diff --git a/webpack/index.js b/webpack/index.js index be058ad9..fea2d8df 100644 --- a/webpack/index.js +++ b/webpack/index.js @@ -5,7 +5,7 @@ * @author Feross Aboukhadijeh * @license MIT */ -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()=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;no&&(a=o-l),n=a;n>=0;n--){for(var p=!0,m=0;mi&&(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>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;i239?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(;r0&&(e=this.toString("hex",0,a).match(/.{2}/g).join(" "),this.length>a&&(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;pi)&&(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;ir)&&(a=r);for(var i="",n=t;na)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||te.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>>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>>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),t0&&(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=(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=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>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=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=0;--i)e[i+t]=this[i+a];else if(n<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(n=t;n55295&&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=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(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",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=[];++p1)for(var a=1;a(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=-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=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=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=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{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;et.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{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;ne.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;a1&&(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{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>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;so?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;o0)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>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){ +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()=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;no&&(a=o-l),n=a;n>=0;n--){for(var p=!0,m=0;mi&&(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>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;i239?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(;r0&&(e=this.toString("hex",0,a).match(/.{2}/g).join(" "),this.length>a&&(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;pi)&&(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;ir)&&(a=r);for(var i="",n=t;na)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||te.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>>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>>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),t0&&(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=(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=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>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=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=0;--i)e[i+t]=this[i+a];else if(n<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(n=t;n55295&&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=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(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",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=[];++p1)for(var a=1;a(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=-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=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=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=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{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;et.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{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;ne.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;a1&&(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{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>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;so?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;o0)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>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){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ t.read=function(e,t,a,r,i){var n,s,o=8*i-r-1,l=(1<>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<>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<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&&n127?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;j0)&&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=55296&&t<=56319&&i65535&&(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=128&&v("not-basic"),h.push(e.charCodeAt(r));for(i=a>0?a+1:0;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=t&&mc((l-a)/(g=r+1))&&v("overflow"),a+=(o-t)*g,t=o,s=0;sl&&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=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=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