index.js 1020 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626
  1. var mp = Object.defineProperty;
  2. var fp = (r, e, t) => e in r ? mp(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
  3. var w = (r, e, t) => fp(r, typeof e != "symbol" ? e + "" : e, t);
  4. import { DOCS_VIEW_KEY as gp, getCanvasOffsetByEngine as ru, IEditorService as Ss, VIEWPORT_KEY as vo, DOCS_COMPONENT_MAIN_LAYER_INDEX as pp, BreakLineCommand as Sp, DeleteLeftCommand as Cp, DocSelectionRenderService as Sr, ReplaceSnapshotCommand as xh, MoveSelectionOperation as vp, MoveCursorOperation as bp, SetInlineFormatBoldCommand as _p, SetInlineFormatItalicCommand as wp, SetInlineFormatUnderlineCommand as Rp, SetInlineFormatStrikethroughCommand as Ip, SetInlineFormatSubscriptCommand as yp, SetInlineFormatSuperscriptCommand as Mp, SetInlineFormatFontSizeCommand as Pp, SetInlineFormatFontFamilyCommand as Ep, SetInlineFormatTextColorCommand as Oh, SetInlineFormatCommand as Pi, NodePositionConvertToCursor as Ah, getLineBounding as Nh, DOC_VERTICAL_PADDING as Tp, IMEInputCommand as xp, InsertCommand as Op, CoverContentCommand as Ap, IRangeSelectorService as Np } from "@univerjs/docs-ui";
  5. import { Inject as D, Injector as vt, Disposable as ce, useDependency as W, IUniverInstanceService as L, UniverInstanceType as O, ObjectMatrix as Ke, Tools as se, Direction as B, isFormulaString as Kc, isFormulaId as Hp, CellValueType as ln, numfmt as er, createIdentifier as gn, toDisposable as Ae, Rectangle as ae, RANGE_TYPE as j, ICommandService as F, IUndoRedoService as Zt, CommandType as K, sequenceExecute as pl, createInterceptorKey as sr, ColorKit as Tn, convertCellToRange as bo, Quantity as sc, InterceptorManager as Cs, ThemeService as kt, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Le, EDITOR_ACTIVATED as Je, FOCUSING_EDITOR_STANDALONE as Sl, IContextService as Ne, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Te, Workbook as Vp, Optional as Jc, FOCUSING_SHEET as Tt, RxDisposable as kn, DisposableCollection as St, IPermissionService as $e, fromEventSubject as Hh, sortRules as kp, LocaleService as Ee, getReverseDirection as Vh, VerticalAlign as an, HorizontalAlign as wt, WrapStrategy as Cr, FOCUSING_UNIVER_EDITOR as Tr, FOCUSING_COMMON_DRAWINGS as Cl, FOCUSING_FX_BAR_EDITOR as Ht, FOCUSING_EDITOR_INPUT_FORMULA as _o, LocaleType as su, FOCUSING_EDITOR_BUT_HIDDEN as ic, DEFAULT_EMPTY_DOCUMENT_VALUE as kh, LRUMap as Dp, BaselineOffset as iu, BooleanNumber as Qe, DataStreamTreeTokenType as Lp, skipParseTagNames as Wp, generateRandomId as Dh, CustomRangeType as $c, DEFAULT_WORKSHEET_ROW_HEIGHT as oc, ErrorService as Bp, CellModeEnum as Lh, ILogService as vl, isNotNullOrUndefined as Fp, extractPureTextFromCell as Wh, UserManagerService as Dt, FontWeight as Yi, FontItalic as Zi, DEFAULT_STYLES as ed, Dimension as Bh, BorderStyleTypes as Pe, AbsoluteRefType as ou, useObservable as is, IConfigService as xr, nameCharacterCheck as Up, debounce as Fh, NilCommand as td, connectInjector as Qr, UndoCommandId as jp, Range as co, cellToRange as Xp, convertBodyToHtml as zp, handleStyleToString as lu, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY as au, DEFAULT_WORKSHEET_COLUMN_WIDTH as cu, PresetListType as Yp, isRealNum as Uh, InterceptorEffectEnum as Zp, splitIntoGrid as Gp, IAuthzIoService as bl, isValidRange as qp, DependentOn as jh, Plugin as Xh, DocumentFlavor as Qp, merge as Kp, registerDependencies as du, mergeOverrideWithDependencies as Jp, touchDependencies as Gi } from "@univerjs/core";
  6. import { SpreadsheetSkeleton as $p, IRenderManagerService as Ce, SHEET_VIEWPORT_KEY as z, CURSOR_TYPE as Re, Vector2 as Oe, Rect as ge, ScrollTimer as Kr, ScrollTimerType as It, DashedRect as eS, Group as ua, TRANSFORM_CHANGE_OBSERVABLE_TYPE as zh, cancelRequestFrame as tS, requestNewFrame as nS, FIX_ONE_PIXEL_BLUR_OFFSET as rS, Layer as sS, DeviceInputEventType as Xe, convertTextRotation as nd, RENDER_RAW_FORMULA_KEY as iS, Spreadsheet as Yh, RENDER_CLASS_TYPE as oS, ScrollBar as rd, fixLineWidthByScale as uu, ptToPixel as hu, Shape as sd, SHEET_EXTENSION_PREFIX as mu, SpreadsheetRowHeader as lS, SpreadsheetColumnHeader as aS, Viewport as Cn, hasCJKText as cS, DEFAULT_PADDING_DATA as dS, SheetExtension as Zh, RegularPolygon as Ws, precisionTo as qn } from "@univerjs/engine-render";
  7. import { useObservable as Yt, KeyCode as Z, ILayoutService as _l, MetaKeys as ye, DEFAULT_BACKGROUND_COLOR_RGB as uS, DEFAULT_BACKGROUND_COLOR_RGBA as hS, handleStringToStyle as mS, textTrim as fu, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as gu, HTML_CLIPBOARD_MIME_TYPE as pu, IClipboardInterfaceService as wl, INotificationService as fS, IPlatformService as gS, CopyCommand as pS, CutCommand as SS, PasteCommand as CS, SheetPasteShortKeyCommandName as vS, IConfirmService as tn, IContextMenuService as Rl, MenuItemType as Q, getMenuHiddenObservable as oe, FONT_FAMILY_LIST as bS, FONT_SIZE_LIST as _S, ISidebarService as vs, IDialogService as bs, ComponentManager as Dn, useSidebarClick as wo, DISABLE_AUTO_FOCUS_KEY as Su, useEvent as Cu, useComponentsOfPart as Gh, ComponentContainer as qh, UI_PLUGIN_CONFIG_KEY as Qh, UIMenu as wS, ContextMenuPosition as Ct, IMessageService as Kh, IMenuManagerService as id, ToolbarItem as RS, RibbonStartGroup as ha, ContextMenuGroup as Ge, FontFamily as Jh, FontFamilyItem as $h, FontSize as em, BuiltInUIPart as js, IShortcutService as Il, IUIPartsService as yl, ICanvasPopupService as IS, IZenZoneService as yS, UniverMobileUIPlugin as MS } from "@univerjs/ui";
  8. import od, { useMemo as sn, useState as te, useEffect as be, forwardRef as ht, useRef as xn, createElement as at, useCallback as On, useLayoutEffect as PS } from "react";
  9. import { BehaviorSubject as Me, of as Ie, merge as mt, map as _e, startWith as Vt, Subject as xe, switchMap as We, takeUntil as os, distinctUntilChanged as cn, throttleTime as tm, filter as Ml, combineLatest as ot, debounceTime as Ei, Observable as it, combineLatestWith as ir, Subscription as Kn, withLatestFrom as ES, EMPTY as vu } from "rxjs";
  10. import { SheetInterceptorService as Ln, SheetsSelectionsService as $, SetWorksheetRowAutoHeightMutationFactory as nm, SetWorksheetRowAutoHeightMutation as _r, SetRangeValuesCommand as Ti, SetWorksheetRowIsAutoHeightCommand as Pl, SetStyleCommand as TS, MoveRangeCommand as ld, ReorderRangeCommand as xS, SetSelectionsOperation as He, SetRangeValuesMutation as Se, getSheetCommandTarget as Ue, generateNullCellValue as OS, SetRangeValuesUndoMutationFactory as en, SELECTION_CONTROL_BORDER_BUFFER_WIDTH as Ro, SELECTION_CONTROL_BORDER_BUFFER_COLOR as qi, SELECTIONS_ENABLED as Yr, REF_SELECTIONS_ENABLED as Js, BEFORE_CELL_EDIT as AS, IRefSelectionsService as El, SetWorksheetActiveOperation as et, MoveRangeMutation as tr, RemoveRowMutation as xi, RemoveColMutation as Oi, InsertRowMutation as Ai, InsertColMutation as Ni, MoveRowsMutation as Tl, MoveColsMutation as xl, SetWorksheetColWidthMutation as Qt, SetWorksheetRowHeightMutation as $s, RemoveSheetMutation as An, RemoveMergeUndoMutationFactory as Ol, RemoveWorksheetMergeMutation as Kt, AddWorksheetMergeMutation as Jt, getAddMergeMutationRangeByType as Al, AddMergeUndoMutationFactory as Nl, WorkbookEditablePermission as q, WorksheetEditPermission as ee, UnitAction as ad, alignToMergedCellsBorders as En, getSelectionsService as Hi, getCellAtRowCol as uo, SelectionMoveType as Xt, expandToContinuousRange as NS, ScrollToCellOperation as cd, COMMAND_LISTENER_SKELETON_CHANGE as Io, SetWorksheetActivateCommand as dd, getPrimaryForRange as rm, SetRowHiddenCommand as sm, SetColHiddenCommand as im, SetBoldCommand as ud, SetItalicCommand as hd, SetUnderlineCommand as md, SetStrikeThroughCommand as fd, SetFontSizeCommand as gd, SetFontFamilyCommand as pd, SetTextColorCommand as om, SetFrozenMutationFactory as lm, SetFrozenMutation as vr, IExclusiveRangeService as HS, RangeProtectionRuleModel as Ye, WorksheetProtectionRuleModel as ft, RangeProtectionPermissionEditPoint as re, WorksheetCopyPermission as yo, WorksheetSetCellStylePermission as ze, ResetBackgroundColorCommand as am, SetBackgroundColorCommand as Mo, SetHorizontalTextAlignCommand as lc, SetVerticalTextAlignCommand as ac, SetTextWrapCommand as cc, SetTextRotationCommand as dc, WorkbookCopyPermission as Bs, RangeProtectionPermissionViewPoint as uc, WorksheetSetCellValuePermission as Ut, WorksheetSetColumnStylePermission as Or, WorksheetSetRowStylePermission as Ar, CancelFrozenCommand as ho, SetRowHiddenMutation as Sd, SetRowVisibleMutation as Cd, SetSelectedRowsVisibleCommand as cm, SetColHiddenMutation as vd, SetColVisibleMutation as bd, SetSelectedColsVisibleCommand as dm, SetRowHeightCommand as um, SetWorksheetRowIsAutoHeightMutation as hm, SetColWidthCommand as mm, SetFrozenCommand as VS, InsertRangeMoveDownCommand as hc, InsertRangeMoveRightCommand as mc, InsertRowCommand as kS, InsertColCommand as DS, MoveColsCommand as fm, MoveRowsCommand as gm, RemoveColCommand as pm, RemoveRowCommand as Sm, MergeCellController as LS, MERGE_CELL_INTERCEPTOR_CHECK as WS, DeltaRowHeightCommand as BS, DeltaColumnWidthCommand as FS, COMMAND_LISTENER_VALUE_CHANGE as US, AddMergeRedoSelectionsOperationFactory as jS, AddMergeUndoSelectionsOperationFactory as XS, DeleteRangeMoveLeftCommand as bu, DeleteRangeMoveUpCommand as _u, UnitObject as At, ViewStateEnum as ls, EditStateEnum as on, DeleteWorksheetProtectionCommand as Po, DeleteRangeProtectionMutation as wu, AddRangeProtectionMutation as zS, RemoveSheetCommand as YS, AddWorksheetProtectionCommand as Cm, BorderStyleManagerService as fc, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as gc, InsertDefinedNameCommand as ZS, SetDefinedNameCommand as GS, RemoveDefinedNameCommand as qS, SetWorksheetShowCommand as _d, SetWorksheetOrderMutation as wd, InsertSheetMutation as Nr, SetWorksheetNameMutation as Rd, SetWorksheetHideMutation as nr, SetWorksheetNameCommand as QS, SetWorksheetOrderCommand as KS, WorkbookManageCollaboratorPermission as vm, WorkbookRenameSheetPermission as bm, SetTabColorMutation as JS, WorkbookCreateSheetPermission as _m, InsertSheetCommand as $S, SetBorderBasicCommand as pc, ClearSelectionContentCommand as Xs, ClearSelectionFormatCommand as zs, ClearSelectionAllCommand as mo, WorksheetDeleteColumnPermission as eC, WorksheetDeleteRowPermission as tC, ToggleGridlinesCommand as wm, ToggleGridlinesMutation as nC, WorksheetInsertColumnPermission as Hl, WorksheetInsertRowPermission as Id, InsertRowBeforeCommand as Sc, InsertRowAfterCommand as Rm, InsertColBeforeCommand as Cc, InsertColAfterCommand as Im, RemoveWorksheetMergeCommand as ym, WorksheetManageCollaboratorPermission as rC, RangeProtectionCache as Vl, WorkbookCreateProtectPermission as kl, WorksheetDeleteProtectionPermission as Mm, CopySheetCommand as Pm, SetTabColorCommand as Em, SetWorksheetHideCommand as Tm, WorkbookDeleteSheetPermission as sC, WorkbookHideSheetPermission as xm, ResetTextColorCommand as iC, AddWorksheetMergeCommand as oC, AddWorksheetMergeAllCommand as lC, AddWorksheetMergeVerticalCommand as aC, AddWorksheetMergeHorizontalCommand as cC, RefRangeService as dC, MAX_CELL_PER_SHEET_KEY as uC, INTERCEPTOR_POINT as hC, SheetPermissionCheckController as Om, INumfmtService as mC, WorksheetViewPermission as fC, SetProtectionCommand as gC, AddRangeProtectionCommand as pC, setEndForRange as SC, baseProtectionActions as CC, DeleteRangeProtectionCommand as vC, WorksheetProtectionPointModel as bC, SetWorksheetPermissionPointsCommand as _C, getAllWorksheetPermissionPoint as wC, convertSelectionDataToRange as Am, UniverSheetsPlugin as Nm, RefSelectionsService as Hm, ToggleCellCheckboxCommand as RC, SetSpecificRowsVisibleCommand as IC, SetSpecificColsVisibleCommand as yC } from "@univerjs/sheets";
  11. import { DocSkeletonManagerService as Jn, DocSelectionManagerService as yd, RichTextEditingMutation as Eo, SetTextSelectionsOperation as Vi } from "@univerjs/docs";
  12. import { sequenceNodeType as ma, matchToken as Vm, LexerTreeBuilder as km, IFunctionService as Dm, SetFormulaCalculationNotificationMutation as MC, IDefinedNamesService as ki, operatorToken as Xr, isReferenceStrings as Lm, isReferenceStringWithEffectiveColumn as PC, serializeRangeWithSheet as Wm, FUNCTION_NAMES_STATISTICAL as Fe, FUNCTION_NAMES_MATH as Dl, FUNCTION_NAMES_TEXT as EC, NullValueObject as Ru, serializeRange as Bm, deserializeRangeWithSheet as Fm } from "@univerjs/engine-formula";
  13. import { DEFAULT_TEXT_FORMAT as TC } from "@univerjs/engine-numfmt";
  14. import { InputNumber as xC, DropdownLegacy as ei, ColorPicker as Md, Menu as OC, MenuItem as AC, Input as ti, RadioGroup as vc, Radio as Zr, Select as Um, Button as fn, Tooltip as Gn, Confirm as NC, Slider as HC, DropdownProvider as jm, DropdownTrigger as Xm, DropdownOverlay as zm, MessageType as Ym, FormLayout as To, Avatar as Pd, Switch as VC } from "@univerjs/design";
  15. import { ITelemetryService as kC } from "@univerjs/telemetry";
  16. import { filter as Zm } from "rxjs/operators";
  17. function Ed(r, e) {
  18. if (r == null)
  19. return;
  20. const t = e.getRenderById(r);
  21. if (t == null)
  22. return;
  23. const { mainComponent: n, scene: s, engine: i, components: o } = t, l = n, a = o.get(gp.BACKGROUND);
  24. return {
  25. document: l,
  26. docBackground: a,
  27. scene: s,
  28. engine: i
  29. };
  30. }
  31. function ni(r, e) {
  32. const { startRow: t, startColumn: n, endRow: s, endColumn: i, rangeType: o } = e, l = s < t ? s : t, a = s < t ? t : s, c = i < n ? i : n, d = i < n ? n : i, u = r.getNoMergeCellPositionByIndex(l, c), h = r.getNoMergeCellPositionByIndex(a, d);
  33. return {
  34. startRow: t,
  35. startColumn: n,
  36. endRow: s,
  37. endColumn: i,
  38. rangeType: o,
  39. startY: (u == null ? void 0 : u.startY) || 0,
  40. endY: (h == null ? void 0 : h.endY) || 0,
  41. startX: (u == null ? void 0 : u.startX) || 0,
  42. endX: (h == null ? void 0 : h.endX) || 0
  43. };
  44. }
  45. function Pt(r, e) {
  46. const { range: t, primary: n, style: s } = r, i = ni(e, t), o = n && xo(e, n);
  47. return {
  48. rangeWithCoord: i,
  49. primaryWithCoord: o,
  50. style: s
  51. };
  52. }
  53. function xo(r, e) {
  54. const { actualRow: t, actualColumn: n, isMerged: s, isMergedMainCell: i, startRow: o, startColumn: l, endRow: a, endColumn: c } = e, d = r.getNoMergeCellPositionByIndex(t, n), u = r.getNoMergeCellPositionByIndex(o, l), h = r.getNoMergeCellPositionByIndex(a, c);
  55. return {
  56. actualRow: t,
  57. actualColumn: n,
  58. isMerged: s,
  59. isMergedMainCell: i,
  60. startX: d.startX,
  61. startY: d.startY,
  62. endX: d.endX,
  63. endY: d.endY,
  64. mergeInfo: {
  65. startRow: o,
  66. startColumn: l,
  67. endRow: a,
  68. endColumn: c,
  69. startY: (u == null ? void 0 : u.startY) || 0,
  70. endY: (h == null ? void 0 : h.endY) || 0,
  71. startX: (u == null ? void 0 : u.startX) || 0,
  72. endX: (h == null ? void 0 : h.endX) || 0
  73. }
  74. };
  75. }
  76. var DC = Object.defineProperty, LC = Object.getOwnPropertyDescriptor, WC = (r, e, t, n) => {
  77. for (var s = n > 1 ? void 0 : n ? LC(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  78. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  79. return n && s && DC(e, t, s), s;
  80. }, BC = (r, e) => (t, n) => e(t, n, r);
  81. let me = class extends ce {
  82. constructor(e, t) {
  83. super();
  84. w(this, "_currentSkeletonSearchParam", {
  85. sheetId: ""
  86. });
  87. w(this, "_sheetSkeletonParam", []);
  88. w(this, "_currentSkeleton$", new Me(null));
  89. w(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
  90. /**
  91. * CurrentSkeletonBefore for pre-triggered logic during registration
  92. */
  93. w(this, "_currentSkeletonBefore$", new Me(null));
  94. w(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
  95. this._context = e, this._injector = t, this.disposeWithMe(() => {
  96. this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._sheetSkeletonParam = [];
  97. }), this._initRemoveSheet();
  98. }
  99. _initRemoveSheet() {
  100. this.disposeWithMe(this._context.unit.sheetDisposed$.subscribe((e) => {
  101. this.disposeSkeleton({
  102. sheetId: e.getSheetId()
  103. });
  104. }));
  105. }
  106. getCurrentSkeleton() {
  107. var e;
  108. return (e = this.getCurrent()) == null ? void 0 : e.skeleton;
  109. }
  110. getCurrent() {
  111. return this._getSkeleton(this._currentSkeletonSearchParam);
  112. }
  113. getWorksheetSkeleton(e) {
  114. return this._getSkeleton({ sheetId: e });
  115. }
  116. /**
  117. * unitId is never read?
  118. */
  119. getUnitSkeleton(e, t) {
  120. const n = this._getSkeleton({ sheetId: t });
  121. return n != null && (n.unitId = e), n;
  122. }
  123. setCurrent(e) {
  124. this._setCurrent(e);
  125. }
  126. _setCurrent(e) {
  127. const t = this._getSkeleton(e), n = this._context.unitId;
  128. if (t != null)
  129. this._reCalculate(t);
  130. else {
  131. const { sheetId: o } = e, a = this._context.unit.getSheetBySheetId(e.sheetId);
  132. if (a == null)
  133. return;
  134. const c = this._buildSkeleton(a);
  135. this._sheetSkeletonParam.push({
  136. unitId: n,
  137. sheetId: o,
  138. skeleton: c,
  139. dirty: !1
  140. });
  141. }
  142. this._currentSkeletonSearchParam = e;
  143. const s = this._currentSkeletonSearchParam.sheetId, i = this.getUnitSkeleton(n, s);
  144. this._currentSkeletonBefore$.next(i), this._currentSkeleton$.next(i);
  145. }
  146. reCalculate() {
  147. const e = this.getCurrent();
  148. e != null && this._reCalculate(e);
  149. }
  150. _reCalculate(e) {
  151. e.dirty && (e.skeleton.makeDirty(!0), e.dirty = !1), e.skeleton.calculate();
  152. }
  153. /**
  154. * Make param dirty, if param is dirty, then the skeleton will be makeDirty in _reCalculate()
  155. * @param searchParm
  156. * @param state
  157. */
  158. makeDirty(e, t = !0) {
  159. const n = this._getSkeleton(e);
  160. n != null && (n.dirty = t);
  161. }
  162. getOrCreateSkeleton(e) {
  163. const t = this._getSkeleton(e);
  164. if (t)
  165. return t.skeleton;
  166. const s = this._context.unit.getSheetBySheetId(e.sheetId);
  167. if (!s)
  168. return;
  169. const i = this._buildSkeleton(s);
  170. return this._sheetSkeletonParam.push({
  171. unitId: this._context.unitId,
  172. sheetId: e.sheetId,
  173. skeleton: i,
  174. dirty: !1
  175. }), i;
  176. }
  177. disposeSkeleton(e) {
  178. const t = this._sheetSkeletonParam.findIndex((n) => n.sheetId === e.sheetId);
  179. t > -1 && (this._sheetSkeletonParam[t].skeleton.dispose(), this._sheetSkeletonParam.splice(t, 1));
  180. }
  181. /** @deprecated Use function `attachRangeWithCoord` instead. */
  182. attachRangeWithCoord(e) {
  183. const t = this.getCurrentSkeleton();
  184. return t ? ni(t, e) : null;
  185. }
  186. _getSkeleton(e) {
  187. const t = this._sheetSkeletonParam.find((n) => n.sheetId === e.sheetId);
  188. return t != null && (t.commandId = e.commandId), t;
  189. }
  190. _buildSkeleton(e) {
  191. return this._injector.createInstance(
  192. $p,
  193. e,
  194. this._context.unit.getStyles()
  195. );
  196. }
  197. };
  198. me = WC([
  199. BC(1, D(vt))
  200. ], me);
  201. function Wn() {
  202. const r = W(L), e = Yt(() => r.getCurrentTypeOfUnit$(O.UNIVER_SHEET), void 0, void 0, []);
  203. return e != null ? e : null;
  204. }
  205. function J2(r) {
  206. return Yt(() => {
  207. var t;
  208. return (t = r == null ? void 0 : r.activeSheet$) != null ? t : Ie(null);
  209. }, void 0, void 0, [r]);
  210. }
  211. function $2() {
  212. const r = W(L);
  213. return Yt(() => mt([
  214. r.getTypeOfUnitAdded$(O.UNIVER_SHEET),
  215. r.getTypeOfUnitDisposed$(O.UNIVER_SHEET)
  216. ]).pipe(
  217. _e(() => r.getAllUnitsForType(O.UNIVER_SHEET)),
  218. Vt(r.getAllUnitsForType(O.UNIVER_SHEET))
  219. ), [], void 0, [r]);
  220. }
  221. function FC() {
  222. const r = W(Ce), e = Wn(), { sheetSkeletonManagerService: t } = sn(() => {
  223. if (e) {
  224. const n = r.getRenderById(e.getUnitId());
  225. return {
  226. sheetSkeletonManagerService: n == null ? void 0 : n.with(me)
  227. };
  228. }
  229. return { sheetSkeletonManagerService: null };
  230. }, [e, r]);
  231. return t;
  232. }
  233. const eE = "SheetUI";
  234. var Gm = /* @__PURE__ */ ((r) => (r.FILTER_PANEL_EMBED_POINT = "filter-panel-embed-point", r.SHEETS_FOOTER = "sheets-footer", r.FORMULA_AUX = "formula-aux", r))(Gm || {}), UC = Object.defineProperty, jC = Object.getOwnPropertyDescriptor, XC = (r, e, t, n) => {
  235. for (var s = n > 1 ? void 0 : n ? jC(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  236. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  237. return n && s && UC(e, t, s), s;
  238. }, Qi = (r, e) => (t, n) => e(t, n, r);
  239. const qm = ["ff", "fs", "tr", "tb"];
  240. let ri = class extends ce {
  241. constructor(r, e, t, n) {
  242. super(), this._renderManagerService = r, this._sheetInterceptorService = e, this._selectionManagerService = t, this._univerInstanceService = n, this._initialize();
  243. }
  244. getUndoRedoParamsOfAutoHeight(r) {
  245. const { _univerInstanceService: e } = this, t = e.getCurrentUnitForType(O.UNIVER_SHEET), n = t.getActiveSheet(), s = t.getUnitId(), i = n.getSheetId(), o = this._renderManagerService.getRenderById(s).with(me);
  246. if (!i || !o.getCurrent())
  247. return {
  248. redos: [],
  249. undos: []
  250. };
  251. const { skeleton: l } = o.getCurrent(), a = l.calculateAutoHeightInRange(r), c = {
  252. subUnitId: i,
  253. unitId: s,
  254. rowsAutoHeightInfo: a
  255. }, d = nm(c, n);
  256. return {
  257. undos: [
  258. {
  259. id: _r.id,
  260. params: d
  261. }
  262. ],
  263. redos: [
  264. {
  265. id: _r.id,
  266. params: c
  267. }
  268. ]
  269. };
  270. }
  271. // eslint-disable-next-line max-lines-per-function
  272. _initialize() {
  273. const { _sheetInterceptorService: r, _selectionManagerService: e } = this;
  274. this.disposeWithMe(r.interceptCommand({
  275. getMutations: (t) => {
  276. if (t.id === Ti.id) {
  277. const n = t.params;
  278. return this.getUndoRedoParamsOfAutoHeight(n.range);
  279. }
  280. return {
  281. redos: [],
  282. undos: []
  283. };
  284. }
  285. })), this.disposeWithMe(r.interceptCommand({
  286. getMutations: (t) => t.id !== Pl.id ? {
  287. redos: [],
  288. undos: []
  289. } : this.getUndoRedoParamsOfAutoHeight(t.params.ranges)
  290. })), this.disposeWithMe(r.interceptCommand({
  291. getMutations: (t) => {
  292. var s, i;
  293. if (t.id !== TS.id)
  294. return {
  295. redos: [],
  296. undos: []
  297. };
  298. if (!qm.includes((s = t.params) == null ? void 0 : s.style.type))
  299. return {
  300. redos: [],
  301. undos: []
  302. };
  303. const n = (i = e.getCurrentSelections()) == null ? void 0 : i.map((o) => o.range);
  304. return n != null && n.length ? this.getUndoRedoParamsOfAutoHeight(n) : {
  305. redos: [],
  306. undos: []
  307. };
  308. }
  309. })), this.disposeWithMe(r.interceptAfterCommand({
  310. getMutations: (t) => {
  311. if (t.id === ld.id) {
  312. const n = t.params;
  313. return this.getUndoRedoParamsOfAutoHeight([n.fromRange, n.toRange]);
  314. }
  315. if (t.id === xS.id) {
  316. const n = t.params;
  317. return this.getUndoRedoParamsOfAutoHeight([n.range]);
  318. }
  319. return {
  320. redos: [],
  321. undos: []
  322. };
  323. }
  324. }));
  325. }
  326. };
  327. ri = XC([
  328. Qi(0, Ce),
  329. Qi(1, D(Ln)),
  330. Qi(2, D($)),
  331. Qi(3, D(L))
  332. ], ri);
  333. function Ys(r, e, t, n) {
  334. const s = e.get(L), i = t ? s.getUnit(t, O.UNIVER_SHEET) : s.getCurrentUnitForType(O.UNIVER_SHEET), o = n ? i == null ? void 0 : i.getSheetBySheetId(n) : i == null ? void 0 : i.getActiveSheet();
  335. if (!o)
  336. return null;
  337. const { startRow: l, endRow: a, startColumn: c, endColumn: d } = r, u = [], h = [];
  338. for (let m = l; m <= a; m++)
  339. o.getRowFiltered(m) || u.push(m);
  340. for (let m = c; m <= d; m++)
  341. h.push(m);
  342. return {
  343. rows: u,
  344. cols: h
  345. };
  346. }
  347. function wr(r) {
  348. const { rows: e, cols: t } = r;
  349. return {
  350. startRow: e[0],
  351. endRow: e[e.length - 1],
  352. startColumn: t[0],
  353. endColumn: t[t.length - 1]
  354. };
  355. }
  356. function _s(r) {
  357. let e = [], t = [];
  358. const n = [];
  359. return r.forEach((s) => {
  360. e = e.concat(s.rows), t = t.concat(s.cols);
  361. }), e = Array.from(new Set(e)).sort((s, i) => s - i), t = Array.from(new Set(t)).sort((s, i) => s - i), r.forEach((s) => {
  362. n.push({
  363. startRow: e.findIndex((i) => i === s.rows[0]),
  364. endRow: e.findIndex((i) => i === s.rows[s.rows.length - 1]),
  365. startColumn: t.findIndex((i) => i === s.cols[0]),
  366. endColumn: t.findIndex((i) => i === s.cols[s.cols.length - 1])
  367. });
  368. }), {
  369. ranges: n,
  370. mapFunc: (s, i) => ({
  371. row: e[s],
  372. col: t[i]
  373. })
  374. };
  375. }
  376. function zC(r) {
  377. const e = new Ke();
  378. return r.forEach((t) => {
  379. const { rows: n, cols: s } = t;
  380. n.forEach((i) => {
  381. s.forEach((o) => {
  382. e.setValue(i, o, {
  383. v: null,
  384. p: null,
  385. f: null,
  386. si: null,
  387. custom: null
  388. });
  389. });
  390. });
  391. }), e.getData();
  392. }
  393. const bc = { 零: 0, 一: 1, 二: 2, 三: 3, 四: 4, 五: 5, 六: 6, 七: 7, 八: 8, 九: 9 }, Oo = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"], Iu = ["", "万", "亿", "万亿", "亿亿"], YC = ["", "十", "百", "千"], Qm = {
  394. 十: { value: 10, secUnit: !1 },
  395. 百: { value: 100, secUnit: !1 },
  396. 千: { value: 1e3, secUnit: !1 },
  397. 万: { value: 1e4, secUnit: !0 },
  398. 亿: { value: 1e8, secUnit: !0 }
  399. };
  400. function Pn(r) {
  401. if (!r)
  402. return 0;
  403. let e = 0, t = 0, n = 0, s = !1;
  404. const i = r.split("");
  405. for (let o = 0; o < i.length; o++) {
  406. const l = bc[i[o]];
  407. if (typeof l < "u")
  408. n = l, o === i.length - 1 && (t += n);
  409. else {
  410. const a = Qm[i[o]], c = a.value;
  411. s = a.secUnit, s ? (t = (t + n) * c, e += t, t = 0) : t += n * c, n = 0;
  412. }
  413. }
  414. return e + t;
  415. }
  416. function ZC(r) {
  417. let e = "", t = "", n = 0, s = !0;
  418. for (; r > 0; ) {
  419. const i = r % 10;
  420. i === 0 ? s || (s = !0, t = Oo[i] + t) : (s = !1, e = Oo[i], e += YC[n], t = e + t), n++, r = Math.floor(r / 10);
  421. }
  422. return t;
  423. }
  424. function GC(r) {
  425. let e = 0, t = "", n = "", s = !1;
  426. if (r === 0)
  427. return Oo[0];
  428. for (; r > 0; ) {
  429. const i = r % 1e4;
  430. s && (n = Oo[0] + n), t = ZC(i), t += i !== 0 ? Iu[e] : Iu[0], n = t + n, s = i < 1e3 && i > 0, r = Math.floor(r / 1e4), e++;
  431. }
  432. return n;
  433. }
  434. function qC(r) {
  435. if (!r)
  436. return !1;
  437. let e = !0;
  438. if (r)
  439. if (r.length === 1)
  440. r === "日" || r in bc ? e = !0 : e = !1;
  441. else {
  442. const t = r.split("");
  443. for (let n = 0; n < t.length; n++)
  444. if (!(t[n] in bc || t[n] in Qm)) {
  445. e = !1;
  446. break;
  447. }
  448. }
  449. return e;
  450. }
  451. function Ki(r) {
  452. if (!r)
  453. return {
  454. isExtendNumber: !1
  455. };
  456. const e = /0|([1-9]+[0-9]*)/g, t = e.test(r);
  457. if (t) {
  458. const n = r.match(e);
  459. if (n && n.length > 0) {
  460. const s = n[n.length - 1], i = r.lastIndexOf(s), o = r.substr(0, i), l = r.substr(i + s.length);
  461. return {
  462. isExtendNumber: !0,
  463. matchTxt: Number(s),
  464. beforeTxt: o,
  465. afterTxt: l
  466. };
  467. }
  468. return {
  469. isExtendNumber: !1
  470. };
  471. }
  472. return {
  473. isExtendNumber: t
  474. };
  475. }
  476. function QC(r) {
  477. let e;
  478. return r.length === 2 && (r === "周一" || r === "周二" || r === "周三" || r === "周四" || r === "周五" || r === "周六" || r === "周日") ? e = !0 : e = !1, e;
  479. }
  480. function KC(r) {
  481. let e;
  482. return r.length === 3 && (r === "星期一" || r === "星期二" || r === "星期三" || r === "星期四" || r === "星期五" || r === "星期六" || r === "星期日") ? e = !0 : e = !1, e;
  483. }
  484. function JC(r, e) {
  485. let t = 0;
  486. for (let n = 0; n < r.length && r[n] < e; n++)
  487. t++;
  488. return t;
  489. }
  490. function Di(r) {
  491. let e = !0;
  492. const t = r[1] - r[0];
  493. for (let n = 1; n < r.length; n++)
  494. if (r[n] - r[n - 1] !== t) {
  495. e = !1;
  496. break;
  497. }
  498. return e;
  499. }
  500. function $C(r, e, t) {
  501. const n = [], s = Math.floor(e / r), i = e % r;
  502. let o = 0;
  503. if (s > 0) {
  504. for (let l = 0; l < s; l++)
  505. for (let a = 0; a < t.length; a++)
  506. n[t[a] + l * r] = o, o++;
  507. for (let l = 0; l < t.length && t[l] < i; l++)
  508. n[t[l] + r * s] = o, o++;
  509. } else
  510. for (let l = 0; l < t.length && t[l] < i; l++)
  511. n[t[l]] = o, o++;
  512. return n;
  513. }
  514. function Rr(r, e) {
  515. const t = [];
  516. for (let n = 1; n <= e; n++) {
  517. const s = (n - 1) % r.length, i = se.deepClone(r[s]);
  518. Ir(i), t.push({
  519. v: null,
  520. s: null,
  521. p: null,
  522. f: null,
  523. si: null,
  524. t: null,
  525. ...i
  526. });
  527. }
  528. return t;
  529. }
  530. function ev(r, e) {
  531. var n;
  532. const t = [];
  533. for (let s = 1; s <= e; s++) {
  534. const i = (s - 1) % r.length, o = { s: (n = r[i]) == null ? void 0 : n.s };
  535. t.push(o);
  536. }
  537. return t;
  538. }
  539. function tv(r) {
  540. let e = !0;
  541. const t = r[1] / r[0];
  542. for (let n = 1; n < r.length; n++)
  543. if (r[n] / r[n - 1] !== t) {
  544. e = !1;
  545. break;
  546. }
  547. return e;
  548. }
  549. function nv(r) {
  550. const e = [];
  551. for (let t = 1; t <= r; t++)
  552. e.push(t);
  553. return e;
  554. }
  555. function Ao(r, e, t) {
  556. var i, o, l, a;
  557. const n = [], s = [];
  558. for (let c = 0; c < r.length; c++)
  559. s.push(Number((i = r[c]) == null ? void 0 : i.v));
  560. if (r.length > 2 && tv(s))
  561. for (let c = 1; c <= e; c++) {
  562. const d = (c - 1) % r.length, u = se.deepClone(r[d]);
  563. Ir(u);
  564. const h = Number((o = r[r.length - 1]) == null ? void 0 : o.v) * (Number((l = r[1]) == null ? void 0 : l.v) / Number((a = r[0]) == null ? void 0 : a.v)) ** c;
  565. u && (Eu(u) && (u.v = h), n.push(u));
  566. }
  567. else {
  568. const c = nv(r.length);
  569. for (let d = 1; d <= e; d++) {
  570. const u = (d - 1) % r.length, h = se.deepClone(r[u]);
  571. Ir(h);
  572. const m = t === B.DOWN || t === B.RIGHT, f = rv(r.length + d, s, c, m);
  573. h && (Eu(h) && (h.v = f), n.push(h));
  574. }
  575. }
  576. return n;
  577. }
  578. function rv(r, e, t, n = !0) {
  579. function s(u) {
  580. let h = 0;
  581. for (let m = 0; m < u.length; m++)
  582. h += u[m];
  583. return h / u.length;
  584. }
  585. const i = s(t), o = s(e);
  586. let l = 0, a = 0;
  587. for (let u = 0; u < t.length; u++)
  588. l += (t[u] - i) * (e[u] - o), a += (t[u] - i) * (t[u] - i);
  589. let c;
  590. a === 0 ? c = n ? 1 : -1 : c = l / a;
  591. const d = o - c * i;
  592. return Math.round((d + c * r) * 1e5) / 1e5;
  593. }
  594. function yu(r, e, t) {
  595. var i;
  596. const n = [], s = /0|([1-9]+[0-9]*)/g;
  597. for (let o = 1; o <= e; o++) {
  598. const l = (o - 1) % r.length, a = se.deepClone(r[l]);
  599. Ir(a);
  600. const c = `${(i = r[r.length - 1]) == null ? void 0 : i.v}`, d = c == null ? void 0 : c.match(s), u = d == null ? void 0 : d[d.length - 1], h = Math.abs(Number(u) + t * o);
  601. if (!c || !u) continue;
  602. const m = c.lastIndexOf(u), f = c.substr(0, m) + h.toString() + c.substr(m + u.length);
  603. a && (a.v = f, n.push(a));
  604. }
  605. return n;
  606. }
  607. function as(r, e, t, n = 0) {
  608. var l, a;
  609. const s = [
  610. ["日", "一", "二", "三", "四", "五", "六"],
  611. ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  612. ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
  613. ];
  614. if (n >= s.length) return [];
  615. const i = s[n], o = [];
  616. for (let c = 1; c <= e; c++) {
  617. const d = (c - 1) % r.length, u = se.deepClone(r[d]);
  618. Ir(u);
  619. let h = 0;
  620. if (((l = r[r.length - 1]) == null ? void 0 : l.v) === i[0])
  621. h = 7 + t * c;
  622. else {
  623. const f = `${(a = r[r.length - 1]) == null ? void 0 : a.v}`;
  624. if (f) {
  625. const g = f.substr(f.length - 1, 1);
  626. h = Pn(g) + t * c;
  627. }
  628. }
  629. h < 0 && (h = Math.ceil(Math.abs(h) / 7) * 7 + h);
  630. const m = h % 7;
  631. u && (u.v = i[m], o.push(u));
  632. }
  633. return o;
  634. }
  635. function Mu(r, e, t) {
  636. var s;
  637. const n = [];
  638. for (let i = 1; i <= e; i++) {
  639. const o = (i - 1) % r.length, l = se.deepClone(r[o]);
  640. Ir(l);
  641. const a = `${(s = r[r.length - 1]) == null ? void 0 : s.v}`, c = Pn(a) + t * i;
  642. let d;
  643. c <= 0 ? d = "零" : d = GC(c), l && (l.v = d, n.push(l));
  644. }
  645. return n;
  646. }
  647. const Zs = {
  648. enWeek1: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  649. enWeek2: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  650. enMonth1: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  651. enMonth2: [
  652. "January",
  653. "February",
  654. "March",
  655. "April",
  656. "May",
  657. "June",
  658. "July",
  659. "August",
  660. "September",
  661. "October",
  662. "November",
  663. "December"
  664. ],
  665. chnMonth1: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
  666. chnMonth2: ["正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"],
  667. chHour1: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"],
  668. chHour2: ["子时", "丑时", "寅时", "卯时", "辰时", "巳时", "午时", "未时", "申时", "酉时", "戌时", "亥时"],
  669. chYear1: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"],
  670. chSeason1: ["春", "夏", "秋", "冬"],
  671. chSeason2: ["春季", "夏季", "秋季", "冬季"]
  672. };
  673. function sv(r) {
  674. let e = !1;
  675. return Object.keys(Zs).forEach((t) => {
  676. Zs[t].includes(r) && (e = !0);
  677. }), e;
  678. }
  679. function fa(r) {
  680. let e = "";
  681. const t = [];
  682. return Object.keys(Zs).forEach((n) => {
  683. Zs[n].includes(r) && (e = n, t.push(...Zs[n]));
  684. }), { name: e, series: t };
  685. }
  686. function Pu(r, e, t, n) {
  687. var o;
  688. const s = n.length, i = [];
  689. for (let l = 1; l <= e; l++) {
  690. const a = (l - 1) % r.length, c = se.deepClone(r[a]);
  691. Ir(c);
  692. const d = `${(o = r[r.length - 1]) == null ? void 0 : o.v}`;
  693. let u = n.indexOf(d) + t * l;
  694. u < 0 && (u += Math.abs(t) * s);
  695. const h = u % s;
  696. c && (c.v = n[h], i.push(c));
  697. }
  698. return i;
  699. }
  700. function tE(r, e) {
  701. const t = [];
  702. let n;
  703. if (e.startRow < r.startRow)
  704. n = B.UP;
  705. else if (e.endRow > r.endRow)
  706. n = B.DOWN;
  707. else if (e.startColumn < r.startColumn)
  708. n = B.LEFT;
  709. else if (e.endColumn > r.endColumn)
  710. n = B.RIGHT;
  711. else
  712. return [];
  713. if (n === B.DOWN || n === B.UP) {
  714. const s = r.endRow - r.startRow + 1, i = e.endRow - e.startRow + 1, o = Math.floor(i / s), l = i % s, a = {
  715. startRow: 0,
  716. startColumn: 0,
  717. endRow: r.endRow - r.startRow,
  718. endColumn: r.endColumn - r.startColumn
  719. };
  720. if (n === B.DOWN) {
  721. for (let c = 0; c < o; c++)
  722. t.push({
  723. repeatStartCell: {
  724. row: r.startRow + (c + 1) * s,
  725. col: r.startColumn
  726. },
  727. relativeRange: a
  728. });
  729. l > 0 && t.push({
  730. repeatStartCell: {
  731. row: r.startRow + (o + 1) * s,
  732. col: r.startColumn
  733. },
  734. relativeRange: {
  735. startRow: 0,
  736. startColumn: 0,
  737. endRow: l - 1,
  738. endColumn: r.endColumn - r.startColumn
  739. }
  740. });
  741. } else {
  742. for (let c = 0; c < o; c++)
  743. t.push({
  744. repeatStartCell: {
  745. row: r.startRow - (c + 1) * s,
  746. col: r.startColumn
  747. },
  748. relativeRange: a
  749. });
  750. l > 0 && t.push({
  751. repeatStartCell: {
  752. row: r.startRow - (o + 1) * s,
  753. col: r.startColumn
  754. },
  755. relativeRange: {
  756. startRow: s - l,
  757. endRow: s - 1,
  758. startColumn: 0,
  759. endColumn: r.endColumn - r.startColumn
  760. }
  761. });
  762. }
  763. }
  764. if (n === B.RIGHT || n === B.LEFT) {
  765. const s = r.endColumn - r.startColumn + 1, i = e.endColumn - e.startColumn + 1, o = Math.floor(i / s), l = i % s, a = {
  766. startRow: 0,
  767. startColumn: 0,
  768. endRow: r.endRow - r.startRow,
  769. endColumn: r.endColumn - r.startColumn
  770. };
  771. if (n === B.RIGHT) {
  772. for (let c = 0; c < o; c++)
  773. t.push({
  774. repeatStartCell: {
  775. row: r.startRow,
  776. col: r.startColumn + (c + 1) * s
  777. },
  778. relativeRange: a
  779. });
  780. l > 0 && t.push({
  781. repeatStartCell: {
  782. row: r.startRow,
  783. col: r.startColumn + (o + 1) * s
  784. },
  785. relativeRange: {
  786. startRow: 0,
  787. startColumn: 0,
  788. endRow: r.endRow - r.startRow,
  789. endColumn: l - 1
  790. }
  791. });
  792. } else {
  793. for (let c = 0; c < o; c++)
  794. t.push({
  795. repeatStartCell: {
  796. row: r.startRow,
  797. col: r.startColumn - (c + 1) * s
  798. },
  799. relativeRange: a
  800. });
  801. l > 0 && t.push({
  802. repeatStartCell: {
  803. row: r.startRow,
  804. col: r.startColumn - (o + 1) * s
  805. },
  806. relativeRange: {
  807. startRow: 0,
  808. startColumn: s - l,
  809. endRow: r.endRow - r.startRow,
  810. endColumn: s - 1
  811. }
  812. });
  813. }
  814. }
  815. return t;
  816. }
  817. function Eu(r) {
  818. return !(Kc(r.f) || Hp(r.si) || r.t === ln.BOOLEAN);
  819. }
  820. function Ir(r) {
  821. r && "custom" in r && delete r.custom;
  822. }
  823. var Gr = /* @__PURE__ */ ((r) => (r.Append = "APPEND", r.Default = "DEFAULT", r.Only = "ONLY", r))(Gr || {}), ut = /* @__PURE__ */ ((r) => (r.NUMBER = "number", r.DATE = "date", r.EXTEND_NUMBER = "extendNumber", r.CHN_NUMBER = "chnNumber", r.CHN_WEEK2 = "chnWeek2", r.CHN_WEEK3 = "chnWeek3", r.LOOP_SERIES = "loopSeries", r.FORMULA = "formula", r.OTHER = "other", r))(ut || {}), ke = /* @__PURE__ */ ((r) => (r.COPY = "COPY", r.SERIES = "SERIES", r.ONLY_FORMAT = "ONLY_FORMAT", r.NO_FORMAT = "NO_FORMAT", r))(ke || {});
  824. const iv = {
  825. type: ut.DATE,
  826. priority: 1100,
  827. match: (r, e) => {
  828. var t;
  829. if (r != null && r.f || r != null && r.si)
  830. return !1;
  831. if ((typeof (r == null ? void 0 : r.v) == "number" || (r == null ? void 0 : r.t) === ln.NUMBER) && r.s) {
  832. if (typeof r.s == "string") {
  833. const s = e.get(L).getFocusedUnit().getStyles().get(r.s), i = (t = s == null ? void 0 : s.n) == null ? void 0 : t.pattern;
  834. if (i)
  835. return er.getInfo(i).isDate;
  836. } else if (r.s.n && er.getInfo(r.s.n.pattern).isDate)
  837. return !0;
  838. }
  839. return !1;
  840. },
  841. isContinue: (r, e) => r.type === ut.DATE,
  842. applyFunctions: {
  843. [ke.SERIES]: (r, e, t) => {
  844. const { data: n } = r;
  845. return t === B.LEFT || t === B.UP ? (n.reverse(), Ao(n, e, t).reverse()) : Ao(n, e, t);
  846. }
  847. }
  848. }, ov = {
  849. type: ut.NUMBER,
  850. priority: 1e3,
  851. match: (r) => typeof (r == null ? void 0 : r.v) == "number" || (r == null ? void 0 : r.t) === ln.NUMBER,
  852. isContinue: (r, e) => r.type === ut.NUMBER,
  853. applyFunctions: {
  854. [ke.SERIES]: (r, e, t) => {
  855. const { data: n } = r;
  856. return t === B.LEFT || t === B.UP ? (n.reverse(), Ao(n, e, t).reverse()) : Ao(n, e, t);
  857. }
  858. }
  859. }, Km = {
  860. type: ut.OTHER,
  861. priority: 0,
  862. match: () => !0,
  863. isContinue: (r, e) => r.type === ut.OTHER
  864. }, lv = {
  865. type: ut.EXTEND_NUMBER,
  866. priority: 900,
  867. match: (r) => Ki(`${r == null ? void 0 : r.v}` || "").isExtendNumber,
  868. isContinue: (r, e) => {
  869. var t;
  870. if (r.type === ut.EXTEND_NUMBER) {
  871. const { beforeTxt: n, afterTxt: s } = Ki(`${(t = r.cellData) == null ? void 0 : t.v}` || ""), { beforeTxt: i, afterTxt: o } = Ki(`${e == null ? void 0 : e.v}` || "");
  872. if (n === i && s === o)
  873. return !0;
  874. }
  875. return !1;
  876. },
  877. applyFunctions: {
  878. [ke.SERIES]: (r, e, t) => {
  879. var l;
  880. const { data: n } = r, s = t === B.UP || t === B.LEFT;
  881. let i;
  882. if (n.length === 1)
  883. return i = s ? -1 : 1, jt(yu(n, e, i), s);
  884. const o = [];
  885. for (let a = 0; a < n.length; a++) {
  886. const c = `${(l = n[a]) == null ? void 0 : l.v}`;
  887. c && o.push(Number(Ki(c).matchTxt));
  888. }
  889. return s && (n.reverse(), o.reverse()), Di(o) ? (i = o[1] - o[0], jt(yu(n, e, i), s)) : Rr(n, e);
  890. }
  891. }
  892. }, av = {
  893. type: ut.CHN_NUMBER,
  894. priority: 830,
  895. match: (r) => !!qC(`${r == null ? void 0 : r.v}` || ""),
  896. isContinue: (r, e) => r.type === ut.CHN_NUMBER,
  897. applyFunctions: {
  898. [ke.SERIES]: (r, e, t) => {
  899. var a, c, d;
  900. const { data: n } = r, s = t === B.LEFT || t === B.UP;
  901. if (n.length === 1) {
  902. const u = `${(a = n[0]) == null ? void 0 : a.v}`;
  903. let h;
  904. return s ? h = -1 : h = 1, u && (u === "日" || Pn(u) < 7) ? jt(as(n, e, h), s) : jt(Mu(n, e, h), s);
  905. }
  906. let i = !1;
  907. for (let u = 0; u < n.length; u++)
  908. if (((c = n[u]) == null ? void 0 : c.v) === "日") {
  909. i = !0;
  910. break;
  911. }
  912. const o = [];
  913. let l = 0;
  914. for (let u = 0; u < n.length; u++) {
  915. const h = `${(d = n[u]) == null ? void 0 : d.v}`;
  916. h === "日" ? u === 0 ? o.push(0) : (l++, o.push(l * 7)) : i && Pn(h) > 0 && Pn(h) < 7 ? o.push(Pn(h) + l * 7) : o.push(Pn(h));
  917. }
  918. if (s && (n.reverse(), o.reverse()), Di(o)) {
  919. if (i || o[o.length - 1] < 6 && o[0] > 0 || o[0] < 6 && o[o.length - 1] > 0) {
  920. const h = o[1] - o[0];
  921. return jt(as(n, e, h), s);
  922. }
  923. const u = o[1] - o[0];
  924. return jt(Mu(n, e, u), s);
  925. }
  926. return Rr(n, e);
  927. }
  928. }
  929. }, cv = {
  930. type: ut.CHN_WEEK2,
  931. priority: 820,
  932. match: (r) => !!QC(`${r == null ? void 0 : r.v}` || ""),
  933. isContinue: (r, e) => r.type === ut.CHN_WEEK2,
  934. applyFunctions: {
  935. [ke.SERIES]: (r, e, t) => {
  936. var l;
  937. const { data: n } = r, s = t === B.LEFT || t === B.UP;
  938. if (n.length === 1) {
  939. let a;
  940. return s ? a = -1 : a = 1, jt(as(n, e, a, 1), s);
  941. }
  942. const i = [];
  943. let o = 0;
  944. for (let a = 0; a < n.length; a++) {
  945. const c = `${(l = n[a]) == null ? void 0 : l.v}`, d = c == null ? void 0 : c.substr(c.length - 1, 1);
  946. c === "周日" ? a === 0 ? i.push(0) : (o++, i.push(o * 7)) : i.push(Pn(d) + o * 7);
  947. }
  948. if (s && (n.reverse(), i.reverse()), Di(i)) {
  949. const a = i[1] - i[0];
  950. return jt(as(n, e, a, 1), s);
  951. }
  952. return Rr(n, e);
  953. }
  954. }
  955. }, dv = {
  956. type: ut.CHN_WEEK3,
  957. priority: 810,
  958. match: (r) => KC(`${r == null ? void 0 : r.v}` || ""),
  959. isContinue: (r, e) => r.type === ut.CHN_WEEK3,
  960. applyFunctions: {
  961. [ke.SERIES]: (r, e, t) => {
  962. var l;
  963. const { data: n } = r, s = t === B.LEFT || t === B.UP;
  964. if (n.length === 1) {
  965. let a;
  966. return s ? a = -1 : a = 1, jt(as(n, e, a, 2), s);
  967. }
  968. const i = [];
  969. let o = 0;
  970. for (let a = 0; a < n.length; a++) {
  971. const c = `${(l = n[a]) == null ? void 0 : l.v}`;
  972. if (c) {
  973. const d = c.substr(c.length - 1, 1);
  974. c === "星期日" ? a === 0 ? i.push(0) : (o++, i.push(o * 7)) : i.push(Pn(d) + o * 7);
  975. }
  976. }
  977. if (s && (n.reverse(), i.reverse()), Di(i)) {
  978. const a = i[1] - i[0];
  979. return jt(as(n, e, a, 2), s);
  980. }
  981. return Rr(n, e);
  982. }
  983. }
  984. }, uv = {
  985. type: ut.LOOP_SERIES,
  986. priority: 800,
  987. match: (r) => sv(`${r == null ? void 0 : r.v}` || ""),
  988. isContinue: (r, e) => {
  989. var t;
  990. return r.type === ut.LOOP_SERIES ? fa(`${(t = r.cellData) == null ? void 0 : t.v}` || "").name === fa(`${e == null ? void 0 : e.v}` || "").name : !1;
  991. },
  992. applyFunctions: {
  993. [ke.SERIES]: (r, e, t) => {
  994. var a, c;
  995. const { data: n } = r, s = t === B.LEFT || t === B.UP, { series: i } = fa(`${(a = n[0]) == null ? void 0 : a.v}` || "");
  996. if (n.length === 1) {
  997. let d;
  998. return s ? d = -1 : d = 1, jt(Pu(n, e, d, i), s);
  999. }
  1000. const o = [];
  1001. let l = 0;
  1002. for (let d = 0; d < n.length; d++) {
  1003. const u = `${(c = n[d]) == null ? void 0 : c.v}`;
  1004. u && (u === i[0] ? d === 0 ? o.push(0) : (l++, o.push(l * i.length)) : o.push(i.indexOf(u) + l * 7));
  1005. }
  1006. if (s && (n.reverse(), o.reverse()), Di(o)) {
  1007. const d = o[1] - o[0];
  1008. return jt(Pu(n, e, d, i), s);
  1009. }
  1010. return Rr(n, e);
  1011. }
  1012. }
  1013. };
  1014. function jt(r, e) {
  1015. return e ? r.reverse() : r;
  1016. }
  1017. var hv = Object.defineProperty, mv = Object.getOwnPropertyDescriptor, fv = (r, e, t, n) => {
  1018. for (var s = n > 1 ? void 0 : n ? mv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  1019. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  1020. return n && s && hv(e, t, s), s;
  1021. }, Dr = (r, e) => (t, n) => e(t, n, r);
  1022. let No = class extends ce {
  1023. constructor(e, t, n, s, i, o) {
  1024. super();
  1025. w(this, "_rules", []);
  1026. w(this, "_hooks", []);
  1027. w(this, "_applyType$", new Me(ke.SERIES));
  1028. w(this, "_isFillingStyle", !0);
  1029. w(this, "_prevUndos", []);
  1030. w(this, "_autoFillLocation$", new Me(null));
  1031. w(this, "autoFillLocation$", this._autoFillLocation$.asObservable());
  1032. w(this, "_showMenu$", new Me(!1));
  1033. w(this, "showMenu$", this._showMenu$.asObservable());
  1034. w(this, "_direction", B.DOWN);
  1035. w(this, "applyType$", this._applyType$.asObservable());
  1036. w(this, "_menu$", new Me([
  1037. {
  1038. label: "autoFill.copy",
  1039. value: ke.COPY,
  1040. disable: !1
  1041. },
  1042. {
  1043. label: "autoFill.series",
  1044. value: ke.SERIES,
  1045. disable: !1
  1046. },
  1047. {
  1048. label: "autoFill.formatOnly",
  1049. value: ke.ONLY_FORMAT,
  1050. disable: !1
  1051. },
  1052. {
  1053. label: "autoFill.noFormat",
  1054. value: ke.NO_FORMAT,
  1055. disable: !1
  1056. }
  1057. ]));
  1058. w(this, "menu$", this._menu$.asObservable());
  1059. this._commandService = e, this._undoRedoService = t, this._renderManagerService = n, this._univerInstanceService = s, this._selectionManagerService = i, this._injector = o, this._init();
  1060. }
  1061. _init() {
  1062. this._rules = [
  1063. iv,
  1064. ov,
  1065. lv,
  1066. av,
  1067. cv,
  1068. dv,
  1069. uv,
  1070. Km
  1071. ].sort((e, t) => t.priority - e.priority), this._isFillingStyle = !0;
  1072. }
  1073. _getOneByPriority(e) {
  1074. return e.length <= 0 ? [] : [e.reduce((n, s) => (s.priority || 0) > (n.priority || 0) ? s : n, e[0])];
  1075. }
  1076. // a cache to undo commands of last apply-type
  1077. _initPrevUndo() {
  1078. this._prevUndos = [];
  1079. }
  1080. // eslint-disable-next-line max-lines-per-function
  1081. async triggerAutoFill(e, t, n, s) {
  1082. var h;
  1083. if (n.startColumn === s.startColumn && n.startRow === s.startRow && n.endColumn === s.endColumn && n.endRow === s.endRow)
  1084. return !1;
  1085. if (s.endColumn < n.endColumn && s.endColumn > n.startColumn)
  1086. return this._commandService.executeCommand(si.id, {
  1087. clearRange: {
  1088. startRow: s.startRow,
  1089. endRow: s.endRow,
  1090. startColumn: s.endColumn + 1,
  1091. endColumn: n.endColumn
  1092. },
  1093. selectionRange: s
  1094. });
  1095. if (s.endRow < n.endRow && s.endRow > n.startRow)
  1096. return this._commandService.executeCommand(si.id, {
  1097. clearRange: {
  1098. startRow: s.endRow + 1,
  1099. endRow: n.endRow,
  1100. startColumn: s.startColumn,
  1101. endColumn: s.endColumn
  1102. },
  1103. selectionRange: s
  1104. });
  1105. const i = {
  1106. startRow: s.startRow,
  1107. endRow: s.endRow,
  1108. startColumn: s.startColumn,
  1109. endColumn: s.endColumn
  1110. };
  1111. let o = null;
  1112. if (s.startRow < n.startRow)
  1113. o = B.UP, i.endRow = n.startRow - 1;
  1114. else if (s.endRow > n.endRow)
  1115. o = B.DOWN, i.startRow = n.endRow + 1;
  1116. else if (s.startColumn < n.startColumn)
  1117. o = B.LEFT, i.endColumn = n.startColumn - 1;
  1118. else if (s.endColumn > n.endColumn)
  1119. o = B.RIGHT, i.startColumn = n.endColumn + 1;
  1120. else
  1121. return !1;
  1122. this.direction = o;
  1123. const l = this._injector.invoke((m) => Ys(n, m)), a = this._injector.invoke((m) => Ys(i, m));
  1124. if (!l || !a)
  1125. return !1;
  1126. this.autoFillLocation = {
  1127. source: l,
  1128. target: a,
  1129. unitId: e,
  1130. subUnitId: t
  1131. };
  1132. const c = [];
  1133. this.getActiveHooks().forEach((m) => {
  1134. var g;
  1135. const f = (g = m == null ? void 0 : m.onBeforeFillData) == null ? void 0 : g.call(m, { source: l, target: a, unitId: e, subUnitId: t }, o);
  1136. f && c.unshift(f);
  1137. }), this._initPrevUndo();
  1138. for (let m = 0; m < c.length; m++) {
  1139. const f = this.menu.find((g) => g.value === c[m]);
  1140. if (f && !f.disable)
  1141. return this.fillData(c[m]);
  1142. }
  1143. const u = (h = this.menu.find((m) => m.disable === !1)) == null ? void 0 : h.value;
  1144. return u ? this.fillData(u) : !1;
  1145. }
  1146. addHook(e) {
  1147. if (this._hooks.find((t) => t.id === e.id))
  1148. throw new Error(`Add hook failed, hook id '${e.id}' already exist!`);
  1149. return e.priority === void 0 && (e.priority = 0), e.type === void 0 && (e.type = Gr.Append), this._hooks.push(e), Ae(() => {
  1150. const t = this._hooks.findIndex((n) => n === e);
  1151. t > -1 && this._hooks.splice(t, 1);
  1152. });
  1153. }
  1154. registerRule(e) {
  1155. if (this._rules.find((n) => n.type === e.type))
  1156. throw new Error(`Registry rule failed, type '${e.type}' already exist!`);
  1157. const t = this._rules.findIndex((n) => n.priority < e.priority);
  1158. this._rules.splice(t === -1 ? this._rules.length : t, 0, e);
  1159. }
  1160. getRules() {
  1161. return this._rules;
  1162. }
  1163. getAllHooks() {
  1164. return this._hooks;
  1165. }
  1166. getActiveHooks() {
  1167. const { source: e, target: t, unitId: n, subUnitId: s } = this.autoFillLocation || {};
  1168. if (!e || !t || !n || !s)
  1169. return [];
  1170. const i = this._hooks.filter(
  1171. (c) => {
  1172. var d;
  1173. return !((d = c.disable) != null && d.call(c, { source: e, target: t, unitId: n, subUnitId: s }, this._direction, this.applyType));
  1174. }
  1175. ), o = i.filter((c) => c.type === Gr.Only);
  1176. if (o.length > 0)
  1177. return this._getOneByPriority(o);
  1178. const l = this._getOneByPriority(i.filter((c) => c.type === Gr.Default)), a = i.filter((c) => c.type === Gr.Append) || [];
  1179. return [...l, ...a];
  1180. }
  1181. get applyType() {
  1182. return this._applyType$.getValue();
  1183. }
  1184. set applyType(e) {
  1185. this._applyType$.next(e);
  1186. }
  1187. get menu() {
  1188. return this._menu$.getValue();
  1189. }
  1190. get direction() {
  1191. return this._direction;
  1192. }
  1193. set direction(e) {
  1194. this._direction = e;
  1195. }
  1196. isFillingStyle() {
  1197. return this._isFillingStyle;
  1198. }
  1199. setFillingStyle(e) {
  1200. this._isFillingStyle = e;
  1201. }
  1202. get autoFillLocation() {
  1203. return this._autoFillLocation$.getValue();
  1204. }
  1205. set autoFillLocation(e) {
  1206. this._autoFillLocation$.next(e);
  1207. }
  1208. setDisableApplyType(e, t) {
  1209. this._menu$.next(
  1210. this._menu$.getValue().map((n) => n.value === e ? {
  1211. ...n,
  1212. disable: t
  1213. } : n)
  1214. );
  1215. }
  1216. setShowMenu(e) {
  1217. this._showMenu$.next(e);
  1218. }
  1219. // eslint-disable-next-line max-lines-per-function
  1220. fillData(e) {
  1221. var p, S, b;
  1222. this.applyType = e;
  1223. const {
  1224. source: t,
  1225. target: n,
  1226. unitId: s = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId(),
  1227. subUnitId: i = (p = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : p.getSheetId()
  1228. } = this.autoFillLocation || {};
  1229. if (!t || !n || !s || !i)
  1230. return !1;
  1231. const o = this.direction;
  1232. this._prevUndos.length > 0 && this._prevUndos.forEach((v) => {
  1233. this._commandService.syncExecuteCommand(v.id, v.params);
  1234. }), this._prevUndos = [];
  1235. const l = ae.union(wr(t), wr(n)), a = this.getActiveHooks(), c = this._univerInstanceService.getUnit(s, O.UNIVER_SHEET);
  1236. this._commandService.syncExecuteCommand(He.id, {
  1237. selections: [
  1238. {
  1239. primary: { ...(b = (S = this._selectionManagerService.getCurrentLastSelection()) == null ? void 0 : S.primary) != null ? b : l },
  1240. range: {
  1241. ...l,
  1242. rangeType: j.NORMAL
  1243. }
  1244. }
  1245. ],
  1246. unitId: s,
  1247. subUnitId: i
  1248. });
  1249. const d = [], u = [];
  1250. a.forEach((v) => {
  1251. var I;
  1252. const { undos: _, redos: R } = ((I = v.onFillData) == null ? void 0 : I.call(v, { source: t, target: n, unitId: s, subUnitId: i }, o, e)) || {};
  1253. _ && d.push(..._), R && u.push(...R);
  1254. });
  1255. const h = u.every((v) => this._commandService.syncExecuteCommand(v.id, v.params)), m = [];
  1256. e !== ke.NO_FORMAT && u.forEach((v) => {
  1257. if (v.id === Se.id) {
  1258. const { cellValue: _ } = v.params;
  1259. new Ke(_).forValue((I, y, M) => {
  1260. const P = Object.keys(c.getStyles().get(M == null ? void 0 : M.s) || {});
  1261. (M != null && M.p || P.length && qm.some((E) => P.includes(E))) && m.push({ startRow: I, endRow: I, startColumn: y, endColumn: y });
  1262. });
  1263. }
  1264. });
  1265. const f = this._getAutoHeightUndoRedos(s, i, m);
  1266. return f.redos.every((v) => this._commandService.syncExecuteCommand(v.id, v.params)) && (d.push(...f.undos), u.push(...f.redos)), h && (this._prevUndos = d, this._undoRedoService.pushUndoRedo({
  1267. unitID: s,
  1268. undoMutations: d,
  1269. redoMutations: u
  1270. })), a.forEach((v) => {
  1271. var _;
  1272. (_ = v.onAfterFillData) == null || _.call(v, { source: t, target: n, unitId: s, subUnitId: i }, o, e);
  1273. }), this.setShowMenu(!0), !0;
  1274. }
  1275. _getAutoHeightUndoRedos(e, t, n) {
  1276. var d, u;
  1277. const s = (d = this._renderManagerService.getRenderById(e)) == null ? void 0 : d.with(me), i = (u = s == null ? void 0 : s.getCurrent()) == null ? void 0 : u.skeleton;
  1278. if (!i) return { redos: [], undos: [] };
  1279. const o = i.calculateAutoHeightInRange(n), l = { subUnitId: t, unitId: e, rowsAutoHeightInfo: o }, a = i.worksheet, c = nm(l, a);
  1280. return {
  1281. undos: [{ id: _r.id, params: c }],
  1282. redos: [{ id: _r.id, params: l }]
  1283. };
  1284. }
  1285. };
  1286. No = fv([
  1287. Dr(0, F),
  1288. Dr(1, Zt),
  1289. Dr(2, Ce),
  1290. Dr(3, D(L)),
  1291. Dr(4, D($)),
  1292. Dr(5, D(vt))
  1293. ], No);
  1294. const Hr = gn("univer.auto-fill-service"), pr = {
  1295. type: K.COMMAND,
  1296. id: "sheet.command.auto-fill",
  1297. handler: async (r, e) => {
  1298. const t = r.get(Hr), n = r.get(L), { sourceRange: s, targetRange: i } = e, o = Ue(n);
  1299. if (!o) return !1;
  1300. const { subUnitId: l, unitId: a } = o;
  1301. return t.triggerAutoFill(a, l, s, i);
  1302. }
  1303. }, si = {
  1304. id: "sheet.command.auto-clear-content",
  1305. type: K.COMMAND,
  1306. handler: async (r, e) => {
  1307. const t = r.get(L), n = r.get(F), s = r.get(Zt), i = r.get(Ln), o = Ue(t);
  1308. if (!o) return !1;
  1309. const { unitId: l, subUnitId: a } = o, { clearRange: c, selectionRange: d } = e, u = {
  1310. subUnitId: a,
  1311. unitId: l,
  1312. cellValue: OS([c])
  1313. }, h = en(
  1314. r,
  1315. u
  1316. ), { startColumn: m, startRow: f } = d, g = {
  1317. selections: [
  1318. {
  1319. primary: {
  1320. startColumn: m,
  1321. startRow: f,
  1322. endColumn: m,
  1323. endRow: f,
  1324. actualRow: f,
  1325. actualColumn: m,
  1326. isMerged: !1,
  1327. isMergedMainCell: !1
  1328. },
  1329. range: {
  1330. ...d
  1331. }
  1332. }
  1333. ],
  1334. unitId: l,
  1335. subUnitId: a
  1336. };
  1337. if (n.executeCommand(He.id, g), n.syncExecuteCommand(Se.id, u)) {
  1338. const S = i.afterCommandExecute({
  1339. id: Se.id,
  1340. params: u
  1341. });
  1342. return pl(S.redos, n), s.pushUndoRedo({
  1343. // If there are multiple mutations that form an encapsulated project, they must be encapsulated in the same undo redo element.
  1344. // Hooks can be used to hook the code of external controllers to add new actions.
  1345. unitID: l,
  1346. undoMutations: [{ id: Se.id, params: h }, ...S.undos],
  1347. redoMutations: [{ id: Se.id, params: u }, ...S.redos]
  1348. }), !0;
  1349. }
  1350. return !1;
  1351. }
  1352. }, Ll = {
  1353. id: "sheet.command.refill",
  1354. type: K.COMMAND,
  1355. handler: async (r, e) => r.get(Hr).fillData(e.type)
  1356. }, _c = [10, 400], Jm = "RANGE_SELECTOR_COMPONENT_KEY", Td = "EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY";
  1357. var qe = /* @__PURE__ */ ((r) => (r.MAIN = "__SpreadsheetRender__", r.ROW = "__SpreadsheetRowHeader__", r.COLUMN = "__SpreadsheetColumnHeader__", r.LEFT_TOP = "__SpreadsheetLeftTopPlaceholder__", r))(qe || {});
  1358. const Tu = 0, Ho = 1, rr = 10, gv = 11, xu = 12, wc = sr("rangeMovePermissionCheck"), Rc = sr("rangeFillPermissionCheck");
  1359. var $m = /* @__PURE__ */ ((r) => (r[r.FORMULA_EDITOR_SHOW = 100] = "FORMULA_EDITOR_SHOW", r[r.MARK_SELECTION = 1e4] = "MARK_SELECTION", r))($m || {});
  1360. function yr(r) {
  1361. const e = r.getCurrentTheme(), t = new Tn(e.primaryColor).setAlpha(0.07).toRgbString();
  1362. return {
  1363. strokeWidth: 1,
  1364. stroke: e.primaryColor,
  1365. fill: t,
  1366. // widgets: { tl: true, tc: true, tr: true, ml: true, mr: true, bl: true, bc: true, br: true },
  1367. widgets: {},
  1368. widgetSize: 6,
  1369. widgetStrokeWidth: 1,
  1370. widgetStroke: e.colorWhite,
  1371. autofillSize: 6,
  1372. autofillStrokeWidth: 1,
  1373. autofillStroke: e.colorWhite,
  1374. rowHeaderFill: t,
  1375. rowHeaderStroke: e.primaryColor,
  1376. rowHeaderStrokeWidth: 1,
  1377. columnHeaderFill: t,
  1378. columnHeaderStroke: e.primaryColor,
  1379. columnHeaderStrokeWidth: 1,
  1380. expandCornerSize: 40
  1381. };
  1382. }
  1383. class pv {
  1384. constructor() {
  1385. w(this, "_startColumn", -1);
  1386. w(this, "_startRow", -1);
  1387. w(this, "_endColumn", -1);
  1388. w(this, "_endRow", -1);
  1389. w(this, "_startX", 0);
  1390. w(this, "_startY", 0);
  1391. w(this, "_endX", 0);
  1392. w(this, "_endY", 0);
  1393. /**
  1394. * The highlight cell of a selection. aka: current cell
  1395. */
  1396. w(this, "_primary");
  1397. w(this, "_rangeType", j.NORMAL);
  1398. }
  1399. get startColumn() {
  1400. return this._startColumn;
  1401. }
  1402. get startRow() {
  1403. return this._startRow;
  1404. }
  1405. get endColumn() {
  1406. return this._endColumn;
  1407. }
  1408. get endRow() {
  1409. return this._endRow;
  1410. }
  1411. get startX() {
  1412. return this._startX;
  1413. }
  1414. get startY() {
  1415. return this._startY;
  1416. }
  1417. get endX() {
  1418. return this._endX;
  1419. }
  1420. get endY() {
  1421. return this._endY;
  1422. }
  1423. get currentCell() {
  1424. return this._primary;
  1425. }
  1426. get rangeType() {
  1427. return this._rangeType;
  1428. }
  1429. /**
  1430. * @deprecated, Duplicate with `Rectangle`
  1431. */
  1432. isEqual(e) {
  1433. const { startColumn: t, startRow: n, endColumn: s, endRow: i } = this, {
  1434. startColumn: o,
  1435. startRow: l,
  1436. endColumn: a,
  1437. endRow: c
  1438. } = e;
  1439. return t === o && n === l && s === a && i === c;
  1440. }
  1441. /**
  1442. * @deprecated, Duplicate with `Rectangle`
  1443. */
  1444. isInclude(e) {
  1445. const { startColumn: t, startRow: n, endColumn: s, endRow: i } = this, {
  1446. startColumn: o,
  1447. startRow: l,
  1448. endColumn: a,
  1449. endRow: c
  1450. } = e;
  1451. return !(a < t || o > s || l > i || c < n);
  1452. }
  1453. highlightToSelection() {
  1454. if (this._primary)
  1455. return bo(this._primary);
  1456. }
  1457. getRange() {
  1458. return {
  1459. startColumn: this._startColumn,
  1460. startRow: this._startRow,
  1461. endColumn: this._endColumn,
  1462. endRow: this._endRow,
  1463. startX: this._startX,
  1464. startY: this._startY,
  1465. endX: this._endX,
  1466. endY: this._endY,
  1467. rangeType: this.rangeType
  1468. };
  1469. }
  1470. getCell() {
  1471. return this._primary;
  1472. }
  1473. getRangeType() {
  1474. return this._rangeType;
  1475. }
  1476. setRangeType(e) {
  1477. this._rangeType = e;
  1478. }
  1479. getValue() {
  1480. return {
  1481. rangeWithCoord: this.getRange(),
  1482. primaryWithCoord: this._primary
  1483. };
  1484. }
  1485. setValue(e, t) {
  1486. const {
  1487. startColumn: n,
  1488. startRow: s,
  1489. endColumn: i,
  1490. endRow: o,
  1491. startX: l,
  1492. startY: a,
  1493. endX: c,
  1494. endY: d,
  1495. rangeType: u
  1496. } = e;
  1497. this._startColumn = n, this._startRow = s, this._endColumn = i, this._endRow = o, this._startX = l, this._startY = a, this._endX = c, this._endY = d, u !== void 0 && (this._rangeType = u), t !== void 0 && this.setCurrentCell(t);
  1498. }
  1499. /**
  1500. * Set primary cell.
  1501. * @TODO lumixraku there are 3 concepts for same thing, primary and current and highlight
  1502. * highlight is best. primary sometimes means the actual cell(actual means ignore merge)
  1503. * @param currentCell
  1504. */
  1505. setCurrentCell(e) {
  1506. this._primary = e;
  1507. }
  1508. clearCurrentCell() {
  1509. this._primary = null;
  1510. }
  1511. }
  1512. const Ou = "__SpreadsheetHelperSelectionTempRect", Sv = 35;
  1513. class Cv {
  1514. constructor(e, t) {
  1515. w(this, "_startOffsetX", 0);
  1516. w(this, "_startOffsetY", 0);
  1517. w(this, "_relativeSelectionPositionRow", 0);
  1518. w(this, "_relativeSelectionPositionColumn", 0);
  1519. w(this, "_relativeSelectionRowLength", 0);
  1520. w(this, "_relativeSelectionColumnLength", 0);
  1521. w(this, "_scenePointerMoveSub");
  1522. w(this, "_scenePointerUpSub");
  1523. /**
  1524. * The shadow selection under cursor when move whole selection control(for moving normal selection)
  1525. */
  1526. w(this, "_helperSelection");
  1527. w(this, "_scrollTimer");
  1528. w(this, "_activeViewport");
  1529. w(this, "_targetSelection", {
  1530. startY: 0,
  1531. endY: 0,
  1532. startX: 0,
  1533. endX: 0,
  1534. startRow: -1,
  1535. endRow: -1,
  1536. startColumn: -1,
  1537. endColumn: -1
  1538. });
  1539. w(this, "_isInMergeState", !1);
  1540. w(this, "_fillControlColors", []);
  1541. w(this, "_skeleton");
  1542. w(this, "_scene");
  1543. w(this, "_themeService");
  1544. w(this, "_injector");
  1545. w(this, "_selectionHooks");
  1546. this._control = e, this._skeleton = t.skeleton, this._scene = t.scene, this._themeService = t.themeService, this._injector = t.injector, this._selectionHooks = t.selectionHooks, this._initialControl(), this._initialWidget(), this._initialAutoFill(), this._control.dispose$.subscribe(() => {
  1547. this.dispose();
  1548. });
  1549. }
  1550. get isHelperSelection() {
  1551. return this._control.isHelperSelection;
  1552. }
  1553. dispose() {
  1554. var e, t;
  1555. (e = this._scrollTimer) == null || e.dispose(), this._fillControlColors = [], this._clearObserverEvent(), (t = this._helperSelection) == null || t.dispose();
  1556. }
  1557. _getFreeze() {
  1558. var n, s;
  1559. return (s = (n = this._injector.get(Ce).withCurrentTypeOfUnit(O.UNIVER_SHEET, me)) == null ? void 0 : n.getCurrent()) == null ? void 0 : s.skeleton.getWorksheetConfig().freeze;
  1560. }
  1561. _isSelectionInViewport(e, t) {
  1562. const n = this._getFreeze() || {
  1563. startRow: -1,
  1564. startColumn: -1,
  1565. xSplit: 0,
  1566. ySplit: 0
  1567. };
  1568. switch (t.viewportKey) {
  1569. case z.VIEW_MAIN:
  1570. return e.endRow >= n.startRow && e.endColumn >= n.startColumn;
  1571. case z.VIEW_MAIN_TOP:
  1572. case z.VIEW_COLUMN_RIGHT:
  1573. return e.endColumn >= n.startColumn && e.startRow < n.startRow;
  1574. case z.VIEW_MAIN_LEFT:
  1575. case z.VIEW_ROW_BOTTOM:
  1576. return e.endRow >= n.startRow && e.startColumn < n.startColumn;
  1577. case z.VIEW_MAIN_LEFT_TOP:
  1578. case z.VIEW_COLUMN_LEFT:
  1579. case z.VIEW_ROW_TOP:
  1580. case z.VIEW_LEFT_TOP:
  1581. return e.startRow < n.startRow && e.startColumn < n.startColumn;
  1582. }
  1583. }
  1584. _clearObserverEvent() {
  1585. var e, t;
  1586. (e = this._scenePointerMoveSub) == null || e.unsubscribe(), (t = this._scenePointerUpSub) == null || t.unsubscribe(), this._scenePointerMoveSub = null, this._scenePointerUpSub = null;
  1587. }
  1588. _initialControl() {
  1589. const { leftControl: e, rightControl: t, topControl: n, bottomControl: s } = this._control;
  1590. [e, t, n, s].forEach((i) => {
  1591. i.onPointerEnter$.subscribeEvent(() => {
  1592. var l;
  1593. ((l = this._injector.get(dt, sc.OPTIONAL)) == null ? void 0 : l.interceptor.fetchThroughInterceptors(wc)(!1, null)) !== !1 && i.setCursor(Re.MOVE);
  1594. }), i.onPointerLeave$.subscribeEvent(() => {
  1595. i.resetCursor();
  1596. }), i.onPointerDown$.subscribeEvent(this._controlPointerDownHandler.bind(this));
  1597. });
  1598. }
  1599. /**
  1600. * Move the whole selection control after cursor turn into move state.
  1601. * NOT same as widgetMoving, that's for 8 control points.
  1602. * @param moveOffsetX
  1603. * @param moveOffsetY
  1604. */
  1605. _controlMoving(e, t) {
  1606. var P;
  1607. const n = this._scene, s = n.getScrollXYInfoByViewport(Oe.FromArray([e, t])), { scaleX: i, scaleY: o } = n.getAncestorScale(), l = this._skeleton.getCellIndexByOffset(
  1608. e,
  1609. t,
  1610. i,
  1611. o,
  1612. s
  1613. ), { row: a, column: c } = l, d = this._skeleton.getRowCount() - 1, u = this._skeleton.getColumnCount() - 1;
  1614. let h = Math.max(0, a + this._relativeSelectionPositionRow), m = h + this._relativeSelectionRowLength;
  1615. m > d && (m = d, m - h < this._relativeSelectionRowLength && (h = m - this._relativeSelectionRowLength));
  1616. let f = Math.max(0, c + this._relativeSelectionPositionColumn), g = f + this._relativeSelectionColumnLength;
  1617. g > u && (g = u, g - f < this._relativeSelectionColumnLength && (f = g - this._relativeSelectionColumnLength));
  1618. const p = this._skeleton.worksheet.getCellInfoInMergeData(h, f), b = Pt({
  1619. range: { startRow: h, endRow: m, startColumn: f, endColumn: g },
  1620. primary: p,
  1621. style: null
  1622. }, this._skeleton), v = this._skeleton.getNoMergeCellPositionByIndex(h, f), _ = this._skeleton.getNoMergeCellPositionByIndex(m, g), R = (v == null ? void 0 : v.startY) || 0, I = (_ == null ? void 0 : _.endY) || 0, y = (v == null ? void 0 : v.startX) || 0, M = (_ == null ? void 0 : _.endX) || 0;
  1623. (P = this._helperSelection) == null || P.transformByState({
  1624. left: y,
  1625. top: R,
  1626. width: M - y,
  1627. height: I - R
  1628. }), this._targetSelection = { ...b.rangeWithCoord }, this._control.selectionMoving$.next(b.rangeWithCoord);
  1629. }
  1630. /**
  1631. * Drag move whole selectionControl when cursor turns to crosshair. Not for dragging 8 control points.
  1632. * @param evt
  1633. */
  1634. _controlPointerDownHandler(e) {
  1635. const { offsetX: t, offsetY: n } = e, s = this._scene, i = s.getCoordRelativeToViewport(Oe.FromArray([t, n])), { x: o, y: l } = i, a = s.getScrollXYInfoByViewport(i), { scaleX: c, scaleY: d } = s.getAncestorScale(), u = this._skeleton.getCellIndexByOffset(
  1636. o,
  1637. l,
  1638. c,
  1639. d,
  1640. a
  1641. );
  1642. this._startOffsetX = o, this._startOffsetY = l;
  1643. const { row: h, column: m } = u, {
  1644. startRow: f,
  1645. startColumn: g,
  1646. endRow: p,
  1647. endColumn: S
  1648. } = this._control.model;
  1649. let b = 0, v = 0;
  1650. h < f ? b -= 1 : h > p && (b += 1), m < g ? v -= 1 : m > S && (v += 1), this._relativeSelectionPositionRow = f - h + b, this._relativeSelectionPositionColumn = g - m + v, this._relativeSelectionRowLength = p - f, this._relativeSelectionColumnLength = S - g;
  1651. const _ = this._control.currentStyle, R = this._getScale();
  1652. this.isHelperSelection && (this._helperSelection = new ge(Ou, {
  1653. stroke: _.stroke,
  1654. strokeWidth: _.strokeWidth / R
  1655. }), s.addObject(this._helperSelection));
  1656. const I = s.getViewport(z.VIEW_MAIN), y = Kr.create(s);
  1657. this._scrollTimer = y, y.startScroll(o, l, I), s.disableObjectsEvent(), this._scenePointerMoveSub = s.onPointerMove$.subscribeEvent((M) => {
  1658. var x;
  1659. const { offsetX: P, offsetY: E } = M;
  1660. if (((x = this._injector.get(dt, sc.OPTIONAL)) == null ? void 0 : x.interceptor.fetchThroughInterceptors(wc)(!1, null)) === !1)
  1661. return;
  1662. const { x: A, y: H } = s.getCoordRelativeToViewport(
  1663. Oe.FromArray([P, E])
  1664. );
  1665. this._controlMoving(A, H), s.setCursor(Re.MOVE), y.scrolling(A, H, () => {
  1666. this._controlMoving(A, H);
  1667. });
  1668. }), this._scenePointerUpSub = s.onPointerUp$.subscribeEvent(() => {
  1669. var P, E, T, A;
  1670. (P = this._helperSelection) == null || P.dispose();
  1671. const M = this._scene;
  1672. M.resetCursor(), this._clearObserverEvent(), M.enableObjectsEvent(), (E = this._scrollTimer) == null || E.dispose(), this._control.selectionMoveEnd$.next(this._targetSelection), (A = (T = this._selectionHooks).selectionMoveEnd) == null || A.call(T);
  1673. });
  1674. }
  1675. _initialWidget() {
  1676. const {
  1677. topLeftWidget: e,
  1678. topCenterWidget: t,
  1679. topRightWidget: n,
  1680. middleLeftWidget: s,
  1681. middleRightWidget: i,
  1682. bottomLeftWidget: o,
  1683. bottomCenterWidget: l,
  1684. bottomRightWidget: a
  1685. } = this._control, c = [
  1686. Re.NORTH_WEST_RESIZE,
  1687. Re.NORTH_RESIZE,
  1688. Re.NORTH_EAST_RESIZE,
  1689. Re.WEST_RESIZE,
  1690. Re.EAST_RESIZE,
  1691. Re.SOUTH_WEST_RESIZE,
  1692. Re.SOUTH_RESIZE,
  1693. Re.SOUTH_EAST_RESIZE
  1694. ];
  1695. [
  1696. e,
  1697. t,
  1698. n,
  1699. s,
  1700. i,
  1701. o,
  1702. l,
  1703. a
  1704. ].forEach((d, u) => {
  1705. d.onPointerEnter$.subscribeEvent(() => {
  1706. d.setCursor(c[u]);
  1707. }), d.onPointerLeave$.subscribeEvent(() => {
  1708. d.resetCursor();
  1709. }), d.onPointerDown$.subscribeEvent((h) => {
  1710. this._widgetPointerDownEvent(h, c[u]);
  1711. });
  1712. });
  1713. }
  1714. /**
  1715. * Pointer down Events for 8 control point.
  1716. * @param evt
  1717. * @param cursor
  1718. */
  1719. _widgetPointerDownEvent(e, t) {
  1720. const n = this._scene, { offsetX: s, offsetY: i } = e, o = n.getCoordRelativeToViewport(Oe.FromArray([s, i])), { x: l, y: a } = o;
  1721. this._startOffsetX = s, this._startOffsetY = i;
  1722. const {
  1723. startRow: c,
  1724. startColumn: d,
  1725. endRow: u,
  1726. endColumn: h
  1727. } = this._control.model, m = Math.min(c, u), f = Math.min(d, h), g = Math.max(c, u), p = Math.max(d, h);
  1728. this._relativeSelectionPositionRow = m, this._relativeSelectionPositionColumn = f, this._relativeSelectionRowLength = g - m, this._relativeSelectionColumnLength = p - f, t === Re.NORTH_WEST_RESIZE ? (this._relativeSelectionPositionRow = g, this._relativeSelectionPositionColumn = p) : t === Re.NORTH_RESIZE ? this._relativeSelectionPositionRow = g : t === Re.NORTH_EAST_RESIZE ? this._relativeSelectionPositionRow = g : t === Re.WEST_RESIZE ? this._relativeSelectionPositionColumn = p : t === Re.SOUTH_WEST_RESIZE ? this._relativeSelectionPositionColumn = p : t === Re.SOUTH_RESIZE && (this._relativeSelectionPositionRow = m);
  1729. const S = Kr.create(n), b = n.getViewport(z.VIEW_MAIN);
  1730. S.startScroll(l, a, b), this._scrollTimer = S, n.disableObjectsEvent(), this._scenePointerMoveSub = n.onPointerMove$.subscribeEvent((v) => {
  1731. const { offsetX: _, offsetY: R } = v, { x: I, y } = n.getCoordRelativeToViewport(
  1732. Oe.FromArray([_, R])
  1733. );
  1734. this._widgetMoving(I, y, t), n.setCursor(t), S.scrolling(I, y, () => {
  1735. this._widgetMoving(I, y, t);
  1736. });
  1737. }), this._scenePointerUpSub = n.onPointerUp$.subscribeEvent(() => {
  1738. var _, R, I;
  1739. const v = this._scene;
  1740. v.resetCursor(), this._clearObserverEvent(), v.enableObjectsEvent(), (_ = this._scrollTimer) == null || _.dispose(), this._control.selectionScaled$.next(this._targetSelection), (I = (R = this._selectionHooks).selectionMoveEnd) == null || I.call(R);
  1741. });
  1742. }
  1743. /**
  1744. * Pointer move Events for 8 control point.
  1745. * @param moveOffsetX
  1746. * @param moveOffsetY
  1747. * @param cursor
  1748. */
  1749. _widgetMoving(e, t, n) {
  1750. const s = this._scene, i = s.getScrollXYInfoByViewport(Oe.FromArray([this._startOffsetX, this._startOffsetY])), { scaleX: o, scaleY: l } = s.getAncestorScale(), a = this._skeleton.getCellIndexByOffset(
  1751. e,
  1752. t,
  1753. o,
  1754. l,
  1755. i
  1756. ), { row: c, column: d } = a;
  1757. let u = this._relativeSelectionPositionRow, h = this._relativeSelectionPositionColumn, m = c, f = d;
  1758. n === Re.NORTH_WEST_RESIZE ? (u = c, h = d, m = this._relativeSelectionPositionRow, f = this._relativeSelectionPositionColumn) : n === Re.NORTH_RESIZE ? (u = c, h = this._relativeSelectionPositionColumn, m = this._relativeSelectionPositionRow, f = this._relativeSelectionPositionColumn + this._relativeSelectionColumnLength) : n === Re.NORTH_EAST_RESIZE ? (u = c, h = this._relativeSelectionPositionColumn, m = this._relativeSelectionPositionRow, f = d) : n === Re.WEST_RESIZE ? (u = this._relativeSelectionPositionRow, h = d, m = this._relativeSelectionPositionRow + this._relativeSelectionRowLength, f = this._relativeSelectionPositionColumn) : n === Re.EAST_RESIZE ? m = this._relativeSelectionPositionRow + this._relativeSelectionRowLength : n === Re.SOUTH_WEST_RESIZE ? (u = this._relativeSelectionPositionRow, h = d, m = c, f = this._relativeSelectionPositionColumn) : n === Re.SOUTH_RESIZE && (u = this._relativeSelectionPositionRow, h = this._relativeSelectionPositionColumn, m = c, f = this._relativeSelectionPositionColumn + this._relativeSelectionColumnLength);
  1759. const g = this._swapPositions(u, h, m, f), p = this._skeleton.getCellWithMergeInfoByIndex(u, h), b = Pt({ range: g, primary: p, style: null }, this._skeleton);
  1760. this._targetSelection = { ...b.rangeWithCoord }, this._control.updateRangeBySelectionWithCoord(b), this._control.selectionScaling$.next(this._targetSelection);
  1761. }
  1762. _initialAutoFill() {
  1763. const { fillControl: e } = this._control;
  1764. e.onPointerEnter$.subscribeEvent((t) => {
  1765. this._injector.get(dt).interceptor.fetchThroughInterceptors(Rc)(!1, { x: t.offsetX, y: t.offsetY, skeleton: this._skeleton, scene: this._scene }) && e.setCursor(Re.CROSSHAIR);
  1766. }), e.onPointerLeave$.subscribeEvent(() => {
  1767. e.resetCursor();
  1768. }), e.onPointerDown$.subscribeEvent(this._autoFillForPointerdown.bind(this));
  1769. }
  1770. // eslint-disable-next-line complexity
  1771. _autoFillMoving(e, t) {
  1772. var E, T, A;
  1773. const n = this._scene, s = n.getViewportScrollXY(this._activeViewport), { scaleX: i, scaleY: o } = n.getAncestorScale(), l = this._skeleton.getCellIndexByOffset(
  1774. e,
  1775. t,
  1776. i,
  1777. o,
  1778. s
  1779. ), { row: a, column: c } = l, d = n.getCoordRelativeToViewport(Oe.FromArray([e, t])), u = this._skeleton.getRowCount() - 1, h = this._skeleton.getColumnCount() - 1;
  1780. let m = this._relativeSelectionPositionRow, f = this._relativeSelectionPositionColumn, g = this._relativeSelectionPositionRow + this._relativeSelectionRowLength, p = this._relativeSelectionPositionColumn + this._relativeSelectionColumnLength, S = !1, b = !0;
  1781. if ((c < f || c > p) && a >= m && a <= g) {
  1782. const H = this._fillRuler(
  1783. c,
  1784. f,
  1785. p,
  1786. this._relativeSelectionColumnLength,
  1787. h
  1788. );
  1789. f = H.startRowOrColumn, p = H.endRowOrColumn, S = H.isLighten, b = !1;
  1790. } else if ((a < m || a > g) && c >= f && c <= p) {
  1791. const H = this._fillRuler(a, m, g, this._relativeSelectionRowLength, u);
  1792. m = H.startRowOrColumn, g = H.endRowOrColumn, S = H.isLighten;
  1793. } else if (Math.abs(this._startOffsetX - d.x - s.x) / 2 > Math.abs(this._startOffsetY - d.y - s.y)) {
  1794. const H = this._fillRuler(
  1795. c,
  1796. f,
  1797. p,
  1798. this._relativeSelectionColumnLength,
  1799. h
  1800. );
  1801. f = H.startRowOrColumn, p = H.endRowOrColumn, S = H.isLighten, b = !1;
  1802. } else {
  1803. const H = this._fillRuler(a, m, g, this._relativeSelectionRowLength, u);
  1804. m = H.startRowOrColumn, g = H.endRowOrColumn, S = H.isLighten;
  1805. }
  1806. const v = this._skeleton.getNoMergeCellPositionByIndex(m, f), _ = this._skeleton.getNoMergeCellPositionByIndex(g, p), R = (v == null ? void 0 : v.startY) || 0, I = (_ == null ? void 0 : _.endY) || 0, y = (v == null ? void 0 : v.startX) || 0, M = (_ == null ? void 0 : _.endX) || 0;
  1807. S ? this._controlHandler((H, x) => {
  1808. const k = new Tn(this._fillControlColors[x]).lighten(Sv).toRgbString();
  1809. H.setProps({
  1810. fill: k
  1811. });
  1812. }) : this._controlHandler((H, x) => {
  1813. H.setProps({
  1814. fill: this._fillControlColors[x]
  1815. });
  1816. });
  1817. const P = Ro / this._getScale();
  1818. m === g && b === !0 || f === p && b === !1 ? (E = this._helperSelection) == null || E.hide() : ((T = this._helperSelection) == null || T.transformByState({
  1819. left: y - P / 2,
  1820. top: R - P / 2,
  1821. width: M - y,
  1822. height: I - R
  1823. }), (A = this._helperSelection) == null || A.show()), this._targetSelection = {
  1824. startY: R,
  1825. endY: I,
  1826. startX: y,
  1827. endX: M,
  1828. startRow: m,
  1829. endRow: g,
  1830. startColumn: f,
  1831. endColumn: p
  1832. }, this._control.selectionFilling$.next(this._targetSelection);
  1833. }
  1834. _autoFillForPointerdown(e) {
  1835. const { offsetX: t, offsetY: n } = e, s = this._scene, i = s.getCoordRelativeToViewport(Oe.FromArray([t, n])), { x: o, y: l } = i;
  1836. this._startOffsetX = o, this._startOffsetY = l;
  1837. const {
  1838. startRow: a,
  1839. startColumn: c,
  1840. endRow: d,
  1841. endColumn: u
  1842. } = this._control.model;
  1843. this._isInMergeState = this._hasMergeInRange(a, c, d, u), this._relativeSelectionPositionRow = a, this._relativeSelectionPositionColumn = c, this._relativeSelectionRowLength = d - a, this._relativeSelectionColumnLength = u - c;
  1844. const h = this._control.currentStyle;
  1845. let m = h == null ? void 0 : h.stroke, f = h == null ? void 0 : h.strokeWidth;
  1846. const g = yr(this._themeService);
  1847. m == null && (m = g.stroke), f == null && (f = g.strokeWidth);
  1848. const p = this._getScale();
  1849. f /= p;
  1850. const S = Ro / p, b = new Tn(m).darken(2).toRgbString();
  1851. this.isHelperSelection && (this._helperSelection = new ge(Ou, {
  1852. stroke: b,
  1853. strokeWidth: f + S / 2
  1854. }), s.addObject(this._helperSelection)), this._activeViewport = s.getActiveViewportByCoord(Oe.FromArray([t, n]));
  1855. const v = s.getViewport(z.VIEW_MAIN), _ = Kr.create(
  1856. s,
  1857. this._activeViewport.viewportKey === z.VIEW_MAIN ? It.ALL : It.NONE
  1858. );
  1859. _.startScroll(o, l, v), this._scrollTimer = _, s.disableObjectsEvent(), this._controlHandler((R) => {
  1860. this._fillControlColors.push(R.fill);
  1861. }), this._scenePointerMoveSub = s.onPointerMove$.subscribeEvent((R) => {
  1862. var H;
  1863. const { offsetX: I, offsetY: y } = R, M = s.getActiveViewportByCoord(Oe.FromArray([I, y]));
  1864. if (!this._injector.get(dt).interceptor.fetchThroughInterceptors(Rc)(!1, { x: e.offsetX, y: e.offsetY, skeleton: this._skeleton, scene: this._scene }))
  1865. return;
  1866. const { x: E, y: T } = s.getCoordRelativeToViewport(
  1867. Oe.FromArray([I, y])
  1868. );
  1869. this._autoFillMoving(E, T), s.setCursor(Re.CROSSHAIR);
  1870. const A = this._targetSelection;
  1871. if (v && M && ((H = this._activeViewport) == null ? void 0 : H.viewportKey) !== (M == null ? void 0 : M.viewportKey)) {
  1872. let x;
  1873. A.startRow !== a ? (_.scrollTimerType = It.Y, x = {
  1874. ...A,
  1875. endRow: A.startRow
  1876. }) : A.endRow !== d ? (_.scrollTimerType = It.Y, x = {
  1877. ...A,
  1878. startRow: A.endRow
  1879. }) : A.startColumn !== c ? (_.scrollTimerType = It.X, x = {
  1880. ...A,
  1881. endColumn: A.startColumn
  1882. }) : (_.scrollTimerType = It.X, x = {
  1883. ...A,
  1884. startColumn: A.endColumn
  1885. }), this._isSelectionInViewport(x, M) && (v.scrollToBarPos({
  1886. x: _.scrollTimerType === It.X ? 0 : void 0,
  1887. y: _.scrollTimerType === It.Y ? 0 : void 0
  1888. }), this._activeViewport = M);
  1889. }
  1890. _.scrolling(E, T, () => {
  1891. this._autoFillMoving(E, T);
  1892. });
  1893. }), this._scenePointerUpSub = s.onPointerUp$.subscribeEvent(() => {
  1894. var I, y;
  1895. (I = this._helperSelection) == null || I.dispose();
  1896. const R = this._scene;
  1897. R.resetCursor(), this._clearObserverEvent(), R.enableObjectsEvent(), (y = this._scrollTimer) == null || y.dispose(), this._control.refreshSelectionFilled(this._targetSelection), this._isInMergeState = !1, this._controlHandler((M, P) => {
  1898. M.setProps({
  1899. fill: this._fillControlColors[P]
  1900. });
  1901. }), this._fillControlColors = [];
  1902. });
  1903. }
  1904. _hasMergeInRange(e, t, n, s) {
  1905. return this._skeleton.worksheet.getMergedCellRange(e, t, n, s).length > 0;
  1906. }
  1907. /**
  1908. * Make sure startRow < endRow and startColumn < endColumn
  1909. *
  1910. * @param startRow
  1911. * @param startColumn
  1912. * @param endRow
  1913. * @param endColumn
  1914. * @returns {IRange} range
  1915. */
  1916. _swapPositions(e, t, n, s) {
  1917. const i = Math.min(e, n), o = Math.min(t, s), l = Math.max(e, n), a = Math.max(t, s);
  1918. return {
  1919. startRow: i,
  1920. startColumn: o,
  1921. endRow: l,
  1922. endColumn: a
  1923. };
  1924. }
  1925. _controlHandler(e) {
  1926. const {
  1927. leftControl: t,
  1928. rightControl: n,
  1929. topControl: s,
  1930. bottomControl: i,
  1931. backgroundControlTop: o,
  1932. backgroundControlMiddleLeft: l,
  1933. backgroundControlMiddleRight: a,
  1934. backgroundControlBottom: c,
  1935. fillControl: d
  1936. } = this._control, u = [
  1937. t,
  1938. n,
  1939. s,
  1940. i,
  1941. o,
  1942. l,
  1943. a,
  1944. c,
  1945. d
  1946. ];
  1947. for (let h = 0, m = u.length; h < m; h++) {
  1948. const f = u[h];
  1949. e(f, h);
  1950. }
  1951. }
  1952. _fillRuler(e, t, n, s, i) {
  1953. let o = !1;
  1954. if (e < t)
  1955. if (this._isInMergeState && e < t) {
  1956. const l = t - e, a = s + 1, c = Math.ceil(l / a);
  1957. let d = t - c * a;
  1958. d < 0 && (d = t - (c - 1) * a), t = d;
  1959. } else
  1960. t = e;
  1961. else if (e >= t && e <= n)
  1962. o = !0, this._isInMergeState || (n = e);
  1963. else if (this._isInMergeState && e > n) {
  1964. const l = e - n, a = s + 1, c = Math.ceil(l / a);
  1965. let d = n + c * a;
  1966. d > i && (d = n + (c - 1) * a), n = d;
  1967. } else
  1968. n = e;
  1969. return {
  1970. rowOrColumn: e,
  1971. startRowOrColumn: t,
  1972. endRowOrColumn: n,
  1973. isLighten: o
  1974. };
  1975. }
  1976. _getScale() {
  1977. const { scaleX: e, scaleY: t } = this._scene.getAncestorScale();
  1978. return Math.max(e, t);
  1979. }
  1980. }
  1981. var Ic = /* @__PURE__ */ ((r) => (r.Selection = "__SpreadsheetSelectionShape__", r.top = "__SpreadsheetSelectionTopControl__", r.bottom = "__SpreadsheetSelectionBottomControl__", r.left = "__SpreadsheetSelectionShapeLeftControl__", r.right = "__SpreadsheetSelectionShapeRightControl__", r.backgroundTop = "__SpreadsheetSelectionBackgroundControlTop__", r.backgroundMiddleLeft = "__SpreadsheetSelectionBackgroundControlMiddleLeft__", r.backgroundMiddleRight = "__SpreadsheetSelectionBackgroundControlMiddleRight__", r.backgroundBottom = "__SpreadsheetSelectionBackgroundControlBottom__", r.fill = "__SpreadsheetSelectionFillControl__", r.fillTopLeft = "__SpreadsheetSelectionFillControlTopLeft__", r.fillBottomRight = "__SpreadsheetSelectionFillControlBottomRight__", r.fillTopLeftInner = "__SpreadsheetSelectionFillControlTopLeftInner__", r.fillBottomRightInner = "__SpreadsheetSelectionFillControlBottomRightInner__", r.lineMain = "__SpreadsheetDragLineMainControl__", r.lineContent = "__SpreadsheetDragLineContentControl__", r.line = "__SpreadsheetDragLineControl__", r.dash = "__SpreadsheetDragDashControl__", r.rowHeaderBackground = "__SpreadSheetSelectionRowHeaderBackground__", r.rowHeaderBorder = "__SpreadSheetSelectionRowHeaderBorder__", r.rowHeaderGroup = "__SpreadSheetSelectionRowHeaderGroup__", r.columnHeaderBackground = "__SpreadSheetSelectionColumnHeaderBackground__", r.columnHeaderBorder = "__SpreadSheetSelectionColumnHeaderBorder__", r.columnHeaderGroup = "__SpreadSheetSelectionColumnHeaderGroup__", r.topLeftWidget = "__SpreadSheetSelectionTopLeftWidget__", r.topCenterWidget = "__SpreadSheetSelectionTopCenterWidget__", r.topRightWidget = "__SpreadSheetSelectionTopRightWidget__", r.middleLeftWidget = "__SpreadSheetSelectionMiddleLeftWidget__", r.middleRightWidget = "__SpreadSheetSelectionMiddleRightWidget__", r.bottomLeftWidget = "__SpreadSheetSelectionBottomLeftWidget__", r.bottomCenterWidget = "__SpreadSheetSelectionBottomCenterWidget__", r.bottomRightWidget = "__SpreadSheetSelectionBottomRightWidget__", r))(Ic || {});
  1982. const Au = 0.3;
  1983. class xd extends ce {
  1984. constructor(t, n, s, i) {
  1985. var o, l, a, c;
  1986. super();
  1987. w(this, "_isHelperSelection", !0);
  1988. /**
  1989. * For ref selections, there is no auto fill.
  1990. */
  1991. w(this, "_enableAutoFill", !0);
  1992. /**
  1993. * Only normal selections with primary cell has auto fill.
  1994. * This works for multiple normal selections. Only last selection has primary cell and auto fill.
  1995. */
  1996. w(this, "_showAutoFill", !1);
  1997. /**
  1998. * If rowHeader & col Header would be highlighted with selection.
  1999. */
  2000. w(this, "_highlightHeader", !0);
  2001. w(this, "_selectionRenderModel");
  2002. w(this, "_leftBorder");
  2003. w(this, "_rightBorder");
  2004. w(this, "_topBorder");
  2005. w(this, "_bottomBorder");
  2006. w(this, "_backgroundControlTop");
  2007. w(this, "_backgroundControlBottom");
  2008. w(this, "_backgroundControlMiddleLeft");
  2009. w(this, "_backgroundControlMiddleRight");
  2010. w(this, "_autoFillControl");
  2011. w(this, "_selectionShapeGroup");
  2012. w(this, "_rowHeaderBackground");
  2013. w(this, "_rowHeaderBorder");
  2014. w(this, "_rowHeaderGroup");
  2015. w(this, "_columnHeaderBackground");
  2016. w(this, "_columnHeaderBorder");
  2017. w(this, "_columnHeaderGroup");
  2018. w(this, "_dashedRect");
  2019. // for ref selection
  2020. w(this, "_topLeftWidget");
  2021. w(this, "_topCenterWidget");
  2022. w(this, "_topRightWidget");
  2023. w(this, "_middleLeftWidget");
  2024. w(this, "_middleRightWidget");
  2025. w(this, "_bottomLeftWidget");
  2026. w(this, "_bottomCenterWidget");
  2027. w(this, "_bottomRightWidget");
  2028. // why three style prop? what's diff between _selectionStyle & _currentStyle?
  2029. // protected _selectionStyle: Nullable<ISelectionStyle>;
  2030. w(this, "_defaultStyle");
  2031. w(this, "_currentStyle");
  2032. w(this, "_rowHeaderWidth", 0);
  2033. w(this, "_columnHeaderHeight", 0);
  2034. w(this, "_widgetRects", []);
  2035. w(this, "_controlExtension");
  2036. w(this, "_dispose$", new Me(this));
  2037. w(this, "dispose$", this._dispose$.asObservable());
  2038. /**
  2039. * eventSource: selectionShapeExtension selectionMoving$.next,
  2040. * Observer: prompt.controller
  2041. */
  2042. w(this, "selectionMoving$", new xe());
  2043. w(this, "selectionMoveEnd$", new xe());
  2044. w(this, "selectionScaling$", new xe());
  2045. w(this, "selectionScaled$", new xe());
  2046. w(this, "selectionFilling$", new xe());
  2047. w(this, "_selectionFilled$", new xe());
  2048. w(this, "selectionFilled$", this._selectionFilled$.asObservable());
  2049. w(this, "_antLineOffset", 0);
  2050. w(this, "_antRequestNewFrame", -1);
  2051. this._scene = t, this._zIndex = n, this._themeService = s, this._enableAutoFill = (o = i == null ? void 0 : i.enableAutoFill) != null ? o : !0, this._highlightHeader = (l = i == null ? void 0 : i.highlightHeader) != null ? l : !0, this._rowHeaderWidth = (a = i == null ? void 0 : i.rowHeaderWidth) != null ? a : 0, this._columnHeaderHeight = (c = i == null ? void 0 : i.columnHeaderHeight) != null ? c : 0, this._initializeSheetBody(), this._initialHeader();
  2052. }
  2053. _initializeSheetBody() {
  2054. this._defaultStyle = yr(this._themeService), this._currentStyle = yr(this._themeService), this._selectionRenderModel = new pv();
  2055. const t = this._zIndex;
  2056. this._leftBorder = new ge("__SpreadsheetSelectionShapeLeftControl__" + t, {
  2057. zIndex: t
  2058. }), this._rightBorder = new ge("__SpreadsheetSelectionShapeRightControl__" + t, {
  2059. zIndex: t
  2060. }), this._topBorder = new ge("__SpreadsheetSelectionTopControl__" + t, {
  2061. zIndex: t
  2062. }), this._bottomBorder = new ge("__SpreadsheetSelectionBottomControl__" + t, {
  2063. zIndex: t
  2064. }), this._backgroundControlTop = new ge("__SpreadsheetSelectionBackgroundControlTop__" + t, {
  2065. zIndex: t - 1,
  2066. evented: !1
  2067. }), this._backgroundControlBottom = new ge("__SpreadsheetSelectionBackgroundControlBottom__" + t, {
  2068. zIndex: t - 1,
  2069. evented: !1
  2070. }), this._backgroundControlMiddleLeft = new ge("__SpreadsheetSelectionBackgroundControlMiddleLeft__" + t, {
  2071. zIndex: t - 1,
  2072. evented: !1
  2073. }), this._backgroundControlMiddleRight = new ge("__SpreadsheetSelectionBackgroundControlMiddleRight__" + t, {
  2074. zIndex: t - 1,
  2075. evented: !1
  2076. }), this._autoFillControl = new ge("__SpreadsheetSelectionFillControl__" + t, {
  2077. zIndex: t + 1
  2078. }), this._autoFillControl.hide(), this._dashedRect = new eS("__SpreadsheetDragDashControl__" + t, {
  2079. zIndex: t + 2,
  2080. evented: !1,
  2081. stroke: "#fff"
  2082. });
  2083. const n = [
  2084. this._autoFillControl,
  2085. this._leftBorder,
  2086. this._rightBorder,
  2087. this._topBorder,
  2088. this._bottomBorder,
  2089. this._backgroundControlTop,
  2090. this._backgroundControlMiddleLeft,
  2091. this._backgroundControlMiddleRight,
  2092. this._backgroundControlBottom,
  2093. this._dashedRect
  2094. ];
  2095. this._widgetRects = this._initialWidget(), this._selectionShapeGroup = new ua("__SpreadsheetSelectionShape__" + t, ...n, ...this._widgetRects), this._selectionShapeGroup.hide(), this._selectionShapeGroup.evented = !1, this._selectionShapeGroup.zIndex = t;
  2096. const s = this.getScene();
  2097. s.addObject(this._selectionShapeGroup, Ho), this.disposeWithMe(
  2098. Ae(
  2099. s.onTransformChange$.subscribeEvent((i) => {
  2100. i.type === zh.scale && (this._updateLayoutOfSelectionControl(this._currentStyle), this._updateControlCoord());
  2101. })
  2102. )
  2103. );
  2104. }
  2105. _initialHeader() {
  2106. const t = this._zIndex;
  2107. this._rowHeaderBackground = new ge("__SpreadSheetSelectionRowHeaderBackground__" + t, {
  2108. zIndex: t - 1,
  2109. evented: !1
  2110. }), this._rowHeaderBorder = new ge("__SpreadSheetSelectionRowHeaderBorder__" + t, {
  2111. zIndex: t - 1,
  2112. evented: !1
  2113. }), this._rowHeaderGroup = new ua(
  2114. "__SpreadSheetSelectionRowHeaderGroup__" + t,
  2115. this._rowHeaderBackground,
  2116. this._rowHeaderBorder
  2117. ), this._rowHeaderGroup.hide(), this._rowHeaderGroup.evented = !1, this._rowHeaderGroup.zIndex = t, this._columnHeaderBackground = new ge("__SpreadSheetSelectionColumnHeaderBackground__" + t, {
  2118. zIndex: t - 1,
  2119. evented: !1
  2120. }), this._columnHeaderBorder = new ge("__SpreadSheetSelectionColumnHeaderBorder__" + t, {
  2121. zIndex: t - 1,
  2122. evented: !1
  2123. }), this._columnHeaderGroup = new ua(
  2124. "__SpreadSheetSelectionColumnHeaderGroup__" + t,
  2125. this._columnHeaderBackground,
  2126. this._columnHeaderBorder
  2127. ), this._columnHeaderGroup.hide(), this._columnHeaderGroup.evented = !1, this._columnHeaderGroup.zIndex = t, this.getScene().addObjects([this._rowHeaderGroup, this._columnHeaderGroup], gv);
  2128. }
  2129. _initialWidget() {
  2130. const t = this._zIndex;
  2131. return this._topLeftWidget = new ge("__SpreadSheetSelectionTopLeftWidget__" + t, {
  2132. zIndex: t + 1
  2133. }), this._topCenterWidget = new ge("__SpreadSheetSelectionTopCenterWidget__" + t, {
  2134. zIndex: t + 1
  2135. }), this._topRightWidget = new ge("__SpreadSheetSelectionTopRightWidget__" + t, {
  2136. zIndex: t + 1
  2137. }), this._middleLeftWidget = new ge("__SpreadSheetSelectionMiddleLeftWidget__" + t, {
  2138. zIndex: t + 1
  2139. }), this._middleRightWidget = new ge("__SpreadSheetSelectionMiddleRightWidget__" + t, {
  2140. zIndex: t + 1
  2141. }), this._bottomLeftWidget = new ge("__SpreadSheetSelectionBottomLeftWidget__" + t, {
  2142. zIndex: t + 1
  2143. }), this._bottomCenterWidget = new ge("__SpreadSheetSelectionBottomCenterWidget__" + t, {
  2144. zIndex: t + 1
  2145. }), this._bottomRightWidget = new ge("__SpreadSheetSelectionBottomRightWidget__" + t, {
  2146. zIndex: t + 1
  2147. }), [
  2148. this._topLeftWidget,
  2149. this._topCenterWidget,
  2150. this._topRightWidget,
  2151. this._middleLeftWidget,
  2152. this._middleRightWidget,
  2153. this._bottomLeftWidget,
  2154. this._bottomCenterWidget,
  2155. this._bottomRightWidget
  2156. ];
  2157. }
  2158. get zIndex() {
  2159. return this._zIndex;
  2160. }
  2161. get leftControl() {
  2162. return this._leftBorder;
  2163. }
  2164. get rightControl() {
  2165. return this._rightBorder;
  2166. }
  2167. get topControl() {
  2168. return this._topBorder;
  2169. }
  2170. get bottomControl() {
  2171. return this._bottomBorder;
  2172. }
  2173. get fillControl() {
  2174. return this._autoFillControl;
  2175. }
  2176. get backgroundControlTop() {
  2177. return this._backgroundControlTop;
  2178. }
  2179. get backgroundControlBottom() {
  2180. return this._backgroundControlBottom;
  2181. }
  2182. get backgroundControlMiddleLeft() {
  2183. return this._backgroundControlMiddleLeft;
  2184. }
  2185. get backgroundControlMiddleRight() {
  2186. return this._backgroundControlMiddleRight;
  2187. }
  2188. get selectionShape() {
  2189. return this._selectionShapeGroup;
  2190. }
  2191. get columnHeaderGroup() {
  2192. return this._columnHeaderGroup;
  2193. }
  2194. get rowHeaderGroup() {
  2195. return this._rowHeaderGroup;
  2196. }
  2197. get selectionShapeGroup() {
  2198. return this._selectionShapeGroup;
  2199. }
  2200. // That's so bad! _selectionModel is protected! But I don't want to expose it to the outside world
  2201. get model() {
  2202. return this._selectionRenderModel;
  2203. }
  2204. get topLeftWidget() {
  2205. return this._topLeftWidget;
  2206. }
  2207. get topCenterWidget() {
  2208. return this._topCenterWidget;
  2209. }
  2210. get topRightWidget() {
  2211. return this._topRightWidget;
  2212. }
  2213. get middleLeftWidget() {
  2214. return this._middleLeftWidget;
  2215. }
  2216. get middleRightWidget() {
  2217. return this._middleRightWidget;
  2218. }
  2219. get bottomLeftWidget() {
  2220. return this._bottomLeftWidget;
  2221. }
  2222. get bottomCenterWidget() {
  2223. return this._bottomCenterWidget;
  2224. }
  2225. get bottomRightWidget() {
  2226. return this._bottomRightWidget;
  2227. }
  2228. get themeService() {
  2229. return this._themeService;
  2230. }
  2231. get selectionModel() {
  2232. return this._selectionRenderModel;
  2233. }
  2234. set selectionModel(t) {
  2235. this._selectionRenderModel = t;
  2236. }
  2237. // get defaultStyle(): ISelectionStyle {
  2238. // return this._defaultStyle;
  2239. // }
  2240. // set defaultStyle(style: ISelectionStyle) {
  2241. // this._defaultStyle = style;
  2242. // }
  2243. get currentStyle() {
  2244. return this._currentStyle;
  2245. }
  2246. set currentStyle(t) {
  2247. this._currentStyle = t;
  2248. }
  2249. get dashedRect() {
  2250. return this._dashedRect;
  2251. }
  2252. get isHelperSelection() {
  2253. return this._isHelperSelection;
  2254. }
  2255. get rowHeaderWidth() {
  2256. return this._rowHeaderWidth;
  2257. }
  2258. set rowHeaderWidth(t) {
  2259. this._rowHeaderWidth = t;
  2260. }
  2261. get columnHeaderHeight() {
  2262. return this._columnHeaderHeight;
  2263. }
  2264. set columnHeaderHeight(t) {
  2265. this._columnHeaderHeight = t;
  2266. }
  2267. setControlExtension(t) {
  2268. this._controlExtension = new Cv(this, t);
  2269. }
  2270. setEvent(t) {
  2271. this.leftControl.evented = t, this.rightControl.evented = t, this.topControl.evented = t, this.bottomControl.evented = t;
  2272. }
  2273. refreshSelectionFilled(t) {
  2274. this._selectionFilled$.next(t);
  2275. }
  2276. /**
  2277. * Update Control Style And Position of SelectionControl
  2278. * @param selectionStyle
  2279. */
  2280. _updateLayoutOfSelectionControl(t) {
  2281. t && (this.currentStyle = Object.assign({}, this._defaultStyle, t));
  2282. const n = this.currentStyle, {
  2283. stroke: s,
  2284. widgets: i,
  2285. autofillStroke: o,
  2286. strokeDash: l,
  2287. isAnimationDash: a
  2288. } = n;
  2289. let c = n.autofillSize, d = n.strokeWidth, u = n.autofillStrokeWidth;
  2290. const h = this._getScale(), m = (d + Ro) / 2 / h;
  2291. d /= h, c /= h, u /= h < 1 ? 1 : h;
  2292. const f = Ro / h, g = rS / h, { startX: p, startY: S, endX: b, endY: v } = this._selectionRenderModel;
  2293. if (this.leftControl.transformByState({
  2294. height: v - S,
  2295. left: -m + g,
  2296. width: d,
  2297. strokeWidth: f,
  2298. top: -f / 2 + g
  2299. }), this.leftControl.setProps({
  2300. fill: s,
  2301. stroke: qi
  2302. }), this.rightControl.transformByState({
  2303. height: v - S,
  2304. left: b - p - m + g,
  2305. width: d,
  2306. strokeWidth: f,
  2307. top: -f / 2 + g
  2308. }), this.rightControl.setProps({
  2309. fill: s,
  2310. stroke: qi
  2311. }), this.topControl.transformByState({
  2312. width: b - p + d,
  2313. top: -m + g,
  2314. left: -m + g,
  2315. height: d,
  2316. strokeWidth: f
  2317. }), this.topControl.setProps({
  2318. fill: s,
  2319. stroke: qi
  2320. }), this.bottomControl.transformByState({
  2321. width: b - p + d,
  2322. top: v - S - m + g,
  2323. height: d,
  2324. left: -m + g,
  2325. strokeWidth: f
  2326. }), this.bottomControl.setProps({
  2327. fill: s,
  2328. stroke: qi
  2329. }), l == null)
  2330. this.dashedRect.hide(), this._stopAntLineAnimation();
  2331. else {
  2332. const _ = n.strokeWidth * 2 / h;
  2333. this.dashedRect.transformByState({
  2334. height: v - S,
  2335. width: b - p,
  2336. strokeWidth: _,
  2337. left: -_ / 2 + g,
  2338. top: -_ / 2 + g
  2339. }), this.dashedRect.setProps({
  2340. strokeDashArray: [0, l / h]
  2341. }), this._stopAntLineAnimation(), a !== !1 && this._startAntLineAnimation(), this.dashedRect.show();
  2342. }
  2343. if (this._showAutoFill = this._showAutoFill && this._enableAutoFill, this._showAutoFill && !this._hasWidgets(i)) {
  2344. const _ = {
  2345. fill: s,
  2346. stroke: o,
  2347. strokeScaleEnabled: !1
  2348. }, R = {
  2349. width: c - u,
  2350. height: c - u,
  2351. left: b - p - c / 2 + u / 2 - g,
  2352. top: v - S - c / 2 + u / 2 - g,
  2353. strokeWidth: u
  2354. };
  2355. this._autoFillControl.setProps(_), this._autoFillControl.transformByState(R), this._autoFillControl.show();
  2356. } else
  2357. this._autoFillControl.hide();
  2358. this._updateBackgroundControl(n), this._updateHeaderBackground(n), this._updateWidgets(n);
  2359. }
  2360. /**
  2361. * update selection control coordination by curr selection model
  2362. */
  2363. _updateControlCoord() {
  2364. const { startX: t, startY: n } = this._selectionRenderModel;
  2365. this.selectionShapeGroup.show(), this.selectionShapeGroup.translate(t, n), this.selectionShapeGroup.makeDirtyNoDebounce(!0);
  2366. }
  2367. updateStyle(t) {
  2368. this._updateLayoutOfSelectionControl(t), this._updateControlCoord();
  2369. }
  2370. /**
  2371. * Update range and primary range.
  2372. *
  2373. * highlight cell would update if primaryWithCoord has value.
  2374. * highlight cell would be cleared if primaryWithCoord is null.
  2375. * highlight would keep prev value if primaryWithCoord is undefined.
  2376. * @param rangeWithCoord
  2377. * @param primaryWithCoord
  2378. */
  2379. updateRange(t, n) {
  2380. this._selectionRenderModel.setValue(t, n), this._showAutoFill = n !== null, this._updateLayoutOfSelectionControl(), this._updateControlCoord();
  2381. }
  2382. /**
  2383. * Update range and primary range and style.
  2384. * @param selectionWthCoord
  2385. */
  2386. updateRangeBySelectionWithCoord(t) {
  2387. this._selectionRenderModel.setValue(t.rangeWithCoord, t.primaryWithCoord), this._showAutoFill = t.primaryWithCoord !== null, this._updateLayoutOfSelectionControl(t.style), this._updateControlCoord();
  2388. }
  2389. /**
  2390. * Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
  2391. *
  2392. * @deprecated use `updateRangeBySelectionWithCoord` and `updateStyle` to do same thing.
  2393. *
  2394. * @param newSelectionRange
  2395. * @param rowHeaderWidth
  2396. * @param columnHeaderHeight
  2397. * @param style
  2398. * @param primaryCell primary cell
  2399. */
  2400. update(t, n = 0, s = 0, i, o) {
  2401. this._rowHeaderWidth = n, this._columnHeaderHeight = s, this.updateRangeBySelectionWithCoord({
  2402. rangeWithCoord: t,
  2403. primaryWithCoord: o,
  2404. style: i
  2405. }), i && this.updateStyle(i);
  2406. }
  2407. /**
  2408. * Update primary range.
  2409. * highlight cell would update if primary cell has value.
  2410. * highlight cell would be cleared if primary cell is null.
  2411. * highlight would keep prev value if primary cell is undefined.
  2412. *
  2413. * @param primaryCell model.current (aka: highlight)
  2414. */
  2415. // @TODO lumixraku there are 3 concepts for same thing, primary and current and highlight
  2416. // highlight is best. primary sometimes means the actual cell(actual means ignore merge)
  2417. updateCurrCell(t) {
  2418. this._showAutoFill = t !== null, this._selectionRenderModel.setCurrentCell(t);
  2419. }
  2420. clearHighlight() {
  2421. this._showAutoFill = !1, this._selectionRenderModel.clearCurrentCell(), this._updateLayoutOfSelectionControl(this._currentStyle);
  2422. }
  2423. getScene() {
  2424. return this._scene;
  2425. }
  2426. // eslint-disable-next-line complexity
  2427. dispose() {
  2428. var t, n, s, i, o, l, a, c, d, u, h, m, f, g, p, S, b, v, _, R, I, y, M, P, E;
  2429. (t = this._leftBorder) == null || t.dispose(), (n = this._rightBorder) == null || n.dispose(), (s = this._topBorder) == null || s.dispose(), (i = this._bottomBorder) == null || i.dispose(), (o = this._backgroundControlTop) == null || o.dispose(), (l = this._backgroundControlMiddleLeft) == null || l.dispose(), (a = this._backgroundControlMiddleRight) == null || a.dispose(), (c = this._backgroundControlBottom) == null || c.dispose(), this._autoFillControl.dispose(), (d = this._selectionShapeGroup) == null || d.dispose(), (u = this._rowHeaderBackground) == null || u.dispose(), (h = this._rowHeaderBorder) == null || h.dispose(), (m = this._rowHeaderGroup) == null || m.dispose(), (f = this._rowHeaderBackground) == null || f.dispose(), (g = this._columnHeaderBackground) == null || g.dispose(), (p = this._columnHeaderBorder) == null || p.dispose(), (S = this._columnHeaderGroup) == null || S.dispose(), (b = this._topLeftWidget) == null || b.dispose(), (v = this._topCenterWidget) == null || v.dispose(), (_ = this._topRightWidget) == null || _.dispose(), (R = this._middleLeftWidget) == null || R.dispose(), (I = this._middleRightWidget) == null || I.dispose(), (y = this._bottomLeftWidget) == null || y.dispose(), (M = this._bottomCenterWidget) == null || M.dispose(), (P = this._bottomRightWidget) == null || P.dispose(), (E = this._controlExtension) == null || E.dispose(), super.dispose(), this._dispose$.next(this), this._dispose$.complete();
  2430. }
  2431. /**
  2432. * Get the cell information of the current selection, considering the case of merging cells
  2433. */
  2434. getCurrentCellInfo() {
  2435. const t = this.model.currentCell;
  2436. if (t) {
  2437. let n;
  2438. if (t.isMerged) {
  2439. const s = t.mergeInfo;
  2440. n = {
  2441. startRow: s.startRow,
  2442. endRow: s.endRow,
  2443. startColumn: s.startColumn,
  2444. endColumn: s.endColumn,
  2445. startX: s.startX,
  2446. endX: s.endX,
  2447. startY: s.startY,
  2448. endY: s.endY
  2449. };
  2450. } else {
  2451. const { actualRow: s, actualColumn: i, startX: o, endX: l, startY: a, endY: c } = t;
  2452. n = {
  2453. startRow: s,
  2454. endRow: s,
  2455. startColumn: i,
  2456. endColumn: i,
  2457. startX: o,
  2458. endX: l,
  2459. startY: a,
  2460. endY: c
  2461. };
  2462. }
  2463. return n;
  2464. }
  2465. }
  2466. getValue() {
  2467. return {
  2468. ...this._selectionRenderModel.getValue(),
  2469. style: this._currentStyle
  2470. };
  2471. }
  2472. getRange() {
  2473. return this._selectionRenderModel.getValue().rangeWithCoord;
  2474. }
  2475. enableHelperSelection() {
  2476. this._isHelperSelection = !0;
  2477. }
  2478. disableHelperSelection() {
  2479. this._isHelperSelection = !1;
  2480. }
  2481. _updateHeaderBackground(t) {
  2482. const { startX: n, startY: s, endX: i, endY: o, rangeType: l } = this._selectionRenderModel, a = this._currentStyle, c = this._getScale(), {
  2483. stroke: d,
  2484. rowHeaderFill: u = a.rowHeaderFill,
  2485. rowHeaderStroke: h = a.rowHeaderStroke,
  2486. columnHeaderFill: m = a.columnHeaderFill,
  2487. columnHeaderStroke: f = a.columnHeaderStroke
  2488. } = t;
  2489. let {
  2490. rowHeaderStrokeWidth: g = a.rowHeaderStrokeWidth,
  2491. columnHeaderStrokeWidth: p = a.columnHeaderStrokeWidth
  2492. } = t;
  2493. g /= c, p /= c;
  2494. const S = this._rowHeaderWidth, b = this._columnHeaderHeight;
  2495. if (this._highlightHeader && b > 0) {
  2496. let v = m;
  2497. l === j.COLUMN && (v = new Tn(d).setAlpha(Au).toString()), this._columnHeaderBackground.setProps({
  2498. fill: v
  2499. }), this._columnHeaderBackground.resize(i - n, b), this._columnHeaderBorder.setProps({
  2500. fill: f
  2501. }), this._columnHeaderBorder.transformByState({
  2502. width: i - n,
  2503. height: p,
  2504. top: b - p + 1 / c
  2505. }), this._columnHeaderGroup.show(), this._columnHeaderGroup.translate(n, 0);
  2506. } else
  2507. this._columnHeaderGroup.hide();
  2508. if (this._columnHeaderGroup.makeDirty(!0), this._highlightHeader && S > 0) {
  2509. let v = u;
  2510. l === j.ROW && (v = new Tn(d).setAlpha(Au).toString()), this._rowHeaderBackground.setProps({
  2511. fill: v
  2512. }), this._rowHeaderBackground.resize(S, o - s), this._rowHeaderBorder.setProps({
  2513. fill: h
  2514. }), this._rowHeaderBorder.transformByState({
  2515. width: g,
  2516. height: o - s,
  2517. left: S - g + 1 / c
  2518. }), this._rowHeaderGroup.show(), this._rowHeaderGroup.translate(0, s);
  2519. } else
  2520. this._rowHeaderGroup.hide();
  2521. this._rowHeaderGroup.makeDirty(!0);
  2522. }
  2523. _updateBackgroundControl(t) {
  2524. const { startX: n, startY: s, endX: i, endY: o } = this._selectionRenderModel, l = this._getScale(), { fill: a = t.fill } = t;
  2525. let { strokeWidth: c } = t;
  2526. c /= l;
  2527. const d = this._selectionRenderModel.highlightToSelection();
  2528. if (!d) {
  2529. this._backgroundControlTop.resize(i - n, o - s), this._backgroundControlTop.setProps({ fill: a }), this._backgroundControlBottom.resize(0, 0), this._backgroundControlMiddleLeft.resize(0, 0), this._backgroundControlMiddleRight.resize(0, 0);
  2530. return;
  2531. }
  2532. const { startX: u, startY: h, endX: m, endY: f } = d, g = c / 2, p = {
  2533. left: -g,
  2534. top: -g,
  2535. width: i - n + g * 2,
  2536. height: h - s + g
  2537. };
  2538. p.height < 0 && (p.width = 0, p.height = 0), this._backgroundControlTop.transformByState(p);
  2539. const S = {
  2540. left: -g,
  2541. top: h - s,
  2542. width: u - n + g,
  2543. height: f - h
  2544. };
  2545. S.width < 0 && (S.width = 0, S.height = 0), this._backgroundControlMiddleLeft.transformByState(S);
  2546. const b = {
  2547. left: m - n - g,
  2548. top: h - s,
  2549. width: i - m + g * 2,
  2550. height: f - h
  2551. };
  2552. b.width < 0 && (b.width = 0, b.height = 0), this._backgroundControlMiddleRight.transformByState(b);
  2553. const v = {
  2554. left: -g,
  2555. top: f - s,
  2556. width: i - n + g * 2,
  2557. height: o - f + g
  2558. };
  2559. v.height < 0 && (v.width = 0, v.height = 0), this._backgroundControlBottom.transformByState(v), this._backgroundControlTop.setProps({ fill: a }), this._backgroundControlMiddleLeft.setProps({ fill: a }), this._backgroundControlMiddleRight.setProps({ fill: a }), this._backgroundControlBottom.setProps({ fill: a });
  2560. }
  2561. _updateWidgets(t) {
  2562. const { startX: n, startY: s, endX: i, endY: o } = this._selectionRenderModel, { stroke: l = t.stroke, widgets: a = t.widgets, widgetStroke: c = t.widgetStroke } = t, d = this._getScale();
  2563. let { widgetSize: u, widgetStrokeWidth: h } = t;
  2564. u /= d, h /= d;
  2565. const m = { left: -u / 2 + h / 2, center: (i - n) / 2 - u / 2 + h / 2, right: i - n - u / 2 + h / 2, top: -u / 2, middle: (o - s) / 2 - u / 2, bottom: o - s - u / 2 + h / 2 }, f = u - h;
  2566. this._widgetRects.forEach((g) => {
  2567. g.setProps({ fill: l, stroke: c });
  2568. }), a.tl === !0 ? (this._topLeftWidget.transformByState({ height: f, width: f, left: m.left, top: m.top, strokeWidth: h }), this._topLeftWidget.show()) : this._topLeftWidget.hide(), a.tc === !0 ? (this._topCenterWidget.transformByState({ height: f, width: f, left: m.center, top: m.top, strokeWidth: h }), this._topCenterWidget.show()) : this._topCenterWidget.hide(), a.tr === !0 ? (this._topRightWidget.transformByState({ height: f, width: f, left: m.right, top: m.top, strokeWidth: h }), this._topRightWidget.show()) : this._topRightWidget.hide(), a.ml === !0 ? (this._middleLeftWidget.transformByState({ height: f, width: f, left: m.left, top: m.middle, strokeWidth: h }), this._middleLeftWidget.show()) : this._middleLeftWidget.hide(), a.mr === !0 ? (this._middleRightWidget.transformByState({ height: f, width: f, left: m.right, top: m.middle, strokeWidth: h }), this._middleRightWidget.show()) : this._middleRightWidget.hide(), a.bl === !0 ? (this._bottomLeftWidget.transformByState({ height: f, width: f, left: m.left, top: m.bottom, strokeWidth: h }), this._bottomLeftWidget.show()) : this._bottomLeftWidget.hide(), a.bc === !0 ? (this._bottomCenterWidget.transformByState({ height: f, width: f, left: m.center, top: m.bottom, strokeWidth: h }), this._bottomCenterWidget.show()) : this._bottomCenterWidget.hide(), a.br === !0 ? (this._bottomRightWidget.transformByState({ height: f, width: f, left: m.right, top: m.bottom, strokeWidth: h }), this._bottomRightWidget.show()) : this._bottomRightWidget.hide();
  2569. }
  2570. _hasWidgets(t) {
  2571. if (t == null)
  2572. return !1;
  2573. const n = Object.keys(t);
  2574. if (n.length === 0)
  2575. return !1;
  2576. for (const s of n)
  2577. if (t[s] === !0)
  2578. return !0;
  2579. return !1;
  2580. }
  2581. _getScale() {
  2582. const { scaleX: t, scaleY: n } = this._scene.getAncestorScale();
  2583. return Math.max(t, n);
  2584. }
  2585. _stopAntLineAnimation() {
  2586. this._antLineOffset = 0, tS(this._antRequestNewFrame);
  2587. }
  2588. _startAntLineAnimation() {
  2589. const t = this._getScale();
  2590. this._antLineOffset += 0.6 / t, this._antLineOffset > 160 / t && (this._antLineOffset = 0), this.dashedRect.setProps({
  2591. strokeDashOffset: -this._antLineOffset
  2592. }), this._antRequestNewFrame = nS(() => {
  2593. this._startAntLineAnimation();
  2594. });
  2595. }
  2596. }
  2597. class vv extends sS {
  2598. render(e, t = !1) {
  2599. const n = se.now();
  2600. return super.render(e, t), this._afterRender(n), this;
  2601. }
  2602. _afterRender(e) {
  2603. this.scene.getEngine().renderFrameTimeMetric$.next(["selectionLayer", se.now() - e]);
  2604. }
  2605. }
  2606. const dt = gn("univer.sheet.selection-render-service");
  2607. class ef extends ce {
  2608. constructor(t, n, s, i, o) {
  2609. super();
  2610. w(this, "_downObserver");
  2611. w(this, "_scenePointerMoveSub");
  2612. w(this, "_scenePointerUpSub");
  2613. w(this, "_controlFillConfig$", new Me(null));
  2614. w(this, "controlFillConfig$", this._controlFillConfig$.asObservable());
  2615. w(this, "_selectionControls", []);
  2616. // sheetID:Controls
  2617. w(this, "_startRangeWhenPointerDown", {
  2618. startY: 0,
  2619. endY: 0,
  2620. startX: 0,
  2621. endX: 0,
  2622. startRow: -1,
  2623. endRow: -1,
  2624. startColumn: -1,
  2625. endColumn: -1
  2626. });
  2627. w(this, "_activeControlIndex", -1);
  2628. /**
  2629. * the posX of viewport when the pointer down
  2630. */
  2631. w(this, "_startViewportPosX", 0);
  2632. /**
  2633. * the posY of viewport when the pointer down
  2634. */
  2635. w(this, "_startViewportPosY", 0);
  2636. w(this, "_scrollTimer");
  2637. w(this, "_cancelDownSubscription");
  2638. w(this, "_cancelUpSubscription");
  2639. w(this, "_skeleton");
  2640. /**
  2641. * From renderContext.
  2642. */
  2643. w(this, "_scene");
  2644. // The type of selector determines the type of data range and the highlighting style of the title bar, now it always true. In future, this could be configurable by user.
  2645. w(this, "_highlightHeader", !0);
  2646. // protected _shouldDetectMergedCells: boolean = true;
  2647. w(this, "_rangeType", j.NORMAL);
  2648. // The style of the selection area, including dashed lines, color, thickness, autofill, other points for modifying the range of the selection area, title highlighting, and so on, can all be customized.
  2649. w(this, "_selectionStyle");
  2650. // #region ref range selection
  2651. // we put the properties here for simplicity
  2652. // Used in the formula selection feature, a new selection string is added by drawing a box with the mouse.
  2653. w(this, "_remainLastEnabled", !1);
  2654. w(this, "_skipLastEnabled", !1);
  2655. w(this, "_singleSelectionEnabled", !1);
  2656. // #endregion
  2657. /**
  2658. * Mainly emit by pointerup in spreadsheet. (pointerup is handled in _onPointerdown)
  2659. */
  2660. w(this, "_selectionMoveEnd$", new Me([]));
  2661. /**
  2662. * Pointerup in spreadsheet
  2663. */
  2664. w(this, "selectionMoveEnd$", this._selectionMoveEnd$.asObservable());
  2665. /**
  2666. * Mainly emit by pointermove in spreadsheet
  2667. */
  2668. w(this, "_selectionMoving$", new xe());
  2669. /**
  2670. * Pointermove in spreadsheet
  2671. */
  2672. w(this, "selectionMoving$", this._selectionMoving$.asObservable());
  2673. w(this, "_selectionMoveStart$", new xe());
  2674. w(this, "selectionMoveStart$", this._selectionMoveStart$.asObservable());
  2675. w(this, "_selectionMoving", !1);
  2676. w(this, "_selectionTheme");
  2677. w(this, "_activeViewport");
  2678. w(this, "interceptor", new Cs({ RANGE_MOVE_PERMISSION_CHECK: wc, RANGE_FILL_PERMISSION_CHECK: Rc }));
  2679. w(this, "_escapeShortcutDisposable", null);
  2680. this._injector = t, this._themeService = n, this._shortcutService = s, this._sheetSkeletonManagerService = i, this.contextService = o, this._initSelectionThemeFromThemeService(), this._initMoving();
  2681. }
  2682. get selectionMoving() {
  2683. return this._selectionMoving;
  2684. }
  2685. /**
  2686. * If true, the selector will respond to the range of merged cells and automatically extend the selected range. If false, it will ignore the merged cells.
  2687. */
  2688. get _shouldDetectMergedCells() {
  2689. return this._rangeType === j.NORMAL;
  2690. }
  2691. _initMoving() {
  2692. this.disposeWithMe(this._selectionMoving$.subscribe(() => {
  2693. this._selectionMoving = !0;
  2694. })), this.disposeWithMe(this._selectionMoveEnd$.subscribe(() => {
  2695. this._selectionMoving = !1;
  2696. }));
  2697. }
  2698. _setSelectionStyle(t) {
  2699. this._selectionStyle = t;
  2700. }
  2701. /**
  2702. * Reset this._selectionStyle to default normal selection style
  2703. */
  2704. // protected _resetSelectionStyle(): void {
  2705. // this._setSelectionStyle(genNormalSelectionStyle(this._themeService));
  2706. // }
  2707. /** @deprecated This should not be provided by the selection render service. */
  2708. getViewPort() {
  2709. return this._activeViewport;
  2710. }
  2711. setSingleSelectionEnabled(t = !1) {
  2712. this._singleSelectionEnabled = t;
  2713. }
  2714. newSelectionControl(t, n, s) {
  2715. const i = this.getSelectionControls().length, { rowHeaderWidth: o, columnHeaderHeight: l } = n, a = new xd(t, i, this._selectionTheme, {
  2716. highlightHeader: this._highlightHeader,
  2717. rowHeaderWidth: o,
  2718. columnHeaderHeight: l
  2719. });
  2720. this._selectionControls.push(a);
  2721. const c = Pt(s, n);
  2722. return a.updateRangeBySelectionWithCoord(c), a.setControlExtension({
  2723. skeleton: n,
  2724. scene: t,
  2725. themeService: this._selectionTheme,
  2726. injector: this._injector,
  2727. selectionHooks: {
  2728. selectionMoveEnd: () => {
  2729. this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
  2730. }
  2731. }
  2732. }), a;
  2733. }
  2734. /**
  2735. * Update the corresponding selectionControl based on selectionsData from WorkbookSelectionModel
  2736. * selectionData[i] --> selectionControls[i]
  2737. * @param selectionsWithStyleList {ISelectionWithStyle[]} selectionsData from WorkbookSelectionModel
  2738. */
  2739. resetSelectionsByModelData(t) {
  2740. const n = this.getSelectionControls(), s = this._skeleton;
  2741. if (!(!n || !s)) {
  2742. for (let i = 0, o = t.length; i < o; i++) {
  2743. const l = t[i], a = Pt(l, this._skeleton), c = n[i];
  2744. c ? c.updateRangeBySelectionWithCoord(a) : this.isSelectionEnabled() && this.newSelectionControl(this._scene, s, l);
  2745. }
  2746. t.length < n.length && n.splice(t.length).forEach((o) => o.dispose());
  2747. }
  2748. }
  2749. refreshSelectionMoveStart() {
  2750. this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
  2751. }
  2752. refreshSelectionMoveEnd() {
  2753. this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
  2754. }
  2755. _initSelectionThemeFromThemeService() {
  2756. const t = this._themeService.getCurrentTheme();
  2757. this._selectionTheme = new kt(), this._selectionTheme.setTheme(t);
  2758. }
  2759. setSelectionTheme(t) {
  2760. this._selectionTheme.setTheme(t);
  2761. }
  2762. _changeRuntime(t, n, s) {
  2763. this._skeleton = t, this._scene = n, this._activeViewport = s || (n == null ? void 0 : n.getViewports()[0]), n.findLayerByZIndex(Ho) || n.addLayer(new vv(n, [], Ho));
  2764. }
  2765. getSkeleton() {
  2766. return this._skeleton;
  2767. }
  2768. /**
  2769. * Generate selectionData from this._selectionControls.model .
  2770. * @returns {ISelectionWithCoord[]} {range, primary, style}[]
  2771. */
  2772. getSelectionDataWithStyle() {
  2773. const t = this._selectionControls, [n, s] = this._skeleton.getLocation();
  2774. return t.map((i) => {
  2775. const o = i.getValue();
  2776. return o.rangeWithCoord.sheetId = s, o.rangeWithCoord.unitId = n, o;
  2777. });
  2778. }
  2779. /**
  2780. * @TODO lumixraku DO NOT expose private props.
  2781. */
  2782. getSelectionControls() {
  2783. return this._selectionControls;
  2784. }
  2785. /**
  2786. * Add a selection in spreadsheet, create a new SelectionControl and then update this control by range derives from selection.
  2787. * @param {ISelectionWithCoord} selectionWithStyle
  2788. */
  2789. _addSelectionControlByModelData(t) {
  2790. var l;
  2791. const n = this._skeleton, s = (l = t.style) != null ? l : yr(this._selectionTheme), i = this._scene;
  2792. return t.style = s, this.newSelectionControl(i, n, t);
  2793. }
  2794. _clearAllSelectionControls() {
  2795. const t = this._selectionControls;
  2796. for (const n of t)
  2797. n.dispose();
  2798. this._selectionControls.length = 0;
  2799. }
  2800. _getFreeze() {
  2801. var n;
  2802. return (n = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : n.skeleton.getWorksheetConfig().freeze;
  2803. }
  2804. _getViewportByCell(t, n) {
  2805. if (t === void 0 || n === void 0)
  2806. return null;
  2807. const s = this._getFreeze();
  2808. if (!s || s.startRow <= 0 && s.startColumn <= 0)
  2809. return this._scene.getViewport(z.VIEW_MAIN);
  2810. if (t > s.startRow && n > s.startColumn)
  2811. return this._scene.getViewport(z.VIEW_MAIN);
  2812. if (t <= s.startRow && n <= s.startColumn)
  2813. return this._scene.getViewport(z.VIEW_MAIN_LEFT_TOP);
  2814. if (t <= s.startRow && n > s.startColumn)
  2815. return this._scene.getViewport(z.VIEW_MAIN_TOP);
  2816. if (t > s.startRow && n <= s.startColumn)
  2817. return this._scene.getViewport(z.VIEW_MAIN_LEFT);
  2818. }
  2819. /**
  2820. * Returns the selected range in the active sheet, or null if there is no active range. If multiple ranges are selected this method returns only the last selected range.
  2821. */
  2822. getActiveRange() {
  2823. const t = this.getSelectionControls(), n = t && t[t.length - 1].model;
  2824. return n && {
  2825. startRow: n.startRow,
  2826. startColumn: n.startColumn,
  2827. endRow: n.endRow,
  2828. endColumn: n.endColumn
  2829. };
  2830. }
  2831. setActiveSelectionIndex(t) {
  2832. this._activeControlIndex = t;
  2833. }
  2834. resetActiveSelectionIndex() {
  2835. this._activeControlIndex = -1;
  2836. }
  2837. /**
  2838. * get active(actually last) selection control
  2839. * @returns T extends SelectionControl
  2840. */
  2841. getActiveSelectionControl() {
  2842. const t = this.getSelectionControls();
  2843. if (t)
  2844. return this._activeControlIndex < 0 ? t[t.length - 1] : t[this._activeControlIndex];
  2845. }
  2846. endSelection() {
  2847. var t;
  2848. this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (t = this._escapeShortcutDisposable) == null || t.dispose(), this._escapeShortcutDisposable = null;
  2849. }
  2850. /**
  2851. * Clear existed selections by workbookSelections.selectionMoveEnd$
  2852. */
  2853. _reset() {
  2854. var t;
  2855. this._clearAllSelectionControls(), (t = this._downObserver) == null || t.unsubscribe(), this._downObserver = null;
  2856. }
  2857. /**
  2858. * Init pointer move listener in each pointer down, unbind in each pointer up.
  2859. * Both cell selections and row-column selections are supported by this method.
  2860. * @param viewportMain
  2861. * @param activeSelectionControl
  2862. * @param rangeType
  2863. * @param scrollTimerType
  2864. * @param moveStartPosX
  2865. * @param moveStartPosY
  2866. */
  2867. _setupPointerMoveListener(t, n, s, i = It.ALL, o, l) {
  2868. var f, g;
  2869. let a = 0, c = 0, d = o, u = l;
  2870. this._scrollTimer = Kr.create(this._scene, i), this._scrollTimer.startScroll((f = t == null ? void 0 : t.left) != null ? f : 0, (g = t == null ? void 0 : t.top) != null ? g : 0, t);
  2871. const h = this._scene, m = h.getActiveViewportByCoord(Oe.FromArray([o, l]));
  2872. this._scenePointerMoveSub = h.onPointerMove$.subscribeEvent((p) => {
  2873. var A, H, x, k, U, V, N, X, Y;
  2874. const { offsetX: S, offsetY: b } = p, { x: v, y: _ } = h.getCoordRelativeToViewport(Oe.FromArray([S, b]));
  2875. this._movingHandler(v, _, n, s);
  2876. let R = v, I = _;
  2877. const y = this.getActiveSelectionControl(), M = this._getFreeze(), P = y == null ? void 0 : y.model, E = (A = h.getActiveViewportByCoord(Oe.FromArray([S, b]))) != null ? A : this._getViewportByCell(P == null ? void 0 : P.endRow, P == null ? void 0 : P.endColumn);
  2878. if ((() => {
  2879. if (!m || !E || !t)
  2880. return !1;
  2881. const ie = [
  2882. z.VIEW_MAIN,
  2883. z.VIEW_MAIN_LEFT_TOP,
  2884. z.VIEW_MAIN_TOP,
  2885. z.VIEW_MAIN_LEFT
  2886. ];
  2887. return ie.includes(m.viewportKey) && ie.includes(E.viewportKey);
  2888. })()) {
  2889. if (!m || !E || !t)
  2890. return !1;
  2891. const ie = d < t.left && v > t.left || d > t.left && v < t.left, he = u < t.top && _ > t.top || u > t.top && _ < t.top;
  2892. ie && (a += 1), he && (c += 1);
  2893. const ne = m.viewportKey, pe = E.viewportKey;
  2894. if (ne === z.VIEW_ROW_TOP)
  2895. b < t.top && ((H = P == null ? void 0 : P.endRow) != null ? H : 0) < ((x = M == null ? void 0 : M.startRow) != null ? x : 0) ? I = t.top : he && c % 2 === 1 && t.scrollToViewportPos({
  2896. viewportScrollY: 0
  2897. });
  2898. else if (ne === z.VIEW_COLUMN_LEFT)
  2899. S < t.left && ((k = P == null ? void 0 : P.endColumn) != null ? k : 0) < ((U = M == null ? void 0 : M.startColumn) != null ? U : 0) ? R = t.left : ie && a % 2 === 1 && t.scrollToViewportPos({
  2900. viewportScrollX: 0
  2901. });
  2902. else if (ne === pe) {
  2903. let ve = !1, G = !1;
  2904. ne === z.VIEW_MAIN_LEFT_TOP ? (ve = !0, G = !0) : ne === z.VIEW_MAIN_TOP ? G = !0 : ne === z.VIEW_MAIN_LEFT && (ve = !0), ((V = P == null ? void 0 : P.endRow) != null ? V : 0) > ((N = M == null ? void 0 : M.startRow) != null ? N : 0) && (G = !1), ((X = P == null ? void 0 : P.endColumn) != null ? X : 0) > ((Y = M == null ? void 0 : M.startColumn) != null ? Y : 0) && (ve = !1), ve && (R = t.left), G && (I = t.top);
  2905. } else {
  2906. const ve = {
  2907. x: m.scrollX,
  2908. y: m.scrollY
  2909. }, G = {
  2910. x: E.scrollX,
  2911. y: E.scrollY
  2912. }, J = ve.x !== G.x && ie && a % 2 === 1, le = ve.y !== G.y && he && c % 2 === 1;
  2913. (J || le) && (t.scrollToBarPos({
  2914. x: J ? ve.x : void 0,
  2915. y: le ? ve.y : void 0
  2916. }), J || (R = t.left), le || (I = t.top)), (ne === z.VIEW_MAIN_LEFT_TOP && pe === z.VIEW_MAIN_LEFT || pe === z.VIEW_MAIN_LEFT_TOP && ne === z.VIEW_MAIN_LEFT) && (R = t.left), (ne === z.VIEW_MAIN_LEFT_TOP && pe === z.VIEW_MAIN_TOP || pe === z.VIEW_MAIN_LEFT_TOP && ne === z.VIEW_MAIN_TOP) && (I = t.top);
  2917. }
  2918. d = v, u = _;
  2919. }
  2920. this._scrollTimer.scrolling(R, I, () => {
  2921. this._movingHandler(v, _, n, s);
  2922. });
  2923. });
  2924. }
  2925. /** @deprecated Use the function `attachSelectionWithCoord` instead`. */
  2926. attachSelectionWithCoord(t) {
  2927. return Pt(t, this._skeleton);
  2928. }
  2929. /** @deprecated Use the function `attachPrimaryWithCoord` instead`. */
  2930. attachPrimaryWithCoord(t) {
  2931. return xo(this._skeleton, t);
  2932. }
  2933. /**
  2934. * @deprecated Please use `getCellWithCoordByOffset` instead.
  2935. */
  2936. getSelectionCellByPosition(t, n) {
  2937. return this.getCellWithCoordByOffset(t, n);
  2938. }
  2939. getCellWithCoordByOffset(t, n, s) {
  2940. const i = this._scene, o = s != null ? s : this._skeleton, l = i.getViewportScrollXY(i.getViewport(z.VIEW_MAIN)), { scaleX: a, scaleY: c } = i.getAncestorScale();
  2941. return o.getCellWithCoordByOffset(t, n, a, c, l);
  2942. }
  2943. /**
  2944. * When mousedown and mouseup need to go to the coordination and undo stack, when mousemove does not need to go to the coordination and undo stack
  2945. */
  2946. _movingHandler(t, n, s, i) {
  2947. var R, I, y, M, P;
  2948. const o = this._skeleton, l = this._scene, [a, c] = o.getLocation(), d = {
  2949. startRow: (R = s == null ? void 0 : s.model.startRow) != null ? R : -1,
  2950. endRow: (I = s == null ? void 0 : s.model.endRow) != null ? I : -1,
  2951. startColumn: (y = s == null ? void 0 : s.model.startColumn) != null ? y : -1,
  2952. endColumn: (M = s == null ? void 0 : s.model.endColumn) != null ? M : -1,
  2953. unitId: a,
  2954. sheetId: c
  2955. }, u = l.getViewport(z.VIEW_MAIN), h = (P = this._getViewportByCell(d.endRow, d.endColumn)) != null ? P : u, m = l.getScrollXYInfoByViewport(
  2956. Oe.FromArray([this._startViewportPosX, this._startViewportPosY]),
  2957. h
  2958. ), { scaleX: f, scaleY: g } = l.getAncestorScale();
  2959. i === j.ROW ? t = Number.POSITIVE_INFINITY : i === j.COLUMN && (n = Number.POSITIVE_INFINITY);
  2960. const p = this._skeleton.getCellByOffset(t, n, f, g, m);
  2961. if (!p)
  2962. return;
  2963. let S = {
  2964. startRow: Math.min(p.startRow, this._startRangeWhenPointerDown.startRow),
  2965. startColumn: Math.min(p.startColumn, this._startRangeWhenPointerDown.startColumn),
  2966. endRow: Math.max(p.endRow, this._startRangeWhenPointerDown.endRow),
  2967. endColumn: Math.max(p.endColumn, this._startRangeWhenPointerDown.endColumn)
  2968. };
  2969. this._shouldDetectMergedCells && (S = o.expandRangeByMerge(S));
  2970. const v = Pt({ range: S, primary: void 0, style: null }, o);
  2971. v.rangeWithCoord.unitId = a, v.rangeWithCoord.sheetId = c, v.rangeWithCoord.rangeType = i;
  2972. const _ = d.startRow !== S.startRow || d.startColumn !== S.startColumn || d.endRow !== S.endRow || d.endColumn !== S.endColumn;
  2973. s != null && _ && (s.updateRangeBySelectionWithCoord(v), this._selectionMoving$.next(this.getSelectionDataWithStyle()));
  2974. }
  2975. _clearUpdatingListeners() {
  2976. var n, s, i, o, l;
  2977. this._scene.enableObjectsEvent(), (n = this._scenePointerMoveSub) == null || n.unsubscribe(), this._scenePointerMoveSub = null, (s = this._scenePointerUpSub) == null || s.unsubscribe(), this._scenePointerUpSub = null, (i = this._cancelDownSubscription) == null || i.unsubscribe(), this._cancelDownSubscription = null, (o = this._cancelUpSubscription) == null || o.unsubscribe(), this._cancelUpSubscription = null, (l = this._scrollTimer) == null || l.dispose();
  2978. }
  2979. _addEndingListeners() {
  2980. var s, i, o;
  2981. const t = this._scene, n = (s = t.getEngine()) == null ? void 0 : s.activeScene;
  2982. !n || n === t || ((i = this._cancelDownSubscription) == null || i.unsubscribe(), this._cancelDownSubscription = null, (o = this._cancelUpSubscription) == null || o.unsubscribe(), this._cancelUpSubscription = null, this._cancelDownSubscription = n.onPointerDown$.subscribeEvent(() => this._clearUpdatingListeners()), this._cancelUpSubscription = n.onPointerUp$.subscribeEvent(() => this._clearUpdatingListeners()));
  2983. }
  2984. /**
  2985. * Get visible selection range & coord by offset on viewport. Nearly same as skeleton.getCellWithCoordByOffset
  2986. * Returning selection is only one cell. primary and range are same cell.
  2987. *
  2988. * visible selection range means getCellWithCoordByOffset needs first matched row/col in rowHeightAccumulation & colWidthAccumulation.
  2989. * Original name: _getCellRangeByCursorPosition
  2990. *
  2991. * @param offsetX position X in viewport.
  2992. * @param offsetY
  2993. * @param scaleX
  2994. * @param scaleY
  2995. * @param scrollXY
  2996. * @returns {Nullable<ISelectionWithCoord>} selection range with coord.
  2997. */
  2998. _getSelectionWithCoordByOffset(t, n, s, i, o) {
  2999. const l = this._skeleton;
  3000. if (l == null) return null;
  3001. if (this._shouldDetectMergedCells) {
  3002. const S = l == null ? void 0 : l.getCellWithCoordByOffset(
  3003. t,
  3004. n,
  3005. s,
  3006. i,
  3007. o,
  3008. { firstMatch: !0 }
  3009. );
  3010. if (!S) return;
  3011. const b = bo(S);
  3012. return {
  3013. primaryWithCoord: S,
  3014. rangeWithCoord: b
  3015. };
  3016. }
  3017. const { row: a, column: c } = l.getCellIndexByOffset(t, n, s, i, o), d = l.getNoMergeCellPositionByIndex(a, c), { startX: u, startY: h, endX: m, endY: f } = d, g = {
  3018. startY: h,
  3019. endY: f,
  3020. startX: u,
  3021. endX: m,
  3022. startRow: a,
  3023. endRow: a,
  3024. startColumn: c,
  3025. endColumn: c
  3026. };
  3027. return {
  3028. primaryWithCoord: {
  3029. mergeInfo: g,
  3030. actualRow: a,
  3031. actualColumn: c,
  3032. isMerged: !1,
  3033. isMergedMainCell: !1,
  3034. startY: h,
  3035. endY: f,
  3036. startX: u,
  3037. endX: m
  3038. },
  3039. rangeWithCoord: g
  3040. };
  3041. }
  3042. _checkClearPreviousControls(t) {
  3043. this.getSelectionControls().length !== 0 && (!t.ctrlKey && !t.shiftKey && !this._remainLastEnabled || this._singleSelectionEnabled && !t.shiftKey) && this._clearAllSelectionControls();
  3044. }
  3045. _makeSelectionByTwoCells(t, n, s, i, o) {
  3046. const { actualRow: l, actualColumn: a, mergeInfo: c } = t;
  3047. this._startRangeWhenPointerDown = { ...t.mergeInfo };
  3048. const d = Math.min(l, n.startRow, c.startRow), u = Math.max(l, n.endRow, c.endRow), h = Math.min(a, n.startColumn, c.startColumn), m = Math.max(a, n.endColumn, c.endColumn), g = {
  3049. range: s.expandRangeByMerge({
  3050. startRow: d,
  3051. startColumn: h,
  3052. endRow: u,
  3053. endColumn: m
  3054. }),
  3055. primary: null,
  3056. style: null
  3057. }, p = Pt(g, s);
  3058. o.updateRangeBySelectionWithCoord(p);
  3059. }
  3060. isSelectionEnabled() {
  3061. return this.contextService.getContextValue(Yr);
  3062. }
  3063. isSelectionDisabled() {
  3064. return this.contextService.getContextValue(Yr) === !1;
  3065. }
  3066. inRefSelectionMode() {
  3067. return this.contextService.getContextValue(Js);
  3068. }
  3069. }
  3070. function tf(r) {
  3071. return {
  3072. range: {
  3073. startRow: 0,
  3074. startColumn: 0,
  3075. endRow: r.getRowCount() - 1,
  3076. endColumn: r.getColumnCount() - 1,
  3077. rangeType: j.ALL
  3078. },
  3079. primary: Od(r).primary,
  3080. style: null
  3081. };
  3082. }
  3083. function Od(r) {
  3084. return bv(r, {
  3085. startRow: 0,
  3086. startColumn: 0,
  3087. endRow: 0,
  3088. endColumn: 0
  3089. });
  3090. }
  3091. function bv(r, e) {
  3092. const t = r.worksheet.getCellInfoInMergeData(e.startRow, e.startColumn), n = r.worksheet.getCellInfoInMergeData(e.endRow, e.endColumn);
  3093. return {
  3094. range: {
  3095. startRow: t.startRow,
  3096. startColumn: t.startColumn,
  3097. endRow: n.endRow,
  3098. endColumn: n.endColumn,
  3099. rangeType: j.NORMAL
  3100. },
  3101. primary: {
  3102. actualRow: t.startRow,
  3103. actualColumn: t.startColumn,
  3104. startRow: t.startRow,
  3105. startColumn: t.startColumn,
  3106. endRow: t.endRow,
  3107. endColumn: t.endColumn,
  3108. isMerged: t.isMerged,
  3109. isMergedMainCell: t.isMergedMainCell
  3110. },
  3111. style: null
  3112. };
  3113. }
  3114. var _v = Object.defineProperty, wv = Object.getOwnPropertyDescriptor, Rv = (r, e, t, n) => {
  3115. for (var s = n > 1 ? void 0 : n ? wv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  3116. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  3117. return n && s && _v(e, t, s), s;
  3118. }, lr = (r, e) => (t, n) => e(t, n, r);
  3119. let yc = class extends ce {
  3120. constructor(e, t, n, s, i, o, l) {
  3121. super();
  3122. w(this, "_editorUnitId", Le);
  3123. w(this, "_editorIsDirty", !1);
  3124. w(this, "_isDisabled", !1);
  3125. w(this, "_visible", {
  3126. visible: !1,
  3127. eventType: Xe.Dblclick,
  3128. unitId: ""
  3129. });
  3130. w(this, "_currentEditCell", null);
  3131. w(this, "_currentEditCellState", null);
  3132. w(this, "_currentEditCellLayout", null);
  3133. // TODO: @weird94 this should split into to subjects, documentDataModel & position
  3134. w(this, "_currentEditCellState$", new Me(null));
  3135. w(this, "currentEditCellState$", this._currentEditCellState$.asObservable());
  3136. w(this, "_currentEditCellLayout$", new Me(null));
  3137. w(this, "currentEditCellLayout$", this._currentEditCellLayout$.asObservable());
  3138. w(this, "currentEditCell$", this._currentEditCellState$.pipe(
  3139. We((e) => this._currentEditCellLayout$.pipe(_e((t) => e && t ? { ...e, ...t } : null)))
  3140. ));
  3141. w(this, "_visible$", new Me(this._visible));
  3142. w(this, "visible$", this._visible$.asObservable());
  3143. w(this, "_afterVisible$", new Me(this._visible));
  3144. w(this, "afterVisible$", this._afterVisible$.asObservable());
  3145. w(this, "_forceKeepVisible$", new Me(!1));
  3146. w(this, "forceKeepVisible$", this._forceKeepVisible$.asObservable());
  3147. this._sheetInterceptorService = e, this._renderManagerService = t, this._themeService = n, this._univerInstanceService = s, this._editorService = i, this._refSelectionsService = o, this._contextService = l, this.disposeWithMe(Ae(() => {
  3148. this._currentEditCellState$.complete(), this._currentEditCell = null;
  3149. })), this._univerInstanceService.getTypeOfUnitDisposed$(O.UNIVER_SHEET).subscribe((a) => {
  3150. var c;
  3151. a.getUnitId() === ((c = this._currentEditCellState) == null ? void 0 : c.unitId) && this._clearCurrentEditCellState();
  3152. });
  3153. }
  3154. refreshEditCellState() {
  3155. const e = this.getLatestEditCellState();
  3156. if (!e) {
  3157. this._currentEditCellState = null, this._currentEditCellLayout = null, this._currentEditCellState$.next(null), this._currentEditCellLayout$.next(null);
  3158. return;
  3159. }
  3160. const { position: t, scaleX: n, scaleY: s, canvasOffset: i, ...o } = e;
  3161. this._currentEditCellState = o, this._currentEditCellLayout = { position: t, scaleX: n, scaleY: s, canvasOffset: i }, this._currentEditCellState$.next(this._currentEditCellState), this._currentEditCellLayout$.next(this._currentEditCellLayout);
  3162. }
  3163. refreshEditCellPosition(e) {
  3164. var R;
  3165. const t = this._currentEditCell;
  3166. if (t == null)
  3167. return;
  3168. const n = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_SHEET);
  3169. if (!n) return;
  3170. const s = (R = n.with(me).getWorksheetSkeleton(t.sheetId)) == null ? void 0 : R.skeleton, i = n.with(dt);
  3171. if (!s || !this._currentEditCellState) return;
  3172. const { primary: o, unitId: l, sheetId: a, scene: c, engine: d } = t, u = xo(s, o);
  3173. if (u == null)
  3174. return;
  3175. const h = bo(u), m = ru(d);
  3176. let { startX: f, startY: g, endX: p, endY: S } = h;
  3177. const { scaleX: b, scaleY: v } = c.getAncestorScale(), _ = c.getViewportScrollXY(i.getViewPort());
  3178. f = s.convertTransformToOffsetX(f, b, _), g = s.convertTransformToOffsetY(g, v, _), p = s.convertTransformToOffsetX(p, b, _), S = s.convertTransformToOffsetY(S, v, _), e && this._currentEditCellLayout && (p = p - f + this._currentEditCellLayout.position.startX, S = S - g + this._currentEditCellLayout.position.startY, f = this._currentEditCellLayout.position.startX, g = this._currentEditCellLayout.position.startY), this._currentEditCellLayout = {
  3179. position: {
  3180. startX: f,
  3181. startY: g,
  3182. endX: p,
  3183. endY: S
  3184. },
  3185. canvasOffset: m,
  3186. scaleX: b,
  3187. scaleY: v
  3188. }, this._currentEditCellLayout$.next(this._currentEditCellLayout);
  3189. }
  3190. setEditCell(e) {
  3191. this._currentEditCell = e, this._editorService.getFocusEditor() || (this._editorService.focus(Le), this._contextService.setContextValue(Je, !1), this._contextService.setContextValue(Sl, !1));
  3192. const t = this.getLatestEditCellState();
  3193. if (!t) {
  3194. this._currentEditCellState = t, this._currentEditCellLayout = t, this._currentEditCellState$.next(t), this._currentEditCellLayout$.next(t);
  3195. return;
  3196. }
  3197. const { position: n, canvasOffset: s, scaleX: i, scaleY: o, ...l } = t;
  3198. this._currentEditCellState = l, this._currentEditCellLayout = { position: n, canvasOffset: s, scaleX: i, scaleY: o }, this._currentEditCellState$.next(this._currentEditCellState), this._currentEditCellLayout$.next(this._currentEditCellLayout);
  3199. }
  3200. _clearCurrentEditCellState() {
  3201. this._currentEditCellState = null, this._currentEditCellState$.next(null), this._currentEditCellLayout = null, this._currentEditCellLayout$.next(null);
  3202. }
  3203. getEditCellState() {
  3204. return this._currentEditCellState == null || this._currentEditCellLayout == null ? null : { ...this._currentEditCellState, ...this._currentEditCellLayout };
  3205. }
  3206. getEditCellLayout() {
  3207. return this._currentEditCellLayout;
  3208. }
  3209. getEditLocation() {
  3210. return this._currentEditCellState;
  3211. }
  3212. // eslint-disable-next-line max-lines-per-function
  3213. getLatestEditCellState() {
  3214. var A, H, x;
  3215. const e = this._currentEditCell;
  3216. if (e == null)
  3217. return;
  3218. const t = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_SHEET);
  3219. if (!t) return;
  3220. const n = t.with(me).getCurrentSkeleton(), s = t.with(dt);
  3221. if (!n) return;
  3222. const { primary: i, unitId: o, sheetId: l, scene: a, engine: c } = e, { startRow: d, startColumn: u } = i, h = xo(n, i);
  3223. if (h == null)
  3224. return;
  3225. const m = bo(h), f = ru(c);
  3226. let { startX: g, startY: p, endX: S, endY: b } = m;
  3227. const { scaleX: v, scaleY: _ } = a.getAncestorScale(), R = a.getViewportScrollXY(s.getViewPort());
  3228. g = n.convertTransformToOffsetX(g, v, R), p = n.convertTransformToOffsetY(p, _, R), S = n.convertTransformToOffsetX(S, v, R), b = n.convertTransformToOffsetY(b, _, R);
  3229. const I = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), y = I.getActiveSheet();
  3230. if (!y) return;
  3231. const M = {
  3232. workbook: I,
  3233. worksheet: y,
  3234. unitId: I.getUnitId(),
  3235. subUnitId: y.getSheetId(),
  3236. row: d,
  3237. col: u,
  3238. origin: y.getCellRaw(d, u)
  3239. };
  3240. let P;
  3241. const E = this._sheetInterceptorService.writeCellInterceptor.fetchThroughInterceptors(AS)(
  3242. y.getCell(d, u),
  3243. M
  3244. );
  3245. P = E && n.getCellDocumentModelWithFormula(E);
  3246. const T = (A = P == null ? void 0 : P.documentModel) == null ? void 0 : A.documentStyle.renderConfig;
  3247. if (T != null && (T.cellValueType = ln.STRING), !P || P.documentModel == null) {
  3248. const k = n.getBlankCellDocumentModel(E);
  3249. if (P != null) {
  3250. const { verticalAlign: U, horizontalAlign: V, wrapStrategy: N, textRotation: X, fill: Y } = P, { centerAngle: ie, vertexAngle: he } = nd(X);
  3251. k.documentModel.documentStyle.renderConfig = {
  3252. ...T,
  3253. verticalAlign: U,
  3254. horizontalAlign: V,
  3255. wrapStrategy: N,
  3256. background: { rgb: Y },
  3257. centerAngle: ie,
  3258. vertexAngle: he
  3259. };
  3260. }
  3261. P = k;
  3262. }
  3263. if (P.fill = P.fill || "#fff", (H = P.documentModel) == null || H.setZoomRatio(Math.max(v, _)), (E == null ? void 0 : E.isInArrayFormulaRange) === !0) {
  3264. const k = (x = P.documentModel) == null ? void 0 : x.getBody();
  3265. k && (k.textRuns = [
  3266. {
  3267. st: 0,
  3268. ed: k.dataStream.length - 2,
  3269. ts: {
  3270. cl: {
  3271. rgb: this._themeService.getCurrentTheme().textColorSecondary
  3272. }
  3273. }
  3274. }
  3275. ]);
  3276. }
  3277. return {
  3278. position: {
  3279. startX: g,
  3280. startY: p,
  3281. endX: S,
  3282. endY: b
  3283. },
  3284. scaleX: v,
  3285. scaleY: _,
  3286. canvasOffset: f,
  3287. row: d,
  3288. column: u,
  3289. unitId: o,
  3290. sheetId: l,
  3291. documentLayoutObject: P,
  3292. editorUnitId: this._editorUnitId,
  3293. isInArrayFormulaRange: E == null ? void 0 : E.isInArrayFormulaRange
  3294. };
  3295. }
  3296. getCurrentEditorId() {
  3297. return this._editorUnitId;
  3298. }
  3299. changeVisible(e) {
  3300. this._visible = e, e.visible && (this._editorIsDirty = !1), this._visible$.next(this._visible), this._afterVisible$.next(this._visible);
  3301. }
  3302. isVisible() {
  3303. return this._visible;
  3304. }
  3305. enableForceKeepVisible() {
  3306. this._forceKeepVisible$.next(!0);
  3307. }
  3308. disableForceKeepVisible() {
  3309. this._forceKeepVisible$.next(!1);
  3310. }
  3311. isForceKeepVisible() {
  3312. return this._forceKeepVisible$.getValue();
  3313. }
  3314. changeEditorDirty(e) {
  3315. this._editorIsDirty = e;
  3316. }
  3317. getEditorDirty() {
  3318. return this._editorIsDirty;
  3319. }
  3320. };
  3321. yc = Rv([
  3322. lr(0, D(Ln)),
  3323. lr(1, Ce),
  3324. lr(2, D(kt)),
  3325. lr(3, L),
  3326. lr(4, Ss),
  3327. lr(5, El),
  3328. lr(6, Ne)
  3329. ], yc);
  3330. const tt = gn("univer.sheet-editor-bridge.service"), Et = {
  3331. id: "sheet.operation.set-cell-edit-visible",
  3332. type: K.OPERATION,
  3333. handler: (r, e) => e ? (r.get(tt).changeVisible(e), !0) : !1
  3334. }, Wl = {
  3335. id: "sheet.operation.set-cell-edit-visible-f2",
  3336. type: K.OPERATION,
  3337. handler: (r, e) => {
  3338. const t = r.get(F), s = r.get(L).getCurrentUnitForType(O.UNIVER_SHEET);
  3339. return s ? (t.syncExecuteCommand(Et.id, {
  3340. ...e,
  3341. unitId: s.getUnitId()
  3342. }), !0) : !1;
  3343. }
  3344. }, cs = {
  3345. id: "sheet.operation.set-cell-edit-visible-arrow",
  3346. type: K.OPERATION,
  3347. handler: () => !0
  3348. }, Li = {
  3349. id: "sheet.command.change-zoom-ratio",
  3350. type: K.COMMAND,
  3351. handler: (r, e) => {
  3352. if (!e)
  3353. return !1;
  3354. const t = r.get(L), n = Ue(t);
  3355. if (!n) return !1;
  3356. const { worksheet: s, subUnitId: i, unitId: o } = n, { delta: l, reset: a } = e;
  3357. let c = a ? 100 : Math.round((s.getConfig().zoomRatio + l) * 100);
  3358. c = Math.max(_c[0], c), c = Math.min(_c[1], c);
  3359. const d = c / 100, h = r.get(tt).isVisible();
  3360. return (h.unitId === o || h.unitId === Te) && h.visible ? !1 : r.get(F).executeCommand($t.id, {
  3361. unitId: o,
  3362. subUnitId: i,
  3363. zoomRatio: d
  3364. });
  3365. }
  3366. }, Wi = {
  3367. id: "sheet.command.set-zoom-ratio",
  3368. type: K.COMMAND,
  3369. handler: async (r, e) => {
  3370. if (!e)
  3371. return !1;
  3372. const { unitId: t, subUnitId: n, zoomRatio: s } = e, o = r.get(tt).isVisible();
  3373. return (o.unitId === t || o.unitId === Te) && o.visible ? !1 : r.get(F).executeCommand($t.id, {
  3374. unitId: t,
  3375. subUnitId: n,
  3376. zoomRatio: s
  3377. });
  3378. }
  3379. };
  3380. function Iv(r) {
  3381. return typeof r.isMainScene > "u";
  3382. }
  3383. function pn(r, e) {
  3384. const t = r instanceof Vp ? r : r.getCurrentUnitForType(O.UNIVER_SHEET);
  3385. if (!t) return null;
  3386. const n = t.getUnitId();
  3387. let s, i, o, l;
  3388. if (Iv(e)) {
  3389. const h = e.getRenderById(n);
  3390. if (h == null) return null;
  3391. s = h.components, s = h.components, i = h.mainComponent, o = h.scene, l = h.engine;
  3392. } else
  3393. s = e.components, i = e.mainComponent, o = e.scene, l = e.engine;
  3394. if (!s || !i) return null;
  3395. const a = i, c = s.get(qe.ROW), d = s.get(qe.COLUMN), u = s.get(qe.LEFT_TOP);
  3396. return {
  3397. spreadsheet: a,
  3398. spreadsheetRowHeader: c,
  3399. spreadsheetColumnHeader: d,
  3400. spreadsheetLeftTopPlaceholder: u,
  3401. scene: o,
  3402. engine: l
  3403. };
  3404. }
  3405. function Nu(r, e, t, n) {
  3406. const { startX: s, startY: i, endX: o, endY: l } = n.getCellWithCoordByIndex(r, e);
  3407. return { startX: s, startY: i, endX: o, endY: l };
  3408. }
  3409. function Nn(r, e, t, n, s, i) {
  3410. const o = t.getCoordRelativeToViewport(Oe.FromArray([r, e])), { x: l, y: a } = o, c = t.getScrollXYInfoByViewport(o, s), { scaleX: d, scaleY: u } = t.getAncestorScale(), h = n.getCellIndexByOffset(
  3411. l,
  3412. a,
  3413. d,
  3414. u,
  3415. c,
  3416. { closeFirst: i }
  3417. ), { row: m, column: f } = h, g = n.getNoMergeCellPositionByIndex(m, f), { startX: p, startY: S, endX: b, endY: v } = g;
  3418. return {
  3419. startX: p,
  3420. startY: S,
  3421. endX: b,
  3422. endY: v,
  3423. row: m,
  3424. column: f
  3425. };
  3426. }
  3427. function fo(r, e, t, n) {
  3428. const s = t.getCoordRelativeToViewport(Oe.FromArray([r, e])), i = t.getViewport(z.VIEW_MAIN), o = t.getScrollXYInfoByViewport(s, i), { scaleX: l, scaleY: a } = t.getAncestorScale(), { x: c, y: d } = o, u = r / l + c, h = e / a + d;
  3429. return { x: u, y: h };
  3430. }
  3431. var yv = Object.defineProperty, Mv = Object.getOwnPropertyDescriptor, Pv = (r, e, t, n) => {
  3432. for (var s = n > 1 ? void 0 : n ? Mv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  3433. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  3434. return n && s && yv(e, t, s), s;
  3435. }, Ji = (r, e) => (t, n) => e(t, n, r);
  3436. let ii = class extends ce {
  3437. constructor(r, e, t, n, s) {
  3438. super(), this._context = r, this._sheetSkeletonManagerService = e, this._commandService = t, this._contextService = n, this._editorBridgeService = s, this._initSkeletonListener(), this._initZoomEventListener();
  3439. }
  3440. updateZoom(r, e) {
  3441. const t = this._context.unit.getSheetBySheetId(r);
  3442. return t ? (t.getConfig().zoomRatio = e, t === this._context.unit.getActiveSheet() && this._updateViewZoom(e), !0) : !1;
  3443. }
  3444. _initZoomEventListener() {
  3445. const r = this._getSheetObject().scene;
  3446. this.disposeWithMe(
  3447. r.onMouseWheel$.subscribeEvent((e) => {
  3448. if (!e.ctrlKey || !this._contextService.getContextValue(Tt))
  3449. return;
  3450. if (this._editorBridgeService) {
  3451. const a = this._editorBridgeService.isVisible();
  3452. if ((a.unitId === this._context.unitId || a.unitId === Te) && a.visible)
  3453. return;
  3454. }
  3455. const t = Math.abs(e.deltaX);
  3456. let n = t < 40 ? 0.2 : t < 80 ? 0.4 : 0.2;
  3457. n *= e.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (n /= 2);
  3458. const s = this._context.unit, i = s.getActiveSheet();
  3459. if (!i) return;
  3460. const o = i.getZoomRatio();
  3461. let l = +Number.parseFloat(`${o + n}`).toFixed(1);
  3462. l = l >= 4 ? 4 : l <= 0.1 ? 0.1 : l, this._commandService.executeCommand(Wi.id, {
  3463. zoomRatio: Math.round(l * 10) / 10,
  3464. unitId: s.getUnitId(),
  3465. subUnitId: i.getSheetId()
  3466. }), e.preventDefault();
  3467. })
  3468. );
  3469. }
  3470. _initSkeletonListener() {
  3471. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeletonBefore$.subscribe((r) => {
  3472. if (r == null)
  3473. return;
  3474. const t = this._context.unit.getActiveSheet();
  3475. if (!t) return;
  3476. const n = t.getZoomRatio() || 1;
  3477. this._updateViewZoom(n);
  3478. }));
  3479. }
  3480. /**
  3481. * Zoom scene, resize viewport and then setScrollInfo
  3482. * @param zoomRatio
  3483. */
  3484. _updateViewZoom(r) {
  3485. const e = this._getSheetObject();
  3486. e == null || e.scene.scale(r, r), e == null || e.spreadsheet.makeForceDirty();
  3487. }
  3488. _getSheetObject() {
  3489. return pn(this._context.unit, this._context);
  3490. }
  3491. };
  3492. ii = Pv([
  3493. Ji(1, D(me)),
  3494. Ji(2, F),
  3495. Ji(3, Ne),
  3496. Ji(4, Jc(tt))
  3497. ], ii);
  3498. const $t = {
  3499. id: "sheet.operation.set-zoom-ratio",
  3500. type: K.OPERATION,
  3501. handler: (r, e) => {
  3502. const n = r.get(Ce).getRenderById(e.unitId);
  3503. return n ? n.with(ii).updateZoom(e.subUnitId, e.zoomRatio) : !1;
  3504. }
  3505. };
  3506. var Ev = Object.defineProperty, Tv = Object.getOwnPropertyDescriptor, xv = (r, e, t, n) => {
  3507. for (var s = n > 1 ? void 0 : n ? Tv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  3508. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  3509. return n && s && Ev(e, t, s), s;
  3510. }, ga = (r, e) => (t, n) => e(t, n, r);
  3511. const Hu = "univer-sheet-main-canvas";
  3512. let Mr = class extends kn {
  3513. constructor(e, t, n) {
  3514. super();
  3515. w(this, "_skeletonChangeMutations", /* @__PURE__ */ new Set());
  3516. this._contextService = e, this._instanceSrv = t, this._renderManagerService = n, Promise.resolve().then(() => this._init());
  3517. }
  3518. /**
  3519. * Register a mutation id that will trigger the skeleton change.
  3520. *
  3521. * @param mutationId the id of the mutation
  3522. * @returns a disposable to unregister the mutation
  3523. */
  3524. registerSkeletonChangingMutations(e) {
  3525. return this._skeletonChangeMutations.has(e) ? Ae(() => {
  3526. }) : (this._skeletonChangeMutations.add(e), Ae(() => this._skeletonChangeMutations.delete(e)));
  3527. }
  3528. /**
  3529. * Examine if a mutation would make the skeleton to change.
  3530. */
  3531. checkMutationShouldTriggerRerender(e) {
  3532. return this._skeletonChangeMutations.has(e);
  3533. }
  3534. _init() {
  3535. this._initWorkbookListener(), this._initContextListener();
  3536. }
  3537. _initWorkbookListener() {
  3538. this._instanceSrv.getTypeOfUnitAdded$(O.UNIVER_SHEET).pipe(os(this.dispose$)).subscribe((e) => this._createRenderer(e)), this._instanceSrv.getAllUnitsForType(O.UNIVER_SHEET).forEach((e) => this._createRenderer(e)), this._instanceSrv.getTypeOfUnitDisposed$(O.UNIVER_SHEET).pipe(os(this.dispose$)).subscribe((e) => this._disposeRenderer(e));
  3539. }
  3540. _createRenderer(e) {
  3541. const t = e.getUnitId();
  3542. this._renderManagerService.created$.subscribe((n) => {
  3543. n.unitId === t && (n.engine.getCanvas().setId(`${Hu}_${t}`), n.engine.getCanvas().getContext().setId(`${Hu}_${t}`));
  3544. }), this._renderManagerService.createRender(t), this._renderManagerService.setCurrent(t);
  3545. }
  3546. _disposeRenderer(e) {
  3547. const t = e.getUnitId();
  3548. this._renderManagerService.removeRender(t);
  3549. }
  3550. _initContextListener() {
  3551. this.disposeWithMe(this._contextService.subscribeContextValue$(iS).pipe(cn()).subscribe(() => {
  3552. this._renderManagerService.getRenderAll().forEach((e) => {
  3553. e.mainComponent instanceof Yh && e.mainComponent.makeForceDirty(!0);
  3554. });
  3555. }));
  3556. }
  3557. };
  3558. Mr = xv([
  3559. ga(0, Ne),
  3560. ga(1, L),
  3561. ga(2, Ce)
  3562. ], Mr);
  3563. var Ov = Object.defineProperty, Av = Object.getOwnPropertyDescriptor, Nv = (r, e, t, n) => {
  3564. for (var s = n > 1 ? void 0 : n ? Av(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  3565. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  3566. return n && s && Ov(e, t, s), s;
  3567. }, ar = (r, e) => (t, n) => e(t, n, r);
  3568. let Vo = class extends ce {
  3569. constructor(e, t, n, s, i, o, l) {
  3570. super();
  3571. w(this, "_beforeApplyData", []);
  3572. w(this, "_currentLocation", null);
  3573. w(this, "_copyData", []);
  3574. w(this, "_defaultHook");
  3575. this._univerInstanceService = e, this._commandService = t, this._autoFillService = n, this._editorBridgeService = s, this._renderManagerService = i, this._injector = o, this._sheetsRenderService = l, this._defaultHook = {
  3576. id: "default",
  3577. type: Gr.Default,
  3578. priority: 0,
  3579. onBeforeFillData: (a, c) => this._presetAndCacheData(a, c),
  3580. onFillData: (a, c, d) => this._fillData(a, c, d)
  3581. }, this._init();
  3582. }
  3583. _init() {
  3584. this._initDefaultHook(), this._onSelectionControlFillChanged(), this._initQuitListener(), this._initSkeletonChange();
  3585. }
  3586. _initSkeletonChange() {
  3587. this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(pr.id));
  3588. }
  3589. _initDefaultHook() {
  3590. this.disposeWithMe(this._autoFillService.addHook(this._defaultHook));
  3591. }
  3592. _initQuitListener() {
  3593. const e = [
  3594. Et.id,
  3595. si.id,
  3596. Ti.id,
  3597. $t.id,
  3598. et.id,
  3599. tr.id,
  3600. xi.id,
  3601. Oi.id,
  3602. Ai.id,
  3603. Ni.id,
  3604. Tl.id,
  3605. xl.id,
  3606. Qt.id,
  3607. $s.id,
  3608. Se.id
  3609. ];
  3610. this.disposeWithMe(this._commandService.onCommandExecuted((t, n) => {
  3611. var l, a;
  3612. const s = n == null ? void 0 : n.fromCollab, i = n == null ? void 0 : n.fromSync, o = n == null ? void 0 : n.fromFormula;
  3613. e.includes(t.id) && !s && !i && !o && t.params.trigger !== pr.id && t.params.trigger !== Ll.id && this._quit(), t.id === An.id && t.params.unitId === ((l = this._currentLocation) == null ? void 0 : l.unitId) && t.params.subUnitId === ((a = this._currentLocation) == null ? void 0 : a.subUnitId) && this._quit();
  3614. })), this.disposeWithMe(this._univerInstanceService.unitDisposed$.subscribe((t) => {
  3615. var n;
  3616. t.getUnitId() === ((n = this._currentLocation) == null ? void 0 : n.unitId) && this._quit();
  3617. }));
  3618. }
  3619. _quit() {
  3620. this._currentLocation = null, this._beforeApplyData = [], this._copyData = [], this._autoFillService.setShowMenu(!1);
  3621. }
  3622. // eslint-disable-next-line max-lines-per-function
  3623. _onSelectionControlFillChanged() {
  3624. const e = new St(), t = (n) => {
  3625. n.dispose();
  3626. const s = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_SHEET);
  3627. if (!s) return;
  3628. s.with(dt).getSelectionControls().forEach((l) => {
  3629. n.add(
  3630. Ae(
  3631. l.selectionFilled$.subscribe((a) => {
  3632. if (a == null || a.startColumn === -1 || a.startRow === -1 || a.endColumn === -1 || a.endRow === -1)
  3633. return;
  3634. const c = {
  3635. startColumn: l.model.startColumn,
  3636. endColumn: l.model.endColumn,
  3637. startRow: l.model.startRow,
  3638. endRow: l.model.endRow
  3639. }, d = {
  3640. startColumn: a.startColumn,
  3641. endColumn: a.endColumn,
  3642. startRow: a.startRow,
  3643. endRow: a.endRow
  3644. };
  3645. this._commandService.executeCommand(pr.id, { sourceRange: c, targetRange: d });
  3646. })
  3647. )
  3648. ), n.add(
  3649. Ae(
  3650. l.fillControl.onDblclick$.subscribeEvent(() => {
  3651. const a = {
  3652. startColumn: l.model.startColumn,
  3653. endColumn: l.model.endColumn,
  3654. startRow: l.model.startRow,
  3655. endRow: l.model.endRow
  3656. };
  3657. this._handleDbClickFill(a);
  3658. })
  3659. )
  3660. ), n.add(
  3661. Ae(
  3662. l.fillControl.onPointerDown$.subscribeEvent(() => {
  3663. this._editorBridgeService.isVisible().visible && this._editorBridgeService.changeVisible({
  3664. visible: !1,
  3665. eventType: Xe.PointerDown,
  3666. unitId: s.unitId
  3667. });
  3668. })
  3669. )
  3670. );
  3671. });
  3672. };
  3673. t(e), this.disposeWithMe(
  3674. this._commandService.onCommandExecuted((n) => {
  3675. n.id === He.id && t(e);
  3676. })
  3677. );
  3678. }
  3679. _handleDbClickFill(e) {
  3680. const t = this._detectFillRange(e);
  3681. t.endRow <= e.endRow || this._commandService.executeCommand(pr.id, { sourceRange: e, targetRange: t });
  3682. }
  3683. _detectFillRange(e) {
  3684. var u, h, m, f, g, p;
  3685. const { startRow: t, endRow: n, startColumn: s, endColumn: i } = e, o = (u = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET)) == null ? void 0 : u.getActiveSheet();
  3686. if (!o)
  3687. return e;
  3688. const l = o.getCellMatrix(), a = o.getMaxRows() - 1, c = o.getMaxColumns() - 1;
  3689. let d = n;
  3690. if (s > 0 && ((h = l.getValue(t, s - 1)) == null ? void 0 : h.v) != null) {
  3691. let S = t;
  3692. for (; ((m = l.getValue(S, s - 1)) == null ? void 0 : m.v) != null && S < a; )
  3693. S += 1;
  3694. d = S - 1;
  3695. } else if (i < c && ((f = l.getValue(n, i + 1)) == null ? void 0 : f.v) != null) {
  3696. let S = t;
  3697. for (; ((g = l.getValue(S, i + 1)) == null ? void 0 : g.v) != null && S < a; )
  3698. S += 1;
  3699. d = S - 1;
  3700. }
  3701. for (let S = n + 1; S <= d; S++)
  3702. for (let b = s; b <= i; b++)
  3703. if (((p = l.getValue(S, b)) == null ? void 0 : p.v) != null) {
  3704. d = S - 1;
  3705. break;
  3706. }
  3707. return {
  3708. startColumn: s,
  3709. endColumn: i,
  3710. startRow: t,
  3711. endRow: d
  3712. };
  3713. }
  3714. // calc apply data according to copy data and direction
  3715. _getApplyData(e, t, n, s, i, o = !0) {
  3716. const l = [], a = Math.floor(n / t), c = n % t, d = this._autoFillService.getRules();
  3717. if (!o && i === ke.ONLY_FORMAT)
  3718. return console.error("ERROR: only format can not be applied when hasStyle is false"), [];
  3719. const u = {};
  3720. d.forEach((h) => {
  3721. u[h.type] = [];
  3722. }), d.forEach((h) => {
  3723. const { type: m, applyFunctions: f = {} } = h, g = e[m];
  3724. g && g.forEach((p) => {
  3725. const S = JC(p.index, c), b = p.index.length * a + S, v = this._applyFunctions(
  3726. p,
  3727. b,
  3728. s,
  3729. i,
  3730. f,
  3731. e
  3732. ), _ = $C(t, n, p.index);
  3733. u[m].push({ data: v, index: _ });
  3734. });
  3735. });
  3736. for (let h = 0; h < n; h++)
  3737. d.forEach((m) => {
  3738. const { type: f } = m, g = u[f];
  3739. for (let p = 0; p < g.length; p++)
  3740. h in g[p].index && l.push(g[p].data[g[p].index[h]]);
  3741. });
  3742. return l;
  3743. }
  3744. _applyFunctions(e, t, n, s, i, o) {
  3745. const { data: l } = e, a = n === B.UP || n === B.LEFT;
  3746. if (s === ke.COPY) {
  3747. const c = i == null ? void 0 : i[ke.COPY];
  3748. return c ? c(e, t, n, o) : (a && l.reverse(), Rr(l, t));
  3749. }
  3750. if (s === ke.SERIES) {
  3751. const c = i == null ? void 0 : i[ke.SERIES];
  3752. return c ? c(e, t, n, o) : (a && l.reverse(), i != null && i[ke.COPY] ? i[ke.COPY](e, t, n, o) : Rr(l, t));
  3753. }
  3754. if (s === ke.ONLY_FORMAT) {
  3755. const c = i == null ? void 0 : i[ke.ONLY_FORMAT];
  3756. return c ? c(e, t, n, o) : ev(l, t);
  3757. }
  3758. }
  3759. _getCopyData(e, t) {
  3760. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet();
  3761. if (!n)
  3762. throw new Error("No active sheet found");
  3763. const s = n.getCellMatrix(), i = this._autoFillService.getRules(), o = [], l = t === B.DOWN || t === B.UP;
  3764. let a, c;
  3765. return l ? (a = e.cols, c = e.rows) : (a = e.rows, c = e.cols), a.forEach((d) => {
  3766. const u = this._getEmptyCopyDataPiece(), h = {
  3767. type: void 0,
  3768. cellData: void 0
  3769. };
  3770. c.forEach((m) => {
  3771. let f;
  3772. l ? f = s.getValue(m, d) : f = s.getValue(d, m);
  3773. const { type: g, isContinue: p } = i.find((S) => S.match(f, this._injector)) || Km;
  3774. if (p(h, f)) {
  3775. const S = u[g], b = S[S.length - 1];
  3776. b.data.push(f), b.index.push(m - c[0]);
  3777. } else {
  3778. const S = u[g];
  3779. S ? S.push({
  3780. data: [f],
  3781. index: [m - c[0]]
  3782. }) : u[g] = [
  3783. {
  3784. data: [f],
  3785. index: [m - c[0]]
  3786. }
  3787. ];
  3788. }
  3789. h.type = g, h.cellData = f;
  3790. }), o.push(u);
  3791. }), o;
  3792. }
  3793. _getEmptyCopyDataPiece() {
  3794. const e = {};
  3795. return this._autoFillService.getRules().forEach((t) => {
  3796. e[t.type] = [];
  3797. }), e;
  3798. }
  3799. _getMergeApplyData(e, t, n, s) {
  3800. const i = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet();
  3801. if (!i)
  3802. throw new Error("No active sheet found");
  3803. const o = [];
  3804. for (let l = e.startRow; l <= e.endRow; l++)
  3805. for (let a = e.startColumn; a <= e.endColumn; a++) {
  3806. const { isMergedMainCell: c, startRow: d, startColumn: u, endRow: h, endColumn: m } = i.getCellInfoInMergeData(l, a);
  3807. if (c) {
  3808. if (n === B.DOWN) {
  3809. let f = d + s, g = h + s;
  3810. for (; g <= t.endRow; )
  3811. o.push({
  3812. startRow: f,
  3813. startColumn: u,
  3814. endRow: g,
  3815. endColumn: m
  3816. }), f += s, g += s;
  3817. } else if (n === B.UP) {
  3818. let f = d - s, g = h - s;
  3819. for (; f >= t.startRow; )
  3820. o.push({
  3821. startRow: f,
  3822. startColumn: u,
  3823. endRow: g,
  3824. endColumn: m
  3825. }), f -= s, g -= s;
  3826. } else if (n === B.RIGHT) {
  3827. let f = u + s, g = m + s;
  3828. for (; g <= t.endColumn; )
  3829. o.push({
  3830. startRow: d,
  3831. startColumn: f,
  3832. endRow: h,
  3833. endColumn: g
  3834. }), f += s, g += s;
  3835. } else if (n === B.LEFT) {
  3836. let f = u - s, g = m - s;
  3837. for (; f >= t.startColumn; )
  3838. o.push({
  3839. startRow: d,
  3840. startColumn: f,
  3841. endRow: h,
  3842. endColumn: g
  3843. }), f -= s, g -= s;
  3844. }
  3845. }
  3846. }
  3847. return o;
  3848. }
  3849. _presetAndCacheData(e, t) {
  3850. const { source: n, target: s } = e, i = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet();
  3851. if (!i)
  3852. throw new Error("No active sheet found");
  3853. const o = i.getCellMatrix(), l = [];
  3854. return s.rows.forEach((a) => {
  3855. const c = [];
  3856. s.cols.forEach((d) => {
  3857. c.push(se.deepClone(o.getValue(a, d)));
  3858. }), l.push(c);
  3859. }), this._beforeApplyData = l, this._copyData = this._getCopyData(n, t), this._currentLocation = e, this._shouldDisableSeries(this._copyData) ? (this._autoFillService.setDisableApplyType(ke.SERIES, !0), ke.COPY) : (this._autoFillService.setDisableApplyType(ke.SERIES, !1), this._getPreferredApplyType(this._copyData));
  3860. }
  3861. // auto fill entry
  3862. // eslint-disable-next-line max-lines-per-function
  3863. _fillData(e, t, n) {
  3864. var A, H;
  3865. const s = [], i = [];
  3866. let o = !0;
  3867. n === ke.NO_FORMAT && (o = !1, n = ke.SERIES);
  3868. const { source: l, target: a, unitId: c, subUnitId: d } = e;
  3869. if (!l || !a || t == null)
  3870. return {
  3871. undos: s,
  3872. redos: i
  3873. };
  3874. const u = wr(l), h = wr(a), { cols: m, rows: f } = a, { cols: g, rows: p } = l, S = this._copyData;
  3875. let b;
  3876. t === B.DOWN || t === B.UP ? b = p.length : b = g.length;
  3877. const v = [];
  3878. if (t === B.DOWN || t === B.UP) {
  3879. const x = f.length, k = [];
  3880. m.forEach((U, V) => {
  3881. const N = S[V], X = this._getApplyData(N, b, x, t, n, o);
  3882. k.push(X);
  3883. });
  3884. for (let U = 0; U < k[0].length; U++) {
  3885. const V = [];
  3886. for (let N = 0; N < k.length; N++)
  3887. V.push({
  3888. s: null,
  3889. ...k[N][U]
  3890. });
  3891. v.push(V);
  3892. }
  3893. } else {
  3894. const x = m.length;
  3895. f.forEach((k, U) => {
  3896. const V = S[U], N = this._getApplyData(V, b, x, t, n, o), X = [];
  3897. for (let Y = 0; Y < N.length; Y++)
  3898. X.push({
  3899. s: null,
  3900. ...N[Y]
  3901. });
  3902. v.push(X);
  3903. });
  3904. }
  3905. let _ = [];
  3906. const R = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getStyles();
  3907. if (o ? (_ = this._getMergeApplyData(u, h, t, b), v.forEach((x) => {
  3908. x.forEach((k) => {
  3909. k && R && R && (k.s = R.getStyleByCell(k));
  3910. });
  3911. })) : v.forEach((x, k) => {
  3912. x.forEach((U, V) => {
  3913. U && R && (U.s = R.getStyleByCell(this._beforeApplyData[k][V]) || null);
  3914. });
  3915. }), n === ke.ONLY_FORMAT && v.forEach((x, k) => {
  3916. x.forEach((U, V) => {
  3917. if (U) {
  3918. const N = this._beforeApplyData[k][V] || {};
  3919. U.f = N.f, U.si = N.si, U.t = N.t, U.v = N.v;
  3920. }
  3921. });
  3922. }), o) {
  3923. const x = [], k = (H = (A = this._univerInstanceService.getUniverSheetInstance(c)) == null ? void 0 : A.getSheetBySheetId(d)) == null ? void 0 : H.getMergeData();
  3924. k && k.forEach((N) => {
  3925. ae.intersects(N, h) && x.push(N);
  3926. });
  3927. const U = {
  3928. unitId: c,
  3929. subUnitId: d,
  3930. ranges: x
  3931. }, V = this._injector.invoke(
  3932. Ol,
  3933. U
  3934. );
  3935. x.length && (i.push({ id: Kt.id, params: U }), s.unshift({ id: Jt.id, params: V }));
  3936. }
  3937. const I = {
  3938. subUnitId: d,
  3939. unitId: c,
  3940. cellValue: zC([a])
  3941. }, y = this._injector.invoke(
  3942. en,
  3943. I
  3944. );
  3945. i.push({ id: Se.id, params: I }), s.unshift({ id: Se.id, params: y });
  3946. const M = new Ke();
  3947. f.forEach((x, k) => {
  3948. m.forEach((U, V) => {
  3949. v[k][V] && M.setValue(x, U, v[k][V]);
  3950. });
  3951. });
  3952. const P = M.getMatrix(), E = {
  3953. subUnitId: d,
  3954. unitId: c,
  3955. cellValue: P
  3956. }, T = this._injector.invoke(
  3957. en,
  3958. E
  3959. );
  3960. if (this._autoFillService.getActiveHooks().forEach((x) => {
  3961. var k;
  3962. (k = x.onBeforeSubmit) == null || k.call(x, e, t, n, P);
  3963. }), s.unshift({ id: Se.id, params: T }), i.push({ id: Se.id, params: E }), _ != null && _.length) {
  3964. const x = Al(_), k = {
  3965. unitId: c,
  3966. subUnitId: d,
  3967. ranges: x
  3968. }, U = this._injector.invoke(
  3969. Nl,
  3970. k
  3971. );
  3972. s.unshift({ id: Kt.id, params: U }), i.push({ id: Jt.id, params: k });
  3973. }
  3974. return {
  3975. undos: s,
  3976. redos: i
  3977. };
  3978. }
  3979. _shouldDisableSeries(e) {
  3980. return e.every(
  3981. (t) => Object.keys(t).every(
  3982. (n) => {
  3983. var s;
  3984. return ((s = t[n]) == null ? void 0 : s.length) === 0 || [ut.OTHER, ut.FORMULA].includes(n);
  3985. }
  3986. )
  3987. );
  3988. }
  3989. _getPreferredApplyType(e) {
  3990. return e.every(
  3991. (n) => Object.keys(n).every(
  3992. (s) => {
  3993. var i, o;
  3994. return ((i = n[s]) == null ? void 0 : i.length) === 0 || ((o = n[s]) == null ? void 0 : o.length) === 1 && n[s][0].data.length === 1 && ut.NUMBER === s;
  3995. }
  3996. )
  3997. ) ? ke.COPY : ke.SERIES;
  3998. }
  3999. };
  4000. Vo = Nv([
  4001. ar(0, L),
  4002. ar(1, F),
  4003. ar(2, Hr),
  4004. ar(3, tt),
  4005. ar(4, Ce),
  4006. ar(5, D(vt)),
  4007. ar(6, D(Mr))
  4008. ], Vo);
  4009. var Hv = Object.defineProperty, Vv = Object.getOwnPropertyDescriptor, kv = (r, e, t, n) => {
  4010. for (var s = n > 1 ? void 0 : n ? Vv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  4011. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  4012. return n && s && Hv(e, t, s), s;
  4013. }, pa = (r, e) => (t, n) => e(t, n, r);
  4014. let ko = class extends ce {
  4015. constructor(e, t, n, s) {
  4016. super();
  4017. w(this, "_enterActiveRender");
  4018. this._context = e, this._sheetSkeletonManagerService = t, this._renderManagerService = n, this._permissionService = s, this._initEventBinding();
  4019. }
  4020. // eslint-disable-next-line max-lines-per-function
  4021. _initEventBinding() {
  4022. const e = new St(), t = this._context.unit, n = (s) => {
  4023. if (e.dispose(), !s)
  4024. return;
  4025. const i = this._context.unitId, { skeleton: o } = s, l = this._renderManagerService.getRenderById(i);
  4026. if (l && l.mainComponent) {
  4027. const a = l.mainComponent, c = (h) => {
  4028. const { offsetX: m, offsetY: f } = h, g = l.scene, p = t.getActiveSheet();
  4029. if (!p)
  4030. return;
  4031. const S = g.getActiveViewportByCoord(
  4032. Oe.FromArray([m, f])
  4033. );
  4034. if (!S)
  4035. return;
  4036. const { scaleX: b, scaleY: v } = g.getAncestorScale(), _ = {
  4037. x: S.viewportScrollX,
  4038. y: S.viewportScrollY
  4039. }, R = o.getCellIndexByOffset(m, f, b, v, _), I = o.worksheet.getMergedCell(R.row, R.column), y = {
  4040. actualRow: I ? I.startRow : R.row,
  4041. actualCol: I ? I.startColumn : R.column,
  4042. mergeCell: I,
  4043. row: R.row,
  4044. col: R.column
  4045. };
  4046. if (!y || !o)
  4047. return;
  4048. const M = p.getCell(y.actualRow, y.actualCol);
  4049. if (!M)
  4050. return;
  4051. const P = M.customRender;
  4052. if (!(P != null && P.length))
  4053. return;
  4054. const E = y.actualRow, T = y.actualCol, A = P.sort(kp), H = p.getSheetId(), x = {
  4055. data: M,
  4056. style: o.getsStyles().getStyleByCell(M),
  4057. primaryWithCoord: o.getCellWithCoordByIndex(y.actualRow, y.actualCol),
  4058. unitId: i,
  4059. subUnitId: H,
  4060. row: E,
  4061. col: T,
  4062. workbook: t,
  4063. worksheet: p
  4064. }, k = {
  4065. x: _.x + m / b,
  4066. y: _.y + f / v
  4067. }, U = A.find((V) => {
  4068. var N;
  4069. return (N = V.isHit) == null ? void 0 : N.call(V, k, x);
  4070. });
  4071. if (U)
  4072. return [U, x];
  4073. }, d = a.onPointerDown$.subscribeEvent((h) => {
  4074. var f, g, p, S;
  4075. const m = c(h);
  4076. if (m) {
  4077. const [b, v] = m, { row: _, col: R, worksheet: I, unitId: y, subUnitId: M } = v;
  4078. if (!((f = this._permissionService.composePermission(
  4079. [new q(y).id, new ee(y, M).id]
  4080. )) == null ? void 0 : f.every((T) => T.value)))
  4081. return !1;
  4082. const E = (p = (g = I.getCell(_, R)) == null ? void 0 : g.selectionProtection) == null ? void 0 : p[0];
  4083. if ((E == null ? void 0 : E[ad.Edit]) === !1)
  4084. return !1;
  4085. (S = b.onPointerDown) == null || S.call(b, v, h);
  4086. }
  4087. }), u = Hh(a.onPointerMove$).pipe(tm(30)).subscribe((h) => {
  4088. var f, g, p, S, b, v;
  4089. const m = c(h);
  4090. if (m) {
  4091. const [_, R] = m;
  4092. this._enterActiveRender ? this._enterActiveRender.render !== _ && ((g = (f = this._enterActiveRender.render).onPointerLeave) == null || g.call(f, this._enterActiveRender.cellContext, h), this._enterActiveRender = {
  4093. render: _,
  4094. cellContext: R
  4095. }, (p = _.onPointerEnter) == null || p.call(_, R, h)) : (this._enterActiveRender = {
  4096. render: _,
  4097. cellContext: R
  4098. }, (S = _.onPointerEnter) == null || S.call(_, R, h));
  4099. } else
  4100. this._enterActiveRender && ((v = (b = this._enterActiveRender.render).onPointerLeave) == null || v.call(b, this._enterActiveRender.cellContext, h), this._enterActiveRender = null);
  4101. });
  4102. d && e.add(d), u && e.add(u);
  4103. }
  4104. };
  4105. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(n)), n(this._sheetSkeletonManagerService.getCurrent()), this.disposeWithMe(e);
  4106. }
  4107. };
  4108. ko = kv([
  4109. pa(1, D(me)),
  4110. pa(2, Ce),
  4111. pa(3, $e)
  4112. ], ko);
  4113. class Ad extends ce {
  4114. constructor() {
  4115. super(...arguments);
  4116. w(this, "rangesStack", []);
  4117. w(this, "selectedRangeWorksheet", "");
  4118. }
  4119. }
  4120. var Dv = Object.defineProperty, Lv = Object.getOwnPropertyDescriptor, Wv = (r, e, t, n) => {
  4121. for (var s = n > 1 ? void 0 : n ? Lv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  4122. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  4123. return n && s && Dv(e, t, s), s;
  4124. }, Vu = (r, e) => (t, n) => e(t, n, r);
  4125. let ds = class {
  4126. constructor(r, e) {
  4127. w(this, "_current", null);
  4128. w(this, "_shortcutParam", []);
  4129. this._univerInstanceService = r, this._localeService = e;
  4130. }
  4131. dispose() {
  4132. this._shortcutParam = [];
  4133. }
  4134. getCurrentBySearch(r) {
  4135. return this._getCurrentBySearch(r);
  4136. }
  4137. getCurrent() {
  4138. return this._getCurrentBySearch(this._current);
  4139. }
  4140. addOrUpdate(r) {
  4141. const e = this._getCurrentBySearch({
  4142. unitId: r.unitId,
  4143. sheetId: r.sheetId,
  4144. keycode: r.keycode
  4145. });
  4146. if (e != null) {
  4147. const t = this._shortcutParam.indexOf(e);
  4148. this._shortcutParam.splice(t, 1);
  4149. }
  4150. return this._shortcutParam.push(r), e;
  4151. }
  4152. remove(r) {
  4153. if (r == null)
  4154. return;
  4155. const e = this._getCurrentBySearch(r);
  4156. if (e == null)
  4157. return;
  4158. const t = this._shortcutParam.indexOf(e);
  4159. return this._shortcutParam.splice(t, 1)[0];
  4160. }
  4161. _getCurrentBySearch(r) {
  4162. return r == null ? void 0 : this._shortcutParam.find(
  4163. (t) => t.unitId === r.unitId && t.sheetId === r.sheetId && t.keycode === r.keycode
  4164. );
  4165. }
  4166. };
  4167. ds = Wv([
  4168. Vu(0, L),
  4169. Vu(1, D(Ee))
  4170. ], ds);
  4171. var Bl = /* @__PURE__ */ ((r) => (r.MergeAll = "mergeAll", r.MergeVertical = "mergeVertical", r.MergeHorizontal = "mergeHorizontal", r))(Bl || {});
  4172. function Qn(r, e, t, n, s = !0, i = 1, o = !0) {
  4173. let l = { ...r };
  4174. n == null && (n = {
  4175. startRow: 0,
  4176. endRow: t.getRowCount() - 1,
  4177. startColumn: 0,
  4178. endColumn: t.getColumnCount() - 1
  4179. });
  4180. let a;
  4181. switch (e) {
  4182. case B.UP:
  4183. for (a = r.startRow - i; a > -1 && !t.getRowVisible(a); )
  4184. a -= 1;
  4185. a >= n.startRow ? (l.startRow = a, l.endRow = a) : o && (l.startRow = n.endRow, l.endRow = n.endRow, s && (l = Qn(l, B.LEFT, t, n, !1)));
  4186. break;
  4187. case B.DOWN:
  4188. for (a = r.endRow + i; a < t.getRowCount() && !t.getRowVisible(a); )
  4189. a += 1;
  4190. a <= n.endRow ? (l.startRow = a, l.endRow = a) : o && (l.startRow = n.startRow, l.endRow = n.startRow, s && (l = Qn(l, B.RIGHT, t, n, !1)));
  4191. break;
  4192. case B.LEFT:
  4193. for (a = r.startColumn - i; a > -1 && !t.getColVisible(a); )
  4194. a -= 1;
  4195. a >= n.startColumn ? (l.startColumn = a, l.endColumn = a) : o && (l.startColumn = n.endColumn, l.endColumn = n.endColumn, s && (l = Qn(l, B.UP, t, n, !1)));
  4196. break;
  4197. case B.RIGHT:
  4198. for (a = r.endColumn + i; a < t.getColumnCount() && !t.getColVisible(a); )
  4199. a += 1;
  4200. a <= n.endColumn ? (l.startColumn = a, l.endColumn = a) : o && (l.startColumn = n.startColumn, l.endColumn = n.startColumn, s && (l = Qn(l, B.DOWN, t, n, !1)));
  4201. break;
  4202. }
  4203. return l;
  4204. }
  4205. function Nd(r, e, t) {
  4206. const n = { ...r }, { startRow: s, startColumn: i, endRow: o, endColumn: l } = oi(r, e, t);
  4207. let a = Os(t, s, i, o, l).hasValue, c = !0, d = !0;
  4208. for (; d; ) {
  4209. if (B.UP === e) {
  4210. let u = n.startRow - 1;
  4211. for (; u > -1 && !t.getRowVisible(u); )
  4212. u -= 1;
  4213. if (u === -1) {
  4214. d = !1;
  4215. break;
  4216. }
  4217. const { hasValue: h, matrix: m } = Os(
  4218. t,
  4219. u,
  4220. n.startColumn,
  4221. u,
  4222. n.endColumn
  4223. );
  4224. if (a && !h && !c) {
  4225. d = !1;
  4226. break;
  4227. } else {
  4228. if (m.getLength() !== 0) {
  4229. let f = u;
  4230. m.forValue((g) => {
  4231. f = Math.min(g, f);
  4232. }), n.startRow = f;
  4233. } else
  4234. n.startRow = u;
  4235. if (n.endRow = n.startRow, !a && h) {
  4236. d = !1;
  4237. break;
  4238. }
  4239. a = h, c = !1;
  4240. }
  4241. }
  4242. if (B.DOWN === e) {
  4243. let u = n.endRow + 1;
  4244. for (; u < t.getRowCount() && !t.getRowVisible(u); )
  4245. u += 1;
  4246. if (u === t.getRowCount()) {
  4247. d = !1;
  4248. break;
  4249. }
  4250. const { hasValue: h, matrix: m } = Os(
  4251. t,
  4252. u,
  4253. n.startColumn,
  4254. u,
  4255. n.endColumn
  4256. );
  4257. if (a && !h && !c) {
  4258. d = !1;
  4259. break;
  4260. } else {
  4261. if (m.getLength() !== 0) {
  4262. let f = u;
  4263. m.forValue((g, p, S) => {
  4264. f = Math.max(g + (S.rowSpan || 1) - 1, f);
  4265. }), n.endRow = f;
  4266. } else
  4267. n.endRow = u;
  4268. if (n.startRow = n.endRow, !a && h) {
  4269. d = !1;
  4270. break;
  4271. }
  4272. a = h, c = !1;
  4273. }
  4274. }
  4275. if (B.LEFT === e) {
  4276. let u = n.startColumn - 1;
  4277. for (; u > -1 && !t.getColVisible(u); )
  4278. u -= 1;
  4279. if (u === -1) {
  4280. d = !1;
  4281. break;
  4282. }
  4283. const { hasValue: h, matrix: m } = Os(
  4284. t,
  4285. n.startRow,
  4286. u,
  4287. n.endRow,
  4288. u
  4289. );
  4290. if (a && !h && !c) {
  4291. d = !1;
  4292. break;
  4293. } else {
  4294. if (m.getLength() !== 0) {
  4295. let f = u;
  4296. m.forValue((g, p) => {
  4297. f = Math.min(p, f);
  4298. }), n.startColumn = f;
  4299. } else
  4300. n.startColumn = u;
  4301. if (n.endColumn = n.startColumn, !a && h) {
  4302. d = !1;
  4303. break;
  4304. }
  4305. a = h, c = !1;
  4306. }
  4307. }
  4308. if (B.RIGHT === e) {
  4309. let u = n.endColumn + 1;
  4310. for (; u < t.getColumnCount() && !t.getColVisible(u); )
  4311. u += 1;
  4312. if (u === t.getColumnCount()) {
  4313. d = !1;
  4314. break;
  4315. }
  4316. const { hasValue: h, matrix: m } = Os(
  4317. t,
  4318. n.startRow,
  4319. u,
  4320. n.endRow,
  4321. u
  4322. );
  4323. if (a && !h && !c) {
  4324. d = !1;
  4325. break;
  4326. } else {
  4327. if (m.getLength() !== 0) {
  4328. let f = u;
  4329. m.forValue((g, p, S) => {
  4330. f = Math.max(p + (S.colSpan || 1) - 1, f);
  4331. }), n.endColumn = f;
  4332. } else
  4333. n.endColumn = u;
  4334. if (n.startColumn = n.endColumn, !a && h) {
  4335. d = !1;
  4336. break;
  4337. }
  4338. a = h, c = !1;
  4339. }
  4340. }
  4341. }
  4342. return En(n, t, !0);
  4343. }
  4344. function nf(r, e, t) {
  4345. return Qn(r, e, t, void 0, !1, 1, !1);
  4346. }
  4347. function Bv(r, e, t) {
  4348. const n = Nd(r, e, t);
  4349. return En(ae.union(n, r), t, !0);
  4350. }
  4351. function Fv(r, e, t) {
  4352. const n = nf(r, e, t), s = {
  4353. startRow: Math.min(r.startRow, n.startRow),
  4354. startColumn: Math.min(r.startColumn, n.startColumn),
  4355. endRow: Math.max(r.endRow, n.endRow),
  4356. endColumn: Math.max(r.endColumn, n.endColumn)
  4357. };
  4358. return En(ae.union(r, s), t);
  4359. }
  4360. function Uv(r, e, t, n) {
  4361. const s = Vh(t), i = Nd(oi(r, s, n), t, n);
  4362. return t === B.UP && i.startRow <= r.startRow ? En(
  4363. { ...e, startColumn: r.startColumn, endColumn: r.endColumn },
  4364. n,
  4365. !0
  4366. ) : t === B.DOWN && i.endRow >= r.endRow ? En(
  4367. { ...e, startColumn: r.startColumn, endColumn: r.endColumn },
  4368. n,
  4369. !0
  4370. ) : t === B.LEFT && i.startColumn <= r.startColumn ? En(
  4371. { ...e, startRow: r.startRow, endRow: r.endRow },
  4372. n,
  4373. !0
  4374. ) : t === B.RIGHT && i.endColumn >= r.endColumn ? En(
  4375. { ...e, startRow: r.startRow, endRow: r.endRow },
  4376. n,
  4377. !0
  4378. ) : ae.union(ae.clone(e), i);
  4379. }
  4380. function jv(r, e, t) {
  4381. const n = Vh(e), s = oi(r, n, t), i = oi(r, e, t), o = nf(s, e, t);
  4382. return En(ae.union(i, o), t, !1);
  4383. }
  4384. function ku(r) {
  4385. return {
  4386. startRow: 0,
  4387. startColumn: 0,
  4388. endRow: r.getRowCount() - 1,
  4389. endColumn: r.getColumnCount() - 1,
  4390. rangeType: j.ALL
  4391. };
  4392. }
  4393. function oi(r, e, t) {
  4394. let n;
  4395. switch (e) {
  4396. case B.UP:
  4397. n = {
  4398. startRow: r.startRow,
  4399. startColumn: r.startColumn,
  4400. endRow: r.startRow,
  4401. endColumn: r.endColumn,
  4402. rangeType: j.NORMAL
  4403. };
  4404. break;
  4405. case B.DOWN:
  4406. n = {
  4407. startRow: r.endRow,
  4408. startColumn: r.startColumn,
  4409. endRow: r.endRow,
  4410. endColumn: r.endColumn,
  4411. rangeType: j.NORMAL
  4412. };
  4413. break;
  4414. case B.LEFT:
  4415. n = {
  4416. startRow: r.startRow,
  4417. startColumn: r.startColumn,
  4418. endRow: r.endRow,
  4419. endColumn: r.startColumn,
  4420. rangeType: j.NORMAL
  4421. };
  4422. break;
  4423. case B.RIGHT:
  4424. n = {
  4425. startRow: r.startRow,
  4426. startColumn: r.endColumn,
  4427. endRow: r.endRow,
  4428. endColumn: r.endColumn,
  4429. rangeType: j.NORMAL
  4430. };
  4431. break;
  4432. default:
  4433. throw new Error("Invalid direction");
  4434. }
  4435. return En(n, t, !1);
  4436. }
  4437. function Os(r, e, t, n, s) {
  4438. let i = !1;
  4439. const o = r.getMatrixWithMergedCells(e, t, n, s).forValue((l, a, c) => {
  4440. if (zv(c))
  4441. return i = !0, !1;
  4442. });
  4443. return {
  4444. hasValue: i,
  4445. matrix: o
  4446. };
  4447. }
  4448. function Mc(r, e, t) {
  4449. const n = ae.clone(r);
  4450. if (e == null)
  4451. return n;
  4452. switch (t) {
  4453. case B.UP:
  4454. case B.DOWN:
  4455. n.startColumn = n.endColumn = e.actualColumn;
  4456. break;
  4457. case B.LEFT:
  4458. case B.RIGHT:
  4459. n.startRow = n.endRow = e.actualRow;
  4460. break;
  4461. }
  4462. return n;
  4463. }
  4464. function Xv(r, e, t) {
  4465. var l, a, c, d;
  4466. const { primary: n, range: s } = r, i = ae.clone(s);
  4467. switch (e) {
  4468. case B.UP:
  4469. case B.DOWN:
  4470. i.startRow = (l = n == null ? void 0 : n.startRow) != null ? l : s.startRow, i.endRow = (a = n == null ? void 0 : n.endRow) != null ? a : s.startRow;
  4471. break;
  4472. case B.LEFT:
  4473. case B.RIGHT:
  4474. i.startColumn = (c = n == null ? void 0 : n.startColumn) != null ? c : s.startColumn, i.endColumn = (d = n == null ? void 0 : n.endColumn) != null ? d : s.startColumn;
  4475. break;
  4476. }
  4477. const o = oi(i, e, t);
  4478. switch (e) {
  4479. case B.DOWN:
  4480. return s.startRow < o.startRow;
  4481. case B.UP:
  4482. return s.endRow > o.endRow;
  4483. case B.LEFT:
  4484. return o.endColumn < s.endColumn;
  4485. case B.RIGHT:
  4486. return o.startColumn > s.startColumn;
  4487. }
  4488. }
  4489. function rf(r, e) {
  4490. let t = r[0].startRow, n = r[0].endRow;
  4491. r.forEach((i) => {
  4492. const { startRow: o, endRow: l } = i;
  4493. t = Math.min(t, o), n = Math.max(n, l);
  4494. });
  4495. const s = new Array(n - t + 1).fill(!1);
  4496. return e.forEach((i) => {
  4497. const { startRow: o, endRow: l } = i;
  4498. for (let a = Math.max(o, t); a <= Math.min(l, n); a++)
  4499. s[a - t] = !0;
  4500. }), r.every((i) => {
  4501. const { startRow: o, endRow: l } = i;
  4502. for (let a = o; a <= l; a++)
  4503. if (!s[a - t])
  4504. return !1;
  4505. return !0;
  4506. });
  4507. }
  4508. function sf(r, e) {
  4509. let t = r[0].startColumn, n = r[0].endColumn;
  4510. r.forEach((i) => {
  4511. const { startColumn: o, endColumn: l } = i;
  4512. t = Math.min(t, o), n = Math.max(n, l);
  4513. });
  4514. const s = new Array(n - t + 1).fill(!1);
  4515. return e.forEach((i) => {
  4516. const { startColumn: o, endColumn: l } = i;
  4517. for (let a = Math.max(o, t); a <= Math.min(l, n); a++)
  4518. s[a - t] = !0;
  4519. }), r.every((i) => {
  4520. const { startColumn: o, endColumn: l } = i;
  4521. for (let a = o; a <= l; a++)
  4522. if (!s[a - t])
  4523. return !1;
  4524. return !0;
  4525. });
  4526. }
  4527. function Hd(r, e) {
  4528. return e ? r === "mergeAll" ? e.filter((t) => !(t.startRow === t.endRow && t.startColumn === t.endColumn)) : r === "mergeVertical" ? e.filter((t) => t.startRow !== t.endRow) : r === "mergeHorizontal" ? e.filter((t) => t.startColumn !== t.endColumn) : e : null;
  4529. }
  4530. function zv(r) {
  4531. return r.v !== void 0 && r.v !== null && r.v !== "" || r.p !== void 0;
  4532. }
  4533. var Bn = /* @__PURE__ */ ((r) => (r[r.moveStopeOne = 0] = "moveStopeOne", r[r.moveGap = 1] = "moveGap", r[r.moveStepPage = 2] = "moveStepPage", r[r.moveStepEnd = 3] = "moveStepEnd", r))(Bn || {});
  4534. const Lt = {
  4535. id: "sheet.command.move-selection",
  4536. type: K.COMMAND,
  4537. handler: (r, e) => {
  4538. if (!e)
  4539. return !1;
  4540. const t = Ue(r.get(L));
  4541. if (!t) return !1;
  4542. const { workbook: n, worksheet: s } = t, i = Hi(r, e.fromCurrentSelection).getCurrentLastSelection();
  4543. if (!i)
  4544. return !1;
  4545. const { direction: o, jumpOver: l, extra: a } = e, { range: c, primary: d } = i, u = Mc(c, d, o), h = l === 1 ? Nd(u, o, s) : Qn(u, o, s), m = uo(h.startRow, h.startColumn, s);
  4546. if (ae.equals(m, u))
  4547. return !1;
  4548. const f = n.getUnitId();
  4549. r.get(ds).remove({
  4550. unitId: f,
  4551. sheetId: s.getSheetId(),
  4552. keycode: Z.TAB
  4553. });
  4554. const g = [
  4555. {
  4556. range: ae.clone(m),
  4557. primary: {
  4558. startRow: m.startRow,
  4559. startColumn: m.startColumn,
  4560. endRow: m.endRow,
  4561. endColumn: m.endColumn,
  4562. actualRow: h.startRow,
  4563. actualColumn: h.startColumn,
  4564. isMerged: m.isMerged,
  4565. isMergedMainCell: m.startRow === h.startRow && m.startColumn === h.startColumn
  4566. }
  4567. }
  4568. ];
  4569. return r.get(F).executeCommand(He.id, {
  4570. unitId: n.getUnitId(),
  4571. subUnitId: s.getSheetId(),
  4572. selections: g,
  4573. type: Xt.MOVE_END,
  4574. extra: a
  4575. });
  4576. }
  4577. }, Fn = {
  4578. id: "sheet.command.move-selection-enter-tab",
  4579. type: K.COMMAND,
  4580. // eslint-disable-next-line max-lines-per-function, complexity
  4581. handler: (r, e) => {
  4582. var k;
  4583. if (!e)
  4584. return !1;
  4585. const t = Ue(r.get(L));
  4586. if (!t) return !1;
  4587. const { workbook: n, worksheet: s } = t, i = Hi(r), { direction: o, keycode: l } = e, a = o === B.LEFT || o === B.UP, c = i.getCurrentSelections().concat(), d = c.findIndex((U) => U.primary), u = c[d];
  4588. if (!u)
  4589. return !1;
  4590. const h = a ? -1 : 1, m = d + h !== c.length ? c[d + h] : c[0], f = c.findIndex((U) => U === m), g = n.getUnitId(), p = s.getSheetId();
  4591. if (!u)
  4592. return !1;
  4593. const { range: S } = u, b = u.primary;
  4594. let v = Mc(S, b, o);
  4595. const _ = r.get(ds), R = _.getCurrentBySearch({
  4596. unitId: g,
  4597. sheetId: p,
  4598. keycode: Z.TAB
  4599. });
  4600. let I;
  4601. const { startRow: y, endRow: M, startColumn: P, endColumn: E } = S, T = a ? b.startRow === y && b.startColumn === P : b.endRow === M && b.endColumn === E;
  4602. if (ae.equals(S, b)) {
  4603. if (l === Z.TAB)
  4604. R == null && _.addOrUpdate({
  4605. unitId: g,
  4606. sheetId: p,
  4607. keycode: Z.TAB,
  4608. selection: u
  4609. });
  4610. else {
  4611. const N = R == null ? void 0 : R.selection;
  4612. if (N != null) {
  4613. const { range: X, primary: Y } = N;
  4614. v = Mc(X, Y, o);
  4615. }
  4616. _.remove({
  4617. unitId: g,
  4618. sheetId: p,
  4619. keycode: Z.TAB
  4620. });
  4621. }
  4622. const U = Qn(v, o, s), V = uo(U.startRow, U.startColumn, s);
  4623. if (ae.equals(V, v))
  4624. return !1;
  4625. I = {
  4626. range: ae.clone(V),
  4627. primary: {
  4628. startRow: V.startRow,
  4629. startColumn: V.startColumn,
  4630. endRow: V.endRow,
  4631. endColumn: V.endColumn,
  4632. actualRow: U.startRow,
  4633. actualColumn: U.startColumn,
  4634. isMerged: V.isMerged,
  4635. isMergedMainCell: V.startRow === U.startRow && V.startColumn === U.startColumn
  4636. }
  4637. };
  4638. } else {
  4639. _.remove({
  4640. unitId: g,
  4641. sheetId: p,
  4642. keycode: Z.TAB
  4643. });
  4644. const U = se.deepClone(b), V = T ? m.range : Qn(
  4645. {
  4646. startRow: U.startRow,
  4647. startColumn: U.startColumn,
  4648. endRow: U.endRow,
  4649. endColumn: U.endColumn
  4650. },
  4651. o,
  4652. s,
  4653. {
  4654. startRow: y,
  4655. endRow: M,
  4656. startColumn: P,
  4657. endColumn: E
  4658. }
  4659. ), N = T && a, X = N ? uo(V.endRow, V.endColumn, s) : uo(V.startRow, V.startColumn, s);
  4660. I = {
  4661. range: T ? m.range : ae.clone(S),
  4662. primary: {
  4663. startRow: X.startRow,
  4664. startColumn: X.startColumn,
  4665. endRow: X.endRow,
  4666. endColumn: X.endColumn,
  4667. actualRow: N ? X.startRow : V.startRow,
  4668. actualColumn: N ? X.startColumn : V.startColumn,
  4669. isMerged: X.isMerged,
  4670. isMergedMainCell: X.startRow === V.startRow && X.startColumn === V.startColumn
  4671. },
  4672. style: T ? m.style : u.style
  4673. };
  4674. }
  4675. T ? (c[d].primary = null, c[f] = I, i.setSelections(g, p, [], Xt.MOVE_END)) : c[d] = I;
  4676. const A = r.get(F).executeCommand(He.id, {
  4677. unitId: g,
  4678. subUnitId: p,
  4679. type: Xt.MOVE_END,
  4680. selections: c,
  4681. extra: e.extra
  4682. }), x = (k = r.get(Ce).getRenderById(g)) == null ? void 0 : k.with(dt);
  4683. return x == null || x.refreshSelectionMoveEnd(), A;
  4684. }
  4685. }, Gt = {
  4686. id: "sheet.command.expand-selection",
  4687. type: K.COMMAND,
  4688. handler: (r, e) => {
  4689. if (!e) return !1;
  4690. const t = Ue(r.get(L));
  4691. if (!t) return !1;
  4692. const { worksheet: n, unitId: s, subUnitId: i } = t, o = Hi(r).getCurrentLastSelection();
  4693. if (!o) return !1;
  4694. const { range: l, primary: a } = o, { jumpOver: c, direction: d, extra: u } = e, m = Xv(o, d, n) ? c === 1 ? Uv(
  4695. l,
  4696. { ...ae.clone(a), rangeType: j.NORMAL },
  4697. d,
  4698. n
  4699. ) : jv(l, d, n) : c === 1 ? Bv(l, d, n) : Fv(l, d, n);
  4700. return m.rangeType = o.range.rangeType, ae.equals(m, l) ? !1 : r.get(F).syncExecuteCommand(He.id, {
  4701. unitId: s,
  4702. subUnitId: i,
  4703. type: Xt.ONLY_SET,
  4704. selections: [
  4705. {
  4706. range: m,
  4707. primary: a
  4708. // this remains unchanged
  4709. }
  4710. ],
  4711. extra: u
  4712. });
  4713. }
  4714. }, Vd = {
  4715. id: "sheet.command.select-all",
  4716. type: K.COMMAND,
  4717. handler: async (r, e = { expandToGapFirst: !0, loop: !1 }) => {
  4718. const t = Ue(r.get(L));
  4719. if (!t) return !1;
  4720. const n = Hi(r).getCurrentLastSelection();
  4721. if (!n) return !1;
  4722. const s = r.get(Ad), { worksheet: i, unitId: o, subUnitId: l } = t, a = `${o}|${l}`;
  4723. a !== s.selectedRangeWorksheet && (s.rangesStack = [], s.selectedRangeWorksheet = a);
  4724. const c = i.getMaxRows(), d = i.getMaxColumns(), { expandToGapFirst: u, loop: h } = e, { range: m, primary: f } = n, g = m.endColumn === d - 1 && m.endRow === c - 1 && m.startRow === 0 && m.startColumn === 0;
  4725. s.rangesStack.some((S) => ae.equals(S, m)) || (s.rangesStack = [], s.rangesStack.push(m));
  4726. let p;
  4727. if (g)
  4728. if (h) {
  4729. if (s.rangesStack.findIndex((b) => ae.equals(b, m)) !== s.rangesStack.length - 1)
  4730. return !1;
  4731. p = s.rangesStack[0];
  4732. } else
  4733. return !1;
  4734. else u ? (p = NS(m, { left: !0, right: !0, up: !0, down: !0 }, i), ae.equals(p, m) && (p = ku(i))) : p = ku(i);
  4735. return s.rangesStack.some((S) => ae.equals(S, p)) || s.rangesStack.push(p), r.get(F).executeCommand(He.id, {
  4736. unitId: o,
  4737. subUnitId: l,
  4738. selections: [
  4739. {
  4740. range: p,
  4741. primary: f
  4742. // this remains unchanged
  4743. }
  4744. ]
  4745. });
  4746. }
  4747. };
  4748. var Yv = Object.defineProperty, Zv = Object.getOwnPropertyDescriptor, Gv = (r, e, t, n) => {
  4749. for (var s = n > 1 ? void 0 : n ? Zv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  4750. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  4751. return n && s && Yv(e, t, s), s;
  4752. }, qv = (r, e) => (t, n) => e(t, n, r);
  4753. let yt = class {
  4754. constructor(r, e) {
  4755. /**
  4756. * a map holds all scroll info for each sheet
  4757. */
  4758. w(this, "_scrollStateMap", /* @__PURE__ */ new Map());
  4759. /**
  4760. * a subject for current sheet scrollInfo, no limit by viewport.
  4761. */
  4762. w(this, "_rawScrollInfo$", new Me(null));
  4763. /**
  4764. * a subject for current sheet scrollInfo ( events, ex wheel event and point events add deltaXY to rawScrollInfo$)
  4765. */
  4766. w(this, "rawScrollInfo$", this._rawScrollInfo$.asObservable());
  4767. /**
  4768. * a subject for current valid scrollInfo, viewport@_scrollCore would limit rawScrollInfo$ exclude negative value or over max value.
  4769. * use this subject not rawScrollInfo$ when get scrolling state of viewport.
  4770. * The value of this subject is the same as the value of onScrollAfter$
  4771. *
  4772. */
  4773. w(this, "validViewportScrollInfo$", new Me(null));
  4774. /**
  4775. * a subject for current valid scrollInfo, viewport@_scrollCore would limit rawScrollInfo$ exclude negative value or over max value.
  4776. * use this subject not rawScrollInfo$ when get scrolling state of viewport.
  4777. */
  4778. w(this, "_searchParamForScroll", null);
  4779. this._context = r, this._sheetSkeletonManagerService = e;
  4780. }
  4781. dispose() {
  4782. this._rawScrollInfo$.complete();
  4783. }
  4784. setSearchParam(r) {
  4785. this._searchParamForScroll = r;
  4786. }
  4787. setSearchParamAndRefresh(r) {
  4788. this._searchParamForScroll = r, this._scrollStateNext(r);
  4789. }
  4790. getScrollStateByParam(r) {
  4791. return this._getCurrentScroll(r);
  4792. }
  4793. getCurrentScrollState() {
  4794. return this._getCurrentScroll(this._searchParamForScroll);
  4795. }
  4796. /**
  4797. * Set scrollInfo by SetScrollOperation, call by ScrollCommand.id.
  4798. * @param param
  4799. */
  4800. setScrollInfoAndEmitEvent(r) {
  4801. this._setScrollState(r), this._scrollStateNext(r);
  4802. }
  4803. /**
  4804. * Set _scrollStateMap but no _scrollInfo$.next
  4805. * @param scroll
  4806. */
  4807. setScrollStateToCurrSheet(r) {
  4808. this._searchParamForScroll != null && this._setScrollState({
  4809. ...this._searchParamForScroll,
  4810. ...r
  4811. });
  4812. }
  4813. clear() {
  4814. this._searchParamForScroll != null && this._clearByParamAndNotify(this._searchParamForScroll);
  4815. }
  4816. calcViewportScrollFromRowColOffset(r) {
  4817. if (!r)
  4818. return {
  4819. viewportScrollX: 0,
  4820. viewportScrollY: 0
  4821. };
  4822. let { sheetViewStartColumn: e, sheetViewStartRow: t, offsetX: n, offsetY: s } = r;
  4823. t = t || 0, s = s || 0;
  4824. const i = this._sheetSkeletonManagerService.getCurrentSkeleton(), o = (i == null ? void 0 : i.rowHeightAccumulation[t - 1]) || 0, a = ((i == null ? void 0 : i.columnWidthAccumulation[e - 1]) || 0) + n, c = o + s;
  4825. return {
  4826. viewportScrollX: a,
  4827. viewportScrollY: c
  4828. };
  4829. }
  4830. _setScrollState(r) {
  4831. const { unitId: e, sheetId: t, sheetViewStartColumn: n, sheetViewStartRow: s, offsetX: i, offsetY: o } = r;
  4832. this._scrollStateMap.has(e) || this._scrollStateMap.set(e, /* @__PURE__ */ new Map());
  4833. const l = this._scrollStateMap.get(e), a = {
  4834. sheetViewStartRow: s,
  4835. sheetViewStartColumn: n,
  4836. offsetX: i,
  4837. offsetY: o
  4838. };
  4839. l.set(t, a);
  4840. }
  4841. _clearByParamAndNotify(r) {
  4842. this._setScrollState({
  4843. ...r,
  4844. sheetViewStartRow: 0,
  4845. sheetViewStartColumn: 0,
  4846. offsetX: 0,
  4847. offsetY: 0
  4848. }), this._scrollStateNext(r);
  4849. }
  4850. _getCurrentScroll(r) {
  4851. var i;
  4852. const e = {
  4853. sheetViewStartRow: 0,
  4854. sheetViewStartColumn: 0,
  4855. offsetX: 0,
  4856. offsetY: 0
  4857. };
  4858. if (r == null)
  4859. return e;
  4860. const { unitId: t, sheetId: n } = r;
  4861. return ((i = this._scrollStateMap.get(t)) == null ? void 0 : i.get(n)) || e;
  4862. }
  4863. _scrollStateNext(r) {
  4864. const e = this._getCurrentScroll(r);
  4865. this._rawScrollInfo$.next(e);
  4866. }
  4867. };
  4868. yt = Gv([
  4869. qv(1, D(me))
  4870. ], yt);
  4871. const dn = {
  4872. id: "sheet.operation.set-scroll",
  4873. type: K.OPERATION,
  4874. handler: (r, e) => {
  4875. if (!e)
  4876. return !1;
  4877. const { unitId: t, sheetId: n, offsetX: s, offsetY: i, sheetViewStartColumn: o, sheetViewStartRow: l } = e;
  4878. return r.get(Ce).getRenderById(t).with(yt).setScrollInfoAndEmitEvent({
  4879. unitId: t,
  4880. sheetId: n,
  4881. offsetX: s,
  4882. offsetY: i,
  4883. sheetViewStartRow: l,
  4884. sheetViewStartColumn: o
  4885. }), !0;
  4886. }
  4887. }, li = {
  4888. id: "sheet.command.set-scroll-relative",
  4889. type: K.COMMAND,
  4890. // offsetXY derived from mouse wheel event
  4891. // this._commandService.executeCommand(SetScrollRelativeCommand.id, { offsetY });
  4892. handler: async (r, e) => {
  4893. const t = r.get(F), n = r.get(L), s = r.get(Ce), i = Ue(n);
  4894. if (!i) return !1;
  4895. const { unitId: o, subUnitId: l } = i, c = s.getRenderById(o).with(yt).getCurrentScrollState(), { offsetX: d = 0, offsetY: u = 0 } = e || {}, {
  4896. sheetViewStartRow: h = 0,
  4897. sheetViewStartColumn: m = 0,
  4898. offsetX: f = 0,
  4899. offsetY: g = 0
  4900. } = c || {};
  4901. return t.executeCommand(dn.id, {
  4902. unitId: o,
  4903. sheetId: l,
  4904. // why + ySplit? receiver - ySplit in scroll.operation.ts
  4905. // sheetViewStartRow: sheetViewStartRow + ySplit,
  4906. // sheetViewStartColumn: sheetViewStartColumn + xSplit,
  4907. sheetViewStartRow: h,
  4908. sheetViewStartColumn: m,
  4909. offsetX: f + d,
  4910. // currentOffsetX + offsetX may be negative or over max
  4911. offsetY: g + u
  4912. });
  4913. }
  4914. }, un = {
  4915. id: "sheet.command.scroll-view",
  4916. type: K.COMMAND,
  4917. handler: (r, e) => {
  4918. if (!e)
  4919. return !1;
  4920. const t = r.get(L), n = r.get(Ce), s = Ue(t);
  4921. if (!s) return !1;
  4922. const { workbook: i, worksheet: o, unitId: l } = s, c = n.getRenderById(l).with(yt).getCurrentScrollState();
  4923. if (!o)
  4924. return !1;
  4925. const { sheetViewStartRow: d, sheetViewStartColumn: u, offsetX: h, offsetY: m } = e, {
  4926. sheetViewStartColumn: f,
  4927. sheetViewStartRow: g,
  4928. offsetX: p,
  4929. offsetY: S
  4930. } = c || {}, { xSplit: b, ySplit: v } = s.worksheet.getConfig().freeze;
  4931. return r.get(F).syncExecuteCommand(dn.id, {
  4932. unitId: i.getUnitId(),
  4933. sheetId: o.getSheetId(),
  4934. // why + ySplit? receiver - ySplit in scroll.operation.ts
  4935. // sheetViewStartRow: sheetViewStartRow + ySplit,
  4936. // sheetViewStartColumn: sheetViewStartColumn + xSplit,
  4937. sheetViewStartRow: d != null ? d : g != null ? g : 0 + v,
  4938. sheetViewStartColumn: u != null ? u : f != null ? f : 0 + b,
  4939. offsetX: h != null ? h : p,
  4940. offsetY: m != null ? m : S
  4941. });
  4942. }
  4943. }, of = {
  4944. id: "sheet.command.scroll-to-cell",
  4945. type: K.COMMAND,
  4946. handler: (r, e) => {
  4947. const t = r.get(L);
  4948. return r.get(Ce).getRenderById(t.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId()).with(ai).scrollToRange(e.range, e.forceTop, e.forceLeft);
  4949. }
  4950. }, nE = {
  4951. id: "sheet.command.scroll-view-reset",
  4952. type: K.COMMAND,
  4953. handler: async (r) => {
  4954. const e = r.get(L), t = Ue(e);
  4955. if (!t) return !1;
  4956. const { subUnitId: n, unitId: s } = t;
  4957. return r.get(F).executeCommand(dn.id, {
  4958. unitId: s,
  4959. sheetId: n,
  4960. sheetViewStartRow: 0,
  4961. sheetViewStartColumn: 0
  4962. });
  4963. }
  4964. };
  4965. var Qv = Object.defineProperty, Kv = Object.getOwnPropertyDescriptor, Jv = (r, e, t, n) => {
  4966. for (var s = n > 1 ? void 0 : n ? Kv(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  4967. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  4968. return n && s && Qv(e, t, s), s;
  4969. }, Lr = (r, e) => (t, n) => e(t, n, r);
  4970. const $v = [Lt.id, Fn.id], e1 = 3;
  4971. let ai = class extends ce {
  4972. constructor(r, e, t, n, s, i, o) {
  4973. super(), this._context = r, this._injector = e, this._sheetSkeletonManagerService = t, this._contextService = n, this._commandService = s, this._renderManagerService = i, this._scrollManagerService = o, this._initCommandListener(), this._wheelEventListener(), this._scrollBarEventListener(), this._initSkeletonListener();
  4974. }
  4975. _wheelEventListener() {
  4976. const { scene: r } = this._context;
  4977. if (!r) return;
  4978. const e = r.getViewport(z.VIEW_MAIN);
  4979. e && this.disposeWithMe(
  4980. r.onMouseWheel$.subscribeEvent((t, n) => {
  4981. if (t.ctrlKey || !this._contextService.getContextValue(Tt))
  4982. return;
  4983. let s = 0, i = 0;
  4984. const o = e.limitedScroll();
  4985. s = t.deltaX, t.shiftKey ? s = (t.deltaY || t.deltaX) * e1 : i = t.deltaY, this._commandService.executeCommand(li.id, { offsetX: s, offsetY: i }), this._context.scene.makeDirty(!0), o && !o.isLimitedX && !o.isLimitedY && (t.preventDefault(), r.getParent().classType === oS.SCENE_VIEWER && n.stopPropagation()), e.isWheelPreventDefaultX && e.isWheelPreventDefaultY && t.preventDefault();
  4986. })
  4987. );
  4988. }
  4989. // eslint-disable-next-line max-lines-per-function
  4990. _scrollBarEventListener() {
  4991. const { scene: r } = this._context;
  4992. if (r == null) return;
  4993. const e = r.getViewport(z.VIEW_MAIN);
  4994. e && (this.disposeWithMe(
  4995. Ae(
  4996. this._scrollManagerService.rawScrollInfo$.subscribe((t) => {
  4997. var h;
  4998. const n = (h = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton;
  4999. if (!n) return;
  5000. if (t == null) {
  5001. e.scrollToViewportPos({
  5002. viewportScrollX: 0,
  5003. viewportScrollY: 0
  5004. });
  5005. return;
  5006. }
  5007. const { sheetViewStartRow: s, sheetViewStartColumn: i, offsetX: o, offsetY: l } = t, { startX: a, startY: c } = n.getCellWithCoordByIndex(
  5008. s,
  5009. i,
  5010. !1
  5011. ), d = a + o, u = c + l;
  5012. e.scrollToViewportPos({ viewportScrollX: d, viewportScrollY: u });
  5013. })
  5014. )
  5015. ), this.disposeWithMe(
  5016. // set scrollInfo, the event is triggered in viewport@_scrollToScrollbarPos
  5017. e.onScrollAfter$.subscribeEvent((t) => {
  5018. var f;
  5019. const n = (f = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : f.skeleton;
  5020. if (n == null || t.isTrigger === !1)
  5021. return;
  5022. const s = this._getSheetObject();
  5023. if (n == null || s == null)
  5024. return;
  5025. const { viewportScrollX: i, viewportScrollY: o, scrollX: l, scrollY: a } = t, { row: c, column: d, rowOffset: u, columnOffset: h } = n.getDecomposedOffset(
  5026. i,
  5027. o
  5028. ), m = {
  5029. sheetViewStartRow: c,
  5030. sheetViewStartColumn: d,
  5031. offsetX: h,
  5032. offsetY: u
  5033. };
  5034. this._scrollManagerService.setScrollStateToCurrSheet(m), this._scrollManagerService.validViewportScrollInfo$.next({
  5035. ...m,
  5036. viewportScrollX: i,
  5037. viewportScrollY: o,
  5038. scrollX: l,
  5039. scrollY: a
  5040. });
  5041. })
  5042. ), this.disposeWithMe(
  5043. // get scrollByBar event from viewport and exec ScrollCommand.id.
  5044. e.onScrollByBar$.subscribeEvent((t) => {
  5045. var u;
  5046. const n = (u = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : u.skeleton;
  5047. if (n == null || t.isTrigger === !1)
  5048. return;
  5049. const s = this._getSheetObject();
  5050. if (n == null || s == null)
  5051. return;
  5052. const { viewportScrollX: i = 0, viewportScrollY: o = 0 } = t, { row: l, column: a, rowOffset: c, columnOffset: d } = n.getDecomposedOffset(
  5053. i,
  5054. o
  5055. );
  5056. this._commandService.executeCommand(un.id, {
  5057. sheetViewStartRow: l,
  5058. sheetViewStartColumn: a,
  5059. offsetX: d,
  5060. offsetY: c
  5061. });
  5062. })
  5063. ));
  5064. }
  5065. _initSkeletonListener() {
  5066. this.disposeWithMe(Ae(
  5067. this._sheetSkeletonManagerService.currentSkeletonBefore$.subscribe((r) => {
  5068. if (r == null)
  5069. return;
  5070. const e = { unitId: r.unitId, sheetId: r.sheetId };
  5071. this._scrollManagerService.setSearchParam(e);
  5072. const t = this._getSheetObject();
  5073. if (!t) return;
  5074. const s = t.scene.getViewport(z.VIEW_MAIN), i = this._scrollManagerService.getScrollStateByParam(e), { viewportScrollX: o, viewportScrollY: l } = this._scrollManagerService.calcViewportScrollFromRowColOffset(i);
  5075. s && (i ? (s.viewportScrollX = o, s.viewportScrollY = l) : (s.viewportScrollX = 0, s.viewportScrollY = 0), this._updateSceneSize(r));
  5076. })
  5077. ));
  5078. }
  5079. scrollToRange(r, e, t) {
  5080. let { endRow: n, endColumn: s, startColumn: i, startRow: o } = r;
  5081. const l = this._getViewportBounding();
  5082. if (r.rangeType === j.ROW ? (i = 0, s = 0) : r.rangeType === j.COLUMN && (o = 0, n = 0), l && !e && !t) {
  5083. const a = l.startRow > n ? o : n, c = l.startColumn > s ? i : s;
  5084. return this._scrollToCell(a, c);
  5085. } else
  5086. return this._scrollToCell(o, i, e, t);
  5087. }
  5088. /**
  5089. * Scroll spreadsheet(viewMain) to cell position. Based on the limitations of viewport and the number of rows and columns, you can only scroll to the maximum scrollable range.
  5090. *
  5091. * if column A ~ B is frozen. set second param to 0 would make viewMain start at column C.
  5092. * set second param to 2 would make viewMain start at column E.
  5093. * @param {number} row - Cell row
  5094. * @param {number} column - Cell column
  5095. * @returns {boolean} - true if scroll is successful
  5096. */
  5097. scrollToCell(r, e) {
  5098. const t = this._context.unit.getActiveSheet(), {
  5099. ySplit: n,
  5100. xSplit: s
  5101. } = t.getFreeze();
  5102. return this._commandService.syncExecuteCommand(un.id, {
  5103. sheetViewStartRow: r - n,
  5104. sheetViewStartColumn: e - s,
  5105. offsetX: 0,
  5106. offsetY: 0
  5107. });
  5108. }
  5109. _initCommandListener() {
  5110. this.disposeWithMe(this._commandService.onCommandExecuted((r) => {
  5111. if ($v.includes(r.id))
  5112. this._scrollToSelection();
  5113. else if (r.id === cd.id) {
  5114. const e = r.params;
  5115. this.scrollToRange(e);
  5116. } else if (r.id === Gt.id) {
  5117. const e = r.params;
  5118. this._scrollToSelectionForExpand(e);
  5119. } else r.id === He.id && r.params.reveal && this._scrollToSelection();
  5120. }));
  5121. }
  5122. _scrollToSelectionForExpand(r) {
  5123. setTimeout(() => {
  5124. const e = this._getSelectionsService().getCurrentLastSelection();
  5125. if (e == null)
  5126. return;
  5127. const { startRow: t, startColumn: n, endRow: s, endColumn: i } = e.range, o = this._getViewportBounding();
  5128. if (o == null)
  5129. return;
  5130. const { startRow: l, startColumn: a, endRow: c, endColumn: d } = o;
  5131. let u = 0, h = 0;
  5132. t > l ? u = s : s < c ? u = t : u = l, n > a ? h = i : i < d ? h = n : h = a, r.direction === B.DOWN ? u = s : r.direction === B.UP ? u = t : r.direction === B.RIGHT ? h = i : r.direction === B.LEFT && (h = n), this._scrollToCell(u, h);
  5133. }, 0);
  5134. }
  5135. _getFreeze() {
  5136. var e;
  5137. const r = (e = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : e.skeleton.getWorksheetConfig();
  5138. if (r != null)
  5139. return r.freeze;
  5140. }
  5141. _updateSceneSize(r) {
  5142. var u;
  5143. if (r == null)
  5144. return;
  5145. const { unitId: e } = this._context, { skeleton: t } = r, n = (u = this._renderManagerService.getRenderById(e)) == null ? void 0 : u.scene;
  5146. if (t == null || n == null)
  5147. return;
  5148. const { rowTotalHeight: s, columnTotalWidth: i, rowHeaderWidthAndMarginLeft: o, columnHeaderHeightAndMarginTop: l } = t, c = this._context.unit.getActiveSheet();
  5149. if (!c) return;
  5150. const d = c.getZoomRatio() || 1;
  5151. n == null || n.setScaleValue(d, d), n == null || n.transformByState({
  5152. width: o + i,
  5153. height: l + s
  5154. });
  5155. }
  5156. _getSheetObject() {
  5157. return pn(this._context.unit, this._context);
  5158. }
  5159. _scrollToSelectionByDirection(r) {
  5160. const e = this._getViewportBounding();
  5161. if (e == null)
  5162. return !1;
  5163. const {
  5164. startRow: t,
  5165. startColumn: n,
  5166. endRow: s,
  5167. endColumn: i
  5168. } = e;
  5169. let o = 0, l = 0;
  5170. const { startRow: a, startColumn: c, endRow: d, endColumn: u } = r;
  5171. a >= t && (o = d), d <= s && (o = a), c >= n && (l = u), u <= i && (l = c), this._scrollToCell(o, l);
  5172. }
  5173. _scrollToSelection(r = !0) {
  5174. var a;
  5175. const e = this._getSelectionsService().getCurrentLastSelection();
  5176. if (!e) return;
  5177. const { startRow: t, startColumn: n, actualRow: s, actualColumn: i } = (a = e.primary) != null ? a : e.range, o = r && s != null ? s : t, l = r && i != null ? i : n;
  5178. this._scrollToCell(o, l);
  5179. }
  5180. _getSelectionsService() {
  5181. return Hi(this._injector);
  5182. }
  5183. _getViewportBounding() {
  5184. var s, i;
  5185. const r = (s = this._getSheetObject()) == null ? void 0 : s.scene;
  5186. if (r == null)
  5187. return;
  5188. const e = r.getViewport(z.VIEW_MAIN);
  5189. if (e == null)
  5190. return;
  5191. const t = (i = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : i.skeleton;
  5192. if (t == null)
  5193. return;
  5194. const n = e.calcViewportInfo();
  5195. return t.getRangeByViewBound(n.viewBound);
  5196. }
  5197. // For arrow key to active cell cause scrolling.
  5198. // eslint-disable-next-line max-lines-per-function, complexity
  5199. _scrollToCell(r, e, t = !1, n = !1) {
  5200. var P, E, T, A;
  5201. const { rowHeightAccumulation: s, columnWidthAccumulation: i } = (E = (P = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : P.skeleton) != null ? E : {};
  5202. if (s == null || i == null) return !1;
  5203. const o = (T = this._getSheetObject()) == null ? void 0 : T.scene;
  5204. if (o == null) return !1;
  5205. const l = o.getViewport(z.VIEW_MAIN);
  5206. if (l == null) return !1;
  5207. const a = (A = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : A.skeleton;
  5208. if (a == null) return !1;
  5209. const c = this._context.unit.getActiveSheet();
  5210. if (!c) return !1;
  5211. r = se.clamp(r, 0, s.length - 1), e = se.clamp(e, 0, i.length - 1);
  5212. const {
  5213. startColumn: d,
  5214. startRow: u,
  5215. ySplit: h,
  5216. xSplit: m
  5217. } = c.getFreeze(), f = this._getViewportBounding();
  5218. if (f == null) return !1;
  5219. const {
  5220. startRow: g,
  5221. startColumn: p,
  5222. endRow: S,
  5223. endColumn: b
  5224. } = f;
  5225. a.getVisibleRangeByViewport(z.VIEW_MAIN);
  5226. let v, _;
  5227. if (r >= u && e >= d - h && (r <= g && (v = r, t = !0), r >= S)) {
  5228. const H = s[r] - l.height;
  5229. for (let x = g; x <= r && (v = x + 1, !(s[x] >= H)); x++)
  5230. ;
  5231. }
  5232. if (e >= d && r >= u - h && (e <= p && (_ = e, n = !0), e >= b)) {
  5233. const H = i[e] - l.width;
  5234. for (let x = p; x <= e && (_ = x + 1, !(i[x] >= H)); x++)
  5235. ;
  5236. }
  5237. if (v === void 0 && _ === void 0) return !1;
  5238. let { offsetX: R, offsetY: I, sheetViewStartRow: y, sheetViewStartColumn: M } = this._scrollManagerService.getCurrentScrollState() || {};
  5239. if (v = v ? Math.min(v, r) : y + h, _ = _ ? Math.min(_, e) : M + m, n) {
  5240. R = 0, _ = e;
  5241. const H = a.getHiddenColumnsInRange({ startColumn: _ - m, endColumn: _ });
  5242. _ = _ - H.length;
  5243. }
  5244. if (t) {
  5245. I = 0, v = r;
  5246. const H = a.getHiddenRowsInRange({ startRow: v - h, endRow: v });
  5247. v = v - H.length;
  5248. }
  5249. return this._commandService.syncExecuteCommand(un.id, {
  5250. // sheetViewStartRow & offsetX should never be undefined, it's rendering, there should always be a value!
  5251. // sheetViewStartRow: forceTop ? Math.max(0, row - freezeYSplit) : ((startSheetViewRow ?? 0) - freezeYSplit),
  5252. // sheetViewStartColumn: forceLeft ? Math.max(0, column - freezeXSplit) : ((startSheetViewColumn ?? 0) - freezeXSplit),
  5253. // offsetX: startSheetViewColumn === undefined ? offsetX : 0,
  5254. // offsetY: startSheetViewRow === undefined ? offsetY : 0,
  5255. sheetViewStartRow: Math.max(0, v - h),
  5256. sheetViewStartColumn: Math.max(0, _ - m),
  5257. offsetX: R,
  5258. offsetY: I
  5259. });
  5260. }
  5261. };
  5262. ai = Jv([
  5263. Lr(1, D(vt)),
  5264. Lr(2, D(me)),
  5265. Lr(3, Ne),
  5266. Lr(4, F),
  5267. Lr(5, Ce),
  5268. Lr(6, D(yt))
  5269. ], ai);
  5270. const lf = {
  5271. id: "sheet.operation.scroll-to-range",
  5272. type: K.OPERATION,
  5273. handler: (r, e) => {
  5274. if (!e)
  5275. return !1;
  5276. const t = r.get(L);
  5277. return r.get(Ce).getRenderById(t.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId()).with(ai).scrollToRange(e.range, e.forceTop, e.forceLeft);
  5278. }
  5279. };
  5280. class t1 {
  5281. constructor() {
  5282. w(this, "_state", null);
  5283. w(this, "_rect", null);
  5284. w(this, "_state$", new Me(null));
  5285. w(this, "state$", this._state$.asObservable());
  5286. w(this, "_rect$", new Me(null));
  5287. w(this, "rect$", this._rect$.asObservable());
  5288. w(this, "_focus", !1);
  5289. w(this, "_focus$", new Me(this._focus));
  5290. w(this, "focus$", this._focus$.asObservable());
  5291. }
  5292. dispose() {
  5293. this._state$.complete(), this._state = null, this._rect$.complete(), this._rect = null;
  5294. }
  5295. setState(e) {
  5296. this._state = e, this._refresh(e);
  5297. }
  5298. getRect() {
  5299. return this._rect;
  5300. }
  5301. setRect(e) {
  5302. this._rect = e, this._rect$.next(e);
  5303. }
  5304. getState() {
  5305. return this._state;
  5306. }
  5307. setFocus(e = !1) {
  5308. this._focus = e, this._focus$.next(e);
  5309. }
  5310. _refresh(e) {
  5311. this._state$.next(e);
  5312. }
  5313. }
  5314. const Fl = gn(
  5315. "univer.sheet-cell-editor-manager.service"
  5316. ), n1 = "36", r1 = "univer-sheet-container", af = {
  5317. sheetFooterBarHeight: n1,
  5318. sheetContainer: r1
  5319. };
  5320. var s1 = Object.defineProperty, i1 = Object.getOwnPropertyDescriptor, o1 = (r, e, t, n) => {
  5321. for (var s = n > 1 ? void 0 : n ? i1(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  5322. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  5323. return n && s && s1(e, t, s), s;
  5324. }, Wr = (r, e) => (t, n) => e(t, n, r);
  5325. const Du = 5, Lu = 2;
  5326. let Do = class extends ce {
  5327. constructor(r, e, t, n, s, i, o) {
  5328. super(), this._context = r, this._layoutService = e, this._cellEditorManagerService = t, this._editorBridgeService = n, this._renderManagerService = s, this._sheetSkeletonManagerService = i, this._univerInstanceService = o;
  5329. }
  5330. // eslint-disable-next-line complexity
  5331. fitTextSize(r) {
  5332. var M, P, E, T;
  5333. const e = this._editorBridgeService.getEditCellState();
  5334. if (!e) return;
  5335. const { position: t, documentLayoutObject: n, canvasOffset: s, scaleX: i, scaleY: o } = e, { startX: l, startY: a, endX: c, endY: d } = t, u = this._univerInstanceService.getUnit(Le, O.UNIVER_DOC);
  5336. if (u == null)
  5337. return;
  5338. const h = this._getEditorSkeleton();
  5339. if (!h) return;
  5340. const m = this._predictingSize(
  5341. t,
  5342. s,
  5343. h,
  5344. n,
  5345. i,
  5346. o
  5347. );
  5348. if (!m) return;
  5349. let { actualWidth: f, actualHeight: g } = m;
  5350. const { verticalAlign: p, horizontalAlign: S, paddingData: b, fill: v } = n;
  5351. f = f + ((M = b.l) != null ? M : 0) + ((P = b.r) != null ? P : 0), g = g + ((E = b.t) != null ? E : 0) + ((T = b.b) != null ? T : 0);
  5352. let _ = c - l, R = d - a;
  5353. _ < f && (_ = Math.ceil(f)), R < g && (R = Math.ceil(g));
  5354. let I = 0;
  5355. p === an.MIDDLE ? I = (R - g) / 2 / o : p === an.TOP ? I = b.t || 0 : I = (R - g) / o;
  5356. let y = 0;
  5357. S === wt.CENTER ? y = (_ - f) / 2 / i : S === wt.RIGHT ? y = (_ - f) / i : y = b.l || 0, I = I < (b.t || 0) ? b.t || 0 : I, y = y < (b.l || 0) ? b.l || 0 : y, u.updateDocumentDataMargin({
  5358. t: I,
  5359. l: y
  5360. }), h.calculate(), this._editAreaProcessing(
  5361. _,
  5362. R,
  5363. t,
  5364. s,
  5365. v,
  5366. i,
  5367. o,
  5368. S,
  5369. r
  5370. );
  5371. }
  5372. /**
  5373. * Mainly used to pre-calculate the width of the editor,
  5374. * to determine whether it needs to be automatically widened.
  5375. */
  5376. _predictingSize(r, e, t, n, s = 1, i = 1) {
  5377. const { startX: o, endX: l } = r, { textRotation: a, wrapStrategy: c, paddingData: d } = n, u = this._univerInstanceService.getUnit(Le, O.UNIVER_DOC), { vertexAngle: h } = nd(a);
  5378. if (c === Cr.WRAP && h === 0) {
  5379. u == null || u.updateDocumentDataPageSize(l - o), u == null || u.updateDocumentDataMargin({ l: d.l, t: d.t }), t.calculate();
  5380. const { actualWidth: p, actualHeight: S } = t.getActualSize();
  5381. return {
  5382. actualWidth: p * s,
  5383. actualHeight: S * i
  5384. };
  5385. }
  5386. const m = this._getEditorMaxSize(r, e, n.horizontalAlign);
  5387. if (!m) return;
  5388. u == null || u.updateDocumentDataPageSize(m.width / s), t.calculate();
  5389. const f = t.getActualSize();
  5390. let g = l - o;
  5391. return g < f.actualWidth * s + Du * s && (g = f.actualWidth * s + Du * s), u == null || u.updateDocumentDataPageSize(g / s), u == null || u.updateDocumentRenderConfig({
  5392. horizontalAlign: wt.UNSPECIFIED,
  5393. cellValueType: void 0
  5394. }), {
  5395. actualWidth: f.actualWidth * s,
  5396. actualHeight: f.actualHeight * i
  5397. };
  5398. }
  5399. _getEditorMaxSize(r, e, t) {
  5400. if (this._getEditorObject() == null)
  5401. return;
  5402. function s(S) {
  5403. return Number.parseInt(S.replace("px", ""));
  5404. }
  5405. const o = this._context.engine.getCanvasElement(), l = o.getBoundingClientRect(), a = s(o.style.width), { width: c } = l, d = c / a, { startX: u, startY: h, endX: m } = r, f = this._context.engine.width, g = document.body.clientHeight - h - Number.parseFloat(af.sheetFooterBarHeight) - e.top - Lu * 2;
  5406. let p = c - u;
  5407. if (t === wt.CENTER) {
  5408. const S = f - m, b = u;
  5409. p = m - u + Math.min(b, S) * 2;
  5410. } else t === wt.RIGHT && (p = m);
  5411. return {
  5412. height: g,
  5413. width: p - Lu,
  5414. scaleAdjust: d
  5415. };
  5416. }
  5417. /**
  5418. * Mainly used to calculate the volume of scenes and objects,
  5419. * determine whether a scrollbar appears,
  5420. * and calculate the editor's boundaries relative to the browser.
  5421. */
  5422. // eslint-disable-next-line max-lines-per-function
  5423. _editAreaProcessing(r, e, t, n, s, i = 1, o = 1, l, a) {
  5424. var H;
  5425. const c = this._getEditorObject();
  5426. if (c == null)
  5427. return;
  5428. const u = this._context.engine.getCanvasElement();
  5429. let { startX: h, startY: m } = t;
  5430. const { document: f, scene: g, engine: p } = c, S = g.getViewport(vo.VIEW_MAIN), b = this._getEditorMaxSize(t, n, l), { height: v, width: _, scaleAdjust: R } = b;
  5431. let I = e, y = S == null ? void 0 : S.getScrollBar();
  5432. I > v ? (y == null ? S && new rd(S, { enableHorizontal: !1, barSize: 8 }) : S == null || S.resetCanvasSizeAndUpdateScroll(), S == null || S.scrollToViewportPos({
  5433. viewportScrollY: I - v
  5434. }), I = v) : (y = null, (H = S == null ? void 0 : S.getScrollBar()) == null || H.dispose()), r += (y == null ? void 0 : y.barSize) || 0, r > _ && (r = _), this._addBackground(g, r / i, e / o, s);
  5435. const { scaleX: M, scaleY: P } = g.getPrecisionScale();
  5436. g.transformByState({
  5437. width: r * R / i,
  5438. height: e * R / o,
  5439. scaleX: i * R,
  5440. scaleY: o * R
  5441. }), f.resize(r * R / i, e * R / o), setTimeout(() => {
  5442. p.resizeBySize(
  5443. uu(r, M),
  5444. uu(I, P)
  5445. ), a == null || a();
  5446. }, 0);
  5447. const E = this._layoutService.getContentElement().getBoundingClientRect(), T = u.getBoundingClientRect();
  5448. h = h * R + (T.left - E.left), m = m * R + (T.top - E.top);
  5449. const A = t.endX - t.startX;
  5450. l === wt.RIGHT ? h += (A - r) * R : l === wt.CENTER && (h += (A - r * R) / 2), this._cellEditorManagerService.setState({
  5451. startX: h,
  5452. startY: m,
  5453. endX: r * R + h,
  5454. endY: I * R + m,
  5455. show: !0
  5456. });
  5457. }
  5458. /**
  5459. * Since the document does not support cell background color, an additional rect needs to be added.
  5460. */
  5461. _addBackground(r, e, t, n) {
  5462. const s = "_backgroundRectHelperColor_", i = r.getObject(s);
  5463. i == null && n == null || (i == null ? r.addObjects(
  5464. [
  5465. new ge(s, {
  5466. width: e,
  5467. height: t,
  5468. fill: n,
  5469. evented: !1
  5470. })
  5471. ],
  5472. pp
  5473. ) : n == null ? i.dispose() : (i.setProps({
  5474. fill: n
  5475. }), i.transformByState({
  5476. width: e,
  5477. height: t
  5478. })));
  5479. }
  5480. resizeCellEditor(r) {
  5481. var R;
  5482. const e = this._cellEditorManagerService.getState();
  5483. if (!e || !this._editorBridgeService.isVisible().visible) return;
  5484. this._editorBridgeService.refreshEditCellPosition(!0);
  5485. const t = this._editorBridgeService.getEditCellState();
  5486. if (!t) return;
  5487. const n = (R = this._sheetSkeletonManagerService.getWorksheetSkeleton(t.sheetId)) == null ? void 0 : R.skeleton;
  5488. if (!n) return;
  5489. const { row: s, column: i, scaleX: o, scaleY: l, position: a, canvasOffset: c, documentLayoutObject: d } = t, { horizontalAlign: u } = d, h = this._getEditorMaxSize(a, c, u);
  5490. if (!h) return;
  5491. const { height: m, width: f, scaleAdjust: g } = h, p = n.getCellWithCoordByIndex(s, i), S = Math.min((p.mergeInfo.endY - p.mergeInfo.startY) * l, m) * g, b = Math.min((p.mergeInfo.endX - p.mergeInfo.startX) * o, f) * g, v = e.endY - e.startY, _ = e.endX - e.startX;
  5492. if (v !== S || _ !== b) {
  5493. if (this._editorBridgeService.refreshEditCellPosition(!0), !this._getEditorSkeleton())
  5494. return;
  5495. this.fitTextSize(r);
  5496. }
  5497. }
  5498. _getEditorObject() {
  5499. return Ed(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
  5500. }
  5501. _getEditorSkeleton() {
  5502. var r;
  5503. return (r = this._renderManagerService.getRenderById(Le)) == null ? void 0 : r.with(Jn).getSkeleton();
  5504. }
  5505. };
  5506. Do = o1([
  5507. Wr(1, _l),
  5508. Wr(2, Fl),
  5509. Wr(3, tt),
  5510. Wr(4, Ce),
  5511. Wr(5, D(me)),
  5512. Wr(6, L)
  5513. ], Do);
  5514. function kd(r) {
  5515. return r.getContextValue(Tt);
  5516. }
  5517. function De(r) {
  5518. return r.getContextValue(Tt) && r.getContextValue(Tr) && !r.getContextValue(Je) && !r.getContextValue(Cl);
  5519. }
  5520. function cf(r) {
  5521. return r.getContextValue(Tt) && r.getContextValue(Tr) && !r.getContextValue(Je) && !r.getContextValue(Ht) && !r.getContextValue(Cl);
  5522. }
  5523. function l1(r) {
  5524. return r.getContextValue(Tt) && r.getContextValue(Tr) && r.getContextValue(Je);
  5525. }
  5526. function a1(r) {
  5527. return r.getContextValue(Tr) && r.getContextValue(Je);
  5528. }
  5529. function df(r) {
  5530. return r.getContextValue(Ht) && r.getContextValue(Tr);
  5531. }
  5532. function rE(r) {
  5533. return r.getContextValue(Tt) && r.getContextValue(Je) && r.getContextValue(_o) && r.getContextValue(Tr);
  5534. }
  5535. function ci(r) {
  5536. return r.getContextValue(Tt) && r.getContextValue(Tr) && r.getContextValue(Je) && !r.getContextValue(_o) && !r.getContextValue(Sl);
  5537. }
  5538. const uf = [
  5539. Z.ARROW_DOWN,
  5540. Z.ARROW_UP,
  5541. Z.ARROW_LEFT,
  5542. Z.ARROW_RIGHT
  5543. ], c1 = [Z.ENTER, Z.TAB, ...uf];
  5544. function hf() {
  5545. const r = [];
  5546. for (const e of uf)
  5547. r.push({
  5548. id: cs.id,
  5549. binding: e,
  5550. preconditions: (t) => ci(t),
  5551. staticParameters: {
  5552. visible: !1,
  5553. eventType: Xe.Keyboard,
  5554. keycode: e,
  5555. isShift: !1
  5556. }
  5557. }), r.push({
  5558. id: cs.id,
  5559. binding: e | ye.SHIFT,
  5560. preconditions: (t) => ci(t),
  5561. staticParameters: {
  5562. visible: !1,
  5563. eventType: Xe.Keyboard,
  5564. keycode: e,
  5565. isShift: !0
  5566. }
  5567. });
  5568. return r;
  5569. }
  5570. const mf = {
  5571. id: Wl.id,
  5572. binding: Z.F2,
  5573. description: "shortcut.sheet.start-editing",
  5574. group: "4_sheet-edit",
  5575. preconditions: De,
  5576. staticParameters: {
  5577. visible: !0,
  5578. eventType: Xe.Keyboard,
  5579. keycode: Z.F2
  5580. }
  5581. }, ff = {
  5582. id: Et.id,
  5583. binding: Z.ENTER,
  5584. description: "shortcut.sheet.toggle-editing",
  5585. group: "4_sheet-edit",
  5586. preconditions: (r) => ci(r),
  5587. staticParameters: {
  5588. visible: !1,
  5589. eventType: Xe.Keyboard,
  5590. keycode: Z.ENTER
  5591. }
  5592. }, gf = {
  5593. id: Et.id,
  5594. binding: Z.TAB,
  5595. preconditions: (r) => ci(r),
  5596. staticParameters: {
  5597. visible: !1,
  5598. eventType: Xe.Keyboard,
  5599. keycode: Z.TAB
  5600. }
  5601. }, pf = {
  5602. id: Et.id,
  5603. binding: Z.ESC,
  5604. description: "shortcut.sheet.abort-editing",
  5605. group: "4_sheet-edit",
  5606. preconditions: (r) => ci(r),
  5607. staticParameters: {
  5608. visible: !1,
  5609. eventType: Xe.Keyboard,
  5610. keycode: Z.ESC
  5611. }
  5612. }, Sf = {
  5613. id: Sp.id,
  5614. description: "shortcut.sheet.break-line",
  5615. group: "4_sheet-edit",
  5616. preconditions: (r) => l1(r),
  5617. binding: Z.ENTER | ye.ALT
  5618. }, Cf = {
  5619. id: Cp.id,
  5620. preconditions: (r) => a1(r) || df(r),
  5621. binding: Z.BACKSPACE
  5622. }, vf = {
  5623. id: Et.id,
  5624. description: "shortcut.sheet.delete-and-start-editing",
  5625. group: "4_sheet-edit",
  5626. preconditions: (r) => De(r) && !df(r),
  5627. binding: Z.BACKSPACE,
  5628. staticParameters: {
  5629. visible: !0,
  5630. eventType: Xe.Keyboard,
  5631. keycode: Z.BACKSPACE
  5632. }
  5633. };
  5634. function d1(r) {
  5635. return r.startsWith("'");
  5636. }
  5637. function u1(r) {
  5638. return r.slice(1);
  5639. }
  5640. const h1 = {
  5641. "0": "0",
  5642. "1": "1",
  5643. "2": "2",
  5644. "3": "3",
  5645. "4": "4",
  5646. "5": "5",
  5647. "6": "6",
  5648. "7": "7",
  5649. "8": "8",
  5650. "9": "9",
  5651. A: "A",
  5652. B: "B",
  5653. C: "C",
  5654. D: "D",
  5655. E: "E",
  5656. F: "F",
  5657. G: "G",
  5658. H: "H",
  5659. I: "I",
  5660. J: "J",
  5661. K: "K",
  5662. L: "L",
  5663. M: "M",
  5664. N: "N",
  5665. O: "O",
  5666. P: "P",
  5667. Q: "Q",
  5668. R: "R",
  5669. S: "S",
  5670. T: "T",
  5671. U: "U",
  5672. V: "V",
  5673. W: "W",
  5674. X: "X",
  5675. Y: "Y",
  5676. Z: "Z",
  5677. a: "a",
  5678. b: "b",
  5679. c: "c",
  5680. d: "d",
  5681. e: "e",
  5682. f: "f",
  5683. g: "g",
  5684. h: "h",
  5685. i: "i",
  5686. j: "j",
  5687. k: "k",
  5688. l: "l",
  5689. m: "m",
  5690. n: "n",
  5691. o: "o",
  5692. p: "p",
  5693. q: "q",
  5694. r: "r",
  5695. s: "s",
  5696. t: "t",
  5697. u: "u",
  5698. v: "v",
  5699. w: "w",
  5700. x: "x",
  5701. y: "y",
  5702. z: "z",
  5703. "%": "%",
  5704. "-": "-",
  5705. ".": ".",
  5706. ":": ":",
  5707. "/": "/",
  5708. "+": "+",
  5709. "@": "@",
  5710. "&": "&",
  5711. "*": "*",
  5712. "#": "#",
  5713. "=": "=",
  5714. ">": ">",
  5715. "<": "<",
  5716. "$": "$",
  5717. """: '"',
  5718. "'": "'",
  5719. "(": "(",
  5720. ")": ")",
  5721. " ": " ",
  5722. ",": ",",
  5723. "!": "!",
  5724. "?": "?",
  5725. ";": ";",
  5726. "[": "[",
  5727. "]": "]",
  5728. "{": "{",
  5729. "}": "}"
  5730. }, Pc = {
  5731. true: "TRUE",
  5732. false: "FALSE"
  5733. };
  5734. function m1(r) {
  5735. return [su.ZH_CN, su.ZH_TW].includes(r);
  5736. }
  5737. function f1(r, e, t, n) {
  5738. let s = r;
  5739. if (m1(t)) {
  5740. if (r.startsWith("'") || r.startsWith("'"))
  5741. return `'${r.slice(1)}`;
  5742. s = g1(s);
  5743. }
  5744. if (s.startsWith("="))
  5745. return p1(r, s, e, n);
  5746. const i = s.toLowerCase();
  5747. return Pc[i] ? Pc[i] : er.parseValue(s) == null ? r : s;
  5748. }
  5749. function g1(r) {
  5750. const e = /['"].*?['"]/g, t = [], n = r.split(e);
  5751. r.replace(e, (i) => (t.push(i), ""));
  5752. let s = n.join("").split("").map(v1).join("");
  5753. return t.forEach((i, o) => {
  5754. s = s.slice(0, o * 2) + i + s.slice((o + 1) * 2);
  5755. }), s;
  5756. }
  5757. function p1(r, e, t, n) {
  5758. const s = t.sequenceNodesBuilder(e);
  5759. if (!s) return r;
  5760. let i = e, o = 0;
  5761. return s.forEach((l, a) => {
  5762. if (typeof l == "object") {
  5763. const c = l.token;
  5764. if (Pc[c.toLowerCase()]) {
  5765. const d = l.startIndex + o + 1, u = l.endIndex + o + 2;
  5766. i = Br(c.toLocaleUpperCase(), i, d, u);
  5767. } else if (l.nodeType === ma.FUNCTION && S1(c, n, s, a) || l.nodeType === ma.REFERENCE) {
  5768. const d = c.indexOf("!");
  5769. if (d > -1) {
  5770. const u = c.substring(d + 1), h = l.startIndex + o + (d + 1) + 1, m = l.endIndex + o + 2;
  5771. i = Br(u.toLocaleUpperCase(), i, h, m);
  5772. } else {
  5773. const u = l.startIndex + o + 1, h = l.endIndex + o + 2;
  5774. i = Br(c.toLocaleUpperCase(), i, u, h);
  5775. }
  5776. } else if (c.startsWith('"') && c.endsWith('"') || c.startsWith("'") && c.endsWith("'")) {
  5777. const d = l.startIndex + o + 2, u = l.endIndex + o + 1;
  5778. i = Br(r.slice(d, u), i, d, u);
  5779. } else if (l.nodeType !== ma.ARRAY) {
  5780. const d = er.parseValue(c);
  5781. if (d == null) {
  5782. const u = l.startIndex + o + 1, h = l.endIndex + o + 2;
  5783. i = Br(r.slice(u, h), i, u, h);
  5784. } else if (typeof d.v == "number" && (d.z === void 0 || !er.isDate(d.z))) {
  5785. const u = `${d.v}`, h = l.startIndex + o + 1, m = l.endIndex + o + 2, { processedString: f, offset: g } = b1(c, u);
  5786. i = Br(f, i, h, m), o += g;
  5787. }
  5788. }
  5789. }
  5790. }), i;
  5791. }
  5792. function S1(r, e, t, n) {
  5793. const s = e.getDescriptions();
  5794. return t[n + 1] !== Vm.OPEN_BRACKET ? !1 : s.get(C1(r).toLocaleUpperCase()) !== void 0;
  5795. }
  5796. function C1(r) {
  5797. const e = /^@+/;
  5798. return r.replace(e, "");
  5799. }
  5800. function v1(r) {
  5801. return h1[r] || r;
  5802. }
  5803. function Br(r, e, t, n) {
  5804. return e.substring(0, t) + r + e.substring(n);
  5805. }
  5806. function b1(r, e) {
  5807. var o, l;
  5808. const t = ((o = r.match(/^\s*/)) == null ? void 0 : o[0]) || "", n = ((l = r.match(/\s*$/)) == null ? void 0 : l[0]) || "", s = t + e + n, i = s.length - r.length;
  5809. return { processedString: s, offset: i };
  5810. }
  5811. const _1 = "range_selector", w1 = (r) => r.includes(_1);
  5812. var R1 = Object.defineProperty, I1 = Object.getOwnPropertyDescriptor, y1 = (r, e, t, n) => {
  5813. for (var s = n > 1 ? void 0 : n ? I1(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  5814. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  5815. return n && s && R1(e, t, s), s;
  5816. }, Rt = (r, e) => (t, n) => e(t, n, r);
  5817. const Wu = -1e3;
  5818. let Ec = class extends ce {
  5819. constructor(e, t, n, s, i, o, l, a, c, d, u, h, m, f, g, p) {
  5820. super();
  5821. /**
  5822. * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
  5823. */
  5824. w(this, "_cursorChange", 0);
  5825. /** If the corresponding unit is active and prepared for editing. */
  5826. w(this, "_isUnitEditing", !1);
  5827. w(this, "_workbookSelections");
  5828. w(this, "_d");
  5829. w(this, "_cursorTimeout");
  5830. this._context = e, this._undoRedoService = n, this._contextService = s, this._renderManagerService = i, this._editorBridgeService = o, this._cellEditorManagerService = l, this._lexerTreeBuilder = a, this._functionService = c, this._textSelectionManagerService = d, this._commandService = u, this._localService = h, this._editorService = m, this._sheetCellEditorResizeService = f, this._univerInstanceService = g, this._sheetInterceptorService = p, this._workbookSelections = t.getWorkbookSelections(this._context.unitId), this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(O.UNIVER_SHEET).subscribe((S) => {
  5831. (S == null ? void 0 : S.getUnitId()) === this._context.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
  5832. visible: !1,
  5833. eventType: Xe.Keyboard,
  5834. keycode: Z.ESC,
  5835. unitId: this._context.unitId
  5836. }), this._isUnitEditing = !1));
  5837. })), this._initEditorVisibilityListener();
  5838. }
  5839. dispose() {
  5840. super.dispose(), this._disposeCurrent();
  5841. }
  5842. _disposeCurrent() {
  5843. var e;
  5844. (e = this._d) == null || e.dispose(), this._d = null;
  5845. }
  5846. _init() {
  5847. const e = new St();
  5848. return this._subscribeToCurrentCell(e), this._initialCursorSync(e), this._listenEditorFocus(e), this._commandExecutedListener(e), this._initSkeletonListener(e), this.disposeWithMe(this._univerInstanceService.unitDisposed$.subscribe((t) => {
  5849. clearTimeout(this._cursorTimeout);
  5850. })), this._cursorTimeout = setTimeout(() => {
  5851. this._cursorStateListener(e);
  5852. }, 1e3), e;
  5853. }
  5854. _initEditorVisibilityListener() {
  5855. this.disposeWithMe(
  5856. this._editorBridgeService.visible$.pipe(cn((e, t) => e.visible === t.visible)).subscribe((e) => {
  5857. (e.unitId === Te || e.unitId === this._context.unitId) && e.visible ? (this._isUnitEditing = !0, this._handleEditorVisible(e)) : this._isUnitEditing && (this._handleEditorInvisible(e), this._isUnitEditing = !1);
  5858. })
  5859. );
  5860. }
  5861. _listenEditorFocus(e) {
  5862. const t = this._getEditorObject();
  5863. t && e.add(t.document.onPointerDown$.subscribeEvent(() => {
  5864. if (this._isUnitEditing && this._editorBridgeService.isVisible()) {
  5865. const n = this._editorBridgeService.getEditCellState(), s = this._editorBridgeService.getCurrentEditorId();
  5866. if (!n || !s)
  5867. return;
  5868. this._sheetCellEditorResizeService.fitTextSize();
  5869. }
  5870. }));
  5871. }
  5872. _initialCursorSync(e) {
  5873. e.add(this._cellEditorManagerService.focus$.pipe(Ml((t) => !!t)).subscribe(() => {
  5874. var n;
  5875. const t = (n = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_DOC)) == null ? void 0 : n.with(Sr);
  5876. t && t.sync();
  5877. }));
  5878. }
  5879. _initSkeletonListener(e) {
  5880. const t = new Set(Io);
  5881. t.delete(et.id), e.add(this._commandService.onCommandExecuted((n) => {
  5882. t.has(n.id) && this._sheetCellEditorResizeService.resizeCellEditor(() => {
  5883. this._textSelectionManagerService.refreshSelection({
  5884. unitId: Le,
  5885. subUnitId: Le
  5886. });
  5887. });
  5888. }));
  5889. }
  5890. /**
  5891. * Should update current editing cell info when selection is changed.
  5892. * @param d DisposableCollection
  5893. */
  5894. _subscribeToCurrentCell(e) {
  5895. e.add(this._editorBridgeService.currentEditCellState$.subscribe((t) => {
  5896. var S, b;
  5897. if (t == null || this._editorBridgeService.isForceKeepVisible())
  5898. return;
  5899. const n = this._editorBridgeService.getEditCellState();
  5900. if (n == null)
  5901. return;
  5902. const { position: s, documentLayoutObject: i, scaleX: o, editorUnitId: l } = n;
  5903. if (this._contextService.getContextValue(Sl))
  5904. return;
  5905. const a = this._getDocumentDataModel();
  5906. if (a == null) return;
  5907. const { startX: c, endX: d } = s, { textRotation: u, wrapStrategy: h, documentModel: m } = i, { vertexAngle: f } = nd(u);
  5908. h === Cr.WRAP && f === 0 && a.updateDocumentDataPageSize((d - c) / o), this._commandService.syncExecuteCommand(xh.id, {
  5909. unitId: l,
  5910. snapshot: m.getSnapshot()
  5911. }), this._contextService.setContextValue(ic, !0), this._textSelectionManagerService.replaceDocRanges(
  5912. [{
  5913. startOffset: 0,
  5914. endOffset: 0
  5915. }],
  5916. {
  5917. unitId: Le,
  5918. subUnitId: Le
  5919. }
  5920. );
  5921. const g = (S = this._renderManagerService.getRenderById(Le)) == null ? void 0 : S.with(Sr), p = (b = this._renderManagerService.getRenderById(Te)) == null ? void 0 : b.with(Sr);
  5922. (g != null && g.canFocusing || p != null && p.canFocusing) && (this._univerInstanceService.setCurrentUnitForType(Le), g == null || g.activate(
  5923. Wu,
  5924. Wu,
  5925. !0
  5926. ));
  5927. }));
  5928. }
  5929. /**
  5930. * Listen to document edits to refresh the size of the sheet editor, not for normal editor.
  5931. */
  5932. _commandExecutedListener(e) {
  5933. e.add(this._commandService.onCommandExecuted((n) => {
  5934. if (n.id === Eo.id) {
  5935. const s = n.params, { unitId: i } = s;
  5936. if (!this._isCurrentSheetFocused() || w1(i) || (this._editorBridgeService.changeEditorDirty(!0), !this._editorBridgeService.isVisible().visible))
  5937. return;
  5938. i === Le && this._sheetCellEditorResizeService.fitTextSize();
  5939. }
  5940. }));
  5941. const t = [cs.id];
  5942. e.add(this._commandService.onCommandExecuted((n) => {
  5943. if (t.includes(n.id)) {
  5944. const s = n.params, { keycode: i, isShift: o } = s;
  5945. if (i != null && (this._cursorChange === 2 || this._contextService.getContextValue(Ht))) {
  5946. this._moveInEditor(i, o);
  5947. return;
  5948. }
  5949. this._editorBridgeService.changeVisible(s);
  5950. }
  5951. n.id === Wl.id && (this._cursorChange = 2);
  5952. }));
  5953. }
  5954. // You can double-click on the cell or input content by keyboard to put the cell into the edit state.
  5955. // eslint-disable-next-line complexity
  5956. _handleEditorVisible(e) {
  5957. var h, m, f;
  5958. const { eventType: t, keycode: n } = e;
  5959. this._cursorChange = t === Xe.PointerDown || t === Xe.Dblclick ? 2 : 1;
  5960. const s = this._editorBridgeService.getEditLocation();
  5961. if (s == null)
  5962. return;
  5963. this._commandService.syncExecuteCommand(lf.id, {
  5964. range: {
  5965. startRow: s.row,
  5966. startColumn: s.column,
  5967. endRow: s.row,
  5968. endColumn: s.column
  5969. }
  5970. }), this._editorBridgeService.refreshEditCellPosition(!1);
  5971. const { unitId: i, isInArrayFormulaRange: o = !1 } = s, l = this._getEditorObject();
  5972. if (l == null)
  5973. return;
  5974. const { document: a, scene: c } = l;
  5975. this._contextService.setContextValue(Je, !0);
  5976. const d = this._getDocumentDataModel(), u = this._getEditorSkeleton(Le);
  5977. if (!(!u || !d)) {
  5978. if (this._sheetCellEditorResizeService.fitTextSize(() => {
  5979. const g = c.getViewport(vo.VIEW_MAIN);
  5980. g == null || g.scrollToViewportPos({
  5981. viewportScrollX: Number.POSITIVE_INFINITY,
  5982. viewportScrollY: Number.POSITIVE_INFINITY
  5983. });
  5984. }), t === Xe.Keyboard && n === Z.F2) {
  5985. a.makeDirty(), this._textSelectionManagerService.replaceDocRanges([
  5986. {
  5987. startOffset: 0,
  5988. endOffset: 0
  5989. }
  5990. ]);
  5991. const g = ((m = (h = d.getBody()) == null ? void 0 : h.dataStream.length) != null ? m : 2) - 2;
  5992. this._textSelectionManagerService.replaceDocRanges(
  5993. [{
  5994. startOffset: g,
  5995. endOffset: g
  5996. }],
  5997. {
  5998. unitId: Le,
  5999. subUnitId: Le
  6000. }
  6001. );
  6002. } else if (
  6003. // clear and edit
  6004. t === Xe.Keyboard || t === Xe.Dblclick && o
  6005. )
  6006. this._emptyDocumentDataModel(d.getSnapshot().documentStyle, !!o), a.makeDirty(), (n === Z.BACKSPACE || t === Xe.Dblclick) && (u.calculate(), this._editorBridgeService.changeEditorDirty(!0)), this._textSelectionManagerService.replaceDocRanges(
  6007. [{
  6008. startOffset: 0,
  6009. endOffset: 0
  6010. }],
  6011. {
  6012. unitId: Le,
  6013. subUnitId: Le
  6014. }
  6015. );
  6016. else if (t === Xe.Dblclick) {
  6017. if (this._contextService.getContextValue(_o))
  6018. return;
  6019. const g = d.getBody().dataStream.length - 2 || 0;
  6020. this._textSelectionManagerService.replaceDocRanges([
  6021. {
  6022. startOffset: g,
  6023. endOffset: g
  6024. }
  6025. ]);
  6026. }
  6027. (f = this._renderManagerService.getRenderById(i)) == null || f.scene.resetCursor();
  6028. }
  6029. }
  6030. async _handleEditorInvisible(e) {
  6031. const t = this._editorBridgeService.getEditCellState(), n = this._univerInstanceService.getUnit(Le), s = se.deepClone(n == null ? void 0 : n.getSnapshot());
  6032. let { keycode: i } = e;
  6033. if (this._cursorChange = 0, this._exitInput(e), t == null)
  6034. return;
  6035. this._editorBridgeService.getEditorDirty() === !1 && (i = Z.ESC);
  6036. const a = this._context.unit.getActiveSheet(), c = this._context.unitId, d = a.getSheetId(), { unitId: u, sheetId: h } = t;
  6037. if (c === u && h !== d && await this._commandService.executeCommand(dd.id, {
  6038. subUnitId: h,
  6039. unitId: u
  6040. }), i === Z.ESC) {
  6041. this._editorBridgeService.isForceKeepVisible() && this._editorBridgeService.disableForceKeepVisible();
  6042. const m = this._workbookSelections.getCurrentSelections();
  6043. m && (this._contextService.setContextValue(Js, !1), this._commandService.syncExecuteCommand(He.id, {
  6044. unitId: this._context.unit.getUnitId(),
  6045. subUnitId: h,
  6046. selections: m
  6047. }));
  6048. return;
  6049. }
  6050. s && await this._submitCellData(s), this._moveCursor(i);
  6051. }
  6052. _getEditorObject() {
  6053. return Ed(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
  6054. }
  6055. submitCellData(e) {
  6056. return this._submitCellData(e.getSnapshot());
  6057. }
  6058. async _submitCellData(e) {
  6059. const t = this._editorBridgeService.getEditCellState();
  6060. if (t == null)
  6061. return;
  6062. const { unitId: n, sheetId: s, row: i, column: o } = t, l = this._context.unit;
  6063. let a = l.getActiveSheet();
  6064. if (!l.getSheetBySheetId(s))
  6065. return;
  6066. a = l.getActiveSheet();
  6067. const d = M1(
  6068. { ...a.getCellRaw(i, o) || {} },
  6069. e,
  6070. this._lexerTreeBuilder,
  6071. this._localService,
  6072. this._functionService,
  6073. l.getStyles()
  6074. );
  6075. if (!d)
  6076. return;
  6077. const u = await this._sheetInterceptorService.onWriteCell(l, a, i, o, d);
  6078. u !== a.getCellRaw(i, o) && this._commandService.executeCommand(Ti.id, {
  6079. subUnitId: s,
  6080. unitId: n,
  6081. range: {
  6082. startRow: i,
  6083. startColumn: o,
  6084. endRow: i,
  6085. endColumn: o
  6086. },
  6087. value: u
  6088. });
  6089. }
  6090. _exitInput(e) {
  6091. var s;
  6092. this._contextService.setContextValue(_o, !1), this._contextService.setContextValue(Je, !1), this._contextService.setContextValue(ic, !1), this._contextService.setContextValue(Ht, !1), this._cellEditorManagerService.setState({
  6093. show: e.visible
  6094. });
  6095. const t = this._getEditorObject();
  6096. (s = t == null ? void 0 : t.scene.getViewport(vo.VIEW_MAIN)) == null || s.scrollToViewportPos({
  6097. viewportScrollX: 0,
  6098. viewportScrollY: 0
  6099. });
  6100. const n = this._editorBridgeService.getCurrentEditorId();
  6101. n == null || !this._editorService.isSheetEditor(n) || (this._undoRedoService.clearUndoRedo(n), this._undoRedoService.clearUndoRedo(Te));
  6102. }
  6103. _moveCursor(e) {
  6104. if (e == null || !c1.includes(e))
  6105. return;
  6106. let t = B.LEFT;
  6107. switch (e) {
  6108. case Z.ENTER:
  6109. t = B.DOWN;
  6110. break;
  6111. case Z.TAB:
  6112. t = B.RIGHT;
  6113. break;
  6114. case Z.ARROW_DOWN:
  6115. t = B.DOWN;
  6116. break;
  6117. case Z.ARROW_UP:
  6118. t = B.UP;
  6119. break;
  6120. case Z.ARROW_LEFT:
  6121. t = B.LEFT;
  6122. break;
  6123. case Z.ARROW_RIGHT:
  6124. t = B.RIGHT;
  6125. break;
  6126. }
  6127. e === Z.ENTER || e === Z.TAB ? this._commandService.executeCommand(Fn.id, {
  6128. keycode: e,
  6129. direction: t
  6130. }) : this._commandService.executeCommand(Lt.id, {
  6131. direction: t
  6132. });
  6133. }
  6134. /**
  6135. * The user's operations follow the sequence of opening the editor and then moving the cursor.
  6136. * The logic here predicts the user's first cursor movement behavior based on this rule
  6137. */
  6138. _cursorStateListener(e) {
  6139. const t = this._getEditorObject();
  6140. if (!(t != null && t.document)) return;
  6141. const { document: n } = t;
  6142. e.add(Ae(n.onPointerDown$.subscribeEvent(() => {
  6143. this._cursorChange === 1 && (this._cursorChange = 2);
  6144. })));
  6145. }
  6146. // TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
  6147. _moveInEditor(e, t) {
  6148. let n = B.LEFT;
  6149. e === Z.ARROW_DOWN ? n = B.DOWN : e === Z.ARROW_UP ? n = B.UP : e === Z.ARROW_RIGHT && (n = B.RIGHT), t ? this._commandService.executeCommand(vp.id, {
  6150. direction: n
  6151. }) : this._commandService.executeCommand(bp.id, {
  6152. direction: n
  6153. });
  6154. }
  6155. _getDocumentDataModel() {
  6156. return this._univerInstanceService.getUnit(Le, O.UNIVER_DOC);
  6157. }
  6158. // WTF: this is should not exist at all. It is because all editor instances reuse the singleton
  6159. // "DocSelectionManagerService" and other modules. Which will be refactored soon in August, 2024.
  6160. _isCurrentSheetFocused() {
  6161. var e;
  6162. return ((e = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : e.getUnitId()) === this._context.unitId;
  6163. }
  6164. _getEditorSkeleton(e) {
  6165. var t;
  6166. return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(Jn).getSkeleton();
  6167. }
  6168. _getEditorViewModel(e) {
  6169. var t;
  6170. return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(Jn).getViewModel();
  6171. }
  6172. _emptyDocumentDataModel(e, t) {
  6173. const n = (o, l) => {
  6174. const a = se.deepClone(o.getSnapshot()), c = this._getEditorViewModel(o.getUnitId());
  6175. c != null && (P1(a.body, t), l && (a.documentStyle = e), a.drawings = {}, a.drawingsOrder = [], o.reset(a), c.reset(o));
  6176. }, s = this._getDocumentDataModel();
  6177. s && n(s, !0);
  6178. const i = this._univerInstanceService.getUnit(Te, O.UNIVER_DOC);
  6179. i && n(i);
  6180. }
  6181. };
  6182. Ec = y1([
  6183. Rt(1, D($)),
  6184. Rt(2, Zt),
  6185. Rt(3, Ne),
  6186. Rt(4, Ce),
  6187. Rt(5, tt),
  6188. Rt(6, Fl),
  6189. Rt(7, D(km)),
  6190. Rt(8, Dm),
  6191. Rt(9, D(yd)),
  6192. Rt(10, F),
  6193. Rt(11, D(Ee)),
  6194. Rt(12, Ss),
  6195. Rt(13, D(Do)),
  6196. Rt(14, L),
  6197. Rt(15, D(Ln))
  6198. ], Ec);
  6199. function M1(r, e, t, n, s, i) {
  6200. var u, h, m;
  6201. if ((e == null ? void 0 : e.body) == null)
  6202. return null;
  6203. const { body: o } = e;
  6204. r.t = void 0;
  6205. const l = o.dataStream;
  6206. let c = l.substring(l.length - 2, l.length) === kh ? l.substring(0, l.length - 2) : l;
  6207. const d = n.getCurrentLocale();
  6208. if (c = f1(c, t, d, s), (u = e.drawingsOrder) != null && u.length)
  6209. r.v = "", r.f = null, r.si = null, r.p = e, r.t = ln.STRING;
  6210. else if (r.s && ((m = (h = i == null ? void 0 : i.get(r.s)) == null ? void 0 : h.n) == null ? void 0 : m.pattern) === TC) {
  6211. r.v = c, r.f = null, r.si = null, r.p = null, r.t = ln.STRING, Tc(o) && o.dataStream !== `\r
  6212. ` && (r.p = e);
  6213. const f = Bu(e);
  6214. f && (r.s = f);
  6215. } else if (Kc(c)) {
  6216. if (r.f === c)
  6217. return null;
  6218. const f = t.checkIfAddBracket(c);
  6219. for (let g = 0; g < f; g++)
  6220. c += Vm.CLOSE_BRACKET;
  6221. r.f = c, r.si = null, r.v = null, r.p = null;
  6222. } else if (d1(c)) {
  6223. const f = u1(c);
  6224. r.v = f, r.f = null, r.si = null, r.p = null, r.t = ln.FORCE_STRING;
  6225. } else if (Tc(o))
  6226. o.dataStream === `\r
  6227. ` ? (r.v = "", r.f = null, r.si = null, r.p = null) : (r.p = e, r.v = null, r.f = null, r.si = null);
  6228. else {
  6229. if (c === "" && r.v == null && r.p == null)
  6230. return null;
  6231. r.v = c, r.f = null, r.si = null, r.p = null;
  6232. const f = Bu(e);
  6233. f && (r.s = f);
  6234. }
  6235. return r;
  6236. }
  6237. function Tc(r) {
  6238. const { textRuns: e = [], paragraphs: t = [], customRanges: n, customBlocks: s = [] } = r, i = r.dataStream.replace(/(\r\n)+$/, ""), o = ["va"];
  6239. return (
  6240. // This is because after editing, an inexplicable second paragraph style will appear \r\n
  6241. e.filter((l) => l.st < i.length).some((l) => {
  6242. var c;
  6243. return !!(l.ts && Object.keys(l.ts).some((d) => o.includes(d))) || Object.keys((c = l.ts) != null ? c : {}).length && l.ed - l.st < i.length;
  6244. }) || t.some((l) => l.bullet) || t.length >= 2 || !!(n != null && n.length) || s.length > 0
  6245. );
  6246. }
  6247. function Bu(r) {
  6248. const { body: e } = r;
  6249. if (!e) return null;
  6250. const { textRuns: t = [] } = e;
  6251. let n = {};
  6252. const s = e.dataStream.replace(`\r
  6253. `, "");
  6254. return t.forEach((i) => {
  6255. const { st: o, ed: l, ts: a } = i;
  6256. l - o >= s.length && (n = { ...n, ...a });
  6257. }), Object.keys(n).length ? n : null;
  6258. }
  6259. function P1(r, e = !1) {
  6260. r.dataStream = kh, r.textRuns != null && (r.textRuns.length === 1 && !e ? (r.textRuns[0].st = 0, r.textRuns[0].ed = 1) : r.textRuns = void 0), r.paragraphs != null && (r.paragraphs = [
  6261. {
  6262. startIndex: 0
  6263. }
  6264. ]), r.sectionBreaks != null && (r.sectionBreaks = void 0), r.tables != null && (r.tables = void 0), r.customRanges != null && (r.customRanges = void 0), r.customBlocks != null && (r.customBlocks = void 0);
  6265. }
  6266. var E1 = Object.defineProperty, T1 = Object.getOwnPropertyDescriptor, x1 = (r, e, t, n) => {
  6267. for (var s = n > 1 ? void 0 : n ? T1(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  6268. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  6269. return n && s && E1(e, t, s), s;
  6270. }, Sa = (r, e) => (t, n) => e(t, n, r);
  6271. const Fu = $m.MARK_SELECTION, ws = gn("univer.mark-selection-service");
  6272. let Lo = class extends ce {
  6273. constructor(e, t, n) {
  6274. super();
  6275. w(this, "_shapeMap", /* @__PURE__ */ new Map());
  6276. this._currentService = e, this._renderManagerService = t, this._themeService = n;
  6277. }
  6278. addShape(e, t = [], n = Fu) {
  6279. var a;
  6280. const s = this._currentService.getCurrentUnitForType(O.UNIVER_SHEET), i = (a = s.getActiveSheet()) == null ? void 0 : a.getSheetId();
  6281. if (!i) return null;
  6282. const o = se.generateRandomId(), l = {
  6283. selection: e,
  6284. subUnitId: i,
  6285. unitId: s.getUnitId(),
  6286. zIndex: n,
  6287. control: null,
  6288. exits: t
  6289. };
  6290. return this._shapeMap.set(o, l), this.refreshShapes(), o;
  6291. }
  6292. addShapeWithNoFresh(e, t = [], n = Fu) {
  6293. var l;
  6294. const s = this._currentService.getCurrentUnitForType(O.UNIVER_SHEET), i = (l = s.getActiveSheet()) == null ? void 0 : l.getSheetId();
  6295. if (!i) return null;
  6296. const o = se.generateRandomId();
  6297. return this._shapeMap.set(o, {
  6298. selection: e,
  6299. subUnitId: i,
  6300. unitId: s.getUnitId(),
  6301. zIndex: n,
  6302. control: null,
  6303. exits: t
  6304. }), o;
  6305. }
  6306. refreshShapes() {
  6307. var s;
  6308. const e = this._currentService.getCurrentUnitForType(O.UNIVER_SHEET);
  6309. if (!e) return;
  6310. const t = e.getUnitId(), n = (s = e.getActiveSheet()) == null ? void 0 : s.getSheetId();
  6311. this._shapeMap.forEach((i) => {
  6312. var b;
  6313. const { unitId: o, subUnitId: l, selection: a, control: c, zIndex: d } = i;
  6314. if (c == null || c.dispose(), o !== t || l !== n)
  6315. return;
  6316. const u = this._renderManagerService.getRenderById(o);
  6317. if (!u) return;
  6318. const h = (b = this._renderManagerService.withCurrentTypeOfUnit(O.UNIVER_SHEET, me)) == null ? void 0 : b.getCurrentSkeleton();
  6319. if (!h) return;
  6320. const { scene: m } = u, { rowHeaderWidth: f, columnHeaderHeight: g } = h, p = new xd(m, d, this._themeService, {
  6321. enableAutoFill: !1,
  6322. highlightHeader: !1,
  6323. rowHeaderWidth: f,
  6324. columnHeaderHeight: g
  6325. }), S = Pt(a, h);
  6326. p.updateRangeBySelectionWithCoord(S), i.control = p;
  6327. });
  6328. }
  6329. getShapeMap() {
  6330. return this._shapeMap;
  6331. }
  6332. removeShape(e) {
  6333. const t = this._shapeMap.get(e);
  6334. if (!t) return;
  6335. const { control: n } = t;
  6336. n == null || n.dispose(), this._shapeMap.delete(e);
  6337. }
  6338. removeAllShapes() {
  6339. for (const e of this._shapeMap.values()) {
  6340. const { control: t } = e;
  6341. t == null || t.dispose();
  6342. }
  6343. this._shapeMap.clear();
  6344. }
  6345. };
  6346. Lo = x1([
  6347. Sa(0, L),
  6348. Sa(1, Ce),
  6349. Sa(2, D(kt))
  6350. ], Lo);
  6351. function bf(r) {
  6352. return {
  6353. strokeWidth: 1.5,
  6354. stroke: r.getCurrentTheme().primaryColor,
  6355. fill: "rgba(178, 178, 178, 0.10)",
  6356. widgets: {},
  6357. strokeDash: 8
  6358. };
  6359. }
  6360. const O1 = 10, A1 = 6;
  6361. function N1() {
  6362. return se.generateRandomId(A1);
  6363. }
  6364. function H1(r) {
  6365. const e = r.match(/data-copy-id="([^\s]+)"/);
  6366. return e && e[1] ? e[1] : null;
  6367. }
  6368. class V1 {
  6369. constructor() {
  6370. w(this, "_cache", new Dp(O1));
  6371. }
  6372. set(e, t) {
  6373. this._cache.set(e, t);
  6374. }
  6375. get(e) {
  6376. return this._cache.get(e);
  6377. }
  6378. del(e) {
  6379. this._cache.delete(e);
  6380. }
  6381. clear() {
  6382. this._cache.clear();
  6383. }
  6384. clearWithUnitId(e) {
  6385. this._cache.forEach((t, n) => {
  6386. t.unitId === e && this._cache.delete(n);
  6387. });
  6388. }
  6389. }
  6390. function Wo(r, e) {
  6391. const t = e != null ? e : r.style, n = {}, s = r.tagName.toLowerCase();
  6392. switch (s) {
  6393. case "b":
  6394. case "em":
  6395. case "strong": {
  6396. n.bl = Qe.TRUE;
  6397. break;
  6398. }
  6399. case "s": {
  6400. n.st = {
  6401. s: Qe.TRUE
  6402. };
  6403. break;
  6404. }
  6405. case "u": {
  6406. n.ul = {
  6407. s: Qe.TRUE
  6408. };
  6409. break;
  6410. }
  6411. case "i": {
  6412. n.it = Qe.TRUE;
  6413. break;
  6414. }
  6415. case "sub":
  6416. case "sup": {
  6417. n.va = s === "sup" ? iu.SUPERSCRIPT : iu.SUBSCRIPT;
  6418. break;
  6419. }
  6420. }
  6421. return k1(t, n), n;
  6422. }
  6423. function k1(r, e) {
  6424. if (r instanceof CSSStyleDeclaration)
  6425. for (let t = 0; t < r.length; t++) {
  6426. const n = r[t], s = r.getPropertyValue(n);
  6427. Uu(n, s, e);
  6428. }
  6429. else
  6430. for (const t in r) {
  6431. const n = r[t];
  6432. Uu(t, n, e);
  6433. }
  6434. }
  6435. function Uu(r, e, t) {
  6436. switch (r) {
  6437. case "font-family":
  6438. t.ff = e;
  6439. break;
  6440. case "font-size": {
  6441. const n = Number.parseInt(e);
  6442. Number.isNaN(n) || (e.endsWith("pt") ? t.fs = n : e.endsWith("px") && (t.fs = n * 0.75));
  6443. break;
  6444. }
  6445. case "font-style":
  6446. e === "italic" && (t.it = Qe.TRUE);
  6447. break;
  6448. case "font-weight": {
  6449. (Number(e) > 400 || e === "bold") && (t.bl = Qe.TRUE);
  6450. break;
  6451. }
  6452. case "text-decoration": {
  6453. /underline/.test(e) ? t.ul = { s: Qe.TRUE } : /overline/.test(e) ? t.ol = { s: Qe.TRUE } : /line-through/.test(e) && (t.st = { s: Qe.TRUE });
  6454. break;
  6455. }
  6456. case "color": {
  6457. try {
  6458. const n = new Tn(e);
  6459. n.isValid && (t.cl = {
  6460. rgb: n.toRgbString()
  6461. });
  6462. } catch {
  6463. }
  6464. break;
  6465. }
  6466. case "background-color": {
  6467. const n = new Tn(e), s = n.isValid ? n.toRgbString() : "";
  6468. s !== uS && s !== hS && (t.bg = { rgb: s });
  6469. break;
  6470. }
  6471. }
  6472. }
  6473. function D1(r) {
  6474. const e = document.createElement("body");
  6475. return e.innerHTML = r, e;
  6476. }
  6477. function _f(r) {
  6478. const e = r.style, t = {};
  6479. for (let n = 0; n < e.length; n++) {
  6480. const s = e[n], i = e.getPropertyValue(s);
  6481. switch (s) {
  6482. case "margin-top": {
  6483. const o = Number.parseInt(i);
  6484. t.spaceAbove = { v: /pt/.test(i) ? hu(o) : o };
  6485. break;
  6486. }
  6487. case "margin-bottom": {
  6488. const o = Number.parseInt(i);
  6489. t.spaceBelow = { v: /pt/.test(i) ? hu(o) : o };
  6490. break;
  6491. }
  6492. case "line-height": {
  6493. const o = Number.parseFloat(i);
  6494. t.lineSpacing = o;
  6495. break;
  6496. }
  6497. }
  6498. }
  6499. return Object.getOwnPropertyNames(t).length ? t : null;
  6500. }
  6501. function Ca(r, e) {
  6502. const t = [];
  6503. for (let n = 0, s = r.length; n < s; n++)
  6504. r[n] === Lp.PARAGRAPH && t.push({
  6505. startIndex: n
  6506. });
  6507. return t;
  6508. }
  6509. function ju(r, e, t) {
  6510. var o, l, a;
  6511. const n = e.length, i = ((o = t == null ? void 0 : t.length) != null ? o : 0) === 1 && t[0].st === 0 && t[0].ed === n;
  6512. return r.p ? i && ((a = (l = r.p.body) == null ? void 0 : l.textRuns) != null && a.length) ? (r.p.body.textRuns = [], {
  6513. ...r,
  6514. s: t[0].ts
  6515. }) : r : i ? {
  6516. ...r,
  6517. s: t[0].ts
  6518. } : r;
  6519. }
  6520. const Xu = [
  6521. // Rich Text Style Rules,
  6522. "color",
  6523. "background",
  6524. "font-size",
  6525. "text-align",
  6526. "vertical-align",
  6527. "font-weight",
  6528. "font-style",
  6529. "font-family",
  6530. "text-decoration",
  6531. "white-space",
  6532. "word-wrap",
  6533. // Border Style Rules,
  6534. "border-left",
  6535. "border-right",
  6536. "border-top",
  6537. "border-bottom",
  6538. // Custom Style Rules, '--' needs to be used as a prefix.
  6539. "--data-rotate"
  6540. ];
  6541. function zu(r, e) {
  6542. const t = r.tagName.toLowerCase();
  6543. return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(r);
  6544. }
  6545. const gl = class gl {
  6546. constructor(e) {
  6547. w(this, "_styleMap", /* @__PURE__ */ new Map());
  6548. w(this, "_styleCache", /* @__PURE__ */ new Map());
  6549. w(this, "_styleRules", []);
  6550. w(this, "_afterProcessRules", []);
  6551. w(this, "_dom", null);
  6552. w(this, "_getCurrentSkeleton");
  6553. this._getCurrentSkeleton = e.getCurrentSkeleton;
  6554. }
  6555. static use(e) {
  6556. if (this._pluginList.includes(e))
  6557. throw new Error(`Univer paste plugin ${e.name} already added`);
  6558. this._pluginList.push(e);
  6559. }
  6560. // eslint-disable-next-line max-lines-per-function
  6561. convert(e) {
  6562. const t = gl._pluginList.find((g) => g.checkPasteType(e));
  6563. t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]);
  6564. const n = new Ke();
  6565. this._dom = D1(e);
  6566. const s = this._dom.querySelector("style");
  6567. if (s) {
  6568. const g = document.createElement("div"), p = g.attachShadow({ mode: "open" });
  6569. document.body.appendChild(g), p.appendChild(s);
  6570. for (const S of s.sheet.cssRules) {
  6571. const b = S, v = b.selectorText, _ = b.style;
  6572. this._styleMap.set(v, _);
  6573. }
  6574. s.remove(), g.remove();
  6575. }
  6576. const i = {
  6577. dataStream: "",
  6578. textRuns: []
  6579. }, o = [], l = [], a = e.match(/<table\b[^>]*>([\s\S]*?)<\/table>/gi), c = [];
  6580. this.process(null, this._dom.childNodes, i, c);
  6581. const { paragraphs: d, dataStream: u, textRuns: h, payloads: m, customRanges: f } = i;
  6582. if (d) {
  6583. const g = d.map((p) => p.startIndex + 1);
  6584. g.unshift(0);
  6585. for (let p = 0; p < g.length; p++) {
  6586. let S;
  6587. if (p === g.length - 1) {
  6588. if (S = `${u.substring(g[p])}\r
  6589. `, S === `\r
  6590. `)
  6591. continue;
  6592. } else
  6593. S = `${u.substring(g[p], g[p + 1] - 1)}\r
  6594. `;
  6595. const b = [];
  6596. h == null || h.forEach((I) => {
  6597. I.st >= g[p] && I.ed <= g[p + 1] && b.push({
  6598. st: I.st - g[p],
  6599. ed: I.ed - g[p],
  6600. ts: I.ts
  6601. });
  6602. });
  6603. const v = [];
  6604. f == null || f.forEach((I) => {
  6605. I.startIndex >= g[p] && I.endIndex <= g[p + 1] && v.push({
  6606. ...I,
  6607. startIndex: I.startIndex - g[p],
  6608. endIndex: I.endIndex - g[p]
  6609. });
  6610. });
  6611. const _ = this._generateDocumentDataModelSnapshot({
  6612. body: {
  6613. dataStream: S,
  6614. textRuns: b,
  6615. paragraphs: Ca(S),
  6616. customRanges: v
  6617. }
  6618. }), R = Object.keys(n.getMatrix()).length === 0;
  6619. n.setValue(R ? 0 : n.getLength(), 0, {
  6620. v: S,
  6621. p: _
  6622. }), o.push({});
  6623. }
  6624. } else if (u) {
  6625. const g = `${u}\r
  6626. `, p = {
  6627. dataStream: g,
  6628. textRuns: h,
  6629. paragraphs: Ca(g),
  6630. payloads: m,
  6631. customRanges: f
  6632. };
  6633. if (!(f != null && f.length))
  6634. n.setValue(0, 0, ju({ v: u }, u, h));
  6635. else {
  6636. const S = this._generateDocumentDataModelSnapshot({
  6637. body: p
  6638. });
  6639. n.setValue(0, 0, ju({ v: u, p: S }, u, h));
  6640. }
  6641. o.push({});
  6642. }
  6643. return a && a.forEach((g, p) => {
  6644. const S = n.getDataRange().endRow + 1, { cellMatrix: b, rowProperties: v, colProperties: _ } = this._parseTable(g, p);
  6645. b && b.forValue((R, I, y) => {
  6646. n.setValue(S + R, I, y);
  6647. }), _ && l.push(..._), o.push(...v);
  6648. }), this.dispose(), {
  6649. rowProperties: o,
  6650. colProperties: l,
  6651. cellMatrix: n
  6652. };
  6653. }
  6654. _getStyleBySelectorText(e, t) {
  6655. var s;
  6656. const n = (s = this._styleMap.get(e)) == null ? void 0 : s.getPropertyValue(t);
  6657. return n || "";
  6658. }
  6659. _getStyle(e, t) {
  6660. const n = Yu(t), s = e.style;
  6661. let i = "";
  6662. for (let o = 0; o < Xu.length; o++) {
  6663. const l = Xu[o];
  6664. if (l === "background") {
  6665. let c = "";
  6666. e.classList.forEach((u) => {
  6667. c = this._getStyleBySelectorText(`.${u}`, "background-color") || this._getStyleBySelectorText(`.${u}`, l);
  6668. });
  6669. const d = s.getPropertyValue("background-color") || c || this._getStyleBySelectorText(`#${e.id}`, "background-color") || this._getStyleBySelectorText(`#${e.id}`, l) || this._getStyleBySelectorText(e.nodeName.toLowerCase(), l) || this._getStyleBySelectorText(e.nodeName, "background-color") || n["background-color"] || "";
  6670. d && (i += `background:${d};`);
  6671. continue;
  6672. }
  6673. if (l === "text-decoration") {
  6674. let c = "";
  6675. e.classList.forEach((u) => {
  6676. c = this._getStyleBySelectorText(`.${u}`, "text-decoration-line") || this._getStyleBySelectorText(`.${u}`, l);
  6677. });
  6678. const d = s.getPropertyValue("text-decoration-line") || s.getPropertyValue("text-decoration") || c || this._getStyleBySelectorText(`#${e.id}`, "text-decoration-line") || this._getStyleBySelectorText(`#${e.id}`, l) || this._getStyleBySelectorText(e.nodeName.toLowerCase(), l) || this._getStyleBySelectorText(e.nodeName, "text-decoration-line") || n["text-decoration-line"] || "";
  6679. d && (i += `text-decoration:${d};`);
  6680. continue;
  6681. }
  6682. let a = "";
  6683. e.classList.forEach((c) => {
  6684. a = this._getStyleBySelectorText(`.${c}`, l);
  6685. }), a = s.getPropertyValue(l) || this._getStyleBySelectorText(`#${e.id}`, l) || a || this._getStyleBySelectorText(e.nodeName.toLowerCase(), l) || n[l] || "", a && (i += `${l}:${a};`);
  6686. }
  6687. return i;
  6688. }
  6689. _parseTable(e, t) {
  6690. var l, a;
  6691. const n = new Ke(), s = (l = W1(e)) != null ? l : [], { rowProperties: i = [] } = L1(e), o = this._parseTableByHtml(this._dom, t, (a = this._getCurrentSkeleton()) == null ? void 0 : a.skeleton);
  6692. return o && o.forValue((c, d, u) => {
  6693. var f, g, p, S, b, v, _, R, I, y, M, P, E, T, A, H, x, k, U, V, N, X, Y, ie;
  6694. let h = mS(void 0, u.style);
  6695. if ((S = (p = (g = (f = u == null ? void 0 : u.richTextParma) == null ? void 0 : f.p) == null ? void 0 : g.body) == null ? void 0 : p.textRuns) != null && S.length) {
  6696. const he = (v = (b = u == null ? void 0 : u.richTextParma) == null ? void 0 : b.v) == null ? void 0 : v.length;
  6697. for (let ne = 0; ne < ((y = (I = (R = (_ = u == null ? void 0 : u.richTextParma) == null ? void 0 : _.p) == null ? void 0 : R.body) == null ? void 0 : I.textRuns) == null ? void 0 : y.length); ne++) {
  6698. const pe = (E = (P = (M = u == null ? void 0 : u.richTextParma) == null ? void 0 : M.p) == null ? void 0 : P.body) == null ? void 0 : E.textRuns[ne];
  6699. pe.st === 0 && pe.ed === he && (h = { ...pe.ts, ...h }, (H = (A = (T = u == null ? void 0 : u.richTextParma) == null ? void 0 : T.p) == null ? void 0 : A.body) == null || H.textRuns.splice(ne, 1), ne--);
  6700. }
  6701. ((V = (U = (k = (x = u == null ? void 0 : u.richTextParma) == null ? void 0 : x.p) == null ? void 0 : k.body) == null ? void 0 : U.textRuns) == null ? void 0 : V.length) === 0 && (u.content = (N = u == null ? void 0 : u.richTextParma) == null ? void 0 : N.v, delete u.richTextParma);
  6702. }
  6703. const m = (ie = (Y = (X = u == null ? void 0 : u.richTextParma) == null ? void 0 : X.p) == null ? void 0 : Y.body) != null && ie.textRuns ? {
  6704. v: u.richTextParma.v,
  6705. p: u.richTextParma.p,
  6706. s: h,
  6707. rowSpan: u.rowSpan,
  6708. colSpan: u.colSpan
  6709. } : {
  6710. v: u.content,
  6711. s: h,
  6712. rowSpan: u.rowSpan,
  6713. colSpan: u.colSpan
  6714. };
  6715. n.setValue(c, d, m);
  6716. }), {
  6717. rowProperties: i,
  6718. colProperties: s,
  6719. cellMatrix: n
  6720. };
  6721. }
  6722. _parseTableByHtml(e, t, n) {
  6723. var a, c;
  6724. const s = new Ke(), i = e.querySelectorAll("table")[t];
  6725. if (!i)
  6726. return s;
  6727. const o = this._getStyle(i, ""), l = i == null ? void 0 : i.querySelectorAll("tr");
  6728. for (let d = 0; d < l.length; d++) {
  6729. const u = l[d], h = this._getStyle(u, o), m = u.querySelectorAll("td, th");
  6730. let f = 0;
  6731. for (let g = 0; g < m.length; ) {
  6732. const p = m[g];
  6733. let S = "";
  6734. const b = Number(p.getAttribute("rowSpan")) || 1, v = Number(p.getAttribute("colSpan")) || 1;
  6735. if (S = this._getStyle(p, h), d > 0) {
  6736. const y = s.getValue(d - 1, f);
  6737. if ((a = y == null ? void 0 : y.style) != null && a.includes("border-bottom") && S.includes("border-top")) {
  6738. const M = Zu(y.style, "border-bottom");
  6739. M && fu(M.substr(M.indexOf(":") + 1)) !== "none" && (S = S.replace(/border-top:[^;]+;/, ""));
  6740. }
  6741. }
  6742. if (g > 0) {
  6743. const y = s.getValue(d, f - 1);
  6744. if ((c = y == null ? void 0 : y.style) != null && c.includes("border-right") && S.includes("border-left")) {
  6745. const M = Zu(y.style, "border-right");
  6746. M && fu(M.substr(M.indexOf(":") + 1)) !== "none" && (S = S.replace(/border-left:[^;]+;/, ""));
  6747. }
  6748. }
  6749. const { cellText: _, cellRichStyle: R } = this._getCellTextAndRichText(p, S, n), I = {
  6750. rowSpan: b,
  6751. colSpan: v,
  6752. content: _,
  6753. style: S,
  6754. richTextParma: {
  6755. p: R,
  6756. v: _
  6757. }
  6758. };
  6759. if (s.getValue(d, f)) {
  6760. f += 1;
  6761. continue;
  6762. } else
  6763. b > 1 || v > 1 ? F1(s, S, I, { colSpan: v, rowSpan: b, rowIndex: d, colIndex: g, colSetValueIndex: f }) : s.setValue(d, f, I), f += v, g++;
  6764. }
  6765. }
  6766. return s;
  6767. }
  6768. _parseCellHtml(e, t, n, s = /* @__PURE__ */ new Map(), i) {
  6769. var o;
  6770. for (const l of t)
  6771. if (l.nodeType === Node.TEXT_NODE) {
  6772. const a = (o = l.nodeValue) == null ? void 0 : o.replace(/[\r\n]/g, "");
  6773. let c;
  6774. e && s.has(e) && (c = s.get(e)), n.dataStream += a, c && Object.getOwnPropertyNames(c).length && n.textRuns.push({
  6775. st: n.dataStream.length - a.length,
  6776. ed: n.dataStream.length,
  6777. ts: c
  6778. });
  6779. } else {
  6780. if (l.nodeType === Node.COMMENT_NODE || l.nodeName === "STYLE")
  6781. continue;
  6782. if (l.nodeType === Node.ELEMENT_NODE) {
  6783. const a = this._getStyle(l, i), c = e ? s.get(e) : {}, d = Yu(a), u = Wo(l, d);
  6784. s.set(l, { ...c, ...u });
  6785. const { childNodes: h } = l;
  6786. this._parseCellHtml(l, h, n, s, a);
  6787. }
  6788. }
  6789. }
  6790. _getCellTextAndRichText(e, t, n) {
  6791. var l;
  6792. let s = "", i;
  6793. if (/<[^>]+>/.test(e.innerHTML) && n) {
  6794. const a = {
  6795. dataStream: "",
  6796. textRuns: []
  6797. };
  6798. this._parseCellHtml(null, e.childNodes, a, void 0, t);
  6799. const c = (l = n.getBlankCellDocumentModel()) == null ? void 0 : l.documentModel, d = c == null ? void 0 : c.getSnapshot(), u = `${a.dataStream}\r
  6800. `, h = {
  6801. ...d,
  6802. body: {
  6803. dataStream: u,
  6804. textRuns: a.textRuns,
  6805. paragraphs: Ca(u)
  6806. }
  6807. };
  6808. c == null || c.reset(h), i = c == null ? void 0 : c.getSnapshot(), s = a.dataStream;
  6809. } else
  6810. s = B1(e.innerHTML.replace(/[\r\n]/g, ""));
  6811. return {
  6812. cellText: s,
  6813. cellRichStyle: i
  6814. };
  6815. }
  6816. _generateDocumentDataModelSnapshot(e) {
  6817. var l;
  6818. const t = this._getCurrentSkeleton();
  6819. if (t == null)
  6820. return null;
  6821. const { skeleton: n } = t, s = (l = n.getBlankCellDocumentModel()) == null ? void 0 : l.documentModel, o = { ...s == null ? void 0 : s.getSnapshot(), ...e };
  6822. return s == null || s.reset(o), s == null ? void 0 : s.getSnapshot();
  6823. }
  6824. process(e, t, n, s) {
  6825. var i, o, l;
  6826. for (const a of t)
  6827. if (a.nodeName.toLowerCase() === "table")
  6828. s.push({
  6829. index: ((i = n == null ? void 0 : n.paragraphs) == null ? void 0 : i.length) || 0
  6830. });
  6831. else if (a.nodeType === Node.TEXT_NODE) {
  6832. if (((o = a.nodeValue) == null ? void 0 : o.trim()) === "")
  6833. continue;
  6834. const c = (l = a.nodeValue) == null ? void 0 : l.replace(/[\r\n]/g, "");
  6835. let d;
  6836. e && this._styleCache.has(e) && (d = this._styleCache.get(e));
  6837. const u = {
  6838. dataStream: "",
  6839. textRuns: []
  6840. };
  6841. n.dataStream += c, u.dataStream += c, d && Object.getOwnPropertyNames(d).length && (n.textRuns.push({
  6842. st: n.dataStream.length - c.length,
  6843. ed: n.dataStream.length,
  6844. ts: d
  6845. }), u.textRuns.push({
  6846. st: n.dataStream.length - c.length,
  6847. ed: n.dataStream.length,
  6848. ts: d
  6849. }));
  6850. } else {
  6851. if (Wp.includes(a.nodeName.toLowerCase()))
  6852. continue;
  6853. if (a.nodeName.toLowerCase() === "br")
  6854. n.paragraphs || (n.paragraphs = []), n.paragraphs.push({ startIndex: n.dataStream.length }), n.dataStream += "\r";
  6855. else if (a.nodeType === Node.ELEMENT_NODE) {
  6856. if (a.nodeName === "STYLE")
  6857. continue;
  6858. const c = a, d = this._processBeforeLink(c, { body: n }), u = e ? this._styleCache.get(e) : {}, h = this._styleRules.find(({ filter: p }) => zu(a, p)), m = h ? h.getStyle(a) : Wo(a);
  6859. this._styleCache.set(a, { ...u, ...m });
  6860. const { childNodes: f } = a;
  6861. this.process(a, f, n, s);
  6862. const g = this._afterProcessRules.find(
  6863. ({ filter: p }) => zu(a, p)
  6864. );
  6865. g && g.handler(n, a), this._processAfterLink(c, { body: n }, d);
  6866. }
  6867. }
  6868. }
  6869. _processBeforeLink(e, t) {
  6870. return t.body.dataStream.length;
  6871. }
  6872. _processAfterLink(e, t, n) {
  6873. var o, l;
  6874. const s = t.body, i = e;
  6875. i.tagName.toUpperCase() === "A" && (s.customRanges = (o = s.customRanges) != null ? o : [], s.customRanges.push({
  6876. startIndex: n,
  6877. endIndex: s.dataStream.length - 1,
  6878. rangeId: (l = i.dataset.rangeid) != null ? l : Dh(),
  6879. rangeType: $c.HYPERLINK,
  6880. properties: { url: i.href }
  6881. }));
  6882. }
  6883. dispose() {
  6884. this._dom = null, this._styleCache.clear(), this._styleMap.clear();
  6885. }
  6886. };
  6887. w(gl, "_pluginList", []);
  6888. let us = gl;
  6889. function L1(r) {
  6890. const e = /<tr([\s\S]*?)>([\s\S]*?)<\/tr>/gi, t = r.matchAll(e);
  6891. if (!t)
  6892. return {
  6893. rowProperties: [],
  6894. rowCount: 0
  6895. };
  6896. const s = Array.from(t).map((i) => wf(i[1])).map((i) => {
  6897. if (!i.height) {
  6898. const o = i.style, l = o && o.match(/height\s*:\s*(\d+(\.\d+)?)px/);
  6899. i.height = `${l ? Number.parseInt(l[1], 10) : oc}`;
  6900. }
  6901. return i;
  6902. });
  6903. return {
  6904. rowProperties: s,
  6905. rowCount: s.length
  6906. };
  6907. }
  6908. function Yu(r) {
  6909. const e = {};
  6910. return r.split(";").forEach((n) => {
  6911. const [s, i] = n.split(":");
  6912. e[s] = i;
  6913. }), e;
  6914. }
  6915. function wf(r) {
  6916. if (!r)
  6917. return {};
  6918. const e = {}, t = /([\w-]+)\s*=\s*(?:(['"])([^'"]*)\2|(\S+))/g;
  6919. let n;
  6920. for (; (n = t.exec(r)) !== null; ) {
  6921. const [, s, , i, o] = n, l = i !== void 0 ? i : o;
  6922. e[s] = l;
  6923. }
  6924. return e;
  6925. }
  6926. function W1(r) {
  6927. const e = /<colgroup([\s\S]*?)>(.*?)<\/colgroup>/, t = r.match(e), n = /<col([\s\S]*?)>/g;
  6928. let s;
  6929. if (t != null && t[2] ? s = t[2].matchAll(n) : s = r.matchAll(n), !s)
  6930. return null;
  6931. const i = Array.from(s).map((l) => wf(l[1])), o = [];
  6932. return i.forEach((l) => {
  6933. const a = Number(l.span);
  6934. if (a)
  6935. for (let c = 0; c < a; c++) {
  6936. const d = { ...l };
  6937. delete d.span, o.push(d);
  6938. }
  6939. else
  6940. o.push(l);
  6941. }), o;
  6942. }
  6943. function B1(r) {
  6944. const e = {
  6945. "&lt;": "<",
  6946. "&gt;": ">",
  6947. "&amp;": "&",
  6948. "&quot;": '"',
  6949. "&#39;": "'",
  6950. "&nbsp;": " "
  6951. };
  6952. return r.replace(/&lt;|&gt;|&amp;|&quot;|&#39;|&nbsp;|<br>/g, (t) => e[t]);
  6953. }
  6954. function Zu(r, e) {
  6955. if (!r || !e) return null;
  6956. const t = new RegExp(`(${e}\\s*:\\s*[^;]+);`, "i"), n = r.match(t);
  6957. return n ? n[1] : null;
  6958. }
  6959. function F1(r, e, t, n) {
  6960. const { rowSpan: s, colSpan: i, rowIndex: o, colSetValueIndex: l } = n;
  6961. for (let a = o; a < o + s; a++)
  6962. for (let c = l; c < l + i; c++)
  6963. a === o && c === l ? r.setValue(a, c, { ...t, style: e }) : r.setValue(a, c, { style: e });
  6964. }
  6965. const U1 = {
  6966. name: "univer-doc-paste-plugin-lark",
  6967. checkPasteType(r) {
  6968. return /lark-record-clipboard/i.test(r);
  6969. },
  6970. // TODO: @JOCS, support inline code copy from lark.
  6971. stylesRules: [
  6972. {
  6973. filter: ["s"],
  6974. getStyle(r) {
  6975. const e = Wo(r);
  6976. return {
  6977. st: {
  6978. s: Qe.TRUE
  6979. },
  6980. ...e
  6981. };
  6982. }
  6983. }
  6984. ],
  6985. afterProcessRules: [
  6986. {
  6987. filter(r) {
  6988. return r.tagName === "DIV" && /ace-line/i.test(r.className);
  6989. },
  6990. handler(r) {
  6991. r.paragraphs == null && (r.paragraphs = []), r.paragraphs.push({
  6992. startIndex: r.dataStream.length
  6993. }), r.dataStream += "\r";
  6994. }
  6995. }
  6996. ]
  6997. }, j1 = {
  6998. name: "univer-doc-paste-plugin-univer",
  6999. checkPasteType(r) {
  7000. return /UniverNormal/i.test(r);
  7001. },
  7002. stylesRules: [],
  7003. afterProcessRules: [
  7004. {
  7005. filter(r) {
  7006. return r.tagName === "P" && /UniverNormal/i.test(r.className);
  7007. },
  7008. handler(r, e) {
  7009. r.paragraphs == null && (r.paragraphs = []);
  7010. const t = {
  7011. startIndex: r.dataStream.length
  7012. }, n = _f(e);
  7013. n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
  7014. }
  7015. }
  7016. ]
  7017. }, X1 = {
  7018. name: "univer-doc-paste-plugin-word",
  7019. checkPasteType(r) {
  7020. return /word|mso/i.test(r);
  7021. },
  7022. stylesRules: [
  7023. {
  7024. filter: ["b"],
  7025. getStyle(r) {
  7026. const e = Wo(r);
  7027. return { bl: Qe.TRUE, ...e };
  7028. }
  7029. }
  7030. ],
  7031. afterProcessRules: [
  7032. {
  7033. filter(r) {
  7034. return r.tagName === "P" && /mso/i.test(r.className);
  7035. },
  7036. handler(r, e) {
  7037. r.paragraphs == null && (r.paragraphs = []);
  7038. const t = {
  7039. startIndex: r.dataStream.length
  7040. }, n = _f(e);
  7041. n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
  7042. }
  7043. }
  7044. ]
  7045. };
  7046. var gr = /* @__PURE__ */ ((r) => (r.COPY = "COPY", r.CUT = "CUT", r))(gr || {});
  7047. function z1(r, e, t, n, s) {
  7048. const i = t.map((c) => {
  7049. var d;
  7050. return (d = c.onCopyRow) == null ? void 0 : d.call(c, r);
  7051. }).filter((c) => !!c), o = Dd(i), l = Ld(o), a = e.map((c) => {
  7052. if (!s.has(`${r}-${c}`)) {
  7053. const d = n.getValue(r, c);
  7054. if (d != null && d.rowSpan && (d != null && d.colSpan))
  7055. for (let u = r; u < r + d.rowSpan; u++)
  7056. for (let h = c; h < c + d.colSpan; h++)
  7057. s.add(`${u}-${h}`);
  7058. return Y1(r, c, t, n);
  7059. }
  7060. return null;
  7061. }).filter((c) => !!c).join("");
  7062. return `<tr${l}>${a}</tr>`;
  7063. }
  7064. function Y1(r, e, t, n) {
  7065. const s = n.getValue(r, e), i = t.map((c) => {
  7066. var d;
  7067. return (d = c.onCopyCellStyle) == null ? void 0 : d.call(c, r, e, s == null ? void 0 : s.rowSpan, s == null ? void 0 : s.colSpan);
  7068. }).filter((c) => !!c), o = Dd(i), l = Ld(o), a = t.reduce((c, d) => {
  7069. var u;
  7070. return c || ((u = d.onCopyCellContent) == null ? void 0 : u.call(d, r, e)) || "";
  7071. }, "");
  7072. return `<td${l}>${a}</td>`;
  7073. }
  7074. function Z1(r, e) {
  7075. return `<colgroup>${r.map((n) => {
  7076. const s = e.map((l) => {
  7077. var a;
  7078. return (a = l.onCopyColumn) == null ? void 0 : a.call(l, n);
  7079. }).filter((l) => !!l), i = Dd(s);
  7080. return `<col ${Ld(i)}>`;
  7081. }).join("")}</colgroup>`;
  7082. }
  7083. function Dd(r) {
  7084. return r.reduce((e, t) => (Object.keys(t).forEach((s) => {
  7085. e[s] ? e[s] += `;${t[s]}` : e[s] = t[s];
  7086. }), e), {});
  7087. }
  7088. function Ld(r) {
  7089. return Object.keys(r).reduce((e, t) => (e += ` ${t}="${r[t]}"`, e), "");
  7090. }
  7091. class G1 {
  7092. convert(e, t, n) {
  7093. const { cols: s, rows: i } = t;
  7094. if (!s.length)
  7095. return "";
  7096. const o = Z1(s, n), l = [], a = /* @__PURE__ */ new Set();
  7097. return i.forEach((d) => {
  7098. l.push(z1(d, s, n, e, a));
  7099. }), `<google-sheets-html-origin><table xmlns="http://www.w3.org/1999/xhtml" cellspacing="0" cellpadding="0" dir="ltr" style="table-layout:fixed;font-size:10pt;font-family:Arial;width:0px;border-collapse:collapse;border:none">${o}
  7100. <tbody>${l.join("")}</tbody></table>`;
  7101. }
  7102. }
  7103. const sE = (r, e, t = !1) => {
  7104. const n = (u) => u.endRow - u.startRow + 1, s = (u) => u.endColumn - u.startColumn + 1, i = n(e) % n(r), o = s(e) % s(r), l = {
  7105. startRow: 0,
  7106. endRow: n(r) - 1,
  7107. startColumn: 0,
  7108. endColumn: s(r) - 1
  7109. }, a = Math.floor(n(e) / n(r)), c = Math.floor(s(e) / s(r)), d = [];
  7110. if (!i && !o)
  7111. for (let u = 1; u <= a; u++)
  7112. for (let h = 1; h <= c; h++) {
  7113. const m = n(r) * (u - 1), f = s(r) * (h - 1), g = {
  7114. startRow: m + e.startRow,
  7115. endRow: m + e.startRow,
  7116. startColumn: f + e.startColumn,
  7117. endColumn: f + e.startColumn
  7118. };
  7119. d.push({ repeatRelativeRange: l, startRange: g });
  7120. }
  7121. else if (!i && o && !t)
  7122. for (let u = 1; u <= a; u++) {
  7123. const h = n(r) * (u - 1), m = 0, f = {
  7124. startRow: h + e.startRow,
  7125. endRow: h + e.startRow,
  7126. startColumn: m + e.startColumn,
  7127. endColumn: m + e.startColumn
  7128. };
  7129. d.push({ repeatRelativeRange: l, startRange: f });
  7130. }
  7131. else if (i && !o && !t)
  7132. for (let u = 1; u <= c; u++) {
  7133. const m = s(r) * (u - 1), f = {
  7134. startRow: 0 + e.startRow,
  7135. endRow: 0 + e.startRow,
  7136. startColumn: m + e.startColumn,
  7137. endColumn: m + e.startColumn
  7138. };
  7139. d.push({ repeatRelativeRange: l, startRange: f });
  7140. }
  7141. else {
  7142. const u = {
  7143. startRow: e.startRow,
  7144. endRow: e.startRow,
  7145. startColumn: e.startColumn,
  7146. endColumn: e.startColumn
  7147. };
  7148. d.push({ startRange: u, repeatRelativeRange: l });
  7149. }
  7150. return d;
  7151. };
  7152. async function q1(r) {
  7153. return r ? /<td[^>]*class=".*?xl.*?"[^>]*>.*?<\/td>/.test(r) : !1;
  7154. }
  7155. function Q1(...r) {
  7156. if (r.length === 1)
  7157. return r[0];
  7158. const e = new Ke();
  7159. return r.forEach((t) => {
  7160. t && new Ke(t).forValue((s, i, o) => {
  7161. e.setValue(s, i, { ...e.getValue(s, i), ...o });
  7162. });
  7163. }), e.getMatrix();
  7164. }
  7165. function K1(r, e) {
  7166. return r.id === e.id && r.params.unitId === e.params.unitId && r.params.subUnitId === e.params.subUnitId;
  7167. }
  7168. function Gu(r) {
  7169. const e = [];
  7170. for (let t = 0; t < r.length; ) {
  7171. let n = 1;
  7172. if (r[t].id === Se.id) {
  7173. const s = r[t], i = [s];
  7174. for (; t + n < r.length && K1(s, r[t + n]); )
  7175. i.push(r[t + n]), n += 1;
  7176. const o = Q1(...i.map((l) => l.params.cellValue || {}));
  7177. e.push({
  7178. ...s,
  7179. params: {
  7180. ...s.params,
  7181. cellValue: o
  7182. }
  7183. });
  7184. } else
  7185. e.push(r[t]);
  7186. t += n;
  7187. }
  7188. return e;
  7189. }
  7190. function va(r, e) {
  7191. const { startRow: t, endRow: n, startColumn: s, endColumn: i } = r;
  7192. for (let o = t; o <= n; o++)
  7193. for (let l = s; l <= i; l++)
  7194. if (e.rows.includes(o) && e.cols.includes(l))
  7195. return !0;
  7196. }
  7197. function qu(r, e) {
  7198. const { startRow: t, endRow: n, startColumn: s, endColumn: i } = e;
  7199. for (let o = t; o <= n; o++)
  7200. if (!r.rows.includes(o))
  7201. return !1;
  7202. for (let o = s; o <= i; o++)
  7203. if (!r.cols.includes(o))
  7204. return !1;
  7205. return !0;
  7206. }
  7207. function J1(r) {
  7208. const e = r.trim().split(`
  7209. `);
  7210. let t = "<table>";
  7211. return e.forEach((n) => {
  7212. const s = n.split(" ");
  7213. t += "<tr>", s.forEach((i) => {
  7214. t += `<td>${i}</td>`;
  7215. }), t += "</tr>";
  7216. }), t += "</table>", t;
  7217. }
  7218. var $1 = Object.defineProperty, eb = Object.getOwnPropertyDescriptor, tb = (r, e, t, n) => {
  7219. for (var s = n > 1 ? void 0 : n ? eb(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  7220. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  7221. return n && s && $1(e, t, s), s;
  7222. }, Mt = (r, e) => (t, n) => e(t, n, r);
  7223. const rt = {
  7224. DEFAULT_COPY: "default-copy",
  7225. DEFAULT_PASTE: "default-paste",
  7226. SPECIAL_PASTE_VALUE: "special-paste-value",
  7227. SPECIAL_PASTE_FORMAT: "special-paste-format",
  7228. SPECIAL_PASTE_COL_WIDTH: "special-paste-col-width",
  7229. SPECIAL_PASTE_BESIDES_BORDER: "special-paste-besides-border",
  7230. SPECIAL_PASTE_FORMULA: "special-paste-formula"
  7231. };
  7232. us.use(X1);
  7233. us.use(U1);
  7234. us.use(j1);
  7235. const Sn = gn("sheet.clipboard-service");
  7236. let Bo = class extends ce {
  7237. constructor(e, t, n, s, i, o, l, a, c, d, u, h, m, f) {
  7238. super();
  7239. w(this, "_clipboardHooks", []);
  7240. w(this, "_clipboardHooks$", new Me([]));
  7241. w(this, "clipboardHooks$", this._clipboardHooks$.asObservable());
  7242. w(this, "_htmlToUSM");
  7243. w(this, "_usmToHtml");
  7244. w(this, "_copyContentCache");
  7245. w(this, "_copyMarkId", null);
  7246. // Record the parsed matrix and row and column attributes
  7247. w(this, "_pasteOptionsCache$", new Me(null));
  7248. w(this, "pasteOptionsCache$", this._pasteOptionsCache$.asObservable());
  7249. //Control the visibility of the Paste Options menu
  7250. w(this, "_showMenu$", new xe());
  7251. w(this, "showMenu$", this._showMenu$.asObservable());
  7252. this._logService = e, this._univerInstanceService = t, this._selectionManagerService = n, this._clipboardInterfaceService = s, this._undoRedoService = i, this._commandService = o, this._markSelectionService = l, this._notificationService = a, this._platformService = c, this._renderManagerService = d, this._themeService = u, this._localeService = h, this._errorService = m, this._injector = f, this._htmlToUSM = new us({
  7253. getCurrentSkeleton: () => {
  7254. var g;
  7255. return (g = this._renderManagerService.withCurrentTypeOfUnit(O.UNIVER_SHEET, me)) == null ? void 0 : g.getCurrent();
  7256. }
  7257. }), this._usmToHtml = new G1(), this._copyContentCache = new V1(), this.disposeWithMe(this._htmlToUSM), this._initUnitDisposed();
  7258. }
  7259. setShowMenu(e) {
  7260. this._showMenu$.next(e);
  7261. }
  7262. copyContentCache() {
  7263. return this._copyContentCache;
  7264. }
  7265. generateCopyContent(e, t, n) {
  7266. const s = this._clipboardHooks;
  7267. s.forEach((o) => {
  7268. var l;
  7269. return (l = o.onBeforeCopy) == null ? void 0 : l.call(o, e, t, n);
  7270. });
  7271. const i = this._generateCopyContent(e, t, n, s);
  7272. return s.forEach((o) => {
  7273. var l;
  7274. return (l = o.onAfterCopy) == null ? void 0 : l.call(o);
  7275. }), i;
  7276. }
  7277. async copy(e = gr.COPY) {
  7278. const t = this._selectionManagerService.getCurrentLastSelection();
  7279. if (!t)
  7280. return !1;
  7281. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), s = n.getActiveSheet();
  7282. if (!s)
  7283. return !1;
  7284. const i = this.generateCopyContent(n.getUnitId(), s.getSheetId(), t.range);
  7285. if (!i)
  7286. return !1;
  7287. const { html: o, plain: l, matrixFragment: a, copyId: c, discreteRange: d } = i;
  7288. this._copyContentCache.set(c, {
  7289. unitId: n.getUnitId(),
  7290. subUnitId: s.getSheetId(),
  7291. range: d,
  7292. matrix: a,
  7293. copyType: e
  7294. }), await this._clipboardInterfaceService.write(l, o), this._markSelectionService.removeAllShapes();
  7295. const u = bf(this._themeService);
  7296. return this._copyMarkId = this._markSelectionService.addShape({ ...t, style: u }), !0;
  7297. }
  7298. async cut() {
  7299. return this.copy(gr.CUT);
  7300. }
  7301. async paste(e, t = rt.DEFAULT_PASTE) {
  7302. const n = e.types, s = n.indexOf(gu) !== -1 ? await e.getType(gu).then((o) => o && o.text()) : "", i = n.indexOf(pu) !== -1 ? await e.getType(pu).then((o) => o && o.text()) : "";
  7303. return i ? (this._platformService.isWindows && await q1(i) && this._notificationService.show({
  7304. type: "warning",
  7305. title: this._localeService.t("clipboard.shortCutNotify.title"),
  7306. content: this._localeService.t("clipboard.shortCutNotify.useShortCutInstead")
  7307. }), this._pasteHTML(i, t)) : s ? this._pastePlainText(s, t) : (this._logService.error("[SheetClipboardService]", "No valid data on clipboard"), !1);
  7308. }
  7309. legacyPaste(e, t) {
  7310. return e ? this._pasteHTML(e, rt.DEFAULT_PASTE) : t ? /[\n\t]/.test(t) ? this._pasteHTML(J1(t), rt.DEFAULT_PASTE) : this._pastePlainText(t, rt.DEFAULT_PASTE) : Promise.resolve(!1);
  7311. }
  7312. rePasteWithPasteType(e) {
  7313. const t = this._pasteOptionsCache$.getValue();
  7314. if (!t)
  7315. return !1;
  7316. const n = this._injector.get(Zt), s = n.pitchTopUndoElement();
  7317. s && pl(s.undoMutations, this._commandService) && n.popUndoToRedo();
  7318. const { cellMatrix: i, rowProperties: o = [], colProperties: l = [], source: a, target: c } = t;
  7319. return this._pasteUSM({
  7320. cellMatrix: i,
  7321. colProperties: l,
  7322. rowProperties: o
  7323. }, c, rt[e], a), !0;
  7324. }
  7325. updatePasteOptionsCache(e) {
  7326. this._pasteOptionsCache$.next(e);
  7327. }
  7328. addClipboardHook(e) {
  7329. if (this._clipboardHooks.findIndex((n) => n.id === e.id) !== -1)
  7330. return this._logService.error("[SheetClipboardService]", "hook already exists", e.id), { dispose: () => {
  7331. } };
  7332. const t = this._clipboardHooks.findIndex((n) => {
  7333. const s = n.priority || 0;
  7334. return (e.priority || 0) < s;
  7335. });
  7336. return this._clipboardHooks.splice(t !== -1 ? t : this._clipboardHooks.length, 0, e), this._notifyClipboardHook(), Ae(() => {
  7337. const n = this._clipboardHooks.indexOf(e);
  7338. n > -1 && (this._clipboardHooks.splice(n, 1), this._notifyClipboardHook());
  7339. });
  7340. }
  7341. getClipboardHooks() {
  7342. return this._clipboardHooks;
  7343. }
  7344. _generateCopyContent(e, t, n, s) {
  7345. const i = this._univerInstanceService.getUniverSheetInstance(e), o = i == null ? void 0 : i.getSheetBySheetId(t);
  7346. if (!i || !o)
  7347. return null;
  7348. const l = s.reduce((_, R) => {
  7349. var y;
  7350. const I = (y = R.getFilteredOutRows) == null ? void 0 : y.call(R, n);
  7351. return I == null || I.forEach((M) => _.add(M)), _;
  7352. }, /* @__PURE__ */ new Set()), { startColumn: a, startRow: c, endColumn: d, endRow: u } = n, h = o.getMatrixWithMergedCells(c, a, u, d, Lh.Both), m = new Ke();
  7353. let f = c;
  7354. const g = new Ke(), p = { rows: [], cols: [] };
  7355. for (let _ = c; _ <= u; _++)
  7356. if (!l.has(_)) {
  7357. p.rows.push(_);
  7358. for (let R = a; R <= d; R++) {
  7359. const I = h.getValue(_, R);
  7360. if (I) {
  7361. const y = se.deepClone(I);
  7362. g.setValue(f - c, R - a, {
  7363. ...As(),
  7364. ...y
  7365. }), delete y.displayV, m.setValue(f - c, R - a, {
  7366. ...As(),
  7367. ...y
  7368. });
  7369. } else
  7370. g.setValue(f - c, R - a, As()), m.setValue(f - c, R - a, As()), h.setValue(_, R, As());
  7371. }
  7372. f += 1;
  7373. }
  7374. for (let _ = a; _ <= d; _++)
  7375. p.cols.push(_);
  7376. let S = this._usmToHtml.convert(h, p, s);
  7377. const b = nb(g), v = N1();
  7378. return S = S.replace(/(<[a-z]+)/, (_, R) => `${R} data-copy-id="${v}"`), {
  7379. copyId: v,
  7380. plain: b,
  7381. html: S,
  7382. matrixFragment: m,
  7383. discreteRange: p
  7384. };
  7385. }
  7386. _notifyClipboardHook() {
  7387. this._clipboardHooks$.next(this._clipboardHooks);
  7388. }
  7389. async _pastePlainText(e, t) {
  7390. const n = this._getPastingTarget();
  7391. if (!n.subUnitId || !n.selection)
  7392. return !1;
  7393. const s = this._injector.invoke((m) => Ys(n.selection.range, m, n.unitId, n.subUnitId));
  7394. if (!s)
  7395. return !1;
  7396. const { unitId: i, subUnitId: o } = n, l = this._clipboardHooks, a = [];
  7397. if (l.some(
  7398. (m) => {
  7399. var f;
  7400. return a.push(m) && ((f = m.onBeforePaste) == null ? void 0 : f.call(m, { unitId: i, subUnitId: o, range: s })) === !1;
  7401. }
  7402. ))
  7403. return a.forEach((m) => {
  7404. var f;
  7405. return (f = m.onAfterPaste) == null ? void 0 : f.call(m, !1);
  7406. }), !1;
  7407. const d = [], u = [];
  7408. a.forEach((m) => {
  7409. var g;
  7410. const f = (g = m.onPastePlainText) == null ? void 0 : g.call(
  7411. m,
  7412. {
  7413. unitId: i,
  7414. subUnitId: o,
  7415. range: s
  7416. },
  7417. e,
  7418. {
  7419. pasteType: t
  7420. }
  7421. );
  7422. f && (d.push(...f.redos), u.push(...f.undos));
  7423. });
  7424. const h = d.every((m) => this._commandService.executeCommand(m.id, m.params));
  7425. return h && this._undoRedoService.pushUndoRedo({
  7426. unitID: this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId(),
  7427. undoMutations: u,
  7428. redoMutations: d
  7429. }), h;
  7430. }
  7431. async _pasteHTML(e, t) {
  7432. const n = H1(e);
  7433. return n && this._copyContentCache.get(n) ? this._pasteInternal(n, t) : this._pasteExternal(e, t);
  7434. }
  7435. async _pasteExternal(e, t) {
  7436. var d;
  7437. const { rowProperties: n, colProperties: s, cellMatrix: i } = this._htmlToUSM.convert(e);
  7438. if (!i)
  7439. return !1;
  7440. const o = this._getPastedRange(i);
  7441. if (!o)
  7442. return !1;
  7443. const l = (d = this._univerInstanceService.getUniverSheetInstance(o.unitId)) == null ? void 0 : d.getSheetBySheetId(o.subUnitId);
  7444. if (!l)
  7445. return !1;
  7446. const a = l == null ? void 0 : l.getMergeData();
  7447. return a.length && a.some((h) => va(h, o.pastedRange) && !qu(o.pastedRange, h)) ? (this._errorService.emit(this._localeService.t("clipboard.paste.overlappingMergedCells")), !1) : this._pasteUSM(
  7448. {
  7449. rowProperties: n,
  7450. colProperties: s,
  7451. cellMatrix: i
  7452. },
  7453. o,
  7454. t
  7455. );
  7456. }
  7457. // eslint-disable-next-line max-lines-per-function, complexity
  7458. async _pasteInternal(e, t) {
  7459. var R, I;
  7460. const n = se.deepClone(this._copyContentCache.get(e)), { range: s, matrix: i, unitId: o, subUnitId: l } = n || {};
  7461. if (!i || !n || !s || !o || !l || !i || !n)
  7462. return !1;
  7463. const a = (R = this._univerInstanceService.getUniverSheetInstance(o)) == null ? void 0 : R.getStyles();
  7464. i.forValue((y, M, P) => {
  7465. if (typeof P.s == "string") {
  7466. const E = se.deepClone(P);
  7467. E.s = a == null ? void 0 : a.getStyleByCell(P), i.setValue(y, M, E);
  7468. }
  7469. if (P.colSpan || P.rowSpan)
  7470. for (let E = 0; E < P.rowSpan; E++)
  7471. for (let T = 0; T < P.colSpan; T++) {
  7472. if (E === 0 && T === 0) continue;
  7473. const A = y + E, H = M + T;
  7474. i.setValue(A, H, { s: a == null ? void 0 : a.getStyleByCell(P) });
  7475. }
  7476. });
  7477. const c = this._getPastedRange(i);
  7478. if (!c) return !1;
  7479. const d = (I = this._univerInstanceService.getUniverSheetInstance(c.unitId)) == null ? void 0 : I.getSheetBySheetId(c.subUnitId);
  7480. if (!d)
  7481. return !1;
  7482. const u = d == null ? void 0 : d.getMergeData();
  7483. if (u && u.some((M) => va(M, c.pastedRange) && !qu(c.pastedRange, M)))
  7484. return this._errorService.emit(this._localeService.t("clipboard.paste.overlappingMergedCells")), !1;
  7485. const h = this._univerInstanceService.getUnit(o);
  7486. if (!h) return !1;
  7487. const m = h.getSheetBySheetId(l);
  7488. if (!m) return !1;
  7489. const f = m.getColumnManager(), g = m.getRowManager(), p = m.getConfig().defaultColumnWidth, S = m.getConfig().defaultRowHeight, b = [], v = [];
  7490. if (s.cols.forEach((y) => {
  7491. const M = f.getColumnOrCreate(y);
  7492. b.push({ width: `${M.w || p}` });
  7493. }), s.rows.forEach((y) => {
  7494. const M = g.getRowOrCreate(y), { ah: P = S, h: E = S } = M, T = Math.max(P, E);
  7495. v.push({ height: `${T}` });
  7496. }), n.copyType === gr.CUT) {
  7497. const y = c.pastedRange.rows[0], M = s.rows[s.rows.length - 1] - s.rows[0] + y;
  7498. c.pastedRange.rows = Array.from(new Array(M + 1).keys()).slice(y);
  7499. }
  7500. const _ = this._pasteUSM(
  7501. {
  7502. cellMatrix: i,
  7503. colProperties: b,
  7504. rowProperties: v
  7505. },
  7506. // paste data
  7507. c,
  7508. t,
  7509. {
  7510. range: s,
  7511. // paste source
  7512. unitId: n.unitId,
  7513. subUnitId: n.subUnitId,
  7514. copyType: n.copyType,
  7515. copyId: e
  7516. }
  7517. );
  7518. return n.copyType === gr.CUT && (this._copyContentCache.set(e, { ...n, matrix: null }), this._copyMarkId && this._markSelectionService.removeShape(this._copyMarkId), this._copyMarkId = null), _;
  7519. }
  7520. // eslint-disable-next-line max-lines-per-function
  7521. _pasteUSM(e, t, n, s) {
  7522. const { rowProperties: i, colProperties: o, cellMatrix: l } = e, { unitId: a, subUnitId: c, pastedRange: d } = t, u = d.cols.length, h = this._clipboardHooks, m = [];
  7523. if (h.some(
  7524. (I) => {
  7525. var y;
  7526. return m.push(I) && ((y = I.onBeforePaste) == null ? void 0 : y.call(I, { unitId: a, subUnitId: c, range: d })) === !1;
  7527. }
  7528. ))
  7529. return m.forEach((I) => {
  7530. var y;
  7531. return (y = I.onAfterPaste) == null ? void 0 : y.call(I, !1);
  7532. }), !1;
  7533. if (!l) return !1;
  7534. const g = s ? {
  7535. unitId: s.unitId,
  7536. subUnitId: s.subUnitId,
  7537. range: s.range
  7538. } : null, p = {
  7539. copyType: (s == null ? void 0 : s.copyType) || gr.COPY,
  7540. copyId: s == null ? void 0 : s.copyId,
  7541. pasteType: n
  7542. };
  7543. let S = [], b = [];
  7544. const v = m.filter(
  7545. (I) => !I.specialPasteInfo && I.id !== rt.DEFAULT_PASTE || n === I.id
  7546. );
  7547. v.forEach((I) => {
  7548. var P, E, T;
  7549. if (i) {
  7550. const A = (P = I.onPasteRows) == null ? void 0 : P.call(I, { range: d, unitId: a, subUnitId: c }, i, {
  7551. pasteType: n
  7552. });
  7553. A && (S.push(...A.redos), b.push(...A.undos));
  7554. }
  7555. const y = (E = I.onPasteColumns) == null ? void 0 : E.call(
  7556. I,
  7557. { range: d, unitId: a, subUnitId: c },
  7558. o || new Array(u).map(() => ({})),
  7559. { pasteType: n }
  7560. );
  7561. y && (S.push(...y.redos), b.push(...y.undos));
  7562. const M = (T = I.onPasteCells) == null ? void 0 : T.call(
  7563. I,
  7564. g,
  7565. { range: d, unitId: a, subUnitId: c },
  7566. l,
  7567. p
  7568. );
  7569. M && (S.push(...M.redos), b.push(...M.undos));
  7570. });
  7571. const _ = this._getSetSelectionOperation(a, c, d, l, n);
  7572. _ && S.push(_), S = Gu(S), b = Gu(b), b.push({ id: et.id, params: { unitId: t.unitId, subUnitId: t.subUnitId } }), this._logService.log("[SheetClipboardService]", "pasting mutations", {
  7573. undoMutationsInfo: b,
  7574. redoMutationsInfo: S
  7575. });
  7576. const R = S.every((I) => this._commandService.syncExecuteCommand(I.id, I.params));
  7577. return R && (this._undoRedoService.pushUndoRedo({
  7578. unitID: a,
  7579. undoMutations: b,
  7580. redoMutations: S
  7581. }), this.updatePasteOptionsCache({
  7582. target: {
  7583. pastedRange: d,
  7584. unitId: a,
  7585. subUnitId: c
  7586. },
  7587. cellMatrix: l,
  7588. rowProperties: i,
  7589. colProperties: o,
  7590. pasteType: n,
  7591. source: s
  7592. }), this.setShowMenu(!0)), v.forEach((I) => {
  7593. var y;
  7594. return (y = I.onAfterPaste) == null ? void 0 : y.call(I, R);
  7595. }), R;
  7596. }
  7597. _getSetSelectionOperation(e, t, n, s, i) {
  7598. var _;
  7599. const o = (_ = this._univerInstanceService.getUniverSheetInstance(e)) == null ? void 0 : _.getSheetBySheetId(t);
  7600. if (!o)
  7601. return null;
  7602. const { rows: l, cols: a } = n, c = l[0], d = a[0], u = l[l.length - 1], h = a[a.length - 1], f = rm({
  7603. startRow: c,
  7604. endRow: c,
  7605. startColumn: d,
  7606. endColumn: d
  7607. }, o), g = s.getValue(0, 0), p = (g == null ? void 0 : g.rowSpan) || 1, S = (g == null ? void 0 : g.colSpan) || 1;
  7608. if ((i === rt.DEFAULT_PASTE || i === rt.SPECIAL_PASTE_BESIDES_BORDER || i === rt.SPECIAL_PASTE_FORMAT) && (p > 1 || S > 1)) {
  7609. const R = {
  7610. startRow: c,
  7611. endRow: c + p - 1,
  7612. startColumn: d,
  7613. endColumn: d + S - 1
  7614. };
  7615. f.startRow = R.startRow, f.endRow = R.endRow, f.startColumn = R.startColumn, f.endColumn = R.endColumn, f.isMerged = !0, f.isMergedMainCell = !0;
  7616. }
  7617. const v = {
  7618. unitId: e,
  7619. subUnitId: t,
  7620. selections: [{
  7621. range: {
  7622. startRow: c,
  7623. endRow: u,
  7624. startColumn: d,
  7625. endColumn: h
  7626. },
  7627. primary: f,
  7628. style: null
  7629. }]
  7630. };
  7631. return {
  7632. id: He.id,
  7633. params: v
  7634. };
  7635. }
  7636. _getPastingTarget() {
  7637. const e = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), t = e.getActiveSheet(), n = this._selectionManagerService.getCurrentLastSelection();
  7638. return {
  7639. unitId: e.getUnitId(),
  7640. subUnitId: t == null ? void 0 : t.getSheetId(),
  7641. selection: n
  7642. };
  7643. }
  7644. /**
  7645. * Handles copying one range to another range, obtained by the following rules
  7646. *
  7647. * [Content to be assigned] => [Target range]
  7648. *
  7649. * I. There are no merged cells in the upper left corner of the pasted area
  7650. *
  7651. * 1. 1 -> 1: 1 => 1
  7652. * 2. N -> 1: N => N
  7653. * 3. 1 -> N: N => N
  7654. * 4. N1 -> N2:
  7655. * 1) N1 <N2: If N2 is a multiple of N1 (X), N1 * X => N2; If not, N1 => N1 (refer to office excel, different from google sheet)
  7656. * 2) N1> N2: N1 => N1
  7657. *
  7658. * The above four cases can be combined and processed as
  7659. *
  7660. * Case 1, 1/2/4-2 merged into N1 => N1
  7661. * Case 2, 3/4-1 merge into N1 * X => N2 or Case 1
  7662. *
  7663. * In the end we only need to judge whether N2 is a multiple of N1
  7664. *
  7665. * II. The pasted area contains merged cells
  7666. *
  7667. * 1. If N2 is a multiple of N1,
  7668. * 1) If N2 === N1, paste this area directly and the range remains unchanged.
  7669. * 2) Otherwise, determine whether other cells are included
  7670. * 1] If included, tile, the range remains unchanged
  7671. * 2] If not included, determine whether the source data is a combined cell
  7672. * 1} If yes, tile, the range remains unchanged
  7673. * 2} If not, only the content will be pasted, the original style will be discarded, and the scope will remain unchanged.
  7674. *
  7675. * 2. If N2 is not a multiple of N1, determine whether the upper left corner cell (merged or non-merged or combined) is consistent with the size of the original data.
  7676. * 1) If consistent, only paste this area;
  7677. * 2) If inconsistent, then determine whether the pasted area contains other cells.
  7678. * 1] If yes, pasting is not allowed and an error will pop up;
  7679. * 2] If not, only the content will be pasted and the original style will be discarded.
  7680. *
  7681. * @param rowCount
  7682. * @param colCount
  7683. * @param cellMatrix
  7684. * @param range
  7685. */
  7686. // eslint-disable-next-line max-lines-per-function, complexity
  7687. _transformPastedData(e, t, n) {
  7688. const s = this._getPastingTarget(), { selection: i, unitId: o, subUnitId: l } = s;
  7689. if (!l || !i)
  7690. return null;
  7691. const a = this._injector.invoke((E) => Ys(i.range, E, o, l));
  7692. if (!a)
  7693. return null;
  7694. const { ranges: [c], mapFunc: d } = _s([a]), { startRow: u, startColumn: h, endRow: m, endColumn: f } = c, g = m - u + 1, p = f - h + 1, S = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), b = S == null ? void 0 : S.getActiveSheet();
  7695. if (!b)
  7696. return null;
  7697. const _ = b.getMergeData().filter(
  7698. (E) => a.rows.includes(E.startRow) && a.cols.includes(E.startColumn)
  7699. ), R = _[0];
  7700. let I = 0, y = 0, M = 0, P = 0;
  7701. if (R && (I = R.startRow, y = R.startColumn, M = R.endRow, P = R.endColumn), g % e === 0 && p % t === 0)
  7702. if (_.length > 0 && (g !== e || p !== t))
  7703. if (I === a.rows[0] && y === a.cols[0] && M === a.rows[g - 1] && P === a.cols[p - 1])
  7704. if (ob(n))
  7705. for (let T = 0; T < g; T++)
  7706. for (let A = 0; A < p; A++) {
  7707. const H = n.getValue(T % e, A % t);
  7708. H && n.setValue(T, A, H);
  7709. }
  7710. else
  7711. n.forValue((T, A, H) => {
  7712. H.s = null, delete H.colSpan, delete H.rowSpan;
  7713. });
  7714. else
  7715. for (let E = 0; E < g; E++)
  7716. for (let T = 0; T < p; T++) {
  7717. const A = n.getValue(E % e, T % t);
  7718. A && n.setValue(E, T, A);
  7719. }
  7720. else
  7721. for (let E = 0; E < g; E++)
  7722. for (let T = 0; T < p; T++) {
  7723. const A = n.getValue(E % e, T % t);
  7724. A && n.setValue(E, T, A);
  7725. }
  7726. else if (_.length > 0) {
  7727. const { row: E, col: T } = d(u, h);
  7728. if (this._topLeftCellsMatch(e, t, {
  7729. topRow: E,
  7730. leftCol: T
  7731. })) {
  7732. const H = this._expandOrShrinkRowsCols(o, l, a, t, e);
  7733. a.rows = H.rows, a.cols = H.cols;
  7734. } else {
  7735. if (m > R.endRow || f > R.endColumn)
  7736. return null;
  7737. n.forValue((H, x, k) => {
  7738. k.s = null, delete k.colSpan, delete k.rowSpan;
  7739. });
  7740. }
  7741. } else {
  7742. const E = this._expandOrShrinkRowsCols(o, l, a, t, e);
  7743. a.rows = E.rows, a.cols = E.cols;
  7744. }
  7745. return {
  7746. pastedRange: a,
  7747. unitId: o,
  7748. subUnitId: l
  7749. };
  7750. }
  7751. _getPastedRange(e) {
  7752. var b;
  7753. const t = this._getPastingTarget(), { selection: n, unitId: s, subUnitId: i } = t;
  7754. if (!i || !n)
  7755. return null;
  7756. const o = this._injector.invoke((v) => Ys(n.range, v, s, i));
  7757. if (!o)
  7758. return null;
  7759. const { startColumn: l, endColumn: a, startRow: c, endRow: d } = e.getDataRange(), u = d - c + 1, h = a - l + 1;
  7760. if (u <= 0 || h <= 0) return null;
  7761. const m = o.rows.length, f = o.cols.length, g = (b = this._univerInstanceService.getUniverSheetInstance(s)) == null ? void 0 : b.getSheetBySheetId(i);
  7762. if (!g)
  7763. return null;
  7764. const p = g == null ? void 0 : g.getMergeData();
  7765. if (m % u === 0 && f % h === 0 && !(p == null ? void 0 : p.some((_) => va(_, o)))) {
  7766. for (let _ = 0; _ < m; _++)
  7767. for (let R = 0; R < f; R++) {
  7768. const I = e.getValue(_ % u, R % h);
  7769. I && e.setValue(_, R, I);
  7770. }
  7771. return {
  7772. pastedRange: o,
  7773. unitId: s,
  7774. subUnitId: i
  7775. };
  7776. }
  7777. const S = this._expandOrShrinkRowsCols(s, i, o, h, u);
  7778. return o.rows = S.rows, o.cols = S.cols, {
  7779. pastedRange: o,
  7780. unitId: s,
  7781. subUnitId: i
  7782. };
  7783. }
  7784. _expandOrShrinkRowsCols(e, t, n, s, i) {
  7785. const { rows: o, cols: l } = n, a = this._univerInstanceService.getUniverSheetInstance(e), c = a == null ? void 0 : a.getSheetBySheetId(t);
  7786. let d, u;
  7787. if (o.length >= i)
  7788. d = o.slice(0, i);
  7789. else {
  7790. d = o.slice(0);
  7791. let h = o[o.length - 1] + 1;
  7792. for (; d.length < i; )
  7793. c.getRowFiltered(h) || d.push(h), h++;
  7794. }
  7795. if (l.length >= s)
  7796. u = l.slice(0, s);
  7797. else {
  7798. u = l.slice(0);
  7799. let h = l[l.length - 1] + 1;
  7800. for (; u.length < s; )
  7801. u.push(h), h++;
  7802. }
  7803. return {
  7804. rows: d,
  7805. cols: u
  7806. };
  7807. }
  7808. /**
  7809. * Determine whether the cells starting from the upper left corner of the range (merged or non-merged or combined) are consistent with the size of the original data
  7810. * @param cellMatrix
  7811. * @param range
  7812. */
  7813. _topLeftCellsMatch(e, t, n) {
  7814. const s = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), i = s == null ? void 0 : s.getActiveSheet();
  7815. if (!i)
  7816. return !1;
  7817. const { topRow: o, leftCol: l } = n, a = sb(
  7818. o + e - 1,
  7819. l,
  7820. l + t - 1,
  7821. i
  7822. ), c = ib(
  7823. l + t - 1,
  7824. o,
  7825. o + e - 1,
  7826. i
  7827. );
  7828. return !a && !c;
  7829. }
  7830. removeMarkSelection() {
  7831. this._copyMarkId && (this._markSelectionService.removeShape(this._copyMarkId), this._copyMarkId = null);
  7832. }
  7833. _initUnitDisposed() {
  7834. this.disposeWithMe(
  7835. this._univerInstanceService.getTypeOfUnitDisposed$(O.UNIVER_SHEET).subscribe((e) => {
  7836. e && this.copyContentCache().clearWithUnitId(e.getUnitId());
  7837. })
  7838. );
  7839. }
  7840. disposePasteOptionsCache() {
  7841. this.setShowMenu(!1), this.updatePasteOptionsCache(null);
  7842. }
  7843. };
  7844. Bo = tb([
  7845. Mt(0, vl),
  7846. Mt(1, L),
  7847. Mt(2, D($)),
  7848. Mt(3, wl),
  7849. Mt(4, Zt),
  7850. Mt(5, F),
  7851. Mt(6, ws),
  7852. Mt(7, fS),
  7853. Mt(8, gS),
  7854. Mt(9, Ce),
  7855. Mt(10, D(kt)),
  7856. Mt(11, D(Ee)),
  7857. Mt(12, D(Bp)),
  7858. Mt(13, D(vt))
  7859. ], Bo);
  7860. function nb(r) {
  7861. let e = "";
  7862. const t = r.getLength();
  7863. return r.forRow((n, s) => {
  7864. const i = [];
  7865. s.forEach((o) => {
  7866. const l = r.getValue(n, o);
  7867. if (l) {
  7868. const a = rb(l);
  7869. i.push(a);
  7870. }
  7871. }), e += i.join(" "), n !== t - 1 && (e += `
  7872. `);
  7873. }), e;
  7874. }
  7875. function rb(r) {
  7876. return Fp(r.displayV) ? r.displayV : Wh(r);
  7877. }
  7878. function sb(r, e, t, n) {
  7879. return n.getMergeData().some(
  7880. (s) => s.startRow <= r && r < s.endRow && e <= s.startColumn && s.startColumn <= t
  7881. );
  7882. }
  7883. function ib(r, e, t, n) {
  7884. return n.getMergeData().some(
  7885. (s) => s.startColumn <= r && r < s.endColumn && e <= s.startRow && s.startRow <= t
  7886. );
  7887. }
  7888. function ob(r) {
  7889. let e = 0;
  7890. return r.forValue((t, n, s) => {
  7891. if (s && e++, e > 1)
  7892. return !1;
  7893. }), e > 1;
  7894. }
  7895. function As() {
  7896. return {
  7897. p: null,
  7898. v: null,
  7899. s: null,
  7900. f: null,
  7901. si: null,
  7902. t: null
  7903. };
  7904. }
  7905. const Wd = 998, hn = {
  7906. id: pS.id,
  7907. name: "sheet.command.copy",
  7908. type: K.COMMAND,
  7909. multi: !0,
  7910. priority: Wd,
  7911. preconditions: kd,
  7912. handler: async (r) => r.get(Sn).copy()
  7913. }, Rf = {
  7914. id: SS.id,
  7915. name: "sheet.command.cut",
  7916. type: K.COMMAND,
  7917. multi: !0,
  7918. priority: Wd,
  7919. preconditions: kd,
  7920. handler: async (r) => r.get(Sn).cut()
  7921. }, mn = {
  7922. id: CS.id,
  7923. type: K.COMMAND,
  7924. multi: !0,
  7925. name: "sheet.command.paste",
  7926. priority: Wd,
  7927. preconditions: kd,
  7928. handler: async (r, e) => {
  7929. const n = await r.get(wl).read(), s = r.get(Sn);
  7930. return n.length !== 0 ? s.paste(n[0], e == null ? void 0 : e.value) : !1;
  7931. }
  7932. }, xc = {
  7933. id: vS,
  7934. type: K.COMMAND,
  7935. handler: async (r, e) => {
  7936. const t = r.get(Sn), { htmlContent: n, textContent: s } = e;
  7937. return t.legacyPaste(n, s), !0;
  7938. }
  7939. }, Gs = {
  7940. id: "sheet.command.paste-value",
  7941. type: K.COMMAND,
  7942. handler: async (r) => r.get(F).executeCommand(mn.id, { value: rt.SPECIAL_PASTE_VALUE })
  7943. }, qs = {
  7944. id: "sheet.command.paste-format",
  7945. type: K.COMMAND,
  7946. handler: async (r) => r.get(F).executeCommand(mn.id, {
  7947. value: rt.SPECIAL_PASTE_FORMAT
  7948. })
  7949. }, Jr = {
  7950. id: "sheet.command.paste-col-width",
  7951. type: K.COMMAND,
  7952. handler: async (r) => r.get(F).executeCommand(mn.id, {
  7953. value: rt.SPECIAL_PASTE_COL_WIDTH
  7954. })
  7955. }, Qs = {
  7956. id: "sheet.command.paste-besides-border",
  7957. type: K.COMMAND,
  7958. handler: async (r) => r.get(F).executeCommand(mn.id, {
  7959. value: rt.SPECIAL_PASTE_BESIDES_BORDER
  7960. })
  7961. }, If = {
  7962. id: "sheet.command.optional-paste",
  7963. type: K.COMMAND,
  7964. handler: async (r, { type: e }) => r.get(Sn).rePasteWithPasteType(e)
  7965. }, Ul = {
  7966. id: "sheet.command.hide-row-confirm",
  7967. type: K.COMMAND,
  7968. handler: async (r) => {
  7969. var a;
  7970. const t = (a = r.get($).getCurrentSelections()) == null ? void 0 : a.map((c) => c.range);
  7971. if (!(t != null && t.length)) return !1;
  7972. const n = r.get(F), s = r.get(L), i = Ue(s);
  7973. if (!i) return !1;
  7974. const { worksheet: o } = i, l = o.getVisibleRows();
  7975. if (rf(l, t)) {
  7976. const c = r.get(tn), d = r.get(Ee);
  7977. return await c.confirm({
  7978. id: "sheet.confirm.hide-row",
  7979. title: {
  7980. title: d.t("info.problem")
  7981. },
  7982. children: { title: d.t("rightClick.hideAllRowsAlert") },
  7983. cancelText: d.t("button.cancel"),
  7984. confirmText: d.t("button.confirm")
  7985. }), !1;
  7986. }
  7987. return await n.executeCommand(sm.id), !0;
  7988. }
  7989. }, jl = {
  7990. id: "sheet.command.hide-col-confirm",
  7991. type: K.COMMAND,
  7992. handler: async (r) => {
  7993. var a;
  7994. const t = (a = r.get($).getCurrentSelections()) == null ? void 0 : a.map((c) => c.range);
  7995. if (!(t != null && t.length))
  7996. return !1;
  7997. const n = r.get(F), s = r.get(L), i = Ue(s);
  7998. if (!i) return !1;
  7999. const { worksheet: o } = i, l = o.getVisibleCols();
  8000. if (sf(l, t)) {
  8001. const c = r.get(tn), d = r.get(Ee);
  8002. return await c.confirm({
  8003. id: "sheet.confirm.hide-col",
  8004. title: {
  8005. title: d.t("info.problem")
  8006. },
  8007. children: { title: d.t("rightClick.hideAllColumnsAlert") },
  8008. cancelText: d.t("button.cancel"),
  8009. confirmText: d.t("button.confirm")
  8010. }), !1;
  8011. }
  8012. return await n.executeCommand(im.id), !0;
  8013. }
  8014. }, Rs = {
  8015. type: K.COMMAND,
  8016. id: "sheet.command.set-range-bold",
  8017. handler: async (r) => {
  8018. const e = r.get(F);
  8019. return r.get(Ne).getContextValue(Je) ? e.executeCommand(_p.id) : e.executeCommand(ud.id);
  8020. }
  8021. }, Is = {
  8022. type: K.COMMAND,
  8023. id: "sheet.command.set-range-italic",
  8024. handler: async (r) => {
  8025. const e = r.get(F);
  8026. return r.get(Ne).getContextValue(Je) ? e.executeCommand(wp.id) : e.executeCommand(hd.id);
  8027. }
  8028. }, ys = {
  8029. type: K.COMMAND,
  8030. id: "sheet.command.set-range-underline",
  8031. handler: async (r) => {
  8032. const e = r.get(F);
  8033. return r.get(Ne).getContextValue(Je) ? e.executeCommand(Rp.id) : e.executeCommand(md.id);
  8034. }
  8035. }, Ms = {
  8036. type: K.COMMAND,
  8037. id: "sheet.command.set-range-stroke",
  8038. handler: async (r) => {
  8039. const e = r.get(F);
  8040. return r.get(Ne).getContextValue(Je) ? e.executeCommand(Ip.id) : e.executeCommand(fd.id);
  8041. }
  8042. }, yf = {
  8043. type: K.COMMAND,
  8044. id: "sheet.command.set-range-subscript",
  8045. handler: async (r) => {
  8046. const e = r.get(F);
  8047. return r.get(Ne).getContextValue(Je) ? e.executeCommand(yp.id) : !1;
  8048. }
  8049. }, Mf = {
  8050. type: K.COMMAND,
  8051. id: "sheet.command.set-range-superscript",
  8052. handler: async (r) => {
  8053. const e = r.get(F);
  8054. return r.get(Ne).getContextValue(Je) ? e.executeCommand(Mp.id) : !1;
  8055. }
  8056. }, Xl = {
  8057. type: K.COMMAND,
  8058. id: "sheet.command.set-range-fontsize",
  8059. handler: async (r, e) => {
  8060. const t = r.get(F);
  8061. return r.get(Ne).getContextValue(Je) ? t.executeCommand(Pp.id, e) : t.executeCommand(gd.id, e);
  8062. }
  8063. }, zl = {
  8064. type: K.COMMAND,
  8065. id: "sheet.command.set-range-font-family",
  8066. handler: async (r, e) => {
  8067. const t = r.get(F);
  8068. return r.get(Ne).getContextValue(Je) ? t.executeCommand(Ep.id, e) : t.executeCommand(pd.id, e);
  8069. }
  8070. }, di = {
  8071. type: K.COMMAND,
  8072. id: "sheet.command.set-range-text-color",
  8073. handler: async (r, e) => {
  8074. const t = r.get(F);
  8075. return r.get(Ne).getContextValue(Je) ? t.executeCommand(Oh.id, e) : t.executeCommand(om.id, e);
  8076. }
  8077. }, Pf = {
  8078. type: K.COMMAND,
  8079. id: "sheet.command.reset-range-text-color",
  8080. handler: async (r) => {
  8081. const e = r.get(F), n = r.get(Ne).getContextValue(Je), s = r.get(kt);
  8082. return n ? e.executeCommand(Oh.id, { value: null }) : e.executeCommand(om.id, { value: s.getCurrentTheme().textColor });
  8083. }
  8084. };
  8085. var lb = Object.defineProperty, ab = Object.getOwnPropertyDescriptor, cb = (r, e, t, n) => {
  8086. for (var s = n > 1 ? void 0 : n ? ab(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  8087. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  8088. return n && s && lb(e, t, s), s;
  8089. }, Fr = (r, e) => (t, n) => e(t, n, r), zt = /* @__PURE__ */ ((r) => (r[r.OFF = 0] = "OFF", r[r.ONCE = 1] = "ONCE", r[r.INFINITE = 2] = "INFINITE", r))(zt || {});
  8090. const Un = gn("univer.format-painter-service");
  8091. let Fo = class extends ce {
  8092. constructor(e, t, n, s, i, o) {
  8093. super();
  8094. w(this, "status$");
  8095. w(this, "_selectionFormat");
  8096. w(this, "_markId", null);
  8097. w(this, "_status$");
  8098. w(this, "_defaultHook", null);
  8099. w(this, "_extendHooks", []);
  8100. this._selectionManagerService = e, this._themeService = t, this._markSelectionService = n, this._logService = s, this._commandService = i, this._undoRedoService = o, this._status$ = new Me(
  8101. 0
  8102. /* OFF */
  8103. ), this.status$ = this._status$.asObservable(), this._selectionFormat = { styles: new Ke(), merges: [] };
  8104. }
  8105. addHook(e) {
  8106. var t, n, s;
  8107. e.isDefaultHook && ((t = e.priority) != null ? t : 0) > ((s = (n = this._defaultHook) == null ? void 0 : n.priority) != null ? s : -1) ? this._defaultHook = e : (this._extendHooks.push(e), this._extendHooks.sort((i, o) => (i.priority || 0) - (o.priority || 0)));
  8108. }
  8109. getHooks() {
  8110. return this._defaultHook ? [this._defaultHook, ...this._extendHooks] : this._extendHooks;
  8111. }
  8112. setStatus(e) {
  8113. this._updateRangeMark(e), this._status$.next(e), this.getHooks().forEach((n) => {
  8114. n.onStatusChange !== void 0 && n.onStatusChange(e);
  8115. });
  8116. }
  8117. getStatus() {
  8118. return this._status$.getValue();
  8119. }
  8120. setSelectionFormat(e) {
  8121. this._selectionFormat = e;
  8122. }
  8123. getSelectionFormat() {
  8124. return this._selectionFormat;
  8125. }
  8126. applyFormatPainter(e, t, n) {
  8127. const s = this.getHooks(), i = [], o = [];
  8128. s.forEach((a) => {
  8129. if (a.onApply !== void 0) {
  8130. const c = a.onApply(
  8131. e,
  8132. t,
  8133. n,
  8134. this._selectionFormat
  8135. );
  8136. c && (i.push(...c.redos), o.push(...c.undos));
  8137. }
  8138. });
  8139. for (const a of s)
  8140. if (a.onBeforeApply !== void 0 && !a.onBeforeApply({
  8141. unitId: e,
  8142. subUnitId: t,
  8143. range: n,
  8144. redoMutationsInfo: i,
  8145. format: this._selectionFormat,
  8146. undoMutationsInfo: o
  8147. }))
  8148. return !1;
  8149. this._logService.log("[FormatPainterService]", "apply mutations", {
  8150. undoMutationsInfo: o,
  8151. redoMutationsInfo: i
  8152. });
  8153. const l = i.every((a) => this._commandService.executeCommand(a.id, a.params));
  8154. return l && this._undoRedoService.pushUndoRedo({
  8155. unitID: e,
  8156. undoMutations: o,
  8157. redoMutations: i
  8158. }), l;
  8159. }
  8160. _updateRangeMark(e) {
  8161. if (this._markSelectionService.removeAllShapes(), e !== 0) {
  8162. const t = this._selectionManagerService.getCurrentLastSelection();
  8163. if (t) {
  8164. const n = bf(this._themeService);
  8165. e === 2 ? this._markId = this._markSelectionService.addShape({ ...t, style: n }) : this._markId = this._markSelectionService.addShape({ ...t, style: n }, [
  8166. Se.id
  8167. ]);
  8168. }
  8169. }
  8170. }
  8171. };
  8172. Fo = cb([
  8173. Fr(0, D($)),
  8174. Fr(1, D(kt)),
  8175. Fr(2, ws),
  8176. Fr(3, vl),
  8177. Fr(4, F),
  8178. Fr(5, Zt)
  8179. ], Fo);
  8180. const Yl = {
  8181. id: "sheet.operation.set-format-painter",
  8182. type: K.OPERATION,
  8183. handler: (r, e) => e ? (r.get(Un).setStatus(e.status), !0) : !1
  8184. }, Bd = {
  8185. type: K.COMMAND,
  8186. id: "sheet.command.set-infinite-format-painter",
  8187. handler: async (r) => {
  8188. const t = r.get(Un).getStatus();
  8189. let n;
  8190. return t !== zt.OFF ? n = zt.OFF : n = zt.INFINITE, r.get(F).executeCommand(Yl.id, { status: n });
  8191. }
  8192. }, Bi = {
  8193. type: K.COMMAND,
  8194. id: "sheet.command.set-once-format-painter",
  8195. handler: async (r) => {
  8196. const t = r.get(Un).getStatus();
  8197. let n;
  8198. return t !== zt.OFF ? n = zt.OFF : n = zt.ONCE, r.get(F).executeCommand(Yl.id, { status: n });
  8199. }
  8200. }, Zl = {
  8201. type: K.COMMAND,
  8202. id: "sheet.command.apply-format-painter",
  8203. handler: async (r, e) => r.get(Un).applyFormatPainter(e.unitId, e.subUnitId, e.range)
  8204. }, $n = {
  8205. type: K.COMMAND,
  8206. id: "sheet.command.set-selection-frozen",
  8207. handler: async (r, e) => {
  8208. const { type: t } = e || {}, n = r.get(L), s = r.get(Zt), i = Ue(n);
  8209. if (!i) return !1;
  8210. const { unitId: o, subUnitId: l } = i, a = r.get(F), d = r.get($).getCurrentSelections();
  8211. if (!d)
  8212. return !1;
  8213. const u = d[(d == null ? void 0 : d.length) - 1], { range: h } = u, f = r.get(Ce).getRenderById(o).with(yt), { sheetViewStartRow: g = 0, sheetViewStartColumn: p = 0 } = f.getCurrentScrollState() || {};
  8214. let S, b, v, _;
  8215. const { startRow: R, startColumn: I, rangeType: y } = h;
  8216. if (y === j.ROW || t === 1)
  8217. S = R, v = R - g, b = -1, _ = 0;
  8218. else if (y === j.COLUMN || t === 2)
  8219. S = -1, v = 0, b = I, _ = I - p;
  8220. else if (y === j.NORMAL)
  8221. S = R, v = R - g, b = I, _ = I - p;
  8222. else
  8223. return !1;
  8224. const M = {
  8225. unitId: o,
  8226. subUnitId: l,
  8227. startRow: S,
  8228. startColumn: b,
  8229. xSplit: b > 0 ? Math.max(1, _) : _,
  8230. ySplit: S > 0 ? Math.max(1, v) : v
  8231. }, P = lm(r, M);
  8232. return a.syncExecuteCommand(vr.id, M) && s.pushUndoRedo({
  8233. unitID: o,
  8234. undoMutations: [{ id: vr.id, params: P }],
  8235. redoMutations: [{ id: vr.id, params: M }]
  8236. }), !0;
  8237. }
  8238. }, Gl = {
  8239. type: K.COMMAND,
  8240. id: "sheet.command.set-row-frozen",
  8241. handler: async (r) => (r.get(F).executeCommand($n.id, {
  8242. type: 1
  8243. /* Row */
  8244. }), !0)
  8245. }, ql = {
  8246. type: K.COMMAND,
  8247. id: "sheet.command.set-col-frozen",
  8248. handler: async (r) => (r.get(F).executeCommand($n.id, {
  8249. type: 2
  8250. /* Column */
  8251. }), !0)
  8252. };
  8253. var db = Object.defineProperty, ub = Object.getOwnPropertyDescriptor, hb = (r, e, t, n) => {
  8254. for (var s = n > 1 ? void 0 : n ? ub(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  8255. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  8256. return n && s && db(e, t, s), s;
  8257. }, Qu = (r, e) => (t, n) => e(t, n, r);
  8258. const mb = (r, e) => {
  8259. const { unitId: t, subUnitId: n, ranges: s } = r, i = {}, o = e.getColumnManager();
  8260. for (let l = 0; l < s.length; l++) {
  8261. const a = s[l];
  8262. for (let c = a.startColumn; c < a.endColumn + 1; c++) {
  8263. const d = o.getColumnOrCreate(c);
  8264. i[c] = d.w;
  8265. }
  8266. }
  8267. return {
  8268. unitId: t,
  8269. subUnitId: n,
  8270. ranges: s,
  8271. colWidth: i
  8272. };
  8273. };
  8274. let ui = class extends ce {
  8275. constructor(r, e) {
  8276. super(), this._renderManagerService = r, this._univerInstanceService = e;
  8277. }
  8278. getUndoRedoParamsOfColWidth(r) {
  8279. const e = { redos: [], undos: [] }, { _univerInstanceService: t } = this, n = Ue(t);
  8280. if (!n) return e;
  8281. const { unitId: s, subUnitId: i, worksheet: o } = n, l = this._renderManagerService.getRenderById(s).with(me);
  8282. if (!l.getCurrent()) return e;
  8283. const { skeleton: a } = l.getCurrent(), c = a.calculateAutoWidthInRange(r.ranges), d = {};
  8284. for (const { col: m, width: f } of c)
  8285. d[m] = f;
  8286. const u = {
  8287. subUnitId: i,
  8288. unitId: s,
  8289. ranges: r.ranges,
  8290. colWidth: d
  8291. }, h = mb(u, o);
  8292. return {
  8293. undos: [
  8294. {
  8295. id: Qt.id,
  8296. params: h
  8297. }
  8298. ],
  8299. redos: [
  8300. {
  8301. id: Qt.id,
  8302. params: u
  8303. }
  8304. ]
  8305. };
  8306. }
  8307. };
  8308. ui = hb([
  8309. Qu(0, Ce),
  8310. Qu(1, D(L))
  8311. ], ui);
  8312. const Ql = {
  8313. type: K.COMMAND,
  8314. id: "sheet.command.set-col-auto-width",
  8315. handler: async (r, e) => {
  8316. const t = r.get(F), n = r.get(Zt), s = r.get($), i = r.get(L), o = Ue(i, e);
  8317. if (!o) return !1;
  8318. const { unitId: l, subUnitId: a } = o;
  8319. let c = [];
  8320. if (e != null && e.ranges)
  8321. c = [...e.ranges];
  8322. else {
  8323. const f = s.getCurrentSelections();
  8324. for (let g = 0; g < f.length; g++)
  8325. c.push(f[g].range);
  8326. }
  8327. if (!(c != null && c.length))
  8328. return !1;
  8329. const d = {
  8330. unitId: l,
  8331. subUnitId: a,
  8332. ranges: c
  8333. }, { redos: u, undos: h } = r.get(ui).getUndoRedoParamsOfColWidth(d);
  8334. return pl([...u], t).result ? (n.pushUndoRedo({
  8335. unitID: l,
  8336. undoMutations: [...h],
  8337. redoMutations: [...u]
  8338. }), !0) : !1;
  8339. }
  8340. }, Ps = "UI_PLUGIN_SHEETS", Fi = `${Ps}_COLOR_PICKER_COMPONENT`, Fd = `${Ps}_FONT_FAMILY_COMPONENT`, Ud = `${Ps}_FONT_FAMILY_ITEM_COMPONENT`, jd = `${Ps}_FONT_SIZE_COMPONENT`, Kl = `${Ps}_MENU_ITEM_INPUT_COMPONENT`;
  8341. var ba = { exports: {} }, Ns = {};
  8342. /**
  8343. * @license React
  8344. * react-jsx-runtime.production.min.js
  8345. *
  8346. * Copyright (c) Facebook, Inc. and its affiliates.
  8347. *
  8348. * This source code is licensed under the MIT license found in the
  8349. * LICENSE file in the root directory of this source tree.
  8350. */
  8351. var Ku;
  8352. function fb() {
  8353. if (Ku) return Ns;
  8354. Ku = 1;
  8355. var r = od, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
  8356. function o(l, a, c) {
  8357. var d, u = {}, h = null, m = null;
  8358. c !== void 0 && (h = "" + c), a.key !== void 0 && (h = "" + a.key), a.ref !== void 0 && (m = a.ref);
  8359. for (d in a) n.call(a, d) && !i.hasOwnProperty(d) && (u[d] = a[d]);
  8360. if (l && l.defaultProps) for (d in a = l.defaultProps, a) u[d] === void 0 && (u[d] = a[d]);
  8361. return { $$typeof: e, type: l, key: h, ref: m, props: u, _owner: s.current };
  8362. }
  8363. return Ns.Fragment = t, Ns.jsx = o, Ns.jsxs = o, Ns;
  8364. }
  8365. var Ju;
  8366. function gb() {
  8367. return Ju || (Ju = 1, ba.exports = fb()), ba.exports;
  8368. }
  8369. var C = gb();
  8370. const pb = "univer-sheets-ui-context-menu-input", Sb = "univer-sheets-ui-context-menu-input-container", Cb = "univer-sheets-ui-context-menu-input-number", _a = {
  8371. sheetsUiContextMenuInput: pb,
  8372. sheetsUiContextMenuInputContainer: Sb,
  8373. sheetsUiContextMenuInputNumber: Cb
  8374. }, Ef = (r) => {
  8375. const { prefix: e, suffix: t, value: n, onChange: s, min: i = Number.MIN_SAFE_INTEGER, max: o = Number.MAX_SAFE_INTEGER } = r, l = W(Ee), a = W(Rl), [c, d] = te(), u = (m) => {
  8376. var f;
  8377. d(m == null ? void 0 : m.toString()), s((f = m == null ? void 0 : m.toString()) != null ? f : "");
  8378. };
  8379. be(() => {
  8380. a.visible || d(n);
  8381. }, [a.visible]), be(() => {
  8382. d(n);
  8383. }, [n]);
  8384. function h(m) {
  8385. m.key === "Backspace" && m.stopPropagation();
  8386. }
  8387. return /* @__PURE__ */ C.jsxs("div", { className: _a.sheetsUiContextMenuInput, children: [
  8388. l.t(e),
  8389. /* @__PURE__ */ C.jsx("span", { className: _a.sheetsUiContextMenuInputContainer, onClick: (m) => m.stopPropagation(), children: /* @__PURE__ */ C.jsx(
  8390. xC,
  8391. {
  8392. className: _a.sheetsUiContextMenuInputNumber,
  8393. value: Number(c),
  8394. precision: 0,
  8395. onKeyDown: h,
  8396. onChange: u,
  8397. min: i,
  8398. max: o
  8399. }
  8400. ) }),
  8401. l.t(t)
  8402. ] });
  8403. };
  8404. function vb(r) {
  8405. return r.getCurrentTypeOfUnit$(O.UNIVER_SHEET).pipe(We((e) => e ? e.activeSheet$.pipe(_e((t) => t ? { workbook: e, worksheet: t } : null)) : Ie(null)));
  8406. }
  8407. function xt(r, e, t) {
  8408. return vb(r).pipe(We((n) => n ? t(n) : Ie(e)));
  8409. }
  8410. function bb(r, e) {
  8411. const t = r.get(L), n = r.get(HS), s = r.get($);
  8412. return t.getCurrentTypeOfUnit$(O.UNIVER_SHEET).pipe(
  8413. We((o) => o ? ot([s.selectionMoveEnd$, o.activeSheet$]).pipe(
  8414. We(([l, a]) => {
  8415. if (!a)
  8416. return Ie(!1);
  8417. if (l.length === 0)
  8418. return Ie(!1);
  8419. const c = n.getInterestGroupId(l);
  8420. if (e) {
  8421. const d = c.filter((u) => e.has(u));
  8422. return Ie(d.length > 0);
  8423. } else
  8424. return Ie(c.length > 0);
  8425. })
  8426. ) : Ie(!1))
  8427. );
  8428. }
  8429. function Es(r, e, t) {
  8430. return ot([e, bb(r, t)]).pipe(
  8431. _e(([n, s]) => n || s)
  8432. );
  8433. }
  8434. function ue(r, e = {}, t = !1) {
  8435. var d;
  8436. const s = r.get(L).getCurrentTypeOfUnit$(O.UNIVER_SHEET), i = r.get(Dt), o = r.has(tt) ? r.get(tt) : null, a = r.get(Ne).subscribeContextValue$(Ht), c = (d = o == null ? void 0 : o.visible$) != null ? d : Ie(null);
  8437. return ot([i.currentUser$, s, c, a]).pipe(
  8438. We(([u, h, m, f]) => !h || m != null && m.visible && m.unitId === h.getUnitId() && !t || f && !t ? Ie(!0) : h.activeSheet$.pipe(
  8439. We((g) => {
  8440. if (!g)
  8441. return Ie(!0);
  8442. const p = r.get($), S = r.get(Ye), b = r.get(ft), _ = r.get(Ne).subscribeContextValue$(Cl).pipe(Vt(!1));
  8443. return ot([p.selectionMoveEnd$, _]).pipe(
  8444. We(([R, I]) => {
  8445. if (I)
  8446. return Ie(!0);
  8447. const y = h.getUnitId(), M = g.getSheetId(), P = r.get($e), { workbookTypes: E = [q], worksheetTypes: T, rangeTypes: A } = e, H = [];
  8448. if (E == null || E.forEach((V) => {
  8449. H.push(new V(y).id);
  8450. }), T == null || T.forEach((V) => {
  8451. H.push(new V(y, M).id);
  8452. }), b.getRule(y, M))
  8453. return P.composePermission$(H).pipe(_e((V) => V.some((N) => N.value === !1)));
  8454. const k = R == null ? void 0 : R.map((V) => V.range), U = S.getSubunitRuleList(y, M).filter((V) => k == null ? void 0 : k.some((N) => V.ranges.some((X) => ae.intersects(N, X))));
  8455. return A == null || A.forEach((V) => {
  8456. U.forEach((N) => {
  8457. H.push(new V(y, M, N.permissionId).id);
  8458. });
  8459. }), P.composePermission$(H).pipe(_e((V) => V.some((N) => N.value === !1)));
  8460. })
  8461. );
  8462. })
  8463. ))
  8464. );
  8465. }
  8466. function Jl(r) {
  8467. const e = r.get(L), t = r.get($), n = r.get(Ye), s = r.get($e);
  8468. return mt(t.selectionMoveEnd$, s.permissionPointUpdate$.pipe(Ei(100))).pipe(
  8469. _e(() => {
  8470. var u;
  8471. const i = (u = t.getCurrentLastSelection()) == null ? void 0 : u.range;
  8472. if (!i) return !0;
  8473. const o = e.getCurrentUnitForType(O.UNIVER_SHEET), l = o == null ? void 0 : o.getActiveSheet();
  8474. if (!o || !l)
  8475. return !0;
  8476. const a = o.getUnitId(), c = l.getSheetId(), d = [new q(a).id, new ee(a, c).id];
  8477. return n.getSubunitRuleList(a, c).filter((h) => h.ranges.some((m) => ae.intersects(i, m))).forEach((h) => {
  8478. d.push(new re(a, c, h.permissionId).id);
  8479. }), s.composePermission(d).some((h) => h.value === !1);
  8480. })
  8481. );
  8482. }
  8483. function Tf(r, e) {
  8484. const t = r.get(L), n = r.get($), s = r.get(Ye), i = r.get($e);
  8485. return mt(n.selectionMoveEnd$, i.permissionPointUpdate$.pipe(Ei(100))).pipe(
  8486. _e(() => {
  8487. var h;
  8488. const o = (h = n.getCurrentLastSelection()) == null ? void 0 : h.range;
  8489. if (!o) return !0;
  8490. const l = t.getCurrentUnitForType(O.UNIVER_SHEET), a = l == null ? void 0 : l.getActiveSheet();
  8491. if (!l || !a)
  8492. return !0;
  8493. const c = l.getUnitId(), d = a.getSheetId(), u = [new q(c).id, new ee(c, d).id];
  8494. return s.getSubunitRuleList(c, d).filter((m) => e === "row" ? m.ranges.some((f) => o.endRow > f.startRow && o.endRow <= f.endRow) : m.ranges.some((f) => o.endColumn > f.startColumn && o.endColumn <= f.endColumn)).forEach((m) => {
  8495. u.push(new re(c, d, m.permissionId).id);
  8496. }), i.composePermission(u).some((m) => m.value === !1);
  8497. })
  8498. );
  8499. }
  8500. function xf(r, e) {
  8501. const t = r.get(L), n = r.get($), s = r.get(Ye), i = r.get($e);
  8502. return mt(n.selectionMoveEnd$, i.permissionPointUpdate$.pipe(Ei(100))).pipe(
  8503. _e(() => {
  8504. var h;
  8505. const o = (h = n.getCurrentLastSelection()) == null ? void 0 : h.range;
  8506. if (!o) return !0;
  8507. const l = t.getCurrentUnitForType(O.UNIVER_SHEET), a = l == null ? void 0 : l.getActiveSheet();
  8508. if (!l || !a)
  8509. return !0;
  8510. const c = l.getUnitId(), d = a.getSheetId(), u = [new q(c).id, new ee(c, d).id];
  8511. return s.getSubunitRuleList(c, d).filter((m) => e === "row" ? m.ranges.some((f) => o.startRow > f.startRow && o.startRow <= f.endRow) : m.ranges.some((f) => o.startColumn > f.startColumn && o.startColumn <= f.endColumn)).forEach((m) => {
  8512. u.push(new re(c, d, m.permissionId).id);
  8513. }), i.composePermission(u).some((m) => m.value === !1);
  8514. })
  8515. );
  8516. }
  8517. function Of(r, e) {
  8518. const t = r.get(L), n = r.get($), s = r.get(Ye), i = r.get($e);
  8519. return mt(n.selectionMoveEnd$, i.permissionPointUpdate$.pipe(Ei(100))).pipe(
  8520. _e(() => {
  8521. var m;
  8522. const o = (m = n.getCurrentLastSelection()) == null ? void 0 : m.range;
  8523. if (!o) return !0;
  8524. const l = t.getCurrentUnitForType(O.UNIVER_SHEET), a = l == null ? void 0 : l.getActiveSheet();
  8525. if (!l || !a)
  8526. return !0;
  8527. const c = l.getUnitId(), d = a.getSheetId(), u = [new q(c).id, new ee(c, d).id], h = se.deepClone(o);
  8528. return e === "row" ? (h.startColumn = 0, h.endColumn = a.getColumnCount() - 1) : (h.startRow = 0, h.endRow = a.getRowCount() - 1), s.getSubunitRuleList(c, d).filter((f) => f.ranges.some((g) => ae.intersects(h, g))).forEach((f) => {
  8529. u.push(new re(c, d, f.permissionId).id);
  8530. }), i.composePermission(u).some((f) => f.value === !1);
  8531. })
  8532. );
  8533. }
  8534. function $l(r, e) {
  8535. const t = r.get(L), n = r.get($), s = r.get(Ye), i = r.get($e);
  8536. return mt(n.selectionMoveEnd$, i.permissionPointUpdate$.pipe(Ei(100))).pipe(
  8537. _e(() => {
  8538. var m;
  8539. const o = (m = n.getCurrentLastSelection()) == null ? void 0 : m.range;
  8540. if (!o) return !0;
  8541. const l = t.getCurrentUnitForType(O.UNIVER_SHEET), a = l == null ? void 0 : l.getActiveSheet();
  8542. if (!l || !a)
  8543. return !0;
  8544. const c = l.getUnitId(), d = a.getSheetId(), u = [new q(c).id, new ee(c, d).id], h = se.deepClone(o);
  8545. return e === "row" ? h.endRow = a.getRowCount() - 1 : h.endColumn = a.getColumnCount() - 1, s.getSubunitRuleList(c, d).filter((f) => f.ranges.some((g) => ae.intersects(h, g))).forEach((f) => {
  8546. u.push(new re(c, d, f.permissionId).id);
  8547. }), i.composePermission(u).some((f) => f.value === !1);
  8548. })
  8549. );
  8550. }
  8551. function Ts(r, e) {
  8552. const n = r.get(L).getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(ft), i = r.get(Ye), o = r.get($e), l = r.get(Dt);
  8553. return ot([l.currentUser$, n]).pipe(
  8554. We(([a, c]) => c ? c.activeSheet$.pipe(
  8555. We((d) => {
  8556. if (!d)
  8557. return Ie(!0);
  8558. const u = c.getUnitId(), h = [];
  8559. return e.forEach((f) => h.push(new f(u).id)), o.composePermission$(h).pipe(_e((f) => f.every((g) => g.value === !0))).pipe(
  8560. _e((f) => {
  8561. if (!f)
  8562. return !0;
  8563. const g = d.getSheetId(), p = s.getRule(u, g), S = i.getSubunitRuleList(u, g);
  8564. return !!(p || S.length);
  8565. })
  8566. );
  8567. })
  8568. ) : Ie(!0))
  8569. );
  8570. }
  8571. var _b = /* @__PURE__ */ ((r) => (r.ROW_HEADER_CONTEXT_MENU = "ROW_HEADER_CONTEXT_MENU", r.COL_HEADER_CONTEXT_MENU = "COL_HEADER_CONTEXT_MENU", r.SHEET_BAR = "SHEET_BAR", r.SHEET_FOOTER = "SHEET_FOOTER", r))(_b || {});
  8572. function wb(r) {
  8573. const e = r.get(Un);
  8574. return {
  8575. id: Bi.id,
  8576. subId: Bd.id,
  8577. type: Q.BUTTON,
  8578. icon: "BrushSingle",
  8579. title: "Format Painter",
  8580. tooltip: "toolbar.formatPainter",
  8581. activated$: new it((t) => {
  8582. let n = !1;
  8583. const s = e.status$.subscribe((i) => {
  8584. n = i !== zt.OFF, t.next(n);
  8585. });
  8586. return t.next(n), () => {
  8587. s.unsubscribe();
  8588. };
  8589. }),
  8590. hidden$: oe(r, O.UNIVER_SHEET),
  8591. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [yo, ee], rangeTypes: [re] }, !0)
  8592. };
  8593. }
  8594. function Rb(r) {
  8595. const e = r.get(F), t = r.get(L), n = r.get(Ne), s = r.get($);
  8596. return {
  8597. id: Rs.id,
  8598. type: Q.BUTTON,
  8599. icon: "BoldSingle",
  8600. title: "Set bold",
  8601. tooltip: "toolbar.bold",
  8602. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0),
  8603. activated$: xt(t, !1, ({ worksheet: i }) => new it((o) => {
  8604. var d;
  8605. const l = e.onCommandExecuted((u) => {
  8606. var m, f;
  8607. const h = u.id;
  8608. if (h === Se.id || h === He.id || h === et.id) {
  8609. const g = (m = s.getCurrentLastSelection()) == null ? void 0 : m.primary;
  8610. let p = Yi.NORMAL;
  8611. if (g != null) {
  8612. const S = i.getRange(g.startRow, g.startColumn);
  8613. p = S == null ? void 0 : S.getFontWeight();
  8614. }
  8615. o.next(p === Yi.BOLD);
  8616. }
  8617. if ((h === Vi.id || h === Pi.id) && n.getContextValue(Je) && n.getContextValue(Tt)) {
  8618. const g = ji(r);
  8619. if (g == null)
  8620. return;
  8621. const p = (f = g.ts) == null ? void 0 : f.bl;
  8622. o.next(p === Qe.TRUE);
  8623. }
  8624. }), a = (d = s.getCurrentLastSelection()) == null ? void 0 : d.primary;
  8625. if (!i) {
  8626. o.next(!1);
  8627. return;
  8628. }
  8629. let c = Yi.NORMAL;
  8630. if (a != null) {
  8631. const u = i.getRange(a.startRow, a.startColumn);
  8632. c = u == null ? void 0 : u.getFontWeight();
  8633. }
  8634. return o.next(c === Yi.BOLD), l.dispose;
  8635. })),
  8636. hidden$: oe(r, O.UNIVER_SHEET)
  8637. };
  8638. }
  8639. function Ib(r) {
  8640. const e = r.get(F), t = r.get(L), n = r.get($), s = r.get(Ne);
  8641. return {
  8642. id: Is.id,
  8643. type: Q.BUTTON,
  8644. icon: "ItalicSingle",
  8645. title: "Set italic",
  8646. tooltip: "toolbar.italic",
  8647. disabled$: ue(
  8648. r,
  8649. {
  8650. workbookTypes: [q],
  8651. worksheetTypes: [ee, ze],
  8652. rangeTypes: [re]
  8653. },
  8654. !0
  8655. ),
  8656. activated$: xt(t, !1, ({ worksheet: i }) => new it((o) => {
  8657. var d;
  8658. const l = e.onCommandExecuted((u) => {
  8659. var m, f;
  8660. const h = u.id;
  8661. if (h === Se.id || h === He.id || h === et.id) {
  8662. const g = (m = n.getCurrentLastSelection()) == null ? void 0 : m.primary;
  8663. let p = Zi.NORMAL;
  8664. if (g != null) {
  8665. const S = i.getRange(g.startRow, g.startColumn);
  8666. p = S == null ? void 0 : S.getFontStyle();
  8667. }
  8668. o.next(p === Zi.ITALIC);
  8669. }
  8670. if ((h === Vi.id || h === Pi.id) && s.getContextValue(Je) && s.getContextValue(Tt)) {
  8671. const g = ji(r);
  8672. if (g == null) return;
  8673. const p = (f = g.ts) == null ? void 0 : f.it;
  8674. o.next(p === Qe.TRUE);
  8675. }
  8676. }), a = (d = n.getCurrentLastSelection()) == null ? void 0 : d.primary;
  8677. let c = Zi.NORMAL;
  8678. if (a != null) {
  8679. const u = i.getRange(a.startRow, a.startColumn);
  8680. c = u == null ? void 0 : u.getFontStyle();
  8681. }
  8682. return o.next(c === Zi.ITALIC), l.dispose;
  8683. })),
  8684. hidden$: oe(r, O.UNIVER_SHEET)
  8685. };
  8686. }
  8687. function yb(r) {
  8688. const e = r.get(F), t = r.get(L), n = r.get($), s = r.get(Ne);
  8689. return {
  8690. id: ys.id,
  8691. type: Q.BUTTON,
  8692. icon: "UnderlineSingle",
  8693. title: "Set underline",
  8694. tooltip: "toolbar.underline",
  8695. activated$: xt(t, !1, ({ worksheet: i }) => new it((o) => {
  8696. var d;
  8697. const l = e.onCommandExecuted((u) => {
  8698. var m, f;
  8699. const h = u.id;
  8700. if (h === Se.id || h === He.id || h === et.id) {
  8701. const g = (m = n.getCurrentLastSelection()) == null ? void 0 : m.primary;
  8702. let p;
  8703. if (g != null) {
  8704. const S = i.getRange(g.startRow, g.startColumn);
  8705. p = S == null ? void 0 : S.getUnderline();
  8706. }
  8707. o.next(!!(p && p.s));
  8708. }
  8709. if ((h === Vi.id || h === Pi.id) && s.getContextValue(Je) && s.getContextValue(Tt)) {
  8710. const g = ji(r);
  8711. if (g == null) return;
  8712. const p = (f = g.ts) == null ? void 0 : f.ul;
  8713. o.next((p == null ? void 0 : p.s) === Qe.TRUE);
  8714. }
  8715. }), a = (d = n.getCurrentLastSelection()) == null ? void 0 : d.primary;
  8716. let c;
  8717. if (a != null) {
  8718. const u = i.getRange(a.startRow, a.startColumn);
  8719. c = u == null ? void 0 : u.getUnderline();
  8720. }
  8721. return o.next(!!(c && c.s)), l.dispose;
  8722. })),
  8723. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0),
  8724. hidden$: oe(r, O.UNIVER_SHEET)
  8725. };
  8726. }
  8727. function Mb(r) {
  8728. const e = r.get(F), t = r.get(L), n = r.get($), s = r.get(Ne);
  8729. return {
  8730. id: Ms.id,
  8731. type: Q.BUTTON,
  8732. icon: "StrikethroughSingle",
  8733. title: "Set strike through",
  8734. tooltip: "toolbar.strikethrough",
  8735. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0),
  8736. activated$: xt(t, !1, ({ worksheet: i }) => new it((o) => {
  8737. var d;
  8738. const l = e.onCommandExecuted((u) => {
  8739. var m, f;
  8740. const h = u.id;
  8741. if (h === Se.id || h === He.id || h === et.id) {
  8742. const g = (m = n.getCurrentLastSelection()) == null ? void 0 : m.primary;
  8743. let p;
  8744. if (g != null) {
  8745. const S = i.getRange(g.startRow, g.startColumn);
  8746. p = S == null ? void 0 : S.getStrikeThrough();
  8747. }
  8748. o.next(!!(p && p.s));
  8749. }
  8750. if ((h === Vi.id || h === Pi.id) && s.getContextValue(Je) && s.getContextValue(Tt)) {
  8751. const g = ji(r);
  8752. if (g == null)
  8753. return;
  8754. const p = (f = g.ts) == null ? void 0 : f.st;
  8755. o.next((p == null ? void 0 : p.s) === Qe.TRUE);
  8756. }
  8757. }), a = (d = n.getCurrentLastSelection()) == null ? void 0 : d.primary;
  8758. let c;
  8759. if (a != null) {
  8760. const u = i.getRange(a.startRow, a.startColumn);
  8761. c = u == null ? void 0 : u.getStrikeThrough();
  8762. }
  8763. return o.next(!!(c && c.s)), l.dispose;
  8764. })),
  8765. hidden$: oe(r, O.UNIVER_SHEET)
  8766. };
  8767. }
  8768. function Pb(r) {
  8769. const e = r.get(F), t = r.get(L), n = r.get($), s = ed.ff;
  8770. return {
  8771. id: zl.id,
  8772. tooltip: "toolbar.font",
  8773. type: Q.SELECTOR,
  8774. label: Fd,
  8775. selections: bS.map((i) => ({
  8776. label: {
  8777. name: Ud,
  8778. hoverable: !0
  8779. },
  8780. value: i.value
  8781. })),
  8782. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0),
  8783. value$: xt(t, s, ({ worksheet: i }) => new it((o) => {
  8784. var d;
  8785. const l = e.onCommandExecuted((u) => {
  8786. var g;
  8787. const h = u.id;
  8788. if (h !== Se.id && h !== He.id && h !== et.id)
  8789. return;
  8790. const m = (g = n.getCurrentLastSelection()) == null ? void 0 : g.primary;
  8791. let f;
  8792. if (m != null) {
  8793. const p = i.getRange(m.startRow, m.startColumn);
  8794. f = p == null ? void 0 : p.getFontFamily();
  8795. }
  8796. o.next(f != null ? f : s);
  8797. }), a = (d = n.getCurrentLastSelection()) == null ? void 0 : d.primary;
  8798. let c;
  8799. if (a != null) {
  8800. const u = i.getRange(a.startRow, a.startColumn);
  8801. c = u == null ? void 0 : u.getFontFamily();
  8802. }
  8803. return o.next(c != null ? c : s), l.dispose;
  8804. })),
  8805. hidden$: oe(r, O.UNIVER_SHEET)
  8806. };
  8807. }
  8808. function Eb(r) {
  8809. const e = r.get(F), t = r.get(L), n = r.get($), s = r.get(Ne), i = ed.fs, o = ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0);
  8810. return {
  8811. id: Xl.id,
  8812. type: Q.SELECTOR,
  8813. tooltip: "toolbar.fontSize",
  8814. label: {
  8815. name: jd,
  8816. props: {
  8817. min: 1,
  8818. max: 400,
  8819. disabled$: o
  8820. }
  8821. },
  8822. selections: _S,
  8823. disabled$: o,
  8824. value$: xt(t, i, ({ worksheet: l }) => new it((a) => {
  8825. var h;
  8826. const c = e.onCommandExecuted((m) => {
  8827. var g, p;
  8828. const f = m.id;
  8829. if (f === Se.id || f === He.id || f === et.id) {
  8830. const S = (g = n.getCurrentLastSelection()) == null ? void 0 : g.primary;
  8831. let b;
  8832. if (S != null) {
  8833. const v = l.getRange(S.startRow, S.startColumn);
  8834. b = v == null ? void 0 : v.getFontSize();
  8835. }
  8836. a.next(b != null ? b : i);
  8837. }
  8838. if ((f === Vi.id || f === Pi.id) && s.getContextValue(Je) && s.getContextValue(Tt)) {
  8839. const S = ji(r);
  8840. if (S == null)
  8841. return;
  8842. const b = (p = S.ts) == null ? void 0 : p.fs;
  8843. a.next(b != null ? b : i);
  8844. }
  8845. }), d = (h = n.getCurrentLastSelection()) == null ? void 0 : h.primary;
  8846. let u;
  8847. if (d != null) {
  8848. const m = l.getRange(d.startRow, d.startColumn);
  8849. u = m == null ? void 0 : m.getFontSize();
  8850. }
  8851. return a.next(u != null ? u : i), c.dispose;
  8852. })),
  8853. hidden$: oe(r, O.UNIVER_SHEET)
  8854. };
  8855. }
  8856. function Tb(r) {
  8857. return {
  8858. id: Pf.id,
  8859. type: Q.BUTTON,
  8860. title: "toolbar.resetColor",
  8861. icon: "NoColor",
  8862. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0),
  8863. hidden$: oe(r, O.UNIVER_SHEET)
  8864. };
  8865. }
  8866. function xb(r) {
  8867. const e = r.get(F), t = r.get(kt);
  8868. return {
  8869. id: di.id,
  8870. icon: "FontColor",
  8871. tooltip: "toolbar.textColor.main",
  8872. type: Q.BUTTON_SELECTOR,
  8873. selections: [
  8874. {
  8875. label: {
  8876. name: Fi,
  8877. hoverable: !1
  8878. }
  8879. }
  8880. ],
  8881. value$: new it((n) => {
  8882. const s = t.getCurrentTheme().textColor, i = e.onCommandExecuted((o) => {
  8883. if (o.id === di.id) {
  8884. const l = o.params.value;
  8885. n.next(l != null ? l : s);
  8886. }
  8887. });
  8888. return n.next(s), i.dispose;
  8889. }),
  8890. hidden$: oe(r, O.UNIVER_SHEET),
  8891. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }, !0)
  8892. };
  8893. }
  8894. function Ob(r) {
  8895. return {
  8896. id: am.id,
  8897. type: Q.BUTTON,
  8898. title: "toolbar.resetColor",
  8899. icon: "NoColor",
  8900. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  8901. };
  8902. }
  8903. function Ab(r) {
  8904. const e = r.get(F), t = r.get(kt);
  8905. return {
  8906. id: Mo.id,
  8907. tooltip: "toolbar.fillColor.main",
  8908. type: Q.BUTTON_SELECTOR,
  8909. icon: "PaintBucket",
  8910. selections: [
  8911. {
  8912. label: {
  8913. name: Fi,
  8914. hoverable: !1
  8915. }
  8916. }
  8917. ],
  8918. value$: new it((n) => {
  8919. const s = t.getCurrentTheme().primaryColor, i = e.onCommandExecuted((o) => {
  8920. if (o.id === Mo.id) {
  8921. const l = o.params.value;
  8922. n.next(l != null ? l : s);
  8923. }
  8924. });
  8925. return n.next(s), i.dispose;
  8926. }),
  8927. hidden$: oe(r, O.UNIVER_SHEET),
  8928. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  8929. };
  8930. }
  8931. const $u = [
  8932. {
  8933. label: "align.left",
  8934. icon: "LeftJustifyingSingle",
  8935. value: wt.LEFT
  8936. },
  8937. {
  8938. label: "align.center",
  8939. icon: "HorizontallySingle",
  8940. value: wt.CENTER
  8941. },
  8942. {
  8943. label: "align.right",
  8944. icon: "RightJustifyingSingle",
  8945. value: wt.RIGHT
  8946. }
  8947. ];
  8948. function Nb(r) {
  8949. const e = r.get(L), t = r.get($), n = wt.LEFT;
  8950. return {
  8951. id: lc.id,
  8952. icon: $u[0].icon,
  8953. tooltip: "toolbar.horizontalAlignMode.main",
  8954. type: Q.SELECTOR,
  8955. selections: $u,
  8956. value$: xt(e, n, ({ worksheet: s }) => new it((i) => {
  8957. var c;
  8958. const o = r.get(F).onCommandExecuted((d) => {
  8959. var f;
  8960. const u = d.id;
  8961. if (u !== lc.id && u !== He.id && u !== et.id)
  8962. return;
  8963. const h = (f = t.getCurrentLastSelection()) == null ? void 0 : f.primary;
  8964. let m;
  8965. if (h != null) {
  8966. const g = s.getRange(h.startRow, h.startColumn);
  8967. m = g == null ? void 0 : g.getHorizontalAlignment();
  8968. }
  8969. i.next(m != null ? m : n);
  8970. }), l = (c = t.getCurrentLastSelection()) == null ? void 0 : c.primary;
  8971. let a;
  8972. if (l != null) {
  8973. const d = s.getRange(l.startRow, l.startColumn);
  8974. a = d == null ? void 0 : d.getHorizontalAlignment();
  8975. }
  8976. return i.next(a != null ? a : n), o.dispose;
  8977. })),
  8978. hidden$: oe(r, O.UNIVER_SHEET),
  8979. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  8980. };
  8981. }
  8982. const eh = [
  8983. {
  8984. label: "align.top",
  8985. icon: "AlignTopSingle",
  8986. value: an.TOP
  8987. },
  8988. {
  8989. label: "align.middle",
  8990. icon: "VerticalCenterSingle",
  8991. value: an.MIDDLE
  8992. },
  8993. {
  8994. label: "align.bottom",
  8995. icon: "AlignBottomSingle",
  8996. value: an.BOTTOM
  8997. }
  8998. ];
  8999. function Hb(r) {
  9000. const e = r.get(L), t = r.get($), n = an.BOTTOM;
  9001. return {
  9002. id: ac.id,
  9003. icon: eh[2].icon,
  9004. tooltip: "toolbar.verticalAlignMode.main",
  9005. type: Q.SELECTOR,
  9006. selections: eh,
  9007. value$: xt(e, n, ({ worksheet: s }) => new it((i) => {
  9008. var c;
  9009. const o = r.get(F).onCommandExecuted((d) => {
  9010. var f;
  9011. const u = d.id;
  9012. if (u !== ac.id && u !== He.id && u !== et.id)
  9013. return;
  9014. const h = (f = t.getCurrentLastSelection()) == null ? void 0 : f.primary;
  9015. let m;
  9016. if (h != null) {
  9017. const g = s.getRange(h.startRow, h.startColumn);
  9018. m = g == null ? void 0 : g.getVerticalAlignment();
  9019. }
  9020. i.next(m != null ? m : n);
  9021. }), l = (c = t.getCurrentLastSelection()) == null ? void 0 : c.primary;
  9022. let a;
  9023. if (l != null) {
  9024. const d = s.getRange(l.startRow, l.startColumn);
  9025. a = d == null ? void 0 : d.getVerticalAlignment();
  9026. }
  9027. return i.next(a != null ? a : n), o.dispose;
  9028. })),
  9029. hidden$: oe(r, O.UNIVER_SHEET),
  9030. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  9031. };
  9032. }
  9033. const th = [
  9034. {
  9035. label: "textWrap.overflow",
  9036. icon: "OverflowSingle",
  9037. value: Cr.OVERFLOW
  9038. },
  9039. {
  9040. label: "textWrap.wrap",
  9041. icon: "AutowrapSingle",
  9042. value: Cr.WRAP
  9043. },
  9044. {
  9045. label: "textWrap.clip",
  9046. icon: "TruncationSingle",
  9047. value: Cr.CLIP
  9048. }
  9049. ];
  9050. function Vb(r) {
  9051. const e = r.get($), t = r.get(L), n = Cr.OVERFLOW;
  9052. return {
  9053. id: cc.id,
  9054. tooltip: "toolbar.textWrapMode.main",
  9055. icon: th[0].icon,
  9056. type: Q.SELECTOR,
  9057. selections: th,
  9058. value$: xt(t, n, ({ worksheet: s }) => new it((i) => {
  9059. var c;
  9060. const o = r.get(F).onCommandExecuted((d) => {
  9061. var f;
  9062. const u = d.id;
  9063. if (u !== cc.id && u !== He.id && u !== et.id)
  9064. return;
  9065. const h = (f = e.getCurrentLastSelection()) == null ? void 0 : f.primary;
  9066. let m;
  9067. if (h != null) {
  9068. const g = s.getRange(h.startRow, h.startColumn);
  9069. m = g == null ? void 0 : g.getWrapStrategy();
  9070. }
  9071. i.next(m != null ? m : n);
  9072. }), l = (c = e.getCurrentLastSelection()) == null ? void 0 : c.primary;
  9073. let a;
  9074. if (l != null) {
  9075. const d = s.getRange(l.startRow, l.startColumn);
  9076. a = d == null ? void 0 : d.getWrapStrategy();
  9077. }
  9078. return i.next(a != null ? a : n), o.dispose;
  9079. })),
  9080. hidden$: oe(r, O.UNIVER_SHEET),
  9081. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  9082. };
  9083. }
  9084. const nh = [
  9085. {
  9086. label: "textRotate.none",
  9087. icon: "NoRotationSingle",
  9088. value: 0
  9089. },
  9090. {
  9091. label: "textRotate.angleUp",
  9092. icon: "LeftRotationFortyFiveDegreesSingle",
  9093. value: -45
  9094. },
  9095. {
  9096. label: "textRotate.angleDown",
  9097. icon: "RightRotationFortyFiveDegreesSingle",
  9098. value: 45
  9099. },
  9100. {
  9101. label: "textRotate.vertical",
  9102. icon: "VerticalTextSingle",
  9103. value: "v"
  9104. },
  9105. {
  9106. label: "textRotate.rotationUp",
  9107. icon: "LeftRotationNinetyDegreesSingle",
  9108. value: -90
  9109. },
  9110. {
  9111. label: "textRotate.rotationDown",
  9112. icon: "RightRotationNinetyDegreesSingle",
  9113. value: 90
  9114. }
  9115. ];
  9116. function kb(r) {
  9117. const e = r.get($), t = r.get(L), n = 0;
  9118. return {
  9119. id: dc.id,
  9120. tooltip: "toolbar.textRotateMode.main",
  9121. icon: nh[0].icon,
  9122. type: Q.SELECTOR,
  9123. selections: nh,
  9124. value$: xt(t, n, ({ worksheet: s }) => new it((i) => {
  9125. var c, d;
  9126. const o = r.get(F).onCommandExecuted((u) => {
  9127. var g, p;
  9128. const h = u.id;
  9129. if (h !== dc.id && h !== He.id && h !== et.id)
  9130. return;
  9131. const m = (g = e.getCurrentLastSelection()) == null ? void 0 : g.primary;
  9132. let f;
  9133. if (m != null) {
  9134. const S = s.getRange(m.startRow, m.startColumn);
  9135. f = S == null ? void 0 : S.getTextRotation();
  9136. }
  9137. (f == null ? void 0 : f.v) === Qe.TRUE ? i.next("v") : i.next((p = f && f.a) != null ? p : n);
  9138. }), l = (c = e.getCurrentLastSelection()) == null ? void 0 : c.primary;
  9139. let a;
  9140. if (l != null) {
  9141. const u = s.getRange(l.startRow, l.startColumn);
  9142. a = u == null ? void 0 : u.getTextRotation();
  9143. }
  9144. return (a == null ? void 0 : a.v) === Qe.TRUE ? i.next("v") : i.next((d = a && a.a) != null ? d : n), o.dispose;
  9145. })),
  9146. hidden$: oe(r, O.UNIVER_SHEET),
  9147. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] })
  9148. };
  9149. }
  9150. function Ui(r) {
  9151. return new it((t) => t.next(!r.get(wl).supportClipboard));
  9152. }
  9153. function $r(r) {
  9154. return {
  9155. id: hn.name,
  9156. commandId: hn.id,
  9157. type: Q.BUTTON,
  9158. title: "rightClick.copy",
  9159. icon: "Copy",
  9160. disabled$: ue(r, { workbookTypes: [Bs], worksheetTypes: [yo], rangeTypes: [uc] }),
  9161. hidden$: oe(r, O.UNIVER_SHEET)
  9162. };
  9163. }
  9164. function wa(r) {
  9165. return {
  9166. id: mn.name,
  9167. commandId: mn.id,
  9168. type: Q.BUTTON,
  9169. title: "rightClick.paste",
  9170. icon: "PasteSpecial",
  9171. disabled$: Ui(r).pipe(
  9172. ir(ue(r, { rangeTypes: [re], worksheetTypes: [ee, ze, Ut], workbookTypes: [q] })),
  9173. _e(([e, t]) => e || t)
  9174. ),
  9175. hidden$: oe(r, O.UNIVER_SHEET)
  9176. };
  9177. }
  9178. const go = "sheet.menu.paste-special";
  9179. function Ra(r) {
  9180. return {
  9181. id: go,
  9182. type: Q.SUBITEMS,
  9183. icon: "PasteSpecial",
  9184. title: "rightClick.pasteSpecial",
  9185. hidden$: Es(r, oe(r, O.UNIVER_SHEET))
  9186. };
  9187. }
  9188. function Ia(r) {
  9189. return {
  9190. id: Gs.id,
  9191. type: Q.BUTTON,
  9192. title: "rightClick.pasteValue",
  9193. disabled$: Ui(r).pipe(
  9194. ir(ue(r, { rangeTypes: [re], worksheetTypes: [Ut, ee], workbookTypes: [q] })),
  9195. _e(([e, t]) => e || t)
  9196. ),
  9197. hidden$: oe(r, O.UNIVER_SHEET)
  9198. };
  9199. }
  9200. function ya(r) {
  9201. return {
  9202. id: qs.id,
  9203. type: Q.BUTTON,
  9204. title: "rightClick.pasteFormat",
  9205. disabled$: Ui(r).pipe(
  9206. ir(ue(r, { rangeTypes: [re], worksheetTypes: [ze, ee], workbookTypes: [q] })),
  9207. _e(([e, t]) => e || t)
  9208. ),
  9209. hidden$: oe(r, O.UNIVER_SHEET)
  9210. };
  9211. }
  9212. function Ma(r) {
  9213. return {
  9214. id: Jr.id,
  9215. type: Q.BUTTON,
  9216. title: "rightClick.pasteColWidth",
  9217. disabled$: Ui(r).pipe(
  9218. ir(ue(r, { rangeTypes: [re], worksheetTypes: [Or, ee], workbookTypes: [q] })),
  9219. _e(([e, t]) => e || t)
  9220. )
  9221. };
  9222. }
  9223. function Pa(r) {
  9224. return {
  9225. id: Qs.id,
  9226. type: Q.BUTTON,
  9227. title: "rightClick.pasteBesidesBorder",
  9228. disabled$: Ui(r).pipe(
  9229. ir(ue(r, { rangeTypes: [re], worksheetTypes: [ee, ze, Ut, Ar, Or], workbookTypes: [q] })),
  9230. _e(([e, t]) => e || t)
  9231. ),
  9232. hidden$: oe(r, O.UNIVER_SHEET)
  9233. };
  9234. }
  9235. function Db(r) {
  9236. return {
  9237. id: Pl.id,
  9238. type: Q.BUTTON,
  9239. icon: "AutoHeight",
  9240. title: "rightClick.fitContent",
  9241. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Ar, ee], rangeTypes: [re] }),
  9242. hidden$: oe(r, O.UNIVER_SHEET)
  9243. };
  9244. }
  9245. function Lb(r) {
  9246. return {
  9247. id: Ql.id,
  9248. type: Q.BUTTON,
  9249. icon: "AutoWidth",
  9250. title: "rightClick.fitContent",
  9251. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Ar, ee], rangeTypes: [re] }),
  9252. hidden$: oe(r, O.UNIVER_SHEET)
  9253. };
  9254. }
  9255. const Af = "sheet.menu.sheet-frozen";
  9256. function Wb(r) {
  9257. return {
  9258. id: Af,
  9259. type: Q.SUBITEMS,
  9260. title: "rightClick.freeze",
  9261. icon: "FreezeToSelectedSingle",
  9262. hidden$: oe(r, O.UNIVER_SHEET)
  9263. };
  9264. }
  9265. const Oc = "sheet.header-menu.sheet-frozen";
  9266. function rh(r) {
  9267. return {
  9268. id: Oc,
  9269. type: Q.SUBITEMS,
  9270. title: "rightClick.freeze",
  9271. icon: "FreezeToSelectedSingle",
  9272. hidden$: oe(r, O.UNIVER_SHEET)
  9273. };
  9274. }
  9275. function Ea(r) {
  9276. return {
  9277. id: $n.id,
  9278. type: Q.BUTTON,
  9279. title: "rightClick.freeze",
  9280. icon: "FreezeToSelectedSingle",
  9281. // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
  9282. hidden$: oe(r, O.UNIVER_SHEET)
  9283. };
  9284. }
  9285. function Bb(r) {
  9286. return {
  9287. id: Gl.id,
  9288. type: Q.BUTTON,
  9289. title: "rightClick.freezeRow",
  9290. icon: "FreezeRowSingle",
  9291. // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
  9292. hidden$: oe(r, O.UNIVER_SHEET)
  9293. };
  9294. }
  9295. function Fb(r) {
  9296. return {
  9297. id: ql.id,
  9298. type: Q.BUTTON,
  9299. title: "rightClick.freezeCol",
  9300. icon: "FreezeColumnSingle",
  9301. // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
  9302. hidden$: oe(r, O.UNIVER_SHEET)
  9303. };
  9304. }
  9305. function Ta(r) {
  9306. return {
  9307. id: ho.id,
  9308. type: Q.BUTTON,
  9309. title: "rightClick.cancelFreeze",
  9310. icon: "CancelFreezeSingle",
  9311. // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
  9312. hidden$: oe(r, O.UNIVER_SHEET)
  9313. };
  9314. }
  9315. function Ub(r) {
  9316. return {
  9317. id: Ul.id,
  9318. type: Q.BUTTON,
  9319. icon: "Hide",
  9320. title: "rightClick.hideSelectedRow",
  9321. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Ar, ee], rangeTypes: [re] }),
  9322. hidden$: oe(r, O.UNIVER_SHEET)
  9323. };
  9324. }
  9325. function jb(r) {
  9326. return {
  9327. id: jl.id,
  9328. type: Q.BUTTON,
  9329. icon: "Hide",
  9330. title: "rightClick.hideSelectedColumn",
  9331. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, Or], rangeTypes: [re] }),
  9332. hidden$: oe(r, O.UNIVER_SHEET)
  9333. };
  9334. }
  9335. function Xb(r) {
  9336. const e = r.get(L), t = r.get($), n = r.get(F), s = [He, Sd, Cd].map((i) => i.id);
  9337. return {
  9338. id: cm.id,
  9339. type: Q.BUTTON,
  9340. title: "rightClick.showHideRow",
  9341. hidden$: xt(e, !0, ({ worksheet: i }) => new it((o) => {
  9342. function l() {
  9343. var d;
  9344. const c = (d = t.getCurrentSelections()) == null ? void 0 : d.map((u) => u.range).filter((u) => u.rangeType === j.ROW);
  9345. return !!(c != null && c.some((u) => {
  9346. for (let h = u.startRow; h <= u.endRow; h++)
  9347. if (!i.getRowRawVisible(h)) return !0;
  9348. return !1;
  9349. }));
  9350. }
  9351. const a = n.onCommandExecuted((c) => {
  9352. s.findIndex((d) => d === c.id) !== -1 && o.next(!l());
  9353. });
  9354. return o.next(!l()), () => a.dispose();
  9355. })),
  9356. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, Ar], rangeTypes: [re] })
  9357. };
  9358. }
  9359. function zb(r) {
  9360. const e = r.get(L), t = r.get($), n = r.get(F), s = [He, vd, bd].map((i) => i.id);
  9361. return {
  9362. id: dm.id,
  9363. type: Q.BUTTON,
  9364. title: "rightClick.showHideColumn",
  9365. hidden$: xt(e, !0, ({ worksheet: i }) => new it((o) => {
  9366. function l() {
  9367. var d;
  9368. const c = (d = t.getCurrentSelections()) == null ? void 0 : d.map((u) => u.range).filter((u) => u.rangeType === j.COLUMN);
  9369. return !c || c.length === 0 ? !1 : !!c.some((u) => {
  9370. for (let h = u.startColumn; h <= u.endColumn; h++)
  9371. if (!i.getColVisible(h)) return !0;
  9372. return !1;
  9373. });
  9374. }
  9375. const a = n.onCommandExecuted((c) => {
  9376. s.findIndex((d) => d === c.id) !== -1 && o.next(!l());
  9377. });
  9378. return o.next(!l()), () => a.dispose();
  9379. })),
  9380. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Or, ee], rangeTypes: [re] })
  9381. };
  9382. }
  9383. function Yb(r) {
  9384. const e = r.get(F), t = r.get(L), n = r.get($), s = 0;
  9385. return {
  9386. id: um.id,
  9387. type: Q.BUTTON,
  9388. icon: "AdjustHeight",
  9389. label: {
  9390. name: Kl,
  9391. props: {
  9392. prefix: "rightClick.rowHeight",
  9393. suffix: "px",
  9394. min: 2,
  9395. max: 1e3
  9396. }
  9397. },
  9398. value$: xt(t, s, ({ worksheet: i }) => new it((o) => {
  9399. function l() {
  9400. var u;
  9401. const c = (u = n.getCurrentLastSelection()) == null ? void 0 : u.primary, d = c ? i.getRowHeight(c.startRow) : s;
  9402. o.next(d);
  9403. }
  9404. const a = e.onCommandExecuted((c) => {
  9405. const d = c.id;
  9406. if (d === Se.id || d === He.id || d === hm.id)
  9407. return l();
  9408. });
  9409. return l(), a.dispose;
  9410. })),
  9411. hidden$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, Ar], rangeTypes: [re] })
  9412. };
  9413. }
  9414. function Zb(r) {
  9415. const e = r.get(F), t = r.get(L), n = r.get($), s = 0;
  9416. return {
  9417. id: mm.id,
  9418. type: Q.BUTTON,
  9419. icon: "AdjustWidth",
  9420. label: {
  9421. name: Kl,
  9422. props: {
  9423. prefix: "rightClick.columnWidth",
  9424. suffix: "px",
  9425. min: 2,
  9426. max: 1e3
  9427. }
  9428. },
  9429. value$: xt(t, s, ({ worksheet: i }) => new it((o) => {
  9430. function l() {
  9431. var u;
  9432. const c = (u = n.getCurrentLastSelection()) == null ? void 0 : u.primary;
  9433. let d = s;
  9434. c != null && (d = i.getColumnWidth(c.startColumn)), o.next(d);
  9435. }
  9436. const a = e.onCommandExecuted((c) => {
  9437. const d = c.id;
  9438. if (d === Se.id || d === He.id || d === Qt.id)
  9439. return l();
  9440. });
  9441. return l(), a.dispose;
  9442. })),
  9443. hidden$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, Or], rangeTypes: [re] })
  9444. };
  9445. }
  9446. function ji(r) {
  9447. var a;
  9448. const e = r.get(L), t = r.get(yd), n = e.getUniverDocInstance(Le), s = t.getActiveTextRange();
  9449. if (n == null || s == null) return null;
  9450. const i = (a = n.getBody()) == null ? void 0 : a.textRuns;
  9451. if (i == null) return;
  9452. const { startOffset: o } = s;
  9453. return i.find(({ st: c, ed: d }) => o >= c && o <= d);
  9454. }
  9455. var Gb = Object.defineProperty, qb = Object.getOwnPropertyDescriptor, Qb = (r, e, t, n) => {
  9456. for (var s = n > 1 ? void 0 : n ? qb(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  9457. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  9458. return n && s && Gb(e, t, s), s;
  9459. }, cr = (r, e) => (t, n) => e(t, n, r);
  9460. const Kb = "__SpreadsheetFreezeRowMainName__", Jb = "__SpreadsheetFreezeRowHeaderName__", $b = "__SpreadsheetFreezeColumnMainName__", e_ = "__SpreadsheetFreezeColumnHeaderName__", xa = 2, t_ = 0.01, Hs = sr("freezePermissionCheck");
  9461. let hi = class extends ce {
  9462. constructor(e, t, n, s, i, o, l, a) {
  9463. super();
  9464. w(this, "_rowFreezeHeaderRect");
  9465. w(this, "_rowFreezeMainRect");
  9466. w(this, "_columnFreezeHeaderRect");
  9467. w(this, "_columnFreezeMainRect");
  9468. w(this, "_freezeDownSubs");
  9469. w(this, "_freezePointerEnterSubs");
  9470. w(this, "_freezePointerLeaveSubs");
  9471. w(this, "_scenePointerMoveSub");
  9472. w(this, "_scenePointerUpSub");
  9473. w(this, "_changeToRow", -1);
  9474. w(this, "_changeToColumn", -1);
  9475. w(this, "_changeToOffsetX", 0);
  9476. w(this, "_changeToOffsetY", 0);
  9477. w(this, "_activeViewport", null);
  9478. w(this, "_freezeNormalHeaderColor", "");
  9479. w(this, "_freezeNormalMainColor", "");
  9480. w(this, "_freezeActiveColor", "");
  9481. w(this, "_freezeHoverColor", "");
  9482. w(this, "_lastFreeze");
  9483. w(this, "interceptor", new Cs({ FREEZE_PERMISSION_CHECK: Hs }));
  9484. this._context = e, this._sheetSkeletonManagerService = t, this._commandService = n, this._selectionManagerService = s, this._scrollManagerService = i, this._themeService = o, this._sheetInterceptorService = l, this._injector = a, this._initialize();
  9485. }
  9486. dispose() {
  9487. super.dispose();
  9488. }
  9489. _initialize() {
  9490. this._skeletonListener(), this._commandExecutedListener(), this._themeChangeListener(), this._interceptorCommands(), this._bindViewportScroll(), this._zoomRefresh();
  9491. }
  9492. // eslint-disable-next-line max-lines-per-function
  9493. _createFreeze(e = 0, t) {
  9494. var y;
  9495. const n = t != null ? t : this._getFreeze();
  9496. if (n == null) return null;
  9497. const s = (y = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : y.skeleton, { startRow: i, startColumn: o } = n, l = this._getPositionByIndex(i, o);
  9498. if (l == null || s == null) return null;
  9499. const a = this._getSheetObject(), c = a.engine, d = (c == null ? void 0 : c.width) || 0, u = (c == null ? void 0 : c.height) || 0, h = a.scene, { startX: m, startY: f } = l, { rowTotalHeight: g, columnTotalWidth: p, rowHeaderWidthAndMarginLeft: S, columnHeaderHeightAndMarginTop: b } = s, v = d > p + S ? d : p + b, _ = u > g + b ? u : g + b;
  9500. this._changeToRow = i, this._changeToColumn = o, this._changeToOffsetX = m, this._changeToOffsetY = f;
  9501. const R = Math.max(h.scaleX, h.scaleY);
  9502. let I = xa / (R < 1 ? 1 : R);
  9503. if (e === 0) {
  9504. (i === -1 || i === 0) && (I = I * 2);
  9505. const M = I;
  9506. this._rowFreezeHeaderRect = new ge(Jb, {
  9507. fill: this._freezeNormalHeaderColor,
  9508. width: S,
  9509. height: I,
  9510. left: 0,
  9511. top: f - M,
  9512. zIndex: 3
  9513. });
  9514. let P = this._freezeNormalHeaderColor;
  9515. (i === -1 || i === 0) && (P = this._freezeNormalMainColor), this._rowFreezeMainRect = new ge(Kb, {
  9516. fill: P,
  9517. width: v * 2 / R,
  9518. height: I,
  9519. left: S,
  9520. top: f - M,
  9521. zIndex: 3
  9522. }), h.addObjects([this._rowFreezeHeaderRect, this._rowFreezeMainRect], rr);
  9523. } else {
  9524. (o === -1 || o === 0) && (I = I * 2);
  9525. const M = I;
  9526. this._columnFreezeHeaderRect = new ge(e_, {
  9527. fill: this._freezeNormalHeaderColor,
  9528. width: I,
  9529. height: b,
  9530. left: m - M,
  9531. top: 0,
  9532. zIndex: 3
  9533. });
  9534. let P = this._freezeNormalHeaderColor;
  9535. (o === -1 || o === 0) && (P = this._freezeNormalMainColor), this._columnFreezeMainRect = new ge($b, {
  9536. fill: P,
  9537. width: I,
  9538. height: _ * 2 / R,
  9539. left: m - M,
  9540. top: b,
  9541. zIndex: 3
  9542. }), h.addObjects([this._columnFreezeHeaderRect, this._columnFreezeMainRect], rr);
  9543. }
  9544. this._eventBinding(e);
  9545. }
  9546. // eslint-disable-next-line max-lines-per-function
  9547. _eventBinding(e = 0) {
  9548. let t = this._rowFreezeHeaderRect, n = this._rowFreezeMainRect;
  9549. e === 1 && (t = this._columnFreezeHeaderRect, n = this._columnFreezeMainRect);
  9550. const s = this._getSheetObject();
  9551. if (s == null)
  9552. return;
  9553. const { scene: i } = s;
  9554. if (this._freezePointerEnterSubs = new Kn(), this._freezePointerLeaveSubs = new Kn(), this._freezeDownSubs = new Kn(), n) {
  9555. const a = n.onPointerEnter$.subscribeEvent(() => {
  9556. if (!this.interceptor.fetchThroughInterceptors(Hs)(!0, null))
  9557. return !1;
  9558. t == null || t.setProps({
  9559. fill: this._freezeHoverColor,
  9560. zIndex: 4
  9561. }), i.setCursor(Re.GRAB);
  9562. });
  9563. this._freezePointerEnterSubs.add(a);
  9564. const c = n.onPointerLeave$.subscribeEvent(() => {
  9565. t == null || t.setProps({
  9566. fill: this._freezeNormalHeaderColor,
  9567. zIndex: 3
  9568. }), i.resetCursor();
  9569. });
  9570. this._freezePointerLeaveSubs.add(c);
  9571. }
  9572. if (t) {
  9573. const a = t.onPointerEnter$.subscribeEvent(() => {
  9574. if (!this.interceptor.fetchThroughInterceptors(Hs)(!0, null))
  9575. return !1;
  9576. t == null || t.setProps({
  9577. fill: this._freezeHoverColor,
  9578. zIndex: 4
  9579. }), i.setCursor(Re.GRAB);
  9580. });
  9581. this._freezePointerEnterSubs.add(a);
  9582. const c = t.onPointerLeave$.subscribeEvent(() => {
  9583. t == null || t.setProps({
  9584. fill: this._freezeNormalHeaderColor,
  9585. zIndex: 3
  9586. }), i.resetCursor();
  9587. });
  9588. this._freezePointerLeaveSubs.add(c);
  9589. }
  9590. const o = t == null ? void 0 : t.onPointerDown$.subscribeEvent((a) => {
  9591. this._freezeDown(a, t, n, e);
  9592. });
  9593. o && this._freezeDownSubs.add(o);
  9594. const l = n == null ? void 0 : n.onPointerDown$.subscribeEvent((a) => {
  9595. this._freezeDown(a, t, n, e);
  9596. });
  9597. l && this._freezeDownSubs.add(l);
  9598. }
  9599. // eslint-disable-next-line complexity
  9600. _getCurrentLastVisible() {
  9601. var p, S, b, v, _, R, I;
  9602. const e = this._getSheetObject();
  9603. if (e == null)
  9604. return;
  9605. const t = (p = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : p.skeleton;
  9606. if (t == null)
  9607. return;
  9608. const n = e.scene, s = Math.max(n.scaleX, n.scaleY), i = this._scrollManagerService.getCurrentScrollState(), o = (e.engine.height - t.columnHeaderHeight) / s, l = (e.engine.width - t.rowHeaderWidth) / s, a = (S = i == null ? void 0 : i.sheetViewStartRow) != null ? S : 0, c = a === 0 ? -((b = i == null ? void 0 : i.offsetY) != null ? b : 0) : t.rowHeightAccumulation[a - 1] - ((v = i == null ? void 0 : i.offsetY) != null ? v : 0);
  9609. let d = 0, u = !1;
  9610. for (let y = a, M = t.rowHeightAccumulation.length; y < M; y++)
  9611. if (t.rowHeightAccumulation[y] - c > o) {
  9612. d = y, u = !0;
  9613. break;
  9614. }
  9615. u || (d = t.rowHeightAccumulation.length - 1);
  9616. const h = (_ = i == null ? void 0 : i.sheetViewStartColumn) != null ? _ : 0, m = h === 0 ? -((R = i == null ? void 0 : i.offsetX) != null ? R : 0) : t.columnWidthAccumulation[h - 1] - ((I = i == null ? void 0 : i.offsetX) != null ? I : 0);
  9617. let f = 0, g = !1;
  9618. for (let y = h, M = t.columnWidthAccumulation.length; y < M; y++)
  9619. if (t.columnWidthAccumulation[y] - m > l) {
  9620. f = y, g = !0;
  9621. break;
  9622. }
  9623. return g || (f = t.columnWidthAccumulation.length - 1), { lastRow: d, lastColumn: f };
  9624. }
  9625. _getActiveViewport(e) {
  9626. var n;
  9627. const t = (n = this._getSheetObject()) == null ? void 0 : n.scene.getViewports();
  9628. return t && t.find((s) => s.isHit(new Oe(e.offsetX, e.offsetY))) || null;
  9629. }
  9630. // eslint-disable-next-line max-lines-per-function
  9631. _freezeDown(e, t, n, s = 0) {
  9632. var m;
  9633. const i = (m = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton;
  9634. if (i == null)
  9635. return;
  9636. const o = this._getSheetObject();
  9637. if (o == null)
  9638. return;
  9639. if (!this.interceptor.fetchThroughInterceptors(Hs)(!0, null))
  9640. return !1;
  9641. const { scene: a } = o;
  9642. a.setCursor(Re.GRABBING), a.disableObjectsEvent();
  9643. const c = this._getCurrentLastVisible(), d = c === void 0 ? Number.POSITIVE_INFINITY : i.rowHeightAccumulation[c.lastRow], u = c === void 0 ? Number.POSITIVE_INFINITY : i.columnWidthAccumulation[c.lastColumn - 1] + i.rowHeaderWidth;
  9644. this._activeViewport = null;
  9645. const h = this._getFreeze();
  9646. h && (this._changeToColumn = h.startColumn, this._changeToRow = h.startRow), this._scenePointerMoveSub = a.onPointerMove$.subscribeEvent((f) => {
  9647. var I, y, M, P;
  9648. const g = this._getActiveViewport(f), { startX: p, startY: S, row: b, column: v } = Nn(
  9649. f.offsetX,
  9650. f.offsetY,
  9651. a,
  9652. i,
  9653. g || void 0,
  9654. !0
  9655. );
  9656. if (!this.interceptor.fetchThroughInterceptors(Hs)(!0, null))
  9657. return !1;
  9658. a.setCursor(Re.GRABBING);
  9659. const R = xa / Math.max(a.scaleX, a.scaleY);
  9660. s === 0 ? ((I = t.transformByState({
  9661. top: Math.min(S, d) - R / 2
  9662. })) == null || I.setProps({
  9663. fill: this._freezeActiveColor
  9664. }), (y = n.transformByState({
  9665. top: Math.min(S, d) - R / 2
  9666. })) == null || y.setProps({
  9667. fill: this._freezeNormalHeaderColor
  9668. }), this._changeToRow = c === void 0 ? b : Math.min(b, c.lastRow), this._changeToOffsetY = Math.min(S, d), this._activeViewport = g) : ((M = t.transformByState({
  9669. left: Math.min(p, u) - R / 2
  9670. })) == null || M.setProps({
  9671. fill: this._freezeActiveColor
  9672. }), (P = n.transformByState({
  9673. left: Math.min(p, u) - R / 2
  9674. })) == null || P.setProps({
  9675. fill: this._freezeNormalHeaderColor
  9676. }), this._changeToColumn = c === void 0 ? v : Math.min(v, c.lastColumn), this._changeToOffsetX = p, this._activeViewport = g);
  9677. }), this._scenePointerUpSub = a.onPointerUp$.subscribeEvent(() => {
  9678. var E, T;
  9679. a.resetCursor(), a.enableObjectsEvent(), this._clearObserverEvent();
  9680. const { rowHeaderWidthAndMarginLeft: f, columnHeaderHeightAndMarginTop: g } = i;
  9681. s === 0 && (this._changeToRow === 0 || this._changeToRow === -1) || s === 1 && (this._changeToColumn === 0 || this._changeToColumn === -1) ? (t.setProps({
  9682. fill: this._freezeNormalHeaderColor
  9683. }), n.setProps({
  9684. fill: this._freezeNormalMainColor
  9685. })) : (t == null || t.setProps({
  9686. fill: this._freezeNormalHeaderColor
  9687. }), n == null || n.setProps({
  9688. fill: this._freezeNormalHeaderColor
  9689. }));
  9690. const p = xa / Math.max(a.scaleX, a.scaleY);
  9691. s === 0 ? (this._changeToRow === 0 || this._changeToRow === -1) && (t.transformByState({
  9692. top: g - p
  9693. }), n.transformByState({
  9694. top: g - p
  9695. })) : (this._changeToColumn === 0 || this._changeToColumn === -1) && (t.transformByState({
  9696. left: f - p
  9697. }), n.transformByState({
  9698. left: f - p
  9699. }));
  9700. const S = this._scrollManagerService.getCurrentScrollState() || {
  9701. sheetViewStartRow: 0,
  9702. sheetViewStartColumn: 0
  9703. }, { sheetViewStartRow: b, sheetViewStartColumn: v } = S;
  9704. if (v == null || b == null)
  9705. return;
  9706. const _ = this._context.unit, R = _.getActiveSheet();
  9707. if (!R) return;
  9708. const I = (E = R.getConfig()) == null ? void 0 : E.freeze;
  9709. let y = (I == null ? void 0 : I.xSplit) || 0, M = (I == null ? void 0 : I.ySplit) || 0;
  9710. const P = (T = this._activeViewport) == null ? void 0 : T.viewportKey;
  9711. s === 0 && (!P || P === z.VIEW_LEFT_TOP || P === z.VIEW_MAIN_LEFT_TOP || P === z.VIEW_MAIN_TOP || P === z.VIEW_ROW_TOP ? M = this._changeToRow - (I.startRow - I.ySplit) : M = this._changeToRow - b, M = M < 0 ? 0 : M), s === 1 && (!P || P === z.VIEW_LEFT_TOP || P === z.VIEW_MAIN_LEFT_TOP || P === z.VIEW_MAIN_LEFT || P === z.VIEW_COLUMN_LEFT ? y = this._changeToColumn - (I.startColumn - I.xSplit) : y = this._changeToColumn - v, y = y < 0 ? 0 : y), this._commandService.executeCommand(VS.id, {
  9712. startRow: M === 0 ? -1 : this._changeToRow,
  9713. startColumn: y === 0 ? -1 : this._changeToColumn,
  9714. ySplit: M,
  9715. xSplit: y,
  9716. unitId: _.getUnitId(),
  9717. subUnitId: R.getSheetId()
  9718. });
  9719. });
  9720. }
  9721. _getViewports() {
  9722. const e = this._getSheetObject();
  9723. if (e == null)
  9724. return;
  9725. const { scene: t } = e, n = t.getViewport(z.VIEW_COLUMN_LEFT), s = t.getViewport(z.VIEW_COLUMN_RIGHT), i = t.getViewport(z.VIEW_ROW_TOP), o = t.getViewport(z.VIEW_ROW_BOTTOM), l = t.getViewport(z.VIEW_LEFT_TOP), a = t.getViewport(z.VIEW_MAIN), c = t.getViewport(z.VIEW_MAIN_LEFT_TOP), d = t.getViewport(z.VIEW_MAIN_LEFT), u = t.getViewport(z.VIEW_MAIN_TOP);
  9726. if (!(n == null || s == null || i == null || o == null || l == null || a == null || c == null || d == null || u == null))
  9727. return {
  9728. viewMain: a,
  9729. viewMainLeftTop: c,
  9730. viewMainLeft: d,
  9731. viewMainTop: u,
  9732. viewColumnLeft: n,
  9733. viewColumnRight: s,
  9734. viewRowTop: i,
  9735. viewRowBottom: o,
  9736. viewLeftTop: l
  9737. };
  9738. }
  9739. _bindViewportScroll() {
  9740. const e = this._getViewports();
  9741. if (!e)
  9742. return;
  9743. const { viewRowBottom: t, viewColumnRight: n, viewMainLeft: s, viewMainTop: i } = e;
  9744. this.disposeWithMe(
  9745. this._scrollManagerService.validViewportScrollInfo$.subscribe((o) => {
  9746. if (!o) return;
  9747. const { scrollX: l, scrollY: a, viewportScrollX: c, viewportScrollY: d } = o;
  9748. t.isActive && t.updateScrollVal({
  9749. scrollY: a,
  9750. viewportScrollY: d
  9751. }), n.isActive && n.updateScrollVal({
  9752. scrollX: l,
  9753. viewportScrollX: c
  9754. }), s.isActive && s.updateScrollVal({
  9755. scrollY: a,
  9756. viewportScrollY: d
  9757. }), i.isActive && i.updateScrollVal({
  9758. scrollX: l,
  9759. viewportScrollX: c
  9760. });
  9761. })
  9762. );
  9763. }
  9764. // eslint-disable-next-line max-lines-per-function, complexity
  9765. _updateViewport(e = -1, t = -1, n = 0, s = 0, i = 3) {
  9766. var y;
  9767. const o = (y = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : y.skeleton;
  9768. if (o == null)
  9769. return;
  9770. const { rowHeaderWidthAndMarginLeft: l, columnHeaderHeightAndMarginTop: a } = o, c = this._getViewports();
  9771. if (!c)
  9772. return;
  9773. const {
  9774. viewMain: d,
  9775. viewMainLeftTop: u,
  9776. viewMainLeft: h,
  9777. viewMainTop: m,
  9778. viewColumnLeft: f,
  9779. viewColumnRight: g,
  9780. viewRowTop: p,
  9781. viewRowBottom: S,
  9782. viewLeftTop: b
  9783. } = c;
  9784. g.resizeWhenFreezeChange({
  9785. left: l,
  9786. top: 0,
  9787. height: a,
  9788. right: 0
  9789. }), S.resizeWhenFreezeChange({
  9790. left: 0,
  9791. top: a,
  9792. bottom: 0,
  9793. width: l
  9794. }), b.resizeWhenFreezeChange({
  9795. left: 0,
  9796. top: 0,
  9797. width: l,
  9798. height: a
  9799. });
  9800. let v = !0, _ = !0;
  9801. u.enable(), (e === -1 || e === 0) && (v = !1), (t === -1 || t === 0) && (_ = !1);
  9802. const R = o.getNoMergeCellPositionByIndexWithNoHeader(e - n, t - s), I = o.getNoMergeCellPositionByIndexWithNoHeader(e, t);
  9803. if (u.disable(), m.disable(), h.disable(), p.disable(), f.disable(), u.resetPadding(), m.resetPadding(), h.resetPadding(), p.resetPadding(), f.resetPadding(), v === !1 && _ === !1)
  9804. d.resizeWhenFreezeChange({
  9805. left: l,
  9806. top: a,
  9807. bottom: 0,
  9808. right: 0
  9809. }), d.resetPadding();
  9810. else if (v === !0 && _ === !1) {
  9811. const M = I.startY - R.startY;
  9812. d.resizeWhenFreezeChange({
  9813. left: l,
  9814. top: a + M,
  9815. bottom: 0,
  9816. right: 0
  9817. }), d.setPadding({
  9818. startY: R.startY,
  9819. endY: I.startY,
  9820. startX: 0,
  9821. endX: 0
  9822. }), i & 2 && this._commandService.executeCommand(un.id, {
  9823. sheetViewStartRow: 0,
  9824. offsetY: 0
  9825. }), m.resizeWhenFreezeChange({
  9826. left: l,
  9827. top: a,
  9828. height: M,
  9829. right: 0
  9830. }), m.updateScrollVal({
  9831. viewportScrollY: R.startY,
  9832. rawScrollX: d.scrollX,
  9833. viewportScrollX: d.viewportScrollX
  9834. }), p.resizeWhenFreezeChange({
  9835. left: 0,
  9836. top: a,
  9837. width: l,
  9838. height: M
  9839. }), p.updateScrollVal({
  9840. viewportScrollY: R.startY
  9841. }), S.resizeWhenFreezeChange({
  9842. left: 0,
  9843. top: a + M,
  9844. bottom: 0,
  9845. width: l
  9846. }), m.enable(), p.enable();
  9847. } else if (v === !1 && _ === !0) {
  9848. const M = I.startX - R.startX;
  9849. d.resizeWhenFreezeChange({
  9850. left: l + M,
  9851. top: a,
  9852. bottom: 0,
  9853. right: 0
  9854. }), d.setPadding({
  9855. startX: R.startX,
  9856. endX: I.startX,
  9857. startY: 0,
  9858. endY: 0
  9859. }), i & 1 && this._commandService.executeCommand(un.id, {
  9860. sheetViewStartColumn: 0,
  9861. offsetX: 0
  9862. }), h.resizeWhenFreezeChange({
  9863. left: l,
  9864. top: a,
  9865. width: M,
  9866. bottom: 0,
  9867. right: 0
  9868. }), h.updateScrollVal({
  9869. viewportScrollX: R.startX,
  9870. rawScrollY: d.scrollY,
  9871. viewportScrollY: d.viewportScrollY
  9872. }), f.resizeWhenFreezeChange({
  9873. left: l,
  9874. top: 0,
  9875. width: M,
  9876. height: a
  9877. }), f.updateScrollVal({
  9878. viewportScrollX: R.startX
  9879. }), g.resizeWhenFreezeChange({
  9880. left: l + M,
  9881. top: 0,
  9882. height: a,
  9883. right: 0
  9884. }), h.enable(), f.enable();
  9885. } else {
  9886. const M = I.startX - R.startX, P = I.startY - R.startY;
  9887. d.resizeWhenFreezeChange({
  9888. left: l + M,
  9889. top: a + P,
  9890. bottom: 0,
  9891. right: 0
  9892. }), d.setPadding({
  9893. startY: R.startY,
  9894. endY: I.startY,
  9895. startX: R.startX,
  9896. endX: I.startX
  9897. }), i && this._commandService.executeCommand(un.id, {
  9898. ...i & 1 ? {
  9899. sheetViewStartColumn: 0,
  9900. offsetX: 0
  9901. } : null,
  9902. ...i & 2 ? {
  9903. sheetViewStartRow: 0,
  9904. offsetY: 0
  9905. } : null
  9906. }), h.resizeWhenFreezeChange({
  9907. left: l,
  9908. top: a + P,
  9909. width: M,
  9910. bottom: 0
  9911. }), h.updateScrollVal({
  9912. viewportScrollX: R.startX,
  9913. rawScrollY: d.scrollY,
  9914. viewportScrollY: d.viewportScrollY
  9915. }), m.resizeWhenFreezeChange({
  9916. left: l + M,
  9917. top: a,
  9918. height: P,
  9919. right: 0
  9920. }), m.updateScrollVal({
  9921. viewportScrollY: R.startY,
  9922. rawScrollX: d.scrollX,
  9923. viewportScrollX: d.viewportScrollX
  9924. }), u.resizeWhenFreezeChange({
  9925. left: l,
  9926. top: a,
  9927. width: M,
  9928. height: P
  9929. }), u.updateScrollVal({
  9930. viewportScrollX: R.startX,
  9931. viewportScrollY: R.startY
  9932. }), p.resizeWhenFreezeChange({
  9933. left: 0,
  9934. top: a,
  9935. width: l,
  9936. height: P
  9937. }), p.updateScrollVal({
  9938. viewportScrollY: R.startY
  9939. }), S.resizeWhenFreezeChange({
  9940. left: 0,
  9941. top: a + P,
  9942. bottom: 0,
  9943. width: l
  9944. }), f.resizeWhenFreezeChange({
  9945. left: l,
  9946. top: 0,
  9947. width: M,
  9948. height: a
  9949. }), f.updateScrollVal({
  9950. viewportScrollX: R.startX
  9951. }), g.resizeWhenFreezeChange({
  9952. left: l + M,
  9953. top: 0,
  9954. height: a,
  9955. right: 0
  9956. }), u.enable(), m.enable(), h.enable(), p.enable(), f.enable();
  9957. }
  9958. }
  9959. /**
  9960. * When switching sheet tabs, it is necessary to update the frozen state of the current view.
  9961. */
  9962. _skeletonListener() {
  9963. this.disposeWithMe(
  9964. Ae(
  9965. this._sheetSkeletonManagerService.currentSkeleton$.subscribe((e) => {
  9966. [
  9967. et.id,
  9968. hc.id,
  9969. mc.id
  9970. ].includes((e == null ? void 0 : e.commandId) || "") && this._refreshCurrent();
  9971. })
  9972. )
  9973. );
  9974. }
  9975. _refreshCurrent() {
  9976. const t = this._context.unit.getActiveSheet();
  9977. if (!t) return;
  9978. const n = t.getConfig().freeze, { startRow: s = -1, startColumn: i = -1, ySplit: o = 0, xSplit: l = 0 } = n;
  9979. this._refreshFreeze(
  9980. s,
  9981. i,
  9982. o,
  9983. l,
  9984. 0
  9985. /* NONE */
  9986. );
  9987. }
  9988. _themeChangeListener() {
  9989. this._themeChange(this._themeService.getCurrentTheme()), this.disposeWithMe(
  9990. this._themeService.currentTheme$.subscribe((e) => {
  9991. this._clearFreeze(), this._themeChange(e), this._refreshCurrent();
  9992. })
  9993. );
  9994. }
  9995. _themeChange(e) {
  9996. this._freezeNormalHeaderColor = e.grey400, this._freezeNormalMainColor = new Tn(e.grey400).setAlpha(t_).toRgbString(), this._freezeActiveColor = e.primaryColor, this._freezeHoverColor = e.grey500;
  9997. }
  9998. // eslint-disable-next-line max-lines-per-function
  9999. _interceptorCommands() {
  10000. this.disposeWithMe(
  10001. this._sheetInterceptorService.interceptCommand({
  10002. // eslint-disable-next-line complexity, max-lines-per-function
  10003. getMutations: (e) => {
  10004. const t = {
  10005. redos: [],
  10006. undos: []
  10007. }, n = this._getFreeze();
  10008. if (!n)
  10009. return t;
  10010. const s = (i) => {
  10011. const o = this._context.unit, l = o.getUnitId(), a = o.getActiveSheet();
  10012. if (!a)
  10013. return t;
  10014. const c = a.getSheetId();
  10015. this._refreshFreeze(
  10016. i.startRow,
  10017. i.startColumn,
  10018. i.ySplit,
  10019. i.xSplit,
  10020. 0
  10021. /* NONE */
  10022. );
  10023. const d = {
  10024. ...i,
  10025. unitId: l,
  10026. subUnitId: c,
  10027. resetScroll: !1
  10028. }, u = lm(this._injector, d);
  10029. return {
  10030. undos: [{ id: vr.id, params: u }],
  10031. redos: [{ id: vr.id, params: d }]
  10032. };
  10033. };
  10034. if (e.id === kS.id) {
  10035. const i = e.params, { range: o, direction: l } = i, a = o.endRow - o.startRow + 1;
  10036. if (o.startRow + 1 < n.startRow || o.startRow + 1 === n.startRow && l === B.UP) {
  10037. const c = {
  10038. ...n,
  10039. startRow: Math.max(1, n.startRow + a),
  10040. ySplit: Math.max(1, n.ySplit + a)
  10041. };
  10042. return s(c);
  10043. }
  10044. }
  10045. if (e.id === DS.id) {
  10046. const i = e.params, { range: o, direction: l } = i, a = o.endColumn - o.startColumn + 1;
  10047. if (o.startColumn + 1 < n.startColumn || o.startColumn + 1 === n.startColumn && l === B.LEFT) {
  10048. const c = {
  10049. ...n,
  10050. startColumn: Math.max(1, n.startColumn + a),
  10051. xSplit: Math.max(1, n.xSplit + a)
  10052. };
  10053. return s(c);
  10054. }
  10055. }
  10056. if (e.id === fm.id) {
  10057. const i = this._selectionManagerService.getCurrentSelections(), {
  10058. fromRange: { startColumn: o },
  10059. toRange: { startColumn: l }
  10060. } = e.params, a = i == null ? void 0 : i.filter(
  10061. (p) => p.range.rangeType === j.COLUMN && p.range.startColumn <= o && o <= p.range.endColumn
  10062. );
  10063. if (!(a != null && a.length))
  10064. return t;
  10065. const c = a[0].range, d = {
  10066. ...c,
  10067. startColumn: l,
  10068. endColumn: l + c.endColumn - c.startColumn
  10069. };
  10070. if (!n || n.startColumn <= 0 || // move out of freeze
  10071. c.startColumn >= n.startColumn && d.startColumn >= n.startColumn || // not move
  10072. c.startColumn === d.startColumn || // move in freeze range
  10073. c.endColumn < n.startColumn && d.startColumn < n.startColumn)
  10074. return t;
  10075. const u = c.endColumn - c.startColumn + 1, h = Math.max(
  10076. Math.min(n.startColumn, c.endColumn + 1) - c.startColumn,
  10077. 0
  10078. );
  10079. let m, f;
  10080. d.startColumn >= n.startColumn ? (m = Math.max(n.startColumn - h, 1), f = Math.max(n.xSplit - h, 1)) : (m = n.startColumn + u - h, f = n.xSplit + u - h);
  10081. const g = {
  10082. ...n,
  10083. startColumn: m,
  10084. xSplit: f
  10085. };
  10086. return s(g);
  10087. }
  10088. if (e.id === gm.id) {
  10089. const i = this._selectionManagerService.getCurrentSelections(), {
  10090. fromRange: { startRow: o },
  10091. toRange: { startRow: l }
  10092. } = e.params, a = i == null ? void 0 : i.filter(
  10093. (p) => p.range.rangeType === j.ROW && p.range.startRow <= o && o <= p.range.endRow
  10094. );
  10095. if (!(a != null && a.length))
  10096. return t;
  10097. const c = a[0].range, d = {
  10098. ...c,
  10099. startRow: l,
  10100. endRow: l + c.endRow - c.startRow
  10101. };
  10102. if (!n || n.startRow <= 0 || // move out of freeze
  10103. c.startRow >= n.startRow && d.startRow >= n.startRow || // not move
  10104. c.startRow === d.startRow || // move in freeze range
  10105. c.endRow < n.startRow && d.startRow < n.startRow)
  10106. return t;
  10107. const u = c.endRow - c.startRow + 1, h = Math.max(
  10108. Math.min(n.startRow, c.endRow + 1) - c.startRow,
  10109. 0
  10110. );
  10111. let m, f;
  10112. d.startRow >= n.startRow ? (m = Math.max(n.startRow - h, 1), f = Math.max(n.ySplit - h, 1)) : (m = n.startRow + u - h, f = n.ySplit + u - h);
  10113. const g = {
  10114. ...n,
  10115. startRow: m,
  10116. ySplit: f
  10117. };
  10118. return s(g);
  10119. }
  10120. if (e.id === pm.id || e.id === Sm.id) {
  10121. const i = e.params, o = i.range;
  10122. if (o.rangeType === j.COLUMN && o.startColumn < n.startColumn) {
  10123. const l = Math.min(n.startColumn, o.endColumn + 1) - o.startColumn, a = {
  10124. ...n,
  10125. startColumn: Math.max(1, n.startColumn - l),
  10126. xSplit: Math.max(1, n.xSplit - l)
  10127. };
  10128. return s(a);
  10129. }
  10130. if (i.range.rangeType === j.ROW && o.startRow < n.startRow) {
  10131. const l = Math.min(n.startRow, o.endRow + 1) - o.startRow, a = {
  10132. ...n,
  10133. startRow: Math.max(1, n.startRow - l),
  10134. ySplit: Math.max(1, n.ySplit - l)
  10135. };
  10136. return s(a);
  10137. }
  10138. }
  10139. return t;
  10140. }
  10141. })
  10142. );
  10143. }
  10144. _commandExecutedListener() {
  10145. const e = [vr.id, $t.id];
  10146. this.disposeWithMe(
  10147. // eslint-disable-next-line complexity
  10148. this._commandService.onCommandExecuted((t) => {
  10149. if (e.includes(t.id)) {
  10150. const n = this._lastFreeze, s = this._context.unit, i = s.getActiveSheet(), o = t.params, { unitId: l, subUnitId: a } = o;
  10151. if (!(l === s.getUnitId() && a === (i == null ? void 0 : i.getSheetId())))
  10152. return;
  10153. const c = i.getConfig().freeze;
  10154. if (this._lastFreeze = c, c == null)
  10155. return;
  10156. let d = 0;
  10157. const { startRow: u = -1, startColumn: h = -1, ySplit: m = 0, xSplit: f = 0 } = c;
  10158. (!n || n.startRow !== u || n.ySplit !== m) && (d |= 2), (!n || n.startColumn !== h || n.xSplit !== f) && (d |= 1), o.resetScroll === !1 && (d = 0), this._refreshFreeze(u, h, m, f, d);
  10159. } else if (t.id === $s.id) {
  10160. const n = this._getFreeze(), s = n && t.params.ranges.some((i) => i.startRow < n.startRow);
  10161. t.params && s && this._refreshCurrent();
  10162. } else if (t.id === Qt.id) {
  10163. const n = this._getFreeze();
  10164. t.params && n && t.params.ranges.some(
  10165. (s) => s.startColumn < n.startColumn
  10166. ) && this._refreshCurrent();
  10167. } else if (t.id === _r.id) {
  10168. const n = t.params, s = this._getFreeze();
  10169. if (s && s.startRow > -1 && n.rowsAutoHeightInfo.some((i) => i.row < s.startRow)) {
  10170. const i = this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => {
  10171. this._refreshCurrent(), setTimeout(() => {
  10172. i.unsubscribe();
  10173. });
  10174. });
  10175. }
  10176. } else if (t.id === vd.id || t.id === bd.id) {
  10177. const n = t.params, s = this._getFreeze(), i = n.ranges;
  10178. s && s.startColumn > -1 && i.some((o) => o.startColumn < s.startColumn) && this._refreshCurrent();
  10179. } else if (t.id === Sd.id || t.id === Cd.id) {
  10180. const n = t.params, s = this._getFreeze(), i = n.ranges;
  10181. s && s.startRow > -1 && i.some((o) => o.startRow < s.startRow) && this._refreshCurrent();
  10182. }
  10183. })
  10184. );
  10185. }
  10186. _zoomRefresh() {
  10187. const e = this._getSheetObject();
  10188. if (e == null)
  10189. return;
  10190. const { scene: t } = e;
  10191. t.onTransformChange$.subscribeEvent((n) => {
  10192. n.type === zh.scale && this._refreshCurrent();
  10193. });
  10194. }
  10195. _clearObserverEvent() {
  10196. var t, n;
  10197. this._getSheetObject() != null && ((t = this._scenePointerMoveSub) == null || t.unsubscribe(), (n = this._scenePointerUpSub) == null || n.unsubscribe(), this._scenePointerMoveSub = null, this._scenePointerUpSub = null);
  10198. }
  10199. _clearFreeze() {
  10200. var t, n, s, i, o, l;
  10201. (t = this._rowFreezeHeaderRect) == null || t.dispose(), (n = this._rowFreezeMainRect) == null || n.dispose(), (s = this._columnFreezeHeaderRect) == null || s.dispose(), (i = this._columnFreezeMainRect) == null || i.dispose(), this._getSheetObject() != null && ([this._freezeDownSubs, this._freezePointerEnterSubs, this._freezePointerLeaveSubs].forEach((a) => {
  10202. a == null || a.unsubscribe();
  10203. }), this._freezeDownSubs = null, this._freezePointerEnterSubs = null, this._freezePointerLeaveSubs = null, (o = this._scenePointerMoveSub) == null || o.unsubscribe(), (l = this._scenePointerUpSub) == null || l.unsubscribe(), this._scenePointerMoveSub = null, this._scenePointerUpSub = null);
  10204. }
  10205. _getPositionByIndex(e, t) {
  10206. var a;
  10207. if (this._getSheetObject() == null)
  10208. return;
  10209. const s = (a = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : a.skeleton, i = s == null ? void 0 : s.getNoMergeCellPositionByIndex(e, t);
  10210. if (s == null)
  10211. return;
  10212. if (i != null && (!isNaN(i.endX) || !isNaN(i.endY)))
  10213. return i;
  10214. const { rowHeaderWidthAndMarginLeft: o, columnHeaderHeightAndMarginTop: l } = s;
  10215. return {
  10216. startX: o,
  10217. endX: o,
  10218. startY: l,
  10219. endY: l
  10220. };
  10221. }
  10222. _getFreeze() {
  10223. var t;
  10224. const e = (t = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : t.skeleton.getWorksheetConfig();
  10225. if (e != null)
  10226. return e.freeze;
  10227. }
  10228. _getSheetObject() {
  10229. return pn(this._context.unit, this._context);
  10230. }
  10231. /**
  10232. * 调整冻结 & 缩放都会进入
  10233. * 但是窗口 resize 并不会进入
  10234. * @param startRow
  10235. * @param startColumn
  10236. * @param ySplit
  10237. * @param xSplit
  10238. * @param resetScroll
  10239. */
  10240. _refreshFreeze(e, t, n, s, i) {
  10241. var l;
  10242. const o = {
  10243. startRow: e,
  10244. startColumn: t,
  10245. ySplit: n,
  10246. xSplit: s
  10247. };
  10248. this._clearFreeze(), this._createFreeze(0, o), this._createFreeze(1, o), this._updateViewport(e, t, n, s, i), (l = this._getSheetObject()) == null || l.spreadsheet.makeForceDirty();
  10249. }
  10250. };
  10251. hi = Qb([
  10252. cr(1, D(me)),
  10253. cr(2, F),
  10254. cr(3, D($)),
  10255. cr(4, D(yt)),
  10256. cr(5, D(kt)),
  10257. cr(6, D(Ln)),
  10258. cr(7, D(vt))
  10259. ], hi);
  10260. function n_(r) {
  10261. const e = r.get($), t = r.get(Ye), n = r.get(L), s = r.get(LS), i = n.getCurrentTypeOfUnit$(O.UNIVER_SHEET);
  10262. return ot([
  10263. e.selectionMoveEnd$,
  10264. i.pipe(_e((o) => {
  10265. var l;
  10266. return (l = o == null ? void 0 : o.getUnitId()) != null ? l : "";
  10267. })),
  10268. i.pipe(We((o) => {
  10269. var l;
  10270. return (l = o == null ? void 0 : o.activeSheet$) != null ? l : Ie(null);
  10271. }))
  10272. ]).pipe(
  10273. _e(([o, l, a]) => {
  10274. if (!a || !o || o.length === 0) return !1;
  10275. const c = a.getSheetId(), d = o.map((m) => m.range);
  10276. if (s.interceptor.fetchThroughInterceptors(WS)(!1, d))
  10277. return !0;
  10278. const h = t.getSubunitRuleList(l, c).map((m) => m.ranges).flat();
  10279. if (o.length < 2) {
  10280. const m = o[0].range;
  10281. return h.some((g) => ae.intersects(g, m) && !ae.contains(g, m));
  10282. }
  10283. for (let m = 0; m < o.length; m++)
  10284. for (let f = m + 1; f < o.length; f++)
  10285. if (ae.intersects(o[m].range, o[f].range))
  10286. return !0;
  10287. return !1;
  10288. })
  10289. );
  10290. }
  10291. function Nf(r, e) {
  10292. return !!Uo(r, e, j.ROW);
  10293. }
  10294. function Hf(r, e) {
  10295. return !!Uo(r, e, j.COLUMN);
  10296. }
  10297. function Uo(r, e, t) {
  10298. return r.find((s) => {
  10299. const i = s.range, { startRow: o, endRow: l, startColumn: a, endColumn: c, rangeType: d } = i;
  10300. return d === j.ALL || d === j.NORMAL ? !1 : d === t && (t === j.COLUMN && a <= e && e <= c || t === j.ROW && o <= e && e <= l);
  10301. });
  10302. }
  10303. var r_ = Object.defineProperty, s_ = Object.getOwnPropertyDescriptor, i_ = (r, e, t, n) => {
  10304. for (var s = n > 1 ? void 0 : n ? s_(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  10305. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  10306. return n && s && r_(e, t, s), s;
  10307. }, Oa = (r, e) => (t, n) => e(t, n, r);
  10308. const o_ = "__SpreadsheetHeaderMoveControllerBackground__", l_ = "__SpreadsheetHeaderMoveControllerShapeLine__", a_ = "rgba(0, 0, 0, 0.1)", c_ = "rgb(119, 119, 119)", d_ = 4, Aa = sr("headerMovePermissionCheck");
  10309. let mi = class extends ce {
  10310. constructor(e, t, n, s) {
  10311. super();
  10312. w(this, "_startOffsetX", Number.NEGATIVE_INFINITY);
  10313. w(this, "_startOffsetY", Number.NEGATIVE_INFINITY);
  10314. w(this, "_moveHelperBackgroundShape");
  10315. w(this, "_moveHelperLineShape");
  10316. w(this, "_headerPointerDownSubs");
  10317. w(this, "_headerPointerMoveSubs");
  10318. w(this, "_headerPointerLeaveSubs");
  10319. w(this, "_dragHeaderMoveSub");
  10320. w(this, "_scenePointerUpSub");
  10321. w(this, "_scrollTimer");
  10322. w(this, "_changeFromColumn", -1);
  10323. w(this, "_changeFromRow", -1);
  10324. w(this, "_changeToColumn", -1);
  10325. w(this, "_changeToRow", -1);
  10326. w(this, "interceptor", new Cs({ HEADER_MOVE_PERMISSION_CHECK: Aa }));
  10327. w(this, "_workbookSelections");
  10328. this._context = e, this._sheetSkeletonManagerService = n, this._commandService = s, this._workbookSelections = t.getWorkbookSelections(this._context.unitId), this._init();
  10329. }
  10330. dispose() {
  10331. var e, t, n, s, i, o, l, a;
  10332. (e = this._moveHelperBackgroundShape) == null || e.dispose(), (t = this._moveHelperLineShape) == null || t.dispose(), (n = this._headerPointerMoveSubs) == null || n.unsubscribe(), (s = this._headerPointerLeaveSubs) == null || s.unsubscribe(), (i = this._headerPointerDownSubs) == null || i.unsubscribe(), this._headerPointerMoveSubs = null, this._headerPointerLeaveSubs = null, this._headerPointerDownSubs = null, (o = this._dragHeaderMoveSub) == null || o.unsubscribe(), (l = this._scenePointerUpSub) == null || l.unsubscribe(), this._dragHeaderMoveSub = null, this._scenePointerUpSub = null, (a = this._scrollTimer) == null || a.dispose();
  10333. }
  10334. _init() {
  10335. this._initialRowOrColumn(j.ROW), this._initialRowOrColumn(j.COLUMN);
  10336. }
  10337. // eslint-disable-next-line max-lines-per-function
  10338. _initialRowOrColumn(e = j.ROW) {
  10339. const t = this._context.components.get(qe.COLUMN), n = this._context.components.get(qe.ROW), s = this._context.scene, i = e === j.ROW ? n : t, o = (c) => {
  10340. var S, b;
  10341. const d = (S = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : S.skeleton;
  10342. if (d == null)
  10343. return;
  10344. const u = (b = this._workbookSelections.getCurrentLastSelection()) == null ? void 0 : b.range;
  10345. if (!u || !this.interceptor.fetchThroughInterceptors(Aa)(!1, u))
  10346. return;
  10347. const m = this._workbookSelections.getCurrentSelections(), { row: f, column: g } = Nn(c.offsetX, c.offsetY, s, d);
  10348. if (!Uo(
  10349. m,
  10350. e === j.ROW ? f : g,
  10351. e
  10352. )) {
  10353. s.resetCursor();
  10354. return;
  10355. }
  10356. s.setCursor(Re.GRAB);
  10357. }, l = () => {
  10358. var c, d;
  10359. (c = this._moveHelperBackgroundShape) == null || c.hide(), (d = this._moveHelperLineShape) == null || d.hide(), s.resetCursor();
  10360. }, a = (c, d) => {
  10361. var A, H;
  10362. if (d.isStopPropagation) return;
  10363. const u = (A = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : A.skeleton;
  10364. if (u == null)
  10365. return;
  10366. const h = (H = this._workbookSelections.getCurrentLastSelection()) == null ? void 0 : H.range;
  10367. if (!h || !this.interceptor.fetchThroughInterceptors(Aa)(!1, h))
  10368. return;
  10369. const { offsetX: f, offsetY: g } = c, p = s.getCoordRelativeToViewport(Oe.FromArray([f, g])), { x: S, y: b } = p;
  10370. this._startOffsetX = S, this._startOffsetY = b;
  10371. const { row: v, column: _ } = Nn(c.offsetX, c.offsetY, s, u);
  10372. let R;
  10373. e === j.ROW ? (this._changeFromRow = v, R = It.Y) : (this._changeFromColumn = _, R = It.X);
  10374. const I = this._workbookSelections.getCurrentSelections(), y = Uo(
  10375. I,
  10376. e === j.ROW ? v : _,
  10377. e
  10378. );
  10379. if (!y)
  10380. return;
  10381. const M = s.getScrollXYInfoByViewport(
  10382. Oe.FromArray([this._startOffsetX, this._startOffsetY])
  10383. );
  10384. this._newBackgroundAndLine(), s.setCursor(Re.GRABBING), s.disableObjectsEvent();
  10385. let P = !1, E;
  10386. const T = () => {
  10387. if (P)
  10388. return;
  10389. E = Kr.create(s, R), this._scrollTimer = E;
  10390. const x = s.getViewport(z.VIEW_MAIN);
  10391. E.startScroll(S, b, x), P = !0;
  10392. };
  10393. this._dragHeaderMoveSub = s.onPointerMove$.subscribeEvent((x) => {
  10394. T();
  10395. const { offsetX: k, offsetY: U } = x, { x: V, y: N } = s.getCoordRelativeToViewport(
  10396. Oe.FromArray([k, U])
  10397. );
  10398. this._rowColumnMoving(
  10399. V,
  10400. N,
  10401. y,
  10402. M,
  10403. e
  10404. ), E.scrolling(V, N, () => {
  10405. this._rowColumnMoving(
  10406. V,
  10407. N,
  10408. y,
  10409. M,
  10410. e
  10411. );
  10412. });
  10413. }), this._scenePointerUpSub = s.onPointerUp$.subscribeEvent(() => {
  10414. var k, U, V;
  10415. this._disposeBackgroundAndLine(), s.resetCursor(), s.enableObjectsEvent(), this._clearObserverEvent(), (k = this._scrollTimer) == null || k.dispose();
  10416. const x = this._workbookSelections.getCurrentSelections();
  10417. if (e === j.ROW) {
  10418. if (this._changeFromRow !== this._changeToRow && this._changeToRow !== -1) {
  10419. const X = (U = ((x == null ? void 0 : x.filter(
  10420. (Y) => Y.range.rangeType === j.ROW && Y.range.startRow <= this._changeFromRow && this._changeFromRow <= Y.range.endRow
  10421. )) || [])[0]) == null ? void 0 : U.range;
  10422. X && this._commandService.executeCommand(gm.id, {
  10423. fromRange: X,
  10424. toRange: {
  10425. ...X,
  10426. startRow: this._changeToRow,
  10427. endRow: this._changeToRow + X.endRow - X.startRow
  10428. }
  10429. });
  10430. }
  10431. this._changeToRow = this._changeFromRow = -1;
  10432. } else {
  10433. if (this._changeFromColumn !== this._changeToColumn && this._changeToColumn !== -1) {
  10434. const X = (V = ((x == null ? void 0 : x.filter(
  10435. (Y) => Y.range.rangeType === j.COLUMN && Y.range.startColumn <= this._changeFromColumn && this._changeFromColumn <= Y.range.endColumn
  10436. )) || [])[0]) == null ? void 0 : V.range;
  10437. X && this._commandService.executeCommand(fm.id, {
  10438. fromRange: X,
  10439. toRange: {
  10440. ...X,
  10441. startColumn: this._changeToColumn,
  10442. endColumn: this._changeToColumn + X.endColumn - X.startColumn
  10443. }
  10444. });
  10445. }
  10446. this._changeToColumn = this._changeFromColumn = -1;
  10447. }
  10448. });
  10449. };
  10450. this._headerPointerMoveSubs = new Kn(), this._headerPointerMoveSubs.add(i.onPointerMove$.subscribeEvent(o)), this._headerPointerLeaveSubs = new Kn(), this._headerPointerLeaveSubs.add(i == null ? void 0 : i.onPointerLeave$.subscribeEvent(l)), this._headerPointerDownSubs = new Kn(), this._headerPointerDownSubs.add(i == null ? void 0 : i.onPointerDown$.subscribeEvent(a));
  10451. }
  10452. // eslint-disable-next-line max-lines-per-function
  10453. _rowColumnMoving(e, t, n, s, i) {
  10454. var N, X, Y, ie, he, ne, pe;
  10455. const o = this._context.scene, l = (N = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : N.skeleton;
  10456. if (l == null)
  10457. return;
  10458. const { rowHeaderWidth: a, columnHeaderHeight: c, rowTotalHeight: d, columnTotalWidth: u } = l, h = o.getViewportScrollXY(o.getViewport(z.VIEW_MAIN)), { scaleX: m, scaleY: f } = o.getAncestorScale(), g = l.getCellIndexByOffset(
  10459. e,
  10460. t,
  10461. m,
  10462. f,
  10463. h
  10464. ), { row: p, column: S } = g, b = l.getNoMergeCellPositionByIndex(p, S), { startX: v, startY: _, endX: R, endY: I } = b, y = this._sheetSkeletonManagerService.attachRangeWithCoord(n.range);
  10465. if (y == null)
  10466. return;
  10467. const M = Math.max(m, m), {
  10468. startX: P,
  10469. endX: E,
  10470. startY: T,
  10471. endY: A,
  10472. startRow: H,
  10473. startColumn: x,
  10474. endRow: k,
  10475. endColumn: U
  10476. } = y;
  10477. i === j.ROW ? (X = this._moveHelperBackgroundShape) == null || X.transformByState({
  10478. height: A - T,
  10479. width: u + a,
  10480. left: 0,
  10481. top: T + (t - this._startOffsetY) / M + h.y - s.y
  10482. }) : (Y = this._moveHelperBackgroundShape) == null || Y.transformByState({
  10483. height: d + c,
  10484. width: E - P,
  10485. left: P + (e - this._startOffsetX) / M + h.x - s.x,
  10486. top: 0
  10487. }), (ie = this._moveHelperBackgroundShape) == null || ie.show();
  10488. const V = d_ / M;
  10489. if (i === j.ROW) {
  10490. let ve = 0;
  10491. if (p <= H)
  10492. ve = _ - V / 2, this._changeToRow = p;
  10493. else if (p > k)
  10494. ve = I - V / 2, this._changeToRow = p + 1;
  10495. else
  10496. return;
  10497. (he = this._moveHelperLineShape) == null || he.transformByState({
  10498. height: V,
  10499. width: u,
  10500. left: a,
  10501. top: ve
  10502. });
  10503. } else {
  10504. let ve = 0;
  10505. if (S <= x)
  10506. ve = v - V / 2, this._changeToColumn = S;
  10507. else if (S > U)
  10508. ve = R - V / 2, this._changeToColumn = S + 1;
  10509. else
  10510. return;
  10511. (ne = this._moveHelperLineShape) == null || ne.transformByState({
  10512. height: d,
  10513. width: V,
  10514. left: ve,
  10515. top: c
  10516. });
  10517. }
  10518. (pe = this._moveHelperLineShape) == null || pe.show();
  10519. }
  10520. _clearObserverEvent() {
  10521. var e, t;
  10522. (e = this._dragHeaderMoveSub) == null || e.unsubscribe(), (t = this._scenePointerUpSub) == null || t.unsubscribe(), this._dragHeaderMoveSub = null, this._scenePointerUpSub = null;
  10523. }
  10524. _newBackgroundAndLine() {
  10525. const e = this._context.scene;
  10526. this._moveHelperBackgroundShape = new ge(o_, {
  10527. fill: a_,
  10528. evented: !1,
  10529. zIndex: 100
  10530. }), this._moveHelperLineShape = new ge(l_, {
  10531. fill: c_,
  10532. evented: !1,
  10533. zIndex: 100
  10534. }), e.addObjects(
  10535. [this._moveHelperBackgroundShape, this._moveHelperLineShape],
  10536. rr
  10537. );
  10538. }
  10539. _disposeBackgroundAndLine() {
  10540. var e, t;
  10541. (e = this._moveHelperBackgroundShape) == null || e.dispose(), (t = this._moveHelperLineShape) == null || t.dispose();
  10542. }
  10543. };
  10544. mi = i_([
  10545. Oa(1, D($)),
  10546. Oa(2, D(me)),
  10547. Oa(3, F)
  10548. ], mi);
  10549. var Ac = /* @__PURE__ */ ((r) => (r[r.VERTICAL = 0] = "VERTICAL", r[r.HORIZONTAL = 1] = "HORIZONTAL", r))(Ac || {});
  10550. const u_ = "rgba(120, 120, 120, 0.01)", Na = "rgb(68, 71, 70)", Fs = 12, h_ = 44, Nc = 4;
  10551. class sh extends sd {
  10552. constructor(t, n) {
  10553. super(t, n);
  10554. w(this, "_size", Fs);
  10555. w(this, "_color", Na);
  10556. w(this, "_mode", 0);
  10557. this.setShapeProps(n);
  10558. }
  10559. get size() {
  10560. return this._size;
  10561. }
  10562. get mode() {
  10563. return this._mode;
  10564. }
  10565. get color() {
  10566. return this._color;
  10567. }
  10568. _draw(t) {
  10569. const n = this.getScene();
  10570. if (!n) return;
  10571. const { scaleX: s, scaleY: i } = n.getAncestorScale(), o = Math.max(s, i), l = Fs / o, a = Nc / o;
  10572. let { width: c, height: d } = this, u = 0, h = 0;
  10573. this.mode === 0 ? (c = a, u = l - a) : (d = a, h = l - a), ge.drawWith(t, {
  10574. width: this.width,
  10575. height: this.height,
  10576. left: 0,
  10577. top: 0,
  10578. fill: u_
  10579. }), ge.drawWith(t, {
  10580. width: c,
  10581. height: d,
  10582. fill: Na,
  10583. radius: a
  10584. }), t.save(), t.transform(1, 0, 0, 1, u, h), ge.drawWith(t, {
  10585. width: c,
  10586. height: d,
  10587. fill: Na,
  10588. radius: a
  10589. }), t.restore();
  10590. }
  10591. setShapeProps(t) {
  10592. return t != null && t.size && (this._size = t.size), t != null && t.mode && (this._mode = t.mode), t != null && t.color && (this._color = t.color), this.mode === 0 ? this.transformByState({
  10593. width: Fs,
  10594. height: this.size
  10595. }) : this.transformByState({
  10596. width: this.size,
  10597. height: Fs
  10598. }), this;
  10599. }
  10600. }
  10601. var m_ = Object.defineProperty, f_ = Object.getOwnPropertyDescriptor, g_ = (r, e, t, n) => {
  10602. for (var s = n > 1 ? void 0 : n ? f_(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  10603. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  10604. return n && s && m_(e, t, s), s;
  10605. }, Ha = (r, e) => (t, n) => e(t, n, r);
  10606. const p_ = "__SpreadsheetHeaderResizeControllerShapeRow__", S_ = "__SpreadsheetHeaderResizeControllerShapeColumn__", ih = "__SpreadsheetHeaderResizeControllerShapeHelper__", oh = "rgb(199, 199, 199)", C_ = 2, Va = sr("headerResizePermissionCheck");
  10607. let jo = class extends ce {
  10608. constructor(e, t, n, s) {
  10609. super();
  10610. w(this, "_currentRow", 0);
  10611. w(this, "_currentColumn", 0);
  10612. w(this, "_rowResizeRect");
  10613. w(this, "_columnResizeRect");
  10614. w(this, "_headerPointerSubs");
  10615. // private _colHeaderPointerSubs: Array<Subscription>;
  10616. w(this, "_scenePointerMoveSub");
  10617. w(this, "_scenePointerUpSub");
  10618. w(this, "_resizeHelperShape");
  10619. w(this, "_startOffsetX", Number.POSITIVE_INFINITY);
  10620. w(this, "_startOffsetY", Number.POSITIVE_INFINITY);
  10621. w(this, "interceptor", new Cs({ HEADER_RESIZE_PERMISSION_CHECK: Va }));
  10622. this._context = e, this._sheetSkeletonManagerService = t, this._selectionManagerService = n, this._commandService = s, this._init();
  10623. }
  10624. dispose() {
  10625. var e, t, n;
  10626. (e = this._rowResizeRect) == null || e.dispose(), this._rowResizeRect = null, (t = this._columnResizeRect) == null || t.dispose(), this._columnResizeRect = null, (n = this._headerPointerSubs) == null || n.unsubscribe(), this._headerPointerSubs = null;
  10627. }
  10628. _init() {
  10629. const e = this._context.scene;
  10630. this._rowResizeRect = new sh(p_, {
  10631. visible: !1,
  10632. mode: Ac.HORIZONTAL,
  10633. zIndex: 100
  10634. }), this._columnResizeRect = new sh(S_, {
  10635. visible: !1,
  10636. mode: Ac.VERTICAL,
  10637. zIndex: 100
  10638. }), e.addObjects([this._rowResizeRect, this._columnResizeRect], rr), this._initialHover(
  10639. 0
  10640. /* ROW */
  10641. ), this._initialHover(
  10642. 1
  10643. /* COLUMN */
  10644. ), this._initialHoverResize(
  10645. 0
  10646. /* ROW */
  10647. ), this._initialHoverResize(
  10648. 1
  10649. /* COLUMN */
  10650. );
  10651. }
  10652. _initialHover(e = 0) {
  10653. const t = this._context.components.get(qe.COLUMN), n = this._context.components.get(qe.ROW), s = this._context.scene, i = e === 0 ? n : t, o = (a, c) => {
  10654. var d, u;
  10655. (d = this._rowResizeRect) == null || d.hide(), (u = this._columnResizeRect) == null || u.hide();
  10656. }, l = (a, c) => {
  10657. var M;
  10658. const d = (M = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : M.skeleton;
  10659. if (d == null || this._rowResizeRect == null || this._columnResizeRect == null)
  10660. return;
  10661. const { rowHeaderWidth: u, columnHeaderHeight: h } = d, { startX: m, startY: f, endX: g, endY: p, row: S, column: b } = Nn(
  10662. a.offsetX,
  10663. a.offsetY,
  10664. s,
  10665. d
  10666. ), v = fo(a.offsetX, a.offsetY, s), { scaleX: _, scaleY: R } = s.getAncestorScale(), I = Math.max(_, R), y = Fs / I;
  10667. if (e === 0) {
  10668. let P = f - y / 2;
  10669. if (v.y <= f + y / 2 && v.y >= f)
  10670. this._currentRow = S - 1;
  10671. else if (v.y >= p - y / 2 && v.y <= p)
  10672. this._currentRow = S, P = p - y / 2;
  10673. else {
  10674. this._rowResizeRect.hide();
  10675. return;
  10676. }
  10677. if (this._currentRow === -1)
  10678. return;
  10679. if (!this.interceptor.fetchThroughInterceptors(Va)(null, { row: this._currentRow }))
  10680. return !1;
  10681. const T = Math.min(h_, u / 3);
  10682. this._rowResizeRect.transformByState({
  10683. left: u / 2 - T / 2,
  10684. top: P
  10685. }), this._rowResizeRect.setShapeProps({
  10686. size: T
  10687. }), this._rowResizeRect.show();
  10688. } else {
  10689. let P = m - y / 2;
  10690. if (v.x <= m + y / 2 && v.x >= m)
  10691. this._currentColumn = b - 1;
  10692. else if (v.x >= g - y / 2 && v.x <= g)
  10693. this._currentColumn = b, P = g - y / 2;
  10694. else {
  10695. this._columnResizeRect.hide();
  10696. return;
  10697. }
  10698. if (this._currentColumn === -1)
  10699. return;
  10700. if (!this.interceptor.fetchThroughInterceptors(Va)(null, { col: this._currentColumn }))
  10701. return !1;
  10702. const T = h * 0.7;
  10703. this._columnResizeRect.transformByState({
  10704. left: P,
  10705. top: h / 2 - T / 2
  10706. }), this._columnResizeRect.setShapeProps({
  10707. size: T
  10708. }), this._columnResizeRect.show();
  10709. }
  10710. };
  10711. this._headerPointerSubs = new Kn(), this._headerPointerSubs.add(i == null ? void 0 : i.onPointerMove$.subscribeEvent(l)), this._headerPointerSubs.add(i == null ? void 0 : i.onPointerLeave$.subscribeEvent(o));
  10712. }
  10713. _initialHoverResize(e = 0) {
  10714. const t = this._context.scene, n = e === 0 ? this._rowResizeRect : this._columnResizeRect;
  10715. n != null && (this.disposeWithMe(
  10716. n.onPointerEnter$.subscribeEvent(() => {
  10717. n != null && (n.show(), t.setCursor(
  10718. e === 0 ? Re.ROW_RESIZE : Re.COLUMN_RESIZE
  10719. ));
  10720. })
  10721. ), this.disposeWithMe(
  10722. n.onPointerLeave$.subscribeEvent(() => {
  10723. n != null && (n.hide(), t.resetCursor());
  10724. })
  10725. ), this.disposeWithMe(
  10726. n.onPointerDown$.subscribeEvent((s) => {
  10727. var U, V, N, X, Y, ie, he;
  10728. const i = (U = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : U.skeleton;
  10729. if (i == null) return;
  10730. const o = this._context.scene, l = o.getEngine(), a = (l == null ? void 0 : l.height) || 0, c = (l == null ? void 0 : l.width) || 0, d = o.getViewport(z.VIEW_MAIN), u = (((N = (V = d == null ? void 0 : d.getScrollBar()) == null ? void 0 : V.horizonScrollTrack) == null ? void 0 : N.height) || 0) + 10, h = (((Y = (X = d == null ? void 0 : d.getScrollBar()) == null ? void 0 : X.verticalScrollTrack) == null ? void 0 : Y.width) || 0) + 10, m = fo(s.offsetX, s.offsetY, o), { scaleX: f, scaleY: g } = o.getAncestorScale();
  10731. this._startOffsetX = m.x, this._startOffsetY = m.y;
  10732. const p = i.getOffsetByPositionX(this._currentColumn), S = i.getOffsetByPositionY(this._currentRow), b = i.getNoMergeCellPositionByIndex(this._currentRow, this._currentColumn);
  10733. let v = !1, _ = 0, R = 0;
  10734. const { columnTotalWidth: I, rowHeaderWidth: y, rowTotalHeight: M, columnHeaderHeight: P } = i, E = c > I + y ? c : I + y, T = a > M + P ? a : M + P, A = Math.max(f, g), H = Nc / A;
  10735. e === 0 ? this._resizeHelperShape = new ge(ih, {
  10736. width: E,
  10737. height: H,
  10738. fill: oh,
  10739. left: 0,
  10740. top: S - H / 2
  10741. }) : this._resizeHelperShape = new ge(ih, {
  10742. width: H,
  10743. height: T,
  10744. fill: oh,
  10745. left: p - H / 2,
  10746. top: 0
  10747. });
  10748. const x = ((ie = this._columnResizeRect) == null ? void 0 : ie.left) || 0, k = ((he = this._rowResizeRect) == null ? void 0 : he.top) || 0;
  10749. o.addObject(this._resizeHelperShape, rr), o.disableObjectsEvent(), this._scenePointerMoveSub = o.onPointerMove$.subscribeEvent((ne) => {
  10750. var we, Ve, pt, bt, xs, nu;
  10751. const pe = o.getCoordRelativeToViewport(
  10752. Oe.FromArray([this._startOffsetX, this._startOffsetY])
  10753. ), ve = o.getScrollXYInfoByViewport(pe, d), G = fo(ne.offsetX, ne.offsetY, o), { x: J, y: le } = G, { scaleX: fe, scaleY: Ze } = o.getAncestorScale(), lt = Math.max(fe, Ze), Be = Nc / lt;
  10754. _ = J - this._startOffsetX - Be / 2, R = le - this._startOffsetY - Be / 2, Math.abs(e === 0 ? R : _) >= C_ && (v = !0), e === 0 ? (R > a - u + ve.y - b.startY && (R = a - u + ve.y - b.startY), R < -(b.endY - b.startY) + 2 && (R = -(b.endY - b.startY) + 2), v && ((we = this._resizeHelperShape) == null || we.transformByState({
  10755. top: S + R
  10756. }), (Ve = this._rowResizeRect) == null || Ve.transformByState({
  10757. top: k + R + Be / 2
  10758. }), (pt = this._rowResizeRect) == null || pt.show(), o.setCursor(Re.ROW_RESIZE))) : (_ > c - h + ve.x - b.startX && (_ = c - h + ve.x - b.startX), _ < -(b.endX - b.startX) + 2 && (_ = -(b.endX - b.startX) + 2), v && ((bt = this._resizeHelperShape) == null || bt.transformByState({
  10759. left: p + _
  10760. }), (xs = this._columnResizeRect) == null || xs.transformByState({
  10761. left: x + _ + Be / 2
  10762. }), (nu = this._columnResizeRect) == null || nu.show(), o.setCursor(Re.COLUMN_RESIZE)));
  10763. }), this._scenePointerUpSub = o.onPointerUp$.subscribeEvent((ne) => {
  10764. var ve, G, J;
  10765. const pe = this._context.scene;
  10766. this._clearObserverEvent(), (ve = this._resizeHelperShape) == null || ve.dispose(), this._resizeHelperShape = null, pe.enableObjectsEvent(), v && (pe.resetCursor(), (G = this._rowResizeRect) == null || G.hide(), (J = this._columnResizeRect) == null || J.hide(), e === 0 ? this._commandService.executeCommand(BS.id, {
  10767. deltaY: R,
  10768. anchorRow: this._currentRow
  10769. }) : this._commandService.executeCommand(
  10770. FS.id,
  10771. {
  10772. deltaX: _,
  10773. anchorCol: this._currentColumn
  10774. }
  10775. ));
  10776. });
  10777. })
  10778. ), this.disposeWithMe(
  10779. n.onDblclick$.subscribeEvent(() => {
  10780. var d, u, h;
  10781. this._context.scene.resetCursor();
  10782. const i = (d = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
  10783. if (!i) return;
  10784. const o = 0, l = 0, a = i.worksheet.getRowCount() - 1 || 0, c = i.worksheet.getColumnCount() - 1 || 0;
  10785. switch (e) {
  10786. case 1: {
  10787. const m = this._selectionManagerService.getCurrentSelections(), f = [];
  10788. for (let g = 0; g < m.length; g++) {
  10789. const p = m[g];
  10790. p.range.rangeType === j.COLUMN && this._currentColumn <= p.range.endColumn && this._currentColumn >= p.range.startColumn && f.push({
  10791. startColumn: p.range.startColumn,
  10792. endColumn: p.range.endColumn,
  10793. startRow: o,
  10794. endRow: a
  10795. });
  10796. }
  10797. f.length === 0 && f.push({
  10798. startColumn: this._currentColumn,
  10799. endColumn: this._currentColumn,
  10800. startRow: o,
  10801. endRow: a
  10802. }), this._commandService.executeCommand(
  10803. Ql.id,
  10804. { ranges: f }
  10805. ), (u = this._columnResizeRect) == null || u.hide();
  10806. break;
  10807. }
  10808. case 0:
  10809. this._commandService.executeCommand(
  10810. Pl.id,
  10811. {
  10812. ranges: [{
  10813. startRow: this._currentRow,
  10814. endRow: this._currentRow,
  10815. startColumn: l,
  10816. endColumn: c
  10817. }]
  10818. }
  10819. ), (h = this._rowResizeRect) == null || h.hide();
  10820. break;
  10821. }
  10822. })
  10823. ));
  10824. }
  10825. _clearObserverEvent() {
  10826. var e, t;
  10827. (e = this._scenePointerMoveSub) == null || e.unsubscribe(), (t = this._scenePointerUpSub) == null || t.unsubscribe(), this._scenePointerMoveSub = null, this._scenePointerUpSub = null;
  10828. }
  10829. };
  10830. jo = g_([
  10831. Ha(1, D(me)),
  10832. Ha(2, D($)),
  10833. Ha(3, F)
  10834. ], jo);
  10835. var v_ = Object.defineProperty, b_ = Object.getOwnPropertyDescriptor, __ = (r, e, t, n) => {
  10836. for (var s = n > 1 ? void 0 : n ? b_(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  10837. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  10838. return n && s && v_(e, t, s), s;
  10839. }, $i = (r, e) => (t, n) => e(t, n, r);
  10840. const w_ = 60;
  10841. let Xo = class extends kn {
  10842. constructor(e, t, n, s, i) {
  10843. super();
  10844. w(this, "_renderFrameTimeMetric", null);
  10845. w(this, "_renderFrameTags", {});
  10846. w(this, "_afterRenderMetric$", new xe());
  10847. this._context = e, this._sheetSkeletonManagerService = t, this._sheetRenderService = n, this._commandService = s, this._telemetryService = i, this._addNewRender(), this._initRenderMetricSubscriber();
  10848. }
  10849. _addNewRender() {
  10850. const { scene: e, engine: t, unit: n } = this._context;
  10851. this._addComponent(n), this._initRerenderScheduler(), this._initCommandListener();
  10852. const s = this._context.unit.getActiveSheet();
  10853. if (!s)
  10854. throw new Error("No active sheet found");
  10855. const i = s.getSheetId();
  10856. this._sheetSkeletonManagerService.setCurrent({ sheetId: i }), t.runRenderLoop(() => e.render());
  10857. }
  10858. _initRenderMetricSubscriber() {
  10859. if (!this._telemetryService) return;
  10860. const { engine: e } = this._context;
  10861. e.beginFrame$.subscribe(() => {
  10862. this._renderFrameTimeMetric = null, this._renderFrameTags = {};
  10863. }), e.endFrame$.subscribe(() => {
  10864. this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).filter((s) => s.startsWith(mu)).length > 0 && this._afterRenderMetric$.next({
  10865. frameTimeMetric: this._renderFrameTimeMetric,
  10866. tags: this._renderFrameTags
  10867. });
  10868. }), e.renderFrameTimeMetric$.subscribe(([n, s]) => {
  10869. this._renderFrameTimeMetric || (this._renderFrameTimeMetric = {}), this._renderFrameTimeMetric[n] || (this._renderFrameTimeMetric[n] = []), this._renderFrameTimeMetric[n].push(Math.round(s * 100) / 100);
  10870. }), e.renderFrameTags$.subscribe(([n, s]) => {
  10871. this._renderFrameTags[n] = s;
  10872. });
  10873. const t = [];
  10874. this._afterRenderMetric$.pipe(ES(e.endFrame$)).subscribe(([n, s]) => {
  10875. t.push({
  10876. FPS: s.FPS,
  10877. elapsedTime: s.elapsedTime,
  10878. frameTime: Math.round(s.frameTime * 100) / 100,
  10879. ...n.frameTimeMetric,
  10880. ...n.tags
  10881. }), t.length > w_ && (this._renderMetricCapture(t), t.length = 0);
  10882. });
  10883. }
  10884. _renderMetricCapture(e) {
  10885. const t = e;
  10886. if (t.length === 0) return;
  10887. const n = (u) => {
  10888. let h = 0;
  10889. const f = Object.entries(u).filter(([p, S]) => Array.isArray(S)).map(([p]) => p).reduce((p, S) => {
  10890. const b = u[S].reduce((v, _) => v + _, 0);
  10891. return p[S] = b, p;
  10892. }, {});
  10893. return Object.keys(u).filter((p) => p.startsWith(mu)).forEach((p) => {
  10894. h += f[p];
  10895. }), { ...f, extensionTotal: h };
  10896. }, s = e.map((u) => ({ ...u, ...n(u) })), o = ((u) => Object.entries(u[0]).filter(([f, g]) => !["elapsedTime"].includes(f)).filter(([f, g]) => typeof g == "number").map(([f]) => f).reduce((f, g) => {
  10897. const p = u.map((_) => _[g]), S = Math.max(...p), b = Math.min(...p), v = p.reduce((_, R) => _ + R, 0) / p.length;
  10898. return f[g] = {
  10899. max: Math.round(S * 100) / 100,
  10900. min: Math.round(b * 100) / 100,
  10901. avg: Math.round(v * 100) / 100
  10902. }, f;
  10903. }, {}))(s), l = t[t.length - 1].elapsedTime, a = this._context.unit.getActiveSheet().getSheetId(), c = this._context.unit.getUnitId(), d = { sheetId: a, unitId: c, elapsedTimeToStart: l, ...o };
  10904. this._telemetryService.capture("sheet_render_cost", d);
  10905. }
  10906. _addComponent(e) {
  10907. const { scene: t, components: n } = this._context, s = e.getActiveSheet(), i = new Yh(qe.MAIN);
  10908. this._addViewport(s);
  10909. const o = new lS(qe.ROW), l = new aS(qe.COLUMN), a = new ge(qe.LEFT_TOP, {
  10910. zIndex: 2,
  10911. left: -1,
  10912. top: -1,
  10913. fill: "rgb(248, 249, 250)",
  10914. stroke: "rgb(217, 217, 217)",
  10915. strokeWidth: 1
  10916. });
  10917. this._context.mainComponent = i, n.set(qe.MAIN, i), n.set(qe.ROW, o), n.set(qe.COLUMN, l), n.set(qe.LEFT_TOP, a), t.addObjects([i], Tu), t.addObjects(
  10918. [o, l, a],
  10919. rr
  10920. ), t.enableLayerCache(Tu, rr);
  10921. }
  10922. _initViewports(e, t, n) {
  10923. const o = new Cn(z.VIEW_MAIN, e, {
  10924. left: t.width,
  10925. top: n.height,
  10926. bottom: 0,
  10927. right: 0,
  10928. isWheelPreventDefaultX: !0,
  10929. allowCache: !0,
  10930. bufferEdgeX: 100,
  10931. bufferEdgeY: 100
  10932. }), l = new Cn(z.VIEW_MAIN_LEFT_TOP, e, {
  10933. isWheelPreventDefaultX: !0,
  10934. active: !1,
  10935. allowCache: !0,
  10936. bufferEdgeX: 0,
  10937. bufferEdgeY: 0
  10938. }), a = new Cn(z.VIEW_MAIN_LEFT, e, {
  10939. isWheelPreventDefaultX: !0,
  10940. active: !1,
  10941. allowCache: !0,
  10942. bufferEdgeX: 0,
  10943. bufferEdgeY: 100
  10944. }), c = new Cn(z.VIEW_MAIN_TOP, e, {
  10945. isWheelPreventDefaultX: !0,
  10946. active: !1,
  10947. allowCache: !0,
  10948. bufferEdgeX: 100,
  10949. bufferEdgeY: 0
  10950. }), d = new Cn(z.VIEW_ROW_TOP, e, {
  10951. active: !1,
  10952. isWheelPreventDefaultX: !0
  10953. }), u = new Cn(z.VIEW_ROW_BOTTOM, e, {
  10954. left: 0,
  10955. top: n.height,
  10956. bottom: 0,
  10957. width: t.width,
  10958. isWheelPreventDefaultX: !0
  10959. }), h = new Cn(z.VIEW_COLUMN_LEFT, e, {
  10960. active: !1,
  10961. isWheelPreventDefaultX: !0
  10962. }), m = new Cn(z.VIEW_COLUMN_RIGHT, e, {
  10963. left: t.width,
  10964. top: 0,
  10965. height: n.height,
  10966. right: 0,
  10967. isWheelPreventDefaultX: !0
  10968. }), f = new Cn(z.VIEW_LEFT_TOP, e, {
  10969. left: 0,
  10970. top: 0,
  10971. width: t.width,
  10972. height: n.height,
  10973. isWheelPreventDefaultX: !0
  10974. });
  10975. return {
  10976. viewMain: o,
  10977. viewLeftTop: f,
  10978. viewMainLeftTop: l,
  10979. viewMainLeft: a,
  10980. viewMainTop: c,
  10981. viewColumnLeft: h,
  10982. viewRowTop: d,
  10983. viewRowBottom: u,
  10984. viewColumnRight: m
  10985. };
  10986. }
  10987. /**
  10988. *
  10989. * initViewport & wheel event
  10990. * +-----------------+--------------------+-------------------+
  10991. * | VIEW_LEFT_TOP | VIEW_COLUMN_LEFT | VIEW_COLUMN_RIGHT |
  10992. * +-----------------+--------------------+-------------------+
  10993. * | VIEW_ROW_TOP | VIEW_MAIN_LEFT_TOP | VIEW_MAIN_TOP |
  10994. * +-----------------+--------------------+-------------------+
  10995. * | VIEW_ROW_BOTTOM | VIEW_MAIN_LEFT | VIEW_MAIN |
  10996. * +-----------------+--------------------+-------------------+
  10997. */
  10998. _addViewport(e) {
  10999. const t = this._context.scene, { rowHeader: n, columnHeader: s } = e.getConfig(), { viewMain: i } = this._initViewports(t, n, s);
  11000. return new rd(i), t.attachControl(), i;
  11001. }
  11002. _initRerenderScheduler() {
  11003. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((e) => {
  11004. if (!e) return null;
  11005. const { skeleton: t, sheetId: n } = e, s = this._context.unit, i = s == null ? void 0 : s.getSheetBySheetId(n);
  11006. if (s == null || i == null) return;
  11007. const { mainComponent: o, components: l } = this._context, a = o, c = l.get(qe.ROW), d = l.get(qe.COLUMN), u = l.get(qe.LEFT_TOP), { rowHeaderWidth: h, columnHeaderHeight: m } = t;
  11008. a == null || a.updateSkeleton(t), c == null || c.updateSkeleton(t), d == null || d.updateSkeleton(t), u == null || u.transformByState({
  11009. width: h,
  11010. height: m
  11011. });
  11012. }));
  11013. }
  11014. _initCommandListener() {
  11015. this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
  11016. const { unit: t } = this._context, { id: n } = e;
  11017. if (Io.includes(n) || this._sheetRenderService.checkMutationShouldTriggerRerender(n)) {
  11018. const s = e.params, { unitId: i, subUnitId: o } = s, l = t.getActiveSheet();
  11019. if (!l) return;
  11020. const a = this._context.unitId, c = l.getSheetId();
  11021. if (i !== a || o !== c)
  11022. return;
  11023. this._sheetSkeletonManagerService.makeDirty({
  11024. sheetId: c,
  11025. commandId: n
  11026. }, !0), this._sheetSkeletonManagerService.setCurrent({
  11027. sheetId: c,
  11028. commandId: n
  11029. });
  11030. } else US.includes(n) && this._sheetSkeletonManagerService.reCalculate();
  11031. e.type === K.MUTATION && this._markUnitDirty(e);
  11032. }));
  11033. }
  11034. _markUnitDirty(e) {
  11035. const { mainComponent: t, scene: n } = this._context;
  11036. if (e.id === MC.id && e.params.stageInfo != null || (t && t.makeDirty(), n.makeDirty(), !e.params)) return;
  11037. const s = e.params, i = this._spreadsheetViewports(n);
  11038. if (e.id === Se.id && s.cellValue) {
  11039. const o = this._cellValueToRange(s.cellValue), l = this._rangeToBounds([o]);
  11040. this._markViewportDirty(i, l), t.setDirtyArea(l);
  11041. }
  11042. if (e.id === tr.id && s.from && s.to) {
  11043. const o = s.fromRange || this._cellValueToRange(s.from.value), l = s.toRange || this._cellValueToRange(s.to.value), a = this._rangeToBounds([o, l]);
  11044. this._markViewportDirty(i, a), t.setDirtyArea(a);
  11045. }
  11046. }
  11047. /**
  11048. * cellValue data structure:
  11049. * {[row]: { [col]: value}}
  11050. * @param cellValue
  11051. * @returns IRange
  11052. */
  11053. _cellValueToRange(e) {
  11054. let t = 0, n = 0, s = 0, i = 0;
  11055. for (const [d, u] of Object.entries(e)) {
  11056. for (const h in u)
  11057. t > Number(h) && (t = Number(h)), n < Number(h) && (n = Number(h));
  11058. s > Number(d) && (s = Number(d)), i < Number(d) && (i = Number(d));
  11059. }
  11060. return {
  11061. startRow: s,
  11062. endRow: i,
  11063. startColumn: t,
  11064. endColumn: n
  11065. };
  11066. }
  11067. _rangeToBounds(e) {
  11068. const t = this._sheetSkeletonManagerService.getCurrent().skeleton, { rowHeightAccumulation: n, columnWidthAccumulation: s, rowHeaderWidth: i, columnHeaderHeight: o } = t, l = [];
  11069. for (const a of e) {
  11070. const { startRow: c, endRow: d, startColumn: u, endColumn: h } = a, m = c === 0 ? 0 : n[c - 1] + o, f = n[d] + o, g = u === 0 ? 0 : s[u - 1] + i, p = s[h] + i;
  11071. l.push({ top: m, left: g, bottom: f, right: p, width: p - g, height: f - m });
  11072. }
  11073. return l;
  11074. }
  11075. _markViewportDirty(e, t) {
  11076. const n = e.filter((s) => s.isActive && s.cacheBound);
  11077. for (const s of n)
  11078. for (const i of t)
  11079. ae.hasIntersectionBetweenTwoRect(s.cacheBound, i) && s.markDirty(!0);
  11080. }
  11081. _spreadsheetViewports(e) {
  11082. return e.getViewports().filter((t) => ["viewMain", "viewMainLeftTop", "viewMainTop", "viewMainLeft"].includes(t.viewportKey));
  11083. }
  11084. };
  11085. Xo = __([
  11086. $i(1, D(me)),
  11087. $i(2, D(Mr)),
  11088. $i(3, F),
  11089. $i(4, Jc(kC))
  11090. ], Xo);
  11091. var Bt = function() {
  11092. return Bt = Object.assign || function(r) {
  11093. for (var e, t = 1, n = arguments.length; t < n; t++) {
  11094. e = arguments[t];
  11095. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (r[s] = e[s]);
  11096. }
  11097. return r;
  11098. }, Bt.apply(this, arguments);
  11099. }, R_ = function(r, e) {
  11100. var t = {};
  11101. for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
  11102. if (r != null && typeof Object.getOwnPropertySymbols == "function")
  11103. for (var s = 0, n = Object.getOwnPropertySymbols(r); s < n.length; s++)
  11104. e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[s]) && (t[n[s]] = r[n[s]]);
  11105. return t;
  11106. }, gt = ht(function(r, e) {
  11107. var t = r.icon, n = r.id, s = r.className, i = r.extend, o = R_(r, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(n, " ").concat(s || "").trim(), a = xn("_".concat(M_()));
  11108. return Vf(t, "".concat(n), { defIds: t.defIds, idSuffix: a.current }, Bt({ ref: e, className: l }, o), i);
  11109. });
  11110. function Vf(r, e, t, n, s) {
  11111. return at(r.tag, Bt(Bt({ key: e }, I_(r, t, s)), n), (y_(r, t).children || []).map(function(i, o) {
  11112. return Vf(i, "".concat(e, "-").concat(r.tag, "-").concat(o), t, void 0, s);
  11113. }));
  11114. }
  11115. function I_(r, e, t) {
  11116. var n = Bt({}, r.attrs);
  11117. t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1);
  11118. var s = e.defIds;
  11119. return !s || s.length === 0 || (r.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(i) {
  11120. var o = i[0], l = i[1];
  11121. typeof l == "string" && (n[o] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
  11122. })), n;
  11123. }
  11124. function y_(r, e) {
  11125. var t, n = e.defIds;
  11126. return !n || n.length === 0 ? r : r.tag === "defs" && (!((t = r.children) === null || t === void 0) && t.length) ? Bt(Bt({}, r), { children: r.children.map(function(s) {
  11127. return typeof s.attrs.id == "string" && n && n.indexOf(s.attrs.id) > -1 ? Bt(Bt({}, s), { attrs: Bt(Bt({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
  11128. }) }) : r;
  11129. }
  11130. function M_() {
  11131. return Math.random().toString(36).substring(2, 8);
  11132. }
  11133. gt.displayName = "UniverIcon";
  11134. var P_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, kf = ht(function(r, e) {
  11135. return at(gt, Object.assign({}, r, {
  11136. id: "autofill",
  11137. ref: e,
  11138. icon: P_
  11139. }));
  11140. });
  11141. kf.displayName = "Autofill";
  11142. var E_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Hn = ht(function(r, e) {
  11143. return at(gt, Object.assign({}, r, {
  11144. id: "check-mark-single",
  11145. ref: e,
  11146. icon: E_
  11147. }));
  11148. });
  11149. Hn.displayName = "CheckMarkSingle";
  11150. var T_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, Df = ht(function(r, e) {
  11151. return at(gt, Object.assign({}, r, {
  11152. id: "close-single",
  11153. ref: e,
  11154. icon: T_
  11155. }));
  11156. });
  11157. Df.displayName = "CloseSingle";
  11158. var x_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#convert-single_clip0_911_593)" }, children: [{ tag: "path", attrs: { d: "M2.44766.848145C1.564.848145.847656 1.56449.847656 2.44814V6.44814C.847656 7.3318 1.564 8.04814 2.44766 8.04814H6.44766C7.33131 8.04814 8.04766 7.3318 8.04766 6.44814V2.44814C8.04766 1.56449 7.33131.848145 6.44766.848145H2.44766zM2.04766 6.44814V5.04824H3.84775V6.84814H2.44766C2.22674 6.84814 2.04766 6.66906 2.04766 6.44814zM2.04766 3.84824H3.84775V2.04814H2.44766C2.22674 2.04814 2.04766 2.22723 2.04766 2.44814V3.84824zM5.04775 6.84814V5.04824H6.84766V6.44814C6.84766 6.66906 6.66857 6.84814 6.44766 6.84814H5.04775zM5.04775 3.84824H6.84766V2.44814C6.84766 2.22723 6.66857 2.04814 6.44766 2.04814H5.04775V3.84824zM9.55215 7.95166C8.66849 7.95166 7.95215 8.668 7.95215 9.55166V13.5517C7.95215 14.4353 8.66849 15.1517 9.55215 15.1517L11.5522 15.1517 13.5521 15.1517C14.4358 15.1517 15.1521 14.4353 15.1521 13.5517L15.1521 11.5518 15.1521 9.55166C15.1521 8.668 14.4358 7.95166 13.5521 7.95166H9.55215zM13.9521 10.9518V9.55166C13.9521 9.33075 13.7731 9.15166 13.5521 9.15166H12.1522V10.9518H13.9521zM10.9522 10.9518V9.15166H9.55215C9.33123 9.15166 9.15215 9.33075 9.15215 9.55166V10.9518H10.9522zM9.15215 12.1518H10.9522V13.9517H9.55215C9.33123 13.9517 9.15215 13.7726 9.15215 13.5517V12.1518zM12.1522 12.1518H13.9521V13.5517C13.9521 13.7726 13.7731 13.9517 13.5521 13.9517H12.1522V12.1518z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { d: "M9.62158 2.44912C9.62158 2.11775 9.89021 1.84912 10.2216 1.84912H12.7516C13.6352 1.84912 14.3516 2.56547 14.3516 3.44912V5.9791C14.3516 6.31047 14.0829 6.5791 13.7516 6.5791 13.4202 6.5791 13.1516 6.31047 13.1516 5.9791V3.44912C13.1516 3.22821 12.9725 3.04912 12.7516 3.04912H10.2216C9.89021 3.04912 9.62158 2.78049 9.62158 2.44912zM5.77871 14.1507C6.11008 14.1507 6.37871 13.8821 6.37871 13.5507 6.37871 13.2193 6.11008 12.9507 5.77871 12.9507L3.24873 12.9507C3.02782 12.9507 2.84873 12.7716 2.84873 12.5507L2.84873 10.0207C2.84873 9.68933 2.5801 9.4207 2.24873 9.4207 1.91736 9.4207 1.64873 9.68933 1.64873 10.0207L1.64873 12.5507C1.64873 13.4343 2.36507 14.1507 3.24873 14.1507H5.77871z" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "convert-single_clip0_911_593" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z" } }] }] }], defIds: ["convert-single_clip0_911_593"] }, Lf = ht(function(r, e) {
  11159. return at(gt, Object.assign({}, r, {
  11160. id: "convert-single",
  11161. ref: e,
  11162. icon: x_
  11163. }));
  11164. });
  11165. Lf.displayName = "ConvertSingle";
  11166. var O_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, ea = ht(function(r, e) {
  11167. return at(gt, Object.assign({}, r, {
  11168. id: "delete-single",
  11169. ref: e,
  11170. icon: O_
  11171. }));
  11172. });
  11173. ea.displayName = "DeleteSingle";
  11174. var A_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_371_77", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_371_77)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.85869 12.9216C8.38445 13.4708 7.61555 13.4708 7.14131 12.9216L0.358114 5.06726C-0.406895 4.18144 0.134916 2.66683 1.2168 2.66683L14.7832 2.66683C15.8651 2.66683 16.4069 4.18144 15.6419 5.06726L8.85869 12.9216Z" } }] }] }, Hc = ht(function(r, e) {
  11175. return at(gt, Object.assign({}, r, {
  11176. id: "dropdown-single",
  11177. ref: e,
  11178. icon: A_
  11179. }));
  11180. });
  11181. Hc.displayName = "DropdownSingle";
  11182. var N_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM10.3097 5.69014C10.544 5.92445 10.544 6.30435 10.3097 6.53867L8.84843 7.9999L10.3099 9.46137C10.5442 9.69569 10.5442 10.0756 10.3099 10.3099C10.0756 10.5442 9.69569 10.5442 9.46137 10.3099L7.9999 8.84843L6.53842 10.3099C6.30411 10.5442 5.92421 10.5442 5.6899 10.3099C5.45558 10.0756 5.45558 9.69569 5.6899 9.46137L7.15137 7.9999L5.69014 6.53867C5.45583 6.30435 5.45583 5.92445 5.69014 5.69014C5.92445 5.45583 6.30435 5.45583 6.53867 5.69014L7.9999 7.15137L9.46113 5.69014C9.69544 5.45583 10.0753 5.45583 10.3097 5.69014Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Xd = ht(function(r, e) {
  11183. return at(gt, Object.assign({}, r, {
  11184. id: "error-single",
  11185. ref: e,
  11186. icon: N_
  11187. }));
  11188. });
  11189. Xd.displayName = "ErrorSingle";
  11190. var H_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.28096 4.6541C1.57489 4.50109 1.93721 4.61533 2.09022 4.90926C2.27315 5.26067 2.55999 5.60455 2.94829 5.92278C4.04628 6.82266 5.87505 7.44865 7.99828 7.44865C10.1215 7.44865 11.9503 6.82267 13.0482 5.92279C13.4366 5.60455 13.7234 5.26067 13.9063 4.90927C14.0594 4.61533 14.4217 4.50109 14.7156 4.65409C15.0095 4.8071 15.1238 5.16941 14.9708 5.46334C14.6995 5.98445 14.2981 6.44997 13.8089 6.8509C13.7298 6.91575 13.6481 6.97914 13.564 7.041L15.2245 8.70153C15.4588 8.93585 15.4588 9.31575 15.2245 9.55006C14.9902 9.78438 14.6103 9.78438 14.376 9.55006L12.5041 7.67822C11.8977 7.97568 11.2181 8.21208 10.4884 8.37706L11.0996 10.6581C11.1853 10.9782 10.9954 11.3072 10.6753 11.393C10.3552 11.4787 10.0262 11.2888 9.94045 10.9687L9.29949 8.57652C8.8758 8.62404 8.44081 8.64865 7.99828 8.64865C7.55276 8.64865 7.11487 8.62371 6.68846 8.57555L6.04723 10.9687C5.96147 11.2888 5.63247 11.4788 5.31239 11.393C4.99231 11.3073 4.80236 10.9783 4.88812 10.6582L5.49983 8.37516C4.7743 8.2105 4.09843 7.9752 3.49498 7.67947L1.62436 9.55009C1.39005 9.78441 1.01015 9.78441 0.775835 9.5501C0.54152 9.31578 0.541518 8.93588 0.775832 8.70157L2.43478 7.04261C2.34987 6.98024 2.26746 6.91632 2.18764 6.8509C1.69842 6.44997 1.29706 5.98445 1.0258 5.46335C0.872791 5.16942 0.987031 4.80711 1.28096 4.6541Z" } }] }, Wf = ht(function(r, e) {
  11191. return at(gt, Object.assign({}, r, {
  11192. id: "eyelash-single",
  11193. ref: e,
  11194. icon: H_
  11195. }));
  11196. });
  11197. Wf.displayName = "EyelashSingle";
  11198. var V_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M6.06409 5.53454C5.93592 5.53454 5.84083 5.41567 5.86897 5.29063L5.95442 4.9109C6.05444 4.48178 6.23806 4.11547 6.51182 3.81952 6.81082 3.49628 7.25398 3.35405 7.79738 3.35405 7.99847 3.35405 8.21359 3.37775 8.44188 3.42245 8.46089 3.42617 8.47974 3.43006 8.49846 3.4341 8.7099 3.4798 8.93698 3.38478 9.02031 3.18514L9.24767 2.6404C9.33457 2.43219 9.23178 2.19404 9.01582 2.12874 8.98358 2.11899 8.95028 2.10912 8.91591 2.09914 8.62745 2.01631 8.28392 1.97217 7.88074 1.97217 6.82015 1.97217 6.02714 2.23936 5.4746 2.7444 4.90987 3.26069 4.50889 3.99917 4.28413 4.9762L2.83703 11.1909C2.76126 11.5286 2.666 11.8917 2.54844 12.2812 2.42975 12.6734 2.2873 13.0595 2.12221 13.4373 1.95577 13.8159 1.76813 14.1762 1.55955 14.5171 1.49345 14.6251 1.42515 14.7282 1.35467 14.8263 1.26508 14.9509 1.3347 15.133 1.48655 15.1554 2.13635 15.2509 2.8179 15.0763 3.18197 14.5296 3.32661 14.3124 3.46779 14.0646 3.60509 13.7851 3.96635 13.0497 4.30522 12.0103 4.61867 10.6574L5.469 7.01534C5.49013 6.92483 5.57082 6.86081 5.66376 6.86081H7.62478C7.8097 6.86081 7.97051 6.73405 8.01371 6.55425L8.14014 6.02798C8.20057 5.77642 8.00992 5.53454 7.75121 5.53454H6.06409zM14.3211 5.72037L12.5124 7.96963 11.4089 5.77754C11.3422 5.63012 11.1954 5.5354 11.0336 5.5354H10.3129C10.0085 5.5354 9.80921 5.85428 9.9427 6.1279L11.4089 9.05502 8.79783 12.1493C8.56587 12.4158 8.75519 12.8315 9.10855 12.8315H9.68607C9.80672 12.8315 9.9605 12.7822 10.0388 12.6904L12.1108 10.2648 13.1176 12.561C13.1786 12.7231 13.333 12.8315 13.5061 12.8315H14.3C14.5831 12.8315 14.7417 12.6175 14.6426 12.3524L13.1728 9.28628C13.1728 9.28628 15.4009 6.45542 15.6013 6.17892 15.7966 5.90929 15.6023 5.5354 15.2693 5.5354H14.6661C14.5275 5.5354 14.4333 5.58887 14.3211 5.72037z" } }] }, Bf = ht(function(r, e) {
  11199. return at(gt, Object.assign({}, r, {
  11200. id: "fx-single",
  11201. ref: e,
  11202. icon: V_
  11203. }));
  11204. });
  11205. Bf.displayName = "FxSingle";
  11206. var k_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M6.4833 1.65005C6.4833 1.31868 6.21467 1.05005 5.8833 1.05005C5.55193 1.05005 5.2833 1.31868 5.2833 1.65005V5.28345H1.65029C1.31892 5.28345 1.05029 5.55208 1.05029 5.88345C1.05029 6.21482 1.31892 6.48345 1.65029 6.48345H5.2833V9.51684H1.65029C1.31892 9.51684 1.05029 9.78547 1.05029 10.1168C1.05029 10.4482 1.31892 10.7168 1.65029 10.7168H5.2833V14.35C5.2833 14.6814 5.55193 14.95 5.8833 14.95C6.21467 14.95 6.4833 14.6814 6.4833 14.35V10.7168H9.5167V14.35C9.5167 14.6814 9.78533 14.95 10.1167 14.95C10.4481 14.95 10.7167 14.6814 10.7167 14.35V10.7168H14.3503C14.6817 10.7168 14.9503 10.4482 14.9503 10.1168C14.9503 9.78547 14.6817 9.51685 14.3503 9.51685H10.7167V6.48345H14.3503C14.6817 6.48345 14.9503 6.21482 14.9503 5.88345C14.9503 5.55208 14.6817 5.28345 14.3503 5.28345H10.7167V1.65005C10.7167 1.31868 10.4481 1.05005 10.1167 1.05005C9.78533 1.05005 9.5167 1.31868 9.5167 1.65005V5.28345L6.4833 5.28345V1.65005ZM6.4833 6.48345V9.51684L9.5167 9.51685V6.48345L6.4833 6.48345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.0498 3.65005C1.0498 2.21411 2.21386 1.05005 3.6498 1.05005H12.3498C13.7857 1.05005 14.9498 2.21411 14.9498 3.65005V12.3501C14.9498 13.786 13.7857 14.95 12.3498 14.95H3.6498C2.21386 14.95 1.0498 13.786 1.0498 12.35V3.65005ZM3.6498 2.25005C2.87661 2.25005 2.2498 2.87685 2.2498 3.65005V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V3.65005C13.7498 2.87685 13.123 2.25005 12.3498 2.25005H3.6498Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ff = ht(function(r, e) {
  11207. return at(gt, Object.assign({}, r, {
  11208. id: "hide-gridlines",
  11209. ref: e,
  11210. icon: k_
  11211. }));
  11212. });
  11213. Ff.displayName = "HideGridlines";
  11214. var D_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, zd = ht(function(r, e) {
  11215. return at(gt, Object.assign({}, r, {
  11216. id: "increase-single",
  11217. ref: e,
  11218. icon: D_
  11219. }));
  11220. });
  11221. zd.displayName = "IncreaseSingle";
  11222. var L_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.62402 7.72905C2.58427 7.72905 2.55205 7.76127 2.55205 7.80102V13.6782C2.55205 13.7179 2.58427 13.7502 2.62402 13.7502H13.3755C13.4152 13.7502 13.4474 13.7179 13.4474 13.6782V7.80102C13.4474 7.76127 13.4152 7.72905 13.3755 7.72905H2.62402ZM1.35205 7.80102C1.35205 7.09853 1.92153 6.52905 2.62402 6.52905H13.3755C14.0779 6.52905 14.6474 7.09853 14.6474 7.80102V13.6782C14.6474 14.3807 14.0779 14.9502 13.3755 14.9502H2.62402C1.92153 14.9502 1.35205 14.3807 1.35205 13.6782V7.80102Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8 2.25005C6.69847 2.25003 5.64336 3.30513 5.64336 4.60666V7.12895C5.64336 7.46032 5.37473 7.72895 5.04336 7.72895 4.71199 7.72895 4.44336 7.46032 4.44336 7.12895V4.60666C4.44336 2.64239 6.04451 1.05565 8.00879 1.05566M8 2.25005L8.00879 1.05566 8 2.25005zM8.00879 1.05566L8 2.25005C9.30154 2.25003 10.3567 3.30513 10.3567 4.60666V7.12895C10.3567 7.46032 10.6253 7.72895 10.9567 7.72895 11.288 7.72895 11.5567 7.46032 11.5567 7.12895V4.60666C11.5567 2.64239 9.97306 1.05565 8.00879 1.05566zM8.00039 9.4668C8.33176 9.4668 8.60039 9.73543 8.60039 10.0668V12.0827C8.60039 12.4141 8.33176 12.6827 8.00039 12.6827 7.66902 12.6827 7.40039 12.4141 7.40039 12.0827V10.0668C7.40039 9.73543 7.66902 9.4668 8.00039 9.4668z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Yd = ht(function(r, e) {
  11223. return at(gt, Object.assign({}, r, {
  11224. id: "lock-single",
  11225. ref: e,
  11226. icon: L_
  11227. }));
  11228. });
  11229. Yd.displayName = "LockSingle";
  11230. var W_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, hs = ht(function(r, e) {
  11231. return at(gt, Object.assign({}, r, {
  11232. id: "more-down-single",
  11233. ref: e,
  11234. icon: W_
  11235. }));
  11236. });
  11237. hs.displayName = "MoreDownSingle";
  11238. var B_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.90913 3.57564C6.14345 3.34132 6.52335 3.34132 6.75766 3.57564L10.7577 7.57564C10.992 7.80995 10.992 8.18985 10.7577 8.42417L6.75766 12.4242C6.52335 12.6585 6.14345 12.6585 5.90913 12.4242C5.67482 12.1899 5.67482 11.81 5.90913 11.5756L9.48487 7.9999L5.90913 4.42417C5.67482 4.18985 5.67482 3.80995 5.90913 3.57564Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vc = ht(function(r, e) {
  11239. return at(gt, Object.assign({}, r, {
  11240. id: "more-single",
  11241. ref: e,
  11242. icon: B_
  11243. }));
  11244. });
  11245. Vc.displayName = "MoreSingle";
  11246. var F_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_1204", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_1204)" }, children: [{ tag: "rect", attrs: { width: 12.62, height: 2.79, x: 1.69, y: 12.25, fill: "colorChannel1", rx: 1.4 } }, { tag: "path", attrs: { fill: "currentColor", d: "M7.74646 2.1642C7.34284 1.65121 6.85947 1.28205 6.38447 1.09593C5.86863 0.893787 5.15166 0.852126 4.70047 1.42917C4.29842 1.94344 4.33082 2.70249 4.57691 3.50395C4.68808 3.8661 4.86846 4.22254 5.12522 4.56617C5.13695 4.58185 5.14927 4.5968 5.16211 4.61102C5.17152 4.6214 5.18122 4.63139 5.19115 4.64096C5.20459 4.65393 5.21855 4.66618 5.23296 4.6777L3.5064 6.40422C3.26756 6.64306 3.26756 7.03033 3.5064 7.26919L7.23756 11.0004C7.47648 11.2392 7.86375 11.2392 8.1026 11.0004L12.8329 6.27001C13.0717 6.03117 13.0717 5.6439 12.8329 5.40505L9.10172 1.67387C8.86288 1.43503 8.47561 1.43503 8.23676 1.67387L7.74646 2.1642ZM7.46162 4.50638C7.47252 4.57574 7.48163 4.64652 7.4888 4.71868C7.52232 5.05481 7.82194 5.30013 8.15807 5.26661C8.4942 5.23311 8.73954 4.93345 8.70601 4.59732C8.65786 4.11463 8.54251 3.6666 8.37892 3.26169L8.66928 2.97135L11.5354 5.83753L10.6106 6.76237H4.87824L7.40802 4.2326C7.42885 4.32128 7.44684 4.41255 7.46162 4.50638ZM6.87284 3.03784C6.57441 2.62008 6.22261 2.34634 5.93815 2.23487C5.80233 2.18165 5.71528 2.17827 5.67638 2.18335C5.6725 2.18387 5.66929 2.18443 5.6666 2.18497L5.6619 2.18607C5.64166 2.21954 5.53594 2.45979 5.74626 3.1449C5.81241 3.36036 5.92262 3.58602 6.09307 3.81761L6.87284 3.03784Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.1932 11.5463C12.6454 11.5463 13.012 11.1797 13.012 10.7275C13.012 10.4475 12.6981 9.92821 12.459 9.5733C12.3299 9.38173 12.0564 9.38174 11.9274 9.57331C11.6883 9.92822 11.3744 10.4475 11.3744 10.7275C11.3744 11.1797 11.741 11.5463 12.1932 11.5463Z" } }] }] }, Uf = ht(function(r, e) {
  11247. return at(gt, Object.assign({}, r, {
  11248. id: "paint-bucket",
  11249. ref: e,
  11250. icon: F_
  11251. }));
  11252. });
  11253. Uf.displayName = "PaintBucket";
  11254. var U_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_1138", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_1138)" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M7.74692 9.12463C7.74692 9.46018 8.01893 9.73219 8.35448 9.73219H11.4933C11.8288 9.73219 12.1009 9.46018 12.1009 9.12463 12.1009 8.78909 11.8288 8.51707 11.4933 8.51707H8.35448C8.01893 8.51707 7.74692 8.78909 7.74692 9.12463zM10.8636 10.8523C10.8636 11.1879 10.5915 11.4599 10.256 11.4599H8.35448C8.01893 11.4599 7.74692 11.1879 7.74692 10.8523 7.74692 10.5168 8.01893 10.2447 8.35448 10.2447H10.256C10.5915 10.2447 10.8636 10.5168 10.8636 10.8523z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.4791 1.98268C5.47913 1.71529 5.87912 1.49854 6.37252 1.49854C6.86593 1.49854 7.26592 1.71529 7.26595 1.98268H7.62187C8.22277 1.98268 8.72459 2.39534 8.84412 2.9452H9.39563C10.0856 2.9452 10.6449 3.48923 10.6449 4.16032V6.00569H12.1261C13.161 6.00569 14 6.82174 14 7.82838V11.334C14 11.8174 13.8025 12.281 13.4511 12.6228L12.0693 13.9647C11.7179 14.3065 11.2412 14.4985 10.7442 14.4985H7.91116C7.05024 14.4985 6.32492 14.0431 6.10535 13.2737H3.34925C2.6593 13.2737 2.09998 12.7297 2.09998 12.0586V4.16032C2.09998 3.48923 2.6593 2.9452 3.34925 2.9452H3.90107C4.0206 2.39534 4.52241 1.98268 5.12332 1.98268H5.4791ZM3.97249 4.16032H3.24925L3.24925 12.0586H6.03725V7.82838C6.03725 6.82174 6.87623 6.00569 7.91116 6.00569H9.49563V4.16032H8.7727C8.58289 4.59611 8.13909 4.90183 7.62187 4.90183H5.12332C4.6061 4.90183 4.1623 4.59611 3.97249 4.16032ZM5.12332 2.89403H7.62187C7.79436 2.89403 7.93419 3.03003 7.93419 3.19781V3.68671C7.93419 3.85448 7.79436 3.99049 7.62187 3.99049H5.12332C4.95083 3.99049 4.811 3.85448 4.811 3.68671V3.19781C4.811 3.03003 4.95083 2.89403 5.12332 2.89403ZM7.91116 7.11157C7.56618 7.11157 7.28652 7.38359 7.28652 7.71913V12.7851C7.28652 13.1206 7.56618 13.3927 7.91116 13.3927H10.7442C10.8401 13.3927 10.9337 13.3712 11.0182 13.3311C11.1373 13.2746 11.1859 13.1423 11.1859 13.0134V12.0066C11.1859 11.8724 11.2978 11.7636 11.4358 11.7636H12.4709C12.6034 11.7636 12.7394 11.7163 12.7975 11.6004C12.8388 11.5182 12.8608 11.4272 12.8608 11.334V7.71913C12.8608 7.38359 12.5811 7.11157 12.2362 7.11157H7.91116Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, jf = ht(function(r, e) {
  11255. return at(gt, Object.assign({}, r, {
  11256. id: "paste-special",
  11257. ref: e,
  11258. icon: U_
  11259. }));
  11260. });
  11261. jf.displayName = "PasteSpecial";
  11262. var j_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.785 6.77762C5.78908 6.7777 5.79316 6.77774 5.79725 6.77774C5.80134 6.77774 5.80543 6.7777 5.8095 6.77762H10.0184C10.0225 6.7777 10.0266 6.77774 10.0307 6.77774C10.0347 6.77774 10.0388 6.7777 10.0429 6.77762H13.6638V7.63727C13.6638 7.96864 13.9324 8.23727 14.2638 8.23727C14.5951 8.23727 14.8638 7.96864 14.8638 7.63727V3.9999C14.8638 2.56395 13.6997 1.39989 12.2637 1.3999L3.56389 1.39999C2.12797 1.40001 0.96393 2.56405 0.96392 3.99998L0.963867 11.6666C0.963857 13.1025 2.12792 14.2666 3.56387 14.2666H8.0542C8.38557 14.2666 8.6542 13.9979 8.6542 13.6666C8.6542 13.3352 8.38557 13.0666 8.0542 13.0666H3.56387C2.79067 13.0666 2.16386 12.4398 2.16387 11.6666L2.1639 6.77762H5.785ZM6.39725 2.59996L9.43065 2.59993V5.57762H6.39725V2.59996ZM5.19725 5.57762V2.59998L3.56391 2.59999C2.79072 2.6 2.16393 3.22679 2.16392 3.99998L2.16391 5.57762H5.19725ZM13.6638 5.57762V3.9999C13.6638 3.2267 13.037 2.59989 12.2638 2.5999L10.6307 2.59992V5.57762H13.6638Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M14.1223 10.2333V10.7496C14.7087 10.9869 15.1223 11.5618 15.1223 12.2333V12.8999C15.1223 13.7836 14.406 14.4999 13.5223 14.4999H11.5223C10.6387 14.4999 9.92235 13.7836 9.92235 12.8999V12.2333C9.92235 11.5618 10.336 10.9869 10.9223 10.7496V10.2333C10.9223 9.34961 11.6387 8.63328 12.5223 8.63328C13.406 8.63328 14.1223 9.34961 14.1223 10.2333ZM11.1223 12.2333C11.1223 12.0124 11.3014 11.8333 11.5223 11.8333H13.5223C13.7433 11.8333 13.9223 12.0124 13.9223 12.2333V12.8999C13.9223 13.1209 13.7433 13.2999 13.5223 13.2999H11.5223C11.3014 13.2999 11.1223 13.1209 11.1223 12.8999V12.2333ZM12.9223 10.2333V10.6333H12.1223V10.2333C12.1223 10.0124 12.3014 9.83328 12.5223 9.83328C12.7433 9.83328 12.9223 10.0124 12.9223 10.2333Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Xf = ht(function(r, e) {
  11263. return at(gt, Object.assign({}, r, {
  11264. id: "protect-single",
  11265. ref: e,
  11266. icon: j_
  11267. }));
  11268. });
  11269. Xf.displayName = "ProtectSingle";
  11270. var X_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM8.00008 12.3671C8.46031 12.3671 8.83342 11.994 8.83342 11.5338C8.83342 11.0735 8.46031 10.7004 8.00008 10.7004C7.53985 10.7004 7.16675 11.0735 7.16675 11.5338C7.16675 11.994 7.53985 12.3671 8.00008 12.3671ZM8.5999 4.4335C8.5999 4.10213 8.33127 3.8335 7.9999 3.8335C7.66853 3.8335 7.3999 4.10213 7.3999 4.4335V9.36683C7.3999 9.6982 7.66853 9.96683 7.9999 9.96683C8.33127 9.96683 8.5999 9.6982 8.5999 9.36683V4.4335Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, kc = ht(function(r, e) {
  11271. return at(gt, Object.assign({}, r, {
  11272. id: "warning-single",
  11273. ref: e,
  11274. icon: X_
  11275. }));
  11276. });
  11277. kc.displayName = "WarningSingle";
  11278. var z_ = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, Zd = ht(function(r, e) {
  11279. return at(gt, Object.assign({}, r, {
  11280. id: "write-single",
  11281. ref: e,
  11282. icon: z_
  11283. }));
  11284. });
  11285. Zd.displayName = "WriteSingle";
  11286. function Y_(r, e) {
  11287. if (r.length !== e.length) return !1;
  11288. const t = r.sort((s, i) => s.id.localeCompare(i.id)), n = e.sort((s, i) => s.id.localeCompare(i.id));
  11289. return t.every((s, i) => {
  11290. var o, l;
  11291. return ((o = s.subject) == null ? void 0 : o.userID) === ((l = n[i].subject) == null ? void 0 : l.userID) && s.role === n[i].role;
  11292. });
  11293. }
  11294. function zf(r, e) {
  11295. return e.some((t) => Z_(r, t));
  11296. }
  11297. function Z_(r, e) {
  11298. const { startRow: t, startColumn: n, endColumn: s, endRow: i } = e, o = r.getMatrixWithMergedCells(t, n, i, s);
  11299. let l = !1;
  11300. return o.forValue((a, c, d) => {
  11301. if (d && (a !== t || c !== n) && r.cellHasValue(d))
  11302. return l = !0, !1;
  11303. }), l;
  11304. }
  11305. function Yf(r, e, t, n) {
  11306. const s = [], i = [], o = t.getSheetId();
  11307. return n.forEach((l) => {
  11308. const a = G_(t, l), c = {
  11309. unitId: e,
  11310. subUnitId: o,
  11311. cellValue: a.getData()
  11312. }, d = en(
  11313. r,
  11314. c
  11315. );
  11316. s.push({ id: Se.id, params: d }), i.push({ id: Se.id, params: c });
  11317. }), {
  11318. undos: s,
  11319. redos: i
  11320. };
  11321. }
  11322. function G_(r, e) {
  11323. const { startRow: t, startColumn: n, endColumn: s, endRow: i } = e, o = r.getMatrixWithMergedCells(t, n, i, s, Lh.Intercepted), l = new Ke();
  11324. let a = null;
  11325. return o.forValue((c, d, u) => {
  11326. var h, m, f, g;
  11327. u && c >= t && d >= n && (!a && r.cellHasValue(u) && (u.v !== "" || ((g = (f = (m = (h = u.p) == null ? void 0 : h.body) == null ? void 0 : m.dataStream) == null ? void 0 : f.length) != null ? g : 0) > 2) && (a = u), l.setValue(c, d, null));
  11328. }), l.setValue(t, n, a), l;
  11329. }
  11330. function q_(r, e, t, n) {
  11331. const s = t.getActiveViewportByCoord(
  11332. Oe.FromArray([r, e])
  11333. );
  11334. if (!s)
  11335. return;
  11336. const { scaleX: i, scaleY: o } = t.getAncestorScale(), l = {
  11337. x: s.viewportScrollX,
  11338. y: s.viewportScrollY
  11339. }, a = n.getCellIndexByOffset(r, e, i, o, l), c = n.worksheet.getMergedCell(a.row, a.column);
  11340. return {
  11341. actualRow: c ? c.startRow : a.row,
  11342. actualCol: c ? c.startColumn : a.column,
  11343. mergeCell: c,
  11344. row: a.row,
  11345. col: a.column
  11346. };
  11347. }
  11348. function lh(r, e, t, n) {
  11349. const s = n.getFreeze();
  11350. if (!s || s.startRow <= 0 && s.startColumn <= 0)
  11351. return t.getViewport(z.VIEW_MAIN);
  11352. if (r >= s.startRow && e >= s.startColumn)
  11353. return t.getViewport(z.VIEW_MAIN);
  11354. if (r < s.startRow && e < s.startColumn)
  11355. return t.getViewport(z.VIEW_MAIN_LEFT_TOP);
  11356. if (r < s.startRow && e >= s.startColumn)
  11357. return t.getViewport(z.VIEW_MAIN_TOP);
  11358. if (r >= s.startRow && e < s.startColumn)
  11359. return t.getViewport(z.VIEW_MAIN_LEFT);
  11360. }
  11361. function Q_(r, e, t, n) {
  11362. const s = ah(r.left, r.top, e, t, n), i = ah(r.right, r.bottom, e, t, n);
  11363. return {
  11364. left: s.x,
  11365. top: s.y,
  11366. right: i.x,
  11367. bottom: i.y
  11368. };
  11369. }
  11370. function ah(r, e, t, n, s) {
  11371. const { scaleX: i, scaleY: o } = t.getAncestorScale(), l = t.getViewport(z.VIEW_MAIN);
  11372. if (!l)
  11373. return {
  11374. x: r,
  11375. y: e
  11376. };
  11377. const a = s.getFreeze(), { startColumn: c, startRow: d, xSplit: u, ySplit: h } = a, m = n.getNoMergeCellPositionByIndexWithNoHeader(d - h, c - u), f = n.getNoMergeCellPositionByIndexWithNoHeader(d, c), { rowHeaderWidth: g, columnHeaderHeight: p } = n, S = f.startX - m.startX, b = f.startY - m.startY, { top: v, left: _, viewportScrollX: R, viewportScrollY: I } = l;
  11378. let y;
  11379. r > _ ? y = (r - R) * i : y = (S + g - (_ - r)) * i;
  11380. let M;
  11381. return e > v ? M = (e - I) * o : M = (b + p - (v - e)) * i, {
  11382. x: y,
  11383. y: M
  11384. };
  11385. }
  11386. function K_(r, e, t, n, s) {
  11387. let i = n, o = s;
  11388. t.overflowCache.forValue((c, d, u) => {
  11389. u.startRow <= i && u.endRow >= i && u.startColumn <= o && u.endColumn >= o && (o = d, i = c);
  11390. });
  11391. const l = t.getCellWithCoordByIndex(i, o);
  11392. return {
  11393. unitId: r.getUnitId(),
  11394. subUnitId: e.getSheetId(),
  11395. workbook: r,
  11396. worksheet: e,
  11397. row: l.actualRow,
  11398. col: l.actualColumn
  11399. };
  11400. }
  11401. function Zf(r, e, t, n, s, i) {
  11402. const { scene: o } = r, l = e.getUnitId(), { skeleton: a, sheetId: c } = n, d = q_(s, i, o, a);
  11403. if (!d)
  11404. return null;
  11405. let { actualCol: u, actualRow: h } = d;
  11406. const m = {
  11407. unitId: l,
  11408. subUnitId: c,
  11409. workbook: e,
  11410. worksheet: t,
  11411. row: h,
  11412. col: u
  11413. };
  11414. a.overflowCache.forValue((I, y, M) => {
  11415. M.startRow <= h && M.endRow >= h && M.startColumn <= u && M.endColumn >= u && (u = y, h = I);
  11416. });
  11417. const f = a.getCellWithCoordByIndex(h, u), g = K_(e, t, a, h, u);
  11418. let p;
  11419. f.mergeInfo ? p = f.mergeInfo : p = {
  11420. startRow: g.row,
  11421. endRow: g.row,
  11422. startColumn: g.col,
  11423. endColumn: g.col
  11424. };
  11425. const S = o.getActiveViewportByCoord(
  11426. Oe.FromArray([s, i])
  11427. );
  11428. if (!S)
  11429. return;
  11430. const { scaleX: b, scaleY: v } = o.getAncestorScale(), _ = {
  11431. x: S.viewportScrollX,
  11432. y: S.viewportScrollY
  11433. };
  11434. return {
  11435. position: {
  11436. startX: (a.getOffsetByPositionX(p.startColumn - 1) - _.x) * b,
  11437. endX: (a.getOffsetByPositionX(p.endColumn) - _.x) * b,
  11438. startY: (a.getOffsetByPositionY(p.startRow - 1) - _.y) * v,
  11439. endY: (a.getOffsetByPositionY(p.endRow) - _.y) * v
  11440. },
  11441. location: m,
  11442. overflowLocation: g
  11443. };
  11444. }
  11445. const or = {
  11446. type: K.COMMAND,
  11447. id: "sheet.command.add-worksheet-merge",
  11448. handler: async (r, e) => {
  11449. const t = r.get(F), n = r.get(Zt), s = r.get(L), i = r.get(tn), o = r.get(Ee), l = e.unitId, a = e.subUnitId, c = e.selections, d = Al(c, e.value), u = s.getUniverSheetInstance(l).getSheetBySheetId(a), h = [], m = [], f = zf(u, d);
  11450. if (f && !e.defaultMerge && !await i.confirm({
  11451. id: "merge.confirm.add-worksheet-merge",
  11452. title: {
  11453. title: "merge.confirm.title"
  11454. },
  11455. cancelText: o.t("merge.confirm.cancel"),
  11456. confirmText: o.t("merge.confirm.confirm")
  11457. }))
  11458. return !1;
  11459. const g = {
  11460. unitId: l,
  11461. subUnitId: a,
  11462. ranges: se.deepClone(d)
  11463. }, p = {
  11464. unitId: l,
  11465. subUnitId: a,
  11466. ranges: se.deepClone(d)
  11467. }, S = Ol(r, g), b = Nl(r, p);
  11468. if (S.ranges.length > 0 && h.push({ id: Kt.id, params: S }), h.push({ id: Jt.id, params: p }), m.push({ id: Kt.id, params: b }), S.ranges.length > 0 && m.push({ id: Jt.id, params: S }), f) {
  11469. const M = Yf(r, l, u, d);
  11470. h.unshift(...M.redos), m.push(...M.undos);
  11471. }
  11472. const v = jS(r, e, d);
  11473. v && h.push(v);
  11474. const _ = XS(r, e);
  11475. _ && m.push(_);
  11476. const I = r.get(Ln).onCommandExecute({
  11477. id: or.id,
  11478. params: { unitId: l, subUnitId: a, ranges: d }
  11479. });
  11480. return h.push(...I.redos), m.push(...I.undos), pl(h, t).result ? (n.pushUndoRedo({
  11481. unitID: l,
  11482. undoMutations: m,
  11483. redoMutations: h
  11484. }), !0) : !1;
  11485. }
  11486. }, Gd = {
  11487. type: K.COMMAND,
  11488. id: "sheet.command.add-worksheet-merge-all",
  11489. handler: async (r) => {
  11490. var d;
  11491. const e = r.get(F), n = (d = r.get($).getCurrentSelections()) == null ? void 0 : d.map((u) => u.range), s = Hd(Bl.MergeAll, n);
  11492. if (!(s != null && s.length))
  11493. return !1;
  11494. const o = r.get(L).getCurrentUnitForType(O.UNIVER_SHEET);
  11495. if (!o) return !1;
  11496. const l = o.getActiveSheet();
  11497. if (!l) return !1;
  11498. const a = o.getUnitId(), c = l.getSheetId();
  11499. return e.executeCommand(or.id, {
  11500. selections: s,
  11501. unitId: a,
  11502. subUnitId: c
  11503. });
  11504. }
  11505. }, qd = {
  11506. type: K.COMMAND,
  11507. id: "sheet.command.add-worksheet-merge-vertical",
  11508. handler: async (r) => {
  11509. var d;
  11510. const e = r.get(F), n = (d = r.get($).getCurrentSelections()) == null ? void 0 : d.map((u) => u.range), s = Hd(Bl.MergeVertical, n);
  11511. if (!(s != null && s.length))
  11512. return !1;
  11513. const o = r.get(L).getCurrentUnitForType(O.UNIVER_SHEET);
  11514. if (!o) return !1;
  11515. const l = o.getActiveSheet();
  11516. if (!l) return !1;
  11517. const a = o.getUnitId(), c = l.getSheetId();
  11518. return e.executeCommand(or.id, {
  11519. value: Bh.COLUMNS,
  11520. selections: s,
  11521. unitId: a,
  11522. subUnitId: c
  11523. });
  11524. }
  11525. }, Qd = {
  11526. type: K.COMMAND,
  11527. id: "sheet.command.add-worksheet-merge-horizontal",
  11528. handler: async (r) => {
  11529. var d;
  11530. const e = r.get(F), n = (d = r.get($).getCurrentSelections()) == null ? void 0 : d.map((u) => u.range), s = Hd(Bl.MergeHorizontal, n);
  11531. if (!(s != null && s.length))
  11532. return !1;
  11533. const o = r.get(L).getCurrentUnitForType(O.UNIVER_SHEET);
  11534. if (!o) return !1;
  11535. const l = o.getActiveSheet();
  11536. if (!l) return !1;
  11537. const a = o.getUnitId(), c = l.getSheetId();
  11538. return e.executeCommand(or.id, {
  11539. value: Bh.ROWS,
  11540. selections: s,
  11541. unitId: a,
  11542. subUnitId: c
  11543. });
  11544. }
  11545. }, Xi = {
  11546. type: K.COMMAND,
  11547. id: "sheet.command.delete-range-move-left-confirm",
  11548. handler: async (r) => {
  11549. const e = r.get(tn), t = r.get(F), n = r.get(Ee), s = r.get($), i = r.get(L), o = s.getCurrentSelections();
  11550. if (!o)
  11551. return !1;
  11552. const l = Ue(i);
  11553. if (!l) return !1;
  11554. const { worksheet: a } = l;
  11555. let c = o[0].range;
  11556. if (!c)
  11557. return !1;
  11558. c = { ...c, endColumn: a.getColumnCount() - 1 };
  11559. const d = (m) => m.endRow - m.startRow;
  11560. return a.getMergeData().find((m) => {
  11561. const f = ae.getIntersects(m, c);
  11562. return f ? d(m) > d(f) : !1;
  11563. }) ? await e.confirm({
  11564. id: Xi.id,
  11565. title: { title: n.t("merge.confirm.waring") },
  11566. children: { title: n.t("merge.confirm.dismantleMergeCellWaring") },
  11567. cancelText: n.t("button.cancel"),
  11568. confirmText: n.t("button.confirm")
  11569. }) ? t.executeCommand(bu.id) : !0 : t.executeCommand(bu.id);
  11570. }
  11571. }, ms = {
  11572. type: K.COMMAND,
  11573. id: "sheet.command.delete-range-move-up-confirm",
  11574. handler: async (r) => {
  11575. const e = r.get(tn), t = r.get(F), n = r.get(Ee), s = r.get($), i = r.get(L), o = s.getCurrentSelections();
  11576. if (!o) return !1;
  11577. const l = Ue(i);
  11578. if (!l) return !1;
  11579. const { worksheet: a } = l;
  11580. let c = o[0].range;
  11581. if (!c) return !1;
  11582. c = { ...c, endRow: a.getRowCount() - 1 };
  11583. for (let m = c.startRow; m <= c.endRow; m++)
  11584. if (a.getRowFiltered(m) && await e.confirm({
  11585. id: ms.id,
  11586. title: { title: n.t("filter.confirm.error") },
  11587. children: { title: n.t("filter.confirm.notAllowedToInsertRange") },
  11588. confirmText: n.t("button.confirm")
  11589. }))
  11590. return !1;
  11591. const d = (m) => m.endColumn - m.startColumn;
  11592. return a.getMergeData().find((m) => {
  11593. const f = ae.getIntersects(m, c);
  11594. return f ? d(m) > d(f) : !1;
  11595. }) ? await e.confirm({
  11596. id: ms.id,
  11597. title: { title: n.t("merge.confirm.waring") },
  11598. children: { title: n.t("merge.confirm.dismantleMergeCellWaring") },
  11599. cancelText: n.t("button.cancel"),
  11600. confirmText: n.t("button.confirm")
  11601. }) ? t.executeCommand(_u.id) : !0 : t.executeCommand(_u.id);
  11602. }
  11603. }, fs = {
  11604. type: K.COMMAND,
  11605. id: "sheet.command.insert-range-move-down-confirm",
  11606. handler: async (r) => {
  11607. const e = r.get(tn), t = r.get(F), n = r.get(Ee), s = r.get($), i = r.get(L), o = s.getCurrentSelections();
  11608. if (!o)
  11609. return !1;
  11610. const l = Ue(i);
  11611. if (!l) return !1;
  11612. const { worksheet: a } = l;
  11613. let c = o[0].range;
  11614. if (!c)
  11615. return !1;
  11616. c = { ...c, endRow: a.getRowCount() - 1 };
  11617. for (let m = c.startRow; m <= c.endRow; m++)
  11618. if (a.getRowFiltered(m) && await e.confirm({
  11619. id: fs.id,
  11620. title: { title: n.t("filter.confirm.error") },
  11621. children: { title: n.t("filter.confirm.notAllowedToInsertRange") },
  11622. confirmText: n.t("button.confirm")
  11623. }))
  11624. return !1;
  11625. const d = (m) => m.endColumn - m.startColumn;
  11626. return a.getMergeData().find((m) => {
  11627. const f = ae.getIntersects(m, c);
  11628. return f ? d(m) > d(f) : !1;
  11629. }) ? await e.confirm({
  11630. id: fs.id,
  11631. title: { title: n.t("merge.confirm.waring") },
  11632. children: { title: n.t("merge.confirm.dismantleMergeCellWaring") },
  11633. cancelText: n.t("button.cancel"),
  11634. confirmText: n.t("button.confirm")
  11635. }) ? t.executeCommand(hc.id) : !0 : t.executeCommand(hc.id);
  11636. }
  11637. }, zi = {
  11638. type: K.COMMAND,
  11639. id: "sheet.command.insert-range-move-right-confirm",
  11640. handler: async (r) => {
  11641. const e = r.get(tn), t = r.get(F), n = r.get(Ee), s = r.get($), i = r.get(L), o = s.getCurrentSelections();
  11642. if (!o)
  11643. return !1;
  11644. const l = Ue(i);
  11645. if (!l) return !1;
  11646. const { worksheet: a } = l;
  11647. let c = o[0].range;
  11648. if (!c)
  11649. return !1;
  11650. c = { ...c, endColumn: a.getColumnCount() - 1 };
  11651. const d = (m) => m.endRow - m.startRow;
  11652. return a.getMergeData().find((m) => {
  11653. const f = ae.getIntersects(m, c);
  11654. return f ? d(m) > d(f) : !1;
  11655. }) ? await e.confirm({
  11656. id: zi.id,
  11657. title: { title: n.t("merge.confirm.waring") },
  11658. children: { title: n.t("merge.confirm.dismantleMergeCellWaring") },
  11659. cancelText: n.t("button.cancel"),
  11660. confirmText: n.t("button.confirm")
  11661. }) ? t.executeCommand(mc.id) : !0 : t.executeCommand(mc.id);
  11662. }
  11663. };
  11664. var Gf = /* @__PURE__ */ ((r) => (r[r.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", r[r.UNIVER_DOC = 1] = "UNIVER_DOC", r[r.UNIVER_SHEET = 2] = "UNIVER_SHEET", r[r.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", r[r.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Gf || {}), de = /* @__PURE__ */ ((r) => (r[r.View = 0] = "View", r[r.Edit = 1] = "Edit", r[r.ManageCollaborator = 2] = "ManageCollaborator", r[r.Print = 3] = "Print", r[r.Duplicate = 4] = "Duplicate", r[r.Comment = 5] = "Comment", r[r.Copy = 6] = "Copy", r[r.Share = 7] = "Share", r[r.Export = 8] = "Export", r[r.MoveWorksheet = 9] = "MoveWorksheet", r[r.DeleteWorksheet = 10] = "DeleteWorksheet", r[r.HideWorksheet = 11] = "HideWorksheet", r[r.RenameWorksheet = 12] = "RenameWorksheet", r[r.CreateWorksheet = 13] = "CreateWorksheet", r[r.SetWorksheetStyle = 14] = "SetWorksheetStyle", r[r.EditWorksheetCell = 15] = "EditWorksheetCell", r[r.InsertHyperlink = 16] = "InsertHyperlink", r[r.Sort = 17] = "Sort", r[r.Filter = 18] = "Filter", r[r.PivotTable = 19] = "PivotTable", r[r.FloatImg = 20] = "FloatImg", r[r.History = 21] = "History", r[r.RwHgtClWdt = 22] = "RwHgtClWdt", r[r.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", r[r.ViewFilter = 24] = "ViewFilter", r[r.MoveSheet = 25] = "MoveSheet", r[r.DeleteSheet = 26] = "DeleteSheet", r[r.HideSheet = 27] = "HideSheet", r[r.CopySheet = 28] = "CopySheet", r[r.RenameSheet = 29] = "RenameSheet", r[r.CreateSheet = 30] = "CreateSheet", r[r.SelectProtectedCells = 31] = "SelectProtectedCells", r[r.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", r[r.SetCellStyle = 33] = "SetCellStyle", r[r.SetCellValue = 34] = "SetCellValue", r[r.SetRowStyle = 35] = "SetRowStyle", r[r.SetColumnStyle = 36] = "SetColumnStyle", r[r.InsertRow = 37] = "InsertRow", r[r.InsertColumn = 38] = "InsertColumn", r[r.DeleteRow = 39] = "DeleteRow", r[r.DeleteColumn = 40] = "DeleteColumn", r[r.EditExtraObject = 41] = "EditExtraObject", r[r.Delete = 42] = "Delete", r[r.RecoverHistory = 43] = "RecoverHistory", r[r.ViewHistory = 44] = "ViewHistory", r[r.CreatePermissionObject = 45] = "CreatePermissionObject", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(de || {}), Nt = /* @__PURE__ */ ((r) => (r[r.Reader = 0] = "Reader", r[r.Editor = 1] = "Editor", r[r.Owner = 2] = "Owner", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Nt || {}), Mn = /* @__PURE__ */ ((r) => (r[r.Unkonwn = 0] = "Unkonwn", r[r.Workbook = 1] = "Workbook", r[r.Worksheet = 2] = "Worksheet", r[r.SelectRange = 3] = "SelectRange", r[r.Document = 4] = "Document", r[r.Slide = 5] = "Slide", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Mn || {}), rn = /* @__PURE__ */ ((r) => (r[r.SomeCollaborator = 0] = "SomeCollaborator", r[r.AllCollaborator = 1] = "AllCollaborator", r[r.OneSelf = 2] = "OneSelf", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(rn || {});
  11665. const fi = "UNIVER_SHEET_PERMISSION_PANEL", Dc = "UNIVER_SHEET_PERMISSION_USER_PART", qf = "UNIVER_SHEET_PERMISSION_BACKGROUND", Qf = "UNIVER_SHEET_PERMISSION_USER_DIALOG", Kf = "UNIVER_SHEET_PERMISSION_DIALOG", zo = "UNIVER_SHEET_PERMISSION_USER_DIALOG_ID", Yo = "UNIVER_SHEET_PERMISSION_DIALOG_ID", eo = {
  11666. [de.Copy]: "Copy",
  11667. [de.SetCellStyle]: "SetCellStyle",
  11668. [de.SetCellValue]: "SetCellValue",
  11669. [de.SetRowStyle]: "SetRowStyle",
  11670. [de.SetColumnStyle]: "SetColumnStyle",
  11671. [de.InsertRow]: "InsertRow",
  11672. [de.InsertColumn]: "InsertColumn",
  11673. [de.InsertHyperlink]: "InsertHyperlink",
  11674. [de.DeleteRow]: "DeleteRow",
  11675. [de.DeleteColumn]: "DeleteColumn",
  11676. [de.Sort]: "Sort",
  11677. [de.Filter]: "Filter",
  11678. [de.PivotTable]: "PivotTable",
  11679. [de.EditExtraObject]: "EditExtraObject"
  11680. }, J_ = [
  11681. de.Copy,
  11682. de.SetCellStyle,
  11683. de.SetCellValue,
  11684. de.SetRowStyle,
  11685. de.SetColumnStyle,
  11686. de.InsertRow,
  11687. de.InsertColumn,
  11688. de.InsertHyperlink,
  11689. de.DeleteRow,
  11690. de.DeleteColumn,
  11691. de.Sort,
  11692. de.Filter,
  11693. de.PivotTable,
  11694. de.EditExtraObject,
  11695. de.View
  11696. ], Jf = "sheet-permission-menu-icon", $_ = "sheet-permission-delete-icon", ew = "sheet-permission-edit-icon", tw = "sheet-permission-check-icon", $f = "sheet-permission-lock-icon", nw = {
  11697. unitId: "",
  11698. subUnitId: "",
  11699. permissionId: "",
  11700. unitType: At.SelectRange,
  11701. id: "",
  11702. ranges: [],
  11703. viewState: ls.OthersCanView,
  11704. editState: on.OnlyMe
  11705. };
  11706. class gs {
  11707. constructor() {
  11708. w(this, "_rule", nw);
  11709. w(this, "_visible", !1);
  11710. }
  11711. setVisible(e) {
  11712. this._visible = e;
  11713. }
  11714. getVisible() {
  11715. return this._visible;
  11716. }
  11717. reset() {
  11718. this.setVisible(!1);
  11719. }
  11720. }
  11721. class Vr {
  11722. constructor() {
  11723. w(this, "_userList", []);
  11724. w(this, "_oldCollaboratorList", []);
  11725. w(this, "_selectUserList", []);
  11726. w(this, "_selectUserList$", new Me(this._selectUserList));
  11727. w(this, "selectUserList$", this._selectUserList$.asObservable());
  11728. }
  11729. get userList() {
  11730. return this._userList;
  11731. }
  11732. // Set all editable users of this unit
  11733. setCanEditUserList(e) {
  11734. this._userList = e;
  11735. }
  11736. reset() {
  11737. this._userList = [], this._oldCollaboratorList = [], this._selectUserList = [], this._selectUserList$.next([]);
  11738. }
  11739. get oldCollaboratorList() {
  11740. return this._oldCollaboratorList;
  11741. }
  11742. setOldCollaboratorList(e) {
  11743. this._oldCollaboratorList = e;
  11744. }
  11745. get selectUserList() {
  11746. return this._selectUserList;
  11747. }
  11748. // The results of the user dialog selection panel should be rendered in the permission panel
  11749. setSelectUserList(e) {
  11750. this._selectUserList = e, this._selectUserList$.next(e);
  11751. }
  11752. }
  11753. const Vn = {
  11754. type: K.OPERATION,
  11755. id: "sheet-permission.operation.openPanel",
  11756. async handler(r, e = {}) {
  11757. const t = r.get(vs), n = r.get(gs), s = r.get(Vr), { showDetail: i = !0, fromSheetBar: o = !1, rule: l, oldRule: a } = e, c = {
  11758. header: { title: "permission.panel.title" },
  11759. children: {
  11760. label: fi,
  11761. showDetail: i,
  11762. fromSheetBar: o,
  11763. rule: l,
  11764. oldRule: a
  11765. },
  11766. width: 330,
  11767. onClose: () => {
  11768. n.reset(), s.reset();
  11769. }
  11770. };
  11771. return n.setVisible(!0), t.open(c), !0;
  11772. }
  11773. }, ta = {
  11774. type: K.COMMAND,
  11775. id: "sheet.command.add-range-protection-from-toolbar",
  11776. async handler(r) {
  11777. return await r.get(F).executeCommand(Vn.id, { showDetail: !0 }), !0;
  11778. }
  11779. }, es = {
  11780. type: K.COMMAND,
  11781. id: "sheet.command.add-range-protection-from-context-menu",
  11782. async handler(r) {
  11783. return await r.get(F).executeCommand(Vn.id, { showDetail: !0 }), !0;
  11784. }
  11785. }, ts = {
  11786. type: K.COMMAND,
  11787. id: "sheet.command.view-sheet-permission-from-context-menu",
  11788. async handler(r) {
  11789. return await r.get(F).executeCommand(Vn.id, { showDetail: !1 }), !0;
  11790. }
  11791. }, na = {
  11792. type: K.COMMAND,
  11793. id: "sheet.command.add-range-protection-from-sheet-bar",
  11794. async handler(r) {
  11795. return await r.get(F).executeCommand(Vn.id, { fromSheetBar: !0, showDetail: !0 }), !0;
  11796. }
  11797. }, ra = {
  11798. type: K.COMMAND,
  11799. id: "sheet.command.view-sheet-permission-from-sheet-bar",
  11800. async handler(r) {
  11801. return await r.get(F).executeCommand(Vn.id, { showDetail: !1 }), !0;
  11802. }
  11803. }, ns = {
  11804. type: K.COMMAND,
  11805. id: "sheet.command.delete-range-protection-from-context-menu",
  11806. async handler(r) {
  11807. var u;
  11808. const e = r.get(F), t = r.get(L), n = r.get(Zt), s = r.get($), i = r.get(ft), o = t.getCurrentUnitForType(O.UNIVER_SHEET), l = o.getActiveSheet(), a = o.getUnitId(), c = l.getSheetId(), d = i.getRule(a, c);
  11809. if (d != null && d.permissionId)
  11810. return e.executeCommand(Po.id, { unitId: a, subUnitId: c, rule: d });
  11811. {
  11812. const h = (u = s.getCurrentLastSelection()) == null ? void 0 : u.range;
  11813. if (!h)
  11814. return !1;
  11815. const g = r.get(Ye).getSubunitRuleList(a, c).find((p) => p.ranges.some((S) => ae.intersects(S, h)));
  11816. if (g) {
  11817. const p = {
  11818. unitId: a,
  11819. subUnitId: c,
  11820. ruleIds: [g.id]
  11821. };
  11822. return await e.executeCommand(wu.id, p) && n.pushUndoRedo({
  11823. unitID: a,
  11824. redoMutations: [{ id: wu.id, params: p }],
  11825. undoMutations: [{ id: zS.id, params: { unitId: a, subUnitId: c, rules: [g] } }]
  11826. }), !0;
  11827. } else
  11828. return !1;
  11829. }
  11830. }
  11831. }, rs = {
  11832. type: K.COMMAND,
  11833. id: "sheet.command.set-range-protection-from-context-menu",
  11834. async handler(r) {
  11835. var d;
  11836. const e = r.get(F), t = r.get(L), n = r.get($), s = r.get(ft), i = t.getCurrentUnitForType(O.UNIVER_SHEET), o = i.getActiveSheet(), l = i.getUnitId(), a = o.getSheetId(), c = s.getRule(l, a);
  11837. if (c != null && c.permissionId) {
  11838. const u = {
  11839. ...c,
  11840. unitId: l,
  11841. subUnitId: a,
  11842. ranges: []
  11843. };
  11844. return await e.executeCommand(Vn.id, { showDetail: !0, rule: se.deepClone(u), oldRule: se.deepClone(u) }), !0;
  11845. } else {
  11846. const u = (d = n.getCurrentLastSelection()) == null ? void 0 : d.range;
  11847. if (!u)
  11848. return !1;
  11849. const f = r.get(Ye).getSubunitRuleList(l, a).find((g) => {
  11850. var p;
  11851. return (p = g == null ? void 0 : g.ranges) == null ? void 0 : p.some((S) => ae.intersects(S, u));
  11852. });
  11853. if (f) {
  11854. const g = {
  11855. ...f,
  11856. unitId: l,
  11857. subUnitId: a
  11858. };
  11859. return await e.executeCommand(Vn.id, { showDetail: !0, rule: se.deepClone(g), oldRule: se.deepClone(g) }), !0;
  11860. } else
  11861. return !1;
  11862. }
  11863. }
  11864. }, gi = {
  11865. id: "sheet.command.remove-row-confirm",
  11866. type: K.COMMAND,
  11867. handler: async (r, e) => {
  11868. var c;
  11869. const t = r.get($);
  11870. let n = e == null ? void 0 : e.range;
  11871. if (n || (n = (c = t.getCurrentLastSelection()) == null ? void 0 : c.range), !n)
  11872. return !1;
  11873. const s = r.get(F), i = r.get(L), o = Ue(i);
  11874. if (!o) return !1;
  11875. const { worksheet: l } = o, a = l.getVisibleRows();
  11876. if (rf(a, [n])) {
  11877. const d = r.get(tn), u = r.get(Ee);
  11878. return await d.confirm({
  11879. id: "sheet.confirm.remove-row",
  11880. title: {
  11881. title: u.t("info.problem")
  11882. },
  11883. children: { title: u.t("rightClick.deleteAllRowsAlert") },
  11884. cancelText: u.t("button.cancel"),
  11885. confirmText: u.t("button.confirm")
  11886. }), !1;
  11887. }
  11888. return await s.executeCommand(Sm.id, { range: n }), !0;
  11889. }
  11890. }, pi = {
  11891. id: "sheet.command.remove-col-confirm",
  11892. type: K.COMMAND,
  11893. handler: async (r, e) => {
  11894. var c;
  11895. const t = r.get($);
  11896. let n = e == null ? void 0 : e.range;
  11897. if (n || (n = (c = t.getCurrentLastSelection()) == null ? void 0 : c.range), !n)
  11898. return !1;
  11899. const s = r.get(F), i = r.get(L), o = Ue(i);
  11900. if (!o) return !1;
  11901. const { worksheet: l } = o, a = l.getVisibleCols();
  11902. if (sf(a, [n])) {
  11903. const d = r.get(tn), u = r.get(Ee);
  11904. return await d.confirm({
  11905. id: "sheet.confirm.remove-col",
  11906. title: {
  11907. title: u.t("info.problem")
  11908. },
  11909. children: { title: u.t("rightClick.deleteAllColumnsAlert") },
  11910. cancelText: u.t("button.cancel"),
  11911. confirmText: u.t("button.confirm")
  11912. }), !1;
  11913. }
  11914. return await s.executeCommand(pm.id, { range: n }), !0;
  11915. }
  11916. }, sa = {
  11917. id: "sheet.command.remove-sheet-confirm",
  11918. type: K.COMMAND,
  11919. handler: async (r, e) => {
  11920. const { subUnitId: t } = e, n = r.get(tn), s = r.get(F), i = r.get(Ee);
  11921. return await n.confirm({
  11922. id: "sheet.confirm.remove-sheet",
  11923. title: {
  11924. title: i.t("sheetConfig.deleteSheet")
  11925. },
  11926. children: { title: i.t("sheetConfig.deleteSheetContent") },
  11927. cancelText: i.t("button.cancel"),
  11928. confirmText: i.t("button.confirm")
  11929. }) ? (await s.executeCommand(YS.id, { subUnitId: t }), !0) : !1;
  11930. }
  11931. }, kr = gn("univer.sheetbar-service");
  11932. class eg extends ce {
  11933. constructor() {
  11934. super();
  11935. w(this, "renameId$");
  11936. w(this, "removeId$");
  11937. w(this, "scroll$");
  11938. w(this, "scrollX$");
  11939. w(this, "addSheet$");
  11940. w(this, "_renameId$");
  11941. w(this, "_removeId$");
  11942. w(this, "_scroll$");
  11943. w(this, "_scrollX$");
  11944. w(this, "_addSheet$");
  11945. w(this, "_currentHandler", null);
  11946. this._renameId$ = new xe(), this.renameId$ = this._renameId$.asObservable(), this._removeId$ = new xe(), this.removeId$ = this._removeId$.asObservable(), this._scroll$ = new xe(), this.scroll$ = this._scroll$.asObservable(), this._scrollX$ = new xe(), this.scrollX$ = this._scrollX$.asObservable(), this._addSheet$ = new xe(), this.addSheet$ = this._addSheet$.asObservable();
  11947. }
  11948. setRenameId(t) {
  11949. this._renameId$.next(t);
  11950. }
  11951. setRemoveId(t) {
  11952. this._removeId$.next(t);
  11953. }
  11954. setScroll(t) {
  11955. this._scroll$.next(t);
  11956. }
  11957. setScrollX(t) {
  11958. this._scrollX$.next(t);
  11959. }
  11960. setAddSheet(t) {
  11961. this._addSheet$.next(t);
  11962. }
  11963. triggerSheetBarMenu() {
  11964. var t;
  11965. (t = this._currentHandler) == null || t.handleSheetBarMenu();
  11966. }
  11967. registerSheetBarMenuHandler(t) {
  11968. if (this._currentHandler)
  11969. throw new Error("There is already a context menu handler!");
  11970. return this._currentHandler = t, Ae(() => {
  11971. this._currentHandler = null;
  11972. });
  11973. }
  11974. }
  11975. const ia = {
  11976. id: "ui-sheet.command.show-menu-list",
  11977. type: K.OPERATION,
  11978. handler: async (r) => (r.get(kr).triggerSheetBarMenu(), !0)
  11979. }, oa = {
  11980. type: K.COMMAND,
  11981. id: "sheet.command.delete-worksheet-protection-from-sheet-bar",
  11982. async handler(r, e) {
  11983. if (!e)
  11984. return !1;
  11985. const t = r.get(F), n = r.get(Zt), s = r.get(ft), o = r.get(L).getCurrentUnitForType(Gf.UNIVER_SHEET), l = o == null ? void 0 : o.getActiveSheet(), a = o.getUnitId();
  11986. if (!l)
  11987. return !1;
  11988. const c = l.getSheetId(), d = s.getRule(a, c);
  11989. if (await t.executeCommand(Po.id, {
  11990. unitId: a,
  11991. subUnitId: c
  11992. })) {
  11993. const h = [{ id: Po.id, params: { unitId: a, subUnitId: c } }], m = [{ id: Cm.id, params: { unitId: a, rule: d } }];
  11994. n.pushUndoRedo({
  11995. unitID: a,
  11996. redoMutations: h,
  11997. undoMutations: m
  11998. });
  11999. }
  12000. return !0;
  12001. }
  12002. }, la = {
  12003. type: K.COMMAND,
  12004. id: "sheet.command.change-sheet-protection-from-sheet-bar",
  12005. async handler(r) {
  12006. return await r.get(F).executeCommand("sheet-permission.operation.openDialog"), !0;
  12007. }
  12008. }, Kd = {
  12009. id: "sheet.operation.set-activate-cell-edit",
  12010. type: K.OPERATION,
  12011. handler: (r, e) => (r.get(tt).setEditCell(e), !0)
  12012. }, aa = {
  12013. id: "sheet.operation.rename-sheet",
  12014. type: K.OPERATION,
  12015. handler: async (r, e) => {
  12016. const t = r.get(kr);
  12017. return e && t.setRenameId(e.subUnitId), !0;
  12018. }
  12019. }, tg = {
  12020. type: K.OPERATION,
  12021. id: "sheet-permission.operation.openDialog",
  12022. async handler(r, e) {
  12023. const t = r.get(bs);
  12024. return t.close("DESKTOP_FIND_REPLACE_DIALOG"), t.open({
  12025. id: Yo,
  12026. title: { title: "permission.dialog.allowedPermissionType" },
  12027. children: { label: Kf },
  12028. width: 393,
  12029. destroyOnClose: !0,
  12030. onClose: () => t.close(Yo)
  12031. }), !0;
  12032. }
  12033. }, Si = "DefinedNameContainer", Jd = {
  12034. id: "sidebar.operation.defined-name",
  12035. type: K.COMMAND,
  12036. handler: async (r, e) => {
  12037. const t = r.get(vs);
  12038. r.get(Ss);
  12039. const n = r.get(Ee), s = r.get(L);
  12040. if (!Ue(s)) return !1;
  12041. switch (e.value) {
  12042. case "open":
  12043. t.open({
  12044. id: Si,
  12045. header: { title: n.t("definedName.featureTitle") },
  12046. children: { label: Si },
  12047. onClose: () => {
  12048. },
  12049. width: 333
  12050. });
  12051. break;
  12052. case "close":
  12053. default:
  12054. t.close();
  12055. break;
  12056. }
  12057. return !0;
  12058. }
  12059. }, rw = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12060. /* @__PURE__ */ C.jsx("path", { d: "M0.98999 1.08218H-0.0100098V0.0821838H0.98999V1.08218Z", fill: "black" }),
  12061. /* @__PURE__ */ C.jsx("path", { d: "M5.78992 1.08218H2.78992V0.0821838H5.78992V1.08218Z", fill: "black" }),
  12062. /* @__PURE__ */ C.jsx("path", { d: "M7.58984 1.08218H8.58984V0.0821838H7.58984V1.08218Z", fill: "black" }),
  12063. /* @__PURE__ */ C.jsx("path", { d: "M14.9152 1.08218H13.9152V0.0821838H14.9152V1.08218Z", fill: "black" }),
  12064. /* @__PURE__ */ C.jsx("path", { d: "M16.7151 1.08218H19.7151V0.0821838H16.7151V1.08218Z", fill: "black" }),
  12065. /* @__PURE__ */ C.jsx("path", { d: "M22.515 1.08218H21.515V0.0821838H22.515V1.08218Z", fill: "black" }),
  12066. /* @__PURE__ */ C.jsx("path", { d: "M27.8405 1.08218H28.8405V0.0821838H27.8405V1.08218Z", fill: "black" }),
  12067. /* @__PURE__ */ C.jsx("path", { d: "M33.6404 1.08218H30.6404V0.0821838H33.6404V1.08218Z", fill: "black" }),
  12068. /* @__PURE__ */ C.jsx("path", { d: "M35.4403 1.08218H36.4403V0.0821838H35.4403V1.08218Z", fill: "black" }),
  12069. /* @__PURE__ */ C.jsx("path", { d: "M42.7657 1.08218H41.7657V0.0821838H42.7657V1.08218Z", fill: "black" }),
  12070. /* @__PURE__ */ C.jsx("path", { d: "M44.5657 1.08218H47.5657V0.0821838H44.5657V1.08218Z", fill: "black" }),
  12071. /* @__PURE__ */ C.jsx("path", { d: "M50.3656 1.08218H49.3656V0.0821838H50.3656V1.08218Z", fill: "black" }),
  12072. /* @__PURE__ */ C.jsx("path", { d: "M55.691 1.08218H56.691V0.0821838H55.691V1.08218Z", fill: "black" }),
  12073. /* @__PURE__ */ C.jsx("path", { d: "M61.491 1.08218H58.491V0.0821838H61.491V1.08218Z", fill: "black" }),
  12074. /* @__PURE__ */ C.jsx("path", { d: "M63.2909 1.08218H64.2909V0.0821838H63.2909V1.08218Z", fill: "black" }),
  12075. /* @__PURE__ */ C.jsx("path", { d: "M70.6163 1.08218H69.6163V0.0821838H70.6163V1.08218Z", fill: "black" }),
  12076. /* @__PURE__ */ C.jsx("path", { d: "M72.4163 1.08218H75.4163V0.0821838H72.4163V1.08218Z", fill: "black" }),
  12077. /* @__PURE__ */ C.jsx("path", { d: "M78.2162 1.08218H77.2162V0.0821838H78.2162V1.08218Z", fill: "black" }),
  12078. /* @__PURE__ */ C.jsx("path", { d: "M83.5416 1.08218H84.5416V0.0821838H83.5416V1.08218Z", fill: "black" }),
  12079. /* @__PURE__ */ C.jsx("path", { d: "M89.3416 1.08218H86.3416V0.0821838H89.3416V1.08218Z", fill: "black" }),
  12080. /* @__PURE__ */ C.jsx("path", { d: "M91.1415 1.08218H92.1415V0.0821838H91.1415V1.08218Z", fill: "black" }),
  12081. /* @__PURE__ */ C.jsx("path", { d: "M98.4669 1.08218H97.4669V0.0821838H98.4669V1.08218Z", fill: "black" }),
  12082. /* @__PURE__ */ C.jsx("path", { d: "M100.267 1.08218H103.267V0.0821838H100.267V1.08218Z", fill: "black" }),
  12083. /* @__PURE__ */ C.jsx("path", { d: "M106.067 1.08218H105.067V0.0821838H106.067V1.08218Z", fill: "black" }),
  12084. /* @__PURE__ */ C.jsx("path", { d: "M111.392 1.08218H112.392V0.0821838H111.392V1.08218Z", fill: "black" }),
  12085. /* @__PURE__ */ C.jsx("path", { d: "M117.192 1.08218H114.192V0.0821838H117.192V1.08218Z", fill: "black" }),
  12086. /* @__PURE__ */ C.jsx("path", { d: "M118.992 1.08218H119.992V0.0821838H118.992V1.08218Z", fill: "black" })
  12087. ] }), sw = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12088. /* @__PURE__ */ C.jsx("path", { d: "M-0.0100098 1.15771H0.98999V0.157715H-0.0100098V1.15771Z", fill: "black" }),
  12089. /* @__PURE__ */ C.jsx("path", { d: "M2.78992 1.15771H5.78992V0.157715H2.78992V1.15771Z", fill: "black" }),
  12090. /* @__PURE__ */ C.jsx("path", { d: "M8.58984 1.15771H7.58984V0.157715H8.58984V1.15771Z", fill: "black" }),
  12091. /* @__PURE__ */ C.jsx("path", { d: "M10.3899 1.15771H11.3899V0.157715H10.3899V1.15771Z", fill: "black" }),
  12092. /* @__PURE__ */ C.jsx("path", { d: "M19.0903 1.15771H18.0903V0.157715H19.0903V1.15771Z", fill: "black" }),
  12093. /* @__PURE__ */ C.jsx("path", { d: "M20.8903 1.15771H23.8903V0.157715H20.8903V1.15771Z", fill: "black" }),
  12094. /* @__PURE__ */ C.jsx("path", { d: "M26.6902 1.15771H25.6902V0.157715H26.6902V1.15771Z", fill: "black" }),
  12095. /* @__PURE__ */ C.jsx("path", { d: "M28.4902 1.15771H29.4902V0.157715H28.4902V1.15771Z", fill: "black" }),
  12096. /* @__PURE__ */ C.jsx("path", { d: "M37.1907 1.15771H36.1907V0.157715H37.1907V1.15771Z", fill: "black" }),
  12097. /* @__PURE__ */ C.jsx("path", { d: "M38.9906 1.15771H41.9906V0.157715H38.9906V1.15771Z", fill: "black" }),
  12098. /* @__PURE__ */ C.jsx("path", { d: "M44.7905 1.15771H43.7905V0.157715H44.7905V1.15771Z", fill: "black" }),
  12099. /* @__PURE__ */ C.jsx("path", { d: "M46.5906 1.15771H47.5906V0.157715H46.5906V1.15771Z", fill: "black" }),
  12100. /* @__PURE__ */ C.jsx("path", { d: "M55.291 1.15771H54.291V0.157715H55.291V1.15771Z", fill: "black" }),
  12101. /* @__PURE__ */ C.jsx("path", { d: "M57.0909 1.15771H60.0909V0.157715H57.0909V1.15771Z", fill: "black" }),
  12102. /* @__PURE__ */ C.jsx("path", { d: "M62.8909 1.15771H61.8909V0.157715H62.8909V1.15771Z", fill: "black" }),
  12103. /* @__PURE__ */ C.jsx("path", { d: "M64.6909 1.15771H65.6909V0.157715H64.6909V1.15771Z", fill: "black" }),
  12104. /* @__PURE__ */ C.jsx("path", { d: "M73.3914 1.15771H72.3914V0.157715H73.3914V1.15771Z", fill: "black" }),
  12105. /* @__PURE__ */ C.jsx("path", { d: "M75.1913 1.15771H78.1913V0.157715H75.1913V1.15771Z", fill: "black" }),
  12106. /* @__PURE__ */ C.jsx("path", { d: "M80.9912 1.15771H79.9912V0.157715H80.9912V1.15771Z", fill: "black" }),
  12107. /* @__PURE__ */ C.jsx("path", { d: "M82.7913 1.15771H83.7913V0.157715H82.7913V1.15771Z", fill: "black" }),
  12108. /* @__PURE__ */ C.jsx("path", { d: "M91.4917 1.15771H90.4917V0.157715H91.4917V1.15771Z", fill: "black" }),
  12109. /* @__PURE__ */ C.jsx("path", { d: "M93.2916 1.15771H96.2916V0.157715H93.2916V1.15771Z", fill: "black" }),
  12110. /* @__PURE__ */ C.jsx("path", { d: "M99.0916 1.15771H98.0916V0.157715H99.0916V1.15771Z", fill: "black" }),
  12111. /* @__PURE__ */ C.jsx("path", { d: "M100.892 1.15771H101.892V0.157715H100.892V1.15771Z", fill: "black" }),
  12112. /* @__PURE__ */ C.jsx("path", { d: "M109.592 1.15771H108.592V0.157715H109.592V1.15771Z", fill: "black" }),
  12113. /* @__PURE__ */ C.jsx("path", { d: "M111.392 1.15771H114.392V0.157715H111.392V1.15771Z", fill: "black" }),
  12114. /* @__PURE__ */ C.jsx("path", { d: "M117.192 1.15771H116.192V0.157715H117.192V1.15771Z", fill: "black" }),
  12115. /* @__PURE__ */ C.jsx("path", { d: "M118.992 1.15771H119.992V0.157715H118.992V1.15771Z", fill: "black" })
  12116. ] }), iw = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12117. /* @__PURE__ */ C.jsx("path", { d: "M-0.00842285 1.22449H2.99158V0.224487H-0.00842285V1.22449Z", fill: "black" }),
  12118. /* @__PURE__ */ C.jsx("path", { d: "M6.14941 1.22449H9.14941V0.224487H6.14941V1.22449Z", fill: "black" }),
  12119. /* @__PURE__ */ C.jsx("path", { d: "M15.3073 1.22449H12.3073V0.224487H15.3073V1.22449Z", fill: "black" }),
  12120. /* @__PURE__ */ C.jsx("path", { d: "M18.4651 1.22449H21.4651V0.224487H18.4651V1.22449Z", fill: "black" }),
  12121. /* @__PURE__ */ C.jsx("path", { d: "M27.6229 1.22449H24.6229V0.224487H27.6229V1.22449Z", fill: "black" }),
  12122. /* @__PURE__ */ C.jsx("path", { d: "M30.7808 1.22449H33.7808V0.224487H30.7808V1.22449Z", fill: "black" }),
  12123. /* @__PURE__ */ C.jsx("path", { d: "M39.9386 1.22449H36.9386V0.224487H39.9386V1.22449Z", fill: "black" }),
  12124. /* @__PURE__ */ C.jsx("path", { d: "M43.0964 1.22449H46.0964V0.224487H43.0964V1.22449Z", fill: "black" }),
  12125. /* @__PURE__ */ C.jsx("path", { d: "M52.2543 1.22449H49.2543V0.224487H52.2543V1.22449Z", fill: "black" }),
  12126. /* @__PURE__ */ C.jsx("path", { d: "M55.4121 1.22449H58.4121V0.224487H55.4121V1.22449Z", fill: "black" }),
  12127. /* @__PURE__ */ C.jsx("path", { d: "M64.5699 1.22449H61.5699V0.224487H64.5699V1.22449Z", fill: "black" }),
  12128. /* @__PURE__ */ C.jsx("path", { d: "M67.7278 1.22449H70.7278V0.224487H67.7278V1.22449Z", fill: "black" }),
  12129. /* @__PURE__ */ C.jsx("path", { d: "M76.8856 1.22449H73.8856V0.224487H76.8856V1.22449Z", fill: "black" }),
  12130. /* @__PURE__ */ C.jsx("path", { d: "M80.0435 1.22449H83.0435V0.224487H80.0435V1.22449Z", fill: "black" }),
  12131. /* @__PURE__ */ C.jsx("path", { d: "M89.2013 1.22449H86.2013V0.224487H89.2013V1.22449Z", fill: "black" }),
  12132. /* @__PURE__ */ C.jsx("path", { d: "M92.3591 1.22449H95.3591V0.224487H92.3591V1.22449Z", fill: "black" }),
  12133. /* @__PURE__ */ C.jsx("path", { d: "M101.517 1.22449H98.517V0.224487H101.517V1.22449Z", fill: "black" }),
  12134. /* @__PURE__ */ C.jsx("path", { d: "M104.675 1.22449H107.675V0.224487H104.675V1.22449Z", fill: "black" }),
  12135. /* @__PURE__ */ C.jsx("path", { d: "M113.833 1.22449H110.833V0.224487H113.833V1.22449Z", fill: "black" }),
  12136. /* @__PURE__ */ C.jsx("path", { d: "M116.99 1.22449H119.99V0.224487H116.99V1.22449Z", fill: "black" })
  12137. ] }), ow = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12138. /* @__PURE__ */ C.jsx("path", { d: "M-0.00976562 1.65707H0.990234V0.657074H-0.00976562V1.65707Z", fill: "black" }),
  12139. /* @__PURE__ */ C.jsx("path", { d: "M2.32361 1.65707H3.32361V0.657074H2.32361V1.65707Z", fill: "black" }),
  12140. /* @__PURE__ */ C.jsx("path", { d: "M5.65698 1.65707H4.65698V0.657074H5.65698V1.65707Z", fill: "black" }),
  12141. /* @__PURE__ */ C.jsx("path", { d: "M6.99036 1.65707H7.99036V0.657074H6.99036V1.65707Z", fill: "black" }),
  12142. /* @__PURE__ */ C.jsx("path", { d: "M10.3237 1.65707H9.32373V0.657074H10.3237V1.65707Z", fill: "black" }),
  12143. /* @__PURE__ */ C.jsx("path", { d: "M11.6571 1.65707H12.6571V0.657074H11.6571V1.65707Z", fill: "black" }),
  12144. /* @__PURE__ */ C.jsx("path", { d: "M14.9905 1.65707H13.9905V0.657074H14.9905V1.65707Z", fill: "black" }),
  12145. /* @__PURE__ */ C.jsx("path", { d: "M16.3239 1.65707H17.3239V0.657074H16.3239V1.65707Z", fill: "black" }),
  12146. /* @__PURE__ */ C.jsx("path", { d: "M19.6572 1.65707H18.6572V0.657074H19.6572V1.65707Z", fill: "black" }),
  12147. /* @__PURE__ */ C.jsx("path", { d: "M20.9906 1.65707H21.9906V0.657074H20.9906V1.65707Z", fill: "black" }),
  12148. /* @__PURE__ */ C.jsx("path", { d: "M24.324 1.65707H23.324V0.657074H24.324V1.65707Z", fill: "black" }),
  12149. /* @__PURE__ */ C.jsx("path", { d: "M25.6573 1.65707H26.6573V0.657074H25.6573V1.65707Z", fill: "black" }),
  12150. /* @__PURE__ */ C.jsx("path", { d: "M28.9907 1.65707H27.9907V0.657074H28.9907V1.65707Z", fill: "black" }),
  12151. /* @__PURE__ */ C.jsx("path", { d: "M30.3241 1.65707H31.3241V0.657074H30.3241V1.65707Z", fill: "black" }),
  12152. /* @__PURE__ */ C.jsx("path", { d: "M33.6575 1.65707H32.6575V0.657074H33.6575V1.65707Z", fill: "black" }),
  12153. /* @__PURE__ */ C.jsx("path", { d: "M34.9908 1.65707H35.9908V0.657074H34.9908V1.65707Z", fill: "black" }),
  12154. /* @__PURE__ */ C.jsx("path", { d: "M38.3242 1.65707H37.3242V0.657074H38.3242V1.65707Z", fill: "black" }),
  12155. /* @__PURE__ */ C.jsx("path", { d: "M39.6576 1.65707H40.6576V0.657074H39.6576V1.65707Z", fill: "black" }),
  12156. /* @__PURE__ */ C.jsx("path", { d: "M42.991 1.65707H41.991V0.657074H42.991V1.65707Z", fill: "black" }),
  12157. /* @__PURE__ */ C.jsx("path", { d: "M44.3243 1.65707H45.3243V0.657074H44.3243V1.65707Z", fill: "black" }),
  12158. /* @__PURE__ */ C.jsx("path", { d: "M47.6577 1.65707H46.6577V0.657074H47.6577V1.65707Z", fill: "black" }),
  12159. /* @__PURE__ */ C.jsx("path", { d: "M48.9911 1.65707H49.9911V0.657074H48.9911V1.65707Z", fill: "black" }),
  12160. /* @__PURE__ */ C.jsx("path", { d: "M52.3245 1.65707H51.3245V0.657074H52.3245V1.65707Z", fill: "black" }),
  12161. /* @__PURE__ */ C.jsx("path", { d: "M53.6578 1.65707H54.6578V0.657074H53.6578V1.65707Z", fill: "black" }),
  12162. /* @__PURE__ */ C.jsx("path", { d: "M56.9912 1.65707H55.9912V0.657074H56.9912V1.65707Z", fill: "black" }),
  12163. /* @__PURE__ */ C.jsx("path", { d: "M58.3246 1.65707H59.3246V0.657074H58.3246V1.65707Z", fill: "black" }),
  12164. /* @__PURE__ */ C.jsx("path", { d: "M61.658 1.65707H60.658V0.657074H61.658V1.65707Z", fill: "black" }),
  12165. /* @__PURE__ */ C.jsx("path", { d: "M62.9913 1.65707H63.9913V0.657074H62.9913V1.65707Z", fill: "black" }),
  12166. /* @__PURE__ */ C.jsx("path", { d: "M66.3247 1.65707H65.3247V0.657074H66.3247V1.65707Z", fill: "black" }),
  12167. /* @__PURE__ */ C.jsx("path", { d: "M67.6581 1.65707H68.6581V0.657074H67.6581V1.65707Z", fill: "black" }),
  12168. /* @__PURE__ */ C.jsx("path", { d: "M70.9915 1.65707H69.9915V0.657074H70.9915V1.65707Z", fill: "black" }),
  12169. /* @__PURE__ */ C.jsx("path", { d: "M72.3248 1.65707H73.3248V0.657074H72.3248V1.65707Z", fill: "black" }),
  12170. /* @__PURE__ */ C.jsx("path", { d: "M75.6582 1.65707H74.6582V0.657074H75.6582V1.65707Z", fill: "black" }),
  12171. /* @__PURE__ */ C.jsx("path", { d: "M76.9916 1.65707H77.9916V0.657074H76.9916V1.65707Z", fill: "black" }),
  12172. /* @__PURE__ */ C.jsx("path", { d: "M80.325 1.65707H79.325V0.657074H80.325V1.65707Z", fill: "black" }),
  12173. /* @__PURE__ */ C.jsx("path", { d: "M81.6583 1.65707H82.6583V0.657074H81.6583V1.65707Z", fill: "black" }),
  12174. /* @__PURE__ */ C.jsx("path", { d: "M84.9917 1.65707H83.9917V0.657074H84.9917V1.65707Z", fill: "black" }),
  12175. /* @__PURE__ */ C.jsx("path", { d: "M86.3251 1.65707H87.3251V0.657074H86.3251V1.65707Z", fill: "black" }),
  12176. /* @__PURE__ */ C.jsx("path", { d: "M89.6584 1.65707H88.6584V0.657074H89.6584V1.65707Z", fill: "black" }),
  12177. /* @__PURE__ */ C.jsx("path", { d: "M90.9918 1.65707H91.9918V0.657074H90.9918V1.65707Z", fill: "black" }),
  12178. /* @__PURE__ */ C.jsx("path", { d: "M94.3252 1.65707H93.3252V0.657074H94.3252V1.65707Z", fill: "black" }),
  12179. /* @__PURE__ */ C.jsx("path", { d: "M95.6586 1.65707H96.6586V0.657074H95.6586V1.65707Z", fill: "black" }),
  12180. /* @__PURE__ */ C.jsx("path", { d: "M98.9919 1.65707H97.9919V0.657074H98.9919V1.65707Z", fill: "black" }),
  12181. /* @__PURE__ */ C.jsx("path", { d: "M100.325 1.65707H101.325V0.657074H100.325V1.65707Z", fill: "black" }),
  12182. /* @__PURE__ */ C.jsx("path", { d: "M103.659 1.65707H102.659V0.657074H103.659V1.65707Z", fill: "black" }),
  12183. /* @__PURE__ */ C.jsx("path", { d: "M104.992 1.65707H105.992V0.657074H104.992V1.65707Z", fill: "black" }),
  12184. /* @__PURE__ */ C.jsx("path", { d: "M108.325 1.65707H107.325V0.657074H108.325V1.65707Z", fill: "black" }),
  12185. /* @__PURE__ */ C.jsx("path", { d: "M109.659 1.65707H110.659V0.657074H109.659V1.65707Z", fill: "black" }),
  12186. /* @__PURE__ */ C.jsx("path", { d: "M112.992 1.65707H111.992V0.657074H112.992V1.65707Z", fill: "black" }),
  12187. /* @__PURE__ */ C.jsx("path", { d: "M114.325 1.65707H115.325V0.657074H114.325V1.65707Z", fill: "black" }),
  12188. /* @__PURE__ */ C.jsx("path", { d: "M117.659 1.65707H116.659V0.657074H117.659V1.65707Z", fill: "black" }),
  12189. /* @__PURE__ */ C.jsx("path", { d: "M118.992 1.65707H119.992V0.657074H118.992V1.65707Z", fill: "black" })
  12190. ] }), lw = () => /* @__PURE__ */ C.jsx("svg", { width: "120", height: "3", viewBox: "0 0 120 3", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ C.jsx(
  12191. "path",
  12192. {
  12193. fillRule: "evenodd",
  12194. clipRule: "evenodd",
  12195. d: "M119.991 2.42035H-0.0090332V0.420349H119.991V2.42035Z",
  12196. fill: "black"
  12197. }
  12198. ) }), aw = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "3", viewBox: "0 0 120 3", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12199. /* @__PURE__ */ C.jsx("path", { d: "M-0.0100098 2.47614H1.98999V0.476135H-0.0100098V2.47614Z", fill: "black" }),
  12200. /* @__PURE__ */ C.jsx("path", { d: "M3.99014 2.47614H9.99014V0.476135H3.99014V2.47614Z", fill: "black" }),
  12201. /* @__PURE__ */ C.jsx("path", { d: "M13.9901 2.47614H11.9901V0.476135H13.9901V2.47614Z", fill: "black" }),
  12202. /* @__PURE__ */ C.jsx("path", { d: "M21.1904 2.47614H23.1904V0.476135H21.1904V2.47614Z", fill: "black" }),
  12203. /* @__PURE__ */ C.jsx("path", { d: "M31.1906 2.47614H25.1906V0.476135H31.1906V2.47614Z", fill: "black" }),
  12204. /* @__PURE__ */ C.jsx("path", { d: "M33.1906 2.47614H35.1906V0.476135H33.1906V2.47614Z", fill: "black" }),
  12205. /* @__PURE__ */ C.jsx("path", { d: "M44.3909 2.47614H42.3909V0.476135H44.3909V2.47614Z", fill: "black" }),
  12206. /* @__PURE__ */ C.jsx("path", { d: "M46.391 2.47614H52.391V0.476135H46.391V2.47614Z", fill: "black" }),
  12207. /* @__PURE__ */ C.jsx("path", { d: "M56.391 2.47614H54.391V0.476135H56.391V2.47614Z", fill: "black" }),
  12208. /* @__PURE__ */ C.jsx("path", { d: "M63.5913 2.47614H65.5913V0.476135H63.5913V2.47614Z", fill: "black" }),
  12209. /* @__PURE__ */ C.jsx("path", { d: "M73.5915 2.47614H67.5915V0.476135H73.5915V2.47614Z", fill: "black" }),
  12210. /* @__PURE__ */ C.jsx("path", { d: "M75.5915 2.47614H77.5915V0.476135H75.5915V2.47614Z", fill: "black" }),
  12211. /* @__PURE__ */ C.jsx("path", { d: "M86.7917 2.47614H84.7917V0.476135H86.7917V2.47614Z", fill: "black" }),
  12212. /* @__PURE__ */ C.jsx("path", { d: "M88.7919 2.47614H94.7919V0.476135H88.7919V2.47614Z", fill: "black" }),
  12213. /* @__PURE__ */ C.jsx("path", { d: "M98.7919 2.47614H96.7919V0.476135H98.7919V2.47614Z", fill: "black" }),
  12214. /* @__PURE__ */ C.jsx("path", { d: "M105.992 2.47614H107.992V0.476135H105.992V2.47614Z", fill: "black" }),
  12215. /* @__PURE__ */ C.jsx("path", { d: "M115.992 2.47614H109.992V0.476135H115.992V2.47614Z", fill: "black" }),
  12216. /* @__PURE__ */ C.jsx("path", { d: "M117.992 2.47614H119.992V0.476135H117.992V2.47614Z", fill: "black" })
  12217. ] }), cw = () => /* @__PURE__ */ C.jsxs("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12218. /* @__PURE__ */ C.jsx("path", { d: "M-0.0100098 2.00415H1.98999V0.00415039H-0.0100098V2.00415Z", fill: "black" }),
  12219. /* @__PURE__ */ C.jsx("path", { d: "M3.99014 2.00415H9.99014V0.00415039H3.99014V2.00415Z", fill: "black" }),
  12220. /* @__PURE__ */ C.jsx("path", { d: "M13.9901 2.00415H11.9901V0.00415039H13.9901V2.00415Z", fill: "black" }),
  12221. /* @__PURE__ */ C.jsx("path", { d: "M15.9901 2.00415H17.9901V0.00415039H15.9901V2.00415Z", fill: "black" }),
  12222. /* @__PURE__ */ C.jsx("path", { d: "M27.4905 2.00415H25.4905V0.00415039H27.4905V2.00415Z", fill: "black" }),
  12223. /* @__PURE__ */ C.jsx("path", { d: "M29.4906 2.00415H35.4906V0.00415039H29.4906V2.00415Z", fill: "black" }),
  12224. /* @__PURE__ */ C.jsx("path", { d: "M39.4906 2.00415H37.4906V0.00415039H39.4906V2.00415Z", fill: "black" }),
  12225. /* @__PURE__ */ C.jsx("path", { d: "M41.4906 2.00415H43.4906V0.00415039H41.4906V2.00415Z", fill: "black" }),
  12226. /* @__PURE__ */ C.jsx("path", { d: "M52.991 2.00415H50.991V0.00415039H52.991V2.00415Z", fill: "black" }),
  12227. /* @__PURE__ */ C.jsx("path", { d: "M54.9911 2.00415H60.9911V0.00415039H54.9911V2.00415Z", fill: "black" }),
  12228. /* @__PURE__ */ C.jsx("path", { d: "M64.9911 2.00415H62.9911V0.00415039H64.9911V2.00415Z", fill: "black" }),
  12229. /* @__PURE__ */ C.jsx("path", { d: "M66.9911 2.00415H68.9911V0.00415039H66.9911V2.00415Z", fill: "black" }),
  12230. /* @__PURE__ */ C.jsx("path", { d: "M78.4915 2.00415H76.4915V0.00415039H78.4915V2.00415Z", fill: "black" }),
  12231. /* @__PURE__ */ C.jsx("path", { d: "M80.4916 2.00415H86.4916V0.00415039H80.4916V2.00415Z", fill: "black" }),
  12232. /* @__PURE__ */ C.jsx("path", { d: "M90.4916 2.00415H88.4916V0.00415039H90.4916V2.00415Z", fill: "black" }),
  12233. /* @__PURE__ */ C.jsx("path", { d: "M92.4916 2.00415H94.4916V0.00415039H92.4916V2.00415Z", fill: "black" }),
  12234. /* @__PURE__ */ C.jsx("path", { d: "M103.992 2.00415H101.992V0.00415039H103.992V2.00415Z", fill: "black" }),
  12235. /* @__PURE__ */ C.jsx("path", { d: "M105.992 2.00415H111.992V0.00415039H105.992V2.00415Z", fill: "black" }),
  12236. /* @__PURE__ */ C.jsx("path", { d: "M115.992 2.00415H113.992V0.00415039H115.992V2.00415Z", fill: "black" }),
  12237. /* @__PURE__ */ C.jsx("path", { d: "M117.992 2.00415H119.992V0.00415039H117.992V2.00415Z", fill: "black" })
  12238. ] }), dw = () => /* @__PURE__ */ C.jsxs("svg", { width: "118", height: "3", viewBox: "0 0 118 3", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
  12239. /* @__PURE__ */ C.jsx("path", { d: "M-0.00854492 2.94815H1.99146V0.948151H-0.00854492V2.94815Z", fill: "black" }),
  12240. /* @__PURE__ */ C.jsx("path", { d: "M6.09668 2.94815H8.09668V0.948151H6.09668V2.94815Z", fill: "black" }),
  12241. /* @__PURE__ */ C.jsx("path", { d: "M14.2019 2.94815H12.2019V0.948151H14.2019V2.94815Z", fill: "black" }),
  12242. /* @__PURE__ */ C.jsx("path", { d: "M18.3071 2.94815H20.3071V0.948151H18.3071V2.94815Z", fill: "black" }),
  12243. /* @__PURE__ */ C.jsx("path", { d: "M26.4124 2.94815H24.4124V0.948151H26.4124V2.94815Z", fill: "black" }),
  12244. /* @__PURE__ */ C.jsx("path", { d: "M30.5176 2.94815H32.5176V0.948151H30.5176V2.94815Z", fill: "black" }),
  12245. /* @__PURE__ */ C.jsx("path", { d: "M38.6228 2.94815H36.6228V0.948151H38.6228V2.94815Z", fill: "black" }),
  12246. /* @__PURE__ */ C.jsx("path", { d: "M42.728 2.94815H44.728V0.948151H42.728V2.94815Z", fill: "black" }),
  12247. /* @__PURE__ */ C.jsx("path", { d: "M50.8333 2.94815H48.8333V0.948151H50.8333V2.94815Z", fill: "black" }),
  12248. /* @__PURE__ */ C.jsx("path", { d: "M54.9385 2.94815H56.9385V0.948151H54.9385V2.94815Z", fill: "black" }),
  12249. /* @__PURE__ */ C.jsx("path", { d: "M63.0437 2.94815H61.0437V0.948151H63.0437V2.94815Z", fill: "black" }),
  12250. /* @__PURE__ */ C.jsx("path", { d: "M67.1489 2.94815H69.1489V0.948151H67.1489V2.94815Z", fill: "black" }),
  12251. /* @__PURE__ */ C.jsx("path", { d: "M75.2542 2.94815H73.2542V0.948151H75.2542V2.94815Z", fill: "black" }),
  12252. /* @__PURE__ */ C.jsx("path", { d: "M79.3594 2.94815H81.3594V0.948151H79.3594V2.94815Z", fill: "black" }),
  12253. /* @__PURE__ */ C.jsx("path", { d: "M87.4645 2.94815H85.4645V0.948151H87.4645V2.94815Z", fill: "black" }),
  12254. /* @__PURE__ */ C.jsx("path", { d: "M91.5697 2.94815H93.5697V0.948151H91.5697V2.94815Z", fill: "black" }),
  12255. /* @__PURE__ */ C.jsx("path", { d: "M99.6749 2.94815H97.6749V0.948151H99.6749V2.94815Z", fill: "black" }),
  12256. /* @__PURE__ */ C.jsx("path", { d: "M103.78 2.94815H105.78V0.948151H103.78V2.94815Z", fill: "black" }),
  12257. /* @__PURE__ */ C.jsx("path", { d: "M111.885 2.94815H109.885V0.948151H111.885V2.94815Z", fill: "black" }),
  12258. /* @__PURE__ */ C.jsx("path", { d: "M115.991 2.94815H117.991V0.948151H115.991V2.94815Z", fill: "black" })
  12259. ] }), uw = () => /* @__PURE__ */ C.jsx("svg", { width: "120", height: "4", viewBox: "0 0 120 4", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ C.jsx(
  12260. "path",
  12261. {
  12262. fillRule: "evenodd",
  12263. clipRule: "evenodd",
  12264. d: "M119.991 3.86215H-0.0090332V0.862152H119.991V3.86215Z",
  12265. fill: "black"
  12266. }
  12267. ) }), ch = () => /* @__PURE__ */ C.jsx("svg", { width: "120", height: "2", viewBox: "0 0 120 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ C.jsx(
  12268. "path",
  12269. {
  12270. fillRule: "evenodd",
  12271. clipRule: "evenodd",
  12272. d: "M119.991 1.15668H-0.0090332V0.156677H119.991V1.15668Z",
  12273. fill: "black"
  12274. }
  12275. ) });
  12276. function dh(r) {
  12277. const { type: e = Pe.THIN } = r;
  12278. switch (e) {
  12279. case Pe.DASH_DOT:
  12280. return /* @__PURE__ */ C.jsx(rw, {});
  12281. case Pe.DASH_DOT_DOT:
  12282. return /* @__PURE__ */ C.jsx(sw, {});
  12283. case Pe.DASHED:
  12284. return /* @__PURE__ */ C.jsx(iw, {});
  12285. case Pe.HAIR:
  12286. return /* @__PURE__ */ C.jsx(ow, {});
  12287. case Pe.MEDIUM:
  12288. return /* @__PURE__ */ C.jsx(lw, {});
  12289. case Pe.MEDIUM_DASH_DOT:
  12290. return /* @__PURE__ */ C.jsx(aw, {});
  12291. case Pe.MEDIUM_DASH_DOT_DOT:
  12292. return /* @__PURE__ */ C.jsx(cw, {});
  12293. case Pe.MEDIUM_DASHED:
  12294. return /* @__PURE__ */ C.jsx(dw, {});
  12295. case Pe.THICK:
  12296. return /* @__PURE__ */ C.jsx(uw, {});
  12297. case Pe.THIN:
  12298. return /* @__PURE__ */ C.jsx(ch, {});
  12299. default:
  12300. return /* @__PURE__ */ C.jsx(ch, {});
  12301. }
  12302. }
  12303. const hw = "univer-ui-plugin-sheets-border-panel", mw = "univer-ui-plugin-sheets-border-panel-position", fw = "univer-ui-plugin-sheets-border-panel-position-item", gw = "univer-ui-plugin-sheets-border-panel-position-item-active", pw = "univer-ui-plugin-sheets-border-panel-styles", Sw = "univer-ui-plugin-sheets-border-panel-board", Cw = "univer-ui-plugin-sheets-border-panel-button", vw = "univer-ui-plugin-sheets-border-panel-more-icon", qt = {
  12304. uiPluginSheetsBorderPanel: hw,
  12305. uiPluginSheetsBorderPanelPosition: mw,
  12306. uiPluginSheetsBorderPanelPositionItem: fw,
  12307. uiPluginSheetsBorderPanelPositionItemActive: gw,
  12308. uiPluginSheetsBorderPanelStyles: pw,
  12309. uiPluginSheetsBorderPanelBoard: Sw,
  12310. uiPluginSheetsBorderPanelButton: Cw,
  12311. uiPluginSheetsBorderPanelMoreIcon: vw
  12312. }, $d = `${Ps}_BORDER_PANEL_COMPONENT`, ng = [
  12313. {
  12314. label: "borderLine.borderTop",
  12315. icon: "UpBorder",
  12316. value: "top"
  12317. },
  12318. {
  12319. label: "borderLine.borderBottom",
  12320. icon: "DownBorder",
  12321. value: "bottom"
  12322. },
  12323. {
  12324. label: "borderLine.borderLeft",
  12325. icon: "LeftBorder",
  12326. value: "left"
  12327. },
  12328. {
  12329. label: "borderLine.borderRight",
  12330. icon: "RightBorder",
  12331. value: "right"
  12332. },
  12333. {
  12334. label: "borderLine.borderNone",
  12335. icon: "NoBorderSingle",
  12336. value: "none"
  12337. },
  12338. {
  12339. label: "borderLine.borderAll",
  12340. icon: "AllBorderSingle",
  12341. value: "all"
  12342. },
  12343. {
  12344. label: "borderLine.borderOutside",
  12345. icon: "OuterBorder",
  12346. value: "outside"
  12347. },
  12348. {
  12349. label: "borderLine.borderInside",
  12350. icon: "InnerBorder",
  12351. value: "inside"
  12352. },
  12353. {
  12354. label: "borderLine.borderHorizontal",
  12355. icon: "HorizontalBorder",
  12356. value: "horizontal"
  12357. },
  12358. {
  12359. label: "borderLine.borderVertical",
  12360. icon: "VerticalBorder",
  12361. value: "vertical"
  12362. },
  12363. {
  12364. label: "borderLine.borderTlbr",
  12365. icon: "BackSlashSingle",
  12366. value: "tlbr"
  12367. },
  12368. {
  12369. label: "borderLine.borderTlbcTlmr",
  12370. icon: "LeftDoubleDiagonalSingle",
  12371. value: "tlbc_tlmr"
  12372. },
  12373. {
  12374. label: "borderLine.borderTlbrTlbcTlmr",
  12375. icon: "LeftTridiagonalSingle",
  12376. value: "tlbr_tlbc_tlmr"
  12377. },
  12378. {
  12379. label: "borderLine.borderBlTr",
  12380. icon: "SlashSingle",
  12381. value: "bltr"
  12382. },
  12383. {
  12384. label: "borderLine.borderMltrBctr",
  12385. icon: "RightDoubleDiagonalSingle",
  12386. value: "mltr_bctr"
  12387. }
  12388. ], bw = [
  12389. {
  12390. label: Pe.THIN,
  12391. value: Pe.THIN
  12392. },
  12393. {
  12394. label: Pe.HAIR,
  12395. value: Pe.HAIR
  12396. },
  12397. {
  12398. label: Pe.DOTTED,
  12399. value: Pe.DOTTED
  12400. },
  12401. {
  12402. label: Pe.DASHED,
  12403. value: Pe.DASHED
  12404. },
  12405. {
  12406. label: Pe.DASH_DOT,
  12407. value: Pe.DASH_DOT
  12408. },
  12409. {
  12410. label: Pe.DASH_DOT_DOT,
  12411. value: Pe.DASH_DOT_DOT
  12412. },
  12413. {
  12414. label: Pe.MEDIUM,
  12415. value: Pe.MEDIUM
  12416. },
  12417. {
  12418. label: Pe.MEDIUM_DASHED,
  12419. value: Pe.MEDIUM_DASHED
  12420. },
  12421. {
  12422. label: Pe.MEDIUM_DASH_DOT,
  12423. value: Pe.MEDIUM_DASH_DOT
  12424. },
  12425. {
  12426. label: Pe.MEDIUM_DASH_DOT_DOT,
  12427. value: Pe.MEDIUM_DASH_DOT_DOT
  12428. },
  12429. {
  12430. label: Pe.THICK,
  12431. value: Pe.THICK
  12432. }
  12433. ];
  12434. function rg(r) {
  12435. var a;
  12436. const e = W(Dn), t = W(fc), { onChange: n, value: s } = r;
  12437. function i(c, d) {
  12438. n == null || n({
  12439. ...s,
  12440. [d]: c
  12441. });
  12442. }
  12443. function o(c) {
  12444. const d = e.get(c);
  12445. return d && /* @__PURE__ */ C.jsx(d, { extend: { colorChannel1: "rgb(var(--primary-color))" } });
  12446. }
  12447. function l(c) {
  12448. c.stopPropagation();
  12449. }
  12450. return /* @__PURE__ */ C.jsxs("section", { className: qt.uiPluginSheetsBorderPanel, children: [
  12451. /* @__PURE__ */ C.jsx("div", { className: qt.uiPluginSheetsBorderPanelPosition, children: ng.map((c) => /* @__PURE__ */ C.jsx(
  12452. "div",
  12453. {
  12454. className: t.getBorderInfo().type === c.value ? `
  12455. ${qt.uiPluginSheetsBorderPanelPositionItemActive}
  12456. ${qt.uiPluginSheetsBorderPanelPositionItem}
  12457. ` : qt.uiPluginSheetsBorderPanelPositionItem,
  12458. onClick: (d) => {
  12459. d.stopPropagation(), i(c.value, "type");
  12460. },
  12461. children: o(c.icon)
  12462. },
  12463. c.value
  12464. )) }),
  12465. /* @__PURE__ */ C.jsxs("div", { className: qt.uiPluginSheetsBorderPanelStyles, children: [
  12466. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(
  12467. ei,
  12468. {
  12469. align: {
  12470. offset: [0, 18]
  12471. },
  12472. overlay: /* @__PURE__ */ C.jsx("section", { className: qt.uiPluginSheetsBorderPanelBoard, onClick: l, children: /* @__PURE__ */ C.jsx(Md, { onChange: (c) => i(c, "color") }) }),
  12473. children: /* @__PURE__ */ C.jsxs("a", { className: qt.uiPluginSheetsBorderPanelButton, onClick: l, children: [
  12474. /* @__PURE__ */ C.jsx(Uf, { extend: { colorChannel1: (a = s == null ? void 0 : s.color) != null ? a : "rgb(var(--primary-color))" } }),
  12475. /* @__PURE__ */ C.jsx("span", { className: qt.uiPluginSheetsBorderPanelMoreIcon, children: /* @__PURE__ */ C.jsx(hs, {}) })
  12476. ] })
  12477. }
  12478. ) }),
  12479. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(
  12480. ei,
  12481. {
  12482. align: {
  12483. offset: [0, 18]
  12484. },
  12485. overlay: /* @__PURE__ */ C.jsx("section", { onClick: l, children: /* @__PURE__ */ C.jsx(OC, { children: bw.map((c) => /* @__PURE__ */ C.jsx(
  12486. AC,
  12487. {
  12488. eventKey: c.value.toString(),
  12489. onClick: () => i(c.value, "style"),
  12490. children: /* @__PURE__ */ C.jsx(dh, { type: c.value })
  12491. },
  12492. c.value
  12493. )) }) }),
  12494. children: /* @__PURE__ */ C.jsxs("a", { className: qt.uiPluginSheetsBorderPanelButton, onClick: l, children: [
  12495. /* @__PURE__ */ C.jsx(dh, { type: Pe.THIN }),
  12496. /* @__PURE__ */ C.jsx("span", { className: qt.uiPluginSheetsBorderPanelMoreIcon, children: /* @__PURE__ */ C.jsx(hs, {}) })
  12497. ] })
  12498. }
  12499. ) })
  12500. ] })
  12501. ] });
  12502. }
  12503. function sg(r) {
  12504. var e, t, n = "";
  12505. if (typeof r == "string" || typeof r == "number") n += r;
  12506. else if (typeof r == "object") if (Array.isArray(r)) {
  12507. var s = r.length;
  12508. for (e = 0; e < s; e++) r[e] && (t = sg(r[e])) && (n && (n += " "), n += t);
  12509. } else for (t in r) r[t] && (n && (n += " "), n += t);
  12510. return n;
  12511. }
  12512. function st() {
  12513. for (var r, e, t = 0, n = "", s = arguments.length; t < s; t++) (r = arguments[t]) && (e = sg(r)) && (n && (n += " "), n += e);
  12514. return n;
  12515. }
  12516. const _w = "univer-defined-name", ww = "univer-defined-name-overlay", Rw = "univer-defined-name-overlay-container", Iw = "univer-defined-name-overlay-item", yw = "univer-defined-name-overlay-item-name", Mw = "univer-defined-name-overlay-item-name-for-sheet", Pw = "univer-defined-name-overlay-item-formula", Ew = "univer-defined-name-overlay-manager", Tw = "univer-defined-name-overlay-manager-title", xw = "univer-defined-name-overlay-manager-content", Ow = "univer-defined-name-container", Aw = "univer-defined-name-container-scroll", Nw = "univer-defined-name-container-addButton", Hw = "univer-defined-name-container-addButton-text", Vw = "univer-defined-name-container-item", kw = "univer-defined-name-container-item-name", Dw = "univer-defined-name-container-item-name-for-sheet", Lw = "univer-defined-name-container-item-formula-or-refString", Ww = "univer-defined-name-container-item-update", Bw = "univer-defined-name-container-item-delete", Fw = "univer-defined-name-container-item-show", Uw = "univer-defined-name-input", jw = "univer-defined-name-input-formula-selector-text-wrap", Xw = "univer-defined-name-input-text-editor-container", zw = "univer-defined-name-input-validation", Yw = "univer-defined-name-input-disable", _t = {
  12517. definedName: _w,
  12518. definedNameOverlay: ww,
  12519. definedNameOverlayContainer: Rw,
  12520. definedNameOverlayItem: Iw,
  12521. definedNameOverlayItemName: yw,
  12522. definedNameOverlayItemNameForSheet: Mw,
  12523. definedNameOverlayItemFormula: Pw,
  12524. definedNameOverlayManager: Ew,
  12525. definedNameOverlayManagerTitle: Tw,
  12526. definedNameOverlayManagerContent: xw,
  12527. definedNameContainer: Ow,
  12528. definedNameContainerScroll: Aw,
  12529. definedNameContainerAddButton: Nw,
  12530. definedNameContainerAddButtonText: Hw,
  12531. definedNameContainerItem: Vw,
  12532. definedNameContainerItemName: kw,
  12533. definedNameContainerItemNameForSheet: Dw,
  12534. definedNameContainerItemFormulaOrRefString: Lw,
  12535. definedNameContainerItemUpdate: Ww,
  12536. definedNameContainerItemDelete: Bw,
  12537. definedNameContainerItemShow: Fw,
  12538. definedNameInput: Uw,
  12539. definedNameInputFormulaSelectorTextWrap: jw,
  12540. definedNameInputTextEditorContainer: Xw,
  12541. definedNameInputValidation: zw,
  12542. definedNameInputDisable: Yw
  12543. }, ka = {
  12544. width: "100%"
  12545. }, uh = (r) => {
  12546. const {
  12547. inputId: e,
  12548. state: t = !1,
  12549. type: n = "range",
  12550. confirm: s,
  12551. cancel: i,
  12552. name: o,
  12553. formulaOrRefString: l,
  12554. comment: a = "",
  12555. localSheetId: c = gc,
  12556. hidden: d = !1,
  12557. // 是否对用户隐藏,与excel兼容,暂时用不上。
  12558. id: u
  12559. } = r, m = W(L).getCurrentUnitForType(O.UNIVER_SHEET), f = W(Ee), g = W(ki), p = W(Dm), S = W(km), b = W(Dn), v = sn(() => b.get(Jm), []), _ = sn(() => b.get(Td), []);
  12560. if (m == null)
  12561. return;
  12562. const R = sn(() => m.getUnitId(), []), I = sn(() => m.getActiveSheet().getSheetId(), []), [y, M] = te(o), [P, E] = te(l), [T, A] = te(a), [H, x] = te(c), [k, U] = te(""), [V, N] = te(n), [X, Y] = te(!0), ie = xn({}), [he, ne] = te(!1), pe = [{
  12563. label: f.t("definedName.scopeWorkbook"),
  12564. value: gc
  12565. }], ve = (we) => !Lm(we);
  12566. be(() => {
  12567. ne(!1);
  12568. }, [I]), be(() => {
  12569. Y(!0), M(o), A(a), x(c);
  12570. let we = l;
  12571. l.substring(0, 1) === Xr.EQUALS ? N("formula") : ve(l) ? (N("formula"), we = Xr.EQUALS + l) : N("range"), E(we), U("");
  12572. }, [t]), m.getSheetOrders().forEach((we) => {
  12573. const Ve = m.getSheetBySheetId(we);
  12574. pe.push({
  12575. label: (Ve == null ? void 0 : Ve.getName()) || "",
  12576. value: we
  12577. });
  12578. });
  12579. const G = (we) => {
  12580. E(we);
  12581. }, J = (we) => {
  12582. E(we || "");
  12583. }, le = () => {
  12584. if (y.length === 0) {
  12585. U(f.t("definedName.nameEmpty"));
  12586. return;
  12587. }
  12588. if (g.getValueByName(R, y) != null && (u == null || u.length === 0)) {
  12589. U(f.t("definedName.nameDuplicate"));
  12590. return;
  12591. }
  12592. if (!se.isValidParameter(y) || PC(y) || !se.isStartValidPosition(y) && !cS(y.substring(0, 1))) {
  12593. U(f.t("definedName.nameInvalid"));
  12594. return;
  12595. }
  12596. if (m.getSheetOrders().map((pt) => {
  12597. var bt;
  12598. return ((bt = m.getSheetBySheetId(pt)) == null ? void 0 : bt.getName()) || "";
  12599. }).includes(y)) {
  12600. U(f.t("definedName.nameSheetConflict"));
  12601. return;
  12602. }
  12603. if (P.length === 0) {
  12604. U(f.t("definedName.formulaOrRefStringEmpty"));
  12605. return;
  12606. }
  12607. if (!X) {
  12608. U(f.t("definedName.formulaOrRefStringInvalid"));
  12609. return;
  12610. }
  12611. if (p.hasExecutor(y.toUpperCase())) {
  12612. U(f.t("definedName.nameConflict"));
  12613. return;
  12614. }
  12615. const Ve = m.getActiveSheet().getName();
  12616. s && s({
  12617. id: u || "",
  12618. name: y,
  12619. formulaOrRefString: S.convertRefersToAbsolute(P, ou.ALL, ou.ALL, Ve),
  12620. comment: T,
  12621. localSheetId: H
  12622. });
  12623. }, fe = (we) => {
  12624. const Ve = we;
  12625. Ve === "formula" ? l[0] === Xr.EQUALS ? E(l) : E(`${Xr.EQUALS}`) : l[0] === Xr.EQUALS ? E("") : E(l), N(Ve);
  12626. }, Ze = xn({}), [lt, Be] = te(!1);
  12627. return wo((we) => {
  12628. var pt;
  12629. const Ve = (pt = ie.current) == null ? void 0 : pt.handleOutClick;
  12630. Ve && Ve(we, () => ne(!1));
  12631. }), wo((we) => {
  12632. var pt;
  12633. const Ve = (pt = Ze.current) == null ? void 0 : pt.handleOutClick;
  12634. Ve && Ve(we, () => Be(!1));
  12635. }), /* @__PURE__ */ C.jsxs("div", { className: _t.definedNameInput, style: { display: t ? "block" : "none" }, children: [
  12636. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(ti, { placeholder: f.t("definedName.inputNamePlaceholder"), value: y, allowClear: !0, onChange: M, affixWrapperStyle: ka }) }),
  12637. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsxs(vc, { value: V, onChange: fe, children: [
  12638. /* @__PURE__ */ C.jsx(Zr, { value: "range", children: f.t("definedName.ratioRange") }),
  12639. /* @__PURE__ */ C.jsx(Zr, { value: "formula", children: f.t("definedName.ratioFormula") })
  12640. ] }) }),
  12641. V === "range" ? v && /* @__PURE__ */ C.jsx(
  12642. v,
  12643. {
  12644. unitId: R,
  12645. subUnitId: I,
  12646. initValue: P,
  12647. onChange: G,
  12648. isFocus: he,
  12649. onFocus: () => ne(!0),
  12650. actions: ie.current,
  12651. isSupportAcrossSheet: !0
  12652. }
  12653. ) : _ && /* @__PURE__ */ C.jsx(
  12654. _,
  12655. {
  12656. initValue: P,
  12657. unitId: R,
  12658. subUnitId: I,
  12659. isFocus: lt,
  12660. isSupportAcrossSheet: !0,
  12661. onChange: (we = "") => {
  12662. J(we || "");
  12663. },
  12664. onVerify: (we) => {
  12665. Y(we);
  12666. },
  12667. onFocus: () => Be(!0),
  12668. actions: Ze.current
  12669. }
  12670. ),
  12671. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(Um, { style: ka, value: H, options: pe, onChange: x }) }),
  12672. /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(ti, { affixWrapperStyle: ka, placeholder: f.t("definedName.inputCommentPlaceholder"), value: T, onChange: A }) }),
  12673. /* @__PURE__ */ C.jsxs("div", { style: { display: k.length === 0 ? "none" : "flex" }, className: _t.definedNameInputValidation, children: [
  12674. /* @__PURE__ */ C.jsx("span", { children: k }),
  12675. /* @__PURE__ */ C.jsx(Xd, {})
  12676. ] }),
  12677. /* @__PURE__ */ C.jsxs("div", { children: [
  12678. /* @__PURE__ */ C.jsx(
  12679. fn,
  12680. {
  12681. onClick: () => {
  12682. i && i();
  12683. },
  12684. children: f.t("definedName.cancel")
  12685. }
  12686. ),
  12687. /* @__PURE__ */ C.jsx(
  12688. fn,
  12689. {
  12690. style: { marginLeft: 15 },
  12691. type: "primary",
  12692. onClick: le,
  12693. children: f.t("definedName.confirm")
  12694. }
  12695. )
  12696. ] })
  12697. ] });
  12698. }, ig = () => {
  12699. const r = W(F), t = W(L).getCurrentUnitForType(O.UNIVER_SHEET), n = W(Ee), s = W(ki), i = W($);
  12700. if (t == null)
  12701. return;
  12702. const o = t.getUnitId(), l = () => {
  12703. const T = s.getDefinedNameMap(o);
  12704. return T ? Array.from(Object.values(T)) : [];
  12705. }, [a, c] = te(!1), [d, u] = te(l()), [h, m] = te(null), [f, g] = te();
  12706. be(() => {
  12707. const T = s.update$.subscribe(() => {
  12708. u(l());
  12709. });
  12710. return () => {
  12711. T.unsubscribe();
  12712. };
  12713. }, []);
  12714. const p = (T) => {
  12715. const { name: A, formulaOrRefString: H, comment: x, localSheetId: k, hidden: U } = T;
  12716. let V = T.id;
  12717. if (V == null || V.length === 0)
  12718. V = se.generateRandomId(10), r.executeCommand(ZS.id, { id: V, unitId: o, name: A, formulaOrRefString: H, comment: x, localSheetId: k, hidden: U });
  12719. else {
  12720. const N = { id: V, unitId: o, name: A, formulaOrRefString: H, comment: x, localSheetId: k, hidden: U };
  12721. r.executeCommand(GS.id, N);
  12722. }
  12723. c(!1), m(null);
  12724. }, S = (T) => {
  12725. g(T);
  12726. };
  12727. function b() {
  12728. g(null);
  12729. }
  12730. function v(T) {
  12731. const A = s.getValueById(o, T);
  12732. r.executeCommand(qS.id, { ...A, unitId: o }), g(null);
  12733. }
  12734. const _ = async (T) => {
  12735. const { formulaOrRefString: A, id: H } = T, x = s.getWorksheetByRef(o, A);
  12736. if (!x)
  12737. return;
  12738. x.isSheetHidden() && await r.executeCommand(_d.id, { unitId: o, subUnitId: x.getSheetId() }), s.focusRange(o, H);
  12739. }, R = () => {
  12740. const T = d.length + 1, A = n.t("definedName.defaultName") + T;
  12741. if (s.getValueByName(o, A) == null)
  12742. return A;
  12743. let H = T + 1;
  12744. for (; ; ) {
  12745. const x = n.t("definedName.defaultName") + H;
  12746. if (s.getValueByName(o, x) == null)
  12747. return x;
  12748. H++;
  12749. }
  12750. }, I = () => {
  12751. var x;
  12752. const T = (x = t.getActiveSheet()) == null ? void 0 : x.getName();
  12753. if (!T)
  12754. return "";
  12755. const A = i.getCurrentSelections();
  12756. return A == null ? "" : A.map((k) => Wm(T, k.range)).join(",");
  12757. }, y = () => {
  12758. c(!1), m(null);
  12759. }, M = () => {
  12760. c(!0), m(null);
  12761. }, P = (T) => {
  12762. c(!1), m(T);
  12763. }, E = (T) => {
  12764. const A = t.getSheetBySheetId(T);
  12765. return A == null ? "" : A.getName();
  12766. };
  12767. return /* @__PURE__ */ C.jsx("div", { className: _t.definedNameContainer, children: /* @__PURE__ */ C.jsxs("div", { className: _t.definedNameContainerScroll, children: [
  12768. /* @__PURE__ */ C.jsxs("div", { children: [
  12769. /* @__PURE__ */ C.jsxs("div", { onClick: M, className: _t.definedNameContainerAddButton, style: { display: a ? "none" : "flex" }, children: [
  12770. /* @__PURE__ */ C.jsx(zd, {}),
  12771. /* @__PURE__ */ C.jsx("span", { className: _t.definedNameContainerAddButtonText, children: n.t("definedName.addButton") })
  12772. ] }),
  12773. a && /* @__PURE__ */ C.jsx(uh, { confirm: p, cancel: y, state: a, inputId: "insertDefinedName", name: R(), formulaOrRefString: I() })
  12774. ] }, "insertDefinedName"),
  12775. d.map((T, A) => /* @__PURE__ */ C.jsxs("div", { children: [
  12776. /* @__PURE__ */ C.jsxs("div", { onClick: () => {
  12777. _(T);
  12778. }, className: _t.definedNameContainerItem, style: { display: T.id === h ? "none" : "flex" }, children: [
  12779. /* @__PURE__ */ C.jsxs("div", { title: T.comment, children: [
  12780. /* @__PURE__ */ C.jsxs("div", { className: _t.definedNameContainerItemName, children: [
  12781. T.name,
  12782. /* @__PURE__ */ C.jsx("span", { className: _t.definedNameContainerItemNameForSheet, children: T.localSheetId === gc || T.localSheetId == null ? "" : E(T.localSheetId) })
  12783. ] }),
  12784. /* @__PURE__ */ C.jsx("div", { className: _t.definedNameContainerItemFormulaOrRefString, children: T.formulaOrRefString })
  12785. ] }),
  12786. /* @__PURE__ */ C.jsx(Gn, { title: n.t("definedName.updateButton"), placement: "top", children: /* @__PURE__ */ C.jsx("div", { className: st(_t.definedNameContainerItemUpdate, _t.definedNameContainerItemShow), onClick: () => {
  12787. P(T.id);
  12788. }, children: /* @__PURE__ */ C.jsx(Hn, {}) }) }),
  12789. /* @__PURE__ */ C.jsx(Gn, { title: n.t("definedName.deleteButton"), placement: "top", children: /* @__PURE__ */ C.jsx("div", { className: st(_t.definedNameContainerItemDelete, _t.definedNameContainerItemShow), onClick: () => {
  12790. S(T.id);
  12791. }, children: /* @__PURE__ */ C.jsx(ea, {}) }) })
  12792. ] }),
  12793. /* @__PURE__ */ C.jsx(NC, { visible: f === T.id, onClose: b, onConfirm: () => {
  12794. v(T.id);
  12795. }, children: n.t("definedName.deleteConfirmText") }),
  12796. T.id === h && /* @__PURE__ */ C.jsx(
  12797. uh,
  12798. {
  12799. confirm: p,
  12800. cancel: y,
  12801. state: T.id === h,
  12802. id: T.id,
  12803. inputId: T.id + A,
  12804. name: T.name,
  12805. formulaOrRefString: T.formulaOrRefString,
  12806. comment: T.comment,
  12807. localSheetId: T.localSheetId
  12808. }
  12809. )
  12810. ] }, A))
  12811. ] }) });
  12812. }, Zw = "univer-count-bar", Gw = {
  12813. countBar: Zw
  12814. }, qw = [50, 75, 100, 125, 150, 175, 200, 400];
  12815. function Qw() {
  12816. const r = W(F), e = W(L), t = Wn(), n = W(tt), s = is(n.visible$), i = On(() => {
  12817. if (!t) return 100;
  12818. const d = t.getActiveSheet(), u = d && d.getZoomRatio() * 100 || 100;
  12819. return Math.round(u);
  12820. }, [t]), [o, l] = te(() => i());
  12821. be(() => (l(i()), r.onCommandExecuted((u) => {
  12822. if (u.id === $t.id || u.id === et.id) {
  12823. const h = i();
  12824. l(h);
  12825. }
  12826. }).dispose), [r, i]);
  12827. function a(d) {
  12828. l(d);
  12829. const u = e.getCurrentUnitForType(O.UNIVER_SHEET), h = u == null ? void 0 : u.getActiveSheet();
  12830. if (h == null)
  12831. return;
  12832. const m = d / 100;
  12833. r.executeCommand(Wi.id, {
  12834. unitId: u.getUnitId(),
  12835. subUnitId: h.getSheetId(),
  12836. zoomRatio: m
  12837. });
  12838. }
  12839. const c = (s == null ? void 0 : s.visible) && (s.unitId === (t == null ? void 0 : t.getUnitId()) || s.unitId === Te);
  12840. return /* @__PURE__ */ C.jsx(
  12841. HC,
  12842. {
  12843. disabled: c,
  12844. min: _c[0],
  12845. value: o,
  12846. shortcuts: qw,
  12847. onChange: a
  12848. }
  12849. );
  12850. }
  12851. function Kw(r) {
  12852. return /* @__PURE__ */ C.jsx("section", { className: Gw.countBar, children: /* @__PURE__ */ C.jsx(Qw, {}) });
  12853. }
  12854. function og(r, e) {
  12855. const t = W(tt);
  12856. return sn(() => ({
  12857. keyCodes: [
  12858. { keyCode: Z.ENTER },
  12859. { keyCode: Z.ESC },
  12860. { keyCode: Z.TAB }
  12861. ],
  12862. handler: (s) => {
  12863. (s === Z.ENTER || s === Z.ESC || s === Z.TAB) && (t.disableForceKeepVisible(), t.changeVisible({
  12864. visible: !1,
  12865. eventType: Xe.Keyboard,
  12866. keycode: s,
  12867. unitId: e
  12868. }));
  12869. }
  12870. }), [t, e]);
  12871. }
  12872. const Jw = "univer-editor-container", $w = "univer-editor-input", e0 = "univer-sheet-embedding-formula-editor-wrap", hh = {
  12873. editorContainer: Jw,
  12874. editorInput: $w,
  12875. sheetEmbeddingFormulaEditorWrap: e0
  12876. }, Zo = -1e3, mh = {
  12877. width: 0,
  12878. height: 0,
  12879. top: Zo,
  12880. left: Zo
  12881. }, t0 = () => {
  12882. const [r, e] = te({
  12883. ...mh
  12884. }), t = W(Fl), n = W(Ss), s = W(Ne), i = W(Dn), o = W(tt), l = Yt(o.visible$), a = W(F), c = xn(0), d = Yt(
  12885. () => s.subscribeContextValue$(Su),
  12886. !1,
  12887. void 0,
  12888. [s, Su]
  12889. ), u = i.get(Td), h = o.getEditLocation();
  12890. be(() => {
  12891. const p = t.state$.subscribe((S) => {
  12892. if (S == null)
  12893. return;
  12894. const {
  12895. startX: b = Zo,
  12896. startY: v = Zo,
  12897. endX: _ = 0,
  12898. endY: R = 0,
  12899. show: I = !1
  12900. } = S;
  12901. if (!I)
  12902. e({
  12903. ...mh
  12904. });
  12905. else {
  12906. e({
  12907. width: _ - b,
  12908. height: R - v,
  12909. left: b,
  12910. top: v
  12911. });
  12912. const y = n.getEditor(Le);
  12913. if (y == null)
  12914. return;
  12915. const { left: M, top: P, width: E, height: T } = y.getBoundingClientRect();
  12916. t.setRect({ left: M, top: P, width: E, height: T });
  12917. }
  12918. });
  12919. return () => {
  12920. p.unsubscribe();
  12921. };
  12922. }, []), be(() => {
  12923. d || t.setFocus(!0);
  12924. }, [d, r]);
  12925. const m = Cu(() => {
  12926. o.isVisible().visible && o.changeVisible({
  12927. visible: !1,
  12928. eventType: Xe.PointerUp,
  12929. unitId: h.unitId
  12930. });
  12931. });
  12932. wo(m);
  12933. const f = og(c, h == null ? void 0 : h.unitId), g = Cu((p, S) => {
  12934. a.executeCommand(cs.id, {
  12935. keycode: p,
  12936. visible: !1,
  12937. eventType: Xe.Keyboard,
  12938. isShift: S === ye.SHIFT || S === (ye.CTRL_COMMAND | ye.SHIFT),
  12939. unitId: h == null ? void 0 : h.unitId
  12940. });
  12941. });
  12942. return /* @__PURE__ */ C.jsx(
  12943. "div",
  12944. {
  12945. className: hh.editorContainer,
  12946. style: {
  12947. left: r.left,
  12948. top: r.top,
  12949. width: r.width,
  12950. height: r.height
  12951. },
  12952. children: u && /* @__PURE__ */ C.jsx(
  12953. u,
  12954. {
  12955. editorId: Le,
  12956. className: hh.editorInput,
  12957. initValue: "",
  12958. onChange: () => {
  12959. },
  12960. isFocus: l == null ? void 0 : l.visible,
  12961. unitId: h == null ? void 0 : h.unitId,
  12962. subUnitId: h == null ? void 0 : h.sheetId,
  12963. keyboradEventConfig: f,
  12964. onMoveInEditor: g,
  12965. isSupportAcrossSheet: !0,
  12966. resetSelectionOnBlur: !1,
  12967. isSingle: !1,
  12968. autoScrollbar: !1,
  12969. onFormulaSelectingChange: (p) => {
  12970. c.current = p, p ? o.enableForceKeepVisible() : o.disableForceKeepVisible();
  12971. },
  12972. disableSelectionOnClick: !0,
  12973. disableContextMenu: !1
  12974. }
  12975. )
  12976. }
  12977. );
  12978. };
  12979. class n0 {
  12980. constructor() {
  12981. w(this, "_position", null);
  12982. w(this, "_position$", new Me(null));
  12983. w(this, "position$", this._position$.asObservable());
  12984. w(this, "_focus", !1);
  12985. w(this, "_focus$", new Me(this._focus));
  12986. w(this, "focus$", this._focus$.asObservable());
  12987. w(this, "_fxBtnClick$", new xe());
  12988. w(this, "fxBtnClick$", this._fxBtnClick$.asObservable());
  12989. w(this, "_foldBtnStatus$", new xe());
  12990. w(this, "foldBtnStatus$", this._foldBtnStatus$.asObservable());
  12991. }
  12992. dispose() {
  12993. this._position$.complete(), this._focus$.complete(), this._position = null, this._focus = !1;
  12994. }
  12995. setPosition(e) {
  12996. this._position = e, this._refresh(e);
  12997. }
  12998. getPosition() {
  12999. return this._position;
  13000. }
  13001. setFocus(e = !1) {
  13002. this._focus = e, this._focus$.next(e);
  13003. }
  13004. handleFxBtnClick(e) {
  13005. this._fxBtnClick$.next(e);
  13006. }
  13007. handleFoldBtnClick(e) {
  13008. this._foldBtnStatus$.next(e);
  13009. }
  13010. _refresh(e) {
  13011. this._position$.next(e);
  13012. }
  13013. }
  13014. const ca = gn(
  13015. "univer.sheet-formula-editor-manager.service"
  13016. );
  13017. function r0(r) {
  13018. const e = W(F), t = W(Ee), n = W(ki), s = W(L), i = W(vs), l = s.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId(), a = () => {
  13019. const m = n.getDefinedNameMap(l);
  13020. return m ? Array.from(Object.values(m)) : [];
  13021. }, [c, d] = te(a());
  13022. be(() => {
  13023. const m = n.update$.subscribe(() => {
  13024. d(a());
  13025. });
  13026. return () => {
  13027. m.unsubscribe();
  13028. };
  13029. }, []), be(() => {
  13030. const m = i.sidebarOptions$.subscribe((f) => {
  13031. f.id === Si && (f.visible || setTimeout(() => {
  13032. i.sidebarOptions$.next({ visible: !1 });
  13033. }));
  13034. });
  13035. return () => {
  13036. m.unsubscribe();
  13037. };
  13038. }, []);
  13039. const u = () => {
  13040. e.executeCommand(Jd.id, { value: "open" });
  13041. }, h = async (m) => {
  13042. const { formulaOrRefString: f, id: g } = m, p = n.getWorksheetByRef(l, f);
  13043. if (!p)
  13044. return;
  13045. p.isSheetHidden() && await e.executeCommand(_d.id, { unitId: l, subUnitId: p.getSheetId() }), n.focusRange(l, g);
  13046. };
  13047. return /* @__PURE__ */ C.jsxs("div", { className: "univer-w-[300px]", children: [
  13048. /* @__PURE__ */ C.jsx(
  13049. "ul",
  13050. {
  13051. className: `
  13052. univer-max-h-[360px] univer-overflow-y-auto univer-scrollbar-thin univer-scrollbar-thumb-gray-300
  13053. univer-scrollbar-track-transparent univer-scrollbar-w-[4px] univer-m-0 univer-list-none univer-p-0
  13054. `,
  13055. children: c.map((m, f) => /* @__PURE__ */ C.jsx(
  13056. "li",
  13057. {
  13058. className: `
  13059. univer-px-2 univer-cursor-pointer univer-transition-colors univer-duration-200
  13060. dark:hover:univer-bg-gray-600
  13061. hover:univer-bg-gray-100
  13062. `,
  13063. onClick: () => {
  13064. h(m);
  13065. },
  13066. children: /* @__PURE__ */ C.jsxs(
  13067. "div",
  13068. {
  13069. className: `
  13070. univer-flex univer-py-1 univer-items-center univer-justify-between univer-border-b
  13071. univer-border-solid univer-border-0 univer-border-gray-200 univer-gap-2
  13072. `,
  13073. children: [
  13074. /* @__PURE__ */ C.jsx(
  13075. "div",
  13076. {
  13077. className: `
  13078. univer-text-gray-600 univer-text-sm univer-overflow-hidden univer-text-ellipsis
  13079. univer-flex-shrink-0 univer-w-[50%] univer-whitespace-nowrap
  13080. `,
  13081. title: m.name,
  13082. children: m.name
  13083. }
  13084. ),
  13085. /* @__PURE__ */ C.jsx(
  13086. "div",
  13087. {
  13088. className: `
  13089. univer-text-gray-400 univer-text-xs univer-flex-shrink-0 univer-overflow-hidden
  13090. univer-text-ellipsis univer-w-[50%] univer-whitespace-nowrap
  13091. `,
  13092. title: m.formulaOrRefString,
  13093. children: m.formulaOrRefString
  13094. }
  13095. )
  13096. ]
  13097. }
  13098. )
  13099. },
  13100. f
  13101. ))
  13102. }
  13103. ),
  13104. /* @__PURE__ */ C.jsxs(
  13105. "div",
  13106. {
  13107. className: `
  13108. univer-p-2 univer-cursor-pointer univer-transition-colors univer-duration-200
  13109. dark:hover:univer-bg-gray-600
  13110. hover:univer-bg-gray-100
  13111. `,
  13112. onClick: u,
  13113. children: [
  13114. /* @__PURE__ */ C.jsx("div", { className: "univer-text-sm univer-font-semibold univer-text-gray-600 univer-mb-2", children: t.t("definedName.managerTitle") }),
  13115. /* @__PURE__ */ C.jsx("div", { className: "univer-text-xs univer-text-gray-400", children: t.t("definedName.managerDescription") })
  13116. ]
  13117. }
  13118. )
  13119. ] });
  13120. }
  13121. function s0({ disable: r }) {
  13122. const [e, t] = te(""), n = W(ki);
  13123. return be(() => {
  13124. const s = n.currentRange$.subscribe(() => {
  13125. t(n.getCurrentRangeForString());
  13126. });
  13127. return () => {
  13128. s.unsubscribe();
  13129. };
  13130. }, []), /* @__PURE__ */ C.jsxs("div", { className: _t.definedName, children: [
  13131. /* @__PURE__ */ C.jsx(
  13132. ti,
  13133. {
  13134. className: st({ [_t.defineNameInputDisable]: r }),
  13135. value: e,
  13136. type: "text",
  13137. size: "small",
  13138. affixWrapperStyle: { border: "none", paddingLeft: "6px", paddingRight: "6px", height: "100%" }
  13139. }
  13140. ),
  13141. /* @__PURE__ */ C.jsxs(jm, { children: [
  13142. /* @__PURE__ */ C.jsx(Xm, { children: /* @__PURE__ */ C.jsx(
  13143. "a",
  13144. {
  13145. className: st(
  13146. `
  13147. univer-flex univer-items-center univer-justify-center univer-px-1 univer-cursor-pointer
  13148. univer-absolute univer-right-0 univer-h-full univer-transition-colors univer-duration-200
  13149. hover:univer-bg-gray-100
  13150. `,
  13151. {
  13152. "univer-text-gray-300 univer-cursor-not-allowed hover:univer-bg-transparent": r
  13153. }
  13154. ),
  13155. children: /* @__PURE__ */ C.jsx(hs, {})
  13156. }
  13157. ) }),
  13158. /* @__PURE__ */ C.jsx(zm, { className: "univer-z-[1001]", offset: { x: -75, y: 2 }, children: /* @__PURE__ */ C.jsx(r0, {}) })
  13159. ] })
  13160. ] });
  13161. }
  13162. const i0 = "univer-formula-box", o0 = "univer-name-ranges", l0 = "univer-formula-bar", a0 = "univer-formula-icon", c0 = "univer-formula-icon-disable", d0 = "univer-formula-icon-wrapper", u0 = "univer-icon-container", h0 = "univer-icon-container-success", m0 = "univer-formula-active", f0 = "univer-icon-container-error", g0 = "univer-icon-container-fx", p0 = "univer-formula-input", S0 = "univer-formula-container", C0 = "univer-sheet-embedding-formula-editor-wrap", v0 = "univer-formula-content", b0 = "univer-arrow-container", _0 = "univer-arrow-container-disable", ct = {
  13163. formulaBox: i0,
  13164. nameRanges: o0,
  13165. formulaBar: l0,
  13166. formulaIcon: a0,
  13167. formulaIconDisable: c0,
  13168. formulaIconWrapper: d0,
  13169. iconContainer: u0,
  13170. iconContainerSuccess: h0,
  13171. formulaActive: m0,
  13172. iconContainerError: f0,
  13173. iconContainerFx: g0,
  13174. formulaInput: p0,
  13175. formulaContainer: S0,
  13176. sheetEmbeddingFormulaEditorWrap: C0,
  13177. formulaContent: v0,
  13178. arrowContainer: b0,
  13179. arrowContainerDisable: _0
  13180. };
  13181. function w0() {
  13182. var U;
  13183. const [r, e] = te(ct.formulaGrey), [t, n] = te(
  13184. 0
  13185. /* Down */
  13186. ), s = W(ca), i = W(tt), o = W(ft), l = W(Ye), a = W(L), c = W($), d = W($e), [u, h] = te(!1), [m, f] = te(!1), g = Wn(), p = W(Dn), S = is(() => a.getCurrentTypeOfUnit$(O.UNIVER_SHEET), void 0, void 0, []), b = xn(0), v = i.getEditLocation(), _ = og(b, (U = v == null ? void 0 : v.unitId) != null ? U : ""), R = p.get(Td), I = Gh(Gm.FORMULA_AUX), y = W(Ne);
  13187. is(sn(() => y.subscribeContextValue$(Ht), [y]));
  13188. const M = y.getContextValue(Ht), P = xn(null);
  13189. function E(V, N) {
  13190. return [
  13191. new q(V).id,
  13192. new Ut(V, N).id,
  13193. new ee(V, N).id
  13194. ];
  13195. }
  13196. PS(() => {
  13197. const V = S.activeSheet$.pipe(
  13198. We((N) => N ? mt(
  13199. o.ruleChange$,
  13200. l.ruleChange$,
  13201. c.selectionMoveEnd$,
  13202. c.selectionSet$
  13203. ).pipe(
  13204. We(() => {
  13205. var ve, G;
  13206. const X = S.getUnitId(), Y = N.getSheetId();
  13207. if (!((ve = c.getCurrentLastSelection()) == null ? void 0 : ve.range)) return vu;
  13208. const he = E(X, Y), ne = (G = c.getCurrentSelections()) == null ? void 0 : G.map((J) => J.range);
  13209. return l.getSubunitRuleList(X, Y).filter((J) => J.ranges.some((le) => ne == null ? void 0 : ne.some((fe) => ae.intersects(le, fe)))).forEach((J) => {
  13210. he.push(new re(X, Y, J.permissionId).id);
  13211. }), d.composePermission$(he);
  13212. })
  13213. ) : vu)
  13214. ).subscribe((N) => {
  13215. N && h(!N.every((X) => X.value));
  13216. });
  13217. return () => {
  13218. V.unsubscribe();
  13219. };
  13220. }, [S]), be(() => {
  13221. const V = i.visible$.subscribe((N) => {
  13222. e(N.visible ? ct.formulaActive : ct.formulaGrey);
  13223. });
  13224. return () => V.unsubscribe();
  13225. }, [i.visible$]), be(() => {
  13226. const V = i.currentEditCellState$.subscribe((N) => {
  13227. var X, Y, ie;
  13228. (ie = (Y = (X = N == null ? void 0 : N.documentLayoutObject.documentModel) == null ? void 0 : X.getBody()) == null ? void 0 : Y.customBlocks) != null && ie.length ? f(!0) : f(!1);
  13229. });
  13230. return () => V.unsubscribe();
  13231. }, [i.currentEditCellState$]), be(() => {
  13232. if (P.current) {
  13233. const V = () => {
  13234. const X = P.current.getBoundingClientRect();
  13235. s.setPosition(X);
  13236. };
  13237. V();
  13238. const N = new ResizeObserver(V);
  13239. return N.observe(P.current), () => N.disconnect();
  13240. }
  13241. }, [s]);
  13242. function T() {
  13243. n(
  13244. t === 0 ? 1 : 0
  13245. /* Down */
  13246. ), setTimeout(() => {
  13247. s.handleFoldBtnClick(
  13248. t === 1
  13249. /* Up */
  13250. );
  13251. }, 150);
  13252. }
  13253. function A() {
  13254. var N;
  13255. i.isVisible().visible && i.changeVisible({
  13256. visible: !1,
  13257. eventType: Xe.Keyboard,
  13258. keycode: Z.ESC,
  13259. unitId: (N = g == null ? void 0 : g.getUnitId()) != null ? N : ""
  13260. });
  13261. }
  13262. function H() {
  13263. var N;
  13264. i.isVisible().visible && i.changeVisible({
  13265. visible: !1,
  13266. eventType: Xe.PointerDown,
  13267. unitId: (N = g == null ? void 0 : g.getUnitId()) != null ? N : ""
  13268. });
  13269. }
  13270. function x() {
  13271. s.handleFxBtnClick(!0);
  13272. }
  13273. const k = u || m;
  13274. return /* @__PURE__ */ C.jsxs(
  13275. "div",
  13276. {
  13277. className: ct.formulaBox,
  13278. style: {
  13279. height: t === 0 ? "28px" : "82px",
  13280. pointerEvents: u ? "none" : "auto"
  13281. },
  13282. children: [
  13283. /* @__PURE__ */ C.jsx("div", { className: ct.nameRanges, children: /* @__PURE__ */ C.jsx(s0, { disable: u }) }),
  13284. /* @__PURE__ */ C.jsxs("div", { className: ct.formulaBar, children: [
  13285. /* @__PURE__ */ C.jsx("div", { className: st(ct.formulaIcon, { [ct.formulaIconDisable]: k }), children: /* @__PURE__ */ C.jsxs("div", { className: ct.formulaIconWrapper, children: [
  13286. /* @__PURE__ */ C.jsx(
  13287. "span",
  13288. {
  13289. className: st(ct.iconContainer, ct.iconContainerError, r),
  13290. onClick: A,
  13291. children: /* @__PURE__ */ C.jsx(Df, {})
  13292. }
  13293. ),
  13294. /* @__PURE__ */ C.jsx(
  13295. "span",
  13296. {
  13297. className: st(ct.iconContainer, ct.iconContainerSuccess, r),
  13298. onClick: H,
  13299. children: /* @__PURE__ */ C.jsx(Hn, {})
  13300. }
  13301. ),
  13302. /* @__PURE__ */ C.jsx("span", { className: st(ct.iconContainer, ct.iconContainerFx), onClick: x, children: /* @__PURE__ */ C.jsx(Bf, {}) })
  13303. ] }) }),
  13304. /* @__PURE__ */ C.jsxs("div", { className: ct.formulaContainer, children: [
  13305. /* @__PURE__ */ C.jsx("div", { className: ct.formulaInput, ref: P, children: R && /* @__PURE__ */ C.jsx(
  13306. R,
  13307. {
  13308. disableSelectionOnClick: !0,
  13309. editorId: Te,
  13310. initValue: "",
  13311. onChange: () => {
  13312. },
  13313. isFocus: M,
  13314. className: ct.formulaContent,
  13315. unitId: v == null ? void 0 : v.unitId,
  13316. subUnitId: v == null ? void 0 : v.sheetId,
  13317. isSupportAcrossSheet: !0,
  13318. resetSelectionOnBlur: !1,
  13319. isSingle: !1,
  13320. keyboradEventConfig: _,
  13321. onFormulaSelectingChange: (V) => {
  13322. b.current = V, V ? i.enableForceKeepVisible() : i.disableForceKeepVisible();
  13323. },
  13324. autoScrollbar: !1,
  13325. disableContextMenu: !1
  13326. }
  13327. ) }),
  13328. /* @__PURE__ */ C.jsx("div", { className: st(ct.arrowContainer, { [ct.arrowContainerDisable]: u }), onClick: T, children: t === 0 ? /* @__PURE__ */ C.jsx(Hc, {}) : /* @__PURE__ */ C.jsx(Hc, { style: { transform: "rotateZ(180deg)" } }) })
  13329. ] })
  13330. ] }),
  13331. /* @__PURE__ */ C.jsx(qh, { components: I }, "formula-aux")
  13332. ]
  13333. }
  13334. );
  13335. }
  13336. const R0 = "univer-operate-container", I0 = "univer-auto-fill-popup-menu", y0 = "univer-auto-fill-popup-menu-item", M0 = "univer-auto-fill-popup-menu-item-icon", P0 = "univer-auto-fill-popup-menu-item-title", E0 = "univer-auto-fill-popup-menu-item-hide", T0 = "univer-btn-container", x0 = "univer-btn-container-expand", fr = {
  13337. operateContainer: R0,
  13338. autoFillPopupMenu: I0,
  13339. autoFillPopupMenuItem: y0,
  13340. autoFillPopupMenuItemIcon: M0,
  13341. autoFillPopupMenuItemTitle: P0,
  13342. autoFillPopupMenuItemHide: E0,
  13343. btnContainer: T0,
  13344. btnContainerExpand: x0
  13345. }, O0 = () => {
  13346. const [, r] = te({});
  13347. return On(() => r((e) => !e), []);
  13348. }, A0 = () => {
  13349. const r = W(F), e = W(L), t = W(Ce), n = W(Hr), s = W(Ee), [i, o] = te([]), [l, a] = te(!1), [c, d] = te({ row: -1, col: -1 }), [u, h] = te(ke.SERIES), [m, f] = te(!1), g = Wn(), { sheetSkeletonManagerService: p, selectionRenderService: S } = sn(() => {
  13350. if (g) {
  13351. const Y = t.getRenderById(g.getUnitId());
  13352. return {
  13353. sheetSkeletonManagerService: Y == null ? void 0 : Y.with(me),
  13354. selectionRenderService: Y == null ? void 0 : Y.with(dt)
  13355. };
  13356. }
  13357. return { sheetSkeletonManagerService: null, selectionRenderService: null };
  13358. }, [g, t]), b = () => {
  13359. f(!0);
  13360. }, v = () => {
  13361. f(!1);
  13362. }, _ = O0();
  13363. if (be(() => r.onCommandExecuted((ie, he) => {
  13364. ie.id === dn.id && _();
  13365. }).dispose, [_, r]), be(() => {
  13366. const Y = p && Ae(
  13367. p.currentSkeleton$.subscribe((ie) => {
  13368. ie && _();
  13369. })
  13370. );
  13371. return Y == null ? void 0 : Y.dispose;
  13372. }, [p, _]), be(() => Ae(
  13373. n.menu$.subscribe((ie) => {
  13374. o(ie.map((he) => ({ ...he, index: ie.indexOf(he) })));
  13375. })
  13376. ).dispose, [n]), be(() => Ae(
  13377. n.showMenu$.subscribe((ie) => {
  13378. const { source: he, target: ne } = n.autoFillLocation || { source: null, target: null };
  13379. if (ie && he && ne) {
  13380. const pe = Math.max(he.rows[he.rows.length - 1], ne.rows[ne.rows.length - 1]), ve = Math.max(he.cols[he.cols.length - 1], ne.cols[ne.cols.length - 1]);
  13381. d({ row: pe, col: ve });
  13382. } else
  13383. d({ row: -1, col: -1 });
  13384. })
  13385. ).dispose, [n]), be(() => Ae(
  13386. n.applyType$.subscribe((ie) => {
  13387. h(ie);
  13388. })
  13389. ).dispose, [n]), be(() => {
  13390. function Y() {
  13391. a(!1);
  13392. }
  13393. return document.addEventListener("wheel", Y), () => {
  13394. document.removeEventListener("wheel", Y);
  13395. };
  13396. }, [l]), c.col < 0 || c.row < 0)
  13397. return null;
  13398. const R = pn(e, t);
  13399. if (!R || !S) return null;
  13400. const { scene: I } = R, y = p == null ? void 0 : p.getCurrentSkeleton(), M = S.getViewPort(), P = I == null ? void 0 : I.scaleX, E = I == null ? void 0 : I.scaleY, T = I == null ? void 0 : I.getViewportScrollXY(M);
  13401. if (!P || !I || !P || !E || !T) return null;
  13402. const A = (y == null ? void 0 : y.getNoMergeCellPositionByIndex(c.row, c.col).endX) || 0, H = (y == null ? void 0 : y.getNoMergeCellPositionByIndex(c.row, c.col).endY) || 0, x = y == null ? void 0 : y.convertTransformToOffsetX(A, P, T), k = y == null ? void 0 : y.convertTransformToOffsetY(H, E, T);
  13403. if (x == null || k == null) return null;
  13404. const U = (Y) => {
  13405. a(Y);
  13406. }, V = (Y) => {
  13407. r.executeCommand(Ll.id, { type: Y.value }), a(!1);
  13408. }, N = l || m, X = i.filter((Y) => !Y.disable);
  13409. return /* @__PURE__ */ C.jsx(
  13410. "div",
  13411. {
  13412. onMouseEnter: b,
  13413. onMouseLeave: v,
  13414. style: { left: `${x + 2}px`, top: `${k + 2}px`, position: "absolute" },
  13415. children: /* @__PURE__ */ C.jsx(
  13416. ei,
  13417. {
  13418. placement: "bottomLeft",
  13419. trigger: ["click"],
  13420. overlay: /* @__PURE__ */ C.jsx("ul", { className: fr.autoFillPopupMenu, children: X.map((Y) => /* @__PURE__ */ C.jsxs(
  13421. "li",
  13422. {
  13423. onClick: () => V(Y),
  13424. className: fr.autoFillPopupMenuItem,
  13425. children: [
  13426. /* @__PURE__ */ C.jsx("span", { className: fr.autoFillPopupMenuItemIcon, children: Y.value === u && /* @__PURE__ */ C.jsx(Hn, { style: { color: "rgb(var(--green-700, #409f11))" } }) }),
  13427. /* @__PURE__ */ C.jsx("span", { className: fr.autoFillPopupMenuItemTitle, children: s.t(Y.label) })
  13428. ]
  13429. },
  13430. Y.index
  13431. )) }),
  13432. visible: l,
  13433. onVisibleChange: U,
  13434. children: /* @__PURE__ */ C.jsxs(
  13435. "div",
  13436. {
  13437. className: st(fr.btnContainer, {
  13438. [fr.btnContainerExpand]: l
  13439. }),
  13440. children: [
  13441. /* @__PURE__ */ C.jsx(
  13442. kf,
  13443. {
  13444. style: { color: "#35322B" },
  13445. extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
  13446. }
  13447. ),
  13448. N && /* @__PURE__ */ C.jsx(hs, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
  13449. ]
  13450. }
  13451. )
  13452. }
  13453. )
  13454. }
  13455. );
  13456. }, N0 = () => /* @__PURE__ */ C.jsx("div", { className: fr.operateContainer, children: /* @__PURE__ */ C.jsx(A0, {}) }), H0 = "univer-sheet-bar", V0 = "univer-sheet-bar-options", k0 = "univer-sheet-bar-options-divider", to = {
  13457. sheetBar: H0,
  13458. sheetBarOptions: V0,
  13459. sheetBarOptionsDivider: k0
  13460. }, D0 = "univer-sheet-bar-btn", L0 = {
  13461. sheetBarBtn: D0
  13462. };
  13463. function po(r) {
  13464. const { children: e, className: t, style: n, disabled: s = !1, onClick: i, ...o } = r, l = (a) => {
  13465. if (s) {
  13466. a.preventDefault();
  13467. return;
  13468. }
  13469. i && i(a);
  13470. };
  13471. return /* @__PURE__ */ C.jsx("button", { className: L0.sheetBarBtn, style: n, disabled: s, onClick: l, ...o, children: e });
  13472. }
  13473. const W0 = "36", B0 = "univer-sheet-container", F0 = "univer-sheet-bar-menu", U0 = "univer-sheet-bar-menu-item", j0 = "univer-sheet-bar-menu-item-icon", X0 = "univer-sheet-bar-menu-item-hide", z0 = "univer-sheet-bar-menu-item-select", Y0 = "univer-sheet-bar-menu-item-label", jn = {
  13474. sheetFooterBarHeight: W0,
  13475. sheetContainer: B0,
  13476. sheetBarMenu: F0,
  13477. sheetBarMenuItem: U0,
  13478. sheetBarMenuItemIcon: j0,
  13479. sheetBarMenuItemHide: X0,
  13480. sheetBarMenuItemSelect: z0,
  13481. sheetBarMenuItemLabel: Y0
  13482. };
  13483. function Z0(r) {
  13484. const { style: e } = r, [t, n] = te([]), [s, i] = te(!1), o = W(L), l = W(F), a = W(kr), c = W(ft), d = Yt(() => o.getCurrentTypeOfUnit$(O.UNIVER_SHEET), null, !1, []), u = (p) => {
  13485. const { sheetId: S } = p;
  13486. !S || !d || (p.hidden ? l.executeCommand(_d.id, {
  13487. unitId: d.getUnitId(),
  13488. subUnitId: S,
  13489. value: S
  13490. }) : p.selected || l.executeCommand(dd.id, {
  13491. unitId: d.getUnitId(),
  13492. subUnitId: S
  13493. }), i(!1));
  13494. }, h = On(() => {
  13495. if (!d) return;
  13496. const p = d.getSheets(), S = d.getActiveSheet(), b = p.map((v, _) => ({
  13497. label: v.getName(),
  13498. index: `${_}`,
  13499. sheetId: v.getSheetId(),
  13500. hidden: v.isSheetHidden() === Qe.TRUE,
  13501. selected: S === v
  13502. }));
  13503. n(b);
  13504. }, [d, c]), m = On(() => l.onCommandExecuted((p) => {
  13505. switch (p.id) {
  13506. case nr.id:
  13507. case An.id:
  13508. case Rd.id:
  13509. case Nr.id:
  13510. case wd.id:
  13511. case et.id:
  13512. h();
  13513. break;
  13514. }
  13515. }), [l, h]);
  13516. function f() {
  13517. i(!0);
  13518. }
  13519. const g = (p) => {
  13520. i(p);
  13521. };
  13522. return be(() => {
  13523. h();
  13524. const p = new St();
  13525. return p.add(m()), p.add(a.registerSheetBarMenuHandler({ handleSheetBarMenu: f })), () => p.dispose();
  13526. }, [m, a, h, d]), /* @__PURE__ */ C.jsx(
  13527. ei,
  13528. {
  13529. placement: "topLeft",
  13530. trigger: ["click"],
  13531. overlay: /* @__PURE__ */ C.jsx("ul", { className: jn.sheetBarMenu, style: { ...e }, children: t.map((p) => /* @__PURE__ */ C.jsxs(
  13532. "li",
  13533. {
  13534. onClick: () => u(p),
  13535. className: p.selected ? `
  13536. ${jn.sheetBarMenuItem}
  13537. ${jn.sheetBarMenuItemSelect}
  13538. ` : p.hidden ? `
  13539. ${jn.sheetBarMenuItem}
  13540. ${jn.sheetBarMenuItemHide}
  13541. ` : jn.sheetBarMenuItem,
  13542. children: [
  13543. /* @__PURE__ */ C.jsx("span", { className: jn.sheetBarMenuItemIcon, children: p.selected ? /* @__PURE__ */ C.jsx(Hn, {}) : p.hidden ? /* @__PURE__ */ C.jsx(Wf, {}) : /* @__PURE__ */ C.jsx(Hn, {}) }),
  13544. /* @__PURE__ */ C.jsx("div", { className: jn.sheetBarMenuItemLabel, children: p.label })
  13545. ]
  13546. },
  13547. p.index
  13548. )) }),
  13549. visible: s,
  13550. onVisibleChange: g,
  13551. children: /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(po, { children: /* @__PURE__ */ C.jsx(Lf, {}) }) })
  13552. }
  13553. );
  13554. }
  13555. const G0 = "univer-slide-tab-bar-container", q0 = "univer-slide-tab-bar", Q0 = "univer-slide-tab-item", K0 = "univer-slide-tab-active", J0 = "univer-slide-tab-div", $0 = "univer-slide-tab-div-edit", eR = "univer-slide-tab-item-dropdown", Wt = {
  13556. slideTabBarContainer: G0,
  13557. slideTabBar: q0,
  13558. slideTabItem: Q0,
  13559. slideTabActive: K0,
  13560. slideTabDiv: J0,
  13561. slideTabDivEdit: $0,
  13562. slideTabItemDropdown: eR
  13563. };
  13564. function tR(r) {
  13565. const { sheetId: e, label: t, color: n, selected: s } = r, [i, o] = te(s), l = W(kt);
  13566. be(() => {
  13567. o(s);
  13568. }, [s]);
  13569. const a = (c) => {
  13570. const d = l.getCurrentTheme(), u = d.textColor, h = d.colorWhite;
  13571. return new Tn(c).isDark() ? h : u;
  13572. };
  13573. return /* @__PURE__ */ C.jsx(
  13574. "div",
  13575. {
  13576. "data-id": e,
  13577. className: i ? `
  13578. ${Wt.slideTabActive}
  13579. ${Wt.slideTabItem}
  13580. ` : Wt.slideTabItem,
  13581. style: {
  13582. backgroundColor: !i && n ? n : "",
  13583. color: !i && n ? a(n) : "",
  13584. boxShadow: i && n ? `0px 0px 8px rgba(0, 0, 0, 0.08), inset 0px -2px 0px 0px ${n}` : ""
  13585. },
  13586. children: /* @__PURE__ */ C.jsx("div", { className: Wt.slideTabDiv, children: t })
  13587. },
  13588. e
  13589. );
  13590. }
  13591. const nR = {
  13592. easeOutStrong(r, e, t, n) {
  13593. return -t * ((r = r / n - 1) * r * r * r - 1) + e;
  13594. },
  13595. backOut(r, e, t, n, s) {
  13596. return typeof s > "u" && (s = 0.7), t * ((r = r / n - 1) * r * ((s + 1) * r + s) + 1) + e;
  13597. }
  13598. }, rR = {
  13599. loop: !1,
  13600. begin: 0,
  13601. end: 0,
  13602. duration: 300,
  13603. delay: 0,
  13604. type: "easeOutStrong",
  13605. receive(r) {
  13606. },
  13607. success(r) {
  13608. },
  13609. cancel(r) {
  13610. },
  13611. complete(r) {
  13612. }
  13613. };
  13614. class sR {
  13615. constructor(e) {
  13616. w(this, "_config");
  13617. w(this, "_status", 0);
  13618. w(this, "_start", 0);
  13619. w(this, "_handle", 0);
  13620. w(this, "_delayHandle", null);
  13621. this._config = {
  13622. ...rR,
  13623. ...e
  13624. }, this._config.loop && (this._config.complete = () => {
  13625. }, this._config.success = () => {
  13626. this.request();
  13627. });
  13628. }
  13629. static success(...e) {
  13630. let t = 0;
  13631. return new Promise((n) => {
  13632. for (let s = 0; s < e.length; s++) {
  13633. const i = e[s], o = i._config, l = o.success;
  13634. o.loop || (o.success = (c) => {
  13635. t++, l && l.call(i, c), t === e.length && n();
  13636. });
  13637. }
  13638. });
  13639. }
  13640. request() {
  13641. this._config.delay === 0 ? (this._status = 0, this._start = Date.now(), this._fakeHandle()) : (this._delayHandle && clearTimeout(this._delayHandle), this._delayHandle = setTimeout(() => {
  13642. this._status = 0, this._start = Date.now(), this._fakeHandle();
  13643. }, this._config.delay));
  13644. }
  13645. cancel() {
  13646. this._status = 1, this._delayHandle && clearTimeout(this._delayHandle), cancelAnimationFrame(this._handle);
  13647. }
  13648. _fakeHandle() {
  13649. let e = Date.now() - this._start;
  13650. e = e >= this._config.duration ? this._config.duration : e;
  13651. const n = nR[this._config.type](
  13652. e,
  13653. this._config.begin,
  13654. this._config.end - this._config.begin,
  13655. this._config.duration,
  13656. 0.7
  13657. ).toFixed(2);
  13658. if (this._config.receive(n), this._status === 1) {
  13659. this._config.cancel(n), this._config.complete(n);
  13660. return;
  13661. }
  13662. if (e === this._config.duration) {
  13663. this._config.success(n), this._config.complete(n);
  13664. return;
  13665. }
  13666. this._handle = requestAnimationFrame(() => {
  13667. this._fakeHandle();
  13668. });
  13669. }
  13670. }
  13671. class br {
  13672. constructor(e, t) {
  13673. w(this, "_slideTabItem");
  13674. w(this, "_animate");
  13675. w(this, "_midline", 0);
  13676. w(this, "_translateX");
  13677. w(this, "_scrollbar");
  13678. w(this, "_slideTabBar");
  13679. w(this, "_editMode");
  13680. w(this, "_placeholder");
  13681. this._slideTabItem = e, this._animate = null, this._translateX = 0, this._editMode = !1, this._slideTabBar = t, this._placeholder = null, this._scrollbar = t.getScrollbar(), this.update();
  13682. }
  13683. static midline(e) {
  13684. return e.getBoundingRect().x + e.getBoundingRect().width / 2;
  13685. }
  13686. static leftLine(e) {
  13687. return e.getBoundingRect().x;
  13688. }
  13689. static rightLine(e) {
  13690. return e.getBoundingRect().x + e.getBoundingRect().width;
  13691. }
  13692. static make(e, t) {
  13693. const n = [];
  13694. return e.forEach((s) => n.push(new br(s, t))), n;
  13695. }
  13696. getSlideTabItem() {
  13697. return this._slideTabItem;
  13698. }
  13699. getEditor() {
  13700. return this._slideTabItem.querySelector("span");
  13701. }
  13702. focus() {
  13703. var e;
  13704. (e = this.getEditor()) == null || e.focus();
  13705. }
  13706. selectAll() {
  13707. const e = this.getEditor();
  13708. e && ss.keepSelectAll(e);
  13709. }
  13710. isEditMode() {
  13711. return this._editMode;
  13712. }
  13713. classList() {
  13714. return this._slideTabItem.classList;
  13715. }
  13716. translateX(e) {
  13717. return this._translateX = e, this._slideTabItem.style.transform = `translateX(${e}px)`, this.getTranslateXDirection();
  13718. }
  13719. setEditor(e) {
  13720. if (!this._slideTabBar.getConfig().onNameChangeCheck())
  13721. return;
  13722. let t = !0;
  13723. if (this._editMode === !1) {
  13724. const n = this._slideTabItem.querySelector("span"), s = (c) => {
  13725. if (!this.nameCheck()) {
  13726. if (this._editMode = !1, n && (n.removeAttribute("contentEditable"), n.removeEventListener("focusout", s), n.removeEventListener("compositionstart", o), n.removeEventListener("compositionend", l), n.removeEventListener("input", a), n.removeEventListener("keydown", i), n.classList.remove(this._slideTabBar.getConfig().slideTabBarSpanEditClassName)), this._slideTabBar.removeListener(), this._slideTabBar.updateItems(), this._slideTabBar.getConfig().onChangeName) {
  13727. const d = (n == null ? void 0 : n.innerText) || "", u = this.getId();
  13728. this._slideTabBar.getConfig().onChangeName(u, d);
  13729. }
  13730. e && e(c);
  13731. }
  13732. };
  13733. let i = (c) => {
  13734. n && (c.stopPropagation(), c.key === "Enter" && n.blur());
  13735. };
  13736. const o = (c) => {
  13737. t = !1;
  13738. }, l = (c) => {
  13739. t = !0;
  13740. }, a = (c) => {
  13741. if (!n) return;
  13742. const d = 31;
  13743. setTimeout(() => {
  13744. if (t) {
  13745. const u = n.innerText;
  13746. u.length > d && (n.innerText = u.substring(0, d), ss.keepLastIndex(n));
  13747. }
  13748. }, 0);
  13749. };
  13750. n && (n.setAttribute("contentEditable", "true"), n.addEventListener("focusout", s), n.addEventListener("compositionstart", o), n.addEventListener("compositionend", l), n.addEventListener("input", a), n.addEventListener("keydown", i), n.classList.add(this._slideTabBar.getConfig().slideTabBarSpanEditClassName), this._editMode = !0, ss.keepSelectAll(n));
  13751. }
  13752. }
  13753. nameCheck() {
  13754. const e = this._slideTabItem.querySelector("span");
  13755. if (!e) return !1;
  13756. const t = e.innerText;
  13757. return this._slideTabBar.getConfig().onNameCheckAlert(t);
  13758. }
  13759. animate() {
  13760. return {
  13761. translateX: (e) => {
  13762. this._translateX !== e && (this._animate && (this._animate.cancel(), this._animate = null), this._animate = new sR({
  13763. begin: this._translateX,
  13764. end: e,
  13765. receive: (t) => {
  13766. this._slideTabItem.style.transform = `translateX(${t}px)`;
  13767. }
  13768. }), this._translateX = e, this._animate.request());
  13769. },
  13770. cancel: () => {
  13771. this._animate && (this._animate.cancel(), this._animate = null);
  13772. }
  13773. };
  13774. }
  13775. after(e) {
  13776. this._slideTabItem.after(e._slideTabItem || e);
  13777. }
  13778. update() {
  13779. this._midline = br.midline(this);
  13780. }
  13781. disableFixed() {
  13782. if (this._placeholder) {
  13783. const e = this._slideTabBar.primeval();
  13784. this._slideTabItem.style.removeProperty("position"), this._slideTabItem.style.removeProperty("left"), this._slideTabItem.style.removeProperty("top"), this._slideTabItem.style.removeProperty("width"), this._slideTabItem.style.removeProperty("height"), this._slideTabItem.style.removeProperty("background"), this._slideTabItem.style.removeProperty("padding"), this._slideTabItem.style.removeProperty("box-sizing"), this._slideTabItem.style.removeProperty("font-size"), this._slideTabItem.style.removeProperty("font-family"), this._slideTabItem.style.removeProperty("font-weight"), this._slideTabItem.style.removeProperty("color"), this._slideTabItem.style.removeProperty("border-radius"), this._placeholder.after(this._slideTabItem), e.removeChild(this._placeholder), this._placeholder = null;
  13785. }
  13786. }
  13787. enableFixed() {
  13788. const e = document.createElement("div"), t = this.getBoundingRect(), n = getComputedStyle(this._slideTabItem), s = this._slideTabItem.querySelector("span");
  13789. if (this._placeholder = e, this._placeholder.style.width = `${t.width}px`, this._placeholder.style.height = `${t.height}px`, this._placeholder.style.flexShrink = "0", this._placeholder.style.margin = n.margin, this._slideTabItem.style.background = n.background, s) {
  13790. const i = getComputedStyle(s).padding;
  13791. this._slideTabItem.style.padding = i;
  13792. }
  13793. this._slideTabItem.style.boxSizing = n.boxSizing, this._slideTabItem.style.fontSize = n.fontSize, this._slideTabItem.style.fontFamily = n.fontFamily, this._slideTabItem.style.fontWeight = n.fontWeight, this._slideTabItem.style.color = n.color, this._slideTabItem.style.borderRadius = n.borderRadius, this._slideTabItem.style.left = `${t.x - this.getScrollbar().getScrollX()}px`, this._slideTabItem.style.top = `${t.y}px`, this._slideTabItem.style.width = `${t.width}px`, this._slideTabItem.style.height = `${t.height}px`, this._slideTabItem.style.position = "fixed", this._slideTabItem.after(e), document.body.appendChild(this._slideTabItem);
  13794. }
  13795. addEventListener(e, t, n) {
  13796. this._slideTabItem.addEventListener(e, t, n);
  13797. }
  13798. removeEventListener(e, t, n) {
  13799. this._slideTabItem.removeEventListener(e, t, n);
  13800. }
  13801. getScrollbar() {
  13802. return this._scrollbar;
  13803. }
  13804. getMidLine() {
  13805. return this._midline;
  13806. }
  13807. getBoundingRect() {
  13808. const e = this._slideTabItem.getBoundingClientRect();
  13809. return e.x += this._scrollbar.getScrollX(), e;
  13810. }
  13811. getWidth() {
  13812. return this.getBoundingRect().width;
  13813. }
  13814. getTranslateXDirection() {
  13815. const e = br.midline(this);
  13816. return e > this._midline ? 1 : e < this._midline ? -1 : 0;
  13817. }
  13818. equals(e) {
  13819. return e && e._slideTabItem === this._slideTabItem;
  13820. }
  13821. getId() {
  13822. return this._slideTabItem.dataset.id || "";
  13823. }
  13824. }
  13825. class iR {
  13826. constructor(e) {
  13827. w(this, "_slideTabBar");
  13828. w(this, "_scrollX");
  13829. const t = e.primeval();
  13830. this._scrollX = t.scrollLeft, this._slideTabBar = e;
  13831. }
  13832. scrollX(e) {
  13833. const t = this._slideTabBar.primeval();
  13834. t.scrollLeft = e, this._scrollX = t.scrollLeft;
  13835. }
  13836. scrollRight() {
  13837. const e = this._slideTabBar.primeval();
  13838. e.scrollLeft = e.scrollWidth, this._scrollX = e.scrollLeft;
  13839. }
  13840. getScrollX() {
  13841. return this._scrollX;
  13842. }
  13843. }
  13844. const qr = class qr {
  13845. // eslint-disable-next-line max-lines-per-function
  13846. constructor(e) {
  13847. // in milliseconds
  13848. w(this, "_activeTabItemIndex", 0);
  13849. w(this, "_slideTabBar");
  13850. w(this, "_slideTabItems", []);
  13851. w(this, "_config");
  13852. w(this, "_downActionX", 0);
  13853. w(this, "_moveActionX", 0);
  13854. w(this, "_compareIndex", 0);
  13855. w(this, "_activeTabItem", null);
  13856. w(this, "_moveAction");
  13857. w(this, "_upAction");
  13858. w(this, "_downAction");
  13859. w(this, "_wheelAction");
  13860. w(this, "_scrollIncremental", 0);
  13861. w(this, "_compareDirection", 0);
  13862. w(this, "_autoScrollTime", null);
  13863. w(this, "_slideScrollbar");
  13864. w(this, "_longPressTimer", null);
  13865. /**
  13866. * left border line
  13867. */
  13868. w(this, "_leftBoundingLine", 0);
  13869. /**
  13870. * right border line
  13871. */
  13872. w(this, "_rightBoundingLine", 0);
  13873. /**
  13874. * The distance required to move to the left border
  13875. */
  13876. w(this, "_leftMoveX", 0);
  13877. /**
  13878. * The distance required to move to the right border
  13879. */
  13880. w(this, "_rightMoveX", 0);
  13881. var o;
  13882. if (e.slideTabBarContainer == null)
  13883. throw new Error("not found slide-tab-bar root element");
  13884. const t = e.slideTabBarContainer.querySelector(
  13885. `.${(o = e.slideTabBarClassName) != null ? o : "slide-tab-bar"}`
  13886. );
  13887. if (t == null)
  13888. throw new Error("not found slide-tab-bar");
  13889. this._slideTabBar = t, this._slideScrollbar = new iR(this), this._config = e, this._initConfig();
  13890. let n = 0, s = 0, i = 0;
  13891. this._downAction = (l) => {
  13892. var I, y, M, P, E, T;
  13893. if ((I = this._activeTabItem) != null && I.isEditMode())
  13894. return;
  13895. this._longPressTimer && (clearTimeout(this._longPressTimer), this._longPressTimer = null);
  13896. const a = (M = (y = l.target) == null ? void 0 : y.closest(`.${e.slideTabBarItemClassName}`)) == null ? void 0 : M.getAttribute("data-id"), c = this._slideTabItems.findIndex((A) => A.getId() === a);
  13897. if (a == null || c === -1) return;
  13898. if (this._activeTabItemIndex !== c) {
  13899. (P = this._activeTabItem) == null || P.removeEventListener("pointermove", this._moveAction), (E = this._activeTabItem) == null || E.removeEventListener("pointerup", this._upAction), this.removeListener(), this._config.onChangeTab(l, a);
  13900. return;
  13901. }
  13902. if (this._compareIndex = c, this._downActionX = l.pageX, this._moveActionX = 0, this._scrollIncremental = 0, this._activeTabItem = this._slideTabItems[c], !this._activeTabItem) {
  13903. console.error("Not found active slide-tab-item in sheet bar");
  13904. return;
  13905. }
  13906. const d = this._activeTabItem.getSlideTabItem();
  13907. d == null || d.setPointerCapture(l.pointerId), (T = this._activeTabItem) == null || T.addEventListener("pointerup", this._upAction);
  13908. const { x: u, width: h } = this._activeTabItem.getBoundingRect(), { x: m, width: f } = this.getBoundingRect(), g = this._slideScrollbar.getScrollX();
  13909. if (this._leftBoundingLine = this._downActionX - (u - g), this._rightBoundingLine = u - g + h - this._downActionX, this._leftMoveX = u - m - g, this._rightMoveX = m + f - (u + h) + g, l.button === 2 || this._hasEditItem())
  13910. return;
  13911. const { pageX: p, pageY: S } = l, b = Date.now(), v = b - i <= qr.DoubleClickDelay, _ = Math.abs(p - n) < 10, R = Math.abs(S - s) < 10;
  13912. v && _ && R && this._activeTabItem.setEditor(), n = p, s = S, i = b, this._longPressTimer = setTimeout(() => {
  13913. var A, H, x;
  13914. !d || (A = this._activeTabItem) != null && A.isEditMode() || ((H = this._activeTabItem) == null || H.enableFixed(), this._startAutoScroll(), d.setPointerCapture(l.pointerId), d.style.cursor = "move", (x = this._activeTabItem) == null || x.addEventListener("pointermove", this._moveAction));
  13915. }, qr.LongPressDelay);
  13916. }, this._upAction = (l) => {
  13917. var d, u, h, m;
  13918. if ((d = this._activeTabItem) != null && d.isEditMode() || (this._longPressTimer && (clearTimeout(this._longPressTimer), this._longPressTimer = null), !this._activeTabItem)) return;
  13919. const a = this._autoScrollTime !== null;
  13920. this._closeAutoScroll(), this._activeTabItem.disableFixed(), this.updateItems();
  13921. const c = (u = this._activeTabItem) == null ? void 0 : u.getSlideTabItem();
  13922. c && (c.style.cursor = "", c.releasePointerCapture(l.pointerId), (h = this._activeTabItem) == null || h.removeEventListener("pointermove", this._moveAction), (m = this._activeTabItem) == null || m.removeEventListener("pointerup", this._upAction), this._config.onSlideEnd && this._activeTabItemIndex !== this._compareIndex && a && (this.removeListener(), this._config.onSlideEnd(l, this._compareIndex || 0)), this._scrollIncremental = 0, this._downActionX = 0, this._moveActionX = 0, this._compareIndex = 0);
  13923. }, this._moveAction = (l) => {
  13924. this._activeTabItem && (this._moveActionX = l.pageX - this._downActionX, this._moveActionX <= -this._leftMoveX ? this._moveActionX = -this._leftMoveX : this._moveActionX >= this._rightMoveX && (this._moveActionX = this._rightMoveX), this._scrollIncremental = 0, this._scrollLeft(l), this._scrollRight(l));
  13925. }, this._wheelAction = (l) => {
  13926. this.setScroll(l.deltaY);
  13927. }, this.addListener();
  13928. }
  13929. static checkedSkipSlide(e) {
  13930. let t = e.target;
  13931. for (; t != null && t !== document.body; ) {
  13932. if (t.getAttribute("data-slide-skip"))
  13933. return !0;
  13934. t = t.parentElement;
  13935. }
  13936. return !1;
  13937. }
  13938. static keepLastIndex(e) {
  13939. setTimeout(() => {
  13940. const t = window.getSelection();
  13941. t && (t.selectAllChildren(e), t.collapseToEnd());
  13942. });
  13943. }
  13944. static keepSelectAll(e) {
  13945. setTimeout(() => {
  13946. const t = window.getSelection();
  13947. if (!t) return;
  13948. const n = document.createRange();
  13949. n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
  13950. });
  13951. }
  13952. /**
  13953. * The current instance is persistent, but some parameters need to be updated after refreshing
  13954. * @param currentIndex
  13955. */
  13956. update(e) {
  13957. this._config.currentIndex = e, this._initConfig(), this.removeListener(), this.addListener(), this.scrollToItem(e);
  13958. }
  13959. primeval() {
  13960. return this._slideTabBar;
  13961. }
  13962. updateItems() {
  13963. for (let e = 0; e < this._slideTabItems.length; e++)
  13964. this._slideTabItems[e].animate().cancel(), this._slideTabItems[e].translateX(0), this._slideTabItems[e].update();
  13965. }
  13966. getScrollbar() {
  13967. return this._slideScrollbar;
  13968. }
  13969. getConfig() {
  13970. return this._config;
  13971. }
  13972. getBoundingRect() {
  13973. return this._slideTabBar.getBoundingClientRect();
  13974. }
  13975. getSlideTabItems() {
  13976. return this._slideTabItems;
  13977. }
  13978. getActiveItem() {
  13979. return this._activeTabItem;
  13980. }
  13981. isLeftEnd() {
  13982. return this._slideTabBar.scrollLeft === 0;
  13983. }
  13984. isRightEnd() {
  13985. const e = this._slideTabBar.parentElement;
  13986. return e ? this._slideTabBar.scrollWidth - e.clientWidth === this._slideTabBar.scrollLeft : !1;
  13987. }
  13988. addListener() {
  13989. this._slideTabBar.addEventListener("wheel", this._wheelAction), this._slideTabItems.forEach((e) => {
  13990. e.addEventListener("pointerdown", this._downAction);
  13991. });
  13992. }
  13993. removeListener() {
  13994. this._slideTabBar.removeEventListener("wheel", this._wheelAction), this._slideTabItems.forEach((e) => {
  13995. e.removeEventListener("pointerdown", this._downAction);
  13996. });
  13997. }
  13998. setScroll(e) {
  13999. if (this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + e), e > 0) {
  14000. const t = this.calculateLeftScrollX();
  14001. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + t);
  14002. } else if (e < 0) {
  14003. const t = this.calculateRightScrollX();
  14004. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + t);
  14005. }
  14006. this._config.onScroll({
  14007. leftEnd: this.isLeftEnd(),
  14008. rightEnd: this.isRightEnd()
  14009. });
  14010. }
  14011. flipPage(e) {
  14012. if (e > 0) {
  14013. const t = this.calculateLeftScrollX(!0);
  14014. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + t);
  14015. } else if (e < 0) {
  14016. const t = this.calculateRightScrollX(!0);
  14017. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + t);
  14018. }
  14019. this._config.onScroll({
  14020. leftEnd: this.isLeftEnd(),
  14021. rightEnd: this.isRightEnd()
  14022. });
  14023. }
  14024. scrollToItem(e) {
  14025. if (e = e != null ? e : this._config.currentIndex, e < 0 || e >= this._slideTabItems.length) {
  14026. console.error("Index out of bounds");
  14027. return;
  14028. }
  14029. const t = this.calculateTabItemScrollX(e);
  14030. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + t), this._config.onScroll({
  14031. leftEnd: this.isLeftEnd(),
  14032. rightEnd: this.isRightEnd()
  14033. });
  14034. }
  14035. calculateLeftScrollX(e) {
  14036. let t = 0;
  14037. const n = 4;
  14038. return this._slideTabItems.some((s) => {
  14039. const i = this._slideTabBar.getBoundingClientRect(), o = i.left + i.width, l = s.getSlideTabItem().getBoundingClientRect(), a = l.left, c = l.width;
  14040. return a < o && a + c + n * 2 > o ? (t = e ? a - i.left - n : a + c - o + n, !0) : !1;
  14041. }), t;
  14042. }
  14043. calculateRightScrollX(e) {
  14044. let t = 0;
  14045. const n = 4;
  14046. return this._slideTabItems.some((s) => {
  14047. const i = this._slideTabBar.getBoundingClientRect(), o = i.left, l = s.getSlideTabItem().getBoundingClientRect(), a = l.left, c = l.width;
  14048. return a - n * 2 < o && a + c > o ? (t = e ? a + c - i.left - i.width + n : a - o - n, !0) : !1;
  14049. }), t;
  14050. }
  14051. calculateTabItemScrollX(e) {
  14052. let t = 0;
  14053. const n = 4, s = this._slideTabBar.getBoundingClientRect(), i = s.left, o = s.left + s.width, l = this._slideTabItems[e].getSlideTabItem().getBoundingClientRect(), a = l.left, c = l.width;
  14054. return a - n * 2 < i && (t = a - i - n), a + c + n * 2 > o && (t = a + c - o + n), t;
  14055. }
  14056. calculateActiveTabItemScrollX() {
  14057. var c;
  14058. let e = 0;
  14059. const t = 4, n = this._slideTabBar.getBoundingClientRect(), s = n.left, i = n.left + n.width, o = (c = this._activeTabItem) == null ? void 0 : c.getSlideTabItem().getBoundingClientRect();
  14060. if (!o) return 0;
  14061. const l = o.left, a = o.width;
  14062. return l - t * 2 < s && l + a > s && (e = l - s - t), l < i && l + a + t * 2 > i && (e = l + a - i + t), e;
  14063. }
  14064. destroy() {
  14065. this.removeListener(), this._downActionX = 0, this._moveActionX = 0, this._compareDirection = 0, this._compareIndex = 0, this._slideTabItems = [], this._activeTabItem = null;
  14066. }
  14067. _hasEditItem() {
  14068. for (let e = 0; e < this._slideTabItems.length; e++)
  14069. if (this._slideTabItems[e].isEditMode())
  14070. return !0;
  14071. return !1;
  14072. }
  14073. _autoScrollFrame() {
  14074. if (this._activeTabItem)
  14075. switch (this._compareDirection = this._activeTabItem.translateX(this._moveActionX), this._compareDirection) {
  14076. case 1: {
  14077. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + this._scrollIncremental), this._compareRight();
  14078. break;
  14079. }
  14080. case 0: {
  14081. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + this._scrollIncremental), this._compareIndex = this._activeTabItemIndex;
  14082. break;
  14083. }
  14084. case -1: {
  14085. this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + this._scrollIncremental), this._compareLeft();
  14086. break;
  14087. }
  14088. }
  14089. this._autoScrollTime = requestAnimationFrame(() => {
  14090. this._autoScrollFrame();
  14091. });
  14092. }
  14093. _startAutoScroll() {
  14094. this._autoScrollTime == null && this._autoScrollFrame();
  14095. }
  14096. _closeAutoScroll() {
  14097. this._autoScrollTime && cancelAnimationFrame(this._autoScrollTime), this._autoScrollTime = null;
  14098. }
  14099. _scrollLeft(e) {
  14100. const t = this.getBoundingRect(), n = e.pageX - t.x;
  14101. n < this._leftBoundingLine && (this._scrollIncremental = -Math.min(Math.abs(n - this._leftBoundingLine) * 0.1, 50));
  14102. }
  14103. _scrollRight(e) {
  14104. const t = this.getBoundingRect(), n = e.pageX - t.x;
  14105. n > t.width - this._rightBoundingLine && (this._scrollIncremental = Math.min(Math.abs(n - (t.width - this._rightBoundingLine)) * 0.1, 50));
  14106. }
  14107. _sortedItems() {
  14108. if (this._activeTabItem != null && this._activeTabItemIndex != null && this._compareIndex != null && (this._slideTabItems.splice(this._activeTabItemIndex, 1), this._slideTabItems.splice(this._compareIndex, 0, this._activeTabItem), this._config.slideTabBarItemAutoSort))
  14109. for (let e = 0; e < this._slideTabItems.length; e++) {
  14110. const t = this._slideTabItems[e], n = this._slideTabItems[e + 1];
  14111. n && t.after(n);
  14112. }
  14113. }
  14114. _compareLeft() {
  14115. if (this._activeTabItem && this._activeTabItemIndex) {
  14116. const e = this._slideTabItems.findIndex((i) => i.equals(this._activeTabItem)), t = this._slideTabItems.length, n = [];
  14117. for (let i = 0; i < e && !(i >= e); i++)
  14118. n.push(this._slideTabItems[i]);
  14119. for (let i = e + 1; i < t; i++)
  14120. this._slideTabItems[i].animate().translateX(0);
  14121. let s = !0;
  14122. for (let i = n.length - 1; i >= 0; i--) {
  14123. const o = n[i];
  14124. br.leftLine(this._activeTabItem) < o.getMidLine() ? (o.animate().translateX(this._activeTabItem.getWidth()), this._compareIndex = i, s = !1) : (o.animate().translateX(0), s && (this._compareIndex = this._activeTabItemIndex));
  14125. }
  14126. }
  14127. }
  14128. _compareRight() {
  14129. if (this._activeTabItem) {
  14130. const e = this._slideTabItems.findIndex((i) => i.equals(this._activeTabItem)), t = this._slideTabItems.length, n = [];
  14131. for (let i = e + 1; i < t; i++)
  14132. n.push(this._slideTabItems[i]);
  14133. for (let i = 0; i < e; i++)
  14134. this._slideTabItems[i].animate().translateX(0);
  14135. let s = !0;
  14136. for (let i = 0; i < n.length; i++) {
  14137. const o = n[i];
  14138. br.rightLine(this._activeTabItem) > o.getMidLine() ? (o.animate().translateX(-this._activeTabItem.getWidth()), this._compareIndex = e + i + 1, s = !1) : (o.animate().translateX(0), s && (this._compareIndex = this._activeTabItemIndex));
  14139. }
  14140. }
  14141. }
  14142. _initConfig() {
  14143. var t;
  14144. const e = this._slideTabBar.querySelectorAll(
  14145. `.${(t = this._config.slideTabBarItemClassName) != null ? t : "slide-tab-item"}`
  14146. );
  14147. this._downActionX = 0, this._moveActionX = 0, this._compareDirection = 0, this._compareIndex = 0, this._slideTabItems = br.make(e, this), this._activeTabItemIndex = this._config.currentIndex, this._activeTabItem = this._slideTabItems[this._activeTabItemIndex];
  14148. }
  14149. };
  14150. /** Time in milliseconds to wait to raise long press events if button is still pressed */
  14151. w(qr, "LongPressDelay", 500), // in milliseconds
  14152. /** Time in milliseconds with two consecutive clicks will be considered as a double click */
  14153. w(qr, "DoubleClickDelay", 300);
  14154. let ss = qr;
  14155. function oR() {
  14156. var ve;
  14157. const [r, e] = te([]), [t, n] = te(""), [s, i] = te(""), [o, l] = te(!1), [a, c] = te([0, 0]), d = xn({ slideTabBar: null }), u = xn(null), h = W(F), m = W(kr), f = W(Ee), g = W(tn), p = W(xr), S = W(tt, sc.OPTIONAL), b = W(ft), v = W(Ye), _ = Yt(b.resetOrder$), R = Wn(), I = W($e), y = On(() => {
  14158. var Ze;
  14159. const G = ((Ze = R.getActiveSheet()) == null ? void 0 : Ze.getSheetId()) || "";
  14160. n(G);
  14161. const J = R.getSheets(), le = R.getActiveSheet(), fe = J.filter((lt) => !lt.isSheetHidden()).map((lt, Be) => {
  14162. var xs;
  14163. const we = b.getRule(R.getUnitId(), lt.getSheetId()), Ve = v.getSubunitRuleList(R.getUnitId(), lt.getSheetId()).length > 0, bt = (we == null ? void 0 : we.permissionId) || Ve ? /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
  14164. /* @__PURE__ */ C.jsx(Yd, {}),
  14165. /* @__PURE__ */ C.jsx("span", { children: lt.getName() })
  14166. ] }) : /* @__PURE__ */ C.jsx("span", { children: lt.getName() });
  14167. return {
  14168. sheetId: lt.getSheetId(),
  14169. label: bt,
  14170. index: Be,
  14171. selected: le === lt,
  14172. color: (xs = lt.getTabColor()) != null ? xs : void 0
  14173. };
  14174. });
  14175. e(fe), n(G);
  14176. }, [v, R, b]);
  14177. be(() => {
  14178. y();
  14179. const { slideTabBar: G, disconnectResizeObserver: J } = M(), le = V(), fe = [
  14180. N(),
  14181. X(),
  14182. Y()
  14183. // When adding a sheet, it no longer slides, which has been uniformly handled in setupSlideTabBarUpdate
  14184. ];
  14185. return () => {
  14186. le.dispose(), G.destroy(), fe.forEach((Ze) => Ze.unsubscribe()), J && J();
  14187. };
  14188. }, [_, R]), be(() => {
  14189. r.length > 0 && U();
  14190. }, [r]), be(() => {
  14191. const G = mt(
  14192. b.ruleChange$,
  14193. v.ruleChange$
  14194. ).subscribe(() => {
  14195. y();
  14196. });
  14197. return () => {
  14198. G.unsubscribe();
  14199. };
  14200. }, [b, y]);
  14201. const M = () => {
  14202. const G = new ss({
  14203. slideTabBarClassName: Wt.slideTabBar,
  14204. slideTabBarItemActiveClassName: Wt.slideTabActive,
  14205. slideTabBarItemClassName: Wt.slideTabItem,
  14206. slideTabBarSpanEditClassName: Wt.slideTabDivEdit,
  14207. slideTabBarItemAutoSort: !0,
  14208. slideTabBarContainer: u.current,
  14209. currentIndex: 0,
  14210. onChangeName: (le, fe) => {
  14211. h.executeCommand(QS.id, {
  14212. subUnitId: le,
  14213. name: fe
  14214. });
  14215. },
  14216. onSlideEnd: async (le, fe) => {
  14217. await h.executeCommand(KS.id, { order: fe });
  14218. },
  14219. onChangeTab: (le, fe) => {
  14220. h.executeCommand(et.id, {
  14221. subUnitId: fe,
  14222. unitId: R.getUnitId()
  14223. }).then(() => {
  14224. le.button === 2 && pe(!0);
  14225. });
  14226. },
  14227. onScroll: (le) => {
  14228. m.setScroll(le);
  14229. },
  14230. onNameCheckAlert: (le) => T(le) || A(le) || H(le),
  14231. onNameChangeCheck: () => {
  14232. var we, Ve, pt, bt;
  14233. const le = R.getUnitId(), fe = R == null ? void 0 : R.getActiveSheet();
  14234. if (!fe)
  14235. throw new Error("No active sheet found");
  14236. const Ze = fe.getSheetId(), lt = b.getRule(le, Ze), Be = v.getSubunitRuleList(le, Ze).length > 0;
  14237. return lt || Be ? (Ve = (we = I.getPermissionPoint(new vm(le).id)) == null ? void 0 : we.value) != null ? Ve : !1 : (bt = (pt = I.getPermissionPoint(new bm(le).id)) == null ? void 0 : pt.value) != null ? bt : !1;
  14238. }
  14239. });
  14240. d.current.slideTabBar = G;
  14241. const J = ne(G);
  14242. return { slideTabBar: G, disconnectResizeObserver: J };
  14243. }, P = p.getConfig(Qh), E = (ve = P == null ? void 0 : P.contextMenu) != null ? ve : !0, T = (G) => {
  14244. if (G.trim() === "") {
  14245. const J = "sheetNameEmptyAlert";
  14246. return g.open({
  14247. id: J,
  14248. title: { title: f.t("sheetConfig.sheetNameErrorTitle") },
  14249. children: { title: f.t("sheetConfig.sheetNameCannotIsEmptyError") },
  14250. cancelText: f.t("button.cancel"),
  14251. confirmText: f.t("button.confirm"),
  14252. onClose() {
  14253. x(), g.close(J);
  14254. },
  14255. onConfirm() {
  14256. x(), g.close(J);
  14257. }
  14258. }), !0;
  14259. }
  14260. return !1;
  14261. }, A = (G) => {
  14262. if (!Up(G)) {
  14263. const J = "sheetNameSpecCharAlert";
  14264. return g.open({
  14265. id: J,
  14266. title: { title: f.t("sheetConfig.sheetNameErrorTitle") },
  14267. children: { title: f.t("sheetConfig.sheetNameSpecCharError") },
  14268. cancelText: f.t("button.cancel"),
  14269. confirmText: f.t("button.confirm"),
  14270. onClose() {
  14271. x(), g.close(J);
  14272. },
  14273. onConfirm() {
  14274. x(), g.close(J);
  14275. }
  14276. }), !0;
  14277. }
  14278. return !1;
  14279. }, H = (G) => {
  14280. const J = R.getActiveSheet();
  14281. if ((J == null ? void 0 : J.getName()) === G) return !1;
  14282. const fe = R.checkSheetName(G);
  14283. if (fe) {
  14284. const Ze = "sheetNameRepeatAlert";
  14285. g.open({
  14286. id: Ze,
  14287. title: { title: f.t("sheetConfig.sheetNameErrorTitle") },
  14288. children: { title: f.t("sheetConfig.sheetNameAlreadyExistsError") },
  14289. cancelText: f.t("button.cancel"),
  14290. confirmText: f.t("button.confirm"),
  14291. onClose() {
  14292. g.close(Ze), x();
  14293. },
  14294. onConfirm() {
  14295. g.close(Ze), x();
  14296. }
  14297. });
  14298. }
  14299. return fe;
  14300. }, x = () => {
  14301. setTimeout(() => {
  14302. var J;
  14303. const G = (J = d.current.slideTabBar) == null ? void 0 : J.getActiveItem();
  14304. G && (G.focus(), G.selectAll());
  14305. }, 0);
  14306. }, k = () => {
  14307. var G, J;
  14308. (J = (G = d.current.slideTabBar) == null ? void 0 : G.getActiveItem()) == null || J.setEditor();
  14309. }, U = () => {
  14310. var J;
  14311. const G = r.findIndex((le) => le.selected);
  14312. (J = d.current.slideTabBar) == null || J.update(G);
  14313. }, V = () => h.onCommandExecuted((G) => {
  14314. switch (G.id) {
  14315. case JS.id:
  14316. case nr.id:
  14317. case An.id:
  14318. case Rd.id:
  14319. case Nr.id:
  14320. case wd.id:
  14321. case et.id:
  14322. y();
  14323. break;
  14324. }
  14325. }), N = () => m.scroll$.subscribe((G) => {
  14326. ie(G);
  14327. }), X = () => m.scrollX$.subscribe((G) => {
  14328. var J;
  14329. (J = d.current.slideTabBar) == null || J.flipPage(G);
  14330. }), Y = () => m.renameId$.subscribe(() => {
  14331. k();
  14332. }), ie = (G) => {
  14333. const { leftEnd: J, rightEnd: le } = G;
  14334. let fe = "";
  14335. J && le ? fe = "" : J && !le ? fe = "inset -10px 0px 10px -10px rgba(0, 0, 0, 0.2)" : !J && le ? fe = "inset 10px 0px 10px -10px rgba(0, 0, 0, 0.2)" : !J && !le && (fe = "inset 10px 0px 10px -10px rgba(0, 0, 0, 0.2), inset -10px 0px 10px -10px rgba(0, 0, 0, 0.2)"), i(fe);
  14336. }, he = (G) => {
  14337. const J = G.calculateActiveTabItemScrollX();
  14338. if (J) {
  14339. const le = G.getScrollbar();
  14340. le.scrollX(le.getScrollX() + J);
  14341. }
  14342. m.setScroll({
  14343. leftEnd: G.isLeftEnd(),
  14344. rightEnd: G.isRightEnd()
  14345. });
  14346. }, ne = (G) => {
  14347. var fe;
  14348. const J = (fe = u.current) == null ? void 0 : fe.querySelector(`.${Wt.slideTabBar}`);
  14349. if (!J) return;
  14350. const le = new ResizeObserver(() => {
  14351. he(G);
  14352. });
  14353. return le.observe(J), () => le.disconnect();
  14354. }, pe = (G) => {
  14355. var J, le, fe, Ze, lt;
  14356. if (E && !(S != null && S.isForceKeepVisible())) {
  14357. if (G) {
  14358. const { left: Be } = (le = (J = u.current) == null ? void 0 : J.getBoundingClientRect()) != null ? le : {}, { left: we } = (lt = (Ze = (fe = d.current.slideTabBar) == null ? void 0 : fe.getActiveItem()) == null ? void 0 : Ze.getSlideTabItem().getBoundingClientRect()) != null ? lt : {};
  14359. Be !== void 0 && we !== void 0 && c([we - Be, 0]);
  14360. }
  14361. l(G);
  14362. }
  14363. };
  14364. return /* @__PURE__ */ C.jsx(
  14365. ei,
  14366. {
  14367. className: Wt.slideTabItemDropdown,
  14368. visible: o,
  14369. align: { offset: a },
  14370. trigger: ["contextMenu"],
  14371. overlay: /* @__PURE__ */ C.jsx(
  14372. wS,
  14373. {
  14374. menuType: Ct.FOOTER_TABS,
  14375. onOptionSelect: (G) => {
  14376. const { label: J, value: le, commandId: fe } = G;
  14377. h.executeCommand(fe != null ? fe : J, { value: le, subUnitId: t }), l(!1);
  14378. }
  14379. }
  14380. ),
  14381. onVisibleChange: pe,
  14382. children: /* @__PURE__ */ C.jsx(
  14383. "div",
  14384. {
  14385. className: Wt.slideTabBarContainer,
  14386. ref: u,
  14387. onDragStart: (G) => G.preventDefault(),
  14388. onContextMenu: (G) => G.preventDefault(),
  14389. children: /* @__PURE__ */ C.jsx("div", { className: Wt.slideTabBar, style: { boxShadow: s }, children: r.map((G) => /* @__PURE__ */ at(tR, { ...G, key: G.sheetId, selected: t === G.sheetId })) })
  14390. }
  14391. )
  14392. }
  14393. );
  14394. }
  14395. const lR = 100, aR = () => {
  14396. var g, p;
  14397. const [r, e] = te(!0), [t, n] = te(!0), s = W(F), i = W(kr), o = W($e), a = Wn().getUnitId(), c = Yt(o.getPermissionPoint$((g = new q(a)) == null ? void 0 : g.id)), d = Yt(o.getPermissionPoint$((p = new _m(a)) == null ? void 0 : p.id));
  14398. be(() => {
  14399. const S = i.scroll$.subscribe((b) => {
  14400. u(b);
  14401. });
  14402. return () => {
  14403. S.unsubscribe();
  14404. };
  14405. }, []);
  14406. const u = (S) => {
  14407. const { leftEnd: b, rightEnd: v } = S;
  14408. e(b), n(v);
  14409. }, h = () => {
  14410. s.executeCommand($S.id), setTimeout(() => {
  14411. i.setAddSheet(0);
  14412. }, 0);
  14413. }, m = () => {
  14414. i.setScrollX(-100);
  14415. }, f = () => {
  14416. i.setScrollX(lR);
  14417. };
  14418. return /* @__PURE__ */ C.jsxs("div", { className: to.sheetBar, children: [
  14419. /* @__PURE__ */ C.jsxs("div", { className: to.sheetBarOptions, children: [
  14420. /* @__PURE__ */ C.jsx(po, { onClick: h, disabled: !(d != null && d.value && (c != null && c.value)), children: /* @__PURE__ */ C.jsx(zd, {}) }),
  14421. /* @__PURE__ */ C.jsx(Z0, {})
  14422. ] }),
  14423. /* @__PURE__ */ C.jsx(oR, {}),
  14424. (!r || !t) && /* @__PURE__ */ C.jsxs(
  14425. "div",
  14426. {
  14427. className: `
  14428. ${to.sheetBarOptions}
  14429. ${to.sheetBarOptionsDivider}
  14430. `,
  14431. children: [
  14432. /* @__PURE__ */ C.jsx(po, { disabled: r, onClick: m, children: /* @__PURE__ */ C.jsx(Vc, { style: { transform: "rotateZ(180deg)" } }) }),
  14433. /* @__PURE__ */ C.jsx(po, { disabled: t, onClick: f, children: /* @__PURE__ */ C.jsx(Vc, {}) })
  14434. ]
  14435. }
  14436. )
  14437. ] });
  14438. };
  14439. class lg {
  14440. constructor() {
  14441. w(this, "_functions", [
  14442. {
  14443. func: Fe.MAX,
  14444. filter: (e) => {
  14445. var t, n, s, i;
  14446. return ((n = (t = e.values.find((o) => o.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1 && ((i = (s = e.values.find((o) => o.func === Fe.COUNT)) == null ? void 0 : s.value) != null ? i : 0) > 0;
  14447. }
  14448. },
  14449. {
  14450. func: Fe.MIN,
  14451. filter: (e) => {
  14452. var t, n, s, i;
  14453. return ((n = (t = e.values.find((o) => o.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1 && ((i = (s = e.values.find((o) => o.func === Fe.COUNT)) == null ? void 0 : s.value) != null ? i : 0) > 0;
  14454. }
  14455. },
  14456. {
  14457. func: Dl.SUM,
  14458. filter: (e) => {
  14459. var t, n, s, i;
  14460. return ((n = (t = e.values.find((o) => o.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1 && ((i = (s = e.values.find((o) => o.func === Fe.COUNT)) == null ? void 0 : s.value) != null ? i : 0) > 0;
  14461. }
  14462. },
  14463. {
  14464. func: Fe.COUNTA,
  14465. filter: (e) => {
  14466. var t, n;
  14467. return ((n = (t = e.values.find((s) => s.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1;
  14468. }
  14469. },
  14470. {
  14471. func: Fe.COUNT,
  14472. filter: (e) => {
  14473. var t, n, s, i;
  14474. return ((n = (t = e.values.find((o) => o.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1 && ((i = (s = e.values.find((o) => o.func === Fe.COUNT)) == null ? void 0 : s.value) != null ? i : 0) > 0;
  14475. }
  14476. },
  14477. {
  14478. func: Fe.AVERAGE,
  14479. filter: (e) => {
  14480. var t, n, s, i;
  14481. return ((n = (t = e.values.find((o) => o.func === Fe.COUNTA)) == null ? void 0 : t.value) != null ? n : 0) > 1 && ((i = (s = e.values.find((o) => o.func === Fe.COUNT)) == null ? void 0 : s.value) != null ? i : 0) > 0;
  14482. }
  14483. }
  14484. ]);
  14485. w(this, "_state$", new Me(null));
  14486. w(this, "state$", this._state$.asObservable());
  14487. }
  14488. dispose() {
  14489. this._state$.complete();
  14490. }
  14491. setState(e) {
  14492. var n;
  14493. const t = {
  14494. values: [],
  14495. pattern: null
  14496. };
  14497. e == null || e.values.forEach((s) => {
  14498. const i = this._functions.find((o) => o.func === s.func);
  14499. i && (i.filter === void 0 || i.filter(e)) && t.values.push(s);
  14500. }), t.pattern = (n = e == null ? void 0 : e.pattern) != null ? n : null, this._state$.next(t);
  14501. }
  14502. getState() {
  14503. return this._state$.getValue();
  14504. }
  14505. getFunctions() {
  14506. return this._functions;
  14507. }
  14508. addFunctions(e) {
  14509. this._functions.push(...e);
  14510. }
  14511. }
  14512. const da = gn("univer.sheet-status-bar.service"), cR = "univer-status-bar", dR = "univer-single-mode", uR = "univer-status-bar-div", hR = "univer-statistic-list", mR = "univer-statistic-list-column", fR = "univer-statistic-item", gR = "univer-statistic-picker", pR = "univer-statistic-picker-item", SR = "univer-statistic-more", zr = {
  14513. statusBar: cR,
  14514. singleMode: dR,
  14515. statusBarDiv: uR,
  14516. statisticList: hR,
  14517. statisticListColumn: mR,
  14518. statisticItem: fR,
  14519. statisticPicker: gR,
  14520. statisticPickerItem: pR,
  14521. statisticMore: SR
  14522. }, CR = [
  14523. Dl.SUM,
  14524. Fe.AVERAGE,
  14525. Fe.MIN,
  14526. Fe.MAX
  14527. ], Da = {
  14528. [Dl.SUM]: "statusbar.sum",
  14529. [Fe.AVERAGE]: "statusbar.average",
  14530. [Fe.MIN]: "statusbar.min",
  14531. [Fe.MAX]: "statusbar.max",
  14532. [Fe.COUNT]: "statusbar.count",
  14533. [Fe.COUNTA]: "statusbar.countA",
  14534. [EC.CONCATENATE]: "concatenate"
  14535. }, La = (r) => {
  14536. const e = W(Ee), t = W(Kh), n = W(wl), s = vR(r), i = async () => {
  14537. await n.writeText(r.value.toString()), t.show({
  14538. type: Ym.Success,
  14539. content: e.t("statusbar.copied")
  14540. });
  14541. };
  14542. return /* @__PURE__ */ C.jsx(Gn, { title: e.t("statusbar.clickToCopy"), placement: "top", children: /* @__PURE__ */ C.jsx("div", { className: zr.statisticItem, onClick: i, children: /* @__PURE__ */ C.jsx("span", { children: `${e.t(
  14543. (Da == null ? void 0 : Da[r.name]) || r.name
  14544. )}: ${s}` }) }, r.name) });
  14545. };
  14546. function vR(r) {
  14547. const { pattern: e, value: t } = r;
  14548. return typeof t != "number" ? 0 : t >= 1e8 ? t.toExponential(2) : e && CR.includes(r.name) ? er.format(e, t, { throws: !1 }) : t.toLocaleString();
  14549. }
  14550. const fh = 800, bR = 3, _R = () => {
  14551. const [r, e] = te(window.innerWidth < fh), [t, n] = te(!0), s = W(da), i = s.getFunctions().map((h, m) => ({
  14552. name: h.func,
  14553. value: 0,
  14554. show: !0,
  14555. disable: !1,
  14556. pattern: null
  14557. })), [o, l] = te(i), a = o.find((h) => h.show && !h.disable), c = r && a ? [a] : o.filter((h) => h.show && !h.disable);
  14558. be(() => {
  14559. const h = s.state$.subscribe((m) => {
  14560. const f = m == null ? void 0 : m.values;
  14561. if (!f || f.length === 0)
  14562. n(!1);
  14563. else {
  14564. n(!0);
  14565. const g = o.map((p) => {
  14566. var b;
  14567. const S = f.find((v) => v.func === p.name);
  14568. return S ? (p.value = S.value, p.disable = !1) : p.disable = !0, p.pattern = (b = m == null ? void 0 : m.pattern) != null ? b : null, p;
  14569. });
  14570. l(g);
  14571. }
  14572. });
  14573. return () => {
  14574. h.unsubscribe();
  14575. };
  14576. }, [s]);
  14577. const d = Fh(() => {
  14578. const h = window.innerWidth < fh;
  14579. r !== h && e(h);
  14580. }, 100);
  14581. be(() => (window.addEventListener("resize", d), () => {
  14582. window.removeEventListener("resize", d);
  14583. }), [r]);
  14584. let u = null;
  14585. if (c.length > bR) {
  14586. const h = [];
  14587. c.forEach((m, f) => {
  14588. f % 2 === 0 && h.push(c.slice(f, f + 2));
  14589. }), u = /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
  14590. " ",
  14591. h.map((m, f) => /* @__PURE__ */ C.jsxs("div", { className: zr.statisticListColumn, children: [
  14592. (m == null ? void 0 : m[0]) && /* @__PURE__ */ C.jsx(La, { ...m == null ? void 0 : m[0] }, m == null ? void 0 : m[0].name),
  14593. (m == null ? void 0 : m[1]) && /* @__PURE__ */ C.jsx(La, { ...m == null ? void 0 : m[1] }, m == null ? void 0 : m[1].name)
  14594. ] }, `stat-col-${f}`)),
  14595. " "
  14596. ] });
  14597. } else
  14598. u = /* @__PURE__ */ C.jsx(C.Fragment, { children: c.map((h) => /* @__PURE__ */ C.jsx(La, { ...h }, h.name)) });
  14599. return t && /* @__PURE__ */ C.jsxs(
  14600. "div",
  14601. {
  14602. className: st(zr.statusBar, {
  14603. [zr.singleMode]: r
  14604. }),
  14605. children: [
  14606. /* @__PURE__ */ C.jsx("div", { className: st(zr.statisticList), children: u }),
  14607. /* @__PURE__ */ C.jsx("div", { className: zr.statusBarDiv })
  14608. ]
  14609. }
  14610. );
  14611. };
  14612. function wR() {
  14613. const r = W(id), e = Wn(), t = r.getMenuByPositionKey(Ct.FOOTER_MENU);
  14614. return e ? /* @__PURE__ */ C.jsxs("section", { className: af.sheetContainer, "data-range-selector": !0, children: [
  14615. /* @__PURE__ */ C.jsx(aR, {}),
  14616. /* @__PURE__ */ C.jsx(_R, {}),
  14617. t.map((n) => {
  14618. var s;
  14619. return (s = n.children) == null ? void 0 : s.map((i) => (i == null ? void 0 : i.item) && /* @__PURE__ */ C.jsx(
  14620. RS,
  14621. {
  14622. align: {
  14623. offset: [-32, 18]
  14624. },
  14625. ...i.item
  14626. },
  14627. i.key
  14628. ));
  14629. }),
  14630. /* @__PURE__ */ C.jsx(Kw, {})
  14631. ] }) : null;
  14632. }
  14633. function RR() {
  14634. return ag() ? /* @__PURE__ */ C.jsx(w0, {}) : null;
  14635. }
  14636. function IR() {
  14637. return ag() ? /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
  14638. /* @__PURE__ */ C.jsx(t0, {}),
  14639. /* @__PURE__ */ C.jsx(N0, {})
  14640. ] }) : null;
  14641. }
  14642. function ag() {
  14643. const r = W(L), t = !!Yt(() => r.getCurrentTypeOfUnit$(O.UNIVER_SHEET), null, !1, []);
  14644. return sn(
  14645. () => r.getAllUnitsForType(O.UNIVER_SHEET).length > 0,
  14646. // eslint-disable-next-line react-hooks/exhaustive-deps
  14647. [r, t]
  14648. );
  14649. }
  14650. const Pr = "sheets-ui.config", Lc = {
  14651. formulaBar: !0
  14652. };
  14653. function yR(r) {
  14654. const e = r.get(fc), t = ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] });
  14655. return {
  14656. id: pc.id,
  14657. icon: new it((n) => {
  14658. const s = "AllBorderSingle", i = r.get(fc), o = r.get(F).onCommandExecuted((l) => {
  14659. var h;
  14660. if (l.id !== pc.id)
  14661. return;
  14662. const { type: c } = i.getBorderInfo(), d = ng.find((m) => m.value === c), u = (h = d == null ? void 0 : d.icon) != null ? h : s;
  14663. n.next(u);
  14664. });
  14665. return n.next(s), o.dispose;
  14666. }),
  14667. tooltip: "toolbar.border.main",
  14668. type: Q.BUTTON_SELECTOR,
  14669. selections: [
  14670. {
  14671. label: {
  14672. name: $d,
  14673. hoverable: !1
  14674. },
  14675. value$: e.borderInfo$
  14676. }
  14677. ],
  14678. value$: e.borderInfo$,
  14679. hidden$: oe(r, O.UNIVER_SHEET),
  14680. disabled$: t
  14681. };
  14682. }
  14683. const So = "sheet.menu.clear-selection";
  14684. function Wa(r) {
  14685. return {
  14686. id: So,
  14687. type: Q.SUBITEMS,
  14688. icon: "ClearFormat",
  14689. title: "rightClick.clearSelection",
  14690. hidden$: oe(r, O.UNIVER_SHEET)
  14691. };
  14692. }
  14693. function Ba(r) {
  14694. return {
  14695. id: Xs.id,
  14696. type: Q.BUTTON,
  14697. title: "rightClick.clearContent",
  14698. disabled$: Es(r, ue(r, { workbookTypes: [q], worksheetTypes: [ee, Ut], rangeTypes: [re] })),
  14699. hidden$: oe(r, O.UNIVER_SHEET)
  14700. };
  14701. }
  14702. function Fa(r) {
  14703. return {
  14704. id: zs.id,
  14705. type: Q.BUTTON,
  14706. title: "rightClick.clearFormat",
  14707. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, ze], rangeTypes: [re] }),
  14708. hidden$: oe(r, O.UNIVER_SHEET)
  14709. };
  14710. }
  14711. function Ua(r) {
  14712. return {
  14713. id: mo.id,
  14714. type: Q.BUTTON,
  14715. title: "rightClick.clearAll",
  14716. disabled$: Es(r, ue(r, { workbookTypes: [q], worksheetTypes: [ee, Ut, ze], rangeTypes: [re] })),
  14717. hidden$: oe(r, O.UNIVER_SHEET)
  14718. };
  14719. }
  14720. const cg = "sheet.menu.delete";
  14721. function MR(r) {
  14722. return {
  14723. id: cg,
  14724. type: Q.SUBITEMS,
  14725. title: "rightClick.delete",
  14726. icon: "Reduce",
  14727. hidden$: Es(r, Jl(r)),
  14728. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee] })
  14729. };
  14730. }
  14731. function gh(r) {
  14732. return {
  14733. id: pi.id,
  14734. type: Q.BUTTON,
  14735. icon: "DeleteColumn",
  14736. title: "rightClick.deleteSelectedColumn",
  14737. hidden$: Es(r, Of(r, "col")),
  14738. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, eC] })
  14739. };
  14740. }
  14741. function ph(r) {
  14742. return {
  14743. id: gi.id,
  14744. type: Q.BUTTON,
  14745. icon: "DeleteRow",
  14746. title: "rightClick.deleteSelectedRow",
  14747. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, tC] }),
  14748. hidden$: Of(r, "row")
  14749. };
  14750. }
  14751. function PR(r) {
  14752. return {
  14753. id: Xi.id,
  14754. type: Q.BUTTON,
  14755. title: "rightClick.moveLeft",
  14756. icon: "DeleteCellShiftLeft",
  14757. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee], rangeTypes: [re] }),
  14758. hidden$: $l(r, "col")
  14759. };
  14760. }
  14761. function ER(r) {
  14762. return {
  14763. id: ms.id,
  14764. type: Q.BUTTON,
  14765. title: "rightClick.moveUp",
  14766. icon: "DeleteCellShiftUp",
  14767. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee], rangeTypes: [re] }),
  14768. hidden$: $l(r, "row")
  14769. };
  14770. }
  14771. function TR(r) {
  14772. const e = r.get(F), t = r.get(L);
  14773. return {
  14774. id: wm.id,
  14775. type: Q.BUTTON,
  14776. tooltip: "toolbar.toggleGridlines",
  14777. icon: "HideGridlines",
  14778. activated$: new it((n) => {
  14779. const s = () => {
  14780. const o = t.getCurrentUnitForType(O.UNIVER_SHEET);
  14781. return o ? o.getActiveSheet().getConfig().showGridlines === Qe.TRUE : !1;
  14782. }, i = new St();
  14783. return i.add(e.onCommandExecuted((o) => {
  14784. (o.id === nC.id || o.id === et.id) && n.next(s());
  14785. })), i.add(t.getCurrentTypeOfUnit$(O.UNIVER_SHEET).subscribe(() => {
  14786. n.next(s());
  14787. })), n.next(s()), () => i.dispose();
  14788. }),
  14789. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee] })
  14790. };
  14791. }
  14792. const dg = "sheet.menu.col-insert";
  14793. function xR(r) {
  14794. return {
  14795. id: dg,
  14796. type: Q.SUBITEMS,
  14797. title: "rightClick.insert",
  14798. icon: "Insert",
  14799. hidden$: Jl(r),
  14800. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee, Hl] })
  14801. };
  14802. }
  14803. const ug = "sheet.menu.row-insert";
  14804. function OR(r) {
  14805. return {
  14806. id: ug,
  14807. type: Q.SUBITEMS,
  14808. title: "rightClick.insert",
  14809. icon: "Insert",
  14810. hidden$: Jl(r),
  14811. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Id, ee], rangeTypes: [re] })
  14812. };
  14813. }
  14814. const hg = "sheet.menu.cell-insert";
  14815. function AR(r) {
  14816. return {
  14817. id: hg,
  14818. type: Q.SUBITEMS,
  14819. title: "rightClick.insert",
  14820. icon: "Insert",
  14821. hidden$: Es(r, Jl(r)),
  14822. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Hl, ee], rangeTypes: [re] })
  14823. };
  14824. }
  14825. function Sh(r) {
  14826. return {
  14827. id: Sc.id,
  14828. type: Q.BUTTON,
  14829. title: "rightClick.insertRowBefore",
  14830. icon: "InsertRowAbove",
  14831. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Id, ee], rangeTypes: [re] }),
  14832. hidden$: xf(r, "row")
  14833. };
  14834. }
  14835. function NR(r) {
  14836. return {
  14837. id: Rm.id,
  14838. type: Q.BUTTON,
  14839. title: "rightClick.insertRow",
  14840. icon: "InsertRowBelow",
  14841. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Id, ee], rangeTypes: [re] }),
  14842. hidden$: Tf(r, "row")
  14843. };
  14844. }
  14845. function Ch(r) {
  14846. return {
  14847. id: Cc.id,
  14848. type: Q.BUTTON,
  14849. title: "rightClick.insertColumnBefore",
  14850. icon: "LeftInsertColumn",
  14851. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Hl, ee], rangeTypes: [re] }),
  14852. hidden$: xf(r, "col")
  14853. };
  14854. }
  14855. function HR(r) {
  14856. return {
  14857. id: Im.id,
  14858. type: Q.BUTTON,
  14859. title: "rightClick.insertColumn",
  14860. icon: "RightInsertColumn",
  14861. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [Hl, ee], rangeTypes: [re] }),
  14862. hidden$: Tf(r, "col")
  14863. };
  14864. }
  14865. function VR(r) {
  14866. return {
  14867. id: zi.id,
  14868. type: Q.BUTTON,
  14869. title: "rightClick.moveRight",
  14870. icon: "InsertCellShiftRight",
  14871. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee], rangeTypes: [re] }),
  14872. hidden$: $l(r, "col")
  14873. };
  14874. }
  14875. function kR(r) {
  14876. return {
  14877. id: fs.id,
  14878. type: Q.BUTTON,
  14879. title: "rightClick.moveDown",
  14880. icon: "InsertCellDown",
  14881. disabled$: ue(r, { workbookTypes: [q], worksheetTypes: [ee], rangeTypes: [re] }),
  14882. hidden$: $l(r, "row")
  14883. };
  14884. }
  14885. function DR(r) {
  14886. const e = ue(r, { workbookTypes: [q], worksheetTypes: [ee, Ut, ze], rangeTypes: [re] }), t = n_(r);
  14887. return {
  14888. id: or.id,
  14889. icon: "MergeAllSingle",
  14890. tooltip: "toolbar.mergeCell.main",
  14891. type: Q.SUBITEMS,
  14892. // selections: [...MERGE_CHILDREN],
  14893. hidden$: oe(r, O.UNIVER_SHEET),
  14894. disabled$: e.pipe(
  14895. ir(t),
  14896. _e(([n, s]) => n || s)
  14897. )
  14898. };
  14899. }
  14900. function LR(r) {
  14901. return {
  14902. id: Gd.id,
  14903. type: Q.BUTTON,
  14904. title: "merge.all",
  14905. icon: "MergeAllSingle",
  14906. hidden$: oe(r, O.UNIVER_SHEET)
  14907. };
  14908. }
  14909. function WR(r) {
  14910. return {
  14911. id: qd.id,
  14912. type: Q.BUTTON,
  14913. title: "merge.vertical",
  14914. icon: "VerticalIntegrationSingle",
  14915. hidden$: oe(r, O.UNIVER_SHEET)
  14916. };
  14917. }
  14918. function BR(r) {
  14919. return {
  14920. id: Qd.id,
  14921. type: Q.BUTTON,
  14922. title: "merge.horizontal",
  14923. icon: "HorizontalMergeSingle",
  14924. hidden$: oe(r, O.UNIVER_SHEET)
  14925. };
  14926. }
  14927. function FR(r) {
  14928. return {
  14929. id: ym.id,
  14930. type: Q.BUTTON,
  14931. title: "merge.cancel",
  14932. icon: "CancelMergeSingle",
  14933. hidden$: oe(r, O.UNIVER_SHEET)
  14934. };
  14935. }
  14936. function UR(r) {
  14937. const t = r.get(L).getCurrentTypeOfUnit$(O.UNIVER_SHEET), n = r.get(Dt);
  14938. return ot([t, n.currentUser$]).pipe(
  14939. We(([s, i]) => s ? s.activeSheet$.pipe(
  14940. We((o) => {
  14941. if (!o)
  14942. return Ie(!0);
  14943. const l = r.get(Ye), a = r.get(ft), c = r.get($);
  14944. return mt(
  14945. c.selectionMoveEnd$,
  14946. l.ruleChange$,
  14947. a.ruleChange$
  14948. ).pipe(
  14949. _e(() => {
  14950. const d = s.getUnitId(), u = o.getSheetId(), h = l.getSubunitRuleList(d, u), m = c.getCurrentSelections(), f = m == null ? void 0 : m.map((S) => S.range), g = h.map((S) => S.ranges).flat();
  14951. if (!f)
  14952. return !1;
  14953. const p = a.getRule(d, u);
  14954. return p != null && p.permissionId ? !0 : f == null ? void 0 : f.some((S) => g.some((b) => ae.intersects(S, b)));
  14955. })
  14956. );
  14957. })
  14958. ) : Ie(!0))
  14959. );
  14960. }
  14961. function jR(r) {
  14962. const e = r.get(L), t = r.get(Ye), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  14963. return ot([n, s.currentUser$]).pipe(
  14964. We(([i, o]) => i ? i.activeSheet$.pipe(
  14965. We((l) => {
  14966. if (!l)
  14967. return Ie(!0);
  14968. const a = r.get(Ye), c = r.get(ft), d = r.get($e), u = r.get($);
  14969. return mt(
  14970. u.selectionMoveEnd$,
  14971. a.ruleChange$,
  14972. c.ruleChange$
  14973. ).pipe(
  14974. _e(() => {
  14975. var M, P;
  14976. const h = i.getUnitId(), m = l.getSheetId(), f = t.getSubunitRuleList(h, m), g = (M = u.getCurrentSelections()) == null ? void 0 : M.map((E) => E.range);
  14977. if (f.map((E) => E.ranges).flat(), !(g != null && g.length) || g.length > 1)
  14978. return !0;
  14979. const p = g[0];
  14980. if ((p == null ? void 0 : p.rangeType) === j.ALL || (p == null ? void 0 : p.rangeType) === j.COLUMN || (p == null ? void 0 : p.rangeType) === j.ROW)
  14981. return !0;
  14982. const S = c.getRule(h, m);
  14983. if (S != null && S.permissionId)
  14984. return ((P = d.getPermissionPoint(new rC(h, m).id)) == null ? void 0 : P.value) === !1;
  14985. if (f.filter((E) => E.ranges.some((T) => ae.intersects(T, p))).length !== 1)
  14986. return !0;
  14987. const { startRow: v, endRow: _, startColumn: R, endColumn: I } = p, y = r.get(Vl);
  14988. for (let E = v; E <= _; E++)
  14989. for (let T = R; T <= I; T++) {
  14990. const A = y.getCellInfo(h, m, E, T);
  14991. if (A)
  14992. return A[ad.ManageCollaborator] === !1;
  14993. }
  14994. return !1;
  14995. })
  14996. );
  14997. })
  14998. ) : Ie(!0))
  14999. );
  15000. }
  15001. function XR(r) {
  15002. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  15003. return ot([n, s.currentUser$]).pipe(
  15004. We(([i, o]) => i ? i.activeSheet$.pipe(
  15005. We((l) => {
  15006. var f;
  15007. if (!l)
  15008. return Ie(!0);
  15009. const a = i.getUnitId(), c = r.get($), d = r.get(Ye), u = r.get(ft), h = (f = t.composePermission$([new q(a).id]).pipe(_e((g) => g.every((p) => p.value)))) != null ? f : Ie(!1), m = mt(
  15010. d.ruleChange$,
  15011. u.ruleChange$
  15012. ).pipe(
  15013. Vt(null)
  15014. );
  15015. return ot([h, m, c.selectionMoveEnd$]).pipe(
  15016. _e(([g, p, S]) => {
  15017. if (!g)
  15018. return !0;
  15019. const b = c.getCurrentSelections(), v = b == null ? void 0 : b.map((_) => _.range);
  15020. return v != null && v.length ? v.length > 1 : !1;
  15021. })
  15022. );
  15023. })
  15024. ) : Ie(!0))
  15025. );
  15026. }
  15027. function mg(r) {
  15028. var c;
  15029. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt), i = r.has(tt) ? r.get(tt) : null, l = r.get(Ne).subscribeContextValue$(Ht), a = (c = i == null ? void 0 : i.visible$) != null ? c : Ie(null);
  15030. return ot([n, s.currentUser$, a, l]).pipe(
  15031. We(([d, u, h, m]) => !d || h != null && h.visible && h.unitId === d.getUnitId() || m ? Ie(!0) : d.activeSheet$.pipe(
  15032. We((f) => {
  15033. var M;
  15034. if (!f)
  15035. return Ie(!0);
  15036. const p = r.get(Ne).subscribeContextValue$(Cl).pipe(Vt(!1)), S = d.getUnitId(), b = f.getSheetId(), v = r.get(Ye), _ = r.get(ft), R = r.get($), I = (M = t.composePermission$([new kl(S).id]).pipe(_e((P) => P.every((E) => E.value)))) != null ? M : Ie(!1), y = mt(
  15037. v.ruleChange$,
  15038. _.ruleChange$
  15039. ).pipe(
  15040. Vt(null)
  15041. );
  15042. return ot([I, y, R.selectionMoveEnd$, p]).pipe(
  15043. _e(([P, E, T, A]) => {
  15044. if (!P || A)
  15045. return !0;
  15046. const H = R.getCurrentSelections(), x = H == null ? void 0 : H.map((N) => N.range);
  15047. if (!(x != null && x.length))
  15048. return !0;
  15049. const k = _.getRule(S, b);
  15050. if (k != null && k.permissionId)
  15051. return !0;
  15052. const U = v.getSubunitRuleList(S, b);
  15053. return x == null ? void 0 : x.some((N) => U.some((X) => X.ranges.some((Y) => ae.intersects(N, Y))));
  15054. })
  15055. );
  15056. })
  15057. ))
  15058. );
  15059. }
  15060. function zR(r) {
  15061. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  15062. return ot([n, s.currentUser$]).pipe(
  15063. We(([i, o]) => i ? i.activeSheet$.pipe(
  15064. We((l) => {
  15065. var f;
  15066. if (!l)
  15067. return Ie(!0);
  15068. const a = i.getUnitId(), c = l.getSheetId(), d = r.get(Ye), u = r.get(ft), h = (f = t.composePermission$([new kl(a).id]).pipe(_e((g) => g.every((p) => p.value)))) != null ? f : Ie(!1), m = mt(
  15069. d.ruleChange$,
  15070. u.ruleChange$
  15071. ).pipe(
  15072. Vt(null)
  15073. );
  15074. return ot([h, m]).pipe(
  15075. _e(([g, p]) => {
  15076. var v;
  15077. if (!g) return !0;
  15078. const S = u.getRule(a, c);
  15079. return S != null && S.permissionId ? !0 : ((v = d.getSubunitRuleList(a, c)) == null ? void 0 : v.filter((_) => _ == null ? void 0 : _.permissionId)).length > 0;
  15080. })
  15081. );
  15082. })
  15083. ) : Ie(!0))
  15084. );
  15085. }
  15086. function YR(r) {
  15087. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  15088. return ot([n, s.currentUser$]).pipe(
  15089. We(([i, o]) => i ? i.activeSheet$.pipe(
  15090. We((l) => {
  15091. if (!l)
  15092. return Ie(!0);
  15093. const a = i.getUnitId(), c = l.getSheetId(), d = r.get(ft);
  15094. return d.ruleChange$.pipe(Vt(null)).pipe(
  15095. _e(() => {
  15096. var h;
  15097. return d.getRule(a, c) ? ((h = t.getPermissionPoint(new Mm(a, c).id)) == null ? void 0 : h.value) === !1 : !0;
  15098. })
  15099. );
  15100. })
  15101. ) : Ie(!0))
  15102. );
  15103. }
  15104. function ZR(r) {
  15105. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  15106. return ot([n, s.currentUser$]).pipe(
  15107. We(([i, o]) => i ? i.activeSheet$.pipe(
  15108. We((l) => {
  15109. var f;
  15110. if (!l)
  15111. return Ie(!0);
  15112. const a = i.getUnitId(), c = r.get(Ye), d = r.get(ft), u = (f = t.composePermission$([new kl(a).id, new vm(a).id]).pipe(_e((g) => g.every((p) => p.value)))) != null ? f : Ie(!1), h = d.ruleChange$.pipe(Vt(null)), m = c.ruleChange$.pipe(Vt(null));
  15113. return ot([u, h, m]).pipe(
  15114. _e(([g, p, S]) => {
  15115. if (!g)
  15116. return !0;
  15117. const b = l.getSheetId(), v = d.getRule(a, b), _ = c.getSubunitRuleList(a, b);
  15118. return !(v || _.length);
  15119. })
  15120. );
  15121. })
  15122. ) : Ie(!0))
  15123. );
  15124. }
  15125. function GR(r) {
  15126. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt);
  15127. return ot([n, s.currentUser$]).pipe(
  15128. We(([i, o]) => i ? i.activeSheet$.pipe(
  15129. We((l) => {
  15130. if (!l)
  15131. return Ie(!0);
  15132. const a = i.getUnitId(), c = l.getSheetId(), d = r.get($), u = r.get(Ye), h = r.get(ft), m = mt(
  15133. u.ruleChange$,
  15134. h.ruleChange$,
  15135. d.selectionMoveEnd$
  15136. ).pipe(Vt(null));
  15137. return ot([m]).pipe(
  15138. _e(([f]) => {
  15139. var P;
  15140. const g = r.get($).getCurrentSelections(), p = g == null ? void 0 : g.map((E) => E.range);
  15141. if (!(p != null && p.length) || p.length > 1)
  15142. return !0;
  15143. const S = p[0];
  15144. if ((S == null ? void 0 : S.rangeType) === j.ALL || (S == null ? void 0 : S.rangeType) === j.COLUMN || (S == null ? void 0 : S.rangeType) === j.ROW)
  15145. return !0;
  15146. const b = h.getRule(a, c);
  15147. if (b != null && b.permissionId)
  15148. return ((P = t.getPermissionPoint(new Mm(a, c).id)) == null ? void 0 : P.value) === !1;
  15149. if (u.getSubunitRuleList(a, c).filter((E) => E.ranges.some((T) => ae.intersects(T, S))).length !== 1)
  15150. return !0;
  15151. const { startRow: _, endRow: R, startColumn: I, endColumn: y } = S, M = r.get(Vl);
  15152. for (let E = _; E <= R; E++)
  15153. for (let T = I; T <= y; T++) {
  15154. const A = M.getCellInfo(a, c, E, T);
  15155. if (A)
  15156. return A[ad.Delete] === !1;
  15157. }
  15158. return !1;
  15159. })
  15160. );
  15161. })
  15162. ) : Ie(!0))
  15163. );
  15164. }
  15165. function fg(r) {
  15166. var c;
  15167. const e = r.get(L), t = r.get($e), n = e.getCurrentTypeOfUnit$(O.UNIVER_SHEET), s = r.get(Dt), i = r.has(tt) ? r.get(tt) : null, l = r.get(Ne).subscribeContextValue$(Ht), a = (c = i == null ? void 0 : i.visible$) != null ? c : Ie(null);
  15168. return ot([n, s.currentUser$, a, l]).pipe(
  15169. We(([d, u, h, m]) => !d || h != null && h.visible && h.unitId === d.getUnitId() || m ? Ie(!0) : d.activeSheet$.pipe(
  15170. We((f) => {
  15171. var S, b;
  15172. if (!f)
  15173. return Ie(!0);
  15174. const g = d.getUnitId();
  15175. return ((b = (S = t.getPermissionPoint$(new q(g).id)) == null ? void 0 : S.pipe(_e((v) => !!v.value))) != null ? b : Ie(!1)).pipe(
  15176. _e((v) => !v)
  15177. );
  15178. })
  15179. ))
  15180. );
  15181. }
  15182. const Co = "sheet.contextMenu.permission";
  15183. function qR(r) {
  15184. return {
  15185. id: ta.id,
  15186. type: Q.BUTTON,
  15187. icon: Jf,
  15188. tooltip: "permission.toolbarMenu",
  15189. hidden$: oe(r, O.UNIVER_SHEET),
  15190. disabled$: mg(r)
  15191. };
  15192. }
  15193. function ja(r) {
  15194. return {
  15195. id: Co,
  15196. type: Q.SUBITEMS,
  15197. title: "rightClick.protectRange",
  15198. icon: $f,
  15199. hidden$: oe(r, O.UNIVER_SHEET)
  15200. };
  15201. }
  15202. function Xa(r) {
  15203. return {
  15204. id: es.id,
  15205. type: Q.BUTTON,
  15206. title: "rightClick.turnOnProtectRange",
  15207. hidden$: UR(r),
  15208. disabled$: mg(r)
  15209. };
  15210. }
  15211. function za(r) {
  15212. return {
  15213. id: rs.id,
  15214. type: Q.BUTTON,
  15215. title: "rightClick.editProtectRange",
  15216. disabled$: XR(r),
  15217. hidden$: jR(r)
  15218. };
  15219. }
  15220. function Ya(r) {
  15221. return {
  15222. id: ns.id,
  15223. type: Q.BUTTON,
  15224. title: "rightClick.removeProtectRange",
  15225. disabled$: GR(r),
  15226. hidden$: oe(r, O.UNIVER_SHEET)
  15227. };
  15228. }
  15229. function Za(r) {
  15230. return {
  15231. id: ts.id,
  15232. type: Q.BUTTON,
  15233. title: "rightClick.viewAllProtectArea",
  15234. disabled$: fg(r),
  15235. hidden$: oe(r, O.UNIVER_SHEET)
  15236. };
  15237. }
  15238. function QR(r) {
  15239. return {
  15240. id: na.id,
  15241. type: Q.BUTTON,
  15242. title: "sheetConfig.addProtectSheet",
  15243. disabled$: zR(r),
  15244. hidden$: oe(r, O.UNIVER_SHEET)
  15245. };
  15246. }
  15247. function KR(r) {
  15248. return {
  15249. id: oa.id,
  15250. type: Q.BUTTON,
  15251. title: "sheetConfig.removeProtectSheet",
  15252. disabled$: YR(r),
  15253. hidden$: oe(r, O.UNIVER_SHEET)
  15254. };
  15255. }
  15256. function JR(r) {
  15257. return {
  15258. id: la.id,
  15259. type: Q.BUTTON,
  15260. title: "sheetConfig.changeSheetPermission",
  15261. disabled$: ZR(r),
  15262. hidden$: oe(r, O.UNIVER_SHEET)
  15263. };
  15264. }
  15265. function $R(r) {
  15266. return {
  15267. id: ra.id,
  15268. type: Q.BUTTON,
  15269. title: "sheetConfig.viewAllProtectArea",
  15270. disabled$: fg(r),
  15271. hidden$: oe(r, O.UNIVER_SHEET)
  15272. };
  15273. }
  15274. function eI(r) {
  15275. const e = r.get(L), t = r.get(F), n = new it((i) => {
  15276. const o = t.onCommandExecuted((l) => {
  15277. const a = l.id;
  15278. (a === An.id || a === Nr.id || a === nr.id) && Go(e, i);
  15279. });
  15280. return Go(e, i), o.dispose;
  15281. }), s = Ts(r, [q, sC]);
  15282. return {
  15283. id: sa.id,
  15284. type: Q.BUTTON,
  15285. title: "sheetConfig.delete",
  15286. disabled$: ot([n, s]).pipe(
  15287. _e(([i, o]) => i || o)
  15288. ),
  15289. hidden$: oe(r, O.UNIVER_SHEET)
  15290. };
  15291. }
  15292. function tI(r) {
  15293. return {
  15294. id: Pm.id,
  15295. type: Q.BUTTON,
  15296. title: "sheetConfig.copy",
  15297. disabled$: Ts(r, [q, _m]),
  15298. hidden$: oe(r, O.UNIVER_SHEET)
  15299. };
  15300. }
  15301. function nI(r) {
  15302. return {
  15303. id: aa.id,
  15304. type: Q.BUTTON,
  15305. title: "sheetConfig.rename",
  15306. disabled$: Ts(r, [q, bm]),
  15307. hidden$: oe(r, O.UNIVER_SHEET)
  15308. };
  15309. }
  15310. function rI(r) {
  15311. return {
  15312. id: Em.id,
  15313. title: "sheetConfig.changeColor",
  15314. type: Q.SELECTOR,
  15315. selections: [
  15316. {
  15317. label: {
  15318. name: Fi,
  15319. hoverable: !1
  15320. }
  15321. }
  15322. ],
  15323. hidden$: Ts(r, [q])
  15324. };
  15325. }
  15326. function sI(r) {
  15327. const e = r.get(L), t = r.get(F);
  15328. return {
  15329. id: Tm.id,
  15330. type: Q.BUTTON,
  15331. title: "sheetConfig.hide",
  15332. disabled$: new it((n) => {
  15333. const s = t.onCommandExecuted((i) => {
  15334. const o = i.id;
  15335. (o === An.id || o === Nr.id || o === nr.id) && Go(e, n);
  15336. });
  15337. return Go(e, n), s.dispose;
  15338. }).pipe(
  15339. ir(Ts(r, [q, xm])),
  15340. _e(([n, s]) => n || s)
  15341. ),
  15342. hidden$: oe(r, O.UNIVER_SHEET)
  15343. };
  15344. }
  15345. function iI(r) {
  15346. const e = r.get(L), t = r.get(F);
  15347. return {
  15348. id: ia.id,
  15349. type: Q.BUTTON,
  15350. title: "sheetConfig.unhide",
  15351. disabled$: new it((n) => {
  15352. function s() {
  15353. const o = e.getCurrentUnitForType(O.UNIVER_SHEET).getWorksheets(), l = Array.from(o.values());
  15354. n.next(l.length === 1);
  15355. }
  15356. const i = t.onCommandExecuted((o) => {
  15357. const l = o.id;
  15358. (l === An.id || l === Nr.id || l === nr.id) && s();
  15359. });
  15360. return s(), i.dispose;
  15361. }).pipe(
  15362. ir(Ts(r, [q, xm])),
  15363. _e(([n, s]) => n || s)
  15364. ),
  15365. hidden$: oe(r, O.UNIVER_SHEET)
  15366. };
  15367. }
  15368. function Go(r, e) {
  15369. const t = r.getCurrentUnitForType(O.UNIVER_SHEET).getWorksheets(), n = Array.from(t.values()).filter(
  15370. (s) => s.getConfig().hidden === Qe.FALSE
  15371. );
  15372. e.next(n.length === 1);
  15373. }
  15374. const oI = {
  15375. [ha.FORMAT]: {
  15376. [Bi.id]: {
  15377. order: 0,
  15378. menuItemFactory: wb
  15379. },
  15380. [Rs.id]: {
  15381. order: 1,
  15382. menuItemFactory: Rb
  15383. },
  15384. [Is.id]: {
  15385. order: 2,
  15386. menuItemFactory: Ib
  15387. },
  15388. [ys.id]: {
  15389. order: 3,
  15390. menuItemFactory: yb
  15391. },
  15392. [Ms.id]: {
  15393. order: 4,
  15394. menuItemFactory: Mb
  15395. },
  15396. [zl.id]: {
  15397. order: 5,
  15398. menuItemFactory: Pb
  15399. },
  15400. [Xl.id]: {
  15401. order: 6,
  15402. menuItemFactory: Eb
  15403. },
  15404. [di.id]: {
  15405. order: 7,
  15406. menuItemFactory: xb,
  15407. [iC.id]: {
  15408. order: 0,
  15409. menuItemFactory: Tb
  15410. }
  15411. },
  15412. [Mo.id]: {
  15413. order: 9,
  15414. menuItemFactory: Ab,
  15415. [am.id]: {
  15416. order: 0,
  15417. menuItemFactory: Ob
  15418. }
  15419. },
  15420. [pc.id]: {
  15421. order: 10,
  15422. menuItemFactory: yR
  15423. }
  15424. },
  15425. [ha.LAYOUT]: {
  15426. [oC.id]: {
  15427. order: 0,
  15428. menuItemFactory: DR,
  15429. [lC.id]: {
  15430. order: 0,
  15431. menuItemFactory: LR
  15432. },
  15433. [aC.id]: {
  15434. order: 1,
  15435. menuItemFactory: WR
  15436. },
  15437. [cC.id]: {
  15438. order: 2,
  15439. menuItemFactory: BR
  15440. },
  15441. [ym.id]: {
  15442. order: 3,
  15443. menuItemFactory: FR
  15444. }
  15445. },
  15446. [lc.id]: {
  15447. order: 1,
  15448. menuItemFactory: Nb
  15449. },
  15450. [ac.id]: {
  15451. order: 1,
  15452. menuItemFactory: Hb
  15453. },
  15454. [cc.id]: {
  15455. order: 2,
  15456. menuItemFactory: Vb
  15457. },
  15458. [dc.id]: {
  15459. order: 3,
  15460. menuItemFactory: kb
  15461. }
  15462. },
  15463. [ha.OTHERS]: {
  15464. [ta.id]: {
  15465. order: 0,
  15466. menuItemFactory: qR
  15467. }
  15468. },
  15469. [Ct.MAIN_AREA]: {
  15470. [Ge.FORMAT]: {
  15471. [hn.name]: {
  15472. order: 0,
  15473. menuItemFactory: $r
  15474. },
  15475. // [SheetCutCommand.name]: {
  15476. // order: 1,
  15477. // menuItemFactory: CutMenuItemFactory,
  15478. // },
  15479. [mn.name]: {
  15480. order: 2,
  15481. menuItemFactory: wa
  15482. },
  15483. [go]: {
  15484. order: 3,
  15485. menuItemFactory: Ra,
  15486. [Gs.id]: {
  15487. order: 0,
  15488. menuItemFactory: Ia
  15489. },
  15490. [qs.id]: {
  15491. order: 1,
  15492. menuItemFactory: ya
  15493. },
  15494. [Jr.id]: {
  15495. order: 2,
  15496. menuItemFactory: Ma
  15497. },
  15498. [Qs.id]: {
  15499. order: 3,
  15500. menuItemFactory: Pa
  15501. }
  15502. },
  15503. [So]: {
  15504. order: 4,
  15505. menuItemFactory: Wa,
  15506. [Xs.id]: {
  15507. order: 0,
  15508. menuItemFactory: Ba
  15509. },
  15510. [zs.id]: {
  15511. order: 1,
  15512. menuItemFactory: Fa
  15513. },
  15514. [mo.id]: {
  15515. order: 2,
  15516. menuItemFactory: Ua
  15517. }
  15518. }
  15519. },
  15520. [Ge.LAYOUT]: {
  15521. order: 1,
  15522. [hg]: {
  15523. order: 0,
  15524. menuItemFactory: AR,
  15525. [Sc.id]: {
  15526. order: 0,
  15527. menuItemFactory: Sh
  15528. },
  15529. [Cc.id]: {
  15530. order: 1,
  15531. menuItemFactory: Ch
  15532. },
  15533. [zi.id]: {
  15534. order: 2,
  15535. menuItemFactory: VR
  15536. },
  15537. [fs.id]: {
  15538. order: 3,
  15539. menuItemFactory: kR
  15540. }
  15541. },
  15542. [cg]: {
  15543. order: 0,
  15544. menuItemFactory: MR,
  15545. [pi.id]: {
  15546. order: 0,
  15547. menuItemFactory: gh
  15548. },
  15549. [gi.id]: {
  15550. order: 1,
  15551. menuItemFactory: ph
  15552. },
  15553. [Xi.id]: {
  15554. order: 2,
  15555. menuItemFactory: PR
  15556. },
  15557. [ms.id]: {
  15558. order: 3,
  15559. menuItemFactory: ER
  15560. }
  15561. },
  15562. [Af]: {
  15563. order: 2,
  15564. menuItemFactory: Wb,
  15565. [$n.id]: {
  15566. order: 0,
  15567. menuItemFactory: Ea
  15568. },
  15569. [Gl.id]: {
  15570. order: 1,
  15571. menuItemFactory: Bb
  15572. },
  15573. [ql.id]: {
  15574. order: 2,
  15575. menuItemFactory: Fb
  15576. },
  15577. [ho.id]: {
  15578. order: 3,
  15579. menuItemFactory: Ta
  15580. }
  15581. },
  15582. [Co]: {
  15583. order: 3,
  15584. menuItemFactory: ja,
  15585. [es.id]: {
  15586. order: 0,
  15587. menuItemFactory: Xa
  15588. },
  15589. [rs.id]: {
  15590. order: 1,
  15591. menuItemFactory: za
  15592. },
  15593. [ns.id]: {
  15594. order: 2,
  15595. menuItemFactory: Ya
  15596. },
  15597. [ts.id]: {
  15598. order: 3,
  15599. menuItemFactory: Za
  15600. }
  15601. }
  15602. },
  15603. [Ge.DATA]: {
  15604. order: 2
  15605. },
  15606. [Ge.OTHERS]: {
  15607. order: 3
  15608. }
  15609. },
  15610. [Ct.COL_HEADER]: {
  15611. [Ge.FORMAT]: {
  15612. [hn.name]: {
  15613. order: 0,
  15614. menuItemFactory: $r
  15615. },
  15616. // [SheetCutCommand.name]: {
  15617. // order: 1,
  15618. // menuItemFactory: CutMenuItemFactory,
  15619. // },
  15620. [mn.name]: {
  15621. order: 2,
  15622. menuItemFactory: wa
  15623. },
  15624. [go]: {
  15625. order: 3,
  15626. menuItemFactory: Ra,
  15627. [Gs.id]: {
  15628. order: 0,
  15629. menuItemFactory: Ia
  15630. },
  15631. [qs.id]: {
  15632. order: 1,
  15633. menuItemFactory: ya
  15634. },
  15635. [Jr.id]: {
  15636. order: 2,
  15637. menuItemFactory: Ma
  15638. },
  15639. [Qs.id]: {
  15640. order: 3,
  15641. menuItemFactory: Pa
  15642. }
  15643. },
  15644. [So]: {
  15645. order: 4,
  15646. menuItemFactory: Wa,
  15647. [Xs.id]: {
  15648. order: 0,
  15649. menuItemFactory: Ba
  15650. },
  15651. [zs.id]: {
  15652. order: 1,
  15653. menuItemFactory: Fa
  15654. },
  15655. [mo.id]: {
  15656. order: 2,
  15657. menuItemFactory: Ua
  15658. }
  15659. }
  15660. },
  15661. [Ge.LAYOUT]: {
  15662. order: 1,
  15663. [dg]: {
  15664. order: 0,
  15665. menuItemFactory: xR,
  15666. [Cc.id]: {
  15667. order: 0,
  15668. menuItemFactory: Ch
  15669. },
  15670. [Im.id]: {
  15671. order: 1,
  15672. menuItemFactory: HR
  15673. }
  15674. },
  15675. [jl.id]: {
  15676. order: 1,
  15677. menuItemFactory: jb
  15678. },
  15679. [dm.id]: {
  15680. order: 2,
  15681. menuItemFactory: zb
  15682. },
  15683. [pi.id]: {
  15684. order: 2,
  15685. menuItemFactory: gh
  15686. },
  15687. [mm.id]: {
  15688. order: 3,
  15689. menuItemFactory: Zb
  15690. },
  15691. [Ql.id]: {
  15692. order: 4,
  15693. menuItemFactory: Lb
  15694. },
  15695. [Oc]: {
  15696. order: 5,
  15697. menuItemFactory: rh,
  15698. [$n.id]: {
  15699. order: 0,
  15700. menuItemFactory: Ea
  15701. },
  15702. [ho.id]: {
  15703. order: 3,
  15704. menuItemFactory: Ta
  15705. }
  15706. },
  15707. [Co]: {
  15708. order: 6,
  15709. menuItemFactory: ja,
  15710. [es.id]: {
  15711. order: 0,
  15712. menuItemFactory: Xa
  15713. },
  15714. [rs.id]: {
  15715. order: 1,
  15716. menuItemFactory: za
  15717. },
  15718. [ns.id]: {
  15719. order: 2,
  15720. menuItemFactory: Ya
  15721. },
  15722. [ts.id]: {
  15723. order: 3,
  15724. menuItemFactory: Za
  15725. }
  15726. }
  15727. },
  15728. [Ge.DATA]: {
  15729. order: 2
  15730. },
  15731. [Ge.OTHERS]: {
  15732. order: 3
  15733. }
  15734. },
  15735. [Ct.ROW_HEADER]: {
  15736. [Ge.FORMAT]: {
  15737. [hn.name]: {
  15738. order: 0,
  15739. menuItemFactory: $r
  15740. },
  15741. // [SheetCutCommand.name]: {
  15742. // order: 1,
  15743. // menuItemFactory: CutMenuItemFactory,
  15744. // },
  15745. [mn.name]: {
  15746. order: 2,
  15747. menuItemFactory: wa
  15748. },
  15749. [go]: {
  15750. order: 3,
  15751. menuItemFactory: Ra,
  15752. [Gs.id]: {
  15753. order: 0,
  15754. menuItemFactory: Ia
  15755. },
  15756. [qs.id]: {
  15757. order: 1,
  15758. menuItemFactory: ya
  15759. },
  15760. [Jr.id]: {
  15761. order: 2,
  15762. menuItemFactory: Ma
  15763. },
  15764. [Qs.id]: {
  15765. order: 3,
  15766. menuItemFactory: Pa
  15767. }
  15768. },
  15769. [So]: {
  15770. order: 4,
  15771. menuItemFactory: Wa,
  15772. [Xs.id]: {
  15773. order: 0,
  15774. menuItemFactory: Ba
  15775. },
  15776. [zs.id]: {
  15777. order: 1,
  15778. menuItemFactory: Fa
  15779. },
  15780. [mo.id]: {
  15781. order: 2,
  15782. menuItemFactory: Ua
  15783. }
  15784. }
  15785. },
  15786. [Ge.LAYOUT]: {
  15787. order: 1,
  15788. [ug]: {
  15789. order: 0,
  15790. menuItemFactory: OR,
  15791. [Sc.id]: {
  15792. order: 0,
  15793. menuItemFactory: Sh
  15794. },
  15795. [Rm.id]: {
  15796. order: 1,
  15797. menuItemFactory: NR
  15798. }
  15799. },
  15800. [gi.id]: {
  15801. order: 1,
  15802. menuItemFactory: ph
  15803. },
  15804. [Ul.id]: {
  15805. order: 2,
  15806. menuItemFactory: Ub
  15807. },
  15808. [cm.id]: {
  15809. order: 2,
  15810. menuItemFactory: Xb
  15811. },
  15812. [um.id]: {
  15813. order: 3,
  15814. menuItemFactory: Yb
  15815. },
  15816. [Pl.id]: {
  15817. order: 4,
  15818. menuItemFactory: Db
  15819. },
  15820. [Oc]: {
  15821. order: 5,
  15822. menuItemFactory: rh,
  15823. [$n.id]: {
  15824. order: 0,
  15825. menuItemFactory: Ea
  15826. },
  15827. [ho.id]: {
  15828. order: 3,
  15829. menuItemFactory: Ta
  15830. }
  15831. },
  15832. [Co]: {
  15833. order: 6,
  15834. menuItemFactory: ja,
  15835. [es.id]: {
  15836. order: 0,
  15837. menuItemFactory: Xa
  15838. },
  15839. [rs.id]: {
  15840. order: 1,
  15841. menuItemFactory: za
  15842. },
  15843. [ns.id]: {
  15844. order: 2,
  15845. menuItemFactory: Ya
  15846. },
  15847. [ts.id]: {
  15848. order: 3,
  15849. menuItemFactory: Za
  15850. }
  15851. }
  15852. },
  15853. [Ge.DATA]: {
  15854. order: 2
  15855. },
  15856. [Ge.OTHERS]: {
  15857. order: 3
  15858. }
  15859. },
  15860. [Ct.FOOTER_TABS]: {
  15861. [Ge.OTHERS]: {
  15862. order: 0,
  15863. [sa.id]: {
  15864. order: 0,
  15865. menuItemFactory: eI
  15866. },
  15867. [Pm.id]: {
  15868. order: 1,
  15869. menuItemFactory: tI
  15870. },
  15871. [aa.id]: {
  15872. order: 2,
  15873. menuItemFactory: nI
  15874. },
  15875. [Em.id]: {
  15876. order: 3,
  15877. menuItemFactory: rI
  15878. },
  15879. [Tm.id]: {
  15880. order: 4,
  15881. menuItemFactory: sI
  15882. },
  15883. // [SetWorksheetShowCommand.id]: {
  15884. // order: 5,
  15885. // menuItemFactory: UnHideSheetMenuItemFactory,
  15886. // },
  15887. [ia.id]: {
  15888. order: 6,
  15889. menuItemFactory: iI
  15890. },
  15891. [na.id]: {
  15892. order: 7,
  15893. menuItemFactory: QR
  15894. },
  15895. [oa.id]: {
  15896. order: 8,
  15897. menuItemFactory: KR
  15898. },
  15899. [la.id]: {
  15900. order: 9,
  15901. menuItemFactory: JR
  15902. },
  15903. [ra.id]: {
  15904. order: 10,
  15905. menuItemFactory: $R
  15906. }
  15907. }
  15908. },
  15909. [Ct.FOOTER_MENU]: {
  15910. [Ge.OTHERS]: {
  15911. [wm.id]: {
  15912. order: 1,
  15913. menuItemFactory: TR
  15914. }
  15915. }
  15916. }
  15917. }, gg = {
  15918. id: sm.id,
  15919. // when focusing on any other input tag do not trigger this shortcut
  15920. preconditions: (r) => De(r),
  15921. binding: Z.Digit9 | ye.CTRL_COMMAND
  15922. }, pg = {
  15923. id: im.id,
  15924. // when focusing on any other input tag do not trigger this shortcut
  15925. preconditions: (r) => De(r),
  15926. binding: Z.Digit0 | ye.CTRL_COMMAND | ye.SHIFT
  15927. }, Sg = {
  15928. id: Lt.id,
  15929. description: "shortcut.sheet.select-below-cell",
  15930. group: "3_sheet-view",
  15931. binding: Z.ARROW_DOWN,
  15932. priority: 100,
  15933. preconditions: De,
  15934. staticParameters: {
  15935. direction: B.DOWN
  15936. }
  15937. }, Cg = {
  15938. id: Lt.id,
  15939. description: "shortcut.sheet.select-up-cell",
  15940. group: "3_sheet-view",
  15941. binding: Z.ARROW_UP,
  15942. priority: 100,
  15943. preconditions: De,
  15944. staticParameters: {
  15945. direction: B.UP
  15946. }
  15947. }, vg = {
  15948. id: Lt.id,
  15949. description: "shortcut.sheet.select-left-cell",
  15950. group: "3_sheet-view",
  15951. binding: Z.ARROW_LEFT,
  15952. priority: 100,
  15953. preconditions: cf,
  15954. staticParameters: {
  15955. direction: B.LEFT
  15956. }
  15957. }, bg = {
  15958. id: Lt.id,
  15959. description: "shortcut.sheet.select-right-cell",
  15960. group: "3_sheet-view",
  15961. binding: Z.ARROW_RIGHT,
  15962. priority: 100,
  15963. preconditions: cf,
  15964. staticParameters: {
  15965. direction: B.RIGHT
  15966. }
  15967. }, _g = {
  15968. id: Fn.id,
  15969. description: "shortcut.sheet.select-next-cell",
  15970. group: "3_sheet-view",
  15971. binding: Z.TAB,
  15972. priority: 100,
  15973. preconditions: De,
  15974. staticParameters: {
  15975. direction: B.RIGHT,
  15976. keycode: Z.TAB
  15977. }
  15978. }, wg = {
  15979. id: Fn.id,
  15980. description: "shortcut.sheet.select-previous-cell",
  15981. group: "3_sheet-view",
  15982. binding: Z.TAB | ye.SHIFT,
  15983. priority: 100,
  15984. preconditions: De,
  15985. staticParameters: {
  15986. direction: B.LEFT,
  15987. keycode: Z.TAB
  15988. }
  15989. }, Rg = {
  15990. id: Fn.id,
  15991. description: "shortcut.sheet.select-below-cell",
  15992. group: "3_sheet-view",
  15993. binding: Z.ENTER,
  15994. priority: 100,
  15995. preconditions: De,
  15996. staticParameters: {
  15997. direction: B.DOWN,
  15998. keycode: Z.ENTER
  15999. }
  16000. }, Ig = {
  16001. id: Fn.id,
  16002. description: "shortcut.sheet.select-up-cell",
  16003. group: "3_sheet-view",
  16004. binding: Z.ENTER | ye.SHIFT,
  16005. priority: 100,
  16006. preconditions: De,
  16007. staticParameters: {
  16008. direction: B.UP,
  16009. keycode: Z.ENTER
  16010. }
  16011. }, yg = {
  16012. id: Lt.id,
  16013. description: "shortcut.sheet.select-below-value-cell",
  16014. group: "3_sheet-view",
  16015. binding: Z.ARROW_DOWN | ye.CTRL_COMMAND,
  16016. preconditions: De,
  16017. staticParameters: {
  16018. direction: B.DOWN,
  16019. jumpOver: Bn.moveGap
  16020. }
  16021. }, Mg = {
  16022. id: Lt.id,
  16023. description: "shortcut.sheet.select-up-value-cell",
  16024. group: "3_sheet-view",
  16025. binding: Z.ARROW_UP | ye.CTRL_COMMAND,
  16026. preconditions: De,
  16027. staticParameters: {
  16028. direction: B.UP,
  16029. jumpOver: Bn.moveGap
  16030. }
  16031. }, Pg = {
  16032. id: Lt.id,
  16033. description: "shortcut.sheet.select-left-value-cell",
  16034. group: "3_sheet-view",
  16035. binding: Z.ARROW_LEFT | ye.CTRL_COMMAND,
  16036. preconditions: De,
  16037. staticParameters: {
  16038. direction: B.LEFT,
  16039. jumpOver: Bn.moveGap
  16040. }
  16041. }, Eg = {
  16042. id: Lt.id,
  16043. description: "shortcut.sheet.select-right-value-cell",
  16044. group: "3_sheet-view",
  16045. binding: Z.ARROW_RIGHT | ye.CTRL_COMMAND,
  16046. preconditions: De,
  16047. staticParameters: {
  16048. direction: B.RIGHT,
  16049. jumpOver: Bn.moveGap
  16050. }
  16051. }, Tg = {
  16052. id: Gt.id,
  16053. description: "shortcut.sheet.expand-selection-down",
  16054. group: "3_sheet-view",
  16055. binding: Z.ARROW_DOWN | ye.SHIFT,
  16056. preconditions: De,
  16057. staticParameters: {
  16058. direction: B.DOWN
  16059. }
  16060. }, xg = {
  16061. id: Gt.id,
  16062. description: "shortcut.sheet.expand-selection-up",
  16063. group: "3_sheet-view",
  16064. binding: Z.ARROW_UP | ye.SHIFT,
  16065. preconditions: De,
  16066. staticParameters: {
  16067. direction: B.UP
  16068. }
  16069. }, Og = {
  16070. id: Gt.id,
  16071. description: "shortcut.sheet.expand-selection-left",
  16072. group: "3_sheet-view",
  16073. binding: Z.ARROW_LEFT | ye.SHIFT,
  16074. preconditions: De,
  16075. staticParameters: {
  16076. direction: B.LEFT
  16077. }
  16078. }, Ag = {
  16079. id: Gt.id,
  16080. description: "shortcut.sheet.expand-selection-right",
  16081. group: "3_sheet-view",
  16082. binding: Z.ARROW_RIGHT | ye.SHIFT,
  16083. preconditions: De,
  16084. staticParameters: {
  16085. direction: B.RIGHT
  16086. }
  16087. }, Ng = {
  16088. id: Gt.id,
  16089. description: "shortcut.sheet.expand-selection-to-below-gap",
  16090. group: "3_sheet-view",
  16091. binding: Z.ARROW_DOWN | ye.SHIFT | ye.CTRL_COMMAND,
  16092. preconditions: De,
  16093. staticParameters: {
  16094. direction: B.DOWN,
  16095. jumpOver: Bn.moveGap
  16096. }
  16097. }, Hg = {
  16098. id: Gt.id,
  16099. description: "shortcut.sheet.expand-selection-to-up-gap",
  16100. group: "3_sheet-view",
  16101. binding: Z.ARROW_UP | ye.SHIFT | ye.CTRL_COMMAND,
  16102. preconditions: De,
  16103. staticParameters: {
  16104. direction: B.UP,
  16105. jumpOver: Bn.moveGap
  16106. }
  16107. }, Vg = {
  16108. id: Gt.id,
  16109. description: "shortcut.sheet.expand-selection-to-left-gap",
  16110. group: "3_sheet-view",
  16111. binding: Z.ARROW_LEFT | ye.SHIFT | ye.CTRL_COMMAND,
  16112. preconditions: De,
  16113. staticParameters: {
  16114. direction: B.LEFT,
  16115. jumpOver: Bn.moveGap
  16116. }
  16117. }, kg = {
  16118. id: Gt.id,
  16119. description: "shortcut.sheet.expand-selection-to-right-gap",
  16120. group: "3_sheet-view",
  16121. binding: Z.ARROW_RIGHT | ye.SHIFT | ye.CTRL_COMMAND,
  16122. preconditions: De,
  16123. staticParameters: {
  16124. direction: B.RIGHT,
  16125. jumpOver: Bn.moveGap
  16126. }
  16127. }, Dg = {
  16128. id: Vd.id,
  16129. description: "shortcut.sheet.select-all",
  16130. group: "3_sheet-view",
  16131. binding: Z.A | ye.CTRL_COMMAND,
  16132. preconditions: De,
  16133. staticParameters: {
  16134. expandToGapFirst: !0,
  16135. loop: !0
  16136. }
  16137. }, Lg = {
  16138. id: Rs.id,
  16139. description: "shortcut.sheet.set-bold",
  16140. group: "4_sheet-edit",
  16141. preconditions: (r) => De(r),
  16142. binding: Z.B | ye.CTRL_COMMAND
  16143. }, Wg = {
  16144. id: Is.id,
  16145. description: "shortcut.sheet.set-italic",
  16146. group: "4_sheet-edit",
  16147. preconditions: (r) => De(r),
  16148. binding: Z.I | ye.CTRL_COMMAND
  16149. }, Bg = {
  16150. id: ys.id,
  16151. description: "shortcut.sheet.set-underline",
  16152. group: "4_sheet-edit",
  16153. preconditions: (r) => De(r),
  16154. binding: Z.U | ye.CTRL_COMMAND
  16155. }, Fg = {
  16156. id: Ms.id,
  16157. description: "shortcut.sheet.set-strike-through",
  16158. group: "4_sheet-edit",
  16159. preconditions: (r) => De(r),
  16160. binding: Z.X | ye.SHIFT | ye.CTRL_COMMAND
  16161. }, Ug = {
  16162. id: Xs.id,
  16163. // when focusing on any other input tag do not trigger this shortcut
  16164. preconditions: (r) => De(r),
  16165. binding: Z.DELETE,
  16166. mac: Z.BACKSPACE
  16167. }, jg = {
  16168. id: Li.id,
  16169. description: "shortcut.sheet.zoom-in",
  16170. binding: Z.EQUAL | ye.CTRL_COMMAND,
  16171. group: "3_sheet-view",
  16172. preconditions: De,
  16173. priority: 1,
  16174. staticParameters: {
  16175. delta: 0.2
  16176. }
  16177. }, Xg = {
  16178. id: td.id,
  16179. binding: Z.EQUAL | ye.CTRL_COMMAND
  16180. }, zg = {
  16181. id: Li.id,
  16182. description: "shortcut.sheet.zoom-out",
  16183. binding: Z.MINUS | ye.CTRL_COMMAND,
  16184. group: "3_sheet-view",
  16185. preconditions: De,
  16186. priority: 1,
  16187. staticParameters: {
  16188. delta: -0.2
  16189. }
  16190. }, Yg = {
  16191. id: td.id,
  16192. binding: Z.MINUS | ye.CTRL_COMMAND
  16193. }, Zg = {
  16194. id: Li.id,
  16195. description: "shortcut.sheet.reset-zoom",
  16196. binding: Z.Digit0 | ye.CTRL_COMMAND,
  16197. preconditions: De,
  16198. group: "3_sheet-view",
  16199. priority: 1,
  16200. staticParameters: {
  16201. reset: !0
  16202. }
  16203. }, Gg = {
  16204. id: td.id,
  16205. binding: Z.Digit0 | ye.CTRL_COMMAND
  16206. };
  16207. var lI = Object.defineProperty, aI = Object.getOwnPropertyDescriptor, cI = (r, e, t, n) => {
  16208. for (var s = n > 1 ? void 0 : n ? aI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  16209. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  16210. return n && s && lI(e, t, s), s;
  16211. }, Xn = (r, e) => (t, n) => e(t, n, r);
  16212. let qo = class extends ce {
  16213. constructor(r, e, t, n, s, i, o, l) {
  16214. super(), this._injector = r, this._componentManager = e, this._layoutService = t, this._commandService = n, this._shortcutService = s, this._menuManagerService = i, this._uiPartsService = o, this._configService = l, this._init();
  16215. }
  16216. _init() {
  16217. this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcuts(), this._initWorkbenchParts(), this._initFocusHandler();
  16218. }
  16219. _initComponents() {
  16220. const r = this._componentManager;
  16221. this.disposeWithMe(r.register(Kl, Ef)), this.disposeWithMe(r.register($d, rg)), this.disposeWithMe(r.register(Fi, Md)), this.disposeWithMe(r.register(Fd, Jh)), this.disposeWithMe(r.register(Ud, $h)), this.disposeWithMe(r.register(jd, em)), this.disposeWithMe(r.register(Si, ig)), this.disposeWithMe(r.register("HideGridlines", Ff));
  16222. }
  16223. _initCommands() {
  16224. [
  16225. Gd,
  16226. or,
  16227. Qd,
  16228. qd,
  16229. Li,
  16230. Gt,
  16231. Lt,
  16232. Fn,
  16233. aa,
  16234. sa,
  16235. gi,
  16236. pi,
  16237. Ul,
  16238. jl,
  16239. un,
  16240. of,
  16241. Vd,
  16242. Kd,
  16243. ud,
  16244. cs,
  16245. Et,
  16246. Wl,
  16247. Rs,
  16248. Is,
  16249. ys,
  16250. Ms,
  16251. yf,
  16252. Mf,
  16253. Xl,
  16254. zl,
  16255. di,
  16256. Pf,
  16257. hd,
  16258. fd,
  16259. pd,
  16260. gd,
  16261. Yl,
  16262. Bd,
  16263. Bi,
  16264. Zl,
  16265. dn,
  16266. li,
  16267. $n,
  16268. Gl,
  16269. ql,
  16270. lf,
  16271. md,
  16272. Wi,
  16273. $t,
  16274. ia,
  16275. Ll,
  16276. fs,
  16277. ms,
  16278. zi,
  16279. Xi,
  16280. Jd,
  16281. pr,
  16282. si,
  16283. // permission
  16284. Vn,
  16285. tg,
  16286. ta,
  16287. es,
  16288. ts,
  16289. na,
  16290. ra,
  16291. la,
  16292. ns,
  16293. rs,
  16294. oa,
  16295. Ql
  16296. ].forEach((r) => {
  16297. this.disposeWithMe(this._commandService.registerCommand(r));
  16298. });
  16299. }
  16300. _initMenus() {
  16301. this._menuManagerService.mergeMenu(oI);
  16302. }
  16303. _initShortcuts() {
  16304. [
  16305. // selection shortcuts
  16306. Sg,
  16307. Cg,
  16308. vg,
  16309. bg,
  16310. _g,
  16311. wg,
  16312. Rg,
  16313. Ig,
  16314. // MoveBackSelectionShortcutItem,
  16315. yg,
  16316. Mg,
  16317. Pg,
  16318. Eg,
  16319. Tg,
  16320. xg,
  16321. Og,
  16322. Ag,
  16323. Ng,
  16324. Hg,
  16325. Vg,
  16326. kg,
  16327. Dg,
  16328. // view shortcuts
  16329. jg,
  16330. zg,
  16331. Zg,
  16332. Gg,
  16333. Xg,
  16334. Yg,
  16335. // toggle cell style shortcuts
  16336. Lg,
  16337. Wg,
  16338. Bg,
  16339. Fg,
  16340. // cell content editing shortcuts
  16341. Ug,
  16342. ...hf(),
  16343. ff,
  16344. mf,
  16345. gf,
  16346. Sf,
  16347. Cf,
  16348. vf,
  16349. pf,
  16350. // operation shortcuts
  16351. gg,
  16352. pg
  16353. ].forEach((r) => {
  16354. this.disposeWithMe(this._shortcutService.registerShortcut(r));
  16355. });
  16356. }
  16357. _initWorkbenchParts() {
  16358. const r = this._uiPartsService, e = this._injector, t = this._configService.getConfig(Pr);
  16359. (t == null ? void 0 : t.formulaBar) !== !1 && this.disposeWithMe(r.registerComponent(js.HEADER, () => Qr(RR, e))), this.disposeWithMe(r.registerComponent(js.FOOTER, () => Qr(wR, e))), this.disposeWithMe(r.registerComponent(js.CONTENT, () => Qr(IR, e)));
  16360. }
  16361. _initFocusHandler() {
  16362. this.disposeWithMe(
  16363. this._layoutService.registerFocusHandler(O.UNIVER_SHEET, (r) => {
  16364. const t = this._injector.get(Ce).getCurrentTypeOfRenderer(O.UNIVER_DOC), n = t == null ? void 0 : t.with(Sr);
  16365. n == null || n.focus();
  16366. })
  16367. );
  16368. }
  16369. };
  16370. qo = cI([
  16371. Xn(0, D(vt)),
  16372. Xn(1, D(Dn)),
  16373. Xn(2, _l),
  16374. Xn(3, F),
  16375. Xn(4, Il),
  16376. Xn(5, id),
  16377. Xn(6, yl),
  16378. Xn(7, xr)
  16379. ], qo);
  16380. const dI = (r = []) => {
  16381. const e = W(ws);
  16382. be(() => {
  16383. const t = r.map((n) => e.addShape({
  16384. range: n,
  16385. style: {
  16386. fill: "rgba(73, 184, 17, 0.05)",
  16387. strokeWidth: 1,
  16388. stroke: "#49B811",
  16389. widgets: {}
  16390. },
  16391. primary: {
  16392. startColumn: n.startColumn,
  16393. endColumn: n.endColumn,
  16394. startRow: n.startRow,
  16395. endRow: n.endRow,
  16396. actualRow: n.startRow,
  16397. actualColumn: n.startColumn,
  16398. isMerged: !1,
  16399. isMergedMainCell: !1
  16400. }
  16401. }));
  16402. return () => {
  16403. t.forEach((n) => {
  16404. n && e.removeShape(n);
  16405. });
  16406. };
  16407. }, [r]);
  16408. };
  16409. var uI = Object.defineProperty, hI = Object.getOwnPropertyDescriptor, mI = (r, e, t, n) => {
  16410. for (var s = n > 1 ? void 0 : n ? hI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  16411. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  16412. return n && s && uI(e, t, s), s;
  16413. }, vh = (r, e) => (t, n) => e(t, n, r);
  16414. let Ci = class extends ce {
  16415. constructor(e, t) {
  16416. super();
  16417. w(this, "_previousSheetIndex", -1);
  16418. this._commandService = e, this._univerInstanceService = t, this.disposeWithMe(this._commandService.beforeCommandExecuted((n) => {
  16419. if (n.id === An.id)
  16420. return this._beforeAdjustActiveSheetOnRemoveSheet(
  16421. n
  16422. );
  16423. })), this.disposeWithMe(this._commandService.onCommandExecuted((n, s) => {
  16424. if (n.id === An.id)
  16425. return this._adjustActiveSheetOnRemoveSheet(n);
  16426. if (n.id === nr.id && n.params.hidden)
  16427. return this._adjustActiveSheetOnHideSheet(n);
  16428. if (s != null && s.fromCollab) return !1;
  16429. if (n.id === Nr.id)
  16430. return this._adjustActiveSheetOnInsertSheet(n);
  16431. if (n.id === nr.id && !n.params.hidden)
  16432. return this._adjustActiveSheetOnShowSheet(n);
  16433. if (n.id === He.id)
  16434. return this._adjustActiveSheetOnSelection(n);
  16435. }));
  16436. }
  16437. _adjustActiveSheetOnHideSheet(e) {
  16438. var a;
  16439. const { unitId: t, subUnitId: n } = e.params, s = this._univerInstanceService.getUniverSheetInstance(t);
  16440. if (!s || ((a = s.getActiveSheet()) == null ? void 0 : a.getSheetId()) !== n)
  16441. return;
  16442. const o = s.getActiveSheetIndex(), l = bh(s, o);
  16443. this._switchToNextSheet(t, l);
  16444. }
  16445. _beforeAdjustActiveSheetOnRemoveSheet(e) {
  16446. const { unitId: t, subUnitId: n } = e.params, s = this._univerInstanceService.getUniverSheetInstance(t);
  16447. if (!s)
  16448. return;
  16449. const i = s.getSheetBySheetId(n);
  16450. i && (this._previousSheetIndex = s.getSheetIndex(i));
  16451. }
  16452. _adjustActiveSheetOnRemoveSheet(e) {
  16453. if (this._previousSheetIndex === -1)
  16454. return;
  16455. const { unitId: t } = e.params, n = this._univerInstanceService.getUniverSheetInstance(t);
  16456. if (!n)
  16457. return;
  16458. if (n.getActiveSheet().getSheetId() === e.params.subUnitId) {
  16459. const i = this._previousSheetIndex, o = i >= 1 ? i - 1 : 0, l = bh(n, o);
  16460. this._switchToNextSheet(t, l);
  16461. }
  16462. }
  16463. _adjustActiveSheetOnInsertSheet(e) {
  16464. const { unitId: t, sheet: n } = e.params;
  16465. this._switchToNextSheet(t, n.id);
  16466. }
  16467. _adjustActiveSheetOnShowSheet(e) {
  16468. const { unitId: t, subUnitId: n } = e.params;
  16469. this._switchToNextSheet(t, n);
  16470. }
  16471. _adjustActiveSheetOnSelection(e) {
  16472. var s;
  16473. const { unitId: t, subUnitId: n } = e.params;
  16474. n !== ((s = this._univerInstanceService.getUnit(t)) == null ? void 0 : s.getActiveSheet().getSheetId()) && this._switchToNextSheet(t, n);
  16475. }
  16476. _switchToNextSheet(e, t) {
  16477. this._commandService.executeCommand(et.id, {
  16478. unitId: e,
  16479. subUnitId: t
  16480. });
  16481. }
  16482. };
  16483. Ci = mI([
  16484. vh(0, F),
  16485. vh(1, L)
  16486. ], Ci);
  16487. function bh(r, e) {
  16488. const t = r.getSheetSize();
  16489. for (let n = e; n > -1; n--) {
  16490. const s = r.getSheetByIndex(n);
  16491. if (!s.getConfig().hidden)
  16492. return s.getSheetId();
  16493. }
  16494. for (let n = e; n < t; n++) {
  16495. const s = r.getSheetByIndex(n);
  16496. if (!s.getConfig().hidden)
  16497. return s.getSheetId();
  16498. }
  16499. throw new Error(
  16500. "[ActiveWorksheetController]: could not find the next unhidden sheet! Collaboration error perhaps."
  16501. );
  16502. }
  16503. var fI = Object.defineProperty, gI = Object.getOwnPropertyDescriptor, pI = (r, e, t, n) => {
  16504. for (var s = n > 1 ? void 0 : n ? gI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  16505. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  16506. return n && s && fI(e, t, s), s;
  16507. }, dr = (r, e) => (t, n) => e(t, n, r);
  16508. let vi = class extends ce {
  16509. constructor(e, t, n, s, i, o, l) {
  16510. super();
  16511. // the DrawingTypeEnum should refer from drawing package, here we just use type, so no need to import the drawing package
  16512. w(this, "_popupMenuFeatureMap", /* @__PURE__ */ new Map());
  16513. w(this, "_isSelectionMoving", !1);
  16514. this._globalPopupManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._refRangeService = s, this._commandService = i, this._refSelectionsService = o, this._selectionManagerService = l, this._initMoving();
  16515. }
  16516. _initMoving() {
  16517. this.disposeWithMe(
  16518. this._refSelectionsService.selectionMoving$.subscribe(() => {
  16519. this._isSelectionMoving = !0;
  16520. })
  16521. ), this.disposeWithMe(
  16522. this._refSelectionsService.selectionMoveEnd$.subscribe(() => {
  16523. this._isSelectionMoving = !1;
  16524. })
  16525. ), this.disposeWithMe(
  16526. this._selectionManagerService.selectionMoving$.subscribe(() => {
  16527. this._isSelectionMoving = !0;
  16528. })
  16529. ), this.disposeWithMe(
  16530. this._selectionManagerService.selectionMoveEnd$.subscribe(() => {
  16531. this._isSelectionMoving = !1;
  16532. })
  16533. );
  16534. }
  16535. /**
  16536. * Register a feature menu callback for a specific drawing type.such as image, chart, etc.
  16537. */
  16538. registerFeatureMenu(e, t) {
  16539. this._popupMenuFeatureMap.set(e, t);
  16540. }
  16541. /**
  16542. * Get the feature menu by drawing type, the function should be called when a drawing element need trigger popup menu, so the unitId, subUnitId, drawingId should be provided.
  16543. * @param {string} unitId the unit id
  16544. * @param {string} subUnitId the sub unit id
  16545. * @param {string} drawingId the drawing id
  16546. * @param {DrawingTypeEnum} drawingType the feature type
  16547. * @returns the feature menu if it exists, otherwise return undefined
  16548. */
  16549. getFeatureMenu(e, t, n, s) {
  16550. const i = this._popupMenuFeatureMap.get(s);
  16551. if (i)
  16552. return i(e, t, n, s);
  16553. }
  16554. dispose() {
  16555. super.dispose(), this._popupMenuFeatureMap.clear();
  16556. }
  16557. _createHiddenRectObserver(e) {
  16558. const { row: t, column: n, worksheet: s, skeleton: i, currentRender: o } = e, l = () => {
  16559. var N, X;
  16560. const u = s.getFreeze(), { startRow: h, startColumn: m, xSplit: f, ySplit: g } = u, p = h - g, S = m - f, { rowHeightAccumulation: b, columnWidthAccumulation: v, rowHeaderWidth: _, columnHeaderHeight: R } = i, I = _ + (S === -1 ? 0 : v[S + f - 1] - ((N = v[S - 1]) != null ? N : 0)), y = R + (p === -1 ? 0 : b[p + g - 1] - ((X = b[p]) != null ? X : 0)), M = o.engine.getCanvasElement(), P = M.getBoundingClientRect(), E = Ga(M.style.width), T = P.width / E, A = o.scene.getAncestorScale().scaleX, H = I * T * A, x = y * T * A, k = {
  16561. left: -1 / 0,
  16562. top: -1 / 0,
  16563. right: P.left + H,
  16564. bottom: P.top + x
  16565. }, U = {
  16566. left: P.left + H,
  16567. top: -1 / 0,
  16568. right: 1 / 0,
  16569. bottom: P.top + x
  16570. }, V = {
  16571. left: -1 / 0,
  16572. top: P.top + x,
  16573. right: P.left + H,
  16574. bottom: 1 / 0
  16575. };
  16576. return t < h && n < m ? [] : t < h ? [k] : n < m ? [k] : [k, U, V];
  16577. }, a = l(), c = new Me(a), d = new St();
  16578. return d.add(this._commandService.onCommandExecuted((u) => {
  16579. if (u.id === vr.id) {
  16580. const h = l();
  16581. c.next(h);
  16582. }
  16583. })), {
  16584. rects$: c,
  16585. disposable: d
  16586. };
  16587. }
  16588. // #region attach to object
  16589. // Unlike _createCellPositionObserver, this bind to a certain position.
  16590. _createPositionObserver(e, t, n, s) {
  16591. const i = () => {
  16592. const { scene: c } = t, d = Q_(e, c, n, s), u = t.engine.getCanvasElement(), h = u.getBoundingClientRect(), m = Ga(u.style.width), f = h.width / m;
  16593. return {
  16594. left: d.left * f + h.left,
  16595. right: d.right * f + h.left,
  16596. top: d.top * f + h.top,
  16597. bottom: d.bottom * f + h.top
  16598. };
  16599. }, o = i(), l = new Me(o), a = new St();
  16600. return a.add(this._commandService.onCommandExecuted((c) => {
  16601. (c.id === dn.id || c.id === $t.id) && l.next(i());
  16602. })), {
  16603. position: o,
  16604. position$: l,
  16605. disposable: a
  16606. };
  16607. }
  16608. /**
  16609. * attach a popup to canvas object
  16610. * @param targetObject target canvas object
  16611. * @param popup popup item
  16612. * @returns disposable
  16613. */
  16614. attachPopupToObject(e, t) {
  16615. var b;
  16616. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), s = n.getActiveSheet();
  16617. if (!s || this._isSelectionMoving && !t.showOnSelectionMoving)
  16618. return {
  16619. dispose: () => {
  16620. },
  16621. canDispose: () => !0
  16622. };
  16623. const i = n.getUnitId(), o = s.getSheetId(), l = (b = this._renderManagerService.getRenderById(i)) == null ? void 0 : b.with(me).getOrCreateSkeleton({
  16624. sheetId: o
  16625. }), a = this._renderManagerService.getRenderById(i);
  16626. if (!a || !l)
  16627. return {
  16628. dispose: () => {
  16629. },
  16630. canDispose: () => !0
  16631. };
  16632. const { left: c, top: d, width: u, height: h } = e, m = {
  16633. left: c,
  16634. right: c + u,
  16635. top: d,
  16636. bottom: d + h
  16637. }, { position: f, position$: g, disposable: p } = this._createPositionObserver(m, a, l, s), S = this._globalPopupManagerService.addPopup({
  16638. ...t,
  16639. unitId: i,
  16640. subUnitId: o,
  16641. anchorRect: f,
  16642. anchorRect$: g,
  16643. canvasElement: a.engine.getCanvasElement()
  16644. });
  16645. return {
  16646. dispose: () => {
  16647. this._globalPopupManagerService.removePopup(S), g.complete(), p.dispose();
  16648. },
  16649. canDispose: () => this._globalPopupManagerService.activePopupId !== S
  16650. };
  16651. }
  16652. // #endregion
  16653. // #region attach to position
  16654. attachPopupByPosition(e, t, n) {
  16655. var p;
  16656. const s = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), i = s.getActiveSheet();
  16657. if (!i)
  16658. return null;
  16659. const o = s.getUnitId(), l = i.getSheetId();
  16660. if (o !== n.unitId || n.subUnitId !== l)
  16661. return null;
  16662. if (this._isSelectionMoving && !t.showOnSelectionMoving)
  16663. return;
  16664. const a = (p = this._renderManagerService.getRenderById(o)) == null ? void 0 : p.with(me).getOrCreateSkeleton({
  16665. sheetId: l
  16666. }), c = this._renderManagerService.getRenderById(o);
  16667. if (!c || !a)
  16668. return null;
  16669. const { position: d, position$: u, disposable: h } = this._createPositionObserver(e, c, a, i), { rects$: m, disposable: f } = this._createHiddenRectObserver({
  16670. row: n.row,
  16671. column: n.col,
  16672. worksheet: i,
  16673. skeleton: a,
  16674. currentRender: c
  16675. }), g = this._globalPopupManagerService.addPopup({
  16676. ...t,
  16677. unitId: o,
  16678. subUnitId: l,
  16679. anchorRect: d,
  16680. anchorRect$: u,
  16681. hiddenRects$: m,
  16682. canvasElement: c.engine.getCanvasElement()
  16683. });
  16684. return {
  16685. dispose: () => {
  16686. this._globalPopupManagerService.removePopup(g), u.complete(), h.dispose(), f.dispose();
  16687. },
  16688. canDispose: () => this._globalPopupManagerService.activePopupId !== g
  16689. };
  16690. }
  16691. // #endregion
  16692. // #region attach to absolute position
  16693. attachPopupToAbsolutePosition(e, t, n, s) {
  16694. var m;
  16695. const i = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), o = i.getActiveSheet();
  16696. if (!o)
  16697. return null;
  16698. const l = i.getUnitId(), a = o.getSheetId();
  16699. if (n && l !== n || s && s !== a)
  16700. return null;
  16701. const c = (m = this._renderManagerService.getRenderById(l)) == null ? void 0 : m.with(me).getOrCreateSkeleton({
  16702. sheetId: a
  16703. }), d = this._renderManagerService.getRenderById(l);
  16704. if (!d || !c)
  16705. return null;
  16706. if (this._isSelectionMoving && !t.showOnSelectionMoving)
  16707. return;
  16708. const u = new Me(e), h = this._globalPopupManagerService.addPopup({
  16709. ...t,
  16710. unitId: l,
  16711. subUnitId: a,
  16712. anchorRect: e,
  16713. anchorRect$: u.asObservable(),
  16714. canvasElement: d.engine.getCanvasElement()
  16715. });
  16716. return {
  16717. dispose: () => {
  16718. this._globalPopupManagerService.removePopup(h), u.complete();
  16719. },
  16720. canDispose: () => this._globalPopupManagerService.activePopupId !== h
  16721. };
  16722. }
  16723. // #endregion
  16724. // #region attach to cell
  16725. /**
  16726. * Bind popup to the right part of cell at(row, col).
  16727. * This popup would move with the cell.
  16728. * @param row
  16729. * @param col
  16730. * @param popup
  16731. * @param _unitId
  16732. * @param _subUnitId
  16733. * @param viewport
  16734. * @returns
  16735. */
  16736. attachPopupToCell(e, t, n, s, i, o) {
  16737. const l = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), a = l.getActiveSheet();
  16738. if (!a)
  16739. return null;
  16740. const c = l.getUnitId(), d = a.getSheetId();
  16741. if (s && c !== s || i && d !== i)
  16742. return null;
  16743. const u = this._renderManagerService.getRenderById(c), h = u == null ? void 0 : u.with(me).getOrCreateSkeleton({
  16744. sheetId: d
  16745. }), m = u == null ? void 0 : u.with(dt);
  16746. if (!u || !h || !m)
  16747. return null;
  16748. if (this._isSelectionMoving && !n.showOnSelectionMoving)
  16749. return;
  16750. const f = o != null ? o : lh(e, t, u.scene, a);
  16751. if (!f)
  16752. return null;
  16753. const { position: g, position$: p, disposable: S, updateRowCol: b } = this._createCellPositionObserver(e, t, u, h, f), { rects$: v, disposable: _ } = this._createHiddenRectObserver({
  16754. row: e,
  16755. column: t,
  16756. worksheet: a,
  16757. skeleton: h,
  16758. currentRender: u
  16759. }), R = this._globalPopupManagerService.addPopup({
  16760. ...n,
  16761. unitId: c,
  16762. subUnitId: d,
  16763. anchorRect: g,
  16764. anchorRect$: p,
  16765. canvasElement: u.engine.getCanvasElement(),
  16766. hiddenRects$: v
  16767. }), I = new St();
  16768. I.add(S), I.add(Ae(() => {
  16769. this._globalPopupManagerService.removePopup(R), p.complete();
  16770. })), I.add(_);
  16771. const y = { startRow: e, endRow: e, startColumn: t, endColumn: t };
  16772. return I.add(this._refRangeService.watchRange(c, d, y, (M, P) => {
  16773. P ? b(P.startRow, P.startColumn) : I.dispose();
  16774. })), {
  16775. dispose() {
  16776. I.dispose();
  16777. },
  16778. canDispose: () => this._globalPopupManagerService.activePopupId !== R
  16779. };
  16780. }
  16781. /**
  16782. * attach Comp to floatDOM
  16783. * @param range
  16784. * @param popup
  16785. * @param _unitId
  16786. * @param _subUnitId
  16787. * @param viewport
  16788. * @param showOnSelectionMoving
  16789. * @returns
  16790. */
  16791. attachRangePopup(e, t, n, s, i, o = !1) {
  16792. const l = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), a = l.getActiveSheet();
  16793. if (!a)
  16794. return null;
  16795. const c = l.getUnitId(), d = a.getSheetId();
  16796. if (n && c !== n || s && d !== s)
  16797. return null;
  16798. const u = this._renderManagerService.getRenderById(c), h = u == null ? void 0 : u.with(me).getOrCreateSkeleton({
  16799. sheetId: d
  16800. }), m = u == null ? void 0 : u.with(dt);
  16801. if (!u || !h || !m)
  16802. return null;
  16803. if (m.selectionMoving && !o)
  16804. return;
  16805. const f = i != null ? i : lh(e.startRow, e.startColumn, u.scene, a);
  16806. if (!f)
  16807. return null;
  16808. const {
  16809. position: g,
  16810. position$: p,
  16811. disposable: S,
  16812. updateRowCol: b,
  16813. topLeftPos$: v,
  16814. rightBottomPos$: _
  16815. } = this._createRangePositionObserver(e, u, h, f), { rects$: R, disposable: I } = this._createHiddenRectObserver({
  16816. row: e.startRow,
  16817. column: e.startColumn,
  16818. worksheet: a,
  16819. skeleton: h,
  16820. currentRender: u
  16821. }), y = this._globalPopupManagerService.addPopup({
  16822. ...t,
  16823. unitId: c,
  16824. subUnitId: d,
  16825. anchorRect: g,
  16826. anchorRect$: p,
  16827. canvasElement: u.engine.getCanvasElement(),
  16828. hiddenRects$: R
  16829. }), M = new St();
  16830. M.add(S), M.add(Ae(() => {
  16831. this._globalPopupManagerService.removePopup(y), v.complete(), _.complete();
  16832. })), M.add(I);
  16833. const P = { ...e };
  16834. return M.add(this._refRangeService.watchRange(c, d, P, (E, T) => {
  16835. T ? b(T.startRow, T.startColumn) : M.dispose();
  16836. })), {
  16837. dispose() {
  16838. M.dispose();
  16839. },
  16840. canDispose: () => this._globalPopupManagerService.activePopupId !== y
  16841. };
  16842. }
  16843. /**
  16844. *
  16845. * @param initialRow
  16846. * @param initialCol
  16847. * @param currentRender
  16848. * @param skeleton
  16849. * @param activeViewport
  16850. * @returns
  16851. */
  16852. _createCellPositionObserver(e, t, n, s, i) {
  16853. let o = e, l = t;
  16854. const a = this._calcCellPositionByCell(o, l, n, s, i), c = new Me(a), d = () => c.next(this._calcCellPositionByCell(o, l, n, s, i)), u = new St();
  16855. return u.add(n.engine.clientRect$.subscribe(() => d())), u.add(this._commandService.onCommandExecuted((m) => {
  16856. if (m.id === _r.id && m.params.rowsAutoHeightInfo.findIndex((g) => g.row === o) > -1) {
  16857. d();
  16858. return;
  16859. }
  16860. (Io.indexOf(m.id) > -1 || m.id === dn.id || m.id === $t.id) && d();
  16861. })), {
  16862. position$: c,
  16863. disposable: u,
  16864. position: a,
  16865. updateRowCol: (m, f) => {
  16866. o = m, l = f, d();
  16867. }
  16868. };
  16869. }
  16870. // TODO @lumixraku to a normal function, not method.
  16871. _calcCellPositionByCell(e, t, n, s, i) {
  16872. const { scene: o, engine: l } = n, a = s.getCellWithCoordByIndex(e, t), c = a.isMergedMainCell ? a.mergeInfo : a, { scaleX: d, scaleY: u } = o.getAncestorScale(), h = {
  16873. x: i.viewportScrollX,
  16874. y: i.viewportScrollY
  16875. }, m = l.getCanvasElement(), f = m.getBoundingClientRect(), g = Ga(m.style.width), { top: p, left: S, width: b } = f, v = b / g;
  16876. return {
  16877. left: (c.startX - h.x) * v * d + S,
  16878. right: (c.endX - h.x) * v * d + S,
  16879. top: (c.startY - h.y) * v * u + p,
  16880. bottom: (c.endY - h.y) * v * u + p
  16881. };
  16882. }
  16883. // #endregion
  16884. /**
  16885. * Unlike _createCellPositionObserver, this accept a range not a single cell.
  16886. * @param initialRow
  16887. * @param initialCol
  16888. * @param currentRender
  16889. * @param skeleton
  16890. * @param activeViewport
  16891. */
  16892. _createRangePositionObserver(e, t, n, s) {
  16893. let { startRow: i, startColumn: o } = e;
  16894. const l = this._calcCellPositionByCell(i, o, t, n, s), a = new Me(l), c = this._calcCellPositionByCell(e.endRow, e.endColumn, t, n, s), d = new Me(c), u = () => {
  16895. const p = this._calcCellPositionByCell(i, o, t, n, s), S = this._calcCellPositionByCell(e.endRow, e.endColumn, t, n, s);
  16896. a.next(p), d.next(S);
  16897. }, h = new St();
  16898. h.add(t.engine.clientRect$.subscribe(() => u())), h.add(this._commandService.onCommandExecuted((p) => {
  16899. if (p.id === _r.id && p.params.rowsAutoHeightInfo.findIndex((b) => b.row === i) > -1) {
  16900. u();
  16901. return;
  16902. }
  16903. (Io.indexOf(p.id) > -1 || p.id === dn.id || p.id === $t.id) && u();
  16904. }));
  16905. const m = (p, S) => {
  16906. i = p, o = S, u();
  16907. }, f = a.pipe(
  16908. _e((p) => {
  16909. const S = this._calcCellPositionByCell(e.endRow, e.endColumn, t, n, s);
  16910. return {
  16911. top: p.top,
  16912. left: p.left,
  16913. right: S.right,
  16914. bottom: S.bottom
  16915. };
  16916. })
  16917. ), g = {
  16918. top: l.top,
  16919. left: l.left,
  16920. right: c.right,
  16921. bottom: c.bottom
  16922. };
  16923. return {
  16924. position$: f,
  16925. position: g,
  16926. updateRowCol: m,
  16927. topLeftPos$: a,
  16928. rightBottomPos$: d,
  16929. disposable: h
  16930. };
  16931. }
  16932. };
  16933. vi = pI([
  16934. dr(0, D(IS)),
  16935. dr(1, Ce),
  16936. dr(2, L),
  16937. dr(3, D(dC)),
  16938. dr(4, F),
  16939. dr(5, El),
  16940. dr(6, D($))
  16941. ], vi);
  16942. function Ga(r) {
  16943. return Number.parseInt(r.replace("px", ""));
  16944. }
  16945. var SI = Object.defineProperty, CI = Object.getOwnPropertyDescriptor, vI = (r, e, t, n) => {
  16946. for (var s = n > 1 ? void 0 : n ? CI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  16947. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  16948. return n && s && SI(e, t, s), s;
  16949. }, _h = (r, e) => (t, n) => e(t, n, r), Ks = /* @__PURE__ */ ((r) => (r[r.INFO = 0] = "INFO", r[r.WARNING = 1] = "WARNING", r[r.ERROR = 2] = "ERROR", r))(Ks || {});
  16950. let bi = class extends ce {
  16951. constructor(e, t) {
  16952. super();
  16953. w(this, "_currentAlert$", new xe());
  16954. w(this, "_currentAlert", /* @__PURE__ */ new Map());
  16955. w(this, "currentAlert$", this._currentAlert$.asObservable());
  16956. this._renderManagerService = e, this._canvasPopManagerService = t, this.disposeWithMe(() => {
  16957. this._currentAlert$.complete();
  16958. });
  16959. }
  16960. get currentAlert() {
  16961. return this._currentAlert;
  16962. }
  16963. showAlert(e) {
  16964. let t = this._currentAlert.get(e.key);
  16965. t && t.dispose.dispose(), t ? t.dispose.dispose() : (t = {
  16966. alert: e,
  16967. dispose: {
  16968. dispose() {
  16969. }
  16970. }
  16971. }, this._currentAlert.set(e.key, t));
  16972. const { location: n } = e, { row: s, col: i, unitId: o } = n;
  16973. if (!this._renderManagerService.getRenderById(o))
  16974. return;
  16975. const a = this._canvasPopManagerService.attachPopupToCell(s, i, {
  16976. componentKey: qg,
  16977. direction: "horizontal",
  16978. offset: [2, 0],
  16979. extraProps: {
  16980. alert: e
  16981. }
  16982. });
  16983. a && (t.dispose = a), this._currentAlert$.next(Array.from(this._currentAlert.entries()));
  16984. }
  16985. removeAlert(e) {
  16986. const t = this._currentAlert.get(e);
  16987. t && (this._currentAlert.delete(e), t == null || t.dispose.dispose(), this._currentAlert$.next(Array.from(this._currentAlert.entries())));
  16988. }
  16989. clearAlert() {
  16990. this._currentAlert.forEach((e) => {
  16991. e.dispose.dispose();
  16992. }), this._currentAlert.clear(), this._currentAlert$.next(Array.from(this._currentAlert.entries()));
  16993. }
  16994. };
  16995. bi = vI([
  16996. _h(0, Ce),
  16997. _h(1, D(vi))
  16998. ], bi);
  16999. const bI = "univer-cell-alert", _I = "univer-cell-alert-title", wI = "univer-cell-alert-icon", RI = "univer-cell-alert-icon-error", II = "univer-cell-alert-icon-info", yI = "univer-cell-alert-icon-warning", MI = "univer-cell-alert-content", vn = {
  17000. cellAlert: bI,
  17001. cellAlertTitle: _I,
  17002. cellAlertIcon: wI,
  17003. cellAlertIconError: RI,
  17004. cellAlertIconInfo: II,
  17005. cellAlertIconWarning: yI,
  17006. cellAlertContent: MI
  17007. };
  17008. function PI({ popup: r }) {
  17009. var o;
  17010. const e = (o = r.extraProps) == null ? void 0 : o.alert;
  17011. if (!e)
  17012. return null;
  17013. const { type: t, title: n, message: s } = e, i = {
  17014. [Ks.ERROR]: /* @__PURE__ */ C.jsx(Xd, { className: st(vn.cellAlertIcon, vn.cellAlertIconError) }),
  17015. [Ks.INFO]: /* @__PURE__ */ C.jsx(kc, { className: st(vn.cellAlertIcon, vn.cellAlertIconInfo) }),
  17016. [Ks.WARNING]: /* @__PURE__ */ C.jsx(kc, { className: st(vn.cellAlertIcon, vn.cellAlertIconWarning) })
  17017. };
  17018. return /* @__PURE__ */ C.jsxs("div", { className: vn.cellAlert, children: [
  17019. /* @__PURE__ */ C.jsxs("div", { className: vn.cellAlertTitle, children: [
  17020. t ? i[t] : null,
  17021. n
  17022. ] }),
  17023. /* @__PURE__ */ C.jsx("div", { className: vn.cellAlertContent, children: s })
  17024. ] });
  17025. }
  17026. const qg = "univer.sheet.cell-alert";
  17027. var EI = Object.defineProperty, TI = Object.getOwnPropertyDescriptor, xI = (r, e, t, n) => {
  17028. for (var s = n > 1 ? void 0 : n ? TI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  17029. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  17030. return n && s && EI(e, t, s), s;
  17031. }, OI = (r, e) => (t, n) => e(t, n, r);
  17032. let Qo = class extends ce {
  17033. constructor(r, e) {
  17034. super(), this._context = r, this._componentManager = e, this._initComponent();
  17035. }
  17036. _initComponent() {
  17037. this._componentManager.register(qg, PI);
  17038. }
  17039. };
  17040. Qo = xI([
  17041. OI(1, D(Dn))
  17042. ], Qo);
  17043. const AI = "univer-sheet-paste-options-wrapper", NI = "univer-sheet-paste-options-icon-wrapper", HI = "univer-sheet-paste-options-menu", VI = "univer-sheet-paste-options-menu-item", kI = "univer-sheet-paste-options-menu-item-title", DI = "univer-sheet-paste-options-menu-item-icon", Ur = {
  17044. sheetPasteOptionsWrapper: AI,
  17045. sheetPasteOptionsIconWrapper: NI,
  17046. sheetPasteOptionsMenu: HI,
  17047. sheetPasteOptionsMenuItem: VI,
  17048. sheetPasteOptionsMenuItemTitle: kI,
  17049. sheetPasteOptionsMenuItemIcon: DI
  17050. }, wh = 2, LI = [
  17051. { value: "DEFAULT_PASTE", label: "rightClick.paste" },
  17052. { value: "SPECIAL_PASTE_VALUE", label: "rightClick.pasteValue" },
  17053. { value: "SPECIAL_PASTE_FORMAT", label: "rightClick.pasteFormat" },
  17054. { value: "SPECIAL_PASTE_COL_WIDTH", label: "rightClick.pasteColWidth" },
  17055. { value: "SPECIAL_PASTE_BESIDES_BORDER", label: "rightClick.pasteBesidesBorder" },
  17056. { value: "SPECIAL_PASTE_FORMULA", label: "formula.operation.pasteFormula" }
  17057. ], WI = (r) => {
  17058. var T, A, H, x, k;
  17059. const e = W(L), t = W(Ce), n = Wn();
  17060. if (!r || !n) return null;
  17061. const s = {
  17062. startRow: r.rows[0],
  17063. startCol: r.cols[0],
  17064. endRow: r.rows[r.rows.length - 1],
  17065. endCol: r.cols[r.cols.length - 1]
  17066. };
  17067. if (s.endRow < 0 || s.endCol < 0)
  17068. return null;
  17069. const i = t.getRenderById(n.getUnitId()), o = i == null ? void 0 : i.with(me), l = i == null ? void 0 : i.with(dt), a = pn(e, t);
  17070. if (!a || !l) return null;
  17071. const { scene: c } = a, d = o == null ? void 0 : o.getCurrentSkeleton(), u = l.getViewPort(), h = c == null ? void 0 : c.scaleX, m = c == null ? void 0 : c.scaleY, f = c == null ? void 0 : c.getViewportScrollXY(u), g = (T = c.getEngine()) == null ? void 0 : T.getCanvas();
  17072. if (!h || !c || !h || !m || !f) return null;
  17073. const p = d == null ? void 0 : d.getNoMergeCellPositionByIndex(s.endRow, s.endCol), S = (A = p == null ? void 0 : p.endX) != null ? A : 0, b = (H = p == null ? void 0 : p.endY) != null ? H : 0, v = (x = d == null ? void 0 : d.convertTransformToOffsetX(S, h, f)) != null ? x : -9999, _ = (k = d == null ? void 0 : d.convertTransformToOffsetY(b, m, f)) != null ? k : -9999, R = g == null ? void 0 : g.getWidth(), I = g == null ? void 0 : g.getHeight();
  17074. if (!R || !I) return null;
  17075. const y = v + 50 <= R, M = _ + 50 <= I;
  17076. let P = v, E = _;
  17077. return y || (P = R - 100), M || (E = I - 100), {
  17078. positionX: P,
  17079. positionY: E
  17080. };
  17081. }, BI = () => {
  17082. const r = W(Sn), e = is(r.showMenu$, !0), t = is(r.pasteOptionsCache$, null);
  17083. W(Ce);
  17084. const n = W(Ee), s = W(F), [i, o] = te(!1), [l, a] = te(!1), [c, d] = te(Math.random()), u = t == null ? void 0 : t.target.pastedRange, h = WI(u), m = FC();
  17085. be(() => {
  17086. e || (o(!1), a(!1));
  17087. }, [e]);
  17088. const f = On(() => d(Math.random()), []);
  17089. if (be(() => {
  17090. const S = m && Ae(
  17091. m.currentSkeleton$.subscribe((b) => {
  17092. b && f();
  17093. })
  17094. );
  17095. return S == null ? void 0 : S.dispose;
  17096. }, [m, f]), be(() => s.onCommandExecuted((b) => {
  17097. b.id === dn.id && f();
  17098. }).dispose, [f, s]), !h || !e || h.positionX < 50 || h.positionY < 30) return null;
  17099. const g = i || l, p = (S) => {
  17100. s.executeCommand(If.id, { type: S });
  17101. };
  17102. return /* @__PURE__ */ C.jsx(
  17103. "div",
  17104. {
  17105. className: Ur.sheetPasteOptionsWrapper,
  17106. style: {
  17107. left: h.positionX + wh,
  17108. top: h.positionY + wh
  17109. },
  17110. onMouseEnter: () => o(!0),
  17111. onMouseLeave: () => o(!1),
  17112. children: /* @__PURE__ */ C.jsxs(jm, { children: [
  17113. /* @__PURE__ */ C.jsx(Xm, { children: /* @__PURE__ */ C.jsxs(
  17114. "div",
  17115. {
  17116. className: Ur.sheetPasteOptionsIconWrapper,
  17117. onClick: () => {
  17118. a(!l);
  17119. },
  17120. children: [
  17121. /* @__PURE__ */ C.jsx(
  17122. jf,
  17123. {
  17124. style: { color: "#35322B" },
  17125. extend: { colorChannel1: "rgb(var(--green-700))" }
  17126. }
  17127. ),
  17128. g && /* @__PURE__ */ C.jsx(hs, {})
  17129. ]
  17130. }
  17131. ) }),
  17132. /* @__PURE__ */ C.jsx(
  17133. zm,
  17134. {
  17135. className: st(Ur.sheetPasteOptionsMenu, `
  17136. univer-border univer-border-gray-200 univer-border-solid
  17137. `),
  17138. children: /* @__PURE__ */ C.jsx("ul", { children: LI.map((S) => {
  17139. const b = rt[S.value], v = (t == null ? void 0 : t.pasteType) === b;
  17140. return /* @__PURE__ */ C.jsxs(
  17141. "li",
  17142. {
  17143. onClick: () => p(S.value),
  17144. className: st(Ur.sheetPasteOptionsMenuItem, "hover:univer-bg-neutral-100"),
  17145. children: [
  17146. /* @__PURE__ */ C.jsx("span", { children: v && /* @__PURE__ */ C.jsx(Hn, { className: Ur.sheetPasteOptionsMenuItemIcon, style: { color: "rgb(var(--green-700, #409f11))" } }) }),
  17147. /* @__PURE__ */ C.jsx("div", { className: st(Ur.sheetPasteOptionsMenuItemTitle, "univer-text-gray-700"), children: n.t(S.label) })
  17148. ]
  17149. },
  17150. S.value
  17151. );
  17152. }) })
  17153. }
  17154. )
  17155. ] })
  17156. }
  17157. );
  17158. }, FI = [
  17159. Et.id,
  17160. Ti.id,
  17161. $t.id,
  17162. tr.id,
  17163. xi.id,
  17164. Oi.id,
  17165. Ai.id,
  17166. Ni.id,
  17167. Tl.id,
  17168. xl.id,
  17169. Qt.id,
  17170. $s.id,
  17171. He.id,
  17172. jp
  17173. ];
  17174. function UI(r, e, t, n, s) {
  17175. const i = [], o = [];
  17176. if (n.copyType === gr.CUT) {
  17177. const { undos: l, redos: a } = jI(r, e, s);
  17178. i.push(...a), o.push(...l);
  17179. } else {
  17180. const { undos: l, redos: a } = Jg(e, t, s);
  17181. i.push(...a), o.push(...l);
  17182. const { undos: c, redos: d } = XI(e, t, s);
  17183. i.push(...d), o.push(...c);
  17184. const { undos: u, redos: h } = Qg(e, r, t, s);
  17185. i.push(...h), o.push(...u);
  17186. const { undos: m, redos: f } = Kg(e, t, s, !0);
  17187. i.push(...f), o.push(...m);
  17188. const { undos: g, redos: p } = Wc(
  17189. e,
  17190. t,
  17191. s
  17192. );
  17193. i.push(...p), o.push(...g);
  17194. }
  17195. return {
  17196. undos: o,
  17197. redos: i
  17198. };
  17199. }
  17200. function jI(r, e, t) {
  17201. let n = [], s = [];
  17202. const { range: i, subUnitId: o, unitId: l } = r, { range: a, subUnitId: c } = e, d = a ? wr(a) : null, u = i ? wr(i) : null;
  17203. if (u && d) {
  17204. const h = t.get(L), m = t.get(Ln), f = h.getUniverSheetInstance(l), g = f == null ? void 0 : f.getSheetBySheetId(o), p = f == null ? void 0 : f.getSheetBySheetId(c);
  17205. if (g && p) {
  17206. const S = new Ke(), b = new Ke(), v = g.getCellMatrix(), _ = p.getCellMatrix();
  17207. co.foreach(u, (N, X) => {
  17208. S.setValue(N, X, se.deepClone(v.getValue(N, X))), b.setValue(N, X, null);
  17209. });
  17210. const R = new Ke();
  17211. co.foreach(d, (N, X) => {
  17212. R.setValue(N, X, se.deepClone(_.getValue(N, X)));
  17213. });
  17214. const I = new Ke();
  17215. co.foreach(u, (N, X) => {
  17216. const Y = Xp(N, X), ie = ae.getRelativeRange(Y, u), he = ae.getPositionRange(ie, d);
  17217. I.setValue(he.startRow, he.startColumn, v.getValue(N, X));
  17218. });
  17219. const y = {
  17220. fromRange: u,
  17221. toRange: d,
  17222. from: {
  17223. value: b.getMatrix(),
  17224. subUnitId: o
  17225. },
  17226. to: {
  17227. value: I.getMatrix(),
  17228. subUnitId: c
  17229. },
  17230. unitId: l
  17231. }, M = {
  17232. fromRange: d,
  17233. toRange: u,
  17234. from: {
  17235. value: S.getMatrix(),
  17236. subUnitId: o
  17237. },
  17238. to: {
  17239. value: R.getMatrix(),
  17240. subUnitId: c
  17241. },
  17242. unitId: l
  17243. }, P = m.onCommandExecute({
  17244. id: ld.id,
  17245. params: { toRange: d, fromRange: u }
  17246. }), E = g.getMergeData(), T = p.getMergeData(), A = E.filter((N) => ae.intersects(N, u)), H = T.filter((N) => ae.intersects(N, d)), x = A.map((N) => ae.getRelativeRange(N, u)).map((N) => ae.getPositionRange(N, d)), k = Al(x), U = [
  17247. {
  17248. id: Kt.id,
  17249. params: {
  17250. unitId: l,
  17251. subUnitId: o,
  17252. ranges: A
  17253. }
  17254. },
  17255. {
  17256. id: Kt.id,
  17257. params: {
  17258. unitId: l,
  17259. subUnitId: o,
  17260. ranges: H
  17261. }
  17262. },
  17263. {
  17264. id: Jt.id,
  17265. params: {
  17266. unitId: l,
  17267. subUnitId: c,
  17268. ranges: k
  17269. }
  17270. }
  17271. ], V = [
  17272. {
  17273. id: Kt.id,
  17274. params: {
  17275. unitId: l,
  17276. subUnitId: c,
  17277. ranges: k
  17278. }
  17279. },
  17280. {
  17281. id: Jt.id,
  17282. params: {
  17283. unitId: l,
  17284. subUnitId: c,
  17285. ranges: H
  17286. }
  17287. },
  17288. {
  17289. id: Jt.id,
  17290. params: {
  17291. unitId: l,
  17292. subUnitId: o,
  17293. ranges: A
  17294. }
  17295. }
  17296. ];
  17297. n = [
  17298. { id: tr.id, params: y },
  17299. ...P.redos,
  17300. ...U,
  17301. {
  17302. id: He.id,
  17303. params: {
  17304. unitId: l,
  17305. subUnitId: c,
  17306. selections: [{ range: d }],
  17307. type: Xt.MOVE_END
  17308. }
  17309. }
  17310. ], s = [
  17311. { id: tr.id, params: M },
  17312. ...P.undos,
  17313. ...V,
  17314. {
  17315. id: He.id,
  17316. params: {
  17317. unitId: l,
  17318. subUnitId: o,
  17319. type: Xt.MOVE_END,
  17320. selections: [{ range: u }]
  17321. }
  17322. }
  17323. ];
  17324. }
  17325. }
  17326. return {
  17327. undos: s,
  17328. redos: n
  17329. };
  17330. }
  17331. function Qg(r, e, t, n) {
  17332. const { unitId: s, subUnitId: i, range: o } = r, l = [], a = [], { mapFunc: c } = _s([o]), d = new Ke();
  17333. t.forValue((m, f, g) => {
  17334. var v;
  17335. let p;
  17336. if (!g.p && g.v && !e) {
  17337. const _ = String(g.v), R = er.parseValue(_);
  17338. (R == null ? void 0 : R.v) !== void 0 && typeof R.v == "number" && (p = R.v);
  17339. }
  17340. const { row: S, col: b } = c(m, f);
  17341. if ((v = g.p) != null && v.body && Tc(g.p.body)) {
  17342. const _ = se.deepClone({ p: g.p, v: p != null ? p : g.v });
  17343. d.setValue(S, b, _);
  17344. } else
  17345. d.setValue(S, b, se.deepClone({ v: p != null ? p : g.v, t: g.t }));
  17346. });
  17347. const u = {
  17348. unitId: s,
  17349. subUnitId: i,
  17350. cellValue: se.deepClone(d.getMatrix())
  17351. };
  17352. l.push({
  17353. id: Se.id,
  17354. params: u
  17355. });
  17356. const h = en(
  17357. n,
  17358. u
  17359. );
  17360. return a.push({
  17361. id: Se.id,
  17362. params: h
  17363. }), {
  17364. undos: a,
  17365. redos: l
  17366. };
  17367. }
  17368. function Kg(r, e, t, n = !1) {
  17369. const s = [], i = [], { unitId: o, subUnitId: l, range: a } = r, c = new Ke(), { mapFunc: d } = _s([a]);
  17370. e.forValue((m, f, g) => {
  17371. var I;
  17372. const p = {
  17373. s: Object.assign({}, {
  17374. ...ed,
  17375. pd: dS,
  17376. bg: null,
  17377. cl: null
  17378. }, g.s)
  17379. }, S = p.s.bd;
  17380. S && (Object.keys(S).length > 0 || (p.s.bd = {
  17381. b: null,
  17382. l: null,
  17383. r: null,
  17384. t: null
  17385. }));
  17386. const b = String(g.v), v = er.parseValue(b);
  17387. v != null && v.z && (p.s || (p.s = {}), typeof p.s == "object" && ((I = p.s) != null && I.n ? p.s.n.pattern = v.z : p.s.n = { pattern: v.z }));
  17388. const { row: _, col: R } = d(m, f);
  17389. c.setValue(_, R, p);
  17390. });
  17391. const u = {
  17392. unitId: o,
  17393. subUnitId: l,
  17394. cellValue: se.deepClone(c.getMatrix())
  17395. };
  17396. s.push({
  17397. id: Se.id,
  17398. params: u
  17399. });
  17400. const h = en(
  17401. t,
  17402. u
  17403. );
  17404. return i.push({
  17405. id: Se.id,
  17406. params: h
  17407. }), {
  17408. undos: i,
  17409. redos: s
  17410. };
  17411. }
  17412. function Jg(r, e, t) {
  17413. const n = [], s = [], i = new Ke(), { unitId: o, subUnitId: l, range: a } = r, { mapFunc: c } = _s([a]);
  17414. if (e.forEach((d, u) => {
  17415. Object.keys(u).forEach((h) => {
  17416. const m = Number(h), { row: f, col: g } = c(d, m);
  17417. i.setValue(f, g, { s: null });
  17418. });
  17419. }), i.getLength() > 0) {
  17420. const d = {
  17421. subUnitId: l,
  17422. unitId: o,
  17423. cellValue: se.deepClone(i.getMatrix())
  17424. };
  17425. n.push({
  17426. id: Se.id,
  17427. params: d
  17428. });
  17429. const u = en(
  17430. t,
  17431. d
  17432. );
  17433. s.push({
  17434. id: Se.id,
  17435. params: u
  17436. });
  17437. }
  17438. return { undos: s, redos: n };
  17439. }
  17440. function XI(r, e, t) {
  17441. const n = [], s = [], i = new Ke(), { unitId: o, subUnitId: l, range: a } = r, { mapFunc: c } = _s([a]);
  17442. if (e.forValue((d, u, h) => {
  17443. const { row: m, col: f } = c(d, u);
  17444. i.setValue(m, f, { v: null, p: null });
  17445. }), i.getLength() > 0) {
  17446. const d = {
  17447. subUnitId: l,
  17448. unitId: o,
  17449. cellValue: se.deepClone(i.getMatrix())
  17450. };
  17451. n.push({
  17452. id: Se.id,
  17453. params: d
  17454. });
  17455. const u = en(
  17456. t,
  17457. d
  17458. );
  17459. s.push({
  17460. id: Se.id,
  17461. params: u
  17462. });
  17463. }
  17464. return { undos: s, redos: n };
  17465. }
  17466. function Wc(r, e, t) {
  17467. const n = [], s = [], { unitId: i, subUnitId: o, range: l } = r, { startColumn: a, startRow: c, endColumn: d, endRow: u } = wr(l), h = [];
  17468. e.forValue((b, v, _) => {
  17469. if (_.rowSpan && _.rowSpan > 1) {
  17470. const R = _.colSpan || 1, I = {
  17471. startRow: c + b,
  17472. endRow: c + b + _.rowSpan - 1,
  17473. startColumn: a + v,
  17474. endColumn: a + v + R - 1
  17475. };
  17476. h.push(I);
  17477. } else if (_.colSpan && _.colSpan > 1) {
  17478. const R = _.rowSpan || 1, I = {
  17479. startRow: c + b,
  17480. endRow: c + b + R - 1,
  17481. startColumn: a + v,
  17482. endColumn: a + v + _.colSpan - 1
  17483. };
  17484. h.push(I);
  17485. }
  17486. });
  17487. const f = t.get(L).getUniverSheetInstance(i), g = f == null ? void 0 : f.getSheetBySheetId(o);
  17488. if (f && g) {
  17489. const v = g.getMergeData().filter(
  17490. (I) => ae.intersects({ startRow: c, startColumn: a, endRow: u, endColumn: d }, I)
  17491. ), _ = {
  17492. unitId: i,
  17493. subUnitId: o,
  17494. ranges: v
  17495. };
  17496. n.push({
  17497. id: Kt.id,
  17498. params: _
  17499. });
  17500. const R = Ol(
  17501. t,
  17502. _
  17503. );
  17504. s.push({
  17505. id: Jt.id,
  17506. params: R
  17507. });
  17508. }
  17509. const p = {
  17510. unitId: i,
  17511. subUnitId: o,
  17512. ranges: h
  17513. };
  17514. h.length > 0 && n.push({
  17515. id: Jt.id,
  17516. params: p
  17517. });
  17518. const S = Nl(
  17519. t,
  17520. p
  17521. );
  17522. return h.length > 0 && s.push({
  17523. id: Kt.id,
  17524. params: S
  17525. }), { undos: s, redos: n };
  17526. }
  17527. function zI(r) {
  17528. if (!r.includes("\r") && se.isLegalUrl(r)) {
  17529. const n = Dh(), s = `${r}`, i = {
  17530. startIndex: 0,
  17531. endIndex: s.length - 1,
  17532. rangeId: n,
  17533. rangeType: $c.HYPERLINK,
  17534. properties: {
  17535. url: r
  17536. }
  17537. };
  17538. return {
  17539. dataStream: `${s}\r
  17540. `,
  17541. paragraphs: [{
  17542. startIndex: s.length
  17543. }],
  17544. customRanges: [i]
  17545. };
  17546. }
  17547. let e = r.replace(/(\r\n|\n)/g, "\r");
  17548. e.endsWith(`\r
  17549. `) || (e += `\r
  17550. `);
  17551. const t = [];
  17552. for (let n = 0; n < e.length; n++)
  17553. e[n] === "\r" && t.push({ startIndex: n });
  17554. return {
  17555. dataStream: e,
  17556. paragraphs: t,
  17557. sectionBreaks: [{ startIndex: e.indexOf(`
  17558. `) }]
  17559. };
  17560. }
  17561. var YI = Object.defineProperty, ZI = Object.getOwnPropertyDescriptor, GI = (r, e, t, n) => {
  17562. for (var s = n > 1 ? void 0 : n ? ZI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  17563. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  17564. return n && s && YI(e, t, s), s;
  17565. }, nn = (r, e) => (t, n) => e(t, n, r);
  17566. const qI = [
  17567. Ni.id,
  17568. Ai.id,
  17569. Oi.id,
  17570. xi.id,
  17571. tr.id,
  17572. Tl.id,
  17573. xl.id
  17574. ];
  17575. let _i = class extends kn {
  17576. constructor(r, e, t, n, s, i, o, l, a, c) {
  17577. super(), this._injector = r, this._currentUniverSheet = e, this._renderManagerService = t, this._commandService = n, this._contextService = s, this._configService = i, this._sheetClipboardService = o, this._messageService = l, this._localService = a, this._uiPartsService = c, this._init(), this._initCommandListener(), this._initUIComponents(), this._pasteWithDoc();
  17578. }
  17579. _pasteWithDoc() {
  17580. var t;
  17581. const r = (n) => {
  17582. n.onPaste$.pipe(os(this.dispose$)).subscribe((s) => {
  17583. var a, c;
  17584. if (!De(this._contextService))
  17585. return;
  17586. s.event.preventDefault();
  17587. const i = s.event, o = (a = i.clipboardData) == null ? void 0 : a.getData("text/html"), l = (c = i.clipboardData) == null ? void 0 : c.getData("text/plain");
  17588. this._commandService.executeCommand(xc.id, { htmlContent: o, textContent: l });
  17589. });
  17590. };
  17591. let e = (t = this._renderManagerService.getRenderById(Le)) == null ? void 0 : t.with(Sr);
  17592. e && r(e), this._renderManagerService.created$.subscribe((n) => {
  17593. var s;
  17594. n.unitId === Le && (e = (s = this._renderManagerService.getRenderById(Le)) == null ? void 0 : s.with(Sr), e && r(e));
  17595. });
  17596. }
  17597. _init() {
  17598. [hn, Rf, mn].forEach(
  17599. (e) => this.disposeWithMe(this._commandService.registerMultipleCommand(e))
  17600. ), [
  17601. Gs,
  17602. qs,
  17603. Jr,
  17604. Qs,
  17605. xc,
  17606. If
  17607. ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e))), this.disposeWithMe(this._sheetClipboardService.addClipboardHook(this._initCopyingHooks())), this.disposeWithMe(this._sheetClipboardService.addClipboardHook(this._initPastingHook()));
  17608. const r = this._initSpecialPasteHooks().map(
  17609. (e) => this._sheetClipboardService.addClipboardHook(e)
  17610. );
  17611. this.disposeWithMe({ dispose: () => r.forEach((e) => e.dispose()) });
  17612. }
  17613. // eslint-disable-next-line max-lines-per-function
  17614. _initCopyingHooks() {
  17615. const r = this;
  17616. let e = null;
  17617. return {
  17618. id: rt.DEFAULT_COPY,
  17619. isDefaultHook: !0,
  17620. onBeforeCopy(t, n) {
  17621. e = r._getWorksheet(t, n);
  17622. },
  17623. onCopyCellContent(t, n) {
  17624. var o, l, a, c;
  17625. const s = e.getCell(t, n);
  17626. return (l = (o = s == null ? void 0 : s.p) == null ? void 0 : o.body) != null && l.paragraphs || (c = (a = s == null ? void 0 : s.p) == null ? void 0 : a.body) != null && c.textRuns ? zp(s.p.body) : s ? Wh(s) : "";
  17627. },
  17628. onCopyCellStyle: (t, n, s, i) => {
  17629. const o = {};
  17630. (s || i) && (o.rowspan = `${s || 1}`, o.colspan = `${i || 1}`);
  17631. const l = e.getRange(t, n), a = e.getMergedCell(t, n), c = l.getTextStyle();
  17632. let d = "";
  17633. if (c && (d = lu(c)), a) {
  17634. const u = a.endRow, h = a.endColumn, f = e.getRange(u, h).getTextStyle();
  17635. if (f) {
  17636. const g = lu(f);
  17637. d ? d += g ? `;${g}` : "" : d = g;
  17638. }
  17639. }
  17640. return d && (o.style = d), Object.keys(o).length ? o : null;
  17641. },
  17642. onCopyColumn(t) {
  17643. return {
  17644. width: `${e.getColumnWidth(t)}`
  17645. };
  17646. },
  17647. onCopyRow(t) {
  17648. return {
  17649. style: `height: ${e.getRowHeight(t)}px;`
  17650. };
  17651. },
  17652. onAfterCopy() {
  17653. e = null;
  17654. },
  17655. getFilteredOutRows(t) {
  17656. var l;
  17657. const { startRow: n, endRow: s } = t, i = (l = r._currentUniverSheet.getCurrentUnitForType(O.UNIVER_SHEET)) == null ? void 0 : l.getActiveSheet(), o = [];
  17658. if (!i)
  17659. return o;
  17660. for (let a = n; a <= s; a++)
  17661. i.getRowFiltered(a) && o.push(a);
  17662. return o;
  17663. }
  17664. };
  17665. }
  17666. // eslint-disable-next-line max-lines-per-function
  17667. _initPastingHook() {
  17668. const r = this;
  17669. let e = null, t = null, n = null;
  17670. return {
  17671. id: rt.DEFAULT_PASTE,
  17672. isDefaultHook: !0,
  17673. onBeforePaste({ unitId: s, subUnitId: i, range: o }) {
  17674. n = r._getWorksheet(s, i), e = s, t = i;
  17675. const l = r._configService.getConfig(uC), a = o.rows[o.rows.length - 1], c = o.cols[o.cols.length - 1];
  17676. return l && a * c > l ? (r._messageService.show({
  17677. type: Ym.Error,
  17678. content: r._localService.t("clipboard.paste.exceedMaxCells")
  17679. }), !1) : !0;
  17680. },
  17681. // eslint-disable-next-line max-lines-per-function
  17682. onPasteRows(s, i) {
  17683. const { range: o } = s, l = [], a = [], c = n.getMaxRows(), d = c - 1, u = o.rows[o.rows.length - 1] - d, h = i.length - u, m = n.getRowManager();
  17684. if (u > 0) {
  17685. const p = {};
  17686. i.slice(h).forEach((v, _) => {
  17687. const { height: R } = v || {};
  17688. R && (p[_] = {
  17689. h: Number.parseFloat(R),
  17690. hd: Qe.FALSE
  17691. });
  17692. });
  17693. const S = {
  17694. startColumn: o.cols[0],
  17695. endColumn: o.cols[o.cols.length - 1],
  17696. endRow: o.rows[o.rows.length - 1],
  17697. startRow: c
  17698. }, b = {
  17699. unitId: e,
  17700. subUnitId: t,
  17701. range: S,
  17702. rowInfo: p
  17703. };
  17704. l.push({
  17705. id: Ai.id,
  17706. params: b
  17707. }), a.push({
  17708. id: xi.id,
  17709. params: {
  17710. unitId: e,
  17711. subUnitId: t,
  17712. range: S
  17713. }
  17714. });
  17715. }
  17716. const f = {}, g = {};
  17717. if (i.slice(0, h).forEach((p, S) => {
  17718. var v, _;
  17719. const { height: b } = p;
  17720. if (b) {
  17721. const R = m.getRow(o.rows[0] + S), I = Number.parseFloat(b);
  17722. if (R) {
  17723. const { h: y = oc, ah: M = 0 } = R, P = Math.max(y, M);
  17724. I > P ? (f[S + o.rows[0]] = I, g[S + o.rows[0]] = P) : (f[S + o.rows[0]] = P, g[S + o.rows[0]] = P);
  17725. } else
  17726. f[S + o.rows[0]] = I, g[S + o.rows[0]] = (_ = (v = m.getRow(o.rows[0] + S)) == null ? void 0 : v.h) != null ? _ : oc;
  17727. }
  17728. }), Object.keys(f).length) {
  17729. const p = {
  17730. unitId: e,
  17731. subUnitId: t,
  17732. ranges: [{
  17733. startRow: o.rows[0],
  17734. endRow: Math.min(o.rows[o.rows.length - 1], c),
  17735. startColumn: o.cols[0],
  17736. endColumn: o.cols[o.cols.length - 1]
  17737. }],
  17738. rowHeight: f
  17739. };
  17740. l.push({
  17741. id: $s.id,
  17742. params: p
  17743. }), a.push({
  17744. id: $s.id,
  17745. params: {
  17746. ...p,
  17747. rowHeight: g
  17748. }
  17749. });
  17750. }
  17751. return {
  17752. redos: l,
  17753. undos: a
  17754. };
  17755. },
  17756. // eslint-disable-next-line max-lines-per-function
  17757. onPasteColumns(s, i, o) {
  17758. var b;
  17759. const { range: l } = s, a = [], c = [], d = n.getMaxColumns(), u = d - 1, h = l.cols[l.cols.length - 1] - u, m = i.length - h, f = (b = r._configService.getConfig(au)) != null ? b : cu, g = l.cols, p = g[0];
  17760. if (h > 0) {
  17761. const v = {
  17762. startRow: l.rows[0],
  17763. endRow: l.rows[l.rows.length - 1],
  17764. endColumn: l.cols[l.cols.length - 1],
  17765. startColumn: d
  17766. }, _ = {
  17767. unitId: e,
  17768. subUnitId: t,
  17769. range: v,
  17770. colInfo: i.slice(m).map((R, I) => ({
  17771. w: R.width ? Math.max(+R.width, n.getColumnWidth(g[I])) : f,
  17772. hd: Qe.FALSE
  17773. }))
  17774. };
  17775. a.push({
  17776. id: Ni.id,
  17777. params: _
  17778. }), c.push({
  17779. id: Oi.id,
  17780. params: {
  17781. unitId: e,
  17782. subUnitId: t,
  17783. range: v
  17784. }
  17785. });
  17786. }
  17787. const S = {
  17788. unitId: e,
  17789. subUnitId: t,
  17790. ranges: [{
  17791. startRow: l.rows[0],
  17792. endRow: l.rows[l.rows.length - 1],
  17793. startColumn: l.cols[0],
  17794. endColumn: Math.min(l.cols[l.cols.length - 1], d)
  17795. }]
  17796. };
  17797. if (i.length > 0) {
  17798. const v = {
  17799. ...S,
  17800. colWidth: i.slice(0, m).reduce((R, I, y) => {
  17801. var M;
  17802. return R[y + p] = I.width ? Math.max(+I.width, (M = n.getColumnWidth(g[y])) != null ? M : f) : f, R;
  17803. }, {})
  17804. }, _ = {
  17805. ...S,
  17806. colWidth: i.slice(0, m).reduce((R, I, y) => {
  17807. var M;
  17808. return R[y + p] = (M = n.getColumnWidth(g[y])) != null ? M : f, R;
  17809. }, {})
  17810. };
  17811. a.push({
  17812. id: Qt.id,
  17813. params: v
  17814. }), c.push({
  17815. id: Qt.id,
  17816. params: _
  17817. });
  17818. }
  17819. return {
  17820. redos: a,
  17821. undos: c
  17822. };
  17823. },
  17824. onPastePlainText(s, i, o) {
  17825. return r._onPastePlainText(s, i, o);
  17826. },
  17827. onPasteCells(s, i, o, l) {
  17828. return r._onPasteCells(s, i, o, l);
  17829. },
  17830. onAfterPaste(s) {
  17831. n = null;
  17832. }
  17833. };
  17834. }
  17835. _generateDocumentDataModelSnapshot(r) {
  17836. var o, l;
  17837. const e = (o = this._renderManagerService.withCurrentTypeOfUnit(O.UNIVER_SHEET, me)) == null ? void 0 : o.getCurrent();
  17838. if (e == null)
  17839. return null;
  17840. const { skeleton: t } = e, n = (l = t.getBlankCellDocumentModel()) == null ? void 0 : l.documentModel, i = { ...n == null ? void 0 : n.getSnapshot(), ...r };
  17841. return n == null || n.reset(i), n == null ? void 0 : n.getSnapshot();
  17842. }
  17843. _onPastePlainText(r, e, t) {
  17844. const { range: n, unitId: s, subUnitId: i } = r;
  17845. let o;
  17846. if (/\r|\n/.test(e) || se.isLegalUrl(e)) {
  17847. const a = zI(e), c = this._generateDocumentDataModelSnapshot({ body: a });
  17848. o = {
  17849. [n.rows[0]]: {
  17850. [n.cols[0]]: {
  17851. p: c
  17852. }
  17853. }
  17854. };
  17855. } else
  17856. Kc(e) ? o = {
  17857. [n.rows[0]]: {
  17858. [n.cols[0]]: {
  17859. f: e
  17860. }
  17861. }
  17862. } : o = {
  17863. [n.rows[0]]: {
  17864. [n.cols[0]]: {
  17865. v: e
  17866. }
  17867. }
  17868. };
  17869. const l = {
  17870. unitId: s,
  17871. subUnitId: i,
  17872. cellValue: o
  17873. };
  17874. return {
  17875. redos: [
  17876. {
  17877. id: Se.id,
  17878. params: l
  17879. }
  17880. ],
  17881. undos: [
  17882. {
  17883. id: Se.id,
  17884. params: en(this._injector, l)
  17885. }
  17886. ]
  17887. };
  17888. }
  17889. _onPasteCells(r, e, t, n) {
  17890. return this._injector.invoke((s) => UI(r, e, t, n, s));
  17891. }
  17892. // eslint-disable-next-line max-lines-per-function
  17893. _initSpecialPasteHooks() {
  17894. const r = this, e = {
  17895. id: rt.SPECIAL_PASTE_VALUE,
  17896. specialPasteInfo: {
  17897. label: "specialPaste.value"
  17898. },
  17899. onPasteCells: (i, o, l) => this._injector.invoke((a) => Qg(o, i, l, a))
  17900. }, t = {
  17901. id: rt.SPECIAL_PASTE_FORMAT,
  17902. specialPasteInfo: {
  17903. label: "specialPaste.format"
  17904. },
  17905. onPasteCells: (i, o, l) => {
  17906. const a = [], c = [], { undos: d, redos: u } = this._injector.invoke((p) => Jg(o, l, p));
  17907. a.push(...u), c.push(...d);
  17908. const { undos: h, redos: m } = this._injector.invoke((p) => Wc(
  17909. o,
  17910. l,
  17911. p
  17912. ));
  17913. a.push(...m), c.push(...h);
  17914. const { undos: f, redos: g } = this._injector.invoke((p) => Kg(
  17915. o,
  17916. l,
  17917. p
  17918. ));
  17919. return a.push(...g), c.push(...f), {
  17920. undos: c,
  17921. redos: a
  17922. };
  17923. }
  17924. }, n = {
  17925. id: rt.SPECIAL_PASTE_COL_WIDTH,
  17926. specialPasteInfo: {
  17927. label: "specialPaste.colWidth"
  17928. },
  17929. onPasteCells() {
  17930. return {
  17931. undos: [],
  17932. redos: []
  17933. };
  17934. },
  17935. onPasteColumns(i, o, l) {
  17936. var y, M;
  17937. const a = r._currentUniverSheet.getCurrentUnitForType(O.UNIVER_SHEET), c = a.getUnitId(), d = (y = a.getActiveSheet()) == null ? void 0 : y.getSheetId();
  17938. if (!c || !d)
  17939. throw new Error("Cannot find unitId or subUnitId");
  17940. const u = [], h = [], m = r._getWorksheet(c, d), { range: f } = i, g = f.cols, p = g[0], S = m.getMaxColumns(), b = f.cols[f.cols.length - 1] - S, v = o.length - b, _ = (M = r._configService.getConfig(au)) != null ? M : cu, R = {
  17941. unitId: c,
  17942. subUnitId: d,
  17943. ranges: [{
  17944. startRow: f.rows[0],
  17945. endRow: Math.min(f.cols[f.cols.length - 1], S),
  17946. startColumn: f.cols[0],
  17947. endColumn: f.cols[f.cols.length - 1]
  17948. }],
  17949. colWidth: o.slice(0, v).reduce((P, E, T) => {
  17950. var A;
  17951. return P[T + p] = E.width ? Math.max(+E.width, (A = m.getColumnWidth(g[T])) != null ? A : _) : _, P;
  17952. }, {})
  17953. }, I = {
  17954. unitId: c,
  17955. subUnitId: d,
  17956. ranges: [{
  17957. startRow: f.rows[0],
  17958. endRow: Math.min(f.cols[f.cols.length - 1], S),
  17959. startColumn: f.cols[0],
  17960. endColumn: f.cols[f.cols.length - 1]
  17961. }],
  17962. colWidth: o.slice(0, v).reduce((P, E, T) => {
  17963. var A;
  17964. return P[T + p] = (A = m.getColumnWidth(g[T])) != null ? A : _, P;
  17965. }, {})
  17966. };
  17967. return u.push({
  17968. id: Qt.id,
  17969. params: R
  17970. }), h.push({
  17971. id: Qt.id,
  17972. params: I
  17973. }), {
  17974. redos: u,
  17975. undos: h
  17976. };
  17977. }
  17978. }, s = {
  17979. id: rt.SPECIAL_PASTE_BESIDES_BORDER,
  17980. specialPasteInfo: {
  17981. label: "specialPaste.besidesBorder"
  17982. },
  17983. onPasteCells: (i, o, l, a) => {
  17984. r._currentUniverSheet.getCurrentUnitForType(O.UNIVER_SHEET);
  17985. const c = [], d = [], { range: u, unitId: h, subUnitId: m } = o, f = new Ke();
  17986. l.forValue((v, _, R) => {
  17987. const I = R.s;
  17988. if (typeof I == "object") {
  17989. const y = se.deepClone(R);
  17990. y.s && (y.s = {
  17991. ...I,
  17992. bd: null
  17993. }), f.setValue(u.rows[v], u.cols[_], y);
  17994. }
  17995. });
  17996. const g = {
  17997. unitId: h,
  17998. subUnitId: m,
  17999. cellValue: f.getData()
  18000. };
  18001. c.push({
  18002. id: Se.id,
  18003. params: g
  18004. });
  18005. const p = this._injector.invoke(
  18006. en,
  18007. g
  18008. );
  18009. d.push({
  18010. id: Se.id,
  18011. params: p
  18012. });
  18013. const { undos: S, redos: b } = this._injector.invoke((v) => Wc(o, l, v));
  18014. return d.push(...S), c.push(...b), {
  18015. redos: c,
  18016. undos: d
  18017. };
  18018. }
  18019. };
  18020. return [e, t, n, s];
  18021. }
  18022. _getWorksheet(r, e) {
  18023. var n;
  18024. const t = (n = this._currentUniverSheet.getUniverSheetInstance(r)) == null ? void 0 : n.getSheetBySheetId(e);
  18025. if (!t)
  18026. throw new Error(
  18027. `[SheetClipboardController]: cannot find a worksheet with unitId ${r} and subUnitId ${e}.`
  18028. );
  18029. return t;
  18030. }
  18031. _initCommandListener() {
  18032. var e;
  18033. this.disposeWithMe(
  18034. this._commandService.onCommandExecuted((t) => {
  18035. t.id === or.id ? this._sheetClipboardService.removeMarkSelection() : qI.includes(t.id) && this._sheetClipboardService.removeMarkSelection();
  18036. })
  18037. );
  18038. const r = this._configService.getConfig(Pr);
  18039. (e = r == null ? void 0 : r.clipboardConfig) != null && e.hidePasteOptions || this.disposeWithMe(
  18040. this._commandService.onCommandExecuted((t) => {
  18041. FI.includes(t.id) && this._sheetClipboardService.disposePasteOptionsCache();
  18042. })
  18043. );
  18044. }
  18045. _initUIComponents() {
  18046. var e;
  18047. const r = this._configService.getConfig(Pr);
  18048. (e = r == null ? void 0 : r.clipboardConfig) != null && e.hidePasteOptions || this.disposeWithMe(
  18049. this._uiPartsService.registerComponent(js.CONTENT, () => Qr(BI, this._injector))
  18050. );
  18051. }
  18052. };
  18053. _i = GI([
  18054. nn(0, D(vt)),
  18055. nn(1, L),
  18056. nn(2, Ce),
  18057. nn(3, F),
  18058. nn(4, Ne),
  18059. nn(5, xr),
  18060. nn(6, Sn),
  18061. nn(7, Kh),
  18062. nn(8, D(Ee)),
  18063. nn(9, yl)
  18064. ], _i);
  18065. var QI = Object.defineProperty, KI = Object.getOwnPropertyDescriptor, JI = (r, e, t, n) => {
  18066. for (var s = n > 1 ? void 0 : n ? KI(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18067. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18068. return n && s && QI(e, t, s), s;
  18069. }, Rh = (r, e) => (t, n) => e(t, n, r);
  18070. let wi = class extends ce {
  18071. constructor(e, t) {
  18072. super();
  18073. w(this, "_currentCell$", new xe());
  18074. w(this, "currentCell$", this._currentCell$.asObservable().pipe(cn(
  18075. (e, t) => {
  18076. var n, s, i, o, l, a, c, d;
  18077. return ((n = e == null ? void 0 : e.location) == null ? void 0 : n.unitId) === ((s = t == null ? void 0 : t.location) == null ? void 0 : s.unitId) && ((i = e == null ? void 0 : e.location) == null ? void 0 : i.subUnitId) === ((o = t == null ? void 0 : t.location) == null ? void 0 : o.subUnitId) && ((l = e == null ? void 0 : e.location) == null ? void 0 : l.row) === ((a = t == null ? void 0 : t.location) == null ? void 0 : a.row) && ((c = e == null ? void 0 : e.location) == null ? void 0 : c.col) === ((d = t == null ? void 0 : t.location) == null ? void 0 : d.col);
  18078. }
  18079. )));
  18080. w(this, "_endCell$", new xe());
  18081. w(this, "endCell$", this._endCell$.asObservable());
  18082. this._univerInstanceService = e, this._renderManagerService = t, this._initCellDisposableListener();
  18083. }
  18084. dispose() {
  18085. super.dispose(), this._currentCell$.complete(), this._endCell$.complete();
  18086. }
  18087. _initCellDisposableListener() {
  18088. this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(O.UNIVER_SHEET).subscribe((e) => {
  18089. e || (this._currentCell$.next(null), this._endCell$.next(null));
  18090. }));
  18091. }
  18092. _calcActiveCell(e, t) {
  18093. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET);
  18094. if (!n)
  18095. return null;
  18096. const s = n.getActiveSheet();
  18097. if (!s) return;
  18098. const i = this._renderManagerService.getRenderById(n.getUnitId());
  18099. if (!i) return;
  18100. const o = i.with(me).getCurrent(), a = i.with(yt).getCurrentScrollState();
  18101. if (!(!o || !a || !i))
  18102. return Zf(i, n, s, o, e, t);
  18103. }
  18104. onDragOver(e) {
  18105. const { offsetX: t, offsetY: n, dataTransfer: s } = e, i = this._calcActiveCell(t, n);
  18106. if (!i) {
  18107. this._currentCell$.next(null);
  18108. return;
  18109. }
  18110. const { location: o, position: l } = i;
  18111. this._currentCell$.next({
  18112. location: o,
  18113. position: l,
  18114. dataTransfer: s
  18115. });
  18116. }
  18117. onDrop(e) {
  18118. const { offsetX: t, offsetY: n, dataTransfer: s } = e, i = this._calcActiveCell(t, n);
  18119. if (!i) {
  18120. this._endCell$.next(null);
  18121. return;
  18122. }
  18123. const { location: o, position: l } = i;
  18124. this._endCell$.next({
  18125. location: o,
  18126. position: l,
  18127. dataTransfer: s
  18128. });
  18129. }
  18130. };
  18131. wi = JI([
  18132. Rh(0, L),
  18133. Rh(1, Ce)
  18134. ], wi);
  18135. var $I = Object.defineProperty, ey = Object.getOwnPropertyDescriptor, ty = (r, e, t, n) => {
  18136. for (var s = n > 1 ? void 0 : n ? ey(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18137. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18138. return n && s && $I(e, t, s), s;
  18139. }, qa = (r, e) => (t, n) => e(t, n, r);
  18140. let Ko = class extends ce {
  18141. constructor(r, e, t, n) {
  18142. super(), this._context = r, this._renderManagerService = e, this._dragManagerService = t, this._sheetSkeletonManagerService = n, this._initDragEvent();
  18143. }
  18144. _initDragEvent() {
  18145. const r = new St(), e = (t) => {
  18146. if (r.dispose(), !t)
  18147. return;
  18148. const { scene: n } = this._context, s = n.onDragOver$.subscribeEvent((o) => {
  18149. this._dragManagerService.onDragOver(o);
  18150. }), i = n.onDrop$.subscribeEvent((o) => {
  18151. this._dragManagerService.onDrop(o);
  18152. });
  18153. r.add({
  18154. dispose() {
  18155. s.unsubscribe(), i.unsubscribe();
  18156. }
  18157. });
  18158. };
  18159. e(this._sheetSkeletonManagerService.getCurrent()), this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((t) => {
  18160. e(t);
  18161. }));
  18162. }
  18163. };
  18164. Ko = ty([
  18165. qa(1, Ce),
  18166. qa(2, D(wi)),
  18167. qa(3, D(me))
  18168. ], Ko);
  18169. const eu = (r, e) => {
  18170. var u, h, m, f, g;
  18171. const n = e.findNodePositionByCharIndex(r.startOffset, !0, r.segmentId, -1), s = e.getSkeletonData();
  18172. let i = r.endOffset;
  18173. if (r.segmentId) {
  18174. const p = (g = Array.from((h = (u = s == null ? void 0 : s.skeFooters.get(r.segmentId)) == null ? void 0 : u.values()) != null ? h : [])[0]) != null ? g : Array.from((f = (m = s == null ? void 0 : s.skeHeaders.get(r.segmentId)) == null ? void 0 : m.values()) != null ? f : [])[0];
  18175. p && (i = Math.min(p.ed, i));
  18176. }
  18177. const o = e.findNodePositionByCharIndex(i, !0, r.segmentId, -1);
  18178. if (!o || !n)
  18179. return;
  18180. const l = {
  18181. docsLeft: 0,
  18182. docsTop: 0,
  18183. pageMarginLeft: 0,
  18184. pageMarginTop: 0
  18185. }, a = new Ah(l, e), { borderBoxPointGroup: c } = a.getRangePointData(n, o);
  18186. return Nh(c).map((p) => ({
  18187. top: p.top,
  18188. bottom: p.bottom,
  18189. left: p.left,
  18190. right: p.right
  18191. }));
  18192. }, ny = (r, e, t = -1) => {
  18193. const n = e.findPositionByGlyph(r, t);
  18194. if (!n)
  18195. return;
  18196. const s = { ...n, isBack: !0 }, i = {
  18197. docsLeft: 0,
  18198. docsTop: 0,
  18199. pageMarginLeft: 0,
  18200. pageMarginTop: 0
  18201. }, o = new Ah(i, e), { borderBoxPointGroup: l } = o.getRangePointData(s, s), c = Nh(l)[0];
  18202. return {
  18203. top: c.top,
  18204. bottom: c.bottom,
  18205. left: c.left,
  18206. right: c.right
  18207. };
  18208. }, ry = (r, e, t = 0, n = 0) => {
  18209. const s = eu({ startOffset: e.startIndex, endOffset: e.endIndex + 1, collapsed: !1 }, r);
  18210. if (s)
  18211. return {
  18212. rects: s.map((i) => ({
  18213. top: i.top + n,
  18214. bottom: i.bottom + n,
  18215. left: i.left + t,
  18216. right: i.right + t
  18217. })),
  18218. range: e
  18219. };
  18220. }, sy = (r, e, t = 0, n = 0) => {
  18221. var u, h, m;
  18222. const s = r.findNodeByCharIndex(e.startIndex), i = s == null ? void 0 : s.parent, o = i == null ? void 0 : i.parent, l = o == null ? void 0 : o.parent, a = l == null ? void 0 : l.lines.find((f) => f.paragraphStart && f.paragraphIndex === e.startIndex), c = (m = (h = (u = a == null ? void 0 : a.divides) == null ? void 0 : u[0]) == null ? void 0 : h.glyphGroup) == null ? void 0 : m[0];
  18223. if (!c || !c)
  18224. return;
  18225. const d = ny(c, r);
  18226. if (d)
  18227. return {
  18228. rect: {
  18229. top: d.top + n,
  18230. bottom: d.bottom + n,
  18231. left: d.left + t,
  18232. right: d.right + t
  18233. },
  18234. segmentId: void 0,
  18235. segmentPageIndex: -1,
  18236. paragraph: e
  18237. };
  18238. }, iy = (r, e = 0, t = 0) => {
  18239. var l, a, c, d, u, h, m;
  18240. const n = r.getViewModel().getDataModel(), s = (c = (a = (l = n.getBody()) == null ? void 0 : l.customRanges) == null ? void 0 : a.filter((f) => f.rangeType === $c.HYPERLINK)) != null ? c : [], i = (h = (u = (d = n.getBody()) == null ? void 0 : d.paragraphs) == null ? void 0 : u.filter((f) => {
  18241. var g;
  18242. return ((g = f.bullet) == null ? void 0 : g.listType.indexOf(Yp.CHECK_LIST)) === 0;
  18243. })) != null ? h : [], o = (m = r.getSkeletonData()) == null ? void 0 : m.pages[0].skeDrawings;
  18244. return {
  18245. links: s.map((f) => ry(r, f, e, t)).filter(Boolean),
  18246. checkLists: i.map((f) => sy(r, f, e, t)).filter(Boolean),
  18247. drawings: o ? Array.from(o.keys()).map((f) => ({
  18248. drawingId: f,
  18249. rect: {
  18250. top: o.get(f).aTop,
  18251. bottom: o.get(f).aTop + o.get(f).width,
  18252. left: o.get(f).aLeft,
  18253. right: o.get(f).aLeft + o.get(f).height
  18254. }
  18255. })) : []
  18256. };
  18257. };
  18258. function $g(r, e, t) {
  18259. var c, d, u, h;
  18260. const n = (d = (c = e.documentSkeleton.getSkeletonData()) == null ? void 0 : c.pages[0].height) != null ? d : 0, s = (h = (u = e.documentSkeleton.getSkeletonData()) == null ? void 0 : u.pages[0].width) != null ? h : 0, i = e.verticalAlign, o = e.horizontalAlign;
  18261. let l = 0;
  18262. switch (i) {
  18263. case an.UNSPECIFIED:
  18264. case an.BOTTOM:
  18265. l = r.mergeInfo.endY - r.mergeInfo.startY - n;
  18266. break;
  18267. case an.MIDDLE:
  18268. l = (r.mergeInfo.endY - r.mergeInfo.startY - n) / 2;
  18269. break;
  18270. }
  18271. let a = 0;
  18272. switch (o) {
  18273. case wt.RIGHT:
  18274. a = r.mergeInfo.endX - r.mergeInfo.startX - s;
  18275. break;
  18276. case wt.CENTER:
  18277. a = (r.mergeInfo.endX - r.mergeInfo.startX - s) / 2;
  18278. break;
  18279. case wt.UNSPECIFIED: {
  18280. t && (a = r.mergeInfo.endX - r.mergeInfo.startX - s);
  18281. break;
  18282. }
  18283. }
  18284. return {
  18285. paddingLeft: a,
  18286. paddingTop: l
  18287. };
  18288. }
  18289. const iE = (r, e, t, n, s, i) => {
  18290. var T, A, H;
  18291. const o = r.get(L), l = r.get(Ce), a = o.getUnit(e, O.UNIVER_SHEET);
  18292. if (!a)
  18293. return null;
  18294. const c = a.getSheetBySheetId(t);
  18295. if (!c)
  18296. return null;
  18297. const d = l.getRenderById(a.getUnitId()), u = d == null ? void 0 : d.with(me).getWorksheetSkeleton(c.getSheetId()), h = u == null ? void 0 : u.skeleton;
  18298. if (!h || !d) return;
  18299. const m = h.getFont(n, s), f = m == null ? void 0 : m.documentSkeleton;
  18300. if (!f)
  18301. return null;
  18302. const g = (A = (T = f.getViewModel().getBody()) == null ? void 0 : T.customRanges) == null ? void 0 : A.find((x) => x.rangeId === i);
  18303. if (!g)
  18304. return null;
  18305. const p = Tp, S = h.getCellWithCoordByIndex(n, s);
  18306. let { actualColumn: b, actualRow: v } = S;
  18307. h.overflowCache.forValue((x, k, U) => {
  18308. U.startRow <= v && U.endRow >= v && U.startColumn <= b && U.endColumn >= b && (b = k, v = x);
  18309. });
  18310. const _ = h.getCellWithCoordByIndex(v, b), R = c.getCell(_.actualRow, _.actualColumn), { topOffset: I = 0, leftOffset: y = 0 } = (H = R == null ? void 0 : R.fontRenderExtension) != null ? H : {}, { paddingLeft: M, paddingTop: P } = $g(_, m, !1), E = eu({ startOffset: g.startIndex, endOffset: g.endIndex, collapsed: !1 }, f);
  18311. return {
  18312. rects: E == null ? void 0 : E.map((x) => ({
  18313. top: x.top + _.mergeInfo.startY + P + I + p,
  18314. bottom: x.bottom + _.mergeInfo.startY + P + I + p,
  18315. left: x.left + _.mergeInfo.startX + M + y,
  18316. right: x.right + _.mergeInfo.startX + M + y
  18317. })),
  18318. customRange: g,
  18319. label: f.getViewModel().getBody().dataStream.slice(g.startIndex, g.endIndex + 1)
  18320. };
  18321. }, oE = (r, e, t, n, s, i) => {
  18322. var y, M, P;
  18323. const o = r.get(tt), l = o.getEditCellState();
  18324. if (!l || !o.isVisible().visible)
  18325. return null;
  18326. const { editorUnitId: c, unitId: d, sheetId: u, row: h, column: m } = l;
  18327. if (e !== d || t !== u || h !== n || m !== s)
  18328. return null;
  18329. const f = r.get(Ce), g = f.getRenderById(c), p = f.getRenderById(e);
  18330. if (!g || !p)
  18331. return null;
  18332. const S = g.with(Jn).getSkeleton(), b = (y = p.with(me).getWorksheetSkeleton(u)) == null ? void 0 : y.skeleton;
  18333. if (!S || !b)
  18334. return null;
  18335. const v = (P = (M = S.getViewModel().getBody()) == null ? void 0 : M.customRanges) == null ? void 0 : P.find((E) => E.rangeId === i);
  18336. if (!v)
  18337. return null;
  18338. const _ = 4, R = eu({ startOffset: v.startIndex, endOffset: v.endIndex, collapsed: !1 }, S), I = g.engine.getCanvasElement().getBoundingClientRect();
  18339. return {
  18340. rects: R == null ? void 0 : R.map((E) => ({
  18341. top: E.top + I.top - _,
  18342. bottom: E.bottom + I.top + _,
  18343. left: E.left + I.left,
  18344. right: E.right + I.left
  18345. })),
  18346. customRange: v,
  18347. label: S.getViewModel().getBody().dataStream.slice(v.startIndex, v.endIndex + 1)
  18348. };
  18349. };
  18350. var oy = Object.defineProperty, ly = Object.getOwnPropertyDescriptor, ay = (r, e, t, n) => {
  18351. for (var s = n > 1 ? void 0 : n ? ly(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18352. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18353. return n && s && oy(e, t, s), s;
  18354. }, Ih = (r, e) => (t, n) => e(t, n, r);
  18355. function ur(r) {
  18356. const { workbook: e, worksheet: t, ...n } = r;
  18357. return n;
  18358. }
  18359. let Er = class extends ce {
  18360. constructor(e, t) {
  18361. super();
  18362. w(this, "_currentCell$", new Me(null));
  18363. w(this, "_currentRichText$", new Me(null));
  18364. w(this, "_currentClickedCell$", new xe());
  18365. w(this, "_currentDbClickedCell$", new xe());
  18366. w(this, "_currentCellWithEvent$", new xe());
  18367. w(this, "_currentPointerDownCell$", new xe());
  18368. w(this, "_currentPointerUpCell$", new xe());
  18369. w(this, "_currentHoveredRowHeader$", new Me(null));
  18370. w(this, "_currentHoveredColHeader$", new Me(null));
  18371. w(this, "_currentRowHeaderClick$", new xe());
  18372. w(this, "_currentColHeaderClick$", new xe());
  18373. w(this, "_currentRowHeaderDbClick$", new xe());
  18374. w(this, "_currentColHeaderDbClick$", new xe());
  18375. w(this, "_currentRowHeaderPointerDown$", new xe());
  18376. w(this, "_currentColHeaderPointerDown$", new xe());
  18377. w(this, "_currentRowHeaderPointerUp$", new xe());
  18378. w(this, "_currentColHeaderPointerUp$", new xe());
  18379. // Notify when hovering over different cells
  18380. w(this, "currentCell$", this._currentCell$.asObservable().pipe(
  18381. cn(
  18382. (e, t) => {
  18383. var n, s, i, o, l, a, c, d;
  18384. return ((n = e == null ? void 0 : e.location) == null ? void 0 : n.unitId) === ((s = t == null ? void 0 : t.location) == null ? void 0 : s.unitId) && ((i = e == null ? void 0 : e.location) == null ? void 0 : i.subUnitId) === ((o = t == null ? void 0 : t.location) == null ? void 0 : o.subUnitId) && ((l = e == null ? void 0 : e.location) == null ? void 0 : l.row) === ((a = t == null ? void 0 : t.location) == null ? void 0 : a.row) && ((c = e == null ? void 0 : e.location) == null ? void 0 : c.col) === ((d = t == null ? void 0 : t.location) == null ? void 0 : d.col);
  18385. }
  18386. )
  18387. ));
  18388. // Notify when hovering over different cells and different custom range or bullet
  18389. w(this, "currentRichText$", this._currentRichText$.pipe(
  18390. cn(
  18391. // eslint-disable-next-line complexity
  18392. (e, t) => {
  18393. var n, s, i, o, l, a, c, d, u, h, m, f, g, p, S, b;
  18394. return ((n = e == null ? void 0 : e.location) == null ? void 0 : n.unitId) === ((s = t == null ? void 0 : t.location) == null ? void 0 : s.unitId) && ((i = e == null ? void 0 : e.location) == null ? void 0 : i.subUnitId) === ((o = t == null ? void 0 : t.location) == null ? void 0 : o.subUnitId) && ((l = e == null ? void 0 : e.location) == null ? void 0 : l.row) === ((a = t == null ? void 0 : t.location) == null ? void 0 : a.row) && ((c = e == null ? void 0 : e.location) == null ? void 0 : c.col) === ((d = t == null ? void 0 : t.location) == null ? void 0 : d.col) && ((u = e == null ? void 0 : e.customRange) == null ? void 0 : u.rangeId) === ((h = t == null ? void 0 : t.customRange) == null ? void 0 : h.rangeId) && ((m = e == null ? void 0 : e.bullet) == null ? void 0 : m.startIndex) === ((f = t == null ? void 0 : t.bullet) == null ? void 0 : f.startIndex) && ((g = e == null ? void 0 : e.customRange) == null ? void 0 : g.startIndex) === ((p = t == null ? void 0 : t.customRange) == null ? void 0 : p.startIndex) && ((S = e == null ? void 0 : e.customRange) == null ? void 0 : S.endIndex) === ((b = t == null ? void 0 : t.customRange) == null ? void 0 : b.endIndex) && (e == null ? void 0 : e.drawing) === (t == null ? void 0 : t.drawing);
  18395. }
  18396. ),
  18397. _e((e) => e && {
  18398. unitId: e.location.unitId,
  18399. subUnitId: e.location.subUnitId,
  18400. row: e.location.row,
  18401. col: e.location.col,
  18402. customRange: e.customRange,
  18403. bullet: e.bullet,
  18404. rect: e.rect,
  18405. drawing: e.drawing
  18406. })
  18407. ));
  18408. /**
  18409. * Nearly same as currentRichText$, but with event
  18410. */
  18411. w(this, "currentCellPosWithEvent$", this._currentCellWithEvent$.pipe(
  18412. cn(
  18413. (e, t) => {
  18414. var n, s, i, o, l, a, c, d;
  18415. return ((n = e == null ? void 0 : e.location) == null ? void 0 : n.unitId) === ((s = t == null ? void 0 : t.location) == null ? void 0 : s.unitId) && ((i = e == null ? void 0 : e.location) == null ? void 0 : i.subUnitId) === ((o = t == null ? void 0 : t.location) == null ? void 0 : o.subUnitId) && ((l = e == null ? void 0 : e.location) == null ? void 0 : l.row) === ((a = t == null ? void 0 : t.location) == null ? void 0 : a.row) && ((c = e == null ? void 0 : e.location) == null ? void 0 : c.col) === ((d = t == null ? void 0 : t.location) == null ? void 0 : d.col);
  18416. }
  18417. ),
  18418. _e((e) => e && {
  18419. unitId: e.location.unitId,
  18420. subUnitId: e.location.subUnitId,
  18421. row: e.location.row,
  18422. col: e.location.col,
  18423. event: e.event
  18424. })
  18425. ));
  18426. // Notify when mouse position changes
  18427. w(this, "currentPosition$", this._currentCell$.asObservable());
  18428. w(this, "currentClickedCell$", this._currentClickedCell$.asObservable());
  18429. w(this, "currentDbClickedCell$", this._currentDbClickedCell$.asObservable());
  18430. w(this, "currentPointerDownCell$", this._currentPointerDownCell$.asObservable());
  18431. w(this, "currentPointerUpCell$", this._currentPointerUpCell$.asObservable());
  18432. w(this, "currentHoveredRowHeader$", this._currentHoveredRowHeader$.asObservable());
  18433. w(this, "currentHoveredColHeader$", this._currentHoveredColHeader$.asObservable());
  18434. w(this, "currentRowHeaderClick$", this._currentRowHeaderClick$.asObservable());
  18435. w(this, "currentColHeaderClick$", this._currentColHeaderClick$.asObservable());
  18436. w(this, "currentRowHeaderDbClick$", this._currentRowHeaderDbClick$.asObservable());
  18437. w(this, "currentColHeaderDbClick$", this._currentColHeaderDbClick$.asObservable());
  18438. w(this, "currentRowHeaderPointerDown$", this._currentRowHeaderPointerDown$.asObservable());
  18439. w(this, "currentColHeaderPointerDown$", this._currentColHeaderPointerDown$.asObservable());
  18440. w(this, "currentRowHeaderPointerUp$", this._currentRowHeaderPointerUp$.asObservable());
  18441. w(this, "currentColHeaderPointerUp$", this._currentColHeaderPointerUp$.asObservable());
  18442. this._univerInstanceService = e, this._renderManagerService = t, this._initCellDisposableListener();
  18443. }
  18444. dispose() {
  18445. super.dispose(), this._currentCell$.complete(), this._currentClickedCell$.complete(), this._currentPointerDownCell$.complete(), this._currentPointerUpCell$.complete(), this._currentCellWithEvent$.complete();
  18446. }
  18447. _initCellDisposableListener() {
  18448. this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(O.UNIVER_SHEET).subscribe((e) => {
  18449. e || this._currentCell$.next(null);
  18450. })), this.disposeWithMe(this._univerInstanceService.unitDisposed$.subscribe((e) => {
  18451. var t, n;
  18452. ((t = this._currentCell$.getValue()) == null ? void 0 : t.location.unitId) === e.getUnitId() && this._currentCell$.next(null), ((n = this._currentRichText$.getValue()) == null ? void 0 : n.location.unitId) === e.getUnitId() && this._currentRichText$.next(null);
  18453. }));
  18454. }
  18455. _getCalcDeps(e) {
  18456. const t = this._univerInstanceService.getUnit(e, O.UNIVER_SHEET);
  18457. if (!t)
  18458. return null;
  18459. const n = t.getActiveSheet();
  18460. if (!n)
  18461. return null;
  18462. const s = this._renderManagerService.getRenderById(t.getUnitId());
  18463. if (!s) return null;
  18464. const i = s.with(me).getWorksheetSkeleton(n.getSheetId());
  18465. if (!i) return null;
  18466. const o = s.with(yt);
  18467. if (!(!(o != null && o.getCurrentScrollState()) || !s))
  18468. return { currentRender: s, workbook: t, worksheet: n, skeletonParam: i };
  18469. }
  18470. _calcActiveCell(e, t, n, s, i, o) {
  18471. var R, I, y;
  18472. const l = Zf(e, t, n, s, i, o), a = s.skeleton;
  18473. if (!l)
  18474. return null;
  18475. const { position: c, overflowLocation: d, location: u } = l, h = a.getFont(d.row, d.col);
  18476. let m = null, f = null, g = null;
  18477. const p = a.getCellWithCoordByIndex(d.row, d.col), S = n.getCell(d.row, d.col), { topOffset: b = 0, leftOffset: v = 0 } = (R = S == null ? void 0 : S.fontRenderExtension) != null ? R : {};
  18478. if (h) {
  18479. const { paddingLeft: M, paddingTop: P } = $g(p, h, (S == null ? void 0 : S.v) !== null && (S == null ? void 0 : S.v) !== void 0 ? !Number.isNaN(+S.v) : !1), E = iy(h.documentSkeleton, M, P), T = i - c.startX - v, A = o - c.startY - b;
  18480. m = E.links.find((H) => H.rects.some((x) => x.left <= T && T <= x.right && x.top <= A && A <= x.bottom)), f = E.checkLists.find((H) => H.rect.left <= T && T <= H.rect.right && H.rect.top <= A && A <= H.rect.bottom), g = E.drawings.find((H) => H.rect.left <= T && T <= H.rect.right && H.rect.top <= A && A <= H.rect.bottom);
  18481. }
  18482. const _ = (y = (I = m == null ? void 0 : m.rects.pop()) != null ? I : f == null ? void 0 : f.rect) != null ? y : g == null ? void 0 : g.rect;
  18483. return {
  18484. location: u,
  18485. position: c,
  18486. overflowLocation: d,
  18487. customRange: m == null ? void 0 : m.range,
  18488. bullet: f == null ? void 0 : f.paragraph,
  18489. drawing: g == null ? void 0 : g.drawingId,
  18490. rect: _ && {
  18491. top: _.top + p.mergeInfo.startY + b,
  18492. bottom: _.bottom + p.mergeInfo.startY + b,
  18493. left: _.left + p.mergeInfo.startX + v,
  18494. right: _.right + p.mergeInfo.startX + v
  18495. }
  18496. };
  18497. }
  18498. _calcActiveRowHeader(e, t, n) {
  18499. const s = this._getCalcDeps(e);
  18500. if (!s)
  18501. return;
  18502. const { currentRender: i, worksheet: o, skeletonParam: l } = s, { scaleY: a } = i.scene.getAncestorScale(), c = i.scene.getViewports().find((h) => h.isHit(new Oe(t, n)));
  18503. if (!c || c.viewportKey !== z.VIEW_ROW_TOP && c.viewportKey !== z.VIEW_ROW_BOTTOM)
  18504. return;
  18505. const d = {
  18506. x: c.viewportScrollX,
  18507. y: c.viewportScrollY
  18508. }, u = l.skeleton.getRowIndexByOffsetY(n, a, d);
  18509. return { unitId: e, index: u, subUnitId: o.getSheetId() };
  18510. }
  18511. _calcActiveColHeader(e, t, n) {
  18512. const s = this._getCalcDeps(e);
  18513. if (!s)
  18514. return;
  18515. const { currentRender: i, worksheet: o, skeletonParam: l } = s, { scaleX: a } = i.scene.getAncestorScale(), c = i.scene.getViewports().find((h) => h.isHit(new Oe(t, n)));
  18516. if (!c || c.viewportKey !== z.VIEW_COLUMN_LEFT && c.viewportKey !== z.VIEW_COLUMN_RIGHT)
  18517. return;
  18518. const d = {
  18519. x: c.viewportScrollX,
  18520. y: c.viewportScrollY
  18521. }, u = l.skeleton.getColumnIndexByOffsetX(t, a, d);
  18522. return { unitId: e, index: u, subUnitId: o.getSheetId() };
  18523. }
  18524. triggerPointerDown(e, t) {
  18525. const n = this._getCalcDeps(e);
  18526. if (!n)
  18527. return;
  18528. const { currentRender: s, workbook: i, worksheet: o, skeletonParam: l } = n, a = this._calcActiveCell(s, i, o, l, t.offsetX, t.offsetY);
  18529. if (a && a.location) {
  18530. const { unitId: c, subUnitId: d, row: u, col: h } = ur(a.location);
  18531. this._currentPointerDownCell$.next({
  18532. unitId: c,
  18533. subUnitId: d,
  18534. row: u,
  18535. col: h,
  18536. event: t
  18537. });
  18538. }
  18539. }
  18540. triggerPointerUp(e, t) {
  18541. const n = this._getCalcDeps(e);
  18542. if (!n)
  18543. return;
  18544. const { currentRender: s, workbook: i, worksheet: o, skeletonParam: l } = n, a = this._calcActiveCell(s, i, o, l, t.offsetX, t.offsetY);
  18545. if (a) {
  18546. const c = ur(a.location);
  18547. this._currentPointerUpCell$.next({
  18548. ...c,
  18549. event: t
  18550. });
  18551. }
  18552. }
  18553. triggerMouseMove(e, t) {
  18554. const n = this._getCalcDeps(e);
  18555. if (!n)
  18556. return;
  18557. const { currentRender: s, workbook: i, worksheet: o, skeletonParam: l } = n, a = this._calcActiveCell(s, i, o, l, t.offsetX, t.offsetY);
  18558. this._currentCell$.next(a && {
  18559. location: ur(a.location),
  18560. position: a.position
  18561. }), this._currentRichText$.next(a && {
  18562. ...a,
  18563. location: ur(a.overflowLocation)
  18564. }), this._currentCellWithEvent$.next(a && {
  18565. ...a,
  18566. location: ur(a.location),
  18567. event: t
  18568. });
  18569. }
  18570. /**
  18571. * Trigger by pointerup.
  18572. * @param unitId
  18573. * @param offsetX
  18574. * @param offsetY
  18575. */
  18576. triggerClick(e, t, n) {
  18577. const s = this._getCalcDeps(e);
  18578. if (!s)
  18579. return;
  18580. const { currentRender: i, workbook: o, worksheet: l, skeletonParam: a } = s, c = this._calcActiveCell(i, o, l, a, t, n);
  18581. c && this._currentClickedCell$.next({
  18582. ...c,
  18583. location: ur(c.location)
  18584. });
  18585. }
  18586. triggerDbClick(e, t, n) {
  18587. const s = this._getCalcDeps(e);
  18588. if (!s)
  18589. return;
  18590. const { currentRender: i, workbook: o, worksheet: l, skeletonParam: a } = s, c = this._calcActiveCell(i, o, l, a, t, n);
  18591. c && this._currentDbClickedCell$.next({
  18592. ...c,
  18593. location: ur(c.location)
  18594. });
  18595. }
  18596. triggerScroll() {
  18597. this._currentCell$.next(null);
  18598. }
  18599. triggerRowHeaderClick(e, t, n) {
  18600. const s = this._calcActiveRowHeader(e, t, n);
  18601. s && this._currentRowHeaderClick$.next(s);
  18602. }
  18603. triggerColHeaderClick(e, t, n) {
  18604. const s = this._calcActiveColHeader(e, t, n);
  18605. s && this._currentColHeaderClick$.next(s);
  18606. }
  18607. triggerRowHeaderDbClick(e, t, n) {
  18608. const s = this._calcActiveRowHeader(e, t, n);
  18609. s && this._currentRowHeaderDbClick$.next(s);
  18610. }
  18611. triggerColHeaderDbClick(e, t, n) {
  18612. const s = this._calcActiveColHeader(e, t, n);
  18613. s && this._currentColHeaderDbClick$.next(s);
  18614. }
  18615. triggerRowHeaderMouseMove(e, t, n) {
  18616. this._currentHoveredRowHeader$.next(this._calcActiveRowHeader(e, t, n));
  18617. }
  18618. triggerColHeaderMouseMove(e, t, n) {
  18619. this._currentHoveredColHeader$.next(this._calcActiveColHeader(e, t, n));
  18620. }
  18621. triggerRowHeaderPoniterDown(e, t, n) {
  18622. const s = this._calcActiveRowHeader(e, t, n);
  18623. s && this._currentRowHeaderPointerDown$.next(s);
  18624. }
  18625. triggerColHeaderPoniterDown(e, t, n) {
  18626. const s = this._calcActiveColHeader(e, t, n);
  18627. s && this._currentColHeaderPointerDown$.next(s);
  18628. }
  18629. triggerRowHeaderPoniterUp(e, t, n) {
  18630. const s = this._calcActiveRowHeader(e, t, n);
  18631. s && this._currentRowHeaderPointerUp$.next(s);
  18632. }
  18633. triggerColHeaderPoniterUp(e, t, n) {
  18634. const s = this._calcActiveColHeader(e, t, n);
  18635. s && this._currentColHeaderPointerUp$.next(s);
  18636. }
  18637. };
  18638. Er = ay([
  18639. Ih(0, L),
  18640. Ih(1, Ce)
  18641. ], Er);
  18642. var cy = Object.defineProperty, dy = Object.getOwnPropertyDescriptor, uy = (r, e, t, n) => {
  18643. for (var s = n > 1 ? void 0 : n ? dy(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18644. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18645. return n && s && cy(e, t, s), s;
  18646. }, no = (r, e) => (t, n) => e(t, n, r);
  18647. const Qa = "SHEET_FORCE_STRING_ALERT";
  18648. let Jo = class extends ce {
  18649. constructor(r, e, t, n, s) {
  18650. super(), this._context = r, this._hoverManagerService = e, this._cellAlertManagerService = t, this._localeService = n, this._zenZoneService = s, this._init();
  18651. }
  18652. _init() {
  18653. this._initCellAlertPopup(), this._initZenService();
  18654. }
  18655. _initCellAlertPopup() {
  18656. this.disposeWithMe(this._hoverManagerService.currentCell$.subscribe((r) => {
  18657. var e;
  18658. if (r) {
  18659. const n = this._context.unit.getActiveSheet();
  18660. if (!n) return;
  18661. const s = n.getCell(r.location.row, r.location.col);
  18662. if ((s == null ? void 0 : s.t) === ln.FORCE_STRING && s.v && Uh(s.v)) {
  18663. const i = this._cellAlertManagerService.currentAlert.get(Qa), o = (e = i == null ? void 0 : i.alert) == null ? void 0 : e.location;
  18664. if (o && o.row === r.location.row && o.col === r.location.col && o.subUnitId === r.location.subUnitId && o.unitId === r.location.unitId)
  18665. return;
  18666. this._cellAlertManagerService.showAlert({
  18667. type: Ks.ERROR,
  18668. title: this._localeService.t("info.error"),
  18669. message: this._localeService.t("info.forceStringInfo"),
  18670. location: r.location,
  18671. width: 200,
  18672. height: 74,
  18673. key: Qa
  18674. });
  18675. return;
  18676. }
  18677. }
  18678. this._hideAlert();
  18679. }));
  18680. }
  18681. _initZenService() {
  18682. this.disposeWithMe(this._zenZoneService.visible$.subscribe((r) => {
  18683. r && this._hideAlert();
  18684. }));
  18685. }
  18686. _hideAlert() {
  18687. this._cellAlertManagerService.removeAlert(Qa);
  18688. }
  18689. };
  18690. Jo = uy([
  18691. no(1, D(Er)),
  18692. no(2, D(bi)),
  18693. no(3, D(Ee)),
  18694. no(4, yS)
  18695. ], Jo);
  18696. var hy = Object.defineProperty, my = Object.getOwnPropertyDescriptor, fy = (r, e, t, n) => {
  18697. for (var s = n > 1 ? void 0 : n ? my(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18698. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18699. return n && s && hy(e, t, s), s;
  18700. }, yh = (r, e) => (t, n) => e(t, n, r);
  18701. let $o = class extends kn {
  18702. constructor(r, e, t) {
  18703. super(), this._context = r, this._sheetSkeletonManagerService = e, this._sheetInterceptorService = t, this._initViewModelIntercept();
  18704. }
  18705. _initViewModelIntercept() {
  18706. const r = {
  18707. tl: {
  18708. size: 6,
  18709. color: "#409f11"
  18710. }
  18711. };
  18712. this.disposeWithMe(
  18713. this._sheetInterceptorService.intercept(
  18714. hC.CELL_CONTENT,
  18715. {
  18716. priority: 10,
  18717. effect: Zp.Style,
  18718. handler: (e, t, n) => {
  18719. var o;
  18720. if (!((o = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : o.skeleton))
  18721. return n(e);
  18722. const i = t.worksheet.getCellRaw(t.row, t.col);
  18723. return !i || i.v === null || i.v === void 0 ? n(e) : (e == null ? void 0 : e.t) === ln.FORCE_STRING && Uh(i.v) ? n({
  18724. ...e,
  18725. markers: {
  18726. ...e == null ? void 0 : e.markers,
  18727. ...r
  18728. }
  18729. }) : n(e);
  18730. }
  18731. }
  18732. )
  18733. );
  18734. }
  18735. };
  18736. $o = fy([
  18737. yh(1, D(me)),
  18738. yh(2, D(Ln))
  18739. ], $o);
  18740. var gy = Object.defineProperty, py = Object.getOwnPropertyDescriptor, Sy = (r, e, t, n) => {
  18741. for (var s = n > 1 ? void 0 : n ? py(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18742. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18743. return n && s && gy(e, t, s), s;
  18744. }, Ka = (r, e) => (t, n) => e(t, n, r);
  18745. let el = class extends ce {
  18746. constructor(e, t, n, s) {
  18747. super();
  18748. w(this, "_active", !1);
  18749. this._context = e, this._hoverManagerService = t, this._sheetSkeletonManagerService = n, this._scrollManagerService = s, this._initPointerEvent(), this._initScrollEvent();
  18750. }
  18751. get active() {
  18752. return this._active;
  18753. }
  18754. // eslint-disable-next-line max-lines-per-function
  18755. _initPointerEvent() {
  18756. const e = new St(), t = (n) => {
  18757. if (e.dispose(), !n)
  18758. return;
  18759. const { mainComponent: s, unitId: i, components: o } = this._context;
  18760. if (!s)
  18761. return;
  18762. e.add(s.onPointerEnter$.subscribeEvent((c) => {
  18763. this._active = !0;
  18764. })), e.add(Hh(s.onPointerMove$).subscribe((c) => {
  18765. this._active = !0, this._hoverManagerService.triggerMouseMove(i, c);
  18766. })), e.add(s.onPointerDown$.subscribeEvent((c) => {
  18767. this._hoverManagerService.triggerPointerDown(i, c);
  18768. })), e.add(s.onPointerUp$.subscribeEvent((c) => {
  18769. this._hoverManagerService.triggerPointerUp(i, c), this._hoverManagerService.triggerClick(i, c.offsetX, c.offsetY);
  18770. })), e.add(s.onDblclick$.subscribeEvent((c) => {
  18771. this._hoverManagerService.triggerDbClick(i, c.offsetX, c.offsetY);
  18772. })), e.add(s.onPointerLeave$.subscribeEvent(() => {
  18773. this._active = !1;
  18774. }));
  18775. const l = o.get(qe.ROW), a = o.get(qe.COLUMN);
  18776. l && (e.add(l.onPointerMove$.subscribeEvent((c) => {
  18777. this._hoverManagerService.triggerRowHeaderMouseMove(i, c.offsetX, c.offsetY);
  18778. })), e.add(l.onPointerDown$.subscribeEvent((c) => {
  18779. this._hoverManagerService.triggerRowHeaderPoniterDown(i, c.offsetX, c.offsetY);
  18780. })), e.add(l.onPointerUp$.subscribeEvent((c) => {
  18781. this._hoverManagerService.triggerRowHeaderPoniterUp(i, c.offsetX, c.offsetY), this._hoverManagerService.triggerRowHeaderClick(i, c.offsetX, c.offsetY);
  18782. })), e.add(l.onDblclick$.subscribeEvent((c) => {
  18783. this._hoverManagerService.triggerRowHeaderDbClick(i, c.offsetX, c.offsetY);
  18784. }))), a && (e.add(a.onPointerMove$.subscribeEvent((c) => {
  18785. this._hoverManagerService.triggerColHeaderMouseMove(i, c.offsetX, c.offsetY);
  18786. })), e.add(a.onPointerDown$.subscribeEvent((c) => {
  18787. this._hoverManagerService.triggerColHeaderPoniterDown(i, c.offsetX, c.offsetY);
  18788. })), e.add(a.onPointerUp$.subscribeEvent((c) => {
  18789. this._hoverManagerService.triggerColHeaderPoniterUp(i, c.offsetX, c.offsetY), this._hoverManagerService.triggerColHeaderClick(i, c.offsetX, c.offsetY);
  18790. })), e.add(a.onDblclick$.subscribeEvent((c) => {
  18791. this._hoverManagerService.triggerColHeaderDbClick(i, c.offsetX, c.offsetY);
  18792. })));
  18793. };
  18794. t(this._sheetSkeletonManagerService.getCurrent()), this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((n) => {
  18795. t(n);
  18796. }));
  18797. }
  18798. _initScrollEvent() {
  18799. this.disposeWithMe(this._scrollManagerService.validViewportScrollInfo$.subscribe(() => this._hoverManagerService.triggerScroll()));
  18800. }
  18801. };
  18802. el = Sy([
  18803. Ka(1, D(Er)),
  18804. Ka(2, D(me)),
  18805. Ka(3, D(yt))
  18806. ], el);
  18807. var Cy = Object.defineProperty, vy = Object.getOwnPropertyDescriptor, by = (r, e, t, n) => {
  18808. for (var s = n > 1 ? void 0 : n ? vy(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18809. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18810. return n && s && Cy(e, t, s), s;
  18811. }, Ja = (r, e) => (t, n) => e(t, n, r);
  18812. let tl = class extends ce {
  18813. constructor(r, e, t, n) {
  18814. super(), this._context = r, this._markSelectionService = e, this._commandService = t, this._sheetSkeletonManagerService = n, this._initListeners();
  18815. }
  18816. _initListeners() {
  18817. this._addRemoveListener(), this._addRefreshListener();
  18818. }
  18819. _addRemoveListener() {
  18820. const r = [Et.id];
  18821. this.disposeWithMe(
  18822. this._commandService.onCommandExecuted((e) => {
  18823. r.includes(e.id) ? this._markSelectionService.removeAllShapes() : this._markSelectionService.getShapeMap().forEach((n, s) => {
  18824. n.exits.includes(e.id) && this._markSelectionService.removeShape(s);
  18825. });
  18826. })
  18827. );
  18828. }
  18829. _addRefreshListener() {
  18830. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((r) => {
  18831. r && this._markSelectionService.refreshShapes();
  18832. }));
  18833. }
  18834. };
  18835. tl = by([
  18836. Ja(1, D(ws)),
  18837. Ja(2, F),
  18838. Ja(3, D(me))
  18839. ], tl);
  18840. const _y = "univer-mobile-sheet-bar-container", wy = "univer-mobile-sheet-bar-slider", Ry = "univer-mobile-sheet-bar-item", Iy = "univer-mobile-sheet-bar-item-activated", ro = {
  18841. mobileSheetBarContainer: _y,
  18842. mobileSheetBarSlider: wy,
  18843. mobileSheetBarItem: Ry,
  18844. mobileSheetBarItemActivated: Iy
  18845. };
  18846. function yy() {
  18847. const r = Wn();
  18848. return r ? /* @__PURE__ */ C.jsx(My, { workbook: r }) : null;
  18849. }
  18850. function My(r) {
  18851. const { workbook: e } = r, [t, n] = te([]), [s, i] = te(""), o = od.useRef(/* @__PURE__ */ new Map()), l = W(F), a = On(() => {
  18852. const d = e.getActiveSheet().getSheetId(), u = e.getSheets(), h = e.getActiveSheet(), m = u.filter((f) => !f.isSheetHidden()).map((f, g) => {
  18853. var p;
  18854. return {
  18855. sheetId: f.getSheetId(),
  18856. label: f.getName(),
  18857. index: g,
  18858. selected: h === f,
  18859. color: (p = f.getTabColor()) != null ? p : void 0
  18860. };
  18861. });
  18862. if (n(m), i(d), o.current.has(d)) {
  18863. const f = o.current.get(d);
  18864. f && f.scrollIntoView({ behavior: "smooth", block: "nearest" });
  18865. }
  18866. o.current.clear();
  18867. }, [e]);
  18868. be(() => a(), [a]);
  18869. const c = On((d) => {
  18870. l.executeCommand(et.id, {
  18871. unitId: e.getUnitId(),
  18872. subUnitId: d
  18873. });
  18874. }, [l, e]);
  18875. return be(() => {
  18876. const d = l.onCommandExecuted((u) => {
  18877. switch (u.id) {
  18878. case nr.id:
  18879. case An.id:
  18880. case Rd.id:
  18881. case Nr.id:
  18882. case wd.id:
  18883. case et.id:
  18884. a();
  18885. break;
  18886. }
  18887. });
  18888. return () => d.dispose();
  18889. }, [l, a]), /* @__PURE__ */ C.jsx("div", { className: ro.mobileSheetBarContainer, children: /* @__PURE__ */ C.jsx("div", { className: ro.mobileSheetBarSlider, children: t.map((d) => /* @__PURE__ */ C.jsx(
  18890. "div",
  18891. {
  18892. className: st(
  18893. ro.mobileSheetBarItem,
  18894. {
  18895. [ro.mobileSheetBarItemActivated]: d.sheetId === s
  18896. }
  18897. ),
  18898. onClick: () => c(d.sheetId),
  18899. ref: (u) => o.current.set(d.sheetId, u),
  18900. children: d.label
  18901. },
  18902. d.sheetId
  18903. )) }) });
  18904. }
  18905. const Py = {
  18906. [Ct.MAIN_AREA]: {
  18907. [Ge.FORMAT]: {
  18908. [hn.name]: {
  18909. order: 0,
  18910. menuItemFactory: $r
  18911. }
  18912. },
  18913. [Ge.DATA]: {
  18914. order: 2
  18915. },
  18916. [Ge.OTHERS]: {
  18917. order: 3
  18918. }
  18919. },
  18920. [Ct.COL_HEADER]: {
  18921. [Ge.FORMAT]: {
  18922. [hn.name]: {
  18923. order: 0,
  18924. menuItemFactory: $r
  18925. }
  18926. },
  18927. [Ge.LAYOUT]: {
  18928. order: 1
  18929. },
  18930. [Ge.DATA]: {
  18931. order: 2
  18932. },
  18933. [Ge.OTHERS]: {
  18934. order: 3
  18935. }
  18936. },
  18937. [Ct.ROW_HEADER]: {
  18938. [Ge.FORMAT]: {
  18939. [hn.name]: {
  18940. order: 0,
  18941. menuItemFactory: $r
  18942. }
  18943. },
  18944. [Ge.LAYOUT]: {
  18945. order: 1
  18946. },
  18947. [Ge.DATA]: {
  18948. order: 2
  18949. },
  18950. [Ge.OTHERS]: {
  18951. order: 3
  18952. }
  18953. }
  18954. };
  18955. var Ey = Object.defineProperty, Ty = Object.getOwnPropertyDescriptor, xy = (r, e, t, n) => {
  18956. for (var s = n > 1 ? void 0 : n ? Ty(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  18957. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  18958. return n && s && Ey(e, t, s), s;
  18959. }, hr = (r, e) => (t, n) => e(t, n, r);
  18960. let nl = class extends ce {
  18961. constructor(r, e, t, n, s, i, o) {
  18962. super(), this._injector = r, this._componentManager = e, this._layoutService = t, this._commandService = n, this._shortcutService = s, this._menuManagerService = i, this._uiPartsService = o, this._init();
  18963. }
  18964. _init() {
  18965. this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts(), this._initWorkbenchParts(), this._initFocusHandler();
  18966. }
  18967. _initCustomComponents() {
  18968. const r = this._componentManager;
  18969. this.disposeWithMe(r.register(Kl, Ef)), this.disposeWithMe(r.register($d, rg)), this.disposeWithMe(r.register(Fi, Md)), this.disposeWithMe(r.register(Fd, Jh)), this.disposeWithMe(r.register(Ud, $h)), this.disposeWithMe(r.register(jd, em)), this.disposeWithMe(r.register(Si, ig));
  18970. }
  18971. _initCommands() {
  18972. [
  18973. Gd,
  18974. or,
  18975. Qd,
  18976. qd,
  18977. Li,
  18978. Gt,
  18979. Lt,
  18980. Fn,
  18981. aa,
  18982. sa,
  18983. gi,
  18984. pi,
  18985. Ul,
  18986. jl,
  18987. un,
  18988. of,
  18989. Vd,
  18990. Kd,
  18991. ud,
  18992. cs,
  18993. Et,
  18994. Wl,
  18995. Rs,
  18996. Is,
  18997. ys,
  18998. Ms,
  18999. yf,
  19000. Mf,
  19001. Xl,
  19002. zl,
  19003. di,
  19004. hd,
  19005. fd,
  19006. pd,
  19007. gd,
  19008. Yl,
  19009. Bd,
  19010. Bi,
  19011. Zl,
  19012. dn,
  19013. li,
  19014. $n,
  19015. Gl,
  19016. ql,
  19017. md,
  19018. Wi,
  19019. $t,
  19020. ia,
  19021. Ll,
  19022. fs,
  19023. ms,
  19024. zi,
  19025. Xi,
  19026. Jd,
  19027. pr,
  19028. si,
  19029. // permission
  19030. Vn,
  19031. tg,
  19032. ta,
  19033. es,
  19034. ts,
  19035. na,
  19036. ra,
  19037. la,
  19038. ns,
  19039. rs,
  19040. oa
  19041. ].forEach((r) => {
  19042. this.disposeWithMe(this._commandService.registerCommand(r));
  19043. });
  19044. }
  19045. _initMenus() {
  19046. this._menuManagerService.mergeMenu(Py);
  19047. }
  19048. _initShortcuts() {
  19049. [
  19050. // selection shortcuts
  19051. Sg,
  19052. Cg,
  19053. vg,
  19054. bg,
  19055. _g,
  19056. wg,
  19057. Rg,
  19058. Ig,
  19059. // MoveBackSelectionShortcutItem,
  19060. yg,
  19061. Mg,
  19062. Pg,
  19063. Eg,
  19064. Tg,
  19065. xg,
  19066. Og,
  19067. Ag,
  19068. Ng,
  19069. Hg,
  19070. Vg,
  19071. kg,
  19072. Dg,
  19073. // view shortcuts
  19074. jg,
  19075. zg,
  19076. Zg,
  19077. Gg,
  19078. Xg,
  19079. Yg,
  19080. // toggle cell style shortcuts
  19081. Lg,
  19082. Wg,
  19083. Bg,
  19084. Fg,
  19085. // cell content editing shortcuts
  19086. Ug,
  19087. ...hf(),
  19088. ff,
  19089. mf,
  19090. gf,
  19091. Sf,
  19092. Cf,
  19093. vf,
  19094. pf,
  19095. // operation shortcuts
  19096. gg,
  19097. pg
  19098. ].forEach((r) => {
  19099. this.disposeWithMe(this._shortcutService.registerShortcut(r));
  19100. });
  19101. }
  19102. _initWorkbenchParts() {
  19103. this._uiPartsService.registerComponent(js.HEADER, () => Qr(yy, this._injector));
  19104. }
  19105. _initFocusHandler() {
  19106. this.disposeWithMe(
  19107. this._layoutService.registerFocusHandler(O.UNIVER_SHEET, (r) => {
  19108. })
  19109. );
  19110. }
  19111. };
  19112. nl = xy([
  19113. hr(0, D(vt)),
  19114. hr(1, D(Dn)),
  19115. hr(2, _l),
  19116. hr(3, F),
  19117. hr(4, Il),
  19118. hr(5, id),
  19119. hr(6, yl)
  19120. ], nl);
  19121. const Bc = "UNIVER_SHEET_PERMISSION_ALERT_DIALOG_ID", ep = "UNIVER_SHEET_PERMISSION_ALERT_DIALOG";
  19122. var Oy = Object.defineProperty, Ay = Object.getOwnPropertyDescriptor, Ny = (r, e, t, n) => {
  19123. for (var s = n > 1 ? void 0 : n ? Ay(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  19124. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  19125. return n && s && Oy(e, t, s), s;
  19126. }, bn = (r, e) => (t, n) => e(t, n, r);
  19127. let Ri = class extends ce {
  19128. constructor(e, t, n, s, i, o, l, a, c) {
  19129. super();
  19130. w(this, "disposableCollection", new St());
  19131. this._commandService = e, this._univerInstanceService = t, this._permissionService = n, this._dialogService = s, this._rangeProtectionRuleModel = i, this._autoFillService = o, this._localeService = l, this._contextService = a, this._sheetPermissionCheckController = c, this._initialize(), this._initUIEvent();
  19132. }
  19133. _initUIEvent() {
  19134. this.disposeWithMe(
  19135. this._sheetPermissionCheckController.triggerPermissionUIEvent$.subscribe((e) => {
  19136. this._haveNotPermissionHandle(e);
  19137. })
  19138. );
  19139. }
  19140. _haveNotPermissionHandle(e) {
  19141. const t = {
  19142. id: Bc,
  19143. title: { title: "" },
  19144. children: {
  19145. label: ep,
  19146. errorMsg: e
  19147. },
  19148. width: 320,
  19149. destroyOnClose: !0,
  19150. onClose: () => this._dialogService.close(Bc),
  19151. className: "sheet-permission-user-dialog"
  19152. };
  19153. this._permissionService.getShowComponents() && this._dialogService.open(t);
  19154. }
  19155. _getPermissionCheck(e, t) {
  19156. var i, o;
  19157. let n = !0, s = "";
  19158. switch (e) {
  19159. case Op.id:
  19160. case xp.id:
  19161. if (this._contextService.getContextValue(Sl) === !0)
  19162. break;
  19163. n = this._sheetPermissionCheckController.permissionCheckWithoutRange({
  19164. workbookTypes: [q],
  19165. rangeTypes: [re],
  19166. worksheetTypes: [Ut, ee]
  19167. }), s = this._localeService.t("permission.dialog.editErr");
  19168. break;
  19169. case Et.id:
  19170. if (t.visible === !1)
  19171. break;
  19172. n = this._sheetPermissionCheckController.permissionCheckWithoutRange({
  19173. workbookTypes: [q],
  19174. rangeTypes: [re],
  19175. worksheetTypes: [Ut, ee]
  19176. }), s = this._localeService.t("permission.dialog.editErr");
  19177. break;
  19178. case Jr.id:
  19179. n = this._sheetPermissionCheckController.permissionCheckWithoutRange({
  19180. workbookTypes: [q],
  19181. rangeTypes: [re],
  19182. worksheetTypes: [ee, Or]
  19183. }), s = this._localeService.t("permission.dialog.pasteErr");
  19184. break;
  19185. case xc.id:
  19186. n = this._permissionCheckByPaste(t), s = this._localeService.t("permission.dialog.pasteErr");
  19187. break;
  19188. case Zl.id:
  19189. n = this._sheetPermissionCheckController.permissionCheckWithRanges({
  19190. workbookTypes: [q],
  19191. rangeTypes: [re],
  19192. worksheetTypes: [ee, Ut, ze]
  19193. }), s = this._localeService.t("permission.dialog.commonErr");
  19194. break;
  19195. case Mo.id:
  19196. case Rs.id:
  19197. case Is.id:
  19198. case ys.id:
  19199. case Ms.id:
  19200. n = this._sheetPermissionCheckController.permissionCheckWithRanges({
  19201. workbookTypes: [q],
  19202. rangeTypes: [re],
  19203. worksheetTypes: [ze, ee]
  19204. }), s = this._localeService.t("permission.dialog.setStyleErr");
  19205. break;
  19206. case hn.id:
  19207. n = this._sheetPermissionCheckController.permissionCheckWithRanges({
  19208. workbookTypes: [Bs],
  19209. rangeTypes: [uc],
  19210. worksheetTypes: [yo]
  19211. }), s = this._localeService.t("permission.dialog.copyErr"), (i = this._permissionService.getPermissionPoint(new Bs(this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId()).id)) != null && i.value || (s = this._localeService.t("permission.dialog.workbookCopyErr"));
  19212. break;
  19213. case Rf.id:
  19214. n = this._sheetPermissionCheckController.permissionCheckWithRanges({
  19215. workbookTypes: [Bs, q],
  19216. rangeTypes: [uc, re],
  19217. worksheetTypes: [yo, ee]
  19218. }), s = this._localeService.t("permission.dialog.copyErr"), (o = this._permissionService.getPermissionPoint(new Bs(this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getUnitId()).id)) != null && o.value || (s = this._localeService.t("permission.dialog.workbookCopyErr"));
  19219. break;
  19220. case pr.id:
  19221. n = this._permissionCheckByAutoFillCommand(t), s = this._localeService.t("permission.dialog.autoFillErr");
  19222. break;
  19223. }
  19224. n || this._sheetPermissionCheckController.blockExecuteWithoutPermission(s);
  19225. }
  19226. _initialize() {
  19227. this._commandExecutedListener();
  19228. }
  19229. _commandExecutedListener() {
  19230. this.disposeWithMe(
  19231. this._commandService.beforeCommandExecuted((e) => {
  19232. this._getPermissionCheck(e.id, e == null ? void 0 : e.params);
  19233. })
  19234. );
  19235. }
  19236. _permissionCheckByPaste(e) {
  19237. return e.value === rt.SPECIAL_PASTE_VALUE || e.value === rt.SPECIAL_PASTE_FORMULA ? this._sheetPermissionCheckController.permissionCheckWithRanges({
  19238. workbookTypes: [q],
  19239. rangeTypes: [re],
  19240. worksheetTypes: [ze, ee]
  19241. }) : e.value === rt.SPECIAL_PASTE_FORMAT ? this._sheetPermissionCheckController.permissionCheckWithRanges({
  19242. workbookTypes: [q],
  19243. rangeTypes: [re],
  19244. worksheetTypes: [ze, ee]
  19245. }) : this._sheetPermissionCheckController.permissionCheckWithRanges({
  19246. workbookTypes: [q],
  19247. rangeTypes: [re],
  19248. worksheetTypes: [Ut, ze, ee]
  19249. });
  19250. }
  19251. _permissionCheckByAutoFillCommand(e) {
  19252. if (!e)
  19253. return !1;
  19254. const { targetRange: t } = e, n = Ue(this._univerInstanceService);
  19255. if (!n)
  19256. return !1;
  19257. const { worksheet: s, unitId: i, subUnitId: o } = n;
  19258. return !this._rangeProtectionRuleModel.getSubunitRuleList(i, o).reduce((c, d) => [...c, ...d.ranges], []).filter((c) => ae.intersects(c, t)).some((c) => {
  19259. var d, u;
  19260. for (let h = c.startRow; h <= c.endRow; h++)
  19261. for (let m = c.startColumn; m <= c.endColumn; m++) {
  19262. const f = (u = (d = s.getCell(h, m)) == null ? void 0 : d.selectionProtection) == null ? void 0 : u[0];
  19263. if ((f == null ? void 0 : f[de.Edit]) === !1)
  19264. return !0;
  19265. }
  19266. return !1;
  19267. });
  19268. }
  19269. };
  19270. Ri = Ny([
  19271. bn(0, F),
  19272. bn(1, L),
  19273. bn(2, $e),
  19274. bn(3, bs),
  19275. bn(4, D(Ye)),
  19276. bn(5, Hr),
  19277. bn(6, D(Ee)),
  19278. bn(7, Ne),
  19279. bn(8, D(Om))
  19280. ], Ri);
  19281. var Hy = Object.defineProperty, Vy = Object.getOwnPropertyDescriptor, ky = (r, e, t, n) => {
  19282. for (var s = n > 1 ? void 0 : n ? Vy(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  19283. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  19284. return n && s && Hy(e, t, s), s;
  19285. }, _n = (r, e) => (t, n) => e(t, n, r);
  19286. let rl = class extends kn {
  19287. constructor(e, t, n, s, i, o, l, a, c, d) {
  19288. super();
  19289. w(this, "disposableCollection", new St());
  19290. this._context = e, this._univerInstanceService = t, this._permissionService = n, this._selectionManagerService = s, this._rangeProtectionRuleModel = i, this._headerMoveRenderController = o, this._selectionRenderService = l, this._headerFreezeRenderController = a, this._rangeProtectionCache = c, this._headerResizeRenderController = d, this._initHeaderMovePermissionInterceptor(), this._initHeaderResizePermissionInterceptor(), this._initRangeFillPermissionInterceptor(), this._initRangeMovePermissionInterceptor();
  19291. }
  19292. _initHeaderMovePermissionInterceptor() {
  19293. const e = this._headerMoveRenderController.interceptor.getInterceptPoints().HEADER_MOVE_PERMISSION_CHECK;
  19294. this.disposeWithMe(
  19295. this._headerMoveRenderController.interceptor.intercept(e, {
  19296. handler: (t, n) => {
  19297. const s = Ue(this._univerInstanceService);
  19298. if (!s)
  19299. return !1;
  19300. const { unitId: i, subUnitId: o } = s;
  19301. if (!this._permissionService.composePermission([new q(i).id, new ee(i, o).id]).every((a) => a.value))
  19302. return !1;
  19303. if (!n)
  19304. return !0;
  19305. if (n.rangeType !== j.ROW && n.rangeType !== j.COLUMN)
  19306. return t;
  19307. if (n.rangeType === j.ROW) {
  19308. for (let a = n.startRow; a <= n.endRow; a++)
  19309. if (this._rangeProtectionCache.getRowPermissionInfo(i, o, a, [de.Edit]) === !1)
  19310. return !1;
  19311. } else
  19312. for (let a = n.startColumn; a <= n.endColumn; a++)
  19313. if (this._rangeProtectionCache.getColPermissionInfo(i, o, a, [de.Edit]) === !1)
  19314. return !1;
  19315. return !0;
  19316. }
  19317. })
  19318. );
  19319. }
  19320. _initHeaderResizePermissionInterceptor() {
  19321. this._headerResizeRenderController && this.disposeWithMe(
  19322. this._headerResizeRenderController.interceptor.intercept(this._headerResizeRenderController.interceptor.getInterceptPoints().HEADER_RESIZE_PERMISSION_CHECK, {
  19323. handler: (e, t) => {
  19324. var o, l, a, c;
  19325. const n = Ue(this._univerInstanceService);
  19326. if (!n)
  19327. return !1;
  19328. const { unitId: s, subUnitId: i } = n;
  19329. if (t.row) {
  19330. if (((l = (o = this._permissionService.getPermissionPoint(new Ar(s, i).id)) == null ? void 0 : o.value) != null ? l : !1) === !1)
  19331. return !1;
  19332. } else if (t.col && ((c = (a = this._permissionService.getPermissionPoint(new Or(s, i).id)) == null ? void 0 : a.value) != null ? c : !1) === !1)
  19333. return !1;
  19334. return !0;
  19335. }
  19336. })
  19337. );
  19338. }
  19339. _initRangeFillPermissionInterceptor() {
  19340. this.disposeWithMe(
  19341. this._selectionRenderService.interceptor.intercept(this._selectionRenderService.interceptor.getInterceptPoints().RANGE_FILL_PERMISSION_CHECK, {
  19342. handler: (e, t) => {
  19343. var f, g, p;
  19344. const n = Ue(this._univerInstanceService);
  19345. if (!n)
  19346. return !1;
  19347. const { worksheet: s, unitId: i, subUnitId: o } = n;
  19348. if (!this._permissionService.composePermission([
  19349. new q(i).id,
  19350. new ee(i, o).id,
  19351. new Ut(i, o).id,
  19352. new ze(i, o).id
  19353. ]).every((S) => S.value))
  19354. return !1;
  19355. const a = (f = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : f.map((S) => S.range), c = a == null ? void 0 : a.find((S) => {
  19356. const b = fo(t.x, t.y, t.scene, t.skeleton), v = t.skeleton.getCellWithCoordByIndex(S.endRow, S.endColumn), _ = Math.abs(v.endX - b.x), R = Math.abs(v.endY - b.y);
  19357. return _ <= 5 && R <= 5;
  19358. });
  19359. if (!c)
  19360. return !0;
  19361. const { startRow: d, endRow: u, startColumn: h, endColumn: m } = c;
  19362. for (let S = d; S <= u; S++)
  19363. for (let b = h; b <= m; b++) {
  19364. const v = (p = (g = s.getCell(S, b)) == null ? void 0 : g.selectionProtection) == null ? void 0 : p[0];
  19365. if ((v == null ? void 0 : v[de.Edit]) === !1 || (v == null ? void 0 : v[de.View]) === !1)
  19366. return !1;
  19367. }
  19368. return !0;
  19369. }
  19370. })
  19371. );
  19372. }
  19373. _initRangeMovePermissionInterceptor() {
  19374. this.disposeWithMe(
  19375. this._selectionRenderService.interceptor.intercept(this._selectionRenderService.interceptor.getInterceptPoints().RANGE_MOVE_PERMISSION_CHECK, {
  19376. handler: (e, t) => {
  19377. var h;
  19378. const n = Ue(this._univerInstanceService);
  19379. if (!n)
  19380. return !1;
  19381. const { worksheet: s, unitId: i, subUnitId: o } = n;
  19382. if (!this._permissionService.composePermission([new q(i).id, new ee(i, o).id]).every((m) => m.value))
  19383. return !1;
  19384. const a = (h = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : h.map((m) => m.range), c = this._rangeProtectionRuleModel.getSubunitRuleList(i, o).reduce((m, f) => [...m, ...f.ranges], []), d = a == null ? void 0 : a.filter((m) => c.some((f) => ae.intersects(f, m)));
  19385. return !(d == null ? void 0 : d.some((m) => {
  19386. var b, v;
  19387. const { startRow: f, startColumn: g, endRow: p, endColumn: S } = m;
  19388. for (let _ = f; _ <= p; _++)
  19389. for (let R = g; R <= S; R++) {
  19390. const I = (v = (b = s.getCell(_, R)) == null ? void 0 : b.selectionProtection) == null ? void 0 : v[0];
  19391. if ((I == null ? void 0 : I[de.Edit]) === !1)
  19392. return !0;
  19393. }
  19394. return !1;
  19395. }));
  19396. }
  19397. })
  19398. );
  19399. }
  19400. _initFreezePermissionInterceptor() {
  19401. this.disposeWithMe(
  19402. this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, {
  19403. handler: (e, t) => {
  19404. var o, l;
  19405. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET);
  19406. return !(n == null ? void 0 : n.getActiveSheet()) || !n ? !1 : (l = (o = this._permissionService.getPermissionPoint(new q(n.getUnitId()).id)) == null ? void 0 : o.value) != null ? l : !1;
  19407. }
  19408. })
  19409. );
  19410. }
  19411. };
  19412. rl = ky([
  19413. _n(1, L),
  19414. _n(2, $e),
  19415. _n(3, D($)),
  19416. _n(4, D(Ye)),
  19417. _n(5, D(mi)),
  19418. _n(6, dt),
  19419. _n(7, D(hi)),
  19420. _n(8, D(Vl)),
  19421. _n(9, Jc(jo))
  19422. ], rl);
  19423. var Dy = Object.defineProperty, Ly = Object.getOwnPropertyDescriptor, Wy = (r, e, t, n) => {
  19424. for (var s = n > 1 ? void 0 : n ? Ly(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  19425. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  19426. return n && s && Dy(e, t, s), s;
  19427. }, Vs = (r, e) => (t, n) => e(t, n, r);
  19428. const By = "SHEET_PERMISSION_PASTE_PLUGIN";
  19429. let Ii = class extends ce {
  19430. constructor(e, t, n, s, i) {
  19431. super();
  19432. w(this, "disposableCollection", new St());
  19433. this._univerInstanceService = e, this._selectionManagerService = t, this._localService = n, this._sheetClipboardService = s, this._sheetPermissionCheckController = i, this._initClipboardHook();
  19434. }
  19435. _initClipboardHook() {
  19436. this.disposeWithMe(
  19437. this._sheetClipboardService.addClipboardHook({
  19438. id: By,
  19439. onBeforePaste: (e) => {
  19440. var h, m, f;
  19441. const [t] = _s([e.range]).ranges, n = (h = this._selectionManagerService.getCurrentLastSelection()) == null ? void 0 : h.range;
  19442. if (!n)
  19443. return !1;
  19444. const s = {
  19445. startRow: n.startRow + t.startRow,
  19446. endRow: n.startRow + t.endRow,
  19447. startColumn: n.startColumn + t.startColumn,
  19448. endColumn: n.startColumn + t.endColumn
  19449. }, o = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet();
  19450. if (!o)
  19451. return !1;
  19452. const { startRow: l, endRow: a, startColumn: c, endColumn: d } = s;
  19453. let u = !0;
  19454. for (let g = l; g <= a; g++)
  19455. for (let p = c; p <= d; p++) {
  19456. const S = (f = (m = o.getCell(g, p)) == null ? void 0 : m.selectionProtection) == null ? void 0 : f[0];
  19457. if ((S == null ? void 0 : S[de.Edit]) === !1) {
  19458. u = !1;
  19459. break;
  19460. }
  19461. }
  19462. return u || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localService.t("permission.dialog.pasteErr")), u;
  19463. }
  19464. })
  19465. );
  19466. }
  19467. };
  19468. Ii = Wy([
  19469. Vs(0, L),
  19470. Vs(1, D($)),
  19471. Vs(2, D(Ee)),
  19472. Vs(3, D(Sn)),
  19473. Vs(4, D(Om))
  19474. ], Ii);
  19475. var Fy = Object.defineProperty, Uy = Object.getOwnPropertyDescriptor, jy = (r, e, t, n) => {
  19476. for (var s = n > 1 ? void 0 : n ? Uy(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  19477. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  19478. return n && s && Fy(e, t, s), s;
  19479. }, ks = (r, e) => (t, n) => e(t, n, r);
  19480. const Xy = sr("statusBarPermissionCorrect");
  19481. class zy {
  19482. constructor() {
  19483. w(this, "_sum", 0);
  19484. w(this, "_count", 0);
  19485. w(this, "_countNumber", 0);
  19486. w(this, "_min", Number.POSITIVE_INFINITY);
  19487. w(this, "_max", Number.NEGATIVE_INFINITY);
  19488. }
  19489. add(e) {
  19490. const t = e == null ? void 0 : e.v, n = e == null ? void 0 : e.t;
  19491. t != null && (typeof t == "number" && n !== ln.STRING && (this._sum += t, this._countNumber++, this._min = Math.min(this._min, t), this._max = Math.max(this._max, t)), this._count++);
  19492. }
  19493. getResults() {
  19494. return {
  19495. sum: this._sum,
  19496. count: this._countNumber,
  19497. // the countA in formula is the count of all values
  19498. countA: this._count,
  19499. min: this._min,
  19500. max: this._max
  19501. };
  19502. }
  19503. }
  19504. function Yy(r) {
  19505. const { sum: e, count: t, countA: n, min: s, max: i } = r.getResults();
  19506. return [
  19507. {
  19508. func: Fe.MAX,
  19509. value: i
  19510. },
  19511. {
  19512. func: Fe.MIN,
  19513. value: s
  19514. },
  19515. {
  19516. func: Dl.SUM,
  19517. value: e
  19518. },
  19519. {
  19520. func: Fe.COUNTA,
  19521. value: n
  19522. },
  19523. {
  19524. func: Fe.COUNT,
  19525. value: t
  19526. },
  19527. {
  19528. func: Fe.AVERAGE,
  19529. value: e / t
  19530. }
  19531. ];
  19532. }
  19533. let ps = class extends ce {
  19534. constructor(e, t, n, s, i) {
  19535. super();
  19536. w(this, "interceptor", new Cs({ STATUS_BAR_PERMISSION_CORRECT: Xy }));
  19537. this._univerInstanceService = e, this._selectionManagerService = t, this._statusBarService = n, this._commandService = s, this._numfmtService = i, this._init();
  19538. }
  19539. _init() {
  19540. this._registerSelectionListener();
  19541. }
  19542. _registerSelectionListener() {
  19543. const e = Fh((t) => {
  19544. var s;
  19545. const n = (s = t[t.length - 1]) == null ? void 0 : s.primary;
  19546. this._calculateSelection(
  19547. t.map((i) => i.range),
  19548. n
  19549. );
  19550. }, 100);
  19551. this.disposeWithMe(
  19552. Ae(
  19553. this._selectionManagerService.selectionMoving$.subscribe((t) => {
  19554. t && e(t);
  19555. })
  19556. )
  19557. ), this.disposeWithMe(
  19558. Ae(
  19559. this._selectionManagerService.selectionMoveEnd$.subscribe((t) => {
  19560. t && e(t);
  19561. })
  19562. )
  19563. ), this.disposeWithMe(
  19564. this._commandService.onCommandExecuted((t) => {
  19565. if (t.id === Se.id) {
  19566. const n = this._selectionManagerService.getCurrentSelections();
  19567. n && e(n);
  19568. }
  19569. })
  19570. );
  19571. }
  19572. _clearResult() {
  19573. this._statusBarService.setState(null);
  19574. }
  19575. getRangeStartEndInfo(e, t) {
  19576. return e.rangeType === j.ALL ? {
  19577. startRow: 0,
  19578. startColumn: 0,
  19579. endRow: t.getRowCount() - 1,
  19580. endColumn: t.getColumnCount() - 1
  19581. } : e.rangeType === j.COLUMN ? {
  19582. startRow: 0,
  19583. startColumn: e.startColumn,
  19584. endRow: t.getRowCount() - 1,
  19585. endColumn: e.endColumn
  19586. } : e.rangeType === j.ROW ? {
  19587. startRow: e.startRow,
  19588. startColumn: 0,
  19589. endRow: e.endRow,
  19590. endColumn: t.getColumnCount() - 1
  19591. } : {
  19592. startRow: e.startRow,
  19593. startColumn: e.startColumn,
  19594. endRow: e.endRow,
  19595. endColumn: e.endColumn
  19596. };
  19597. }
  19598. // eslint-disable-next-line max-lines-per-function
  19599. _calculateSelection(e, t) {
  19600. var a;
  19601. const n = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET);
  19602. if (!n)
  19603. return this._clearResult();
  19604. const s = n.getUnitId(), i = n.getActiveSheet(), o = i == null ? void 0 : i.getSheetId();
  19605. if (!o)
  19606. return this._clearResult();
  19607. const l = {};
  19608. if (this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET).getSheets().forEach((c) => {
  19609. const d = c.getConfig();
  19610. l[c.getSheetId()] = {
  19611. cellData: new Ke(d.cellData),
  19612. rowCount: d.rowCount,
  19613. columnCount: d.columnCount,
  19614. rowData: d.rowData,
  19615. columnData: d.columnData
  19616. };
  19617. }), e != null && e.length) {
  19618. const c = [];
  19619. e.forEach((p) => {
  19620. const { startRow: S, endRow: b } = p;
  19621. let v = null;
  19622. for (let _ = S; _ <= b; _++)
  19623. i.getRowVisible(_) ? v === null && (v = _) : v !== null && (c.push({ ...p, startRow: v, endRow: _ - 1 }), v = null);
  19624. v !== null && c.push({ ...p, startRow: v, endRow: b });
  19625. });
  19626. const d = Gp(c), u = new zy();
  19627. for (const p of d) {
  19628. const { startRow: S, startColumn: b, endColumn: v, endRow: _ } = this.getRangeStartEndInfo(p, i);
  19629. for (let R = S; R <= _; R++)
  19630. for (let I = b; I <= v; I++) {
  19631. const y = i.getCell(R, I);
  19632. u.add(y);
  19633. }
  19634. }
  19635. const h = Yy(u);
  19636. if (h.every((p) => p === void 0))
  19637. return;
  19638. let m = null;
  19639. if (t) {
  19640. const { actualRow: p, actualColumn: S } = t;
  19641. m = (a = this._numfmtService.getValue(s, o, p, S)) == null ? void 0 : a.pattern;
  19642. }
  19643. const g = {
  19644. values: h.filter((p) => p !== void 0),
  19645. pattern: m
  19646. };
  19647. this._statusBarService.setState(g);
  19648. } else
  19649. this._clearResult();
  19650. }
  19651. };
  19652. ps = jy([
  19653. ks(0, L),
  19654. ks(1, D($)),
  19655. ks(2, da),
  19656. ks(3, F),
  19657. ks(4, D(mC))
  19658. ], ps);
  19659. var Zy = Object.defineProperty, Gy = Object.getOwnPropertyDescriptor, qy = (r, e, t, n) => {
  19660. for (var s = n > 1 ? void 0 : n ? Gy(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  19661. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  19662. return n && s && Zy(e, t, s), s;
  19663. }, so = (r, e) => (t, n) => e(t, n, r);
  19664. let sl = class extends kn {
  19665. constructor(e, t, n, s, i) {
  19666. super();
  19667. w(this, "disposableCollection", new St());
  19668. this._context = e, this._univerInstanceService = t, this._permissionService = n, this._statusBarController = s, this._rangeProtectionCache = i, this._initStatusBarPermissionInterceptor();
  19669. }
  19670. _initStatusBarPermissionInterceptor() {
  19671. this.disposeWithMe(
  19672. this._statusBarController.interceptor.intercept(this._statusBarController.interceptor.getInterceptPoints().STATUS_BAR_PERMISSION_CORRECT, {
  19673. priority: 100,
  19674. handler: (e, t) => {
  19675. var a;
  19676. const n = Ue(this._univerInstanceService);
  19677. if (!n)
  19678. return e != null ? e : [];
  19679. const { worksheet: s, unitId: i, subUnitId: o } = n;
  19680. return ((a = this._permissionService.getPermissionPoint(new fC(i, o).id)) == null ? void 0 : a.value) === !1 ? t.forEach((c) => {
  19681. const d = c.getArrayValue();
  19682. d.forEach((u, h) => {
  19683. u.forEach((m, f) => {
  19684. d[h][f] = Ru.create();
  19685. });
  19686. });
  19687. }) : t.forEach((c) => {
  19688. const d = c.getArrayValue(), u = c.getCurrentRow(), h = c.getCurrentColumn();
  19689. d.forEach((m, f) => {
  19690. m.forEach((g, p) => {
  19691. var v;
  19692. if (((v = s.getCellRaw(f + u, p + h)) == null ? void 0 : v.v) === void 0)
  19693. return;
  19694. const b = this._rangeProtectionCache.getCellInfo(i, o, f + u, p + h);
  19695. (b == null ? void 0 : b[de.View]) === !1 && (d[f][p] = Ru.create());
  19696. });
  19697. });
  19698. }), t;
  19699. }
  19700. })
  19701. );
  19702. }
  19703. };
  19704. sl = qy([
  19705. so(1, L),
  19706. so(2, $e),
  19707. so(3, D(ps)),
  19708. so(4, D(Vl))
  19709. ], sl);
  19710. const tp = (r, e, t, n, s) => {
  19711. const i = r.get(Ee), o = r.get(ft), l = r.get(Ye);
  19712. let a = "";
  19713. if (e.length === 0)
  19714. a = i.t("permission.panel.emptyRangeError");
  19715. else if (e.length > 1) {
  19716. let c = !1;
  19717. for (let d = 0; d < e.length; d++) {
  19718. for (let u = d + 1; u < e.length; u++)
  19719. if (ae.intersects(e[d], e[u])) {
  19720. c = !0;
  19721. break;
  19722. }
  19723. if (c)
  19724. break;
  19725. }
  19726. c && (a = i.t("permission.panel.rangeOverlapError"));
  19727. }
  19728. if (!a) {
  19729. if (o.getRule(n, s) && !t)
  19730. return a = i.t("permission.panel.rangeOverlapOverPermissionError"), a;
  19731. const d = l.getSubunitRuleList(n, s).filter((h) => h.permissionId !== t).find((h) => h.ranges.some((m) => e.some((f) => ae.intersects(m, f))));
  19732. (d == null ? void 0 : d.ranges.find((h) => e.some((m) => ae.intersects(h, m)))) && (a = i.t("permission.panel.rangeOverlapOverPermissionError"));
  19733. }
  19734. return a === "" ? void 0 : a;
  19735. }, Qy = (r, e) => {
  19736. if (r.length !== 1)
  19737. return !1;
  19738. const t = r[0], n = e.getRowCount(), s = e.getColumnCount(), { startRow: i, endRow: o, startColumn: l, endColumn: a } = t;
  19739. return i === 0 && l === 0 && o === n - 1 && a === s - 1;
  19740. }, Ky = (r, e) => {
  19741. var a, c;
  19742. const t = r.get(L), n = r.get($), s = t.getCurrentUnitForType(O.UNIVER_SHEET), i = s.getActiveSheet();
  19743. let o = At.SelectRange, l = (c = (a = n.getCurrentSelections()) == null ? void 0 : a.map((d) => d.range)) != null ? c : [];
  19744. return e && (o = At.Worksheet, l = [{
  19745. startRow: 0,
  19746. startColumn: 0,
  19747. endRow: i.getRowCount() - 1,
  19748. endColumn: i.getColumnCount() - 1,
  19749. rangeType: j.ALL
  19750. }]), {
  19751. unitId: s.getUnitId(),
  19752. subUnitId: i.getSheetId(),
  19753. permissionId: "",
  19754. unitType: o,
  19755. description: "",
  19756. id: "",
  19757. ranges: l,
  19758. editState: on.OnlyMe,
  19759. viewState: ls.OthersCanView
  19760. };
  19761. }, Jy = (r, e) => {
  19762. const s = r.get(L).getCurrentUnitForType(O.UNIVER_SHEET).getActiveSheet(), { unitType: i } = e;
  19763. return i === At.Worksheet ? {
  19764. ...e,
  19765. ranges: [{
  19766. startRow: 0,
  19767. startColumn: 0,
  19768. endRow: s.getRowCount() - 1,
  19769. endColumn: s.getColumnCount() - 1,
  19770. rangeType: j.ALL
  19771. }]
  19772. } : e;
  19773. }, $y = "univer-permission-panel-detail-wrapper", eM = "univer-radio-group-vertical", tM = "univer-sheet-permission-design-person-panel", nM = "univer-sheet-permission-design-person-panel-header", rM = "univer-sheet-permission-design-person-panel-header-add", sM = "univer-sheet-permission-design-person-panel-split", iM = "univer-sheet-permission-design-person-panel-content-item", oM = "univer-sheet-permission-design-person-panel-content-item-name", lM = "univer-sheet-permission-design-person-panel-content-item-select", aM = "univer-sheet-permission-design-person-panel-content", cM = "univer-sheet-permission-user-list-empty", dM = "univer-sheet-permission-user-list-empty-text", uM = "univer-sheet-permission-panel-title", hM = "univer-sheet-permission-panel-footer", mM = "univer-permission-range-selector", fM = "univer-permission-range-selector-error", gM = "univer-sheet-permission-panel-name-input-error", pM = "univer-permission-range-selector-error-text", SM = "univer-sheet-permission-panel-name-input-error-text", nt = {
  19774. permissionPanelDetailWrapper: $y,
  19775. radioGroupVertical: eM,
  19776. sheetPermissionDesignPersonPanel: tM,
  19777. sheetPermissionDesignPersonPanelHeader: nM,
  19778. sheetPermissionDesignPersonPanelHeaderAdd: rM,
  19779. sheetPermissionDesignPersonPanelSplit: sM,
  19780. sheetPermissionDesignPersonPanelContentItem: iM,
  19781. sheetPermissionDesignPersonPanelContentItemName: oM,
  19782. sheetPermissionDesignPersonPanelContentItemSelect: lM,
  19783. sheetPermissionDesignPersonPanelContent: aM,
  19784. sheetPermissionUserListEmpty: cM,
  19785. sheetPermissionUserListEmptyText: dM,
  19786. sheetPermissionPanelTitle: uM,
  19787. sheetPermissionPanelFooter: hM,
  19788. permissionRangeSelector: mM,
  19789. permissionRangeSelectorError: fM,
  19790. sheetPermissionPanelNameInputError: gM,
  19791. permissionRangeSelectorErrorText: pM,
  19792. sheetPermissionPanelNameInputErrorText: SM
  19793. }, CM = (r) => {
  19794. const { viewState: e, editState: t, permissionId: n, ranges: s, rangesErrMsg: i, desc: o, oldRule: l, id: a } = r, c = W(gs), d = W(vs), u = W(bl), h = W(Ee), m = W(F), f = W(Vr), p = W(L).getCurrentUnitForType(O.UNIVER_SHEET), S = p == null ? void 0 : p.getActiveSheet();
  19795. if (!p || !S)
  19796. return null;
  19797. const b = p.getUnitId(), v = S.getSheetId();
  19798. return /* @__PURE__ */ C.jsxs("div", { className: nt.sheetPermissionPanelFooter, children: [
  19799. /* @__PURE__ */ C.jsx(
  19800. fn,
  19801. {
  19802. type: "primary",
  19803. onClick: async () => {
  19804. if (i) return;
  19805. const _ = {
  19806. unitId: b,
  19807. subUnitId: v,
  19808. permissionId: n,
  19809. id: a,
  19810. viewState: e,
  19811. editState: t,
  19812. unitType: At.SelectRange,
  19813. ranges: s,
  19814. description: o
  19815. };
  19816. Qy(s, S) && (_.unitType = At.Worksheet, _.ranges = []);
  19817. let I = f.selectUserList;
  19818. _.editState === on.OnlyMe && (I = [], f.setSelectUserList([]));
  19819. const y = {
  19820. read: _.viewState === ls.OthersCanView ? rn.AllCollaborator : rn.SomeCollaborator,
  19821. edit: _.editState === on.DesignedUserCanEdit ? rn.SomeCollaborator : rn.OneSelf
  19822. };
  19823. if (_.editState === on.DesignedUserCanEdit && I.length === 0 && (I = [], y.edit = rn.OneSelf), _.permissionId) {
  19824. const P = Y_(I.filter((x) => x.role === Nt.Editor), f.oldCollaboratorList.filter((x) => x.role === Nt.Editor)), E = (l == null ? void 0 : l.viewState) === _.viewState, T = (l == null ? void 0 : l.editState) === _.editState, A = _.unitType === (l == null ? void 0 : l.unitType) && _.description === l.description && _.ranges === l.ranges, H = !P || !E || !T;
  19825. if (A && H)
  19826. await u.update({
  19827. objectType: _.unitType,
  19828. objectID: _.permissionId,
  19829. unitID: _.unitId,
  19830. share: void 0,
  19831. name: "",
  19832. strategies: [],
  19833. scope: y,
  19834. collaborators: {
  19835. collaborators: I
  19836. }
  19837. });
  19838. else {
  19839. let x = _.permissionId;
  19840. H && (_.unitType === At.Worksheet ? x = await u.create({
  19841. worksheetObject: {
  19842. collaborators: I,
  19843. unitID: _.unitId,
  19844. name: "",
  19845. strategies: [{ role: Nt.Editor, action: de.Edit }, { role: Nt.Reader, action: de.View }],
  19846. scope: y
  19847. },
  19848. objectType: At.Worksheet
  19849. }) : x = await u.create({
  19850. selectRangeObject: {
  19851. collaborators: I,
  19852. unitID: _.unitId,
  19853. name: "",
  19854. scope: y
  19855. },
  19856. objectType: At.SelectRange
  19857. })), m.executeCommand(gC.id, {
  19858. rule: {
  19859. ..._,
  19860. permissionId: x
  19861. },
  19862. oldRule: l
  19863. });
  19864. }
  19865. } else if (_.unitType === At.Worksheet) {
  19866. const P = await u.create({
  19867. worksheetObject: {
  19868. collaborators: I,
  19869. unitID: _.unitId,
  19870. name: "",
  19871. strategies: [{ role: Nt.Editor, action: de.Edit }, { role: Nt.Reader, action: de.View }],
  19872. scope: y
  19873. },
  19874. objectType: At.Worksheet
  19875. }), { ranges: E = [], ...T } = _;
  19876. T.permissionId = P, m.executeCommand(Cm.id, {
  19877. rule: T,
  19878. unitId: _.unitId
  19879. });
  19880. } else if (_.unitType === At.SelectRange) {
  19881. const P = await u.create({
  19882. selectRangeObject: {
  19883. collaborators: I,
  19884. unitID: _.unitId,
  19885. name: "",
  19886. scope: y
  19887. },
  19888. objectType: At.SelectRange
  19889. });
  19890. m.executeCommand(pC.id, {
  19891. rule: _,
  19892. permissionId: P
  19893. });
  19894. }
  19895. const M = {
  19896. header: { title: `${h.t("permission.panel.title")}` },
  19897. children: {
  19898. label: fi,
  19899. showDetail: !1
  19900. },
  19901. width: 330
  19902. };
  19903. d.open(M);
  19904. },
  19905. children: h.t("permission.button.confirm")
  19906. }
  19907. ),
  19908. /* @__PURE__ */ C.jsx(
  19909. fn,
  19910. {
  19911. className: nt.sheetPermissionPanelFooterCancel,
  19912. onClick: () => {
  19913. c.reset(), f.reset(), d.close();
  19914. },
  19915. children: h.t("permission.button.cancel")
  19916. }
  19917. )
  19918. ] });
  19919. }, vM = (r) => {
  19920. const { ranges: e, onRangesChange: t, rangeSelectorRef: n, desc: s, onDescChange: i, rangesErrMsg: o, isFocusRangeSelector: l, permissionId: a, onFocus: c } = r, d = W(Dn), u = sn(() => d.get(Jm), []), h = W(L), m = W(Ee), f = W(vt), g = h.getCurrentUnitForType(O.UNIVER_SHEET), p = g == null ? void 0 : g.getActiveSheet();
  19921. if (!g || !p)
  19922. return null;
  19923. const S = g.getUnitId(), b = p.getSheetId(), v = (_) => {
  19924. const R = _.split(",").map(Fm).map((A) => A.range);
  19925. if (R.some((A) => !qp(A) || A.endColumn < A.startColumn || A.endRow < A.startRow))
  19926. return;
  19927. const I = h.getCurrentUnitForType(O.UNIVER_SHEET), y = I == null ? void 0 : I.getActiveSheet();
  19928. if (!I || !y)
  19929. return;
  19930. const M = I.getUnitId(), P = y.getSheetId(), E = R.map((A) => {
  19931. const H = y.getRowCount(), x = y.getColumnCount();
  19932. return SC(A, H, x), A;
  19933. }), T = tp(f, E, a, M, P);
  19934. t(E, T);
  19935. };
  19936. return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
  19937. /* @__PURE__ */ C.jsx(To, { className: nt.sheetPermissionPanelTitle, label: m.t("permission.panel.protectedRange"), children: u && /* @__PURE__ */ C.jsx(
  19938. u,
  19939. {
  19940. unitId: S,
  19941. errorText: o,
  19942. subUnitId: b,
  19943. initValue: e == null ? void 0 : e.map((_) => Bm(_)).join(","),
  19944. onChange: v,
  19945. onFocus: c,
  19946. isFocus: l,
  19947. actions: n.current
  19948. }
  19949. ) }),
  19950. /* @__PURE__ */ C.jsx(To, { className: nt.sheetPermissionPanelTitle, label: m.t("permission.panel.permissionDirection"), children: /* @__PURE__ */ C.jsx(
  19951. ti,
  19952. {
  19953. value: s,
  19954. onChange: (_) => i(_),
  19955. placeholder: m.t("permission.panel.permissionDirectionPlaceholder")
  19956. }
  19957. ) })
  19958. ] });
  19959. }, bM = (r) => {
  19960. var _, R;
  19961. const { fromSheetBar: e, rule: t, oldRule: n } = r, s = W(vt), i = t ? Jy(s, t) : Ky(s, e), [o, l] = te(i.ranges), [a, c] = te(() => tp(s, i.ranges, i.permissionId, i.unitId, i.subUnitId)), [d, u] = te(i.description), [h, m] = te((_ = i.editState) != null ? _ : on.OnlyMe), [f, g] = te((R = i.viewState) != null ? R : ls.OthersCanView), p = xn({}), [S, b] = te(!1);
  19962. wo((I) => {
  19963. var M;
  19964. const y = (M = p.current) == null ? void 0 : M.handleOutClick;
  19965. y && y(I, () => b(!1));
  19966. });
  19967. const v = Gh(Dc);
  19968. return be(() => {
  19969. const I = s.get(L), y = s.get(vs), M = I.getCurrentUnitForType(O.UNIVER_SHEET);
  19970. if (!M) return;
  19971. const P = M.getActiveSheet().getSheetId(), E = M.activeSheet$.subscribe((T) => {
  19972. (T == null ? void 0 : T.getSheetId()) !== P && y.close();
  19973. });
  19974. return () => {
  19975. E.unsubscribe();
  19976. };
  19977. }, []), /* @__PURE__ */ C.jsxs("div", { className: nt.permissionPanelDetailWrapper, children: [
  19978. /* @__PURE__ */ C.jsx(
  19979. vM,
  19980. {
  19981. onFocus: () => b(!0),
  19982. permissionId: i.permissionId,
  19983. ranges: o,
  19984. onRangesChange: (I, y) => {
  19985. l(I), c(y);
  19986. },
  19987. isFocusRangeSelector: S,
  19988. rangesErrMsg: a,
  19989. desc: d,
  19990. onDescChange: (I) => u(I),
  19991. rangeSelectorRef: p
  19992. }
  19993. ),
  19994. /* @__PURE__ */ C.jsx(
  19995. qh,
  19996. {
  19997. components: v,
  19998. sharedProps: {
  19999. editState: h,
  20000. onEditStateChange: (I) => m(I),
  20001. viewState: f,
  20002. onViewStateChange: (I) => g(I),
  20003. permissionId: i.permissionId
  20004. }
  20005. },
  20006. "user-part"
  20007. ),
  20008. /* @__PURE__ */ C.jsx(
  20009. CM,
  20010. {
  20011. permissionId: i.permissionId,
  20012. id: i.id,
  20013. ranges: o,
  20014. rangesErrMsg: a,
  20015. desc: d,
  20016. viewState: f,
  20017. editState: h,
  20018. oldRule: n
  20019. }
  20020. )
  20021. ] });
  20022. }, _M = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADxCAYAAAATKWQfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KADAAQAAAABAAAA8QAAAAAQiyznAABAAElEQVR4Aey9e6wnyXXf192/1/397p2ZO7s73If3MWuRSy4pC0uL1oOSrF0lsgXZECVZDBDJiZZ2RMaURIsEKUpKAA9hWLRNmaTWsQ0SCCgFDmBTgCkGQYAgf2gUx69YiUcBKFGm5B1Jq10ud3fe9/V7dOf7OVWnb/363jucfc2dR9XM/VXVOadOVZ/urm+fqurqosghWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgWyBbIFsgW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Qv7k+Gu5Q1Ln/NmeN4ee/qxu7y0fmTu5anl68drY9PeEHoBDn6w53VZn/jaLU65gUofsf1eLc91QrwSC/I+i9fjkg4Sj4LvYDm1SDn8CZJJcGKxomJ+pYcnXip14p1WGuv1fxafXulTfKelawkleqOkgRbcrYMlokuStza6G0vQ7fMq4ayB5rSxYofu508j4bxl3RW8m0x6CsjpEdbyJvt/rp2gM8N22vXt0fnz/nFpO16yN+26n3gU53f9fBwevkZvwE2PNF/lcdd0T86AmcR6An4LCL9uiPwLUSAVfmlPz0+KbVkfSHD6ksv1jp4UnZyeVhcuytJ9viGMtxFtd3qL0lV/7Lq71bzy/qfI8XnartxI8nwkupecMv0cXL5q4sL773PyfWF54bFpYeir38T04RRP+sIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPQEegIdAQ6Ah2BjkBHoCPw5iLw/wCH3cvs3EDhsQAAAABJRU5ErkJggg==", wM = "univer-sheet-permission-list-panel-wrapper", RM = "univer-sheet-permission-list-panel-header", IM = "univer-sheet-permission-list-panel-header-type", yM = "univer-sheet-permission-list-panel-header-type-bottom", MM = "univer-sheet-permission-list-panel-header-select", PM = "univer-sheet-permission-list-item-header-icon", EM = "univer-sheet-permission-list-item", TM = "univer-sheet-permission-list-item-header", xM = "univer-sheet-permission-list-item-header-name", OM = "univer-sheet-permission-list-item-header-operator", AM = "univer-sheet-permission-list-item-split", NM = "univer-sheet-permission-list-item-content-edit", HM = "univer-sheet-permission-list-item-content-view", VM = "univer-sheet-permission-list-item-content-desc", kM = "univer-sheet-permission-list-empty", DM = "univer-sheet-permission-list-empty-text", LM = "univer-sheet-permission-list-item-content-title", WM = "univer-sheet-permission-list-item-content-sub", BM = "univer-sheet-permission-panel-add-wrapper", FM = "univer-sheet-permission-panel-add-button", je = {
  20023. sheetPermissionListPanelWrapper: wM,
  20024. sheetPermissionListPanelHeader: RM,
  20025. sheetPermissionListPanelHeaderType: IM,
  20026. sheetPermissionListPanelHeaderTypeBottom: yM,
  20027. sheetPermissionListPanelHeaderSelect: MM,
  20028. sheetPermissionListItemHeaderIcon: PM,
  20029. sheetPermissionListItem: EM,
  20030. sheetPermissionListItemHeader: TM,
  20031. sheetPermissionListItemHeaderName: xM,
  20032. sheetPermissionListItemHeaderOperator: OM,
  20033. sheetPermissionListItemSplit: AM,
  20034. sheetPermissionListItemContentEdit: NM,
  20035. sheetPermissionListItemContentView: HM,
  20036. sheetPermissionListItemContentDesc: VM,
  20037. sheetPermissionListEmpty: kM,
  20038. sheetPermissionListEmptyText: DM,
  20039. sheetPermissionListItemContentTitle: LM,
  20040. sheetPermissionListItemContentSub: WM,
  20041. sheetPermissionPanelAddWrapper: BM,
  20042. sheetPermissionPanelAddButton: FM
  20043. }, UM = () => {
  20044. var H;
  20045. const [r, e] = te(!0), [t, n] = te(!1), s = W(Ee), i = W(Ye), o = W(ft), l = W(L), a = W(F), c = W(vs), d = W(bl), u = W($e), m = W(Dt).getCurrentUser(), [f, g] = te([]), p = W(Vr), S = Yt(o.ruleRefresh$, ""), b = Yt(i.ruleRefresh$, ""), v = l.getCurrentUnitForType(O.UNIVER_SHEET);
  20046. if (!v)
  20047. return null;
  20048. const _ = v == null ? void 0 : v.getUnitId(), R = On(async (x) => {
  20049. var ve;
  20050. const k = v.getActiveSheet(), U = v.getUnitId(), V = k.getSheetId(), N = [], X = [];
  20051. v.getSheets().forEach((G) => {
  20052. const J = G.getSheetId();
  20053. i.getSubunitRuleList(U, J).forEach((Ze) => {
  20054. Ze.permissionId && N.push(Ze.permissionId);
  20055. });
  20056. const fe = o.getRule(U, J);
  20057. fe != null && fe.permissionId && X.push(fe.permissionId);
  20058. });
  20059. const Y = [...N, ...X], ie = await d.list({
  20060. objectIDs: Y,
  20061. unitID: U,
  20062. actions: CC
  20063. }), he = i.getSubunitRuleList(U, V).map((G) => G.permissionId), ne = (ve = o.getRule(U, V)) == null ? void 0 : ve.permissionId;
  20064. ne && he.push(ne);
  20065. const pe = ie.filter((G) => {
  20066. var J;
  20067. return he.includes(G.objectID) || G.objectID === ((J = o.getRule(U, V)) == null ? void 0 : J.permissionId);
  20068. });
  20069. return x ? pe : ie;
  20070. }, []), [I, y] = te([]);
  20071. be(() => {
  20072. const x = mt(
  20073. i.ruleChange$,
  20074. o.ruleChange$
  20075. ).subscribe(async () => {
  20076. const k = await R(r);
  20077. y(k);
  20078. });
  20079. return () => {
  20080. x.unsubscribe();
  20081. };
  20082. }, [r]), be(() => {
  20083. const x = v.activeSheet$.pipe(
  20084. cn((k, U) => (k == null ? void 0 : k.getSheetId()) === (U == null ? void 0 : U.getSheetId()))
  20085. ).subscribe(async () => {
  20086. const k = await R(r);
  20087. y(k);
  20088. });
  20089. return () => {
  20090. x.unsubscribe();
  20091. };
  20092. }, [r]), be(() => {
  20093. (async () => {
  20094. if (S || b) {
  20095. const k = await R(!0);
  20096. y(k);
  20097. }
  20098. })();
  20099. }, [S, b]);
  20100. const M = (x) => {
  20101. const { unitId: k, subUnitId: U, unitType: V } = x;
  20102. let N;
  20103. V === Mn.Worksheet ? N = a.executeCommand(Po.id, { unitId: k, subUnitId: U, rule: x }) : V === Mn.SelectRange && (N = a.executeCommand(vC.id, { unitId: k, subUnitId: U, rule: x })), N && (n(!t), x.ranges === f && g([]));
  20104. };
  20105. be(() => {
  20106. p.reset();
  20107. }, []), dI(f);
  20108. const P = /* @__PURE__ */ new Map();
  20109. v.getSheets().forEach((x) => {
  20110. const k = x.getSheetId();
  20111. i.getSubunitRuleList(_, k).forEach((N) => {
  20112. P.set(N.permissionId, N);
  20113. });
  20114. const V = o.getRule(_, k);
  20115. V && P.set(V == null ? void 0 : V.permissionId, V);
  20116. });
  20117. const E = (x) => {
  20118. x.subUnitId !== v.getActiveSheet().getSheetId() && a.executeCommand(et.id, {
  20119. unitId: x.unitId,
  20120. subUnitId: x.subUnitId
  20121. });
  20122. const k = {
  20123. header: { title: "permission.panel.title" },
  20124. children: {
  20125. label: fi,
  20126. showDetail: !0,
  20127. rule: se.deepClone(x),
  20128. oldRule: se.deepClone(x)
  20129. },
  20130. width: 330
  20131. };
  20132. c.open(k);
  20133. }, T = (x) => {
  20134. e(x);
  20135. }, A = (H = u.getPermissionPoint(new kl(_).id)) == null ? void 0 : H.value;
  20136. return /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListPanelWrapper, children: [
  20137. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListPanelHeader, children: [
  20138. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListPanelHeaderType, onClick: () => T(!0), children: [
  20139. /* @__PURE__ */ C.jsx("div", { className: st({ [je.sheetPermissionListPanelHeaderSelect]: r }), children: s.t("permission.panel.currentSheet") }),
  20140. r && /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListPanelHeaderTypeBottom })
  20141. ] }),
  20142. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListPanelHeaderType, onClick: () => T(!1), children: [
  20143. /* @__PURE__ */ C.jsx("div", { className: st({ [je.sheetPermissionListPanelHeaderSelect]: !r }), children: s.t("permission.panel.allSheet") }),
  20144. !r && /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListPanelHeaderTypeBottom })
  20145. ] })
  20146. ] }),
  20147. (I == null ? void 0 : I.length) > 0 ? /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListPanelContent, children: I == null ? void 0 : I.map((x) => {
  20148. var J, le, fe, Ze, lt;
  20149. const k = P.get(x.objectID);
  20150. if (!k)
  20151. return null;
  20152. const U = x.actions.find((Be) => Be.action === de.Edit), V = U == null ? void 0 : U.allowed, N = x.actions.find((Be) => Be.action === de.View), X = N == null ? void 0 : N.allowed, Y = x.actions.find((Be) => Be.action === de.ManageCollaborator), ie = x.actions.find((Be) => Be.action === de.Delete), he = (Y == null ? void 0 : Y.allowed) || m.userID === ((J = x.creator) == null ? void 0 : J.userID), ne = (ie == null ? void 0 : ie.allowed) || m.userID === ((le = x.creator) == null ? void 0 : le.userID);
  20153. let pe = "";
  20154. const ve = v.getSheetBySheetId(k.subUnitId), G = ve == null ? void 0 : ve.getName();
  20155. if (k.unitType === Mn.SelectRange) {
  20156. const Be = k.ranges, we = Be != null && Be.length ? Be.map((Ve) => {
  20157. const pt = Bm(Ve);
  20158. return pt === "NaN" ? "" : pt;
  20159. }).filter((Ve) => !!Ve).join(",") : "";
  20160. pe = `${G}(${we})`;
  20161. } else k.unitType === Mn.Worksheet && (pe = G || "");
  20162. return /* @__PURE__ */ C.jsxs(
  20163. "div",
  20164. {
  20165. className: je.sheetPermissionListItem,
  20166. onMouseMove: () => {
  20167. const { subUnitId: Be, unitType: we } = k, Ve = v.getActiveSheet();
  20168. if (!Ve)
  20169. return !1;
  20170. const pt = Ve.getSheetId();
  20171. if (Be !== pt)
  20172. return !1;
  20173. if (we === Mn.SelectRange) {
  20174. const bt = k.ranges || [];
  20175. bt !== f && g(bt);
  20176. } else if (we === Mn.Worksheet) {
  20177. const bt = [{ startRow: 0, endRow: Ve.getRowCount() - 1, startColumn: 0, endColumn: Ve.getColumnCount() - 1 }];
  20178. bt !== f && g(bt);
  20179. }
  20180. },
  20181. onMouseLeave: () => g([]),
  20182. children: [
  20183. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListItemHeader, children: [
  20184. /* @__PURE__ */ C.jsx(Gn, { title: pe, children: /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListItemHeaderName, children: pe }) }),
  20185. (he || ne) && /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListItemHeaderOperator, children: [
  20186. he && /* @__PURE__ */ C.jsx(Gn, { title: s.t("permission.panel.edit"), children: /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListItemHeaderIcon, onClick: () => E(k), children: /* @__PURE__ */ C.jsx(Zd, {}) }) }),
  20187. ne && /* @__PURE__ */ C.jsx(Gn, { title: s.t("permission.panel.delete"), children: /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListItemHeaderIcon, onClick: () => M(k), children: /* @__PURE__ */ C.jsx(ea, {}) }) })
  20188. ] })
  20189. ] }),
  20190. /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListItemSplit }),
  20191. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListItemContent, children: [
  20192. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListItemContentEdit, children: [
  20193. /* @__PURE__ */ C.jsx(Gn, { title: (Ze = (fe = x.creator) == null ? void 0 : fe.name) != null ? Ze : "", children: /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(Pd, { src: (lt = x.creator) == null ? void 0 : lt.avatar, style: { marginRight: 6 }, size: 24 }) }) }),
  20194. /* @__PURE__ */ C.jsx("span", { className: je.sheetPermissionListItemContentTitle, children: s.t("permission.panel.created") }),
  20195. /* @__PURE__ */ C.jsx("span", { className: je.sheetPermissionListItemContentSub, children: V ? `${s.t("permission.panel.iCanEdit")}` : `${s.t("permission.panel.iCanNotEdit")}` })
  20196. ] }),
  20197. /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListItemContentView, children: [
  20198. /* @__PURE__ */ C.jsx("span", { className: je.sheetPermissionListItemContentTitle, children: s.t("permission.panel.viewPermission") }),
  20199. /* @__PURE__ */ C.jsx("span", { className: je.sheetPermissionListItemContentSub, children: X ? `${s.t("permission.panel.iCanView")}` : `${s.t("permission.panel.iCanNotView")}` })
  20200. ] }),
  20201. k.description && /* @__PURE__ */ C.jsx(Gn, { title: k.description, children: /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionListItemContentDesc, children: k.description }) })
  20202. ] })
  20203. ]
  20204. },
  20205. x.objectID
  20206. );
  20207. }) }) : /* @__PURE__ */ C.jsxs("div", { className: je.sheetPermissionListEmpty, children: [
  20208. /* @__PURE__ */ C.jsx("img", { width: 240, height: 120, src: _M, alt: "" }),
  20209. /* @__PURE__ */ C.jsx("p", { className: je.sheetPermissionListEmptyText, children: s.t("permission.dialog.listEmpty") })
  20210. ] }),
  20211. A && /* @__PURE__ */ C.jsx("div", { className: je.sheetPermissionPanelAddWrapper, children: /* @__PURE__ */ C.jsxs(
  20212. fn,
  20213. {
  20214. className: je.sheetPermissionPanelAddButton,
  20215. type: "primary",
  20216. onClick: () => {
  20217. const x = {
  20218. header: { title: `${s.t("permission.panel.title")}` },
  20219. children: {
  20220. label: fi,
  20221. showDetail: !0
  20222. },
  20223. width: 330
  20224. };
  20225. c.open(x);
  20226. },
  20227. children: [
  20228. /* @__PURE__ */ C.jsx("div", { children: "+ " }),
  20229. s.t("permission.button.addNewPermission")
  20230. ]
  20231. }
  20232. ) })
  20233. ] });
  20234. }, jM = ({ showDetail: r, fromSheetBar: e, rule: t, oldRule: n }) => {
  20235. var u;
  20236. const s = W(L), i = W($);
  20237. if (!W(gs).getVisible()) return null;
  20238. const l = Ue(s);
  20239. if (!l) return null;
  20240. const { worksheet: a } = l, d = ((u = i.getCurrentSelections()) == null ? void 0 : u.map((h) => h.range)).reduce((h, m) => h + Wm(a.getName(), m), "");
  20241. return r ? /* @__PURE__ */ C.jsx(
  20242. bM,
  20243. {
  20244. fromSheetBar: e,
  20245. rule: t,
  20246. oldRule: n
  20247. },
  20248. e ? "sheet-bar" : "normal"
  20249. ) : /* @__PURE__ */ C.jsx(UM, {}, d);
  20250. }, XM = "univer-spin-container", zM = "univer-spin-overlay", YM = "univer-spinner", ZM = "univer-spin", GM = "univer-content-blur", io = {
  20251. spinContainer: XM,
  20252. spinOverlay: zM,
  20253. spinner: YM,
  20254. spin: ZM,
  20255. contentBlur: GM
  20256. }, qM = ({ loading: r, children: e }) => /* @__PURE__ */ C.jsxs("div", { className: io.spinContainer, children: [
  20257. r && /* @__PURE__ */ C.jsx("div", { className: io.spinOverlay, children: /* @__PURE__ */ C.jsx("div", { className: io.spinner }) }),
  20258. /* @__PURE__ */ C.jsx("div", { className: r ? io.contentBlur : "", children: e })
  20259. ] }), QM = "univer-sheet-permission-dialog-wrapper", KM = "univer-sheet-permission-dialog-split", JM = "univer-sheet-permission-dialog-item", $M = "univer-sheet-permission-user-dialog-footer", eP = "univer-sheet-permission-user-dialog-footer-confirm", tP = "univer-sheet-permission-user-dialog-button", zn = {
  20260. sheetPermissionDialogWrapper: QM,
  20261. sheetPermissionDialogSplit: KM,
  20262. sheetPermissionDialogItem: JM,
  20263. sheetPermissionUserDialogFooter: $M,
  20264. sheetPermissionUserDialogFooterConfirm: eP,
  20265. sheetPermissionUserDialogButton: tP
  20266. }, nP = () => {
  20267. const r = W(Ee), e = W(L), t = W(bl), n = W(bC), s = W(bs), i = W($e), o = e.getCurrentUnitForType(O.UNIVER_SHEET), l = o.getActiveSheet();
  20268. if (!l)
  20269. throw new Error("No active sheet found");
  20270. const [a, c] = te([]), d = W(F), [u, h] = te(() => !!n.getRule(o.getUnitId(), l.getSheetId())), [m, f] = te(() => Object.keys(eo).reduce((p, S) => (p[S] = {
  20271. text: r.t(`permission.panel.${eo[Number(S)]}`),
  20272. allowed: !0
  20273. }, p), {}));
  20274. be(() => {
  20275. (async () => {
  20276. const S = o.getUnitId(), b = await t.listCollaborators({
  20277. objectID: S,
  20278. unitID: S
  20279. });
  20280. c(b);
  20281. })();
  20282. }, []), be(() => {
  20283. (async () => {
  20284. const S = o.getUnitId(), b = n.getRule(S, l.getSheetId());
  20285. if (!b)
  20286. return;
  20287. h(!0);
  20288. const _ = (await t.list({
  20289. unitID: o.getUnitId(),
  20290. objectIDs: [b.permissionId],
  20291. actions: J_
  20292. }))[0].strategies.reduce((R, I) => (eo[I.action] && (R[I.action] = {
  20293. text: r.t(`permission.panel.${eo[I.action]}`),
  20294. allowed: I.role !== Nt.Owner
  20295. }), R), {});
  20296. f(_), setTimeout(() => {
  20297. h(!1);
  20298. }, 100);
  20299. })();
  20300. }, []);
  20301. const g = async () => {
  20302. const p = e.getCurrentUnitForType(O.UNIVER_SHEET), S = p == null ? void 0 : p.getActiveSheet();
  20303. if (!S)
  20304. throw new Error("No active sheet found");
  20305. const b = p.getUnitId(), v = S.getSheetId(), _ = n.getRule(b, v), R = Object.keys(m).map((y) => ({
  20306. action: Number(y),
  20307. role: m[y].allowed ? Nt.Editor : Nt.Owner
  20308. }));
  20309. let I = _ == null ? void 0 : _.permissionId;
  20310. I ? t.update({
  20311. objectType: Mn.Worksheet,
  20312. objectID: I,
  20313. unitID: b,
  20314. strategies: R,
  20315. share: void 0,
  20316. name: "",
  20317. scope: {
  20318. read: rn.AllCollaborator,
  20319. edit: rn.AllCollaborator
  20320. },
  20321. collaborators: void 0
  20322. }).then(() => {
  20323. wC().forEach((y) => {
  20324. const M = new y(b, v), P = M.subType, E = R.find((T) => T.action === P);
  20325. E && i.updatePermissionPoint(M.id, E.role === Nt.Editor);
  20326. });
  20327. }) : (I = await t.create({
  20328. objectType: Mn.Worksheet,
  20329. worksheetObject: {
  20330. unitID: b,
  20331. collaborators: a,
  20332. name: "",
  20333. strategies: R,
  20334. scope: {
  20335. read: rn.AllCollaborator,
  20336. edit: rn.AllCollaborator
  20337. }
  20338. }
  20339. }), d.executeCommand(_C.id, {
  20340. rule: {
  20341. permissionId: I,
  20342. unitId: b,
  20343. subUnitId: v
  20344. }
  20345. }));
  20346. };
  20347. return /* @__PURE__ */ C.jsx(qM, { loading: u, children: /* @__PURE__ */ C.jsxs("div", { className: zn.sheetPermissionDialogWrapper, children: [
  20348. /* @__PURE__ */ C.jsx("div", { className: zn.sheetPermissionDialogSplit }),
  20349. Object.keys(m).map((p) => {
  20350. const S = m[p], { text: b, allowed: v } = S;
  20351. return /* @__PURE__ */ C.jsxs("div", { className: zn.sheetPermissionDialogItem, children: [
  20352. /* @__PURE__ */ C.jsx("div", { children: b }),
  20353. /* @__PURE__ */ C.jsx(
  20354. VC,
  20355. {
  20356. defaultChecked: v,
  20357. onChange: () => {
  20358. f({
  20359. ...m,
  20360. [p]: {
  20361. ...S,
  20362. allowed: !v
  20363. }
  20364. });
  20365. }
  20366. }
  20367. )
  20368. ] }, b);
  20369. }),
  20370. /* @__PURE__ */ C.jsx("div", { className: zn.sheetPermissionDialogSplit }),
  20371. /* @__PURE__ */ C.jsxs("div", { className: zn.sheetPermissionUserDialogFooter, children: [
  20372. /* @__PURE__ */ C.jsx(
  20373. fn,
  20374. {
  20375. className: zn.sheetPermissionUserDialogButton,
  20376. onClick: () => {
  20377. s.close(Yo);
  20378. },
  20379. children: r.t("permission.button.cancel")
  20380. }
  20381. ),
  20382. /* @__PURE__ */ C.jsx(
  20383. fn,
  20384. {
  20385. type: "primary",
  20386. onClick: () => {
  20387. g(), s.close(Yo);
  20388. },
  20389. className: st(zn.sheetPermissionUserDialogFooterConfirm, zn.sheetPermissionUserDialogButton),
  20390. children: r.t("permission.button.confirm")
  20391. }
  20392. )
  20393. ] })
  20394. ] }) });
  20395. }, np = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADwCAYAAADYdbe6AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KADAAQAAAABAAAA8AAAAAAt6wVXAABAAElEQVR4Aey9C5Rm11Xfee/3rEd3V78lWS2p5Qe2sAHxCGYWMMgrK8AAs0LWjDyTNcPDY7CHYTC2CWBw1rg8E3Bggh1kHMbMsGRWEmaWPQ8SB3AIGQsmLCDgxBjLOLZBJautV7f6UV2P73Xvnd9/n7u/OnW7qtVSV1VXS+dI9Z1z9tl7n332/fr87z733PNlWUrJA8kDyQPJA8kDy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7m1k7jtmpPWhVa19TCeFWv6xD6T9rm75P5KLhX42itRfK9l/4j3gHsGQIQgAAE7pLAsrCtjZe2DEJz1+azlj4EIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQgUAn8BrzesdviE5ggAAAAASUVORK5CYII=", rP = "univer-sheet-permission-user-dialog-wrapper", sP = "univer-sheet-permission-user-dialog-search-input", iP = "univer-sheet-permission-user-list", oP = "univer-sheet-permission-user-list-empty", lP = "univer-sheet-permission-user-list-empty-text", aP = "univer-sheet-permission-user-item", cP = "univer-sheet-permission-user-item-name", dP = "univer-sheet-permission-split", uP = "univer-sheet-permission-user-dialog-footer", hP = "univer-sheet-permission-user-dialog-footer-confirm", mP = "univer-sheet-permission-user-dialog-button", Ot = {
  20396. sheetPermissionUserDialogWrapper: rP,
  20397. sheetPermissionUserDialogSearchInput: sP,
  20398. sheetPermissionUserList: iP,
  20399. sheetPermissionUserListEmpty: oP,
  20400. sheetPermissionUserListEmptyText: lP,
  20401. sheetPermissionUserItem: aP,
  20402. sheetPermissionUserItemName: cP,
  20403. sheetPermissionSplit: dP,
  20404. sheetPermissionUserDialogFooter: uP,
  20405. sheetPermissionUserDialogFooterConfirm: hP,
  20406. sheetPermissionUserDialogButton: mP
  20407. }, fP = () => {
  20408. const [r, e] = od.useState(""), t = W(Ee), n = W(bs), s = W(Vr), o = s.userList.filter((d) => {
  20409. var u;
  20410. return ((u = d.subject) == null ? void 0 : u.name.toLocaleLowerCase().includes(r.toLocaleLowerCase())) && d.role === Nt.Editor;
  20411. }), [l, a] = te(s.selectUserList), c = (d) => {
  20412. if ((l == null ? void 0 : l.findIndex((h) => {
  20413. var m, f;
  20414. return ((m = h.subject) == null ? void 0 : m.userID) === ((f = d.subject) == null ? void 0 : f.userID);
  20415. })) === -1) {
  20416. const h = { ...d };
  20417. a([...l, h]);
  20418. } else {
  20419. const h = l.filter((m) => {
  20420. var f, g;
  20421. return ((f = m.subject) == null ? void 0 : f.userID) !== ((g = d.subject) == null ? void 0 : g.userID);
  20422. });
  20423. a(h);
  20424. }
  20425. };
  20426. return /* @__PURE__ */ C.jsxs("div", { className: Ot.sheetPermissionUserDialogWrapper, children: [
  20427. /* @__PURE__ */ C.jsx("div", { className: Ot.sheetPermissionUserDialogSearch, children: /* @__PURE__ */ C.jsx(
  20428. ti,
  20429. {
  20430. placeholder: t.t("permission.dialog.search"),
  20431. className: Ot.sheetPermissionUserDialogSearchInput,
  20432. value: r,
  20433. onChange: (d) => e(d)
  20434. }
  20435. ) }),
  20436. /* @__PURE__ */ C.jsx("div", { className: Ot.sheetPermissionUserList, children: (o == null ? void 0 : o.length) > 0 ? /* @__PURE__ */ C.jsx(C.Fragment, { children: o == null ? void 0 : o.map((d) => {
  20437. var u, h, m;
  20438. return /* @__PURE__ */ C.jsxs("div", { className: Ot.sheetPermissionUserItem, onClick: () => c(d), children: [
  20439. /* @__PURE__ */ C.jsx(Pd, { src: (u = d.subject) == null ? void 0 : u.avatar, size: 24 }),
  20440. /* @__PURE__ */ C.jsx("div", { className: Ot.sheetPermissionUserItemName, children: (h = d.subject) == null ? void 0 : h.name }),
  20441. (l == null ? void 0 : l.findIndex((f) => {
  20442. var g, p;
  20443. return ((g = f.subject) == null ? void 0 : g.userID) === ((p = d.subject) == null ? void 0 : p.userID);
  20444. })) !== -1 && /* @__PURE__ */ C.jsx("div", { children: /* @__PURE__ */ C.jsx(Hn, {}) })
  20445. ] }, (m = d.subject) == null ? void 0 : m.userID);
  20446. }) }) : /* @__PURE__ */ C.jsxs("div", { className: Ot.sheetPermissionUserListEmpty, children: [
  20447. /* @__PURE__ */ C.jsx("img", { width: 240, height: 120, src: np, alt: "" }),
  20448. /* @__PURE__ */ C.jsx("p", { className: Ot.sheetPermissionUserListEmptyText, children: t.t("permission.dialog.userEmpty") })
  20449. ] }) }),
  20450. /* @__PURE__ */ C.jsx("div", { className: Ot.sheetPermissionSplit }),
  20451. /* @__PURE__ */ C.jsxs("div", { className: Ot.sheetPermissionUserDialogFooter, children: [
  20452. /* @__PURE__ */ C.jsx(fn, { className: Ot.sheetPermissionUserDialogButton, onClick: () => n.close(zo), children: t.t("permission.button.cancel") }),
  20453. /* @__PURE__ */ C.jsx(
  20454. fn,
  20455. {
  20456. type: "primary",
  20457. onClick: () => {
  20458. s.setSelectUserList(l), n.close(zo);
  20459. },
  20460. className: st(Ot.sheetPermissionUserDialogFooterConfirm, Ot.sheetPermissionUserDialogButton),
  20461. children: t.t("permission.button.confirm")
  20462. }
  20463. )
  20464. ] })
  20465. ] });
  20466. }, gP = "univer-sheet-permission-alert-dialog", pP = "univer-sheet-permission-alert-dialog-title", SP = "univer-sheet-permission-alert-dialog-button", $a = {
  20467. sheetPermissionAlertDialog: gP,
  20468. sheetPermissionAlertDialogTitle: pP,
  20469. sheetPermissionAlertDialogButton: SP
  20470. }, CP = ({ errorMsg: r }) => {
  20471. const e = W(Ee), t = W(bs);
  20472. return /* @__PURE__ */ C.jsxs("div", { className: $a.sheetPermissionAlertDialog, children: [
  20473. /* @__PURE__ */ C.jsx("h1", { className: $a.sheetPermissionAlertDialogTitle, children: e.t("permission.dialog.alert") }),
  20474. /* @__PURE__ */ C.jsx("p", { children: r || e.t("permission.dialog.alertContent") }),
  20475. /* @__PURE__ */ C.jsx("div", { className: $a.sheetPermissionAlertDialogButton, children: /* @__PURE__ */ C.jsx(
  20476. fn,
  20477. {
  20478. type: "primary",
  20479. onClick: () => {
  20480. t.close(Bc);
  20481. },
  20482. children: e.t("permission.button.confirm")
  20483. }
  20484. ) })
  20485. ] });
  20486. }, rp = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy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() {
  20489. super();
  20490. w(this, "_pattern", null);
  20491. w(this, "_img", new Image());
  20492. w(this, "renderCache", /* @__PURE__ */ new Set());
  20493. this._img.src = rp;
  20494. }
  20495. clearCache() {
  20496. this.renderCache.clear();
  20497. }
  20498. draw(t, n, s) {
  20499. const { worksheet: i } = s;
  20500. i && (t.save(), this._pattern || (this._pattern = t.createPattern(this._img, "repeat")), this.renderCache.clear(), co.foreach(s.rowColumnSegment, (o, l) => {
  20501. if (!i.getRowVisible(o) || !i.getColVisible(l))
  20502. return;
  20503. const { selectionProtection: a = [] } = i.getCell(o, l) || {};
  20504. this._pattern && (t.fillStyle = this._pattern, a.forEach((c) => {
  20505. if (c.ruleId && this.shouldRender(c)) {
  20506. if (this.renderCache.has(c.ruleId))
  20507. return;
  20508. this.renderCache.add(c.ruleId), c.ranges.forEach((d) => {
  20509. const u = s.getCellWithCoordByIndex(d.startRow, d.startColumn, !1), h = s.getCellWithCoordByIndex(d.endRow, d.endColumn, !1);
  20510. t.fillRect(u.startX, u.startY, h.endX - u.startX, h.endY - u.startY);
  20511. });
  20512. }
  20513. }));
  20514. }), t.restore());
  20515. }
  20516. }
  20517. class _P extends op {
  20518. constructor() {
  20519. super();
  20520. w(this, "uKey", sp);
  20521. w(this, "Z_INDEX", vP);
  20522. }
  20523. shouldRender(t) {
  20524. return (t == null ? void 0 : t[de.View]) !== !1;
  20525. }
  20526. }
  20527. class wP extends op {
  20528. constructor() {
  20529. super();
  20530. w(this, "uKey", ip);
  20531. w(this, "Z_INDEX", bP);
  20532. }
  20533. shouldRender(t) {
  20534. return (t == null ? void 0 : t[de.View]) === !1;
  20535. }
  20536. }
  20537. const lp = "worksheet-protection", Mh = 25, RP = 80;
  20538. class IP extends Zh {
  20539. constructor() {
  20540. super();
  20541. w(this, "uKey", lp);
  20542. w(this, "Z_INDEX", Mh);
  20543. w(this, "_pattern");
  20544. w(this, "_img", new Image());
  20545. this._img.src = rp;
  20546. }
  20547. draw(t, n, s) {
  20548. const { worksheet: i } = s;
  20549. if (!i)
  20550. return !1;
  20551. t.save(), this._pattern || (this._pattern = t.createPattern(this._img, "repeat"));
  20552. const { startRow: o, startColumn: l, endRow: a, endColumn: c } = s.rowColumnSegment, d = s.getCellWithCoordByIndex(o, l, !1), u = s.getCellWithCoordByIndex(a, c, !1), { hasWorksheetRule: h = !1, selectionProtection: m = [] } = i.getCell(o, l) || {};
  20553. if (this._pattern) {
  20554. if (m.length > 0) {
  20555. const f = m[0];
  20556. (f == null ? void 0 : f[de.View]) ? this.setZIndex(Mh) : this.setZIndex(RP);
  20557. }
  20558. t.fillStyle = this._pattern, h && t.fillRect(d.startX, d.startY, u.endX - d.startX, u.endY - d.startY), t.restore();
  20559. }
  20560. }
  20561. setZIndex(t) {
  20562. this.Z_INDEX = t;
  20563. }
  20564. }
  20565. const yP = (r) => {
  20566. const { editState: e, onEditStateChange: t, viewState: n, onViewStateChange: s, permissionId: i } = r, o = W(Ee), l = W(bs), a = W(bl), c = W(Vr), d = W(Dt), u = W(L), h = is(c.selectUserList$, c.selectUserList), m = u.getCurrentUnitForType(O.UNIVER_SHEET), f = m == null ? void 0 : m.getActiveSheet();
  20567. if (!m || !f)
  20568. return null;
  20569. const g = m.getUnitId(), p = async () => {
  20570. const S = await a.listCollaborators({
  20571. objectID: g,
  20572. unitID: g
  20573. }), b = d.getCurrentUser();
  20574. c.setCanEditUserList(S.filter((v) => {
  20575. var _;
  20576. return ((_ = v.subject) == null ? void 0 : _.userID) !== b.userID;
  20577. })), l.open({
  20578. id: zo,
  20579. title: { title: "" },
  20580. children: { label: Qf },
  20581. width: 280,
  20582. destroyOnClose: !0,
  20583. onClose: () => l.close(zo),
  20584. className: "sheet-permission-user-dialog"
  20585. });
  20586. };
  20587. return be(() => {
  20588. i ? (async () => {
  20589. const v = (await a.listCollaborators({
  20590. objectID: i,
  20591. unitID: g
  20592. })).filter((_) => _.role === Nt.Editor);
  20593. v.length > 0 && t(on.DesignedUserCanEdit), c.setSelectUserList(v), c.setOldCollaboratorList(v);
  20594. })() : (c.setSelectUserList([]), c.setOldCollaboratorList([]));
  20595. }, []), /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
  20596. /* @__PURE__ */ C.jsx(To, { className: nt.sheetPermissionPanelTitle, label: o.t("permission.panel.editPermission"), children: /* @__PURE__ */ C.jsxs(
  20597. vc,
  20598. {
  20599. value: e,
  20600. onChange: (S) => t(S),
  20601. className: nt.radioGroupVertical,
  20602. children: [
  20603. /* @__PURE__ */ C.jsx(Zr, { value: on.OnlyMe, children: /* @__PURE__ */ C.jsx("span", { className: nt.text, children: o.t("permission.panel.onlyICanEdit") }) }),
  20604. /* @__PURE__ */ C.jsx(Zr, { value: on.DesignedUserCanEdit, children: /* @__PURE__ */ C.jsx("span", { className: nt.text, children: o.t("permission.panel.designedUserCanEdit") }) })
  20605. ]
  20606. }
  20607. ) }),
  20608. e === on.DesignedUserCanEdit && /* @__PURE__ */ C.jsxs("div", { className: nt.sheetPermissionDesignPersonPanel, children: [
  20609. /* @__PURE__ */ C.jsxs("div", { className: nt.sheetPermissionDesignPersonPanelHeader, children: [
  20610. /* @__PURE__ */ C.jsx("span", { children: o.t("permission.panel.designedPerson") }),
  20611. /* @__PURE__ */ C.jsx("span", { className: nt.sheetPermissionDesignPersonPanelHeaderAdd, onClick: p, children: o.t("permission.panel.addPerson") })
  20612. ] }),
  20613. /* @__PURE__ */ C.jsx("div", { className: nt.sheetPermissionDesignPersonPanelSplit }),
  20614. /* @__PURE__ */ C.jsx("div", { className: nt.sheetPermissionDesignPersonPanelContent, children: (h == null ? void 0 : h.length) > 0 ? h.map((S) => {
  20615. var b, v, _;
  20616. return /* @__PURE__ */ C.jsxs("div", { className: nt.sheetPermissionDesignPersonPanelContentItem, children: [
  20617. /* @__PURE__ */ C.jsx(Pd, { size: 24, src: (b = S.subject) == null ? void 0 : b.avatar }),
  20618. /* @__PURE__ */ C.jsx("span", { className: nt.sheetPermissionDesignPersonPanelContentItemName, children: (v = S.subject) == null ? void 0 : v.name }),
  20619. /* @__PURE__ */ C.jsx(
  20620. Um,
  20621. {
  20622. className: nt.sheetPermissionDesignPersonPanelContentItemSelect,
  20623. value: "edit",
  20624. onChange: (R) => {
  20625. R === "delete" && c.setSelectUserList(h.filter((I) => {
  20626. var y, M;
  20627. return ((y = I.subject) == null ? void 0 : y.userID) !== ((M = S.subject) == null ? void 0 : M.userID);
  20628. }));
  20629. },
  20630. options: [
  20631. { label: `${o.t("permission.panel.canEdit")}`, value: "edit" },
  20632. { label: `${o.t("permission.panel.delete")}`, value: "delete" }
  20633. ]
  20634. }
  20635. )
  20636. ] }, (_ = S.subject) == null ? void 0 : _.userID);
  20637. }) : /* @__PURE__ */ C.jsxs("div", { className: nt.sheetPermissionUserListEmpty, children: [
  20638. /* @__PURE__ */ C.jsx("img", { width: 240, height: 120, src: np, alt: "" }),
  20639. /* @__PURE__ */ C.jsx("p", { className: nt.sheetPermissionUserListEmptyText, children: o.t("permission.dialog.userEmpty") })
  20640. ] }) })
  20641. ] }),
  20642. /* @__PURE__ */ C.jsx(To, { className: nt.sheetPermissionPanelTitle, label: o.t("permission.panel.viewPermission"), children: /* @__PURE__ */ C.jsxs(
  20643. vc,
  20644. {
  20645. value: n,
  20646. onChange: (S) => s(S),
  20647. className: nt.radioGroupVertical,
  20648. children: [
  20649. /* @__PURE__ */ C.jsx(Zr, { value: ls.OthersCanView, children: /* @__PURE__ */ C.jsx("span", { className: nt.text, children: o.t("permission.panel.othersCanView") }) }),
  20650. /* @__PURE__ */ C.jsx(Zr, { value: ls.NoOneElseCanView, children: /* @__PURE__ */ C.jsx("span", { className: nt.text, children: o.t("permission.panel.noOneElseCanView") }) })
  20651. ]
  20652. }
  20653. ) })
  20654. ] });
  20655. };
  20656. var MP = Object.defineProperty, PP = Object.getOwnPropertyDescriptor, tu = (r, e, t, n) => {
  20657. for (var s = n > 1 ? void 0 : n ? PP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  20658. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  20659. return n && s && MP(e, t, s), s;
  20660. }, Ft = (r, e) => (t, n) => e(t, n, r);
  20661. let yi = class extends ce {
  20662. constructor(r, e, t) {
  20663. super(), this._injector = r, this._componentManager = e, this._uiPartsService = t, this._init();
  20664. }
  20665. _init() {
  20666. this._initComponents(), this._initUiPartComponents();
  20667. }
  20668. _initComponents() {
  20669. [
  20670. [Jf, Xf],
  20671. [$_, ea],
  20672. [ew, Zd],
  20673. [tw, Hn],
  20674. [$f, Yd],
  20675. [fi, jM],
  20676. [Qf, fP],
  20677. [Kf, nP],
  20678. [ep, CP]
  20679. ].forEach(([r, e]) => {
  20680. this.disposeWithMe(this._componentManager.register(
  20681. r,
  20682. e
  20683. ));
  20684. });
  20685. }
  20686. _initUiPartComponents() {
  20687. var t;
  20688. const e = this._injector.get(xr).getConfig(Pr);
  20689. (t = e == null ? void 0 : e.customComponents) != null && t.has(Dc) || this.disposeWithMe(this._uiPartsService.registerComponent(Dc, () => Qr(yP, this._injector)));
  20690. }
  20691. };
  20692. yi = tu([
  20693. Ft(0, D(vt)),
  20694. Ft(1, D(Dn)),
  20695. Ft(2, D(yl))
  20696. ], yi);
  20697. let il = class extends ce {
  20698. constructor(e, t, n, s, i) {
  20699. var l;
  20700. super();
  20701. w(this, "_rangeProtectionCanViewRenderExtension", new _P());
  20702. w(this, "_rangeProtectionCanNotViewRenderExtension", new wP());
  20703. this._context = e, this._rangeProtectionRuleModel = t, this._sheetSkeletonManagerService = n, this._permissionService = s, this._configService = i;
  20704. const o = this._configService.getConfig(Pr);
  20705. (l = o == null ? void 0 : o.customComponents) != null && l.has(qf) || (this._initRender(), this._initSkeleton(), this._rangeProtectionRuleModel.ruleChange$.subscribe((a) => {
  20706. var c, d;
  20707. ((c = a.oldRule) != null && c.id && this._rangeProtectionCanViewRenderExtension.renderCache.has(a.oldRule.id) || this._rangeProtectionCanViewRenderExtension.renderCache.has(a.rule.id)) && this._rangeProtectionCanViewRenderExtension.clearCache(), ((d = a.oldRule) != null && d.id && this._rangeProtectionCanNotViewRenderExtension.renderCache.has(a.oldRule.id) || this._rangeProtectionCanNotViewRenderExtension.renderCache.has(a.rule.id)) && this._rangeProtectionCanNotViewRenderExtension.clearCache();
  20708. }));
  20709. }
  20710. _initRender() {
  20711. const e = this._context.mainComponent;
  20712. e && (e.getExtensionByKey(sp) || e.register(this._rangeProtectionCanViewRenderExtension), e.getExtensionByKey(ip) || e.register(this._rangeProtectionCanNotViewRenderExtension));
  20713. }
  20714. _initSkeleton() {
  20715. const e = () => {
  20716. var t;
  20717. this._sheetSkeletonManagerService.reCalculate(), (t = this._context.mainComponent) == null || t.makeDirty();
  20718. };
  20719. this.disposeWithMe(mt(
  20720. this._permissionService.permissionPointUpdate$.pipe(tm(300, void 0, { trailing: !0 })),
  20721. this._rangeProtectionRuleModel.rangeRuleInitStateChange$,
  20722. this._rangeProtectionRuleModel.ruleChange$
  20723. ).pipe().subscribe(e));
  20724. }
  20725. };
  20726. il = tu([
  20727. Ft(1, D(Ye)),
  20728. Ft(2, D(me)),
  20729. Ft(3, $e),
  20730. Ft(4, xr)
  20731. ], il);
  20732. let ol = class extends ce {
  20733. constructor(e, t, n, s, i, o) {
  20734. var a;
  20735. super();
  20736. w(this, "_worksheetProtectionRenderExtension", new IP());
  20737. this._context = e, this._renderManagerService = t, this._univerInstanceService = n, this._sheetSkeletonManagerService = s, this._worksheetProtectionRuleModel = i, this._configService = o;
  20738. const l = this._configService.getConfig(Pr);
  20739. (a = l == null ? void 0 : l.customComponents) != null && a.has(qf) || (this._initRender(), this._initSkeleton());
  20740. }
  20741. _initRender() {
  20742. const e = this._context.unitId, t = e && this._renderManagerService.getRenderById(e), n = t && t.mainComponent;
  20743. n && (n.getExtensionByKey(lp) || n.register(this._worksheetProtectionRenderExtension));
  20744. }
  20745. _initSkeleton() {
  20746. const e = () => {
  20747. var t;
  20748. this._sheetSkeletonManagerService.reCalculate(), (t = this._context.mainComponent) == null || t.makeDirty();
  20749. };
  20750. this.disposeWithMe(mt(
  20751. this._worksheetProtectionRuleModel.worksheetRuleInitStateChange$
  20752. ).pipe().subscribe(e));
  20753. }
  20754. };
  20755. ol = tu([
  20756. Ft(1, D(Ce)),
  20757. Ft(2, D(L)),
  20758. Ft(3, D(me)),
  20759. Ft(4, D(ft)),
  20760. Ft(5, D(xr))
  20761. ], ol);
  20762. var EP = Object.defineProperty, TP = Object.getOwnPropertyDescriptor, xP = (r, e, t, n) => {
  20763. for (var s = n > 1 ? void 0 : n ? TP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  20764. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  20765. return n && s && EP(e, t, s), s;
  20766. }, OP = (r, e) => (t, n) => e(t, n, r);
  20767. let ll = class extends ce {
  20768. constructor(r, e) {
  20769. super(), this._context = r, this._formatPainterService = e, this._initialize();
  20770. }
  20771. _initialize() {
  20772. this._bindFormatPainterStatus();
  20773. }
  20774. _bindFormatPainterStatus() {
  20775. this.disposeWithMe(
  20776. Ae(this._formatPainterService.status$.subscribe((r) => {
  20777. const e = this._context.scene;
  20778. e && (r !== zt.OFF ? e.setDefaultCursor(Re.CELL) : e.setDefaultCursor(Re.DEFAULT));
  20779. }))
  20780. );
  20781. }
  20782. };
  20783. ll = xP([
  20784. OP(1, Un)
  20785. ], ll);
  20786. var AP = Object.defineProperty, NP = Object.getOwnPropertyDescriptor, HP = (r, e, t, n) => {
  20787. for (var s = n > 1 ? void 0 : n ? NP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  20788. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  20789. return n && s && AP(e, t, s), s;
  20790. }, Ds = (r, e) => (t, n) => e(t, n, r);
  20791. let Fc = class extends ce {
  20792. constructor(r, e, t, n, s, i) {
  20793. super(), this._context = r, this._layoutService = e, this._contextMenuService = t, this._selectionManagerService = n, this._selectionRenderService = s, this._sheetSkeletonManagerService = i, this._init();
  20794. }
  20795. _init() {
  20796. let r = !1;
  20797. this.disposeWithMe(this._selectionManagerService.selectionMoveStart$.subscribe(() => r = !0)), this.disposeWithMe(this._selectionManagerService.selectionMoveEnd$.subscribe((e) => {
  20798. const t = this._sheetSkeletonManagerService.getCurrent().skeleton;
  20799. if (!t || !e || r === !1)
  20800. return;
  20801. r = !1;
  20802. const n = e[0];
  20803. if (!n.primary) return;
  20804. const s = Pt(n, t), i = n.range.rangeType, { scene: o } = this._context, l = o.getViewport(z.VIEW_MAIN), a = (l == null ? void 0 : l.viewportScrollX) || 0, c = (l == null ? void 0 : l.viewportScrollY) || 0;
  20805. let d = 0, u = 0;
  20806. const h = t.rowHeaderWidth, m = this._layoutService.getContentElement().getBoundingClientRect();
  20807. switch (i) {
  20808. case j.NORMAL:
  20809. d = s.rangeWithCoord.startX + m.left - a, u = s.rangeWithCoord.endY + m.top - c;
  20810. break;
  20811. case j.COLUMN:
  20812. d = s.rangeWithCoord.startX + m.left - a, u = Math.min(m.height / 2, s.rangeWithCoord.endY) + 40;
  20813. break;
  20814. case j.ROW:
  20815. d = (m.width - h) / 2 + 20, u = s.rangeWithCoord.endY + m.top - c;
  20816. break;
  20817. case j.ALL:
  20818. d = s.rangeWithCoord.startX + m.left, u = s.rangeWithCoord.startY + m.top;
  20819. break;
  20820. default:
  20821. d = s.rangeWithCoord.startX + m.left - a, u = s.rangeWithCoord.endY + m.top - c;
  20822. break;
  20823. }
  20824. d = se.clamp(d, h, m.width), u = se.clamp(u, m.top, m.height), this._contextMenuService.triggerContextMenu({
  20825. clientX: d,
  20826. clientY: u,
  20827. preventDefault: () => {
  20828. },
  20829. stopPropagation: () => {
  20830. }
  20831. }, Ct.MAIN_AREA);
  20832. }));
  20833. }
  20834. };
  20835. Fc = HP([
  20836. Ds(1, _l),
  20837. Ds(2, Rl),
  20838. Ds(3, D($)),
  20839. Ds(4, dt),
  20840. Ds(5, D(me))
  20841. ], Fc);
  20842. var VP = Object.defineProperty, kP = Object.getOwnPropertyDescriptor, DP = (r, e, t, n) => {
  20843. for (var s = n > 1 ? void 0 : n ? kP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  20844. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  20845. return n && s && VP(e, t, s), s;
  20846. }, jr = (r, e) => (t, n) => e(t, n, r);
  20847. const LP = [Lt.id, Fn.id];
  20848. let Uc = class extends ce {
  20849. constructor(r, e, t, n, s, i, o) {
  20850. super(), this._context = r, this._sheetSkeletonManagerService = e, this._commandService = t, this._renderManagerService = n, this._selectionManagerService = s, this._scrollManagerService = i, this._univerInstanceService = o, this._init();
  20851. }
  20852. scrollToRange(r) {
  20853. let { endRow: e, endColumn: t, startColumn: n, startRow: s } = r;
  20854. const i = this._getViewportBounding();
  20855. if (r.rangeType === j.ROW ? (n = 0, t = 0) : r.rangeType === j.COLUMN && (s = 0, e = 0), i) {
  20856. const o = i.startRow > e ? s : e, l = i.startColumn > t ? n : t;
  20857. return this._scrollToCell(o, l);
  20858. } else
  20859. return this._scrollToCell(s, n);
  20860. }
  20861. _init() {
  20862. this._initCommandListener(), this._initScrollEventListener(), this._initPointerScrollEvent(), this._initSkeletonListener();
  20863. }
  20864. _initCommandListener() {
  20865. this.disposeWithMe(
  20866. this._commandService.onCommandExecuted((r) => {
  20867. if (LP.includes(r.id))
  20868. this._scrollToSelection();
  20869. else if (r.id === cd.id) {
  20870. const e = r.params;
  20871. this.scrollToRange(e);
  20872. } else if (r.id === Gt.id) {
  20873. const e = r.params;
  20874. this._scrollToSelectionForExpand(e);
  20875. }
  20876. })
  20877. );
  20878. }
  20879. _scrollToSelectionForExpand(r) {
  20880. setTimeout(() => {
  20881. const e = this._selectionManagerService.getCurrentLastSelection();
  20882. if (e == null)
  20883. return;
  20884. const { startRow: t, startColumn: n, endRow: s, endColumn: i } = e.range, o = this._getViewportBounding();
  20885. if (o == null)
  20886. return;
  20887. const { startRow: l, startColumn: a, endRow: c, endColumn: d } = o;
  20888. let u = 0, h = 0;
  20889. t > l ? u = s : s < c ? u = t : u = l, n > a ? h = i : i < d ? h = n : h = a, r.direction === B.DOWN ? u = s : r.direction === B.UP ? u = t : r.direction === B.RIGHT ? h = i : r.direction === B.LEFT && (h = n), this._scrollToCell(u, h);
  20890. }, 0);
  20891. }
  20892. _getFreeze() {
  20893. var e;
  20894. const r = (e = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : e.skeleton.getWorksheetConfig();
  20895. if (r != null)
  20896. return r.freeze;
  20897. }
  20898. // eslint-disable-next-line max-lines-per-function
  20899. _initScrollEventListener() {
  20900. const { scene: r } = this._context;
  20901. if (r == null) return;
  20902. const e = r.getViewport(z.VIEW_MAIN);
  20903. e && (this.disposeWithMe(
  20904. Ae(
  20905. // wheel event --> set-scroll.command('sheet.operation.set-scroll') --> scroll.operation.ts -->
  20906. // scrollManagerService.setScrollInfoAndEmitEvent ---> scrollManagerService.setScrollInfo(raw value, may be negative) &&
  20907. // _notifyCurrentScrollInfo
  20908. this._scrollManagerService.rawScrollInfo$.subscribe((t) => {
  20909. var h;
  20910. if (t == null) {
  20911. e.scrollToViewportPos({
  20912. viewportScrollX: 0,
  20913. viewportScrollY: 0
  20914. });
  20915. return;
  20916. }
  20917. const n = (h = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton;
  20918. if (!n) return;
  20919. const { sheetViewStartRow: s, sheetViewStartColumn: i, offsetX: o, offsetY: l } = t, { startX: a, startY: c } = n.getCellWithCoordByIndex(
  20920. s,
  20921. i,
  20922. !1
  20923. ), d = a + o, u = c + l;
  20924. e.scrollToViewportPos({ viewportScrollX: d, viewportScrollY: u });
  20925. })
  20926. )
  20927. ), this.disposeWithMe(
  20928. e.onScrollAfter$.subscribeEvent((t) => {
  20929. var f;
  20930. if (!t) return;
  20931. const n = (f = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : f.skeleton;
  20932. if (n == null) return;
  20933. const s = this._getSheetObject();
  20934. if (n == null || s == null) return;
  20935. const { viewportScrollX: i, viewportScrollY: o, scrollX: l, scrollY: a } = t, { row: c, column: d, rowOffset: u, columnOffset: h } = n.getDecomposedOffset(
  20936. i,
  20937. o
  20938. ), m = {
  20939. sheetViewStartRow: c,
  20940. sheetViewStartColumn: d,
  20941. offsetX: h,
  20942. offsetY: u
  20943. };
  20944. this._scrollManagerService.setScrollStateToCurrSheet(m), this._scrollManagerService.validViewportScrollInfo$.next({
  20945. ...m,
  20946. scrollX: l,
  20947. scrollY: a,
  20948. viewportScrollX: i,
  20949. viewportScrollY: o
  20950. });
  20951. })
  20952. ), this.disposeWithMe(
  20953. e.onScrollByBar$.subscribeEvent((t) => {
  20954. var h;
  20955. const n = (h = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton;
  20956. if (n == null || t.isTrigger === !1)
  20957. return;
  20958. const s = this._getSheetObject();
  20959. if (n == null || s == null)
  20960. return;
  20961. const { viewportScrollX: i = 0, viewportScrollY: o = 0 } = t, l = this._getFreeze(), { row: a, column: c, rowOffset: d, columnOffset: u } = n.getDecomposedOffset(
  20962. i,
  20963. o
  20964. );
  20965. this._commandService.executeCommand(un.id, {
  20966. sheetViewStartRow: a + ((l == null ? void 0 : l.ySplit) || 0),
  20967. sheetViewStartColumn: c + ((l == null ? void 0 : l.xSplit) || 0),
  20968. offsetX: u,
  20969. offsetY: d
  20970. });
  20971. })
  20972. ));
  20973. }
  20974. _initSkeletonListener() {
  20975. this.disposeWithMe(Ae(
  20976. this._sheetSkeletonManagerService.currentSkeletonBefore$.subscribe((r) => {
  20977. if (r == null)
  20978. return;
  20979. const e = { unitId: r.unitId, sheetId: r.sheetId };
  20980. this._scrollManagerService.setSearchParam(e);
  20981. const t = this._getSheetObject();
  20982. if (!t) return;
  20983. const s = t.scene.getViewport(z.VIEW_MAIN), i = this._scrollManagerService.getScrollStateByParam(e), { viewportScrollX: o, viewportScrollY: l } = this._scrollManagerService.calcViewportScrollFromRowColOffset(i);
  20984. s && (i ? (s.viewportScrollX = o, s.viewportScrollY = l) : (s.viewportScrollX = 0, s.viewportScrollY = 0), this._updateSceneSize(r));
  20985. })
  20986. ));
  20987. }
  20988. /**
  20989. * for mobile
  20990. */
  20991. // eslint-disable-next-line max-lines-per-function
  20992. _initPointerScrollEvent() {
  20993. const r = this._getSheetObject();
  20994. if (!r) return;
  20995. const e = this._scrollManagerService, t = r.scene, n = r.spreadsheet, s = t.getViewport(z.VIEW_MAIN), i = { x: 0, y: 0 };
  20996. let o = !1;
  20997. const l = { x: 0, y: 0 }, a = 0.95;
  20998. let c = null;
  20999. const d = () => {
  21000. if (!s) return;
  21001. l.x *= a, l.y *= a, i.x += l.x, i.y += l.y;
  21002. const h = l.x, m = l.y;
  21003. (m !== 0 || h !== 0) && this._commandService.executeCommand(li.id, { offsetY: m, offsetX: h }), Math.abs(l.x) > 1 || Math.abs(l.y) > 1 ? c = requestAnimationFrame(d) : c = null;
  21004. }, u = () => {
  21005. cancelAnimationFrame(c), c = null;
  21006. };
  21007. n.onPointerDown$.subscribeEvent((h, m) => {
  21008. u(), s && (i.x = h.offsetX, i.y = h.offsetY, o = !0, m.stopPropagation());
  21009. }), n.onPointerMove$.subscribeEvent((h, m) => {
  21010. if (!o || !s) return;
  21011. const f = h, g = -(f.offsetX - i.x), p = -(f.offsetY - i.y);
  21012. l.x = -(f.offsetX - i.x), l.y = -(f.offsetY - i.y);
  21013. const S = g, b = p;
  21014. (g !== 0 || p !== 0) && (b !== 0 || S !== 0) && this._commandService.executeCommand(li.id, { offsetY: b, offsetX: S }), e.getCurrentScrollState(), i.x = f.offsetX, i.y = f.offsetY, m.stopPropagation();
  21015. }), n.onPointerUp$.subscribeEvent((h) => {
  21016. o = !1, c = requestAnimationFrame(d);
  21017. }), n.onPointerLeave$.subscribeEvent(() => {
  21018. o = !1;
  21019. }), n.onPointerOut$.subscribeEvent(() => {
  21020. o = !1;
  21021. }), t.onPointerOut$.subscribeEvent(() => {
  21022. o = !1;
  21023. }), t.onPointerCancel$.subscribeEvent(() => {
  21024. o = !1;
  21025. });
  21026. }
  21027. _updateSceneSize(r) {
  21028. var u;
  21029. if (r == null)
  21030. return;
  21031. const { unitId: e } = this._context, { skeleton: t } = r, n = (u = this._renderManagerService.getRenderById(e)) == null ? void 0 : u.scene;
  21032. if (t == null || n == null)
  21033. return;
  21034. const { rowTotalHeight: s, columnTotalWidth: i, rowHeaderWidthAndMarginLeft: o, columnHeaderHeightAndMarginTop: l } = t, c = this._context.unit.getActiveSheet();
  21035. if (!c) return;
  21036. const d = c.getZoomRatio() || 1;
  21037. n == null || n.setScaleValue(d, d), n == null || n.transformByState({
  21038. width: o + i,
  21039. height: l + s
  21040. });
  21041. }
  21042. _getSheetObject() {
  21043. return pn(this._context.unit, this._context);
  21044. }
  21045. _scrollToSelectionByDirection(r) {
  21046. const e = this._getViewportBounding();
  21047. if (e == null)
  21048. return !1;
  21049. const {
  21050. startRow: t,
  21051. startColumn: n,
  21052. endRow: s,
  21053. endColumn: i
  21054. } = e;
  21055. let o = 0, l = 0;
  21056. const { startRow: a, startColumn: c, endRow: d, endColumn: u } = r;
  21057. a >= t && (o = d), d <= s && (o = a), c >= n && (l = u), u <= i && (l = c), this._scrollToCell(o, l);
  21058. }
  21059. _scrollToSelection(r = !0) {
  21060. const e = this._selectionManagerService.getCurrentLastSelection();
  21061. if (e == null)
  21062. return;
  21063. const { startRow: t, startColumn: n, actualRow: s, actualColumn: i } = e.primary, o = r ? s : t, l = r ? i : n;
  21064. this._scrollToCell(o, l);
  21065. }
  21066. _getViewportBounding() {
  21067. var n, s;
  21068. const r = (n = this._getSheetObject()) == null ? void 0 : n.scene;
  21069. if (r == null)
  21070. return;
  21071. const e = r.getViewport(z.VIEW_MAIN);
  21072. if (e == null)
  21073. return;
  21074. const t = (s = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : s.skeleton;
  21075. if (t != null)
  21076. return t.getRangeByViewport(e.calcViewportInfo());
  21077. }
  21078. // eslint-disable-next-line max-lines-per-function, complexity
  21079. _scrollToCell(r, e) {
  21080. var R, I, y, M;
  21081. const { rowHeightAccumulation: t, columnWidthAccumulation: n } = (I = (R = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : R.skeleton) != null ? I : {};
  21082. if (t == null || n == null) return !1;
  21083. const s = (y = this._getSheetObject()) == null ? void 0 : y.scene;
  21084. if (s == null) return !1;
  21085. const i = s.getViewport(z.VIEW_MAIN);
  21086. if (i == null || ((M = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : M.skeleton) == null) return !1;
  21087. const l = this._context.unit.getActiveSheet();
  21088. if (!l) return !1;
  21089. const {
  21090. startColumn: a,
  21091. startRow: c,
  21092. ySplit: d,
  21093. xSplit: u
  21094. } = l.getFreeze(), h = this._getViewportBounding();
  21095. if (h == null) return !1;
  21096. const {
  21097. startRow: m,
  21098. startColumn: f,
  21099. endRow: g,
  21100. endColumn: p
  21101. } = h;
  21102. let S, b;
  21103. if (r >= c && e >= a - u && (r <= m && (S = r), r >= g)) {
  21104. const P = t[r] - i.height;
  21105. for (let E = m; E <= r; E++)
  21106. if (t[E] >= P) {
  21107. S = E + 1;
  21108. break;
  21109. }
  21110. }
  21111. if (e >= a && r >= c - d && (e <= f && (b = e), e >= p)) {
  21112. const P = n[e] - i.width;
  21113. for (let E = f; E <= e; E++)
  21114. if (n[E] >= P) {
  21115. b = E + 1;
  21116. break;
  21117. }
  21118. }
  21119. if (S === void 0 && b === void 0) return !1;
  21120. const { offsetX: v, offsetY: _ } = this._scrollManagerService.getCurrentScrollState() || {};
  21121. return this._commandService.syncExecuteCommand(un.id, {
  21122. sheetViewStartRow: S,
  21123. sheetViewStartColumn: b,
  21124. offsetX: b === void 0 ? v : 0,
  21125. offsetY: S === void 0 ? _ : 0
  21126. });
  21127. }
  21128. };
  21129. Uc = DP([
  21130. jr(1, D(me)),
  21131. jr(2, F),
  21132. jr(3, Ce),
  21133. jr(4, D($)),
  21134. jr(5, D(yt)),
  21135. jr(6, L)
  21136. ], Uc);
  21137. const WP = sr("PRINTING_RANGE"), BP = sr("PRINTING_COMPONENT_COLLECT");
  21138. class ap extends ce {
  21139. constructor() {
  21140. super();
  21141. w(this, "interceptor", new Cs({
  21142. PRINTING_RANGE: WP,
  21143. PRINTING_COMPONENT_COLLECT: BP
  21144. }));
  21145. this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_RANGE, {
  21146. priority: -1,
  21147. handler: (t) => t
  21148. })), this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT, {
  21149. priority: -1,
  21150. handler: (t) => t
  21151. }));
  21152. }
  21153. }
  21154. class FP extends xd {
  21155. constructor(t, n, s, i) {
  21156. super(t, n, s, i);
  21157. /**
  21158. * topLeft controlPointer, it is not visible, just transparent, for handling event.
  21159. */
  21160. w(this, "_fillControlTopLeft");
  21161. /**
  21162. * bottomRight controlPointer, it is not visible, just transparent, for handling event.
  21163. */
  21164. w(this, "_fillControlBottomRight");
  21165. w(this, "_rangeType", j.NORMAL);
  21166. this._scene = t, this._zIndex = n, this._themeService = s, this._rangeType = (i == null ? void 0 : i.rangeType) || j.NORMAL, this.initControlPoints();
  21167. }
  21168. initControlPoints() {
  21169. const t = this.currentStyle, n = t.expandCornerSize || 0, s = (t.expandCornerSize || 0) / 4, i = t.autofillStrokeWidth || 0, o = t.stroke, l = t.autofillStroke, a = this.zIndex;
  21170. this._fillControlTopLeft = new ge(Ic.fillTopLeft + a, {
  21171. zIndex: a + 2,
  21172. width: n,
  21173. height: n,
  21174. radius: n / 2,
  21175. visualWidth: s,
  21176. visualHeight: s,
  21177. strokeWidth: i
  21178. }), this._fillControlBottomRight = new ge(Ic.fillBottomRight + a, {
  21179. zIndex: a + 2,
  21180. width: n,
  21181. height: n,
  21182. radius: n / 2,
  21183. visualHeight: s,
  21184. visualWidth: s,
  21185. strokeWidth: i
  21186. });
  21187. const c = {
  21188. fill: o,
  21189. stroke: l,
  21190. strokeScaleEnabled: !1
  21191. };
  21192. this._fillControlTopLeft.setProps({ ...c }), this._fillControlBottomRight.setProps({ ...c });
  21193. const d = [
  21194. this._fillControlTopLeft,
  21195. this._fillControlBottomRight
  21196. ];
  21197. switch (this._rangeType) {
  21198. case j.ROW:
  21199. this.rowHeaderGroup.addObjects(...d);
  21200. break;
  21201. case j.COLUMN:
  21202. this.columnHeaderGroup.addObjects(...d);
  21203. break;
  21204. case j.NORMAL:
  21205. this.selectionShapeGroup.addObjects(...d);
  21206. }
  21207. this.getScene().addObjects(d, Ho);
  21208. }
  21209. get fillControlTopLeft() {
  21210. return this._fillControlTopLeft;
  21211. }
  21212. set fillControlTopLeft(t) {
  21213. this._fillControlTopLeft = t;
  21214. }
  21215. get fillControlBottomRight() {
  21216. return this._fillControlBottomRight;
  21217. }
  21218. set fillControlBottomRight(t) {
  21219. this._fillControlBottomRight = t;
  21220. }
  21221. get rangeType() {
  21222. return this._rangeType;
  21223. }
  21224. set rangeType(t) {
  21225. this._rangeType = t;
  21226. }
  21227. dispose() {
  21228. var t, n;
  21229. (t = this._fillControlBottomRight) == null || t.dispose(), (n = this._fillControlTopLeft) == null || n.dispose(), super.dispose();
  21230. }
  21231. _updateLayoutOfSelectionControl(t) {
  21232. var i, o;
  21233. super._updateLayoutOfSelectionControl(t);
  21234. const n = this.currentStyle;
  21235. t == null && (t = n);
  21236. const {
  21237. widgets: s = n.widgets
  21238. } = t;
  21239. if (this.currentStyle = t, this._enableAutoFill === !0 && !super._hasWidgets(s)) {
  21240. const { viewportScrollX: l, viewportScrollY: a } = this.getViewportMainScrollInfo(), { endX: c, endY: d } = this.selectionModel;
  21241. this.transformControlPoint(l, a, c, d), this.fillControlTopLeft.show(), this.fillControlBottomRight.show();
  21242. } else
  21243. (i = this.fillControlTopLeft) == null || i.hide(), (o = this.fillControlBottomRight) == null || o.hide();
  21244. }
  21245. getViewportMainScrollInfo() {
  21246. const t = this.getScene().getViewport(z.VIEW_MAIN);
  21247. return {
  21248. viewportScrollX: (t == null ? void 0 : t.viewportScrollX) || 0,
  21249. viewportScrollY: (t == null ? void 0 : t.viewportScrollY) || 0,
  21250. width: (t == null ? void 0 : t.width) || 0,
  21251. height: (t == null ? void 0 : t.height) || 0
  21252. };
  21253. }
  21254. /**
  21255. * Mainly for row & col selection control point position. update control point position by when scrolling.
  21256. * @param viewportScrollX viewportScrollX
  21257. * @param viewportScrollY
  21258. * @param sheetContentWidth
  21259. * @param sheetContentHeight max sheet content height, for very short sheet, control pointer shoud not out of sheet
  21260. */
  21261. transformControlPoint(t = 0, n = 0, s = 0, i = 0) {
  21262. const o = this.currentStyle, l = this.selectionModel.rangeType, a = o.expandCornerSize, { startX: c, startY: d, endX: u, endY: h } = this.selectionModel, m = this.getViewportMainScrollInfo(), f = m.width, g = m.height;
  21263. switch (l) {
  21264. case j.NORMAL:
  21265. this.fillControlTopLeft.transformByState({
  21266. left: -a / 2,
  21267. top: -a / 2
  21268. }), this.fillControlBottomRight.transformByState({
  21269. left: u - c - a / 2,
  21270. top: h - d - a / 2
  21271. });
  21272. break;
  21273. case j.ROW:
  21274. {
  21275. const p = Math.min(f / 2 + t, s), S = -a / 2 + p;
  21276. this.fillControlTopLeft.transformByState({
  21277. left: S,
  21278. top: -a / 2
  21279. }), this.fillControlBottomRight.transformByState({
  21280. left: S,
  21281. top: -a / 2 + h - d
  21282. });
  21283. }
  21284. break;
  21285. case j.COLUMN:
  21286. {
  21287. const p = Math.min(+g / 2 + n, i), S = -a / 2 + p;
  21288. this.fillControlTopLeft.transformByState({
  21289. left: -a / 2,
  21290. top: S
  21291. }), this.fillControlBottomRight.transformByState({
  21292. left: -a / 2 + u - c,
  21293. top: S
  21294. });
  21295. }
  21296. break;
  21297. default:
  21298. console.error("unknown range type");
  21299. }
  21300. }
  21301. }
  21302. var UP = Object.defineProperty, jP = Object.getOwnPropertyDescriptor, XP = (r, e, t, n) => {
  21303. for (var s = n > 1 ? void 0 : n ? jP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  21304. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  21305. return n && s && UP(e, t, s), s;
  21306. }, wn = (r, e) => (t, n) => e(t, n, r);
  21307. let al = class extends ef {
  21308. constructor(e, t, n, s, i, o, l, a, c, d) {
  21309. super(
  21310. t,
  21311. n,
  21312. s,
  21313. o,
  21314. c
  21315. );
  21316. w(this, "_workbookSelections");
  21317. w(this, "_renderDisposable", null);
  21318. w(this, "_expandingSelection", !1);
  21319. w(this, "_selectionControls", []);
  21320. // sheetID:Controls
  21321. w(this, "expandingControlMode", "bottom-right");
  21322. this._context = e, this._logService = l, this._commandService = a, this._contextService = c, this._scrollManagerService = d, this._workbookSelections = i.getWorkbookSelections(this._context.unitId), this._init();
  21323. }
  21324. _init() {
  21325. const e = this._getSheetObject();
  21326. this._initEventListeners(e), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._updateControlPointWhenScrolling();
  21327. }
  21328. _initSkeletonChangeListener() {
  21329. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((e) => {
  21330. if (e == null) {
  21331. this._logService.error("[SelectionRenderService]: should not receive null!");
  21332. return;
  21333. }
  21334. const t = this._context.unitId, { sheetId: n, skeleton: s } = e, { scene: i } = this._context, o = i.getViewport(z.VIEW_MAIN);
  21335. this._changeRuntime(s, i, o), this._workbookSelections.getCurrentLastSelection() || this._commandService.syncExecuteCommand(He.id, {
  21336. unitId: t,
  21337. subUnitId: n,
  21338. selections: [Od(s)]
  21339. });
  21340. }));
  21341. }
  21342. _initSelectionChangeListener() {
  21343. }
  21344. _initEventListeners(e) {
  21345. const { spreadsheetRowHeader: t, spreadsheetColumnHeader: n, spreadsheet: s, spreadsheetLeftTopPlaceholder: i } = e, { scene: o } = this._context;
  21346. this._initSpreadsheetEvent(e), this.disposeWithMe(
  21347. t == null ? void 0 : t.onPointerUp$.subscribeEvent((l, a) => {
  21348. if (this._normalSelectionDisabled()) return;
  21349. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: d } = Nn(l.offsetX, l.offsetY, o, c);
  21350. Nf(this._workbookSelections.getCurrentSelections(), d) || (this.createNewSelection(l, (s.zIndex || 1) + 1, j.ROW, this._getActiveViewport(l)), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()));
  21351. })
  21352. ), this.disposeWithMe(
  21353. n == null ? void 0 : n.onPointerUp$.subscribeEvent((l, a) => {
  21354. if (this._normalSelectionDisabled()) return;
  21355. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: d } = Nn(l.offsetX, l.offsetY, o, c);
  21356. Hf(this._workbookSelections.getCurrentSelections(), d) || (this.createNewSelection(l, (s.zIndex || 1) + 1, j.COLUMN, this._getActiveViewport(l)), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()));
  21357. })
  21358. ), this.disposeWithMe(i == null ? void 0 : i.onPointerUp$.subscribeEvent((l, a) => {
  21359. if (this._normalSelectionDisabled()) return;
  21360. this._reset();
  21361. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, d = tf(c);
  21362. this._addSelectionControlByModelData(d), this.refreshSelectionMoveStart(), a.stopPropagation(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
  21363. }));
  21364. }
  21365. _initSpreadsheetEvent(e) {
  21366. const { spreadsheet: t } = e;
  21367. let n;
  21368. const s = 500, i = { x: 0, y: 0 }, o = () => {
  21369. clearTimeout(n);
  21370. }, l = (d, u) => {
  21371. this.createNewSelection(
  21372. d,
  21373. t.zIndex + 1,
  21374. j.NORMAL,
  21375. this._getActiveViewport(d)
  21376. ), u && this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
  21377. };
  21378. t == null || t.onPointerMove$.subscribeEvent((d, u) => {
  21379. (Math.abs(d.offsetX - i.x) > 10 || Math.abs(d.offsetY - i.y) > 10) && o();
  21380. });
  21381. const a = t == null ? void 0 : t.onPointerDown$.subscribeEvent((d, u) => {
  21382. i.x = d.offsetX, i.y = d.offsetY, n = setTimeout(() => {
  21383. l(d, !0);
  21384. }, s), u.stopPropagation();
  21385. }), c = t == null ? void 0 : t.onPointerUp$.subscribeEvent((d, u) => {
  21386. if (this._normalSelectionDisabled()) return;
  21387. clearTimeout(n);
  21388. const h = 10;
  21389. Math.abs(d.offsetX - i.x) > h || Math.abs(d.offsetY - i.y) > h || (l(d, !1), u.stopPropagation());
  21390. });
  21391. this.disposeWithMe(Ae(a)), this.disposeWithMe(Ae(c));
  21392. }
  21393. _initUserActionSyncListener() {
  21394. this.disposeWithMe(this.selectionMoveStart$.subscribe((e) => this._updateSelections(e, Xt.MOVE_START))), this.disposeWithMe(this.selectionMoving$.subscribe((e) => this._updateSelections(e, Xt.MOVING))), this.disposeWithMe(this._contextService.subscribeContextValue$(Js).pipe(Vt(!1), cn()).subscribe((e) => {
  21395. var t;
  21396. e ? ((t = this._renderDisposable) == null || t.dispose(), this._renderDisposable = null, this._reset()) : this._renderDisposable = Ae(
  21397. this.selectionMoveEnd$.subscribe((n) => this._updateSelections(n, Xt.MOVE_END))
  21398. );
  21399. }));
  21400. }
  21401. _updateSelections(e, t) {
  21402. const n = this._context.unit, s = n.getUnitId(), i = n.getActiveSheet().getSheetId();
  21403. e.length !== 0 && this._commandService.executeCommand(He.id, {
  21404. unitId: s,
  21405. subUnitId: i,
  21406. type: t,
  21407. selections: e.map(
  21408. (o) => Am(o)
  21409. )
  21410. });
  21411. }
  21412. /**
  21413. * invoked when pointerup or long press on spreadsheet, or pointerdown on row&col
  21414. * then move curr selection to cell at cursor
  21415. * Main purpose to create a new selection, or update curr selection to a new range.
  21416. * @param evt
  21417. * @param _zIndex
  21418. * @param rangeType
  21419. * @param viewport
  21420. */
  21421. createNewSelection(e, t = 0, n = j.NORMAL, s) {
  21422. this._rangeType = n;
  21423. const i = this._skeleton, o = this._scene;
  21424. if (!o || !i)
  21425. return;
  21426. s && (this._activeViewport = s);
  21427. const { offsetX: l, offsetY: a } = e, c = o.getCoordRelativeToViewport(Oe.FromArray([l, a])), { x: d, y: u } = c;
  21428. this._startViewportPosX = d, this._startViewportPosY = u;
  21429. const h = o.getScrollXYInfoByViewport(c), { scaleX: m, scaleY: f } = o.getAncestorScale(), g = this._skeleton.getCellByOffset(d, u, m, f, h);
  21430. if (!g) return;
  21431. switch (n) {
  21432. case j.NORMAL:
  21433. break;
  21434. case j.ROW:
  21435. g.startColumn = 0, g.endColumn = this._skeleton.getColumnCount() - 1;
  21436. break;
  21437. case j.COLUMN:
  21438. g.startRow = 0, g.endRow = this._skeleton.getRowCount() - 1;
  21439. break;
  21440. case j.ALL:
  21441. g.startRow = 0, g.startColumn = 0, g.endRow = this._skeleton.getRowCount() - 1, g.endColumn = this._skeleton.getColumnCount() - 1;
  21442. }
  21443. const p = { range: g, primary: g, style: null };
  21444. p.range.rangeType = n;
  21445. const S = Pt(p, this._skeleton);
  21446. this._startRangeWhenPointerDown = { ...S.rangeWithCoord };
  21447. let b = this.getActiveSelectionControl();
  21448. const v = { ...S.rangeWithCoord };
  21449. for (const _ of this.getSelectionControls())
  21450. if (_.model.isEqual(v)) {
  21451. b = _;
  21452. break;
  21453. }
  21454. (b == null ? void 0 : b.model.rangeType) !== n ? (this._clearAllSelectionControls(), b = this.newSelectionControl(o, i, p)) : b.updateRangeBySelectionWithCoord(S), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._clearUpdatingListeners(), this._expandingSelection = !1;
  21455. }
  21456. /**
  21457. * Not same as PC version,
  21458. * new selection control for mobile do one more thing: bind event for two control points.
  21459. * @param scene
  21460. * @param rangeType
  21461. */
  21462. newSelectionControl(e, t, n) {
  21463. const s = this.getSelectionControls(), { rowHeaderWidth: i, columnHeaderHeight: o } = t, l = n.range.rangeType, a = new FP(e, s.length, this._themeService, {
  21464. highlightHeader: this._highlightHeader,
  21465. rowHeaderWidth: i,
  21466. columnHeaderHeight: o,
  21467. rangeType: l
  21468. }), c = Pt(n, t);
  21469. a.updateRangeBySelectionWithCoord(c), this._selectionControls.push(a);
  21470. const { expandingModeForTopLeft: d, expandingModeForBottomRight: u } = (() => {
  21471. switch (l) {
  21472. case j.NORMAL:
  21473. return {
  21474. expandingModeForTopLeft: "top-left",
  21475. expandingModeForBottomRight: "bottom-right"
  21476. /* BOTTOM_RIGHT */
  21477. };
  21478. case j.ROW:
  21479. return {
  21480. expandingModeForTopLeft: "top",
  21481. expandingModeForBottomRight: "bottom"
  21482. /* BOTTOM */
  21483. };
  21484. case j.COLUMN:
  21485. return {
  21486. expandingModeForTopLeft: "left",
  21487. expandingModeForBottomRight: "right"
  21488. /* RIGHT */
  21489. };
  21490. case j.ALL:
  21491. return {
  21492. expandingModeForTopLeft: "top-left",
  21493. expandingModeForBottomRight: "bottom-right"
  21494. /* BOTTOM_RIGHT */
  21495. };
  21496. default:
  21497. return {
  21498. expandingModeForTopLeft: "top-left",
  21499. expandingModeForBottomRight: "bottom-right"
  21500. /* BOTTOM_RIGHT */
  21501. };
  21502. }
  21503. })();
  21504. return a.fillControlTopLeft.onPointerDown$.subscribeEvent((h) => {
  21505. this._expandingSelection = !0, this.expandingControlMode = d, this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._fillControlPointerDownHandler(
  21506. h,
  21507. l,
  21508. this._activeViewport
  21509. );
  21510. }), a.fillControlBottomRight.onPointerDown$.subscribeEvent((h) => {
  21511. this._expandingSelection = !0, this.expandingControlMode = u, this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._fillControlPointerDownHandler(
  21512. h,
  21513. l,
  21514. this._activeViewport
  21515. );
  21516. }), (l === j.ROW || l === j.COLUMN) && !e.getViewport(z.VIEW_MAIN), a;
  21517. }
  21518. // same as PC
  21519. _getActiveViewport(e) {
  21520. const t = this._getSheetObject();
  21521. return t == null ? void 0 : t.scene.getActiveViewportByCoord(Oe.FromArray([e.offsetX, e.offsetY]));
  21522. }
  21523. // same as PC
  21524. _getSheetObject() {
  21525. return pn(this._context.unit, this._context);
  21526. }
  21527. // same as PC
  21528. _normalSelectionDisabled() {
  21529. return this._contextService.getContextValue(Js);
  21530. }
  21531. getSelectionControls() {
  21532. return this._selectionControls;
  21533. }
  21534. _fillControlPointerDownHandler(e, t = j.NORMAL, n, s = It.ALL) {
  21535. var u, h, m;
  21536. const i = this._skeleton, o = this._scene;
  21537. if (!o || !i)
  21538. return;
  21539. n && (this._activeViewport = n);
  21540. const l = o.getViewport(z.VIEW_MAIN), a = this.getActiveSelectionControl();
  21541. if (!a) return;
  21542. this._changeCurrCellWhenControlPointerDown(), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._clearUpdatingListeners(), this._addEndingListeners(), this._scrollTimer = Kr.create(this._scene, s), this._scrollTimer.startScroll((u = l == null ? void 0 : l.left) != null ? u : 0, (h = l == null ? void 0 : l.top) != null ? h : 0, l), (m = o.getTransformer()) == null || m.clearSelectedObjects();
  21543. const c = o.getCoordRelativeToViewport(Oe.FromArray([e.offsetX, e.offsetY]));
  21544. this._setupPointerMoveListener(l, a, t, s, c.x, c.y);
  21545. const d = this._shortcutService.forceEscape();
  21546. this._scenePointerUpSub = o.onPointerUp$.subscribeEvent((f) => {
  21547. this.endSelection(), this._expandingSelection = !1, this.expandingControlMode = "bottom-right", this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), d.dispose();
  21548. });
  21549. }
  21550. _changeCurrCellWhenControlPointerDown() {
  21551. const e = this.getActiveSelectionControl(), t = this._skeleton;
  21552. let n;
  21553. const { startRow: s, startColumn: i, endRow: o, endColumn: l } = e.model;
  21554. switch (this.expandingControlMode) {
  21555. case "top-left":
  21556. n = t.getCellWithCoordByIndex(o, l);
  21557. break;
  21558. case "bottom-right":
  21559. n = t.getCellWithCoordByIndex(s, i);
  21560. break;
  21561. case "left":
  21562. n = t.getCellWithCoordByIndex(s, l), n.isMerged = !1, n.isMergedMainCell = !1;
  21563. break;
  21564. case "right":
  21565. n = t.getCellWithCoordByIndex(s, i), n.isMerged = !1, n.isMergedMainCell = !1;
  21566. break;
  21567. case "top":
  21568. n = t.getCellWithCoordByIndex(o, i), n.isMerged = !1, n.isMergedMainCell = !1;
  21569. break;
  21570. case "bottom":
  21571. n = t.getCellWithCoordByIndex(s, i), n.isMerged = !1, n.isMergedMainCell = !1;
  21572. break;
  21573. default:
  21574. n = t.getCellWithCoordByIndex(s, i);
  21575. }
  21576. return e.updateCurrCell(n), n;
  21577. }
  21578. /**
  21579. * Not same as _moving in PC (base selection render service)
  21580. * The diff is
  21581. * In base version, new selection is determined by the cursor cell and _startRangeWhenPointerDown
  21582. *
  21583. * In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
  21584. */
  21585. _movingHandler(e, t, n, s) {
  21586. var M, P, E, T, A, H, x, k, U, V, N, X, Y;
  21587. this._rangeType = s;
  21588. const i = this._skeleton, o = this._scene, l = {
  21589. startRow: n.model.startRow,
  21590. endRow: n.model.endRow,
  21591. startColumn: n.model.startColumn,
  21592. endColumn: n.model.endColumn
  21593. }, a = o.getViewport(z.VIEW_MAIN), c = (M = this._getViewportByCell(l.endRow, l.endColumn)) != null ? M : a, d = o.getScrollXYInfoByViewport(
  21594. Oe.FromArray([this._startViewportPosX, this._startViewportPosY]),
  21595. c
  21596. ), { scaleX: u, scaleY: h } = o.getAncestorScale();
  21597. s === j.ROW ? e = Number.POSITIVE_INFINITY : s === j.COLUMN && (t = Number.POSITIVE_INFINITY);
  21598. const m = this._getSelectionWithCoordByOffset(e, t, u, h, d);
  21599. if (!m)
  21600. return !1;
  21601. const { rangeWithCoord: f } = m, g = n.model.currentCell, p = (P = g == null ? void 0 : g.mergeInfo.startRow) != null ? P : -1, S = (E = g == null ? void 0 : g.mergeInfo.endRow) != null ? E : -1, b = (T = g == null ? void 0 : g.mergeInfo.startColumn) != null ? T : -1, v = (A = g == null ? void 0 : g.mergeInfo.endColumn) != null ? A : -1;
  21602. let _ = {
  21603. startRow: Math.min(f.startRow, p),
  21604. startColumn: Math.min(f.startColumn, b),
  21605. endRow: Math.max(f.endRow, S),
  21606. endColumn: Math.max(f.endColumn, v)
  21607. };
  21608. if (s === j.NORMAL ? _ = i.expandRangeByMerge(_) : s === j.COLUMN ? _ = {
  21609. startRow: Math.min(f.startRow, (H = g == null ? void 0 : g.actualRow) != null ? H : -1),
  21610. startColumn: Math.min(f.startColumn, (x = g == null ? void 0 : g.actualColumn) != null ? x : -1),
  21611. endRow: Math.max(f.endRow, (k = g == null ? void 0 : g.actualRow) != null ? k : -1),
  21612. endColumn: Math.max(f.endColumn, (U = g == null ? void 0 : g.actualColumn) != null ? U : -1)
  21613. } : s === j.ROW && (_ = {
  21614. startRow: Math.min(f.startRow, (V = g == null ? void 0 : g.actualRow) != null ? V : -1),
  21615. startColumn: Math.min(f.startColumn, (N = g == null ? void 0 : g.actualColumn) != null ? N : -1),
  21616. endRow: Math.max(f.endRow, (X = g == null ? void 0 : g.actualRow) != null ? X : -1),
  21617. endColumn: Math.max(f.endColumn, (Y = g == null ? void 0 : g.actualColumn) != null ? Y : -1)
  21618. }), !_)
  21619. return !1;
  21620. const I = Pt({ range: _, style: null, primary: null }, i);
  21621. (l.startRow !== _.startRow || l.startColumn !== _.startColumn || l.endRow !== _.endRow || l.endColumn !== _.endColumn) && n && (n.updateRangeBySelectionWithCoord(I), this._selectionMoving$.next(this.getSelectionDataWithStyle()));
  21622. }
  21623. _updateControlPointWhenScrolling() {
  21624. const { scene: e } = this._context;
  21625. if (!e.getViewport(z.VIEW_MAIN)) return;
  21626. const n = this._scrollManagerService.validViewportScrollInfo$.subscribe((s) => {
  21627. var h;
  21628. if (s == null)
  21629. return;
  21630. const { viewportScrollX: i, viewportScrollY: o } = s, l = this.getActiveSelectionControl();
  21631. if (l == null)
  21632. return;
  21633. const a = (h = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, c = a == null ? void 0 : a.rowTotalHeight, d = a == null ? void 0 : a.columnTotalWidth, u = l.rangeType;
  21634. u === j.COLUMN ? l.transformControlPoint(0, o, d, c) : u === j.ROW && l.transformControlPoint(i, 0, d, c);
  21635. });
  21636. this.disposeWithMe(Ae(n));
  21637. }
  21638. };
  21639. al = XP([
  21640. wn(1, D(vt)),
  21641. wn(2, D(kt)),
  21642. wn(3, Il),
  21643. wn(4, D($)),
  21644. wn(5, D(me)),
  21645. wn(6, vl),
  21646. wn(7, F),
  21647. wn(8, Ne),
  21648. wn(9, D(yt))
  21649. ], al);
  21650. var cp = Object.defineProperty, zP = Object.getOwnPropertyDescriptor, YP = (r, e, t) => e in r ? cp(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ZP = (r, e, t, n) => {
  21651. for (var s = n > 1 ? void 0 : n ? zP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  21652. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  21653. return n && s && cp(e, t, s), s;
  21654. }, ec = (r, e) => (t, n) => e(t, n, r), dp = (r, e, t) => YP(r, typeof e != "symbol" ? e + "" : e, t);
  21655. let cl = class extends Xh {
  21656. constructor(r = Lc, e, t, n) {
  21657. super(), this._config = r, this._injector = e, this._renderManagerService = t, this._univerInstanceService = n;
  21658. }
  21659. onStarting() {
  21660. [
  21661. [ds],
  21662. [Sn, { useClass: Bo }],
  21663. [kr, { useClass: eg }],
  21664. [Un, { useClass: Fo }],
  21665. [Hr, { useClass: No }],
  21666. [ap],
  21667. [dt, { useClass: al }],
  21668. [da, { useClass: lg }],
  21669. [ws, { useClass: Lo }],
  21670. [Er],
  21671. [wi],
  21672. [vi],
  21673. [bi],
  21674. [Ad],
  21675. [Ci],
  21676. [ri],
  21677. [_i],
  21678. [Mr],
  21679. [nl],
  21680. [ps],
  21681. [El, { useClass: Hm }],
  21682. // permission
  21683. [gs],
  21684. [Vr],
  21685. [ol],
  21686. [Ii],
  21687. [Ri],
  21688. [yi]
  21689. ].forEach((r) => this._injector.add(r));
  21690. }
  21691. onReady() {
  21692. this._markSheetAsFocused(), this._registerRenderBasics(), this._injector.get(nl);
  21693. }
  21694. onRendered() {
  21695. this._registerRenderModules();
  21696. }
  21697. _registerRenderBasics() {
  21698. [
  21699. [me],
  21700. [Xo],
  21701. [dt, { useClass: al }],
  21702. [yt]
  21703. ].forEach((r) => {
  21704. this.disposeWithMe(this._renderManagerService.registerRenderModule(O.UNIVER_SHEET, r));
  21705. });
  21706. }
  21707. // We have to let render basics get bootstrapped before. Because some render controllers relies on
  21708. // a correct skeleton when they get loaded.
  21709. _registerRenderModules() {
  21710. [
  21711. // https://github.com/dream-num/univer-pro/issues/669
  21712. // HeaderMoveRenderController(HMRC) must be initialized before SelectionRenderController(SRC).
  21713. // Before HMRC expected selections remain unchanged when user clicks on the header. If we don't initialize HMRC before SRC,
  21714. // the selections will be changed by SRC first. Maybe we should merge row/col header related render controllers to one class.
  21715. [mi],
  21716. [hi],
  21717. // Caution: ScrollRenderController should placed before ZoomRenderController
  21718. // because ZoomRenderController would change scrollInfo in currentSkeletonBefore$.
  21719. [Uc],
  21720. [ii],
  21721. [ll],
  21722. [Qo],
  21723. [Jo],
  21724. [tl],
  21725. [el],
  21726. [Ko],
  21727. [$o],
  21728. [ko],
  21729. [Fc],
  21730. [rl],
  21731. [sl],
  21732. [il]
  21733. ].forEach((r) => {
  21734. this.disposeWithMe(this._renderManagerService.registerRenderModule(O.UNIVER_SHEET, r));
  21735. });
  21736. }
  21737. _markSheetAsFocused() {
  21738. const r = this._univerInstanceService;
  21739. this.disposeWithMe(r.getCurrentTypeOfUnit$(O.UNIVER_SHEET).pipe(Zm((e) => !!e)).subscribe((e) => {
  21740. r.focusUnit(e.getUnitId());
  21741. }));
  21742. }
  21743. };
  21744. dp(cl, "pluginName", "SHEET_UI_PLUGIN");
  21745. dp(cl, "type", O.UNIVER_SHEET);
  21746. cl = ZP([
  21747. jh(Nm, MS),
  21748. ec(1, D(vt)),
  21749. ec(2, Ce),
  21750. ec(3, L)
  21751. ], cl);
  21752. var GP = Object.defineProperty, qP = Object.getOwnPropertyDescriptor, QP = (r, e, t, n) => {
  21753. for (var s = n > 1 ? void 0 : n ? qP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  21754. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  21755. return n && s && GP(e, t, s), s;
  21756. }, tc = (r, e) => (t, n) => e(t, n, r);
  21757. let dl = class extends ce {
  21758. constructor(e, t, n) {
  21759. super();
  21760. w(this, "_isPointer", !1);
  21761. this._hoverManagerService = e, this._commandService = t, this._renderManagerService = n, this._initPointerEvent(), this._initHover();
  21762. }
  21763. get _mainComponent() {
  21764. var e;
  21765. return (e = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_SHEET)) == null ? void 0 : e.mainComponent;
  21766. }
  21767. _initHover() {
  21768. this.disposeWithMe(this._hoverManagerService.currentRichText$.subscribe((e) => {
  21769. var t, n;
  21770. e != null && e.bullet ? (this._isPointer || (t = this._mainComponent) == null || t.setCursor(Re.POINTER), this._isPointer = !0) : (this._isPointer && ((n = this._mainComponent) == null || n.setCursor(Re.AUTO)), this._isPointer = !1);
  21771. }));
  21772. }
  21773. _initPointerEvent() {
  21774. this.disposeWithMe(this._hoverManagerService.currentClickedCell$.subscribe((e) => {
  21775. const { location: t, bullet: n } = e;
  21776. n && this._commandService.executeCommand(RC.id, {
  21777. unitId: t.unitId,
  21778. subUnitId: t.subUnitId,
  21779. row: t.row,
  21780. col: t.col,
  21781. paragraphIndex: n.startIndex
  21782. });
  21783. }));
  21784. }
  21785. };
  21786. dl = QP([
  21787. tc(0, D(Er)),
  21788. tc(1, F),
  21789. tc(2, Ce)
  21790. ], dl);
  21791. var KP = Object.defineProperty, JP = Object.getOwnPropertyDescriptor, $P = (r, e, t, n) => {
  21792. for (var s = n > 1 ? void 0 : n ? JP(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  21793. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  21794. return n && s && KP(e, t, s), s;
  21795. }, Ls = (r, e) => (t, n) => e(t, n, r);
  21796. let ul = class extends ce {
  21797. constructor(r, e, t, n, s) {
  21798. super(), this._selectionManagerService = r, this._themeService = e, this._instanceSrv = t, this._cmdSrv = n, this._definedNamesService = s, this._init();
  21799. }
  21800. _init() {
  21801. this.disposeWithMe(mt(
  21802. this._selectionManagerService.selectionMoveStart$,
  21803. this._selectionManagerService.selectionMoving$,
  21804. this._selectionManagerService.selectionMoveEnd$,
  21805. this._selectionManagerService.selectionSet$
  21806. ).pipe(Ml((r) => !!r)).subscribe((r) => {
  21807. this._syncDefinedNameRange(r);
  21808. })), this.disposeWithMe(this._definedNamesService.focusRange$.subscribe(async (r) => {
  21809. if (r == null) return;
  21810. const { unitId: e } = r;
  21811. let { formulaOrRefString: t } = r;
  21812. if (t.substring(0, 1) === Xr.EQUALS && (t = t.substring(1)), !Lm(t))
  21813. return;
  21814. const s = this._instanceSrv.getUnit(e), i = await this._getSelections(s, e, t);
  21815. this._selectionManagerService.setSelections(i), this._cmdSrv.executeCommand(cd.id, i[0].range);
  21816. }));
  21817. }
  21818. _syncDefinedNameRange(r) {
  21819. if (r.length === 0)
  21820. return;
  21821. const e = r[r.length - 1], t = this._instanceSrv.getCurrentUnitForType(O.UNIVER_SHEET), n = t == null ? void 0 : t.getActiveSheet();
  21822. n && this._definedNamesService.setCurrentRange({
  21823. range: e.range,
  21824. unitId: t.getUnitId(),
  21825. sheetId: n.getSheetId()
  21826. });
  21827. }
  21828. async _getSelections(r, e, t) {
  21829. const n = t.split(",");
  21830. let s = r.getActiveSheet();
  21831. if (!s)
  21832. return [];
  21833. const i = [];
  21834. for (let o = 0; o < n.length; o++) {
  21835. const l = n[o].trim(), a = Fm(l.trim());
  21836. if (o === 0) {
  21837. const d = r.getSheetBySheetName(a.sheetName);
  21838. d && s.getSheetId() !== d.getSheetId() && (s = d, await this._cmdSrv.executeCommand(dd.id, {
  21839. subUnitId: s.getSheetId(),
  21840. unitId: e
  21841. }));
  21842. }
  21843. if (s.getName() !== a.sheetName)
  21844. continue;
  21845. let c = null;
  21846. if (o === n.length - 1) {
  21847. const d = a.range, { startRow: u, startColumn: h, endRow: m, endColumn: f } = d;
  21848. c = rm({
  21849. startRow: u,
  21850. startColumn: h,
  21851. endRow: m,
  21852. endColumn: f
  21853. }, s);
  21854. }
  21855. i.push({
  21856. range: a.range,
  21857. style: yr(this._themeService),
  21858. primary: c
  21859. });
  21860. }
  21861. return i;
  21862. }
  21863. };
  21864. ul = $P([
  21865. Ls(0, D($)),
  21866. Ls(1, D(kt)),
  21867. Ls(2, L),
  21868. Ls(3, F),
  21869. Ls(4, ki)
  21870. ], ul);
  21871. var e2 = Object.defineProperty, t2 = Object.getOwnPropertyDescriptor, n2 = (r, e, t, n) => {
  21872. for (var s = n > 1 ? void 0 : n ? t2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  21873. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  21874. return n && s && e2(e, t, s), s;
  21875. }, Rn = (r, e) => (t, n) => e(t, n, r);
  21876. let Mi = class extends kn {
  21877. constructor(e, t, n, s, i, o, l, a, c) {
  21878. super();
  21879. w(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
  21880. w(this, "_scheduledCallback", -1);
  21881. this._univerInstanceService = e, this._renderManagerService = t, this._editorBridgeService = n, this._commandService = s, this._contextService = i, this._formulaEditorManagerService = o, this._undoRedoService = l, this._textSelectionManagerService = a, this._editorService = c, this._initialize();
  21882. }
  21883. _initialize() {
  21884. this._syncEditorSize(), this._listenFxBtnClick(), this._handleContentChange(), this._renderManagerService.currentRender$.pipe(os(this.dispose$)).subscribe((e) => {
  21885. this._create(e);
  21886. }), this._create(Te), this.disposeWithMe(this._editorService.focus$.subscribe(() => {
  21887. var t;
  21888. ((t = this._editorService.getFocusEditor()) == null ? void 0 : t.getEditorId()) === Te && this._contextService.setContextValue(Ht, !1);
  21889. }));
  21890. }
  21891. _handleContentChange() {
  21892. this.disposeWithMe(
  21893. this._commandService.onCommandExecuted((e) => {
  21894. if (e.id === Eo.id) {
  21895. const t = e.params, { unitId: n } = t;
  21896. n === Te && this.autoScroll();
  21897. }
  21898. })
  21899. );
  21900. }
  21901. _create(e) {
  21902. if (e !== Te)
  21903. return;
  21904. const t = this._renderManagerService.getRenderById(e);
  21905. if (t == null)
  21906. return;
  21907. const { mainComponent: n } = t;
  21908. n != null && (this._loadedMap.has(n) || (this._initialMain(e), this._loadedMap.add(n)));
  21909. }
  21910. _listenFxBtnClick() {
  21911. this._formulaEditorManagerService.fxBtnClick$.pipe(os(this.dispose$)).subscribe(() => {
  21912. var t, n;
  21913. if (this._contextService.getContextValue(ic) && !this._contextService.getContextValue(Je)) {
  21914. this._univerInstanceService.setCurrentUnitForType(Te), this._contextService.setContextValue(Ht, !0);
  21915. const s = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), i = this._univerInstanceService.getUniverDocInstance(
  21916. Te
  21917. );
  21918. this._editorBridgeService.isVisible().visible === !1 && this._editorBridgeService.changeVisible({
  21919. visible: !0,
  21920. eventType: Xe.PointerDown,
  21921. unitId: (t = s == null ? void 0 : s.getUnitId()) != null ? t : ""
  21922. });
  21923. const l = (n = i == null ? void 0 : i.getBody()) == null ? void 0 : n.dataStream;
  21924. if (l == null)
  21925. return;
  21926. let a = l.startsWith("=") ? l : `=${l}`;
  21927. a = a.replace(/\r\n$/, "");
  21928. const c = [
  21929. {
  21930. startOffset: a.length,
  21931. endOffset: a.length
  21932. }
  21933. ], d = {
  21934. unitId: Te,
  21935. body: {
  21936. dataStream: a
  21937. },
  21938. segmentId: ""
  21939. };
  21940. this._commandService.executeCommand(Ap.id, d), this._textSelectionManagerService.replaceDocRanges(c);
  21941. }
  21942. });
  21943. }
  21944. _initialMain(e) {
  21945. const t = this._renderManagerService.getRenderById(e);
  21946. if (t == null)
  21947. return;
  21948. const { mainComponent: n } = t;
  21949. n != null && this.disposeWithMe(
  21950. n.onPointerDown$.subscribeEvent(() => {
  21951. this._editorBridgeService.isVisible().visible === !1 && (this._editorBridgeService.changeVisible({
  21952. visible: !0,
  21953. eventType: Xe.PointerDown,
  21954. unitId: e
  21955. }), this._undoRedoService.clearUndoRedo(Te)), this._contextService.setContextValue(Ht, !0);
  21956. })
  21957. );
  21958. }
  21959. // Listen to changes in the size of the formula editor container to set the size of the editor.
  21960. _syncEditorSize() {
  21961. const e = this._univerInstanceService.unitAdded$.pipe(Ml((t) => t.getUnitId() === Te));
  21962. this.disposeWithMe(ot([this._formulaEditorManagerService.position$, e]).subscribe(([t]) => {
  21963. if (!t) return this._clearScheduledCallback();
  21964. const n = Ed(Te, this._renderManagerService), s = this._univerInstanceService.getUniverDocInstance(
  21965. Te
  21966. );
  21967. if (n == null || s == null) return this._clearScheduledCallback();
  21968. const { width: i, height: o } = t;
  21969. if (i === 0 || o === 0) return this._clearScheduledCallback();
  21970. const { engine: l } = n;
  21971. s.updateDocumentDataPageSize(i), this.autoScroll(), this._scheduledCallback = requestIdleCallback(() => l.resizeBySize(i, o));
  21972. }));
  21973. }
  21974. _clearScheduledCallback() {
  21975. this._scheduledCallback !== -1 && cancelIdleCallback(this._scheduledCallback), this._scheduledCallback = -1;
  21976. }
  21977. autoScroll() {
  21978. var f, g;
  21979. const e = this._formulaEditorManagerService.getPosition(), t = (f = this._renderManagerService.getRenderById(Te)) == null ? void 0 : f.with(Jn).getSkeleton(), n = this._renderManagerService.getRenderById(Te), s = this._univerInstanceService.getUniverDocInstance(
  21980. Te
  21981. );
  21982. if (t == null || e == null || n == null || s == null)
  21983. return;
  21984. const { marginTop: i = 0, marginBottom: o = 0 } = s.getSnapshot().documentStyle, { scene: l, mainComponent: a } = n;
  21985. let { actualHeight: c } = t.getActualSize();
  21986. c += i + o;
  21987. const { width: d, height: u } = e, h = l.getViewport(vo.VIEW_MAIN);
  21988. let m = h == null ? void 0 : h.getScrollBar();
  21989. l.transformByState({
  21990. width: d,
  21991. height: c
  21992. }), a == null || a.resize(d, c), c > u ? m == null ? h && new rd(h, { enableHorizontal: !1, barSize: 8 }) : h == null || h.resetCanvasSizeAndUpdateScroll() : (m = null, h == null || h.scrollToViewportPos({ viewportScrollX: 0, viewportScrollY: 0 }), (g = h == null ? void 0 : h.getScrollBar()) == null || g.dispose());
  21993. }
  21994. };
  21995. Mi = n2([
  21996. Rn(0, L),
  21997. Rn(1, Ce),
  21998. Rn(2, tt),
  21999. Rn(3, F),
  22000. Rn(4, Ne),
  22001. Rn(5, ca),
  22002. Rn(6, Zt),
  22003. Rn(7, D(yd)),
  22004. Rn(8, Ss)
  22005. ], Mi);
  22006. var r2 = Object.defineProperty, s2 = Object.getOwnPropertyDescriptor, i2 = (r, e, t, n) => {
  22007. for (var s = n > 1 ? void 0 : n ? s2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22008. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22009. return n && s && r2(e, t, s), s;
  22010. }, Yn = (r, e) => (t, n) => e(t, n, r);
  22011. const o2 = {
  22012. pageSize: {
  22013. width: Number.POSITIVE_INFINITY,
  22014. height: Number.POSITIVE_INFINITY
  22015. },
  22016. documentFlavor: Qp.UNSPECIFIED,
  22017. marginTop: 5,
  22018. marginBottom: 5,
  22019. marginRight: 0,
  22020. marginLeft: 0,
  22021. paragraphLineGapDefault: 0,
  22022. renderConfig: {
  22023. horizontalAlign: wt.UNSPECIFIED,
  22024. verticalAlign: an.TOP,
  22025. centerAngle: 0,
  22026. vertexAngle: 0,
  22027. wrapStrategy: Cr.WRAP,
  22028. isRenderStyle: Qe.FALSE
  22029. }
  22030. };
  22031. let hl = class extends ce {
  22032. constructor(r, e, t, n, s, i, o, l) {
  22033. super(), this._univerInstanceService = r, this._renderManagerService = e, this._editorBridgeService = t, this._commandService = n, this._rangeProtectionRuleModel = s, this._worksheetProtectionRuleModel = i, this._formulaEditorController = o, this._formulaEditorManagerService = l, this._initialize();
  22034. }
  22035. _initialize() {
  22036. this._syncFormulaEditorContent(), this._commandExecutedListener();
  22037. }
  22038. _getEditorViewModel(r) {
  22039. var e;
  22040. return (e = this._renderManagerService.getRenderById(r)) == null ? void 0 : e.with(Jn).getViewModel();
  22041. }
  22042. // Sync cell content to formula editor bar when sheet selection changed.
  22043. _syncFormulaEditorContent() {
  22044. this.disposeWithMe(this._editorBridgeService.currentEditCellState$.subscribe((r) => {
  22045. r == null || this._editorBridgeService.isForceKeepVisible() || !this._rangeProtectionRuleModel.getRangeRuleInitState() || !this._worksheetProtectionRuleModel.getSheetRuleInitState() || this._editorSyncHandler(r);
  22046. }));
  22047. }
  22048. // Sync cell content to formula editor bar when sheet selection changed or visible changed.
  22049. _editorSyncHandler(r) {
  22050. var s, i, o;
  22051. let e = se.deepClone((s = r.documentLayoutObject.documentModel) == null ? void 0 : s.getBody());
  22052. const t = se.deepClone((i = r.documentLayoutObject.documentModel) == null ? void 0 : i.drawings), n = se.deepClone((o = r.documentLayoutObject.documentModel) == null ? void 0 : o.getDrawingsOrder());
  22053. (!e || r.isInArrayFormulaRange === !0 && this._editorBridgeService.isVisible().eventType === Xe.Dblclick) && (e = {
  22054. dataStream: `\r
  22055. `,
  22056. paragraphs: [
  22057. {
  22058. startIndex: 0
  22059. }
  22060. ],
  22061. textRuns: []
  22062. }), this._syncContentAndRender(Te, e, t, n);
  22063. }
  22064. _commandExecutedListener() {
  22065. const r = [Le, Te];
  22066. this.disposeWithMe(
  22067. this._commandService.onCommandExecuted((t) => {
  22068. if (t.id === Eo.id) {
  22069. const n = t.params, { unitId: s, trigger: i, isSync: o } = n;
  22070. if (o || i === xh.id)
  22071. return;
  22072. if (r.includes(s)) {
  22073. const l = this._univerInstanceService.getUnit(s, O.UNIVER_DOC), a = s === Te ? Le : Te;
  22074. this._checkAndSetRenderStyleConfig(l), this._syncActionsAndRender(a, n);
  22075. }
  22076. }
  22077. })
  22078. );
  22079. const e = [Se.id, tr.id];
  22080. this.disposeWithMe(
  22081. this._commandService.onCommandExecuted((t) => {
  22082. var n, s, i, o, l, a, c;
  22083. if (e.includes(t.id)) {
  22084. const d = this._editorBridgeService.getLatestEditCellState();
  22085. if (d == null)
  22086. return;
  22087. let u = !1;
  22088. const { row: h, column: m } = d;
  22089. if (t.id === Se.id && t.params ? (s = (n = t.params.cellValue) == null ? void 0 : n[h]) != null && s[m] && (u = !0) : t.id === tr.id && t.params && (o = (i = t.params.to.value) == null ? void 0 : i[h]) != null && o[m] && (u = !0), u) {
  22090. const f = se.deepClone((l = d.documentLayoutObject.documentModel) == null ? void 0 : l.getBody()), g = se.deepClone((a = d.documentLayoutObject.documentModel) == null ? void 0 : a.drawings), p = se.deepClone((c = d.documentLayoutObject.documentModel) == null ? void 0 : c.getDrawingsOrder());
  22091. if (f == null)
  22092. return;
  22093. this._syncContentAndRender(Te, f, g, p);
  22094. }
  22095. }
  22096. })
  22097. );
  22098. }
  22099. // Sync actions between cell editor and formula editor, and make `dataStream` and `paragraph` is the same.
  22100. _syncActionsAndRender(r, e) {
  22101. var l;
  22102. const t = [Le, Te], n = this._renderManagerService.getRenderById(r);
  22103. if (n == null)
  22104. return;
  22105. const s = n.with(Jn).getSkeleton(), i = this._univerInstanceService.getUnit(r, O.UNIVER_DOC), o = this._getEditorViewModel(r);
  22106. i == null || o == null || (this._commandService.syncExecuteCommand(Eo.id, {
  22107. ...e,
  22108. textRanges: null,
  22109. isSync: !0,
  22110. unitId: r,
  22111. syncer: e.unitId
  22112. }), o.reset(i), s.calculate(), t.includes(r) && ((l = n.mainComponent) == null || l.makeDirty()));
  22113. }
  22114. _syncContentAndRender(r, e, t, n) {
  22115. var c, d;
  22116. r === Te && e.paragraphs && (e.paragraphs = this._clearParagraph(e.paragraphs));
  22117. const s = [Le, Te], i = (c = this._renderManagerService.getRenderById(r)) == null ? void 0 : c.with(Jn).getSkeleton(), o = this._univerInstanceService.getUnit(r, O.UNIVER_DOC), l = this._getEditorViewModel(r);
  22118. if (o == null || l == null || i == null)
  22119. return;
  22120. o.getSnapshot().body = e, o.getSnapshot().drawings = t != null ? t : {}, o.getSnapshot().drawingsOrder = n != null ? n : [], this._checkAndSetRenderStyleConfig(o), l.reset(o);
  22121. const a = this._renderManagerService.getRenderById(r);
  22122. a != null && (i.calculate(), s.includes(r) && ((d = a.mainComponent) == null || d.makeDirty()), r === Te && this._formulaEditorController.autoScroll());
  22123. }
  22124. _checkAndSetRenderStyleConfig(r) {
  22125. var i;
  22126. const e = r.getSnapshot(), { body: t } = e;
  22127. if (e.id !== Te)
  22128. return;
  22129. e.documentStyle = o2;
  22130. let n = e.documentStyle.renderConfig;
  22131. n == null && (n = {}, e.documentStyle.renderConfig = n);
  22132. const s = this._formulaEditorManagerService.getPosition();
  22133. if (s) {
  22134. const o = s.width;
  22135. e.documentStyle.pageSize = {
  22136. width: o,
  22137. height: 1 / 0
  22138. };
  22139. }
  22140. ((i = t == null ? void 0 : t.dataStream) != null ? i : "").startsWith("=") ? n.isRenderStyle = Qe.TRUE : n.isRenderStyle = Qe.FALSE;
  22141. }
  22142. _clearParagraph(r) {
  22143. const e = se.deepClone(r);
  22144. for (const t of e)
  22145. t.paragraphStyle && (t.paragraphStyle.horizontalAlign = wt.UNSPECIFIED);
  22146. return e;
  22147. }
  22148. };
  22149. hl = i2([
  22150. Yn(0, L),
  22151. Yn(1, Ce),
  22152. Yn(2, tt),
  22153. Yn(3, F),
  22154. Yn(4, D(Ye)),
  22155. Yn(5, D(ft)),
  22156. Yn(6, D(Mi)),
  22157. Yn(7, ca)
  22158. ], hl);
  22159. var l2 = Object.defineProperty, a2 = Object.getOwnPropertyDescriptor, c2 = (r, e, t, n) => {
  22160. for (var s = n > 1 ? void 0 : n ? a2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22161. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22162. return n && s && l2(e, t, s), s;
  22163. }, mr = (r, e) => (t, n) => e(t, n, r);
  22164. let ml = class extends ce {
  22165. constructor(r, e, t, n, s, i, o) {
  22166. super(), this._commandService = r, this._formatPainterService = e, this._univerInstanceService = t, this._renderManagerService = n, this._selectionManagerService = s, this._sheetInterceptorService = i, this._injector = o, this._initialize();
  22167. }
  22168. _initialize() {
  22169. this._commandExecutedListener(), this._addDefaultHook();
  22170. }
  22171. _commandExecutedListener() {
  22172. const r = this._renderManagerService.getCurrentTypeOfRenderer(O.UNIVER_SHEET).with(dt);
  22173. this.disposeWithMe(
  22174. r.selectionMoveEnd$.subscribe((e) => {
  22175. var t, n;
  22176. if (this._formatPainterService.getStatus() !== zt.OFF) {
  22177. const { rangeWithCoord: s } = e[e.length - 1];
  22178. this._commandService.executeCommand(Zl.id, {
  22179. unitId: ((t = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : t.getUnitId()) || "",
  22180. subUnitId: ((n = this._univerInstanceService.getFocusedUnit().getActiveSheet()) == null ? void 0 : n.getSheetId()) || "",
  22181. range: {
  22182. startRow: s.startRow,
  22183. startColumn: s.startColumn,
  22184. endRow: s.endRow,
  22185. endColumn: s.endColumn
  22186. }
  22187. }), this._formatPainterService.getStatus() === zt.ONCE && this._commandService.executeCommand(Bi.id);
  22188. }
  22189. })
  22190. );
  22191. }
  22192. _addDefaultHook() {
  22193. const r = {
  22194. id: "default-format-painter",
  22195. priority: 0,
  22196. isDefaultHook: !0,
  22197. onStatusChange: (e) => {
  22198. if (e !== zt.OFF) {
  22199. const t = this._collectSelectionRangeFormat();
  22200. t && this._formatPainterService.setSelectionFormat(t);
  22201. }
  22202. },
  22203. onApply: (e, t, n, s) => this._getUndoRedoMutationInfo(e, t, n, s)
  22204. };
  22205. this._formatPainterService.addHook(r);
  22206. }
  22207. _collectSelectionRangeFormat() {
  22208. const r = this._selectionManagerService.getCurrentLastSelection(), e = r == null ? void 0 : r.range;
  22209. if (!e) return null;
  22210. const { startRow: t, endRow: n, startColumn: s, endColumn: i } = e, o = this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET), l = o == null ? void 0 : o.getActiveSheet();
  22211. if (!l) return null;
  22212. const a = l.getCellMatrix(), c = o.getStyles(), d = new Ke(), u = [];
  22213. for (let h = t; h <= n; h++)
  22214. for (let m = s; m <= i; m++) {
  22215. const f = a.getValue(h, m);
  22216. d.setValue(h, m, c.getStyleByCell(f) || {});
  22217. const { isMergedMainCell: g, ...p } = l.getCellInfoInMergeData(h, m);
  22218. g && u.push({
  22219. startRow: p.startRow,
  22220. startColumn: p.startColumn,
  22221. endRow: p.endRow,
  22222. endColumn: p.endColumn
  22223. });
  22224. }
  22225. return {
  22226. styles: d,
  22227. merges: u
  22228. };
  22229. }
  22230. _getUndoRedoMutationInfo(r, e, t, n) {
  22231. const s = this._sheetInterceptorService, i = this._univerInstanceService, { merges: o, styles: l } = n;
  22232. if (!l) return { undos: [], redos: [] };
  22233. const { startRow: a, startColumn: c, endRow: d, endColumn: u } = l.getDataRange(), h = d - a + 1, m = u - c + 1, f = t.startRow === t.endRow && t.startColumn === t.endColumn ? {
  22234. startRow: t.startRow,
  22235. startColumn: t.startColumn,
  22236. endRow: t.startRow + h - 1,
  22237. endColumn: t.startColumn + m - 1
  22238. } : t, g = Array.from(
  22239. { length: f.endRow - f.startRow + 1 },
  22240. () => Array.from({ length: f.endColumn - f.startColumn + 1 }, () => ({}))
  22241. ), p = [];
  22242. g.forEach((N, X) => {
  22243. N.forEach((Y, ie) => {
  22244. const he = X % h + a, ne = ie % m + c, pe = l.getValue(he, ne);
  22245. pe && (g[X][ie].s = Object.keys(pe).length > 0 ? pe : null);
  22246. });
  22247. }), o.forEach((N) => {
  22248. const X = {
  22249. startRow: N.startRow - a,
  22250. startColumn: N.startColumn - c,
  22251. endRow: N.endRow - a,
  22252. endColumn: N.endColumn - c
  22253. }, Y = Math.max(1, Math.floor((f.endRow - f.startRow + 1) / h)), ie = Math.max(1, Math.floor((f.endColumn - f.startColumn + 1) / m));
  22254. for (let he = 0; he < Y; he++)
  22255. for (let ne = 0; ne < ie; ne++)
  22256. p.push({
  22257. startRow: X.startRow + he * h + f.startRow,
  22258. startColumn: X.startColumn + ne * m + f.startColumn,
  22259. endRow: X.endRow + he * h + f.startRow,
  22260. endColumn: X.endColumn + ne * m + f.startColumn
  22261. });
  22262. });
  22263. const S = [f], b = new Ke(), v = new Ke();
  22264. if (se.isArray(g))
  22265. for (let N = 0; N < S.length; N++) {
  22266. const { startRow: X, startColumn: Y, endRow: ie, endColumn: he } = S[N];
  22267. for (let ne = 0; ne <= ie - X; ne++)
  22268. for (let pe = 0; pe <= he - Y; pe++)
  22269. b.setValue(ne + X, pe + Y, { s: null }), v.setValue(ne + X, pe + Y, g[ne][pe]);
  22270. }
  22271. const _ = {
  22272. subUnitId: e,
  22273. unitId: r,
  22274. cellValue: b.getMatrix()
  22275. }, R = {
  22276. subUnitId: e,
  22277. unitId: r,
  22278. cellValue: v.getMatrix()
  22279. }, I = this._injector.invoke(
  22280. en,
  22281. _
  22282. ), { undos: y, redos: M } = s.onCommandExecute({
  22283. id: Ti.id,
  22284. params: { ...R, range: S }
  22285. }), P = Al(p), E = [], T = [], A = i.getUnit(r).getSheetBySheetId(e), H = zf(A, P), x = {
  22286. unitId: r,
  22287. subUnitId: e,
  22288. ranges: P
  22289. }, k = {
  22290. unitId: r,
  22291. subUnitId: e,
  22292. ranges: P
  22293. };
  22294. E.push({ id: Kt.id, params: x }), E.push({ id: Jt.id, params: k });
  22295. const U = this._injector.invoke(
  22296. Ol,
  22297. x
  22298. ), V = this._injector.invoke(
  22299. Nl,
  22300. k
  22301. );
  22302. if (T.push({ id: Kt.id, params: V }), T.push({ id: Jt.id, params: U }), H) {
  22303. const N = this._injector.invoke((X) => Yf(X, r, A, P));
  22304. E.unshift(...N.redos), T.push(...N.undos);
  22305. }
  22306. return {
  22307. undos: [
  22308. { id: Se.id, params: _ },
  22309. { id: Se.id, params: I },
  22310. ...y,
  22311. ...T
  22312. ],
  22313. redos: [
  22314. { id: Se.id, params: _ },
  22315. { id: Se.id, params: R },
  22316. ...M,
  22317. ...E
  22318. ]
  22319. };
  22320. }
  22321. };
  22322. ml = c2([
  22323. mr(0, F),
  22324. mr(1, Un),
  22325. mr(2, L),
  22326. mr(3, Ce),
  22327. mr(4, D($)),
  22328. mr(5, D(Ln)),
  22329. mr(6, D(vt))
  22330. ], ml);
  22331. var d2 = Object.defineProperty, u2 = Object.getOwnPropertyDescriptor, h2 = (r, e, t, n) => {
  22332. for (var s = n > 1 ? void 0 : n ? u2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22333. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22334. return n && s && d2(e, t, s), s;
  22335. }, nc = (r, e) => (t, n) => e(t, n, r);
  22336. let jc = class extends ce {
  22337. constructor(e, t, n, s) {
  22338. super();
  22339. w(this, "_initialize", () => {
  22340. const e = new St();
  22341. this.disposeWithMe(
  22342. this._selectionManagerService.selectionMoveEnd$.subscribe(() => {
  22343. e.dispose(), this._selectionRenderService.getSelectionControls().forEach((n) => {
  22344. e.add(
  22345. Ae(
  22346. n.selectionMoveEnd$.subscribe((s) => {
  22347. if (!s)
  22348. return;
  22349. const i = n.model.getRange(), o = {
  22350. startRow: i.startRow,
  22351. startColumn: i.startColumn,
  22352. endRow: i.endRow,
  22353. endColumn: i.endColumn,
  22354. rangeType: i.rangeType
  22355. }, l = {
  22356. startRow: s.startRow,
  22357. startColumn: s.startColumn,
  22358. endRow: s.endRow,
  22359. endColumn: s.endColumn,
  22360. // rangeType must equal to fromRange
  22361. rangeType: i.rangeType
  22362. };
  22363. if (o.startRow === l.startRow && o.startColumn === l.startColumn || l.startRow < 0 || l.startColumn < 0)
  22364. return;
  22365. const a = {
  22366. fromRange: o,
  22367. toRange: l
  22368. };
  22369. this._commandService.executeCommand(ld.id, a);
  22370. })
  22371. )
  22372. );
  22373. });
  22374. })
  22375. );
  22376. });
  22377. this._context = e, this._selectionRenderService = t, this._selectionManagerService = n, this._commandService = s, this._initialize();
  22378. }
  22379. };
  22380. jc = h2([
  22381. nc(1, D(dt)),
  22382. nc(2, D($)),
  22383. nc(3, D(F))
  22384. ], jc);
  22385. var m2 = Object.defineProperty, f2 = Object.getOwnPropertyDescriptor, g2 = (r, e, t, n) => {
  22386. for (var s = n > 1 ? void 0 : n ? f2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22387. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22388. return n && s && m2(e, t, s), s;
  22389. }, rc = (r, e) => (t, n) => e(t, n, r);
  22390. let Xc = class extends ce {
  22391. constructor(r, e, t, n) {
  22392. super(), this._context = r, this._contextMenuService = e, this._selectionManagerService = t, this._selectionRenderService = n, this._init();
  22393. }
  22394. _init() {
  22395. var l, a;
  22396. const e = ((a = (l = this._context) == null ? void 0 : l.mainComponent) == null ? void 0 : a.onPointerDown$).subscribeEvent((c) => {
  22397. if (c.button === 2) {
  22398. const d = this._selectionManagerService.getCurrentSelections(), u = d == null ? void 0 : d[0];
  22399. if (!u)
  22400. return;
  22401. const h = u.range.rangeType, m = this._selectionRenderService.getSkeleton(), g = Pt(u, m).rangeWithCoord, p = () => {
  22402. if (!g)
  22403. return !1;
  22404. const b = c.offsetX, v = c.offsetY;
  22405. switch (h) {
  22406. case j.ROW:
  22407. return g.startY <= v && g.endY >= v;
  22408. case j.COLUMN:
  22409. return g.startX <= b && g.endX >= b;
  22410. default:
  22411. return g.startX <= b && g.endX >= b && g.startY <= v && g.endY >= v;
  22412. }
  22413. }, S = (b) => {
  22414. this._contextMenuService.triggerContextMenu(c, b);
  22415. };
  22416. p() ? h === j.COLUMN ? S(Ct.COL_HEADER) : h === j.ROW ? S(Ct.ROW_HEADER) : S(Ct.MAIN_AREA) : S(Ct.MAIN_AREA);
  22417. }
  22418. });
  22419. this.disposeWithMe(e);
  22420. const t = this._context.components.get(qe.COLUMN), s = this._context.components.get(qe.ROW).onPointerDown$.subscribeEvent((c) => {
  22421. c.button === 2 && this._contextMenuService.triggerContextMenu(c, Ct.ROW_HEADER);
  22422. });
  22423. this.disposeWithMe(s);
  22424. const o = t.onPointerDown$.subscribeEvent((c) => {
  22425. c.button === 2 && this._contextMenuService.triggerContextMenu(c, Ct.COL_HEADER);
  22426. });
  22427. this.disposeWithMe(o);
  22428. }
  22429. };
  22430. Xc = g2([
  22431. rc(1, Rl),
  22432. rc(2, D($)),
  22433. rc(3, dt)
  22434. ], Xc);
  22435. var p2 = Object.defineProperty, S2 = Object.getOwnPropertyDescriptor, C2 = (r, e, t, n) => {
  22436. for (var s = n > 1 ? void 0 : n ? S2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22437. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22438. return n && s && p2(e, t, s), s;
  22439. }, In = (r, e) => (t, n) => e(t, n, r);
  22440. let zc = class extends kn {
  22441. constructor(e, t, n, s, i, o, l, a, c, d) {
  22442. super();
  22443. w(this, "_d");
  22444. this._context = e, this._instanceSrv = t, this._commandService = n, this._editorBridgeService = s, this._selectionManagerService = i, this._rangeSelectorService = o, this._contextService = l, this._renderManagerService = a, this._editorService = c, this._sheetSkeletonManagerService = d, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(O.UNIVER_SHEET).subscribe((u) => {
  22445. u && u.getUnitId() === this._context.unitId ? this._d = this._init() : this._disposeCurrent();
  22446. })), this._initialRangeSelector();
  22447. }
  22448. _init() {
  22449. const e = new St();
  22450. return this._initSelectionChangeListener(e), this._initEventListener(e), this._commandExecutedListener(e), this._initialKeyboardListener(e), e;
  22451. }
  22452. _disposeCurrent() {
  22453. var e;
  22454. (e = this._d) == null || e.dispose(), this._d = null;
  22455. }
  22456. _initSelectionChangeListener(e) {
  22457. e.add(mt(
  22458. this._selectionManagerService.selectionMoveEnd$,
  22459. this._selectionManagerService.selectionSet$,
  22460. this._selectionManagerService.selectionMoveStart$
  22461. ).subscribe((t) => this._updateEditorPosition(t)));
  22462. }
  22463. _updateEditorPosition(e) {
  22464. var n, s, i;
  22465. if (this._editorBridgeService.isVisible().visible || this._rangeSelectorService.selectorModalVisible) return;
  22466. const t = (n = e == null ? void 0 : e[e.length - 1]) == null ? void 0 : n.primary;
  22467. if (t) {
  22468. const o = this._getSheetObject(), { scene: l, engine: a } = o, c = this._context.unitId, d = (s = this._context.unit.getActiveSheet()) == null ? void 0 : s.getSheetId();
  22469. if (!d) return;
  22470. const u = (i = this._sheetSkeletonManagerService.getWorksheetSkeleton(d)) == null ? void 0 : i.skeleton.getCellWithCoordByIndex(t.actualRow, t.actualColumn), h = u ? {
  22471. actualRow: u.actualRow,
  22472. actualColumn: u.actualColumn,
  22473. isMerged: u.isMerged,
  22474. startRow: u.mergeInfo.startRow,
  22475. startColumn: u.mergeInfo.startColumn,
  22476. endRow: u.mergeInfo.endRow,
  22477. endColumn: u.mergeInfo.endColumn,
  22478. isMergedMainCell: u.isMergedMainCell
  22479. } : t;
  22480. this._commandService.executeCommand(Kd.id, {
  22481. scene: l,
  22482. engine: a,
  22483. primary: h,
  22484. unitId: c,
  22485. sheetId: d
  22486. });
  22487. }
  22488. }
  22489. _initEventListener(e) {
  22490. const t = this._getSheetObject(), { spreadsheet: n, spreadsheetColumnHeader: s, spreadsheetLeftTopPlaceholder: i, spreadsheetRowHeader: o } = t;
  22491. e.add(n.onDblclick$.subscribeEvent((l) => {
  22492. l.button !== 2 && this._commandService.executeCommand(Et.id, {
  22493. visible: !0,
  22494. eventType: Xe.Dblclick,
  22495. unitId: this._context.unitId
  22496. });
  22497. })), e.add(n.onPointerDown$.subscribeEvent({
  22498. next: this._tryHideEditor.bind(this),
  22499. priority: -1
  22500. })), e.add(s.onPointerDown$.subscribeEvent({
  22501. next: this._tryHideEditor.bind(this),
  22502. priority: -1
  22503. })), e.add(i.onPointerDown$.subscribeEvent({
  22504. next: this._tryHideEditor.bind(this),
  22505. priority: -1
  22506. })), e.add(o.onPointerDown$.subscribeEvent({
  22507. next: this._tryHideEditor.bind(this),
  22508. priority: -1
  22509. }));
  22510. }
  22511. /**
  22512. * Should activate the editor when the user inputs text.
  22513. * @param d DisposableCollection
  22514. */
  22515. _initialKeyboardListener(e) {
  22516. let t = null;
  22517. const n = (i) => {
  22518. const o = i.with(Sr);
  22519. o && (t = Ae(o.onInputBefore$.subscribe((l) => {
  22520. if (!this._isCurrentSheetFocused())
  22521. return;
  22522. const a = this._contextService.getContextValue(Ht), c = this._contextService.getContextValue(Tt), d = i.unitId;
  22523. this._editorBridgeService.isVisible().visible || d && c && !a && this._showEditorByKeyboard(l);
  22524. })), e.add(t));
  22525. }, s = this._renderManagerService.getRenderById(Le);
  22526. s ? n(s) : this.disposeWithMe(this._renderManagerService.created$.pipe(Ml((i) => i.unitId === Le)).subscribe((i) => {
  22527. t == null || t.dispose(), n(i);
  22528. }));
  22529. }
  22530. _commandExecutedListener(e) {
  22531. const t = /* @__PURE__ */ new Set([zs.id, Wi.id]);
  22532. e.add(this._commandService.onCommandExecuted((n) => {
  22533. if (t.has(n.id)) {
  22534. if (this._editorBridgeService.isVisible().visible) return;
  22535. this._editorBridgeService.refreshEditCellState();
  22536. }
  22537. if (n.id === Se.id) {
  22538. const s = n.params, { cellValue: i, unitId: o, subUnitId: l } = s;
  22539. if (!i) return;
  22540. const a = this._editorBridgeService.getEditLocation();
  22541. if (a) {
  22542. const { unitId: c, sheetId: d, row: u, column: h } = a;
  22543. o === c && l === d && i && i[u] && Object.prototype.hasOwnProperty.call(i[u], h) && this._editorBridgeService.refreshEditCellState();
  22544. }
  22545. }
  22546. })), e.add(this._commandService.beforeCommandExecuted((n, s) => {
  22547. s != null && s.fromCollab || n.id === et.id && this._tryHideEditor();
  22548. }));
  22549. }
  22550. _showEditorByKeyboard(e) {
  22551. const t = e == null ? void 0 : e.event;
  22552. e == null || !t.data && t.inputType !== "InsertParagraph" || this._commandService.executeCommand(Et.id, {
  22553. visible: !0,
  22554. eventType: Xe.Keyboard,
  22555. keycode: t.which,
  22556. unitId: this._context.unitId
  22557. });
  22558. }
  22559. _tryHideEditor() {
  22560. this._editorBridgeService.isForceKeepVisible() || this._hideEditor();
  22561. }
  22562. _hideEditor() {
  22563. this._editorBridgeService.isVisible().visible === !0 && this._commandService.syncExecuteCommand(Et.id, {
  22564. visible: !1,
  22565. eventType: Xe.PointerDown,
  22566. unitId: this._context.unitId
  22567. });
  22568. }
  22569. _initialRangeSelector() {
  22570. this.disposeWithMe(this._selectionManagerService.selectionMoving$.subscribe(this._rangeSelector.bind(this))), this.disposeWithMe(this._selectionManagerService.selectionMoveStart$.subscribe(this._rangeSelector.bind(this))), this.disposeWithMe(
  22571. this._rangeSelectorService.openSelector$.subscribe(() => {
  22572. const { unitId: e, sheetId: t, sheetName: n } = this._getCurrentUnitIdAndSheetId();
  22573. if (!t || !n) return;
  22574. const s = this._selectionManagerService.getCurrentSelections(), i = s == null ? void 0 : s.map((o) => ({ range: o.range, unitId: e, sheetId: t, sheetName: n }));
  22575. i && this._rangeSelectorService.selectionChange(i);
  22576. })
  22577. );
  22578. }
  22579. _rangeSelector(e) {
  22580. if (!e)
  22581. return;
  22582. const { unitId: t, sheetId: n, sheetName: s } = this._getCurrentUnitIdAndSheetId();
  22583. if (!n || !s) return;
  22584. const i = e.map((o) => ({ range: o.range, unitId: t, sheetId: n, sheetName: s }));
  22585. this._rangeSelectorService.selectionChange(i);
  22586. }
  22587. _getCurrentUnitIdAndSheetId() {
  22588. const e = this._context.unit, t = e.getActiveSheet();
  22589. return {
  22590. unitId: e.getUnitId(),
  22591. sheetId: t == null ? void 0 : t.getSheetId(),
  22592. sheetName: t == null ? void 0 : t.getName()
  22593. };
  22594. }
  22595. _getSheetObject() {
  22596. return pn(this._context.unit, this._context);
  22597. }
  22598. _isCurrentSheetFocused() {
  22599. var e;
  22600. return ((e = this._instanceSrv.getFocusedUnit()) == null ? void 0 : e.getUnitId()) === this._context.unitId;
  22601. }
  22602. };
  22603. zc = C2([
  22604. In(1, L),
  22605. In(2, F),
  22606. In(3, tt),
  22607. In(4, D($)),
  22608. In(5, Np),
  22609. In(6, Ne),
  22610. In(7, Ce),
  22611. In(8, Ss),
  22612. In(9, D(me))
  22613. ], zc);
  22614. var Yc = /* @__PURE__ */ ((r) => (r[r.NORMAL = 0] = "NORMAL", r[r.HIGHLIGHT = 1] = "HIGHLIGHT", r))(Yc || {});
  22615. const v2 = "rgba(0, 0, 0, 0.15)", yn = "rgb(0, 0, 0)", oo = "rgb(255, 255, 255, 1)";
  22616. class b2 extends sd {
  22617. constructor(t, n) {
  22618. super(t, n);
  22619. w(this, "_size", 12);
  22620. w(this, "_iconRatio", 0.4);
  22621. w(this, "_mode", 0);
  22622. this.setShapeProps(n);
  22623. }
  22624. setShapeProps(t) {
  22625. t != null && t.size && (this._size = t.size), t != null && t.mode && (this._mode = t.mode), this.transformByState({
  22626. width: this._size,
  22627. height: this._size
  22628. });
  22629. }
  22630. _draw(t) {
  22631. this._mode === 1 && ge.drawWith(t, {
  22632. width: this._size,
  22633. height: this._size,
  22634. radius: this._size,
  22635. fill: v2
  22636. });
  22637. const n = this._size * 0.5 * this._iconRatio, s = Math.PI / 180 * 60, i = n * Math.sin(s), o = n * Math.cos(s);
  22638. Ws.drawWith(t, {
  22639. pointsGroup: [
  22640. [
  22641. { x: -i + this._size / 2, y: -o + this._size / 2 },
  22642. { x: i + this._size / 2, y: -o + this._size / 2 },
  22643. { x: this._size / 2, y: n + this._size / 2 }
  22644. ]
  22645. ],
  22646. // left: this.left,
  22647. // top: this.top,
  22648. fill: yn
  22649. });
  22650. }
  22651. }
  22652. var _2 = Object.defineProperty, w2 = Object.getOwnPropertyDescriptor, R2 = (r, e, t, n) => {
  22653. for (var s = n > 1 ? void 0 : n ? w2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22654. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22655. return n && s && _2(e, t, s), s;
  22656. }, lo = (r, e) => (t, n) => e(t, n, r);
  22657. const I2 = "__SpreadsheetHeaderMenuSHAPEControllerShape__", y2 = "__SpreadsheetHeaderMenuMAINControllerShape__", M2 = "rgba(0, 0, 0, 0.1)";
  22658. let Zc = class extends ce {
  22659. constructor(e, t, n, s, i) {
  22660. super();
  22661. w(this, "_hoverRect");
  22662. w(this, "_hoverMenu");
  22663. w(this, "_currentColumn", Number.POSITIVE_INFINITY);
  22664. // private _rowHeaderPointerMoveSub: Subscription;
  22665. // private _colHeaderPointerMoveSub: Subscription;
  22666. // private _rowHeaderPointerLeaveSub: Subscription;
  22667. // private _colHeaderPointerLeaveSub: Subscription;
  22668. // private _rowHeaderPointerEnterSub: Subscription;
  22669. // private _colHeaderPointerEnterSub: Subscription;
  22670. w(this, "_headerPointerSubs");
  22671. w(this, "_colHeaderPointerSubs");
  22672. this._context = e, this._sheetSkeletonManagerService = t, this._contextMenuService = n, this._commandService = s, this._selectionManagerService = i, this._initialize();
  22673. }
  22674. dispose() {
  22675. var e, t, n;
  22676. (e = this._hoverRect) == null || e.dispose(), (t = this._hoverMenu) == null || t.dispose(), (n = this._headerPointerSubs) == null || n.unsubscribe(), this._headerPointerSubs = null;
  22677. }
  22678. _initialize() {
  22679. const e = this._context.scene;
  22680. this._hoverRect = new ge(I2, {
  22681. fill: M2,
  22682. evented: !1
  22683. }), this._hoverMenu = new b2(y2, { zIndex: 100, visible: !1 }), e.addObjects([this._hoverRect, this._hoverMenu], rr), this._initialHover(
  22684. 0
  22685. /* ROW */
  22686. ), this._initialHover(
  22687. 1
  22688. /* COLUMN */
  22689. ), this._initialHoverMenu();
  22690. }
  22691. // eslint-disable-next-line max-lines-per-function
  22692. _initialHover(e = 0) {
  22693. var u, h, m;
  22694. const t = this._context.components.get(qe.COLUMN), n = this._context.components.get(qe.ROW), s = e === 0 ? n : t, i = (f) => {
  22695. var y, M, P;
  22696. const g = (y = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : y.skeleton;
  22697. if (g == null)
  22698. return;
  22699. const { rowHeaderWidth: p, columnHeaderHeight: S } = g, { startX: b, startY: v, endX: _, endY: R, column: I } = Nn(
  22700. f.offsetX,
  22701. f.offsetY,
  22702. this._context.scene,
  22703. g
  22704. );
  22705. if (e === 0)
  22706. (M = this._hoverRect) == null || M.transformByState({
  22707. width: p,
  22708. height: R - v,
  22709. left: 0,
  22710. top: v
  22711. });
  22712. else {
  22713. if (this._currentColumn = I, (P = this._hoverRect) == null || P.transformByState({
  22714. width: _ - b,
  22715. height: S,
  22716. left: b,
  22717. top: 0
  22718. }), this._hoverMenu == null)
  22719. return;
  22720. if (_ - b < S * 2) {
  22721. this._hoverMenu.hide();
  22722. return;
  22723. }
  22724. const E = S * 0.8;
  22725. this._hoverMenu.transformByState({
  22726. left: _ - S,
  22727. top: S / 2 - E / 2
  22728. }), this._hoverMenu.setShapeProps({ size: E }), this._hoverMenu.show();
  22729. }
  22730. }, o = () => {
  22731. var f;
  22732. (f = this._hoverRect) == null || f.show();
  22733. }, l = () => {
  22734. var f, g;
  22735. (f = this._hoverRect) == null || f.hide(), (g = this._hoverMenu) == null || g.hide();
  22736. };
  22737. this._headerPointerSubs = new Kn();
  22738. const a = s.onPointerMove$.subscribeEvent(i), c = s.onPointerEnter$.subscribeEvent(o), d = s.onPointerLeave$.subscribeEvent(l);
  22739. (u = this._headerPointerSubs) == null || u.add(a), (h = this._headerPointerSubs) == null || h.add(c), (m = this._headerPointerSubs) == null || m.add(d);
  22740. }
  22741. _initialHoverMenu() {
  22742. this._hoverMenu != null && (this._hoverMenu.onPointerEnter$.subscribeEvent(() => {
  22743. this._hoverMenu != null && (this._hoverMenu.setProps({
  22744. mode: Yc.HIGHLIGHT,
  22745. visible: !0
  22746. }), this._context.scene.setCursor(Re.POINTER));
  22747. }), this._hoverMenu.onPointerLeave$.subscribeEvent(() => {
  22748. this._hoverMenu != null && (this._hoverMenu.setProps({
  22749. mode: Yc.NORMAL,
  22750. visible: !1
  22751. }), this._context.scene.resetCursor());
  22752. }), this._hoverMenu.onPointerDown$.subscribeEvent((e) => {
  22753. var i;
  22754. const t = this._currentColumn, n = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((o) => o.range);
  22755. if (!!!(n != null && n.filter((o) => o.rangeType === j.COLUMN).find((o) => {
  22756. const { startColumn: l, endColumn: a } = o;
  22757. return t >= l && t <= a;
  22758. }))) {
  22759. const o = this._getSelectionOnColumn(t);
  22760. this._commandService.syncExecuteCommand(He.id, o);
  22761. }
  22762. e.stopPropagation(), e.preventDefault(), this._contextMenuService.triggerContextMenu(e, Ct.COL_HEADER);
  22763. }));
  22764. }
  22765. _getSelectionOnColumn(e) {
  22766. const t = this._context.unit, n = t.getActiveSheet();
  22767. if (!n)
  22768. throw new Error("No active worksheet");
  22769. return {
  22770. unitId: t.getUnitId(),
  22771. subUnitId: n.getSheetId(),
  22772. selections: [
  22773. {
  22774. range: {
  22775. startRow: 0,
  22776. startColumn: e,
  22777. endRow: n.getRowCount() - 1,
  22778. endColumn: e,
  22779. rangeType: j.COLUMN
  22780. },
  22781. primary: {
  22782. startRow: 0,
  22783. startColumn: e,
  22784. endRow: 0,
  22785. endColumn: e,
  22786. actualRow: 0,
  22787. actualColumn: e,
  22788. isMerged: !1,
  22789. isMergedMainCell: !1
  22790. },
  22791. style: null
  22792. }
  22793. ]
  22794. };
  22795. }
  22796. };
  22797. Zc = R2([
  22798. lo(1, D(me)),
  22799. lo(2, Rl),
  22800. lo(3, F),
  22801. lo(4, D($))
  22802. ], Zc);
  22803. var Gc = /* @__PURE__ */ ((r) => (r[r.ROW = 0] = "ROW", r[r.COLUMN = 1] = "COLUMN", r))(Gc || {});
  22804. const Us = 12, P2 = 0.4;
  22805. class Ph extends sd {
  22806. constructor(t, n, s) {
  22807. super(t, n);
  22808. w(this, "_size", Us);
  22809. w(this, "_iconRatio", P2);
  22810. w(this, "_hovered", !0);
  22811. w(this, "_hasPrevious", !0);
  22812. w(this, "_hasNext", !0);
  22813. w(this, "_unhideType");
  22814. n && this.setShapeProps(n), this.onPointerEnter$.subscribeEvent(() => this.setShapeProps({ hovered: !0 })), this.onPointerLeave$.subscribeEvent(() => this.setShapeProps({ hovered: !1 })), this.onPointerDown$.subscribeEvent(() => s == null ? void 0 : s());
  22815. }
  22816. setShapeProps(t) {
  22817. t.type !== void 0 && (this._unhideType = t.type), t.hovered !== void 0 && (this._hovered = t.hovered), t.hasPrevious !== void 0 && (this._hasPrevious = t.hasPrevious), t.hasNext !== void 0 && (this._hasNext = t.hasNext), this.transformByState({
  22818. width: this._size * (this._unhideType === 1 ? 2 : 1),
  22819. height: this._size * (this._unhideType === 0 ? 2 : 1)
  22820. });
  22821. }
  22822. _draw(t) {
  22823. this._unhideType === 0 ? this._drawOnRow(t) : this._drawOnCol(t);
  22824. }
  22825. _drawOnRow(t) {
  22826. this._hovered && (!this._hasNext || !this._hasPrevious ? ge.drawWith(t, {
  22827. width: this._size,
  22828. height: this._size,
  22829. stroke: yn,
  22830. fill: oo
  22831. }) : ge.drawWith(t, {
  22832. width: this._size,
  22833. height: 2 * this._size,
  22834. stroke: yn,
  22835. fill: oo
  22836. }));
  22837. const n = this._size * 0.5 * this._iconRatio, s = Math.PI / 3, i = n * Math.cos(s), o = n * Math.sin(s);
  22838. if (this._hasPrevious && Ws.drawWith(t, {
  22839. pointsGroup: [
  22840. [
  22841. { x: this._size / 2, y: this._size / 2 - o },
  22842. { x: this._size / 2 - o, y: this._size / 2 + i },
  22843. { x: this._size / 2 + o, y: this._size / 2 + i }
  22844. ]
  22845. ],
  22846. fill: yn
  22847. }), this._hasNext) {
  22848. const l = this._hasPrevious ? 3 : 1;
  22849. Ws.drawWith(t, {
  22850. pointsGroup: [
  22851. [
  22852. { x: this._size / 2, y: this._size * l / 2 + o },
  22853. { x: this._size / 2 - o, y: this._size * l / 2 - i },
  22854. { x: this._size / 2 + o, y: this._size * l / 2 - i }
  22855. ]
  22856. ],
  22857. fill: yn
  22858. });
  22859. }
  22860. }
  22861. /**
  22862. *
  22863. * @param ctx
  22864. */
  22865. _drawOnCol(t) {
  22866. this._hovered && (!this._hasNext || !this._hasPrevious ? ge.drawWith(t, {
  22867. width: this._size,
  22868. height: this._size,
  22869. stroke: yn,
  22870. fill: oo
  22871. }) : ge.drawWith(t, {
  22872. width: 2 * this._size,
  22873. height: this._size,
  22874. stroke: yn,
  22875. fill: oo
  22876. }));
  22877. const n = this._size * 0.5 * this._iconRatio, s = Math.PI / 3, i = n * Math.cos(s), o = n * Math.sin(s);
  22878. if (this._hasPrevious && Ws.drawWith(t, {
  22879. pointsGroup: [
  22880. [
  22881. { x: -i + this._size / 2, y: this._size / 2 },
  22882. { x: this._size / 2 + o, y: this._size / 2 - o },
  22883. { x: this._size / 2 + o, y: this._size / 2 + o }
  22884. ]
  22885. ],
  22886. fill: yn
  22887. }), this._hasNext) {
  22888. const l = this._hasPrevious ? 3 : 1;
  22889. Ws.drawWith(t, {
  22890. pointsGroup: [
  22891. [
  22892. { x: i + this._size * l / 2, y: this._size / 2 },
  22893. { x: -o + this._size * l / 2, y: this._size / 2 - o },
  22894. { x: -o + this._size * l / 2, y: this._size / 2 + o }
  22895. ]
  22896. ],
  22897. fill: yn
  22898. });
  22899. }
  22900. }
  22901. }
  22902. var E2 = Object.defineProperty, T2 = Object.getOwnPropertyDescriptor, x2 = (r, e, t, n) => {
  22903. for (var s = n > 1 ? void 0 : n ? T2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  22904. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  22905. return n && s && E2(e, t, s), s;
  22906. }, Eh = (r, e) => (t, n) => e(t, n, r);
  22907. const Th = "__SpreadsheetHeaderUnhideSHAPEControllerShape__";
  22908. Ni.id, Ai.id, Oi.id, xi.id, xl.id, Tl.id, Qt.id, hm.id, Sd.id, Cd.id, vd.id, bd.id;
  22909. let qc = class extends kn {
  22910. constructor(e, t, n) {
  22911. super();
  22912. w(this, "_shapes", { cols: [], rows: [] });
  22913. this._context = e, this._sheetSkeletonManagerService = t, this._commandService = n, this._init();
  22914. }
  22915. get _workbook() {
  22916. return this._context.unit;
  22917. }
  22918. dispose() {
  22919. super.dispose(), this._clearShapes();
  22920. }
  22921. _init() {
  22922. let e = "";
  22923. this._context.unit.activeSheet$.pipe(os(this.dispose$)).subscribe((t) => {
  22924. if (this._clearShapes(), !t) {
  22925. e = "";
  22926. return;
  22927. }
  22928. e = t.getSheetId(), this._update(this._workbook, t);
  22929. }), this.disposeWithMe(
  22930. this._sheetSkeletonManagerService.currentSkeleton$.subscribe((t) => {
  22931. if (t) {
  22932. const { unitId: n, sheetId: s } = t;
  22933. if (n === this._workbook.getUnitId() && s === e) {
  22934. const i = this._workbook.getSheetBySheetId(s);
  22935. i && this._update(this._workbook, i);
  22936. }
  22937. }
  22938. })
  22939. );
  22940. }
  22941. _update(e, t) {
  22942. var h;
  22943. const n = (h = this._sheetSkeletonManagerService.getWorksheetSkeleton(t.getSheetId())) == null ? void 0 : h.skeleton;
  22944. if (!n) return;
  22945. const s = t.getHiddenRows(), i = t.getHiddenCols(), o = this._getSheetObject(), { scene: l } = o, a = t.getRowCount(), c = s.map((m) => {
  22946. const { startRow: f, endRow: g } = m, p = Nu(f, 0, l, n), S = f !== 0, b = g !== a - 1;
  22947. return new Ph(
  22948. Th,
  22949. {
  22950. type: Gc.ROW,
  22951. hovered: !1,
  22952. hasPrevious: S,
  22953. hasNext: b,
  22954. top: p.startY - (S ? Us : 0),
  22955. left: p.startX - Us
  22956. },
  22957. () => this._commandService.executeCommand(
  22958. IC.id,
  22959. {
  22960. unitId: e.getUnitId(),
  22961. subUnitId: t.getSheetId(),
  22962. ranges: [m]
  22963. }
  22964. )
  22965. );
  22966. }), d = t.getColumnCount(), u = i.map((m) => {
  22967. const { startColumn: f, endColumn: g } = m, p = Nu(0, f, l, n), S = f !== 0, b = g !== d - 1;
  22968. return new Ph(
  22969. Th,
  22970. {
  22971. type: Gc.COLUMN,
  22972. hovered: !1,
  22973. hasPrevious: S,
  22974. hasNext: b,
  22975. top: 20 - Us,
  22976. left: p.startX - (S ? Us : 0)
  22977. },
  22978. () => this._commandService.executeCommand(
  22979. yC.id,
  22980. {
  22981. unitId: e.getUnitId(),
  22982. subUnitId: t.getSheetId(),
  22983. ranges: [m]
  22984. }
  22985. )
  22986. );
  22987. });
  22988. l.addObjects(u, xu), l.addObjects(c, xu), this._clearShapes(), this._shapes = { cols: u, rows: c };
  22989. }
  22990. _clearShapes() {
  22991. this._shapes.cols.forEach((e) => e.dispose()), this._shapes.rows.forEach((e) => e.dispose()), this._shapes = { cols: [], rows: [] };
  22992. }
  22993. _getSheetObject() {
  22994. return pn(this._workbook, this._context);
  22995. }
  22996. };
  22997. qc = x2([
  22998. Eh(1, D(me)),
  22999. Eh(2, F)
  23000. ], qc);
  23001. var O2 = Object.defineProperty, A2 = Object.getOwnPropertyDescriptor, N2 = (r, e, t, n) => {
  23002. for (var s = n > 1 ? void 0 : n ? A2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  23003. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  23004. return n && s && O2(e, t, s), s;
  23005. }, Zn = (r, e) => (t, n) => e(t, n, r);
  23006. let Qc = class extends ef {
  23007. constructor(e, t, n, s, i, o, l, a, c) {
  23008. super(
  23009. t,
  23010. n,
  23011. s,
  23012. o,
  23013. c
  23014. );
  23015. w(this, "_workbookSelections");
  23016. w(this, "_renderDisposable", null);
  23017. this._context = e, this._logService = l, this._commandService = a, this._contextService = c, this._workbookSelections = i.getWorkbookSelections(this._context.unitId), this._init();
  23018. }
  23019. _init() {
  23020. const e = this._getSheetObject();
  23021. this._contextService.setContextValue(Yr, !0), this._initEventListeners(e), this._initSelectionModelChangeListener(), this._initThemeChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener();
  23022. }
  23023. _initEventListeners(e) {
  23024. const { spreadsheetRowHeader: t, spreadsheetColumnHeader: n, spreadsheet: s, spreadsheetLeftTopPlaceholder: i } = e, { scene: o } = this._context;
  23025. this.disposeWithMe(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, a) => {
  23026. this.isSelectionDisabled() || this.inRefSelectionMode() || (this._onPointerDown(l, s.zIndex + 1, j.NORMAL, this._getActiveViewport(l)), l.button !== 2 && a.stopPropagation());
  23027. })), this.disposeWithMe(
  23028. t == null ? void 0 : t.onPointerDown$.subscribeEvent((l, a) => {
  23029. if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
  23030. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: d } = Nn(l.offsetX, l.offsetY, o, c);
  23031. Nf(this._workbookSelections.getCurrentSelections(), d) || (this._onPointerDown(l, (s.zIndex || 1) + 1, j.ROW, this._getActiveViewport(l), It.Y), l.button !== 2 && a.stopPropagation());
  23032. })
  23033. ), this.disposeWithMe(n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, a) => {
  23034. if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
  23035. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: d } = Nn(l.offsetX, l.offsetY, o, c);
  23036. Hf(this._workbookSelections.getCurrentSelections(), d) || (this._onPointerDown(l, (s.zIndex || 1) + 1, j.COLUMN, this._getActiveViewport(l), It.X), l.button !== 2 && a.stopPropagation());
  23037. })), this.disposeWithMe(i == null ? void 0 : i.onPointerDown$.subscribeEvent((l, a) => {
  23038. if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
  23039. this._reset();
  23040. const c = this._sheetSkeletonManagerService.getCurrent().skeleton, d = tf(c);
  23041. this._addSelectionControlByModelData(d), this.refreshSelectionMoveEnd(), l.button !== 2 && a.stopPropagation();
  23042. }));
  23043. }
  23044. _initThemeChangeListener() {
  23045. this.disposeWithMe(this._themeService.currentTheme$.subscribe(() => {
  23046. this._initSelectionThemeFromThemeService();
  23047. const e = this._workbookSelections.getCurrentSelections();
  23048. e && this.resetSelectionsByModelData(e);
  23049. }));
  23050. }
  23051. /**
  23052. * Response for selection model changing.
  23053. */
  23054. _initSelectionModelChangeListener() {
  23055. this.disposeWithMe(mt(
  23056. this._workbookSelections.selectionMoveEnd$,
  23057. // triggered by keyboard(e.g. arrow key tab enter)
  23058. this._workbookSelections.selectionSet$
  23059. // shift + arrow key
  23060. ).subscribe((e) => {
  23061. this.resetSelectionsByModelData(e);
  23062. }));
  23063. }
  23064. disableSelection() {
  23065. this._contextService.setContextValue(Yr, !1);
  23066. }
  23067. enableSelection() {
  23068. this._contextService.setContextValue(Yr, !0);
  23069. }
  23070. transparentSelection() {
  23071. this.setSelectionTheme({
  23072. primaryColor: "transparent"
  23073. });
  23074. const e = this._workbookSelections.getCurrentSelections();
  23075. for (let t = 0; t < e.length; t++) {
  23076. const n = e[t];
  23077. n.style = yr(this._selectionTheme);
  23078. }
  23079. this.resetSelectionsByModelData(e);
  23080. }
  23081. showSelection() {
  23082. const e = this._themeService.getCurrentTheme();
  23083. this.setSelectionTheme(e);
  23084. const t = this._workbookSelections.getCurrentSelections();
  23085. for (let n = 0; n < t.length; n++) {
  23086. const s = t[n];
  23087. s.style && (s.style = yr(this._selectionTheme));
  23088. }
  23089. this.resetSelectionsByModelData(t);
  23090. }
  23091. /**
  23092. * Handle events in spreadsheet. (e.g. drag and move to make a selection)
  23093. */
  23094. _initUserActionSyncListener() {
  23095. this.disposeWithMe(this.selectionMoveStart$.subscribe((e) => this._updateSelections(e, Xt.MOVE_START))), this.disposeWithMe(this.selectionMoving$.subscribe((e) => this._updateSelections(e, Xt.MOVING))), this.disposeWithMe(this._contextService.subscribeContextValue$(Js).pipe(Vt(!1), cn()).subscribe((e) => {
  23096. e && this._reset();
  23097. })), this.disposeWithMe(this._contextService.subscribeContextValue$(Yr).pipe(Vt(!0), cn()).subscribe((e) => {
  23098. var t;
  23099. e ? this._renderDisposable = Ae(
  23100. this.selectionMoveEnd$.subscribe((n) => {
  23101. this._updateSelections(n, Xt.MOVE_END);
  23102. })
  23103. ) : ((t = this._renderDisposable) == null || t.dispose(), this._renderDisposable = null, this._reset());
  23104. }));
  23105. }
  23106. /**
  23107. * Update selectionData to selectionDataModel (WorkBookSelections) by SetSelectionsOperation.
  23108. *
  23109. * Unlike baseSelectionRenderService@resetSelectionsByModelData, this method is for update WorkbookSelectionModel.
  23110. *
  23111. *
  23112. * @param selectionDataWithStyleList
  23113. * @param type
  23114. */
  23115. _updateSelections(e, t) {
  23116. const n = this._context.unit, s = n.getUnitId(), i = n.getActiveSheet().getSheetId();
  23117. if (e.length === 0)
  23118. return;
  23119. const o = e.map(
  23120. (l) => Am(l)
  23121. );
  23122. this._commandService.executeCommand(He.id, {
  23123. unitId: s,
  23124. subUnitId: i,
  23125. type: t,
  23126. selections: o
  23127. });
  23128. }
  23129. _initSkeletonChangeListener() {
  23130. this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((e) => {
  23131. var c, d;
  23132. if (e == null) {
  23133. this._logService.error("[SelectionRenderService]: should not receive null!");
  23134. return;
  23135. }
  23136. const t = this._context.unitId, { sheetId: n, skeleton: s } = e, { scene: i } = this._context, o = i.getViewport(z.VIEW_MAIN), l = (d = (c = this._skeleton) == null ? void 0 : c.worksheet) == null ? void 0 : d.getSheetId();
  23137. if (this._changeRuntime(s, i, o), l !== s.worksheet.getSheetId()) {
  23138. const u = this._workbookSelections.getCurrentSelections();
  23139. this._commandService.syncExecuteCommand(He.id, {
  23140. unitId: t,
  23141. subUnitId: n,
  23142. selections: u.length !== 0 ? u : [Od(s)]
  23143. });
  23144. }
  23145. const a = this._workbookSelections.getCurrentSelections();
  23146. a != null && this.resetSelectionsByModelData(a);
  23147. }));
  23148. }
  23149. _getActiveViewport(e) {
  23150. const t = this._getSheetObject();
  23151. return t == null ? void 0 : t.scene.getActiveViewportByCoord(Oe.FromArray([e.offsetX, e.offsetY]));
  23152. }
  23153. _getSheetObject() {
  23154. return pn(this._context.unit, this._context);
  23155. }
  23156. /**
  23157. * Handle pointer down event, bind pointermove & pointerup handler.
  23158. * then trigger selectionMoveStart$.
  23159. *
  23160. * @param evt
  23161. * @param _zIndex
  23162. * @param rangeType
  23163. * @param viewport
  23164. * @param scrollTimerType
  23165. */
  23166. // eslint-disable-next-line complexity, max-lines-per-function
  23167. _onPointerDown(e, t = 0, n = j.NORMAL, s, i = It.ALL) {
  23168. var E, T;
  23169. this._rangeType = n;
  23170. const o = this._skeleton, l = this._scene;
  23171. if (!l || !o)
  23172. return;
  23173. s && (this._activeViewport = s);
  23174. const { offsetX: a, offsetY: c } = e, d = l.getViewport(z.VIEW_MAIN);
  23175. if (!d) return;
  23176. const u = l.getCoordRelativeToViewport(Oe.FromArray([a, c])), { x: h, y: m } = u;
  23177. this._startViewportPosX = h, this._startViewportPosY = m;
  23178. const f = l.getScrollXYInfoByViewport(u), { scaleX: g, scaleY: p } = l.getAncestorScale(), S = this._skeleton.getCellByOffset(h, m, g, p, f);
  23179. if (!S) return;
  23180. switch (n) {
  23181. case j.NORMAL:
  23182. break;
  23183. case j.ROW:
  23184. S.startColumn = 0, S.endColumn = this._skeleton.getColumnCount() - 1, S.startRow = S.actualRow, S.endRow = S.actualRow;
  23185. break;
  23186. case j.COLUMN:
  23187. S.startRow = 0, S.endRow = this._skeleton.getRowCount() - 1, S.startColumn = S.actualColumn, S.endColumn = S.actualColumn;
  23188. break;
  23189. case j.ALL:
  23190. S.startRow = 0, S.startColumn = 0, S.endRow = this._skeleton.getRowCount() - 1, S.endColumn = this._skeleton.getColumnCount() - 1;
  23191. }
  23192. const b = { range: S, primary: S, style: null };
  23193. b.range.rangeType = n;
  23194. const v = Pt(b, this._skeleton);
  23195. this._startRangeWhenPointerDown = { ...v.rangeWithCoord };
  23196. let _ = this.getActiveSelectionControl();
  23197. const R = { ...v.rangeWithCoord, rangeType: n }, I = this.getSelectionControls();
  23198. for (const A of I)
  23199. if (e.button === 2 && A.model.isInclude(R)) {
  23200. _ = A;
  23201. return;
  23202. }
  23203. this._checkClearPreviousControls(e);
  23204. const y = _ == null ? void 0 : _.model.currentCell, M = e.shiftKey && y, P = this._remainLastEnabled && !e.ctrlKey && !e.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
  23205. M && y ? this._makeSelectionByTwoCells(
  23206. y,
  23207. R,
  23208. o,
  23209. n,
  23210. _
  23211. // Get updated in this method
  23212. ) : P && _ ? _.updateRangeBySelectionWithCoord(v) : _ = this.newSelectionControl(l, o, b);
  23213. for (let A = 0; A < this.getSelectionControls().length - 1; A++)
  23214. this.getSelectionControls()[A].clearHighlight();
  23215. l.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (E = l.getTransformer()) == null || E.clearSelectedObjects(), this._setupPointerMoveListener(d, _, n, i, h, m), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._scenePointerUpSub = l.onPointerUp$.subscribeEvent(() => {
  23216. var A;
  23217. this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (A = this._escapeShortcutDisposable) == null || A.dispose(), this._escapeShortcutDisposable = null;
  23218. }), (T = this._scene.getEngine()) == null || T.setCapture();
  23219. }
  23220. };
  23221. Qc = N2([
  23222. Zn(1, D(vt)),
  23223. Zn(2, D(kt)),
  23224. Zn(3, Il),
  23225. Zn(4, D($)),
  23226. Zn(5, D(me)),
  23227. Zn(6, vl),
  23228. Zn(7, F),
  23229. Zn(8, Ne)
  23230. ], Qc);
  23231. var up = Object.defineProperty, H2 = Object.getOwnPropertyDescriptor, V2 = (r, e, t) => e in r ? up(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k2 = (r, e, t, n) => {
  23232. for (var s = n > 1 ? void 0 : n ? H2(e, t) : e, i = r.length - 1, o; i >= 0; i--)
  23233. (o = r[i]) && (s = (n ? o(e, t, s) : o(s)) || s);
  23234. return n && s && up(e, t, s), s;
  23235. }, ao = (r, e) => (t, n) => e(t, n, r), hp = (r, e, t) => V2(r, typeof e != "symbol" ? e + "" : e, t);
  23236. let fl = class extends Xh {
  23237. /** @ignore */
  23238. constructor(r = Lc, e, t, n, s) {
  23239. super(), this._config = r, this._injector = e, this._renderManagerService = t, this._configService = n, this._univerInstanceService = s;
  23240. const { menu: i, ...o } = Kp(
  23241. {},
  23242. Lc,
  23243. this._config
  23244. );
  23245. i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Pr, o);
  23246. }
  23247. onStarting() {
  23248. du(this._injector, Jp([
  23249. [ds],
  23250. [tt, { useClass: yc }],
  23251. [Sn, { useClass: Bo }],
  23252. [kr, { useClass: eg }],
  23253. [Un, { useClass: Fo }],
  23254. [Fl, { useClass: t1 }],
  23255. [ca, { useClass: n0 }],
  23256. [El, { useClass: Hm }],
  23257. [Hr, { useClass: No }],
  23258. [ap],
  23259. [da, { useClass: lg }],
  23260. [ws, { useClass: Lo }],
  23261. [Er],
  23262. [wi],
  23263. [vi],
  23264. [bi],
  23265. [Ad],
  23266. // controllers
  23267. [Ci],
  23268. [ri],
  23269. [ui],
  23270. [Mi],
  23271. [Mr],
  23272. [qo],
  23273. [ps],
  23274. [Vo],
  23275. [ml],
  23276. [ul],
  23277. [hl],
  23278. [dl],
  23279. // permission
  23280. [gs],
  23281. [Vr],
  23282. [Ii],
  23283. [Ri],
  23284. [yi]
  23285. ], this._config.override)), Gi(this._injector, [
  23286. [gs]
  23287. ]);
  23288. }
  23289. onReady() {
  23290. this._config.disableAutoFocus || this._initAutoFocus(), du(this._injector, [
  23291. [_i]
  23292. ]), this._registerRenderBasics(), Gi(this._injector, [
  23293. [qo],
  23294. [Mr],
  23295. [Ci],
  23296. [Ri]
  23297. ]);
  23298. }
  23299. onRendered() {
  23300. this._registerRenderModules(), Gi(this._injector, [
  23301. [yi],
  23302. [_i],
  23303. [Mi],
  23304. [ul],
  23305. [ps],
  23306. [ri],
  23307. [ui],
  23308. [hl],
  23309. [dl]
  23310. ]);
  23311. }
  23312. onSteady() {
  23313. Gi(this._injector, [
  23314. [ml],
  23315. [Vo],
  23316. [Ii]
  23317. ]);
  23318. }
  23319. _registerRenderBasics() {
  23320. [
  23321. [me],
  23322. [Xo],
  23323. [dt, { useClass: Qc }]
  23324. ].forEach((r) => {
  23325. this.disposeWithMe(this._renderManagerService.registerRenderModule(O.UNIVER_SHEET, r));
  23326. });
  23327. }
  23328. // We have to let render basics get bootstrapped before. Because some render controllers relies on
  23329. // a correct skeleton when they get loaded.
  23330. _registerRenderModules() {
  23331. var n;
  23332. const r = [
  23333. [mi],
  23334. [qc],
  23335. [jo],
  23336. // Caution: ScrollRenderController should placed before ZoomRenderController.
  23337. [yt],
  23338. [ai],
  23339. [hi],
  23340. [ii],
  23341. [Do],
  23342. [ll],
  23343. [Qo],
  23344. [Jo],
  23345. [tl],
  23346. [el],
  23347. [Ko],
  23348. [$o],
  23349. [ko],
  23350. [Xc],
  23351. [jc],
  23352. // editor
  23353. [zc],
  23354. [Ec],
  23355. // permission
  23356. [rl],
  23357. [sl],
  23358. [il],
  23359. [ol]
  23360. ], e = this._configService.getConfig(Qh);
  23361. ((n = e == null ? void 0 : e.contextMenu) != null ? n : !0) && r.push([Zc]), r.forEach((s) => {
  23362. this.disposeWithMe(this._renderManagerService.registerRenderModule(O.UNIVER_SHEET, s));
  23363. });
  23364. }
  23365. _initAutoFocus() {
  23366. const r = this._univerInstanceService;
  23367. this.disposeWithMe(r.getCurrentTypeOfUnit$(O.UNIVER_SHEET).pipe(Zm((e) => !!e)).subscribe((e) => r.focusUnit(e.getUnitId())));
  23368. }
  23369. };
  23370. hp(fl, "pluginName", "SHEET_UI_PLUGIN");
  23371. hp(fl, "type", O.UNIVER_SHEET);
  23372. fl = k2([
  23373. jh(Nm),
  23374. ao(1, D(vt)),
  23375. ao(2, Ce),
  23376. ao(3, xr),
  23377. ao(4, L)
  23378. ], fl);
  23379. const D2 = "embedding_formula_editor", lE = (r) => r.includes(D2);
  23380. function aE(r, e, t, n) {
  23381. const { from: s, to: i } = t, { column: o, columnOffset: l, row: a, rowOffset: c } = s, { column: d, columnOffset: u, row: h, rowOffset: m } = i, f = n.getOrCreateSkeleton({ sheetId: e });
  23382. if (f == null)
  23383. throw new Error("No current skeleton");
  23384. const g = ni(f, {
  23385. startColumn: o,
  23386. endColumn: o,
  23387. startRow: a,
  23388. endRow: a
  23389. }), p = ni(f, {
  23390. startColumn: d,
  23391. endColumn: d,
  23392. startRow: h,
  23393. endRow: h
  23394. }), { startX: S, startY: b } = g, { startX: v, startY: _ } = p, R = qn(S + l, 1), I = qn(b + c, 1);
  23395. let y = qn(v + u - R, 1), M = qn(_ + m - I, 1);
  23396. return g.startX === p.endX && (y = 0), g.startY === p.endY && (M = 0), {
  23397. unitId: r,
  23398. subUnitId: e,
  23399. left: R,
  23400. top: I,
  23401. width: y,
  23402. height: M
  23403. };
  23404. }
  23405. function cE(r, e, t, n, s, i, o) {
  23406. const { column: l, columnOffset: a, row: c, rowOffset: d } = t, u = o.getOrCreateSkeleton({ sheetId: e });
  23407. if (u == null)
  23408. throw new Error("No current skeleton");
  23409. const h = ni(u, {
  23410. startColumn: l,
  23411. endColumn: l,
  23412. startRow: c,
  23413. endRow: c
  23414. }), { startX: m, startY: f } = h, g = qn(m + a, 1), p = qn(f + d, 1), S = i.getCellWithCoordByOffset(g + n, p + s, u);
  23415. if (S == null)
  23416. throw new Error("No end selection cell");
  23417. const b = {
  23418. column: S.actualColumn,
  23419. columnOffset: qn(g + n - S.startX, 1),
  23420. row: S.actualRow,
  23421. rowOffset: qn(p + s - S.startY, 1)
  23422. };
  23423. return {
  23424. unitId: r,
  23425. subUnitId: e,
  23426. sheetTransform: {
  23427. from: {
  23428. column: l,
  23429. columnOffset: a,
  23430. row: c,
  23431. rowOffset: d
  23432. },
  23433. to: b
  23434. },
  23435. transform: {
  23436. left: g,
  23437. top: p,
  23438. width: n,
  23439. height: s
  23440. }
  23441. };
  23442. }
  23443. export {
  23444. qm as AFFECT_LAYOUT_STYLES,
  23445. ke as APPLY_TYPE,
  23446. es as AddRangeProtectionFromContextMenuCommand,
  23447. na as AddRangeProtectionFromSheetBarCommand,
  23448. ta as AddRangeProtectionFromToolbarCommand,
  23449. Zl as ApplyFormatPainterCommand,
  23450. si as AutoClearContentCommand,
  23451. pr as AutoFillCommand,
  23452. Vo as AutoFillController,
  23453. No as AutoFillService,
  23454. ri as AutoHeightController,
  23455. ui as AutoWidthController,
  23456. ef as BaseSelectionRenderService,
  23457. gr as COPY_TYPE,
  23458. bi as CellAlertManagerService,
  23459. Ks as CellAlertType,
  23460. ko as CellCustomRenderController,
  23461. t1 as CellEditorManagerService,
  23462. la as ChangeSheetProtectionFromSheetBarCommand,
  23463. Li as ChangeZoomRatioCommand,
  23464. ut as DATA_TYPE,
  23465. Xi as DeleteRangeMoveLeftConfirmCommand,
  23466. ms as DeleteRangeMoveUpConfirmCommand,
  23467. ns as DeleteRangeProtectionFromContextMenuCommand,
  23468. oa as DeleteWorksheetProtectionFormSheetBarCommand,
  23469. wi as DragManagerService,
  23470. Ko as DragRenderController,
  23471. D2 as EMBEDDING_FORMULA_EDITOR,
  23472. Td as EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY,
  23473. Ec as EditingRenderController,
  23474. yc as EditorBridgeService,
  23475. Gt as ExpandSelectionCommand,
  23476. Fd as FONT_FAMILY_COMPONENT,
  23477. Ud as FONT_FAMILY_ITEM_COMPONENT,
  23478. jd as FONT_SIZE_COMPONENT,
  23479. zt as FormatPainterStatus,
  23480. Mi as FormulaEditorController,
  23481. hi as HeaderFreezeRenderController,
  23482. mi as HeaderMoveRenderController,
  23483. jo as HeaderResizeRenderController,
  23484. jl as HideColConfirmCommand,
  23485. Ul as HideRowConfirmCommand,
  23486. Er as HoverManagerService,
  23487. el as HoverRenderController,
  23488. Hr as IAutoFillService,
  23489. Fl as ICellEditorManagerService,
  23490. tt as IEditorBridgeService,
  23491. Un as IFormatPainterService,
  23492. ca as IFormulaEditorManagerService,
  23493. ws as IMarkSelectionService,
  23494. Sn as ISheetClipboardService,
  23495. dt as ISheetSelectionRenderService,
  23496. fs as InsertRangeMoveDownConfirmCommand,
  23497. zi as InsertRangeMoveRightConfirmCommand,
  23498. Bn as JumpOver,
  23499. Lo as MarkSelectionService,
  23500. yy as MobileSheetBar,
  23501. Lt as MoveSelectionCommand,
  23502. Fn as MoveSelectionEnterAndTabCommand,
  23503. go as PASTE_SPECIAL_MENU_ID,
  23504. rt as PREDEFINED_HOOK_NAME,
  23505. Jm as RANGE_SELECTOR_COMPONENT_KEY,
  23506. _1 as RANGE_SELECTOR_SYMBOLS,
  23507. Ll as RefillCommand,
  23508. pi as RemoveColConfirmCommand,
  23509. gi as RemoveRowConfirmCommand,
  23510. sa as RemoveSheetConfirmCommand,
  23511. aa as RenameSheetOperation,
  23512. IR as RenderSheetContent,
  23513. wR as RenderSheetFooter,
  23514. RR as RenderSheetHeader,
  23515. Pf as ResetRangeTextColorCommand,
  23516. nE as ResetScrollCommand,
  23517. $m as SELECTION_SHAPE_DEPTH,
  23518. eE as SHEET_UI_PLUGIN_NAME,
  23519. qe as SHEET_VIEW_KEY,
  23520. un as ScrollCommand,
  23521. of as ScrollToCellCommand,
  23522. lf as ScrollToRangeOperation,
  23523. Vd as SelectAllCommand,
  23524. xd as SelectionControl,
  23525. xd as SelectionShape,
  23526. Cv as SelectionShapeExtension,
  23527. Kd as SetActivateCellEditOperation,
  23528. cs as SetCellEditVisibleArrowOperation,
  23529. Et as SetCellEditVisibleOperation,
  23530. Wl as SetCellEditVisibleWithF2Operation,
  23531. ql as SetColumnFrozenCommand,
  23532. Yl as SetFormatPainterOperation,
  23533. Bd as SetInfiniteFormatPainterCommand,
  23534. Bi as SetOnceFormatPainterCommand,
  23535. Rs as SetRangeBoldCommand,
  23536. zl as SetRangeFontFamilyCommand,
  23537. Xl as SetRangeFontSizeCommand,
  23538. Is as SetRangeItalicCommand,
  23539. rs as SetRangeProtectionFromContextMenuCommand,
  23540. Ms as SetRangeStrickThroughCommand,
  23541. yf as SetRangeSubscriptCommand,
  23542. Mf as SetRangeSuperscriptCommand,
  23543. di as SetRangeTextColorCommand,
  23544. ys as SetRangeUnderlineCommand,
  23545. Gl as SetRowFrozenCommand,
  23546. dn as SetScrollOperation,
  23547. li as SetScrollRelativeCommand,
  23548. $n as SetSelectionFrozenCommand,
  23549. Ql as SetWorksheetColAutoWidthCommand,
  23550. Wi as SetZoomRatioCommand,
  23551. $t as SetZoomRatioOperation,
  23552. aR as SheetBar,
  23553. vi as SheetCanvasPopManagerService,
  23554. Do as SheetCellEditorResizeService,
  23555. Bo as SheetClipboardService,
  23556. hn as SheetCopyCommand,
  23557. Rf as SheetCutCommand,
  23558. _b as SheetMenuPosition,
  23559. Qs as SheetPasteBesidesBorderCommand,
  23560. Jr as SheetPasteColWidthCommand,
  23561. mn as SheetPasteCommand,
  23562. qs as SheetPasteFormatCommand,
  23563. xc as SheetPasteShortKeyCommand,
  23564. Gs as SheetPasteValueCommand,
  23565. Ri as SheetPermissionCheckUIController,
  23566. tg as SheetPermissionOpenDialogOperation,
  23567. Vn as SheetPermissionOpenPanelOperation,
  23568. Vr as SheetPermissionUserManagerService,
  23569. ap as SheetPrintInterceptorService,
  23570. Xo as SheetRenderController,
  23571. yt as SheetScrollManagerService,
  23572. Qc as SheetSelectionRenderService,
  23573. me as SheetSkeletonManagerService,
  23574. qo as SheetUIController,
  23575. Mr as SheetsRenderService,
  23576. ai as SheetsScrollRenderController,
  23577. oI as SheetsUIMenuSchema,
  23578. Gm as SheetsUIPart,
  23579. ia as ShowMenuListCommand,
  23580. Jd as SidebarDefinedNameOperation,
  23581. ps as StatusBarController,
  23582. qf as UNIVER_SHEET_PERMISSION_BACKGROUND,
  23583. Dc as UNIVER_SHEET_PERMISSION_USER_PART,
  23584. cl as UniverSheetsMobileUIPlugin,
  23585. fl as UniverSheetsUIPlugin,
  23586. ts as ViewSheetPermissionFromContextMenuCommand,
  23587. ra as ViewSheetPermissionFromSheetBarCommand,
  23588. xo as attachPrimaryWithCoord,
  23589. ni as attachRangeWithCoord,
  23590. Pt as attachSelectionWithCoord,
  23591. iy as calculateDocSkeletonRects,
  23592. Uo as checkInHeaderRanges,
  23593. cE as convertPositionCellToSheetOverGrid,
  23594. aE as convertPositionSheetOverGridToAbsolute,
  23595. xt as deriveStateFromActiveSheet$,
  23596. wr as discreteRangeToRange,
  23597. yr as genNormalSelectionStyle,
  23598. bv as genSelectionByRange,
  23599. tf as getAllSelection,
  23600. tE as getAutoFillRepeatRange,
  23601. K_ as getCellRealRange,
  23602. Nu as getCoordByCell,
  23603. Nn as getCoordByOffset,
  23604. bb as getCurrentExclusiveRangeInterest$,
  23605. ue as getCurrentRangeDisable$,
  23606. iE as getCustomRangePosition,
  23607. oE as getEditingCustomRangePosition,
  23608. Ed as getEditorObject,
  23609. nb as getMatrixPlainText,
  23610. Es as getObservableWithExclusiveRange$,
  23611. sE as getRepeatRange,
  23612. pn as getSheetObject,
  23613. Od as getTopLeftSelectionOfCurrSheet,
  23614. fo as getTransformCoord,
  23615. lE as isEmbeddingFormulaEditor,
  23616. w1 as isRangeSelector,
  23617. Gu as mergeSetRangeValues,
  23618. Ys as rangeToDiscreteRange,
  23619. Wn as useActiveWorkbook,
  23620. J2 as useActiveWorksheet,
  23621. dI as useHighlightRange,
  23622. $2 as useWorkbooks,
  23623. _s as virtualizeDiscreteRanges,
  23624. rE as whenFormulaEditorActivated,
  23625. De as whenSheetEditorFocused
  23626. };