homey-lib 2.32.6 → 2.32.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/App/index.js CHANGED
@@ -157,12 +157,12 @@ class App {
157
157
  }
158
158
  }
159
159
 
160
- if (Array.isArray(appJson.widgets)) {
160
+ if (appJson.widgets != null) {
161
161
  if (semver.lt(semver.coerce(appJson.compatibility), '12.1.0')) {
162
- throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${path})`);
162
+ throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${this._path})`);
163
163
  }
164
164
 
165
- for (const widget of appJson.widgets) {
165
+ for (const [widgetId, widget] of Object.entries(appJson.widgets)) {
166
166
  const apiFilePathMjs = join(this._path, 'widgets', widget.id, 'api.mjs');
167
167
  const apiFilePathCjs = join(this._path, 'widgets', widget.id, 'api.cjs');
168
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-lib",
3
- "version": "2.32.6",
3
+ "version": "2.32.7",
4
4
  "description": "Shared Library for Homey",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/webpack/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @author Feross Aboukhadijeh <http://feross.org>
6
6
  * @license MIT
7
7
  */
8
- var r=a(26),i=a(27),n=a(28);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,a){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return d(this,e,t,a)}function d(e,t,a,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,r){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,a):new Uint8Array(t,a,r);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=m(e,t);return e}(e,t,a,r):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!l.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var r=0|h(t,a),i=(e=o(e,r)).write(t,a);i!==r&&(e=e.slice(0,i));return e}(e,t,a):function(e,t){if(l.isBuffer(t)){var a=0|c(t.length);return 0===(e=o(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?o(e,0):m(e,t);if("Buffer"===t.type&&n(t.data))return m(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function p(e,t){if(u(t),e=o(e,t<0?0:0|c(t)),!l.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function m(e,t){var a=t.length<0?0:0|c(t.length);e=o(e,a);for(var r=0;r<a;r+=1)e[r]=255&t[r];return e}function c(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return F(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,a){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,a);case"utf8":case"utf-8":return A(this,t,a);case"ascii":return j(this,t,a);case"latin1":case"binary":return C(this,t,a);case"base64":return S(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,a);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function f(e,t,a){var r=e[t];e[t]=e[a],e[a]=r}function g(e,t,a,r,i){if(0===e.length)return-1;if("string"==typeof a?(r=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return-1;a=e.length-1}else if(a<0){if(!i)return-1;a=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:k(e,t,a,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):k(e,[t],a,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,a,r,i){var n,s=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,o/=2,l/=2,a/=2}function d(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(n=a;n<o;n++)if(d(e,n)===d(t,-1===u?0:n-u)){if(-1===u&&(u=n),n-u+1===l)return u*s}else-1!==u&&(n-=n-u),u=-1}else for(a+l>o&&(a=o-l),n=a;n>=0;n--){for(var p=!0,m=0;m<l;m++)if(d(e,n+m)!==d(t,m)){p=!1;break}if(p)return n}return-1}function y(e,t,a,r){a=Number(a)||0;var i=e.length-a;r?(r=Number(r))>i&&(r=i):r=i;var n=t.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var s=0;s<r;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o}return s}function b(e,t,a,r){return R(H(t,e.length-a),e,a,r)}function w(e,t,a,r){return R(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,r)}function z(e,t,a,r){return w(e,t,a,r)}function _(e,t,a,r){return R(F(t),e,a,r)}function P(e,t,a,r){return R(function(e,t){for(var a,r,i,n=[],s=0;s<e.length&&!((t-=2)<0);++s)a=e.charCodeAt(s),r=a>>8,i=a%256,n.push(i),n.push(r);return n}(t,e.length-a),e,a,r)}function S(e,t,a){return 0===t&&a===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,a))}function A(e,t,a){a=Math.min(e.length,a);for(var r=[],i=t;i<a;){var n,s,o,l,d=e[i],u=null,p=d>239?4:d>223?3:d>191?2:1;if(i+p<=a)switch(p){case 1:d<128&&(u=d);break;case 2:128==(192&(n=e[i+1]))&&(l=(31&d)<<6|63&n)>127&&(u=l);break;case 3:n=e[i+1],s=e[i+2],128==(192&n)&&128==(192&s)&&(l=(15&d)<<12|(63&n)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:n=e[i+1],s=e[i+2],o=e[i+3],128==(192&n)&&128==(192&s)&&128==(192&o)&&(l=(15&d)<<18|(63&n)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var a="",r=0;for(;r<t;)a+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return a}(r)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,a){return d(null,e,t,a)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,a){return function(e,t,a,r){return u(t),t<=0?o(e,t):void 0!==a?"string"==typeof r?o(e,t).fill(a,r):o(e,t).fill(a):o(e,t)}(null,e,t,a)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,r=t.length,i=0,n=Math.min(a,r);i<n;++i)if(e[i]!==t[i]){a=e[i],r=t[i];break}return a<r?-1:r<a?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!n(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var r=l.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var s=e[a];if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},l.byteLength=h,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):v.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",a=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,a).match(/.{2}/g).join(" "),this.length>a&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,a,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||a>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=a)return 0;if(r>=i)return-1;if(t>=a)return 1;if(this===e)return 0;for(var n=(i>>>=0)-(r>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(n,s),d=this.slice(r,i),u=e.slice(t,a),p=0;p<o;++p)if(d[p]!==u[p]){n=d[p],s=u[p];break}return n<s?-1:s<n?1:0},l.prototype.includes=function(e,t,a){return-1!==this.indexOf(e,t,a)},l.prototype.indexOf=function(e,t,a){return g(this,e,t,a,!0)},l.prototype.lastIndexOf=function(e,t,a){return g(this,e,t,a,!1)},l.prototype.write=function(e,t,a,r){if(void 0===t)r="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)r=t,a=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===r&&(r="utf8")):(r=a,a=void 0)}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return y(this,e,t,a);case"utf8":case"utf-8":return b(this,e,t,a);case"ascii":return w(this,e,t,a);case"latin1":case"binary":return z(this,e,t,a);case"base64":return _(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,a);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,t,a){var r="";a=Math.min(e.length,a);for(var i=t;i<a;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,a){var r="";a=Math.min(e.length,a);for(var i=t;i<a;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,a){var r=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>r)&&(a=r);for(var i="",n=t;n<a;++n)i+=V(e[n]);return i}function L(e,t,a){for(var r=e.slice(t,a),i="",n=0;n<r.length;n+=2)i+=String.fromCharCode(r[n]+256*r[n+1]);return i}function E(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,a,r,i,n){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<n)throw new RangeError('"value" argument is out of bounds');if(a+r>e.length)throw new RangeError("Index out of range")}function x(e,t,a,r){t<0&&(t=65535+t+1);for(var i=0,n=Math.min(e.length-a,2);i<n;++i)e[a+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(e,t,a,r){t<0&&(t=4294967295+t+1);for(var i=0,n=Math.min(e.length-a,4);i<n;++i)e[a+i]=t>>>8*(r?i:3-i)&255}function D(e,t,a,r,i,n){if(a+r>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function $(e,t,a,r,n){return n||D(e,0,a,4),i.write(e,t,a,r,23,4),a+4}function I(e,t,a,r,n){return n||D(e,0,a,8),i.write(e,t,a,r,52,8),a+8}l.prototype.slice=function(e,t){var a,r=this.length;if((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<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=l.prototype;else{var i=t-e;a=new l(i,void 0);for(var n=0;n<i;++n)a[n]=this[n+e]}return a},l.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e],i=1,n=0;++n<t&&(i*=256);)r+=this[e+n]*i;return r},l.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||E(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||E(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||E(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e],i=1,n=0;++n<t&&(i*=256);)r+=this[e+n]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=t,i=1,n=this[e+--r];r>0&&(i*=256);)n+=this[e+--r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readInt8=function(e,t){return t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||E(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt16BE=function(e,t){t||E(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt32LE=function(e,t){return t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||E(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||E(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||E(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||E(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,a,r){(e=+e,t|=0,a|=0,r)||T(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,n=0;for(this[t]=255&e;++n<a&&(i*=256);)this[t+n]=e/i&255;return t+a},l.prototype.writeUIntBE=function(e,t,a,r){(e=+e,t|=0,a|=0,r)||T(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,n=1;for(this[t+i]=255&e;--i>=0&&(n*=256);)this[t+i]=e/n&255;return t+a},l.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,a,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*a-1);T(this,e,t,a,i-1,-i)}var n=0,s=1,o=0;for(this[t]=255&e;++n<a&&(s*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+a},l.prototype.writeIntBE=function(e,t,a,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*a-1);T(this,e,t,a,i-1,-i)}var n=a-1,s=1,o=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+a},l.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,a){return $(this,e,t,!0,a)},l.prototype.writeFloatBE=function(e,t,a){return $(this,e,t,!1,a)},l.prototype.writeDoubleLE=function(e,t,a){return I(this,e,t,!0,a)},l.prototype.writeDoubleBE=function(e,t,a){return I(this,e,t,!1,a)},l.prototype.copy=function(e,t,a,r){if(a||(a=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<a&&(r=a),r===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-a&&(r=e.length-t+a);var i,n=r-a;if(this===e&&a<t&&t<r)for(i=n-1;i>=0;--i)e[i+t]=this[i+a];else if(n<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i<n;++i)e[i+t]=this[i+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+n),t);return n},l.prototype.fill=function(e,t,a,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,a=this.length):"string"==typeof a&&(r=a,a=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var n;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(n=t;n<a;++n)this[n]=e;else{var s=l.isBuffer(e)?e:H(new l(e,r).toString()),o=s.length;for(n=0;n<a-t;++n)this[n+t]=s[n%o]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var a;t=t||1/0;for(var r=e.length,i=null,n=[],s=0;s<r;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&n.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&n.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&n.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320)}else i&&(t-=3)>-1&&n.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;n.push(a)}else if(a<2048){if((t-=2)<0)break;n.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;n.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;n.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return n}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,a,r){for(var i=0;i<r&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}}).call(this,a(7))},function(e,t,a){"use strict";var r=a(37),i=a(4),n=a(0),s=a(9),o=a(39);function l(e,t,a){var r=this._refs[a];if("string"==typeof r){if(!this._refs[r])return l.call(this,e,t,r);r=this._refs[r]}if((r=r||this._schemas[a])instanceof s)return h(r.schema,this._opts.inlineRefs)?r.schema:r.validate||this._compile(r);var i,n,o,u=d.call(this,t,a);return u&&(i=u.schema,t=u.root,o=u.baseId),i instanceof s?n=i.validate||e.call(this,i.schema,t,void 0,o):void 0!==i&&(n=h(i,this._opts.inlineRefs)?i:e.call(this,i,t,void 0,o)),n}function d(e,t){var a=r.parse(t),i=f(a),n=v(this._getId(e.schema));if(0===Object.keys(e.schema).length||i!==n){var o=k(i),l=this._refs[o];if("string"==typeof l)return u.call(this,e,l,a);if(l instanceof s)l.validate||this._compile(l),e=l;else{if(!((l=this._schemas[o])instanceof s))return;if(l.validate||this._compile(l),o==k(t))return{schema:l,root:e,baseId:n};e=l}if(!e.schema)return;n=v(this._getId(e.schema))}return m.call(this,a,n,e.schema,e)}function u(e,t,a){var r=d.call(this,e,t);if(r){var i=r.schema,n=r.baseId;e=r.root;var s=this._getId(i);return s&&(n=y(n,s)),m.call(this,a,n,i,e)}}e.exports=l,l.normalizeId=k,l.fullPath=v,l.url=y,l.ids=function(e){var t=k(this._getId(e)),a={"":t},s={"":v(t,!1)},l={},d=this;return o(e,{allKeys:!0},(function(e,t,o,u,p,m,c){if(""!==t){var h=d._getId(e),v=a[u],f=s[u]+"/"+p;if(void 0!==c&&(f+="/"+("number"==typeof c?c:n.escapeFragment(c))),"string"==typeof h){h=v=k(v?r.resolve(v,h):h);var g=d._refs[h];if("string"==typeof g&&(g=d._refs[g]),g&&g.schema){if(!i(e,g.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=k(f))if("#"==h[0]){if(l[h]&&!i(e,l[h]))throw new Error('id "'+h+'" resolves to more than one schema');l[h]=e}else d._refs[h]=f}a[t]=v,s[t]=f}})),l},l.inlineRef=h,l.schema=d;var p=n.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,t,a,r){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var i=e.fragment.split("/"),s=1;s<i.length;s++){var o=i[s];if(o){if(void 0===(a=a[o=n.unescapeFragment(o)]))break;var l;if(!p[o]&&((l=this._getId(a))&&(t=y(t,l)),a.$ref)){var u=y(t,a.$ref),m=d.call(this,r,u);m&&(a=m.schema,r=m.root,t=m.baseId)}}}return void 0!==a&&a!==r.schema?{schema:a,root:r,baseId:t}:void 0}}var c=n.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function h(e,t){return!1!==t&&(void 0===t||!0===t?function e(t){var a;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if("object"==typeof(a=t[r])&&!e(a))return!1}else for(var i in t){if("$ref"==i)return!1;if("object"==typeof(a=t[i])&&!e(a))return!1}return!0}(e):t?function e(t){var a,r=0;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if("object"==typeof(a=t[i])&&(r+=e(a)),r==1/0)return 1/0}else for(var n in t){if("$ref"==n)return 1/0;if(c[n])r++;else if("object"==typeof(a=t[n])&&(r+=e(a)+1),r==1/0)return 1/0}return r}(e)<=t:void 0)}function v(e,t){return!1!==t&&(e=k(e)),f(r.parse(e))}function f(e){return r.serialize(e).split("#")[0]+"#"}var g=/#\/?$/;function k(e){return e?e.replace(g,""):""}function y(e,t){return t=k(t),r.resolve(e,t)}},function(e,t,a){"use strict";e.exports=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=a.length)return!1;for(i=r;0!=i--;)if(!e(t[i],a[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,n[i]))return!1;for(i=r;0!=i--;){var s=n[i];if(!e(t[s],a[s]))return!1}return!0}return t!=t&&a!=a}},function(e,t,a){"use strict";var r=a(3);function i(e,t,a){this.message=a||i.message(e,t),this.missingRef=r.url(e,t),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function n(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}e.exports={Validation:n((function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0})),MissingRef:n(i)},i.message=function(e,t){return"can't resolve reference "+t+" from id "+e}},function(e,t,a){"use strict";const r=a(8);let i;class n{constructor(e){this._capability=e}debug(...e){this._debug&&console.log("[dbg]",...e)}async validate({debug:e=!1}={}){this._debug=e,this.debug("Validating capability");const t=n.getJSONSchema(),a=new r({async:!0}).compile(t);if(!1===await a(this._capability))throw new Error(JSON.stringify(a.errors,!1,4)||"Invalid Capability");this.debug("Validated successfully")}static getJSONSchema(){return a(71)}static getCapabilities(){if(i)return i;const e=a(72);return i=e.reduce((e,t)=>(e[t]=a(73)(`./${t}.json`),e[t]=n._composeCapability(t,e[t]),e),{}),i}static getCapability(e){const t=n.getCapabilities()[e];if(!t)throw new Error("invalid_capability");return t}static hasCapability(e){return!!this.getCapabilities()[e]}static _composeCapability(e,t){return t.flow&&console.warn(`Warning: using \`capability.flow\` (${e}), expected a \`capability.$flow\``),t.$flow&&["triggers","conditions","actions"].forEach(a=>{const r=t.$flow[a];Array.isArray(r)&&r.forEach(a=>{Array.isArray(a.args)&&a.args.forEach(e=>{"dropdown"===e.type&&"$values"===e.values&&(e.values=t.values,e.meta=e.meta||{},e.meta.$values=!0)}),Array.isArray(a.tokens)&&a.tokens.forEach(a=>{"$id"===a.name&&(a.name=e),"$type"===a.type&&(a.type=t.type),"$title"===a.title&&(a.title=t.title)})})}),t}static isInstanceOfId(e,t){return t===e||e.startsWith(t+".")}static getBaseId(e){return e.split(".")[0]}}e.exports=n},function(e,t){var a;a=function(){return this}();try{a=a||new Function("return this")()}catch(e){"object"==typeof window&&(a=window)}e.exports=a},function(e,t,a){"use strict";var r=a(36),i=a(3),n=a(40),s=a(9),o=a(10),l=a(41),d=a(42),u=a(63),p=a(0);e.exports=g,g.prototype.validate=function(e,t){var a;if("string"==typeof e){if(!(a=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var r=this._addSchema(e);a=r.validate||this._compile(r)}var i=a(t);!0!==a.$async&&(this.errors=a.errors);return i},g.prototype.compile=function(e,t){var a=this._addSchema(e,void 0,t);return a.validate||this._compile(a)},g.prototype.addSchema=function(e,t,a,r){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.addSchema(e[n],void 0,a,r);return this}var s=this._getId(e);if(void 0!==s&&"string"!=typeof s)throw new Error("schema id must be string");return _(this,t=i.normalizeId(t||s)),this._schemas[t]=this._addSchema(e,a,r,!0),this},g.prototype.addMetaSchema=function(e,t,a){return this.addSchema(e,t,a,!0),this},g.prototype.validateSchema=function(e,t){var a=e.$schema;if(void 0!==a&&"string"!=typeof a)throw new Error("$schema must be a string");if(!(a=a||this._opts.defaultMeta||function(e){var t=e._opts.meta;return e._opts.defaultMeta="object"==typeof t?e._getId(t)||t:e.getSchema(h)?h:void 0,e._opts.defaultMeta}(this)))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var r=this.validate(a,e);if(!r&&t){var i="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(i);this.logger.error(i)}return r},g.prototype.getSchema=function(e){var t=k(this,e);switch(typeof t){case"object":return t.validate||this._compile(t);case"string":return this.getSchema(t);case"undefined":return function(e,t){var a=i.schema.call(e,{schema:{}},t);if(a){var n=a.schema,o=a.root,l=a.baseId,d=r.call(e,n,o,void 0,l);return e._fragments[t]=new s({ref:t,fragment:!0,schema:n,root:o,baseId:l,validate:d}),d}}(this,e)}},g.prototype.removeSchema=function(e){if(e instanceof RegExp)return y(this,this._schemas,e),y(this,this._refs,e),this;switch(typeof e){case"undefined":return y(this,this._schemas),y(this,this._refs),this._cache.clear(),this;case"string":var t=k(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var a=this._opts.serialize,r=a?a(e):e;this._cache.del(r);var n=this._getId(e);n&&(n=i.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this},g.prototype.addFormat=function(e,t){"string"==typeof t&&(t=new RegExp(t));return this._formats[e]=t,this},g.prototype.errorsText=function(e,t){if(!(e=e||this.errors))return"No errors";for(var a=void 0===(t=t||{}).separator?", ":t.separator,r=void 0===t.dataVar?"data":t.dataVar,i="",n=0;n<e.length;n++){var s=e[n];s&&(i+=r+s.dataPath+" "+s.message+a)}return i.slice(0,-a.length)},g.prototype._addSchema=function(e,t,a,r){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var n=this._opts.serialize,o=n?n(e):e,l=this._cache.get(o);if(l)return l;r=r||!1!==this._opts.addUsedSchema;var d=i.normalizeId(this._getId(e));d&&r&&_(this,d);var u,p=!1!==this._opts.validateSchema&&!t;p&&!(u=d&&d==i.normalizeId(e.$schema))&&this.validateSchema(e,!0);var m=i.ids.call(this,e),c=new s({id:d,schema:e,localRefs:m,cacheKey:o,meta:a});"#"!=d[0]&&r&&(this._refs[d]=c);this._cache.put(o,c),p&&u&&this.validateSchema(e,!0);return c},g.prototype._compile=function(e,t){if(e.compiling)return e.validate=n,n.schema=e.schema,n.errors=null,n.root=t||n,!0===e.schema.$async&&(n.$async=!0),n;var a,i;e.compiling=!0,e.meta&&(a=this._opts,this._opts=this._metaOpts);try{i=r.call(this,e.schema,t,e.localRefs)}catch(t){throw delete e.validate,t}finally{e.compiling=!1,e.meta&&(this._opts=a)}return e.validate=i,e.refs=i.refs,e.refVal=i.refVal,e.root=i.root,i;function n(){var t=e.validate,a=t.apply(this,arguments);return n.errors=t.errors,a}},g.prototype.compileAsync=a(64);var m=a(65);g.prototype.addKeyword=m.add,g.prototype.getKeyword=m.get,g.prototype.removeKeyword=m.remove,g.prototype.validateKeyword=m.validate;var c=a(5);g.ValidationError=c.Validation,g.MissingRefError=c.MissingRef,g.$dataMetaSchema=u;var h="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],f=["/properties"];function g(e){if(!(this instanceof g))return new g(e);e=this._opts=p.copy(e)||{},function(e){var t=e._opts.logger;if(!1===t)e.logger={log:P,warn:P,error:P};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=l(e.format),this._cache=e.cache||new n,this._loadingSchemas={},this._compilations=[],this.RULES=d(),this._getId=function(e){switch(e.schemaId){case"auto":return z;case"id":return b;default:return w}}(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=o),this._metaOpts=function(e){for(var t=p.copy(e._opts),a=0;a<v.length;a++)delete t[v[a]];return t}(this),e.formats&&function(e){for(var t in e._opts.formats){var a=e._opts.formats[t];e.addFormat(t,a)}}(this),e.keywords&&function(e){for(var t in e._opts.keywords){var a=e._opts.keywords[t];e.addKeyword(t,a)}}(this),function(e){var t;e._opts.$data&&(t=a(68),e.addMetaSchema(t,t.$id,!0));if(!1===e._opts.meta)return;var r=a(16);e._opts.$data&&(r=u(r,f));e.addMetaSchema(r,h,!0),e._refs["http://json-schema.org/schema"]=h}(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),function(e){var t=e._opts.schemas;if(!t)return;if(Array.isArray(t))e.addSchema(t);else for(var a in t)e.addSchema(t[a],a)}(this)}function k(e,t){return t=i.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function y(e,t,a){for(var r in t){var i=t[r];i.meta||a&&!a.test(r)||(e._cache.del(i.cacheKey),delete t[r])}}function b(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function w(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function z(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function _(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function P(){}},function(e,t,a){"use strict";var r=a(0);e.exports=function(e){r.copy(e,this)}},function(e,t,a){"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var a,r="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(a=t.cmp,function(e){return function(t,r){var i={key:t,value:e[t]},n={key:r,value:e[r]};return a(i,n)}}),n=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var a,s;if(Array.isArray(t)){for(s="[",a=0;a<t.length;a++)a&&(s+=","),s+=e(t[a])||"null";return s+"]"}if(null===t)return"null";if(-1!==n.indexOf(t)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var o=n.push(t)-1,l=Object.keys(t).sort(i&&i(t));for(s="",a=0;a<l.length;a++){var d=l[a],u=e(t[d]);u&&(s&&(s+=","),s+=JSON.stringify(d)+":"+u)}return n.splice(o,1),"{"+s+"}"}}(e)}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r="",i=!0===e.schema.$async,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),s=e.self._getId(e.schema);if(e.opts.strictKeywords){var o=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(o){var l="unknown keyword: "+o;if("log"!==e.opts.strictKeywords)throw new Error(l);e.logger.warn(l)}}if(e.isTop&&(r+=" var validate = ",i&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",s&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" /*# sourceURL="+s+" */ ")),"boolean"==typeof e.schema||!n&&!e.schema.$ref){var d=e.level,u=e.dataLevel,p=e.schema["false schema"],m=e.schemaPath+e.util.getProperty("false schema"),c=e.errSchemaPath+"/false schema",h=!e.opts.allErrors,v="data"+(u||""),f="valid"+d;if(!1===e.schema){e.isTop?h=!0:r+=" var "+f+" = false; ",(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";var g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?r+=i?" return data; ":" validate.errors = null; return true; ":r+=" var "+f+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var k=e.isTop;d=e.level=0,u=e.dataLevel=0,v="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[void 0],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{d=e.level,v="data"+((u=e.dataLevel)||"");if(s&&(e.baseId=e.resolve.url(e.baseId,s)),i&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+d+" = errors;"}f="valid"+d,h=!e.opts.allErrors;var b="",w="",z=e.schema.type,_=Array.isArray(z);if(z&&e.opts.nullable&&!0===e.schema.nullable&&(_?-1==z.indexOf("null")&&(z=z.concat("null")):"null"!=z&&(z=[z,"null"],_=!0)),_&&1==z.length&&(z=z[0],_=!1),e.schema.$ref&&n){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),z){if(e.opts.coerceTypes)var P=e.util.coerceToTypes(e.opts.coerceTypes,z);var S=e.RULES.types[z];if(P||_||!0===S||S&&!Y(S)){m=e.schemaPath+".type",c=e.errSchemaPath+"/type",m=e.schemaPath+".type",c=e.errSchemaPath+"/type";var A=_?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](z,v,e.opts.strictNumbers,!0)+") { ",P){var j="dataType"+d,C="coerced"+d;r+=" var "+j+" = typeof "+v+"; ","array"==e.opts.coerceTypes&&(r+=" if ("+j+" == 'object' && Array.isArray("+v+")) "+j+" = 'array'; "),r+=" var "+C+" = undefined; ";var O="",L=P;if(L)for(var E,T=-1,x=L.length-1;T<x;)E=L[T+=1],T&&(r+=" if ("+C+" === undefined) { ",O+="}"),"array"==e.opts.coerceTypes&&"array"!=E&&(r+=" if ("+j+" == 'array' && "+v+".length == 1) { "+C+" = "+v+" = "+v+"[0]; "+j+" = typeof "+v+"; } "),"string"==E?r+=" if ("+j+" == 'number' || "+j+" == 'boolean') "+C+" = '' + "+v+"; else if ("+v+" === null) "+C+" = ''; ":"number"==E||"integer"==E?(r+=" if ("+j+" == 'boolean' || "+v+" === null || ("+j+" == 'string' && "+v+" && "+v+" == +"+v+" ","integer"==E&&(r+=" && !("+v+" % 1)"),r+=")) "+C+" = +"+v+"; "):"boolean"==E?r+=" if ("+v+" === 'false' || "+v+" === 0 || "+v+" === null) "+C+" = false; else if ("+v+" === 'true' || "+v+" === 1) "+C+" = true; ":"null"==E?r+=" if ("+v+" === '' || "+v+" === 0 || "+v+" === false) "+C+" = null; ":"array"==e.opts.coerceTypes&&"array"==E&&(r+=" if ("+j+" == 'string' || "+j+" == 'number' || "+j+" == 'boolean' || "+v+" == null) "+C+" = ["+v+"]; ");r+=" "+O+" if ("+C+" === undefined) { ",(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ";var M=u?"data"+(u-1||""):"parentData";r+=" "+v+" = "+C+"; ",u||(r+="if ("+M+" !== undefined)"),r+=" "+M+"["+(u?e.dataPathArr[u]:"parentDataProperty")+"] = "+C+"; } "}else{(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!n)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",h&&(r+=" } if (errors === ",r+=k?"0":"errs_"+d,r+=") { ",w+="}");else{var D=e.RULES;if(D)for(var $=-1,I=D.length-1;$<I;)if(Y(S=D[$+=1])){if(S.type&&(r+=" if ("+e.util.checkDataType(S.type,v,e.opts.strictNumbers)+") { "),e.opts.useDefaults)if("object"==S.type&&e.schema.properties){p=e.schema.properties;var N=Object.keys(p);if(N)for(var V,H=-1,F=N.length-1;H<F;){if(void 0!==(B=p[V=N[H+=1]]).default){var R=v+e.util.getProperty(V);if(e.compositeRule){if(e.opts.strictDefaults){y="default is ignored for: "+R;if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}}else r+=" if ("+R+" === undefined ","empty"==e.opts.useDefaults&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ","shared"==e.opts.useDefaults?r+=" "+e.useDefault(B.default)+" ":r+=" "+JSON.stringify(B.default)+" ",r+="; "}}}else if("array"==S.type&&Array.isArray(e.schema.items)){var U=e.schema.items;if(U){T=-1;for(var B,q=U.length-1;T<q;)if(void 0!==(B=U[T+=1]).default){R=v+"["+T+"]";if(e.compositeRule){if(e.opts.strictDefaults){y="default is ignored for: "+R;if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}}else r+=" if ("+R+" === undefined ","empty"==e.opts.useDefaults&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ","shared"==e.opts.useDefaults?r+=" "+e.useDefault(B.default)+" ":r+=" "+JSON.stringify(B.default)+" ",r+="; "}}}var K=S.rules;if(K)for(var G,W=-1,J=K.length-1;W<J;)if(X(G=K[W+=1])){var Z=G.code(e,G.keyword,S.type);Z&&(r+=" "+Z+" ",h&&(b+="}"))}if(h&&(r+=" "+b+" ",b=""),S.type&&(r+=" } ",z&&z===S.type&&!P)){r+=" else { ";var Q;m=e.schemaPath+".type",c=e.errSchemaPath+"/type";(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}h&&(r+=" if (errors === ",r+=k?"0":"errs_"+d,r+=") { ",w+="}")}}function Y(e){for(var t=e.rules,a=0;a<t.length;a++)if(X(t[a]))return!0}function X(t){return void 0!==e.schema[t.keyword]||t.implements&&function(t){for(var a=t.implements,r=0;r<a.length;r++)if(void 0!==e.schema[a[r]])return!0}(t)}return h&&(r+=" "+w+" "),k?(i?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+f+" = errors === errs_"+d+";",r}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o;var c="maximum"==t,h=c?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[h],f=e.opts.$data&&v&&v.$data,g=c?"<":">",k=c?">":"<",y=void 0;if(!m&&"number"!=typeof o&&void 0!==o)throw new Error(t+" must be number");if(!f&&void 0!==v&&"number"!=typeof v&&"boolean"!=typeof v)throw new Error(h+" must be number or boolean");if(f){var b=e.util.getData(v.$data,s,e.dataPathArr),w="exclusive"+n,z="exclType"+n,_="exclIsNumber"+n,P="' + "+(j="op"+n)+" + '";i+=" var schemaExcl"+n+" = "+b+"; ",i+=" var "+w+"; var "+z+" = typeof "+(b="schemaExcl"+n)+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var S;y=h;(S=S||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(y||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(i+=" , message: '"+h+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var A=i;i=S.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+z+" == 'number' ? ( ("+w+" = "+r+" === undefined || "+b+" "+g+"= "+r+") ? "+p+" "+k+"= "+b+" : "+p+" "+k+" "+r+" ) : ( ("+w+" = "+b+" === true) ? "+p+" "+k+"= "+r+" : "+p+" "+k+" "+r+" ) || "+p+" !== "+p+") { var op"+n+" = "+w+" ? '"+g+"' : '"+g+"='; ",void 0===o&&(y=h,d=e.errSchemaPath+"/"+h,r=b,m=f)}else{P=g;if((_="number"==typeof v)&&m){var j="'"+P+"'";i+=" if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" ( "+r+" === undefined || "+v+" "+g+"= "+r+" ? "+p+" "+k+"= "+v+" : "+p+" "+k+" "+r+" ) || "+p+" !== "+p+") { "}else{_&&void 0===o?(w=!0,y=h,d=e.errSchemaPath+"/"+h,r=v,k+="="):(_&&(r=Math[c?"min":"max"](v,o)),v===(!_||r)?(w=!0,y=h,d=e.errSchemaPath+"/"+h,k+="="):(w=!1,P+="="));j="'"+P+"'";i+=" if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+p+" "+k+" "+r+" || "+p+" !== "+p+") { "}}y=y||t,(S=S||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(y||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { comparison: "+j+", limit: "+r+", exclusive: "+w+" } ",!1!==e.opts.messages&&(i+=" , message: 'should be "+P+" ",i+=m?"' + "+r:r+"'"),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";A=i;return i=S.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+p+".length "+("maxItems"==t?">":"<")+" "+r+") { ";var c=t,h=h||[];h.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(c||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==t?"more":"fewer",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var v=i;return i=h.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");var c="maxLength"==t?">":"<";i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),!1===e.opts.unicode?i+=" "+p+".length ":i+=" ucs2length("+p+") ",i+=" "+c+" "+r+") { ";var h=t,v=v||[];v.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==t?"longer":"shorter",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var f=i;return i=v.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" Object.keys("+p+").length "+("maxProperties"==t?">":"<")+" "+r+") { ";var c=t,h=h||[];h.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(c||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==t?"more":"fewer",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var v=i;return i=h.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},function(e,t){var a,r,i=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(a===setTimeout)return setTimeout(e,0);if((a===n||!a)&&setTimeout)return a=setTimeout,setTimeout(e,0);try{return a(e,0)}catch(t){try{return a.call(null,e,0)}catch(t){return a.call(this,e,0)}}}!function(){try{a="function"==typeof setTimeout?setTimeout:n}catch(e){a=n}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l,d=[],u=!1,p=-1;function m(){u&&l&&(u=!1,l.length?d=l.concat(d):p=-1,d.length&&c())}function c(){if(!u){var e=o(m);u=!0;for(var t=d.length;t;){for(l=d,d=[];++p<t;)l&&l[p].run();p=-1,t=d.length}l=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];d.push(new h(e,t)),1!==d.length||u||o(c)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,a){"use strict";const r=a(6);let i;class n{static getClasses(){if(i)return i;const e=a(243);return i=e.reduce((e,t)=>(e[t]=a(244)(`./${t}.json`),e),{}),i}static getClass(e){const t=n.getClasses()[e];if(!t)throw new Error("invalid_class");return t}static getCapabilities(){return r.getCapabilities()}}e.exports=n},function(e,t,a){"use strict";const{validate:r,genericValidator:i,irValidator:n,rfValidator:s,rf433Validator:o,rf868Validator:l,modulationValidator:d,prontoValidator:u}=a(318);e.exports=class{constructor(e,{frequency:t}={}){this._signal=e,this._frequency=t,this._check=this._check.bind(this)}debug(...e){this._debug&&console.log("[dbg]",...e)}_check(e,t){if(!0!==t)throw new Error(e)}async validate({debug:e=!1}={}){if(this._debug=e,this.debug("Validating signal"),!this._signal)throw new Error("Invalid Signal");if("prontohex"===this._signal.type)this._validateProntohex();else{if(void 0!==this._signal.type)throw new Error("Invalid Signal type");this._validateRegular()}if("433"===this._frequency)this._validate433();else if("868"===this._frequency)this._validate868();else{if("ir"!==this._frequency)throw new Error("Invalid Frequency");this._validateInfrared()}this.debug("Validated successfully")}_validateWithEngine(e){return r(e,this._check,this._signal)}_validateProntohex(){this._check("mandatory_fields",this._signal.hasOwnProperty("cmds")),this._validateWithEngine(u)}_validateRegular(){this._check("mandatory_fields",this._signal.hasOwnProperty("sof")||this._signal.hasOwnProperty("eof")||this._signal.hasOwnProperty("words")),this._validateWithEngine(i),this._validateWithEngine(s)}_validate433(){this._validateWithEngine(d),this._validateWithEngine(o)}_validate868(){this._validateWithEngine(d),this._validateWithEngine(l)}_validateInfrared(){this._validateWithEngine(n)}}},function(e,t,a){"use strict";e.exports=class{static getCurrencies(){return a(319)}static getBatteries(){return["LS14250","C","AA","AAA","AAAA","A23","A27","PP3","CR123A","CR2","CR1632","CR2032","CR2430","CR2450","CR2477","CR3032","CR14250","INTERNAL","OTHER"]}}},function(e,t,a){(function(e){function a(e,t){for(var a=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),a++):a&&(e.splice(r,1),a--)}if(t)for(;a--;a)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var a=[],r=0;r<e.length;r++)t(e[r],r,e)&&a.push(e[r]);return a}t.resolve=function(){for(var t="",i=!1,n=arguments.length-1;n>=-1&&!i;n--){var s=n>=0?arguments[n]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=a(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var n=t.isAbsolute(e),s="/"===i(e,-1);return(e=a(r(e.split("/"),(function(e){return!!e})),!n).join("/"))||n||(e="."),e&&s&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,a){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var a=e.length-1;a>=0&&""===e[a];a--);return t>a?[]:e.slice(t,a-t+1)}e=t.resolve(e).substr(1),a=t.resolve(a).substr(1);for(var i=r(e.split("/")),n=r(a.split("/")),s=Math.min(i.length,n.length),o=s,l=0;l<s;l++)if(i[l]!==n[l]){o=l;break}var d=[];for(l=o;l<i.length;l++)d.push("..");return(d=d.concat(n.slice(o))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),a=47===t,r=-1,i=!0,n=e.length-1;n>=1;--n)if(47===(t=e.charCodeAt(n))){if(!i){r=n;break}}else i=!1;return-1===r?a?"/":".":a&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var a=function(e){"string"!=typeof e&&(e+="");var t,a=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){a=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(a,r)}(e);return t&&a.substr(-1*t.length)===t&&(a=a.substr(0,a.length-t.length)),a},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,a=0,r=-1,i=!0,n=0,s=e.length-1;s>=0;--s){var o=e.charCodeAt(s);if(47!==o)-1===r&&(i=!1,r=s+1),46===o?-1===t?t=s:1!==n&&(n=1):-1!==t&&(n=-1);else if(!i){a=s+1;break}}return-1===t||-1===r||0===n||1===n&&t===r-1&&t===a+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,a){return e.substr(t,a)}:function(e,t,a){return t<0&&(t=e.length+t),e.substr(t,a)}}).call(this,a(17))},function(e,t,a){"use strict";var r={bmp:a(322),cur:a(323),dds:a(324),gif:a(325),ico:a(23),jpg:a(326),png:a(327),psd:a(328),svg:a(329),tiff:a(330),webp:a(332)};e.exports=r},function(e,t,a){"use strict";function r(e,t){var a=e.readUInt8(t);return 0===a?256:a}function i(e,t){var a=6+16*t;return{width:r(e,a),height:r(e,a+1)}}e.exports={detect:function(e){return 0===e.readUInt16LE(0)&&1===e.readUInt16LE(2)},calculate:function(e){var t,a=e.readUInt16LE(4),r=i(e,0);if(1===a)return r;for(r.images=[{width:r.width,height:r.height}],t=1;t<a;t+=1)r.images.push(i(e,t));return r}}},function(e,t,a){"use strict";e.exports.App=a(25),e.exports.Device=a(18),e.exports.Capability=a(6),e.exports.Signal=a(19),e.exports.Media=a(336),e.exports.Energy=a(20),e.exports.getDeviceClasses=e.exports.Device.getClasses.bind(e.exports.Device),e.exports.getDeviceClass=e.exports.Device.getClass.bind(e.exports.Device),e.exports.getCapabilities=e.exports.Capability.getCapabilities.bind(e.exports.Capability),e.exports.getCapability=e.exports.Capability.getCapability.bind(e.exports.Capability),e.exports.hasCapability=e.exports.Capability.hasCapability.bind(e.exports.Capability),e.exports.getAppLocales=e.exports.App.getLocales.bind(e.exports.App),e.exports.getAppCategories=e.exports.App.getCategories.bind(e.exports.App),e.exports.getAppPermissions=e.exports.App.getPermissions.bind(e.exports.App),e.exports.getAppBrandColor=e.exports.App.getBrandColor.bind(e.exports.App),e.exports.getMediaCodecs=e.exports.Media.getCodecs.bind(e.exports.Media),e.exports.getCurrencies=e.exports.Energy.getCurrencies.bind(e.exports.Energy),e.exports.getBatteries=e.exports.Energy.getBatteries.bind(e.exports.Energy)},function(e,t,a){"use strict";(function(t,r){const{URLSearchParams:i}=a(29),n=a(1),s=a(8),o=a(69),l=a(70),d=a(18),u=a(6),p=a(19),m=a(20),{openAsync:c,closeAsync:h,readAsync:v,statAsync:f,readFileAsync:g,readDirAsync:k,lstatAsync:y,imageSizeAsync:b,join:w,extname:z,basename:_,dirname:P}=a(320),S=["debug","publish","verified"],A={".jpg":t.from([255,216]),".jpeg":t.from([255,216]),".png":t.from([137,80,78,71])},j={app:{small:{width:250,height:175},large:{width:500,height:350},xlarge:{width:1e3,height:700}},driver:{small:{width:75,height:75},large:{width:500,height:500},xlarge:{width:1e3,height:1e3}}},C=["measure_battery","alarm_battery"];class O{constructor(e){if(this._path=e,"string"!=typeof this._path)throw new Error("Invalid path")}debug(...e){this._debug&&console.log("[dbg]",...e)}async validate({level:e="debug",debug:t=!1}={}){if(this._debug=t,this.debug(`Validating "${this._path}"`),!S.includes(e))throw new Error("Invalid validation level. Allowed levels are: "+S);const a="publish"===e||"verified"===e,r="verified"===e;let i=await g(w(this._path,"app.json"));i=JSON.parse(i);const l=O.getJSONSchema(),c=new s({async:!0,allErrors:!0}).compile(l);if(!1===await c(i))throw new Error(this.constructor.errorsText(c.errors,i)||"Invalid app.json");if(!O.isValidId(i.id))throw new Error("Invalid id");if(!o.valid(i.version))throw new Error("Invalid version");if(o.coerce(i.version).toString()!==i.version)throw new Error(`Invalid version (${i.version}), pre-release versions are not allowed`);if(!o.validRange(i.compatibility))throw new Error("Invalid compatibility");if(!0===i.esm&&o.lt(o.coerce(i.compatibility),"12.0.1"))throw new Error("ESM apps require a compatibility of at least >=12.0.1");const h=async e=>{await n.promises.access(e).then(()=>{if(o.lt(o.coerce(i.compatibility),"12.0.1"))throw new Error(`ESM apps require a compatibility of at least >=12.0.1. (${e})`)}).catch(e=>{if("ENOENT"!==e.code)throw e})},v=w(this._path,"app.mjs"),f=w(this._path,"app.cjs"),k=w(this._path,"api.mjs"),y=w(this._path,"api.cjs");if(await h(v),await h(f),await h(k),await h(y),Array.isArray(i.drivers))for(const e of i.drivers){const t=w(this._path,"drivers",e.id,"driver.mjs"),a=w(this._path,"drivers",e.id,"driver.cjs"),r=w(this._path,"drivers",e.id,"device.mjs"),i=w(this._path,"drivers",e.id,"device.cjs");await h(t),await h(a),await h(r),await h(i)}if(Array.isArray(i.widgets)){if(o.lt(o.coerce(i.compatibility),"12.1.0"))throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${path})`);for(const e of i.widgets){const t=w(this._path,"widgets",e.id,"api.mjs"),a=w(this._path,"widgets",e.id,"api.cjs");await h(t),await h(a)}}if(3===i.sdk){const e=o.minVersion(i.compatibility);if(!o.gt(e,"4.2.0"))throw new Error(`Invalid compatibility (${i.compatibility}), SDK version 3 apps must have a compatibility of at least >=5.0.0`)}if((i.platforms||[]).includes("cloud")&&(i.platformLocalRequiredFeatures||[]).length>0)throw new Error("The property `platformLocalRequiredFeatures` can not be used in combination with platform: `cloud`.");if(!1===(i.platforms||[]).includes("local")&&(i.platformLocalRequiredFeatures||[]).length>0&&console.warn("Warning: using `platformLocalRequiredFeatures` requires `platforms: [local]`."),r){if(void 0===i.platforms)throw new Error("The property `platforms` is required in order to publish a verified app.");if(void 0===i.support)throw new Error("The property `support` is required in order to publish a verified app.")}if(Array.isArray(i.permissions)){const e=O.getPermissions();i.permissions.forEach(t=>{if("homey:app:com.athom.homeyscript"===t)throw new Error("Forbidden permission: "+t);if("homey:manager:api"===t&&a&&console.warn("Warning: using the homey:manager:api permission will require a more thorough review. It may take longer than usual to review your app."),"homey:manager:speech-input"===t){if(r)throw new Error(`Unsupported permission: ${t}, please remove any speech input related functionality.`);console.warn("Warning: the homey:manager:speech-input permission is not supported, please remove any speech input related functionality.")}if(!t.startsWith("homey:app:")&&void 0===e[t])throw new Error("Invalid permission: "+t)})}if(i.category){const e=O.getCategories();let t=[];t=Array.isArray(i.category)?i.category:[i.category],t.forEach(t=>{if(!e.includes(t))throw new Error("Invalid category: "+t)})}else if(a)throw new Error("The property `category` is required in order to publish an app.");if(Array.isArray(i.drivers)){const e=d.getClasses(),t=d.getCapabilities();for(let n=0;n<i.drivers.length;n++){const s=i.drivers[n];if(await this._ensureFileExistsCaseSensitive(w("drivers",s.id)),void 0===e[s.class])throw new Error(`drivers.${s.id} invalid driver class: ${s.class}`);if(e[s.class].minCompatibility&&o.lt(o.minVersion(i.compatibility),e[s.class].minCompatibility))throw new Error(`drivers.${s.id} driver class: ${s.class} is not available for compatibility ${i.compatibility}, requires minimum: ${e[s.class].minCompatibility}`);if(s.capabilities.forEach(e=>{const r=e.split(".")[0],n=void 0!==t[r],l=void 0!==i.capabilities&&void 0!==i.capabilities[r];if(!n&&!l)throw new Error(`drivers.${s.id} invalid capability: ${e}`);if(n&&!l&&t[r].minCompatibility&&o.lt(o.minVersion(i.compatibility),t[r].minCompatibility))throw new Error(`drivers.${s.id} capability: ${r} is not available for compatibility ${i.compatibility}, requires minimum: ${t[r].minCompatibility}`);if(C.includes(r)&&(!s.energy||!Array.isArray(s.energy.batteries))&&a)throw new Error(`drivers.${s.id} is missing an array 'energy.batteries' because the capability ${r} is being used.`)}),Array.isArray(s.pair))for(let e=0;e<s.pair.length;e++){const t=s.pair[e];if(void 0!==t.navigation){const e=t.navigation.prev;if(e){if(!s.pair.find(t=>t.id===e))throw new Error(`drivers.${s.id} invalid navigation.prev: ${e}`)}const a=t.navigation.next;if(a){if(!s.pair.find(e=>e.id===a))throw new Error(`drivers.${s.id} invalid navigation.next: ${a}`)}}void 0===t.template&&await this._ensureFileExistsCaseSensitive(w("drivers",s.id,"pair",t.id+".html"))}const l=new Set;if(s.zwave&&Array.isArray(s.settings))for(let e=0;e<s.settings.length;e++){const t=s.settings[e];if(t.type&&"group"===t.type&&t.children&&Array.isArray(t.children))for(let e=0;e<t.children.length;e++){const a=t.children[e];a&&a.zwave&&(l.has(a.zwave.index)?console.warn(`drivers.${s.id}: duplicate zwave setting index ${a.zwave.index}`):l.add(a.zwave.index),this._checkZwaveForSetting(s,a))}else t.zwave&&(l.has(t.zwave.index)?console.warn(`drivers.${s.id}: duplicate zwave setting index ${t.zwave.index}`):l.add(t.zwave.index),this._checkZwaveForSetting(s,t))}if(a){if(!s.images)throw new Error(`drivers.${s.id}: property \`images\` is required in order to publish an app.`);await this._validateImages(s.images,"driver","drivers."+s.id)}if(r){if(void 0===s.platforms)throw new Error(`drivers.${s.id}: property \`platforms\` is required in order to publish a verified app.`);if(void 0===s.connectivity)throw new Error(`drivers.${s.id}: property \`connectivity\` is required in order to publish a verified app.`)}if(!s.platforms&&i.platforms&&i.platforms.includes("cloud")&&console.warn(`Warning: drivers.${s.id} doesn't have a 'platforms' property. The default is ["local"].`),s.platforms&&i.platforms){if(s.platforms.includes("local")&&!1===i.platforms.includes("local"))throw new Error(`drivers.${s.id} invalid 'platforms': App manifest does not list 'local' as a supported platform.`);if(s.platforms.includes("cloud")&&!1===i.platforms.includes("cloud"))throw new Error(`drivers.${s.id} invalid 'platforms': App manifest does not list 'cloud' as a supported platform.`)}if(s.connectivity&&(s.connectivity.includes("lan")||s.connectivity.includes("rf868")||s.connectivity.includes("matter"))&&s.platforms&&s.platforms.includes("cloud"))throw new Error(`drivers.${s.id} invalid 'connectivity': Platform 'cloud' does not support 'lan', 'matter' or 'rf868'.`);if(!("string"!=typeof s.discovery||i.discovery&&i.discovery[s.discovery]))throw new Error(`drivers.${s.id} invalid 'discovery': ${s.discovery}`);if("object"==typeof s.energy&&Array.isArray(s.energy.batteries)){const e=m.getBatteries();s.energy.batteries.forEach(t=>{if(!e.includes(t))throw new Error(`drivers.${s.id} invalid 'battery': ${t}. Allowed values: ${e.join(", ")}`)})}if(s.connectivity&&s.connectivity.includes("matter")){if(!s.matter)throw new Error(`drivers.${s.id} has 'connectivity': 'matter' and therefore requires a 'matter' object.`);if(s.pair)throw new Error(`drivers.${s.id} invalid 'pair' configuration, Matter drivers do not support custom pairing views.`);if(void 0===s.matter.deviceVendorId&&void 0!==s.matter.deviceProductName||void 0!==s.matter.deviceVendorId&&void 0===s.matter.deviceProductName)throw new Error(`drivers.${s.id} invalid 'matter': 'deviceVendorId' and 'deviceProductName' must be defined together.`);const e=await this._fileExistsCaseSensitive(w("drivers",s.id,"device.js")),t=await this._fileExistsCaseSensitive(w("drivers",s.id,"device.mjs"));if(e||t)throw new Error(`drivers.${s.id}: using a device.${e?"js":"mjs"} file is not supported for Matter drivers.`);const a=await this._fileExistsCaseSensitive(w("drivers",s.id,"driver.js")),r=await this._fileExistsCaseSensitive(w("drivers",s.id,"driver.mjs"));if(a||r)throw new Error(`drivers.${s.id}: using a driver.${a?"js":"mjs"} file is not supported for Matter drivers.`)}if(s.matter&&(!s.connectivity||!s.connectivity.includes("matter")))throw new Error(`drivers.${s.id} Matter drivers require 'connectivity' to include 'matter'.`)}const n=i.drivers.every(e=>e.connectivity&&e.connectivity.includes("matter")),s=i.platformLocalRequiredFeatures&&i.platformLocalRequiredFeatures.includes("matter");n&&!s&&console.warn("Warning: all drivers have connectivity: matter, but matter is not set as a platform required feature."),!n&&s&&console.warn("Warning: matter is set as a platform required feature, but not all drivers have connectivity: matter.")}if(void 0!==i.capabilities)for(const e of Object.keys(i.capabilities)){if(e.includes("."))throw new Error(`Invalid capability: ${e}\nCharacter '.' is reserved for subcapabilities.`);const t=i.capabilities[e],a=new u(t);try{await a.validate()}catch(t){throw new Error(`Invalid capability: ${e}\n${t.message}`)}t.icon&&await this._ensureFileExistsCaseSensitive(t.icon)}if(void 0!==i.signals)for(const e of Object.keys(i.signals))for(const t of Object.keys(i.signals[e])){const a=new p(i.signals[e][t],{frequency:e});try{await a.validate()}catch(a){throw new Error(`Invalid signal: ${e}.${t}\n${a.message}`)}}if(i.flow)for(const e of Object.keys(i.flow)){const t=i.flow[e];if(Array.isArray(t))for(let n=0;n<t.length;n++){const s=t[n];if(t.findIndex(e=>e.id===s.id)!==n){if(i.sdk>=3)throw new Error(`Found multiple Flow card ${e} with the id "${s.id}", all Flow cards should have a unique id.`);console.warn(`Warning: Found multiple Flow card ${e} with the id "${s.id}", all Flow cards should have a unique id.`)}this._validateFlowCard(s,`flow.${e}['${s.id}']`,i,{levelPublish:a,levelVerified:r})}}if(i.discovery)for(const e of Object.keys(i.discovery)){const t=i.discovery[e],{type:a}=t;if(!t[a])throw new Error(`Missing discovery.${e}.${a}`)}if(await this._fileExistsCaseSensitive("locales")){const e=O.getLocales(),t=await this._getDirectoryContents("locales");for(let a=0;a<t.length;a++){const r=t[a];if(".json"!==z(r))continue;const i=_(r,".json");if(!e.includes(i))throw new Error(`Invalid locale: /locales/${i}.json\nAllowed locales are: ${e}`);try{const e=await g(r,"utf8");JSON.parse(e)}catch(e){throw new Error(`Malformed locale: /locales/${i}.json\n${e.message}`)}}}if(i.sdk&&1!==i.sdk||await this._ensureFileExistsCaseSensitive("app.js"),await this._fileExistsCaseSensitive("env.json")){let e;try{e=await g(w(this._path,"env.json"),"utf8"),e=JSON.parse(e)}catch(e){throw new Error("Malformed file: /env.json\n"+e.message)}if(e)for(const t of Object.keys(e)){if(t.toUpperCase()!==t)throw new Error("Invalid /env.json key, must be uppercase: "+t);const a=e[t];if("string"!=typeof a)throw new Error("Invalid /env.json value, must be of type string: "+a)}}if(await this._ensureFileExistsCaseSensitive(w("assets","icon.svg")),await this._fileExistsCaseSensitive("settings")&&await this._ensureFileExistsCaseSensitive(w("settings","index.html")),a){if(!i.images)throw new Error("The property `images` is required in order to publish an app.");await this._validateImages(i.images,"app"),await this._validateModules()}if(i.brandColor){if(!this.constructor.isValidBrandColor(i.brandColor))throw new Error("The color defined in `brandColor` is too bright. Icons are rendered white, so choose a darker color that has enough contrast.")}else if(a)throw new Error("The property `brandColor` is required in order to publish an app.");this.debug("Validated successfully")}_checkZwaveForSetting(e,t){if(e&&t&&t.zwave){if("number"!=typeof t.zwave.index||"number"!=typeof t.zwave.size)throw new Error(`Missing property in "zwave" at ${e.id}, ${t.id}`);if(t.attr&&"number"==typeof t.attr.max||"number"==typeof t.max){const{size:a}=t.zwave;let r="number"==typeof t.attr.max?t.attr.max:t.max;const i="number"==typeof t.attr.step?t.attr.step:1;i>1&&(r/=i);const n="boolean"!=typeof t.zwave.signed||t.zwave.signed,s=Math.pow(2,8*a)/2-1,o=Math.pow(2,8*a)-1;if(n&&r>s)throw new Error(`Value cannot be signed: ${e.id}, ${t.id}. Max value: ${s}, actual value: ${r}`);if(!n&&r>o)throw new Error(`Max value out of bounds: ${e.id}, ${t.id}. Max value: ${o}, actual value: ${r}`)}}}async _getDirectoryContents(e){return await this._fileExistsCaseSensitive(e),e=w(this._path,e),k(e).then(t=>t.map(t=>w(e,t)))}async _ensureFileExistsCaseSensitive(e){if(!0!==await this._fileExistsCaseSensitive(e))throw new Error("Filepath does not exist: "+e)}async _fileExistsCaseSensitive(e){e=w(this._path,e);const t=P(e);try{if(!(await f(t)).isDirectory())return!1;return(await k(t)).indexOf(_(e))>-1}catch(e){return!1}}async _validateImages(e,t,a){const r=["small","large"];for(let i=0;i<r.length;i++){const n=r[i],s=e[n],o=z(s);if(void 0===A[o])throw new Error(`Invalid image extension (${o})${a?` ${a}.${n}`:""}: ${w(this._path,s)}`);await this._ensureFileExistsCaseSensitive(s);const l=A[o];if(!(await this._readBytes(s,l.length)).equals(l))throw new Error(`Invalid image${a?` ${a}.${n}`:""}: ${w(this._path,s)}`);const d=j[t][n],u=await b(w(this._path,s));if(u.width!==d.width||u.height!==d.height)throw new Error(`Invalid image size (${u.width}x${u.height})${a?` ${a}.${n}`:""}: ${w(this._path,s)}\nRequired: ${d.width}x${d.height}`)}}async _validateModules(){const e=w(this._path,"node_modules");try{await f(e)}catch(e){return}for(const t of await k(e)){let a;try{a=await y(w(e,t))}catch(e){throw Error(`Invalid module '${t}' in 'node_modules': ${e.message}`)}if(a.isSymbolicLink())throw Error(`Invalid module '${t}' in 'node_modules': is a symbolic link`)}}_validateFlowCard(e,t,a,{levelPublish:r,levelVerified:n}){if(Array.isArray(e.tokens))for(const a of e.tokens)"string"!=typeof a.type&&console.warn(`Warning: ${t}.tokens['${a.name}'].type is missing, it defaults to "string". Specifying a token type will be required in the future.`);if(!1===Array.isArray(e.args))return;const s=e.args.find(e=>{const t=new i(e.filter);return"device"===e.type&&(t.has("driver_id")||t.has("driverId"))}),o=e.args.filter(e=>e!==s);if(0!==o.length){if(n)for(const e of o)if(void 0===e.title)throw new Error(`${t}.args['${e.name}'].title is required for arguments in order to publish a verified app.`);if(e.droptoken&&o.push({name:"droptoken"}),void 0===e.titleFormatted){if(n)throw new Error(t+".titleFormatted is required in order to publish a verified app.");console.warn(`Warning: ${t}.titleFormatted is missing. Specifying a Flow card's formatted title will be required in the future.`)}if("string"!=typeof e.titleFormatted){if("object"==typeof e.titleFormatted&&null!==e.titleFormatted)for(const[a,r]of Object.entries(e.titleFormatted))O._checkTitleFormatted(r,o,`${t}.titleFormatted.${a}`);if(e.platforms&&a.platforms){if(e.platforms.includes("local")&&!1===a.platforms.includes("local"))throw new Error(t+" invalid 'platforms': App manifest does not list 'local' as a supported platform.");if(e.platforms.includes("cloud")&&!1===a.platforms.includes("cloud"))throw new Error(t+" invalid 'platforms': App manifest does not list 'cloud' as a supported platform.")}}else O._checkTitleFormatted(e.titleFormatted,o,t+".titleFormatted")}}static _checkTitleFormatted(e,t,a){const r=t.reduce((e,t)=>(e[t.name]=!1,e),{}),i=e.match(/\[\[(.*?)\]\]/gm);if(null===i)throw Error("Missing all args in "+a);i.forEach(e=>{const t=e.substring(2,e.length-2);if(void 0===r[t])throw Error(`Invalid [[${t}]] in ${a}.titleFormatted`);if(!0===r[t])throw Error(`Duplicate [[${t}]] in ${a}.titleFormatted`);!1===r[t]&&(r[t]=!0)});for(const[e,t]of Object.entries(r))if(!1===t)throw Error(`Missing [[${e}]] in ${a}`)}async _readBytes(e,a){e=w(this._path,e);const r=await c(e,"r"),i=t.alloc(a);return await v(r,i,0,a,0),await h(r),i}static isValidId(e){return"string"==typeof e&&(!(e.length<1)&&(!(e.split(".").length<2)&&!!/^[a-zA-Z0-9_.-]*$/g.test(e)))}static isValidBrandColor(e){return l(e).getBrightness()<=184}static getJSONSchema(){const e=a(334);return JSON.parse(JSON.stringify(e))}static getPermissions(){const e=a(335);if("function"==typeof w)for(const t of Object.keys(e)){e[t].icon=w(r,"..","..","assets","app","permissions",t.replace(/:/g,"-")+".svg")}return e}static getCategories(){return["lights","video","music","appliances","security","climate","tools","internet","localization","energy"]}static getLocales(){return["ab","aa","af","ak","sq","am","ar","an","hy","as","av","ae","ay","az","bm","ba","eu","be","bn","bh","bi","bs","br","bg","my","ca","ch","ce","ny","zh","cv","kw","co","cr","hr","cs","da","dv","nl","dz","en","eo","et","ee","fo","fj","fi","fr","ff","gl","ka","de","el","gn","gu","ht","ha","he","hz","hi","ho","hu","ia","id","ie","ga","ig","ik","io","is","it","iu","ja","jv","kl","kn","kr","ks","kk","km","ki","rw","ky","kv","kg","ko","ku","kj","la","lb","lg","li","ln","lo","lt","lu","lv","gv","mk","mg","ms","ml","mt","mi","mr","mh","mn","na","nv","nd","ne","ng","nb","nn","no","ii","nr","oc","oj","cu","om","or","os","pa","pi","fa","pl","ps","pt","qu","rm","rn","ro","ru","sa","sc","sd","se","sm","sg","sr","gd","sn","si","sk","sl","so","st","es","su","sw","ss","sv","ta","te","tg","th","ti","bo","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","cy","wo","fy","xh","yi","yo","za","zu"]}static getBrandColor(e){const a=t.from(e).toString("hex");let r,i=0;do{const e=`${a}${++i}`;let t=l("#"+e.substring(e.length-6));t=l({h:t.toHsv().h,s:.75,l:.5});const n=t.toHexString();this.isValidBrandColor(n)&&(r=n)}while(!r);return r}static errorsText(e,t){return!1===Array.isArray(e)?null:e.reduce((e,a)=>{let r="";const i=new RegExp("drivers\\[(\\d+)\\]"),n=a.dataPath.match(i);if(n){const e=parseInt(n[1],10),r=t.drivers[e];r&&(a.dataPath=a.dataPath.replace(`drivers[${e}]`,`drivers['${r.id}']`))}switch(["triggers","conditions","actions"].forEach(e=>{const r=new RegExp(`flow.${e}\\[(\\d+)\\]`),i=a.dataPath.match(r);if(i){const r=parseInt(i[1],10),n=t.flow[e][r];if(n){a.dataPath=a.dataPath.replace(`flow.${e}[${r}]`,`flow.${e}['${n.id}']`);const t=new RegExp(".args\\[(\\d+)\\]"),i=a.dataPath.match(t);if(i){const e=parseInt(i[1],10),t=n.args[e];t&&(a.dataPath=a.dataPath.replace(`.args[${e}]`,`.args['${t.name}']`))}}}}),a.keyword){case"oneOf":return`${e}manifest${a.dataPath} matched no available schemas, see previous errors\n`;case"enum":r=JSON.stringify(a.params.allowedValues)}return`${e}manifest${a.dataPath} ${a.message} ${r}\n`},"").slice(0,-1)}}e.exports=O}).call(this,a(2).Buffer,"/")},function(e,t,a){"use strict";t.byteLength=function(e){var t=d(e),a=t[0],r=t[1];return 3*(a+r)/4-r},t.toByteArray=function(e){var t,a,r=d(e),s=r[0],o=r[1],l=new n(function(e,t,a){return 3*(t+a)/4-a}(0,s,o)),u=0,p=o>0?s-4:s;for(a=0;a<p;a+=4)t=i[e.charCodeAt(a)]<<18|i[e.charCodeAt(a+1)]<<12|i[e.charCodeAt(a+2)]<<6|i[e.charCodeAt(a+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===o&&(t=i[e.charCodeAt(a)]<<2|i[e.charCodeAt(a+1)]>>4,l[u++]=255&t);1===o&&(t=i[e.charCodeAt(a)]<<10|i[e.charCodeAt(a+1)]<<4|i[e.charCodeAt(a+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,a=e.length,i=a%3,n=[],s=0,o=a-i;s<o;s+=16383)n.push(u(e,s,s+16383>o?o:s+16383));1===i?(t=e[a-1],n.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[a-2]<<8)+e[a-1],n.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return n.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=s.length;o<l;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.indexOf("=");return-1===a&&(a=t),[a,a===t?0:4-a%4]}function u(e,t,a){for(var i,n,s=[],o=t;o<a;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(r[(n=i)>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
8
+ var r=a(26),i=a(27),n=a(28);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,a){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return d(this,e,t,a)}function d(e,t,a,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,r){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,a):new Uint8Array(t,a,r);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=m(e,t);return e}(e,t,a,r):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!l.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var r=0|h(t,a),i=(e=o(e,r)).write(t,a);i!==r&&(e=e.slice(0,i));return e}(e,t,a):function(e,t){if(l.isBuffer(t)){var a=0|c(t.length);return 0===(e=o(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?o(e,0):m(e,t);if("Buffer"===t.type&&n(t.data))return m(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function p(e,t){if(u(t),e=o(e,t<0?0:0|c(t)),!l.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function m(e,t){var a=t.length<0?0:0|c(t.length);e=o(e,a);for(var r=0;r<a;r+=1)e[r]=255&t[r];return e}function c(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return F(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,a){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,a);case"utf8":case"utf-8":return A(this,t,a);case"ascii":return j(this,t,a);case"latin1":case"binary":return C(this,t,a);case"base64":return S(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,a);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function f(e,t,a){var r=e[t];e[t]=e[a],e[a]=r}function g(e,t,a,r,i){if(0===e.length)return-1;if("string"==typeof a?(r=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return-1;a=e.length-1}else if(a<0){if(!i)return-1;a=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:k(e,t,a,r,i);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):k(e,[t],a,r,i);throw new TypeError("val must be string, number or Buffer")}function k(e,t,a,r,i){var n,s=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,o/=2,l/=2,a/=2}function d(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(n=a;n<o;n++)if(d(e,n)===d(t,-1===u?0:n-u)){if(-1===u&&(u=n),n-u+1===l)return u*s}else-1!==u&&(n-=n-u),u=-1}else for(a+l>o&&(a=o-l),n=a;n>=0;n--){for(var p=!0,m=0;m<l;m++)if(d(e,n+m)!==d(t,m)){p=!1;break}if(p)return n}return-1}function y(e,t,a,r){a=Number(a)||0;var i=e.length-a;r?(r=Number(r))>i&&(r=i):r=i;var n=t.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var s=0;s<r;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o}return s}function b(e,t,a,r){return R(H(t,e.length-a),e,a,r)}function w(e,t,a,r){return R(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,r)}function z(e,t,a,r){return w(e,t,a,r)}function _(e,t,a,r){return R(F(t),e,a,r)}function P(e,t,a,r){return R(function(e,t){for(var a,r,i,n=[],s=0;s<e.length&&!((t-=2)<0);++s)a=e.charCodeAt(s),r=a>>8,i=a%256,n.push(i),n.push(r);return n}(t,e.length-a),e,a,r)}function S(e,t,a){return 0===t&&a===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,a))}function A(e,t,a){a=Math.min(e.length,a);for(var r=[],i=t;i<a;){var n,s,o,l,d=e[i],u=null,p=d>239?4:d>223?3:d>191?2:1;if(i+p<=a)switch(p){case 1:d<128&&(u=d);break;case 2:128==(192&(n=e[i+1]))&&(l=(31&d)<<6|63&n)>127&&(u=l);break;case 3:n=e[i+1],s=e[i+2],128==(192&n)&&128==(192&s)&&(l=(15&d)<<12|(63&n)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:n=e[i+1],s=e[i+2],o=e[i+3],128==(192&n)&&128==(192&s)&&128==(192&o)&&(l=(15&d)<<18|(63&n)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var a="",r=0;for(;r<t;)a+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return a}(r)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,a){return d(null,e,t,a)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,a){return function(e,t,a,r){return u(t),t<=0?o(e,t):void 0!==a?"string"==typeof r?o(e,t).fill(a,r):o(e,t).fill(a):o(e,t)}(null,e,t,a)},l.allocUnsafe=function(e){return p(null,e)},l.allocUnsafeSlow=function(e){return p(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,r=t.length,i=0,n=Math.min(a,r);i<n;++i)if(e[i]!==t[i]){a=e[i],r=t[i];break}return a<r?-1:r<a?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!n(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var r=l.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var s=e[a];if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},l.byteLength=h,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):v.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",a=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,a).match(/.{2}/g).join(" "),this.length>a&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,a,r,i){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||a>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=a)return 0;if(r>=i)return-1;if(t>=a)return 1;if(this===e)return 0;for(var n=(i>>>=0)-(r>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(n,s),d=this.slice(r,i),u=e.slice(t,a),p=0;p<o;++p)if(d[p]!==u[p]){n=d[p],s=u[p];break}return n<s?-1:s<n?1:0},l.prototype.includes=function(e,t,a){return-1!==this.indexOf(e,t,a)},l.prototype.indexOf=function(e,t,a){return g(this,e,t,a,!0)},l.prototype.lastIndexOf=function(e,t,a){return g(this,e,t,a,!1)},l.prototype.write=function(e,t,a,r){if(void 0===t)r="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)r=t,a=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===r&&(r="utf8")):(r=a,a=void 0)}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return y(this,e,t,a);case"utf8":case"utf-8":return b(this,e,t,a);case"ascii":return w(this,e,t,a);case"latin1":case"binary":return z(this,e,t,a);case"base64":return _(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,a);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,t,a){var r="";a=Math.min(e.length,a);for(var i=t;i<a;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,a){var r="";a=Math.min(e.length,a);for(var i=t;i<a;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,a){var r=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>r)&&(a=r);for(var i="",n=t;n<a;++n)i+=V(e[n]);return i}function L(e,t,a){for(var r=e.slice(t,a),i="",n=0;n<r.length;n+=2)i+=String.fromCharCode(r[n]+256*r[n+1]);return i}function E(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,a,r,i,n){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<n)throw new RangeError('"value" argument is out of bounds');if(a+r>e.length)throw new RangeError("Index out of range")}function x(e,t,a,r){t<0&&(t=65535+t+1);for(var i=0,n=Math.min(e.length-a,2);i<n;++i)e[a+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(e,t,a,r){t<0&&(t=4294967295+t+1);for(var i=0,n=Math.min(e.length-a,4);i<n;++i)e[a+i]=t>>>8*(r?i:3-i)&255}function D(e,t,a,r,i,n){if(a+r>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function $(e,t,a,r,n){return n||D(e,0,a,4),i.write(e,t,a,r,23,4),a+4}function I(e,t,a,r,n){return n||D(e,0,a,8),i.write(e,t,a,r,52,8),a+8}l.prototype.slice=function(e,t){var a,r=this.length;if((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<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=l.prototype;else{var i=t-e;a=new l(i,void 0);for(var n=0;n<i;++n)a[n]=this[n+e]}return a},l.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e],i=1,n=0;++n<t&&(i*=256);)r+=this[e+n]*i;return r},l.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},l.prototype.readUInt8=function(e,t){return t||E(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||E(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||E(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=this[e],i=1,n=0;++n<t&&(i*=256);)r+=this[e+n]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||E(e,t,this.length);for(var r=t,i=1,n=this[e+--r];r>0&&(i*=256);)n+=this[e+--r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readInt8=function(e,t){return t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||E(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt16BE=function(e,t){t||E(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt32LE=function(e,t){return t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||E(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||E(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||E(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||E(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,a,r){(e=+e,t|=0,a|=0,r)||T(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,n=0;for(this[t]=255&e;++n<a&&(i*=256);)this[t+n]=e/i&255;return t+a},l.prototype.writeUIntBE=function(e,t,a,r){(e=+e,t|=0,a|=0,r)||T(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,n=1;for(this[t+i]=255&e;--i>=0&&(n*=256);)this[t+i]=e/n&255;return t+a},l.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,a,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*a-1);T(this,e,t,a,i-1,-i)}var n=0,s=1,o=0;for(this[t]=255&e;++n<a&&(s*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+a},l.prototype.writeIntBE=function(e,t,a,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*a-1);T(this,e,t,a,i-1,-i)}var n=a-1,s=1,o=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+a},l.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,a){return $(this,e,t,!0,a)},l.prototype.writeFloatBE=function(e,t,a){return $(this,e,t,!1,a)},l.prototype.writeDoubleLE=function(e,t,a){return I(this,e,t,!0,a)},l.prototype.writeDoubleBE=function(e,t,a){return I(this,e,t,!1,a)},l.prototype.copy=function(e,t,a,r){if(a||(a=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<a&&(r=a),r===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-a&&(r=e.length-t+a);var i,n=r-a;if(this===e&&a<t&&t<r)for(i=n-1;i>=0;--i)e[i+t]=this[i+a];else if(n<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i<n;++i)e[i+t]=this[i+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+n),t);return n},l.prototype.fill=function(e,t,a,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,a=this.length):"string"==typeof a&&(r=a,a=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var n;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(n=t;n<a;++n)this[n]=e;else{var s=l.isBuffer(e)?e:H(new l(e,r).toString()),o=s.length;for(n=0;n<a-t;++n)this[n+t]=s[n%o]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var a;t=t||1/0;for(var r=e.length,i=null,n=[],s=0;s<r;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&n.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&n.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&n.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320)}else i&&(t-=3)>-1&&n.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;n.push(a)}else if(a<2048){if((t-=2)<0)break;n.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;n.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;n.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return n}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,a,r){for(var i=0;i<r&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}}).call(this,a(7))},function(e,t,a){"use strict";var r=a(37),i=a(4),n=a(0),s=a(9),o=a(39);function l(e,t,a){var r=this._refs[a];if("string"==typeof r){if(!this._refs[r])return l.call(this,e,t,r);r=this._refs[r]}if((r=r||this._schemas[a])instanceof s)return h(r.schema,this._opts.inlineRefs)?r.schema:r.validate||this._compile(r);var i,n,o,u=d.call(this,t,a);return u&&(i=u.schema,t=u.root,o=u.baseId),i instanceof s?n=i.validate||e.call(this,i.schema,t,void 0,o):void 0!==i&&(n=h(i,this._opts.inlineRefs)?i:e.call(this,i,t,void 0,o)),n}function d(e,t){var a=r.parse(t),i=f(a),n=v(this._getId(e.schema));if(0===Object.keys(e.schema).length||i!==n){var o=k(i),l=this._refs[o];if("string"==typeof l)return u.call(this,e,l,a);if(l instanceof s)l.validate||this._compile(l),e=l;else{if(!((l=this._schemas[o])instanceof s))return;if(l.validate||this._compile(l),o==k(t))return{schema:l,root:e,baseId:n};e=l}if(!e.schema)return;n=v(this._getId(e.schema))}return m.call(this,a,n,e.schema,e)}function u(e,t,a){var r=d.call(this,e,t);if(r){var i=r.schema,n=r.baseId;e=r.root;var s=this._getId(i);return s&&(n=y(n,s)),m.call(this,a,n,i,e)}}e.exports=l,l.normalizeId=k,l.fullPath=v,l.url=y,l.ids=function(e){var t=k(this._getId(e)),a={"":t},s={"":v(t,!1)},l={},d=this;return o(e,{allKeys:!0},(function(e,t,o,u,p,m,c){if(""!==t){var h=d._getId(e),v=a[u],f=s[u]+"/"+p;if(void 0!==c&&(f+="/"+("number"==typeof c?c:n.escapeFragment(c))),"string"==typeof h){h=v=k(v?r.resolve(v,h):h);var g=d._refs[h];if("string"==typeof g&&(g=d._refs[g]),g&&g.schema){if(!i(e,g.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=k(f))if("#"==h[0]){if(l[h]&&!i(e,l[h]))throw new Error('id "'+h+'" resolves to more than one schema');l[h]=e}else d._refs[h]=f}a[t]=v,s[t]=f}})),l},l.inlineRef=h,l.schema=d;var p=n.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,t,a,r){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var i=e.fragment.split("/"),s=1;s<i.length;s++){var o=i[s];if(o){if(void 0===(a=a[o=n.unescapeFragment(o)]))break;var l;if(!p[o]&&((l=this._getId(a))&&(t=y(t,l)),a.$ref)){var u=y(t,a.$ref),m=d.call(this,r,u);m&&(a=m.schema,r=m.root,t=m.baseId)}}}return void 0!==a&&a!==r.schema?{schema:a,root:r,baseId:t}:void 0}}var c=n.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function h(e,t){return!1!==t&&(void 0===t||!0===t?function e(t){var a;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if("object"==typeof(a=t[r])&&!e(a))return!1}else for(var i in t){if("$ref"==i)return!1;if("object"==typeof(a=t[i])&&!e(a))return!1}return!0}(e):t?function e(t){var a,r=0;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if("object"==typeof(a=t[i])&&(r+=e(a)),r==1/0)return 1/0}else for(var n in t){if("$ref"==n)return 1/0;if(c[n])r++;else if("object"==typeof(a=t[n])&&(r+=e(a)+1),r==1/0)return 1/0}return r}(e)<=t:void 0)}function v(e,t){return!1!==t&&(e=k(e)),f(r.parse(e))}function f(e){return r.serialize(e).split("#")[0]+"#"}var g=/#\/?$/;function k(e){return e?e.replace(g,""):""}function y(e,t){return t=k(t),r.resolve(e,t)}},function(e,t,a){"use strict";e.exports=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var r,i,n;if(Array.isArray(t)){if((r=t.length)!=a.length)return!1;for(i=r;0!=i--;)if(!e(t[i],a[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((r=(n=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,n[i]))return!1;for(i=r;0!=i--;){var s=n[i];if(!e(t[s],a[s]))return!1}return!0}return t!=t&&a!=a}},function(e,t,a){"use strict";var r=a(3);function i(e,t,a){this.message=a||i.message(e,t),this.missingRef=r.url(e,t),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function n(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}e.exports={Validation:n((function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0})),MissingRef:n(i)},i.message=function(e,t){return"can't resolve reference "+t+" from id "+e}},function(e,t,a){"use strict";const r=a(8);let i;class n{constructor(e){this._capability=e}debug(...e){this._debug&&console.log("[dbg]",...e)}async validate({debug:e=!1}={}){this._debug=e,this.debug("Validating capability");const t=n.getJSONSchema(),a=new r({async:!0}).compile(t);if(!1===await a(this._capability))throw new Error(JSON.stringify(a.errors,!1,4)||"Invalid Capability");this.debug("Validated successfully")}static getJSONSchema(){return a(71)}static getCapabilities(){if(i)return i;const e=a(72);return i=e.reduce((e,t)=>(e[t]=a(73)(`./${t}.json`),e[t]=n._composeCapability(t,e[t]),e),{}),i}static getCapability(e){const t=n.getCapabilities()[e];if(!t)throw new Error("invalid_capability");return t}static hasCapability(e){return!!this.getCapabilities()[e]}static _composeCapability(e,t){return t.flow&&console.warn(`Warning: using \`capability.flow\` (${e}), expected a \`capability.$flow\``),t.$flow&&["triggers","conditions","actions"].forEach(a=>{const r=t.$flow[a];Array.isArray(r)&&r.forEach(a=>{Array.isArray(a.args)&&a.args.forEach(e=>{"dropdown"===e.type&&"$values"===e.values&&(e.values=t.values,e.meta=e.meta||{},e.meta.$values=!0)}),Array.isArray(a.tokens)&&a.tokens.forEach(a=>{"$id"===a.name&&(a.name=e),"$type"===a.type&&(a.type=t.type),"$title"===a.title&&(a.title=t.title)})})}),t}static isInstanceOfId(e,t){return t===e||e.startsWith(t+".")}static getBaseId(e){return e.split(".")[0]}}e.exports=n},function(e,t){var a;a=function(){return this}();try{a=a||new Function("return this")()}catch(e){"object"==typeof window&&(a=window)}e.exports=a},function(e,t,a){"use strict";var r=a(36),i=a(3),n=a(40),s=a(9),o=a(10),l=a(41),d=a(42),u=a(63),p=a(0);e.exports=g,g.prototype.validate=function(e,t){var a;if("string"==typeof e){if(!(a=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var r=this._addSchema(e);a=r.validate||this._compile(r)}var i=a(t);!0!==a.$async&&(this.errors=a.errors);return i},g.prototype.compile=function(e,t){var a=this._addSchema(e,void 0,t);return a.validate||this._compile(a)},g.prototype.addSchema=function(e,t,a,r){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.addSchema(e[n],void 0,a,r);return this}var s=this._getId(e);if(void 0!==s&&"string"!=typeof s)throw new Error("schema id must be string");return _(this,t=i.normalizeId(t||s)),this._schemas[t]=this._addSchema(e,a,r,!0),this},g.prototype.addMetaSchema=function(e,t,a){return this.addSchema(e,t,a,!0),this},g.prototype.validateSchema=function(e,t){var a=e.$schema;if(void 0!==a&&"string"!=typeof a)throw new Error("$schema must be a string");if(!(a=a||this._opts.defaultMeta||function(e){var t=e._opts.meta;return e._opts.defaultMeta="object"==typeof t?e._getId(t)||t:e.getSchema(h)?h:void 0,e._opts.defaultMeta}(this)))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var r=this.validate(a,e);if(!r&&t){var i="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(i);this.logger.error(i)}return r},g.prototype.getSchema=function(e){var t=k(this,e);switch(typeof t){case"object":return t.validate||this._compile(t);case"string":return this.getSchema(t);case"undefined":return function(e,t){var a=i.schema.call(e,{schema:{}},t);if(a){var n=a.schema,o=a.root,l=a.baseId,d=r.call(e,n,o,void 0,l);return e._fragments[t]=new s({ref:t,fragment:!0,schema:n,root:o,baseId:l,validate:d}),d}}(this,e)}},g.prototype.removeSchema=function(e){if(e instanceof RegExp)return y(this,this._schemas,e),y(this,this._refs,e),this;switch(typeof e){case"undefined":return y(this,this._schemas),y(this,this._refs),this._cache.clear(),this;case"string":var t=k(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var a=this._opts.serialize,r=a?a(e):e;this._cache.del(r);var n=this._getId(e);n&&(n=i.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this},g.prototype.addFormat=function(e,t){"string"==typeof t&&(t=new RegExp(t));return this._formats[e]=t,this},g.prototype.errorsText=function(e,t){if(!(e=e||this.errors))return"No errors";for(var a=void 0===(t=t||{}).separator?", ":t.separator,r=void 0===t.dataVar?"data":t.dataVar,i="",n=0;n<e.length;n++){var s=e[n];s&&(i+=r+s.dataPath+" "+s.message+a)}return i.slice(0,-a.length)},g.prototype._addSchema=function(e,t,a,r){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var n=this._opts.serialize,o=n?n(e):e,l=this._cache.get(o);if(l)return l;r=r||!1!==this._opts.addUsedSchema;var d=i.normalizeId(this._getId(e));d&&r&&_(this,d);var u,p=!1!==this._opts.validateSchema&&!t;p&&!(u=d&&d==i.normalizeId(e.$schema))&&this.validateSchema(e,!0);var m=i.ids.call(this,e),c=new s({id:d,schema:e,localRefs:m,cacheKey:o,meta:a});"#"!=d[0]&&r&&(this._refs[d]=c);this._cache.put(o,c),p&&u&&this.validateSchema(e,!0);return c},g.prototype._compile=function(e,t){if(e.compiling)return e.validate=n,n.schema=e.schema,n.errors=null,n.root=t||n,!0===e.schema.$async&&(n.$async=!0),n;var a,i;e.compiling=!0,e.meta&&(a=this._opts,this._opts=this._metaOpts);try{i=r.call(this,e.schema,t,e.localRefs)}catch(t){throw delete e.validate,t}finally{e.compiling=!1,e.meta&&(this._opts=a)}return e.validate=i,e.refs=i.refs,e.refVal=i.refVal,e.root=i.root,i;function n(){var t=e.validate,a=t.apply(this,arguments);return n.errors=t.errors,a}},g.prototype.compileAsync=a(64);var m=a(65);g.prototype.addKeyword=m.add,g.prototype.getKeyword=m.get,g.prototype.removeKeyword=m.remove,g.prototype.validateKeyword=m.validate;var c=a(5);g.ValidationError=c.Validation,g.MissingRefError=c.MissingRef,g.$dataMetaSchema=u;var h="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],f=["/properties"];function g(e){if(!(this instanceof g))return new g(e);e=this._opts=p.copy(e)||{},function(e){var t=e._opts.logger;if(!1===t)e.logger={log:P,warn:P,error:P};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=l(e.format),this._cache=e.cache||new n,this._loadingSchemas={},this._compilations=[],this.RULES=d(),this._getId=function(e){switch(e.schemaId){case"auto":return z;case"id":return b;default:return w}}(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=o),this._metaOpts=function(e){for(var t=p.copy(e._opts),a=0;a<v.length;a++)delete t[v[a]];return t}(this),e.formats&&function(e){for(var t in e._opts.formats){var a=e._opts.formats[t];e.addFormat(t,a)}}(this),e.keywords&&function(e){for(var t in e._opts.keywords){var a=e._opts.keywords[t];e.addKeyword(t,a)}}(this),function(e){var t;e._opts.$data&&(t=a(68),e.addMetaSchema(t,t.$id,!0));if(!1===e._opts.meta)return;var r=a(16);e._opts.$data&&(r=u(r,f));e.addMetaSchema(r,h,!0),e._refs["http://json-schema.org/schema"]=h}(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),function(e){var t=e._opts.schemas;if(!t)return;if(Array.isArray(t))e.addSchema(t);else for(var a in t)e.addSchema(t[a],a)}(this)}function k(e,t){return t=i.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function y(e,t,a){for(var r in t){var i=t[r];i.meta||a&&!a.test(r)||(e._cache.del(i.cacheKey),delete t[r])}}function b(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function w(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function z(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function _(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function P(){}},function(e,t,a){"use strict";var r=a(0);e.exports=function(e){r.copy(e,this)}},function(e,t,a){"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var a,r="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(a=t.cmp,function(e){return function(t,r){var i={key:t,value:e[t]},n={key:r,value:e[r]};return a(i,n)}}),n=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var a,s;if(Array.isArray(t)){for(s="[",a=0;a<t.length;a++)a&&(s+=","),s+=e(t[a])||"null";return s+"]"}if(null===t)return"null";if(-1!==n.indexOf(t)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var o=n.push(t)-1,l=Object.keys(t).sort(i&&i(t));for(s="",a=0;a<l.length;a++){var d=l[a],u=e(t[d]);u&&(s&&(s+=","),s+=JSON.stringify(d)+":"+u)}return n.splice(o,1),"{"+s+"}"}}(e)}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r="",i=!0===e.schema.$async,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),s=e.self._getId(e.schema);if(e.opts.strictKeywords){var o=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(o){var l="unknown keyword: "+o;if("log"!==e.opts.strictKeywords)throw new Error(l);e.logger.warn(l)}}if(e.isTop&&(r+=" var validate = ",i&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",s&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" /*# sourceURL="+s+" */ ")),"boolean"==typeof e.schema||!n&&!e.schema.$ref){var d=e.level,u=e.dataLevel,p=e.schema["false schema"],m=e.schemaPath+e.util.getProperty("false schema"),c=e.errSchemaPath+"/false schema",h=!e.opts.allErrors,v="data"+(u||""),f="valid"+d;if(!1===e.schema){e.isTop?h=!0:r+=" var "+f+" = false; ",(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";var g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?r+=i?" return data; ":" validate.errors = null; return true; ":r+=" var "+f+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var k=e.isTop;d=e.level=0,u=e.dataLevel=0,v="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[void 0],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{d=e.level,v="data"+((u=e.dataLevel)||"");if(s&&(e.baseId=e.resolve.url(e.baseId,s)),i&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+d+" = errors;"}f="valid"+d,h=!e.opts.allErrors;var b="",w="",z=e.schema.type,_=Array.isArray(z);if(z&&e.opts.nullable&&!0===e.schema.nullable&&(_?-1==z.indexOf("null")&&(z=z.concat("null")):"null"!=z&&(z=[z,"null"],_=!0)),_&&1==z.length&&(z=z[0],_=!1),e.schema.$ref&&n){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),z){if(e.opts.coerceTypes)var P=e.util.coerceToTypes(e.opts.coerceTypes,z);var S=e.RULES.types[z];if(P||_||!0===S||S&&!Y(S)){m=e.schemaPath+".type",c=e.errSchemaPath+"/type",m=e.schemaPath+".type",c=e.errSchemaPath+"/type";var A=_?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](z,v,e.opts.strictNumbers,!0)+") { ",P){var j="dataType"+d,C="coerced"+d;r+=" var "+j+" = typeof "+v+"; ","array"==e.opts.coerceTypes&&(r+=" if ("+j+" == 'object' && Array.isArray("+v+")) "+j+" = 'array'; "),r+=" var "+C+" = undefined; ";var O="",L=P;if(L)for(var E,T=-1,x=L.length-1;T<x;)E=L[T+=1],T&&(r+=" if ("+C+" === undefined) { ",O+="}"),"array"==e.opts.coerceTypes&&"array"!=E&&(r+=" if ("+j+" == 'array' && "+v+".length == 1) { "+C+" = "+v+" = "+v+"[0]; "+j+" = typeof "+v+"; } "),"string"==E?r+=" if ("+j+" == 'number' || "+j+" == 'boolean') "+C+" = '' + "+v+"; else if ("+v+" === null) "+C+" = ''; ":"number"==E||"integer"==E?(r+=" if ("+j+" == 'boolean' || "+v+" === null || ("+j+" == 'string' && "+v+" && "+v+" == +"+v+" ","integer"==E&&(r+=" && !("+v+" % 1)"),r+=")) "+C+" = +"+v+"; "):"boolean"==E?r+=" if ("+v+" === 'false' || "+v+" === 0 || "+v+" === null) "+C+" = false; else if ("+v+" === 'true' || "+v+" === 1) "+C+" = true; ":"null"==E?r+=" if ("+v+" === '' || "+v+" === 0 || "+v+" === false) "+C+" = null; ":"array"==e.opts.coerceTypes&&"array"==E&&(r+=" if ("+j+" == 'string' || "+j+" == 'number' || "+j+" == 'boolean' || "+v+" == null) "+C+" = ["+v+"]; ");r+=" "+O+" if ("+C+" === undefined) { ",(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ";var M=u?"data"+(u-1||""):"parentData";r+=" "+v+" = "+C+"; ",u||(r+="if ("+M+" !== undefined)"),r+=" "+M+"["+(u?e.dataPathArr[u]:"parentDataProperty")+"] = "+C+"; } "}else{(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!n)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",h&&(r+=" } if (errors === ",r+=k?"0":"errs_"+d,r+=") { ",w+="}");else{var D=e.RULES;if(D)for(var $=-1,I=D.length-1;$<I;)if(Y(S=D[$+=1])){if(S.type&&(r+=" if ("+e.util.checkDataType(S.type,v,e.opts.strictNumbers)+") { "),e.opts.useDefaults)if("object"==S.type&&e.schema.properties){p=e.schema.properties;var N=Object.keys(p);if(N)for(var V,H=-1,F=N.length-1;H<F;){if(void 0!==(B=p[V=N[H+=1]]).default){var R=v+e.util.getProperty(V);if(e.compositeRule){if(e.opts.strictDefaults){y="default is ignored for: "+R;if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}}else r+=" if ("+R+" === undefined ","empty"==e.opts.useDefaults&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ","shared"==e.opts.useDefaults?r+=" "+e.useDefault(B.default)+" ":r+=" "+JSON.stringify(B.default)+" ",r+="; "}}}else if("array"==S.type&&Array.isArray(e.schema.items)){var U=e.schema.items;if(U){T=-1;for(var B,q=U.length-1;T<q;)if(void 0!==(B=U[T+=1]).default){R=v+"["+T+"]";if(e.compositeRule){if(e.opts.strictDefaults){y="default is ignored for: "+R;if("log"!==e.opts.strictDefaults)throw new Error(y);e.logger.warn(y)}}else r+=" if ("+R+" === undefined ","empty"==e.opts.useDefaults&&(r+=" || "+R+" === null || "+R+" === '' "),r+=" ) "+R+" = ","shared"==e.opts.useDefaults?r+=" "+e.useDefault(B.default)+" ":r+=" "+JSON.stringify(B.default)+" ",r+="; "}}}var K=S.rules;if(K)for(var G,W=-1,J=K.length-1;W<J;)if(X(G=K[W+=1])){var Z=G.code(e,G.keyword,S.type);Z&&(r+=" "+Z+" ",h&&(b+="}"))}if(h&&(r+=" "+b+" ",b=""),S.type&&(r+=" } ",z&&z===S.type&&!P)){r+=" else { ";var Q;m=e.schemaPath+".type",c=e.errSchemaPath+"/type";(Q=Q||[]).push(r),r="",!1!==e.createErrors?(r+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",r+=_?""+z.join(","):""+z,r+="' } ",!1!==e.opts.messages&&(r+=" , message: 'should be ",r+=_?""+z.join(","):""+z,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+m+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),r+=" } "):r+=" {} ";g=r;r=Q.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}h&&(r+=" if (errors === ",r+=k?"0":"errs_"+d,r+=") { ",w+="}")}}function Y(e){for(var t=e.rules,a=0;a<t.length;a++)if(X(t[a]))return!0}function X(t){return void 0!==e.schema[t.keyword]||t.implements&&function(t){for(var a=t.implements,r=0;r<a.length;r++)if(void 0!==e.schema[a[r]])return!0}(t)}return h&&(r+=" "+w+" "),k?(i?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+f+" = errors === errs_"+d+";",r}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o;var c="maximum"==t,h=c?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[h],f=e.opts.$data&&v&&v.$data,g=c?"<":">",k=c?">":"<",y=void 0;if(!m&&"number"!=typeof o&&void 0!==o)throw new Error(t+" must be number");if(!f&&void 0!==v&&"number"!=typeof v&&"boolean"!=typeof v)throw new Error(h+" must be number or boolean");if(f){var b=e.util.getData(v.$data,s,e.dataPathArr),w="exclusive"+n,z="exclType"+n,_="exclIsNumber"+n,P="' + "+(j="op"+n)+" + '";i+=" var schemaExcl"+n+" = "+b+"; ",i+=" var "+w+"; var "+z+" = typeof "+(b="schemaExcl"+n)+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var S;y=h;(S=S||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(y||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(i+=" , message: '"+h+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var A=i;i=S.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+z+" == 'number' ? ( ("+w+" = "+r+" === undefined || "+b+" "+g+"= "+r+") ? "+p+" "+k+"= "+b+" : "+p+" "+k+" "+r+" ) : ( ("+w+" = "+b+" === true) ? "+p+" "+k+"= "+r+" : "+p+" "+k+" "+r+" ) || "+p+" !== "+p+") { var op"+n+" = "+w+" ? '"+g+"' : '"+g+"='; ",void 0===o&&(y=h,d=e.errSchemaPath+"/"+h,r=b,m=f)}else{P=g;if((_="number"==typeof v)&&m){var j="'"+P+"'";i+=" if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" ( "+r+" === undefined || "+v+" "+g+"= "+r+" ? "+p+" "+k+"= "+v+" : "+p+" "+k+" "+r+" ) || "+p+" !== "+p+") { "}else{_&&void 0===o?(w=!0,y=h,d=e.errSchemaPath+"/"+h,r=v,k+="="):(_&&(r=Math[c?"min":"max"](v,o)),v===(!_||r)?(w=!0,y=h,d=e.errSchemaPath+"/"+h,k+="="):(w=!1,P+="="));j="'"+P+"'";i+=" if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+p+" "+k+" "+r+" || "+p+" !== "+p+") { "}}y=y||t,(S=S||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(y||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { comparison: "+j+", limit: "+r+", exclusive: "+w+" } ",!1!==e.opts.messages&&(i+=" , message: 'should be "+P+" ",i+=m?"' + "+r:r+"'"),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";A=i;return i=S.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" "+p+".length "+("maxItems"==t?">":"<")+" "+r+") { ";var c=t,h=h||[];h.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(c||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==t?"more":"fewer",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var v=i;return i=h.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");var c="maxLength"==t?">":"<";i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),!1===e.opts.unicode?i+=" "+p+".length ":i+=" ucs2length("+p+") ",i+=" "+c+" "+r+") { ";var h=t,v=v||[];v.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==t?"longer":"shorter",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var f=i;return i=v.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e,t,a){"use strict";e.exports=function(e,t,a){var r,i=" ",n=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data;if(m?(i+=" var schema"+n+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",r="schema"+n):r=o,!m&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",m&&(i+=" ("+r+" !== undefined && typeof "+r+" != 'number') || "),i+=" Object.keys("+p+").length "+("maxProperties"==t?">":"<")+" "+r+") { ";var c=t,h=h||[];h.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(c||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+r+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==t?"more":"fewer",i+=" than ",i+=m?"' + "+r+" + '":""+o,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var v=i;return i=h.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i}},function(e){e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},function(e,t){var a,r,i=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(a===setTimeout)return setTimeout(e,0);if((a===n||!a)&&setTimeout)return a=setTimeout,setTimeout(e,0);try{return a(e,0)}catch(t){try{return a.call(null,e,0)}catch(t){return a.call(this,e,0)}}}!function(){try{a="function"==typeof setTimeout?setTimeout:n}catch(e){a=n}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l,d=[],u=!1,p=-1;function m(){u&&l&&(u=!1,l.length?d=l.concat(d):p=-1,d.length&&c())}function c(){if(!u){var e=o(m);u=!0;for(var t=d.length;t;){for(l=d,d=[];++p<t;)l&&l[p].run();p=-1,t=d.length}l=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];d.push(new h(e,t)),1!==d.length||u||o(c)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,a){"use strict";const r=a(6);let i;class n{static getClasses(){if(i)return i;const e=a(243);return i=e.reduce((e,t)=>(e[t]=a(244)(`./${t}.json`),e),{}),i}static getClass(e){const t=n.getClasses()[e];if(!t)throw new Error("invalid_class");return t}static getCapabilities(){return r.getCapabilities()}}e.exports=n},function(e,t,a){"use strict";const{validate:r,genericValidator:i,irValidator:n,rfValidator:s,rf433Validator:o,rf868Validator:l,modulationValidator:d,prontoValidator:u}=a(318);e.exports=class{constructor(e,{frequency:t}={}){this._signal=e,this._frequency=t,this._check=this._check.bind(this)}debug(...e){this._debug&&console.log("[dbg]",...e)}_check(e,t){if(!0!==t)throw new Error(e)}async validate({debug:e=!1}={}){if(this._debug=e,this.debug("Validating signal"),!this._signal)throw new Error("Invalid Signal");if("prontohex"===this._signal.type)this._validateProntohex();else{if(void 0!==this._signal.type)throw new Error("Invalid Signal type");this._validateRegular()}if("433"===this._frequency)this._validate433();else if("868"===this._frequency)this._validate868();else{if("ir"!==this._frequency)throw new Error("Invalid Frequency");this._validateInfrared()}this.debug("Validated successfully")}_validateWithEngine(e){return r(e,this._check,this._signal)}_validateProntohex(){this._check("mandatory_fields",this._signal.hasOwnProperty("cmds")),this._validateWithEngine(u)}_validateRegular(){this._check("mandatory_fields",this._signal.hasOwnProperty("sof")||this._signal.hasOwnProperty("eof")||this._signal.hasOwnProperty("words")),this._validateWithEngine(i),this._validateWithEngine(s)}_validate433(){this._validateWithEngine(d),this._validateWithEngine(o)}_validate868(){this._validateWithEngine(d),this._validateWithEngine(l)}_validateInfrared(){this._validateWithEngine(n)}}},function(e,t,a){"use strict";e.exports=class{static getCurrencies(){return a(319)}static getBatteries(){return["LS14250","C","AA","AAA","AAAA","A23","A27","PP3","CR123A","CR2","CR1632","CR2032","CR2430","CR2450","CR2477","CR3032","CR14250","INTERNAL","OTHER"]}}},function(e,t,a){(function(e){function a(e,t){for(var a=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),a++):a&&(e.splice(r,1),a--)}if(t)for(;a--;a)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var a=[],r=0;r<e.length;r++)t(e[r],r,e)&&a.push(e[r]);return a}t.resolve=function(){for(var t="",i=!1,n=arguments.length-1;n>=-1&&!i;n--){var s=n>=0?arguments[n]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=a(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var n=t.isAbsolute(e),s="/"===i(e,-1);return(e=a(r(e.split("/"),(function(e){return!!e})),!n).join("/"))||n||(e="."),e&&s&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,a){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var a=e.length-1;a>=0&&""===e[a];a--);return t>a?[]:e.slice(t,a-t+1)}e=t.resolve(e).substr(1),a=t.resolve(a).substr(1);for(var i=r(e.split("/")),n=r(a.split("/")),s=Math.min(i.length,n.length),o=s,l=0;l<s;l++)if(i[l]!==n[l]){o=l;break}var d=[];for(l=o;l<i.length;l++)d.push("..");return(d=d.concat(n.slice(o))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),a=47===t,r=-1,i=!0,n=e.length-1;n>=1;--n)if(47===(t=e.charCodeAt(n))){if(!i){r=n;break}}else i=!1;return-1===r?a?"/":".":a&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var a=function(e){"string"!=typeof e&&(e+="");var t,a=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){a=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(a,r)}(e);return t&&a.substr(-1*t.length)===t&&(a=a.substr(0,a.length-t.length)),a},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,a=0,r=-1,i=!0,n=0,s=e.length-1;s>=0;--s){var o=e.charCodeAt(s);if(47!==o)-1===r&&(i=!1,r=s+1),46===o?-1===t?t=s:1!==n&&(n=1):-1!==t&&(n=-1);else if(!i){a=s+1;break}}return-1===t||-1===r||0===n||1===n&&t===r-1&&t===a+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,a){return e.substr(t,a)}:function(e,t,a){return t<0&&(t=e.length+t),e.substr(t,a)}}).call(this,a(17))},function(e,t,a){"use strict";var r={bmp:a(322),cur:a(323),dds:a(324),gif:a(325),ico:a(23),jpg:a(326),png:a(327),psd:a(328),svg:a(329),tiff:a(330),webp:a(332)};e.exports=r},function(e,t,a){"use strict";function r(e,t){var a=e.readUInt8(t);return 0===a?256:a}function i(e,t){var a=6+16*t;return{width:r(e,a),height:r(e,a+1)}}e.exports={detect:function(e){return 0===e.readUInt16LE(0)&&1===e.readUInt16LE(2)},calculate:function(e){var t,a=e.readUInt16LE(4),r=i(e,0);if(1===a)return r;for(r.images=[{width:r.width,height:r.height}],t=1;t<a;t+=1)r.images.push(i(e,t));return r}}},function(e,t,a){"use strict";e.exports.App=a(25),e.exports.Device=a(18),e.exports.Capability=a(6),e.exports.Signal=a(19),e.exports.Media=a(336),e.exports.Energy=a(20),e.exports.getDeviceClasses=e.exports.Device.getClasses.bind(e.exports.Device),e.exports.getDeviceClass=e.exports.Device.getClass.bind(e.exports.Device),e.exports.getCapabilities=e.exports.Capability.getCapabilities.bind(e.exports.Capability),e.exports.getCapability=e.exports.Capability.getCapability.bind(e.exports.Capability),e.exports.hasCapability=e.exports.Capability.hasCapability.bind(e.exports.Capability),e.exports.getAppLocales=e.exports.App.getLocales.bind(e.exports.App),e.exports.getAppCategories=e.exports.App.getCategories.bind(e.exports.App),e.exports.getAppPermissions=e.exports.App.getPermissions.bind(e.exports.App),e.exports.getAppBrandColor=e.exports.App.getBrandColor.bind(e.exports.App),e.exports.getMediaCodecs=e.exports.Media.getCodecs.bind(e.exports.Media),e.exports.getCurrencies=e.exports.Energy.getCurrencies.bind(e.exports.Energy),e.exports.getBatteries=e.exports.Energy.getBatteries.bind(e.exports.Energy)},function(e,t,a){"use strict";(function(t,r){const{URLSearchParams:i}=a(29),n=a(1),s=a(8),o=a(69),l=a(70),d=a(18),u=a(6),p=a(19),m=a(20),{openAsync:c,closeAsync:h,readAsync:v,statAsync:f,readFileAsync:g,readDirAsync:k,lstatAsync:y,imageSizeAsync:b,join:w,extname:z,basename:_,dirname:P}=a(320),S=["debug","publish","verified"],A={".jpg":t.from([255,216]),".jpeg":t.from([255,216]),".png":t.from([137,80,78,71])},j={app:{small:{width:250,height:175},large:{width:500,height:350},xlarge:{width:1e3,height:700}},driver:{small:{width:75,height:75},large:{width:500,height:500},xlarge:{width:1e3,height:1e3}}},C=["measure_battery","alarm_battery"];class O{constructor(e){if(this._path=e,"string"!=typeof this._path)throw new Error("Invalid path")}debug(...e){this._debug&&console.log("[dbg]",...e)}async validate({level:e="debug",debug:t=!1}={}){if(this._debug=t,this.debug(`Validating "${this._path}"`),!S.includes(e))throw new Error("Invalid validation level. Allowed levels are: "+S);const a="publish"===e||"verified"===e,r="verified"===e;let i=await g(w(this._path,"app.json"));i=JSON.parse(i);const l=O.getJSONSchema(),c=new s({async:!0,allErrors:!0}).compile(l);if(!1===await c(i))throw new Error(this.constructor.errorsText(c.errors,i)||"Invalid app.json");if(!O.isValidId(i.id))throw new Error("Invalid id");if(!o.valid(i.version))throw new Error("Invalid version");if(o.coerce(i.version).toString()!==i.version)throw new Error(`Invalid version (${i.version}), pre-release versions are not allowed`);if(!o.validRange(i.compatibility))throw new Error("Invalid compatibility");if(!0===i.esm&&o.lt(o.coerce(i.compatibility),"12.0.1"))throw new Error("ESM apps require a compatibility of at least >=12.0.1");const h=async e=>{await n.promises.access(e).then(()=>{if(o.lt(o.coerce(i.compatibility),"12.0.1"))throw new Error(`ESM apps require a compatibility of at least >=12.0.1. (${e})`)}).catch(e=>{if("ENOENT"!==e.code)throw e})},v=w(this._path,"app.mjs"),f=w(this._path,"app.cjs"),k=w(this._path,"api.mjs"),y=w(this._path,"api.cjs");if(await h(v),await h(f),await h(k),await h(y),Array.isArray(i.drivers))for(const e of i.drivers){const t=w(this._path,"drivers",e.id,"driver.mjs"),a=w(this._path,"drivers",e.id,"driver.cjs"),r=w(this._path,"drivers",e.id,"device.mjs"),i=w(this._path,"drivers",e.id,"device.cjs");await h(t),await h(a),await h(r),await h(i)}if(null!=i.widgets){if(o.lt(o.coerce(i.compatibility),"12.1.0"))throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${this._path})`);for(const[e,t]of Object.entries(i.widgets)){const e=w(this._path,"widgets",t.id,"api.mjs"),a=w(this._path,"widgets",t.id,"api.cjs");await h(e),await h(a)}}if(3===i.sdk){const e=o.minVersion(i.compatibility);if(!o.gt(e,"4.2.0"))throw new Error(`Invalid compatibility (${i.compatibility}), SDK version 3 apps must have a compatibility of at least >=5.0.0`)}if((i.platforms||[]).includes("cloud")&&(i.platformLocalRequiredFeatures||[]).length>0)throw new Error("The property `platformLocalRequiredFeatures` can not be used in combination with platform: `cloud`.");if(!1===(i.platforms||[]).includes("local")&&(i.platformLocalRequiredFeatures||[]).length>0&&console.warn("Warning: using `platformLocalRequiredFeatures` requires `platforms: [local]`."),r){if(void 0===i.platforms)throw new Error("The property `platforms` is required in order to publish a verified app.");if(void 0===i.support)throw new Error("The property `support` is required in order to publish a verified app.")}if(Array.isArray(i.permissions)){const e=O.getPermissions();i.permissions.forEach(t=>{if("homey:app:com.athom.homeyscript"===t)throw new Error("Forbidden permission: "+t);if("homey:manager:api"===t&&a&&console.warn("Warning: using the homey:manager:api permission will require a more thorough review. It may take longer than usual to review your app."),"homey:manager:speech-input"===t){if(r)throw new Error(`Unsupported permission: ${t}, please remove any speech input related functionality.`);console.warn("Warning: the homey:manager:speech-input permission is not supported, please remove any speech input related functionality.")}if(!t.startsWith("homey:app:")&&void 0===e[t])throw new Error("Invalid permission: "+t)})}if(i.category){const e=O.getCategories();let t=[];t=Array.isArray(i.category)?i.category:[i.category],t.forEach(t=>{if(!e.includes(t))throw new Error("Invalid category: "+t)})}else if(a)throw new Error("The property `category` is required in order to publish an app.");if(Array.isArray(i.drivers)){const e=d.getClasses(),t=d.getCapabilities();for(let n=0;n<i.drivers.length;n++){const s=i.drivers[n];if(await this._ensureFileExistsCaseSensitive(w("drivers",s.id)),void 0===e[s.class])throw new Error(`drivers.${s.id} invalid driver class: ${s.class}`);if(e[s.class].minCompatibility&&o.lt(o.minVersion(i.compatibility),e[s.class].minCompatibility))throw new Error(`drivers.${s.id} driver class: ${s.class} is not available for compatibility ${i.compatibility}, requires minimum: ${e[s.class].minCompatibility}`);if(s.capabilities.forEach(e=>{const r=e.split(".")[0],n=void 0!==t[r],l=void 0!==i.capabilities&&void 0!==i.capabilities[r];if(!n&&!l)throw new Error(`drivers.${s.id} invalid capability: ${e}`);if(n&&!l&&t[r].minCompatibility&&o.lt(o.minVersion(i.compatibility),t[r].minCompatibility))throw new Error(`drivers.${s.id} capability: ${r} is not available for compatibility ${i.compatibility}, requires minimum: ${t[r].minCompatibility}`);if(C.includes(r)&&(!s.energy||!Array.isArray(s.energy.batteries))&&a)throw new Error(`drivers.${s.id} is missing an array 'energy.batteries' because the capability ${r} is being used.`)}),Array.isArray(s.pair))for(let e=0;e<s.pair.length;e++){const t=s.pair[e];if(void 0!==t.navigation){const e=t.navigation.prev;if(e){if(!s.pair.find(t=>t.id===e))throw new Error(`drivers.${s.id} invalid navigation.prev: ${e}`)}const a=t.navigation.next;if(a){if(!s.pair.find(e=>e.id===a))throw new Error(`drivers.${s.id} invalid navigation.next: ${a}`)}}void 0===t.template&&await this._ensureFileExistsCaseSensitive(w("drivers",s.id,"pair",t.id+".html"))}const l=new Set;if(s.zwave&&Array.isArray(s.settings))for(let e=0;e<s.settings.length;e++){const t=s.settings[e];if(t.type&&"group"===t.type&&t.children&&Array.isArray(t.children))for(let e=0;e<t.children.length;e++){const a=t.children[e];a&&a.zwave&&(l.has(a.zwave.index)?console.warn(`drivers.${s.id}: duplicate zwave setting index ${a.zwave.index}`):l.add(a.zwave.index),this._checkZwaveForSetting(s,a))}else t.zwave&&(l.has(t.zwave.index)?console.warn(`drivers.${s.id}: duplicate zwave setting index ${t.zwave.index}`):l.add(t.zwave.index),this._checkZwaveForSetting(s,t))}if(a){if(!s.images)throw new Error(`drivers.${s.id}: property \`images\` is required in order to publish an app.`);await this._validateImages(s.images,"driver","drivers."+s.id)}if(r){if(void 0===s.platforms)throw new Error(`drivers.${s.id}: property \`platforms\` is required in order to publish a verified app.`);if(void 0===s.connectivity)throw new Error(`drivers.${s.id}: property \`connectivity\` is required in order to publish a verified app.`)}if(!s.platforms&&i.platforms&&i.platforms.includes("cloud")&&console.warn(`Warning: drivers.${s.id} doesn't have a 'platforms' property. The default is ["local"].`),s.platforms&&i.platforms){if(s.platforms.includes("local")&&!1===i.platforms.includes("local"))throw new Error(`drivers.${s.id} invalid 'platforms': App manifest does not list 'local' as a supported platform.`);if(s.platforms.includes("cloud")&&!1===i.platforms.includes("cloud"))throw new Error(`drivers.${s.id} invalid 'platforms': App manifest does not list 'cloud' as a supported platform.`)}if(s.connectivity&&(s.connectivity.includes("lan")||s.connectivity.includes("rf868")||s.connectivity.includes("matter"))&&s.platforms&&s.platforms.includes("cloud"))throw new Error(`drivers.${s.id} invalid 'connectivity': Platform 'cloud' does not support 'lan', 'matter' or 'rf868'.`);if(!("string"!=typeof s.discovery||i.discovery&&i.discovery[s.discovery]))throw new Error(`drivers.${s.id} invalid 'discovery': ${s.discovery}`);if("object"==typeof s.energy&&Array.isArray(s.energy.batteries)){const e=m.getBatteries();s.energy.batteries.forEach(t=>{if(!e.includes(t))throw new Error(`drivers.${s.id} invalid 'battery': ${t}. Allowed values: ${e.join(", ")}`)})}if(s.connectivity&&s.connectivity.includes("matter")){if(!s.matter)throw new Error(`drivers.${s.id} has 'connectivity': 'matter' and therefore requires a 'matter' object.`);if(s.pair)throw new Error(`drivers.${s.id} invalid 'pair' configuration, Matter drivers do not support custom pairing views.`);if(void 0===s.matter.deviceVendorId&&void 0!==s.matter.deviceProductName||void 0!==s.matter.deviceVendorId&&void 0===s.matter.deviceProductName)throw new Error(`drivers.${s.id} invalid 'matter': 'deviceVendorId' and 'deviceProductName' must be defined together.`);const e=await this._fileExistsCaseSensitive(w("drivers",s.id,"device.js")),t=await this._fileExistsCaseSensitive(w("drivers",s.id,"device.mjs"));if(e||t)throw new Error(`drivers.${s.id}: using a device.${e?"js":"mjs"} file is not supported for Matter drivers.`);const a=await this._fileExistsCaseSensitive(w("drivers",s.id,"driver.js")),r=await this._fileExistsCaseSensitive(w("drivers",s.id,"driver.mjs"));if(a||r)throw new Error(`drivers.${s.id}: using a driver.${a?"js":"mjs"} file is not supported for Matter drivers.`)}if(s.matter&&(!s.connectivity||!s.connectivity.includes("matter")))throw new Error(`drivers.${s.id} Matter drivers require 'connectivity' to include 'matter'.`)}const n=i.drivers.every(e=>e.connectivity&&e.connectivity.includes("matter")),s=i.platformLocalRequiredFeatures&&i.platformLocalRequiredFeatures.includes("matter");n&&!s&&console.warn("Warning: all drivers have connectivity: matter, but matter is not set as a platform required feature."),!n&&s&&console.warn("Warning: matter is set as a platform required feature, but not all drivers have connectivity: matter.")}if(void 0!==i.capabilities)for(const e of Object.keys(i.capabilities)){if(e.includes("."))throw new Error(`Invalid capability: ${e}\nCharacter '.' is reserved for subcapabilities.`);const t=i.capabilities[e],a=new u(t);try{await a.validate()}catch(t){throw new Error(`Invalid capability: ${e}\n${t.message}`)}t.icon&&await this._ensureFileExistsCaseSensitive(t.icon)}if(void 0!==i.signals)for(const e of Object.keys(i.signals))for(const t of Object.keys(i.signals[e])){const a=new p(i.signals[e][t],{frequency:e});try{await a.validate()}catch(a){throw new Error(`Invalid signal: ${e}.${t}\n${a.message}`)}}if(i.flow)for(const e of Object.keys(i.flow)){const t=i.flow[e];if(Array.isArray(t))for(let n=0;n<t.length;n++){const s=t[n];if(t.findIndex(e=>e.id===s.id)!==n){if(i.sdk>=3)throw new Error(`Found multiple Flow card ${e} with the id "${s.id}", all Flow cards should have a unique id.`);console.warn(`Warning: Found multiple Flow card ${e} with the id "${s.id}", all Flow cards should have a unique id.`)}this._validateFlowCard(s,`flow.${e}['${s.id}']`,i,{levelPublish:a,levelVerified:r})}}if(i.discovery)for(const e of Object.keys(i.discovery)){const t=i.discovery[e],{type:a}=t;if(!t[a])throw new Error(`Missing discovery.${e}.${a}`)}if(await this._fileExistsCaseSensitive("locales")){const e=O.getLocales(),t=await this._getDirectoryContents("locales");for(let a=0;a<t.length;a++){const r=t[a];if(".json"!==z(r))continue;const i=_(r,".json");if(!e.includes(i))throw new Error(`Invalid locale: /locales/${i}.json\nAllowed locales are: ${e}`);try{const e=await g(r,"utf8");JSON.parse(e)}catch(e){throw new Error(`Malformed locale: /locales/${i}.json\n${e.message}`)}}}if(i.sdk&&1!==i.sdk||await this._ensureFileExistsCaseSensitive("app.js"),await this._fileExistsCaseSensitive("env.json")){let e;try{e=await g(w(this._path,"env.json"),"utf8"),e=JSON.parse(e)}catch(e){throw new Error("Malformed file: /env.json\n"+e.message)}if(e)for(const t of Object.keys(e)){if(t.toUpperCase()!==t)throw new Error("Invalid /env.json key, must be uppercase: "+t);const a=e[t];if("string"!=typeof a)throw new Error("Invalid /env.json value, must be of type string: "+a)}}if(await this._ensureFileExistsCaseSensitive(w("assets","icon.svg")),await this._fileExistsCaseSensitive("settings")&&await this._ensureFileExistsCaseSensitive(w("settings","index.html")),a){if(!i.images)throw new Error("The property `images` is required in order to publish an app.");await this._validateImages(i.images,"app"),await this._validateModules()}if(i.brandColor){if(!this.constructor.isValidBrandColor(i.brandColor))throw new Error("The color defined in `brandColor` is too bright. Icons are rendered white, so choose a darker color that has enough contrast.")}else if(a)throw new Error("The property `brandColor` is required in order to publish an app.");this.debug("Validated successfully")}_checkZwaveForSetting(e,t){if(e&&t&&t.zwave){if("number"!=typeof t.zwave.index||"number"!=typeof t.zwave.size)throw new Error(`Missing property in "zwave" at ${e.id}, ${t.id}`);if(t.attr&&"number"==typeof t.attr.max||"number"==typeof t.max){const{size:a}=t.zwave;let r="number"==typeof t.attr.max?t.attr.max:t.max;const i="number"==typeof t.attr.step?t.attr.step:1;i>1&&(r/=i);const n="boolean"!=typeof t.zwave.signed||t.zwave.signed,s=Math.pow(2,8*a)/2-1,o=Math.pow(2,8*a)-1;if(n&&r>s)throw new Error(`Value cannot be signed: ${e.id}, ${t.id}. Max value: ${s}, actual value: ${r}`);if(!n&&r>o)throw new Error(`Max value out of bounds: ${e.id}, ${t.id}. Max value: ${o}, actual value: ${r}`)}}}async _getDirectoryContents(e){return await this._fileExistsCaseSensitive(e),e=w(this._path,e),k(e).then(t=>t.map(t=>w(e,t)))}async _ensureFileExistsCaseSensitive(e){if(!0!==await this._fileExistsCaseSensitive(e))throw new Error("Filepath does not exist: "+e)}async _fileExistsCaseSensitive(e){e=w(this._path,e);const t=P(e);try{if(!(await f(t)).isDirectory())return!1;return(await k(t)).indexOf(_(e))>-1}catch(e){return!1}}async _validateImages(e,t,a){const r=["small","large"];for(let i=0;i<r.length;i++){const n=r[i],s=e[n],o=z(s);if(void 0===A[o])throw new Error(`Invalid image extension (${o})${a?` ${a}.${n}`:""}: ${w(this._path,s)}`);await this._ensureFileExistsCaseSensitive(s);const l=A[o];if(!(await this._readBytes(s,l.length)).equals(l))throw new Error(`Invalid image${a?` ${a}.${n}`:""}: ${w(this._path,s)}`);const d=j[t][n],u=await b(w(this._path,s));if(u.width!==d.width||u.height!==d.height)throw new Error(`Invalid image size (${u.width}x${u.height})${a?` ${a}.${n}`:""}: ${w(this._path,s)}\nRequired: ${d.width}x${d.height}`)}}async _validateModules(){const e=w(this._path,"node_modules");try{await f(e)}catch(e){return}for(const t of await k(e)){let a;try{a=await y(w(e,t))}catch(e){throw Error(`Invalid module '${t}' in 'node_modules': ${e.message}`)}if(a.isSymbolicLink())throw Error(`Invalid module '${t}' in 'node_modules': is a symbolic link`)}}_validateFlowCard(e,t,a,{levelPublish:r,levelVerified:n}){if(Array.isArray(e.tokens))for(const a of e.tokens)"string"!=typeof a.type&&console.warn(`Warning: ${t}.tokens['${a.name}'].type is missing, it defaults to "string". Specifying a token type will be required in the future.`);if(!1===Array.isArray(e.args))return;const s=e.args.find(e=>{const t=new i(e.filter);return"device"===e.type&&(t.has("driver_id")||t.has("driverId"))}),o=e.args.filter(e=>e!==s);if(0!==o.length){if(n)for(const e of o)if(void 0===e.title)throw new Error(`${t}.args['${e.name}'].title is required for arguments in order to publish a verified app.`);if(e.droptoken&&o.push({name:"droptoken"}),void 0===e.titleFormatted){if(n)throw new Error(t+".titleFormatted is required in order to publish a verified app.");console.warn(`Warning: ${t}.titleFormatted is missing. Specifying a Flow card's formatted title will be required in the future.`)}if("string"!=typeof e.titleFormatted){if("object"==typeof e.titleFormatted&&null!==e.titleFormatted)for(const[a,r]of Object.entries(e.titleFormatted))O._checkTitleFormatted(r,o,`${t}.titleFormatted.${a}`);if(e.platforms&&a.platforms){if(e.platforms.includes("local")&&!1===a.platforms.includes("local"))throw new Error(t+" invalid 'platforms': App manifest does not list 'local' as a supported platform.");if(e.platforms.includes("cloud")&&!1===a.platforms.includes("cloud"))throw new Error(t+" invalid 'platforms': App manifest does not list 'cloud' as a supported platform.")}}else O._checkTitleFormatted(e.titleFormatted,o,t+".titleFormatted")}}static _checkTitleFormatted(e,t,a){const r=t.reduce((e,t)=>(e[t.name]=!1,e),{}),i=e.match(/\[\[(.*?)\]\]/gm);if(null===i)throw Error("Missing all args in "+a);i.forEach(e=>{const t=e.substring(2,e.length-2);if(void 0===r[t])throw Error(`Invalid [[${t}]] in ${a}.titleFormatted`);if(!0===r[t])throw Error(`Duplicate [[${t}]] in ${a}.titleFormatted`);!1===r[t]&&(r[t]=!0)});for(const[e,t]of Object.entries(r))if(!1===t)throw Error(`Missing [[${e}]] in ${a}`)}async _readBytes(e,a){e=w(this._path,e);const r=await c(e,"r"),i=t.alloc(a);return await v(r,i,0,a,0),await h(r),i}static isValidId(e){return"string"==typeof e&&(!(e.length<1)&&(!(e.split(".").length<2)&&!!/^[a-zA-Z0-9_.-]*$/g.test(e)))}static isValidBrandColor(e){return l(e).getBrightness()<=184}static getJSONSchema(){const e=a(334);return JSON.parse(JSON.stringify(e))}static getPermissions(){const e=a(335);if("function"==typeof w)for(const t of Object.keys(e)){e[t].icon=w(r,"..","..","assets","app","permissions",t.replace(/:/g,"-")+".svg")}return e}static getCategories(){return["lights","video","music","appliances","security","climate","tools","internet","localization","energy"]}static getLocales(){return["ab","aa","af","ak","sq","am","ar","an","hy","as","av","ae","ay","az","bm","ba","eu","be","bn","bh","bi","bs","br","bg","my","ca","ch","ce","ny","zh","cv","kw","co","cr","hr","cs","da","dv","nl","dz","en","eo","et","ee","fo","fj","fi","fr","ff","gl","ka","de","el","gn","gu","ht","ha","he","hz","hi","ho","hu","ia","id","ie","ga","ig","ik","io","is","it","iu","ja","jv","kl","kn","kr","ks","kk","km","ki","rw","ky","kv","kg","ko","ku","kj","la","lb","lg","li","ln","lo","lt","lu","lv","gv","mk","mg","ms","ml","mt","mi","mr","mh","mn","na","nv","nd","ne","ng","nb","nn","no","ii","nr","oc","oj","cu","om","or","os","pa","pi","fa","pl","ps","pt","qu","rm","rn","ro","ru","sa","sc","sd","se","sm","sg","sr","gd","sn","si","sk","sl","so","st","es","su","sw","ss","sv","ta","te","tg","th","ti","bo","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","cy","wo","fy","xh","yi","yo","za","zu"]}static getBrandColor(e){const a=t.from(e).toString("hex");let r,i=0;do{const e=`${a}${++i}`;let t=l("#"+e.substring(e.length-6));t=l({h:t.toHsv().h,s:.75,l:.5});const n=t.toHexString();this.isValidBrandColor(n)&&(r=n)}while(!r);return r}static errorsText(e,t){return!1===Array.isArray(e)?null:e.reduce((e,a)=>{let r="";const i=new RegExp("drivers\\[(\\d+)\\]"),n=a.dataPath.match(i);if(n){const e=parseInt(n[1],10),r=t.drivers[e];r&&(a.dataPath=a.dataPath.replace(`drivers[${e}]`,`drivers['${r.id}']`))}switch(["triggers","conditions","actions"].forEach(e=>{const r=new RegExp(`flow.${e}\\[(\\d+)\\]`),i=a.dataPath.match(r);if(i){const r=parseInt(i[1],10),n=t.flow[e][r];if(n){a.dataPath=a.dataPath.replace(`flow.${e}[${r}]`,`flow.${e}['${n.id}']`);const t=new RegExp(".args\\[(\\d+)\\]"),i=a.dataPath.match(t);if(i){const e=parseInt(i[1],10),t=n.args[e];t&&(a.dataPath=a.dataPath.replace(`.args[${e}]`,`.args['${t.name}']`))}}}}),a.keyword){case"oneOf":return`${e}manifest${a.dataPath} matched no available schemas, see previous errors\n`;case"enum":r=JSON.stringify(a.params.allowedValues)}return`${e}manifest${a.dataPath} ${a.message} ${r}\n`},"").slice(0,-1)}}e.exports=O}).call(this,a(2).Buffer,"/")},function(e,t,a){"use strict";t.byteLength=function(e){var t=d(e),a=t[0],r=t[1];return 3*(a+r)/4-r},t.toByteArray=function(e){var t,a,r=d(e),s=r[0],o=r[1],l=new n(function(e,t,a){return 3*(t+a)/4-a}(0,s,o)),u=0,p=o>0?s-4:s;for(a=0;a<p;a+=4)t=i[e.charCodeAt(a)]<<18|i[e.charCodeAt(a+1)]<<12|i[e.charCodeAt(a+2)]<<6|i[e.charCodeAt(a+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===o&&(t=i[e.charCodeAt(a)]<<2|i[e.charCodeAt(a+1)]>>4,l[u++]=255&t);1===o&&(t=i[e.charCodeAt(a)]<<10|i[e.charCodeAt(a+1)]<<4|i[e.charCodeAt(a+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,a=e.length,i=a%3,n=[],s=0,o=a-i;s<o;s+=16383)n.push(u(e,s,s+16383>o?o:s+16383));1===i?(t=e[a-1],n.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[a-2]<<8)+e[a-1],n.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return n.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=s.length;o<l;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.indexOf("=");return-1===a&&(a=t),[a,a===t?0:4-a%4]}function u(e,t,a){for(var i,n,s=[],o=t;o<a;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(r[(n=i)>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
9
9
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
10
  t.read=function(e,t,a,r,i){var n,s,o=8*i-r-1,l=(1<<o)-1,d=l>>1,u=-7,p=a?i-1:0,m=a?-1:1,c=e[t+p];for(p+=m,n=c&(1<<-u)-1,c>>=-u,u+=o;u>0;n=256*n+e[t+p],p+=m,u-=8);for(s=n&(1<<-u)-1,n>>=-u,u+=r;u>0;s=256*s+e[t+p],p+=m,u-=8);if(0===n)n=1-d;else{if(n===l)return s?NaN:1/0*(c?-1:1);s+=Math.pow(2,r),n-=d}return(c?-1:1)*s*Math.pow(2,n-r)},t.write=function(e,t,a,r,i,n){var s,o,l,d=8*n-i-1,u=(1<<d)-1,p=u>>1,m=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,c=r?0:n-1,h=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+p>=1?m/l:m*Math.pow(2,1-p))*l>=2&&(s++,l/=2),s+p>=u?(o=0,s=u):s+p>=1?(o=(t*l-1)*Math.pow(2,i),s+=p):(o=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[a+c]=255&o,c+=h,o/=256,i-=8);for(s=s<<i|o,d+=i;d>0;e[a+c]=255&s,c+=h,s/=256,d-=8);e[a+c-h]|=128*v}},function(e,t){var a={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==a.call(e)}},function(e,t,a){"use strict";var r=a(30),i=a(32);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=y,t.resolve=function(e,t){return y(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=y(e));return e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(d),p=["%","/","?",";","#"].concat(u),m=["/","?","#"],c=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},f={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=a(33);function y(e,t,a){if(e&&i.isObject(e)&&e instanceof n)return e;var r=new n;return r.parse(e,t,a),r}n.prototype.parse=function(e,t,a){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",d=e.split(o);d[0]=d[0].replace(/\\/g,"/");var y=e=d.join(o);if(y=y.trim(),!a&&1===e.split("#").length){var b=l.exec(y);if(b)return this.path=y,this.href=y,this.pathname=b[1],b[2]?(this.search=b[2],this.query=t?k.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=s.exec(y);if(w){var z=(w=w[0]).toLowerCase();this.protocol=z,y=y.substr(w.length)}if(a||w||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===y.substr(0,2);!_||w&&f[w]||(y=y.substr(2),this.slashes=!0)}if(!f[w]&&(_||w&&!g[w])){for(var P,S,A=-1,j=0;j<m.length;j++){-1!==(C=y.indexOf(m[j]))&&(-1===A||C<A)&&(A=C)}-1!==(S=-1===A?y.lastIndexOf("@"):y.lastIndexOf("@",A))&&(P=y.slice(0,S),y=y.slice(S+1),this.auth=decodeURIComponent(P)),A=-1;for(j=0;j<p.length;j++){var C;-1!==(C=y.indexOf(p[j]))&&(-1===A||C<A)&&(A=C)}-1===A&&(A=y.length),this.host=y.slice(0,A),y=y.slice(A),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var L=this.hostname.split(/\./),E=(j=0,L.length);j<E;j++){var T=L[j];if(T&&!T.match(c)){for(var x="",M=0,D=T.length;M<D;M++)T.charCodeAt(M)>127?x+="x":x+=T[M];if(!x.match(c)){var $=L.slice(0,j),I=L.slice(j+1),N=T.match(h);N&&($.push(N[1]),I.unshift(N[2])),I.length&&(y="/"+I.join(".")+y),this.hostname=$.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var V=this.port?":"+this.port:"",H=this.hostname||"";this.host=H+V,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!v[z])for(j=0,E=u.length;j<E;j++){var F=u[j];if(-1!==y.indexOf(F)){var R=encodeURIComponent(F);R===F&&(R=escape(F)),y=y.split(F).join(R)}}var U=y.indexOf("#");-1!==U&&(this.hash=y.substr(U),y=y.slice(0,U));var B=y.indexOf("?");if(-1!==B?(this.search=y.substr(B),this.query=y.substr(B+1),t&&(this.query=k.parse(this.query)),y=y.slice(0,B)):t&&(this.search="",this.query={}),y&&(this.pathname=y),g[z]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){V=this.pathname||"";var q=this.search||"";this.path=V+q}return this.href=this.format(),this},n.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",a=this.pathname||"",r=this.hash||"",n=!1,s="";this.host?n=e+this.host:this.hostname&&(n=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=k.stringify(this.query));var o=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==n?(n="//"+(n||""),a&&"/"!==a.charAt(0)&&(a="/"+a)):n||(n=""),r&&"#"!==r.charAt(0)&&(r="#"+r),o&&"?"!==o.charAt(0)&&(o="?"+o),t+n+(a=a.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(o=o.replace("#","%23"))+r},n.prototype.resolve=function(e){return this.resolveObject(y(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if(i.isString(e)){var t=new n;t.parse(e,!1,!0),e=t}for(var a=new n,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];a[o]=this[o]}if(a.hash=e.hash,""===e.href)return a.href=a.format(),a;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),d=0;d<l.length;d++){var u=l[d];"protocol"!==u&&(a[u]=e[u])}return g[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=a.format(),a}if(e.protocol&&e.protocol!==a.protocol){if(!g[e.protocol]){for(var p=Object.keys(e),m=0;m<p.length;m++){var c=p[m];a[c]=e[c]}return a.href=a.format(),a}if(a.protocol=e.protocol,e.host||f[e.protocol])a.pathname=e.pathname;else{for(var h=(e.pathname||"").split("/");h.length&&!(e.host=h.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),a.pathname=h.join("/")}if(a.search=e.search,a.query=e.query,a.host=e.host||"",a.auth=e.auth,a.hostname=e.hostname||e.host,a.port=e.port,a.pathname||a.search){var v=a.pathname||"",k=a.search||"";a.path=v+k}return a.slashes=a.slashes||e.slashes,a.href=a.format(),a}var y=a.pathname&&"/"===a.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=b||y||a.host&&e.pathname,z=w,_=a.pathname&&a.pathname.split("/")||[],P=(h=e.pathname&&e.pathname.split("/")||[],a.protocol&&!g[a.protocol]);if(P&&(a.hostname="",a.port=null,a.host&&(""===_[0]?_[0]=a.host:_.unshift(a.host)),a.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===h[0]?h[0]=e.host:h.unshift(e.host)),e.host=null),w=w&&(""===h[0]||""===_[0])),b)a.host=e.host||""===e.host?e.host:a.host,a.hostname=e.hostname||""===e.hostname?e.hostname:a.hostname,a.search=e.search,a.query=e.query,_=h;else if(h.length)_||(_=[]),_.pop(),_=_.concat(h),a.search=e.search,a.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(P)a.hostname=a.host=_.shift(),(O=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=O.shift(),a.host=a.hostname=O.shift());return a.search=e.search,a.query=e.query,i.isNull(a.pathname)&&i.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a}if(!_.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(var S=_.slice(-1)[0],A=(a.host||e.host||_.length>1)&&("."===S||".."===S)||""===S,j=0,C=_.length;C>=0;C--)"."===(S=_[C])?_.splice(C,1):".."===S?(_.splice(C,1),j++):j&&(_.splice(C,1),j--);if(!w&&!z)for(;j--;j)_.unshift("..");!w||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),A&&"/"!==_.join("/").substr(-1)&&_.push("");var O,L=""===_[0]||_[0]&&"/"===_[0].charAt(0);P&&(a.hostname=a.host=L?"":_.length?_.shift():"",(O=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=O.shift(),a.host=a.hostname=O.shift()));return(w=w||a.host&&_.length)&&!L&&_.unshift(""),_.length?a.pathname=_.join("/"):(a.pathname=null,a.path=null),i.isNull(a.pathname)&&i.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=e.auth||a.auth,a.slashes=a.slashes||e.slashes,a.href=a.format(),a},n.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,a){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(n){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var o,l=2147483647,d=/^xn--/,u=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,h=String.fromCharCode;function v(e){throw new RangeError(m[e])}function f(e,t){for(var a=e.length,r=[];a--;)r[a]=t(e[a]);return r}function g(e,t){var a=e.split("@"),r="";return a.length>1&&(r=a[0]+"@",e=a[1]),r+f((e=e.replace(p,".")).split("."),t).join(".")}function k(e){for(var t,a,r=[],i=0,n=e.length;i<n;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<n?56320==(64512&(a=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&a)+65536):(r.push(t),i--):r.push(t);return r}function y(e){return f(e,(function(e){var t="";return e>65535&&(t+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=h(e)})).join("")}function b(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,a){var r=0;for(e=a?c(e/700):e>>1,e+=c(e/t);e>455;r+=36)e=c(e/35);return c(r+36*e/(e+38))}function z(e){var t,a,r,i,n,s,o,d,u,p,m,h=[],f=e.length,g=0,k=128,b=72;for((a=e.lastIndexOf("-"))<0&&(a=0),r=0;r<a;++r)e.charCodeAt(r)>=128&&v("not-basic"),h.push(e.charCodeAt(r));for(i=a>0?a+1:0;i<f;){for(n=g,s=1,o=36;i>=f&&v("invalid-input"),((d=(m=e.charCodeAt(i++))-48<10?m-22:m-65<26?m-65:m-97<26?m-97:36)>=36||d>c((l-g)/s))&&v("overflow"),g+=d*s,!(d<(u=o<=b?1:o>=b+26?26:o-b));o+=36)s>c(l/(p=36-u))&&v("overflow"),s*=p;b=w(g-n,t=h.length+1,0==n),c(g/t)>l-k&&v("overflow"),k+=c(g/t),g%=t,h.splice(g++,0,k)}return y(h)}function _(e){var t,a,r,i,n,s,o,d,u,p,m,f,g,y,z,_=[];for(f=(e=k(e)).length,t=128,a=0,n=72,s=0;s<f;++s)(m=e[s])<128&&_.push(h(m));for(r=i=_.length,i&&_.push("-");r<f;){for(o=l,s=0;s<f;++s)(m=e[s])>=t&&m<o&&(o=m);for(o-t>c((l-a)/(g=r+1))&&v("overflow"),a+=(o-t)*g,t=o,s=0;s<f;++s)if((m=e[s])<t&&++a>l&&v("overflow"),m==t){for(d=a,u=36;!(d<(p=u<=n?1:u>=n+26?26:u-n));u+=36)z=d-p,y=36-p,_.push(h(b(p+z%y,0))),d=c(z/y);_.push(h(b(d,0))),n=w(a,g,r==i),a=0,++r}++a,++t}return _.join("")}o={version:"1.4.1",ucs2:{decode:k,encode:y},decode:z,encode:_,toASCII:function(e){return g(e,(function(e){return u.test(e)?"xn--"+_(e):e}))},toUnicode:function(e){return g(e,(function(e){return d.test(e)?z(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return o}.call(t,a,t,e))||(e.exports=i)}()}).call(this,a(31)(e),a(7))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,a){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,a){"use strict";t.decode=t.parse=a(34),t.encode=t.stringify=a(35)},function(e,t,a){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,a,n){t=t||"&",a=a||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var l=1e3;n&&"number"==typeof n.maxKeys&&(l=n.maxKeys);var d=e.length;l>0&&d>l&&(d=l);for(var u=0;u<d;++u){var p,m,c,h,v=e[u].replace(o,"%20"),f=v.indexOf(a);f>=0?(p=v.substr(0,f),m=v.substr(f+1)):(p=v,m=""),c=decodeURIComponent(p),h=decodeURIComponent(m),r(s,c)?i(s[c])?s[c].push(h):s[c]=[s[c],h]:s[c]=h}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,a){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,a,o){return t=t||"&",a=a||"=",null===e&&(e=void 0),"object"==typeof e?n(s(e),(function(s){var o=encodeURIComponent(r(s))+a;return i(e[s])?n(e[s],(function(e){return o+encodeURIComponent(r(e))})).join(t):o+encodeURIComponent(r(e[s]))})).join(t):o?encodeURIComponent(r(o))+a+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var a=[],r=0;r<e.length;r++)a.push(t(e[r],r));return a}var s=Object.keys||function(e){var t=[];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t}},function(e,t,a){"use strict";var r=a(3),i=a(0),n=a(5),s=a(10),o=a(11),l=i.ucs2length,d=a(4),u=n.Validation;function p(e,t,a){var r=c.call(this,e,t,a);return r>=0?{index:r,compiling:!0}:(r=this._compilations.length,this._compilations[r]={schema:e,root:t,baseId:a},{index:r,compiling:!1})}function m(e,t,a){var r=c.call(this,e,t,a);r>=0&&this._compilations.splice(r,1)}function c(e,t,a){for(var r=0;r<this._compilations.length;r++){var i=this._compilations[r];if(i.schema==e&&i.root==t&&i.baseId==a)return r}return-1}function h(e,t){return"var pattern"+e+" = new RegExp("+i.toQuotedString(t[e])+");"}function v(e){return"var default"+e+" = defaults["+e+"];"}function f(e,t){return void 0===t[e]?"":"var refVal"+e+" = refVal["+e+"];"}function g(e){return"var customRule"+e+" = customRules["+e+"];"}function k(e,t){if(!e.length)return"";for(var a="",r=0;r<e.length;r++)a+=t(r,e);return a}e.exports=function e(t,a,c,y){var b=this,w=this._opts,z=[void 0],_={},P=[],S={},A=[],j={},C=[];a=a||{schema:t,refVal:z,refs:_};var O=p.call(this,t,a,y),L=this._compilations[O.index];if(O.compiling)return L.callValidate=function e(){var t=L.validate,a=t.apply(this,arguments);return e.errors=t.errors,a};var E=this._formats,T=this.RULES;try{var x=D(t,a,c,y);L.validate=x;var M=L.callValidate;return M&&(M.schema=x.schema,M.errors=null,M.refs=x.refs,M.refVal=x.refVal,M.root=x.root,M.$async=x.$async,w.sourceCode&&(M.source=x.source)),x}finally{m.call(this,t,a,y)}function D(t,s,p,m){var c=!s||s&&s.schema==t;if(s.schema!=a.schema)return e.call(b,t,s,p,m);var y,S=!0===t.$async,j=o({isTop:!0,schema:t,isRoot:c,baseId:m,root:s,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:n.MissingRef,RULES:T,validate:o,util:i,resolve:r,resolveRef:$,usePattern:V,useDefault:H,useCustomRule:F,opts:w,formats:E,logger:b.logger,self:b});j=k(z,f)+k(P,h)+k(A,v)+k(C,g)+j,w.processCode&&(j=w.processCode(j,t));try{y=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",j)(b,T,E,a,z,A,C,d,l,u),z[0]=y}catch(e){throw b.logger.error("Error compiling schema, function code:",j),e}return y.schema=t,y.errors=null,y.refs=_,y.refVal=z,y.root=c?y:s,S&&(y.$async=!0),!0===w.sourceCode&&(y.source={code:j,patterns:P,defaults:A}),y}function $(t,i,n){i=r.url(t,i);var s,o,l=_[i];if(void 0!==l)return N(s=z[l],o="refVal["+l+"]");if(!n&&a.refs){var d=a.refs[i];if(void 0!==d)return N(s=a.refVal[d],o=I(i,s))}o=I(i);var u=r.call(b,D,a,i);if(void 0===u){var p=c&&c[i];p&&(u=r.inlineRef(p,w.inlineRefs)?p:e.call(b,p,a,c,t))}if(void 0!==u)return function(e,t){var a=_[e];z[a]=t}(i,u),N(u,o);!function(e){delete _[e]}(i)}function I(e,t){var a=z.length;return z[a]=t,_[e]=a,"refVal"+a}function N(e,t){return"object"==typeof e||"boolean"==typeof e?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function V(e){var t=S[e];return void 0===t&&(t=S[e]=P.length,P[t]=e),"pattern"+t}function H(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return i.toQuotedString(e);case"object":if(null===e)return"null";var t=s(e),a=j[t];return void 0===a&&(a=j[t]=A.length,A[a]=e),"default"+a}}function F(e,t,a,r){if(!1!==b._opts.validateSchema){var i=e.definition.dependencies;if(i&&!i.every((function(e){return Object.prototype.hasOwnProperty.call(a,e)})))throw new Error("parent schema must have all required keywords: "+i.join(","));var n=e.definition.validateSchema;if(n)if(!n(t)){var s="keyword schema is invalid: "+b.errorsText(n.errors);if("log"!=b._opts.validateSchema)throw new Error(s);b.logger.error(s)}}var o,l=e.definition.compile,d=e.definition.inline,u=e.definition.macro;if(l)o=l.call(b,t,a,r);else if(u)o=u.call(b,t,a,r),!1!==w.validateSchema&&b.validateSchema(o,!0);else if(d)o=d.call(b,r,e.keyword,t,a);else if(!(o=e.definition.validate))return;if(void 0===o)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var p=C.length;return C[p]=o,{code:"customRule"+p,validate:o}}}},function(e,t,a){
11
11
  /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */