@salutejs/jazz-sdk-electron
Version:
Jazz SDK Electron
2 lines (1 loc) • 24.1 kB
JavaScript
"use strict";var t=require("ditox"),r=require("electron"),e=require("nrgy"),n=require("node:fs"),o=require("nrgy/mvc"),i=require("nrgy/rxjs"),u=require("rxjs"),a=require("rx-effects");function c(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function f(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function u(t){c(i,n,o,u,a,"next",t)}function a(t){c(i,n,o,u,a,"throw",t)}u(void 0)}))}}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}var l,p=Object.prototype,h=p.hasOwnProperty,v="function"==typeof Symbol?Symbol:{},d=v.iterator||"@@iterator",y=v.asyncIterator||"@@asyncIterator",g=v.toStringTag||"@@toStringTag";function b(t,r,e,n){var o=r&&r.prototype instanceof S?r:S,i=Object.create(o.prototype),u=new F(n||[]);return i._invoke=function(t,r,e){var n=_;return function(o,i){if(n===O)throw new Error("Generator is already running");if(n===j){if("throw"===o)throw i;return G()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=C(u,e);if(a){if(a===E)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===_)throw n=j,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=O;var c=m(t,r,e);if("normal"===c.type){if(n=e.done?j:w,c.arg===E)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n=j,e.method="throw",e.arg=c.arg)}}}(t,e,u),i}function m(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}var _="suspendedStart",w="suspendedYield",O="executing",j="completed",E={};function S(){}function x(){}function L(){}var P={};P[d]=function(){return this};var T=Object.getPrototypeOf,N=T&&T(T(K([])));N&&N!==p&&h.call(N,d)&&(P=N);var k=L.prototype=S.prototype=Object.create(P);function A(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function D(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===x||"GeneratorFunction"===(r.displayName||r.name))}function I(t,r){function e(n,o,i,u){var a=m(t[n],t,o);if("throw"!==a.type){var c=a.arg,f=c.value;return f&&"object"===s(f)&&h.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,i,u)}),(function(t){e("throw",t,i,u)})):r.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,u)}))}u(a.arg)}var n;this._invoke=function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}}function C(t,r){var e=t.iterator[r.method];if(e===l){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=l,C(t,r),"throw"===r.method))return E;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var n=m(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,E;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=l),r.delegate=null,E):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function M(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function z(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function K(t){if(t){var r=t[d];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e<t.length;)if(h.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=l,r.done=!0,r};return n.next=n}}return{next:G}}function G(){return{value:l,done:!0}}x.prototype=k.constructor=L,L.constructor=x,L[g]=x.displayName="GeneratorFunction",A(I.prototype),I.prototype[y]=function(){return this},A(k),k[g]="Generator",k[d]=function(){return this},k.toString=function(){return"[object Generator]"},F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=l,this.done=!1,this.delegate=null,this.method="next",this.arg=l,this.tryEntries.forEach(z),!t)for(var r in this)"t"===r.charAt(0)&&h.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=l)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=l),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var u=h.call(o,"catchLoc"),a=h.call(o,"finallyLoc");if(u&&a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&h.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o.finallyLoc,E):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),E},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),z(e),E}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;z(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:K(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=l),E}};var R={wrap:b,isGeneratorFunction:D,AsyncIterator:I,mark:function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,L):(t.__proto__=L,g in t||(t[g]="GeneratorFunction")),t.prototype=Object.create(k),t},awrap:function(t){return{__await:t}},async:function(t,r,e,n,o){void 0===o&&(o=Promise);var i=new I(b(t,r,e,n),o);return D(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},keys:function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},values:K},Z={Transport:t.token({key:"JAZZ_SDK_ELECTRON_MAIN_TOKENS_TRANSPORT_TOKEN"}),TransportEndpoints:t.token({key:"JAZZ_SDK_ELECTRON_MAIN_TOKENS_TRANSPORT_ENDPOINTS_TOKEN"})},$=t.token({key:"JAZZ_SDK_MAIN_CONTEXT_TOKEN"});function q(t){var r=function(t,r){if("object"!=s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==s(r)?r:r+""}function J(t,r,e){return(r=q(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function V(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function U(t,r){if(t){if("string"==typeof t)return V(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?V(t,r):void 0}}function Y(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(a.push(n.value),a.length!==r);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,r)||U(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var X=["destroy"];function B(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function W(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?B(Object(e),!0).forEach((function(r){J(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):B(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function H(t){return!t||0===Object.keys(t).length}var Q,tt,rt,et,nt,ot,it,ut,at,ct,ft,st,lt,pt,ht,vt,dt,yt,gt,bt,mt,_t,wt,Ot,jt,Et,St,xt,Lt,Pt,Tt,Nt,kt,At,Dt,It,Ct,Mt,zt,Ft,Kt,Gt,Rt,Zt,$t,qt,Jt,Vt,Ut,Yt,Xt,Bt,Wt,Ht,Qt,tr,rr,er,nr,or,ir,ur,ar,cr,fr,sr,lr,pr,hr,vr,dr,yr,gr,br,mr,_r,wr,Or,jr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Er(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Sr(){if(tt)return Q;tt=1;var t="object"==s(jr)&&jr&&jr.Object===Object&&jr;return Q=t}function xr(){if(et)return rt;et=1;var t=Sr(),r="object"==("undefined"==typeof self?"undefined":s(self))&&self&&self.Object===Object&&self,e=t||r||Function("return this")();return rt=e}function Lr(){if(ot)return nt;ot=1;var t=xr().Symbol;return nt=t}function Pr(){if(ut)return it;ut=1;var t=Lr(),r=Object.prototype,e=r.hasOwnProperty,n=r.toString,o=t?t.toStringTag:void 0;return it=function(t){var r=e.call(t,o),i=t[o];try{t[o]=void 0;var u=!0}catch(t){}var a=n.call(t);return u&&(r?t[o]=i:delete t[o]),a}}function Tr(){if(ct)return at;ct=1;var t=Object.prototype.toString;return at=function(r){return t.call(r)}}function Nr(){if(st)return ft;st=1;var t=Lr(),r=Pr(),e=Tr(),n=t?t.toStringTag:void 0;return ft=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?r(t):e(t)}}function kr(){if(pt)return lt;return pt=1,lt=function(t){var r=s(t);return null!=t&&("object"==r||"function"==r)}}function Ar(){if(vt)return ht;vt=1;var t=Nr(),r=kr();return ht=function(e){if(!r(e))return!1;var n=t(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function Dr(){if(yt)return dt;yt=1;var t=xr()["__core-js_shared__"];return dt=t}function Ir(){if(bt)return gt;bt=1;var t,r=Dr(),e=(t=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return gt=function(t){return!!e&&e in t}}function Cr(){if(_t)return mt;_t=1;var t=Function.prototype.toString;return mt=function(r){if(null!=r){try{return t.call(r)}catch(t){}try{return r+""}catch(t){}}return""}}function Mr(){if(Ot)return wt;Ot=1;var t=Ar(),r=Ir(),e=kr(),n=Cr(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,u=Object.prototype,a=i.toString,c=u.hasOwnProperty,f=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return wt=function(i){return!(!e(i)||r(i))&&(t(i)?f:o).test(n(i))}}function zr(){if(Et)return jt;return Et=1,jt=function(t,r){return null==t?void 0:t[r]}}function Fr(){if(xt)return St;xt=1;var t=Mr(),r=zr();return St=function(e,n){var o=r(e,n);return t(o)?o:void 0}}function Kr(){if(Pt)return Lt;Pt=1;var t=Fr()(Object,"create");return Lt=t}function Gr(){if(Nt)return Tt;Nt=1;var t=Kr();return Tt=function(){this.__data__=t?t(null):{},this.size=0}}function Rr(){if(At)return kt;return At=1,kt=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}}function Zr(){if(It)return Dt;It=1;var t=Kr(),r=Object.prototype.hasOwnProperty;return Dt=function(e){var n=this.__data__;if(t){var o=n[e];return"__lodash_hash_undefined__"===o?void 0:o}return r.call(n,e)?n[e]:void 0}}function $r(){if(Mt)return Ct;Mt=1;var t=Kr(),r=Object.prototype.hasOwnProperty;return Ct=function(e){var n=this.__data__;return t?void 0!==n[e]:r.call(n,e)}}function qr(){if(Ft)return zt;Ft=1;var t=Kr();return zt=function(r,e){var n=this.__data__;return this.size+=this.has(r)?0:1,n[r]=t&&void 0===e?"__lodash_hash_undefined__":e,this}}function Jr(){if(Gt)return Kt;Gt=1;var t=Gr(),r=Rr(),e=Zr(),n=$r(),o=qr();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,Kt=i}function Vr(){if(Zt)return Rt;return Zt=1,Rt=function(){this.__data__=[],this.size=0}}function Ur(){if(qt)return $t;return qt=1,$t=function(t,r){return t===r||t!=t&&r!=r}}function Yr(){if(Vt)return Jt;Vt=1;var t=Ur();return Jt=function(r,e){for(var n=r.length;n--;)if(t(r[n][0],e))return n;return-1}}function Xr(){if(Yt)return Ut;Yt=1;var t=Yr(),r=Array.prototype.splice;return Ut=function(e){var n=this.__data__,o=t(n,e);return!(o<0)&&(o==n.length-1?n.pop():r.call(n,o,1),--this.size,!0)}}function Br(){if(Bt)return Xt;Bt=1;var t=Yr();return Xt=function(r){var e=this.__data__,n=t(e,r);return n<0?void 0:e[n][1]}}function Wr(){if(Ht)return Wt;Ht=1;var t=Yr();return Wt=function(r){return t(this.__data__,r)>-1}}function Hr(){if(tr)return Qt;tr=1;var t=Yr();return Qt=function(r,e){var n=this.__data__,o=t(n,r);return o<0?(++this.size,n.push([r,e])):n[o][1]=e,this}}function Qr(){if(er)return rr;er=1;var t=Vr(),r=Xr(),e=Br(),n=Wr(),o=Hr();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,rr=i}function te(){if(or)return nr;or=1;var t=Fr()(xr(),"Map");return nr=t}function re(){if(ur)return ir;ur=1;var t=Jr(),r=Qr(),e=te();return ir=function(){this.size=0,this.__data__={hash:new t,map:new(e||r),string:new t}}}function ee(){if(cr)return ar;return cr=1,ar=function(t){var r=s(t);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}}function ne(){if(sr)return fr;sr=1;var t=ee();return fr=function(r,e){var n=r.__data__;return t(e)?n["string"==typeof e?"string":"hash"]:n.map}}function oe(){if(pr)return lr;pr=1;var t=ne();return lr=function(r){var e=t(this,r).delete(r);return this.size-=e?1:0,e}}function ie(){if(vr)return hr;vr=1;var t=ne();return hr=function(r){return t(this,r).get(r)}}function ue(){if(yr)return dr;yr=1;var t=ne();return dr=function(r){return t(this,r).has(r)}}function ae(){if(br)return gr;br=1;var t=ne();return gr=function(r,e){var n=t(this,r),o=n.size;return n.set(r,e),this.size+=n.size==o?0:1,this}}function ce(){if(_r)return mr;_r=1;var t=re(),r=oe(),e=ie(),n=ue(),o=ae();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,mr=i}function fe(){if(Or)return wr;Or=1;var t=ce();function r(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,r=n?n.apply(this,t):t[0],i=o.cache;if(i.has(r))return i.get(r);var u=e.apply(this,t);return o.cache=i.set(r,u)||i,u};return o.cache=new(r.Cache||t),o}return r.Cache=t,wr=r}var se=Er(fe());function le(t){return function(t){if(Array.isArray(t))return V(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||U(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function he(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?pe(Object(e),!0).forEach((function(r){J(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):pe(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}var ve=["debug","info","warn","error"];function de(t){return ve.find((function(r){return r===t}))}var ye,ge,be,me,_e={debug:0,info:1,warn:2,error:3},we=Object.create(null),Oe=(ye=1e3,be=-1,me=!1,{append:function(t){ge||(ge=new Array(ye)),me=me||be+1===ye,ge[be=(be+1)%ye]=t},clear:function(){ge=void 0,be=-1,me=!1},getItems:function(){if(!ge||be<0)return[];var t=me?ge.slice(be+2):[],r=ge.slice(0,be+1);return[].concat(le(t),le(r))}});function je(){return Oe.getItems()}var Ee,Se,xe=(Ee=new u.Subject,(Se=function(t){var r=he(he({},t),{},{meta:he(he({},we),t.meta)});Oe.append(r),Ee.next(r)}).event$=Ee.asObservable(),Se);function Le(t,r){return{getLogger:function(e,n){return Le("".concat(t,".").concat(e),he(he({},r),n))},withMeta:function(e){return Le(t,he(he({},r),e))},debug:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];xe({level:"debug",timestamp:Date.now(),tag:t,messages:n,meta:r})},log:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];xe({level:"info",timestamp:Date.now(),tag:t,messages:n,meta:r})},info:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];xe({level:"info",timestamp:Date.now(),tag:t,messages:n,meta:r})},warn:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];xe({level:"warn",timestamp:Date.now(),tag:t,messages:n,meta:r})},error:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];xe({level:"error",timestamp:Date.now(),tag:t,messages:n,meta:r})}}}function Pe(t,r){return se((function(){return Le(t,r)}))}var Te=function(){return{logEvent$:xe.event$,logLevelWeight:_e,createLoggerFactory:Pe,getLogBuffer:je,getLogger:Le,logLevelValues:ve,logMessage:xe,parseLogLevel:de}};function Ne(r){var e,n=r.container,o=r.plugins,i=r.defaultPlugins,c=a.createScope(),s=[].concat(le(i),le(o)),l=(s.length>0?u.zip.apply(void 0,le(s)):u.of([])).pipe(u.tap((function(r){if(0!==r.length){var e=[],o=new Set;le(r).reverse().forEach((function(t){var r=t(),n=r.key,i=r.module;n?o.has(n)||(o.add(n),e.push({module:i,options:{scope:"scoped"}})):e.push({module:i,options:{scope:"scoped"}})})),o.clear(),t.bindModules(n,e),e.forEach((function(t){var r=t.module;n.resolve(r.token)}))}})));return{destroy:function(){c.destroy()},ready:(e=f(R.mark((function t(){return R.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u.firstValueFrom(l);case 2:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})}}function ke(t){var r=t.split("\n"),e={};return r.forEach((function(t){var r,n=Y(t.split("="),2),o=n[0],i=n[1];o&&i&&(e[o.trim().toLowerCase()]=null!==(r=null==i?void 0:i.trim())&&void 0!==r?r:"")})),e}var Ae=function(){var t=void 0,r=function(){var r=f(R.mark((function r(){var e;return R.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=2;break}return r.abrupt("return",t);case 2:if("linux"===process.platform){r.next=4;break}return r.abrupt("return",void 0);case 4:return r.prev=5,r.next=8,n.promises.readFile("/etc/os-release",{encoding:"utf8"}).then(ke);case 8:return e=r.sent,t=e,r.abrupt("return",e);case 13:return r.prev=13,r.t0=r.catch(5),r.abrupt("return",void 0);case 16:case"end":return r.stop()}}),r,null,[[5,13]])})));return function(){return r.apply(this,arguments)}}(),e=void 0;return{getLinuxDistributionInfo:r,getLinuxSessionInfo:function(){if(e)return e;if("linux"===process.platform){var t={desktopSession:process.env.DESKTOP_SESSION,xdgCurrentDesktop:process.env.XDG_CURRENT_DESKTOP,xdgSessionType:process.env.XDG_SESSION_TYPE,waylandDisplay:process.env.WAYLAND_DISPLAY};return e=t,t}},destroy:function(){}}},De="JAZZ_SDK_ELECTRON_IPC_CHANNEL",Ie=o.declareController().params().apply((function(t){var r=t.scope,e=t.params.ipcMain,n=r.signal(),o=i.observe(n),a=function(t,r){n([r,t])};e.on(De,a),r.onDestroy((function(){e.off(De,a)}));var c=new Map,f=function(t){return function(r){var e=Y(r,2),n=e[0],o=e[1];"payload"in n?t(n.payload,o):t(o)}},s=function(t){var r;null===(r=c.get(t))||void 0===r||r.unsubscribe(),c.delete(t)},l={once:function(t,r){var e=o.pipe(u.filter((function(r){return Y(r,1)[0].type===t})),u.take(1)).subscribe(f(r));return function(){return e.unsubscribe()}},subscribe:function(t,r){var e=o.pipe(u.filter((function(r){return Y(r,1)[0].type===t}))).subscribe(f(r));return function(){return e.unsubscribe()}},on:function(t){var r=o.subscribe((function(r){var e=Y(r,2),n=e[0],o=e[1];t(n,o)}));return c.set(t,r),function(){s(t)}},off:s,withType:function(){return l},send:function(t,r){t.webContents.send(De,r)}};return l})),Ce=o.declareController().params().apply((function(t){var r=t.scope,e=t.params.transport,n=new Set,o=new Map;r.onDestroy(e.on((function(t,r){"registerEndpoint"===t.type&&(o.has(r.frameId)||o.set(r.frameId,t.payload.endpointName)),i(r.frameId,t)})));var i=function(t,r){n.forEach((function(n){t!==n.id&&(r.to?o.get(n.id)===r.to&&e.send(n,r):e.send(n,r))}))};return{register:function(t){return n.add(t),function(){n.delete(t)}},unregister:function(t){var r=o.get(t.id);r&&i(t.id,{type:"unregisterEndpoint",payload:{endpointName:r}}),o.delete(t.id),n.delete(t)}}})),Me=function(){var n=f(R.mark((function n(){var o,i,u,a,c,f,s,l,p,h,v,d=arguments;return R.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=d.length>0&&void 0!==d[0]?d[0]:{},u=e.createScope(),a=null!==(o=i.container)&&void 0!==o?o:t.createContainer(),c=Te(),f=c.getLogger("SDK_MAIN"),s=u.add(Ae()),l=u.add(new Ie({ipcMain:r.ipcMain})),p=u.add(new Ce({transport:l})),h={logger:f,logs:c,platform:s,transport:l,transportEndpoints:p},a.bindValue($,h),a.bindValue(Z.Transport,l),a.bindValue(Z.TransportEndpoints,p),v=u.add(Ne({logger:f,container:a,plugins:i.plugins||[],defaultPlugins:[]})),n.next=15,v.ready();case 15:return f.debug("Sdk started"),n.abrupt("return",{destroy:u.destroy,container:a});case 17:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();exports.DEFAULT_PLUGINS=[],exports.JAZZ_SDK_MAIN_CONTEXT_TOKEN=$,exports.JazzSdkElectronMainTokens=Z,exports.TransportEndpointsController=Ce,exports.createEventBus=function(){return a.createAction()},exports.createJazzSdkElectronMain=Me,exports.createLogs=Te,exports.createModule=function(r){var n=r.factory,o=r.exports,i=r.imports,u=void 0===i?{}:i,a=r.token,c=r.name,f=Object.entries(u).reduce((function(r,e){var n=Y(e,2),o=n[0],i=n[1];return t.isToken(i)?r.deps[o]=i:(r.imports.push(i),r.deps[o]=i.token),r}),{deps:{},imports:[]});return function(){return{module:t.declareModule({token:a,factory:function(r){var o=e.createScope(),i=n({scope:o,container:r,deps:H(f.deps)?void 0:t.resolveValue(r,f.deps),name:c}),u=i.destroy;return W(W({},function(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.includes(n))continue;e[n]=t[n]}return e}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.includes(e)||{}.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}(i,X)),{},{destroy:function(){null==u||u(),o.destroy()}})},exports:o,imports:f.imports}),key:c}}},exports.createPluginsController=Ne,exports.filterByType=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n=function(t){return r.includes(t.type)};return function(t){return t.pipe(u.filter(n))}};