/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@hrueger/node-hid@2.2.0/nodehid.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var EventEmitter=require("events").EventEmitter,util=require("util"),driverType=null;function setDriverType(e){driverType=e}var binding=null;function loadBinding(){binding||(binding=require("pkg-prebuilds/bindings")(__dirname,{name:"linux"!==process.platform||driverType&&"hidraw"!==driverType?"HID":"HID_hidraw",napi_versions:[3]}))}function HID(){if(!new.target)throw new Error("HID() must be called with 'new' operator");EventEmitter.call(this),loadBinding();var e=new Array(arguments.length+1);e[0]=null;for(var i=0;i<arguments.length;i++)e[i+1]=arguments[i];for(var i in this._raw=new(Function.prototype.bind.apply(binding.HID,e)),binding.HID.prototype)this[i]=binding.HID.prototype[i].bind(this._raw);this._paused=!0;var r=this;r.on("newListener",(function(e,i){"data"==e&&process.nextTick(r.resume.bind(r))}))}function showdevices(){return loadBinding(),binding.devices.apply(HID,arguments)}util.inherits(HID,EventEmitter),HID.prototype.close=function(){this._closing=!0,this.removeAllListeners(),this._raw.close(),this._closed=!0},HID.prototype.pause=function(){this._paused=!0},HID.prototype.read=function(e){if(this._closed)throw new Error("Unable to read from a closed HID device");return this._raw.read(e)},HID.prototype.resume=function(){var e=this;e._paused&&e.listeners("data").length>0&&(e._paused=!1,e.read((function i(r,t){r?(e._paused=!0,e._closing||e.emit("error",r)):(e.listeners("data").length<=0&&(e._paused=!0),e._paused||e.read(i),e.emit("data",t))})))},exports.HID=HID,exports.devices=showdevices,exports.setDriverType=setDriverType;
//# sourceMappingURL=/sm/e7a0311c3baf508936389b17eb2e7b30359603e2264dc160f1818a4afc5885b6.map