@typecad/typecad
Version:
🤖programmatically 💥create 🛰️hardware
1 lines • 8.69 kB
JavaScript
(function(_0x35e400,_0x1af277){const a6_0x1b0b80={_0x4b109b:0x281,_0x588805:0x26d,_0x38ea45:0x275,_0x25aef9:0x27d,_0xff3201:0x283,_0x1b907e:0x276,_0x256367:0x27b},_0x846c99=_0x35e400();function _0x28fcb4(_0xe6f79b,_0x2b619d){return a6_0x2da4(_0xe6f79b-0x114,_0x2b619d);}while(!![]){try{const _0x470950=parseInt(_0x28fcb4(0x28c,a6_0x1b0b80._0x4b109b))/(0x84+0x4f5*-0x1+-0x239*-0x2)+-parseInt(_0x28fcb4(0x278,a6_0x1b0b80._0x588805))/(-0x5a*-0x3a+-0x1762+-0x2*-0x180)*(parseInt(_0x28fcb4(0x281,0x27a))/(-0xae+0x48a+-0xc5*0x5))+parseInt(_0x28fcb4(0x287,0x28a))/(0xc18+0x1*0x2677+-0xe3*0x39)+parseInt(_0x28fcb4(a6_0x1b0b80._0x38ea45,a6_0x1b0b80._0x25aef9))/(0x198f+0x6a*0x1c+-0x2522*0x1)*(parseInt(_0x28fcb4(a6_0x1b0b80._0xff3201,a6_0x1b0b80._0x1b907e))/(-0x385*-0x1+-0xf6b+-0xbec*-0x1))+parseInt(_0x28fcb4(a6_0x1b0b80._0x256367,0x27e))/(0x8a+0x3fd*0x7+-0x1c6e)+parseInt(_0x28fcb4(0x279,a6_0x1b0b80._0x38ea45))/(-0x51*-0x51+-0x337*0x1+-0x1662)+-parseInt(_0x28fcb4(0x276,0x27c))/(-0x2*0x9d9+0xbf8+0x7c3);if(_0x470950===_0x1af277)break;else _0x846c99['push'](_0x846c99['shift']());}catch(_0x1cb5b3){_0x846c99['push'](_0x846c99['shift']());}}}(a6_0xad40,-0x494d4+-0x23311*-0x2+0x388b5));import{execSync}from'node:child_process';import{promisify}from'node:util';function a6_0xad40(){const _0x371503=['CgLWzq','y3rdqMC','vfLeD2W','CxbXC0e','mZm1ndDzsM5Hwu4','s2LdquqGy29TBq','re5WtKm','u1Hzuvy','AM9PBG','Aw5OzxjPDa','otCYnwjLzvnSyq','nZuYotCXnu1irwfgqW','sunOt28','mM5ZDuXKAq','mJa4mZm4ngnVEfjACq','zw5JB2rPBMC','mJa0nZu3n1nfwg1nCG','y3DK','De9buK8','AwnHzc5RAwnHza','A2LJywqTy2XPia','zxHWB3j0','ntK3ntrwD2zMq24','tuL3quW','nZGWy1roBvrW','DgLTzw91Da','Dg9tDhjPBMC','C3rKAw8','otq3ndKYALPLC05x'];a6_0xad40=function(){return _0x371503;};return a6_0xad40();}import{is_flatpak,kicad_cli_path}from'./kicad';const execAsync=promisify(execSync);export async function executeKiCADCommand(_0x256ed9,_0x4da25c=[],_0x1134be={}){const a6_0x52d392={_0x277b0f:0x348,_0x3d7fd0:0x356,_0x35bea9:0x35f,_0x3453d4:0x35b,_0x58e30c:0x35f,_0x439ebb:0x363,_0xc63653:0x35a,_0x461f0c:0x364,_0x28ece7:0x369,_0x5ad2bf:0x360,_0x1e62ac:0x35c},a6_0x1848d2={_0x3fa57e:0x1ef};function _0x1c1012(_0x1514fd,_0x456099){return a6_0x2da4(_0x1514fd-a6_0x1848d2._0x3fa57e,_0x456099);}const _0x17b120={'tOARO':function(_0xa1193e,_0x34c915,_0x5ac915){return _0xa1193e(_0x34c915,_0x5ac915);},'YSKBG':function(_0x55f9f1,_0x16cebc,_0x51b1a7){return _0x55f9f1(_0x16cebc,_0x51b1a7);},'ctCBg':_0x1c1012(0x363,0x360)},_0x4da616=_0x17b120[_0x1c1012(0x358,0x357)](buildKiCADCommand,_0x256ed9,_0x4da25c);try{if(_0x1134be['stdio']===_0x1c1012(0x34f,a6_0x52d392._0x277b0f)){const _0x5d95d0={};return _0x5d95d0[_0x1c1012(0x357,a6_0x52d392._0x3d7fd0)]=_0x1134be['cwd'],_0x5d95d0[_0x1c1012(0x361,0x36b)]=_0x1c1012(0x34f,0x34b),_0x5d95d0[_0x1c1012(a6_0x52d392._0x35bea9,a6_0x52d392._0x3453d4)]=_0x1134be[_0x1c1012(a6_0x52d392._0x58e30c,0x357)],execSync(_0x4da616,_0x5d95d0),'';}else{const _0x21bdf9=await _0x17b120['YSKBG'](execAsync,_0x4da616,{'cwd':_0x1134be['cwd'],'timeout':_0x1134be[_0x1c1012(a6_0x52d392._0x58e30c,a6_0x52d392._0x439ebb)],'stdio':[_0x1c1012(a6_0x52d392._0x439ebb,a6_0x52d392._0xc63653),_0x17b120[_0x1c1012(a6_0x52d392._0x461f0c,0x35f)],_0x17b120[_0x1c1012(a6_0x52d392._0x461f0c,a6_0x52d392._0x28ece7)]]});return _0x21bdf9['stdout'][_0x1c1012(a6_0x52d392._0x5ad2bf,a6_0x52d392._0x1e62ac)]();}}catch(_0x5918fd){throw new Error('KiCAD\x20comm'+'and\x20failed'+':\x20'+_0x4da616+'\x0a'+_0x5918fd);}}export function executeKiCADCommandSync(_0x54e574,_0x22a19c=[],_0x45468b={}){const a6_0x24661f={_0x41b317:0x118,_0x4a87bc:0x11b,_0x53413f:0x11e,_0x5bed6a:0x12c,_0x3062db:0x12e,_0x4a338a:0x12a,_0x11e3b3:0x11d,_0x2d7516:0x120,_0x49cecd:0x134,_0x545145:0x111,_0x5b0a31:0x131,_0x3f5e3a:0x136},a6_0x4d2013={_0x110a3e:0x48},_0x27c446={};_0x27c446['TYDwl']=function(_0x700478,_0xb4b041){return _0x700478===_0xb4b041;},_0x27c446['MIwAL']=_0x16fb74(a6_0x24661f._0x41b317,0x10e),_0x27c446[_0x16fb74(0x115,0x120)]='utf8',_0x27c446[_0x16fb74(a6_0x24661f._0x4a87bc,a6_0x24661f._0x53413f)]=_0x16fb74(a6_0x24661f._0x5bed6a,0x12b);const _0x56df0c=_0x27c446,_0x1810f1=buildKiCADCommand(_0x54e574,_0x22a19c);function _0x16fb74(_0x591dbe,_0x4a8db8){return a6_0x2da4(_0x591dbe- -a6_0x4d2013._0x110a3e,_0x4a8db8);}try{if(_0x56df0c[_0x16fb74(a6_0x24661f._0x3062db,a6_0x24661f._0x3062db)](_0x45468b['stdio'],_0x56df0c['MIwAL'])){const _0x42e053={};return _0x42e053['cwd']=_0x45468b['cwd'],_0x42e053[_0x16fb74(a6_0x24661f._0x4a338a,a6_0x24661f._0x11e3b3)]=_0x56df0c[_0x16fb74(0x126,0x11d)],_0x42e053[_0x16fb74(0x128,0x12a)]=_0x45468b['timeout'],execSync(_0x1810f1,_0x42e053),'';}else{const _0x1b2de3={};return _0x1b2de3['cwd']=_0x45468b[_0x16fb74(a6_0x24661f._0x2d7516,0x125)],_0x1b2de3[_0x16fb74(a6_0x24661f._0x53413f,0x126)]=_0x56df0c['DNpNC'],_0x1b2de3[_0x16fb74(0x128,a6_0x24661f._0x49cecd)]=_0x45468b['timeout'],_0x1b2de3[_0x16fb74(0x12a,0x131)]=[_0x16fb74(0x12c,0x137),'pipe',_0x56df0c[_0x16fb74(0x11b,a6_0x24661f._0x545145)]],execSync(_0x1810f1,_0x1b2de3);}}catch(_0x448de1){throw new Error(_0x16fb74(a6_0x24661f._0x5b0a31,a6_0x24661f._0x3f5e3a)+'and\x20failed'+':\x20'+_0x1810f1+'\x0a'+_0x448de1);}}function buildKiCADCommand(_0x419b5e,_0x5cc4be){const a6_0x2ed7c7={_0x2f844f:0x155,_0x5776aa:0x148};function _0x2de69d(_0x1111d4,_0x598b6a){return a6_0x2da4(_0x598b6a- -0x23,_0x1111d4);}if(is_flatpak){const _0x1ffb2a=_0x2de69d(a6_0x2ed7c7._0x2f844f,a6_0x2ed7c7._0x5776aa)+_0x419b5e+'\x20'+_0x5cc4be[_0x2de69d(0x131,0x13c)]('\x20');return'flatpak\x20ru'+'n\x20--comman'+'d=sh\x20org.k'+_0x2de69d(0x144,0x147)+'\x20-c\x20\x22'+_0x1ffb2a+'\x22';}else{const _0x17520a=kicad_cli_path||'kicad-cli',_0x36cdea=_0x17520a['includes']('\x20')?'\x22'+_0x17520a+'\x22':_0x17520a;return _0x36cdea+'\x20'+_0x419b5e+'\x20'+_0x5cc4be[_0x2de69d(0x130,0x13c)]('\x20');}}export async function runDRC(_0x484c50,_0x12613f={}){return executeKiCADCommand('drc',[_0x484c50],_0x12613f);}export async function upgradeFootprint(_0x2fb89f,_0x1246c3={}){const _0x58ecd4={};_0x58ecd4['gByUg']='upgrade';const _0x2a146c=_0x58ecd4;return executeKiCADCommand('fp',[_0x2a146c['gByUg'],_0x2fb89f],_0x1246c3);}export async function exportPCB(_0x15091d,_0x34b6e9,_0xd9d2a9,_0x4b47c1={}){const a6_0x45a24b={_0x53123f:0x5f},a6_0x100a2f={_0x3acf11:0xf1};function _0xee6f8c(_0x5c0ff9,_0x3ec460){return a6_0x2da4(_0x5c0ff9- -a6_0x100a2f._0x3acf11,_0x3ec460);}const _0x3cc857={'SXYQV':'export','tFgIZ':function(_0x3f7df2,_0x5e7294,_0x171e2c,_0x5366cc){return _0x3f7df2(_0x5e7294,_0x171e2c,_0x5366cc);}},_0x20dc0e=[_0x3cc857[_0xee6f8c(0x6d,a6_0x45a24b._0x53123f)],_0xd9d2a9,_0x15091d,'-o',_0x34b6e9];return _0x3cc857['tFgIZ'](executeKiCADCommand,'',_0x20dc0e,_0x4b47c1);}function a6_0x2da4(_0x587353,_0x3398dc){const _0x14853a=a6_0xad40();return a6_0x2da4=function(_0x4bc03b,_0x3fefe9){_0x4bc03b=_0x4bc03b-(-0xc04+-0x25bf+-0x20*-0x199);let _0x336bfb=_0x14853a[_0x4bc03b];if(a6_0x2da4['CtPDbc']===undefined){var _0xcf31e2=function(_0x2dc130){const _0x2ff11d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x40409d='',_0x4a666c='';for(let _0x15068f=-0x27f*-0x6+-0x1*0x1b47+0xc4d,_0x28c5a6,_0x542b95,_0x4b63cb=0x1f58+-0x1df9+-0x15f;_0x542b95=_0x2dc130['charAt'](_0x4b63cb++);~_0x542b95&&(_0x28c5a6=_0x15068f%(0xdad+-0x21d+-0xb8c)?_0x28c5a6*(0x35b*-0x3+0x29*0x86+0x3b7*-0x3)+_0x542b95:_0x542b95,_0x15068f++%(0x1b41+0x1dc7*-0x1+0xd*0x32))?_0x40409d+=String['fromCharCode'](-0x3*-0xf1+0xa64+-0xc38&_0x28c5a6>>(-(-0xa61*0x1+0x474+0x5ef)*_0x15068f&0x131*-0x1e+0x4e0+-0x7b9*-0x4)):-0x23*-0x39+-0xc41+0x476){_0x542b95=_0x2ff11d['indexOf'](_0x542b95);}for(let _0x55760a=0x1043+0xb64*-0x1+-0x1*0x4df,_0x3366c4=_0x40409d['length'];_0x55760a<_0x3366c4;_0x55760a++){_0x4a666c+='%'+('00'+_0x40409d['charCodeAt'](_0x55760a)['toString'](-0x15ee+0x17*-0x12f+0x3137))['slice'](-(-0x1*-0x59+0x11fb+-0x1d5*0xa));}return decodeURIComponent(_0x4a666c);};a6_0x2da4['RlbJBy']=_0xcf31e2,_0x587353=arguments,a6_0x2da4['CtPDbc']=!![];}const _0x4a783a=_0x14853a[0x6*0x501+-0xd*0xa9+0x1*-0x1571],_0x1a523e=_0x4bc03b+_0x4a783a,_0xc97db0=_0x587353[_0x1a523e];return!_0xc97db0?(_0x336bfb=a6_0x2da4['RlbJBy'](_0x336bfb),_0x587353[_0x1a523e]=_0x336bfb):_0x336bfb=_0xc97db0,_0x336bfb;},a6_0x2da4(_0x587353,_0x3398dc);}export async function exportSchematic(_0x497aeb,_0x8f38a4,_0xf50f22,_0x463cfe={}){const a6_0x50d5e8={_0x3820f4:0xb2},_0x4ffe5a={'qpqsA':function(_0xc1f7f9,_0x15bf84,_0x11aadb,_0x1c4160){return _0xc1f7f9(_0x15bf84,_0x11aadb,_0x1c4160);}},_0x3999f0=[_0x52d34f(0xa9,a6_0x50d5e8._0x3820f4),_0xf50f22,_0x497aeb,'-o',_0x8f38a4];function _0x52d34f(_0x36de89,_0x552360){return a6_0x2da4(_0x552360- -0xba,_0x36de89);}return _0x4ffe5a[_0x52d34f(0xcb,0xbd)](executeKiCADCommand,'',_0x3999f0,_0x463cfe);}