jsf.js_next_gen 1.0.0-beta-13 → 1.0.0-beta-16
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/dist/window/jsf-development.js +3805 -89
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +5 -5
- package/src/main/typescript/api/Jsf.ts +2 -0
- package/src/main/typescript/impl/AjaxImpl.ts +37 -26
- package/src/main/typescript/impl/util/ExtDomQuery.ts +6 -4
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +23 -30
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +2 -0
- package/target/api/Jsf.js +1 -0
- package/target/api/Jsf.js.map +1 -1
- package/target/impl/AjaxImpl.js +32 -21
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +5 -4
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +20 -26
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +2 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/webpack.config.js +7 -3
- package/webpack.config.js.map +1 -1
- package/webpack.config.ts +8 -7
- package/dist/window/tmp +0 -0
|
@@ -1,14 +1,3741 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
2
3
|
/******/ var __webpack_modules__ = ({
|
|
3
4
|
|
|
4
|
-
/***/ "./node_modules/mona-dish/
|
|
5
|
-
|
|
6
|
-
!*** ./node_modules/mona-dish/
|
|
7
|
-
|
|
8
|
-
/***/ ((__unused_webpack_module, exports)
|
|
5
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts":
|
|
6
|
+
/*!****************************************************************!*\
|
|
7
|
+
!*** ./node_modules/mona-dish/src/main/typescript/DomQuery.ts ***!
|
|
8
|
+
\****************************************************************/
|
|
9
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
13
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
14
|
+
* this work for additional information regarding copyright ownership.
|
|
15
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
16
|
+
* (the "License"); you may not use this file except in compliance with
|
|
17
|
+
* the License. You may obtain a copy of the License at
|
|
18
|
+
*
|
|
19
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
22
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
|
+
* See the License for the specific language governing permissions and
|
|
25
|
+
* limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
var __extends = (this && this.__extends) || (function () {
|
|
28
|
+
var extendStatics = function (d, b) {
|
|
29
|
+
extendStatics = Object.setPrototypeOf ||
|
|
30
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
32
|
+
return extendStatics(d, b);
|
|
33
|
+
};
|
|
34
|
+
return function (d, b) {
|
|
35
|
+
if (typeof b !== "function" && b !== null)
|
|
36
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
37
|
+
extendStatics(d, b);
|
|
38
|
+
function __() { this.constructor = d; }
|
|
39
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __assign = (this && this.__assign) || function () {
|
|
43
|
+
__assign = Object.assign || function(t) {
|
|
44
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
45
|
+
s = arguments[i];
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
};
|
|
51
|
+
return __assign.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
54
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
55
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
56
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
57
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
58
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
59
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
63
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
64
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
65
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
66
|
+
function step(op) {
|
|
67
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
+
while (_) try {
|
|
69
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
70
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
71
|
+
switch (op[0]) {
|
|
72
|
+
case 0: case 1: t = op; break;
|
|
73
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
74
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
75
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
76
|
+
default:
|
|
77
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
78
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
79
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
80
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
81
|
+
if (t[2]) _.ops.pop();
|
|
82
|
+
_.trys.pop(); continue;
|
|
83
|
+
}
|
|
84
|
+
op = body.call(thisArg, _);
|
|
85
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
86
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
90
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
91
|
+
if (ar || !(i in from)) {
|
|
92
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
93
|
+
ar[i] = from[i];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
97
|
+
};
|
|
98
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
99
|
+
exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.ElementAttribute = void 0;
|
|
100
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
101
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
102
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
103
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
104
|
+
var trim = Lang_1.Lang.trim;
|
|
105
|
+
var objToArray = Lang_1.Lang.objToArray;
|
|
106
|
+
var isString = Lang_1.Lang.isString;
|
|
107
|
+
var equalsIgnoreCase = Lang_1.Lang.equalsIgnoreCase;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* // - submit checkboxes and radio inputs only if checked
|
|
111
|
+
if ((tagName != "select" && elemType != "button"
|
|
112
|
+
&& elemType != "reset" && elemType != "submit" && elemType != "image")
|
|
113
|
+
&& ((elemType != "checkbox" && elemType != "radio"
|
|
114
|
+
*/
|
|
115
|
+
var Submittables;
|
|
116
|
+
(function (Submittables) {
|
|
117
|
+
Submittables["SELECT"] = "select";
|
|
118
|
+
Submittables["BUTTON"] = "button";
|
|
119
|
+
Submittables["SUBMIT"] = "submit";
|
|
120
|
+
Submittables["RESET"] = "reset";
|
|
121
|
+
Submittables["IMAGE"] = "image";
|
|
122
|
+
Submittables["RADIO"] = "radio";
|
|
123
|
+
Submittables["CHECKBOX"] = "checkbox";
|
|
124
|
+
})(Submittables || (Submittables = {}));
|
|
125
|
+
/**
|
|
126
|
+
* helper to fix a common problem that a system has to wait until a certain condition is reached
|
|
127
|
+
* depening on the browser this uses either the mutation observer or a semi compatible interval as fallback
|
|
128
|
+
* @param condition
|
|
129
|
+
*/
|
|
130
|
+
function waitUntilDom(root, condition, options) {
|
|
131
|
+
if (options === void 0) { options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }; }
|
|
132
|
+
var ret = new Promise(function (success, error) {
|
|
133
|
+
var MUT_ERROR = new Error("Mutation observer timeout");
|
|
134
|
+
if ('undefined' != typeof window.MutationObserver) {
|
|
135
|
+
var mutTimeout_1 = setTimeout(function () {
|
|
136
|
+
return error(MUT_ERROR);
|
|
137
|
+
}, options.timeout);
|
|
138
|
+
var callback = function (mutationList, observer) {
|
|
139
|
+
var found = new DomQuery(mutationList.map(function (mut) { return mut.target; })).first(condition);
|
|
140
|
+
if (found.isPresent()) {
|
|
141
|
+
clearTimeout(mutTimeout_1);
|
|
142
|
+
success(found);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var observer_1 = new window.MutationObserver(callback);
|
|
146
|
+
// browsers might ignore it, but we cannot break the api in the case
|
|
147
|
+
// hence no timeout is passed
|
|
148
|
+
var observableOpts_1 = __assign({}, options);
|
|
149
|
+
delete observableOpts_1.timeout;
|
|
150
|
+
root.eachElem(function (item) {
|
|
151
|
+
observer_1.observe(item, observableOpts_1);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else { //fallback for legacy browsers without mutation observer
|
|
155
|
+
//we do the same but for now ignore the options on the dom query
|
|
156
|
+
var interval_1 = setInterval(function () {
|
|
157
|
+
var found = null;
|
|
158
|
+
if (options.childList) {
|
|
159
|
+
found = (condition(root)) ? root : root.childNodes.first(condition);
|
|
160
|
+
}
|
|
161
|
+
else if (options.subtree) {
|
|
162
|
+
found = (condition(root)) ? root : root.querySelectorAll(" * ").first(condition);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
found = (condition(root)) ? root : DomQuery.absent;
|
|
166
|
+
}
|
|
167
|
+
if (found.isPresent()) {
|
|
168
|
+
if (timeout_1) {
|
|
169
|
+
clearTimeout(timeout_1);
|
|
170
|
+
clearInterval(interval_1);
|
|
171
|
+
interval_1 = null;
|
|
172
|
+
success(found);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, options.interval);
|
|
176
|
+
var timeout_1 = setTimeout(function () {
|
|
177
|
+
if (interval_1) {
|
|
178
|
+
clearInterval(interval_1);
|
|
179
|
+
error(MUT_ERROR);
|
|
180
|
+
}
|
|
181
|
+
}, options.timeout);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
return ret;
|
|
185
|
+
}
|
|
186
|
+
var ElementAttribute = /** @class */ (function (_super) {
|
|
187
|
+
__extends(ElementAttribute, _super);
|
|
188
|
+
function ElementAttribute(element, name, defaultVal) {
|
|
189
|
+
if (defaultVal === void 0) { defaultVal = null; }
|
|
190
|
+
var _this = _super.call(this, element, name) || this;
|
|
191
|
+
_this.element = element;
|
|
192
|
+
_this.name = name;
|
|
193
|
+
_this.defaultVal = defaultVal;
|
|
194
|
+
return _this;
|
|
195
|
+
}
|
|
196
|
+
Object.defineProperty(ElementAttribute.prototype, "value", {
|
|
197
|
+
get: function () {
|
|
198
|
+
var _a;
|
|
199
|
+
var val = (_a = this.element.get(0)).orElse.apply(_a, []).values;
|
|
200
|
+
if (!val.length) {
|
|
201
|
+
return this.defaultVal;
|
|
202
|
+
}
|
|
203
|
+
return val[0].getAttribute(this.name);
|
|
204
|
+
},
|
|
205
|
+
set: function (value) {
|
|
206
|
+
var _a;
|
|
207
|
+
var val = (_a = this.element.get(0)).orElse.apply(_a, []).values;
|
|
208
|
+
for (var cnt = 0; cnt < val.length; cnt++) {
|
|
209
|
+
val[cnt].setAttribute(this.name, value);
|
|
210
|
+
}
|
|
211
|
+
val[0].setAttribute(this.name, value);
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
ElementAttribute.prototype.getClass = function () {
|
|
217
|
+
return ElementAttribute;
|
|
218
|
+
};
|
|
219
|
+
ElementAttribute.fromNullable = function (value, valueKey) {
|
|
220
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
221
|
+
return new ElementAttribute(value, valueKey);
|
|
222
|
+
};
|
|
223
|
+
return ElementAttribute;
|
|
224
|
+
}(Monad_1.ValueEmbedder));
|
|
225
|
+
exports.ElementAttribute = ElementAttribute;
|
|
226
|
+
/**
|
|
227
|
+
* small helper for the specialized jsf case
|
|
228
|
+
* @param src
|
|
229
|
+
* @constructor
|
|
230
|
+
*/
|
|
231
|
+
var DEFAULT_WHITELIST = function (src) {
|
|
232
|
+
return true;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Monadic DomNode representation, ala jquery
|
|
236
|
+
* This is a thin wrapper over querySelectorAll
|
|
237
|
+
* to get slim monadic support
|
|
238
|
+
* to reduce implementation code on the users side.
|
|
239
|
+
* This is vital for frameworks which want to rely on
|
|
240
|
+
* plain dom but still do not want to lose
|
|
241
|
+
* the reduced code footprint of querying dom trees and traversing
|
|
242
|
+
* by using functional patterns.
|
|
243
|
+
*
|
|
244
|
+
* Also a few convenience methods are added to reduce
|
|
245
|
+
* the code footprint of standard dom processing
|
|
246
|
+
* operations like eval
|
|
247
|
+
*
|
|
248
|
+
* TODO add jquery fallback support, since it is supported
|
|
249
|
+
* in most older systems
|
|
250
|
+
* Note parts of this code still stem from the Dom.js I have written 10 years
|
|
251
|
+
* ago, those parts look a little bit ancient and will be replaced over time.
|
|
252
|
+
*
|
|
253
|
+
*/
|
|
254
|
+
var DomQuery = /** @class */ (function () {
|
|
255
|
+
function DomQuery() {
|
|
256
|
+
var _a;
|
|
257
|
+
var rootNode = [];
|
|
258
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
259
|
+
rootNode[_i] = arguments[_i];
|
|
260
|
+
}
|
|
261
|
+
this.rootNode = [];
|
|
262
|
+
this.pos = -1;
|
|
263
|
+
//TODO this part probably will be removed
|
|
264
|
+
//because we can stream from an array stream directly into the dom query
|
|
265
|
+
this._limits = -1;
|
|
266
|
+
if (Monad_1.Optional.fromNullable(rootNode).isAbsent() || !rootNode.length) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
//we need to flatten out the arrays
|
|
271
|
+
for (var cnt = 0; cnt < rootNode.length; cnt++) {
|
|
272
|
+
if (!rootNode[cnt]) {
|
|
273
|
+
//we skip possible null entries which can happen in
|
|
274
|
+
//certain corner conditions due to the constructor re-wrapping single elements into arrays.
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
else if (isString(rootNode[cnt])) {
|
|
278
|
+
var foundElement = DomQuery.querySelectorAll(rootNode[cnt]);
|
|
279
|
+
if (!foundElement.isAbsent()) {
|
|
280
|
+
rootNode.push.apply(rootNode, foundElement.values);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else if (rootNode[cnt] instanceof DomQuery) {
|
|
284
|
+
(_a = this.rootNode).push.apply(_a, rootNode[cnt].values);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
this.rootNode.push(rootNode[cnt]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
Object.defineProperty(DomQuery.prototype, "value", {
|
|
293
|
+
/**
|
|
294
|
+
* returns the first element
|
|
295
|
+
*/
|
|
296
|
+
get: function () {
|
|
297
|
+
return this.getAsElem(0);
|
|
298
|
+
},
|
|
299
|
+
enumerable: false,
|
|
300
|
+
configurable: true
|
|
301
|
+
});
|
|
302
|
+
Object.defineProperty(DomQuery.prototype, "values", {
|
|
303
|
+
get: function () {
|
|
304
|
+
return this.allElems();
|
|
305
|
+
},
|
|
306
|
+
enumerable: false,
|
|
307
|
+
configurable: true
|
|
308
|
+
});
|
|
309
|
+
Object.defineProperty(DomQuery.prototype, "id", {
|
|
310
|
+
/**
|
|
311
|
+
* returns the id of the first element
|
|
312
|
+
*/
|
|
313
|
+
get: function () {
|
|
314
|
+
return new ElementAttribute(this.get(0), "id");
|
|
315
|
+
},
|
|
316
|
+
enumerable: false,
|
|
317
|
+
configurable: true
|
|
318
|
+
});
|
|
319
|
+
Object.defineProperty(DomQuery.prototype, "length", {
|
|
320
|
+
/**
|
|
321
|
+
* length of the entire query set
|
|
322
|
+
*/
|
|
323
|
+
get: function () {
|
|
324
|
+
return this.rootNode.length;
|
|
325
|
+
},
|
|
326
|
+
enumerable: false,
|
|
327
|
+
configurable: true
|
|
328
|
+
});
|
|
329
|
+
Object.defineProperty(DomQuery.prototype, "tagName", {
|
|
330
|
+
/**
|
|
331
|
+
* convenience method for tagName
|
|
332
|
+
*/
|
|
333
|
+
get: function () {
|
|
334
|
+
return this.getAsElem(0).getIf("tagName");
|
|
335
|
+
},
|
|
336
|
+
enumerable: false,
|
|
337
|
+
configurable: true
|
|
338
|
+
});
|
|
339
|
+
Object.defineProperty(DomQuery.prototype, "nodeName", {
|
|
340
|
+
/**
|
|
341
|
+
* convenience method for nodeName
|
|
342
|
+
*/
|
|
343
|
+
get: function () {
|
|
344
|
+
return this.getAsElem(0).getIf("nodeName");
|
|
345
|
+
},
|
|
346
|
+
enumerable: false,
|
|
347
|
+
configurable: true
|
|
348
|
+
});
|
|
349
|
+
DomQuery.prototype.isTag = function (tagName) {
|
|
350
|
+
return !this.isAbsent()
|
|
351
|
+
&& (this.nodeName.orElse("__none___")
|
|
352
|
+
.value.toLowerCase() == tagName.toLowerCase()
|
|
353
|
+
|| this.tagName.orElse("__none___")
|
|
354
|
+
.value.toLowerCase() == tagName.toLowerCase());
|
|
355
|
+
};
|
|
356
|
+
Object.defineProperty(DomQuery.prototype, "type", {
|
|
357
|
+
/**
|
|
358
|
+
* convenience property for type
|
|
359
|
+
*
|
|
360
|
+
* returns null in case of no type existing otherwise
|
|
361
|
+
* the type of the first element
|
|
362
|
+
*/
|
|
363
|
+
get: function () {
|
|
364
|
+
return this.getAsElem(0).getIf("type");
|
|
365
|
+
},
|
|
366
|
+
enumerable: false,
|
|
367
|
+
configurable: true
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(DomQuery.prototype, "name", {
|
|
370
|
+
/**
|
|
371
|
+
* convenience property for name
|
|
372
|
+
*
|
|
373
|
+
* returns null in case of no type existing otherwise
|
|
374
|
+
* the name of the first element
|
|
375
|
+
*/
|
|
376
|
+
get: function () {
|
|
377
|
+
return new Monad_1.ValueEmbedder(this.getAsElem(0).value, "name");
|
|
378
|
+
},
|
|
379
|
+
enumerable: false,
|
|
380
|
+
configurable: true
|
|
381
|
+
});
|
|
382
|
+
Object.defineProperty(DomQuery.prototype, "inputValue", {
|
|
383
|
+
/**
|
|
384
|
+
* convenience property for value
|
|
385
|
+
*
|
|
386
|
+
* returns null in case of no type existing otherwise
|
|
387
|
+
* the value of the first element
|
|
388
|
+
*/
|
|
389
|
+
get: function () {
|
|
390
|
+
if (this.getAsElem(0).getIf("value").isPresent()) {
|
|
391
|
+
return new Monad_1.ValueEmbedder(this.getAsElem(0).value);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
return Monad_1.ValueEmbedder.absent;
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
enumerable: false,
|
|
398
|
+
configurable: true
|
|
399
|
+
});
|
|
400
|
+
Object.defineProperty(DomQuery.prototype, "checked", {
|
|
401
|
+
get: function () {
|
|
402
|
+
return Stream_1.Stream.of.apply(Stream_1.Stream, this.values).allMatch(function (el) { return !!el.checked; });
|
|
403
|
+
},
|
|
404
|
+
set: function (newChecked) {
|
|
405
|
+
this.eachElem(function (el) { return el.checked = newChecked; });
|
|
406
|
+
},
|
|
407
|
+
enumerable: false,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
410
|
+
Object.defineProperty(DomQuery.prototype, "elements", {
|
|
411
|
+
get: function () {
|
|
412
|
+
//a simple querySelectorAll should suffice
|
|
413
|
+
return this.querySelectorAll("input, checkbox, select, textarea, fieldset");
|
|
414
|
+
},
|
|
415
|
+
enumerable: false,
|
|
416
|
+
configurable: true
|
|
417
|
+
});
|
|
418
|
+
Object.defineProperty(DomQuery.prototype, "deepElements", {
|
|
419
|
+
get: function () {
|
|
420
|
+
var elemStr = "input, select, textarea, checkbox, fieldset";
|
|
421
|
+
return this.querySelectorAllDeep(elemStr);
|
|
422
|
+
},
|
|
423
|
+
enumerable: false,
|
|
424
|
+
configurable: true
|
|
425
|
+
});
|
|
426
|
+
/**
|
|
427
|
+
* a deep search which treats the single isolated shadow doms
|
|
428
|
+
* separately and runs the query on earch shadow dom
|
|
429
|
+
* @param queryStr
|
|
430
|
+
*/
|
|
431
|
+
DomQuery.prototype.querySelectorAllDeep = function (queryStr) {
|
|
432
|
+
var found = [];
|
|
433
|
+
var queryRes = this.querySelectorAll(queryStr);
|
|
434
|
+
if (queryRes.length) {
|
|
435
|
+
found.push(queryRes);
|
|
436
|
+
}
|
|
437
|
+
var shadowRoots = this.querySelectorAll("*").shadowRoot;
|
|
438
|
+
if (shadowRoots.length) {
|
|
439
|
+
var shadowRes = shadowRoots.querySelectorAllDeep(queryStr);
|
|
440
|
+
if (shadowRes.length) {
|
|
441
|
+
found.push(shadowRes);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], found, false)))();
|
|
445
|
+
};
|
|
446
|
+
Object.defineProperty(DomQuery.prototype, "disabled", {
|
|
447
|
+
/**
|
|
448
|
+
* todo align this api with the rest of the apis
|
|
449
|
+
*/
|
|
450
|
+
get: function () {
|
|
451
|
+
return this.attr("disabled").isPresent();
|
|
452
|
+
},
|
|
453
|
+
set: function (disabled) {
|
|
454
|
+
// this.attr("disabled").value = disabled + "";
|
|
455
|
+
if (!disabled) {
|
|
456
|
+
this.removeAttribute("disabled");
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.attr("disabled").value = "disabled";
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
enumerable: false,
|
|
463
|
+
configurable: true
|
|
464
|
+
});
|
|
465
|
+
DomQuery.prototype.removeAttribute = function (name) {
|
|
466
|
+
this.eachElem(function (item) { return item.removeAttribute(name); });
|
|
467
|
+
};
|
|
468
|
+
Object.defineProperty(DomQuery.prototype, "childNodes", {
|
|
469
|
+
get: function () {
|
|
470
|
+
var childNodeArr = [];
|
|
471
|
+
this.eachElem(function (item) {
|
|
472
|
+
childNodeArr = childNodeArr.concat(objToArray(item.childNodes));
|
|
473
|
+
});
|
|
474
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], childNodeArr, false)))();
|
|
475
|
+
},
|
|
476
|
+
enumerable: false,
|
|
477
|
+
configurable: true
|
|
478
|
+
});
|
|
479
|
+
Object.defineProperty(DomQuery.prototype, "stream", {
|
|
480
|
+
/**
|
|
481
|
+
* binding into stream
|
|
482
|
+
*/
|
|
483
|
+
get: function () {
|
|
484
|
+
return new (Stream_1.Stream.bind.apply(Stream_1.Stream, __spreadArray([void 0], this.asArray, false)))();
|
|
485
|
+
},
|
|
486
|
+
enumerable: false,
|
|
487
|
+
configurable: true
|
|
488
|
+
});
|
|
489
|
+
Object.defineProperty(DomQuery.prototype, "lazyStream", {
|
|
490
|
+
/**
|
|
491
|
+
* fetches a lazy stream representation
|
|
492
|
+
* lazy should be applied if you have some filters etc
|
|
493
|
+
* in between, this can reduce the number of post filter operations
|
|
494
|
+
* and ram usage
|
|
495
|
+
* significantly because the operations are done lazily and stop
|
|
496
|
+
* once they hit a dead end.
|
|
497
|
+
*/
|
|
498
|
+
get: function () {
|
|
499
|
+
return Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.asArray);
|
|
500
|
+
},
|
|
501
|
+
enumerable: false,
|
|
502
|
+
configurable: true
|
|
503
|
+
});
|
|
504
|
+
Object.defineProperty(DomQuery.prototype, "asArray", {
|
|
505
|
+
get: function () {
|
|
506
|
+
//filter not supported by IE11
|
|
507
|
+
return [].concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, this.rootNode).filter(function (item) {
|
|
508
|
+
return item != null;
|
|
509
|
+
})
|
|
510
|
+
.map(function (item) {
|
|
511
|
+
return DomQuery.byId(item);
|
|
512
|
+
}).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
513
|
+
},
|
|
514
|
+
enumerable: false,
|
|
515
|
+
configurable: true
|
|
516
|
+
});
|
|
517
|
+
Object.defineProperty(DomQuery.prototype, "asNodeArray", {
|
|
518
|
+
get: function () {
|
|
519
|
+
return [].concat(Stream_1.Stream.of(this.rootNode).filter(function (item) { return item != null; }).collect(new SourcesCollectors_1.ArrayCollector()));
|
|
520
|
+
},
|
|
521
|
+
enumerable: false,
|
|
522
|
+
configurable: true
|
|
523
|
+
});
|
|
524
|
+
DomQuery.querySelectorAllDeep = function (selector) {
|
|
525
|
+
return new DomQuery(document).querySelectorAllDeep(selector);
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* easy query selector all producer
|
|
529
|
+
*
|
|
530
|
+
* @param selector the selector
|
|
531
|
+
* @returns a results dom query object
|
|
532
|
+
*/
|
|
533
|
+
DomQuery.querySelectorAll = function (selector) {
|
|
534
|
+
if (selector.indexOf("/shadow/") != -1) {
|
|
535
|
+
return new DomQuery(document)._querySelectorAllDeep(selector);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
return new DomQuery(document)._querySelectorAll(selector);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* byId producer
|
|
543
|
+
*
|
|
544
|
+
* @param selector id
|
|
545
|
+
* @return a DomQuery containing the found elements
|
|
546
|
+
*/
|
|
547
|
+
DomQuery.byId = function (selector, deep) {
|
|
548
|
+
if (deep === void 0) { deep = false; }
|
|
549
|
+
if (isString(selector)) {
|
|
550
|
+
return (!deep) ? new DomQuery(document).byId(selector) : new DomQuery(document).byIdDeep(selector);
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
return new DomQuery(selector);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* byTagName producer
|
|
558
|
+
*
|
|
559
|
+
* @param selector name
|
|
560
|
+
* @return a DomQuery containing the found elements
|
|
561
|
+
*/
|
|
562
|
+
DomQuery.byTagName = function (selector) {
|
|
563
|
+
if (isString(selector)) {
|
|
564
|
+
return new DomQuery(document).byTagName(selector);
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
return new DomQuery(selector);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
DomQuery.globalEval = function (code, nonce) {
|
|
571
|
+
return new DomQuery(document).globalEval(code, nonce);
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* builds the ie nodes properly in a placeholder
|
|
575
|
+
* and bypasses a non script insert bug that way
|
|
576
|
+
* @param markup the marku code
|
|
577
|
+
*/
|
|
578
|
+
DomQuery.fromMarkup = function (markup) {
|
|
579
|
+
//https://developer.mozilla.org/de/docs/Web/API/DOMParser license creative commons
|
|
580
|
+
var doc = document.implementation.createHTMLDocument("");
|
|
581
|
+
markup = trim(markup);
|
|
582
|
+
var lowerMarkup = markup.toLowerCase();
|
|
583
|
+
if (lowerMarkup.indexOf('<!doctype') != -1 ||
|
|
584
|
+
lowerMarkup.indexOf('<html') != -1 ||
|
|
585
|
+
lowerMarkup.indexOf('<head') != -1 || //TODO proper regexps here to avoid embedded tags with same element names to be triggered
|
|
586
|
+
lowerMarkup.indexOf('<body') != -1) {
|
|
587
|
+
doc.documentElement.innerHTML = markup;
|
|
588
|
+
return new DomQuery(doc.documentElement);
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
var startsWithTag = function (str, tagName) {
|
|
592
|
+
var tag1 = ["<", tagName, ">"].join("");
|
|
593
|
+
var tag2 = ["<", tagName, " "].join("");
|
|
594
|
+
return (str.indexOf(tag1) == 0) || (str.indexOf(tag2) == 0);
|
|
595
|
+
};
|
|
596
|
+
var dummyPlaceHolder = new DomQuery(document.createElement("div"));
|
|
597
|
+
//table needs special treatment due to the browsers auto creation
|
|
598
|
+
if (startsWithTag(lowerMarkup, "thead") || startsWithTag(lowerMarkup, "tbody")) {
|
|
599
|
+
dummyPlaceHolder.html("<table>".concat(markup, "</table>"));
|
|
600
|
+
return dummyPlaceHolder.querySelectorAll("table").get(0).childNodes.detach();
|
|
601
|
+
}
|
|
602
|
+
else if (startsWithTag(lowerMarkup, "tfoot")) {
|
|
603
|
+
dummyPlaceHolder.html("<table><thead></thead><tbody><tbody".concat(markup, "</table>"));
|
|
604
|
+
return dummyPlaceHolder.querySelectorAll("table").get(2).childNodes.detach();
|
|
605
|
+
}
|
|
606
|
+
else if (startsWithTag(lowerMarkup, "tr")) {
|
|
607
|
+
dummyPlaceHolder.html("<table><tbody>".concat(markup, "</tbody></table>"));
|
|
608
|
+
return dummyPlaceHolder.querySelectorAll("tbody").get(0).childNodes.detach();
|
|
609
|
+
}
|
|
610
|
+
else if (startsWithTag(lowerMarkup, "td")) {
|
|
611
|
+
dummyPlaceHolder.html("<table><tbody><tr>".concat(markup, "</tr></tbody></table>"));
|
|
612
|
+
return dummyPlaceHolder.querySelectorAll("tr").get(0).childNodes.detach();
|
|
613
|
+
}
|
|
614
|
+
dummyPlaceHolder.html(markup);
|
|
615
|
+
return dummyPlaceHolder.childNodes.detach();
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* returns the nth element as domquery
|
|
620
|
+
* from the internal elements
|
|
621
|
+
* note if you try to reach a non existing element position
|
|
622
|
+
* you will get back an absent entry
|
|
623
|
+
*
|
|
624
|
+
* @param index the nth index
|
|
625
|
+
*/
|
|
626
|
+
DomQuery.prototype.get = function (index) {
|
|
627
|
+
return (index < this.rootNode.length) ? new DomQuery(this.rootNode[index]) : DomQuery.absent;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* returns the nth element as optional of an Element object
|
|
631
|
+
* @param index the number from the index
|
|
632
|
+
* @param defaults the default value if the index is overrun default Optional.absent
|
|
633
|
+
*/
|
|
634
|
+
DomQuery.prototype.getAsElem = function (index, defaults) {
|
|
635
|
+
if (defaults === void 0) { defaults = Monad_1.Optional.absent; }
|
|
636
|
+
return (index < this.rootNode.length) ? Monad_1.Optional.fromNullable(this.rootNode[index]) : defaults;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* returns the files from a given elmement
|
|
640
|
+
* @param index
|
|
641
|
+
*/
|
|
642
|
+
DomQuery.prototype.filesFromElem = function (index) {
|
|
643
|
+
var _a;
|
|
644
|
+
return (index < this.rootNode.length) ? ((_a = this.rootNode[index]) === null || _a === void 0 ? void 0 : _a.files) ? this.rootNode[index].files : [] : [];
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* returns the value array< of all elements
|
|
648
|
+
*/
|
|
649
|
+
DomQuery.prototype.allElems = function () {
|
|
650
|
+
return this.rootNode;
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* absent no values reached?
|
|
654
|
+
*/
|
|
655
|
+
DomQuery.prototype.isAbsent = function () {
|
|
656
|
+
return this.length == 0;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* should make the code clearer
|
|
660
|
+
* note if you pass a function
|
|
661
|
+
* this refers to the active dopmquery object
|
|
662
|
+
*/
|
|
663
|
+
DomQuery.prototype.isPresent = function (presentRunnable) {
|
|
664
|
+
var absent = this.isAbsent();
|
|
665
|
+
if (!absent && presentRunnable) {
|
|
666
|
+
presentRunnable.call(this, this);
|
|
667
|
+
}
|
|
668
|
+
return !absent;
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* should make the code clearer
|
|
672
|
+
* note if you pass a function
|
|
673
|
+
* this refers to the active dopmquery object
|
|
674
|
+
*
|
|
675
|
+
*
|
|
676
|
+
* @param presentRunnable
|
|
677
|
+
*/
|
|
678
|
+
DomQuery.prototype.ifPresentLazy = function (presentRunnable) {
|
|
679
|
+
if (presentRunnable === void 0) { presentRunnable = function () {
|
|
680
|
+
}; }
|
|
681
|
+
this.isPresent.call(this, presentRunnable);
|
|
682
|
+
return this;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* remove all affected nodes from this query object from the dom tree
|
|
686
|
+
*/
|
|
687
|
+
DomQuery.prototype.delete = function () {
|
|
688
|
+
this.eachElem(function (node) {
|
|
689
|
+
if (node.parentNode) {
|
|
690
|
+
node.parentNode.removeChild(node);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
};
|
|
694
|
+
DomQuery.prototype.querySelectorAll = function (selector) {
|
|
695
|
+
//We could merge both methods, but for now this is more readable
|
|
696
|
+
if (selector.indexOf("/shadow/") != -1) {
|
|
697
|
+
return this._querySelectorAllDeep(selector);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
return this._querySelectorAll(selector);
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* query selector all on the existing dom queryX object
|
|
705
|
+
*
|
|
706
|
+
* @param selector the standard selector
|
|
707
|
+
* @return a DomQuery with the results
|
|
708
|
+
*/
|
|
709
|
+
DomQuery.prototype._querySelectorAll = function (selector) {
|
|
710
|
+
var _a, _b;
|
|
711
|
+
if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
712
|
+
return this;
|
|
713
|
+
}
|
|
714
|
+
var nodes = [];
|
|
715
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
716
|
+
if (!((_b = this.rootNode[cnt]) === null || _b === void 0 ? void 0 : _b.querySelectorAll)) {
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
var res = this.rootNode[cnt].querySelectorAll(selector);
|
|
720
|
+
nodes = nodes.concat(objToArray(res));
|
|
721
|
+
}
|
|
722
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], nodes, false)))();
|
|
723
|
+
};
|
|
724
|
+
/*deep with a selector and a peudo /shadow/ marker to break into the next level*/
|
|
725
|
+
DomQuery.prototype._querySelectorAllDeep = function (selector) {
|
|
726
|
+
var _a;
|
|
727
|
+
if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
var nodes = [];
|
|
731
|
+
var foundNodes = new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.rootNode, false)))();
|
|
732
|
+
var selectors = selector.split(/\/shadow\//);
|
|
733
|
+
for (var cnt2 = 0; cnt2 < selectors.length; cnt2++) {
|
|
734
|
+
if (selectors[cnt2] == "") {
|
|
735
|
+
continue;
|
|
736
|
+
}
|
|
737
|
+
var levelSelector = selectors[cnt2];
|
|
738
|
+
foundNodes = foundNodes.querySelectorAll(levelSelector);
|
|
739
|
+
if (cnt2 < selectors.length - 1) {
|
|
740
|
+
foundNodes = foundNodes.shadowRoot;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return foundNodes;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* core byId method
|
|
747
|
+
* @param id the id to search for
|
|
748
|
+
* @param includeRoot also match the root element?
|
|
749
|
+
*/
|
|
750
|
+
DomQuery.prototype.byId = function (id, includeRoot) {
|
|
751
|
+
var res = [];
|
|
752
|
+
if (includeRoot) {
|
|
753
|
+
res = res.concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((this === null || this === void 0 ? void 0 : this.rootNode) || [])).filter(function (item) { return id == item.id; })
|
|
754
|
+
.map(function (item) { return new DomQuery(item); })
|
|
755
|
+
.collect(new SourcesCollectors_1.ArrayCollector()));
|
|
756
|
+
}
|
|
757
|
+
//for some strange kind of reason the # selector fails
|
|
758
|
+
//on hidden elements we use the attributes match selector
|
|
759
|
+
//that works
|
|
760
|
+
res = res.concat(this.querySelectorAll("[id=\"".concat(id, "\"]")));
|
|
761
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
762
|
+
};
|
|
763
|
+
DomQuery.prototype.byIdDeep = function (id, includeRoot) {
|
|
764
|
+
var res = [];
|
|
765
|
+
if (includeRoot) {
|
|
766
|
+
res = res.concat(Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((this === null || this === void 0 ? void 0 : this.rootNode) || [])).filter(function (item) { return id == item.id; })
|
|
767
|
+
.map(function (item) { return new DomQuery(item); })
|
|
768
|
+
.collect(new SourcesCollectors_1.ArrayCollector()));
|
|
769
|
+
}
|
|
770
|
+
var subItems = this.querySelectorAllDeep("[id=\"".concat(id, "\"]"));
|
|
771
|
+
if (subItems.length) {
|
|
772
|
+
res.push(subItems);
|
|
773
|
+
}
|
|
774
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* same as byId just for the tag name
|
|
778
|
+
* @param tagName
|
|
779
|
+
* @param includeRoot
|
|
780
|
+
*/
|
|
781
|
+
DomQuery.prototype.byTagName = function (tagName, includeRoot, deep) {
|
|
782
|
+
var _a;
|
|
783
|
+
var res = [];
|
|
784
|
+
if (includeRoot) {
|
|
785
|
+
res = Stream_1.LazyStream.of.apply(Stream_1.LazyStream, ((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : [])).filter(function (element) { return (element === null || element === void 0 ? void 0 : element.tagName) == tagName; })
|
|
786
|
+
.reduce(function (reduction, item) { return reduction.concat([item]); }, res)
|
|
787
|
+
.orElse(res).value;
|
|
788
|
+
}
|
|
789
|
+
(deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));
|
|
790
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
791
|
+
};
|
|
792
|
+
/**
|
|
793
|
+
* attr accessor, usage myQuery.attr("class").value = "bla"
|
|
794
|
+
* or let value myQuery.attr("class").value
|
|
795
|
+
* @param attr the attribute to set
|
|
796
|
+
* @param defaultValue the default value in case nothing is presented (defaults to null)
|
|
797
|
+
*/
|
|
798
|
+
DomQuery.prototype.attr = function (attr, defaultValue) {
|
|
799
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
800
|
+
return new ElementAttribute(this, attr, defaultValue);
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* hasclass, checks for an existing class in the class attributes
|
|
804
|
+
*
|
|
805
|
+
* @param clazz the class to search for
|
|
806
|
+
*/
|
|
807
|
+
DomQuery.prototype.hasClass = function (clazz) {
|
|
808
|
+
var hasIt = false;
|
|
809
|
+
this.eachElem(function (node) {
|
|
810
|
+
hasIt = node.classList.contains(clazz);
|
|
811
|
+
if (hasIt) {
|
|
812
|
+
return false;
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
return hasIt;
|
|
816
|
+
};
|
|
817
|
+
/**
|
|
818
|
+
* appends a class string if not already in the element(s)
|
|
819
|
+
*
|
|
820
|
+
* @param clazz the style class to append
|
|
821
|
+
*/
|
|
822
|
+
DomQuery.prototype.addClass = function (clazz) {
|
|
823
|
+
this.eachElem(function (item) { return item.classList.add(clazz); });
|
|
824
|
+
return this;
|
|
825
|
+
};
|
|
826
|
+
/**
|
|
827
|
+
* remove the style class if in the class definitions
|
|
828
|
+
*
|
|
829
|
+
* @param clazz
|
|
830
|
+
*/
|
|
831
|
+
DomQuery.prototype.removeClass = function (clazz) {
|
|
832
|
+
this.eachElem(function (item) { return item.classList.remove(clazz); });
|
|
833
|
+
return this;
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* checks whether we have a multipart element in our children
|
|
837
|
+
* or are one
|
|
838
|
+
*/
|
|
839
|
+
DomQuery.prototype.isMultipartCandidate = function (deep) {
|
|
840
|
+
var _this = this;
|
|
841
|
+
if (deep === void 0) { deep = false; }
|
|
842
|
+
var isCandidate = function (item) {
|
|
843
|
+
var _a;
|
|
844
|
+
if (item.length == 0) {
|
|
845
|
+
return false;
|
|
846
|
+
}
|
|
847
|
+
if (item.length == 1) {
|
|
848
|
+
if (item.tagName.get("booga").value.toLowerCase() == "input" &&
|
|
849
|
+
(((_a = item.attr("type")) === null || _a === void 0 ? void 0 : _a.value) || "").toLowerCase() == "file") {
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
if (deep) {
|
|
853
|
+
return _this.querySelectorAllDeep("input[type='file']").firstElem().isPresent();
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
return _this.querySelectorAll("input[type='file']").firstElem().isPresent();
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
return item.isMultipartCandidate(deep);
|
|
860
|
+
};
|
|
861
|
+
var ret = this.stream.filter(function (item) { return isCandidate(item); }).first().isPresent();
|
|
862
|
+
return ret;
|
|
863
|
+
};
|
|
864
|
+
/**
|
|
865
|
+
* innerHtml equivalkent
|
|
866
|
+
* equivalent to jqueries html
|
|
867
|
+
* as setter the html is set and the
|
|
868
|
+
* DomQuery is given back
|
|
869
|
+
* as getter the html string is returned
|
|
870
|
+
*
|
|
871
|
+
* @param inval
|
|
872
|
+
*/
|
|
873
|
+
DomQuery.prototype.html = function (inval) {
|
|
874
|
+
if (Monad_1.Optional.fromNullable(inval).isAbsent()) {
|
|
875
|
+
return this.isPresent() ? Monad_1.Optional.fromNullable(this.innerHtml) : Monad_1.Optional.absent;
|
|
876
|
+
}
|
|
877
|
+
this.innerHtml = inval;
|
|
878
|
+
return this;
|
|
879
|
+
};
|
|
880
|
+
/**
|
|
881
|
+
* Standard dispatch event method, delegated from node
|
|
882
|
+
*/
|
|
883
|
+
DomQuery.prototype.dispatchEvent = function (evt) {
|
|
884
|
+
this.eachElem(function (elem) { return elem.dispatchEvent(evt); });
|
|
885
|
+
return this;
|
|
886
|
+
};
|
|
887
|
+
Object.defineProperty(DomQuery.prototype, "innerHtml", {
|
|
888
|
+
get: function () {
|
|
889
|
+
var retArr = [];
|
|
890
|
+
this.eachElem(function (elem) { return retArr.push(elem.innerHTML); });
|
|
891
|
+
return retArr.join("");
|
|
892
|
+
},
|
|
893
|
+
set: function (inVal) {
|
|
894
|
+
this.eachElem(function (elem) { return elem.innerHTML = inVal; });
|
|
895
|
+
},
|
|
896
|
+
enumerable: false,
|
|
897
|
+
configurable: true
|
|
898
|
+
});
|
|
899
|
+
//source: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
900
|
+
//code snippet license: https://creativecommons.org/licenses/by-sa/2.5/
|
|
901
|
+
DomQuery.prototype._mozMatchesSelector = function (toMatch, selector) {
|
|
902
|
+
var prot = toMatch;
|
|
903
|
+
var matchesSelector = prot.matches ||
|
|
904
|
+
prot.matchesSelector ||
|
|
905
|
+
prot.mozMatchesSelector ||
|
|
906
|
+
prot.msMatchesSelector ||
|
|
907
|
+
prot.oMatchesSelector ||
|
|
908
|
+
prot.webkitMatchesSelector ||
|
|
909
|
+
function (s) {
|
|
910
|
+
var matches = (document || window.ownerDocument).querySelectorAll(s), i = matches.length;
|
|
911
|
+
while (--i >= 0 && matches.item(i) !== toMatch) {
|
|
912
|
+
}
|
|
913
|
+
return i > -1;
|
|
914
|
+
};
|
|
915
|
+
return matchesSelector.call(toMatch, selector);
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* filters the current dom query elements
|
|
919
|
+
* upon a given selector
|
|
920
|
+
*
|
|
921
|
+
* @param selector
|
|
922
|
+
*/
|
|
923
|
+
DomQuery.prototype.filterSelector = function (selector) {
|
|
924
|
+
var _this = this;
|
|
925
|
+
var matched = [];
|
|
926
|
+
this.eachElem(function (item) {
|
|
927
|
+
if (_this._mozMatchesSelector(item, selector)) {
|
|
928
|
+
matched.push(item);
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], matched, false)))();
|
|
932
|
+
};
|
|
933
|
+
/**
|
|
934
|
+
* checks whether any item in this domQuery level matches the selector
|
|
935
|
+
* if there is one element only attached, as root the match is only
|
|
936
|
+
* performed on this element.
|
|
937
|
+
* @param selector
|
|
938
|
+
*/
|
|
939
|
+
DomQuery.prototype.matchesSelector = function (selector) {
|
|
940
|
+
var _this = this;
|
|
941
|
+
var ret = this.lazyStream
|
|
942
|
+
.map(function (item) { return _this._mozMatchesSelector(item.getAsElem(0).value, selector); })
|
|
943
|
+
.filter(function (match) { return match; })
|
|
944
|
+
.first();
|
|
945
|
+
return ret.isPresent();
|
|
946
|
+
};
|
|
947
|
+
/**
|
|
948
|
+
* easy node traversal, you can pass
|
|
949
|
+
* a set of node selectors which are joined as direct childs
|
|
950
|
+
*
|
|
951
|
+
* not the rootnodes are not in the getIf, those are always the child nodes
|
|
952
|
+
*
|
|
953
|
+
* @param nodeSelector
|
|
954
|
+
*/
|
|
955
|
+
DomQuery.prototype.getIf = function () {
|
|
956
|
+
var nodeSelector = [];
|
|
957
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
958
|
+
nodeSelector[_i] = arguments[_i];
|
|
959
|
+
}
|
|
960
|
+
var selectorStage = this.childNodes;
|
|
961
|
+
for (var cnt = 0; cnt < nodeSelector.length; cnt++) {
|
|
962
|
+
selectorStage = selectorStage.filterSelector(nodeSelector[cnt]);
|
|
963
|
+
if (selectorStage.isAbsent()) {
|
|
964
|
+
return selectorStage;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return selectorStage;
|
|
968
|
+
};
|
|
969
|
+
DomQuery.prototype.eachElem = function (func) {
|
|
970
|
+
for (var cnt = 0, len = this.rootNode.length; cnt < len; cnt++) {
|
|
971
|
+
if (func(this.rootNode[cnt], cnt) === false) {
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return this;
|
|
976
|
+
};
|
|
977
|
+
DomQuery.prototype.firstElem = function (func) {
|
|
978
|
+
if (func === void 0) { func = function (item) { return item; }; }
|
|
979
|
+
if (this.rootNode.length > 1) {
|
|
980
|
+
func(this.rootNode[0], 0);
|
|
981
|
+
}
|
|
982
|
+
return this;
|
|
983
|
+
};
|
|
984
|
+
DomQuery.prototype.each = function (func) {
|
|
985
|
+
Stream_1.Stream.of.apply(Stream_1.Stream, this.rootNode).each(function (item, cnt) {
|
|
986
|
+
//we could use a filter, but for the best performance we dont
|
|
987
|
+
if (item == null) {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
return func(DomQuery.byId(item), cnt);
|
|
991
|
+
});
|
|
992
|
+
return this;
|
|
993
|
+
};
|
|
994
|
+
/**
|
|
995
|
+
* returns a new dom query containing only the first element max
|
|
996
|
+
*
|
|
997
|
+
* @param func a an optional callback function to perform an operation on the first element
|
|
998
|
+
*/
|
|
999
|
+
DomQuery.prototype.first = function (func) {
|
|
1000
|
+
if (func === void 0) { func = function (item) { return item; }; }
|
|
1001
|
+
if (this.rootNode.length >= 1) {
|
|
1002
|
+
func(this.get(0), 0);
|
|
1003
|
+
return this.get(0);
|
|
1004
|
+
}
|
|
1005
|
+
return this;
|
|
1006
|
+
};
|
|
1007
|
+
/**
|
|
1008
|
+
* filter function which filters a subset
|
|
1009
|
+
*
|
|
1010
|
+
* @param func
|
|
1011
|
+
*/
|
|
1012
|
+
DomQuery.prototype.filter = function (func) {
|
|
1013
|
+
var reArr = [];
|
|
1014
|
+
this.each(function (item) {
|
|
1015
|
+
func(item) ? reArr.push(item) : null;
|
|
1016
|
+
});
|
|
1017
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], reArr, false)))();
|
|
1018
|
+
};
|
|
1019
|
+
//TODO append prepend
|
|
1020
|
+
/**
|
|
1021
|
+
* global eval head appendix method
|
|
1022
|
+
* no other methods are supported anymore
|
|
1023
|
+
* @param code the code to be evaled
|
|
1024
|
+
* @param nonce optional nonce key for higher security
|
|
1025
|
+
*/
|
|
1026
|
+
DomQuery.prototype.globalEval = function (code, nonce) {
|
|
1027
|
+
var head = document.getElementsByTagName("head")[0] || document.documentElement;
|
|
1028
|
+
var script = document.createElement("script");
|
|
1029
|
+
if (nonce) {
|
|
1030
|
+
script.setAttribute("nonce", nonce);
|
|
1031
|
+
}
|
|
1032
|
+
script.type = "text/javascript";
|
|
1033
|
+
script.innerHTML = code;
|
|
1034
|
+
var newScriptElement = head.appendChild(script);
|
|
1035
|
+
head.removeChild(newScriptElement);
|
|
1036
|
+
return this;
|
|
1037
|
+
};
|
|
1038
|
+
/**
|
|
1039
|
+
* detaches a set of nodes from their parent elements
|
|
1040
|
+
* in a browser independend manner
|
|
1041
|
+
* @param {Object} items the items which need to be detached
|
|
1042
|
+
* @return {Array} an array of nodes with the detached dom nodes
|
|
1043
|
+
*/
|
|
1044
|
+
DomQuery.prototype.detach = function () {
|
|
1045
|
+
this.eachElem(function (item) {
|
|
1046
|
+
item.parentNode.removeChild(item);
|
|
1047
|
+
});
|
|
1048
|
+
return this;
|
|
1049
|
+
};
|
|
1050
|
+
/**
|
|
1051
|
+
* appends the current set of elements
|
|
1052
|
+
* to the element or first element passed via elem
|
|
1053
|
+
* @param elem
|
|
1054
|
+
*/
|
|
1055
|
+
DomQuery.prototype.appendTo = function (elem) {
|
|
1056
|
+
this.eachElem(function (item) {
|
|
1057
|
+
var value1 = elem.getAsElem(0).orElseLazy(function () {
|
|
1058
|
+
return {
|
|
1059
|
+
appendChild: function (theItem) {
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
}).value;
|
|
1063
|
+
value1.appendChild(item);
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
/**
|
|
1067
|
+
* loads and evals a script from a source uri
|
|
1068
|
+
*
|
|
1069
|
+
* @param src the source to be loaded and evaled
|
|
1070
|
+
* @param defer in miliseconds execution default (0 == no defer)
|
|
1071
|
+
* @param charSet
|
|
1072
|
+
*/
|
|
1073
|
+
DomQuery.prototype.loadScriptEval = function (src, defer, charSet) {
|
|
1074
|
+
var _this = this;
|
|
1075
|
+
if (defer === void 0) { defer = 0; }
|
|
1076
|
+
if (charSet === void 0) { charSet = "utf-8"; }
|
|
1077
|
+
var xhr = new XMLHttpRequest();
|
|
1078
|
+
xhr.open("GET", src, false);
|
|
1079
|
+
if (charSet) {
|
|
1080
|
+
xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
|
|
1081
|
+
}
|
|
1082
|
+
xhr.send(null);
|
|
1083
|
+
xhr.onload = function (responseData) {
|
|
1084
|
+
//defer also means we have to process after the ajax response
|
|
1085
|
+
//has been processed
|
|
1086
|
+
//we can achieve that with a small timeout, the timeout
|
|
1087
|
+
//triggers after the processing is done!
|
|
1088
|
+
if (!defer) {
|
|
1089
|
+
_this.globalEval(xhr.responseText.replace(/\n/g, "\r\n") + "\r\n//@ sourceURL=" + src);
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
//TODO not ideal we maybe ought to move to something else here
|
|
1093
|
+
//but since it is not in use yet, it is ok
|
|
1094
|
+
setTimeout(function () {
|
|
1095
|
+
_this.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
|
|
1096
|
+
}, defer);
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
xhr.onerror = function (data) {
|
|
1100
|
+
throw Error(data);
|
|
1101
|
+
};
|
|
1102
|
+
//since we are synchronous we do it after not with onReadyStateChange
|
|
1103
|
+
return this;
|
|
1104
|
+
};
|
|
1105
|
+
DomQuery.prototype.insertAfter = function () {
|
|
1106
|
+
var toInsertParams = [];
|
|
1107
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1108
|
+
toInsertParams[_i] = arguments[_i];
|
|
1109
|
+
}
|
|
1110
|
+
this.each(function (existingItem) {
|
|
1111
|
+
var existingElement = existingItem.getAsElem(0).value;
|
|
1112
|
+
var rootNode = existingElement.parentNode;
|
|
1113
|
+
var _loop_1 = function (cnt) {
|
|
1114
|
+
var nextSibling = existingElement.nextSibling;
|
|
1115
|
+
toInsertParams[cnt].eachElem(function (insertElem) {
|
|
1116
|
+
if (nextSibling) {
|
|
1117
|
+
rootNode.insertBefore(insertElem, nextSibling);
|
|
1118
|
+
existingElement = nextSibling;
|
|
1119
|
+
}
|
|
1120
|
+
else {
|
|
1121
|
+
rootNode.appendChild(insertElem);
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
};
|
|
1125
|
+
for (var cnt = 0; cnt < toInsertParams.length; cnt++) {
|
|
1126
|
+
_loop_1(cnt);
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
var res = [];
|
|
1130
|
+
res.push(this);
|
|
1131
|
+
res = res.concat(toInsertParams);
|
|
1132
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
1133
|
+
};
|
|
1134
|
+
DomQuery.prototype.insertBefore = function () {
|
|
1135
|
+
var toInsertParams = [];
|
|
1136
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1137
|
+
toInsertParams[_i] = arguments[_i];
|
|
1138
|
+
}
|
|
1139
|
+
this.each(function (existingItem) {
|
|
1140
|
+
var existingElement = existingItem.getAsElem(0).value;
|
|
1141
|
+
var rootNode = existingElement.parentNode;
|
|
1142
|
+
for (var cnt = 0; cnt < toInsertParams.length; cnt++) {
|
|
1143
|
+
toInsertParams[cnt].eachElem(function (insertElem) {
|
|
1144
|
+
rootNode.insertBefore(insertElem, existingElement);
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
var res = [];
|
|
1149
|
+
res.push(this);
|
|
1150
|
+
res = res.concat(toInsertParams);
|
|
1151
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], res, false)))();
|
|
1152
|
+
};
|
|
1153
|
+
DomQuery.prototype.orElse = function () {
|
|
1154
|
+
var elseValue = [];
|
|
1155
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1156
|
+
elseValue[_i] = arguments[_i];
|
|
1157
|
+
}
|
|
1158
|
+
if (this.isPresent()) {
|
|
1159
|
+
return this;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], elseValue, false)))();
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
DomQuery.prototype.orElseLazy = function (func) {
|
|
1166
|
+
if (this.isPresent()) {
|
|
1167
|
+
return this;
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
return new DomQuery(func());
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
DomQuery.prototype.parents = function (tagName) {
|
|
1174
|
+
var retSet = new Set();
|
|
1175
|
+
var retArr = [];
|
|
1176
|
+
var lowerTagName = tagName.toLowerCase();
|
|
1177
|
+
var resolveItem = function (item) {
|
|
1178
|
+
if ((item.tagName || "").toLowerCase() == lowerTagName && !retSet.has(item)) {
|
|
1179
|
+
retSet.add(item);
|
|
1180
|
+
retArr.push(item);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
this.eachElem(function (item) {
|
|
1184
|
+
var _a;
|
|
1185
|
+
while (item.parentNode || item.host) {
|
|
1186
|
+
item = (_a = item === null || item === void 0 ? void 0 : item.parentNode) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.host;
|
|
1187
|
+
resolveItem(item);
|
|
1188
|
+
//nested forms not possible, performance shortcut
|
|
1189
|
+
if (tagName == "form" && retArr.length) {
|
|
1190
|
+
return false;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], retArr, false)))();
|
|
1195
|
+
};
|
|
1196
|
+
DomQuery.prototype.copyAttrs = function (sourceItem) {
|
|
1197
|
+
var _this = this;
|
|
1198
|
+
sourceItem.eachElem(function (sourceNode) {
|
|
1199
|
+
var attrs = objToArray(sourceNode.attributes);
|
|
1200
|
+
for (var _i = 0, attrs_1 = attrs; _i < attrs_1.length; _i++) {
|
|
1201
|
+
var item = attrs_1[_i];
|
|
1202
|
+
var value = item.value;
|
|
1203
|
+
var name_1 = item.name;
|
|
1204
|
+
switch (name_1) {
|
|
1205
|
+
case "id":
|
|
1206
|
+
_this.id.value = value;
|
|
1207
|
+
break;
|
|
1208
|
+
case "disabled":
|
|
1209
|
+
_this.resolveAttributeHolder("disabled").disabled = value;
|
|
1210
|
+
break;
|
|
1211
|
+
case "checked":
|
|
1212
|
+
_this.resolveAttributeHolder("checked").checked = value;
|
|
1213
|
+
break;
|
|
1214
|
+
default:
|
|
1215
|
+
_this.attr(name_1).value = value;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return this;
|
|
1220
|
+
};
|
|
1221
|
+
/**
|
|
1222
|
+
* resolves an attribute holder compared
|
|
1223
|
+
* @param attrName the attribute name
|
|
1224
|
+
*/
|
|
1225
|
+
DomQuery.prototype.resolveAttributeHolder = function (attrName) {
|
|
1226
|
+
if (attrName === void 0) { attrName = "value"; }
|
|
1227
|
+
var ret = [];
|
|
1228
|
+
ret[attrName] = null;
|
|
1229
|
+
return (attrName in this.getAsElem(0).value) ?
|
|
1230
|
+
this.getAsElem(0).value :
|
|
1231
|
+
ret;
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* outerhtml convenience method
|
|
1235
|
+
* browsers only support innerHTML but
|
|
1236
|
+
* for instance for your jsf.js we have a full
|
|
1237
|
+
* replace pattern which needs outerHTML processing
|
|
1238
|
+
*
|
|
1239
|
+
* @param markup
|
|
1240
|
+
* @param runEmbeddedScripts
|
|
1241
|
+
* @param runEmbeddedCss
|
|
1242
|
+
*/
|
|
1243
|
+
DomQuery.prototype.outerHTML = function (markup, runEmbeddedScripts, runEmbeddedCss, deep) {
|
|
1244
|
+
var _a;
|
|
1245
|
+
if (deep === void 0) { deep = false; }
|
|
1246
|
+
if (this.isAbsent()) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
var focusElementId = (_a = document === null || document === void 0 ? void 0 : document.activeElement) === null || _a === void 0 ? void 0 : _a.id;
|
|
1250
|
+
var caretPosition = (focusElementId) ? DomQuery.getCaretPosition(document.activeElement) : null;
|
|
1251
|
+
var nodes = DomQuery.fromMarkup(markup);
|
|
1252
|
+
var res = [];
|
|
1253
|
+
var toReplace = this.getAsElem(0).value;
|
|
1254
|
+
var firstInsert = nodes.get(0);
|
|
1255
|
+
var parentNode = toReplace.parentNode;
|
|
1256
|
+
var replaced = firstInsert.getAsElem(0).value;
|
|
1257
|
+
parentNode.replaceChild(replaced, toReplace);
|
|
1258
|
+
res.push(new DomQuery(replaced));
|
|
1259
|
+
//no replacement possible
|
|
1260
|
+
if (this.isAbsent()) {
|
|
1261
|
+
return this;
|
|
1262
|
+
}
|
|
1263
|
+
var insertAdditionalItems = [];
|
|
1264
|
+
if (nodes.length > 1) {
|
|
1265
|
+
insertAdditionalItems = insertAdditionalItems.concat.apply(insertAdditionalItems, nodes.values.slice(1));
|
|
1266
|
+
res.push(DomQuery.byId(replaced).insertAfter(new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], insertAdditionalItems, false)))()));
|
|
1267
|
+
}
|
|
1268
|
+
if (runEmbeddedScripts) {
|
|
1269
|
+
this.runScripts();
|
|
1270
|
+
}
|
|
1271
|
+
if (runEmbeddedCss) {
|
|
1272
|
+
this.runCss();
|
|
1273
|
+
}
|
|
1274
|
+
var focusElement = DomQuery.byId(focusElementId);
|
|
1275
|
+
if (focusElementId && focusElement.isPresent() &&
|
|
1276
|
+
caretPosition != null && "undefined" != typeof caretPosition) {
|
|
1277
|
+
focusElement.eachElem(function (item) { return DomQuery.setCaretPosition(item, caretPosition); });
|
|
1278
|
+
}
|
|
1279
|
+
return nodes;
|
|
1280
|
+
};
|
|
1281
|
+
/**
|
|
1282
|
+
* Run through the given nodes in the DomQuery execute the inline scripts
|
|
1283
|
+
* @param whilteListed: optional whitelist function which can filter out script tags which are not processed
|
|
1284
|
+
* defaults to the standard jsf.js exclusion (we use this code for myfaces)
|
|
1285
|
+
*/
|
|
1286
|
+
DomQuery.prototype.runScripts = function (whilteListed) {
|
|
1287
|
+
var _this = this;
|
|
1288
|
+
if (whilteListed === void 0) { whilteListed = DEFAULT_WHITELIST; }
|
|
1289
|
+
var finalScripts = [], equi = equalsIgnoreCase, execScrpt = function (item) {
|
|
1290
|
+
var tagName = item.tagName;
|
|
1291
|
+
var itemType = item.type || "";
|
|
1292
|
+
if (tagName && equi(tagName, "script") &&
|
|
1293
|
+
(itemType === "" || equi(itemType, "text/javascript") ||
|
|
1294
|
+
equi(itemType, "javascript") ||
|
|
1295
|
+
equi(itemType, "text/ecmascript") ||
|
|
1296
|
+
equi(itemType, "ecmascript"))) {
|
|
1297
|
+
var src = item.getAttribute('src');
|
|
1298
|
+
if ('undefined' != typeof src
|
|
1299
|
+
&& null != src
|
|
1300
|
+
&& src.length > 0) {
|
|
1301
|
+
//we have to move this into an inner if because chrome otherwise chokes
|
|
1302
|
+
//due to changing the and order instead of relying on left to right
|
|
1303
|
+
//if jsf.js is already registered we do not replace it anymore
|
|
1304
|
+
if (whilteListed(src)) {
|
|
1305
|
+
if (finalScripts.length) {
|
|
1306
|
+
//script source means we have to eval the existing
|
|
1307
|
+
//scripts before running the include
|
|
1308
|
+
_this.globalEval(finalScripts.join("\n"));
|
|
1309
|
+
finalScripts = [];
|
|
1310
|
+
}
|
|
1311
|
+
_this.loadScriptEval(src, 0, "UTF-8");
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
else {
|
|
1315
|
+
// embedded script auto eval
|
|
1316
|
+
//TODO this probably needs to be changed due to our new parsing structures
|
|
1317
|
+
//probably not needed anymore
|
|
1318
|
+
var evalText = trim(item.text || item.innerText || item.innerHTML);
|
|
1319
|
+
var go = true;
|
|
1320
|
+
while (go) {
|
|
1321
|
+
go = false;
|
|
1322
|
+
if (evalText.substring(0, 4) == "<!--") {
|
|
1323
|
+
evalText = evalText.substring(4);
|
|
1324
|
+
go = true;
|
|
1325
|
+
}
|
|
1326
|
+
if (evalText.substring(0, 4) == "//<!--") {
|
|
1327
|
+
evalText = evalText.substring(6);
|
|
1328
|
+
go = true;
|
|
1329
|
+
}
|
|
1330
|
+
if (evalText.substring(0, 11) == "//<![CDATA[") {
|
|
1331
|
+
evalText = evalText.substring(11);
|
|
1332
|
+
go = true;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
// we have to run the script under a global context
|
|
1336
|
+
//we store the script for less calls to eval
|
|
1337
|
+
finalScripts.push(evalText);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
try {
|
|
1342
|
+
var scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
|
|
1343
|
+
//script execution order by relative pos in their dom tree
|
|
1344
|
+
scriptElements.stream
|
|
1345
|
+
.flatMap(function (item) { return Stream_1.Stream.of(item.values); })
|
|
1346
|
+
.sort(function (node1, node2) { return node1.compareDocumentPosition(node2) - 3; }) //preceding 2, following == 4)
|
|
1347
|
+
.each(function (item) { return execScrpt(item); });
|
|
1348
|
+
if (finalScripts.length) {
|
|
1349
|
+
this.globalEval(finalScripts.join("\n"));
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
catch (e) {
|
|
1353
|
+
if (window.console && window.console.error) {
|
|
1354
|
+
//not sure if we
|
|
1355
|
+
//should use our standard
|
|
1356
|
+
//error mechanisms here
|
|
1357
|
+
//because in the head appendix
|
|
1358
|
+
//method only a console
|
|
1359
|
+
//error would be raised as well
|
|
1360
|
+
console.error(e.message || e.description);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
finally {
|
|
1364
|
+
//the usual ie6 fix code
|
|
1365
|
+
//the IE6 garbage collector is broken
|
|
1366
|
+
//nulling closures helps somewhat to reduce
|
|
1367
|
+
//mem leaks, which are impossible to avoid
|
|
1368
|
+
//at this browser
|
|
1369
|
+
execScrpt = null;
|
|
1370
|
+
}
|
|
1371
|
+
return this;
|
|
1372
|
+
};
|
|
1373
|
+
DomQuery.prototype.runCss = function () {
|
|
1374
|
+
var applyStyle = function (item, style) {
|
|
1375
|
+
var _a, _b, _c, _d;
|
|
1376
|
+
var newSS = document.createElement("style");
|
|
1377
|
+
document.getElementsByTagName("head")[0].appendChild(newSS);
|
|
1378
|
+
var styleSheet = (_a = newSS.sheet) !== null && _a !== void 0 ? _a : newSS.styleSheet;
|
|
1379
|
+
newSS.setAttribute("rel", (_b = item.getAttribute("rel")) !== null && _b !== void 0 ? _b : "stylesheet");
|
|
1380
|
+
newSS.setAttribute("type", (_c = item.getAttribute("type")) !== null && _c !== void 0 ? _c : "text/css");
|
|
1381
|
+
if ((_d = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssText) !== null && _d !== void 0 ? _d : false) {
|
|
1382
|
+
styleSheet.cssText = style;
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
newSS.appendChild(document.createTextNode(style));
|
|
1386
|
+
}
|
|
1387
|
+
}, execCss = function (item) {
|
|
1388
|
+
var tagName = item.tagName;
|
|
1389
|
+
if (tagName && equalsIgnoreCase(tagName, "link") && equalsIgnoreCase(item.getAttribute("type"), "text/css")) {
|
|
1390
|
+
applyStyle(item, "@import url('" + item.getAttribute("href") + "');");
|
|
1391
|
+
}
|
|
1392
|
+
else if (tagName && equalsIgnoreCase(tagName, "style") && equalsIgnoreCase(item.getAttribute("type"), "text/css")) {
|
|
1393
|
+
var innerText_1 = [];
|
|
1394
|
+
//compliant browsers know child nodes
|
|
1395
|
+
var childNodes = Array.prototype.slice.call(item.childNodes);
|
|
1396
|
+
if (childNodes) {
|
|
1397
|
+
childNodes.forEach(function (child) { return innerText_1.push(child.innerHTML || child.data); });
|
|
1398
|
+
//non compliant ones innerHTML
|
|
1399
|
+
}
|
|
1400
|
+
else if (item.innerHTML) {
|
|
1401
|
+
innerText_1.push(item.innerHTML);
|
|
1402
|
+
}
|
|
1403
|
+
applyStyle(item, innerText_1.join(""));
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
var scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
|
|
1407
|
+
scriptElements.stream
|
|
1408
|
+
.flatMap(function (item) { return Stream_1.Stream.of(item.values); })
|
|
1409
|
+
.sort(function (node1, node2) { return node1.compareDocumentPosition(node2) - 3; })
|
|
1410
|
+
.each(function (item) { return execCss(item); });
|
|
1411
|
+
return this;
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* fires a click event on the underlying dom elements
|
|
1415
|
+
*/
|
|
1416
|
+
DomQuery.prototype.click = function () {
|
|
1417
|
+
this.fireEvent("click");
|
|
1418
|
+
return this;
|
|
1419
|
+
};
|
|
1420
|
+
DomQuery.prototype.addEventListener = function (type, listener, options) {
|
|
1421
|
+
this.eachElem(function (node) { return node.addEventListener(type, listener, options); });
|
|
1422
|
+
return this;
|
|
1423
|
+
};
|
|
1424
|
+
DomQuery.prototype.removeEventListener = function (type, listener, options) {
|
|
1425
|
+
this.eachElem(function (node) { return node.removeEventListener(type, listener, options); });
|
|
1426
|
+
return this;
|
|
1427
|
+
};
|
|
1428
|
+
/**
|
|
1429
|
+
* fires an event
|
|
1430
|
+
*/
|
|
1431
|
+
DomQuery.prototype.fireEvent = function (eventName) {
|
|
1432
|
+
this.eachElem(function (node) {
|
|
1433
|
+
var doc;
|
|
1434
|
+
if (node.ownerDocument) {
|
|
1435
|
+
doc = node.ownerDocument;
|
|
1436
|
+
}
|
|
1437
|
+
else if (node.nodeType == 9) {
|
|
1438
|
+
// the node may be the document itself, nodeType 9 = DOCUMENT_NODE
|
|
1439
|
+
doc = node;
|
|
1440
|
+
}
|
|
1441
|
+
else {
|
|
1442
|
+
throw new Error("Invalid node passed to fireEvent: " + node.id);
|
|
1443
|
+
}
|
|
1444
|
+
if (node.dispatchEvent) {
|
|
1445
|
+
// Gecko-style approach (now the standard) takes more work
|
|
1446
|
+
var eventClass = "";
|
|
1447
|
+
// Different events have different event classes.
|
|
1448
|
+
// If this switch statement can't map an eventName to an eventClass,
|
|
1449
|
+
// the event firing is going to fail.
|
|
1450
|
+
switch (eventName) {
|
|
1451
|
+
case "click": // Dispatching of 'click' appears to not work correctly in Safari. Use 'mousedown' or 'mouseup' instead.
|
|
1452
|
+
case "mousedown":
|
|
1453
|
+
case "mouseup":
|
|
1454
|
+
eventClass = "MouseEvents";
|
|
1455
|
+
break;
|
|
1456
|
+
case "focus":
|
|
1457
|
+
case "change":
|
|
1458
|
+
case "blur":
|
|
1459
|
+
case "select":
|
|
1460
|
+
eventClass = "HTMLEvents";
|
|
1461
|
+
break;
|
|
1462
|
+
default:
|
|
1463
|
+
throw "fireEvent: Couldn't find an event class for event '" + eventName + "'.";
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
var event_1 = doc.createEvent(eventClass);
|
|
1467
|
+
event_1.initEvent(eventName, true, true); // All events created as bubbling and cancelable.
|
|
1468
|
+
event_1.synthetic = true; // allow detection of synthetic events
|
|
1469
|
+
// The second parameter says go ahead with the default action
|
|
1470
|
+
node.dispatchEvent(event_1);
|
|
1471
|
+
}
|
|
1472
|
+
else if (node.fireEvent) {
|
|
1473
|
+
// IE-old school style, you can drop this if you don't need to support IE8 and lower
|
|
1474
|
+
var event_2 = doc.createEventObject();
|
|
1475
|
+
event_2.synthetic = true; // allow detection of synthetic events
|
|
1476
|
+
node.fireEvent("on" + eventName, event_2);
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
};
|
|
1480
|
+
DomQuery.prototype.textContent = function (joinstr) {
|
|
1481
|
+
if (joinstr === void 0) { joinstr = ""; }
|
|
1482
|
+
return this.stream
|
|
1483
|
+
.map(function (value) {
|
|
1484
|
+
var item = value.getAsElem(0).orElseLazy(function () {
|
|
1485
|
+
return {
|
|
1486
|
+
textContent: ""
|
|
1487
|
+
};
|
|
1488
|
+
}).value;
|
|
1489
|
+
return item.textContent || "";
|
|
1490
|
+
})
|
|
1491
|
+
.reduce(function (text1, text2) { return text1 + joinstr + text2; }, "").value;
|
|
1492
|
+
};
|
|
1493
|
+
DomQuery.prototype.innerText = function (joinstr) {
|
|
1494
|
+
if (joinstr === void 0) { joinstr = ""; }
|
|
1495
|
+
return this.stream
|
|
1496
|
+
.map(function (value) {
|
|
1497
|
+
var item = value.getAsElem(0).orElseLazy(function () {
|
|
1498
|
+
return {
|
|
1499
|
+
innerText: ""
|
|
1500
|
+
};
|
|
1501
|
+
}).value;
|
|
1502
|
+
return item.innerText || "";
|
|
1503
|
+
})
|
|
1504
|
+
.reduce(function (text1, text2) { return [text1, text2].join(joinstr); }, "").value;
|
|
1505
|
+
};
|
|
1506
|
+
/**
|
|
1507
|
+
* encodes all input elements properly into respective
|
|
1508
|
+
* config entries, this can be used
|
|
1509
|
+
* for legacy systems, for newer usecases, use the
|
|
1510
|
+
* HTML5 Form class which all newer browsers provide
|
|
1511
|
+
*
|
|
1512
|
+
* @param toMerge optional config which can be merged in
|
|
1513
|
+
* @return a copy pf
|
|
1514
|
+
*/
|
|
1515
|
+
DomQuery.prototype.encodeFormElement = function (toMerge) {
|
|
1516
|
+
if (toMerge === void 0) { toMerge = new Monad_1.Config({}); }
|
|
1517
|
+
//browser behavior no element name no encoding (normal submit fails in that case)
|
|
1518
|
+
//https://issues.apache.org/jira/browse/MYFACES-2847
|
|
1519
|
+
if (this.name.isAbsent()) {
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
//lets keep it sideffects free
|
|
1523
|
+
var target = toMerge.shallowCopy;
|
|
1524
|
+
this.each(function (element) {
|
|
1525
|
+
var _a, _b;
|
|
1526
|
+
if (element.name.isAbsent()) { //no name, no encoding
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
var name = element.name.value;
|
|
1530
|
+
var tagName = element.tagName.orElse("__none__").value.toLowerCase();
|
|
1531
|
+
var elemType = element.type.orElse("__none__").value.toLowerCase();
|
|
1532
|
+
elemType = elemType.toLowerCase();
|
|
1533
|
+
// routine for all elements
|
|
1534
|
+
// rules:
|
|
1535
|
+
// - process only inputs, textareas and selects
|
|
1536
|
+
// - elements muest have attribute "name"
|
|
1537
|
+
// - elements must not be disabled
|
|
1538
|
+
if (((tagName == "input" || tagName == "textarea" || tagName == "select") &&
|
|
1539
|
+
(name != null && name != "")) && !element.disabled) {
|
|
1540
|
+
// routine for select elements
|
|
1541
|
+
// rules:
|
|
1542
|
+
// - if select-one and value-Attribute exist => "name=value"
|
|
1543
|
+
// (also if value empty => "name=")
|
|
1544
|
+
// - if select-one and value-Attribute don't exist =>
|
|
1545
|
+
// "name=DisplayValue"
|
|
1546
|
+
// - if select multi and multple selected => "name=value1&name=value2"
|
|
1547
|
+
// - if select and selectedIndex=-1 don't submit
|
|
1548
|
+
if (tagName == "select") {
|
|
1549
|
+
// selectedIndex must be >= 0 sein to be submittet
|
|
1550
|
+
var selectElem = element.getAsElem(0).value;
|
|
1551
|
+
if (selectElem.selectedIndex >= 0) {
|
|
1552
|
+
var uLen = selectElem.options.length;
|
|
1553
|
+
for (var u = 0; u < uLen; u++) {
|
|
1554
|
+
// find all selected options
|
|
1555
|
+
//let subBuf = [];
|
|
1556
|
+
if (selectElem.options[u].selected) {
|
|
1557
|
+
var elementOption = selectElem.options[u];
|
|
1558
|
+
target.append(name).value = (elementOption.getAttribute("value") != null) ?
|
|
1559
|
+
elementOption.value : elementOption.text;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
// routine for remaining elements
|
|
1565
|
+
// rules:
|
|
1566
|
+
// - don't submit no selects (processed above), buttons, reset buttons, submit buttons,
|
|
1567
|
+
// - submit checkboxes and radio inputs only if checked
|
|
1568
|
+
if ((tagName != Submittables.SELECT &&
|
|
1569
|
+
elemType != Submittables.BUTTON &&
|
|
1570
|
+
elemType != Submittables.RESET &&
|
|
1571
|
+
elemType != Submittables.SUBMIT &&
|
|
1572
|
+
elemType != Submittables.IMAGE) && ((elemType != Submittables.CHECKBOX && elemType != Submittables.RADIO) ||
|
|
1573
|
+
element.checked)) {
|
|
1574
|
+
var files = (_b = (_a = element.value.value) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : [];
|
|
1575
|
+
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
1576
|
+
//xhr level2
|
|
1577
|
+
target.append(name).value = files[0];
|
|
1578
|
+
}
|
|
1579
|
+
else {
|
|
1580
|
+
target.append(name).value = element.inputValue.value;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
return target;
|
|
1586
|
+
};
|
|
1587
|
+
Object.defineProperty(DomQuery.prototype, "cDATAAsString", {
|
|
1588
|
+
get: function () {
|
|
1589
|
+
var cDataBlock = [];
|
|
1590
|
+
var TYPE_CDATA_BLOCK = 4;
|
|
1591
|
+
var res = this.lazyStream.flatMap(function (item) {
|
|
1592
|
+
return item.childNodes.stream;
|
|
1593
|
+
}).filter(function (item) {
|
|
1594
|
+
var _a, _b;
|
|
1595
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.nodeType) == TYPE_CDATA_BLOCK;
|
|
1596
|
+
}).reduce(function (reduced, item) {
|
|
1597
|
+
var _a, _b, _c;
|
|
1598
|
+
reduced.push((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : "");
|
|
1599
|
+
return reduced;
|
|
1600
|
+
}, []).value;
|
|
1601
|
+
// response may contain several blocks
|
|
1602
|
+
return res.join("");
|
|
1603
|
+
},
|
|
1604
|
+
enumerable: false,
|
|
1605
|
+
configurable: true
|
|
1606
|
+
});
|
|
1607
|
+
DomQuery.prototype.subNodes = function (from, to) {
|
|
1608
|
+
if (Monad_1.Optional.fromNullable(to).isAbsent()) {
|
|
1609
|
+
to = this.length;
|
|
1610
|
+
}
|
|
1611
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.rootNode.slice(from, Math.min(to, this.length)), false)))();
|
|
1612
|
+
};
|
|
1613
|
+
DomQuery.prototype.limits = function (end) {
|
|
1614
|
+
this._limits = end;
|
|
1615
|
+
return this;
|
|
1616
|
+
};
|
|
1617
|
+
//-- internally exposed methods needed for the interconnectivity
|
|
1618
|
+
DomQuery.prototype.hasNext = function () {
|
|
1619
|
+
var isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
|
|
1620
|
+
var isEndOfArray = this.pos >= this.values.length - 1;
|
|
1621
|
+
return !(isLimitsReached ||
|
|
1622
|
+
isEndOfArray);
|
|
1623
|
+
};
|
|
1624
|
+
DomQuery.prototype.next = function () {
|
|
1625
|
+
if (!this.hasNext()) {
|
|
1626
|
+
return null;
|
|
1627
|
+
}
|
|
1628
|
+
this.pos++;
|
|
1629
|
+
return new DomQuery(this.values[this.pos]);
|
|
1630
|
+
};
|
|
1631
|
+
DomQuery.prototype.lookAhead = function (cnt) {
|
|
1632
|
+
if (cnt === void 0) { cnt = 1; }
|
|
1633
|
+
if ((this.values.length - 1) < (this.pos + cnt)) {
|
|
1634
|
+
return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
|
|
1635
|
+
}
|
|
1636
|
+
return new DomQuery(this.values[this.pos + cnt]);
|
|
1637
|
+
};
|
|
1638
|
+
DomQuery.prototype.current = function () {
|
|
1639
|
+
if (this.pos == -1) {
|
|
1640
|
+
return SourcesCollectors_1.ITERATION_STATUS.BEF_STRM;
|
|
1641
|
+
}
|
|
1642
|
+
return new DomQuery(this.values[this.pos]);
|
|
1643
|
+
};
|
|
1644
|
+
DomQuery.prototype.reset = function () {
|
|
1645
|
+
this.pos = -1;
|
|
1646
|
+
};
|
|
1647
|
+
DomQuery.prototype.attachShadow = function (params) {
|
|
1648
|
+
if (params === void 0) { params = { mode: "open" }; }
|
|
1649
|
+
var shadowRoots = [];
|
|
1650
|
+
this.eachElem(function (item) {
|
|
1651
|
+
var shadowElement;
|
|
1652
|
+
if (item === null || item === void 0 ? void 0 : item.attachShadow) {
|
|
1653
|
+
shadowElement = DomQuery.byId(item.attachShadow(params));
|
|
1654
|
+
shadowRoots.push(shadowElement);
|
|
1655
|
+
}
|
|
1656
|
+
else {
|
|
1657
|
+
throw new Error("Shadow dom creation not supported by the browser, please use a shim, to gain this functionality");
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], shadowRoots, false)))();
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* helper to fix a common dom problem
|
|
1664
|
+
* we have to wait until a certain condition is met, in most of the cases we just want to know whether an element is present in the subdome before being able to proceed
|
|
1665
|
+
* @param condition
|
|
1666
|
+
* @param options
|
|
1667
|
+
*/
|
|
1668
|
+
DomQuery.prototype.waitUntilDom = function (condition, options) {
|
|
1669
|
+
if (options === void 0) { options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }; }
|
|
1670
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1671
|
+
return __generator(this, function (_a) {
|
|
1672
|
+
return [2 /*return*/, waitUntilDom(this, condition, options)];
|
|
1673
|
+
});
|
|
1674
|
+
});
|
|
1675
|
+
};
|
|
1676
|
+
Object.defineProperty(DomQuery.prototype, "shadowElements", {
|
|
1677
|
+
/**
|
|
1678
|
+
* returns the embedded shadow elements
|
|
1679
|
+
*/
|
|
1680
|
+
get: function () {
|
|
1681
|
+
var shadowElements = this.querySelectorAll("*")
|
|
1682
|
+
.filter(function (item) { return item.hasShadow; });
|
|
1683
|
+
var mapped = (shadowElements.allElems() || []).map(function (element) { return element.shadowRoot; });
|
|
1684
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], mapped, false)))();
|
|
1685
|
+
},
|
|
1686
|
+
enumerable: false,
|
|
1687
|
+
configurable: true
|
|
1688
|
+
});
|
|
1689
|
+
Object.defineProperty(DomQuery.prototype, "shadowRoot", {
|
|
1690
|
+
get: function () {
|
|
1691
|
+
var shadowRoots = [];
|
|
1692
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
1693
|
+
if (this.rootNode[cnt].shadowRoot) {
|
|
1694
|
+
shadowRoots.push(this.rootNode[cnt].shadowRoot);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], shadowRoots, false)))();
|
|
1698
|
+
},
|
|
1699
|
+
enumerable: false,
|
|
1700
|
+
configurable: true
|
|
1701
|
+
});
|
|
1702
|
+
Object.defineProperty(DomQuery.prototype, "hasShadow", {
|
|
1703
|
+
get: function () {
|
|
1704
|
+
for (var cnt = 0; cnt < this.rootNode.length; cnt++) {
|
|
1705
|
+
if (this.rootNode[cnt].shadowRoot) {
|
|
1706
|
+
return true;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
return false;
|
|
1710
|
+
},
|
|
1711
|
+
enumerable: false,
|
|
1712
|
+
configurable: true
|
|
1713
|
+
});
|
|
1714
|
+
//from
|
|
1715
|
+
// http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/
|
|
1716
|
+
DomQuery.getCaretPosition = function (ctrl) {
|
|
1717
|
+
var caretPos = 0;
|
|
1718
|
+
try {
|
|
1719
|
+
if (document === null || document === void 0 ? void 0 : document.selection) {
|
|
1720
|
+
ctrl.focus();
|
|
1721
|
+
var selection = document.selection.createRange();
|
|
1722
|
+
//the selection now is start zero
|
|
1723
|
+
selection.moveStart('character', -ctrl.value.length);
|
|
1724
|
+
//the caretposition is the selection start
|
|
1725
|
+
caretPos = selection.text.length;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
catch (e) {
|
|
1729
|
+
//now this is ugly, but not supported input types throw errors for selectionStart
|
|
1730
|
+
//just in case someone dumps this code onto unsupported browsers
|
|
1731
|
+
}
|
|
1732
|
+
return caretPos;
|
|
1733
|
+
};
|
|
1734
|
+
/**
|
|
1735
|
+
* sets the caret position
|
|
1736
|
+
*
|
|
1737
|
+
* @param ctrl the control to set the caret position to
|
|
1738
|
+
* @param pos the position to set
|
|
1739
|
+
*
|
|
1740
|
+
* note if the control does not have any selectable and focusable behavior
|
|
1741
|
+
* calling this method does nothing (silent fail)
|
|
1742
|
+
*
|
|
1743
|
+
*/
|
|
1744
|
+
DomQuery.setCaretPosition = function (ctrl, pos) {
|
|
1745
|
+
(ctrl === null || ctrl === void 0 ? void 0 : ctrl.focus) ? ctrl === null || ctrl === void 0 ? void 0 : ctrl.focus() : null;
|
|
1746
|
+
//the selection range is our caret position
|
|
1747
|
+
(ctrl === null || ctrl === void 0 ? void 0 : ctrl.setSelectiongRange) ? ctrl === null || ctrl === void 0 ? void 0 : ctrl.setSelectiongRange(pos, pos) : null;
|
|
1748
|
+
};
|
|
1749
|
+
/**
|
|
1750
|
+
* Implementation of an iterator
|
|
1751
|
+
* to allow loops over dom query collections
|
|
1752
|
+
*/
|
|
1753
|
+
DomQuery.prototype[Symbol.iterator] = function () {
|
|
1754
|
+
var _this = this;
|
|
1755
|
+
return {
|
|
1756
|
+
next: function () {
|
|
1757
|
+
var done = !_this.hasNext();
|
|
1758
|
+
var val = _this.next();
|
|
1759
|
+
return {
|
|
1760
|
+
done: done,
|
|
1761
|
+
value: val
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
};
|
|
1766
|
+
/**
|
|
1767
|
+
* concats the elements of two Dom Queries into a single one
|
|
1768
|
+
* @param toAttach
|
|
1769
|
+
*/
|
|
1770
|
+
DomQuery.prototype.concat = function (toAttach, filterDoubles) {
|
|
1771
|
+
if (filterDoubles === void 0) { filterDoubles = true; }
|
|
1772
|
+
var ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
|
|
1773
|
+
//we now filter the doubles out
|
|
1774
|
+
if (!filterDoubles) {
|
|
1775
|
+
return ret;
|
|
1776
|
+
}
|
|
1777
|
+
var idx = {}; //ie11 does not support sets, we have to fake it
|
|
1778
|
+
return ret.lazyStream.filter(function (node) {
|
|
1779
|
+
var notFound = !(idx === null || idx === void 0 ? void 0 : idx[node.value.value.outerHTML]);
|
|
1780
|
+
idx[node.value.value.outerHTML] = true;
|
|
1781
|
+
return notFound;
|
|
1782
|
+
}).collect(new DomQueryCollector());
|
|
1783
|
+
};
|
|
1784
|
+
DomQuery.absent = new DomQuery();
|
|
1785
|
+
return DomQuery;
|
|
1786
|
+
}());
|
|
1787
|
+
exports.DomQuery = DomQuery;
|
|
1788
|
+
/**
|
|
1789
|
+
* Various collectors
|
|
1790
|
+
* which can be used in conjunction with Streams
|
|
1791
|
+
*/
|
|
1792
|
+
/**
|
|
1793
|
+
* A collector which bundles a full dom query stream into a single dom query element
|
|
1794
|
+
*
|
|
1795
|
+
* This connects basically our stream back into DomQuery
|
|
1796
|
+
*/
|
|
1797
|
+
var DomQueryCollector = /** @class */ (function () {
|
|
1798
|
+
function DomQueryCollector() {
|
|
1799
|
+
this.data = [];
|
|
1800
|
+
}
|
|
1801
|
+
DomQueryCollector.prototype.collect = function (element) {
|
|
1802
|
+
this.data.push(element);
|
|
1803
|
+
};
|
|
1804
|
+
Object.defineProperty(DomQueryCollector.prototype, "finalValue", {
|
|
1805
|
+
get: function () {
|
|
1806
|
+
return new (DomQuery.bind.apply(DomQuery, __spreadArray([void 0], this.data, false)))();
|
|
1807
|
+
},
|
|
1808
|
+
enumerable: false,
|
|
1809
|
+
configurable: true
|
|
1810
|
+
});
|
|
1811
|
+
return DomQueryCollector;
|
|
1812
|
+
}());
|
|
1813
|
+
exports.DomQueryCollector = DomQueryCollector;
|
|
1814
|
+
/**
|
|
1815
|
+
* abbreviation for DomQuery
|
|
1816
|
+
*/
|
|
1817
|
+
exports.DQ = DomQuery;
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
/***/ }),
|
|
1821
|
+
|
|
1822
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Lang.ts":
|
|
1823
|
+
/*!************************************************************!*\
|
|
1824
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Lang.ts ***!
|
|
1825
|
+
\************************************************************/
|
|
1826
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1830
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
1831
|
+
* this work for additional information regarding copyright ownership.
|
|
1832
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
1833
|
+
* (the "License"); you may not use this file except in compliance with
|
|
1834
|
+
* the License. You may obtain a copy of the License at
|
|
1835
|
+
*
|
|
1836
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1837
|
+
*
|
|
1838
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1839
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1840
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1841
|
+
* See the License for the specific language governing permissions and
|
|
1842
|
+
* limitations under the License.
|
|
1843
|
+
*/
|
|
1844
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1845
|
+
exports.Lang = void 0;
|
|
1846
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
1847
|
+
/**
|
|
1848
|
+
* Lang helpers crossported from the apache myfaces project
|
|
1849
|
+
*/
|
|
1850
|
+
var Lang;
|
|
1851
|
+
(function (Lang) {
|
|
1852
|
+
//should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
|
|
1853
|
+
/**
|
|
1854
|
+
* helper function to savely resolve anything
|
|
1855
|
+
* this is not an elvis operator, it resolves
|
|
1856
|
+
* a value without exception in a tree and if
|
|
1857
|
+
* it is not resolvable then an optional of
|
|
1858
|
+
* a default value is restored or Optional.empty
|
|
1859
|
+
* if none is given
|
|
1860
|
+
*
|
|
1861
|
+
* usage
|
|
1862
|
+
* <code>
|
|
1863
|
+
* let var: Optiona<string> = saveResolve(() => a.b.c.d.e, "foobaz")
|
|
1864
|
+
* </code>
|
|
1865
|
+
*
|
|
1866
|
+
* @param resolverProducer a lambda which can produce the value
|
|
1867
|
+
* @param defaultValue an optional default value if the producer failes to produce anything
|
|
1868
|
+
* @returns an Optional of the produced value
|
|
1869
|
+
*/
|
|
1870
|
+
function saveResolve(resolverProducer, defaultValue) {
|
|
1871
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1872
|
+
try {
|
|
1873
|
+
var result = resolverProducer();
|
|
1874
|
+
return Monad_1.Optional.fromNullable(result !== null && result !== void 0 ? result : defaultValue);
|
|
1875
|
+
}
|
|
1876
|
+
catch (e) {
|
|
1877
|
+
return Monad_1.Optional.absent;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
Lang.saveResolve = saveResolve;
|
|
1881
|
+
function saveResolveLazy(resolverProducer, defaultValue) {
|
|
1882
|
+
if (defaultValue === void 0) { defaultValue = null; }
|
|
1883
|
+
try {
|
|
1884
|
+
var result = resolverProducer();
|
|
1885
|
+
return Monad_1.Optional.fromNullable(result !== null && result !== void 0 ? result : defaultValue());
|
|
1886
|
+
}
|
|
1887
|
+
catch (e) {
|
|
1888
|
+
return Monad_1.Optional.absent;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
Lang.saveResolveLazy = saveResolveLazy;
|
|
1892
|
+
/**
|
|
1893
|
+
* String to array function performs a string to array transformation
|
|
1894
|
+
* @param {String} it the string which has to be changed into an array
|
|
1895
|
+
* @param {RegExp} splitter our splitter reglar expression
|
|
1896
|
+
* @return a trimmed array of the splitted string
|
|
1897
|
+
*/
|
|
1898
|
+
function strToArray(it, splitter) {
|
|
1899
|
+
if (splitter === void 0) { splitter = /\./gi; }
|
|
1900
|
+
var ret = [];
|
|
1901
|
+
it.split(splitter).forEach((function (element) {
|
|
1902
|
+
ret.push(trim(element));
|
|
1903
|
+
}));
|
|
1904
|
+
return ret;
|
|
1905
|
+
}
|
|
1906
|
+
Lang.strToArray = strToArray;
|
|
1907
|
+
/**
|
|
1908
|
+
* hyperfast trim
|
|
1909
|
+
* http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
|
1910
|
+
* crossported from dojo
|
|
1911
|
+
*/
|
|
1912
|
+
function trim(str) {
|
|
1913
|
+
str = str.replace(/^\s\s*/, '');
|
|
1914
|
+
var ws = /\s/, i = str.length;
|
|
1915
|
+
while (ws.test(str.charAt(--i))) {
|
|
1916
|
+
//do nothing
|
|
1917
|
+
}
|
|
1918
|
+
return str.slice(0, i + 1);
|
|
1919
|
+
}
|
|
1920
|
+
Lang.trim = trim;
|
|
1921
|
+
/**
|
|
1922
|
+
* generic object arrays like dom definitions to array conversion method which
|
|
1923
|
+
* transforms any object to something array like
|
|
1924
|
+
* @param obj
|
|
1925
|
+
* @param offset
|
|
1926
|
+
* @param pack
|
|
1927
|
+
* @returns an array converted from the object
|
|
1928
|
+
*/
|
|
1929
|
+
function objToArray(obj, offset, pack) {
|
|
1930
|
+
if (offset === void 0) { offset = 0; }
|
|
1931
|
+
if (pack === void 0) { pack = []; }
|
|
1932
|
+
if ((obj !== null && obj !== void 0 ? obj : "__undefined__") == "__undefined__") {
|
|
1933
|
+
return pack !== null && pack !== void 0 ? pack : null;
|
|
1934
|
+
}
|
|
1935
|
+
//since offset is numeric we cannot use the shortcut due to 0 being false
|
|
1936
|
+
//special condition array delivered no offset no pack
|
|
1937
|
+
if (obj instanceof Array && !offset && !pack)
|
|
1938
|
+
return obj;
|
|
1939
|
+
return pack.concat(Array.prototype.slice.call(obj, offset));
|
|
1940
|
+
}
|
|
1941
|
+
Lang.objToArray = objToArray;
|
|
1942
|
+
/**
|
|
1943
|
+
* equalsIgnoreCase, case insensitive comparison of two strings
|
|
1944
|
+
*
|
|
1945
|
+
* @param source
|
|
1946
|
+
* @param destination
|
|
1947
|
+
*/
|
|
1948
|
+
function equalsIgnoreCase(source, destination) {
|
|
1949
|
+
var finalSource = source !== null && source !== void 0 ? source : "___no_value__";
|
|
1950
|
+
var finalDest = destination !== null && destination !== void 0 ? destination : "___no_value__";
|
|
1951
|
+
//in any other case we do a strong string comparison
|
|
1952
|
+
return finalSource.toLowerCase() === finalDest.toLowerCase();
|
|
1953
|
+
}
|
|
1954
|
+
Lang.equalsIgnoreCase = equalsIgnoreCase;
|
|
1955
|
+
/**
|
|
1956
|
+
* runtime type assertion
|
|
1957
|
+
*
|
|
1958
|
+
* @param probe the probe to be tested for a type
|
|
1959
|
+
* @param theType the type to be tested for
|
|
1960
|
+
*/
|
|
1961
|
+
function assertType(probe, theType) {
|
|
1962
|
+
return isString(theType) ? typeof probe == theType : probe instanceof theType;
|
|
1963
|
+
}
|
|
1964
|
+
Lang.assertType = assertType;
|
|
1965
|
+
/**
|
|
1966
|
+
* Backported from dojo
|
|
1967
|
+
* a failsafe string determination method
|
|
1968
|
+
* (since in javascript String != "" typeof alone fails!)
|
|
1969
|
+
* @param it {|Object|} the object to be checked for being a string
|
|
1970
|
+
* @return true in case of being a string false otherwise
|
|
1971
|
+
*/
|
|
1972
|
+
function isString(it) {
|
|
1973
|
+
// summary:
|
|
1974
|
+
// Return true if it is a String
|
|
1975
|
+
return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
|
|
1976
|
+
}
|
|
1977
|
+
Lang.isString = isString;
|
|
1978
|
+
function isFunc(it) {
|
|
1979
|
+
return it instanceof Function || typeof it === "function";
|
|
1980
|
+
}
|
|
1981
|
+
Lang.isFunc = isFunc;
|
|
1982
|
+
// code from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
1983
|
+
// license https://creativecommons.org/licenses/by-sa/2.5/
|
|
1984
|
+
function objAssign(target) {
|
|
1985
|
+
var theArgs = [];
|
|
1986
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1987
|
+
theArgs[_i - 1] = arguments[_i];
|
|
1988
|
+
}
|
|
1989
|
+
if (target == null) { // TypeError if undefined or null
|
|
1990
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
1991
|
+
}
|
|
1992
|
+
var to = Object(target);
|
|
1993
|
+
if (Object.assign) {
|
|
1994
|
+
theArgs.forEach(function (item) { return Object.assign(to, item); });
|
|
1995
|
+
return to;
|
|
1996
|
+
}
|
|
1997
|
+
theArgs.filter(function (item) { return item != null; }).forEach(function (item) {
|
|
1998
|
+
var nextSource = item;
|
|
1999
|
+
Object.keys(nextSource)
|
|
2000
|
+
.filter(function (nextKey) { return Object.prototype.hasOwnProperty.call(nextSource, nextKey); })
|
|
2001
|
+
.forEach(function (nextKey) { return to[nextKey] = nextSource[nextKey]; });
|
|
2002
|
+
});
|
|
2003
|
+
return to;
|
|
2004
|
+
}
|
|
2005
|
+
Lang.objAssign = objAssign;
|
|
2006
|
+
})(Lang = exports.Lang || (exports.Lang = {}));
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
/***/ }),
|
|
2010
|
+
|
|
2011
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Monad.ts":
|
|
2012
|
+
/*!*************************************************************!*\
|
|
2013
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Monad.ts ***!
|
|
2014
|
+
\*************************************************************/
|
|
2015
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2019
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
2020
|
+
* this work for additional information regarding copyright ownership.
|
|
2021
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
2022
|
+
* (the "License"); you may not use this file except in compliance with
|
|
2023
|
+
* the License. You may obtain a copy of the License at
|
|
2024
|
+
*
|
|
2025
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2026
|
+
*
|
|
2027
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2028
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2029
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2030
|
+
* See the License for the specific language governing permissions and
|
|
2031
|
+
* limitations under the License.
|
|
2032
|
+
*/
|
|
2033
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2034
|
+
var extendStatics = function (d, b) {
|
|
2035
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2036
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2037
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2038
|
+
return extendStatics(d, b);
|
|
2039
|
+
};
|
|
2040
|
+
return function (d, b) {
|
|
2041
|
+
if (typeof b !== "function" && b !== null)
|
|
2042
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2043
|
+
extendStatics(d, b);
|
|
2044
|
+
function __() { this.constructor = d; }
|
|
2045
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2046
|
+
};
|
|
2047
|
+
})();
|
|
2048
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2049
|
+
exports.Config = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
|
|
2050
|
+
/**
|
|
2051
|
+
* A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
|
|
2052
|
+
* Useful if you need the functions in another library to keep its dependencies down
|
|
2053
|
+
*/
|
|
2054
|
+
/*IMonad definitions*/
|
|
2055
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
2056
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
2057
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2058
|
+
var objAssign = Lang_1.Lang.objAssign;
|
|
2059
|
+
/**
|
|
2060
|
+
* Implementation of a monad
|
|
2061
|
+
* (Sideffect free), no write allowed directly on the monads
|
|
2062
|
+
* value state
|
|
2063
|
+
*/
|
|
2064
|
+
var Monad = /** @class */ (function () {
|
|
2065
|
+
function Monad(value) {
|
|
2066
|
+
this._value = value;
|
|
2067
|
+
}
|
|
2068
|
+
Object.defineProperty(Monad.prototype, "value", {
|
|
2069
|
+
get: function () {
|
|
2070
|
+
return this._value;
|
|
2071
|
+
},
|
|
2072
|
+
enumerable: false,
|
|
2073
|
+
configurable: true
|
|
2074
|
+
});
|
|
2075
|
+
Monad.prototype.map = function (fn) {
|
|
2076
|
+
if (!fn) {
|
|
2077
|
+
fn = function (inval) { return inval; };
|
|
2078
|
+
}
|
|
2079
|
+
var result = fn(this.value);
|
|
2080
|
+
return new Monad(result);
|
|
2081
|
+
};
|
|
2082
|
+
Monad.prototype.flatMap = function (fn) {
|
|
2083
|
+
var mapped = this.map(fn);
|
|
2084
|
+
while ((mapped === null || mapped === void 0 ? void 0 : mapped.value) instanceof Monad) {
|
|
2085
|
+
mapped = mapped.value;
|
|
2086
|
+
}
|
|
2087
|
+
return mapped;
|
|
2088
|
+
};
|
|
2089
|
+
return Monad;
|
|
2090
|
+
}());
|
|
2091
|
+
exports.Monad = Monad;
|
|
2092
|
+
/**
|
|
2093
|
+
* optional implementation, an optional is basically an implementation of a Monad with additional syntactic
|
|
2094
|
+
* sugar on top
|
|
2095
|
+
* (Sideeffect free, since value assignment is not allowed)
|
|
2096
|
+
* */
|
|
2097
|
+
var Optional = /** @class */ (function (_super) {
|
|
2098
|
+
__extends(Optional, _super);
|
|
2099
|
+
function Optional(value) {
|
|
2100
|
+
return _super.call(this, value) || this;
|
|
2101
|
+
}
|
|
2102
|
+
Object.defineProperty(Optional.prototype, "value", {
|
|
2103
|
+
get: function () {
|
|
2104
|
+
if (this._value instanceof Monad) {
|
|
2105
|
+
return this._value.flatMap().value;
|
|
2106
|
+
}
|
|
2107
|
+
return this._value;
|
|
2108
|
+
},
|
|
2109
|
+
enumerable: false,
|
|
2110
|
+
configurable: true
|
|
2111
|
+
});
|
|
2112
|
+
Optional.fromNullable = function (value) {
|
|
2113
|
+
return new Optional(value);
|
|
2114
|
+
};
|
|
2115
|
+
/*syntactic sugar for absent and present checks*/
|
|
2116
|
+
Optional.prototype.isAbsent = function () {
|
|
2117
|
+
return "undefined" == typeof this.value || null == this.value;
|
|
2118
|
+
};
|
|
2119
|
+
/**
|
|
2120
|
+
* any value present
|
|
2121
|
+
*/
|
|
2122
|
+
Optional.prototype.isPresent = function (presentRunnable) {
|
|
2123
|
+
var absent = this.isAbsent();
|
|
2124
|
+
if (!absent && presentRunnable) {
|
|
2125
|
+
presentRunnable.call(this, this);
|
|
2126
|
+
}
|
|
2127
|
+
return !absent;
|
|
2128
|
+
};
|
|
2129
|
+
Optional.prototype.ifPresentLazy = function (presentRunnable) {
|
|
2130
|
+
if (presentRunnable === void 0) { presentRunnable = function () {
|
|
2131
|
+
}; }
|
|
2132
|
+
this.isPresent.call(this, presentRunnable);
|
|
2133
|
+
return this;
|
|
2134
|
+
};
|
|
2135
|
+
Optional.prototype.orElse = function (elseValue) {
|
|
2136
|
+
if (this.isPresent()) {
|
|
2137
|
+
return this;
|
|
2138
|
+
}
|
|
2139
|
+
else {
|
|
2140
|
+
//shortcut
|
|
2141
|
+
if (elseValue == null) {
|
|
2142
|
+
return Optional.absent;
|
|
2143
|
+
}
|
|
2144
|
+
return this.flatMap(function () { return elseValue; });
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
/**
|
|
2148
|
+
* lazy, passes a function which then is lazily evaluated
|
|
2149
|
+
* instead of a direct value
|
|
2150
|
+
* @param func
|
|
2151
|
+
*/
|
|
2152
|
+
Optional.prototype.orElseLazy = function (func) {
|
|
2153
|
+
if (this.isPresent()) {
|
|
2154
|
+
return this;
|
|
2155
|
+
}
|
|
2156
|
+
else {
|
|
2157
|
+
return this.flatMap(func);
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
/*
|
|
2161
|
+
* we need to implement it to fullfill the contract, although it is used only internally
|
|
2162
|
+
* all values are flattened when accessed anyway, so there is no need to call this methiod
|
|
2163
|
+
*/
|
|
2164
|
+
Optional.prototype.flatMap = function (fn) {
|
|
2165
|
+
var val = _super.prototype.flatMap.call(this, fn);
|
|
2166
|
+
if (!(val instanceof Optional)) {
|
|
2167
|
+
return Optional.fromNullable(val.value);
|
|
2168
|
+
}
|
|
2169
|
+
return val.flatMap();
|
|
2170
|
+
};
|
|
2171
|
+
/*
|
|
2172
|
+
* elvis operation, take care, if you use this you lose typesafety and refactoring
|
|
2173
|
+
* capabilites, unfortunately typesceript does not allow to have its own elvis operator
|
|
2174
|
+
* this is some syntactic sugar however which is quite useful*/
|
|
2175
|
+
Optional.prototype.getIf = function () {
|
|
2176
|
+
var key = [];
|
|
2177
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2178
|
+
key[_i] = arguments[_i];
|
|
2179
|
+
}
|
|
2180
|
+
var currentPos = this;
|
|
2181
|
+
for (var cnt = 0; cnt < key.length; cnt++) {
|
|
2182
|
+
var currKey = this.keyVal(key[cnt]);
|
|
2183
|
+
var arrPos = this.arrayIndex(key[cnt]);
|
|
2184
|
+
if (currKey === "" && arrPos >= 0) {
|
|
2185
|
+
currentPos = this.getClass().fromNullable(!(currentPos.value instanceof Array) ? null : (currentPos.value.length < arrPos ? null : currentPos.value[arrPos]));
|
|
2186
|
+
if (currentPos.isAbsent()) {
|
|
2187
|
+
return currentPos;
|
|
2188
|
+
}
|
|
2189
|
+
continue;
|
|
2190
|
+
}
|
|
2191
|
+
else if (currKey && arrPos >= 0) {
|
|
2192
|
+
if (currentPos.getIfPresent(currKey).isAbsent()) {
|
|
2193
|
+
return currentPos;
|
|
2194
|
+
}
|
|
2195
|
+
currentPos = (currentPos.getIfPresent(currKey).value instanceof Array) ? this.getClass().fromNullable(currentPos.getIfPresent(currKey).value[arrPos]) : this.getClass().absent;
|
|
2196
|
+
if (currentPos.isAbsent()) {
|
|
2197
|
+
return currentPos;
|
|
2198
|
+
}
|
|
2199
|
+
continue;
|
|
2200
|
+
}
|
|
2201
|
+
else {
|
|
2202
|
+
currentPos = currentPos.getIfPresent(currKey);
|
|
2203
|
+
}
|
|
2204
|
+
if (currentPos.isAbsent()) {
|
|
2205
|
+
return currentPos;
|
|
2206
|
+
}
|
|
2207
|
+
else if (arrPos > -1) {
|
|
2208
|
+
currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
var retVal = currentPos;
|
|
2212
|
+
return retVal;
|
|
2213
|
+
};
|
|
2214
|
+
/**
|
|
2215
|
+
* simple match, if the first order function call returns
|
|
2216
|
+
* true then there is a match, if the value is not present
|
|
2217
|
+
* it never matches
|
|
2218
|
+
*
|
|
2219
|
+
* @param fn the first order function performing the match
|
|
2220
|
+
*/
|
|
2221
|
+
Optional.prototype.match = function (fn) {
|
|
2222
|
+
if (this.isAbsent()) {
|
|
2223
|
+
return false;
|
|
2224
|
+
}
|
|
2225
|
+
return fn(this.value);
|
|
2226
|
+
};
|
|
2227
|
+
/**
|
|
2228
|
+
* convenience function to flatmap the internal value
|
|
2229
|
+
* and replace it with a default in case of being absent
|
|
2230
|
+
*
|
|
2231
|
+
* @param defaultVal
|
|
2232
|
+
* @returns {Optional<any>}
|
|
2233
|
+
*/
|
|
2234
|
+
Optional.prototype.get = function (defaultVal) {
|
|
2235
|
+
if (defaultVal === void 0) { defaultVal = Optional.absent; }
|
|
2236
|
+
if (this.isAbsent()) {
|
|
2237
|
+
return this.getClass().fromNullable(defaultVal).flatMap();
|
|
2238
|
+
}
|
|
2239
|
+
return this.getClass().fromNullable(this.value).flatMap();
|
|
2240
|
+
};
|
|
2241
|
+
Optional.prototype.toJson = function () {
|
|
2242
|
+
return JSON.stringify(this.value);
|
|
2243
|
+
};
|
|
2244
|
+
/**
|
|
2245
|
+
* helper to override several implementations in a more fluent way
|
|
2246
|
+
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
2247
|
+
* static methods and do not have to implement several methods which rely on the type
|
|
2248
|
+
* of "this"
|
|
2249
|
+
* @returns {Monadish.Optional}
|
|
2250
|
+
*/
|
|
2251
|
+
Optional.prototype.getClass = function () {
|
|
2252
|
+
return Optional;
|
|
2253
|
+
};
|
|
2254
|
+
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
2255
|
+
Optional.prototype.arrayIndex = function (key) {
|
|
2256
|
+
var start = key.indexOf("[");
|
|
2257
|
+
var end = key.indexOf("]");
|
|
2258
|
+
if (start >= 0 && end > 0 && start < end) {
|
|
2259
|
+
return parseInt(key.substring(start + 1, end));
|
|
2260
|
+
}
|
|
2261
|
+
else {
|
|
2262
|
+
return -1;
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
/*helper method for getIf with array access aka <name>[<indexPos>]*/
|
|
2266
|
+
Optional.prototype.keyVal = function (key) {
|
|
2267
|
+
var start = key.indexOf("[");
|
|
2268
|
+
if (start >= 0) {
|
|
2269
|
+
return key.substring(0, start);
|
|
2270
|
+
}
|
|
2271
|
+
else {
|
|
2272
|
+
return key;
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
/**
|
|
2276
|
+
* additional syntactic sugar which is not part of the usual optional implementation
|
|
2277
|
+
* but makes life easier, if you want to sacrifice typesafety and refactoring
|
|
2278
|
+
* capabilities in typescript
|
|
2279
|
+
*/
|
|
2280
|
+
Optional.prototype.getIfPresent = function (key) {
|
|
2281
|
+
if (this.isAbsent()) {
|
|
2282
|
+
return this.getClass().absent;
|
|
2283
|
+
}
|
|
2284
|
+
return this.getClass().fromNullable(this.value[key]).flatMap();
|
|
2285
|
+
};
|
|
2286
|
+
/**
|
|
2287
|
+
* elvis like typesafe functional save resolver
|
|
2288
|
+
* a typesafe option for getIfPresent
|
|
2289
|
+
*
|
|
2290
|
+
* usage myOptional.resolve(value => value.subAttr.subAttr2).orElseLazy(....)
|
|
2291
|
+
* if this is resolvable without any errors an Optional with the value is returned
|
|
2292
|
+
* if not, then an Optional absent is returned, also if you return Optional absent
|
|
2293
|
+
* it is flatmapped into absent
|
|
2294
|
+
*
|
|
2295
|
+
* @param resolver the resolver function, can throw any arbitrary errors, int the error case
|
|
2296
|
+
* the resolution goes towards absent
|
|
2297
|
+
*/
|
|
2298
|
+
Optional.prototype.resolve = function (resolver) {
|
|
2299
|
+
if (this.isAbsent()) {
|
|
2300
|
+
return Optional.absent;
|
|
2301
|
+
}
|
|
2302
|
+
try {
|
|
2303
|
+
return Optional.fromNullable(resolver(this.value));
|
|
2304
|
+
}
|
|
2305
|
+
catch (e) {
|
|
2306
|
+
return Optional.absent;
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
/*default value for absent*/
|
|
2310
|
+
Optional.absent = Optional.fromNullable(null);
|
|
2311
|
+
return Optional;
|
|
2312
|
+
}(Monad));
|
|
2313
|
+
exports.Optional = Optional;
|
|
2314
|
+
// --------------------- From here onwards we break out the sideffects free limits ------------
|
|
2315
|
+
/**
|
|
2316
|
+
* ValueEmbedder is the writeable version
|
|
2317
|
+
* of optional, it basically is a wrappber
|
|
2318
|
+
* around a construct which has a state
|
|
2319
|
+
* and can be written to.
|
|
2320
|
+
*
|
|
2321
|
+
* For the readonly version see Optional
|
|
2322
|
+
*/
|
|
2323
|
+
var ValueEmbedder = /** @class */ (function (_super) {
|
|
2324
|
+
__extends(ValueEmbedder, _super);
|
|
2325
|
+
function ValueEmbedder(rootElem, valueKey) {
|
|
2326
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
2327
|
+
var _this = _super.call(this, rootElem) || this;
|
|
2328
|
+
_this.key = valueKey;
|
|
2329
|
+
return _this;
|
|
2330
|
+
}
|
|
2331
|
+
Object.defineProperty(ValueEmbedder.prototype, "value", {
|
|
2332
|
+
get: function () {
|
|
2333
|
+
return this._value ? this._value[this.key] : null;
|
|
2334
|
+
},
|
|
2335
|
+
set: function (newVal) {
|
|
2336
|
+
if (!this._value) {
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2339
|
+
this._value[this.key] = newVal;
|
|
2340
|
+
},
|
|
2341
|
+
enumerable: false,
|
|
2342
|
+
configurable: true
|
|
2343
|
+
});
|
|
2344
|
+
ValueEmbedder.prototype.orElse = function (elseValue) {
|
|
2345
|
+
var alternative = {};
|
|
2346
|
+
alternative[this.key] = elseValue;
|
|
2347
|
+
return this.isPresent() ? this : new ValueEmbedder(alternative, this.key);
|
|
2348
|
+
};
|
|
2349
|
+
ValueEmbedder.prototype.orElseLazy = function (func) {
|
|
2350
|
+
if (this.isPresent()) {
|
|
2351
|
+
return this;
|
|
2352
|
+
}
|
|
2353
|
+
else {
|
|
2354
|
+
var alternative = {};
|
|
2355
|
+
alternative[this.key] = func();
|
|
2356
|
+
return new ValueEmbedder(alternative, this.key);
|
|
2357
|
+
}
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* helper to override several implementations in a more fluent way
|
|
2361
|
+
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
2362
|
+
* static methods and do not have to implement several methods which rely on the type
|
|
2363
|
+
* of "this"
|
|
2364
|
+
* @returns {Monadish.Optional}
|
|
2365
|
+
*/
|
|
2366
|
+
ValueEmbedder.prototype.getClass = function () {
|
|
2367
|
+
return ValueEmbedder;
|
|
2368
|
+
};
|
|
2369
|
+
ValueEmbedder.fromNullable = function (value, valueKey) {
|
|
2370
|
+
if (valueKey === void 0) { valueKey = "value"; }
|
|
2371
|
+
return new ValueEmbedder(value, valueKey);
|
|
2372
|
+
};
|
|
2373
|
+
/*default value for absent*/
|
|
2374
|
+
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
2375
|
+
return ValueEmbedder;
|
|
2376
|
+
}(Optional));
|
|
2377
|
+
exports.ValueEmbedder = ValueEmbedder;
|
|
2378
|
+
/**
|
|
2379
|
+
* specialized value embedder
|
|
2380
|
+
* for our Configuration
|
|
2381
|
+
*/
|
|
2382
|
+
var ConfigEntry = /** @class */ (function (_super) {
|
|
2383
|
+
__extends(ConfigEntry, _super);
|
|
2384
|
+
function ConfigEntry(rootElem, key, arrPos) {
|
|
2385
|
+
var _this = _super.call(this, rootElem, key) || this;
|
|
2386
|
+
_this.arrPos = arrPos !== null && arrPos !== void 0 ? arrPos : -1;
|
|
2387
|
+
return _this;
|
|
2388
|
+
}
|
|
2389
|
+
Object.defineProperty(ConfigEntry.prototype, "value", {
|
|
2390
|
+
get: function () {
|
|
2391
|
+
if (this.key == "" && this.arrPos >= 0) {
|
|
2392
|
+
return this._value[this.arrPos];
|
|
2393
|
+
}
|
|
2394
|
+
else if (this.key && this.arrPos >= 0) {
|
|
2395
|
+
return this._value[this.key][this.arrPos];
|
|
2396
|
+
}
|
|
2397
|
+
return this._value[this.key];
|
|
2398
|
+
},
|
|
2399
|
+
set: function (val) {
|
|
2400
|
+
if (this.key == "" && this.arrPos >= 0) {
|
|
2401
|
+
this._value[this.arrPos] = val;
|
|
2402
|
+
return;
|
|
2403
|
+
}
|
|
2404
|
+
else if (this.key && this.arrPos >= 0) {
|
|
2405
|
+
this._value[this.key][this.arrPos] = val;
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
this._value[this.key] = val;
|
|
2409
|
+
},
|
|
2410
|
+
enumerable: false,
|
|
2411
|
+
configurable: true
|
|
2412
|
+
});
|
|
2413
|
+
/*default value for absent*/
|
|
2414
|
+
ConfigEntry.absent = ConfigEntry.fromNullable(null);
|
|
2415
|
+
return ConfigEntry;
|
|
2416
|
+
}(ValueEmbedder));
|
|
2417
|
+
/**
|
|
2418
|
+
* Config, basically an optional wrapper for a json structure
|
|
2419
|
+
* (not sideeffect free, since we can alter the internal config state
|
|
2420
|
+
* without generating a new config), not sure if we should make it sideffect free
|
|
2421
|
+
* since this would swallow a lot of performane and ram
|
|
2422
|
+
*/
|
|
2423
|
+
var Config = /** @class */ (function (_super) {
|
|
2424
|
+
__extends(Config, _super);
|
|
2425
|
+
function Config(root) {
|
|
2426
|
+
return _super.call(this, root) || this;
|
|
2427
|
+
}
|
|
2428
|
+
Object.defineProperty(Config.prototype, "shallowCopy", {
|
|
2429
|
+
/**
|
|
2430
|
+
* shallow copy getter, copies only the first level, references the deeper nodes
|
|
2431
|
+
* in a shared manner
|
|
2432
|
+
*/
|
|
2433
|
+
get: function () {
|
|
2434
|
+
return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
|
|
2435
|
+
},
|
|
2436
|
+
enumerable: false,
|
|
2437
|
+
configurable: true
|
|
2438
|
+
});
|
|
2439
|
+
Object.defineProperty(Config.prototype, "deepCopy", {
|
|
2440
|
+
/**
|
|
2441
|
+
* deep copy, copies all config nodes
|
|
2442
|
+
*/
|
|
2443
|
+
get: function () {
|
|
2444
|
+
return new Config(objAssign({}, this.value));
|
|
2445
|
+
},
|
|
2446
|
+
enumerable: false,
|
|
2447
|
+
configurable: true
|
|
2448
|
+
});
|
|
2449
|
+
/**
|
|
2450
|
+
* creates a config from an initial value or null
|
|
2451
|
+
* @param value
|
|
2452
|
+
*/
|
|
2453
|
+
Config.fromNullable = function (value) {
|
|
2454
|
+
return new Config(value);
|
|
2455
|
+
};
|
|
2456
|
+
/**
|
|
2457
|
+
* simple merge for the root configs
|
|
2458
|
+
*/
|
|
2459
|
+
Config.prototype.shallowMerge = function (other, overwrite, withAppend) {
|
|
2460
|
+
var _this = this;
|
|
2461
|
+
if (overwrite === void 0) { overwrite = true; }
|
|
2462
|
+
if (withAppend === void 0) { withAppend = false; }
|
|
2463
|
+
var _loop_1 = function (key) {
|
|
2464
|
+
if (overwrite || !(key in this_1.value)) {
|
|
2465
|
+
if (!withAppend) {
|
|
2466
|
+
this_1.assign(key).value = other.getIf(key).value;
|
|
2467
|
+
}
|
|
2468
|
+
else {
|
|
2469
|
+
if (Array.isArray(other.getIf(key).value)) {
|
|
2470
|
+
Stream_1.Stream.of.apply(Stream_1.Stream, other.getIf(key).value).each(function (item) { return _this.append(key).value = item; });
|
|
2471
|
+
}
|
|
2472
|
+
else {
|
|
2473
|
+
this_1.append(key).value = other.getIf(key).value;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
var this_1 = this;
|
|
2479
|
+
for (var key in other.value) {
|
|
2480
|
+
_loop_1(key);
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
/**
|
|
2484
|
+
* assigns a single value as array, or appends it
|
|
2485
|
+
* to an existing value mapping a single value to array
|
|
2486
|
+
*
|
|
2487
|
+
*
|
|
2488
|
+
* usage myConfig.append("foobaz").value = "newValue"
|
|
2489
|
+
* myConfig.append("foobaz").value = "newValue2"
|
|
2490
|
+
*
|
|
2491
|
+
* resulting in myConfig.foobaz == ["newValue, newValue2"]
|
|
2492
|
+
*
|
|
2493
|
+
* @param {string[]} accessPath
|
|
2494
|
+
*/
|
|
2495
|
+
Config.prototype.append = function () {
|
|
2496
|
+
var accessPath = [];
|
|
2497
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2498
|
+
accessPath[_i] = arguments[_i];
|
|
2499
|
+
}
|
|
2500
|
+
var noKeys = accessPath.length < 1;
|
|
2501
|
+
if (noKeys) {
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
var lastKey = accessPath[accessPath.length - 1];
|
|
2505
|
+
var currKey, finalKey = this.keyVal(lastKey);
|
|
2506
|
+
var pathExists = this.getIf.apply(this, accessPath).isPresent();
|
|
2507
|
+
this.buildPath(accessPath);
|
|
2508
|
+
var finalKeyArrPos = this.arrayIndex(lastKey);
|
|
2509
|
+
if (finalKeyArrPos > -1) {
|
|
2510
|
+
throw Error("Append only possible on non array properties, use assign on indexed data");
|
|
2511
|
+
}
|
|
2512
|
+
var value = this.getIf.apply(this, accessPath).value;
|
|
2513
|
+
if (!Array.isArray(value)) {
|
|
2514
|
+
value = this.assign.apply(this, accessPath).value = [value];
|
|
2515
|
+
}
|
|
2516
|
+
if (pathExists) {
|
|
2517
|
+
value.push({});
|
|
2518
|
+
}
|
|
2519
|
+
finalKeyArrPos = value.length - 1;
|
|
2520
|
+
var retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
|
|
2521
|
+
return retVal;
|
|
2522
|
+
};
|
|
2523
|
+
/**
|
|
2524
|
+
* appends to an existing entry (or extends into an array and appends)
|
|
2525
|
+
* if the condition is met
|
|
2526
|
+
* @param {boolean} condition
|
|
2527
|
+
* @param {string[]} accessPath
|
|
2528
|
+
*/
|
|
2529
|
+
Config.prototype.appendIf = function (condition) {
|
|
2530
|
+
var accessPath = [];
|
|
2531
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2532
|
+
accessPath[_i - 1] = arguments[_i];
|
|
2533
|
+
}
|
|
2534
|
+
if (!condition) {
|
|
2535
|
+
return { value: null };
|
|
2536
|
+
}
|
|
2537
|
+
return this.append.apply(this, accessPath);
|
|
2538
|
+
};
|
|
2539
|
+
/**
|
|
2540
|
+
* assings an new value on the given access path
|
|
2541
|
+
* @param accessPath
|
|
2542
|
+
*/
|
|
2543
|
+
Config.prototype.assign = function () {
|
|
2544
|
+
var accessPath = [];
|
|
2545
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2546
|
+
accessPath[_i] = arguments[_i];
|
|
2547
|
+
}
|
|
2548
|
+
if (accessPath.length < 1) {
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
this.buildPath(accessPath);
|
|
2552
|
+
var currKey = this.keyVal(accessPath[accessPath.length - 1]);
|
|
2553
|
+
var arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
|
|
2554
|
+
var retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
|
|
2555
|
+
return retVal;
|
|
2556
|
+
};
|
|
2557
|
+
/**
|
|
2558
|
+
* assign a value if the condition is set to true, otherwise skip it
|
|
2559
|
+
*
|
|
2560
|
+
* @param condition the condition, the access accessPath into the config
|
|
2561
|
+
* @param accessPath
|
|
2562
|
+
*/
|
|
2563
|
+
Config.prototype.assignIf = function (condition) {
|
|
2564
|
+
var accessPath = [];
|
|
2565
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2566
|
+
accessPath[_i - 1] = arguments[_i];
|
|
2567
|
+
}
|
|
2568
|
+
return condition ? this.assign.apply(this, accessPath) : { value: null };
|
|
2569
|
+
};
|
|
2570
|
+
/**
|
|
2571
|
+
* get if the access path is present (get is reserved as getter with a default, on the current path)
|
|
2572
|
+
* TODO will be renamed to something more meaningful and deprecated, the name is ambigous
|
|
2573
|
+
* @param accessPath the access path
|
|
2574
|
+
*/
|
|
2575
|
+
Config.prototype.getIf = function () {
|
|
2576
|
+
var accessPath = [];
|
|
2577
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2578
|
+
accessPath[_i] = arguments[_i];
|
|
2579
|
+
}
|
|
2580
|
+
return this.getClass().fromNullable(_super.prototype.getIf.apply(this, accessPath).value);
|
|
2581
|
+
};
|
|
2582
|
+
/**
|
|
2583
|
+
* gets the current node and if none is present returns a config with a default value
|
|
2584
|
+
* @param defaultVal
|
|
2585
|
+
*/
|
|
2586
|
+
Config.prototype.get = function (defaultVal) {
|
|
2587
|
+
return this.getClass().fromNullable(_super.prototype.get.call(this, defaultVal).value);
|
|
2588
|
+
};
|
|
2589
|
+
//empties the current config entry
|
|
2590
|
+
Config.prototype.delete = function (key) {
|
|
2591
|
+
if (key in this.value) {
|
|
2592
|
+
delete this.value[key];
|
|
2593
|
+
}
|
|
2594
|
+
return this;
|
|
2595
|
+
};
|
|
2596
|
+
/**
|
|
2597
|
+
* converts the entire config into a json object
|
|
2598
|
+
*/
|
|
2599
|
+
Config.prototype.toJson = function () {
|
|
2600
|
+
return JSON.stringify(this.value);
|
|
2601
|
+
};
|
|
2602
|
+
Config.prototype.getClass = function () {
|
|
2603
|
+
return Config;
|
|
2604
|
+
};
|
|
2605
|
+
Config.prototype.setVal = function (val) {
|
|
2606
|
+
this._value = val;
|
|
2607
|
+
};
|
|
2608
|
+
/**
|
|
2609
|
+
* builds the config path
|
|
2610
|
+
*
|
|
2611
|
+
* @param accessPath a sequential array of accessPath containing either a key name or an array reference name[<index>]
|
|
2612
|
+
*/
|
|
2613
|
+
Config.prototype.buildPath = function (accessPath) {
|
|
2614
|
+
var val = this;
|
|
2615
|
+
var parentVal = this.getClass().fromNullable(null);
|
|
2616
|
+
var parentPos = -1;
|
|
2617
|
+
var alloc = function (arr, length) {
|
|
2618
|
+
var length1 = arr.length;
|
|
2619
|
+
var length2 = length1 + length;
|
|
2620
|
+
for (var cnt = length1; cnt < length2; cnt++) {
|
|
2621
|
+
arr.push({});
|
|
2622
|
+
}
|
|
2623
|
+
};
|
|
2624
|
+
for (var cnt = 0; cnt < accessPath.length; cnt++) {
|
|
2625
|
+
var currKey = this.keyVal(accessPath[cnt]);
|
|
2626
|
+
var arrPos = this.arrayIndex(accessPath[cnt]);
|
|
2627
|
+
if (currKey === "" && arrPos >= 0) {
|
|
2628
|
+
val.setVal((val.value instanceof Array) ? val.value : []);
|
|
2629
|
+
alloc(val.value, arrPos + 1);
|
|
2630
|
+
if (parentPos >= 0) {
|
|
2631
|
+
parentVal.value[parentPos] = val.value;
|
|
2632
|
+
}
|
|
2633
|
+
parentVal = val;
|
|
2634
|
+
parentPos = arrPos;
|
|
2635
|
+
val = this.getClass().fromNullable(val.value[arrPos]);
|
|
2636
|
+
continue;
|
|
2637
|
+
}
|
|
2638
|
+
var tempVal = val.getIf(currKey);
|
|
2639
|
+
if (arrPos == -1) {
|
|
2640
|
+
if (tempVal.isAbsent()) {
|
|
2641
|
+
tempVal = this.getClass().fromNullable(val.value[currKey] = {});
|
|
2642
|
+
}
|
|
2643
|
+
else {
|
|
2644
|
+
val = tempVal;
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
var arr = (tempVal.value instanceof Array) ? tempVal.value : [];
|
|
2649
|
+
alloc(arr, arrPos + 1);
|
|
2650
|
+
val.value[currKey] = arr;
|
|
2651
|
+
tempVal = this.getClass().fromNullable(arr[arrPos]);
|
|
2652
|
+
}
|
|
2653
|
+
parentVal = val;
|
|
2654
|
+
parentPos = arrPos;
|
|
2655
|
+
val = tempVal;
|
|
2656
|
+
}
|
|
2657
|
+
return this;
|
|
2658
|
+
};
|
|
2659
|
+
return Config;
|
|
2660
|
+
}(Optional));
|
|
2661
|
+
exports.Config = Config;
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
/***/ }),
|
|
2665
|
+
|
|
2666
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts":
|
|
2667
|
+
/*!*************************************************************************!*\
|
|
2668
|
+
!*** ./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts ***!
|
|
2669
|
+
\*************************************************************************/
|
|
2670
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2674
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
2675
|
+
* this work for additional information regarding copyright ownership.
|
|
2676
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
2677
|
+
* (the "License"); you may not use this file except in compliance with
|
|
2678
|
+
* the License. You may obtain a copy of the License at
|
|
2679
|
+
*
|
|
2680
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2681
|
+
*
|
|
2682
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2683
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2684
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2685
|
+
* See the License for the specific language governing permissions and
|
|
2686
|
+
* limitations under the License.
|
|
2687
|
+
*/
|
|
2688
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2689
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2690
|
+
if (ar || !(i in from)) {
|
|
2691
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2692
|
+
ar[i] = from[i];
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2696
|
+
};
|
|
2697
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2698
|
+
exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.ITERATION_STATUS = void 0;
|
|
2699
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
2700
|
+
/**
|
|
2701
|
+
* special status of the datasource location pointer
|
|
2702
|
+
*/
|
|
2703
|
+
var ITERATION_STATUS;
|
|
2704
|
+
(function (ITERATION_STATUS) {
|
|
2705
|
+
ITERATION_STATUS["EO_STRM"] = "__EO_STRM__";
|
|
2706
|
+
ITERATION_STATUS["BEF_STRM"] = "___BEF_STRM__";
|
|
2707
|
+
})(ITERATION_STATUS = exports.ITERATION_STATUS || (exports.ITERATION_STATUS = {}));
|
|
2708
|
+
/**
|
|
2709
|
+
* defines a sequence of numbers for our stream input
|
|
2710
|
+
*/
|
|
2711
|
+
var SequenceDataSource = /** @class */ (function () {
|
|
2712
|
+
function SequenceDataSource(start, total) {
|
|
2713
|
+
this.total = total;
|
|
2714
|
+
this.start = start;
|
|
2715
|
+
this.value = start - 1;
|
|
2716
|
+
}
|
|
2717
|
+
SequenceDataSource.prototype.hasNext = function () {
|
|
2718
|
+
return this.value < (this.total - 1);
|
|
2719
|
+
};
|
|
2720
|
+
SequenceDataSource.prototype.next = function () {
|
|
2721
|
+
this.value++;
|
|
2722
|
+
return this.value <= (this.total - 1) ? this.value : ITERATION_STATUS.EO_STRM;
|
|
2723
|
+
};
|
|
2724
|
+
SequenceDataSource.prototype.lookAhead = function (cnt) {
|
|
2725
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2726
|
+
if ((this.value + cnt) > this.total - 1) {
|
|
2727
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2728
|
+
}
|
|
2729
|
+
else {
|
|
2730
|
+
return this.value + cnt;
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2733
|
+
SequenceDataSource.prototype.reset = function () {
|
|
2734
|
+
this.value = this.start - 1;
|
|
2735
|
+
};
|
|
2736
|
+
SequenceDataSource.prototype.current = function () {
|
|
2737
|
+
//first condition current without initial call for next
|
|
2738
|
+
return (this.start - 1) ? ITERATION_STATUS.BEF_STRM : this.value;
|
|
2739
|
+
};
|
|
2740
|
+
return SequenceDataSource;
|
|
2741
|
+
}());
|
|
2742
|
+
exports.SequenceDataSource = SequenceDataSource;
|
|
2743
|
+
/**
|
|
2744
|
+
* implementation of iteratable on top of array
|
|
2745
|
+
*/
|
|
2746
|
+
var ArrayStreamDataSource = /** @class */ (function () {
|
|
2747
|
+
function ArrayStreamDataSource() {
|
|
2748
|
+
var value = [];
|
|
2749
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2750
|
+
value[_i] = arguments[_i];
|
|
2751
|
+
}
|
|
2752
|
+
this.dataPos = -1;
|
|
2753
|
+
this.value = value;
|
|
2754
|
+
}
|
|
2755
|
+
ArrayStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2756
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2757
|
+
if ((this.dataPos + cnt) > this.value.length - 1) {
|
|
2758
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2759
|
+
}
|
|
2760
|
+
return this.value[this.dataPos + cnt];
|
|
2761
|
+
};
|
|
2762
|
+
ArrayStreamDataSource.prototype.hasNext = function () {
|
|
2763
|
+
return this.value.length - 1 > this.dataPos;
|
|
2764
|
+
};
|
|
2765
|
+
ArrayStreamDataSource.prototype.next = function () {
|
|
2766
|
+
var _a;
|
|
2767
|
+
this.dataPos++;
|
|
2768
|
+
return (_a = this === null || this === void 0 ? void 0 : this.value[this.dataPos]) !== null && _a !== void 0 ? _a : ITERATION_STATUS.EO_STRM;
|
|
2769
|
+
};
|
|
2770
|
+
ArrayStreamDataSource.prototype.reset = function () {
|
|
2771
|
+
this.dataPos = -1;
|
|
2772
|
+
};
|
|
2773
|
+
ArrayStreamDataSource.prototype.current = function () {
|
|
2774
|
+
return this.value[Math.max(0, this.dataPos)];
|
|
2775
|
+
};
|
|
2776
|
+
return ArrayStreamDataSource;
|
|
2777
|
+
}());
|
|
2778
|
+
exports.ArrayStreamDataSource = ArrayStreamDataSource;
|
|
2779
|
+
/**
|
|
2780
|
+
* an intermediate data source which prefilters
|
|
2781
|
+
* incoming stream data
|
|
2782
|
+
* and lets only the data out which
|
|
2783
|
+
* passes the filter function check
|
|
2784
|
+
*/
|
|
2785
|
+
var FilteredStreamDatasource = /** @class */ (function () {
|
|
2786
|
+
function FilteredStreamDatasource(filterFunc, parent) {
|
|
2787
|
+
this._current = ITERATION_STATUS.BEF_STRM;
|
|
2788
|
+
// we have to add a filter idx because the external filter values might change over time, so
|
|
2789
|
+
// we cannot reset the state properly unless we do it from a snapshot
|
|
2790
|
+
this._filterIdx = {};
|
|
2791
|
+
this._unfilteredPos = 0;
|
|
2792
|
+
this.filterFunc = filterFunc;
|
|
2793
|
+
this.inputDataSource = parent;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* in order to filter we have to make a look ahead until the
|
|
2797
|
+
* first next allowed element
|
|
2798
|
+
* hence we prefetch the element and then
|
|
2799
|
+
* serve it via next
|
|
2800
|
+
*/
|
|
2801
|
+
FilteredStreamDatasource.prototype.hasNext = function () {
|
|
2802
|
+
var steps = 1;
|
|
2803
|
+
var found = false;
|
|
2804
|
+
var next;
|
|
2805
|
+
while (!found && (next = this.inputDataSource.lookAhead(steps)) != ITERATION_STATUS.EO_STRM) {
|
|
2806
|
+
if (this.filterFunc(next)) {
|
|
2807
|
+
this._filterIdx[this._unfilteredPos + steps] = true;
|
|
2808
|
+
found = true;
|
|
2809
|
+
}
|
|
2810
|
+
else {
|
|
2811
|
+
steps++;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return found;
|
|
2815
|
+
};
|
|
2816
|
+
/**
|
|
2817
|
+
* serve the next element
|
|
2818
|
+
*/
|
|
2819
|
+
FilteredStreamDatasource.prototype.next = function () {
|
|
2820
|
+
var _a, _b;
|
|
2821
|
+
var found = ITERATION_STATUS.EO_STRM;
|
|
2822
|
+
while (this.inputDataSource.hasNext()) {
|
|
2823
|
+
this._unfilteredPos++;
|
|
2824
|
+
var next = this.inputDataSource.next();
|
|
2825
|
+
//again here we cannot call the filter function twice, because its state might change, so if indexed, we have a decent snapshot, either has next or next can trigger
|
|
2826
|
+
//the snapshot
|
|
2827
|
+
if (next != ITERATION_STATUS.EO_STRM &&
|
|
2828
|
+
(((_b = (_a = this._filterIdx) === null || _a === void 0 ? void 0 : _a[this._unfilteredPos]) !== null && _b !== void 0 ? _b : false) || this.filterFunc(next))) {
|
|
2829
|
+
this._filterIdx[this._unfilteredPos] = true;
|
|
2830
|
+
found = next;
|
|
2831
|
+
break;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
this._current = found;
|
|
2835
|
+
return found;
|
|
2836
|
+
};
|
|
2837
|
+
FilteredStreamDatasource.prototype.lookAhead = function (cnt) {
|
|
2838
|
+
var _a;
|
|
2839
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2840
|
+
var lookupVal;
|
|
2841
|
+
for (var loop = 1; cnt > 0 && (lookupVal = this.inputDataSource.lookAhead(loop)) != ITERATION_STATUS.EO_STRM; loop++) {
|
|
2842
|
+
var inCache = (_a = this._filterIdx) === null || _a === void 0 ? void 0 : _a[this._unfilteredPos + loop];
|
|
2843
|
+
if (inCache || this.filterFunc(lookupVal)) {
|
|
2844
|
+
cnt--;
|
|
2845
|
+
this._filterIdx[this._unfilteredPos + loop] = true;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
return lookupVal;
|
|
2849
|
+
};
|
|
2850
|
+
FilteredStreamDatasource.prototype.current = function () {
|
|
2851
|
+
return this._current;
|
|
2852
|
+
};
|
|
2853
|
+
FilteredStreamDatasource.prototype.reset = function () {
|
|
2854
|
+
this._current = ITERATION_STATUS.BEF_STRM;
|
|
2855
|
+
this._filterIdx = {};
|
|
2856
|
+
this._unfilteredPos = 0;
|
|
2857
|
+
this.inputDataSource.reset();
|
|
2858
|
+
};
|
|
2859
|
+
return FilteredStreamDatasource;
|
|
2860
|
+
}());
|
|
2861
|
+
exports.FilteredStreamDatasource = FilteredStreamDatasource;
|
|
2862
|
+
/**
|
|
2863
|
+
* an intermediate datasource which maps the items from
|
|
2864
|
+
* one into another
|
|
2865
|
+
*/
|
|
2866
|
+
var MappedStreamDataSource = /** @class */ (function () {
|
|
2867
|
+
function MappedStreamDataSource(mapFunc, parent) {
|
|
2868
|
+
this.mapFunc = mapFunc;
|
|
2869
|
+
this.inputDataSource = parent;
|
|
2870
|
+
}
|
|
2871
|
+
MappedStreamDataSource.prototype.hasNext = function () {
|
|
2872
|
+
return this.inputDataSource.hasNext();
|
|
2873
|
+
};
|
|
2874
|
+
MappedStreamDataSource.prototype.next = function () {
|
|
2875
|
+
return this.mapFunc(this.inputDataSource.next());
|
|
2876
|
+
};
|
|
2877
|
+
MappedStreamDataSource.prototype.reset = function () {
|
|
2878
|
+
this.inputDataSource.reset();
|
|
2879
|
+
};
|
|
2880
|
+
MappedStreamDataSource.prototype.current = function () {
|
|
2881
|
+
return this.mapFunc(this.inputDataSource.current());
|
|
2882
|
+
};
|
|
2883
|
+
MappedStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2884
|
+
if (cnt === void 0) { cnt = 1; }
|
|
2885
|
+
var lookAheadVal = this.inputDataSource.lookAhead(cnt);
|
|
2886
|
+
return (lookAheadVal == ITERATION_STATUS.EO_STRM) ? lookAheadVal : this.mapFunc(lookAheadVal);
|
|
2887
|
+
};
|
|
2888
|
+
return MappedStreamDataSource;
|
|
2889
|
+
}());
|
|
2890
|
+
exports.MappedStreamDataSource = MappedStreamDataSource;
|
|
2891
|
+
/**
|
|
2892
|
+
* Same for flatmap to deal with element -> stream mappings
|
|
2893
|
+
*/
|
|
2894
|
+
var FlatMapStreamDataSource = /** @class */ (function () {
|
|
2895
|
+
function FlatMapStreamDataSource(func, parent) {
|
|
2896
|
+
this.walkedDataSources = [];
|
|
2897
|
+
this._currPos = 0;
|
|
2898
|
+
this.mapFunc = func;
|
|
2899
|
+
this.inputDataSource = parent;
|
|
2900
|
+
}
|
|
2901
|
+
FlatMapStreamDataSource.prototype.hasNext = function () {
|
|
2902
|
+
return this.resolveActiveHasNext() || this.resolveNextHasNext();
|
|
2903
|
+
};
|
|
2904
|
+
FlatMapStreamDataSource.prototype.resolveActiveHasNext = function () {
|
|
2905
|
+
var next = false;
|
|
2906
|
+
if (this.activeDataSource) {
|
|
2907
|
+
next = this.activeDataSource.hasNext();
|
|
2908
|
+
}
|
|
2909
|
+
return next;
|
|
2910
|
+
};
|
|
2911
|
+
FlatMapStreamDataSource.prototype.lookAhead = function (cnt) {
|
|
2912
|
+
var _a;
|
|
2913
|
+
//easy access trial
|
|
2914
|
+
if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && ((_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt)) != ITERATION_STATUS.EO_STRM) {
|
|
2915
|
+
//this should coverr 95% of all accesses
|
|
2916
|
+
return this === null || this === void 0 ? void 0 : this.activeDataSource.lookAhead(cnt);
|
|
2917
|
+
}
|
|
2918
|
+
//slower method we have to look ahead forward one by one until we hit the end or
|
|
2919
|
+
//have to move on
|
|
2920
|
+
for (var lookAheadPos = 1, topLevelLookAhead = 1; lookAheadPos <= cnt; topLevelLookAhead++) {
|
|
2921
|
+
var foundItem = null;
|
|
2922
|
+
var item = this.inputDataSource.lookAhead(topLevelLookAhead);
|
|
2923
|
+
if (item === ITERATION_STATUS.EO_STRM) {
|
|
2924
|
+
return item;
|
|
2925
|
+
}
|
|
2926
|
+
var mapped = this.mapFunc(item);
|
|
2927
|
+
//it either comes in as datasource or as array
|
|
2928
|
+
var currentDataSource = this.toDatasource(mapped);
|
|
2929
|
+
//this is the inner loop which looks ahead on our flatmapped datasource
|
|
2930
|
+
//we need an inner counter, but every look ahead also increases our loop
|
|
2931
|
+
return currentDataSource.lookAhead(cnt);
|
|
2932
|
+
/* for(let flatmapLookAhead = 1; lookAheadPos <= cnt && foundItem != ITERATION_STATUS.EO_STRM; flatmapLookAhead++, lookAheadPos++) {
|
|
2933
|
+
foundItem = currentDataSource.lookAhead(flatmapLookAhead);
|
|
2934
|
+
if(lookAheadPos >= cnt) {
|
|
2935
|
+
return foundItem;
|
|
2936
|
+
}
|
|
2937
|
+
}*/
|
|
2938
|
+
}
|
|
2939
|
+
return ITERATION_STATUS.EO_STRM;
|
|
2940
|
+
};
|
|
2941
|
+
FlatMapStreamDataSource.prototype.toDatasource = function (mapped) {
|
|
2942
|
+
var ds = Array.isArray(mapped) ? new (ArrayStreamDataSource.bind.apply(ArrayStreamDataSource, __spreadArray([void 0], mapped, false)))() : mapped;
|
|
2943
|
+
this.walkedDataSources.push(ds);
|
|
2944
|
+
return ds;
|
|
2945
|
+
};
|
|
2946
|
+
FlatMapStreamDataSource.prototype.resolveNextHasNext = function () {
|
|
2947
|
+
var next = false;
|
|
2948
|
+
while (!next && this.inputDataSource.hasNext()) {
|
|
2949
|
+
var mapped = this.mapFunc(this.inputDataSource.next());
|
|
2950
|
+
this.activeDataSource = this.toDatasource(mapped);
|
|
2951
|
+
;
|
|
2952
|
+
next = this.activeDataSource.hasNext();
|
|
2953
|
+
}
|
|
2954
|
+
return next;
|
|
2955
|
+
};
|
|
2956
|
+
FlatMapStreamDataSource.prototype.next = function () {
|
|
2957
|
+
if (this.hasNext()) {
|
|
2958
|
+
this._currPos++;
|
|
2959
|
+
return this.activeDataSource.next();
|
|
2960
|
+
}
|
|
2961
|
+
};
|
|
2962
|
+
FlatMapStreamDataSource.prototype.reset = function () {
|
|
2963
|
+
this.inputDataSource.reset();
|
|
2964
|
+
this.walkedDataSources.forEach(function (ds) { return ds.reset(); });
|
|
2965
|
+
this.walkedDataSources = [];
|
|
2966
|
+
this._currPos = 0;
|
|
2967
|
+
this.activeDataSource = null;
|
|
2968
|
+
};
|
|
2969
|
+
FlatMapStreamDataSource.prototype.current = function () {
|
|
2970
|
+
if (!this.activeDataSource) {
|
|
2971
|
+
this.hasNext();
|
|
2972
|
+
}
|
|
2973
|
+
return this.activeDataSource.current();
|
|
2974
|
+
};
|
|
2975
|
+
return FlatMapStreamDataSource;
|
|
2976
|
+
}());
|
|
2977
|
+
exports.FlatMapStreamDataSource = FlatMapStreamDataSource;
|
|
2978
|
+
/**
|
|
2979
|
+
* For the time being we only need one collector
|
|
2980
|
+
* a collector which collects a stream back into arrays
|
|
2981
|
+
*/
|
|
2982
|
+
var ArrayCollector = /** @class */ (function () {
|
|
2983
|
+
function ArrayCollector() {
|
|
2984
|
+
this.data = [];
|
|
2985
|
+
}
|
|
2986
|
+
ArrayCollector.prototype.collect = function (element) {
|
|
2987
|
+
this.data.push(element);
|
|
2988
|
+
};
|
|
2989
|
+
Object.defineProperty(ArrayCollector.prototype, "finalValue", {
|
|
2990
|
+
get: function () {
|
|
2991
|
+
return this.data;
|
|
2992
|
+
},
|
|
2993
|
+
enumerable: false,
|
|
2994
|
+
configurable: true
|
|
2995
|
+
});
|
|
2996
|
+
return ArrayCollector;
|
|
2997
|
+
}());
|
|
2998
|
+
exports.ArrayCollector = ArrayCollector;
|
|
2999
|
+
/**
|
|
3000
|
+
* collects an tuple array stream into an assoc array with elements being collected into arrays
|
|
3001
|
+
*
|
|
3002
|
+
*/
|
|
3003
|
+
var ArrayAssocArrayCollector = /** @class */ (function () {
|
|
3004
|
+
function ArrayAssocArrayCollector() {
|
|
3005
|
+
this.finalValue = {};
|
|
3006
|
+
}
|
|
3007
|
+
ArrayAssocArrayCollector.prototype.collect = function (element) {
|
|
3008
|
+
var _a, _b, _c, _d;
|
|
3009
|
+
var key = (_a = element === null || element === void 0 ? void 0 : element[0]) !== null && _a !== void 0 ? _a : element;
|
|
3010
|
+
this.finalValue[key] = (_c = (_b = this.finalValue) === null || _b === void 0 ? void 0 : _b[key]) !== null && _c !== void 0 ? _c : [];
|
|
3011
|
+
this.finalValue[key].push((_d = element === null || element === void 0 ? void 0 : element[1]) !== null && _d !== void 0 ? _d : true);
|
|
3012
|
+
};
|
|
3013
|
+
return ArrayAssocArrayCollector;
|
|
3014
|
+
}());
|
|
3015
|
+
exports.ArrayAssocArrayCollector = ArrayAssocArrayCollector;
|
|
3016
|
+
/**
|
|
3017
|
+
* dummy collector which just triggers a run
|
|
3018
|
+
* on lazy streams without collecting anything
|
|
3019
|
+
*/
|
|
3020
|
+
var Run = /** @class */ (function () {
|
|
3021
|
+
function Run() {
|
|
3022
|
+
}
|
|
3023
|
+
Run.prototype.collect = function (element) {
|
|
3024
|
+
};
|
|
3025
|
+
Object.defineProperty(Run.prototype, "finalValue", {
|
|
3026
|
+
get: function () {
|
|
3027
|
+
return null;
|
|
3028
|
+
},
|
|
3029
|
+
enumerable: false,
|
|
3030
|
+
configurable: true
|
|
3031
|
+
});
|
|
3032
|
+
return Run;
|
|
3033
|
+
}());
|
|
3034
|
+
exports.Run = Run;
|
|
3035
|
+
/**
|
|
3036
|
+
* collects an assoc stream back to an assoc array
|
|
3037
|
+
*/
|
|
3038
|
+
var AssocArrayCollector = /** @class */ (function () {
|
|
3039
|
+
function AssocArrayCollector() {
|
|
3040
|
+
this.finalValue = {};
|
|
3041
|
+
}
|
|
3042
|
+
AssocArrayCollector.prototype.collect = function (element) {
|
|
3043
|
+
var _a, _b;
|
|
3044
|
+
this.finalValue[(_a = element[0]) !== null && _a !== void 0 ? _a : element] = (_b = element[1]) !== null && _b !== void 0 ? _b : true;
|
|
3045
|
+
};
|
|
3046
|
+
return AssocArrayCollector;
|
|
3047
|
+
}());
|
|
3048
|
+
exports.AssocArrayCollector = AssocArrayCollector;
|
|
3049
|
+
/**
|
|
3050
|
+
* Form data collector for key value pair streams
|
|
3051
|
+
*/
|
|
3052
|
+
var FormDataCollector = /** @class */ (function () {
|
|
3053
|
+
function FormDataCollector() {
|
|
3054
|
+
this.finalValue = new FormData();
|
|
3055
|
+
}
|
|
3056
|
+
FormDataCollector.prototype.collect = function (element) {
|
|
3057
|
+
this.finalValue.append(element.key, element.value);
|
|
3058
|
+
};
|
|
3059
|
+
return FormDataCollector;
|
|
3060
|
+
}());
|
|
3061
|
+
exports.FormDataCollector = FormDataCollector;
|
|
3062
|
+
/**
|
|
3063
|
+
* Form data collector for DomQuery streams
|
|
3064
|
+
*/
|
|
3065
|
+
var QueryFormDataCollector = /** @class */ (function () {
|
|
3066
|
+
function QueryFormDataCollector() {
|
|
3067
|
+
this.finalValue = new FormData();
|
|
3068
|
+
}
|
|
3069
|
+
QueryFormDataCollector.prototype.collect = function (element) {
|
|
3070
|
+
var toMerge = element.encodeFormElement();
|
|
3071
|
+
if (toMerge.isPresent()) {
|
|
3072
|
+
this.finalValue.append(element.name.value, toMerge.get(element.name).value);
|
|
3073
|
+
}
|
|
3074
|
+
};
|
|
3075
|
+
return QueryFormDataCollector;
|
|
3076
|
+
}());
|
|
3077
|
+
exports.QueryFormDataCollector = QueryFormDataCollector;
|
|
3078
|
+
/**
|
|
3079
|
+
* Encoded String collector from dom query streams
|
|
3080
|
+
*/
|
|
3081
|
+
var QueryFormStringCollector = /** @class */ (function () {
|
|
3082
|
+
function QueryFormStringCollector() {
|
|
3083
|
+
this.formData = [];
|
|
3084
|
+
}
|
|
3085
|
+
QueryFormStringCollector.prototype.collect = function (element) {
|
|
3086
|
+
var toMerge = element.encodeFormElement();
|
|
3087
|
+
if (toMerge.isPresent()) {
|
|
3088
|
+
this.formData.push([element.name.value, toMerge.get(element.name).value]);
|
|
3089
|
+
}
|
|
3090
|
+
};
|
|
3091
|
+
Object.defineProperty(QueryFormStringCollector.prototype, "finalValue", {
|
|
3092
|
+
get: function () {
|
|
3093
|
+
return Stream_1.Stream.of.apply(Stream_1.Stream, this.formData).map(function (keyVal) { return keyVal.join("="); })
|
|
3094
|
+
.reduce(function (item1, item2) { return [item1, item2].join("&"); })
|
|
3095
|
+
.orElse("").value;
|
|
3096
|
+
},
|
|
3097
|
+
enumerable: false,
|
|
3098
|
+
configurable: true
|
|
3099
|
+
});
|
|
3100
|
+
return QueryFormStringCollector;
|
|
3101
|
+
}());
|
|
3102
|
+
exports.QueryFormStringCollector = QueryFormStringCollector;
|
|
3103
|
+
|
|
3104
|
+
|
|
3105
|
+
/***/ }),
|
|
3106
|
+
|
|
3107
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/Stream.ts":
|
|
3108
|
+
/*!**************************************************************!*\
|
|
3109
|
+
!*** ./node_modules/mona-dish/src/main/typescript/Stream.ts ***!
|
|
3110
|
+
\**************************************************************/
|
|
3111
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3115
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3116
|
+
* this work for additional information regarding copyright ownership.
|
|
3117
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
3118
|
+
* (the "License"); you may not use this file except in compliance with
|
|
3119
|
+
* the License. You may obtain a copy of the License at
|
|
3120
|
+
*
|
|
3121
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3122
|
+
*
|
|
3123
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3124
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3125
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3126
|
+
* See the License for the specific language governing permissions and
|
|
3127
|
+
* limitations under the License.
|
|
3128
|
+
*/
|
|
3129
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3130
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3131
|
+
if (ar || !(i in from)) {
|
|
3132
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3133
|
+
ar[i] = from[i];
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3137
|
+
};
|
|
3138
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3139
|
+
exports.LazyStream = exports.Stream = void 0;
|
|
3140
|
+
/*
|
|
3141
|
+
* A small stream implementation
|
|
3142
|
+
*/
|
|
3143
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
3144
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
3145
|
+
/**
|
|
3146
|
+
* A simple typescript based reimplementation of streams
|
|
3147
|
+
*
|
|
3148
|
+
* This is the early eval version
|
|
3149
|
+
* for a lazy eval version check, LazyStream, which is api compatible
|
|
3150
|
+
* to this implementation, however with the benefit of being able
|
|
3151
|
+
* to provide infinite data sources and generic data providers, the downside
|
|
3152
|
+
* is, it might be a tad slower in some situations
|
|
3153
|
+
*/
|
|
3154
|
+
var Stream = /** @class */ (function () {
|
|
3155
|
+
function Stream() {
|
|
3156
|
+
var value = [];
|
|
3157
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3158
|
+
value[_i] = arguments[_i];
|
|
3159
|
+
}
|
|
3160
|
+
this._limits = -1;
|
|
3161
|
+
this.pos = -1;
|
|
3162
|
+
this.value = value;
|
|
3163
|
+
}
|
|
3164
|
+
Stream.of = function () {
|
|
3165
|
+
var data = [];
|
|
3166
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3167
|
+
data[_i] = arguments[_i];
|
|
3168
|
+
}
|
|
3169
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], data, false)))();
|
|
3170
|
+
};
|
|
3171
|
+
Stream.ofAssoc = function (data) {
|
|
3172
|
+
return this.of.apply(this, Object.keys(data)).map(function (key) { return [key, data[key]]; });
|
|
3173
|
+
};
|
|
3174
|
+
Stream.ofDataSource = function (dataSource) {
|
|
3175
|
+
var value = [];
|
|
3176
|
+
while (dataSource.hasNext()) {
|
|
3177
|
+
value.push(dataSource.next());
|
|
3178
|
+
}
|
|
3179
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], value, false)))();
|
|
3180
|
+
};
|
|
3181
|
+
Stream.prototype.limits = function (end) {
|
|
3182
|
+
this._limits = end;
|
|
3183
|
+
return this;
|
|
3184
|
+
};
|
|
3185
|
+
/**
|
|
3186
|
+
* concat for streams, so that you can concat two streams together
|
|
3187
|
+
* @param toAppend
|
|
3188
|
+
*/
|
|
3189
|
+
Stream.prototype.concat = function () {
|
|
3190
|
+
//let dataSource = new MultiStreamDatasource<T>(this, ...toAppend);
|
|
3191
|
+
//return Stream.ofDataSource<T>(dataSource);
|
|
3192
|
+
var toAppend = [];
|
|
3193
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3194
|
+
toAppend[_i] = arguments[_i];
|
|
3195
|
+
}
|
|
3196
|
+
return Stream.of.apply(Stream, __spreadArray([this], toAppend, false)).flatMap(function (item) { return item; });
|
|
3197
|
+
};
|
|
3198
|
+
Stream.prototype.onElem = function (fn) {
|
|
3199
|
+
for (var cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3200
|
+
if (fn(this.value[cnt], cnt) === false) {
|
|
3201
|
+
break;
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
return this;
|
|
3205
|
+
};
|
|
3206
|
+
Stream.prototype.each = function (fn) {
|
|
3207
|
+
this.onElem(fn);
|
|
3208
|
+
this.reset();
|
|
3209
|
+
};
|
|
3210
|
+
Stream.prototype.map = function (fn) {
|
|
3211
|
+
if (!fn) {
|
|
3212
|
+
fn = function (inval) { return inval; };
|
|
3213
|
+
}
|
|
3214
|
+
var res = [];
|
|
3215
|
+
this.each(function (item) {
|
|
3216
|
+
res.push(fn(item));
|
|
3217
|
+
});
|
|
3218
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], res, false)))();
|
|
3219
|
+
};
|
|
3220
|
+
/*
|
|
3221
|
+
* we need to implement it to fullfill the contract, although it is used only internally
|
|
3222
|
+
* all values are flattened when accessed anyway, so there is no need to call this methiod
|
|
3223
|
+
*/
|
|
3224
|
+
Stream.prototype.flatMap = function (fn) {
|
|
3225
|
+
var ret = [];
|
|
3226
|
+
this.each(function (item) {
|
|
3227
|
+
var strmR = fn(item);
|
|
3228
|
+
ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat.apply(ret, strmR.value);
|
|
3229
|
+
});
|
|
3230
|
+
return Stream.of.apply(Stream, ret);
|
|
3231
|
+
};
|
|
3232
|
+
Stream.prototype.filter = function (fn) {
|
|
3233
|
+
var res = [];
|
|
3234
|
+
this.each(function (data) {
|
|
3235
|
+
if (fn(data)) {
|
|
3236
|
+
res.push(data);
|
|
3237
|
+
}
|
|
3238
|
+
});
|
|
3239
|
+
return new (Stream.bind.apply(Stream, __spreadArray([void 0], res, false)))();
|
|
3240
|
+
};
|
|
3241
|
+
Stream.prototype.reduce = function (fn, startVal) {
|
|
3242
|
+
if (startVal === void 0) { startVal = null; }
|
|
3243
|
+
var offset = startVal != null ? 0 : 1;
|
|
3244
|
+
var val1 = startVal != null ? startVal : this.value.length ? this.value[0] : null;
|
|
3245
|
+
for (var cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3246
|
+
val1 = fn(val1, this.value[cnt]);
|
|
3247
|
+
}
|
|
3248
|
+
this.reset();
|
|
3249
|
+
return Monad_1.Optional.fromNullable(val1);
|
|
3250
|
+
};
|
|
3251
|
+
Stream.prototype.first = function () {
|
|
3252
|
+
this.reset();
|
|
3253
|
+
return this.value && this.value.length ? Monad_1.Optional.fromNullable(this.value[0]) : Monad_1.Optional.absent;
|
|
3254
|
+
};
|
|
3255
|
+
Stream.prototype.last = function () {
|
|
3256
|
+
//could be done via reduce, but is faster this way
|
|
3257
|
+
var length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;
|
|
3258
|
+
this.reset();
|
|
3259
|
+
return Monad_1.Optional.fromNullable(length ? this.value[length - 1] : null);
|
|
3260
|
+
};
|
|
3261
|
+
Stream.prototype.anyMatch = function (fn) {
|
|
3262
|
+
for (var cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
|
|
3263
|
+
if (fn(this.value[cnt])) {
|
|
3264
|
+
return true;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
this.reset();
|
|
3268
|
+
return false;
|
|
3269
|
+
};
|
|
3270
|
+
Stream.prototype.allMatch = function (fn) {
|
|
3271
|
+
if (!this.value.length) {
|
|
3272
|
+
return false;
|
|
3273
|
+
}
|
|
3274
|
+
var matches = 0;
|
|
3275
|
+
for (var cnt = 0; cnt < this.value.length; cnt++) {
|
|
3276
|
+
if (fn(this.value[cnt])) {
|
|
3277
|
+
matches++;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
this.reset();
|
|
3281
|
+
return matches == this.value.length;
|
|
3282
|
+
};
|
|
3283
|
+
Stream.prototype.noneMatch = function (fn) {
|
|
3284
|
+
var matches = 0;
|
|
3285
|
+
for (var cnt = 0; cnt < this.value.length; cnt++) {
|
|
3286
|
+
if (!fn(this.value[cnt])) {
|
|
3287
|
+
matches++;
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
this.reset();
|
|
3291
|
+
return matches == this.value.length;
|
|
3292
|
+
};
|
|
3293
|
+
Stream.prototype.sort = function (comparator) {
|
|
3294
|
+
var newArr = this.value.slice().sort(comparator);
|
|
3295
|
+
return Stream.of.apply(Stream, newArr);
|
|
3296
|
+
};
|
|
3297
|
+
Stream.prototype.collect = function (collector) {
|
|
3298
|
+
this.each(function (data) { return collector.collect(data); });
|
|
3299
|
+
this.reset();
|
|
3300
|
+
return collector.finalValue;
|
|
3301
|
+
};
|
|
3302
|
+
//-- internally exposed methods needed for the interconnectivity
|
|
3303
|
+
Stream.prototype.hasNext = function () {
|
|
3304
|
+
var isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
|
|
3305
|
+
var isEndOfArray = this.pos >= this.value.length - 1;
|
|
3306
|
+
return !(isLimitsReached || isEndOfArray);
|
|
3307
|
+
};
|
|
3308
|
+
Stream.prototype.next = function () {
|
|
3309
|
+
if (!this.hasNext()) {
|
|
3310
|
+
return null;
|
|
3311
|
+
}
|
|
3312
|
+
this.pos++;
|
|
3313
|
+
return this.value[this.pos];
|
|
3314
|
+
};
|
|
3315
|
+
Stream.prototype.lookAhead = function (cnt) {
|
|
3316
|
+
if (cnt === void 0) { cnt = 1; }
|
|
3317
|
+
if ((this.pos + cnt) >= this.value.length) {
|
|
3318
|
+
return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
|
|
3319
|
+
}
|
|
3320
|
+
return this.value[this.pos + cnt];
|
|
3321
|
+
};
|
|
3322
|
+
Stream.prototype[Symbol.iterator] = function () {
|
|
3323
|
+
var _this = this;
|
|
3324
|
+
return {
|
|
3325
|
+
next: function () {
|
|
3326
|
+
var done = !_this.hasNext();
|
|
3327
|
+
var val = _this.next();
|
|
3328
|
+
return {
|
|
3329
|
+
done: done,
|
|
3330
|
+
value: val
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
};
|
|
3335
|
+
/*get observable(): Observable<T> {
|
|
3336
|
+
return from(this);
|
|
3337
|
+
}*/
|
|
3338
|
+
Stream.prototype.reset = function () {
|
|
3339
|
+
this.pos = -1;
|
|
3340
|
+
};
|
|
3341
|
+
return Stream;
|
|
3342
|
+
}());
|
|
3343
|
+
exports.Stream = Stream;
|
|
3344
|
+
/**
|
|
3345
|
+
* Lazy implementation of a Stream
|
|
3346
|
+
* The idea is to connect the intermediate
|
|
3347
|
+
* streams as datasources like a linked list
|
|
3348
|
+
* with reverse referencing and for special
|
|
3349
|
+
* operations like filtering flatmapping
|
|
3350
|
+
* have intermediate datasources in the list
|
|
3351
|
+
* with specialized functions.
|
|
3352
|
+
*
|
|
3353
|
+
* Sort of a modified pipe valve pattern
|
|
3354
|
+
* the streams are the pipes the intermediate
|
|
3355
|
+
* data sources are the valves
|
|
3356
|
+
*
|
|
3357
|
+
* We then can use passed in functions to control
|
|
3358
|
+
* the flow in the valves
|
|
3359
|
+
*
|
|
3360
|
+
* That way we can have a lazy evaluating stream
|
|
3361
|
+
*
|
|
3362
|
+
* So if an endpoint requests data
|
|
3363
|
+
* a callback trace goes back the stream list
|
|
3364
|
+
* which triggers an operation upwards
|
|
3365
|
+
* which sends data down the drain which then is processed
|
|
3366
|
+
* and filtered until one element hits the endpoint.
|
|
3367
|
+
*
|
|
3368
|
+
* That is repeated, until all elements are processed
|
|
3369
|
+
* or an internal limit is hit.
|
|
3370
|
+
*
|
|
3371
|
+
*/
|
|
3372
|
+
var LazyStream = /** @class */ (function () {
|
|
3373
|
+
function LazyStream(parent) {
|
|
3374
|
+
this._limits = -1;
|
|
3375
|
+
/*
|
|
3376
|
+
* needed to have the limits check working
|
|
3377
|
+
* we need to keep track of the current position
|
|
3378
|
+
* in the stream
|
|
3379
|
+
*/
|
|
3380
|
+
this.pos = -1;
|
|
3381
|
+
this.dataSource = parent;
|
|
3382
|
+
}
|
|
3383
|
+
LazyStream.of = function () {
|
|
3384
|
+
var values = [];
|
|
3385
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3386
|
+
values[_i] = arguments[_i];
|
|
3387
|
+
}
|
|
3388
|
+
return new LazyStream(new (SourcesCollectors_1.ArrayStreamDataSource.bind.apply(SourcesCollectors_1.ArrayStreamDataSource, __spreadArray([void 0], values, false)))());
|
|
3389
|
+
};
|
|
3390
|
+
LazyStream.ofAssoc = function (data) {
|
|
3391
|
+
return this.of.apply(this, Object.keys(data)).map(function (key) { return [key, data[key]]; });
|
|
3392
|
+
};
|
|
3393
|
+
LazyStream.ofStreamDataSource = function (value) {
|
|
3394
|
+
return new LazyStream(value);
|
|
3395
|
+
};
|
|
3396
|
+
LazyStream.prototype.hasNext = function () {
|
|
3397
|
+
if (this.isOverLimits()) {
|
|
3398
|
+
return false;
|
|
3399
|
+
}
|
|
3400
|
+
return this.dataSource.hasNext();
|
|
3401
|
+
};
|
|
3402
|
+
LazyStream.prototype.next = function () {
|
|
3403
|
+
var next = this.dataSource.next();
|
|
3404
|
+
// @ts-ignore
|
|
3405
|
+
this.pos++;
|
|
3406
|
+
return next;
|
|
3407
|
+
};
|
|
3408
|
+
LazyStream.prototype.lookAhead = function (cnt) {
|
|
3409
|
+
if (cnt === void 0) { cnt = 1; }
|
|
3410
|
+
return this.dataSource.lookAhead(cnt);
|
|
3411
|
+
};
|
|
3412
|
+
LazyStream.prototype.current = function () {
|
|
3413
|
+
return this.dataSource.current();
|
|
3414
|
+
};
|
|
3415
|
+
LazyStream.prototype.reset = function () {
|
|
3416
|
+
this.dataSource.reset();
|
|
3417
|
+
this.pos = -1;
|
|
3418
|
+
this._limits = -1;
|
|
3419
|
+
};
|
|
3420
|
+
/**
|
|
3421
|
+
* concat for streams, so that you can concat two streams together
|
|
3422
|
+
* @param toAppend
|
|
3423
|
+
*/
|
|
3424
|
+
LazyStream.prototype.concat = function () {
|
|
3425
|
+
var toAppend = [];
|
|
3426
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3427
|
+
toAppend[_i] = arguments[_i];
|
|
3428
|
+
}
|
|
3429
|
+
//this.dataSource = new MultiStreamDatasource<T>(this, ... toAppend);
|
|
3430
|
+
//return this;
|
|
3431
|
+
return LazyStream.of.apply(LazyStream, __spreadArray([this], toAppend, false)).flatMap(function (item) { return item; });
|
|
3432
|
+
};
|
|
3433
|
+
LazyStream.prototype.nextFilter = function (fn) {
|
|
3434
|
+
if (this.hasNext()) {
|
|
3435
|
+
var newVal = this.next();
|
|
3436
|
+
if (!fn(newVal)) {
|
|
3437
|
+
return this.nextFilter(fn);
|
|
3438
|
+
}
|
|
3439
|
+
return newVal;
|
|
3440
|
+
}
|
|
3441
|
+
return null;
|
|
3442
|
+
};
|
|
3443
|
+
LazyStream.prototype.limits = function (max) {
|
|
3444
|
+
this._limits = max;
|
|
3445
|
+
return this;
|
|
3446
|
+
};
|
|
3447
|
+
//main stream methods
|
|
3448
|
+
LazyStream.prototype.collect = function (collector) {
|
|
3449
|
+
while (this.hasNext()) {
|
|
3450
|
+
var t = this.next();
|
|
3451
|
+
collector.collect(t);
|
|
3452
|
+
}
|
|
3453
|
+
this.reset();
|
|
3454
|
+
return collector.finalValue;
|
|
3455
|
+
};
|
|
3456
|
+
LazyStream.prototype.onElem = function (fn) {
|
|
3457
|
+
var _this = this;
|
|
3458
|
+
return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource(function (el) {
|
|
3459
|
+
if (fn(el, _this.pos) === false) {
|
|
3460
|
+
_this.stop();
|
|
3461
|
+
}
|
|
3462
|
+
return el;
|
|
3463
|
+
}, this));
|
|
3464
|
+
};
|
|
3465
|
+
LazyStream.prototype.filter = function (fn) {
|
|
3466
|
+
return new LazyStream(new SourcesCollectors_1.FilteredStreamDatasource(fn, this));
|
|
3467
|
+
};
|
|
3468
|
+
LazyStream.prototype.map = function (fn) {
|
|
3469
|
+
return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource(fn, this));
|
|
3470
|
+
};
|
|
3471
|
+
LazyStream.prototype.flatMap = function (fn) {
|
|
3472
|
+
return new LazyStream(new SourcesCollectors_1.FlatMapStreamDataSource(fn, this));
|
|
3473
|
+
};
|
|
3474
|
+
//endpoint
|
|
3475
|
+
LazyStream.prototype.each = function (fn) {
|
|
3476
|
+
while (this.hasNext()) {
|
|
3477
|
+
if (fn(this.next()) === false) {
|
|
3478
|
+
this.stop();
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
this.reset();
|
|
3482
|
+
};
|
|
3483
|
+
LazyStream.prototype.reduce = function (fn, startVal) {
|
|
3484
|
+
if (startVal === void 0) { startVal = null; }
|
|
3485
|
+
if (!this.hasNext()) {
|
|
3486
|
+
return Monad_1.Optional.absent;
|
|
3487
|
+
}
|
|
3488
|
+
var value1;
|
|
3489
|
+
var value2 = null;
|
|
3490
|
+
if (startVal != null) {
|
|
3491
|
+
value1 = startVal;
|
|
3492
|
+
value2 = this.next();
|
|
3493
|
+
}
|
|
3494
|
+
else {
|
|
3495
|
+
value1 = this.next();
|
|
3496
|
+
if (!this.hasNext()) {
|
|
3497
|
+
return Monad_1.Optional.fromNullable(value1);
|
|
3498
|
+
}
|
|
3499
|
+
value2 = this.next();
|
|
3500
|
+
}
|
|
3501
|
+
value1 = fn(value1, value2);
|
|
3502
|
+
while (this.hasNext()) {
|
|
3503
|
+
value2 = this.next();
|
|
3504
|
+
value1 = fn(value1, value2);
|
|
3505
|
+
}
|
|
3506
|
+
this.reset();
|
|
3507
|
+
return Monad_1.Optional.fromNullable(value1);
|
|
3508
|
+
};
|
|
3509
|
+
LazyStream.prototype.last = function () {
|
|
3510
|
+
if (!this.hasNext()) {
|
|
3511
|
+
return Monad_1.Optional.absent;
|
|
3512
|
+
}
|
|
3513
|
+
return this.reduce(function (el1, el2) { return el2; });
|
|
3514
|
+
};
|
|
3515
|
+
LazyStream.prototype.first = function () {
|
|
3516
|
+
this.reset();
|
|
3517
|
+
if (!this.hasNext()) {
|
|
3518
|
+
return Monad_1.Optional.absent;
|
|
3519
|
+
}
|
|
3520
|
+
return Monad_1.Optional.fromNullable(this.next());
|
|
3521
|
+
};
|
|
3522
|
+
LazyStream.prototype.anyMatch = function (fn) {
|
|
3523
|
+
while (this.hasNext()) {
|
|
3524
|
+
if (fn(this.next())) {
|
|
3525
|
+
return true;
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return false;
|
|
3529
|
+
};
|
|
3530
|
+
LazyStream.prototype.allMatch = function (fn) {
|
|
3531
|
+
while (this.hasNext()) {
|
|
3532
|
+
if (!fn(this.next())) {
|
|
3533
|
+
return false;
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
return true;
|
|
3537
|
+
};
|
|
3538
|
+
LazyStream.prototype.noneMatch = function (fn) {
|
|
3539
|
+
while (this.hasNext()) {
|
|
3540
|
+
if (fn(this.next())) {
|
|
3541
|
+
return false;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
return true;
|
|
3545
|
+
};
|
|
3546
|
+
LazyStream.prototype.sort = function (comparator) {
|
|
3547
|
+
var arr = this.collect(new SourcesCollectors_1.ArrayCollector());
|
|
3548
|
+
arr = arr.sort(comparator);
|
|
3549
|
+
return LazyStream.of.apply(LazyStream, arr);
|
|
3550
|
+
};
|
|
3551
|
+
Object.defineProperty(LazyStream.prototype, "value", {
|
|
3552
|
+
get: function () {
|
|
3553
|
+
return this.collect(new SourcesCollectors_1.ArrayCollector());
|
|
3554
|
+
},
|
|
3555
|
+
enumerable: false,
|
|
3556
|
+
configurable: true
|
|
3557
|
+
});
|
|
3558
|
+
LazyStream.prototype[Symbol.iterator] = function () {
|
|
3559
|
+
var _this = this;
|
|
3560
|
+
return {
|
|
3561
|
+
next: function () {
|
|
3562
|
+
var done = !_this.hasNext();
|
|
3563
|
+
var val = _this.next();
|
|
3564
|
+
return {
|
|
3565
|
+
done: done,
|
|
3566
|
+
value: val
|
|
3567
|
+
};
|
|
3568
|
+
}
|
|
3569
|
+
};
|
|
3570
|
+
};
|
|
3571
|
+
/*get observable(): Observable<T> {
|
|
3572
|
+
return from(this);
|
|
3573
|
+
}*/
|
|
3574
|
+
LazyStream.prototype.stop = function () {
|
|
3575
|
+
this.pos = this._limits + 1000000000;
|
|
3576
|
+
this._limits = 0;
|
|
3577
|
+
};
|
|
3578
|
+
LazyStream.prototype.isOverLimits = function () {
|
|
3579
|
+
return this._limits != -1 && this.pos >= this._limits - 1;
|
|
3580
|
+
};
|
|
3581
|
+
return LazyStream;
|
|
3582
|
+
}());
|
|
3583
|
+
exports.LazyStream = LazyStream;
|
|
3584
|
+
|
|
3585
|
+
|
|
3586
|
+
/***/ }),
|
|
3587
|
+
|
|
3588
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts":
|
|
3589
|
+
/*!****************************************************************!*\
|
|
3590
|
+
!*** ./node_modules/mona-dish/src/main/typescript/XmlQuery.ts ***!
|
|
3591
|
+
\****************************************************************/
|
|
3592
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3596
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3597
|
+
* this work for additional information regarding copyright ownership.
|
|
3598
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
3599
|
+
* (the "License"); you may not use this file except in compliance with
|
|
3600
|
+
* the License. You may obtain a copy of the License at
|
|
3601
|
+
*
|
|
3602
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3603
|
+
*
|
|
3604
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3605
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3606
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3607
|
+
* See the License for the specific language governing permissions and
|
|
3608
|
+
* limitations under the License.
|
|
3609
|
+
*/
|
|
3610
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3611
|
+
var extendStatics = function (d, b) {
|
|
3612
|
+
extendStatics = Object.setPrototypeOf ||
|
|
3613
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3614
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
3615
|
+
return extendStatics(d, b);
|
|
3616
|
+
};
|
|
3617
|
+
return function (d, b) {
|
|
3618
|
+
if (typeof b !== "function" && b !== null)
|
|
3619
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3620
|
+
extendStatics(d, b);
|
|
3621
|
+
function __() { this.constructor = d; }
|
|
3622
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3623
|
+
};
|
|
3624
|
+
})();
|
|
3625
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3626
|
+
exports.XQ = exports.XMLQuery = void 0;
|
|
3627
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3628
|
+
var DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
|
|
3629
|
+
var isString = Lang_1.Lang.isString;
|
|
3630
|
+
/**
|
|
3631
|
+
* xml query as specialized case for DomQuery
|
|
3632
|
+
*/
|
|
3633
|
+
var XMLQuery = /** @class */ (function (_super) {
|
|
3634
|
+
__extends(XMLQuery, _super);
|
|
3635
|
+
function XMLQuery(rootNode, docType) {
|
|
3636
|
+
if (docType === void 0) { docType = "text/xml"; }
|
|
3637
|
+
var _this = this;
|
|
3638
|
+
var createIe11DomQueryShim = function () {
|
|
3639
|
+
//at the time if wroting ie11 is the only relevant browser
|
|
3640
|
+
//left withut any DomQuery support
|
|
3641
|
+
var parser = new ActiveXObject("Microsoft.XMLDOM");
|
|
3642
|
+
parser.async = false;
|
|
3643
|
+
//we shim th dom parser from ie in
|
|
3644
|
+
return {
|
|
3645
|
+
parseFromString: function (text, contentType) {
|
|
3646
|
+
return parser.loadXML(text);
|
|
3647
|
+
}
|
|
3648
|
+
};
|
|
3649
|
+
};
|
|
3650
|
+
var parseXML = function (xml) {
|
|
3651
|
+
if (xml == null) {
|
|
3652
|
+
return null;
|
|
3653
|
+
}
|
|
3654
|
+
var domParser = Lang_1.Lang.saveResolveLazy(function () { return new window.DOMParser(); }, function () { return createIe11DomQueryShim(); }).value;
|
|
3655
|
+
return domParser.parseFromString(xml, docType);
|
|
3656
|
+
};
|
|
3657
|
+
if (isString(rootNode)) {
|
|
3658
|
+
_this = _super.call(this, parseXML(rootNode)) || this;
|
|
3659
|
+
}
|
|
3660
|
+
else {
|
|
3661
|
+
_this = _super.call(this, rootNode) || this;
|
|
3662
|
+
}
|
|
3663
|
+
return _this;
|
|
3664
|
+
}
|
|
3665
|
+
XMLQuery.prototype.isXMLParserError = function () {
|
|
3666
|
+
return this.querySelectorAll("parsererror").isPresent();
|
|
3667
|
+
};
|
|
3668
|
+
XMLQuery.prototype.toString = function () {
|
|
3669
|
+
var ret = [];
|
|
3670
|
+
this.eachElem(function (node) {
|
|
3671
|
+
var _a, _b, _c;
|
|
3672
|
+
var serialized = (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.XMLSerializer) === null || _a === void 0 ? void 0 : _a.constructor()) === null || _b === void 0 ? void 0 : _b.serializeToString(node)) !== null && _c !== void 0 ? _c : node === null || node === void 0 ? void 0 : node.xml;
|
|
3673
|
+
if (!!serialized) {
|
|
3674
|
+
ret.push(serialized);
|
|
3675
|
+
}
|
|
3676
|
+
});
|
|
3677
|
+
return ret.join("");
|
|
3678
|
+
};
|
|
3679
|
+
XMLQuery.prototype.parserErrorText = function (joinstr) {
|
|
3680
|
+
return this.querySelectorAll("parsererror").textContent(joinstr);
|
|
3681
|
+
};
|
|
3682
|
+
XMLQuery.parseXML = function (txt) {
|
|
3683
|
+
return new XMLQuery(txt);
|
|
3684
|
+
};
|
|
3685
|
+
XMLQuery.parseHTML = function (txt) {
|
|
3686
|
+
return new XMLQuery(txt, "text/html");
|
|
3687
|
+
};
|
|
3688
|
+
XMLQuery.fromString = function (txt, parseType) {
|
|
3689
|
+
if (parseType === void 0) { parseType = "text/xml"; }
|
|
3690
|
+
return new XMLQuery(txt, parseType);
|
|
3691
|
+
};
|
|
3692
|
+
return XMLQuery;
|
|
3693
|
+
}(DomQuery_1.DomQuery));
|
|
3694
|
+
exports.XMLQuery = XMLQuery;
|
|
3695
|
+
exports.XQ = XMLQuery;
|
|
3696
|
+
|
|
3697
|
+
|
|
3698
|
+
/***/ }),
|
|
3699
|
+
|
|
3700
|
+
/***/ "./node_modules/mona-dish/src/main/typescript/index_core.ts":
|
|
3701
|
+
/*!******************************************************************!*\
|
|
3702
|
+
!*** ./node_modules/mona-dish/src/main/typescript/index_core.ts ***!
|
|
3703
|
+
\******************************************************************/
|
|
3704
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3708
|
+
exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Config = exports.Lang = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
|
|
3709
|
+
var DomQuery_1 = __webpack_require__(/*! ./DomQuery */ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts");
|
|
3710
|
+
Object.defineProperty(exports, "DomQuery", ({ enumerable: true, get: function () { return DomQuery_1.DomQuery; } }));
|
|
3711
|
+
Object.defineProperty(exports, "ElementAttribute", ({ enumerable: true, get: function () { return DomQuery_1.ElementAttribute; } }));
|
|
3712
|
+
Object.defineProperty(exports, "DomQueryCollector", ({ enumerable: true, get: function () { return DomQuery_1.DomQueryCollector; } }));
|
|
3713
|
+
Object.defineProperty(exports, "DQ", ({ enumerable: true, get: function () { return DomQuery_1.DQ; } }));
|
|
3714
|
+
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3715
|
+
Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
|
|
3716
|
+
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
3717
|
+
Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
|
|
3718
|
+
Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
|
|
3719
|
+
Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
|
|
3720
|
+
Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
|
|
3721
|
+
var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
|
|
3722
|
+
Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
|
|
3723
|
+
Object.defineProperty(exports, "XQ", ({ enumerable: true, get: function () { return XmlQuery_1.XQ; } }));
|
|
3724
|
+
var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
|
|
3725
|
+
Object.defineProperty(exports, "Stream", ({ enumerable: true, get: function () { return Stream_1.Stream; } }));
|
|
3726
|
+
Object.defineProperty(exports, "LazyStream", ({ enumerable: true, get: function () { return Stream_1.LazyStream; } }));
|
|
3727
|
+
var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
|
|
3728
|
+
Object.defineProperty(exports, "ArrayStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayStreamDataSource; } }));
|
|
3729
|
+
Object.defineProperty(exports, "MappedStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.MappedStreamDataSource; } }));
|
|
3730
|
+
Object.defineProperty(exports, "FilteredStreamDatasource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FilteredStreamDatasource; } }));
|
|
3731
|
+
Object.defineProperty(exports, "FlatMapStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FlatMapStreamDataSource; } }));
|
|
3732
|
+
Object.defineProperty(exports, "SequenceDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.SequenceDataSource; } }));
|
|
3733
|
+
Object.defineProperty(exports, "QueryFormStringCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormStringCollector; } }));
|
|
3734
|
+
Object.defineProperty(exports, "ArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayCollector; } }));
|
|
3735
|
+
Object.defineProperty(exports, "AssocArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.AssocArrayCollector; } }));
|
|
3736
|
+
Object.defineProperty(exports, "FormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.FormDataCollector; } }));
|
|
3737
|
+
Object.defineProperty(exports, "QueryFormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormDataCollector; } }));
|
|
9
3738
|
|
|
10
|
-
!function(){"use strict";var t={585:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function l(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,l)}u((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.DQ=e.DomQueryCollector=e.DomQuery=e.ElementAttribute=void 0;var f,p=r(152),h=r(551),y=r(255),v=r(805),d=v.Lang.trim,m=v.Lang.objToArray,b=v.Lang.isString,g=v.Lang.equalsIgnoreCase;function S(t,e,r){return void 0===r&&(r={attributes:!0,childList:!0,subtree:!0,timeout:500,interval:100}),new Promise((function(n,o){var a=new Error("Mutation observer timeout");if(void 0!==window.MutationObserver){var l=setTimeout((function(){return o(a)}),r.timeout),u=new window.MutationObserver((function(t,r){var o=new x(t.map((function(t){return t.target}))).first(e);o.isPresent()&&(clearTimeout(l),n(o))})),s=i({},r);delete s.timeout,t.eachElem((function(t){u.observe(t,s)}))}else var c=setInterval((function(){var o=null;(o=r.childList?e(t)?t:t.childNodes.first(e):r.subtree?e(t)?t:t.querySelectorAll(" * ").first(e):e(t)?t:x.absent).isPresent()&&f&&(clearTimeout(f),clearInterval(c),c=null,n(o))}),r.interval),f=setTimeout((function(){c&&(clearInterval(c),o(a))}),r.timeout)}))}!function(t){t.SELECT="select",t.BUTTON="button",t.SUBMIT="submit",t.RESET="reset",t.IMAGE="image",t.RADIO="radio",t.CHECKBOX="checkbox"}(f||(f={}));var A=function(t){function e(e,r,n){void 0===n&&(n=null);var o=t.call(this,e,r)||this;return o.element=e,o.name=r,o.defaultVal=n,o}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){var t,e=(t=this.element.get(0)).orElse.apply(t,[]).values;return e.length?e[0].getAttribute(this.name):this.defaultVal},set:function(t){for(var e,r=(e=this.element.get(0)).orElse.apply(e,[]).values,n=0;n<r.length;n++)r[n].setAttribute(this.name,t);r[0].setAttribute(this.name,t)},enumerable:!1,configurable:!0}),e.prototype.getClass=function(){return e},e.fromNullable=function(t,r){return void 0===r&&(r="value"),new e(t,r)},e}(p.ValueEmbedder);e.ElementAttribute=A;var w=function(t){return!0},x=function(){function t(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(this.rootNode=[],this.pos=-1,this._limits=-1,!p.Optional.fromNullable(r).isAbsent()&&r.length)for(var o=0;o<r.length;o++)if(r[o])if(b(r[o])){var i=t.querySelectorAll(r[o]);i.isAbsent()||r.push.apply(r,s([],u(i.values),!1))}else r[o]instanceof t?(e=this.rootNode).push.apply(e,s([],u(r[o].values),!1)):this.rootNode.push(r[o])}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getAsElem(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this.allElems()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return new A(this.get(0),"id")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.rootNode.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.getAsElem(0).getIf("tagName")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return this.getAsElem(0).getIf("nodeName")},enumerable:!1,configurable:!0}),t.prototype.isTag=function(t){return!this.isAbsent()&&(this.nodeName.orElse("__none___").value.toLowerCase()==t.toLowerCase()||this.tagName.orElse("__none___").value.toLowerCase()==t.toLowerCase())},Object.defineProperty(t.prototype,"type",{get:function(){return this.getAsElem(0).getIf("type")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return new p.ValueEmbedder(this.getAsElem(0).value,"name")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputValue",{get:function(){return this.getAsElem(0).getIf("value").isPresent()?new p.ValueEmbedder(this.getAsElem(0).value):p.ValueEmbedder.absent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checked",{get:function(){return h.Stream.of.apply(h.Stream,s([],u(this.values),!1)).allMatch((function(t){return!!t.checked}))},set:function(t){this.eachElem((function(e){return e.checked=t}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"elements",{get:function(){return this.querySelectorAll("input, checkbox, select, textarea, fieldset")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deepElements",{get:function(){return this.querySelectorAllDeep("input, select, textarea, checkbox, fieldset")},enumerable:!1,configurable:!0}),t.prototype.querySelectorAllDeep=function(e){var r=[],n=this.querySelectorAll(e);n.length&&r.push(n);var o=this.querySelectorAll("*").shadowRoot;if(o.length){var i=o.querySelectorAllDeep(e);i.length&&r.push(i)}return new(t.bind.apply(t,s([void 0],u(r),!1)))},Object.defineProperty(t.prototype,"disabled",{get:function(){return this.attr("disabled").isPresent()},set:function(t){t?this.attr("disabled").value="disabled":this.removeAttribute("disabled")},enumerable:!1,configurable:!0}),t.prototype.removeAttribute=function(t){this.eachElem((function(e){return e.removeAttribute(t)}))},Object.defineProperty(t.prototype,"childNodes",{get:function(){var e=[];return this.eachElem((function(t){e=e.concat(m(t.childNodes))})),new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stream",{get:function(){return new(h.Stream.bind.apply(h.Stream,s([void 0],u(this.asArray),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lazyStream",{get:function(){return h.LazyStream.of.apply(h.LazyStream,s([],u(this.asArray),!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asArray",{get:function(){return[].concat(h.LazyStream.of.apply(h.LazyStream,s([],u(this.rootNode),!1)).filter((function(t){return null!=t})).map((function(e){return t.byId(e)})).collect(new y.ArrayCollector))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asNodeArray",{get:function(){return[].concat(h.Stream.of(this.rootNode).filter((function(t){return null!=t})).collect(new y.ArrayCollector))},enumerable:!1,configurable:!0}),t.querySelectorAllDeep=function(e){return new t(document).querySelectorAllDeep(e)},t.querySelectorAll=function(e){return-1!=e.indexOf("/shadow/")?new t(document)._querySelectorAllDeep(e):new t(document)._querySelectorAll(e)},t.byId=function(e,r){return void 0===r&&(r=!1),b(e)?r?new t(document).byIdDeep(e):new t(document).byId(e):new t(e)},t.byTagName=function(e){return b(e)?new t(document).byTagName(e):new t(e)},t.globalEval=function(e,r){return new t(document).globalEval(e,r)},t.fromMarkup=function(e){var r=document.implementation.createHTMLDocument(""),n=(e=d(e)).toLowerCase();if(-1!=n.indexOf("<!doctype")||-1!=n.indexOf("<html")||-1!=n.indexOf("<head")||-1!=n.indexOf("<body"))return r.documentElement.innerHTML=e,new t(r.documentElement);var o=function(t,e){var r=["<",e,">"].join(""),n=["<",e," "].join("");return 0==t.indexOf(r)||0==t.indexOf(n)},i=new t(document.createElement("div"));return o(n,"thead")||o(n,"tbody")?(i.html("<table>".concat(e,"</table>")),i.querySelectorAll("table").get(0).childNodes.detach()):o(n,"tfoot")?(i.html("<table><thead></thead><tbody><tbody".concat(e,"</table>")),i.querySelectorAll("table").get(2).childNodes.detach()):o(n,"tr")?(i.html("<table><tbody>".concat(e,"</tbody></table>")),i.querySelectorAll("tbody").get(0).childNodes.detach()):o(n,"td")?(i.html("<table><tbody><tr>".concat(e,"</tr></tbody></table>")),i.querySelectorAll("tr").get(0).childNodes.detach()):(i.html(e),i.childNodes.detach())},t.prototype.get=function(e){return e<this.rootNode.length?new t(this.rootNode[e]):t.absent},t.prototype.getAsElem=function(t,e){return void 0===e&&(e=p.Optional.absent),t<this.rootNode.length?p.Optional.fromNullable(this.rootNode[t]):e},t.prototype.filesFromElem=function(t){var e;return t<this.rootNode.length&&(null===(e=this.rootNode[t])||void 0===e?void 0:e.files)?this.rootNode[t].files:[]},t.prototype.allElems=function(){return this.rootNode},t.prototype.isAbsent=function(){return 0==this.length},t.prototype.isPresent=function(t){var e=this.isAbsent();return!e&&t&&t.call(this,this),!e},t.prototype.ifPresentLazy=function(t){return void 0===t&&(t=function(){}),this.isPresent.call(this,t),this},t.prototype.delete=function(){this.eachElem((function(t){t.parentNode&&t.parentNode.removeChild(t)}))},t.prototype.querySelectorAll=function(t){return-1!=t.indexOf("/shadow/")?this._querySelectorAllDeep(t):this._querySelectorAll(t)},t.prototype._querySelectorAll=function(e){var r,n;if(!(null===(r=null==this?void 0:this.rootNode)||void 0===r?void 0:r.length))return this;for(var o=[],i=0;i<this.rootNode.length;i++)if(null===(n=this.rootNode[i])||void 0===n?void 0:n.querySelectorAll){var a=this.rootNode[i].querySelectorAll(e);o=o.concat(m(a))}return new(t.bind.apply(t,s([void 0],u(o),!1)))},t.prototype._querySelectorAllDeep=function(e){var r;if(!(null===(r=null==this?void 0:this.rootNode)||void 0===r?void 0:r.length))return this;for(var n=new(t.bind.apply(t,s([void 0],u(this.rootNode),!1))),o=e.split(/\/shadow\//),i=0;i<o.length;i++)if(""!=o[i]){var a=o[i];n=n.querySelectorAll(a),i<o.length-1&&(n=n.shadowRoot)}return n},t.prototype.byId=function(e,r){var n=[];return r&&(n=n.concat(h.LazyStream.of.apply(h.LazyStream,s([],u((null==this?void 0:this.rootNode)||[]),!1)).filter((function(t){return e==t.id})).map((function(e){return new t(e)})).collect(new y.ArrayCollector))),n=n.concat(this.querySelectorAll('[id="'.concat(e,'"]'))),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.byIdDeep=function(e,r){var n=[];r&&(n=n.concat(h.LazyStream.of.apply(h.LazyStream,s([],u((null==this?void 0:this.rootNode)||[]),!1)).filter((function(t){return e==t.id})).map((function(e){return new t(e)})).collect(new y.ArrayCollector)));var o=this.querySelectorAllDeep('[id="'.concat(e,'"]'));return o.length&&n.push(o),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.byTagName=function(e,r,n){var o,i=[];return r&&(i=h.LazyStream.of.apply(h.LazyStream,s([],u(null!==(o=null==this?void 0:this.rootNode)&&void 0!==o?o:[]),!1)).filter((function(t){return(null==t?void 0:t.tagName)==e})).reduce((function(t,e){return t.concat([e])}),i).orElse(i).value),n?i.push(this.querySelectorAllDeep(e)):i.push(this.querySelectorAll(e)),new(t.bind.apply(t,s([void 0],u(i),!1)))},t.prototype.attr=function(t,e){return void 0===e&&(e=null),new A(this,t,e)},t.prototype.hasClass=function(t){var e=!1;return this.eachElem((function(r){if(e=r.classList.contains(t))return!1})),e},t.prototype.addClass=function(t){return this.eachElem((function(e){return e.classList.add(t)})),this},t.prototype.removeClass=function(t){return this.eachElem((function(e){return e.classList.remove(t)})),this},t.prototype.isMultipartCandidate=function(t){var e=this;void 0===t&&(t=!1);return this.stream.filter((function(r){return function(r){var n;return 0!=r.length&&(1==r.length?"input"==r.tagName.get("booga").value.toLowerCase()&&"file"==((null===(n=r.attr("type"))||void 0===n?void 0:n.value)||"").toLowerCase()||(t?e.querySelectorAllDeep("input[type='file']").firstElem().isPresent():e.querySelectorAll("input[type='file']").firstElem().isPresent()):r.isMultipartCandidate(t))}(r)})).first().isPresent()},t.prototype.html=function(t){return p.Optional.fromNullable(t).isAbsent()?this.isPresent()?p.Optional.fromNullable(this.innerHtml):p.Optional.absent:(this.innerHtml=t,this)},t.prototype.dispatchEvent=function(t){return this.eachElem((function(e){return e.dispatchEvent(t)})),this},Object.defineProperty(t.prototype,"innerHtml",{get:function(){var t=[];return this.eachElem((function(e){return t.push(e.innerHTML)})),t.join("")},set:function(t){this.eachElem((function(e){return e.innerHTML=t}))},enumerable:!1,configurable:!0}),t.prototype._mozMatchesSelector=function(t,e){var r=t,n=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector||function(e){for(var r=(document||window.ownerDocument).querySelectorAll(e),n=r.length;--n>=0&&r.item(n)!==t;);return n>-1};return n.call(t,e)},t.prototype.filterSelector=function(e){var r=this,n=[];return this.eachElem((function(t){r._mozMatchesSelector(t,e)&&n.push(t)})),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.matchesSelector=function(t){var e=this;return this.eachElem((function(r){if(!e._mozMatchesSelector(r,t))return!1})),!0},t.prototype.getIf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this.childNodes,n=0;n<t.length;n++)if((r=r.filterSelector(t[n])).isAbsent())return r;return r},t.prototype.eachElem=function(t){for(var e=0,r=this.rootNode.length;e<r&&!1!==t(this.rootNode[e],e);e++);return this},t.prototype.firstElem=function(t){return void 0===t&&(t=function(t){return t}),this.rootNode.length>1&&t(this.rootNode[0],0),this},t.prototype.each=function(e){return h.Stream.of.apply(h.Stream,s([],u(this.rootNode),!1)).each((function(r,n){if(null!=r)return e(t.byId(r),n)})),this},t.prototype.first=function(t){return void 0===t&&(t=function(t){return t}),this.rootNode.length>=1?(t(this.get(0),0),this.get(0)):this},t.prototype.filter=function(e){var r=[];return this.each((function(t){e(t)&&r.push(t)})),new(t.bind.apply(t,s([void 0],u(r),!1)))},t.prototype.globalEval=function(t,e){var r=document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("script");e&&n.setAttribute("nonce",e),n.type="text/javascript",n.innerHTML=t;var o=r.appendChild(n);return r.removeChild(o),this},t.prototype.detach=function(){return this.eachElem((function(t){t.parentNode.removeChild(t)})),this},t.prototype.appendTo=function(t){this.eachElem((function(e){t.getAsElem(0).orElseLazy((function(){return{appendChild:function(t){}}})).value.appendChild(e)}))},t.prototype.loadScriptEval=function(t,e,r){var n=this;void 0===e&&(e=0),void 0===r&&(r="utf-8");var o=new XMLHttpRequest;return o.open("GET",t,!1),r&&o.setRequestHeader("Content-Type","application/x-javascript; charset:"+r),o.send(null),o.onload=function(r){e?setTimeout((function(){n.globalEval(o.responseText+"\r\n//@ sourceURL="+t)}),e):n.globalEval(o.responseText.replace(/\n/g,"\r\n")+"\r\n//@ sourceURL="+t)},o.onerror=function(t){throw Error(t)},this},t.prototype.insertAfter=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.each((function(t){for(var r=t.getAsElem(0).value,n=r.parentNode,o=function(t){var o=r.nextSibling;e[t].eachElem((function(t){o?(n.insertBefore(t,o),r=o):n.appendChild(t)}))},i=0;i<e.length;i++)o(i)}));var n=[];return n.push(this),n=n.concat(e),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.insertBefore=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.each((function(t){for(var r=t.getAsElem(0).value,n=r.parentNode,o=0;o<e.length;o++)e[o].eachElem((function(t){n.insertBefore(t,r)}))}));var n=[];return n.push(this),n=n.concat(e),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.orElse=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.isPresent()?this:new(t.bind.apply(t,s([void 0],u(e),!1)))},t.prototype.orElseLazy=function(e){return this.isPresent()?this:new t(e())},t.prototype.parents=function(e){var r=new Set,n=[],o=e.toLowerCase(),i=function(t){(t.tagName||"").toLowerCase()!=o||r.has(t)||(r.add(t),n.push(t))};return this.eachElem((function(t){for(var r;t.parentNode||t.host;)if(t=null!==(r=null==t?void 0:t.parentNode)&&void 0!==r?r:null==t?void 0:t.host,i(t),"form"==e&&n.length)return!1})),new(t.bind.apply(t,s([void 0],u(n),!1)))},t.prototype.copyAttrs=function(t){var e=this;return t.eachElem((function(t){var r,n,o=m(t.attributes);try{for(var i=c(o),a=i.next();!a.done;a=i.next()){var l=a.value,u=l.value,s=l.name;switch(s){case"id":e.id.value=u;break;case"disabled":e.resolveAttributeHolder("disabled").disabled=u;break;case"checked":e.resolveAttributeHolder("checked").checked=u;break;default:e.attr(s).value=u}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}})),this},t.prototype.resolveAttributeHolder=function(t){void 0===t&&(t="value");var e=[];return e[t]=null,t in this.getAsElem(0).value?this.getAsElem(0).value:e},t.prototype.outerHTML=function(e,r,n,o){var i;if(void 0===o&&(o=!1),!this.isAbsent()){var a=null===(i=null===document||void 0===document?void 0:document.activeElement)||void 0===i?void 0:i.id,l=a?t.getCaretPosition(document.activeElement):null,c=t.fromMarkup(e),f=[],p=this.getAsElem(0).value,h=c.get(0),y=p.parentNode,v=h.getAsElem(0).value;if(y.replaceChild(v,p),f.push(new t(v)),this.isAbsent())return this;var d=[];c.length>1&&(d=d.concat.apply(d,s([],u(c.values.slice(1)),!1)),f.push(t.byId(v).insertAfter(new(t.bind.apply(t,s([void 0],u(d),!1)))))),r&&this.runScripts(),n&&this.runCss();var m=t.byId(a);return a&&m.isPresent()&&null!=l&&void 0!==l&&m.eachElem((function(e){return t.setCaretPosition(e,l)})),c}},t.prototype.runScripts=function(e){var r=this;void 0===e&&(e=w);var n=[],o=g,i=function(t){var i=t.tagName,a=t.type||"";if(i&&o(i,"script")&&(""===a||o(a,"text/javascript")||o(a,"javascript")||o(a,"text/ecmascript")||o(a,"ecmascript"))){var l=t.getAttribute("src");if(void 0!==l&&null!=l&&l.length>0)e(l)&&(n.length&&(r.globalEval(n.join("\n")),n=[]),r.loadScriptEval(l,0,"UTF-8"));else{for(var u=d(t.text||t.innerText||t.innerHTML),s=!0;s;)s=!1,"\x3c!--"==u.substring(0,4)&&(u=u.substring(4),s=!0),"//\x3c!--"==u.substring(0,4)&&(u=u.substring(6),s=!0),"//<![CDATA["==u.substring(0,11)&&(u=u.substring(11),s=!0);n.push(u)}}};try{new t(this.filterSelector("script"),this.querySelectorAll("script")).stream.flatMap((function(t){return h.Stream.of(t.values)})).sort((function(t,e){return t.compareDocumentPosition(e)-3})).each((function(t){return i(t)})),n.length&&this.globalEval(n.join("\n"))}catch(t){window.console&&window.console.error&&console.error(t.message||t.description)}finally{i=null}return this},t.prototype.runCss=function(){var e=function(t,e){var r,n,o,i,a=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(a);var l=null!==(r=a.sheet)&&void 0!==r?r:a.styleSheet;a.setAttribute("rel",null!==(n=t.getAttribute("rel"))&&void 0!==n?n:"stylesheet"),a.setAttribute("type",null!==(o=t.getAttribute("type"))&&void 0!==o?o:"text/css"),null!==(i=null==l?void 0:l.cssText)&&void 0!==i&&i?l.cssText=e:a.appendChild(document.createTextNode(e))};return new t(this.filterSelector("link, style"),this.querySelectorAll("link, style")).stream.flatMap((function(t){return h.Stream.of(t.values)})).sort((function(t,e){return t.compareDocumentPosition(e)-3})).each((function(t){return function(t){var r=t.tagName;if(r&&g(r,"link")&&g(t.getAttribute("type"),"text/css"))e(t,"@import url('"+t.getAttribute("href")+"');");else if(r&&g(r,"style")&&g(t.getAttribute("type"),"text/css")){var n=[],o=Array.prototype.slice.call(t.childNodes);o?o.forEach((function(t){return n.push(t.innerHTML||t.data)})):t.innerHTML&&n.push(t.innerHTML),e(t,n.join(""))}}(t)})),this},t.prototype.click=function(){return this.fireEvent("click"),this},t.prototype.addEventListener=function(t,e,r){return this.eachElem((function(n){return n.addEventListener(t,e,r)})),this},t.prototype.removeEventListener=function(t,e,r){return this.eachElem((function(n){return n.removeEventListener(t,e,r)})),this},t.prototype.fireEvent=function(t){this.eachElem((function(e){var r;if(e.ownerDocument)r=e.ownerDocument;else{if(9!=e.nodeType)throw new Error("Invalid node passed to fireEvent: "+e.id);r=e}if(e.dispatchEvent){var n="";switch(t){case"click":case"mousedown":case"mouseup":n="MouseEvents";break;case"focus":case"change":case"blur":case"select":n="HTMLEvents";break;default:throw"fireEvent: Couldn't find an event class for event '"+t+"'."}var o=r.createEvent(n);o.initEvent(t,!0,!0),o.synthetic=!0,e.dispatchEvent(o)}else if(e.fireEvent){var i=r.createEventObject();i.synthetic=!0,e.fireEvent("on"+t,i)}}))},t.prototype.textContent=function(t){return void 0===t&&(t=""),this.stream.map((function(t){return t.getAsElem(0).orElseLazy((function(){return{textContent:""}})).value.textContent||""})).reduce((function(e,r){return e+t+r}),"").value},t.prototype.innerText=function(t){return void 0===t&&(t=""),this.stream.map((function(t){return t.getAsElem(0).orElseLazy((function(){return{innerText:""}})).value.innerText||""})).reduce((function(e,r){return[e,r].join(t)}),"").value},t.prototype.encodeFormElement=function(t){if(void 0===t&&(t=new p.Config({})),!this.name.isAbsent()){var e=t.shallowCopy;return this.each((function(t){var r,n;if(!t.name.isAbsent()){var o=t.name.value,i=t.tagName.orElse("__none__").value.toLowerCase(),a=t.type.orElse("__none__").value.toLowerCase();if(a=a.toLowerCase(),("input"==i||"textarea"==i||"select"==i)&&null!=o&&""!=o&&!t.disabled){if("select"==i){var l=t.getAsElem(0).value;if(l.selectedIndex>=0)for(var u=l.options.length,s=0;s<u;s++)if(l.options[s].selected){var c=l.options[s];e.append(o).value=null!=c.getAttribute("value")?c.value:c.text}}if(i!=f.SELECT&&a!=f.BUTTON&&a!=f.RESET&&a!=f.SUBMIT&&a!=f.IMAGE&&(a!=f.CHECKBOX&&a!=f.RADIO||t.checked)){var p=null!==(n=null===(r=t.value.value)||void 0===r?void 0:r.files)&&void 0!==n?n:[];(null==p?void 0:p.length)?e.append(o).value=p[0]:e.append(o).value=t.inputValue.value}}}})),e}},Object.defineProperty(t.prototype,"cDATAAsString",{get:function(){return this.lazyStream.flatMap((function(t){return t.childNodes.stream})).filter((function(t){var e,r;return 4==(null===(r=null===(e=null==t?void 0:t.value)||void 0===e?void 0:e.value)||void 0===r?void 0:r.nodeType)})).reduce((function(t,e){var r,n,o;return t.push(null!==(o=null===(n=null===(r=null==e?void 0:e.value)||void 0===r?void 0:r.value)||void 0===n?void 0:n.data)&&void 0!==o?o:""),t}),[]).value.join("")},enumerable:!1,configurable:!0}),t.prototype.subNodes=function(e,r){return p.Optional.fromNullable(r).isAbsent()&&(r=this.length),new(t.bind.apply(t,s([void 0],u(this.rootNode.slice(e,Math.min(r,this.length))),!1)))},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.hasNext=function(){var t=-1!=this._limits&&this.pos>=this._limits-1,e=this.pos>=this.values.length-1;return!(t||e)},t.prototype.next=function(){return this.hasNext()?(this.pos++,new t(this.values[this.pos])):null},t.prototype.reset=function(){this.pos=-1},t.prototype.attachShadow=function(e){void 0===e&&(e={mode:"open"});var r=[];return this.eachElem((function(n){var o;if(!(null==n?void 0:n.attachShadow))throw new Error("Shadow dom creation not supported by the browser, please use a shim, to gain this functionality");o=t.byId(n.attachShadow(e)),r.push(o)})),new(t.bind.apply(t,s([void 0],u(r),!1)))},t.prototype.waitUntilDom=function(t,e){return void 0===e&&(e={attributes:!0,childList:!0,subtree:!0,timeout:500,interval:100}),a(this,void 0,void 0,(function(){return l(this,(function(r){return[2,S(this,t,e)]}))}))},Object.defineProperty(t.prototype,"shadowElements",{get:function(){var e=(this.querySelectorAll("*").filter((function(t){return t.hasShadow})).allElems()||[]).map((function(t){return t.shadowRoot}));return new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowRoot",{get:function(){for(var e=[],r=0;r<this.rootNode.length;r++)this.rootNode[r].shadowRoot&&e.push(this.rootNode[r].shadowRoot);return new(t.bind.apply(t,s([void 0],u(e),!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasShadow",{get:function(){for(var t=0;t<this.rootNode.length;t++)if(this.rootNode[t].shadowRoot)return!0;return!1},enumerable:!1,configurable:!0}),t.getCaretPosition=function(t){var e=0;try{if(null===document||void 0===document?void 0:document.selection){t.focus();var r=document.selection.createRange();r.moveStart("character",-t.value.length),e=r.text.length}}catch(t){}return e},t.setCaretPosition=function(t,e){(null==t?void 0:t.focus)&&(null==t||t.focus()),(null==t?void 0:t.setSelectiongRange)&&(null==t||t.setSelectiongRange(e,e))},t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.absent=new t,t}();e.DomQuery=x;var E=function(){function t(){this.data=[]}return t.prototype.collect=function(t){this.data.push(t)},Object.defineProperty(t.prototype,"finalValue",{get:function(){return new(x.bind.apply(x,s([void 0],u(this.data),!1)))},enumerable:!1,configurable:!0}),t}();e.DomQueryCollector=E,e.DQ=x},805:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Lang=void 0;var n=r(152);!function(t){function e(t){for(var e=/\s/,r=(t=t.replace(/^\s\s*/,"")).length;e.test(t.charAt(--r)););return t.slice(0,r+1)}function r(t){return!!arguments.length&&null!=t&&("string"==typeof t||t instanceof String)}t.saveResolve=function(t,e){void 0===e&&(e=null);try{var r=t();return n.Optional.fromNullable(null!=r?r:e)}catch(t){return n.Optional.absent}},t.saveResolveLazy=function(t,e){void 0===e&&(e=null);try{var r=t();return n.Optional.fromNullable(null!=r?r:e())}catch(t){return n.Optional.absent}},t.strToArray=function(t,r){void 0===r&&(r=/\./gi);var n=[];return t.split(r).forEach((function(t){n.push(e(t))})),n},t.trim=e,t.objToArray=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=[]),"__undefined__"==(null!=t?t:"__undefined__")?null!=r?r:null:t instanceof Array&&!e&&!r?t:r.concat(Array.prototype.slice.call(t,e))},t.equalsIgnoreCase=function(t,e){var r=null!=e?e:"___no_value__";return(null!=t?t:"___no_value__").toLowerCase()===r.toLowerCase()},t.assertType=function(t,e){return r(e)?typeof t==e:t instanceof e},t.isString=r,t.isFunc=function(t){return t instanceof Function||"function"==typeof t},t.objAssign=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(null==t)throw new TypeError("Cannot convert undefined or null to object");var n=Object(t);return Object.assign?(e.forEach((function(t){return Object.assign(n,t)})),n):(e.filter((function(t){return null!=t})).forEach((function(t){var e=t;Object.keys(e).filter((function(t){return Object.prototype.hasOwnProperty.call(e,t)})).forEach((function(t){return n[t]=e[t]}))})),n)}}(e.Lang||(e.Lang={}))},152:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.Config=e.ValueEmbedder=e.Optional=e.Monad=void 0;var l=r(805),u=r(255),s=r(551),c=l.Lang.objAssign,f=function(){function t(t){this._value=t}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.map=function(e){return e||(e=function(t){return t}),new t(e(this.value))},t.prototype.flatMap=function(e){for(var r=this.map(e);(null==r?void 0:r.value)instanceof t;)r=r.value;return r},t}();e.Monad=f;var p=function(t){function e(e){return t.call(this,e)||this}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value instanceof f?this._value.flatMap().value:this._value},enumerable:!1,configurable:!0}),e.fromNullable=function(t){return new e(t)},e.prototype.isAbsent=function(){return void 0===this.value||null==this.value},e.prototype.isPresent=function(t){var e=this.isAbsent();return!e&&t&&t.call(this,this),!e},e.prototype.ifPresentLazy=function(t){return void 0===t&&(t=function(){}),this.isPresent.call(this,t),this},e.prototype.orElse=function(t){return this.isPresent()?this:null==t?e.absent:this.flatMap((function(){return t}))},e.prototype.orElseLazy=function(t){return this.isPresent()?this:this.flatMap(t)},e.prototype.flatMap=function(r){var n=t.prototype.flatMap.call(this,r);return n instanceof e?n.flatMap():e.fromNullable(n.value)},e.prototype.getIf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this,n=0;n<t.length;n++){var o=this.keyVal(t[n]),i=this.arrayIndex(t[n]);if(""===o&&i>=0){if((r=this.getClass().fromNullable(r.value instanceof Array?r.value.length<i?null:r.value[i]:null)).isAbsent())return r}else if(o&&i>=0){if(r.getIfPresent(o).isAbsent())return r;if((r=r.getIfPresent(o).value instanceof Array?this.getClass().fromNullable(r.getIfPresent(o).value[i]):this.getClass().absent).isAbsent())return r}else{if((r=r.getIfPresent(o)).isAbsent())return r;i>-1&&(r=this.getClass().fromNullable(r.value[i]))}}return r},e.prototype.match=function(t){return!this.isAbsent()&&t(this.value)},e.prototype.get=function(t){return void 0===t&&(t=e.absent),this.isAbsent()?this.getClass().fromNullable(t).flatMap():this.getClass().fromNullable(this.value).flatMap()},e.prototype.toJson=function(){return JSON.stringify(this.value)},e.prototype.getClass=function(){return e},e.prototype.arrayIndex=function(t){var e=t.indexOf("["),r=t.indexOf("]");return e>=0&&r>0&&e<r?parseInt(t.substring(e+1,r)):-1},e.prototype.keyVal=function(t){var e=t.indexOf("[");return e>=0?t.substring(0,e):t},e.prototype.getIfPresent=function(t){return this.isAbsent()?this.getClass().absent:this.getClass().fromNullable(this.value[t]).flatMap()},e.prototype.resolve=function(t){if(this.isAbsent())return e.absent;try{return e.fromNullable(t(this.value))}catch(t){return e.absent}},e.absent=e.fromNullable(null),e}(f);e.Optional=p;var h=function(t){function e(e,r){void 0===r&&(r="value");var n=t.call(this,e)||this;return n.key=r,n}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value?this._value[this.key]:null},set:function(t){this._value&&(this._value[this.key]=t)},enumerable:!1,configurable:!0}),e.prototype.orElse=function(t){var r={};return r[this.key]=t,this.isPresent()?this:new e(r,this.key)},e.prototype.orElseLazy=function(t){if(this.isPresent())return this;var r={};return r[this.key]=t(),new e(r,this.key)},e.prototype.getClass=function(){return e},e.fromNullable=function(t,r){return void 0===r&&(r="value"),new e(t,r)},e.absent=e.fromNullable(null),e}(p);e.ValueEmbedder=h;var y=function(t){function e(e,r,n){var o=t.call(this,e,r)||this;return o.arrPos=null!=n?n:-1,o}return o(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return""==this.key&&this.arrPos>=0?this._value[this.arrPos]:this.key&&this.arrPos>=0?this._value[this.key][this.arrPos]:this._value[this.key]},set:function(t){""==this.key&&this.arrPos>=0?this._value[this.arrPos]=t:this.key&&this.arrPos>=0?this._value[this.key][this.arrPos]=t:this._value[this.key]=t},enumerable:!1,configurable:!0}),e.absent=e.fromNullable(null),e}(h),v=function(t){function e(e){return t.call(this,e)||this}return o(e,t),Object.defineProperty(e.prototype,"shallowCopy",{get:function(){return new e(s.Stream.ofAssoc(this.value).collect(new u.AssocArrayCollector))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deepCopy",{get:function(){return new e(c({},this.value))},enumerable:!1,configurable:!0}),e.fromNullable=function(t){return new e(t)},e.prototype.shallowMerge=function(t,e,r){var n=this;void 0===e&&(e=!0),void 0===r&&(r=!1);var o=function(o){!e&&o in l.value||(r?Array.isArray(t.getIf(o).value)?s.Stream.of.apply(s.Stream,a([],i(t.getIf(o).value),!1)).each((function(t){return n.append(o).value=t})):l.append(o).value=t.getIf(o).value:l.assign(o).value=t.getIf(o).value)},l=this;for(var u in t.value)o(u)},e.prototype.append=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.length<1;if(!r){var n=t[t.length-1],o=(this.keyVal(n),this.getIf.apply(this,a([],i(t),!1)).isPresent());this.buildPath(t);var l=this.arrayIndex(n);if(l>-1)throw Error("Append only possible on non array properties, use assign on indexed data");var u=this.getIf.apply(this,a([],i(t),!1)).value;Array.isArray(u)||(u=this.assign.apply(this,a([],i(t),!1)).value=[u]),o&&u.push({}),l=u.length-1;var s=new y(1==t.length?this.value:this.getIf.apply(this,t.slice(0,t.length-1)).value,n,l);return s}},e.prototype.appendIf=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t?this.append.apply(this,a([],i(e),!1)):{value:null}},e.prototype.assign=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!(t.length<1)){this.buildPath(t);var r=this.keyVal(t[t.length-1]),n=this.arrayIndex(t[t.length-1]),o=new y(1==t.length?this.value:this.getIf.apply(this,t.slice(0,t.length-1)).value,r,n);return o}},e.prototype.assignIf=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t?this.assign.apply(this,a([],i(e),!1)):{value:null}},e.prototype.getIf=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.getClass().fromNullable(t.prototype.getIf.apply(this,e).value)},e.prototype.get=function(e){return this.getClass().fromNullable(t.prototype.get.call(this,e).value)},e.prototype.delete=function(t){return t in this.value&&delete this.value[t],this},e.prototype.toJson=function(){return JSON.stringify(this.value)},e.prototype.getClass=function(){return e},e.prototype.setVal=function(t){this._value=t},e.prototype.buildPath=function(t){for(var e=this,r=this.getClass().fromNullable(null),n=-1,o=function(t,e){for(var r=t.length,n=r+e,o=r;o<n;o++)t.push({})},i=0;i<t.length;i++){var a=this.keyVal(t[i]),l=this.arrayIndex(t[i]);if(""===a&&l>=0)e.setVal(e.value instanceof Array?e.value:[]),o(e.value,l+1),n>=0&&(r.value[n]=e.value),r=e,n=l,e=this.getClass().fromNullable(e.value[l]);else{var u=e.getIf(a);if(-1==l)u.isAbsent()?u=this.getClass().fromNullable(e.value[a]={}):e=u;else{var s=u.value instanceof Array?u.value:[];o(s,l+1),e.value[a]=s,u=this.getClass().fromNullable(s[l])}r=e,n=l,e=u}}return this},e}(p);e.Config=v},255:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.QueryFormStringCollector=e.QueryFormDataCollector=e.FormDataCollector=e.AssocArrayCollector=e.Run=e.ArrayAssocArrayCollector=e.ArrayCollector=e.FlatMapStreamDataSource=e.MappedStreamDataSource=e.FilteredStreamDatasource=e.ArrayStreamDataSource=e.SequenceDataSource=void 0;var i=r(551),a=function(){function t(t,e){this.total=e,this.start=t,this.value=t}return t.prototype.hasNext=function(){return this.value<this.total},t.prototype.next=function(){return Math.min(this.value++,this.total-1)},t.prototype.reset=function(){this.value=0},t}();e.SequenceDataSource=a;var l=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.dataPos=-1,this.value=t}return t.prototype.hasNext=function(){return this.value.length-1>this.dataPos},t.prototype.next=function(){return this.dataPos++,this.value[this.dataPos]},t.prototype.reset=function(){this.dataPos=-1},t}();e.ArrayStreamDataSource=l;var u=function(){function t(t,e){this.filteredNext=null,this.filterFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){for(;null==this.filteredNext&&this.inputDataSource.hasNext();){var t=this.inputDataSource.next();if(this.filterFunc(t))return this.filteredNext=t,!0;this.filteredNext=null}return null!=this.filteredNext},t.prototype.next=function(){var t=this.filteredNext;return this.filteredNext=null,this.hasNext(),t},t.prototype.reset=function(){this.filteredNext=null,this.inputDataSource.reset()},t}();e.FilteredStreamDatasource=u;var s=function(){function t(t,e){this.mapFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){return this.inputDataSource.hasNext()},t.prototype.next=function(){return this.mapFunc(this.inputDataSource.next())},t.prototype.reset=function(){this.inputDataSource.reset()},t}();e.MappedStreamDataSource=s;var c=function(){function t(t,e){this.mapFunc=t,this.inputDataSource=e}return t.prototype.hasNext=function(){return this.resolveCurrentNext()||this.resolveNextNext()},t.prototype.resolveCurrentNext=function(){var t=!1;return this.activeDataSource&&(t=this.activeDataSource.hasNext()),t},t.prototype.resolveNextNext=function(){for(var t=!1;!t&&this.inputDataSource.hasNext();){var e=this.mapFunc(this.inputDataSource.next());Array.isArray(e)?this.activeDataSource=new(l.bind.apply(l,o([void 0],n(e),!1))):this.activeDataSource=e,t=this.activeDataSource.hasNext()}return t},t.prototype.next=function(){return this.activeDataSource.next()},t.prototype.reset=function(){this.inputDataSource.reset()},t}();e.FlatMapStreamDataSource=c;var f=function(){function t(){this.data=[]}return t.prototype.collect=function(t){this.data.push(t)},Object.defineProperty(t.prototype,"finalValue",{get:function(){return this.data},enumerable:!1,configurable:!0}),t}();e.ArrayCollector=f;var p=function(){function t(){this.finalValue={}}return t.prototype.collect=function(t){var e,r,n,o,i=null!==(e=null==t?void 0:t[0])&&void 0!==e?e:t;this.finalValue[i]=null!==(n=null===(r=this.finalValue)||void 0===r?void 0:r[i])&&void 0!==n?n:[],this.finalValue[i].push(null===(o=null==t?void 0:t[1])||void 0===o||o)},t}();e.ArrayAssocArrayCollector=p;var h=function(){function t(){}return t.prototype.collect=function(t){},Object.defineProperty(t.prototype,"finalValue",{get:function(){return null},enumerable:!1,configurable:!0}),t}();e.Run=h;var y=function(){function t(){this.finalValue={}}return t.prototype.collect=function(t){var e,r;this.finalValue[null!==(e=t[0])&&void 0!==e?e:t]=null===(r=t[1])||void 0===r||r},t}();e.AssocArrayCollector=y;var v=function(){function t(){this.finalValue=new FormData}return t.prototype.collect=function(t){this.finalValue.append(t.key,t.value)},t}();e.FormDataCollector=v;var d=function(){function t(){this.finalValue=new FormData}return t.prototype.collect=function(t){var e=t.encodeFormElement();e.isPresent()&&this.finalValue.append(t.name.value,e.get(t.name).value)},t}();e.QueryFormDataCollector=d;var m=function(){function t(){this.formData=[]}return t.prototype.collect=function(t){var e=t.encodeFormElement();e.isPresent()&&this.formData.push([t.name.value,e.get(t.name).value])},Object.defineProperty(t.prototype,"finalValue",{get:function(){return i.Stream.of.apply(i.Stream,o([],n(this.formData),!1)).map((function(t){return t.join("=")})).reduce((function(t,e){return[t,e].join("&")})).orElse("").value},enumerable:!1,configurable:!0}),t}();e.QueryFormStringCollector=m},551:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.LazyStream=e.Stream=void 0;var i=r(152),a=r(255),l=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._limits=-1,this.pos=-1,this.value=t}return t.of=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new(t.bind.apply(t,o([void 0],n(e),!1)))},t.ofAssoc=function(t){return this.of.apply(this,o([],n(Object.keys(t)),!1)).map((function(e){return[e,t[e]]}))},t.ofDataSource=function(e){for(var r=[];e.hasNext();)r.push(e.next());return new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.concat=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.of.apply(t,o([this],n(e),!1)).flatMap((function(t){return t}))},t.prototype.onElem=function(t){for(var e=0;e<this.value.length&&(-1==this._limits||e<this._limits)&&!1!==t(this.value[e],e);e++);return this},t.prototype.each=function(t){this.onElem(t)},t.prototype.map=function(e){e||(e=function(t){return t});var r=[];return this.each((function(t,n){r.push(e(t))})),new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.flatMap=function(e){var r=[];return this.each((function(t){var i=e(t);r=Array.isArray(i)?r.concat(i):r.concat.apply(r,o([],n(i.value),!1))})),t.of.apply(t,o([],n(r),!1))},t.prototype.filter=function(e){var r=[];return this.each((function(t){e(t)&&r.push(t)})),new(t.bind.apply(t,o([void 0],n(r),!1)))},t.prototype.reduce=function(t,e){void 0===e&&(e=null);for(var r=null!=e?0:1,n=null!=e?e:this.value.length?this.value[0]:null,o=r;o<this.value.length&&(-1==this._limits||o<this._limits);o++)n=t(n,this.value[o]);return i.Optional.fromNullable(n)},t.prototype.first=function(){return this.value&&this.value.length?i.Optional.fromNullable(this.value[0]):i.Optional.absent},t.prototype.last=function(){var t=this._limits>0?Math.min(this._limits,this.value.length):this.value.length;return i.Optional.fromNullable(t?this.value[t-1]:null)},t.prototype.anyMatch=function(t){for(var e=0;e<this.value.length&&(-1==this._limits||e<this._limits);e++)if(t(this.value[e]))return!0;return!1},t.prototype.allMatch=function(t){if(!this.value.length)return!1;for(var e=0,r=0;r<this.value.length;r++)t(this.value[r])&&e++;return e==this.value.length},t.prototype.noneMatch=function(t){for(var e=0,r=0;r<this.value.length;r++)t(this.value[r])||e++;return e==this.value.length},t.prototype.sort=function(e){var r=this.value.slice().sort(e);return t.of.apply(t,o([],n(r),!1))},t.prototype.collect=function(t){return this.each((function(e){return t.collect(e)})),t.finalValue},t.prototype.hasNext=function(){var t=-1!=this._limits&&this.pos>=this._limits-1,e=this.pos>=this.value.length-1;return!(t||e)},t.prototype.next=function(){return this.hasNext()?(this.pos++,this.value[this.pos]):null},t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.prototype.reset=function(){this.pos=-1},t}();e.Stream=l;var u=function(){function t(t){this._limits=-1,this.pos=-1,this.dataSource=t}return t.of=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new t(new(a.ArrayStreamDataSource.bind.apply(a.ArrayStreamDataSource,o([void 0],n(e),!1))))},t.ofAssoc=function(t){return this.of.apply(this,o([],n(Object.keys(t)),!1)).map((function(e){return[e,t[e]]}))},t.ofStreamDataSource=function(e){return new t(e)},t.prototype.hasNext=function(){return!this.isOverLimits()&&this.dataSource.hasNext()},t.prototype.next=function(){var t=this.dataSource.next();return this.pos++,t},t.prototype.reset=function(){this.dataSource.reset(),this.pos=0,this._limits=-1},t.prototype.concat=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.of.apply(t,o([this],n(e),!1)).flatMap((function(t){return t}))},t.prototype.nextFilter=function(t){if(this.hasNext()){var e=this.next();return t(e)?e:this.nextFilter(t)}return null},t.prototype.limits=function(t){return this._limits=t,this},t.prototype.collect=function(t){for(;this.hasNext();){var e=this.next();t.collect(e)}return t.finalValue},t.prototype.onElem=function(e){var r=this;return new t(new a.MappedStreamDataSource((function(t){return!1===e(t,r.pos)&&r.stop(),t}),this))},t.prototype.filter=function(e){return new t(new a.FilteredStreamDatasource(e,this))},t.prototype.map=function(e){return new t(new a.MappedStreamDataSource(e,this))},t.prototype.flatMap=function(e){return new t(new a.FlatMapStreamDataSource(e,this))},t.prototype.each=function(t){for(;this.hasNext();)!1===t(this.next())&&this.stop()},t.prototype.reduce=function(t,e){if(void 0===e&&(e=null),!this.hasNext())return i.Optional.absent;var r=null,n=null;if(null!=e)r=e,n=this.next();else{if(r=this.next(),!this.hasNext())return i.Optional.fromNullable(r);n=this.next()}for(r=t(r,n);this.hasNext();)r=t(r,n=this.next());return i.Optional.fromNullable(r)},t.prototype.last=function(){return this.hasNext()?this.reduce((function(t,e){return e})):i.Optional.absent},t.prototype.first=function(){return this.reset(),this.hasNext()?i.Optional.fromNullable(this.next()):i.Optional.absent},t.prototype.anyMatch=function(t){for(;this.hasNext();)if(t(this.next()))return!0;return!1},t.prototype.allMatch=function(t){for(;this.hasNext();)if(!t(this.next()))return!1;return!0},t.prototype.noneMatch=function(t){for(;this.hasNext();)if(t(this.next()))return!1;return!0},t.prototype.sort=function(e){var r=this.collect(new a.ArrayCollector);return r=r.sort(e),t.of.apply(t,o([],n(r),!1))},Object.defineProperty(t.prototype,"value",{get:function(){return this.collect(new a.ArrayCollector)},enumerable:!1,configurable:!0}),t.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){return{done:!t.hasNext(),value:t.next()}}}},t.prototype.stop=function(){this.pos=this._limits+1e9},t.prototype.isOverLimits=function(){return-1!=this._limits&&this.pos>=this._limits-1},t}();e.LazyStream=u},121:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.XQ=e.XMLQuery=void 0;var i=r(805),a=r(585),l=i.Lang.isString,u=function(t){function e(e,r){void 0===r&&(r="text/xml");var n;return l(e)?t.call(this,null==(n=e)?null:i.Lang.saveResolveLazy((function(){return new window.DOMParser}),(function(){return(t=new ActiveXObject("Microsoft.XMLDOM")).async=!1,{parseFromString:function(e,r){return t.loadXML(e)}};var t})).value.parseFromString(n,r))||this:t.call(this,e)||this}return o(e,t),e.prototype.isXMLParserError=function(){return this.querySelectorAll("parsererror").isPresent()},e.prototype.toString=function(){var t=[];return this.eachElem((function(e){var r,n,o,i=null!==(o=null===(n=null===(r=null===window||void 0===window?void 0:window.XMLSerializer)||void 0===r?void 0:r.constructor())||void 0===n?void 0:n.serializeToString(e))&&void 0!==o?o:null==e?void 0:e.xml;i&&t.push(i)})),t.join("")},e.prototype.parserErrorText=function(t){return this.querySelectorAll("parsererror").textContent(t)},e.parseXML=function(t){return new e(t)},e.parseHTML=function(t){return new e(t,"text/html")},e.fromString=function(t,r){return void 0===r&&(r="text/xml"),new e(t,r)},e}(a.DomQuery);e.XMLQuery=u,e.XQ=u}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}var n={};!function(){var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.QueryFormDataCollector=t.FormDataCollector=t.AssocArrayCollector=t.ArrayCollector=t.QueryFormStringCollector=t.SequenceDataSource=t.FlatMapStreamDataSource=t.FilteredStreamDatasource=t.MappedStreamDataSource=t.ArrayStreamDataSource=t.LazyStream=t.Stream=t.XQ=t.XMLQuery=t.ValueEmbedder=t.Optional=t.Monad=t.Config=t.Lang=t.DQ=t.DomQueryCollector=t.ElementAttribute=t.DomQuery=void 0;var e=r(585);Object.defineProperty(t,"DomQuery",{enumerable:!0,get:function(){return e.DomQuery}}),Object.defineProperty(t,"ElementAttribute",{enumerable:!0,get:function(){return e.ElementAttribute}}),Object.defineProperty(t,"DomQueryCollector",{enumerable:!0,get:function(){return e.DomQueryCollector}}),Object.defineProperty(t,"DQ",{enumerable:!0,get:function(){return e.DQ}});var o=r(805);Object.defineProperty(t,"Lang",{enumerable:!0,get:function(){return o.Lang}});var i=r(152);Object.defineProperty(t,"Config",{enumerable:!0,get:function(){return i.Config}}),Object.defineProperty(t,"Monad",{enumerable:!0,get:function(){return i.Monad}}),Object.defineProperty(t,"Optional",{enumerable:!0,get:function(){return i.Optional}}),Object.defineProperty(t,"ValueEmbedder",{enumerable:!0,get:function(){return i.ValueEmbedder}});var a=r(121);Object.defineProperty(t,"XMLQuery",{enumerable:!0,get:function(){return a.XMLQuery}}),Object.defineProperty(t,"XQ",{enumerable:!0,get:function(){return a.XQ}});var l=r(551);Object.defineProperty(t,"Stream",{enumerable:!0,get:function(){return l.Stream}}),Object.defineProperty(t,"LazyStream",{enumerable:!0,get:function(){return l.LazyStream}});var u=r(255);Object.defineProperty(t,"ArrayStreamDataSource",{enumerable:!0,get:function(){return u.ArrayStreamDataSource}}),Object.defineProperty(t,"MappedStreamDataSource",{enumerable:!0,get:function(){return u.MappedStreamDataSource}}),Object.defineProperty(t,"FilteredStreamDatasource",{enumerable:!0,get:function(){return u.FilteredStreamDatasource}}),Object.defineProperty(t,"FlatMapStreamDataSource",{enumerable:!0,get:function(){return u.FlatMapStreamDataSource}}),Object.defineProperty(t,"SequenceDataSource",{enumerable:!0,get:function(){return u.SequenceDataSource}}),Object.defineProperty(t,"QueryFormStringCollector",{enumerable:!0,get:function(){return u.QueryFormStringCollector}}),Object.defineProperty(t,"ArrayCollector",{enumerable:!0,get:function(){return u.ArrayCollector}}),Object.defineProperty(t,"AssocArrayCollector",{enumerable:!0,get:function(){return u.AssocArrayCollector}}),Object.defineProperty(t,"FormDataCollector",{enumerable:!0,get:function(){return u.FormDataCollector}}),Object.defineProperty(t,"QueryFormDataCollector",{enumerable:!0,get:function(){return u.QueryFormDataCollector}})}();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})}();
|
|
11
|
-
//# sourceMappingURL=index_core.js.map
|
|
12
3739
|
|
|
13
3740
|
/***/ }),
|
|
14
3741
|
|
|
@@ -18,7 +3745,6 @@
|
|
|
18
3745
|
\****************************************/
|
|
19
3746
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
20
3747
|
|
|
21
|
-
"use strict";
|
|
22
3748
|
|
|
23
3749
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
24
3750
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -49,6 +3775,7 @@ exports.myfaces = exports.jsf = void 0;
|
|
|
49
3775
|
///<reference types='../../types/typedefs'/>
|
|
50
3776
|
var AjaxImpl_1 = __webpack_require__(/*! ../impl/AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
51
3777
|
var PushImpl_1 = __webpack_require__(/*! ../impl/PushImpl */ "./src/main/typescript/impl/PushImpl.ts");
|
|
3778
|
+
//declare const Implementation: any;
|
|
52
3779
|
var jsf;
|
|
53
3780
|
(function (jsf) {
|
|
54
3781
|
"use strict";
|
|
@@ -286,7 +4013,6 @@ var myfaces;
|
|
|
286
4013
|
\**********************************************/
|
|
287
4014
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
288
4015
|
|
|
289
|
-
"use strict";
|
|
290
4016
|
|
|
291
4017
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
292
4018
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -308,7 +4034,7 @@ exports.Implementation = void 0;
|
|
|
308
4034
|
var Response_1 = __webpack_require__(/*! ./xhrCore/Response */ "./src/main/typescript/impl/xhrCore/Response.ts");
|
|
309
4035
|
var XhrRequest_1 = __webpack_require__(/*! ./xhrCore/XhrRequest */ "./src/main/typescript/impl/xhrCore/XhrRequest.ts");
|
|
310
4036
|
var AsyncQueue_1 = __webpack_require__(/*! ./util/AsyncQueue */ "./src/main/typescript/impl/util/AsyncQueue.ts");
|
|
311
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
4037
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
312
4038
|
var Assertions_1 = __webpack_require__(/*! ./util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
313
4039
|
var XhrFormData_1 = __webpack_require__(/*! ./xhrCore/XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
314
4040
|
var ExtDomQuery_1 = __webpack_require__(/*! ./util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
@@ -365,7 +4091,7 @@ var Implementation;
|
|
|
365
4091
|
/**
|
|
366
4092
|
* fetches the separator char from the given script tags
|
|
367
4093
|
*
|
|
368
|
-
* @return {
|
|
4094
|
+
* @return {string} the separator char for the given script tags
|
|
369
4095
|
*/
|
|
370
4096
|
function getSeparatorChar() {
|
|
371
4097
|
var _a, _b, _c;
|
|
@@ -412,30 +4138,17 @@ var Implementation;
|
|
|
412
4138
|
* @param funcs
|
|
413
4139
|
*/
|
|
414
4140
|
function chain(source, event) {
|
|
4141
|
+
// we can use our lazy stream each functionality to run our chain here..
|
|
4142
|
+
// by passing a boolean as return value into the onElem call
|
|
4143
|
+
// we can stop early at the first false, just like the spec requests
|
|
415
4144
|
var funcs = [];
|
|
416
4145
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
417
4146
|
funcs[_i - 2] = arguments[_i];
|
|
418
4147
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return (ret = ret && (func.call(source, event) !== false));
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
427
|
-
//it it is not a plain executable code but a definition
|
|
428
|
-
var sourceCode = trim(func);
|
|
429
|
-
if (sourceCode.indexOf("function ") == 0) {
|
|
430
|
-
sourceCode = "return ".concat(sourceCode, " (event)");
|
|
431
|
-
}
|
|
432
|
-
return (ret = ret && (new Function("event", sourceCode).call(source, event) !== false));
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
//we can use our stream each functionality to run our chain here..
|
|
436
|
-
//the no return value == false stop stream functionality is handled by our resolveAndExecute
|
|
437
|
-
mona_dish_1.Stream.of.apply(mona_dish_1.Stream, funcs).each(function (func) { return resolveAndExecute(func); });
|
|
438
|
-
return ret;
|
|
4148
|
+
return mona_dish_1.LazyStream.of.apply(mona_dish_1.LazyStream, funcs).map(function (func) { return resolveAndExecute(source, event, func); })
|
|
4149
|
+
// we use the return false == stop as an early stop
|
|
4150
|
+
.onElem(function (opResult) { return opResult; })
|
|
4151
|
+
.last().value;
|
|
439
4152
|
}
|
|
440
4153
|
Implementation.chain = chain;
|
|
441
4154
|
/**
|
|
@@ -854,6 +4567,30 @@ var Implementation;
|
|
|
854
4567
|
var _a, _b;
|
|
855
4568
|
return (_b = (_a = window === null || window === void 0 ? void 0 : window[Const_1.MYFACES]) === null || _a === void 0 ? void 0 : _a.config) !== null && _b !== void 0 ? _b : {};
|
|
856
4569
|
}
|
|
4570
|
+
/**
|
|
4571
|
+
* Private helper to execute a function or code fragment
|
|
4572
|
+
* @param source the source of the caller passed into the function as this
|
|
4573
|
+
* @param event an event which needs to be passed down into the function
|
|
4574
|
+
* @param func either a function or code fragment
|
|
4575
|
+
* @return a boolean value, if the passed function returns false, then the
|
|
4576
|
+
* caller is basically notified that the execution can now stop (JSF requirement for chain)
|
|
4577
|
+
* @private
|
|
4578
|
+
*/
|
|
4579
|
+
function resolveAndExecute(source, event, func) {
|
|
4580
|
+
if ("string" != typeof func) {
|
|
4581
|
+
//function is passed down as chain parameter, can be executed as is
|
|
4582
|
+
return func.call(source, event) !== false;
|
|
4583
|
+
}
|
|
4584
|
+
else {
|
|
4585
|
+
//either a function or a string can be passed in case of a string we have to wrap it into another function
|
|
4586
|
+
//it it is not a plain executable code but a definition
|
|
4587
|
+
var sourceCode = trim(func);
|
|
4588
|
+
if (sourceCode.indexOf("function ") == 0) {
|
|
4589
|
+
sourceCode = "return ".concat(sourceCode, " (event)");
|
|
4590
|
+
}
|
|
4591
|
+
return new Function("event", sourceCode).call(source, event) !== false;
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
857
4594
|
})(Implementation = exports.Implementation || (exports.Implementation = {}));
|
|
858
4595
|
|
|
859
4596
|
|
|
@@ -865,7 +4602,6 @@ var Implementation;
|
|
|
865
4602
|
\**********************************************/
|
|
866
4603
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
867
4604
|
|
|
868
|
-
"use strict";
|
|
869
4605
|
|
|
870
4606
|
/**
|
|
871
4607
|
* Typescript port of the jsf.push part in the myfaces implementation
|
|
@@ -1090,7 +4826,6 @@ var PushImpl;
|
|
|
1090
4826
|
\************************************************/
|
|
1091
4827
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1092
4828
|
|
|
1093
|
-
"use strict";
|
|
1094
4829
|
|
|
1095
4830
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1096
4831
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1235,7 +4970,6 @@ exports.UNKNOWN = "UNKNOWN";
|
|
|
1235
4970
|
\****************************************************/
|
|
1236
4971
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1237
4972
|
|
|
1238
|
-
"use strict";
|
|
1239
4973
|
|
|
1240
4974
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1241
4975
|
exports.StateHolder = void 0;
|
|
@@ -1288,7 +5022,6 @@ exports.StateHolder = StateHolder;
|
|
|
1288
5022
|
\***************************************************/
|
|
1289
5023
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1290
5024
|
|
|
1291
|
-
"use strict";
|
|
1292
5025
|
|
|
1293
5026
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1294
5027
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1412,11 +5145,10 @@ exports.Messages = Messages;
|
|
|
1412
5145
|
\*****************************************************/
|
|
1413
5146
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1414
5147
|
|
|
1415
|
-
"use strict";
|
|
1416
5148
|
|
|
1417
5149
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1418
5150
|
exports.Assertions = void 0;
|
|
1419
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5151
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1420
5152
|
var Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
1421
5153
|
var getMessage = Lang_1.ExtLang.getMessage;
|
|
1422
5154
|
var makeException = Lang_1.ExtLang.makeException;
|
|
@@ -1512,7 +5244,6 @@ var Assertions;
|
|
|
1512
5244
|
\*****************************************************/
|
|
1513
5245
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1514
5246
|
|
|
1515
|
-
"use strict";
|
|
1516
5247
|
|
|
1517
5248
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1518
5249
|
exports.AsynchronousQueue = void 0;
|
|
@@ -1626,7 +5357,6 @@ exports.AsynchronousQueue = AsynchronousQueue;
|
|
|
1626
5357
|
\******************************************************/
|
|
1627
5358
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1628
5359
|
|
|
1629
|
-
"use strict";
|
|
1630
5360
|
|
|
1631
5361
|
var __extends = (this && this.__extends) || (function () {
|
|
1632
5362
|
var extendStatics = function (d, b) {
|
|
@@ -1645,7 +5375,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
1645
5375
|
})();
|
|
1646
5376
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1647
5377
|
exports.ExtDQ = exports.ExtDomquery = void 0;
|
|
1648
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5378
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1649
5379
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
1650
5380
|
/**
|
|
1651
5381
|
* detects whether a source is a jsf.js request
|
|
@@ -1671,6 +5401,7 @@ var IS_JSF_SOURCE = function (source) {
|
|
|
1671
5401
|
var IS_INTERNAL_SOURCE = function (source) {
|
|
1672
5402
|
return source.search(/\/jsf[^\.]\.js.*ln\=myfaces.testscripts.*/gi) != -1;
|
|
1673
5403
|
};
|
|
5404
|
+
var ATTR_SRC = 'src';
|
|
1674
5405
|
/**
|
|
1675
5406
|
* Extension which adds implementation specific
|
|
1676
5407
|
* meta data to our dom query
|
|
@@ -1749,8 +5480,8 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
1749
5480
|
var nonceScript = mona_dish_1.DQ
|
|
1750
5481
|
.querySelectorAll("script[src], link[src]")
|
|
1751
5482
|
.lazyStream
|
|
1752
|
-
.filter(function (item) { return item.attr("nonce").value != null && item.attr(
|
|
1753
|
-
.map(function (item) { return IS_JSF_SOURCE(item.attr(
|
|
5483
|
+
.filter(function (item) { return item.attr("nonce").value != null && item.attr(ATTR_SRC) != null; })
|
|
5484
|
+
.map(function (item) { return IS_JSF_SOURCE(item.attr(ATTR_SRC).value); })
|
|
1754
5485
|
.first();
|
|
1755
5486
|
if (nonceScript.isPresent()) {
|
|
1756
5487
|
nonce.value = mona_dish_1.DomQuery.byId(nonceScript.value, true).attr("nonce").value;
|
|
@@ -1771,8 +5502,8 @@ var ExtDomquery = /** @class */ (function (_super) {
|
|
|
1771
5502
|
ExtDomquery.prototype.searchJsfJsFor = function (rexp) {
|
|
1772
5503
|
//perfect application for lazy stream
|
|
1773
5504
|
return mona_dish_1.DQ.querySelectorAll("script[src], link[src]").lazyStream
|
|
1774
|
-
.filter(function (item) { return IS_JSF_SOURCE(item.attr(
|
|
1775
|
-
.map(function (item) { return item.attr(
|
|
5505
|
+
.filter(function (item) { return IS_JSF_SOURCE(item.attr(ATTR_SRC).value); })
|
|
5506
|
+
.map(function (item) { return item.attr(ATTR_SRC).value.match(rexp); })
|
|
1776
5507
|
.filter(function (item) { return item != null && item.length > 1; })
|
|
1777
5508
|
.map(function (result) {
|
|
1778
5509
|
return decodeURIComponent(result[1]);
|
|
@@ -1819,7 +5550,6 @@ exports.ExtDQ = mona_dish_1.DQ;
|
|
|
1819
5550
|
\***********************************************/
|
|
1820
5551
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1821
5552
|
|
|
1822
|
-
"use strict";
|
|
1823
5553
|
|
|
1824
5554
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
1825
5555
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -1841,7 +5571,7 @@ exports.ExtDQ = mona_dish_1.DQ;
|
|
|
1841
5571
|
*/
|
|
1842
5572
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1843
5573
|
exports.ExtLang = void 0;
|
|
1844
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5574
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
1845
5575
|
var Messages_1 = __webpack_require__(/*! ../i18n/Messages */ "./src/main/typescript/impl/i18n/Messages.ts");
|
|
1846
5576
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
1847
5577
|
var RequestDataResolver_1 = __webpack_require__(/*! ../xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
|
|
@@ -2044,7 +5774,6 @@ var ExtLang;
|
|
|
2044
5774
|
\*******************************************************/
|
|
2045
5775
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2046
5776
|
|
|
2047
|
-
"use strict";
|
|
2048
5777
|
|
|
2049
5778
|
var __extends = (this && this.__extends) || (function () {
|
|
2050
5779
|
var extendStatics = function (d, b) {
|
|
@@ -2145,11 +5874,10 @@ exports.ErrorData = ErrorData;
|
|
|
2145
5874
|
\*******************************************************/
|
|
2146
5875
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2147
5876
|
|
|
2148
|
-
"use strict";
|
|
2149
5877
|
|
|
2150
5878
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2151
5879
|
exports.EventData = void 0;
|
|
2152
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5880
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2153
5881
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2154
5882
|
var EventData = /** @class */ (function () {
|
|
2155
5883
|
function EventData() {
|
|
@@ -2185,7 +5913,6 @@ exports.EventData = EventData;
|
|
|
2185
5913
|
\*****************************************************************/
|
|
2186
5914
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2187
5915
|
|
|
2188
|
-
"use strict";
|
|
2189
5916
|
|
|
2190
5917
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2191
5918
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2204,7 +5931,7 @@ exports.EventData = EventData;
|
|
|
2204
5931
|
*/
|
|
2205
5932
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2206
5933
|
exports.resolveDefaults = exports.getEventTarget = exports.resolveWindowId = exports.resolveDelay = exports.resolveTimeout = exports.resolveForm = exports.resolveFinalUrl = exports.resolveTargetUrl = exports.resolveHandlerFunc = void 0;
|
|
2207
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
5934
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2208
5935
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2209
5936
|
var Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
2210
5937
|
var ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
@@ -2338,7 +6065,6 @@ exports.resolveDefaults = resolveDefaults;
|
|
|
2338
6065
|
\*****************************************************************/
|
|
2339
6066
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2340
6067
|
|
|
2341
|
-
"use strict";
|
|
2342
6068
|
|
|
2343
6069
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2344
6070
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2357,9 +6083,9 @@ exports.resolveDefaults = resolveDefaults;
|
|
|
2357
6083
|
*/
|
|
2358
6084
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2359
6085
|
exports.resolveSourceForm = exports.resolveSourceElement = exports.resolveContexts = exports.resolveResponseXML = void 0;
|
|
2360
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6086
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2361
6087
|
var Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
2362
|
-
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6088
|
+
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2363
6089
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2364
6090
|
/**
|
|
2365
6091
|
* Resolver functions for various aspects of the response data
|
|
@@ -2451,7 +6177,6 @@ function resolveSourceElementId(context, internalContext) {
|
|
|
2451
6177
|
\******************************************************/
|
|
2452
6178
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2453
6179
|
|
|
2454
|
-
"use strict";
|
|
2455
6180
|
|
|
2456
6181
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2457
6182
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2470,7 +6195,7 @@ function resolveSourceElementId(context, internalContext) {
|
|
|
2470
6195
|
*/
|
|
2471
6196
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2472
6197
|
exports.Response = void 0;
|
|
2473
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6198
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2474
6199
|
var ResponseProcessor_1 = __webpack_require__(/*! ./ResponseProcessor */ "./src/main/typescript/impl/xhrCore/ResponseProcessor.ts");
|
|
2475
6200
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
2476
6201
|
var ResonseDataResolver_1 = __webpack_require__(/*! ./ResonseDataResolver */ "./src/main/typescript/impl/xhrCore/ResonseDataResolver.ts");
|
|
@@ -2628,7 +6353,6 @@ var Response;
|
|
|
2628
6353
|
\***************************************************************/
|
|
2629
6354
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2630
6355
|
|
|
2631
|
-
"use strict";
|
|
2632
6356
|
|
|
2633
6357
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2634
6358
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -2656,7 +6380,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
2656
6380
|
};
|
|
2657
6381
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2658
6382
|
exports.ResponseProcessor = void 0;
|
|
2659
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6383
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
2660
6384
|
var AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
2661
6385
|
var Assertions_1 = __webpack_require__(/*! ../util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
2662
6386
|
var ErrorData_1 = __webpack_require__(/*! ./ErrorData */ "./src/main/typescript/impl/xhrCore/ErrorData.ts");
|
|
@@ -3015,7 +6739,6 @@ exports.ResponseProcessor = ResponseProcessor;
|
|
|
3015
6739
|
\*********************************************************/
|
|
3016
6740
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3017
6741
|
|
|
3018
|
-
"use strict";
|
|
3019
6742
|
|
|
3020
6743
|
var __extends = (this && this.__extends) || (function () {
|
|
3021
6744
|
var extendStatics = function (d, b) {
|
|
@@ -3058,8 +6781,8 @@ exports.XhrFormData = void 0;
|
|
|
3058
6781
|
* See the License for the specific language governing permissions and
|
|
3059
6782
|
* limitations under the License.
|
|
3060
6783
|
*/
|
|
3061
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
3062
|
-
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
6784
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6785
|
+
var mona_dish_2 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
3063
6786
|
var isString = mona_dish_1.Lang.isString;
|
|
3064
6787
|
var Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
3065
6788
|
/**
|
|
@@ -3083,12 +6806,10 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
3083
6806
|
* @param dataSource either a form as DomQuery object or an encoded url string
|
|
3084
6807
|
* @param partialIdsArray partial ids to collect, to reduce the data sent down
|
|
3085
6808
|
*/
|
|
3086
|
-
function XhrFormData(dataSource, partialIdsArray
|
|
3087
|
-
if (encode === void 0) { encode = true; }
|
|
6809
|
+
function XhrFormData(dataSource, partialIdsArray) {
|
|
3088
6810
|
var _this = _super.call(this, {}) || this;
|
|
3089
6811
|
_this.dataSource = dataSource;
|
|
3090
6812
|
_this.partialIdsArray = partialIdsArray;
|
|
3091
|
-
_this.encode = encode;
|
|
3092
6813
|
_this.fileInputs = {};
|
|
3093
6814
|
//a call to getViewState before must pass the encoded line
|
|
3094
6815
|
//a call from getViewState passes the form element as datasource
|
|
@@ -3124,7 +6845,7 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
3124
6845
|
}
|
|
3125
6846
|
};
|
|
3126
6847
|
var inputExists = function (item) {
|
|
3127
|
-
return
|
|
6848
|
+
return item.isPresent();
|
|
3128
6849
|
};
|
|
3129
6850
|
var applyInput = function (item) {
|
|
3130
6851
|
_this.fileInputs[_this.resolveSubmitIdentifier(item.getAsElem(0).value)] = true;
|
|
@@ -3134,25 +6855,11 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
3134
6855
|
.each(applyInput);
|
|
3135
6856
|
};
|
|
3136
6857
|
XhrFormData.prototype.getFileInputs = function (rootElment) {
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
(((_a = item.attr("type")) === null || _a === void 0 ? void 0 : _a.value) || '').toLowerCase() == "file") {
|
|
3143
|
-
return item;
|
|
3144
|
-
}
|
|
3145
|
-
return rootElment.querySelectorAllDeep("input[type='file']");
|
|
3146
|
-
}
|
|
3147
|
-
return _this.getFileInputs(item);
|
|
3148
|
-
};
|
|
3149
|
-
var itemExists = function (item) {
|
|
3150
|
-
return !!(item === null || item === void 0 ? void 0 : item.length);
|
|
3151
|
-
};
|
|
3152
|
-
var ret = rootElment.lazyStream
|
|
3153
|
-
.map(resolveFileInputs)
|
|
3154
|
-
.filter(itemExists)
|
|
3155
|
-
.collect(new mona_dish_1.DomQueryCollector());
|
|
6858
|
+
var rootFileInputs = rootElment
|
|
6859
|
+
.filter(function (elem) { return elem.matchesSelector("input[type='file']"); });
|
|
6860
|
+
var childFileInputs = rootElment
|
|
6861
|
+
.querySelectorAll("input[type='file']");
|
|
6862
|
+
var ret = rootFileInputs.concat(childFileInputs);
|
|
3156
6863
|
return ret;
|
|
3157
6864
|
};
|
|
3158
6865
|
XhrFormData.prototype.handleFormSource = function () {
|
|
@@ -3185,15 +6892,25 @@ var XhrFormData = /** @class */ (function (_super) {
|
|
|
3185
6892
|
* @param encoded
|
|
3186
6893
|
*/
|
|
3187
6894
|
XhrFormData.prototype.assignEncodedString = function (encoded) {
|
|
6895
|
+
//TODO reevaluate this method
|
|
3188
6896
|
//this code filters out empty strings as key value pairs
|
|
3189
|
-
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
6897
|
+
var keyValueEntries = decodeURIComponent(encoded).split(/&/gi)
|
|
6898
|
+
.filter(function (item) { return !!(item || '')
|
|
6899
|
+
.replace(/\s+/g, ''); });
|
|
3190
6900
|
this.assignString(keyValueEntries);
|
|
3191
6901
|
};
|
|
3192
6902
|
XhrFormData.prototype.assignString = function (keyValueEntries) {
|
|
3193
6903
|
var toMerge = new mona_dish_1.Config({});
|
|
3194
|
-
|
|
6904
|
+
function splitToKeyVal(line) {
|
|
6905
|
+
return line.split(/=(.*)/gi);
|
|
6906
|
+
}
|
|
6907
|
+
function fixKeyWithoutVal(keyVal) {
|
|
6908
|
+
var _a, _b;
|
|
6909
|
+
return keyVal.length < 3 ? [(_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal[0]) !== null && _a !== void 0 ? _a : [], (_b = keyVal === null || keyVal === void 0 ? void 0 : keyVal[1]) !== null && _b !== void 0 ? _b : []] : keyVal;
|
|
6910
|
+
}
|
|
6911
|
+
mona_dish_2.Stream.of.apply(mona_dish_2.Stream, keyValueEntries).map(function (line) { return splitToKeyVal(line); })
|
|
3195
6912
|
//special case of having keys without values
|
|
3196
|
-
.map(function (keyVal) {
|
|
6913
|
+
.map(function (keyVal) { return fixKeyWithoutVal(keyVal); })
|
|
3197
6914
|
.each(function (keyVal) {
|
|
3198
6915
|
var _a, _b;
|
|
3199
6916
|
toMerge.append(keyVal[0]).value = (_b = (_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal.splice(1)) === null || _a === void 0 ? void 0 : _a.join("")) !== null && _b !== void 0 ? _b : "";
|
|
@@ -3298,7 +7015,6 @@ exports.XhrFormData = XhrFormData;
|
|
|
3298
7015
|
\********************************************************/
|
|
3299
7016
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3300
7017
|
|
|
3301
|
-
"use strict";
|
|
3302
7018
|
|
|
3303
7019
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3304
7020
|
* contributor license agreements. See the NOTICE file distributed with
|
|
@@ -3317,7 +7033,7 @@ exports.XhrFormData = XhrFormData;
|
|
|
3317
7033
|
*/
|
|
3318
7034
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3319
7035
|
exports.XhrRequest = void 0;
|
|
3320
|
-
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/
|
|
7036
|
+
var mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
3321
7037
|
var AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
3322
7038
|
var XhrFormData_1 = __webpack_require__(/*! ./XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
3323
7039
|
var ErrorData_1 = __webpack_require__(/*! ./ErrorData */ "./src/main/typescript/impl/xhrCore/ErrorData.ts");
|