@olympeio/runtime-node 9.11.9 → 9.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -251,31 +251,31 @@ ea('Object.fromEntries',function(a){return a?a:function(b){var c={};if(!(Symbol.
|
|
|
251
251
|
function wa(a,b){a=void 0!==a?String(a):' ';return 0<b&&a?a.repeat(Math.ceil(b/a.length)).substring(0,b):''}ea('String.prototype.padStart',function(a){return a?a:function(b,c){var d=va(this);return wa(c,b-d.length)+d}});ea('String.prototype.padEnd',function(a){return a?a:function(b,c){var d=va(this);return d+wa(c,b-d.length)}});
|
|
252
252
|
ea('Promise.allSettled',function(a){function b(d){return{status:'fulfilled',value:d}}function c(d){return{status:'rejected',reason:d}}return a?a:function(d){var e=this;d=Array.from(d,function(f){return e.resolve(f).then(b,c)});return e.all(d)}});ea('Object.values',function(a){return a?a:function(b){var c=[],d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&c.push(b[d]);return c}});
|
|
253
253
|
ea('Array.prototype.flatMap',function(a){return a?a:function(b,c){for(var d=[],e=0;e<this.length;e++){var f=b.call(c,this[e],e,this);Array.isArray(f)?d.push.apply(d,f):d.push(f)}return d}});ea('Array.prototype.flat',function(a){return a?a:function(b){b=void 0===b?1:b;for(var c=[],d=0;d<this.length;d++){var e=this[d];Array.isArray(e)&&0<b?(e=Array.prototype.flat.call(e,b-1),c.push.apply(c,e)):c.push(e)}return c}});var xa=this||self;
|
|
254
|
-
function w(a,b){a=a.split('.');let c=xa;a[0]in c||'undefined'==typeof c.execScript||c.execScript('var '+a[0]);for(let d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};const olympe={
|
|
255
|
-
const Ca=console.trace,Da=console.debug,Ea=console.log,Fa=console.info,Ga=console.warn,Ha=console.error;console.trace=(...a)=>Ca.call(console,Ba('TRACE',a));console.debug=(...a)=>Da.call(console,Ba('DEBUG',a));console.log=(...a)=>Ea.call(console,Ba('LOG',a));console.info=(...a)=>Fa.call(console,Ba('INFO',a));console.warn=(...a)=>Ga.call(console,Ba('WARN',a));console.error=(...a)=>Ha.call(console,Ba('ERROR',a));olympe.Xa={};olympe.Xa.node={};olympe.V={};olympe.V.Of={};olympe.V.Of.
|
|
256
|
-
olympe.V
|
|
254
|
+
function w(a,b){a=a.split('.');let c=xa;a[0]in c||'undefined'==typeof c.execScript||c.execScript('var '+a[0]);for(let d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};const olympe={de:()=>'object'===typeof window?window:'object'===typeof global?global:self};if('olympe'in olympe.de())throw Error('The olympe runtime is loaded more than once. Make sure not to import `@olympeio/runtime-web` or `@olympeio/runtime-node` explicitly, and to always use the `olympe` alias.');olympe.de().olympe=olympe;olympe.aF=(a,...b)=>{b.forEach(c=>{Object.getOwnPropertyNames(c.prototype).forEach(d=>{'constructor'!==d&&void 0===a.prototype[d]&&(a.prototype[d]=c.prototype[d])})})};const za=require('util');function Aa(a){if('string'===typeof a)return a;let b=a;'function'===typeof(null==a?void 0:a.toJSON)&&(b=a.toJSON());let c,d;return'function'===typeof(null==(c=b)?void 0:c.toString)&&(null==(d=b)?void 0:d.toString)!==Object.prototype.toString?b.toString():za.inspect(b,{maxStringLength:1E4,depth:null,breakLength:Infinity})}function Ba(a,b){return JSON.stringify({level:a,message:b.map(Aa).join(' ')})}
|
|
255
|
+
const Ca=console.trace,Da=console.debug,Ea=console.log,Fa=console.info,Ga=console.warn,Ha=console.error;console.trace=(...a)=>Ca.call(console,Ba('TRACE',a));console.debug=(...a)=>Da.call(console,Ba('DEBUG',a));console.log=(...a)=>Ea.call(console,Ba('LOG',a));console.info=(...a)=>Fa.call(console,Ba('INFO',a));console.warn=(...a)=>Ga.call(console,Ba('WARN',a));console.error=(...a)=>Ha.call(console,Ba('ERROR',a));olympe.Xa={};olympe.Xa.node={};olympe.V={};olympe.V.Of={};olympe.V.Of.Qo=class{process(a){for(const b of Object.keys(a.Ee))if(a.wd(b).Qn())throw Error('Service "'+b+'" is defined as abstract and needs to be overridden');}};olympe.V.Of.Qo.ya=[olympe.V.Of.hr];olympe.V.Of.Ro=class{process(a){function b(e,f){if(f.includes(e))throw Error('Circular dependency detected: '+f.join(' > ')+' > '+e);if(d.has(e)){f=f.concat(e);d.delete(e);e=a.wd(e);c(e.zj(),f);for(const g of Ia(e))c(g.zj(),f)}}function c(e,f){for(const g of e)g instanceof olympe.V.qb&&b(g.T(),f)}const d=new Set(Object.keys(a.Ee));for(const e of d)b(e,[])}};olympe.V.Of.Ro.ya=[olympe.V.Of.hr];olympe.V.Of.hr=class{process(){}};const Ja=[],Ka=[];function La(a){const b=a.Wa();b.debug('Registering configurations...');b.j++;Ja.forEach(c=>{B(a.G,'Registering configure callback '+(c.j?'for module '+c.j:''));a.H.push(c.D)});Ma(b);b.debug('done registering')}function Na(a){const b=a.Wa();b.debug('Running run callbacks of container...');b.j++;Ka.forEach(c=>{const d=Oa(a,c.zj());a.G.debug('Calling run callback '+`for module ${c.j}`);c.D.apply(null,d)});Ma(b);b.debug('done calling run callbacks. DI process completed!')}
|
|
256
|
+
olympe.V.Wo=class{constructor(){}static j(a,b){Ja.push(new olympe.V.Vl(a,b))}static D(a,b,c){a.forEach(d=>{if(null===d||void 0===d)throw Error('Cannot proceed - DI configuration error. '+(c?`Run callback "${c}"`:'A run callback')+' cannot have a null or undefined dependency');});Ka.push(new olympe.V.Vl(b,c,a))}};olympe.V.config=olympe.V.Wo.j;olympe.V.run=olympe.V.Wo.D;olympe.V.Ss=a=>{const b=new Map,c=(d,e)=>{for(const [f,g]of Object.entries(d))d=e.concat((f.startsWith('#')?f.substring(1):f).toLowerCase()),'object'!==typeof g||null===g||f.startsWith('#')?b.set(d.join('.'),g):c(g,d)};c(a,[]);return b};olympe.V.Uj=class{constructor(){}getValue(){}};function Pa(a,b){let c,d;return null!=(d=null==(c=a.F)?void 0:c.call(a,b))?d:!0}olympe.V.Vl=class{constructor(a,b,c){this.D=a;this.Vd=(null!=c?c:[]).map(d=>'string'===typeof d?new olympe.V.qb(d):d);this.j=null!=b?b:'no name di callback';this.F=null}zj(){return this.Vd}};function Ra(a,b){var c=olympe.V.P.Eg;if(void 0!==a.j[c])throw Error('Service "'+c+'" has already been instantiated');a.j[c]=b}function Sa(a,b,c){let d=a.j[b];if(void 0===d){const e=a.H[b];if(void 0===e){if(c===olympe.V.Ah.j.Gm)return null;throw Error('Service "'+b+'" not found');}try{d=e.instantiate(a)}catch(f){throw a.G.error('Error during instantiation of service '+b),f;}!e.F&&(a.j[b]=d)}return d}
|
|
257
257
|
function Ta(a,b,c){b=b.toLowerCase();let d;const e=null!=(d=a.D.get(b))?d:[];e.push(c);a.D.set(b,e)}function Oa(a,b){const c=b.length,d=Array(c);let e,f;for(e=0;e<c;e++)a.G.j++,f=b[e],d[e]=f instanceof olympe.V.Uj?f.getValue(a):f,Ma(a.G);return d}
|
|
258
|
-
olympe.V.Ah=class{constructor(a,b,c,d,e=2){this.H=a;this.F=b;this.parameters=c;this.j=Object.create(null);this.G=new olympe.V.
|
|
259
|
-
(d=null==(c=this.D.get(a))?void 0:c.length)?d:0} listeners.`);this.parameters[a]=b;var e;for(const f of null!=(e=this.D.get(a))?e:[])f(b)}}};olympe.V.Ah.j={
|
|
258
|
+
olympe.V.Ah=class{constructor(a,b,c,d,e=2){this.H=a;this.F=b;this.parameters=c;this.j=Object.create(null);this.G=new olympe.V.wq(e);this.D=new Map;Ra(this,this);this.G.debug('Instantiate all computed parameters');d.forEach(f=>Sa(this,f).subscribe(this.Ai.bind(this,f)))}Wa(){return this.G}getParameter(a){a=a.toLowerCase();let b;return null!=(b=this.parameters[a])?b:this.F[a]}Ai(a,b){a=a.toLowerCase();if(this.parameters[a]!==b){var c,d;this.G.debug(`Updating parameter ${a} to ${b} and notify ${null!=
|
|
259
|
+
(d=null==(c=this.D.get(a))?void 0:c.length)?d:0} listeners.`);this.parameters[a]=b;var e;for(const f of null!=(e=this.D.get(a))?e:[])f(b)}}};olympe.V.Ah.j={nu:'exception',Gm:'null'};function Ua(a,b){b=olympe.V.Ss(b);for(const [c,d]of b)a.setParameter(c,d)}function C(a,b,c,...d){B(a.G,'Defining service '+b);a.j(b,c,d,!1,!1)}function Va(a,b,c,...d){B(a.G,'Defining service '+b);a.j(b,c,d,!1,!0)}function D(a,b,c,d,e=!1){B(a.G,'Defining service (as a factory) '+b);a.j(b,d,c,!0,e)}function Wa(a,b,c,d=!1){B(a.G,'Defining service alias '+b);a.j(b,e=>e,[c],!0,d)}function Xa(a,b){B(a.G,'Defining abstract service '+b);a.j(b).D=!0}
|
|
260
260
|
function Ya(a,b,c,d){a.F.push(b);a.setParameter(b,d(...c.map(e=>a.getParameter(e))));D(a,b,c.map(e=>new olympe.V.Dh(e)),(...e)=>rxjs.combineLatest(e).pipe(rxjs.operators.skip(1),rxjs.operators.map(f=>d(...f)),rxjs.operators.distinctUntilChanged()))}function E(a,b,c){a.D[b.toLowerCase()]=c}
|
|
261
|
-
olympe.V.
|
|
262
|
-
var g=this.
|
|
263
|
-
{B(this.G,'Calling callback');this.G.j++;b(this);Ma(this.G)});Ma(this.G);this.G.debug('Configuration summary: '+Object.keys(this.
|
|
264
|
-
olympe.V.
|
|
265
|
-
(null==(g=this.j)?void 0:g.size)){b.j++;B(b,'Calling configuration callbacks:');for(const h of this.j.values())b.j++,B(b,'Check if need to call additional configuration callback '+h.j),Pa(h,f)?(B(b,'Calling additional configuration callback '+h.j),d=Oa(a,h.zj()),d.push(f),h.D.apply(null,d)):B(b,'Will not call additional configuration callback '+h.j+'predicate has returned false'),Ma(b);Ma(b)}B(b,'Done instantiating '+this.id);return f}zj(){return this.Vd}
|
|
266
|
-
this.j&&(this.j=new Map);var f=this.j,g=f.set;b=new olympe.V.
|
|
267
|
-
olympe.U.
|
|
268
|
-
olympe.U.
|
|
269
|
-
olympe.U.
|
|
270
|
-
olympe.U.Zh=class{constructor(a){this.j=gb(new olympe.U.
|
|
261
|
+
olympe.V.du=class{constructor(a,b){this.Ee=Object.create(null);this.parameters=Object.create(null);this.D=Object.create(null);this.F=[];Ua(this,a);Ua(this,b);this.R=[new olympe.V.Of.Qo,new olympe.V.Of.Ro];this.H=[];a=this.getParameter(olympe.V.Config.vv);this.N=void 0!==a?a:3;this.G=new olympe.V.wq(this.N)}Wa(){return this.G}j(a,b,c,d,e){const f=a instanceof olympe.V.qb?a.T():a;if(3<=arguments.length&&c){const h=c.indexOf(f);if(-1!==h){if(void 0===this.Ee[f])throw Error(`ContainerBuilder.define: Service ${f} references itself and is not an override definition!`);
|
|
262
|
+
var g=this.Ee[f];g.id=g.id+'!!'+ ++olympe.V.gm.j;g.F=!0;g=g.id;c[h]=g;this.Ee[g]=this.Ee[f]}}this.Ee[f]=new olympe.V.gm(b,c,d||!1,f);return this.Ee[f]}setParameter(a,b){this.parameters[a.toLowerCase()]=b}wd(a){const b=this.Ee[a];if(void 0===b)throw Error(`DI Error: Definition ${a} was not found`);return b}getParameter(a){a=a.toLowerCase();let b;return null!=(b=this.parameters[a])?b:this.D[a]}compile(){const a=this.H;this.G.debug('Calling '+a.length+' configure callbacks');this.G.j++;a.forEach(b=>
|
|
263
|
+
{B(this.G,'Calling callback');this.G.j++;b(this);Ma(this.G)});Ma(this.G);this.G.debug('Configuration summary: '+Object.keys(this.Ee).length+' definitions');this.G.debug('Compiling...');this.G.j++;this.R.forEach((b,c)=>{this.G.debug('running compilation pass '+(c+1)+': '+b.constructor.name);b.process(this)});Ma(this.G);this.G.debug('Compilation done, returning container');return new olympe.V.Ah(this.Ee,this.D,this.parameters,this.F,this.N)}};function Ia(a){let b,c;return null!=(c=null==(b=a.j)?void 0:b.values())?c:[]}
|
|
264
|
+
olympe.V.gm=class{constructor(a,b,c,d){this.H=a||null;this.N=!!c;this.Vd=(null!=b?b:[]).map(e=>'string'===typeof e?new olympe.V.qb(e):e);this.D=!1;this.j=null;this.id=null!=d?d:'';this.F=!1}T(){return this.id}instantiate(a){const b=a.Wa();b.debug('Resolving arguments for '+this.id);const c=this.H;let d=Oa(a,this.Vd);const e=()=>{if(this.N)return c.apply(null,d);d.unshift(null);return new (c.bind.apply(c,d))};B(b,'Instantiating '+this.id);const f=olympe.C?olympe.C.kh().run(()=>e()):e();let g;if(0<
|
|
265
|
+
(null==(g=this.j)?void 0:g.size)){b.j++;B(b,'Calling configuration callbacks:');for(const h of this.j.values())b.j++,B(b,'Check if need to call additional configuration callback '+h.j),Pa(h,f)?(B(b,'Calling additional configuration callback '+h.j),d=Oa(a,h.zj()),d.push(f),h.D.apply(null,d)):B(b,'Will not call additional configuration callback '+h.j+'predicate has returned false'),Ma(b);Ma(b)}B(b,'Done instantiating '+this.id);return f}zj(){return this.Vd}Qn(){return this.D}config(a,b,c,d,e){null===
|
|
266
|
+
this.j&&(this.j=new Map);var f=this.j,g=f.set;b=new olympe.V.Vl(c,e,b);b.F=d;g.call(f,a,b)}};olympe.V.gm.j=0;olympe.V.Dh=class extends olympe.V.Uj{constructor(a){super();this.id=a}T(){return this.id}getValue(a){return new rxjs.Observable(b=>{b.next(a.getParameter(this.id));Ta(a,this.id,c=>b.next(c))})}};function Ma(a){0<a.j&&a.j--}function B(a,b){1>=a.D&&Za(a,'log','DI: '+b)}function Za(a,b,c){if(console&&console[b]){var d='';for(let e=0;e<a.j;e++)d+=' ';console[b](d+c)}}olympe.V.wq=class{constructor(a){this.D=a;this.j=0}debug(a){2>=this.D&&Za(this,'log','DI: '+a)}info(a){3>=this.D&&Za(this,'info','DI: '+a)}warn(a){4>=this.D&&Za(this,'warn','DI: '+a)}error(a){5>=this.D&&Za(this,'error','DI: '+a)}};olympe.V.oa=class extends olympe.V.Uj{constructor(a){super();this.id=a}T(){return this.id}getValue(a){return a.getParameter(this.id)}};olympe.V.qb=class extends olympe.V.Uj{constructor(a,b){super();this.id=a;this.j=b||olympe.V.Ah.j.nu}T(){return this.id}getValue(a){return Sa(a,this.id,this.j)}};olympe.V.P={Eg:'di.Container',JC:'di.PublicContainer'};olympe.V.Config={vv:'logging.di'};olympe.V.run([olympe.V.P.Eg],a=>{olympe.V.getParameter=b=>a.getParameter(b);olympe.V.Ai=(b,c)=>a.Ai(b,c);olympe.de().getConfig=b=>a.getParameter(b);olympe.de().getConfigNames=()=>Array.from(new Set([...Object.keys(a.parameters),...Object.keys(a.F)]));olympe.de().updateConfig=(b,c)=>a.Ai(b,c)});olympe.U={};olympe.U.kq=class{constructor(a){this.id=a||olympe.U.kq.j++}Ea(a){return a?this.id===a.id:!1}toJSON(){return this.id.toString()}toString(){return this.id.toString()}print(){return('000000'+this.id).substr(-6)}};olympe.U.kq.j=0;olympe.U.mC=class{constructor(a,b,c,d,e,f){this.j=[a||0,b||0,0,c||0,d||0,0,e||0,f||0,1]}set(a,b,c){this.j[3*a+b]=c}get(a,b){return this.j[3*a+b]}};olympe.U.Nh=function(a,b,c,d,e,f,g,h,k,l,n,p,q){this.values=[a,b,c,0,0,d,e,f,0,0,g,h,k,0,0,l,n,p,q,0]};olympe.U.Nh.D=function(a){return new olympe.U.Nh(.213+.787*a,.715-.715*a,.072-.072*a,.213-.213*a,.715+.285*a,.072-.072*a,.213-.213*a,.715-.715*a,.072+.928*a,0,0,0,1)};olympe.U.Nh.j=function(){return new olympe.U.Nh(0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0)};olympe.U.Nh.prototype.set=function(a,b,c){this.values[5*a+b]=c};olympe.U.Nh.prototype.get=function(a,b){return this.values[5*a+b]};function $a(a){return(new TextEncoder).encode(a)}function ab(a,b){return a.j($a(b))}function bb(a){return(new TextDecoder('utf8')).decode(a)}function cb(a){const b=new olympe.U.stream.mg;for(let c=0;c<a.length;c+=65536){const d=c+65536;b.write(a.subarray(c,d>a.length?a.length:d))}b.complete();return b}
|
|
267
|
+
olympe.U.Ml=class{D(){}j(){}H(a){return u(function*(){if(a instanceof ArrayBuffer)return new Uint8Array(a);if(a instanceof Uint8Array)return a;if('string'===typeof a)return $a(a);if(a instanceof Blob)return new Uint8Array(yield a.arrayBuffer());if(a instanceof olympe.U.stream.mg){const b=[];for(const c=ha(a);;){const d=yield c.next();if(d.done)break;b.push(...d.value)}return new Uint8Array(b)}throw Error('Unsupported value type for binary conversion.');})}F(){}};
|
|
268
|
+
olympe.U.zs=a=>a.replace('+','-').replace('/','_');olympe.U.ux=a=>a.replace('-','+').replace('_','/');function eb(a){a.j=setTimeout(()=>{const b=Date.now(),c=a.timeout;for(const [d,e]of a.values)b-e>c&&(a.delete(d),a.D&&a.D(d));if(0<a.values.size)eb(a);else{let d;null==(d=a.F)||d.call(a)}},a.H)}function fb(a,b){return a.values.has(b)?(a.values.set(b,Date.now()),!0):!1}function gb(a,b){a.D=b;return a}
|
|
269
|
+
olympe.U.fn=class{constructor(a,b=a/2){this.timeout=a;this.H=b;this.values=new Map;this.F=this.D=this.j=null}add(a){this.values.set(a,Date.now());null===this.j&&eb(this)}has(a){return this.values.has(a)}forEach(a){this.values.forEach((b,c)=>a(c))}delete(a){a=this.values.delete(a);if(0===this.values.size){this.j&&clearTimeout(this.j);this.j=null;let b;null==(b=this.F)||b.call(this)}return a}clear(){this.j&&clearTimeout(this.j);this.j=null;this.values.clear();return this}};function hb(a,b){a.D=b;return a}function ib(a,b){a.j.F=b}
|
|
270
|
+
olympe.U.Zh=class{constructor(a){this.j=gb(new olympe.U.fn(a,void 0),b=>{const c=this.values.get(b);this.values.delete(b);let d;null==(d=this.D)||d.call(this,b,c)});this.values=new Map;this.D=null}set(a,b){this.values.set(a,b);this.j.add(a);return this}has(a){return this.values.has(a)}get(a){return this.values.get(a)}forEach(a){this.values.forEach((b,c)=>a(b,c))}delete(a){this.values.delete(a);return this.j.delete(a)}clear(){this.j.clear();this.values.clear();return this}};function F(a,b,...c){if(!a.N)throw Error('Cannot update state before starting the state machine');if(!a.R.has(b))throw Error(`State ${b} not found`);var d;let e;var f=null!=(e=null==(d=a.D[a.D.length-1])?void 0:d.state)?e:a.F.getValue();if(null!==f){if(f===b){a.G.debug(`Move request is a no-op, state ${b} is already active or queued`);return}d=a.X.get(b);if(null!==d&&!d.has(f)){F(a,a.j,Error(`Cannot move to state ${b} from state ${f}`));return}}a.G.debug(`Plan moving to state ${b}, from state ${f}`);
|
|
271
271
|
b===a.j&&(a.G.debug("Clear transition's queue to move to error state"),a.D=[]);a.D.push({state:b,Vd:c});1===a.D.length&&jb(a).then()}function kb(a,b,c){a.H.has(b)||a.H.set(b,new Set);a.H.get(b).add(c)}
|
|
272
272
|
function lb(a,b){let c=null;return(new Promise((d,e)=>{if(a.F.getValue()===b)d();else if(a.F.getValue()===a.j)e(Error(`Error state reached: ${a.j}`));else{c=()=>{let h;null==(h=a.H.get(b))||h.delete(f);let k;null==(k=a.H.get(a.j))||k.delete(g)};const f=()=>d(),g=()=>e(Error('Reached error state'));kb(a,b,f);kb(a,a.j,g)}})).finally(()=>{let d;return null==(d=c)?void 0:d()})}
|
|
273
273
|
function mb(a,b,c=()=>{},d=null){if(a.N)throw Error('Cannot add state after starting the state machine');if(a.R.has(b))throw Error(`State ${b} already exists`);a.R.set(b,c);a.X.set(b,d?new Set(d):null)}function nb(a,b,c){mb(a,b,(d,e)=>u(function*(){try{yield c(d,e)}catch(f){a.G.error(`Error while processing error state ${b}: ${f}`)}}),null);a.j=b}
|
|
274
274
|
function jb(a){return u(function*(){if(0!==a.D.length){var {state:b,Vd:c}=a.D[0],d=a.F.getValue();try{a.G.debug(`Start processing transition ${d} -> ${b}`);yield a.R.get(b)(d,...c);a.F.next(b);a.D.shift();a.G.debug(`New state reached: ${b}`);let e;null==(e=a.H.get(b))||e.forEach(f=>f());jb(a).then()}catch(e){a.G.debug(`Error while processing transition ${d} -> ${b}: ${e}`),F(a,a.j,e)}}})}
|
|
275
|
-
olympe.U.
|
|
276
|
-
olympe.U.
|
|
277
|
-
olympe.U.Promise.
|
|
278
|
-
olympe.U.promise.
|
|
275
|
+
olympe.U.Fw=class{constructor(a){this.G=a;this.N=!1;this.F=new rxjs.BehaviorSubject(null);this.R=new Map;this.X=new Map;this.j=null;this.D=[];this.H=new Map}start(a,...b){if(this.N)throw Error('State machine already started');if(null===this.j)throw Error('Error state not defined: all state machines should have an error state');this.N=!0;F(this,a,...b)}getState(){if(!this.N)throw Error('State machine not started');return this.F.getValue()}};function ob(a,b){a.R.push(b)}function pb(a,b){a.X.push(b)}function qb(a,b){let c;'object'!==typeof b&&'function'!==typeof b?c=b:b instanceof olympe.dc.CloudObject?c=b.toJSON():Array.isArray(b)?c=b.map(d=>qb(a,d)):c='N/A';return c}function rb(a,b,c,d){b={cat:b,epoch:null!=d?d:performance.now()-a.D};let e;for(const [f,g]of null!=(e=c)?e:[])b[f]=qb(a,g);a.F.push(b)}
|
|
276
|
+
olympe.U.cw=class{constructor(){this.F=[];this.R=[];this.X=[];this.N=new Map;this.H=new Map;this.j=!1;this.D=null}start(){this.j||(this.D||(this.D=performance.now()),this.j=!0,this.R.forEach(a=>a()))}stop(){this.j&&(this.X.forEach(a=>a()),this.j=!1)}};function sb(a,b,c=5E3){return rxjs.operators.retry({resetOnSuccess:!0,delay:(d,e)=>{if(d instanceof a){const f=Math.round(Math.random()*(e+1)*c);return rxjs.timer(f).pipe(rxjs.operators.tap(()=>null==b?void 0:b(d,f)))}return rxjs.throwError(()=>d)}})}olympe.U.operators={AF(a,b=0){return c=>c.pipe(rxjs.operators.map((d,e)=>{e===b&&a(d);return d}))}};olympe.U.Promise={};olympe.U.Promise.uj=function(a,b){let c=null;return(...d)=>new Promise((e,f)=>{clearTimeout(c);c=setTimeout(()=>u(function*(){try{const g=yield a(...d);e(g)}catch(g){f(g)}}),b)})};olympe.U.Promise.$f=function(a,b,c='Promise timeout'){return new Promise((d,e)=>{const f=setTimeout(()=>{e(Error(c))},b);a.then(g=>{clearTimeout(f);d(g)}).catch(g=>{clearTimeout(f);e(g)})})};
|
|
277
|
+
olympe.U.Promise.rt=function(a,b,c=null){return u(function*(){for(let d=0;3>d;d++)try{return yield a(d)}catch(e){let f;if(2<=d||null!==c&&(null==(f=c)||!f.some(g=>e instanceof g)))throw e;yield new Promise(g=>setTimeout(g,b))}})};olympe.U.promise={};function tb(a){if(0===a.size())a.D.next(!1);else if(a.F()){a.j++;var b=ub(a);b&&b.j.call(a).then(c=>{b.resolve(c)}).catch(c=>{b.reject(c)}).finally(()=>{a.j--;0===a.size()&&a.D.next(!1);tb(a)})}}function vb(a,b){return new Promise((c,d)=>{a.Ga.push(new olympe.U.promise.Ew(c,d,b));tb(a)})}function ub(a){a.D.next(!0);let b;return null!=(b=a.Ga.shift())?b:null}
|
|
278
|
+
olympe.U.promise.Tk=class{constructor(){this.Ga=[];this.D=new rxjs.BehaviorSubject(!1);this.j=0}F(){return 0===this.j}clear(){for(;0<this.Ga.length;)this.Ga.shift().reject(Error('Canceled by a clearStack'));tb(this)}size(){return this.Ga.length}};olympe.U.promise.Ew=class{constructor(a,b,c){this.resolve=a;this.reject=b;this.j=c}};olympe.U.promise.Xr=class extends olympe.U.promise.Tk{constructor(a){super();if('number'!==typeof a||0>=a)throw Error('StackWindow with an invalid concurrentLimit. It must be a number > 0 for the stack to work properly');this.Hj=a}F(){return this.j<this.Hj}};olympe.U.promise.dE=class{constructor(a,...b){this.F=a;this.parameters=b;this.j=this.D=null;this.promise=new Promise((c,d)=>{this.D=c;this.j=d});this.start()}then(a){return this.promise.then(a)}catch(a){return this.promise.catch(a)}finally(a){return this.promise.finally(a)}start(){'undefined'!==typeof Worker?setTimeout(()=>{const a=URL.createObjectURL(new Blob([`
|
|
279
279
|
function onFullfilledCallback(data) {
|
|
280
280
|
self.postMessage({ type: "done", data, });
|
|
281
281
|
self.close();
|
|
@@ -288,964 +288,961 @@ olympe.U.promise.Uk=class{constructor(){this.Ha=[];this.D=new rxjs.BehaviorSubje
|
|
|
288
288
|
(${this.F.toString()})(onFullfilledCallback, onRejectedCallback, ...(params ?? []));
|
|
289
289
|
};`])),b=new Worker(a);b.addEventListener('message',c=>{const {data:d,type:e}=c.data;URL.revokeObjectURL(a);b.terminate();if('done'===e){let f;null==(f=this.D)||f.call(this,d)}else{let f;null==(f=this.j)||f.call(this,d)}});b.postMessage({params:this.parameters})},0):this.F(this.D,this.j,...this.parameters)}};olympe.U.stream={};olympe.U.stream.mg=class{constructor(){this.buffer=[];this.F=this.j=!1;this.error=this.D=null}[Symbol.asyncIterator](){const a=this;return new oa(function*(){if(a.F)throw Error('This stream is already being read');for(a.F=!0;!a.error&&(!a.j||0<a.buffer.length);)0===a.buffer.length&&(yield new ja(2,new Promise(b=>{a.D=()=>b()}))),!a.error&&0<a.buffer.length&&(yield new ja(0,a.buffer.shift()));if(a.error)throw a.error;}())}write(a){const b=this;return u(function*(){if(null===a||void 0===a)throw Error('Try to stream null or undefined');
|
|
290
290
|
if(b.j)throw Error('Cannot write to a completed stream');b.buffer.push(a);let c;null==(c=b.D)||c.call(b)})}pipeTo(a){return new Promise(b=>{const c=this;return u(function*(){try{for(const d=ha(c);;){const e=yield d.next();if(e.done)break;yield a.write(e.value)}a.complete()}catch(d){a.throw(d)}finally{b()}})})}map(a){const b=new olympe.U.stream.mg;this.pipeTo({write:c=>u(function*(){yield b.write(a(c))}),complete:()=>{b.complete()},throw:c=>{b.throw(c)}}).catch(()=>{});return b}concat(a){const b=new olympe.U.stream.mg;
|
|
291
|
-
this.pipeTo({write:c=>u(function*(){yield b.write(c)}),complete:()=>{a.pipeTo(b).then(()=>{b.complete()})},throw:c=>{b.throw(c)}}).catch(()=>{});return b}throw(a){this.j||(this.error=a,this.complete())}complete(){if(!this.j){this.j=!0;let a;null==(a=this.D)||a.call(this)}}};olympe.U.stream.mg.ya=[olympe.U.stream.ReadableStream,olympe.U.stream.WritableStream];olympe.U.stream.ReadableStream=class{[Symbol.asyncIterator](){return new oa(function*(){}())}pipeTo(){}map(){}concat(){}};function wb(a,b){const c=new Worker(a.j),d=new TransformStream;c.addEventListener('message',({data:e})=>{e.pipeTo(d.writable).finally(()=>{c.terminate()})},{once:!0});c.postMessage(b,[b]);return d.readable}olympe.U.stream.
|
|
292
|
-
const transformedStream = (${olympe.U.stream.
|
|
291
|
+
this.pipeTo({write:c=>u(function*(){yield b.write(c)}),complete:()=>{a.pipeTo(b).then(()=>{b.complete()})},throw:c=>{b.throw(c)}}).catch(()=>{});return b}throw(a){this.j||(this.error=a,this.complete())}complete(){if(!this.j){this.j=!0;let a;null==(a=this.D)||a.call(this)}}};olympe.U.stream.mg.ya=[olympe.U.stream.ReadableStream,olympe.U.stream.WritableStream];olympe.U.stream.ReadableStream=class{[Symbol.asyncIterator](){return new oa(function*(){}())}pipeTo(){}map(){}concat(){}};function wb(a,b){const c=new Worker(a.j),d=new TransformStream;c.addEventListener('message',({data:e})=>{e.pipeTo(d.writable).finally(()=>{c.terminate()})},{once:!0});c.postMessage(b,[b]);return d.readable}olympe.U.stream.ax=class{constructor(){this.j=URL.createObjectURL(new Blob([`self.onmessage = ({ data: stream }) => {
|
|
292
|
+
const transformedStream = (${olympe.U.stream.Ak.toString()}).transform(stream);
|
|
293
293
|
self.postMessage(transformedStream, [transformedStream]);
|
|
294
|
-
};`],{type:'application/javascript'}))}destroy(){URL.revokeObjectURL(this.j)}};olympe.U.stream.WritableStream=class{write(){return u(function*(){})}throw(){}complete(){}};olympe.U.stream.
|
|
295
|
-
olympe.U.stream.
|
|
296
|
-
[];this.
|
|
294
|
+
};`],{type:'application/javascript'}))}destroy(){URL.revokeObjectURL(this.j)}};olympe.U.stream.WritableStream=class{write(){return u(function*(){})}throw(){}complete(){}};olympe.U.stream.Ms=(...a)=>new ReadableStream({start(){this.cursor=0},pull(b){this.cursor<a.length?b.enqueue(a[this.cursor++]):b.close()}});olympe.U.stream.tap=a=>new TransformStream({transform(b,c){a(b);c.enqueue(b)}});
|
|
295
|
+
olympe.U.stream.Ak=class a{static transform(b){return b.pipeThrough(new TextDecoderStream).pipeThrough(a.j()).pipeThrough(a.D())}static j(){return new TransformStream({start(){this.buffer=''},transform(b,c){this.buffer+=b;for(var d=0;-1!==(b=this.buffer.indexOf('\n',d));){if(d=this.buffer.slice(d,b).trim())try{c.enqueue(JSON.parse(d))}catch(e){c.error(e);return}d=b+1}this.buffer=this.buffer.slice(d)},flush(b){if(this.buffer.trim())try{b.enqueue(JSON.parse(this.buffer))}catch(c){b.error(c)}}})}static D(){return new TransformStream({start(){this.buffer=
|
|
296
|
+
[];this.Dx=50},transform(b,c){this.buffer.push(b);this.buffer.length>=this.Dx&&(c.enqueue(this.buffer),this.buffer=[])},flush(b){0<this.buffer.length&&b.enqueue(this.buffer)}})}};olympe.U.stream.Ak.transform=olympe.U.stream.Ak.transform;function xb(a,b){return a+b&4294967295}
|
|
297
297
|
function yb(a,b){let c=a[0],d=a[1],e=a[2],f=a[3];c=G(c,d,e,f,b[0],7,-680876936);f=G(f,c,d,e,b[1],12,-389564586);e=G(e,f,c,d,b[2],17,606105819);d=G(d,e,f,c,b[3],22,-1044525330);c=G(c,d,e,f,b[4],7,-176418897);f=G(f,c,d,e,b[5],12,1200080426);e=G(e,f,c,d,b[6],17,-1473231341);d=G(d,e,f,c,b[7],22,-45705983);c=G(c,d,e,f,b[8],7,1770035416);f=G(f,c,d,e,b[9],12,-1958414417);e=G(e,f,c,d,b[10],17,-42063);d=G(d,e,f,c,b[11],22,-1990404162);c=G(c,d,e,f,b[12],7,1804603682);f=G(f,c,d,e,b[13],12,-40341101);e=G(e,f,
|
|
298
298
|
c,d,b[14],17,-1502002290);d=G(d,e,f,c,b[15],22,1236535329);c=H(c,d,e,f,b[1],5,-165796510);f=H(f,c,d,e,b[6],9,-1069501632);e=H(e,f,c,d,b[11],14,643717713);d=H(d,e,f,c,b[0],20,-373897302);c=H(c,d,e,f,b[5],5,-701558691);f=H(f,c,d,e,b[10],9,38016083);e=H(e,f,c,d,b[15],14,-660478335);d=H(d,e,f,c,b[4],20,-405537848);c=H(c,d,e,f,b[9],5,568446438);f=H(f,c,d,e,b[14],9,-1019803690);e=H(e,f,c,d,b[3],14,-187363961);d=H(d,e,f,c,b[8],20,1163531501);c=H(c,d,e,f,b[13],5,-1444681467);f=H(f,c,d,e,b[2],9,-51403784);
|
|
299
299
|
e=H(e,f,c,d,b[7],14,1735328473);d=H(d,e,f,c,b[12],20,-1926607734);c=I(d^e^f,c,d,b[5],4,-378558);f=I(c^d^e,f,c,b[8],11,-2022574463);e=I(f^c^d,e,f,b[11],16,1839030562);d=I(e^f^c,d,e,b[14],23,-35309556);c=I(d^e^f,c,d,b[1],4,-1530992060);f=I(c^d^e,f,c,b[4],11,1272893353);e=I(f^c^d,e,f,b[7],16,-155497632);d=I(e^f^c,d,e,b[10],23,-1094730640);c=I(d^e^f,c,d,b[13],4,681279174);f=I(c^d^e,f,c,b[0],11,-358537222);e=I(f^c^d,e,f,b[3],16,-722521979);d=I(e^f^c,d,e,b[6],23,76029189);c=I(d^e^f,c,d,b[9],4,-640364487);
|
|
300
300
|
f=I(c^d^e,f,c,b[12],11,-421815835);e=I(f^c^d,e,f,b[15],16,530742520);d=I(e^f^c,d,e,b[2],23,-995338651);c=J(c,d,e,f,b[0],6,-198630844);f=J(f,c,d,e,b[7],10,1126891415);e=J(e,f,c,d,b[14],15,-1416354905);d=J(d,e,f,c,b[5],21,-57434055);c=J(c,d,e,f,b[12],6,1700485571);f=J(f,c,d,e,b[3],10,-1894986606);e=J(e,f,c,d,b[10],15,-1051523);d=J(d,e,f,c,b[1],21,-2054922799);c=J(c,d,e,f,b[8],6,1873313359);f=J(f,c,d,e,b[15],10,-30611744);e=J(e,f,c,d,b[6],15,-1560198380);d=J(d,e,f,c,b[13],21,1309151649);c=J(c,d,e,f,
|
|
301
301
|
b[4],6,-145523070);f=J(f,c,d,e,b[11],10,-1120210379);e=J(e,f,c,d,b[2],15,718787259);d=J(d,e,f,c,b[9],21,-343485551);a[0]=xb(c,a[0]);a[1]=xb(d,a[1]);a[2]=xb(e,a[2]);a[3]=xb(f,a[3])}function I(a,b,c,d,e,f){b=xb(xb(b,a),xb(d,f));return xb(b<<e|b>>>32-e,c)}function G(a,b,c,d,e,f,g){return I(b&c|~b&d,a,b,e,f,g)}function H(a,b,c,d,e,f,g){return I(b&d|c&~d,a,b,e,f,g)}function J(a,b,c,d,e,f,g){return I(c^(b|~d),a,b,e,f,g)}
|
|
302
302
|
function zb(a,b=32){const c='0123456789abcdef'.split('');var d=a,e=d.length;a=[1732584193,-271733879,-1732584194,271733878];var f;for(f=64;f<=d.length;f+=64){var g=d.substring(f-64,f),h=[];for(let k=0;64>k;k+=4)h[k>>2]=g.charCodeAt(k)+(g.charCodeAt(k+1)<<8)+(g.charCodeAt(k+2)<<16)+(g.charCodeAt(k+3)<<24);yb(a,h)}d=d.substring(f-64);g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(f=0;f<d.length;f++)g[f>>2]|=d.charCodeAt(f)<<(f%4<<3);g[f>>2]|=128<<(f%4<<3);if(55<f)for(yb(a,g),f=0;16>f;f++)g[f]=0;g[14]=8*e;
|
|
303
|
-
yb(a,g);d='';e=0;b=0<=b?b:32;for(f=0;4>f;f++)for(h=a[f],g=0;4>g;g++){if(++e>b)return d;d+=c[h>>8*g+4&15];if(++e>b)return d;d+=c[h>>8*g&15]}return d}'5d41402abc4b2a76b9719d911017c592'!==zb('hello')&&(xb=(a,b)=>{const c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535});olympe.U.rb=zb;function Ab(a){a='0'.repeat(12)+a.toString(16);return a.substring(a.length-12,a.length)}function Bb(){var a=Math.random();return Ab((new Date).getTime())+(a.toString(16)+'0'.repeat(8)).substr(2,8)}const Cb=Math.pow(2,32)-1;olympe.U.Lc=function(){return Bb()};olympe.U.
|
|
304
|
-
olympe.U.
|
|
305
|
-
olympe.U.ni=function(){let a='';for(let b=0;19>b;b++)a+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return'@'+a};olympe.U.
|
|
306
|
-
olympe.U.
|
|
307
|
-
r=decodeURIComponent(r);b[q[1]]=r}return{scheme:a||null,
|
|
308
|
-
olympe.U.
|
|
309
|
-
olympe.U.
|
|
310
|
-
'');return d},Object.create(null))})};olympe.U.
|
|
311
|
-
olympe.U.Mf=class{constructor(a,b,c,d){this.j=a;this.D=b;this.F=c;this.H=d||null}static parse(a){a=/([0-9]*)\.([0-9]*)\.([0-9]*)-?([A-z\-_0-9]*)/.exec(a);if(null===a||4>a.length)return olympe.U.Mf.j;const b=Number.parseInt(a[1],10),c=Number.parseInt(a[2],10),d=Number.parseInt(a[3],10);return isNaN(b)||isNaN(c)||isNaN(d)?olympe.U.Mf.j:new olympe.U.Mf(b,c,d,a[4])}
|
|
312
|
-
a.F}Ea(a){return this.j===a.j&&this.D===a.D&&this.F===a.F}toString(){return`${this.j}.${this.D}.${this.F}`+(null!==this.H?`-${this.H}`:'')}};olympe.U.Mf.j=new olympe.U.Mf(Number.NaN,Number.NaN,Number.NaN);olympe.U.P={Dg:'utils.binaryConverter',
|
|
313
|
-
olympe.
|
|
314
|
-
olympe.
|
|
315
|
-
Ib(this,'trace',a)}debug(...a){this.j()&&Ib(this,'debug',a)}log(...a){this.N()&&Ib(this,'log',a)}info(...a){this.ia()&&Ib(this,'info',a)}warn(...a){this.wa()&&Ib(this,'warn',a)}error(...a){this.Z()&&Ib(this,'error',a)}fatal(...a){this.
|
|
316
|
-
!0===this.j.getParameter(b));b=new olympe.
|
|
317
|
-
olympe.C.J.D=new olympe.C.J(()=>olympe.C.Sa);olympe.C.J.N=new olympe.C.J(()=>olympe.C.
|
|
318
|
-
olympe.C.Xb=class{constructor(a='SimpleContext',b){++Mb;this.
|
|
319
|
-
this.Z.clear();this.X.clear();this.N&&(this.N.detach(this,!1),this.N=null);this.ia=!0;this.F=!1;this.sg()}}fb(){return this.ia}jd(){return this.F}
|
|
320
|
-
this.X.get(b)();this.X.clear()}onDestroy(a,b){void 0===b&&(++this.
|
|
321
|
-
function Ob(a,b){a.R||(a.R=new Map);a.R.set(b.T(),b);switch(b.Kc()){case olympe.C.Node.j.Oh:break;case olympe.C.Node.j.ai:break;case olympe.C.Node.j.
|
|
303
|
+
yb(a,g);d='';e=0;b=0<=b?b:32;for(f=0;4>f;f++)for(h=a[f],g=0;4>g;g++){if(++e>b)return d;d+=c[h>>8*g+4&15];if(++e>b)return d;d+=c[h>>8*g&15]}return d}'5d41402abc4b2a76b9719d911017c592'!==zb('hello')&&(xb=(a,b)=>{const c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535});olympe.U.rb=zb;function Ab(a){a='0'.repeat(12)+a.toString(16);return a.substring(a.length-12,a.length)}function Bb(){var a=Math.random();return Ab((new Date).getTime())+(a.toString(16)+'0'.repeat(8)).substr(2,8)}const Cb=Math.pow(2,32)-1;olympe.U.Lc=function(){return Bb()};olympe.U.hf=function(){return Bb()};olympe.U.mF=function(a,b=1){const c=a.substr(12,a.length-12);return Ab(parseInt(a.substr(0,12),16)+b)+c};
|
|
304
|
+
olympe.U.lF=function(a){return Ab(parseInt(a.substr(0,12),16)+1)+(Math.random().toString(16)+'00000000').substr(2,8)};let Db=0,Eb=0;olympe.U.Zx=function(){var a=(new Date).getTime();a<=Db?4294967295===Eb?(Eb=Math.floor(Math.random()/4*Cb),Db+=1):Eb=Math.floor(Eb+(4294967295-Eb)/2):(Eb=Math.floor(Math.random()/4*Cb),Db=a);a='00000000'+Eb.toString(16);return Ab(Db)+a.substr(a.length-8,8)};olympe.U.BF=function(){for(let a=0;1E4>a;a++)console.log(olympe.U.Zx())};
|
|
305
|
+
olympe.U.ni=function(){let a='';for(let b=0;19>b;b++)a+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return'@'+a};olympe.U.gF=function(a){let b='';for(let c=0;5>c;c++)b+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return(a?a:'UI')+'-'+b};olympe.U.cF=function(a,b){return(b?b:'UI')+'-'+a};
|
|
306
|
+
olympe.U.Rz=function(a){var b=/^(?:(\S*)@)?([^:]+)(?::(\d{2,5}))?$/;const c=/([^&=]+)=([^&=]+)/g,d=/^true|false$/i,e=/^\d+(\.\d+)?$/;var f=a.match(/^(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?\/?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/);a=f[1];const g=f[2],h=f[3],k=f[4];f=f[5];let l=null,n=null;var p=null;g&&(p=g.match(b),l=p[1],n=p[2],p=p[3]);b={};let q;for(;q=c.exec(k);){let r=q[2];void 0===r?r=!0:r.startsWith('"')&&r.endsWith('"')?r=r.substring(1,r.length-1):d.test(r)?r='true'===r.toLowerCase():e.test(r)?r=parseFloat(r):
|
|
307
|
+
r=decodeURIComponent(r);b[q[1]]=r}return{scheme:a||null,KE:g||null,Ct:l||null,host:n||null,port:p&&parseInt(p,10)||null,path:h&&'/'!==h?h:null,query:k||null,dF:f||null,parameters:b}};olympe.U.vF=function(a){a=a.substring(1);return''===a?new Map:new Map(a.split('&').map(b=>b.split('=').map(decodeURIComponent)))};
|
|
308
|
+
olympe.U.yF=function(a){a=Array.from(a.entries()).filter(([,b])=>null!==b&&void 0!==b).map(([b,c])=>`${encodeURIComponent(b)}=${encodeURIComponent(c)}`).join('&');return 0<a.length?`#${a}`:''};olympe.U.kF=(a,b)=>{const c=Object.keys(a).find(d=>a[d]===b);return void 0===c?null:c};
|
|
309
|
+
olympe.U.it=a=>{var b=Fb,c=Gb;return u(function*(){return(yield Promise.all(a.map(b))).map((d,e)=>{if('string'!==typeof d)return Object.create(null);try{return JSON.parse(d)}catch(f){if(a[e].endsWith('.json'))throw Error(`Failed to parse JSON Config file: ${a[e]}: ${f}`);const g=null!=c?c:'';return d.split('\n').filter(h=>h.startsWith(g)).reduce((h,k)=>{const [l,n]=k.split('=');h['host.'+l.slice(g.length)]=olympe.U.As(n);return h},{})}}).reduce((d,e,f)=>{olympe.U.kt(d,e,'version.json'===a[f]?'version.':
|
|
310
|
+
'');return d},Object.create(null))})};olympe.U.As=a=>{const b=/^true|false$/i,c=/^\d+(\.\d+)?$/;void 0===a?a=!0:a.startsWith('"')&&a.endsWith('"')?a=a.substring(1,a.length-1):b.test(a)?a='true'===a.toLowerCase():c.test(a)&&(a=parseFloat(a));return a};olympe.U.kt=(a,b,c)=>{if(b instanceof Object)for(const d of Object.keys(b)){const e=c+d,f=b[d];f instanceof Object&&void 0!==a[e]?olympe.U.kt(a[e],f,''):a[e]=f}};olympe.U.JE=class a{constructor(b,c){this.x=b;this.y=c}add(b){return new a(this.x+b.x,this.y+b.y)}Jn(){return Math.sqrt(this.x*this.x+this.y*this.y)}toString(){return`Vector(${this.x}, ${this.y})`}};olympe.U.yv=class{constructor(a,b){this.start=a;this.end=b}};olympe.U.yv.j={aC:'left',TC:'right',FA:'bottom',bE:'top'};function Hb(a){return`${a.j}.${a.D}.${a.F}`}
|
|
311
|
+
olympe.U.Mf=class{constructor(a,b,c,d){this.j=a;this.D=b;this.F=c;this.H=d||null}static parse(a){a=/([0-9]*)\.([0-9]*)\.([0-9]*)-?([A-z\-_0-9]*)/.exec(a);if(null===a||4>a.length)return olympe.U.Mf.j;const b=Number.parseInt(a[1],10),c=Number.parseInt(a[2],10),d=Number.parseInt(a[3],10);return isNaN(b)||isNaN(c)||isNaN(d)?olympe.U.Mf.j:new olympe.U.Mf(b,c,d,a[4])}nl(a){return this.j!==a.j?this.j>a.j:this.D!==a.D?this.D>a.D:this.F>a.F}Pj(a){return this.j!==a.j?this.j<a.j:this.D!==a.D?this.D<a.D:this.F<
|
|
312
|
+
a.F}Ea(a){return this.j===a.j&&this.D===a.D&&this.F===a.F}toString(){return`${this.j}.${this.D}.${this.F}`+(null!==this.H?`-${this.H}`:'')}};olympe.U.Mf.j=new olympe.U.Mf(Number.NaN,Number.NaN,Number.NaN);olympe.U.P={Dg:'utils.binaryConverter',Nt:'utils.base64Converter',jg:'utils.Profiler'};olympe.V.config(a=>{Xa(a,olympe.U.P.Dg);Wa(a,olympe.U.P.Nt,olympe.U.P.Dg,!0);C(a,olympe.U.P.jg,olympe.U.cw)},'Utils services');olympe.V.run([olympe.U.P.Dg,olympe.U.P.jg],(a,b)=>{olympe.U.jf=()=>a;olympe.de().isProfilerEnabled=()=>b.j;olympe.de().startProfiler=()=>b.start();olympe.de().stopProfiler=()=>b.stop();olympe.de().getProfilerEvents=()=>({events:b.F,names:Object.fromEntries(b.N.entries()),models:Object.fromEntries(b.H.entries())})});olympe.ga={};olympe.ga.yb=class{ka(){}H(){}F(){}j(){}ia(){}N(){}wa(){}Z(){}ba(){}trace(){}debug(){}log(){}info(){}warn(){}error(){}fatal(){}};olympe.ga.yb.prototype.fatal=olympe.ga.yb.prototype.fatal;olympe.ga.yb.prototype.error=olympe.ga.yb.prototype.error;olympe.ga.yb.prototype.warn=olympe.ga.yb.prototype.warn;olympe.ga.yb.prototype.info=olympe.ga.yb.prototype.info;olympe.ga.yb.prototype.log=olympe.ga.yb.prototype.log;olympe.ga.yb.prototype.debug=olympe.ga.yb.prototype.debug;olympe.ga.yb.prototype.trace=olympe.ga.yb.prototype.trace;
|
|
313
|
+
olympe.ga.yb.j={Lw:0,bg:1,uv:2,pk:3,qs:4,Ab:5,qu:6,pC:7};olympe.ga.yb.D={0:'TRACE',1:'DEBUG',2:'LOG',3:'INFO',4:'WARN',5:'ERROR',6:'FATAL',7:'NOTHING'};olympe.ga.Ta=class{ad(){}};olympe.ga.we={};function Ib(a,b,c){a.Ha[b](`[OLYMPE.${a.X}]:`,...c);if(0<a.R.size){var d=new Date;d=('00'+d.getHours()).substring(-2)+':'+('00'+d.getMinutes()).substring(-2)+':'+('00'+d.getSeconds()).substring(-2)+'.'+('00'+d.getMilliseconds()).substring(-3);for(const e of a.R.values())e(d,a.X,b,...c)}}
|
|
314
|
+
olympe.ga.we.yb=class{constructor(a,b){this.name=a;const c=b instanceof rxjs.Observable;this.D=c?olympe.ga.yb.j.pk:b;c&&b.subscribe(d=>{this.D=d});this.X=a.toUpperCase();this.R=new Map;this.Ha=console}ka(){return this.name}H(){return this.D}F(){return this.D<=olympe.ga.yb.j.Lw}j(){return this.D<=olympe.ga.yb.j.bg}N(){return this.D<=olympe.ga.yb.j.uv}ia(){return this.D<=olympe.ga.yb.j.pk}wa(){return this.D<=olympe.ga.yb.j.qs}Z(){return this.D<=olympe.ga.yb.j.Ab}ba(){return this.D<=olympe.ga.yb.j.qu}trace(...a){this.F()&&
|
|
315
|
+
Ib(this,'trace',a)}debug(...a){this.j()&&Ib(this,'debug',a)}log(...a){this.N()&&Ib(this,'log',a)}info(...a){this.ia()&&Ib(this,'info',a)}warn(...a){this.wa()&&Ib(this,'warn',a)}error(...a){this.Z()&&Ib(this,'error',a)}fatal(...a){this.ba()&&Ib(this,'error',a)}};olympe.ga.we.yb.ya=[olympe.ga.yb];olympe.ga.we.Ta=class{constructor(a,b,c){this.j=a;this.D=parseInt(b,10);this.F=c;this.channels=new Map;this.G=this.ad('logging');this.G.log('Logging initialized, global log level is '+olympe.ga.yb.D[b])}ad(a){var b=this.channels.get(a);if(!b){b=`${olympe.ga.Config.Wt}.${a}`;var c;const d=new rxjs.BehaviorSubject(null!=(c=this.j.getParameter(b))?c:this.D);Ta(this.j,b,e=>{d.next(e)});c=this.F;b=`${b}.${olympe.ga.Config.ww}`;Object.prototype.hasOwnProperty.call(this.j.parameters,b.toLowerCase())&&(c=
|
|
316
|
+
!0===this.j.getParameter(b));b=new olympe.ga.we.yb(a,d.asObservable(),c);this.channels.set(a,b)}return b}};olympe.ga.we.Ta.ya=[olympe.ga.Ta];olympe.ga.P={Fa:'logging.Manager'};olympe.ga.Config={Hp:'logging',Ip:'logging.showLogLevel',Wt:'logging',ww:'showLogLevel'};olympe.V.config(function(a){E(a,olympe.ga.Config.Hp,olympe.ga.yb.j.pk);E(a,olympe.ga.Config.Ip,!0);Va(a,olympe.ga.P.Fa,olympe.ga.we.Ta,olympe.V.P.Eg,new olympe.V.oa(olympe.ga.Config.Hp),new olympe.V.oa(olympe.ga.Config.Ip))},'olympe.logging');olympe.V.run([olympe.ga.P.Fa],a=>{olympe.ga.Wa=b=>a.ad(b)},'Logging singleton getter initialization');olympe.C={};olympe.C.Config={Cq:'df.nodeCreationThreshold'};const Jb=[];function Kb(){}function Lb(){}olympe.C.J=class a{constructor(b,c,d){this.j=void 0===b?Kb:b;this.D=void 0===c?Jb:c;this.X=d}static H(){var b=[];return void 0===b||0===b.length?olympe.C.J.Z:new a(Lb,b)}H(){return this.j?this.j():void 0}F(){return this.D?this.D:Jb}N(){return null===this.j&&null===this.D}R(){return this.j===Lb}};olympe.C.J.X=new olympe.C.J;olympe.C.J.j=new olympe.C.J(null,null);olympe.C.J.Z=new olympe.C.J(Lb);olympe.C.J.F=new olympe.C.J(()=>olympe.C.$);
|
|
317
|
+
olympe.C.J.D=new olympe.C.J(()=>olympe.C.Sa);olympe.C.J.N=new olympe.C.J(()=>olympe.C.da);olympe.C.J.R=new olympe.C.J(()=>olympe.C.Zb);olympe.C.Fh=class{T(){return''}Hn(){return''}destroy(){}fb(){return!1}jd(){return!1}run(a,...b){return a(...b)}rc(a){return a}getParent(){return null}xt(){}ne(){}detach(){}el(){}sg(){}onDestroy(){return''}Xf(){}Xd(){return''}mt(){}};olympe.C.Fh.prototype.offDestroy=olympe.C.Fh.prototype.Xf;olympe.C.Fh.prototype.onDestroy=olympe.C.Fh.prototype.onDestroy;let Mb=0;olympe.V.run([new olympe.V.oa(olympe.C.Config.Cq)],()=>{});
|
|
318
|
+
olympe.C.Xb=class{constructor(a='SimpleContext',b){++Mb;this.ba=new Map;this.Z=new Map;this.X=new Map;this.Ha=0;this.name=a;this.id=String(Mb);this.F=this.ia=!1;(this.N=void 0===b?olympe.C.Za():b)&&this.N.ne(this);this.debug=!1}T(){return this.id}Hn(){return this.name}run(a,...b){if(!this.ia){var c=olympe.C.wt(this);a=a(...b);c&&olympe.C.wt(c);return a}}rc(a){return(...b)=>this.run(a,...b)}destroy(){if(!this.ia&&!this.F){this.F=!0;this.sg();for(const a of this.Z.keys())this.Z.has(a)&&this.Z.get(a)();
|
|
319
|
+
this.Z.clear();this.X.clear();this.N&&(this.N.detach(this,!1),this.N=null);this.ia=!0;this.F=!1;this.sg()}}fb(){return this.ia}jd(){return this.F}ne(a){if(!this.ia){var b;olympe.C.gb(a)?b=a.Ba:olympe.C.Tn(a)&&(b=a);b&&this.ba.set(b.T(),b)}}detach(a,b=!0){let c;olympe.C.gb(a)?c=a.Ba:olympe.C.Tn(a)&&(c=a);c&&this.ba.has(c.T())&&(b&&c.el(this),this.ba.delete(c.T()))}el(){this.N=null;this.destroy()}sg(){const a=this.ba;for(const b of a.keys())a.has(b)&&a.get(b).el(this);this.ba.clear();for(const b of this.X.keys())this.X.has(b)&&
|
|
320
|
+
this.X.get(b)();this.X.clear()}onDestroy(a,b){void 0===b&&(++this.Ha,b=String(this.Ha));this.Z.set(b,a);return b}Xf(a){this.Z.delete(a)}Xd(a){if(void 0===b){++this.Ha;var b=String(this.Ha)}this.X.set(b,a);return b}mt(a){this.X.delete(a)}xt(a){this.N&&this.N.detach(this,!1);(this.N=a||null)&&this.N.ne(this)}getParent(){return this.N}};olympe.C.Gr=class extends olympe.C.Xb{constructor(){super('Root',null)}destroy(){}onDestroy(){return''}Xf(){}};olympe.C.Fh.ya=[olympe.C.Fh];let Nb=0;
|
|
321
|
+
function Ob(a,b){a.R||(a.R=new Map);a.R.set(b.T(),b);switch(b.Kc()){case olympe.C.Node.j.Oh:break;case olympe.C.Node.j.ai:break;case olympe.C.Node.j.vk:case olympe.C.Node.j.dg:olympe.C.G.warn('Not bad as such but should not happen!');break;case olympe.C.Node.j.Gh:Pb(a,olympe.C.Node.j.Gh);break;case olympe.C.Node.j.OBSOLETE:a.lb=!0;a.j!==olympe.C.Node.j.Gh&&Pb(a,olympe.C.Node.j.OBSOLETE);break;case olympe.C.Node.j.Zd:olympe.C.G.warn('Adding a destroyed node as upstream => should never happen!');break;
|
|
322
322
|
default:olympe.C.G.warn('Unknown state, investigate: ',b.Kc())}Qb(b,a)}
|
|
323
|
-
function Rb(a){if(a.Mc){var b=[],c=[];if(a.Yf)if(a.Yf instanceof olympe.C.Node)if(Sb(a.Yf))b=a.Yf.Eb;else return;else b=a.Yf;else b=null;if(null!==a.Vd){const e=a.rg;for(let f=0,g=a.Vd.length;f<g;f++)if(null!==e&&-1<e.indexOf(f)){const h=a.Vd[f];if(Sb(h))c.push(h.Eb);else return}else c.push(a.Vd[f])}if(a.Mc instanceof Function)var d=a.Mc;else b&&(b[a.Mc]||olympe.C.G.warn('looks like you forget a cast somewhere around '+a.Mc),d=b[a.Mc]);a.run(()=>{a.sg();if(void 0!==d){const e=d.apply(b,c);e&&e.
|
|
323
|
+
function Rb(a){if(a.Mc){var b=[],c=[];if(a.Yf)if(a.Yf instanceof olympe.C.Node)if(Sb(a.Yf))b=a.Yf.Eb;else return;else b=a.Yf;else b=null;if(null!==a.Vd){const e=a.rg;for(let f=0,g=a.Vd.length;f<g;f++)if(null!==e&&-1<e.indexOf(f)){const h=a.Vd[f];if(Sb(h))c.push(h.Eb);else return}else c.push(a.Vd[f])}if(a.Mc instanceof Function)var d=a.Mc;else b&&(b[a.Mc]||olympe.C.G.warn('looks like you forget a cast somewhere around '+a.Mc),d=b[a.Mc]);a.run(()=>{a.sg();if(void 0!==d){const e=d.apply(b,c);e&&e.vs?
|
|
324
324
|
Tb(a,e.Ba):e instanceof olympe.C.Node?Tb(a,e):(L(a,e),void 0===e&&void 0===a.valueType&&Pb(a,olympe.C.Node.j.ai))}else Ub(a)})}}function M(a){void 0===a.Ua&&(a.Ua=a.valueType===olympe.C.Proxy?Vb(void 0,a.vb):Vb(a.valueType,a.vb),a.Ua.Ba=a);return a.Ua}function Wb(a){void 0!==a.D&&(Xb(a.D,a),a.D=void 0)}function Yb(a){if(a.j===olympe.C.Node.j.OBSOLETE&&(a.j=olympe.C.Node.j.ai,null!==a.H))for(const b of a.H.values())Zb(b)}function Pb(a,b){b!==a.j&&(a.j=b)}
|
|
325
|
-
function $b(a){if(a.j!==olympe.C.Node.j.OBSOLETE&&a.j!==olympe.C.Node.j.
|
|
325
|
+
function $b(a){if(a.j!==olympe.C.Node.j.OBSOLETE&&a.j!==olympe.C.Node.j.vk&&a.j!==olympe.C.Node.j.Oh&&a.j!==olympe.C.Node.j.Gh){Pb(a,olympe.C.Node.j.vk);var b=a.H;if(b)for(const c of b.values())b.has(c.T())&&$b(c);Pb(a,olympe.C.Node.j.OBSOLETE)}}function ac(a,b,c){if(a.j!==olympe.C.Node.j.dg)if(b===a.D)L(a,c,!0);else{if(a.j===olympe.C.Node.j.OBSOLETE||a.j===olympe.C.Node.j.vk)a.lb=!0;Rb(a)}}
|
|
326
326
|
function L(a,b,c){b instanceof olympe.C.Node&&(olympe.C.G.warn('We are setting the value of a node as a node, that should never happen?'),b=b.Eb);a.wa||c||void 0===a.D||Wb(a);if(void 0!==b){if((a.wa||a.j===olympe.C.Node.j.ai||a.j===olympe.C.Node.j.OBSOLETE)&&!olympe.C.gb(b)&&void 0!==a.Eb){if(null===b&&null===a.Eb){Yb(a);return}if(null!==b&&null!==a.Eb&&(b.valueOf()===a.Eb.valueOf()||a.Eb.Ea&&a.Eb.Ea(b))){Yb(a);return}}if(!0===a.wa)olympe.C.G.error("Circular dependency detected: updating a downstream node caused this node's (#"+
|
|
327
327
|
a.T()+') value to get updated !');else{a.j===olympe.C.Node.j.Zd&&olympe.C.G.warn(`trying to set a value on a destroyed node (#${a.T()} ${a.$c?', '+a.$c:''})`);a.j===olympe.C.Node.j.dg&&olympe.C.G.warn(`trying to set a value on a node being destroyed (#${a.T()} ${a.$c?', '+a.$c:''})`);a.wa=!0;c=b;var d=!1,e=(f,g)=>f instanceof g?!0:!1;void 0===a.valueType||null===c||e(c,a.valueType)||(e=a.valueType&&a.valueType.name?a.valueType.name:'undefined',b='object'===typeof c?b.constructor.name:typeof c,c instanceof
|
|
328
|
-
Object?d=!0:b.toLowerCase()!==e.toLowerCase()&&a.valueType!==Object&&(d=!0),d&&('string'===b.toLowerCase()&&a.valueType===olympe.C.Sa?(c=olympe.C.xb(c),d=!1):'number'===b.toLowerCase()&&a.valueType===olympe.C.$?(c=olympe.C.qa(c),d=!1):'boolean'===b.toLowerCase()&&a.valueType===olympe.C.
|
|
328
|
+
Object?d=!0:b.toLowerCase()!==e.toLowerCase()&&a.valueType!==Object&&(d=!0),d&&('string'===b.toLowerCase()&&a.valueType===olympe.C.Sa?(c=olympe.C.xb(c),d=!1):'number'===b.toLowerCase()&&a.valueType===olympe.C.$?(c=olympe.C.qa(c),d=!1):'boolean'===b.toLowerCase()&&a.valueType===olympe.C.da&&(c=olympe.C.Rb(c),d=!1)));a.Eb=c;Pb(a,olympe.C.Node.j.ai);if(b=a.H){d=0;for(const f of b.values())0<d&&$b(f),d++;for(const f of b.values())ac(f,a,c)}a.wa=!1}}}
|
|
329
329
|
function bc(a,b){if(a.j!==olympe.C.Node.j.dg&&a.j!==olympe.C.Node.j.Zd&&(a.j!==olympe.C.Node.j.Oh||a.Mc)){var c=void 0!==a.defaultValue;a.Mc&&b!==a.D&&a.sg();if(c)L(a,a.defaultValue,!0);else if(a.Eb=void 0,Pb(a,olympe.C.Node.j.Oh),b=a.H)for(const d of b.values())bc(d,a)}}function Ub(a){if(a.j!==olympe.C.Node.j.Gh){Pb(a,olympe.C.Node.j.Gh);var b=a.H;if(b)for(const c of b.values())Ub(c);a.sg();void 0!==a.D&&Wb(a);a.Eb=a.defaultValue}}function Sb(a){return a.j===olympe.C.Node.j.ai}
|
|
330
330
|
function Tb(a,b){b===a?olympe.C.G.error('Setting a node as provider of itself. Ignoring'):(a.D&&a.D!==b&&Wb(a),Qb(b,a),Sb(b)?L(a,b.Eb,!0):void 0!==a.defaultValue?L(a,a.defaultValue,!0):bc(a),a.D=b)}function cc(a,b){a.Mc&&(a.Mc=void 0);a.$c='Repeater';Tb(a,b)}function Zb(a){a.D?Yb(a):null!==a.R&&0===Array.from(a.R.values()).filter(b=>!Sb(b)).length&&(a.lb&&(a.lb=!1,Rb(a)),Yb(a))}
|
|
331
331
|
function Qb(a,b){a.H||(a.H=new Map);a.H.set(b.T(),b);a.j===olympe.C.Node.j.Zd&&olympe.C.G.warn('adding a downstream node on a deleted one (#'+a.T()+') !')}function Xb(a,b){a.H&&(b=b.T(),a.H.has(b)&&(a.H.delete(b),dc(a)))}function dc(a){if(null===a.getParent()){var b=a.H;b&&0<b.size||a.destroy()}}
|
|
332
|
-
olympe.C.Node=class extends olympe.C.Xb{constructor({valueType:a,Mc:b,
|
|
333
|
-
olympe.C.Node&&Ob(this,d);if(g)for(b=0;b<g.length;b++)a=e[g[b]],Ob(this,a);c&&Rb(this)}wh(a){this.defaultValue=a;this.j===olympe.C.Node.j.Oh&&L(this,a,!0);return this}sj(a){this.valueType=a}
|
|
332
|
+
olympe.C.Node=class extends olympe.C.Xb{constructor({valueType:a,Mc:b,Wz:c=!0,Yf:d,Pn:e,debug:f=!1,rg:g=null,$c:h='Node',qj:k}={}){++Nb;super(String(Nb));this.debug=!!f;this.$c=h;h&&'string'===typeof h||(b?this.$c=b.name?b.name:'anon()':this.$c='Node');this.Vd=e&&0<e.length?e:null;this.rg=g&&0<g.length?g:null;this.valueType=a;this.Eb=void 0;this.wa=!1;this.j=olympe.C.Node.j.Oh;this.lb=!1;this.H=this.R=null;this.Mc=b;this.Yf=d||null;this.defaultValue=this.Ua=this.D=void 0;this.qj=k;d&&d instanceof
|
|
333
|
+
olympe.C.Node&&Ob(this,d);if(g)for(b=0;b<g.length;b++)a=e[g[b]],Ob(this,a);c&&Rb(this)}wh(a){this.defaultValue=a;this.j===olympe.C.Node.j.Oh&&L(this,a,!0);return this}sj(a){this.valueType=a}Mb(){return this.valueType||Object}asObservable(a=olympe.C.Za()){return new rxjs.Observable(b=>{const c=a.run(()=>olympe.C.createNode(this.valueType,b.next.bind(b),null,[this],[0],`Observable of ${this.$c}`));c.onDestroy(()=>b.complete());return()=>c.destroy()})}Kc(){return this.j}fb(){return this.j===olympe.C.Node.j.Zd}jd(){return this.j===
|
|
334
334
|
olympe.C.Node.j.dg}vb(...a){if(this.qj instanceof Function)return this.qj(...a);var b=a.length;--b;const c=a[b];--b;const d=a[b],e=Array(b);for(var f=0;f<b;f++)e[f]=a[f];a=this.Kc();a!==olympe.C.Node.j.dg&&a!==olympe.C.Node.j.Zd||olympe.C.G.warn('Calling a function on a destroyed node!!!',this);a=d.F();b=[];if(1===a.length&&-1===a[0])for(var g of e)olympe.C.gb(g)&&b.push(g.Ba);else for(let h=0,k=a.length;h<k;h++)g=a[h],f=e[g],void 0!==f&&null!==f&&f.fh&&(e[g]=f.Ba,b.push(g));return M(new olympe.C.Node({valueType:d.H(),
|
|
335
|
-
Mc:c,Yf:this,
|
|
336
|
-
b.D&&b.D.T()===this.T()?b.D=void 0:b.destroy()}a.clear()}this.H=null;super.destroy();if(this.R){for(const c of this.R.values())this.R.has(c.T())&&Xb(c,this);this.R.clear()}this.R=null;this.D&&(Xb(this.D,this),this.D=void 0);this.Eb=void 0;this.Vd&&(this.Vd.length=0,this.Vd=null);this.rg&&(this.rg.length=0,this.rg=null);this.qj=this.Mc=void 0;this.defaultValue=this.Yf=null;this.$c=`** Destroyed ** ${this.$c}`;Pb(this,olympe.C.Node.j.Zd)}}
|
|
337
|
-
Function?this.Mc.name?this.Mc.name:'()':this.Mc:'{ }';return'#'+('000000'+this.T()).substr(-6)+(this.$c?' '+this.$c:'')+'>'+(a?' '+a+'()':'')}};olympe.C.Node.D='rootNode';olympe.C.Node.j={Oh:0,ai:1,Gh:3,
|
|
335
|
+
Mc:c,Yf:this,Pn:e,debug:!1,rg:b,$c:'Proxy.'+c+'()'}))}el(a){if(null===this.getParent())olympe.C.G.warn('context is undefined, investigate');else if(this.getParent()!==a){olympe.C.G.warn('Investigate a potential issue in creator-createe link: create node mismatch',a,this.getParent());return}this.xt(null);dc(this)}destroy(){var a=this.j;if(a!==olympe.C.Node.j.dg&&a!==olympe.C.Node.j.Zd){Pb(this,olympe.C.Node.j.dg);if(a=this.H){for(const c of a.values())if(a.has(c.T())){var b=c;b.R&&b.R.delete(this.T());
|
|
336
|
+
b.D&&b.D.T()===this.T()?b.D=void 0:b.destroy()}a.clear()}this.H=null;super.destroy();if(this.R){for(const c of this.R.values())this.R.has(c.T())&&Xb(c,this);this.R.clear()}this.R=null;this.D&&(Xb(this.D,this),this.D=void 0);this.Eb=void 0;this.Vd&&(this.Vd.length=0,this.Vd=null);this.rg&&(this.rg.length=0,this.rg=null);this.qj=this.Mc=void 0;this.defaultValue=this.Yf=null;this.$c=`** Destroyed ** ${this.$c}`;Pb(this,olympe.C.Node.j.Zd)}}Hn(){return this.$c}print(){const a=this.Mc?this.Mc instanceof
|
|
337
|
+
Function?this.Mc.name?this.Mc.name:'()':this.Mc:'{ }';return'#'+('000000'+this.T()).substr(-6)+(this.$c?' '+this.$c:'')+'>'+(a?' '+a+'()':'')}};olympe.C.Node.D='rootNode';olympe.C.Node.j={Oh:0,ai:1,Gh:3,vk:4,OBSOLETE:5,dg:6,Zd:7};function Vb(a,b){if('function'!==typeof a)return new olympe.C.Proxy(a,b);var c=olympe.C.Proxy.prototype;void 0===a.prototype&&olympe.C.G.error('investigate');c=Object.create(ec(c,a.prototype));c.di=a;c.ws=b;return c}function ec(a,b){Object.prototype.hasOwnProperty.call(b,olympe.C.Proxy.Rm)||Object.defineProperty(b,olympe.C.Proxy.Rm,{enumerable:!1,configurable:!1,writable:!1,value:fc(a,b)});return b[olympe.C.Proxy.Rm]}
|
|
338
338
|
function gc(a,b){if(a.di!==b){a.di=b;b.prototype||olympe.C.G.error('Cast not possible, provided type is not a valid type!');var c=ec(a,b.prototype);Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c;a.Ba&&a.Ba.sj(b)}}
|
|
339
|
-
function fc(a,b){let c={};if(b.prototype)olympe.C.G.error('first level of prototyping, investigate');else if(b.__proto__)c=Object.create(ec(a,b.__proto__));else return olympe.C.Proxy.prototype;Object.getOwnPropertyNames(b).forEach(d=>{if('function'===typeof b[d]&&'__getReplacementFunction'!==d){var e=b[d].K;null===e||e&&e.N()?c[d]=function(...f){var g=this.Ba;if(g&&Sb(g)&&(g=g.Eb)&&g[d]&&'function'===typeof g[d])return g[d].apply(g,f)}:(e=e||b[d].__oSig__||olympe.C.J.X,c[d]=function(...f){f=this.
|
|
339
|
+
function fc(a,b){let c={};if(b.prototype)olympe.C.G.error('first level of prototyping, investigate');else if(b.__proto__)c=Object.create(ec(a,b.__proto__));else return olympe.C.Proxy.prototype;Object.getOwnPropertyNames(b).forEach(d=>{if('function'===typeof b[d]&&'__getReplacementFunction'!==d){var e=b[d].K;null===e||e&&e.N()?c[d]=function(...f){var g=this.Ba;if(g&&Sb(g)&&(g=g.Eb)&&g[d]&&'function'===typeof g[d])return g[d].apply(g,f)}:(e=e||b[d].__oSig__||olympe.C.J.X,c[d]=function(...f){f=this.ws.call(this.Ba,
|
|
340
340
|
...f,e,d);const g=e.X;if(g){const h=this.Ba.Eb;h&&h[g]&&gc(f,h[g])}return e.R()?this:f})}});return c}function hc(a,b){L(a.Ba,b)}function ic(a){bc(a.Ba)}function jc(a,b){cc(a.Ba,olympe.C.Wf(b)?b:b.Ba)}function kc(a,b){olympe.C.gb(b)||olympe.C.Wf(b)?jc(a,b):hc(a,b)}
|
|
341
|
-
olympe.C.Proxy=class{constructor(a,b){this.Ba=null;this.di=a;this.
|
|
342
|
-
olympe.C.$=class{constructor(a){this.value=void 0===a||null===a?0:a}toJSON(){return'{ "type": "number", "value": '+JSON.stringify(this.value)+' }'}static
|
|
343
|
-
this.value&&null!==this.value?'number'===typeof a?this.value.toString(a):'number'===typeof b?this.value.toFixed(b):this.value.toString():'-'}toFixed(a){return this.
|
|
344
|
-
g===c&&e()}});return d.tb()}
|
|
345
|
-
c.valueOf()),olympe.C.$,'ONumber.div')}
|
|
346
|
-
a],(b,c)=>olympe.C.
|
|
347
|
-
a],(b,c)=>b.valueOf()<=c.valueOf()?b:olympe.C.qa(c),olympe.C.$,'ONumber.returnsSmallest')}
|
|
348
|
-
b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.
|
|
349
|
-
const k=(l,n)=>{n=olympe.C.
|
|
350
|
-
return f}static offset(a){let b;return olympe.C.
|
|
351
|
-
b=b.
|
|
352
|
-
f=>{const g=olympe.C.Qa(b,1E3),h=olympe.C.Qa(e);return void 0===h?olympe.C.qa(f):mc(h,f,g,c,k=>{d&&d(k)})},olympe.C.$)}static
|
|
353
|
-
olympe.C.Sa):olympe.C.xb(a)}static Qj(a){return olympe.C.gb(a)?olympe.C.sa([a],b=>olympe.C.qa(-b.valueOf()),olympe.C.$):olympe.C.qa(-a.valueOf())}static
|
|
354
|
-
b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.
|
|
355
|
-
olympe.C.$.
|
|
356
|
-
olympe.C.$.
|
|
357
|
-
|
|
358
|
-
10*(a/d-1))+b},
|
|
359
|
-
c*(2*d*d+2*d*a+-3*d)},
|
|
360
|
-
b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},
|
|
361
|
-
m.toString.K=new olympe.C.J(()=>String,[]);m.toFixed.K=new olympe.C.J(()=>String,[]);m.
|
|
362
|
-
m.Jd.K=new olympe.C.J(()=>olympe.C.
|
|
363
|
-
a))}
|
|
364
|
-
olympe.C.
|
|
365
|
-
olympe.C.$,'OString.indexOf')}lastIndexOf(a,b){return olympe.C.sa([this,a,b||Infinity],(c,d,e)=>olympe.C.qa(c.valueOf().lastIndexOf(d.valueOf(),e.valueOf())),olympe.C.$,'OString.lastIndexOf')}slice(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().slice(d.valueOf(),e?e.valueOf():void 0)),olympe.C.Sa,'OString.slice')}
|
|
366
|
-
b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().padStart(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.padStart')}padEnd(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().padEnd(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.padEnd')}replace(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().replace(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.replace')}
|
|
367
|
-
e.valueOf())),olympe.C.Sa,'OString.subOStr')}static concat(...a){return olympe.C.xb('').concat(...a)}};olympe.C.Sa.EMPTY=new olympe.C.Sa('');olympe.C.Sa.
|
|
368
|
-
m.contains.K=new olympe.C.J(()=>olympe.C.
|
|
369
|
-
m.replace.K=olympe.C.J.D;m.
|
|
370
|
-
olympe.C.
|
|
371
|
-
olympe.C.
|
|
372
|
-
m.and.K=new olympe.C.J(()=>olympe.C.
|
|
373
|
-
olympe.C.eb=class{constructor(a){this.sb=a}toJSON(){return'{ "type": "dateTime", "value": "'+this.sb.toJSON()+'" }'}static
|
|
341
|
+
olympe.C.Proxy=class{constructor(a,b){this.Ba=null;this.di=a;this.ws=b}static gb(a){return!(!a||!a.fh)}Ea(a){return olympe.C.sa([this,a],(b,c)=>b===c,Boolean)}Jd(a){return olympe.C.sa([this,a],(b,c)=>null===b||null===c?b===c?olympe.C.da.D:olympe.C.da.j:b.valueOf()===c.valueOf()?olympe.C.da.D:olympe.C.da.j,olympe.C.da)}asObservable(a){return this.Ba.asObservable(a)}vs(){return this.Ba}};olympe.C.Proxy.Rm='__opp__';olympe.C.Proxy.prototype.fh=!0;function lc(a,b){a.node.wh(b);return a}olympe.C.lk=class{constructor(a,b='FlowSource'){this.node=olympe.C.createNode(a,void 0,void 0,void 0,void 0,b)}update(a){olympe.C.gb(a)?L(this.node,olympe.C.Qa(a)):L(this.node,a);return this}repeat(a){cc(this.node,olympe.C.gb(a)?a.Ba:a);return this}clear(){bc(this.node);return this}tb(){return M(this.node)}getContext(){return this.node}};function mc(a,b,c=1E3,d,e){const f=olympe.C.bc(olympe.C.$),g=d||olympe.C.$.mp.uq;let h,k,l,n;f.update(olympe.C.qa(a));const p=window.performance.now(),q=b.valueOf();l=q-a.valueOf();if(0!==l&&void 0===n){const r=()=>{f.getContext().fb()||(l=q-a.valueOf(),k=(window.performance.now()-p)/c,1<=k&&(k=1,n=void 0),h=a.valueOf()+l*g(k,0,1,1),f.update(olympe.C.qa(h)),1===k&&void 0!==e&&e(h),1>k&&(n=window.requestAnimationFrame(r)))};n=window.requestAnimationFrame(r)}return f.tb()}
|
|
342
|
+
olympe.C.$=class{constructor(a){this.value=void 0===a||null===a?0:a}toJSON(){return'{ "type": "number", "value": '+JSON.stringify(this.value)+' }'}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.C.qa(b.value)}ho(){return'number'===typeof this.value&&!isNaN(this.value)}isNaN(){return olympe.C.Rb(!this.ho())}Xc(){return null===this.value||void 0===this.value||void 0===this.value.toString||isNaN(this.value)?olympe.C.xb(''):olympe.C.xb(this.value.toString())}toString(a,b){return void 0!==
|
|
343
|
+
this.value&&null!==this.value?'number'===typeof a?this.value.toString(a):'number'===typeof b?this.value.toFixed(b):this.value.toString():'-'}toFixed(a){return this.ho()?this.valueOf().toFixed(a):''}static max(a){const b=new Map;let c=-Infinity;const d=olympe.C.bc(olympe.C.$,'ONumber.max result'),e=()=>{c=-Infinity;for(const f of b.values())f>c&&(c=f);d.update(olympe.C.qa(c))};a.forEach((f,g)=>{olympe.C.Wc([f],h=>{b.set(g,h.valueOf());e()})},f=>{if(!d.getContext().fb()){var g=b.get(f);b.delete(f);
|
|
344
|
+
g===c&&e()}});return d.tb()}ge(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(b.valueOf()+c.valueOf()),olympe.C.$,'ONumber.plus')}uh(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(b.valueOf()-c.valueOf()),olympe.C.$,'ONumber.minus')}round(){return olympe.C.qa(Math.round(this.valueOf()))}Qj(){return olympe.C.qa(-this.valueOf())}sl(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(b.valueOf()*c.valueOf()),olympe.C.$,'ONumber.mul')}vj(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(b.valueOf()/
|
|
345
|
+
c.valueOf()),olympe.C.$,'ONumber.div')}yz(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(b.valueOf()%c.valueOf()),olympe.C.$,'ONumber.div')}floor(){return olympe.C.qa(Math.floor(this.valueOf()))}ceil(){return olympe.C.qa(Math.ceil(this.valueOf()))}trunc(){return olympe.C.qa(Math.trunc(this.valueOf()))}log(){return olympe.C.qa(Math.log(this.valueOf()))}pow(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.qa(Math.pow(b.valueOf(),c.valueOf())),olympe.C.$,'ONumber.pow')}exp(){return olympe.C.qa(Math.exp(this.valueOf()))}Jd(a){return olympe.C.sa([this,
|
|
346
|
+
a],(b,c)=>olympe.C.Rb(b.Ea(c)),olympe.C.da,'ONumber.oEquals')}Ea(a){return this.valueOf()===(void 0!==a&&null!==a?a.valueOf():void 0)}valueOf(){return void 0!==this.value?this.value.valueOf():void 0}Ly(){return this.valueOf()}Sn(a){return olympe.C.sa([this,a],(b,c)=>b.valueOf()>c.valueOf()?olympe.C.da.D:olympe.C.da.j,olympe.C.da,'ONumber.isBiggerThan')}cA(a){return olympe.C.sa([this,a],(b,c)=>b.valueOf()>=c.valueOf()?b:olympe.C.qa(c),olympe.C.$,'ONumber.returnsBiggest')}st(a){return olympe.C.sa([this,
|
|
347
|
+
a],(b,c)=>b.valueOf()<=c.valueOf()?b:olympe.C.qa(c),olympe.C.$,'ONumber.returnsSmallest')}oz(a){return olympe.C.sa([this,a],(b,c)=>b.valueOf()<c.valueOf()?olympe.C.da.D:olympe.C.da.j,olympe.C.da,'ONumber.isSmallerThan')}sin(){return olympe.C.qa(Math.sin(this.valueOf()))}cos(){return olympe.C.qa(Math.cos(this.valueOf()))}atan2(a){return olympe.C.gb(a)?olympe.C.ye([a],b=>olympe.C.qa(Math.atan2(this.valueOf(),b.valueOf())),olympe.C.$):olympe.C.qa(Math.atan2(this.valueOf(),a.valueOf()))}abs(){return olympe.C.qa(Math.abs(this.valueOf()))}Ij(a,
|
|
348
|
+
b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.ye([a,b],(c,d)=>olympe.C.qa(this.valueOf()*d.valueOf()+c.valueOf()*(1-d.valueOf())),olympe.C.$):olympe.C.qa(this.valueOf()*b.valueOf()+a.valueOf()*(1-b.valueOf()))}static gx(a,b,c,d){'number'===typeof a&&(a=olympe.C.fe(a));'number'===typeof b&&(b=olympe.C.fe(b));'number'===typeof c&&(c=olympe.C.fe(c));let e=0;const f=olympe.C.fe(0);let g,h;void 0!==b&&void 0!==c&&olympe.C.Gj(b.Sn(c),()=>{olympe.ga.Wa('df').warn('You have a min bigger than max, cap your inputs')});
|
|
349
|
+
const k=(l,n)=>{n=olympe.C.fe(n);const p=olympe.C.$.animate(n,500);jc(f,p);hc(n,olympe.C.qa(l));e=l};olympe.C.ye([a],l=>{e+=l.valueOf();e>h?k(h,e):e<g?k(g,e):jc(f,olympe.C.fe(e))},olympe.C.$);void 0!==b&&olympe.C.Vn(b.valueOf(),l=>{if(g!==l&&(g=l,g>e)){const n=olympe.C.fe(e),p=olympe.C.$.animate(n,400,d);l=olympe.C.qa(g);L(n.Ba,l);e=g;jc(f,p)}});void 0!==c&&olympe.C.Vn(c.valueOf(),l=>{if(h!==l&&(h=l,h<e)){const n=olympe.C.fe(e),p=olympe.C.$.animate(n,400,d);l=olympe.C.qa(h);L(n.Ba,l);e=h;jc(f,p)}});
|
|
350
|
+
return f}static offset(a){let b;return olympe.C.ye([a],c=>{void 0===b&&(b=c);return olympe.C.qa(c-b)},olympe.C.$,'offset')}static Hs(a){let b,c,d;return olympe.C.sa([a],e=>{if(void 0===b)return b=e,c=window.performance.now(),olympe.C.qa(0);d=window.performance.now();const f=olympe.C.qa((e.valueOf()-b.valueOf())/(d-c));b=e;c=d;return f},olympe.C.$,'derivative')}static gz(a){let b=olympe.C.qa(0),c,d,e;return olympe.C.sa([a],f=>{if(void 0===c)return c=f,d=window.performance.now(),olympe.C.qa(0);e=window.performance.now();
|
|
351
|
+
b=b.ge((f.valueOf()+c.valueOf())/2*(e-d));c=f;d=e;return b},olympe.C.$,'integrate')}static Nx(a){let b;return olympe.C.sa([a],c=>{void 0===b&&(b=c.valueOf());const d=olympe.C.qa(c.valueOf()-b.valueOf());b=c;return d},olympe.C.$,'diff')}static Cx(a,b,c){return olympe.C.ye([a,b,c],(d,e,f)=>{d='number'===typeof d?d:d.valueOf();e='number'===typeof e?e:e.valueOf();f='number'===typeof f?f:f.valueOf();return olympe.C.qa(d>=e?d<=f?d:f:e)},olympe.C.$)}static animate(a,b,c,d){let e;return e=olympe.C.sa([a],
|
|
352
|
+
f=>{const g=olympe.C.Qa(b,1E3),h=olympe.C.Qa(e);return void 0===h?olympe.C.qa(f):mc(h,f,g,c,k=>{d&&d(k)})},olympe.C.$)}static sx(a,b,c){let d,e,f,g,h,k,l=olympe.C.fe(),n;olympe.C.Wc([a],p=>{void 0===d?g=d=p.valueOf():d=g;f=window.performance.now();e=p.valueOf();k=e-d;0!==k&&void 0===n&&(n=setInterval(()=>{k=e-d;h=(window.performance.now()-f)/b;1<=h&&(h=1);g=d+k*c(h,0,1,1);hc(l,olympe.C.qa(g));1===h&&(clearTimeout(n),n=void 0)},0))});return l}static Xc(a){return olympe.C.gb(a)?olympe.C.sa([a],b=>olympe.C.xb(b.valueOf().toString()),
|
|
353
|
+
olympe.C.Sa):olympe.C.xb(a)}static Qj(a){return olympe.C.gb(a)?olympe.C.sa([a],b=>olympe.C.qa(-b.valueOf()),olympe.C.$):olympe.C.qa(-a.valueOf())}static ge(a,b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.sa([a,b],(c,d)=>olympe.C.qa(c.valueOf()+d.valueOf()),olympe.C.$,'plus'):olympe.C.qa(a.valueOf()+b.valueOf())}static uh(a,b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.ye([a,b],(c,d)=>olympe.C.qa(c.valueOf()-d.valueOf()),olympe.C.$,'minus'):olympe.C.qa(a.valueOf()-b.valueOf())}static vj(a,
|
|
354
|
+
b){return olympe.C.gb(a)||olympe.C.gb(b)?olympe.C.ye([a,b],(c,d)=>olympe.C.qa(c.valueOf()/d.valueOf()),olympe.C.$,'div'):olympe.C.qa(a.valueOf()/b.valueOf())}static Uz(a,b){if(void 0===b)return a;olympe.C.Wc([b],c=>{c=olympe.C.qa(a.Ba.Eb.valueOf()+c.valueOf());L(a.Ba,c)},'plusEqual');return a}};olympe.C.$.ZERO=new olympe.C.$(0);olympe.C.$.ONE=new olympe.C.$(1);olympe.C.$.Ow=new olympe.C.$(2);olympe.C.$.PI=new olympe.C.$(Math.PI);olympe.C.$.Hu=new olympe.C.$(Infinity);olympe.C.$.Ev=new olympe.C.$(-Infinity);
|
|
355
|
+
olympe.C.$.Bq=new olympe.C.$(NaN);olympe.C.$.LC=olympe.C.$.Uz;olympe.C.$.wA=olympe.C.$.gx;olympe.C.$.zC=olympe.C.$.offset;olympe.C.$.dB=olympe.C.$.Hs;olympe.C.$.WE=olympe.C.$.Hs;olympe.C.$.$B=olympe.C.$.gz;olympe.C.$.eB=olympe.C.$.Nx;olympe.C.$.MA=olympe.C.$.Cx;olympe.C.$.xA=olympe.C.$.animate;olympe.C.$.yA=olympe.C.$.sx;olympe.C.$.eE=olympe.C.$.Xc;olympe.C.$.fE=olympe.C.$.Qj;olympe.C.$.KC=olympe.C.$.ge;olympe.C.$.nC=olympe.C.$.uh;olympe.C.$.fB=olympe.C.$.vj;
|
|
356
|
+
olympe.C.$.mp={uq:function(a,b,c,d){return c*a/d+b},zB:function(a,b,c,d){a/=d;return c*a*a+b},JB:function(a,b,c,d){a/=d;return-c*a*(a-2)+b},vB:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a+b;a--;return-c/2*(a*(a-2)-1)+b},oB:function(a,b,c,d){a/=d;return c*a*a*a+b},FB:function(a,b,c,d){a/=d;a--;return c*(a*a*a+1)+b},tB:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a+b;a-=2;return c/2*(a*a*a+2)+b},AB:function(a,b,c,d){a/=d;return c*a*a*a*a+b},KB:function(a,b,c,d){a/=d;a--;return-c*(a*a*a*a-1)+b},
|
|
357
|
+
wB:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a*a+b;a-=2;return-c/2*(a*a*a*a-2)+b},BB:function(a,b,c,d){a/=d;return c*a*a*a*a*a+b},LB:function(a,b,c,d){a/=d;a--;return c*(a*a*a*a*a+1)+b},xB:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a*a*a+b;a-=2;return c/2*(a*a*a*a*a+2)+b},CB:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},MB:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},yB:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},rB:function(a,b,c,d){return c*Math.pow(2,
|
|
358
|
+
10*(a/d-1))+b},IB:function(a,b,c,d){return c*(-Math.pow(2,-10*a/d)+1)+b},uB:function(a,b,c,d){a/=d/2;if(1>a)return c/2*Math.pow(2,10*(a-1))+b;a--;return c/2*(-Math.pow(2,-10*a)+2)+b},nB:function(a,b,c,d){a/=d;return-c*(Math.sqrt(1-a*a)-1)+b},EB:function(a,b,c,d){a/=d;a--;return c*Math.sqrt(1-a*a)+b},sB:function(a,b,c,d){a/=d/2;if(1>a)return-c/2*(Math.sqrt(1-a*a)-1)+b;a-=2;return c/2*(Math.sqrt(1-a*a)+1)+b},iB:function(a,b,c,d){d=(a/=d)*a;return b+c*(4*d*a+-3*d)},jB:function(a,b,c,d){d=(a/=d)*a;return b+
|
|
359
|
+
c*(2*d*d+2*d*a+-3*d)},kB:function(a,b,c,d){d=(a/=d)*a;return b+c*(4*d*a+-9*d+6*a)},lB:function(a,b,c,d){d=(a/=d)*a;return b+c*(-2*d*d+10*d*a+-15*d+8*a)},HB:function(a,b,c,d){d=(a/=d)*a;const e=d*a;return b+c*(33*e*d+-106*d*d+126*e+-67*d+15*a)},GB:function(a,b,c,d){d=(a/=d)*a;const e=d*a;return b+c*(56*e*d+-175*d*d+200*e+-100*d+20*a)},qB:function(a,b,c,d){d=(a/=d)*a;a*=d;return b+c*(33*a*d+-59*d*d+32*a+-5*d)},pB:function(a,b,c,d){d=(a/=d)*a;a*=d;return b+c*(56*a*d+-105*d*d+60*a+-10*d)},DB:function(a,
|
|
360
|
+
b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},mB:function(a,b,c,d){a=d-a;d=(a/=d)<1/2.75?7.5625*c*a*a:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375):c*(7.5625*(a-=2.625/2.75)*a+.984375);return c-d+b}};m=olympe.C.$.prototype;m.toJSON.K=olympe.C.J.j;m.ho.K=olympe.C.J.j;m.isNaN.K=olympe.C.J.N;m.Xc.K=olympe.C.J.D;
|
|
361
|
+
m.toString.K=new olympe.C.J(()=>String,[]);m.toFixed.K=new olympe.C.J(()=>String,[]);m.ge.K=new olympe.C.J(()=>olympe.C.$,[0]);m.uh.K=new olympe.C.J(()=>olympe.C.$,[0]);m.round.K=olympe.C.J.F;m.Qj.K=olympe.C.J.F;m.sl.K=new olympe.C.J(()=>olympe.C.$,[0]);m.vj.K=new olympe.C.J(()=>olympe.C.$,[0]);m.yz.K=new olympe.C.J(()=>olympe.C.$,[0]);m.floor.K=olympe.C.J.F;m.ceil.K=olympe.C.J.F;m.trunc.K=olympe.C.J.F;m.log.K=olympe.C.J.F;m.pow.K=new olympe.C.J(()=>olympe.C.$,[0]);m.exp.K=olympe.C.J.F;
|
|
362
|
+
m.Jd.K=new olympe.C.J(()=>olympe.C.da,[0]);m.Ea.K=olympe.C.J.j;m.valueOf.K=olympe.C.J.j;m.Ly.K=olympe.C.J.j;m.Sn.K=new olympe.C.J(()=>olympe.C.da,[0]);m.cA.K=new olympe.C.J(()=>olympe.C.$,[0]);m.st.K=new olympe.C.J(()=>olympe.C.$,[0]);m.oz.K=new olympe.C.J(()=>olympe.C.da,[0]);m.sin.K=olympe.C.J.F;m.cos.K=olympe.C.J.F;m.atan2.K=new olympe.C.J(()=>olympe.C.$,[0]);m.abs.K=olympe.C.J.F;m.Ij.K=new olympe.C.J(()=>olympe.C.$,[0,1]);olympe.C.Sa=class{constructor(a){this.value=a}toJSON(){return'{ "type": "string", "value": '+JSON.stringify(this.value)+' }'}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.C.xb(b.value)}Es(a){return olympe.C.Sa.concat(this,'.',a)}concat(...a){let b;Array.isArray(a[0])?b=a[0]:b=a;return olympe.C.sa([this,...b],(...c)=>{let d='';for(let e=0,f=c.length;e<f;e++)d=c[e]?d+c[e].valueOf():d+c[e];return olympe.C.xb(d)},olympe.C.Sa,'OString.concat')}Xc(){return this}pA(a){return olympe.C.qa(parseInt(this.value,
|
|
363
|
+
a))}zt(){return olympe.C.qa(parseFloat(this.value))}toString(){return this.value}valueOf(){return this.value.valueOf()}Ea(a){return this.value===(void 0===a||null===a?void 0:a.valueOf())}Jd(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.Rb(c&&b.valueOf()===c.valueOf()),olympe.C.da,'OString.oEquals')}nf(){return olympe.C.Rb(!this.value||0===this.value.length)}contains(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.Rb((c instanceof olympe.C.Sa||'string'===typeof c)&&b.valueOf().includes(c.valueOf())),
|
|
364
|
+
olympe.C.da,'OString.contains')}startsWith(a,b){return olympe.C.sa([this,a,b||0],(c,d,e)=>olympe.C.Rb(c.valueOf().startsWith(d.valueOf(),e.valueOf())),olympe.C.da,'OString.startsWith')}endsWith(a,b){return olympe.C.sa([this,a,b||-1],(c,d,e)=>{e=0<=e.valueOf()?e.valueOf():this.Jn().valueOf()+e.valueOf()+1;return olympe.C.Rb(c.valueOf().endsWith(d.valueOf(),e))},olympe.C.da,'OString.endsWith')}indexOf(a,b){return olympe.C.sa([this,a,b||0],(c,d,e)=>olympe.C.qa(c.valueOf().indexOf(d.valueOf(),e.valueOf())),
|
|
365
|
+
olympe.C.$,'OString.indexOf')}lastIndexOf(a,b){return olympe.C.sa([this,a,b||Infinity],(c,d,e)=>olympe.C.qa(c.valueOf().lastIndexOf(d.valueOf(),e.valueOf())),olympe.C.$,'OString.lastIndexOf')}slice(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().slice(d.valueOf(),e?e.valueOf():void 0)),olympe.C.Sa,'OString.slice')}Jn(){return olympe.C.qa(this.value.length)}threshold(a){return olympe.C.sa([this,a],(b,c)=>b.valueOf().length>=c.valueOf()?b:olympe.C.Sa.EMPTY,olympe.C.Sa,'OString.threshold')}toLowerCase(){return olympe.C.xb(this.value.toLowerCase())}toUpperCase(){return olympe.C.xb(this.value.toUpperCase())}trim(){return olympe.C.xb(this.value.trim())}padStart(a,
|
|
366
|
+
b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().padStart(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.padStart')}padEnd(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().padEnd(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.padEnd')}replace(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().replace(d.valueOf(),e.valueOf())),olympe.C.Sa,'OString.replace')}lA(a,b){return olympe.C.sa([this,a,b],(c,d,e)=>olympe.C.xb(c.valueOf().substr(d.valueOf(),
|
|
367
|
+
e.valueOf())),olympe.C.Sa,'OString.subOStr')}static concat(...a){return olympe.C.xb('').concat(...a)}};olympe.C.Sa.EMPTY=new olympe.C.Sa('');olympe.C.Sa.zw=new olympe.C.Sa(' ');m=olympe.C.Sa.prototype;m.toJSON.K=olympe.C.J.j;m.Es.K=new olympe.C.J(()=>olympe.C.Sa,[0,1]);m.concat.K=olympe.C.J.D;m.Xc.K=olympe.C.J.D;m.pA.K=olympe.C.J.F;m.zt.K=olympe.C.J.F;m.toString.K=olympe.C.J.j;m.valueOf.K=olympe.C.J.j;m.Ea.K=olympe.C.J.j;m.Jd.K=new olympe.C.J(()=>olympe.C.da,[0]);m.nf.K=olympe.C.J.N;
|
|
368
|
+
m.contains.K=new olympe.C.J(()=>olympe.C.da,[0]);m.startsWith.K=new olympe.C.J(()=>olympe.C.da,[0,1]);m.endsWith.K=new olympe.C.J(()=>olympe.C.da,[0,1]);m.indexOf.K=new olympe.C.J(()=>olympe.C.$,[0,1]);m.lastIndexOf.K=new olympe.C.J(()=>olympe.C.$,[0,1]);m.slice.K=new olympe.C.J(()=>olympe.C.Sa,[0,1]);m.Jn.K=olympe.C.J.F;m.threshold.K=new olympe.C.J(()=>olympe.C.Sa,[0]);m.toLowerCase.K=olympe.C.J.D;m.toUpperCase.K=olympe.C.J.D;m.trim.K=olympe.C.J.D;m.padStart.K=olympe.C.J.D;m.padEnd.K=olympe.C.J.D;
|
|
369
|
+
m.replace.K=olympe.C.J.D;m.lA.K=olympe.C.J.D;olympe.C.da=class{constructor(a){this.value=a}toJSON(){return`{ "type": "boolean", "value": ${this.value.valueOf()}}`}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return b.value?olympe.C.da.D:olympe.C.da.j}and(a){if(void 0!==a)return olympe.C.gb(a)?olympe.C.ye([a],b=>new olympe.C.da(this.valueOf()&&b.valueOf()),olympe.C.da,'and'):this.value&&a.valueOf()?olympe.C.da.D:olympe.C.da.j}Ea(a){return this.valueOf()===(void 0!==a?a.valueOf():void 0)}Jd(a){if(void 0!==a)return olympe.C.gb(a)?
|
|
370
|
+
olympe.C.ye([a],b=>new olympe.C.da(this.valueOf()===b.valueOf()),olympe.C.da,'oEquals'):this.Ea(a)?olympe.C.da.D:olympe.C.da.j}zd(){return this.value?olympe.C.da.j:olympe.C.da.D}qx(a){if(void 0!==a)return olympe.C.gb(a)?olympe.C.ye([a],b=>new olympe.C.da(!(this.valueOf()&&b.valueOf())),olympe.C.da,'andNot'):this.value&&!a.valueOf()?olympe.C.da.D:olympe.C.da.j}or(a){if(void 0!==a)return olympe.C.gb(a)?olympe.C.ye([a],b=>new olympe.C.da(this.valueOf()||b.valueOf()),olympe.C.da,'or'):this.value||a.valueOf()?
|
|
371
|
+
olympe.C.da.D:olympe.C.da.j}xor(a){return olympe.C.sa([this,a],(b,c)=>{b=b.valueOf();c=c.valueOf();return olympe.C.Rb(b&&!c||!b&&c)},olympe.C.da,'OBoolean.xor')}ay(){return this.value}Ws(){return!0===this.value?olympe.C.$.ONE:olympe.C.$.ZERO}Xc(){return olympe.C.xb(this.toString())}toString(){return this.value?'true':'false'}valueOf(){return this.value}};olympe.C.da.D=new olympe.C.da(!0);olympe.C.da.j=new olympe.C.da(!1);m=olympe.C.da.prototype;m.toJSON.K=olympe.C.J.j;
|
|
372
|
+
m.and.K=new olympe.C.J(()=>olympe.C.da,[0]);m.Ea.K=olympe.C.J.j;m.Jd.K=new olympe.C.J(()=>olympe.C.da,[0]);m.zd.K=olympe.C.J.N;m.qx.K=new olympe.C.J(()=>olympe.C.da,[0]);m.or.K=new olympe.C.J(()=>olympe.C.da,[0]);m.xor.K=new olympe.C.J(()=>olympe.C.da,[0]);m.ay.K=new olympe.C.J(()=>Boolean,[]);m.Ws.K=olympe.C.J.F;m.Xc.K=olympe.C.J.D;m.toString.K=olympe.C.J.j;m.valueOf.K=olympe.C.J.j;function nc(a){return new olympe.C.eb(new Date(a))}
|
|
373
|
+
olympe.C.eb=class{constructor(a){this.sb=a}toJSON(){return'{ "type": "dateTime", "value": "'+this.sb.toJSON()+'" }'}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.C.eb(new Date(b.value.valueOf()))}static now(){return new olympe.C.eb(new Date)}mq(){return this.sb&&!isNaN(this.sb.getTime())?olympe.C.da.D:olympe.C.da.j}Ou(){return olympe.C.qa(this.sb.getMilliseconds())}Qu(){return olympe.C.qa(this.sb.getSeconds())}Pu(){return olympe.C.qa(this.sb.getMinutes())}Nu(){return olympe.C.qa(this.sb.getHours())}qy(){return olympe.C.qa(this.sb.getDate())}getMonth(){return olympe.C.qa(this.sb.getMonth()+1)}Ru(){return olympe.C.qa(this.sb.getFullYear())}getTime(){return this.sb.getTime()}iA(){var a=
|
|
374
374
|
olympe.C,b=a.xb;var c=this.sb.getDate();c=10>c?'0'+c:c;var d=this.sb.getMonth()+1;return b.call(a,`${c}.${10>d?'0'+d:d}.${this.sb.getFullYear()}`)}toLocaleString(a){return void 0===a||'string'===typeof a?olympe.C.xb(this.sb.toLocaleString(a)):olympe.C.sa([this,a],(b,c)=>olympe.C.xb(b.sb.toLocaleString(c.valueOf())),olympe.C.Sa)}toLocaleDateString(a){return void 0===a||'string'===typeof a?olympe.C.xb(this.sb.toLocaleDateString(a)):olympe.C.sa([this,a],(b,c)=>olympe.C.xb(b.sb.toLocaleDateString(c.valueOf())),
|
|
375
|
-
olympe.C.Sa)}toLocaleTimeString(a){return void 0===a||'string'===typeof a?olympe.C.xb(this.sb.toLocaleTimeString(a)):olympe.C.sa([this,a],(b,c)=>olympe.C.xb(b.sb.toLocaleTimeString(c.valueOf())),olympe.C.Sa)}Xc(){return olympe.C.xb(this.sb.toISOString())}
|
|
376
|
-
a)}
|
|
377
|
-
b=>olympe.C.
|
|
378
|
-
void 0===d&&(olympe.
|
|
379
|
-
new Date(this.getTime()):new Date(0)}};olympe.C.eb.j=nc(0);olympe.C.eb.D=nc(Number.NaN);m=olympe.C.eb.prototype;m.
|
|
380
|
-
m.
|
|
381
|
-
m.
|
|
382
|
-
olympe.C.Color=class{constructor(a,b,c,d){this.j=olympe.C.qa(void 0!==a?Math.min(255,Math.max(0,Math.round(a))):0);this.D=olympe.C.qa(void 0!==b?Math.min(255,Math.max(0,Math.round(b))):0);this.b=olympe.C.qa(void 0!==c?Math.min(255,Math.max(0,Math.round(c))):0);this.a=olympe.C.qa(void 0!==d?Math.min(1,Math.max(0,d)):1)}toJSON(){return{r:this.j.valueOf(),g:this.D.valueOf(),b:this.b.valueOf(),a:this.a.valueOf()}}static
|
|
383
|
-
b.g,b.b,b.a)}static create(a,b,c,d=1){return olympe.C.sa([a,b,c,d],(e,f,g,h)=>{e=olympe.C.qa(void 0!==e?Math.min(255,Math.max(0,Math.round(e.valueOf()))):0);f=olympe.C.qa(void 0!==f?Math.min(255,Math.max(0,Math.round(f.valueOf()))):0);g=olympe.C.qa(void 0!==g?Math.min(255,Math.max(0,Math.round(g.valueOf()))):0);h=olympe.C.qa(void 0!==h?Math.min(1,Math.max(0,h.valueOf())):1);for(let k of oc.values())if(k&&k.j.Ea(e)&&k.D.Ea(f)&&k.b.Ea(g)&&k.a.Ea(h))return k;return new olympe.C.Color(e,f,g,h)},olympe.C.Color)}oh(){return this.j}hh(){return this.b}lh(){return this.D}gh(){return this.a}
|
|
384
|
-
b){return olympe.C.Color.create(this.j.Ij(a.oh(),b),this.D.Ij(a.lh(),b),this.b.Ij(a.hh(),b),this.a.Ij(a.gh(),b))}
|
|
385
|
-
this.D.valueOf()===a.D.valueOf()&&this.b.valueOf()===a.b.valueOf()&&this.a.valueOf()===a.a.valueOf():!1}compare(a){const b=(this.oh().valueOf()<<16|this.lh().valueOf()<<8|this.hh().valueOf())-(a.oh().valueOf()<<16|a.lh().valueOf()<<8|a.hh().valueOf());return 0===b?this.gh().valueOf()-a.gh().valueOf():b}};olympe.C.Color.prototype.equals=olympe.C.Color.prototype.Ea;olympe.C.Color.prototype.toHexString=olympe.C.Color.prototype.
|
|
386
|
-
olympe.C.Color.prototype.getAlpha=olympe.C.Color.prototype.gh;olympe.C.Color.prototype.getGreen=olympe.C.Color.prototype.lh;olympe.C.Color.prototype.getBlue=olympe.C.Color.prototype.hh;olympe.C.Color.prototype.getRed=olympe.C.Color.prototype.oh;olympe.C.Color.create=olympe.C.Color.create;m=olympe.C.Color.prototype;m.toJSON.K=olympe.C.J.j;m.oh.K=olympe.C.J.F;m.hh.K=olympe.C.J.F;m.lh.K=olympe.C.J.F;m.gh.K=olympe.C.J.F;m.
|
|
387
|
-
m.
|
|
388
|
-
olympe.C.Zb,'Vector2.plus')}uh(a){return olympe.C.sa([this,a],(b,c)=>new olympe.C.Zb(b.x.uh(c.x),b.y.uh(c.y)),olympe.C.Zb,'Vector2.minus')}
|
|
389
|
-
a+b*b)),olympe.C.$)}normalize(){return olympe.C.sa([this.x,this.y],(a,b)=>{const c=Math.sqrt(a*a+b*b);return new olympe.C.Zb(a/c,b/c)},olympe.C.Zb)}floor(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.floor(a),Math.floor(b)),olympe.C.Zb)}ceil(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.ceil(a),Math.ceil(b)),olympe.C.Zb)}round(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.round(a),Math.round(b)),olympe.C.Zb)}
|
|
390
|
-
this.y.
|
|
391
|
-
m.uh.K=new olympe.C.J(()=>olympe.C.Zb,[0]);m.
|
|
392
|
-
m.mf.K=new olympe.C.J(()=>String,[]);m.Rf.K=olympe.C.J.j;m.
|
|
393
|
-
c)&&gc(b[c],a)}get(a){const b=c=>{null===this.ia&&(this.ia={});return this.Bj(this.ia,c,this.values[c],this.valueType,'Map.get('+c+')')};return olympe.C.sa([a],c=>b(c),this.valueType)}oi(a){a=this.values[a];return olympe.C.gb(a)?Sb(a.Ba)?a.Ba.Eb:void 0:a}has(a){const b=c=>{null===this.Ua&&(this.Ua={});return this.Bj(this.Ua,c,c in this.values?olympe.C.
|
|
394
|
-
f||this.H.run(()=>{f=olympe.C.Wd(d,void 0,e);a[b]=f;f.Ba.onDestroy(()=>delete a[b]);olympe.C.gb(c)?jc(f,c):hc(f,c)});return f}Jc(){throw Error('Abstract method getFirstKey needs to be overridden');}Tf(){throw Error('Abstract method getFirstKey needs to be overridden');}Cf(){null===this.F&&this.H.run(()=>{this.F=olympe.C.Wd(olympe.C.$,olympe.C.qa(this.size));this.F.Ba.onDestroy(()=>{this.F=null})});return this.F}wg(){return this.size}forEach(a,b){const c=this.
|
|
395
|
-
b){this.lb[a]=b;olympe.C.Za().Xd(()=>{const c=this.R;for(const d in c)Object.prototype.hasOwnProperty.call(c,d)&&delete c[d][a];delete this.lb[a]});this.
|
|
396
|
-
a(b[c],c,this))break}
|
|
375
|
+
olympe.C.Sa)}toLocaleTimeString(a){return void 0===a||'string'===typeof a?olympe.C.xb(this.sb.toLocaleTimeString(a)):olympe.C.sa([this,a],(b,c)=>olympe.C.xb(b.sb.toLocaleTimeString(c.valueOf())),olympe.C.Sa)}Xc(){return olympe.C.xb(this.sb.toISOString())}mA(){return new Date(this.getTime())}oA(){return this}qA(){return this}qg(a,b){return olympe.C.sa([b],c=>{const d=new olympe.C.eb(new Date(this.sb.getTime()));d.sb['set'+a](this.sb['get'+a]()+c.valueOf());return d},olympe.C.eb)}ix(a){return this.qg('Milliseconds',
|
|
376
|
+
a)}nx(a){return this.qg('Seconds',a)}jx(a){return this.qg('Minutes',a)}hx(a){return this.qg('Hours',a)}pn(a){return this.qg('Date',a)}ox(a){return'number'===typeof a?this.pn(7*a):this.pn(a.sl(7))}kx(a){return this.qg('Month',a)}px(a){return this.qg('FullYear',a)}jA(){let a=this.sb.getDay();a=0===a?6:a-1;return new olympe.C.eb(new Date(this.sb.getFullYear(),this.sb.getMonth(),this.sb.getDate()-a))}kA(){return new olympe.C.eb(new Date(this.sb.getFullYear(),this.sb.getMonth()))}Jd(a){return olympe.C.sa([a],
|
|
377
|
+
b=>olympe.C.Rb(this.Ea(b)),olympe.C.da)}Ea(a){return a instanceof olympe.C.eb?this.getTime()===a.getTime()||isNaN(this.getTime())&&isNaN(a.getTime()):!1}Dy(){let a=this.sb.getDay();0===a&&(a=7);return olympe.C.qa(a)}vy(a,b){return olympe.C.sa([a,b],(c,d)=>{d=d.valueOf();'years'===d?c=this.sb.getFullYear()-c.sb.getFullYear():'months'===d?c=12*(this.sb.getFullYear()-c.sb.getFullYear())+(this.sb.getMonth()-c.sb.getMonth()):(d={milliseconds:1,seconds:1E3,minutes:6E4,hours:36E5,days:864E5,weeks:6048E5}[d],
|
|
378
|
+
void 0===d&&(olympe.ga.Wa('df').warn("[getDiff] '_unit' is not a valid unit! Defaulting to milliseconds"),d=1),c=Math.trunc((this.sb.getTime()-c.sb.getTime())/d));return olympe.C.qa(c)},olympe.C.$)}jz(a){return olympe.C.sa([a],b=>olympe.C.Rb(this.getTime()<b.getTime()),olympe.C.da)}hz(a){return olympe.C.sa([a],b=>olympe.C.Rb(this.getTime()>b.getTime()),olympe.C.da)}kz(a,b){return olympe.C.sa([a,b],(c,d)=>olympe.C.Rb(this.getTime()>c.getTime()&&this.getTime()<d.getTime()),olympe.C.da)}valueOf(){return this.mq().valueOf()?
|
|
379
|
+
new Date(this.getTime()):new Date(0)}};olympe.C.eb.j=nc(0);olympe.C.eb.D=nc(Number.NaN);m=olympe.C.eb.prototype;m.mq.K=olympe.C.J.N;m.Ou.K=olympe.C.J.F;m.Qu.K=olympe.C.J.F;m.Pu.K=olympe.C.J.F;m.Nu.K=olympe.C.J.F;m.qy.K=olympe.C.J.F;m.getMonth.K=olympe.C.J.F;m.Ru.K=olympe.C.J.F;m.getTime.K=olympe.C.J.j;m.iA.K=new olympe.C.J(()=>olympe.C.Sa,[0]);m.toLocaleString.K=olympe.C.J.D;m.toLocaleDateString.K=olympe.C.J.D;m.toLocaleTimeString.K=olympe.C.J.D;m.Xc.K=olympe.C.J.D;m.mA.K=olympe.C.J.j;
|
|
380
|
+
m.oA.K=new olympe.C.J(()=>olympe.C.eb,[]);m.qA.K=new olympe.C.J(()=>olympe.C.eb,[]);m.qg.K=new olympe.C.J(()=>olympe.C.eb,[]);m.ix.K=new olympe.C.J(()=>olympe.C.eb,[]);m.nx.K=new olympe.C.J(()=>olympe.C.eb,[]);m.jx.K=new olympe.C.J(()=>olympe.C.eb,[]);m.hx.K=new olympe.C.J(()=>olympe.C.eb,[]);m.pn.K=new olympe.C.J(()=>olympe.C.eb,[0]);m.ox.K=new olympe.C.J(()=>olympe.C.eb,[]);m.kx.K=new olympe.C.J(()=>olympe.C.eb,[]);m.px.K=new olympe.C.J(()=>olympe.C.eb,[0]);
|
|
381
|
+
m.jA.K=new olympe.C.J(()=>olympe.C.eb,[]);m.kA.K=new olympe.C.J(()=>olympe.C.eb,[]);m.Jd.K=olympe.C.J.N;m.Ea.K=olympe.C.J.j;m.Dy.K=olympe.C.J.F;m.vy.K=new olympe.C.J(()=>olympe.C.$,[0,1]);m.jz.K=new olympe.C.J(()=>olympe.C.da,[0]);m.hz.K=new olympe.C.J(()=>olympe.C.da,[0]);m.kz.K=new olympe.C.J(()=>olympe.C.da,[0,1]);m.valueOf.K=olympe.C.J.j;const oc=new Map,pc=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,qc=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;function rc(a){const b=c=>{let d;c=c.valueOf();6>c.length?(d=17,c=qc.exec(c)):(d=1,c=pc.exec(c));c=c?c.slice(1).map(e=>parseInt(e,16)*d):[0,0,0];return olympe.C.Color.create(c[0],c[1],c[2],isNaN(c[3])?1:c[3]/255)};return olympe.C.pf(a)?olympe.C.ye([a],b,olympe.C.Color):b(a)}
|
|
382
|
+
olympe.C.Color=class{constructor(a,b,c,d){this.j=olympe.C.qa(void 0!==a?Math.min(255,Math.max(0,Math.round(a))):0);this.D=olympe.C.qa(void 0!==b?Math.min(255,Math.max(0,Math.round(b))):0);this.b=olympe.C.qa(void 0!==c?Math.min(255,Math.max(0,Math.round(c))):0);this.a=olympe.C.qa(void 0!==d?Math.min(1,Math.max(0,d)):1)}toJSON(){return{r:this.j.valueOf(),g:this.D.valueOf(),b:this.b.valueOf(),a:this.a.valueOf()}}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.C.Color.create(b.r,
|
|
383
|
+
b.g,b.b,b.a)}static create(a,b,c,d=1){return olympe.C.sa([a,b,c,d],(e,f,g,h)=>{e=olympe.C.qa(void 0!==e?Math.min(255,Math.max(0,Math.round(e.valueOf()))):0);f=olympe.C.qa(void 0!==f?Math.min(255,Math.max(0,Math.round(f.valueOf()))):0);g=olympe.C.qa(void 0!==g?Math.min(255,Math.max(0,Math.round(g.valueOf()))):0);h=olympe.C.qa(void 0!==h?Math.min(1,Math.max(0,h.valueOf())):1);for(let k of oc.values())if(k&&k.j.Ea(e)&&k.D.Ea(f)&&k.b.Ea(g)&&k.a.Ea(h))return k;return new olympe.C.Color(e,f,g,h)},olympe.C.Color)}oh(){return this.j}hh(){return this.b}lh(){return this.D}gh(){return this.a}vx(a,
|
|
384
|
+
b){return olympe.C.Color.create(this.j.Ij(a.oh(),b),this.D.Ij(a.lh(),b),this.b.Ij(a.hh(),b),this.a.Ij(a.gh(),b))}Ux(a){return olympe.C.Color.create(this.j,this.D,this.b,a)}At(){return`rgba(${this.j},${this.D},${this.b},${this.a})`}eo(){const a=(16777216|this.b|this.D<<8|this.j<<16).toString(16).slice(1),b=1===this.a.valueOf()?'':(256|255*this.a).toString(16).slice(1);return'#'+(a+b).toUpperCase()}toString(){return this.eo()}Ea(a){return a instanceof olympe.C.Color?this.j.valueOf()===a.j.valueOf()&&
|
|
385
|
+
this.D.valueOf()===a.D.valueOf()&&this.b.valueOf()===a.b.valueOf()&&this.a.valueOf()===a.a.valueOf():!1}compare(a){const b=(this.oh().valueOf()<<16|this.lh().valueOf()<<8|this.hh().valueOf())-(a.oh().valueOf()<<16|a.lh().valueOf()<<8|a.hh().valueOf());return 0===b?this.gh().valueOf()-a.gh().valueOf():b}};olympe.C.Color.prototype.equals=olympe.C.Color.prototype.Ea;olympe.C.Color.prototype.toHexString=olympe.C.Color.prototype.eo;olympe.C.Color.prototype.toRGBString=olympe.C.Color.prototype.At;
|
|
386
|
+
olympe.C.Color.prototype.getAlpha=olympe.C.Color.prototype.gh;olympe.C.Color.prototype.getGreen=olympe.C.Color.prototype.lh;olympe.C.Color.prototype.getBlue=olympe.C.Color.prototype.hh;olympe.C.Color.prototype.getRed=olympe.C.Color.prototype.oh;olympe.C.Color.create=olympe.C.Color.create;m=olympe.C.Color.prototype;m.toJSON.K=olympe.C.J.j;m.oh.K=olympe.C.J.F;m.hh.K=olympe.C.J.F;m.lh.K=olympe.C.J.F;m.gh.K=olympe.C.J.F;m.vx.K=new olympe.C.J(()=>olympe.C.Color,[]);
|
|
387
|
+
m.Ux.K=new olympe.C.J(()=>olympe.C.Color,[]);m.At.K=new olympe.C.J(()=>String,[]);m.eo.K=new olympe.C.J(()=>String,[]);m.Ea.K=olympe.C.J.j;m.compare.K=olympe.C.J.j;olympe.C.File=class{ka(){}nq(){}oq(){}Vs(){}gl(){}Fn(){}hl(){}rename(){}};olympe.C.Zb=class{constructor(a,b){this.x=olympe.C.fe(a);this.y=olympe.C.fe(b)}toJSON(){return'{ "type": "vector2", "x": '+JSON.stringify(olympe.C.Qa(this.x).valueOf())+', "y": '+JSON.stringify(olympe.C.Qa(this.y).valueOf())+' }'}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.C.Zb(b.x,b.y)}Su(){return this.x}gA(a){kc(this.x,a)}Tu(){return this.y}hA(a){kc(this.y,a)}Wy(){return this.x.st(this.y)}ge(a){return olympe.C.sa([this,a],(b,c)=>new olympe.C.Zb(b.x.ge(c.x),b.y.ge(c.y)),
|
|
388
|
+
olympe.C.Zb,'Vector2.plus')}uh(a){return olympe.C.sa([this,a],(b,c)=>new olympe.C.Zb(b.x.uh(c.x),b.y.uh(c.y)),olympe.C.Zb,'Vector2.minus')}Az(a){return new olympe.C.Zb(this.x.sl(a),this.y.sl(a))}Px(a){return new olympe.C.Zb(this.x.vj(a),this.y.vj(a))}Cz(){return new olympe.C.Zb(this.x.Qj(),this.y.Qj())}Qx(a){return olympe.C.sa([this,a],(b,c)=>olympe.C.sa([b.x,b.y,c.x,c.y],(d,e,f,g)=>olympe.C.qa(d*f+e*g),olympe.C.$),olympe.C.$)}length(){return olympe.C.sa([this.x,this.y],(a,b)=>olympe.C.qa(Math.sqrt(a*
|
|
389
|
+
a+b*b)),olympe.C.$)}normalize(){return olympe.C.sa([this.x,this.y],(a,b)=>{const c=Math.sqrt(a*a+b*b);return new olympe.C.Zb(a/c,b/c)},olympe.C.Zb)}floor(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.floor(a),Math.floor(b)),olympe.C.Zb)}ceil(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.ceil(a),Math.ceil(b)),olympe.C.Zb)}round(){return olympe.C.sa([this.x,this.y],(a,b)=>new olympe.C.Zb(Math.round(a),Math.round(b)),olympe.C.Zb)}lx(a){return new olympe.C.Zb(this.x.ge(a),
|
|
390
|
+
this.y.ge(a))}mx(a,b){return new olympe.C.Zb(this.x.ge(a),this.y.ge(b))}Xc(){return olympe.C.sa([this.x,this.y],(a,b)=>olympe.C.xb(`Vector2[${a.valueOf()}, ${b.valueOf()}]`),olympe.C.Sa)}toString(){return`Vector2[${this.x.Ba.Eb}, ${this.y.Ba.Eb}]`}Ea(a){return this===a?!0:!1}};m=olympe.C.Zb.prototype;m.toJSON.K=olympe.C.J.j;m.Su.K=olympe.C.J.F;m.gA.K=olympe.C.J.j;m.Tu.K=olympe.C.J.F;m.hA.K=olympe.C.J.j;m.Wy.K=olympe.C.J.F;m.ge.K=new olympe.C.J(()=>olympe.C.Zb,[0]);
|
|
391
|
+
m.uh.K=new olympe.C.J(()=>olympe.C.Zb,[0]);m.Az.K=olympe.C.J.R;m.Px.K=olympe.C.J.R;m.Cz.K=olympe.C.J.R;m.Qx.K=new olympe.C.J(()=>olympe.C.$,[0]);m.length.K=olympe.C.J.F;m.normalize.K=olympe.C.J.R;m.floor.K=olympe.C.J.R;m.ceil.K=olympe.C.J.R;m.round.K=olympe.C.J.R;m.lx.K=olympe.C.J.R;m.mx.K=olympe.C.J.R;m.Xc.K=olympe.C.J.D;m.toString.K=olympe.C.J.j;m.Ea.K=olympe.C.J.j;olympe.C.Ig=class{constructor(){}Mb(){}Qd(){}get(){}oi(){}has(){}rh(){}Jc(){}Tf(){}Cf(){}wg(){}forEach(){}oe(){}};olympe.C.Ig.prototype.forEachCurrentValue=olympe.C.Ig.prototype.oe;olympe.C.Ig.prototype.forEach=olympe.C.Ig.prototype.forEach;m=olympe.C.Ig.prototype;m.has.K=olympe.C.J.N;m.rh.K=olympe.C.J.j;m.Jc.K=new olympe.C.J(()=>Object,[]);m.Tf.K=new olympe.C.J(()=>String,[]);m.Cf.K=olympe.C.J.F;m.wg.K=olympe.C.J.j;m.forEach.K=new olympe.C.J(()=>{},[]);m.oe.K=olympe.C.J.j;olympe.C.vd=class extends olympe.C.Ig{Hd(){}Sf(){}mf(){}Rf(){}qe(){}lf(){}wj(){}si(){}};olympe.C.vd.prototype.getCurrentAt=olympe.C.vd.prototype.lf;olympe.C.vd.prototype.getAt=olympe.C.vd.prototype.qe;olympe.C.vd.prototype.getCurrentKeyAt=olympe.C.vd.prototype.Rf;olympe.C.vd.prototype.getKeyAt=olympe.C.vd.prototype.mf;olympe.C.vd.prototype.getCurrentRank=olympe.C.vd.prototype.Sf;olympe.C.vd.prototype.getRank=olympe.C.vd.prototype.Hd;m=olympe.C.vd.prototype;m.Hd.K=olympe.C.J.F;m.Sf.K=olympe.C.J.j;
|
|
392
|
+
m.mf.K=new olympe.C.J(()=>String,[]);m.Rf.K=olympe.C.J.j;m.qe.K=new olympe.C.J(()=>Object,[]);m.lf.K=olympe.C.J.j;m.wj.K=olympe.C.J.j;m.si.K=new olympe.C.J(()=>Array,[]);olympe.C.Ci=class{constructor(a,b){this.H=b||olympe.C.Za();this.valueType=a||Object;this.values={};this.Ua=this.ia=null;this.Qe=0;this.R=Object.create(null);this.lb=Object.create(null);this.size=0;this.F=null;this.H.onDestroy(()=>{const c=this.R;if(c){const d=Object.keys(c),e=d.length;for(let f=0;f<e;f++){const g=c[d[f]],h=Object.keys(g);for(let k=h.length,l=0;l<k;l++)g[h[l]].destroy()}}})}getContext(){return this.H}Mb(){return this.valueType}Qd(a){this.valueType=a;const b=this.ia;if(null!==b)for(const c in b)Object.prototype.hasOwnProperty.call(b,
|
|
393
|
+
c)&&gc(b[c],a)}get(a){const b=c=>{null===this.ia&&(this.ia={});return this.Bj(this.ia,c,this.values[c],this.valueType,'Map.get('+c+')')};return olympe.C.sa([a],c=>b(c),this.valueType)}oi(a){a=this.values[a];return olympe.C.gb(a)?Sb(a.Ba)?a.Ba.Eb:void 0:a}has(a){const b=c=>{null===this.Ua&&(this.Ua={});return this.Bj(this.Ua,c,c in this.values?olympe.C.da.D:olympe.C.da.j,olympe.C.da,'Map.has('+c+')')};return olympe.C.sa([a],c=>b(c),olympe.C.da)}rh(a){return a in this.values}Bj(a,b,c,d,e){let f=a[b];
|
|
394
|
+
f||this.H.run(()=>{f=olympe.C.Wd(d,void 0,e);a[b]=f;f.Ba.onDestroy(()=>delete a[b]);olympe.C.gb(c)?jc(f,c):hc(f,c)});return f}Jc(){throw Error('Abstract method getFirstKey needs to be overridden');}Tf(){throw Error('Abstract method getFirstKey needs to be overridden');}Cf(){null===this.F&&this.H.run(()=>{this.F=olympe.C.Wd(olympe.C.$,olympe.C.qa(this.size));this.F.Ba.onDestroy(()=>{this.F=null})});return this.F}wg(){return this.size}forEach(a,b){const c=this.kn();a=this.xs(c,a,b);this.jn(c,a)}kn(){return String(++this.Qe)}jn(a,
|
|
395
|
+
b){this.lb[a]=b;olympe.C.Za().Xd(()=>{const c=this.R;for(const d in c)Object.prototype.hasOwnProperty.call(c,d)&&delete c[d][a];delete this.lb[a]});this.oe(b)}xs(a,b,c){const d=olympe.C.Za();return(e,f)=>{d.run(()=>{const g=olympe.C.createNode(void 0,b,null,[e,f,this],null,`forEach-${a}-${f}`);if(void 0!==c)g.onDestroy(()=>{c(f)});this.nn(a,f,g)})}}nn(a,b,c){void 0===this.R[b]&&(this.R[b]={});this.R[b][a]=c}oe(a){const b=this.values;for(const c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&!1===
|
|
396
|
+
a(b[c],c,this))break}al(a,b){void 0!==this.values[a]&&this.pj(a,!0);this.values[a]=b;var c=this.ia;null!==c&&void 0!==c[a]&&(b&&b instanceof olympe.C.Proxy?jc(c[a],b):hc(c[a],b));c=this.Ua;null!==c&&void 0!==c[a]&&kc(c[a],!0);this.size++;c=this.lb;for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d))c[d](b,a,this)}pj(a,b){const c=this.values;if(Object.prototype.hasOwnProperty.call(c,a)){var d=(d=c[a])&&d.fh?d.Ba.Eb:d;var e=this.ia;null!==e&&void 0!==e[a]&&ic(e[a]);e=this.Ua;null!==e&&void 0!==
|
|
397
397
|
e[a]&&kc(e[a],!1);delete c[a];this.size--;b||this.Nf()}a=this.R[a];if(void 0!==a)for(const f in a)Object.prototype.hasOwnProperty.call(a,f)&&a[f].destroy();return d}Nf(){null!==this.F&&kc(this.F,this.size)}fi(){var a=this.ia;if(null!==a)for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&ic(a[c]);a=this.Ua;if(null!==a)for(var b in a)Object.prototype.hasOwnProperty.call(a,b)&&kc(a[b],!1);for(const c in this.values)Object.prototype.hasOwnProperty.call(this.values,c)&&delete this.values[c];for(const c in this.R)if(Object.prototype.hasOwnProperty.call(this.R,
|
|
398
|
-
c)){b=this.R[c];for(const d in b)Object.prototype.hasOwnProperty.call(b,d)&&b[d].destroy()}this.size=0;null!==this.F&&kc(this.F,this.size)}Lg(){const a=this.values;let b='\n';for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b+=a[c]+'\n');return b}};olympe.C.Ci.ya=[olympe.C.Ig];m=olympe.C.Ci.prototype;m.getContext.K=olympe.C.J.j;m.
|
|
399
|
-
m.Cf.K=olympe.C.J.F;m.wg.K=olympe.C.J.j;m.forEach.K=new olympe.C.J(()=>{},[]);m.
|
|
400
|
-
[0],'onResolved('+(b.name||'')+')')):b(a)}Sf(a){return this.D[a]}mf(a){const b=c=>{const d=c.valueOf(),e=this.Rf(d);null===this.wa&&(this.wa=Object.create(null));return this.Bj(this.wa,String(d),e,String,'List.getKeyAt('+c+')')};return olympe.C.sa([a],c=>b(c),String)}Rf(a){return this.j[a.valueOf()]}
|
|
401
|
-
b||this.H.run(()=>{b=this.get(this.mf(a));this.
|
|
402
|
-
{this.F=null})});return this.Z}
|
|
403
|
-
null!==d&&(void 0!==e&&null!==e&&void 0!==d[e]&&ic(d[e]),void 0!==d[b]&&hc(d[b],a))}}
|
|
398
|
+
c)){b=this.R[c];for(const d in b)Object.prototype.hasOwnProperty.call(b,d)&&b[d].destroy()}this.size=0;null!==this.F&&kc(this.F,this.size)}Lg(){const a=this.values;let b='\n';for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b+=a[c]+'\n');return b}};olympe.C.Ci.ya=[olympe.C.Ig];m=olympe.C.Ci.prototype;m.getContext.K=olympe.C.J.j;m.Mb.K=olympe.C.J.j;m.Qd.K=olympe.C.J.j;m.get.K=new olympe.C.J(()=>Object,[],'valueType');m.oi.K=olympe.C.J.j;m.has.K=olympe.C.J.N;m.rh.K=olympe.C.J.j;m.Bj.K=olympe.C.J.j;
|
|
399
|
+
m.Cf.K=olympe.C.J.F;m.wg.K=olympe.C.J.j;m.forEach.K=new olympe.C.J(()=>{},[]);m.kn.K=olympe.C.J.j;m.jn.K=olympe.C.J.j;m.xs.K=olympe.C.J.j;m.nn.K=olympe.C.J.j;m.oe.K=olympe.C.J.j;m.al.K=olympe.C.J.j;m.pj.K=olympe.C.J.j;m.Nf.K=olympe.C.J.j;m.fi.K=olympe.C.J.j;m.Lg.K=olympe.C.J.j;olympe.C.Tj=class extends olympe.C.Ci{constructor(a,b){super(a,b);this.D=Object.create(null);this.j=[];this.ba=this.wa=this.Ha=this.Z=null}Qd(a){super.Qd(a);if(null!==this.ba)for(let b of this.ba.values())gc(b,a)}Jc(){return this.qe(0)}Tf(){return this.mf(0)}Hd(a){const b=c=>{null===this.Ha&&(this.Ha=Object.create(null));let d=this.Sf(a);d=void 0!==d?olympe.C.qa(d):void 0;return this.Bj(this.Ha,c,d,olympe.C.$,`List.getRank(${c})`)};return olympe.C.gb(a)?M(olympe.C.createNode(olympe.C.$,b,null,[a.Ba],
|
|
400
|
+
[0],'onResolved('+(b.name||'')+')')):b(a)}Sf(a){return this.D[a]}mf(a){const b=c=>{const d=c.valueOf(),e=this.Rf(d);null===this.wa&&(this.wa=Object.create(null));return this.Bj(this.wa,String(d),e,String,'List.getKeyAt('+c+')')};return olympe.C.sa([a],c=>b(c),String)}Rf(a){return this.j[a.valueOf()]}qe(a){if(olympe.C.gb(a))return this.get(olympe.C.sa([a],c=>{c=this.mf(c);if(!Sb(c.Ba)){const d=olympe.C.Za();olympe.C.Wf(d)&&bc(d)}return c},String));null===this.ba&&(this.ba=new Map);let b=this.ba.get(a);
|
|
401
|
+
b||this.H.run(()=>{b=this.get(this.mf(a));this.ba.set(a,b);b.Ba.onDestroy(()=>this.ba.delete(a))});return b}lf(a){return this.oi(this.Rf(a))}wj(a,b,c,d){let e=this.kn();a=this.jt(e,a,b,c,d);this.jn(e,a)}jt(a,b,c,d,e){return olympe.C.Za().rc((f,g)=>{let h=!1,k=olympe.C.zi([b,c,this.Hd(g)],(l,n,p)=>{p>=l&&p<l+n?h||(d(f,g,this),h=!0):h&&(e(g),h=!1)});if(void 0!==e)k.onDestroy(e.bind(null,g));this.nn(a,g,k)})}si(){null===this.Z&&this.H.run(()=>{this.Z=olympe.C.Wd(Array,this.j.filter(a=>void 0!==a));this.Z.Ba.onDestroy(()=>
|
|
402
|
+
{this.F=null})});return this.Z}oe(a){if(this.j.length!==this.size)super.oe(a);else{var b=this.values;for(let c of this.j.filter(d=>void 0!==d))if(Object.prototype.hasOwnProperty.call(b,c)&&!1===a(b[c],c,this))break}}mn(a,b){const c=this.Ha,d=this.wa,e=this.D[a],f=b.valueOf();if(e!==f||this.j[e]!==a){var g=this.j[f];void 0!==g&&delete this.D[g];void 0!==e&&null!==e&&this.j[e]===a&&(this.j[e]=void 0);this.D[a]=f;this.j[f]=a;null!==c&&(void 0!==g&&void 0!==c[g]&&ic(c[g]),void 0!==c[a]&&hc(c[a],olympe.C.qa(f)));
|
|
403
|
+
null!==d&&(void 0!==e&&null!==e&&void 0!==d[e]&&ic(d[e]),void 0!==d[b]&&hc(d[b],a))}}ln(a){var b=this.wa,c=this.D[a];null!==c&&void 0!==c&&null!==b&&(b=b[c],void 0!==b&&b.Ba.Eb===a&&ic(b));delete this.D[a];this.j.splice(c,1);c=this.Ha;null!==c&&void 0!==c[a]&&ic(c[a])}ys(){if(null!==this.Z){const a=this.j,b=this.Z.Ba.Eb;b&&a.join(',')!==b.join(',')&&hc(this.Z,a)}}Nf(){this.ys();super.Nf()}fi(){var a=this.D;for(b in a)delete a[b];this.j.length=0;a=this.Ha;if(null!==a)for(b in a)ic(a[b]);a=this.wa;
|
|
404
404
|
if(null!==a)for(b in a)ic(a[parseInt(b,10)]);var b=this.Z;null!==b&&($b(b.Ba),hc(b,this.j));return olympe.C.Ci.prototype.fi.call(this)}Lg(){const a=this.values,b=this.D;let c='[\n';for(let d in a)Object.prototype.hasOwnProperty.call(a,d)&&(c+=`${b[d]}. ${a[d]}\n`);return c+']'}};olympe.C.Tj.ya=[olympe.C.vd];m=olympe.C.Tj.prototype;m.Qd.K=olympe.C.J.j;m.Jc.K=new olympe.C.J(()=>Object,[]);m.Tf.K=new olympe.C.J(()=>String,[]);m.Hd.K=olympe.C.J.F;m.Sf.K=olympe.C.J.j;m.mf.K=new olympe.C.J(()=>String,[]);
|
|
405
|
-
m.Rf.K=olympe.C.J.j;m.
|
|
406
|
-
a){const b=this.values[a];b&&b instanceof olympe.C.Proxy?jc(this.D,b):hc(this.D,b);hc(this.j,a)}else void 0!==this.D.Ba.Eb&&(ic(this.D),ic(this.j))}set(a,b){this.
|
|
407
|
-
m.
|
|
408
|
-
olympe.C.Wd=function(a,b,c){a=olympe.C.createNode(a,void 0,void 0,void 0,void 0,c);olympe.C.Wf(b)?cc(a,b):olympe.C.gb(b)?cc(a,b.Ba):L(a,b);return M(a)};olympe.C.gb=function(a){return!(!a||!a.fh)};olympe.C.pf=function(a){return!(!a||!(a instanceof olympe.C.Node||a.fh))};olympe.C.
|
|
409
|
-
olympe.C.
|
|
410
|
-
olympe.C.wh=function(a,b){let c;olympe.C.gb(a)?c=a.Ba:olympe.C.Wf(a)?c=a:olympe.C.sh(a)&&(c=a.tb().Ba);c&&olympe.C.Wc([b],d=>{c.wh(d)},'setDefaultValue');return a};olympe.C.zi=function(a,b,c,d){const e=a.length,f=Array(e),g=[];let h;for(let k=0;k<e;k++)h=a[k],void 0!==h&&null!==h&&(void 0!==h.
|
|
411
|
-
olympe.C.
|
|
412
|
-
olympe.C.
|
|
413
|
-
olympe.C.
|
|
414
|
-
olympe.C.bc=function(a,b='flowSource'){return new olympe.C.
|
|
415
|
-
olympe.C.
|
|
416
|
-
olympe.C.
|
|
417
|
-
''))});c.onDestroy(()=>{delete sc[d]})}}else olympe.C.G.log('NOT starting node dump, node is '+String(a))};olympe.C.
|
|
418
|
-
olympe.C.qa=function(a){if(void 0===a)return olympe.C.$.ZERO;if(a instanceof olympe.C.$)return a;a&&a.valueOf&&(a=a.valueOf());if('number'===typeof a){if(isNaN(a))return olympe.C.$.
|
|
419
|
-
olympe.C.
|
|
420
|
-
olympe.C.
|
|
421
|
-
olympe.C.
|
|
422
|
-
olympe.C.
|
|
423
|
-
olympe.C.
|
|
424
|
-
olympe.C.
|
|
425
|
-
class vc{constructor(a,b,c,d){this.id=a;this.D=new olympe.C.Xb('Slot manager entry');this.H=c;this.N=d;this.D.run(()=>{const e=lc(olympe.C.bc(olympe.C.$),olympe.C.$.ZERO);olympe.C.gb(b)?e.repeat(b):e.update(b);this.j=olympe.C.bc(olympe.C.$);this.F=this.j.tb().
|
|
426
|
-
this.next=null}destroy(){this.D.destroy();this.F=this.j=this.next=null}}m=vc.prototype;m.T.K=olympe.C.J.j;m.
|
|
427
|
-
function Ac(a){var b=olympe.host.
|
|
428
|
-
{zc(this,d,k,...n)})},void 0,g,h,'Native('+d+').'+k),this.D.set(l,f),f.onDestroy(()=>this.D.delete(l)));return null}.bind(a));e.Xd(a.N.bind(a,d));a=M(e);a.
|
|
429
|
-
olympe.host.Ed.H=class extends olympe.host.Ed.j{cancel(){this.Zf.N(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.Ed.D=class extends olympe.host.Ed.j{cancel(){this.Zf.F(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.Ed.F=class extends olympe.host.Ed.j{cancel(){this.Zf.D(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.
|
|
430
|
-
|
|
431
|
-
olympe.V.config(function(a){var b,c;const d='object'===typeof window&&(null==(b=window)?void 0:null==(c=b.location)?void 0:c.hostname)||'127.0.0.1';a.setParameter(olympe.host.Config.
|
|
432
|
-
[olympe.host.P.Fa],e=>{null===olympe.host.Zf&&(olympe.host.Zf=new olympe.host.Ed(e));return olympe.host.Zf},!0)},'olympe.host');olympe.V.run([olympe.host.P.
|
|
433
|
-
olympe.error.
|
|
434
|
-
olympe.error.
|
|
435
|
-
olympe.error.
|
|
436
|
-
olympe.net.ua.
|
|
437
|
-
olympe.net.oj.j=/%25([0-9a-f]{2})/i;olympe.net.WebSocket=class{send(){}close(){}
|
|
438
|
-
olympe.net.Si=class extends olympe.net.oj{constructor(a,b,c,d,e,f,g,h){super(a,b,c,d);this.method=null!=e?e:olympe.net.ua.Rd.GET;this.query=h;this.headers={};this.body=f;this.D=null!=g?g:olympe.net.ua.ResponseType
|
|
439
|
-
olympe.net.Si.Rd={Sh:'POST',GET:'GET',
|
|
440
|
-
[b,c,e]);nb(a.state,e,(f,g)=>{a.G.warn(`Error occurred with the AMQP Client, (was in state ${f}): ${g}`);F(a.state,d,a.F)});a.state.start(d,!1)}function Mc(a,b){kb(a.state,olympe.net.AMQPClient.j.
|
|
441
|
-
function Lc(a){return u(function*(){const b=a.j,c=a.H;a.j=a.H=null;!1===(null==b?void 0:b.closed)&&b.close().catch(d=>a.G.debug(`Issue while closing channel: ${d}`));!1===(null==c?void 0:c.closed)&&(yield olympe.U.Promise.$f(c.close(),500,'AMQPClient close timeout').catch(d=>{a.G.debug(`Error while closing client: ${d}`)}))})}function Pc(a){return null!==a.H&&!a.H.closed&&null!==a.j&&!a.j.closed&&a.F}function Qc(a,b){if(!Pc(a))throw new olympe.error.
|
|
405
|
+
m.Rf.K=olympe.C.J.j;m.qe.K=new olympe.C.J(()=>Object,[]);m.lf.K=olympe.C.J.j;m.wj.K=new olympe.C.J(()=>{},[]);m.jt.K=olympe.C.J.j;m.si.K=new olympe.C.J(()=>Array,[]);m.oe.K=olympe.C.J.j;m.mn.K=olympe.C.J.j;m.ln.K=olympe.C.J.j;m.ys.K=olympe.C.J.j;m.Nf.K=olympe.C.J.j;m.fi.K=olympe.C.J.j;m.Lg.K=olympe.C.J.j;olympe.C.Map=class extends olympe.C.Ci{constructor(a){a===olympe.C.Proxy&&(a=Object);super(a);this.j=this.D=null}Qd(a){a===olympe.C.Proxy&&(a=Object);null!==this.D&&gc(this.D,a);super.Qd(a)}Jc(){null===this.D&&this.zn();return this.D}Tf(){null===this.j&&this.zn();return this.j}zn(){this.getContext().run(()=>{this.D=olympe.C.Wd(this.Mb());this.j=olympe.C.Wd(String);this.Oj(this.Cn())})}Cn(){const a=this.values;let b,c;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b)){c=b;break}return c}Oj(a){if(void 0!==
|
|
406
|
+
a){const b=this.values[a];b&&b instanceof olympe.C.Proxy?jc(this.D,b):hc(this.D,b);hc(this.j,a)}else void 0!==this.D.Ba.Eb&&(ic(this.D),ic(this.j))}set(a,b){this.al(a,b);1===this.size&&null!==this.j&&this.Oj(a);this.Nf()}remove(a){const b=this.pj(a);null!==this.j&&this.j.Ba.Eb===a&&this.Oj(this.Cn());return b}clear(){this.fi();null!==this.j&&this.Oj()}};m=olympe.C.Map.prototype;m.Qd.K=olympe.C.J.j;m.Jc.K=new olympe.C.J(()=>Object,[]);m.Tf.K=new olympe.C.J(()=>String,[]);m.zn.K=olympe.C.J.j;
|
|
407
|
+
m.Cn.K=olympe.C.J.j;m.Oj.K=olympe.C.J.j;m.set.K=olympe.C.J.j;m.remove.K=new olympe.C.J(()=>Object,[]);m.clear.K=olympe.C.J.j;olympe.C.Og=class extends olympe.C.Tj{constructor(a){super(a)}set(a,b,c){this.al(a,b);void 0!==c&&olympe.C.Wc([c],d=>{this.mn(a,d)});this.Nf()}remove(a){this.ln(a);return this.pj(a)}clear(){this.fi()}};olympe.C.Og.prototype.remove.K=olympe.C.J.j;olympe.C.Og.prototype.clear.K=olympe.C.J.j;olympe.C.Kt=class extends olympe.C.lk{constructor(a,b){super(olympe.C.$,'animatedFlowSource');this.duration=a;this.j=b||olympe.C.$.mp.uq}tb(){return olympe.C.Ez(this.node,this.duration,this.j,void 0)}};let sc=null;olympe.C.G=void 0;olympe.C.Yn=void 0;olympe.C.ki=void 0;olympe.C.ei=new Map;olympe.C.ei.set(0,olympe.C.$.ZERO);olympe.C.ei.set(1,olympe.C.$.ONE);olympe.C.ei.set(2,olympe.C.$.Ow);olympe.C.$k=new Map;olympe.C.$k.set('',olympe.C.Sa.EMPTY);olympe.C.$k.set(' ',olympe.C.Sa.zw);olympe.C.createNode=function(a,b,c,d,e,f,g,h){return new olympe.C.Node({valueType:a,Mc:b,Yf:c,Pn:d,debug:g,rg:e,$c:f,qj:h})};olympe.C.Wf=function(a){return a instanceof olympe.C.Node};
|
|
408
|
+
olympe.C.Wd=function(a,b,c){a=olympe.C.createNode(a,void 0,void 0,void 0,void 0,c);olympe.C.Wf(b)?cc(a,b):olympe.C.gb(b)?cc(a,b.Ba):L(a,b);return M(a)};olympe.C.gb=function(a){return!(!a||!a.fh)};olympe.C.pf=function(a){return!(!a||!(a instanceof olympe.C.Node||a.fh))};olympe.C.Tn=function(a){return a instanceof olympe.C.Xb||a instanceof olympe.C.Gr||a instanceof olympe.C.Node};olympe.C.sh=function(a){return a instanceof olympe.C.lk};
|
|
409
|
+
olympe.C.Vn=function(a,b){if(void 0!==a){olympe.C.sh(a)&&(a=a.tb().Ba);if(!olympe.C.pf(a))return b(a);var c=[];olympe.C.gb(a)?c.push(a.Ba):c.push(a);return olympe.C.createNode(void 0,b,null,c,[0],'onResolved')}};olympe.C.Qa=function(a,b){let c=a;olympe.C.gb(a)?c=a.Ba.Eb:olympe.C.Wf(a)?c=a.Eb:olympe.C.sh(a)&&(c=a.tb().Ba.Eb);return void 0===c?b:c};
|
|
410
|
+
olympe.C.wh=function(a,b){let c;olympe.C.gb(a)?c=a.Ba:olympe.C.Wf(a)?c=a:olympe.C.sh(a)&&(c=a.tb().Ba);c&&olympe.C.Wc([b],d=>{c.wh(d)},'setDefaultValue');return a};olympe.C.zi=function(a,b,c,d){const e=a.length,f=Array(e),g=[];let h;for(let k=0;k<e;k++)h=a[k],void 0!==h&&null!==h&&(void 0!==h.vs?(h=h.Ba,g.push(k)):h instanceof olympe.C.Node?g.push(k):olympe.C.sh(h)&&(h=h.tb().Ba,g.push(k))),f[k]=h;return olympe.C.createNode(c,b,null,f,g,d||'syncNodes')};
|
|
411
|
+
olympe.C.ye=function(a,b,c,d){return M(olympe.C.zi(a,b,c,d||'syncProxies'))};const tc=a=>{for(const b of a)if(olympe.C.pf(b)||olympe.C.sh(b))return!1;return!0};olympe.C.sa=function(a,b,c,d,e){if(tc(a))return b(...a);const f=olympe.C.zi(a,b,c,d||'TransformFlows');e&&olympe.C.Wc([e],g=>{f.wh(g)},'setDefaultValue');return M(f)};olympe.C.Wc=function(a,b,c){tc(a)?b(...a):olympe.C.zi(a,b,void 0,c||'processFlows')};
|
|
412
|
+
olympe.C.UE=function(a,b,c){const d=olympe.C.Wf(a)?a.Mb():olympe.C.sh(a)?a.tb().di:a.di,e=olympe.C.bc(d,c),f=olympe.U.Promise.uj(g=>{e.getContext().fb()||e.update(g)},b);olympe.C.Wc([a],g=>f(g).then());return e.tb()};olympe.C.nt=function(a,b){if(tc(a))b(...a);else{const c=olympe.C.Za();olympe.C.zi(a,(...d)=>{olympe.C.Za().destroy();c.run(b,...d)},void 0,'processFlowsOnce')}};
|
|
413
|
+
olympe.C.Wn=function(a,b,c){const d=a.length,e=Array(d),f=[];let g;for(let h=0;h<d;h++)g=a[h],void 0!==g&&null!==g&&(olympe.C.gb(g)?(g=g.Ba,f.push(h)):g instanceof olympe.C.Node?f.push(h):olympe.C.sh(g)&&(g=g.tb().Ba,f.push(h))),e[h]=g;0!==f.length&&new olympe.C.Node({Mc:b,Pn:e,rg:f,Wz:!1,$c:c})};olympe.C.ot=function(a,b){const c=olympe.C.Za();olympe.C.Wn(a,(...d)=>{olympe.C.Za().destroy();c.run(b,...d)},'processFutureFlowsOnce')};olympe.C.SE=function(a,b,c){a=new olympe.C.lk(a,c);b(a);return a.tb()};
|
|
414
|
+
olympe.C.bc=function(a,b='flowSource'){return new olympe.C.lk(a,b)};olympe.C.zF=function(a,b,c,d){const e=olympe.C.Za();olympe.C.zi(a,(...f)=>{olympe.C.Za().destroy();e.run(b,...f)},c,d||'syncProxiesOnce')};olympe.C.Gj=function(a,b,c){olympe.C.sa([a],d=>d.valueOf()?b.apply(null,void 0):c&&c.apply(null,void 0),Object,'If')};olympe.C.eF=function(a,b,c='from observable'){const d=olympe.C.bc(b,c),e=a.subscribe(f=>d.update(f));d.getContext().onDestroy(()=>e.unsubscribe());return d.tb()};
|
|
415
|
+
olympe.C.bF=function(a,b,...c){return a?a.run(b,...c):b(...c)};olympe.C.DF=function(a){return olympe.C.Za().rc(a)};olympe.C.ZE=function(a,b,c){olympe.C.Rx(a?a.Ba:a,b,c)};
|
|
416
|
+
olympe.C.Rx=function(a,b,c){if(a){var d=a.T();null===sc&&(sc={});if(sc[d])olympe.C.G.log(`Already started node #${d} dump`+(b?`: ${b}`:''));else{sc[d]=!0;var e=`Starting node #${d} dump`+(b?`: ${b}`:'');c?olympe.C.G.warn(e):olympe.C.G.log(e);var f=`#${d}`+(b?`: ${b}`:'')+':';c=olympe.C.createNode(null,g=>{void 0===g?olympe.C.G.log(f,'undefined'):null===g?olympe.C.G.log(f,'null'):olympe.C.G.log(f,String(g))},null,[a],[0],'DataFlowDump');a.onDestroy(()=>{olympe.C.G.log(`Node #${d} destroyed`+(b?`: ${b}`:
|
|
417
|
+
''))});c.onDestroy(()=>{delete sc[d]})}}else olympe.C.G.log('NOT starting node dump, node is '+String(a))};olympe.C.YE=function(){let a='',b=olympe.C.Za();for(;null!==b;)a+=b.Hn()+' --\x3e ',b=b.getParent();olympe.C.G.log(a)};
|
|
418
|
+
olympe.C.qa=function(a){if(void 0===a)return olympe.C.$.ZERO;if(a instanceof olympe.C.$)return a;a&&a.valueOf&&(a=a.valueOf());if('number'===typeof a){if(isNaN(a))return olympe.C.$.Bq;if(a===Math.PI)return olympe.C.$.PI;if(Infinity===a)return olympe.C.$.Hu;if(-Infinity===a)return olympe.C.$.Ev;if(isNaN(a))var b=!1;else b=parseFloat(a),b=(b|0)===b;return b&&-1<=a&&100>=a?(olympe.C.ei.has(a)||olympe.C.ei.set(a,new olympe.C.$(a)),olympe.C.ei.get(a)):new olympe.C.$(a)}return null};
|
|
419
|
+
olympe.C.fe=function(a){return void 0===a?olympe.C.Wd(olympe.C.$):olympe.C.Wd(olympe.C.$,olympe.C.pf(a)?a:olympe.C.qa(a))};olympe.C.Ez=olympe.C.$.animate;olympe.C.oF=function(a,b){return new olympe.C.Kt(a,b)};olympe.C.xb=function(a){if(a instanceof olympe.C.Sa)return a;a instanceof Object&&(a=a.valueOf());const b=typeof a;if('string'===b||'number'===b||'boolean'===b)return a=String(a),olympe.C.$k.has(a)?olympe.C.$k.get(a):new olympe.C.Sa(a)};
|
|
420
|
+
olympe.C.tF=function(a){return void 0===a?olympe.C.Wd(olympe.C.Sa):olympe.C.Wd(olympe.C.Sa,olympe.C.pf(a)?a:olympe.C.xb(a))};olympe.C.Rb=function(a){return a instanceof olympe.C.da?a:void 0!==a&&null!==a&&a.valueOf()?olympe.C.da.D:olympe.C.da.j};olympe.C.qF=function(a){return void 0===a?olympe.C.Wd(olympe.C.da):olympe.C.Wd(olympe.C.da,olympe.C.pf(a)?a:olympe.C.Rb(a))};olympe.C.pF=function(a){if(a instanceof Date)return new olympe.C.eb(a)};
|
|
421
|
+
olympe.C.sF=function(a){return olympe.C.Wd(olympe.C.eb,void 0!==a?new olympe.C.eb(a):null)};olympe.C.et=a=>a instanceof olympe.C.da||a instanceof olympe.C.$||a instanceof olympe.C.Sa||a instanceof olympe.C.eb;olympe.C.uF=function(a,b){return olympe.C.Wd(olympe.C.Zb,void 0===a&&void 0===b?void 0:new olympe.C.Zb(a,b))};olympe.C.Qz=function(a,b,c,d){let e;void 0!==a&&(a instanceof olympe.C.Color?e=a:e=olympe.C.Color.create(a,b,c,d));return olympe.C.Wd(olympe.C.Color,e)};olympe.C.rF=olympe.C.Qz;
|
|
422
|
+
olympe.C.Ix=function(a){olympe.C.G=a;olympe.C.ki=olympe.C.kh()};olympe.C.kh=function(){olympe.C.Yn||(olympe.C.Yn=new olympe.C.Gr);return olympe.C.Yn};olympe.C.Za=function(){olympe.C.ki||(olympe.C.ki=olympe.C.kh());return olympe.C.ki};olympe.C.wt=function(a){const b=olympe.C.ki;olympe.C.Tn(a)&&(olympe.C.ki=a);return null!=b?b:null};
|
|
423
|
+
olympe.C.Pb=a=>{a='string'===typeof a?JSON.parse(a):a;if(a.type){let b=null;switch(a.type){case 'dateTime':b=olympe.C.eb.Pb(a);break;case 'number':b=olympe.C.$.Pb(a);break;case 'string':b=olympe.C.Sa.Pb(a);break;case 'vector2':b=olympe.C.Zb.Pb(a);break;case 'color':b=olympe.C.Color.Pb(a);break;case 'boolean':b=olympe.C.da.Pb(a)}return b}return null};function uc(a){a.j.fb()||(a.F.forEach(b=>{b.destroy()}),a.F.clear(),a.D.clear(),a.size.clear(),a.N.clear(),a.R.length=0,a.H.length=0)}
|
|
424
|
+
olympe.C.pD=class{constructor(){this.j=new olympe.C.Xb('Slot Manager context');this.F=new Map;this.j.run(()=>{this.D=olympe.C.bc(vc,'Last slot manager entry');this.size=lc(olympe.C.bc(olympe.C.$,'SlotManager size').repeat(this.D.tb().In()),olympe.C.$.ZERO);this.N=lc(olympe.C.bc(olympe.C.$,'last valid slots'),olympe.C.qa(-1))});this.R=[];this.H=[];this.j.onDestroy(()=>{uc(this)})}};
|
|
425
|
+
class vc{constructor(a,b,c,d){this.id=a;this.D=new olympe.C.Xb('Slot manager entry');this.H=c;this.N=d;this.D.run(()=>{const e=lc(olympe.C.bc(olympe.C.$),olympe.C.$.ZERO);olympe.C.gb(b)?e.repeat(b):e.update(b);this.j=olympe.C.bc(olympe.C.$);this.F=this.j.tb().ge(e.tb())});this.next=null}T(){return this.id}$y(){return this.j.tb()}In(){return this.F}Hd(){return this.H}iz(){return this.N}sA(a){this.H=a}fA(a){null===a?this.j.update(olympe.C.$.ZERO):(this.j.repeat(a.In()),a.next=this)}Uu(){this.j.clear();
|
|
426
|
+
this.next=null}destroy(){this.D.destroy();this.F=this.j=this.next=null}}m=vc.prototype;m.T.K=olympe.C.J.j;m.$y.K=new olympe.C.J(()=>olympe.C.$);m.In.K=new olympe.C.J(()=>olympe.C.$);m.Hd.K=olympe.C.J.j;m.iz.K=olympe.C.J.j;m.sA.K=olympe.C.J.j;m.fA.K=olympe.C.J.j;m.Uu.K=olympe.C.J.j;m.destroy.K=olympe.C.J.j;olympe.C.P={Da:'df.Logger'};olympe.V.config(a=>{E(a,olympe.C.Config.Cq,Number.POSITIVE_INFINITY);D(a,olympe.C.P.Da,[olympe.ga.P.Fa],b=>b.ad('df'))},'olympe.df');olympe.V.run([olympe.C.P.Da],a=>{olympe.C.Ix(a)},'olympe.df');olympe.host={};const wc=new Map,xc=new Map;olympe.host.Jq=class{static register(a,b,...c){wc.set(a,b);0<c.length&&xc.set(a,c)}static create(a,b,c,d){const e=wc.get(a);if(void 0===e)throw Error('Undefined UI element type: '+a);a=xc.get(a);return void 0!==a?new e(b,c,...a.map(f=>Sa(d,f))):new e(b,c)}};function yc(a,b,c){a.G.debug('CREATE #',b,', type=',c);a.j.set(b,olympe.host.Jq.create(c,b,a.G,a.H))}function zc(a,b,c,...d){const e=a.j.get(b);if(void 0!==e){a.G.H()<=olympe.ga.yb.j.bg&&a.G.debug('CALL #'+b+', '+c+'('+Array.prototype.slice.call(d,0)+')');b=[];for(const f of d)if(void 0===f||null===f)b.push(f);else if(olympe.C.gb(f))b.push(a.j.get(f.ex)||null);else if('function'===typeof f){const g=f,h=olympe.C.Za();b.push((...k)=>{h.fb()||g(...k)})}else b.push(f.valueOf());e[c].apply(e,b)}}
|
|
427
|
+
function Ac(a){var b=olympe.host.Pe.Ed,c=olympe.host.Pe.Iq.ms;++a.F;const d=a.F;yc(a,d,c);const e=olympe.C.createNode(b,void 0,void 0,void 0,void 0,'Native('+d+')',!1,function(){var f=arguments.length-2;const g=Array.from({length:f}),h=[],k=arguments[f+1],l=d+'_'+k;this.D.has(l)&&this.D.get(l).destroy();for(let n=0;n<f;n++){let p=arguments[n];olympe.C.gb(p)?(h.push(n),p=p.Ba):olympe.C.Wf(p)&&h.push(n);g[n]=p}0===h.length?e.run(()=>{zc(this,d,k,...g)}):(f=olympe.C.createNode(void 0,(...n)=>{e.run(()=>
|
|
428
|
+
{zc(this,d,k,...n)})},void 0,g,h,'Native('+d+').'+k),this.D.set(l,f),f.onDestroy(()=>this.D.delete(l)));return null}.bind(a));e.Xd(a.N.bind(a,d));a=M(e);a.ex=d;L(e,a);return a}olympe.host.Ta=class{constructor(a,b){this.G=a;this.H=b;this.F=0;this.j=new Map;this.D=new Map;a.debug('Starting host manager')}Wa(){return this.G}N(a){this.G.debug('DESTROY #',a);const b=this.j.get(a);this.j.delete(a);b.destroy()}};olympe.host.Sd=class{constructor(a){this.j=a;this.D=olympe.C.Za()}F(){return this.j}jd(){return this.j.Ba.jd()||this.D.jd()}fb(){return this.j.Ba.fb()}};olympe.host.Sd.prototype.F.K=new olympe.C.J(()=>olympe.host.Pe.Sd,[]);olympe.host.Uk=class{j(){}D(){}};olympe.host.Bu=class{};function Bc(a,b){var c=olympe.host.Zf;const d=olympe.U.Lc(),e=new olympe.C.Xb('onTimeout context');c.j.X(b,d,()=>{e.fb()||e.jd()||e.run(a);c.j.F(d)});return new olympe.host.Ed.D(c.j,d,e)}function Cc(a,b){var c=olympe.host.Zf;const d=olympe.U.Lc(),e=new olympe.C.Xb('onInterval context');c.j.R(b,d,()=>{e.fb()||e.jd()?c.j.D(d):e.run(a)})}olympe.host.Ed=class{constructor(a){this.j=Ac(a)}};olympe.host.Ed.j=class{constructor(a,b,c){this.Zf=a;this.id=b;this.j=null!=c?c:null}T(){return this.id}cancel(){}};
|
|
429
|
+
olympe.host.Ed.H=class extends olympe.host.Ed.j{cancel(){this.Zf.N(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.Ed.D=class extends olympe.host.Ed.j{cancel(){this.Zf.F(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.Ed.F=class extends olympe.host.Ed.j{cancel(){this.Zf.D(this.id);let a;null==(a=this.j)||a.destroy();this.j=null}};olympe.host.Ke=class{H(a,b){return null!=b?b:''}ia(a,b){return null!=b?b:''}Ha(a,b){return null!=b?b:''}F(){}j(a,b){return null!=b?b:''}D(){}};olympe.host.Ke.j={LIVENESS:'liveness',READINESS:'readiness',ALL:'all'};olympe.host.Pe={};olympe.host.Pe.Sd=class{destroy(){}};olympe.host.Pe.Sd.prototype.destroy=olympe.host.Pe.Sd.prototype.destroy;olympe.host.Pe.Iq={AA:100,CA:101,BA:102,EA:103,DA:104,zA:105,gD:201,eD:202,bD:204,jD:205,aD:206,dD:207,hD:208,kD:209,lD:210,mD:211,cD:212,iD:218,fD:219,nD:220,$C:221,ZC:222,uD:300,vD:301,wD:302,AD:303,BD:304,CD:305,xD:310,yD:311,zD:312,AC:400,BC:401,CC:402,oC:450,hC:500,fC:501,kC:502,jC:503,gC:504,iC:505,VD:600,MD:601,QD:602,ID:603,JD:604,GD:605,LD:606,aE:607,TD:608,DD:609,HD:610,KD:611,SD:612,XD:613,ED:614,WD:615,RD:616,$D:617,ND:618,OD:619,PD:620,UD:630,FD:631,YD:632,ZD:633,GE:700,jE:701,kE:702,
|
|
430
|
+
lE:703,nE:704,oE:705,pE:706,mE:707,rE:708,qE:709,sE:710,wE:711,EE:712,tE:713,uE:714,xE:715,yE:716,AE:717,BE:718,DE:719,zE:720,CE:721,FE:722,vE:723,HE:724,IE:725,ms:800};olympe.host.Pe.Ed=class{N(){}X(){}F(){}R(){}D(){}};olympe.host.P={Qk:'host.System',Pp:'host.HistoryManager',Ir:'host.Scheduler',Da:'host.platform.Logger',Fa:'host.Manager',He:'host.ProcessManager'};olympe.host.Config={Jk:'host.role',Qp:'host.currentHost',er:'host.processProbe',Pr:'host.gracefulShutdownTimeout'};olympe.host.Wg={Dl:'active',Th:'preview'};olympe.host.Zf=null;
|
|
431
|
+
olympe.V.config(function(a){var b,c;const d='object'===typeof window&&(null==(b=window)?void 0:null==(c=b.location)?void 0:c.hostname)||'127.0.0.1';a.setParameter(olympe.host.Config.Qp,d);b=olympe.host.Wg.Dl;c=olympe.host.Wg.Th;E(a,olympe.host.Config.Jk,d.startsWith(`${c}.`)?c:b);Xa(a,olympe.host.P.Qk);Xa(a,olympe.host.P.Pp);C(a,olympe.host.P.He,olympe.host.Ke);D(a,olympe.host.P.Da,[olympe.ga.P.Fa],e=>e.ad('host'));C(a,olympe.host.P.Fa,olympe.host.Ta,olympe.host.P.Da,olympe.V.P.Eg);D(a,olympe.host.P.Ir,
|
|
432
|
+
[olympe.host.P.Fa],e=>{null===olympe.host.Zf&&(olympe.host.Zf=new olympe.host.Ed(e));return olympe.host.Zf},!0)},'olympe.host');olympe.V.run([olympe.host.P.Ir],a=>a,'olympe.host.scheduler');olympe.V.run([olympe.host.P.Fa],a=>a,'olympe.host');olympe.V.run([olympe.host.P.He],a=>{olympe.host.ll=()=>a});olympe.error={};olympe.error.pd=class extends Error{constructor(a,b=olympe.error.lc.Wk){super(a);this.code=b}Aj(){return this.code}};olympe.error.lc={Wk:0,Oi:1,Gq:401,kk:403,Zi:404,Iv:406,TIMEOUT:408,uw:503,Fq:530,Tl:600,Hq:1006};olympe.error.Vk=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.TIMEOUT)}};olympe.error.br=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.uw)}};olympe.error.uk=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Gq)}};olympe.error.Hm=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Zi)}};
|
|
433
|
+
olympe.error.Pq=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Oi)}};olympe.error.Oq=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Iv)}};olympe.error.rC=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Fq)}};olympe.error.Wl=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Tl)}};olympe.error.lp=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Oi)}};
|
|
434
|
+
olympe.error.Zq=class extends olympe.error.pd{constructor(){super('Working offline',olympe.error.lc.Oi)}};olympe.error.Vo=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Oi)}};olympe.error.Er=class extends olympe.error.pd{constructor(a){super(a,olympe.error.lc.Oi)}};olympe.error.cn=class extends olympe.error.pd{constructor(a,b){super(a);this.id=b}T(){return this.id}};olympe.error.Ph=class extends olympe.error.cn{};olympe.error.Io=class extends olympe.error.cn{};
|
|
435
|
+
olympe.error.Op=class extends olympe.error.cn{};olympe.net={};olympe.net.ua={};olympe.net.ua.Rd={Sh:'POST',GET:'GET',yu:'HEAD',fr:'PUT',Dc:'DELETE',Uq:'OPTIONS',DC:'PATCH'};olympe.net.ua.ResponseType={$r:'text',JSON:'json',Kl:'blob',$h:'uint8array',je:'stream'};olympe.net.ua.Headers={Ii:'content-type',PA:'content-length',vo:'authorization',Jt:'access-control-allow-origin',Ht:'access-control-allow-headers',It:'access-control-allow-methods',zp:'x-forwarded-host',Ap:'x-forwarded-proto'};
|
|
436
|
+
olympe.net.ua.Xl={RB:'text/html',JSON:'application/json',bx:'application/zip',je:'application/octet-stream'};olympe.net.ua.Tb={No:0,Qh:200,Po:201,Rj:202,Il:400,Rw:401,kk:403,Zi:404,lC:405,gj:500,qw:503};function Dc(a){return a.host&&encodeURI(a.host)}function Ec(a){return encodeURI(a.path).replace(olympe.net.oj.j,(b,c)=>'%'+c)}olympe.net.oj=class{constructor(a,b,c,d){this.host='localhost';this.port=80;this.path='';this.xh=!1;void 0!==a&&(this.host=a);void 0!==b&&(this.port=b);void 0!==c&&(this.path=c.replace(/^\/+/,''));void 0!==d&&(this.xh=d)}j(){return`${(void 0===this.xh?443===this.port:this.xh)?'wss':'ws'}://${Dc(this)}:${this.port}/${Ec(this)}`}toString(){return`${Dc(this)}:${this.port}/${Ec(this)}`}};
|
|
437
|
+
olympe.net.oj.j=/%25([0-9a-f]{2})/i;olympe.net.WebSocket=class{send(){}close(){}ba(){}Z(){}X(){}D(){}};function N(a,b,c,d){a=olympe.U.Rz(a.valueOf());if(!a.host&&!a.path)return null;const e=a.scheme?a.scheme.includes('s'):!1;b=new olympe.net.Si(a.host,a.port||(e?443:80),a.path||'',e,b,c,d,a.query||void 0);a.Ct&&(c=a.Ct.split(':'),2===c.length&&(c=ab(olympe.U.jf(),`${c[0]}:${c[1]}`),Fc(b,{Authorization:`Basic ${c}`})));return b}function Gc(a){return void 0!==a.query?a.query.replace(/[^=&]+/g,b=>encodeURIComponent(b)):null}function Hc(a,b){a.D=b;return a}function Fc(a,b){Object.assign(a.headers,b)}
|
|
438
|
+
olympe.net.Si=class extends olympe.net.oj{constructor(a,b,c,d,e,f,g,h){super(a,b,c,d);this.method=null!=e?e:olympe.net.ua.Rd.GET;this.query=h;this.headers={};this.body=f;this.D=null!=g?g:olympe.net.ua.ResponseType.$r}Cj(){return this.headers}j(){let a=Gc(this);a=a?`?${a}`:'';if(!Dc(this))return`${Ec(this)}${a}`;const b=Number.isInteger(this.port)?`:${this.port}`:'';return`${(void 0===this.xh?443===this.port:this.xh)?'https':'http'}://${Dc(this)}${b}/${Ec(this)}${a}`}toString(){return this.j()}};
|
|
439
|
+
olympe.net.Si.Rd={Sh:'POST',GET:'GET',yu:'HEAD',fr:'PUT',Dc:'DELETE',Uq:'OPTIONS'};olympe.net.qd=class{constructor(a,b,c,d){this.data=a;this.status=null!=b?b:200;this.statusText=null!=c?c:'';this.headers=null!=d?d:{}}getData(){return this.data}Kc(){return this.status}Cj(){return this.headers}};function Ic(a,b){if(!b)throw Error('Try to send an invalid HTTP request: '+b);a.G.debug('SEND HTTP '+b.method+' to '+b.j());const c=a.F++,d=olympe.C.Za(),e=d.onDestroy(()=>{var f=a.j;const g=f.j.get(c);f.j.delete(c);null==g||g()});return Jc(a.j,c,b).finally(()=>{d.Xf(e);a.j.j.delete(c)})}olympe.net.Ta=class{constructor(a){this.G=a;this.j=new olympe.net.we.Cu(a);this.F=1;a='Initializing NET layer';this.G.j()&&(a+=' (implementation: '+this.R()+')');this.G.log(a);this.G.log('DONE initializing NET layer (ready to receive connection requests)')}D(){}N(){}H(){}qf(){}R(){}};function Kc(a){const b=olympe.net.AMQPClient.j.Ae,c=olympe.net.AMQPClient.j.CONNECTING,d=olympe.net.AMQPClient.j.zc,e=olympe.net.AMQPClient.j.Ab;mb(a.state,b,a.ia.bind(a),[c]);mb(a.state,c,()=>{a.G.debug('Connecting to the AMQP Client..');a.F=!0;F(a.state,b)},[d]);mb(a.state,d,(f,g)=>u(function*(){a.F=null!=g?g:a.F;a.F||a.D.clear();yield Lc(a);if(a.F&&!a.X&&null!==a.N){let h,k;setTimeout(()=>{a.G.debug('Reconnecting to the AMQPClient..');F(a.state,c)},null!=(k=null==(h=a.N)?void 0:h.pt)?k:5E3)}}),
|
|
440
|
+
[b,c,e]);nb(a.state,e,(f,g)=>{a.G.warn(`Error occurred with the AMQP Client, (was in state ${f}): ${g}`);F(a.state,d,a.F)});a.state.start(d,!1)}function Mc(a,b){kb(a.state,olympe.net.AMQPClient.j.Ae,b)}function Nc(a,b){kb(a.state,olympe.net.AMQPClient.j.CONNECTING,b)}function Oc(a,b){kb(a.state,olympe.net.AMQPClient.j.zc,b)}
|
|
441
|
+
function Lc(a){return u(function*(){const b=a.j,c=a.H;a.j=a.H=null;!1===(null==b?void 0:b.closed)&&b.close().catch(d=>a.G.debug(`Issue while closing channel: ${d}`));!1===(null==c?void 0:c.closed)&&(yield olympe.U.Promise.$f(c.close(),500,'AMQPClient close timeout').catch(d=>{a.G.debug(`Error while closing client: ${d}`)}))})}function Pc(a){return null!==a.H&&!a.H.closed&&null!==a.j&&!a.j.closed&&a.F}function Qc(a,b){if(!Pc(a))throw new olympe.error.Wl(null!=b?b:'Not connected to the bus');}
|
|
442
442
|
function Rc(a){let b,c;return Number.parseInt(null!=(c=null==(b=/^.*\((\d+)\)$/.exec(a instanceof Error?a.message:a))?void 0:b[1])?c:'0',10)}
|
|
443
|
-
function Sc(a,b,c,d){return u(function*(){try{yield Tc(a,b,c)}catch(e){if(e instanceof olympe.error.
|
|
444
|
-
}})}function Wc(a,b,c,d){return u(function*(){Qc(a,'Cannot subscribe to a queue without being connected to the bus');if(a.D.has(b))throw Error(`Cannot subscribe twice to the queue ${b}.`);a.G.debug(`Subscribing to queue: ${b}, exclusive: ${c}`);a.D.set(b,{
|
|
445
|
-
function Xc(a,b){return u(function*(){a.G.debug(`Closing subscription to queue: ${b}`);const c=a.D.get(b);a.D.delete(b);let d,e;if(!1===(null==(d=a.H)?void 0:d.closed)&&!1===(null==(e=a.j)?void 0:e.closed))try{let f;yield null==c?void 0:null==(f=c.
|
|
446
|
-
function Tc(a,b,c){return u(function*(){Qc(a,'Cannot declare a queue without being connected to the bus');a.G.debug(`Declaring queue: ${b}`);const d=yield Yc(a);try{yield d.queueDeclare(b,{durable:!c,exclusive:!1,autoDelete:!1,passive:!1},{'x-expires':c?15E3:a.N.
|
|
443
|
+
function Sc(a,b,c,d){return u(function*(){try{yield Tc(a,b,c)}catch(e){if(e instanceof olympe.error.Oq)return a.G.debug(`Queue ${b} already exists with different parameters, deleting it..`),yield Uc(a,b),new Promise((f,g)=>setTimeout(()=>{a.G.debug(`Redeclare queue ${b} with new parameters..`);Sc(a,b,c,d).then(f).catch(g)},500));throw Error(`Fail to declare queue ${b}: ${e}`);}try{let e,f;yield null==(e=a.D.get(b))?void 0:null==(f=e.yn)?void 0:f.cancel()}catch(e){}try{yield Vc(a,b,c,d)}catch(e){throw Error(`Fail to consume queue ${b}: ${e}`);
|
|
444
|
+
}})}function Wc(a,b,c,d){return u(function*(){Qc(a,'Cannot subscribe to a queue without being connected to the bus');if(a.D.has(b))throw Error(`Cannot subscribe twice to the queue ${b}.`);a.G.debug(`Subscribing to queue: ${b}, exclusive: ${c}`);a.D.set(b,{Bl:new Set([b]),yn:null,On:d,exclusive:c});yield Sc(a,b,c,d);a.G.debug(`Subscribed queue: ${b}.`)})}
|
|
445
|
+
function Xc(a,b){return u(function*(){a.G.debug(`Closing subscription to queue: ${b}`);const c=a.D.get(b);a.D.delete(b);let d,e;if(!1===(null==(d=a.H)?void 0:d.closed)&&!1===(null==(e=a.j)?void 0:e.closed))try{let f;yield null==c?void 0:null==(f=c.yn)?void 0:f.cancel()}catch(f){a.G.warn(`An error occurred while closing the subscription to queue: ${b}: ${f}`)}})}
|
|
446
|
+
function Tc(a,b,c){return u(function*(){Qc(a,'Cannot declare a queue without being connected to the bus');a.G.debug(`Declaring queue: ${b}`);const d=yield Yc(a);try{yield d.queueDeclare(b,{durable:!c,exclusive:!1,autoDelete:!1,passive:!1},{'x-expires':c?15E3:a.N.Yz,'x-message-ttl':a.N.xz,'x-queue-type':c?'classic':'quorum'}),a.G.debug(`Queue: ${b} declared`)}catch(e){a.G.error(`Failed to declare queue: ${b}`,e);if(Rc(e)===olympe.net.AMQPClient.D.dr)throw new olympe.error.Oq(`Queue ${b} already exists with different parameters`);
|
|
447
447
|
throw e;}finally{try{yield d.close()}catch(e){}}})}function Uc(a,b){return u(function*(){const c=yield Yc(a);try{yield c.queueDelete(b)}finally{yield c.close()}})}
|
|
448
|
-
function Vc(a,b,c,d){return u(function*(){Qc(a,'Cannot consume a queue without being connected to the bus');a.G.debug(`Will consume queue: ${b}..`);const e=a.j,f={exclusive:c,noAck:!1},g=yield a.push(()=>e.basicConsume(b,f,h=>{a.G.j()&&a.G.debug(`AMQP < [${b}]: ${h.bodyToString()}`);d(new olympe.net.AMQPMessage(h,b,e))}));a.D.get(b).
|
|
449
|
-
if(h===olympe.net.AMQPClient.D.
|
|
450
|
-
function Yc(a,{id:b,
|
|
451
|
-
function Zc(a,b,c){return u(function*(){Qc(a,'Cannot bind a queue without being connected to the bus');var d;if(null==(d=a.D.get(b))?0:d.
|
|
452
|
-
function $c(a,b,c){return u(function*(){Qc(a,'Cannot unbind a queue without being connected to the bus');const d=yield Yc(a);try{a.G.debug(`Unbinding queue ${b} to topic ${c}`);let e,f;null==(e=a.D.get(b))||null==(f=e.
|
|
453
|
-
olympe.net.AMQPClient=class{constructor(a,b){this.G=olympe.
|
|
454
|
-
this.N=d;null!==d&&(this.X=!1,c().then())});Kc(this)}connect(){const a=this;return u(function*(){if(Pc(a))return a;a.state.getState()===olympe.net.AMQPClient.j.zc&&F(a.state,olympe.net.AMQPClient.j.CONNECTING);yield lb(a.state,olympe.net.AMQPClient.j.
|
|
455
|
-
const f=JSON.stringify(c);e.G.j()&&e.G.debug(`AMQP > [${b}]: ${f}`);return(new Promise((g,h)=>{e.R.set(a,l=>h(new olympe.error.
|
|
456
|
-
this;return u(function*(){if(null===a.N)throw Error('Cannot connect to the bus without a configuration');a.H=a.Z(a.N,a.name);try{let b;yield olympe.U.Promise.
|
|
457
|
-
olympe.error.lc.
|
|
458
|
-
!0,new olympe.error.
|
|
459
|
-
{var g=b.state;F(g,g.j,f)})}});yield b.j.confirmSelect();let d;yield b.j.prefetch(null!=(d=b.N.
|
|
460
|
-
olympe.net.AMQPClient.D={
|
|
461
|
-
olympe.net.AMQPMessage=class{constructor(a,b,c){this.H=a.redelivered;this.D=a.deliveryTag;this.N=a.routingKey;this.j=c;this.F=null;try{const d=a.bodyToString();this.F=JSON.parse(null!=d?d:'null')}catch(d){console.warn(`AMQPMessage: Failed to parse message payload: ${d}`)}}wi(){return this.H}ack(){return!1===this.j.closed?this.j.basicAck(this.D,!1).catch(a=>{olympe.
|
|
462
|
-
!1,a).catch(b=>{olympe.
|
|
463
|
-
olympe.net.ci.ALL='*';olympe.net.
|
|
464
|
-
olympe.V.config(function(a){E(a,olympe.net.Config.Bf,3141);E(a,olympe.net.Config.
|
|
465
|
-
(b,c)=>new Map([['offlineEnabled',b],['offlineAutoBackOnline',!b||c]]))},'olympe.net');olympe.Xa.node.host={};olympe.Xa.node.host.Sd=function(a,b){this.G=b};olympe.Xa.node.host.Sd.prototype.constructor=olympe.Xa.node.host.Sd;olympe.Xa.node.host.Sd.prototype.destroy=function(){};olympe.Xa.node.host.Sd.prototype.destroy=olympe.Xa.node.host.Sd.prototype.destroy;olympe.Xa.node.host.Sd.prototype.Wa=function(){return this.G};olympe.Xa.node.host.Sd.ya=[olympe.host.
|
|
448
|
+
function Vc(a,b,c,d){return u(function*(){Qc(a,'Cannot consume a queue without being connected to the bus');a.G.debug(`Will consume queue: ${b}..`);const e=a.j,f={exclusive:c,noAck:!1},g=yield a.push(()=>e.basicConsume(b,f,h=>{a.G.j()&&a.G.debug(`AMQP < [${b}]: ${h.bodyToString()}`);d(new olympe.net.AMQPMessage(h,b,e))}));a.D.get(b).yn=g;a.G.debug(`Consumer ${g.tag} subscribed to queue: ${b}, on channel ${e.id}`);g.wait().catch(h=>{a.G.debug(`Consumer of queue ${b} has been closed: ${h}`);h=Rc(h);
|
|
449
|
+
if(h===olympe.net.AMQPClient.D.Um||h===olympe.net.AMQPClient.D.Wk)h=Math.round(5E3*Math.random()),a.G.warn(`Consumer of queue ${b} has been forced closed, will recreate the queue in ${h}ms..`),setTimeout(()=>{a.j===e&&!1===(null==e?void 0:e.closed)&&Sc(a,b,c,d).catch(k=>{a.G.error(`Failed to resubscribe to queue ${b}: ${k}`)})},h)})})}
|
|
450
|
+
function Yc(a,{id:b,Nz:c}={}){return u(function*(){const d=yield a.H.channel(b);d.onerror=null!=c?c:e=>{a.G.debug(`Error with channel (${d.id}): ${e}`)};return d})}
|
|
451
|
+
function Zc(a,b,c){return u(function*(){Qc(a,'Cannot bind a queue without being connected to the bus');var d;if(null==(d=a.D.get(b))?0:d.Bl.has(c))throw Error(`Queue ${b} already bound to topic ${c}`);d=yield Yc(a);try{a.G.debug(`Binding queue ${b} to topic ${c}`),yield d.queueBind(b,'amq.topic',c),a.D.get(b).Bl.add(c)}finally{yield d.close()}})}
|
|
452
|
+
function $c(a,b,c){return u(function*(){Qc(a,'Cannot unbind a queue without being connected to the bus');const d=yield Yc(a);try{a.G.debug(`Unbinding queue ${b} to topic ${c}`);let e,f;null==(e=a.D.get(b))||null==(f=e.Bl)||f.delete(c);yield d.queueUnbind(b,'amq.topic',c)}finally{try{yield d.close()}catch(e){}}})}
|
|
453
|
+
olympe.net.AMQPClient=class{constructor(a,b){this.G=olympe.ga.Wa('amqp');this.X=this.F=!1;this.N=null;this.name=b;this.j=this.H=null;this.state=new olympe.U.Fw(this.G);this.D=new Map;this.R=new Map;this.wa=new olympe.U.promise.Tk;const c=olympe.U.Promise.uj(()=>{const d=olympe.net.AMQPClient.j.CONNECTING,e=olympe.net.AMQPClient.j.zc,f=this.state.getState();f===e?this.F&&F(this.state,d):f!==d&&F(this.state,e,this.F)},0);a.subscribe(d=>{this.G.j()&&this.G.debug('New AMQP configuration received',d);
|
|
454
|
+
this.N=d;null!==d&&(this.X=!1,c().then())});Kc(this)}connect(){const a=this;return u(function*(){if(Pc(a))return a;a.state.getState()===olympe.net.AMQPClient.j.zc&&F(a.state,olympe.net.AMQPClient.j.CONNECTING);yield lb(a.state,olympe.net.AMQPClient.j.Ae);return a})}disconnect(){const a=this;return u(function*(){const b=olympe.net.AMQPClient.j.zc;a.state.getState()!==b&&(F(a.state,b,!1),yield lb(a.state,b))})}ld(a,b,c,d={mandatory:!1,Bt:!1}){const e=this;return u(function*(){Qc(e,'Cannot publish a message without being connected to the bus');
|
|
455
|
+
const f=JSON.stringify(c);e.G.j()&&e.G.debug(`AMQP > [${b}]: ${f}`);return(new Promise((g,h)=>{e.R.set(a,l=>h(new olympe.error.Pq(`Impossible to deliver message to topic "${b}": ${l}`)));const k={messageId:String(a)};e.push(()=>e.j.basicPublish(d.Bt?'amq.topic':'',b,f,k,d.mandatory)).then(()=>g()).catch(l=>{l=Rc(l)===olympe.net.AMQPClient.D.Um?new olympe.error.Hm(`Topic ${b} not deployed.`):Error(`Failed to publish a message ${f} to topic ${b}: ${l}`);h(l)})})).finally(()=>e.R.delete(a))})}ia(){const a=
|
|
456
|
+
this;return u(function*(){if(null===a.N)throw Error('Cannot connect to the bus without a configuration');a.H=a.Z(a.N,a.name);try{let b;yield olympe.U.Promise.rt(a.Ha.bind(a),(null!=(b=a.N.pt)?b:5E3)/2,[olympe.error.Wl]);a.G.debug('AMQP Client connected')}catch(b){if(b instanceof Event&&'close'===b.type)throw Error('Bus not ready, will try to reconnect..');throw b;}})}Ha(a){const b=this;return u(function*(){b.G.debug(`Connecting to the bus, tentative ${a+1}..`);b.H.onerror=d=>{if(d instanceof amqp.AMQPError){var e=
|
|
457
|
+
olympe.error.lc.Tl;const f=olympe.error.lc.Hq,g=Rc(d);if(g===e||g===f){b.G.debug(`Connection closed by network: ${d}`);F(b.state,olympe.net.AMQPClient.j.zc,b.F);return}}else b.F=!1;e=b.state;F(e,e.j,d)};try{yield b.H.connect(),b.ba(b.H,d=>{b.G.debug(`AMQP connection closed ${d?'with error':'without error'}`);d||F(b.state,olympe.net.AMQPClient.j.zc,b.F)})}catch(d){if(d instanceof Error)switch(Rc(d)){case olympe.error.lc.Tl:case olympe.error.lc.Hq:throw new olympe.error.Wl(d);case olympe.error.lc.Fq:case olympe.error.lc.Gq:case olympe.error.lc.kk:throw b.X=
|
|
458
|
+
!0,new olympe.error.uk('Connection to the bus is not allowed: check your credentials');}throw new olympe.error.pd(`Connection to the bus failed: check your config and the availability of the bus: ${d}`);}const c=()=>u(function*(){b.j=yield Yc(b,{id:1,Nz:e=>{b.G.debug(`Error with channel 0: ${e}`);b.j=null;e=Rc(e);e!==olympe.net.AMQPClient.D.Um&&e!==olympe.net.AMQPClient.D.dr||olympe.U.Promise.rt(f=>{b.G.warn(`Trying to recreate channel after being closed, tentative ${f+1}..`);return c()},500).catch(f=>
|
|
459
|
+
{var g=b.state;F(g,g.j,f)})}});yield b.j.confirmSelect();let d;yield b.j.prefetch(null!=(d=b.N.Zz)?d:20);b.j.onReturn=e=>{const f=`Message returned by the server: ${e.bodyToString()}`;let g;null==(g=b.R.get(parseInt(e.properties.messageId,10)))||g(f)};b.D.forEach(({On:e,exclusive:f},g)=>{Sc(b,g,f,e)})});yield c()})}push(a){return vb(this.wa,a)}Z(){}ba(){}};olympe.net.AMQPClient.j={CONNECTING:'CONNECTING',Ae:'CONNECTED',zc:'DISCONNECTED',Ab:'ERROR'};
|
|
460
|
+
olympe.net.AMQPClient.D={Wk:0,Um:404,OC:405,dr:406,IA:504,fq:541};function ad(a){let b;return null!=(b=a.F)?b:{}}
|
|
461
|
+
olympe.net.AMQPMessage=class{constructor(a,b,c){this.H=a.redelivered;this.D=a.deliveryTag;this.N=a.routingKey;this.j=c;this.F=null;try{const d=a.bodyToString();this.F=JSON.parse(null!=d?d:'null')}catch(d){console.warn(`AMQPMessage: Failed to parse message payload: ${d}`)}}wi(){return this.H}ack(){return!1===this.j.closed?this.j.basicAck(this.D,!1).catch(a=>{olympe.ga.Wa('amqp').error(`Failed to ack message ${this.D}: ${a}`)}):Promise.resolve()}reject(a){return!1===this.j.closed?this.j.basicNack(this.D,
|
|
462
|
+
!1,a).catch(b=>{olympe.ga.Wa('amqp').error(`Failed to reject message ${this.D}: ${b}`)}):Promise.resolve()}};olympe.net.ci=class{constructor(a){this.G=a}start(){return Promise.reject('Try to start web server with the browser implementation.')}F(){return Promise.reject('Try to restart web server with the browser implementation.')}stop(){return Promise.reject('Try to stop web server with the browser implementation.')}D(){return Promise.reject('Try to open a route on a web server using the browser implementation.')}R(){return Promise.reject('Try to close a route on a web server using the browser implementation.')}};
|
|
463
|
+
olympe.net.ci.ALL='*';olympe.net.Dw=class{register(){return u(function*(){throw Error('Service Worker Manager must be overridden by a native layer: called "register"');})}};olympe.net.P={Fa:'net.Manager',Da:'net.Logger',nj:'net.WebServer',vw:'net.ServiceWorkerManager',Jm:'net.OfflineConfig'};olympe.net.Config={Bf:'net.httpPort',Tp:'net.httpBodyLimit',ls:'net.http2',Sp:'net.httpsCertificatesPath',Bm:'net.localNetworkSuffix',bj:'offline.enabled',Im:'offline.autoBackOnline',Tq:'offline.downloadBatchSize'};
|
|
464
|
+
olympe.V.config(function(a){E(a,olympe.net.Config.Bf,3141);E(a,olympe.net.Config.Tp,100);E(a,olympe.net.Config.ls,!1);E(a,olympe.net.Config.Sp,null);E(a,olympe.net.Config.Bm,'frontend');E(a,olympe.net.Config.bj,!1);E(a,olympe.net.Config.Im,!1);E(a,olympe.net.Config.Tq,20);Xa(a,olympe.net.P.Fa);D(a,olympe.net.P.Da,[olympe.ga.P.Fa],b=>b.ad('net'));C(a,olympe.net.P.nj,olympe.net.ci,olympe.net.P.Da);C(a,olympe.net.P.vw,olympe.net.Dw);D(a,olympe.net.P.Jm,[new olympe.V.oa(olympe.net.Config.bj),new olympe.V.oa(olympe.net.Config.Im)],
|
|
465
|
+
(b,c)=>new Map([['offlineEnabled',b],['offlineAutoBackOnline',!b||c]]))},'olympe.net');olympe.Xa.node.host={};olympe.Xa.node.host.Sd=function(a,b){this.G=b};olympe.Xa.node.host.Sd.prototype.constructor=olympe.Xa.node.host.Sd;olympe.Xa.node.host.Sd.prototype.destroy=function(){};olympe.Xa.node.host.Sd.prototype.destroy=olympe.Xa.node.host.Sd.prototype.destroy;olympe.Xa.node.host.Sd.prototype.Wa=function(){return this.G};olympe.Xa.node.host.Sd.ya=[olympe.host.Pe.Sd];olympe.Xa.node.host.Kq=class{constructor(a){this.G=a}};olympe.Xa.node.host.Kq.ya=[olympe.host.Bu];olympe.Xa.node.host.Ed=class{constructor(){this.j={};this.H={}}destroy(){}N(a){clearTimeout(this.j[a]);delete this.j[a]}X(a,b,c){this.j[b]=setTimeout(c,a)}F(a){clearTimeout(this.j[a]);delete this.j[a]}R(a,b,c){this.H[b]=setInterval(c,a)}D(a){clearInterval(this.H[a]);delete this.H[a]}};olympe.host.Jq.register(olympe.host.Pe.Iq.ms,olympe.Xa.node.host.Ed);olympe.Xa.node.host.Ed.ya=[olympe.host.Pe.Ed];olympe.Xa.node.host.Uk=class{constructor(a){this.G=a}j(){return olympe.C.da.D}D(){return!0}};olympe.Xa.node.host.Uk.ya=[olympe.host.Uk];function bd(a){a.wa.D('readinessProbe','/readiness',[olympe.net.ua.Rd.GET],()=>cd(a,a.ba)).catch(b=>a.G.error(`Failed to add readiness health check route ${b}`));a.wa.D('livenessProbe','/liveness',[olympe.net.ua.Rd.GET],()=>cd(a,a.Z)).catch(b=>a.G.error(`Failed to add liveness health check route ${b}`));a.H(()=>a.wa.stop())}
|
|
466
466
|
function ed(a,b){b=Array.from(b.values()).map(c=>c());return Promise.allSettled(b).then(c=>{let d=!1;for(const e of c)'rejected'===e.status&&(d=!0,a.G.warn(`Failed to close some resource: ${e.reason}`));return d})}function fd(a){return u(function*(){try{const b=yield ed(a,a.N),c=yield ed(a,a.R),d=yield ed(a,a.X);if(b||c||d)throw Error('Failed to gracefully close the backend');}finally{a.N.clear(),a.R.clear(),a.X.clear()}})}
|
|
467
|
-
function cd(a,b){const c=olympe.net.ua.
|
|
468
|
-
olympe.Xa.node.host.
|
|
469
|
-
return b}ia(a,b=olympe.U.
|
|
467
|
+
function cd(a,b){const c=olympe.net.ua.Tb.Qh,d=olympe.net.ua.Tb.gj;b=Array.from(b.values()).map(e=>e.apply(a));return 0===b.length?Promise.resolve(new olympe.net.qd('No healthCheck is set',c,'Nothing to check')):Promise.allSettled(b).then(e=>{let f=!1,g='Health check result: ';for(const h of e)'rejected'===h.status?(f=!0,e=h.reason,g+=`\n${e}`,a.G.warn(`Health check detected a service which is DOWN: ${e}`)):g+=`\n${h.value}`;return new olympe.net.qd(g,f?d:c,f?'Some services are not working':'Everything is OK')})}
|
|
468
|
+
olympe.Xa.node.host.Ke=class extends olympe.host.Ke{constructor(a,b,c,d=!0){super();this.G=a;this.wa=b;this.Ua=c;this.Z=new Map;this.ba=new Map;this.R=new Map;this.N=new Map;this.X=new Map;d&&bd(this)}j(a,b=olympe.U.hf(),c=olympe.host.Ke.j.ALL){switch(c){case olympe.host.Ke.j.LIVENESS:this.Z.set(b,a);break;case olympe.host.Ke.j.READINESS:this.ba.set(b,a);break;default:this.Z.set(b,a),this.ba.set(b,a)}return b}D(a){this.ba.delete(a);this.Z.delete(a)}H(a,b=olympe.U.hf()){this.R.set(b,this.$f(b,a,this.Ua));
|
|
469
|
+
return b}ia(a,b=olympe.U.hf(),c){this.N.set(b,this.$f(b,a,null!=c?c:this.Ua));return b}Ha(a,b=olympe.U.hf()){this.X.set(b,this.$f(b,a,this.Ua));return b}F(a){this.R.has(a)?this.R.delete(a):this.N.has(a)?this.N.delete(a):this.X.delete(a)}$f(a,b,c){return()=>olympe.U.Promise.$f(b(),c,`Shutdown hook ${a} has timeout`)}};olympe.V.config(function(a){E(a,olympe.host.Config.er,!0);E(a,olympe.host.Config.Pr,1E4);Va(a,olympe.host.P.Pp,olympe.Xa.node.host.Kq,olympe.host.P.Da);Va(a,olympe.host.P.Qk,olympe.Xa.node.host.Uk,olympe.host.P.Da);C(a,olympe.host.P.He,olympe.Xa.node.host.Ke,olympe.host.P.Da,olympe.net.P.nj,new olympe.V.oa(olympe.host.Config.Pr),new olympe.V.oa(olympe.host.Config.er))},'olympe.native.node.host');olympe.V.run([olympe.host.P.He],a=>{olympe.Xa.node.host.ll=()=>a});olympe.net.we={};function Jc(a,b,c){const d=olympe.net.ua.Tb.No,e=olympe.net.ua.Tb.gj,f=new AbortController;a.j.set(b,()=>f.abort());const g=c.j(),h=c.method;let k;return fetch(g,{method:h,headers:c.Cj(),body:null!=(k=c.body)?k:void 0,signal:f.signal}).then(l=>l.ok?gd(l,c.D).catch(n=>new olympe.net.qd(`Error parsing response from ${g} with method ${h}: ${n.message}`,e,'Error handling response')):new olympe.net.qd(`Error fetching data from ${g} with method ${h}`,l.status,l.statusText,l.headers)).catch(l=>'AbortError'===
|
|
470
470
|
l.name?new olympe.net.qd('',d,'Request canceled'):new olympe.net.qd(`Error connecting to ${g} with method ${h}`,e,'Failed to fetch:'+l.message))}
|
|
471
|
-
function gd(a,b){return u(function*(){switch(b){case olympe.net.ua.ResponseType.
|
|
471
|
+
function gd(a,b){return u(function*(){switch(b){case olympe.net.ua.ResponseType.Kl:var c=yield a.blob();break;case olympe.net.ua.ResponseType.$h:c=yield a.arrayBuffer();c=new Uint8Array(c,0,c.byteLength);break;case olympe.net.ua.ResponseType.JSON:c=yield a.json();break;case olympe.net.ua.ResponseType.je:c=a.body;break;default:c=yield a.text()}return new olympe.net.qd(c,a.status,a.statusText,a.headers)})}olympe.net.we.Cu=class{constructor(a){this.G=a;this.j=new Map}};olympe.net.we.WebSocket=class{constructor(a,b){this.G=b;this.id=a;this.j=null;this.buffer=[];this.N=this.F=this.H=this.R=null}T(){return this.id}open(a){const b=`#${this.id}`,c=this.ia(a);c.binaryType='arraybuffer';c.addEventListener('open',()=>{this.G.info(`Websocket ${b} OPENED`);this.R?(this.G.debug('Notifying upper layer for WebSocket',b),this.R()):this.G.warn('Nothing to notify for WebSocket',b);this.G.debug(b,`Send all buffered messages (n=${this.buffer.length}).`);this.buffer.forEach(c.send.bind(c));
|
|
472
472
|
this.buffer.length=0});c.addEventListener('message',d=>{d='string'===typeof d.data?String(d.data):bb(d.data);(this.G.F()||this.G.j()&&!d.startsWith('pong'))&&this.G.debug(b,'<',d);this.F&&this.F(d)});c.addEventListener('close',()=>{this.G.info(`WebSocket ${b} CLOSED`);this.H&&this.H()});c.addEventListener('error',()=>{this.G.debug(`WebSocket ${b} ERROR`);this.N&&this.N()});this.j=c}send(a){const b=`#${this.id}`;if(null!==this.j){const c=this.j.constructor;switch(this.j.readyState){case c.OPEN:(this.G.F()||
|
|
473
473
|
this.G.j()&&!a.startsWith('ping'))&&this.G.debug(b,'>',a);try{this.j.send(a)}catch(d){this.G.error(`Error while sending message to websocket: ${d}`)}break;case c.CONNECTING:this.G.debug(b,'- Connecting: BUFFER','>',a);this.buffer.push(a);break;default:return this.G.debug(b,'- Closed','>',a),!1}}else this.G.debug(b,'- Not opened yet: BUFFER','>',a),this.buffer.push(a);return!0}close(){if(null!==this.j){const a=this.j.constructor,b=this.j.readyState;if(b===a.OPEN||b===a.CONNECTING){this.G.debug(`Force closing native websocket ${`#${this.id}`}`);
|
|
474
|
-
this.j.close(1E3);return}}this.G.debug('Try to force close native websocket, but not open nor connecting')}
|
|
475
|
-
b)}};olympe.Xa.node.net.
|
|
476
|
-
function pd(a,b){const c=b.methods,d=b.
|
|
477
|
-
new olympe.net.Si(q,parseInt(r,10),g.url,'https'===g.protocol,k,p);for(const [t,v]of Object.entries(g.headers))k.headers[t]=v;a.G.debug('< HTTP:',k.toString());n=new Map(Object.entries(g.params));g=new Map(Object.entries(g.query));return d(k,n,g).then(t=>{const v=t.Kc(),x=t.getData();(x instanceof Uint8Array||x instanceof ArrayBuffer||x instanceof id)&&h.type(olympe.net.ua.
|
|
478
|
-
x):a.G.debug('> HTTP: reply with body:',Buffer.isBuffer(x)?'binary':x);return h.code(v).headers(Object.assign(l,t.Cj())).send(x)}).catch(t=>{a.G.error('> HTTP: reply with internal server error:',t);return h.code(olympe.net.ua.
|
|
479
|
-
olympe.Xa.node.net.http.ci=class extends olympe.net.ci{constructor(a,b,c,d,e){super(a);this.X=c;this.port=b;this.Z=d;this.N=e;this.j=this.createServer();this.H=new Map;this.state=jd.
|
|
480
|
-
a);return this.j.listen({port:this.port,host:'0.0.0.0'}).then(a=>{this.state=jd
|
|
481
|
-
jd.
|
|
482
|
-
hd(a);a.addContentTypeParser('*',{parseAs:'buffer'},(c,d,e)=>{e(null,d)});return a}uj(a,b=1E3){this.timer&&clearTimeout(this.timer);this.timer=setTimeout(a,b)}};olympe.V.config(function(a){C(a,olympe.net.P.nj,olympe.Xa.node.net.http.ci,olympe.net.P.Da,new olympe.V.oa(olympe.net.Config.Bf),new olympe.V.oa(olympe.net.Config.
|
|
483
|
-
olympe.Xa.node.U.
|
|
484
|
-
{throw Error(`Error while trying to fetch buffer from ObjectURL: ${b}`);})}};olympe.V.config(function(a){Va(a,olympe.U.P.Dg,olympe.Xa.node.U.
|
|
485
|
-
olympe.async.
|
|
486
|
-
this.
|
|
487
|
-
function td(a){if(0<a.D.length){const b=a.D.shift();a.G&&a.G.log(`Executing next task. ${a.D.length} tasks left in the pipeline.`);a.getContext().run(()=>{b(()=>{Promise.resolve().then(()=>{td(a)})},c=>{c&&(a.j=c);a.complete(!1)},a.env)})}else a.complete(!0)}olympe.async.
|
|
488
|
-
olympe.async.
|
|
489
|
-
0<this.D.length){this.
|
|
490
|
-
olympe.V.config(a=>{E(a,olympe.L.Yb.
|
|
474
|
+
this.j.close(1E3);return}}this.G.debug('Try to force close native websocket, but not open nor connecting')}ba(a){this.R=a||null}Z(a){this.F=a||null}D(a){this.N=a||null}X(a){this.H=a||null}ia(){}};olympe.net.we.WebSocket.ya=[olympe.net.WebSocket];olympe.Xa.node.net={};olympe.Xa.node.net.Kv=class extends olympe.net.Ta{R(){return'NodeJS'}qf(){return olympe.C.da.D}D(a){var b=this.F++;a=a.j();this.G.debug('CREATE Websocket #'+b+' to '+a);b=new olympe.Xa.node.net.Mv(b,this.G);b.open(a);return b}H(){this.G.warn('DOWNLOAD FILE not available with node native implementation. URL:')}N(a,b){return new olympe.Xa.node.net.Lv(a,b)}};olympe.Xa.node.net.Lv=class extends olympe.net.AMQPClient{Z(a,b='olympe-node'){var c=a.host;const d=a.port,e=a.path,f=a.tA,g=a.fz;var h=URL,k=a.xh?'amqps':'amqp';var l=a.user;a=a.dd;l=`${encodeURIComponent(f||'/')}|${encodeURIComponent(l)}|${encodeURIComponent(a)}`;c=new h(`${k}://${l}:_@${c}:${d}${e}/${f}`);0<g&&c.searchParams.append('heartbeat',`${g}`);c.searchParams.append('name',b);this.G.debug(`Open AMQP Socket to: ${c.toString()}`);return new amqp.AMQPClient(c.toString())}ba(a,b){a.socket.on('close',
|
|
475
|
+
b)}};olympe.Xa.node.net.Mv=class extends olympe.net.we.WebSocket{ia(a){return new (require('ws'))(a)}};olympe.Xa.node.net.Config={iE:'native.html.net.useWorkers'};olympe.V.config(function(a){a.getParameter(olympe.net.Config.bj)&&a.setParameter(olympe.net.Config.bj,!1);Va(a,olympe.net.P.Fa,olympe.Xa.node.net.Kv,olympe.net.P.Da,olympe.host.P.Fa)},'olympe.native.node.net');olympe.Xa.node.net.http={};const hd=require('fastify'),{Readable:id}=require('stream'),jd={Pk:0,Ok:1,$m:2},kd=olympe.net.ua.Rd.Uq,ld=olympe.net.ua.Headers.Jt,md=olympe.net.ua.Headers.Ht,nd=olympe.net.ua.Headers.It,od=olympe.net.ua.Tb.Qh;
|
|
476
|
+
function pd(a,b){const c=b.methods,d=b.On,e=b.headers,f=b.origin;a.j.route({bodyLimit:a.X<<20,url:b.path,method:[...c,kd],handler:(g,h)=>{a.G.debug('Incoming request:','hostname:',g.hostname,'headers:',g.headers);var k=g.method;const l={[ld]:f,[nd]:c,[md]:e};if(k===kd)return a.G.debug('< HTTP: OPTIONS'),h.code(od).headers(l).send();var n=g.body;if(n instanceof Buffer){var p=new Uint8Array(n.length);n.copy(p)}else if('string'===typeof n||n instanceof Object)p=n;const [q,r]=g.hostname.split(':');k=
|
|
477
|
+
new olympe.net.Si(q,parseInt(r,10),g.url,'https'===g.protocol,k,p);for(const [t,v]of Object.entries(g.headers))k.headers[t]=v;a.G.debug('< HTTP:',k.toString());n=new Map(Object.entries(g.params));g=new Map(Object.entries(g.query));return d(k,n,g).then(t=>{const v=t.Kc(),x=t.getData();(x instanceof Uint8Array||x instanceof ArrayBuffer||x instanceof id)&&h.type(olympe.net.ua.Xl.je);if(v>=olympe.net.ua.Tb.gj)throw Error(x);v>=olympe.net.ua.Tb.Il?a.G.warn('> HTTP: client bad request: reply with error:',
|
|
478
|
+
x):a.G.debug('> HTTP: reply with body:',Buffer.isBuffer(x)?'binary':x);return h.code(v).headers(Object.assign(l,t.Cj())).send(x)}).catch(t=>{a.G.error('> HTTP: reply with internal server error:',t);return h.code(olympe.net.ua.Tb.gj).headers(Object.assign(l,{[olympe.net.ua.Headers.Ii]:'text/plain'})).send('Internal server error')})}})}
|
|
479
|
+
olympe.Xa.node.net.http.ci=class extends olympe.net.ci{constructor(a,b,c,d,e){super(a);this.X=c;this.port=b;this.Z=d;this.N=e;this.j=this.createServer();this.H=new Map;this.state=jd.Pk;this.kd=new Set;this.timer=null}D(a,b,c,d){const e=olympe.net.ci.ALL;this.H.set(a,{path:b,methods:c,On:d,headers:e,origin:e});return this.F()}R(a){const b=this;return u(function*(){b.H.delete(a);return 0<b.H.size?b.F():b.stop()})}start(){if(this.state===jd.Pk)return this.F();if(this.state===jd.Ok){for(const a of this.H.values())pd(this,
|
|
480
|
+
a);return this.j.listen({port:this.port,host:'0.0.0.0'}).then(a=>{this.state=jd.$m;this.G.debug('Web server listening on '+a);this.kd.forEach(b=>b(null))}).catch(a=>{this.stop().then();this.kd.forEach(b=>b(a))}).finally(()=>this.kd.clear())}return Promise.reject('Try to start a webservice already started')}F(){return this.state===jd.Ok?(new Promise((a,b)=>{this.kd.add(c=>c?b(c):a())})).then(()=>this.F()):new Promise((a,b)=>{this.kd.add(c=>c?b(c):a());this.uj(()=>{const c=this;return u(function*(){c.state=
|
|
481
|
+
jd.Ok;yield c.j.close();c.j=c.createServer();yield c.start()})})})}stop(){return this.state===jd.$m?this.j.close().then(()=>{this.state=jd.Pk}):Promise.resolve()}createServer(){var a=olympe.ga.yb.j.qs,b=this.G.H();a={logger:{level:olympe.ga.yb.D[b===olympe.ga.yb.j.pk?a:b].toLowerCase()},http2:this.Z};if('string'===typeof this.N){b=require('fs');const c=require('path');Object.assign(a,{https:{allowHTTP1:!0,key:b.readFileSync(c.join(this.N,'key.pem')),cert:b.readFileSync(c.join(this.N,'cert.pem'))}})}a=
|
|
482
|
+
hd(a);a.addContentTypeParser('*',{parseAs:'buffer'},(c,d,e)=>{e(null,d)});return a}uj(a,b=1E3){this.timer&&clearTimeout(this.timer);this.timer=setTimeout(a,b)}};olympe.V.config(function(a){C(a,olympe.net.P.nj,olympe.Xa.node.net.http.ci,olympe.net.P.Da,new olympe.V.oa(olympe.net.Config.Bf),new olympe.V.oa(olympe.net.Config.Tp),new olympe.V.oa(olympe.net.Config.ls),new olympe.V.oa(olympe.net.Config.Sp))},'olympe.native.node.net.http');olympe.Xa.node.U={};const qd=require('stream').Readable,rd=require('buffer');
|
|
483
|
+
olympe.Xa.node.U.Ml=class extends olympe.U.Ml{D(a){return new Uint8Array(Buffer.from(a,'base64'))}j(a){return a instanceof Uint8Array?Buffer.from(a,a.byteOffset,a.byteLength).toString('base64'):Buffer.from(a).toString('base64')}H(a){const b=this,c=()=>super.H;return u(function*(){if(a instanceof qd){const d=[];for(const e=ha(a);;){const f=yield e.next();if(f.done)break;d.push(f.value)}return Buffer.concat(d)}return c().call(b,a)})}F(a){return Promise.resolve().then(()=>rd.resolveObjectURL(a)).catch(b=>
|
|
484
|
+
{throw Error(`Error while trying to fetch buffer from ObjectURL: ${b}`);})}};olympe.V.config(function(a){Va(a,olympe.U.P.Dg,olympe.Xa.node.U.Ml)},'olympe.native.node.utils');olympe.async={};function sd(a,b){a.H||a.X.push(a.F.rc(b))}
|
|
485
|
+
olympe.async.tp=class{constructor(a,b=void 0===a){this.D=[];this.X=[];this.F=a||new olympe.C.Xb('Async executor context');this.ia=b;this.j=null;this.env=new Map;this.env.set('Executor',this);this.H=this.N=!1;this.G=null;this.timer=this.timeout=0;this.Z=olympe.U.Lc()}$f(a){0<=a&&(this.timeout=a);return this}Wa(){return this.G}add(a){this.H||this.D.push(this.F.rc(a));return this}start(){this.N||(this.G&&this.G.log('Executor started.'),this.N=!0,this.F.onDestroy(()=>{this.j='Context destroyed.';this.complete(!1)},
|
|
486
|
+
this.Z),0<this.timeout&&(this.timer=setTimeout(()=>{this.j='Timeout expired.';this.timer=0;this.complete(!1)},this.timeout)))}clear(){this.D=[];this.X=[];this.env.clear();this.ia&&this.F.destroy()}complete(a){this.F.Xf(this.Z);if(!this.H){this.H=!0;this.timer&&(clearTimeout(this.timer),this.timer=0);this.G&&this.G.log(a?'Executor completed successfully':`Executor completed with error: ${this.j}`);for(const b of this.X)b(a,a?null:this.j,this.env);this.clear()}}getContext(){return this.F}};
|
|
487
|
+
function td(a){if(0<a.D.length){const b=a.D.shift();a.G&&a.G.log(`Executing next task. ${a.D.length} tasks left in the pipeline.`);a.getContext().run(()=>{b(()=>{Promise.resolve().then(()=>{td(a)})},c=>{c&&(a.j=c);a.complete(!1)},a.env)})}else a.complete(!0)}olympe.async.Cw=class extends olympe.async.tp{static create(){return new olympe.async.Cw(new olympe.C.Xb('SequencedExecutor'),!0)}start(){this.N||(super.start(),td(this))}};
|
|
488
|
+
olympe.async.Dk=class extends olympe.async.tp{constructor(a,b){super(a,b);this.R=0;this.ba=!0}static create(){return new olympe.async.Dk(new olympe.C.Xb('ParallelExecutor'),!0)}run(a){this.G&&this.G.log('Starting a task');this.getContext().run(()=>{a(()=>{this.done()},b=>{this.ba=!1;b&&(this.j=this.j?`${this.j}. ${b}`:b);this.done()},this.env)})}add(a){super.add(a);this.N&&!this.H&&(this.R++,this.run(a));return this}done(){this.R--;0>=this.R&&this.complete(this.ba)}start(){if(!this.N)if(super.start(),
|
|
489
|
+
0<this.D.length){this.R=this.D.length;for(const a of this.D)this.run(a)}else this.complete(!0)}};olympe.Db={};olympe.Db.qv=class{D(){return u(function*(){})}X(){}N(){}F(){}R(){}forEach(){}has(){}get(){}set(){}remove(){}ba(){}Z(){}clear(){}H(){}};olympe.Db.rv=class{D(){}};olympe.Db.Storage=class{open(){}write(){}close(){}};olympe.Db.Bv=class{get(){return null}set(){return this}delete(){}};olympe.Db.P={qk:'localStorage.KeyValueDatabaseManager',hj:'localStorage.Storage',TA:'localStorage.DatacloudStorage',Cm:'localStorage.LocalStorage',Da:'localStorage.Logger',$g:'localStorage.prefix'};olympe.V.config(function(a){Xa(a,olympe.Db.P.qk);D(a,olympe.Db.P.$g,[],()=>'olympe');D(a,olympe.Db.P.Da,[olympe.ga.P.Fa],b=>b.ad('localstorage'));C(a,olympe.Db.P.Cm,olympe.Db.Bv)},'olympe.localstorage');olympe.L={};olympe.L.Yb={ik:'urls.FileSvc',wo:'urls.BackupSvc',vr:'urls.RestoreBackupSvc',Jg:'urls.GetContext',Kp:'urls.GraphDef',Jo:'urls.StaticGraphDef',TRANSACTION:'urls.Transaction',ks:'urls.UserTagFromToken',Xw:'urls.UserNameFromTag',Ww:'urls.UserRoles',jw:'urls.RoleMembers',wk:'urls.OpenIDSvc'};
|
|
490
|
+
olympe.V.config(a=>{E(a,olympe.L.Yb.ik,'rest/filesvc');E(a,olympe.L.Yb.wo,'rest/backupsvc');E(a,olympe.L.Yb.vr,'rest/backupsvc/restore');E(a,olympe.L.Yb.wk,'rest/openid');E(a,olympe.L.Yb.Jg,'rest/initialData');E(a,olympe.L.Yb.Kp,'rest/querysvc/graphDef');E(a,olympe.L.Yb.Jo,'rest/querysvc/graphDef/static');E(a,olympe.L.Yb.TRANSACTION,'rest/transaction');E(a,olympe.L.Yb.ks,'rest/token');E(a,olympe.L.Yb.Xw,'rest/authorization/getUserTag');E(a,olympe.L.Yb.Ww,'rest/authorization/getUserRoles');E(a,olympe.L.Yb.jw,
|
|
491
491
|
'rest/authorization/roleMembers')});function ud(a,b){a.validate=b.ack.bind(b);a.N=b.reject.bind(b);a.H=b.wi();return a}
|
|
492
|
-
olympe.L.va=class{constructor(a,b,c,d,e,f){this.ae=c;this.F=a;this.source=b;this.D=d;this.messageType=e;this.j=null!=f?f:null;this.H=!1;this.validate=()=>u(function*(){});this.N=()=>u(function*(){})}static F(a,b,c){const d=olympe.L.va.D.
|
|
493
|
-
b){const c=olympe.L.va.D.
|
|
494
|
-
olympe.L.va.j={SEND:0,GET:1,SUBSCRIBE:2,PUBLISH:3,
|
|
495
|
-
olympe.L.Fc=class{constructor(a,b,c){this.j=a;this.D=b;this.F=c;this.user=null;Object.defineProperties(this,{D:{enumerable:!1},F:{enumerable:!1}})}Bi(){return null!==this.user?Promise.resolve(this.user):Ed(this.D,this.j).then(a=>this.user=a)}wi(){return this.j.wi()}
|
|
496
|
-
this;return u(function*(){const c=b.j.getType();if(c===wd||c===yd)yield b.j.ack(),yield b.D.cd(b.j,Bd,a);else throw Error('Should only call `reply` on GET requests');})}
|
|
497
|
-
id:d,refresh:this.D.Pf};this.j.ack().then(()=>this.D.cd(this.j,Cd,e)).catch(c)})}li(a){const b=this;return u(function*(){yield b.D.cd(b.j,Ad,{reason:a.message})})}};olympe.L.Fc.prototype.fail=olympe.L.Fc.prototype.li;olympe.L.Fc.prototype.notifyOn=olympe.L.Fc.prototype.
|
|
498
|
-
olympe.L.Fc.prototype.requestType=olympe.L.Fc.prototype.
|
|
492
|
+
olympe.L.va=class{constructor(a,b,c,d,e,f){this.ae=c;this.F=a;this.source=b;this.D=d;this.messageType=e;this.j=null!=f?f:null;this.H=!1;this.validate=()=>u(function*(){});this.N=()=>u(function*(){})}static F(a,b,c){const d=olympe.L.va.D.Om,e=ad(a);let f;var g=olympe.L.va,h=e[olympe.L.va.D.DESTINATION],k=e[olympe.L.va.D.Zg],l=e[olympe.L.va.D.Mk],n=e[olympe.L.va.D.ng],p=e[olympe.L.va.D.TYPE];b.R=c;return ud(new g(h,k,l,n,p,b.N(null!=(f=e[d])?f:null)),a)}wi(){return this.H}ic(){return this.F}jb(){return this.source}getType(){return this.messageType}ack(){return this.validate()}reject(){return this.N()}fa(a,
|
|
493
|
+
b){const c=olympe.L.va.D.Om,d={[olympe.L.va.D.DESTINATION]:this.F,[olympe.L.va.D.Zg]:this.source,[olympe.L.va.D.Mk]:this.ae,[olympe.L.va.D.ng]:this.D,[olympe.L.va.D.TYPE]:this.messageType};null!==this.j&&(a.X=b,d[c]=a.fa(this.j));return d}toString(){return`Message(dest: ${this.F}, src: ${this.source}, seqId: ${this.ae}, topic: ${this.D}, type: ${this.messageType}, payload: ${this.j})`}};olympe.L.va.D={DESTINATION:'d',Zg:'s',Mk:'i',ng:'tp',TYPE:'t',Om:'p',If:'tk'};
|
|
494
|
+
olympe.L.va.j={SEND:0,GET:1,SUBSCRIBE:2,PUBLISH:3,ns:4,je:5,ng:6,Ab:7,Jr:10,cs:11,ig:12,gs:13,Zm:14,Fp:15};olympe.L.an=class extends olympe.L.va{constructor(a,b,c,d,e,f,g){super(a,b,d,e,f,g);this.dd=c}static F(a,b,c){const d=olympe.L.va.D.Om,e=ad(a);let f;var g=olympe.L.an,h=e[olympe.L.va.D.DESTINATION],k=e[olympe.L.va.D.Zg],l=e[olympe.L.va.D.If],n=e[olympe.L.va.D.Mk],p=e[olympe.L.va.D.ng],q=e[olympe.L.va.D.TYPE];b.R=c;b=new g(h,k,l,n,p,q,b.N(null!=(f=e[d])?f:null));ud(b,a);return b}te(){return this.dd}fa(a,b){return Object.assign(super.fa(a,b),{[olympe.L.va.D.If]:this.dd})}toString(){return`SignedMessage{dest: ${this.F}, src: ${this.source}, seqId: ${this.ae}, topic: ${this.D}, type: ${this.messageType}, token: ${this.dd}, payload: ${this.j}}`}};const vd=olympe.L.va.j.SEND,wd=olympe.L.va.j.GET,xd=olympe.L.va.j.SUBSCRIBE,yd=olympe.L.va.j.ig,zd=olympe.L.va.j.Jr,Ad=olympe.L.va.j.Ab,Bd=olympe.L.va.j.ns,Cd=olympe.L.va.j.ng,Dd=olympe.L.va.j.cs;
|
|
495
|
+
olympe.L.Fc=class{constructor(a,b,c){this.j=a;this.D=b;this.F=c;this.user=null;Object.defineProperties(this,{D:{enumerable:!1},F:{enumerable:!1}})}Bi(){return null!==this.user?Promise.resolve(this.user):Ed(this.D,this.j).then(a=>this.user=a)}wi(){return this.j.wi()}qt(){return this.j.getType()}source(){return this.j.jb()}body(){return this.j.j}ack(){const a=this;return u(function*(){if(a.j.getType()!==vd)throw Error('Should only call `ack` on SEND requests');yield a.j.ack();yield a.D.cd(a.j,zd)})}cd(a){const b=
|
|
496
|
+
this;return u(function*(){const c=b.j.getType();if(c===wd||c===yd)yield b.j.ack(),yield b.D.cd(b.j,Bd,a);else throw Error('Should only call `reply` on GET requests');})}Un(a){return this.j.getType()!==xd?Promise.reject(Error('Should only call `notifyOn` on SUBSCRIBE requests')):new Promise((b,c)=>{const d=`sub_${olympe.U.Lc()}`,e={seq:Fd(this.D,f=>{switch(f.getType()){case Dd:Gd(this.F,d);b(d);break;case Ad:c(f.j.reason);break;default:c('Unsupported response type for a SUBSCRIBE request')}}),topic:a,
|
|
497
|
+
id:d,refresh:this.D.Pf};this.j.ack().then(()=>this.D.cd(this.j,Cd,e)).catch(c)})}li(a){const b=this;return u(function*(){yield b.D.cd(b.j,Ad,{reason:a.message})})}};olympe.L.Fc.prototype.fail=olympe.L.Fc.prototype.li;olympe.L.Fc.prototype.notifyOn=olympe.L.Fc.prototype.Un;olympe.L.Fc.prototype.reply=olympe.L.Fc.prototype.cd;olympe.L.Fc.prototype.ack=olympe.L.Fc.prototype.ack;olympe.L.Fc.prototype.body=olympe.L.Fc.prototype.body;olympe.L.Fc.prototype.source=olympe.L.Fc.prototype.source;
|
|
498
|
+
olympe.L.Fc.prototype.requestType=olympe.L.Fc.prototype.qt;olympe.L.Fc.prototype.isRedelivered=olympe.L.Fc.prototype.wi;olympe.L.Fc.prototype.userTag=olympe.L.Fc.prototype.Bi;function Hd(a,b){b&&a.rf();null===a.D&&(a.D=setInterval(a.rf.bind(a),a.F))}function Id(a){if(null!==a.D){var b=a.D;a.D=null;clearInterval(b)}}function Jd(a){return Array.from(a.j.values()).reduce((b,c)=>b+c.size,0)}function Kd(a,b,c){const d=a.j.get(b);c=!(null==d||!d.delete(c));0===(null==d?void 0:d.size)&&a.j.delete(b)&&0===a.j.size&&Id(a);return c}function Ld(a){a.j.forEach((b,c)=>{b.forEach((d,e)=>{Kd(a,c,e);null==d||d(new olympe.error.Ph(`Subscription ${e} to be refreshed`,e))})})}
|
|
499
499
|
function Md(a,b,c){let d;null==(d=a.j.get(b))||d.forEach((e,f)=>{Kd(a,b,f);e(c)})}
|
|
500
|
-
olympe.L.
|
|
501
|
-
olympe.error.
|
|
502
|
-
function Qd(a){Oc(a.D,()=>{a.
|
|
503
|
-
function Ud(a,b){a.G.debug(`Bus: starting topic prefix: '${a.H}'`);const c=new rxjs.BehaviorSubject(!1);rxjs.combineLatest([b,c,a.D.state.F.asObservable(),a.
|
|
504
|
-
try{a.G.debug('Bus: prefix change: unsubscribe from all topics');for(const [k]of e)yield Vd(a,k);a.H=d;a.G.debug('Bus: prefix change: subscribe again to all topics');for(const [k,l]of e)yield Wd(a,k,l,!f.has(k));a.G.debug('Bus: prefix change: force re-subscription');let h;null==(h=a.F)||h.forEach(k=>{Ld(k)});a.G.debug('Bus: prefix change: done!');c.next(!1)}catch(h){a.G.error(`Bus: was not able to change prefix: ${h}`),a.H=g,a.ia=new Map(e),a.
|
|
500
|
+
olympe.L.Iw=class{constructor(a,b,c,d){this.G=a;this.H=b;this.N=c;this.F=d;this.j=new Map;this.D=null}rf(){if(Nd(this.H)){var a=olympe.L.va.j.ig;this.j.forEach((b,c)=>{this.H.request(c,this.N,a,Array.from(b.keys()),!0).then(d=>{d=d.j;0<d.length&&d.forEach(e=>{let f;const g=null==(f=this.j.get(c))?void 0:f.get(e);Kd(this,c,e);null==g||g(new olympe.error.Ph('Subscription does not exist in the service.',e))})}).catch(d=>{const e=`Impossible to keep alive subscriptions of provider ${c}: ${d}`;d instanceof
|
|
501
|
+
olympe.error.Pq?d=new olympe.error.Ph('Subscriptions must be re-subscribed.'):(this.G.error(e),d=Error(e));Md(this,c,d)})})}else Id(this)}};const Od=new Set([olympe.L.va.j.SUBSCRIBE,olympe.L.va.j.GET,olympe.L.va.j.SEND,olympe.L.va.j.ng,olympe.L.va.j.je,olympe.L.va.j.ig]);function Ed(a,b){return new Promise((c,d)=>{a.N.qh(b.te(),(e,f)=>{e?d(e):c(f)})})}function Fd(a,b){a.vb++;const c=a.vb;a.wa.set(c,d=>{a.wa.delete(c);b(d)});return c}function Nd(a){return Pd(a.Ha)&&Pc(a.D)}
|
|
502
|
+
function Qd(a){Oc(a.D,()=>{a.Ub&&Rd(a);a.Ub=!1});Nc(a.D,()=>{a.Ub&&a.G.info('Reconnecting to bus...');a.X=!0});Mc(a.D,()=>{Sd(a).then(()=>{a.Ub=!0;a.X=!1;Td(a)}).catch(b=>{a.G.error(`An error occurred while trying to subscribe to the session: ${b}`);a.disconnect().catch(c=>{a.G.error(`An error occurred while trying to disconnect from the bus: ${c}`)})})})}
|
|
503
|
+
function Ud(a,b){a.G.debug(`Bus: starting topic prefix: '${a.H}'`);const c=new rxjs.BehaviorSubject(!1);rxjs.combineLatest([b,c,a.D.state.F.asObservable(),a.Ha.qf().asObservable()]).pipe(rxjs.operators.filter(([d,e])=>Nd(a)&&a.H!==d&&!e)).pipe(rxjs.operators.switchMap(([d])=>u(function*(){c.next(!0);a.G.debug(`Bus: new topic prefix detected: '${d}' (current: '${a.H}')`);const e=[...a.ia.entries()],f=new Set([...a.ba.keys()]),g=a.H;a.G.debug(`Bus: ${e.length} topics found: ${e.map(([h])=>h)}`);a.G.debug(`Bus: ${f.size} shared topics found: ${[...f.keys()]}`);
|
|
504
|
+
try{a.G.debug('Bus: prefix change: unsubscribe from all topics');for(const [k]of e)yield Vd(a,k);a.H=d;a.G.debug('Bus: prefix change: subscribe again to all topics');for(const [k,l]of e)yield Wd(a,k,l,!f.has(k));a.G.debug('Bus: prefix change: force re-subscription');let h;null==(h=a.F)||h.forEach(k=>{Ld(k)});a.G.debug('Bus: prefix change: done!');c.next(!1)}catch(h){a.G.error(`Bus: was not able to change prefix: ${h}`),a.H=g,a.ia=new Map(e),a.ba=f,c.next(!1)}}))).subscribe(()=>{})}
|
|
505
505
|
function Rd(a){a.G.info('Disconnected from bus.');let b;null==(b=a.F)||b.forEach((c,d)=>{null!==c.D&&(a.G.info(`Disconnected from bus: pause keep alive of ${Jd(c)} subscriptions for ${d} service.`),Id(c))})}function Sd(a){return u(function*(){a.G.debug('Connection to bus established. Listening to responses on topic',a.j);yield Wd(a,a.j,b=>{let c;null==(c=a.wa.get(b.ae))||c(b)},!0)})}
|
|
506
506
|
function Td(a){a.R.info(`Connected to bus (session: ${a.j}).`);a.G.debug(`Connected to bus (session ${a.j}): subscribe to ${a.ia.size} active topics.`);let b;null==(b=a.F)||b.forEach((c,d)=>{null===c.D&&(a.G.debug(`Connected to bus: start keep alive of ${Jd(c)} subscriptions for ${d} service.`),Hd(c,!0))});a.Z.forEach(c=>c(null));a.Z=[]}
|
|
507
|
-
function Vd(a,b){return u(function*(){var c;const d=null==(c=a.F)?void 0:c.get(b);d&&(Id(d),a.F.delete(b));const e=Xd(a,b);c=a.
|
|
508
|
-
function Wd(a,b,c,d=!0){return u(function*(){Nd(a)||(yield a.connect());a.ia.set(b,c);!d&&a.
|
|
509
|
-
function Yd(a){a.Md=a.lb.j(()=>Nd(a)?Promise.resolve('Bus connection OK'):Promise.reject('Bus is disconnected'))}function Zd(a,b,c,d=new Map){a.
|
|
510
|
-
function be(a,b){const c=olympe.L.
|
|
511
|
-
function ce(a,b,c){return u(function*(){let d;if('number'===typeof c)d=c;else{const f=de(a,b,b,olympe.L.va.j.
|
|
512
|
-
function fe(a,b,c,d){const e=b.ae,f=h=>{g&&clearTimeout(g);a.wa.delete(e);c(h)};a.wa.set(e,f);const g=setTimeout(()=>f(new olympe.L.va(a.j,a.j,e,b.D,olympe.L.va.j.Ab,{reason:'Timeout',code:olympe.error.lc.TIMEOUT})),d)}function ge(a,b,c,d,e,f){null===a.F&&(a.F=new Map);var g=a.F.get(b);g?(a=g,a.F!==e&&(a.F=e,null!==a.D&&(Id(a),Hd(a,!1)))):(g=new olympe.L.
|
|
513
|
-
function he(a,b,c,d){var e;const f=null==(e=a.F)?void 0:e.get(b);if(null==f?0:Kd(f,c,d))e=olympe.L.va.j.
|
|
514
|
-
olympe.L.
|
|
515
|
-
dd:k.Gd()}):null)).pipe(rxjs.operators.distinctUntilChanged((h,k)=>[...Object.keys(null!=k?k:{})].every(l=>(null!=h?h:{})[l]===(null!=k?k:{})[l])));this.D=a.N(b,this.j);Qd(this);this.H='';Ud(this,g.get('topicPrefix'));this.
|
|
516
|
-
this.Z.push(d=>d?b(d):a()):Pd(this.
|
|
517
|
-
this;return u(function*(){a.G.debug('Disconnecting from bus');a.N.R.delete('busLogoutCallback');a.lb.D(a.Md);a.lb.F(a.
|
|
518
|
-
}var g=Od.has(a.getType());yield c.D.ld(a.ae,e,f,{mandatory:g,
|
|
507
|
+
function Vd(a,b){return u(function*(){var c;const d=null==(c=a.F)?void 0:c.get(b);d&&(Id(d),a.F.delete(b));const e=Xd(a,b);c=a.ba.delete(b)?[a.j,e]:[a.j];a.G.debug(`Bus: Unsubscribe from ${b}`);yield Promise.all(c.map(f=>u(function*(){if(e!==f)try{yield $c(a.D,f,e)}catch(g){a.G.debug(`Failed to unbind topic ${e} from queue ${f}: ${g}`)}else try{a.ia.delete(b),yield Xc(a.D,f)}catch(g){a.G.debug(`Failed to unsubscribe from queue ${f}: ${g}`)}})))})}
|
|
508
|
+
function Wd(a,b,c,d=!0){return u(function*(){Nd(a)||(yield a.connect());a.ia.set(b,c);!d&&a.ba.add(b);const e=Xd(a,b);yield Promise.all((d?[[a.j,!0]]:[[a.j,!0],[e,!1]]).map(([f,g])=>u(function*(){a.D.D.has(f)||(a.G.debug(`Bus: Subscribe to queue ${f}..`),yield Wc(a.D,f,g,a.tg.bind(a,f)));var h;if(!(h=e===f)){let k,l;h=null!=(l=null==(k=a.D.D.get(f))?void 0:k.Bl.has(e))?l:!1}h||(yield Zc(a.D,f,e));a.G.debug(`Subscribed to topic ${e} over queue: ${f}`)})))})}
|
|
509
|
+
function Yd(a){a.Md=a.lb.j(()=>Nd(a)?Promise.resolve('Bus connection OK'):Promise.reject('Bus is disconnected'))}function Zd(a,b,c,d=new Map){a.ke.j&&rb(a.ke,'com',d.set('id',`${b}`).set('channel','bus').set('eventType',c))}function Xd(a,b,c=null){const d=$d(a,b,c);return!a.ba.has(d)&&null===c||!1===c||0===a.H.length?b:`${a.H}-${d}`}function ae(a,b,c){const d=`${b}:${c}`;b=a.Ua.get(d);b||(b=new olympe.L.ar(()=>a.Ua.delete(d)),a.Ua.set(d,b));return b}
|
|
510
|
+
function be(a,b){const c=olympe.L.Ne.Gg,d=olympe.L.Ne.Eh,e=olympe.L.Ne.Ab,f=b.j,{id:g,e:h}=f,k=`${b.jb()}:${g}`,l=ae(a,b.jb(),g);if(h===c){fb(a.Ua.j,k);const {i:n,c:p}=f;l.write(p,n).catch(q=>{l.throw(q)})}else h===d?l.complete(f.s):h===e&&l.throw(Error(`Received stream error: ${f.reason}`));b.ack().catch(n=>a.G.error(`Failed to ack message: ${n}`))}
|
|
511
|
+
function ce(a,b,c){return u(function*(){let d;if('number'===typeof c)d=c;else{const f=de(a,b,b,olympe.L.va.j.Fp);d=f.ae;yield a.ld(f)}let e=a.Gc.get(d);e||(e=[],a.Gc.set(d,e));return olympe.U.Promise.$f(new Promise(f=>{e.push(g=>f(g))}),15E3,`Timeout while getting the destination (sessionId) for message ${d}.`)})}function de(a,b,c,d,e){a.vb++;const f=ee(a.N).Gd();return new olympe.L.an(b,a.j,f,a.vb,c,d,e)}
|
|
512
|
+
function fe(a,b,c,d){const e=b.ae,f=h=>{g&&clearTimeout(g);a.wa.delete(e);c(h)};a.wa.set(e,f);const g=setTimeout(()=>f(new olympe.L.va(a.j,a.j,e,b.D,olympe.L.va.j.Ab,{reason:'Timeout',code:olympe.error.lc.TIMEOUT})),d)}function ge(a,b,c,d,e,f){null===a.F&&(a.F=new Map);var g=a.F.get(b);g?(a=g,a.F!==e&&(a.F=e,null!==a.D&&(Id(a),Hd(a,!1)))):(g=new olympe.L.Iw(a.G,a,b,e),a.F.set(b,g));e=g;g=e.j.size;a=e.j.get(c);a||(a=new Map,e.j.set(c,a));a.set(d,f);0===g&&Hd(e,!1)}
|
|
513
|
+
function he(a,b,c,d){var e;const f=null==(e=a.F)?void 0:e.get(b);if(null==f?0:Kd(f,c,d))e=olympe.L.va.j.gs,Nd(a)&&a.ld(de(a,c,b,e,d)).catch(g=>a.G.error(`Impossible to keep alive subscriptions: ${g}`)),0===Jd(f)&&(a.F.delete(b),0===a.F.size&&(a.F=null))}function $d(a,b,c=null){const d=b.substring(a.H.length);return a.ba.has(d)&&!1!==c?d:b}
|
|
514
|
+
olympe.L.Ol=class{constructor(a,b,c,d,e,f,g){this.G=olympe.ga.Wa('bus');this.R=olympe.ga.Wa('communication');this.Ha=b;this.N=c;this.lb=d;this.Qe=e;this.ke=f;this.wa=new Map;this.j=`${'olympe-runtime'}-${olympe.U.Lc()}`;this.Hc=g.get('requestTimeout');this.Pf=g.get('subscriptionsRefreshRate');this.Fd=g.get('allowGuest');b=rxjs.combineLatest([g.get('connection'),this.N.dd.tb().asObservable(),this.Ha.qf().asObservable()]).pipe(rxjs.operators.map(([h,k,l])=>l.valueOf()?Object.assign({},h,{user:k.xc(),
|
|
515
|
+
dd:k.Gd()}):null)).pipe(rxjs.operators.distinctUntilChanged((h,k)=>[...Object.keys(null!=k?k:{})].every(l=>(null!=h?h:{})[l]===(null!=k?k:{})[l])));this.D=a.N(b,this.j);Qd(this);this.H='';Ud(this,g.get('topicPrefix'));this.ol=this.vb=0;this.F=null;this.X=!1;this.Z=[];this.ia=new Map;this.ba=new Set;this.Gc=new Map;this.Ua=new olympe.U.Zh(this.Hc);this.ef=this.Md='';this.Ub=this.hd=!1}connect(){return new Promise((a,b)=>{const c=d=>{b(d);this.Z.forEach(e=>e(d));this.Z=[]};Nd(this)?a():this.X||this.hd?
|
|
516
|
+
this.Z.push(d=>d?b(d):a()):Pd(this.Ha)?(this.hd=!0,olympe.C.nt([this.N.rl()],d=>{Yd(this);this.hd=!1;d.valueOf()||this.Fd?(this.Fd||ie(this.N,()=>this.disconnect().then()),this.X=!0,this.Z.push(e=>e?b(e):a()),this.D.connect().catch(e=>{this.X=!1;c(e)}),this.ef=this.lb.Ha(()=>this.disconnect(),'Bus websocket')):c(Error('Guest user is not allowed to connect to RabbitMQ, you can allow guest with the bus.allowGuest oConfig parameter!'))})):c(Error('Cannot connect to the bus if working offline'))})}disconnect(){const a=
|
|
517
|
+
this;return u(function*(){a.G.debug('Disconnecting from bus');a.N.R.delete('busLogoutCallback');a.lb.D(a.Md);a.lb.F(a.ef);yield a.D.disconnect()})}ld(a,b=!1){const c=this;return u(function*(){if(!c.X||a.getType()!==olympe.L.va.j.ig){Nd(c)||(yield c.connect());var d=a.F.startsWith('olympe-runtime'),e=d?a.ic():Xd(c,a.ic(),!0);try{Zd(c,a.ae.toString(),'serialize');var f=a.fa(c.Qe,c.mi.bind(c,a.D,a.ae));c.R.j()&&c.R.j()&&c.R.debug(`BUS > #${e}:`,JSON.stringify(f))}catch(h){throw Error(`An error occurred while serializing the message (seqId=${a.ae}): ${h}`);
|
|
518
|
+
}var g=Od.has(a.getType());yield c.D.ld(a.ae,e,f,{mandatory:g,Bt:!(d||b)});Zd(c,a.ae.toString(),'publish',(new Map).set('destination',a.ic()).set('messageType',a.getType().toString()))}})}mi(a,b,c){const d=this.ol++;(()=>{const e=this;return u(function*(){let f;try{f=yield ce(e,a,b)}catch(p){e.G.error(`Error to get the destSessionId for the stream ${d}: ${p}`);return}const g=p=>e.ld(new olympe.L.va(f,e.j,b,a,olympe.L.va.j.je,p)),h=olympe.L.Ne.Gg,k=olympe.L.Ne.Eh,l=olympe.L.Ne.Ab;let n=0;try{for(const p=
|
|
519
519
|
ha(c);;){const q=yield p.next();if(q.done)break;const r=q.value;yield g({id:d,i:n++,e:h,c:r})}yield g({id:d,s:n,e:k})}catch(p){yield g({id:d,e:l,reason:`Error to complete the stream: ${p}`})}})})();return d}cd(a,b,c){return this.send(a.ae,a.jb(),a.jb(),b,c)}send(a,b,c,d,e){return this.ld(new olympe.L.va(c,this.j,a,b,d,e))}request(a,b,c,d,e,f){const g=de(this,a,b,c,d);return c===olympe.L.va.j.PUBLISH?this.ld(g,e):new Promise((h,k)=>{fe(this,g,h,null!=f?f:this.Hc);this.ld(g,e).catch(k)})}tg(a,b){const c=
|
|
520
|
-
olympe.L.va.D.Zg;a=olympe.L.va.D.
|
|
521
|
-
this.G.error(`Failed to reject message: ${k}`));return}const g=d;b=g.ae;Zd(this,b.toString(),'deserialized',(new Map).set('source',g.jb()).set('messageType',g.getType().toString()));switch(g.getType()){case olympe.L.va.j.
|
|
522
|
-
try{let k;null==(k=this.ia.get(g.D))||k(g)}catch(k){this.G.error(`An error occurred while trying to handle the message: ${k}`)}}}};olympe.L.
|
|
520
|
+
olympe.L.va.D.Zg;a=olympe.L.va.D.Mk;var d=olympe.L.va.D.If;const e=ad(b);this.R.j()&&this.R.debug(`BUS < #${b.N}:`,JSON.stringify(e));Zd(this,e[a],'consumed');a=void 0===e[d]?olympe.L.va.F:olympe.L.an.F;d=null;let f=!1;try{d=a.call(null,b,this.Qe,h=>{f=!0;return ae(this,e[c],h).stream}),Od.has(d.getType())||b.ack().catch(h=>this.G.error(`Failed to ack message: ${h}`))}catch(h){this.G.error(`An error occurred while trying to deserialize the message: ${JSON.stringify(e)} with error ${h}`);b.reject().catch(k=>
|
|
521
|
+
this.G.error(`Failed to reject message: ${k}`));return}const g=d;b=g.ae;Zd(this,b.toString(),'deserialized',(new Map).set('source',g.jb()).set('messageType',g.getType().toString()));switch(g.getType()){case olympe.L.va.j.je:be(this,g);break;case olympe.L.va.j.Fp:this.cd(g,olympe.L.va.j.Zm).catch(k=>this.G.error(`Failed to reply to get session message: ${k}`));break;case olympe.L.va.j.Zm:let h;null==(h=this.Gc.get(b))||h.forEach(k=>k(g.jb()));break;default:f&&this.cd(g,olympe.L.va.j.Zm).catch(k=>this.G.error(`Failed to send session id for stream publishing: ${k}`));
|
|
522
|
+
try{let k;null==(k=this.ia.get(g.D))||k(g)}catch(k){this.G.error(`An error occurred while trying to handle the message: ${k}`)}}}};olympe.L.Ol.D='Timeout';olympe.L.Ol.j='olympe-runtime';const je=olympe.net.ua.Headers.vo,ke=olympe.net.ua.Tb.Qh,le=olympe.net.ua.Tb.Po,me=olympe.net.ua.Tb.Rj,ne=olympe.net.ua.Tb.qw,oe=olympe.net.ua.Tb.No,pe=olympe.net.ua.Tb.kk,qe=olympe.net.ua.Tb.Rw,re=olympe.net.ua.Tb.Zi;function se(a,b){let c;return null!=(c=a.F.get(b))?c:''}function te(a,b,c,d=new Map){a.j.j&&rb(a.j,'com',d.set('id',`${b}`).set('channel','http').set('eventType',c))}
|
|
523
523
|
function ue(a,b,c){if(null===b)return Promise.reject('No http request to send');Fc(b,{[je]:c});const d=b.j();return rxjs.firstValueFrom(rxjs.defer(()=>{a.D++;const e=a.D;if(a.G.j()){const f=b.body;a.G.debug('HTTP >',d,`body: ${'string'===typeof f?f:typeof f}`)}te(a,e,'request',(new Map).set('destination',b.j()).set('messageType',b.method.toString()));return Ic(a.H,b).then(f=>{te(a,e,'reply');switch(f.Kc()){case ke:case le:case me:var g=f.getData();a.G.j()&&a.G.debug('HTTP <',f.Kc(),`content: ${'string'===
|
|
524
|
-
typeof g?g:typeof g}`);return f;case ne:throw f=`HTTP < Service provider for http request to ${b.j()} is overloaded, retry later`,a.G.warn(f),new olympe.error.
|
|
525
|
-
a.G.error(g);if(500===f.Kc()&&'Connection refused'===f.statusText)throw new olympe.error.
|
|
524
|
+
typeof g?g:typeof g}`);return f;case ne:throw f=`HTTP < Service provider for http request to ${b.j()} is overloaded, retry later`,a.G.warn(f),new olympe.error.br(f);case oe:return a.G.debug(`HTTP < request canceled (${b.j()}).`),f;case pe:case qe:throw f=`HTTP < request authorization denied: ${b.j()}, ${f.statusText}`,a.G.error(f),new olympe.error.uk(f);case re:throw f=`HTTP < requested resource not found: ${b.j()}`,a.G.error(f),new olympe.error.Hm(f);default:g=`HTTP < Error: ${f.Kc()}, ${f.statusText}`;
|
|
525
|
+
a.G.error(g);if(500===f.Kc()&&'Connection refused'===f.statusText)throw new olympe.error.Vo(g);throw new olympe.error.pd(g);}})}).pipe(sb(olympe.error.br,(e,f)=>{a.G.warn(`Service overloaded (${d}), retry sending http request after ${f}ms.`)},a.N)))}olympe.L.zu=class{constructor(a,b,c,d,e){this.G=a;this.H=b;this.j=c;this.F=null;d.subscribe(f=>{this.F=f});this.N=e;this.D=0}};function O(a,b){if(a.state!==b)switch(a.G.debug('State change '+a.state+' --\x3e '+b),a.state=b,a.vb.forEach(c=>c(b)),b){case olympe.L.Na.j.Zk:case olympe.L.Na.j.CONNECTING:case olympe.L.Na.j.gp:break;case olympe.L.Na.j.Ae:a.connected.update(olympe.C.da.D);break;case olympe.L.Na.j.Tg:a.F=[0,0,a.F[2]];ve(a);break;case olympe.L.Na.j.Ab:let c;a.G.error('Connection to server',null==(c=a.N)?void 0:c.j(),'aborted due to error');a.connected.update(olympe.C.da.j);break;case olympe.L.Na.j.po:ve(a);break;case olympe.L.Na.j.zc:a.connected.update(olympe.C.da.j);
|
|
526
526
|
break;default:throw Error('State machine error in server manager. Should not get in state '+b);}}
|
|
527
|
-
function we(a){const b=olympe.L.Na.j.
|
|
528
|
-
O(a,d)}});f.D(()=>{a.G.warn(`Communication with ${e} failed.`);f.close();O(a,d)});f.
|
|
529
|
-
function xe(a,b,c){a.G.log('Initializing COMMUNICATION layer');if(a.G.j()){const d=['Server layer parameters:'];b.forEach((e,f)=>{d.push(f+'="'+e+'"')});a.G.debug(d.join('\n\t'))}ye(a,olympe.L.
|
|
530
|
-
{d.c===olympe.L.
|
|
531
|
-
a.G.log('DONE initializing SERVER layer (waiting for NET layer connection to be opened)')}function Ae(a){return a.state===olympe.L.Na.j.
|
|
532
|
-
function ve(a){const b=olympe.L.Na.j.INIT,c=olympe.L.Na.j.CONNECTING,d=olympe.L.Na.j.
|
|
533
|
-
a.j.X(()=>{a.j=null;a.state===d?O(a,f):a.state!==h&&a.state!==g&&O(a,e)});a.Z&&a.state===b&&a.j.D(()=>{a.j.D(null);a.state===c&&we(a);a.Z=null});a.state!==f&&O(a,c)}}function De(a,b,c,d){const e=a.
|
|
534
|
-
function Ee(a){const b=olympe.L.Na.D.ij;return c=>{if(null!==c&&void 0!==c){var d=null,e=c.s;if(void 0!==e&&e!==b){d=void 0!==olympe.L.Na.oc[e]?`Status code = ${e} [${olympe.L.Na.oc[e]}]`:`Status code = ${e}`;e=olympe.error.
|
|
535
|
-
function Fe(a,b,c){var d=c.message;a.G.j()&&a.G.debug('WS >',JSON.stringify(d.payload));(d=a.j.send(JSON.stringify(d)))?null===c.
|
|
536
|
-
function ze(a,b,c){if(a.D.has(b)){const {
|
|
537
|
-
function Je(a,b){const c=olympe.L.
|
|
538
|
-
olympe.L.Na=class{constructor(a,b,c,d,e,f,g,h){this.G=a;this.Gc=b;this.N=null;e.subscribe(k=>{this.N=k;k=olympe.L.Na.j.CONNECTING;if(this.state===olympe.L.Na.j.
|
|
539
|
-
this.state=olympe.L.Na.j.INIT;this.Ua=d;this.
|
|
540
|
-
b||ve(this);Be(this,[a,b,c],g=>{g===a?e():f(Error('Was not able to open a connection to the orchestrator'))},!0)})}disconnect(){return new Promise((a,b)=>{const c=olympe.L.Na.j.
|
|
541
|
-
Hb(this.X),'subscribeEverything:',this.
|
|
542
|
-
return;case c.
|
|
543
|
-
return}this.G.log('Handshake successful. Orchestrator version: ',JSON.stringify(e),'required:',Hb(this.
|
|
544
|
-
(this.G.debug('Ping did not get answer, try to reconnect'),O(this,olympe.L.Na.j.Tg)):(this.F[0]=Date.now(),this.j.send('ping')||(this.G.debug('Impossible to send ping, try to reconnect'),O(this,olympe.L.Na.j.Tg)))}
|
|
545
|
-
c.seqId;var d=c.stream;const e=c.messageFamily;c=c.payload;if(this.G.j()){const g=({id:h,i:k,e:l,c:n})=>l===olympe.L.
|
|
546
|
-
null;f=d.stream}this.D.has(a)&&({
|
|
547
|
-
function Ke(a,b){const c=olympe.L.uc.j.
|
|
527
|
+
function we(a){const b=olympe.L.Na.j.po,c=olympe.L.Na.j.Zk,d=olympe.L.Na.j.zc,e=Ec(a.Z);a.G.info(`Trying to wakeup orchestrator with ${e}`);O(a,c);const f=a.Gc.D(a.Z);f.Z(g=>{const h=JSON.parse(g);a.G.info(`${e}: ${null==h?void 0:h.status}`);switch(null==h?void 0:h.status){case 'ready':O(a,b);f.close();break;case 'asleep':a.G.info(`Trying to wakeup orchestrator with ${e}`);f.send('{"action": "wakeup"}');O(a,c);break;case 'waking-up':break;default:a.G.warn(`Invalid message from ${e}: ${g}`),f.close(),
|
|
528
|
+
O(a,d)}});f.D(()=>{a.G.warn(`Communication with ${e} failed.`);f.close();O(a,d)});f.ba(()=>{a.G.info(`Checking orchestrator status with ${e}`);f.send('{"action": "status"}')})}
|
|
529
|
+
function xe(a,b,c){a.G.log('Initializing COMMUNICATION layer');if(a.G.j()){const d=['Server layer parameters:'];b.forEach((e,f)=>{d.push(f+'="'+e+'"')});a.G.debug(d.join('\n\t'))}ye(a,olympe.L.Fe.Ab,d=>{switch(d.c){case olympe.L.sk.Tw:a.G.error('Unknown message sent to the server:',olympe.L.Na.oc[d.s]);break;case olympe.L.sk.ru:a.G.error('Fatal error, the last message is probably too big according to the websocket config.'),a.D.forEach((e,f)=>{null!==e.Zn&&ze(a,f,d.i)})}});ye(a,olympe.L.Fe.oc,d=>
|
|
530
|
+
{d.c===olympe.L.sk.fw&&'boolean'===typeof d.a&&a.tg.update(olympe.C.Rb(d.a))});olympe.C.Gj(a.connected,()=>{let d=!1;olympe.C.Gj(a.Ua.j(),()=>{d&&(a.Hc(),a.lb(),d=!1);Cc(a.Hc.bind(a),a.Md);Cc(a.lb.bind(a),a.wa)},()=>{a.F=[0,0,a.F[2]];d=!0})},()=>{a.R=null;Bc(a.lb.bind(a),a.wa)});c.j(()=>Ae(a)?Promise.resolve('WebSocket connection to Orchestrator OK'):Promise.reject(`WebSocket connection to Orchestrator is ${a.state}`));c.Ha(()=>a.disconnect(),'Orchestrator websocket');hb(a.H,(d,e)=>{e.throw(Error('Stream timeout'))});
|
|
531
|
+
a.G.log('DONE initializing SERVER layer (waiting for NET layer connection to be opened)')}function Ae(a){return a.state===olympe.L.Na.j.Ae}function Be(a,b,c,d=!1){const e=f=>{if(0===b.length||b.includes(f))d&&a.vb.delete(e),c(f)};a.vb.add(e);e(a.state)}function Ce(a,b,c,d,e){a.ba.j&&rb(a.ba,'com',d.set('id',`${b}`).set('channel','ws').set('eventType',c),e)}
|
|
532
|
+
function ve(a){const b=olympe.L.Na.j.INIT,c=olympe.L.Na.j.CONNECTING,d=olympe.L.Na.j.Ae,e=olympe.L.Na.j.zc,f=olympe.L.Na.j.Tg,g=olympe.L.Na.j.Zk,h=olympe.L.Na.j.Ab;if(null===a.N)a.G.warn('Trying to open a connection to the orchestrator without a valid server request. Ignoring...'),O(a,e);else{null!==a.j&&(a.j.X(null),a.j.close());var k,l;a.G.log(`Asking NET layer for a connection to ${null==(k=a.N)?void 0:Dc(k)}:${null==(l=a.N)?void 0:l.port}...`);a.j=a.Gc.D(a.N);a.j.ba(a.ke.bind(a));a.j.Z(a.ef.bind(a));
|
|
533
|
+
a.j.X(()=>{a.j=null;a.state===d?O(a,f):a.state!==h&&a.state!==g&&O(a,e)});a.Z&&a.state===b&&a.j.D(()=>{a.j.D(null);a.state===c&&we(a);a.Z=null});a.state!==f&&O(a,c)}}function De(a,b,c,d){const e=a.Qe;a.Qe++;c={message:{seqId:e,messageFamily:b,payload:c},tn:d?Ee(d):null,Zn:null};a.D.set(e,c);Ce(a,e,'publish',(new Map).set('family',b));d=[olympe.L.Na.j.CONNECTING,olympe.L.Na.j.Tg];(Ae(a)||b===olympe.L.Fe.nk&&d.includes(a.state))&&Fe(a,e,c)}
|
|
534
|
+
function Ee(a){const b=olympe.L.Na.D.ij;return c=>{if(null!==c&&void 0!==c){var d=null,e=c.s;if(void 0!==e&&e!==b){d=void 0!==olympe.L.Na.oc[e]?`Status code = ${e} [${olympe.L.Na.oc[e]}]`:`Status code = ${e}`;e=olympe.error.Er;const f=c.error;'string'===typeof f&&0<f.length&&(f.includes('Message timeout')&&(e=olympe.error.Vk),d+=`\nReason:\n${f}`);d=new e('Rejected by orchestrator:\n'+d)}a(d,c)}}}
|
|
535
|
+
function Fe(a,b,c){var d=c.message;a.G.j()&&a.G.debug('WS >',JSON.stringify(d.payload));(d=a.j.send(JSON.stringify(d)))?null===c.tn?a.D.delete(b):c.Zn=Date.now():olympe.C.Qa(a.Ua.j()).valueOf()&&O(a,olympe.L.Na.j.Tg);return d}function ye(a,b,c,d){void 0===d&&(d=olympe.U.Lc());let e=a.ia.get(b);void 0===e&&(e=new Map,a.ia.set(b,e));e.set(d,c)}function Ge(a){a=a.ia.get(olympe.L.Fe.Ng);void 0!==a&&a.delete('logoutHandler')}
|
|
536
|
+
function ze(a,b,c){if(a.D.has(b)){const {tn:d}=a.D.get(b);a.D.delete(b);null==d||d({s:olympe.L.Na.D.fq,error:c})}}function He(a,b){a.G.error(b);O(a,olympe.L.Na.j.Ab)}function Ie(a,b,c){a.hd=c?1E3*c:-1;let d;a.G.info(`Connected to ${null==(d=a.N)?void 0:d.j()}`,'|',b?`server version: ${b}`:'','|',null!==c?`activity timeout: ${c}s`:'');b=Array.from(a.D).sort(([e],[f])=>e-f);for(const [e,f]of b)if(!Fe(a,e,f))return;O(a,olympe.L.Na.j.Ae)}
|
|
537
|
+
function Je(a,b){const c=olympe.L.Ne.Gg,d=olympe.L.Ne.Eh,e=olympe.L.Ne.Ab,{id:f,e:g}=b;let h=a.H.get(f);h||(h=new olympe.L.ar(()=>a.H.delete(f)),a.H.set(f,h));if(g===c){fb(a.H.j,f);const {i:k,c:l}=b;h.write(l,k).catch(n=>{h.throw(n)})}else g===d?h.complete(b.s):g===e&&h.throw(Error(`Received stream error: ${b.reason}`))}
|
|
538
|
+
olympe.L.Na=class{constructor(a,b,c,d,e,f,g,h){this.G=a;this.Gc=b;this.N=null;e.subscribe(k=>{this.N=k;k=olympe.L.Na.j.CONNECTING;if(this.state===olympe.L.Na.j.Ae||this.state===k){let l;null==(l=this.j)||l.close()}});this.Z=this.j=null;e.subscribe(k=>{this.Z=k;k=olympe.L.Na.j.zc;this.state===olympe.L.Na.j.Zk&&(O(this,k),we(this))});this.ba=g;this.Md=h.get('pingInterval');this.wa=h.get('messageTimeout');this.X=olympe.U.Mf.parse(h.get('clientVersion'));this.Ha=olympe.U.Mf.parse(h.get('serverVersion'));
|
|
539
|
+
this.state=olympe.L.Na.j.INIT;this.Ua=d;this.Ub=h.get('getContextMode');this.Qe=1;this.R=null;this.F=[0,0,0];this.ia=new Map;this.connected=olympe.C.bc(olympe.C.da,'Server is connected');this.tg=lc(olympe.C.bc(olympe.C.da,'Server is readonly'),olympe.C.da.j);this.vb=new Set;this.D=new Map;this.H=new olympe.U.Zh(this.wa);this.Fd=new Map;this.hd=-1;xe(this,h,c)}connect(){const a=olympe.L.Na.j.Ae,b=olympe.L.Na.j.zc,c=olympe.L.Na.j.Ab,d=olympe.L.Na.j.INIT;return new Promise((e,f)=>{this.state!==d&&this.state!==
|
|
540
|
+
b||ve(this);Be(this,[a,b,c],g=>{g===a?e():f(Error('Was not able to open a connection to the orchestrator'))},!0)})}disconnect(){return new Promise((a,b)=>{const c=olympe.L.Na.j.gp,d=olympe.L.Na.j.zc,e=olympe.L.Na.j.CONNECTING,f=olympe.L.Na.j.Ab;this.state===olympe.L.Na.j.Ae||this.state===e||this.state===c?(Be(this,[d,f],g=>{g===d?a():b(Error('Was not able to disconnect'))},!0),this.state!==c&&(O(this,c),this.j.close())):(O(this,d),a())})}ke(){this.G.debug('Websocket connected, sending handshake. Client version:',
|
|
541
|
+
Hb(this.X),'subscribeEverything:',this.Ub?'NO':'YES');De(this,olympe.L.Fe.nk,{c:olympe.L.sk.nk,cv:Hb(this.X),m:this.Ub?0:1,s:this.R,b:this.Ua.D()},this.Pf.bind(this))}Pf(a,b){if(a)He(this,'Error in receiving handshake response: '+a.message);else{this.G.debug('Handshake response received');var c=olympe.L.Na.F;a=b.sv||'undefined';var d=b.activityTimeout?Math.max(b.activityTimeout-60,5):null;switch(b.status){case c.Ku:He(this,`Framework version (${Hb(this.X)}) provided to the orchestrator was not valid. See orchestrator logs for more info.`);
|
|
542
|
+
return;case c.Kw:He(this,`Framework version (${Hb(this.X)}) is not compatible with the orchestrator in use. See orchestrator logs for more info.`);return;case c.uu:He(this,'Handshake failed. See orchestrator logs for more info.');return}if(this.Ha.Ea(olympe.U.Mf.j))this.G.warn('Handshake successful but received server version',a,'is invalid. Cannot check against it');else try{var e=olympe.U.Mf.parse(a);if(e.Pj(this.Ha)){He(this,`Framework v${Hb(this.X)} is expecting Orchestrator to be at least in v${Hb(this.Ha)}`);
|
|
543
|
+
return}this.G.log('Handshake successful. Orchestrator version: ',JSON.stringify(e),'required:',Hb(this.Ha))}catch(f){He(this,f);return}e=olympe.L.Na.j.zc;if(this.state===olympe.L.Na.j.Tg&&null!==this.R&&this.R!==b.sessionId)this.G.warn('Trying to do a session recovering, but got another session id so retry from disconnected state'),O(this,e);else{if(e=b.identityProviders)for(const [f,g]of Object.entries(e))this.Fd.set(f,g);this.R=b.sessionId||null;Ie(this,a,d)}}}Hc(){this.F[0]-this.F[1]>this.Md/2?
|
|
544
|
+
(this.G.debug('Ping did not get answer, try to reconnect'),O(this,olympe.L.Na.j.Tg)):(this.F[0]=Date.now(),this.j.send('ping')||(this.G.debug('Impossible to send ping, try to reconnect'),O(this,olympe.L.Na.j.Tg)))}ef(a){this.F[2]=Date.now();if(a.startsWith('pong'))return olympe.C.Qa(this.Ua.j()).valueOf()&&(this.F[1]=this.F[2]),null;var b=0;this.ba.j&&(b=performance.now()-this.ba.D);try{var c=JSON.parse(a)}catch(g){return this.G.error('Unable to parse response from server: '+g.toString()),Error('Unable to parse response from server')}a=
|
|
545
|
+
c.seqId;var d=c.stream;const e=c.messageFamily;c=c.payload;if(this.G.j()){const g=({id:h,i:k,e:l,c:n})=>l===olympe.L.Ne.Gg?`stream[${h}][${k}]: ${JSON.stringify(n)}`:l===olympe.L.Ne.Eh?`stream[${h}]:END`:`stream[${h}]:ERROR`;this.G.debug(`WS < ${JSON.stringify(c)}, ${d?g(d):''}`)}Ce(this,a,'consumed',new Map,b);Ce(this,a,'deserialized',(new Map).set('family',e));if(void 0!==d){var f=d.id;b=this.H.has(f);Je(this,d);if(b)return null;d=this.H.get(f);if(!d)return this.G.error(`Received a stream chunk for an unknown stream id: ${f}`),
|
|
546
|
+
null;f=d.stream}this.D.has(a)&&({tn:d}=this.D.get(a),this.D.delete(a),null==d||d(c,f));a=this.ia.get(e);if(void 0!==a)for(const g of a.values())g(c,f);return null}lb(){const a=Date.now();for(const [b,{Zn:c}]of this.D)null!==c&&a-c>this.wa&&(this.G.warn(`No response was received from the server for the seqId = ${b}`),ze(this,b,'Message timeout: never receive acknowledge'))}};function Pd(a){return olympe.C.Qa(a.state)===olympe.L.uc.j.cj}
|
|
547
|
+
function Ke(a,b){const c=olympe.L.uc.j.Pm,d=olympe.L.uc.j.Ef,e=olympe.L.uc.j.zc,f=olympe.L.uc.j.xw,g=b.get('reconnectionDelay');Be(a.D,[olympe.L.Na.j.INIT],()=>{Le(a)?(a.state.update(c),a.connect().catch(h=>a.G.error(h))):a.D.disconnect().catch(h=>a.G.error(h))},!0);Be(a.D,[olympe.L.Na.j.zc],()=>{if(olympe.C.Qa(a.state)===f)a.G.info('Disconnected, from orchestrator for shutdown');else if(a.state.update(a.j?d:e),Le(a)&&a.N){const h=`Disconnected, will try to auto reconnect in ${g} ms`;a.j?a.G.log(h):
|
|
548
548
|
a.G.error(h);setTimeout(()=>a.connect().catch(k=>a.G.error(k)),g)}else a.G.info('Disconnected, stay offline.')});a.H.H(()=>{a.state.update(f);return Promise.resolve()},'Connectivity manager: shutdown state')}function Le(a){return null===a.storage.get(a.F+'olympe_manual_offline')}
|
|
549
|
-
olympe.L.uc=class{constructor(a,b,c,d,e,f){this.G=a;this.D=b;this.H=d;this.storage=e;this.state=olympe.C.bc(Number).update(olympe.L.uc.j.INIT);this.j=f.get('offlineEnabled');this.N=f.get('offlineAutoBackOnline');this.F=f.get('storagePrefix');Ke(this,f)}qf(){const a=olympe.L.uc.j.cj,b=olympe.L.uc.j.Ef,c=olympe.L.uc.j.zc;let d=olympe.C.
|
|
550
|
-
this;return u(function*(){const b=olympe.L.uc.j.cj,c=olympe.L.uc.j.
|
|
551
|
-
b&&(a.state.update(c),yield olympe.L.ih().disconnect(),yield a.D.disconnect())})}};olympe.L.uc.j={INIT:0,
|
|
552
|
-
a.toJSON());case a instanceof Map:return a=Object.fromEntries(Array.from(a).map(([c,d])=>[c,this.D(d)])),this.format(olympe.L.cc.j.
|
|
553
|
-
a:if(!this.X)throw Error('No stream handler has been set, so cannot serialize the asyncIterable.');let b;return this.format(olympe.L.cc.j.
|
|
554
|
-
typeof a:return a}if(Array.isArray(a))return a.map(d=>this.j(d));if('object'!==typeof a)throw new olympe.error.
|
|
555
|
-
case olympe.L.cc.j.
|
|
556
|
-
function Xe(a){let b,c;const d=null!=(c=null==(b=a.j)?void 0:b.code)?c:olympe.error.lc.
|
|
557
|
-
olympe.L.qb=class{constructor(a,b){this.D=olympe.L.ih();this.F=a;this.H=this.j=null;this.N=new olympe.C.Xb(`Service ${a}`,'function'===typeof b.Cb?b.Cb():b);this.G=olympe.
|
|
558
|
-
a,Pe,b,!1)})}static
|
|
559
|
-
d.j;if(null!==d)return d;throw Error('No payload after request to service: '+a);case Ue:throw Xe(d);default:throw Error('Unsupported response type for a GET request');}})}static observe(a,b,c,d={}){const e='function'===typeof b.Cb?b.Cb():b,f=olympe.L.ih(),g=new olympe.L.
|
|
560
|
-
e.Xd(p);f.request(a,a,Qe,c,!0,d.timeout).then(q=>{switch(q.getType()){case We:Ze(g,q.jb());const r=q.j;k=r.topic;q.ack().catch(()=>olympe.
|
|
561
|
-
p()});break;case Ue:h.error(Xe(q));break;default:h.error('Unsupported response type for a SUBSCRIBE request')}}).catch(q=>h.error(q));return p})).pipe(sb(olympe.error.Ph,(h,k)=>{olympe.
|
|
549
|
+
olympe.L.uc=class{constructor(a,b,c,d,e,f){this.G=a;this.D=b;this.H=d;this.storage=e;this.state=olympe.C.bc(Number).update(olympe.L.uc.j.INIT);this.j=f.get('offlineEnabled');this.N=f.get('offlineAutoBackOnline');this.F=f.get('storagePrefix');Ke(this,f)}qf(){const a=olympe.L.uc.j.cj,b=olympe.L.uc.j.Ef,c=olympe.L.uc.j.zc;let d=olympe.C.da.j;return olympe.C.sa([this.state],e=>{if(e===a)d=olympe.C.da.D;else if(e===b||e===c)d=olympe.C.da.j;return d},olympe.C.da)}getState(){return this.state.tb()}connect(){const a=
|
|
550
|
+
this;return u(function*(){const b=olympe.L.uc.j.cj,c=olympe.L.uc.j.Pm;olympe.C.Qa(a.state)!==b&&(a.state.update(c),a.storage.delete(a.F+'olympe_manual_offline'),yield a.D.connect(),yield Me(),a.state.update(b))})}disconnect(){const a=this;return u(function*(){const b=olympe.L.uc.j.Ef,c=olympe.L.uc.j.Pm;if(!a.j)throw Error('Try to go offline manually while the process does not support it. Please add `offline.enabled=true` in the config');a.storage.set(a.F+'olympe_manual_offline','true');olympe.C.Qa(a.state)!==
|
|
551
|
+
b&&(a.state.update(c),yield olympe.L.ih().disconnect(),yield a.D.disconnect())})}};olympe.L.uc.j={INIT:0,Pm:1,cj:2,Ef:3,zc:4,xw:5};olympe.L.uc.D='olympe_manual_offline';olympe.L.cc=class{constructor(){this.R=this.X=null}fa(a){a=this.D(a);this.X=null;return a}N(a){a=this.j(a);this.R=null;return a}D(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===typeof a:case 'boolean'===typeof a:case 'number'===typeof a:return a;case a instanceof olympe.C.eb:return this.format(olympe.L.cc.j.Zl,a.valueOf().toISOString());case a instanceof Date:return this.format(olympe.L.cc.j.Zl,a.toISOString());case a instanceof olympe.C.Color:return this.format(olympe.L.cc.j.COLOR,
|
|
552
|
+
a.toJSON());case a instanceof Map:return a=Object.fromEntries(Array.from(a).map(([c,d])=>[c,this.D(d)])),this.format(olympe.L.cc.j.yq,a);case a instanceof Set:return a=Array.from(a).map(this.D.bind(this)),this.format(olympe.L.cc.j.Yg,a);case Array.isArray(a):return a.map(this.D.bind(this));case a instanceof ArrayBuffer:return a=olympe.U.jf().j(new Uint8Array(a)),this.format(olympe.L.cc.j.ARRAY_BUFFER,a);case a instanceof Uint8Array:return a=olympe.U.jf().j(a),this.format(olympe.L.cc.j.$h,a);case Symbol.asyncIterator in
|
|
553
|
+
a:if(!this.X)throw Error('No stream handler has been set, so cannot serialize the asyncIterable.');let b;return this.format(olympe.L.cc.j.je,null==(b=this.X)?void 0:b.call(this,a));case 'object'===typeof a:return a=Object.entries(a).reduce((c,[d,e])=>{c[d]=this.D(e);return c},{}),this.format(olympe.L.cc.j.Rq,a);default:throw Error(`Impossible to serialize the following value: ${a}`);}}j(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===typeof a:case 'boolean'===typeof a:case 'number'===
|
|
554
|
+
typeof a:return a}if(Array.isArray(a))return a.map(d=>this.j(d));if('object'!==typeof a)throw new olympe.error.lp(`Impossible to deserialize the following value: ${a}`);const {t:b,v:c}=a;switch(b){case olympe.L.cc.j.Zl:return new Date(c);case olympe.L.cc.j.COLOR:return olympe.C.Color.Pb(c);case olympe.L.cc.j.yq:return new Map(Object.entries(c).map(([e,f])=>[e,this.j(f)]));case olympe.L.cc.j.Yg:return new Set(c.map(e=>this.j(e)));case olympe.L.cc.j.ARRAY_BUFFER:return olympe.U.jf().D(c).buffer;case olympe.L.cc.j.$h:return olympe.U.jf().D(c);
|
|
555
|
+
case olympe.L.cc.j.je:if(!this.R)throw Error('No stream handler has been set, so cannot deserialize the stream.');let d;return null==(d=this.R)?void 0:d.call(this,c);case olympe.L.cc.j.Rq:return Object.entries(c).reduce((e,[f,g])=>{e[f]=this.j(g);return e},{});default:throw new olympe.error.lp(`Impossible to deserialize the following value: ${c}`);}}format(a,b){return{t:a,v:b}}};olympe.L.cc.j={Zl:1,COLOR:2,yq:3,Yg:4,ARRAY_BUFFER:5,$h:6,je:7,Rq:8};const Ne=olympe.L.va.j.SEND,Oe=olympe.L.va.j.GET,Pe=olympe.L.va.j.PUBLISH,Qe=olympe.L.va.j.SUBSCRIBE,Re=olympe.L.va.j.ig,Se=olympe.L.va.j.gs,Te=olympe.L.va.j.Jr,Ue=olympe.L.va.j.Ab,Ve=olympe.L.va.j.ns,We=olympe.L.va.j.ng;function Gd(a,b){a.j||(a.j=gb(new olympe.U.fn(a.D.Pf+3E4),c=>{let d;null==(d=a.H)||d.call(a,c)}));a.j.add(b)}
|
|
556
|
+
function Xe(a){let b,c;const d=null!=(c=null==(b=a.j)?void 0:b.code)?c:olympe.error.lc.Wk;let e,f;a=null!=(f=null==(e=a.j)?void 0:e.reason)?f:'Unknown Error';return d===olympe.error.lc.TIMEOUT?new olympe.error.Vk(a):new olympe.error.pd(a,d)}function Ye(a,b){const c=olympe.L.va.j.ng,d=olympe.L.va.j.cs;return b.getType()!==c?Promise.reject('Should only call `topicAck` on TOPIC responses'):a.send(b.j.seq,b.jb(),b.jb(),d)}
|
|
557
|
+
olympe.L.qb=class{constructor(a,b){this.D=olympe.L.ih();this.F=a;this.H=this.j=null;this.N=new olympe.C.Xb(`Service ${a}`,'function'===typeof b.Cb?b.Cb():b);this.G=olympe.ga.Wa(`Service ${this.F}`)}yt(a){this.H=a;return this}stop(){this.N.destroy()}clear(){Vd(this.D,this.F).catch(b=>this.G.error('Failed to unsubscribe from '+this.F+', error: '+b));if(this.H){let b;null==(b=this.j)||b.forEach(c=>{let d;return null==(d=this.H)?void 0:d.call(this,c)})}let a;null==(a=this.j)||a.clear()}static ld(a,b){return u(function*(){yield olympe.L.ih().request(a,
|
|
558
|
+
a,Pe,b,!1)})}static $s(a){const b=olympe.L.ih(),c=new olympe.L.Ek(a,b);ce(b,a).then(d=>Ze(c,d)).catch(d=>olympe.ga.Wa('Publisher for service '+a).error('Failed to get session id for publisher',d));return c}static send(a,b,c={}){return olympe.L.ih().request(a,a,Ne,b,!0,c.timeout).then(d=>{switch(d.getType()){case Te:break;case Ue:throw Xe(d);default:throw Error('Unsupported response type for a SEND request');}})}static get(a,b,c={}){return olympe.L.ih().request(a,a,Oe,b,!0,c.timeout).then(d=>{switch(d.getType()){case Ve:d=
|
|
559
|
+
d.j;if(null!==d)return d;throw Error('No payload after request to service: '+a);case Ue:throw Xe(d);default:throw Error('Unsupported response type for a GET request');}})}static observe(a,b,c,d={}){const e='function'===typeof b.Cb?b.Cb():b,f=olympe.L.ih(),g=new olympe.L.Ek(a,f);return{observable:(new rxjs.Observable(h=>{let k=null,l=null,n=null;const p=()=>{h.complete();l&&n&&(he(f,a,n,l),l=n=null);k&&(Vd(f,k).catch(q=>olympe.ga.Wa('Service '+a).error('Failed to unsubscribe from a topic '+q)),k=null)};
|
|
560
|
+
e.Xd(p);f.request(a,a,Qe,c,!0,d.timeout).then(q=>{switch(q.getType()){case We:Ze(g,q.jb());const r=q.j;k=r.topic;q.ack().catch(()=>olympe.ga.Wa('Service '+a).error('Failed to ack the msg'));Wd(f,k,t=>{t.getType()===Pe?h.next(t.j):(h.error('Unsupported notification message. It should be a publish'),p())}).then(()=>{l=r.id;n=q.jb();ge(f,a,n,l,r.refresh,t=>h.error(t));Ye(f,q).catch(t=>{h.error(`Was unable to ack the subscription: ${t}`);p()})}).catch(t=>{h.error(`Was not able to subscribe to notification topic ${k}: ${t}`);
|
|
561
|
+
p()});break;case Ue:h.error(Xe(q));break;default:h.error('Unsupported response type for a SUBSCRIBE request')}}).catch(q=>h.error(q));return p})).pipe(sb(olympe.error.Ph,(h,k)=>{olympe.ga.Wa(`Service ${a}`).debug(`Subscribed to topic ${h.T()} now that we are back online, after waiting for ${k}ms`);let l;null==(l=d.onRetry)||l.call(d)})),publisher:g}}listen(){return new rxjs.Observable(a=>{const b=()=>{a.complete();this.clear()};this.N.onDestroy(b);Wd(this.D,this.F,this.R.bind(this,a),!1).catch(c=>
|
|
562
562
|
{c='Failed to connect to the bus: '+c;this.G.error(c);a.error(Error(c))});return b})}xi(a){const b=this;return u(function*(){yield b.D.request(b.F,b.F,Pe,a,!1,b.D.Hc)})}R(a,b){var c=new olympe.L.Fc(b,this.D,this);switch(b.getType()){case Re:var d=c.body().filter(f=>{let g;return!(null==(g=this.j)?0:fb(g,f))});c.cd(d).catch(f=>this.G.error('Not able to validate subscription keep alive',f));break;case Se:c=c.body();null==(d=this.j)||d.delete(c);let e;null==(e=this.H)||e.call(this,c);break;default:a.next(c)}}};
|
|
563
|
-
olympe.L.qb.prototype.multicast=olympe.L.qb.prototype.xi;olympe.L.qb.prototype.listen=olympe.L.qb.prototype.listen;olympe.L.qb.observe=olympe.L.qb.observe;olympe.L.qb.get=olympe.L.qb.get;olympe.L.qb.send=olympe.L.qb.send;olympe.L.qb.getPublisher=olympe.L.qb
|
|
564
|
-
this.size)throw Error('The stream has already been completed');if(a<this.j+this.buffer.length)throw Error(`The stream has already reached element n\u00b0${this.j+this.buffer.length}, specified index must be greater or equal to it.`);this.size=a;this.j===this.size&&(this.D(),this.stream.complete())}throw(a){this.D();this.stream.throw(a)}};function Ze(a,b){a.j=b;a.D.forEach(c=>c());a.D=[];return a}olympe.L.
|
|
563
|
+
olympe.L.qb.prototype.multicast=olympe.L.qb.prototype.xi;olympe.L.qb.prototype.listen=olympe.L.qb.prototype.listen;olympe.L.qb.observe=olympe.L.qb.observe;olympe.L.qb.get=olympe.L.qb.get;olympe.L.qb.send=olympe.L.qb.send;olympe.L.qb.getPublisher=olympe.L.qb.$s;olympe.L.qb.publish=olympe.L.qb.ld;olympe.L.qb.prototype.stop=olympe.L.qb.prototype.stop;olympe.L.qb.prototype.setUnsubscriptionHandler=olympe.L.qb.prototype.yt;olympe.L.ar=class{constructor(a){this.j=0;this.buffer=[];this.size=null;this.stream=new olympe.U.stream.mg;this.D=null!=a?a:()=>{}}write(a,b){const c=this;return u(function*(){if(b<c.j||null!==c.size&&b>=c.size)throw Error(`Received stream chunk with unexpected index = ${b}. That index has already been processed. Next expected once is ${c.j}`);for(c.buffer[b-c.j]=a;void 0!==c.buffer[0];){c.j++;const d=c.buffer.shift();yield c.stream.write(d)}c.j===c.size&&(c.D(),c.stream.complete())})}complete(a){if(null!==
|
|
564
|
+
this.size)throw Error('The stream has already been completed');if(a<this.j+this.buffer.length)throw Error(`The stream has already reached element n\u00b0${this.j+this.buffer.length}, specified index must be greater or equal to it.`);this.size=a;this.j===this.size&&(this.D(),this.stream.complete())}throw(a){this.D();this.stream.throw(a)}};function Ze(a,b){a.j=b;a.D.forEach(c=>c());a.D=[];return a}olympe.L.Ek=class{constructor(a,b){this.F=b;this.D=[];this.H=a;this.j=null}ld(a){const b=this;return u(function*(){b.j||(yield new Promise(c=>{b.D.push(()=>c())}));yield b.F.request(b.j,b.H,olympe.L.va.j.PUBLISH,a,!0)})}};olympe.L.Ek.prototype.publish=olympe.L.Ek.prototype.ld;olympe.L.Fe={Gg:1,bg:2,Ab:3,Ng:4,JA:5,nk:6,oc:7};olympe.L.sk={nk:1,Tw:2,ru:3,ig:5,fw:1,gE:2};olympe.L.Ne={Gg:0,Eh:1,Ab:2};olympe.L.Na.j={INIT:'initialize',CONNECTING:'connecting',zc:'disconnected',gp:'disconnecting',Ae:'connected',Tg:'reconnecting',Zk:'waking',po:'awake',Ab:'error'};olympe.L.Na.F={Qh:1,uu:-1,Ku:-2,Kw:-3};olympe.L.Na.D={ij:0,fq:23};
|
|
565
565
|
olympe.L.Na.oc={0:'OK',1:'SRP Authentication First Step Failed',2:'SRP Authentication Last Step Failed',3:'SRP Authentication Bad Credentials',4:'AutoLogin Authentication Failed',5:'AutoLogin Authentication Token Invalid',6:'Logout Failed',7:'SAML Request Generation Failed',8:'SAML Authentication Save Failed',9:'Invalid SAML Response',10:'SAML User Not Found',11:'Transaction Failed',12:'GetContext Failed',13:'Notification Failed',15:'FileService Clean Failed',17:'Try to subscribe multiple times',
|
|
566
|
-
18:'Try to unsubscribe multiple times',21:'GraphDef Query Failed',22:'Client Request Invalid',23:'Internal Server Error',24:'File Retrieval Error',25:'File Does Not Exists',26:'Restore Failed',27:'Permission Error',14:'Handshake Failed',28:'Client Version Too Old',29:'Client Version Invalid Format',34:'Server overloaded, retry later',35:'Add token error',36:'Keep token alive error',37:'Unknown client message',39:'Fetch data while concurrency transaction'};olympe.L.P={vf:'com.ConnectivityManager',
|
|
567
|
-
olympe.L.Config={
|
|
568
|
-
|
|
569
|
-
olympe.V.config(function(a){const b=olympe.host.Wg.Th;E(a,olympe.L.Config.
|
|
570
|
-
var x=['localhost','127.0.0.1'],y=f.endsWith(v),z=y&&e?`${f}-${b}`:f;const A='object'===typeof window;g=null!=g?g:z;n=null!=n?n:!A&&y?z.replace(new RegExp(`${v}.*`),'rabbitmq'):z;z=(v=x.includes(g))||y;y=(x=x.includes(n))||y;f=x?'/':f.split('.')[0];return{
|
|
571
|
-
E(a,olympe.L.Config.
|
|
572
|
-
D(a,olympe.L.P.Da,[olympe.
|
|
573
|
-
f)return null;const l=f.replace(/\/+/g,'/').replace(/\/$/,'');return new olympe.net.oj(g,h,l,k)})).pipe(rxjs.operators.shareReplay(1)));const d=Array.from(Object.values(olympe.L.Yb));D(a,olympe.L.P.
|
|
574
|
-
C(a,olympe.L.P.
|
|
575
|
-
h));return g});C(a,olympe.L.P.
|
|
576
|
-
new olympe.V.oa(olympe.L.Config.
|
|
577
|
-
h],['subscriptionsRefreshRate',k]])});C(a,olympe.L.P.
|
|
578
|
-
'olympe.communication');olympe.V.run([olympe.L.P.
|
|
579
|
-
function af(a,b,c){const d=null==b?void 0:b.Df();if(b instanceof olympe.auth.
|
|
580
|
-
olympe.L.
|
|
581
|
-
function df(a,b,c){if(b.Mg()!==olympe.auth.Ec.j.OAUTH2)c(Error('Only oAuth2 tokens can be refreshed'),null);else{var d=`?idpName=${b.Df()}&access_token=${bf(b)}`;d=`${se(a.Lh,olympe.L.Yb.
|
|
582
|
-
olympe.auth.ud=class{constructor(a,b,c,d,e,f){this.G=a;this.j=b;this.Lh=c;this.H=d;this.D=e;this.F=f;ef(this.F).then(g=>{g&&this.F.db.remove('main','redirectTo').then(()=>{this.D.redirect(g,null,olympe.auth.
|
|
583
|
-
a=N(`${d}/${a}`);ue(this.Lh,a,b).then(e=>c(null,e.getData())).catch(e=>c(Error(e)))}};olympe.auth.ud.j={Ng:1,
|
|
584
|
-
function Me(){var a=olympe.auth.
|
|
585
|
-
function jf(a){a.G.log('Initializing AUTH layer');let b=a.
|
|
566
|
+
18:'Try to unsubscribe multiple times',21:'GraphDef Query Failed',22:'Client Request Invalid',23:'Internal Server Error',24:'File Retrieval Error',25:'File Does Not Exists',26:'Restore Failed',27:'Permission Error',14:'Handshake Failed',28:'Client Version Too Old',29:'Client Version Invalid Format',34:'Server overloaded, retry later',35:'Add token error',36:'Keep token alive error',37:'Unknown client message',39:'Fetch data while concurrency transaction'};olympe.L.P={vf:'com.ConnectivityManager',Nk:'com.ServerManager',Co:'com.BusManager',pm:'com.HttpManager',Me:'com.Serializer',Da:'com.Logger',Zg:'com.Source',hs:'com.Urls',EC:'com.peerFileSvcUrl'};
|
|
567
|
+
olympe.L.Config={am:'defaultHost',Yt:'com.computedHost',pw:'server.host',rw:'server.port',sw:'server.ssl',Kr:'server.basePath',ss:'server.wsPath',Vm:'server.reconnectionDelay',cr:'server.pingInterval',rs:'server.messageTimeout',xr:'server.retryHttpOnOverload',Rl:'server.clientVersion',Nr:'server.serverVersion',tw:'server.wakeUpService',Rt:'bus.host',St:'bus.path',Tt:'bus.port',Vt:'bus.vhost',Ut:'bus.ssl',Go:'bus.requestTimeout',Ho:'bus.subscriptionRefreshRate',Fo:'bus.reconnectionDelay',Bo:'bus.heartbeat',
|
|
568
|
+
Do:'bus.queueExpiration',Eo:'bus.queuePrefetch',Ll:'bus.allowGuest',ds:'bus.topicPrefix'};
|
|
569
|
+
olympe.V.config(function(a){const b=olympe.host.Wg.Th;E(a,olympe.L.Config.am,a.getParameter(olympe.host.Config.Qp));E(a,olympe.L.Config.Kr,'OlympeServer');E(a,olympe.L.Config.ds,'');Ya(a,'com.hostConfig',[olympe.host.Config.Jk,olympe.L.Config.am,olympe.L.Config.pw,olympe.L.Config.rw,olympe.L.Config.sw,olympe.L.Config.Kr,olympe.L.Config.Rt,olympe.L.Config.Vt,olympe.L.Config.Tt,olympe.L.Config.St,olympe.L.Config.Ut],(e,f,g,h,k,l,n,p,q,r,t)=>{var v=a.getParameter(olympe.net.Config.Bm);e=e===olympe.host.Wg.Th;
|
|
570
|
+
var x=['localhost','127.0.0.1'],y=f.endsWith(v),z=y&&e?`${f}-${b}`:f;const A='object'===typeof window;g=null!=g?g:z;n=null!=n?n:!A&&y?z.replace(new RegExp(`${v}.*`),'rabbitmq'):z;z=(v=x.includes(g))||y;y=(x=x.includes(n))||y;f=x?'/':f.split('.')[0];return{yl:g,$n:null!=h?h:v?8080:z?e?85:80:443,zl:null!=k?k:!z,ut:l,wx:n,Ax:null!=p?p:f,yx:null!=q?q:A?x?15670:y?e?85:80:443:y?5672:5671,xx:null!=r?r:!x&&A?'/amqp/ws':'',zx:null!=t?t:!y}});E(a,olympe.L.Config.ss,'websocket');E(a,olympe.L.Config.Vm,5E3);
|
|
571
|
+
E(a,olympe.L.Config.cr,5E3);E(a,olympe.L.Config.rs,3E4);E(a,olympe.L.Config.xr,4E3);E(a,olympe.L.Config.Nr,'7.5.3');E(a,olympe.L.Config.Go,6E4);E(a,olympe.L.Config.Ho,3E4);E(a,olympe.L.Config.Ll,!1);E(a,olympe.L.Config.Fo,a.getParameter(olympe.L.Config.Vm));E(a,olympe.L.Config.Bo,15);E(a,olympe.L.Config.Do,3E5);E(a,olympe.L.Config.Eo,20);const c=a.getParameter(olympe.xg.Config.yp);if(void 0!==c)a.setParameter(olympe.L.Config.Rl,c);else throw Error('Framework version could not be found! Is field "olympe-framework" present in version.json?');
|
|
572
|
+
D(a,olympe.L.P.Da,[olympe.ga.P.Fa],e=>e.ad('communication'));D(a,'server.WebSocketRequest',[new olympe.V.Dh('com.hostConfig'),new olympe.V.oa(olympe.L.Config.ss)],(e,f)=>e.pipe(rxjs.operators.map(({yl:g,$n:h,zl:k,ut:l})=>new olympe.net.oj(g,h,(l+'/'+f).replace(/\/+/g,'/').replace(/\/$/,''),k))).pipe(rxjs.operators.shareReplay(1)));D(a,'server.wakeUpRequest',[new olympe.V.Dh('com.hostConfig'),new olympe.V.oa(olympe.L.Config.tw)],(e,f)=>e.pipe(rxjs.operators.map(({yl:g,$n:h,zl:k})=>{if(null===f||void 0===
|
|
573
|
+
f)return null;const l=f.replace(/\/+/g,'/').replace(/\/$/,'');return new olympe.net.oj(g,h,l,k)})).pipe(rxjs.operators.shareReplay(1)));const d=Array.from(Object.values(olympe.L.Yb));D(a,olympe.L.P.hs,[new olympe.V.Dh('com.hostConfig'),...d.map(e=>new olympe.V.oa(e))],(e,...f)=>e.pipe(rxjs.operators.map(({yl:g,$n:h,zl:k,ut:l})=>{const n=d.map((p,q)=>{q=f[q];q=(new olympe.net.Si(g,h,`${l}${q?'/'+q:''}`.replace(/\/+/g,'/').replace(/\/$/,''),k)).j();return[p,q]});return new Map(n)})).pipe(rxjs.operators.shareReplay(1)));
|
|
574
|
+
C(a,olympe.L.P.Me,olympe.L.cc);C(a,olympe.L.P.pm,olympe.L.zu,olympe.L.P.Da,olympe.net.P.Fa,olympe.U.P.jg,olympe.L.P.hs,new olympe.V.oa(olympe.L.Config.xr));D(a,'com.server.ManagerConfig',[new olympe.V.oa(olympe.L.Config.cr),new olympe.V.oa(olympe.L.Config.rs),new olympe.V.oa(olympe.L.Config.Rl),new olympe.V.oa(olympe.L.Config.Nr),new olympe.V.oa(olympe.dc.Config.Yh)],(...e)=>{const f=['pingInterval','messageTimeout','clientVersion','serverVersion','getContextMode'],g=new Map;e.forEach((h,k)=>g.set(f[k],
|
|
575
|
+
h));return g});C(a,olympe.L.P.Nk,olympe.L.Na,olympe.L.P.Da,olympe.net.P.Fa,olympe.host.P.He,olympe.host.P.Qk,'server.WebSocketRequest','server.wakeUpRequest',olympe.U.P.jg,'com.server.ManagerConfig');Ya(a,olympe.L.Config.Yt,['com.hostConfig'],e=>`${e.zl?'https':'http'}://${e.yl}`);Ya(a,'com.bus.TopicPrefix',[olympe.host.Config.Jk,olympe.L.Config.ds],(e,f)=>{const g=0<f.length;return e===olympe.host.Wg.Th?g?`${b}-${f}`:b:g?f:''});D(a,'com.bus.ManagerConfig',[new olympe.V.Dh('com.hostConfig'),new olympe.V.Dh('com.bus.TopicPrefix'),
|
|
576
|
+
new olympe.V.oa(olympe.L.Config.Ll),new olympe.V.oa(olympe.L.Config.Go),new olympe.V.oa(olympe.L.Config.Ho),new olympe.V.oa(olympe.L.Config.Fo),new olympe.V.oa(olympe.L.Config.Do),new olympe.V.oa(olympe.L.Config.Eo),new olympe.V.oa(olympe.L.Config.Bo)],(e,f,g,h,k,l,n,p,q)=>{e=e.pipe(rxjs.operators.map(({wx:r,xx:t,yx:v,Ax:x,zx:y})=>({host:r,xh:y,port:v,path:t,tA:x,pt:l,Yz:n,Zz:p,xz:h+3E4,fz:q})),rxjs.operators.shareReplay(1));return new Map([['connection',e],['topicPrefix',f],['allowGuest',g],['requestTimeout',
|
|
577
|
+
h],['subscriptionsRefreshRate',k]])});C(a,olympe.L.P.Co,olympe.L.Ol,olympe.net.P.Fa,olympe.L.P.vf,olympe.auth.P.Fa,olympe.host.P.He,olympe.L.P.Me,olympe.U.P.jg,'com.bus.ManagerConfig');D(a,'com.connectivity.ManagerConfig',[olympe.net.P.Jm,olympe.Db.P.$g,new olympe.V.oa(olympe.L.Config.Vm)],(e,...f)=>['storagePrefix','reconnectionDelay'].reduce((g,h,k)=>g.set(h,f[k]),e));C(a,olympe.L.P.vf,olympe.L.uc,olympe.L.P.Da,olympe.L.P.Nk,olympe.net.P.Fa,olympe.host.P.He,olympe.Db.P.Cm,'com.connectivity.ManagerConfig')},
|
|
578
|
+
'olympe.communication');olympe.V.run([olympe.L.P.Co,olympe.L.P.vf],(a,b)=>{olympe.L.ih=()=>a;olympe.L.En=()=>b});olympe.auth={};function $e(a,b){Ge(a.j);ye(a.j,olympe.L.Fe.Ng,c=>{const d=c.c;d===olympe.auth.ud.j.wv?(a.j.ke(),b(olympe.auth.Ta.D.Rj,c)):d===olympe.auth.ud.j.nw&&b(olympe.auth.Ta.D.Wp,c)},'logoutHandler')}
|
|
579
|
+
function af(a,b,c){const d=null==b?void 0:b.Df();if(b instanceof olympe.auth.zk){const e=g=>{const h=Object.create(null);h.url=g;h.olympe_token=b.Gd();h.access_token=bf(b);g=`${se(a.Lh,olympe.L.Yb.wk)}/logout${d?`?idpName=${d}`:''}`;a.D.redirect(g,h)};c=a.D.j();const f=new URL(c);0!==f.hash.length||0!==f.search.length?(f.hash='',f.search='',a.F.db.set('main',c,'redirectTo').then(()=>{e(f.toString())}).catch(g=>{a.G.error(`Error when trying to set the redirectKey in Auth store: ${g}`)})):e(c)}else De(a.j,
|
|
580
|
+
olympe.L.Fe.Ng,Object.assign({},{c:olympe.auth.ud.j.xv},d&&{idpName:d}),c)}function cf(a,b,c,d){olympe.C.Qa(a.H.getState())===olympe.L.uc.j.Ef?d(new olympe.error.Zq,'Working offline'):(c.c=b,De(a.j,olympe.L.Fe.Ng,c,d))}
|
|
581
|
+
function df(a,b,c){if(b.Mg()!==olympe.auth.Ec.j.OAUTH2)c(Error('Only oAuth2 tokens can be refreshed'),null);else{var d=`?idpName=${b.Df()}&access_token=${bf(b)}`;d=`${se(a.Lh,olympe.L.Yb.wk)}/refresh${d}`;d=Hc(N(d),olympe.net.ua.ResponseType.JSON);ue(a.Lh,d,b.Gd()).then(e=>{(e=e.getData())?(e=new olympe.auth.zk(b.xc(),b.ue(),b.Gd(),e,b.Df()),c(null,e)):c(null,b)}).catch(e=>c(Error(e),null))}}
|
|
582
|
+
olympe.auth.ud=class{constructor(a,b,c,d,e,f){this.G=a;this.j=b;this.Lh=c;this.H=d;this.D=e;this.F=f;ef(this.F).then(g=>{g&&this.F.db.remove('main','redirectTo').then(()=>{this.D.redirect(g,null,olympe.auth.Lk.j.GET)}).catch(h=>{this.G.error(`Error when trying to remove redirect key from AUTH storage: ${h}`)})}).catch(g=>{this.G.error(`Error when trying to get redirect key from AUTH storage: ${g}`)})}rf(a){De(this.j,olympe.L.Fe.Ng,{c:olympe.auth.ud.j.ig},b=>a(b))}qh(a,b,c){const d=se(this.Lh,olympe.L.Yb.ks);
|
|
583
|
+
a=N(`${d}/${a}`);ue(this.Lh,a,b).then(e=>c(null,e.getData())).catch(e=>c(Error(e)))}};olympe.auth.ud.j={Ng:1,xv:2,Ab:3,ig:5,ij:6,Du:10,Bw:11,Gt:12,SAML:13,nw:14,wv:20};function ie(a,b){var c='busLogoutCallback';void 0===c&&(c=olympe.U.ni());a.R.set(c,b)}function ee(a){return olympe.C.Qa(a.dd.tb())}
|
|
584
|
+
function Me(){var a=olympe.auth.re();const b=olympe.auth.Ta.j.Sj,c=olympe.auth.Ta.j.INIT;ff(a,b);a.ia?(a.j=olympe.auth.Ta.F.Ft,a.G.log('Connector online, parameter auth.autoLogin=true --\x3e attempting to log with parameters'),gf(a)):(a.j=olympe.auth.Ta.F.If,a.G.log('Connector online, attempting to log with token'),hf(a));return rxjs.firstValueFrom(a.state.tb().asObservable().pipe(rxjs.operators.filter(d=>!(d===b||d===c)))).catch(()=>{})}
|
|
585
|
+
function jf(a){a.G.log('Initializing AUTH layer');let b=a.Ub;if('object'===typeof location){const c=location.hash;let d=c.indexOf('authToken=');-1<d&&(b=c.substring(d+10),'&'===c[d-1]&&d--,location.hash=c.substring(0,d))}b&&a.storage&&kf(a.storage,b).catch(c=>a.G.error(c));a.G.debug('Asking to be notified when auth connector gets online');olympe.C.Wc([a.wa.getState()],c=>{switch(c){case olympe.L.uc.j.Ef:a.j=olympe.auth.Ta.F.If;a.G.log('Connector offline, attempting to recover sessions from current token');
|
|
586
586
|
hf(a);break;case olympe.L.uc.j.zc:switch(olympe.C.Qa(a.state)){case olympe.auth.Ta.j.sf:c=olympe.C.Qa(a.dd).xc();lf(a,`Disconnected from server - session of user ${c} lost`);break;case olympe.auth.Ta.j.Pi:a.G.info('Disconnected from server - guest session lost');break;case olympe.auth.Ta.j.Sj:lf(a,'Disconnected from server - authentication aborted');break;case olympe.auth.Ta.j.INIT:lf(a,'Cannot open auth session - no server connection');break;default:lf(a,'Should not get there, investigate',!0)}}});
|
|
587
|
-
$e(a.D,(c,d)=>{if(c===olympe.auth.Ta.D.Rj){lf(a,'authentication revoked');let e;null==(e=a.storage)||mf(e).catch(f=>a.G.error('Failed to clear token',f));a.R.forEach(f=>{f(c,d)})}else if(c===olympe.auth.Ta.D
|
|
587
|
+
$e(a.D,(c,d)=>{if(c===olympe.auth.Ta.D.Rj){lf(a,'authentication revoked');let e;null==(e=a.storage)||mf(e).catch(f=>a.G.error('Failed to clear token',f));a.R.forEach(f=>{f(c,d)})}else if(c===olympe.auth.Ta.D.Wp){a.G.info('Redirection to IDP to invalidate token (SAML)');ee(a);let e;null==(e=a.storage)||mf(e).catch(f=>a.G.error('Failed to clear token',f));a.Ha.D()}else throw Error(`Unknown logout step coming from server : ${c}`);});a.Z=nf(a);a.G.log('DONE initializing AUTH layer (waiting for connector to be online)')}
|
|
588
588
|
function of(a,b){let c=null;olympe.C.Gj(a.state.tb().Jd(olympe.auth.Ta.j.sf).and(b),()=>{const d=ee(a);!pf(a)&&d&&(c=a.Yd.get(d.Mg()).H(d,(e,f)=>{e?(a.G.error('Failed to refresh token, error message: ',e.message),a.Jj().catch(g=>a.G.error(`Failed to logout after wrong refresh ${g}`))):f&&qf(a,f)}))},()=>{let d;null==(d=c)||d()})}
|
|
589
|
-
function hf(a){null!==a.storage?(a.G.debug('Retrieving token from local storage'),a.storage.
|
|
590
|
-
!0)}function lf(a,b,c=!1){a.dd.update(a.N);ff(a,olympe.auth.Ta.j.Pi);b=`Authenticated as guest (${b})`;c?a.G.error(b):a.G.info(b)}function nf(a){const b=[olympe.auth.Ta.j.sf];a.ia||b.push(olympe.auth.Ta.j.Pi);return a.
|
|
589
|
+
function hf(a){null!==a.storage?(a.G.debug('Retrieving token from local storage'),a.storage.te().then(b=>{if(b){const e=new olympe.auth.Request;var c=b.xc();e.set('username',c);c=e;var d=b.Gd();c.set('nonce',d);'string'===typeof b.Df()&&e.set('idpName',b.Df());a.G.debug('Token found, trying login with',e);rf(a,e,olympe.auth.Ec.j.Km)}else lf(a,'No token found, cannot perform auto login')}).catch(b=>{lf(a,b.message,!0)})):lf(a,'Cannot retrieve token: no storage configured, cannot perform auto login',
|
|
590
|
+
!0)}function lf(a,b,c=!1){a.dd.update(a.N);ff(a,olympe.auth.Ta.j.Pi);b=`Authenticated as guest (${b})`;c?a.G.error(b):a.G.info(b)}function nf(a){const b=[olympe.auth.Ta.j.sf];a.ia||b.push(olympe.auth.Ta.j.Pi);return a.ba.j(()=>{const c=sf(a);return b.includes(c)?Promise.resolve('The auth manager is OK'):Promise.reject(`The auth manager is not in valid state, the current state is: ${c}`)})}function ff(a,b){a.G.log('State change: ',sf(a),'--\x3e',b);a.state.update(b)}
|
|
591
591
|
function gf(a){if(a.H){const b=new olympe.auth.Request;b.set('username',a.H);b.set('password',a.Ua);a.G.log('Autologin with user "'+a.H+'"');rf(a,b)}else lf(a,'No user specified for auto login',!0)}function pf(a){return olympe.C.Qa(a.dd)===a.N}function qf(a,b){if(b){a.dd.update(b);let c;null==(c=a.storage)||kf(c,b).catch(d=>a.G.error(d));a.G.debug('Token updated')}}function sf(a){return olympe.C.Qa(a.state.tb())}function tf(){var a=olympe.public.Ma.get();return new Map(a.D.j.Fd)}
|
|
592
|
-
function uf(a,b,c,d=!1){b=b+c?':'+c.message:'';a.G.error(b);a.error.update(olympe.C.xb(b));ff(a,olympe.auth.Ta.j.Ab);if(d)throw Error(b);}function rf(a,b,c,d){void 0===c&&(c=a.lb);void 0===c&&uf(a,'No authentication provider specified',null,!0);const e=a.Yd.get(c);e||uf(a,'Undefined authentication provider "'+c+'"',null,!0);d&&a.F.set('login',d);a.G.log('Sending authentication request using "'+c+'" for '+b);e.
|
|
592
|
+
function uf(a,b,c,d=!1){b=b+c?':'+c.message:'';a.G.error(b);a.error.update(olympe.C.xb(b));ff(a,olympe.auth.Ta.j.Ab);if(d)throw Error(b);}function rf(a,b,c,d){void 0===c&&(c=a.lb);void 0===c&&uf(a,'No authentication provider specified',null,!0);const e=a.Yd.get(c);e||uf(a,'Undefined authentication provider "'+c+'"',null,!0);d&&a.F.set('login',d);a.G.log('Sending authentication request using "'+c+'" for '+b);e.te(b,a.vb.bind(a));ff(a,olympe.auth.Ta.j.Sj)}
|
|
593
593
|
function vf(a,b,c){a.F.forEach(d=>{d(b,c)})}
|
|
594
|
-
olympe.auth.Ta=class{constructor(a,b,c,d,e,f,g,h,k){this.G=a;this.wa=b;this.D=c;this.storage=d;this.
|
|
595
|
-
this.F=new Map;this.R=new Map;this.X=new olympe.U.Zh(k.get('cacheTokenTimeout'));h.forEach(l=>{const n=l.F();if(this.Yd.has(n))throw Error('Provider "'+n+'" has already been registered !');this.Yd.set(n,l)});jf(this);of(this,g.j())}
|
|
596
|
-
return d.tb()}yg(a){if(olympe.C.Qa(this.state)===olympe.auth.Ta.j.sf){var b=ee(this);!pf(this)&&b&&this.Yd.get(b.Mg()).yg(b,(c,d)=>{c?(this.G.error('Failed to refresh token, error message: ',c.message),this.Jj().catch(e=>this.G.error(`Failed to logout after wrong refresh ${e}`))):d&&qf(this,d);a(c)})}}getState(){return this.state.tb()}xc(){return this.dd.tb().xc()}
|
|
597
|
-
void 0:c.Gd();this.D.qh(a,d,(e,f)=>{'string'===typeof f&&this.X.set(a,f);b(e,f)})}}Jj(){return pf(this)?(this.G.warn('Logout called for Guest user so it will be ignored'),Promise.resolve()):new Promise((a,b)=>{this.G.debug('Sending logout');let c;null==(c=this.storage)||mf(c).catch(d=>this.G.error('Failed to clear token',d));af(this.D,ee(this),d=>{d?(uf(this,'Logout request rejected:',d),b(d)):(this.G.debug('Logout request acknowledged'),a())});this.
|
|
598
|
-
this.D.rf(b=>{b&&this.G.error('Was not able to send the auth keep alive message:',b.message);null==a||a(b)})}vb(a,b){const c=null===this.j?olympe.auth.Ta.F.
|
|
599
|
-
null==(d=this.storage)||mf(d).catch(e=>this.G.error(e));this.error.update(olympe.C.xb(a.message));lf(this,'authentication rejected: '+a.message);vf(this,a,c)}this.F.has('login')&&this.F.delete('login')}};olympe.auth.Ta.j={INIT:'init',Sj:'authenticating',Pi:'guest',sf:'authenticated',Ab:'error'};olympe.auth.Ta.F={
|
|
600
|
-
m.
|
|
601
|
-
olympe.auth.
|
|
602
|
-
d.parse;var f=bb(olympe.U.
|
|
603
|
-
olympe.auth.Yd.
|
|
604
|
-
olympe.auth.Yd.
|
|
605
|
-
function Cf(a,b,c){const d=olympe.auth.ud.j.
|
|
606
|
-
null)}})}olympe.auth.Yd.SRP=class extends olympe.auth.Ec{F(){return olympe.auth.Ec.j.SRP}
|
|
607
|
-
olympe.V.config(function(a){E(a,olympe.auth.Config.
|
|
608
|
-
olympe.L.P.
|
|
609
|
-
new olympe.V.oa(olympe.auth.Config.
|
|
610
|
-
r]]))},!0)},'olympe.auth');olympe.V.run([olympe.auth.P.Fa],a=>{olympe.auth.
|
|
611
|
-
olympe.Xa.node.Db.
|
|
612
|
-
|
|
613
|
-
null==(c=b.j.get(a))||c.clear()})}H(){Df();return Promise.resolve([])}D(){return u(function*(){Df()})}};olympe.Xa.node.Db.
|
|
614
|
-
function Jf(a){var b=Kf;console.debug(`Start watching config files for changes: ${b}`);b.forEach(c=>{Ff.access(c,Ef.constants.F_OK).then(()=>{Ef.watch(c,d=>u(function*(){if('change'===d){console.log(`Config file "${c}" has changed. Loading new configuration...`);try{const e=yield olympe.U.
|
|
615
|
-
function Lf(){console.log('The node process received a signal for graceful shutdown');let a,b,c,d;(null!=(d=null==(b=(a=olympe.Xa.node.host).
|
|
594
|
+
olympe.auth.Ta=class{constructor(a,b,c,d,e,f,g,h,k){this.G=a;this.wa=b;this.D=c;this.storage=d;this.Ha=e;this.lb=k.get('defaultProvider');this.ia=!!k.get('autoLogin');this.H=k.get('autoUser');this.Ua=k.get('autoPassword');this.Ub=k.get('autoToken');this.Yd=new Map;this.ba=f;this.Z='';this.state=olympe.C.bc(String).update(olympe.auth.Ta.j.INIT);this.error=olympe.C.bc(olympe.C.Sa);this.j=null;this.N=new olympe.auth.eh('guest','0163d9653067b6237f62','e96e099c-55bb-4004-b0e8-bd76b6209218');this.dd=olympe.C.bc(olympe.auth.eh).update(this.N);
|
|
595
|
+
this.F=new Map;this.R=new Map;this.X=new olympe.U.Zh(k.get('cacheTokenTimeout'));h.forEach(l=>{const n=l.F();if(this.Yd.has(n))throw Error('Provider "'+n+'" has already been registered !');this.Yd.set(n,l)});jf(this);of(this,g.j())}rl(){const a=olympe.auth.Ta.j.sf,b=olympe.auth.Ta.j.Pi,c=olympe.auth.Ta.j.Ab,d=olympe.C.bc(olympe.C.da);olympe.C.Wc([this.state],e=>{e===a?d.update(olympe.C.da.D):e===b?d.update(olympe.C.da.j):e===c?(this.G.error('Authentication failed.'),d.update(olympe.C.da.j)):d.clear()});
|
|
596
|
+
return d.tb()}yg(a){if(olympe.C.Qa(this.state)===olympe.auth.Ta.j.sf){var b=ee(this);!pf(this)&&b&&this.Yd.get(b.Mg()).yg(b,(c,d)=>{c?(this.G.error('Failed to refresh token, error message: ',c.message),this.Jj().catch(e=>this.G.error(`Failed to logout after wrong refresh ${e}`))):d&&qf(this,d);a(c)})}}getState(){return this.state.tb()}xc(){return this.dd.tb().xc()}ue(){return this.dd.tb().ue()}ri(){return this.dd.tb().ri()}qh(a,b){if(fb(this.X.j,a))b(null,this.X.get(a));else{var c,d=null==(c=olympe.C.Qa(this.dd.tb()))?
|
|
597
|
+
void 0:c.Gd();this.D.qh(a,d,(e,f)=>{'string'===typeof f&&this.X.set(a,f);b(e,f)})}}Jj(){return pf(this)?(this.G.warn('Logout called for Guest user so it will be ignored'),Promise.resolve()):new Promise((a,b)=>{this.G.debug('Sending logout');let c;null==(c=this.storage)||mf(c).catch(d=>this.G.error('Failed to clear token',d));af(this.D,ee(this),d=>{d?(uf(this,'Logout request rejected:',d),b(d)):(this.G.debug('Logout request acknowledged'),a())});this.ba.D(this.Z)})}rf(a){sf(this)===olympe.auth.Ta.j.sf&&
|
|
598
|
+
this.D.rf(b=>{b&&this.G.error('Was not able to send the auth keep alive message:',b.message);null==a||a(b)})}vb(a,b){const c=null===this.j?olympe.auth.Ta.F.Dv:this.j;this.j=null;if(!a||a instanceof olympe.error.Zq){null===a?this.G.info(`User ${b.xc()} (#${b.ue()}) successfully authenticated`):this.G.info(`User ${b.xc()} (#${b.ue()}) recovered from token, while offline`);this.dd.update(b);ff(this,olympe.auth.Ta.j.sf);vf(this,a,c);let d;null==(d=this.storage)||kf(d,b).catch(e=>this.G.error(e))}else{let d;
|
|
599
|
+
null==(d=this.storage)||mf(d).catch(e=>this.G.error(e));this.error.update(olympe.C.xb(a.message));lf(this,'authentication rejected: '+a.message);vf(this,a,c)}this.F.has('login')&&this.F.delete('login')}};olympe.auth.Ta.j={INIT:'init',Sj:'authenticating',Pi:'guest',sf:'authenticated',Ab:'error'};olympe.auth.Ta.F={Dv:'manual',Ft:'auto',If:'tokenOnFirstConnection'};olympe.auth.Ta.D={Rj:'accepted',Wp:'redirect'};olympe.auth.Ec=class{constructor(a,b){this.G=a;this.D=b;this.j=null}F(){}te(){}H(a,b){const c=()=>{this.j=setTimeout(()=>this.D.rf(d=>{d?b(d,null):(b(null,null),c())}),this.D.j.hd)};c();return()=>{this.j&&clearTimeout(this.j);this.j=null}}yg(a,b){this.D.rf(c=>{b(c,null)})}};olympe.auth.Ec.j={SAML:'saml',OAUTH2:'openID',SRP:'srp',Km:'olympeToken'};function wf(a){return a.get('idpName')}olympe.auth.Request=class{constructor(){this.j=new Map}set(a,b){olympe.C.Wc([b],c=>{this.j.set(a.toLocaleLowerCase(),c.toString())})}get(a){(a=this.j.get(a.toLowerCase()))&&a.fh&&(a=a.Ba.Eb);return a?a.valueOf():a}xc(){return this.get('username')}Gd(){return this.get('nonce')}toString(){return this.xc()+(this.Gd()?' with nonce':'')+(this.get('password')?' with password':'')+(wf(this)?` with idp name ${wf(this)}`:'')}};olympe.auth.eh=class{constructor(a,b,c,d={},e=null){this.user=a;this.Bi=b;this.D=c;this.j=e;this.F=d}xc(){return this.user}ue(){return this.Bi}Gd(){return this.D}Vi(){return this.F}ri(){return null}Df(){return this.j}fa(){const a=olympe.U.jf(),b=Object.assign({},{user:this.user,userTag:this.Bi,nonce:this.D},this.j&&{idpName:this.j},{payload:this.F});return olympe.U.zs(ab(a,JSON.stringify(b)))}Mg(){return olympe.auth.Ec.j.SRP}};m=olympe.auth.eh.prototype;m.xc.K=new olympe.C.J(()=>String,[]);
|
|
600
|
+
m.ue.K=new olympe.C.J(()=>String,[]);m.Gd.K=new olympe.C.J(()=>String,[]);m.Vi.K=new olympe.C.J(()=>Object,[]);m.ri.K=new olympe.C.J(()=>String,[]);m.Df.K=new olympe.C.J(()=>String,[]);m.fa.K=new olympe.C.J(()=>String,[]);m.Mg.K=new olympe.C.J(()=>String,[]);function bf(a){return a.Vi().access_token||null}function xf(a){return 1E3*parseInt(a.Vi().access_token_exp||'0',10)}olympe.auth.zk=class extends olympe.auth.eh{constructor(a,b,c,d,e){super(a,b,c,d,e);this.H=Date.now()}ri(){return bf(this)}Mg(){return olympe.auth.Ec.j.OAUTH2}};olympe.auth.Hr=class extends olympe.auth.eh{constructor(a,b,c,d,e,f){super(a,b,c,e,f);this.H=d}ri(){return this.H}Mg(){return olympe.auth.Ec.j.SAML}fa(){const a=olympe.U.jf(),b=Object.assign({},{user:this.xc(),userTag:this.ue(),nonce:this.Gd()},this.Df()&&{idpName:this.Df()},{payload:this.Vi(),fullToken:this.H});return olympe.U.zs(ab(a,JSON.stringify(b)))}};function ef(a){let b;return null!=(b=a.db.get('main','redirectTo'))?b:null}function kf(a,b){return vb(a.D,()=>a.db.set('main','string'===typeof b?b:b.fa(),a.j).catch(c=>{throw Error(`Error when trying to set the token from the auth store: ${c}`);}))}function mf(a){return vb(a.D,()=>a.db.remove('main',a.j).catch(b=>{a.G.error(`Error when trying to remove the token from the auth store: ${b}`)}))}
|
|
601
|
+
olympe.auth.Mt=class{constructor(a,b,c){this.F=a;this.G=b;this.j='OlympeToken-'+c.j;this.D=new olympe.U.promise.Tk;this.db=this.F.D('AUTH')}te(){this.G.debug(`olympe.auth.AuthStorage: retrieve token with key ${this.j}`);return vb(this.D,()=>{const a=this;return u(function*(){let b;try{b=yield a.db.get('main',a.j)}catch(g){throw Error(`Error when trying to get the token from the auth store: ${g}`);}let c=null;if(b)try{a.G.debug('olympe.auth.AuthStorage: Token retrieved successfully');var d=JSON,e=
|
|
602
|
+
d.parse;var f=bb(olympe.U.jf().D(olympe.U.ux(b)));const g=e.call(d,f);let h;g.fullToken?h=new olympe.auth.Hr(g.user,g.userTag,g.nonce,g.fullToken,g.payload,g.idpName):g.payload&&g.payload.id_token?h=new olympe.auth.zk(g.user,g.userTag,g.nonce,g.payload,g.idpName):h=new olympe.auth.eh(g.user,g.userTag,g.nonce,g.payload,g.idpName);c=h}catch(g){throw Error(`Error while unserializing token: ${g}`);}else a.G.debug('olympe.auth.AuthStorage: No token found');return c})})}};olympe.auth.Lk=class{redirect(){}D(){}j(){}};olympe.auth.Lk.j={GET:'GET',Sh:'POST'};olympe.auth.so=class{constructor(a){this.j=a||'default'}};olympe.auth.Yd={};function yf(a,b,c){cf(a.D,olympe.auth.ud.j.Ng,{token:b.Gd()},(d,e)=>{if(null!==d)c(d,null);else switch(e.c){case olympe.auth.ud.j.Ab:c(Error('Invalid token'),null);break;case olympe.auth.ud.j.ij:d=null;if(e=e.payload){const f=e.userName,g=e.userTag,h=e.rndCook,k=e.payload,l=e.protocol;'SAML'===l?d=new olympe.auth.Hr(f,g,h,e.samlToken,k,wf(b)):'openid'===l&&(d=new olympe.auth.zk(f,g,h,k,wf(b)))}c(null,d);break;default:c(Error('Unknown response from server'),null)}})}
|
|
603
|
+
olympe.auth.Yd.Cv=class extends olympe.auth.Ec{constructor(a,b,c){super(a,b);this.storage=c}F(){return olympe.auth.Ec.j.Km}te(a,b){this.storage.te().then(c=>{yf(this,a,(d,e)=>{b(d,null!=e?e:c)})}).catch(c=>{b(c,null)})}};function zf(a,b,c){var d=xf(b);const e=Math.max(d-b.H,0),f=olympe.V.getParameter(olympe.auth.Config.bs);d=Math.max(Math.round(d-e*(1-Math.max(Math.min((f||50)/100,.95),0))-Date.now()),0);if(0<d)return setTimeout(()=>{a.yg(b,c)},d);a.yg(b,c);return null}
|
|
604
|
+
olympe.auth.Yd.Tv=class extends olympe.auth.Ec{constructor(a,b,c,d){super(a,b);this.N=c;this.R=d}F(){return olympe.auth.Ec.j.OAUTH2}te(a){const b=encodeURIComponent(this.N.j());a=wf(a)?`idpName=${wf(a)}&`:'';this.N.redirect(`${this.R}/auth?${a}url=${b}`,null,olympe.auth.Lk.j.GET)}H(a,b){0<xf(a)?this.j=zf(this,a,b):b(null,a);return this.X.bind(this)}yg(a,b){df(this.D,a,(c,d)=>{c?b(c,null):d&&(b(null,d),this.j&&(this.j=zf(this,d,b)))})}X(){this.j&&clearTimeout(this.j);this.j=null}};function Af(a,b){cf(a.D,olympe.auth.ud.j.SAML,{},(c,d)=>{null!==c?b(c):d.url&&d.request?b(null,d.url,d.request.replace(/\s/g,''),d.id):b(Error('Missing parameters from server response'))})}olympe.auth.Yd.SAML=class extends olympe.auth.Ec{constructor(a,b,c){super(a,b);this.N=c}F(){return olympe.auth.Ec.j.SAML}te(a,b){Af(this,c=>{c?b(c,null):this.N.D(wf(a))})}};function Bf(a,b,c){const d=olympe.auth.ud.j.Du,e=olympe.auth.ud.j.Ab,f=olympe.auth.ud.j.Bw,g={I:b.xc()};cf(a.D,d,g,(h,k)=>{if(null!==h)c(h);else switch(k.c){case e:c(Error(`Username '${b.xc()}' invalid, or password does not match`));break;case f:h=k.payload;c(null,h.S,h.B);break;default:c(Error('Unknown response from server'))}})}
|
|
605
|
+
function Cf(a,b,c){const d=olympe.auth.ud.j.Gt,e=olympe.auth.ud.j.Ab,f=olympe.auth.ud.j.ij;b={A:b.get('a'),M:b.get('m1'),I:b.xc()};cf(a.D,d,b,(g,h)=>{if(null!==g)c(g,null);else switch(h.c){case e:a.G.debug('Login failed, invalid username or password');c(Error('Invalid username or password'),null);break;case f:g=h.payload;a.G.debug('Login successful, creating token');h=g.payload?JSON.parse(g.payload):void 0;c(null,new olympe.auth.eh(g.userName,g.userTag,g.rndCook,h));break;default:c(Error(`Unknown response from server (type ${h.c})`),
|
|
606
|
+
null)}})}olympe.auth.Yd.SRP=class extends olympe.auth.Ec{F(){return olympe.auth.Ec.j.SRP}te(a,b){const c=a.get('password');a.j.delete('password');this.G.debug('Sending SRP request');Bf(this,a,(d,e,f)=>{this.G.debug('Received Salt+B message');if(d)b(d,null);else{try{const g=new SRPClient;g.step1(a.xc(),c);const h=g.step2(e,f);a.set('a',h.A);a.set('m1',h.M1)}catch(g){b(g,null);return}this.G.debug('Sending SRP A+M (proof) message');Cf(this,a,b)}})}};olympe.auth.P={Fa:'auth.Manager',Da:'auth.Logger',hj:'auth.Storage',Fl:'auth.appNameToken',Hk:'auth.Redirector',Lr:'auth.ServerConnector'};olympe.auth.Config={bm:'auth.defaultProvider',mo:'auth.autoLogin',oo:'auth.autoUser',no:'auth.autoPassword',If:'auth.token',Ko:'auth.cacheTokenTimeout',bs:'auth.tokenDurationPercentage'};
|
|
607
|
+
olympe.V.config(function(a){E(a,olympe.auth.Config.bm,olympe.auth.Ec.j.SRP);E(a,olympe.auth.Config.mo,!1);E(a,olympe.auth.Config.oo,'');E(a,olympe.auth.Config.no,'');E(a,olympe.auth.Config.If,'');E(a,olympe.auth.Config.bs,50);E(a,olympe.auth.Config.Ko,3E5);D(a,olympe.auth.P.Da,[olympe.ga.P.Fa],b=>b.ad('auth'));C(a,olympe.auth.P.Fl,olympe.auth.so,olympe.Db.P.$g);C(a,olympe.auth.P.hj,olympe.auth.Mt,olympe.Db.P.qk,olympe.auth.P.Da,olympe.auth.P.Fl);C(a,olympe.auth.P.Lr,olympe.auth.ud,olympe.auth.P.Da,
|
|
608
|
+
olympe.L.P.Nk,olympe.L.P.pm,olympe.L.P.vf,olympe.auth.P.Hk,olympe.auth.P.hj);Xa(a,olympe.auth.P.Hk);D(a,olympe.auth.P.Fa,[olympe.auth.P.Da,olympe.L.P.vf,olympe.auth.P.Lr,olympe.host.P.He,olympe.host.P.Qk,new olympe.V.qb(olympe.auth.P.hj,olympe.V.Ah.j.Gm),new olympe.V.qb(olympe.auth.P.Hk,olympe.V.Ah.j.Gm),new olympe.V.oa(olympe.auth.Config.bm),new olympe.V.oa(olympe.auth.Config.mo),new olympe.V.oa(olympe.auth.Config.oo),new olympe.V.oa(olympe.auth.Config.no),new olympe.V.oa(olympe.auth.Config.If),
|
|
609
|
+
new olympe.V.oa(olympe.auth.Config.Ko)],(b,c,d,e,f,g,h,k,l,n,p,q,r)=>{const t=[new olympe.auth.Yd.Cv(b,d,g),new olympe.auth.Yd.SRP(b,d),new olympe.auth.Yd.SAML(b,d,h),new olympe.auth.Yd.Tv(b,d,h,se(d.Lh,olympe.L.Yb.wk))];if(!t.map(v=>v.F()).includes(k))throw Error(`Default provider name ${k} given by parameter ${olympe.auth.Config.bm} cannot be found`);return new olympe.auth.Ta(b,c,d,g,h,e,f,t,new Map([['defaultProvider',k],['autoLogin',l],['autoUser',n],['autoPassword',p],['autoToken',q],['cacheTokenTimeout',
|
|
610
|
+
r]]))},!0)},'olympe.auth');olympe.V.run([olympe.auth.P.Fa],a=>{olympe.auth.re=()=>a});olympe.Xa.node.auth={};olympe.Xa.node.auth.Nq=class{redirect(){console.warn('Redirection n/a in Node.JS')}D(){console.warn('Redirection n/a in Node.JS')}j(){console.warn('Redirection n/a in Node.JS');return''}};olympe.Xa.node.auth.Nq.ya=[olympe.auth.Lk];olympe.V.config(a=>{C(a,olympe.auth.P.Hk,olympe.Xa.node.auth.Nq)},'olympe.native.node.auth');olympe.Xa.node.Db={};function Df(){throw Error('Key-Value Database does not implement this in NodeJS');}
|
|
611
|
+
olympe.Xa.node.Db.Lq=class{constructor(a){this.G=a;this.j=new Map}X(){return 0}N(a){const b=this;return u(function*(){let c,d;return null!=(d=null==(c=b.j.get(a))?void 0:c.size)?d:0})}F(a){const b=this;return u(function*(){const c=b.j.get(a);return c?Array.from(c.values()):[]})}R(a){const b=this;return u(function*(){const c=b.j.get(a);return c?Array.from(c.keys()):[]})}forEach(a,b){const c=this;return u(function*(){let d;for(const [e,f]of null!=(d=c.j.get(a))?d:new Map)b(f,e)})}has(a,b){const c=this;
|
|
612
|
+
return u(function*(){let d,e;return null!=(e=null==(d=c.j.get(a))?void 0:d.has(b))?e:!1})}get(a,b){const c=this;return u(function*(){let d;return null==(d=c.j.get(a))?void 0:d.get(b)})}set(a,b,c){const d=this;return u(function*(){let e;return null==(e=d.j.get(a))?void 0:e.set(c,b)})}remove(a,b){const c=this;return u(function*(){let d;yield null==(d=c.j.get(a))?void 0:d.delete(b)})}ba(){Df();return Promise.resolve()}Z(){Df();return Promise.resolve()}clear(a){const b=this;return u(function*(){let c;
|
|
613
|
+
null==(c=b.j.get(a))||c.clear()})}H(){Df();return Promise.resolve([])}D(){return u(function*(){Df()})}};olympe.Xa.node.Db.Lq.ya=[olympe.Db.qv];olympe.Xa.node.Db.Mq=class{constructor(a){this.j=new Map;this.G=a}D(a){this.j.has(a)||this.j.set(a,new olympe.Xa.node.Db.Lq(this.G));return this.j.get(a)}};olympe.Xa.node.Db.Mq.ya=[olympe.Db.rv];olympe.V.config(function(a){C(a,olympe.Db.P.qk,olympe.Xa.node.Db.Mq,olympe.Db.P.Da)},'olympe.native.node.localstorage');olympe.Xa.node.storage={};olympe.Xa.node.storage.Storage=class{constructor(a){this.G=a}write(a,b,c,d,e){e&&e('Not Implemented.')}open(a){a(null)}close(a){a(null)}};olympe.Xa.node.storage.Storage.ya=[olympe.Db.Storage];olympe.V.config(function(a){Va(a,olympe.Db.P.hj,olympe.Xa.node.storage.Storage,olympe.host.P.Da)},'olympe.native.html.storage');olympe.xg={};olympe.xg.Config={VERSION:'version.version',Pt:'version.branch',uf:'version.commit',Jw:'version.tag',yp:'version.olympe-framework',Qt:'version.build'};olympe.V.config(function(a){E(a,olympe.xg.Config.VERSION,'');E(a,olympe.xg.Config.Pt,'');E(a,olympe.xg.Config.uf,'');E(a,olympe.xg.Config.Jw,'');E(a,olympe.xg.Config.yp,'');E(a,olympe.xg.Config.Qt,'')},'olympe.main');const Ef=require('fs'),Ff=require('fs/promises');let Gf;const Hf=null!=(Gf=process.env.EXTRA_CONFIG_PATH)?Gf:null;let If;const Gb=null!=(If=process.env.EXTRA_CONFIG_KEY_PREFIX)?If:'';function Fb(a){return Ff.readFile(a,{encoding:'utf8'}).then(b=>'string'===typeof b?b:null).catch(()=>null)}
|
|
614
|
+
function Jf(a){var b=Kf;console.debug(`Start watching config files for changes: ${b}`);b.forEach(c=>{Ff.access(c,Ef.constants.F_OK).then(()=>{Ef.watch(c,d=>u(function*(){if('change'===d){console.log(`Config file "${c}" has changed. Loading new configuration...`);try{const e=yield olympe.U.it([c]),f=olympe.V.Ss(e);for(const [g,h]of f)a.Ai(g,h)}catch(e){console.error(`Failed to updated config from file ${c} with message: ${e.message}`)}}}))}).catch(()=>{})})}
|
|
615
|
+
function Lf(){console.log('The node process received a signal for graceful shutdown');let a,b,c,d;(null!=(d=null==(b=(a=olympe.Xa.node.host).ll)?void 0:null==(c=b.call(a))?void 0:fd(c))?d:Promise.resolve()).then(()=>console.log('The node backend has stopped successfully')).catch(e=>console.warn(e)).finally(()=>process.exit(0))}process.on('SIGTERM',Lf);process.on('SIGINT',Lf);process.on('SIGBREAK',Lf);process.on('SIGHUP',Lf);
|
|
616
616
|
process.on('uncaughtException',a=>{console.error('Uncaught Exception:',a);Lf()});const Kf=['oConfig.json','conf.d/oConfig.json','version.json'];Hf&&Kf.push(Hf);
|
|
617
|
-
olympe.U.
|
|
618
|
-
setInterval(()=>{},1073741824)});olympe.dc={};olympe.dc.ta={ORIGIN:'<',DESTINATION:'>'};w('olympe.dc.Direction',olympe.dc.ta);olympe.dc.fc={Zc:'ff022000000000000000',Li:'ff02200000000000000e',Zj:'ff02200000000000000f'};olympe.dc.
|
|
619
|
-
olympe.dc.Lb={NONE:null,
|
|
617
|
+
olympe.U.it(Kf).then(a=>{try{const b=Object.create(null),c=process.argv;for(let f=2;f<c.length;f++){const g=/([^?&=]+)(=?([^?&=]+))?/g.exec(c[f]);!Array.isArray(g)||4>g.length?console.warn(`Malformed config parameter "${c[f]}" ignored. It should of the form 'a=b'`):b[g[1]]=olympe.U.As(g[3])}const d=new olympe.V.du(a,b);La(d);const e=d.compile();Na(e);Jf(e)}catch(b){console.error(`Failed to start Olympe: ${b}`),process.exit(1)}}).catch(a=>{console.error(`Failed to load config files: ${a.message}.`);
|
|
618
|
+
setInterval(()=>{},1073741824)});olympe.dc={};olympe.dc.ta={ORIGIN:'<',DESTINATION:'>'};w('olympe.dc.Direction',olympe.dc.ta);olympe.dc.fc={Zc:'ff022000000000000000',Li:'ff02200000000000000e',Zj:'ff02200000000000000f'};olympe.dc.lq={VERSION:'@v',Zg:'@s'};olympe.dc.he={Xe:'?',hg:'~'};olympe.dc.rD={cj:'online',Ef:'offline',WB:'invalidate'};olympe.dc.Ia={SELF:'self',SERVER:'server',Ze:'remote'};
|
|
619
|
+
olympe.dc.Lb={NONE:null,hp:'ff023000000000000037',Dc:'ff023000000000000137',kg:'ff023000000000000237',yw:'ff023000000000000337',ku:'ff023000000000000437',Vw:'ff023000000000000537',YB:olympe.dc.he.hg+'ff023000000000000037',ZB:olympe.dc.he.hg+'ff023000000000000237',XB:olympe.dc.he.hg+'ff023000000000000437',hE:olympe.dc.he.hg+'ff023000000000000537'};olympe.dc.Xq=class extends Error{constructor(a){var b=olympe.dc.ha(),c=olympe.dc.ee(),d=b.model(a);d=`\n- model: ${d} (${d?b.name(d):'no name'})`;b=b.source(a);c=`\n- source: ${b} (${b?c.jb(b).name():'no name'})`;super(`Trying to use a CloudObject that does not exist:\n- tag: ${a}${d}${c}${''}`)}};olympe.dc.Qq=class extends Error{constructor(){var a=Mf();super('Try to access a resource not available yet: BusinessContainer, wait for it to be ready');this.j=a}};olympe.dc.Writable=class{Sc(){}Yc(){}D(){}Oa(){}hc(){}};olympe.dc.ir=class{qc(){}T(){}H(){}};olympe.dc.vc=class{constructor(a){this.tag='string'===typeof a?a:a.W()}W(){return this.tag}Ea(a){return a instanceof olympe.dc.vc&&this.tag===a.tag}};olympe.dc.vc.ya=[olympe.dc.Ye];olympe.dc.vc.prototype.Ea.K=olympe.C.J.j;olympe.dc.tu=class a{constructor(b,c,d,e,f,g){this.G=b;this.Z=c;this.db=c.view;this.ba=d;this.Jb=e;this.D=f;this.N=g;this.j=new Map;this.F=hb(new olympe.U.Zh(6E5),(h,k)=>{URL.revokeObjectURL(k);Nf(this.db,h,a.j(h))})}ia(b,c,d,e,f){this.Ua(c).then(g=>{this.lb(b,g,d,!!this.N,e,f)}).catch(g=>this.G.error(g))}H(b){const c=this;return u(function*(){const d=f=>{f=`Failed to download file ${b.W()}: ${f}`;c.G.error(f);throw Error(f);},e=b.W();if(fb(c.F.j,e)){const f=c.F.get(e);return c.D.F(f).then(g=>g.arrayBuffer()).then(g=>
|
|
620
620
|
new Uint8Array(g,0,g.byteLength)).catch(d)}return c.downloadFileContent(b).then(f=>c.D.H(f)).then(f=>{if(c.N){let g;const h=null!=(g=b.get(olympe.dm.File.mimeTypeProp))?g:'application/data';c.R(e,new Blob([f],{type:h}))}return f}).catch(d)})}downloadFileContent(b){var c=b.W(),d=b.get(olympe.dm.File.j);const e=b.get(olympe.dm.File.urlProp);if(e.startsWith('stream:'))return this.X(c).then(()=>this.downloadFileContent(b));if(e.startsWith('blob:'))return this.D.F(e).then(f=>f.arrayBuffer()).then(f=>new Uint8Array(f,
|
|
621
|
-
0,f.byteLength));if(d)return d=this.db.model(b),c=new olympe.dc.Request(olympe.dc.Request.j.eg,olympe.dc.
|
|
622
|
-
{throw Error(`Failed to delete file ${b}: ${e.message}`);})}
|
|
623
|
-
const f=null!=(e=this.j.get(b))?e:[];f.push(g=>g?d(g):c());this.j.set(b,f)})}lb(b,c,d,e,f,g){const h=e?k=>{this.R(b,new Blob([c],{type:d}));f(k)}:f;e=this.db.model(b);e=new olympe.dc.Request(olympe.dc.Request.j.og,olympe.dc.
|
|
624
|
-
0,c.byteLength):c instanceof Blob?(c=yield c.arrayBuffer(),new Uint8Array(c,0,c.byteLength)):c})}R(b,c){const d=olympe.dc.ea(b);b=URL.createObjectURL(c);this.F.set(d,b);const e=a.j(d);Pf(this.db,d,f=>{f||(this.F.delete(d),Nf(this.db,d,e))},e)}static j(b){return`cacheBinary${b}`}};function Qf(a,b){let c=Rf(b),d=null;for(;!c&&b&&b!==d;){d=b;b=a.db.
|
|
625
|
-
olympe.dc.Request.j={oc:1,Jg:10,
|
|
626
|
-
p.W(),!a.sources.has(h)){const q=new olympe.dc.sources.
|
|
627
|
-
olympe.dc.
|
|
628
|
-
(b=this.D.get(a.getType()))||b.forEach(c=>c(a));return this.jb(olympe.dc.Ia
|
|
629
|
-
olympe.dc.Hg=class{constructor(a,b){this.id=a;this.
|
|
630
|
-
this.id),this.
|
|
621
|
+
0,f.byteLength));if(d)return d=this.db.model(b),c=new olympe.dc.Request(olympe.dc.Request.j.eg,olympe.dc.ee().pe(b),{tag:c,model:d,url:e.valueOf()}),this.Jb.request(c);c=N(e);Hc(c,olympe.net.ua.ResponseType.Kl);return Ic(this.ba,c).then(f=>{const g=f.Kc();if(200<=g&&300>g)return f.getData();throw Error(`Failed to download file ${b}. Response code ${g}`);})}wa(b,c,d){c=new olympe.dc.Request(olympe.dc.Request.j.cg,d,{tag:b,model:c});return this.Jb.request(c).then(()=>this.G.debug(`Successfully deleted file: ${b}`)).catch(e=>
|
|
622
|
+
{throw Error(`Failed to delete file ${b}: ${e.message}`);})}Ha(b){const c=new olympe.U.stream.mg;this.H(b).then(d=>{cb(d).pipeTo(c).catch(()=>{})});return c}vb(b,c){this.D.H(c).then(d=>{d=URL.createObjectURL(new Blob([d]));const e=new olympe.dc.db.ec;e.Yc(b,(new Map).set(olympe.dm.File.urlProp.W(),d));this.Z.nd(Of(e));let f;null==(f=this.j.get(b))||f.forEach(g=>g(null))}).catch(d=>{let e;null==(e=this.j.get(b))||e.forEach(f=>f(d))}).finally(()=>{this.j.delete(b)})}X(b){return new Promise((c,d)=>{let e;
|
|
623
|
+
const f=null!=(e=this.j.get(b))?e:[];f.push(g=>g?d(g):c());this.j.set(b,f)})}lb(b,c,d,e,f,g){const h=e?k=>{this.R(b,new Blob([c],{type:d}));f(k)}:f;e=this.db.model(b);e=new olympe.dc.Request(olympe.dc.Request.j.og,olympe.dc.ee().pe(b),{tag:b,model:e,content:c,mimeType:d});this.Jb.request(e).then(k=>h(null!=k?k:'')).catch(null!=g?g:this.G.error.bind(this.G))}Ua(b){return u(function*(){var c=b instanceof olympe.C.Sa?b.valueOf():b;return'string'===typeof c?$a(c):c instanceof ArrayBuffer?new Uint8Array(c,
|
|
624
|
+
0,c.byteLength):c instanceof Blob?(c=yield c.arrayBuffer(),new Uint8Array(c,0,c.byteLength)):c})}R(b,c){const d=olympe.dc.ea(b);b=URL.createObjectURL(c);this.F.set(d,b);const e=a.j(d);Pf(this.db,d,f=>{f||(this.F.delete(d),Nf(this.db,d,e))},e)}static j(b){return`cacheBinary${b}`}};function Qf(a,b){let c=Rf(b),d=null;for(;!c&&b&&b!==d;){d=b;b=a.db.ff(b);if(null===b)break;c=Rf(b)}let e;return null!=(e=c)?e:null}olympe.dc.Mu=class{constructor(a,b,c){this.G=a;this.j=b;this.db=b.view;this.D=c;this.Ra=new FinalizationRegistry(d=>{this.G.F()&&this.G.debug(`Collect instance ${d} (${this.db.name(d)||'no name'})`);this.j.detach([d],olympe.dc.db.Instance.j.aq)})}};function Sf(a,b){a.origin=b;return a}function Tf(a,b,c){a.D.set(b,c);return a}function Uf(a){let b;return null!=(b=a.D)?b:new Map}olympe.dc.Request=class{constructor(a,b,c,d){this.type=a;this.origin=olympe.dc.Ia.SELF;this.j=b;this.content=null!=c?c:null;this.user=null!=d?d:ee(olympe.auth.re()).ue();this.D=new Map}getType(){return this.type}xc(){return this.user}ic(){return this.j}toString(){return`Request of type ${this.type}, from ${this.origin} to ${this.j}; content: ${this.content}`}};
|
|
625
|
+
olympe.dc.Request.j={oc:1,Jg:10,vu:24,Lp:25,wu:28,Sg:30,Gk:31,NC:32,df:40,dh:41,xo:42,wr:43,cE:44,Fi:45,zo:46,jk:47,og:50,eg:51,cg:52,Sw:60,gw:61,Gp:62,PB:63,Xt:64,yh:65,ck:91,xu:93,Fm:95,QUERY_RESULT:97};function Vf(a,b,c,d,e){const f=olympe.C.kh();a.sources.set(olympe.dc.Ia.SERVER,e.init(a));a.F?a.sources.set(olympe.dc.Ia.Ze,d.init(a)):Pf(b,a.j,()=>{a.sources.set(olympe.dc.Ia.Ze,d.init(a));const g=new Map;olympe.dc.la.from(a.j,a.j).bb(olympe.dm.DataSource.Mj).filter(olympe.dc.query.za.Ea(olympe.dm.DataSource.gi,!0)).observe(f).subscribe(h=>{var k=h.Ej();for(var l of k){const [p,q]=g.get(l);c.D(p);c.F(q);k=a.sources.get(l);a.sources.delete(l);var n=void 0;null==(n=k)||n.destroy()}h=h.yj();for(const p of h)if(h=
|
|
626
|
+
p.W(),!a.sources.has(h)){const q=new olympe.dc.sources.vq(a.G,p);a.sources.set(h,q);l=c.j(()=>q.healthCheck(),h,olympe.host.Ke.j.READINESS);n=c.H(()=>q.destroy(),`Datasource ${h}`);g.set(h,[l,n]);q.init(a)}});Nf(b,a.j,'router',!0)},'router')}function Wf(a,b,c){let d=a.D.get(b);void 0===d&&(d=[],a.D.set(b,d));d.push(c)}
|
|
627
|
+
olympe.dc.lw=class{constructor(a,b,c,d,e,f,g){this.G=a;this.j=f;this.F=g;this.sources=new Map;this.D=new Map;Vf(this,d,e,b,c)}request(a){this.G.debug('Router: sends',a);return this.jb(a.ic()).request(a)}subscribe(a,b){this.G.debug('Router: subscribes',a);return this.jb(a.ic()).subscribe(a,b)}cd(a){if(a.ic()!==this.j)this.G.error(`Router: try to reply to a request that is not for this data cloud, ignore it: ${a}`);else{var b;null==(b=this.D.get(a.getType()))||b.forEach(c=>c(a))}}xi(a){let b;null==
|
|
628
|
+
(b=this.D.get(a.getType()))||b.forEach(c=>c(a));return this.jb(olympe.dc.Ia.Ze).xi(a)}jb(a){let b;return null!=(b=this.sources.get(a))?b:this.sources.get(olympe.dc.Ia.Ze)}};function Of(a,b){b=new olympe.dc.Hg(a.T(),null!=b?b:null);b.j=a;return b}function Xf(a,b,c,d){c=new olympe.dc.Hg(null!=d?d:olympe.U.Lc(),null!=c?c:null);c.D=b;c.Ga=a;return c}
|
|
629
|
+
olympe.dc.Hg=class{constructor(a,b){this.id=a;this.Ga=this.j=this.D=null;this.dl=b}static j(a){return Xf(a.p,a.s,a.t,a.i)}T(){return this.id}qc(a){return this.j instanceof olympe.dc.db.ec?this.j.qc(a):Array.isArray(this.Ga)?(new olympe.dc.transaction.dj(this.D)).D(this.Ga,a):a}H(){let a,b,c,d;return null!=(d=null!=(c=null==(a=this.Ga)?void 0:a.length)?c:null==(b=this.j)?void 0:b.H())?d:0}ac(){return this.j instanceof olympe.dc.db.ec?this.j:Array.isArray(this.Ga)?(this.j=(new olympe.dc.transaction.dj(this.D)).j(this.Ga,
|
|
630
|
+
this.id),this.Ga=null,this.j):new olympe.dc.db.ec(this.id)}jl(){if(Array.isArray(this.Ga))return this.Ga;if(this.j instanceof olympe.dc.db.ec){const a=new olympe.dc.transaction.Ie;this.j.qc(a);return Yf(a)}return[]}fa(){return{p:this.jl(),t:this.dl,s:this.D,i:this.id}}};olympe.dc.Hg.ya=[olympe.dc.ir];olympe.dc.Ra={};const Zf=olympe.dc.ta.ORIGIN,$f=olympe.dc.ta.DESTINATION,ag=new Map,bg=new Map,cg=new Map,dg=new Map;function Rf(a){let b;return null!=(b=ag.get(a))?b:null}function eg(a,b,c){let d=a;'function'===typeof a&&(d=c.entry);a=[...(d.co||[])];return olympe.dc.na.j(b,c,...a)}function fg(a,b){dg.set(a,b);return a}function gg(a){let b,c;return null!=(c=null==(b=ag.get(a))?void 0:b.D)?c:olympe.dc.CloudObject}
|
|
631
631
|
function hg(a,b,c){const d=a+'@'+(b===$f?Zf:$f);if(bg.has(d))throw Error(`Try to register the same relation (${b+a}) multiple times.`);bg.set(d,c)}function ig(a){a=a.W()+'@'+a.La();return bg.get(a)||olympe.dc.CloudObject}function P(a,b){b.NAME=a;cg.set(a,b)}function Q(a){let b;return null!=(b=a.NAME)?b:null}
|
|
632
632
|
olympe.dc.na=class{constructor(){}static j(a,b,...c){if(ag.has(a))throw Error(`Tag: ${a} - overwriting already defined CloudObject class ${ag.get(a).D.name} with ${b.name}`);let d=null;const e=c.length;if(0<e){d=Array(e);for(let f=0;f<e;f++){let g=c[f];d[f]='string'===typeof g?new olympe.V.qb(g):g}}b=new olympe.dc.Ra.Entry(a,b,d);ag.set(a,b);return b.D.entry=b}static Wb(a){let b,c;return null!=(c=null==(b=a.entry)?void 0:b.W())?c:null}};function jg(a,b){a.j=b}function R(a,b){b=b.$b();hg(b.W(),b.La(),a.D);return b}function kg(a){a.F=!0;return a}
|
|
633
|
-
olympe.dc.Ra.Entry=class{constructor(a,b,c){this.tag=a;this.D=b;this.
|
|
634
|
-
new c(void 0,a)}ja(a){return new olympe.dc.Ra.Property(a)}ra(a,b=olympe.dc.ta.DESTINATION){hg(a,b,this.D);return new olympe.dc.aa
|
|
635
|
-
olympe.dc.Ra.Relation.prototype.getInverse=olympe.dc.Ra.Relation.prototype.$b;olympe.dc.Ra.Relation.prototype.getDirection=olympe.dc.Ra.Relation.prototype.La;olympe.dc.Ra.Relation.prototype.getTag=olympe.dc.Ra.Relation.prototype.W;olympe.dc.Ra.Relation.ya=[olympe.dc.
|
|
633
|
+
olympe.dc.Ra.Entry=class{constructor(a,b,c){this.tag=a;this.D=b;this.co=c||null;this.j=null;this.F=!1}W(){return this.tag}instantiate(a,b){const c=this.D;if(this.Qn()&&b.getParameter(olympe.dc.Config.qp)){var d=olympe.dc.ha();d=`Trying to instantiate an abstract class ${d.name(this)} (${this.W()}).`+` This may happen when the implementation of another class extending ${d.name(this)} has not been registered`;olympe.ga.Wa('dc').error(d)}return this.co?(a=[void 0,a].concat(Oa(b,this.co)),new c(...a)):
|
|
634
|
+
new c(void 0,a)}ja(a){return new olympe.dc.Ra.Property(a)}ra(a,b=olympe.dc.ta.DESTINATION){hg(a,b,this.D);return new olympe.dc.aa.$e(a,b)}Qn(){return this.F}};w('olympe.dc.registry.Entry',olympe.dc.Ra.Entry);olympe.dc.Ra.Entry.prototype.addRelation=olympe.dc.Ra.Entry.prototype.ra;olympe.dc.Ra.Entry.prototype.addProperty=olympe.dc.Ra.Entry.prototype.ja;olympe.dc.Ra.Entry.ya=[olympe.dc.Ye];olympe.dc.Ra.Property=class{constructor(a){this.tag=a}W(){return this.tag}toString(){return`Property: ${this.tag}`}};olympe.dc.Ra.Property.prototype.getTag=olympe.dc.Ra.Property.prototype.W;olympe.dc.Ra.Property.ya=[olympe.dc.Ye];olympe.dc.Ra.Relation=class{constructor(a,b=olympe.dc.ta.DESTINATION,c=olympe.dc.CloudObject,d=olympe.dc.CloudObject){this.tag=olympe.dc.ea(a);this.direction=b;this.origin=c;this.H=d}W(){return this.tag}La(){return this.direction}type(){return this.H}$b(){return new olympe.dc.Ra.Relation(this.tag,this.direction===olympe.dc.ta.DESTINATION?olympe.dc.ta.ORIGIN:olympe.dc.ta.DESTINATION,this.H,this.origin)}Ea(a){return a instanceof olympe.dc.Ra.Relation?a.W()===this.W()&&a.La()===this.La():!1}toString(){return`${this.direction}${olympe.dc.ha().name(this.tag)} (${this.tag})`}};
|
|
635
|
+
olympe.dc.Ra.Relation.prototype.getInverse=olympe.dc.Ra.Relation.prototype.$b;olympe.dc.Ra.Relation.prototype.getDirection=olympe.dc.Ra.Relation.prototype.La;olympe.dc.Ra.Relation.prototype.getTag=olympe.dc.Ra.Relation.prototype.W;olympe.dc.Ra.Relation.ya=[olympe.dc.Ye];olympe.dc.db={};function lg(a,b){const c=a.H,d=olympe.dc.ha(),e=olympe.dc.db.Database.D.ej,f=olympe.dc.db.Database.D.Xe,g=olympe.dc.db.Database.D.ORIGIN,h=olympe.dc.db.Database.D.DESTINATION,k=new olympe.dc.db.ec('rev-'+b.T());a.G.debug('Generate the reverse graphLayer of',b.T());b.Bb.forEach((l,n)=>{if(l.D()){k.D(n,olympe.dc.Lb.NONE);for(const [r,t]of l.Id())k.hc(r,n,t)}else{var p=c.get(n);if(void 0!==p)if(l.yd())for(const r of mg(d,n,l.F())){l=c.get(r);const t=new Map;l.forEach((v,x)=>{const y=x[0],z=x.substring(1);
|
|
636
636
|
y===e?t.set(z,v):y===f?t.set(x,v):y===g?v.forEach((A,K)=>{k.Oa(z,K,r)}):y===h&&v.forEach((A,K)=>{k.Oa(z,r,K)})});l=l.source();k.Sc(r,l,t)}else{const r=new Map;for(const t of l.zb().keys()){var q=t[0]===f;const v=q?t.substring(1):t;q=q?ng(p,v,!0):p.Pa(v,!0);let x;r.set(t,null!=(x=q)?x:null)}0<r.size&&k.Yc(n,r);for(const [t,v,x]of l.Id())x?k.hc(t,n,v):k.Oa(t,n,v)}}});return k}
|
|
637
|
-
function og(a,b,c){const d=b.T();if(a.F.has(d))throw Error(`You try to execute the patch ${d} a second times whereas the first execution has not been validated yet.`);const e=new pg(b,lg(a,b));a.D.unshift(d);a.F.set(d,e);a.H.
|
|
637
|
+
function og(a,b,c){const d=b.T();if(a.F.has(d))throw Error(`You try to execute the patch ${d} a second times whereas the first execution has not been validated yet.`);const e=new pg(b,lg(a,b));a.D.unshift(d);a.F.set(d,e);a.H.bt(c);a.write(b,!1,!1)}
|
|
638
638
|
function qg(a,b,c){if(0>=a.N||null===c)return b;var d=a.j.findIndex(h=>h.T()===b.T()),e=a.j[d];-1<d&&a.j.splice(d,1);d=0<a.j.length?a.j.findIndex(h=>c>=h.D):0;d=-1<d?d:a.j.length;const f=a.j.slice(0,d).reduce((h,k)=>k.nd(h),b);let g;e=null!=(g=null==e?void 0:e.update(f,c))?g:new rg(f,c,a.j,a.N);a.j.splice(d,0,e);a.G.F()&&a.G.debug('CommitController buffer:\n',a.j.map(h=>`${h.T()} at ${h.D}`).join('\n'));return f}
|
|
639
|
-
function sg(a,b,c){return a.D.slice(0,c).map(d=>a.F.get(d)).reduce((d,e)=>{let f;return null!=(f=null==e?void 0:e.nd(d))?f:d},b)}function tg(a,b,c,d=!1){return u(function*(){const e=new olympe.dc.db.
|
|
640
|
-
function ug(a,b,c,d){b=b.pipeThrough(olympe.U.stream.tap(e=>{0<a.D.length&&qg(a,sg(a,e.ac(),a.D.length),e.
|
|
641
|
-
olympe.dc.db.
|
|
642
|
-
1);qg(this,sg(this,d.D,c),b);this.F.delete(a)}}write(a,b,c=!1){b=new olympe.dc.db.
|
|
639
|
+
function sg(a,b,c){return a.D.slice(0,c).map(d=>a.F.get(d)).reduce((d,e)=>{let f;return null!=(f=null==e?void 0:e.nd(d))?f:d},b)}function tg(a,b,c,d=!1){return u(function*(){const e=new olympe.dc.db.hn(a.G,a.H,a.ha,c);e.open(d);for(const f=ha(b);;){const g=yield f.next();if(g.done)break;e.write(g.value,a.R)}e.close()})}
|
|
640
|
+
function ug(a,b,c,d){b=b.pipeThrough(olympe.U.stream.tap(e=>{0<a.D.length&&qg(a,sg(a,e.ac(),a.D.length),e.dl)}));return tg(a,b,c,d).then(()=>a.G.debug('Rebase stream completed')).catch(e=>a.G.error('Rebase stream failed:',e))}
|
|
641
|
+
olympe.dc.db.bu=class{constructor(a,b,c,d){this.G=a;this.H=b;this.ha=c;let e;this.R=null!=(e=d.get('debug'))?e:!1;let f;this.N=null!=(f=d.get('bufferTimeout'))?f:0;this.D=[];this.F=new Map;this.j=[];b.addEventListener(olympe.dc.db.Database.j.Cp,g=>{this.j.forEach(h=>{for(const k of g)h.j.j(k)})})}nd(a,b,c){const d=a.T(),e=a.dl;this.F.has(d)?this.push(d,e):(a=qg(this,sg(this,a.ac(),this.D.length),e),this.write(a,b,c))}push(a,b){const c=this.D.indexOf(a);if(-1<c){const d=this.F.get(a);this.D.splice(c,
|
|
642
|
+
1);qg(this,sg(this,d.D,c),b);this.F.delete(a)}}write(a,b,c=!1){b=new olympe.dc.db.hn(this.G,this.H,this.ha,b);b.open(c);b.write(a,this.R);b.close()}};class vg{T(){}nd(){}}function wg(a,b,c,d){const e=olympe.dc.ta.DESTINATION;c=c.tag();const f=a.j.Uc(c);b.zb().forEach((g,h)=>{f.ja(h,g);b.Z(h)});for(const [g,h,k,l]of b.ba()){if(!l)continue;const n=h===e?c:k,p=h===e?k:c;a.j.Oa(g,n,p);d.N(g,n,p)}}
|
|
643
643
|
function xg(a,b,c,d){const e=olympe.dc.ta.DESTINATION,f=c.tag(),g=a.j.Uc(f);b.zb().forEach((h,k)=>{void 0!==c.Pa(k)&&(g.ja(k,h),b.Z(k))});for(const [h,k,l]of b.Id()){const n=c.lb(h,e,k);void 0!==n&&(d.N(h,f,k),n===l&&a.j.N(h,f,k))}}
|
|
644
|
-
class pg extends vg{constructor(a,b){super();this.D=a;this.j=b;this.db=olympe.dc.
|
|
644
|
+
class pg extends vg{constructor(a,b){super();this.D=a;this.j=b;this.db=olympe.dc.ha()}T(){return this.D.T()}nd(a){for(const [b,c]of this.D.ba(a)){const d=b.tag();c.yd()?b.D()?a.j(d,b.F()):(this.D.j(d,c.F()),this.j.j(d,c.F())):b.yd()?(wg(this,c,b,a),a.j(d,b.F())):xg(this,c,b,a)}return a}}function yg(a){clearTimeout(a.F);a.F=setTimeout(()=>{a.buffer.splice(a.buffer.indexOf(a),1)},a.H)}
|
|
645
645
|
class rg extends vg{constructor(a,b,c,d){super();this.j=a;this.D=b;this.buffer=c;this.H=d;this.F=null;yg(this)}T(){return this.j.T()}nd(a){return a.R(this.j)}update(a,b){this.D=b;a.qc(this.j);yg(this);return this}};const zg=olympe.dc.fc.Zc,Ag=olympe.dc.fc.Li,Bg=olympe.dc.ta.ORIGIN,Cg=olympe.dc.ta.DESTINATION;let Dg=0;
|
|
646
|
-
olympe.dc.db.Database=class a extends Map{constructor(b,c,d){super();let e;this.id=null!=(e=d.get('selfTag'))?e:olympe.dc.Ia.SELF;this.G=b;this.hd=olympe.C.Za();this.state=olympe.dc.db.Database.F.IDLE;this.ia=new Map;this.
|
|
647
|
-
c,d,e=!1){var f=this.N(b,!0);if(!f.e&&null!==c&&(null===f.H||f.H===c)){f.H=c;let g;(null==(g=f.model())?0:g.e)&&f.db.Z(f,!0)}e&&f.persist();this.state===a.F.
|
|
648
|
-
d)switch(b){case zg:Hg(c,d);break;case Ag:Ig(c,d);break;default:c.unlink(b,d)}}Pf(b,c){for(const d of b)this.N(d).
|
|
649
|
-
this.state!==a.F.
|
|
650
|
-
d)}addEventListener(b,c){let d=this.ia.get(b);void 0===d&&(d=[],this.ia.set(b,d));d.push(c)}j(b,c){this.addEventListener(b,c)}lb(b){this.
|
|
651
|
-
null===this.H?a.F.
|
|
652
|
-
f,d);return d}
|
|
653
|
-
`\nExtension models: ${Array.from(f.values()).join(', ')}`+`\n\n ${h.toString()}`)});e.clear()})}};olympe.dc.db.Database.D={ej:'$',
|
|
654
|
-
olympe.dc.db.
|
|
655
|
-
function Pf(a,b,c,d){a=a.j.N(eh(b));d=null!=d?d:fh();gh(a,'',d,c)&&a.Ja()&&c(!0,b);return d}function mg(a,b,c){return{[Symbol.iterator]:function*(d,e,f){const g=(new Set).add(olympe.dc.ea(e));for(const h of g)yield h,d.
|
|
646
|
+
olympe.dc.db.Database=class a extends Map{constructor(b,c,d){super();let e;this.id=null!=(e=d.get('selfTag'))?e:olympe.dc.Ia.SELF;this.G=b;this.hd=olympe.C.Za();this.state=olympe.dc.db.Database.F.IDLE;this.ia=new Map;this.Ub=[];this.X=new Map;this.H=null;this.ba=new Set;var f;b=null!=(f=d.get('garbageCollector'))?f:olympe.dc.db.Af.j.em;let g;f=null!=(g=d.get('garbageCollectorDelay'))?g:5E3;this.Fd=new olympe.dc.db.Af(c,this,b,f);d.get('debug')&&this.ol()}T(){return this.id}getState(){return this.state}Wa(){return this.G}create(b,
|
|
647
|
+
c,d,e=!1){var f=this.N(b,!0);if(!f.e&&null!==c&&(null===f.H||f.H===c)){f.H=c;let g;(null==(g=f.model())?0:g.e)&&f.db.Z(f,!0)}e&&f.persist();this.state===a.F.Jl&&Eg(f,!0);d&&this.Hc(f,d);this.D(a.j.bq,b)}update(b,c){c&&(b=this.N(b,!0),this.Hc(b,c))}wa(b){const c=this.get(b);void 0!==c&&(this.Z(c,!1),this.D(a.j.cq,b))}link(b,c,d){c=this.N(c,!0);d=this.N(d,!0);switch(b){case zg:Fg(c,d);break;case Ag:Gg(c,d);break;default:c.link(b,d)}}unlink(b,c,d){c=this.get(c);d=this.get(d);if(void 0!==c&&void 0!==
|
|
648
|
+
d)switch(b){case zg:Hg(c,d);break;case Ag:Ig(c,d);break;default:c.unlink(b,d)}}Pf(b,c){for(const d of b)this.N(d).ne(c)}mi(b,c){for(const d of b)(b=this.get(d))&&b.detach(c)}Kj(...b){for(const c of b)null!=(b=this.get(c))&&(b.e=!1)}bt(b){b.forEach(c=>{this.N(c).persist()})}Md(b){const c=this.get(b);void 0!==c&&(c.clear(),super.delete(b),this.D(a.j.op,b))}N(b,c=!1){let d;return null!=(d=this.get(b))?d:this.Sc(b,c)}Sc(b,c){const d=new olympe.dc.db.Instance(b,this);this.set(b,d);this.D(a.j.np,b);c&&
|
|
649
|
+
this.state!==a.F.Jl&&this.D(a.j.gn,b);return d}vb(b){var c=olympe.U.ni();this.H?Jg(this.H,c,b):b()}R(b){let c;null!=(c=this.H)&&c.j.delete(b)}Ha(b,...c){this.ia.has(b)&&this.ia.get(b).forEach(d=>{d(...c)})}D(b,c,...d){this.Ha(b,c,...d)}Z(b,c){let d;null!=(d=this.H)&&d.H.set(b,c)}Qe(b,c,d,e){let f;null!=(f=this.H)&&Kg(f,b).ja(e?Lg+c:c,d)}ef(b,c,d,e,f){let g;null!=(g=this.H)&&(d===Mg?f?Kg(g,b).link(c,e):Kg(g,b).unlink(c,e):f?Kg(g,b).vb(c,e):Kg(g,b).Gc(c,e))}Ua(b,c,d){let e;null!=(e=this.H)&&Kg(e,b).Md(c,
|
|
650
|
+
d)}addEventListener(b,c){let d=this.ia.get(b);void 0===d&&(d=[],this.ia.set(b,d));d.push(c)}j(b,c){this.addEventListener(b,c)}lb(b){this.Ub.push(b)}F(b){for(const c of this.X.values())if(c.R.has(b))return!0;return!1}tg(b=!1){const c=Dg++;this.state=a.F.Dl;this.ba.add(c);b||this.X.set(c,new olympe.dc.db.pu(c,this,this.hd));return c}ht(b,c){if(!this.ba.has(b))throw Error('Database: cannot use a transaction that has not been started');let d;this.H=null!=(d=this.X.get(b))?d:null;b=this.state;this.state=
|
|
651
|
+
null===this.H?a.F.Jl:a.F.Yv;c();this.state=b;this.H=null}ke(b){this.state=a.F.uf;const c=this.X.get(b);c&&(this.H=c,Ng(this.H),Og(this.H),this.X.delete(b),this.H=null);this.ba.delete(b);0===this.ba.size&&(this.state=a.F.IDLE,this.Ub.forEach(d=>{d()}),Pg(this.Fd))}Hc(b,c){const d=a.D.Xe;for(const [e,f]of c)void 0!==f&&(e[0]===d?Qg(b,e.substring(1),f):b.update(e,f))}Gc(b,c,d=[]){const e=c.tag();if(!b.has(e)&&(b.add(e),d.push(c),c=c.get(Bg+zg)))for(const f of c.values())null!==f.source()&&this.Gc(b,
|
|
652
|
+
f,d);return d}ol(){const b=a.j.hm,c=a.j.Ik,d=new Set,e=new Map;this.j(a.j.bq,f=>{d.add(f)});this.j(b,f=>{d.delete(f);e.delete(f)});this.j(c,(f,...g)=>{if(g[0]===Ag&&g[1]===Cg){const h=g[2];this.get(h).Ja()||(g=e.get(h)||new Set,0===g.size&&e.set(h,g),g.add(f))}});this.lb(()=>{d.forEach(f=>{const g=this.get(f);g&&null===g.model()&&this.G.error(`\n[DEBUG - DATABASE]\nInstance ${f} created but does not exist !\n${g.toString()}`)});d.clear();e.forEach((f,g)=>{const h=this.get(g);h&&this.G.error(`\n[DEBUG - DATABASE]\nThe model ${g} is extended by other models but does not exist !`+
|
|
653
|
+
`\nExtension models: ${Array.from(f.values()).join(', ')}`+`\n\n ${h.toString()}`)});e.clear()})}};olympe.dc.db.Database.D={ej:'$',Iu:'~',Xe:'?',El:'=',Yp:'|',Hi:'@',ORIGIN:olympe.dc.ta.ORIGIN,DESTINATION:olympe.dc.ta.DESTINATION};olympe.dc.db.Database.j={np:0,op:1,js:2,gn:3,Lo:4,Mo:5,hm:6,Dc:7,Ik:8,Wm:9,bq:10,cq:11,rr:12,LA:13,KA:14,Nw:15,Cp:16};olympe.dc.db.Database.F={IDLE:0,Dl:1,Yv:2,Jl:3,uf:4};function Rg(a,b,c=[]){const d=b.T();og(a.j,b,c);return e=>{if(null!==e)a.j.push(d,e);else{e=a.j;var f=e.F.get(d);if(void 0!==f){const g=e.D.indexOf(d);e.D.splice(g,1);f=sg(e,f.j,e.D.length);e.write(qg(e,f,Date.now()),!1);e.F.delete(d)}}}}function Sg(a,b,c={}){let d,e;return ug(a.j,b,null!=(d=c.persist)?d:!0,null!=(e=c.sn)?e:!1)}function Tg(a,b){a.D.lb(b)}
|
|
654
|
+
olympe.dc.db.lu=class{constructor(a,b,c,d,e){this.G=a;this.D=b;this.view=c;this.j=new olympe.dc.db.bu(a,b,c,d);this.zz=new olympe.dc.db.Hv(a,c,b,e)}Wa(){return this.G}nd(a,b={}){let c,d;this.j.nd(a,null!=(c=b.persist)?c:!0,null!=(d=b.sn)?d:!1)}ne(a,b){this.D.Pf(a,b)}detach(a,b){this.D.mi(a,b);return this}Kj(...a){this.D.Kj(...a.map(olympe.dc.ea))}};const Ug=olympe.dc.db.Database.D.ORIGIN,Vg=olympe.dc.db.Database.D.DESTINATION,Wg=olympe.dc.db.Database.D.ej,Xg=olympe.dc.db.Database.D.Xe,Yg=olympe.dc.db.Database.D.El,Zg=olympe.dc.db.Database.D.Yp,$g=Ug+Vg,ah=Wg+Wg,bh=olympe.dc.db.Database.F;let ch=0;function Nf(a,b,c,d=!1){const e=S(a,b);if(null!==e){const f=dh(e,'',c);void 0!==f&&(a.j.getState()!==bh.uf||e.F()&&!d||a.j.R(c),d||!e.Ja()&&!e.F()||f(!1,b))}}
|
|
655
|
+
function Pf(a,b,c,d){a=a.j.N(eh(b));d=null!=d?d:fh();gh(a,'',d,c)&&a.Ja()&&c(!0,b);return d}function mg(a,b,c){return{[Symbol.iterator]:function*(d,e,f){const g=(new Set).add(olympe.dc.ea(e));for(const h of g)yield h,d.il(h,f).forEach(([k,,,l])=>{l&&g.add(k)})}.bind(null,a,b,c)}}function fh(){++ch;return String(ch)}function eh(a){if(a)return olympe.dc.ea(a);throw Error('DBView: Impossible to transform tag to string, provided tag is empty, null or undefined.');}
|
|
656
656
|
function hh(a,b,c,d,e){a=a.j.N(eh(b));c=eh(c);b=Wg+c;e=null!=e?e:fh();if(gh(a,b,e,d)&&a.Ja()){let f=!1;b=a.get(b);void 0===b&&(f=!0,b=a.get(Yg+c));void 0!==b&&d(b,f)}return e}function S(a,b,c=!1){if(b)return a=a.j.get(olympe.dc.ea(b)),!a||c&&!a.Ja()?null:a;throw Error('DBView: Impossible to get instance, provided tag is empty, null or undefined.');}function ih(a,b,c,d){b=S(a,b);null!==b&&(c=olympe.dc.ea(c),dh(b,Wg+c,d),a.j.getState()===bh.uf&&a.j.R(d))}
|
|
657
657
|
function jh(a,b,c,d){a=a.j.N(eh(b));d=null!=d?d:fh();gh(a,ah,d,c)&&a.Ja()&&a.forEach((e,f)=>{const g=f[0];g!==Wg&&g!==Yg||c(f.substring(1),e,g===Yg)});return d}function kh(a,b,c){b=S(a,b);null!==b&&(dh(b,ah,c),a.j.getState()===bh.uf&&a.j.R(c))}function lh(a,b,c,d,e){let f;null==(f=a.get(b))||f.forEach((g,h)=>{if(g.Ja()||!c&&g.F())e?d(b.substring(1),b[0],c,h):d(c,h)})}function T(a,b,c,d,e){a=a.j.N(eh(b));c=c.La()+c.W();e=null!=e?e:fh();(d=mh(a,c,e,d))&&a.Ja()&&lh(a,c,!0,d,!1);return e}
|
|
658
658
|
function nh(a,b,c,d){const e=a.j.N(eh(b));a=null!=d?d:fh();const f=mh(e,$g,a,c);f&&e.Ja()&&e.forEach((g,h)=>{g=h[0];g!==Ug&&g!==Vg||lh(e,h,!0,f,!0)})}function oh(a,b,c){const d=S(a,b);if(null!==d){const e=dh(d,$g,c);void 0!==e&&(a.j.getState()!==bh.uf||d.F()||a.j.R(c),!d.Ja()&&!d.F()||d.forEach((f,g)=>{f=g[0];(f===Ug||f===Vg)&&e&&lh(d,g,!1,e,!0)}))}}
|
|
659
|
-
function ph(a,b,c){b=S(a,b,!1);if(!b||c===olympe.dc.Lb.NONE)return[];const d=c.charAt(0)===olympe.dc.
|
|
659
|
+
function ph(a,b,c){b=S(a,b,!1);if(!b||c===olympe.dc.Lb.NONE)return[];const d=c.charAt(0)===olympe.dc.he.hg,e=[];b.forEach((f,g)=>{const h=g.charAt(0);if(!d&&f instanceof olympe.dc.vc&&(h===Wg||h===Xg))(f=a.j.get(f.W()))&&e.push([f,g.substring(1),null,!0]);else if(h===Ug||h===Vg){const k=g.substring(1),l=(h===Ug?12:3)&qh(a,k,c);l&&f.forEach(n=>{e.push([n,k,h,!!(l&10)])})}});if(d&&void 0!==b.D){const [f,g]=void 0!==b.D?[b.D.tag,b.D.Ca]:null;b=a.j.get(f);e.push([b,g,null,!0])}return e}
|
|
660
660
|
function rh(a,b,c,d,e){const f=a.j.N(eh(b));e=null!=e?e:fh();const g=mh(f,Zg+c,e,d);g&&f.Ja()&&ph(a,b,c).forEach(([h,...k])=>{h.Ja()&&g(...k,!0,h.tag())})}function sh(a,b,c,d){const e=S(a,b);if(null!==e){const f=dh(e,Zg+c,d);void 0!==f&&(a.j.getState()!==bh.uf||e.F()||a.j.R(d),!e.Ja()&&!e.F()||ph(a,b,c).forEach(([g,...h])=>{(g.Ja()||g.F())&&f(...h,!1,g.tag())}))}}function th(a,b){a=S(a,b,!0);b=new Map;if(a)for(const [c,d]of a)c[0]===Xg&&b.set(c.substring(1),d);return b}
|
|
661
|
-
function qh(a,b,c){if(c===olympe.dc.Lb.NONE)return 0;const d=c[0]===olympe.dc.
|
|
661
|
+
function qh(a,b,c){if(c===olympe.dc.Lb.NONE)return 0;const d=c[0]===olympe.dc.he.hg;c=d?c.substring(1):c;a=a.Pa(b,c,!0)||0;return d?((a&3)<<2)+((a&12)>>2):a}function uh(a,b){return function*(c){if(c)for(const [d,e]of c)if(c=d[0],c===Ug||c===Vg){const f=d.substring(1);for(const g of e.keys())yield[f,c,g]}}(S(a,b,!0))}
|
|
662
662
|
function vh(a,b,c){if(!a.Ja(b))return a.G.warn(`No instance found with tag ${b}`),new Map;const d=new Map,e=[olympe.dc.ea(b)];for(const f of e){const g=a.cb(f,c);d.set(f,g);for(const h of g.filter(k=>!d.has(k)))e.push(h)}a.G.debug(`Found ${d.size} instances in sub-tree rooted at ${olympe.dc.ea(b)}`);return d}function wh(a,b,c,d){return(c=(a=S(a,b,!0))&&a.get(d+c))?Array.from(c.values()).filter(e=>e.Ja()).length:0}
|
|
663
|
-
olympe.dc.kb=class{constructor(a,b){this.G=a;this.j=b}T(){return this.j.T()}D(a,b,c,d=!1){a=S(this,a);if(null!==a){b=b.La()+b.W();const e=dh(a,b,c);void 0!==e&&(this.j.getState()!==bh.uf||a.F()&&!d||this.j.R(c),d||!a.Ja()&&!a.F()||lh(a,b,!1,e,!1))}}Ja(a){a=this.j.get(olympe.dc.ea(a));return!(null==a||!a.Ja())}name(a){let b,c;return null!=(c=null==(b=S(this,a))?void 0:b.Pa(olympe.dc.CloudObject.nameProp.W()))?c:''}model(a){return(a=(a=S(this,a,!0))?a.model():null)?a.tag():null}
|
|
664
|
-
a,!0))&&a.
|
|
665
|
-
...d])=>[c.tag(),...d])}cb(a,b){a=S(this,a,!0);b=b.La()+b.W();b=null==a?void 0:a.get(b);a=[];if(b)for(const c of b.values())c.Ja()&&a.push(c.tag());return a}
|
|
666
|
-
S(this,a,!0);const d=b.La()+b.W();c=null==c?void 0:c.get(d);if(1<(null==c?void 0:c.size))return this.G.warn(`Relation ${b.W()} to instance ${a} is not unique: found ${c.size} related items`),null;a=null==c?void 0:c.values().next().value;return(null==a?0:a.Ja())?a.tag():null}nh(a,b,c){a=olympe.dc.ea(a);const d=vh(this,a,b);d.delete(a);return c?(c=olympe.dc.ea(c),d.has(c)?Array.from(vh(this,c,b.$b()).keys()).filter(e=>d.has(e)):[]):Array.from(d.keys())}
|
|
667
|
-
a,b);const d=[olympe.dc.ea(a)];for(const e of d){if(c(e))return e;if(a=b.get(e))for(const f of a.filter(g=>!d.includes(g)))d.push(f)}return null}
|
|
668
|
-
Error(a);null!==c&&e.push(c)}c=S(this,olympe.dc.CloudObject,!0);if(d!==c&&e[e.length-1]===c)throw Error(`The model "${this.name(a)}" (tag = ${a}) does not extend the expected model "${this.name(b)}" (tag = ${b}).`);return e.map(f=>f.tag())}Vf(a,b){const c=olympe.dc.ea(b);return!!this.
|
|
669
|
-
olympe.dc.kb.prototype.getExtendedModels=olympe.dc.kb.prototype.
|
|
670
|
-
olympe.dc.kb.prototype.getRelated=olympe.dc.kb.prototype.cb;olympe.dc.kb.prototype.getProperties=olympe.dc.kb.prototype.zb;olympe.dc.kb.prototype.getProperty=olympe.dc.kb.prototype.Pa;olympe.dc.kb.prototype.isPersisted=olympe.dc.kb.prototype.
|
|
671
|
-
olympe.dc.kb.prototype.name=olympe.dc.kb.prototype.name;olympe.dc.kb.prototype.exist=olympe.dc.kb.prototype.Ja;const xh=olympe.dc.db.Database.D.ORIGIN,Mg=olympe.dc.db.Database.D.DESTINATION,Lg=olympe.dc.db.Database.D.
|
|
663
|
+
olympe.dc.kb=class{constructor(a,b){this.G=a;this.j=b}T(){return this.j.T()}D(a,b,c,d=!1){a=S(this,a);if(null!==a){b=b.La()+b.W();const e=dh(a,b,c);void 0!==e&&(this.j.getState()!==bh.uf||a.F()&&!d||this.j.R(c),d||!a.Ja()&&!a.F()||lh(a,b,!1,e,!1))}}Ja(a){a=this.j.get(olympe.dc.ea(a));return!(null==a||!a.Ja())}name(a){let b,c;return null!=(c=null==(b=S(this,a))?void 0:b.Pa(olympe.dc.CloudObject.nameProp.W()))?c:''}model(a){return(a=(a=S(this,a,!0))?a.model():null)?a.tag():null}ff(a){return(a=(a=S(this,
|
|
664
|
+
a,!0))&&a.ff())?a.tag():null}vi(a){a=S(this,a,!0);return!(!a||!a.ff())}Nb(a,b){a=(a=S(this,a,!0))&&a.model();return!(!a||!this.Vf(a.tag(),b))}source(a){return(a=S(this,a,!0))&&a.source()}Re(a){a=S(this,a,!1);return!a||a.N}Pa(a,b,c){a=S(this,a,!0);b=olympe.dc.ea(b);let d;return null!=(d=null==a?void 0:a.Pa(b,c))?d:null}zb(a,b=!1){var c=S(this,a,!0);a=new Map;if(c)for(const [d,e]of c)c=d[0],(c===Wg||!b&&c===Yg)&&a.set(d.substring(1),e);return a}il(a,b){return ph(this,a,b).filter(([c])=>c.Ja()).map(([c,
|
|
665
|
+
...d])=>[c.tag(),...d])}cb(a,b){a=S(this,a,!0);b=b.La()+b.W();b=null==a?void 0:a.get(b);a=[];if(b)for(const c of b.values())c.Ja()&&a.push(c.tag());return a}gt(a,b,c){let d,e;a=null==(d=S(this,a,!0))?void 0:null==(e=d.get(b.La()+b.W()))?void 0:e.get(olympe.dc.ea(c));return!(null==a||!a.Ja())}Ln(a,b){a=S(this,a,!0);if(!a)return[];a=[a.tag()];for(const c of b){b=[];for(const d of a)if(a=S(this,d,!0).get(c.La()+c.W()),void 0!==a)for(const e of a.values())e.Ja()&&b.push(e.tag());a=b}return a}Ib(a,b){var c=
|
|
666
|
+
S(this,a,!0);const d=b.La()+b.W();c=null==c?void 0:c.get(d);if(1<(null==c?void 0:c.size))return this.G.warn(`Relation ${b.W()} to instance ${a} is not unique: found ${c.size} related items`),null;a=null==c?void 0:c.values().next().value;return(null==a?0:a.Ja())?a.tag():null}nh(a,b,c){a=olympe.dc.ea(a);const d=vh(this,a,b);d.delete(a);return c?(c=olympe.dc.ea(c),d.has(c)?Array.from(vh(this,c,b.$b()).keys()).filter(e=>d.has(e)):[]):Array.from(d.keys())}Ks(a,b,c){if(!this.Ja(a))return null;b=vh(this,
|
|
667
|
+
a,b);const d=[olympe.dc.ea(a)];for(const e of d){if(c(e))return e;if(a=b.get(e))for(const f of a.filter(g=>!d.includes(g)))d.push(f)}return null}Dn(a,b,c){return this.Ln(a,b).find(c)||null}Vx(a,b,c){return this.Ln(a,b).filter(c)}Qs(a,b=olympe.dc.CloudObject){var c=S(this,a,!0);const d=b&&S(this,b,!0),e=[c];for(;c&&c!==d;){c=c.ff();if(e.includes(c))throw Error(`Cycle detected when following recursively extend relations from base model instance "${a}".`);if(c&&!c.Ja())throw a=`Try to get all extensions of the model ${olympe.dc.ea(a)} but one of them does not exists (${c.tag()})`,
|
|
668
|
+
Error(a);null!==c&&e.push(c)}c=S(this,olympe.dc.CloudObject,!0);if(d!==c&&e[e.length-1]===c)throw Error(`The model "${this.name(a)}" (tag = ${a}) does not extend the expected model "${this.name(b)}" (tag = ${b}).`);return e.map(f=>f.tag())}Vf(a,b){const c=olympe.dc.ea(b);return!!this.Ks(a,olympe.dc.CloudObject.extendRel,d=>d===c)}Vc(a){return this.cb(a,olympe.dc.CloudObject.instancesRel)}};olympe.dc.kb.prototype.getInstances=olympe.dc.kb.prototype.Vc;olympe.dc.kb.prototype.isExtending=olympe.dc.kb.prototype.Vf;
|
|
669
|
+
olympe.dc.kb.prototype.getExtendedModels=olympe.dc.kb.prototype.Qs;olympe.dc.kb.prototype.findAllRelated=olympe.dc.kb.prototype.Vx;olympe.dc.kb.prototype.findRelated=olympe.dc.kb.prototype.Dn;olympe.dc.kb.prototype.findRecursive=olympe.dc.kb.prototype.Ks;olympe.dc.kb.prototype.getRecursiveRelated=olympe.dc.kb.prototype.nh;olympe.dc.kb.prototype.getUniqueRelated=olympe.dc.kb.prototype.Ib;olympe.dc.kb.prototype.getMultiRelated=olympe.dc.kb.prototype.Ln;olympe.dc.kb.prototype.isRelated=olympe.dc.kb.prototype.gt;
|
|
670
|
+
olympe.dc.kb.prototype.getRelated=olympe.dc.kb.prototype.cb;olympe.dc.kb.prototype.getProperties=olympe.dc.kb.prototype.zb;olympe.dc.kb.prototype.getProperty=olympe.dc.kb.prototype.Pa;olympe.dc.kb.prototype.isPersisted=olympe.dc.kb.prototype.Re;olympe.dc.kb.prototype.instanceOf=olympe.dc.kb.prototype.Nb;olympe.dc.kb.prototype.isModel=olympe.dc.kb.prototype.vi;olympe.dc.kb.prototype.extension=olympe.dc.kb.prototype.ff;olympe.dc.kb.prototype.model=olympe.dc.kb.prototype.model;
|
|
671
|
+
olympe.dc.kb.prototype.name=olympe.dc.kb.prototype.name;olympe.dc.kb.prototype.exist=olympe.dc.kb.prototype.Ja;const xh=olympe.dc.db.Database.D.ORIGIN,Mg=olympe.dc.db.Database.D.DESTINATION,Lg=olympe.dc.db.Database.D.El,yh=olympe.dc.db.Database.D.ej,zh=olympe.dc.db.Database.D.Yp,Ah=olympe.dc.db.Database.D.Hi,Bh=xh+Mg,Ch=yh+yh,Dh=Array.from(Object.values(olympe.dc.Lb)).filter(a=>null!==a);function Jg(a,b,c){let d=a.j.get(b);void 0===d&&(d=[],a.j.set(b,d));a.buffer.push([b,d.length]);d.push(c)}
|
|
672
672
|
function Ng(a){for(const [b,c]of a.H)a.D.Gc(new Set,b).filter(d=>Eg(d,c)).forEach(d=>{d=d.tag();c?Kg(a,d).create():Kg(a,d).delete()})}
|
|
673
|
-
function Og(a){const b=a.D;a.F.forEach((c,d)=>{var e=b.get(d);if(c.D()||c.yd()){var f=e.get(Ah);f&&Eh(a,f,c.D(),d);c.yd()&&a.R.add(d)}for(const [n,p]of c.zb()){var g=n[0]===Lg,h=g?n.substring(1):n;f=a;var k=e,l=p;const q=k.get(Ah+yh+h);q&&Eh(f,q,l,g);(k=k.get(Ah+Ch))&&Eh(f,k,h,l,g)}for(const n of c.
|
|
674
|
-
function Eh(a,b,...c){b.forEach((d,e)=>{Jg(a,e,d.bind(null,...c))})}function Fh(a,b,c,d,e,f){var g=b.get(Ah+d+c);g&&Eh(a,g,f,e);(g=b.get(Ah+Bh))&&Eh(a,g,c,d,f,e);Ih(a,c,d).forEach((h,k)=>{(k=b.get(Ah+zh+k))&&Eh(a,k,c,d,h,f,e)})}function Gh(a,b,c,d,e){Dh.forEach(f=>{const g=f[0]===olympe.dc.
|
|
675
|
-
function Hh(a){a.X.run(()=>{const b=a.j;for(const [c,d]of a.buffer){let e,f,g;null==(e=b.get(c))||null==(g=(f=e)[d])||g.call(f)}});a.j.clear();a.buffer.length=0}function Ih(a,b,c){const d=b+c;let e=a.N.get(d);if(!e){const f=a.D.get(b);e=new Map;Dh.forEach(g=>{const h=g[0]===olympe.dc.
|
|
676
|
-
olympe.dc.db.
|
|
677
|
-
olympe.dc.db.Af=class{constructor(a,b,c,d){this.G=a;this.j=b;this.D=new Set;this.mode=c;this.delay=d;this.F=!1;c!==olympe.dc.db.Af.j.
|
|
678
|
-
c=olympe.dc.db.Database.j.
|
|
679
|
-
l?a.Oa(h,f,k,g,e.Vb()):a.hc(h,f,k,g,e.Vb())});return a}nf(){return 0===this.Bb.size}H(){let a=0;this.Bb.forEach(b=>{a+=b.hd()});return a}Sc(a,b,c,d=null){b=this.F(a).create(b);'string'===typeof d&&this.Oa(olympe.dc.fc.Zc,a,d,d,null);c&&b.
|
|
680
|
-
c);this.F(c,e).vb(a,b)}hc(a,b,c,d=null,e=null){this.F(b,d).unlink(a,c);this.F(c,e).Gc(a,b)}Z(a){var b=olympe.dc.
|
|
681
|
-
b:null}j(a,b=olympe.dc.Lb.NONE){a=this.
|
|
682
|
-
b)}X(a,b){const c=olympe.dc.ta.ORIGIN,d=olympe.dc.ta.DESTINATION,e=this.Bb.get(a);for(const [g,h,k]of e.Id())if(k||!b){e.H(g,d,h);var f=this.Bb.get(h);f&&f.H(g,c,a)}for(const [g,h,k]of e.Ua())if(k||!b)e.H(g,c,h),(f=this.Bb.get(h))&&f.H(g,d,a)}*
|
|
673
|
+
function Og(a){const b=a.D;a.F.forEach((c,d)=>{var e=b.get(d);if(c.D()||c.yd()){var f=e.get(Ah);f&&Eh(a,f,c.D(),d);c.yd()&&a.R.add(d)}for(const [n,p]of c.zb()){var g=n[0]===Lg,h=g?n.substring(1):n;f=a;var k=e,l=p;const q=k.get(Ah+yh+h);q&&Eh(f,q,l,g);(k=k.get(Ah+Ch))&&Eh(f,k,h,l,g)}for(const n of c.ba())Fh(a,e,...n);(e=c.X)&&Gh(a,e,d,c.Ub,!c.yd())});a.H.clear();a.F.clear();a.N.clear();Hh(a)}function Kg(a,b){let c=a.F.get(b);void 0===c&&(c=new olympe.dc.db.Jh(b),a.F.set(b,c));return c}
|
|
674
|
+
function Eh(a,b,...c){b.forEach((d,e)=>{Jg(a,e,d.bind(null,...c))})}function Fh(a,b,c,d,e,f){var g=b.get(Ah+d+c);g&&Eh(a,g,f,e);(g=b.get(Ah+Bh))&&Eh(a,g,c,d,f,e);Ih(a,c,d).forEach((h,k)=>{(k=b.get(Ah+zh+k))&&Eh(a,k,c,d,h,f,e)})}function Gh(a,b,c,d,e){Dh.forEach(f=>{const g=f[0]===olympe.dc.he.hg;(f=a.D.get(g?c:b).get(Ah+zh+f))&&Eh(a,f,d,null,!0,e,g?b:c)})}
|
|
675
|
+
function Hh(a){a.X.run(()=>{const b=a.j;for(const [c,d]of a.buffer){let e,f,g;null==(e=b.get(c))||null==(g=(f=e)[d])||g.call(f)}});a.j.clear();a.buffer.length=0}function Ih(a,b,c){const d=b+c;let e=a.N.get(d);if(!e){const f=a.D.get(b);e=new Map;Dh.forEach(g=>{const h=g[0]===olympe.dc.he.hg;var k=h?g.substring(1):g;let l;k=null!=(l=null==f?void 0:f.get(yh+k))?l:0;k=h?((k&3)<<2)+((k&12)>>2):k;(c===xh?12:3)&k&&e.set(g,!!((c===xh?8:2)&k))});a.N.set(d,e)}return e}
|
|
676
|
+
olympe.dc.db.pu=class{constructor(a,b,c){this.id=a;this.D=b;this.X=c;this.H=new Map;this.F=new Map;this.R=new Set;this.j=new Map;this.N=new Map;this.buffer=[]}T(){return this.id}};function Pg(a){if(!a.F&&0<a.D.size)switch(a.mode){case olympe.dc.db.Af.j.ko:a.F=!0;setTimeout(()=>{a.j.getState()===olympe.dc.db.Database.F.IDLE&&a.run()},a.delay);break;case olympe.dc.db.Af.j.Aw:a.F=!0,a.run()}}
|
|
677
|
+
olympe.dc.db.Af=class{constructor(a,b,c,d){this.G=a;this.j=b;this.D=new Set;this.mode=c;this.delay=d;this.F=!1;c!==olympe.dc.db.Af.j.em&&this.init()}run(){const a=this.j;this.G.debug('Start garbage collector with',this.D.size,'instances to check');const b=[];for(const c of this.D){const d=a.get(c);!d||0<d.c||(this.G.debug('Remove unused instance',c,'from database'),a.Md(c),b.push(c))}this.D.clear();this.j.Ha(olympe.dc.db.Database.j.Cp,b);this.F=!1}init(){const a=olympe.dc.db.Database.j.js,b=olympe.dc.db.Database.j.cq,
|
|
678
|
+
c=olympe.dc.db.Database.j.rr,d=olympe.dc.db.Database.F.IDLE,e=f=>{this.D.add(f);this.j.getState()===d&&Pg(this)};this.j.j(olympe.dc.db.Database.j.gn,e.bind(this));this.j.j(b,e.bind(this));this.j.j(a,f=>{this.D.delete(f)});this.j.addEventListener(olympe.dc.db.Database.j.Nw,()=>{this.run()});this.j.j(c,(f,...g)=>{this.G.error(g[0])})}};olympe.dc.db.Af.j={em:0,Aw:1,ko:2};olympe.dc.db.Af.D=5E3;olympe.dc.db.ec=class{constructor(a){this.id=null!=a?a:olympe.U.hf();this.Bb=new Map}T(){return this.id}qc(a){const b=olympe.dc.db.Jh.j.Em,c=olympe.dc.db.Jh.j.Dc,d=olympe.dc.db.Jh.j.Xk;this.Bb.forEach((e,f)=>{const g=e.Vb();switch(e.getState()){case b:const h=e.jb();if(null===h)throw Error(`GraphPatch: try to create the instance ${f} with no source`);const k=e.N()?e.zb():void 0;a.Sc(f,h,k,g);break;case d:e.N()&&a.Yc(f,e.zb(),g);break;case c:a.D(f,e.F(),g)}for(const [h,k,l]of e.Id())e=this.Bb.get(k),
|
|
679
|
+
l?a.Oa(h,f,k,g,e.Vb()):a.hc(h,f,k,g,e.Vb())});return a}nf(){return 0===this.Bb.size}H(){let a=0;this.Bb.forEach(b=>{a+=b.hd()});return a}Sc(a,b,c,d=null){b=this.F(a).create(b);'string'===typeof d&&this.Oa(olympe.dc.fc.Zc,a,d,d,null);c&&b.qn(c)}Yc(a,b,c=null){b&&this.F(a,c).qn(b)}D(a,b=olympe.dc.Lb.NONE,c=null){const d=this.Bb.get(a);if(d&&d.D())this.j(a,b);else{this.F(a,c).delete(b);for(const e of this.il(a,b,!1))this.Bb.get(e).zb().clear(),this.X(e,!0)}}Oa(a,b,c,d=null,e=null){this.F(b,d).link(a,
|
|
680
|
+
c);this.F(c,e).vb(a,b)}hc(a,b,c,d=null,e=null){this.F(b,d).unlink(a,c);this.F(c,e).Gc(a,b)}Z(a){var b=olympe.dc.ha();if(b.Ja(a)){const c=b.model(a),d=b.source(a),e=b.zb(a,!0);th(b,a).forEach((f,g)=>{e.set(`${olympe.dc.he.Xe}${g}`,f)});this.Sc(a,d,e,c);(b=b.ff(a))&&this.Oa(olympe.dc.fc.Li,a,b);e.forEach(f=>{f instanceof olympe.dc.vc&&this.Z(f.W())})}}Vc(){return function*(a){for(const b of a.values())if(b.D()||b.yd()||b.N())yield b}(this.Bb)}Uc(a){let b;return null!=(b=this.Bb.get(olympe.dc.ea(a)))?
|
|
681
|
+
b:null}j(a,b=olympe.dc.Lb.NONE){a=this.il(a,b);for(const c of a)this.X(c,!1),this.Bb.delete(c)}Id(){return function*(a){for(var b=a.next();!b.done;){b=b.value;const c=b.tag();yield*b.Id((d,e,f)=>[d,c,e,f]);b=a.next()}}(this.Bb.values())}nh(a,b,c=(d,e)=>[d,e]){return this.ia(a,b,c)}*ia(a,b,c,d=[]){d.push(a);a=this.Uc(a);for(const [e,f]of a.cb(b))d.includes(e)||(yield*this.ia(e,b,c,d),yield c(e,f))}N(a,b,c){const d=this.Bb.get(b),e=this.Bb.get(c);d&&d.H(a,olympe.dc.ta.DESTINATION,c);e&&e.H(a,olympe.dc.ta.ORIGIN,
|
|
682
|
+
b)}X(a,b){const c=olympe.dc.ta.ORIGIN,d=olympe.dc.ta.DESTINATION,e=this.Bb.get(a);for(const [g,h,k]of e.Id())if(k||!b){e.H(g,d,h);var f=this.Bb.get(h);f&&f.H(g,c,a)}for(const [g,h,k]of e.Ua())if(k||!b)e.H(g,c,h),(f=this.Bb.get(h))&&f.H(g,d,a)}*Us(a){let b;for(const [c,d]of(null==(b=this.Uc(a))?void 0:b.cb(olympe.dc.CloudObject.instancesRel))||[])d&&(a=this.Bb.get(c),a.yd()||(yield a))}il(a,b,c=!0){const d=olympe.dm.Relation.j.yr,e=olympe.dm.Relation.j.es,f=olympe.dc.ta.ORIGIN,g=olympe.dc.ha();a=new Set([a]);
|
|
683
683
|
const h=new Set;for(const l of a){var k=this.Bb.get(l);if(void 0!==k){for(const [n,p,q]of k.Id())q&&qh(g,n,b)&e?a.add(p):c||q||h.add(`${l}.${n}.${p}`);for(const [n,p,q]of k.Ua())q&&qh(g,n,b)&d?a.add(p):c||q||h.add(`${p}.${n}.${l}`)}for(const [n,p,q]of uh(g,l))k=p===f?d:e,!h.has(p===f?`${q}.${n}.${l}`:`${l}.${n}.${q}`)&&qh(g,n,b)&k&&a.add(q)}return Array.from(a).filter(l=>this.Bb.has(l))}F(a,b){let c=this.Bb.get(a);void 0===c&&(c=new olympe.dc.db.Jh(a),this.Bb.set(a,c));return b?c.wa(b):c}R(a){const b=
|
|
684
|
-
olympe.dc.ta.DESTINATION;for(const [c,d]of this.
|
|
685
|
-
function Fg(a,b){const c=a.model();if(null!==c){if(c===b)return;a.unlink(Ph,c)}a.link(Ph,b);b.forEach((d,e)=>{if(e[0]===Mh||e[0]===Lh)e=e.substring(1),Th(a,e,d)});null===a.H||!b.e&&b!==a||a.db.Z(a,!0)}function Gg(a,b){const c=a.
|
|
684
|
+
olympe.dc.ta.DESTINATION;for(const [c,d]of this.ba(a))if(a=c.tag(),d.yd())this.j(a,d.F());else if(c.yd())d.D()&&this.j(a,c.F());else{c.zb().forEach((e,f)=>{void 0!==d.Pa(f)&&c.Z(f)});for(const [e,f,g]of c.Id()){const h=d.lb(e,b,f);void 0!==h&&g!==h&&this.N(e,a,f)}}return this}*ba(a){var b=this.Bb;const c=a.Bb,d=(a=a.H()>this.H())?c:b;b=a?b:c;for(const [e,f]of b)b=d.get(e),void 0!==b&&(yield[a?f:b,a?b:f])}};olympe.dc.db.ec.ya=[olympe.dc.Writable,olympe.dc.ir];const Jh=olympe.dc.db.Database.j,Kh=olympe.dc.db.Database.D.ej,Lh=olympe.dc.db.Database.D.Iu,Mh=olympe.dc.db.Database.D.Xe,Nh=olympe.dc.db.Database.D.El,Oh=olympe.dc.db.Database.D.Hi,U=olympe.dc.ta.ORIGIN,V=olympe.dc.ta.DESTINATION,Ph=olympe.dc.fc.Zc,Qh=olympe.dc.fc.Li;function ng(a,b,c=!1){const d=a.get(Mh+b);return c||void 0!==d?d:a.get(Lh+b)}function Eg(a,b){const c=a.e!==b;c&&(b?(a.e=b,Rh(a)):(Sh(a),a.e=b),a.db.D(b?Jh.hm:Jh.Dc,a.j));return c}
|
|
685
|
+
function Fg(a,b){const c=a.model();if(null!==c){if(c===b)return;a.unlink(Ph,c)}a.link(Ph,b);b.forEach((d,e)=>{if(e[0]===Mh||e[0]===Lh)e=e.substring(1),Th(a,e,d)});null===a.H||!b.e&&b!==a||a.db.Z(a,!0)}function Gg(a,b){const c=a.ff();if(null!==c){if(c===b)return;a.unlink(Qh,c)}a.link(Qh,b);const d=new Map;b.forEach((e,f)=>{if(f[0]===Mh||f[0]===Lh)f=f.substring(1),a.has(Mh+f)||(a.set(Lh+f,e),d.set(f,e))});Uh(a,d)}
|
|
686
686
|
function Hg(a,b){a.unlink(Ph,b);a.forEach((c,d)=>{c=d.substring(1);Th(a,c,null)});a.db.Z(a,!1)}function Ig(a,b){a.unlink(Qh,b);const c=new Map;a.forEach((d,e)=>{e[0]===Lh&&(a.delete(e),d=e.substring(1),c.set(d,null))});Uh(a,c)}
|
|
687
|
-
function Qg(a,b,c){const d=Mh+b;var e=a.get(d);e=void 0===e?null:e;if(!Vh(e,c))if(Wh(a,b,e,c,!0),e=Lh+b,null===c){a.delete(d);let f;c=null==(f=a.
|
|
688
|
-
function dh(a,b,c){const d=Yh(a,Oh+b,c);void 0!==d&&(a.detach(olympe.dc.db.Instance.j.Hi+b),a.db.D(Jh.
|
|
689
|
-
function Wh(a,b,c,d,e){c instanceof olympe.dc.vc&&(Zh(a.db.get(c.W())),a.db.wa(c.W()));d instanceof olympe.dc.vc&&(c=a.db.N(d.W(),!0),c.D&&c.D.tag!==a.j&&a.db.Wa().fatal('Instance',d.W(),'referenced multiple times!\nThis instance is currently property of',c.D.tag,'(for the property '+c.D.Ca+')','and is assigned as a property of',a.j,'(for the property '+b+')'),d=c,a=a.j,void 0===d.D&&(d.
|
|
690
|
-
function $h(a,b,c,d){a.e&&a.db.
|
|
687
|
+
function Qg(a,b,c){const d=Mh+b;var e=a.get(d);e=void 0===e?null:e;if(!Vh(e,c))if(Wh(a,b,e,c,!0),e=Lh+b,null===c){a.delete(d);let f;c=null==(f=a.ff())?void 0:ng(f,b);c=void 0===c?null:c;null!==c&&a.set(e,c);Uh(a,(new Map).set(b,c))}else void 0!==a.get(e)&&a.delete(e),a.set(d,c),Uh(a,(new Map).set(b,c))}function gh(a,b,c,d){const e=Xh(a,Oh+b);return e.has(c)?!1:(e.set(c,d),a.ne(olympe.dc.db.Instance.j.Hi+b),a.db.D(Jh.Lo,a.j,b,c),!0)}
|
|
688
|
+
function dh(a,b,c){const d=Yh(a,Oh+b,c);void 0!==d&&(a.detach(olympe.dc.db.Instance.j.Hi+b),a.db.D(Jh.Mo,a.j,b,c));return d}function mh(a,b,c,d){const e=(...f)=>{var g=f.length;const h=f[g-2];if(g=a.db.get(f[g-1])){const k=olympe.dc.db.Instance.j.iw+b;h?g.ne(k):g.detach(k)}d(...f)};return gh(a,b,c,e)?e:null}function Vh(a,b){return a instanceof Date?b instanceof Date&&a.getTime()===b.getTime():null!==a&&'function'===typeof a.Ea?a.Ea(b):a===b}
|
|
689
|
+
function Wh(a,b,c,d,e){c instanceof olympe.dc.vc&&(Zh(a.db.get(c.W())),a.db.wa(c.W()));d instanceof olympe.dc.vc&&(c=a.db.N(d.W(),!0),c.D&&c.D.tag!==a.j&&a.db.Wa().fatal('Instance',d.W(),'referenced multiple times!\nThis instance is currently property of',c.D.tag,'(for the property '+c.D.Ca+')','and is assigned as a property of',a.j,'(for the property '+b+')'),d=c,a=a.j,void 0===d.D&&(d.ne(olympe.dc.db.Instance.j.fj+a+':'+b),d.db.Ua(d.j,a,b)),d.D={tag:a,Ca:b,lz:e})}
|
|
690
|
+
function $h(a,b,c,d){a.e&&a.db.Qe(a.j,b,c,d)}function Uh(a,b,c=[]){const d=a.get(U+Ph);void 0!==d&&d.forEach(e=>{b.forEach((f,g)=>Th(e,g,f))});a=a.get(U+Qh);void 0!==a&&a.forEach((e,f)=>{if(!c.includes(e.tag())){var g=new Map;b.forEach((h,k)=>{e.has(Mh+k)||(g.set(k,h),null!==h?e.set(Lh+k,h):e.delete(Lh+k))});Uh(e,g,[...c,f])}})}function Xh(a,b){let c;return null!=(c=a.get(b))?c:a.create(b)}function ai(a,b,c,d,e){a.db.ef(a.j,b,c,d.j,e)}
|
|
691
691
|
function Yh(a,b,c){const d=a.get(b);if(void 0!==d){const e=d.get(c);d.delete(c);0===d.size&&a.delete(b);return e}}function Th(a,b,c){if(!a.has(Kh+b)){const d=Nh+b,e=a.get(d);Vh(c,void 0!==e?e:null)||(null===c?a.delete(d):a.set(d,c),$h(a,b,c,null!==c))}}function Rh(a){a.forEach((b,c)=>{const d=c[0];if(d===U||d===V){const e=c.substring(1),f=d===U?V:U;b.forEach(g=>{g.e&&(ai(a,e,d,g,!0),ai(g,e,f,a,!0))})}else if(d===Kh||d===Nh)c=c.substring(1),$h(a,c,b,d===Nh)})}
|
|
692
|
-
function Sh(a){a.forEach((b,c)=>{const d=c[0];if(d!==Oh){var e=c.substring(1);d===U?b.forEach(f=>{f.unlink(e,a)}):d===V?b.forEach(f=>{a.unlink(e,f)}):d===Kh?a.update(e,null):d===Mh&&Qg(a,e,null);a.delete(c)}});if(void 0!==a.D){const b=a.db.get(a.D.tag),c=a.D.
|
|
692
|
+
function Sh(a){a.forEach((b,c)=>{const d=c[0];if(d!==Oh){var e=c.substring(1);d===U?b.forEach(f=>{f.unlink(e,a)}):d===V?b.forEach(f=>{a.unlink(e,f)}):d===Kh?a.update(e,null):d===Mh&&Qg(a,e,null);a.delete(c)}});if(void 0!==a.D){const b=a.db.get(a.D.tag),c=a.D.lz;let d,e;(null==(d=b.get(`${c?Mh:Kh}${a.D.Ca}`))?void 0:null==(e=d.W)?void 0:e.call(d))===a.j&&(c?Qg(b,a.D.Ca,null):b.update(a.D.Ca,null))}}
|
|
693
693
|
function Zh(a){void 0!==a.D&&(a.detach(olympe.dc.db.Instance.j.fj+a.D.tag+':'+a.D.Ca),a.db.Ua(a.j,a.D.tag,a.D.Ca),a.D=void 0)}
|
|
694
|
-
olympe.dc.db.Instance=class extends Map{constructor(a,b){super();this.j=a;this.H=null;this.e=!1;this.D=void 0;this.c=0;this.N=!1;this.db=b}tag(){return this.j}Ja(){return this.e}F(){return this.db.F(this.j)}source(){return this.H}model(){const a=this.get(V+Ph);let b;return null!=(b=a&&Array.from(a.values())[0])?b:null}
|
|
695
|
-
var b=this.model();if(b){var c=b.Pa(olympe.dc.CloudObject.nameProp.W())||'No model name';a+=`\nModel: ${b.j}, Exist: ${b.e}, Model name: ${c}`}else a+='\nModel: no model';(b=this.
|
|
696
|
-
a,d,b,!1),d=Nh+a,null===b){this.delete(c);let e;b=null==(e=this.model())?void 0:ng(e,a);void 0!==b?(this.set(d,b),$h(this,a,b,!0)):$h(this,a,null,!1)}else this.set(c,b),this.delete(d),$h(this,a,b,!1)}link(a,b){var c=U+a;const d=Xh(this,V+a);c=Xh(b,c);d.has(b.j)||(d.set(b.j,b),c.set(this.j,this),this.db.D(Jh.
|
|
697
|
-
a,V,b.j),this.db.D(Jh.
|
|
698
|
-
this.j)}clear(){this.forEach((a,b)=>{const c=b[0];if(c===U||c===V){const d=b.substring(1),e=c===U?V:U;a.forEach(f=>{const g=f.get(e+d);g.delete(this.j);0===g.size&&f.delete(e+d)})}c===Kh&&a instanceof olympe.dc.vc&&Zh(this.db.get(a.W()))});void 0!==this.D&&this.db.get(this.D.tag).delete(Kh+this.D.Ca)}create(a){const b=new Map;this.set(a,b);return b}};olympe.dc.db.Instance.j={
|
|
699
|
-
this.
|
|
694
|
+
olympe.dc.db.Instance=class extends Map{constructor(a,b){super();this.j=a;this.H=null;this.e=!1;this.D=void 0;this.c=0;this.N=!1;this.db=b}tag(){return this.j}Ja(){return this.e}F(){return this.db.F(this.j)}source(){return this.H}model(){const a=this.get(V+Ph);let b;return null!=(b=a&&Array.from(a.values())[0])?b:null}ff(){const a=this.get(V+Qh);let b;return null!=(b=a&&Array.from(a.values())[0])?b:null}toString(){var a=this.Pa(olympe.dc.CloudObject.nameProp.W());a=`Instance: ${this.j}, Exist: ${this.e}, Name: ${a}`;
|
|
695
|
+
var b=this.model();if(b){var c=b.Pa(olympe.dc.CloudObject.nameProp.W())||'No model name';a+=`\nModel: ${b.j}, Exist: ${b.e}, Model name: ${c}`}else a+='\nModel: no model';(b=this.ff())?(c=b.Pa(olympe.dc.CloudObject.nameProp.W())||'No extension name',a+=`\nExtension: ${b.j}, Exist: ${b.e}, Extension name: ${c}`):a+='\nExtension: no extension';return a}Pa(a,b=!1){const c=this.get(Kh+a);return b||void 0!==c?c:this.get(Nh+a)}update(a,b){const c=Kh+a;var d=this.get(c);d=void 0===d?null:d;if(!Vh(d,b))if(Wh(this,
|
|
696
|
+
a,d,b,!1),d=Nh+a,null===b){this.delete(c);let e;b=null==(e=this.model())?void 0:ng(e,a);void 0!==b?(this.set(d,b),$h(this,a,b,!0)):$h(this,a,null,!1)}else this.set(c,b),this.delete(d),$h(this,a,b,!1)}link(a,b){var c=U+a;const d=Xh(this,V+a);c=Xh(b,c);d.has(b.j)||(d.set(b.j,b),c.set(this.j,this),this.db.D(Jh.Ik,this.j,a,V,b.j),this.db.D(Jh.Ik,b.j,a,U,this.j),this.e&&b.e&&(ai(this,a,V,b,!0),ai(b,a,U,this,!0)))}unlink(a,b){const c=U+a;void 0!==Yh(this,V+a,b.j)&&(Yh(b,c,this.j),this.db.D(Jh.Wm,this.j,
|
|
697
|
+
a,V,b.j),this.db.D(Jh.Wm,b.j,a,U,this.j),this.e&&b.e&&(ai(this,a,V,b,!1),ai(b,a,U,this,!1)))}persist(){this.N=!0;return this}ne(){this.c++;1===this.c&&this.db.D(Jh.js,this.j)}detach(){0<this.c?--this.c:this.db.D(Jh.rr,this.j,`Try to decrease references on instance ${this.j} but the reference counter is already 0.\n`+'It happens when you try to remove a callback from an instance multiple times.\nThis counter reference is used for garbage collection of instances in the database.');0===this.c&&this.db.D(Jh.gn,
|
|
698
|
+
this.j)}clear(){this.forEach((a,b)=>{const c=b[0];if(c===U||c===V){const d=b.substring(1),e=c===U?V:U;a.forEach(f=>{const g=f.get(e+d);g.delete(this.j);0===g.size&&f.delete(e+d)})}c===Kh&&a instanceof olympe.dc.vc&&Zh(this.db.get(a.W()))});void 0!==this.D&&this.db.get(this.D.tag).delete(Kh+this.D.Ca)}create(a){const b=new Map;this.set(a,b);return b}};olympe.dc.db.Instance.j={aq:'instance',iw:'rel',Hi:'cb',fj:'ref',TRANSACTION:'tx'};olympe.dc.db.Jh=class a{constructor(b){this.Hc=b;this.R=this.Ha=null;this.Ob=olympe.dc.Lb.NONE;this.state=a.j.Xk;this.j=this.ob=this.Ub=this.X=this.properties=null}tag(){return this.Hc}Vb(){return this.R}jb(){return this.Ha}getState(){return this.state}wa(b){if(null===this.R)this.R=b;else if(this.R!==b)throw Error(`Try to set a model relation with another model ${b} than the one set initially ${this.R}`);return this}F(){return this.state===a.j.Dc?this.Ob:olympe.dc.Lb.NONE}create(b){this.state=a.j.Em;
|
|
699
|
+
this.Ha=null!=b?b:null;return this}delete(b=olympe.dc.Lb.NONE){this.state=a.j.Dc;this.Ob=b;this.properties=null;return this}ja(b,c){if(this.state===a.j.Dc)return this;this.properties||(this.properties=new Map);this.properties.set(b,c);return this}qn(b){this.state!==a.j.Dc&&(this.properties||(this.properties=new Map),b.forEach((c,d)=>{this.properties.set(d,c)}))}Md(b,c){if(null!==this.X&&this.X!==b)throw Error('An instance should never be set as complex property of multiple instances');this.X=b;this.Ub=
|
|
700
700
|
c}Z(b){let c;null==(c=this.properties)||c.delete(b);0===this.properties.size&&(this.properties=null)}link(b,c){null===this.ob&&(this.ob=new Map);b===olympe.dc.fc.Zc&&this.wa(c);this.ra(this.ob,b,c,!0);return this}unlink(b,c){null===this.ob&&(this.ob=new Map);b===olympe.dc.fc.Zc&&this.wa(c);this.ra(this.ob,b,c,!1);return this}vb(b,c){null===this.j&&(this.j=new Map);this.ra(this.j,b,c,!0)}Gc(b,c){null===this.j&&(this.j=new Map);this.ra(this.j,b,c,!1)}lb(b,c,d){if(c=c===olympe.dc.ta.ORIGIN?this.j:this.ob)return(b=
|
|
701
|
-
c.get(b))&&b.get(d)}H(b,c,d){const e=(c=c===olympe.dc.ta.ORIGIN?this.j:this.ob)&&c.get(b);e&&e.delete(d);e&&0===e.size&&c.delete(b)}D(){return this.state===a.j.
|
|
702
|
-
e]){return function*(d){if(d=d&&d.get(b.W()))for(const [e,f]of d)yield c(e,f)}(b.La()===olympe.dc.ta.ORIGIN?this.j:this.ob)}Ib(b){const c=b.La()===olympe.dc.ta.ORIGIN?this.j:this.ob;return(b=c&&c.get(b.W()))&&0!==b.size?Array.from(b.keys())[0]:null}Id(b=(c,d,e)=>[c,d,e]){return this.ia(this.ob,b)}Ua(b=(c,d,e)=>[c,d,e]){return this.ia(this.j,b)}
|
|
703
|
-
b(h,c,k,l))}(this.ia.bind(this),this.ob,this.j)}ra(b,c,d,e){if(this.state!==a.j.Dc||!e){var f=b.get(c);if(void 0===f)f=new Map,b.set(c,f);else if(b=f.get(d),void 0!==b&&b!==e){f.delete(d);return}f.set(d,e)}}*ia(b,c){if(null!==b)for(const [d,e]of b){b=e.entries();for(const [f,g]of b)yield c(d,f,g)}}};olympe.dc.db.Jh.j={
|
|
704
|
-
' (name: '+c.get(e)+') has no model.\nList: '+d.join(' --M--\x3e ')}this.G.info(a)}else this.G.info('[DATABASE] Instance',b,'has never been created or referred by the database')}init(){const a=olympe.dc.db.Database.j.
|
|
705
|
-
k,h,`monitorRelations${k}`)})});this.j.j(c,k=>{this.j.vb(()=>{oh(this.view,k,`monitorRelations${k}`)})});this.j.j(d,()=>{});this.j.j(e,()=>{});this.j.j(f,()=>{});this.j.j(g,()=>{})}};olympe.dc.db.
|
|
706
|
-
this.transactionId);this.j.
|
|
701
|
+
c.get(b))&&b.get(d)}H(b,c,d){const e=(c=c===olympe.dc.ta.ORIGIN?this.j:this.ob)&&c.get(b);e&&e.delete(d);e&&0===e.size&&c.delete(b)}D(){return this.state===a.j.Em}yd(){return this.state===a.j.Dc}hd(){let b=this.properties?this.properties.size:0,c;null==(c=this.ob)||c.forEach(d=>{b+=d.size});return b}N(){return null!==this.properties}Fd(){return null!==this.ob||null!==this.j}zb(){let b;return null!=(b=this.properties)?b:new Map}Pa(b){if(this.properties)return this.properties.get(b)}cb(b,c=(d,e)=>[d,
|
|
702
|
+
e]){return function*(d){if(d=d&&d.get(b.W()))for(const [e,f]of d)yield c(e,f)}(b.La()===olympe.dc.ta.ORIGIN?this.j:this.ob)}Ib(b){const c=b.La()===olympe.dc.ta.ORIGIN?this.j:this.ob;return(b=c&&c.get(b.W()))&&0!==b.size?Array.from(b.keys())[0]:null}Id(b=(c,d,e)=>[c,d,e]){return this.ia(this.ob,b)}Ua(b=(c,d,e)=>[c,d,e]){return this.ia(this.j,b)}ba(b=(c,d,e,f)=>[c,d,e,f]){const c=olympe.dc.ta.ORIGIN,d=olympe.dc.ta.DESTINATION;return function*(e,f,g){yield*e(f,(h,k,l)=>b(h,d,k,l));yield*e(g,(h,k,l)=>
|
|
703
|
+
b(h,c,k,l))}(this.ia.bind(this),this.ob,this.j)}ra(b,c,d,e){if(this.state!==a.j.Dc||!e){var f=b.get(c);if(void 0===f)f=new Map,b.set(c,f);else if(b=f.get(d),void 0!==b&&b!==e){f.delete(d);return}f.set(d,e)}}*ia(b,c){if(null!==b)for(const [d,e]of b){b=e.entries();for(const [f,g]of b)yield c(d,f,g)}}};olympe.dc.db.Jh.j={Em:0,Xk:1,Dc:2};olympe.dc.db.Hv=class{constructor(a,b,c,d){this.G=a;this.view=b;this.j=c;(this.active=d.get('active'))&&this.init()}debug(a){const b=olympe.dc.ea(a);if(this.j.has(b)){var c=this.j.get(a);a='\n[DEBUG - DATABASE]\n'+c.toString();if(!c.Ja()){const d=[];for(;null!==c&&!d.includes(c.tag());)d.push(c.tag()),c=c.model();c=this.j.get(d[d.length-1]);const e=olympe.dc.db.Database.D.ej+olympe.dc.CloudObject.nameProp.W();d.push('???');a+='\n\nThe instance <<'+b+'>> does not exists because the instance '+c.tag()+
|
|
704
|
+
' (name: '+c.get(e)+') has no model.\nList: '+d.join(' --M--\x3e ')}this.G.info(a)}else this.G.info('[DATABASE] Instance',b,'has never been created or referred by the database')}init(){const a=olympe.dc.db.Database.j.op,b=olympe.dc.db.Database.j.hm,c=olympe.dc.db.Database.j.Dc,d=olympe.dc.db.Database.j.Ik,e=olympe.dc.db.Database.j.Wm,f=olympe.dc.db.Database.j.Lo,g=olympe.dc.db.Database.j.Mo,h=()=>{};this.j.j(olympe.dc.db.Database.j.np,()=>{});this.j.j(a,()=>{});this.j.j(b,k=>{this.j.vb(()=>{nh(this.view,
|
|
705
|
+
k,h,`monitorRelations${k}`)})});this.j.j(c,k=>{this.j.vb(()=>{oh(this.view,k,`monitorRelations${k}`)})});this.j.j(d,()=>{});this.j.j(e,()=>{});this.j.j(f,()=>{});this.j.j(g,()=>{})}};olympe.dc.db.hn=class{constructor(a,b,c,d){this.G=a;this.j=b;this.ha=c;this.F=d;this.transactionId=null}open(a){if(null!==this.transactionId)throw Error('A transaction is already open');this.transactionId=this.j.tg(a);this.G.debug(`DB Writer: transaction ${this.transactionId} opened`)}write(a,b){b&&(b=new bi(this.ha),a.qc(b),this.G.info(b.flush()));if(null===this.transactionId)throw Error('You must first open a transaction before to write');this.G.debug('DB Writer: writing patch',a.T(),'for transaction',
|
|
706
|
+
this.transactionId);this.j.ht(this.transactionId,()=>a.qc(this))}close(){if(null===this.transactionId)throw Error('No transaction is open');this.j.ke(this.transactionId);this.G.debug(`DB Writer: transaction ${this.transactionId} committed`);this.transactionId=null}Sc(a,b,c,d){this.j.create(a,b,c,this.F);d&&this.j.link(olympe.dc.fc.Zc,a,d)}Yc(a,b){this.j.update(a,b)}D(a,b=olympe.dc.Lb.NONE){for(const c of mg(this.ha,a,b))this.j.wa(c)}Oa(a,b,c){this.j.link(a,b,c)}hc(a,b,c){this.j.unlink(a,b,c)}};
|
|
707
707
|
function ci(a,b,c){if(!b)return'';let d='';if(c&&1<c)return'...';for(const [e,f]of b)if(d+=(d?', "':'"')+e+'":',!f)d+=JSON.stringify(f);else if(f instanceof olympe.dc.vc||f instanceof olympe.dc.CloudObject)d+='Reference("'+f.W()+'")';else if(f instanceof olympe.C.Color)d+='Color("'+f.oh()+','+f.lh()+','+f.hh()+','+f.gh()+'")';else if(f.constructor&&Object.prototype.hasOwnProperty.call(f.constructor.prototype,'toString'))d+=JSON.stringify(f.toString());else if('object'===typeof f){let g;d+=ci(a,f,
|
|
708
708
|
(null!=(g=c)?g:0)+1)}return'{'+(d?d:'')+'}'}function di(a,b){let c;return'string'===typeof b?null!=(c=a.db.name(b))?c:b:''}function ei(a,b){let c;return b===olympe.dc.fc.Zc?'Model':null!=(c=a.db.name(b))?c:b}
|
|
709
709
|
class bi{constructor(a){this.db=a;this.output='Applying patch on the local database'}flush(){const a=this.output;this.output='';return a}log(a,b){this.output+=`\ndb.${a};${b?`// ${b}`:''}`}Sc(a,b,c,d){this.log(`createInstance(tag: ${a}, source: ${b}, ${ci(this,c)})`,di(this,d))}Yc(a,b,c){this.log(`updateInstance(tag: ${a}, ${ci(this,b)})`,di(this,c))}D(a,b,c){this.log(`deleteInstance("${a}", rule: ${b})`,di(this,c))}Oa(a,b,c){this.log(`createRelation("${a}", "${b}", "${c}")`,ei(this,a))}hc(a,b,c){this.log(`deleteRelation("${a}", "${b}", "${c}")`,
|
|
710
|
-
ei(this,a))}}olympe.dc.db.
|
|
711
|
-
olympe.V.config(function(a){E(a,olympe.dc.db.Config.
|
|
712
|
-
new olympe.V.oa(olympe.dc.db.Config.
|
|
713
|
-
new olympe.V.oa(olympe.dc.db.Config.Yi),new olympe.V.oa(olympe.dc.db.Config.
|
|
714
|
-
olympe.dc.query.xf=class{constructor(a,b,c){this.db=olympe.dc.
|
|
715
|
-
d)=>c.compare(d));olympe.
|
|
716
|
-
olympe.dc.query.
|
|
717
|
-
Nf(this.db,a,`${this.D}:${a}:notif`))}};olympe.dc.query.
|
|
710
|
+
ei(this,a))}}olympe.dc.db.hn.ya=[olympe.dc.Writable,olympe.dc.Writable];olympe.dc.db.P={Da:'dc.db.Logger',nm:'dc.db.gc.Logger',Fa:'dc.db.DatabaseManager',bk:'dc.db.Database',$l:'dc.db.DBView',QB:'dc.db.Graph',SA:'dc.db.DatabaseWriter',FC:'dc.db.PermissionProcessor',Yi:'dc.db.GraphMonitor'};olympe.dc.db.Config={Dp:'db.garbageCollector',Ep:'db.garbageCollectorDelay',Sl:'db.commitBufferTimeout',Yi:'db.monitor',Gv:'db.monitorCounters',Fv:'db.monitorCallbacks',fp:'db.debug'};
|
|
711
|
+
olympe.V.config(function(a){E(a,olympe.dc.db.Config.Dp,olympe.dc.db.Af.j.ko);E(a,olympe.dc.db.Config.Ep,5E3);E(a,olympe.dc.db.Config.Sl,3E4);E(a,olympe.dc.db.Config.Yi,!1);E(a,olympe.dc.db.Config.fp,!1);D(a,olympe.dc.db.P.Da,[olympe.ga.P.Fa],b=>b.ad('db'));D(a,olympe.dc.db.P.nm,[olympe.ga.P.Fa],b=>b.ad('gc'));D(a,olympe.dc.db.P.bk,[olympe.dc.db.P.Da,olympe.dc.db.P.nm,new olympe.V.oa(olympe.dc.Config.Xg),new olympe.V.oa(olympe.dc.db.Config.Dp),new olympe.V.oa(olympe.dc.db.Config.Ep),new olympe.V.oa(olympe.dc.Config.Yh),
|
|
712
|
+
new olympe.V.oa(olympe.dc.db.Config.fp)],(b,c,d,e,f,g,h)=>{e=g?olympe.dc.db.Af.j.em:e;d=(new Map).set('selfTag',d).set('garbageCollector',e).set('garbageCollectorDelay',f).set('debug',h);return new olympe.dc.db.Database(b,c,d)});C(a,olympe.dc.db.P.$l,olympe.dc.kb,olympe.dc.db.P.Da,olympe.dc.db.P.bk);D(a,olympe.dc.db.P.Yi,[olympe.dc.db.P.Fa],b=>b.zz);D(a,olympe.dc.db.P.Fa,[olympe.dc.db.P.Da,olympe.dc.db.P.bk,olympe.dc.db.P.$l,new olympe.V.oa(olympe.dc.Config.bg),new olympe.V.oa(olympe.dc.db.Config.Sl),
|
|
713
|
+
new olympe.V.oa(olympe.dc.db.Config.Yi),new olympe.V.oa(olympe.dc.db.Config.Gv),new olympe.V.oa(olympe.dc.db.Config.Fv)],(b,c,d,e,f,g,h,k)=>{g=(new Map).set('active',g).set('counters',h).set('callbacks',k);e=(new Map).set('debug',e).set('bufferTimeout',f);return new olympe.dc.db.lu(b,c,d,e,g)})},'olympe.dc.db');olympe.V.run([olympe.dc.db.P.bk,olympe.dc.db.P.Yi],(a,b)=>{olympe.de().db=a;olympe.de().dbMonitor=b},'DC.DB debug service injection');olympe.dc.query={};function fi(a){return(b,c)=>{const d=null===b,e=null===c;return d||e?d&&e?0:d?1:-1:a(b,c)}}
|
|
714
|
+
olympe.dc.query.xf=class{constructor(a,b,c){this.db=olympe.dc.ha();this.j=a;this.Ca=b;this.Wi=c}fa(){return{p:this.Ca.W(),o:this.Wi}}toString(){return'sortByQueryPart-'+this.Wi+this.Ca.W()}jh(){const a=this.db.Ib(this.Ca,olympe.dm.Property.typeRel),b=olympe.dc.ea;if(this.db.Vf(a,olympe.dm.String))return fi((c,d)=>c.localeCompare(d));if(a===b(olympe.dm.Number)||a===b(olympe.dm.Boolean))return fi((c,d)=>c-d);if(a===b(olympe.dm.DateTime))return fi((c,d)=>c.getTime()-d.getTime());if(a===b(olympe.dm.Color))return fi((c,
|
|
715
|
+
d)=>c.compare(d));olympe.ga.Wa('dc.query').warn(`No comparator found for type with tag ${a}`);return fi(()=>-1)}Pa(){return this.Ca}};olympe.dc.Ye=class{W(){}};olympe.dc.Ye.prototype.getTag=olympe.dc.Ye.prototype.W;olympe.dc.TB=olympe.dc.Ye;function gi(a){let b;if(null==(b=a.j)?0:b.nf())if(a=a.N,!a.N){let c;null==(c=a.R)||c.call(a)}}function hi(a,b,c,d,e){gi(a);let f,g;b?null==(f=a.j)||f.Oa(c,d,e):null==(g=a.j)||g.hc(c,d,e)}function ii(a){let b;const c=!(null==(b=a.j)?0:b.nf());a.F=c?a.j:null;a.H.forEach(d=>d());a.H=[];c&&(a.j=new olympe.dc.db.ec,a.G.j()&&a.G.debug(`Commit notification with ${a.F.H()} operations for query ${a.D}`))}
|
|
716
|
+
olympe.dc.query.Nv=class{constructor(a,b,c,d){this.G=a;this.source=b;this.D=c;this.N=d;this.j=this.F=null;this.db=olympe.dc.ha();this.H=[]}watch(a,b){if(this.db.source(a)===this.source){var c=`${this.D}:${a}:notif`;Pf(this.db,a,(d,e)=>{if(d){gi(this);let f;null==(f=this.j)||f.Z(e)}else if(b&&kh(this.db,e,c),!this.db.Ja(e)){gi(this);let f;null==(f=this.j)||f.D(e,olympe.dc.Lb.NONE)}},c);b&&jh(this.db,a,(d,e,f)=>{gi(this);let g;f||null!=(g=this.j)&&g.Yc(a,new Map([[d,e]]))},c)}}stop(a){this.H.push(()=>
|
|
717
|
+
Nf(this.db,a,`${this.D}:${a}:notif`))}};olympe.dc.query.Bk={ASC:'ASC',DESC:'DESC'};function ji(a){const b=ki(a.query),c=new Map;for(let e=b.length;0<=e;e--){const f=0<e?b[e-1].T():a.F,g=0<e?b[e-1].j:'root',h=0<e&&b[e-1].R(),k=a.j.get(f),l=new Set(k.Vc()),n=new Map,p=a.H.has(f);let q=p?';':'';if(c.has(f)){const [r,t,v]=c.get(f);c.delete(f);q+=v;r.forEach((x,y)=>{for(const z of k.j(y)){let A;n.set(z,Array.from(x).map(K=>p?`${y};${K}`:K).reduce((K,Y)=>K.add(Y),null!=(A=n.get(z))?A:new Set))}l.delete(y)});t&&l.forEach(x=>{const y=p?`${x};${v}`:v;for(const z of k.j(x)){let A;n.set(z,
|
|
718
718
|
(null!=(A=n.get(z))?A:new Set).add(y))}})}else l.forEach(r=>{const t=p?`${r};`:'';for(const v of k.j(r))n.has(v)?n.get(v).add(t):n.set(v,(new Set).add(t))});if(0<e&&c.has(g)){const [r,t,v]=c.get(g),x=new Map;n.forEach((y,z)=>{let A;null==(A=r.get(z))||A.forEach(K=>{let Y;const ya=null!=(Y=x.get(z))?Y:new Set;y.forEach(db=>ya.add(db+K));x.set(z,ya)});n.delete(z);r.delete(z)});t&&n.forEach((y,z)=>{x.set(z,new Set(Array.from(y).map(A=>A+v)))});b[e-1].R()&&r.forEach((y,z)=>{x.set(z,new Set(Array.from(y).map(A=>
|
|
719
719
|
q+A)))});c.set(g,[x,t&&h,q+v])}else c.set(g,[n,h,q])}let d;a=null==(d=c.get('root'))?void 0:d[0].get('root');return Array.from(null!=a?a:[]).map(e=>e.slice(0,-1).split(';'))}function li(a){if(null===a.D){const b={Gb:a.query.jh(),Ld:a.Ld,max:a.query.j.max,offset:a.query.j.offset};a.D=olympe.dc.Ka.from(a.X,ji(a),b)}return a.D}function mi(a,b){a.R=b}function ni(a){if(!a.N){null!==a.D&&(a.X=a.D);a.D=null;a.N=!0;let b;null==(b=a.R)||b.call(a)}}
|
|
720
|
-
function oi(a,b){let c;return null!=(c=a.j.get(b).Vc())?c:[]}function pi(a,b,c){let d,e;return null!=(e=null==(d=a.j.get(c))?void 0:d.has(b))?e:!1}function qi(a,b,c=a.F,d='root'){const e=a.j.get(c);if(!e)return a.G.error('Try to insert result entry to a higher level than possible'),null;const f=!e.has(b);e.D(b,d)&&ni(a);let g;f&&(null==(g=a.
|
|
721
|
-
function si(a){a.G.j()&&a.G.debug(`Start sending notifications for query ${a.query.T()}`);const b=new olympe.dc.query.
|
|
722
|
-
olympe.dc.query.
|
|
723
|
-
this.j.get(b);if(null==b?0:b.remove(a,c))if(ni(this),!b.has(a)){let d;null==(d=this.
|
|
724
|
-
function wi(a){var b=olympe.dc.query.za.j.
|
|
725
|
-
case d:return new olympe.dc.query.Y.yf(a.p,a.s,olympe.dc.
|
|
726
|
-
2===a.t?a.v.map(n=>new Date(n)):a.v,new olympe.dc.query.Y.
|
|
727
|
-
olympe.dc.query.za=class{observe(){}mb(){}compile(){return[[this]]}zd(){return new olympe.dc.query.Y.
|
|
728
|
-
b,olympe.dc.
|
|
729
|
-
return new olympe.dc.query.Y.
|
|
730
|
-
olympe.dc.query.za.regex=olympe.dc.query.za.
|
|
731
|
-
function xi(a,b){var c=b.relation,d=olympe.dm.Relation.originModelRel,e=olympe.dm.Relation.destinationModelRel;d=a.db.Ib(c,c.La()===olympe.dc.ta.ORIGIN?e:d);if(0>a.cursor)e=a.j.
|
|
720
|
+
function oi(a,b){let c;return null!=(c=a.j.get(b).Vc())?c:[]}function pi(a,b,c){let d,e;return null!=(e=null==(d=a.j.get(c))?void 0:d.has(b))?e:!1}function qi(a,b,c=a.F,d='root'){const e=a.j.get(c);if(!e)return a.G.error('Try to insert result entry to a higher level than possible'),null;const f=!e.has(b);e.D(b,d)&&ni(a);let g;f&&(null==(g=a.Se)||g.watch(b,a.H.has(c)));return f}function ri(a,b,c,d,e,f){null!==a.Se&&(d===olympe.dc.ta.ORIGIN?hi(a.Se,b,c,f,e):hi(a.Se,b,c,e,f))}
|
|
721
|
+
function si(a){a.G.j()&&a.G.debug(`Start sending notifications for query ${a.query.T()}`);const b=new olympe.dc.query.Nv(a.G,a.query.jb(),a.query.T(),a);a.j.forEach((c,d)=>{for(const e of c.Vc())b.watch(e,a.H.has(d))});null!=b.j||(b.j=new olympe.dc.db.ec);a.Se=b}function ti(a){null!==a.Se&&(a.G.j()&&a.G.debug(`Stop sending notifications for query ${a.query.T()}`),a.j.forEach(b=>{for(const c of b.Vc())a.Se.stop(c)}),a.Se=null)}function ui(a){a.N=!1;let b;null==(b=a.Se)||ii(b)}
|
|
722
|
+
olympe.dc.query.gr=class{constructor(a,b){this.G=a;this.query=b;this.F=olympe.U.rb(b.D);this.ma=new Map;this.j=(new Map).set(this.F,new olympe.dc.query.ma.bn);this.H=new Set(b.F);this.Ld=-1;this.N=!1;this.R=null;this.X=olympe.dc.Ka.empty();this.Se=this.D=null;a=ki(b);a.forEach(c=>{const d=c.T();this.ma.set(d,c.N());this.j.set(d,c.ia())});b=b.jh();if(null!==b){b=b.j;let c=-1;for(const d of[this.F].concat(a.map(e=>e.T())))if(c+=this.H.has(d)?1:0,b===d){this.Ld=c;break}}}remove(a,b=this.F,c='root'){b=
|
|
723
|
+
this.j.get(b);if(null==b?0:b.remove(a,c))if(ni(this),!b.has(a)){let d;null==(d=this.Se)||d.stop(a);return!0}return!1}Ic(a){const b=a.D,c=olympe.U.rb(b);a=ki(a);const d=[];for(const [f,g]of this.j){if(g.H(b))return!0;g.has(b)&&d.push(f)}const e=(new Map).set(c,d);return 0<d.length&&a.every(f=>{let g;const h=(null!=(g=e.get(f.j))?g:[]).flatMap(k=>f.Z(k,this.ma.get(k))).filter(k=>{let l,n;return null!=(n=null==(l=this.ma.get(k))?void 0:l.Ic(f))?n:!1});e.set(f.T(),h);return 0<h.length})}};function vi(a){if(!olympe.dc.ha().Nb(a,olympe.dm.Property))throw new olympe.dc.query.Cd(`The specified property while trying to build a query predicate is invalid: ${a}`);}
|
|
724
|
+
function wi(a){var b=olympe.dc.query.za.j.Zr;const c=olympe.dc.query.za.j.pp,d=olympe.dc.query.za.j.Zj,e=olympe.dc.query.za.j.$p,f=olympe.dc.query.za.j.Dq,g=olympe.dc.query.za.j.sr,h=olympe.dc.query.za.j.io,k=olympe.dc.query.za.j.Vq,l=olympe.dc.query.za.j.Zp;switch(a.pr){case b:return new olympe.dc.query.Y.en(a.t);case c:b=a.v;switch(a.t){case 2:b=new Date(b);break;case 3:b=olympe.dc.CloudObject.get(b);break;case 4:b=olympe.C.Color.create(b.r,b.g,b.b,b.a)}return new olympe.dc.query.Y.Ce(a.p,b,olympe.dc.ha());
|
|
725
|
+
case d:return new olympe.dc.query.Y.yf(a.p,a.s,olympe.dc.ha(),a.c);case e:return new olympe.dc.query.Y.Ti(olympe.dc.ha(),a.p,a.b,a.l,a.s);case f:return new olympe.dc.query.Y.ie(wi(a.v));case g:return new olympe.dc.query.Y.Hf(a.p,new RegExp(a.r),olympe.dc.ha(),a.c);case k:return new olympe.dc.query.Y.Ge(...a.p.map(n=>wi(n)));case h:return new olympe.dc.query.Y.Nd(...a.p.map(n=>wi(n)));case l:return b=4===a.t?a.v.map(n=>olympe.C.Color.create(n.r,n.g,n.b,n.a)):3===a.t?a.v.map(n=>olympe.dc.CloudObject.get(n)):
|
|
726
|
+
2===a.t?a.v.map(n=>new Date(n)):a.v,new olympe.dc.query.Y.jq(a.p,b);default:return null}}
|
|
727
|
+
olympe.dc.query.za=class{observe(){}mb(){}compile(){return[[this]]}zd(){return new olympe.dc.query.Y.ie(this)}zb(){}Ic(){}clear(){}fa(){}Nc(){}toString(){}Ea(a){return this===a}static dt(...a){return new olympe.dc.query.Y.en(a)}static Xz(a,b){vi(a);return new olympe.dc.query.Y.jq(a,b)}static Ea(a,b){vi(a);return new olympe.dc.query.Y.Ce(a,b,olympe.dc.ha())}static contains(a,b,c=!0){vi(a);return new olympe.dc.query.Y.yf(a,b,olympe.dc.ha(),c)}static aA(a,b,c=!0){vi(a);return new olympe.dc.query.Y.Hf(a,
|
|
728
|
+
b,olympe.dc.ha(),c)}static nl(a,b,c=!0){vi(a);return new olympe.dc.query.Y.Ti(olympe.dc.ha(),a,b,!1,c)}static Pj(a,b,c=!0){vi(a);return new olympe.dc.query.Y.Ti(olympe.dc.ha(),a,b,!0,c)}static and(...a){if(!a.every(b=>b instanceof olympe.dc.query.za))throw new olympe.dc.query.Cd(`Some specified predicates, while trying to build an AND query predicate are invalid: ${a}`);return new olympe.dc.query.Y.Nd(...a)}static or(...a){if(!a.every(b=>b instanceof olympe.dc.query.za))throw new olympe.dc.query.Cd(`Some specified predicates, while trying to build an OR query predicate are invalid: ${a}`);
|
|
729
|
+
return new olympe.dc.query.Y.Ge(...a)}static zd(a){if(!(a instanceof olympe.dc.query.za))throw new olympe.dc.query.Cd(`The specified predicate, while trying to build a NOT query predicate is invalid: ${a}`);return new olympe.dc.query.Y.ie(a)}};olympe.dc.query.za.not=olympe.dc.query.za.zd;olympe.dc.query.za.or=olympe.dc.query.za.or;olympe.dc.query.za.and=olympe.dc.query.za.and;olympe.dc.query.za.smallerThan=olympe.dc.query.za.Pj;olympe.dc.query.za.greaterThan=olympe.dc.query.za.nl;
|
|
730
|
+
olympe.dc.query.za.regex=olympe.dc.query.za.aA;olympe.dc.query.za.contains=olympe.dc.query.za.contains;olympe.dc.query.za.equals=olympe.dc.query.za.Ea;olympe.dc.query.za.propertyIn=olympe.dc.query.za.Xz;olympe.dc.query.za['in']=olympe.dc.query.za.dt;olympe.dc.query.za.j={Zr:0,pp:1,Zj:2,$p:3,Dq:4,sr:5,Vq:6,io:7,Zp:8};function ki(a){return Array.from(a.ma)}
|
|
731
|
+
function xi(a,b){var c=b.relation,d=olympe.dm.Relation.originModelRel,e=olympe.dm.Relation.destinationModelRel;d=a.db.Ib(c,c.La()===olympe.dc.ta.ORIGIN?e:d);if(0>a.cursor)e=a.j.Te;else if(e=a.ma[a.cursor],null!==e.wa)e=e.wa;else{var f=olympe.dc.ta.ORIGIN;e=olympe.dc.ha().Ib(e.relation,e.relation.La()===f?olympe.dm.Relation.originModelRel:olympe.dm.Relation.destinationModelRel)}if(a.db.Ja(olympe.dc.CloudObject)&&(null===d||!a.db.Vf(d,e)&&!a.db.Vf(e,d)))throw new olympe.dc.query.Cd(`The specified relation "${c}" is invalid at the current level "${a.db.name(e)} (${e})" of the Query you are building. Please make sure you did not forget a .back() or another relation.`);d=
|
|
732
732
|
b.T();for(c=a.cursor+1;c<a.ma.length&&a.ma[c].T()!==d;)c++;b=c<a.ma.length?a.ma:a.ma.concat(b);return new olympe.dc.la(a.D,a.source,b,c,a.F,a.j)}function yi(a,b=a.cursor){return 0<=b?a.ma[b].T():olympe.U.rb(a.D)}
|
|
733
|
-
function zi(a,b,c,d={}){var e=olympe.dc.Lb.kg;const f=(null==d?0:d.md)?d.md:olympe.dc.la.nc.wf,g=(null==d?0:d.
|
|
734
|
-
function Ai(a){const b=0===a.F.size?a.
|
|
735
|
-
olympe.dc.la=class{constructor(a,b,c=[],d=-1,e=new Set,f={max:-1,offset:0,Ld:null,
|
|
736
|
-
b=null!=b?b:olympe.dc.
|
|
737
|
-
a=null!=c?c:olympe.dc.
|
|
738
|
-
d.ma=[b?new olympe.dc.query.ma.
|
|
739
|
-
return xi(this,new olympe.dc.query.ma.
|
|
740
|
-
this.source,this.ma,this.cursor,this.F,{Ld:this.j.Ld,max:a,offset:b,
|
|
733
|
+
function zi(a,b,c,d={}){var e=olympe.dc.Lb.kg;const f=(null==d?0:d.md)?d.md:olympe.dc.la.nc.wf,g=(null==d?0:d.bo)?'__code-as-data__':void 0;b=olympe.dc.ea(b);const h=olympe.dc.ee().pe(b);b=(new olympe.dc.la(b,h)).me();b.ma=[f===olympe.dc.la.nc.Qg?new olympe.dc.query.ma.mm(yi(b),e,c):new olympe.dc.query.ma.Od(yi(b),e,c)];let k;b.H=null!=(k=null==d?void 0:d.ft)?k:!1;return b.observe(a,{md:f,cl:g})}
|
|
734
|
+
function Ai(a){const b=0===a.F.size?a.me():a;if(null!==b.j.Ld&&!b.F.has(yi(a,b.j.Ld)))throw new olympe.dc.query.Cd('AndReturn was not called for the current level before sortBy operator');return b}function Bi(a,b){let c,d;return b.H||(null!=(d=null==(c=a.N)?void 0:c.has(b.T()))?d:!1)}
|
|
735
|
+
olympe.dc.la=class{constructor(a,b,c=[],d=-1,e=new Set,f={max:-1,offset:0,Ld:null,Te:null}){this.db=olympe.dc.ha();if('string'!==typeof a||''===a)throw new olympe.dc.query.Cd('The root of the query cannot be empty.');this.D=a;this.source=b;this.ma=c;this.cursor=d;this.F=e;this.j=f;this.N=this.id=null;this.H=!1}static from(a,b){a=olympe.dc.ea(a);if(!olympe.dc.CloudObject.exists(a))throw new olympe.dc.query.Cd(`Try to create a query from an instance that does not exist (${a}). Please try to use \`Query.fromTag()\` instead.`);
|
|
736
|
+
b=null!=b?b:olympe.dc.ee().pe(a);b=new olympe.dc.la(a,b);b.j.Te=olympe.dc.ha().model(a);return b}static pe(a,b,c){if(!olympe.dc.CloudObject.exists(b)&&!c)throw new olympe.dc.query.Cd(`Try to create a query from an instance (${a}) with an explicit datatype that does not exist (${b})`);a=olympe.dc.ea(a);c=null!=c?c:olympe.dc.ee().fromModel(b);c=new olympe.dc.la(a,c);c.j.Te=olympe.dc.ea(b);return c}static ql(a,b=!0,c){const d=olympe.dc.ea(a);var e=olympe.dc.ha();if(!e.vi(d))throw new olympe.dc.query.Cd(`Try to create a query to get instances of ${a}, which is not a data type or does not exist.`);
|
|
737
|
+
a=null!=c?c:olympe.dc.ee().fromModel(d);a=new olympe.dc.la(d,a);a.j.Te=e.model(d);b&&(a=xi(a,new olympe.dc.query.ma.De(yi(a),olympe.dc.CloudObject.extendedByRel,!0,!1)));b=a;e=new olympe.dc.query.ma.Hh(yi(a),olympe.dc.CloudObject.instancesRel,!1);e.wa=d;return xi(b,e)}static Ob(a,b,c,d,e){var f;const g=null!=(f=null==e?void 0:e.md)?f:olympe.dc.la.nc.wf;f=(null==e?0:e.bo)?'__code-as-data__':void 0;b=olympe.dc.ea(b);d=null!=d?d:olympe.dc.ee().pe(b);d=(new olympe.dc.la(b,d)).me();b=g===olympe.dc.la.nc.Qg;
|
|
738
|
+
d.ma=[b?new olympe.dc.query.ma.mm(yi(d),c):new olympe.dc.query.ma.Od(yi(d),c)];let h;d.H=null!=(h=null==e?void 0:e.ft)?h:!1;let k;return d.observe(a,{md:g,cl:f,rj:null!=(k=null==e?void 0:e.rj)?k:b})}bb(a,b=!1){if(!(a instanceof olympe.dc.Ra.Relation))throw new olympe.dc.query.Cd(`The relation given to follow() is invalid: ${a}`);return xi(this,new olympe.dc.query.ma.Hh(yi(this),a,b))}ug(a,b=!1,c=!1){if(!(a instanceof olympe.dc.Ra.Relation))throw new olympe.dc.query.Cd(`The relation given to followRecursively() is invalid: ${a}`);
|
|
739
|
+
return xi(this,new olympe.dc.query.ma.De(yi(this),a,b,c))}me(){const a=(new Set(this.F)).add(yi(this));return new olympe.dc.la(this.D,this.source,this.ma,this.cursor,a,this.j)}filter(a){if(!(a instanceof olympe.dc.query.za))throw new olympe.dc.query.Cd(`The specified predicate while trying to filter a query is invalid: ${a}`);const b=Array.from(this.ma);b[this.cursor]=b[this.cursor].filter(a);return new olympe.dc.la(this.D,this.source,b,this.cursor,this.F,this.j)}sj(){return this}Hj(a,b=0){return new olympe.dc.la(this.D,
|
|
740
|
+
this.source,this.ma,this.cursor,this.F,{Ld:this.j.Ld,max:a,offset:b,Te:this.j.Te})}Al(a,b=olympe.dc.query.Bk.ASC){if(0>this.cursor)throw new olympe.dc.query.Cd('You are trying to sort an empty query. Please first follow at least one relation to sort a query.');if(!olympe.dc.ha().Nb(a,olympe.dm.Property))throw new olympe.dc.query.Cd(`The specified property while trying to sort a query is invalid: ${a}`);const c=this.ma[this.cursor],d={Ld:this.cursor,max:this.j.max,offset:this.j.offset,Te:this.j.Te},
|
|
741
741
|
e=Array.from(this.ma);e[this.cursor]=c.sort(a,b);return new olympe.dc.la(this.D,this.source,e,this.cursor,this.F,d)}jh(){const a=this.j.Ld;let b;return null!==a?null==(b=this.ma[a])?void 0:b.jh():null}back(a=1){if(0>this.cursor||1>a)return this;let b=this.cursor;for(let c=0;c<a;c++){const d=this.ma[b].j;for(b--;-1<b&&yi(this,b)!==d;)b--}return new olympe.dc.la(this.D,this.source,Array.from(this.ma),b,this.F,this.j)}parse(){const a=new Map,b=yi(this,-1),c={limit:this.j.max,offset:this.j.offset,returned:this.F.has(b),
|
|
742
|
-
filter:[],optional:!1,inheritance:!1,next:[]};a.set(b,c);this.db.vi(this.D)?c.dataType=olympe.dc.ea(this.D):(c.root=olympe.dc.ea(this.D),c.dataType=this.j.
|
|
743
|
-
g),c.inheritance=!0;else{let h;null==(h=a.get(d.j))||h.next.push(g)}});return c}mb(a){const b=(null==a?0:a.md)?a.md:olympe.dc.la.nc.
|
|
744
|
-
a;let d;return Di(olympe.dc.query.
|
|
745
|
-
r:Array.from(this.F),s:this.source,e:{m:this.j.max,o:this.j.offset,s:this.j.Ld,rm:null!=(a=this.j.
|
|
746
|
-
olympe.dc.la.prototype.parse=olympe.dc.la.prototype.parse;olympe.dc.la.prototype.back=olympe.dc.la.prototype.back;olympe.dc.la.prototype.sortBy=olympe.dc.la.prototype.
|
|
747
|
-
olympe.dc.la.followRule=olympe.dc.la.
|
|
748
|
-
olympe.dc.query.Dd=class extends olympe.dc.Hg{constructor(a){super(a,null);this.F=new olympe.dc.transaction.
|
|
749
|
-
b,c){this.F.Oa(a,b,c,null,null);return this}fa(){return super.fa()}};olympe.dc.query.Dd.prototype.createRelation=olympe.dc.query.Dd.prototype.Oa;olympe.dc.query.Dd.prototype.create=olympe.dc.query.Dd.prototype.create;olympe.dc.query.Dd.fromQuery=olympe.dc.query.Dd.xj;function Ci(a,b){const c=new olympe.dc.query.
|
|
750
|
-
function Di(a,b,c,d,e,f){const g=b.T();let h=a.j.get(g);if(!h){var k=b.jb();a.G.debug(`Create new subscription for query ${g} for subscriber ${d}, to be executed by the data source ${k}`);k=!1===f.Bc||a.H&&k===olympe.dc.Ia.SERVER?[]:Array.from(a.j.values());h=new olympe.dc.query.
|
|
751
|
-
{const n=()=>{p&&c.
|
|
752
|
-
function Ii(a){a.F.forEach(b=>{let c;null==(c=a.j.get(b))||Ji(c)});a.F.clear()}function Ki(a,b,c,d){return u(function*(){const e=null!=d?d:c===olympe.dc.la.nc.Qg;if(b instanceof ReadableStream)yield Sg(a.D,b,{
|
|
753
|
-
function Mi(a,b){const c=b.jb();if(c===olympe.dc.Ia.SELF||a.H&&c===olympe.dc.Ia.SERVER)return Promise.resolve(!0);a=Array.from(a.j.values()).filter(d=>d.Ic(b)).map(d=>new Promise(e=>d.kd(f=>e(!f))));return Promise.all(a).then(d=>d.some(e=>e))}function Gi(a,b,c,d){return u(function*(){var e=b.jb();e=Tf(Tf(new olympe.dc.Request(olympe.dc.Request.j.Sg,e,b),olympe.dc.la.j.
|
|
754
|
-
function Ni(a,b,c){const d=[];for(const e of a.j.values())Oi(e,b,c)&&d.push(Gi(a,e.query,olympe.dc.la.nc.
|
|
755
|
-
olympe.dc.query.
|
|
742
|
+
filter:[],optional:!1,inheritance:!1,next:[]};a.set(b,c);this.db.vi(this.D)?c.dataType=olympe.dc.ea(this.D):(c.root=olympe.dc.ea(this.D),c.dataType=this.j.Te);this.ma.forEach((d,e)=>{const f=d.T(),g=d.Nc();Object.assign(g,{returned:this.F.has(f),next:[]});a.set(f,g);g.sort&&this.j.Ld!==e&&delete g.sort;if(1>=e&&d instanceof olympe.dc.query.ma.Hh&&d.relation.Ea(olympe.dc.CloudObject.instancesRel))Object.assign(c,g);else if(0===e&&d instanceof olympe.dc.query.ma.De&&d.relation.Ea(olympe.dc.CloudObject.extendedByRel))Object.assign(c,
|
|
743
|
+
g),c.inheritance=!0;else{let h;null==(h=a.get(d.j))||h.next.push(g)}});return c}mb(a){const b=(null==a?0:a.md)?a.md:olympe.dc.la.nc.Ck;let c;return olympe.dc.query.ml().executeQuery(Ai(this),b,{ii:null!=(c=null==a?void 0:a.cl)?c:null==a?void 0:a.cacheId,Bc:null==a?void 0:a.Bc}).then(d=>{let e;return null!=(e=null==d?void 0:li(d))?e:olympe.dc.Ka.empty()})}Cc(){return li(Ci(olympe.dc.query.ml(),Ai(this)))}observe(a,b){const c=(null==b?0:b.md)?b.md:olympe.dc.la.nc.wf;a='function'===typeof a.Cb?a.Cb():
|
|
744
|
+
a;let d;return Di(olympe.dc.query.ml(),Ai(this),a,olympe.dc.Ia.SELF,c,{ii:null!=(d=null==b?void 0:b.cl)?d:null==b?void 0:b.cacheId,Bc:null==b?void 0:b.Bc,rj:null==b?void 0:b.rj}).pipe(rxjs.operators.map(e=>li(e)),rxjs.operators.distinctUntilChanged())}T(){null===this.id&&(this.id=olympe.U.rb(this.D+ki(this).map(a=>a.H()).join()+Array.from(new Set(this.F)).sort().toString()+this.j.Ld+this.j.max+this.j.offset));return this.id}jb(){return this.source}fa(){let a;return{b:this.D,p:this.ma.map(b=>b.fa()),
|
|
745
|
+
r:Array.from(this.F),s:this.source,e:{m:this.j.max,o:this.j.offset,s:this.j.Ld,rm:null!=(a=this.j.Te)?a:this.db.model(this.D)}}}toString(){return`Query: ${JSON.stringify(this)}`}toJSON(){return{origin:this.db.Ja(this.D)?olympe.dc.CloudObject.get(this.D):this.D,relations:this.ma.map(a=>a.toJSON())}}};olympe.dc.la.prototype.observe=olympe.dc.la.prototype.observe;olympe.dc.la.prototype.executeFromCache=olympe.dc.la.prototype.Cc;olympe.dc.la.prototype.execute=olympe.dc.la.prototype.mb;
|
|
746
|
+
olympe.dc.la.prototype.parse=olympe.dc.la.prototype.parse;olympe.dc.la.prototype.back=olympe.dc.la.prototype.back;olympe.dc.la.prototype.sortBy=olympe.dc.la.prototype.Al;olympe.dc.la.prototype.limit=olympe.dc.la.prototype.Hj;olympe.dc.la.prototype.cast=olympe.dc.la.prototype.sj;olympe.dc.la.prototype.filter=olympe.dc.la.prototype.filter;olympe.dc.la.prototype.andReturn=olympe.dc.la.prototype.me;olympe.dc.la.prototype.followRecursively=olympe.dc.la.prototype.ug;olympe.dc.la.prototype.follow=olympe.dc.la.prototype.bb;
|
|
747
|
+
olympe.dc.la.followRule=olympe.dc.la.Ob;olympe.dc.la.instancesOf=olympe.dc.la.ql;olympe.dc.la.fromTag=olympe.dc.la.pe;olympe.dc.la.from=olympe.dc.la.from;olympe.dc.la.nc={wf:1,Ck:2,Qg:3};olympe.dc.la.j={Pl:'cacheBucketName',hq:'isCacheable'};function Ei(a){null===a.Ga&&null===a.j&&(a.Ga=Yf(a.F))}
|
|
748
|
+
olympe.dc.query.Dd=class extends olympe.dc.Hg{constructor(a){super(a,null);this.F=new olympe.dc.transaction.Ie}static xj(a){const b=new olympe.dc.query.Dd(`DataResult_${a.T()}`);b.D=a.jb();return b}static j(a){const b=new olympe.dc.query.Dd(a.i);let c;b.D=null!=(c=a.s)?c:null;let d;b.dl=null!=(d=a.t)?d:null;let e;b.Ga=null!=(e=a.p)?e:[];return b}qc(a){Ei(this);return super.qc(a)}ac(){Ei(this);return super.ac()}jl(){Ei(this);return super.jl()}create(a,b,c){this.F.Sc(a,this.D,c,b);return this}Oa(a,
|
|
749
|
+
b,c){this.F.Oa(a,b,c,null,null);return this}fa(){return super.fa()}};olympe.dc.query.Dd.prototype.createRelation=olympe.dc.query.Dd.prototype.Oa;olympe.dc.query.Dd.prototype.create=olympe.dc.query.Dd.prototype.create;olympe.dc.query.Dd.fromQuery=olympe.dc.query.Dd.xj;function Ci(a,b){const c=new olympe.dc.query.gr(a.G,b);if(a.D.view.Ja(b.D)){qi(c,b.D);for(const d of ki(b))d.mb(c)}return c}
|
|
750
|
+
function Di(a,b,c,d,e,f){const g=b.T();let h=a.j.get(g);if(!h){var k=b.jb();a.G.debug(`Create new subscription for query ${g} for subscriber ${d}, to be executed by the data source ${k}`);k=!1===f.Bc||a.H&&k===olympe.dc.Ia.SERVER?[]:Array.from(a.j.values());h=new olympe.dc.query.qr(a.G,a.D,b,e,a.R.bind(a,e,f));a.j.set(g,h);Fi(h,l=>a.F.add(l));h.start(k)&&(null==f?0:f.ii)&&Gi(a,b,e,f).catch(l=>{a.G.error(`Was not able to get the result of the subscribed query ${g} to add it to the cache: ${l}`)})}return new rxjs.Observable(l=>
|
|
751
|
+
{const n=()=>{p&&c.mt(p);l.complete();if(q){var r=q;const v=a.j.get(g);a.G.debug(`${d} unsubscribed from ${g}`);if(null==v)r=0;else{var t=v;t.H.delete(r)&&t.G.debug(`Remove subscriber ${d} for query ${t.query.T()}, now have ${t.H.size} subscribers`);d!==olympe.dc.Ia.SELF&&(t.Z--,0===t.Z&&ti(t.j));r=0===t.H.size}r&&(a.G.debug(`No more subscriber to ${g}, remove the subscription`),a.F.delete(g),a.j.delete(g),v.destroy())}},p=c.Xd(n),q=Hi(h,d,l);return n})}
|
|
752
|
+
function Ii(a){a.F.forEach(b=>{let c;null==(c=a.j.get(b))||Ji(c)});a.F.clear()}function Ki(a,b,c,d){return u(function*(){const e=null!=d?d:c===olympe.dc.la.nc.Qg;if(b instanceof ReadableStream)yield Sg(a.D,b,{sn:e});else{var f;if(f=b instanceof olympe.dc.Hg)f=b.T(),f=!a.N.H.has(f);f&&a.D.nd(b,{sn:e})}})}function Li(a){a.G.debug('Send GetContext request to the orchestrator');const b=new olympe.dc.Request(olympe.dc.Request.j.Jg,olympe.dc.Ia.SERVER);return a.Jb.request(b).then(c=>{a.D.nd(c)})}
|
|
753
|
+
function Mi(a,b){const c=b.jb();if(c===olympe.dc.Ia.SELF||a.H&&c===olympe.dc.Ia.SERVER)return Promise.resolve(!0);a=Array.from(a.j.values()).filter(d=>d.Ic(b)).map(d=>new Promise(e=>d.kd(f=>e(!f))));return Promise.all(a).then(d=>d.some(e=>e))}function Gi(a,b,c,d){return u(function*(){var e=b.jb();e=Tf(Tf(new olympe.dc.Request(olympe.dc.Request.j.Sg,e,b),olympe.dc.la.j.hq,c===olympe.dc.la.nc.Qg),olympe.dc.la.j.Pl,null==d?void 0:d.ii);return a.Jb.request(e)})}
|
|
754
|
+
function Ni(a,b,c){const d=[];for(const e of a.j.values())Oi(e,b,c)&&d.push(Gi(a,e.query,olympe.dc.la.nc.Ck,{}).then(f=>Ki(a,f,olympe.dc.la.nc.Ck)));return Promise.all(d).then(()=>{})}
|
|
755
|
+
olympe.dc.query.ew=class{constructor(a,b,c,d,e){this.G=a;this.D=b;this.N=c;this.Jb=d;this.H=e;this.j=new Map;this.F=new Set;Tg(b,()=>Ii(this));Wf(d,olympe.dc.Request.j.ck,f=>{Ki(this,f.content,olympe.dc.la.nc.wf).catch(g=>this.G.error(`Error while applying data notification on DB: ${g}`))})}executeQuery(a,b,c){const d=this;return u(function*(){const e='boolean'===typeof c.Bc?c.Bc:yield Mi(d,a);if(!e||(null==c?0:c.ii))try{const f=yield Gi(d,a,b,c);e||(yield Ki(d,f,b))}catch(f){return d.G.error(`Error while sending a query to data source ${a.jb()}: ${f}`),
|
|
756
756
|
null}return Ci(d,a)})}R(a,b,c,d,e,f){const g=c.jb();if(g===olympe.dc.Ia.SELF||b.Bc||this.H&&g===olympe.dc.Ia.SERVER)return e(),null;if(a!==olympe.dc.la.nc.wf)return Gi(this,c,a,b).then(r=>{var t=r;r instanceof ReadableStream&&(t=(t=d())?r.pipeThrough(t):r);return Ki(this,t,a,b.rj)}).then(e).catch(f),null;let h,k=!1;const l=r=>{h=[];r&&this.G.debug(`Resend subscription ${c.T()} after detection of dead subscription in the remote service`);Gi(this,c,a,b).then(t=>{if(k)return this.G.warn(`Received data result after query subscription ${c.T()} has been destroyed. Could happen with queries observed multiple times successively quickly.`),
|
|
757
|
-
Promise.resolve();var v=t;t instanceof ReadableStream&&(v=(v=d())?t.pipeThrough(v):t);return Ki(this,v,a,b.rj).then(()=>{h.forEach(x=>Ki(this,x,a))}).finally(()=>{h=null})}).then(e).catch(f)},n=c.T();l(!1);const p=Tf(new olympe.dc.Request(olympe.dc.Request.j.
|
|
758
|
-
l(!0)},0)).subscribe(rxjs.Subscriber.create(r=>{Array.isArray(h)?h.push(r):Ki(this,r,a)},r=>{this.G.error(`An error occurred with the subscription ${n}: ${r}`);f(String(r))}));return()=>{k=!0;this.G.debug(`Unsubscribe to query ${n} from data source ${g}`);q.unsubscribe()}}};function Pi(a){const b=olympe.dc.
|
|
759
|
-
olympe.dc.Ka=class{constructor(){this.j=[];this.D=new Map;this.F=[];this.H=[];this.hash=''}static empty(){return new olympe.dc.Ka}[Symbol.iterator](){let a=0;return{next:()=>{var b={done:!0};a<this.j.length&&(b=this.j[a],b={value:[b,this.D.get(b)],done:!1},a++);return b}}}entries(){return this.j.map(a=>[a,this.D.get(a)])}values(){return this.D.values()}keys(){return this.j.values()}
|
|
760
|
-
a||void 0===a?-1:'string'===typeof a?this.j.indexOf(a):this.
|
|
761
|
-
a(this.D.get(b),c))}map(a){return this.
|
|
762
|
-
this.D.get(this.j[a]))}Ej(){return this.H.map(a=>{a=a.split('.');return 1===a.length?a[0]:a})}static from(a,b,{Gb:c,Ld:d,offset:e,max:f}={}){if(null!==c&&-1<d){const p=olympe.dc.
|
|
757
|
+
Promise.resolve();var v=t;t instanceof ReadableStream&&(v=(v=d())?t.pipeThrough(v):t);return Ki(this,v,a,b.rj).then(()=>{h.forEach(x=>Ki(this,x,a))}).finally(()=>{h=null})}).then(e).catch(f)},n=c.T();l(!1);const p=Tf(new olympe.dc.Request(olympe.dc.Request.j.Gk,g,c),olympe.dc.la.j.Pl,null==b?void 0:b.ii),q=this.Jb.subscribe(p,l.bind(this,!0)).pipe(sb(olympe.error.Op,()=>{},0)).pipe(sb(olympe.error.Io,(r,t)=>{this.G.debug(`Data Provider: Subscribe to topic ${r.T()} now that we are back online, after waiting for ${t}ms`);
|
|
758
|
+
l(!0)},0)).subscribe(rxjs.Subscriber.create(r=>{Array.isArray(h)?h.push(r):Ki(this,r,a)},r=>{this.G.error(`An error occurred with the subscription ${n}: ${r}`);f(String(r))}));return()=>{k=!0;this.G.debug(`Unsubscribe to query ${n} from data source ${g}`);q.unsubscribe()}}};function Pi(a){const b=olympe.dc.ha();let c=!1;const d=a.k.map(e=>{const f=e.split('.').map(g=>b.Ja(g)?olympe.dc.CloudObject.get(g):(olympe.ga.Wa('dc.query').error(`CloudObject with tag ${g} not present but required for deserialization`),c=!0,null));return[e,1===f.length?f[0]:f]});return c?null:olympe.dc.Ka.create(d,a.a,a.r)}
|
|
759
|
+
olympe.dc.Ka=class{constructor(){this.j=[];this.D=new Map;this.F=[];this.H=[];this.hash=''}static empty(){return new olympe.dc.Ka}[Symbol.iterator](){let a=0;return{next:()=>{var b={done:!0};a<this.j.length&&(b=this.j[a],b={value:[b,this.D.get(b)],done:!1},a++);return b}}}entries(){return this.j.map(a=>[a,this.D.get(a)])}values(){return this.D.values()}keys(){return this.j.values()}Ue(){return this.j.map(a=>this.D.get(a))}size(){return this.j.length}has(a){return this.D.has(a)||this.Ue().includes(a)}indexOf(a){return null===
|
|
760
|
+
a||void 0===a?-1:'string'===typeof a?this.j.indexOf(a):this.Ue().indexOf(a)}get(a){return(a=this.D.get(a))?a:null}Jc(){return this.qe(0)}qe(a){return a<this.j.length?this.D.get(this.j[a]):null}push(...a){const b=this.Ue();b.push(...a);return b}pop(){if(0===this.j.length)return[];const a=this.Ue();a.pop();return a}shift(){if(0<this.j.length){const a=this.Ue();a.shift();return a}return[]}filter(a){return this.Ue().filter(a)}find(a){return(a=this.Ue().find(a))?a:null}forEach(a){this.j.forEach((b,c)=>
|
|
761
|
+
a(this.D.get(b),c))}map(a){return this.Ue().map(a)}sort(a){const b=this.entries().sort((c,d)=>a(c[1],d[1]));return olympe.dc.Ka.create(b,Array.from(this.F),Array.from(this.H))}reduce(a,b){return this.Ue().reduce(a,b)}concat(...a){const b=[this.entries(),...a.map(d=>d.entries())].flat();let c=Array.from(this.F);for(const d of a)c=c.concat(d.F.map(e=>e+c.length));a=this.H.concat(...a.map(d=>d.H));return olympe.dc.Ka.create(b,c,a)}toString(){return`QueryResult: ${JSON.stringify(this)}`}toJSON(){return this.Ue()}yj(){return this.F.map(a=>
|
|
762
|
+
this.D.get(this.j[a]))}Ej(){return this.H.map(a=>{a=a.split('.');return 1===a.length?a[0]:a})}static from(a,b,{Gb:c,Ld:d,offset:e,max:f}={}){if(null!==c&&-1<d){const p=olympe.dc.ha(),q=c.Wi===olympe.dc.query.Bk.ASC?1:-1,r=c.jh(),t=c.Pa();b.sort((v,x)=>{x=x[d];v=p.Pa(v[d],t);x=p.Pa(x,t);return null===v?-q:null===x?q:q*r(olympe.dc.ib.tc(v),olympe.dc.ib.tc(x))})}else b.sort((p,q)=>p.reduce((r,t,v)=>r||t.localeCompare(q[v]),0));if(0<e||-1<f)b=b.slice(e,-1<f?e+f:void 0);c=olympe.U.rb(b.flat().join(''));
|
|
763
763
|
if(c===a.hash)return a;const g=p=>''===p?null:olympe.dc.CloudObject.get(p);e=b.map(p=>[p.join('.'),1===p.length?g(p[0]):p.map(g)]);const h=new Set(e.map(p=>p[0])),k=new Set(a.keys()),l=[],n=[];e.forEach(([p],q)=>{!k.has(p)&&l.push(q)});k.forEach(p=>{!h.has(p)&&n.push(p)});return olympe.dc.Ka.create(e,l,n,c)}static create(a,b,c,d){const e=new olympe.dc.Ka;e.j=a.map(f=>f[0]);e.D=new Map(a);e.hash=d||olympe.U.rb(e.j.join(''));e.F=b||e.j.map((f,g)=>g);e.H=c||[];return e}fa(a){a&&this.j.flatMap(b=>b.split('.')).forEach(a);
|
|
764
764
|
return{k:this.j,a:this.F,r:this.H}}};olympe.dc.Ka.prototype.getRemoved=olympe.dc.Ka.prototype.Ej;olympe.dc.Ka.prototype.getAdded=olympe.dc.Ka.prototype.yj;olympe.dc.Ka.prototype.concat=olympe.dc.Ka.prototype.concat;olympe.dc.Ka.prototype.reduce=olympe.dc.Ka.prototype.reduce;olympe.dc.Ka.prototype.sort=olympe.dc.Ka.prototype.sort;olympe.dc.Ka.prototype.map=olympe.dc.Ka.prototype.map;olympe.dc.Ka.prototype.forEach=olympe.dc.Ka.prototype.forEach;olympe.dc.Ka.prototype.find=olympe.dc.Ka.prototype.find;
|
|
765
|
-
olympe.dc.Ka.prototype.filter=olympe.dc.Ka.prototype.filter;olympe.dc.Ka.prototype.shift=olympe.dc.Ka.prototype.shift;olympe.dc.Ka.prototype.pop=olympe.dc.Ka.prototype.pop;olympe.dc.Ka.prototype.push=olympe.dc.Ka.prototype.push;olympe.dc.Ka.prototype.getAt=olympe.dc.Ka.prototype.
|
|
766
|
-
olympe.dc.Ka.prototype.size=olympe.dc.Ka.prototype.size;olympe.dc.Ka.prototype.toArray=olympe.dc.Ka.prototype.
|
|
767
|
-
olympe.dc.sd.prototype.execute=olympe.dc.sd.prototype.mb;olympe.dc.sd.prototype.cast=olympe.dc.sd.prototype.sj;olympe.dc.sd.prototype.follow=olympe.dc.sd.prototype.bb;const Ri=olympe.dc.ta.ORIGIN,Si=olympe.dc.ta.DESTINATION;function Fi(a,b){mi(a.j,()=>{a.fb()||null!==a.D||b(a.query.T())})}function Hi(a,b,c){const d=a.
|
|
765
|
+
olympe.dc.Ka.prototype.filter=olympe.dc.Ka.prototype.filter;olympe.dc.Ka.prototype.shift=olympe.dc.Ka.prototype.shift;olympe.dc.Ka.prototype.pop=olympe.dc.Ka.prototype.pop;olympe.dc.Ka.prototype.push=olympe.dc.Ka.prototype.push;olympe.dc.Ka.prototype.getAt=olympe.dc.Ka.prototype.qe;olympe.dc.Ka.prototype.getFirst=olympe.dc.Ka.prototype.Jc;olympe.dc.Ka.prototype.get=olympe.dc.Ka.prototype.get;olympe.dc.Ka.prototype.indexOf=olympe.dc.Ka.prototype.indexOf;olympe.dc.Ka.prototype.has=olympe.dc.Ka.prototype.has;
|
|
766
|
+
olympe.dc.Ka.prototype.size=olympe.dc.Ka.prototype.size;olympe.dc.Ka.prototype.toArray=olympe.dc.Ka.prototype.Ue;olympe.dc.Ka.prototype.keys=olympe.dc.Ka.prototype.keys;olympe.dc.Ka.prototype.values=olympe.dc.Ka.prototype.values;olympe.dc.Ka.prototype.entries=olympe.dc.Ka.prototype.entries;olympe.dc.Ka.empty=olympe.dc.Ka.empty;function Qi(a){return 1<a.size()?(olympe.ga.Wa('dc').warn(`a follow() on a QuerySingle has ${a.size()} results (0 or 1 expected) -> returns null`),null):a.Jc()||null}olympe.dc.sd=class{constructor(a){this.query=a}static from(a){return new olympe.dc.sd(olympe.dc.la.from(a))}bb(a){return new olympe.dc.sd(this.query.bb(a))}sj(){return this}mb(a){return this.query.mb(a).then(b=>Qi(b))}Cc(){return Qi(this.query.Cc())}};olympe.dc.sd.prototype.executeFromCache=olympe.dc.sd.prototype.Cc;
|
|
767
|
+
olympe.dc.sd.prototype.execute=olympe.dc.sd.prototype.mb;olympe.dc.sd.prototype.cast=olympe.dc.sd.prototype.sj;olympe.dc.sd.prototype.follow=olympe.dc.sd.prototype.bb;const Ri=olympe.dc.ta.ORIGIN,Si=olympe.dc.ta.DESTINATION;function Fi(a,b){mi(a.j,()=>{a.fb()||null!==a.D||b(a.query.T())})}function Hi(a,b,c){const d=a.ba;a.ba++;a.H.set(d,c);b===olympe.dc.Ia.SELF?a.kd(e=>e?c.error(e):c.next(a.j)):(a.Z++,1===a.Z&&a.kd(()=>si(a.j)));a.G.debug(`Add subscriber ${b} for query ${a.query.T()}, now have ${a.H.size} subscribers`);return d}
|
|
768
768
|
function Oi(a,b,c){if(a.query.jb()!==b)return!1;c.qc(a.ia);(b=a.ia.flush())&&a.G.debug(`Subscription ${a.query.T()} is considered as obsolete after the transaction ${c.T()} applied on DB`);return b}function Ji(a){ui(a.j);a.H.forEach(b=>{b.next(a.j)})}
|
|
769
|
-
function Ti(a,b,c){const d=[];let e=!1;const f=new olympe.async.
|
|
769
|
+
function Ti(a,b,c){const d=[];let e=!1;const f=new olympe.async.Dk(olympe.C.kh());for(const g of b)if(g.Ic(a.query)&&(e||(e=!0),f.add(h=>g.kd(k=>{!k&&d.push(g);h()}))),null!==g.D&&Bi(a.query,g.query)){let h;null==(h=a.R)||h.push(g)}sd(f,g=>c(g?d:[]));f.start();return e}
|
|
770
770
|
function Ui(a){const b=a.query.T(),c=new Map,d=q=>{const r=c.get(q);return r?1===r.size?Array.from(r)[0]:(t,v,x,y)=>r.forEach(z=>z(t,v,x,y)):()=>{}},e=ki(a.query),f=a.j;for(let q=e.length-1;0<=q;q--){var g=e[q];const r=g.T(),t=g.j;g=g.observe(f,d(r));let v;c.set(t,(null!=(v=c.get(t))?v:new Set).add(g))}const h=a.db,k=a.query.D,l=olympe.U.rb(k),n=Pf(h,k,(q,r)=>{q?qi(f,r):f.remove(r);d(l)(q,r,null,b)});let p;null==(p=a.X)||p.push(()=>{Nf(h,k,n)});Vi(a)}
|
|
771
|
-
function Wi(a){const b=a.
|
|
772
|
-
olympe.dc.query.
|
|
771
|
+
function Wi(a){const b=a.Ha(a.query,a.Ua.bind(a),()=>{null===a.D||a.fb()||Ui(a)},d=>{a.fb()||(a.G.error(`Error while getting data from data source (${a.query.jb()}) to ensure coverage of the query ${a.query.T()}: ${d}`),Vi(a))});let c;b&&(null==(c=a.X)||c.push(b))}function Xi(a,b){a.N.delete(b);0===a.N.size&&(a.N=null,Promise.resolve().then(()=>{!a.fb()&&Wi(a)}))}function Vi(a){const b=a.D;a.D=null;null==b||b.forEach(c=>c())}
|
|
772
|
+
olympe.dc.query.qr=class{constructor(a,b,c,d,e){this.G=a;this.wa=b;this.db=b.view;this.query=c;this.md=d;this.j=new olympe.dc.query.gr(this.G,c);this.Z=0;this.ba=1;this.X=[];this.H=new Map;this.D=[()=>ui(this.j)];this.Ha=e;this.ia=new Yi(a,this.db,c,this.j);this.F=this.N=null;this.R=[]}start(a){return Ti(this,a,b=>{0<b.length?(this.N=new Set(b),this.N.forEach(c=>{null===c.F&&(c.F=new Set);c.F.add(this)}),Ui(this)):Wi(this)})}Ic(a){return!this.fb()&&this.query.jb()===a.jb()&&(this.query.T()===a.T()||
|
|
773
773
|
(null===this.D||this.query.D===a.D)&&this.j.Ic(a))}kd(a){null!==this.D?this.D.push(a):a();return this}destroy(a){a?this.G.error(`Destroy subscription ${this.query.T()} after error: ${a}`):this.G.debug(`Destroy subscription ${this.query.T()}`);const b=this.X;this.X=null;this.H.forEach(e=>a?e.error(a):e.complete());let c;null==(c=this.F)||c.forEach(e=>Xi(e,this));let d;null==(d=this.N)||d.forEach(e=>{e.F.delete(this);0===e.F.size&&(e.F=null)});b.forEach(e=>e())}fb(){return null===this.X}Ua(){const a=
|
|
774
|
-
olympe.dc.la.nc.Qg;if(this.md===a)return olympe.U.stream.tap(c=>{c=c.
|
|
774
|
+
olympe.dc.la.nc.Qg;if(this.md===a)return olympe.U.stream.tap(c=>{c=c.jl().filter(e=>e.o===olympe.dc.Qc.j).map(e=>e.t);this.wa.ne(c,'Batch mode');const d=ki(this.query)[0];d instanceof olympe.dc.query.ma.mm&&c.forEach(e=>qi(this.j,e,d.T(),d.j))});let b;if(0<(null==(b=this.R)?void 0:b.length)){const c=this.R.filter(e=>e.md===a).map(e=>new Promise(f=>e.kd(f))),d=this.R.filter(e=>e.md!==a).map(e=>new Promise(f=>e.kd(f)));this.R=void 0;return new TransformStream({start:()=>Promise.all(c),flush:()=>Promise.all(d)})}return null}};
|
|
775
775
|
function Zi(a,b){return a.F.has(Si+b)||a.F.has(Ri+b)}
|
|
776
776
|
class Yi{constructor(a,b,c,d){this.G=a;this.db=b;this.H=d;this.R=[];this.N=-1<c.j.max||0<c.j.offset;this.F=new Map;this.j=!1;const e=new Map;for(const f of ki(c)){a=f.T();this.R.push(a);if(f instanceof olympe.dc.query.ma.Wh){a=f.relation;a=`${a.La()}${a.W()}`;let g;b=null!=(g=this.F.get(a))?g:[];b.push(f);this.F.set(a,b)}$i(f).forEach(g=>{let h;const k=null!=(h=e.get(g))?h:[];k.push(f.T());e.set(g,k)})}this.properties=Array.from(e.entries())}flush(){const a=this.j;this.j=!1;return a}Sc(){}Yc(a,b){if(!(this.j||
|
|
777
|
-
!this.N&&this.db.Ja(a))){var c;this.j||(this.j=null==(c=this.properties)?void 0:c.some(([d,e])=>b.has(d)&&pi(this.H,a,e)))}}D(a){this.j||this.db.Ja(a)&&!this.N||this.j||(this.j=this.R.some(b=>pi(this.H,a,b)))}Oa(a,b,c){if(!this.j&&Zi(this,a)){var d=this.db.Ja(b),e=this.db.Ja(c);if(d&&!e||!d&&e){const f=this.F.get(Si+a);a=this.F.get(Ri+a);this.j||(this.j=d&&(null==f?void 0:f.some(g=>pi(this.H,b,g.j)))||e&&(null==a?void 0:a.some(g=>pi(this.H,c,g.j))))}}}hc(a,b,c){if(!this.j&&this.N&&Zi(this,a)&&this.db.
|
|
778
|
-
new olympe.dc.Ra.Relation(a),c)){const d=this.F.get(Si+a);a=this.F.get(Ri+a);const e=this.H;this.j||(this.j=(null==d?void 0:d.some(f=>pi(e,b,f.j)&&pi(e,c,f.T())))||(null==a?void 0:a.some(f=>pi(e,c,f.j)&&pi(e,b,f.T()))))}}}olympe.dc.query.
|
|
779
|
-
olympe.dc.query.Relation=class extends olympe.dc.Ra.Relation{constructor(a,b,c){super(a,b);this.recursive=c}toJSON(){let a='{ "tag": '+JSON.stringify(this.W())+', ';a+='"direction": '+JSON.stringify(this.La())+', ';a+='"recursive": '+JSON.stringify(this.recursive);return a+'}'}static
|
|
780
|
-
olympe.dc.ta.DESTINATION,b=olympe.dc.ta.ORIGIN;return new olympe.dc.query.Relation(this.tag,this.direction===a?b:a,this.recursive)}T(){return`${this.direction}${this.tag}${this.recursive?'-r':''}`}};olympe.dc.query.P={Da:'dc.query.Logger',
|
|
781
|
-
Array(this.Y.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.every(k=>k);e!==g&&(e=g,c(g))};this.Y.forEach((g,h)=>{g.observe(a,olympe.U.rb('AND-'+b+a+h),f.bind(null,h))})}fa(){return{pr:olympe.dc.query.za.j.
|
|
777
|
+
!this.N&&this.db.Ja(a))){var c;this.j||(this.j=null==(c=this.properties)?void 0:c.some(([d,e])=>b.has(d)&&pi(this.H,a,e)))}}D(a){this.j||this.db.Ja(a)&&!this.N||this.j||(this.j=this.R.some(b=>pi(this.H,a,b)))}Oa(a,b,c){if(!this.j&&Zi(this,a)){var d=this.db.Ja(b),e=this.db.Ja(c);if(d&&!e||!d&&e){const f=this.F.get(Si+a);a=this.F.get(Ri+a);this.j||(this.j=d&&(null==f?void 0:f.some(g=>pi(this.H,b,g.j)))||e&&(null==a?void 0:a.some(g=>pi(this.H,c,g.j))))}}}hc(a,b,c){if(!this.j&&this.N&&Zi(this,a)&&this.db.gt(b,
|
|
778
|
+
new olympe.dc.Ra.Relation(a),c)){const d=this.F.get(Si+a);a=this.F.get(Ri+a);const e=this.H;this.j||(this.j=(null==d?void 0:d.some(f=>pi(e,b,f.j)&&pi(e,c,f.T())))||(null==a?void 0:a.some(f=>pi(e,c,f.j)&&pi(e,b,f.T()))))}}}olympe.dc.query.qr.ya=[olympe.dc.Writable];function aj(a){return new olympe.dc.query.Relation(a.tag,a.direction,!0)}
|
|
779
|
+
olympe.dc.query.Relation=class extends olympe.dc.Ra.Relation{constructor(a,b,c){super(a,b);this.recursive=c}toJSON(){let a='{ "tag": '+JSON.stringify(this.W())+', ';a+='"direction": '+JSON.stringify(this.La())+', ';a+='"recursive": '+JSON.stringify(this.recursive);return a+'}'}static Pb(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.dc.query.Relation(b.tag,b.direction,b.recursive)}static from(a,b){return new olympe.dc.query.Relation(a.W(),a.La(),null!=b?b:a instanceof olympe.dc.aa.Le)}$b(){const a=
|
|
780
|
+
olympe.dc.ta.DESTINATION,b=olympe.dc.ta.ORIGIN;return new olympe.dc.query.Relation(this.tag,this.direction===a?b:a,this.recursive)}T(){return`${this.direction}${this.tag}${this.recursive?'-r':''}`}};olympe.dc.query.P={Da:'dc.query.Logger',Fk:'dc.query.QueryProcessor'};olympe.V.config(function(a){D(a,olympe.dc.query.P.Da,[olympe.ga.P.Fa],b=>b.ad('query'));C(a,olympe.dc.query.P.Fk,olympe.dc.query.ew,olympe.dc.query.P.Da,olympe.dc.db.P.Fa,olympe.dc.transaction.P.Fa,olympe.dc.P.Ug,new olympe.V.oa(olympe.dc.Config.Yh))});olympe.V.run([olympe.dc.query.P.Fk],a=>{olympe.dc.query.ml=()=>a});olympe.dc.query.Cd=class extends Error{};olympe.dc.query.Y={};olympe.dc.query.Y.Nd=class extends olympe.dc.query.za{constructor(...a){super();this.Y=a}compile(){return this.Y.reduce((a,b)=>{const c=[];for(const d of b.compile()){for(const e of a)d.push(...e);c.push(d)}return c},[])}zd(){return new olympe.dc.query.Y.Ge(...this.Y.map(a=>a.zd()))}zb(){return this.Y.flatMap(a=>a.zb())}Ic(){throw Error('Should not try to check predicate coverage on And (should be removed by compiling predicates');}mb(a){return this.Y.reduce((b,c)=>b&&c.mb(a),!0)}observe(a,b,c){const d=
|
|
781
|
+
Array(this.Y.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.every(k=>k);e!==g&&(e=g,c(g))};this.Y.forEach((g,h)=>{g.observe(a,olympe.U.rb('AND-'+b+a+h),f.bind(null,h))})}fa(){return{pr:olympe.dc.query.za.j.io,p:this.Y.map(a=>a.fa())}}Nc(){throw Error('toObject for AND predicate should not be called');}toString(){return'And-'+this.Y.reduce((a,b)=>a+'-'+b.toString(),'')}clear(a,b){this.Y.forEach((c,d)=>{c.clear(a,olympe.U.rb('AND-'+b+a+d))})}};olympe.dc.query.Y.yf=class extends olympe.dc.query.za{constructor(a,b,c,d=!1){super();this.Ca=olympe.dc.ea(a);this.substring=b;this.db=c;this.j=d}zb(){return[this.Ca]}Ic(a,b){return a instanceof olympe.dc.query.Y.yf&&a.Ca===this.Ca?b?a.j?a.substring.toLowerCase().includes(this.substring.toLowerCase()):a.substring.includes(this.substring):this.j?this.substring.toLowerCase().includes(a.substring.toLowerCase()):this.substring.includes(a.substring):!1}Pa(){return this.Ca}mb(a){return this.apply(this.db.Pa(a,
|
|
782
782
|
this.Ca))}observe(a,b,c){hh(this.db,a,this.Ca,d=>{c(this.apply(d))},olympe.U.rb(b+a+this.toString()))}apply(a){a=olympe.dc.ib.tc(a);return'string'===typeof a?this.j?a.includes(this.substring):a.toLowerCase().includes(this.substring.toLowerCase()):!1}toString(){return'Contains'+this.Ca+'-'+this.substring+'-'+this.j}clear(a,b){ih(this.db,a,this.Ca,olympe.U.rb(b+a+this.toString()))}Nc(){return{name:'CONTAINS',property:this.Pa(),value:this.substring,caseSensitive:this.j}}fa(){return{pr:olympe.dc.query.za.j.Zj,
|
|
783
|
-
p:this.Ca,s:this.substring,c:this.j}}};olympe.dc.query.Y.
|
|
783
|
+
p:this.Ca,s:this.substring,c:this.j}}};olympe.dc.query.Y.Ce=class extends olympe.dc.query.za{constructor(a,b,c){super();this.Ca=olympe.dc.ea(a);this.j=olympe.dc.ib.tc(null!=b?b:null);this.db=c}zb(){return[this.Ca]}Ic(a){if(a instanceof olympe.dc.query.Y.Ce&&this.Ca===a.Ca)if('object'===typeof this.j&&null!==this.j){if(this.j instanceof olympe.dc.CloudObject)return this.j.Ea(a.j);if(this.j instanceof Date)return a.j instanceof Date&&this.j.getTime()===a.j.getTime();if(this.j instanceof olympe.C.Color)return this.j.Ea(a.j)}else return this.j===
|
|
784
784
|
a.j;return!1}mb(a){return this.apply(this.db.Pa(a,this.Ca))}observe(a,b,c){hh(this.db,a,this.Ca,d=>{c(this.apply(d))},olympe.U.rb(b+a+this.toString()));null===this.j&&null===this.db.Pa(a,this.Ca)&&c(!0)}clear(a,b){ih(this.db,a,this.Ca,olympe.U.rb(b+a+this.toString()))}apply(a){a=olympe.dc.ib.tc(a);return'object'===typeof a&&null!==a?a instanceof olympe.dc.CloudObject?a.Ea(this.j):a instanceof Date?this.j instanceof Date&&this.j.getTime()===a.getTime():a instanceof olympe.C.Color?a.Ea(this.j):!1:a===
|
|
785
|
-
this.j}toString(){let a,b;const c=null!=(b=null==(a=this.j)?void 0:a.toString())?b:'null';return'Equals-'+this.Ca+'-'+c}Nc(){return{name:'EQUALS',property:this.Ca,value:this.j}}fa(){let a=1,b=this.j;switch(!0){case this.j instanceof Date:a=2;b=this.j.toJSON();break;case this.j instanceof olympe.dc.CloudObject:a=3;b=this.j.W();break;case this.j instanceof olympe.C.Color:a=4,b=this.j.toJSON()}return{pr:olympe.dc.query.za.j.
|
|
785
|
+
this.j}toString(){let a,b;const c=null!=(b=null==(a=this.j)?void 0:a.toString())?b:'null';return'Equals-'+this.Ca+'-'+c}Nc(){return{name:'EQUALS',property:this.Ca,value:this.j}}fa(){let a=1,b=this.j;switch(!0){case this.j instanceof Date:a=2;b=this.j.toJSON();break;case this.j instanceof olympe.dc.CloudObject:a=3;b=this.j.W();break;case this.j instanceof olympe.C.Color:a=4,b=this.j.toJSON()}return{pr:olympe.dc.query.za.j.pp,p:this.Ca,t:a,v:b}}};olympe.dc.query.Y.jq=class extends olympe.dc.query.za{constructor(a,b){var c=olympe.dc.ha();super();this.Ca=olympe.dc.ea(a);this.values=b.map(d=>olympe.dc.ib.tc(null!=d?d:null));this.db=c}zb(){return[this.Ca]}Ic(){return!1}mb(a){return this.apply(this.db.Pa(a,this.Ca))}observe(a,b,c){hh(this.db,a,this.Ca,d=>{c(this.apply(d))},olympe.U.rb(b+a+this.toString()))}clear(a,b){ih(this.db,a,this.Ca,olympe.U.rb(b+a+this.toString()))}apply(a){const b=olympe.dc.ib.tc(a);return'object'===typeof b&&null!==b?b instanceof
|
|
786
786
|
olympe.dc.CloudObject||b instanceof olympe.C.Color?this.values.some(c=>b.Ea(c)):b instanceof Date?this.values.some(c=>c instanceof Date&&c.getTime()===b.getTime()):!1:this.values.includes(b)}toString(){const a=this.values.map(b=>{let c;return null!=(c=null==b?void 0:b.toString())?c:'null'}).join('');return'In-'+this.Ca+'-'+a}Nc(){return{name:'IN',property:this.Ca,values:this.values}}fa(){var a,b=null!=(a=this.values[0])?a:null;a=b instanceof olympe.C.Color?4:b instanceof olympe.dc.CloudObject?3:b instanceof
|
|
787
|
-
Date?2:1;b=4===a||2===a?this.values.map(c=>c.toJSON()):3===a?this.values.map(c=>c.W()):this.values;return{pr:olympe.dc.query.za.j.
|
|
787
|
+
Date?2:1;b=4===a||2===a?this.values.map(c=>c.toJSON()):3===a?this.values.map(c=>c.W()):this.values;return{pr:olympe.dc.query.za.j.Zp,p:this.Ca,t:a,v:b}}};function bj(a,b,c){return olympe.U.rb(c+b+a.j+a.Ca)}
|
|
788
788
|
olympe.dc.query.Y.Ti=class extends olympe.dc.query.za{constructor(a,b,c,d=!0,e=!0){super();this.db=a;this.Ca=olympe.dc.ea(b);this.j=(this.F=('object'===typeof c||'string'===typeof c)&&olympe.dc.CloudObject.exists(c))?olympe.dc.ea(c):c;this.D=d;this.H=e}zd(){return new olympe.dc.query.Y.Ti(this.db,this.Ca,this.j,!this.D,!this.H)}zb(){return[this.Ca]}Ic(a,b){if(b)throw Error('Check coverage of inequality should not happen with opposite = true');return a instanceof olympe.dc.query.Y.Ti&&this.Ca===a.Ca?
|
|
789
789
|
typeof this.j!==typeof a.j||this.D!==a.D?!1:this.F?this.j===a.j:this.D&&this.j>=a.j||!this.D&&this.j<=a.j:!1}Pa(){return this.Ca}mb(a){return this.compare(this.db.Pa(a,this.Ca),this.F?this.db.Pa(a,this.j):this.j)}observe(a,b,c){this.F&&hh(this.db,a,this.j,d=>{const e=this.db.Pa(a,this.Ca);null!==e&&c(this.compare(e,d))},bj(this,a,b));hh(this.db,a,this.Ca,d=>{const e=this.F?this.db.Pa(a,this.j):this.j;c(null!==e?this.compare(d,e):!0)},bj(this,a,b))}compare(a,b){return null===a?!1:null===b?!0:this.H?
|
|
790
|
-
this.D?a<b:a>b:this.D?a<=b:a>=b}clear(a,b){ih(this.db,a,this.Ca,bj(this,a,b));this.F&&ih(this.db,a,this.j,bj(this,a,b))}Nc(){return{name:'INEQUALITY_OPERATOR',property:this.Pa(),operator:this.D?'<':'>',strict:this.H,value:this.j}}fa(){return{pr:olympe.dc.query.za.j
|
|
791
|
-
b){this.j.clear(a,olympe.U.rb('NOT'+b+a))}Ea(a){return a instanceof olympe.dc.query.Y.
|
|
792
|
-
k);e!==g&&(e=g,c(g))};this.Y.forEach((g,h)=>{g.observe(a,olympe.U.rb('OR-'+b+a+h),f.bind(null,h))})}Nc(){throw Error('toObject for OR predicate should not be called');}fa(){return{pr:olympe.dc.query.za.j.
|
|
793
|
-
return'string'===typeof a?(a=this.j.test(this.D?a:a.toLowerCase()),this.j.lastIndex=0,a):!1}toString(){return'Regex'+this.Ca+'-'+this.j.toString()+'-'+this.D}Nc(){return{name:'REGEX',property:this.Ca,pattern:this.j,caseSensitive:this.D}}fa(){return{pr:olympe.dc.query.za.j.
|
|
790
|
+
this.D?a<b:a>b:this.D?a<=b:a>=b}clear(a,b){ih(this.db,a,this.Ca,bj(this,a,b));this.F&&ih(this.db,a,this.j,bj(this,a,b))}Nc(){return{name:'INEQUALITY_OPERATOR',property:this.Pa(),operator:this.D?'<':'>',strict:this.H,value:this.j}}fa(){return{pr:olympe.dc.query.za.j.$p,p:this.Ca,b:this.j,l:this.D,s:this.H}}toString(){return(this.D?'LowerThan-':'GreaterThan-')+this.Ca+'-'+this.H+'-'+this.j}};olympe.dc.query.Y.ie=class extends olympe.dc.query.za{constructor(a){super();this.j=a}compile(){const a=this.j.zd();return this.Ea(a)?super.compile():a.compile()}zd(){return this.j}zb(){return this.j.zb()}Ic(a,b){return a instanceof olympe.dc.query.Y.ie?this.j.Ic(a.j,b):this.j.Ic(a,!b)}mb(a){return!this.j.mb(a)}observe(a,b,c){let d=null;this.j.observe(a,olympe.U.rb('NOT'+b+a),e=>{!e!==d&&(d=!e,c(d))})}Nc(){return{name:'NOT',predicate:this.j.Nc()}}fa(){return{pr:olympe.dc.query.za.j.Dq,v:this.j.fa()}}toString(){return`NOT-${this.j.toString()}`}clear(a,
|
|
791
|
+
b){this.j.clear(a,olympe.U.rb('NOT'+b+a))}Ea(a){return a instanceof olympe.dc.query.Y.ie?this.j.Ea(a.j):!1}};olympe.dc.query.Y.Ge=class extends olympe.dc.query.za{constructor(...a){super();this.Y=a}compile(){return this.Y.map(a=>a.compile()).flat()}zd(){return new olympe.dc.query.Y.Nd(...this.Y.map(a=>a.zd()))}zb(){return this.Y.flatMap(a=>a.zb())}Ic(){throw Error('Should not try to check predicate coverage on And (should be removed by compiling predicates');}mb(a){return this.Y.reduce((b,c)=>b||c.mb(a),!1)}observe(a,b,c){const d=Array(this.Y.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.some(k=>
|
|
792
|
+
k);e!==g&&(e=g,c(g))};this.Y.forEach((g,h)=>{g.observe(a,olympe.U.rb('OR-'+b+a+h),f.bind(null,h))})}Nc(){throw Error('toObject for OR predicate should not be called');}fa(){return{pr:olympe.dc.query.za.j.Vq,p:this.Y.map(a=>a.fa())}}toString(){return'And-'+this.Y.reduce((a,b)=>a.toString()+'-'+b.toString(),'')}clear(a,b){this.Y.forEach((c,d)=>{c.clear(a,olympe.U.rb('OR-'+b+a+d))})}};olympe.dc.query.Y.Hf=class extends olympe.dc.query.za{constructor(a,b,c,d=!0){super();this.Ca=olympe.dc.ea(a);this.j='string'===typeof b?new RegExp(d?b:b.toLowerCase()):d?b:new RegExp(b.source.toLowerCase());this.db=c;this.D=d}zb(){return[this.Ca]}Ic(a){return a instanceof olympe.dc.query.Y.Hf&&this.Ca===a.Ca&&this.j.toString()===a.j.toString()}mb(a){return this.apply(this.db.Pa(a,this.Ca))}observe(a,b,c){hh(this.db,a,this.Ca,d=>{c(this.apply(d))},olympe.U.rb(b+a+this.toString()))}apply(a){a=olympe.dc.ib.tc(a);
|
|
793
|
+
return'string'===typeof a?(a=this.j.test(this.D?a:a.toLowerCase()),this.j.lastIndex=0,a):!1}toString(){return'Regex'+this.Ca+'-'+this.j.toString()+'-'+this.D}Nc(){return{name:'REGEX',property:this.Ca,pattern:this.j,caseSensitive:this.D}}fa(){return{pr:olympe.dc.query.za.j.sr,p:this.Ca,r:this.j.source,c:this.D}}clear(a,b){ih(this.db,a,this.Ca,olympe.U.rb(b+a+this.toString()))}};olympe.dc.query.Y.en=class extends olympe.dc.query.za{constructor(a){super();this.j=new Set(a.map(olympe.dc.ea))}zb(){return[]}Ic(a){return a instanceof olympe.dc.query.Y.en&&Array.from(a.j).every(b=>this.j.has(b))}mb(a){return this.j.has(a)}observe(a,b,c){c(this.j.has(a))}clear(){}toString(){return'Tags-'+Array.from(this.j)}Nc(){return{name:'IS',tags:Array.from(this.j)}}fa(){return{pr:olympe.dc.query.za.j.Zr,t:Array.from(this.j)}}};olympe.dc.query.ma={};function $i(a){let b,c;const d=new Set(null!=(c=null==(b=a.D)?void 0:b.zb())?c:[]);let e;a.Gb&&d.add(null==(e=a.Gb)?void 0:e.Pa().W());return d}function cj(a){if(!a.ba){let b,c;a.ba=null!=(c=null==(b=a.D)?void 0:b.compile())?c:[]}return a.ba}function dj(a,b){for(const c of b)if(a.some(d=>d.Ic(c,!1)))return!0;return!1}
|
|
794
794
|
function ej(a,b){if(null===a.D)return b;let c=!1;const d=a.toString();return(e,f,g,h)=>{const k=olympe.U.rb(h+f+d);e?a.D.observe(f,k,l=>{c||b(l,f,g,k)}):(c=!0,a.D.clear(f,k),c=!1,b(!1,f,g,k))}}function fj(a,b,c){if(null===a.Gb)return c;const d=a.toString();return(e,f,g,h)=>{const k=a.Gb.Pa();h=olympe.U.rb(h+d);e?hh(a.db,f,k,()=>{ni(b)},h):ih(a.db,f,k,h);c(e,f,g,h)}}
|
|
795
|
-
olympe.dc.query.ma.
|
|
796
|
-
b,c,d;return`${this.j}-${this.optional}${null!=(c=null==(a=this.D)?void 0:a.toString())?c:''}${null!=(d=null==(b=this.Gb)?void 0:b.toString())?d:''}`}Nc(){}toJSON(){}fa(){const a={i:this.j,o:this.optional};null!==this.D&&(a.p=this.D.fa());null!==this.Gb&&(a.c=this.Gb.fa());return a}X(){}ia(){return new olympe.dc.query.ma.
|
|
795
|
+
olympe.dc.query.ma.Sm=class{constructor(a,b){this.db=olympe.dc.ha();this.j=a;this.optional=b;this.ba=this.Gb=this.D=this.id=null}static j(a){var b=a.i;if('string'===typeof a.f)return new olympe.dc.query.ma.Od(b,a.f);var c=a.o;const d=new olympe.dc.Ra.Relation(a.t,a.d);b='boolean'===typeof a.s?new olympe.dc.query.ma.De(b,d,a.s,c):new olympe.dc.query.ma.Hh(b,d,c);void 0!==a.p&&(b.D=wi(a.p));void 0!==a.c&&(c=b.T(),a=a.c,a=new olympe.dc.query.xf(c,new olympe.dc.Ra.Property(a.p),a.o),b.Gb=a);return b}N(){}H(){let a,
|
|
796
|
+
b,c,d;return`${this.j}-${this.optional}${null!=(c=null==(a=this.D)?void 0:a.toString())?c:''}${null!=(d=null==(b=this.Gb)?void 0:b.toString())?d:''}`}Nc(){}toJSON(){}fa(){const a={i:this.j,o:this.optional};null!==this.D&&(a.p=this.D.fa());null!==this.Gb&&(a.c=this.Gb.fa());return a}X(){}ia(){return new olympe.dc.query.ma.bn}Z(){}T(){this.id||(this.id=this.X());return this.id}R(){return this.optional}Ic(a){const b=cj(this);if(0===b.length)return!0;a=cj(a);if(0===a.length)return!1;for(const c of a)if(!b.some(d=>
|
|
797
797
|
dj(d,c)))return!1;return!0}filter(a){const b=this.N(),c=b.D;null===c?b.D=a:b.D=c instanceof olympe.dc.query.Y.Nd?new olympe.dc.query.Y.Nd(...Array.from(c.Y),a):new olympe.dc.query.Y.Nd(b.D,a);return b}sort(a,b){const c=this.N();c.Gb=new olympe.dc.query.xf(this.T(),a,b);return c}jh(){return this.Gb}mb(a){if(null!==this.D){var b=this.T();for(const c of oi(a,b))this.D.mb(c)||a.remove(c,b,null)}}observe(a,b){const c=this.T();return ej(this,fj(this,a,(d,e,f,g)=>{(d?qi(a,e,c,f):a.remove(e,c,f))&&b(d,e,
|
|
798
|
-
f,g)}))}Ea(){}};olympe.dc.query.ma.Wh=class extends olympe.dc.query.ma.
|
|
799
|
-
olympe.dm.Relation.j.
|
|
800
|
-
sh(this.db,g,this.
|
|
801
|
-
rule:`${this.db.name(this.
|
|
798
|
+
f,g)}))}Ea(){}};olympe.dc.query.ma.Wh=class extends olympe.dc.query.ma.Sm{constructor(a,b,c){super(a,c);this.relation=b;this.wa=null}};olympe.dc.query.ma.Tm=class{has(){}H(){}j(){}Vc(){}D(){}remove(){}};olympe.dc.query.ma.Od=class extends olympe.dc.query.ma.Sm{constructor(a,b,c){super(a,!1);this.Ob=b;this.F=null!=c?c:null}N(){return new olympe.dc.query.ma.Od(this.j,this.Ob,this.F)}X(){return olympe.U.rb(this.j+'followRules')}ia(){return new olympe.dc.query.ma.iq(this.db,this.F)}Z(a,b){return b instanceof olympe.dc.query.ma.Od?[a]:[olympe.U.rb(a+'followRules')]}Ic(a){if(a instanceof olympe.dc.query.ma.Wh){const b=olympe.dc.ta.ORIGIN,c=olympe.dc.ta.DESTINATION,d=olympe.dc.fc.Zc,e=olympe.dc.fc.Li,f=
|
|
799
|
+
olympe.dm.Relation.j.yr,g=olympe.dm.Relation.j.es;a=a.relation;const h=a.La(),k=a.W();return h!==c||k!==d&&k!==e?!!(qh(this.db,a,this.Ob)&(a.La()===b?f:g)):!0}return a instanceof olympe.dc.query.ma.Od?this.Ob===a.Ob:!1}mb(a){const b=this.T();for(const c of oi(a,this.j))for(const d of mg(this.db,c,this.Ob))qi(a,d,b,c)}observe(a,b){const c=this.T(),d=(e,f,g,h)=>{const k=`${h}:${g}`;f?rh(this.db,g,this.Ob,(l,n,p,q,r)=>{p&&(p=q?qi(a,r,c,g):a.remove(r,c,g),null!==n&&ri(a,q,l,n,g,r),p&&d(e,q,r,h))},k):
|
|
800
|
+
sh(this.db,g,this.Ob,k);b(f,g,e,k)};return(e,f,g,h)=>{(e?qi(a,f,c,f):a.remove(f,c,f))&&d(f,e,f,olympe.U.rb(h+f+this.toString()))}}fa(){return Object.assign(super.fa(),{f:this.Ob})}H(){return`followRulePart-${this.Ob}-${super.H()}`}Nc(){throw Error('Try to parse a part of an implicit query. Data connectors do not support those queries.');}toString(){return`FollowRule Part: ${this.db.name(this.Ob)} (${this.Ob})`}Ea(a){return a instanceof olympe.dc.query.ma.Od&&this.Ob===a.Ob}toJSON(){return{type:'follow rule',
|
|
801
|
+
rule:`${this.db.name(this.Ob)} (${this.Ob})`}}R(){return!1}filter(){olympe.ga.Wa('dc.query').warn('Should never try to filter on queries with follow rules, ignore...');return this}sort(){olympe.ga.Wa('dc.query').warn('Should never try to sort queries with follow rules, ignore...');return this}};olympe.dc.query.ma.Od.D='followRules';olympe.dc.query.ma.Hh=class extends olympe.dc.query.ma.Wh{constructor(a,b,c){super(a,olympe.dc.query.Relation.from(b,!1),c)}N(){const a=new olympe.dc.query.ma.Hh(this.j,this.relation,this.optional);a.D=this.D;a.Gb=this.Gb;return a}X(){return olympe.U.rb(this.j+this.relation.T())}Z(a,b){if(b instanceof olympe.dc.query.ma.Od)return[a];const c=[a+this.relation.T(),a+aj(this.relation).T()+!1,a+aj(this.relation).T()+!0,a+'followRules'].map(d=>olympe.U.rb(d));b instanceof olympe.dc.query.ma.De&&b.relation.Ea(this.relation)&&
|
|
802
802
|
c.push(a);return c}mb(a){const b=this.T();for(const c of oi(a,this.j))this.db.cb(c,this.relation).forEach(d=>{qi(a,d,b,c)});super.mb(a)}observe(a,b){const c=super.observe(a,b),d=this.relation.W(),e=this.relation.La(),f=this.toString();return(g,h,k,l)=>{const n=olympe.U.rb(l+h+f);g?T(this.db,h,this.relation,(p,q)=>{ri(a,p,d,e,h,q);c(p,q,h,n)},n):this.db.D(h,this.relation,n)}}fa(){return Object.assign(super.fa(),{t:this.relation.W(),d:this.relation.La()})}H(){return`followPart-${this.relation.T()}-${super.H()}`}Nc(){const a=
|
|
803
|
-
{recursive:!1,relation:this.relation,filter:cj(this).map(b=>b.map(c=>c.Nc())),optional:this.R()};this.Gb&&(a.sort={property:this.Gb.Pa(),order:this.Gb.Wi});return a}toString(){return`Follow Part: ${this.relation}`}toJSON(){return{type:'follow',relation:`${this.db.name(this.relation)} (${this.relation.W()})`,direction:this.relation.La()}}Ea(a){return a instanceof olympe.dc.query.ma.Hh&&this.relation.Ea(a.relation)}};olympe.dc.query.ma.
|
|
803
|
+
{recursive:!1,relation:this.relation,filter:cj(this).map(b=>b.map(c=>c.Nc())),optional:this.R()};this.Gb&&(a.sort={property:this.Gb.Pa(),order:this.Gb.Wi});return a}toString(){return`Follow Part: ${this.relation}`}toJSON(){return{type:'follow',relation:`${this.db.name(this.relation)} (${this.relation.W()})`,direction:this.relation.La()}}Ea(a){return a instanceof olympe.dc.query.ma.Hh&&this.relation.Ea(a.relation)}};olympe.dc.query.ma.De=class extends olympe.dc.query.ma.Wh{constructor(a,b,c,d){super(a,olympe.dc.query.Relation.from(b,!0),d);this.F=c}ia(){return new olympe.dc.query.ma.Cr}N(){const a=new olympe.dc.query.ma.De(this.j,this.relation,this.F,this.optional);a.D=this.D;a.Gb=this.Gb;return a}X(){return olympe.U.rb(this.j+this.relation.T()+this.F)}Z(a,b){if(b instanceof olympe.dc.query.ma.Od)return[a];const c=[a+this.relation.T()+this.F,a+'followRules'].map(d=>olympe.U.rb(d));b instanceof olympe.dc.query.ma.De&&
|
|
804
804
|
b.relation.Ea(this.relation)&&c.push(a);return c}mb(a){const b=this.T();for(const c of oi(a,this.j))this.F&&qi(a,c,b,c),this.db.nh(c,this.relation).forEach(d=>{qi(a,d,b,c)});super.mb(a)}observe(a,b){const c=this.relation.W(),d=this.relation.La(),e=(f,g,h,k)=>{const l=olympe.U.rb(k+g);f?T(this.db,g,this.relation,(n,p)=>{ri(a,n,c,d,g,p);super.observe(a,(q,r,t,v)=>{b(q,r,t,v);e(q,r,t,k)})(n,p,h,l)},l):this.db.D(g,this.relation,l)};return(f,g,h,k)=>{h=k+this.toString();this.F&&super.observe(a,b)(f,g,
|
|
805
805
|
g,olympe.U.rb(h+g));e(f,g,g,h)}}fa(){return Object.assign(super.fa(),{s:this.F,t:this.relation.W(),d:this.relation.La()})}H(){return`followRecursivelyPart-${this.relation.T()}-${this.F}-${super.H()}`}Nc(){const a={recursive:this.F?'INCLUDE_SELF':'EXCLUDE_SELF',relation:this.relation,filter:cj(this).map(b=>b.map(c=>c.Nc())),optional:this.R()};this.Gb&&(a.sort={property:this.Gb.Pa(),order:this.Gb.Wi});return a}toString(){return`FollowRecursively Part: ${this.relation}`}toJSON(){return{type:'follow recursively',
|
|
806
|
-
relation:`${this.db.name(this.relation)} (${this.relation.W()})`,direction:this.relation.La()}}Ea(a){return a instanceof olympe.dc.query.ma.
|
|
807
|
-
b){a===this.origin&&(this.origin=null);if(null===this.origin||!this.db.Ja(a)||!b)return this.content.delete(a);var c=this.content.get(a);if(!c)return!1;const d=c.get(b);if(1<d)return c.set(b,d-1),!0;b=c.delete(b);if(0===c.size)return this.content.delete(a);if(b){c=new Set(c.keys());for(const e of c){if(this.origin===e)return!0;let f,g;for(const h of null!=(g=null==(f=this.content.get(e))?void 0:f.keys())?g:[])c.add(h)}return this.content.delete(a)}return!1}};olympe.dc.query.ma.
|
|
808
|
-
(e=null==c?void 0:c.delete(b))?e:!1;0===(null==c?void 0:c.size)&&this.content.delete(a);return b}};olympe.dc.query.ma.
|
|
809
|
-
return b}};olympe.dc.query.ma.
|
|
810
|
-
function rj(a){const b=`/${olympe.V.getParameter(olympe.dc.sources.Config.
|
|
811
|
-
yield sj(a,k[lj])}catch(r){return new olympe.net.qd(`Invalid token ${r}`,oj,'Access denied')}try{var n=Number(d.get('requestType')),p=c.body;const r=olympe.dc.Request.j.oc,t=olympe.dc.Request.j.Sg,v=olympe.dc.Request.j.
|
|
812
|
-
Uint8Array&&(Y.content=p);break;default:throw Error(`Data Http request type not supported ${n}`);}let ya;const db=null!=(ya=k['X-Source-Origin'])?ya:olympe.dc.Ia
|
|
806
|
+
relation:`${this.db.name(this.relation)} (${this.relation.W()})`,direction:this.relation.La()}}Ea(a){return a instanceof olympe.dc.query.ma.De&&this.relation.Ea(a.relation)&&this.F===a.F}};olympe.dc.query.ma.mm=class extends olympe.dc.query.ma.Od{observe(a,b){const c=this.T();return(d,e,f,g)=>{d?qi(a,e,c,e):a.remove(e,c,e);b(d,e,e,g)}}};olympe.dc.query.ma.iq=class{constructor(a,b){this.db=a;this.origin=null;this.content=new Map;this.F=null!=b?b:null}Vc(){return this.content.keys()}j(a){return this.content.has(a)&&null!==this.origin?[this.origin].values():[].values()}has(a){return this.content.has(a)}H(a){let b;return(null==(b=this.F)?void 0:b.call(this,a))||!1}D(a,b){null===this.origin&&(this.origin=b);const c=this.content.get(a);if(!c)return this.content.set(a,(new Map).set(b,1)),!0;let d;a=null!=(d=c.get(b))?d:0;c.set(b,a+1);return!1}remove(a,
|
|
807
|
+
b){a===this.origin&&(this.origin=null);if(null===this.origin||!this.db.Ja(a)||!b)return this.content.delete(a);var c=this.content.get(a);if(!c)return!1;const d=c.get(b);if(1<d)return c.set(b,d-1),!0;b=c.delete(b);if(0===c.size)return this.content.delete(a);if(b){c=new Set(c.keys());for(const e of c){if(this.origin===e)return!0;let f,g;for(const h of null!=(g=null==(f=this.content.get(e))?void 0:f.keys())?g:[])c.add(h)}return this.content.delete(a)}return!1}};olympe.dc.query.ma.iq.ya=[olympe.dc.query.ma.Tm];olympe.dc.query.ma.Cr=class{constructor(){this.content=new Map}Vc(){return this.content.keys()}j(a){let b,c;return null!=(c=null==(b=this.content.get(a))?void 0:b.keys())?c:[]}has(a){return this.content.has(a)}H(){return!1}D(a,b){let c=this.content.get(a);c||(c=new Map,this.content.set(a,c));let d;a=null!=(d=c.get(b))?d:0;c.set(b,a+1);return 0===a}remove(a,b){if(null===b)return this.content.delete(a);const c=this.content.get(a),d=null==c?void 0:c.get(b);if(1<d)return c.set(b,d-1),!1;let e;b=null!=
|
|
808
|
+
(e=null==c?void 0:c.delete(b))?e:!1;0===(null==c?void 0:c.size)&&this.content.delete(a);return b}};olympe.dc.query.ma.Cr.ya=[olympe.dc.query.ma.Tm];olympe.dc.query.ma.bn=class{constructor(){this.content=new Map}Vc(){return this.content.keys()}j(a){let b,c;return null!=(c=null==(b=this.content.get(a))?void 0:b.values())?c:[]}has(a){return this.content.has(a)}H(){return!1}D(a,b){let c=this.content.get(a);c||(c=new Set,this.content.set(a,c));a=c.size;c.add(b);return a<c.size}remove(a,b){if(null===b)return this.content.delete(a);const c=this.content.get(a);let d;b=null!=(d=null==c?void 0:c.delete(b))?d:!1;0===(null==c?void 0:c.size)&&this.content.delete(a);
|
|
809
|
+
return b}};olympe.dc.query.ma.bn.ya=[olympe.dc.query.ma.Tm];olympe.dc.sources={};olympe.dc.sources.fk=class{T(){}init(){}destroy(){}request(){return u(function*(){})}subscribe(){}};const gj=olympe.net.ua.Rd.GET,hj=olympe.net.ua.Rd.Sh,ij=olympe.net.ua.Rd.Dc,jj=olympe.net.ua.Rd.fr,kj=olympe.net.ua.Headers.Ii,lj=olympe.net.ua.Headers.vo,mj=olympe.net.ua.Tb.Qh,nj=olympe.net.ua.Tb.Po,oj=olympe.net.ua.Tb.kk,pj=olympe.net.ua.Tb.gj,qj=olympe.net.ua.Tb.Zi;
|
|
810
|
+
function rj(a){const b=`/${olympe.V.getParameter(olympe.dc.sources.Config.om)}/:${'sourceId'}/:${'requestType'}`.replace(/\/+/g,'/').replace(/\/$/,'');a.R.D('_DataSourcesHTTPService',b,[gj,hj,ij,jj],(c,d,e)=>u(function*(){const f=d.get('sourceId');var g=a.F.get(d.get('sourceId'));if(!g){var h;g=null!=(h=olympe.dc.ha().name(f))?h:'name unknown';return Promise.resolve(new olympe.net.qd(`No handler found for datasource ${f} called '${g}'`,qj,'Invalid source id'))}h=c.method;const k=c.Cj();try{var l=
|
|
811
|
+
yield sj(a,k[lj])}catch(r){return new olympe.net.qd(`Invalid token ${r}`,oj,'Access denied')}try{var n=Number(d.get('requestType')),p=c.body;const r=olympe.dc.Request.j.oc,t=olympe.dc.Request.j.Sg,v=olympe.dc.Request.j.df,x=olympe.dc.Request.j.dh,y=olympe.dc.Request.j.yh,z=olympe.dc.Request.j.cg,A=olympe.dc.Request.j.eg,K=olympe.dc.Request.j.og;let Y;switch(n){case r:break;case t:case v:case y:case x:Y=a.D.N(p);break;case K:case z:case A:Y={tag:e.get('tag'),model:e.get('model'),mimeType:k[kj]};p instanceof
|
|
812
|
+
Uint8Array&&(Y.content=p);break;default:throw Error(`Data Http request type not supported ${n}`);}let ya;const db=null!=(ya=k['X-Source-Origin'])?ya:olympe.dc.Ia.Ze;var q=Sf(new olympe.dc.Request(n,f,Y,l),db);const Qa=yield g(q);let dd;void 0===Qa?dd='':Qa instanceof Blob||Qa instanceof Uint8Array||Qa instanceof ArrayBuffer||'function'===typeof(null==Qa?void 0:Qa.pipe)?dd=Qa:dd=JSON.stringify(a.D.fa(Qa));return new olympe.net.qd(dd,h===jj?nj:mj)}catch(r){return r instanceof olympe.error.uk?new olympe.net.qd(`Authorization error: ${r}`,
|
|
813
813
|
oj,'Forbidden'):new olympe.net.qd(`Internal server error: ${r}`,pj,'Internal server error')}})).catch(c=>a.G.error(`Error while starting the HTTP Service: ${c}`));a.G.debug(`Started HTTP service with path: ${b}`)}function tj(a){a.R.R('_DataSourcesHTTPService').catch(b=>{a.G.error(`An error occurred while stopping the data sources http service: ${b}`)})}function uj(a,b,c){0===a.F.size&&rj(a);a.F.set(b,c);return()=>{a.F.delete(b);0===a.F.size&&tj(a)}}
|
|
814
814
|
function vj(a,b,c){c=b instanceof olympe.dm.DataSource?b.Qf(c):wj(b,c);null===c&&a.G.error(`Impossible to build URL for data source ${b}`);return c}
|
|
815
|
-
function xj(a,b,c){if(b===olympe.dc.Ia.SERVER){var d;return null!=(d=se(a.H,a.
|
|
815
|
+
function xj(a,b,c){if(b===olympe.dc.Ia.SERVER){var d;return null!=(d=se(a.H,a.ba.get(c)))?d:null}var e=a.N.get(b);if(!e){d=a.Z.jb(b);e=olympe.dc.sources.Config.Ih;const f=olympe.dc.sources.Config.Bf,g=olympe.dc.sources.Config.Qi,h=olympe.dc.sources.Config.om;let k;e=`${vj(a,null!=d?d:b,g)?'https':'http'}://${vj(a,null!=d?d:b,e)}:${null!=(k=vj(a,null!=d?d:b,f))?k:vj(a,null!=d?d:b,g)?443:80}`+`/${vj(a,null!=d?d:b,h)}/${b}`.replace(/\/+/g,'/').replace(/\/$/,'');a.N.set(b,e)}return`${e}/${c}`}
|
|
816
816
|
function yj(a,b){return b instanceof olympe.net.Si?ue(a.H,b,ee(a.X).Gd()):Promise.reject('No http request to send')}function zj(a,b){var c=xj(a,b.ic(),b.getType());if(!c)return Promise.reject(`No destination URL to send the query to destination: ${b.ic()}`);const d=b.content,e=JSON.stringify(a.D.fa(d));c=N(c,hj,e,olympe.net.ua.ResponseType.JSON);Fc(c,{['X-Source-Origin']:b.origin,[kj]:'application/json'});return yj(a,c).then(f=>(f=f.getData())?a.D.N(f):olympe.dc.query.Dd.xj(d))}
|
|
817
817
|
function Aj(a,b){var c=xj(a,b.ic(),b.getType());if(!c)return Promise.reject(`No destination URL to send the transaction to destination: ${b.ic()}`);const d=JSON.stringify(a.D.fa(b.content));c=N(c,hj,d);Fc(c,{['X-Source-Origin']:b.origin,[kj]:'application/json'});return yj(a,c).then(e=>Number.parseInt(e.getData(),10))}function sj(a,b){return'string'!==typeof b?Promise.reject('Please provide an authorization token.'):new Promise((c,d)=>{a.X.qh(b,(e,f)=>{e?d(e):c(f)})})}
|
|
818
|
-
olympe.dc.sources.
|
|
819
|
-
[olympe.dc.Request.j.Sg,olympe.L.Yb.
|
|
818
|
+
olympe.dc.sources.Au=class{constructor(a,b,c,d,e,f){this.G=a;this.R=b;this.H=c;this.X=d;this.Z=e;this.D=f;this.F=new Map;new olympe.C.Xb('Http service of remote data provider');this.N=new Map;this.j=new Map;this.ba=new Map([[olympe.dc.Request.j.Jg,olympe.L.Yb.Jg],[olympe.dc.Request.j.eg,olympe.L.Yb.ik],[olympe.dc.Request.j.og,olympe.L.Yb.ik],[olympe.dc.Request.j.cg,olympe.L.Yb.ik],[olympe.dc.Request.j.xo,olympe.L.Yb.wo],[olympe.dc.Request.j.wr,olympe.L.Yb.vr],[olympe.dc.Request.j.Lp,olympe.L.Yb.Kp],
|
|
819
|
+
[olympe.dc.Request.j.Sg,olympe.L.Yb.Jo],[olympe.dc.Request.j.dh,olympe.L.Yb.TRANSACTION]])}Kc(a){var b=xj(this,a.ic(),a.getType());if(!b)return Promise.reject(`No destination URL to send the status request to destination: ${a.ic()}`);b=Hc(N(b,gj),olympe.net.ua.ResponseType.JSON);Fc(b,{['X-Source-Origin']:a.origin});return yj(this,b).then(c=>c.getData())}uploadFileContent(a){const {tag:b,model:c,content:d}=a.content,e=a.ic(),f=xj(this,e,a.getType());if(!f)return Promise.reject(`No destination URL to upload the file. ${b}`);
|
|
820
820
|
const g=N(e===olympe.dc.Ia.SERVER?`${f}/${b}`:`${f}?tag=${b}&model=${c}`,jj,d);Fc(g,{[kj]:'application/octet-stream'});e!==olympe.dc.Ia.SERVER&&Fc(g,{['X-Source-Origin']:a.origin});return yj(this,g).then(()=>(new URL(g.j())).pathname)}deleteFileContent(a){const {tag:b,model:c}=a.content,d=a.ic();var e=xj(this,d,a.getType());if(!e)return Promise.reject(`No destination URL to delete the file. ${b}`);e=N(d===olympe.dc.Ia.SERVER?`${e}/${b}`:`${e}?tag=${b}&model=${c}`,ij,b);d!==olympe.dc.Ia.SERVER&&Fc(e,
|
|
821
821
|
{['X-Source-Origin']:a.origin});return yj(this,e).then(()=>{})}downloadFileContent(a){const {tag:b,model:c}=a.content,d=a.ic();var e=xj(this,d,a.getType());if(!e)return Promise.reject(Error(`No destination URL to download the file. ${b}`));var f;const g=null!=(f=this.j.get(b))?f:[];f=new Promise((h,k)=>{g.push({done:h,li:k})});if(this.j.has(b))return f;this.j.set(b,g);e=N(d===olympe.dc.Ia.SERVER?`${e}/${b}`:`${e}?tag=${b}&model=${c}`,gj,void 0,olympe.net.ua.ResponseType.$h);d!==olympe.dc.Ia.SERVER&&
|
|
822
|
-
Fc(e,{['X-Source-Origin']:a.origin});yj(this,e).then(h=>{let k;null==(k=this.j.get(b))||k.forEach(l=>l.done(h.getData()))}).catch(h=>{let k;null==(k=this.j.get(b))||k.forEach(l=>l.li(`${h}`))}).finally(()=>{this.j.delete(b)});return f}};olympe.dc.sources.
|
|
822
|
+
Fc(e,{['X-Source-Origin']:a.origin});yj(this,e).then(h=>{let k;null==(k=this.j.get(b))||k.forEach(l=>l.done(h.getData()))}).catch(h=>{let k;null==(k=this.j.get(b))||k.forEach(l=>l.li(`${h}`))}).finally(()=>{this.j.delete(b)});return f}};olympe.dc.sources.gq=class{constructor(a,b){this.G=a;this.Jb=b}};olympe.dc.sources.gq.Tb={ij:0,WC:1,XC:3,qC:4};const Bj=olympe.dc.Request.j.oc,Cj=olympe.dc.Request.j.Sg,Dj=olympe.dc.Request.j.Gk,Ej=olympe.dc.Request.j.og,Fj=olympe.dc.Request.j.eg,Gj=olympe.dc.Request.j.cg,Hj=olympe.dc.Request.j.Fi,Ij=olympe.dc.Request.j.yh,Jj=olympe.dc.Request.j.df,Kj=olympe.dc.Request.j.dh,Lj=olympe.dc.Request.j.ck;
|
|
823
823
|
function Mj(a,b){const c=b.T();null===a.D&&(a.D=new olympe.U.Zh(6E4),hb(a.D,(f,g)=>{a.applyTransaction(g,!1).catch(h=>{a.G.error(`Error occurred when applying burst transaction ${f} to the data source: ${h}`)})}),ib(a.D,()=>{a.D=null}));let d;const e=null!=(d=a.D.get(c))?d:new olympe.dc.db.ec(c);b.qc(e);fb(a.D.j,c)||a.D.set(c,e)}function Nj(a,b){return u(function*(){const c=Sf(new olympe.dc.Request(olympe.dc.Request.j.ck,a.T(),b),olympe.dc.Ia.SELF);let d;yield null==(d=a.Jb)?void 0:d.xi(c)})}
|
|
824
824
|
function Oj(a,b){const c=b.T();let d,e;const f=null!=(e=null==(d=a.D)?void 0:d.get(c))?e:new olympe.dc.db.ec(c);let g;null==(g=a.D)||g.delete(c);b.qc(f);return a.applyTransaction(f,!1).catch(h=>{a.G.error(`Error occurred when applying burst transaction ${c} to the data source: ${h}`)})}function Pj(a,b){const c=rxjs.defer(()=>a.j.executeQuery(b));return 0<a.N?rxjs.interval(a.N).pipe(rxjs.operators.switchMap(()=>c)):c}
|
|
825
|
-
olympe.dc.sources.
|
|
825
|
+
olympe.dc.sources.vq=class{constructor(a,b){this.G=a;this.j=b;this.Jb=null;this.H=olympe.dc.query.ml();this.F=new olympe.C.Xb('Context of source '+this.T());let c;this.N=null!=(c=b.Qf(olympe.dc.sources.Config.Qm))?c:-1;this.D=null}T(){return this.j.T()}init(a){this.Jb=a;if(this.T()===olympe.dc.Ia.SELF)return this;(new Promise((b,c)=>{let d=!0;Qj(this.j,this.F).subscribe(rxjs.Subscriber.create(e=>{if(this.G.j()){this.G.debug(`Data source ${this.j.name()} has loaded ${e.size()} data types in its cache:`);
|
|
826
826
|
for(const [f,g]of e)this.G.debug(`=> DataType: ${g.name()} (${f})`)}d&&(d=!1,b())},c))})).then(()=>this.j.init(this.F)).catch(b=>{this.G.error(`Error while initialization of DataSource ${this.j.name()} (${this.T()}): ${b}`)});return this}healthCheck(){return this.j.healthCheck().then(()=>`Data source ${this.j.name()} (${this.j.T()}) OK`)}destroy(){this.F.destroy();return this.j.destroy()}request(a){const b=a.content;var c=a.getType();switch(c){case Bj:const d=olympe.dm.DataSource.oc.Ab,e=olympe.dm.DataSource.oc.Vh;
|
|
827
|
-
return this.j.healthCheck().then(()=>({s:e})).catch(h=>({s:d,r:String(h)}));case Cj:return this.j.executeQuery(b);case Hj:const f=b.ac();Mj(this,f);Nj(this,Of(f)).catch(h=>{this.G.warn(`Error occurred when applying burst transaction ${f.T()} to the data source: ${h}`)});return Promise.resolve();case Jj:case Kj:const g=b.ac();return this.applyTransaction(g,c===Kj).finally(()=>{if(a.origin===olympe.dc.Ia.SELF){var h=g.T();h=Sf(new olympe.dc.Request(olympe.dc.Request.j.
|
|
827
|
+
return this.j.healthCheck().then(()=>({s:e})).catch(h=>({s:d,r:String(h)}));case Cj:return this.j.executeQuery(b);case Hj:const f=b.ac();Mj(this,f);Nj(this,Of(f)).catch(h=>{this.G.warn(`Error occurred when applying burst transaction ${f.T()} to the data source: ${h}`)});return Promise.resolve();case Jj:case Kj:const g=b.ac();return this.applyTransaction(g,c===Kj).finally(()=>{if(a.origin===olympe.dc.Ia.SELF){var h=g.T();h=Sf(new olympe.dc.Request(olympe.dc.Request.j.jk,olympe.dc.Ia.SELF,{id:h,finalize:olympe.dc.transaction.Jf.j.$i,
|
|
828
828
|
error:null}),this.T());let k;null==(k=this.Jb)||k.cd(h)}});case Ij:return Oj(this,b.ac());case Ej:return b.content instanceof Uint8Array?this.j.uploadFileContent(b.tag,b.model,b.content).then(()=>`datasource://${b.tag}`):Promise.reject('File content is undefined');case Fj:return this.j.downloadFileContent(b.tag,b.model);case Gj:return this.j.deleteFileContent(b.tag,b.model);case Lj:return c=Sf(new olympe.dc.Request(Lj,olympe.dc.Ia.SELF,b,a.xc()),this.T()),this.Jb.cd(c);default:return Promise.reject(`Request of type ${a.getType()} is not supported by the data source`)}}subscribe(a){if(a.getType()===
|
|
829
|
-
Dj){const b=a.content;a=a.origin;return a===olympe.dc.Ia.SELF?Pj(this,b):Di(this.H,b,this.F,a,olympe.dc.la.nc.wf,{}).pipe(rxjs.operators.map(c=>{let d,e;return null!=(e=null==(d=c.
|
|
830
|
-
Of(a,d);yield Nj(c,e);return d})}};olympe.dc.sources.
|
|
829
|
+
Dj){const b=a.content;a=a.origin;return a===olympe.dc.Ia.SELF?Pj(this,b):Di(this.H,b,this.F,a,olympe.dc.la.nc.wf,{}).pipe(rxjs.operators.map(c=>{let d,e;return null!=(e=null==(d=c.Se)?void 0:d.F)?e:null}),rxjs.operators.filter(c=>null!==c),rxjs.operators.map(c=>Of(c,Date.now())))}return rxjs.throwError(()=>Error('Subscription request not supported'))}applyTransaction(a,b){const c=this;return u(function*(){var d=Rj(a);yield c.j.applyTransaction(d,{batch:b});d=Date.now();yield Ni(c.H,c.T(),a);const e=
|
|
830
|
+
Of(a,d);yield Nj(c,e);return d})}};olympe.dc.sources.vq.ya=[olympe.dc.sources.fk];function Rj(a){const b=olympe.dc.sources.lg.j.Zt,c=olympe.dc.sources.lg.j.Uw,d=olympe.dc.sources.lg.j.eu,e=olympe.dc.sources.lg.j.$t,f=olympe.dc.sources.lg.j.fu,g=[],h=[],k=[],l=[],n=[];a.Bb.forEach((p,q)=>{const r=p.Vb();p.D()?g.push(Sj(b,q,r,p.N()?p.zb():null)):p.yd()?k.push(Sj(d,q,r,null,p.F())):p.N()&&h.push(Sj(c,q,r,p.zb()));for(const [t,v,x]of p.Id())p=a.Uc(v),x?l.push(new Tj(e,t,q,v,r,p.Vb())):n.push(new Tj(f,t,q,v,r,p.Vb()))});return n.concat(k,g,h,l)}
|
|
831
831
|
function Sj(a,b,c,d,e){if('string'!==typeof c)throw Error(`Patch: model of instance ${b} is missing. It is invalid transaction.`);return new Uj(a,b,c,d,e)}olympe.dc.sources.lg=class{constructor(a){this.type=a}};class Uj extends olympe.dc.sources.lg{constructor(a,b,c,d,e){super(a);this.object=b;this.model=c;this.properties=null!=d?d:null;this.deleteRules=null!=e?e:olympe.dc.Lb.NONE}}
|
|
832
|
-
class Tj extends olympe.dc.sources.lg{constructor(a,b,c,d,e,f){super(a);this.relation=b;this.from=c;this.to=d;this.fromModel=e;this.toModel=f}}olympe.dc.sources.lg.j={
|
|
833
|
-
olympe.dc.sources.
|
|
834
|
-
q=a.getType(),r=a.ic();if(Pd(b.D)){q===d&&(c=a.content,(g=Uf(a).get(olympe.dc.la.j.
|
|
832
|
+
class Tj extends olympe.dc.sources.lg{constructor(a,b,c,d,e,f){super(a);this.relation=b;this.from=c;this.to=d;this.fromModel=e;this.toModel=f}}olympe.dc.sources.lg.j={Zt:'CREATE',Uw:'UPDATE',eu:'DELETE',$t:'CREATE_RELATION',fu:'DELETE_RELATION'};function Vj(a,b){b=Sf(new olympe.dc.Request(olympe.dc.Request.j.jk,olympe.dc.Ia.SELF,{id:b,finalize:olympe.dc.transaction.Jf.j.$i,error:null}),a.T());let c;null==(c=a.Jb)||c.cd(b)}
|
|
833
|
+
olympe.dc.sources.Ul=class{constructor(a,b){this.G=a;this.D=b;this.Jb=null}T(){}X(){}Z(){}init(a){this.Jb=a;return this}destroy(){return Promise.resolve()}request(a){const b=this;return u(function*(){if(!b.D.j)return b.X(a);var c=olympe.dc.Request.j.oc,d=olympe.dc.Request.j.Sg;const e=olympe.dc.Request.j.df,f=olympe.dc.Request.j.dh;var g=olympe.dc.Request.j.Fi;const h=olympe.dc.Request.j.yh,k=olympe.dc.Request.j.og;var l=olympe.dc.Request.j.eg;const n=olympe.dc.Request.j.cg,p=olympe.dc.sources.ce(),
|
|
834
|
+
q=a.getType(),r=a.ic();if(Pd(b.D)){q===d&&(c=a.content,(g=Uf(a).get(olympe.dc.la.j.Pl))&&(yield Wj(p,c.T(),g)),b.G.debug(`Data Provider: Query ${c.T()} will be executed with its default Remote or Server provider`));if(q===l&&(l=a.content,'string'===typeof(null==l?void 0:l.url)&&l.url.startsWith('offline://')))return p.downloadFileContent(l.tag);l=yield b.X(a);if(q===d){const t=a.content;d=l;const v=new olympe.dc.db.ec(`fullResult_${t.T()}`);l=d.pipeThrough(new TransformStream({transform:(x,y)=>u(function*(){const z=
|
|
835
835
|
x.ac();yield Xj(p,z);z.qc(v);b.G.j()&&b.G.debug(`Data Provider: Data result for query ${t.T()}`,z.Bb.size,'instances',Array.from(z.Id()).length,'relations');y.enqueue(x)}),flush:()=>u(function*(){yield Yj(p,t.T(),r,v,!0)})}))}else if(q===e||q===f||q===h)b.G.debug('Data Provider: Persisting graph patch in offline cache after successful transaction'),yield Zj(p,null,r,a.content.ac(),!1);return l}b.G.debug(`Data Provider: Request (type: ${q}) will be sent to the cache data provider: ${a.content}`);switch(q){case c:return{s:olympe.dm.DataSource.oc.Ef};
|
|
836
836
|
case d:return p.executeQuery(a.content);case e:case f:case h:d=a.content;const t=d.ac().T();return p.applyTransaction(d,r).finally(()=>Vj(b,t));case g:return Promise.resolve();case k:return d=a.content,p.uploadFileContent(d.tag,d.content,d.mimeType);case l:return p.downloadFileContent(a.content.tag);case n:return p.deleteFileContent(a.content.tag);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${b.T()}`)}})}subscribe(a,b){if(!this.D.j)return this.Z(a,
|
|
837
|
-
b);const c=olympe.dc.sources.
|
|
838
|
-
throw g;}))))}};olympe.dc.sources.
|
|
839
|
-
function lk(a,b){let c;return(null==(c=a.
|
|
840
|
-
function ok(a,b,c,d,e){return u(function*(){var f=olympe.L.va.j.SEND,g=olympe.L.va.j.GET;const h=olympe.L.va.j.PUBLISH,k=olympe.L.va.j.SUBSCRIBE,l=d.
|
|
841
|
-
g=yield d.
|
|
842
|
-
olympe.dc.sources.
|
|
837
|
+
b);const c=olympe.dc.sources.ce(),d=a.content,e=a.ic();return rxjs.of(null).pipe(rxjs.operators.switchMap(()=>{if(Pd(this.D)){const f=new rxjs.Observable(h=>{olympe.C.ot([this.D.qf()],()=>{h.error(new olympe.error.Op('Go Offline',d.T()))})}),g=this.Z(a,b);return rxjs.merge(f,g)}return new rxjs.Observable(f=>{olympe.C.ot([this.D.qf()],()=>{f.error(new olympe.error.Io('Back Online',d.T()))})})})).pipe(rxjs.operators.switchMap(f=>rxjs.from(Zj(c,d.T(),e,f.ac()).then(()=>f).catch(g=>{this.G.error(`Data Provider: Cache database failed to handle the data result with message: ${g}`);
|
|
838
|
+
throw g;}))))}};olympe.dc.sources.Ul.ya=[olympe.dc.sources.fk];const ak=olympe.dc.Request.j.oc,bk=olympe.dc.Request.j.Sg,ck=olympe.dc.Request.j.Gk,dk=olympe.dc.Request.j.df,ek=olympe.dc.Request.j.dh,fk=olympe.dc.Request.j.Fi,gk=olympe.dc.Request.j.yh,hk=olympe.dc.Request.j.og,ik=olympe.dc.Request.j.eg,jk=olympe.dc.Request.j.cg;function kk(a,b){let c;return(null==(c=a.Ha.jb(b))?void 0:c.Qf(olympe.dc.sources.Config.Ve))!==olympe.dm.DataSource.Ve.Rp}
|
|
839
|
+
function lk(a,b){let c;return(null==(c=a.Ha.jb(b))?void 0:c.Qf(olympe.dc.sources.Config.Ve))!==olympe.dm.DataSource.Ve.Ao}function mk(a,b,c){const d=c.content.ac().T();let e=a.ba.get(d);e||(e=olympe.L.qb.$s(b),a.ba.set(d,e));return e.ld(c)}function nk(a,b){b=b.xc();if(b!==olympe.dm.User.j&&a.Qf(olympe.dc.sources.Config.Xm))throw a=`User ${b} has no right to access the restricted data source ${a.name()} (${a.T()}). Please use an admin account instead.`,new olympe.error.uk(a);}
|
|
840
|
+
function ok(a,b,c,d,e){return u(function*(){var f=olympe.L.va.j.SEND,g=olympe.L.va.j.GET;const h=olympe.L.va.j.PUBLISH,k=olympe.L.va.j.SUBSCRIBE,l=d.qt();var n=d.body();if(e!==n.xc())throw Error('Access denied: try to impersonate a user');nk(c,n);let p;if(null==(p=a.Jb)||!p.sources.has(n.ic()))throw Error(`Try to process a message with destination data source ${n.ic()} coming from remote but not started here`);if(l===k){if(n.getType()===ck)f=n.content.T();else throw Error('Not supported type of subscription');
|
|
841
|
+
g=yield d.Un(f);a.ia.set(g,f);g=a.N.get(f);g||(g=new pk(a.G,f,b,Sf(n,olympe.dc.Ia.Ze)),a.N.set(f,g));g.subscribe()}else l===g?(n=yield b.request(n),void 0!==n?yield d.cd(n):a.G.warn(`Request from ${d.source()} requires an output value, but got undefined instead.`)):l===f?(yield b.request(n),yield d.ack()):l===h&&(yield b.request(n))})}
|
|
842
|
+
olympe.dc.sources.Fr=class extends olympe.dc.sources.Ul{constructor(a,b,c,d,e,f){super(a,d);this.H=b;this.j=c;this.db=e;this.F=new olympe.C.Xb('Remote Provider Context');this.wa=new Map;this.R=new Map;this.N=new Map;this.ia=new Map;this.Ha=f;this.ba=new Map}T(){return olympe.dc.Ia.Ze}X(a){var b=olympe.L.qb;const c=a.ic();var d=a.getType();this.G.j()&&this.G.debug(`Request (type: ${d}) will be sent to remote data provider ${c}: ${a.content}`);switch(d){case ak:const e=olympe.dm.DataSource.oc.Ab,f=
|
|
843
843
|
olympe.dm.DataSource.oc.Vh;b=kk(this,c)?b.get(c,a):Promise.resolve({s:f});a=lk(this,c)?this.j.Kc(a):Promise.resolve({s:f});return Promise.all([b,a]).then(([k,l])=>{if((null==k?void 0:k.s)===e||(null==l?void 0:l.s)===e){let n,p;return{s:e,r:`${null!=(n=null==k?void 0:k.r)?n:''} ${null!=(p=null==l?void 0:l.r)?p:''}`}}return{s:f}});case bk:return lk(this,c)?zj(this.j,a):b.get(c,a);case dk:const g=a.content.ac().T();return(kk(this,c)?b.get(c,a):Aj(this.j,a)).finally(()=>Vj(this,g));case ek:const h=a.content.ac().T();
|
|
844
|
-
return(lk(this,c)?Aj(this.j,a):b.get(c,a)).finally(()=>Vj(this,h));case fk:return kk(this,c)?mk(this,c,a).catch(k=>{this.G.error(`An error occurred while sending "burst transaction" to the data source ${c}: ${k}`)}):Promise.resolve();case gk:return d=a.content.ac().T(),this.
|
|
844
|
+
return(lk(this,c)?Aj(this.j,a):b.get(c,a)).finally(()=>Vj(this,h));case fk:return kk(this,c)?mk(this,c,a).catch(k=>{this.G.error(`An error occurred while sending "burst transaction" to the data source ${c}: ${k}`)}):Promise.resolve();case gk:return d=a.content.ac().T(),this.ba.delete(d),kk(this,c)?b.get(c,a):Aj(this.j,a);case hk:return lk(this,c)?this.j.uploadFileContent(a):b.get(c,a);case ik:return lk(this,c)?this.j.downloadFileContent(a):b.get(c,a);case jk:return lk(this,c)?this.j.deleteFileContent(a):
|
|
845
845
|
b.send(c,a);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${this.T()}`)}}Z(a,b){const c=a.ic(),d=a.getType();if(!kk(this,c))return rxjs.throwError(()=>Error(`Subscription request not supported for data source ${this.db.name(c)} (${c}) which uses HTTP only.`));this.G.j()&&this.G.debug(`Subscription (type: ${d}) will be sent to remote data provider ${c}: ${a.content}`);return d===ck?olympe.L.qb.observe(c,this.F,a,{onRetry:b}).observable:rxjs.throwError(()=>
|
|
846
|
-
Error(`Do not handle subscription request of type ${d}`))}init(a){super.init(a);if(a.F)return this;olympe.dc.la.from(this.H,this.H).bb(olympe.dm.DataSource.Mj).filter(olympe.dc.query.za.Ea(olympe.dm.DataSource.gi,!0)).filter(olympe.dc.query.za.Ea(olympe.dm.DataSource.
|
|
847
|
-
{b=b.body();b instanceof olympe.dc.Request?a.cd(b):this.G.error('Self source received something else than a data request, ignore it.')});return this}destroy(){return u(function*(){})}lb(a,b){const c=b.W(),d=new olympe.C.Xb(`Published data provider context ${c}`,this.F);this.wa.set(c,d);let e;qk(b,d).subscribe(f=>{let g;null==(g=e)||g();let h;null==(h=this.R.get(c))||h.stop();this.R.delete(c);f!==olympe.dm.DataSource.
|
|
848
|
-
(k=e)?void 0:k()}));f!==olympe.dm.DataSource.
|
|
849
|
-
if(a=b)null==(a=this.N.get(b))?a=0:(0<a.
|
|
850
|
-
class pk{constructor(a,b,c,d){this.G=a;this.
|
|
851
|
-
olympe.dc.sources.cc=class extends olympe.L.cc{constructor(a){super();this.Z=a;this.db=a.view;this.F=new Map}fa(a){a=super.fa(a);if(0<this.F.size){const b=Array.from(this.F.values());this.F.clear();return Object.assign(this.format(W.
|
|
852
|
-
a.get(olympe.dm.File.urlProp);if(f.startsWith('blob:')||f.startsWith('stream:'))a=olympe.dc.
|
|
853
|
-
a.qc(b),this.format(W.
|
|
854
|
-
a||'object'!==typeof a)return super.j(a);const {t:b,v:c}=a;switch(b){case W.
|
|
855
|
-
Sf(new olympe.dc.Request(c.r,c.d,a,c.u),c.o);case W.
|
|
856
|
-
d:a});c={t:a,m:this.db.model(a),s:this.db.source(a),p:b,r:c};this.db.
|
|
857
|
-
olympe.dc.Request.j.yh,Mk=olympe.dc.Request.j.
|
|
858
|
-
function Sk(a,b){const c=b.ac(),d=new olympe.dc.transaction.
|
|
859
|
-
function Uk(a,b){const c=new olympe.dc.transaction.
|
|
860
|
-
function Wk(a,b){const c=encodeURI(ab(olympe.U.
|
|
861
|
-
function $k(a,b){if(!Ae(a.F))return a.G.error(`Server is disconnected, backup of instance ${b} is canceled.`),Promise.reject('Server is disconnected');b=Xk(a,olympe.dc.la.from(b));b.f=olympe.dc.Lb.
|
|
862
|
-
function al(a,b,c,d){if(!Ae(a.F))return a.G.error('Server is disconnected, restore of instance is canceled.'),Promise.reject('Server is disconnected');const e=xj(a.j,olympe.dc.Ia.SERVER,xk);b=N(e+`?debug=${c}&optional=${d}`,olympe.net.ua.Rd.Sh,b);Fc(b,{[olympe.net.ua.Headers.Ii]:olympe.net.ua.
|
|
863
|
-
function Rk(a,b,c,d=!0){const e=olympe.L.
|
|
864
|
-
function Xk(a,b){var c=ki(b);b={i:b.T(),b:[b.D],m:!0,v:!0};if(c[0]instanceof olympe.dc.query.ma.Od)Object.assign(b,{f:c[0].
|
|
846
|
+
Error(`Do not handle subscription request of type ${d}`))}init(a){super.init(a);if(a.F)return this;olympe.dc.la.from(this.H,this.H).bb(olympe.dm.DataSource.Mj).filter(olympe.dc.query.za.Ea(olympe.dm.DataSource.gi,!0)).filter(olympe.dc.query.za.Ea(olympe.dm.DataSource.Js,!0)).observe(this.F).subscribe(b=>{b.yj().forEach(this.lb.bind(this,a));b.Ej().forEach(c=>{let d;null==(d=this.wa.get(c))||d.destroy();this.wa.delete(c)})});this.db.Pa(this.H,olympe.dm.DataSource.Js)&&(new olympe.L.qb(this.H,this.F)).listen().subscribe(b=>
|
|
847
|
+
{b=b.body();b instanceof olympe.dc.Request?a.cd(b):this.G.error('Self source received something else than a data request, ignore it.')});return this}destroy(){return u(function*(){})}lb(a,b){const c=b.W(),d=new olympe.C.Xb(`Published data provider context ${c}`,this.F);this.wa.set(c,d);let e;qk(b,d).subscribe(f=>{let g;null==(g=e)||g();let h;null==(h=this.R.get(c))||h.stop();this.R.delete(c);f!==olympe.dm.DataSource.Ve.Ao&&(e=uj(this.j,c,k=>{nk(b,k);return a.request(k)}),d.onDestroy(()=>{let k;return null==
|
|
848
|
+
(k=e)?void 0:k()}));f!==olympe.dm.DataSource.Ve.Rp&&(f=new olympe.C.Xb(`Bus Service of data source ${c}`,d),f=(new olympe.L.qb(c,f)).yt(this.Ua.bind(this)),this.R.set(c,f),f.listen().subscribe(k=>{k.Bi().then(l=>ok(this,a,b,k,l)).catch(l=>{this.G.warn(`Error occurred while processing request from ${k.source()}: ${l}`);return k.li(l instanceof Error?l:Error(l))})}))})}xi(a){const b=this;return u(function*(){let c;yield null==(c=b.R.get(a.ic()))?void 0:c.xi(a)})}Ua(a){const b=this.ia.get(a);this.ia.delete(a);
|
|
849
|
+
if(a=b)null==(a=this.N.get(b))?a=0:(0<a.j&&--a.j,0===a.j?(a.G.debug(`Data subscription ${a.D} has more subscriber: unsubscribe`),a.F.unsubscribe(),a=!0):(a.G.debug(`Data subscription ${a.D} has ${a.j} subscribers`),a=!1));a&&this.N.delete(b)}};
|
|
850
|
+
class pk{constructor(a,b,c,d){this.G=a;this.D=b;this.j=0;this.F=c.subscribe(d).subscribe({next:e=>{olympe.L.qb.ld(b,e).catch(f=>a.error(`Error occurred while publishing a data notification: ${f}`))},error:e=>a.error(`Error occurred while trying to subscribe to topic ${b} for a datasource: ${e}`)})}subscribe(){this.j++;this.G.debug(`Data subscription ${this.D} has ${this.j} subscribers`);return this}}olympe.dc.sources.Fr.ya=[olympe.dc.sources.fk];const W={us:10,Oo:11,up:12,lr:13,QUERY_RESULT:14,Mp:15,cp:16,df:17,mr:18,bp:19,fj:20};function rk(a,b){const c=new olympe.dc.transaction.Ie,d=new olympe.dc.transaction.Ie;b.forEach(e=>{const f=new Map(Array.from(Object.entries(e.p).map(([h,k])=>[h,a.j(k)]))),g=e.v?d:c;g.Sc(e.t,e.s,f,e.m);e.r.forEach(h=>g.Oa(h.r,h.o,h.d))});a.Z.nd(Xf(Yf(d),olympe.dc.Ia.SELF),{persist:!1});a.Z.nd(Xf(Yf(c),olympe.dc.Ia.SELF))}
|
|
851
|
+
olympe.dc.sources.cc=class extends olympe.L.cc{constructor(a){super();this.Z=a;this.db=a.view;this.F=new Map}fa(a){a=super.fa(a);if(0<this.F.size){const b=Array.from(this.F.values());this.F.clear();return Object.assign(this.format(W.us,a),{i:b})}return a}N(a){return(null==a?void 0:a.t)===W.us&&Array.isArray(null==a?void 0:a.i)?(rk(this,a.i),this.j(a.v)):this.j(a)}D(a){switch(!0){case a instanceof olympe.dm.File:var b=this.format,c=W.up;{const d=a.W(),e={t:d};if(!this.F.has(d)&&(this.H(d),!this.db.Re(d))){const f=
|
|
852
|
+
a.get(olympe.dm.File.urlProp);if(f.startsWith('blob:')||f.startsWith('stream:'))a=olympe.dc.Rs().Ha(a),this.F.get(d).p[olympe.dm.File.urlProp.W()]='stream://'+d,e.s=this.D(a)}a=e}return b.call(this,c,a);case a instanceof olympe.dc.CloudObject:return this.format(W.Oo,this.H(a.W()));case a instanceof olympe.dc.la:return this.format(W.lr,a.fa());case a instanceof olympe.dc.Ka:return this.format(W.QUERY_RESULT,a.fa(this.H.bind(this)));case a instanceof olympe.dc.db.ec:return b=new olympe.dc.transaction.Ie,
|
|
853
|
+
a.qc(b),this.format(W.Mp,{i:a.T(),p:Yf(b)});case a instanceof olympe.dc.Request:return this.format(W.cp,{r:a.getType(),o:a.origin,d:a.ic(),u:a.xc(),c:this.D(a.content)});case a instanceof olympe.dc.transaction.lj:return this.format(W.df,{r:a.th(),p:this.D(a.ac())});case a instanceof olympe.dc.query.Dd:return this.format(W.mr,a.fa());case a instanceof olympe.dc.Hg:return this.format(W.bp,a.fa());case a instanceof olympe.dc.vc:return this.format(W.fj,this.H(a.W()));default:return super.D(a)}}j(a){if(null===
|
|
854
|
+
a||'object'!==typeof a)return super.j(a);const {t:b,v:c}=a;switch(b){case W.up:var d=c.t;c.s&&(a=this.j(c.s),olympe.dc.Rs().vb(d,a));return olympe.dc.CloudObject.get(d);case W.Oo:return olympe.dc.CloudObject.get(c);case W.lr:return d=c.p.map(olympe.dc.query.ma.Sm.j),a=c.e,new olympe.dc.la(c.b,c.s,d,d.length-1,new Set(c.r),{max:a.m,offset:a.o,Ld:a.s,Te:a.rm});case W.QUERY_RESULT:return Pi(c);case W.Mp:return(new olympe.dc.transaction.dj).j(c.p,c.i);case W.cp:return a=null!=(d=this.j(c.c))?d:void 0,
|
|
855
|
+
Sf(new olympe.dc.Request(c.r,c.d,a,c.u),c.o);case W.df:return d=this.j(c.p),new olympe.dc.transaction.lj(d,c.r);case W.mr:return olympe.dc.query.Dd.j(c);case W.bp:return olympe.dc.Hg.j(c);case W.fj:return new olympe.dc.vc(c);default:return super.j(a)}}H(a){if(this.F.has(a))return a;if(!this.db.Ja(a))throw new olympe.dc.Xq(a);const b={};this.db.zb(a).forEach((d,e)=>{b[e]=this.D(d)});var c=[];for(const [d,e,f]of uh(this.db,a))this.F.has(f)&&c.push(e===olympe.dc.ta.DESTINATION?{r:d,o:a,d:f}:{r:d,o:f,
|
|
856
|
+
d:a});c={t:a,m:this.db.model(a),s:this.db.source(a),p:b,r:c};this.db.Re(a)||(c.v=!0);this.F.set(a,c);return a}};const sk=olympe.dc.Request.j.Jg,tk=olympe.dc.Request.j.df,uk=olympe.dc.Request.j.dh,vk=olympe.dc.Request.j.Fi,wk=olympe.dc.Request.j.xo,xk=olympe.dc.Request.j.wr,yk=olympe.dc.Request.j.Sg,zk=olympe.dc.Request.j.Gk,Ak=olympe.dc.Request.j.Lp,Bk=olympe.dc.Request.j.vu,Ck=olympe.dc.Request.j.wu,Dk=olympe.dc.Request.j.xu,Ek=olympe.dc.Request.j.cg,Fk=olympe.dc.Request.j.eg,Gk=olympe.dc.Request.j.og,Hk=olympe.dc.Request.j.jk,Ik=olympe.dc.Request.j.Sw,Jk=olympe.dc.Request.j.gw,Kk=olympe.dc.Request.j.Gp,Lk=
|
|
857
|
+
olympe.dc.Request.j.yh,Mk=olympe.dc.Request.j.Xt,Nk=olympe.dc.Request.j.oc;function Ok(a){return Pk(a,olympe.dc.Request.j.Jg).then(b=>{b=b.getData().p;const c=Xf(b,a.T());a.G.j()&&a.G.debug('< Get Context result',b);a.G.N()&&a.G.log('< Get Context result has',b.length,'operations');return c})}function Qk(a,b){const c=new olympe.dc.transaction.Ie({le:!1,hi:!1}),d=b.ac(),e=b.j;d.qc(c);return Rk(a,tk,{i:d.T(),r:b.th(),p:Yf(c),bd:e?!0:void 0}).then(f=>f.ct)}
|
|
858
|
+
function Sk(a,b){const c=b.ac(),d=new olympe.dc.transaction.Ie({xl:!0,le:!1,hi:!1});c.qc(d);b=b.j?'bd=true':'';return Pk(a,uk,Yf(d),b,olympe.net.ua.ResponseType.$r).then(e=>{try{const f=e.getData();let g;return null!=(g=JSON.parse(f).ct)?g:Date.now()}catch(f){return Date.now()}}).finally(()=>{Tk(a,Hk,{id:c.T(),finalize:olympe.dc.transaction.Jf.j.$i})})}
|
|
859
|
+
function Uk(a,b){const c=new olympe.dc.transaction.Ie({le:!1,hi:!1}),d=b.ac();d.qc(c);return Rk(a,vk,{i:d.T(),r:b.th(),p:Yf(c)},!1).catch(e=>a.G.error(`Error while publishing burst transaction: ${e}`))}function Vk(a,b){const c=new olympe.dc.transaction.Ie({le:!1,hi:!1});b=b.ac();b.qc(c);return Rk(a,Lk,{i:b.T(),p:Yf(c)}).then(d=>d.ct)}
|
|
860
|
+
function Wk(a,b){const c=encodeURI(ab(olympe.U.jf(),JSON.stringify(Xk(a,b))));a.G.j()&&a.G.debug(`Static GraphDef query ${b} sent to orchestrator`);return Pk(a,yk,void 0,`query=${c}&v=${a.version}`,olympe.net.ua.ResponseType.je).then(d=>Yk(a,d))}function Zk(a,b){const c=b.T();a.G.j()&&a.G.debug(`Query (${c}) sent to orchestrator: ${b}`);const d=Xk(a,b);return vb(a.wa,()=>Pk(a,Ak,d,void 0,olympe.net.ua.ResponseType.je)).then(e=>Yk(a,e))}
|
|
861
|
+
function $k(a,b){if(!Ae(a.F))return a.G.error(`Server is disconnected, backup of instance ${b} is canceled.`),Promise.reject('Server is disconnected');b=Xk(a,olympe.dc.la.from(b));b.f=olympe.dc.Lb.hp;b=N(xj(a.j,olympe.dc.Ia.SERVER,wk),olympe.net.ua.Rd.Sh,JSON.stringify(b),olympe.net.ua.ResponseType.$h);Fc(b,{[olympe.net.ua.Headers.Ii]:olympe.net.ua.Xl.JSON});return yj(a.j,b).then(c=>c.getData())}
|
|
862
|
+
function al(a,b,c,d){if(!Ae(a.F))return a.G.error('Server is disconnected, restore of instance is canceled.'),Promise.reject('Server is disconnected');const e=xj(a.j,olympe.dc.Ia.SERVER,xk);b=N(e+`?debug=${c}&optional=${d}`,olympe.net.ua.Rd.Sh,b);Fc(b,{[olympe.net.ua.Headers.Ii]:olympe.net.ua.Xl.bx});return yj(a.j,b).then(f=>f.getData())}
|
|
863
|
+
function Rk(a,b,c,d=!0){const e=olympe.L.Fe.Gg,f={c:b};Object.assign(f,c);if(d)return new Promise((g,h)=>{De(a.F,e,f,(k,l)=>{k?h(k):g(l)})});De(a.F,e,f);return Promise.resolve()}
|
|
864
|
+
function Xk(a,b){var c=ki(b);b={i:b.T(),b:[b.D],m:!0,v:!0};if(c[0]instanceof olympe.dc.query.ma.Od)Object.assign(b,{f:c[0].Ob,q:[]});else{const d=(h,k)=>{h.every(l=>!l.Ea(k))&&h.push(k);return h},e=new Map;for(let h=c.length-1;0<=h;h--){const k=c[h],l=k.j;let n;const p=d(null!=(n=e.get(l))?n:[],k);if(k instanceof olympe.dc.query.ma.De&&k.F){let q;null==(q=e.get(k.T()))||q.forEach(r=>d(p,r))}e.set(l,p)}let f,g;c=null!=(g=e.get(null==(f=c[0])?void 0:f.j))?g:[];Object.assign(b,{f:olympe.dc.Lb.NONE,q:c.map(a.ba.bind(a,
|
|
865
865
|
e))})}return b}function Tk(a,b,c){b=Sf(new olympe.dc.Request(b,olympe.dc.Ia.SELF,c),a.T());let d;null==(d=a.Jb)||d.cd(b)}
|
|
866
866
|
function Pk(a,b,c,d,e){const f=xj(a.j,a.T(),b);if('string'!==typeof f)return Promise.reject(`ServerProvider: no url for type ${b}`);b=N(`${f}${'string'===typeof d&&0<d.length?`?${d}`:''}`,void 0!==c?olympe.net.ua.Rd.Sh:olympe.net.ua.Rd.GET,c&&JSON.stringify(c));Fc(b,{[olympe.net.ua.Headers.Ii]:'application/json'});Hc(b,null!=e?e:olympe.net.ua.ResponseType.JSON);return yj(a.j,b)}
|
|
867
|
-
function Yk(a,b){return u(function*(){const c=b.headers.graphId,d=b.getData();let e,f;return(null!=(f=null==(e=a.
|
|
867
|
+
function Yk(a,b){return u(function*(){const c=b.headers.graphId,d=b.getData();let e,f;return(null!=(f=null==(e=a.Ha)?void 0:wb(e,d))?f:olympe.U.stream.Ak.transform(b.getData())).pipeThrough(new TransformStream({transform:(g,h)=>{a.G.debug(`Received ${g.length} operations for patch ${c}`);h.enqueue(Xf(g,a.T(),null,c))}}))})}
|
|
868
868
|
function bl(a,b,c){return u(function*(){const d=b.pi;let e;if(c instanceof olympe.U.stream.mg){e=new olympe.dc.db.ec(d);try{for(const f=ha(c);;){const g=yield f.next();if(g.done)break;a.R.j(g.value.p,d).qc(e)}}catch(f){a.G.error(`Error while reading the stream: ${f}`),e=new olympe.dc.db.ec(d)}}else e=a.R.j(b.p,d);return Of(e,b.ct)})}
|
|
869
|
-
olympe.dc.sources.
|
|
870
|
-
olympe.dm.DataSource.oc.Ab,b=olympe.dm.DataSource.oc.Vh,Promise.resolve(Ae(this.F)?{s:b}:{s:a,r:'Disconnected'});case sk:return Ok(this);case tk:return Qk(this,c);case uk:return Sk(this,c);case vk:return Uk(this,c);case Lk:return Vk(this,c);case yk:return d.get(olympe.dc.la.j.
|
|
869
|
+
olympe.dc.sources.Tr=class extends olympe.dc.sources.Ul{constructor(a,b,c,d,e,f,g){super(a,c);this.F=b;this.j=d;this.R=new olympe.dc.transaction.dj(this.T());this.H=new Map;this.N=new Set;this.version=e||'unknown';this.Ha=g?new olympe.U.stream.ax:null;this.wa=new olympe.U.promise.Xr(f);olympe.C.Gj(this.D.qf(),()=>{this.H.forEach((h,k)=>{h.error(new olympe.error.Ph('Connection to server has been recovered',k))})})}T(){return olympe.dc.Ia.SERVER}X(a){var b=a.getType();const c=a.content,d=Uf(a);switch(b){case Nk:return a=
|
|
870
|
+
olympe.dm.DataSource.oc.Ab,b=olympe.dm.DataSource.oc.Vh,Promise.resolve(Ae(this.F)?{s:b}:{s:a,r:'Disconnected'});case sk:return Ok(this);case tk:return Qk(this,c);case uk:return Sk(this,c);case vk:return Uk(this,c);case Lk:return Vk(this,c);case yk:return d.get(olympe.dc.la.j.hq)?Wk(this,c):Zk(this,c);case wk:return $k(this,c);case xk:return al(this,c.EF,c.debug,c.optional);case Ik:case Jk:case Kk:case Mk:return Rk(this,b,{});case Fk:return this.j.downloadFileContent(a);case Ek:return this.j.deleteFileContent(a);
|
|
871
871
|
case Gk:return this.j.uploadFileContent(a);default:return Promise.reject(`ServerProvider: Message of type ${b} not supported yet`)}}Z(a,b){if(a.getType()===zk){const c=a.content,d=c.T();return(new rxjs.Observable(e=>{const f=Xk(this,c);this.N.delete(d);this.H.set(d,e);Rk(this,Bk,f).catch(g=>e.error(g))})).pipe(sb(olympe.error.Ph,(e,f)=>{this.G.debug(`Subscribe to topic ${e.T()} now that we are back online, after waiting for ${f}ms`);b()}),rxjs.operators.finalize(()=>{this.N.add(d);Rk(this,Ck,{i:d}).catch(e=>
|
|
872
|
-
{this.G.warn(`Fail to unsubscribe to graphdef ${d}: ${e}`)}).finally(()=>{this.N.has(d)&&this.H.delete(d);this.N.delete(d)})}))}return rxjs.throwError(()=>Error(`Subscription of type ${a.getType()} is not supported`))}init(a){super.init(a);ye(this.F,olympe.L.
|
|
873
|
-
b=Of(b,a.ct),Tk(this,e,{rollback:b,error:a.error});else if(e===Dk){const f=a.i;bl(this,a,b).then(g=>{let h;null==(h=this.H.get(f))||h.next(g)})}else e===d&&Tk(this,Hk,{id:a.i,finalize:olympe.dc.transaction.Jf.j.
|
|
874
|
-
olympe.dc.sources.
|
|
875
|
-
!0;var a=new olympe.dc.Ya;X(a.create(olympe.dm.DataSource,this.j).yi(this.j),olympe.dm.DataSource.gi,!0);a.Oa(olympe.dm.DataSource.Mj,this.j,this.j);a.mb(()=>{olympe.dc.la.from(this.j).observe(olympe.C.kh()).subscribe(()=>{})})}}};olympe.dc.sources.P={Da:'dc.sources.Logger',
|
|
876
|
-
olympe.dc.sources.Config={Ih:'data.httpHost',Bf:'data.httpPort',Qi:'data.httpSSL',
|
|
877
|
-
olympe.V.config(function(a){const b=['localhost','127.0.0.1'],c=a.getParameter(olympe.net.Config.
|
|
878
|
-
return f.endsWith(c)&&e?f+d:f});Ya(a,olympe.dc.sources.Kh.Bf,[olympe.dc.sources.Kh.Ih,olympe.dc.sources.Config.Bf],(e,f)=>{if(f)return f;f=b.includes(e);const g=e.endsWith(d);e=e.endsWith(c);return f?3141:g?85:e?80:443});Ya(a,olympe.dc.sources.Kh.Qi,[olympe.dc.sources.Kh.Bf,olympe.dc.sources.Config.Qi],(e,f)=>null!==f?f:443===e);E(a,olympe.dc.sources.Config.
|
|
879
|
-
C(a,olympe.dc.sources.P.
|
|
880
|
-
olympe.dc.sources.P.
|
|
881
|
-
[olympe.
|
|
882
|
-
olympe.V.run([olympe.dc.sources.P.
|
|
883
|
-
olympe.dc.sources.cache.
|
|
872
|
+
{this.G.warn(`Fail to unsubscribe to graphdef ${d}: ${e}`)}).finally(()=>{this.N.has(d)&&this.H.delete(d);this.N.delete(d)})}))}return rxjs.throwError(()=>Error(`Subscription of type ${a.getType()} is not supported`))}init(a){super.init(a);ye(this.F,olympe.L.Fe.Gg,this.ia.bind(this));return this}destroy(){return u(function*(){})}ia(a,b){const c=olympe.dc.Request.j.zo,d=olympe.dc.Request.j.Fm,e=a.c;if(e===olympe.dc.Request.j.ck)bl(this,a,b).then(f=>{Tk(this,e,f)});else if(e===c)b=this.R.j(a.p,a.i),
|
|
873
|
+
b=Of(b,a.ct),Tk(this,e,{rollback:b,error:a.error});else if(e===Dk){const f=a.i;bl(this,a,b).then(g=>{let h;null==(h=this.H.get(f))||h.next(g)})}else e===d&&Tk(this,Hk,{id:a.i,finalize:olympe.dc.transaction.Jf.j.Fm,error:0<a.s?a.error:null})}ba(a,b){if(b instanceof olympe.dc.query.ma.Wh){const c=b.relation;let d;b=null!=(d=a.get(b.T()))?d:[];return{t:c.W(),d:c.La()===olympe.dc.ta.ORIGIN?1:2,v:!0,r:c.recursive,q:b.map(this.ba.bind(this,a))}}return{}}};olympe.dc.sources.Tr.ya=[olympe.dc.sources.fk];function cl(a,b,c){const d=new olympe.C.Xb(`Source solver ${b.W()}`);b.bb(olympe.dm.Ad.F.$b()).bb(olympe.dm.Ad.D).me().back().bb(olympe.dm.Ad.j).me().observe(d,{md:c,Bc:!0}).subscribe(e=>{e.yj().forEach(([f,g])=>{a.D.set(f.W(),g.T())});e.Ej().forEach(([f])=>{a.D.delete(f)})});b.bb(olympe.dm.hb.D).observe(d,{md:c,Bc:!0}).subscribe(e=>{let f,g;a.F=null!=(g=null==(f=e.Jc())?void 0:f.T())?g:null});d.onDestroy(()=>{a.D.clear();a.F=null})}
|
|
874
|
+
olympe.dc.sources.Sk=class{constructor(a,b,c){this.db=a;this.j=b;this.N=c;this.D=new Map;this.F=null;this.H=!1}fromModel(a){a=olympe.dc.ea(a);return this.D.has(a)?this.D.get(a):this.F&&this.R(a)?this.F:this.N}pe(a){let b;return null!=(b=this.db.source(a))?b:this.N}jb(a){return a===this.j?olympe.dc.CloudObject.get(this.j):a===olympe.dc.Ia.SERVER?olympe.dc.CloudObject.get(olympe.dm.DataSource.SERVER):this.db.Ja(a)&&this.db.Nb(a,olympe.dm.DataSource)?olympe.dc.CloudObject.get(a):null}R(){return!1}init(){if(!this.H){this.H=
|
|
875
|
+
!0;var a=new olympe.dc.Ya;X(a.create(olympe.dm.DataSource,this.j).yi(this.j),olympe.dm.DataSource.gi,!0);a.Oa(olympe.dm.DataSource.Mj,this.j,this.j);a.mb(()=>{olympe.dc.la.from(this.j).observe(olympe.C.kh()).subscribe(()=>{})})}}};olympe.dc.sources.P={Da:'dc.sources.Logger',qm:'dc.sources.HTTPService',Lu:'dc.sources.IOService',ur:'dc.sources.RemoteProvider',Mr:'dc.sources.ServerProvider',sC:'dc.sources.OfflineProvider',af:'dc.sources.SourceSolver',Me:'dc.sources.Serializer',$o:'dc.sources.cache.Cache',ap:'dc.sources.cache.DATABASE',Ql:'dc.sources.cache.Logger'};
|
|
876
|
+
olympe.dc.sources.Config={Ih:'data.httpHost',Bf:'data.httpPort',Qi:'data.httpSSL',om:'data.httpBasePath',Qm:'data.pollingFrequency',Ve:'data.communicationMode',Xm:'data.restrictedUse',VERSION:'version.version',Rr:'data.streamWorker',Wq:'data.queryConcurrencyLimit'};olympe.dc.sources.Kh={Xv:'olympe.internal.data.',Ih:'olympe.internal.data.httpHost',Bf:'olympe.internal.data.httpPort',Qi:'olympe.internal.data.httpSSL'};
|
|
877
|
+
olympe.V.config(function(a){const b=['localhost','127.0.0.1'],c=a.getParameter(olympe.net.Config.Bm),d=`-${olympe.host.Wg.Th}`;E(a,olympe.dc.sources.Config.Ih,null);E(a,olympe.dc.sources.Config.Bf,null);E(a,olympe.dc.sources.Config.Qi,null);E(a,olympe.dc.sources.Config.om,'runtime/data');E(a,olympe.dc.sources.Config.Rr,!1);E(a,olympe.dc.sources.Config.Wq,10);Ya(a,olympe.dc.sources.Kh.Ih,[olympe.host.Config.Jk,olympe.L.Config.am,olympe.dc.sources.Config.Ih],(e,f,g)=>{if(g)return g;e=e===olympe.host.Wg.Th;
|
|
878
|
+
return f.endsWith(c)&&e?f+d:f});Ya(a,olympe.dc.sources.Kh.Bf,[olympe.dc.sources.Kh.Ih,olympe.dc.sources.Config.Bf],(e,f)=>{if(f)return f;f=b.includes(e);const g=e.endsWith(d);e=e.endsWith(c);return f?3141:g?85:e?80:443});Ya(a,olympe.dc.sources.Kh.Qi,[olympe.dc.sources.Kh.Bf,olympe.dc.sources.Config.Qi],(e,f)=>null!==f?f:443===e);E(a,olympe.dc.sources.Config.Qm,null);E(a,olympe.dc.sources.Config.Ve,null);E(a,olympe.dc.sources.Config.Xm,null);D(a,olympe.dc.sources.P.Da,[olympe.ga.P.Fa],e=>e.ad('data'));
|
|
879
|
+
C(a,olympe.dc.sources.P.Me,olympe.dc.sources.cc,olympe.dc.db.P.Fa);Wa(a,olympe.L.P.Me,olympe.dc.sources.P.Me);C(a,olympe.dc.sources.P.qm,olympe.dc.sources.Au,olympe.dc.sources.P.Da,olympe.net.P.nj,olympe.L.P.pm,olympe.auth.P.Fa,olympe.dc.sources.P.af,olympe.L.P.Me,new olympe.V.oa(olympe.L.Config.Ll));C(a,olympe.dc.sources.P.Lu,olympe.dc.sources.gq,olympe.dc.sources.P.Da,olympe.dc.P.Ug,olympe.net.P.Fa,olympe.auth.P.Fa);C(a,olympe.dc.sources.P.ur,olympe.dc.sources.Fr,olympe.dc.sources.P.Da,new olympe.V.oa(olympe.dc.Config.Xg),
|
|
880
|
+
olympe.dc.sources.P.qm,olympe.L.P.vf,olympe.dc.P.Ch,olympe.dc.sources.P.af);C(a,olympe.dc.sources.P.Mr,olympe.dc.sources.Tr,olympe.dc.sources.P.Da,olympe.L.P.Nk,olympe.L.P.vf,olympe.dc.sources.P.qm,new olympe.V.oa(olympe.dc.sources.Config.VERSION),new olympe.V.oa(olympe.dc.sources.Config.Wq),new olympe.V.oa(olympe.dc.sources.Config.Rr));C(a,olympe.dc.sources.P.af,olympe.dc.sources.Sk,olympe.dc.P.Ch,new olympe.V.oa(olympe.dc.Config.Xg),new olympe.V.oa(olympe.dc.Config.cm));D(a,olympe.dc.sources.P.Ql,
|
|
881
|
+
[olympe.ga.P.Fa],e=>e.ad('datacache'));C(a,olympe.dc.sources.P.$o,olympe.dc.sources.cache.Cache,olympe.dc.sources.P.Ql,olympe.dc.P.Ug,olympe.dc.sources.P.ap,olympe.dc.db.P.Fa,olympe.net.P.Fa,olympe.L.P.vf,olympe.Db.P.Cm,olympe.U.P.Dg,new olympe.V.oa(olympe.net.Config.Tq),new olympe.V.oa(olympe.dc.sources.Config.VERSION));C(a,olympe.dc.sources.P.ap,olympe.dc.sources.cache.yk,olympe.Db.P.$g,olympe.dc.sources.P.Ql,olympe.Db.P.qk)},'olympe.dc.sources');
|
|
882
|
+
olympe.V.run([olympe.dc.sources.P.af,olympe.dc.sources.P.$o],(a,b)=>{olympe.dc.ee=()=>a;olympe.dc.sources.ce=()=>b});olympe.dc.sources.cache={};olympe.dc.sources.cache.errors={};olympe.dc.sources.cache.errors.dn=class extends Error{constructor(a){super(a)}};olympe.dc.sources.cache.errors.cu=class extends olympe.dc.sources.cache.errors.dn{};olympe.dc.sources.cache.errors.Pw=class extends olympe.dc.sources.cache.errors.dn{};olympe.dc.sources.cache.errors.Yw=class extends olympe.dc.sources.cache.errors.dn{};function dl(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===typeof a:case 'boolean'===typeof a:case 'number'===typeof a:return a}switch(a.t){case 1:return new Date(a.d);case 2:return olympe.C.Color.Pb(a);case 17:return new olympe.dc.vc(a.v);case 13:return(new olympe.dc.transaction.dj).j(a.v,a.i);default:throw Error(`Impossible to deserialize the following value: ${a}`);}}
|
|
883
|
+
olympe.dc.sources.cache.Vp=class{fa(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===typeof a:case 'boolean'===typeof a:case 'number'===typeof a:return a;case a instanceof olympe.C.eb:return{t:1,d:a.valueOf().toISOString()};case a instanceof Date:return{t:1,d:a.toISOString()};case a instanceof olympe.C.Color:return Object.assign({t:2},a.toJSON());case a instanceof olympe.dc.vc:return{t:17,v:a.W()};case a instanceof olympe.dc.db.ec:const b=new olympe.dc.transaction.Ie;a.qc(b);
|
|
884
884
|
return{t:13,i:a.T(),v:Yf(b)};default:throw Error(`Impossible to serialize the following value: ${a}`);}}};function Wj(a,b,c){return u(function*(){el(a,'queries',b);yield a.init();const d=a.D.has(c)?a.D.get(c):new Set;d.has(b)||(d.add(b),a.D.set(c,d),a.N.next(fl(a)));return gl(a.j,b,c)})}function Xj(a,b){return u(function*(){yield a.init();a.G.debug(`Cache: subtract pending transaction operations from ${b.T()}`);b.R(a.F)})}
|
|
885
885
|
function Yj(a,b,c,d,e=!1){(()=>u(function*(){a.G.debug(`Cache: handle query ${b} graph patch: ${d.T()}`);try{const f=null===b?[]:Array.from(a.D.entries()).filter(([,h])=>h.has(b)).map(([h])=>h),g=1===f.length&&'__code-as-data__'===f[0];if(null===b||!g||a.Z)a.G.debug('Cache: persist graph patch',d.T()),e&&b&&(Array.from(d.Vc()).filter(h=>!h.yd()).map(h=>h.tag()),yield hl(a.j)),yield il(a.j,d,0<f.length?b:null),jl(a,d,c).catch(h=>{a.G.error(`Cache: Failed to download files of a graph patch: ${h}`)})}catch(f){a.G.error(`Cache: Failed to handle graph patch ${d.T()} with message: ${f}`),
|
|
886
|
-
a.hd.next(f)}finally{b&&kl(a,'queries',b)}}))().then(()=>{})}function Zj(a,b,c,d,e=!1){return u(function*(){yield Xj(a,d);Yj(a,b,c,d,e)})}function ll(){var a=olympe.dc.sources.
|
|
887
|
-
function kl(a,b,c){const d=a.status.getValue();let e,f;null!=(f=null==(e=d[b])?void 0:e.values)&&f.delete(c)&&(d[b].processed+=1,0===d[b].values.size&&(delete d[b],('queries'===b?'files':'queries')in d||(d.processing=!1)),a.status.next(d))}function ml(a){return u(function*(){a.F=new olympe.dc.db.ec;const b=yield nl(a.j);for(const c of b)c.qc(a.F);a.
|
|
888
|
-
function jl(a,b,c){return u(function*(){const d=ol(b),e=[];for(const g of d){const h=g.tag();if(!(yield pl(a.j,h)))if(el(a,'files',h),!1===g.Pa(olympe.dm.File.j.W())&&g.Pa(olympe.dm.File.urlProp.W())){var f=g.Pa(olympe.dm.File.urlProp.W());f=N(f);Hc(f,olympe.net.ua.ResponseType.
|
|
886
|
+
a.hd.next(f)}finally{b&&kl(a,'queries',b)}}))().then(()=>{})}function Zj(a,b,c,d,e=!1){return u(function*(){yield Xj(a,d);Yj(a,b,c,d,e)})}function ll(){var a=olympe.dc.sources.ce();a.Z=!0;a.vb=!0}function el(a,b,c){const d=a.status.getValue();b in d||(d[b]={total:0,processed:0,values:new Set});d[b].total+=1;d[b].values.add(c);d.processing=!0;a.status.next(d)}
|
|
887
|
+
function kl(a,b,c){const d=a.status.getValue();let e,f;null!=(f=null==(e=d[b])?void 0:e.values)&&f.delete(c)&&(d[b].processed+=1,0===d[b].values.size&&(delete d[b],('queries'===b?'files':'queries')in d||(d.processing=!1)),a.status.next(d))}function ml(a){return u(function*(){a.F=new olympe.dc.db.ec;const b=yield nl(a.j);for(const c of b)c.qc(a.F);a.ba.next(0<b.length)})}
|
|
888
|
+
function jl(a,b,c){return u(function*(){const d=ol(b),e=[];for(const g of d){const h=g.tag();if(!(yield pl(a.j,h)))if(el(a,'files',h),!1===g.Pa(olympe.dm.File.j.W())&&g.Pa(olympe.dm.File.urlProp.W())){var f=g.Pa(olympe.dm.File.urlProp.W());f=N(f);Hc(f,olympe.net.ua.ResponseType.Kl);e.push(Ic(a.Fd,f).then(k=>{k=k.Kc();if(200>k||300<=k)throw Error(`Failed to download file ${g}. Response code ${k}`);}).finally(()=>kl(a,'files',h)))}else{let k;const l=null!=(k=g.Pa(olympe.dm.File.mimeTypeProp.W()))?k:
|
|
889
889
|
'application/octet-stream';f={tag:h,model:g.Vb(),mimeType:l};const n=new olympe.dc.Request(olympe.dc.Request.j.eg,c,f);f=vb(a.Md,()=>a.Jb.request(n).then(p=>ql(a.j,h,p,l))).finally(()=>kl(a,'files',h));e.push(f)}}yield Promise.allSettled(e).then(g=>{g.forEach((h,k)=>{if('rejected'===h.status){let l;a.G.warn(`Cache: File content for ${null==(l=d[k])?void 0:l.tag()} was not found`)}})})})}
|
|
890
890
|
function ol(a){const b=[olympe.dc.ea(olympe.dm.File)];if(olympe.dc.CloudObject.exists(olympe.dm.File))b.push(...olympe.dc.la.from(olympe.dm.File).ug(olympe.dc.CloudObject.extendedByRel).Cc().keys());else for(const c of b){let d,e;b.push(...(null!=(e=null==(d=a.Uc(c))?void 0:d.cb(olympe.dc.CloudObject.extendedByRel,f=>f))?e:[]))}return b.reduce((c,d)=>{let e,f;d=Array.from(null!=(f=null==(e=a.Uc(d))?void 0:e.cb(olympe.dc.CloudObject.instancesRel,g=>g))?f:[]).map(g=>a.Uc(g));return c.concat(d)},[])}
|
|
891
891
|
function rl(a,b){return Array.from(a.D.values()).some(c=>c.has(b))}function fl(a){return Array.from(a.D.keys()).filter(b=>'__code-as-data__'!==b)}function sl(a,b){return u(function*(){yield a.init();if(b){var c,d=Array.from(null!=(c=a.D.get(b))?c:[]);a.D.delete(b);var e=Array.from(a.D.values()).reduce((f,g)=>{g.forEach(h=>f.add(h));return f},new Set);yield tl(a.j,b);a.N.next(fl(a));d.filter(f=>!e.has(f));yield hl(a.j)}else yield Promise.all(fl(a).map(f=>sl(a,f)))})}
|
|
892
892
|
function ul(a){if(!(2>a.length))for(let b=a.length-1;0<b;b--)for(let c=b-1;0<=c;c--)a[c].R(a[b])}
|
|
893
|
-
function vl(a,b,c){return u(function*(){var d=olympe.dc.Request.j.
|
|
893
|
+
function vl(a,b,c){return u(function*(){var d=olympe.dc.Request.j.df;const e=olympe.dc.Request.j.cg,f=olympe.dc.Request.j.og;a.G.debug('Sync Cache: Applying transaction patch to destination',c,b.T());const g=ol(b);a.G.debug(`Sync Cache: Found ${g.length} files to send`);yield Promise.all(g.map(h=>u(function*(){const k=h.tag();var l=h.Vb();if(h.yd())l=new olympe.dc.Request(e,c,{tag:k,model:l});else{const n=yield wl(a.j,k);l=new olympe.dc.Request(f,c,{tag:k,model:l,content:n.content,mimeType:n.j})}if(!Pd(a.lb))throw Error('Lost connection, stop syncing');
|
|
894
894
|
l=yield a.Jb.request(l);b.Yc(k,new Map([[olympe.dm.File.urlProp.W(),l]]))})));d=new olympe.dc.Request(d,c,new olympe.dc.transaction.lj(b,!1));if(!Pd(a.lb))throw Error('Lost connection, stop syncing');yield a.Jb.request(d)})}
|
|
895
|
-
function xl(a,b,c){return c instanceof olympe.error.
|
|
896
|
-
c.message)):new olympe.dc.sources.cache.errors.
|
|
897
|
-
function yl(){var a=olympe.dc.sources.
|
|
895
|
+
function xl(a,b,c){return c instanceof olympe.error.Vk||c instanceof olympe.error.Vo?(a.G.error('Sync Cache: Timeout or Connection error',c),new olympe.dc.sources.cache.errors.cu('The connection has been lost. It can happen when the application loose connectivity or when the remote server is not responding correctly',c.message)):c instanceof olympe.error.Er?(a.G.error(`Sync Cache: transaction has been rejected by ${b} data source`,c),new olympe.dc.sources.cache.errors.Pw('The transaction has been rejected by the datasource',
|
|
896
|
+
c.message)):new olympe.dc.sources.cache.errors.Yw('Synchronisation error',c.message)}
|
|
897
|
+
function yl(){var a=olympe.dc.sources.ce();if(a.R)return rxjs.throwError(()=>Error('Another synchronisation is in progress'));a.R=!0;a.G.info('Sync Cache: Start synchronising transactions');const b=new rxjs.BehaviorSubject([null,null]);(()=>u(function*(){yield a.init();const c=yield zl(a.j);let d=0;const e=Array.from(c.values()).reduce((f,g)=>f+g.length,0);0<e&&b.next([e,d]);for(const [f,g]of c){ul(g);for(const h of g){a.G.debug(`Sync Cache: Processing patch ${d+1}/${e} (${h.T()})`);try{yield vl(a,
|
|
898
898
|
h,f),yield Al(a.j,h)}catch(k){throw xl(a,f,k);}d+=1;b.next([e,d])}}a.H=null}))().then(()=>{a.R=!1;b.complete()}).catch(c=>{b.error(c.message)}).finally(()=>{ml(a).finally(()=>{a.R=!1})});return b.asObservable()}
|
|
899
|
-
function Bl(){const a=olympe.dc.sources.
|
|
900
|
-
function Dl(a){const b=olympe.dc.sources.
|
|
901
|
-
function Fl(){const a=olympe.dc.sources.
|
|
902
|
-
olympe.dc.sources.cache.Cache=class{constructor(a,b,c,d,e,f,g,h,k,l){this.G=a;this.Jb=b;this.j=c;this.
|
|
903
|
-
!1;this.hd=new rxjs.Subject;this.Md=new olympe.U.promise.
|
|
904
|
-
b.j.executeQuery(a).then(olympe.U.stream.
|
|
905
|
-
b,c){const d=this;return u(function*(){yield d.init();yield ql(d.j,a,b,c);return`offline://${a}`})}downloadFileContent(a){const b=this;return u(function*(){yield b.init();return wl(b.j,a).then(c=>c.content)})}deleteFileContent(a){const b=this;return u(function*(){yield b.init();yield Kl(b.j,[a])})}};olympe.dc.sources.cache.
|
|
899
|
+
function Bl(){const a=olympe.dc.sources.ce();return u(function*(){var b=new Set;const c={files:[],patches:[],version:a.version};var d=ol(a.F);for(const e of d)b.has(e.tag())||(d=yield wl(a.j,e.tag()),c.files.push({t:e.tag(),m:d.j,c:a.wa.j(d.content)}),b.add(e.tag()));b=yield Cl(a.j);c.patches.push(...b);return JSON.stringify(c)})}
|
|
900
|
+
function Dl(a){const b=olympe.dc.sources.ce();return u(function*(){let c;try{c=JSON.parse(a)}catch(e){throw Error('Invalid pending changes, must be a JSON string');}var d=c.files;if(!Array.isArray(c.patches)||!Array.isArray(d))throw Error('Invalid pending changes, must contain a `patches` array and a `files` array');for(const e of c.files)d=b.wa.D(e.c),yield ql(b.j,e.t,d,e.m);yield El(b.j,c.patches);yield ml(b);b.Ha.nd(Of(b.F))})}
|
|
901
|
+
function Fl(){const a=olympe.dc.sources.ce();return u(function*(){yield Gl(a.j);yield ml(a)})}
|
|
902
|
+
olympe.dc.sources.cache.Cache=class{constructor(a,b,c,d,e,f,g,h,k,l){this.G=a;this.Jb=b;this.j=c;this.Ha=d;this.Fd=e;this.lb=f;this.Ua=g;this.wa=h;this.version=l;this.Z=this.version!==this.Ua.get('__code-as-data-version__');this.Ub=this.vb=!1;this.D=new Map;this.N=new rxjs.BehaviorSubject([]);this.H=null;this.ba=new rxjs.BehaviorSubject(!1);this.F=new olympe.dc.db.ec;this.Hc=this.Gc=!1;this.ia=[];this.X=0;this.ke=new rxjs.BehaviorSubject(!1);this.status=new rxjs.BehaviorSubject({processing:!1});this.R=
|
|
903
|
+
!1;this.hd=new rxjs.Subject;this.Md=new olympe.U.promise.Xr(k)}Kc(){return this.status.asObservable()}init(){const a=this;return u(function*(){if(!a.Gc)if(a.Hc)yield new Promise(b=>{a.ia.push(b)});else{a.Hc=!0;(yield Hl(a.j)).forEach(b=>{a.D.set(b.name,new Set(b.j))});a.N.next(fl(a));yield ml(a);a.Ha.nd(Of(a.F));for(const b of a.ia)b();a.Gc=!0;a.ia=[]}})}executeQuery(a){const b=this;return u(function*(){yield b.init();return rl(b,a.T())&&ki(a).some(c=>c instanceof olympe.dc.query.ma.Od)?Il(b.j,a).then(olympe.U.stream.Ms):
|
|
904
|
+
b.j.executeQuery(a).then(olympe.U.stream.Ms)})}applyTransaction(a,b){const c=this;return u(function*(){c.G.debug('Cache: apply transaction',a,b);yield c.init();const d=a.ac(),e=Array.from(d.Bb.keys());let f,g;const h=Array.from(null!=(g=null==(f=c.H)?void 0:f.j.Bb.keys())?g:[]);let k;b!==(null==(k=c.H)?void 0:k.D)||e.some(l=>!h.includes(l))?(yield Jl(c.j,d,b),c.H=new olympe.dc.sources.cache.au(d,b),c.ba.next(!0)):(d.qc(c.H.j),yield Jl(c.j,c.H.j,b));d.qc(c.F);yield il(c.j,d,'local-transaction')})}uploadFileContent(a,
|
|
905
|
+
b,c){const d=this;return u(function*(){yield d.init();yield ql(d.j,a,b,c);return`offline://${a}`})}downloadFileContent(a){const b=this;return u(function*(){yield b.init();return wl(b.j,a).then(c=>c.content)})}deleteFileContent(a){const b=this;return u(function*(){yield b.init();yield Kl(b.j,[a])})}};olympe.dc.sources.cache.au=class{constructor(a,b){this.j=a;this.D=b}};olympe.dc.sources.cache.Cache.D='__code-as-data-version__';olympe.dc.sources.cache.Cache.j='__code-as-data__';function Hl(a){return u(function*(){return(yield a.db.F('buckets')).map(b=>olympe.dc.sources.cache.Yq.Pb(b))})}function nl(a){return u(function*(){return(yield a.db.F('pending-transactions')).map(b=>{b=olympe.dc.sources.cache.Rh.Pb(b);return dl(b.j)})})}function gl(a,b,c){return u(function*(){a.G.debug(`Offline DB: Adding query ${b} in bucket ${c}`);return a.db.D()})}function hl(a){return u(function*(){return a.db.D()})}
|
|
906
906
|
function il(a,b,c){a.G.debug(`Offline DB: Apply patch ${b.T()} on local offline db`);Array.from(b.Bb.keys());return a.db.D().then(()=>{null===c&&(b.Bb.forEach((d,e)=>a.D.add(e)),a.F().then(()=>{}))})}function pl(a,b){return new Promise((c,d)=>{null!==a.files?c(a.files.has(b)):a.j.push(e=>{let f;return e?d(e):c(!(null==(f=a.files)||!f.has(b)))})})}
|
|
907
|
-
function ql(a,b,c,d){c=new olympe.dc.sources.cache.
|
|
908
|
-
function Al(a,b){return u(function*(){return a.db.remove('pending-transactions',b.T()).then(()=>{})})}function wl(a,b){return u(function*(){const c=yield a.db.get('files',b);if(!c)throw Error(`File ${b} not found in offline cache database`);return olympe.dc.sources.cache.
|
|
909
|
-
function El(a,b){return u(function*(){const c=new Map;for(const d of b){const e=olympe.dc.sources.cache.Rh.
|
|
910
|
-
function Il(a,b){return u(function*(){const c=b.jb();a.G.debug(`Offline DB: Executing query ${b.T()} by ID with source ${c}`);const d=olympe.dc.query.Dd.xj(b);var e=(yield a.db.H(b.T())).map(f=>olympe.dc.sources.cache.Pg.
|
|
911
|
-
a.G.debug(`Offline DB: Data result for query ${b.T()}`,d.ac().Bb.size,'instances',Array.from(d.ac().Id()).length,'relations');return d})}function Jl(a,b,c){b=a.N.fa(b);a.G.debug(`save transaction in destination '${c}'`,JSON.stringify(b));return a.db.set('pending-transactions',(new olympe.dc.sources.cache.Rh(c,b,Date.now())).toJSON())}function Ml(a){return u(function*(){return a.db.
|
|
912
|
-
function
|
|
913
|
-
olympe.dc.sources.cache.
|
|
907
|
+
function ql(a,b,c,d){c=new olympe.dc.sources.cache.Nm(b,c,d);a.files.add(b);return a.db.set('files',c.toJSON()).then(()=>{}).catch(e=>{a.files.delete(b);throw e;})}function tl(a,b){return u(function*(){return a.db.remove('buckets',b).then(()=>{})})}function zl(a){return u(function*(){return(yield a.db.F('pending-transactions')).reduce((b,c)=>{c=olympe.dc.sources.cache.Rh.Pb(c);const d=c.D;let e;const f=null!=(e=b.get(d))?e:[];f.push(dl(c.j));b.set(d,f);return b},new Map)})}
|
|
908
|
+
function Al(a,b){return u(function*(){return a.db.remove('pending-transactions',b.T()).then(()=>{})})}function wl(a,b){return u(function*(){const c=yield a.db.get('files',b);if(!c)throw Error(`File ${b} not found in offline cache database`);return olympe.dc.sources.cache.Nm.Pb(c)})}function Cl(a){return u(function*(){return a.db.F('pending-transactions')})}
|
|
909
|
+
function El(a,b){return u(function*(){const c=new Map;for(const d of b){const e=olympe.dc.sources.cache.Rh.Pb(d);e&&c.set(e.j.i,d)}yield a.db.ba()})}function Gl(a){return u(function*(){return a.db.clear('pending-transactions').then(()=>{})})}
|
|
910
|
+
function Il(a,b){return u(function*(){const c=b.jb();a.G.debug(`Offline DB: Executing query ${b.T()} by ID with source ${c}`);const d=olympe.dc.query.Dd.xj(b);var e=(yield a.db.H(b.T())).map(f=>olympe.dc.sources.cache.Pg.Pb(f));for(const f of e){if(f.source!==c)continue;e=olympe.dc.sources.cache.yk.Wb(f);const g=Ll(f.Kd);d.create(f.tag,e,g);for(const h of f.ob)if(e=h.match(/^([a-z0-9]*)(<|>)([a-z0-9]*)$/)){const [,k,l,n]=e;e='<'===l;k===olympe.dc.fc.Zc&&!0===e||d.Oa(k,e?n:f.tag,e?f.tag:n)}}a.G.j()&&
|
|
911
|
+
a.G.debug(`Offline DB: Data result for query ${b.T()}`,d.ac().Bb.size,'instances',Array.from(d.ac().Id()).length,'relations');return d})}function Jl(a,b,c){b=a.N.fa(b);a.G.debug(`save transaction in destination '${c}'`,JSON.stringify(b));return a.db.set('pending-transactions',(new olympe.dc.sources.cache.Rh(c,b,Date.now())).toJSON())}function Ml(a){return u(function*(){return a.db.N('pending-transactions')})}function Kl(a,b){return u(function*(){b.forEach(c=>a.files.delete(c));yield a.db.Z()})}
|
|
912
|
+
function Ll(a){return Object.entries(a).reduce((b,[c,d])=>b.set(c,dl(d)),new Map)}
|
|
913
|
+
olympe.dc.sources.cache.yk=class{constructor(a,b,c){this.H=`Olympe_Cache_${a}`;this.G=b;this.N=new olympe.dc.sources.cache.Vp;this.db=c.D(this.H);this.D=new Set;this.j=[];this.files=null;this.db.R('files').then(d=>{this.files=new Set(d);this.j.forEach(e=>e(null))}).catch(d=>{this.j.forEach(e=>e(d))});this.F=olympe.U.Promise.uj(()=>{const d=this;return u(function*(){if(!(0===d.D.size||0<(yield Ml(d))))if(0<d.db.X())d.F().then(()=>{}),d.G.debug('Offline DB GC: Postponing round while the stack is busy');
|
|
914
914
|
else{d.G.debug(`Offline DB GC: Round with ${d.D.size} candidates`);var e=Date.now();yield d.db.D().then(()=>{});d.G.debug(`Offline DB GC: has taken ${Date.now()-e}ms to run`)}})},5E3)}static Wb(a){const b=new RegExp(`^(${olympe.dc.fc.Zc})>([a-z0-9]*)$`);for(const c of a.ob)if(a=c.match(b))return a[2];return null}executeQuery(a){const b=this;return u(function*(){const c=Date.now();b.G.debug(`Offline DB: Executing query ${a.T()} with source ${a.jb()}`);const d=olympe.dc.query.Dd.xj(a),e=a.jb();var f=
|
|
915
|
-
yield b.db.get('instances',a.D),g=olympe.dc.sources.cache.Pg.
|
|
916
|
-
Promise.resolve([]);r.W();return b.db.H().then(z=>z.map(A=>olympe.dc.sources.cache.Pg.
|
|
915
|
+
yield b.db.get('instances',a.D),g=olympe.dc.sources.cache.Pg.Pb(f);if(!g)return d;f=new Map;const h=new Set([g.tag]);d.create(g.tag,olympe.dc.sources.cache.yk.Wb(g),Ll(g.Kd));for(const p of ki(a))if(p instanceof olympe.dc.query.ma.Wh){var k=p.relation;g=k.La()===olympe.dc.ta.ORIGIN;const q=k.W(),r=k.$b();k=new Set;f.set(p.T(),k);const t=[f.has(p.j)?new Set(f.get(p.j)):new Set([a.D])];for(const v of t){const x=new Map;var l=yield Promise.all(Array.from(v).map(y=>{if(!h.has(y))return b.G.warn(`Offline DB: Instance ${y} not found while processing query part, this should not happen`),
|
|
916
|
+
Promise.resolve([]);r.W();return b.db.H().then(z=>z.map(A=>olympe.dc.sources.cache.Pg.Pb(A))).then(z=>{x.set(y,z)})})).then(()=>x);for(const [y,z]of l){p instanceof olympe.dc.query.ma.De&&p.F&&k.add(y);for(const A of z)if(l=A.tag,A.source===e){if(p instanceof olympe.dc.query.ma.De&&!k.has(l)){var n=t[t.length-1];n||(n=new Set,t.push(n));n.add(l)}k.add(l);h.has(l)||(h.add(l),n=olympe.dc.sources.cache.yk.Wb(A),d.create(l,n,Ll(A.Kd)));q===olympe.dc.fc.Zc&&!0===g||d.Oa(q,g?l:y,g?y:l)}}}}else p instanceof
|
|
917
917
|
olympe.dc.query.ma.Od&&b.G.warn(`Offline DB: Trying to execute a query ${a.T()} on the Cache DB that contains a FollowRule part. This is not supported and designed not to happen.`);b.G.j()&&(b.G.debug(`Offline DB: Data result for query ${a.T()}`,d.ac().Bb.size,'instances',Array.from(d.ac().Id()).length,'relations'),b.G.debug(`Offline DB: Data result for query ${a.T()} took ${Date.now()-c}ms to be executed`));return d})}};
|
|
918
|
-
olympe.dc.sources.cache.
|
|
919
|
-
olympe.dc.sources.cache.Pg=class{constructor(a,b,c,d,e){this.tag=a;this.source=b;this.Kd=null!=c?c:{};this.ob=null!=d?d:[];this.j=null!=e?e:[]}static
|
|
920
|
-
olympe.dc.sources.cache.Rh=class{constructor(a,b,c){this.D=a;this.j=b;this.timestamp=c}static
|
|
921
|
-
olympe.dc.sources.cache.
|
|
922
|
-
olympe.dc.sources.cache.
|
|
923
|
-
olympe.dc.sources.cache.
|
|
918
|
+
olympe.dc.sources.cache.Yq=class{constructor(a,b){this.name=a;this.j=b}static Pb(a){return a?new olympe.dc.sources.cache.Yq(a.name,a.queryIds):null}toJSON(){return{name:this.name,queryIds:this.j}}};
|
|
919
|
+
olympe.dc.sources.cache.Pg=class{constructor(a,b,c,d,e){this.tag=a;this.source=b;this.Kd=null!=c?c:{};this.ob=null!=d?d:[];this.j=null!=e?e:[]}static Pb(a){return a?new olympe.dc.sources.cache.Pg(a.tag,a.source,a.props,a.relations,a.queryIds):null}toJSON(){return{tag:this.tag,source:this.source,props:this.Kd,relations:this.ob,queryIds:this.j}}};
|
|
920
|
+
olympe.dc.sources.cache.Rh=class{constructor(a,b,c){this.D=a;this.j=b;this.timestamp=c}static Pb(a){return a?new olympe.dc.sources.cache.Rh(a.destination,a.patch,a.timestamp):null}toJSON(){return{destination:this.D,patch:this.j,timestamp:this.timestamp}}};
|
|
921
|
+
olympe.dc.sources.cache.Sv=class extends olympe.dc.sources.cache.Rh{constructor(a,b,c,d){super(a,b,c);this.error=d}static Pb(a){return a?new olympe.dc.sources.cache.Sv(a.destination,a.patch,a.timestamp,a.error):null}toJSON(){return{destination:this.D,patch:this.j,timestamp:this.timestamp,error:this.error}}};
|
|
922
|
+
olympe.dc.sources.cache.Nm=class{constructor(a,b,c){this.tag=a;this.content=b;this.j=c}static Pb(a){return a?new olympe.dc.sources.cache.Nm(a.tag,a.content,a.mimetype):null}toJSON(){return{tag:this.tag,content:this.content,mimetype:this.j}}};function Nl(a,b){let c=a.N.get(b);c||(c=new Set(a.j.get(b).ob),a.N.set(b,c));return c}
|
|
923
|
+
olympe.dc.sources.cache.Eu=class{constructor(a,b){this.G=a;this.F=b;this.j=new Map;this.R=new Set;this.X=new Set;this.H=new olympe.dc.sources.cache.Vp;this.N=new Map}Vc(){this.R.forEach(a=>this.j.delete(a));Array.from(this.j.entries()).forEach(([a,b])=>{b||this.j.delete(a)});return this.j}Sc(a,b,c){const d=this.j.get(a);d||this.X.add(a);var e;c=Array.from(null!=c?c:[]).reduce((h,k)=>{h[k[0]]=this.H.fa(k[1]);return h},null!=(e=null==d?void 0:d.Kd)?e:{});let f;e=null!=(f=null==d?void 0:d.j)?f:[];null===
|
|
924
924
|
this.F||e.includes(this.F)||e.push(this.F);let g;b=new olympe.dc.sources.cache.Pg(a,b,c,null!=(g=null==d?void 0:d.ob)?g:[],e);this.j.set(a,b)}Yc(a,b){const c=this.j.get(a);if(c){var d;c.Kd=Array.from(b).reduce((e,[f,g])=>{null===g?delete e[f]:e[f]=this.H.fa(g);return e},null!=(d=c.Kd)?d:{})}else this.G.warn(`Trying to update an instance (${a}) which do not exists in the cache database: ignoring.`)}D(a){this.R.add(a)}Oa(a,b,c){var d;const e=null!=(d=this.j.get(b))?d:new olympe.dc.sources.cache.Pg(b,
|
|
925
925
|
'unknown',{},[],[]);var f;d=null!=(f=this.j.get(c))?f:new olympe.dc.sources.cache.Pg(c,'unknown',{},[],[]);b=`${a}${olympe.dc.ta.ORIGIN}${b}`;f=(g,h)=>{this.j.set(g.tag,g);const k=Nl(this,g.tag);k.has(h)||(g.ob.push(h),k.add(h));null===this.F||g.j.includes(this.F)||g.j.push(this.F)};f(e,`${a}${olympe.dc.ta.DESTINATION}${c}`);f(d,b)}hc(a,b,c){const d=this.j.get(b),e=this.j.get(c);c=`${a}${olympe.dc.ta.DESTINATION}${c}`;a=`${a}${olympe.dc.ta.ORIGIN}${b}`;b=(f,g)=>{const h=Nl(this,f.tag);if(h.has(g)){const k=
|
|
926
|
-
f.ob.indexOf(g);f.ob.splice(k,1);h.delete(g)}};d&&b(d,c);e&&b(e,a)}};olympe.dc.sources.cache.
|
|
927
|
-
Pl(this,b,!1);this.H.clear()}
|
|
928
|
-
this.X.add(b)}complete(){return new Promise((b,c)=>{this.N((d,e)=>{for(const f of this.X)f.unsubscribe();d?b():c(e)})})}update(b,c,d){const e=olympe.dc.ea(b),f=olympe.dc.ea(c);void 0===e||void 0===f?olympe.
|
|
929
|
-
h:null)}})}),this.D.Xd(()=>{this.N()}))}stop(){this.D.destroy();this.ia.length=0}getContext(){return this.D}T(){return this.id}th(){return!1}N(b){if(this.R){this.R=!1;null!==this.j&&(clearTimeout(this.j),this.j=null);this.H.clear();const c=this.
|
|
926
|
+
f.ob.indexOf(g);f.ob.splice(k,1);h.delete(g)}};d&&b(d,c);e&&b(e,a)}};olympe.dc.sources.cache.Eu.ya=[olympe.dc.Writable];olympe.dc.transaction={};olympe.dc.Gi=class a{constructor(b,c){this.id=null!=b?b:olympe.U.Lc();this.D=new olympe.C.Xb('BurstTransaction#'+this.id,c);this.vb=Ol(this);this.R=!1;this.D.onDestroy(()=>this.N());this.X=new Set;this.F=new Map;this.H=new Set;this.j=null;let d;this.Ua=null!=(d=olympe.V.getParameter(olympe.dc.transaction.Config.yo))?d:30;this.ia=[]}static j(b,c){return`${b},${c}`}Ub(b){for(const c of this.ia)c(b);this.stop()}Ha(){null!==this.j&&(clearTimeout(this.j),this.j=null);const b=this.ba(this.H);0<b.size&&
|
|
927
|
+
Pl(this,b,!1);this.H.clear()}ba(b){const c=new Map;b.forEach(d=>{const e=d.split(',');let f=c.get(e[0]);void 0===f&&(f=new Map,c.set(e[0],f));f.set(e[1],this.F.get(d))});return c}Z(b,c,d){this.wa(b,c,d);this.vb(b,c,d);null===this.j&&(this.j=setTimeout(this.Ha.bind(this),this.Ua))}wa(b,c,d){b=a.j(b,c);this.F.set(b,d);this.H.add(b)}lb(b,c){return this.F.get(a.j(b,c))}push(b,c){const d=olympe.dc.ea(b);b=c.subscribe(e=>{for(const [f,g]of e)e=olympe.dc.ea(f),this.lb(d,e)!==g&&this.Z(d,e,g.valueOf())});
|
|
928
|
+
this.X.add(b)}complete(){return new Promise((b,c)=>{this.N((d,e)=>{for(const f of this.X)f.unsubscribe();d?b():c(e)})})}update(b,c,d){const e=olympe.dc.ea(b),f=olympe.dc.ea(c);void 0===e||void 0===f?olympe.ga.Wa('dc').error('Burst transaction: instance tag or property tag is undefined'):(this.D.run(()=>{olympe.C.Wn([d],g=>{this.R=!0;if(g instanceof olympe.dc.vc)olympe.ga.Wa('dc').error('Cannot send complex property values in burst transactions');else{var h;this.Z(e,f,null!=(h=null==g?void 0:g.valueOf())?
|
|
929
|
+
h:null)}})}),this.D.Xd(()=>{this.N()}))}stop(){this.D.destroy();this.ia.length=0}getContext(){return this.D}T(){return this.id}th(){return!1}N(b){if(this.R){this.R=!1;null!==this.j&&(clearTimeout(this.j),this.j=null);this.H.clear();const c=this.ba(new Set(this.F.keys()));Pl(this,c,!0,b)}else null==b||b(!0)}toString(){return'Burst transaction #'+this.id}};olympe.dc.Gi.prototype.complete=olympe.dc.Gi.prototype.complete;olympe.dc.Gi.prototype.push=olympe.dc.Gi.prototype.push;olympe.dc.Qc=class{j(){}toString(){}};olympe.dc.Qc.j=1;olympe.dc.Qc.D=2;olympe.dc.Qc.H=3;olympe.dc.Qc.F=4;olympe.dc.Qc.N=5;olympe.dc.transaction.dj=class a{constructor(b){this.F=null!=b?b:olympe.dc.Ia.SERVER}static j(b){const c=new Map;for(const [d,e]of Object.entries(b)){b=d;let f=typeof e;20<b.length&&b.startsWith('fd')&&(b=olympe.dc.he.Xe+b.substring(2));'object'===f&&(f=e&&e.c?String(e.c):'untyped');switch(f){case '1':case '2':case '3':throw Error('Complex format for primitive types not supported.');case 'string':case 'boolean':case 'number':c.set(b,e);break;case '4':c.set(b,new Date(Date.UTC(e.y,e.M-1,e.d,e.h,e.m,
|
|
930
930
|
e.s,e.S)));break;case '5':c.set(b,new Date(Date.UTC(e.y,e.M-1,e.d)));break;case '6':c.set(b,new Date(Date.UTC(e.y||1970,e.M&&e.M-1||0,e.d||1,e.h,e.m,e.s,e.S)));break;case '7':c.set(b,new olympe.C.Color(e.r,e.g,e.b,e.a));break;case '8':c.set(b,new olympe.dc.vc(e.t));break;case 'untyped':null===e&&c.set(b,null)}}return c}j(b,c){return this.D(b,new olympe.dc.db.ec(c))}D(b,c){for(const d of b)switch(d.o){case olympe.dc.Qc.j:b=a.j(d.p||{});let e;c.Sc(d.t,null!=(e=d.s)?e:this.F,b,d.m);break;case olympe.dc.Qc.D:c.Yc(d.t,
|
|
931
|
-
a.j(d.p),d.m);break;case olympe.dc.Qc.H:c.D(d.t,d.f,d.m);break;case olympe.dc.Qc.F:c.Oa(d.m,d.l,d.r,d.lm,d.rm);break;case olympe.dc.Qc.N:c.hc(d.m,d.l,d.r,d.lm,d.rm);break;default:throw Error('Undefined patch operation: '+d.o);}return c}};function Ql(a,b){let c;return null!=(c=a.sources.get(b))?c:a.H.
|
|
931
|
+
a.j(d.p),d.m);break;case olympe.dc.Qc.H:c.D(d.t,d.f,d.m);break;case olympe.dc.Qc.F:c.Oa(d.m,d.l,d.r,d.lm,d.rm);break;case olympe.dc.Qc.N:c.hc(d.m,d.l,d.r,d.lm,d.rm);break;default:throw Error('Undefined patch operation: '+d.o);}return c}};function Ql(a,b){let c;return null!=(c=a.sources.get(b))?c:a.H.pe(b)}function Rl(a,b){let c,d,e;return null!=(e=null!=(d=null==(c=a.j.Uc(b))?void 0:c.Vb())?d:a.db.model(b))?e:null}function Z(a,b){let c;return null!=(c=a.F.get(b))?c:a.db.Re(b)||!a.db.Ja(b)}function Sl(a,b){0===a.F.size?a.F=b:b.forEach((c,d)=>a.F.set(d,c))}function Tl(a){return Array.from(a.j.Vc()).filter(b=>!b.yd()).map(b=>b.tag())}function Ul(a){return Array.from(a.j.Vc()).filter(b=>b.yd()).map(b=>b.tag())}
|
|
932
932
|
function Vl(a,b,c,d){d(a.j);c&&b!==olympe.dc.Ia.SELF&&(c=a.D.get(b),c||(c=new olympe.dc.db.ec(a.id),a.D.set(b,c)),d(c))}function Wl(a,b,c){const d=Ql(a,b),e=Z(a,b),f=Rl(a,b);Vl(a,d,e,g=>{g.D(b,c,f)})}
|
|
933
|
-
olympe.dc.transaction.
|
|
934
|
-
Ql(this,c);var f=Z(this,b)&&Z(this,c)&&d!==olympe.dc.Ia.SELF&&e!==olympe.dc.Ia.SELF;f&&d!==e&&a!==olympe.dc.fc.Zc&&(f=g=>{let h;return null!=(h=olympe.dc.
|
|
935
|
-
Z(this,c)&&d!==olympe.dc.Ia.SELF&&e!==olympe.dc.Ia.SELF;f&&d!==e&&a!==olympe.dc.fc.Zc&&(olympe.
|
|
936
|
-
class Zl{constructor(){this.N=new Map}R(a){return a instanceof olympe.C.Sa||a instanceof olympe.C.
|
|
933
|
+
olympe.dc.transaction.aw=class{constructor(a,b,c){this.id=null!=c?c:olympe.U.Lc();this.H=b;this.db=a;this.D=new Map;this.j=new olympe.dc.db.ec(this.id);this.sources=new Map;this.F=new Map}nf(){return 0===this.j.Bb.size}Sc(a,b,c,d){let e;const f=null!=(e=null!=c?c:this.sources.get(a))?e:this.H.fromModel(b);c=Z(this,a);this.sources.set(a,f);Vl(this,f,c,g=>{g.Sc(a,f,d,b)})}Yc(a,b){const c=Ql(this,a),d=Z(this,a),e=Rl(this,a);Vl(this,c,d,f=>{f.Yc(a,null!=b?b:new Map,e)})}Oa(a,b,c){const d=Ql(this,b),e=
|
|
934
|
+
Ql(this,c);var f=Z(this,b)&&Z(this,c)&&d!==olympe.dc.Ia.SELF&&e!==olympe.dc.Ia.SELF;f&&d!==e&&a!==olympe.dc.fc.Zc&&(f=g=>{let h;return null!=(h=olympe.dc.ha().name(g))?h:g},olympe.ga.Wa('dc').warn(`Try to create a relation between 2 objects that have different locations: \n ${f(b)} (${b})-[${f(a)} (${a})]->${f(c)} (${c}), originSrc: ${f(d)} (${d}), destinationSrc: ${f(e)} (${e})`),f=!1);Vl(this,d,f,g=>{g.Oa(a,b,c,Rl(this,b),Rl(this,c))})}hc(a,b,c){const d=Ql(this,b),e=Ql(this,c);let f=Z(this,b)&&
|
|
935
|
+
Z(this,c)&&d!==olympe.dc.Ia.SELF&&e!==olympe.dc.Ia.SELF;f&&d!==e&&a!==olympe.dc.fc.Zc&&(olympe.ga.Wa('dc').warn(`Try to delete a relation between 2 objects that have different locations: ${b}-[${a}]->${c}`),f=!1);Vl(this,d,f,g=>{g.hc(a,b,c,Rl(this,b),Rl(this,c))})}};function Xl(a,b,c){const d=Object.create(null);if(!b)return d;for(const f of Array.from(b.keys()).sort()){let g=f;var e=b.get(f);if(g===olympe.dc.lq.Zg)if(e===olympe.dc.Ia.SELF)d[g]=olympe.dc.ha().T();else{if(e===olympe.dc.Ia.SERVER)continue}else g.startsWith(olympe.dc.he.Xe)&&(g='fd'+g.substring(1));e=a.R(e);c&&e instanceof Object&&8===e.c?a.N.set(g,e):d[g]=e}return d}function Yl(a){if(0===a.N.size)return null;const b=Object.create(null);a.N.forEach((c,d)=>{b[d]=c});a.N.clear();return b}
|
|
936
|
+
class Zl{constructor(){this.N=new Map}R(a){return a instanceof olympe.C.Sa||a instanceof olympe.C.da||a instanceof olympe.C.$?a.valueOf():a instanceof Date||a instanceof olympe.C.eb?(a=a instanceof olympe.C.eb?a.valueOf():a,{c:4,y:a.getUTCFullYear(),M:a.getUTCMonth()+1,d:a.getUTCDate(),h:a.getUTCHours(),m:a.getUTCMinutes(),s:a.getUTCSeconds(),S:a.getUTCMilliseconds(),z:0}):a instanceof olympe.C.Color?{c:7,r:a.oh().valueOf(),g:a.lh().valueOf(),b:a.hh().valueOf(),a:a.gh().valueOf()}:a&&'function'===
|
|
937
937
|
typeof a.W?{c:8,t:a.W()}:a}}function Yf(a){const b=a.H.concat(a.F).concat(a.N).concat(a.j).concat(a.R);a.N=[];a.F=[];a.j=[];a.R=[];a.H=[];return b}
|
|
938
|
-
olympe.dc.transaction.
|
|
939
|
-
t:a,p:b})}Yc(a,b,c=null){b=Xl(this.X,b||null,!1);a={o:olympe.dc.Qc.D,t:a,p:b};this.
|
|
940
|
-
e&&(a.rm=e);this.R.push(a)}hc(a,b,c,d=null,e=null){if(!a)throw Error('Cannot delete relation of undefined type');if(!b)throw Error('Cannot delete relation with undefined origin');if(!c)throw Error('Cannot delete relation with undefined destination');a={o:olympe.dc.Qc.N,m:a,l:b,r:c};this.
|
|
941
|
-
function bm(a,b,c,d){c=a.create(null!=c?c:olympe.dc.CloudObject,void 0);if('string'===typeof b)b=b||'',X(c,olympe.dc.CloudObject.nameProp.W(),b);else for(const [f,g]of Object.entries(b))X(c,f,g);b=c.W();d=null!=d?d:olympe.dc.CloudObject;const e=olympe.dc.CloudObject.extendRel.W();am(a,new olympe.dc.transaction.
|
|
938
|
+
olympe.dc.transaction.Ie=class{constructor({xl:a=!1,hi:b=!0,le:c=!0}={}){this.N=[];this.F=[];this.j=[];this.R=[];this.H=[];this.xl=null!=a?a:!1;this.le=null!=c?c:!0;this.hi=null!=b?b:!0;this.X=olympe.C?new Zl:new class extends Zl{R(d){return d&&'function'===typeof d.W?{c:8,t:d.W()}:d}}}flush(){return JSON.stringify(Yf(this))}Sc(a,b,c,d=null){c=Xl(this.X,null!=c?c:null,this.xl);c={o:olympe.dc.Qc.j,t:a,p:c};this.hi&&(c.s=b);this.le&&d&&(c.m=d);this.N.push(c);this.xl&&(b=Yl(this.X))&&this.j.push({o:olympe.dc.Qc.D,
|
|
939
|
+
t:a,p:b})}Yc(a,b,c=null){b=Xl(this.X,b||null,!1);a={o:olympe.dc.Qc.D,t:a,p:b};this.le&&c&&(a.m=c);this.j.push(a)}D(a,b,c=null){a={o:olympe.dc.Qc.H,t:a,f:b};this.le&&c&&(a.m=c);this.F.push(a)}Oa(a,b,c,d=null,e=null){if(!a)throw Error('Cannot create relation of undefined type');if(!b)throw Error(`Cannot create relation ${a} from undefined origin to ${c}`);if(!c)throw Error(`Cannot create relation ${a} from ${b} to undefined destination`);a={o:olympe.dc.Qc.F,m:a,l:b,r:c};this.le&&d&&(a.lm=d);this.le&&
|
|
940
|
+
e&&(a.rm=e);this.R.push(a)}hc(a,b,c,d=null,e=null){if(!a)throw Error('Cannot delete relation of undefined type');if(!b)throw Error('Cannot delete relation with undefined origin');if(!c)throw Error('Cannot delete relation with undefined destination');a={o:olympe.dc.Qc.N,m:a,l:b,r:c};this.le&&d&&(a.lm=d);this.le&&e&&(a.rm=e);this.H.push(a)}};olympe.dc.transaction.Ie.ya=[olympe.dc.Writable];function $l(a){var b=new olympe.dc.Ya;b.X=a;return b}function am(a,b){b instanceof olympe.dc.Ya&&b.D.forEach((c,d)=>a.D.set(d,c));a.Ga.push(b);return b}
|
|
941
|
+
function bm(a,b,c,d){c=a.create(null!=c?c:olympe.dc.CloudObject,void 0);if('string'===typeof b)b=b||'',X(c,olympe.dc.CloudObject.nameProp.W(),b);else for(const [f,g]of Object.entries(b))X(c,f,g);b=c.W();d=null!=d?d:olympe.dc.CloudObject;const e=olympe.dc.CloudObject.extendRel.W();am(a,new olympe.dc.transaction.Ga.jp(e,b));am(a,new olympe.dc.transaction.Ga.Yl(e,b,d));return c}
|
|
942
942
|
function cm(a,b){if(a.H)throw Error('Operation not permitted: this transaction has already been executed');a.H=!0;const c=[d=>{a.H=d},...a.Z,null!=b?b:()=>{}];return(d,e)=>{c.forEach(f=>f(d,e))}}
|
|
943
|
-
olympe.dc.Ya=class{constructor(a){this.id=null!=a?a:olympe.U.Lc();this.
|
|
944
|
-
olympe.dc.ea(a));let d;this.persist(c,null!=(d=this.D.get(c))?d:this.X);return b}persist(a,b=!0){const c=olympe.dc.ea(a);var d=olympe.dc.
|
|
945
|
-
if(!e&&!this.F.has(c))throw Error(`Try to remove persistence of an instance that does not exist and is not part of the transaction: ${c}`);}return this}delete(a,b=olympe.dc.Lb.Dc){am(this,new olympe.dc.transaction.
|
|
946
|
-
f);X(d,olympe.dc.CloudObject.nameProp,c||'');void 0!==e&&this.update(a,olympe.dc.
|
|
947
|
-
c||''),olympe.dm.Relation.D,d),olympe.dm.Relation.F,k),olympe.dm.Relation.
|
|
943
|
+
olympe.dc.Ya=class{constructor(a){this.id=null!=a?a:olympe.U.Lc();this.Ga=[];this.F=new Map;this.X=!0;this.D=new Map;this.Z=[];this.H=this.N=!1;this.R=[...olympe.dc.Fj().Z]}T(){return this.id}model(a){let b;return null!=(b=this.F.get(olympe.dc.ea(a)))?b:olympe.dc.ha().model(a)}j(a){Sl(a,this.D);for(const b of this.Ga)b.j(a);try{this.R.forEach(b=>b(a))}catch(b){throw Error(`Transaction compilation error: ${b.message}`);}}create(a,b){b=am(this,new olympe.dc.transaction.Ga.Yo(a,b));const c=b.W();this.F.set(c,
|
|
944
|
+
olympe.dc.ea(a));let d;this.persist(c,null!=(d=this.D.get(c))?d:this.X);return b}persist(a,b=!0){const c=olympe.dc.ea(a);var d=olympe.dc.ha();this.D.set(c,b);if(b){let f;b=null!=(f=this.F.get(c))?f:d.model(c);if(null===b)throw Error(`Try to persist an instance that does not exist: ${c}`);var e;d=null!=(e=d.source(a))?e:olympe.dc.ee().fromModel(b);am(this,new olympe.dc.transaction.Ga.bw(c,d))}else{if((e=d.Ja(c))&&d.Re(c))throw Error(`Try to remove persistence of an instance already persisted: ${c}`);
|
|
945
|
+
if(!e&&!this.F.has(c))throw Error(`Try to remove persistence of an instance that does not exist and is not part of the transaction: ${c}`);}return this}delete(a,b=olympe.dc.Lb.Dc){am(this,new olympe.dc.transaction.Ga.kp(a,b))}update(a,b,c){return am(this,new olympe.dc.transaction.Ga.$w(a,b,c))}Oa(a,b,c){am(this,new olympe.dc.transaction.Ga.Yl(a,b,c))}hc(a,b,c){am(this,new olympe.dc.transaction.Ga.mu(a,b,c))}An(a,b){am(this,new olympe.dc.transaction.Ga.jp(a,b))}defineProperty(a,b,c,d,e,f){d=this.create(olympe.dm.Property,
|
|
946
|
+
f);X(d,olympe.dc.CloudObject.nameProp,c||'');void 0!==e&&this.update(a,olympe.dc.he.Xe+d.W(),e);this.Oa(olympe.dc.CloudObject.propertyRel,a,d);this.Oa(olympe.dm.Property.typeRel,d,b);this.Oa(olympe.dc.CloudObject.containsRel,a,d);return d}Gs(a,b,c='',{OE:d=olympe.dm.Relation.H.Ov,$E:e=olympe.dm.Relation.j.hw,VE:f=olympe.dm.Relation.j.Ot,xF:g=olympe.dm.Relation.j.Xp,LE:h=olympe.dm.Gl.NONE,wF:k=olympe.dm.Relation.N|h}={},l=olympe.U.Lc()){c=X(X(X(X(X(X(X(X(X(X(this.create(olympe.dm.Relation,l),olympe.dc.CloudObject.nameProp,
|
|
947
|
+
c||''),olympe.dm.Relation.D,d),olympe.dm.Relation.F,k),olympe.dm.Relation.ba,e),olympe.dm.Relation.wa,e),olympe.dm.Relation.Z,e),olympe.dm.Relation.X,f),olympe.dm.Relation.ia,g),olympe.dm.Relation.Ha,olympe.dm.Relation.j.Xp),olympe.dm.Relation.R,h);this.Oa(olympe.dc.CloudObject.Lj,a,c);this.Oa(olympe.dm.Relation.destinationModelRel,c,b);this.Oa(olympe.dc.CloudObject.containsRel,a,c);return c}th(){return!1}rn(a){this.Z.push(olympe.C.Za().rc(a))}mb(a,b){dm(olympe.dc.Fj(),this,cm(this,a),b)}Bn(a){a=
|
|
948
948
|
cm(this,a);em(olympe.dc.Fj(),this,a,!0)}toString(){return`Transaction #${this.id}`}};olympe.dc.Ya.ya=[olympe.dc.Qc];function Ol(a){var b=olympe.dc.Fj();const c=a.T();b.H.set(c,a);return(d,e,f)=>{const g=new olympe.dc.db.ec(c);g.Yc(d,(new Map).set(e,f),b.db.model(d));b.j.nd(Of(g,Infinity))}}
|
|
949
|
-
function Pl(a,b,c,d){var e=olympe.dc.Fj();const f=olympe.dc.Request.j.Fi,g=olympe.dc.Request.j.yh,h=a.T();a=a.th();const k=new Map;for(const l of b.keys()){const n=e.db.source(l);if(n===olympe.dc.Ia.SELF||!e.db.
|
|
950
|
-
function dm(a,b,c,d){if(d){const e=b.T();a.D.set(e,c);em(a,b,(f,g)=>{f||(a.D.delete(e),c(f,g))},!1)}else em(a,b,c,!1)}function fm(a){const b=olympe.dc.Request.j.
|
|
949
|
+
function Pl(a,b,c,d){var e=olympe.dc.Fj();const f=olympe.dc.Request.j.Fi,g=olympe.dc.Request.j.yh,h=a.T();a=a.th();const k=new Map;for(const l of b.keys()){const n=e.db.source(l);if(n===olympe.dc.Ia.SELF||!e.db.Re(l))continue;let p=k.get(n);p||(p=new olympe.dc.db.ec(h),k.set(n,p));p.Yc(l,b.get(l),e.db.model(l))}for(const [l,n]of k)b=new olympe.dc.Request(c?g:f,l,new olympe.dc.transaction.lj(n,a)),b=e.Jb.request(b).catch(p=>null==d?void 0:d(!1,`${p}`)),c&&b.then(p=>{e.j.nd(Of(n,p));null==d||d(!0)})}
|
|
950
|
+
function dm(a,b,c,d){if(d){const e=b.T();a.D.set(e,c);em(a,b,(f,g)=>{f||(a.D.delete(e),c(f,g))},!1)}else em(a,b,c,!1)}function fm(a){const b=olympe.dc.Request.j.jk;Wf(a.Jb,olympe.dc.Request.j.zo,c=>{var d=c.content;c=d.rollback;d=d.error;const e=c.T(),f=a.H.get(e);void 0!==f&&(a.H.delete(e),f.Ub(d));a.j.nd(c);a.G.warn(`Burst update (id=${e}) has been refused and is rolled back. Error: ${d}`)});Wf(a.Jb,b,c=>{c=c.content;gm(a,c.id,c.finalize,c.error)})}
|
|
951
951
|
function hm(a,b,c){if(!c)throw Error('Transaction compiler id is required');a.wa.has(c)||a.Z.push(b);return a}
|
|
952
|
-
function em(a,b,c,d=!1){const e=b.T(),f=new olympe.dc.transaction.
|
|
952
|
+
function em(a,b,c,d=!1){const e=b.T(),f=new olympe.dc.transaction.aw(a.db,a.ia,e);try{b.j(f)}catch(q){if(q instanceof olympe.dc.Qq){q.j.then(()=>em(a,b,c,d));return}c(!1,q.message);return}if(f.nf()){c(!0);var g;null==(g=a.D.get(e))||g(!0);a.D.delete(e)}else{a.F.set(e,[]);var h=Tl(f);a.j.ne(h,olympe.dc.db.Instance.j.TRANSACTION);g=h.filter(q=>Z(f,q));var k=Ul(f).filter(q=>a.db.Re(q)&&a.db.Nb(q,olympe.dm.File)&&a.db.source(q)!==olympe.dc.Ia.SERVER).map(q=>[q,a.db.model(q),a.db.source(q)]),l=Rg(a.j,
|
|
953
953
|
f.j,g),n=olympe.C.Za().rc((q,r)=>c(null!==q,r)),p=[l,n];im(a,f,g).then(q=>{p.splice(1,0,q);jm(a,e,h,f.D.size+1);return km(a,f.D,d,b.th(),b.N)}).then(q=>Promise.allSettled(k.map(([r,t,v])=>a.N.wa(r,t,v))).then(r=>{r.forEach(t=>{'rejected'===t.status&&a.G.warn('Some binary files have not been deleted after the transaction:',t.reason)});return q})).then(q=>{p.forEach(r=>r(q));gm(a,e,olympe.dc.transaction.Jf.j.$i)}).catch(q=>{a.G.error(q);p.forEach(r=>r(null,`${q}`));lm(a,e)})}}
|
|
954
|
-
function im(a,b,c){const d=b.j,e=olympe.dm.File.urlProp.W();c=c.filter(n=>{let p;return a.db.
|
|
955
|
-
r();else{var v=n.W(),x,y=null!=(x=n.get(olympe.dm.File.mimeTypeProp))?x:'application/data';a.N.ia(v,q,y,z=>{const A=h.reduce((K,Y)=>K||Y.Uc(v),null);null!==A&&(z=(new Map).set(e,z).set(f,!0).set(g,new Date),A.
|
|
956
|
-
new olympe.dc.db.ec);return Rg(a.j,n)})}function jm(a,b,c,d){const e=olympe.C.kh(),f=new olympe.async.
|
|
957
|
-
function km(a,b,c,d,e){if(c&&olympe.C.Qa(a.
|
|
954
|
+
function im(a,b,c){const d=b.j,e=olympe.dm.File.urlProp.W();c=c.filter(n=>{let p;return a.db.Nb(n,olympe.dm.File)&&void 0!==(null==(p=d.Uc(n))?void 0:p.Pa(e))}).map(olympe.dc.CloudObject.get);if(0===c.length)return Promise.resolve(()=>{});const f=olympe.dm.File.j.W(),g=olympe.dm.File.modificationDateProp.W(),h=Array.from(b.D.values()),k=[],l=olympe.U.jf();return Promise.all(c.map(n=>{const p=n.get(e);if(p.startsWith('blob:'))return l.F(p).then(q=>new Promise((r,t)=>{if(null===q)URL.revokeObjectURL(p),
|
|
955
|
+
r();else{var v=n.W(),x,y=null!=(x=n.get(olympe.dm.File.mimeTypeProp))?x:'application/data';a.N.ia(v,q,y,z=>{const A=h.reduce((K,Y)=>K||Y.Uc(v),null);null!==A&&(z=(new Map).set(e,z).set(f,!0).set(g,new Date),A.qn(z),k.push([v,z]));URL.revokeObjectURL(p);r()},t)}}));2048<p.length&&a.G.error('Trying to create a file with an URL longer than 2048. It likely is a data url and should be an object url. File tag:',n.W());return Promise.resolve([])})).then(()=>{const n=k.reduce((p,[q,r])=>{p.Yc(q,r);return p},
|
|
956
|
+
new olympe.dc.db.ec);return Rg(a.j,n)})}function jm(a,b,c,d){const e=olympe.C.kh(),f=new olympe.async.Dk(e);0<a.R&&f.$f(a.R);const g=olympe.dc.transaction.Jf.j.Jv;let h=!0;const k=a.F.get(b);for(let l=0;l<d;l++)f.add((n,p)=>{k.push(e.rc((q,r)=>{h&&(h=q!==g);r?p(r):n()}))});sd(f,(l,n)=>{l||a.G.warn(`An error occurred while processing the notification of transaction (${b}): ${n}.`);h&&a.j.detach(c,olympe.dc.db.Instance.j.TRANSACTION);lm(a,b)});f.start()}
|
|
957
|
+
function km(a,b,c,d,e){if(c&&olympe.C.Qa(a.ba.state)!==olympe.auth.Ta.j.sf)return Promise.reject('Cannot persist with batch transactions API if not authenticated (aka: `Transaction.executeAsLarge()`).');const f=c?olympe.dc.Request.j.dh:olympe.dc.Request.j.df;return Promise.all(Array.from(b).map(([g,h])=>{g=new olympe.dc.Request(f,g,new olympe.dc.transaction.lj(h,d,e));return a.Jb.request(g)})).then(g=>g[0])}
|
|
958
958
|
function gm(a,b,c,d){let e,f;null==(f=null==(e=a.F.get(b))?void 0:e.pop())||f(c,null!=d?d:null)}function lm(a,b){var c;null==(c=a.F.get(b))||c.forEach(d=>{d(olympe.dc.transaction.Jf.j.$i,null)});a.F.delete(b);if(0===a.F.size){for(const d of a.X)d();a.X=[]}a.D.has(b)&&(c=a.D.get(b),a.D.delete(b),c(!0))}
|
|
959
|
-
olympe.dc.transaction.Jf=class{constructor(a,b,c,d,e,f,g){this.G=a;this.j=b;this.db=b.view;this.Jb=c;this.ia=d;this.N=e;this.
|
|
960
|
-
b.redo_stack_size)}).catch(b=>this.G.error('Failed to process get stack request',b))).then(()=>{})}};olympe.dc.transaction.Jf.j={
|
|
961
|
-
olympe.V.config(function(a){E(a,olympe.dc.transaction.Config.
|
|
962
|
-
olympe.dc.transaction.Jf,olympe.dc.transaction.P.Da,olympe.dc.db.P.Fa,olympe.dc.P.Ug,olympe.dc.sources.P.
|
|
963
|
-
olympe.dc.transaction.
|
|
964
|
-
if(!this.D)throw Error('OperationError: Cannot create relation, destination tag is undefined, null or empty string');this.relation.La()===olympe.dc.ta.DESTINATION?a.Oa(b,olympe.dc.ea(this.origin),olympe.dc.ea(this.D)):a.Oa(b,olympe.dc.ea(this.D),olympe.dc.ea(this.origin))}toString(){return`CreateRelation('${this.relation.La()}${this.relation.W()}, ${olympe.dc.ea(this.origin)}, ${olympe.dc.ea(this.D)})`}};olympe.dc.transaction.
|
|
965
|
-
a.hc(b,c,f):a.hc(b,f,c)}toString(){return`DeleteAllRelations(${this.La()}${this.getType()})`}};olympe.dc.transaction.
|
|
966
|
-
this.relation.La()===olympe.dc.ta.DESTINATION?a.hc(b,c,d):a.hc(b,d,c)}toString(){return'DeleteRelation('+this.relation.La()+this.relation.W()+', '+olympe.dc.ea(this.origin)+', '+olympe.dc.ea(this.D)+')'}};olympe.dc.transaction.
|
|
967
|
-
for(const [e,f]of c){var d=this.
|
|
968
|
-
k)&&(h===olympe.dc.ta.ORIGIN?b.Oa(g,k,this.tag):b.Oa(g,this.tag,k))}}toString(){return`PersistOperation: tag - ${this.tag}, src - ${this.source}`}};olympe.dc.ea=function(a){let b=null;if('string'===typeof a)return a;if('function'===typeof(null==a?void 0:a.W)&&(null==a||!a.fh))b=a.W();else if('function'===typeof a){let d;b=null!=(d=olympe.dc.na.Wb(a))?d:''}else if(olympe.C.pf(a)){let d;b=olympe.dc.ea(null==(d=olympe.C.Qa(a))?void 0:d.valueOf())}let c;return null!=(c=b)?c:''};w('olympe.dc.instanceToTag',olympe.dc.ea);olympe.dc.
|
|
969
|
-
olympe.dc.defineProperty=function(a){return new olympe.dc.Ra.Property(a)};olympe.dc.
|
|
970
|
-
olympe.dc.ib.
|
|
959
|
+
olympe.dc.transaction.Jf=class{constructor(a,b,c,d,e,f,g){this.G=a;this.j=b;this.db=b.view;this.Jb=c;this.ia=d;this.N=e;this.ba=f;this.R=g.get('notificationTimeout');this.Z=[];let h;this.wa=new Set(null!=(h=g.get('disabledCompilers'))?h:[]);this.H=new olympe.U.Zh(g.get('burstHoldTime'));this.F=new Map;this.X=[];this.D=new Map;this.Ha=new olympe.U.promise.Tk;fm(this)}se(a){vb(this.Ha,()=>this.Jb.request(new olympe.dc.Request(olympe.dc.Request.j.Gp,olympe.dc.Ia.SERVER)).then(b=>{a(b.ids,b.undo_stack_size,
|
|
960
|
+
b.redo_stack_size)}).catch(b=>this.G.error('Failed to process get stack request',b))).then(()=>{})}};olympe.dc.transaction.Jf.j={Fm:0,$i:1,Jv:2};olympe.dc.transaction.lj=class{constructor(a,b=!1,c=!1){this.D=a;this.F=b;this.j=c}th(){return this.F}ac(){return this.D}};olympe.dc.transaction.P={Da:'dc.transaction.Logger',Fa:'dc.transaction.Manager'};olympe.dc.transaction.Config={Eq:'dc.transaction.timeout',yo:'dc.transaction.burstInterval',fm:'dc.transaction.disabledCompilers'};
|
|
961
|
+
olympe.V.config(function(a){E(a,olympe.dc.transaction.Config.Eq,9E4);E(a,olympe.dc.transaction.Config.yo,30);E(a,olympe.dc.transaction.Config.fm,[]);D(a,olympe.dc.transaction.P.Da,[olympe.ga.P.Fa],b=>b.ad('dc'));D(a,'olympe.dc.transaction.Config',[new olympe.V.oa(olympe.dc.transaction.Config.Eq),new olympe.V.oa(olympe.dc.transaction.Config.fm),new olympe.V.oa(olympe.dc.db.Config.Sl)],(b,c,d)=>new Map([['notificationTimeout',b],['disabledCompilers',c],['burstHoldTime',d]]));C(a,olympe.dc.transaction.P.Fa,
|
|
962
|
+
olympe.dc.transaction.Jf,olympe.dc.transaction.P.Da,olympe.dc.db.P.Fa,olympe.dc.P.Ug,olympe.dc.sources.P.af,olympe.dc.P.hk,olympe.auth.P.Fa,'olympe.dc.transaction.Config')},'olympe.dc.transaction');olympe.dc.transaction.Ga={};function mm(a,b){const c=new Map;for(const [d,e]of b)c.set(d,a.Qa(e));return c}olympe.dc.transaction.Ga.Cg=class{constructor(){this.ha=olympe.dc.ha()}j(){throw Error('Abstract method build() not override !');}toString(){throw Error('Abstract method toString() not override !');}Qa(a){a=olympe.C.Qa(a);return void 0===a||null===a?null:olympe.C.et(a)?a.valueOf():a}};olympe.dc.transaction.Ga.Cg.ya=[olympe.dc.Qc];olympe.dc.transaction.Ga.qo=class extends olympe.dc.transaction.Ga.Cg{constructor(a,b){super();this.relation=a instanceof olympe.dc.Ra.Relation?a:new olympe.dc.Ra.Relation(olympe.dc.ea(a));this.origin=this.ha.Ja(b)?olympe.dc.CloudObject.get(b):b}getType(){return this.relation.W()}La(){return this.relation.La()}j(){throw Error('Abstract method build() not override !');}toString(){throw Error('Abstract method toString() not override !');}};function X(a,b,c){a.Kd.set(olympe.dc.ea(b),c);return a}olympe.dc.transaction.Ga.Yo=class extends olympe.dc.transaction.Ga.Cg{constructor(a,b){super();let c;this.tag=null!=(c=b&&olympe.dc.ea(b))?c:olympe.U.hf();this.model=olympe.dc.ea(a);this.source=null;this.Kd=new Map}W(){return this.tag}Wb(){return this.model}yi(a){this.source=a;return this}j(a){const b=this.Wb(),c=this.W();if(!b)throw Error('OperationError: Cannot create instance, model tag is undefined');a.Sc(c,b,this.source,mm(this,this.Kd))}toString(){return`CreateInstance(${this.Wb()}, ${this.W()})`}};
|
|
963
|
+
olympe.dc.transaction.Ga.Yo.ya=[olympe.dc.Ye];olympe.dc.transaction.Ga.Yl=class extends olympe.dc.transaction.Ga.qo{constructor(a,b,c){super(a,b);this.D=this.ha.Ja(c)?olympe.dc.CloudObject.get(c):c}j(a){const b=this.getType();if(''===b)throw Error('OperationError: Cannot create relation, type is undefined, null or empty string');if(b===olympe.dc.fc.Zc)throw Error('OperationError: Cannot create the instance -> model relation');if(!this.origin)throw Error('OperationError: Cannot create relation, origin tag is undefined, null or empty string');
|
|
964
|
+
if(!this.D)throw Error('OperationError: Cannot create relation, destination tag is undefined, null or empty string');this.relation.La()===olympe.dc.ta.DESTINATION?a.Oa(b,olympe.dc.ea(this.origin),olympe.dc.ea(this.D)):a.Oa(b,olympe.dc.ea(this.D),olympe.dc.ea(this.origin))}toString(){return`CreateRelation('${this.relation.La()}${this.relation.W()}, ${olympe.dc.ea(this.origin)}, ${olympe.dc.ea(this.D)})`}};olympe.dc.transaction.Ga.cB=class extends olympe.dc.transaction.Ga.Cg{constructor(a,b=olympe.dc.Lb.Dc){super();this.model=a instanceof olympe.dc.CloudObject?a:olympe.dc.CloudObject.get(a);this.Ob=b}j(a){for(const b of this.ha.Vc(this.model))b!==olympe.dc.ea(this.model)&&(new olympe.dc.transaction.Ga.kp(b,this.Ob)).j(a)}toString(){return`DeleteAllInstances(${this.model.W()}, ${this.Ob})`}};olympe.dc.transaction.Ga.jp=class extends olympe.dc.transaction.Ga.qo{j(a){const b=this.getType();if(void 0===b)throw Error('OperationError: Cannot delete relation, type is undefined');if(b===olympe.dc.fc.Zc)throw Error('OperationError: Cannot delete the instance -> model relation');const c=olympe.dc.ea(this.origin);if(!this.origin)throw Error('OperationError: Cannot delete relation, left tag is undefined');const d=this.La(),e=this.ha.cb(c,this.relation);for(const f of e)d===olympe.dc.ta.DESTINATION?
|
|
965
|
+
a.hc(b,c,f):a.hc(b,f,c)}toString(){return`DeleteAllRelations(${this.La()}${this.getType()})`}};olympe.dc.transaction.Ga.kp=class extends olympe.dc.transaction.Ga.Cg{constructor(a,b=olympe.dc.Lb.Dc){super();this.tag=this.ha.Ja(a)?olympe.dc.CloudObject.get(a):a;this.Ob=b}W(){return olympe.dc.ea(this.tag)}j(a){const b=this.W();if(void 0===b)throw Error('OperationError: Cannot delete instance, tag is undefined');this.ha.Ja(b)&&Wl(a,b,this.Ob)}toString(){return'DeleteInstance('+this.W()+', '+this.Ob+')'}};olympe.dc.transaction.Ga.mu=class extends olympe.dc.transaction.Ga.Yl{j(a){const b=this.relation.W();if(void 0===b)throw Error('OperationError: Cannot delete relation, type is undefined');if(b===olympe.dc.fc.Zc)throw Error('OperationError: Cannot delete the instance -> model relation');const c=olympe.dc.ea(this.origin);if(void 0===c)throw Error('OperationError: Cannot delete relation, left tag is undefined');const d=olympe.dc.ea(this.D);if(void 0===d)throw Error('OperationError: Cannot delete relation, right tag is undefined');
|
|
966
|
+
this.relation.La()===olympe.dc.ta.DESTINATION?a.hc(b,c,d):a.hc(b,d,c)}toString(){return'DeleteRelation('+this.relation.La()+this.relation.W()+', '+olympe.dc.ea(this.origin)+', '+olympe.dc.ea(this.D)+')'}};olympe.dc.transaction.Ga.$w=class extends olympe.dc.transaction.Ga.Cg{constructor(a,b,c){super();this.tag=this.ha.Ja(a)?olympe.dc.CloudObject.get(a):a;this.Kd=new Map;void 0!==b&&this.Kd.set(olympe.dc.ea(b),c)}W(){return olympe.dc.ea(this.tag)}j(a){const b=this.W();if(void 0===b)throw Error('OperationError: Cannot update instance, tag is undefined');var c;if(!(null!=(c=a.j.Uc(b))&&c.D()||this.ha.Ja(b)))throw Error('OperationError: Instance #'+b+' not found so it cannot be updated');c=mm(this,this.Kd);
|
|
967
|
+
for(const [e,f]of c){var d=this.ha.Pa(b,e,!0);d instanceof olympe.dc.vc&&Wl(a,d.W(),olympe.dc.Lb.Dc);f instanceof olympe.dc.vc&&!Z(a,f.W())&&(d=new olympe.dc.Ya,d.persist(f.W()),d.j(a))}a.Yc(b,c)}toString(){return'UpdateInstance('+this.W()+', '+mm(this,this.Kd)+')'}};olympe.dc.transaction.Ga.bw=class a extends olympe.dc.transaction.Ga.Cg{constructor(b,c){super();this.tag=b;this.source=c}j(b){const c=olympe.dc.ha();if(Z(b,this.tag)&&c.Ja(this.tag)&&!c.Re(this.tag)){const e=c.zb(this.tag,!0);var d;let f;null==(f=null==(d=b.j.Uc(this.tag))?void 0:d.zb())||f.forEach((g,h)=>{e.set(h,g)});for(const g of e.values())g instanceof olympe.dc.vc&&c.Ja(g.W())&&(new a(g.W(),this.source)).j(b);d=c.model(this.tag);b.Sc(this.tag,d,this.source,e);for(const [g,h,k]of uh(c,this.tag))Z(b,
|
|
968
|
+
k)&&(h===olympe.dc.ta.ORIGIN?b.Oa(g,k,this.tag):b.Oa(g,this.tag,k))}}toString(){return`PersistOperation: tag - ${this.tag}, src - ${this.source}`}};olympe.dc.ea=function(a){let b=null;if('string'===typeof a)return a;if('function'===typeof(null==a?void 0:a.W)&&(null==a||!a.fh))b=a.W();else if('function'===typeof a){let d;b=null!=(d=olympe.dc.na.Wb(a))?d:''}else if(olympe.C.pf(a)){let d;b=olympe.dc.ea(null==(d=olympe.C.Qa(a))?void 0:d.valueOf())}let c;return null!=(c=b)?c:''};w('olympe.dc.instanceToTag',olympe.dc.ea);olympe.dc.ha=function(){return olympe.dc.Ns().view};olympe.dc.register=function(a,b){olympe.dc.na.j(a,b)};
|
|
969
|
+
olympe.dc.defineProperty=function(a){return new olympe.dc.Ra.Property(a)};olympe.dc.Gs=function(a,b=olympe.dc.ta.DESTINATION,c=olympe.dc.CloudObject,d=olympe.dc.ta.DESTINATION){const e=olympe.dc.ta.DESTINATION;return b===olympe.dc.ta.ORIGIN||b===e?new olympe.dc.Ra.Relation(a,b):new olympe.dc.Ra.Relation(a,d,b,c)};olympe.dc.Kx=function(a){return a.$b()};olympe.dc.ib={};olympe.dc.ib.xn=a=>'string'===typeof a||'number'===typeof a||'boolean'===typeof a||a instanceof String?olympe.C.xb(a):a instanceof olympe.C.Sa?a:null;olympe.dc.ib.un=a=>'boolean'===typeof a||a instanceof Boolean?olympe.C.Rb(a):a instanceof olympe.C.da?a:null;olympe.dc.ib.wn=a=>'number'===typeof a||a instanceof Number?olympe.C.qa(a):'string'===typeof a||a instanceof String?olympe.C.qa(Number.parseFloat(a.valueOf())):a instanceof olympe.C.$?a:null;
|
|
970
|
+
olympe.dc.ib.vn=a=>'number'===typeof a||a instanceof Number?nc(a.valueOf()):'string'===typeof a||a instanceof String?new olympe.C.eb(new Date(a.valueOf().valueOf())):a instanceof Date?new olympe.C.eb(a):a instanceof olympe.C.eb?a:null;olympe.dc.ib.Bs=function(a){return a instanceof olympe.C.Color?a:'string'===typeof a||a instanceof String?rc(a.valueOf()):null};olympe.dc.ib.Cs=a=>a instanceof olympe.dc.CloudObject?a:a instanceof olympe.dc.vc?olympe.dc.CloudObject.get(a.tag):null;
|
|
971
971
|
olympe.dc.ib.tj=a=>a instanceof olympe.dc.vc?olympe.dc.CloudObject.get(a.tag):a;olympe.dc.ib.tc=a=>{a=a instanceof olympe.dc.vc?olympe.dc.CloudObject.get(a.tag):a;let b;return null!=(b=a instanceof olympe.dc.CloudObject?a.tc():a)?b:null};
|
|
972
|
-
olympe.dc.ib.
|
|
973
|
-
olympe.dc.Aa=class{constructor(a,b,c){void 0===a||null===a?olympe.
|
|
974
|
-
{var b=this.j.T();a.G.debug('QueryMGR: [ID:',b,'] - Unregistered');const c=a.j.get(b);if(null==c)var d=0;else 0<c.counter&&c.counter--,d=0===c.counter;d&&(c.j.release(),a.j.delete(b));this.j=null})}return this}mc(){null===this.j&&this.mb();return this.j}Qd(a){this.valueType=a;null!==this.j&&this.j.Qd(this.valueType)}
|
|
975
|
-
this.mc();om(b,'getCurrent');return b.oi(a)}has(a){return this.mc().has(a)}rh(a){const b=this.mc();om(b,'hasCurrent');return b.rh(a)}
|
|
976
|
-
this.mc();om(a,'getCurrentSize');return a.wg()}forEach(a,b){this.mc().forEach(a,b)}
|
|
977
|
-
if(c instanceof olympe.dc.Ra.Property)throw Error(`ListDef.transform(): Properties cannot be used as transformer, unlike relations ${c}`);if(!c||'function'!==typeof c.j)break;a.push(c)}b=new olympe.dc.Aa(this.D,a);b.Bc=this.Bc;b.Qd(nm(b)||this.valueType||Object);return b}
|
|
978
|
-
let b=this.aa;b instanceof Array||(b=b?[b]:[]);a.transform(b);return a}toString(){let a=this.aa;a=a?', '+(a.join?a.join(', '):a.toString()):'';return'ListDef(#'+olympe.C.Qa(this.D)+a+')'}
|
|
979
|
-
olympe.dc.Aa.prototype.transform=olympe.dc.Aa.prototype.transform;olympe.dc.Aa.prototype.forEachCurrentValue=olympe.dc.Aa.prototype.
|
|
980
|
-
olympe.dc.Aa.prototype.getCurrentAt=olympe.dc.Aa.prototype.lf;olympe.dc.Aa.prototype.observeAt=olympe.dc.Aa.prototype.
|
|
981
|
-
m.be.K=new olympe.C.J(()=>String,[]);m.
|
|
982
|
-
m.Sf.K=olympe.C.J.j;m.Jc.K=new olympe.C.J(()=>olympe.dc.CloudObject,[],'valueType');m.Tf.K=new olympe.C.J(()=>String,[]);m.Cf.K=olympe.C.J.F;m.wg.K=olympe.C.J.j;m.forEach.K=new olympe.C.J(()=>{},[]);m.
|
|
983
|
-
olympe.dc.
|
|
984
|
-
d);if(!d||'function'!==typeof d.j)throw new tm('transform','one of the argument is not a Transformer '+d);const e=d.
|
|
985
|
-
b,c){a=new olympe.dc.aa.
|
|
986
|
-
olympe.dc.Y.Nd?(b=b.Y,b.push(a),a=new olympe.dc.Y.Nd(...b)):a=new olympe.dc.Y.Nd(b,a);b=this.
|
|
987
|
-
c))}
|
|
988
|
-
Array))throw new tm('hasRelated','Provided argument "relations" must be an array.');const c=[],d=[];a.forEach(e=>{c.push(e);d.push(e.La())});return this.
|
|
989
|
-
return this.
|
|
990
|
-
new olympe.dc.wc.DateTime(new olympe.dc.ab.Ji(a,c))}c=d;null!==c&&this.aa.push(new olympe.dc.aa.ah(c,b));return this}sort(a,b,c){const d=new class extends olympe.dc.wc.Bg{F(e,f){return a(olympe.dc.CloudObject.get(f))}compare(e,f){return b(e,f).valueOf()}};this.aa.push(new olympe.dc.aa.ah(d,c));return this}
|
|
991
|
-
function sm(a){return'string'===typeof a||a instanceof olympe.C.Sa?a:'function'===typeof a?olympe.dc.na.Wb(a):olympe.C.gb(a)?a.di===olympe.C.Sa?a:olympe.C.sa([a],b=>olympe.C.xb(olympe.dc.ea(b)),olympe.C.Sa):a.W()}m=olympe.dc.
|
|
992
|
-
m.
|
|
993
|
-
function um(a,b){if(b.N())a.G.debug('ListProcessor: [ID:',b.T(),'] - Subscription already booted, ignoring');else{a.G.debug('ListProcessor: [ID:',b.T(),'] - Booting subscription');var c=new olympe.dc.kc.
|
|
994
|
-
function xm(a,b,c,d,e){const f=[b.be()],g=l=>l instanceof olympe.dc.aa.Lf;let h;const k=(null!=(h=b.ph())?h:[]).filter(g);for(const l of k){f.push(l.be());let n;k.push(...(null!=(n=l.ph())?n:[]).filter(g))}olympe.C.Wc(f,()=>{const l=b.
|
|
995
|
-
function ym(a,b,c,d,e){a.G.debug('CoverageProcessor: [ID:',c,'] - checking coverage of remote query over',b.length,'paths.');const f=olympe.C.Za(),g=new olympe.async.
|
|
996
|
-
function vm(a,b,c){const d=new olympe.dc.kc.Vj;let e=!1;const f=olympe.C.Za(),g=b.ph(),h=[];h[g?g.length:0]=(k,l,n,p)=>{f.jd()||f.fb()||(k?b.rh(n)?a.G.warn('Adding the same index twice (should never happen) for sub #',b.T(),', index #',n,', tag #',l):(a.G.debug('ListProcessor: [ID:',b.T(),'] - Adding Instance',l,'to the subscription'),b.Md(n,l)):(a.G.debug('ListProcessor: [ID:',b.T(),'] - Removing Instance',l,'from the subscription'),b.tg(n)),e||(zm(c,()=>{p.pg();wm(c)}),f.run(()=>p.
|
|
972
|
+
olympe.dc.ib.gy=a=>{switch(a){case olympe.C.da:return olympe.dc.ib.un;case olympe.C.Sa:return olympe.dc.ib.xn;case olympe.C.$:return olympe.dc.ib.wn;case olympe.C.eb:return olympe.dc.ib.vn;case olympe.C.Color:return olympe.dc.ib.Bs;case olympe.dc.CloudObject:return olympe.dc.ib.Cs;default:return olympe.dc.ib.tj}};olympe.dc.jc={};olympe.dc.xf=class{ka(){}F(){}compare(){}H(){}fa(){}toString(){}};function nm(a){let b=null;for(a=[...a.aa];null===b&&0<a.length;)b=a.pop().Mb();return b}function om(a,b){a.N()||(a=`Calling "${b}" on subscription with id ${a.T()} while it is not ready (thus no data is available).`+'This call should be made within an onReady callback. You can also consider to use Queries API instead of ListDefs (which are deprecated)',olympe.ga.Wa('dc').warn(a))}
|
|
973
|
+
olympe.dc.Aa=class{constructor(a,b,c){void 0===a||null===a?olympe.ga.Wa('dc').warn('attempt to create a listdef with a null or undefind basetag. This listdef is thus without effect.'):(this.D=olympe.C.sa([a],olympe.dc.ea,String),this.aa=void 0!==b&&(Array.isArray(b)?b:[b])||[],this.valueType=c||nm(this),this.j=null,this.Bc=void 0)}re(){return olympe.dc.re()}mb(){if(null===this.j){const a=olympe.dc.jc.Fy();this.j=pm(a,this,this.Bc);null!==this.valueType&&this.j.Qd(this.valueType);olympe.C.Za().Xd(()=>
|
|
974
|
+
{var b=this.j.T();a.G.debug('QueryMGR: [ID:',b,'] - Unregistered');const c=a.j.get(b);if(null==c)var d=0;else 0<c.counter&&c.counter--,d=0===c.counter;d&&(c.j.release(),a.j.delete(b));this.j=null})}return this}mc(){null===this.j&&this.mb();return this.j}Qd(a){this.valueType=a;null!==this.j&&this.j.Qd(this.valueType)}Mb(){return null!==this.j?this.j.Mb():null===this.valueType?olympe.dc.CloudObject:this.valueType}be(){return this.D}xm(){return this.aa}kd(a,b){return this.mc().kd(a,b)}ul(a){this.mc().ul(a)}Xu(){return this.mc().Fd()}Wu(){return this.mc().N()}get(a){return this.mc().get(a)}si(){return this.mc().si()}oi(a){const b=
|
|
975
|
+
this.mc();om(b,'getCurrent');return b.oi(a)}has(a){return this.mc().has(a)}rh(a){const b=this.mc();om(b,'hasCurrent');return b.rh(a)}qe(a){return this.mc().qe(a)}Fz(a){return this.qe(a).asObservable()}lf(a){const b=this.mc();om(b,'getCurrentAt');return b.lf(a)}mf(a){return this.mc().mf(a)}Rf(a){const b=this.mc();om(b,'getCurrentKeyAt');return b.Rf(a)}Hd(a){return this.mc().Hd(a)}Kz(a){return this.Hd(a).asObservable()}Sf(a){const b=this.mc();om(b,'getCurrentRank');return b.Sf(a)}Jc(){return this.mc().Jc()}Gz(){return this.Jc().asObservable()}Tf(){return this.mc().Tf()}Cf(){return this.mc().Cf()}Lz(){return this.Cf().asObservable()}wg(){const a=
|
|
976
|
+
this.mc();om(a,'getCurrentSize');return a.wg()}forEach(a,b){this.mc().forEach(a,b)}oe(a){const b=this.mc();om(b,'forEachCurrentValue');return b.oe(a)}wj(a,b,c,d){a=new olympe.dc.aa.Mh(a,b);(new olympe.dc.Aa(this.D,[...this.aa,a],this.valueType)).forEach(c,d)}transform(...a){var b=a;if(Array.isArray(a[0])){if(1<a.length)throw Error('ListDef.transform() should be called either with one array argument, or with ... arguments, but not both');b=a[0]}a=[...this.aa];for(const c of b){if(void 0===c)throw Error('ListDef.transform(): Trying to set an undefined transformer');
|
|
977
|
+
if(c instanceof olympe.dc.Ra.Property)throw Error(`ListDef.transform(): Properties cannot be used as transformer, unlike relations ${c}`);if(!c||'function'!==typeof c.j)break;a.push(c)}b=new olympe.dc.Aa(this.D,a);b.Bc=this.Bc;b.Qd(nm(b)||this.valueType||Object);return b}Cl(a){return this.transform(new olympe.dc.aa.Lf(a))}filter(a){return this.transform(new olympe.dc.aa.zf(a))}bl(){const a=new olympe.dc.rk(this.D,null===this.valueType?void 0:this.valueType);'boolean'===typeof this.Bc&&(a.Bc=this.Bc);
|
|
978
|
+
let b=this.aa;b instanceof Array||(b=b?[b]:[]);a.transform(b);return a}toString(){let a=this.aa;a=a?', '+(a.join?a.join(', '):a.toString()):'';return'ListDef(#'+olympe.C.Qa(this.D)+a+')'}Vu(){return this.mc().Lg()}Xc(){return olympe.C.sa([this.Cf()],a=>{let b='[';for(let c=0;c<a;c++){const d=this.lf(c).toString();b=0<c&&c<a?b+(', '+d):b+d}return olympe.C.xb(b+']')},olympe.C.Sa)}};olympe.dc.Aa.prototype.filter=olympe.dc.Aa.prototype.filter;olympe.dc.Aa.prototype.union=olympe.dc.Aa.prototype.Cl;
|
|
979
|
+
olympe.dc.Aa.prototype.transform=olympe.dc.Aa.prototype.transform;olympe.dc.Aa.prototype.forEachCurrentValue=olympe.dc.Aa.prototype.oe;olympe.dc.Aa.prototype.forEach=olympe.dc.Aa.prototype.forEach;olympe.dc.Aa.prototype.getCurrentSize=olympe.dc.Aa.prototype.wg;olympe.dc.Aa.prototype.observeSize=olympe.dc.Aa.prototype.Lz;olympe.dc.Aa.prototype.observeFirst=olympe.dc.Aa.prototype.Gz;olympe.dc.Aa.prototype.getCurrentRank=olympe.dc.Aa.prototype.Sf;olympe.dc.Aa.prototype.observeRank=olympe.dc.Aa.prototype.Kz;
|
|
980
|
+
olympe.dc.Aa.prototype.getCurrentAt=olympe.dc.Aa.prototype.lf;olympe.dc.Aa.prototype.observeAt=olympe.dc.Aa.prototype.Fz;olympe.dc.Aa.prototype.offReady=olympe.dc.Aa.prototype.ul;olympe.dc.Aa.prototype.onReady=olympe.dc.Aa.prototype.kd;olympe.dc.Aa.prototype.getBaseTag=olympe.dc.Aa.prototype.be;olympe.dc.Aa.ya=[olympe.C.vd];m=olympe.dc.Aa.prototype;m.re.K=olympe.C.J.j;m.mb.K=olympe.C.J.H();m.mc.K=new olympe.C.J(()=>olympe.dc.jc.Subscription,[]);m.Qd.K=new olympe.C.J(()=>{},[]);
|
|
981
|
+
m.be.K=new olympe.C.J(()=>String,[]);m.xm.K=new olympe.C.J(()=>Array,[]);m.kd.K=new olympe.C.J(()=>String,[]);m.ul.K=new olympe.C.J(()=>{},[]);m.Xu.K=olympe.C.J.N;m.Wu.K=olympe.C.J.j;m.get.K=new olympe.C.J(()=>olympe.dc.CloudObject,[],'valueType');m.si.K=new olympe.C.J(()=>Array,[]);m.oi.K=olympe.C.J.j;m.has.K=olympe.C.J.N;m.rh.K=olympe.C.J.j;m.qe.K=new olympe.C.J(()=>olympe.dc.CloudObject,[],'valueType');m.lf.K=olympe.C.J.j;m.mf.K=new olympe.C.J(()=>String,[]);m.Rf.K=olympe.C.J.j;m.Hd.K=olympe.C.J.F;
|
|
982
|
+
m.Sf.K=olympe.C.J.j;m.Jc.K=new olympe.C.J(()=>olympe.dc.CloudObject,[],'valueType');m.Tf.K=new olympe.C.J(()=>String,[]);m.Cf.K=olympe.C.J.F;m.wg.K=olympe.C.J.j;m.forEach.K=new olympe.C.J(()=>{},[]);m.oe.K=olympe.C.J.j;m.wj.K=new olympe.C.J(()=>{},[]);m.transform.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.Cl.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.filter.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.bl.K=new olympe.C.J(()=>olympe.dc.rk,[]);m.toString.K=olympe.C.J.j;m.Vu.K=olympe.C.J.j;m.Xc.K=olympe.C.J.D;const qm={uA:'append',jm:'filter_not',wp:'filter_and',xp:'filter_or'};function rm(a,b){a=sm(a);a=olympe.dc.CloudObject.get(a);return(new olympe.dc.ab.ro(a,b)).D}
|
|
983
|
+
olympe.dc.rk=class{constructor(a,b){this.j=sm(a);this.G=olympe.ga.Wa('dc.query');this.valueType=void 0===b?olympe.dc.CloudObject:b;this.aa=[];this.Ga=[];this.Bc=void 0}Xi(){const a=new olympe.dc.Aa(this.j,this.aa,this.valueType);'boolean'===typeof this.Bc&&(a.Bc=this.Bc);return a}transform(a){for(let b=0,c=a.length,d;b<c;b++){d=a[b];if(void 0===d)throw new tm('transform','Trying to set an undefined transformer');if(d instanceof olympe.dc.Ra.Property)throw new tm('transform','Properties cannot be used as transformer, unlike relations '+
|
|
984
|
+
d);if(!d||'function'!==typeof d.j)throw new tm('transform','one of the argument is not a Transformer '+d);const e=d.Mb();null!==e&&(this.valueType=e);this.aa.push(d)}return this}Cl(a){this.aa.push(new olympe.dc.aa.Lf(a));return this}rA(a){this.aa.push(new olympe.dc.aa.Lf(sm(a)));return this}Zu(a){this.valueType=a;return this}bb(a){this.aa.push(a);this.valueType=a.Mb()||olympe.dc.CloudObject;return this}Yx(a){for(const b of a)this.aa.push(b),this.valueType=b.Mb()||olympe.dc.CloudObject;return this}Xx(a,
|
|
985
|
+
b,c){a=new olympe.dc.aa.Le(a,a.La(),b,c);this.aa.push(a);this.valueType=a.Mb()||olympe.dc.CloudObject;return this}Wx(a){const b=[];let c;for(let d=0;d<a.length;d++){const e=a[d];b.push(e.W());void 0===c&&(c=e.La())}a=new olympe.dc.aa.tk(b,c);this.aa.push(a);this.valueType=a.Mb()||olympe.dc.CloudObject;return this}Yu(){this.bb(olympe.dc.CloudObject.instancesRel);return this}gf(a){var b=this.Ga.pop();b===qm.jm&&(a=new olympe.dc.Y.ie(a),b=this.Ga.pop());switch(b){case qm.wp:b=this.aa.pop().D;b instanceof
|
|
986
|
+
olympe.dc.Y.Nd?(b=b.Y,b.push(a),a=new olympe.dc.Y.Nd(...b)):a=new olympe.dc.Y.Nd(b,a);b=this.Ga.pop();break;case qm.xp:b=this.aa.pop().D,b instanceof olympe.dc.Y.Ge?(b=b.Y,b.push(a),a=new olympe.dc.Y.Ge(...b)):a=new olympe.dc.Y.Ge(b,a),b=this.Ga.pop()}b===qm.jm&&(a=new olympe.dc.Y.ie(a),this.Ga.pop());this.aa.push(new olympe.dc.aa.zf(a));return this}Sx(a,b,c){return this.gf(new olympe.dc.Y.Ce(rm(a,c),new olympe.dc.ab.We(b)))}contains(a,b,c=!1,d){return this.gf(new olympe.dc.Y.yf(rm(a,d),new olympe.dc.ab.We(b),
|
|
987
|
+
c))}Nb(a){if(!(a instanceof Array))throw new tm('instanceOf','Provided argument "models" must be an array.');const b=[];for(let c=0;c<a.length;c++)b.push(sm(a[c]));return this.gf(new olympe.dc.Y.Ui(b))}pl(a){return this.gf(new olympe.dc.Y.Ce(new olympe.dc.ab.kj,new olympe.dc.ab.We(sm(a))))}Tx(a){if(!Array.isArray(a))throw Error('ExcludeInstances should be called with an array');if(0<a.length){this.zd().pl(a[0]);for(let b=1,c=a.length;b<c;b++)this.and().zd().pl(a[b])}return this}ez(a,b){if(!(a instanceof
|
|
988
|
+
Array))throw new tm('hasRelated','Provided argument "relations" must be an array.');const c=[],d=[];a.forEach(e=>{c.push(e);d.push(e.La())});return this.gf(new olympe.dc.Y.Ri(c,d,b))}nl(a,b,c){a=rm(a,c);return this.gf(new olympe.dc.Y.mk(a,new olympe.dc.ab.We(b)))}Pj(a,b,c){a=rm(a,c);return this.gf(new olympe.dc.Y.Rk(a,new olympe.dc.ab.We(b)))}wz(a,b,c,d){a=rm(a,d);return this.gf(new olympe.dc.Y.Hf(a,b,c))}filter(a){const b=new class extends olympe.dc.Y.Bg{j(c,d){return a(olympe.dc.CloudObject.get(d))}};
|
|
989
|
+
return this.gf(b)}zd(){this.Ga.push(qm.jm);return this}and(){this.aa[this.aa.length-1]instanceof olympe.dc.aa.zf&&this.Ga.push(qm.wp);return this}or(){this.aa[this.aa.length-1]instanceof olympe.dc.aa.zf&&this.Ga.push(qm.xp);return this}Al(a,b,c){a=sm(a);let d=null;switch(olympe.dc.ha().Ib(a,olympe.dm.Property.typeRel)){case olympe.dm.String.O.W():d=new olympe.dc.wc.String(new olympe.dc.ab.jj(a,c));break;case olympe.dm.Number.O.W():d=new olympe.dc.wc.Number(new olympe.dc.ab.aj(a,c));break;case olympe.dm.DateTime.O.W():d=
|
|
990
|
+
new olympe.dc.wc.DateTime(new olympe.dc.ab.Ji(a,c))}c=d;null!==c&&this.aa.push(new olympe.dc.aa.ah(c,b));return this}sort(a,b,c){const d=new class extends olympe.dc.wc.Bg{F(e,f){return a(olympe.dc.CloudObject.get(f))}compare(e,f){return b(e,f).valueOf()}};this.aa.push(new olympe.dc.aa.ah(d,c));return this}Ox(){this.aa.push(new olympe.dc.aa.Ki);return this}Hj(a,b){this.aa.push(new olympe.dc.aa.Mh(a,b));return this}};class tm extends Error{constructor(a,b){super(`ListDefBuilder.${a}(): ${b}`)}}
|
|
991
|
+
function sm(a){return'string'===typeof a||a instanceof olympe.C.Sa?a:'function'===typeof a?olympe.dc.na.Wb(a):olympe.C.gb(a)?a.di===olympe.C.Sa?a:olympe.C.sa([a],b=>olympe.C.xb(olympe.dc.ea(b)),olympe.C.Sa):a.W()}m=olympe.dc.rk.prototype;m.Xi.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.transform.K=olympe.C.J.H();m.Cl.K=olympe.C.J.H();m.rA.K=olympe.C.J.H();m.Zu.K=olympe.C.J.H();m.bb.K=olympe.C.J.H();m.Yx.K=olympe.C.J.H();m.Xx.K=olympe.C.J.H();m.Wx.K=olympe.C.J.H();m.Yu.K=olympe.C.J.H();m.gf.K=olympe.C.J.H();
|
|
992
|
+
m.Sx.K=olympe.C.J.H();m.contains.K=olympe.C.J.H();m.Nb.K=olympe.C.J.H();m.pl.K=olympe.C.J.H();m.Tx.K=olympe.C.J.H();m.ez.K=olympe.C.J.H();m.nl.K=olympe.C.J.H();m.Pj.K=olympe.C.J.H();m.wz.K=olympe.C.J.H();m.filter.K=olympe.C.J.H();m.zd.K=olympe.C.J.H();m.and.K=olympe.C.J.H();m.or.K=olympe.C.J.H();m.Al.K=olympe.C.J.H();m.sort.K=olympe.C.J.H();m.Ox.K=olympe.C.J.H();m.Hj.K=olympe.C.J.H();function pm(a,b,c){const d=b.be();var e=new olympe.dc.query.$v;let f;f=d;olympe.C.gb(f)&&(f=e.add(d));b=(b=b.xm())?Array.isArray(b)?b:[b]:null;e=olympe.dc.jc.Subscription.F(f,b,e);let g,h,k=null!=(h=null==(g=a.j.get(e))?void 0:g.j)?h:null;null===k&&(a.G.debug('QueryMGR: new',a.D?'local':'remote','subscription "',e,'": #',`${f},`,b),k=new olympe.dc.jc.Subscription(e,d,b,a.F));k.getContext().run(()=>a.process(k,c));return k}
|
|
993
|
+
function um(a,b){if(b.N())a.G.debug('ListProcessor: [ID:',b.T(),'] - Subscription already booted, ignoring');else{a.G.debug('ListProcessor: [ID:',b.T(),'] - Booting subscription');var c=new olympe.dc.kc.Yr(a.db,a.G),d=b.T();olympe.C.Wc([b.be()],e=>{const f=olympe.dc.ea(e);a.G.debug('ListProcessor: [ID:',b.T(),'] - Booting with baseTag',f);b.Pf()||b.mi();Pf(a.db,f,vm(a,b,c),d);olympe.C.Za().Xd(()=>Nf(a.db,f,d));a.db.Ja(f.valueOf())||wm(c);b.N()||(wm(c),b.Hc([]))})}}
|
|
994
|
+
function xm(a,b,c,d,e){const f=[b.be()],g=l=>l instanceof olympe.dc.aa.Lf;let h;const k=(null!=(h=b.ph())?h:[]).filter(g);for(const l of k){f.push(l.be());let n;k.push(...(null!=(n=l.ph())?n:[]).filter(g))}olympe.C.Wc(f,()=>{const l=b.ke(c);ym(a,l,b.T(),d,e)})}
|
|
995
|
+
function ym(a,b,c,d,e){a.G.debug('CoverageProcessor: [ID:',c,'] - checking coverage of remote query over',b.length,'paths.');const f=olympe.C.Za(),g=new olympe.async.Dk(f);b.forEach(h=>{g.add((k,l)=>{let n=!1;Di(a.H,h,f,olympe.dc.Ia.SELF,olympe.dc.la.nc.wf,{Bc:e}).subscribe(rxjs.Subscriber.create(()=>{n||(n=!0,f.run(k))},p=>f.run(()=>l(`The query ${c} is not covered by an existing graphdef, `+`and the specific graphdef id ${h.T()} has encountered an error: ${p}`))))})});sd(g,(h,k)=>d(k));g.start()}
|
|
996
|
+
function vm(a,b,c){const d=new olympe.dc.kc.Vj;let e=!1;const f=olympe.C.Za(),g=b.ph(),h=[];h[g?g.length:0]=(k,l,n,p)=>{f.jd()||f.fb()||(k?b.rh(n)?a.G.warn('Adding the same index twice (should never happen) for sub #',b.T(),', index #',n,', tag #',l):(a.G.debug('ListProcessor: [ID:',b.T(),'] - Adding Instance',l,'to the subscription'),b.Md(n,l)):(a.G.debug('ListProcessor: [ID:',b.T(),'] - Removing Instance',l,'from the subscription'),b.tg(n)),e||(zm(c,()=>{p.pg();wm(c)}),f.run(()=>p.re().zg(b.Hc.bind(b))),
|
|
997
997
|
e=!0),Am(c,n))};if(null!==g)for(let k=g.length-1;0<=k;k--)h[k]=g[k].j(f,c,h[k+1]);return(k,l)=>{const n=b.T();c.register(n,null);const p=d.j(k,l,n,null);if(null!==p)h[0](k,l,n,Bm(p,k,l,n))}}
|
|
998
|
-
olympe.dc.jc.
|
|
998
|
+
olympe.dc.jc.zv=class{constructor(a,b,c,d,e,f){this.G=a;this.db=b;this.D=f||e;this.H=d;this.j=new Map;this.F=new olympe.C.Xb('Legacy ListDef processor')}process(a,b){const c=a.T();var d=this.j.get(c);d||(d=new olympe.dc.jc.Hw(a),this.j.set(c,d));d.counter++;Cm(d)?this.G.debug('ListProcessor: [ID:',c,'] - id already processed'):(this.G.debug('ListProcessor: [ID:',c,'] - NOT processed yet.'),d=a.ef(),b||this.D&&d===olympe.dc.Ia.SERVER||d===olympe.dc.Ia.SELF?(this.G.debug('QueryMGR: [ID:',c,'] - Local subscription, no need for coverage check, booting subscription '),
|
|
999
999
|
um(this,a)):xm(this,a,d,e=>{e?this.G.error(e):um(this,a)},b))}};function Dm(a){return olympe.C.gb(a)?'Node#'+a.Ba.T():String(a)}function Em(a,b){return olympe.C.gb(b)?'{"c":"Parameter","v":"'+a.add(b)+'"}':JSON.stringify(b)}
|
|
1000
|
-
olympe.dc.query
|
|
1001
|
-
olympe.dc.
|
|
1002
|
-
()=>{},olympe.C.
|
|
1003
|
-
0,d=b.length;c<d;c++)this.
|
|
1004
|
-
(this.
|
|
1005
|
-
!0,!0))}else if(e instanceof olympe.dc.aa.Lf)e=a.D(olympe.C.Qa(e.be()),c,e.ph()),b.push(...e);else if(e instanceof olympe.dc.aa.zf||e instanceof olympe.dc.aa.ah){const h=e.F();b=b.map(k=>{for(const l of h){for(const n of l)k=n.recursive?k.ug(n,!0,!0):k.bb(n,!0);k=k.back(l.length)}return k})}return b}};olympe.dc.jc.Subscription.j={INIT:0,
|
|
1006
|
-
olympe.dc.Y.
|
|
1007
|
-
a.toString()).join(',')+')'}};P('olympe.dc.predicates.And',olympe.dc.Y.Nd);olympe.dc.Y.Nd.ya=[olympe.dc.za];olympe.dc.Y.
|
|
1008
|
-
return this.ka().replace(/^.+\./,'')+'('+a.toString()+','+this.value.toString()+')'}};P('olympe.dc.predicates.BitMask',olympe.dc.Y.
|
|
1009
|
-
return'{"c":"'+this.ka()+'","a":['+b+','+c+','+a+']}'}toString(){const a=Dm(this.F);return'Contains('+this.source.toString()+','+this.value.toString()+','+a+')'}};P('olympe.dc.predicates.Contains',olympe.dc.Y.yf);olympe.dc.Y.yf.ya=[olympe.dc.za];olympe.dc.Y.
|
|
1010
|
-
')'}};P('olympe.dc.predicates.Equals',olympe.dc.Y.
|
|
1000
|
+
olympe.dc.query.$v=class{constructor(){this.j=0;this.values=null}add(a){let b;b=olympe.C.gb(a)?'n'+a.Ba.T():'p'+ ++this.j;null===this.values&&(this.values={});this.values[b]=a;return b}get(a){return this.values[a]}clear(){const a=this.values;if(null!==a)for(let b=Object.keys(a),c=b.length,d=0;d<c;d++)delete a[b[d]]}forEach(a){const b=this.values;if(null!==b)for(let c=Object.keys(b),d=c.length,e=0;e<d;e++)a(b[c[e]],c[e])}};olympe.dc.za=class{ka(){}j(){}D(){}fa(){}toString(){}};olympe.dc.jc.Subscription=class a extends olympe.C.Tj{constructor(b,c,d,e){super(olympe.dc.CloudObject,new olympe.C.Xb('context subscription '+b,e));this.id=b;this.hd=c;this.aa=d||null;this.state=this.H.run(()=>olympe.C.fe(olympe.dc.jc.Subscription.j.INIT));this.Gc=!1;this.X=this.Ub=null}static F(b,c,d){let e;try{e=b;if(c)for(let f=0,g=c.length;f<g;f++)e+='|'+c[f].fa(d);else e+='|null';e=olympe.U.rb(e)}catch(f){e=olympe.U.Lc()}return e}T(){return this.id}be(){return this.hd}ph(){return this.aa}ef(){const b=
|
|
1001
|
+
olympe.dc.ee(),c=olympe.C.Qa(this.be());let d;return olympe.dc.CloudObject.instancesRel.Ea(null==(d=this.aa)?void 0:d[0])?b.fromModel(c):b.pe(c)}Pf(){const b=olympe.C.Qa(this.state);return b&&b.valueOf()>=olympe.dc.jc.Subscription.j.Sr}mi(){if(this.state.Ba.fb())throw Error(`Cannot set destroyed subscription '${this.id}' as subscribed`);const b=this.Ub;this.Ub=null;for(let c in b)if(Object.prototype.hasOwnProperty.call(b,c))b[c](this);kc(this.state,olympe.C.fe(olympe.dc.jc.Subscription.j.Sr))}Fd(){return olympe.C.sa([this.state],
|
|
1002
|
+
()=>{},olympe.C.da)}N(){const b=this.state.Ba.Eb;return b&&b.valueOf()>=olympe.dc.jc.Subscription.j.Vh}kd(b,c){this.N()?b(this):(null===this.X&&(this.X=new Map),void 0===c&&(c=olympe.U.Lc()),this.X.set(c,olympe.C.Za().rc(b)));return c||''}ul(b){null!==this.X&&b&&this.X.delete(b)}vb(){const b=olympe.dc.jc.Subscription.j.Vh;if(!this.state.Ba.fb()&&olympe.C.Qa(this.state)!==b&&(this.Nf(),kc(this.state,b),null!==this.X)){for(const c of this.X.values())c(this);this.X=null}}onDestroy(b){this.H.onDestroy(b)}release(){this.H.destroy()}Hc(b){if(!this.state.Ba.fb()){for(let c=
|
|
1003
|
+
0,d=b.length;c<d;c++)this.mn(b[c],c);if(this.N())this.Nf();else{this.Gc=b=!0;for(let c in this.D)if(Object.prototype.hasOwnProperty.call(this.D,c)&&!Object.prototype.hasOwnProperty.call(this.values,c)){b=!1;break}b&&this.vb()}}}Md(b,c){if(!this.state.Ba.fb()&&(this.al(b,olympe.dc.CloudObject.get(c)),b=this.N(),this.Gc&&!b)){b=!0;for(let d in this.D)if(Object.prototype.hasOwnProperty.call(this.D,d)&&!Object.prototype.hasOwnProperty.call(this.values,d)){b=!1;break}b&&this.vb()}}tg(b){this.state.Ba.fb()||
|
|
1004
|
+
(this.ln(b),this.pj(b,!this.N()))}Lg(){return this.N()?super.Lg():'Subscription is not ready!'}ke(b){const c=olympe.C.Qa(this.be());return olympe.dc.jc.Subscription.D(c,b,this.ph())}static D(b,c,d){var e=olympe.dc.la.from(b,c).me();if(null===d)return[e];b=[];b.push(e);for(let f=0,g=d.length;f<g;f++)if(e=d[f],e instanceof olympe.dc.aa.$e){const h=olympe.dc.query.Relation.from(e);b=b.map(k=>k.bb(h,!0))}else if(e instanceof olympe.dc.aa.Le){const h=olympe.dc.query.Relation.from(e);b=b.map(k=>k.ug(h,
|
|
1005
|
+
!0,!0))}else if(e instanceof olympe.dc.aa.Lf)e=a.D(olympe.C.Qa(e.be()),c,e.ph()),b.push(...e);else if(e instanceof olympe.dc.aa.zf||e instanceof olympe.dc.aa.ah){const h=e.F();b=b.map(k=>{for(const l of h){for(const n of l)k=n.recursive?k.ug(n,!0,!0):k.bb(n,!0);k=k.back(l.length)}return k})}return b}};olympe.dc.jc.Subscription.j={INIT:0,Sr:1,Vh:2};olympe.dc.jc.Subscription.prototype.Lg.K=olympe.C.J.j;function Cm(a){const b=a.D;a.D=!0;return b}olympe.dc.jc.Hw=class{constructor(a){this.counter=0;this.D=!1;this.j=a}};olympe.dc.Kf=class{ka(){}Mb(){}j(){}fa(){}toString(){}};olympe.dc.jr=class{F(){}};olympe.dc.Yk=class{ka(){}getValue(){}j(){}fa(){}toString(){}};olympe.dc.wc={};let Fm=0;olympe.dc.wc.Bg=class{constructor(){this.id=Fm++}ka(){return'CustomLocalComparator#'+Fm}H(){return[]}F(){throw Error('GetComparedValue function was not implemented.');}compare(){throw Error('Compare function was not implemented.');}fa(){return`{"c":"${this.ka()}"}`}toString(){return this.ka()+'()'}};olympe.dc.wc.Bg.ya=[olympe.dc.xf];olympe.dc.wc.DateTime=class{constructor(a){this.j=a}ka(){return Q(olympe.dc.wc.DateTime)}H(){return this.j.j()}F(a,b){return this.j.getValue(a,b)}compare(a,b){if(!a)return b?-1:0;if(!b)return 1;a=a.getTime();b=b.getTime();return a!==b?a>b?1:-1:0}fa(a){return'{"c":"'+this.ka()+'",a:['+this.j.fa(a)+']}'}toString(){return'Number('+this.j.toString()+')'}};P('olympe.dc.comparators.DateTime',olympe.dc.wc.DateTime);olympe.dc.wc.DateTime.ya=[olympe.dc.xf];olympe.dc.wc.Number=class{constructor(a){this.j=a}ka(){return Q(olympe.dc.wc.Number)}H(){return this.j.j()}F(a,b){return this.j.getValue(a,b)}compare(a,b){return a!==b?a>b?1:-1:0}fa(a){return`{"c":"${this.ka()}",a:[${this.j.fa(a)}]}`}toString(){return`Number(${this.j.toString()})`}};P('olympe.dc.comparators.Number',olympe.dc.wc.Number);olympe.dc.wc.Number.ya=[olympe.dc.xf];olympe.dc.wc.String=class{constructor(a){this.j=a}ka(){return Q(olympe.dc.wc.String)}H(){return this.j.j()}F(a,b){return olympe.C.sa([this.j.getValue(a,b)],c=>c.toLowerCase(),olympe.C.Sa)}compare(a,b){return void 0===a?void 0===b?0:1:a!==b?a>b?1:-1:0}fa(a){return`{"c":"${this.ka()}",a:[${this.j.fa(a)}]}`}toString(){return`String(${this.j.toString()})`}};P('olympe.dc.comparators.String',olympe.dc.wc.String);olympe.dc.wc.String.ya=[olympe.dc.xf];olympe.dc.Y={};let Gm=0;olympe.dc.Y.Bg=class{constructor(){this.id=Gm++}ka(){return'CustomLocalPredicate#'+this.id}D(){return[]}j(){throw Error('Test function was not implemented.');}fa(){return`{"c":"${this.ka()}"}`}toString(){return this.ka()+'()'}};olympe.dc.Y.Bg.ya=[olympe.dc.za];olympe.dc.Y.Hl=class{constructor(a,b){this.F=a;this.H=b}ka(){}D(){return[this.F.j(),this.H.j()]}j(a,b){return a.run(()=>olympe.C.sa([this.F.getValue(a,b),this.H.getValue(a,b)],(c,d)=>{c=c.valueOf();d=d.valueOf();return olympe.C.Rb(this.N('string'===typeof c?c:Number(c),'string'===typeof d?d:Number(d)))},olympe.C.da))}N(){}fa(a){return'{"c":"'+this.ka()+'","a":['+this.F.fa(a)+','+this.H.fa(a)+']}'}toString(){return this.ka().replace(/^.+\./,'')+'('+this.F.toString()+','+this.H.toString()+')'}};
|
|
1006
|
+
olympe.dc.Y.Hl.ya=[olympe.dc.za];olympe.dc.Y.Nd=class{constructor(a){this.Y=[];for(let b=arguments.length,c=0;c<b;c++)Array.isArray(arguments[c])?this.Y=this.Y.concat(arguments[c]):this.Y.push(arguments[c])}ka(){return Q(olympe.dc.Y.Nd)}D(){return this.Y.reduce((a,b)=>a.concat(b.D()),[])}j(a,b){return a.run(()=>olympe.C.sa(this.Y.map(c=>c.j(a,b)),(...c)=>olympe.C.Rb(c.every(d=>d.valueOf())),olympe.C.da))}fa(a){const b=this.Y.map(c=>c.fa(a));return'{"c":"'+this.ka()+'","a":['+b.join(',')+']}'}toString(){return'And('+this.Y.map(a=>
|
|
1007
|
+
a.toString()).join(',')+')'}};P('olympe.dc.predicates.And',olympe.dc.Y.Nd);olympe.dc.Y.Nd.ya=[olympe.dc.za];olympe.dc.Y.Nl=class{constructor(a,b){this.F=a;this.value=b}j(a,b){return a.run(()=>olympe.C.sa([this.F,this.value.getValue(a,b)],(c,d)=>{c=c.valueOf();return olympe.C.Rb((Number(c)&Number(d.valueOf()))===Number(c))},olympe.C.da))}ka(){return Q(olympe.dc.Y.Nl)}D(){return[this.value.j()]}fa(a){const b=olympe.C.gb(this.F)?this.F.Ba.Eb.valueOf():this.F.valueOf();return'{"c":"'+this.ka()+'","a":['+b+','+this.value.fa(a)+']}'}toString(){const a=olympe.C.gb(this.F)?this.F.Ba.Eb.valueOf():this.F.valueOf();
|
|
1008
|
+
return this.ka().replace(/^.+\./,'')+'('+a.toString()+','+this.value.toString()+')'}};P('olympe.dc.predicates.BitMask',olympe.dc.Y.Nl);olympe.dc.Y.Nl.ya=[olympe.dc.za];olympe.dc.Y.yf=class{constructor(a,b,c){this.source=a;this.value=b;this.F=c?c:!1}ka(){return Q(olympe.dc.Y.yf)}D(){return[this.source.j(),this.value.j()]}jb(){return this.source}getValue(){return this.value}j(a,b){return a.run(()=>olympe.C.sa([this.source.getValue(a,b),this.value.getValue(a,b),this.F],(c,d,e)=>{c=String(c);d=String(d);e.valueOf()||(c=c.toLowerCase(),d=d.toLowerCase());return olympe.C.Rb(c.includes(d))},olympe.C.da))}fa(a){const b=this.source.fa(a),c=this.value.fa(a);a=Em(a,this.F);
|
|
1009
|
+
return'{"c":"'+this.ka()+'","a":['+b+','+c+','+a+']}'}toString(){const a=Dm(this.F);return'Contains('+this.source.toString()+','+this.value.toString()+','+a+')'}};P('olympe.dc.predicates.Contains',olympe.dc.Y.yf);olympe.dc.Y.yf.ya=[olympe.dc.za];olympe.dc.Y.Ce=class{constructor(a,b){this.F=a;this.H=b}ka(){return Q(olympe.dc.Y.Ce)}D(){return[this.F.j(),this.H.j()]}j(a,b){return a.run(()=>olympe.C.sa([this.F.getValue(a,b),this.H.getValue(a,b)],(c,d)=>'object'===typeof c&&void 0!==c.Jd?c.Jd(d):'object'===typeof d&&void 0!==d.Jd?d.Jd(c):olympe.C.Rb(c.valueOf()===d.valueOf()),olympe.C.da,'Test equal predicate'))}fa(a){return'{"c":"'+this.ka()+'","a":['+this.F.fa(a)+','+this.H.fa(a)+']}'}toString(){return'Equals('+this.F.toString()+','+this.H.toString()+
|
|
1010
|
+
')'}};P('olympe.dc.predicates.Equals',olympe.dc.Y.Ce);olympe.dc.Y.Ce.ya=[olympe.dc.za];olympe.dc.Y.ou=class extends olympe.dc.Y.Ce{constructor(a,b){super(a,new olympe.dc.ab.We(b))}};olympe.dc.Y.ou.ya=[olympe.dc.za];olympe.dc.Y.mk=class extends olympe.dc.Y.Hl{constructor(a,b){super(a,b)}ka(){return Q(olympe.dc.Y.mk)}N(a,b){return a>b}};P('olympe.dc.predicates.Greater',olympe.dc.Y.mk);olympe.dc.Y.Ri=class{constructor(a,b,c){this.ob=[];this.F=c instanceof Array?c:void 0!==c?[olympe.dc.ea(c)]:[];a=Array.isArray(a)?a:[a];for(let d=0,e=a.length;d<e;d++)c=a[d],c instanceof olympe.dc.aa.Le?this.ob.push(new Hm(c.W(),c.La(),c.F,c.D)):this.ob.push(new Hm(olympe.dc.ea(c),b[d],1,1))}ka(){return Q(olympe.dc.Y.Ri)}D(){return[this.ob.reduce((a,b)=>a.concat(b),[])]}j(a,b){const c=a.run(()=>lc(olympe.C.bc(Boolean),!1)),d=olympe.U.Lc(),e=olympe.dc.ha();let f=0;a=(h,k)=>{0!==this.F.length&&!this.F.includes(k)||
|
|
1011
1011
|
c.getContext().fb()||c.getContext().jd()||(f+=h?1:-1,c.update(0<f))};const g=this.ob;for(let h=g.length-1;0<=h;h--)a=Im(g[h],e,a,d+h);Pf(e,b,a,d);c.getContext().onDestroy(()=>{Nf(e,b,d)});return c.tb()}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(this.ob.map(a=>a.fa()))+(0!==this.F.length?',"'+this.F.toString():'')+'"]}'}toString(){return'HasRelated('+(0!==this.F.length?'#'+this.F.toString()+', ':'')+this.ob.map(a=>a.fa())+')'}};P('olympe.dc.predicates.HasRelated',olympe.dc.Y.Ri);
|
|
1012
|
-
function Im(a,b,c,d){const e=Object.create(null);d+=olympe.U.ni();const f=(g,h,k)=>{k>=a.D&&c(g,h);if(!(0<=a.j&&k>=a.j)){var l=d+k;g?e[h]||(e[h]=!0,T(b,h,a,(n,p)=>{f(n,p,k+1)},l)):(delete e[h],b.D(h,a,l))}};return(g,h)=>f(g,h,0)}class Hm extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.D=c;this.j=d}fa(){return`${this.W()}, ${this.La()}, ${this.D}, ${this.j}`}}olympe.dc.Y.Ri.ya=[olympe.dc.za];olympe.dc.Y.
|
|
1013
|
-
const g=this.ob;for(let k=g.length-1;0<=k;k--)f=Km(g[k],d,f,e+k);let h=0;Pf(d,b,f.bind(null,k=>{c.getContext().jd()||c.getContext().fb()||(h+=k,c.update(0<h))}),e);a.onDestroy(()=>Nf(d,b,e));return c.tb()}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(this.ob.map(a=>a.fa()))+(null!==this.F?',"'+this.F.toString():'')+'"]}'}toString(){return'HasRelatedTree('+(null!==this.F?'#['+this.F.toString()+'], ':'')+this.ob.map(a=>a.fa())+')'}};P('olympe.dc.predicates.HasRelatedTree',olympe.dc.Y.
|
|
1012
|
+
function Im(a,b,c,d){const e=Object.create(null);d+=olympe.U.ni();const f=(g,h,k)=>{k>=a.D&&c(g,h);if(!(0<=a.j&&k>=a.j)){var l=d+k;g?e[h]||(e[h]=!0,T(b,h,a,(n,p)=>{f(n,p,k+1)},l)):(delete e[h],b.D(h,a,l))}};return(g,h)=>f(g,h,0)}class Hm extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.D=c;this.j=d}fa(){return`${this.W()}, ${this.La()}, ${this.D}, ${this.j}`}}olympe.dc.Y.Ri.ya=[olympe.dc.za];olympe.dc.Y.sm=class{constructor(a,b,c){this.ob=[];this.F=void 0!==c?c.map(olympe.dc.ea):null;a=Array.isArray(a)?a:[a];for(let d=0,e=a.length;d<e;d++)c=a[d],c instanceof olympe.dc.aa.Le?this.ob.push(new Jm(c.W(),c.La(),c.F,c.D)):this.ob.push(new Jm(olympe.dc.ea(c),b[d],1,1))}ka(){return Q(olympe.dc.Y.sm)}D(){return[this.ob.reduce((a,b)=>a.concat(b),[])]}j(a,b){const c=a.run(()=>lc(olympe.C.bc(Boolean),!1)),d=olympe.dc.ha(),e=olympe.U.ni();let f=(k,l,n)=>{l&&(null===this.F||this.F.includes(n))&&k(1)};
|
|
1013
|
+
const g=this.ob;for(let k=g.length-1;0<=k;k--)f=Km(g[k],d,f,e+k);let h=0;Pf(d,b,f.bind(null,k=>{c.getContext().jd()||c.getContext().fb()||(h+=k,c.update(0<h))}),e);a.onDestroy(()=>Nf(d,b,e));return c.tb()}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(this.ob.map(a=>a.fa()))+(null!==this.F?',"'+this.F.toString():'')+'"]}'}toString(){return'HasRelatedTree('+(null!==this.F?'#['+this.F.toString()+'], ':'')+this.ob.map(a=>a.fa())+')'}};P('olympe.dc.predicates.HasRelatedTree',olympe.dc.Y.sm);
|
|
1014
1014
|
function Km(a,b,c,d){const e=a.F,f=a.N,g=new Set,h=(l,n,p)=>{f.has(n)?f.get(n).set(d+p,l):f.set(n,(new Map).set(d+p,l))},k=(l,n,p,q,r)=>{const t=olympe.U.ni();if(q){const v=p+r,x=y=>{const z=f.get(r);if(g.has(v))throw Error(`Try to use the predicate HasRelatedTree with recursion in a graph cluster containing a loop around instances ${p} and ${r}`);void 0!==z&&null!==z&&(g.add(v),e.set(r,(e.get(r)||0)+y),Array.from(z.values()).forEach(A=>A(y)));g.delete(v)};h(l,r,p);e.has(r)?l(e.get(r)):(n>=a.D&&c(y=>
|
|
1015
|
-
{e.set(r,(e.get(r)||0)+y);l(y)},q,r),(0>a.j||n<=a.j)&&r!==p&&T(b,r,a,k.bind(a,x,n+1,r),t))}else l(-e.get(r)),f.get(r).delete(d+p),0===f.get(r).size&&(e.delete(r),f.delete(r),b.D(r,a,t))};return(l,n,p)=>k(l,0,'origin',n,p)}class Jm extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.D=c;this.j=d;this.N=new Map;this.F=new Map}fa(){return`${this.W()}, ${this.La()}, ${this.D}, ${this.j}`}}olympe.dc.Y.
|
|
1016
|
-
this.F.has(k)?(c.update(olympe.C.
|
|
1017
|
-
P('olympe.dc.predicates.InstanceOf',olympe.dc.Y.Ui);olympe.dc.Y.Ui.ya=[olympe.dc.za];olympe.dc.Y.
|
|
1018
|
-
')'}};P('olympe.dc.predicates.Or',olympe.dc.Y.
|
|
1019
|
-
']}'}toString(){const a=Dm(this.F);return'Regex('+this.source.toString()+','+this.H+','+a+')'}};P('olympe.dc.predicates.Regex',olympe.dc.Y.Hf);olympe.dc.Y.Hf.ya=[olympe.dc.za];olympe.dc.Y.
|
|
1020
|
-
(0<=this.D?Mm(Nm(this.H,this.D),a):a.push(this.R));this.Z(a)}}zg(a){this.Z=a}};olympe.dc.kc.Vj.ya=[olympe.dc.kc.Ta];function Bm(a,b,c,d){b?a.N[d]=c:delete a.N[d];null===a.D&&(a.D=new olympe.dc.kc.gk(a.j,a));return a.D}function Nm(a,b){for(let c=0;c<b;c++)if(null!==a.D)a=a.D;else break;return a}function Mm(a,b){a=a.N;if(null!==a)for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c)}olympe.dc.kc.gk=class{constructor(a,b){this.j=a;this.depth=b?b.depth+1:0;this.N=Object.create(null);this.D=null}
|
|
1021
|
-
function Pm(a,b,c,d,e){const f=Object.create(null),g=a.ia,h=a.H;let k,l,n;a.
|
|
1022
|
-
olympe.dc.kc.
|
|
1023
|
-
e.F&&Mm(e.F,this.R)}}this.Z&&this.Z(this.R)}}zg(a){this.Z=a}j(a,b,c){let d=this.H[c];a?void 0===d?(d=new Om(this,c,b),this.H[c]=d):(d.tag=b,d.X=!1):void 0!==d&&(d.X=!0);return d}};olympe.dc.kc.
|
|
1015
|
+
{e.set(r,(e.get(r)||0)+y);l(y)},q,r),(0>a.j||n<=a.j)&&r!==p&&T(b,r,a,k.bind(a,x,n+1,r),t))}else l(-e.get(r)),f.get(r).delete(d+p),0===f.get(r).size&&(e.delete(r),f.delete(r),b.D(r,a,t))};return(l,n,p)=>k(l,0,'origin',n,p)}class Jm extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.D=c;this.j=d;this.N=new Map;this.F=new Map}fa(){return`${this.W()}, ${this.La()}, ${this.D}, ${this.j}`}}olympe.dc.Y.sm.ya=[olympe.dc.za];olympe.dc.Y.Ui=class{constructor(a){this.F=new Set;a instanceof Array?a.forEach(b=>{this.F.add(olympe.dc.ea(b))}):this.F.add(olympe.dc.ea(a))}ka(){return Q(olympe.dc.Y.Ui)}D(){return[]}j(a,b){const c=a.run(()=>lc(olympe.C.bc(olympe.C.da),olympe.C.da.j)),d=olympe.dc.ha();let e=[];const f=()=>{e.forEach(h=>{d.D(h.tag,h.relation,h.id)});e=[]},g=(h,k)=>{if(h)if(k===olympe.dc.ea(olympe.dc.CloudObject))c.update(olympe.C.Rb(this.F.has(k))),f();else{for(const l of e)if(l.tag===k)throw Error(`You should never extend a model to itself (${k})`);
|
|
1016
|
+
this.F.has(k)?(c.update(olympe.C.da.D),f()):(h=new Lm(k,olympe.dc.CloudObject.extendRel),e.push(h),T(d,h.tag,h.relation,g,h.id))}};a=new Lm(b,olympe.dc.CloudObject.modelRel);e.push(a);T(d,a.tag,a.relation,g,a.id);c.getContext().onDestroy(f);return c.tb()}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(Array.from(this.F))+']}'}toString(){return'InstanceOf('+Array.from(this.F).join(', ')+')'}};class Lm{constructor(a,b){this.tag=a;this.relation=b;this.id=olympe.U.ni()}}
|
|
1017
|
+
P('olympe.dc.predicates.InstanceOf',olympe.dc.Y.Ui);olympe.dc.Y.Ui.ya=[olympe.dc.za];olympe.dc.Y.ie=class{constructor(a){this.F=a}ka(){return Q(olympe.dc.Y.ie)}D(){return this.F.D()}j(a,b){return a.run(()=>olympe.C.sa([this.F.j(a,b)],c=>olympe.C.Rb(!c.valueOf()),olympe.C.da))}fa(a){return`{"c":"${this.ka()}","a":[${this.F.fa(a)}]}`}toString(){return'Not('+this.F.toString()+')'}};P('olympe.dc.predicates.Not',olympe.dc.Y.ie);olympe.dc.Y.ie.ya=[olympe.dc.za];olympe.dc.Y.Ge=class{constructor(a){this.Y=[];for(let b=arguments.length,c=0;c<b;c++)Array.isArray(arguments[c])?this.Y=this.Y.concat(arguments[c]):this.Y.push(arguments[c])}ka(){return Q(olympe.dc.Y.Ge)}D(){return this.Y.reduce((a,b)=>a.concat(b.D()),[])}j(a,b){return a.run(()=>olympe.C.sa(this.Y.map(c=>c.j(a,b)),(...c)=>olympe.C.Rb(c.some(d=>d.valueOf())),olympe.C.da))}fa(a){const b=this.Y.map(c=>c.fa(a));return'{"c":"'+this.ka()+'","a":['+b.join(',')+']}'}toString(){return'Or('+this.Y.map(a=>a.toString()).join(',')+
|
|
1018
|
+
')'}};P('olympe.dc.predicates.Or',olympe.dc.Y.Ge);olympe.dc.Y.Ge.ya=[olympe.dc.za];olympe.dc.Y.Hf=class{constructor(a,b,c){this.source=a;this.H=b;this.F=void 0===c?!0:c}ka(){return Q(olympe.dc.Y.Hf)}D(){return[this.source.j()]}jb(){return this.source}j(a,b){return a.run(()=>olympe.C.sa([this.source.getValue(a,b),this.H,this.F],(c,d,e)=>{c=String(c);d=String(d);e.valueOf()||(c=c.toLowerCase(),d=d.toLowerCase());return olympe.C.Rb((new RegExp(d)).test(c))},olympe.C.da))}fa(a){const b=this.source.fa(a),c=Em(a,this.H);a=Em(a,this.F);return'{"c":"'+this.ka()+'","a":['+b+','+c+','+a+
|
|
1019
|
+
']}'}toString(){const a=Dm(this.F);return'Regex('+this.source.toString()+','+this.H+','+a+')'}};P('olympe.dc.predicates.Regex',olympe.dc.Y.Hf);olympe.dc.Y.Hf.ya=[olympe.dc.za];olympe.dc.Y.Rk=class extends olympe.dc.Y.Hl{constructor(a,b){super(a,b)}ka(){return Q(olympe.dc.Y.Rk)}N(a,b){return a<b}};P('olympe.dc.predicates.Smaller',olympe.dc.Y.Rk);olympe.dc.kc={};olympe.dc.kc.Vj=class{constructor(){this.Z=this.H=this.R=this.D=null}N(){return null!==this.D}X(a){if(null!==this.D)throw Error('Manager already activated (depth='+this.D+')');this.D=a;this.F()}j(a,b,c){b=this.H;if(a&&null!==b)throw Error('The AutoManger handles only a single item.');a?(b=new olympe.dc.kc.gk(this),this.R=c,this.H=b):this.H=this.R=null;return b}F(){if(null===this.D)throw Error('Manager not activated, need to set a depth before updating ranks');if(null!==this.Z){const a=[];null!==this.H&&
|
|
1020
|
+
(0<=this.D?Mm(Nm(this.H,this.D),a):a.push(this.R));this.Z(a)}}zg(a){this.Z=a}};olympe.dc.kc.Vj.ya=[olympe.dc.kc.Ta];function Bm(a,b,c,d){b?a.N[d]=c:delete a.N[d];null===a.D&&(a.D=new olympe.dc.kc.gk(a.j,a));return a.D}function Nm(a,b){for(let c=0;c<b;c++)if(null!==a.D)a=a.D;else break;return a}function Mm(a,b){a=a.N;if(null!==a)for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c)}olympe.dc.kc.gk=class{constructor(a,b){this.j=a;this.depth=b?b.depth+1:0;this.N=Object.create(null);this.D=null}re(){return this.j}pg(){this.j.N()?this.j.F():this.j.X(this.depth-1)}};class Om extends olympe.dc.kc.gk{constructor(a,b,c){super(a);this.R=b;this.tag=c;this.Z=this.X=this.H=!1;this.F=null}}
|
|
1021
|
+
function Pm(a,b,c,d,e){const f=Object.create(null),g=a.ia,h=a.H;let k,l,n;a.ba=!0;l=0;for(n=g.length;l<n;l++)f[g[l]]=null;g.length=0;l=c;for(n=Math.min(b.length,d);l<n;l++)k=b[l],c=h[k],void 0!==c&&(delete f[k],g.push(k),c.H||(c.H=!0,e(!0,c.tag,c.R,c)));for(k in f)Object.prototype.hasOwnProperty.call(f,k)&&(c=h[k],c.H&&(c.H=!1,e(!1,c.tag,c.R,c)),c.X&&(c.F=null,delete h[k]),delete f[k]);a.ba=!1;null!==a.D&&a.F()}
|
|
1022
|
+
olympe.dc.kc.Dm=class{constructor(){this.H={};this.ia=[];this.D=null;this.ba=!1;this.R=[];this.Z=null}N(){return null!==this.D}X(a){if(null!==this.D)throw Error('Manager already activated (depth='+this.D+')');this.D=a;this.F()}F(){if(null===this.D)throw Error('Manager not activated, need to set a depth before updating ranks');if(!this.ba){var a=this.ia,b=a.length,c=this.H,d;for(d=this.R.length=0;d<b;d++){var e=c[a[d]];if(0>this.D)this.R.push(e.R);else{if(!e.Z){var f=e,g=this.D;f.Z=!0;f.F=Nm(f,g)}null!==
|
|
1023
|
+
e.F&&Mm(e.F,this.R)}}this.Z&&this.Z(this.R)}}zg(a){this.Z=a}j(a,b,c){let d=this.H[c];a?void 0===d?(d=new Om(this,c,b),this.H[c]=d):(d.tag=b,d.X=!1):void 0!==d&&(d.X=!0);return d}};olympe.dc.kc.Dm.ya=[olympe.dc.kc.Ta];olympe.dc.kc.Ta=class{constructor(){}j(){}N(){}X(){}F(){}zg(){}};function Qm(a,b){olympe.C.pf(a.value)?(a.node=olympe.C.Vn(a.value,b),Sb(a.node)||b()):b()}function Rm(a,b){if(olympe.C.pf(a.value)){const c=olympe.C.Za(),d=a.H;olympe.C.Wc([a.value],e=>{d!==e.valueOf()&&(c.run(()=>Qm(a,b)),olympe.C.Za().destroy())})}}
|
|
1024
1024
|
class Sm extends olympe.dc.kc.gk{constructor(a,b,c){super(a);this.X=b;this.value=c;this.H=this.Qa();this.position=this.node=null;this.R=!1;this.F=null}Qa(){const a=olympe.C.Qa(this.value);return a?a.valueOf():a}destroy(){this.node&&(this.node.destroy(),this.node=null);this.F=this.value=null}fb(){return null===this.value}}
|
|
1025
1025
|
function Tm(a,b){if(!b.fb()){var c=a.D;var d=a.ia,e=b.Qa(),f=0;let g=c.length,h=0,k;for(null!==b.position&&--g;g>f;){h=Math.floor((f+g)/2);k=d(c[h].H,e);if(0===k||2>g-f){0>k&&null!==b.position&&b.position<=h&&(k=d(c[g].H,e));h=0>k?g:h;break}0>k?f=h:g=h}c=h;b.H=b.Qa();if(c!==b.position){d=a.D;e=d.length;f=b.position;null===f&&(f=e);if(c<f)for(e=f;e>c;e--)d[e]=d[e-1],d[e].position=e;else for(e=f;e<c;e++)d[e]=d[e+1],d[e].position=e;d[c]=b;d[c].position=c;b.R&&a.F()}}}
|
|
1026
1026
|
function Um(a){const b=a.ia;a.D.sort((c,d)=>b(c.Qa(),d.Qa()))}
|
|
1027
|
-
olympe.dc.kc
|
|
1027
|
+
olympe.dc.kc.Wr=class{constructor(a){this.ia=a;this.H=null;this.D=[];this.R=[];this.Z=null;this.ba=new Map}j(a,b,c,d){b='$'+c;const e=this.D;let f;if(a)f=new Sm(this,c,d),this.ba.set(b,f),this.N()?Qm(f,()=>Tm(this,f)):(f.position=e.length,e.push(f));else{f=this.ba.get(b);if(void 0===f)throw Error('Trying to remove an non-registered item: "'+c+'"');this.ba.delete(b);null!==f.position&&(this.N()?this.remove(f):delete e[f.position]);f.destroy()}return f}N(){return null!==this.H}X(a){if(null!==this.H)throw Error('Manager already activated (depth='+
|
|
1028
1028
|
this.H+')');this.H=a;Um(this);for(let b=0,c=this.D.length;b<c;b++){const d=this.D[b];d.position=b;Rm(d,()=>Tm(this,d))}this.F()}F(){if(null===this.H)throw Error('Manager not activated, need to set a depth before updating ranks');const a=this.D.length;this.R.length=0;for(let d=0;d<a;d++){let e=this.D[d];if(!e.R){var b=e,c=this.H;b.R=!0;b.F=Nm(b,c)}0>this.H?this.R.push(e.X):e.F&&Mm(e.F,this.R)}this.Z&&this.Z(this.R)}zg(a){this.Z=a}remove(a){const b=this.D,c=b.length-1;if(null!==a.position){for(a=a.position;a<
|
|
1029
|
-
c;a++)b[a]=b[a+1],b[a].position=a;b.length=c}}};olympe.dc.kc
|
|
1029
|
+
c;a++)b[a]=b[a+1],b[a].position=a;b.length=c}}};olympe.dc.kc.Wr.ya=[olympe.dc.kc.Ta];function wm(a){if(!a.D){for(let b in a.F)Vm(a.F[b]);a.D=!0}a.H=null;a.N=null}function zm(a,b,c){a.F[c||'root'].R=b}function Am(a,b,c){a.F[c||'root'].pg(b)}function Wm(a,b,c,d){const e=a.N,f=b+d+c;let g=e[f];void 0===g&&(g=wh(a.db,b,c,d),e[f]=g);return g}function Xm(a,b){a.D||a.j.pg(b)}function Ym(a,b,c,d,e){if(!a.D){let f=Wm(a,c,d,e||olympe.dc.ta.DESTINATION);e||(f+=Wm(a,c,d,olympe.dc.ta.ORIGIN));0===f&&Xm(a,b)}}
|
|
1030
1030
|
function Zm(a,b){const c=a.F[b];void 0!==c?(a.G&&a.G.debug('Set current block to',b,null!==c.F?'parent = '+c.F.T():''),a.j=c):a.G&&a.G.error('Try to set a block that does not exists:',b)}function $m(a){const b=String(++a.R),c=a.j;a.F[b]=new an(b,c);bn(c,b);c.H||(c.H=()=>Zm(a,c.T()));return b}function cn(a,b){const c=a.j;a.j.H=()=>{Zm(a,c.T());b()}}function dn(a,b){Vm(b?a.F[b]:a.j)}
|
|
1031
|
-
olympe.dc.kc.
|
|
1032
|
-
class an{constructor(a,b){this.id=a;this.F=b||null;this.j=this.R=this.H=this.D=null;this.N=!1}T(){return this.id}pg(a){const b=this.R;if(this.N||this.j===a||null===a)b&&b(),!b&&Vm(this)}notify(a){const b=this.H,c=this.D;if(this.N)b&&b();else if(!c[a]){a=c[a]=!0;for(let d in c)if(!c[d]){a=!1;break}a&&b&&b()}}};olympe.dc.ab={};function en(a,b,c,d){const e=olympe.dc.
|
|
1033
|
-
function fn(a,b,c){const d=c.getContext(),e=olympe.dc.
|
|
1034
|
-
olympe.dc.ab.Di=class{constructor(a,b,c){this.H=a&&a.W?a.W():a;this.aa=b&&b.filter(d=>d instanceof olympe.dc.aa
|
|
1035
|
-
b=this.D||b;null!==this.aa?en(a,b,this.aa,d=>{fn(this,d,c)}):fn(this,b,c);return c.tb()}fa(a){const b=Em(a,this.H),c=Em(a,this.D);let d='null';this.aa&&(d=this.aa.map(function(e){return e.fa(a)}).join(','));return`{"c":"${this.ka()}","a":["${b}",${d},${c}]}`}toString(){const a=Dm(this.H),b=this.D?','+Dm(this.D):'';let c='';this.aa&&(c=','+this.aa.join(','));return this.ka().replace(/^.+\./,'')+'('+a+c+b+')'}};olympe.dc.ab.Di.ya=[olympe.dc.
|
|
1036
|
-
b);break;case olympe.dm.Boolean.O.W():d=new olympe.dc.ab.Wj(c,b);break;case olympe.dm.DateTime.O.W():d=new olympe.dc.ab.Ji(c,b)}this.D=d}ka(){return this.D.ka()}j(){return this.D.j()}getValue(a,b){return this.D.getValue(a,b)}fa(a){return this.D.fa(a)}toString(){return this.D.toString()}};olympe.dc.ab.
|
|
1037
|
-
d(g,h,k,!1),delete e[h]}}fa(a){return'{"c":"'+this.ka()+'","a":['+this.D.fa(a)+']}'}toString(){return'Filter('+this.D.toString()+')'}};P('olympe.dc.transformers.Filter',olympe.dc.aa.zf);olympe.dc.aa.zf.ya=[olympe.dc.Kf,olympe.dc.
|
|
1038
|
-
v,x,f,g);c(!0,z,A,K)},y.
|
|
1039
|
-
'","'+this.F.toString()+'"]}'}toString(){return'FirstRelated('+this.D.toString()+', '+this.F.toString()+')'}};P('olympe.dc.transformers.FirstRelated',olympe.dc.aa.
|
|
1040
|
-
|
|
1041
|
-
olympe.dc.aa.
|
|
1042
|
-
{d.D(g,l,h)})}}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(gn(this))+',"'+this.direction+'"]}'}toString(){return'MultiRelated('+this.La()+'['+gn(this).join(',')+'])'}};P('olympe.dc.transformers.MultiRelated',olympe.dc.aa.
|
|
1031
|
+
olympe.dc.kc.Yr=class{constructor(a,b){this.db=a;this.G=b||null;this.H=Object.create(null);this.N=Object.create(null);this.D=!1;this.R=0;this.j=new an('root');this.F=Object.create(null);this.F.root=this.j}register(a,b,c,d,e){this.D||(null!==b&&c&&d&&e?(c=Wm(this,c,d,e),d=this.H[b]||0,this.H[b]=++d,this.j.j===b&&c<=d&&(this.j.j=a)):this.j.j=a)}};function bn(a,b){null===a.D&&(a.D=Object.create(null));a.D[b]=!1}function Vm(a){a.N=!0;null!==a.F&&a.F.notify(a.id)}
|
|
1032
|
+
class an{constructor(a,b){this.id=a;this.F=b||null;this.j=this.R=this.H=this.D=null;this.N=!1}T(){return this.id}pg(a){const b=this.R;if(this.N||this.j===a||null===a)b&&b(),!b&&Vm(this)}notify(a){const b=this.H,c=this.D;if(this.N)b&&b();else if(!c[a]){a=c[a]=!0;for(let d in c)if(!c[d]){a=!1;break}a&&b&&b()}}};olympe.dc.ab={};function en(a,b,c,d){const e=olympe.dc.ha(),f=new olympe.dc.kc.Vj,g=new olympe.dc.kc.Yr(e);let h=!1;const k=Object.create(null),l=q=>{if(0<q.length)for(const r in k)q[0]===r&&d(k[r])};let n=(q,r,t,v)=>{a.jd()||a.fb()||(h||(zm(g,()=>{v.pg();wm(g)}),v.re().zg(l),h=!0),q?k[t]=r:delete k[t],Am(g,t))};if(null!==c)for(let q=c.length-1;0<=q;q--)n=c[q].j(a,g,n);const p=olympe.U.Lc();Pf(e,b,(q,r)=>{g.register(p,null);const t=f.j(q,b,p,null);n(q,r,p,Bm(t,q,b,p))},p);a.onDestroy(()=>{Nf(e,b,p)});e.Ja(b)||wm(g)}
|
|
1033
|
+
function fn(a,b,c){const d=c.getContext(),e=olympe.dc.ha(),f=a.F(),g=hh(e,b,a.H,d.rc(h=>{null!==h&&(h=f(h));null===h?c.clear():c.update(h)}));d.onDestroy(()=>ih(e,b,a.H,g))}
|
|
1034
|
+
olympe.dc.ab.Di=class{constructor(a,b,c){this.H=a&&a.W?a.W():a;this.aa=b&&b.filter(d=>d instanceof olympe.dc.aa.$e||d instanceof olympe.dc.aa.Le)||null;this.D=c||null;this.defaultValue=null}ka(){}Mb(){}F(){}j(){return(this.aa||[]).reduce((a,b)=>a.concat(olympe.dc.query.Relation.from(b)),[])}wh(a){this.defaultValue=a;return this}ph(){return this.aa}be(){return this.D}getValue(a,b){const c=a.run(()=>olympe.C.bc(this.Mb()||Object,'AbstractProperty valueType'));null!==this.defaultValue&&lc(c,this.defaultValue);
|
|
1035
|
+
b=this.D||b;null!==this.aa?en(a,b,this.aa,d=>{fn(this,d,c)}):fn(this,b,c);return c.tb()}fa(a){const b=Em(a,this.H),c=Em(a,this.D);let d='null';this.aa&&(d=this.aa.map(function(e){return e.fa(a)}).join(','));return`{"c":"${this.ka()}","a":["${b}",${d},${c}]}`}toString(){const a=Dm(this.H),b=this.D?','+Dm(this.D):'';let c='';this.aa&&(c=','+this.aa.join(','));return this.ka().replace(/^.+\./,'')+'('+a+c+b+')'}};olympe.dc.ab.Di.ya=[olympe.dc.Yk];olympe.dc.ab.ro=class{constructor(a,b){if(olympe.C.pf(a))throw Error('Dataflows of Property not supported by AnyProperty');const c=a.W();var d=olympe.dc.ha();const e=d.Ib(a,olympe.dm.Property.typeRel);if(!e)throw Error('Type of property '+a+'unavailable locally, cannot proceed with AnyProperty');a=d.nh(e,olympe.dc.CloudObject.extendRel,olympe.dm.Je);d=null;switch(1<a.length?a[a.length-2]:e){case olympe.dm.String.O.W():d=new olympe.dc.ab.jj(c,b);break;case olympe.dm.Number.O.W():d=new olympe.dc.ab.aj(c,
|
|
1036
|
+
b);break;case olympe.dm.Boolean.O.W():d=new olympe.dc.ab.Wj(c,b);break;case olympe.dm.DateTime.O.W():d=new olympe.dc.ab.Ji(c,b)}this.D=d}ka(){return this.D.ka()}j(){return this.D.j()}getValue(a,b){return this.D.getValue(a,b)}fa(a){return this.D.fa(a)}toString(){return this.D.toString()}};olympe.dc.ab.ro.ya=[olympe.dc.Yk];olympe.dc.ab.Wj=class extends olympe.dc.ab.Di{constructor(a,b,c){super(a,b,c)}ka(){return Q(olympe.dc.ab.Wj)}F(){return olympe.dc.ib.un}Mb(){return olympe.C.da}};P('olympe.dc.valuedefs.BooleanProperty',olympe.dc.ab.Wj);olympe.dc.ab.We=class{constructor(a){this.value=a}ka(){return Q(olympe.dc.ab.We)}j(){return[]}getValue(){return this.value}fa(a){a=Em(a,this.value);return`{"c":"${this.ka()}","a":[${a}]}`}toString(){return`Constant(${Dm(this.value)})`}};P('olympe.dc.valuedefs.Constant',olympe.dc.ab.We);olympe.dc.ab.We.ya=[olympe.dc.Yk];olympe.dc.ab.Ji=class extends olympe.dc.ab.Di{constructor(a,b,c){super(a,b,c)}ka(){return Q(olympe.dc.ab.Ji)}F(){return olympe.dc.ib.vn}Mb(){return olympe.C.eb}};P('olympe.dc.valuedefs.DateTimeProperty',olympe.dc.ab.Ji);olympe.dc.ab.aj=class extends olympe.dc.ab.Di{constructor(a,b,c){super(a,b,c)}ka(){return Q(olympe.dc.ab.aj)}F(){return olympe.dc.ib.wn}Mb(){return olympe.C.$}};P('olympe.dc.valuedefs.NumberProperty',olympe.dc.ab.aj);olympe.dc.ab.jj=class extends olympe.dc.ab.Di{constructor(a,b,c){super(a,b,c)}ka(){return Q(olympe.dc.ab.jj)}F(){return olympe.dc.ib.xn}Mb(){return olympe.C.Sa}};P('olympe.dc.valuedefs.StringProperty',olympe.dc.ab.jj);olympe.dc.ab.kj=class{ka(){return Q(olympe.dc.ab.kj)}j(){return[]}getValue(a,b){return b}fa(){return'{"c":"'+this.ka()+'","a":[]}'}toString(){return'Tag()'}};P('olympe.dc.valuedefs.Tag',olympe.dc.ab.kj);olympe.dc.ab.kj.ya=[olympe.dc.Yk];olympe.dc.aa={};olympe.dc.aa.Ki=class{Mb(){return null}ka(){return Q(olympe.dc.aa.Ki)}j(a,b,c){const d={};return function(e,f,g,h){e?void 0===d[f]?(d[f]=1,b.j.j!==g||b.D||(b.j.j=f),c(!0,f,f,Bm(h,!0,f,f))):(d[f]++,Xm(b,g)):void 0!==d[f]&&0>=--d[f]&&(delete d[f],c(!1,f,f,Bm(h,!1,f,f)))}}fa(){return'{"c":"'+this.ka()+'"}'}toString(){return'Distinct()'}};P('olympe.dc.transformers.Distinct',olympe.dc.aa.Ki);olympe.dc.aa.Ki.ya=[olympe.dc.Kf];olympe.dc.aa.zf=class{constructor(a){this.D=a}Mb(){return null}ka(){return Q(olympe.dc.aa.zf)}F(){return this.D.D()}j(a,b,c){function d(f,g,h,k){k=k.valueOf();!1===k&&Xm(b,g);k!==!!e[g]&&(e[g]=k,c(k,f,g,Bm(h,k,f,g)))}const e={};return(f,g,h,k)=>{const l='@'+h;if(f){let n=this.D.j(a,g);olympe.C.gb(n)&&(n=n.Ba);olympe.C.Wf(n)?(b.D||void 0!==olympe.C.Qa(n)||Xm(b,h),e[l]=n,a.run(()=>{olympe.C.Wc([n],p=>{d(g,h,k,p)},'filterResultHandler')})):d(g,h,k,n)}else void 0!==e[l]&&(e[l].destroy(),delete e[l]),
|
|
1037
|
+
d(g,h,k,!1),delete e[h]}}fa(a){return'{"c":"'+this.ka()+'","a":['+this.D.fa(a)+']}'}toString(){return'Filter('+this.D.toString()+')'}};P('olympe.dc.transformers.Filter',olympe.dc.aa.zf);olympe.dc.aa.zf.ya=[olympe.dc.Kf,olympe.dc.jr];olympe.dc.aa.km=class{constructor(a,b,c,d){this.D=new olympe.dc.Ra.Relation(olympe.dc.ea(a),c||olympe.dc.ta.DESTINATION);this.F=new olympe.dc.Ra.Relation(olympe.dc.ea(b),d||olympe.dc.ta.DESTINATION)}Mb(){return ig(this.D)}ka(){return Q(olympe.dc.aa.km)}j(a,b,c){const d=olympe.dc.ha(),e={},f=this.D.W(),g=this.D.La(),h=this.F.W(),k=this.F.La();let l=null,n=null;const p=(r,t,v,x,y,z)=>{if(y){if(y=()=>{const A=olympe.U.rb(v+g+(f+'_'+r)+z,20),K=Bm(t,!0,z,A);l=r;n=()=>{c(!1,z,A,Bm(t,!1,z,A))};b.register(A,
|
|
1038
|
+
v,x,f,g);c(!0,z,A,K)},y.at=r,e[x]=y,null===l||r<l)n&&n(),y()}else if(l===r){n();e[x]=!0;y=Infinity;let A=null;for(let K=Object.keys(e),Y=K.length,ya=0;ya<Y;ya++){let db=e[K[ya]];db.at<y&&(y=db.at,A=db)}A&&A()}},q=(r,t,v,x,y)=>{x?e[y]||(e[y]=!0,Ym(b,v,y,f,g),Ym(b,v,y,h,k),T(d,y,this.D,p.bind(this,r,t,v,y),v+'_val'),T(d,y,this.F,q.bind(this,r+1,t,v),v+'_follow')):(d.D(y,this.F,v+'_follow'),d.D(y,this.D,v+'_val'),delete e[y])};return(r,t,v,x)=>q(0,x,v,r,t)}fa(){return'{"c":"'+this.ka()+'","a":["'+this.D.toString()+
|
|
1039
|
+
'","'+this.F.toString()+'"]}'}toString(){return'FirstRelated('+this.D.toString()+', '+this.F.toString()+')'}};P('olympe.dc.transformers.FirstRelated',olympe.dc.aa.km);olympe.dc.aa.km.ya=[olympe.dc.Kf];olympe.dc.aa.Mh=class{constructor(a,b){this.start=a;this.D=b}Mb(){return null}ka(){return Q(olympe.dc.aa.Mh)}j(a,b,c){const d=new olympe.dc.kc.Dm;let e,f,g,h=!1;const k=()=>{if(void 0!==f&&void 0!==g&&void 0!==e){var n=f+g;b.D||(b.j.j=e[0>n-1?0:Math.min(e.length,n)-1]);Pm(d,e,f,n,c)}};a.run(()=>olympe.C.Wc([this.start,this.D],(n,p)=>{f=n.valueOf();g=p.valueOf();k()}));cn(b,k);const l=$m(b);Zm(b,l);return(n,p,q,r)=>{h||(r.re().zg(t=>{e=t;dn(b,l)}),zm(b,()=>r.pg(),l),h=!0);d.j(n,p,q,null);Am(b,q,l)}}fa(a){return'{"c":"'+
|
|
1040
|
+
this.ka()+'","a":['+Em(a,this.start)+','+Em(a,this.D)+']}'}toString(){return`Limit(${olympe.C.Qa(this.start)},${olympe.C.Qa(this.D)})`}};P('olympe.dc.transformers.Limit',olympe.dc.aa.Mh);olympe.dc.aa.Mh.ya=[olympe.dc.Kf];function gn(a){return a.ob.map(b=>b.W())}
|
|
1041
|
+
olympe.dc.aa.tk=class{constructor(a,b){this.direction=b||olympe.dc.ta.DESTINATION;this.ob=a.map(c=>new olympe.dc.Ra.Relation(c,this.direction))}Mb(){return olympe.dc.CloudObject}ka(){return Q(olympe.dc.aa.tk)}La(){return this.direction}j(a,b,c){const d=olympe.dc.ha(),e=(f,g,h,k)=>T(d,f,k,(l,n)=>{var p=k.W();p=olympe.U.rb(g+k.La()+p+n,20);const q=Bm(h,l,n,p);l&&b.register(p,g,f,k.W(),k.La());c(l,n,p,q)},g);return(f,g,h,k)=>{f?this.ob.forEach(l=>{Ym(b,h,g,l.W(),l.La());e(g,h,k,l)}):this.ob.forEach(l=>
|
|
1042
|
+
{d.D(g,l,h)})}}fa(){return'{"c":"'+this.ka()+'","a":['+JSON.stringify(gn(this))+',"'+this.direction+'"]}'}toString(){return'MultiRelated('+this.La()+'['+gn(this).join(',')+'])'}};P('olympe.dc.transformers.MultiRelated',olympe.dc.aa.tk);olympe.dc.aa.tk.ya=[olympe.dc.Kf];olympe.dc.aa.Le=class extends olympe.dc.Ra.Relation{constructor(a,b=olympe.dc.ta.DESTINATION,c=1,d=-1){super(a,b);this.F=c;this.D=d}Mb(){return ig(this)}ka(){return Q(olympe.dc.aa.Le)}j(a,b,c){const d=olympe.dc.ha(),e=Object.create(null),f=olympe.dc.ta.ORIGIN,g=olympe.dc.ta.DESTINATION,h=this.W(),k=this.La(),l=(p,q,r)=>{if(!(0<=this.D&&p>=this.D)){var t=d.cb(r,this);p+=1;for(let v=0,x=t.length;v<x;v++){if(void 0!==e[t[v]]||r===t[v])continue;const y=olympe.U.rb(q+k+(h+'_'+p)+t[v],20);b.register(y,
|
|
1043
1043
|
q,r,h,k||g);null===k&&b.register(y,q,r,h,f)}}},n=(p,q,r,t,v,x)=>{v&&!b.D&&l(p,t,x);p>=this.F?c(v,x,t,Bm(r,v,x,t)):Ym(b,t,x,h,k);0<=this.D&&p>=this.D||(v?e[x]||(e[x]=!0,T(d,x,this,(y,z)=>{const A=p+1,K=olympe.U.rb(t+k+(h+'_'+A)+z,20);n(A,x,r,K,y,z)},t)):(d.D(x,this,t),delete e[x]))};return(p,q,r,t)=>n(0,null,t,r,p,q)}fa(){return'{"c":"'+this.ka()+'","a":["'+this.W()+'","'+this.La()+'",'+this.F+','+this.D+']}'}toString(){return'RecursiveRelated('+this.La()+this.W()+'['+this.F+'..'+this.D+'])'}};
|
|
1044
|
-
P('olympe.dc.transformers.RecursiveRelated',olympe.dc.aa.
|
|
1045
|
-
this.ka()+'","a":["'+this.W()+'","'+this.La()+'"]}'}toString(){return'Related('+this.La()+this.W()+')'}};P('olympe.dc.transformers.Related',olympe.dc.aa
|
|
1046
|
-
')'}};P('olympe.dc.transformers.Sort',olympe.dc.aa.ah);olympe.dc.aa.ah.ya=[olympe.dc.Kf,olympe.dc.
|
|
1047
|
-
olympe.dc.aa.Lf=class{constructor(a,b){this.aa=this.D=null;a instanceof olympe.dc.Aa?(this.D=a.be(),this.aa=a.
|
|
1048
|
-
v.fb()||(k||(t.
|
|
1049
|
-
P('olympe.dc.transformers.Union',olympe.dc.aa.Lf);olympe.dc.aa.Lf.ya=[olympe.dc.Kf];olympe.dc.aa.
|
|
1050
|
-
olympe.dc.CloudObject=class{constructor(a,b){this.tag=b;this.db=olympe.dc.
|
|
1051
|
-
c)throw new olympe.dc.
|
|
1052
|
-
return this.get(h)}static
|
|
1053
|
-
olympe.dc.ea(a));b=b&&b.D;return new olympe.dc.Aa(olympe.dc.ea(a),olympe.dc.CloudObject.instancesRel,b)}W(){return this.tag}name(){return this.db.name(this)}ka(){return this.wb(olympe.dc.CloudObject.nameProp)}Vb(){this.model||(this.model=olympe.dc.CloudObject.get(this.db.model(this)));return this.model}query(){return olympe.dc.la.from(this)}
|
|
1054
|
-
a=>olympe.C.xb(a),olympe.C.Sa,'getDisplayName',olympe.C.xb('('+this.toString()+')'))}Wb(){return this.model?this.model.W():this.db.model(this)}observe(a,b,c=!0){const d='function'===typeof a.Cb?a.Cb():a;return new rxjs.Observable(e=>{const f=olympe.dc.ib.tc(this.db.Pa(this.tag,b));c||null!==f||e.next(f);const g=hh(this.db,this.tag,b,h=>{e.next(olympe.dc.ib.tc(h))});d.Xd(()=>{e.complete();ih(this.db,this.tag,b,g)});return()=>ih(this.db,this.tag,b,g)})}
|
|
1055
|
-
a;return new rxjs.Observable(c=>{const d=jh(this.db,this.tag,(e,f)=>{null===f||void 0===f?c.next([new olympe.dc.Ra.Property(e),null]):c.next([new olympe.dc.Ra.Property(e),f])});b.Xd(()=>{c.complete();kh(this.db,this.tag,d)});return()=>kh(this.db,this.tag,d)})}
|
|
1056
|
-
olympe.dc.CloudObject)}
|
|
1057
|
-
olympe.C.
|
|
1058
|
-
olympe.dc.CloudObject.get(h)))&&f.set(h,g);else{let k;null==(k=f.get(h))||k();f.delete(h)}},d);e.onDestroy(()=>{c.D(this.tag,a,d)})}
|
|
1059
|
-
!1,b=!0){const c={};this.db.zb(this,b).forEach((d,e)=>{this.db.Ja(e)&&(e=a?this.db.name(e):e,c[e]=olympe.dc.ib.tc(d))});return c}Ea(a){return a instanceof olympe.dc.CloudObject?this.W()===a.W():'function'===typeof a?olympe.dc.na.Wb(a)===this.W():!1}Jd(a){return olympe.C.sa([a],b=>olympe.C.
|
|
1044
|
+
P('olympe.dc.transformers.RecursiveRelated',olympe.dc.aa.Le);olympe.dc.aa.Le.ya=[olympe.dc.Kf];olympe.dc.aa.$e=class extends olympe.dc.Ra.Relation{constructor(a,b){super(a,b||olympe.dc.ta.DESTINATION)}Mb(){return ig(this)}ka(){return Q(olympe.dc.aa.$e)}$b(){return new olympe.dc.aa.$e(this.tag,this.direction===olympe.dc.ta.DESTINATION?olympe.dc.ta.ORIGIN:olympe.dc.ta.DESTINATION)}j(a,b,c){const d=olympe.dc.ha(),e=this.W(),f=this.La();return(g,h,k,l)=>{Ym(b,k,h,e,f);g?T(d,h,this,(n,p)=>{const q=olympe.U.rb(k+f+e+p,20),r=Bm(l,n,p,q);n&&b.register(q,k,h,e,f);c(n,p,q,r)},k):d.D(h,this,k)}}fa(){return'{"c":"'+
|
|
1045
|
+
this.ka()+'","a":["'+this.W()+'","'+this.La()+'"]}'}toString(){return'Related('+this.La()+this.W()+')'}};P('olympe.dc.transformers.Related',olympe.dc.aa.$e);olympe.dc.aa.$e.ya=[olympe.dc.Kf];olympe.dc.aa.ah=class{constructor(a,b){this.Gb=a;this.D=void 0===b?!0:!!b}Mb(){return null}ka(){return Q(olympe.dc.aa.ah)}jh(){return this.Gb}F(){return[this.Gb.H()]}j(a,b,c){const d=new olympe.dc.kc.Wr(a.rc(this.D?this.Gb.compare.bind(this.Gb):(e,f)=>this.Gb.compare(f,e)));return(e,f,g)=>{var h=e?this.Gb.F(a,f):void 0;h=d.j(e,f,g,h);c(e,f,g,h)}}fa(a){return'{"c":"'+this.ka()+'","a":['+this.Gb.fa(a)+','+JSON.stringify(this.D)+']}'}toString(){return'Sort('+this.Gb.toString()+','+JSON.stringify(this.D)+
|
|
1046
|
+
')'}};P('olympe.dc.transformers.Sort',olympe.dc.aa.ah);olympe.dc.aa.ah.ya=[olympe.dc.Kf,olympe.dc.jr];function hn(a,b,c,d,e,f){function g(n,p){if(l)for(var q=l.length-1;0<=q;q--)f=l[q].j(b,e,f);e.register(h,null);q=d.j(n,p,c,null);f(n,p,h,Bm(q,n,p,h))}const h=olympe.U.Lc(),k=olympe.dc.ha(),l=a.aa;b.run(()=>olympe.C.Wc([a.D],n=>{jn(k,n,g,h);void 0===k.model(n)&&wm(e)}))}function jn(a,b,c,d){const e=b&&b.valueOf();e&&(Pf(a,e,c,d),olympe.C.Za().Xd(()=>Nf(a,e,d)))}
|
|
1047
|
+
olympe.dc.aa.Lf=class{constructor(a,b){this.aa=this.D=null;a instanceof olympe.dc.Aa?(this.D=a.be(),this.aa=a.xm()):(this.D=a,b&&(this.aa=b))}Mb(){return null}ka(){return Q(olympe.dc.aa.Lf)||''}ph(){return this.aa}be(){return this.D}j(a,b,c){const d=new olympe.dc.kc.Dm,e=new olympe.dc.kc.Vj;let f=[],g=[],h=!1,k=!1;const l=$m(b),n=$m(b);cn(b,()=>{const p=f.concat(g);0<p.length?b.D||(b.j.j=p[p.length-1]):dn(b);Pm(d,p,0,p.length,c)});Zm(b,n);hn(this,a,this.D,e,b,(p,q,r,t)=>{const v=olympe.C.Za();v.jd()||
|
|
1048
|
+
v.fb()||(k||(t.re().zg(x=>{g=x;dn(b,n)}),zm(b,()=>t.pg(),n),k=!0),d.j(p,q,r),Am(b,r,n))});Zm(b,l);return(p,q,r,t)=>{h||(t.re().zg(v=>{f=v;dn(b,l)}),zm(b,()=>t.pg(),l),h=!0);d.j(p,q,r,l);Am(b,r,l)}}fa(a){const b=this.aa?'['+this.aa.map(c=>c.fa(a)).join(',')+']':'null';return'{"c":"'+this.ka()+'","a":['+Em(a,this.D)+','+b+']}'}toString(){const a=olympe.C.gb(this.D)?'N:'+this.D.Ba.T():this.D.valueOf(),b=this.aa?','+this.aa.map(c=>c.toString()).join(','):'';return'Union('+a+b+')'}};
|
|
1049
|
+
P('olympe.dc.transformers.Union',olympe.dc.aa.Lf);olympe.dc.aa.Lf.ya=[olympe.dc.Kf];olympe.dc.aa.Dr={NB:1,Gu:-1,Fu:0};olympe.dc.aa.qD={vA:!0,WA:!1};olympe.dc.jc.P={sq:'dc.legacy.listdefProcessor'};olympe.dc.jc.Config={rq:'dc.legacy.listdefsCovered'};olympe.V.config(a=>{E(a,olympe.dc.jc.Config.rq,!1);C(a,olympe.dc.jc.P.sq,olympe.dc.jc.zv,olympe.dc.query.P.Da,olympe.dc.P.Ch,olympe.dc.transaction.P.Fa,olympe.dc.query.P.Fk,new olympe.V.oa(olympe.dc.Config.Yh),new olympe.V.oa(olympe.dc.jc.Config.rq))});olympe.V.run([olympe.dc.jc.P.sq],a=>{olympe.dc.jc.Fy=()=>a});function kn(a){const b=olympe.dc.ha(),c=new Map;b.Qs(a).forEach(d=>{b.cb(d,olympe.dc.CloudObject.propertyRel).forEach(e=>{const f=b.name(e);c.has(f)||c.set(f,e)})});return c}
|
|
1050
|
+
olympe.dc.CloudObject=class{constructor(a,b){this.tag=b;this.db=olympe.dc.ha();Object.defineProperty(this,'db',{enumerable:!1});this.model=null;Object.defineProperties(this,{db:{enumerable:!1}})}static Sc(a,b,c,...d){b=olympe.dc.ea(b);var e=Rf(b);if(e=e&&e.j)return e(a,c,...d);a=a.create(b);void 0!==c&&null!==c&&X(a,olympe.dc.CloudObject.nameProp,c);return a.W()}static get(a){if(a instanceof olympe.dc.CloudObject)var b=a;else{b=olympe.dc.Ts();a=olympe.dc.ea(a);var c=b.db.model(a);c=Qf(b,c);if(null===
|
|
1051
|
+
c)throw new olympe.dc.Xq(a);c=c.instantiate(a,b.D);b.j.ne([a],olympe.dc.db.Instance.j.aq);b.Ra.register(c,a);b=c}return b}static exists(a){return olympe.dc.ha().Ja(olympe.dc.ea(a))}static Kj(...a){olympe.dc.Ns().Kj(...a)}static Jx(a,b,c){const d=olympe.dc.ha();let e=null;const f=k=>{null===e&&(e=kn(b||this));return e.has(k)?e.get(k):null},g=$l(!1),h=g.create(null!=b?b:this);void 0!==c&&h.yi(c);a.forEach((k,l)=>{d.Ja(olympe.dc.ea(l))?X(h,l,k):(l=f(l))&&X(h,l,k)});g.mb((k,l)=>{k||olympe.ga.Wa('dc').error(`Error occurred for transaction executed by CloudObject.createWith: ${l}`)});
|
|
1052
|
+
return this.get(h)}static tx(){return this.get(this)}static ql(a){return olympe.dc.la.ql(a)}static zb(){return olympe.dc.ha().cb(this,olympe.dc.CloudObject.propertyRel).map(a=>new olympe.dc.Ra.Property(a))}static Id(){const a=olympe.dc.ha();return a.cb(this,olympe.dc.CloudObject.Lj).map(b=>new olympe.dc.Ra.Relation(b)).concat(a.cb(this,olympe.dc.CloudObject.Is).map(b=>new olympe.dc.Ra.Relation(b,olympe.dc.ta.ORIGIN)))}static Uc(a){return olympe.dc.CloudObject.get(a)}static Us(a){var b=Qf(olympe.dc.Ts(),
|
|
1053
|
+
olympe.dc.ea(a));b=b&&b.D;return new olympe.dc.Aa(olympe.dc.ea(a),olympe.dc.CloudObject.instancesRel,b)}W(){return this.tag}name(){return this.db.name(this)}ka(){return this.wb(olympe.dc.CloudObject.nameProp)}Vb(){this.model||(this.model=olympe.dc.CloudObject.get(this.db.model(this)));return this.model}query(){return olympe.dc.la.from(this)}Re(){return this.db.Re(this)}jb(){return this.db.source(this)}Cy(){return this.db.vi(this)?olympe.dc.ee().fromModel(this):null}Ps(){return olympe.C.sa([this.ka()],
|
|
1054
|
+
a=>olympe.C.xb(a),olympe.C.Sa,'getDisplayName',olympe.C.xb('('+this.toString()+')'))}Wb(){return this.model?this.model.W():this.db.model(this)}observe(a,b,c=!0){const d='function'===typeof a.Cb?a.Cb():a;return new rxjs.Observable(e=>{const f=olympe.dc.ib.tc(this.db.Pa(this.tag,b));c||null!==f||e.next(f);const g=hh(this.db,this.tag,b,h=>{e.next(olympe.dc.ib.tc(h))});d.Xd(()=>{e.complete();ih(this.db,this.tag,b,g)});return()=>ih(this.db,this.tag,b,g)})}Iz(a){const b='function'===typeof a.Cb?a.Cb():
|
|
1055
|
+
a;return new rxjs.Observable(c=>{const d=jh(this.db,this.tag,(e,f)=>{null===f||void 0===f?c.next([new olympe.dc.Ra.Property(e),null]):c.next([new olympe.dc.Ra.Property(e),f])});b.Xd(()=>{c.complete();kh(this.db,this.tag,d)});return()=>kh(this.db,this.tag,d)})}Jz(a){return this.observe(olympe.C.Za(),a)}get(a){return olympe.dc.ib.tc(this.db.Pa(this.tag,a))}Pa(a){return this.get(a)}bb(a){return olympe.dc.la.from(this).bb(a)}vg(a){return olympe.dc.sd.from(this).bb(a)}tc(){return this}ly(){return this.Tc(olympe.dc.CloudObject.Fx,
|
|
1056
|
+
olympe.dc.CloudObject)}Gn(){return this.cb(olympe.dc.CloudObject.containsRel,olympe.dc.CloudObject)}Uf(a,b,c){const d=olympe.C.bc(c,'Sync valueType'),e=hh(this.db,this.tag,a,olympe.C.Za().rc(f=>{b&&null!==f&&void 0!==f&&(f=b(f));null===f||void 0===f?d.clear():d.update(f)}));d.getContext().onDestroy(()=>ih(this.db,this.tag,a,e));return d.getContext()}wb(a){return M(this.Uf(a,olympe.dc.ib.xn,olympe.C.Sa))}xd(a){return M(this.Uf(a,olympe.dc.ib.wn,olympe.C.$))}mh(a){return M(this.Uf(a,olympe.dc.ib.un,
|
|
1057
|
+
olympe.C.da))}Dj(a){return M(this.Uf(a,olympe.dc.ib.vn,olympe.C.eb))}Ys(){return M(this.Uf(olympe.dm.Color.valueProp,olympe.dc.ib.Bs,olympe.C.Color))}Zs(){return M(this.Uf(olympe.sc.workflow.Transition.processRefProp,olympe.dc.ib.Cs,olympe.dc.CloudObject))}cb(a,b){a=a instanceof olympe.dc.aa.$e?a:new olympe.dc.aa.$e(a.W(),a.La());return new olympe.dc.Aa(this.W(),a,b)}Tc(a,b){return this.cb(a,b).Jc()}Ls(a,b){const c=this.db,d=olympe.U.Lc(),e=olympe.C.Za(),f=new Map;T(c,this.tag,a,(g,h)=>{if(g)(g=e.run(b,
|
|
1058
|
+
olympe.dc.CloudObject.get(h)))&&f.set(h,g);else{let k;null==(k=f.get(h))||k();f.delete(h)}},d);e.onDestroy(()=>{c.D(this.tag,a,d)})}nA(){return new olympe.dc.Aa(this.W(),[],gg(this.W()))}transform(...a){return(new olympe.dc.Aa(this.W(),[],this.constructor)).transform(...a)}Xc(){return this.Ps()}toString(){return`CloudObject: ${JSON.stringify(this)}`}toJSON(){return this.db.Ja(this.tag)?Object.assign({'#tag':this.W(),'#type':this.Vb().name()},this.Nc(!0,!0)):{'#tag':this.W(),'#error':'The object does not exist in the local database.'}}Nc(a=
|
|
1059
|
+
!1,b=!0){const c={};this.db.zb(this,b).forEach((d,e)=>{this.db.Ja(e)&&(e=a?this.db.name(e):e,c[e]=olympe.dc.ib.tc(d))});return c}Ea(a){return a instanceof olympe.dc.CloudObject?this.W()===a.W():'function'===typeof a?olympe.dc.na.Wb(a)===this.W():!1}Jd(a){return olympe.C.sa([a],b=>olympe.C.Rb(this.Ea(b)),olympe.C.da)}Mx(a){const b=this.db;let c=!1;if(void 0===a||null===a)a=new olympe.dc.Ya,c=!0;const d=olympe.dc.ta.ORIGIN;for(const [e,f,g]of uh(b,this))f===d?a.hc(e,g,this):e!==olympe.dc.CloudObject.modelRel.W()&&
|
|
1060
1060
|
a.hc(e,this,g);a.delete(this,olympe.dc.Lb.NONE);c&&a.mb()}};olympe.dc.CloudObject.prototype.equals=olympe.dc.CloudObject.prototype.Ea;olympe.dc.CloudObject.prototype.toObject=olympe.dc.CloudObject.prototype.Nc;olympe.dc.CloudObject.prototype.followSingle=olympe.dc.CloudObject.prototype.vg;olympe.dc.CloudObject.prototype.follow=olympe.dc.CloudObject.prototype.bb;olympe.dc.CloudObject.prototype.getProperty=olympe.dc.CloudObject.prototype.Pa;olympe.dc.CloudObject.prototype.get=olympe.dc.CloudObject.prototype.get;
|
|
1061
|
-
olympe.dc.CloudObject.prototype.observeProperty=olympe.dc.CloudObject.prototype.
|
|
1062
|
-
olympe.dc.CloudObject.prototype.query=olympe.dc.CloudObject.prototype.query;olympe.dc.CloudObject.prototype.getModel=olympe.dc.CloudObject.prototype.Vb;olympe.dc.CloudObject.prototype.name=olympe.dc.CloudObject.prototype.name;olympe.dc.CloudObject.prototype.getTag=olympe.dc.CloudObject.prototype.W;olympe.dc.CloudObject.getInstancesOf=olympe.dc.CloudObject.
|
|
1063
|
-
olympe.dc.CloudObject.getProperties=olympe.dc.CloudObject.zb;olympe.dc.CloudObject.instancesOf=olympe.dc.CloudObject.
|
|
1064
|
-
olympe.dc.CloudObject.
|
|
1065
|
-
olympe.dc.CloudObject.
|
|
1061
|
+
olympe.dc.CloudObject.prototype.observeProperty=olympe.dc.CloudObject.prototype.Jz;olympe.dc.CloudObject.prototype.observeProperties=olympe.dc.CloudObject.prototype.Iz;olympe.dc.CloudObject.prototype.observe=olympe.dc.CloudObject.prototype.observe;olympe.dc.CloudObject.prototype.getModelTag=olympe.dc.CloudObject.prototype.Wb;olympe.dc.CloudObject.prototype.getSource=olympe.dc.CloudObject.prototype.jb;olympe.dc.CloudObject.prototype.isPersisted=olympe.dc.CloudObject.prototype.Re;
|
|
1062
|
+
olympe.dc.CloudObject.prototype.query=olympe.dc.CloudObject.prototype.query;olympe.dc.CloudObject.prototype.getModel=olympe.dc.CloudObject.prototype.Vb;olympe.dc.CloudObject.prototype.name=olympe.dc.CloudObject.prototype.name;olympe.dc.CloudObject.prototype.getTag=olympe.dc.CloudObject.prototype.W;olympe.dc.CloudObject.getInstancesOf=olympe.dc.CloudObject.Us;olympe.dc.CloudObject.getInstance=olympe.dc.CloudObject.Uc;olympe.dc.CloudObject.getRelations=olympe.dc.CloudObject.Id;
|
|
1063
|
+
olympe.dc.CloudObject.getProperties=olympe.dc.CloudObject.zb;olympe.dc.CloudObject.instancesOf=olympe.dc.CloudObject.ql;olympe.dc.CloudObject.asInstance=olympe.dc.CloudObject.tx;olympe.dc.CloudObject.createWith=olympe.dc.CloudObject.Jx;olympe.dc.CloudObject.markObsolete=olympe.dc.CloudObject.Kj;olympe.dc.CloudObject.exists=olympe.dc.CloudObject.exists;olympe.dc.CloudObject.get=olympe.dc.CloudObject.get;olympe.dc.CloudObject.O=olympe.dc.na.j('ff021000000000000001',olympe.dc.CloudObject);
|
|
1064
|
+
olympe.dc.CloudObject.CF=olympe.dc.CloudObject.O.ja(olympe.dc.lq.VERSION);olympe.dc.CloudObject.nameProp=olympe.dc.CloudObject.O.ja('ff023000000000000011');w('olympe.dc.CloudObject.nameProp',olympe.dc.CloudObject.nameProp);olympe.dc.CloudObject.nF=olympe.dc.CloudObject.O.ja('ff023000000000000012');olympe.dc.CloudObject.Lj=olympe.dc.CloudObject.O.ra('ff02200000000000000a');olympe.dc.CloudObject.Is=olympe.dc.CloudObject.O.ra('ff02200000000000000b',olympe.dc.ta.ORIGIN);olympe.dc.CloudObject.XE=olympe.dc.CloudObject.O.ra('017e9c4ba4c847d71cbf');
|
|
1065
|
+
olympe.dc.CloudObject.NE=olympe.dc.CloudObject.O.ra('017ea013caf8e89cedb2');olympe.dc.CloudObject.propertyRel=olympe.dc.CloudObject.O.ra('ff02200000000000000c');w('olympe.dc.CloudObject.propertyRel',olympe.dc.CloudObject.propertyRel);olympe.dc.CloudObject.typeRel=olympe.dc.CloudObject.O.ra('ff02200000000000000d',olympe.dc.ta.ORIGIN);olympe.dc.CloudObject.modelRel=olympe.dc.CloudObject.O.ra(olympe.dc.fc.Zc);w('olympe.dc.CloudObject.modelRel',olympe.dc.CloudObject.modelRel);
|
|
1066
1066
|
olympe.dc.CloudObject.instancesRel=R(olympe.dc.CloudObject.O,olympe.dc.CloudObject.modelRel);w('olympe.dc.CloudObject.instancesRel',olympe.dc.CloudObject.instancesRel);olympe.dc.CloudObject.extendRel=olympe.dc.CloudObject.O.ra(olympe.dc.fc.Li);w('olympe.dc.CloudObject.extendRel',olympe.dc.CloudObject.extendRel);olympe.dc.CloudObject.extendedByRel=R(olympe.dc.CloudObject.O,olympe.dc.CloudObject.extendRel);w('olympe.dc.CloudObject.extendedByRel',olympe.dc.CloudObject.extendedByRel);
|
|
1067
|
-
olympe.dc.CloudObject.containsRel=olympe.dc.CloudObject.O.ra(olympe.dc.fc.Zj);w('olympe.dc.CloudObject.containsRel',olympe.dc.CloudObject.containsRel);olympe.dc.CloudObject.
|
|
1068
|
-
m.W.K=new olympe.C.J(()=>String,[]);m.name.K=new olympe.C.J(()=>String,[]);m.ka.K=olympe.C.J.D;m.Vb.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.jb.K=new olympe.C.J(()=>String,[]);m.
|
|
1069
|
-
m.Dj.K=new olympe.C.J(()=>olympe.C.eb,[]);m.
|
|
1070
|
-
olympe.V.config(function(a){const b='object'===typeof window;E(a,olympe.dc.Config.bg,!1);E(a,olympe.dc.Config.Yh,!1);E(a,olympe.dc.Config.
|
|
1071
|
-
olympe.dc.P.Ug,olympe.U.P.Dg,new olympe.V.oa(olympe.dc.Config.
|
|
1072
|
-
olympe.V.run([olympe.dc.db.P.Fa,olympe.dc.transaction.P.Fa,olympe.dc.P.
|
|
1073
|
-
olympe.dm.Ud.D=fg('014831d95f83635090ea','ADMIN_USERS_ROLE');olympe.dm.Ud.prototype.ka.K=olympe.C.J.D;olympe.dm.Ud.prototype.j.K=olympe.C.J.D;olympe.dm.Ud.prototype.D.K=olympe.C.J.N;olympe.dm.
|
|
1067
|
+
olympe.dc.CloudObject.containsRel=olympe.dc.CloudObject.O.ra(olympe.dc.fc.Zj);w('olympe.dc.CloudObject.containsRel',olympe.dc.CloudObject.containsRel);olympe.dc.CloudObject.Fx=R(olympe.dc.CloudObject.O,olympe.dc.CloudObject.containsRel);olympe.dc.CloudObject.Lx=olympe.dc.CloudObject.O.ra('018282d3ac0a474a0bf4');w('olympe.dc.CloudObject.deleteAlsoRel',olympe.dc.CloudObject.Lx);olympe.dc.sD=olympe.dc.CloudObject;olympe.dc.CloudObject.ya=[olympe.dc.Ye];m=olympe.dc.CloudObject.prototype;
|
|
1068
|
+
m.W.K=new olympe.C.J(()=>String,[]);m.name.K=new olympe.C.J(()=>String,[]);m.ka.K=olympe.C.J.D;m.Vb.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.jb.K=new olympe.C.J(()=>String,[]);m.Cy.K=new olympe.C.J(()=>String,[]);m.Ps.K=olympe.C.J.D;m.Wb.K=new olympe.C.J(()=>String,[]);m.ly.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.Gn.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.Uf.K=new olympe.C.J(()=>olympe.C.Node,[]);m.wb.K=olympe.C.J.D;m.xd.K=olympe.C.J.F;m.mh.K=olympe.C.J.N;
|
|
1069
|
+
m.Dj.K=new olympe.C.J(()=>olympe.C.eb,[]);m.Ys.K=new olympe.C.J(()=>olympe.C.Color,[]);m.Zs.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.cb.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.Tc.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.Ls.K=new olympe.C.J(()=>Function,[]);m.nA.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.transform.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.Xc.K=olympe.C.J.D;m.toString.K=olympe.C.J.j;m.Ea.K=olympe.C.J.j;m.Jd.K=olympe.C.J.N;m.Mx.K=new olympe.C.J(()=>{},[]);olympe.dc.P={Ch:'dc.DBView',eq:'dc.InstanceManager',Da:'dc.Logger',Mw:'dc.TransactionLogger',hk:'dc.FileServiceManager',Ug:'dc.Router'};olympe.dc.Config={Xg:'dc.tag',bg:'dc.debug',Yh:'dc.subscribeAll',cm:'dc.defaultSource',vp:'dc.fileCache',Zo:'dc.dataConsumerOnly',qp:'dc.errorOnAbstractInstantiation'};
|
|
1070
|
+
olympe.V.config(function(a){const b='object'===typeof window;E(a,olympe.dc.Config.bg,!1);E(a,olympe.dc.Config.Yh,!1);E(a,olympe.dc.Config.cm,olympe.dc.Ia.SERVER);E(a,olympe.dc.Config.Zo,b);E(a,olympe.dc.Config.vp,b);E(a,olympe.dc.Config.qp,!0);E(a,olympe.dc.Config.Xg,olympe.U.Lc());D(a,olympe.dc.P.Da,[olympe.ga.P.Fa],c=>c.ad('dc'));Wa(a,olympe.dc.P.Mw,olympe.dc.transaction.P.Da);Wa(a,olympe.dc.P.Ch,olympe.dc.db.P.$l);C(a,olympe.dc.P.hk,olympe.dc.tu,olympe.dc.P.Da,olympe.dc.db.P.Fa,olympe.net.P.Fa,
|
|
1071
|
+
olympe.dc.P.Ug,olympe.U.P.Dg,new olympe.V.oa(olympe.dc.Config.vp));C(a,olympe.dc.P.Ug,olympe.dc.lw,olympe.dc.P.Da,olympe.dc.sources.P.ur,olympe.dc.sources.P.Mr,olympe.dc.P.Ch,olympe.host.P.He,new olympe.V.oa(olympe.dc.Config.Xg),new olympe.V.oa(olympe.dc.Config.Zo));C(a,olympe.dc.P.eq,olympe.dc.Mu,olympe.dc.db.P.nm,olympe.dc.db.P.Fa,olympe.V.P.Eg)},'olympe.dc');
|
|
1072
|
+
olympe.V.run([olympe.dc.db.P.Fa,olympe.dc.transaction.P.Fa,olympe.dc.P.eq,olympe.dc.P.hk,new olympe.V.oa(olympe.dc.Config.Xg)],(a,b,c,d,e)=>{olympe.dc.Ns=()=>a;olympe.dc.Fj=()=>b;olympe.dc.Ts=()=>c;olympe.dc.Rs=()=>d;olympe.dc.Ia.SELF=e},'DC singleton getter initialization');olympe.dm={};olympe.dm.Ud=class extends olympe.dc.CloudObject{ka(){return this.wb(olympe.dc.CloudObject.nameProp)}j(){return olympe.C.Sa.EMPTY}D(){return olympe.C.da.j}};olympe.dm.Ud.O=olympe.dc.na.j('ff021000000000000002',olympe.dm.Ud);olympe.dm.Ud.N=olympe.dm.Ud.O.ja('ff023000000000000035');olympe.dm.Ud.j=olympe.dm.Ud.O.ra('ff022000000000000005');olympe.dm.Ud.F=fg('ff011000000000000001','AUTHENTICATED_USERS');olympe.dm.Ud.H=fg('ff011000000000000002','PROJECT_RUNNER_USERS_ROLE');
|
|
1073
|
+
olympe.dm.Ud.D=fg('014831d95f83635090ea','ADMIN_USERS_ROLE');olympe.dm.Ud.prototype.ka.K=olympe.C.J.D;olympe.dm.Ud.prototype.j.K=olympe.C.J.D;olympe.dm.Ud.prototype.D.K=olympe.C.J.N;olympe.dm.Gl={NONE:0,$A:1,gu:2,aB:4,XA:8,ZA:16,YA:31,xC:32,uC:64,yC:128,vC:256,Qv:512,wC:992,OB:1023};olympe.dm.User=class extends olympe.dc.CloudObject{zy(){return this.Kn()}ka(){return this.Kn()}Kn(){return this.wb(olympe.dm.User.loginProp)}av(){return this.wb(olympe.dm.User.D)}$u(){return olympe.C.Sa.EMPTY}Uy(){return this.wb(olympe.dm.User.saltProp)}cz(){return this.wb(olympe.dm.User.verifierProp)}Sy(){return this.cb(olympe.dm.User.F,olympe.dm.Ud)}};olympe.dm.User.O=olympe.dc.na.j('ff021000000000000003',olympe.dm.User);olympe.dm.User.loginProp=olympe.dm.User.O.ja('ff023000000000000001');
|
|
1074
1074
|
w('olympe.dm.User.loginProp',olympe.dm.User.loginProp);olympe.dm.User.D=olympe.dm.User.O.ja('ff023000000000000002');olympe.dm.User.R=olympe.dm.User.O.ja('ff023000000000000003');olympe.dm.User.saltProp=olympe.dm.User.O.ja('ff023000000000000004');w('olympe.dm.User.saltProp',olympe.dm.User.saltProp);olympe.dm.User.verifierProp=olympe.dm.User.O.ja('ff023000000000000005');w('olympe.dm.User.verifierProp',olympe.dm.User.verifierProp);olympe.dm.User.N=olympe.dm.User.O.ja('ff023000000000000020');
|
|
1075
|
-
olympe.dm.User.SAMLnameIdProp=olympe.dm.User.O.ja('ff023000000000000036');w('olympe.dm.User.SAMLnameIdProp',olympe.dm.User.SAMLnameIdProp);olympe.dm.User.F=R(olympe.dm.User.O,olympe.dm.Ud.j);olympe.dm.User.X=olympe.dm.User.O.ra('ff022000000000000002');olympe.dm.User.j=fg('014831d95fd7d12b8568','ADMIN_USER');olympe.dm.User.H=fg('0163d9653067b6237f62','GUEST_USER');m=olympe.dm.User.prototype;m.
|
|
1076
|
-
m.
|
|
1077
|
-
olympe.dm.BrickMetadata.Gc=olympe.dm.BrickMetadata.O.ja('01621fb84e320000f001');olympe.dm.BrickMetadata.
|
|
1078
|
-
olympe.dm.BrickMetadata.
|
|
1079
|
-
function Qj(a,b){const c=a.query().bb(olympe.dm.Ad.j.$b()).bb(olympe.dm.Ad.D);a=a.query().bb(olympe.dm.hb.D.$b()).ug(olympe.dm.hb.F,!0).bb(olympe.sc.Ac.j.$b());const d=e=>e.
|
|
1080
|
-
function qk(a,b){return a.observe(b,olympe.dm.DataSource.
|
|
1081
|
-
olympe.dm.DataSource=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.Jb=c;this.
|
|
1082
|
-
'_')}.${b}`))?d:wj(this.W(),a))?e:this.
|
|
1075
|
+
olympe.dm.User.SAMLnameIdProp=olympe.dm.User.O.ja('ff023000000000000036');w('olympe.dm.User.SAMLnameIdProp',olympe.dm.User.SAMLnameIdProp);olympe.dm.User.F=R(olympe.dm.User.O,olympe.dm.Ud.j);olympe.dm.User.X=olympe.dm.User.O.ra('ff022000000000000002');olympe.dm.User.j=fg('014831d95fd7d12b8568','ADMIN_USER');olympe.dm.User.H=fg('0163d9653067b6237f62','GUEST_USER');m=olympe.dm.User.prototype;m.zy.K=olympe.C.J.D;m.ka.K=olympe.C.J.D;m.Kn.K=olympe.C.J.D;m.av.K=olympe.C.J.D;m.$u.K=olympe.C.J.D;m.Uy.K=olympe.C.J.D;
|
|
1076
|
+
m.cz.K=olympe.C.J.D;m.Sy.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.fg=class extends olympe.dc.CloudObject{Z(){return this.Gn()}Ha(){return this.wb(olympe.dm.fg.wa)}};olympe.dm.fg.O=olympe.dc.na.j('01621fb84e3300000000',olympe.dm.fg);olympe.dm.fg.wa=olympe.dm.fg.O.ja('01609de3f292e3c2c6ff');olympe.dm.fg.prototype.Z.K=new olympe.C.J(()=>olympe.C.vd,[]);olympe.dm.fg.prototype.Ha.K=olympe.C.J.D;olympe.dm.BrickMetadata=class extends olympe.dm.fg{dz(){return this.wb(olympe.dm.BrickMetadata.Gc)}Kc(){return this.wb(olympe.dm.BrickMetadata.ba)}getType(){return this.wb(olympe.dm.BrickMetadata.Ub)}nz(){return this.mh(olympe.dm.BrickMetadata.vb)}ve(){return null}iy(){return this.cb(olympe.sc.ui.Ex.Comment.QE.$b(),olympe.sc.ui.Ex.Comment)}kl(){return this.vg(olympe.dm.BrickMetadata.Ha).Cc().kl()}};olympe.dm.BrickMetadata.O=kg(olympe.dc.na.j('01621fb84e3500000000',olympe.dm.BrickMetadata));
|
|
1077
|
+
olympe.dm.BrickMetadata.Gc=olympe.dm.BrickMetadata.O.ja('01621fb84e320000f001');olympe.dm.BrickMetadata.ba=olympe.dm.BrickMetadata.O.ja('01703376c4a81c0e9d94');olympe.dm.BrickMetadata.Ub=olympe.dm.BrickMetadata.O.ja('01703376c4a81c0e9d00');olympe.dm.BrickMetadata.vb=olympe.dm.BrickMetadata.O.ja('01703376c4a81c0eaea5');olympe.dm.BrickMetadata.Ha=olympe.dm.BrickMetadata.O.ra('0161ae97622bb21f335b');olympe.dm.BrickMetadata.ke={GC:'private',IC:'public'};
|
|
1078
|
+
olympe.dm.BrickMetadata.Tb={hB:'experimental',YC:'stable',VA:'deprecated'};olympe.dm.BrickMetadata.Md={HA:'business',tD:'technical'};m=olympe.dm.BrickMetadata.prototype;m.dz.K=olympe.C.J.D;m.Kc.K=olympe.C.J.D;m.getType.K=olympe.C.J.D;m.nz.K=olympe.C.J.N;m.ve.K=new olympe.C.J(()=>String,[]);m.iy.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.kl.K=olympe.C.J.R;function wj(a,b){b=b.startsWith('data.')?b.substring(5):b;let c,d;return null!=(d=null!=(c=olympe.V.getParameter(`${'data.'}${a}.${b}`))?c:olympe.V.getParameter(`${'data.'}${b}`))?d:olympe.V.getParameter(`${olympe.dc.sources.Kh.Xv}${b}`)}
|
|
1079
|
+
function Qj(a,b){const c=a.query().bb(olympe.dm.Ad.j.$b()).bb(olympe.dm.Ad.D);a=a.query().bb(olympe.dm.hb.D.$b()).ug(olympe.dm.hb.F,!0).bb(olympe.sc.Ac.j.$b());const d=e=>e.me().ug(olympe.dc.CloudObject.extendRel,!0).bb(olympe.dc.CloudObject.Lj,!0).bb(olympe.dm.Relation.destinationModelRel).back(2).bb(olympe.dc.CloudObject.propertyRel,!0).bb(olympe.dm.Property.typeRel).observe(b);return rxjs.combineLatest([d(c),d(a)]).pipe(rxjs.operators.map(([e,...f])=>e.concat(...f)))}
|
|
1080
|
+
function qk(a,b){return a.observe(b,olympe.dm.DataSource.Ds).pipe(rxjs.operators.map(()=>a.Qf(olympe.dc.sources.Config.Ve)),rxjs.operators.distinctUntilChanged())}
|
|
1081
|
+
olympe.dm.DataSource=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.Jb=c;this.Fs=new Map([[olympe.dc.sources.Config.Qm,olympe.dm.DataSource.Vz],[olympe.dc.sources.Config.Ve,olympe.dm.DataSource.Ds],[olympe.dc.sources.Config.Xm,olympe.dm.DataSource.bA]])}T(){return this.tag===olympe.dm.DataSource.SERVER?olympe.dc.Ia.SERVER:this.tag}Qf(a){const b=a.startsWith('data.')?a.split('.')[1]:a,c=`${'data.'}${b}`;let d,e;return null!=(e=null!=(d=olympe.V.getParameter(`${'data.'}${this.name().toLowerCase().replace(/\W/g,
|
|
1082
|
+
'_')}.${b}`))?d:wj(this.W(),a))?e:this.Fs.has(c)?this.get(this.Fs.get(c)):null}Kc(){const a=this;return u(function*(){const b=olympe.dm.DataSource.oc.ju,c=olympe.dm.DataSource.oc.Ab,d=new olympe.dc.Request(olympe.dc.Request.j.oc,a.T());return a.Jb.request(d).then(e=>{let f;const g=null!=(f=null==e?void 0:e.s)?f:c;(e=null==e?void 0:e.r)&&olympe.ga.Wa('dc').warn(`Source ${a.name()} (${a.T()}) has encountered issues: ${e}`);return g}).catch(e=>e instanceof olympe.error.Vk||e instanceof olympe.error.Hm?
|
|
1083
1083
|
b:c)})}init(){const a=this;return u(function*(){if(a.constructor===olympe.dm.DataSource)throw Error(`Data source ${a.name()} (${a.tag}) has no implementation (is the file missing ?)`);})}destroy(){return u(function*(){})}healthCheck(){return u(function*(){})}executeQuery(a){return u(function*(){return olympe.dc.query.Dd.xj(a)})}applyTransaction(){return u(function*(){})}uploadFileContent(){return u(function*(){throw Error('Should not try to upload files with SELF source');})}downloadFileContent(){return u(function*(){throw Error('Should not try to download files with SELF source');
|
|
1084
1084
|
})}deleteFileContent(){return u(function*(){})}};olympe.dm.DataSource.prototype.deleteFileContent=olympe.dm.DataSource.prototype.deleteFileContent;olympe.dm.DataSource.prototype.downloadFileContent=olympe.dm.DataSource.prototype.downloadFileContent;olympe.dm.DataSource.prototype.uploadFileContent=olympe.dm.DataSource.prototype.uploadFileContent;olympe.dm.DataSource.prototype.applyTransaction=olympe.dm.DataSource.prototype.applyTransaction;olympe.dm.DataSource.prototype.executeQuery=olympe.dm.DataSource.prototype.executeQuery;
|
|
1085
1085
|
olympe.dm.DataSource.prototype.healthCheck=olympe.dm.DataSource.prototype.healthCheck;olympe.dm.DataSource.prototype.destroy=olympe.dm.DataSource.prototype.destroy;olympe.dm.DataSource.prototype.init=olympe.dm.DataSource.prototype.init;olympe.dm.DataSource.prototype.getConfig=olympe.dm.DataSource.prototype.Qf;olympe.dm.DataSource.prototype.getId=olympe.dm.DataSource.prototype.T;olympe.dm.DataSource.O=olympe.dc.na.j('ff021000000000000060',olympe.dm.DataSource,olympe.dc.P.Ug);
|
|
1086
|
-
olympe.dm.DataSource.gi=olympe.dm.DataSource.O.ja('ff023000000000000060');w('olympe.dm.DataSource.activatedProp',olympe.dm.DataSource.gi);olympe.dm.DataSource.
|
|
1087
|
-
olympe.dm.DataSource.Mj=olympe.dm.DataSource.O.ra('ff022000000000000060');olympe.dm.DataSource.SERVER=fg('00000000000000000060','Server source');olympe.dm.DataSource.
|
|
1086
|
+
olympe.dm.DataSource.gi=olympe.dm.DataSource.O.ja('ff023000000000000060');w('olympe.dm.DataSource.activatedProp',olympe.dm.DataSource.gi);olympe.dm.DataSource.TE=olympe.dm.DataSource.O.ja('ff023000000000000061');olympe.dm.DataSource.Vz=olympe.dm.DataSource.O.ja('ff023000000000000062');olympe.dm.DataSource.Ds=olympe.dm.DataSource.O.ja('ff023000000000000063');olympe.dm.DataSource.Js=olympe.dm.DataSource.O.ja('ff023000000000000064');olympe.dm.DataSource.bA=olympe.dm.DataSource.O.ja('ff023000000000000065');
|
|
1087
|
+
olympe.dm.DataSource.Mj=olympe.dm.DataSource.O.ra('ff022000000000000060');olympe.dm.DataSource.SERVER=fg('00000000000000000060','Server source');olympe.dm.DataSource.Ve={SB:'hybrid',Ao:'bus',Rp:'http'};olympe.dm.DataSource.oc={Vh:'ready',Ab:'error',ju:'down',Ef:'offline'};olympe.dm.Ad=class extends olympe.dc.CloudObject{};olympe.dm.Ad.O=olympe.dc.na.j('ff021000000000000070',olympe.dm.Ad);olympe.dm.Ad.j=olympe.dm.Ad.O.ra('ff023000000000000071');olympe.dm.Ad.D=olympe.dm.Ad.O.ra('ff023000000000000072');olympe.dm.Ad.F=olympe.dm.Ad.O.ra('ff023000000000000073');olympe.dm.Kb=class extends olympe.dm.BrickMetadata{H(){return new olympe.dc.Aa(this.W(),[new olympe.dc.aa.Le(olympe.dm.Kb.j.W(),olympe.dc.ta.DESTINATION,olympe.dc.aa.Dr.Fu,olympe.dc.aa.Dr.Gu),olympe.dm.Kb.H])}ve(){return olympe.sc.xe.Oe.su}j(){return this.cb(olympe.dm.Kb.j,olympe.dm.Kb)}N(){return this.cb(olympe.dm.Kb.H)}};olympe.dm.Kb.O=olympe.dc.na.j('01612df1db9749227626',olympe.dm.Kb);olympe.dm.Kb.j=olympe.dm.Kb.O.ra('016a697ef00ce7554691');olympe.dm.Kb.ia=R(olympe.dm.Kb.O,olympe.dm.Kb.j);
|
|
1088
1088
|
olympe.dm.Kb.H=olympe.dm.Kb.O.ra('016a697ef00ce7554692');R(olympe.dc.CloudObject.O,olympe.dm.Kb.H);olympe.dm.Kb.prototype.H.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Kb.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Kb.prototype.N.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Rc=class extends olympe.dm.Kb{j(){return this.W()===olympe.dm.Rc.Z?this.cb(olympe.dm.Rc.N,olympe.dm.Kb):this.cb(olympe.dm.Rc.R,olympe.dm.Kb)}};olympe.dm.Rc.O=olympe.dc.na.j('ff021000000000000020',olympe.dm.Rc);olympe.dm.Rc.R=olympe.dm.Rc.O.ra('017e9c34cf48bd6965c1');olympe.dm.Rc.N=olympe.dm.Rc.O.ra('017e9c2e013e06bfffd9');olympe.dm.Rc.mi=olympe.dm.Rc.O.ra('01811f12ad77673770d4');olympe.dm.Rc.Z=fg('10000000000000000000','ROOT_OF_ROOTS');olympe.dm.Rc.hd=fg('10000000000000000001','OLYMPE_FOLDER');
|
|
1089
|
-
olympe.dm.Rc.Hc=fg('10000000000000000002','INTERNAL_FOLDER');olympe.dm.Rc.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Module=class extends olympe.dc.CloudObject{
|
|
1089
|
+
olympe.dm.Rc.Hc=fg('10000000000000000002','INTERNAL_FOLDER');olympe.dm.Rc.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Module=class extends olympe.dc.CloudObject{yy(){return this.wb(olympe.dm.Module.N)}Jy(){return this.xd(olympe.dm.Module.R)}bv(){return this.wb(olympe.dm.Module.D)}Ny(){return this.wb(olympe.dm.Module.X)}jy(){return this.wb(olympe.dm.Module.F)}Ky(){return this.cb(olympe.dm.Module.H,olympe.dm.Module)}Vy(){return this.cb(olympe.dm.Module.j,olympe.dm.Pd)}};olympe.dm.Module.O=olympe.dc.na.j('ff021000000000000040',olympe.dm.Module);olympe.dm.Module.N=olympe.dm.Module.O.ja('ff023000000000000042');
|
|
1090
1090
|
olympe.dm.Module.R=olympe.dm.Module.O.ja('ff023000000000000043');olympe.dm.Module.D=olympe.dm.Module.O.ja('ff023000000000000044');olympe.dm.Module.X=olympe.dm.Module.O.ja('ff023000000000000045');olympe.dm.Module.F=olympe.dm.Module.O.ja('ff023000000000000046');olympe.dm.Module.creationDateProp=olympe.dm.Module.O.ja('ff023000000000000049');olympe.dm.Module.j=olympe.dm.Module.O.ra('ff022000000000000013');olympe.dm.Module.H=olympe.dm.Module.O.ra('ff022000000000000014');
|
|
1091
|
-
olympe.dm.Module.Z=fg('016a69b9bceabd815b77','OLYMPE_SERVER_MODULE');m=olympe.dm.Module.prototype;m.
|
|
1092
|
-
b);this.j=c;this.F=d;this.D=e}
|
|
1093
|
-
void 0===b||olympe.
|
|
1091
|
+
olympe.dm.Module.Z=fg('016a69b9bceabd815b77','OLYMPE_SERVER_MODULE');m=olympe.dm.Module.prototype;m.yy.K=olympe.C.J.D;m.Jy.K=olympe.C.J.F;m.bv.K=olympe.C.J.D;m.Ny.K=olympe.C.J.D;m.jy.K=olympe.C.J.D;m.Ky.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.Vy.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.File=class extends olympe.dc.CloudObject{static D(a,b,c,d,e,f,g){e=e||'application/data';d=URL.createObjectURL(new Blob([d],{type:e}));g=null!=g?g:olympe.dc.ee().fromModel(a);a=b.create(a,f).yi(g);b=olympe.C.eb.now();X(X(X(X(X(X(a,olympe.dm.File.fileNameProp,null!=c?c:'file'),olympe.dm.File.urlProp,d),olympe.dm.File.creationDateProp,b),olympe.dm.File.modificationDateProp,b),olympe.dm.File.mimeTypeProp,e||'application/data'),olympe.dm.File.j,!1);return a.W()}constructor(a,b,c,d,e){super(a,
|
|
1092
|
+
b);this.j=c;this.F=d;this.D=e}Vs(){return this.wb(olympe.dm.File.mimeTypeProp)}gl(a,b){void 0===a&&void 0===b||olympe.ga.Wa('File.getContentAsBinary').warn('"onSuccess" and "onFailure" callbacks are deprecated in favor of the returned promise');const c=a&&olympe.C.Za().rc(a),d=b&&olympe.C.Za().rc(e=>null==b?void 0:b(`${e}`));return this.j.H(this).then(e=>{e=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);null==c||c(e);return e}).catch(e=>{null==d||d(e.message);throw e;})}Fn(a,b){void 0===a&&
|
|
1093
|
+
void 0===b||olympe.ga.Wa('File.getContentAsString').warn('"onSuccess" and "onFailure" callbacks are deprecated in favor of the returned promise');const c=a&&olympe.C.Za().rc(a),d=b&&olympe.C.Za().rc(e=>null==b?void 0:b(`${e}`));return this.gl().then(e=>{e=bb(e);null==c||c(e);return e}).catch(e=>{null==d||d(e.message);throw e;})}hl(a,b){void 0===a&&void 0===b||olympe.ga.Wa('File.getContentUrl').warn('"onSuccess" and "onFailure" callbacks are deprecated in favor of the returned promise');const c=a&&
|
|
1094
1094
|
olympe.C.Za().rc(a),d=b&&olympe.C.Za().rc(g=>null==b?void 0:b(`${g}`));a=this.get(olympe.dm.File.j);const e=this.get(olympe.dm.File.urlProp),f=this.get(olympe.dm.File.mimeTypeProp);if(a||(null==e?0:e.startsWith('blob:'))||(null==e?0:e.startsWith('stream:')))return this.j.H(this).then(g=>{g=`data:${f};base64,${this.D.j(g)}`;null==c||c(g);return g}).catch(g=>{null==d||d(g.message);throw g;});if('string'===typeof e)return null==c||c(e),Promise.resolve(e);a=`No content nor URL associated to the file ${this.W()}`;
|
|
1095
|
-
null==d||d(a);return Promise.reject(Error(a))}rename(a,b){const c=b&&olympe.C.Za().rc(b);olympe.C.
|
|
1096
|
-
olympe.dm.File.prototype.saveAs=olympe.dm.File.prototype.
|
|
1095
|
+
null==d||d(a);return Promise.reject(Error(a))}rename(a,b){const c=b&&olympe.C.Za().rc(b);olympe.C.nt([a],d=>{const e=new olympe.dc.Ya;e.update(this,olympe.dc.CloudObject.nameProp,d);e.update(this,olympe.dm.File.fileNameProp,d);e.mb(f=>{c&&c(f)})})}tt(a){this.get(olympe.dm.File.urlProp).startsWith('stream:')?this.j.X(this.tag).then(()=>this.tt(a)).catch(b=>this.G.error(`Error while getting the content of a streamed file: ${b}`)):this.F.H(this.get(olympe.dm.File.mimeTypeProp))}oq(){return this.wb(olympe.dm.File.urlProp)}nq(){return this.wb(olympe.dm.File.fileNameProp)}ny(){return this.Dj(olympe.dm.File.creationDateProp)}Iy(){return this.Dj(olympe.dm.File.modificationDateProp)}mz(){return this.mh(olympe.dm.File.j)}};
|
|
1096
|
+
olympe.dm.File.prototype.saveAs=olympe.dm.File.prototype.tt;olympe.dm.File.prototype.getContentUrl=olympe.dm.File.prototype.hl;olympe.dm.File.prototype.getContentAsString=olympe.dm.File.prototype.Fn;olympe.dm.File.prototype.getContentAsBinary=olympe.dm.File.prototype.gl;olympe.dm.File.O=olympe.dc.na.j('ff021000000000000030',olympe.dm.File,olympe.dc.P.hk,olympe.net.P.Fa,olympe.U.P.Dg);olympe.dm.File.nameProp=olympe.dm.File.O.ja('ff023000000000000050');w('olympe.dm.File.nameProp',olympe.dm.File.nameProp);
|
|
1097
1097
|
olympe.dm.File.fileNameProp=olympe.dm.File.O.ja('ff023000000000000050');w('olympe.dm.File.fileNameProp',olympe.dm.File.fileNameProp);olympe.dm.File.creationDateProp=olympe.dm.File.O.ja('ff023000000000000051');w('olympe.dm.File.creationDateProp',olympe.dm.File.creationDateProp);olympe.dm.File.modificationDateProp=olympe.dm.File.O.ja('ff023000000000000055');w('olympe.dm.File.modificationDateProp',olympe.dm.File.modificationDateProp);olympe.dm.File.mimeTypeProp=olympe.dm.File.O.ja('ff023000000000000052');
|
|
1098
|
-
w('olympe.dm.File.mimeTypeProp',olympe.dm.File.mimeTypeProp);olympe.dm.File.urlProp=olympe.dm.File.O.ja('ff023000000000000053');w('olympe.dm.File.urlProp',olympe.dm.File.urlProp);olympe.dm.File.j=olympe.dm.File.O.ja('ff023000000000000054');olympe.dm.File.O.j=olympe.dm.File.D.bind(null,olympe.dm.File);olympe.dm.File.N='application/data';olympe.dm.File.ya=[olympe.C.File];m=olympe.dm.File.prototype;m.
|
|
1099
|
-
m.
|
|
1100
|
-
olympe.dm.Pd.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.hb=class extends olympe.dm.Rc{j(){return this.cb(olympe.dm.Kb.j,olympe.dm.Kb)}F(){return this.wb(olympe.dm.hb.X)}R(){return this.wb(olympe.dm.hb.lb)}D(){return this.cb(olympe.dm.hb.F,olympe.dm.hb)}};olympe.dm.hb.O=olympe.dc.na.j('0163d9594700fcf61e54',olympe.dm.hb);olympe.dm.hb.X=olympe.dm.hb.O.ja('017869c7d2833c9492c1');olympe.dm.hb.
|
|
1101
|
-
olympe.dm.hb.Ua=olympe.dm.hb.O.ra('ff02200000000000002a');olympe.dm.hb.F=olympe.dm.hb.O.ra('ff02200000000000002b');olympe.dm.hb.Pf=R(olympe.dm.hb.O,olympe.dm.hb.F);olympe.dm.hb.D=olympe.dm.hb.O.ra('ff02200000000000002c');olympe.dm.hb.tg=olympe.dm.hb.O.ra('017e9c412e2b944bc48f');olympe.dm.hb.
|
|
1102
|
-
olympe.dm.hb.Fd=fg('100000000000000000dd','PRIMORDIAL');olympe.dm.hb.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.hb.prototype.F.K=olympe.C.J.D;olympe.dm.hb.prototype.R.K=olympe.C.J.D;olympe.dm.hb.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Property=class extends olympe.dc.CloudObject{j(){return this.Tc(olympe.dm.Property.definingModelRel,olympe.dc.CloudObject)}getType(){return this.Tc(olympe.dm.Property.typeRel,olympe.dc.CloudObject)}D(){return this.vg(olympe.dm.Property.typeRel).Cc()}Xc(){return this.j().ka().
|
|
1103
|
-
w('olympe.dm.Property.definingModelRel',olympe.dm.Property.definingModelRel);olympe.dm.Property.typeRel=R(olympe.dm.Property.O,olympe.dc.CloudObject.typeRel);w('olympe.dm.Property.typeRel',olympe.dm.Property.typeRel);olympe.dm.Property.prototype.j.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.getType.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.D.K=olympe.C.J.j;olympe.dm.Relation=class extends olympe.dc.CloudObject{constructor(a,b){super(a,b)}
|
|
1104
|
-
olympe.dm.Relation.F=olympe.dm.Relation.O.ja('ff023000000000000030');olympe.dm.Relation.D=olympe.dm.Relation.O.ja('ff023000000000000034');olympe.dm.Relation.
|
|
1105
|
-
olympe.dm.Relation.R=olympe.dm.Relation.O.ja('ff023000000000000031');olympe.dm.Relation.originModelRel=R(olympe.dm.Relation.O,olympe.dc.CloudObject.Lj);w('olympe.dm.Relation.originModelRel',olympe.dm.Relation.originModelRel);olympe.dm.Relation.destinationModelRel=R(olympe.dm.Relation.O,olympe.dc.CloudObject.
|
|
1106
|
-
olympe.dm.Relation.H={
|
|
1107
|
-
olympe.dm.
|
|
1108
|
-
olympe.dm.String.prototype.toString.K=olympe.C.J.j;olympe.dm.Boolean=class extends olympe.dm.
|
|
1109
|
-
olympe.V.config(a=>{E(a,olympe.sc.Config.
|
|
1110
|
-
c.set(olympe.sc.xa.j.PRODUCTION,b);return new olympe.sc.xa(c)})},'olympe.sc');olympe.V.run([olympe.sc.P.
|
|
1111
|
-
olympe.sc.
|
|
1112
|
-
olympe.dm.Kb.ia));e=e.concat(a.nh(e[e.length-1],olympe.dm.Rc.R.$b()));e=e.concat(a.nh(e[e.length-1],olympe.dm.Rc.N.$b()));return[...d,...e].reverse()};olympe.sc.
|
|
1113
|
-
olympe.sc.
|
|
1114
|
-
olympe.sc.xa=class{constructor(a=olympe.sc
|
|
1115
|
-
c=e}return c}
|
|
1116
|
-
!1){return new rxjs.Observable(d=>{const e=this.get(a);b||null!==e||d.next(e);const f=this.on(a,d.next.bind(d),c?void 0:this.state.T(),!1);this.onDestroy(()=>{f();d.complete()});return f})}repeat(a,b){const c=qn(this.state,a);a=b.subscribe(d=>{null!==d?this.set(c,d):this.remove(c)});this.vh(a.unsubscribe.bind(a));return this}
|
|
1117
|
-
b,c).pipe(rxjs.operators.first()).subscribe(rxjs.Subscriber.create(d,f=>{let g=`An error occurred while calling \`waitFor(${olympe.dc.ea(a)})\``+`on the context ${this.T()}:\nStack: ${this.
|
|
1118
|
-
const d=(null==(c=a.
|
|
1119
|
-
b){return this.state.vh(a,b)}
|
|
1120
|
-
a?void 0:a.constructor)!==this.constructor?!1:this.state===a.state}
|
|
1121
|
-
olympe.sc.xa.prototype.getEvent=olympe.sc.xa.prototype.
|
|
1122
|
-
olympe.sc.xa.prototype.destroy=olympe.sc.xa.prototype.destroy;olympe.sc.xa.prototype.getOtherContext=olympe.sc.xa.prototype.
|
|
1123
|
-
olympe.sc.xa.prototype.repeat=olympe.sc.xa.prototype.repeat;olympe.sc.xa.prototype.observe=olympe.sc.xa.prototype.observe;olympe.sc.xa.prototype.has=olympe.sc.xa.prototype.has;olympe.sc.xa.prototype.get=olympe.sc.xa.prototype.get;olympe.sc.xa.prototype.remove=olympe.sc.xa.prototype.remove;olympe.sc.xa.prototype.trigger=olympe.sc.xa.prototype.
|
|
1124
|
-
olympe.sc.xa.j={PRODUCTION:'__production',EDITION:'__editionMode',TRANSACTION:'__transaction',REDELIVERED:'__redelivered',Eg:'__htmlContainer',
|
|
1125
|
-
function tn(a,b){if(b===a.id||a.R.has(b)||!b)return a;for(a=a.H;a;){if(b===a.T()||a.R.has(b))return a;const c=yn(a.j,b);if(c)return c;a=a.getParent()}return null}function zn(a,b,c=0){null===a.$a&&(a.$a=new Map);a.$a.has(b.T())||(a.$a.set(b.T(),{
|
|
1126
|
-
function Bn(a,b){if(null===a.$a||!a.$a.has(b))return!1;const {
|
|
1098
|
+
w('olympe.dm.File.mimeTypeProp',olympe.dm.File.mimeTypeProp);olympe.dm.File.urlProp=olympe.dm.File.O.ja('ff023000000000000053');w('olympe.dm.File.urlProp',olympe.dm.File.urlProp);olympe.dm.File.j=olympe.dm.File.O.ja('ff023000000000000054');olympe.dm.File.O.j=olympe.dm.File.D.bind(null,olympe.dm.File);olympe.dm.File.N='application/data';olympe.dm.File.ya=[olympe.C.File];m=olympe.dm.File.prototype;m.Vs.K=olympe.C.J.D;m.gl.K=olympe.C.J.j;m.Fn.K=olympe.C.J.j;m.hl.K=olympe.C.J.j;m.rename.K=olympe.C.J.j;
|
|
1099
|
+
m.oq.K=olympe.C.J.D;m.nq.K=olympe.C.J.D;m.ny.K=new olympe.C.J(()=>olympe.C.eb,[]);m.Iy.K=new olympe.C.J(()=>olympe.C.eb,[]);m.mz.K=olympe.C.J.N;olympe.dm.Pd=class extends olympe.dc.CloudObject{j(){return this.wb(olympe.dm.Pd.D)}F(){return this.xd(olympe.dm.Pd.F)}D(){return this.cb(olympe.dm.Pd.j,olympe.dm.Module)}};olympe.dm.Pd.O=olympe.dc.na.j('ff021000000000000041',olympe.dm.Pd);olympe.dm.Pd.D=olympe.dm.Pd.O.ja('ff023000000000000047');olympe.dm.Pd.F=olympe.dm.Pd.O.ja('ff023000000000000048');olympe.dm.Pd.j=olympe.dm.Module.j.$b();olympe.dm.Pd.prototype.j.K=olympe.C.J.D;olympe.dm.Pd.prototype.F.K=olympe.C.J.F;
|
|
1100
|
+
olympe.dm.Pd.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.hb=class extends olympe.dm.Rc{j(){return this.cb(olympe.dm.Kb.j,olympe.dm.Kb)}F(){return this.wb(olympe.dm.hb.X)}R(){return this.wb(olympe.dm.hb.lb)}D(){return this.cb(olympe.dm.hb.F,olympe.dm.hb)}};olympe.dm.hb.O=olympe.dc.na.j('0163d9594700fcf61e54',olympe.dm.hb);olympe.dm.hb.X=olympe.dm.hb.O.ja('017869c7d2833c9492c1');olympe.dm.hb.ht=olympe.dm.hb.O.ja('017869c7d2833c9492c2');olympe.dm.hb.Qe=olympe.dm.hb.O.ja('017869c7d2833c9492c3');olympe.dm.hb.lb=olympe.dm.hb.O.ja('017869c80bb9929c76d0');
|
|
1101
|
+
olympe.dm.hb.Ua=olympe.dm.hb.O.ra('ff02200000000000002a');olympe.dm.hb.F=olympe.dm.hb.O.ra('ff02200000000000002b');olympe.dm.hb.Pf=R(olympe.dm.hb.O,olympe.dm.hb.F);olympe.dm.hb.D=olympe.dm.hb.O.ra('ff02200000000000002c');olympe.dm.hb.tg=olympe.dm.hb.O.ra('017e9c412e2b944bc48f');olympe.dm.hb.ef=olympe.dm.hb.O.ra('017e9c412e2b944bd590');olympe.dm.hb.bt=olympe.dm.hb.O.ra('017e9c416872a89d3415');olympe.dm.hb.ol=olympe.dm.hb.O.ra('017ebf8fe5c506662098');R(olympe.dc.CloudObject.O,olympe.dm.hb.Ua);
|
|
1102
|
+
olympe.dm.hb.Fd=fg('100000000000000000dd','PRIMORDIAL');olympe.dm.hb.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.hb.prototype.F.K=olympe.C.J.D;olympe.dm.hb.prototype.R.K=olympe.C.J.D;olympe.dm.hb.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.dm.Property=class extends olympe.dc.CloudObject{j(){return this.Tc(olympe.dm.Property.definingModelRel,olympe.dc.CloudObject)}getType(){return this.Tc(olympe.dm.Property.typeRel,olympe.dc.CloudObject)}D(){return this.vg(olympe.dm.Property.typeRel).Cc()}Xc(){return this.j().ka().Es(this.ka())}};olympe.dm.Property.O=olympe.dc.na.j('ff021000000000000005',olympe.dm.Property);olympe.dm.Property.definingModelRel=R(olympe.dm.Property.O,olympe.dc.CloudObject.propertyRel);
|
|
1103
|
+
w('olympe.dm.Property.definingModelRel',olympe.dm.Property.definingModelRel);olympe.dm.Property.typeRel=R(olympe.dm.Property.O,olympe.dc.CloudObject.typeRel);w('olympe.dm.Property.typeRel',olympe.dm.Property.typeRel);olympe.dm.Property.prototype.j.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.getType.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.D.K=olympe.C.J.j;olympe.dm.Relation=class extends olympe.dc.CloudObject{constructor(a,b){super(a,b)}Ey(){return olympe.C.Sa.EMPTY}ey(){return this.xd(olympe.dm.Relation.D)}Oy(){return this.xd(olympe.dm.Relation.F)}Os(){return this.cb(olympe.dm.Relation.destinationModelRel,olympe.dc.CloudObject).Jc()}Xs(){return this.cb(olympe.dm.Relation.originModelRel,olympe.dc.CloudObject).Jc()}Xc(){return this.Xs().ka().concat(['-',this.ka(),'->',this.Os().ka()])}};olympe.dm.Relation.O=olympe.dc.na.j('ff021000000000000006',olympe.dm.Relation);
|
|
1104
|
+
olympe.dm.Relation.F=olympe.dm.Relation.O.ja('ff023000000000000030');olympe.dm.Relation.D=olympe.dm.Relation.O.ja('ff023000000000000034');olympe.dm.Relation.ba=olympe.dm.Relation.O.ja(olympe.dc.Lb.hp);olympe.dm.Relation.X=olympe.dm.Relation.O.ja(olympe.dc.Lb.Dc);olympe.dm.Relation.ia=olympe.dm.Relation.O.ja(olympe.dc.Lb.kg);olympe.dm.Relation.wa=olympe.dm.Relation.O.ja(olympe.dc.Lb.yw);olympe.dm.Relation.Z=olympe.dm.Relation.O.ja(olympe.dc.Lb.ku);olympe.dm.Relation.Ha=olympe.dm.Relation.O.ja(olympe.dc.Lb.Vw);
|
|
1105
|
+
olympe.dm.Relation.R=olympe.dm.Relation.O.ja('ff023000000000000031');olympe.dm.Relation.originModelRel=R(olympe.dm.Relation.O,olympe.dc.CloudObject.Lj);w('olympe.dm.Relation.originModelRel',olympe.dm.Relation.originModelRel);olympe.dm.Relation.destinationModelRel=R(olympe.dm.Relation.O,olympe.dc.CloudObject.Is);w('olympe.dm.Relation.destinationModelRel',olympe.dm.Relation.destinationModelRel);olympe.dm.Relation.j={Xp:0,Ot:5,hw:1,SC:4,es:2,yr:8,gB:10,PC:6,QC:9,Xe:6,RC:9};
|
|
1106
|
+
olympe.dm.Relation.H={tC:3,Ov:4,eC:5,dC:6};olympe.dm.Relation.N=olympe.dm.Gl.Qv+olympe.dm.Gl.gu;m=olympe.dm.Relation.prototype;m.Ey.K=olympe.C.J.D;m.ey.K=olympe.C.J.F;m.Oy.K=olympe.C.J.F;m.Os.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.Xs.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);function ln(a){a=olympe.dc.ea(a);if(olympe.dc.ha().Vf(a,olympe.dm.String))return olympe.dm.String.valueProp;switch(a){case olympe.dm.Number.O.W():return olympe.dm.Number.valueProp;case olympe.dm.Boolean.O.W():return olympe.dm.Boolean.valueProp;case olympe.dm.DateTime.O.W():return olympe.dm.DateTime.valueProp;case olympe.dm.Color.O.W():return olympe.dm.Color.valueProp;default:throw Error('Unknown primitive model: '+a);}}olympe.dm.Je=class extends olympe.dc.CloudObject{getValue(){}};
|
|
1107
|
+
olympe.dm.Je.O=olympe.dc.na.j('ff021000000000000019',olympe.dm.Je);olympe.dm.String=class extends olympe.dm.Je{getValue(){return this.wb(olympe.dm.String.valueProp)}tc(){return this.get(olympe.dm.String.valueProp)}toString(){let a;return null!=(a=this.get(olympe.dm.String.valueProp))?a:''}};olympe.dm.String.O=olympe.dc.na.j('ff021000000000000011',olympe.dm.String);olympe.dm.String.valueProp=olympe.dm.String.O.ja('ff023000000000000026');w('olympe.dm.String.valueProp',olympe.dm.String.valueProp);olympe.dm.String.prototype.getValue.K=olympe.C.J.D;
|
|
1108
|
+
olympe.dm.String.prototype.toString.K=olympe.C.J.j;olympe.dm.Boolean=class extends olympe.dm.Je{getValue(){return this.mh(olympe.dm.Boolean.valueProp)}tc(){return this.get(olympe.dm.Boolean.valueProp)}};olympe.dm.Boolean.O=olympe.dc.na.j('ff021000000000000012',olympe.dm.Boolean);olympe.dm.Boolean.valueProp=olympe.dm.Boolean.O.ja('ff023000000000000027');w('olympe.dm.Boolean.valueProp',olympe.dm.Boolean.valueProp);olympe.dm.Boolean.prototype.getValue.K=olympe.C.J.N;olympe.dm.Color=class extends olympe.dm.Je{getValue(){return this.Ys()}tc(){return this.get(olympe.dm.Color.valueProp)}};olympe.dm.Color.O=olympe.dc.na.j('ff021000000000000017',olympe.dm.Color);olympe.dm.Color.valueProp=olympe.dm.Color.O.ja('ff023000000000000032');w('olympe.dm.Color.valueProp',olympe.dm.Color.valueProp);olympe.dm.Color.prototype.getValue.K=new olympe.C.J(()=>olympe.C.Color,[]);olympe.dm.DateTime=class extends olympe.dm.Je{getValue(){return this.Dj(olympe.dm.DateTime.valueProp)}tc(){return this.get(olympe.dm.DateTime.valueProp)}};olympe.dm.DateTime.O=olympe.dc.na.j('ff021000000000000014',olympe.dm.DateTime);olympe.dm.DateTime.valueProp=olympe.dm.DateTime.O.ja('ff023000000000000029');w('olympe.dm.DateTime.valueProp',olympe.dm.DateTime.valueProp);olympe.dm.DateTime.prototype.getValue.K=new olympe.C.J(()=>olympe.C.eb,[]);olympe.dm.Enum=class extends olympe.dm.String{ka(){return olympe.C.sa([super.ka(),super.getValue()],(a,b)=>''!==a.valueOf()?a:b,olympe.C.Sa)}Hd(){return this.xd(olympe.dm.Enum.rankProp)}};olympe.dm.Enum.O=olympe.dc.na.j('016cdd861b32d56c81f7',olympe.dm.Enum);olympe.dm.Enum.rankProp=olympe.dm.Enum.O.ja('017a7690c915975ea995');olympe.dm.Enum.prototype.Hd.K=olympe.C.J.F;olympe.dm.gg=class extends olympe.dm.BrickMetadata{bz(){return this.bb(olympe.dc.CloudObject.instancesRel).Al(olympe.dm.Enum.rankProp,olympe.dc.query.Bk.ASC).Cc()}static create(a,b){b=a.create(olympe.dm.gg,(new Map).set(olympe.dc.CloudObject.nameProp,b));a.Oa(olympe.dc.CloudObject.extendRel,b,olympe.dm.Enum);return b}};olympe.dm.gg.create=olympe.dm.gg.create;olympe.dm.gg.prototype.getValues=olympe.dm.gg.prototype.bz;olympe.dm.gg.O=olympe.dc.na.j('017a768f966fc08ebb98',olympe.dm.gg);olympe.dm.Number=class extends olympe.dm.Je{getValue(){return this.xd(olympe.dm.Number.valueProp)}tc(){return this.get(olympe.dm.Number.valueProp)}};olympe.dm.Number.O=olympe.dc.na.j('ff021000000000000013',olympe.dm.Number);olympe.dm.Number.valueProp=olympe.dm.Number.O.ja('ff023000000000000028');w('olympe.dm.Number.valueProp',olympe.dm.Number.valueProp);olympe.dm.Number.prototype.getValue.K=olympe.C.J.F;olympe.sc={};olympe.sc.P={Da:'sc.Logger',Kk:'sc.RootContext',Me:'sc.Serializer'};olympe.sc.Config={ze:'sc.app',bg:'sc.debug',lo:'sc.autostartProfiler',ep:'sc.debugger',hu:'sc.disableTheme',PRODUCTION:'sc.production',Pv:'sc.onstartTimeout',tr:'sc.remoteActionTimeout'};
|
|
1109
|
+
olympe.V.config(a=>{E(a,olympe.sc.Config.ze,'');E(a,olympe.sc.Config.bg,!1);E(a,olympe.sc.Config.hu,!0);E(a,olympe.sc.Config.PRODUCTION,!1);E(a,olympe.sc.Config.Pv,2E4);E(a,olympe.sc.Config.tr,3E4);E(a,olympe.sc.Config.lo,!1);D(a,olympe.sc.P.Da,[olympe.ga.P.Fa],b=>b.ad('sc'));C(a,olympe.sc.P.Me,olympe.sc.cc,olympe.dc.db.P.Fa);Wa(a,olympe.dc.sources.P.Me,olympe.sc.P.Me);D(a,olympe.sc.P.Kk,[new olympe.V.oa(olympe.sc.Config.PRODUCTION)],b=>{const c=new olympe.sc.Fg('root','root',null);olympe.sc.Xn=c;
|
|
1110
|
+
c.set(olympe.sc.xa.j.PRODUCTION,b);return new olympe.sc.xa(c)})},'olympe.sc');olympe.V.run([olympe.sc.P.Kk,new olympe.V.oa(olympe.L.Config.Rl)],(a,b)=>{olympe.de().ctx=a;olympe.de().oVersion=()=>b});olympe.sc.Rn=()=>null!==olympe.dc.ha().Ib(void 0,olympe.sc.Runnable.j.$b());olympe.sc.RE=(a,b,c,d)=>{c=X(X(a.create(olympe.sc.gd),olympe.sc.gd.j,c||null),olympe.sc.gd.F,d||null);a.Oa(olympe.sc.gd.D,c,b);a.Oa(olympe.dc.CloudObject.containsRel,b,c);return c.W()};olympe.sc.tj=(a,b)=>{a=olympe.dc.ib.gy(b)(a);return a instanceof olympe.sc.Td?a.j():a};
|
|
1111
|
+
olympe.sc.iF=function(a){const b=olympe.dc.CloudObject.containsRel.$b();var c=olympe.dc.ea(a);if(void 0===c)return[];a=olympe.dc.ha();const d=[];let e=[];const f=new Set;for(;!a.Nb(c,olympe.dm.Kb);){f.add(c);const g=a.Ib(c,b);if(null===g)return olympe.ga.Wa('sc').warn(`Object ${c} has no container`),[];a.Nb(c,olympe.sc.logic.pb)||g===a.Ib(c,olympe.sc.Runnable.j.$b())||d.push(c);c=g;if(f.has(c))throw Error(`Instance ${c} (${a.name(c)}) is part of a cyclic contain pattern`);}e.push(c);e=e.concat(a.nh(e[0],
|
|
1112
|
+
olympe.dm.Kb.ia));e=e.concat(a.nh(e[e.length-1],olympe.dm.Rc.R.$b()));e=e.concat(a.nh(e[e.length-1],olympe.dm.Rc.N.$b()));return[...d,...e].reverse()};olympe.sc.jF=a=>{a=a&&a.valueOf()||'';return a.startsWith('image/')?olympe.sc.Kg:a.startsWith('video/')?olympe.sc.bi:a.startsWith('font/')||a.startsWith('application/font-woff')?olympe.sc.Pc:olympe.dm.File};
|
|
1113
|
+
olympe.sc.hF=a=>a instanceof olympe.sc.Kg?'image/*':a instanceof olympe.sc.bi?'video/*':a instanceof olympe.sc.Pc?'font/*,application/font-woff':null;olympe.sc.$a={};function mn(a,b){var c=olympe.sc.xa,d=a.state;a=a.Cb();b=olympe.dc.ea(b);let e,f=null==(e=d.j)?void 0:e.get(b);if(!f){f=d.ji(a,void 0,b);for(d=f.getParent();d&&d.ia&&!d.id.startsWith('_');)d=d.getParent();let g;null==(g=d)||nn(g,b,f)}return new c(f)}function on(a,b){let c,d;return(a=null!=(d=null==(c=a.state.j)?void 0:c.get(olympe.dc.ea(b)))?d:null)?new olympe.sc.xa(a):null}function pn(a){let b;return null!=(b=a.Qa(olympe.sc.xa.j.PRODUCTION))?b:!1}
|
|
1114
|
+
olympe.sc.xa=class{constructor(a=olympe.sc.Xn){this.state=a;this.G=olympe.ga.Wa('sc');this.j=null}T(){return this.state.T()}getParent(){if(null===this.j){const a=this.state.getParent();this.j=null===a?null:new olympe.sc.xa(a)}return this.j}hy(a){const b=olympe.dc.ha();let c=this.getParent();if(!c)return this;const d=e=>{e=e.kf();if('string'!==typeof e)return!1;const f=b.model(e);return f&&b.Pa(f,olympe.sc.Va.Z)||a.modelTag&&!b.Nb(e,a.modelTag)?!1:!0};for(;c&&!d(c);){const e=c.getParent();if(!e)break;
|
|
1115
|
+
c=e}return c}kf(){return this.state.kf()}Cb(){return this.state.Cb()}set(a,b){this.state.set(a,b);return this}fo(a){return this.set(a,Date.now())}remove(a){this.set(a,null)}tb(a,b,c=!1){const d=olympe.dc.ea(a),e=olympe.C.bc(null!=b?b:Object,`Get context value flow source of ${d}`);e.getContext().onDestroy(this.on(a,f=>{null===f?e.clear():e.update(f)},c?this.state.T():void 0));return e.tb()}get(a,b=!1){a=this.Qa(a,b);return void 0!==a?a:null}has(a,b=!1){return this.state.has(a,b)}observe(a,b=!0,c=
|
|
1116
|
+
!1){return new rxjs.Observable(d=>{const e=this.get(a);b||null!==e||d.next(e);const f=this.on(a,d.next.bind(d),c?void 0:this.state.T(),!1);this.onDestroy(()=>{f();d.complete()});return f})}repeat(a,b){const c=qn(this.state,a);a=b.subscribe(d=>{null!==d?this.set(c,d):this.remove(c)});this.vh(a.unsubscribe.bind(a));return this}dA(a){a=a instanceof olympe.sc.Runnable?a:this.get(a);if(!a)return null;const b=this.ji(`Runner ${a.name()}`);a.run(b);return b}Dt(a,b=!0,c=!1){return new Promise((d,e)=>{this.observe(a,
|
|
1117
|
+
b,c).pipe(rxjs.operators.first()).subscribe(rxjs.Subscriber.create(d,f=>{let g=`An error occurred while calling \`waitFor(${olympe.dc.ea(a)})\``+`on the context ${this.T()}:\nStack: ${this.se()}\n${f}`;f instanceof rxjs.EmptyError&&(g=`The context ${this.T()} has been destroyed while a Promise `+`created from a call to \`waitFor(${olympe.dc.ea(a)})\` `+`has never received any value:\nStack: ${this.se()}`);e(Error(g))}))})}throw(a){var b=a instanceof Error?a.message:String(a);if(a instanceof Error){var c;
|
|
1118
|
+
const d=(null==(c=a.se)?void 0:c.call(a))||this.se();let e,f;c=null!=(f=null==(e=a.Aj)?void 0:e.call(a))?f:0;b=rn(b,c,d);b.stack=a.stack}else b=rn(b,0,this.se());sn(this.state,b);return this}eA(a){this.set(olympe.sc.xa.j.Eg,a);return this}Qa(a,b=!0){return this.state.Qa(a,b)}on(a,b,c,d=!0){return this.state.on(a,b,c,d)}ji(a){return new olympe.sc.xa(this.state.ji(this.Cb(),a))}vl(a,b){return this.state.vl(a,c=>{b(new olympe.sc.xa(c))})}My(a){a=tn(this.state,a);return a===this.state?this:a&&new olympe.sc.xa(a)}destroy(){this.state.destroy()}vh(a,
|
|
1119
|
+
b){return this.state.vh(a,b)}tl(a){this.state.tl(a)}onDestroy(a){return this.fb()?(a(),'noId'):this.Cb().onDestroy(a)}Xf(a){this.fb()||this.Cb().Xf(a)}clear(){this.state.clear()}fb(){return this.Cb().fb()||this.Cb().jd()}Pa(a){a=un(this.state,a);return null!==a?new olympe.sc.ui.OA(a,this):null}xy(a){a=un(this.state,a);return null!==a?new olympe.sc.ui.NA(a,this):null}Hz(...a){return rxjs.combineLatest(a.map(b=>{b=un(this.state,b);return null!==b?this.observe(b):rxjs.of(null)}))}Ea(a){return(null==
|
|
1120
|
+
a?void 0:a.constructor)!==this.constructor?!1:this.state===a.state}se(){const a=olympe.dc.ha();let b;try{const c=[this];let d=this.getParent();for(;null!==d&&d.state!==olympe.sc.Xn;)c.push(d),d=d.getParent();b='> '+c.map(e=>{const f=e.kf();return null!==f?(e=a.model(f),`${a.name(f)||e&&a.name(e)||f} (${e})`):e.T()}).join('\n> ')}catch(c){b=`No stack available for context ${this.T()}: ${c}`,this.G.warn(b)}return b}};olympe.sc.xa.prototype.observeMany=olympe.sc.xa.prototype.Hz;
|
|
1121
|
+
olympe.sc.xa.prototype.getEvent=olympe.sc.xa.prototype.xy;olympe.sc.xa.prototype.getProperty=olympe.sc.xa.prototype.Pa;olympe.sc.xa.prototype.isDestroyed=olympe.sc.xa.prototype.fb;olympe.sc.xa.prototype.clear=olympe.sc.xa.prototype.clear;olympe.sc.xa.prototype.offDestroy=olympe.sc.xa.prototype.Xf;olympe.sc.xa.prototype.onDestroy=olympe.sc.xa.prototype.onDestroy;olympe.sc.xa.prototype.offClear=olympe.sc.xa.prototype.tl;olympe.sc.xa.prototype.onClear=olympe.sc.xa.prototype.vh;
|
|
1122
|
+
olympe.sc.xa.prototype.destroy=olympe.sc.xa.prototype.destroy;olympe.sc.xa.prototype.getOtherContext=olympe.sc.xa.prototype.My;olympe.sc.xa.prototype.onContext=olympe.sc.xa.prototype.vl;olympe.sc.xa.prototype.createChild=olympe.sc.xa.prototype.ji;olympe.sc.xa.prototype.setParentElement=olympe.sc.xa.prototype.eA;olympe.sc.xa.prototype['throw']=olympe.sc.xa.prototype.throw;olympe.sc.xa.prototype.waitFor=olympe.sc.xa.prototype.Dt;olympe.sc.xa.prototype.runner=olympe.sc.xa.prototype.dA;
|
|
1123
|
+
olympe.sc.xa.prototype.repeat=olympe.sc.xa.prototype.repeat;olympe.sc.xa.prototype.observe=olympe.sc.xa.prototype.observe;olympe.sc.xa.prototype.has=olympe.sc.xa.prototype.has;olympe.sc.xa.prototype.get=olympe.sc.xa.prototype.get;olympe.sc.xa.prototype.remove=olympe.sc.xa.prototype.remove;olympe.sc.xa.prototype.trigger=olympe.sc.xa.prototype.fo;olympe.sc.xa.prototype.set=olympe.sc.xa.prototype.set;olympe.sc.xa.prototype.getClosest=olympe.sc.xa.prototype.hy;olympe.sc.xa.prototype.getParent=olympe.sc.xa.prototype.getParent;
|
|
1124
|
+
olympe.sc.xa.j={PRODUCTION:'__production',EDITION:'__editionMode',TRANSACTION:'__transaction',REDELIVERED:'__redelivered',Eg:'__htmlContainer',bB:'__dockableElement',jo:'__appHasStarted'};olympe.sc.Zw=class extends olympe.sc.xa{constructor(a){super(a);this.D=new olympe.C.Xb('SC Update Context',super.Cb());const b=a.vh(()=>{b&&a.tl(b);this.D.destroy()})}Cb(){return this.D}vh(a,b){return this.Cb().onDestroy(a,null!=b?b:olympe.U.Lc())}};let vn=0;function qn(a,b){b=olympe.dc.ea(b);let c,d,e,f;return null!=(f=null!=(e=null==(c=a.Z)?void 0:c.get('I#'+b))?e:null==(d=a.Z)?void 0:d.get('IO#'+b))?f:b}function sn(a,b){if(null===a.H)a.G.error(`An error occurred in a brick: ${b.toString()}`);else if(a.ba&&olympe.dc.ha().Ja(a.ba)){var c=wn(olympe.dc.CloudObject.get(a.ba));null!==c&&xn(a,c).some(d=>{let e,f;return 0<(null==(e=a.F)?void 0:null==(f=e.get(d))?void 0:f.size)})&&!a.N.has('$'+c)?a.set(c,b):sn(a.H,b)}else sn(a.H,b)}
|
|
1125
|
+
function tn(a,b){if(b===a.id||a.R.has(b)||!b)return a;for(a=a.H;a;){if(b===a.T()||a.R.has(b))return a;const c=yn(a.j,b);if(c)return c;a=a.getParent()}return null}function zn(a,b,c=0){null===a.$a&&(a.$a=new Map);a.$a.has(b.T())||(a.$a.set(b.T(),{wl:b,depth:c}),An(a,d=>{(-1===b.F||c<b.F)&&zn(d,b,c+1)}),a.onDestroy(()=>{Bn(a,b.T())}));return b.T()}
|
|
1126
|
+
function Bn(a,b){if(null===a.$a||!a.$a.has(b))return!1;const {wl:c,depth:d}=a.$a.get(b);An(a,f=>{Bn(f,b)});0===d&&c.D();const e=a.$a.delete(b);0===a.$a.size&&(a.$a=null);return e}function un(a,b){let c;return(null==(c=a.Z)?void 0:c.get('IO#'+b))||null}
|
|
1127
1127
|
function Cn(a){a.D.Xd(()=>{An(a,c=>c.destroy())});a.D.onDestroy(()=>{void 0!==a.Qa(olympe.sc.xa.j.TRANSACTION,!1)&&a.G.warn(`The context ${a.T()} is being destroyed but still has unreleased transactions. You probably forgot to end a transaction.`);a.clear();let c;if(null!=(c=a.H)){let d;null==(d=c.j)||d.delete(a.T());let e;0===(null==(e=c.j)?void 0:e.size)&&(c.j=null)}a.R.clear()});let b;null==(b=a.H)||Dn(b,a)}
|
|
1128
|
-
function yn(a,b){if(null===a)return null;if(a.has(b))return a.get(b);for(const c of a.values())if(c.ia&&!c.id.startsWith('_')&&(a=yn(c.j,b)))return a;return null}function En(a,b,...c){if(null!==a.$a)for(const {
|
|
1128
|
+
function yn(a,b){if(null===a)return null;if(a.has(b))return a.get(b);for(const c of a.values())if(c.ia&&!c.id.startsWith('_')&&(a=yn(c.j,b)))return a;return null}function En(a,b,...c){if(null!==a.$a)for(const {wl:d,depth:e}of a.$a.values())d.process(a,b,e,...c)}function Fn(a,b){a.ba=olympe.dc.ea(b);a.ia=b.wd().Rn();b.H().forEach(c=>{a.id===c||a.R.has(c)||(a.R.add(c),nn(a,c,a))});a.Z=b.D();En(a,olympe.sc.$a.pc.j.INIT)}function Gn(a){a.wa=!0;let b;null==(b=a.j)||b.forEach(c=>{Gn(c)})}
|
|
1129
1129
|
function Hn(a){a.wa=!1;let b;null==(b=a.j)||b.forEach(c=>{Hn(c)})}function xn(a,b){return['*',a.id,...a.R].map(c=>`${'@'}${c}.${b}`)}function In(a,b,c,d){c.forEach(f=>{let g,h;null==(g=a.F)||null==(h=g.get(f))||h.forEach(k=>{k(d)})});let e;null==(e=a.j)||e.forEach(f=>{!f.wa&&f.data.has(b)||In(f,b,c,d)})}function Jn(a,b,c){a.F||(a.F=new Map);let d=a.F.get(b);void 0===d&&(d=new Map,a.F.set(b,d));vn++;const e=vn;d.set(e,c);return()=>{const f=a.F.get(b);f&&(f.delete(e),0===f.size&&a.F.delete(b))}}
|
|
1130
|
-
function nn(a,b,c){a.N.add(b);let d,e;null==(d=a.F)||null==(e=d.get('&'+b))||e.forEach(f=>{f(c)});An(a,f=>{f.N.has(b)||nn(f,b,c)});a.N.delete(b)}function An(a,b){let c;null==(c=a.j)||c.forEach(b)}function Kn(a,b){a.data.forEach((c,d)=>b(c,d.slice(1)))}function Ln(a){var b=olympe.sc.$a.pc.D
|
|
1131
|
-
olympe.sc.Fg=class{constructor(a,b='no name',c=olympe.sc
|
|
1130
|
+
function nn(a,b,c){a.N.add(b);let d,e;null==(d=a.F)||null==(e=d.get('&'+b))||e.forEach(f=>{f(c)});An(a,f=>{f.N.has(b)||nn(f,b,c)});a.N.delete(b)}function An(a,b){let c;null==(c=a.j)||c.forEach(b)}function Kn(a,b){a.data.forEach((c,d)=>b(c,d.slice(1)))}function Ln(a){var b=olympe.sc.$a.pc.D.Ze;const c=[];if(null!==a.$a)for(const {wl:d}of a.$a.values())d.getType()===b&&(c.push(d.T()),d.D(),Bn(a,d.T()))}function Dn(a,b){null===a.j&&(a.j=new Map);a.j.set(b.id,b)}
|
|
1131
|
+
olympe.sc.Fg=class{constructor(a,b='no name',c=olympe.sc.Xn){this.id=a;this.$c=b;this.R=new Set;this.H=c;this.D=new olympe.C.Xb('SC Context');this.data=new Map;this.ba=this.X=this.j=this.F=null;this.ia=!1;this.N=new Set;this.wa=!1;this.Z=null;this.G=olympe.ga.Wa('sc');this.$a=null;Cn(this)}T(){return this.id}getParent(){return this.H}kf(){return this.ba}set(a,b){if(!this.D.jd()&&!this.D.fb()){const g=olympe.dc.ea(a);var c,d;let h,k;a=null!=(k=null!=(h=null==(c=this.Z)?void 0:c.get('O#'+g))?h:null==
|
|
1132
1132
|
(d=this.Z)?void 0:d.get('IO#'+g))?k:g;c='$'+a;var e;d=null!=(e=this.data.get(c))?e:null;b=null!=b?b:null;if(e=!this.N.has(c)){a:{if('function'===typeof(null==b?void 0:b.Ea))try{var f=b.Ea(d);break a}catch(l){f=!1;break a}f=b===d}e=!f}e&&(null===b?this.data.delete(c):this.data.set(c,b),null!==this.$a&&0<this.$a.size&&En(this,olympe.sc.$a.pc.j.Yg,a,b),f=xn(this,a),this.N.add(c),In(this,c,f,b),this.N.delete(c))}}on(a,b,c,d=!0){if(this.D.fb()||this.D.jd())return()=>{};const e=qn(this,a),f=c?olympe.dc.ea(c):
|
|
1133
1133
|
'*';a=Jn(this,'@'+f+'.'+e,b);c=c?(c=tn(this,f))?c.Qa(e,!1):void 0:this.Qa(e);void 0!==c&&b(c);if(d)olympe.C.Za().onDestroy(a);return a}has(a,b=!1){a='$'+qn(this,a);let c=this.data.has(a),d=this.getParent();if(b)for(;!c&&d;)c=d.data.has(a),d=d.getParent();return c}ji(a,b,c){const d=null!=c?c:'_'+olympe.U.Lc();if(a.fb()||a.jd())throw Error(`Try to create new child context in a destroyed context ${a.T()}, probably because \`runner()\` is called on a destroyed context`);const e=a.run(()=>new olympe.sc.Fg(d,
|
|
1134
|
-
b,this));null!==this.$a&&0<this.$a.size&&this.$a.forEach(({
|
|
1135
|
-
else return vn++,b=null!=b?b:String(vn),null===this.X&&(this.X=new Map),this.X.set(b,a),b;return b||'noId'}
|
|
1136
|
-
t])})};b.
|
|
1137
|
-
c);this.N.listen().subscribe(e=>{var f=e.body();if(f.t===olympe.sc.$d.j.
|
|
1138
|
-
d){const e=[],f=olympe.dc.
|
|
1139
|
-
b||void 0===b)return'<null>';const c=olympe.dc.
|
|
1140
|
-
'<br> ',f+='Properties:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+' : '+c.Pa(b.W(),g)+'<br>'}));d=e.filter(([g])=>g instanceof olympe.sc.Ac);0!==d.length&&(f+=' ',f+='Relations:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+'<br>'}));return f}return b.toString()}};olympe.sc.$d.H='discovery_debug_id';olympe.sc.$d.j={
|
|
1134
|
+
b,this));null!==this.$a&&0<this.$a.size&&this.$a.forEach(({wl:f,depth:g})=>{(-1===f.F||g<f.F)&&zn(e,f,g+1)});return e}vl(a,b){const c=tn(this,a);if(c)return b(c),()=>{};const d=Jn(this,'&'+a,e=>{let f;null==(f=d)||f();b(e)});return d}Qa(a,b=!0){a='$'+qn(this,a);let c=this.data.get(a),d=this.getParent();if(b)for(;void 0===c&&null!==d;)c=d.data.get(a),d=d.getParent();return c}destroy(){this.D.jd()||this.D.fb()||(En(this,olympe.sc.$a.pc.j.dk),this.D.destroy(),En(this,olympe.sc.$a.pc.j.Zd))}vh(a,b){if(this.D.fb())a();
|
|
1135
|
+
else return vn++,b=null!=b?b:String(vn),null===this.X&&(this.X=new Map),this.X.set(b,a),b;return b||'noId'}tl(a){null!==this.X&&this.X.delete(a)}onDestroy(a){return this.fb()?(a(),'noId'):this.D.onDestroy(a)}clear(){if(!this.D.fb()){En(this,olympe.sc.$a.pc.j.Xj);let a;null==(a=this.X)||a.forEach(b=>b());En(this,olympe.sc.$a.pc.j.Yj)}}fb(){return this.D.fb()}Cb(){return this.D}};olympe.sc.Fg.prototype.getParent=olympe.sc.Fg.prototype.getParent;olympe.sc.Fg.j={um:'I#',Lm:'O#',VB:'IO#'};function Mn(a,b,c){return(c=c.kf())?`${a}.${c}.${b}`:`${a}.${b}`}olympe.sc.$a.pc=class{constructor(a=-1){this.id=olympe.U.hf();this.active=!0;this.F=a}D(){this.active=!1}T(){return this.id}getType(){}process(){}};olympe.sc.$a.pc.j={INIT:'INIT',Yg:'SET',Xj:'CLEAR',Yj:'CLEARED',dk:'DESTROY',Zd:'DESTROYED'};olympe.sc.$a.pc.D={Ze:'REMOTE',tv:'LOCAL',jg:'PROFILER'};olympe.sc.$d=class a{constructor(){this.D=this.H=this.N=null;this.R=new Map;this.F=new Map;this.j=new olympe.U.fn(1E4);gb(this.j,b=>{Ln(b)})}Z(b,c,d){const e=b.body(),f=e.c,g=this.R.get(f);switch(e.t){case olympe.sc.$d.j.Uv:c=this.F.get(e.f);b.cd(c).catch(l=>{d.error('Unable to reply with paths: ',l)});break;case olympe.sc.$d.j.Vv:const h=f+c,k=(l,n,p=0)=>{Kn(l,(q,r)=>{let t;q instanceof olympe.dc.CloudObject?t=a.F(q):t=q;let v;q=null!=(v=l.kf())?v:'';0<q.length&&(q+='.');n.push([`${p}.${q}${r}`,
|
|
1136
|
+
t])})};b.Un(h).then(()=>{const l=[];k(g,l,0);An(g,p=>{k(p,l,1)});olympe.L.qb.ld(h,{t:olympe.sc.$d.j.Ju,v:l,ts:0}).catch(p=>{d.error('Error publishing on service : ',p)});const n=new olympe.sc.$a.kw(h);zn(g,n);this.j.has(g)?fb(this.j,g):this.j.add(g)}).catch(l=>{d.error('Error notifying on a contextId : ',l)});break;case olympe.sc.$d.j.Wv:void 0!==g&&this.j.has(g)&&fb(this.j,g);break;case olympe.sc.$d.j.Eh:void 0!==g&&(this.j.delete(g),Ln(g))}}ba(b,c,d){this.N=new olympe.L.qb('discovery_debug_id',
|
|
1137
|
+
c);this.N.listen().subscribe(e=>{var f=e.body();if(f.t===olympe.sc.$d.j.iu){e=f.i;f=f.f;if(!this.F.has(f)){const g=this.X(f,c,b);if(0!==g.length)this.F.set(f,g);else return}null===this.D&&(this.D=olympe.U.hf(),f=new olympe.C.Xb(this.D,c.Cb()),this.H=new olympe.L.qb(this.D,f),this.H.listen().subscribe(g=>{this.Z(g,b,d)}));olympe.L.qb.ld(e,{t:olympe.sc.$d.j.Et,n:olympe.V.getParameter(olympe.sc.Config.ep)||'no name',a:b,s:this.D}).catch(g=>{d.error('Error publishing on draw service : '+g)})}})}X(b,c,
|
|
1138
|
+
d){const e=[],f=olympe.dc.ha(),g=(h,k)=>{An(h,l=>{if(null!==l.kf()){const n=olympe.dc.CloudObject.get(l.kf()).vg(olympe.sc.Runnable.D).Cc();if(null!==n){const p=k+'/'+f.name(n);n.W()===b&&(e.push([p,l.T()]),this.R.set(l.T(),l));g(l,p)}}})};g(c.state,f.name(d));return e}static D(b,c,d){let e=d;d instanceof olympe.dc.CloudObject&&(e=a.F(d));olympe.L.qb.ld(b,{t:olympe.sc.$d.j.Xk,k:c,v:e,ts:Date.now()}).catch(f=>{olympe.ga.Wa('Debugger').error('Error publishing on service : ',f)})}static F(b){if(null===
|
|
1139
|
+
b||void 0===b)return'<null>';const c=olympe.dc.ha();if(b instanceof olympe.dc.CloudObject){var d=b.Wb();if(!c.Nb(d,olympe.sc.Ac))return b.toString();let f=`${b.Vb().name()} (${b.W()})`;var e=olympe.dc.CloudObject.get(d);d=olympe.dc.la.from(e).ug(olympe.dc.CloudObject.extendRel,!0).me().bb(olympe.dc.CloudObject.propertyRel).me().Cc();e=olympe.dc.la.from(e).ug(olympe.dc.CloudObject.extendRel,!0).me().bb(olympe.dc.CloudObject.Lj).me().Cc();d=d.filter(([g])=>g instanceof olympe.sc.Ac);0!==d.length&&(f+=
|
|
1140
|
+
'<br> ',f+='Properties:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+' : '+c.Pa(b.W(),g)+'<br>'}));d=e.filter(([g])=>g instanceof olympe.sc.Ac);0!==d.length&&(f+=' ',f+='Relations:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+'<br>'}));return f}return b.toString()}};olympe.sc.$d.H='discovery_debug_id';olympe.sc.$d.j={iu:0,Et:1,Uv:2,Vv:3,Ju:4,Xk:5,Wv:6,Eh:7};olympe.sc.$a.cC=class extends olympe.sc.$a.pc{constructor(a=-1){super(a);this.j=new Map}getType(){return olympe.sc.$a.pc.D.tv}process(a,b,c,...d){if(this.active&&b===olympe.sc.$a.pc.j.Yg){a=Mn(c,qn(a,d[0]),a);d=d[1];let e;null==(e=this.j.get(a))||e(d)}}on(a,b){this.j.set(a,b)}};function Nn(a,b,c,d=new Map){for(var e=[];b;){const n=b.kf();if(!n)break;e.push(n);b=b.getParent()}rb(a.j,c,d.set('context',e));var f;let g;for(const n of[...e,null==(f=d)?void 0:f.get('propId'),null==(g=d)?void 0:g.get('type')])if(c=n,'string'===typeof c&&!a.H.has(c)){e=a;f=c;e.ha||(e.ha=olympe.dc.ha());d=e.ha.name(f);e=(f=e.ha.model(f))?e.ha.name(f):'';var [h,k,l]=[d,f,e];d=a.j;e=(new Map).set(c,h).set(k,l);c=(new Map).set(c,k);for(const [p,q]of e.entries())d.N.set(p,q);for(const [p,q]of c.entries())d.H.set(p,
|
|
1141
1141
|
q)}}
|
|
1142
|
-
olympe.sc.$a.
|
|
1143
|
-
Nn(this,a,b?e:d?f:c,new Map([['propId',q],['value',r],['type',g]]))):d&&(e=this.
|
|
1144
|
-
const On={
|
|
1145
|
-
e,f)});this.j.set(e,()=>{kh(this.db,f,h)})}olympe.sc.$d.D(this.H,e,f)}}};olympe.sc.Metadata=class extends olympe.dc.CloudObject{
|
|
1146
|
-
olympe.sc.td.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.sc.td.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);function Pn(a,b){[].forEach(c=>c.call(a,b,(d,e)=>{null===e?b.remove(d):b.set(d,e)}))}function Qn(a,b){b=b.filter(c=>'string'===typeof c&&a.db.
|
|
1147
|
-
olympe.sc.Va=class extends olympe.dm.BrickMetadata{
|
|
1142
|
+
olympe.sc.$a.dw=class extends olympe.sc.$a.pc{constructor(a){super();this.j=a;this.ha=olympe.dc.ha();this.H=new Set}getType(){return olympe.sc.$a.pc.D.jg}process(a,b,c,...d){var e=On.um,f=On.Lm,g=On.Zv;const h=On.INIT,k=On.Xj,l=On.Yj,n=On.dk,p=On.Zd;c=On.Rv;if(b===olympe.sc.$a.pc.j.Yg){const [q,r]=d;b=(d=a.kf())?olympe.dc.ha().Nb(d,olympe.sc.logic.Function):!1;d=d?olympe.dc.ha().Nb(d,olympe.sc.ui.UC):!1;b?(g=this.ha.Ib(q,olympe.dm.Property.typeRel),b=this.ha.Nb(q,olympe.sc.logic.ub),d=this.ha.Nb(q,olympe.sc.logic.Fb),
|
|
1143
|
+
Nn(this,a,b?e:d?f:c,new Map([['propId',q],['value',r],['type',g]]))):d&&(e=this.ha.Nb(q,olympe.dm.Property),f=this.ha.Ib(q,olympe.dm.Property.typeRel),Nn(this,a,e?g:c,new Map([['propId',q],['value',r],['type',f]])))}else b===olympe.sc.$a.pc.j.INIT?Nn(this,a,h):b===olympe.sc.$a.pc.j.Xj?Nn(this,a,k):b===olympe.sc.$a.pc.j.Yj?Nn(this,a,l):b===olympe.sc.$a.pc.j.dk?Nn(this,a,n):b===olympe.sc.$a.pc.j.Zd&&Nn(this,a,p)}};
|
|
1144
|
+
const On={um:'input',Lm:'output',Zv:'prop',INIT:'init',Xj:'clear',Yj:'cleared',dk:'destroy',Zd:'destroyed',Rv:'other'};olympe.sc.$a.kw=class extends olympe.sc.$a.pc{constructor(a){super(1);this.H=a;this.j=new Map;this.db=olympe.dc.ha()}getType(){return olympe.sc.$a.pc.D.Ze}D(){super.D();for(const a of this.j.values())a();this.j.clear()}process(a,b,c,...d){if(this.active&&b===olympe.sc.$a.pc.j.Yg&&void 0!==d[0]&&null!==d[0]){const e=Mn(c,qn(a,d[0]),a),f=d[1];let g;null==(g=this.j.get(e))||g();this.j.delete(e);if(f instanceof olympe.dc.CloudObject&&f.Vb()instanceof olympe.sc.Ac){const h=jh(this.db,f,()=>{olympe.sc.$d.D(this.H,
|
|
1145
|
+
e,f)});this.j.set(e,()=>{kh(this.db,f,h)})}olympe.sc.$d.D(this.H,e,f)}}};olympe.sc.Metadata=class extends olympe.dc.CloudObject{dv(){return this.xd(this.Mn())}ev(){return this.xd(this.Nn())}kl(){return new olympe.C.Zb(this.xd(this.Mn()),this.xd(this.Nn()))}Mn(){}Nn(){}};olympe.sc.Metadata.O=olympe.dc.na.j('0161ae936c62f9fcd131',olympe.sc.Metadata);m=olympe.sc.Metadata.prototype;m.dv.K=olympe.C.J.F;m.ev.K=olympe.C.J.F;m.kl.K=olympe.C.J.R;m.Mn.K=olympe.C.J.j;m.Nn.K=olympe.C.J.j;olympe.sc.gd=class extends olympe.dc.CloudObject{D(){return this.wb(olympe.sc.gd.F)}j(){return this.wb(olympe.sc.gd.j)}};olympe.sc.gd.O=olympe.dc.na.j('01703376c4a81c0e9d90',olympe.sc.gd);olympe.sc.gd.F=olympe.sc.gd.O.ja('01703376c4a81c0e9d91');olympe.sc.gd.j=olympe.sc.gd.O.ja('01703376c4a81c0e9d92');olympe.sc.gd.D=olympe.sc.gd.O.ra('01703376c4a81c0e9d93');R(olympe.dc.CloudObject.O,olympe.sc.gd.D);olympe.sc.gd.prototype.D.K=olympe.C.J.D;olympe.sc.gd.prototype.j.K=olympe.C.J.D;olympe.sc.xe={};olympe.sc.xe.Oe={su:'folders',ow:'screenflow',Qw:'ui-design',Qr:'software-intelligence',Bh:'data-management',HC:'projects'};olympe.sc.Gf=class extends olympe.dc.CloudObject{constructor(a,b){super(a,b)}Hd(){return this.xd(olympe.sc.Gf.D)}};olympe.sc.Gf.O=olympe.dc.na.j('019131fb930466a1ad79',olympe.sc.Gf);olympe.sc.Gf.D=olympe.sc.Gf.O.ja('016d1bb681929c2cc3f1');olympe.sc.Gf.j=olympe.sc.Gf.O.ra('019131fb930466a1ad7a');R(olympe.dc.CloudObject.O,olympe.sc.Gf.j);olympe.sc.Gf.prototype.Hd.K=olympe.C.J.F;olympe.sc.td=class extends olympe.dm.BrickMetadata{ve(){return olympe.sc.xe.Oe.Qr}j(){return this.cb(olympe.sc.td.j,olympe.sc.logic.Uh)}D(){return this.cb(olympe.sc.td.D,olympe.sc.logic.Rg)}};olympe.sc.td.O=olympe.dc.na.j('011100000000000adef0',olympe.sc.td);olympe.sc.td.j=olympe.sc.td.O.ra('016ac4f59a2917fdef01');olympe.sc.td.D=olympe.sc.td.O.ra('016ac4f59a2917fdef02');olympe.sc.td.O.j=(a,b)=>bm(a,b||'New function signature',olympe.sc.td,olympe.sc.logic.Bd).W();
|
|
1146
|
+
olympe.sc.td.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.sc.td.prototype.D.K=new olympe.C.J(()=>olympe.dc.Aa,[]);function Pn(a,b){[].forEach(c=>c.call(a,b,(d,e)=>{null===e?b.remove(d):b.set(d,e)}))}function Qn(a,b){b=b.filter(c=>'string'===typeof c&&a.db.Nb(c,olympe.sc.logic.Sb));b.sort((c,d)=>{let e;c=null!=(e=a.db.Pa(c,olympe.sc.logic.Sb.j,!0))?e:0;let f;d=null!=(f=a.db.Pa(d,olympe.sc.logic.Sb.j,!0))?f:0;return c-d});return b}function Rn(a){return Qn(a,a.db.cb(a.tag,olympe.sc.Va.F))}function Sn(a){return Qn(a,a.db.cb(a.tag,olympe.sc.Va.D))}
|
|
1147
|
+
olympe.sc.Va=class extends olympe.dm.BrickMetadata{gv(a,b,c,d,e=!0){e||olympe.ga.Wa('sc').error('parameter own= false ignored, investigate');return olympe.C.wh(M(this.Uf(a,olympe.dc.ib.tj,c)),d)}H(){return[]}F(){return rxjs.of([])}Ty(){return this.cb(olympe.sc.Va.H,olympe.sc.Runnable)}ky(){return this.cb(olympe.sc.Va.R,olympe.sc.Runnable)}ti(){return this.db.Pa(this,olympe.sc.Va.Z)}Rn(){return null!==this.db.Ib(this.tag,olympe.sc.Runnable.j.$b())}fv(){return this.cb(olympe.sc.Va.F,olympe.sc.logic.ub)}pq(){return this.cb(olympe.sc.Va.D,
|
|
1148
1148
|
olympe.sc.logic.Fb)}N(){return[olympe.sc.Va.Ua]}};olympe.sc.Va.O=olympe.dc.na.j('0112000000000000def0',olympe.sc.Va);olympe.sc.Va.Z=olympe.sc.Va.O.ja('01692aa71f3108454479');olympe.sc.Va.lb=olympe.sc.Va.O.ja('0166446c1f128ebc903a');olympe.sc.Va.Ua=olympe.sc.Va.O.ja('0166446c1f128ebc904e');olympe.sc.Va.H=olympe.sc.Va.O.ra('01692a4af82e8984742c');olympe.sc.Va.R=olympe.sc.Va.O.ra('01692a4af82e8984742d');olympe.sc.Va.X=olympe.sc.Va.O.ra('01692a4af82e8984742e');olympe.sc.Va.F=olympe.sc.Va.O.ra('01621fb84e320000f00a');
|
|
1149
|
-
olympe.sc.Va.D=olympe.sc.Va.O.ra('01621fb84e320000f00b');olympe.sc.Va.Fd=olympe.sc.Va.O.ra('0171838bcfed0000e00e');olympe.sc.Va.hd=olympe.sc.Va.O.ra('0171838bcfed0000a00a');m=olympe.sc.Va.prototype;m.
|
|
1150
|
-
function Un(a,b){Fn(b.state,a);Pn(a.wd(),b);const c=a.
|
|
1151
|
-
function Xn(a,b){let c,d,e;a.G.j()&&(e=a.db.name(a.Wb()),c=`Brick ${e} successfully run`,d=`Brick ${e} successfully cleared`);const f=Yn(a,b),g=a.setupExecution(b).pipe(rxjs.operators.map(h=>{if(!b.fb()&&(b.clear(),null!==h)){const k=Array.isArray(h)?h:[h],l=new olympe.sc.
|
|
1149
|
+
olympe.sc.Va.D=olympe.sc.Va.O.ra('01621fb84e320000f00b');olympe.sc.Va.Fd=olympe.sc.Va.O.ra('0171838bcfed0000e00e');olympe.sc.Va.hd=olympe.sc.Va.O.ra('0171838bcfed0000a00a');m=olympe.sc.Va.prototype;m.gv.K=olympe.C.J.j;m.Ty.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.ky.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.ti.K=olympe.C.J.j;m.Rn.K=olympe.C.J.j;m.fv.K=new olympe.C.J(()=>olympe.dc.Aa,[]);m.pq.K=new olympe.C.J(()=>olympe.dc.Aa,[]);function wn(a){let b;return null!=(b=a.wd().N().map(olympe.dc.ea)[0])?b:null}function Tn(a){const b=new olympe.dc.Ya;a=b.create(a);b.persist(a,!1);b.mb((d,e)=>{d||olympe.ga.Wa('sc').error(`Error occurred for transaction executed by createLocalRunnable: ${e}`)});const c=olympe.dc.CloudObject.get(a);olympe.C.Za().onDestroy(()=>{const d=new olympe.dc.Ya;d.delete(c);d.mb()});return c}
|
|
1150
|
+
function Un(a,b){Fn(b.state,a);Pn(a.wd(),b);const c=a.R(),d=Vn(b,c),e=[];c.forEach((f,g)=>{f===a.ia?e[0]=g:f===a.ba&&(e[1]=g)});void 0!==e[0]&&void 0!==e[1]&&(Wn(a,b,d[e[0]],d[e[1]]),c[e[0]]=null,c[e[1]]=null);c.forEach((f,g)=>{f&&f.call(a,b,d[g])})}
|
|
1151
|
+
function Xn(a,b){let c,d,e;a.G.j()&&(e=a.db.name(a.Wb()),c=`Brick ${e} successfully run`,d=`Brick ${e} successfully cleared`);const f=Yn(a,b),g=a.setupExecution(b).pipe(rxjs.operators.map(h=>{if(!b.fb()&&(b.clear(),null!==h)){const k=Array.isArray(h)?h:[h],l=new olympe.sc.Zw(b.state);l.Cb().run(()=>u(function*(){try{yield a.update(l,k,f)}catch(n){l.throw(n)}}));return!0}return!1})).subscribe(rxjs.Subscriber.create(h=>h?a.G.debug(c):a.G.debug(d),h=>b.throw(h),()=>a.G.debug(`Brick ${e} completed`)));
|
|
1152
1152
|
b.onDestroy(g.unsubscribe.bind(g))}function Zn(a,b,c,d){let e=[];const f=T(a.db,b,c,(g,h)=>{if(g){const k=mn(d,h),l=olympe.dc.CloudObject.get(h);l instanceof olympe.sc.logic.ed&&null!==e?e.push(()=>l.run(k)):l.run(k)}else{let k;null==(k=on(d,h))||k.destroy()}});e.forEach(g=>g());e=null;d.Cb().onDestroy(a.db.D.bind(a.db,b,c,f))}function Yn(a,b){return a.wd().H(b)}
|
|
1153
1153
|
function Vn(a,b){if(1===b.length)return[(d,e)=>{null!==e?a.set(d,e):a.remove(d)}];const c=b.map(()=>new Map);return c.map(d=>(e,f)=>{null!==f?d.set(e,f):d.delete(e);a:{for(const g of c)if(f=g.get(e),void 0!==f){a.set(e,f);break a}a.remove(e)}})}function Wn(a,b,c,d){b=b.Cb();const e=jh(a.db,a.tag,b.rc((f,g,h)=>{const k=h?d:c;null!==k&&(k(f,olympe.dc.ib.tc(g)),h&&c!==k&&(null==c||c(f,null)))}));b.onDestroy(()=>{kh(a.db,a.tag,e)})}
|
|
1154
|
-
olympe.sc.Runnable=class extends olympe.dm.BrickMetadata{constructor(a,b,c){super(a,b);this.G=c}run(a){a.Cb().run(()=>{Un(this,a);this.init(a);a.vh(this.clear.bind(this,a));a.onDestroy(this.destroy.bind(this,a));Xn(this,a);this.
|
|
1155
|
-
d,olympe.sc.Va.X,a)}
|
|
1156
|
-
b,c,d){a=b.tb(a,c,!0);void 0!==d&&olympe.C.wh(a,d);return a}
|
|
1154
|
+
olympe.sc.Runnable=class extends olympe.dm.BrickMetadata{constructor(a,b,c){super(a,b);this.G=c}run(a){a.Cb().run(()=>{Un(this,a);this.init(a);a.vh(this.clear.bind(this,a));a.onDestroy(this.destroy.bind(this,a));Xn(this,a);this.F(a)})}wd(){return this.Vb()}init(a){this.onInit(a)}update(a,b,c){const d=this.wd();if(d.ti())this.onUpdate(a,b,c);else this.G.debug(`Softcoded runnable ${this.db.name(this)} with tag ${this.tag} running in context ${a.T()}`),Zn(this,d,olympe.sc.Va.H,a),this.wa()&&Zn(this,
|
|
1155
|
+
d,olympe.sc.Va.X,a)}F(a){a.fo(olympe.sc.Va.lb)}clear(){}destroy(a){this.onDestroy(a)}setupExecution(a){return this.wd().F(a)}onInit(){}onUpdate(){const a=this.Wb(),b=this.db.name(a),c=this.db.name(this.db.model(a));this.G.error(`No code was found for ${b} (${c}: ${a})\n\n`+'This is probably because the code has not yet been deployed to the environment, or because the package.json does not import the required dependencies.')}onDestroy(){}getInputs(){return Rn(this.wd())}getOutputs(){return Sn(this.wd())}H(){return[]}D(){return null}wa(){return!1}N(a,
|
|
1156
|
+
b,c,d){a=b.tb(a,c,!0);void 0!==d&&olympe.C.wh(a,d);return a}Ua(a,b,c,d,e){olympe.C.Wn([d],f=>{b.set(a,olympe.C.et(f)?f.valueOf():f)});return this.N(a,b,c,e)}R(){return[this.ia,this.ba]}ia(a,b){Wn(this,a,b,null)}ba(a,b){Wn(this,a,null,b)}lb(a,b){const c=this.db,d=olympe.sc.logic.pb.F.$b(),e=olympe.sc.logic.pb.D,f=olympe.sc.logic.pb.j;this.Ls(d,g=>{var h=g.W();if(h=c.Ib(h,e)||c.Ib(h,f))return $n(g,a,b.bind(null,h))})}};olympe.sc.Runnable.O=kg(olympe.dc.na.j('01130000000000ca1100',olympe.sc.Runnable));
|
|
1157
1157
|
olympe.sc.Runnable.D=olympe.sc.Runnable.O.ra('01692a4af82e8984742b');olympe.sc.Runnable.j=olympe.sc.Runnable.O.ra('01756a18d4921c103111');olympe.sc.Runnable.N=R(olympe.sc.Runnable.O,olympe.sc.Va.H);olympe.sc.Runnable.R=R(olympe.sc.Runnable.O,olympe.sc.Va.R);olympe.sc.Runnable.X=R(olympe.sc.Runnable.O,olympe.sc.Va.X);R(olympe.sc.Va.O,olympe.sc.Runnable.D);R(olympe.sc.Va.O,olympe.sc.Runnable.j);olympe.sc.Runnable.prototype.wd.K=new olympe.C.J(()=>olympe.sc.Va,[]);
|
|
1158
|
-
olympe.sc.Runnable.prototype.
|
|
1159
|
-
olympe.sc.Td.j=olympe.sc.Td.O.ra('0169b5a8a33144fb0b49');R(olympe.dc.CloudObject.O,olympe.sc.Td.j);olympe.sc.Td.prototype.D.K=new olympe.C.J(()=>String,[]);olympe.sc.Td.prototype.j.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.sc.
|
|
1160
|
-
function fo(a,b){bo=a;const c=olympe.C.Za();return olympe.dc.sd.from(a).bb(olympe.sc.pa.Oc.j).bb(olympe.sc.tf.j.$b()).mb({ii:'__code-as-data__'}).then(d=>{let e;null==(e=eo)||e.forEach(f=>f());eo=null;co=d;if(null!==d){if(b){const f=olympe.dc.
|
|
1161
|
-
g()}))})}olympe.
|
|
1162
|
-
olympe.sc.tf.D=olympe.sc.tf.O.ra('017b3aa8fe7ec3fd52f2');olympe.sc.Map=class extends olympe.dc.CloudObject{};olympe.sc.Map.O=olympe.dc.na.j('018119241abce0e5696e',olympe.sc.Map);olympe.sc.Og=class extends olympe.sc.Map{};olympe.sc.Og.O=olympe.dc.na.j('01631aacd8276ea98490',olympe.sc.Og);olympe.sc.File=class extends olympe.dm.File{static
|
|
1163
|
-
h=new Date;c=(new Map).set(olympe.dm.File.fileNameProp,null!=c?c:'file').set(olympe.dm.File.urlProp,d).set(olympe.dm.File.modificationDateProp,h).set(olympe.dm.File.mimeTypeProp,null!=e?e:'application/data');g&&null!==f.Pa(b,olympe.dm.File.urlProp)||c.set(olympe.dm.File.creationDateProp,h).set(olympe.dm.File.j,!1);a.
|
|
1164
|
-
olympe.sc.File.O=eg(olympe.dm.File,'ff021000000000000031',olympe.sc.File);olympe.sc.Kg=class extends olympe.sc.File{H(){const a=olympe.C.bc(olympe.C.Sa);this.
|
|
1165
|
-
olympe.sc.Pc.O.j=(a,b,c,d)=>{c=olympe.sc.File.D(olympe.sc.Pc,a,b,c,d);a.update(c,olympe.sc.Pc.fontFamilyProp,b.split('.')[0]);return c};olympe.sc.Pc.prototype.H.K=olympe.C.J.D;olympe.sc.Pc.prototype.N.K=olympe.C.J.D;olympe.sc.Pc.prototype.R.K=olympe.C.J.F;olympe.sc.bi=class extends olympe.sc.File{};olympe.sc.bi.O=eg(olympe.sc.File,'0164643c432146a71d5c',olympe.sc.bi);olympe.sc.bi.O.j=olympe.sc.File.D.bind(null,olympe.sc.bi);olympe.sc.
|
|
1166
|
-
olympe.sc.logic.
|
|
1167
|
-
return}let n;if('<'===f)n=(p,q)=>olympe.sc.logic.
|
|
1168
|
-
olympe.sc.logic.
|
|
1169
|
-
olympe.sc.logic.na=class{constructor(){}static j(a,b,...c){if(ho[a])throw c=jo(a),Error(`Tag: ${a} - overwriting already defined function "${c.name}" with "${b.name}"`);b=new olympe.sc.logic.Ra.
|
|
1170
|
-
olympe.sc.logic.Error.prototype.getCode=olympe.sc.logic.Error.prototype.Aj;olympe.sc.logic.Error.prototype.getMessage=olympe.sc.logic.Error.prototype.
|
|
1171
|
-
c=>this.db.model(c)===olympe.dc.ea(a));return b?olympe.dc.CloudObject.get(b):null}H(a){if(!this.ti())return super.H(a);const b=olympe.dc.ea(olympe.sc.logic.ak),c=olympe.dc.ea(olympe.sc.logic.Ni);return Sn(this).map(d=>{switch(this.db.Ib(d,olympe.sc.logic.
|
|
1158
|
+
olympe.sc.Runnable.prototype.N.K=new olympe.C.J(()=>Object,[]);olympe.sc.Runnable.prototype.Ua.K=olympe.C.J.j;function ao(a){if(a){if('string'===typeof a)return a;if(a instanceof olympe.sc.Td)return(a=a.D())?a.valueOf():null;if('function'===typeof a.W)return a.W()}return null}olympe.sc.Td=class extends olympe.dc.CloudObject{D(){return this.db.cb(this,olympe.sc.Td.j)[0]}j(){const a=ao(this);return olympe.dc.CloudObject.get(a)}tc(){return this.j().tc()}toString(){const a=ao(this);let b;a&&(b=this.db.name(a));return b||super.toString()}};olympe.sc.Td.O=olympe.dc.na.j('0163c9ae01f2d6e9ca49',olympe.sc.Td);
|
|
1159
|
+
olympe.sc.Td.j=olympe.sc.Td.O.ra('0169b5a8a33144fb0b49');R(olympe.dc.CloudObject.O,olympe.sc.Td.j);olympe.sc.Td.prototype.D.K=new olympe.C.J(()=>String,[]);olympe.sc.Td.prototype.j.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.sc.ip=class extends olympe.dm.Kb{ve(){return olympe.sc.xe.Oe.Bh}};olympe.sc.ip.O=olympe.dc.na.j('0163a68ce44f3d1fa84c',olympe.sc.ip);olympe.sc.Ac=class extends olympe.dm.BrickMetadata{};olympe.sc.Ac.O=olympe.dc.na.j('016324fde11a836f76c2',olympe.sc.Ac);olympe.sc.Ac.j=olympe.sc.Ac.O.ra('016324fde11a836087c2');olympe.sc.Ac.O.j=function(a,b){return bm(a,null!=b?b:'New type',olympe.sc.Ac).W()};let bo=null,co=null,eo=[];
|
|
1160
|
+
function fo(a,b){bo=a;const c=olympe.C.Za();return olympe.dc.sd.from(a).bb(olympe.sc.pa.Oc.j).bb(olympe.sc.tf.j.$b()).mb({ii:'__code-as-data__'}).then(d=>{let e;null==(e=eo)||e.forEach(f=>f());eo=null;co=d;if(null!==d){if(b){const f=olympe.dc.ha();return new Promise(g=>{zi(c,d,h=>{h=f.vi(h)?h:f.model(h);return null!==h&&f.Nb(h,olympe.sc.Ac)},{bo:!0}).subscribe(rxjs.Subscriber.create(()=>{g()},()=>{olympe.ga.Wa('sc').error('Impossible to load the business container for the application',a,'maybe are you offline?');
|
|
1161
|
+
g()}))})}olympe.ga.Wa('sc').debug("Found business container but won't load it's content according to configuration.")}else olympe.ga.Wa('sc').info(`No business container for application ${a}. You probably miss permissions.`);return Promise.resolve()}).catch(d=>{eo=null;throw d;})}function Mf(){return null===eo?Promise.resolve():new Promise(a=>{eo.push(()=>a())})}olympe.sc.tf=class extends olympe.dc.CloudObject{};olympe.sc.tf.O=olympe.dc.na.j('017b3aa8fae1e3d044dc',olympe.sc.tf);olympe.sc.tf.j=olympe.sc.tf.O.ra('017b3aa8fd1659291b92');
|
|
1162
|
+
olympe.sc.tf.D=olympe.sc.tf.O.ra('017b3aa8fe7ec3fd52f2');olympe.sc.Map=class extends olympe.dc.CloudObject{};olympe.sc.Map.O=olympe.dc.na.j('018119241abce0e5696e',olympe.sc.Map);olympe.sc.Og=class extends olympe.sc.Map{};olympe.sc.Og.O=olympe.dc.na.j('01631aacd8276ea98490',olympe.sc.Og);olympe.sc.File=class extends olympe.dm.File{static Gx(a,b,c,d,e,f){e=a.create(olympe.sc.File,new Map,e,f);olympe.sc.File.vt(a,e,b,c,d);return e}static Hx(a,b,c,d,e,f){e=a.create(olympe.sc.File,new Map,e,f);olympe.sc.File.ao(a,e,b,c,d);return e}static vt(a,b,c,d,e){e=null!=e?e:'application/data';d=URL.createObjectURL(new Blob([d],{type:e}));olympe.sc.File.ao(a,b,c,d,e)}static ao(a,b,c,d,e){const f=olympe.dc.ha(),g=f.Ja(b);var h;const k=null!=(h=a.model(b))?h:olympe.sc.File;if(null===k||!f.Vf(k,olympe.dm.File))throw Error(`Try to set the content of an object which is not a file: ${b}`);
|
|
1163
|
+
h=new Date;c=(new Map).set(olympe.dm.File.fileNameProp,null!=c?c:'file').set(olympe.dm.File.urlProp,d).set(olympe.dm.File.modificationDateProp,h).set(olympe.dm.File.mimeTypeProp,null!=e?e:'application/data');g&&null!==f.Pa(b,olympe.dm.File.urlProp)||c.set(olympe.dm.File.creationDateProp,h).set(olympe.dm.File.j,!1);a.lt(b,c)}};olympe.sc.File.setURLContent=olympe.sc.File.ao;olympe.sc.File.setContent=olympe.sc.File.vt;olympe.sc.File.createFromURL=olympe.sc.File.Hx;olympe.sc.File.createFromContent=olympe.sc.File.Gx;
|
|
1164
|
+
olympe.sc.File.O=eg(olympe.dm.File,'ff021000000000000031',olympe.sc.File);olympe.sc.Kg=class extends olympe.sc.File{H(){const a=olympe.C.bc(olympe.C.Sa);this.hl(b=>{a.update(olympe.C.xb(b))});return a.tb()}};olympe.sc.Kg.O=eg(olympe.sc.File,'01644b6297305d62fca2',olympe.sc.Kg);olympe.sc.Kg.O.j=olympe.sc.File.D.bind(null,olympe.sc.Kg);olympe.sc.Kg.prototype.H.K=olympe.C.J.D;olympe.sc.Pc=class extends olympe.sc.File{H(){return this.wb(olympe.sc.Pc.fontFamilyProp)}N(){return this.wb(olympe.sc.Pc.F)}R(){return this.xd(olympe.sc.Pc.H)}};olympe.sc.Pc.O=eg(olympe.sc.File,'01647e113043c637b541',olympe.sc.Pc);olympe.sc.Pc.fontFamilyProp=olympe.sc.Pc.O.ja('01647e35ecd24ef0b88d');olympe.sc.Pc.F=olympe.sc.Pc.O.ja('01647e677f5d1cfbdf42');olympe.sc.Pc.H=olympe.sc.Pc.O.ja('01647e6780999bf8bd25');
|
|
1165
|
+
olympe.sc.Pc.O.j=(a,b,c,d)=>{c=olympe.sc.File.D(olympe.sc.Pc,a,b,c,d);a.update(c,olympe.sc.Pc.fontFamilyProp,b.split('.')[0]);return c};olympe.sc.Pc.prototype.H.K=olympe.C.J.D;olympe.sc.Pc.prototype.N.K=olympe.C.J.D;olympe.sc.Pc.prototype.R.K=olympe.C.J.F;olympe.sc.bi=class extends olympe.sc.File{};olympe.sc.bi.O=eg(olympe.sc.File,'0164643c432146a71d5c',olympe.sc.bi);olympe.sc.bi.O.j=olympe.sc.File.D.bind(null,olympe.sc.bi);olympe.sc.ps=class extends olympe.dc.CloudObject{};olympe.sc.ps.O=olympe.dc.na.j('016421bb3797e22d1c4e',olympe.sc.ps);olympe.sc.logic={};olympe.sc.logic.Np=(a,b)=>a===b?0:a>b?1:-1;
|
|
1166
|
+
olympe.sc.logic.bC=(a,b,c,d,e,f,g)=>{const h=b.W();b=olympe.C.Qa(b.getType().W());let k,l;if(b===olympe.dc.ea(olympe.dm.String))k=c.valueOf().toLowerCase(),l=p=>p.wb(h).toLowerCase();else if(b===olympe.dc.ea(olympe.dm.Number))k=c.valueOf(),l=p=>p.xd(h);else if(b===olympe.dc.ea(olympe.dm.DateTime))k=c.getTime(),l=p=>olympe.C.sa([p.Dj(h)],q=>q.getTime(),Number,'FilterList Date&DateTime TransformFlows');else{c=olympe.dc.ha().name(b);g.warn(`Properties of type ${c} are not supported. List will not be filtered.`);e(a);
|
|
1167
|
+
return}let n;if('<'===f)n=(p,q)=>olympe.sc.logic.Np(q,p);else if('>'===f)n=(p,q)=>olympe.sc.logic.Np(p,q);else{g.error(`Unknown inequality ${f}. Please use '<' or '>'`);return}e(a.bl().filter(p=>olympe.C.sa([l(p)],q=>{q=n(q.valueOf(),k);return olympe.C.Rb(d.valueOf()?1===q:0<=q)},olympe.C.da,'FilterList ListDefBuilder Filter TransformFlows')).Xi())};
|
|
1168
|
+
olympe.sc.logic.PE=(a,b)=>{if(a instanceof olympe.C.$)return a;if(a instanceof olympe.C.Sa)return a.zt();if(a instanceof olympe.C.da)return a.Ws();if('string'===typeof a||'number'===typeof a)return olympe.C.qa(Number(a));b.error(`Could not parse provided value ${a} into a number`);return olympe.C.$.Bq};olympe.sc.logic.Ra={};function go(a){jg(a.O,(b,c)=>{b=b.create(a.O.D);X(b,olympe.dc.CloudObject.nameProp,c);return b.W()})}olympe.sc.logic.Ra.Bp=class{constructor(a,b,c){this.O=olympe.dc.na.j(a,b,...c);go(this)}W(){return this.O.W()}};olympe.sc.logic.Ra.Bp.ya=[olympe.dc.Ye];const ho=Object.create(null),io=new Map;function jo(a){if(void 0===ho[a])throw Error(`Tag: ${a} - does not correspond to a registered function`);return gg(a)}function ko(a,b,c=olympe.sc.logic.Function){if(io.has(a))throw c=jo(a),Error(`Tag: ${a} - overwriting existing function definition "${c.name}" with "${b.name}"`);const d=olympe.dc.na.j(a,b,...[]);io.set(a,{O:d,fF:b,ME:c});return d}
|
|
1169
|
+
olympe.sc.logic.na=class{constructor(){}static j(a,b,...c){if(ho[a])throw c=jo(a),Error(`Tag: ${a} - overwriting already defined function "${c.name}" with "${b.name}"`);b=new olympe.sc.logic.Ra.Bp(a,b,[olympe.sc.P.Da].concat(c));return ho[a]=b}};olympe.sc.logic.RA=class{};olympe.sc.logic.ak=class extends olympe.dc.CloudObject{};olympe.sc.logic.ak.O=olympe.dc.na.j('01621fb84e320000cf00',olympe.sc.logic.ak);function rn(a,b,c){return new olympe.sc.logic.Error(a,b,c)}olympe.sc.logic.Error=class extends Error{constructor(a,b,c){super(a);this.code=b;this.j=null!=c?c:null}static create(a,b){return new olympe.sc.logic.Error(a,b)}Hy(){return this.message}Aj(){return this.code}se(){let a;return null!=(a=this.j)?a:''}toString(){return`${this.message}\nError found in:\n${this.se()}\n\n${this.stack}`}};olympe.sc.logic.Error.prototype.getStack=olympe.sc.logic.Error.prototype.se;
|
|
1170
|
+
olympe.sc.logic.Error.prototype.getCode=olympe.sc.logic.Error.prototype.Aj;olympe.sc.logic.Error.prototype.getMessage=olympe.sc.logic.Error.prototype.Hy;olympe.sc.logic.Error.create=olympe.sc.logic.Error.create;olympe.sc.logic.Ni=class extends olympe.sc.logic.ak{};olympe.sc.logic.Ni.O=olympe.dc.na.j('016eeb5ede9f3094d8f0',olympe.sc.logic.Ni);olympe.sc.logic.rd=class extends olympe.dc.CloudObject{j(){return this.Tc(olympe.sc.logic.rd.j,olympe.dc.CloudObject)}};olympe.sc.logic.rd.O=olympe.dc.na.j('016ac4f59ee8ea2081ba',olympe.sc.logic.rd);olympe.sc.logic.rd.D=olympe.sc.logic.rd.O.ja('017bc044aeacce7ffc8f');olympe.sc.logic.rd.j=olympe.sc.logic.rd.O.ra('016ac4f5a0091c4790e2');R(olympe.dc.CloudObject.O,olympe.sc.logic.rd.j);olympe.sc.logic.rd.prototype.j.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.sc.logic.Uh=class extends olympe.sc.logic.rd{};olympe.sc.logic.Uh.O=olympe.dc.na.j('016ac4f59c592b862457',olympe.sc.logic.Uh);olympe.sc.logic.Uh.F=olympe.sc.td.j.$b();olympe.sc.logic.Uh.O.j=(a,b,c,d,e)=>{b=bm(a,b||'New Predefined Input',olympe.sc.logic.Uh,olympe.sc.logic.ub);X(b,olympe.sc.logic.rd.D,e);a.Oa(olympe.sc.logic.rd.j,b,c);a.Oa(olympe.sc.td.j,d,b);return b.W()};olympe.sc.logic.Rg=class extends olympe.sc.logic.rd{};olympe.sc.logic.Rg.O=olympe.dc.na.j('016ac4f59dd99f5df3e1',olympe.sc.logic.Rg);olympe.sc.logic.Rg.F=R(olympe.sc.logic.Rg.O,olympe.sc.td.D);olympe.sc.logic.Rg.O.j=(a,b,c,d,e)=>{b=bm(a,b||'New Predefined Output',olympe.sc.logic.Rg,olympe.sc.logic.Fb);X(b,olympe.sc.logic.rd.D,e);a.Oa(olympe.sc.logic.rd.j,b,c);a.Oa(olympe.sc.td.D,d,b);return b.W()};olympe.sc.logic.Bd=class extends olympe.sc.Va{ve(){return olympe.sc.xe.Oe.Qr}Z(){return this.Gn().bl().Nb([olympe.sc.logic.Function]).and().zd().Nb([olympe.sc.logic.od,olympe.sc.logic.ed]).Xi()}N(){const a=olympe.dc.ea(olympe.sc.logic.Ni);return this.db.cb(this,olympe.sc.logic.Bd.D).filter(b=>this.db.Ib(b,olympe.sc.logic.Sb.typeRel)===a)}j(a){const b=this.db.Dn(this,[olympe.sc.Va.F],c=>this.db.model(c)===olympe.dc.ea(a));return b?olympe.dc.CloudObject.get(b):null}D(a){const b=this.db.Dn(this,[olympe.sc.Va.D],
|
|
1171
|
+
c=>this.db.model(c)===olympe.dc.ea(a));return b?olympe.dc.CloudObject.get(b):null}H(a){if(!this.ti())return super.H(a);const b=olympe.dc.ea(olympe.sc.logic.ak),c=olympe.dc.ea(olympe.sc.logic.Ni);return Sn(this).map(d=>{switch(this.db.Ib(d,olympe.sc.logic.Sb.typeRel)){case b:return a.fo.bind(a,d);case c:return a.throw.bind(a);default:return a.set.bind(a,d)}})}F(a){if(!this.ti())return super.F(a);const b=Rn(this);return 0<b.length?rxjs.combineLatest(b.map(c=>a.observe(c))).pipe(rxjs.operators.map(c=>
|
|
1172
1172
|
c.includes(null)?null:c)):rxjs.of([])}};olympe.sc.logic.Bd.O=ko('01621fb84e320000f000',olympe.sc.logic.Bd,olympe.sc.logic.Function);olympe.sc.logic.Bd.prototype.j.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.Bd.prototype.D.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);let lo=null;function mo(){if(null===lo){let a;lo=null!=(a=olympe.V.getParameter('sc.action.experimental'))?a:!1}return lo}
|
|
1173
|
-
olympe.sc.logic.ag=class extends olympe.sc.logic.Bd{R(){return this.j('016ac63229782039429f')}X(){return this.D('016ac6322acf67eebfe7')}
|
|
1174
|
-
olympe.sc.logic.ag.O=ko('01621fb84e320000a000',olympe.sc.logic.ag,olympe.sc.logic.Action);olympe.sc.logic.ag.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.ag.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.ag.prototype.
|
|
1175
|
-
olympe.sc.logic.
|
|
1176
|
-
olympe.sc.logic.ub.H=olympe.sc.logic.ub.O.ra('01621fb84e32000000d1',olympe.dc.ta.ORIGIN);olympe.sc.logic.ub.O.j=function(a,b,c,d,e,f=olympe.sc.logic.ub){f=a.create(f);X(f,olympe.dc.CloudObject.nameProp,b||'New input');a.Oa(olympe.sc.logic.
|
|
1177
|
-
olympe.sc.logic.Fb.O.j=function(a,b,c,d,e,f=olympe.sc.logic.Fb){f=a.create(f);X(f,olympe.dc.CloudObject.nameProp,b||'New output');a.Oa(olympe.sc.logic.
|
|
1178
|
-
olympe.sc.logic.od.F=R(olympe.sc.logic.od.O,olympe.sc.logic.Fb.H);olympe.sc.logic.od.O.j=function(a,b,c){b=a.create(olympe.sc.logic.od);a.Oa(olympe.sc.logic.od.F,b,c);return b.W()};olympe.sc.logic.od.prototype.j.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.od.prototype.
|
|
1179
|
-
olympe.sc.logic.ed.O.j=function(a,b,c){b=a.create(olympe.sc.logic.ed);a.Oa(olympe.sc.logic.ed.F,b,c);return b.W()};olympe.sc.logic.ed.prototype.
|
|
1180
|
-
h)}}function no(a){let b=null,c=a.db.Ib(a,olympe.sc.logic.pb.D);c?b=a.db.Ib(c,olympe.dm.Property.typeRel):(c=a.db.Ib(a,olympe.sc.logic.pb.j))&&(b=a.db.Ib(c,olympe.sc.logic.
|
|
1181
|
-
olympe.sc.logic.pb=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.G=c}j(a,b,c){const d=olympe.sc.tj(c);null==b||b.sg();b&&d instanceof olympe.dm.
|
|
1182
|
-
olympe.sc.logic.Fb)}
|
|
1173
|
+
olympe.sc.logic.ag=class extends olympe.sc.logic.Bd{R(){return this.j('016ac63229782039429f')}X(){return this.D('016ac6322acf67eebfe7')}ba(){return this.pq().bl().bb(olympe.sc.logic.Sb.typeRel).pl(olympe.sc.logic.Ni).Xi().Cf().Sn(olympe.C.$.ZERO)}F(a){if(this.ti()||mo()){const b=this.R().W();return a.observe(b).pipe(rxjs.operators.map(c=>null===c?null:Rn(this).filter(d=>d!==b).map(d=>a.get(d))))}return super.F(a)}};olympe.sc.logic.ag.j='016ac63229782039429f';olympe.sc.logic.ag.N='016ac6322acf67eebfe7';
|
|
1174
|
+
olympe.sc.logic.ag.O=ko('01621fb84e320000a000',olympe.sc.logic.ag,olympe.sc.logic.Action);olympe.sc.logic.ag.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.ag.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.ag.prototype.ba.K=olympe.C.J.N;olympe.sc.logic.To=class extends olympe.sc.logic.Bd{};olympe.sc.logic.To.O=ko('01621fb84e320000f011',olympe.sc.logic.To);olympe.sc.logic.So=class extends olympe.sc.logic.ag{};olympe.sc.logic.So.O=ko('01621fb84e320000f012',olympe.sc.logic.So);olympe.sc.logic.Function=class extends olympe.sc.Runnable{R(){return[this.lb]}D(){if(!this.wd().ti())return super.D();const a=olympe.sc.Fg.j.um,b=olympe.sc.Fg.j.Lm,c=this.db,d=new Map,e=this.Wb();c.cb(e,olympe.sc.Va.F).forEach(f=>{d.set(a+c.name(f),f)});c.cb(e,olympe.sc.Va.D).forEach(f=>{d.set(b+c.name(f),f)});return d}};olympe.sc.logic.Function.O=olympe.dc.na.j('0168c6f020f2a96f0000',olympe.sc.logic.Function,olympe.sc.P.Da);olympe.sc.logic.Sb=class extends olympe.dc.CloudObject{getType(){return this.Tc(olympe.sc.logic.Sb.typeRel,olympe.dc.CloudObject)}j(){return this.xd(olympe.sc.logic.Sb.j)}};olympe.sc.logic.Sb.O=olympe.dc.na.j('0168a431d25001540000',olympe.sc.logic.Sb);olympe.sc.logic.Sb.j=olympe.sc.logic.Sb.O.ja('01740c5d4ae4b520dd01');olympe.sc.logic.Sb.typeRel=olympe.sc.logic.Sb.O.ra('0168a431d3b9b7438424');R(olympe.dc.CloudObject.O,olympe.sc.logic.Sb.typeRel);
|
|
1175
|
+
olympe.sc.logic.Sb.prototype.getType.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);olympe.sc.logic.Sb.prototype.j.K=olympe.C.J.F;olympe.sc.logic.ub=class extends olympe.sc.logic.Sb{};olympe.sc.logic.ub.O=olympe.dc.na.j('0168a431d25001540001',olympe.sc.logic.ub);olympe.sc.logic.ub.R=olympe.sc.logic.Sb.O.ja('01740c5d4ae4b520dd02');olympe.sc.logic.ub.N=R(olympe.sc.logic.ub.O,olympe.sc.Va.F);olympe.sc.logic.ub.D=olympe.sc.logic.ub.O.ra('0168a431d91f2578000b',olympe.dc.ta.ORIGIN);olympe.sc.logic.ub.F=olympe.sc.logic.ub.O.ra('01621fb84e32000000a1',olympe.dc.ta.ORIGIN);
|
|
1176
|
+
olympe.sc.logic.ub.H=olympe.sc.logic.ub.O.ra('01621fb84e32000000d1',olympe.dc.ta.ORIGIN);olympe.sc.logic.ub.O.j=function(a,b,c,d,e,f=olympe.sc.logic.ub){f=a.create(f);X(f,olympe.dc.CloudObject.nameProp,b||'New input');a.Oa(olympe.sc.logic.Sb.typeRel,f,c);void 0!==e&&X(f,olympe.sc.logic.Sb.j,e);d&&a.Oa(olympe.sc.Va.F,d,f);return f.W()};olympe.sc.logic.Fb=class extends olympe.sc.logic.Sb{};olympe.sc.logic.Fb.O=olympe.dc.na.j('0168a431d25001540002',olympe.sc.logic.Fb);olympe.sc.logic.Fb.N=R(olympe.sc.logic.Fb.O,olympe.sc.Va.D);olympe.sc.logic.Fb.D=olympe.sc.logic.Fb.O.ra('0168a431d91f25780003',olympe.dc.ta.ORIGIN);olympe.sc.logic.Fb.H=olympe.sc.logic.Fb.O.ra('01621fb84e32000000a2',olympe.dc.ta.ORIGIN);olympe.sc.logic.Fb.F=olympe.sc.logic.Fb.O.ra('01621fb84e32000000d2',olympe.dc.ta.ORIGIN);
|
|
1177
|
+
olympe.sc.logic.Fb.O.j=function(a,b,c,d,e,f=olympe.sc.logic.Fb){f=a.create(f);X(f,olympe.dc.CloudObject.nameProp,b||'New output');a.Oa(olympe.sc.logic.Sb.typeRel,f,c);void 0!==e&&X(f,olympe.sc.logic.Sb.j,e);d&&a.Oa(olympe.sc.Va.D,d,f);return f.W()};olympe.sc.logic.od=class extends olympe.sc.logic.Function{run(a){Un(this,a);const b=a.getParent(),c=this.db.Ib(this,olympe.sc.logic.od.H),d=this.db.Ib(this,olympe.sc.logic.od.F);a.on(c,e=>b.set(d,e),this.tag)}j(){return this.vg(olympe.sc.logic.od.H).Cc()}X(){return this.vg(olympe.sc.logic.od.F).Cc()}};olympe.sc.logic.od.O=olympe.dc.na.j('01621fb84e32000000a0',olympe.sc.logic.od,olympe.sc.P.Da);olympe.sc.logic.od.H=R(olympe.sc.logic.od.O,olympe.sc.logic.ub.F);
|
|
1178
|
+
olympe.sc.logic.od.F=R(olympe.sc.logic.od.O,olympe.sc.logic.Fb.H);olympe.sc.logic.od.O.j=function(a,b,c){b=a.create(olympe.sc.logic.od);a.Oa(olympe.sc.logic.od.F,b,c);return b.W()};olympe.sc.logic.od.prototype.j.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.od.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.ed=class extends olympe.sc.logic.Function{run(a){const b=a.getParent(),c=this.db.Ib(this,olympe.sc.logic.ed.F),d=this.db.Ib(this,olympe.sc.logic.ed.H);b.on(c,e=>a.set(d,e),b.T())}X(){return this.vg(olympe.sc.logic.ed.F).Cc()}j(){return this.vg(olympe.sc.logic.ed.H).Cc()}};olympe.sc.logic.ed.O=olympe.dc.na.j('01621fb84e32000000d0',olympe.sc.logic.ed,olympe.sc.P.Da);olympe.sc.logic.ed.F=R(olympe.sc.logic.ed.O,olympe.sc.logic.ub.H);olympe.sc.logic.ed.H=R(olympe.sc.logic.ed.O,olympe.sc.logic.Fb.F);
|
|
1179
|
+
olympe.sc.logic.ed.O.j=function(a,b,c){b=a.create(olympe.sc.logic.ed);a.Oa(olympe.sc.logic.ed.F,b,c);return b.W()};olympe.sc.logic.ed.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.ed.prototype.j.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);function $n(a,b,c){var d;const e=null!=(d=a.db.Ib(a,olympe.sc.logic.pb.R))?d:a.db.Ib(a,olympe.sc.logic.pb.H),f=a.db.Ib(a,olympe.sc.logic.pb.N);if(null!==e&&null!==f){d=a.db.Vf(no(a),olympe.dm.Je)?new olympe.C.Xb('Pipe Context'):null;const k=a.j.bind(a,c,d);let l;const n=b.vl(f,p=>{let q;null==(q=l)||q();l=p.on(e,k,f)});return()=>{k(null);n();let p;null==(p=l)||p()}}const g=k=>c(olympe.dc.ib.tc(k)),h=hh(a.db,a,olympe.sc.logic.pb.valueProp,g);return()=>{g(null);ih(a.db,a,olympe.sc.logic.pb.valueProp,
|
|
1180
|
+
h)}}function no(a){let b=null,c=a.db.Ib(a,olympe.sc.logic.pb.D);c?b=a.db.Ib(c,olympe.dm.Property.typeRel):(c=a.db.Ib(a,olympe.sc.logic.pb.j))&&(b=a.db.Ib(c,olympe.sc.logic.Sb.typeRel));return b||olympe.dc.ea(olympe.dc.CloudObject)}
|
|
1181
|
+
olympe.sc.logic.pb=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.G=c}j(a,b,c){const d=olympe.sc.tj(c);null==b||b.sg();b&&d instanceof olympe.dm.Je?null==b||b.run(()=>{olympe.C.Wc([d.getValue()],e=>{a(e.valueOf())})}):a(d)}getValue(a){return this.Uf(olympe.sc.logic.pb.valueProp,a||olympe.dc.ib.tj,Object)}getType(){const a=this.transform(olympe.sc.logic.pb.j,olympe.sc.logic.Sb.typeRel);a.Qd(olympe.dc.CloudObject);return a.Jc()}Zy(){return this.Tc(olympe.sc.logic.pb.N,olympe.dc.CloudObject)}Xy(){return this.Tc(olympe.sc.logic.pb.R,
|
|
1182
|
+
olympe.sc.logic.Fb)}Yy(){return this.Tc(olympe.sc.logic.pb.H,olympe.dm.Property)}uy(){return this.Tc(olympe.sc.logic.pb.F,olympe.dc.CloudObject)}sy(){return this.Tc(olympe.sc.logic.pb.j,olympe.sc.logic.ub)}ty(){return this.Tc(olympe.sc.logic.pb.D,olympe.dm.Property)}};olympe.sc.logic.pb.O=olympe.dc.na.j('0168a431d91f25780000',olympe.sc.logic.pb,olympe.sc.P.Da);olympe.sc.logic.pb.valueProp=olympe.sc.logic.pb.O.ja('0168a431d91f25780001');olympe.sc.logic.pb.N=olympe.sc.logic.pb.O.ra('0168a431d91f25780002');
|
|
1183
1183
|
olympe.sc.logic.pb.R=R(olympe.sc.logic.pb.O,olympe.sc.logic.Fb.D);olympe.sc.logic.pb.H=olympe.sc.logic.pb.O.ra('0168a431d91f25780004');olympe.sc.logic.pb.F=olympe.sc.logic.pb.O.ra('0168a431d91f2578000a');olympe.sc.logic.pb.j=R(olympe.sc.logic.pb.O,olympe.sc.logic.ub.D);olympe.sc.logic.pb.D=olympe.sc.logic.pb.O.ra('0168a431d91f2578000c');R(olympe.dc.CloudObject.O,olympe.sc.logic.pb.N);R(olympe.dm.Property.O,olympe.sc.logic.pb.H);R(olympe.dc.CloudObject.O,olympe.sc.logic.pb.F);
|
|
1184
|
-
R(olympe.dm.Property.O,olympe.sc.logic.pb.D);m=olympe.sc.logic.pb.prototype;m.getType.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.
|
|
1185
|
-
400))})}},b.T())}function po(a,b){const c=a.
|
|
1184
|
+
R(olympe.dm.Property.O,olympe.sc.logic.pb.D);m=olympe.sc.logic.pb.prototype;m.getType.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.Zy.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.Xy.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);m.Yy.K=new olympe.C.J(()=>olympe.dm.Property,[]);m.uy.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);m.sy.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.ty.K=new olympe.C.J(()=>olympe.dm.Property,[]);function oo(a,b){const c=a.wd(),d=c.ym().W(),e=c.zm().W(),f=c.Am().W();b.on(d,g=>{if(g){g=new Map(a.getInputs().map(k=>[k,b.get(k)]));const h={timeout:a.timeout};olympe.L.qb.get(a.Wb(),g,h).then(k=>{for(const [l,n]of k)l!==e&&l!==f&&b.set(l,n);b.set(e,k.get(e));k=k.get(f);k instanceof olympe.sc.logic.Error&&(k=rn(k.message,k.Aj(),k.se()+'\n===== Remote Call =====\n'+b.se()),b.throw(k))}).catch(k=>{k=`RemoteAction "${a.Vb().name()}" (${a.tag}) encountered an error:\n${k}`;a.G.error(k);b.throw(olympe.sc.logic.Error.create(k,
|
|
1185
|
+
400))})}},b.T())}function po(a,b){const c=a.j.ia(()=>new Promise(d=>{b.onDestroy(()=>d())}),void 0,a.timeout);b.onDestroy(()=>a.j.F(c))}
|
|
1186
1186
|
function qo(a,b,c,d,e,f){const g=n=>u(function*(){if(null!==n){e.cancel();let p;null==(p=k)||p();let q;null==(q=l)||q();try{const r=new Map(a.getOutputs().map(t=>[t,b.get(t)]));yield f.cd(r)}catch(r){const t=Error(`Error while trying to send the response of remote action ${a.Vb().name()} (${a.Wb()}): ${r}`);f.li(t).catch(v=>{a.G.error(`Cannot reply with an error to a remote action call ${a.Vb().name()} (${a.Wb()}): ${v}`)})}finally{b.destroy()}}}),h=b.T(),k=b.on(c,g,h),l=b.on(d,g,h)}
|
|
1187
|
-
olympe.sc.logic.Xh=class extends olympe.sc.logic.Function{constructor(a,b,c,d,e,f){super(a,b,c);this.timeout=e;this.
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
olympe.sc.logic.
|
|
1192
|
-
olympe.sc.logic.
|
|
1193
|
-
olympe.sc.
|
|
1194
|
-
olympe.sc.workflow.
|
|
1195
|
-
olympe.sc.workflow.Ff.ff='017ffe02381f9fac5062';olympe.sc.workflow.Ff.ia='017ffe02381f9fac5065';olympe.sc.workflow.Ff.N='017ffe02381f9fac5063';olympe.sc.workflow.Ff.Hc='017ffe02381f9fac5064';m=olympe.sc.workflow.Ff.prototype;m.mv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.pv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.qv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.ty.K=new olympe.C.J(()=>Map,[]);m.nv.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);m.ov.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.workflow.df=class extends olympe.dm.BrickMetadata{Xc(){return this.Tc(olympe.sc.workflow.Workflow.statesRel.$b(),olympe.sc.workflow.Workflow).ka().concat(['.',this.ka()])}};olympe.sc.workflow.df.O=olympe.dc.na.j('017ffdc2dda51d46b430',olympe.sc.workflow.df);olympe.sc.workflow.Transition=class extends olympe.dc.CloudObject{D(){return this.dt()}j(){return this.Tc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.df)}F(){return this.Tc(olympe.sc.workflow.Transition.toStateRel,olympe.sc.workflow.df)}Xc(){const a=this.Tc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.df);return a.Tc(olympe.sc.workflow.Workflow.statesRel.$b(),olympe.sc.workflow.Workflow).ka().concat(['.',a.ka(),'->',this.ka()])}};
|
|
1187
|
+
olympe.sc.logic.Xh=class extends olympe.sc.logic.Function{constructor(a,b,c,d,e,f){super(a,b,c);this.timeout=e;this.j=d;this.X=f}run(a){let b;null!=(b=a.Qa(olympe.sc.xa.j.EDITION))&&b||(this.db.Pa(this,olympe.sc.logic.Xh.F)?(Fn(a.state,this),this.vb(a)):this.X&&0<olympe.dc.la.pe(this.X,olympe.sc.pa.Oc).bb(olympe.sc.Va.H).bb(olympe.sc.Runnable.D).filter(olympe.dc.query.za.dt(this.Wb())).Cc().size()?super.run(a):(Un(this,a),oo(this,a)))}vb(a){const b=this.Wb(),c=this.wd(),d=c.qq().W(),e=c.ym().W(),
|
|
1188
|
+
f=c.zm().W(),g=c.Am().W(),h=new olympe.L.qb(b,a);this.j.ia(()=>u(function*(){return h.stop()}),`RemoteAction_${this.tag}`);h.listen().subscribe(rxjs.Subscriber.create(k=>{const l=a.ji('remote call'),n=k.body();l.set(olympe.sc.xa.j.REDELIVERED,k.wi());po(this,l);const p=Bc(()=>{k.li(Error(`Timeout reached on remote action ${this.db.name(this)} (${this.tag})`)).catch();l.destroy()},this.timeout);qo(this,l,f,g,p,k);super.run(l);for(const [q,r]of n)q!==e&&l.set(q,r);k.Bi().then(q=>{var r=l.get(d);null!==
|
|
1189
|
+
r&&olympe.dc.ea(r)!==q&&(r=this.Wb(),this.G.warn(`Remote action ${this.db.name(r)} ${r}: try to run it with an input user that is not the real authenticated user.`));l.set(d,q);l.set(e,n.get(e))}).catch(q=>{const r=this.Wb();this.G.warn(`Remote action ${this.db.name(r)} ${r} Triggered by unrecognized user: ${q}.`);l.set(g,olympe.sc.logic.Error.create('Unrecognized User',1))})},k=>{const l=this.Wb();this.G.error(`Error while listening on remote action ${this.db.name(l)} (${l}): ${k.message}`)}))}};
|
|
1190
|
+
olympe.sc.logic.Xh.O=olympe.dc.na.j('017a7b0c5dcbd8964c5d',olympe.sc.logic.Xh,olympe.sc.P.Da,olympe.host.P.He,new olympe.V.oa(olympe.sc.Config.tr),new olympe.V.oa(olympe.sc.Config.ze));olympe.sc.logic.Xh.F=olympe.sc.logic.Xh.O.ja('017a7b0c62a02a89444f');olympe.sc.logic.controllers={};olympe.sc.logic.controllers.vm=class{constructor(a){this.db=olympe.dc.ha();this.typeRel=a}};olympe.sc.logic.controllers.vm.j={UA:-1,UB:1};olympe.sc.logic.controllers.MC=class extends olympe.sc.logic.controllers.vm{constructor(){super(olympe.sc.logic.rd.j)}};olympe.sc.logic.controllers.VC=class extends olympe.sc.logic.controllers.vm{constructor(){super(olympe.sc.logic.Sb.typeRel)}};olympe.sc.logic.fl={};olympe.sc.logic.fl.Gw=class extends olympe.sc.logic.Function{update(a,[b],[c]){const d=olympe.dc.ea(b);d?olympe.dc.la.Ob(a,d,olympe.dc.Lb.kg).subscribe(()=>{c(olympe.dc.CloudObject.get(d))}):this.G.warn('Cannot subscribe to an instance with no tag: '+d)}};olympe.sc.logic.na.j('0174bf4b7e006e4b788a',olympe.sc.logic.fl.Gw);olympe.sc.logic.actions={};olympe.sc.logic.fl.Av=class extends olympe.sc.logic.Function{run(a){Un(this,a);const [b,c,d]=Yn(this,a);let e,f=null,g=null;const h=a.getParent(),k=()=>{null===g||0===e?(this.G.warn('No list to iter upon'),this.G.info(a.T())):f<e?(b(g.lf(f)),f++,c(Date.now())):(Hn(h.state),d(Date.now()))};this.getInputs().forEach((l,n)=>a.on(l,p=>{if(p)switch(n){case 0:g=p;break;case 1:e=g.wg();f=0;Gn(h.state);k();break;case 2:k();break;default:this.G.error('Unhandled input')}},this.tag))}};
|
|
1191
|
+
olympe.sc.logic.na.j('0171889b060b6cd54300',olympe.sc.logic.fl.Av);olympe.sc.logic.Qb={};olympe.sc.logic.Qb.im=class extends olympe.sc.logic.Bd{R(){return this.j('016ac638085357047a2d')}};olympe.sc.logic.Qb.im.O=ko('0169b6876a03f14ae61b',olympe.sc.logic.Qb.im);olympe.sc.logic.Qb.im.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);let ro=null;olympe.sc.logic.Qb.wm=class extends olympe.sc.logic.Bd{R(){return this.j('016ac63808535703691c')}F(a){if(null===ro){let b;ro=null!=(b=olympe.V.getParameter('sc.event.experimental'))?b:!1}return ro?a.observe(Rn(this)[0]):super.F(a)}};olympe.sc.logic.Qb.wm.O=ko('0169b6876a03f139d50a',olympe.sc.logic.Qb.wm);olympe.sc.logic.Qb.wm.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.Qb.Mm=class extends olympe.sc.logic.Bd{R(){return this.j('016ac63809a9a8e6db96')}X(){return this.D('016ac6380ab003363b3e')}};ko('01646ad602f933b8caaf',olympe.sc.logic.Qb.Mm);olympe.sc.logic.Qb.Mm.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.Qb.Mm.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.Qb.xk=class extends olympe.sc.logic.Bd{R(){return this.j('016ac6380bd98f1d91a0')}ba(){return this.D('016ac63c589ae38ca3ae')}X(){return this.D('016ac63c5a377fceabaa')}};ko('0168ec42fc01747a98b6',olympe.sc.logic.Qb.xk);olympe.sc.logic.Qb.xk.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.logic.Qb.xk.prototype.ba.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.Qb.xk.prototype.X.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.logic.Qb.Vg=class extends olympe.sc.logic.Bd{ym(){return this.j('017a7b07b09e3b22c8b4')}qq(){return this.j('017a7b07ba05807a74b0')}zm(){return this.D('017a7b0818c12388d731')}Am(){return this.D('017a7b085146d5e69aec')}hv(){return olympe.C.da.D}};olympe.sc.logic.Qb.Vg.N='017a7b07b09e3b22c8b4';olympe.sc.logic.Qb.Vg.Hc='017a7b07ba05807a74b0';olympe.sc.logic.Qb.Vg.ia='017a7b0818c12388d731';olympe.sc.logic.Qb.Vg.j='017a7b085146d5e69aec';
|
|
1192
|
+
olympe.sc.logic.Qb.Vg.O=ko('017a7b07a948e30508fa',olympe.sc.logic.Qb.Vg,olympe.sc.logic.Xh);m=olympe.sc.logic.Qb.Vg.prototype;m.ym.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.qq.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.zm.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);m.Am.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);m.hv.K=olympe.C.J.N;olympe.sc.logic.Qb.Ur=class extends olympe.sc.logic.Bd{R(){return this.j('016ac63c5b3ed0562740')}};ko('016a9766c230916ea5ec',olympe.sc.logic.Qb.Ur);olympe.sc.logic.Qb.Ur.prototype.R.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);olympe.sc.query={};olympe.sc.query.uo=class extends olympe.sc.Og{};olympe.sc.query.uo.O=olympe.dc.na.j('01631aacd8276ea98491',olympe.sc.query.uo);olympe.sc.query.$q=class extends olympe.dm.Enum{};olympe.sc.query.$q.O=olympe.dc.na.j('01631aacd8276ea98495',olympe.sc.query.$q);olympe.sc.query.kr=class extends olympe.dm.Enum{};olympe.sc.query.kr.O=olympe.dc.na.j('01631aacd8276ea98494',olympe.sc.query.kr);olympe.sc.query.nr=class extends olympe.sc.Og{};olympe.sc.query.nr.O=olympe.dc.na.j('01631aacd8276ea98492',olympe.sc.query.nr);olympe.sc.query.nc=class extends olympe.dc.CloudObject{};olympe.sc.query.nc.O=olympe.dc.na.j('01631aacd8276ea98493',olympe.sc.query.nc);olympe.sc.Xo=class extends olympe.dc.CloudObject{};olympe.sc.Xo.O=olympe.dc.na.j('018312ceeb3e93618a85',olympe.sc.Xo);olympe.sc.workflow={};olympe.sc.workflow.ObjectState=class extends olympe.dc.CloudObject{};olympe.sc.workflow.ObjectState.O=olympe.dc.na.j('017ffdd8f0b1e31fe138',olympe.sc.workflow.ObjectState);olympe.sc.workflow.ObjectState.workflowProp=olympe.sc.workflow.ObjectState.O.ja('017ffdd8f0b1e31fe13e');olympe.sc.workflow.ObjectState.stateProp=olympe.sc.workflow.ObjectState.O.ja('017ffdd8f0b1e31fe139');olympe.sc.workflow.ObjectState.assigneeProp=olympe.sc.workflow.ObjectState.O.ja('017ffdd8f0b1e31fe13a');
|
|
1193
|
+
olympe.sc.workflow.ObjectState.dateTimeProp=olympe.sc.workflow.ObjectState.O.ja('017ffdd8f0b1e31fe13b');olympe.sc.workflow.ObjectState.serializedObjectProp=olympe.sc.workflow.ObjectState.O.ja('017ffdd8f0b1e31fe13d');olympe.sc.workflow.ObjectState.objectRel=olympe.sc.workflow.ObjectState.O.ra('017ffdd8f0b1e31fe13c');olympe.sc.workflow.ObjectState.currentObjectRel=olympe.sc.workflow.ObjectState.O.ra('017ffdd8f0b1e31fe13f');olympe.sc.workflow.Ff=class extends olympe.sc.logic.Bd{jv(){return this.j('017ffe02381f9fac5060')}mv(){return this.j('017ffe02381f9fac5061')}nv(){return this.j('017ffe02381f9fac5062')}py(){return this.j('017ffe02381f9fac5065')}kv(){return this.D('017ffe02381f9fac5063')}lv(){return this.D('017ffe02381f9fac5064')}};olympe.sc.workflow.Ff.O=ko('017ffde21f5fe0f704ce',olympe.sc.workflow.Ff);olympe.sc.workflow.Ff.j='017ffe02381f9fac5060';olympe.sc.workflow.Ff.Qe='017ffe02381f9fac5061';
|
|
1194
|
+
olympe.sc.workflow.Ff.ef='017ffe02381f9fac5062';olympe.sc.workflow.Ff.ia='017ffe02381f9fac5065';olympe.sc.workflow.Ff.N='017ffe02381f9fac5063';olympe.sc.workflow.Ff.Hc='017ffe02381f9fac5064';m=olympe.sc.workflow.Ff.prototype;m.jv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.mv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.nv.K=new olympe.C.J(()=>olympe.sc.logic.ub,[]);m.py.K=new olympe.C.J(()=>Map,[]);m.kv.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);m.lv.K=new olympe.C.J(()=>olympe.sc.logic.Fb,[]);olympe.sc.workflow.cf=class extends olympe.dm.BrickMetadata{Xc(){return this.Tc(olympe.sc.workflow.Workflow.statesRel.$b(),olympe.sc.workflow.Workflow).ka().concat(['.',this.ka()])}};olympe.sc.workflow.cf.O=olympe.dc.na.j('017ffdc2dda51d46b430',olympe.sc.workflow.cf);olympe.sc.workflow.Transition=class extends olympe.dc.CloudObject{D(){return this.Zs()}j(){return this.Tc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.cf)}F(){return this.Tc(olympe.sc.workflow.Transition.toStateRel,olympe.sc.workflow.cf)}Xc(){const a=this.Tc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.cf);return a.Tc(olympe.sc.workflow.Workflow.statesRel.$b(),olympe.sc.workflow.Workflow).ka().concat(['.',a.ka(),'->',this.ka()])}};
|
|
1196
1195
|
olympe.sc.workflow.Transition.O=olympe.dc.na.j('017ffdc633219f16beea',olympe.sc.workflow.Transition);olympe.sc.workflow.Transition.processRefProp=olympe.sc.workflow.Transition.O.ja('017ffdc633219f16beec');olympe.sc.workflow.Transition.fromStateRel=olympe.sc.workflow.Transition.O.ra('017ffdc2dda51d46b431');olympe.sc.workflow.Transition.toStateRel=olympe.sc.workflow.Transition.O.ra('017ffdc633219f16beeb');olympe.sc.workflow.Transition.prototype.D.K=new olympe.C.J(()=>olympe.dc.CloudObject,[]);
|
|
1197
|
-
olympe.sc.workflow.Transition.prototype.j.K=new olympe.C.J(()=>olympe.sc.workflow.
|
|
1196
|
+
olympe.sc.workflow.Transition.prototype.j.K=new olympe.C.J(()=>olympe.sc.workflow.cf,[]);olympe.sc.workflow.Transition.prototype.F.K=new olympe.C.J(()=>olympe.sc.workflow.cf,[]);olympe.sc.workflow.Workflow=class extends olympe.dm.BrickMetadata{ve(){return olympe.sc.xe.Oe.Bh}F(){return this.mh(olympe.sc.workflow.Workflow.serializationEnabledProp)}j(){return this.Tc(olympe.sc.workflow.Workflow.dataTypeRel,olympe.sc.Ac)}D(){return this.Tc(olympe.sc.workflow.Workflow.initialStateRel,olympe.sc.workflow.cf)}};olympe.sc.workflow.Workflow.O=olympe.dc.na.j('017ffdc010e5bcc9c971',olympe.sc.workflow.Workflow);olympe.sc.workflow.Workflow.serializationEnabledProp=olympe.sc.workflow.Workflow.O.ja('017ffdc010e5bcc9c972');
|
|
1198
1197
|
olympe.sc.workflow.Workflow.dataTypeRel=olympe.sc.workflow.Workflow.O.ra('017ffdc010e5bcc9c973');olympe.sc.workflow.Workflow.statesRel=olympe.sc.workflow.Workflow.O.ra('017ffdc010e5bcc9c974');olympe.sc.workflow.Workflow.initialStateRel=olympe.sc.workflow.Workflow.O.ra('017ffdc010e5bcc9c975');olympe.sc.workflow.Workflow.prototype.F.K=olympe.C.J.N;olympe.sc.workflow.Workflow.prototype.j.K=new olympe.C.J(()=>olympe.sc.Ac,[]);
|
|
1199
|
-
olympe.sc.workflow.Workflow.prototype.D.K=new olympe.C.J(()=>olympe.sc.workflow.
|
|
1200
|
-
olympe.sc.pa.nb.O=olympe.dc.na.j('011203300000000adef5',olympe.sc.pa.nb);olympe.sc.pa.nb.gi=olympe.sc.pa.nb.O.ja('011203300000000adef6');olympe.sc.pa.nb.ia=olympe.sc.pa.nb.O.ja('011203300000000adef7');olympe.sc.pa.nb.j=olympe.sc.pa.nb.O.ja('011203300000000adef8');olympe.sc.pa.nb.H=olympe.sc.pa.nb.O.ja('011203300000000adef9');olympe.sc.pa.nb.
|
|
1201
|
-
olympe.sc.pa.nb.Z=olympe.sc.pa.nb.O.ja('011203300000000adefd');olympe.sc.pa.nb.N=olympe.sc.pa.nb.O.ja('011203300000000adefe');olympe.sc.pa.nb.R=olympe.sc.pa.nb.O.ja('011203300000000adeff');olympe.sc.pa.nb.F=olympe.sc.pa.nb.O.ja('011203300000000adee0');olympe.sc.pa.nb.oc={INIT:0,
|
|
1202
|
-
m.
|
|
1203
|
-
olympe.sc.pa.
|
|
1198
|
+
olympe.sc.workflow.Workflow.prototype.D.K=new olympe.C.J(()=>olympe.sc.workflow.cf,[]);olympe.sc.pa={};olympe.sc.pa.Oc=class extends olympe.sc.Va{ve(){return olympe.sc.xe.Oe.ow}};olympe.sc.pa.Oc.O=olympe.dc.na.j('01120300000000adef00',olympe.sc.pa.Oc);olympe.sc.pa.Oc.j=olympe.sc.pa.Oc.O.ra('0171bc1f15da96dfdb89');olympe.sc.pa.Oc.ia=olympe.sc.pa.Oc.O.ra('0171bc1f15da96dfdb90');R(olympe.dm.Rc.O,olympe.sc.pa.Oc.j);olympe.sc.pa.Ei=class extends olympe.sc.Runnable{H(){return[this.Wb()]}j(){return olympe.dc.sd.from(this.Wb()).bb(olympe.sc.pa.Oc.j).Cc()}};olympe.sc.pa.Ei.O=kg(olympe.dc.na.j('0113030000000aca1100',olympe.sc.pa.Ei));olympe.sc.pa.Ei.prototype.j.K=new olympe.C.J(()=>olympe.dm.hb,[]);olympe.sc.pa.nb=class extends olympe.dc.CloudObject{pv(){return this.mh(olympe.sc.pa.nb.gi)}Bz(){return this.mh(olympe.sc.pa.nb.ia)}Kc(){return this.xd(olympe.sc.pa.nb.j)}wy(){return this.wb(olympe.sc.pa.nb.H)}Ry(){return this.wb(olympe.sc.pa.nb.ba)}Qy(){return this.wb(olympe.sc.pa.nb.X)}Qf(){return this.wb(olympe.sc.pa.nb.Z)}Gy(){return this.wb(olympe.sc.pa.nb.N)}by(){return this.wb(olympe.sc.pa.nb.D)}Py(){return this.wb(olympe.sc.pa.nb.R)}ov(){return this.wb(olympe.sc.pa.nb.F)}};
|
|
1199
|
+
olympe.sc.pa.nb.O=olympe.dc.na.j('011203300000000adef5',olympe.sc.pa.nb);olympe.sc.pa.nb.gi=olympe.sc.pa.nb.O.ja('011203300000000adef6');olympe.sc.pa.nb.ia=olympe.sc.pa.nb.O.ja('011203300000000adef7');olympe.sc.pa.nb.j=olympe.sc.pa.nb.O.ja('011203300000000adef8');olympe.sc.pa.nb.H=olympe.sc.pa.nb.O.ja('011203300000000adef9');olympe.sc.pa.nb.ba=olympe.sc.pa.nb.O.ja('011203300000000adefa');olympe.sc.pa.nb.X=olympe.sc.pa.nb.O.ja('011203300000000adefb');olympe.sc.pa.nb.D=olympe.sc.pa.nb.O.ja('011203300000000adefc');
|
|
1200
|
+
olympe.sc.pa.nb.Z=olympe.sc.pa.nb.O.ja('011203300000000adefd');olympe.sc.pa.nb.N=olympe.sc.pa.nb.O.ja('011203300000000adefe');olympe.sc.pa.nb.R=olympe.sc.pa.nb.O.ja('011203300000000adeff');olympe.sc.pa.nb.F=olympe.sc.pa.nb.O.ja('011203300000000adee0');olympe.sc.pa.nb.oc={INIT:0,GA:1,Pk:2,Ok:3,$m:4,oD:5,Ab:9};m=olympe.sc.pa.nb.prototype;m.pv.K=olympe.C.J.N;m.Bz.K=olympe.C.J.N;m.Kc.K=olympe.C.J.F;m.wy.K=olympe.C.J.D;m.Ry.K=olympe.C.J.D;m.Qy.K=olympe.C.J.D;m.Qf.K=olympe.C.J.D;m.Gy.K=olympe.C.J.D;
|
|
1201
|
+
m.by.K=olympe.C.J.D;m.Py.K=olympe.C.J.D;m.ov.K=olympe.C.J.D;olympe.sc.pa.tm=class extends olympe.sc.pa.Ei{F(a){a.set(olympe.sc.xa.j.jo,!0);super.F(a)}wa(){return!0}};olympe.sc.pa.tm.O=olympe.dc.na.j('0113032000000aca1102',olympe.sc.pa.tm,olympe.sc.P.Da);olympe.sc.pa.bf=class extends olympe.sc.pa.Oc{j(){return(new olympe.dc.rk(this.W(),olympe.sc.pa.nb)).bb(olympe.sc.pa.bf.N).Xi().Jc()}};olympe.sc.pa.bf.O=olympe.dc.na.j('011203300000000adef3',olympe.sc.pa.bf);olympe.sc.pa.bf.N=olympe.sc.pa.bf.O.ra('011203300000000adef4');R(olympe.sc.pa.nb.O,olympe.sc.pa.bf.N);
|
|
1202
|
+
olympe.sc.pa.bf.O.j=(a,b,c)=>{b=bm(a,b||'New Service Application model',olympe.sc.pa.bf,olympe.sc.pa.tm);a.Oa(olympe.sc.pa.Oc.j,b,c);c=a.create(olympe.sc.pa.nb).W();a.Oa(olympe.sc.pa.bf.N,b,c);return b.W()};olympe.sc.pa.bf.prototype.j.K=new olympe.C.J(()=>olympe.sc.pa.nb,[]);olympe.sc.bh=class extends olympe.dc.CloudObject{static get(){return olympe.dc.CloudObject.get('011203300000000adf0f')}};olympe.sc.bh.O=olympe.dc.na.j('011203300000000adf00',olympe.sc.bh);olympe.sc.bh.D=olympe.sc.bh.O.ja('011203300000000adf01');olympe.sc.bh.j=olympe.sc.bh.O.ja('011203300000000adf02');olympe.sc.bh.F='011203300000000adf0f';olympe.sc.Ag={};olympe.sc.Ag.pz=a=>{var b=a.j;const c=olympe.dc.ha();var d=null;var e=null===eo;for(const f of b.Vc())if((b=f.Vb())&&f.D()&&f.jb()===olympe.dc.Ia.SERVER&&Z(a,f.tag())&&c.Nb(b,olympe.sc.Ac)){if(!e)throw new olympe.dc.Qq;let g,h;null==d&&(d=null,null!==co?d=co:'string'===typeof bo&&(d=olympe.dc.sd.from(bo).bb(olympe.sc.pa.Oc.j).bb(olympe.sc.tf.j.$b()).Cc()),d=null==(g=d)?void 0:g.W());d=null!=(h=d)?h:null;if(null===d)throw Error(`No business container for new instance of ${olympe.dc.ea(b)}`);a.Oa(olympe.sc.tf.D.W(),
|
|
1204
1203
|
d,f.tag())}};
|
|
1205
|
-
olympe.sc.Ag.
|
|
1206
|
-
let p;f=null!=(p=null==(k=b.Uc(h))?void 0:k.Vb())?p:c.model(h)}if(c.Vf(f,olympe.dm.
|
|
1207
|
-
olympe.sc.Ag.
|
|
1208
|
-
n:'unknown';throw Error(`Try to link an instance (${a}) of DataType ${c.name(g)} (${g}) to an instance which is not (${h}) a DataType: ${c.name(e)} (${e})`);}}}};olympe.sc.Ag.
|
|
1209
|
-
olympe.V.run([olympe.dc.transaction.P.Fa],a=>{hm(hm(hm(a,olympe.sc.Ag.
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
olympe.sc.Ya.prototype.merge=olympe.sc.Ya.prototype.merge;olympe.sc.Ya.prototype.model=olympe.sc.Ya.prototype.model;olympe.sc.Ya.prototype.setSource=olympe.sc.Ya.prototype.yi;olympe.sc.Ya.prototype.persistInstance=olympe.sc.Ya.prototype.Xz;olympe.sc.Ya.prototype.persist=olympe.sc.Ya.prototype.persist;olympe.sc.Ya.prototype.deleteAllRelations=olympe.sc.Ya.prototype.Cn;olympe.sc.Ya.prototype.deleteRelation=olympe.sc.Ya.prototype.hc;olympe.sc.Ya.prototype.createRelation=olympe.sc.Ya.prototype.Oa;
|
|
1215
|
-
olympe.sc.Ya.prototype['delete']=olympe.sc.Ya.prototype.delete;olympe.sc.Ya.prototype.multiUpdate=olympe.sc.Ya.prototype.pt;olympe.sc.Ya.prototype.update=olympe.sc.Ya.prototype.update;olympe.sc.Ya.prototype.create=olympe.sc.Ya.prototype.create;olympe.sc.Ya.prototype.getId=olympe.sc.Ya.prototype.T;olympe.sc.Ya.process=olympe.sc.Ya.process;olympe.sc.Ya.from=olympe.sc.Ya.from;olympe.sc.mj=class{constructor(a){this.j=a}py(){return this.j.map(olympe.dc.CloudObject.get)}};olympe.sc.mj.prototype.getCreatedObjects=olympe.sc.mj.prototype.py;olympe.yc={};olympe.yc.Pt=class{run(){}};function wo(a,b='default'){return a.j===b}
|
|
1204
|
+
olympe.sc.Ag.Dz=a=>{const b=a.j,c=olympe.dc.ha();for(const d of b.Vc()){const e=d.Vb();e&&!d.yd()&&c.Nb(e,olympe.sc.Ac)&&d.zb().forEach((f,g)=>{if(f instanceof olympe.dc.vc){const l=b.Uc(f.W());if(null===l)throw Error(`Try to assign an instance as complex property which is not created within the same transaction: ${f.W()}`);var h;f=null!=(h=null==l?void 0:l.Vb())?h:null;h=l.tag();let n;if(f===olympe.dc.ea(olympe.sc.Td)){h=l.Ib(olympe.sc.Td.j);if(!h)throw Error('No object reference found for new ObjectRef');var k;
|
|
1205
|
+
let p;f=null!=(p=null==(k=b.Uc(h))?void 0:k.Vb())?p:c.model(h)}if(c.Vf(f,olympe.dm.Je)){k=ln(f);let p;n=null!=(p=l.Pa(k.W()))?p:c.Pa(h,k)}if(void 0===n)throw Error(`Try to set a complex property to an instance of a DataType: ${c.name(e)} (${e})`);a.Yc(d.tag(),new Map([[g,n]]));Wl(a,l.tag(),olympe.dc.Lb.Dc)}})}};
|
|
1206
|
+
olympe.sc.Ag.Bx=a=>{const b=a.j,c=olympe.dc.ha(),d=new Set;for(var e of b.Bb.values()){a=e.tag();let f;const g=null!=(f=e.Vb())?f:c.model(a);if(null!==g&&e.Fd()&&(d.has(g)||c.Nb(g,olympe.sc.Ac))){d.add(g);const h=Array.from(e.ba()).flatMap(([k,,l,n])=>n&&k!==olympe.dc.fc.Zc?[l]:[]).find(k=>{let l,n;const p=null!=(n=null==(l=b.Uc(k))?void 0:l.Vb())?n:c.model(k);return!p||!(d.has(p)||c.Nb(p,olympe.sc.Ac))});if(void 0!==h){let k,l,n;e=null!=(n=null!=(l=null==(k=b.Uc(h))?void 0:k.Vb())?l:c.model(h))?
|
|
1207
|
+
n:'unknown';throw Error(`Try to link an instance (${a}) of DataType ${c.name(g)} (${g}) to an instance which is not (${h}) a DataType: ${c.name(e)} (${e})`);}}}};olympe.sc.Ag.Tz=a=>{var b=a.j;const c=olympe.dc.ha();for(const d of b.Vc()){b=d.tag();const e=d.Vb();if(e&&!c.Nb(e,olympe.sc.Ac)&&Z(a,b))throw Error(`You are trying to persist an instance of : ${c.name(e)} (${e}), but only instances of DataType can be persisted`);}};
|
|
1208
|
+
olympe.V.run([olympe.dc.transaction.P.Fa],a=>{hm(hm(hm(a,olympe.sc.Ag.Bx,'businessDataRelations'),olympe.sc.Ag.pz,'linkBusinessContainer'),olympe.sc.Ag.Dz,'noBusinessComplexProperty')});olympe.sc.$j=class extends olympe.dm.BrickMetadata{ve(){return olympe.sc.xe.Oe.Bh}};olympe.sc.$j.O=olympe.dc.na.j('01645fe6873aeea59e64',olympe.sc.$j);olympe.sc.$j.j=olympe.sc.$j.O.ra('017ed8ac775f48d4d589');olympe.sc.Uo=class extends olympe.dm.Kb{ve(){return olympe.sc.xe.Oe.Bh}};olympe.sc.Uo.O=olympe.dc.na.j('0163a68ce44f3d1fa95d',olympe.sc.Uo);olympe.sc.zh=class extends olympe.dm.BrickMetadata{};olympe.sc.zh.O=olympe.dc.na.j('016324fde11a836f77d3',olympe.sc.zh);olympe.sc.zh.j=olympe.sc.Ac.O.ra('016324fde11a836088d3');olympe.sc.zh.O.j=(a,b)=>bm(a,null!=b?b:'New config type',olympe.sc.zh).W();olympe.sc.QA=class{};olympe.sc.ek=class extends olympe.dm.BrickMetadata{ve(){return olympe.sc.xe.Oe.Bh}};olympe.sc.ek.O=olympe.dc.na.j('017dc8d6c8fd8c8bd2ff',olympe.sc.ek);olympe.sc.ek.O.j=(a,b)=>bm(a,null!=b?b:'New data connector',olympe.sc.ek,olympe.dm.DataSource).W();olympe.sc.Be=class extends olympe.sc.Runnable{X(){return this.cb(olympe.sc.Be.H,olympe.sc.Runnable)}j(){return this.cb(olympe.sc.Be.F,olympe.dm.Property)}};olympe.sc.Be.O=kg(olympe.dc.na.j('016c2d996d9ca27fa9d8',olympe.sc.Be));olympe.sc.Be.H=olympe.sc.Be.O.ra('016c3cb7742ec9309e0b');olympe.sc.Be.F=olympe.sc.Be.O.ra('016c42d3454636f90533');olympe.sc.Be.prototype.X.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.sc.Be.prototype.j.K=new olympe.C.J(()=>olympe.dc.Aa,[]);olympe.sc.sp=class extends olympe.dm.Kb{ve(){return olympe.sc.xe.Oe.Bh}};olympe.sc.sp.O=olympe.dc.na.j('017a7a9ff057958e5678',olympe.sc.sp);olympe.sc.Mi=class extends olympe.dm.Enum{static create(a,b,c,d,e){const f=olympe.dc.ha();e=void 0!==e?e:f.Ja(b)&&f.Vc(b).length||0;c=(new Map).set(olympe.dm.String.valueProp,c).set(olympe.dc.CloudObject.nameProp,d||c).set(olympe.dm.Enum.rankProp,e);return a.create(b,c)}};olympe.sc.Mi.create=olympe.sc.Mi.create;olympe.sc.Mi.O=olympe.dc.na.j('016cdd861b32d56c8208',olympe.sc.Mi);olympe.sc.zq=class extends olympe.dm.Kb{ve(){return olympe.sc.xe.Oe.Qw}};olympe.sc.zq.O=olympe.dc.na.j('01644b6d4543b344b857',olympe.sc.zq);olympe.sc.Aq=class extends olympe.dc.CloudObject{};olympe.sc.Aq.O=olympe.dc.na.j('0162f672366be5ca7a86',olympe.sc.Aq);const so={rp:30};olympe.sc.cc=class extends olympe.dc.sources.cc{D(a){return a instanceof olympe.sc.logic.Error?this.format(so.rp,{c:a.Aj(),m:a.message,s:a.se()}):super.D(a)}j(a){return(null==a?void 0:a.t)===so.rp?(a=a.v,rn(a.m,a.c,a.s)):super.j(a)}H(a){super.H(a);if(this.db.model(a)===olympe.sc.Td.O.W()){const b=olympe.sc.Td.j;this.F.get(a).r.push({r:b.W(),o:a,d:this.db.Ib(a,b)})}return a}};olympe.sc.Vr=class extends olympe.sc.Be{};olympe.sc.Vr.O=olympe.dc.na.j('016d3f37610ae4fc3962',olympe.sc.Vr);olympe.sc.Text=class extends olympe.dm.String{};olympe.sc.Text.O=olympe.dc.na.j('016cfca73e63f9ab5ba4',olympe.sc.Text);olympe.sc.Ya=class{constructor(a=!0){a=$l(a);a.N=!0;var b=olympe.sc.Ag.Tz;let c;(null==(c=olympe.V.getParameter(olympe.dc.transaction.Config.fm))?0:c.includes('persistenceBusinessDataOnly'))||a.R.push(b);this.j=a;this.D=[];this.source=null}static from(a){const b=olympe.sc.xa.j.TRANSACTION;return a.has(b,!0)?a.get(b,!0):new olympe.sc.Ya}static process(a,b){return a.has(olympe.sc.xa.j.TRANSACTION,!0)?Promise.resolve(!1):b.mb().then(()=>!0)}T(){return this.j.T()}create(a,b=new Map,c=this.source,d){c=
|
|
1209
|
+
'string'===typeof c?c:olympe.dc.ee().fromModel(a);a=this.j.create(a,d).yi(c);for(const [e,f]of b)X(a,e,f);b=a.W();this.D.push(b);return b}update(a,b,c){this.j.update(a,b,c);return this}lt(a,b){a=this.j.update(a);for(const [c,d]of b)b=d,a.Kd.set(olympe.dc.ea(c),b);return this}delete(a){this.j.delete(a);return this}Oa(a,b,c){this.j.Oa(a,b,c);return this}hc(a,b,c){this.j.hc(a,b,c);return this}An(a,b){this.j.An(a,b);return this}persist(a,b=!0){this.j.persist(a,b);return this}Sz(a,b=!0){olympe.ga.Wa('dc').warn('Transaction#persistInstance() has been deprecated. Please use Transaction#persist() instead.');
|
|
1210
|
+
return this.persist(a,b)}yi(a){this.source=a;return this}model(a){return this.j.model(a)}merge(a){am(this.j,a.j);return this}rn(a){this.j.rn(a);return this}mb(){return new Promise((a,b)=>{this.j.mb((c,d)=>{c?a(new olympe.sc.mj(this.D)):b(d)})})}Bn(){return new Promise((a,b)=>{this.j.Bn((c,d)=>{c?a(new olympe.sc.mj(this.D)):b(d)})})}};olympe.sc.Ya.prototype.executeAsLarge=olympe.sc.Ya.prototype.Bn;olympe.sc.Ya.prototype.execute=olympe.sc.Ya.prototype.mb;olympe.sc.Ya.prototype.afterExecution=olympe.sc.Ya.prototype.rn;
|
|
1211
|
+
olympe.sc.Ya.prototype.merge=olympe.sc.Ya.prototype.merge;olympe.sc.Ya.prototype.model=olympe.sc.Ya.prototype.model;olympe.sc.Ya.prototype.setSource=olympe.sc.Ya.prototype.yi;olympe.sc.Ya.prototype.persistInstance=olympe.sc.Ya.prototype.Sz;olympe.sc.Ya.prototype.persist=olympe.sc.Ya.prototype.persist;olympe.sc.Ya.prototype.deleteAllRelations=olympe.sc.Ya.prototype.An;olympe.sc.Ya.prototype.deleteRelation=olympe.sc.Ya.prototype.hc;olympe.sc.Ya.prototype.createRelation=olympe.sc.Ya.prototype.Oa;
|
|
1212
|
+
olympe.sc.Ya.prototype['delete']=olympe.sc.Ya.prototype.delete;olympe.sc.Ya.prototype.multiUpdate=olympe.sc.Ya.prototype.lt;olympe.sc.Ya.prototype.update=olympe.sc.Ya.prototype.update;olympe.sc.Ya.prototype.create=olympe.sc.Ya.prototype.create;olympe.sc.Ya.prototype.getId=olympe.sc.Ya.prototype.T;olympe.sc.Ya.process=olympe.sc.Ya.process;olympe.sc.Ya.from=olympe.sc.Ya.from;olympe.sc.mj=class{constructor(a){this.j=a}my(){return this.j.map(olympe.dc.CloudObject.get)}};olympe.sc.mj.prototype.getCreatedObjects=olympe.sc.mj.prototype.my;olympe.yc={};olympe.yc.Lt=class{run(){}};function to(a,b='default'){return a.j===b}
|
|
1216
1213
|
olympe.yc.Ta=class{constructor(a,b){this.j=a;this.G=b;this.D=null;this.F='';this.G.info('HC Manager will execute application registered as:',this.j)}Nj(a,b,c=''){b||(b='default');b===this.j?(null===this.D?this.G.log('Application',c,'designated to be launched'):this.G.log('OVERRIDE: Application',c,'designated to be launched'),this.D=a,this.F=c):this.G.debug('ignoring application:'+c+' as it is registered under name '+b+' and not '+this.j)}run(){null!==this.D?(this.G.info('Running application:',this.F),
|
|
1217
|
-
this.D.run()):this.G.error('No app registered under name: '+this.j)}};olympe.yc.Nj=function(a,b,c='default'){const d=a.Wa();c?d.debug('Pre-registering application '+b+' under name '+c+' (use '+olympe.yc.Config.
|
|
1218
|
-
olympe.V.run([olympe.yc.P.Fa],a=>a.run(),'olympe.hc');olympe.sc.Hb={};function
|
|
1219
|
-
function
|
|
1220
|
-
h.
|
|
1221
|
-
{md:olympe.dc.la.nc.
|
|
1222
|
-
function
|
|
1223
|
-
a.G.info(`Application ${olympe.dc.
|
|
1224
|
-
3E4);let e;null==(e=a.
|
|
1225
|
-
olympe.sc.Hb
|
|
1226
|
-
c=olympe.L.uc.j.Ef,d=olympe.L.uc.j.zc;olympe.C.Wc([this.N.getState()],e=>{switch(e){case b:case c:this.G.debug('Server session opened or working offline, start the application');a||(a=!0,
|
|
1227
|
-
b[olympe.net.ua.Headers.
|
|
1228
|
-
h:h.message}`,olympe.net.ua.
|
|
1229
|
-
typeof f)try{f=JSON.parse(f)}catch(h){d.G.warn(`Invalid manifest app config for app: ${e}`),f={}}e=Object.assign({},g,d.j,f);return new olympe.net.qd(JSON.stringify(e),olympe.net.ua.
|
|
1230
|
-
olympe.sc.Hb.
|
|
1231
|
-
new olympe.dc.Ya;d.yj().forEach(f=>{e.Oa(olympe.dm.DataSource.Mj,this.j,f)});d.Ej().forEach(f=>{e.hc(olympe.dm.DataSource.Mj,this.j,f)});e.mb()})}}};olympe.sc.Hb.P={kg:'sc.runtime.Main',
|
|
1232
|
-
olympe.V.config(function(a){E(a,olympe.sc.Hb.Config.
|
|
1233
|
-
g:d;return new Map([['offlineEnabled',f],['offlineAutoBackOnline',!f||b]])});Wa(a,olympe.net.P.
|
|
1234
|
-
(b,c,d,e,f)=>new Map([['appTag',b],['getContextMode',c],['debuggerName',d],['autostartProfiler',e],['requireBusinessContainer',f]]));C(a,olympe.sc.Hb.P.kg,olympe.sc.Hb
|
|
1235
|
-
C(a,olympe.sc.Hb.P.
|
|
1236
|
-
d)}static yg(){return new Promise((b,c)=>{olympe.public.Ma.get().yg(d=>d?c(d):b())})}static
|
|
1237
|
-
b).set('password',c),olympe.auth.Ec.j.SRP)}static
|
|
1238
|
-
c),olympe.auth.Ec.j.
|
|
1239
|
-
olympe.public.Ma.loginToken=olympe.public.Ma.
|
|
1240
|
-
olympe.public.Ma.getToken=olympe.public.Ma.
|
|
1241
|
-
olympe.public.xf=class{static create(a){return new class extends olympe.dc.wc.Bg{F(b,c){return olympe.dc.CloudObject.get(c)}compare(b,c){b=a(b,c);if('number'===typeof b)return b;const d=olympe.C.bc(olympe.C.$),e=b.subscribe(f=>d.update(olympe.C.qa(f)));olympe.C.Za().Xd(()=>e.unsubscribe());return d.tb()}}}};olympe.public.Process=class{static
|
|
1242
|
-
b.valueOf()))}};olympe.public.Process.isOnline=olympe.public.Process.qf;olympe.public.Process.disconnect=olympe.public.Process.disconnect;olympe.public.Process.connect=olympe.public.Process.connect;olympe.public.Process.onShutdown=olympe.public.Process.
|
|
1243
|
-
Context:olympe.sc.xa,Entry:olympe.dc.Ra.Entry,PropertyModel:olympe.dm.Property,RelationModel:olympe.dm.Relation,StringModel:olympe.dm.String,NumberModel:olympe.dm.Number,BooleanModel:olympe.dm.Boolean,DatetimeModel:olympe.dm.DateTime,ColorModel:olympe.dm.Color,File:olympe.sc.File,User:olympe.dm.User,Enum:olympe.dm.gg,EnumValue:olympe.sc.Mi,DataSource:olympe.dm.DataSource,DataResult:olympe.dc.query.Dd,Workflow:olympe.sc.workflow.Workflow,WorkflowState:olympe.sc.workflow.
|
|
1244
|
-
WorkflowObjectState:olympe.sc.workflow.ObjectState,Transaction:olympe.sc.Ya,BurstTransaction:olympe.dc.Gi,TransactionResult:olympe.sc.mj,PredefinedDataSource:olympe.dc.Ia,QueryResult:olympe.dc.Ka,Query:olympe.dc.la,QuerySingle:olympe.dc.sd,Predicate:olympe.dc.query.za,Order:olympe.dc.query.
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1214
|
+
this.D.run()):this.G.error('No app registered under name: '+this.j)}};olympe.yc.Nj=function(a,b,c='default'){const d=a.Wa();c?d.debug('Pre-registering application '+b+' under name '+c+' (use '+olympe.yc.Config.ze+'='+c+' to start it)'):d.debug('Pre-registering application '+b+' as default one');a.wd(olympe.yc.P.Fa).config(c,[b],(e,f)=>f.Nj(e,c,b),e=>to(e,c),'olympe.hc.registerApp')};olympe.yc.P={Fa:'hc.Manager',Da:'hc.Logger'};olympe.yc.Config={ze:'hc.app',Jp:'hc.globalToken'};olympe.V.config(function(a){E(a,olympe.yc.Config.ze,'default');E(a,olympe.yc.Config.Jp,!1);D(a,olympe.yc.P.Da,[olympe.ga.P.Fa],b=>b.ad('hc'));D(a,olympe.Db.P.$g,[new olympe.V.oa(olympe.yc.Config.ze)],b=>b);D(a,olympe.auth.P.Fl,[olympe.Db.P.$g,new olympe.V.oa(olympe.yc.Config.Jp)],(b,c)=>new olympe.auth.so(c?'':b));C(a,olympe.yc.P.Fa,olympe.yc.Ta,new olympe.V.oa(olympe.yc.Config.ze),olympe.yc.P.Da)},'olympe.hc');
|
|
1215
|
+
olympe.V.run([olympe.yc.P.Fa],a=>a.run(),'olympe.hc');olympe.sc.Hb={};function uo(a){a.X=a.F.H(()=>u(function*(){return vo(a)}),'Stop application')}function wo(a){a.R=a.F.j(()=>olympe.C.Qa(a.Z)===olympe.C.da.D?Promise.resolve('The application is started'):Promise.reject('The application is not started'),'Application health check',olympe.host.Ke.j.READINESS)}
|
|
1216
|
+
function xo(a){if(a.wa)return a.G.debug('Sending getContext request'),Li(a.Ha).then(()=>{a.G.debug('synchronisation request successful');var f=a.j;eo=null;bo=f}).catch(f=>{a.G.error('failed to synchronise (authenticated) with server: '+f.message)});const b=pn(a.D);!b&&ll();a.G.debug((b?'PULLING':'SUBSCRIBING')+' application '+a.j);const c=a.D.Cb(),d=new Promise((f,g)=>{const h=olympe.dc.ha(),k=new olympe.C.Xb('Primordial Subscription Context',c);zi(k,a.j,l=>{l=h.vi(l)?l:h.model(l);return null!==l&&
|
|
1217
|
+
h.Nb(l,olympe.sc.zh)},{md:b?olympe.dc.la.nc.Qg:olympe.dc.la.nc.wf,bo:!0,ft:!0}).subscribe(rxjs.Subscriber.create(c.rc(()=>{h.Nb(a.j,olympe.sc.pa.Oc)?(a.Ua.X(a.j,b),f()):Pd(a.N)?g(Error(`The specified application tag (${a.j}) is not an application or does not exist`)):(k.destroy(),a.N.connect().catch(l=>{g(Error(`Failed to load the app while offline, you might want to try again when online: ${l}`))}))}),l=>g(l)))}),e=new Promise(f=>{olympe.C.Wc([a.ia.ue()],g=>{olympe.dc.la.pe(g,olympe.dm.User,olympe.dc.Ia.SERVER).observe(c,
|
|
1218
|
+
{md:olympe.dc.la.nc.Ck,cl:'__code-as-data__'}).subscribe(()=>f())})});return Promise.all([d,e]).then(()=>{if(a.ba)return yo(a);yo(a).then(()=>{})})}
|
|
1219
|
+
function zo(a){a.G.info('Starting application '+a.j);const b=olympe.dc.ha();if(0<a.j.length){const c=Pf(b,a.j,a.D.Cb().rc((f,g)=>{if(f)if(f=Tn(g),f instanceof olympe.sc.pa.Ei){a.G.debug('application retrieved: running');g=mn(a.D,f);const h=new olympe.sc.$a.dw(a.H);ob(a.H,()=>zn(a.D.state,h));pb(a.H,()=>{var k=h.T();return Bn(a.D.state,k)});a.lb&&a.H.start();f.run(g);'string'===typeof a.vb&&(new olympe.sc.$d).ba(f.W(),g,a.G);g.Dt(olympe.sc.xa.j.jo).then(()=>{var k;null==(k=d)||k.cancel();a.Z.update(olympe.C.da.D);
|
|
1220
|
+
a.G.info(`Application ${olympe.dc.ha().name(a.j)} (${a.j}) started`);k=olympe.dc.sources.ce();k.Ub=!0;k.X+=0;k.ke.next(0<k.X);0===k.X&&k.Z&&k.Ub&&(k.G.debug(`Cache: set code-as-data version in local storage: ${k.version}`),k.Ua.set('__code-as-data-version__',k.version),k.vb||(k.Z=!1))})}else a.G.error('application retrieved: not an Application with a run() method');else vo(a)}));olympe.C.Za().onDestroy(()=>{Nf(b,a.j,c)});const d=Bc(()=>{a.G.warn(`requested application ${a.j} may not be available (it may not exist or the logged user may not have the correct permissions)`)},
|
|
1221
|
+
3E4);let e;null==(e=a.Ub)||e.start()}}function yo(a){return u(function*(){Ao(a.j)&&(yield fo(a.j,a.ba).catch(b=>{throw Error(`Failed to load the business container for the application ${a.j}: ${b}`);}))})}function vo(a){a.G.info('Stop the application');a.D.Cb().sg();a.F.D(a.R);a.F.F(a.X)}
|
|
1222
|
+
olympe.sc.Hb.Ym=class{constructor(a,b,c,d,e,f,g,h,k,l){this.G=a;this.ia=b;this.N=c;this.Ha=d;this.F=e;this.X=this.R='';this.D=f;this.Ua=g;this.H=h;this.Ub=l;this.j=k.get('appTag');this.wa=k.get('getContextMode');let n;this.vb=null!=(n=k.get('debuggerName'))?n:null;this.lb=k.get('autostartProfiler');this.ba=k.get('requireBusinessContainer');this.Z=olympe.C.bc(olympe.C.da).update(olympe.C.da.j)}run(){this.G.debug('runtime starting for app #'+this.j);let a=!1;uo(this);wo(this);const b=olympe.L.uc.j.cj,
|
|
1223
|
+
c=olympe.L.uc.j.Ef,d=olympe.L.uc.j.zc;olympe.C.Wc([this.N.getState()],e=>{switch(e){case b:case c:this.G.debug('Server session opened or working offline, start the application');a||(a=!0,xo(this).then(olympe.C.Za().rc(()=>zo(this))));break;case d:this.G.debug('Impossible to open a connection to the orchestrator and offline mode is disabled.')}})}};olympe.sc.Hb.Ym.j='app_instance';olympe.sc.Hb.Ym.ya=[olympe.yc.Lt];olympe.sc.Hb.mw=class{constructor(a,b,c,d){this.G=a;this.D=b;this.F=d.get('httpManifestPath');this.j=d.get('manifestCommon');if(!this.j)this.j={};else if('string'===typeof this.j)try{this.j=JSON.parse(this.j)}catch(e){this.G.warn('Invalid manifest common config'),this.j={}}}start(){const a=b=>{this.G.debug('Request URL',b.j());const c=(new URL(b.j())).searchParams.get('origin');if(c)return c;b=b.Cj();this.G.debug('Request headers',b);return b.origin?b.origin:b.$z?(new URL(b.$z)).origin:b[olympe.net.ua.Headers.zp]&&
|
|
1224
|
+
b[olympe.net.ua.Headers.Ap]?b[olympe.net.ua.Headers.Ap]+'://'+b[olympe.net.ua.Headers.zp]:null};this.D.D('manifest',`${this.F}/:${'appTag'}`,[olympe.net.ua.Rd.GET],(b,c)=>{const d=this;return u(function*(){var e=c.get('appTag');d.G.debug('Processing request to serve manifest for app',e);if(20!==e.length)return new olympe.net.qd('Invalid appTag',olympe.net.ua.Tb.Il);try{var f=yield olympe.dc.la.pe(e,olympe.sc.pa.Oc).mb()}catch(h){return new olympe.net.qd(`Something went wrong: ${'string'===typeof h?
|
|
1225
|
+
h:h.message}`,olympe.net.ua.Tb.Il)}if(0===f.size())return new olympe.net.qd('App not found',olympe.net.ua.Tb.Zi);var g=a(b);f=f.Jc();g={name:f.name(),short_name:f.name(),id:e,start_url:g?`${g}?hc.app=sc.runtime&sc.app=${e}`:void 0,display:'standalone',backgroundColor:'#fff',icons:g?[{src:`${g}/images/logo.svg`,sizes:'150x150',type:'image/png'},{src:`${g}/images/logo.png`,sizes:'1024x1024',type:'image/png',purpose:'maskable any'}]:void 0};f=olympe.V.getParameter(`app.manifest.${e}`);if(!f)f={};else if('string'===
|
|
1226
|
+
typeof f)try{f=JSON.parse(f)}catch(h){d.G.warn(`Invalid manifest app config for app: ${e}`),f={}}e=Object.assign({},g,d.j,f);return new olympe.net.qd(JSON.stringify(e),olympe.net.ua.Tb.Qh,void 0,{'content-type':'application/json'})})}).catch(()=>this.G.error('Error while starting the RuntimeHTTPService'));this.G.debug('Started RuntimeHTTPService')}};function Ao(a){var b=olympe.dm.DataSource.SERVER;const c=olympe.dc.la.from(a).bb(olympe.sc.pa.Oc.j).bb(olympe.dm.Ad.F.$b()).bb(olympe.dm.Ad.j).Cc();a=olympe.dc.la.from(a).bb(olympe.sc.pa.Oc.j).bb(olympe.dm.hb.D).Cc();return c.concat(a).has(b)}
|
|
1227
|
+
olympe.sc.Hb.Sk=class extends olympe.dc.sources.Sk{R(a){return this.db.Nb(a,olympe.sc.Ac)}X(a,b){if(!this.H){super.init();var c=olympe.dc.sd.from(a).bb(olympe.sc.pa.Oc.j).Cc();if(!(c instanceof olympe.dm.hb))throw Error(`Impossible to initialize the source solver for the application ${a}: no project is linked to it`);b=b?olympe.dc.la.nc.Qg:olympe.dc.la.nc.wf;cl(this,c,b);c=new olympe.C.Xb('deployed data sources');olympe.dc.la.from(a).bb(olympe.sc.pa.Oc.ia).observe(c,{md:b}).subscribe(d=>{const e=
|
|
1228
|
+
new olympe.dc.Ya;d.yj().forEach(f=>{e.Oa(olympe.dm.DataSource.Mj,this.j,f)});d.Ej().forEach(f=>{e.hc(olympe.dm.DataSource.Mj,this.j,f)});e.mb()})}}};olympe.sc.Hb.P={kg:'sc.runtime.Main',af:'sc.runtime.SourceSolver',zr:'sc.runtime.appConfig',Br:'sc.runtime.runtimeHTTPServiceConfig',Ar:'sc.runtime.RuntimeHTTPService',Sq:'sc.runtime.OfflineAppConfig'};olympe.sc.Hb.Config={Up:'app.httpManifestPath',xq:'app.manifest.common',tq:'sc.loadBusinessContainer'};
|
|
1229
|
+
olympe.V.config(function(a){E(a,olympe.sc.Hb.Config.Up,'/runtime/manifest');E(a,olympe.sc.Hb.Config.xq,null);E(a,olympe.sc.Hb.Config.tq,!1);D(a,olympe.Db.P.$g,[new olympe.V.oa(olympe.yc.Config.ze),new olympe.V.oa(olympe.sc.Config.ze)],(b,c)=>`${b}${c?'-'+c:''}`);D(a,olympe.sc.Hb.P.Sq,[new olympe.V.oa(olympe.sc.Config.ze),new olympe.V.oa(olympe.net.Config.bj),new olympe.V.oa(olympe.net.Config.Im)],(b,c,d)=>{let e;const f=null!=(e=a.getParameter(`offline.${b}.enabled`))?e:c;let g;b=null!=(g=a.getParameter(`offline.${b}.autoBackOnline`))?
|
|
1230
|
+
g:d;return new Map([['offlineEnabled',f],['offlineAutoBackOnline',!f||b]])});Wa(a,olympe.net.P.Jm,olympe.sc.Hb.P.Sq);C(a,olympe.sc.Hb.P.af,olympe.sc.Hb.Sk,olympe.dc.P.Ch,new olympe.V.oa(olympe.dc.Config.Xg),new olympe.V.oa(olympe.dc.Config.cm));Wa(a,olympe.dc.sources.P.af,olympe.sc.Hb.P.af);D(a,olympe.sc.Hb.P.zr,[new olympe.V.oa(olympe.sc.Config.ze),new olympe.V.oa(olympe.dc.Config.Yh),new olympe.V.oa(olympe.sc.Config.ep),new olympe.V.oa(olympe.sc.Config.lo),new olympe.V.oa(olympe.sc.Hb.Config.tq)],
|
|
1231
|
+
(b,c,d,e,f)=>new Map([['appTag',b],['getContextMode',c],['debuggerName',d],['autostartProfiler',e],['requireBusinessContainer',f]]));C(a,olympe.sc.Hb.P.kg,olympe.sc.Hb.Ym,olympe.sc.P.Da,olympe.auth.P.Fa,olympe.L.P.vf,olympe.dc.query.P.Fk,olympe.host.P.He,olympe.sc.P.Kk,olympe.sc.Hb.P.af,olympe.U.P.jg,olympe.sc.Hb.P.zr,olympe.sc.Hb.P.Ar);D(a,olympe.sc.Hb.P.Br,[new olympe.V.oa(olympe.sc.Hb.Config.Up),new olympe.V.oa(olympe.sc.Hb.Config.xq)],(b,c)=>new Map([['httpManifestPath',b],['manifestCommon',c]]));
|
|
1232
|
+
C(a,olympe.sc.Hb.P.Ar,olympe.sc.Hb.mw,olympe.sc.P.Da,olympe.net.P.nj,olympe.sc.P.Kk,olympe.sc.Hb.P.Br);olympe.yc.Nj(a,olympe.sc.Hb.P.kg,'sc.runtime');olympe.yc.Nj(a,olympe.sc.Hb.P.kg,'sc.headless');olympe.yc.Nj(a,olympe.sc.Hb.P.kg)},'olympe.sc.runtime');olympe.public={};olympe.public.Ma=class a{static $x(b,c){const d=new SRPClient,e=d.generateRandomSalt();return{username:b,login:b,salt:e,verifier:d.generateVerifier(e,b,c)}}static getState(){return sf(olympe.public.Ma.get())}static rl(b){return a.D(olympe.public.Ma.get().rl(),b).pipe(rxjs.operators.map(c=>c.valueOf()))}static oy(){return olympe.C.Qa(olympe.public.Ma.get().ue())}static Mz(b){return a.D(olympe.public.Ma.get().ue(),b)}static te(){var b=olympe.C,c=b.Qa;var d=olympe.public.Ma.get().dd.tb().Gd();return c.call(b,
|
|
1233
|
+
d)}static yg(){return new Promise((b,c)=>{olympe.public.Ma.get().yg(d=>d?c(d):b())})}static By(){return olympe.C.Qa(olympe.public.Ma.get().ri())||void 0}static az(){const b=ee(olympe.public.Ma.get());return{user:b.xc(),userTag:b.ue(),nonce:b.Gd(),payload:b.Vi(),idpName:b.Df(),protocol:b.Mg()}}static Ay(){return Array.from(tf().keys())}static rf(){olympe.public.Ma.get().rf()}static qh(b){return new Promise((c,d)=>{olympe.public.Ma.get().qh(b,e=>e?d(e):c())})}static sz(b,c){return olympe.public.Ma.j((new Map).set('username',
|
|
1234
|
+
b).set('password',c),olympe.auth.Ec.j.SRP)}static uz(b){const c=tf();if(0===c.size||b&&!c.has(b)){var d=0===c.size?'There are no available IDPs':`The IDP name ${b} is not valid, the valid names are ${Array.from(c.keys())}`;return Promise.reject(d)}b?(d=b,b=c.get(b)):(b=Array.from(c)[0],d=b[0],b=b[1]);return olympe.public.Ma.j((new Map).set('idpName',d),b)}static rz(){return olympe.public.Ma.j(new Map,olympe.auth.Ec.j.SAML)}static vz(b,c){return olympe.public.Ma.j((new Map).set('username',b).set('nonce',
|
|
1235
|
+
c),olympe.auth.Ec.j.Km)}static qz(){return olympe.public.Ma.j(new Map,olympe.auth.Ec.j.OAUTH2)}static Jj(){return olympe.public.Ma.get().Jj()}static j(b,c){const d=new olympe.auth.Request;for(const [e,f]of b)d.set(e,f);return new Promise(e=>{rf(olympe.public.Ma.get(),d,c,()=>{e()})})}static get(){return olympe.auth.re()}static D(b,c){return b.asObservable('function'===typeof c.Cb?c.Cb():c)}};olympe.public.Ma.logout=olympe.public.Ma.Jj;olympe.public.Ma.loginOpenID=olympe.public.Ma.qz;
|
|
1236
|
+
olympe.public.Ma.loginToken=olympe.public.Ma.vz;olympe.public.Ma.loginSAML=olympe.public.Ma.rz;olympe.public.Ma.loginSSO=olympe.public.Ma.uz;olympe.public.Ma.loginSRP=olympe.public.Ma.sz;olympe.public.Ma.getUserFromToken=olympe.public.Ma.qh;olympe.public.Ma.sendKeepAlive=olympe.public.Ma.rf;olympe.public.Ma.getIDPNames=olympe.public.Ma.Ay;olympe.public.Ma.getUserToken=olympe.public.Ma.az;olympe.public.Ma.getIDPToken=olympe.public.Ma.By;olympe.public.Ma.refreshToken=olympe.public.Ma.yg;
|
|
1237
|
+
olympe.public.Ma.getToken=olympe.public.Ma.te;olympe.public.Ma.observeUser=olympe.public.Ma.Mz;olympe.public.Ma.getCurrentUser=olympe.public.Ma.oy;olympe.public.Ma.isAuthenticated=olympe.public.Ma.rl;olympe.public.Ma.getState=olympe.public.Ma.getState;olympe.public.Ma.generateSRPData=olympe.public.Ma.$x;olympe.public.Config=class{static getParameter(a){return olympe.V.getParameter(a)}static setParameter(a,b){return olympe.V.Ai(a,b)}};olympe.public.Config.setParameter=olympe.public.Config.setParameter;olympe.public.Config.getParameter=olympe.public.Config.getParameter;olympe.public.za=class{static create(a){return new class extends olympe.dc.Y.Bg{j(b,c){b=a(olympe.dc.CloudObject.get(c));if('boolean'===typeof b)return b;const d=olympe.C.bc(olympe.C.da),e=b.subscribe(f=>d.update(olympe.C.Rb(f)));olympe.C.Za().Xd(()=>e.unsubscribe());return d.tb()}}}};
|
|
1238
|
+
olympe.public.xf=class{static create(a){return new class extends olympe.dc.wc.Bg{F(b,c){return olympe.dc.CloudObject.get(c)}compare(b,c){b=a(b,c);if('number'===typeof b)return b;const d=olympe.C.bc(olympe.C.$),e=b.subscribe(f=>d.update(olympe.C.qa(f)));olympe.C.Za().Xd(()=>e.unsubscribe());return d.tb()}}}};olympe.public.Process=class{static Oz(a,b){if('string'===typeof b)throw Error('When registering a health check, the options parameter should be an object: string is not supported anymore.');const c=olympe.host.ll(),d=c.j(a,void 0,null==b?void 0:b.type);return()=>c.D(d)}static Pz(a,b,c){const d=olympe.host.ll(),e=d.ia(a,b,c);return()=>d.F(e)}static connect(){return olympe.L.En().connect()}static disconnect(){return olympe.L.En().disconnect()}static qf(a){a='function'===typeof a.Cb?a.Cb():a;return olympe.L.En().qf().asObservable(a).pipe(rxjs.operators.map(b=>
|
|
1239
|
+
b.valueOf()))}};olympe.public.Process.isOnline=olympe.public.Process.qf;olympe.public.Process.disconnect=olympe.public.Process.disconnect;olympe.public.Process.connect=olympe.public.Process.connect;olympe.public.Process.onShutdown=olympe.public.Process.Pz;olympe.public.Process.onHealthCheck=olympe.public.Process.Oz;'object'===typeof exports&&(exports={CloudObject:olympe.dc.CloudObject,Relation:olympe.dc.Ra.Relation,Direction:olympe.dc.ta,generateTag:olympe.U.hf,tagToString:olympe.dc.ea,register:olympe.dc.register,defineProperty:olympe.dc.defineProperty,defineRelation:olympe.dc.Gs,defineInverseRelation:olympe.dc.Kx,BrickContext:olympe.sc.xa,Brick:olympe.sc.logic.Function,ActionBrick:olympe.sc.logic.Function,GlobalProperties:olympe.sc.xa.j,registerBrick:olympe.sc.logic.na.j,FunctionBrick:olympe.sc.logic.Function,
|
|
1240
|
+
Context:olympe.sc.xa,Entry:olympe.dc.Ra.Entry,PropertyModel:olympe.dm.Property,RelationModel:olympe.dm.Relation,StringModel:olympe.dm.String,NumberModel:olympe.dm.Number,BooleanModel:olympe.dm.Boolean,DatetimeModel:olympe.dm.DateTime,ColorModel:olympe.dm.Color,File:olympe.sc.File,User:olympe.dm.User,Enum:olympe.dm.gg,EnumValue:olympe.sc.Mi,DataSource:olympe.dm.DataSource,DataResult:olympe.dc.query.Dd,Workflow:olympe.sc.workflow.Workflow,WorkflowState:olympe.sc.workflow.cf,WorkflowTransition:olympe.sc.workflow.Transition,
|
|
1241
|
+
WorkflowObjectState:olympe.sc.workflow.ObjectState,Transaction:olympe.sc.Ya,BurstTransaction:olympe.dc.Gi,TransactionResult:olympe.sc.mj,PredefinedDataSource:olympe.dc.Ia,QueryResult:olympe.dc.Ka,Query:olympe.dc.la,QuerySingle:olympe.dc.sd,Predicate:olympe.dc.query.za,Order:olympe.dc.query.Bk,Config:olympe.public.Config,Process:olympe.public.Process,ProbeType:olympe.host.Ke.j,Cache:{getCacheEntries:()=>olympe.dc.sources.ce().N,clearCache:a=>sl(olympe.dc.sources.ce(),a),getProcessingStatus:()=>olympe.dc.sources.ce().Kc(),
|
|
1242
|
+
getProcessingErrors:()=>olympe.dc.sources.ce().hd.asObservable(),hasPendingChanges:()=>olympe.dc.sources.ce().ba.asObservable(),synchroniseChanges:()=>yl(),getPendingChanges:()=>Bl(),clearPendingChanges:()=>Fl(),loadPendingChanges:a=>Dl(a)},Color:olympe.C.Color,ErrorFlow:olympe.sc.logic.Error,ServiceRequestType:olympe.L.va.j,ServiceRequest:olympe.L.Fc,Service:olympe.L.qb,Auth:olympe.public.Ma,AuthState:{INIT:olympe.auth.Ta.j.INIT,AUTHENTICATING:olympe.auth.Ta.j.Sj,GUEST:olympe.auth.Ta.j.Pi,AUTHENTICATED:olympe.auth.Ta.j.sf,
|
|
1243
|
+
ERROR:olympe.auth.Ta.j.Ab},AuthProtocol:olympe.auth.Ec.j,Sync:olympe.dc.CloudObject,BusinessObject:olympe.dc.CloudObject,StringPrimitive:olympe.dm.String,NumberPrimitive:olympe.dm.Number,BooleanPrimitive:olympe.dm.Boolean,DatetimePrimitive:olympe.dm.DateTime,ColorPrimitive:olympe.dm.Color,PropertyPrimitive:olympe.dm.Property,RelationPrimitive:olympe.dm.Relation,DBView:class extends olympe.dc.kb{static get(){return olympe.dc.ha()}},ListDef:olympe.dc.Aa,instanceToTag:olympe.dc.ea,registerSync:olympe.dc.na.j,
|
|
1244
|
+
getUniqueTag:olympe.U.hf,onDestroy:a=>olympe.C.Za().onDestroy(a),offDestroy:a=>olympe.C.Za().Xf(a),FollowRules:olympe.dc.Lb,transformers:{Related:olympe.dc.aa.$e,RecursiveRelated:olympe.dc.aa.Le,Distinct:olympe.dc.aa.Ki,Filter:olympe.dc.aa.zf,Limit:olympe.dc.aa.Mh,Sort:olympe.dc.aa.ah,Union:olympe.dc.aa.Lf},ListDefPredicate:olympe.public.za,predicates:{And:olympe.dc.Y.Nd,Or:olympe.dc.Y.Ge,Not:olympe.dc.Y.ie,Equals:olympe.dc.Y.Ce,Contains:olympe.dc.Y.yf,Greater:olympe.dc.Y.mk,Smaller:olympe.dc.Y.Rk,
|
|
1245
|
+
HasRelated:olympe.dc.Y.Ri,InstanceOf:olympe.dc.Y.Ui,Regex:olympe.dc.Y.Hf},Comparator:olympe.public.xf,comparators:{Number:olympe.dc.wc.Number,String:olympe.dc.wc.String,DateTime:olympe.dc.wc.DateTime},valuedefs:{BooleanProperty:olympe.dc.ab.Wj,StringProperty:olympe.dc.ab.jj,NumberProperty:olympe.dc.ab.aj,DateTimeProperty:olympe.dc.ab.Ji,Constant:olympe.dc.ab.We,Tag:olympe.dc.ab.kj}});
|
|
1249
1246
|
|
|
1250
1247
|
|
|
1251
1248
|
}.bind(this))();
|