@univer-cli/unit-screenshot-command 1.1.0 → 1.3.0
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.
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x4ce937,_0xa9e1a9){const _0x44026f=_0x3aab,_0x315562=_0x4ce937();while(!![]){try{const _0x20211b=parseInt(_0x44026f(0x1fb))/0x1*(-parseInt(_0x44026f(0x203))/0x2)+parseInt(_0x44026f(0x1e4))/0x3*(-parseInt(_0x44026f(0x1f8))/0x4)+parseInt(_0x44026f(0x218))/0x5*(parseInt(_0x44026f(0x1fa))/0x6)+-parseInt(_0x44026f(0x1ee))/0x7+-parseInt(_0x44026f(0x226))/0x8+parseInt(_0x44026f(0x1e8))/0x9+parseInt(_0x44026f(0x1dd))/0xa;if(_0x20211b===_0xa9e1a9)break;else _0x315562['push'](_0x315562['shift']());}catch(_0x547667){_0x315562['push'](_0x315562['shift']());}}}(_0x17bf,0x7a611));import{UnitScreenshotError as _0x2dec2b}from'@univer-cli/unit-screenshot';import{Command as _0x2f0895}from'commander';import{installUniverRenderBrowser as _0x22876c,probeUniverRenderBrowser as _0x56e01e,resolveUniverRenderBrowser as _0x22d258}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x22876c(),'probe':async _0x27a99f=>await _0x56e01e(_0x27a99f),'resolve':async()=>await _0x22d258()};function o(_0x1e3d69=a){const _0xc868d4=_0x3aab;let _0x1023e0=new _0x2f0895('setup')[_0xc868d4(0x211)](_0xc868d4(0x1de))['option'](_0xc868d4(0x1f0),_0xc868d4(0x1d3))[_0xc868d4(0x20c)]('--json',_0xc868d4(0x22a));return _0x1023e0['action'](async _0x206d65=>{const _0x1f2c78=_0xc868d4;l(_0x1023e0);let _0x3af706={..._0x1023e0[_0x1f2c78(0x243)](),..._0x206d65},_0x3c3cf2;try{_0x3c3cf2=await s(_0x1e3d69,_0x3af706['force']===!0x0);}catch(_0x3aea9e){u(_0x3aea9e)&&_0x1023e0[_0x1f2c78(0x234)](_0x3aea9e[_0x1f2c78(0x1d6)]+':\x20'+_0x3aea9e[_0x1f2c78(0x1cf)],{'code':_0x1f2c78(0x20f),'exitCode':0x1}),_0x1023e0[_0x1f2c78(0x234)](_0x3aea9e instanceof Error?_0x3aea9e['message']:_0x1f2c78(0x1eb),{'code':_0x1f2c78(0x20f),'exitCode':0x1});}let _0x317b60=_0x3af706[_0x1f2c78(0x209)]===!0x0?JSON[_0x1f2c78(0x1ed)]({'ok':!0x0,..._0x3c3cf2},null,0x2)+'\x0a':c(_0x3c3cf2);_0x1023e0[_0x1f2c78(0x207)]()[_0x1f2c78(0x235)]?.(_0x317b60);}),_0x1023e0;}async function s(_0x3ded41,_0x329d4f){const _0x5c5844=_0x3aab;if(!_0x329d4f){let _0x2c4f20=await _0x3ded41[_0x5c5844(0x227)]();if(_0x2c4f20['status']==='found')return await _0x3ded41['probe']({'executablePath':_0x2c4f20[_0x5c5844(0x224)]}),{'status':_0x5c5844(0x233),'executablePath':_0x2c4f20[_0x5c5844(0x224)],'source':_0x2c4f20[_0x5c5844(0x202)]};}let _0x182e8d=await _0x3ded41[_0x5c5844(0x1d8)]();return await _0x3ded41[_0x5c5844(0x1d0)]({'executablePath':_0x182e8d['executablePath']}),{'status':'installed',..._0x182e8d};}function c(_0x1c30c1){const _0x43c30a=_0x3aab;return _0x1c30c1['status']===_0x43c30a(0x233)?['usable\x20browser\x20found\x20('+_0x1c30c1[_0x43c30a(0x202)]+_0x43c30a(0x219)+_0x1c30c1[_0x43c30a(0x224)],'run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build',''][_0x43c30a(0x22e)]('\x0a'):[_0x1c30c1[_0x43c30a(0x212)]?_0x43c30a(0x220)+_0x1c30c1[_0x43c30a(0x224)]:_0x43c30a(0x1d2)+_0x1c30c1[_0x43c30a(0x224)],'build:\x20'+_0x1c30c1[_0x43c30a(0x215)],'cache:\x20'+_0x1c30c1[_0x43c30a(0x23c)],''][_0x43c30a(0x22e)]('\x0a');}function l(_0x248e36){const _0x3f48fa=_0x3aab;_0x248e36[_0x3f48fa(0x22f)]!==null&&_0x248e36[_0x3f48fa(0x207)](_0x248e36[_0x3f48fa(0x22f)][_0x3f48fa(0x207)]());}function u(_0x59351d){const _0x5307d1=_0x3aab;return _0x59351d instanceof Error&&typeof _0x59351d[_0x5307d1(0x1d6)]=='string';}var d=0x2710,f=class extends Error{constructor(_0x2cedc3){const _0xaa460c=_0x3aab;super(_0x2cedc3),this['name']=_0xaa460c(0x200);}};function p(_0x138024){const _0x2523f1=_0x3aab;let _0xe59085=new _0x2f0895(_0x2523f1(0x1e0))[_0x2523f1(0x211)](_0x2523f1(0x1d1))[_0x2523f1(0x20c)](_0x2523f1(0x240),_0x2523f1(0x1e7))[_0x2523f1(0x20c)]('--pages\x20<pages>',_0x2523f1(0x223))[_0x2523f1(0x20c)](_0x2523f1(0x230),'Slide\x20overview\x20containing\x20all\x20captured\x20pages')[_0x2523f1(0x20c)](_0x2523f1(0x1e2),_0x2523f1(0x23a))[_0x2523f1(0x20c)](_0x2523f1(0x238),'Sheet\x20name\x20used\x20with\x20--range')[_0x2523f1(0x20c)](_0x2523f1(0x22c),'Sheet\x20range,\x20for\x20example\x20B2:H40')[_0x2523f1(0x20c)](_0x2523f1(0x1da),_0x2523f1(0x236))[_0x2523f1(0x20c)](_0x2523f1(0x1f3),_0x2523f1(0x214))['option'](_0x2523f1(0x217),'Board\x20content\x20padding')[_0x2523f1(0x20c)](_0x2523f1(0x210),_0x2523f1(0x1f9))[_0x2523f1(0x20c)]('--out\x20<destination>','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer')[_0x2523f1(0x20c)](_0x2523f1(0x1e5),_0x2523f1(0x1db));return _0xe59085['addCommand'](o(_0x138024['browserSetup'])),_0xe59085[_0x2523f1(0x23e)](async _0x4acd73=>{const _0x4c7453=_0x2523f1;let _0x50bc10;try{let _0x329f2d=await _0x138024[_0x4c7453(0x21b)](_0x4acd73[_0x4c7453(0x1df)]===void 0x0?{}:{'unitId':_0x4acd73[_0x4c7453(0x1df)]});_0x50bc10=await m(_0x138024[_0x4c7453(0x1e0)],_0x329f2d,_0x4acd73);}catch(_0x17c283){C(_0xe59085,_0x17c283);}let _0x2b5418;try{_0x2b5418=await _0x138024[_0x4c7453(0x213)]({'result':_0x50bc10,..._0x4acd73[_0x4c7453(0x1d5)]===void 0x0?{}:{'destination':_0x4acd73[_0x4c7453(0x1d5)]}}),x(_0x50bc10,_0x2b5418);}catch(_0x1bf6f3){C(_0xe59085,_0x1bf6f3);}let _0x7cdee8=_0x4acd73['json']===!0x0?JSON[_0x4c7453(0x1ed)](S(_0x50bc10,_0x2b5418),null,0x2)+'\x0a':_0x2b5418[_0x4c7453(0x20a)](({location:_0x301f9b})=>_0x301f9b)['join']('\x0a')+'\x0a';_0xe59085[_0x4c7453(0x207)]()[_0x4c7453(0x235)]?.(_0x7cdee8);}),_0xe59085;}async function m(_0x5c2c39,_0x4bbdec,_0x403ec5){const _0x23b7a4=_0x3aab;switch(_0x4bbdec[_0x23b7a4(0x229)]){case _0x23b7a4(0x1e9):if(b(_0x403ec5,[_0x23b7a4(0x1f1),_0x23b7a4(0x237),'tile',_0x23b7a4(0x225),'elements','padding',_0x23b7a4(0x1d7)],_0x23b7a4(0x1ff)),_0x403ec5['sheet']!==void 0x0&&_0x403ec5[_0x23b7a4(0x222)]===void 0x0)throw new f('--sheet\x20requires\x20--range');return await _0x5c2c39[_0x23b7a4(0x21f)]({..._0x4bbdec,..._0x403ec5[_0x23b7a4(0x222)]===void 0x0?{}:{'target':{'kind':'sheet-range','range':_0x403ec5[_0x23b7a4(0x222)],..._0x403ec5['sheet']===void 0x0?{}:{'sheetName':_0x403ec5[_0x23b7a4(0x1e9)]}}}});case'doc':return b(_0x403ec5,['pages','contactSlide',_0x23b7a4(0x1ec),_0x23b7a4(0x1e9),_0x23b7a4(0x222),_0x23b7a4(0x225),_0x23b7a4(0x20b),_0x23b7a4(0x1e6),_0x23b7a4(0x1d7)],_0x23b7a4(0x206)),await _0x5c2c39[_0x23b7a4(0x21f)](_0x4bbdec);case _0x23b7a4(0x21a):{if(b(_0x403ec5,[_0x23b7a4(0x1e9),_0x23b7a4(0x222),_0x23b7a4(0x225),_0x23b7a4(0x20b),'padding',_0x23b7a4(0x1d7)],_0x23b7a4(0x228)),_0x403ec5[_0x23b7a4(0x1ec)]!==void 0x0&&_0x403ec5[_0x23b7a4(0x237)]!==!0x0)throw new f(_0x23b7a4(0x1f2));let _0x2f7dcb=h(_0x403ec5['pages']),_0x4fc5e1=g(_0x403ec5['tile']);return await _0x5c2c39['capture']({..._0x4bbdec,..._0x2f7dcb===void 0x0&&_0x403ec5[_0x23b7a4(0x237)]!==!0x0?{}:{'target':{'kind':_0x23b7a4(0x22d),..._0x2f7dcb===void 0x0?{}:{'pages':_0x2f7dcb},..._0x403ec5[_0x23b7a4(0x237)]===!0x0?{'contactSheet':_0x4fc5e1===void 0x0?{}:{'tile':_0x4fc5e1}}:{}}}});}case _0x23b7a4(0x1fd):{b(_0x403ec5,[_0x23b7a4(0x1f1),_0x23b7a4(0x237),_0x23b7a4(0x1ec),_0x23b7a4(0x1e9),'range'],_0x23b7a4(0x216));let _0x1da404=_(_0x403ec5[_0x23b7a4(0x20b)]),_0xcc003a=v(_0x403ec5['region']),_0x229fff=y(_0x23b7a4(0x1f5),_0x403ec5['padding']),_0x446d8e=y(_0x23b7a4(0x1e1),_0x403ec5[_0x23b7a4(0x1d7)]);if(_0x1da404!==void 0x0&&_0xcc003a!==void 0x0)throw new f(_0x23b7a4(0x1d4));if(_0x1da404===void 0x0&&_0xcc003a===void 0x0&&(_0x229fff!==void 0x0||_0x446d8e!==void 0x0))throw new f(_0x23b7a4(0x1ea));return await _0x5c2c39[_0x23b7a4(0x21f)]({..._0x4bbdec,..._0x1da404===void 0x0&&_0xcc003a===void 0x0&&_0x229fff===void 0x0&&_0x446d8e===void 0x0?{}:{'target':{'kind':_0x23b7a4(0x1ce),..._0x1da404===void 0x0?{}:{'elementIds':_0x1da404},..._0xcc003a===void 0x0?{}:{'region':_0xcc003a},..._0x229fff===void 0x0?{}:{'padding':_0x229fff},..._0x446d8e===void 0x0?{}:{'scale':_0x446d8e}}}});}case _0x23b7a4(0x1f7):return b(_0x403ec5,[_0x23b7a4(0x1f1),_0x23b7a4(0x237),'tile',_0x23b7a4(0x1e9),_0x23b7a4(0x222),_0x23b7a4(0x225),_0x23b7a4(0x20b),_0x23b7a4(0x1e6),'scale'],_0x23b7a4(0x1e3)),await _0x5c2c39[_0x23b7a4(0x21f)](_0x4bbdec);}}function h(_0x3464be){const _0x5164e0=_0x3aab;if(_0x3464be===void 0x0||_0x3464be[_0x5164e0(0x205)]()===_0x5164e0(0x208))return;if(_0x3464be[_0x5164e0(0x205)]()[_0x5164e0(0x221)]===0x0)throw new f(_0x5164e0(0x1f4));let _0x3e6367=[];for(let _0x5f21aa of _0x3464be['split'](',')){let _0x530a04=_0x5f21aa[_0x5164e0(0x205)]();if(_0x530a04['length']===0x0)throw new f('--pages\x20contains\x20an\x20empty\x20selector');let _0x34231a=/^(\d+)(?:-(\d+))?$/['exec'](_0x530a04);if(_0x34231a===null){_0x3e6367[_0x5164e0(0x231)](_0x530a04);continue;}let _0x9b5457=Number(_0x34231a[0x1]),_0xa22383=Number(_0x34231a[0x2]??_0x34231a[0x1]);if(!Number['isSafeInteger'](_0x9b5457)||!Number[_0x5164e0(0x1fe)](_0xa22383)||_0x9b5457<0x1||_0xa22383<_0x9b5457)throw new f(_0x5164e0(0x22b)+JSON[_0x5164e0(0x1ed)](_0x5f21aa[_0x5164e0(0x205)]()));if(_0xa22383-_0x9b5457+0x1>d)throw new f('A\x20--pages\x20range\x20cannot\x20exceed\x20'+d+_0x5164e0(0x1dc));for(let _0x5d1b30=_0x9b5457;_0x5d1b30<=_0xa22383;_0x5d1b30+=0x1)_0x3e6367[_0x5164e0(0x231)](_0x5d1b30);if(_0x3e6367['length']>d)throw new f('--pages\x20cannot\x20expand\x20to\x20more\x20than\x20'+d+_0x5164e0(0x1dc));}return[...new Set(_0x3e6367)];}function g(_0x1ed83b){const _0x477631=_0x3aab;if(_0x1ed83b===void 0x0)return;let _0xc9c068=/^(\d+)x(\d+)$/iu[_0x477631(0x21d)](_0x1ed83b['trim']()),_0x563dc1=Number(_0xc9c068?.[0x1]),_0x755cd2=Number(_0xc9c068?.[0x2]);if(_0xc9c068===null||!Number['isSafeInteger'](_0x563dc1)||_0x563dc1<0x1||!Number[_0x477631(0x1fe)](_0x755cd2)||_0x755cd2<0x1)throw new f(_0x477631(0x21e)+JSON['stringify'](_0x1ed83b)+';\x20expected\x20<columns>x<rows>');return{'columns':_0x563dc1,'rows':_0x755cd2};}function _(_0x551e67){const _0x1051e8=_0x3aab;if(_0x551e67===void 0x0)return;let _0xac26d9=[...new Set(_0x551e67[_0x1051e8(0x23d)](',')['map'](_0x243b20=>_0x243b20[_0x1051e8(0x205)]()))];if(_0xac26d9[_0x1051e8(0x20d)](_0x37b652=>_0x37b652[_0x1051e8(0x221)]===0x0))throw new f(_0x1051e8(0x232));return _0xac26d9;}function v(_0x208951){const _0x253b8b=_0x3aab;if(_0x208951===void 0x0)return;let _0x3a1af6=_0x208951[_0x253b8b(0x23d)](','),_0x8efded=_0x3a1af6[_0x253b8b(0x20a)](Number);if(_0x3a1af6[_0x253b8b(0x221)]!==0x4||_0x3a1af6[_0x253b8b(0x20d)](_0x2c9691=>_0x2c9691['trim']()['length']===0x0)||_0x8efded[_0x253b8b(0x221)]!==0x4||!_0x8efded['every'](Number['isFinite']))throw new f('--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers');let [_0x64cd15,_0x69817e,_0x44d14a,_0x1d3813]=_0x8efded;if(_0x44d14a<=0x0||_0x1d3813<=0x0)throw new f('--region\x20width\x20and\x20height\x20must\x20be\x20positive');return{'left':_0x64cd15,'top':_0x69817e,'width':_0x44d14a,'height':_0x1d3813};}function y(_0x454275,_0x2d0784){const _0x165252=_0x3aab;if(_0x2d0784===void 0x0)return;if(_0x2d0784[_0x165252(0x205)]()['length']===0x0)throw new f(_0x454275+_0x165252(0x241));let _0x63fd50=Number(_0x2d0784);if(!Number[_0x165252(0x204)](_0x63fd50))throw new f(_0x454275+_0x165252(0x241));return _0x63fd50;}function _0x3aab(_0x38d488,_0x6bc959){_0x38d488=_0x38d488-0x1ce;const _0x17bf05=_0x17bf();let _0x3aabb8=_0x17bf05[_0x38d488];return _0x3aabb8;}function b(_0x1a0db6,_0x3439df,_0x5e4288){const _0x3d5e0f=_0x3aab;for(let _0x2451a4 of _0x3439df)if(_0x1a0db6[_0x2451a4]!==void 0x0)throw new f('--'+_0x2451a4[_0x3d5e0f(0x21c)](/[A-Z]/gu,_0x51a6ee=>'-'+_0x51a6ee['toLowerCase']())+'\x20is\x20not\x20supported\x20for\x20'+_0x5e4288);}function x(_0x245eed,_0x358648){const _0x471dc2=_0x3aab;if(_0x358648[_0x471dc2(0x221)]!==_0x245eed[_0x471dc2(0x239)][_0x471dc2(0x221)])throw Error('Screenshot\x20writer\x20returned\x20'+_0x358648['length']+'\x20outputs\x20for\x20'+_0x245eed[_0x471dc2(0x239)][_0x471dc2(0x221)]+_0x471dc2(0x23f));for(let _0x104981=0x0;_0x104981<_0x358648['length'];_0x104981+=0x1)if(_0x358648[_0x104981]?.[_0x471dc2(0x242)]!==_0x245eed[_0x471dc2(0x239)][_0x104981]?.[_0x471dc2(0x242)])throw Error(_0x471dc2(0x1d9)+(_0x104981+0x1)+_0x471dc2(0x1f6));}function S(_0x3d8020,_0x1b0106){const _0x835eff=_0x3aab;return{'ok':!0x0,'unitId':_0x3d8020[_0x835eff(0x20e)],'unitKind':_0x3d8020[_0x835eff(0x229)],'outputs':_0x3d8020[_0x835eff(0x239)][_0x835eff(0x20a)](({bytes:_0x11d2ad,..._0x889fc9},_0xf93070)=>({..._0x889fc9,'location':_0x1b0106[_0xf93070][_0x835eff(0x1fc)]}))};}function C(_0x365713,_0x208977){const _0x1645c9=_0x3aab;_0x208977 instanceof f&&_0x365713[_0x1645c9(0x234)](_0x208977['message'],{'code':_0x1645c9(0x201),'exitCode':0x1}),(_0x208977 instanceof _0x2dec2b||w(_0x208977))&&_0x365713[_0x1645c9(0x234)](_0x208977[_0x1645c9(0x1d6)]+':\x20'+_0x208977['message'],{'code':_0x1645c9(0x23b),'exitCode':0x1}),_0x208977 instanceof Error&&_0x365713[_0x1645c9(0x234)](_0x208977[_0x1645c9(0x1cf)],{'code':'screenshot.failed','exitCode':0x1}),_0x365713[_0x1645c9(0x234)]('Screenshot\x20failed',{'code':_0x1645c9(0x23b),'exitCode':0x1});}function _0x17bf(){const _0x892276=['message','probe','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','screenshot\x20browser\x20installed:\x20','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','out','code','scale','install','Screenshot\x20writer\x20output\x20','--region\x20<left,top,width,height>','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','\x20pages','26710440EBMNqx','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','unit','screenshot','--scale','--tile\x20<columns>x<rows>','Base','2682114PgvgNd','--json','padding','Unit\x20to\x20capture','4092732nQSmVZ','sheet','--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements','Browser\x20setup\x20failed','tile','stringify','5451362FZZSOP','string','--force','pages','--tile\x20requires\x20--contact-slide','--elements\x20<ids>','--pages\x20cannot\x20be\x20empty','--padding','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','base','4pMmJTw','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','84mOlUHN','44111RbeUjP','location','board','isSafeInteger','Sheet','UnitScreenshotCommandInputError','screenshot.invalid-input','source','6cMYzpQ','isFinite','trim','Doc','configureOutput','all','json','map','elements','option','some','unitId','screenshot.setup-failed','--scale\x20<factor>','description','alreadyInstalled','writeImages','Board\x20element\x20IDs\x20separated\x20by\x20commas','buildId','Board','--padding\x20<pixels>','31055SXyWzJ','):\x20','slide','loadUnit','replace','exec','Invalid\x20--tile\x20','capture','screenshot\x20browser\x20already\x20installed:\x20','length','range','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','executablePath','region','7250752KJcJFt','resolve','Slide','unitType','write\x20the\x20setup\x20result\x20as\x20JSON','Invalid\x20--pages\x20range\x20','--range\x20<a1-range>','slide-pages','join','parent','--contact-slide','push','--elements\x20must\x20contain\x20non-empty\x20IDs','resolved','error','writeOut','Board\x20region','contactSlide','--sheet\x20<name>','images','Contact\x20slide\x20grid,\x20for\x20example\x204x2','screenshot.failed','cacheDir','split','action','\x20images','--unit\x20<unit-id>','\x20must\x20be\x20a\x20finite\x20number','name','optsWithGlobals','board-content'];_0x17bf=function(){return _0x892276;};return _0x17bf();}function w(_0x712105){const _0x4cbdf0=_0x3aab;return _0x712105 instanceof Error&&typeof _0x712105[_0x4cbdf0(0x1d6)]==_0x4cbdf0(0x1ef);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
|
|
1
|
+
(function(_0x83f29c,_0x471707){const _0x41f906=_0x490b,_0x4fbb5c=_0x83f29c();while(!![]){try{const _0x37b9ff=parseInt(_0x41f906(0x84))/0x1*(parseInt(_0x41f906(0xe3))/0x2)+-parseInt(_0x41f906(0xa7))/0x3*(-parseInt(_0x41f906(0xaf))/0x4)+parseInt(_0x41f906(0x6a))/0x5*(-parseInt(_0x41f906(0xd9))/0x6)+parseInt(_0x41f906(0xcb))/0x7+parseInt(_0x41f906(0xba))/0x8+parseInt(_0x41f906(0xaa))/0x9*(-parseInt(_0x41f906(0x90))/0xa)+-parseInt(_0x41f906(0x71))/0xb;if(_0x37b9ff===_0x471707)break;else _0x4fbb5c['push'](_0x4fbb5c['shift']());}catch(_0x4980d9){_0x4fbb5c['push'](_0x4fbb5c['shift']());}}}(_0x259d,0x5d627));import{UnitScreenshotError as _0x49b088}from'@univer-cli/unit-screenshot';function _0x490b(_0x4b3a85,_0x355b83){_0x4b3a85=_0x4b3a85-0x67;const _0x259d3f=_0x259d();let _0x490bdc=_0x259d3f[_0x4b3a85];return _0x490bdc;}import{Command as _0x25075f}from'commander';import{installUniverRenderBrowser as _0xe79b50,probeUniverRenderBrowser as _0x2c2b9a,resolveUniverRenderBrowser as _0x16dba0}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0xe79b50(),'probe':async _0x1ca9e7=>await _0x2c2b9a(_0x1ca9e7),'resolve':async()=>await _0x16dba0()};function o(_0x396265=a){const _0x525988=_0x490b;let _0x1313a1=new _0x25075f('setup')[_0x525988(0x8f)]('Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering')[_0x525988(0x94)]('--force',_0x525988(0xde))[_0x525988(0x94)](_0x525988(0xd0),'write\x20the\x20setup\x20result\x20as\x20JSON');return _0x1313a1[_0x525988(0xc3)](async _0xc57449=>{const _0x1cc176=_0x525988;l(_0x1313a1);let _0x5812e2={..._0x1313a1[_0x1cc176(0xb1)](),..._0xc57449},_0x1972e0;try{_0x1972e0=await s(_0x396265,_0x5812e2[_0x1cc176(0x8a)]===!0x0);}catch(_0x17538f){u(_0x17538f)&&_0x1313a1['error'](_0x17538f[_0x1cc176(0xd4)]+':\x20'+_0x17538f[_0x1cc176(0x68)],{'code':_0x1cc176(0xc4),'exitCode':0x1}),_0x1313a1[_0x1cc176(0x9e)](_0x17538f instanceof Error?_0x17538f['message']:_0x1cc176(0x77),{'code':_0x1cc176(0xc4),'exitCode':0x1});}let _0x16da66=_0x5812e2[_0x1cc176(0xa0)]===!0x0?JSON[_0x1cc176(0xc1)]({'ok':!0x0,..._0x1972e0},null,0x2)+'\x0a':c(_0x1972e0);_0x1313a1[_0x1cc176(0x7d)]()['writeOut']?.(_0x16da66);}),_0x1313a1;}async function s(_0x15679e,_0x376662){const _0x5bb3f0=_0x490b;if(!_0x376662){let _0xd4c9e6=await _0x15679e[_0x5bb3f0(0xab)]();if(_0xd4c9e6[_0x5bb3f0(0xe2)]===_0x5bb3f0(0x80))return await _0x15679e[_0x5bb3f0(0x99)]({'executablePath':_0xd4c9e6[_0x5bb3f0(0x72)]}),{'status':'resolved','executablePath':_0xd4c9e6['executablePath'],'source':_0xd4c9e6[_0x5bb3f0(0x98)]};}let _0x2be9d7=await _0x15679e[_0x5bb3f0(0xd5)]();return await _0x15679e['probe']({'executablePath':_0x2be9d7[_0x5bb3f0(0x72)]}),{'status':'installed',..._0x2be9d7};}function c(_0x3a1da8){const _0x9eb574=_0x490b;return _0x3a1da8[_0x9eb574(0xe2)]===_0x9eb574(0x6b)?[_0x9eb574(0xd2)+_0x3a1da8[_0x9eb574(0x98)]+_0x9eb574(0xa1)+_0x3a1da8[_0x9eb574(0x72)],_0x9eb574(0x7a),''][_0x9eb574(0xdd)]('\x0a'):[_0x3a1da8[_0x9eb574(0xc0)]?_0x9eb574(0xa5)+_0x3a1da8[_0x9eb574(0x72)]:_0x9eb574(0x73)+_0x3a1da8[_0x9eb574(0x72)],_0x9eb574(0xbb)+_0x3a1da8['buildId'],_0x9eb574(0x7f)+_0x3a1da8[_0x9eb574(0x9f)],''][_0x9eb574(0xdd)]('\x0a');}function l(_0x5d2a33){const _0x268479=_0x490b;_0x5d2a33[_0x268479(0xb2)]!==null&&_0x5d2a33[_0x268479(0x7d)](_0x5d2a33['parent']['configureOutput']());}function u(_0x1201d4){return _0x1201d4 instanceof Error&&typeof _0x1201d4['code']=='string';}var d=0x2710,f=class extends Error{constructor(_0x2cd16f){const _0x751f6f=_0x490b;super(_0x2cd16f),this[_0x751f6f(0x9d)]='UnitScreenshotCommandInputError';}};function p(_0x12f87f){const _0x6212db=_0x490b;let _0x128951=new _0x25075f(_0x6212db(0x8d))['description'](_0x6212db(0xda))['option'](_0x6212db(0x9b),'Unit\x20to\x20capture')['option'](_0x6212db(0xa2),_0x6212db(0x7c))[_0x6212db(0x94)]('--contact-slide',_0x6212db(0xb7))[_0x6212db(0x94)](_0x6212db(0xc7),_0x6212db(0x88))[_0x6212db(0x94)]('--sheet\x20<name>',_0x6212db(0x8e))[_0x6212db(0x94)]('--range\x20<a1-range>',_0x6212db(0xdc))[_0x6212db(0x94)](_0x6212db(0xc8),'Board\x20region')[_0x6212db(0x94)](_0x6212db(0x6f),_0x6212db(0x70))[_0x6212db(0x94)]('--padding\x20<pixels>',_0x6212db(0x97))[_0x6212db(0x94)](_0x6212db(0xc5),_0x6212db(0xa8))[_0x6212db(0x94)]('--out\x20<destination>',_0x6212db(0x78))[_0x6212db(0x94)](_0x6212db(0xd0),_0x6212db(0x9a));return _0x128951['addCommand'](o(_0x12f87f['browserSetup'])),_0x128951['action'](async _0x52a9be=>{const _0x3ad734=_0x6212db;let _0x4d8fd5;try{let _0x42a2b0=await _0x12f87f['loadUnit'](_0x52a9be[_0x3ad734(0xdb)]===void 0x0?{}:{'unitId':_0x52a9be['unit']});_0x4d8fd5=await m(_0x12f87f['screenshot'],_0x42a2b0,_0x52a9be);}catch(_0x5693c5){C(_0x128951,_0x5693c5);}let _0x4944e4;try{_0x4944e4=await _0x12f87f[_0x3ad734(0x69)]({'result':_0x4d8fd5,..._0x52a9be[_0x3ad734(0xa4)]===void 0x0?{}:{'destination':_0x52a9be[_0x3ad734(0xa4)]}}),x(_0x4d8fd5,_0x4944e4);}catch(_0x961d67){C(_0x128951,_0x961d67);}let _0x10501b=_0x52a9be[_0x3ad734(0xa0)]===!0x0?JSON[_0x3ad734(0xc1)](S(_0x4d8fd5,_0x4944e4),null,0x2)+'\x0a':_0x4944e4[_0x3ad734(0x7b)](({location:_0x4a3777})=>_0x4a3777)[_0x3ad734(0xdd)]('\x0a')+'\x0a';_0x128951['configureOutput']()[_0x3ad734(0xac)]?.(_0x10501b);}),_0x128951;}async function m(_0x153909,_0x21a07e,_0x31cc01){const _0x44b857=_0x490b;switch(_0x21a07e[_0x44b857(0xe0)]){case _0x44b857(0xcc):if(b(_0x31cc01,[_0x44b857(0x8b),'contactSlide',_0x44b857(0x76),_0x44b857(0xbc),_0x44b857(0xc2),'padding',_0x44b857(0x67)],_0x44b857(0x75)),_0x31cc01[_0x44b857(0xcc)]!==void 0x0&&_0x31cc01[_0x44b857(0xae)]===void 0x0)throw new f(_0x44b857(0xd7));return await _0x153909[_0x44b857(0xce)]({..._0x21a07e,..._0x31cc01[_0x44b857(0xae)]===void 0x0?{}:{'target':{'kind':_0x44b857(0xd8),'range':_0x31cc01['range'],..._0x31cc01[_0x44b857(0xcc)]===void 0x0?{}:{'sheetName':_0x31cc01['sheet']}}}});case _0x44b857(0x89):return b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),'sheet',_0x44b857(0xae),'region',_0x44b857(0xc2),'padding',_0x44b857(0x67)],'Doc'),await _0x153909['capture'](_0x21a07e);case _0x44b857(0xcf):{if(b(_0x31cc01,['sheet',_0x44b857(0xae),_0x44b857(0xbc),_0x44b857(0xc2),_0x44b857(0x96),_0x44b857(0x67)],_0x44b857(0xa6)),_0x31cc01[_0x44b857(0x76)]!==void 0x0&&_0x31cc01[_0x44b857(0x93)]!==!0x0)throw new f(_0x44b857(0xb9));let _0x5ba465=h(_0x31cc01[_0x44b857(0x8b)]),_0x52a376=g(_0x31cc01[_0x44b857(0x76)]);return await _0x153909['capture']({..._0x21a07e,..._0x5ba465===void 0x0&&_0x31cc01['contactSlide']!==!0x0?{}:{'target':{'kind':_0x44b857(0xbf),..._0x5ba465===void 0x0?{}:{'pages':_0x5ba465},..._0x31cc01['contactSlide']===!0x0?{'contactSheet':_0x52a376===void 0x0?{}:{'tile':_0x52a376}}:{}}}});}case _0x44b857(0xc6):{b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),'sheet',_0x44b857(0xae)],'Board');let _0x3e8c64=_(_0x31cc01[_0x44b857(0xc2)]),_0x18bf74=v(_0x31cc01[_0x44b857(0xbc)]),_0x17b6dc=y(_0x44b857(0x81),_0x31cc01[_0x44b857(0x96)]),_0x2ef2d5=y(_0x44b857(0x87),_0x31cc01[_0x44b857(0x67)]);if(_0x3e8c64!==void 0x0&&_0x18bf74!==void 0x0)throw new f(_0x44b857(0x7e));if(_0x3e8c64===void 0x0&&_0x18bf74===void 0x0&&(_0x17b6dc!==void 0x0||_0x2ef2d5!==void 0x0))throw new f('--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements');return await _0x153909['capture']({..._0x21a07e,..._0x3e8c64===void 0x0&&_0x18bf74===void 0x0&&_0x17b6dc===void 0x0&&_0x2ef2d5===void 0x0?{}:{'target':{'kind':_0x44b857(0x74),..._0x3e8c64===void 0x0?{}:{'elementIds':_0x3e8c64},..._0x18bf74===void 0x0?{}:{'region':_0x18bf74},..._0x17b6dc===void 0x0?{}:{'padding':_0x17b6dc},..._0x2ef2d5===void 0x0?{}:{'scale':_0x2ef2d5}}}});}case _0x44b857(0xa9):return b(_0x31cc01,[_0x44b857(0x8b),_0x44b857(0x93),_0x44b857(0x76),_0x44b857(0xcc),_0x44b857(0xae),_0x44b857(0xbc),_0x44b857(0xc2),_0x44b857(0x96),_0x44b857(0x67)],_0x44b857(0xe1)),await _0x153909[_0x44b857(0xce)](_0x21a07e);}}function h(_0x985199){const _0x16305b=_0x490b;if(_0x985199===void 0x0||_0x985199[_0x16305b(0x79)]()===_0x16305b(0x9c))return;if(_0x985199[_0x16305b(0x79)]()[_0x16305b(0x8c)]===0x0)throw new f(_0x16305b(0x82));let _0xa0c316=[];for(let _0x413b3c of _0x985199['split'](',')){let _0x40e4e2=_0x413b3c[_0x16305b(0x79)]();if(_0x40e4e2[_0x16305b(0x8c)]===0x0)throw new f('--pages\x20contains\x20an\x20empty\x20selector');let _0x49ac00=/^(\d+)(?:-(\d+))?$/['exec'](_0x40e4e2);if(_0x49ac00===null){_0xa0c316[_0x16305b(0xa3)](_0x40e4e2);continue;}let _0x4d4ca9=Number(_0x49ac00[0x1]),_0x97cea9=Number(_0x49ac00[0x2]??_0x49ac00[0x1]);if(!Number[_0x16305b(0xb4)](_0x4d4ca9)||!Number['isSafeInteger'](_0x97cea9)||_0x4d4ca9<0x1||_0x97cea9<_0x4d4ca9)throw new f(_0x16305b(0xb8)+JSON['stringify'](_0x413b3c['trim']()));if(_0x97cea9-_0x4d4ca9+0x1>d)throw new f(_0x16305b(0x6d)+d+'\x20pages');for(let _0xb8eb1d=_0x4d4ca9;_0xb8eb1d<=_0x97cea9;_0xb8eb1d+=0x1)_0xa0c316[_0x16305b(0xa3)](_0xb8eb1d);if(_0xa0c316[_0x16305b(0x8c)]>d)throw new f(_0x16305b(0xd6)+d+_0x16305b(0xd3));}return[...new Set(_0xa0c316)];}function _0x259d(){const _0x577b7d=['json','):\x20','--pages\x20<pages>','push','out','screenshot\x20browser\x20already\x20installed:\x20','Slide','3KvPftn','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','base','610920SdxofX','resolve','writeOut','exec','range','1635560YWczAH','split','optsWithGlobals','parent','\x20must\x20be\x20a\x20finite\x20number','isSafeInteger','Screenshot\x20writer\x20returned\x20',';\x20expected\x20<columns>x<rows>','Slide\x20overview\x20containing\x20all\x20captured\x20pages','Invalid\x20--pages\x20range\x20','--tile\x20requires\x20--contact-slide','2483400PxPfJT','build:\x20','region','some','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','slide-pages','alreadyInstalled','stringify','elements','action','screenshot.setup-failed','--scale\x20<factor>','board','--tile\x20<columns>x<rows>','--region\x20<left,top,width,height>','string','Screenshot\x20writer\x20output\x20','2380322Slfdgd','sheet','\x20is\x20not\x20supported\x20for\x20','capture','slide','--json','Screenshot\x20failed','usable\x20browser\x20found\x20(','\x20pages','code','install','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','--sheet\x20requires\x20--range','sheet-range','542964oiSikp','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','unit','Sheet\x20range,\x20for\x20example\x20B2:H40','join','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build','location','unitType','Base','status','118744cAqXZx','scale','message','writeImages','35BleIbc','resolved','every','A\x20--pages\x20range\x20cannot\x20exceed\x20','screenshot.failed','--elements\x20<ids>','Board\x20element\x20IDs\x20separated\x20by\x20commas','1222056dXutkQ','executablePath','screenshot\x20browser\x20installed:\x20','board-content','Sheet','tile','Browser\x20setup\x20failed','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer','trim','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','map','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','configureOutput','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','cache:\x20','found','--padding','--pages\x20cannot\x20be\x20empty','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','8qcEvUg','--region\x20width\x20and\x20height\x20must\x20be\x20positive','\x20images','--scale','Contact\x20slide\x20grid,\x20for\x20example\x204x2','doc','force','pages','length','screenshot','Sheet\x20name\x20used\x20with\x20--range','description','60vbSUOQ','isFinite','images','contactSlide','option','Invalid\x20--tile\x20','padding','Board\x20content\x20padding','source','probe','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','--unit\x20<unit-id>','all','name','error','cacheDir'];_0x259d=function(){return _0x577b7d;};return _0x259d();}function g(_0x31a5da){const _0x464f87=_0x490b;if(_0x31a5da===void 0x0)return;let _0x21d9f0=/^(\d+)x(\d+)$/iu[_0x464f87(0xad)](_0x31a5da['trim']()),_0x1b58a7=Number(_0x21d9f0?.[0x1]),_0x5b865b=Number(_0x21d9f0?.[0x2]);if(_0x21d9f0===null||!Number[_0x464f87(0xb4)](_0x1b58a7)||_0x1b58a7<0x1||!Number[_0x464f87(0xb4)](_0x5b865b)||_0x5b865b<0x1)throw new f(_0x464f87(0x95)+JSON[_0x464f87(0xc1)](_0x31a5da)+_0x464f87(0xb6));return{'columns':_0x1b58a7,'rows':_0x5b865b};}function _(_0x34f2b8){const _0xbe2e88=_0x490b;if(_0x34f2b8===void 0x0)return;let _0x509e6e=[...new Set(_0x34f2b8[_0xbe2e88(0xb0)](',')[_0xbe2e88(0x7b)](_0x54aced=>_0x54aced[_0xbe2e88(0x79)]()))];if(_0x509e6e[_0xbe2e88(0xbd)](_0x416d8e=>_0x416d8e[_0xbe2e88(0x8c)]===0x0))throw new f('--elements\x20must\x20contain\x20non-empty\x20IDs');return _0x509e6e;}function v(_0x53e70f){const _0x3f8205=_0x490b;if(_0x53e70f===void 0x0)return;let _0x880ceb=_0x53e70f[_0x3f8205(0xb0)](','),_0x268adc=_0x880ceb[_0x3f8205(0x7b)](Number);if(_0x880ceb[_0x3f8205(0x8c)]!==0x4||_0x880ceb['some'](_0x4578e6=>_0x4578e6['trim']()[_0x3f8205(0x8c)]===0x0)||_0x268adc[_0x3f8205(0x8c)]!==0x4||!_0x268adc[_0x3f8205(0x6c)](Number[_0x3f8205(0x91)]))throw new f(_0x3f8205(0xbe));let [_0x7c967b,_0x130d74,_0x138913,_0x34a79b]=_0x268adc;if(_0x138913<=0x0||_0x34a79b<=0x0)throw new f(_0x3f8205(0x85));return{'left':_0x7c967b,'top':_0x130d74,'width':_0x138913,'height':_0x34a79b};}function y(_0x4e74b4,_0x1e7801){const _0x41591a=_0x490b;if(_0x1e7801===void 0x0)return;if(_0x1e7801[_0x41591a(0x79)]()['length']===0x0)throw new f(_0x4e74b4+_0x41591a(0xb3));let _0x2d43c6=Number(_0x1e7801);if(!Number['isFinite'](_0x2d43c6))throw new f(_0x4e74b4+_0x41591a(0xb3));return _0x2d43c6;}function b(_0x1e2165,_0x12bda9,_0x3a91a8){const _0x4bdba6=_0x490b;for(let _0x281998 of _0x12bda9)if(_0x1e2165[_0x281998]!==void 0x0)throw new f('--'+_0x281998['replace'](/[A-Z]/gu,_0x37cf65=>'-'+_0x37cf65['toLowerCase']())+_0x4bdba6(0xcd)+_0x3a91a8);}function x(_0x8aa436,_0x4c4e01){const _0x1b0d41=_0x490b;if(_0x4c4e01[_0x1b0d41(0x8c)]!==_0x8aa436['images'][_0x1b0d41(0x8c)])throw Error(_0x1b0d41(0xb5)+_0x4c4e01[_0x1b0d41(0x8c)]+'\x20outputs\x20for\x20'+_0x8aa436['images']['length']+_0x1b0d41(0x86));for(let _0x21b9c9=0x0;_0x21b9c9<_0x4c4e01['length'];_0x21b9c9+=0x1)if(_0x4c4e01[_0x21b9c9]?.[_0x1b0d41(0x9d)]!==_0x8aa436[_0x1b0d41(0x92)][_0x21b9c9]?.[_0x1b0d41(0x9d)])throw Error(_0x1b0d41(0xca)+(_0x21b9c9+0x1)+_0x1b0d41(0x83));}function S(_0x1ad8a0,_0x58dc86){const _0x5961e6=_0x490b;return{'ok':!0x0,'unitId':_0x1ad8a0['unitId'],'unitKind':_0x1ad8a0['unitType'],'outputs':_0x1ad8a0['images'][_0x5961e6(0x7b)](({bytes:_0xb3bfb0,..._0x38a5e4},_0x45bba6)=>({..._0x38a5e4,'location':_0x58dc86[_0x45bba6][_0x5961e6(0xdf)]}))};}function C(_0x519eff,_0x57377b){const _0x56d39e=_0x490b;_0x57377b instanceof f&&_0x519eff[_0x56d39e(0x9e)](_0x57377b[_0x56d39e(0x68)],{'code':'screenshot.invalid-input','exitCode':0x1}),(_0x57377b instanceof _0x49b088||w(_0x57377b))&&_0x519eff[_0x56d39e(0x9e)](_0x57377b[_0x56d39e(0xd4)]+':\x20'+_0x57377b[_0x56d39e(0x68)],{'code':_0x56d39e(0x6e),'exitCode':0x1}),_0x57377b instanceof Error&&_0x519eff['error'](_0x57377b[_0x56d39e(0x68)],{'code':_0x56d39e(0x6e),'exitCode':0x1}),_0x519eff[_0x56d39e(0x9e)](_0x56d39e(0xd1),{'code':_0x56d39e(0x6e),'exitCode':0x1});}function w(_0x3fc569){const _0x46d38b=_0x490b;return _0x3fc569 instanceof Error&&typeof _0x3fc569[_0x46d38b(0xd4)]==_0x46d38b(0xc9);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univer-cli/unit-screenshot-command",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"README.zh-CN.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@univer-cli/unit-screenshot": "1.
|
|
22
|
-
"@univer-cli/univer-render-runtime": "1.
|
|
21
|
+
"@univer-cli/unit-screenshot": "1.3.0",
|
|
22
|
+
"@univer-cli/univer-render-runtime": "1.3.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"commander": "^15.0.0"
|