565e59b15de1b2a7cd53e52e63c9d8acd2f84281
Christian Fraß [add] client

Christian Fraß authored 3 years ago

1) var __extends = (this && this.__extends) || (function () {
2)     var extendStatics = function (d, b) {
3)         extendStatics = Object.setPrototypeOf ||
4)             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5)             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6)         return extendStatics(d, b);
7)     };
8)     return function (d, b) {
9)         extendStatics(d, b);
10)         function __() { this.constructor = d; }
11)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12)     };
13) })();
14) /*
15) This file is part of »bacterio-plankton:base«.
16) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

17) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

18) <info@greenscale.de>
19) 
20) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
21) it under the terms of the GNU Lesser General Public License as published by
22) the Free Software Foundation, either version 3 of the License, or
23) (at your option) any later version.
24) 
25) »bacterio-plankton:base« is distributed in the hope that it will be useful,
26) but WITHOUT ANY WARRANTY; without even the implied warranty of
27) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28) GNU Lesser General Public License for more details.
29) 
30) You should have received a copy of the GNU Lesser General Public License
31) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
32)  */
33) // }
34) /*
35) This file is part of »bacterio-plankton:base«.
36) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

37) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

38) <info@greenscale.de>
39) 
40) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
41) it under the terms of the GNU Lesser General Public License as published by
42) the Free Software Foundation, either version 3 of the License, or
43) (at your option) any later version.
44) 
45) »bacterio-plankton:base« is distributed in the hope that it will be useful,
46) but WITHOUT ANY WARRANTY; without even the implied warranty of
47) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48) GNU Lesser General Public License for more details.
49) 
50) You should have received a copy of the GNU Lesser General Public License
51) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
52)  */
53) /**
54)  * @author fenris
55)  */
56) /*export*/ function pseudopointer_null() {
57)     return {
58)         "value": null
59)     };
60) }
61) /**
62)  * @author fenris
63)  */
64) /*export*/ function pseudopointer_make(value) {
65)     return {
66)         "value": value
67)     };
68) }
69) /**
70)  * @author fenris
71)  */
72) /*export*/ function pseudopointer_isset(pseudopointer) {
73)     return (pseudopointer.value != null);
74) }
75) /**
76)  * @author fenris
77)  */
78) /*export*/ function pseudopointer_read(pseudopointer) {
79)     if (pseudopointer.value != null) {
80)         return pseudopointer.value;
81)     }
82)     else {
83)         var message = "nullpointer dereferencation";
84)         throw (new Error(message));
85)     }
86) }
87) /**
88)  * @author fenris
89)  */
90) /*export*/ function pseudopointer_write(pseudopointer, value) {
91)     pseudopointer.value = value;
92) }
93) /*
94) This file is part of »bacterio-plankton:base«.
95) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

96) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

97) <info@greenscale.de>
98) 
99) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
100) it under the terms of the GNU Lesser General Public License as published by
101) the Free Software Foundation, either version 3 of the License, or
102) (at your option) any later version.
103) 
104) »bacterio-plankton:base« is distributed in the hope that it will be useful,
105) but WITHOUT ANY WARRANTY; without even the implied warranty of
106) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107) GNU Lesser General Public License for more details.
108) 
109) You should have received a copy of the GNU Lesser General Public License
110) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
111)  */
112) ;
113) var lib_base;
114) (function (lib_base) {
115)     /**
116)      * @author fenris
117)      */
118)     function environment() {
119)         var entries = [
120)             {
121)                 "id": "web",
122)                 "name": "Web",
123)                 "predicate": function () { return (typeof (document) !== "undefined"); },
124)             },
125)             {
126)                 "id": "node",
127)                 "name": "Node.js",
128)                 "predicate": function () { return (typeof (process) !== "undefined"); },
129)             },
130)             {
131)                 "id": "rhino",
132)                 "name": "Rhino",
133)                 "predicate": function () { return (typeof (java) !== "undefined"); },
134)             },
135)             {
136)                 "id": "webworker",
137)                 "name": "WebWorker",
138)                 "predicate": function () { return (typeof (self["WorkerNavigator"]) !== "undefined"); }
139)             }
140)         ];
141)         var id;
142)         var found = entries.some(function (entry) {
143)             if (entry.predicate()) {
144)                 id = entry.id;
145)                 return true;
146)             }
147)             else {
148)                 return false;
149)             }
150)         });
151)         if (found) {
152)             return id;
153)         }
154)         else {
155)             throw (new Error("unknown environment"));
156)         }
157)     }
158)     lib_base.environment = environment;
159) })(lib_base || (lib_base = {}));
160) /*
161) This file is part of »bacterio-plankton:base«.
162) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

163) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

164) <info@greenscale.de>
165) 
166) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
167) it under the terms of the GNU Lesser General Public License as published by
168) the Free Software Foundation, either version 3 of the License, or
169) (at your option) any later version.
170) 
171) »bacterio-plankton:base« is distributed in the hope that it will be useful,
172) but WITHOUT ANY WARRANTY; without even the implied warranty of
173) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174) GNU Lesser General Public License for more details.
175) 
176) You should have received a copy of the GNU Lesser General Public License
177) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
178)  */
179) /**
180)  * @author fenris
181)  */
182) var instance_verbosity = 0;
183) /**
184)  * @author fenris
185)  */
186) function instance_collate(value1, value2) {
187)     if (typeof (value1) === "object") {
188)         if (value1 == null) {
189)             return (value2 == null);
190)         }
191)         else {
192)             if ("_collate" in value1) {
193)                 return value1["_collate"](value2);
194)             }
195)             else {
196)                 throw (new Error("[collate]" + " " + "object has no such method"));
197)             }
198)         }
199)     }
200)     else {
201)         if (instance_verbosity >= 1) {
202)             lib_log.warn("[collate]" + " " + "primitive value; using default implementation");
203)         }
204)         return (value1 === value2);
205)     }
206) }
207) /**
208)  * @author fenris
209)  */
210) function instance_compare(value1, value2) {
211)     if (typeof (value1) === "object") {
212)         if ("_compare" in value1) {
213)             return value1["_compare"](value2);
214)         }
215)         else {
216)             throw (new Error("[compare]" + " " + "object has no such method"));
217)         }
218)     }
219)     else {
220)         if (instance_verbosity >= 1) {
221)             lib_log.warn("[compare]" + " " + "primitive value; using default implementation");
222)         }
223)         return (value1 <= value2);
224)     }
225) }
226) /**
227)  * @author fenris
228)  */
229) function instance_clone(value) {
230)     if (typeof (value) === "object") {
231)         if ("_clone" in value) {
232)             return value["_clone"]();
233)         }
234)         else {
235)             throw (new Error("[clone]" + " " + "object has no such method"));
236)         }
237)     }
238)     else {
239)         if (instance_verbosity >= 1) {
240)             lib_log.warn("[clone]" + " " + "primitive value; using default implementation");
241)         }
242)         return value;
243)     }
244) }
245) /**
246)  * @desc the ability to generate a string out of the element, which identifies it to a high degree
247)  * @author fenris
248)  */
249) function instance_hash(value) {
250)     if (typeof (value) === "object") {
251)         if ("_hash" in value) {
252)             return value["_hash"]();
253)         }
254)         else {
255)             throw (new Error("[hash]" + " " + "object has no such method"));
256)         }
257)     }
258)     else {
259)         if (instance_verbosity >= 1) {
260)             lib_log.warn("[hash]" + " " + "primitive value; using default implementation");
261)         }
262)         return String(value);
263)     }
264) }
265) /**
266)  * @desc the ability to map the element to a textual representation (most likely not injective)
267)  * @author fenris
268)  */
269) function instance_show(value) {
270)     if (typeof (value) === "object") {
271)         if (value == null) {
272)             return "NULL";
273)         }
274)         else {
275)             if ("_show" in value) {
276)                 return value["_show"]();
277)             }
278)             else {
279)                 // throw (new Error("[show]" + " " + "object has no such method"));
280)                 return JSON.stringify(value);
281)             }
282)         }
283)     }
284)     else {
285)         if (instance_verbosity >= 1) {
286)             lib_log.warn("[show]" + " " + "primitive value; using default implementation");
287)         }
288)         return String(value);
289)     }
290) }
291) /*
292) This file is part of »bacterio-plankton:base«.
293) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

294) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

295) <info@greenscale.de>
296) 
297) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
298) it under the terms of the GNU Lesser General Public License as published by
299) the Free Software Foundation, either version 3 of the License, or
300) (at your option) any later version.
301) 
302) »bacterio-plankton:base« is distributed in the hope that it will be useful,
303) but WITHOUT ANY WARRANTY; without even the implied warranty of
304) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
305) GNU Lesser General Public License for more details.
306) 
307) You should have received a copy of the GNU Lesser General Public License
308) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
309)  */
310) /**
311)  * @todo outsource to dedicated plankton-lib
312)  */
313) var lib_log;
314) (function (lib_log) {
315)     /**
316)      * @author fenris
317)      */
318)     function log() {
319)         var args = [];
320)         for (var _i = 0; _i < arguments.length; _i++) {
321)             args[_i] = arguments[_i];
322)         }
323)         /*window.*/ console.log.apply(console, args);
324)     }
325)     lib_log.log = log;
326)     /**
327)      * @author fenris
328)      */
329)     function info() {
330)         var args = [];
331)         for (var _i = 0; _i < arguments.length; _i++) {
332)             args[_i] = arguments[_i];
333)         }
334)         /*window.*/ console.info.apply(console, args);
335)     }
336)     lib_log.info = info;
337)     /**
338)      * @author fenris
339)      */
340)     function warn() {
341)         var args = [];
342)         for (var _i = 0; _i < arguments.length; _i++) {
343)             args[_i] = arguments[_i];
344)         }
345)         /*window.*/ console.warn.apply(console, args);
346)     }
347)     lib_log.warn = warn;
348)     /**
349)      * @author fenris
350)      */
351)     function error() {
352)         var args = [];
353)         for (var _i = 0; _i < arguments.length; _i++) {
354)             args[_i] = arguments[_i];
355)         }
356)         /*window.*/ console.error.apply(console, args);
357)     }
358)     lib_log.error = error;
359) })(lib_log || (lib_log = {}));
360) /*
361) This file is part of »bacterio-plankton:base«.
362) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

363) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

364) <info@greenscale.de>
365) 
366) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
367) it under the terms of the GNU Lesser General Public License as published by
368) the Free Software Foundation, either version 3 of the License, or
369) (at your option) any later version.
370) 
371) »bacterio-plankton:base« is distributed in the hope that it will be useful,
372) but WITHOUT ANY WARRANTY; without even the implied warranty of
373) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
374) GNU Lesser General Public License for more details.
375) 
376) You should have received a copy of the GNU Lesser General Public License
377) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
378)  */
379) /**
380)  * @author frac
381)  */
382) var class_observer = /** @class */ (function () {
383)     /**
384)      * @author frac
385)      */
386)     function class_observer() {
387)         this.counter = 0;
388)         this.actions = {};
389)         this.buffer = [];
390)     }
391)     /**
392)      * @author frac
393)      */
394)     class_observer.prototype.empty = function () {
395)         return (Object.keys(this.actions).length == 0);
396)     };
397)     /**
398)      * @author frac
399)      */
400)     class_observer.prototype.flush = function () {
401)         this.actions = {};
402)     };
403)     /**
404)      * @author frac
405)      */
406)     class_observer.prototype.set = function (id, action) {
407)         this.actions[id] = action;
408)     };
409)     /**
410)      * @author frac
411)      */
412)     class_observer.prototype.del = function (id) {
413)         delete this.actions[id];
414)     };
415)     /**
416)      * @author frac
417)      */
418)     class_observer.prototype.add = function (action) {
419)         this.set((this.counter++).toString(), action);
420)     };
421)     /**
422)      * @author frac
423)      */
424)     class_observer.prototype.notify = function (information, delayed) {
425)         var _this = this;
426)         if (information === void 0) { information = {}; }
427)         if (delayed === void 0) { delayed = false; }
428)         if (delayed) {
429)             this.buffer.push(information);
430)         }
431)         else {
432)             Object.keys(this.actions).forEach(function (id) { return _this.actions[id](information); });
433)         }
434)     };
435)     /**
436)      * @author frac
437)      */
438)     class_observer.prototype.rollout = function () {
439)         var _this = this;
440)         this.buffer.forEach(function (information) { return _this.notify(information, false); });
441)         this.buffer = [];
442)     };
443)     return class_observer;
444) }());
445) /**
446)  * @author frac
447)  */
448) /*
449) export interface interface_readable<type_value> {
450) 
451)     |**
452)      * @author frac
453)      *|
454)     read() : type_executor<type_value, Error>;
455) 
456) }
457)  */
458) /**
459)  * @author frac
460)  */
461) /*
462) export interface interface_writeable<type_value> {
463) 
464)     |**
465)      * @author frac
466)      *|
467)     write(value : type_value) : type_executor<void, Error>;
468) 
469) }
470)  */
471) /*
472) This file is part of »bacterio-plankton:base«.
473) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

474) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'
Christian Fraß [add] client

Christian Fraß authored 3 years ago

475) <info@greenscale.de>
476) 
477) »bacterio-plankton:base« is free software: you can redistribute it and/or modify
478) it under the terms of the GNU Lesser General Public License as published by
479) the Free Software Foundation, either version 3 of the License, or
480) (at your option) any later version.
481) 
482) »bacterio-plankton:base« is distributed in the hope that it will be useful,
483) but WITHOUT ANY WARRANTY; without even the implied warranty of
484) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
485) GNU Lesser General Public License for more details.
486) 
487) You should have received a copy of the GNU Lesser General Public License
488) along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>.
489)  */
490) var lib_maybe;
491) (function (lib_maybe) {
492)     /**
493)      * @author fenris
494)      */
495)     function make_nothing() {
496)         return {
497)             "kind": "nothing",
498)             "parameters": {}
499)         };
500)     }
501)     lib_maybe.make_nothing = make_nothing;
502)     /**
503)      * @author fenris
504)      */
505)     function make_just(value) {
506)         return {
507)             "kind": "just",
508)             "parameters": {
509)                 "value": value
510)             }
511)         };
512)     }
513)     lib_maybe.make_just = make_just;
514)     /**
515)      * @author fenris
516)      */
517)     function is_nothing(maybe) {
518)         return (maybe.kind === "nothing");
519)     }
520)     lib_maybe.is_nothing = is_nothing;
521)     /**
522)      * @author fenris
523)      */
524)     function is_just(maybe) {
525)         return (maybe.kind === "just");
526)     }
527)     lib_maybe.is_just = is_just;
528)     /**
529)      * @author fenris
530)      */
531)     function cull(maybe) {
532)         if (!is_just(maybe)) {
533)             var message = "cull from nothing";
534)             throw (new Error(message));
535)         }
536)         else {
537)             var value = maybe.parameters["value"];
538)             return value;
539)         }
540)     }
541)     lib_maybe.cull = cull;
542)     /**
543)      * @author fenris
544)      */
545)     function propagate(maybe, function_) {
546)         if (!is_just(maybe)) {
547)         }
548)         else {
549)             var value = maybe.parameters["value"];
550)             var maybe_ = function_(value);
551)             return maybe_;
552)         }
553)     }
554)     lib_maybe.propagate = propagate;
555) })(lib_maybe || (lib_maybe = {}));
556) /**
557)  * @author fenris
558)  */
559) /*export*/ var class_maybe = /** @class */ (function () {
560)     function class_maybe() {
561)     }
562)     /**
563)      * @desc whether the wrapper is nothing
564)      * @author fenris
565)      */
566)     class_maybe.prototype.is_nothing = function () {
567)         throw (new Error("not implemented: class_maybe.is_nothing"));
568)     };
569)     /**
570)      * @desc whether the wrapper is just
571)      * @author fenris
572)      */
573)     class_maybe.prototype.is_just = function () {
574)         throw (new Error("not implemented: class_maybe.is_just"));
575)     };
576)     /**
577)      * @desc return the value, stored in the maybe-wrapper
578)      * @author fenris
579)      */
580)     class_maybe.prototype.cull = function () {
581)         throw (new Error("not implemented: class_maybe.cull"));
582)     };
583)     /**
584)      * @author fenris
585)      */
586)     class_maybe.prototype.toString = function () {
587)         throw (new Error("not implemented: class_maybe.cull"));
588)     };
589)     /**
590)      * @author fenris
591)      */
592)     class_maybe.prototype.distinguish = function (action_just, action_nothing) {
593)         if (action_nothing === void 0) { action_nothing = function () { }; }
594)         throw (new Error("not implemented: class_maybe.distinguish"));
595)     };
596)     /**
597)      * @author fenris
598)      */
599)     class_maybe.prototype.propagate = function (action) {
600)         throw (new Error("not implemented: class_maybe.propagate"));
601)     };
602)     /**
603)      * @desc [implementation]
604)      * @author fenris
605)      */
606)     class_maybe.prototype._show = function () {
607)         return this.toString();
608)     };
609)     return class_maybe;
610) }());
611) /**
612)  * @author fenris
613)  */
614) /*export*/ var class_nothing = /** @class */ (function (_super) {
615)     __extends(class_nothing, _super);
616)     /**
617)      * @author fenris
618)      */
619)     function class_nothing(reason) {
620)         if (reason === void 0) { reason = null; }
621)         var _this = _super.call(this) || this;
622)         _this.reason = reason;
623)         return _this;
624)     }
625)     /**
626)      * @author fenris
627)      */
628)     class_nothing.prototype.is_nothing = function () {
629)         return true;
630)     };
631)     /**
632)      * @author fenris
633)      */
634)     class_nothing.prototype.is_just = function () {
635)         return false;
636)     };
637)     /**
638)      * @author fenris
639)      */
640)     class_nothing.prototype.cull = function () {
641)         var message = "you shouldn't cull a nothing-value …";
642)         lib_log.warn(message);
643)         return null;
644)     };
645)     /**
646)      * @author fenris
647)      */
648)     class_nothing.prototype.toString = function () {
649)         return "<\u00B7>";
650)     };
651)     /**
652)      * @author fenris
653)      */
654)     class_nothing.prototype.reason_get = function () {
655)         var content = ((this.reason == null) ? "·" : this.reason);
656)         return "<- " + content + " ->";
657)     };
658)     /**
659)      * @author fenris
660)      */
661)     class_nothing.prototype.distinguish = function (action_just, action_nothing) {
662)         if (action_nothing === void 0) { action_nothing = function () { }; }
663)         action_nothing(this.reason);
664)     };
665)     /**
666)      * @author fenris
667)      */
668)     class_nothing.prototype.propagate = function (action) {
669)         return (new class_nothing(this.reason));
670)     };
671)     return class_nothing;
672) }(class_maybe));
673) /**
674)  * @author fenris
675)  */
676) /*export*/ var class_just = /** @class */ (function (_super) {
677)     __extends(class_just, _super);
678)     /**
679)      * @author fenris
680)      */
681)     function class_just(value) {
682)         var _this = _super.call(this) || this;
683)         _this.value = value;
684)         return _this;
685)     }
686)     /**
687)      * @author fenris
688)      */
689)     class_just.prototype.is_nothing = function () {
690)         return false;
691)     };
692)     /**
693)      * @author fenris
694)      */
695)     class_just.prototype.is_just = function () {
696)         return true;
697)     };
698)     /**
699)      * @author fenris
700)      */
701)     class_just.prototype.cull = function () {
702)         return this.value;
703)     };
704)     /**
705)      * @author fenris
706)      */
707)     class_just.prototype.toString = function () {
708)         var content = instance_show(this.value);
709)         return "<+ " + content + " +>";
710)     };
711)     /**
712)      * @author fenris
713)      */
714)     class_just.prototype.distinguish = function (action_just, action_nothing) {
715)         if (action_nothing === void 0) { action_nothing = function () { }; }
716)         action_just(this.value);
717)     };
718)     /**
719)      * @author fenris
720)      */
721)     class_just.prototype.propagate = function (action) {
722)         return action(this.value);
723)     };
724)     return class_just;
725) }(class_maybe));
726) /*
727) This file is part of »bacterio-plankton:base«.
728) 
Christian Fraß [upd] client:lib:plankton

Christian Fraß authored 3 years ago

729) Copyright 2016-2021 'Christian Fraß, Christian Neubauer, Martin Springwald GbR'