@univer-cli/unit-screenshot-command 1.1.0 → 1.2.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(_0x1a4400,_0x247026){const _0x59ef1c=_0x25f7,_0xadc0bd=_0x1a4400();while(!![]){try{const _0x19f7b0=parseInt(_0x59ef1c(0x175))/0x1+-parseInt(_0x59ef1c(0x1ad))/0x2*(parseInt(_0x59ef1c(0x166))/0x3)+parseInt(_0x59ef1c(0x16e))/0x4*(-parseInt(_0x59ef1c(0x162))/0x5)+parseInt(_0x59ef1c(0x172))/0x6*(parseInt(_0x59ef1c(0x196))/0x7)+-parseInt(_0x59ef1c(0x13f))/0x8+parseInt(_0x59ef1c(0x1b8))/0x9*(parseInt(_0x59ef1c(0x157))/0xa)+parseInt(_0x59ef1c(0x145))/0xb;if(_0x19f7b0===_0x247026)break;else _0xadc0bd['push'](_0xadc0bd['shift']());}catch(_0x57e26f){_0xadc0bd['push'](_0xadc0bd['shift']());}}}(_0x2f5f,0x1c68e));import{UnitScreenshotError as _0x40c636}from'@univer-cli/unit-screenshot';import{Command as _0x26aaad}from'commander';import{installUniverRenderBrowser as _0x1a2243,probeUniverRenderBrowser as _0x3bc79e,resolveUniverRenderBrowser as _0x452f57}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x1a2243(),'probe':async _0x2175e0=>await _0x3bc79e(_0x2175e0),'resolve':async()=>await _0x452f57()};function _0x25f7(_0x1f87cf,_0x4bd667){_0x1f87cf=_0x1f87cf-0x138;const _0x2f5f2c=_0x2f5f();let _0x25f766=_0x2f5f2c[_0x1f87cf];return _0x25f766;}function _0x2f5f(){const _0x1ad664=['--pages\x20cannot\x20be\x20empty','Sheet\x20name\x20used\x20with\x20--range','--padding','source','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','Base','sheet-range','join','out','pages','979736IGpTmM','--scale\x20<factor>','parent','browserSetup','--contact-slide','\x20outputs\x20for\x20','1358071MlVstA','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','contactSlide','Board\x20region','screenshot.invalid-input','writeOut','Invalid\x20--pages\x20range\x20','split','found','unitType','screenshot\x20browser\x20installed:\x20','executablePath','board','region','all','string','optsWithGlobals','--tile\x20requires\x20--contact-slide','7570FsQrgU','addCommand','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','isFinite','Unit\x20to\x20capture','images','Screenshot\x20writer\x20output\x20','toLowerCase','screenshot\x20browser\x20already\x20installed:\x20','isSafeInteger','--elements\x20must\x20contain\x20non-empty\x20IDs','20TzPxJA','range','--out\x20<destination>','name','2319LWwTOa','push','description','Screenshot\x20writer\x20returned\x20','install','scale','status','slide-pages','52276YsOJVw','capture','configureOutput','Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering','21198bjsGMf','):\x20','some','60396xYEjnC','\x20pages','Sheet\x20range,\x20for\x20example\x20B2:H40','exec','code','error','Slide','Board','Screenshot\x20failed','UnitScreenshotCommandInputError','resolved','Browser\x20setup\x20failed','action','resolve','Invalid\x20--tile\x20','unit','probe','unitId','screenshot','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer','trim','length','sheet','Board\x20content\x20padding','Sheet','--sheet\x20requires\x20--range','Contact\x20slide\x20grid,\x20for\x20example\x204x2','replace','--json','option','alreadyInstalled','message','--sheet\x20<name>','7pFLZKV','padding','\x20is\x20not\x20supported\x20for\x20','Board\x20element\x20IDs\x20separated\x20by\x20commas','--range\x20<a1-range>','every','cache:\x20','board-content','Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images','--tile\x20<columns>x<rows>','screenshot.setup-failed','--pages\x20contains\x20an\x20empty\x20selector','tile','loadUnit','--scale','--pages\x20cannot\x20expand\x20to\x20more\x20than\x20','\x20must\x20be\x20a\x20finite\x20number','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','map','write\x20the\x20setup\x20result\x20as\x20JSON','doc','A\x20--pages\x20range\x20cannot\x20exceed\x20','--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements','188qGrmqj','installed','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','--padding\x20<pixels>','force','screenshot.failed','stringify','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','elements','--elements\x20<ids>','location','2097wEVWdT'];_0x2f5f=function(){return _0x1ad664;};return _0x2f5f();}function o(_0x285b25=a){const _0x1a6863=_0x25f7;let _0x2a1ac6=new _0x26aaad('setup')['description'](_0x1a6863(0x171))[_0x1a6863(0x192)]('--force','skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build')[_0x1a6863(0x192)](_0x1a6863(0x191),_0x1a6863(0x1a9));return _0x2a1ac6[_0x1a6863(0x181)](async _0x16936c=>{const _0x544bc9=_0x1a6863;l(_0x2a1ac6);let _0xed6ee5={..._0x2a1ac6[_0x544bc9(0x155)](),..._0x16936c},_0x567da9;try{_0x567da9=await s(_0x285b25,_0xed6ee5[_0x544bc9(0x1b1)]===!0x0);}catch(_0x2081b1){u(_0x2081b1)&&_0x2a1ac6[_0x544bc9(0x17a)](_0x2081b1[_0x544bc9(0x179)]+':\x20'+_0x2081b1[_0x544bc9(0x194)],{'code':_0x544bc9(0x1a0),'exitCode':0x1}),_0x2a1ac6[_0x544bc9(0x17a)](_0x2081b1 instanceof Error?_0x2081b1['message']:_0x544bc9(0x180),{'code':_0x544bc9(0x1a0),'exitCode':0x1});}let _0x419b64=_0xed6ee5['json']===!0x0?JSON[_0x544bc9(0x1b3)]({'ok':!0x0,..._0x567da9},null,0x2)+'\x0a':c(_0x567da9);_0x2a1ac6[_0x544bc9(0x170)]()[_0x544bc9(0x14a)]?.(_0x419b64);}),_0x2a1ac6;}async function s(_0x24a2ec,_0x2bffad){const _0x317c8c=_0x25f7;if(!_0x2bffad){let _0x3ab8cb=await _0x24a2ec[_0x317c8c(0x182)]();if(_0x3ab8cb[_0x317c8c(0x16c)]===_0x317c8c(0x14d))return await _0x24a2ec['probe']({'executablePath':_0x3ab8cb[_0x317c8c(0x150)]}),{'status':_0x317c8c(0x17f),'executablePath':_0x3ab8cb['executablePath'],'source':_0x3ab8cb['source']};}let _0x2beb91=await _0x24a2ec[_0x317c8c(0x16a)]();return await _0x24a2ec[_0x317c8c(0x185)]({'executablePath':_0x2beb91[_0x317c8c(0x150)]}),{'status':_0x317c8c(0x1ae),..._0x2beb91};}function c(_0x27c714){const _0x8b606f=_0x25f7;return _0x27c714[_0x8b606f(0x16c)]==='resolved'?['usable\x20browser\x20found\x20('+_0x27c714[_0x8b606f(0x138)]+_0x8b606f(0x173)+_0x27c714[_0x8b606f(0x150)],_0x8b606f(0x139),''][_0x8b606f(0x13c)]('\x0a'):[_0x27c714[_0x8b606f(0x193)]?_0x8b606f(0x15f)+_0x27c714[_0x8b606f(0x150)]:_0x8b606f(0x14f)+_0x27c714['executablePath'],'build:\x20'+_0x27c714['buildId'],_0x8b606f(0x19c)+_0x27c714['cacheDir'],''][_0x8b606f(0x13c)]('\x0a');}function l(_0x2d7053){const _0x116bc1=_0x25f7;_0x2d7053[_0x116bc1(0x141)]!==null&&_0x2d7053['configureOutput'](_0x2d7053[_0x116bc1(0x141)][_0x116bc1(0x170)]());}function u(_0x21918b){const _0x250b73=_0x25f7;return _0x21918b instanceof Error&&typeof _0x21918b[_0x250b73(0x179)]==_0x250b73(0x154);}var d=0x2710,f=class extends Error{constructor(_0x251337){const _0x198557=_0x25f7;super(_0x251337),this[_0x198557(0x165)]=_0x198557(0x17e);}};function p(_0x22ecbd){const _0x5cc347=_0x25f7;let _0x26c06e=new _0x26aaad(_0x5cc347(0x187))[_0x5cc347(0x168)](_0x5cc347(0x19e))[_0x5cc347(0x192)]('--unit\x20<unit-id>',_0x5cc347(0x15b))[_0x5cc347(0x192)]('--pages\x20<pages>',_0x5cc347(0x1a7))[_0x5cc347(0x192)](_0x5cc347(0x143),'Slide\x20overview\x20containing\x20all\x20captured\x20pages')['option'](_0x5cc347(0x19f),_0x5cc347(0x18f))[_0x5cc347(0x192)](_0x5cc347(0x195),_0x5cc347(0x1ba))[_0x5cc347(0x192)](_0x5cc347(0x19a),_0x5cc347(0x177))[_0x5cc347(0x192)]('--region\x20<left,top,width,height>',_0x5cc347(0x148))['option'](_0x5cc347(0x1b6),_0x5cc347(0x199))[_0x5cc347(0x192)](_0x5cc347(0x1b0),_0x5cc347(0x18c))['option'](_0x5cc347(0x140),_0x5cc347(0x146))[_0x5cc347(0x192)](_0x5cc347(0x164),_0x5cc347(0x188))[_0x5cc347(0x192)]('--json','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON');return _0x26c06e[_0x5cc347(0x158)](o(_0x22ecbd[_0x5cc347(0x142)])),_0x26c06e[_0x5cc347(0x181)](async _0x535d59=>{const _0x491051=_0x5cc347;let _0x964247;try{let _0x5bfb58=await _0x22ecbd[_0x491051(0x1a3)](_0x535d59[_0x491051(0x184)]===void 0x0?{}:{'unitId':_0x535d59['unit']});_0x964247=await m(_0x22ecbd[_0x491051(0x187)],_0x5bfb58,_0x535d59);}catch(_0x37cb92){C(_0x26c06e,_0x37cb92);}let _0x31c271;try{_0x31c271=await _0x22ecbd['writeImages']({'result':_0x964247,..._0x535d59[_0x491051(0x13d)]===void 0x0?{}:{'destination':_0x535d59['out']}}),x(_0x964247,_0x31c271);}catch(_0x11cbb1){C(_0x26c06e,_0x11cbb1);}let _0x1f0b91=_0x535d59['json']===!0x0?JSON[_0x491051(0x1b3)](S(_0x964247,_0x31c271),null,0x2)+'\x0a':_0x31c271[_0x491051(0x1a8)](({location:_0x537973})=>_0x537973)[_0x491051(0x13c)]('\x0a')+'\x0a';_0x26c06e[_0x491051(0x170)]()[_0x491051(0x14a)]?.(_0x1f0b91);}),_0x26c06e;}async function m(_0x51d164,_0x17a0b5,_0x7b2fee){const _0x5efbde=_0x25f7;switch(_0x17a0b5[_0x5efbde(0x14e)]){case _0x5efbde(0x18b):if(b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),'tile','region',_0x5efbde(0x1b5),_0x5efbde(0x197),_0x5efbde(0x16b)],_0x5efbde(0x18d)),_0x7b2fee[_0x5efbde(0x18b)]!==void 0x0&&_0x7b2fee[_0x5efbde(0x163)]===void 0x0)throw new f(_0x5efbde(0x18e));return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x7b2fee[_0x5efbde(0x163)]===void 0x0?{}:{'target':{'kind':_0x5efbde(0x13b),'range':_0x7b2fee[_0x5efbde(0x163)],..._0x7b2fee[_0x5efbde(0x18b)]===void 0x0?{}:{'sheetName':_0x7b2fee[_0x5efbde(0x18b)]}}}});case _0x5efbde(0x1aa):return b(_0x7b2fee,[_0x5efbde(0x13e),'contactSlide',_0x5efbde(0x1a2),_0x5efbde(0x18b),'range',_0x5efbde(0x152),_0x5efbde(0x1b5),_0x5efbde(0x197),_0x5efbde(0x16b)],'Doc'),await _0x51d164[_0x5efbde(0x16f)](_0x17a0b5);case'slide':{if(b(_0x7b2fee,[_0x5efbde(0x18b),_0x5efbde(0x163),_0x5efbde(0x152),_0x5efbde(0x1b5),'padding',_0x5efbde(0x16b)],_0x5efbde(0x17b)),_0x7b2fee[_0x5efbde(0x1a2)]!==void 0x0&&_0x7b2fee[_0x5efbde(0x147)]!==!0x0)throw new f(_0x5efbde(0x156));let _0x49d0a3=h(_0x7b2fee[_0x5efbde(0x13e)]),_0x58ec4c=g(_0x7b2fee['tile']);return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x49d0a3===void 0x0&&_0x7b2fee[_0x5efbde(0x147)]!==!0x0?{}:{'target':{'kind':_0x5efbde(0x16d),..._0x49d0a3===void 0x0?{}:{'pages':_0x49d0a3},..._0x7b2fee[_0x5efbde(0x147)]===!0x0?{'contactSheet':_0x58ec4c===void 0x0?{}:{'tile':_0x58ec4c}}:{}}}});}case _0x5efbde(0x151):{b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),_0x5efbde(0x1a2),'sheet',_0x5efbde(0x163)],_0x5efbde(0x17c));let _0x4033b1=_(_0x7b2fee['elements']),_0x5a8fb2=v(_0x7b2fee['region']),_0x49bc5f=y(_0x5efbde(0x1bb),_0x7b2fee[_0x5efbde(0x197)]),_0x1e6875=y(_0x5efbde(0x1a4),_0x7b2fee[_0x5efbde(0x16b)]);if(_0x4033b1!==void 0x0&&_0x5a8fb2!==void 0x0)throw new f(_0x5efbde(0x1af));if(_0x4033b1===void 0x0&&_0x5a8fb2===void 0x0&&(_0x49bc5f!==void 0x0||_0x1e6875!==void 0x0))throw new f(_0x5efbde(0x1ac));return await _0x51d164[_0x5efbde(0x16f)]({..._0x17a0b5,..._0x4033b1===void 0x0&&_0x5a8fb2===void 0x0&&_0x49bc5f===void 0x0&&_0x1e6875===void 0x0?{}:{'target':{'kind':_0x5efbde(0x19d),..._0x4033b1===void 0x0?{}:{'elementIds':_0x4033b1},..._0x5a8fb2===void 0x0?{}:{'region':_0x5a8fb2},..._0x49bc5f===void 0x0?{}:{'padding':_0x49bc5f},..._0x1e6875===void 0x0?{}:{'scale':_0x1e6875}}}});}case'base':return b(_0x7b2fee,[_0x5efbde(0x13e),_0x5efbde(0x147),_0x5efbde(0x1a2),_0x5efbde(0x18b),_0x5efbde(0x163),'region',_0x5efbde(0x1b5),_0x5efbde(0x197),'scale'],_0x5efbde(0x13a)),await _0x51d164[_0x5efbde(0x16f)](_0x17a0b5);}}function h(_0x55af5a){const _0x97b84f=_0x25f7;if(_0x55af5a===void 0x0||_0x55af5a['trim']()===_0x97b84f(0x153))return;if(_0x55af5a[_0x97b84f(0x189)]()[_0x97b84f(0x18a)]===0x0)throw new f(_0x97b84f(0x1b9));let _0x43f09b=[];for(let _0x232df1 of _0x55af5a[_0x97b84f(0x14c)](',')){let _0x126e7b=_0x232df1[_0x97b84f(0x189)]();if(_0x126e7b['length']===0x0)throw new f(_0x97b84f(0x1a1));let _0x447225=/^(\d+)(?:-(\d+))?$/[_0x97b84f(0x178)](_0x126e7b);if(_0x447225===null){_0x43f09b['push'](_0x126e7b);continue;}let _0x1f3c3f=Number(_0x447225[0x1]),_0x394fd1=Number(_0x447225[0x2]??_0x447225[0x1]);if(!Number[_0x97b84f(0x160)](_0x1f3c3f)||!Number[_0x97b84f(0x160)](_0x394fd1)||_0x1f3c3f<0x1||_0x394fd1<_0x1f3c3f)throw new f(_0x97b84f(0x14b)+JSON[_0x97b84f(0x1b3)](_0x232df1[_0x97b84f(0x189)]()));if(_0x394fd1-_0x1f3c3f+0x1>d)throw new f(_0x97b84f(0x1ab)+d+'\x20pages');for(let _0x5b72c2=_0x1f3c3f;_0x5b72c2<=_0x394fd1;_0x5b72c2+=0x1)_0x43f09b[_0x97b84f(0x167)](_0x5b72c2);if(_0x43f09b['length']>d)throw new f(_0x97b84f(0x1a5)+d+_0x97b84f(0x176));}return[...new Set(_0x43f09b)];}function g(_0xb28c37){const _0x28ce9e=_0x25f7;if(_0xb28c37===void 0x0)return;let _0x51e2a1=/^(\d+)x(\d+)$/iu[_0x28ce9e(0x178)](_0xb28c37[_0x28ce9e(0x189)]()),_0x278c85=Number(_0x51e2a1?.[0x1]),_0x13d0a5=Number(_0x51e2a1?.[0x2]);if(_0x51e2a1===null||!Number[_0x28ce9e(0x160)](_0x278c85)||_0x278c85<0x1||!Number[_0x28ce9e(0x160)](_0x13d0a5)||_0x13d0a5<0x1)throw new f(_0x28ce9e(0x183)+JSON['stringify'](_0xb28c37)+';\x20expected\x20<columns>x<rows>');return{'columns':_0x278c85,'rows':_0x13d0a5};}function _(_0x263664){const _0x32c702=_0x25f7;if(_0x263664===void 0x0)return;let _0x89c64d=[...new Set(_0x263664[_0x32c702(0x14c)](',')[_0x32c702(0x1a8)](_0x5492e9=>_0x5492e9[_0x32c702(0x189)]()))];if(_0x89c64d[_0x32c702(0x174)](_0x566bc6=>_0x566bc6[_0x32c702(0x18a)]===0x0))throw new f(_0x32c702(0x161));return _0x89c64d;}function v(_0x10734b){const _0x1d1451=_0x25f7;if(_0x10734b===void 0x0)return;let _0x5f3de7=_0x10734b['split'](','),_0x4e372c=_0x5f3de7[_0x1d1451(0x1a8)](Number);if(_0x5f3de7['length']!==0x4||_0x5f3de7['some'](_0x268f46=>_0x268f46[_0x1d1451(0x189)]()[_0x1d1451(0x18a)]===0x0)||_0x4e372c[_0x1d1451(0x18a)]!==0x4||!_0x4e372c[_0x1d1451(0x19b)](Number[_0x1d1451(0x15a)]))throw new f(_0x1d1451(0x1b4));let [_0x25cd1d,_0x14c73d,_0x228845,_0x6c07b4]=_0x4e372c;if(_0x228845<=0x0||_0x6c07b4<=0x0)throw new f('--region\x20width\x20and\x20height\x20must\x20be\x20positive');return{'left':_0x25cd1d,'top':_0x14c73d,'width':_0x228845,'height':_0x6c07b4};}function y(_0x41cdf1,_0x5630df){const _0x3a5261=_0x25f7;if(_0x5630df===void 0x0)return;if(_0x5630df[_0x3a5261(0x189)]()['length']===0x0)throw new f(_0x41cdf1+_0x3a5261(0x1a6));let _0x36114a=Number(_0x5630df);if(!Number['isFinite'](_0x36114a))throw new f(_0x41cdf1+'\x20must\x20be\x20a\x20finite\x20number');return _0x36114a;}function b(_0x19e2e1,_0x2fcb3d,_0x3ec8f2){const _0x895fd0=_0x25f7;for(let _0x3f8139 of _0x2fcb3d)if(_0x19e2e1[_0x3f8139]!==void 0x0)throw new f('--'+_0x3f8139[_0x895fd0(0x190)](/[A-Z]/gu,_0x203c9a=>'-'+_0x203c9a[_0x895fd0(0x15e)]())+_0x895fd0(0x198)+_0x3ec8f2);}function x(_0x2682f8,_0x4cd9cd){const _0x2bdf97=_0x25f7;if(_0x4cd9cd['length']!==_0x2682f8['images']['length'])throw Error(_0x2bdf97(0x169)+_0x4cd9cd[_0x2bdf97(0x18a)]+_0x2bdf97(0x144)+_0x2682f8['images'][_0x2bdf97(0x18a)]+'\x20images');for(let _0x2837db=0x0;_0x2837db<_0x4cd9cd[_0x2bdf97(0x18a)];_0x2837db+=0x1)if(_0x4cd9cd[_0x2837db]?.[_0x2bdf97(0x165)]!==_0x2682f8[_0x2bdf97(0x15c)][_0x2837db]?.[_0x2bdf97(0x165)])throw Error(_0x2bdf97(0x15d)+(_0x2837db+0x1)+_0x2bdf97(0x159));}function S(_0x1a935d,_0x1a1f1a){const _0x351b1c=_0x25f7;return{'ok':!0x0,'unitId':_0x1a935d[_0x351b1c(0x186)],'unitKind':_0x1a935d[_0x351b1c(0x14e)],'outputs':_0x1a935d[_0x351b1c(0x15c)]['map'](({bytes:_0x2a7262,..._0x1193d9},_0x51d982)=>({..._0x1193d9,'location':_0x1a1f1a[_0x51d982][_0x351b1c(0x1b7)]}))};}function C(_0x256fbb,_0x4645bd){const _0x46cffa=_0x25f7;_0x4645bd instanceof f&&_0x256fbb[_0x46cffa(0x17a)](_0x4645bd[_0x46cffa(0x194)],{'code':_0x46cffa(0x149),'exitCode':0x1}),(_0x4645bd instanceof _0x40c636||w(_0x4645bd))&&_0x256fbb[_0x46cffa(0x17a)](_0x4645bd[_0x46cffa(0x179)]+':\x20'+_0x4645bd[_0x46cffa(0x194)],{'code':'screenshot.failed','exitCode':0x1}),_0x4645bd instanceof Error&&_0x256fbb['error'](_0x4645bd[_0x46cffa(0x194)],{'code':_0x46cffa(0x1b2),'exitCode':0x1}),_0x256fbb[_0x46cffa(0x17a)](_0x46cffa(0x17d),{'code':_0x46cffa(0x1b2),'exitCode':0x1});}function w(_0x4ab883){const _0xefd873=_0x25f7;return _0x4ab883 instanceof Error&&typeof _0x4ab883['code']==_0xefd873(0x154);}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.2.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.2.0",
|
|
22
|
+
"@univer-cli/univer-render-runtime": "1.2.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"commander": "^15.0.0"
|