@univerjs_sheets-drawing-ui.js 121 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571
  1. import {
  2. F as F2,
  3. H,
  4. _ as _2,
  5. j,
  6. u
  7. } from "./chunk-DS5QSAGN.js";
  8. import {
  9. $t,
  10. Er,
  11. Hr,
  12. Sn,
  13. _s,
  14. aE as aE2,
  15. ap,
  16. dn,
  17. dt,
  18. gr,
  19. me,
  20. ni,
  21. rt as rt2,
  22. tt as tt2,
  23. ue,
  24. vi
  25. } from "./chunk-T4NNB5UY.js";
  26. import {
  27. $o,
  28. Bn,
  29. Br,
  30. F,
  31. Fn,
  32. Gn,
  33. Hn,
  34. Jn,
  35. Js,
  36. Kn,
  37. Me,
  38. Mn,
  39. N,
  40. Oe,
  41. Oo,
  42. Pe,
  43. Pt as Pt2,
  44. Qt,
  45. Te,
  46. Tt,
  47. V,
  48. Wo,
  49. Xt,
  50. Zt as Zt2,
  51. an,
  52. ea,
  53. et,
  54. gh,
  55. gt,
  56. jn as jn2,
  57. kr,
  58. mt,
  59. ne,
  60. nt as nt2,
  61. oe,
  62. on,
  63. pt,
  64. qn,
  65. qt as qt2,
  66. sn,
  67. tt,
  68. ut,
  69. yr,
  70. zn
  71. } from "./chunk-BW43Z7N3.js";
  72. import "./chunk-QRYBFJ3R.js";
  73. import {
  74. Vi,
  75. rf
  76. } from "./chunk-MIOQ566M.js";
  77. import {
  78. De,
  79. Ke,
  80. Kt,
  81. cn as cn2,
  82. jn,
  83. vr,
  84. xe
  85. } from "./chunk-AGSU7DWG.js";
  86. import {
  87. $e,
  88. Fa,
  89. I1,
  90. Le,
  91. f1,
  92. fl,
  93. it,
  94. l1,
  95. l3,
  96. m1,
  97. n1,
  98. o3,
  99. rt
  100. } from "./chunk-POAJ2YNP.js";
  101. import {
  102. Xw,
  103. e_,
  104. t_
  105. } from "./chunk-GBYP4PB2.js";
  106. import "./chunk-PZD7N4BC.js";
  107. import {
  108. A1,
  109. Y,
  110. Yx,
  111. aS,
  112. b3,
  113. ff,
  114. i2,
  115. ie,
  116. pf
  117. } from "./chunk-2MK3Q52E.js";
  118. import "./chunk-BSDDCPAW.js";
  119. import {
  120. _,
  121. f
  122. } from "./chunk-23GLNZMH.js";
  123. import {
  124. At,
  125. On,
  126. Ut,
  127. Yt,
  128. Zt,
  129. bn,
  130. ln,
  131. mn,
  132. vn,
  133. wn
  134. } from "./chunk-QG2HZMYH.js";
  135. import {
  136. B0,
  137. BehaviorSubject,
  138. DR,
  139. Fe,
  140. Hd,
  141. Ht,
  142. IR,
  143. J0,
  144. K0,
  145. Kp,
  146. Mf,
  147. Mi,
  148. OR,
  149. Oa,
  150. Ot,
  151. Pt,
  152. Ra,
  153. SE,
  154. Sr,
  155. Subject,
  156. UE,
  157. Ve,
  158. Vn,
  159. Vr,
  160. W0,
  161. Xp,
  162. Ze,
  163. _n,
  164. aE,
  165. am,
  166. ar,
  167. cn,
  168. combineLatest,
  169. distinctUntilChanged,
  170. en,
  171. filter,
  172. fm,
  173. fs,
  174. g0,
  175. gm,
  176. kt,
  177. map,
  178. mu,
  179. nt,
  180. nu,
  181. oE,
  182. om,
  183. ot,
  184. qt,
  185. re,
  186. rr,
  187. st,
  188. su,
  189. switchMap,
  190. take,
  191. takeUntil,
  192. tr,
  193. we,
  194. wu,
  195. yR
  196. } from "./chunk-23V3HWTR.js";
  197. import {
  198. require_react
  199. } from "./chunk-GNR2UJZM.js";
  200. import {
  201. __toESM
  202. } from "./chunk-2LSFTFF7.js";
  203. // node_modules/.pnpm/@univerjs+sheets-drawing-ui@0.5.5_@grpc+grpc-js@1.13.4_react-dom@18.3.1_react@18.3.1_rxjs@7.8.1_typescript@5.4.5/node_modules/@univerjs/sheets-drawing-ui/lib/es/index.js
  204. var import_react = __toESM(require_react());
  205. var vr2 = Object.defineProperty;
  206. var Sr2 = (i, e, n) => e in i ? vr2(i, e, { enumerable: true, configurable: true, writable: true, value: n }) : i[e] = n;
  207. var J = (i, e, n) => Sr2(i, typeof e != "symbol" ? e + "" : e, n);
  208. var Hi = "sheets-drawing-ui.config";
  209. var Cn = {};
  210. var F3 = {
  211. id: "sheet.operation.clear-drawing-transformer",
  212. type: ar.MUTATION,
  213. handler: (i, e) => {
  214. const n = i.get(Yx);
  215. return e.forEach((t) => {
  216. var r, s;
  217. (s = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || s.debounceRefreshControls();
  218. }), true;
  219. }
  220. };
  221. var Nt = {
  222. id: "sheet.command.remove-sheet-image",
  223. type: ar.COMMAND,
  224. handler: (i, e) => {
  225. var I, S, R;
  226. const n = i.get(Pt), t = i.get(cn), r = i.get(V), s = i.get(u);
  227. if (!e)
  228. return false;
  229. const { drawings: o } = e, c = [];
  230. o.forEach((v) => {
  231. const { unitId: C } = v;
  232. c.push(C);
  233. });
  234. const d = s.getBatchRemoveOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u2 } = d, m = r.onCommandExecute({ id: Nt.id, params: e }), p = { id: H.id, params: { unitId: g, subUnitId: a, op: h, objects: u2, type: F2.REMOVE } }, f2 = { id: H.id, params: { unitId: g, subUnitId: a, op: l, objects: u2, type: F2.INSERT } };
  235. return mu([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({
  236. unitID: g,
  237. undoMutations: [
  238. ...(S = m.preUndos) != null ? S : [],
  239. f2,
  240. ...m.undos,
  241. { id: F3.id, params: c }
  242. ],
  243. redoMutations: [
  244. ...(R = m.preRedos) != null ? R : [],
  245. p,
  246. ...m.redos,
  247. { id: F3.id, params: c }
  248. ]
  249. }), true) : false;
  250. }
  251. };
  252. var rr2 = "COMPONENT_SHEET_DRAWING_PANEL";
  253. var ir = {
  254. id: "sidebar.operation.sheet-image",
  255. type: ar.COMMAND,
  256. handler: async (i, e) => {
  257. const n = i.get(rt), t = i.get(Vr), r = i.get(_n), s = i.get(Pt);
  258. if (!N(r))
  259. return false;
  260. switch (e.value) {
  261. case "open":
  262. n.open({
  263. header: { title: t.t("sheetImage.panel.title") },
  264. children: { label: rr2 },
  265. onClose: () => {
  266. s.syncExecuteCommand(ln.id, []);
  267. },
  268. width: 360
  269. });
  270. break;
  271. case "close":
  272. default:
  273. n.close();
  274. break;
  275. }
  276. return true;
  277. }
  278. };
  279. var sr = {
  280. id: "sheet.operation.edit-sheet-image",
  281. type: ar.OPERATION,
  282. handler: (i, e) => {
  283. const n = i.get(Pt);
  284. return e == null ? false : (n.syncExecuteCommand(ln.id, [e]), n.executeCommand(ir.id, { value: "open" }), true);
  285. }
  286. };
  287. var Kt2 = { exports: {} };
  288. var Xe = {};
  289. var Rn;
  290. function Xi() {
  291. if (Rn)
  292. return Xe;
  293. Rn = 1;
  294. var i = import_react.default, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: true, ref: true, __self: true, __source: true };
  295. function o(c, d, g) {
  296. var a, l = {}, h = null, u2 = null;
  297. g !== void 0 && (h = "" + g), d.key !== void 0 && (h = "" + d.key), d.ref !== void 0 && (u2 = d.ref);
  298. for (a in d)
  299. t.call(d, a) && !s.hasOwnProperty(a) && (l[a] = d[a]);
  300. if (c && c.defaultProps)
  301. for (a in d = c.defaultProps, d)
  302. l[a] === void 0 && (l[a] = d[a]);
  303. return { $$typeof: e, type: c, key: h, ref: u2, props: l, _owner: r.current };
  304. }
  305. return Xe.Fragment = n, Xe.jsx = o, Xe.jsxs = o, Xe;
  306. }
  307. var bn2;
  308. function zi() {
  309. return bn2 || (bn2 = 1, Kt2.exports = Xi()), Kt2.exports;
  310. }
  311. var G = zi();
  312. var Ki = "univer-upload-loading";
  313. var Ji = "univer-upload-loading-body";
  314. var Zi = "univer-upload-loading-body-animation";
  315. var qi = "univer-UniverCircleAnimation";
  316. var Qi = "univer-upload-loading-body-text";
  317. var mt2 = {
  318. uploadLoading: Ki,
  319. uploadLoadingBody: Ji,
  320. uploadLoadingBodyAnimation: Zi,
  321. univerCircleAnimation: qi,
  322. uploadLoadingBodyText: Qi
  323. };
  324. var es = () => {
  325. const i = W0(Oa), e = W0(Vr), [n, t] = import_react.default.useState(0);
  326. return (0, import_react.useEffect)(() => {
  327. const r = i.change$.subscribe((s) => {
  328. t(s);
  329. });
  330. return () => {
  331. r.unsubscribe();
  332. };
  333. }, [i]), G.jsx("div", { style: { display: n > 0 ? "block" : "none" }, className: mt2.uploadLoading, children: G.jsxs("div", { className: mt2.uploadLoadingBody, children: [
  334. G.jsx("div", { className: mt2.uploadLoadingBodyAnimation }),
  335. G.jsx("div", { className: mt2.uploadLoadingBodyText, children: `${e.t("uploadLoading.loading")}: ${n}` })
  336. ] }) });
  337. };
  338. var ts = Object.defineProperty;
  339. var ns = Object.getOwnPropertyDescriptor;
  340. var rs = (i, e, n, t) => {
  341. for (var r = t > 1 ? void 0 : t ? ns(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  342. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  343. return t && r && ts(e, n, r), r;
  344. };
  345. var fe = (i, e) => (n, t) => e(n, t, i);
  346. var It = class extends J0 {
  347. constructor(e, n, t, r, s, o, c, d) {
  348. super();
  349. J(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
  350. this._injector = e, this._drawingManagerService = n, this._canvasPopManagerService = t, this._renderManagerService = r, this._univerInstanceService = s, this._contextService = o, this._uiPartsService = c, this._commandService = d, this._init();
  351. }
  352. _init() {
  353. this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_SHEET).forEach((e) => this._create(e)), this._uiPartsService.registerComponent(Le.CONTENT, () => B0(es, this._injector));
  354. }
  355. _dispose(e) {
  356. const n = e.getUnitId();
  357. this._renderManagerService.removeRender(n);
  358. }
  359. _create(e) {
  360. if (!e)
  361. return;
  362. const n = e.getUnitId();
  363. this._renderManagerService.has(n) && !this._initImagePopupMenu.has(n) && (this._popupMenuListener(n), this._initImagePopupMenu.add(n));
  364. }
  365. _hasCropObject(e) {
  366. const n = e.getAllObjectsByOrder();
  367. for (const t of n)
  368. if (t instanceof xe)
  369. return true;
  370. return false;
  371. }
  372. _popupMenuListener(e) {
  373. var s;
  374. const n = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene;
  375. if (!n)
  376. return;
  377. const t = n.getTransformerByCreate();
  378. if (!t)
  379. return;
  380. let r;
  381. this.disposeWithMe(
  382. Ze(
  383. t.createControl$.subscribe(() => {
  384. if (this._contextService.setContextValue(yR, true), this._hasCropObject(n))
  385. return;
  386. const o = t.getSelectedObjectMap();
  387. if (o.size > 1) {
  388. r == null || r.dispose();
  389. return;
  390. }
  391. const c = o.values().next().value;
  392. if (!c)
  393. return;
  394. const d = c.oKey, g = this._drawingManagerService.getDrawingOKey(d);
  395. if (!g)
  396. return;
  397. const { unitId: a, subUnitId: l, drawingId: h, drawingType: u2 } = g, m = g.data;
  398. if (m && m.disablePopup)
  399. return;
  400. r == null || r.dispose();
  401. const p = this._canvasPopManagerService.getFeatureMenu(a, l, h, u2);
  402. r = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(c, {
  403. componentKey: Kt,
  404. direction: "horizontal",
  405. offset: [2, 0],
  406. extraProps: {
  407. menuItems: p || this._getImageMenuItems(a, l, h, u2)
  408. }
  409. }));
  410. })
  411. )
  412. ), this.disposeWithMe(
  413. t.clearControl$.subscribe(() => {
  414. r == null || r.dispose(), this._contextService.setContextValue(yR, false), this._commandService.syncExecuteCommand(ln.id, []);
  415. })
  416. ), this.disposeWithMe(
  417. this._contextService.contextChanged$.subscribe((o) => {
  418. o[yR] === false && (r == null || r.dispose());
  419. })
  420. ), this.disposeWithMe(
  421. t.changing$.subscribe(() => {
  422. r == null || r.dispose();
  423. })
  424. );
  425. }
  426. _getImageMenuItems(e, n, t, r) {
  427. return [
  428. {
  429. label: "image-popup.edit",
  430. index: 0,
  431. commandId: sr.id,
  432. commandParams: { unitId: e, subUnitId: n, drawingId: t },
  433. disable: r === gm.DRAWING_DOM
  434. },
  435. {
  436. label: "image-popup.delete",
  437. index: 1,
  438. commandId: Nt.id,
  439. commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
  440. disable: false
  441. },
  442. {
  443. label: "image-popup.crop",
  444. index: 2,
  445. commandId: Ke.id,
  446. commandParams: { unitId: e, subUnitId: n, drawingId: t },
  447. disable: r === gm.DRAWING_DOM
  448. },
  449. {
  450. label: "image-popup.reset",
  451. index: 3,
  452. commandId: jn.id,
  453. commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
  454. disable: r === gm.DRAWING_DOM
  455. }
  456. ];
  457. }
  458. };
  459. It = rs([
  460. fe(0, ot(Ot)),
  461. fe(1, Ut),
  462. fe(2, ot(vi)),
  463. fe(3, Yx),
  464. fe(4, _n),
  465. fe(5, fs),
  466. fe(6, ot(f1)),
  467. fe(7, Pt)
  468. ], It);
  469. function z(i, e, n) {
  470. const { from: t, to: r, flipY: s = false, flipX: o = false, angle: c = 0, skewX: d = 0, skewY: g = 0 } = i, a = n.getCurrent();
  471. if (a == null)
  472. return;
  473. const l = aE2(
  474. a.unitId,
  475. a.sheetId,
  476. { from: t, to: r },
  477. n
  478. );
  479. let { left: h, top: u2, width: m, height: p } = l;
  480. const f2 = n.getCurrentSkeleton(), w = f2.rowHeaderWidth + f2.columnTotalWidth, I = f2.columnHeaderHeight + f2.rowTotalHeight;
  481. return h + m > w && (h = w - m), u2 + p > I && (u2 = I - p), {
  482. flipY: s,
  483. flipX: o,
  484. angle: c,
  485. skewX: d,
  486. skewY: g,
  487. left: h,
  488. top: u2,
  489. width: m,
  490. height: p
  491. };
  492. }
  493. function k(i, e) {
  494. const { left: n = 0, top: t = 0, width: r = 0, height: s = 0, flipY: o = false, flipX: c = false, angle: d = 0, skewX: g = 0, skewY: a = 0 } = i, l = e.getCellWithCoordByOffset(n, t);
  495. if (l == null)
  496. return;
  497. const h = {
  498. column: l.actualColumn,
  499. columnOffset: ie(n - l.startX, 1),
  500. row: l.actualRow,
  501. rowOffset: ie(t - l.startY, 1)
  502. }, u2 = e.getCellWithCoordByOffset(n + r, t + s);
  503. if (u2 == null)
  504. return;
  505. const m = {
  506. column: u2.actualColumn,
  507. columnOffset: ie(n + r - u2.startX, 1),
  508. row: u2.actualRow,
  509. rowOffset: ie(t + s - u2.startY, 1)
  510. };
  511. return {
  512. flipY: o,
  513. flipX: c,
  514. angle: d,
  515. skewX: g,
  516. skewY: a,
  517. from: h,
  518. to: m
  519. };
  520. }
  521. var is = Object.defineProperty;
  522. var ss = Object.getOwnPropertyDescriptor;
  523. var os = (i, e, n, t) => {
  524. for (var r = t > 1 ? void 0 : t ? ss(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  525. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  526. return t && r && is(e, n, r), r;
  527. };
  528. var ft = (i, e) => (n, t) => e(n, t, i);
  529. var nn = class extends nt {
  530. constructor(i, e, n, t, r) {
  531. super(), this._context = i, this._sheetDrawingService = e, this._drawingManagerService = n, this._sheetSelectionRenderService = t, this._sheetSkeletonManagerService = r, this._init();
  532. }
  533. _init() {
  534. this._drawingInitializeListener();
  535. }
  536. _drawingInitializeListener() {
  537. this._sheetDrawingService.initializeNotification(this._context.unitId);
  538. const i = this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId);
  539. for (const e in i) {
  540. const n = i[e];
  541. for (const t in n.data) {
  542. const r = n.data[t];
  543. r.transform = z(r.sheetTransform, this._sheetSelectionRenderService, this._sheetSkeletonManagerService);
  544. }
  545. }
  546. this._drawingManagerService.registerDrawingData(this._context.unitId, this._sheetDrawingService.getDrawingDataForUnit(this._context.unitId)), this._drawingManagerService.initializeNotification(this._context.unitId);
  547. }
  548. };
  549. nn = os([
  550. ft(1, u),
  551. ft(2, Ut),
  552. ft(3, ot(dt)),
  553. ft(4, ot(me))
  554. ], nn);
  555. function as(i) {
  556. const e = [];
  557. return i.forEach((n) => {
  558. const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c } = t, d = pf(0, 0, r.map((l) => l.transform || {})), g = r.map((l) => {
  559. const h = l.transform || { left: 0, top: 0 }, { unitId: u2, subUnitId: m, drawingId: p } = l;
  560. return {
  561. unitId: u2,
  562. subUnitId: m,
  563. drawingId: p,
  564. transform: {
  565. ...h,
  566. left: h.left - d.left,
  567. top: h.top - d.top
  568. },
  569. groupId: c
  570. };
  571. }), a = {
  572. unitId: s,
  573. subUnitId: o,
  574. drawingId: c,
  575. drawingType: gm.DRAWING_GROUP,
  576. transform: d
  577. };
  578. e.push({
  579. parent: a,
  580. children: g
  581. });
  582. }), e;
  583. }
  584. function cs(i) {
  585. const e = [];
  586. return i.forEach((n) => {
  587. const { parent: t, children: r } = n, { unitId: s, subUnitId: o, drawingId: c, transform: d = { width: 0, height: 0 } } = t;
  588. if (d == null)
  589. return;
  590. const g = r.map((l) => {
  591. const { transform: h } = l, { unitId: u2, subUnitId: m, drawingId: p } = l, f2 = ff(h || {}, d, d.width || 0, d.height || 0);
  592. return {
  593. unitId: u2,
  594. subUnitId: m,
  595. drawingId: p,
  596. transform: f2,
  597. groupId: void 0
  598. };
  599. }), a = {
  600. unitId: s,
  601. subUnitId: o,
  602. drawingId: c,
  603. drawingType: gm.DRAWING_GROUP,
  604. transform: {
  605. left: 0,
  606. top: 0
  607. }
  608. };
  609. e.push({
  610. parent: a,
  611. children: g
  612. });
  613. }), e;
  614. }
  615. var or = {
  616. id: "sheet.command.group-sheet-image",
  617. type: ar.COMMAND,
  618. handler: (i, e) => {
  619. const n = i.get(Pt), t = i.get(cn), r = i.get(u);
  620. if (!e)
  621. return false;
  622. const s = [];
  623. e.forEach(({ parent: u2, children: m }) => {
  624. s.push(u2.unitId), m.forEach((p) => {
  625. s.push(p.unitId);
  626. });
  627. });
  628. const o = r.getGroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
  629. return n.syncExecuteCommand(H.id, { op: a, unitId: c, subUnitId: d, objects: l, type: F2.GROUP }) ? (t.pushUndoRedo({
  630. unitID: c,
  631. undoMutations: [
  632. { id: H.id, params: { op: g, unitId: c, subUnitId: d, objects: cs(l), type: F2.UNGROUP } },
  633. { id: F3.id, params: s }
  634. ],
  635. redoMutations: [
  636. { id: H.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: F2.GROUP } },
  637. { id: F3.id, params: s }
  638. ]
  639. }), true) : false;
  640. }
  641. };
  642. var jt = {
  643. id: "sheet.command.insert-sheet-image",
  644. type: ar.COMMAND,
  645. handler: (i, e) => {
  646. var I, S, R;
  647. const n = i.get(Pt), t = i.get(cn), r = i.get(u), s = i.get(V);
  648. if (!e)
  649. return false;
  650. const o = e.drawings, c = o.map((v) => v.unitId), d = r.getBatchAddOp(o), { unitId: g, subUnitId: a, undo: l, redo: h, objects: u2 } = d, m = s.onCommandExecute({ id: jt.id, params: e }), p = { id: H.id, params: { op: h, unitId: g, subUnitId: a, objects: u2, type: F2.INSERT } }, f2 = { id: H.id, params: { op: l, unitId: g, subUnitId: a, objects: u2, type: F2.REMOVE } };
  651. return mu([...(I = m.preRedos) != null ? I : [], p, ...m.redos], n) ? (t.pushUndoRedo({
  652. unitID: g,
  653. undoMutations: [
  654. ...(S = m.preUndos) != null ? S : [],
  655. f2,
  656. ...m.undos,
  657. { id: F3.id, params: c }
  658. ],
  659. redoMutations: [
  660. ...(R = m.preRedos) != null ? R : [],
  661. p,
  662. ...m.redos,
  663. { id: F3.id, params: c }
  664. ]
  665. }), true) : false;
  666. }
  667. };
  668. var ar2 = {
  669. id: "sheet.command.set-drawing-arrange",
  670. type: ar.COMMAND,
  671. handler: (i, e) => {
  672. const n = i.get(Pt), t = i.get(cn);
  673. if (!e)
  674. return false;
  675. const r = i.get(u), { unitId: s, subUnitId: o, drawingIds: c, arrangeType: d } = e, g = { unitId: s, subUnitId: o, drawingIds: c };
  676. let a;
  677. if (d === fm.forward ? a = r.getForwardDrawingsOp(g) : d === fm.backward ? a = r.getBackwardDrawingOp(g) : d === fm.front ? a = r.getFrontDrawingsOp(g) : d === fm.back && (a = r.getBackDrawingsOp(g)), a == null)
  678. return false;
  679. const { objects: l, redo: h, undo: u2 } = a;
  680. return n.syncExecuteCommand(H.id, { op: h, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE }) ? (t.pushUndoRedo({
  681. unitID: s,
  682. undoMutations: [
  683. { id: H.id, params: { op: u2, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE } }
  684. ],
  685. redoMutations: [
  686. { id: H.id, params: { op: h, unitId: s, subUnitId: o, objects: l, type: F2.ARRANGE } }
  687. ]
  688. }), true) : false;
  689. }
  690. };
  691. var Wt = {
  692. id: "sheet.command.set-sheet-image",
  693. type: ar.COMMAND,
  694. handler: (i, e) => {
  695. const n = i.get(Pt), t = i.get(cn), r = i.get(u);
  696. if (!e)
  697. return false;
  698. const { drawings: s } = e, o = r.getBatchUpdateOp(s), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
  699. return n.syncExecuteCommand(H.id, { unitId: c, subUnitId: d, op: a, objects: l, type: F2.UPDATE }) ? (t.pushUndoRedo({
  700. unitID: c,
  701. undoMutations: [
  702. { id: H.id, params: { unitId: c, subUnitId: d, op: g, objects: l, type: F2.UPDATE } },
  703. { id: F3.id, params: [c] }
  704. ],
  705. redoMutations: [
  706. { id: H.id, params: { unitId: c, subUnitId: d, op: a, objects: l, type: F2.UPDATE } },
  707. { id: F3.id, params: [c] }
  708. ]
  709. }), true) : false;
  710. }
  711. };
  712. var cr = {
  713. id: "sheet.command.ungroup-sheet-image",
  714. type: ar.COMMAND,
  715. handler: (i, e) => {
  716. const n = i.get(Pt), t = i.get(cn), r = i.get(u);
  717. if (!e)
  718. return false;
  719. const s = [];
  720. e.forEach(({ parent: u2, children: m }) => {
  721. s.push(u2.unitId), m.forEach((p) => {
  722. s.push(p.unitId);
  723. });
  724. });
  725. const o = r.getUngroupDrawingOp(e), { unitId: c, subUnitId: d, undo: g, redo: a, objects: l } = o;
  726. return n.syncExecuteCommand(H.id, { op: a, unitId: c, subUnitId: d, objects: l, type: F2.UNGROUP }) ? (t.pushUndoRedo({
  727. unitID: c,
  728. undoMutations: [
  729. { id: H.id, params: { op: g, unitId: c, subUnitId: d, objects: as(l), type: F2.GROUP } },
  730. { id: F3.id, params: s }
  731. ],
  732. redoMutations: [
  733. { id: H.id, params: { op: a, unitId: c, subUnitId: d, objects: l, type: F2.UNGROUP } },
  734. { id: F3.id, params: s }
  735. ]
  736. }), true) : false;
  737. }
  738. };
  739. var ds = Object.defineProperty;
  740. var ls = Object.getOwnPropertyDescriptor;
  741. var us = (i, e, n, t) => {
  742. for (var r = t > 1 ? void 0 : t ? ls(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  743. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  744. return t && r && ds(e, n, r), r;
  745. };
  746. var te = (i, e) => (n, t) => e(n, t, i);
  747. function hs(i, e, n) {
  748. const t = n * Math.PI / 180, r = Math.abs(i * Math.cos(t)) + Math.abs(e * Math.sin(t)), s = Math.abs(i * Math.sin(t)) + Math.abs(e * Math.cos(t));
  749. return { rotatedWidth: r, rotatedHeight: s };
  750. }
  751. function dr(i, e, n, t, r) {
  752. var I;
  753. const { rotatedHeight: s, rotatedWidth: o } = hs(n, t, r), d = i.get(Yx).getRenderById(e.unitId);
  754. if (!d)
  755. return false;
  756. const a = (I = d.with(me).getWorksheetSkeleton(e.subUnitId)) == null ? void 0 : I.skeleton;
  757. if (a == null)
  758. return false;
  759. const l = a.getCellByIndex(e.row, e.col), h = l.mergeInfo.endX - l.mergeInfo.startX - 2, u2 = l.mergeInfo.endY - l.mergeInfo.startY - 2, m = o / s, f2 = Math.ceil(Math.min(h, u2 * m)) / o, w = !f2 || Number.isNaN(f2) ? 1e-3 : f2;
  760. return {
  761. width: n * w,
  762. height: t * w
  763. };
  764. }
  765. var Ze2 = class extends nt {
  766. constructor(e, n, t, r, s, o, c, d, g, a, l, h, u2) {
  767. super();
  768. J(this, "_workbookSelections");
  769. this._context = e, this._skeletonManagerService = n, this._commandService = t, this._selectionRenderService = r, this._imageIoService = s, this._fileOpenerService = o, this._sheetDrawingService = c, this._drawingManagerService = d, this._contextService = g, this._messageService = a, this._localeService = l, this._injector = u2, this._workbookSelections = h.getWorkbookSelections(this._context.unitId), this._updateImageListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener();
  770. }
  771. async insertFloatImage() {
  772. const e = await this._fileOpenerService.openFile({
  773. multiple: true,
  774. accept: Zt.map((t) => `.${t.replace("image/", "")}`).join(",")
  775. }), n = e.length;
  776. return n > wn ? (this._messageService.show({
  777. type: Xw.Error,
  778. content: this._localeService.t("update-status.exceedMaxCount", String(wn))
  779. }), false) : n === 0 ? false : (e.forEach(async (t) => await this._insertFloatImage(t)), true);
  780. }
  781. async insertCellImage() {
  782. const n = (await this._fileOpenerService.openFile({
  783. multiple: false,
  784. accept: Zt.map((t) => `.${t.replace("image/", "")}`).join(",")
  785. }))[0];
  786. return n ? (await this._insertCellImage(n), true) : false;
  787. }
  788. async _insertFloatImage(e) {
  789. let n;
  790. try {
  791. n = await this._imageIoService.saveImage(e);
  792. } catch (I) {
  793. const S = I.message;
  794. S === g0.ERROR_EXCEED_SIZE ? this._messageService.show({
  795. type: Xw.Error,
  796. content: this._localeService.t("update-status.exceedMaxSize", String(Yt / (1024 * 1024)))
  797. }) : S === g0.ERROR_IMAGE_TYPE ? this._messageService.show({
  798. type: Xw.Error,
  799. content: this._localeService.t("update-status.invalidImageType")
  800. }) : S === g0.ERROR_IMAGE && this._messageService.show({
  801. type: Xw.Error,
  802. content: this._localeService.t("update-status.invalidImage")
  803. });
  804. }
  805. if (n == null)
  806. return;
  807. const t = this._getUnitInfo(), { unitId: r, subUnitId: s } = t, { imageId: o, imageSourceType: c, source: d, base64Cache: g } = n, { width: a, height: l, image: h } = await vn(g || ""), { width: u2, height: m } = this._context.scene;
  808. this._imageIoService.addImageSourceCache(d, c, h);
  809. let p = 1;
  810. if (a > mn || l > On) {
  811. const I = mn / a, S = On / l;
  812. p = Math.max(I, S);
  813. }
  814. const f2 = this._getImagePosition(a * p, l * p, u2, m);
  815. if (f2 == null)
  816. return;
  817. const w = {
  818. unitId: r,
  819. subUnitId: s,
  820. drawingId: o,
  821. drawingType: gm.DRAWING_IMAGE,
  822. imageSourceType: c,
  823. source: d,
  824. transform: z(f2, this._selectionRenderService, this._skeletonManagerService),
  825. sheetTransform: f2
  826. };
  827. this._commandService.executeCommand(jt.id, {
  828. unitId: r,
  829. drawings: [w]
  830. });
  831. }
  832. // eslint-disable-next-line max-lines-per-function
  833. async _insertCellImage(e) {
  834. let n;
  835. try {
  836. n = await this._imageIoService.saveImage(e);
  837. } catch (f2) {
  838. const w = f2.message;
  839. w === g0.ERROR_EXCEED_SIZE ? this._messageService.show({
  840. type: Xw.Error,
  841. content: this._localeService.t("update-status.exceedMaxSize", String(Yt / (1024 * 1024)))
  842. }) : w === g0.ERROR_IMAGE_TYPE ? this._messageService.show({
  843. type: Xw.Error,
  844. content: this._localeService.t("update-status.invalidImageType")
  845. }) : w === g0.ERROR_IMAGE && this._messageService.show({
  846. type: Xw.Error,
  847. content: this._localeService.t("update-status.invalidImage")
  848. });
  849. }
  850. if (n == null)
  851. return;
  852. const { imageId: t, imageSourceType: r, source: s, base64Cache: o } = n, { width: c, height: d, image: g } = await vn(o || "");
  853. this._imageIoService.addImageSourceCache(s, r, g);
  854. const a = this._workbookSelections.getCurrentLastSelection();
  855. if (!a)
  856. return false;
  857. const l = Sr("", {}), h = dr(
  858. this._injector,
  859. {
  860. unitId: this._context.unitId,
  861. subUnitId: this._context.unit.getActiveSheet().getSheetId(),
  862. row: a.primary.actualRow,
  863. col: a.primary.actualColumn
  864. },
  865. c,
  866. d,
  867. 0
  868. );
  869. if (!h)
  870. return false;
  871. const u2 = {
  872. size: {
  873. width: h.width,
  874. height: h.height
  875. },
  876. positionH: {
  877. relativeFrom: om.PAGE,
  878. posOffset: 0
  879. },
  880. positionV: {
  881. relativeFrom: am.PARAGRAPH,
  882. posOffset: 0
  883. },
  884. angle: 0
  885. }, m = {
  886. unitId: l.getUnitId(),
  887. subUnitId: l.getUnitId(),
  888. drawingId: t,
  889. drawingType: gm.DRAWING_IMAGE,
  890. imageSourceType: r,
  891. source: s,
  892. transform: rf(u2),
  893. docTransform: u2,
  894. behindDoc: we.FALSE,
  895. title: "",
  896. description: "",
  897. layoutType: Xp.INLINE,
  898. // Insert inline drawing by default.
  899. wrapText: Kp.BOTH_SIDES,
  900. distB: 0,
  901. distL: 0,
  902. distR: 0,
  903. distT: 0
  904. }, p = st.drawing.add({
  905. documentDataModel: l,
  906. drawings: [m],
  907. selection: {
  908. collapsed: true,
  909. startOffset: 0,
  910. endOffset: 0
  911. }
  912. });
  913. return p ? (l.apply(p), this._commandService.syncExecuteCommand(on.id, {
  914. value: {
  915. [a.primary.actualRow]: {
  916. [a.primary.actualColumn]: {
  917. p: l.getSnapshot(),
  918. t: 1
  919. }
  920. }
  921. }
  922. })) : false;
  923. }
  924. _getUnitInfo() {
  925. const e = this._context.unit, n = e.getActiveSheet(), t = e.getUnitId(), r = n.getSheetId();
  926. return {
  927. unitId: t,
  928. subUnitId: r
  929. };
  930. }
  931. _getImagePosition(e, n, t, r) {
  932. const s = this._workbookSelections.getCurrentSelections();
  933. let o = {
  934. startRow: 0,
  935. endRow: 0,
  936. startColumn: 0,
  937. endColumn: 0
  938. };
  939. s && s.length > 0 && (o = s[s.length - 1].range);
  940. const c = ni(this._skeletonManagerService.getCurrent().skeleton, o);
  941. if (c == null)
  942. return;
  943. let { startColumn: d, startRow: g, startX: a, startY: l } = c, h = false;
  944. if (a + e > t && (a = t - e, a < 0 && (a = 0, e = t), h = true), l + n > r && (l = r - n, l < 0 && (l = 0, n = r), h = true), h) {
  945. const f2 = this._selectionRenderService.getCellWithCoordByOffset(a, l);
  946. if (f2 == null)
  947. return;
  948. a = f2.startX, l = f2.startY, d = f2.actualColumn, g = f2.actualRow;
  949. }
  950. const u2 = {
  951. column: d,
  952. columnOffset: 0,
  953. row: g,
  954. rowOffset: 0
  955. }, m = this._selectionRenderService.getCellWithCoordByOffset(a + e, l + n);
  956. if (m == null)
  957. return;
  958. const p = {
  959. column: m.actualColumn,
  960. columnOffset: a + e - m.startX,
  961. row: m.actualRow,
  962. rowOffset: l + n - m.startY
  963. };
  964. return {
  965. from: u2,
  966. to: p
  967. };
  968. }
  969. _updateOrderListener() {
  970. this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((e) => {
  971. const { unitId: n, subUnitId: t, drawingIds: r, arrangeType: s } = e;
  972. this._commandService.executeCommand(ar2.id, {
  973. unitId: n,
  974. subUnitId: t,
  975. drawingIds: r,
  976. arrangeType: s
  977. });
  978. }));
  979. }
  980. _updateImageListener() {
  981. this.disposeWithMe(this._drawingManagerService.featurePluginUpdate$.subscribe((e) => {
  982. const n = [];
  983. e.length !== 0 && (e.forEach((t) => {
  984. const { unitId: r, subUnitId: s, drawingId: o, drawingType: c, transform: d } = t;
  985. if (d == null)
  986. return;
  987. const g = this._sheetDrawingService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: o });
  988. if (g == null || g.unitId !== this._context.unitId)
  989. return;
  990. const a = k({ ...g.transform, ...d }, this._selectionRenderService);
  991. if (a == null)
  992. return;
  993. const l = {
  994. ...t,
  995. transform: { ...g.transform, ...d, ...z(a, this._selectionRenderService, this._skeletonManagerService) },
  996. sheetTransform: { ...a }
  997. };
  998. n.push(l);
  999. }), n.length > 0 && this._commandService.executeCommand(Wt.id, {
  1000. unitId: e[0].unitId,
  1001. drawings: n
  1002. }));
  1003. }));
  1004. }
  1005. _groupDrawingListener() {
  1006. this.disposeWithMe(this._drawingManagerService.featurePluginGroupUpdate$.subscribe((e) => {
  1007. this._commandService.executeCommand(or.id, e);
  1008. const { unitId: n, subUnitId: t, drawingId: r } = e[0].parent;
  1009. this._commandService.syncExecuteCommand(ln.id, [{ unitId: n, subUnitId: t, drawingId: r }]);
  1010. })), this.disposeWithMe(this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((e) => {
  1011. this._commandService.executeCommand(cr.id, e);
  1012. }));
  1013. }
  1014. _focusDrawingListener() {
  1015. this.disposeWithMe(
  1016. this._drawingManagerService.focus$.subscribe((e) => {
  1017. e == null || e.length === 0 ? (this._contextService.setContextValue(yR, false), this._sheetDrawingService.focusDrawing([])) : (this._contextService.setContextValue(yR, true), this._sheetDrawingService.focusDrawing(e));
  1018. })
  1019. );
  1020. }
  1021. };
  1022. Ze2 = us([
  1023. te(1, ot(me)),
  1024. te(2, Pt),
  1025. te(3, dt),
  1026. te(4, Oa),
  1027. te(5, fl),
  1028. te(6, u),
  1029. te(7, Ut),
  1030. te(8, fs),
  1031. te(9, o3),
  1032. te(10, ot(Vr)),
  1033. te(11, ot(F)),
  1034. te(12, ot(Ot))
  1035. ], Ze2);
  1036. var gs = Object.defineProperty;
  1037. var ms = Object.getOwnPropertyDescriptor;
  1038. var fs2 = (i, e, n, t) => {
  1039. for (var r = t > 1 ? void 0 : t ? ms(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1040. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1041. return t && r && gs(e, n, r), r;
  1042. };
  1043. var ye = (i, e) => (n, t) => e(n, t, i);
  1044. function rn(i, e, n) {
  1045. var t, r, s, o;
  1046. if (((r = (t = n == null ? void 0 : n.p) == null ? void 0 : t.body) == null ? void 0 : r.dataStream.length) === 3 && ((o = (s = n.p) == null ? void 0 : s.drawingsOrder) == null ? void 0 : o.length) === 1) {
  1047. const c = n.p.drawings[n.p.drawingsOrder[0]], d = dr(
  1048. i,
  1049. {
  1050. unitId: e.unitId,
  1051. subUnitId: e.subUnitId,
  1052. row: e.row,
  1053. col: e.col
  1054. },
  1055. c.docTransform.size.width,
  1056. c.docTransform.size.height,
  1057. c.docTransform.angle
  1058. );
  1059. if (d)
  1060. return c.transform.width = d.width, c.transform.height = d.height, c.docTransform.size.width = d.width, c.docTransform.size.height = d.height, c.transform.left = 0, c.transform.top = 0, c.docTransform.positionH.posOffset = 0, c.docTransform.positionV.posOffset = 0, n.p.documentStyle.pageSize.width = 1 / 0, n.p.documentStyle.pageSize.height = 1 / 0, true;
  1061. }
  1062. return false;
  1063. }
  1064. var Ct = class extends nt {
  1065. constructor(i, e, n, t, r, s, o) {
  1066. super(), this._commandService = i, this._sheetInterceptorService = e, this._univerInstanceService = n, this._injector = t, this._drawingManagerService = r, this._docDrawingController = s, this._editorBridgeService = o, this._initHandleResize(), this._handleInitEditor(), this._handleWriteCell(), this._initCellContentInterceptor();
  1067. }
  1068. _initHandleResize() {
  1069. this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
  1070. let e, n = [];
  1071. if (i.id === nt2.id) {
  1072. const t = i.params;
  1073. n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
  1074. } else if (i.id === tt.id) {
  1075. const t = i.params;
  1076. n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
  1077. } else if (i.id === Oe.id) {
  1078. const t = i.params;
  1079. n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
  1080. } else if (i.id === Br.id) {
  1081. const t = i.params;
  1082. e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId }), n = t.rowsAutoHeightInfo.map((r) => ({
  1083. startRow: r.row,
  1084. endRow: r.row,
  1085. startColumn: 0,
  1086. endColumn: 9999
  1087. }));
  1088. } else if (i.id === ne.id) {
  1089. const t = i.params;
  1090. n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
  1091. } else if (i.id === oe.id) {
  1092. const t = i.params;
  1093. n = t.ranges, e = N(this._univerInstanceService, { unitId: t.unitId, subUnitId: t.subUnitId });
  1094. }
  1095. e && n.length && n.forEach((t) => {
  1096. const r = tr.transformRange(t, e.worksheet);
  1097. for (let s = r.startRow; s <= r.endRow; s++)
  1098. for (let o = r.startColumn; o <= r.endColumn; o++)
  1099. rn(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: s, col: o }, e.worksheet.getCellRaw(s, o));
  1100. });
  1101. }));
  1102. }
  1103. _handleInitEditor() {
  1104. this.disposeWithMe(this._editorBridgeService.visible$.subscribe((i) => {
  1105. i.visible ? i.visible && (this._drawingManagerService.removeDrawingDataForUnit(su), this._docDrawingController.loadDrawingDataForUnit(su), this._drawingManagerService.initializeNotification(su)) : this._drawingManagerService.removeDrawingDataForUnit(su);
  1106. })), this.disposeWithMe(this._commandService.onCommandExecuted((i) => {
  1107. i.id === Vi.id && i.params.unitId === Hd && (this._drawingManagerService.removeDrawingDataForUnit(Hd), this._docDrawingController.loadDrawingDataForUnit(Hd), this._drawingManagerService.initializeNotification(Hd));
  1108. }));
  1109. }
  1110. _handleWriteCell() {
  1111. this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(qn, {
  1112. priority: 9999,
  1113. handler: (i, e, n) => (rn(this._injector, { unitId: e.unitId, subUnitId: e.subUnitId, row: e.row, col: e.col }, i), n(i))
  1114. }));
  1115. }
  1116. _initCellContentInterceptor() {
  1117. this.disposeWithMe(
  1118. this._sheetInterceptorService.intercept(
  1119. et.CELL_CONTENT,
  1120. {
  1121. effect: Vn.Style,
  1122. priority: ea.CELL_IMAGE,
  1123. handler: (i, e, n) => {
  1124. var t;
  1125. return i != null && i.p && ((t = i.p.drawingsOrder) != null && t.length) && (i.interceptorStyle || (i.interceptorStyle = {}), i.interceptorStyle.tr = { a: 0 }), n(i);
  1126. }
  1127. }
  1128. )
  1129. );
  1130. }
  1131. };
  1132. Ct = fs2([
  1133. ye(0, Pt),
  1134. ye(1, ot(V)),
  1135. ye(2, _n),
  1136. ye(3, ot(Ot)),
  1137. ye(4, Ut),
  1138. ye(5, ot(_)),
  1139. ye(6, ot(tt2))
  1140. ], Ct);
  1141. var ps = Object.defineProperty;
  1142. var ws = Object.getOwnPropertyDescriptor;
  1143. var _s2 = (i, e, n, t) => {
  1144. for (var r = t > 1 ? void 0 : t ? ws(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1145. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1146. return t && r && ps(e, n, r), r;
  1147. };
  1148. var Dn = (i, e) => (n, t) => e(n, t, i);
  1149. var Rt = class extends nt {
  1150. constructor(i, e) {
  1151. super(), this._autoFillService = i, this._injector = e, this._initAutoFillHooks();
  1152. }
  1153. _initAutoFillHooks() {
  1154. this.disposeWithMe(
  1155. this._autoFillService.addHook({
  1156. id: "sheet-cell-image-autofill",
  1157. onBeforeSubmit: (i, e, n, t) => {
  1158. new kt(t).forValue((r, s, o) => {
  1159. rn(this._injector, { unitId: i.unitId, subUnitId: i.subUnitId, row: r, col: s }, o);
  1160. });
  1161. }
  1162. })
  1163. );
  1164. }
  1165. };
  1166. Rt = _s2([
  1167. Dn(0, ot(Hr)),
  1168. Dn(1, ot(Ot))
  1169. ], Rt);
  1170. var vs = Object.defineProperty;
  1171. var Ss = Object.getOwnPropertyDescriptor;
  1172. var Is = (i, e, n, t) => {
  1173. for (var r = t > 1 ? void 0 : t ? Ss(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1174. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1175. return t && r && vs(e, n, r), r;
  1176. };
  1177. var pt2 = (i, e) => (n, t) => e(n, t, i);
  1178. var bt = class extends nt {
  1179. constructor(e, n, t, r) {
  1180. super();
  1181. J(this, "_isSetCursor", false);
  1182. this._hoverManagerService = e, this._renderManagerService = n, this._selectionsService = t, this._drawingRenderService = r;
  1183. }
  1184. _initHover() {
  1185. }
  1186. _initImageClick() {
  1187. }
  1188. };
  1189. bt = Is([
  1190. pt2(0, ot(Er)),
  1191. pt2(1, ot(Yx)),
  1192. pt2(2, ot(F)),
  1193. pt2(3, ot(De))
  1194. ], bt);
  1195. var Cs = Object.defineProperty;
  1196. var Rs = Object.getOwnPropertyDescriptor;
  1197. var bs = (i, e, n, t) => {
  1198. for (var r = t > 1 ? void 0 : t ? Rs(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1199. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1200. return t && r && Cs(e, n, r), r;
  1201. };
  1202. var Jt = (i, e) => (n, t) => e(n, t, i);
  1203. var Dt = class extends nt {
  1204. constructor(e, n, t) {
  1205. super();
  1206. J(this, "_copyInfo");
  1207. this._sheetClipboardService = e, this._renderManagerService = n, this._sheetDrawingService = t, this._initCopyPaste();
  1208. }
  1209. _initCopyPaste() {
  1210. this._sheetClipboardService.addClipboardHook({
  1211. id: "SHEET_IMAGE_UI_PLUGIN",
  1212. onBeforeCopy: (e, n, t) => this._collect(e, n, t),
  1213. onPasteCells: (e, n, t, r) => {
  1214. const { copyType: s = gr.COPY, pasteType: o } = r, { range: c } = e || {}, { range: d, unitId: g, subUnitId: a } = n;
  1215. return this._generateMutations(d, { copyType: s, pasteType: o, copyRange: c, unitId: g, subUnitId: a });
  1216. },
  1217. onPastePlainText: (e, n) => ({ undos: [], redos: [] })
  1218. });
  1219. }
  1220. _collect(e, n, t) {
  1221. var h;
  1222. const r = (h = this._renderManagerService.getRenderById(e)) == null ? void 0 : h.with(me);
  1223. if (!r)
  1224. return;
  1225. const s = r.attachRangeWithCoord(t);
  1226. if (!s)
  1227. return;
  1228. const { startX: o, endX: c, startY: d, endY: g } = s, a = this._sheetDrawingService.getDrawingData(e, n), l = [];
  1229. Object.keys(a).forEach((u2) => {
  1230. const m = a[u2], { transform: p } = m;
  1231. if (m.anchorType !== j.Both || !p)
  1232. return;
  1233. const { left: f2 = 0, top: w = 0, width: I = 0, height: S = 0 } = p, { drawingStartX: R, drawingEndX: v, drawingStartY: C, drawingEndY: _3 } = {
  1234. drawingStartX: f2,
  1235. drawingEndX: f2 + I,
  1236. drawingStartY: w,
  1237. drawingEndY: w + S
  1238. };
  1239. o <= R && v <= c && d <= C && _3 <= g && l.push(m);
  1240. }), l.length && (this._copyInfo = {
  1241. drawings: l,
  1242. unitId: e,
  1243. subUnitId: n
  1244. });
  1245. }
  1246. // eslint-disable-next-line max-lines-per-function
  1247. _generateMutations(e, n) {
  1248. var x;
  1249. if (!this._copyInfo)
  1250. return { redos: [], undos: [] };
  1251. if ([
  1252. rt2.SPECIAL_PASTE_COL_WIDTH,
  1253. rt2.SPECIAL_PASTE_VALUE,
  1254. rt2.SPECIAL_PASTE_FORMAT,
  1255. rt2.SPECIAL_PASTE_FORMULA
  1256. ].includes(n.pasteType))
  1257. return { redos: [], undos: [] };
  1258. const { copyRange: r } = n;
  1259. if (!r)
  1260. return { redos: [], undos: [] };
  1261. const { drawings: s, unitId: o, subUnitId: c } = this._copyInfo, { ranges: [d, g], mapFunc: a } = _s([r, e]), { row: l, col: h } = a(d.startRow, d.startColumn), { row: u2, col: m } = a(g.startRow, g.startColumn), p = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(me);
  1262. if (!p)
  1263. return { redos: [], undos: [] };
  1264. const f2 = p.attachRangeWithCoord({
  1265. startRow: l,
  1266. endRow: l,
  1267. startColumn: h,
  1268. endColumn: h
  1269. }), w = p.attachRangeWithCoord({
  1270. startRow: u2,
  1271. endRow: u2,
  1272. startColumn: m,
  1273. endColumn: m
  1274. });
  1275. if (!f2 || !w)
  1276. return { redos: [], undos: [] };
  1277. const I = [], S = [], R = w.startX - f2.startX, v = w.startY - f2.startY, C = u2 - l, _3 = m - h, y = n.copyType === gr.CUT, { _sheetDrawingService: M } = this;
  1278. return s.forEach((U) => {
  1279. const { transform: D, sheetTransform: b } = U;
  1280. if (!D)
  1281. return;
  1282. const P = {
  1283. ...U,
  1284. unitId: o,
  1285. subUnitId: c,
  1286. drawingId: y ? U.drawingId : re.generateRandomId(),
  1287. transform: {
  1288. ...D,
  1289. left: D.left + R,
  1290. top: D.top + v
  1291. },
  1292. sheetTransform: {
  1293. to: { ...b.to, row: b.to.row + C, column: b.to.column + _3 },
  1294. from: { ...b.from, row: b.from.row + C, column: b.from.column + _3 }
  1295. }
  1296. };
  1297. if (y) {
  1298. const { undo: A, redo: j2, objects: B } = M.getBatchUpdateOp([P]);
  1299. I.push({
  1300. id: H.id,
  1301. params: {
  1302. unitId: o,
  1303. subUnitId: c,
  1304. type: F2.UPDATE,
  1305. op: j2,
  1306. objects: B
  1307. }
  1308. }), S.push({
  1309. id: H.id,
  1310. params: {
  1311. unitId: o,
  1312. subUnitId: c,
  1313. type: F2.UPDATE,
  1314. op: A,
  1315. objects: B
  1316. }
  1317. });
  1318. } else {
  1319. const { undo: A, redo: j2, objects: B } = M.getBatchAddOp([P]);
  1320. I.push({ id: H.id, params: { op: j2, unitId: o, subUnitId: c, objects: B, type: F2.INSERT } }), S.push({ id: H.id, params: { op: A, unitId: o, subUnitId: c, objects: B, type: F2.REMOVE } });
  1321. }
  1322. }), {
  1323. redos: I,
  1324. undos: S
  1325. };
  1326. }
  1327. };
  1328. Dt = bs([
  1329. Jt(0, Sn),
  1330. Jt(1, Yx),
  1331. Jt(2, u)
  1332. ], Dt);
  1333. var Ds = Object.defineProperty;
  1334. var Ms = Object.getOwnPropertyDescriptor;
  1335. var ys = (i, e, n, t) => {
  1336. for (var r = t > 1 ? void 0 : t ? Ms(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1337. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1338. return t && r && Ds(e, n, r), r;
  1339. };
  1340. var ze = (i, e) => (n, t) => e(n, t, i);
  1341. var Mt = class extends nt {
  1342. constructor(i, e, n, t, r) {
  1343. super(), this._drawingManagerService = i, this._renderManagerService = e, this._permissionService = n, this._univerInstanceService = t, this._userManagerService = r, this._initDrawingVisible(), this._initDrawingEditable(), this._initViewPermissionChange(), this._initEditPermissionChange();
  1344. }
  1345. _initDrawingVisible() {
  1346. const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET);
  1347. this.disposeWithMe(
  1348. combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
  1349. if (!e) {
  1350. this._drawingManagerService.setDrawingVisible(false);
  1351. return;
  1352. }
  1353. e.activeSheet$.subscribe((t) => {
  1354. if (!t) {
  1355. this._drawingManagerService.setDrawingVisible(false);
  1356. return;
  1357. }
  1358. const r = e.getUnitId(), s = t.getSheetId();
  1359. if (this._permissionService.composePermission([new Js(r).id, new Hn(r, s).id]).every((c) => c.value))
  1360. this._drawingManagerService.setDrawingVisible(true);
  1361. else {
  1362. this._drawingManagerService.setDrawingVisible(false);
  1363. const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene;
  1364. if (h == null)
  1365. return;
  1366. h.getAllObjectsByOrder().forEach((m) => {
  1367. m.classType === Y.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.removeObject(m);
  1368. });
  1369. }
  1370. });
  1371. })
  1372. );
  1373. }
  1374. _initDrawingEditable() {
  1375. const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET);
  1376. this.disposeWithMe(
  1377. combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
  1378. if (!e) {
  1379. this._drawingManagerService.setDrawingEditable(false);
  1380. return;
  1381. }
  1382. e.activeSheet$.subscribe((t) => {
  1383. if (!t) {
  1384. this._drawingManagerService.setDrawingEditable(false);
  1385. return;
  1386. }
  1387. const r = e.getUnitId(), s = t.getSheetId();
  1388. if (this._permissionService.composePermission([new Me(r).id, new Te(r, s).id]).every((c) => c.value))
  1389. this._drawingManagerService.setDrawingEditable(true);
  1390. else {
  1391. this._drawingManagerService.setDrawingEditable(false);
  1392. const c = e.getUnitId(), d = t.getSheetId(), g = this._drawingManagerService.getDrawingData(c, d), a = Object.values(g), l = this._renderManagerService.getRenderById(c), h = l == null ? void 0 : l.scene;
  1393. if (h == null)
  1394. return;
  1395. h.getAllObjectsByOrder().forEach((m) => {
  1396. m.classType === Y.IMAGE && a.some((p) => m.oKey.includes(p.drawingId)) && h.detachTransformerFrom(m);
  1397. });
  1398. }
  1399. });
  1400. })
  1401. );
  1402. }
  1403. _initViewPermissionChange() {
  1404. const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET);
  1405. this.disposeWithMe(
  1406. combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
  1407. e && e.activeSheet$.subscribe((t) => {
  1408. var l;
  1409. if (!t)
  1410. return;
  1411. const r = e.getUnitId(), s = t.getSheetId();
  1412. let o = true;
  1413. const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene;
  1414. if (d == null)
  1415. return;
  1416. const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new Js(r).id, new Hn(r, s).id]).pipe(map((h) => h.every((u2) => u2.value)));
  1417. a == null || a.pipe(
  1418. filter((h) => h !== o),
  1419. distinctUntilChanged()
  1420. ).subscribe({
  1421. next: (h) => {
  1422. o = h, this._drawingManagerService.setDrawingVisible(h);
  1423. const u2 = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m);
  1424. h ? this._drawingManagerService.addNotification(p) : (u2.forEach((f2) => {
  1425. f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.removeObject(f2);
  1426. }), g.clearSelectedObjects());
  1427. }
  1428. }), (l = this._permissionService.getPermissionPoint$(new Hn(r, s).id)) == null || l.pipe(
  1429. filter((h) => h.value !== o),
  1430. distinctUntilChanged()
  1431. ).subscribe({
  1432. complete: () => {
  1433. o = true, this._drawingManagerService.setDrawingVisible(true);
  1434. const h = this._drawingManagerService.getDrawingData(r, s), u2 = Object.values(h);
  1435. this._drawingManagerService.addNotification(u2);
  1436. }
  1437. });
  1438. });
  1439. })
  1440. );
  1441. }
  1442. _initEditPermissionChange() {
  1443. const i = this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET);
  1444. this.disposeWithMe(
  1445. combineLatest([i, this._userManagerService.currentUser$]).subscribe(([e, n]) => {
  1446. e && e.activeSheet$.subscribe((t) => {
  1447. var l;
  1448. if (!t)
  1449. return;
  1450. const r = e.getUnitId(), s = t.getSheetId();
  1451. let o = true;
  1452. const c = this._renderManagerService.getRenderById(r), d = c == null ? void 0 : c.scene;
  1453. if (d == null)
  1454. return;
  1455. const g = d.getTransformerByCreate(), a = this._permissionService.composePermission$([new Me(r).id, new Te(r, s).id]).pipe(map((h) => h.every((u2) => u2.value)));
  1456. a == null || a.pipe(
  1457. filter((h) => h !== o),
  1458. distinctUntilChanged()
  1459. ).subscribe({
  1460. next: (h) => {
  1461. o = h, this._drawingManagerService.setDrawingEditable(h);
  1462. const u2 = d.getAllObjectsByOrder(), m = this._drawingManagerService.getDrawingData(r, s), p = Object.values(m);
  1463. h ? (u2.forEach((f2) => {
  1464. f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.attachTransformerTo(f2);
  1465. }), this._drawingManagerService.addNotification(p)) : (u2.forEach((f2) => {
  1466. f2.classType === Y.IMAGE && p.some((w) => f2.oKey.includes(w.drawingId)) && d.detachTransformerFrom(f2);
  1467. }), g.clearSelectedObjects());
  1468. }
  1469. }), (l = this._permissionService.getPermissionPoint$(new Te(r, s).id)) == null || l.pipe(
  1470. filter((h) => h.value !== o),
  1471. distinctUntilChanged()
  1472. ).subscribe({
  1473. complete: () => {
  1474. o = true;
  1475. const h = e.getUnitId(), u2 = t.getSheetId(), m = this._drawingManagerService.getDrawingData(h, u2), p = Object.values(m), f2 = this._renderManagerService.getRenderById(h), w = f2 == null ? void 0 : f2.scene;
  1476. if (w == null)
  1477. return;
  1478. this._drawingManagerService.setDrawingEditable(true), w.getAllObjectsByOrder().forEach((S) => {
  1479. S.classType === Y.IMAGE && p.some((R) => S.oKey.includes(R.drawingId)) && w.detachTransformerFrom(S);
  1480. });
  1481. }
  1482. });
  1483. });
  1484. })
  1485. );
  1486. }
  1487. };
  1488. Mt = ys([
  1489. ze(0, Ut),
  1490. ze(1, Yx),
  1491. ze(2, UE),
  1492. ze(3, _n),
  1493. ze(4, ot(rr))
  1494. ], Mt);
  1495. var Os = Object.defineProperty;
  1496. var Ts = Object.getOwnPropertyDescriptor;
  1497. var Es = (i, e, n, t) => {
  1498. for (var r = t > 1 ? void 0 : t ? Ts(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1499. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1500. return t && r && Os(e, n, r), r;
  1501. };
  1502. var wt = (i, e) => (n, t) => e(n, t, i);
  1503. var yt = class extends nt {
  1504. constructor(i, e, n, t) {
  1505. super(), this._sheetPrintInterceptorService = i, this._drawingRenderService = e, this._drawingManagerService = n, this._renderManagerService = t, this._initPrinting();
  1506. }
  1507. _initPrinting() {
  1508. this.disposeWithMe(
  1509. this._sheetPrintInterceptorService.interceptor.intercept(
  1510. this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
  1511. {
  1512. handler: (i, e, n) => {
  1513. const { unitId: t, scene: r, subUnitId: s } = e, o = this._drawingManagerService.getDrawingDataForUnit(t), c = o == null ? void 0 : o[s];
  1514. return c && c.order.forEach((d) => {
  1515. this._drawingRenderService.renderDrawing(c.data[d], r);
  1516. }), n();
  1517. }
  1518. }
  1519. )
  1520. ), this.disposeWithMe(
  1521. this._sheetPrintInterceptorService.interceptor.intercept(
  1522. this._sheetPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_RANGE,
  1523. {
  1524. handler: (i, e, n) => {
  1525. const { unitId: t, subUnitId: r } = e, s = this._renderManagerService.getRenderById(t);
  1526. if (!s)
  1527. return n(i);
  1528. const o = s.with(me).getWorksheetSkeleton(r);
  1529. if (!o)
  1530. return n(i);
  1531. const c = this._drawingManagerService.getDrawingDataForUnit(t), d = c == null ? void 0 : c[e.subUnitId];
  1532. if (!d)
  1533. return n(i);
  1534. const { scaleX: g, scaleY: a } = s.scene, l = i ? { ...i } : { startColumn: 0, endColumn: 0, endRow: 0, startRow: 0 }, h = d.order.map((u2) => d.data[u2]).filter((u2) => u2.drawingType !== gm.DRAWING_DOM);
  1535. return h.length ? (h.forEach((u2) => {
  1536. if (!u2.groupId && u2.transform && re.isDefine(u2.transform.left) && re.isDefine(u2.transform.top) && re.isDefine(u2.transform.width) && re.isDefine(u2.transform.height)) {
  1537. const m = o.skeleton.getCellIndexByOffset(u2.transform.left, u2.transform.top, g, a, { x: 0, y: 0 }), p = o.skeleton.getCellIndexByOffset(u2.transform.left + u2.transform.width, u2.transform.top + u2.transform.height, g, a, { x: 0, y: 0 });
  1538. m.column < l.startColumn && (l.startColumn = m.column), m.row < l.startRow && (l.startRow = m.row), l.endRow < p.row && (l.endRow = p.row), l.endColumn < p.column && (l.endColumn = p.column);
  1539. }
  1540. }), n(l)) : n(i);
  1541. }
  1542. }
  1543. )
  1544. );
  1545. }
  1546. };
  1547. yt = Es([
  1548. wt(0, ot(ap)),
  1549. wt(1, ot(De)),
  1550. wt(2, Ut),
  1551. wt(3, Yx)
  1552. ], yt);
  1553. var Ps = Object.defineProperty;
  1554. var Us = Object.getOwnPropertyDescriptor;
  1555. var As = (i, e, n, t) => {
  1556. for (var r = t > 1 ? void 0 : t ? Us(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  1557. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  1558. return t && r && Ps(e, n, r), r;
  1559. };
  1560. var pe = (i, e) => (n, t) => e(n, t, i);
  1561. var Ns = [
  1562. mt.id,
  1563. gt.id,
  1564. Gn.id,
  1565. zn.id,
  1566. Pt2.id,
  1567. Tt.id,
  1568. sn.id,
  1569. Bn.id,
  1570. $o.id,
  1571. Wo.id,
  1572. Oo.id,
  1573. Mn.id,
  1574. kr.id,
  1575. Jn.id,
  1576. Kn.id,
  1577. yr.id,
  1578. jn2.id,
  1579. Fn.id,
  1580. pt.id
  1581. ];
  1582. var js = [
  1583. Zt2.id,
  1584. Qt.id,
  1585. qt2.id,
  1586. Xt.id,
  1587. nt2.id,
  1588. tt.id
  1589. ];
  1590. var sn2 = class extends nt {
  1591. constructor(i, e, n, t, r, s, o, c, d) {
  1592. super(), this._context = i, this._renderManagerService = e, this._commandService = n, this._selectionRenderService = t, this._skeletonManagerService = r, this._sheetInterceptorService = s, this._sheetDrawingService = o, this._drawingManagerService = c, this._univerInstanceService = d, this._sheetInterceptorListener(), this._commandListener(), this._sheetRefreshListener();
  1593. }
  1594. _sheetInterceptorListener() {
  1595. this.disposeWithMe(
  1596. this._sheetInterceptorService.interceptCommand({
  1597. getMutations: (i) => {
  1598. if (!Ns.includes(i.id))
  1599. return { redos: [], undos: [] };
  1600. if (i.params == null)
  1601. return { redos: [], undos: [] };
  1602. const e = i.id;
  1603. if (e === mt.id)
  1604. return this._moveRowInterceptor(i.params, "insert");
  1605. if ([jn2.id, Fn.id, pt.id].includes(e))
  1606. return this._moveRangeInterceptor(i.params);
  1607. if (e === gt.id)
  1608. return this._moveColInterceptor(i.params, "insert");
  1609. if (e === Gn.id)
  1610. return this._moveRowInterceptor(i.params, "remove");
  1611. if (e === zn.id)
  1612. return this._moveColInterceptor(i.params, "remove");
  1613. if (e === Pt2.id) {
  1614. const { range: n } = i.params;
  1615. return this._getRangeMoveUndo(
  1616. n,
  1617. 0
  1618. /* deleteLeft */
  1619. );
  1620. } else if (e === Tt.id) {
  1621. const { range: n } = i.params;
  1622. return this._getRangeMoveUndo(
  1623. n,
  1624. 1
  1625. /* deleteUp */
  1626. );
  1627. } else if (e === sn.id) {
  1628. const { range: n } = i.params;
  1629. return this._getRangeMoveUndo(
  1630. n,
  1631. 2
  1632. /* insertDown */
  1633. );
  1634. } else if (e === Bn.id) {
  1635. const { range: n } = i.params;
  1636. return this._getRangeMoveUndo(
  1637. n,
  1638. 3
  1639. /* insertRight */
  1640. );
  1641. } else if (e === kr.id || e === Jn.id) {
  1642. const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
  1643. return this._getDrawingUndoForRowVisible(t, r, s);
  1644. } else if (e === Kn.id || e === yr.id) {
  1645. const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n;
  1646. return this._getDrawingUndoForColVisible(t, r, s);
  1647. } else if (e === $o.id || e === Wo.id || e === Oo.id || e === Mn.id) {
  1648. const n = i.params, { unitId: t, subUnitId: r, ranges: s } = n, o = e === $o.id || e === Wo.id;
  1649. return this._getDrawingUndoForRowAndColSize(t, r, s, o);
  1650. }
  1651. return { redos: [], undos: [] };
  1652. }
  1653. })
  1654. );
  1655. }
  1656. _getRangeMoveUndo(i, e) {
  1657. const n = N(this._univerInstanceService);
  1658. if (n == null)
  1659. return { redos: [], undos: [] };
  1660. const t = n.unitId, r = n.subUnitId, s = [], o = [], c = this._sheetDrawingService.getDrawingData(t, r), d = [], g = [];
  1661. if (Object.keys(c).forEach((a) => {
  1662. const l = c[a], { updateDrawings: h, deleteDrawings: u2 } = this._getUpdateOrDeleteDrawings(i, e, l);
  1663. d.push(...h), g.push(...u2);
  1664. }), d.length === 0 && g.length === 0)
  1665. return { redos: [], undos: [] };
  1666. if (d.length > 0) {
  1667. const a = this._sheetDrawingService.getBatchUpdateOp(d), { undo: l, redo: h, objects: u2 } = a;
  1668. s.push({ id: H.id, params: { unitId: t, subUnitId: r, op: h, objects: u2, type: F2.UPDATE } }), o.push({ id: H.id, params: { unitId: t, subUnitId: r, op: l, objects: u2, type: F2.UPDATE } });
  1669. }
  1670. if (g.length > 0) {
  1671. const a = this._sheetDrawingService.getBatchRemoveOp(g), l = a.undo, h = a.redo, u2 = a.objects;
  1672. s.push({ id: H.id, params: { unitId: t, subUnitId: r, op: h, objects: u2, type: F2.REMOVE } }), o.push({ id: H.id, params: { unitId: t, subUnitId: r, op: l, objects: u2, type: F2.INSERT } });
  1673. }
  1674. return s.push({ id: F3.id, params: [t] }), o.push({ id: F3.id, params: [t] }), {
  1675. redos: s,
  1676. undos: o
  1677. };
  1678. }
  1679. _getUpdateOrDeleteDrawings(i, e, n) {
  1680. const t = [], r = [], { sheetTransform: s, anchorType: o = j.Position, transform: c, unitId: d, subUnitId: g, drawingId: a } = n, { from: l, to: h } = s, { row: u2, column: m } = l, { row: p, column: f2 } = h;
  1681. if (s == null || c == null)
  1682. return {
  1683. updateDrawings: t,
  1684. deleteDrawings: r
  1685. };
  1686. const { startRow: w, endRow: I, startColumn: S, endColumn: R } = i;
  1687. let v = null, C = null;
  1688. if (e === 0 && u2 >= w && p <= I)
  1689. if (m >= S && f2 <= R)
  1690. r.push({ unitId: d, subUnitId: g, drawingId: a });
  1691. else {
  1692. const _3 = this._shrinkCol(s, c, S, R, o);
  1693. v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform;
  1694. }
  1695. else if (e === 1 && m >= S && f2 <= R)
  1696. if (u2 >= w && p <= I)
  1697. r.push({ unitId: d, subUnitId: g, drawingId: a });
  1698. else {
  1699. const _3 = this._shrinkRow(s, c, w, I, o);
  1700. v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform;
  1701. }
  1702. else if (e === 2) {
  1703. const _3 = this._expandRow(s, c, w, I, o);
  1704. v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform;
  1705. } else if (e === 3) {
  1706. const _3 = this._expandCol(s, c, S, R, o);
  1707. v = _3 == null ? void 0 : _3.newSheetTransform, C = _3 == null ? void 0 : _3.newTransform;
  1708. }
  1709. if (v != null && C != null) {
  1710. const _3 = z(v, this._selectionRenderService, this._skeletonManagerService);
  1711. t.push({ ...n, sheetTransform: v, transform: _3 });
  1712. }
  1713. return { updateDrawings: t, deleteDrawings: r };
  1714. }
  1715. _remainDrawingSize(i, e, n) {
  1716. const t = k({ ...i }, this._selectionRenderService);
  1717. t != null && e.push({
  1718. ...n,
  1719. sheetTransform: t
  1720. });
  1721. }
  1722. // eslint-disable-next-line max-lines-per-function
  1723. _getDrawingUndoForColVisible(i, e, n) {
  1724. const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
  1725. if (Object.keys(t).forEach((a) => {
  1726. const l = t[a], { sheetTransform: h, transform: u2, anchorType: m = j.Position } = l;
  1727. if (m === j.None)
  1728. this._remainDrawingSize(u2, r, l);
  1729. else {
  1730. const { from: p, to: f2 } = h, { row: w, column: I } = p, { row: S, column: R } = f2;
  1731. for (let v = 0; v < n.length; v++) {
  1732. const C = n[v], { startRow: _3, endRow: y, startColumn: M, endColumn: x } = C;
  1733. if (R < M)
  1734. continue;
  1735. if (m === j.Position) {
  1736. let b = null, P = null;
  1737. if (I >= M && I <= x) {
  1738. const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f2.row });
  1739. if (A == null)
  1740. return;
  1741. P = { ...u2, left: A.startX };
  1742. }
  1743. if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) {
  1744. r.push({ ...l, sheetTransform: b, transform: P });
  1745. break;
  1746. }
  1747. this._remainDrawingSize(u2, r, l);
  1748. continue;
  1749. }
  1750. if (I >= M && R <= x)
  1751. continue;
  1752. let U = null, D = null;
  1753. if (I >= M && I <= x) {
  1754. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: I, endColumn: x, startRow: p.row, endRow: f2.row });
  1755. if (b == null)
  1756. return;
  1757. D = {
  1758. ...u2,
  1759. left: (b == null ? void 0 : b.startX) || 0,
  1760. width: ((u2 == null ? void 0 : u2.width) || 0) - b.endX + b.startX
  1761. };
  1762. } else if (R >= M && R <= x) {
  1763. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: R, startRow: p.row, endRow: f2.row });
  1764. if (b == null)
  1765. return;
  1766. D = {
  1767. ...u2,
  1768. left: b.startX - ((u2 == null ? void 0 : u2.width) || 0)
  1769. };
  1770. } else {
  1771. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: M, endColumn: x, startRow: p.row, endRow: f2.row });
  1772. if (b == null)
  1773. return;
  1774. if (D = {
  1775. ...u2,
  1776. width: ((u2 == null ? void 0 : u2.width) || 0) - b.endX + b.startX
  1777. }, U = k(D, this._selectionRenderService), U != null && D != null) {
  1778. s.push({ ...l, sheetTransform: U, transform: D });
  1779. break;
  1780. }
  1781. }
  1782. if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) {
  1783. r.push({ ...l, sheetTransform: U, transform: D });
  1784. break;
  1785. } else
  1786. this._remainDrawingSize(u2, r, l);
  1787. }
  1788. }
  1789. }), r.length === 0 && s.length === 0)
  1790. return { redos: [], undos: [] };
  1791. const { redos: o, undos: c } = this._createUndoAndRedoMutation(i, e, r), d = [], g = [];
  1792. if (s.length > 0) {
  1793. const { redos: a, undos: l } = this._createUndoAndRedoMutation(i, e, s);
  1794. d.push(...a), g.push(...l);
  1795. }
  1796. return {
  1797. redos: o,
  1798. undos: c,
  1799. preRedos: d,
  1800. preUndos: g
  1801. };
  1802. }
  1803. _createUndoAndRedoMutation(i, e, n) {
  1804. const t = this._sheetDrawingService.getBatchUpdateOp(n), { undo: r, redo: s, objects: o } = t, c = [
  1805. { id: H.id, params: { unitId: i, subUnitId: e, op: s, objects: o, type: F2.UPDATE } },
  1806. { id: F3.id, params: [i] }
  1807. ], d = [
  1808. { id: H.id, params: { unitId: i, subUnitId: e, op: r, objects: o, type: F2.UPDATE } },
  1809. { id: F3.id, params: [i] }
  1810. ];
  1811. return {
  1812. redos: c,
  1813. undos: d
  1814. };
  1815. }
  1816. // eslint-disable-next-line max-lines-per-function
  1817. _getDrawingUndoForRowVisible(i, e, n) {
  1818. const t = this._drawingManagerService.getDrawingData(i, e), r = [], s = [];
  1819. if (Object.keys(t).forEach((a) => {
  1820. const l = t[a], { sheetTransform: h, transform: u2, anchorType: m = j.Position } = l;
  1821. if (m === j.None)
  1822. this._remainDrawingSize(u2, r, l);
  1823. else {
  1824. const { from: p, to: f2 } = h, { row: w, column: I } = p, { row: S, column: R } = f2;
  1825. for (let v = 0; v < n.length; v++) {
  1826. const C = n[v], { startRow: _3, endRow: y, startColumn: M, endColumn: x } = C;
  1827. if (S < _3)
  1828. continue;
  1829. if (m === j.Position) {
  1830. let b = null, P = null;
  1831. if (w >= _3 && w <= y) {
  1832. const A = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: w, endRow: y });
  1833. if (A == null)
  1834. return;
  1835. P = { ...u2, top: A.startY };
  1836. }
  1837. if (P != null && (b = k(P, this._selectionRenderService), b != null && P != null)) {
  1838. r.push({ ...l, sheetTransform: b, transform: P });
  1839. break;
  1840. }
  1841. this._remainDrawingSize(u2, r, l);
  1842. continue;
  1843. }
  1844. if (w >= _3 && S <= y)
  1845. continue;
  1846. let U = null, D = null;
  1847. if (w >= _3 && w <= y) {
  1848. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: w, endRow: y });
  1849. if (b == null)
  1850. return;
  1851. D = {
  1852. ...u2,
  1853. top: (b == null ? void 0 : b.startY) || 0,
  1854. height: ((u2 == null ? void 0 : u2.height) || 0) - b.endY + b.startY
  1855. };
  1856. } else if (S >= _3 && S <= y) {
  1857. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: _3, endRow: S });
  1858. if (b == null)
  1859. return;
  1860. D = {
  1861. ...u2,
  1862. top: b.startY - ((u2 == null ? void 0 : u2.height) || 0)
  1863. };
  1864. } else {
  1865. const b = this._skeletonManagerService.attachRangeWithCoord({ startColumn: p.column, endColumn: f2.column, startRow: _3, endRow: y });
  1866. if (b == null)
  1867. return;
  1868. if (D = {
  1869. ...u2,
  1870. height: ((u2 == null ? void 0 : u2.height) || 0) - b.endY + b.startY
  1871. }, U = k(D, this._selectionRenderService), U != null && D != null) {
  1872. s.push({ ...l, sheetTransform: U, transform: D });
  1873. break;
  1874. }
  1875. }
  1876. if (D != null && (U = k(D, this._selectionRenderService)), D != null && U != null) {
  1877. r.push({ ...l, sheetTransform: U, transform: D });
  1878. break;
  1879. } else
  1880. this._remainDrawingSize(u2, r, l);
  1881. }
  1882. }
  1883. }), r.length === 0 && s.length === 0)
  1884. return { redos: [], undos: [] };
  1885. const { redos: o, undos: c } = this._createUndoAndRedoMutation(i, e, r), d = [], g = [];
  1886. if (s.length > 0) {
  1887. const { redos: a, undos: l } = this._createUndoAndRedoMutation(i, e, s);
  1888. d.push(...a), g.push(...l);
  1889. }
  1890. return {
  1891. redos: o,
  1892. undos: c,
  1893. preRedos: d,
  1894. preUndos: g
  1895. };
  1896. }
  1897. _getDrawingUndoForRowAndColSize(i, e, n, t) {
  1898. const r = this._drawingManagerService.getDrawingData(i, e), s = [];
  1899. return Object.keys(r).forEach((o) => {
  1900. const c = r[o], { sheetTransform: d, transform: g, anchorType: a = j.Position } = c;
  1901. if (a === j.None)
  1902. this._remainDrawingSize(g, s, c);
  1903. else {
  1904. const { from: l, to: h } = d, { row: u2, column: m } = l, { row: p, column: f2 } = h;
  1905. for (let w = 0; w < n.length; w++) {
  1906. const I = n[w], { startRow: S, endRow: R, startColumn: v, endColumn: C } = I;
  1907. if (p < S || f2 < v)
  1908. continue;
  1909. if (a === j.Position && (u2 <= S && p >= R || m <= v && f2 >= C)) {
  1910. this._remainDrawingSize(g, s, c);
  1911. continue;
  1912. }
  1913. const _3 = z(
  1914. { ...d },
  1915. this._selectionRenderService,
  1916. this._skeletonManagerService
  1917. );
  1918. if (_3 != null) {
  1919. s.push({
  1920. ...c,
  1921. transform: _3
  1922. });
  1923. break;
  1924. }
  1925. }
  1926. }
  1927. }), s.length === 0 ? { redos: [], undos: [] } : this._createUndoAndRedoMutation(i, e, s);
  1928. }
  1929. _getUnitIdAndSubUnitId(i, e) {
  1930. let n, t;
  1931. if (e === "insert")
  1932. n = i.unitId, t = i.subUnitId;
  1933. else {
  1934. const r = N(this._univerInstanceService);
  1935. if (r == null)
  1936. return;
  1937. n = r.unitId, t = r.subUnitId;
  1938. }
  1939. return { unitId: n, subUnitId: t };
  1940. }
  1941. _moveRangeInterceptor(i) {
  1942. var S, R;
  1943. const { toRange: e, fromRange: n } = i, t = N(this._univerInstanceService);
  1944. if (!t)
  1945. return { redos: [], undos: [] };
  1946. const { unitId: r, subUnitId: s } = t, o = (R = (S = this._renderManagerService.getRenderById(r)) == null ? void 0 : S.with(me)) == null ? void 0 : R.getCurrentSkeleton();
  1947. if (!o)
  1948. return { redos: [], undos: [] };
  1949. const c = ni(o, n);
  1950. if (!c)
  1951. return { redos: [], undos: [] };
  1952. const { startX: d, endX: g, startY: a, endY: l } = c, h = this._sheetDrawingService.getDrawingData(r, s), u2 = [];
  1953. Object.keys(h).forEach((v) => {
  1954. const C = h[v];
  1955. if (C.anchorType !== j.Both)
  1956. return;
  1957. const { transform: _3 } = C;
  1958. if (!_3)
  1959. return;
  1960. const { left: y = 0, top: M = 0, width: x = 0, height: U = 0 } = _3, { drawingStartX: D, drawingEndX: b, drawingStartY: P, drawingEndY: A } = {
  1961. drawingStartX: y,
  1962. drawingEndX: y + x,
  1963. drawingStartY: M,
  1964. drawingEndY: M + U
  1965. };
  1966. d <= D && b <= g && a <= P && A <= l && u2.push(C);
  1967. });
  1968. const m = [], p = [], f2 = e.startRow - n.startRow, w = e.startColumn - n.startColumn, I = u2.map((v) => {
  1969. const C = v.sheetTransform, _3 = {
  1970. to: { ...C.to, row: C.to.row + f2, column: C.to.column + w },
  1971. from: { ...C.from, row: C.from.row + f2, column: C.from.column + w }
  1972. }, y = z(_3, this._selectionRenderService, this._skeletonManagerService);
  1973. return {
  1974. unitId: r,
  1975. subUnitId: s,
  1976. drawingId: v.drawingId,
  1977. transform: y,
  1978. sheetTransform: _3
  1979. };
  1980. });
  1981. if (I.length) {
  1982. const v = this._sheetDrawingService.getBatchUpdateOp(I), { undo: C, redo: _3, objects: y } = v;
  1983. m.push({ id: H.id, params: { unitId: r, subUnitId: s, op: _3, objects: y, type: F2.UPDATE } }), p.push({ id: H.id, params: { unitId: r, subUnitId: s, op: C, objects: y, type: F2.UPDATE } });
  1984. }
  1985. return { redos: m, undos: p };
  1986. }
  1987. _moveRowInterceptor(i, e) {
  1988. const n = this._getUnitIdAndSubUnitId(i, e);
  1989. if (n == null)
  1990. return { redos: [], undos: [] };
  1991. const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startRow, c = s.endRow, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = [];
  1992. if (Object.keys(a).forEach((u2) => {
  1993. const m = a[u2], { sheetTransform: p, transform: f2, anchorType: w = j.Position } = m;
  1994. if (p == null || f2 == null)
  1995. return;
  1996. let I, S;
  1997. if (e === "insert") {
  1998. const v = this._expandRow(p, f2, o, c, w);
  1999. I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform;
  2000. } else {
  2001. const { from: v, to: C } = p, { row: _3 } = v, { row: y } = C;
  2002. if (w === j.Both && _3 >= o && y <= c)
  2003. h.push({ unitId: t, subUnitId: r, drawingId: u2 });
  2004. else {
  2005. const M = this._shrinkRow(p, f2, o, c, w);
  2006. I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform;
  2007. }
  2008. }
  2009. if (!I || !S)
  2010. return;
  2011. const R = { unitId: t, subUnitId: r, drawingId: u2, transform: S, sheetTransform: I };
  2012. l.push(R);
  2013. }), l.length === 0 && h.length === 0)
  2014. return { redos: [], undos: [] };
  2015. if (l.length > 0) {
  2016. const u2 = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f2 } = u2;
  2017. d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.UPDATE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.UPDATE } });
  2018. }
  2019. if (h.length > 0) {
  2020. const u2 = this._sheetDrawingService.getBatchRemoveOp(h), m = u2.undo, p = u2.redo, f2 = u2.objects;
  2021. d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.REMOVE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.INSERT } });
  2022. }
  2023. return d.push({ id: F3.id, params: [t] }), g.push({ id: F3.id, params: [t] }), {
  2024. redos: d,
  2025. undos: g
  2026. };
  2027. }
  2028. _moveColInterceptor(i, e) {
  2029. const n = this._getUnitIdAndSubUnitId(i, e);
  2030. if (n == null)
  2031. return { redos: [], undos: [] };
  2032. const { unitId: t, subUnitId: r } = n, { range: s } = i, o = s.startColumn, c = s.endColumn, d = [], g = [], a = this._sheetDrawingService.getDrawingData(t, r), l = [], h = [];
  2033. if (Object.keys(a).forEach((u2) => {
  2034. const m = a[u2], { sheetTransform: p, transform: f2, anchorType: w = j.Position } = m;
  2035. if (p == null || f2 == null)
  2036. return;
  2037. let I, S;
  2038. if (e === "insert") {
  2039. const v = this._expandCol(p, f2, o, c, w);
  2040. I = v == null ? void 0 : v.newSheetTransform, S = v == null ? void 0 : v.newTransform;
  2041. } else {
  2042. const { from: v, to: C } = p, { column: _3 } = v, { column: y } = C;
  2043. if (w === j.Both && _3 >= o && y <= c)
  2044. h.push({ unitId: t, subUnitId: r, drawingId: u2 });
  2045. else {
  2046. const M = this._shrinkCol(p, f2, o, c, w);
  2047. I = M == null ? void 0 : M.newSheetTransform, S = M == null ? void 0 : M.newTransform;
  2048. }
  2049. }
  2050. if (!I || !S)
  2051. return;
  2052. const R = { unitId: t, subUnitId: r, drawingId: u2, transform: S, sheetTransform: I };
  2053. l.push(R);
  2054. }), l.length === 0 && h.length === 0)
  2055. return { redos: [], undos: [] };
  2056. if (l.length > 0) {
  2057. const u2 = this._sheetDrawingService.getBatchUpdateOp(l), { undo: m, redo: p, objects: f2 } = u2;
  2058. d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.UPDATE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.UPDATE } });
  2059. }
  2060. if (h.length > 0) {
  2061. const u2 = this._sheetDrawingService.getBatchRemoveOp(h), m = u2.undo, p = u2.redo, f2 = u2.objects;
  2062. d.push({ id: H.id, params: { unitId: t, subUnitId: r, op: p, objects: f2, type: F2.REMOVE } }), g.push({ id: H.id, params: { unitId: t, subUnitId: r, op: m, objects: f2, type: F2.INSERT } });
  2063. }
  2064. return d.push({ id: F3.id, params: [t] }), g.push({ id: F3.id, params: [t] }), { redos: d, undos: g };
  2065. }
  2066. _expandCol(i, e, n, t, r = j.Position) {
  2067. const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c;
  2068. if (r === j.None)
  2069. return {
  2070. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2071. newTransform: e
  2072. };
  2073. let a = null, l = null;
  2074. if (d >= n) {
  2075. const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: t, startRow: o.row, endRow: c.row });
  2076. if (h == null)
  2077. return;
  2078. l = { ...e, left: (e.left || 0) + h.endX - h.startX }, a = k(l, this._selectionRenderService);
  2079. } else if (g >= t)
  2080. if (r === j.Both)
  2081. a = {
  2082. from: { ...o },
  2083. to: { ...c, column: g + s }
  2084. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2085. else
  2086. return {
  2087. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2088. newTransform: e
  2089. };
  2090. return a != null && l != null ? {
  2091. newSheetTransform: a,
  2092. newTransform: l
  2093. } : null;
  2094. }
  2095. _shrinkCol(i, e, n, t, r = j.Position) {
  2096. const s = t - n + 1, { from: o, to: c } = i, { column: d } = o, { column: g } = c;
  2097. if (r === j.None)
  2098. return {
  2099. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2100. newTransform: e
  2101. };
  2102. let a = null, l = null;
  2103. if (d > t)
  2104. a = {
  2105. from: { ...o, column: d - s },
  2106. to: { ...c, column: g - s }
  2107. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2108. else {
  2109. if (d >= n && g <= t)
  2110. return null;
  2111. if (d < n && g > t)
  2112. if (r === j.Both)
  2113. a = {
  2114. from: { ...o },
  2115. to: { ...c, column: g - s }
  2116. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2117. else
  2118. return {
  2119. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2120. newTransform: e
  2121. };
  2122. else if (d >= n && d <= t) {
  2123. if (d === n)
  2124. l = { ...e, left: (e.left || 0) - i.from.columnOffset };
  2125. else {
  2126. const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: n, endColumn: d - 1, startRow: o.row, endRow: c.row });
  2127. if (h == null)
  2128. return;
  2129. l = { ...e, left: (e.left || 0) - h.endX + h.startX - i.from.columnOffset };
  2130. }
  2131. a = k(l, this._selectionRenderService);
  2132. } else if (g >= n && g <= t && r === j.Both) {
  2133. const h = this._skeletonManagerService.attachRangeWithCoord({
  2134. startColumn: n - 1,
  2135. endColumn: n - 1,
  2136. startRow: o.row,
  2137. endRow: c.row
  2138. });
  2139. if (h == null)
  2140. return;
  2141. a = {
  2142. from: { ...o },
  2143. to: { ...c, column: n - 1, columnOffset: h.endX - h.startX }
  2144. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2145. }
  2146. }
  2147. return a != null && l != null ? {
  2148. newSheetTransform: a,
  2149. newTransform: l
  2150. } : null;
  2151. }
  2152. _expandRow(i, e, n, t, r = j.Position) {
  2153. const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c;
  2154. if (r === j.None)
  2155. return {
  2156. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2157. newTransform: e
  2158. };
  2159. let a = null, l = null;
  2160. if (d >= n) {
  2161. const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: t, startColumn: o.column, endColumn: c.column });
  2162. if (h == null)
  2163. return;
  2164. l = { ...e, top: (e.top || 0) + h.endY - h.startY }, a = k(l, this._selectionRenderService);
  2165. } else if (g >= t)
  2166. if (r === j.Both)
  2167. a = {
  2168. from: { ...o },
  2169. to: {
  2170. ...c,
  2171. row: g + s
  2172. }
  2173. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2174. else
  2175. return {
  2176. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2177. newTransform: e
  2178. };
  2179. return a != null && l != null ? {
  2180. newSheetTransform: a,
  2181. newTransform: l
  2182. } : null;
  2183. }
  2184. _shrinkRow(i, e, n, t, r = j.Position) {
  2185. const s = t - n + 1, { from: o, to: c } = i, { row: d } = o, { row: g } = c;
  2186. if (r === j.None)
  2187. return {
  2188. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2189. newTransform: e
  2190. };
  2191. let a = null, l = null;
  2192. if (d > t)
  2193. a = {
  2194. from: { ...o, row: d - s },
  2195. to: { ...c, row: g - s }
  2196. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2197. else {
  2198. if (d >= n && g <= t)
  2199. return null;
  2200. if (d < n && g > t)
  2201. if (r === j.Both)
  2202. a = {
  2203. from: { ...o },
  2204. to: { ...c, row: g - s }
  2205. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2206. else
  2207. return {
  2208. newSheetTransform: k({ ...e }, this._selectionRenderService),
  2209. newTransform: e
  2210. };
  2211. else if (d >= n && d <= t) {
  2212. if (d === n)
  2213. l = { ...e, top: (e.top || 0) - i.from.rowOffset };
  2214. else {
  2215. const h = this._skeletonManagerService.attachRangeWithCoord({ startRow: n, endRow: d - 1, startColumn: o.column, endColumn: c.column });
  2216. if (h == null)
  2217. return;
  2218. l = { ...e, top: (e.top || 0) - h.endY + h.startY - i.from.rowOffset };
  2219. }
  2220. a = k(l, this._selectionRenderService);
  2221. } else if (g >= n && g <= t && r === j.Both) {
  2222. const h = this._skeletonManagerService.attachRangeWithCoord({ startColumn: o.column, endColumn: o.column, startRow: n - 1, endRow: n - 1 });
  2223. if (h == null)
  2224. return;
  2225. a = {
  2226. from: { ...o },
  2227. to: { ...c, row: n - 1, rowOffset: h.endY - h.startY }
  2228. }, l = z(a, this._selectionRenderService, this._skeletonManagerService);
  2229. }
  2230. }
  2231. return a != null && l != null ? {
  2232. newSheetTransform: a,
  2233. newTransform: l
  2234. } : null;
  2235. }
  2236. _commandListener() {
  2237. this.disposeWithMe(
  2238. this._commandService.onCommandExecuted((i) => {
  2239. i.id === an.id && setTimeout(() => {
  2240. const e = i.params, { unitId: n, subUnitId: t } = e, r = this._drawingManagerService.drawingManagerData, s = [], o = [];
  2241. Object.keys(r).forEach((c) => {
  2242. const d = r[c];
  2243. d != null && Object.keys(d).forEach((g) => {
  2244. const a = d[g].data;
  2245. a != null && Object.keys(a).forEach((l) => {
  2246. if (c === n && g === t) {
  2247. const h = a[l];
  2248. h.transform = z(h.sheetTransform, this._selectionRenderService, this._skeletonManagerService), s.push(a[l]);
  2249. } else
  2250. o.push(a[l]);
  2251. });
  2252. });
  2253. }), this._drawingManagerService.removeNotification(o), this._drawingManagerService.addNotification(s);
  2254. }, 0);
  2255. })
  2256. );
  2257. }
  2258. _sheetRefreshListener() {
  2259. this.disposeWithMe(
  2260. this._commandService.onCommandExecuted((i) => {
  2261. js.includes(i.id) && requestIdleCallback(() => {
  2262. const e = i.params, { unitId: n, subUnitId: t, ranges: r } = e;
  2263. this._refreshDrawingTransform(n, t, r);
  2264. });
  2265. })
  2266. );
  2267. }
  2268. _refreshDrawingTransform(i, e, n) {
  2269. const t = this._drawingManagerService.getDrawingData(i, e), r = [];
  2270. Object.keys(t).forEach((s) => {
  2271. const o = t[s], { sheetTransform: c, transform: d, anchorType: g = j.Position } = o;
  2272. if (g === j.None)
  2273. return true;
  2274. const { from: a, to: l } = c, { row: h, column: u2 } = a, { row: m, column: p } = l;
  2275. for (let f2 = 0; f2 < n.length; f2++) {
  2276. const w = n[f2], { startRow: I, endRow: S, startColumn: R, endColumn: v } = w;
  2277. if (en.intersects(
  2278. {
  2279. startRow: I,
  2280. endRow: S,
  2281. startColumn: R,
  2282. endColumn: v
  2283. },
  2284. {
  2285. startRow: h,
  2286. endRow: m,
  2287. startColumn: u2,
  2288. endColumn: p
  2289. }
  2290. ) || h > S || u2 > v) {
  2291. const C = g === j.Position, _3 = z(c, this._selectionRenderService, this._skeletonManagerService);
  2292. r.push({
  2293. ...o,
  2294. transform: {
  2295. ..._3,
  2296. width: C ? d == null ? void 0 : d.width : _3 == null ? void 0 : _3.width,
  2297. height: C ? d == null ? void 0 : d.height : _3 == null ? void 0 : _3.height
  2298. }
  2299. });
  2300. break;
  2301. }
  2302. }
  2303. }), r.length !== 0 && (this._drawingManagerService.refreshTransform(r), this._commandService.syncExecuteCommand(F3.id, [i]));
  2304. }
  2305. };
  2306. sn2 = As([
  2307. pe(1, Yx),
  2308. pe(2, Pt),
  2309. pe(3, dt),
  2310. pe(4, ot(me)),
  2311. pe(5, ot(V)),
  2312. pe(6, u),
  2313. pe(7, Ut),
  2314. pe(8, _n)
  2315. ], sn2);
  2316. var ne2 = function() {
  2317. return ne2 = Object.assign || function(i) {
  2318. for (var e, n = 1, t = arguments.length; n < t; n++) {
  2319. e = arguments[n];
  2320. for (var r in e)
  2321. Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
  2322. }
  2323. return i;
  2324. }, ne2.apply(this, arguments);
  2325. };
  2326. var Ws = function(i, e) {
  2327. var n = {};
  2328. for (var t in i)
  2329. Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
  2330. if (i != null && typeof Object.getOwnPropertySymbols == "function")
  2331. for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
  2332. e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
  2333. return n;
  2334. };
  2335. var lr = (0, import_react.forwardRef)(function(i, e) {
  2336. var n = i.icon, t = i.id, r = i.className, s = i.extend, o = Ws(i, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = (0, import_react.useRef)("_".concat($s()));
  2337. return ur(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, ne2({ ref: e, className: c }, o), s);
  2338. });
  2339. function ur(i, e, n, t, r) {
  2340. return (0, import_react.createElement)(i.tag, ne2(ne2({ key: e }, xs(i, n, r)), t), (Bs(i, n).children || []).map(function(s, o) {
  2341. return ur(s, "".concat(e, "-").concat(i.tag, "-").concat(o), n, void 0, r);
  2342. }));
  2343. }
  2344. function xs(i, e, n) {
  2345. var t = ne2({}, i.attrs);
  2346. n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
  2347. var r = e.defIds;
  2348. return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(s) {
  2349. var o = s[0], c = s[1];
  2350. typeof c == "string" && (t[o] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
  2351. })), t;
  2352. }
  2353. function Bs(i, e) {
  2354. var n, t = e.defIds;
  2355. return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? ne2(ne2({}, i), { children: i.children.map(function(r) {
  2356. return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? ne2(ne2({}, r), { attrs: ne2(ne2({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
  2357. }) }) : i;
  2358. }
  2359. function $s() {
  2360. return Math.random().toString(36).substring(2, 8);
  2361. }
  2362. lr.displayName = "UniverIcon";
  2363. var ks = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] };
  2364. var hr = (0, import_react.forwardRef)(function(i, e) {
  2365. return (0, import_react.createElement)(lr, Object.assign({}, i, {
  2366. id: "add-image-single",
  2367. ref: e,
  2368. icon: ks
  2369. }));
  2370. });
  2371. hr.displayName = "AddImageSingle";
  2372. var gr2 = {
  2373. id: "sheet.command.delete-drawing",
  2374. type: ar.COMMAND,
  2375. handler: (i) => {
  2376. const e = i.get(Pt), t = i.get(u).getFocusDrawings();
  2377. if (t.length === 0)
  2378. return false;
  2379. const r = t[0].unitId, s = t.map((o) => {
  2380. const { unitId: c, subUnitId: d, drawingId: g, drawingType: a } = o;
  2381. return {
  2382. unitId: c,
  2383. subUnitId: d,
  2384. drawingId: g,
  2385. drawingType: a
  2386. };
  2387. });
  2388. return e.executeCommand(Nt.id, {
  2389. unitId: r,
  2390. drawings: s
  2391. });
  2392. }
  2393. };
  2394. var cn3 = {
  2395. id: "sheet.command.insert-float-image",
  2396. type: ar.COMMAND,
  2397. handler: (i) => {
  2398. var n, t;
  2399. return (t = (n = i.get(Yx).getCurrentTypeOfRenderer(Fe.UNIVER_SHEET)) == null ? void 0 : n.with(Ze2).insertFloatImage()) != null ? t : false;
  2400. }
  2401. };
  2402. var dn2 = {
  2403. id: "sheet.command.insert-cell-image",
  2404. type: ar.COMMAND,
  2405. handler: (i) => {
  2406. var n, t;
  2407. return (t = (n = i.get(Yx).getCurrentTypeOfRenderer(Fe.UNIVER_SHEET)) == null ? void 0 : n.with(Ze2).insertCellImage()) != null ? t : false;
  2408. }
  2409. };
  2410. var et2 = {
  2411. id: "sheet.command.move-drawing",
  2412. type: ar.COMMAND,
  2413. handler: (i, e) => {
  2414. const n = i.get(Pt), t = i.get(u), r = i.get(dt), { direction: s } = e, o = t.getFocusDrawings();
  2415. if (o.length === 0)
  2416. return false;
  2417. const c = o[0].unitId, d = o.map((a) => {
  2418. const { transform: l } = a;
  2419. if (l == null)
  2420. return null;
  2421. const h = { ...l }, { left: u2 = 0, top: m = 0 } = l;
  2422. return s === wu.UP ? h.top = m - 1 : s === wu.DOWN ? h.top = m + 1 : s === wu.LEFT ? h.left = u2 - 1 : s === wu.RIGHT && (h.left = u2 + 1), {
  2423. ...a,
  2424. transform: h,
  2425. sheetTransform: k(h, r)
  2426. };
  2427. }).filter((a) => a != null);
  2428. return n.syncExecuteCommand(Wt.id, {
  2429. unitId: c,
  2430. drawings: d
  2431. }) ? (n.syncExecuteCommand(F3.id, [c]), true) : false;
  2432. }
  2433. };
  2434. var mr = "addition-and-subtraction-single";
  2435. var fr = "sheet.menu.image";
  2436. function Ls(i) {
  2437. return {
  2438. id: fr,
  2439. type: $e.SUBITEMS,
  2440. icon: mr,
  2441. tooltip: "sheetImage.title",
  2442. hidden$: Fa(i, Fe.UNIVER_SHEET),
  2443. disabled$: ue(i, { workbookTypes: [Me], worksheetTypes: [Te], rangeTypes: [Pe] })
  2444. };
  2445. }
  2446. function Fs(i) {
  2447. return {
  2448. id: cn3.id,
  2449. title: "sheetImage.upload.float",
  2450. type: $e.BUTTON,
  2451. hidden$: Fa(i, Fe.UNIVER_SHEET)
  2452. };
  2453. }
  2454. function Gs(i) {
  2455. return {
  2456. id: dn2.id,
  2457. title: "sheetImage.upload.cell",
  2458. type: $e.BUTTON
  2459. };
  2460. }
  2461. var Vs = "univer-image-common-panel";
  2462. var Ys = "univer-image-common-panel-grid";
  2463. var Hs = "univer-image-common-panel-border";
  2464. var Xs = "univer-image-common-panel-title";
  2465. var zs = "univer-image-common-panel-subtitle";
  2466. var Ks = "univer-image-common-panel-row";
  2467. var Js2 = "univer-image-common-panel-row-vertical";
  2468. var Zs = "univer-image-common-panel-column";
  2469. var qs = "univer-image-common-panel-column-center";
  2470. var Qs = "univer-image-common-panel-inline";
  2471. var eo = "univer-image-common-panel-span2";
  2472. var to = "univer-image-common-panel-span3";
  2473. var no = "univer-image-common-panel-input";
  2474. var ro = "univer-sheet-image-menu";
  2475. var io = "univer-sheet-image-menu-input";
  2476. var we2 = {
  2477. imageCommonPanel: Vs,
  2478. imageCommonPanelGrid: Ys,
  2479. imageCommonPanelBorder: Hs,
  2480. imageCommonPanelTitle: Xs,
  2481. imageCommonPanelSubtitle: zs,
  2482. imageCommonPanelRow: Ks,
  2483. imageCommonPanelRowVertical: Js2,
  2484. imageCommonPanelColumn: Zs,
  2485. imageCommonPanelColumnCenter: qs,
  2486. imageCommonPanelInline: Qs,
  2487. imageCommonPanelSpan2: eo,
  2488. imageCommonPanelSpan3: to,
  2489. imageCommonPanelInput: no,
  2490. sheetImageMenu: ro,
  2491. sheetImageMenuInput: io
  2492. };
  2493. function pr(i) {
  2494. var e, n, t = "";
  2495. if (typeof i == "string" || typeof i == "number")
  2496. t += i;
  2497. else if (typeof i == "object")
  2498. if (Array.isArray(i)) {
  2499. var r = i.length;
  2500. for (e = 0; e < r; e++)
  2501. i[e] && (n = pr(i[e])) && (t && (t += " "), t += n);
  2502. } else
  2503. for (n in i)
  2504. i[n] && (t && (t += " "), t += n);
  2505. return t;
  2506. }
  2507. function _t() {
  2508. for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++)
  2509. (i = arguments[n]) && (e = pr(i)) && (t && (t += " "), t += e);
  2510. return t;
  2511. }
  2512. var so = (i) => {
  2513. var S;
  2514. const e = W0(Pt), n = W0(Vr), t = W0(Ut), r = W0(Yx), { drawings: s } = i, o = s[0];
  2515. if (o == null)
  2516. return;
  2517. const { unitId: c } = o, d = r.getRenderById(c), g = d == null ? void 0 : d.scene;
  2518. if (g == null)
  2519. return;
  2520. const a = g.getTransformerByCreate(), [l, h] = (0, import_react.useState)(true), u2 = (S = o.anchorType) != null ? S : j.Position, [m, p] = (0, import_react.useState)(u2);
  2521. function f2(R, v) {
  2522. const C = [];
  2523. return R.forEach((_3) => {
  2524. const { oKey: y } = _3, M = v.getDrawingOKey(y);
  2525. if (M == null)
  2526. return C.push(null), true;
  2527. const { unitId: x, subUnitId: U, drawingId: D, drawingType: b, anchorType: P, sheetTransform: A } = M;
  2528. C.push({
  2529. unitId: x,
  2530. subUnitId: U,
  2531. drawingId: D,
  2532. anchorType: P,
  2533. sheetTransform: A,
  2534. drawingType: b
  2535. });
  2536. }), C;
  2537. }
  2538. (0, import_react.useEffect)(() => {
  2539. const R = a.clearControl$.subscribe((C) => {
  2540. C === true && h(false);
  2541. }), v = a.changeStart$.subscribe((C) => {
  2542. var M;
  2543. const { objects: _3 } = C, y = f2(_3, t);
  2544. if (y.length === 0)
  2545. h(false);
  2546. else if (y.length >= 1) {
  2547. h(true);
  2548. const x = ((M = y[0]) == null ? void 0 : M.anchorType) || j.Position;
  2549. p(x);
  2550. }
  2551. });
  2552. return () => {
  2553. v.unsubscribe(), R.unsubscribe();
  2554. };
  2555. }, []);
  2556. function w(R) {
  2557. p(R);
  2558. const v = t.getFocusDrawings();
  2559. if (v.length === 0)
  2560. return;
  2561. const C = v.map((_3) => ({
  2562. unitId: _3.unitId,
  2563. subUnitId: _3.subUnitId,
  2564. drawingId: _3.drawingId,
  2565. anchorType: R
  2566. }));
  2567. e.executeCommand(Wt.id, {
  2568. unitId: v[0].unitId,
  2569. drawings: C
  2570. });
  2571. }
  2572. const I = (R) => R ? "block" : "none";
  2573. return G.jsxs("div", { className: _t(we2.imageCommonPanelGrid, we2.imageCommonPanelBorder), style: { display: I(l) }, children: [
  2574. G.jsx("div", { className: we2.imageCommonPanelRow, children: G.jsx("div", { className: _t(we2.imageCommonPanelColumn, we2.imageCommonPanelTitle), children: G.jsx("div", { children: n.t("drawing-anchor.title") }) }) }),
  2575. G.jsx("div", { className: _t(we2.imageCommonPanelRow), children: G.jsx("div", { className: _t(we2.imageCommonPanelColumn), children: G.jsxs(t_, { value: m, onChange: w, direction: "vertical", children: [
  2576. G.jsx(e_, { value: j.Both, children: n.t("drawing-anchor.both") }),
  2577. G.jsx(e_, { value: j.Position, children: n.t("drawing-anchor.position") }),
  2578. G.jsx(e_, { value: j.None, children: n.t("drawing-anchor.none") })
  2579. ] }) }) })
  2580. ] });
  2581. };
  2582. var oo = () => {
  2583. const i = W0(Ut), e = i.getFocusDrawings(), [n, t] = (0, import_react.useState)(e);
  2584. return (0, import_react.useEffect)(() => {
  2585. const r = i.focus$.subscribe((s) => {
  2586. t(s);
  2587. });
  2588. return () => {
  2589. r.unsubscribe();
  2590. };
  2591. }, []), !!(n != null && n.length) && G.jsxs("div", { className: we2.imageCommonPanel, children: [
  2592. G.jsx(vr, { drawings: n }),
  2593. G.jsx(so, { drawings: n })
  2594. ] });
  2595. };
  2596. var ao = {
  2597. [l1.FORMULAS_INSERT]: {
  2598. [fr]: {
  2599. order: 3,
  2600. menuItemFactory: Ls,
  2601. [cn3.id]: {
  2602. order: 0,
  2603. menuItemFactory: Fs
  2604. },
  2605. [dn2.id]: {
  2606. order: 1,
  2607. menuItemFactory: Gs
  2608. }
  2609. }
  2610. }
  2611. };
  2612. function tt3(i) {
  2613. return !i.getContextValue(aE) && !i.getContextValue(oE) && !i.getContextValue(IR) && i.getContextValue(yR);
  2614. }
  2615. var co = {
  2616. id: et2.id,
  2617. description: "shortcut.sheet.drawing-move-down",
  2618. group: "4_sheet-drawing-view",
  2619. binding: I1.ARROW_DOWN,
  2620. priority: 100,
  2621. preconditions: tt3,
  2622. staticParameters: {
  2623. direction: wu.DOWN
  2624. }
  2625. };
  2626. var lo = {
  2627. id: et2.id,
  2628. description: "shortcut.sheet.drawing-move-up",
  2629. group: "4_sheet-drawing-view",
  2630. binding: I1.ARROW_UP,
  2631. priority: 100,
  2632. preconditions: tt3,
  2633. staticParameters: {
  2634. direction: wu.UP
  2635. }
  2636. };
  2637. var uo = {
  2638. id: et2.id,
  2639. description: "shortcut.sheet.drawing-move-left",
  2640. group: "4_sheet-drawing-view",
  2641. binding: I1.ARROW_LEFT,
  2642. priority: 100,
  2643. preconditions: tt3,
  2644. staticParameters: {
  2645. direction: wu.LEFT
  2646. }
  2647. };
  2648. var ho = {
  2649. id: et2.id,
  2650. description: "shortcut.sheet.drawing-move-right",
  2651. group: "4_sheet-drawing-view",
  2652. binding: I1.ARROW_RIGHT,
  2653. priority: 100,
  2654. preconditions: tt3,
  2655. staticParameters: {
  2656. direction: wu.RIGHT
  2657. }
  2658. };
  2659. var go = {
  2660. id: gr2.id,
  2661. description: "shortcut.sheet.drawing-delete",
  2662. group: "4_sheet-drawing-view",
  2663. // when focusing on any other input tag do not trigger this shortcut
  2664. preconditions: tt3,
  2665. binding: I1.DELETE,
  2666. mac: I1.BACKSPACE
  2667. };
  2668. var mo = Object.defineProperty;
  2669. var fo = Object.getOwnPropertyDescriptor;
  2670. var po = (i, e, n, t) => {
  2671. for (var r = t > 1 ? void 0 : t ? fo(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  2672. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  2673. return t && r && mo(e, n, r), r;
  2674. };
  2675. var vt = (i, e) => (n, t) => e(n, t, i);
  2676. var Ot2 = class extends nt {
  2677. constructor(i, e, n, t) {
  2678. super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
  2679. }
  2680. _initCustomComponents() {
  2681. const i = this._componentManager;
  2682. this.disposeWithMe(i.register(mr, hr)), this.disposeWithMe(i.register(rr2, oo));
  2683. }
  2684. _initMenus() {
  2685. this._menuManagerService.mergeMenu(ao);
  2686. }
  2687. _initCommands() {
  2688. [
  2689. cn3,
  2690. dn2,
  2691. jt,
  2692. Nt,
  2693. Wt,
  2694. ir,
  2695. F3,
  2696. sr,
  2697. or,
  2698. cr,
  2699. et2,
  2700. gr2,
  2701. ar2
  2702. ].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
  2703. }
  2704. _initShortcuts() {
  2705. [
  2706. // sheet drawing shortcuts
  2707. co,
  2708. lo,
  2709. uo,
  2710. ho,
  2711. go
  2712. ].forEach((i) => {
  2713. this.disposeWithMe(this._shortcutService.registerShortcut(i));
  2714. });
  2715. }
  2716. _init() {
  2717. this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
  2718. }
  2719. };
  2720. Ot2 = po([
  2721. vt(0, ot(n1)),
  2722. vt(1, m1),
  2723. vt(2, Pt),
  2724. vt(3, it)
  2725. ], Ot2);
  2726. var wo = Object.defineProperty;
  2727. var _o = Object.getOwnPropertyDescriptor;
  2728. var vo = (i, e, n, t) => {
  2729. for (var r = t > 1 ? void 0 : t ? _o(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  2730. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  2731. return t && r && wo(e, n, r), r;
  2732. };
  2733. var Oe2 = (i, e) => (n, t) => e(n, t, i);
  2734. function So(i, e, n, t, r) {
  2735. const { scaleX: s, scaleY: o } = e.getAncestorScale(), c = e.getViewport(i2.VIEW_MAIN), d = {
  2736. left: true,
  2737. top: true
  2738. };
  2739. if (!c)
  2740. return {
  2741. ...i,
  2742. absolute: d
  2743. };
  2744. const { left: g, right: a, top: l, bottom: h } = i;
  2745. let { top: u2, left: m, viewportScrollX: p, viewportScrollY: f2 } = c;
  2746. const { boundsOfViewArea: w, scrollDirectionResponse: I } = r || {};
  2747. w && (re.isDefine(w.top) && (u2 = w.top), re.isDefine(w.left) && (m = w.left)), I === "HORIZONTAL" && (f2 = 0), I === "VERTICAL" && (p = 0);
  2748. let S, R;
  2749. g < m ? (d.left = true, S = (m + (g - m)) * s, R = Math.max(
  2750. Math.min(
  2751. (m + (a - m)) * s,
  2752. m * s
  2753. ),
  2754. (a - p) * s
  2755. )) : (d.left = false, S = Math.max((g - p) * s, m * s), R = Math.max((a - p) * s, m * s));
  2756. let v, C;
  2757. return l < u2 ? (d.top = true, v = (u2 + (l - u2)) * o, C = Math.max(
  2758. Math.min(
  2759. (u2 + (a - u2)) * o,
  2760. u2 * o
  2761. ),
  2762. (h - f2) * o
  2763. )) : (d.top = false, v = Math.max((l - f2) * o, u2 * o), C = Math.max((h - f2) * o, u2 * o)), {
  2764. left: S,
  2765. right: R,
  2766. top: v,
  2767. bottom: C,
  2768. absolute: d
  2769. };
  2770. }
  2771. var Te2 = (i, e, n, t, r) => {
  2772. const { scene: s } = e, { left: o, top: c, width: d, height: g, angle: a } = i, l = {
  2773. left: o,
  2774. right: o + d,
  2775. top: c,
  2776. bottom: c + g
  2777. }, h = So(l, s, n, t, r), { scaleX: u2, scaleY: m } = s.getAncestorScale();
  2778. return {
  2779. startX: h.left,
  2780. endX: h.right,
  2781. startY: h.top,
  2782. endY: h.bottom,
  2783. rotate: a,
  2784. width: d * u2,
  2785. height: g * m,
  2786. absolute: h.absolute
  2787. };
  2788. };
  2789. var Tt2 = class extends nt {
  2790. constructor(e, n, t, r, s, o, c) {
  2791. super();
  2792. J(this, "_domLayerMap", /* @__PURE__ */ new Map());
  2793. J(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
  2794. J(this, "_transformChange$", new Subject());
  2795. J(this, "transformChange$", this._transformChange$.asObservable());
  2796. J(this, "_add$", new Subject());
  2797. J(this, "add$", this._add$.asObservable());
  2798. J(this, "_remove$", new Subject());
  2799. J(this, "remove$", this._remove$.asObservable());
  2800. J(this, "_hooks", []);
  2801. this._renderManagerService = e, this._univerInstanceService = n, this._commandService = t, this._drawingManagerService = r, this._canvasFloatDomService = s, this._sheetDrawingService = o, this._lifecycleService = c, this._drawingAddListener(), this._featureUpdateListener(), this._deleteListener(), this._bindScrollEvent();
  2802. }
  2803. _bindScrollEvent() {
  2804. this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Rendered), take(1)).subscribe(() => {
  2805. this._scrollUpdateListener();
  2806. });
  2807. }
  2808. _ensureMap(e, n) {
  2809. let t = this._domLayerMap.get(e);
  2810. t || (t = /* @__PURE__ */ new Map(), this._domLayerMap.set(e, t));
  2811. let r = t.get(n);
  2812. return r || (r = /* @__PURE__ */ new Map(), t.set(n, r)), r;
  2813. }
  2814. getFloatDomInfo(e) {
  2815. return this._domLayerInfoMap.get(e);
  2816. }
  2817. _getSceneAndTransformerByDrawingSearch(e) {
  2818. if (e == null)
  2819. return;
  2820. const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
  2821. if (n == null || t == null)
  2822. return null;
  2823. const r = t.getTransformerByCreate(), s = n.engine.getCanvasElement();
  2824. return { scene: t, transformer: r, renderUnit: n, canvas: s };
  2825. }
  2826. _getFloatDomProps(e) {
  2827. let n;
  2828. return this._hooks.forEach((t) => {
  2829. n = t.onGetFloatDomProps(e);
  2830. }), n;
  2831. }
  2832. _drawingAddListener() {
  2833. this.disposeWithMe(
  2834. this._drawingManagerService.add$.subscribe((e) => {
  2835. e.forEach((n) => {
  2836. var Se, ge, ce;
  2837. const { unitId: t, subUnitId: r, drawingId: s } = n, o = N(this._univerInstanceService, { unitId: t, subUnitId: r }), c = this._drawingManagerService.getDrawingByParam(n), d = this._univerInstanceService.getUnit(t, Fe.UNIVER_SHEET);
  2838. if (!d)
  2839. return;
  2840. const g = d.getActiveSheet().getSheetId();
  2841. if (!c || !o)
  2842. return;
  2843. const a = (Se = this._renderManagerService.getRenderById(t)) == null ? void 0 : Se.with(me).getWorksheetSkeleton(r);
  2844. if (!a)
  2845. return;
  2846. const { transform: l, drawingType: h, data: u2 } = c;
  2847. if (h !== gm.DRAWING_DOM && h !== gm.DRAWING_CHART)
  2848. return;
  2849. const m = this._getSceneAndTransformerByDrawingSearch(t);
  2850. if (m == null)
  2851. return;
  2852. const { scene: p, canvas: f2 } = m;
  2853. if (l == null)
  2854. return true;
  2855. if (g !== r)
  2856. return;
  2857. const { left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _3, skewX: y, skewY: M } = l, x = bn({ unitId: t, subUnitId: r, drawingId: s }), U = p.getObject(x);
  2858. if (U != null) {
  2859. U.transformByState({ left: w, top: I, width: S, height: R, angle: v, flipX: C, flipY: _3, skewX: y, skewY: M });
  2860. return;
  2861. }
  2862. const D = {
  2863. left: w,
  2864. top: I,
  2865. width: S,
  2866. height: R,
  2867. zIndex: this._drawingManagerService.getDrawingOrder(t, r).length - 1
  2868. }, b = h === gm.DRAWING_CHART;
  2869. if (b) {
  2870. const $ = u2 ? u2.backgroundColor : "white";
  2871. D.fill = $, D.rotateEnabled = false, u2 && u2.border && (D.stroke = u2.border), D.paintFirst = "stroke", D.strokeWidth = 1, D.borderEnabled = false, D.radius = 8;
  2872. }
  2873. const P = new A1(x, D);
  2874. b && P.setObjectType(b3.CHART), p.addObject(P, aS), c.allowTransform !== false && p.attachTransformerTo(P);
  2875. const A = this._ensureMap(t, r), j2 = new Mi(), B = Te2(P, m.renderUnit, a.skeleton, o.worksheet), X = new BehaviorSubject(B), se = {
  2876. dispose: j2,
  2877. rect: P,
  2878. position$: X,
  2879. unitId: t,
  2880. subUnitId: r
  2881. };
  2882. this._canvasFloatDomService.addFloatDom({
  2883. position$: X,
  2884. id: s,
  2885. componentKey: c.componentKey,
  2886. onPointerDown: ($) => {
  2887. f2.dispatchEvent(new PointerEvent($.type, $));
  2888. },
  2889. onPointerMove: ($) => {
  2890. f2.dispatchEvent(new PointerEvent($.type, $));
  2891. },
  2892. onPointerUp: ($) => {
  2893. f2.dispatchEvent(new PointerEvent($.type, $));
  2894. },
  2895. onWheel: ($) => {
  2896. f2.dispatchEvent(new WheelEvent($.type, $));
  2897. },
  2898. props: (ce = (ge = A.get(s)) == null ? void 0 : ge.props) != null ? ce : this._getFloatDomProps(s),
  2899. data: u2,
  2900. unitId: t
  2901. });
  2902. const oe2 = P.onTransformChange$.subscribeEvent(() => {
  2903. const $ = Te2(P, m.renderUnit, a.skeleton, o.worksheet);
  2904. X.next(
  2905. $
  2906. );
  2907. });
  2908. j2.add(() => {
  2909. this._canvasFloatDomService.removeFloatDom(s);
  2910. }), oe2 && j2.add(oe2), this._domLayerInfoMap.set(s, se), A.set(s, {
  2911. ...A.get(s)
  2912. });
  2913. });
  2914. })
  2915. ), this.disposeWithMe(
  2916. this._drawingManagerService.remove$.subscribe((e) => {
  2917. e.forEach((n) => {
  2918. const { unitId: t, subUnitId: r, drawingId: s } = n, o = bn({ unitId: t, subUnitId: r, drawingId: s }), c = this._getSceneAndTransformerByDrawingSearch(t);
  2919. if (c == null)
  2920. return;
  2921. const { transformer: d, scene: g } = c, a = g.getObject(o);
  2922. a != null && a.oKey && d.clearControlByIds([a == null ? void 0 : a.oKey]);
  2923. });
  2924. })
  2925. );
  2926. }
  2927. _scrollUpdateListener() {
  2928. const e = (n, t) => {
  2929. var g;
  2930. const r = this._getSceneAndTransformerByDrawingSearch(n), s = this._ensureMap(n, t), o = Array.from(s.keys()), c = N(this._univerInstanceService, { unitId: n, subUnitId: t }), d = (g = this._renderManagerService.getRenderById(n)) == null ? void 0 : g.with(me).getWorksheetSkeleton(t);
  2931. !r || !c || !d || o.forEach((a) => {
  2932. const l = this._domLayerInfoMap.get(a);
  2933. if (l) {
  2934. const h = Te2(l.rect, r.renderUnit, d.skeleton, c.worksheet, l);
  2935. l.position$.next(h);
  2936. }
  2937. });
  2938. };
  2939. this.disposeWithMe(
  2940. this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).pipe(
  2941. filter((n) => !!n),
  2942. switchMap((n) => n.activeSheet$),
  2943. filter((n) => !!n),
  2944. map((n) => {
  2945. const t = this._renderManagerService.getRenderById(n.getUnitId());
  2946. return t ? { render: t, unitId: n.getUnitId(), subUnitId: n.getSheetId() } : null;
  2947. }),
  2948. filter((n) => !!n),
  2949. switchMap(
  2950. (n) => DR(n.render.scene.getViewport(i2.VIEW_MAIN).onScrollAfter$).pipe(map(() => ({ unitId: n.unitId, subUnitId: n.subUnitId })))
  2951. )
  2952. ).subscribe(({ unitId: n, subUnitId: t }) => {
  2953. e(n, t);
  2954. })
  2955. ), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
  2956. var t, r;
  2957. if (n.id === $t.id) {
  2958. const s = n.params, { unitId: o } = s;
  2959. Array.from((r = (t = this._domLayerMap.get(o)) == null ? void 0 : t.keys()) != null ? r : []).forEach((d) => {
  2960. e(o, d);
  2961. });
  2962. } else if (n.id === ut.id) {
  2963. const { unitId: s, subUnitId: o } = n.params;
  2964. e(s, o);
  2965. }
  2966. }));
  2967. }
  2968. _getPosition(e, n) {
  2969. var h;
  2970. const { startX: t, endX: r, startY: s, endY: o } = e, c = (h = this._renderManagerService.getRenderById(n)) == null ? void 0 : h.with(dt);
  2971. if (c == null)
  2972. return;
  2973. const d = c.getCellWithCoordByOffset(t, s);
  2974. if (d == null)
  2975. return;
  2976. const g = {
  2977. column: d.actualColumn,
  2978. columnOffset: t - d.startX,
  2979. row: d.actualRow,
  2980. rowOffset: s - d.startY
  2981. }, a = c.getCellWithCoordByOffset(r, o);
  2982. if (a == null)
  2983. return;
  2984. const l = {
  2985. column: a.actualColumn,
  2986. columnOffset: r - a.startX,
  2987. row: a.actualRow,
  2988. rowOffset: o - a.startY
  2989. };
  2990. return {
  2991. from: g,
  2992. to: l
  2993. };
  2994. }
  2995. _featureUpdateListener() {
  2996. this.disposeWithMe(
  2997. this._drawingManagerService.update$.subscribe((e) => {
  2998. e.forEach((n) => {
  2999. const t = this._drawingManagerService.getDrawingByParam(n);
  3000. if (!t || t.drawingType !== gm.DRAWING_DOM && t.drawingType !== gm.DRAWING_CHART)
  3001. return;
  3002. const r = {
  3003. ...t.transform
  3004. };
  3005. this._transformChange$.next({ id: n.drawingId, value: r });
  3006. });
  3007. })
  3008. );
  3009. }
  3010. _deleteListener() {
  3011. this.disposeWithMe(
  3012. this._drawingManagerService.remove$.subscribe((e) => {
  3013. e.forEach((n) => {
  3014. this._removeDom(n.drawingId);
  3015. });
  3016. })
  3017. );
  3018. }
  3019. updateFloatDomProps(e, n, t, r) {
  3020. const s = this._domLayerInfoMap.get(t), o = this._getSceneAndTransformerByDrawingSearch(e);
  3021. if (s && o) {
  3022. const { scene: c } = o, d = bn({ unitId: e, subUnitId: n, drawingId: t }), g = c.getObject(d);
  3023. g && g instanceof A1 && g.setProps(r);
  3024. }
  3025. }
  3026. // CreateFloatDomCommand --> floatDomService.addFloatDomToPosition
  3027. addFloatDomToPosition(e, n) {
  3028. const t = N(this._univerInstanceService, {
  3029. unitId: e.unitId,
  3030. subUnitId: e.subUnitId
  3031. });
  3032. if (!t)
  3033. throw new Error("cannot find current target!");
  3034. const { unitId: r, subUnitId: s } = t, { initPosition: o, componentKey: c, data: d, allowTransform: g = true } = e, a = n != null ? n : qt(), l = this._getPosition(o, r);
  3035. if (l == null)
  3036. return;
  3037. this._ensureMap(r, s).set(a, e);
  3038. const u2 = {
  3039. unitId: r,
  3040. subUnitId: s,
  3041. drawingId: a,
  3042. drawingType: e.type || gm.DRAWING_DOM,
  3043. componentKey: c,
  3044. sheetTransform: l,
  3045. transform: {
  3046. left: o.startX,
  3047. top: o.startY,
  3048. width: o.endX - o.startX,
  3049. height: o.endY - o.startY
  3050. },
  3051. data: d,
  3052. allowTransform: g
  3053. };
  3054. return this._commandService.executeCommand(jt.id, {
  3055. unitId: r,
  3056. drawings: [u2]
  3057. }), this._add$.next({ unitId: r, subUnitId: s, id: a }), {
  3058. id: a,
  3059. dispose: () => {
  3060. this._removeDom(a, true);
  3061. }
  3062. };
  3063. }
  3064. _removeDom(e, n = false) {
  3065. const t = this._domLayerInfoMap.get(e);
  3066. if (!t)
  3067. return;
  3068. const { unitId: r, subUnitId: s } = t;
  3069. this._domLayerInfoMap.delete(e), t.dispose.dispose();
  3070. const o = this._getSceneAndTransformerByDrawingSearch(r);
  3071. if (o && o.scene.removeObject(t.rect), n) {
  3072. this._ensureMap(r, s).delete(e);
  3073. const d = this._drawingManagerService.getDrawingByParam({ unitId: r, subUnitId: s, drawingId: e });
  3074. if (!d)
  3075. return;
  3076. const g = this._sheetDrawingService.getBatchRemoveOp([d]), { redo: a, objects: l } = g;
  3077. this._commandService.syncExecuteCommand(H.id, { unitId: r, subUnitId: s, op: a, objects: l, type: F2.REMOVE });
  3078. }
  3079. }
  3080. addHook(e) {
  3081. return this._hooks.push(e), {
  3082. dispose: () => {
  3083. const n = this._hooks.findIndex((t) => t === e);
  3084. this._hooks.splice(n, 1);
  3085. }
  3086. };
  3087. }
  3088. addFloatDomToRange(e, n, t, r) {
  3089. var M, x, U, D, b, P;
  3090. const s = N(this._univerInstanceService, {
  3091. unitId: n.unitId,
  3092. subUnitId: n.subUnitId
  3093. });
  3094. if (!s)
  3095. throw new Error("cannot find current target!");
  3096. const { unitId: o, subUnitId: c } = s;
  3097. if (!this._getSceneAndTransformerByDrawingSearch(o))
  3098. return;
  3099. const g = this._renderManagerService.getRenderById(o);
  3100. if (!g)
  3101. return;
  3102. const a = (M = this._renderManagerService.getRenderById(o)) == null ? void 0 : M.with(me).getWorksheetSkeleton(c);
  3103. if (!a)
  3104. return;
  3105. const { componentKey: l, data: h, allowTransform: u2 = true } = n, m = r != null ? r : qt(), { position: p } = this._createRangePositionObserver(e, g, a.skeleton), f2 = this._getPosition(p, o);
  3106. if (f2 == null)
  3107. return;
  3108. this._ensureMap(o, c).set(m, n);
  3109. const I = p.endX - p.startX, S = p.endY - p.startY, R = (x = t.width) != null ? x : I, v = (U = t.height) != null ? U : S, C = p.startX + je(t.marginX, I), _3 = p.startY + je(t.marginY, S), y = {
  3110. unitId: o,
  3111. subUnitId: c,
  3112. drawingId: m,
  3113. drawingType: n.type || gm.DRAWING_DOM,
  3114. componentKey: l,
  3115. sheetTransform: f2,
  3116. transform: {
  3117. left: C,
  3118. top: _3,
  3119. width: R,
  3120. height: v
  3121. },
  3122. data: h,
  3123. allowTransform: u2
  3124. };
  3125. {
  3126. const { unitId: A, subUnitId: j2, drawingId: B } = y, X = N(this._univerInstanceService, { unitId: A, subUnitId: j2 }), se = y, oe2 = this._univerInstanceService.getUnit(A, Fe.UNIVER_SHEET);
  3127. if (!oe2)
  3128. return;
  3129. const Se = oe2.getActiveSheet().getSheetId();
  3130. if (!se || !X)
  3131. return;
  3132. const ge = (D = this._renderManagerService.getRenderById(A)) == null ? void 0 : D.with(me).getWorksheetSkeleton(j2);
  3133. if (!ge)
  3134. return;
  3135. const { transform: ce, drawingType: $, data: de } = se;
  3136. if ($ !== gm.DRAWING_DOM && $ !== gm.DRAWING_CHART)
  3137. return;
  3138. const Ue = this._getSceneAndTransformerByDrawingSearch(A);
  3139. if (Ue == null)
  3140. return;
  3141. const { scene: le, canvas: ue2 } = Ue;
  3142. if (ce == null || Se !== j2)
  3143. return;
  3144. const { left: Ie, top: ke, width: Le2, height: Fe2, angle: nt3, flipX: xt, flipY: Bt, skewX: $t2, skewY: kt2 } = ce, rt3 = bn({ unitId: A, subUnitId: j2, drawingId: B }), Ge = le.getObject(rt3);
  3145. if (Ge != null) {
  3146. Ge.transformByState({ left: Ie, top: ke, width: Le2, height: Fe2, angle: nt3, flipX: xt, flipY: Bt, skewX: $t2, skewY: kt2 });
  3147. return;
  3148. }
  3149. const re2 = {
  3150. left: Ie,
  3151. top: ke,
  3152. width: Le2,
  3153. height: Fe2,
  3154. zIndex: this._drawingManagerService.getDrawingOrder(A, j2).length - 1
  3155. }, it2 = $ === gm.DRAWING_CHART;
  3156. if (it2) {
  3157. const W = de ? de.backgroundColor : "white";
  3158. re2.fill = W, re2.rotateEnabled = false, de && de.border && (re2.stroke = de.border), re2.paintFirst = "stroke", re2.strokeWidth = 1, re2.borderEnabled = false, re2.radius = 8;
  3159. }
  3160. const K = new A1(rt3, re2);
  3161. it2 && K.setObjectType(b3.CHART), le.addObject(K, aS), se.allowTransform !== false && le.attachTransformerTo(K);
  3162. const Ce = this._ensureMap(A, j2), Re = new Mi(), me2 = le.getMainViewport(), Lt = {
  3163. top: me2.top,
  3164. left: me2.left,
  3165. bottom: me2.bottom,
  3166. right: me2.right
  3167. }, he = {
  3168. dispose: Re,
  3169. rect: K,
  3170. boundsOfViewArea: Lt,
  3171. // position$,
  3172. unitId: A,
  3173. subUnitId: j2
  3174. }, Ft = Te2(K, Ue.renderUnit, ge.skeleton, X.worksheet, he), be = new BehaviorSubject(Ft);
  3175. he.position$ = be;
  3176. let De2 = {
  3177. position$: be,
  3178. id: B,
  3179. componentKey: se.componentKey,
  3180. onPointerDown: () => {
  3181. },
  3182. onPointerMove: () => {
  3183. },
  3184. onPointerUp: () => {
  3185. },
  3186. onWheel: (W) => {
  3187. ue2.dispatchEvent(new WheelEvent(W.type, W));
  3188. },
  3189. props: (P = (b = Ce.get(B)) == null ? void 0 : b.props) != null ? P : this._getFloatDomProps(B),
  3190. data: de,
  3191. unitId: A
  3192. };
  3193. n.eventPassThrough && (De2 = {
  3194. ...De2,
  3195. onPointerDown: (W) => {
  3196. ue2.dispatchEvent(new PointerEvent(W.type, W));
  3197. },
  3198. onPointerMove: (W) => {
  3199. ue2.dispatchEvent(new PointerEvent(W.type, W));
  3200. },
  3201. onPointerUp: (W) => {
  3202. ue2.dispatchEvent(new PointerEvent(W.type, W));
  3203. }
  3204. }), this._canvasFloatDomService.addFloatDom(De2);
  3205. const Ve2 = K.onTransformChange$.subscribeEvent(() => {
  3206. const W = Te2(K, Ue.renderUnit, ge.skeleton, X.worksheet, he);
  3207. be.next(
  3208. W
  3209. );
  3210. });
  3211. Re.add(() => {
  3212. this._canvasFloatDomService.removeFloatDom(B);
  3213. }), Ve2 && Re.add(Ve2), this._domLayerInfoMap.set(B, he), Ce.set(B, {
  3214. ...Ce.get(B)
  3215. });
  3216. }
  3217. return {
  3218. id: m,
  3219. dispose: () => {
  3220. this._removeDom(m, true);
  3221. }
  3222. };
  3223. }
  3224. addFloatDomToColumnHeader(e, n, t, r) {
  3225. var x, U, D, b, P, A;
  3226. const s = N(this._univerInstanceService, {
  3227. unitId: n.unitId,
  3228. subUnitId: n.subUnitId
  3229. });
  3230. if (!s)
  3231. throw new Error("cannot find current target!");
  3232. const { unitId: o, subUnitId: c } = s;
  3233. if (!this._getSceneAndTransformerByDrawingSearch(o))
  3234. return;
  3235. const g = this._renderManagerService.getRenderById(o);
  3236. if (!g)
  3237. return;
  3238. const a = (x = this._renderManagerService.getRenderById(o)) == null ? void 0 : x.with(me).getWorksheetSkeleton(c);
  3239. if (!a)
  3240. return;
  3241. const { componentKey: l, data: h, allowTransform: u2 = true } = n, m = r != null ? r : qt(), { position: p } = this._createRangePositionObserver({
  3242. startRow: 0,
  3243. endRow: 0,
  3244. startColumn: e,
  3245. endColumn: e
  3246. }, g, a.skeleton), f2 = p;
  3247. f2.startY = 0;
  3248. const w = this._getPosition(p, o);
  3249. if (w == null)
  3250. return;
  3251. this._ensureMap(o, c).set(m, n);
  3252. const S = p.endX - p.startX, R = p.endY - p.startY, v = (U = t.width) != null ? U : S, C = (D = t.height) != null ? D : R;
  3253. let _3 = 0, y = 0;
  3254. if (t.horizonOffsetAlign === "right") {
  3255. const j2 = je(t.marginX, S);
  3256. _3 = f2.endX - j2 - v;
  3257. } else
  3258. _3 = f2.startX + je(t.marginX, S);
  3259. if (t.verticalOffsetAlign === "bottom") {
  3260. const j2 = je(t.marginY, R);
  3261. y = f2.endY - j2 - C;
  3262. } else
  3263. y = f2.startY + je(t.marginY, R);
  3264. const M = {
  3265. unitId: o,
  3266. subUnitId: c,
  3267. drawingId: m,
  3268. drawingType: n.type || gm.DRAWING_DOM,
  3269. componentKey: l,
  3270. sheetTransform: w,
  3271. transform: {
  3272. left: _3,
  3273. top: y,
  3274. width: v,
  3275. height: C
  3276. },
  3277. data: h,
  3278. allowTransform: u2
  3279. };
  3280. {
  3281. const { unitId: j2, subUnitId: B, drawingId: X } = M, se = N(this._univerInstanceService, { unitId: j2, subUnitId: B }), oe2 = M, Se = this._univerInstanceService.getUnit(j2, Fe.UNIVER_SHEET);
  3282. if (!Se)
  3283. return;
  3284. const ge = Se.getActiveSheet().getSheetId();
  3285. if (!oe2 || !se)
  3286. return;
  3287. const ce = (b = this._renderManagerService.getRenderById(j2)) == null ? void 0 : b.with(me).getWorksheetSkeleton(B);
  3288. if (!ce)
  3289. return;
  3290. const { transform: $, drawingType: de, data: Ue } = oe2;
  3291. if (de !== gm.DRAWING_DOM && de !== gm.DRAWING_CHART)
  3292. return;
  3293. const le = this._getSceneAndTransformerByDrawingSearch(j2);
  3294. if (le == null)
  3295. return;
  3296. const { scene: ue2, canvas: Ie } = le;
  3297. if ($ == null || ge !== B)
  3298. return;
  3299. const { left: ke, top: Le2, width: Fe2, height: nt3, angle: xt, flipX: Bt, flipY: $t2, skewX: kt2, skewY: rt3 } = $, Ge = bn({ unitId: j2, subUnitId: B, drawingId: X }), re2 = ue2.getObject(Ge);
  3300. if (re2 != null) {
  3301. re2.transformByState({ left: ke, top: Le2, width: Fe2, height: nt3, angle: xt, flipX: Bt, flipY: $t2, skewX: kt2, skewY: rt3 });
  3302. return;
  3303. }
  3304. const it2 = {
  3305. left: ke,
  3306. top: Le2,
  3307. width: Fe2,
  3308. height: nt3,
  3309. zIndex: this._drawingManagerService.getDrawingOrder(j2, B).length - 1
  3310. }, K = new A1(Ge, it2);
  3311. ue2.addObject(K, aS), oe2.allowTransform !== false && ue2.attachTransformerTo(K);
  3312. const Ce = this._ensureMap(j2, B), Re = new Mi(), me2 = ue2.getMainViewport(), Lt = {
  3313. top: 0,
  3314. //viewMain.top,
  3315. left: me2.left,
  3316. bottom: me2.bottom,
  3317. right: me2.right
  3318. }, he = {
  3319. dispose: Re,
  3320. rect: K,
  3321. // position$,
  3322. unitId: j2,
  3323. subUnitId: B,
  3324. boundsOfViewArea: Lt,
  3325. scrollDirectionResponse: "HORIZONTAL"
  3326. /* HORIZONTAL */
  3327. }, Ft = Te2(K, le.renderUnit, ce.skeleton, se.worksheet, he), be = new BehaviorSubject(Ft);
  3328. he.position$ = be;
  3329. let De2 = {
  3330. position$: be,
  3331. id: X,
  3332. componentKey: oe2.componentKey,
  3333. onPointerDown: () => {
  3334. },
  3335. onPointerMove: () => {
  3336. },
  3337. onPointerUp: () => {
  3338. },
  3339. onWheel: (W) => {
  3340. Ie.dispatchEvent(new WheelEvent(W.type, W));
  3341. },
  3342. props: (A = (P = Ce.get(X)) == null ? void 0 : P.props) != null ? A : this._getFloatDomProps(X),
  3343. data: Ue,
  3344. unitId: j2
  3345. };
  3346. n.eventPassThrough && (De2 = {
  3347. ...De2,
  3348. onPointerDown: (W) => {
  3349. Ie.dispatchEvent(new PointerEvent(W.type, W));
  3350. },
  3351. onPointerMove: (W) => {
  3352. Ie.dispatchEvent(new PointerEvent(W.type, W));
  3353. },
  3354. onPointerUp: (W) => {
  3355. Ie.dispatchEvent(new PointerEvent(W.type, W));
  3356. }
  3357. }), this._canvasFloatDomService.addFloatDom(De2);
  3358. const Ve2 = K.onTransformChange$.subscribeEvent(() => {
  3359. const W = Te2(K, le.renderUnit, ce.skeleton, se.worksheet, he);
  3360. be.next(
  3361. W
  3362. );
  3363. });
  3364. Re.add(() => {
  3365. this._canvasFloatDomService.removeFloatDom(X);
  3366. }), Ve2 && Re.add(Ve2), this._domLayerInfoMap.set(X, he), Ce.set(X, {
  3367. ...Ce.get(X)
  3368. });
  3369. }
  3370. return {
  3371. id: m,
  3372. dispose: () => {
  3373. this._removeDom(m, true);
  3374. }
  3375. };
  3376. }
  3377. /**
  3378. * Unlike _createCellPositionObserver, this accept a range not a single cell.
  3379. *
  3380. * @param initialRow
  3381. * @param initialCol
  3382. * @param currentRender
  3383. * @param skeleton
  3384. * @param activeViewport
  3385. * @returns position of cell to canvas.
  3386. */
  3387. _createRangePositionObserver(e, n, t) {
  3388. let { startRow: r, startColumn: s } = e;
  3389. const o = Ke2(r, s, t), c = new BehaviorSubject(o), d = Ke2(e.endRow, e.endColumn, t), g = new BehaviorSubject(d), a = () => {
  3390. const f2 = Ke2(r, s, t), w = Ke2(e.endRow, e.endColumn, t);
  3391. c.next(f2), g.next(w);
  3392. }, l = new Mi();
  3393. l.add(n.engine.clientRect$.subscribe(() => a())), l.add(this._commandService.onCommandExecuted((f2) => {
  3394. if (f2.id === Br.id && f2.params.rowsAutoHeightInfo.findIndex((I) => I.row === r) > -1) {
  3395. a();
  3396. return;
  3397. }
  3398. (gh.indexOf(f2.id) > -1 || f2.id === dn.id || f2.id === $t.id) && a();
  3399. }));
  3400. const h = (f2, w) => {
  3401. r = f2, s = w, a();
  3402. }, u2 = () => ({
  3403. rotate: 0,
  3404. width: d.right - o.left,
  3405. height: d.bottom - o.top,
  3406. absolute: {
  3407. left: true,
  3408. top: true
  3409. },
  3410. startX: o.left,
  3411. startY: o.top,
  3412. endX: d.right,
  3413. endY: d.bottom
  3414. }), m = c.pipe(
  3415. map((f2) => {
  3416. const w = Ke2(e.endRow, e.endColumn, t);
  3417. return console.log("service", f2.left, f2.top), {
  3418. rotate: 0,
  3419. width: w.right - f2.left,
  3420. height: w.bottom - f2.top,
  3421. absolute: {
  3422. left: true,
  3423. top: true
  3424. },
  3425. startX: f2.left,
  3426. startY: f2.top,
  3427. endX: w.right,
  3428. endY: w.bottom
  3429. };
  3430. })
  3431. ), p = u2();
  3432. return console.log("init position", p), {
  3433. position$: m,
  3434. position: p,
  3435. updateRowCol: h,
  3436. topLeftPos$: c,
  3437. rightBottomPos$: g,
  3438. disposable: l
  3439. };
  3440. }
  3441. };
  3442. Tt2 = vo([
  3443. Oe2(0, ot(Yx)),
  3444. Oe2(1, _n),
  3445. Oe2(2, ot(Pt)),
  3446. Oe2(3, Ut),
  3447. Oe2(4, ot(l3)),
  3448. Oe2(5, u),
  3449. Oe2(6, ot(Ht))
  3450. ], Tt2);
  3451. function Ke2(i, e, n) {
  3452. const t = n.getCellWithCoordByIndex(i, e), r = t.isMergedMainCell ? t.mergeInfo : t;
  3453. return {
  3454. left: r.startX,
  3455. right: r.endX,
  3456. top: r.startY,
  3457. bottom: r.endY
  3458. };
  3459. }
  3460. function je(i, e) {
  3461. if (i === void 0)
  3462. return 0;
  3463. if (typeof i == "number")
  3464. return i;
  3465. const n = Number.parseFloat(i);
  3466. return e * n / 100;
  3467. }
  3468. var wr = Object.defineProperty;
  3469. var Io = Object.getOwnPropertyDescriptor;
  3470. var Co = (i, e, n) => e in i ? wr(i, e, { enumerable: true, configurable: true, writable: true, value: n }) : i[e] = n;
  3471. var Ro = (i, e, n, t) => {
  3472. for (var r = t > 1 ? void 0 : t ? Io(e, n) : e, s = i.length - 1, o; s >= 0; s--)
  3473. (o = i[s]) && (r = (t ? o(e, n, r) : o(r)) || r);
  3474. return t && r && wr(e, n, r), r;
  3475. };
  3476. var Zt3 = (i, e) => (n, t) => e(n, t, i);
  3477. var _r = (i, e, n) => Co(i, typeof e != "symbol" ? e + "" : e, n);
  3478. var bo = "SHEET_IMAGE_UI_PLUGIN";
  3479. var Et = class extends Ra {
  3480. constructor(i = Cn, e, n, t) {
  3481. super(), this._config = i, this._injector = e, this._renderManagerService = n, this._configService = t;
  3482. const { menu: r, ...s } = nu(
  3483. {},
  3484. Cn,
  3485. this._config
  3486. );
  3487. r && this._configService.setConfig("menu", r, { merge: true }), this._configService.setConfig(Hi, s);
  3488. }
  3489. onStarting() {
  3490. K0(this._injector, [
  3491. [Tt2],
  3492. [Ot2],
  3493. [It],
  3494. [yt],
  3495. [Mt],
  3496. [Dt],
  3497. [Ct],
  3498. [bt],
  3499. [Rt]
  3500. ]), Mf(this._injector, [
  3501. [Tt2]
  3502. ]);
  3503. }
  3504. onReady() {
  3505. Mf(this._injector, [
  3506. [Dt]
  3507. ]);
  3508. }
  3509. onRendered() {
  3510. this._registerRenderModules(), Mf(this._injector, [
  3511. [Mt],
  3512. [yt],
  3513. [Ot2],
  3514. [Ct],
  3515. [bt],
  3516. [Rt]
  3517. ]);
  3518. }
  3519. onSteady() {
  3520. this._injector.get(It);
  3521. }
  3522. _registerRenderModules() {
  3523. [
  3524. [Ze2],
  3525. [sn2],
  3526. [nn]
  3527. ].forEach((i) => {
  3528. this.disposeWithMe(this._renderManagerService.registerRenderModule(Fe.UNIVER_SHEET, i));
  3529. });
  3530. }
  3531. };
  3532. _r(Et, "type", Fe.UNIVER_SHEET);
  3533. _r(Et, "pluginName", bo);
  3534. Et = Ro([
  3535. OR(At, f, cn2, _2),
  3536. Zt3(1, ot(Ot)),
  3537. Zt3(2, Yx),
  3538. Zt3(3, SE)
  3539. ], Et);
  3540. export {
  3541. F3 as ClearSheetDrawingTransformerOperation,
  3542. gr2 as DeleteDrawingsCommand,
  3543. sr as EditSheetDrawingOperation,
  3544. or as GroupSheetDrawingCommand,
  3545. cn3 as InsertFloatImageCommand,
  3546. jt as InsertSheetDrawingCommand,
  3547. et2 as MoveDrawingsCommand,
  3548. Nt as RemoveSheetDrawingCommand,
  3549. fr as SHEETS_IMAGE_MENU_ID,
  3550. ar2 as SetDrawingArrangeCommand,
  3551. Wt as SetSheetDrawingCommand,
  3552. Tt2 as SheetCanvasFloatDomManagerService,
  3553. ir as SidebarSheetDrawingOperation,
  3554. cr as UngroupSheetDrawingCommand,
  3555. Et as UniverSheetsDrawingUIPlugin
  3556. };
  3557. /*! Bundled license information:
  3558. @univerjs/sheets-drawing-ui/lib/es/index.js:
  3559. (**
  3560. * @license React
  3561. * react-jsx-runtime.production.min.js
  3562. *
  3563. * Copyright (c) Facebook, Inc. and its affiliates.
  3564. *
  3565. * This source code is licensed under the MIT license found in the
  3566. * LICENSE file in the root directory of this source tree.
  3567. *)
  3568. */
  3569. //# sourceMappingURL=@univerjs_sheets-drawing-ui.js.map