univer-cli 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x16bd54=_0x3d8e;(function(_0x493ef8,_0x35ad08){const _0xc338e6=_0x3d8e,_0x576201=_0x493ef8();while(!![]){try{const _0x31db97=-parseInt(_0xc338e6(0xe3))/0x1+-parseInt(_0xc338e6(0xd6))/0x2+-parseInt(_0xc338e6(0x89))/0x3+parseInt(_0xc338e6(0xc8))/0x4+parseInt(_0xc338e6(0x99))/0x5+-parseInt(_0xc338e6(0xd8))/0x6+parseInt(_0xc338e6(0x81))/0x7;if(_0x31db97===_0x35ad08)break;else _0x576201['push'](_0x576201['shift']());}catch(_0x1b69cb){_0x576201['push'](_0x576201['shift']());}}}(_0x48fb,0x3bf31));import'../chunks/vendor-DHdfSSPw.js';import{a as _0x21d3fe,i as _0xfa3d09,n,o as _0x297950,r as _0x360543,t as _0x56d3ea}from'../chunks/trace-DPfd8LdJ.js';import{c as _0x268a72,f as _0xae3ea7,l as _0x1787b9,r as _0x34b881,s as _0x4fe062,t as _0x9d579f}from'../chunks/node-DzdmhTvA.js';import{t as _0x2888e9}from'../chunks/build-id-Coc3wh1M.js';import{n as _0x568989}from'../chunks/runtime-manifest-Bdf66z_K.js';import{existsSync as _0x781da2}from'node:fs';import{chmod as _0x36612c,mkdir as _0x3882f1,readFile as _0x583151,rm as _0x551a38,writeFile as _0x4bafc5}from'node:fs/promises';import _0x2ff25e from'node:net';function _0x48fb(){const _0x40b33b=['DaemonStart','DaemonRpcError','sizeBytes','listen','resolveIdentity','242925cKwCeg','getWorkbookSession','logRequestError','SessionExportWorkbookFile','SessionEvalJs','createdAt','Method\x20not\x20found:\x20','workbookData','session','destroyAll','rpc-shutdown','getSession','DaemonRpcStart','getSessionCount','utf8','close','28655hUcfSA','info','evalJs','DaemonRpcFinish','loadWorkbookDataReplayPack','event','loadWorkbook','toString','min','value','method','packageIdentity','withContext','getSessionIdleTtlMs','Health','loadWorkbookData','code','metaPath','sessionId','UNIVER_CLI_VERSION','DaemonRpcServer','stringify','SessionGetWorkbook','logRequestEvent','toISOString','SessionLoadWorkbook','indexOf','length','trim','Daemon\x20handler\x20not\x20ready:\x20','catch','eventName','DaemonStop','Runtime','finally','socketPath','exportWorkbookFile','unloadIdleSessions','now','timestamp','current','SIGINT','sessionHost','max','modulePath','runtimeExecutionPlaneEntry','homeDir','1094356fkOkwl','exportWorkbookData','absolutePath','sigint','connect','serve','local','dispose','format','mutations','baseWorkbookData','Daemon','sessionRoot','flush','726722CZPAQF','outputPath','1110546WQvXMS','unref','parse','meta','2.0','cwd','sigterm','withSpan','createServer','buildId','message','63413EkdiDZ','exit','createWorkbook','UNIVER_CLI_BUILD_ID','slice','Unknown\x20daemon\x20subcommand:\x20','name','env','error','durationMs','Shutdown','mutates','once','pid','isFinite','SessionExportWorkbookData','execArgv','SessionLoadWorkbookDataReplayPack','lockPath','traceparent','4613511qJGCPP','params','createConnection'];_0x48fb=function(){return _0x40b33b;};return _0x48fb();}import _0x18d7ce from'node:process';var S=new _0x9d579f();async function C(_0x3a966e={}){const _0x2d16f3=_0x3d8e;let _0x5ad1d3=_0x3a966e[_0x2d16f3(0x74)]??_0x18d7ce[_0x2d16f3(0x74)],_0x4ef7b8=_0x268a72(_0x5ad1d3),_0x6a0368=_0x568989(_0x5ad1d3),_0x4c65a7=_0x3a966e[_0x2d16f3(0xc3)]??E(new _0x34b881({'env':_0x5ad1d3,'logger':_0x1787b9({'env':_0x5ad1d3,'role':_0x21d3fe[_0x2d16f3(0xba)]}),'resolveExecutionPlaneOptions':()=>({'execArgv':[..._0x6a0368['runtimeExecutionPlaneEntry'][_0x2d16f3(0x7d)]],'modulePath':_0x6a0368[_0x2d16f3(0xc6)][_0x2d16f3(0xc5)]})})),_0x497076=_0x2888e9(_0x5ad1d3),_0x3afbdf=new Date()['toISOString']();if(await _0x3882f1(_0x4ef7b8['daemonDir'],{'recursive':!0x0,'mode':0x1c0}),await _0x3882f1(_0x4ef7b8[_0x2d16f3(0xd4)],{'recursive':!0x0,'mode':0x1c0}),!await M(_0x4ef7b8[_0x2d16f3(0x7f)],_0x4ef7b8['pidPath'])){if(await N(_0x4ef7b8[_0x2d16f3(0xbc)]))return;throw Error('Another\x20daemon\x20startup\x20owns\x20'+_0x4ef7b8[_0x2d16f3(0x7f)]);}await j(_0x4ef7b8);let _0x392d14=_0x1787b9({'env':_0x5ad1d3,'role':_0x21d3fe[_0x2d16f3(0xd3)]}),_0x288761=k({'buildId':_0x497076,'env':_0x5ad1d3,'pid':_0x18d7ce[_0x2d16f3(0x7a)]}),_0x4e678f=!0x1,_0x312b47={},_0x534ffd=async _0x28d489=>z(null,-0x7f5b,Error(_0x2d16f3(0xb6)+_0x28d489)),_0x38c980=_0x2ff25e[_0x2d16f3(0xe0)](_0x3ac168=>{let _0x3c70f3='';_0x3ac168['on']('data',_0x32ee2a=>{const _0xbea537=_0x3d8e;_0x3c70f3+=_0x32ee2a[_0xbea537(0xa0)]('utf8'),_0x5d9fe1();}),_0x3ac168['on']('error',()=>void 0x0);let _0x5d9fe1=async()=>{const _0x364c65=_0x3d8e;for(;;){let _0x22eef1=_0x3c70f3[_0x364c65(0xb3)]('\x0a');if(_0x22eef1<0x0)return;let _0x3d54a4=_0x3c70f3[_0x364c65(0xe7)](0x0,_0x22eef1)[_0x364c65(0xb5)]();if(_0x3c70f3=_0x3c70f3['slice'](_0x22eef1+0x1),!_0x3d54a4)continue;let _0x2e3977=await _0x534ffd(_0x3d54a4);_0x3ac168['write'](JSON[_0x364c65(0xae)](_0x2e3977)+'\x0a');}};});_0x534ffd=w({'buildId':_0x497076,'logRequestEvent':async _0x3e3d79=>{const _0x1c8e5d=_0x2d16f3;_0x392d14[_0x1c8e5d(0x9e)]({'level':_0x3e3d79[_0x1c8e5d(0xb8)]===_0xfa3d09[_0x1c8e5d(0x85)]?_0x1c8e5d(0x75):_0x1c8e5d(0x9a),'event_name':_0x3e3d79[_0x1c8e5d(0xb8)],'component':_0x360543[_0x1c8e5d(0xd3)],'process_role':_0x21d3fe[_0x1c8e5d(0xd3)],..._0x3e3d79[_0x1c8e5d(0x75)]===void 0x0?{}:{'error':_0x3e3d79[_0x1c8e5d(0x75)]},'fields':{..._0x288761,..._0x3e3d79['durationMs']===void 0x0?{}:{'duration_ms':_0x3e3d79[_0x1c8e5d(0x76)]},'method':_0x3e3d79[_0x1c8e5d(0xa3)],'timestamp':_0x3e3d79[_0x1c8e5d(0xc0)]}});},'logRequestError':async _0x438249=>{const _0x49196e=_0x2d16f3;_0x392d14['error']({'event_name':_0xfa3d09[_0x49196e(0x85)],'component':_0x360543['Daemon'],'process_role':_0x21d3fe[_0x49196e(0xd3)],'error':_0x438249[_0x49196e(0x75)],'fields':{..._0x288761,'method':_0x438249[_0x49196e(0xa3)],'timestamp':_0x438249[_0x49196e(0xc0)]}});},'onShutdownRequest':()=>{const _0x1a7f17=_0x2d16f3;_0x16dd46(_0x1a7f17(0x93))[_0x1a7f17(0xbb)](()=>{const _0x2abf8b=_0x1a7f17;_0x18d7ce[_0x2abf8b(0xe4)](0x0);});},'pid':_0x18d7ce['pid'],'runtimeRoot':_0x4ef7b8[_0x2d16f3(0xc7)],'sessionHost':_0x4c65a7,'socketPath':_0x4ef7b8[_0x2d16f3(0xbc)],'startedAt':_0x3afbdf}),await new Promise((_0x3bacc8,_0x17257d)=>{const _0x59a60a=_0x2d16f3;_0x38c980['once'](_0x59a60a(0x75),_0x17257d),_0x38c980[_0x59a60a(0x87)](_0x4ef7b8[_0x59a60a(0xbc)],_0x3bacc8);}),_0x4fe062(_0x4ef7b8['socketPath'])||await _0x36612c(_0x4ef7b8[_0x2d16f3(0xbc)],0x180);let _0x5a4b03={'pid':_0x18d7ce[_0x2d16f3(0x7a)],'startedAt':_0x3afbdf,'socketPath':_0x4ef7b8[_0x2d16f3(0xbc)],'runtimeRoot':_0x4ef7b8[_0x2d16f3(0xc7)],'buildId':_0x497076};await _0x4bafc5(_0x4ef7b8['pidPath'],String(_0x18d7ce['pid']),_0x2d16f3(0x97)),await _0x4bafc5(_0x4ef7b8[_0x2d16f3(0xaa)],JSON[_0x2d16f3(0xae)](_0x5a4b03,null,0x2),'utf8'),_0x392d14[_0x2d16f3(0x9a)]({'event_name':_0xfa3d09[_0x2d16f3(0x84)],'component':_0x360543[_0x2d16f3(0xd3)],'process_role':_0x21d3fe[_0x2d16f3(0xd3)],'fields':{..._0x288761,'pid':_0x18d7ce[_0x2d16f3(0x7a)],'runtime_root':_0x4ef7b8[_0x2d16f3(0xc7)],'socket_path':_0x4ef7b8[_0x2d16f3(0xbc)],'started_at':_0x3afbdf}}),await _0x392d14[_0x2d16f3(0xd5)]();let _0x3ee591=setInterval(()=>{const _0x107da2=_0x2d16f3;_0x4c65a7[_0x107da2(0xbe)]();},Math[_0x2d16f3(0xc4)](0x3e8,Math[_0x2d16f3(0xa1)](_0x4c65a7['getSessionIdleTtlMs'](),0xea60)));_0x3ee591[_0x2d16f3(0xd9)](),_0x312b47[_0x2d16f3(0xc1)]=_0x3ee591;async function _0x16dd46(_0x207b64){const _0x2ca544=_0x2d16f3;_0x4e678f||(_0x4e678f=!0x0,_0x312b47[_0x2ca544(0xc1)]!==void 0x0&&clearInterval(_0x312b47[_0x2ca544(0xc1)]),_0x392d14[_0x2ca544(0x9a)]({'event_name':_0xfa3d09[_0x2ca544(0xb9)],'component':_0x360543[_0x2ca544(0xd3)],'process_role':_0x21d3fe[_0x2ca544(0xd3)],'fields':{..._0x288761,'pid':_0x18d7ce['pid'],'reason':_0x207b64,'timestamp':new Date()[_0x2ca544(0xb1)]()}}),await _0x392d14[_0x2ca544(0xd5)](),await _0x4c65a7[_0x2ca544(0x92)](_0x207b64),await new Promise(_0x244a7f=>{const _0x5b38c8=_0x2ca544;_0x38c980[_0x5b38c8(0x98)](()=>_0x244a7f());}),await F(_0x4ef7b8['socketPath']),await _0x551a38(_0x4ef7b8['pidPath'],{'force':!0x0})[_0x2ca544(0xb7)](()=>void 0x0),await _0x551a38(_0x4ef7b8['metaPath'],{'force':!0x0})[_0x2ca544(0xb7)](()=>void 0x0),await _0x551a38(_0x4ef7b8[_0x2ca544(0x7f)],{'recursive':!0x0,'force':!0x0})[_0x2ca544(0xb7)](()=>void 0x0));}_0x18d7ce['on'](_0x2d16f3(0xc2),()=>{const _0x2b3f9c=_0x2d16f3;_0x16dd46(_0x2b3f9c(0xcb))[_0x2b3f9c(0xbb)](()=>{const _0x1d0891=_0x2b3f9c;_0x18d7ce[_0x1d0891(0xe4)](0x0);});}),_0x18d7ce['on']('SIGTERM',()=>{const _0x143d20=_0x2d16f3;_0x16dd46(_0x143d20(0xde))[_0x143d20(0xbb)](()=>{const _0x3ab30d=_0x143d20;_0x18d7ce[_0x3ab30d(0xe4)](0x0);});});}function w(_0x16cf15){return async _0x487354=>{const _0x5722b=_0x3d8e;let _0x1aa5e6;try{_0x1aa5e6=JSON[_0x5722b(0xda)](_0x487354);}catch(_0x712120){return z(null,-0x7fbc,_0x712120);}let _0x578d47=_0x56d3ea(_0x1aa5e6[_0x5722b(0xdb)]?.[_0x5722b(0x80)]),_0x2a89bd=async()=>await n[_0x5722b(0xdf)]({'name':_0x297950[_0x5722b(0xad)],'kind':'server'},async()=>{const _0x81ac45=_0x5722b;let _0x56ac76=Date['now']();await _0x16cf15['logRequestEvent']?.({'eventName':_0xfa3d09[_0x81ac45(0x95)],'method':_0x1aa5e6[_0x81ac45(0xa3)],'timestamp':new Date()[_0x81ac45(0xb1)]()});try{let _0x4d9b41=await T(_0x1aa5e6,_0x16cf15);return await _0x16cf15[_0x81ac45(0xb0)]?.({'durationMs':Date['now']()-_0x56ac76,'eventName':_0xfa3d09[_0x81ac45(0x9c)],'method':_0x1aa5e6['method'],'timestamp':new Date()[_0x81ac45(0xb1)]()}),_0x4d9b41;}catch(_0x4a8e49){return await _0x16cf15[_0x81ac45(0xb0)]?.({'durationMs':Date[_0x81ac45(0xbf)]()-_0x56ac76,'eventName':_0xfa3d09[_0x81ac45(0x85)],'method':_0x1aa5e6[_0x81ac45(0xa3)],'error':_0x4a8e49,'timestamp':new Date()[_0x81ac45(0xb1)]()}),_0x16cf15[_0x81ac45(0xb0)]===void 0x0&&await _0x16cf15[_0x81ac45(0x8b)]?.({'method':_0x1aa5e6[_0x81ac45(0xa3)],'error':_0x4a8e49 instanceof Error?_0x4a8e49[_0x81ac45(0xe2)]:String(_0x4a8e49),'timestamp':new Date()[_0x81ac45(0xb1)]()}),z(_0x1aa5e6['id'],-0x7f5b,_0x4a8e49);}});return _0x578d47===void 0x0?await _0x2a89bd():await n[_0x5722b(0xa5)](_0x578d47,_0x2a89bd);};}async function T(_0x6e039b,_0x2eca3f){const _0x3a597b=_0x3d8e;switch(_0x6e039b['method']){case _0xae3ea7[_0x3a597b(0xa7)]:return{'jsonrpc':_0x3a597b(0xdc),'id':_0x6e039b['id'],'result':{'ok':!0x0,'pid':_0x2eca3f[_0x3a597b(0x7a)],'startedAt':_0x2eca3f['startedAt'],'socketPath':_0x2eca3f[_0x3a597b(0xbc)],'runtimeRoot':_0x2eca3f['runtimeRoot'],'buildId':_0x2eca3f[_0x3a597b(0xe1)],'sessionCount':_0x2eca3f[_0x3a597b(0xc3)]['getSessionCount']()}};case _0xae3ea7[_0x3a597b(0x77)]:return _0x2eca3f['onShutdownRequest']?.(),{'jsonrpc':_0x3a597b(0xdc),'id':_0x6e039b['id'],'result':{'stopping':!0x0}};case _0xae3ea7[_0x3a597b(0xb2)]:{let _0x25ab1e=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0x9f)](_0x6e039b[_0x3a597b(0x82)]);return R(_0x6e039b['id'],_0x25ab1e);}case _0xae3ea7[_0x3a597b(0x7e)]:{let _0x27f456=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0x9d)](_0x6e039b[_0x3a597b(0x82)]);return R(_0x6e039b['id'],_0x27f456);}case _0xae3ea7['SessionCreateWorkbook']:{let _0x1184db=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0xe5)](_0x6e039b['params']);return R(_0x6e039b['id'],_0x1184db);}case _0xae3ea7[_0x3a597b(0x8d)]:{let _0x11eaa8=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0x9b)](_0x6e039b['params']);return R(_0x6e039b['id'],_0x11eaa8);}case _0xae3ea7[_0x3a597b(0x8c)]:{let _0x5cd315=await _0x2eca3f['sessionHost']['exportWorkbookFile'](_0x6e039b[_0x3a597b(0x82)]);return R(_0x6e039b['id'],_0x5cd315);}case _0xae3ea7[_0x3a597b(0x7c)]:{let _0x52ca74=_0x6e039b['params'],_0x28bd3e=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0xc9)](_0x52ca74);return R(_0x6e039b['id'],_0x28bd3e);}case _0xae3ea7['SessionDispose']:{let _0xdfe5e9=await _0x2eca3f[_0x3a597b(0xc3)][_0x3a597b(0xcf)](_0x6e039b[_0x3a597b(0x82)]);return R(_0x6e039b['id'],_0xdfe5e9);}case _0xae3ea7[_0x3a597b(0xaf)]:{let _0x18c820=await _0x2eca3f['sessionHost'][_0x3a597b(0x8a)](_0x6e039b[_0x3a597b(0x82)]);return R(_0x6e039b['id'],_0x18c820);}default:return z(_0x6e039b['id'],-0x7f59,Error(_0x3a597b(0x8f)+_0x6e039b['method']));}}function E(_0x3b9a21){return{async 'createWorkbook'(_0x485ced){const _0x475057=_0x3d8e;let _0x3e52ab=await D(_0x485ced),_0x55bdf7=await _0x3b9a21['createWorkbook']({..._0x485ced['cwd']===void 0x0?{}:{'cwd':_0x485ced[_0x475057(0xdd)]},'identity':_0x3e52ab,..._0x485ced['id']===void 0x0?{}:{'workbookId':_0x485ced['id']},..._0x485ced[_0x475057(0x73)]===void 0x0?{}:{'workbookName':_0x485ced['name']}});return{'success':!0x0,'workbookData':_0x55bdf7[_0x475057(0x90)],'session':O(_0x55bdf7[_0x475057(0x91)])};},async 'dispose'(_0x304e27){const _0xf37f2=_0x3d8e;let _0x22165f=await D(_0x304e27);return await _0x3b9a21[_0xf37f2(0xcf)]({..._0x304e27[_0xf37f2(0xdd)]===void 0x0?{}:{'cwd':_0x304e27['cwd']},'identity':_0x22165f}),{'disposed':!0x0,'workbookIdentity':_0x22165f[_0xf37f2(0xca)]};},async 'destroyAll'(_0x4ecf24){const _0x5221bb=_0x3d8e;await _0x3b9a21[_0x5221bb(0x92)]?.(_0x4ecf24);},async 'evalJs'(_0x8afe20){const _0x183f5b=_0x3d8e;let _0x3ddac2=await D(_0x8afe20),_0xf11b47=await _0x3b9a21['evalJs']({'code':_0x8afe20[_0x183f5b(0xa9)],..._0x8afe20[_0x183f5b(0xdd)]===void 0x0?{}:{'cwd':_0x8afe20[_0x183f5b(0xdd)]},'identity':_0x3ddac2,..._0x8afe20[_0x183f5b(0x78)]===void 0x0?{}:{'mutates':_0x8afe20[_0x183f5b(0x78)]}});return{..._0xf11b47[_0x183f5b(0xd1)]===void 0x0?{}:{'mutations':_0xf11b47[_0x183f5b(0xd1)]},'success':!0x0,'value':_0xf11b47[_0x183f5b(0xa2)],'session':O(_0xf11b47[_0x183f5b(0x91)])};},async 'exportWorkbookData'(_0x444fec){const _0x1f86ab=_0x3d8e;let _0x42f882=await D(_0x444fec),_0xd02882=await _0x3b9a21[_0x1f86ab(0xc9)]({..._0x444fec['cwd']===void 0x0?{}:{'cwd':_0x444fec[_0x1f86ab(0xdd)]},'identity':_0x42f882});return{'success':!0x0,'workbookData':_0xd02882[_0x1f86ab(0x90)],'session':O(_0xd02882[_0x1f86ab(0x91)])};},async 'exportWorkbookFile'(_0x31096f){const _0x50eff8=_0x3d8e;let _0x5211e3=await D(_0x31096f),_0x3fd6de=await _0x3b9a21[_0x50eff8(0xbd)]({..._0x31096f[_0x50eff8(0xdd)]===void 0x0?{}:{'cwd':_0x31096f['cwd']},'format':_0x31096f[_0x50eff8(0xd0)],'identity':_0x5211e3,'outputPath':_0x31096f[_0x50eff8(0xd7)]});return{'success':!0x0,'format':_0x3fd6de[_0x50eff8(0xd0)],'outputPath':_0x3fd6de['outputPath'],'sizeBytes':_0x3fd6de[_0x50eff8(0x86)],'session':O(_0x3fd6de[_0x50eff8(0x91)])};},async 'getWorkbookSession'(_0x264ad7){const _0x236de4=_0x3d8e;let _0x3aa882=await D(_0x264ad7),_0x4fde14=await _0x3b9a21[_0x236de4(0x94)]({..._0x264ad7['cwd']===void 0x0?{}:{'cwd':_0x264ad7['cwd']},'identity':_0x3aa882});return{'exists':_0x4fde14!==null,'session':_0x4fde14===null?null:O(_0x4fde14)};},'getSessionCount'(){const _0x131f19=_0x3d8e;return _0x3b9a21[_0x131f19(0x96)]?.()??0x0;},'getSessionIdleTtlMs'(){const _0x3e9c40=_0x3d8e;return _0x3b9a21[_0x3e9c40(0xa6)]?.()??0xea60;},async 'loadWorkbook'(_0x25f8ef){const _0xa41ef3=_0x3d8e;let _0x37e243=await D(_0x25f8ef),_0x2b1829=await _0x3b9a21[_0xa41ef3(0xa8)]({..._0x25f8ef[_0xa41ef3(0xdd)]===void 0x0?{}:{'cwd':_0x25f8ef[_0xa41ef3(0xdd)]},'identity':_0x37e243,'workbookData':_0x25f8ef['workbookData']});return{'success':!0x0,'workbookData':_0x2b1829[_0xa41ef3(0x90)],'session':O(_0x2b1829[_0xa41ef3(0x91)])};},async 'loadWorkbookDataReplayPack'(_0x26abc5){const _0x269ef0=_0x3d8e;let _0x5c304b=await D(_0x26abc5),_0x36a316=await _0x3b9a21[_0x269ef0(0x9d)]({..._0x26abc5[_0x269ef0(0xdd)]===void 0x0?{}:{'cwd':_0x26abc5[_0x269ef0(0xdd)]},'identity':_0x5c304b,'replayPack':{'baseWorkbookData':_0x26abc5[_0x269ef0(0xd2)],'mutations':_0x26abc5[_0x269ef0(0xd1)]}});return{'success':!0x0,'workbookData':_0x36a316[_0x269ef0(0x90)],'session':O(_0x36a316[_0x269ef0(0x91)])};},async 'unloadIdleSessions'(){const _0x2d28eb=_0x3d8e;await _0x3b9a21[_0x2d28eb(0xbe)]?.();}};}async function D(_0x13f6e0){const _0x51f0dd=_0x3d8e;return await S[_0x51f0dd(0x88)](_0x13f6e0);}function O(_0x36cba7){const _0xa6656a=_0x3d8e;return{'createdAt':_0x36cba7[_0xa6656a(0x8e)]??'','lastAccessedAt':_0x36cba7['lastAccessedAt']??'','sessionId':_0x36cba7[_0xa6656a(0xab)],'workbookIdentity':_0x36cba7[_0xa6656a(0xa4)][_0xa6656a(0xca)]};}function k(_0x37095c){const _0x3f07db=_0x3d8e;return{'build.id':A(_0x37095c[_0x3f07db(0x74)],_0x3f07db(0xe6))??_0x37095c[_0x3f07db(0xe1)],'deployment.environment.name':_0x3f07db(0xce),'distribution.channel':A(_0x37095c[_0x3f07db(0x74)],'UNIVER_DISTRIBUTION_CHANNEL')??'unknown','service.instance.id':String(_0x37095c[_0x3f07db(0x7a)]),'service.name':'univer-daemon',...A(_0x37095c[_0x3f07db(0x74)],_0x3f07db(0xac))===void 0x0?{}:{'service.version':A(_0x37095c['env'],_0x3f07db(0xac))}};}function A(_0x15fff6,_0x366790){const _0x26ed70=_0x3d8e;let _0x4d6918=_0x15fff6[_0x366790]?.[_0x26ed70(0xb5)]();return _0x4d6918===void 0x0||_0x4d6918[_0x26ed70(0xb4)]===0x0?void 0x0:_0x4d6918;}async function j(_0x1269d1){const _0x5054b0=_0x3d8e;P(_0x1269d1[_0x5054b0(0xbc)])&&!await N(_0x1269d1['socketPath'])&&await F(_0x1269d1[_0x5054b0(0xbc)]);let _0x460c79=await I(_0x1269d1['pidPath']);_0x460c79!==null&&!L(_0x460c79)&&(await _0x551a38(_0x1269d1['pidPath'],{'force':!0x0})[_0x5054b0(0xb7)](()=>void 0x0),await _0x551a38(_0x1269d1[_0x5054b0(0xaa)],{'force':!0x0})[_0x5054b0(0xb7)](()=>void 0x0),await _0x551a38(_0x1269d1[_0x5054b0(0x7f)],{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0));}async function M(_0x9cf2c9,_0x10f5c9){const _0x3e6357=_0x3d8e;try{return await _0x3882f1(_0x9cf2c9,{'recursive':!0x1,'mode':0x1c0}),!0x0;}catch(_0xa50f34){if(_0xa50f34[_0x3e6357(0xa9)]!=='EEXIST')throw _0xa50f34;let _0x27fbe9=await I(_0x10f5c9);return _0x27fbe9!==null&&L(_0x27fbe9)?!0x1:(await _0x551a38(_0x9cf2c9,{'recursive':!0x0,'force':!0x0}),await _0x3882f1(_0x9cf2c9,{'recursive':!0x1,'mode':0x1c0}),!0x0);}}async function N(_0x484b03){return await new Promise(_0x3f3002=>{const _0x3ae0f1=_0x3d8e;let _0x33d25f=_0x2ff25e[_0x3ae0f1(0x83)](_0x484b03);_0x33d25f[_0x3ae0f1(0x79)](_0x3ae0f1(0xcc),()=>{_0x33d25f['end'](),_0x3f3002(!0x0);}),_0x33d25f[_0x3ae0f1(0x79)](_0x3ae0f1(0x75),()=>{_0x3f3002(!0x1);});});}function P(_0x44f4d3){return _0x4fe062(_0x44f4d3)?!0x1:_0x781da2(_0x44f4d3);}async function F(_0x1accbd){const _0x17085e=_0x3d8e;_0x4fe062(_0x1accbd)||await _0x551a38(_0x1accbd,{'force':!0x0})[_0x17085e(0xb7)](()=>void 0x0);}async function I(_0x3f6126){const _0xdc7483=_0x3d8e;try{let _0x43df69=await _0x583151(_0x3f6126,'utf8'),_0x13ee82=Number(_0x43df69[_0xdc7483(0xb5)]());return Number[_0xdc7483(0x7b)](_0x13ee82)?_0x13ee82:null;}catch{return null;}}function L(_0x5b7483){try{return _0x18d7ce['kill'](_0x5b7483,0x0),!0x0;}catch{return!0x1;}}function R(_0x175e9c,_0x296a74){const _0x4a34a5=_0x3d8e;return{'jsonrpc':_0x4a34a5(0xdc),'id':_0x175e9c,'result':_0x296a74};}function z(_0x138972,_0x685e57,_0x4e03a6){const _0x7b69f=_0x3d8e;return{'jsonrpc':_0x7b69f(0xdc),'id':_0x138972,'error':{'code':_0x685e57,'message':_0x4e03a6 instanceof Error?_0x4e03a6[_0x7b69f(0xe2)]:String(_0x4e03a6)}};}function _0x3d8e(_0x1db5da,_0x196ad0){_0x1db5da=_0x1db5da-0x72;const _0x48fb2d=_0x48fb();let _0x3d8ef9=_0x48fb2d[_0x1db5da];return _0x3d8ef9;}var B=process['argv'][0x2]??_0x16bd54(0xcd);B!==_0x16bd54(0xcd)&&(console[_0x16bd54(0x75)](_0x16bd54(0x72)+B),process[_0x16bd54(0xe4)](0x1)),C()['catch'](_0x59d3db=>{const _0x438294=_0x16bd54;console[_0x438294(0x75)](_0x59d3db instanceof Error?_0x59d3db[_0x438294(0xe2)]:String(_0x59d3db)),process[_0x438294(0xe4)](0x1);});
2
+ const _0x2fcc66=_0x3a22;(function(_0x4e1d74,_0x3b064f){const _0xc6cd41=_0x3a22,_0x59a7a1=_0x4e1d74();while(!![]){try{const _0x1a6c46=-parseInt(_0xc6cd41(0xb2))/0x1*(-parseInt(_0xc6cd41(0xe1))/0x2)+parseInt(_0xc6cd41(0xaf))/0x3*(-parseInt(_0xc6cd41(0xab))/0x4)+parseInt(_0xc6cd41(0xbf))/0x5*(parseInt(_0xc6cd41(0xe6))/0x6)+-parseInt(_0xc6cd41(0x111))/0x7+-parseInt(_0xc6cd41(0xf1))/0x8*(parseInt(_0xc6cd41(0x11b))/0x9)+-parseInt(_0xc6cd41(0xdc))/0xa*(parseInt(_0xc6cd41(0xac))/0xb)+-parseInt(_0xc6cd41(0xd4))/0xc*(-parseInt(_0xc6cd41(0xc1))/0xd);if(_0x1a6c46===_0x3b064f)break;else _0x59a7a1['push'](_0x59a7a1['shift']());}catch(_0x214e66){_0x59a7a1['push'](_0x59a7a1['shift']());}}}(_0x585e,0xdda26));import'../chunks/vendor-BzHSCzgc.js';import{a as _0x4b7473,i as _0x5b699d,n,o as _0x51ccf2,r as _0x223b97,t as _0x240cfa}from'../chunks/trace-DPfd8LdJ.js';import{c as _0x589b19,f as _0x24e7c2,l as _0x432bc5,r as _0x1cebe8,s as _0x54e680,t as _0x233b51}from'../chunks/node-C6ZVE15U.js';import{t as _0x3a8fa4}from'../chunks/build-id-Coc3wh1M.js';import{n as _0x52f330}from'../chunks/runtime-manifest-Bdf66z_K.js';import{existsSync as _0x34d839}from'node:fs';function _0x3a22(_0x5729fc,_0x1bccec){_0x5729fc=_0x5729fc-0xa9;const _0x585e5f=_0x585e();let _0x3a22fd=_0x585e5f[_0x5729fc];return _0x3a22fd;}import{chmod as _0x52d7b9,mkdir as _0x1decc1,readFile as _0x4bd474,rm as _0xa20bd4,writeFile as _0x48f00a}from'node:fs/promises';import _0xea2916 from'node:net';import _0x589d0b from'node:process';var S=new _0x233b51();async function C(_0x3df288={}){const _0x44e652=_0x3a22;let _0x2fb42d=_0x3df288['env']??_0x589d0b[_0x44e652(0xb4)],_0x572336=_0x589b19(_0x2fb42d),_0x30cbb4=_0x52f330(_0x2fb42d),_0x90f2f3=_0x3df288[_0x44e652(0x106)]??E(new _0x1cebe8({'env':_0x2fb42d,'logger':_0x432bc5({'env':_0x2fb42d,'role':_0x4b7473[_0x44e652(0x112)]}),'resolveExecutionPlaneOptions':()=>({'execArgv':[..._0x30cbb4[_0x44e652(0xad)]['execArgv']],'modulePath':_0x30cbb4[_0x44e652(0xad)][_0x44e652(0xf2)]})})),_0x2dbc28=_0x3a8fa4(_0x2fb42d),_0x2d9791=new Date()[_0x44e652(0xd1)]();if(await _0x1decc1(_0x572336[_0x44e652(0xd3)],{'recursive':!0x0,'mode':0x1c0}),await _0x1decc1(_0x572336[_0x44e652(0xed)],{'recursive':!0x0,'mode':0x1c0}),!await M(_0x572336[_0x44e652(0x115)],_0x572336[_0x44e652(0x113)])){if(await N(_0x572336[_0x44e652(0xe9)]))return;throw Error(_0x44e652(0x110)+_0x572336[_0x44e652(0x115)]);}await j(_0x572336);let _0x1ddbee=_0x432bc5({'env':_0x2fb42d,'role':_0x4b7473['Daemon']}),_0x62a564=k({'buildId':_0x2dbc28,'env':_0x2fb42d,'pid':_0x589d0b[_0x44e652(0xef)]}),_0xde3b73=!0x1,_0x53fc77={},_0xf6ab57=async _0x9179cb=>z(null,-0x7f5b,Error(_0x44e652(0xc7)+_0x9179cb)),_0x53c62f=_0xea2916['createServer'](_0x2d395a=>{const _0x4cc4f9=_0x44e652;let _0x25df1e='';_0x2d395a['on'](_0x4cc4f9(0xbe),_0x12f802=>{const _0x3b0683=_0x4cc4f9;_0x25df1e+=_0x12f802[_0x3b0683(0xc9)](_0x3b0683(0xf6)),_0x22d654();}),_0x2d395a['on'](_0x4cc4f9(0xfc),()=>void 0x0);let _0x22d654=async()=>{const _0x577da1=_0x4cc4f9;for(;;){let _0x1d7428=_0x25df1e[_0x577da1(0xf8)]('\x0a');if(_0x1d7428<0x0)return;let _0x38fdd5=_0x25df1e['slice'](0x0,_0x1d7428)[_0x577da1(0xc6)]();if(_0x25df1e=_0x25df1e['slice'](_0x1d7428+0x1),!_0x38fdd5)continue;let _0x48ebef=await _0xf6ab57(_0x38fdd5);_0x2d395a[_0x577da1(0x10a)](JSON[_0x577da1(0xec)](_0x48ebef)+'\x0a');}};});_0xf6ab57=w({'buildId':_0x2dbc28,'logRequestEvent':async _0x32e9f6=>{const _0x281276=_0x44e652;_0x1ddbee[_0x281276(0xd6)]({'level':_0x32e9f6[_0x281276(0xd0)]===_0x5b699d[_0x281276(0xcd)]?_0x281276(0xfc):_0x281276(0x10d),'event_name':_0x32e9f6[_0x281276(0xd0)],'component':_0x223b97[_0x281276(0xa9)],'process_role':_0x4b7473[_0x281276(0xa9)],..._0x32e9f6['error']===void 0x0?{}:{'error':_0x32e9f6[_0x281276(0xfc)]},'fields':{..._0x62a564,..._0x32e9f6[_0x281276(0x11d)]===void 0x0?{}:{'duration_ms':_0x32e9f6[_0x281276(0x11d)]},'method':_0x32e9f6[_0x281276(0xca)],'timestamp':_0x32e9f6['timestamp']}});},'logRequestError':async _0x4b0cb0=>{const _0xf444e0=_0x44e652;_0x1ddbee['error']({'event_name':_0x5b699d[_0xf444e0(0xcd)],'component':_0x223b97[_0xf444e0(0xa9)],'process_role':_0x4b7473['Daemon'],'error':_0x4b0cb0[_0xf444e0(0xfc)],'fields':{..._0x62a564,'method':_0x4b0cb0['method'],'timestamp':_0x4b0cb0['timestamp']}});},'onShutdownRequest':()=>{const _0xaa9479=_0x44e652;_0x55a13d(_0xaa9479(0xeb))[_0xaa9479(0xbc)](()=>{const _0x206c42=_0xaa9479;_0x589d0b[_0x206c42(0xbd)](0x0);});},'pid':_0x589d0b['pid'],'runtimeRoot':_0x572336[_0x44e652(0x100)],'sessionHost':_0x90f2f3,'socketPath':_0x572336['socketPath'],'startedAt':_0x2d9791}),await new Promise((_0x6800ff,_0x5a4689)=>{const _0x46ef50=_0x44e652;_0x53c62f['once'](_0x46ef50(0xfc),_0x5a4689),_0x53c62f[_0x46ef50(0xe8)](_0x572336['socketPath'],_0x6800ff);}),_0x54e680(_0x572336[_0x44e652(0xe9)])||await _0x52d7b9(_0x572336[_0x44e652(0xe9)],0x180);let _0x45330e={'pid':_0x589d0b['pid'],'startedAt':_0x2d9791,'socketPath':_0x572336[_0x44e652(0xe9)],'runtimeRoot':_0x572336[_0x44e652(0x100)],'buildId':_0x2dbc28};await _0x48f00a(_0x572336[_0x44e652(0x113)],String(_0x589d0b['pid']),_0x44e652(0xf6)),await _0x48f00a(_0x572336['metaPath'],JSON['stringify'](_0x45330e,null,0x2),_0x44e652(0xf6)),_0x1ddbee[_0x44e652(0x10d)]({'event_name':_0x5b699d['DaemonStart'],'component':_0x223b97[_0x44e652(0xa9)],'process_role':_0x4b7473[_0x44e652(0xa9)],'fields':{..._0x62a564,'pid':_0x589d0b[_0x44e652(0xef)],'runtime_root':_0x572336[_0x44e652(0x100)],'socket_path':_0x572336[_0x44e652(0xe9)],'started_at':_0x2d9791}}),await _0x1ddbee[_0x44e652(0x105)]();let _0x4b1f60=setInterval(()=>{const _0xdce17f=_0x44e652;_0x90f2f3[_0xdce17f(0xee)]();},Math['max'](0x3e8,Math[_0x44e652(0xe7)](_0x90f2f3[_0x44e652(0x123)](),0xea60)));_0x4b1f60[_0x44e652(0xb1)](),_0x53fc77[_0x44e652(0xf7)]=_0x4b1f60;async function _0x55a13d(_0x43599d){const _0x33165c=_0x44e652;_0xde3b73||(_0xde3b73=!0x0,_0x53fc77[_0x33165c(0xf7)]!==void 0x0&&clearInterval(_0x53fc77[_0x33165c(0xf7)]),_0x1ddbee[_0x33165c(0x10d)]({'event_name':_0x5b699d[_0x33165c(0xda)],'component':_0x223b97['Daemon'],'process_role':_0x4b7473[_0x33165c(0xa9)],'fields':{..._0x62a564,'pid':_0x589d0b[_0x33165c(0xef)],'reason':_0x43599d,'timestamp':new Date()[_0x33165c(0xd1)]()}}),await _0x1ddbee[_0x33165c(0x105)](),await _0x90f2f3['destroyAll'](_0x43599d),await new Promise(_0x5df949=>{const _0x3ad508=_0x33165c;_0x53c62f[_0x3ad508(0xdd)](()=>_0x5df949());}),await F(_0x572336[_0x33165c(0xe9)]),await _0xa20bd4(_0x572336['pidPath'],{'force':!0x0})[_0x33165c(0x107)](()=>void 0x0),await _0xa20bd4(_0x572336['metaPath'],{'force':!0x0})[_0x33165c(0x107)](()=>void 0x0),await _0xa20bd4(_0x572336[_0x33165c(0x115)],{'recursive':!0x0,'force':!0x0})[_0x33165c(0x107)](()=>void 0x0));}_0x589d0b['on']('SIGINT',()=>{const _0x3d1f54=_0x44e652;_0x55a13d(_0x3d1f54(0x102))[_0x3d1f54(0xbc)](()=>{const _0x39b5fe=_0x3d1f54;_0x589d0b[_0x39b5fe(0xbd)](0x0);});}),_0x589d0b['on'](_0x44e652(0xe3),()=>{const _0x27ad07=_0x44e652;_0x55a13d(_0x27ad07(0xe0))[_0x27ad07(0xbc)](()=>{const _0x4c5dd2=_0x27ad07;_0x589d0b[_0x4c5dd2(0xbd)](0x0);});});}function w(_0x3245fb){return async _0xc1f062=>{const _0x3082f0=_0x3a22;let _0x533d91;try{_0x533d91=JSON[_0x3082f0(0xd7)](_0xc1f062);}catch(_0x143d07){return z(null,-0x7fbc,_0x143d07);}let _0x1cf17a=_0x240cfa(_0x533d91[_0x3082f0(0xcf)]?.['traceparent']),_0x4b6a97=async()=>await n[_0x3082f0(0x116)]({'name':_0x51ccf2[_0x3082f0(0xc0)],'kind':_0x3082f0(0xe2)},async()=>{const _0x2b2757=_0x3082f0;let _0x351997=Date[_0x2b2757(0xf0)]();await _0x3245fb[_0x2b2757(0x121)]?.({'eventName':_0x5b699d[_0x2b2757(0xb9)],'method':_0x533d91[_0x2b2757(0xca)],'timestamp':new Date()[_0x2b2757(0xd1)]()});try{let _0x55a8cf=await T(_0x533d91,_0x3245fb);return await _0x3245fb['logRequestEvent']?.({'durationMs':Date[_0x2b2757(0xf0)]()-_0x351997,'eventName':_0x5b699d[_0x2b2757(0xfa)],'method':_0x533d91[_0x2b2757(0xca)],'timestamp':new Date()[_0x2b2757(0xd1)]()}),_0x55a8cf;}catch(_0xc97f90){return await _0x3245fb['logRequestEvent']?.({'durationMs':Date[_0x2b2757(0xf0)]()-_0x351997,'eventName':_0x5b699d['DaemonRpcError'],'method':_0x533d91[_0x2b2757(0xca)],'error':_0xc97f90,'timestamp':new Date()[_0x2b2757(0xd1)]()}),_0x3245fb[_0x2b2757(0x121)]===void 0x0&&await _0x3245fb[_0x2b2757(0x101)]?.({'method':_0x533d91[_0x2b2757(0xca)],'error':_0xc97f90 instanceof Error?_0xc97f90[_0x2b2757(0xcb)]:String(_0xc97f90),'timestamp':new Date()['toISOString']()}),z(_0x533d91['id'],-0x7f5b,_0xc97f90);}});return _0x1cf17a===void 0x0?await _0x4b6a97():await n[_0x3082f0(0x103)](_0x1cf17a,_0x4b6a97);};}async function T(_0x57b9a7,_0xd51cd9){const _0x18b725=_0x3a22;switch(_0x57b9a7[_0x18b725(0xca)]){case _0x24e7c2[_0x18b725(0xf9)]:return{'jsonrpc':'2.0','id':_0x57b9a7['id'],'result':{'ok':!0x0,'pid':_0xd51cd9[_0x18b725(0xef)],'startedAt':_0xd51cd9[_0x18b725(0x11c)],'socketPath':_0xd51cd9[_0x18b725(0xe9)],'runtimeRoot':_0xd51cd9['runtimeRoot'],'buildId':_0xd51cd9[_0x18b725(0xd9)],'sessionCount':_0xd51cd9['sessionHost'][_0x18b725(0x10e)]()}};case _0x24e7c2[_0x18b725(0xea)]:return _0xd51cd9['onShutdownRequest']?.(),{'jsonrpc':'2.0','id':_0x57b9a7['id'],'result':{'stopping':!0x0}};case _0x24e7c2[_0x18b725(0xdb)]:{let _0x5bd670=await _0xd51cd9[_0x18b725(0x106)][_0x18b725(0xe4)](_0x57b9a7['params']);return R(_0x57b9a7['id'],_0x5bd670);}case _0x24e7c2[_0x18b725(0xfd)]:{let _0x62bae9=await _0xd51cd9['sessionHost'][_0x18b725(0xc2)](_0x57b9a7[_0x18b725(0x119)]);return R(_0x57b9a7['id'],_0x62bae9);}case _0x24e7c2[_0x18b725(0x104)]:{let _0x13a455=await _0xd51cd9[_0x18b725(0x106)][_0x18b725(0xb3)](_0x57b9a7['params']);return R(_0x57b9a7['id'],_0x13a455);}case _0x24e7c2[_0x18b725(0xf5)]:{let _0x1a1b9e=await _0xd51cd9[_0x18b725(0x106)][_0x18b725(0xb8)](_0x57b9a7[_0x18b725(0x119)]);return R(_0x57b9a7['id'],_0x1a1b9e);}case _0x24e7c2[_0x18b725(0xff)]:{let _0x24a279=await _0xd51cd9['sessionHost']['exportWorkbookFile'](_0x57b9a7['params']);return R(_0x57b9a7['id'],_0x24a279);}case _0x24e7c2[_0x18b725(0x11f)]:{let _0x2dcd1c=_0x57b9a7['params'],_0x346c89=await _0xd51cd9['sessionHost'][_0x18b725(0xba)](_0x2dcd1c);return R(_0x57b9a7['id'],_0x346c89);}case _0x24e7c2[_0x18b725(0xb5)]:{let _0x4db0c8=await _0xd51cd9['sessionHost'][_0x18b725(0xc5)](_0x57b9a7['params']);return R(_0x57b9a7['id'],_0x4db0c8);}case _0x24e7c2[_0x18b725(0xaa)]:{let _0x49b9c2=await _0xd51cd9[_0x18b725(0x106)][_0x18b725(0xb7)](_0x57b9a7[_0x18b725(0x119)]);return R(_0x57b9a7['id'],_0x49b9c2);}default:return z(_0x57b9a7['id'],-0x7f59,Error(_0x18b725(0xe5)+_0x57b9a7['method']));}}function E(_0x24d3a2){return{async 'createWorkbook'(_0x3e148e){const _0x456c6f=_0x3a22;let _0x2f2106=await D(_0x3e148e),_0x2b863a=await _0x24d3a2['createWorkbook']({..._0x3e148e[_0x456c6f(0xae)]===void 0x0?{}:{'cwd':_0x3e148e[_0x456c6f(0xae)]},'identity':_0x2f2106,..._0x3e148e['id']===void 0x0?{}:{'workbookId':_0x3e148e['id']},..._0x3e148e['name']===void 0x0?{}:{'workbookName':_0x3e148e['name']}});return{'success':!0x0,'workbookData':_0x2b863a[_0x456c6f(0xf4)],'session':O(_0x2b863a[_0x456c6f(0xd5)])};},async 'dispose'(_0x217eb8){const _0x533855=_0x3a22;let _0x248534=await D(_0x217eb8);return await _0x24d3a2['dispose']({..._0x217eb8[_0x533855(0xae)]===void 0x0?{}:{'cwd':_0x217eb8[_0x533855(0xae)]},'identity':_0x248534}),{'disposed':!0x0,'workbookIdentity':_0x248534[_0x533855(0x118)]};},async 'destroyAll'(_0x16d82e){const _0x5efd59=_0x3a22;await _0x24d3a2[_0x5efd59(0x11e)]?.(_0x16d82e);},async 'evalJs'(_0x4ad3fe){const _0x1204ff=_0x3a22;let _0x26903f=await D(_0x4ad3fe),_0x4f8dd1=await _0x24d3a2[_0x1204ff(0xb8)]({'code':_0x4ad3fe['code'],..._0x4ad3fe[_0x1204ff(0xae)]===void 0x0?{}:{'cwd':_0x4ad3fe[_0x1204ff(0xae)]},'identity':_0x26903f,..._0x4ad3fe[_0x1204ff(0x109)]===void 0x0?{}:{'mutates':_0x4ad3fe[_0x1204ff(0x109)]}});return{..._0x4f8dd1[_0x1204ff(0x11a)]===void 0x0?{}:{'mutations':_0x4f8dd1['mutations']},'success':!0x0,'value':_0x4f8dd1[_0x1204ff(0x114)],'session':O(_0x4f8dd1[_0x1204ff(0xd5)])};},async 'exportWorkbookData'(_0x381512){const _0x36d572=_0x3a22;let _0x2b0f1f=await D(_0x381512),_0x1eb9ca=await _0x24d3a2[_0x36d572(0xba)]({..._0x381512[_0x36d572(0xae)]===void 0x0?{}:{'cwd':_0x381512[_0x36d572(0xae)]},'identity':_0x2b0f1f});return{'success':!0x0,'workbookData':_0x1eb9ca[_0x36d572(0xf4)],'session':O(_0x1eb9ca[_0x36d572(0xd5)])};},async 'exportWorkbookFile'(_0x1fedc1){const _0x4aabc2=_0x3a22;let _0x16376d=await D(_0x1fedc1),_0x45e6e5=await _0x24d3a2['exportWorkbookFile']({..._0x1fedc1['cwd']===void 0x0?{}:{'cwd':_0x1fedc1['cwd']},'format':_0x1fedc1[_0x4aabc2(0xdf)],'identity':_0x16376d,'outputPath':_0x1fedc1[_0x4aabc2(0xd8)]});return{'success':!0x0,'format':_0x45e6e5[_0x4aabc2(0xdf)],'outputPath':_0x45e6e5[_0x4aabc2(0xd8)],'sizeBytes':_0x45e6e5[_0x4aabc2(0xfe)],'session':O(_0x45e6e5['session'])};},async 'getWorkbookSession'(_0x3fa447){const _0x47faf5=_0x3a22;let _0x18e76c=await D(_0x3fa447),_0x3ddabb=await _0x24d3a2[_0x47faf5(0x108)]({..._0x3fa447['cwd']===void 0x0?{}:{'cwd':_0x3fa447[_0x47faf5(0xae)]},'identity':_0x18e76c});return{'exists':_0x3ddabb!==null,'session':_0x3ddabb===null?null:O(_0x3ddabb)};},'getSessionCount'(){const _0x21ac7e=_0x3a22;return _0x24d3a2[_0x21ac7e(0x10e)]?.()??0x0;},'getSessionIdleTtlMs'(){const _0x31d623=_0x3a22;return _0x24d3a2[_0x31d623(0x123)]?.()??0xea60;},async 'loadWorkbook'(_0x271cb3){const _0x3aafc4=_0x3a22;let _0x3f264b=await D(_0x271cb3),_0x3c7c7f=await _0x24d3a2[_0x3aafc4(0xfb)]({..._0x271cb3[_0x3aafc4(0xae)]===void 0x0?{}:{'cwd':_0x271cb3[_0x3aafc4(0xae)]},'identity':_0x3f264b,'workbookData':_0x271cb3[_0x3aafc4(0xf4)]});return{'success':!0x0,'workbookData':_0x3c7c7f[_0x3aafc4(0xf4)],'session':O(_0x3c7c7f[_0x3aafc4(0xd5)])};},async 'loadWorkbookDataReplayPack'(_0x34e6f5){const _0x2e50a9=_0x3a22;let _0x1208fd=await D(_0x34e6f5);return{'success':!0x0,'session':O((await _0x24d3a2[_0x2e50a9(0xc2)]({..._0x34e6f5[_0x2e50a9(0xae)]===void 0x0?{}:{'cwd':_0x34e6f5[_0x2e50a9(0xae)]},'identity':_0x1208fd,'replayPack':{'baseWorkbookData':_0x34e6f5[_0x2e50a9(0xce)],'mutations':_0x34e6f5[_0x2e50a9(0x11a)]}}))['session'])};},async 'unloadIdleSessions'(){const _0x3e4898=_0x3a22;await _0x24d3a2[_0x3e4898(0xee)]?.();}};}async function D(_0x468d42){const _0x52aab2=_0x3a22;return await S[_0x52aab2(0xbb)](_0x468d42);}function O(_0x458fb3){const _0x1c6711=_0x3a22;return{'createdAt':_0x458fb3[_0x1c6711(0xc8)]??'','lastAccessedAt':_0x458fb3[_0x1c6711(0xcc)]??'','sessionId':_0x458fb3[_0x1c6711(0xf3)],'workbookIdentity':_0x458fb3[_0x1c6711(0xd2)][_0x1c6711(0x118)]};}function k(_0x28ea0b){const _0x3d0504=_0x3a22;return{'build.id':A(_0x28ea0b[_0x3d0504(0xb4)],_0x3d0504(0xb6))??_0x28ea0b[_0x3d0504(0xd9)],'deployment.environment.name':'local','distribution.channel':A(_0x28ea0b[_0x3d0504(0xb4)],'UNIVER_DISTRIBUTION_CHANNEL')??_0x3d0504(0x125),'service.instance.id':String(_0x28ea0b[_0x3d0504(0xef)]),'service.name':_0x3d0504(0x10c),...A(_0x28ea0b[_0x3d0504(0xb4)],'UNIVER_CLI_VERSION')===void 0x0?{}:{'service.version':A(_0x28ea0b[_0x3d0504(0xb4)],_0x3d0504(0x10b))}};}function A(_0x587e95,_0x195e39){const _0x4991b1=_0x3a22;let _0x5694b0=_0x587e95[_0x195e39]?.[_0x4991b1(0xc6)]();return _0x5694b0===void 0x0||_0x5694b0[_0x4991b1(0xb0)]===0x0?void 0x0:_0x5694b0;}async function j(_0x27dbcb){const _0x580284=_0x3a22;P(_0x27dbcb['socketPath'])&&!await N(_0x27dbcb[_0x580284(0xe9)])&&await F(_0x27dbcb[_0x580284(0xe9)]);let _0x2961c1=await I(_0x27dbcb['pidPath']);_0x2961c1!==null&&!L(_0x2961c1)&&(await _0xa20bd4(_0x27dbcb[_0x580284(0x113)],{'force':!0x0})[_0x580284(0x107)](()=>void 0x0),await _0xa20bd4(_0x27dbcb[_0x580284(0xc4)],{'force':!0x0})[_0x580284(0x107)](()=>void 0x0),await _0xa20bd4(_0x27dbcb['lockPath'],{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0));}async function M(_0x416854,_0x42f9d7){const _0x212f5d=_0x3a22;try{return await _0x1decc1(_0x416854,{'recursive':!0x1,'mode':0x1c0}),!0x0;}catch(_0x5c9532){if(_0x5c9532[_0x212f5d(0xc3)]!==_0x212f5d(0x120))throw _0x5c9532;let _0x150089=await I(_0x42f9d7);return _0x150089!==null&&L(_0x150089)?!0x1:(await _0xa20bd4(_0x416854,{'recursive':!0x0,'force':!0x0}),await _0x1decc1(_0x416854,{'recursive':!0x1,'mode':0x1c0}),!0x0);}}async function N(_0x23158b){return await new Promise(_0x5824f2=>{const _0x566582=_0x3a22;let _0x41593d=_0xea2916['createConnection'](_0x23158b);_0x41593d[_0x566582(0x117)]('connect',()=>{_0x41593d['end'](),_0x5824f2(!0x0);}),_0x41593d[_0x566582(0x117)](_0x566582(0xfc),()=>{_0x5824f2(!0x1);});});}function P(_0x50099c){return _0x54e680(_0x50099c)?!0x1:_0x34d839(_0x50099c);}function _0x585e(){const _0x1a989f=['env','SessionDispose','UNIVER_CLI_BUILD_ID','getWorkbookSession','evalJs','DaemonRpcStart','exportWorkbookData','resolveIdentity','finally','exit','data','76990JjvWJp','DaemonRpcServer','117kFlDXV','loadWorkbookDataReplayPack','code','metaPath','dispose','trim','Daemon\x20handler\x20not\x20ready:\x20','createdAt','toString','method','message','lastAccessedAt','DaemonRpcError','baseWorkbookData','meta','eventName','toISOString','packageIdentity','daemonDir','3048036FZlJfj','session','event','parse','outputPath','buildId','DaemonStop','SessionLoadWorkbook','9970OxMDdj','close','Unknown\x20daemon\x20subcommand:\x20','format','sigterm','31342mZBjff','server','SIGTERM','loadWorkbook','Method\x20not\x20found:\x20','30MpCQEf','min','listen','socketPath','Shutdown','rpc-shutdown','stringify','sessionRoot','unloadIdleSessions','pid','now','464yscoXb','modulePath','sessionId','workbookData','SessionEvalJs','utf8','current','indexOf','Health','DaemonRpcFinish','loadWorkbookData','error','SessionLoadWorkbookDataReplayPack','sizeBytes','SessionExportWorkbookFile','homeDir','logRequestError','sigint','withContext','SessionCreateWorkbook','flush','sessionHost','catch','getSession','mutates','write','UNIVER_CLI_VERSION','univer-daemon','info','getSessionCount','serve','Another\x20daemon\x20startup\x20owns\x20','2854264SEiPfL','Runtime','pidPath','value','lockPath','withSpan','once','absolutePath','params','mutations','95373gVxkaU','startedAt','durationMs','destroyAll','SessionExportWorkbookData','EEXIST','logRequestEvent','2.0','getSessionIdleTtlMs','kill','unknown','Daemon','SessionGetWorkbook','6227472yWiMjh','220NyTXcd','runtimeExecutionPlaneEntry','cwd','3KmDyTT','length','unref','73GWjqUq','createWorkbook'];_0x585e=function(){return _0x1a989f;};return _0x585e();}async function F(_0x280ab7){const _0x14d7dc=_0x3a22;_0x54e680(_0x280ab7)||await _0xa20bd4(_0x280ab7,{'force':!0x0})[_0x14d7dc(0x107)](()=>void 0x0);}async function I(_0xa6719a){const _0x2d1b6d=_0x3a22;try{let _0x54a537=await _0x4bd474(_0xa6719a,'utf8'),_0x5e1db6=Number(_0x54a537[_0x2d1b6d(0xc6)]());return Number['isFinite'](_0x5e1db6)?_0x5e1db6:null;}catch{return null;}}function L(_0x3f4c16){const _0x2c1dda=_0x3a22;try{return _0x589d0b[_0x2c1dda(0x124)](_0x3f4c16,0x0),!0x0;}catch{return!0x1;}}function R(_0x2b2d98,_0x393232){const _0x3d253a=_0x3a22;return{'jsonrpc':_0x3d253a(0x122),'id':_0x2b2d98,'result':_0x393232};}function z(_0x2ad133,_0x43247b,_0x4f0ff2){return{'jsonrpc':'2.0','id':_0x2ad133,'error':{'code':_0x43247b,'message':_0x4f0ff2 instanceof Error?_0x4f0ff2['message']:String(_0x4f0ff2)}};}var B=process['argv'][0x2]??_0x2fcc66(0x10f);B!=='serve'&&(console[_0x2fcc66(0xfc)](_0x2fcc66(0xde)+B),process[_0x2fcc66(0xbd)](0x1)),C()[_0x2fcc66(0x107)](_0x54061a=>{const _0xcc4de1=_0x2fcc66;console[_0xcc4de1(0xfc)](_0x54061a instanceof Error?_0x54061a[_0xcc4de1(0xcb)]:String(_0x54061a)),process[_0xcc4de1(0xbd)](0x1);});
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x27129f=_0x5ccb;(function(_0x3fa448,_0x1c7266){const _0x1053ea=_0x5ccb,_0x1f2a03=_0x3fa448();while(!![]){try{const _0x3f6b79=parseInt(_0x1053ea(0x15c))/0x1*(parseInt(_0x1053ea(0x18d))/0x2)+parseInt(_0x1053ea(0x19c))/0x3*(parseInt(_0x1053ea(0x173))/0x4)+parseInt(_0x1053ea(0x16f))/0x5*(-parseInt(_0x1053ea(0x168))/0x6)+parseInt(_0x1053ea(0x197))/0x7*(-parseInt(_0x1053ea(0x1a6))/0x8)+-parseInt(_0x1053ea(0x169))/0x9+parseInt(_0x1053ea(0x185))/0xa*(parseInt(_0x1053ea(0x164))/0xb)+parseInt(_0x1053ea(0x1a9))/0xc*(parseInt(_0x1053ea(0x172))/0xd);if(_0x3f6b79===_0x1c7266)break;else _0x1f2a03['push'](_0x1f2a03['shift']());}catch(_0x279bc8){_0x1f2a03['push'](_0x1f2a03['shift']());}}}(_0x1dbe,0x33a59));import{t as _0x16dcb0}from'../chunks/build-info-BnEE6trg.js';import{n as _0x2a4303}from'../chunks/runtime-manifest-Bdf66z_K.js';import{readFileSync as _0x41e9fd}from'node:fs';function _0x5ccb(_0x71dc52,_0x498ac4){_0x71dc52=_0x71dc52-0x158;const _0x1dbec2=_0x1dbe();let _0x5ccb01=_0x1dbec2[_0x71dc52];return _0x5ccb01;}import{mkdir as _0x287c0d,readFile as _0x275bb5,rename as _0x148af6,writeFile as _0xc8a368}from'node:fs/promises';import{dirname as _0x233df6,join as _0x2a1a19,resolve as _0x3e615c}from'node:path';import{homedir as _0x26e6ed,platform as _0x500b4e}from'node:os';import{randomUUID as _0x2ffc2f}from'node:crypto';async function p(_0x3f9f59){const _0x334813=_0x5ccb;let _0x1d574e=_0x3f9f59['env']??process.env,_0xc24c7c=_0x3f9f59[_0x334813(0x177)]??_0x2a4303(_0x1d574e);if(_0xc24c7c[_0x334813(0x198)]!==_0x334813(0x171))return{'reason':_0x334813(0x17f),'status':_0x334813(0x190)};let _0x2402ab=_0x3f9f59[_0x334813(0x1a2)]??await E(_0xc24c7c['packageRoot']);if(_0x2402ab[_0x334813(0x188)]['length']===0x0)return{'reason':'missing-endpoint','status':_0x334813(0x190)};let _0x3f007=_0x3f9f59[_0x334813(0x18e)]??new Date(),_0x402181=_0x3f9f59[_0x334813(0x187)]??_0x16dcb0,_0x457a1a=_0x3f9f59[_0x334813(0x166)]??g({'env':_0x1d574e}),_0x59492c=await v({'path':_0x457a1a,..._0x3f9f59[_0x334813(0x1ab)]===void 0x0?{}:{'randomId':_0x3f9f59[_0x334813(0x1ab)]},..._0x3f9f59['stateIo']===void 0x0?{}:{'stateIo':_0x3f9f59[_0x334813(0x18b)]}});if(_0x59492c[_0x334813(0x19e)]===void 0x0)return{'reason':'state-unavailable','status':_0x334813(0x190)};if(_0x3f9f59[_0x334813(0x15d)]==='cli_first_opened'&&_0x59492c[_0x334813(0x19e)][_0x334813(0x1a8)]['cli_first_opened']!==void 0x0)return{'reason':_0x334813(0x160),'status':_0x334813(0x190)};let _0x2ed6a2=S({'buildInfo':_0x402181,'eventName':_0x3f9f59[_0x334813(0x15d)],'now':_0x3f007,'state':_0x59492c['state']});await x({'path':_0x457a1a,'state':_0x2ed6a2,..._0x3f9f59[_0x334813(0x18b)]===void 0x0?{}:{'stateIo':_0x3f9f59[_0x334813(0x18b)]}});let _0x24be91=C({'buildInfo':_0x402181,'env':_0x1d574e,'eventName':_0x3f9f59[_0x334813(0x15d)],'eventSource':_0x3f9f59[_0x334813(0x17b)],'manifest':_0xc24c7c,'state':_0x2ed6a2});try{return await(_0x3f9f59[_0x334813(0x19f)]??new O())[_0x334813(0x189)]({'capture':_0x24be91,'config':_0x2402ab}),{'status':'captured'};}catch{return{'reason':_0x334813(0x1a0),'status':_0x334813(0x190)};}}async function m(_0x409b7c={}){const _0x45a919=_0x5ccb;return await p({..._0x409b7c,'eventName':_0x45a919(0x16a),'eventSource':_0x45a919(0x182)});}async function h(_0x53ec1e={}){const _0x28ff73=_0x5ccb;return await p({..._0x53ec1e,'eventName':_0x28ff73(0x170),'eventSource':_0x28ff73(0x1a7)});}function g(_0x3ae1cf={}){const _0x2e2b7e=_0x5ccb;let _0x546cfd=(_0x3ae1cf[_0x2e2b7e(0x1aa)]??process.env)['UNIVER_HOME']?.[_0x2e2b7e(0x17d)]();return _0x3e615c(_0x546cfd&&_0x546cfd[_0x2e2b7e(0x174)]>0x0?_0x546cfd:_0x2a1a19(_0x3ae1cf[_0x2e2b7e(0x17c)]??_0x26e6ed(),_0x2e2b7e(0x19b)),'telemetry',_0x2e2b7e(0x16e));}function _(_0x361f5c={}){return{'anonymousInstallId':_0x361f5c['randomId']?.()??_0x2ffc2f(),'events':{},'version':0x1};}async function v(_0x25f555){const _0x1e9e53=_0x5ccb;let _0x775aab=_0x25f555[_0x1e9e53(0x18b)]?.[_0x1e9e53(0x19d)]??_0x275bb5;try{return{'state':y(await _0x775aab(_0x25f555[_0x1e9e53(0x17a)],_0x1e9e53(0x180)))};}catch{return{'state':_({..._0x25f555[_0x1e9e53(0x1ab)]===void 0x0?{}:{'randomId':_0x25f555[_0x1e9e53(0x1ab)]}})};}}function y(_0xb7948){const _0x3ea82e=_0x5ccb;let _0x1fe3e4=JSON['parse'](_0xb7948);if(!F(_0x1fe3e4)||_0x1fe3e4[_0x3ea82e(0x16b)]!==0x1)throw Error(_0x3ea82e(0x15a));if(typeof _0x1fe3e4[_0x3ea82e(0x16d)]!='string'||_0x1fe3e4['anonymousInstallId'][_0x3ea82e(0x174)]===0x0)throw Error('Invalid\x20product\x20telemetry\x20anonymous\x20install\x20id.');let _0xd3cdaa=F(_0x1fe3e4['events'])?_0x1fe3e4[_0x3ea82e(0x1a8)]:{};return{'anonymousInstallId':_0x1fe3e4[_0x3ea82e(0x16d)],'events':{...j(_0xd3cdaa['cli_installed'],_0x3ea82e(0x16a)),...j(_0xd3cdaa[_0x3ea82e(0x170)],'cli_first_opened')},'version':0x1};}function b(_0x4d8a7e){const _0x483b06=_0x5ccb;return JSON[_0x483b06(0x192)](_0x4d8a7e,null,0x2)+'\x0a';}async function x(_0x39a5a5){const _0x58717e=_0x5ccb;let _0x6b2641=_0x39a5a5['stateIo']?.[_0x58717e(0x191)]??_0xc8a368,_0x35a9f1=_0x39a5a5[_0x58717e(0x18b)]?.[_0x58717e(0x195)]??_0x148af6,_0x4d720a=_0x39a5a5[_0x58717e(0x17a)]+'.'+process[_0x58717e(0x163)]+'.'+Date[_0x58717e(0x18e)]()+_0x58717e(0x17e);try{await _0x287c0d(_0x233df6(_0x39a5a5[_0x58717e(0x17a)]),{'mode':0x1c0,'recursive':!0x0}),await _0x6b2641(_0x4d720a,b(_0x39a5a5['state']),{'encoding':_0x58717e(0x180),'mode':0x180}),await _0x35a9f1(_0x4d720a,_0x39a5a5[_0x58717e(0x17a)]);}catch{}}function S(_0x250249){const _0x210ebd=_0x5ccb;return{..._0x250249['state'],'events':{..._0x250249[_0x210ebd(0x19e)]['events'],[_0x250249[_0x210ebd(0x15d)]]:{'attemptedAt':_0x250249[_0x210ebd(0x18e)][_0x210ebd(0x1ac)](),'buildCommit':_0x250249[_0x210ebd(0x187)][_0x210ebd(0x15b)],'cliVersion':_0x250249[_0x210ebd(0x187)][_0x210ebd(0x16b)]}}};}function C(_0xe3a702){const _0x1c11c9=_0x5ccb;return{'distinctId':_0xe3a702[_0x1c11c9(0x19e)][_0x1c11c9(0x16d)],'event':_0xe3a702[_0x1c11c9(0x15d)],'properties':w(_0xe3a702)};}function w(_0x100828){const _0x2cad68=_0x5ccb;return{'arch':process[_0x2cad68(0x175)],'build_commit':_0x100828[_0x2cad68(0x187)]['commitHash'],'cli_version':_0x100828[_0x2cad68(0x187)][_0x2cad68(0x16b)],'distribution_channel':A(_0x100828['manifest']),'event_source':_0x100828[_0x2cad68(0x17b)],'install_manager':T(_0x100828[_0x2cad68(0x1aa)]??process.env),'node_major_version':M(process[_0x2cad68(0x178)][_0x2cad68(0x158)]),'package_name':k(_0x100828[_0x2cad68(0x177)]),'platform':_0x500b4e(),'telemetry_state_version':0x1};}function T(_0x3645be=process.env){const _0xcd7380=_0x5ccb;let _0x549a80=process[_0xcd7380(0x178)];if(typeof _0x549a80[_0xcd7380(0x159)]==_0xcd7380(0x186)&&_0x549a80['bun'][_0xcd7380(0x174)]>0x0)return _0xcd7380(0x159);let _0x4890e2=_0x3645be[_0xcd7380(0x167)]??'';if(/\bbun\//u[_0xcd7380(0x1ad)](_0x4890e2))return _0xcd7380(0x159);if(/\bpnpm\//u['test'](_0x4890e2))return _0xcd7380(0x1a1);if(/\byarn\//u['test'](_0x4890e2))return _0xcd7380(0x16c);if(/\bnpm\//u[_0xcd7380(0x1ad)](_0x4890e2))return'npm';let _0x1bc32b=_0x3645be['npm_execpath']??'';return/(^|[/\\])bun(?:\.exe)?$/u['test'](_0x1bc32b)?'bun':/(^|[/\\])pnpm(?:\.cmd|\.ps1|\.exe)?$/u['test'](_0x1bc32b)?'pnpm':/(^|[/\\])yarn(?:\.cmd|\.ps1|\.exe)?$/u[_0xcd7380(0x1ad)](_0x1bc32b)?'yarn':/(^|[/\\])npm(?:\.cmd|\.ps1|\.exe)?$/u[_0xcd7380(0x1ad)](_0x1bc32b)?_0xcd7380(0x184):_0x3645be[_0xcd7380(0x196)]==='1'?_0xcd7380(0x159):_0x3645be['UNIVER_MANAGED_BY_NPM']==='1'?_0xcd7380(0x184):_0xcd7380(0x18a);}async function E(_0x3edb2a){const _0x2fda76=_0x5ccb;try{let _0x46af9a=await _0x275bb5(_0x2a1a19(_0x3edb2a,'internal','product-telemetry.json'),_0x2fda76(0x180));return D(JSON['parse'](_0x46af9a));}catch{return D({});}}function D(_0x53c863){const _0x5876a4=_0x5ccb;let _0x39bb43=F(_0x53c863)?_0x53c863:{};return{'endpoint':N(_0x39bb43['endpoint'],_0x5876a4(0x1a4)),'timeoutMs':P(_0x39bb43['timeoutMs'],0x2ee)};}var O=class{async['capture'](_0x3b37cf){const _0x26c9d5=_0x5ccb;let _0x5bb496=await fetch(_0x3b37cf[_0x26c9d5(0x1a2)][_0x26c9d5(0x188)],{'body':JSON[_0x26c9d5(0x192)]({'distinctId':_0x3b37cf[_0x26c9d5(0x189)][_0x26c9d5(0x1a3)],'event':_0x3b37cf[_0x26c9d5(0x189)]['event'],'properties':_0x3b37cf[_0x26c9d5(0x189)]['properties']}),'headers':{'content-type':_0x26c9d5(0x19a)},'method':'POST','signal':AbortSignal[_0x26c9d5(0x179)](_0x3b37cf[_0x26c9d5(0x1a2)]['timeoutMs'])});if(!_0x5bb496['ok'])throw Error('CLI\x20telemetry\x20proxy\x20failed\x20with\x20status\x20'+_0x5bb496[_0x26c9d5(0x181)]);}};function k(_0x255a34){const _0x3496ad=_0x5ccb;try{let _0x51047f=JSON['parse'](_0x41e9fd(_0x2a1a19(_0x255a34[_0x3496ad(0x1a5)],_0x3496ad(0x18f)),'utf8'));return typeof _0x51047f['name']=='string'&&_0x51047f[_0x3496ad(0x15f)][_0x3496ad(0x17d)]()[_0x3496ad(0x174)]>0x0?_0x51047f[_0x3496ad(0x15f)]:_0x3496ad(0x199);}catch{return _0x3496ad(0x199);}}function A(_0x323978){const _0x3ae389=_0x5ccb;let _0xa0e864=k(_0x323978);return _0xa0e864===_0x3ae389(0x18c)?'internal-github':_0xa0e864===_0x3ae389(0x199)?'public-npm':_0x323978[_0x3ae389(0x198)];}function j(_0x3b280d,_0x88a99a){const _0x30c50a=_0x5ccb;return!F(_0x3b280d)||typeof _0x3b280d['attemptedAt']!=_0x30c50a(0x186)||typeof _0x3b280d[_0x30c50a(0x1ae)]!=_0x30c50a(0x186)||typeof _0x3b280d[_0x30c50a(0x176)]!=_0x30c50a(0x186)?{}:{[_0x88a99a]:{'attemptedAt':_0x3b280d[_0x30c50a(0x165)],'buildCommit':_0x3b280d[_0x30c50a(0x1ae)],'cliVersion':_0x3b280d['cliVersion']}};}function _0x1dbe(){const _0x31c5f7=['env','randomId','toISOString','test','buildCommit','node','bun','Invalid\x20product\x20telemetry\x20state\x20version.','commitHash','9AfLNca','eventName','first-open','name','already-attempted','number','argv','pid','2563682eAgafC','attemptedAt','statePath','npm_config_user_agent','810384ZefbxN','1560879JQxDbu','cli_installed','version','yarn','anonymousInstallId','state.json','10VeaiAL','cli_first_opened','packaged','2817542AoZzNY','4eOePqp','length','arch','cliVersion','manifest','versions','timeout','path','eventSource','homeDir','trim','.tmp','not-packaged','utf8','status','postinstall','object','npm','10ONDXCi','string','buildInfo','endpoint','capture','unknown','stateIo','@dream-num/univer-cli','9786viSGgq','now','package.json','skipped','writeFile','stringify','isSafeInteger','split','rename','UNIVER_MANAGED_BY_BUN','14jHKJGB','mode','univer-cli','application/json','.univer','657171ornxKV','readFile','state','transport','capture-failed','pnpm','config','distinctId','https://univer.ai/api/telemetry/cli','packageRoot','231144rCAeiu','cli-startup','events','12gTbdbi'];_0x1dbe=function(){return _0x31c5f7;};return _0x1dbe();}function M(_0x27b92a){const _0x543694=_0x5ccb;let _0x184f1e=Number(_0x27b92a[_0x543694(0x194)]('.')[0x0]);return Number[_0x543694(0x193)](_0x184f1e)&&_0x184f1e>0x0?_0x184f1e:void 0x0;}function N(_0x431563,_0x2937c6){const _0x1d9cef=_0x5ccb;return typeof _0x431563==_0x1d9cef(0x186)&&_0x431563['trim']()[_0x1d9cef(0x174)]>0x0?_0x431563[_0x1d9cef(0x17d)]():_0x2937c6;}function P(_0x3eb55b,_0xf36a94){const _0x7ee06=_0x5ccb;return typeof _0x3eb55b==_0x7ee06(0x161)&&Number['isSafeInteger'](_0x3eb55b)&&_0x3eb55b>0x0?_0x3eb55b:_0xf36a94;}function F(_0x10fd47){const _0x18c92a=_0x5ccb;return typeof _0x10fd47==_0x18c92a(0x183)&&!!_0x10fd47;}var I=process[_0x27129f(0x162)][0x2];try{I===_0x27129f(0x15e)?await h():I===_0x27129f(0x182)&&await m();}catch{}
2
+ const _0x46143c=_0x2536;(function(_0x172147,_0x4f60dc){const _0x5d9c88=_0x2536,_0x1dc1a5=_0x172147();while(!![]){try{const _0xef7f8f=-parseInt(_0x5d9c88(0xd7))/0x1*(-parseInt(_0x5d9c88(0xdc))/0x2)+parseInt(_0x5d9c88(0xe5))/0x3+parseInt(_0x5d9c88(0xf6))/0x4*(-parseInt(_0x5d9c88(0xc0))/0x5)+-parseInt(_0x5d9c88(0xb4))/0x6*(parseInt(_0x5d9c88(0xf5))/0x7)+parseInt(_0x5d9c88(0xc4))/0x8+parseInt(_0x5d9c88(0xfc))/0x9*(parseInt(_0x5d9c88(0xfd))/0xa)+-parseInt(_0x5d9c88(0xb9))/0xb;if(_0xef7f8f===_0x4f60dc)break;else _0x1dc1a5['push'](_0x1dc1a5['shift']());}catch(_0x3e4230){_0x1dc1a5['push'](_0x1dc1a5['shift']());}}}(_0x5495,0xd7fab));import{t as _0xc20e9b}from'../chunks/build-info-CEz0HGcR.js';import{n as _0x18c318}from'../chunks/runtime-manifest-Bdf66z_K.js';import{readFileSync as _0x3e2942}from'node:fs';import{mkdir as _0x4e4fcb,readFile as _0x2e8f03,rename as _0x39eee6,writeFile as _0x508995}from'node:fs/promises';import{dirname as _0x249ef1,join as _0x6750df,resolve as _0xf59e61}from'node:path';import{homedir as _0x314676,platform as _0x3556ce}from'node:os';import{randomUUID as _0x460225}from'node:crypto';async function p(_0x1c42aa){const _0x5d120f=_0x2536;let _0x2c4340=_0x1c42aa['env']??process.env,_0x44d29c=_0x1c42aa[_0x5d120f(0xa8)]??_0x18c318(_0x2c4340);if(_0x44d29c[_0x5d120f(0xec)]!=='packaged')return{'reason':_0x5d120f(0xba),'status':'skipped'};let _0x12684e=_0x1c42aa[_0x5d120f(0xcc)]??_0xc20e9b;if(j(_0x12684e))return{'reason':_0x5d120f(0xda),'status':_0x5d120f(0xde)};let _0x1859c6=_0x1c42aa[_0x5d120f(0xd2)]??await E(_0x44d29c[_0x5d120f(0xbd)]);if(_0x1859c6[_0x5d120f(0xc2)][_0x5d120f(0xe4)]===0x0)return{'reason':_0x5d120f(0xe1),'status':_0x5d120f(0xde)};let _0x216adf=_0x1c42aa[_0x5d120f(0xd3)]??new Date(),_0xfd47be=_0x1c42aa[_0x5d120f(0xc7)]??g({'env':_0x2c4340}),_0x2f70ba=await v({'path':_0xfd47be,..._0x1c42aa['randomId']===void 0x0?{}:{'randomId':_0x1c42aa['randomId']},..._0x1c42aa[_0x5d120f(0xcb)]===void 0x0?{}:{'stateIo':_0x1c42aa['stateIo']}});if(_0x2f70ba[_0x5d120f(0xd8)]===void 0x0)return{'reason':'state-unavailable','status':_0x5d120f(0xde)};if(_0x1c42aa[_0x5d120f(0xa9)]===_0x5d120f(0xb7)&&_0x2f70ba[_0x5d120f(0xd8)][_0x5d120f(0xd9)][_0x5d120f(0xb7)]!==void 0x0)return{'reason':_0x5d120f(0xb5),'status':_0x5d120f(0xde)};let _0x270ca0=S({'buildInfo':_0x12684e,'eventName':_0x1c42aa[_0x5d120f(0xa9)],'now':_0x216adf,'state':_0x2f70ba['state']});await x({'path':_0xfd47be,'state':_0x270ca0,..._0x1c42aa[_0x5d120f(0xcb)]===void 0x0?{}:{'stateIo':_0x1c42aa[_0x5d120f(0xcb)]}});let _0x2794c2=C({'buildInfo':_0x12684e,'env':_0x2c4340,'eventName':_0x1c42aa[_0x5d120f(0xa9)],'eventSource':_0x1c42aa[_0x5d120f(0xe9)],'manifest':_0x44d29c,'state':_0x270ca0});try{return await(_0x1c42aa[_0x5d120f(0xb3)]??new O())[_0x5d120f(0xf3)]({'capture':_0x2794c2,'config':_0x1859c6}),{'status':_0x5d120f(0xaf)};}catch{return{'reason':_0x5d120f(0xfb),'status':_0x5d120f(0xde)};}}async function m(_0x58cbc7={}){const _0x8803a8=_0x2536;return await p({..._0x58cbc7,'eventName':_0x8803a8(0xb2),'eventSource':_0x8803a8(0xc9)});}async function h(_0x254c95={}){const _0xeefe8f=_0x2536;return await p({..._0x254c95,'eventName':'cli_first_opened','eventSource':_0xeefe8f(0xad)});}function g(_0x5bd96d={}){const _0x1644af=_0x2536;let _0x176f92=(_0x5bd96d[_0x1644af(0xf2)]??process.env)[_0x1644af(0xe3)]?.['trim']();return _0xf59e61(_0x176f92&&_0x176f92['length']>0x0?_0x176f92:_0x6750df(_0x5bd96d[_0x1644af(0xe0)]??_0x314676(),_0x1644af(0xe6)),'telemetry',_0x1644af(0xee));}function _(_0x3b3d48={}){const _0x2496cf=_0x2536;return{'anonymousInstallId':_0x3b3d48[_0x2496cf(0xe8)]?.()??_0x460225(),'events':{},'version':0x1};}async function v(_0x43cc4d){const _0x2fd872=_0x2536;let _0x3322f7=_0x43cc4d[_0x2fd872(0xcb)]?.[_0x2fd872(0xd1)]??_0x2e8f03;try{return{'state':y(await _0x3322f7(_0x43cc4d[_0x2fd872(0xae)],_0x2fd872(0xbf)))};}catch{return{'state':_({..._0x43cc4d[_0x2fd872(0xe8)]===void 0x0?{}:{'randomId':_0x43cc4d[_0x2fd872(0xe8)]}})};}}function y(_0x5c4dda){const _0x2db1af=_0x2536;let _0x5bd11c=JSON[_0x2db1af(0xf8)](_0x5c4dda);if(!I(_0x5bd11c)||_0x5bd11c[_0x2db1af(0xd6)]!==0x1)throw Error(_0x2db1af(0xeb));if(typeof _0x5bd11c[_0x2db1af(0xdb)]!=_0x2db1af(0xfa)||_0x5bd11c[_0x2db1af(0xdb)]['length']===0x0)throw Error(_0x2db1af(0xa7));let _0x2b9dec=I(_0x5bd11c[_0x2db1af(0xd9)])?_0x5bd11c['events']:{};return{'anonymousInstallId':_0x5bd11c['anonymousInstallId'],'events':{...M(_0x2b9dec['cli_installed'],_0x2db1af(0xb2)),...M(_0x2b9dec['cli_first_opened'],_0x2db1af(0xb7))},'version':0x1};}function b(_0x4abacb){const _0x1b4821=_0x2536;return JSON[_0x1b4821(0xb0)](_0x4abacb,null,0x2)+'\x0a';}async function x(_0x11e081){const _0x4c94fe=_0x2536;let _0x5e90eb=_0x11e081['stateIo']?.[_0x4c94fe(0xe7)]??_0x508995,_0x467a78=_0x11e081[_0x4c94fe(0xcb)]?.['rename']??_0x39eee6,_0xd54e29=_0x11e081[_0x4c94fe(0xae)]+'.'+process[_0x4c94fe(0xb1)]+'.'+Date[_0x4c94fe(0xd3)]()+_0x4c94fe(0xe2);try{await _0x4e4fcb(_0x249ef1(_0x11e081[_0x4c94fe(0xae)]),{'mode':0x1c0,'recursive':!0x0}),await _0x5e90eb(_0xd54e29,b(_0x11e081[_0x4c94fe(0xd8)]),{'encoding':'utf8','mode':0x180}),await _0x467a78(_0xd54e29,_0x11e081[_0x4c94fe(0xae)]);}catch{}}function _0x5495(){const _0x13f49d=['UNIVER_HOME','length','1855527hnhQHH','.univer','writeFile','randomId','eventSource','test','Invalid\x20product\x20telemetry\x20state\x20version.','mode','isSafeInteger','state.json','trim','attemptedAt','versions','env','capture','object','117880HmlZOo','281632ozijtm','status','parse','name','string','capture-failed','12145941GvNSvL','10WhGdfW','unknown','0.0.0','bun','Invalid\x20product\x20telemetry\x20anonymous\x20install\x20id.','manifest','eventName','argv','public-npm','npm_execpath','cli-startup','path','captured','stringify','pid','cli_installed','transport','36XJpNBj','already-attempted','https://univer.ai/api/telemetry/cli','cli_first_opened','npm','23343320HatsDU','not-packaged','internal','commitHash','packageRoot','package.json','utf8','45IBjaZi','UNIVER_MANAGED_BY_NPM','endpoint','node','9575832PGkKym','npm_config_user_agent','univer-cli','statePath','arch','postinstall','distinctId','stateIo','buildInfo','first-open','toISOString','UNIVER_MANAGED_BY_BUN','cliVersion','readFile','config','now','buildCommit','yarn','version','576446yGNxAS','state','events','development-build','anonymousInstallId','2ZtUklK','event','skipped','CLI\x20telemetry\x20proxy\x20failed\x20with\x20status\x20','homeDir','missing-endpoint','.tmp'];_0x5495=function(){return _0x13f49d;};return _0x5495();}function S(_0xcc77b0){const _0x467fcd=_0x2536;return{..._0xcc77b0[_0x467fcd(0xd8)],'events':{..._0xcc77b0[_0x467fcd(0xd8)]['events'],[_0xcc77b0[_0x467fcd(0xa9)]]:{'attemptedAt':_0xcc77b0['now'][_0x467fcd(0xce)](),'buildCommit':_0xcc77b0[_0x467fcd(0xcc)]['commitHash'],'cliVersion':_0xcc77b0[_0x467fcd(0xcc)][_0x467fcd(0xd6)]}}};}function C(_0xf6d1d6){const _0x3fee62=_0x2536;return{'distinctId':_0xf6d1d6[_0x3fee62(0xd8)][_0x3fee62(0xdb)],'event':_0xf6d1d6[_0x3fee62(0xa9)],'properties':w(_0xf6d1d6)};}function w(_0x38aa0f){const _0x96c86e=_0x2536;return{'arch':process[_0x96c86e(0xc8)],'build_commit':_0x38aa0f[_0x96c86e(0xcc)][_0x96c86e(0xbc)],'cli_version':_0x38aa0f[_0x96c86e(0xcc)][_0x96c86e(0xd6)],'distribution_channel':A(_0x38aa0f[_0x96c86e(0xa8)]),'event_source':_0x38aa0f[_0x96c86e(0xe9)],'install_manager':T(_0x38aa0f[_0x96c86e(0xf2)]??process.env),'node_major_version':N(process[_0x96c86e(0xf1)][_0x96c86e(0xc3)]),'package_name':k(_0x38aa0f[_0x96c86e(0xa8)]),'platform':_0x3556ce(),'telemetry_state_version':0x1};}function T(_0x4e29ba=process.env){const _0x36aed1=_0x2536;let _0x1c9195=process[_0x36aed1(0xf1)];if(typeof _0x1c9195['bun']=='string'&&_0x1c9195['bun'][_0x36aed1(0xe4)]>0x0)return'bun';let _0x1e4e97=_0x4e29ba[_0x36aed1(0xc5)]??'';if(/\bbun\//u[_0x36aed1(0xea)](_0x1e4e97))return _0x36aed1(0x100);if(/\bpnpm\//u[_0x36aed1(0xea)](_0x1e4e97))return'pnpm';if(/\byarn\//u[_0x36aed1(0xea)](_0x1e4e97))return _0x36aed1(0xd5);if(/\bnpm\//u[_0x36aed1(0xea)](_0x1e4e97))return _0x36aed1(0xb8);let _0x13c004=_0x4e29ba[_0x36aed1(0xac)]??'';return/(^|[/\\])bun(?:\.exe)?$/u['test'](_0x13c004)?'bun':/(^|[/\\])pnpm(?:\.cmd|\.ps1|\.exe)?$/u[_0x36aed1(0xea)](_0x13c004)?'pnpm':/(^|[/\\])yarn(?:\.cmd|\.ps1|\.exe)?$/u['test'](_0x13c004)?'yarn':/(^|[/\\])npm(?:\.cmd|\.ps1|\.exe)?$/u['test'](_0x13c004)?_0x36aed1(0xb8):_0x4e29ba[_0x36aed1(0xcf)]==='1'?_0x36aed1(0x100):_0x4e29ba[_0x36aed1(0xc1)]==='1'?_0x36aed1(0xb8):_0x36aed1(0xfe);}async function E(_0x562ad8){const _0x2fa7ab=_0x2536;try{let _0x2ecd4f=await _0x2e8f03(_0x6750df(_0x562ad8,_0x2fa7ab(0xbb),'product-telemetry.json'),_0x2fa7ab(0xbf));return D(JSON[_0x2fa7ab(0xf8)](_0x2ecd4f));}catch{return D({});}}function D(_0x369245){const _0x3b6b64=_0x2536;let _0x2987ed=I(_0x369245)?_0x369245:{};return{'endpoint':P(_0x2987ed['endpoint'],_0x3b6b64(0xb6)),'timeoutMs':F(_0x2987ed['timeoutMs'],0x1388)};}var O=class{async[_0x46143c(0xf3)](_0x1b299d){const _0x483751=_0x46143c;let _0x1fcfca=await fetch(_0x1b299d['config']['endpoint'],{'body':JSON[_0x483751(0xb0)]({'distinctId':_0x1b299d[_0x483751(0xf3)][_0x483751(0xca)],'event':_0x1b299d[_0x483751(0xf3)][_0x483751(0xdd)],'properties':_0x1b299d[_0x483751(0xf3)]['properties']}),'headers':{'content-type':'application/json'},'method':'POST','signal':AbortSignal['timeout'](_0x1b299d['config']['timeoutMs'])});if(!_0x1fcfca['ok'])throw Error(_0x483751(0xdf)+_0x1fcfca[_0x483751(0xf7)]);}};function k(_0x2319b6){const _0x19d2a0=_0x46143c;try{let _0x31697b=JSON[_0x19d2a0(0xf8)](_0x3e2942(_0x6750df(_0x2319b6[_0x19d2a0(0xbd)],_0x19d2a0(0xbe)),_0x19d2a0(0xbf)));return typeof _0x31697b[_0x19d2a0(0xf9)]==_0x19d2a0(0xfa)&&_0x31697b['name'][_0x19d2a0(0xef)]()[_0x19d2a0(0xe4)]>0x0?_0x31697b[_0x19d2a0(0xf9)]:_0x19d2a0(0xc6);}catch{return _0x19d2a0(0xc6);}}function A(_0x5da9b0){const _0x469d7d=_0x46143c;let _0x3814ad=k(_0x5da9b0);return _0x3814ad==='@dream-num/univer-cli'?'internal-github':_0x3814ad==='univer-cli'?_0x469d7d(0xab):_0x5da9b0[_0x469d7d(0xec)];}function j(_0x41fa06){const _0x348c38=_0x46143c;return _0x41fa06[_0x348c38(0xd6)]===_0x348c38(0xff);}function M(_0xd73c4d,_0x3b48ca){const _0x172486=_0x46143c;return!I(_0xd73c4d)||typeof _0xd73c4d[_0x172486(0xf0)]!=_0x172486(0xfa)||typeof _0xd73c4d[_0x172486(0xd4)]!=_0x172486(0xfa)||typeof _0xd73c4d[_0x172486(0xd0)]!=_0x172486(0xfa)?{}:{[_0x3b48ca]:{'attemptedAt':_0xd73c4d[_0x172486(0xf0)],'buildCommit':_0xd73c4d[_0x172486(0xd4)],'cliVersion':_0xd73c4d[_0x172486(0xd0)]}};}function N(_0x52ded3){const _0x42993a=_0x46143c;let _0x593ee2=Number(_0x52ded3['split']('.')[0x0]);return Number[_0x42993a(0xed)](_0x593ee2)&&_0x593ee2>0x0?_0x593ee2:void 0x0;}function P(_0x287b20,_0x4c5d9e){const _0x52b11d=_0x46143c;return typeof _0x287b20==_0x52b11d(0xfa)&&_0x287b20[_0x52b11d(0xef)]()[_0x52b11d(0xe4)]>0x0?_0x287b20['trim']():_0x4c5d9e;}function F(_0x28b114,_0x2de87c){const _0x5ad2b5=_0x46143c;return typeof _0x28b114=='number'&&Number[_0x5ad2b5(0xed)](_0x28b114)&&_0x28b114>0x0?_0x28b114:_0x2de87c;}function _0x2536(_0x1a651f,_0x56cf74){_0x1a651f=_0x1a651f-0xa7;const _0x549561=_0x5495();let _0x2536ca=_0x549561[_0x1a651f];return _0x2536ca;}function I(_0x1414b2){const _0x3830fe=_0x46143c;return typeof _0x1414b2==_0x3830fe(0xf4)&&!!_0x1414b2;}var L=process[_0x46143c(0xaa)][0x2];try{L===_0x46143c(0xcd)?await h():L==='postinstall'&&await m();}catch{}
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "endpoint": "https://univer.ai/api/telemetry/cli",
3
- "timeoutMs": 750
3
+ "timeoutMs": 5000
4
4
  }
@@ -1 +1 @@
1
- const _0x1d97fe=_0x5741;(function(_0x1ce011,_0x4c0ad3){const _0x4e04ba=_0x5741,_0x408327=_0x1ce011();while(!![]){try{const _0x5ec859=parseInt(_0x4e04ba(0x8e))/0x1*(-parseInt(_0x4e04ba(0x9a))/0x2)+parseInt(_0x4e04ba(0xb0))/0x3*(-parseInt(_0x4e04ba(0xb1))/0x4)+-parseInt(_0x4e04ba(0xb4))/0x5+-parseInt(_0x4e04ba(0x9d))/0x6+parseInt(_0x4e04ba(0xac))/0x7+parseInt(_0x4e04ba(0x97))/0x8*(parseInt(_0x4e04ba(0xad))/0x9)+parseInt(_0x4e04ba(0x8c))/0xa;if(_0x5ec859===_0x4c0ad3)break;else _0x408327['push'](_0x408327['shift']());}catch(_0x506010){_0x408327['push'](_0x408327['shift']());}}}(_0x2c40,0x42440));import'../chunks/vendor-DHdfSSPw.js';import{t as _0x18ed3e}from'../chunks/headless-univer-DJXH7ZfL.js';import{n as _0x357112,o as _0x167590,t as _0x2dff01}from'../chunks/trace-DPfd8LdJ.js';let i=function(_0x1a0cef){const _0x158a56=_0x5741;return _0x1a0cef[_0x158a56(0x98)]=_0x158a56(0x9e),_0x1a0cef[_0x158a56(0xa3)]=_0x158a56(0x92),_0x1a0cef['ExportWorkbookFile']=_0x158a56(0x96),_0x1a0cef[_0x158a56(0x9b)]=_0x158a56(0x90),_0x1a0cef[_0x158a56(0xb5)]=_0x158a56(0xa6),_0x1a0cef[_0x158a56(0x99)]=_0x158a56(0x9f),_0x1a0cef;}({});var a=class{[_0x1d97fe(0xa8)]=Promise['resolve']();async[_0x1d97fe(0xb2)](_0x4f0542){const _0x2bb59f=_0x1d97fe;let _0xdf4c5d=this[_0x2bb59f(0xa8)],_0x17aee5;this[_0x2bb59f(0xa8)]=new Promise(_0x4a5ca9=>{_0x17aee5=_0x4a5ca9;}),await _0xdf4c5d;try{return await _0x4f0542();}finally{_0x17aee5?.();}}},o=_0x18ed3e(),s=new a();process['send']?.({'type':'ready'}),process['on'](_0x1d97fe(0x95),async _0x3dfc45=>{const _0x641970=_0x1d97fe;if(_0x3dfc45?.[_0x641970(0x8f)]!==_0x641970(0xae))return;let _0x564a99=await c(_0x3dfc45['data']);process['send']?.({'type':'rpc-response','id':_0x3dfc45['id'],'data':_0x564a99});}),process['on'](_0x1d97fe(0xa0),()=>{const _0x13dbe4=_0x1d97fe;o[_0x13dbe4(0xa1)](),process['exit'](0x0);}),process['on']('SIGTERM',()=>{const _0x43def1=_0x1d97fe;o[_0x43def1(0xa1)](),process[_0x43def1(0xb6)](0x0);});function _0x5741(_0x5b96a4,_0x54eaec){_0x5b96a4=_0x5b96a4-0x8b;const _0x2c40d3=_0x2c40();let _0x574149=_0x2c40d3[_0x5b96a4];return _0x574149;}async function c(_0x613df8){const _0x3c8a36=_0x1d97fe;let _0x1847da=_0x2dff01(_0x613df8[_0x3c8a36(0xa5)]?.[_0x3c8a36(0xb7)]),_0x758939=async()=>await _0x357112[_0x3c8a36(0x93)]({'name':_0x167590[_0x3c8a36(0xa2)],'kind':'server'},async()=>await l(_0x613df8));return _0x1847da===void 0x0?await _0x758939():await _0x357112[_0x3c8a36(0xa9)](_0x1847da,_0x758939);}async function l(_0x4c4c8a){const _0x551bb5=_0x1d97fe;try{switch(_0x4c4c8a[_0x551bb5(0x91)]){case i[_0x551bb5(0x98)]:{let _0xd06d97=o[_0x551bb5(0x9e)](_0x4c4c8a[_0x551bb5(0x8d)]??{});return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'result':{'success':!0x0,'workbookData':_0xd06d97}};}case i[_0x551bb5(0xb5)]:{let _0x351818=o[_0x551bb5(0xab)](_0x4c4c8a['params']['workbookData']);return{'jsonrpc':'2.0','id':_0x4c4c8a['id'],'result':{'success':!0x0,'workbookData':_0x351818}};}case i[_0x551bb5(0x99)]:{let _0x358541=await o[_0x551bb5(0x9f)](_0x4c4c8a[_0x551bb5(0x8d)]);return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'result':{'success':!0x0,'workbookData':_0x358541}};}case i[_0x551bb5(0x9b)]:return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'result':{'success':!0x0,'workbookData':o[_0x551bb5(0x90)]()}};case i[_0x551bb5(0xa7)]:{let _0x1545ec=_0x4c4c8a[_0x551bb5(0x8d)],_0x11db0d=await o[_0x551bb5(0x96)](_0x1545ec[_0x551bb5(0x94)],_0x1545ec['format']);return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'result':{'success':!0x0,..._0x11db0d}};}case i[_0x551bb5(0xa3)]:{let _0x533081=_0x4c4c8a['params']??{},_0x461147=async()=>{const _0x5f0ca8=_0x551bb5;let _0x2e0999=_0x533081[_0x5f0ca8(0xa4)]?await o['evalJsWithMutationCapture'](_0x533081[_0x5f0ca8(0x9c)]):{'value':await o[_0x5f0ca8(0x8b)](_0x533081[_0x5f0ca8(0x9c)]),'mutations':void 0x0};return{'success':!0x0,..._0x2e0999[_0x5f0ca8(0xaf)]===void 0x0?{}:{'mutations':_0x2e0999[_0x5f0ca8(0xaf)]},'value':_0x2e0999[_0x5f0ca8(0xaa)]};},_0x37960b=_0x533081['mutates']?await s['enqueue'](_0x461147):await _0x461147();return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'result':_0x37960b};}default:throw Error('Method\x20not\x20implemented:\x20'+String(_0x4c4c8a['method']));}}catch(_0x438f6f){return{'jsonrpc':_0x551bb5(0xb3),'id':_0x4c4c8a['id'],'error':{'code':-0x7f5b,'message':_0x438f6f instanceof Error?_0x438f6f['message']:String(_0x438f6f)}};}}function _0x2c40(){const _0x1ece24=['14248320hPIkng','params','32QZTNem','type','exportWorkbookData','method','evaljs','withSpan','outputPath','message','exportWorkbookFile','56bzgiyT','CreateWorkbook','LoadWorkbookDataReplayPack','15292eJAvOB','ExportWorkbookData','code','1574676HuCJxE','createWorkbook','loadWorkbookDataReplayPack','disconnect','dispose','RuntimeRpcClient','EvalJs','mutates','meta','loadWorkbook','ExportWorkbookFile','tail','withContext','value','loadWorkbookData','500633YjZIIc','202491DHAhDv','rpc-request','mutations','423PnODLm','12452bVcTqF','enqueue','2.0','2181845ePWtmn','LoadWorkbook','exit','traceparent','evalJs'];_0x2c40=function(){return _0x1ece24;};return _0x2c40();}
1
+ function _0x5020(){const _0x964391=['dispose','ready','format','RuntimeRpcClient','8529120DEonwI','126584fddIQM','1525910seSfsS','1489720FbAyUI','message','exit','mutations','params','method','Method\x20not\x20implemented:\x20','loadWorkbookDataReplayPack','meta','ExportWorkbookData','workbookData','enqueue','withContext','value','568739QsizTz','4678527sEuRYy','code','send','createWorkbook','6jctLOj','exportWorkbookData','CreateWorkbook','2.0','loadWorkbookData','69vrWGEe','server','exportWorkbookFile','1096168ICpBxq','evaljs','loadWorkbook','mutates','tail','disconnect','LoadWorkbook','rpc-response','EvalJs','evalJs','LoadWorkbookDataReplayPack','type','ExportWorkbookFile'];_0x5020=function(){return _0x964391;};return _0x5020();}const _0x3c8ba0=_0x8a27;(function(_0x2dc1ea,_0x73692f){const _0x3b1eb2=_0x8a27,_0x307577=_0x2dc1ea();while(!![]){try{const _0x2cd219=-parseInt(_0x3b1eb2(0x1bb))/0x1+-parseInt(_0x3b1eb2(0x1c8))/0x2+parseInt(_0x3b1eb2(0x1c5))/0x3*(parseInt(_0x3b1eb2(0x1da))/0x4)+parseInt(_0x3b1eb2(0x1db))/0x5*(parseInt(_0x3b1eb2(0x1c0))/0x6)+-parseInt(_0x3b1eb2(0x1bc))/0x7+parseInt(_0x3b1eb2(0x1dc))/0x8+parseInt(_0x3b1eb2(0x1d9))/0x9;if(_0x2cd219===_0x73692f)break;else _0x307577['push'](_0x307577['shift']());}catch(_0x41b359){_0x307577['push'](_0x307577['shift']());}}}(_0x5020,0x5d337));import'../chunks/vendor-BzHSCzgc.js';import{t as _0x5df7dd}from'../chunks/headless-univer-BHRYaTxY.js';import{n as _0xe0f106,o as _0x3452bc,t as _0x5f2920}from'../chunks/trace-DPfd8LdJ.js';let i=function(_0x308c5b){const _0x44c6ab=_0x8a27;return _0x308c5b['CreateWorkbook']=_0x44c6ab(0x1bf),_0x308c5b['EvalJs']=_0x44c6ab(0x1c9),_0x308c5b[_0x44c6ab(0x1d4)]='exportWorkbookFile',_0x308c5b[_0x44c6ab(0x1b6)]=_0x44c6ab(0x1c1),_0x308c5b['LoadWorkbook']=_0x44c6ab(0x1ca),_0x308c5b[_0x44c6ab(0x1d2)]='loadWorkbookDataReplayPack',_0x308c5b;}({});var a=class{[_0x3c8ba0(0x1cc)]=Promise['resolve']();async[_0x3c8ba0(0x1b8)](_0x21bd7d){const _0x50c1df=_0x3c8ba0;let _0x1abbfe=this[_0x50c1df(0x1cc)],_0x5b3cac;this[_0x50c1df(0x1cc)]=new Promise(_0x5f2e0e=>{_0x5b3cac=_0x5f2e0e;}),await _0x1abbfe;try{return await _0x21bd7d();}finally{_0x5b3cac?.();}}},o=_0x5df7dd(),s=new a();process[_0x3c8ba0(0x1be)]?.({'type':_0x3c8ba0(0x1d6)}),process['on'](_0x3c8ba0(0x1dd),async _0x4bb55e=>{const _0x2c9ec2=_0x3c8ba0;if(_0x4bb55e?.[_0x2c9ec2(0x1d3)]!=='rpc-request')return;let _0x46e2f7=await c(_0x4bb55e['data']);process[_0x2c9ec2(0x1be)]?.({'type':_0x2c9ec2(0x1cf),'id':_0x4bb55e['id'],'data':_0x46e2f7});}),process['on'](_0x3c8ba0(0x1cd),()=>{const _0x4d42f1=_0x3c8ba0;o[_0x4d42f1(0x1d5)](),process[_0x4d42f1(0x1de)](0x0);}),process['on']('SIGTERM',()=>{const _0x2b71df=_0x3c8ba0;o['dispose'](),process[_0x2b71df(0x1de)](0x0);});function _0x8a27(_0x1a5f35,_0x18bd94){_0x1a5f35=_0x1a5f35-0x1b5;const _0x502017=_0x5020();let _0x8a27ff=_0x502017[_0x1a5f35];return _0x8a27ff;}async function c(_0x510dea){const _0x4774f2=_0x3c8ba0;let _0x2c7596=_0x5f2920(_0x510dea[_0x4774f2(0x1b5)]?.['traceparent']),_0x28c23c=async()=>await _0xe0f106['withSpan']({'name':_0x3452bc[_0x4774f2(0x1d8)],'kind':_0x4774f2(0x1c6)},async()=>await l(_0x510dea));return _0x2c7596===void 0x0?await _0x28c23c():await _0xe0f106[_0x4774f2(0x1b9)](_0x2c7596,_0x28c23c);}async function l(_0x2a6869){const _0x1405b8=_0x3c8ba0;try{switch(_0x2a6869[_0x1405b8(0x1e1)]){case i[_0x1405b8(0x1c2)]:{let _0x2ebea2=o[_0x1405b8(0x1bf)](_0x2a6869[_0x1405b8(0x1e0)]??{});return{'jsonrpc':'2.0','id':_0x2a6869['id'],'result':{'success':!0x0,'workbookData':_0x2ebea2}};}case i[_0x1405b8(0x1ce)]:{let _0x4e1002=o[_0x1405b8(0x1c4)](_0x2a6869[_0x1405b8(0x1e0)][_0x1405b8(0x1b7)]);return{'jsonrpc':_0x1405b8(0x1c3),'id':_0x2a6869['id'],'result':{'success':!0x0,'workbookData':_0x4e1002}};}case i['LoadWorkbookDataReplayPack']:return await o[_0x1405b8(0x1e3)](_0x2a6869[_0x1405b8(0x1e0)]),{'jsonrpc':'2.0','id':_0x2a6869['id'],'result':{'success':!0x0}};case i[_0x1405b8(0x1b6)]:return{'jsonrpc':'2.0','id':_0x2a6869['id'],'result':{'success':!0x0,'workbookData':o[_0x1405b8(0x1c1)]()}};case i[_0x1405b8(0x1d4)]:{let _0x4fece9=_0x2a6869[_0x1405b8(0x1e0)],_0x5d71c0=await o[_0x1405b8(0x1c7)](_0x4fece9['outputPath'],_0x4fece9[_0x1405b8(0x1d7)]);return{'jsonrpc':_0x1405b8(0x1c3),'id':_0x2a6869['id'],'result':{'success':!0x0,..._0x5d71c0}};}case i[_0x1405b8(0x1d0)]:{let _0xc3272a=_0x2a6869[_0x1405b8(0x1e0)]??{},_0x12c4f5=async()=>{const _0x4369b2=_0x1405b8;let _0x37a51d=_0xc3272a[_0x4369b2(0x1cb)]?await o['evalJsWithMutationCapture'](_0xc3272a['code']):{'value':await o[_0x4369b2(0x1d1)](_0xc3272a[_0x4369b2(0x1bd)]),'mutations':void 0x0};return{'success':!0x0,..._0x37a51d[_0x4369b2(0x1df)]===void 0x0?{}:{'mutations':_0x37a51d[_0x4369b2(0x1df)]},'value':_0x37a51d[_0x4369b2(0x1ba)]};},_0x5ef584=_0xc3272a[_0x1405b8(0x1cb)]?await s[_0x1405b8(0x1b8)](_0x12c4f5):await _0x12c4f5();return{'jsonrpc':'2.0','id':_0x2a6869['id'],'result':_0x5ef584};}default:throw Error(_0x1405b8(0x1e2)+String(_0x2a6869[_0x1405b8(0x1e1)]));}}catch(_0x529381){return{'jsonrpc':_0x1405b8(0x1c3),'id':_0x2a6869['id'],'error':{'code':-0x7f5b,'message':_0x529381 instanceof Error?_0x529381[_0x1405b8(0x1dd)]:String(_0x529381)}};}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "univer-cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Command-line tools for local Univer workbook automation.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,19 +43,140 @@ univer run ./sales.univer --code 'async () => {
43
43
 
44
44
  `ChartType.Column` is the common column chart enum value. Other enum values are available from `univerAPI.Enum.ChartType`.
45
45
 
46
+ ## Chart Type Enum Values
47
+
48
+ Use `univerAPI.Enum.ChartType.<Name>` with `setChartType()` when building chart metadata.
49
+
50
+ ```javascript
51
+ const chartInfo = sheet
52
+ .newChart()
53
+ .setChartType(univerAPI.Enum.ChartType.Column)
54
+ .addRange("A1:C4")
55
+ .build();
56
+ ```
57
+
58
+ Available chart type enum values:
59
+
60
+ | Facade enum value | Chart type |
61
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------ |
62
+ | `univerAPI.Enum.ChartType.None` | No chart type. This is a sentinel value and should not be used for normal chart insertion. |
63
+ | `univerAPI.Enum.ChartType.Line` | Line chart |
64
+ | `univerAPI.Enum.ChartType.Column` | Column chart |
65
+ | `univerAPI.Enum.ChartType.ColumnStacked` | Stacked column chart |
66
+ | `univerAPI.Enum.ChartType.ColumnPercentStacked` | Percent stacked column chart |
67
+ | `univerAPI.Enum.ChartType.Bar` | Bar chart |
68
+ | `univerAPI.Enum.ChartType.BarStacked` | Stacked bar chart |
69
+ | `univerAPI.Enum.ChartType.BarPercentStacked` | Percent stacked bar chart |
70
+ | `univerAPI.Enum.ChartType.Pie` | Pie chart |
71
+ | `univerAPI.Enum.ChartType.Doughnut` | Doughnut chart |
72
+ | `univerAPI.Enum.ChartType.Area` | Area chart |
73
+ | `univerAPI.Enum.ChartType.AreaStacked` | Stacked area chart |
74
+ | `univerAPI.Enum.ChartType.AreaPercentStacked` | Percent stacked area chart |
75
+ | `univerAPI.Enum.ChartType.Radar` | Radar chart |
76
+ | `univerAPI.Enum.ChartType.Scatter` | Scatter chart |
77
+ | `univerAPI.Enum.ChartType.Combination` | Combination chart |
78
+ | `univerAPI.Enum.ChartType.WordCloud` | Word cloud chart |
79
+ | `univerAPI.Enum.ChartType.Funnel` | Funnel chart |
80
+ | `univerAPI.Enum.ChartType.Bubble` | Bubble chart |
81
+ | `univerAPI.Enum.ChartType.Relation` | Relationship diagram |
82
+ | `univerAPI.Enum.ChartType.Waterfall` | Waterfall chart |
83
+ | `univerAPI.Enum.ChartType.Pareto` | Pareto chart |
84
+ | `univerAPI.Enum.ChartType.Sankey` | Sankey chart |
85
+ | `univerAPI.Enum.ChartType.Heatmap` | Heatmap chart |
86
+ | `univerAPI.Enum.ChartType.Boxplot` | Box plot chart |
87
+
88
+ ## Chart Facade Enum Examples
89
+
90
+ The chart facade also exposes option enums through `univerAPI.Enum`. Use these with specialized builder methods or `setOptions(path, value)`.
91
+
92
+ ```javascript
93
+ const chartInfo = sheet
94
+ .newChart()
95
+ .asLineChart()
96
+ .addRange("A1:D6")
97
+ .setPosition(1, 4, 0, 0)
98
+ .setOptions("title.position", univerAPI.Enum.TitlePositionEnum.Top)
99
+ .setOptions("legend.position", univerAPI.Enum.LegendPositionEnum.Right)
100
+ .setOptions("legend.selectMode", univerAPI.Enum.SelectModeEnum.Multiple)
101
+ .setXAxisTextStyle({
102
+ content: "Month",
103
+ axisAlignment: univerAPI.Enum.AxisAlignEnum.End
104
+ })
105
+ .setAxisPointerStyle({
106
+ indicatorLineType: univerAPI.Enum.ChartBorderDashType.Dashed,
107
+ indicatorLineColor: "#1677ff",
108
+ indicatorLabelColor: "#e6f4ff",
109
+ indicatorLabelTextColor: "#0958d9"
110
+ })
111
+ .setDataPointShape(univerAPI.Enum.LinePointShape.Circle)
112
+ .build();
113
+ ```
114
+
115
+ Common chart facade enums:
116
+
117
+ | Facade enum | Example values | Typical use |
118
+ | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
119
+ | `univerAPI.Enum.LegendPositionEnum` | `Top`, `Bottom`, `Left`, `Right`, `Hide` | `setOptions("legend.position", value)` |
120
+ | `univerAPI.Enum.SelectModeEnum` | `Single`, `Multiple`, `Close` | `setOptions("legend.selectMode", value)` |
121
+ | `univerAPI.Enum.TitlePositionEnum` | `Top`, `Bottom`, `Left`, `Right`, `Hide` | `setOptions("title.position", value)` |
122
+ | `univerAPI.Enum.AxisAlignEnum` | `Start`, `Center`, `End` | `setXAxisTextStyle({ axisAlignment: value })`, `setYAxisTextStyle({ axisAlignment: value })` |
123
+ | `univerAPI.Enum.ChartBorderDashType` | `Solid`, `Dashed`, `Dotted` | `setAxisPointerStyle({ indicatorLineType: value })`, series border `dashType` |
124
+ | `univerAPI.Enum.LinePointShape` | `Circle`, `Square`, `Triangle`, `Diamond`, `Rect`, `RoundRect`, `Pin`, `Arrow`, `None`, `EmptyCircle`, `EmptySquare`, `EmptyTriangle`, `EmptyDiamond`, `EmptyRect`, `EmptyRoundRect`, `EmptyPin`, `EmptyArrow` | `setDataPointShape(value)` |
125
+ | `univerAPI.Enum.RadarShape` | `Polygon`, `Circle` | `asRadarChart().setShape(value)` |
126
+
46
127
  ## Chart Builder
47
128
 
48
- Common builder calls:
129
+ `sheet.newChart()` returns the shared chart builder. The builder only prepares chart metadata. `build()` does not draw anything by itself; insert a new chart with `insertChart(chartInfo)` or update an existing chart with `updateChart(chartInfo)`.
130
+
131
+ Core builder methods:
49
132
 
133
+ - `getChartType()` returns the chart type currently configured on the builder.
50
134
  - `setChartType(univerAPI.Enum.ChartType.Column)` chooses the chart type.
51
135
  - `addRange("A1:C4")` binds the source range. A sheet-qualified range can target another sheet.
136
+ - `clearRange()` removes the current source range from the builder.
52
137
  - `setPosition(row, column, rowOffset, columnOffset)` anchors the chart to the grid.
53
138
  - `setAbsolutePosition(x, y)` places the chart by absolute canvas coordinates.
54
139
  - `setWidth(width)` and `setHeight(height)` set the rendered chart size.
55
- - `setOptions(path, value)` sets chart options such as `title.content` or `legend.position`.
56
140
  - `setTransposeRowsAndColumns(true)` swaps the category and series orientation.
141
+ - `build()` returns chart metadata for `insertChart(chartInfo)` or `updateChart(chartInfo)`.
142
+
143
+ Option and style methods:
144
+
145
+ - `setOptions(path, value)` sets a nested chart option such as `title.content`, `title.position`, `legend.position`, or `legend.selectMode`. Use an empty path, `setOptions("", options)`, to merge a root options object.
146
+ - `setTheme(themeName)` applies a registered chart theme.
147
+ - `setXAxisTitle(title)`, `setYAxisTitle(title)`, and `setRightYAxisTitle(title)` set axis title text.
148
+ - `setXAxisTextStyle(style)`, `setYAxisTextStyle(style)`, and `setRightYAxisTextStyle(style)` set axis title text style. Use `axisAlignment: univerAPI.Enum.AxisAlignEnum.End` for axis-title alignment.
149
+ - `setInvalidValueStrategy(univerAPI.Enum.InvalidValueType.Zero)` controls how line-like charts handle invalid values. Common values are `Zero`, `Break`, and `Link`.
150
+ - `setAxisPointerStyle(style)` configures axis pointer labels and line style. Use `univerAPI.Enum.ChartBorderDashType` for `indicatorLineType`.
151
+ - `setAllSeriesStyle(style)` applies style defaults across all series.
152
+ - `setSeriesStyle(index, style)` applies style to one series. Use `chart.getSeriesData()` readback to find stable series indexes when updating an existing chart.
153
+
154
+ Specialized builder entrypoints:
155
+
156
+ - `asLineChart()` returns a `LineChartBuilder`.
157
+ - `asPieChart()` returns a `PieChartBuilder`.
158
+ - `asRadarChart()` returns a `RadarChartBuilder`.
159
+
160
+ Line chart builder methods:
161
+
162
+ - `setLineStyle("line" | "smooth" | "step")` controls line interpolation.
163
+ - `setDataPointShape(univerAPI.Enum.LinePointShape.Circle)` sets the marker shape.
164
+ - `setDataPointColor(color)` sets marker color.
165
+ - `setDataPointSize(size)` sets marker size.
166
+
167
+ Pie chart builder methods:
168
+
169
+ - `setDoughnutHole(value)` sets the center hole size from `0` to `1`.
170
+ - `setBorderColor(color)` sets pie border color.
171
+ - `setHasPaddingAngle(true)` enables slice padding.
172
+ - `setIsHalfPie(true)` renders a half pie.
173
+ - `setRosePie(true)` renders a rose pie.
174
+ - `setShowLabelLine(true)` toggles label leader lines.
175
+
176
+ Radar chart builder methods:
57
177
 
58
- The builder only prepares chart metadata. `build()` does not draw anything by itself; insert a new chart with `insertChart(chartInfo)` or update an existing chart with `updateChart(chartInfo)`.
178
+ - `setShape(univerAPI.Enum.RadarShape.Polygon)` sets the radar shape. Common values are `Polygon` and `Circle`.
179
+ - `setFill(true)` fills the radar area.
59
180
 
60
181
  ## Source Data Shapes
61
182
 
@@ -125,7 +246,7 @@ const chartInfo = sheet
125
246
  .addRange("A1:D6")
126
247
  .setPosition(1, 4, 0, 0)
127
248
  .setLineStyle("step")
128
- .setDataPointShape(univerAPI.Enum.LinePointShape.CIRCLE)
249
+ .setDataPointShape(univerAPI.Enum.LinePointShape.Circle)
129
250
  .setDataPointColor("#ff0000")
130
251
  .setDataPointSize(10)
131
252
  .build();
@@ -0,0 +1,207 @@
1
+ # Images
2
+
3
+ Images are workbook-local worksheet resources. Use `univer run` to create or maintain floating images through the Sheets Drawing facade, then use facade readback to verify command-line results.
4
+
5
+ This topic covers floating images only. It does not cover cell images, floating DOM, screenshot export, local image upload helpers, or a top-level `univer image` command.
6
+
7
+ For visual verification, open the workbook with `univer view`.
8
+
9
+ ## Core Workflow
10
+
11
+ Look up the workbook and worksheet, configure a floating image builder with `newOverGridImage()`, call `buildAsync()`, then pass the result to `insertImages([image])`.
12
+
13
+ ```bash
14
+ univer run ./report.univer --code 'async () => {
15
+ const workbook = univerAPI.getActiveWorkbook();
16
+ const sheet = workbook.getSheetByName("Sheet1");
17
+ if (!sheet) return { success: false, error: "Sheet1 not found" };
18
+
19
+ const image = await sheet
20
+ .newOverGridImage()
21
+ .setSource("https://example.com/logo.png", univerAPI.Enum.ImageSourceType.URL)
22
+ .setColumn(5)
23
+ .setRow(5)
24
+ .setColumnOffset(10)
25
+ .setRowOffset(10)
26
+ .setWidth(240)
27
+ .setHeight(120)
28
+ .setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Position)
29
+ .buildAsync();
30
+
31
+ sheet.insertImages([image]);
32
+ const [inserted] = sheet.getImages();
33
+
34
+ return {
35
+ success: true,
36
+ imageCount: sheet.getImages().length,
37
+ imageId: inserted?.getId()
38
+ };
39
+ }'
40
+ ```
41
+
42
+ `ImageSourceType.URL` is the common source type for web and data URLs. Other enum values are available from `univerAPI.Enum.ImageSourceType`.
43
+
44
+ ## Image Builder
45
+
46
+ Common builder calls:
47
+
48
+ - `setSource(source, univerAPI.Enum.ImageSourceType.URL)` sets the image source.
49
+ - `setColumn(column)` and `setRow(row)` set the zero-based grid anchor.
50
+ - `setColumnOffset(offset)` and `setRowOffset(offset)` set pixel offsets from the anchor cell.
51
+ - `setWidth(width)` and `setHeight(height)` set the rendered image size in pixels.
52
+ - `setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Position)` controls whether position or size follows row and column changes.
53
+ - `setCropTop(top)`, `setCropLeft(left)`, `setCropBottom(bottom)`, and `setCropRight(right)` crop the visible source region.
54
+ - `setRotate(angle)` rotates the image.
55
+
56
+ The builder only prepares image metadata. `buildAsync()` resolves the image data needed by Univer; insert a new image with `insertImages([image])` or update an existing image with `updateImages([newImage])`.
57
+
58
+ ## Enum Usage
59
+
60
+ Use the source enum to describe how Univer should interpret the `source` argument:
61
+
62
+ - `univerAPI.Enum.ImageSourceType.URL`: use for HTTP(S) image URLs and full data URLs such as `data:image/png;base64,...` or `data:image/svg+xml;base64,...`.
63
+ - `univerAPI.Enum.ImageSourceType.BASE64`: use when `source` is the raw base64 payload without a `data:image/...;base64,` prefix.
64
+ - `univerAPI.Enum.ImageSourceType.UUID`: use when the image is already managed by Univer storage and the `source` is the existing image/file UUID. Do not use it for web URLs, data URLs, or raw base64 strings.
65
+
66
+ Source examples:
67
+
68
+ ```javascript
69
+ builder.setSource("https://example.com/logo.png", univerAPI.Enum.ImageSourceType.URL);
70
+ builder.setSource("data:image/png;base64,iVBORw0KGgo...", univerAPI.Enum.ImageSourceType.URL);
71
+ builder.setSource("iVBORw0KGgo...", univerAPI.Enum.ImageSourceType.BASE64);
72
+ builder.setSource("existing-image-file-uuid", univerAPI.Enum.ImageSourceType.UUID);
73
+ ```
74
+
75
+ Use the anchor enum to describe how the image follows sheet layout changes:
76
+
77
+ - `univerAPI.Enum.SheetDrawingAnchorType.Position`: keep the explicit position anchor. Use this for dashboards, logos, stamps, and screenshots where the image should stay at a chosen grid position with its configured size.
78
+ - `univerAPI.Enum.SheetDrawingAnchorType.Both`: follow both position and size changes from the surrounding sheet layout. Use this when the image should resize with row or column changes around its anchor area.
79
+ - `univerAPI.Enum.SheetDrawingAnchorType.None`: keep the image independent from row and column layout changes. Use this for absolute overlays or decorative assets that should not move or resize when the grid layout changes.
80
+
81
+ Anchor examples:
82
+
83
+ ```javascript
84
+ builder.setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Position); // common reports, logos, stamps
85
+ builder.setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.Both); // resize with the sheet layout
86
+ builder.setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.None); // absolute overlay independent of grid layout
87
+ ```
88
+
89
+ For most CLI-created floating images, start with `ImageSourceType.URL` for web or data URLs and `SheetDrawingAnchorType.Position` for predictable placement.
90
+
91
+ ## Simple Insert Shortcut
92
+
93
+ For simple URL images, `insertImage(url, column, row, offsetX, offsetY)` inserts directly and returns a boolean result.
94
+
95
+ ```javascript
96
+ const inserted = await sheet.insertImage("https://example.com/logo.png", 5, 5, 10, 10);
97
+ ```
98
+
99
+ Use `newOverGridImage()` when you need width, height, anchor, crop, rotate, or deterministic builder readback.
100
+
101
+ ## Readback And Maintenance
102
+
103
+ Use public facade APIs for stable command-line verification:
104
+
105
+ ```javascript
106
+ const images = sheet.getImages();
107
+ const image = images[0];
108
+
109
+ return {
110
+ imageCount: images.length,
111
+ imageId: image?.getId(),
112
+ source: image?.toBuilder().getSource(),
113
+ sourceType: image?.toBuilder().getSourceType()
114
+ };
115
+ ```
116
+
117
+ Useful readback and lookup APIs include:
118
+
119
+ - `getImages()` returns all floating images on the worksheet.
120
+ - `getImageById(id)` returns a single floating image facade object or `null`.
121
+ - `getActiveImages()` returns selected images when a selection exists.
122
+ - `image.getId()` returns the image drawing id.
123
+ - `image.toBuilder().getSource()` returns the current source.
124
+ - `image.toBuilder().getSourceType()` returns the current source type.
125
+
126
+ Avoid asserting private workbook resource storage. Prefer facade evidence such as image count, id, source, source type, and update results.
127
+
128
+ ## Update Image
129
+
130
+ To update via builder state, initialize from an existing image with `toBuilder()`, then call `updateImages([newImage])`.
131
+
132
+ ```bash
133
+ univer run ./report.univer --code 'async () => {
134
+ const workbook = univerAPI.getActiveWorkbook();
135
+ const sheet = workbook.getSheetByName("Sheet1");
136
+ if (!sheet) return { success: false, error: "Sheet1 not found" };
137
+
138
+ const image = sheet.getImages()[0];
139
+ if (!image) return { success: false, error: "No floating image found" };
140
+
141
+ const newImage = await image
142
+ .toBuilder()
143
+ .setWidth(120)
144
+ .setHeight(60)
145
+ .buildAsync();
146
+ sheet.updateImages([newImage]);
147
+
148
+ return {
149
+ success: true,
150
+ imageId: image.getId(),
151
+ imageCount: sheet.getImages().length
152
+ };
153
+ }'
154
+ ```
155
+
156
+ For direct updates, use methods on `FOverGridImage`:
157
+
158
+ ```javascript
159
+ const image = sheet.getImages()[0];
160
+ const resized = await image.setSizeAsync(120, 60);
161
+ const moved = await image.setPositionAsync(5, 5, 10, 10);
162
+ const sourceChanged = image.setSource(
163
+ "https://example.com/updated-logo.png",
164
+ univerAPI.Enum.ImageSourceType.URL
165
+ );
166
+ ```
167
+
168
+ ## Delete Image
169
+
170
+ To delete images in bulk, pass facade image objects to `deleteImages([image])`.
171
+
172
+ ```bash
173
+ univer run ./report.univer --code 'async () => {
174
+ const workbook = univerAPI.getActiveWorkbook();
175
+ const sheet = workbook.getSheetByName("Sheet1");
176
+ if (!sheet) return { success: false, error: "Sheet1 not found" };
177
+
178
+ const image = sheet.getImages()[0];
179
+ if (!image) {
180
+ return {
181
+ success: true,
182
+ removed: false,
183
+ remaining: 0
184
+ };
185
+ }
186
+
187
+ sheet.deleteImages([image]);
188
+
189
+ return {
190
+ success: true,
191
+ removed: true,
192
+ remaining: sheet.getImages().length
193
+ };
194
+ }'
195
+ ```
196
+
197
+ You can also call `remove()` on a single `FOverGridImage`:
198
+
199
+ ```javascript
200
+ const removed = sheet.getImages()[0]?.remove() ?? false;
201
+ ```
202
+
203
+ ## Headless And Viewer Boundary
204
+
205
+ Headless `univer run` scripts should verify floating images by reading facade state: `getImages()`, `getImageById(id)`, `getId()`, `toBuilder().getSource()`, and update or delete return values.
206
+
207
+ Browser rendering belongs to `univer view`, where the readonly workbook viewer loads Drawing UI plugins and paints the visible floating image surface.