Socket
Socket
Sign inDemoInstall

atma-utils

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atma-utils - npm Package Compare versions

Comparing version 0.1.41 to 0.2.42

lib/utils.d.ts

2798

lib/utils.embed.js

@@ -1,1309 +0,1 @@

var _Array_slice,
_Array_splice,
_Array_indexOf,
_Object_hasOwnProp,
_Object_getOwnProp,
_Object_defineProperty,
_global,
_document;
(function(){
_Array_slice = Array.prototype.slice;
_Array_splice = Array.prototype.splice;
_Array_indexOf = Array.prototype.indexOf;
_Object_hasOwnProp = Object.hasOwnProperty;
_Object_getOwnProp = Object.getOwnPropertyDescriptor;
_Object_defineProperty = Object.defineProperty;
_global = typeof global !== 'undefined'
? global
: window;
_document = typeof window !== 'undefined' && window.document != null
? window.document
: null;
}());
(function(){
if (Array.prototype.forEach === void 0) {
Array.prototype.forEach = function (fn, ctx) {
coll_each(this, fn, ctx);
};
}
if (Array.prototype.indexOf === void 0) {
Array.prototype.indexOf = function (x) {
return coll_indexOf(this, x);
};
}
}());
var coll_each,
coll_indexOf,
coll_remove,
coll_map,
coll_find;
(function(){
coll_each = function (coll, fn, ctx) {
if (ctx == null)
ctx = coll;
if (coll == null)
return coll;
var imax = coll.length, i = 0;
for (; i < imax; i++) {
fn.call(ctx, coll[i], i);
}
return ctx;
}
;
coll_indexOf = function (coll, x) {
if (coll == null)
return -1;
var imax = coll.length, i = 0;
for (; i < imax; i++) {
if (coll[i] === x)
return i;
}
return -1;
}
;
coll_remove = function (coll, x) {
var i = coll_indexOf(coll, x);
if (i === -1)
return false;
coll.splice(i, 1);
return true;
}
;
coll_map = function (coll, fn, ctx) {
var arr = new Array(coll.length);
coll_each(coll, function (x, i) {
arr[i] = fn.call(this, x, i);
}, ctx);
return arr;
}
;
coll_find = function (coll, fn, ctx) {
var imax = coll.length, i = 0;
for (; i < imax; i++) {
if (fn.call(ctx || coll, coll[i], i))
return true;
}
return false;
}
;
}());
var is_Function,
is_Object,
is_Array,
is_ArrayLike,
is_String,
is_notEmptyString,
is_rawObject,
is_Date,
is_PromiseLike,
is_Observable,
is_DOM,
is_NODE;
(function(){
is_Function = function (x) {
return typeof x === 'function';
}
is_Object = function (x) {
return x != null && typeof x === 'object';
}
is_Array = function (arr) {
return (arr != null &&
typeof arr === 'object' &&
typeof arr.length === 'number' &&
typeof arr.slice === 'function');
}
is_ArrayLike = is_Array;
is_String = function (x) {
return typeof x === 'string';
}
is_notEmptyString = function (x) {
return typeof x === 'string' && x !== '';
}
is_rawObject = function (x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
is_Date = function (x) {
if (x == null || typeof x !== 'object') {
return false;
}
if (x.getFullYear != null && isNaN(x) === false) {
return true;
}
return false;
}
is_PromiseLike = function (x) {
return x != null && typeof x === 'object' && typeof x.then === 'function';
}
is_Observable = function (x) {
return x != null && typeof x === 'object' && typeof x.subscribe === 'function';
}
is_DOM = typeof window !== 'undefined' && window.navigator != null;
is_NODE = !is_DOM;
}());
var obj_copyProperty,
obj_getProperty,
obj_setProperty,
obj_hasProperty,
obj_defineProperty,
obj_extend,
obj_extendDefaults,
obj_extendProperties,
obj_extendPropertiesDefaults,
obj_extendMany,
obj_toFastProps,
_Object_create,
obj_create,
obj_defaults,
obj_clean,
obj_extendDescriptors,
obj_extendDescriptorsDefaults;
(function(){
var getDescriptor = Object.getOwnPropertyDescriptor;
var defineDescriptor = Object.defineProperty;
obj_copyProperty = getDescriptor == null
? function (target, source, key) { return target[key] = source[key]; }
: function (target, source, key) {
var descr = getDescriptor(source, key);
if (descr == null) {
target[key] = source[key];
return;
}
if (descr.value !== void 0) {
target[key] = descr.value;
return;
}
defineDescriptor(target, key, descr);
};
obj_getProperty = function (obj_, path) {
if (obj_ == null) {
return null;
}
if (path.indexOf('.') === -1) {
return obj_[path];
}
var obj = obj_, chain = path.split('.'), imax = chain.length, i = -1;
while (obj != null && ++i < imax) {
var key = chain[i];
if (key.charCodeAt(key.length - 1) === 63 /*?*/) {
key = key.slice(0, -1);
}
obj = obj[key];
}
return obj;
}
;
obj_setProperty = function (obj_, path, val) {
if (path.indexOf('.') === -1) {
obj_[path] = val;
return;
}
var obj = obj_, chain = path.split('.'), imax = chain.length - 1, i = -1, key;
while (++i < imax) {
key = chain[i];
if (key.charCodeAt(key.length - 1) === 63 /*?*/) {
key = key.slice(0, -1);
}
var x = obj[key];
if (x == null) {
x = obj[key] = {};
}
obj = x;
}
obj[chain[i]] = val;
}
;
obj_hasProperty = function (obj, path) {
var x = obj_getProperty(obj, path);
return x !== void 0;
}
;
obj_defineProperty = function (obj, path, dscr) {
var x = obj, chain = path.split('.'), imax = chain.length - 1, i = -1, key;
while (++i < imax) {
key = chain[i];
if (x[key] == null)
x[key] = {};
x = x[key];
}
key = chain[imax];
if (_Object_defineProperty) {
if (dscr.writable === void 0)
dscr.writable = true;
if (dscr.configurable === void 0)
dscr.configurable = true;
if (dscr.enumerable === void 0)
dscr.enumerable = true;
_Object_defineProperty(x, key, dscr);
return;
}
x[key] = dscr.value === void 0
? dscr.value
: (dscr.get && dscr.get());
}
;
obj_extend = function (a, b) {
if (b == null)
return a || {};
if (a == null)
return obj_create(b);
for (var key in b) {
a[key] = b[key];
}
return a;
}
;
obj_extendDefaults = function (a, b) {
if (b == null)
return a || {};
if (a == null)
return obj_create(b);
for (var key in b) {
if (a[key] == null) {
a[key] = b[key];
continue;
}
if (key === 'toString' && a[key] === Object.prototype.toString) {
a[key] = b[key];
}
}
return a;
}
var extendPropertiesFactory = function (overwriteProps) {
if (_Object_getOwnProp == null)
return overwriteProps ? obj_extend : obj_extendDefaults;
return function (a, b) {
if (b == null)
return a || {};
if (a == null)
return obj_create(b);
var key, descr, ownDescr;
for (key in b) {
descr = _Object_getOwnProp(b, key);
if (descr == null)
continue;
if (overwriteProps !== true) {
ownDescr = _Object_getOwnProp(a, key);
if (ownDescr != null) {
continue;
}
}
if (descr.hasOwnProperty('value')) {
a[key] = descr.value;
continue;
}
_Object_defineProperty(a, key, descr);
}
return a;
};
};
obj_extendProperties = extendPropertiesFactory(true);
obj_extendPropertiesDefaults = extendPropertiesFactory(false);
obj_extendMany = function (a, arg1, arg2, arg3, arg4, arg5, arg6) {
var imax = arguments.length, i = 1;
for (; i < imax; i++) {
a = obj_extend(a, arguments[i]);
}
return a;
}
;
obj_toFastProps = function (obj) {
/*jshint -W027*/
function F() { }
F.prototype = obj;
new F();
return;
eval(obj);
}
;
_Object_create = Object.create || function (x) {
var Ctor = function () { };
Ctor.prototype = x;
return new Ctor;
};
obj_create = _Object_create;
obj_defaults = function (target, defaults) {
for (var key in defaults) {
if (target[key] == null)
target[key] = defaults[key];
}
return target;
}
/**
* Remove all NULL properties, optionally also all falsy-ies
*/
obj_clean = function (json, opts) {
var _a;
if (opts === void 0) { opts = {
removePrivate: false,
skipProperties: null,
removeEmptyArrays: false,
removeFalsy: false
}; }
if (json == null || typeof json !== 'object') {
return json;
}
if (is_ArrayLike(json)) {
var arr = json;
var i = 0;
var notNullIndex = -1;
for (; i < arr.length; i++) {
var val = arr[i];
if (val != null) {
notNullIndex = i;
}
obj_clean(val, opts);
}
// clean all last nullable values
if (notNullIndex + 1 < arr.length) {
arr.splice(notNullIndex + 1);
}
return json;
}
if (is_Object(json)) {
for (var key in json) {
if (opts.skipProperties != null && key in opts.skipProperties) {
delete json[key];
continue;
}
if (opts.ignoreProperties != null && key in opts.ignoreProperties) {
continue;
}
if (opts.removePrivate === true && key[0] === '_') {
delete json[key];
continue;
}
var val = json[key];
if ((_a = opts.shouldRemove) === null || _a === void 0 ? void 0 : _a.call(opts, key, val)) {
delete json[key];
continue;
}
if (isDefault(val, opts)) {
if (opts.strictProperties != null && key in opts.strictProperties && val != null) {
continue;
}
delete json[key];
continue;
}
if (opts.deep !== false) {
obj_clean(val, opts);
}
if (opts.removeEmptyArrays && is_ArrayLike(val) && val.length === 0) {
delete json[key];
}
}
return json;
}
return json;
}
function isDefault(x, opts) {
if (x == null) {
return true;
}
if (opts.removeFalsy && (x === '' || x === false)) {
return true;
}
if (opts.removeEmptyArrays && is_ArrayLike(x) && x.length === 0) {
return true;
}
return false;
}
obj_extendDescriptors;
obj_extendDescriptorsDefaults;
(function () {
if (getDescriptor == null) {
obj_extendDescriptors = obj_extend;
obj_extendDescriptorsDefaults = obj_defaults;
return;
}
obj_extendDescriptors = function (target, source) {
return _extendDescriptors(target, source, false);
};
obj_extendDescriptorsDefaults = function (target, source) {
return _extendDescriptors(target, source, true);
};
function _extendDescriptors(target, source, defaultsOnly) {
if (target == null)
return {};
if (source == null)
return source;
var descr, key;
for (key in source) {
if (defaultsOnly === true && target[key] != null)
continue;
descr = getDescriptor(source, key);
if (descr == null) {
obj_extendDescriptors(target, source["__proto__"]);
continue;
}
if (descr.value !== void 0) {
target[key] = descr.value;
continue;
}
defineDescriptor(target, key, descr);
}
return target;
}
})();
}());
var arr_remove,
arr_each,
arr_indexOf,
arr_contains,
arr_pushMany,
arr_distinct;
(function(){
arr_remove = function (array, x) {
var i = array.indexOf(x);
if (i === -1)
return false;
array.splice(i, 1);
return true;
}
;
arr_each = function (arr, fn, ctx) {
arr.forEach(fn, ctx);
}
;
arr_indexOf = function (arr, x) {
return arr.indexOf(x);
}
;
arr_contains = function (arr, x) {
return arr.indexOf(x) !== -1;
}
;
arr_pushMany = function (arr, arrSource) {
if (arrSource == null || arr == null || arr === arrSource)
return;
var il = arr.length, jl = arrSource.length, j = -1;
while (++j < jl) {
arr[il + j] = arrSource[j];
}
}
;
arr_distinct = function (arr, compareFn) {
var out = [];
var hash = compareFn == null ? obj_create(null) : null;
outer: for (var i = 0; i < arr.length; i++) {
var x = arr[i];
if (compareFn == null) {
if (hash[x] === 1) {
continue;
}
hash[x] = 1;
}
else {
for (var j = i - 1; j > -1; j--) {
var prev = arr[j];
if (compareFn(x, prev)) {
continue outer;
}
}
}
out.push(x);
}
return out;
}
}());
var fn_proxy,
fn_apply,
fn_doNothing,
fn_createByPattern;
(function(){
fn_proxy = function (fn, ctx) {
return function () {
var imax = arguments.length, args = new Array(imax), i = 0;
for (; i < imax; i++)
args[i] = arguments[i];
return fn_apply(fn, ctx, args);
};
}
;
fn_apply = function (fn, ctx, args) {
var l = args.length;
if (0 === l)
return fn.call(ctx);
if (1 === l)
return fn.call(ctx, args[0]);
if (2 === l)
return fn.call(ctx, args[0], args[1]);
if (3 === l)
return fn.call(ctx, args[0], args[1], args[2]);
if (4 === l)
return fn.call(ctx, args[0], args[1], args[2], args[3]);
return fn.apply(ctx, args);
}
;
fn_doNothing = function () {
return false;
}
;
fn_createByPattern = function (definitions, ctx) {
var imax = definitions.length;
return function () {
var l = arguments.length, i = -1, def;
outer: while (++i < imax) {
def = definitions[i];
if (def.pattern.length !== l) {
continue;
}
var j = -1;
while (++j < l) {
var fn = def.pattern[j];
var val = arguments[j];
if (fn(val) === false) {
continue outer;
}
}
return def.handler.apply(ctx, arguments);
}
console.error('InvalidArgumentException for a function', definitions, arguments);
return null;
};
}
;
}());
var str_format,
str_dedent;
(function(){
str_format = function (str_, a, b, c, d) {
var str = str_, imax = arguments.length, i = 0, x;
while (++i < imax) {
x = arguments[i];
if (is_Object(x) && x.toJSON) {
x = x.toJSON();
}
str_ = str_.replace(rgxNum(i - 1), String(x));
}
return str_;
}
;
str_dedent = function (str) {
var rgx = /^[\t ]*\S/gm, match = rgx.exec(str), count = -1;
while (match != null) {
var x = match[0].length;
if (count === -1 || x < count)
count = x;
match = rgx.exec(str);
}
if (--count < 1)
return str;
var replacer = new RegExp('^[\\t ]{1,' + count + '}', 'gm');
return str
.replace(replacer, '')
.replace(/^[\t ]*\r?\n/, '')
.replace(/\r?\n[\t ]*$/, '');
}
;
var rgxNum;
(function () {
rgxNum = function (num) {
return cache_[num] || (cache_[num] = new RegExp('\\{' + num + '\\}', 'g'));
};
var cache_ = {};
}());
}());
var class_create,
class_createEx;
(function(){
;
/**
* create([...Base], Proto)
* Base: Function | Object
* Proto: Object {
* constructor: ?Function
* ...
*/
class_create = createClassFactory(obj_extendDefaults);
// with property accessor functions support
class_createEx = createClassFactory(obj_extendPropertiesDefaults);
function createClassFactory(extendDefaultsFn) {
return function (a, b, c, d, e, f, g, h) {
var args = _Array_slice.call(arguments), Proto = args.pop();
if (Proto == null)
Proto = {};
var Ctor;
if (Proto.hasOwnProperty('constructor')) {
Ctor = Proto.constructor;
if (Ctor.prototype === void 0) {
var es6Method = Ctor;
Ctor = function ClassCtor() {
var imax = arguments.length, i = -1, args = new Array(imax);
while (++i < imax)
args[i] = arguments[i];
return es6Method.apply(this, args);
};
}
}
else {
Ctor = function ClassCtor() { };
}
var i = args.length, BaseCtor, x;
while (--i > -1) {
x = args[i];
if (typeof x === 'function') {
BaseCtor = wrapFn(x, BaseCtor);
x = x.prototype;
}
extendDefaultsFn(Proto, x);
}
return createClass(wrapFn(BaseCtor, Ctor), Proto);
};
}
function createClass(Ctor, Proto) {
Proto.constructor = Ctor;
Ctor.prototype = Proto;
return Ctor;
}
function wrapFn(fnA, fnB) {
if (fnA == null) {
return fnB;
}
if (fnB == null) {
return fnA;
}
return function () {
var args = _Array_slice.call(arguments);
var x = fnA.apply(this, args);
if (x !== void 0)
return x;
return fnB.apply(this, args);
};
}
}());
var error_createClass,
error_formatSource,
error_cursor,
error_formatCursor;
(function(){
error_createClass = function (name, Proto, stackSliceFrom) {
var Ctor = _createCtor(Proto, stackSliceFrom);
Ctor.prototype = new Error;
Proto.constructor = Error;
Proto.name = name;
obj_extend(Ctor.prototype, Proto);
return Ctor;
}
;
error_formatSource = function (source, index, filename) {
var cursor = error_cursor(source, index), lines = cursor[0], lineNum = cursor[1], rowNum = cursor[2], str = '';
if (filename != null) {
str += str_format(' at {0}:{1}:{2}\n', filename, lineNum, rowNum);
}
return str + error_formatCursor(lines, lineNum, rowNum);
}
;
/**
* @returns [ lines, lineNum, rowNum ]
*/
error_cursor = function (str, index) {
var lines = str.substring(0, index).split('\n'), line = lines.length, row = index + 1 - lines.slice(0, line - 1).join('\n').length;
if (line > 1) {
// remove trailing newline
row -= 1;
}
return [str.split('\n'), line, row];
}
;
error_formatCursor = function (lines, lineNum, rowNum) {
var BEFORE = 3, AFTER = 2, i = lineNum - BEFORE, imax = i + BEFORE + AFTER, str = '';
if (i < 0)
i = 0;
if (imax > lines.length)
imax = lines.length;
var lineNumberLength = String(imax).length, lineNumber;
for (; i < imax; i++) {
if (str)
str += '\n';
lineNumber = ensureLength(i + 1, lineNumberLength);
str += lineNumber + '|' + lines[i];
if (i + 1 === lineNum) {
str += '\n' + repeat(' ', lineNumberLength + 1);
str += lines[i].substring(0, rowNum - 1).replace(/[^\s]/g, ' ');
str += '^';
}
}
return str;
}
;
function ensureLength(num, count) {
var str = String(num);
while (str.length < count) {
str += ' ';
}
return str;
}
function repeat(char_, count) {
var str = '';
while (--count > -1) {
str += char_;
}
return str;
}
function _createCtor(Proto, stackFrom) {
var Ctor = Proto.hasOwnProperty('constructor')
? Proto.constructor
: null;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
obj_defineProperty(this, 'stack', {
value: _prepairStack(stackFrom || 3)
});
obj_defineProperty(this, 'message', {
value: str_format.apply(this, arguments)
});
if (Ctor != null) {
Ctor.apply(this, arguments);
}
};
}
function _prepairStack(sliceFrom) {
var stack = new Error().stack;
return stack == null ? null : stack
.split('\n')
.slice(sliceFrom)
.join('\n');
}
}());
var class_Dfr;
(function(){
;
class_Dfr = function () { };
class_Dfr.prototype = {
_isAsync: true,
_done: null,
_fail: null,
_always: null,
_resolved: null,
_rejected: null,
defer: function () {
this._rejected = null;
this._resolved = null;
return this;
},
isResolved: function () {
return this._resolved != null;
},
isRejected: function () {
return this._rejected != null;
},
isBusy: function () {
return this._resolved == null && this._rejected == null;
},
resolve: function () {
var done = this._done, always = this._always;
this._resolved = arguments;
dfr_clearListeners(this);
arr_callOnce(done, this, arguments);
arr_callOnce(always, this, [this]);
return this;
},
reject: function () {
var fail = this._fail, always = this._always;
this._rejected = arguments;
dfr_clearListeners(this);
arr_callOnce(fail, this, arguments);
arr_callOnce(always, this, [this]);
return this;
},
then: function (filterSuccess, filterError) {
return this.pipe(filterSuccess, filterError);
},
done: function (callback) {
if (this._rejected != null)
return this;
return dfr_bind(this, this._resolved, this._done || (this._done = []), callback);
},
fail: function (callback) {
if (this._resolved != null)
return this;
return dfr_bind(this, this._rejected, this._fail || (this._fail = []), callback);
},
always: function (callback) {
return dfr_bind(this, this._rejected || this._resolved, this._always || (this._always = []), callback);
},
pipe: function (mix /* ..methods */) {
var dfr;
if (typeof mix === 'function') {
dfr = new class_Dfr();
var done_ = mix, fail_ = arguments.length > 1
? arguments[1]
: null;
this
.done(delegate(dfr, 'resolve', done_))
.fail(delegate(dfr, 'reject', fail_));
return dfr;
}
dfr = mix;
var imax = arguments.length, done = imax === 1, fail = imax === 1, i = 0, x;
while (++i < imax) {
x = arguments[i];
switch (x) {
case 'done':
done = true;
break;
case 'fail':
fail = true;
break;
default:
console.error('Unsupported pipe channel', arguments[i]);
break;
}
}
done && this.done(delegate(dfr, 'resolve'));
fail && this.fail(delegate(dfr, 'reject'));
function pipe(dfr, method) {
return function () {
dfr[method].apply(dfr, arguments);
};
}
function delegate(dfr, name, fn) {
return function () {
if (fn != null) {
var override = fn.apply(this, arguments);
if (override != null && override !== dfr) {
if (isDeferred(override)) {
override.then(delegate(dfr, 'resolve'), delegate(dfr, 'reject'));
return;
}
dfr[name](override);
return;
}
}
dfr[name].apply(dfr, arguments);
};
}
return this;
},
pipeCallback: function () {
var self = this;
return function (error) {
if (error != null) {
self.reject(error);
return;
}
var args = _Array_slice.call(arguments, 1);
fn_apply(self.resolve, self, args);
};
},
resolveDelegate: function () {
return fn_proxy(this.resolve, this);
},
rejectDelegate: function () {
return fn_proxy(this.reject, this);
},
catch: function (cb) {
return this.fail(cb);
},
finally: function (cb) {
return this.always(cb);
}
};
var static_Dfr = {
resolve: function (a, b, c) {
var dfr = new class_Dfr();
return dfr.resolve.apply(dfr, _Array_slice.call(arguments));
},
reject: function (error) {
var dfr = new class_Dfr();
return dfr.reject(error);
},
run: function (fn, ctx) {
var dfr = new class_Dfr();
if (ctx == null)
ctx = dfr;
fn.call(ctx, fn_proxy(dfr.resolve, ctx), fn_proxy(dfr.reject, dfr), dfr);
return dfr;
},
all: function (promises) {
var dfr = new class_Dfr, arr = new Array(promises.length), wait = promises.length, error = null;
if (wait === 0) {
return dfr.resolve(arr);
}
function tick(index) {
if (error != null) {
return;
}
var args = _Array_slice.call(arguments, 1);
arr.splice.apply(arr, [index, 0].concat(args));
if (--wait === 0) {
dfr.resolve(arr);
}
}
function onReject(err) {
dfr.reject(error = err);
}
var imax = promises.length, i = -1;
while (++i < imax) {
var x = promises[i];
if (x == null || x.then == null) {
tick(i);
continue;
}
x.then(tick.bind(null, i), onReject);
}
return dfr;
}
};
class_Dfr.resolve = static_Dfr.resolve;
class_Dfr.reject = static_Dfr.reject;
class_Dfr.run = static_Dfr.run;
class_Dfr.all = static_Dfr.all;
// PRIVATE
function dfr_bind(dfr, arguments_, listeners, callback) {
if (callback == null)
return dfr;
if (arguments_ != null)
fn_apply(callback, dfr, arguments_);
else
listeners.push(callback);
return dfr;
}
function dfr_clearListeners(dfr) {
dfr._done = null;
dfr._fail = null;
dfr._always = null;
}
function arr_callOnce(arr, ctx, args) {
if (arr == null)
return;
var imax = arr.length, i = -1, fn;
while (++i < imax) {
fn = arr[i];
if (fn)
fn_apply(fn, ctx, args);
}
arr.length = 0;
}
function isDeferred(x) {
return x != null
&& typeof x === 'object'
&& is_Function(x.then);
}
}());
var class_EventEmitter;
(function(){
class_EventEmitter = function () {
this._listeners = {};
};
class_EventEmitter.prototype = {
on: function (event, fn) {
if (fn != null) {
(this._listeners[event] || (this._listeners[event] = [])).push(fn);
}
return this;
},
once: function (event, fn) {
if (fn != null) {
fn._once = true;
(this._listeners[event] || (this._listeners[event] = [])).push(fn);
}
return this;
},
pipe: function (event) {
var that = this, args;
return function () {
args = _Array_slice.call(arguments);
args.unshift(event);
fn_apply(that.trigger, that, args);
};
},
emit: event_trigger,
trigger: event_trigger,
off: function (event, fn) {
var listeners = this._listeners[event];
if (listeners == null)
return this;
if (arguments.length === 1) {
listeners.length = 0;
return this;
}
var imax = listeners.length, i = -1;
while (++i < imax) {
if (listeners[i] === fn) {
listeners.splice(i, 1);
i--;
imax--;
}
}
return this;
}
};
function event_trigger(event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var fns = this._listeners[event];
if (fns == null) {
return this;
}
for (var i = 0; i < fns.length; i++) {
var fn = fns[i];
fn_apply(fn, this, args);
if (fn !== fns[i]) {
// the callback has removed itself
i--;
continue;
}
if (fn._once === true) {
fns.splice(i, 1);
i--;
}
}
return this;
}
}());
var class_Uri;
(function(){
class_Uri = class_create({
protocol: null,
value: null,
path: null,
file: null,
extension: null,
constructor: function (uri) {
if (uri == null)
return this;
if (util_isUri(uri))
return uri.combine('');
uri = normalize_uri(uri);
this.value = uri;
parse_protocol(this);
parse_host(this);
parse_search(this);
parse_file(this);
// normilize path - "/some/path"
this.path = normalize_pathsSlashes(this.value);
if (/^[\w]+:\//.test(this.path)) {
this.path = '/' + this.path;
}
return this;
},
cdUp: function () {
var path = this.path;
if (path == null || path === '' || path === '/') {
return this;
}
// win32 - is base drive
if (/^\/?[a-zA-Z]+:\/?$/.test(path)) {
return this;
}
this.path = path.replace(/\/?[^\/]+\/?$/i, '');
return this;
},
/**
* '/path' - relative to host
* '../path', 'path','./path' - relative to current path
*/
combine: function (path) {
if (util_isUri(path)) {
path = path.toString();
}
if (!path) {
return util_clone(this);
}
if (rgx_win32Drive.test(path)) {
return new class_Uri(path);
}
var uri = util_clone(this);
uri.value = path;
parse_search(uri);
parse_file(uri);
if (!uri.value) {
return uri;
}
path = uri.value.replace(/^\.\//i, '');
if (path[0] === '/') {
uri.path = path;
return uri;
}
while (/^(\.\.\/?)/ig.test(path)) {
uri.cdUp();
path = path.substring(3);
}
uri.path = normalize_pathsSlashes(util_combinePathes(uri.path, path));
return uri;
},
toString: function () {
var protocol = this.protocol ? this.protocol + '://' : '';
var path = util_combinePathes(this.host, this.path, this.file) + (this.search || '');
var str = protocol + path;
if (!(this.file || this.search) && this.path) {
str += '/';
}
return str;
},
toPathAndQuery: function () {
return util_combinePathes(this.path, this.file) + (this.search || '');
},
/**
* @return Current Uri Path{String} that is relative to @arg1 Uri
*/
toRelativeString: function (uri) {
if (typeof uri === 'string')
uri = new class_Uri(uri);
if (this.path.indexOf(uri.path) === 0) {
// host folder
var p = this.path ? this.path.replace(uri.path, '') : '';
if (p[0] === '/')
p = p.substring(1);
return util_combinePathes(p, this.file) + (this.search || '');
}
// sub folder
var current = this.path.split('/'), relative = uri.path.split('/'), commonpath = '', i = 0, length = Math.min(current.length, relative.length);
for (; i < length; i++) {
if (current[i] === relative[i])
continue;
break;
}
if (i > 0)
commonpath = current.splice(0, i).join('/');
if (commonpath) {
var sub = '', path = uri.path, forward;
while (path) {
if (this.path.indexOf(path) === 0) {
forward = this.path.replace(path, '');
break;
}
path = path.replace(/\/?[^\/]+\/?$/i, '');
sub += '../';
}
return util_combinePathes(sub, forward, this.file);
}
return this.toString();
},
toLocalFile: function () {
var path = util_combinePathes(this.host, this.path, this.file);
return util_win32Path(path);
},
toLocalDir: function () {
var path = util_combinePathes(this.host, this.path, '/');
return util_win32Path(path);
},
toDir: function () {
var str = this.protocol ? this.protocol + '://' : '';
return str + util_combinePathes(this.host, this.path, '/');
},
isRelative: function () {
return !(this.protocol || this.host);
},
getName: function () {
return this.file.replace('.' + this.extension, '');
}
});
var rgx_protocol = /^([\w\d]+):\/\//, rgx_extension = /\.([\w\d]+)$/i, rgx_win32Drive = /(^\/?\w{1}:)(\/|$)/, rgx_fileWithExt = /([^\/]+(\.[\w\d]+)?)$/i;
function util_isUri(object) {
return object && typeof object === 'object' && typeof object.combine === 'function';
}
function util_combinePathes(a, b, c, d) {
var args = arguments, str = '';
for (var i = 0, x, imax = arguments.length; i < imax; i++) {
x = arguments[i];
if (!x)
continue;
if (!str) {
str = x;
continue;
}
if (str[str.length - 1] !== '/')
str += '/';
str += x[0] === '/' ? x.substring(1) : x;
}
return str;
}
function normalize_pathsSlashes(str) {
if (str[str.length - 1] === '/') {
return str.substring(0, str.length - 1);
}
return str;
}
function util_clone(source) {
var uri = new class_Uri(), key;
for (key in source) {
if (typeof source[key] === 'string') {
uri[key] = source[key];
}
}
return uri;
}
function normalize_uri(str) {
return str
.replace(/\\/g, '/')
.replace(/^\.\//, '')
// win32 drive path
.replace(/^(\w+):\/([^\/])/, '/$1:/$2');
}
function util_win32Path(path) {
if (rgx_win32Drive.test(path) && path[0] === '/') {
return path.substring(1);
}
return path;
}
function parse_protocol(obj) {
var match = rgx_protocol.exec(obj.value);
if (match == null && obj.value[0] === '/') {
obj.protocol = 'file';
}
if (match == null)
return;
obj.protocol = match[1];
obj.value = obj.value.substring(match[0].length);
}
function parse_host(obj) {
if (obj.protocol == null)
return;
if (obj.protocol === 'file') {
var match = rgx_win32Drive.exec(obj.value);
if (match) {
obj.host = match[1];
obj.value = obj.value.substring(obj.host.length);
}
return;
}
var pathStart = obj.value.indexOf('/', 2);
obj.host = ~pathStart
? obj.value.substring(0, pathStart)
: obj.value;
obj.value = obj.value.replace(obj.host, '');
}
function parse_search(obj) {
var question = obj.value.indexOf('?');
if (question === -1)
return;
obj.search = obj.value.substring(question);
obj.value = obj.value.substring(0, question);
}
function parse_file(obj) {
var match = rgx_fileWithExt.exec(obj.value), file = match == null ? null : match[1];
if (file == null) {
return;
}
obj.file = file;
obj.value = obj.value.substring(0, obj.value.length - file.length);
obj.value = normalize_pathsSlashes(obj.value);
match = rgx_extension.exec(file);
obj.extension = match == null ? null : match[1];
}
class_Uri.combinePathes = util_combinePathes;
class_Uri.combine = util_combinePathes;
}());
(function(){

@@ -1333,2 +25,23 @@ if (String.prototype.trim == null) {

(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._document = exports._global = exports._Object_defineProperty = exports._Object_getOwnProp = exports._Object_hasOwnProp = exports._Array_indexOf = exports._Array_splice = exports._Array_slice = void 0;
exports._Array_slice = Array.prototype.slice;
exports._Array_splice = Array.prototype.splice;
exports._Array_indexOf = Array.prototype.indexOf;
exports._Object_hasOwnProp = Object.hasOwnProperty;
exports._Object_getOwnProp = Object.getOwnPropertyDescriptor;
exports._Object_defineProperty = Object.defineProperty;
exports._global = typeof global !== 'undefined'
? global
: window;
exports._document = typeof window !== 'undefined' && window.document != null
? window.document
: null;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var refs_1 = require("../refs");
if (Function.prototype.bind == null) {

@@ -1338,5 +51,5 @@ Function.prototype.bind = function () {

return this;
var fn = this, args = _Array_slice.call(arguments), ctx = args.shift();
var fn = this, args = refs_1._Array_slice.call(arguments), ctx = args.shift();
return function () {
return fn.apply(ctx, args.concat(_Array_slice.call(arguments)));
return fn.apply(ctx, args.concat(refs_1._Array_slice.call(arguments)));
};

@@ -1347,7 +60,1371 @@ };

}());
var mixin;
(function(){
var class_inherit,
class_extendProtoObjects;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.coll_find = exports.coll_map = exports.coll_remove = exports.coll_indexOf = exports.coll_each = void 0;
function coll_each(coll, fn, ctx) {
if (ctx == null)
ctx = coll;
if (coll == null)
return coll;
var imax = coll.length, i = 0;
for (; i < imax; i++) {
fn.call(ctx, coll[i], i);
}
return ctx;
}
exports.coll_each = coll_each;
;
function coll_indexOf(coll, x) {
if (coll == null)
return -1;
var imax = coll.length, i = 0;
for (; i < imax; i++) {
if (coll[i] === x)
return i;
}
return -1;
}
exports.coll_indexOf = coll_indexOf;
;
function coll_remove(coll, x) {
var i = coll_indexOf(coll, x);
if (i === -1)
return false;
coll.splice(i, 1);
return true;
}
exports.coll_remove = coll_remove;
;
function coll_map(coll, fn, ctx) {
var arr = new Array(coll.length);
coll_each(coll, function (x, i) {
arr[i] = fn.call(this, x, i);
}, ctx);
return arr;
}
exports.coll_map = coll_map;
;
function coll_find(coll, fn, ctx) {
var imax = coll.length, i = 0;
for (; i < imax; i++) {
if (fn.call(ctx || coll, coll[i], i))
return true;
}
return false;
}
exports.coll_find = coll_find;
;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var coll_1 = require("../coll");
if (Array.prototype.forEach === void 0) {
Array.prototype.forEach = function (fn, ctx) {
coll_1.coll_each(this, fn, ctx);
};
}
if (Array.prototype.indexOf === void 0) {
Array.prototype.indexOf = function (x) {
return coll_1.coll_indexOf(this, x);
};
}
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is_NODE = exports.is_DOM = exports.is_Observable = exports.is_PromiseLike = exports.is_Date = exports.is_rawObject = exports.is_notEmptyString = exports.is_String = exports.is_ArrayLike = exports.is_Array = exports.is_Object = exports.is_Function = void 0;
function is_Function(x) {
return typeof x === 'function';
}
exports.is_Function = is_Function;
function is_Object(x) {
return x != null && typeof x === 'object';
}
exports.is_Object = is_Object;
function is_Array(arr) {
return (arr != null &&
typeof arr === 'object' &&
typeof arr.length === 'number' &&
typeof arr.slice === 'function');
}
exports.is_Array = is_Array;
exports.is_ArrayLike = is_Array;
function is_String(x) {
return typeof x === 'string';
}
exports.is_String = is_String;
function is_notEmptyString(x) {
return typeof x === 'string' && x !== '';
}
exports.is_notEmptyString = is_notEmptyString;
function is_rawObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
exports.is_rawObject = is_rawObject;
function is_Date(x) {
if (x == null || typeof x !== 'object') {
return false;
}
if (x.getFullYear != null && isNaN(x) === false) {
return true;
}
return false;
}
exports.is_Date = is_Date;
function is_PromiseLike(x) {
return x != null && typeof x === 'object' && typeof x.then === 'function';
}
exports.is_PromiseLike = is_PromiseLike;
function is_Observable(x) {
return x != null && typeof x === 'object' && typeof x.subscribe === 'function';
}
exports.is_Observable = is_Observable;
exports.is_DOM = typeof window !== 'undefined' && window.navigator != null;
exports.is_NODE = !exports.is_DOM;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.obj_extendDescriptorsDefaults = exports.obj_extendDescriptors = exports.obj_clean = exports.obj_defaults = exports.obj_create = exports._Object_create = exports.obj_toFastProps = exports.obj_extendMany = exports.obj_extendPropertiesDefaults = exports.obj_extendProperties = exports.obj_extendDefaults = exports.obj_extend = exports.obj_defineProperty = exports.obj_hasProperty = exports.obj_setProperty = exports.obj_getProperty = exports.obj_copyProperty = void 0;
var is_1 = require("./is");
var refs_1 = require("./refs");
var getDescriptor = Object.getOwnPropertyDescriptor;
var defineDescriptor = Object.defineProperty;
var obj_copyProperty = getDescriptor == null
? function (target, source, key) { return target[key] = source[key]; }
: function (target, source, key) {
var descr = getDescriptor(source, key);
if (descr == null) {
target[key] = source[key];
return;
}
if (descr.value !== void 0) {
target[key] = descr.value;
return;
}
defineDescriptor(target, key, descr);
};
exports.obj_copyProperty = obj_copyProperty;
function obj_getProperty(obj_, path) {
if (obj_ == null) {
return null;
}
if (path.indexOf('.') === -1) {
return obj_[path];
}
var obj = obj_, chain = path.split('.'), imax = chain.length, i = -1;
while (obj != null && ++i < imax) {
var key = chain[i];
if (key.charCodeAt(key.length - 1) === 63 /*?*/) {
key = key.slice(0, -1);
}
obj = obj[key];
}
return obj;
}
exports.obj_getProperty = obj_getProperty;
;
function obj_setProperty(obj_, path, val) {
if (path.indexOf('.') === -1) {
obj_[path] = val;
return;
}
var obj = obj_, chain = path.split('.'), imax = chain.length - 1, i = -1, key;
while (++i < imax) {
key = chain[i];
if (key.charCodeAt(key.length - 1) === 63 /*?*/) {
key = key.slice(0, -1);
}
var x = obj[key];
if (x == null) {
x = obj[key] = {};
}
obj = x;
}
obj[chain[i]] = val;
}
exports.obj_setProperty = obj_setProperty;
;
function obj_hasProperty(obj, path) {
var x = obj_getProperty(obj, path);
return x !== void 0;
}
exports.obj_hasProperty = obj_hasProperty;
;
function obj_defineProperty(obj, path, dscr) {
var x = obj, chain = path.split('.'), imax = chain.length - 1, i = -1, key;
while (++i < imax) {
key = chain[i];
if (x[key] == null)
x[key] = {};
x = x[key];
}
key = chain[imax];
if (refs_1._Object_defineProperty) {
if (dscr.writable === void 0)
dscr.writable = true;
if (dscr.configurable === void 0)
dscr.configurable = true;
if (dscr.enumerable === void 0)
dscr.enumerable = true;
refs_1._Object_defineProperty(x, key, dscr);
return;
}
x[key] = dscr.value === void 0
? dscr.value
: (dscr.get && dscr.get());
}
exports.obj_defineProperty = obj_defineProperty;
;
function obj_extend(a, b) {
if (b == null)
return a || {};
if (a == null)
return exports.obj_create(b);
for (var key in b) {
a[key] = b[key];
}
return a;
}
exports.obj_extend = obj_extend;
;
function obj_extendDefaults(a, b) {
if (b == null)
return a || {};
if (a == null)
return exports.obj_create(b);
for (var key in b) {
if (a[key] == null) {
a[key] = b[key];
continue;
}
if (key === 'toString' && a[key] === Object.prototype.toString) {
a[key] = b[key];
}
}
return a;
}
exports.obj_extendDefaults = obj_extendDefaults;
var extendPropertiesFactory = function (overwriteProps) {
if (refs_1._Object_getOwnProp == null)
return overwriteProps ? obj_extend : obj_extendDefaults;
return function (a, b) {
if (b == null)
return a || {};
if (a == null)
return exports.obj_create(b);
var key, descr, ownDescr;
for (key in b) {
descr = refs_1._Object_getOwnProp(b, key);
if (descr == null)
continue;
if (overwriteProps !== true) {
ownDescr = refs_1._Object_getOwnProp(a, key);
if (ownDescr != null) {
continue;
}
}
if (descr.hasOwnProperty('value')) {
a[key] = descr.value;
continue;
}
refs_1._Object_defineProperty(a, key, descr);
}
return a;
};
};
exports.obj_extendProperties = extendPropertiesFactory(true);
exports.obj_extendPropertiesDefaults = extendPropertiesFactory(false);
function obj_extendMany(a, arg1, arg2, arg3, arg4, arg5, arg6) {
var imax = arguments.length, i = 1;
for (; i < imax; i++) {
a = obj_extend(a, arguments[i]);
}
return a;
}
exports.obj_extendMany = obj_extendMany;
;
function obj_toFastProps(obj) {
/*jshint -W027*/
function F() { }
F.prototype = obj;
new F();
return;
eval(obj);
}
exports.obj_toFastProps = obj_toFastProps;
;
exports._Object_create = Object.create || function (x) {
var Ctor = function () { };
Ctor.prototype = x;
return new Ctor;
};
exports.obj_create = exports._Object_create;
function obj_defaults(target, defaults) {
for (var key in defaults) {
if (target[key] == null)
target[key] = defaults[key];
}
return target;
}
exports.obj_defaults = obj_defaults;
/**
* Remove all NULL properties, optionally also all falsy-ies
*/
function obj_clean(json, opts) {
var _a;
if (opts === void 0) { opts = {
removePrivate: false,
skipProperties: null,
removeEmptyArrays: false,
removeFalsy: false
}; }
if (json == null || typeof json !== 'object') {
return json;
}
if (is_1.is_ArrayLike(json)) {
var arr = json;
var i = 0;
var notNullIndex = -1;
for (; i < arr.length; i++) {
var val = arr[i];
if (val != null) {
notNullIndex = i;
}
obj_clean(val, opts);
}
// clean all last nullable values
if (notNullIndex + 1 < arr.length) {
arr.splice(notNullIndex + 1);
}
return json;
}
if (is_1.is_Object(json)) {
for (var key in json) {
if (opts.skipProperties != null && key in opts.skipProperties) {
delete json[key];
continue;
}
if (opts.ignoreProperties != null && key in opts.ignoreProperties) {
continue;
}
if (opts.removePrivate === true && key[0] === '_') {
delete json[key];
continue;
}
var val = json[key];
if ((_a = opts.shouldRemove) === null || _a === void 0 ? void 0 : _a.call(opts, key, val)) {
delete json[key];
continue;
}
if (isDefault(val, opts)) {
if (opts.strictProperties != null && key in opts.strictProperties && val != null) {
continue;
}
delete json[key];
continue;
}
if (opts.deep !== false) {
obj_clean(val, opts);
}
if (opts.removeEmptyArrays && is_1.is_ArrayLike(val) && val.length === 0) {
delete json[key];
}
}
return json;
}
return json;
}
exports.obj_clean = obj_clean;
function isDefault(x, opts) {
if (x == null) {
return true;
}
if (opts.removeFalsy && (x === '' || x === false)) {
return true;
}
if (opts.removeEmptyArrays && is_1.is_ArrayLike(x) && x.length === 0) {
return true;
}
return false;
}
var obj_extendDescriptors;
exports.obj_extendDescriptors = obj_extendDescriptors;
var obj_extendDescriptorsDefaults;
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults;
(function () {
if (getDescriptor == null) {
exports.obj_extendDescriptors = obj_extendDescriptors = obj_extend;
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults = obj_defaults;
return;
}
exports.obj_extendDescriptors = obj_extendDescriptors = function (target, source) {
return _extendDescriptors(target, source, false);
};
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults = function (target, source) {
return _extendDescriptors(target, source, true);
};
function _extendDescriptors(target, source, defaultsOnly) {
if (target == null)
return {};
if (source == null)
return source;
var descr, key;
for (key in source) {
if (defaultsOnly === true && target[key] != null)
continue;
descr = getDescriptor(source, key);
if (descr == null) {
obj_extendDescriptors(target, source["__proto__"]);
continue;
}
if (descr.value !== void 0) {
target[key] = descr.value;
continue;
}
defineDescriptor(target, key, descr);
}
return target;
}
})();
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arr_distinct = exports.arr_pushMany = exports.arr_contains = exports.arr_indexOf = exports.arr_each = exports.arr_remove = void 0;
var obj_1 = require("./obj");
function arr_remove(array, x) {
var i = array.indexOf(x);
if (i === -1)
return false;
array.splice(i, 1);
return true;
}
exports.arr_remove = arr_remove;
;
function arr_each(arr, fn, ctx) {
arr.forEach(fn, ctx);
}
exports.arr_each = arr_each;
;
function arr_indexOf(arr, x) {
return arr.indexOf(x);
}
exports.arr_indexOf = arr_indexOf;
;
function arr_contains(arr, x) {
return arr.indexOf(x) !== -1;
}
exports.arr_contains = arr_contains;
;
function arr_pushMany(arr, arrSource) {
if (arrSource == null || arr == null || arr === arrSource)
return;
var il = arr.length, jl = arrSource.length, j = -1;
while (++j < jl) {
arr[il + j] = arrSource[j];
}
}
exports.arr_pushMany = arr_pushMany;
;
function arr_distinct(arr, compareFn) {
var out = [];
var hash = compareFn == null ? obj_1.obj_create(null) : null;
outer: for (var i = 0; i < arr.length; i++) {
var x = arr[i];
if (compareFn == null) {
if (hash[x] === 1) {
continue;
}
hash[x] = 1;
}
else {
for (var j = i - 1; j > -1; j--) {
var prev = arr[j];
if (compareFn(x, prev)) {
continue outer;
}
}
}
out.push(x);
}
return out;
}
exports.arr_distinct = arr_distinct;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fn_createByPattern = exports.fn_doNothing = exports.fn_apply = exports.fn_proxy = void 0;
function fn_proxy(fn, ctx) {
return function () {
var imax = arguments.length, args = new Array(imax), i = 0;
for (; i < imax; i++)
args[i] = arguments[i];
return fn_apply(fn, ctx, args);
};
}
exports.fn_proxy = fn_proxy;
;
function fn_apply(fn, ctx, args) {
var l = args.length;
if (0 === l)
return fn.call(ctx);
if (1 === l)
return fn.call(ctx, args[0]);
if (2 === l)
return fn.call(ctx, args[0], args[1]);
if (3 === l)
return fn.call(ctx, args[0], args[1], args[2]);
if (4 === l)
return fn.call(ctx, args[0], args[1], args[2], args[3]);
return fn.apply(ctx, args);
}
exports.fn_apply = fn_apply;
;
function fn_doNothing() {
return false;
}
exports.fn_doNothing = fn_doNothing;
;
function fn_createByPattern(definitions, ctx) {
var imax = definitions.length;
return function () {
var l = arguments.length, i = -1, def;
outer: while (++i < imax) {
def = definitions[i];
if (def.pattern.length !== l) {
continue;
}
var j = -1;
while (++j < l) {
var fn = def.pattern[j];
var val = arguments[j];
if (fn(val) === false) {
continue outer;
}
}
return def.handler.apply(ctx, arguments);
}
console.error('InvalidArgumentException for a function', definitions, arguments);
return null;
};
}
exports.fn_createByPattern = fn_createByPattern;
;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.str_dedent = exports.str_format = void 0;
var is_1 = require("./is");
function str_format(str_, a, b, c, d) {
var str = str_, imax = arguments.length, i = 0, x;
while (++i < imax) {
x = arguments[i];
if (is_1.is_Object(x) && x.toJSON) {
x = x.toJSON();
}
str_ = str_.replace(rgxNum(i - 1), String(x));
}
return str_;
}
exports.str_format = str_format;
;
function str_dedent(str) {
var rgx = /^[\t ]*\S/gm, match = rgx.exec(str), count = -1;
while (match != null) {
var x = match[0].length;
if (count === -1 || x < count)
count = x;
match = rgx.exec(str);
}
if (--count < 1)
return str;
var replacer = new RegExp('^[\\t ]{1,' + count + '}', 'gm');
return str
.replace(replacer, '')
.replace(/^[\t ]*\r?\n/, '')
.replace(/\r?\n[\t ]*$/, '');
}
exports.str_dedent = str_dedent;
;
var rgxNum;
(function () {
rgxNum = function (num) {
return cache_[num] || (cache_[num] = new RegExp('\\{' + num + '\\}', 'g'));
};
var cache_ = {};
}());
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_createEx = exports.class_create = void 0;
var obj_1 = require("./obj");
var refs_1 = require("./refs");
;
/**
* create([...Base], Proto)
* Base: Function | Object
* Proto: Object {
* constructor: ?Function
* ...
*/
exports.class_create = createClassFactory(obj_1.obj_extendDefaults);
// with property accessor functions support
exports.class_createEx = createClassFactory(obj_1.obj_extendPropertiesDefaults);
function createClassFactory(extendDefaultsFn) {
return function (a, b, c, d, e, f, g, h) {
var args = refs_1._Array_slice.call(arguments), Proto = args.pop();
if (Proto == null)
Proto = {};
var Ctor;
if (Proto.hasOwnProperty('constructor')) {
Ctor = Proto.constructor;
if (Ctor.prototype === void 0) {
var es6Method = Ctor;
Ctor = function ClassCtor() {
var imax = arguments.length, i = -1, args = new Array(imax);
while (++i < imax)
args[i] = arguments[i];
return es6Method.apply(this, args);
};
}
}
else {
Ctor = function ClassCtor() { };
}
var i = args.length, BaseCtor, x;
while (--i > -1) {
x = args[i];
if (typeof x === 'function') {
BaseCtor = wrapFn(x, BaseCtor);
x = x.prototype;
}
extendDefaultsFn(Proto, x);
}
return createClass(wrapFn(BaseCtor, Ctor), Proto);
};
}
function createClass(Ctor, Proto) {
Proto.constructor = Ctor;
Ctor.prototype = Proto;
return Ctor;
}
function wrapFn(fnA, fnB) {
if (fnA == null) {
return fnB;
}
if (fnB == null) {
return fnA;
}
return function () {
var args = refs_1._Array_slice.call(arguments);
var x = fnA.apply(this, args);
if (x !== void 0)
return x;
return fnB.apply(this, args);
};
}
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.error_formatCursor = exports.error_cursor = exports.error_formatSource = exports.error_createClass = void 0;
var obj_1 = require("./obj");
var str_1 = require("./str");
function error_createClass(name, Proto, stackSliceFrom) {
var Ctor = _createCtor(Proto, stackSliceFrom);
Ctor.prototype = new Error;
Proto.constructor = Error;
Proto.name = name;
obj_1.obj_extend(Ctor.prototype, Proto);
return Ctor;
}
exports.error_createClass = error_createClass;
;
function error_formatSource(source, index, filename) {
var cursor = error_cursor(source, index), lines = cursor[0], lineNum = cursor[1], rowNum = cursor[2], str = '';
if (filename != null) {
str += str_1.str_format(' at {0}:{1}:{2}\n', filename, lineNum, rowNum);
}
return str + error_formatCursor(lines, lineNum, rowNum);
}
exports.error_formatSource = error_formatSource;
;
/**
* @returns [ lines, lineNum, rowNum ]
*/
function error_cursor(str, index) {
var lines = str.substring(0, index).split('\n'), line = lines.length, row = index + 1 - lines.slice(0, line - 1).join('\n').length;
if (line > 1) {
// remove trailing newline
row -= 1;
}
return [str.split('\n'), line, row];
}
exports.error_cursor = error_cursor;
;
function error_formatCursor(lines, lineNum, rowNum) {
var BEFORE = 3, AFTER = 2, i = lineNum - BEFORE, imax = i + BEFORE + AFTER, str = '';
if (i < 0)
i = 0;
if (imax > lines.length)
imax = lines.length;
var lineNumberLength = String(imax).length, lineNumber;
for (; i < imax; i++) {
if (str)
str += '\n';
lineNumber = ensureLength(i + 1, lineNumberLength);
str += lineNumber + '|' + lines[i];
if (i + 1 === lineNum) {
str += '\n' + repeat(' ', lineNumberLength + 1);
str += lines[i].substring(0, rowNum - 1).replace(/[^\s]/g, ' ');
str += '^';
}
}
return str;
}
exports.error_formatCursor = error_formatCursor;
;
function ensureLength(num, count) {
var str = String(num);
while (str.length < count) {
str += ' ';
}
return str;
}
function repeat(char_, count) {
var str = '';
while (--count > -1) {
str += char_;
}
return str;
}
function _createCtor(Proto, stackFrom) {
var Ctor = Proto.hasOwnProperty('constructor')
? Proto.constructor
: null;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
obj_1.obj_defineProperty(this, 'stack', {
value: _prepairStack(stackFrom || 3)
});
obj_1.obj_defineProperty(this, 'message', {
value: str_1.str_format.apply(this, arguments)
});
if (Ctor != null) {
Ctor.apply(this, arguments);
}
};
}
function _prepairStack(sliceFrom) {
var stack = new Error().stack;
return stack == null ? null : stack
.split('\n')
.slice(sliceFrom)
.join('\n');
}
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_Dfr = void 0;
var fn_1 = require("../fn");
var is_1 = require("../is");
var refs_1 = require("../refs");
var class_Dfr = /** @class */ (function () {
function class_Dfr() {
this._isAsync = true;
this._done = null;
this._fail = null;
this._always = null;
this._resolved = null;
this._rejected = null;
}
class_Dfr.prototype.defer = function () {
this._rejected = null;
this._resolved = null;
return this;
};
class_Dfr.prototype.isResolved = function () {
return this._resolved != null;
};
class_Dfr.prototype.isRejected = function () {
return this._rejected != null;
};
class_Dfr.prototype.isBusy = function () {
return this._resolved == null && this._rejected == null;
};
class_Dfr.prototype.resolve = function (value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var done = this._done, always = this._always;
this._resolved = arguments;
dfr_clearListeners(this);
arr_callOnce(done, this, arguments);
arr_callOnce(always, this, [this]);
return this;
};
class_Dfr.prototype.reject = function (error) {
var fail = this._fail, always = this._always;
this._rejected = arguments;
dfr_clearListeners(this);
arr_callOnce(fail, this, arguments);
arr_callOnce(always, this, [this]);
return this;
};
class_Dfr.prototype.then = function (filterSuccess, filterError) {
var dfr = new class_Dfr();
var done_ = filterSuccess, fail_ = filterError;
this
.done(delegate(dfr, 'resolve', done_))
.fail(delegate(dfr, 'reject', fail_));
return dfr;
};
class_Dfr.prototype.done = function (callback) {
if (this._rejected != null) {
return this;
}
return dfr_bind(this, this._resolved, this._done || (this._done = []), callback);
};
class_Dfr.prototype.fail = function (callback) {
if (this._resolved != null) {
return this;
}
return dfr_bind(this, this._rejected, this._fail || (this._fail = []), callback);
};
class_Dfr.prototype.always = function (callback) {
return dfr_bind(this, this._rejected || this._resolved, this._always || (this._always = []), callback);
};
class_Dfr.prototype.pipe = function (mix /* ..methods */) {
var dfr;
if (typeof mix === 'function') {
dfr = new class_Dfr();
var done_ = mix, fail_ = arguments.length > 1
? arguments[1]
: null;
this
.done(delegate(dfr, 'resolve', done_))
.fail(delegate(dfr, 'reject', fail_));
return dfr;
}
dfr = mix;
var imax = arguments.length, done = imax === 1, fail = imax === 1, i = 0, x;
while (++i < imax) {
x = arguments[i];
switch (x) {
case 'done':
done = true;
break;
case 'fail':
fail = true;
break;
default:
console.error('Unsupported pipe channel', arguments[i]);
break;
}
}
done && this.done(delegate(dfr, 'resolve'));
fail && this.fail(delegate(dfr, 'reject'));
function pipe(dfr, method) {
return function () {
dfr[method].apply(dfr, arguments);
};
}
return this;
};
class_Dfr.prototype.pipeCallback = function () {
var self = this;
return function (error) {
if (error != null) {
self.reject(error);
return;
}
var args = refs_1._Array_slice.call(arguments, 1);
fn_1.fn_apply(self.resolve, self, args);
};
};
class_Dfr.prototype.resolveDelegate = function () {
return fn_1.fn_proxy(this.resolve, this);
};
class_Dfr.prototype.rejectDelegate = function () {
return fn_1.fn_proxy(this.reject, this);
};
class_Dfr.prototype.catch = function (cb) {
return this.fail(cb);
};
class_Dfr.prototype.finally = function (cb) {
return this.always(cb);
};
class_Dfr.resolve = function (a, b, c) {
var dfr = new class_Dfr();
return dfr.resolve.apply(dfr, refs_1._Array_slice.call(arguments));
};
class_Dfr.reject = function (error) {
var dfr = new class_Dfr();
return dfr.reject(error);
};
class_Dfr.run = function (fn, ctx) {
var dfr = new class_Dfr();
if (ctx == null)
ctx = dfr;
fn.call(ctx, fn_1.fn_proxy(dfr.resolve, ctx), fn_1.fn_proxy(dfr.reject, dfr), dfr);
return dfr;
};
class_Dfr.all = function (promises) {
var dfr = new class_Dfr, arr = new Array(promises.length), wait = promises.length, error = null;
if (wait === 0) {
return dfr.resolve(arr);
}
function tick(index) {
if (error != null) {
return;
}
var args = refs_1._Array_slice.call(arguments, 1);
arr.splice.apply(arr, [index, 0].concat(args));
if (--wait === 0) {
dfr.resolve(arr);
}
}
function onReject(err) {
dfr.reject(error = err);
}
var imax = promises.length, i = -1;
while (++i < imax) {
var x = promises[i];
if (x == null || x.then == null) {
tick(i);
continue;
}
x.then(tick.bind(null, i), onReject);
}
return dfr;
};
return class_Dfr;
}());
exports.class_Dfr = class_Dfr;
;
// PRIVATE
function delegate(dfr, name, fn) {
return function () {
if (fn != null) {
var override = fn.apply(this, arguments);
if (override != null && override !== dfr) {
if (isDeferred(override)) {
override.then(delegate(dfr, 'resolve'), delegate(dfr, 'reject'));
return;
}
dfr[name](override);
return;
}
}
dfr[name].apply(dfr, arguments);
};
}
function dfr_bind(dfr, arguments_, listeners, callback) {
if (callback == null)
return dfr;
if (arguments_ != null)
fn_1.fn_apply(callback, dfr, arguments_);
else
listeners.push(callback);
return dfr;
}
function dfr_clearListeners(dfr) {
dfr._done = null;
dfr._fail = null;
dfr._always = null;
}
function arr_callOnce(arr, ctx, args) {
if (arr == null)
return;
var imax = arr.length, i = -1, fn;
while (++i < imax) {
fn = arr[i];
if (fn)
fn_1.fn_apply(fn, ctx, args);
}
arr.length = 0;
}
function isDeferred(x) {
return x != null
&& typeof x === 'object'
&& is_1.is_Function(x.then);
}
}());
(function(){
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_EventEmitter = void 0;
var fn_1 = require("../fn");
var refs_1 = require("../refs");
var class_EventEmitter = /** @class */ (function () {
function class_EventEmitter() {
this._listeners = {};
}
class_EventEmitter.prototype.on = function (event, fn) {
if (fn != null) {
(this._listeners[event] || (this._listeners[event] = [])).push(fn);
}
return this;
};
class_EventEmitter.prototype.once = function (event, fn) {
if (fn != null) {
fn._once = true;
(this._listeners[event] || (this._listeners[event] = [])).push(fn);
}
return this;
};
class_EventEmitter.prototype.pipe = function (event) {
var that = this, args;
return function () {
args = refs_1._Array_slice.call(arguments);
args.unshift(event);
fn_1.fn_apply(that.trigger, that, args);
};
};
class_EventEmitter.prototype.emit = function (event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var fns = this._listeners[event];
if (fns == null) {
return this;
}
for (var i = 0; i < fns.length; i++) {
var fn = fns[i];
fn_1.fn_apply(fn, this, args);
if (fn !== fns[i]) {
// the callback has removed itself
i--;
continue;
}
if (fn._once === true) {
fns.splice(i, 1);
i--;
}
}
return this;
};
class_EventEmitter.prototype.trigger = function (event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return this.emit.apply(this, __spreadArrays([event], args));
};
class_EventEmitter.prototype.off = function (event, fn) {
var listeners = this._listeners[event];
if (listeners == null)
return this;
if (arguments.length === 1) {
listeners.length = 0;
return this;
}
var imax = listeners.length, i = -1;
while (++i < imax) {
if (listeners[i] === fn) {
listeners.splice(i, 1);
i--;
imax--;
}
}
return this;
};
return class_EventEmitter;
}());
exports.class_EventEmitter = class_EventEmitter;
;
}());
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_Uri = void 0;
var class_Uri = /** @class */ (function () {
function class_Uri(uri) {
this.protocol = null;
this.host = null;
this.path = null;
this.file = null;
this.extension = null;
this.search = null;
this.value = null;
if (uri == null) {
return this;
}
if (util_isUri(uri)) {
return util_clone(uri);
}
uri = normalize_path(uri);
this.value = uri;
parse_protocol(this);
parse_host(this);
parse_search(this);
parse_file(this);
// normilize path - "/some/path"
this.path = normalize_pathsSlashes(this.value);
return this;
}
class_Uri.prototype.cdUp = function () {
var path = this.path;
if (path == null || path === '' || path === '/') {
this.path = '';
return this;
}
this.path = path.replace(/\/?[^\/]+\/?$/i, '');
return this;
};
/**
* '/path' - relative to host
* '../path', 'path','./path' - relative to current path
*/
class_Uri.prototype.combine = function (mix) {
var path;
if (util_isUri(mix)) {
if (mix.protocol || mix.host) {
return util_clone(mix);
}
path = path.toString();
}
else {
path = mix;
}
if (path == null || path === '') {
return util_clone(this);
}
var uri = util_clone(this);
uri.value = path;
parse_search(uri);
parse_file(uri);
if (uri.value === '') {
return uri;
}
path = uri.value.replace(/^\.\//i, '');
if (path[0] === '/') {
uri.path = path;
return uri;
}
while (/^(\.\.\/?)/ig.test(path)) {
uri.cdUp();
path = path.substring(3);
if (uri.path === '') {
break;
}
}
uri.path = normalize_pathsSlashes(util_combinePathes(uri.path, path));
return uri;
};
class_Uri.prototype.toString = function () {
var protocol = this.protocol ? this.protocol + '://' : '';
var path = util_combinePathes(this.host, this.path, this.file) + (this.search || '');
var str = protocol + path;
if (!(this.file || this.search) && this.path) {
str += '/';
}
return str;
};
class_Uri.prototype.toPathAndQuery = function () {
return util_combinePathes(this.path, this.file) + (this.search || '');
};
/**
* @return Current Uri Path{String} that is relative to @arg1 Uri
*/
class_Uri.prototype.toRelativeString = function (uri) {
if (typeof uri === 'string') {
uri = new class_Uri(uri);
}
if (this.path.indexOf(uri.path) === 0) {
// host folder
var p = this.path ? this.path.replace(uri.path, '') : '';
if (p[0] === '/')
p = p.substring(1);
return util_combinePathes(p, this.file) + (this.search || '');
}
// sub folder
var current = this.path.split('/'), relative = uri.path.split('/'), commonpath = '', i = 0, length = Math.min(current.length, relative.length);
for (; i < length; i++) {
if (current[i] === relative[i])
continue;
break;
}
if (i > 0)
commonpath = current.splice(0, i).join('/');
if (commonpath) {
var sub = '', path = uri.path, forward;
while (path) {
if (this.path.indexOf(path) === 0) {
forward = this.path.replace(path, '');
break;
}
path = path.replace(/\/?[^\/]+\/?$/i, '');
sub += '../';
}
return util_combinePathes(sub, forward, this.file);
}
return this.toString();
};
class_Uri.prototype.toLocalFile = function () {
var path = util_combinePathes(this.host, this.path, this.file);
return util_win32Path(path);
};
class_Uri.prototype.toLocalDir = function () {
var path = util_combinePathes(this.host, this.path, '/');
return util_win32Path(path);
};
class_Uri.prototype.toDir = function () {
var str = this.protocol ? this.protocol + '://' : '';
return str + util_combinePathes(this.host, this.path, '/');
};
class_Uri.prototype.isRelative = function () {
return !(this.protocol || this.host);
};
class_Uri.prototype.getName = function () {
return this.file.replace('.' + this.extension, '');
};
class_Uri.combinePathes = util_combinePathes;
class_Uri.combine = util_combinePathes;
return class_Uri;
}());
exports.class_Uri = class_Uri;
;
var rgx_protocol = /^([\w\d]+):\/\//, rgx_extension = /\.([\w\d]+)$/i, rgx_win32Drive = /(^\/?\w{1}:)(\/|$)/, rgx_fileWithExt = /([^\/]+(\.[\w\d]+)?)$/i;
function util_isUri(object) {
return object && typeof object === 'object' && typeof object.combine === 'function';
}
function util_combinePathes(a, b, c, d) {
var args = arguments, str = '';
for (var i = 0, x, imax = arguments.length; i < imax; i++) {
x = arguments[i];
if (!x)
continue;
if (!str) {
str = x;
continue;
}
if (str[str.length - 1] !== '/')
str += '/';
str += x[0] === '/' ? x.substring(1) : x;
}
return str;
}
function normalize_pathsSlashes(str) {
if (str[str.length - 1] === '/') {
return str.substring(0, str.length - 1);
}
return str;
}
function util_clone(source) {
var uri = new class_Uri(), key;
for (key in source) {
if (typeof source[key] === 'string') {
uri[key] = source[key];
}
}
return uri;
}
function normalize_path(str) {
str = str
.replace(/\\/g, '/')
.replace(/^\.\//, '');
var double = /\/{2,}/g;
do {
var match = double.exec(str);
if (match == null) {
break;
}
if (match.index === 0 || str[match.index - 1] === ':') {
continue;
}
str = str.substring(0, match.index) + '/' + str.substring(match.index + match[0].length + 1);
} while (true);
return str;
}
function util_win32Path(path) {
if (rgx_win32Drive.test(path) && path[0] === '/') {
return path.substring(1);
}
return path;
}
function parse_protocol(uri) {
var match = rgx_protocol.exec(uri.value);
if (match == null) {
return;
}
uri.protocol = match[1];
uri.value = uri.value.substring(match[0].length);
}
function parse_host(uri) {
var match = rgx_win32Drive.exec(uri.value);
if (match) {
uri.protocol = 'file';
uri.host = match[1];
uri.value = uri.value.substring(uri.host.length);
}
if (uri.protocol == null || uri.protocol === 'file') {
return;
}
var pathStartIdx = uri.value.indexOf('/', 2);
uri.host = pathStartIdx !== -1
? uri.value.substring(0, pathStartIdx)
: uri.value;
uri.value = uri.value.replace(uri.host, '');
}
function parse_search(uri) {
var question = uri.value.indexOf('?');
if (question === -1) {
return;
}
uri.search = uri.value.substring(question);
uri.value = uri.value.substring(0, question);
}
function parse_file(obj) {
var match = rgx_fileWithExt.exec(obj.value), file = match == null ? null : match[1];
if (file == null) {
return;
}
obj.file = file;
obj.value = obj.value.substring(0, obj.value.length - file.length);
obj.value = normalize_pathsSlashes(obj.value);
match = rgx_extension.exec(file);
obj.extension = match == null ? null : match[1];
}
}());
(function(){
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_extendProtoObjects = exports.class_inherit = void 0;
var is_1 = require("./is");
var fn_1 = require("./fn");
var arr_1 = require("./arr");
var obj_1 = require("./obj");
var PROTO = "__proto__";

@@ -1358,19 +1435,20 @@ var _toString = Object.prototype.toString;

};
class_inherit = PROTO in Object.prototype ? inherit : inherit_protoLess;
class_extendProtoObjects = function (proto, _base, _extends) {
var class_inherit = PROTO in Object.prototype ? inherit : inherit_protoLess;
exports.class_inherit = class_inherit;
function class_extendProtoObjects(proto, _base, _extends) {
var key, protoValue;
for (key in proto) {
protoValue = proto[key];
if (!is_rawObject(protoValue))
if (!is_1.is_rawObject(protoValue))
continue;
if (_base != null) {
if (is_rawObject(_base.prototype[key]))
obj_defaults(protoValue, _base.prototype[key]);
if (is_1.is_rawObject(_base.prototype[key]))
obj_1.obj_defaults(protoValue, _base.prototype[key]);
}
if (_extends != null) {
arr_each(_extends, proto_extendDefaultsDelegate(protoValue, key));
arr_1.arr_each(_extends, proto_extendDefaultsDelegate(protoValue, key));
}
}
}
exports.class_extendProtoObjects = class_extendProtoObjects;
;

@@ -1381,4 +1459,4 @@ // PRIVATE

var proto = proto_getProto(source), val = proto[key];
if (is_rawObject(val)) {
obj_defaults(target, val);
if (is_1.is_rawObject(val)) {
obj_1.obj_defaults(target, val);
}

@@ -1408,11 +1486,11 @@ };

var args = arguments.length === 1 && _isArguments(mix) ? mix : arguments;
return fn_apply(super_, this, args);
return fn_1.fn_apply(super_, this, args);
};
}
else {
proxy = fn_doNothing;
proxy = fn_1.fn_doNothing;
}
return function () {
this["super"] = proxy;
return fn_apply(fn, this, arguments);
return fn_1.fn_apply(fn, this, arguments);
};

@@ -1425,3 +1503,3 @@ }

proto[PROTO] = {};
arr_each(_extends, function (x) {
arr_1.arr_each(_extends, function (x) {
proto_extend(proto[PROTO], x);

@@ -1438,3 +1516,3 @@ });

_class.prototype = Object.create(_base.prototype);
obj_extendDescriptors(_class.prototype, original);
obj_1.obj_extendDescriptors(_class.prototype, original);
}

@@ -1446,8 +1524,8 @@ else {

if (_extends != null) {
arr_each(_extends, function (x) {
obj_defaults(_class.prototype, x);
arr_1.arr_each(_extends, function (x) {
obj_1.obj_defaults(_class.prototype, x);
});
}
var proto = _class.prototype;
obj_defaults(proto, defaults);
obj_1.obj_defaults(proto, defaults);
for (var key in _overrides) {

@@ -1466,3 +1544,3 @@ proto[key] = proto_override(proto[key], _overrides[key]);

if (_extends != null) {
arr_each(_extends, function (x) {
arr_1.arr_each(_extends, function (x) {
delete x.constructor;

@@ -1475,9 +1553,17 @@ proto_extend(_class, x);

function proto_getProto(mix) {
return is_Function(mix) ? mix.prototype : mix;
return is_1.is_Function(mix) ? mix.prototype : mix;
}
}());
mixin = function (mix1, mix2, mix3, mix4, mix5) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mixin = void 0;
var obj_1 = require("./obj");
var is_1 = require("./is");
var fn_1 = require("./fn");
var proto_1 = require("./proto");
function mixin(mix1, mix2, mix3, mix4, mix5) {
return mix(mix1, mix2, mix3, mix4, mix5);
}
exports.mixin = mixin;
function mix() {

@@ -1499,7 +1585,7 @@ var mixins = [];

if (typeof x === 'function') {
fn_apply(x, this, args);
fn_1.fn_apply(x, this, args);
}
}
};
if (is_Function(_base) === false) {
if (is_1.is_Function(_base) === false) {
_extends.unshift(_base);

@@ -1510,4 +1596,4 @@ _base = null;

var proto = {};
class_extendProtoObjects(proto, _base, _extends);
class_inherit(_class, _base, _extends, proto);
proto_1.class_extendProtoObjects(proto, _base, _extends);
proto_1.class_inherit(_class, _base, _extends, proto);
return _class;

@@ -1523,3 +1609,3 @@ }

if (key in Ctor === false) {
obj_copyProperty(Ctor, Fn, key);
obj_1.obj_copyProperty(Ctor, Fn, key);
}

@@ -1538,3 +1624,3 @@ }

ensureCallableSingle = function (mix) {
if (is_Function(mix) === false) {
if (is_1.is_Function(mix) === false) {
return mix;

@@ -1576,6 +1662,36 @@ }

var x = new (fn.bind.apply(fn, [null].concat(args)));
obj_extend(self, x);
obj_1.obj_extend(self, x);
}
}());
}());
}());
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
require("./polyfill/str");
require("./polyfill/fn");
__exportStar(require("./refs"), exports);
__exportStar(require("./polyfill/arr"), exports);
__exportStar(require("./coll"), exports);
__exportStar(require("./is"), exports);
__exportStar(require("./obj"), exports);
__exportStar(require("./arr"), exports);
__exportStar(require("./fn"), exports);
__exportStar(require("./str"), exports);
__exportStar(require("./class"), exports);
__exportStar(require("./error"), exports);
__exportStar(require("./class/Dfr"), exports);
__exportStar(require("./class/EventEmitter"), exports);
__exportStar(require("./class/Uri"), exports);
var mixin_1 = require("./mixin");
Object.defineProperty(exports, "mixin", { enumerable: true, get: function () { return mixin_1.mixin; } });

@@ -17,32 +17,15 @@ (function(factory){

var _Array_slice,
_Object_getOwnProp,
_Object_defineProperty,
_Array_slice,
_Object_getOwnProp,
_Object_defineProperty,
_Array_slice,
_Object_getOwnProp,
_Object_defineProperty,
_Array_slice,
_Object_getOwnProp,
_Object_defineProperty;
var is_Function,
is_Object,
is_Array,
is_ArrayLike,
is_String,
is_notEmptyString,
is_rawObject,
is_Date,
is_DOM,
is_NODE;
(function(){
is_Function = function (x) {
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is_NODE = exports.is_DOM = exports.is_Observable = exports.is_PromiseLike = exports.is_Date = exports.is_rawObject = exports.is_notEmptyString = exports.is_String = exports.is_ArrayLike = exports.is_Array = exports.is_Object = exports.is_Function = void 0;
function is_Function(x) {
return typeof x === 'function';
}
is_Object = function (x) {
exports.is_Function = is_Function;
function is_Object(x) {
return x != null && typeof x === 'object';
}
is_Array = function (arr) {
exports.is_Object = is_Object;
function is_Array(arr) {
return (arr != null &&

@@ -53,13 +36,17 @@ typeof arr === 'object' &&

}
is_ArrayLike = is_Array;
is_String = function (x) {
exports.is_Array = is_Array;
exports.is_ArrayLike = is_Array;
function is_String(x) {
return typeof x === 'string';
}
is_notEmptyString = function (x) {
exports.is_String = is_String;
function is_notEmptyString(x) {
return typeof x === 'string' && x !== '';
}
is_rawObject = function (x) {
exports.is_notEmptyString = is_notEmptyString;
function is_rawObject(x) {
return x != null && typeof x === 'object' && x.constructor === Object;
}
is_Date = function (x) {
exports.is_rawObject = is_rawObject;
function is_Date(x) {
if (x == null || typeof x !== 'object') {

@@ -73,38 +60,30 @@ return false;

}
exports.is_Date = is_Date;
function is_PromiseLike(x) {
return x != null && typeof x === 'object' && typeof x.then === 'function';
}
exports.is_PromiseLike = is_PromiseLike;
function is_Observable(x) {
return x != null && typeof x === 'object' && typeof x.subscribe === 'function';
}
is_DOM = typeof window !== 'undefined' && window.navigator != null;
is_NODE = !is_DOM;
exports.is_Observable = is_Observable;
exports.is_DOM = typeof window !== 'undefined' && window.navigator != null;
exports.is_NODE = !exports.is_DOM;
}());
var obj_copyProperty,
obj_getProperty,
obj_setProperty,
obj_hasProperty,
obj_defineProperty,
obj_extend,
obj_extendDefaults,
obj_extendProperties,
obj_extendPropertiesDefaults,
obj_extendMany,
obj_create,
obj_defaults,
obj_clean,
obj_extendDescriptors;
(function(){
(function(){
_Array_slice = Array.prototype.slice;
var _Array_splice = Array.prototype.splice;
var _Array_indexOf = Array.prototype.indexOf;
var _Object_hasOwnProp = Object.hasOwnProperty;
_Object_getOwnProp = Object.getOwnPropertyDescriptor;
_Object_defineProperty = Object.defineProperty;
var _global = typeof global !== 'undefined'
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._document = exports._global = exports._Object_defineProperty = exports._Object_getOwnProp = exports._Object_hasOwnProp = exports._Array_indexOf = exports._Array_splice = exports._Array_slice = void 0;
exports._Array_slice = Array.prototype.slice;
exports._Array_splice = Array.prototype.splice;
exports._Array_indexOf = Array.prototype.indexOf;
exports._Object_hasOwnProp = Object.hasOwnProperty;
exports._Object_getOwnProp = Object.getOwnPropertyDescriptor;
exports._Object_defineProperty = Object.defineProperty;
exports._global = typeof global !== 'undefined'
? global
: window;
var _document = typeof window !== 'undefined' && window.document != null
exports._document = typeof window !== 'undefined' && window.document != null
? window.document

@@ -114,5 +93,10 @@ : null;

}());
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.obj_extendDescriptorsDefaults = exports.obj_extendDescriptors = exports.obj_clean = exports.obj_defaults = exports.obj_create = exports._Object_create = exports.obj_toFastProps = exports.obj_extendMany = exports.obj_extendPropertiesDefaults = exports.obj_extendProperties = exports.obj_extendDefaults = exports.obj_extend = exports.obj_defineProperty = exports.obj_hasProperty = exports.obj_setProperty = exports.obj_getProperty = exports.obj_copyProperty = void 0;
var is_1 = require("./is");
var refs_1 = require("./refs");
var getDescriptor = Object.getOwnPropertyDescriptor;
var defineDescriptor = Object.defineProperty;
obj_copyProperty = getDescriptor == null
var obj_copyProperty = getDescriptor == null
? function (target, source, key) { return target[key] = source[key]; }

@@ -131,4 +115,4 @@ : function (target, source, key) {

};
obj_getProperty = function (obj_, path) {
exports.obj_copyProperty = obj_copyProperty;
function obj_getProperty(obj_, path) {
if (obj_ == null) {

@@ -150,4 +134,5 @@ return null;

}
exports.obj_getProperty = obj_getProperty;
;
obj_setProperty = function (obj_, path, val) {
function obj_setProperty(obj_, path, val) {
if (path.indexOf('.') === -1) {

@@ -171,9 +156,11 @@ obj_[path] = val;

}
exports.obj_setProperty = obj_setProperty;
;
obj_hasProperty = function (obj, path) {
function obj_hasProperty(obj, path) {
var x = obj_getProperty(obj, path);
return x !== void 0;
}
exports.obj_hasProperty = obj_hasProperty;
;
obj_defineProperty = function (obj, path, dscr) {
function obj_defineProperty(obj, path, dscr) {
var x = obj, chain = path.split('.'), imax = chain.length - 1, i = -1, key;

@@ -187,3 +174,3 @@ while (++i < imax) {

key = chain[imax];
if (_Object_defineProperty) {
if (refs_1._Object_defineProperty) {
if (dscr.writable === void 0)

@@ -195,3 +182,3 @@ dscr.writable = true;

dscr.enumerable = true;
_Object_defineProperty(x, key, dscr);
refs_1._Object_defineProperty(x, key, dscr);
return;

@@ -203,8 +190,9 @@ }

}
exports.obj_defineProperty = obj_defineProperty;
;
obj_extend = function (a, b) {
function obj_extend(a, b) {
if (b == null)
return a || {};
if (a == null)
return obj_create(b);
return exports.obj_create(b);
for (var key in b) {

@@ -215,8 +203,9 @@ a[key] = b[key];

}
exports.obj_extend = obj_extend;
;
obj_extendDefaults = function (a, b) {
function obj_extendDefaults(a, b) {
if (b == null)
return a || {};
if (a == null)
return obj_create(b);
return exports.obj_create(b);
for (var key in b) {

@@ -233,4 +222,5 @@ if (a[key] == null) {

}
exports.obj_extendDefaults = obj_extendDefaults;
var extendPropertiesFactory = function (overwriteProps) {
if (_Object_getOwnProp == null)
if (refs_1._Object_getOwnProp == null)
return overwriteProps ? obj_extend : obj_extendDefaults;

@@ -241,10 +231,10 @@ return function (a, b) {

if (a == null)
return obj_create(b);
return exports.obj_create(b);
var key, descr, ownDescr;
for (key in b) {
descr = _Object_getOwnProp(b, key);
descr = refs_1._Object_getOwnProp(b, key);
if (descr == null)
continue;
if (overwriteProps !== true) {
ownDescr = _Object_getOwnProp(a, key);
ownDescr = refs_1._Object_getOwnProp(a, key);
if (ownDescr != null) {

@@ -258,3 +248,3 @@ continue;

}
_Object_defineProperty(a, key, descr);
refs_1._Object_defineProperty(a, key, descr);
}

@@ -264,5 +254,5 @@ return a;

};
obj_extendProperties = extendPropertiesFactory(true);
obj_extendPropertiesDefaults = extendPropertiesFactory(false);
obj_extendMany = function (a, arg1, arg2, arg3, arg4, arg5, arg6) {
exports.obj_extendProperties = extendPropertiesFactory(true);
exports.obj_extendPropertiesDefaults = extendPropertiesFactory(false);
function obj_extendMany(a, arg1, arg2, arg3, arg4, arg5, arg6) {
var imax = arguments.length, i = 1;

@@ -274,2 +264,3 @@ for (; i < imax; i++) {

}
exports.obj_extendMany = obj_extendMany;
;

@@ -284,4 +275,5 @@ function obj_toFastProps(obj) {

}
exports.obj_toFastProps = obj_toFastProps;
;
var _Object_create = Object.create || function (x) {
exports._Object_create = Object.create || function (x) {
var Ctor = function () { };

@@ -291,4 +283,4 @@ Ctor.prototype = x;

};
obj_create = _Object_create;
obj_defaults = function (target, defaults) {
exports.obj_create = exports._Object_create;
function obj_defaults(target, defaults) {
for (var key in defaults) {

@@ -300,6 +292,7 @@ if (target[key] == null)

}
exports.obj_defaults = obj_defaults;
/**
* Remove all NULL properties, optionally also all falsy-ies
*/
obj_clean = function (json, opts) {
function obj_clean(json, opts) {
var _a;

@@ -315,3 +308,3 @@ if (opts === void 0) { opts = {

}
if (is_ArrayLike(json)) {
if (is_1.is_ArrayLike(json)) {
var arr = json;

@@ -333,3 +326,3 @@ var i = 0;

}
if (is_Object(json)) {
if (is_1.is_Object(json)) {
for (var key in json) {

@@ -362,3 +355,3 @@ if (opts.skipProperties != null && key in opts.skipProperties) {

}
if (opts.removeEmptyArrays && is_ArrayLike(val) && val.length === 0) {
if (opts.removeEmptyArrays && is_1.is_ArrayLike(val) && val.length === 0) {
delete json[key];

@@ -371,2 +364,3 @@ }

}
exports.obj_clean = obj_clean;
function isDefault(x, opts) {

@@ -379,3 +373,3 @@ if (x == null) {

}
if (opts.removeEmptyArrays && is_ArrayLike(x) && x.length === 0) {
if (opts.removeEmptyArrays && is_1.is_ArrayLike(x) && x.length === 0) {
return true;

@@ -385,14 +379,16 @@ }

}
obj_extendDescriptors;
var obj_extendDescriptors;
exports.obj_extendDescriptors = obj_extendDescriptors;
var obj_extendDescriptorsDefaults;
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults;
(function () {
if (getDescriptor == null) {
obj_extendDescriptors = obj_extend;
obj_extendDescriptorsDefaults = obj_defaults;
exports.obj_extendDescriptors = obj_extendDescriptors = obj_extend;
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults = obj_defaults;
return;
}
obj_extendDescriptors = function (target, source) {
exports.obj_extendDescriptors = obj_extendDescriptors = function (target, source) {
return _extendDescriptors(target, source, false);
};
obj_extendDescriptorsDefaults = function (target, source) {
exports.obj_extendDescriptorsDefaults = obj_extendDescriptorsDefaults = function (target, source) {
return _extendDescriptors(target, source, true);

@@ -424,7 +420,9 @@ };

}());
var class_create,
class_createEx;
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_createEx = exports.class_create = void 0;
var obj_1 = require("./obj");
var refs_1 = require("./refs");
;

@@ -438,8 +436,8 @@ /**

*/
class_create = createClassFactory(obj_extendDefaults);
exports.class_create = createClassFactory(obj_1.obj_extendDefaults);
// with property accessor functions support
class_createEx = createClassFactory(obj_extendPropertiesDefaults);
exports.class_createEx = createClassFactory(obj_1.obj_extendPropertiesDefaults);
function createClassFactory(extendDefaultsFn) {
return function (a, b, c, d, e, f, g, h) {
var args = _Array_slice.call(arguments), Proto = args.pop();
var args = refs_1._Array_slice.call(arguments), Proto = args.pop();
if (Proto == null)

@@ -488,3 +486,3 @@ Proto = {};

return function () {
var args = _Array_slice.call(arguments);
var args = refs_1._Array_slice.call(arguments);
var x = fnA.apply(this, args);

@@ -498,9 +496,8 @@ if (x !== void 0)

}());
var arr_remove,
arr_each,
arr_indexOf,
arr_contains,
arr_pushMany;
(function(){
arr_remove = function (array, x) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arr_distinct = exports.arr_pushMany = exports.arr_contains = exports.arr_indexOf = exports.arr_each = exports.arr_remove = void 0;
var obj_1 = require("./obj");
function arr_remove(array, x) {
var i = array.indexOf(x);

@@ -512,16 +509,20 @@ if (i === -1)

}
exports.arr_remove = arr_remove;
;
arr_each = function (arr, fn, ctx) {
function arr_each(arr, fn, ctx) {
arr.forEach(fn, ctx);
}
exports.arr_each = arr_each;
;
arr_indexOf = function (arr, x) {
function arr_indexOf(arr, x) {
return arr.indexOf(x);
}
exports.arr_indexOf = arr_indexOf;
;
arr_contains = function (arr, x) {
function arr_contains(arr, x) {
return arr.indexOf(x) !== -1;
}
exports.arr_contains = arr_contains;
;
arr_pushMany = function (arr, arrSource) {
function arr_pushMany(arr, arrSource) {
if (arrSource == null || arr == null || arr === arrSource)

@@ -534,6 +535,7 @@ return;

}
exports.arr_pushMany = arr_pushMany;
;
function arr_distinct(arr, compareFn) {
var out = [];
var hash = compareFn == null ? obj_create(null) : null;
var hash = compareFn == null ? obj_1.obj_create(null) : null;
outer: for (var i = 0; i < arr.length; i++) {

@@ -559,12 +561,15 @@ var x = arr[i];

}
exports.arr_distinct = arr_distinct;
}());
var str_format,
str_dedent;
(function(){
str_format = function (str_, a, b, c, d) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.str_dedent = exports.str_format = void 0;
var is_1 = require("./is");
function str_format(str_, a, b, c, d) {
var str = str_, imax = arguments.length, i = 0, x;
while (++i < imax) {
x = arguments[i];
if (is_Object(x) && x.toJSON) {
if (is_1.is_Object(x) && x.toJSON) {
x = x.toJSON();

@@ -576,4 +581,5 @@ }

}
exports.str_format = str_format;
;
str_dedent = function (str) {
function str_dedent(str) {
var rgx = /^[\t ]*\S/gm, match = rgx.exec(str), count = -1;

@@ -594,2 +600,3 @@ while (match != null) {

}
exports.str_dedent = str_dedent;
;

@@ -605,5 +612,9 @@ var rgxNum;

}());
var error_createClass;
(function(){
error_createClass = function (name, Proto, stackSliceFrom) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.error_formatCursor = exports.error_cursor = exports.error_formatSource = exports.error_createClass = void 0;
var obj_1 = require("./obj");
var str_1 = require("./str");
function error_createClass(name, Proto, stackSliceFrom) {
var Ctor = _createCtor(Proto, stackSliceFrom);

@@ -613,5 +624,6 @@ Ctor.prototype = new Error;

Proto.name = name;
obj_extend(Ctor.prototype, Proto);
obj_1.obj_extend(Ctor.prototype, Proto);
return Ctor;
}
exports.error_createClass = error_createClass;
;

@@ -621,6 +633,7 @@ function error_formatSource(source, index, filename) {

if (filename != null) {
str += str_format(' at {0}:{1}:{2}\n', filename, lineNum, rowNum);
str += str_1.str_format(' at {0}:{1}:{2}\n', filename, lineNum, rowNum);
}
return str + error_formatCursor(lines, lineNum, rowNum);
}
exports.error_formatSource = error_formatSource;
;

@@ -638,2 +651,3 @@ /**

}
exports.error_cursor = error_cursor;
;

@@ -660,2 +674,3 @@ function error_formatCursor(lines, lineNum, rowNum) {

}
exports.error_formatCursor = error_formatCursor;
;

@@ -685,7 +700,7 @@ function ensureLength(num, count) {

}
obj_defineProperty(this, 'stack', {
obj_1.obj_defineProperty(this, 'stack', {
value: _prepairStack(stackFrom || 3)
});
obj_defineProperty(this, 'message', {
value: str_format.apply(this, arguments)
obj_1.obj_defineProperty(this, 'message', {
value: str_1.str_format.apply(this, arguments)
});

@@ -706,8 +721,7 @@ if (Ctor != null) {

}());
var fn_proxy,
fn_apply,
fn_doNothing,
fn_createByPattern;
(function(){
fn_proxy = function (fn, ctx) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fn_createByPattern = exports.fn_doNothing = exports.fn_apply = exports.fn_proxy = void 0;
function fn_proxy(fn, ctx) {
return function () {

@@ -720,4 +734,5 @@ var imax = arguments.length, args = new Array(imax), i = 0;

}
exports.fn_proxy = fn_proxy;
;
fn_apply = function (fn, ctx, args) {
function fn_apply(fn, ctx, args) {
var l = args.length;

@@ -736,8 +751,10 @@ if (0 === l)

}
exports.fn_apply = fn_apply;
;
fn_doNothing = function () {
function fn_doNothing() {
return false;
}
exports.fn_doNothing = fn_doNothing;
;
fn_createByPattern = function (definitions, ctx) {
function fn_createByPattern(definitions, ctx) {
var imax = definitions.length;

@@ -765,31 +782,41 @@ return function () {

}
exports.fn_createByPattern = fn_createByPattern;
;
}());
var class_Dfr;
(function(){
;
class_Dfr = function () { };
class_Dfr.prototype = {
_isAsync: true,
_done: null,
_fail: null,
_always: null,
_resolved: null,
_rejected: null,
defer: function () {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_Dfr = void 0;
var fn_1 = require("../fn");
var is_1 = require("../is");
var refs_1 = require("../refs");
var class_Dfr = /** @class */ (function () {
function class_Dfr() {
this._isAsync = true;
this._done = null;
this._fail = null;
this._always = null;
this._resolved = null;
this._rejected = null;
}
class_Dfr.prototype.defer = function () {
this._rejected = null;
this._resolved = null;
return this;
},
isResolved: function () {
};
class_Dfr.prototype.isResolved = function () {
return this._resolved != null;
},
isRejected: function () {
};
class_Dfr.prototype.isRejected = function () {
return this._rejected != null;
},
isBusy: function () {
};
class_Dfr.prototype.isBusy = function () {
return this._resolved == null && this._rejected == null;
},
resolve: function () {
};
class_Dfr.prototype.resolve = function (value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var done = this._done, always = this._always;

@@ -801,4 +828,4 @@ this._resolved = arguments;

return this;
},
reject: function () {
};
class_Dfr.prototype.reject = function (error) {
var fail = this._fail, always = this._always;

@@ -810,20 +837,27 @@ this._rejected = arguments;

return this;
},
then: function (filterSuccess, filterError) {
return this.pipe(filterSuccess, filterError);
},
done: function (callback) {
if (this._rejected != null)
};
class_Dfr.prototype.then = function (filterSuccess, filterError) {
var dfr = new class_Dfr();
var done_ = filterSuccess, fail_ = filterError;
this
.done(delegate(dfr, 'resolve', done_))
.fail(delegate(dfr, 'reject', fail_));
return dfr;
};
class_Dfr.prototype.done = function (callback) {
if (this._rejected != null) {
return this;
}
return dfr_bind(this, this._resolved, this._done || (this._done = []), callback);
},
fail: function (callback) {
if (this._resolved != null)
};
class_Dfr.prototype.fail = function (callback) {
if (this._resolved != null) {
return this;
}
return dfr_bind(this, this._rejected, this._fail || (this._fail = []), callback);
},
always: function (callback) {
};
class_Dfr.prototype.always = function (callback) {
return dfr_bind(this, this._rejected || this._resolved, this._always || (this._always = []), callback);
},
pipe: function (mix /* ..methods */) {
};
class_Dfr.prototype.pipe = function (mix /* ..methods */) {
var dfr;

@@ -863,21 +897,5 @@ if (typeof mix === 'function') {

}
function delegate(dfr, name, fn) {
return function () {
if (fn != null) {
var override = fn.apply(this, arguments);
if (override != null && override !== dfr) {
if (isDeferred(override)) {
override.then(delegate(dfr, 'resolve'), delegate(dfr, 'reject'));
return;
}
dfr[name](override);
return;
}
}
dfr[name].apply(dfr, arguments);
};
}
return this;
},
pipeCallback: function () {
};
class_Dfr.prototype.pipeCallback = function () {
var self = this;

@@ -889,36 +907,34 @@ return function (error) {

}
var args = _Array_slice.call(arguments, 1);
fn_apply(self.resolve, self, args);
var args = refs_1._Array_slice.call(arguments, 1);
fn_1.fn_apply(self.resolve, self, args);
};
},
resolveDelegate: function () {
return fn_proxy(this.resolve, this);
},
rejectDelegate: function () {
return fn_proxy(this.reject, this);
},
catch: function (cb) {
};
class_Dfr.prototype.resolveDelegate = function () {
return fn_1.fn_proxy(this.resolve, this);
};
class_Dfr.prototype.rejectDelegate = function () {
return fn_1.fn_proxy(this.reject, this);
};
class_Dfr.prototype.catch = function (cb) {
return this.fail(cb);
},
finally: function (cb) {
};
class_Dfr.prototype.finally = function (cb) {
return this.always(cb);
}
};
var static_Dfr = {
resolve: function (a, b, c) {
};
class_Dfr.resolve = function (a, b, c) {
var dfr = new class_Dfr();
return dfr.resolve.apply(dfr, _Array_slice.call(arguments));
},
reject: function (error) {
return dfr.resolve.apply(dfr, refs_1._Array_slice.call(arguments));
};
class_Dfr.reject = function (error) {
var dfr = new class_Dfr();
return dfr.reject(error);
},
run: function (fn, ctx) {
};
class_Dfr.run = function (fn, ctx) {
var dfr = new class_Dfr();
if (ctx == null)
ctx = dfr;
fn.call(ctx, fn_proxy(dfr.resolve, ctx), fn_proxy(dfr.reject, dfr), dfr);
fn.call(ctx, fn_1.fn_proxy(dfr.resolve, ctx), fn_1.fn_proxy(dfr.reject, dfr), dfr);
return dfr;
},
all: function (promises) {
};
class_Dfr.all = function (promises) {
var dfr = new class_Dfr, arr = new Array(promises.length), wait = promises.length, error = null;

@@ -932,3 +948,3 @@ if (wait === 0) {

}
var args = _Array_slice.call(arguments, 1);
var args = refs_1._Array_slice.call(arguments, 1);
arr.splice.apply(arr, [index, 0].concat(args));

@@ -952,9 +968,24 @@ if (--wait === 0) {

return dfr;
}
};
class_Dfr.resolve = static_Dfr.resolve;
class_Dfr.reject = static_Dfr.reject;
class_Dfr.run = static_Dfr.run;
class_Dfr.all = static_Dfr.all;
};
return class_Dfr;
}());
exports.class_Dfr = class_Dfr;
;
// PRIVATE
function delegate(dfr, name, fn) {
return function () {
if (fn != null) {
var override = fn.apply(this, arguments);
if (override != null && override !== dfr) {
if (isDeferred(override)) {
override.then(delegate(dfr, 'resolve'), delegate(dfr, 'reject'));
return;
}
dfr[name](override);
return;
}
}
dfr[name].apply(dfr, arguments);
};
}
function dfr_bind(dfr, arguments_, listeners, callback) {

@@ -964,3 +995,3 @@ if (callback == null)

if (arguments_ != null)
fn_apply(callback, dfr, arguments_);
fn_1.fn_apply(callback, dfr, arguments_);
else

@@ -982,3 +1013,3 @@ listeners.push(callback);

if (fn)
fn_apply(fn, ctx, args);
fn_1.fn_apply(fn, ctx, args);
}

@@ -990,20 +1021,26 @@ arr.length = 0;

&& typeof x === 'object'
&& is_Function(x.then);
&& is_1.is_Function(x.then);
}
}());
var class_Uri;
(function(){
class_Uri = class_create({
protocol: null,
value: null,
path: null,
file: null,
extension: null,
constructor: function (uri) {
if (uri == null)
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_Uri = void 0;
var class_Uri = /** @class */ (function () {
function class_Uri(uri) {
this.protocol = null;
this.host = null;
this.path = null;
this.file = null;
this.extension = null;
this.search = null;
this.value = null;
if (uri == null) {
return this;
if (util_isUri(uri))
return uri.combine('');
uri = normalize_uri(uri);
}
if (util_isUri(uri)) {
return util_clone(uri);
}
uri = normalize_path(uri);
this.value = uri;

@@ -1016,19 +1053,13 @@ parse_protocol(this);

this.path = normalize_pathsSlashes(this.value);
if (/^[\w]+:\//.test(this.path)) {
this.path = '/' + this.path;
}
return this;
},
cdUp: function () {
}
class_Uri.prototype.cdUp = function () {
var path = this.path;
if (path == null || path === '' || path === '/') {
this.path = '';
return this;
}
// win32 - is base drive
if (/^\/?[a-zA-Z]+:\/?$/.test(path)) {
return this;
}
this.path = path.replace(/\/?[^\/]+\/?$/i, '');
return this;
},
};
/**

@@ -1038,12 +1069,16 @@ * '/path' - relative to host

*/
combine: function (path) {
if (util_isUri(path)) {
class_Uri.prototype.combine = function (mix) {
var path;
if (util_isUri(mix)) {
if (mix.protocol || mix.host) {
return util_clone(mix);
}
path = path.toString();
}
if (!path) {
else {
path = mix;
}
if (path == null || path === '') {
return util_clone(this);
}
if (rgx_win32Drive.test(path)) {
return new class_Uri(path);
}
var uri = util_clone(this);

@@ -1053,3 +1088,3 @@ uri.value = path;

parse_file(uri);
if (!uri.value) {
if (uri.value === '') {
return uri;

@@ -1065,7 +1100,10 @@ }

path = path.substring(3);
if (uri.path === '') {
break;
}
}
uri.path = normalize_pathsSlashes(util_combinePathes(uri.path, path));
return uri;
},
toString: function () {
};
class_Uri.prototype.toString = function () {
var protocol = this.protocol ? this.protocol + '://' : '';

@@ -1078,12 +1116,13 @@ var path = util_combinePathes(this.host, this.path, this.file) + (this.search || '');

return str;
},
toPathAndQuery: function () {
};
class_Uri.prototype.toPathAndQuery = function () {
return util_combinePathes(this.path, this.file) + (this.search || '');
},
};
/**
* @return Current Uri Path{String} that is relative to @arg1 Uri
*/
toRelativeString: function (uri) {
if (typeof uri === 'string')
class_Uri.prototype.toRelativeString = function (uri) {
if (typeof uri === 'string') {
uri = new class_Uri(uri);
}
if (this.path.indexOf(uri.path) === 0) {

@@ -1118,22 +1157,27 @@ // host folder

return this.toString();
},
toLocalFile: function () {
};
class_Uri.prototype.toLocalFile = function () {
var path = util_combinePathes(this.host, this.path, this.file);
return util_win32Path(path);
},
toLocalDir: function () {
};
class_Uri.prototype.toLocalDir = function () {
var path = util_combinePathes(this.host, this.path, '/');
return util_win32Path(path);
},
toDir: function () {
};
class_Uri.prototype.toDir = function () {
var str = this.protocol ? this.protocol + '://' : '';
return str + util_combinePathes(this.host, this.path, '/');
},
isRelative: function () {
};
class_Uri.prototype.isRelative = function () {
return !(this.protocol || this.host);
},
getName: function () {
};
class_Uri.prototype.getName = function () {
return this.file.replace('.' + this.extension, '');
}
});
};
class_Uri.combinePathes = util_combinePathes;
class_Uri.combine = util_combinePathes;
return class_Uri;
}());
exports.class_Uri = class_Uri;
;
var rgx_protocol = /^([\w\d]+):\/\//, rgx_extension = /\.([\w\d]+)$/i, rgx_win32Drive = /(^\/?\w{1}:)(\/|$)/, rgx_fileWithExt = /([^\/]+(\.[\w\d]+)?)$/i;

@@ -1174,8 +1218,18 @@ function util_isUri(object) {

}
function normalize_uri(str) {
return str
function normalize_path(str) {
str = str
.replace(/\\/g, '/')
.replace(/^\.\//, '')
// win32 drive path
.replace(/^(\w+):\/([^\/])/, '/$1:/$2');
.replace(/^\.\//, '');
var double = /\/{2,}/g;
do {
var match = double.exec(str);
if (match == null) {
break;
}
if (match.index === 0 || str[match.index - 1] === ':') {
continue;
}
str = str.substring(0, match.index) + '/' + str.substring(match.index + match[0].length + 1);
} while (true);
return str;
}

@@ -1188,35 +1242,33 @@ function util_win32Path(path) {

}
function parse_protocol(obj) {
var match = rgx_protocol.exec(obj.value);
if (match == null && obj.value[0] === '/') {
obj.protocol = 'file';
function parse_protocol(uri) {
var match = rgx_protocol.exec(uri.value);
if (match == null) {
return;
}
if (match == null)
return;
obj.protocol = match[1];
obj.value = obj.value.substring(match[0].length);
uri.protocol = match[1];
uri.value = uri.value.substring(match[0].length);
}
function parse_host(obj) {
if (obj.protocol == null)
function parse_host(uri) {
var match = rgx_win32Drive.exec(uri.value);
if (match) {
uri.protocol = 'file';
uri.host = match[1];
uri.value = uri.value.substring(uri.host.length);
}
if (uri.protocol == null || uri.protocol === 'file') {
return;
if (obj.protocol === 'file') {
var match = rgx_win32Drive.exec(obj.value);
if (match) {
obj.host = match[1];
obj.value = obj.value.substring(obj.host.length);
}
return;
}
var pathStart = obj.value.indexOf('/', 2);
obj.host = ~pathStart
? obj.value.substring(0, pathStart)
: obj.value;
obj.value = obj.value.replace(obj.host, '');
var pathStartIdx = uri.value.indexOf('/', 2);
uri.host = pathStartIdx !== -1
? uri.value.substring(0, pathStartIdx)
: uri.value;
uri.value = uri.value.replace(uri.host, '');
}
function parse_search(obj) {
var question = obj.value.indexOf('?');
if (question === -1)
function parse_search(uri) {
var question = uri.value.indexOf('?');
if (question === -1) {
return;
obj.search = obj.value.substring(question);
obj.value = obj.value.substring(0, question);
}
uri.search = uri.value.substring(question);
uri.value = uri.value.substring(0, question);
}

@@ -1234,13 +1286,22 @@ function parse_file(obj) {

}
class_Uri.combinePathes = util_combinePathes;
class_Uri.combine = util_combinePathes;
}());
var class_EventEmitter;
(function(){
class_EventEmitter = function () {
this._listeners = {};
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
class_EventEmitter.prototype = {
on: function (event, fn) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_EventEmitter = void 0;
var fn_1 = require("../fn");
var refs_1 = require("../refs");
var class_EventEmitter = /** @class */ (function () {
function class_EventEmitter() {
this._listeners = {};
}
class_EventEmitter.prototype.on = function (event, fn) {
if (fn != null) {

@@ -1250,4 +1311,4 @@ (this._listeners[event] || (this._listeners[event] = [])).push(fn);

return this;
},
once: function (event, fn) {
};
class_EventEmitter.prototype.once = function (event, fn) {
if (fn != null) {

@@ -1258,14 +1319,43 @@ fn._once = true;

return this;
},
pipe: function (event) {
};
class_EventEmitter.prototype.pipe = function (event) {
var that = this, args;
return function () {
args = _Array_slice.call(arguments);
args = refs_1._Array_slice.call(arguments);
args.unshift(event);
fn_apply(that.trigger, that, args);
fn_1.fn_apply(that.trigger, that, args);
};
},
emit: event_trigger,
trigger: event_trigger,
off: function (event, fn) {
};
class_EventEmitter.prototype.emit = function (event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var fns = this._listeners[event];
if (fns == null) {
return this;
}
for (var i = 0; i < fns.length; i++) {
var fn = fns[i];
fn_1.fn_apply(fn, this, args);
if (fn !== fns[i]) {
// the callback has removed itself
i--;
continue;
}
if (fn._once === true) {
fns.splice(i, 1);
i--;
}
}
return this;
};
class_EventEmitter.prototype.trigger = function (event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return this.emit.apply(this, __spreadArrays([event], args));
};
class_EventEmitter.prototype.off = function (event, fn) {
var listeners = this._listeners[event];

@@ -1287,35 +1377,18 @@ if (listeners == null)

return this;
}
};
function event_trigger(event) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var fns = this._listeners[event];
if (fns == null) {
return this;
}
for (var i = 0; i < fns.length; i++) {
var fn = fns[i];
fn_apply(fn, this, args);
if (fn !== fns[i]) {
// the callback has removed itself
i--;
continue;
}
if (fn._once === true) {
fns.splice(i, 1);
i--;
}
}
return this;
}
};
return class_EventEmitter;
}());
exports.class_EventEmitter = class_EventEmitter;
;
}());
var mixin;
(function(){
var class_inherit,
class_extendProtoObjects;
(function(){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.class_extendProtoObjects = exports.class_inherit = void 0;
var is_1 = require("./is");
var fn_1 = require("./fn");
var arr_1 = require("./arr");
var obj_1 = require("./obj");
var PROTO = "__proto__";

@@ -1326,19 +1399,20 @@ var _toString = Object.prototype.toString;

};
class_inherit = PROTO in Object.prototype ? inherit : inherit_protoLess;
class_extendProtoObjects = function (proto, _base, _extends) {
var class_inherit = PROTO in Object.prototype ? inherit : inherit_protoLess;
exports.class_inherit = class_inherit;
function class_extendProtoObjects(proto, _base, _extends) {
var key, protoValue;
for (key in proto) {
protoValue = proto[key];
if (!is_rawObject(protoValue))
if (!is_1.is_rawObject(protoValue))
continue;
if (_base != null) {
if (is_rawObject(_base.prototype[key]))
obj_defaults(protoValue, _base.prototype[key]);
if (is_1.is_rawObject(_base.prototype[key]))
obj_1.obj_defaults(protoValue, _base.prototype[key]);
}
if (_extends != null) {
arr_each(_extends, proto_extendDefaultsDelegate(protoValue, key));
arr_1.arr_each(_extends, proto_extendDefaultsDelegate(protoValue, key));
}
}
}
exports.class_extendProtoObjects = class_extendProtoObjects;
;

@@ -1349,4 +1423,4 @@ // PRIVATE

var proto = proto_getProto(source), val = proto[key];
if (is_rawObject(val)) {
obj_defaults(target, val);
if (is_1.is_rawObject(val)) {
obj_1.obj_defaults(target, val);
}

@@ -1376,11 +1450,11 @@ };

var args = arguments.length === 1 && _isArguments(mix) ? mix : arguments;
return fn_apply(super_, this, args);
return fn_1.fn_apply(super_, this, args);
};
}
else {
proxy = fn_doNothing;
proxy = fn_1.fn_doNothing;
}
return function () {
this["super"] = proxy;
return fn_apply(fn, this, arguments);
return fn_1.fn_apply(fn, this, arguments);
};

@@ -1393,3 +1467,3 @@ }

proto[PROTO] = {};
arr_each(_extends, function (x) {
arr_1.arr_each(_extends, function (x) {
proto_extend(proto[PROTO], x);

@@ -1406,3 +1480,3 @@ });

_class.prototype = Object.create(_base.prototype);
obj_extendDescriptors(_class.prototype, original);
obj_1.obj_extendDescriptors(_class.prototype, original);
}

@@ -1414,8 +1488,8 @@ else {

if (_extends != null) {
arr_each(_extends, function (x) {
obj_defaults(_class.prototype, x);
arr_1.arr_each(_extends, function (x) {
obj_1.obj_defaults(_class.prototype, x);
});
}
var proto = _class.prototype;
obj_defaults(proto, defaults);
obj_1.obj_defaults(proto, defaults);
for (var key in _overrides) {

@@ -1434,3 +1508,3 @@ proto[key] = proto_override(proto[key], _overrides[key]);

if (_extends != null) {
arr_each(_extends, function (x) {
arr_1.arr_each(_extends, function (x) {
delete x.constructor;

@@ -1443,9 +1517,17 @@ proto_extend(_class, x);

function proto_getProto(mix) {
return is_Function(mix) ? mix.prototype : mix;
return is_1.is_Function(mix) ? mix.prototype : mix;
}
}());
mixin = function (mix1, mix2, mix3, mix4, mix5) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mixin = void 0;
var obj_1 = require("./obj");
var is_1 = require("./is");
var fn_1 = require("./fn");
var proto_1 = require("./proto");
function mixin(mix1, mix2, mix3, mix4, mix5) {
return mix(mix1, mix2, mix3, mix4, mix5);
}
exports.mixin = mixin;
function mix() {

@@ -1467,7 +1549,7 @@ var mixins = [];

if (typeof x === 'function') {
fn_apply(x, this, args);
fn_1.fn_apply(x, this, args);
}
}
};
if (is_Function(_base) === false) {
if (is_1.is_Function(_base) === false) {
_extends.unshift(_base);

@@ -1478,4 +1560,4 @@ _base = null;

var proto = {};
class_extendProtoObjects(proto, _base, _extends);
class_inherit(_class, _base, _extends, proto);
proto_1.class_extendProtoObjects(proto, _base, _extends);
proto_1.class_inherit(_class, _base, _extends, proto);
return _class;

@@ -1491,3 +1573,3 @@ }

if (key in Ctor === false) {
obj_copyProperty(Ctor, Fn, key);
obj_1.obj_copyProperty(Ctor, Fn, key);
}

@@ -1506,3 +1588,3 @@ }

ensureCallableSingle = function (mix) {
if (is_Function(mix) === false) {
if (is_1.is_Function(mix) === false) {
return mix;

@@ -1544,3 +1626,3 @@ }

var x = new (fn.bind.apply(fn, [null].concat(args)));
obj_extend(self, x);
obj_1.obj_extend(self, x);
}

@@ -1550,40 +1632,54 @@ }());

}());
var Lib = {
class_Dfr: class_Dfr,
class_EventEmitter: class_EventEmitter,
class_Uri: class_Uri,
class_create: class_create,
class_createEx: class_createEx,
arr_remove: arr_remove,
arr_each: arr_each,
arr_indexOf: arr_indexOf,
arr_contains: arr_contains,
arr_pushMany: arr_pushMany,
error_createClass: error_createClass,
fn_createByPattern: fn_createByPattern,
fn_doNothing: fn_doNothing,
obj_getProperty: obj_getProperty,
obj_setProperty: obj_setProperty,
obj_hasProperty: obj_hasProperty,
obj_extend: obj_extend,
obj_extendDefaults: obj_extendDefaults,
obj_extendMany: obj_extendMany,
obj_extendProperties: obj_extendProperties,
obj_extendPropertiesDefaults: obj_extendPropertiesDefaults,
obj_create: obj_create,
obj_defineProperty: obj_defineProperty,
obj_clean: obj_clean,
is_Function: is_Function,
is_Array: is_Array,
is_ArrayLike: is_ArrayLike,
is_String: is_String,
is_Object: is_Object,
is_notEmptyString: is_notEmptyString,
is_rawObject: is_rawObject,
is_Date: is_Date,
is_NODE: is_NODE,
is_DOM: is_DOM,
str_format: str_format,
str_dedent: str_dedent,
mixin: mixin
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lib = void 0;
var class_1 = require("./class");
var arr_1 = require("./arr");
var error_1 = require("./error");
var fn_1 = require("./fn");
var obj_1 = require("./obj");
var is_1 = require("./is");
var str_1 = require("./str");
var Dfr_1 = require("./class/Dfr");
var Uri_1 = require("./class/Uri");
var EventEmitter_1 = require("./class/EventEmitter");
var mixin_1 = require("./mixin");
exports.Lib = {
class_Dfr: Dfr_1.class_Dfr,
class_EventEmitter: EventEmitter_1.class_EventEmitter,
class_Uri: Uri_1.class_Uri,
class_create: class_1.class_create,
class_createEx: class_1.class_createEx,
arr_remove: arr_1.arr_remove,
arr_each: arr_1.arr_each,
arr_indexOf: arr_1.arr_indexOf,
arr_contains: arr_1.arr_contains,
arr_pushMany: arr_1.arr_pushMany,
error_createClass: error_1.error_createClass,
fn_createByPattern: fn_1.fn_createByPattern,
fn_doNothing: fn_1.fn_doNothing,
obj_getProperty: obj_1.obj_getProperty,
obj_setProperty: obj_1.obj_setProperty,
obj_hasProperty: obj_1.obj_hasProperty,
obj_extend: obj_1.obj_extend,
obj_extendDefaults: obj_1.obj_extendDefaults,
obj_extendMany: obj_1.obj_extendMany,
obj_extendProperties: obj_1.obj_extendProperties,
obj_extendPropertiesDefaults: obj_1.obj_extendPropertiesDefaults,
obj_create: obj_1.obj_create,
obj_defineProperty: obj_1.obj_defineProperty,
obj_clean: obj_1.obj_clean,
is_Function: is_1.is_Function,
is_Array: is_1.is_Array,
is_ArrayLike: is_1.is_ArrayLike,
is_String: is_1.is_String,
is_Object: is_1.is_Object,
is_notEmptyString: is_1.is_notEmptyString,
is_rawObject: is_1.is_rawObject,
is_Date: is_1.is_Date,
is_NODE: is_1.is_NODE,
is_DOM: is_1.is_DOM,
str_format: str_1.str_format,
str_dedent: str_1.str_dedent,
mixin: mixin_1.mixin
};

@@ -1590,0 +1686,0 @@

{
"name": "atma-utils",
"description": "Helpers",
"version": "0.1.41",
"version": "0.2.42",
"author": "Alexander Kit <alex.kit@atmajs.com>",

@@ -17,12 +17,15 @@ "repository": {

"main": "lib/utils.js",
"types": "./types/module.d.ts",
"types": "./lib/utils.d.ts",
"devDependencies": {
"app-bundler": "0.0.68",
"atma": "^0.12.2",
"app-bundler": "^0.0.94",
"atma": "^0.12.28",
"atma-io": "^1.2.37",
"atma-loader-babel": ">0.0.0",
"atma-loader-ts": "^1.1.12"
"atma-loader-ts": "^1.1.12",
"dts-bundle": "^0.7.3"
},
"scripts": {
"test": "atma test",
"build": "app-bundler",
"build": "app-bundler && npm run dts",
"dts": "tsc -p tsconfig-build.json && atma run tools/build-dts",
"release": "echo \"Run atma pub -m \"message\"\""

@@ -90,6 +93,6 @@ },

"#if (TEST)": {
"module": "amd"
"module": "AMD"
},
"#if (!TEST)": {
"module": "esnext"
"module": "CommonJS"
}

@@ -96,0 +99,0 @@ }

{
"compilerOptions": {
"target":"es5",
"module": "amd"
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc