UNPKG

balena-sdk

Version:
1 lines • 630 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.balenaSdk=t():e.balenaSdk=t()}(self,()=>(()=>{var e={34:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.APIKey=void 0;const n=r(9121);t.APIKey=class{constructor(e){this.type=n.TokenType.APIKey,this.isValid=()=>!0,this.getAge=()=>0,this.isExpired=()=>!1,this.get2FAStatus=()=>"not_required",this.key=e}}},41:(e,t,r)=>{"use strict";var n=r(655),i=r(8068),o=r(9675),a=r(5795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],f=!!a&&a(e,t);if(n)n(e,t,{configurable:null===l&&f?f.configurable:!l,enumerable:null===s&&f?f.enumerable:!s,value:r,writable:null===u&&f?f.writable:!u});else{if(!c&&(s||u||l))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},76:e=>{"use strict";e.exports=Function.prototype.call},144:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},148:(e,t,r)=>{"use strict";var n=r(9762),i=Array.prototype.forEach,o=Object.create;e.exports=function(e){var t=o(null);return i.call(arguments,function(e){n(e)&&function(e,t){var r;for(r in e)t[r]=e[r]}(Object(e),t)}),t}},181:(e,t,r)=>{"use strict";var n=r(8175),i={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!n(e)&&hasOwnProperty.call(i,typeof e)}},214:(e,t,r)=>{"use strict";e.exports=r(525)()?String.prototype.contains:r(1521)},251:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,f=r?i-1:0,p=r?-1:1,h=e[t+f];for(f+=p,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+f],f+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+f],f+=p,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=l}return(h?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,f=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=d,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+h]=255&a,h+=d,a/=256,l-=8);e[r+h-d]|=128*y}},261:(e,t,r)=>{"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}t.__esModule=!0;var o=i(r(2871)),a=n(r(9613)),s=n(r(3769)),u=i(r(2849)),l=i(r(7624)),c=n(r(1148));function f(){var e=new o.HandlebarsEnvironment;return u.extend(e,o),e.SafeString=a.default,e.Exception=s.default,e.Utils=u,e.escapeExpression=u.escapeExpression,e.VM=l,e.template=function(t){return l.template(t,e)},e}var p=f();p.create=f,c.default(p),p.default=p,t.default=p,e.exports=t.default},270:(e,t,r)=>{"use strict";const n=r(3908),i=r(8311);e.exports=(e,t,r)=>{let o=null,a=null,s=null;try{s=new i(t,r)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(o&&1!==a.compare(e)||(o=e,a=new n(o,r)))}),o}},294:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},316:(e,t,r)=>{"use strict";t.e=function({getAll:e,NotFoundError:t,AmbiguousResourceError:r,chunkSize:n}){var l,c;const f="number"==typeof n?{numericId:n,stringId:n}:{numericId:null!==(l=null==n?void 0:n.numericId)&&void 0!==l?l:s,stringId:null!==(c=null==n?void 0:n.stringId)&&void 0!==c?c:u};return async function({uuidOrIdOrArray:n,parameterName:s="uuidOrIdOrArray",options:u,groupByNavigationPoperty:l,fn:c}){if(""===n)throw new i.BalenaInvalidParameterError(s,n);if(Array.isArray(n)){if(!n.length)throw new i.BalenaInvalidParameterError(s,n);let e=typeof n[0];for(const t of n){const r=typeof t;if("number"!==r&&"string"!==r)throw new i.BalenaInvalidParameterError("uuidOrIdOrArray",n);if(e!==r)throw new i.BalenaInvalidParameterError("uuidOrIdOrArray",n);if("string"==typeof t&&32!==t.length&&62!==t.length)throw new i.BalenaInvalidParameterError("uuidOrIdOrArray",n);e=r}}const p=Array.isArray(n)?"string"==typeof n[0]?(0,o.default)(n,f.stringId):(0,o.default)(n,f.numericId):[n],h=[];for(const t of p){const r=Array.isArray(t)?"string"==typeof t[0]?{uuid:{$in:t}}:{id:{$in:t}}:"string"==typeof t?{uuid:{$startswith:t}}:{id:t},n=(0,a.mergePineOptions)({$select:["id",...Array.isArray(t)&&"string"==typeof t[0]?["uuid"]:[],...l?[l]:[]],$filter:r},u);h.push(...await e(n))}if(!h.length)throw new t(n.toString());const d=l?(0,a.groupByMap)(h,e=>e[l].__id):new Map([[void 0,h]]);if("string"==typeof n&&h.length>1)throw new r(n);if(Array.isArray(n)){const e="string"==typeof n[0]?"uuid":"id",r=h.map(t=>t[e]),i=new Set(r);for(const e of n)if(!i.has(e))throw new t(e)}for(const[e,t]of d.entries())for(const r of(0,o.default)(t,f.numericId))await c(r,e)}};const n=r(1635),i=n.__importStar(r(4786)),o=n.__importDefault(r(1013)),a=r(8862),s=200,u=50},345:(e,t,r)=>{e.exports=r(7007).EventEmitter},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},352:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assetHelpers=void 0;const r=()=>{throw new Error("File path uploads are not supported in the browser.")};t.assetHelpers={getMimeType:r,getFileSize:r,readFileChunk:r}},361:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}},392:(e,t,r)=>{"use strict";t.i=void 0;const n=r(957);t.i=function(e,t){const r=new n.DeviceActionsService(e,t);return{startOsUpdate:(e,t,n)=>r.startAction({uuid:e,actionName:"resinhup",deviceActionsApiVersion:n,params:{target_version:t}})}}},414:e=>{"use strict";e.exports=Math.round},453:(e,t,r)=>{"use strict";var n,i=r(9612),o=r(9383),a=r(1237),s=r(9290),u=r(9538),l=r(8068),c=r(9675),f=r(5345),p=r(1514),h=r(8968),d=r(6188),y=r(8002),g=r(5880),v=r(414),m=r(3093),b=Function,w=function(e){try{return b('"use strict"; return ('+e+").constructor;")()}catch(e){}},_=r(5795),S=r(655),E=function(){throw new c},O=_?function(){try{return E}catch(e){try{return _(arguments,"callee").get}catch(e){return E}}}():E,A=r(4039)(),x=r(3628),R=r(1064),k=r(8648),P=r(1002),T=r(76),$={},j="undefined"!=typeof Uint8Array&&x?x(Uint8Array):n,I={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":A&&x?x([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":$,"%AsyncGenerator%":$,"%AsyncGeneratorFunction%":$,"%AsyncIteratorPrototype%":$,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?n:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":$,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":A&&x?x(x([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&A&&x?x((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":s,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&A&&x?x((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":A&&x?x(""[Symbol.iterator]()):n,"%Symbol%":A?Symbol:n,"%SyntaxError%":l,"%ThrowTypeError%":O,"%TypedArray%":j,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":f,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":P,"%Object.defineProperty%":S,"%Object.getPrototypeOf%":R,"%Math.abs%":p,"%Math.floor%":h,"%Math.max%":d,"%Math.min%":y,"%Math.pow%":g,"%Math.round%":v,"%Math.sign%":m,"%Reflect.getPrototypeOf%":k};if(x)try{null.error}catch(e){var M=x(x(e));I["%Error.prototype%"]=M}var L=function e(t){var r;if("%AsyncFunction%"===t)r=w("async function () {}");else if("%GeneratorFunction%"===t)r=w("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=w("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&x&&(r=x(i.prototype))}return I[t]=r,r},N={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},D=r(6743),C=r(9957),B=D.call(T,Array.prototype.concat),U=D.call(P,Array.prototype.splice),F=D.call(T,String.prototype.replace),W=D.call(T,String.prototype.slice),q=D.call(T,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H=/\\(\\)?/g,V=function(e,t){var r,n=e;if(C(N,n)&&(n="%"+(r=N[n])[0]+"%"),C(I,n)){var i=I[n];if(i===$&&(i=L(n)),void 0===i&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new l("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===q(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=W(e,0,1),r=W(e,-1);if("%"===t&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var n=[];return F(e,z,function(e,t,r,i){n[n.length]=r?F(i,H,"$1"):t||e}),n}(e),n=r.length>0?r[0]:"",i=V("%"+n+"%",t),o=i.name,a=i.value,s=!1,u=i.alias;u&&(n=u[0],U(r,B([0,1],u)));for(var f=1,p=!0;f<r.length;f+=1){var h=r[f],d=W(h,0,1),y=W(h,-1);if(('"'===d||"'"===d||"`"===d||'"'===y||"'"===y||"`"===y)&&d!==y)throw new l("property names with quotes must have matching quotes");if("constructor"!==h&&p||(s=!0),C(I,o="%"+(n+="."+h)+"%"))a=I[o];else if(null!=a){if(!(h in a)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(_&&f+1>=r.length){var g=_(a,h);a=(p=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[h]}else p=C(a,h),a=a[h];p&&!s&&(I[o]=a)}}return a}},487:(e,t,r)=>{"use strict";var n=r(6897),i=r(655),o=r(3126),a=r(2205);e.exports=function(e){var t=o(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},i?i(e.exports,"apply",{value:a}):e.exports.apply=a},498:(e,t,r)=>{"use strict";var n=r(5499),i=r(5921),o=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),i(e,function(e,n,i,s){r[n]=o.call(t,a,e,n,i,s)}),r}},507:(e,t,r)=>{"use strict";var n=r(453),i=r(6556),o=r(8859),a=r(9675),s=n("%Map%",!0),u=i("Map.prototype.get",!0),l=i("Map.prototype.set",!0),c=i("Map.prototype.has",!0),f=i("Map.prototype.delete",!0),p=i("Map.prototype.size",!0);e.exports=!!s&&function(){var e,t={assert:function(e){if(!t.has(e))throw new a("Side channel does not contain "+o(e))},delete:function(t){if(e){var r=f(e,t);return 0===p(e)&&(e=void 0),r}return!1},get:function(t){if(e)return u(e,t)},has:function(t){return!!e&&c(e,t)},set:function(t,r){e||(e=new s),l(e,t,r)}};return t}},512:(e,t,r)=>{"use strict";var n=r(5499);e.exports=function(e){var t;return"function"==typeof e?{set:e,get:e}:(t={get:n(e.get)},void 0!==e.set?(t.set=n(e.set),e.delete&&(t.delete=n(e.delete)),e.clear&&(t.clear=n(e.clear)),t):(t.set=t.get,t))}},525:e=>{"use strict";var t="razdwatrzy";e.exports=function(){return"function"==typeof t.contains&&(!0===t.contains("dwa")&&!1===t.contains("foo"))}},537:(e,t,r)=>{var n=r(5606),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(l(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(e).replace(o,function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),s=n[r];r<i;s=n[++r])v(s)||!S(s)?a+=" "+s:a+=" "+l(s);return a},t.deprecate=function(e,r){if(void 0!==n&&!0===n.noDeprecation)return e;if(void 0===n)return function(){return t.deprecate(e,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),i=!0}return e.apply(this,arguments)}};var a={},s=/^$/;if(n.env.NODE_DEBUG){var u=n.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}function l(e,r){var n={seen:[],stylize:f};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),p(n,e,n.depth)}function c(e,t){var r=l.styles[t];return r?"["+l.colors[r][0]+"m"+e+"["+l.colors[r][1]+"m":e}function f(e,t){return e}function p(e,r,n){if(e.customInspect&&r&&A(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return b(i)||(i=p(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(g(t))return e.stylize(""+t,"boolean");if(v(t))return e.stylize("null","null")}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),O(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(r);if(0===a.length){if(A(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return h(r)}var l,c="",f=!1,S=["{","}"];(y(r)&&(f=!0,S=["[","]"]),A(r))&&(c=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(c=" "+RegExp.prototype.toString.call(r)),E(r)&&(c=" "+Date.prototype.toUTCString.call(r)),O(r)&&(c=" "+h(r)),0!==a.length||f&&0!=r.length?n<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),l=f?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a<s;++a)P(t,String(a))?o.push(d(e,t,r,n,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(d(e,t,r,n,i,!0))}),o}(e,r,n,s,a):a.map(function(t){return d(e,r,n,s,t,f)}),e.seen.pop(),function(e,t,r){var n=e.reduce(function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(l,c,S)):S[0]+c+S[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),P(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=v(r)?p(e,u.value,null):p(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").slice(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function y(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function v(e){return null===e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function _(e){return S(e)&&"[object RegExp]"===x(e)}function S(e){return"object"==typeof e&&null!==e}function E(e){return S(e)&&"[object Date]"===x(e)}function O(e){return S(e)&&("[object Error]"===x(e)||e instanceof Error)}function A(e){return"function"==typeof e}function x(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[e]},t.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(9032),t.isArray=y,t.isBoolean=g,t.isNull=v,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=_,t.types.isRegExp=_,t.isObject=S,t.isDate=E,t.types.isDate=E,t.isError=O,t.types.isNativeError=O,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(1135);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":"),[e.getDate(),k[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(6698),t._extend=function(e,t){if(!t||!S(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function $(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(T&&e[T]){var t;if("function"!=typeof(t=e[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,T,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,n){e?r(e):t(n)});try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),T&&Object.defineProperty(t,T,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=T,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var i=t.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,t).then(function(e){n.nextTick(a.bind(null,null,e))},function(e){n.nextTick($.bind(null,e,a))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},560:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},565:()=>{},566:(e,t,r)=>{"use strict";t.__esModule=!0;var n=r(2849),i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=n.indexOf(i.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=i.lookupLevel(e),"undefined"!=typeof console&&i.lookupLevel(i.level)<=e){var t=i.methodMap[e];console[t]||(t="log");for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];console[t].apply(console,n)}}};t.default=i,e.exports=t.default},569:(e,t,r)=>{"use strict";var n=r(2665),i=r(5481);e.exports=function(e){if((e=n(e))>i)throw new TypeError(e+" exceeds maximum possible timeout");return e}},592:(e,t,r)=>{"use strict";var n=r(655),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},639:(e,t,r)=>{"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(r(261)),o=n(r(2300)),a=r(9027),s=r(1127),u=n(r(6727)),l=n(r(1350)),c=n(r(1148)),f=i.default.create;function p(){var e=f();return e.compile=function(t,r){return s.compile(t,r,e)},e.precompile=function(t,r){return s.precompile(t,r,e)},e.AST=o.default,e.Compiler=s.Compiler,e.JavaScriptCompiler=u.default,e.Parser=a.parser,e.parse=a.parse,e.parseWithoutProcessing=a.parseWithoutProcessing,e}var h=p();h.create=p,c.default(h),h.Visitor=l.default,h.default=h,t.default=h,e.exports=t.default},640:(e,t)=>{"use strict";t.buildMatchFn=function(e){return(t,r={})=>{const n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const a=o[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r;return}(s,e=>e.test(a)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r;return}(s,e=>e.test(a));let l;l=e.valueCallback?e.valueCallback(u):u,l=r.valueCallback?r.valueCallback(l):l;return{value:l,rest:t.slice(a.length)}}}},650:(e,t,r)=>{"use strict";const n=r(1635).__importStar(r(4786)),i=r(8862),o="organization_membership";t.A=function(e,t){const{pine:a}=e,{buildDependentResource:s}=r(8882),u=s({pine:a},{resourceName:"organization_membership_tag",resourceKeyField:"tag_key",parentResourceName:"organization_membership",async getResourceId(e){if("number"!=typeof e)throw new Error("Unexpected type for membershipId provided in organization-membership tagsModel getResourceId: "+typeof e);return(await l.get(e)).id}}),l={async get(e,t){if("number"!=typeof e&&"object"!=typeof e)throw new n.BalenaInvalidParameterError("membershipId",e);const r=await a.get({resource:o,id:e,options:t});if(null==r)throw new n.BalenaError(`Organization Membership not found: ${e}`);return r},async getAllByOrganization(e,r){const{id:n}=await t(e,{$select:"id"});return await a.get({resource:o,options:(0,i.mergePineOptions)({$filter:{is_member_of__organization:n}},r)})},async getAllByUser(e,t){if("number"!=typeof e&&"string"!=typeof e)throw new n.BalenaInvalidParameterError("usernameOrId",e);return await a.get({resource:o,options:(0,i.mergePineOptions)({$filter:{user:"number"==typeof e?e:{$any:{$alias:"u",$expr:{u:{username:e}}}}}},t)})},async changeRole(e,t){const r=await(async e=>{const t=await a.get({resource:"organization_membership_role",id:{name:e},options:{$select:"id"}});if(!t)throw new n.BalenaOrganizationMembershipRoleNotFound(e);return t.id})(t);await a.patch({resource:"organization_membership",id:e,body:{organization_membership_role:r}})},async remove(e){await a.delete({resource:o,id:e})},tags:{async getAllByOrganization(e,r){const{id:n}=await t(e,{$select:"id"});return await u.getAll((0,i.mergePineOptions)({$filter:{organization_membership:{$any:{$alias:"om",$expr:{om:{is_member_of__organization:n}}}}}},r))},getAllByOrganizationMembership:u.getAllByParent,set:u.set,remove:u.remove}};return l}},655:e=>{"use strict";var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch(e){t=!1}e.exports=t},659:(e,t,r)=>{var n=r(1873),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},685:(e,t,r)=>{"use strict";var n;var i=r(1597).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e){e()}function l(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var c,f=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var p=t.map(function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",function(){s=!0}),void 0===n&&(n=r(2015)),n(e,{readable:t,writable:i},function(e){if(e)return o(e);s=!0,o()});var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,function(e){c||(c=e),e&&p.forEach(u),o||(p.forEach(u),f(c))})});return t.reduce(l)}},712:(e,t,r)=>{"use strict";e.exports=c;var n=r(2590).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(1160);function l(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:l.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function f(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?p(this,null,null):this._flush(function(t,r){p(e,t,r)})}function p(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,function(e){t(e)})}},806:(e,t,r)=>{"use strict";const n=r(1635).__importStar(r(4786)),i=r(8862);t.A=function({pine:e,request:t,sdkInstance:r},{apiUrl:o}){const a={async create({name:e,expiryDate:r,description:i=null}){if(void 0===r)throw new n.BalenaInvalidParameterError("createApiKeyParams.expiryDate",r);const a={name:e,expiryDate:r};"string"==typeof i&&i&&(a.description=i);try{const{body:e}=await t.send({method:"POST",url:"/api-key/user/full",baseUrl:o,body:a});return e}catch(e){throw new n.BalenaNotLoggedIn}},getAll:async t=>await e.get({resource:"api_key",options:(0,i.mergePineOptions)({$orderby:{name:"asc"}},t)}),getAllNamedUserApiKeys:async e=>await a.getAll((0,i.mergePineOptions)({$filter:{is_of__actor:await r.auth.getActorId(),name:{$ne:null}}},e)),async getProvisioningApiKeysByApplication(e,t){const n=await r.models.application.get(e,{$select:"actor"});return await a.getAll((0,i.mergePineOptions)({$filter:{is_of__actor:n.actor.__id}},t))},async getDeviceApiKeysByDevice(t,n){const{actor:o}=await r.models.device.get(t,{$select:"actor"});return await e.get({resource:"api_key",options:(0,i.mergePineOptions)({$filter:{is_of__actor:o.__id},$orderby:{name:"asc"}},n)})},async update(t,r){if(!r)throw new n.BalenaInvalidParameterError("apiKeyInfo",r);if(null===r.name||""===r.name)throw new n.BalenaInvalidParameterError("apiKeyInfo.name",r.name);const i={name:r.name,description:r.description,expiry_date:r.expiryDate};await e.patch({resource:"api_key",id:t,body:i})},async revoke(t){await e.delete({resource:"api_key",id:t})}};return a}},867:(e,t,r)=>{"use strict";const n=r(1635).__importStar(r(4786)),i=r(8862);t.A=({pine:e,sdkInstance:t})=>{const{buildDependentResource:o}=r(8882),a=o({pine:e},{resourceName:"service_environment_variable",resourceKeyField:"name",parentResourceName:"service",async getResourceId(e){if(null!=e&&"object"==typeof e){if(2!==Object.keys(e).length||!("application"in e)||!("service_name"in e))throw new Error("Unexpected type for id provided in service varModel getResourceId: "+typeof e);const t=e,[r]=await u(t.application,{$select:"id",$filter:{service_name:t.service_name}});if(null==r)throw new n.BalenaServiceNotFound(t.service_name);return r.id}if("number"!=typeof e)throw new Error("Unexpected type for id provided in service varModel getResourceId: "+typeof e);return(await s(e,{$select:"id"})).id}}),s=async(t,r)=>{const i=await e.get({resource:"service",id:t,options:r});if(null==i)throw new n.BalenaServiceNotFound(t);return i};async function u(e,r={}){const{service:n}=await t.models.application.get(e,{$select:"id",$expand:{service:r}});return n}return{getAllByApplication:u,var:{getAllByService:a.getAllByParent,async getAllByApplication(e,r){const{id:n}=await t.models.application.get(e,{$select:"id"});return a.getAll((0,i.mergePineOptions)({$filter:{service:{$any:{$alias:"s",$expr:{s:{application:n}}}}},$orderby:{name:"asc"}},r))},get:a.get,set:a.set,remove:a.remove}}}},879:(e,t,r)=>{"use strict";t.getTimezoneOffsetInMilliseconds=function(e){const t=(0,n.toDate)(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r};var n=r(1576)},908:(e,t,r)=>{"use strict";t.__esModule=!0;var n,i=r(2849),o=r(3769),a=(n=o)&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("with",function(e,t){if(2!=arguments.length)throw new a.default("#with requires exactly one argument");i.isFunction(e)&&(e=e.call(this));var r=t.fn;if(i.isEmpty(e))return t.inverse(this);var n=t.data;return t.data&&t.ids&&((n=i.createFrame(t.data)).contextPath=i.appendContextPath(t.data.contextPath,t.ids[0])),r(e,{data:n,blockParams:i.blockParams([e],[n&&n.contextPath])})})},e.exports=t.default},909:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r)=>{const i=new n(e,r),o=new n(t,r);return i.compare(o)||i.compareBuild(o)}},915:(e,t,r)=>{"use strict";t.__esModule=!0;var n,i=r(1350),o=(n=i)&&n.__esModule?n:{default:n};function a(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=e}function s(e,t,r){void 0===t&&(t=e.length);var n=e[t-1],i=e[t-2];return n?"ContentStatement"===n.type?(i||!r?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(n.original):void 0:r}function u(e,t,r){void 0===t&&(t=-1);var n=e[t+1],i=e[t+2];return n?"ContentStatement"===n.type?(i||!r?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(n.original):void 0:r}function l(e,t,r){var n=e[null==t?0:t+1];if(n&&"ContentStatement"===n.type&&(r||!n.rightStripped)){var i=n.value;n.value=n.value.replace(r?/^\s+/:/^[ \t]*\r?\n?/,""),n.rightStripped=n.value!==i}}function c(e,t,r){var n=e[null==t?e.length-1:t-1];if(n&&"ContentStatement"===n.type&&(r||!n.leftStripped)){var i=n.value;return n.value=n.value.replace(r?/\s+$/:/[ \t]+$/,""),n.leftStripped=n.value!==i,n.leftStripped}}a.prototype=new o.default,a.prototype.Program=function(e){var t=!this.options.ignoreStandalone,r=!this.isRootSeen;this.isRootSeen=!0;for(var n=e.body,i=0,o=n.length;i<o;i++){var a=n[i],f=this.accept(a);if(f){var p=s(n,i,r),h=u(n,i,r),d=f.openStandalone&&p,y=f.closeStandalone&&h,g=f.inlineStandalone&&p&&h;f.close&&l(n,i,!0),f.open&&c(n,i,!0),t&&g&&(l(n,i),c(n,i)&&"PartialStatement"===a.type&&(a.indent=/([ \t]+$)/.exec(n[i-1].original)[1])),t&&d&&(l((a.program||a.inverse).body),c(n,i)),t&&y&&(l(n,i),c((a.inverse||a.program).body))}}return e},a.prototype.BlockStatement=a.prototype.DecoratorBlock=a.prototype.PartialBlockStatement=function(e){this.accept(e.program),this.accept(e.inverse);var t=e.program||e.inverse,r=e.program&&e.inverse,n=r,i=r;if(r&&r.chained)for(n=r.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var o={open:e.openStrip.open,close:e.closeStrip.close,openStandalone:u(t.body),closeStandalone:s((n||t).body)};if(e.openStrip.close&&l(t.body,null,!0),r){var a=e.inverseStrip;a.open&&c(t.body,null,!0),a.close&&l(n.body,null,!0),e.closeStrip.open&&c(i.body,null,!0),!this.options.ignoreStandalone&&s(t.body)&&u(n.body)&&(c(t.body),l(n.body))}else e.closeStrip.open&&c(t.body,null,!0);return o},a.prototype.Decorator=a.prototype.MustacheStatement=function(e){return e.strip},a.prototype.PartialStatement=a.prototype.CommentStatement=function(e){var t=e.strip||{};return{inlineStandalone:!0,open:t.open,close:t.close}},t.default=a,e.exports=t.default},920:(e,t,r)=>{"use strict";var n=r(9675),i=r(8859),o=r(4803),a=r(507),s=r(2271)||a||o;e.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new n("Side channel does not contain "+i(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,r){e||(e=s()),e.set(t,r)}};return t}},957:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceActionsService=void 0;t.DeviceActionsService=class{constructor(e,t){this.request=t,this.startAction=({uuid:e,actionName:t,deviceActionsApiVersion:r,params:n,extraOptions:i})=>this.makeActionRequest({method:"POST",uuid:e,actionNameOrId:t,deviceActionsApiVersion:r,params:n,extraOptions:i}),this.getActionStatus=({uuid:e,actionId:t,extraOptions:r})=>this.makeActionRequest({method:"GET",uuid:e,deviceActionsApiVersion:"v1",actionNameOrId:t,extraOptions:r}),this.makeActionRequest=async({method:e,uuid:t,actionNameOrId:r,deviceActionsApiVersion:n,params:i,extraOptions:o})=>{const a=i?{parameters:i}:null,{body:s}=await this.request.send(Object.assign({method:e,url:`${this.actionsEndpoint}/${n}/${t}/${r}`,body:a},o));return s},this.actionsEndpoint=`https://actions.${e}`}}},968:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},980:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSupervisorApiHelper=t.CONTAINER_ACTION_ENDPOINT_TIMEOUT=t.MIN_SUPERVISOR_MC_API=t.MIN_SUPERVISOR_APPS_API=void 0;const n=r(8862),i=r(3364);t.MIN_SUPERVISOR_APPS_API="1.8.0-alpha.0",t.MIN_SUPERVISOR_MC_API="7.0.0",t.CONTAINER_ACTION_ENDPOINT_TIMEOUT=5e4;t.getSupervisorApiHelper=function(e,t){const{request:r,sdkInstance:o}=e,{apiUrl:a}=t,s={ping:async e=>{const t=await o.models.device.get(e,{$select:"id",$expand:{belongs_to__application:{$select:"id"}}});await r.send({method:"POST",url:"/supervisor/ping",baseUrl:a,body:{method:"GET",deviceId:t.id,appId:t.belongs_to__application[0].id}})},identify:async e=>{const t=await o.models.device.get(e,{$select:"uuid"});await r.send({method:"POST",url:"/supervisor/v1/blink",baseUrl:a,body:{uuid:t.uuid}})},restartApplication:e=>(0,n.withSupervisorLockedError)(async()=>{const t=await o.models.device.get(e,{$select:["id","supervisor_version"],$expand:{belongs_to__application:{$select:"id"}}}),n=t.belongs_to__application[0].id,{body:i}=await r.send({method:"POST",url:"/supervisor/v1/restart",baseUrl:a,body:{deviceId:t.id,appId:n,data:{appId:n}},timeout:s.CONTAINER_ACTION_ENDPOINT_TIMEOUT});return i}),reboot:(e,t)=>(0,n.withSupervisorLockedError)(async()=>{null!=t||(t={});const n=(await o.models.device.get(e,{$select:"id"})).id,{body:i}=await r.send({method:"POST",url:"/supervisor/v1/reboot",baseUrl:a,body:{deviceId:n,data:{force:Boolean(t.force)}}});return i}),shutdown:(e,t)=>(0,n.withSupervisorLockedError)(async()=>{null!=t||(t={});const n=await o.models.device.get(e,{$select:"id",$expand:{belongs_to__application:{$select:"id"}}});await r.send({method:"POST",url:"/supervisor/v1/shutdown",baseUrl:a,body:{deviceId:n.id,appId:n.belongs_to__application[0].id,data:{force:Boolean(t.force)}}})}),purge:e=>(0,n.withSupervisorLockedError)(async()=>{const t=await o.models.device.get(e,{$select:"id",$expand:{belongs_to__application:{$select:"id"}}});await r.send({method:"POST",url:"/supervisor/v1/purge",baseUrl:a,body:{deviceId:t.id,appId:t.belongs_to__application[0].id,data:{appId:t.belongs_to__application[0].id}}})}),async update(e,t){null!=t||(t={});const n=await o.models.device.get(e,{$select:"id",$expand:{belongs_to__application:{$select:"id"}}});await r.send({method:"POST",url:"/supervisor/v1/update",baseUrl:a,body:{deviceId:n.id,appId:n.belongs_to__application[0].id,data:{force:Boolean(t.force)}}})},getSupervisorState:async e=>{const{uuid:t}=await o.models.device.get(e,{$select:"uuid"}),{body:n}=await r.send({method:"POST",url:"/supervisor/v1/device",baseUrl:a,body:{uuid:t,method:"GET"}});return n},startService:async(e,t)=>{const n=await o.models.device.get(e,{$select:["id","supervisor_version"],$expand:{belongs_to__application:{$select:"id"}}});(0,i.ensureVersionCompatibility)(n.supervisor_version,s.MIN_SUPERVISOR_MC_API,"supervisor");const u=n.belongs_to__application[0].id;await r.send({method:"POST",url:`/supervisor/v2/applications/${u}/start-service`,baseUrl:a,body:{deviceId:n.id,appId:u,data:{appId:u,imageId:t}},timeout:s.CONTAINER_ACTION_ENDPOINT_TIMEOUT})},stopService:(e,t)=>(0,n.withSupervisorLockedError)(async()=>{const n=await o.models.device.get(e,{$select:["id","supervisor_version"],$expand:{belongs_to__application:{$select:"id"}}});(0,i.ensureVersionCompatibility)(n.supervisor_version,s.MIN_SUPERVISOR_MC_API,"supervisor");const u=n.belongs_to__application[0].id;await r.send({method:"POST",url:`/supervisor/v2/applications/${u}/stop-service`,baseUrl:a,body:{deviceId:n.id,appId:u,data:{appId:u,imageId:t}},timeout:s.CONTAINER_ACTION_ENDPOINT_TIMEOUT})}),restartService:(e,t)=>(0,n.withSupervisorLockedError)(async()=>{const n=await o.models.device.get(e,{$select:["id","supervisor_version"],$expand:{belongs_to__application:{$select:"id"}}});(0,i.ensureVersionCompatibility)(n.supervisor_version,s.MIN_SUPERVISOR_MC_API,"supervisor");const u=n.belongs_to__application[0].id;await r.send({method:"POST",url:`/supervisor/v2/applications/${u}/restart-service`,baseUrl:a,body:{deviceId:n.id,appId:u,data:{appId:u,imageId:t}},timeout:s.CONTAINER_ACTION_ENDPOINT_TIMEOUT})})};return s}},1002:e=>{"use strict";e.exports=Function.prototype.apply},1013:(e,t,r)=>{var n=r(5160),i=r(6800),o=r(1489),a=Math.ceil,s=Math.max;e.exports=function(e,t,r){t=(r?i(e,t,r):void 0===t)?1:s(o(t),0);var u=null==e?0:e.length;if(!u||t<1)return[];for(var l=0,c=0,f=Array(a(u/t));l<u;)f[c++]=n(e,l,l+=t);return f}},1029:(e,t,r)=>{"use strict";var n=r(9575);e.exports=function(e){try{return e&&n(e.toString)?e.toString():String(e)}catch(e){return"<Non-coercible to string value>"}}},1064:(e,t,r)=>{"use strict";var n=r(9612);e.exports=n.getPrototypeOf||null},1072:(e,t)=>{t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},1076:(e,t,r)=>{"use strict";const n=r(1635),i=n.__importStar(r(9883)),o=n.__importStar(r(4786)),a=n.__importDefault(r(8059)),s=r(8862),u=r(4592),l=r(4786);var c,f;!function(e){e.DEFAULT="default",e.ESR="esr"}(c||(c={})),function(e){e.production="prod",e.development="dev"}(f||(f={}));const p={$select:["id","known_issue_list","raw_version","variant","phase"],$expand:{release_tag:{$select:["tag_key","value"]}}},h=(e,t)=>i.rcompare(e.raw_version,t.raw_version),d={aarch64:["armv7hf","rpi"],armv7hf:["rpi"]},y=e=>{const t=Object.create(null);for(const{tag_key:r,value:n}of e)t[r]=n;return t},g=(e,t,r)=>{if(null==e){if(r.nextLineVersionRange&&i.satisfies(t,`^${r.nextLineVersionRange}`))return"next";if(r.currentLineVersionRange&&i.satisfies(t,`^${r.currentLineVersionRange}`))return"current";if(r.sunsetLineVersionRange&&i.satisfies(t,`^${r.sunsetLineVersionRange}`))return"sunset";if(r.osType.toLowerCase()===c.ESR)return"outdated"}return"end-of-life"===e?"outdated":e};t.Ay=function(e,t){const{pine:v,request:m,pubsub:b,sdkInstance:w}=e,{apiUrl:_,isBrowser:S}=t,E=(0,a.default)(()=>r(8817).hupActionHelper),O=(0,u.getAuthDependentMemoize)(b),A=e=>{const t={};return e.forEach(e=>{var r,n,o,a;const s=null===(r=e.is_for__device_type[0])||void 0===r?void 0:r.slug;if(!s)return;null!==(n=t[s])&&void 0!==n||(t[s]=[]);const u=(e=>{var t;const r=y(e);return{osType:null!==(t=r["release-policy"])&&void 0!==t?t:c.DEFAULT,nextLineVersionRange:r["esr-next"],currentLineVersionRange:r["esr-current"],sunsetLineVersionRange:r["esr-sunset"]}})(null!==(o=e.application_tag)&&void 0!==o?o:[]);t[s].push(...((e,t)=>{var r,n;const o=Object.keys(f),a=[];for(const s of e){const e=y(s.release_tag),u=s.raw_version.startsWith("0.0.0")?null:i.parse(s.raw_version);let l,c=s.variant;if(null==u){const t=e.variant;if("string"==typeof t&&(c=o.includes(t)?f[t]:t),l=e.version,null==l)continue;s.raw_version=[l,c].filter(e=>!!e).join(".")}else l=[u.version,u.build.filter(e=>e!==s.variant).join(".")].filter(e=>!!e).join("+");const p=null!==(r=g(s.phase,l,t))&&void 0!==r?r:void 0;a.push(Object.assign(Object.assign({},s),{variant:c,osType:t.osType,line:p,strippedVersion:l,basedOnVersion:null!==(n=e["meta-balena-base"])&&void 0!==n?n:l}))}return a})(null!==(a=e.owns__release)&&void 0!==a?a:[],u))}),Object.keys(t).forEach(e=>{t[e].sort(h)}),t},x=async(e,t,r)=>{const n=Object.assign({},("supported"===r||"include_draft"===r)&&{$filter:Object.assign(Object.assign({},"supported"===r&&{is_final:!0}),{is_invalidated:!1,status:"success"})}),i=null!=t?(0,s.mergePineOptions)(t,n):n,o=await(async(e,t={})=>await v.get({resource:"application",options:{$select:"is_for__device_type",$expand:{application_tag:{$select:["tag_key","value"]},is_for__device_type:{$select:"slug"},owns__release:(0,s.mergePineOptions)(p,t)},$filter:{is_host:!0,is_for__device_type:{$any:{$alias:"dt",$expr:{dt:{slug:{$in:e}}}}}}}}))(e,i);return A(o)},R=O(async(e,t)=>await x(e,void 0,t));async function k(e,t){var r;const n=null!=t?Object.entries(t).filter(([e])=>e.startsWith("$")):void 0,i=null!=n&&n.length>0?Object.fromEntries(n):void 0,o="string"==typeof e&&e;e=Array.isArray(e)?e:[e];const a=!0===(null==t?void 0:t.includeDraft)?"include_draft":"supported",s=null==i?await R(e.slice().sort(),a):await x(e,i,a);return o?null!==(r=s[o])&&void 0!==r?r:[]:s}const P=O(async e=>(await w.models.deviceType.get(e,{$select:"slug"})).slug),T=O(async(e,t)=>{const{body:r}=await m.send({method:"GET",url:`/device-types/v1/${e}/images/${t}/download-size`,baseUrl:_});return r.size}),$=function(e,t){var r,n;if("latest"===e)return null===(r=t[0])||void 0===r?void 0:r.raw_version;if("default"===e)return null===(n=t[0])||void 0===n?void 0:n.raw_version;const o=t.map(e=>e.raw_version);if(o.includes(e))return e;return i.maxSatisfying(o,e)},j=(0,s.onlyIf)(!S)(async function(e){var{deviceType:t,version:r="latest"}=e,o=n.__rest(e,["deviceType","version"]);try{const e=await P(t);if("latest"===r){const t=(await k(e)).find(e=>e.osType===c.DEFAULT);if(!t)throw new l.BalenaReleaseNotFound("No version available for this device type");r=t.raw_version}else r=(e=>{if(!e)throw new Error(`Invalid version: ${e}`);if("latest"===e)return e;const t=e.startsWith("v")?e.substring(1):e;if(!i.valid(t)||!/^\d/.test(t))throw new Error(`Invalid semver version: ${e}`);return t})(r);return await m.stream({method:"GET",url:"/download",qs:Object.assign(Object.assign({},o),{deviceType:t,version:r}),baseUrl:_})}catch(e){if((0,s.isNotFoundResponse)(e))throw new Error("No such version for the device type");throw e}});return{_getNormalizedDeviceTypeSlug:P,_getDownloadSize:T,_clearDeviceTypesAndOsVersionCaches:()=>{P.clear(),T.clear(),R.clear()},_getMaxSatisfyingVersion:$,OsTypes:c,getAllOsVersions:async function(e,t){var r;const n="string"==typeof e&&e;e=Array.isArray(e)?e:[e];const i=null==t?await R(e.slice().sort(),"all"):await x(e,t,"all");return n?null!==(r=i[n])&&void 0!==r?r:[]:i},getAvailableOsVersions:k,getMaxSatisfyingVersion:async function(e,t="latest",r){var n;e=await P(e);let i=await k(e);return null!=r&&(i=i.filter(e=>e.osType===r)),null!==(n=$(t,i))&&void 0!==n?n:null},getDownloadSize:async function(e,t="latest"){return e=await P(e),await T(e,t)},download:j,getConfig:async function(e,t){var r;if(!(null==t?void 0:t.version)