clientnode 4.0.1491 → 4.0.1493

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.
Files changed (113) hide show
  1. package/dist/Lock.js +83 -68
  2. package/dist/Logger.js +163 -693
  3. package/dist/Semaphore.js +46 -55
  4. package/dist/array.js +337 -545
  5. package/dist/cli.js +37 -44
  6. package/dist/constants.js +110 -184
  7. package/dist/context.js +25 -209
  8. package/dist/cookie.js +48 -204
  9. package/dist/data-transfer.js +166 -701
  10. package/dist/datetime.js +245 -1042
  11. package/dist/domNode.js +277 -427
  12. package/dist/expression/evaluators.js +234 -1108
  13. package/dist/expression/helper.js +82 -100
  14. package/dist/expression/index.js +10 -1253
  15. package/dist/expression/indicator-functions.js +21 -208
  16. package/dist/expression/type.js +5 -1
  17. package/dist/filesystem.js +324 -286
  18. package/dist/function.js +51 -90
  19. package/dist/index.js +26 -3059
  20. package/dist/indicators.js +79 -418
  21. package/dist/module.js +109 -154
  22. package/dist/number.js +25 -397
  23. package/dist/object.js +803 -849
  24. package/dist/process.js +38 -200
  25. package/dist/property-types.js +96 -17
  26. package/dist/scope.js +56 -1982
  27. package/dist/string.js +626 -924
  28. package/dist/test-helper.js +289 -514
  29. package/dist/type.js +9 -4
  30. package/dist/utility.js +91 -310
  31. package/package.json +3 -3
  32. package/dist/Lock.d.ts +0 -39
  33. package/dist/Logger.d.ts +0 -102
  34. package/dist/Semaphore.d.ts +0 -29
  35. package/dist/array.d.ts +0 -150
  36. package/dist/bundle/index.js +0 -4507
  37. package/dist/cli.d.ts +0 -31
  38. package/dist/compatible/Lock.js +0 -85
  39. package/dist/compatible/Logger.js +0 -715
  40. package/dist/compatible/Semaphore.js +0 -74
  41. package/dist/compatible/array.js +0 -660
  42. package/dist/compatible/cli.js +0 -58
  43. package/dist/compatible/constants.js +0 -200
  44. package/dist/compatible/context.js +0 -224
  45. package/dist/compatible/cookie.js +0 -240
  46. package/dist/compatible/data-transfer.js +0 -751
  47. package/dist/compatible/datetime.js +0 -1083
  48. package/dist/compatible/domNode.js +0 -481
  49. package/dist/compatible/expression/evaluators.js +0 -1147
  50. package/dist/compatible/expression/helper.js +0 -115
  51. package/dist/compatible/expression/index.js +0 -1269
  52. package/dist/compatible/expression/indicator-functions.js +0 -224
  53. package/dist/compatible/expression/type.js +0 -16
  54. package/dist/compatible/filesystem.js +0 -373
  55. package/dist/compatible/function.js +0 -114
  56. package/dist/compatible/index.js +0 -3076
  57. package/dist/compatible/indicators.js +0 -471
  58. package/dist/compatible/module.js +0 -168
  59. package/dist/compatible/number.js +0 -433
  60. package/dist/compatible/object.js +0 -1037
  61. package/dist/compatible/process.js +0 -230
  62. package/dist/compatible/property-types.js +0 -36
  63. package/dist/compatible/scope.js +0 -2011
  64. package/dist/compatible/string.js +0 -1151
  65. package/dist/compatible/test-helper.js +0 -837
  66. package/dist/compatible/type.js +0 -16
  67. package/dist/compatible/utility.js +0 -358
  68. package/dist/constants.d.ts +0 -99
  69. package/dist/context.d.ts +0 -8
  70. package/dist/cookie.d.ts +0 -31
  71. package/dist/data-transfer.d.ts +0 -45
  72. package/dist/datetime.d.ts +0 -37
  73. package/dist/domNode.d.ts +0 -82
  74. package/dist/expression/evaluators.d.ts +0 -55
  75. package/dist/expression/helper.d.ts +0 -4
  76. package/dist/expression/index.d.ts +0 -7
  77. package/dist/expression/indicator-functions.d.ts +0 -14
  78. package/dist/expression/type.d.ts +0 -70
  79. package/dist/filesystem.d.ts +0 -143
  80. package/dist/function.d.ts +0 -20
  81. package/dist/index.d.ts +0 -23
  82. package/dist/indicators.d.ts +0 -68
  83. package/dist/module.d.ts +0 -10
  84. package/dist/number.d.ts +0 -35
  85. package/dist/object.d.ts +0 -231
  86. package/dist/process.d.ts +0 -22
  87. package/dist/property-types.d.ts +0 -460
  88. package/dist/scope.d.ts +0 -44
  89. package/dist/string.d.ts +0 -319
  90. package/dist/test/Lock.d.ts +0 -1
  91. package/dist/test/Logger.d.ts +0 -1
  92. package/dist/test/Semaphore.d.ts +0 -1
  93. package/dist/test/array.d.ts +0 -1
  94. package/dist/test/cookie.d.ts +0 -1
  95. package/dist/test/data-transfer.d.ts +0 -1
  96. package/dist/test/datetime.d.ts +0 -1
  97. package/dist/test/domNode.d.ts +0 -1
  98. package/dist/test/expression/evaluators.d.ts +0 -1
  99. package/dist/test/expression/helper.d.ts +0 -1
  100. package/dist/test/expression/indicator-functions.d.ts +0 -1
  101. package/dist/test/filesystem.d.ts +0 -1
  102. package/dist/test/function.d.ts +0 -1
  103. package/dist/test/indicators.d.ts +0 -1
  104. package/dist/test/number.d.ts +0 -1
  105. package/dist/test/object.d.ts +0 -1
  106. package/dist/test/process.d.ts +0 -1
  107. package/dist/test/property-types.d.ts +0 -1
  108. package/dist/test/scope.d.ts +0 -1
  109. package/dist/test/string.d.ts +0 -1
  110. package/dist/test/utility.d.ts +0 -1
  111. package/dist/test-helper.d.ts +0 -245
  112. package/dist/type.d.ts +0 -248
  113. package/dist/utility.d.ts +0 -44
package/dist/Lock.js CHANGED
@@ -1,47 +1,9 @@
1
- if(typeof window==='undefined'||window===null)var window=(typeof globalThis==='undefined'||globalThis===null)?{}:globalThis;/******/ // The require scope
2
- /******/ var __webpack_require__ = {};
3
- /******/
4
- /************************************************************************/
5
- /******/ /* webpack/runtime/define property getters */
6
- /******/ !function() {
7
- /******/ // define getter/value functions for harmony exports
8
- /******/ __webpack_require__.d = function(exports, definition) {
9
- /******/ if(Array.isArray(definition)) {
10
- /******/ var i = 0;
11
- /******/ while(i < definition.length) {
12
- /******/ var key = definition[i++];
13
- /******/ var binding = definition[i++];
14
- /******/ if(!__webpack_require__.o(exports, key)) {
15
- /******/ if(binding === 0) {
16
- /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
17
- /******/ } else {
18
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
19
- /******/ }
20
- /******/ } else if(binding === 0) { i++; }
21
- /******/ }
22
- /******/ } else {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ }
29
- /******/ };
30
- /******/ }();
31
- /******/
32
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
33
- /******/ !function() {
34
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
35
- /******/ }();
36
- /******/
37
- /************************************************************************/
38
- var __webpack_exports__ = {};
39
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
40
- /* harmony export */ c: function() { return /* binding */ Lock; }
41
- /* harmony export */ });
42
1
  // #!/usr/bin/env babel-node
43
2
  // -*- coding: utf-8 -*-
44
- /** @module Lock *//* !
3
+ /** @module Lock */
4
+ 'use strict';
5
+
6
+ /* !
45
7
  region header
46
8
  [Project page](https://torben.website/clientnode)
47
9
 
@@ -54,32 +16,85 @@ var __webpack_exports__ = {};
54
16
  naming 3.0 unported license.
55
17
  See https://creativecommons.org/licenses/by/3.0/deed.de
56
18
  endregion
57
- */function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
19
+ */
20
+ import "core-js/modules/es.array.push.js";
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
+ /**
58
25
  * Represents the lock state.
59
26
  * @property locks - Mapping of lock descriptions to their corresponding
60
27
  * callbacks.
61
- */var Lock=/*#__PURE__*/function(){/**
62
- * Initializes locks.
63
- * @param locks - Mapping of a lock description to callbacks for calling
64
- * when given lock should be released.
65
- */function Lock(locks){if(locks===void 0){locks={}}_classCallCheck(this,Lock);_defineProperty(this,"lock",void 0);_defineProperty(this,"locks",void 0);this.locks=locks}/**
66
- * Calling this method introduces a starting point for a critical area with
67
- * potential race conditions. The area will be bind to given description
68
- * string. So don't use same names for different areas.
69
- * @param description - A short string describing the critical areas
70
- * properties.
71
- * @param callback - A procedure which should only be executed if the
72
- * interpreter isn't in the given critical area. The lock description
73
- * string will be given to the callback function.
74
- * @param autoRelease - Release the lock after execution of given callback.
75
- * @returns Returns a promise which will be resolved after releasing lock.
76
- */return _createClass(Lock,[{key:"acquire",value:function acquire(description,callback,autoRelease){var _this=this;if(autoRelease===void 0){autoRelease=false}return new Promise(function(resolve){var wrappedCallback=function wrappedCallback(description){var _result;var result;if(callback)result=callback(description);var finish=function finish(value){if(autoRelease)void _this.release(description);resolve(value);return value};if((_result=result)!==null&&_result!==void 0&&_result.then)return result.then(finish);finish(result);return result};if(description){if(Object.prototype.hasOwnProperty.call(_this.locks,description))_this.locks[description].push(wrappedCallback);else{_this.locks[description]=[];void wrappedCallback(description)}return}if(_this.lock)_this.lock.push(wrappedCallback);else{_this.lock=[];void wrappedCallback(description)}})}/**
77
- * Calling this method causes the given critical area to be finished and
78
- * all functions given to "acquire()" will be executed in right order.
79
- * @param description - A short string describing the critical areas
80
- * properties.
81
- * @returns Returns the return (maybe promise resolved) value of the
82
- * callback given to the "acquire" method.
83
- */},{key:"release",value:(function(){var _release=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(description){var _this$lock;var _callback,callback;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:if(!description){_context.n=4;break}if(!Object.prototype.hasOwnProperty.call(this.locks,description)){_context.n=3;break}_callback=this.locks[description].shift();if(!(_callback===undefined)){_context.n=1;break}delete this.locks[description];_context.n=3;break;case 1:_context.n=2;return _callback(description);case 2:return _context.a(2,_context.v);case 3:return _context.a(2);case 4:callback=(_this$lock=this.lock)===null||_this$lock===void 0?void 0:_this$lock.shift();if(!(callback===undefined)){_context.n=5;break}this.lock=undefined;_context.n=7;break;case 5:_context.n=6;return callback();case 6:return _context.a(2,_context.v);case 7:return _context.a(2)}},_callee,this)}));function release(_x){return _release.apply(this,arguments)}return release}())}])}();/* harmony default export */ __webpack_exports__.A = (Lock);
84
- var __webpack_exports__default = __webpack_exports__.A;
85
- export { Lock, __webpack_exports__default as default };
28
+ */
29
+ export class Lock {
30
+ /**
31
+ * Initializes locks.
32
+ * @param locks - Mapping of a lock description to callbacks for calling
33
+ * when given lock should be released.
34
+ */
35
+ constructor(locks = {}) {
36
+ _defineProperty(this, "lock", void 0);
37
+ _defineProperty(this, "locks", void 0);
38
+ this.locks = locks;
39
+ }
40
+ /**
41
+ * Calling this method introduces a starting point for a critical area with
42
+ * potential race conditions. The area will be bind to given description
43
+ * string. So don't use same names for different areas.
44
+ * @param description - A short string describing the critical areas
45
+ * properties.
46
+ * @param callback - A procedure which should only be executed if the
47
+ * interpreter isn't in the given critical area. The lock description
48
+ * string will be given to the callback function.
49
+ * @param autoRelease - Release the lock after execution of given callback.
50
+ * @returns Returns a promise which will be resolved after releasing lock.
51
+ */
52
+ acquire(description, callback, autoRelease = false) {
53
+ return new Promise(resolve => {
54
+ const wrappedCallback = description => {
55
+ let result;
56
+ if (callback) result = callback(description);
57
+ const finish = value => {
58
+ if (autoRelease) void this.release(description);
59
+ resolve(value);
60
+ return value;
61
+ };
62
+ if (result?.then) return result.then(finish);
63
+ finish(result);
64
+ return result;
65
+ };
66
+ if (description) {
67
+ if (Object.prototype.hasOwnProperty.call(this.locks, description)) this.locks[description].push(wrappedCallback);else {
68
+ this.locks[description] = [];
69
+ void wrappedCallback(description);
70
+ }
71
+ return;
72
+ }
73
+ if (this.lock) this.lock.push(wrappedCallback);else {
74
+ this.lock = [];
75
+ void wrappedCallback(description);
76
+ }
77
+ });
78
+ }
79
+ /**
80
+ * Calling this method causes the given critical area to be finished and
81
+ * all functions given to "acquire()" will be executed in right order.
82
+ * @param description - A short string describing the critical areas
83
+ * properties.
84
+ * @returns Returns the return (maybe promise resolved) value of the
85
+ * callback given to the "acquire" method.
86
+ */
87
+ async release(description) {
88
+ if (description) {
89
+ if (Object.prototype.hasOwnProperty.call(this.locks, description)) {
90
+ const callback = this.locks[description].shift();
91
+ if (callback === undefined) delete this.locks[description];else return await callback(description);
92
+ }
93
+ return;
94
+ }
95
+ const callback = this.lock?.shift();
96
+ if (callback === undefined) this.lock = undefined;else return await callback();
97
+ }
98
+ }
99
+ export default Lock;
100
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL0xvY2sudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gIyEvdXNyL2Jpbi9lbnYgYmFiZWwtbm9kZVxuLy8gLSotIGNvZGluZzogdXRmLTggLSotXG4vKiogQG1vZHVsZSBMb2NrICovXG4ndXNlIHN0cmljdCdcbi8qICFcbiAgICByZWdpb24gaGVhZGVyXG4gICAgW1Byb2plY3QgcGFnZV0oaHR0cHM6Ly90b3JiZW4ud2Vic2l0ZS9jbGllbnRub2RlKVxuXG4gICAgQ29weXJpZ2h0IFRvcmJlbiBTaWNrZXJ0IChpbmZvW1wifmF0flwiX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ICAgICAgY2FsbGJhY2s/OiBMb2NrQ2FsbGJhY2tGdW5jdGlvbjxUeXBlPixcbiAgICAgICAgYXV0b1JlbGVhc2UgPSBmYWxzZVxuICAgICk6IFByb21pc2U8VHlwZT4ge1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2U8VHlwZT4oKHJlc29sdmU6ICh2YWx1ZTogVHlwZSkgPT4gdm9pZCk6IHZvaWQgPT4ge1xuICAgICAgICAgICAgY29uc3Qgd3JhcHBlZENhbGxiYWNrOiBMb2NrQ2FsbGJhY2tGdW5jdGlvbjxUeXBlPiA9IChcbiAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbj86IHN0cmluZ1xuICAgICAgICAgICAgKTogUHJvbWlzZTxUeXBlPiB8IFR5cGUgPT4ge1xuICAgICAgICAgICAgICAgIGxldCByZXN1bHQ6IFByb21pc2U8VHlwZT4gfCBUeXBlIHwgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgaWYgKGNhbGxiYWNrKVxuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBjYWxsYmFjayhkZXNjcmlwdGlvbilcblxuICAgICAgICAgICAgICAgIGNvbnN0IGZpbmlzaCA9ICh2YWx1ZTogVHlwZSk6IFR5cGUgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoYXV0b1JlbGVhc2UpXG4gICAgICAgICAgICAgICAgICAgICAgICB2b2lkIHRoaXMucmVsZWFzZShkZXNjcmlwdGlvbilcblxuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHZhbHVlKVxuXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICgocmVzdWx0IGFzIG51bGwgfCBQcm9taXNlPFR5cGU+KT8udGhlbilcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChyZXN1bHQgYXMgUHJvbWlzZTxUeXBlPikudGhlbihmaW5pc2gpXG5cbiAgICAgICAgICAgICAgICBmaW5pc2gocmVzdWx0IGFzIFR5cGUpXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0IGFzIFR5cGVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGRlc2NyaXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2NrcywgZGVzY3JpcHRpb24pXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvY2tzW2Rlc2NyaXB0aW9uXS5wdXNoKHdyYXBwZWRDYWxsYmFjaylcbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2Nrc1tkZXNjcmlwdGlvbl0gPSBbXVxuXG4gICAgICAgICAgICAgICAgICAgIHZvaWQgd3JhcHBlZENhbGxiYWNrKGRlc2NyaXB0aW9uKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAodGhpcy5sb2NrKVxuICAgICAgICAgICAgICAgIHRoaXMubG9jay5wdXNoKHdyYXBwZWRDYWxsYmFjaylcbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMubG9jayA9IFtdXG5cbiAgICAgICAgICAgICAgICB2b2lkIHdyYXBwZWRDYWxsYmFjayhkZXNjcmlwdGlvbilcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICB9XG4gICAgLyoqXG4gICAgICogQ2FsbGluZyB0aGlzIG1ldGhvZCBjYXVzZXMgdGhlIGdpdmVuIGNyaXRpY2FsIGFyZWEgdG8gYmUgZmluaXNoZWQgYW5kXG4gICAgICogYWxsIGZ1bmN0aW9ucyBnaXZlbiB0byBcImFjcXVpcmUoKVwiIHdpbGwgYmUgZXhlY3V0ZWQgaW4gcmlnaHQgb3JkZXIuXG4gICAgICogQHBhcmFtIGRlc2NyaXB0aW9uIC0gQSBzaG9ydCBzdHJpbmcgZGVzY3JpYmluZyB0aGUgY3JpdGljYWwgYXJlYXNcbiAgICAgKiBwcm9wZXJ0aWVzLlxuICAgICAqIEByZXR1cm5zIFJldHVybnMgdGhlIHJldHVybiAobWF5YmUgcHJvbWlzZSByZXNvbHZlZCkgdmFsdWUgb2YgdGhlXG4gICAgICogY2FsbGJhY2sgZ2l2ZW4gdG8gdGhlIFwiYWNxdWlyZVwiIG1ldGhvZC5cbiAgICAgKi9cbiAgICBhc3luYyByZWxlYXNlKGRlc2NyaXB0aW9uPzogc3RyaW5nKTogUHJvbWlzZTxUeXBlIHwgdW5kZWZpbmVkPiB7XG4gICAgICAgIGlmIChkZXNjcmlwdGlvbikge1xuICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChcbiAgICAgICAgICAgICAgICB0aGlzLmxvY2tzLCBkZXNjcmlwdGlvblxuICAgICAgICAgICAgKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNhbGxiYWNrOiBMb2NrQ2FsbGJhY2tGdW5jdGlvbjxUeXBlPiB8IHVuZGVmaW5lZCA9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9ja3NbZGVzY3JpcHRpb25dLnNoaWZ0KClcblxuICAgICAgICAgICAgICAgIGlmIChjYWxsYmFjayA9PT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5sb2Nrc1tkZXNjcmlwdGlvbl1cbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBjYWxsYmFjayhkZXNjcmlwdGlvbilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBjYWxsYmFjazogTG9ja0NhbGxiYW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