diff --git a/README.md b/README.md index ef8324c..703f7ad 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ The pre-built hex file is for ATMega 328P@16MHz; to use a different MCU of the s When building for Logic Green AVR clones, select "atmega328p" as target. The macro ARDUINO_AVR_LARDU_328E must also be defined, either in the "sys.h" file (using #define) or in the gcc command line (by adding -DARDUINO_AVR_LARDU_328E). This allows the code to know the target is a LGT chip, and set the chip core speed at run time from F_CPU. Recommended values for F_CPU are 32MHz or 16MHz; 8MHz also works but is less reliable. +## Loading Pre-Built hex file to an Arduino Nano using Web Serial + +For certain browsers with support for Web Serial APIs (e.g. chrome) you can opt to use the web based serial uploader to upload the above prebuilt binaries that were created with avr-gcc. + +[Click Here To Access The Web Serial Arduino Nano Flasher](./tools/webSerialUploader) + ## Building with Arduino IDE diff --git a/tools/webSerialUploader/Blink.ino.eightanaloginputs.hex b/tools/webSerialUploader/Blink.ino.eightanaloginputs.hex new file mode 100644 index 0000000..c93f4a6 --- /dev/null +++ b/tools/webSerialUploader/Blink.ino.eightanaloginputs.hex @@ -0,0 +1,59 @@ +:100000000C945C000C946E000C946E000C946E00CA +:100010000C946E000C946E000C946E000C946E00A8 +:100020000C946E000C946E000C946E000C946E0098 +:100030000C946E000C946E000C946E000C946E0088 +:100040000C9413010C946E000C946E000C946E00D2 +:100050000C946E000C946E000C946E000C946E0068 +:100060000C946E000C946E00000000002400270029 +:100070002A0000000000250028002B0004040404CE +:100080000404040402020202020203030303030342 +:10009000010204081020408001020408102001021F +:1000A00004081020000000080002010000030407FB +:1000B000000000000000000011241FBECFEFD8E0B8 +:1000C000DEBFCDBF21E0A0E0B1E001C01D92A930AC +:1000D000B207E1F70E945D010C94CC010C94000082 +:1000E000E1EBF0E02491EDE9F0E09491E9E8F0E053 +:1000F000E491EE23C9F0222339F0233001F1A8F472 +:10010000213019F1223029F1F0E0EE0FFF1FEE58F7 +:10011000FF4FA591B4912FB7F894EC91811126C0AF +:1001200090959E239C932FBF08952730A9F02830E7 +:10013000C9F0243049F7209180002F7D03C0209121 +:1001400080002F7720938000DFCF24B52F7724BD48 +:10015000DBCF24B52F7DFBCF2091B0002F772093EC +:10016000B000D2CF2091B0002F7DF9CF9E2BDACFF7 +:100170003FB7F8948091050190910601A091070185 +:10018000B091080126B5A89B05C02F3F19F0019634 +:10019000A11DB11D3FBFBA2FA92F982F8827BC01E1 +:1001A000CD01620F711D811D911D42E0660F771F09 +:1001B000881F991F4A95D1F708958F929F92AF9209 +:1001C000BF92CF92DF92EF92FF920E94B8004B0154 +:1001D0005C0188EEC82E83E0D82EE12CF12C0E9421 +:1001E000B800681979098A099B09683E734081053E +:1001F0009105A8F321E0C21AD108E108F10888EEC0 +:10020000880E83E0981EA11CB11CC114D104E10426 +:10021000F10429F7FF90EF90DF90CF90BF90AF905F +:100220009F908F9008951F920F920FB60F921124F6 +:100230002F933F938F939F93AF93BF93809101012F +:1002400090910201A0910301B0910401309100014D +:1002500023E0230F2D3758F50196A11DB11D2093E2 +:1002600000018093010190930201A0930301B093D8 +:1002700004018091050190910601A0910701B091C0 +:1002800008010196A11DB11D8093050190930601FF +:10029000A0930701B0930801BF91AF919F918F91F7 +:1002A0003F912F910F900FBE0F901F90189526E849 +:1002B000230F0296A11DB11DD2CF789484B5826020 +:1002C00084BD84B5816084BD85B5826085BD85B5FA +:1002D000816085BD80916E00816080936E00109278 +:1002E00081008091810082608093810080918100F3 +:1002F0008160809381008091800081608093800084 +:100300008091B10084608093B1008091B0008160E1 +:100310008093B00080917A00846080937A0080910D +:100320007A00826080937A0080917A008160809365 +:100330007A0080917A00806880937A001092C100E0 +:10034000EDE9F0E02491E9E8F0E08491882399F068 +:1003500090E0880F991FFC01E859FF4FA591B491D7 +:10036000FC01EE58FF4F859194918FB7F894EC9172 +:10037000E22BEC938FBFC0E0D0E081E00E947000E0 +:100380000E94DD0080E00E9470000E94DD00209746 +:0C039000A1F30E940000F1CFF894FFCF11 +:00000001FF diff --git a/tools/webSerialUploader/arduino-web-uploader.v1.1.2.js b/tools/webSerialUploader/arduino-web-uploader.v1.1.2.js new file mode 100644 index 0000000..143de6f --- /dev/null +++ b/tools/webSerialUploader/arduino-web-uploader.v1.1.2.js @@ -0,0 +1,2 @@ +/*! For license information please see main.js.LICENSE.txt */ +(()=>{var e={184:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Serial=void 0;const n=r(90);class i{async close(){if(this.reader){const e=this.reader;this.reader=void 0,await e.reader.cancel()}if(this.writer){const e=this.writer;this.writer=void 0,await e.close()}if(this.port){const e=this.port;this.port=void 0,await e.close()}}async connectWithPaired(e){const[t]=await navigator.serial.getPorts();if(!t)throw new Error("no paired");return this._connect(e,t)}async connect(e,t={}){const r=await navigator.serial.requestPort(t);return this._connect(e,r)}async _connect(e,t){e={baudRate:9600,dataBits:8,stopBits:1,parity:"none",bufferSize:255,rtscts:!1,xon:!1,xoff:!1,...e},this.port&&await this.close(),this.port=t,await this.port.open(e),this.reader=new n.ReadableWebToNodeStream(this.port.readable),this.writer=this.port.writable.getWriter();const r=this.reader;return r.write=(e,t)=>(this.writer.write(e).then((()=>t(null)),t),!0),r}}t.Serial=i;const o=new i;t.default=o},590:function(e,t,r){"use strict";var n=r(764).Buffer,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.upload=t.boards=void 0;const u=s(r(184)),f=s(r(664)),l=a(r(620)),c=s(r(107)),{version:h}=r(306);t.boards={avr4809:{signature:n.from([30,150,81]),pageSize:128,timeout:400,baudRate:115200,use_8_bit_addresseses:!0},lgt8f328p:{signature:n.from([30,149,15]),pageSize:128,timeout:400,baudRate:57600},nanoOldBootloader:{signature:n.from([30,149,15]),pageSize:128,timeout:400,baudRate:57600},nano:{signature:n.from([30,149,15]),pageSize:128,timeout:400,baudRate:115200},uno:{signature:n.from([30,149,15]),pageSize:128,timeout:400,baudRate:115200},proMini:{signature:n.from([30,149,15]),pageSize:128,timeout:400,baudRate:115200}};const p=e=>e();async function d(e,t,r,n=!1,i={}){try{const o=await fetch(t).then((e=>e.text()));let{data:a}=l.parse(o);const s=await u.default.connect({baudRate:e.baudRate},i);r(0);const h=new c.default;let d=0,y=a.length/e.pageSize;n&&(y*=2),h.log=t=>{if("page done"===t||"verify done"===t){d+=1;const e=Math.round(100*d/y);r(e)}console.log(t,d,y,a.length,e.pageSize)},await f.default.series([h.sync.bind(h,s,3,e.timeout),h.sync.bind(h,s,3,e.timeout),h.sync.bind(h,s,3,e.timeout),h.verifySignature.bind(h,s,e.signature,e.timeout),h.setOptions.bind(h,s,{},e.timeout),h.enterProgrammingMode.bind(h,s,e.timeout),h.upload.bind(h,s,a,e.pageSize,e.timeout,e.use_8_bit_addresseses),n?h.verify.bind(h,s,a,e.pageSize,e.timeout,e.use_8_bit_addresseses):p,h.exitProgrammingMode.bind(h,s,e.timeout)])}finally{u.default.close()}}console.log("Arduino Web Uploader Version:",h),t.upload=d,t.default=d},204:(e,t,r)=>{"use strict";const n=r(590);document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll("[arduino-uploader]").forEach((e=>{e.addEventListener("click",(async()=>{if(!navigator.serial)return alert("Please enable the Web Serial API first: https://web.dev/serial/#use");const t=e.getAttribute("hex-href"),r=e.getAttribute("board"),i=e.hasAttribute("verify"),o=e.querySelector(".upload-progress"),a=e=>{o.innerHTML=e+"%"};let s={};try{s={filters:JSON.parse(e.getAttribute("port-filters"))||[]}}catch(e){}try{await n.upload(n.boards[r],t,a,i,s)}catch(e){throw o.innerHTML="Error!",alert(e),e}o.innerHTML="Done!",console.log("Upload successful!\nEnvious? here's how https://github.com/dbuezas/arduino-web-uploader")}))}))}))},664:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>yt,apply:()=>i,applyEach:()=>x,applyEachSeries:()=>j,asyncify:()=>c,auto:()=>B,autoInject:()=>W,cargo:()=>H,cargoQueue:()=>V,compose:()=>J,concat:()=>Z,concatLimit:()=>$,concatSeries:()=>ee,constant:()=>te,detect:()=>ne,detectLimit:()=>ie,detectSeries:()=>oe,dir:()=>se,doUntil:()=>fe,doWhilst:()=>ue,each:()=>ce,eachLimit:()=>he,eachOf:()=>L,eachOfLimit:()=>T,eachOfSeries:()=>M,eachSeries:()=>pe,ensureAsync:()=>de,every:()=>ye,everyLimit:()=>ge,everySeries:()=>ve,filter:()=>_e,filterLimit:()=>Se,filterSeries:()=>Ee,forever:()=>Re,groupBy:()=>Ae,groupByLimit:()=>Te,groupBySeries:()=>ke,log:()=>Le,map:()=>O,mapLimit:()=>X,mapSeries:()=>C,mapValues:()=>xe,mapValuesLimit:()=>Oe,mapValuesSeries:()=>Me,memoize:()=>Ce,nextTick:()=>je,parallel:()=>Ie,parallelLimit:()=>Be,priorityQueue:()=>Fe,queue:()=>Ne,race:()=>We,reduce:()=>Y,reduceRight:()=>ze,reflect:()=>Ke,reflectAll:()=>Ge,reject:()=>Ve,rejectLimit:()=>Ye,rejectSeries:()=>Qe,retry:()=>Xe,retryable:()=>Ze,seq:()=>Q,series:()=>et,setImmediate:()=>l,some:()=>tt,someLimit:()=>rt,someSeries:()=>nt,sortBy:()=>it,timeout:()=>ot,times:()=>st,timesLimit:()=>at,timesSeries:()=>ut,transform:()=>ft,tryEach:()=>lt,unmemoize:()=>ct,until:()=>pt,waterfall:()=>dt,whilst:()=>ht,all:()=>ye,allLimit:()=>ge,allSeries:()=>ve,any:()=>tt,anyLimit:()=>rt,anySeries:()=>nt,find:()=>ne,findLimit:()=>ie,findSeries:()=>oe,flatMap:()=>Z,flatMapLimit:()=>$,flatMapSeries:()=>ee,forEach:()=>ce,forEachSeries:()=>pe,forEachLimit:()=>he,forEachOf:()=>L,forEachOfSeries:()=>M,forEachOfLimit:()=>T,inject:()=>Y,foldl:()=>Y,foldr:()=>ze,select:()=>_e,selectLimit:()=>Se,selectSeries:()=>Ee,wrapSync:()=>c,during:()=>ht,doDuring:()=>ue});var n=r(155);function i(e,...t){return(...r)=>e(...t,...r)}function o(e){return function(...t){var r=t.pop();return e.call(this,t,r)}}var a="function"==typeof setImmediate&&setImmediate,s="object"==typeof n&&"function"==typeof n.nextTick;function u(e){setTimeout(e,0)}function f(e){return(t,...r)=>e((()=>t(...r)))}var l=f(a?setImmediate:s?n.nextTick:u);function c(e){return d(e)?function(...t){const r=t.pop();return h(e.apply(this,t),r)}:o((function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}if(n&&"function"==typeof n.then)return h(n,r);r(null,n)}))}function h(e,t){return e.then((e=>{p(t,null,e)}),(e=>{p(t,e&&e.message?e:new Error(e))}))}function p(e,t,r){try{e(t,r)}catch(e){l((e=>{throw e}),e)}}function d(e){return"AsyncFunction"===e[Symbol.toStringTag]}function y(e){if("function"!=typeof e)throw new Error("expected a function");return d(e)?c(e):e}function g(e,t=e.length){if(!t)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[t-1]?e.apply(this,r):new Promise(((n,i)=>{r[t-1]=(e,...t)=>{if(e)return i(e);n(t.length>1?t:t[0])},e.apply(this,r)}))}}function v(e){return function(t,...r){return g((function(n){var i=this;return e(t,((e,t)=>{y(e).apply(i,r.concat(t))}),n)}))}}function m(e,t,r,n){t=t||[];var i=[],o=0,a=y(r);return e(t,((e,t,r)=>{var n=o++;a(e,((e,t)=>{i[n]=t,r(e)}))}),(e=>{n(e,i)}))}function b(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const w={};function _(e){function t(...t){if(null!==e){var r=e;e=null,r.apply(this,t)}}return Object.assign(t,e),t}function S(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var r=e;e=null,r.apply(this,t)}}function E(e,t,r,n){let i=!1,o=!1,a=!1,s=0,u=0;function f(){s>=t||a||i||(a=!0,e.next().then((({value:e,done:t})=>{if(!o&&!i){if(a=!1,t)return i=!0,void(s<=0&&n(null));s++,r(e,u,l),u++,f()}})).catch(c))}function l(e,t){if(s-=1,!o)return e?c(e):!1===e?(i=!0,void(o=!0)):t===w||i&&s<=0?(i=!0,n(null)):void f()}function c(e){o||(a=!1,i=!0,n(e))}f()}var R=e=>(t,r,n)=>{if(n=_(n),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return n(null);if("AsyncGenerator"===t[Symbol.toStringTag])return E(t,e,r,n);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return E(t[Symbol.asyncIterator](),e,r,n);var i=function(e){if(b(e))return function(e){var t=-1,r=e.length;return function(){return++t1?n:n[0])}return r[P]=new Promise(((r,n)=>{e=r,t=n})),r}function B(e,t,r){"number"!=typeof t&&(r=t,t=null),r=_(r||I());var n=Object.keys(e).length;if(!n)return r(null);t||(t=n);var i={},o=0,a=!1,s=!1,u=Object.create(null),f=[],l=[],c={};function h(e,t){f.push((()=>function(e,t){if(!s){var n=S(((t,...n)=>{if(o--,!1!==t)if(n.length<2&&([n]=n),t){var f={};if(Object.keys(i).forEach((e=>{f[e]=i[e]})),f[e]=n,s=!0,u=Object.create(null),a)return;r(t,f)}else i[e]=n,(u[e]||[]).forEach((e=>e())),p();else a=!0}));o++;var f=y(t[t.length-1]);t.length>1?f(i,n):f(n)}}(e,t)))}function p(){if(!a){if(0===f.length&&0===o)return r(null,i);for(;f.length&&o{const i=e[n];Array.isArray(i)&&i.indexOf(t)>=0&&r.push(n)})),r}return Object.keys(e).forEach((t=>{var r=e[t];if(!Array.isArray(r))return h(t,[r]),void l.push(t);var n=r.slice(0,r.length-1),i=n.length;if(0===i)return h(t,r),void l.push(t);c[t]=i,n.forEach((o=>{if(!e[o])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+o+"` in "+n.join(", "));var a,s;(s=u[a=o])||(s=u[a]=[]),s.push((()=>{0==--i&&h(t,r)}))}))})),function(){for(var e=0;l.length;)e++,d(l.pop()).forEach((e=>{0==--c[e]&&l.push(e)}));if(e!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p(),r[P]}var N=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,D=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,U=/,/,q=/(=.+)?(\s*)$/,F=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function W(e,t){var r={};return Object.keys(e).forEach((t=>{var n,i=e[t],o=d(i),a=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))n=[...i],i=n.pop(),r[t]=n.concat(n.length>0?s:i);else if(a)r[t]=i;else{if(n=function(e){const t=e.toString().replace(F,"");let r=t.match(N);if(r||(r=t.match(D)),!r)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,n]=r;return n.replace(/\s/g,"").split(U).map((e=>e.replace(q,"").trim()))}(i),0===i.length&&!o&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");o||n.pop(),r[t]=n.concat(s)}function s(e,t){var r=n.map((t=>e[t]));r.push(t),y(i)(...r)}})),B(r,t)}class z{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):K(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):K(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:r}=t;e(t)&&this.removeLink(t),t=r}return this}}function K(e,t){e.length=1,e.head=e.tail=t}function G(e,t,r){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var n=y(e),i=0,o=[];const a={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,t){return e?t?void(a[e]=a[e].filter((e=>e!==t))):a[e]=[]:Object.keys(a).forEach((e=>a[e]=[]))}function u(e,...t){a[e].forEach((e=>e(...t)))}var f=!1;function c(e,t,r,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");var i,o;function a(e,...t){return e?r?o(e):i():t.length<=1?i(t[0]):void i(t)}v.started=!0;var s={data:e,callback:r?a:n||a};if(t?v._tasks.unshift(s):v._tasks.push(s),f||(f=!0,l((()=>{f=!1,v.process()}))),r||!n)return new Promise(((e,t)=>{i=e,o=t}))}function h(e){return function(t,...r){i-=1;for(var n=0,a=e.length;n0&&o.splice(f,1),s.callback(t,...r),null!=t&&u("error",t,s.data)}i<=v.concurrency-v.buffer&&u("unsaturated"),v.idle()&&u("drain"),v.process()}}function p(e){return!(0!==e.length||!v.idle()||(l((()=>u("drain"))),0))}const d=e=>t=>{if(!t)return new Promise(((t,r)=>{!function(e,n){const i=(...n)=>{s(e,i),((e,n)=>{if(e)return r(e);t(n)})(...n)};a[e].push(i)}(e)}));s(e),function(e,t){a[e].push(t)}(e,t)};var g=!1,v={_tasks:new z,*[Symbol.iterator](){yield*v._tasks[Symbol.iterator]()},concurrency:t,payload:r,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(p(e))return;return e.map((e=>c(e,!1,!1,t)))}return c(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(p(e))return;return e.map((e=>c(e,!1,!0,t)))}return c(e,!1,!0,t)},kill(){s(),v._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(p(e))return;return e.map((e=>c(e,!0,!1,t)))}return c(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(p(e))return;return e.map((e=>c(e,!0,!0,t)))}return c(e,!0,!0,t)},remove(e){v._tasks.remove(e)},process(){if(!g){for(g=!0;!v.paused&&iv._tasks.length,running:()=>i,workersList:()=>o,idle:()=>v._tasks.length+i===0,pause(){v.paused=!0},resume(){!1!==v.paused&&(v.paused=!1,l(v.process))}};return Object.defineProperties(v,{saturated:{writable:!1,value:d("saturated")},unsaturated:{writable:!1,value:d("unsaturated")},empty:{writable:!1,value:d("empty")},drain:{writable:!1,value:d("drain")},error:{writable:!1,value:d("error")}}),v}function H(e,t){return G(e,1,t)}function V(e,t,r){return G(e,t,r)}var Y=g((function(e,t,r,n){n=_(n);var i=y(r);return M(e,((e,r,n)=>{i(t,e,((e,r)=>{t=r,n(e)}))}),(e=>n(e,t)))}),4);function Q(...e){var t=e.map(y);return function(...e){var r=this,n=e[e.length-1];return"function"==typeof n?e.pop():n=I(),Y(t,e,((e,t,n)=>{t.apply(r,e.concat(((e,...t)=>{n(e,t)})))}),((e,t)=>n(e,...t))),n[P]}}function J(...e){return Q(...e.reverse())}var X=g((function(e,t,r,n){return m(R(t),e,r,n)}),4),$=g((function(e,t,r,n){var i=y(r);return X(e,t,((e,t)=>{i(e,((e,...r)=>e?t(e):t(e,r)))}),((e,t)=>{for(var r=[],i=0;i{var a,s=!1;const u=y(i);r(n,((r,n,i)=>{u(r,((n,o)=>n||!1===n?i(n):e(o)&&!a?(s=!0,a=t(!0,r),i(null,w)):void i()))}),(e=>{if(e)return o(e);o(null,s?a:t(!1))}))}}var ne=g((function(e,t,r){return re((e=>e),((e,t)=>t))(L,e,t,r)}),3),ie=g((function(e,t,r,n){return re((e=>e),((e,t)=>t))(R(t),e,r,n)}),4),oe=g((function(e,t,r){return re((e=>e),((e,t)=>t))(R(1),e,t,r)}),3);function ae(e){return(t,...r)=>y(t)(...r,((t,...r)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&r.forEach((t=>console[e](t))))}))}var se=ae("dir"),ue=g((function(e,t,r){r=S(r);var n,i=y(e),o=y(t);function a(e,...t){if(e)return r(e);!1!==e&&(n=t,o(...t,s))}function s(e,t){return e?r(e):!1!==e?t?void i(a):r(null,...n):void 0}return s(null,!0)}),3);function fe(e,t,r){const n=y(t);return ue(e,((...e)=>{const t=e.pop();n(...e,((e,r)=>t(e,!r)))}),r)}function le(e){return(t,r,n)=>e(t,n)}var ce=g((function(e,t,r){return L(e,le(y(t)),r)}),3),he=g((function(e,t,r,n){return R(t)(e,le(y(r)),n)}),4),pe=g((function(e,t,r){return he(e,1,t,r)}),3);function de(e){return d(e)?e:function(...t){var r=t.pop(),n=!0;t.push(((...e)=>{n?l((()=>r(...e))):r(...e)})),e.apply(this,t),n=!1}}var ye=g((function(e,t,r){return re((e=>!e),(e=>!e))(L,e,t,r)}),3),ge=g((function(e,t,r,n){return re((e=>!e),(e=>!e))(R(t),e,r,n)}),4),ve=g((function(e,t,r){return re((e=>!e),(e=>!e))(M,e,t,r)}),3);function me(e,t,r,n){var i=new Array(t.length);e(t,((e,t,n)=>{r(e,((e,r)=>{i[t]=!!r,n(e)}))}),(e=>{if(e)return n(e);for(var r=[],o=0;o{r(e,((r,o)=>{if(r)return n(r);o&&i.push({index:t,value:e}),n(r)}))}),(e=>{if(e)return n(e);n(null,i.sort(((e,t)=>e.index-t.index)).map((e=>e.value)))}))}function we(e,t,r,n){return(b(t)?me:be)(e,t,y(r),n)}var _e=g((function(e,t,r){return we(L,e,t,r)}),3),Se=g((function(e,t,r,n){return we(R(t),e,r,n)}),4),Ee=g((function(e,t,r){return we(M,e,t,r)}),3),Re=g((function(e,t){var r=S(t),n=y(de(e));return function e(t){if(t)return r(t);!1!==t&&n(e)}()}),2),Te=g((function(e,t,r,n){var i=y(r);return X(e,t,((e,t)=>{i(e,((r,n)=>r?t(r):t(r,{key:n,val:e})))}),((e,t)=>{for(var r={},{hasOwnProperty:i}=Object.prototype,o=0;o{o(e,t,((e,n)=>{if(e)return r(e);i[t]=n,r(e)}))}),(e=>n(e,i)))}),4);function xe(e,t,r){return Oe(e,1/0,t,r)}function Me(e,t,r){return Oe(e,1,t,r)}function Ce(e,t=(e=>e)){var r=Object.create(null),n=Object.create(null),i=y(e),a=o(((e,o)=>{var a=t(...e);a in r?l((()=>o(null,...r[a]))):a in n?n[a].push(o):(n[a]=[o],i(...e,((e,...t)=>{e||(r[a]=t);var i=n[a];delete n[a];for(var o=0,s=i.length;o{var n=b(t)?[]:{};e(t,((e,t,r)=>{y(e)(((e,...i)=>{i.length<2&&([i]=i),n[t]=i,r(e)}))}),(e=>r(e,n)))}),3);function Ie(e,t){return Pe(L,e,t)}function Be(e,t,r){return Pe(R(t),e,r)}function Ne(e,t){var r=y(e);return G(((e,t)=>{r(e[0],t)}),t,1)}class De{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let t;for(;e>0&&qe(this.heap[e],this.heap[t=Ue(e)]);){let r=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=r,e=t}}percDown(e){let t;for(;(t=1+(e<<1))=0;e--)this.percDown(e);return this}}function Ue(e){return(e+1>>1)-1}function qe(e,t){return e.priority!==t.priority?e.priority{})){if("function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,Array.isArray(e)||(e=[e]),0===e.length&&r.idle())return l((()=>r.drain()));for(var i=0,o=e.length;i{let n={};if(e&&(n.error=e),t.length>0){var i=t;t.length<=1&&([i]=t),n.value=i}r(null,n)})),t.apply(this,e)}))}function Ge(e){var t;return Array.isArray(e)?t=e.map(Ke):(t={},Object.keys(e).forEach((r=>{t[r]=Ke.call(this,e[r])}))),t}function He(e,t,r,n){const i=y(r);return we(e,t,((e,t)=>{i(e,((e,r)=>{t(e,!r)}))}),n)}var Ve=g((function(e,t,r){return He(L,e,t,r)}),3),Ye=g((function(e,t,r,n){return He(R(t),e,r,n)}),4),Qe=g((function(e,t,r){return He(M,e,t,r)}),3);function Je(e){return function(){return e}}function Xe(e,t,r){var n={times:5,intervalFunc:Je(0)};if(arguments.length<3&&"function"==typeof e?(r=t||I(),t=e):($e(n,e),r=r||I()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var i=y(t),o=1;function a(){i(((e,...t)=>{!1!==e&&(e&&o++{function o(e){n(...t,e)}return(t.lengthe))(L,e,t,r)}),3),rt=g((function(e,t,r,n){return re(Boolean,(e=>e))(R(t),e,r,n)}),4),nt=g((function(e,t,r){return re(Boolean,(e=>e))(M,e,t,r)}),3),it=g((function(e,t,r){var n=y(t);return O(e,((e,t)=>{n(e,((r,n)=>{if(r)return t(r);t(r,{value:e,criteria:n})}))}),((e,t)=>{if(e)return r(e);r(null,t.sort(i).map((e=>e.value)))}));function i(e,t){var r=e.criteria,n=t.criteria;return rn?1:0}}),3);function ot(e,t,r){var n=y(e);return o(((i,o)=>{var a,s=!1;i.push(((...e)=>{s||(o(...e),clearTimeout(a))})),a=setTimeout((function(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)}),t),n(...i)}))}function at(e,t,r,n){var i=y(r);return X(function(e){for(var t=Array(e);e--;)t[e]=e;return t}(e),t,i,n)}function st(e,t,r){return at(e,1/0,t,r)}function ut(e,t,r){return at(e,1,t,r)}function ft(e,t,r,n){arguments.length<=3&&"function"==typeof t&&(n=r,r=t,t=Array.isArray(e)?[]:{}),n=_(n||I());var i=y(r);return L(e,((e,r,n)=>{i(t,e,r,n)}),(e=>n(e,t))),n[P]}var lt=g((function(e,t){var r,n=null;return pe(e,((e,t)=>{y(e)(((e,...i)=>{if(!1===e)return t(e);i.length<2?[r]=i:r=i,n=e,t(e?null:{})}))}),(()=>t(n,r)))}));function ct(e){return(...t)=>(e.unmemoized||e)(...t)}var ht=g((function(e,t,r){r=S(r);var n=y(t),i=y(e),o=[];function a(e,...t){if(e)return r(e);o=t,!1!==e&&i(s)}function s(e,t){return e?r(e):!1!==e?t?void n(a):r(null,...o):void 0}return i(s)}),3);function pt(e,t,r){const n=y(e);return ht((e=>n(((t,r)=>e(t,!r)))),t,r)}var dt=g((function(e,t){if(t=_(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){y(e[r++])(...t,S(i))}function i(i,...o){if(!1!==i)return i||r===e.length?t(i,...o):void n(o)}n([])}));const yt={apply:i,applyEach:x,applyEachSeries:j,asyncify:c,auto:B,autoInject:W,cargo:H,cargoQueue:V,compose:J,concat:Z,concatLimit:$,concatSeries:ee,constant:te,detect:ne,detectLimit:ie,detectSeries:oe,dir:se,doUntil:fe,doWhilst:ue,each:ce,eachLimit:he,eachOf:L,eachOfLimit:T,eachOfSeries:M,eachSeries:pe,ensureAsync:de,every:ye,everyLimit:ge,everySeries:ve,filter:_e,filterLimit:Se,filterSeries:Ee,forever:Re,groupBy:Ae,groupByLimit:Te,groupBySeries:ke,log:Le,map:O,mapLimit:X,mapSeries:C,mapValues:xe,mapValuesLimit:Oe,mapValuesSeries:Me,memoize:Ce,nextTick:je,parallel:Ie,parallelLimit:Be,priorityQueue:Fe,queue:Ne,race:We,reduce:Y,reduceRight:ze,reflect:Ke,reflectAll:Ge,reject:Ve,rejectLimit:Ye,rejectSeries:Qe,retry:Xe,retryable:Ze,seq:Q,series:et,setImmediate:l,some:tt,someLimit:rt,someSeries:nt,sortBy:it,timeout:ot,times:st,timesLimit:at,timesSeries:ut,transform:ft,tryEach:lt,unmemoize:ct,until:pt,waterfall:dt,whilst:ht,all:ye,allLimit:ge,allSeries:ve,any:tt,anyLimit:rt,anySeries:nt,find:ne,findLimit:ie,findSeries:oe,flatMap:Z,flatMapLimit:$,flatMapSeries:ee,forEach:ce,forEachSeries:pe,forEachLimit:he,forEachOf:L,forEachOfSeries:M,forEachOfLimit:T,inject:Y,foldl:Y,foldr:ze,select:_e,selectLimit:Se,selectSeries:Ee,wrapSync:c,during:ht,doDuring:ue}},742:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=u(e),a=o[0],s=o[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),l=0,c=s>0?a-4:a;for(r=0;r>16&255,f[l++]=t>>8&255,f[l++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[l++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[l++]=t>>8&255,f[l++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,u=n-i;su?u:s+a));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e,t,n){for(var i,o,a=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},764:(e,t,r)=>{"use strict";var n=r(742),i=r(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;var a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=s(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return h(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);var i=function(e){if(u.isBuffer(e)){var t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||z(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),s(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=s(t),n=0;n=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&f)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);for(var r="",n=0;nr&&(e+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(W(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),f=this.slice(n,i),l=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return S(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function I(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,o){return t=+t,r>>>=0,o||I(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,o){return t=+t,r>>>=0,o||I(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var K=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(){void 0!==o&&e.removeListener("error",o),r([].slice.call(arguments))}var o;"error"!==t&&(o=function(r){e.removeListener(t,i),n(r)},e.once("error",o)),e.once(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,a,f;if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(e))>0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,f=l,console&&console.warn&&console.warn(f)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var f=u.length,l=d(u,f);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},645:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,c=r?i-1:0,h=r?-1:1,p=e[t+c];for(c+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+e[t+c],c+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+c],c+=h,l-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=f}return(p?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,f=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(t*u-1)*Math.pow(2,i),a+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;e[r+p]=255&a,p+=d,a/=256,f-=8);e[r+p-d]|=128*y}},717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},620:(e,t,r)=>{var n=r(764).Buffer;t.parse=function(e,t){e instanceof n&&(e=e.toString("ascii"));for(var r=n.alloc(t||8192),i=0,o=0,a=null,s=null,u=0,f=0;f+11<=e.length;){if(":"!=e.charAt(f++))throw new Error("Line "+(u+1)+" does not start with a colon (:).");u++;var l=parseInt(e.substr(f,2),16);f+=2;var c=parseInt(e.substr(f,4),16);f+=4;var h=parseInt(e.substr(f,2),16);f+=2;var p=e.substr(f,2*l),d=n.from(p,"hex");f+=2*l;var y=parseInt(e.substr(f,2),16);f+=2;for(var g=l+(c>>8)+c+h&255,v=0;v=r.length){var b=n.alloc(2*(m+l));r.copy(b,0,0,i),r=b}m>i&&r.fill(255,i,m),d.copy(r,m),i=Math.max(i,m+l);break;case 1:if(0!=l)throw new Error("Invalid EOF record on line "+u+".");return{data:r.slice(0,i),startSegmentAddress:a,startLinearAddress:s};case 2:if(2!=l||0!=c)throw new Error("Invalid extended segment address record on line "+u+".");o=parseInt(p,16)<<4;break;case 3:if(4!=l||0!=c)throw new Error("Invalid start segment address record on line "+u+".");a=parseInt(p,16);break;case 4:if(2!=l||0!=c)throw new Error("Invalid extended linear address record on line "+u+".");o=parseInt(p,16)<<16;break;case 5:if(4!=l||0!=c)throw new Error("Invalid start linear address record on line "+u+".");s=parseInt(p,16);break;default:throw new Error("Invalid record type ("+h+") on line "+u)}"\r"==e.charAt(f)&&f++,"\n"==e.charAt(f)&&f++}throw new Error("Unexpected end of input: missing or invalid EOF record.")}},155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,u=[],f=!1,l=-1;function c(){f&&s&&(f=!1,s.length?u=s.concat(u):l=-1,u.length&&h())}function h(){if(!f){var e=a(c);f=!0;for(var t=u.length;t;){for(s=u,u=[];++l1)for(var r=1;r{"use strict";var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s,u;if("string"==typeof t&&(o="not ",t.substr(0,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+".".length>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},753:(e,t,r)=>{"use strict";var n=r(155),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(481),a=r(229);r(717)(l,o);for(var s=i(a.prototype),u=0;u{"use strict";e.exports=i;var n=r(605);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(717)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},481:(e,t,r)=>{"use strict";var n,i=r(155);e.exports=T,T.ReadableState=R,r(187).EventEmitter;var o,a=function(e,t){return e.listeners(t).length},s=r(503),u=r(764).Buffer,f=r.g.Uint8Array||function(){},l=r(758);o=l&&l.debuglog?l.debuglog("stream"):function(){};var c,h,p,d=r(327),y=r(195),g=r(457).getHighWaterMark,v=r(281).q,m=v.ERR_INVALID_ARG_TYPE,b=v.ERR_STREAM_PUSH_AFTER_EOF,w=v.ERR_METHOD_NOT_IMPLEMENTED,_=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(717)(T,s);var S=y.errorOrDestroy,E=["error","close","destroy","pause","resume"];function R(e,t,i){n=n||r(753),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=r(553).s),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function T(e){if(n=n||r(753),!(this instanceof T))return new T(e);var t=this instanceof n;this._readableState=new R(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function A(e,t,r,n,i){o("readableAddChunk",t);var a,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,M(e)))}}(e,s);else if(i||(a=function(e,t){var r,n;return n=t,u.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),a)S(e,a);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),n)s.endEmitted?S(e,new _):k(e,s,t,!0);else if(s.ended)S(e,new b);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?k(e,s,t,!1):C(e,s)):k(e,s,t,!1)}else n||(s.reading=!1,C(e,s));return!s.ended&&(s.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=L?e=L:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(M,e))}function M(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,N(e)}function C(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(j,e,t))}function j(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function I(e){o("readable nexttick read 0"),e.read(0)}function B(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(q,t,e))}function q(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):x(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&U(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&U(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){S(this,new w("_read()"))},T.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?y:u;function u(){o("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",f),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",c),l=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}));var f=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,N(e))}}(r);e.on("drain",f);var l=!1;function c(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==F(n.pipes,e))&&!l&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){o("onerror",t),y(),e.removeListener("error",h),0===a(e,"error")&&S(e,t)}function p(){e.removeListener("finish",d),y()}function d(){o("onfinish"),e.removeListener("close",p),y()}function y(){o("unpipe"),r.unpipe(e)}return r.on("data",c),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events.error?Array.isArray(e._events.error)?e._events.error.unshift(r):e._events.error=[r,e._events.error]:e.on(t,r)}(e,"error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(I,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(P,this),r},T.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(P,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(B,e,t))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a{"use strict";e.exports=l;var n=r(281).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(753);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var n,i=r(155);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=T,T.WritableState=R;var a,s={deprecate:r(927)},u=r(503),f=r(764).Buffer,l=r.g.Uint8Array||function(){},c=r(195),h=r(457).getHighWaterMark,p=r(281).q,d=p.ERR_INVALID_ARG_TYPE,y=p.ERR_METHOD_NOT_IMPLEMENTED,g=p.ERR_MULTIPLE_CALLBACK,v=p.ERR_STREAM_CANNOT_PIPE,m=p.ERR_STREAM_DESTROYED,b=p.ERR_STREAM_NULL_VALUES,w=p.ERR_STREAM_WRITE_AFTER_END,_=p.ERR_UNKNOWN_ENCODING,S=c.errorOrDestroy;function E(){}function R(e,t,a){n=n||r(753),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(M,e,t),e._writableState.errorEmitted=!0,S(e,n)):(o(n),e._writableState.errorEmitted=!0,S(e,n),M(e,t))}(e,r,n,t,o);else{var a=O(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||L(e,r),n?i.nextTick(k,e,r,a,o):k(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function T(e){var t=this instanceof(n=n||r(753));if(!t&&!a.call(T,this))return new T(e);this._writableState=new R(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function A(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function k(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),M(e,t)}function L(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,A(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,l=r.encoding,c=r.callback;if(A(e,t,!1,t.objectMode?1:f.length,f,l,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final((function(r){t.pendingcb--,r&&S(e,r),t.prefinished=!0,e.emit("prefinish"),M(e,t)}))}function M(e,t){var r=O(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(717)(T,u),R.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(R.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===T&&e&&e._writableState instanceof R}})):a=function(e){return e instanceof this},T.prototype.pipe=function(){S(this,new v)},T.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof l);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=E),o.ending?function(e,t){var r=new w;S(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new b:"string"==typeof r||t.objectMode||(o=new d("chunk",["string","Buffer"],r)),!o||(S(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new y("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,M(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=c.destroy,T.prototype._undestroy=c.undestroy,T.prototype._destroy=function(e,t){t(e)}},850:(e,t,r)=>{"use strict";var n,i=r(155);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(610),s=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),p=Symbol("stream");function d(e,t){return{value:e,done:t}}function y(e){var t=e[s];if(null!==t){var r=e[p].read();null!==r&&(e[c]=null,e[s]=null,e[u]=null,t(d(r,!1)))}}function g(e){i.nextTick(y,e)}var v=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(n={get stream(){return this[p]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(d(void 0,!0));if(this[p].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[f]?r(e[f]):t(d(void 0,!0))}))}));var r,n=this[c];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[l]?r(d(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var o=this[p].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[h])}return this[c]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[p].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),v);e.exports=function(e){var t,r=Object.create(m,(o(t={},p,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,f,{value:null,writable:!0}),o(t,l,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var n=r[p].read();n?(r[c]=null,r[s]=null,r[u]=null,e(d(n,!1))):(r[s]=e,r[u]=t)},writable:!0}),t));return r[c]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[u];return null!==t&&(r[c]=null,r[s]=null,r[u]=null,t(e)),void(r[f]=e)}var n=r[s];null!==n&&(r[c]=null,r[s]=null,r[u]=null,n(d(void 0,!0))),r[l]=!0})),e.on("readable",g.bind(null,r)),r}},327:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n,i=a.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,a.prototype.copy.call(t,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t{"use strict";var n=r(155);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},610:(e,t,r)=>{"use strict";var n=r(281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},946:(e,t,r)=>{"use strict";var n,i=r(281).q,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(610)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function f(e){e()}function l(e,t){return e.pipe(t)}function c(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r0,(function(e){n||(n=e),e&&a.forEach(f),o||(a.forEach(f),i(n))}))}));return t.reduce(l)}},457:(e,t,r)=>{"use strict";var n=r(281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},503:(e,t,r)=>{e.exports=r(187).EventEmitter},90:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(830);class i extends n.Readable{constructor(e){super(),this.bytesRead=0,this.released=!1,this.reader=e.getReader()}async _read(){if(this.released)return void this.push(null);this.pendingRead=this.reader.read();const e=await this.pendingRead;delete this.pendingRead,e.done||this.released?this.push(null):(this.bytesRead+=e.value.length,this.push(e.value))}async waitForReadToComplete(){this.pendingRead&&await this.pendingRead}async close(){await this.syncAndRelease()}async syncAndRelease(){this.released=!0,await this.waitForReadToComplete(),await this.reader.releaseLock()}}t.ReadableWebToNodeStream=i},509:(e,t,r)=>{var n=r(764),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},107:(e,t,r)=>{var n=r(764).Buffer,i=r(668),o=r(375),a=r(270),s=function(e){this.opts=e||{},this.quiet=this.opts.quiet||!1,this.quiet?this.log=function(){}:"object"==typeof window?this.log=console.log.bind(window):this.log=console.log};s.prototype.sync=function(e,t,r,n){this.log("sync");var i=this,s=1,u={cmd:[o.Cmnd_STK_GET_SYNC],responseData:o.OK_RESPONSE,timeout:r};!function r(){s+=1,a(e,u,(function(e,o){if(e&&s<=t)return e&&i.log(e),i.log("failed attempt again",s),r();i.log("sync complete",e,o,s),n(e,o)}))}()},s.prototype.verifySignature=function(e,t,r,i){this.log("verify signature");var s=this;match=n.concat([n.from([o.Resp_STK_INSYNC]),t,n.from([o.Resp_STK_OK])]);var u={cmd:[o.Cmnd_STK_READ_SIGN],responseLength:match.length,timeout:r};a(e,u,(function(e,t){t?s.log("confirm signature",e,t,t.toString("hex")):s.log("confirm signature",e,"no data"),i(e,t)}))},s.prototype.getSignature=function(e,t,r){this.log("get signature");var n={cmd:[o.Cmnd_STK_READ_SIGN],responseLength:5,timeout:t};a(e,n,(function(e,t){this.log("getSignature",e,t),r(e,t)}))},s.prototype.setOptions=function(e,t,r,n){this.log("set device");var i=this,s={cmd:[o.Cmnd_STK_SET_DEVICE,t.devicecode||0,t.revision||0,t.progtype||0,t.parmode||0,t.polling||0,t.selftimed||0,t.lockbytes||0,t.fusebytes||0,t.flashpollval1||0,t.flashpollval2||0,t.eeprompollval1||0,t.eeprompollval2||0,t.pagesizehigh||0,t.pagesizelow||0,t.eepromsizehigh||0,t.eepromsizelow||0,t.flashsize4||0,t.flashsize3||0,t.flashsize2||0,t.flashsize1||0],responseData:o.OK_RESPONSE,timeout:r};a(e,s,(function(e,t){if(i.log("setOptions",e,t),e)return n(e);n()}))},s.prototype.enterProgrammingMode=function(e,t,r){this.log("send enter programming mode");var n=this,i={cmd:[o.Cmnd_STK_ENTER_PROGMODE],responseData:o.OK_RESPONSE,timeout:t};a(e,i,(function(e,t){n.log("sent enter programming mode",e,t),r(e,t)}))},s.prototype.loadAddress=function(e,t,r,n){this.log("load address");var i=this,s=255&t,u=t>>8&255,f={cmd:[o.Cmnd_STK_LOAD_ADDRESS,s,u],responseData:o.OK_RESPONSE,timeout:r};a(e,f,(function(e,t){i.log("loaded address",e,t),n(e,t)}))},s.prototype.loadPage=function(e,t,r,i){this.log("load page");var s=this,u=255&t.length,f=t.length>>8,l={cmd:n.concat([n.from([o.Cmnd_STK_PROG_PAGE,f,u,70]),t,n.from([o.Sync_CRC_EOP])]),responseData:o.OK_RESPONSE,timeout:r};a(e,l,(function(e,t){s.log("loaded page",e,t),i(e,t)}))},s.prototype.upload=function(e,t,r,n,o,a){this.log("program");var s,u,f=0,l=this;i.whilst((function(){return f>1,e()},function(t){l.loadAddress(e,u,n,t)},function(e){s=t.slice(f,t.length>r?f+r:t.length-1),e()},function(t){l.loadPage(e,s,n,t)},function(e){l.log("programmed page"),f+=s.length,setTimeout(e,4)}],(function(e){l.log("page done"),a(e)}))}),(function(e){l.log("upload done"),a(e)}))},s.prototype.exitProgrammingMode=function(e,t,r){this.log("send leave programming mode");var n=this,i={cmd:[o.Cmnd_STK_LEAVE_PROGMODE],responseData:o.OK_RESPONSE,timeout:t};a(e,i,(function(e,t){n.log("sent leave programming mode",e,t),r(e,t)}))},s.prototype.verify=function(e,t,r,n,o,a){this.log("verify");var s,u,f=0,l=this;i.whilst((function(){return f>1,e()},function(t){l.loadAddress(e,u,n,t)},function(e){s=t.slice(f,t.length>r?f+r:t.length-1),e()},function(t){l.verifyPage(e,s,r,n,t)},function(e){l.log("verified page"),f+=s.length,setTimeout(e,4)}],(function(e){l.log("verify done"),a(e)}))}),(function(e){l.log("verify done"),a(e)}))},s.prototype.verifyPage=function(e,t,r,i,s){this.log("verify page");var u=this;match=n.concat([n.from([o.Resp_STK_INSYNC]),t,n.from([o.Resp_STK_OK])]);var f=t.length>=r?r:t.length,l={cmd:[o.Cmnd_STK_READ_PAGE,f>>8&255,255&f,70],responseLength:match.length,timeout:i};a(e,l,(function(e,t){u.log("confirm page",e,t,t.toString("hex")),s(e,t)}))},s.prototype.bootload=function(e,t,r,n,o){var a={pagesizehigh:r.pagesizehigh<<8&255,pagesizelow:255&r.pagesizelow};i.series([this.sync.bind(this,e,3,r.timeout),this.sync.bind(this,e,3,r.timeout),this.sync.bind(this,e,3,r.timeout),this.verifySignature.bind(this,e,r.signature,r.timeout),this.setOptions.bind(this,e,a,r.timeout),this.enterProgrammingMode.bind(this,e,r.timeout),this.upload.bind(this,e,t,r.pageSize,r.timeout,n),this.verify.bind(this,e,t,r.pageSize,r.timeout,n),this.exitProgrammingMode.bind(this,e,r.timeout)],(function(e){return o(e)}))},e.exports=s},310:(e,t,r)=>{var n=r(764).Buffer,i=[r(375).Resp_STK_INSYNC];e.exports=function(e,t,r,o){var a=n.alloc(0),s=!1,u=null,f=function(e){for(var t=0;!s&&tr)return l(new Error("buffer overflow "+a.length+" > "+r));a.length==r&&l()},l=function(t){u&&clearTimeout(u),e.removeListener("data",f),o(t,a)};t&&t>0&&(u=setTimeout((function(){u=null,l(new Error("receiveData timeout after "+t+"ms"))}),t)),e.on("data",f)}},270:(e,t,r)=>{var n=r(764).Buffer,i=r(310),o=r(375);e.exports=function(e,t,r){var a,s=t.timeout||0,u=(o.Resp_STK_INSYNC,o.Resp_STK_NOSYNC,null),f=0;t.responseData&&t.responseData.length>0&&(u=t.responseData),u&&(f=u.length),t.responseLength&&(f=t.responseLength);var l=t.cmd;l instanceof Array&&(l=n.from(l.concat(o.Sync_CRC_EOP))),e.write(l,(function(t){if(t)return a=new Error("Sending "+l.toString("hex")+": "+t.message),r(a);i(e,s,f,(function(e,t){return e?(a=new Error("Sending "+l.toString("hex")+": "+e.message),r(a)):u&&!t.equals(u)?(a=new Error(l+" response mismatch: "+t.toString("hex")+", "+u.toString("hex")),r(a)):void r(null,t)}))}))}},375:(e,t,r)=>{var n=r(764).Buffer;e.exports={Cmnd_STK_GET_SYNC:48,Cmnd_STK_SET_DEVICE:66,Cmnd_STK_ENTER_PROGMODE:80,Cmnd_STK_LOAD_ADDRESS:85,Cmnd_STK_PROG_PAGE:100,Cmnd_STK_LEAVE_PROGMODE:81,Cmnd_STK_READ_SIGN:117,Sync_CRC_EOP:32,Resp_STK_OK:16,Resp_STK_INSYNC:20,Resp_STK_NOSYNC:21,Cmnd_STK_READ_PAGE:116,OK_RESPONSE:n.from([20,16])}},668:(e,t,r)=>{var n,i=r(155);!function(){var r,o,a={};function s(e){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,e.apply(r,arguments)}}null!=(r=this)&&(o=r.async),a.noConflict=function(){return r.async=o,a};var u=Object.prototype.toString,f=Array.isArray||function(e){return"[object Array]"===u.call(e)},l=function(e,t){for(var r=0;r=e.length&&r()}l(e,(function(e){t(e,s(i))}))},a.forEach=a.each,a.eachSeries=function(e,t,r){if(r=r||function(){},!e.length)return r();var n=0,i=function(){t(e[n],(function(t){t?(r(t),r=function(){}):(n+=1)>=e.length?r():i()}))};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(e,t,r,n){p(t).apply(null,[e,r,n])},a.forEachLimit=a.eachLimit;var p=function(e){return function(t,r,n){if(n=n||function(){},!t.length||e<=0)return n();var i=0,o=0,a=0;!function s(){if(i>=t.length)return n();for(;a=t.length?n():s())}))}()}},d=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[a.each].concat(t))}},y=function(e){return function(){var t=Array.prototype.slice.call(arguments);return e.apply(null,[a.eachSeries].concat(t))}},g=function(e,t,r,n){if(t=c(t,(function(e,t){return{index:t,value:e}})),n){var i=[];e(t,(function(e,t){r(e.value,(function(r,n){i[e.index]=n,t(r)}))}),(function(e){n(e,i)}))}else e(t,(function(e,t){r(e.value,(function(e){t(e)}))}))};a.map=d(g),a.mapSeries=y(g),a.mapLimit=function(e,t,r,n){return v(t)(e,r,n)};var v=function(e){return function(e,t){return function(){var r=Array.prototype.slice.call(arguments);return t.apply(null,[p(e)].concat(r))}}(e,g)};a.reduce=function(e,t,r,n){a.eachSeries(e,(function(e,n){r(t,e,(function(e,r){t=r,n(e)}))}),(function(e){n(e,t)}))},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(e,t,r,n){var i=c(e,(function(e){return e})).reverse();a.reduce(i,t,r,n)},a.foldr=a.reduceRight;var m=function(e,t,r,n){var i=[];e(t=c(t,(function(e,t){return{index:t,value:e}})),(function(e,t){r(e.value,(function(r){r&&i.push(e),t()}))}),(function(e){n(c(i.sort((function(e,t){return e.index-t.index})),(function(e){return e.value})))}))};a.filter=d(m),a.filterSeries=y(m),a.select=a.filter,a.selectSeries=a.filterSeries;var b=function(e,t,r,n){var i=[];e(t=c(t,(function(e,t){return{index:t,value:e}})),(function(e,t){r(e.value,(function(r){r||i.push(e),t()}))}),(function(e){n(c(i.sort((function(e,t){return e.index-t.index})),(function(e){return e.value})))}))};a.reject=d(b),a.rejectSeries=y(b);var w=function(e,t,r,n){e(t,(function(e,t){r(e,(function(r){r?(n(e),n=function(){}):t()}))}),(function(e){n()}))};a.detect=d(w),a.detectSeries=y(w),a.some=function(e,t,r){a.each(e,(function(e,n){t(e,(function(e){e&&(r(!0),r=function(){}),n()}))}),(function(e){r(!1)}))},a.any=a.some,a.every=function(e,t,r){a.each(e,(function(e,n){t(e,(function(e){e||(r(!1),r=function(){}),n()}))}),(function(e){r(!0)}))},a.all=a.every,a.sortBy=function(e,t,r){a.map(e,(function(e,r){t(e,(function(t,n){t?r(t):r(null,{value:e,criteria:n})}))}),(function(e,t){if(e)return r(e);r(null,c(t.sort((function(e,t){var r=e.criteria,n=t.criteria;return rn?1:0})),(function(e){return e.value})))}))},a.auto=function(e,t){t=t||function(){};var r=h(e),n=r.length;if(!n)return t();var i={},o=[],s=function(e){o.unshift(e)},u=function(){n--,l(o.slice(0),(function(e){e()}))};s((function(){if(!n){var e=t;t=function(){},e(null,i)}})),l(r,(function(r){var n=f(e[r])?e[r]:[e[r]],c=function(e){var n=Array.prototype.slice.call(arguments,1);if(n.length<=1&&(n=n[0]),e){var o={};l(h(i),(function(e){o[e]=i[e]})),o[r]=n,t(e,o),t=function(){}}else i[r]=n,a.setImmediate(u)},p=n.slice(0,Math.abs(n.length-1))||[],d=function(){return t=function(e,t){return e&&i.hasOwnProperty(t)},n=!0,((e=p).reduce?e.reduce(t,n):(l(e,(function(e,r,i){n=t(n,e)})),n))&&!i.hasOwnProperty(r);var e,t,n};if(d())n[n.length-1](c,i);else{var y=function(){d()&&(function(e){for(var t=0;t>>1);r(t,e[o])>=0?n=o:i=o-1}return n}(e.tasks,o,r)+1,0,o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),a.setImmediate(e.process)}))}(n,e,t,i)},delete n.unshift,n},a.cargo=function(e,t){var r=!1,n=[],i={tasks:n,payload:t,saturated:null,empty:null,drain:null,drained:!0,push:function(e,r){f(e)||(e=[e]),l(e,(function(e){n.push({data:e,callback:"function"==typeof r?r:null}),i.drained=!1,i.saturated&&n.length===t&&i.saturated()})),a.setImmediate(i.process)},process:function o(){if(!r){if(0===n.length)return i.drain&&!i.drained&&i.drain(),void(i.drained=!0);var a="number"==typeof t?n.splice(0,t):n.splice(0,n.length),s=c(a,(function(e){return e.data}));i.empty&&i.empty(),r=!0,e(s,(function(){r=!1;var e=arguments;l(a,(function(t){t.callback&&t.callback.apply(null,e)})),o()}))}},length:function(){return n.length},running:function(){return r}};return i};var E=function(e){return function(t){var r=Array.prototype.slice.call(arguments,1);t.apply(null,r.concat([function(t){var r=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[e]&&l(r,(function(t){console[e](t)})))}]))}};a.log=E("log"),a.dir=E("dir"),a.memoize=function(e,t){var r={},n={};t=t||function(e){return e};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),s=t.apply(null,i);s in r?a.nextTick((function(){o.apply(null,r[s])})):s in n?n[s].push(o):(n[s]=[o],e.apply(null,i.concat([function(){r[s]=arguments;var e=n[s];delete n[s];for(var t=0,i=e.length;t2){var n=Array.prototype.slice.call(arguments,2);return r.apply(this,n)}return r};a.applyEach=d(R),a.applyEachSeries=y(R),a.forever=function(e,t){!function r(n){if(n){if(t)return t(n);throw n}e(r)}()},e.exports?e.exports=a:void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},830:(e,t,r)=>{e.exports=i;var n=r(187).EventEmitter;function i(){n.call(this)}r(717)(i,n),i.Readable=r(481),i.Writable=r(229),i.Duplex=r(753),i.Transform=r(605),i.PassThrough=r(725),i.finished=r(610),i.pipeline=r(946),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",f),e.removeListener("error",f),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",f),e.on("error",f),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},553:(e,t,r)=>{"use strict";var n=r(509).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=c,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.s=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},927:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},306:e=>{"use strict";e.exports=JSON.parse('{"name":"web-arduino-uploader","version":"1.1.2","main":"dist/index.ts","types":"dist/index.d.ts","license":"MIT","author":{"name":"David Buezas","email":"david.buezas@gmail.com","url":"https://github.com/dbuezas/arduino-web-uploader/"},"scripts":{"prepublish":"npm run build","build":"tsc && webpack"},"devDependencies":{"@types/node":"^14.14.2","@typescript-eslint/eslint-plugin":"^4.5.0","@typescript-eslint/parser":"^4.5.0","buffer":"^5.6.1","eslint":"^7.12.0","prettier":"^2.1.2","process":"^0.11.10","stream-browserify":"^3.0.0","typescript":"^4.0.3","webpack":"^5.2.0","webpack-cli":"^4.1.0"},"dependencies":{"async":"^3.2.0","intel-hex":"^0.1.2","readable-web-to-node-stream":"^2.0.0","stk500":"github:dbuezas/js-stk500v1#v3.0.0"}}')},758:()=>{}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(204)})(); \ No newline at end of file diff --git a/tools/webSerialUploader/index.html b/tools/webSerialUploader/index.html new file mode 100644 index 0000000..e8e0d05 --- /dev/null +++ b/tools/webSerialUploader/index.html @@ -0,0 +1,45 @@ + + + + + + + WebSerial Arduino Nano Flasher + + + + + + +

WebSerial Arduino Nano Flasher

+ This page is here to make it easier for those who would like to load in a precompiled binary for an arduino nano instead. +
+ You will need to open this page on a browser that supports WebSerial API, such as google chrome. +
+ Click Here To Jump Back To Readme + +

Load Main Application Firmware

+ +
+ + +

Test blink Firmware (For Sanity Check)

+ +
+ + + +

Source arduino-web-uploader

+ + The webserial uploader source code is from https://github.com/dbuezas/arduino-web-uploader + + + \ No newline at end of file