@firestitch/common 12.6.3 → 12.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/input'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/common', ['exports', '@angular/core', '@angular/common', '@angular/material/input', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.common = {}), global.ng.core, global.ng.common, global.ng.material.input, global.rxjs, global.rxjs.operators));
5
- })(this, (function (exports, i0, common, i1, rxjs, operators) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('@angular/material/input')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/common', ['exports', '@angular/core', '@angular/common', 'rxjs', 'rxjs/operators', '@angular/material/input'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.common = {}), global.ng.core, global.ng.common, global.rxjs, global.rxjs.operators, global.ng.material.input));
5
+ })(this, (function (exports, i0, common, rxjs, operators, i1) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -656,186 +656,381 @@
656
656
  }]
657
657
  }] });
658
658
 
659
- function number(value, decimals) {
660
- return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: decimals });
659
+ function boolean(value) {
660
+ return String(value).toLowerCase() !== 'false' && !!value;
661
661
  }
662
662
 
663
- var FsFormatNumberPipe = /** @class */ (function () {
664
- function FsFormatNumberPipe() {
665
- }
666
- FsFormatNumberPipe.prototype.transform = function (value, decimals) {
667
- return number(value, decimals);
663
+ function debounce(func, wait, immediate) {
664
+ var timeout;
665
+ return function () {
666
+ var context = this, args = arguments;
667
+ var later = function () {
668
+ timeout = null;
669
+ if (!immediate)
670
+ func.apply(context, args);
671
+ };
672
+ var callNow = immediate && !timeout;
673
+ clearTimeout(timeout);
674
+ timeout = setTimeout(later, wait);
675
+ if (callNow)
676
+ func.apply(context, args);
668
677
  };
669
- return FsFormatNumberPipe;
670
- }());
671
- FsFormatNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
672
- FsFormatNumberPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, name: "fsFormatNumber" });
673
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, decorators: [{
674
- type: i0.Pipe,
675
- args: [{
676
- name: 'fsFormatNumber'
677
- }]
678
- }] });
679
-
680
- function currency(amount, precision, currencyCode, locale) {
681
- if (precision === void 0) { precision = [2, 10]; }
682
- if (currencyCode === void 0) { currencyCode = 'USD'; }
683
- if (locale === void 0) { locale = 'en-US'; }
684
- var digitsInfo = Array.isArray(precision) ? precision : [precision, precision];
685
- return new common.CurrencyPipe(locale).transform(amount, currencyCode, 'symbol', "1." + digitsInfo[0] + "-" + digitsInfo[1]);
686
678
  }
687
679
 
688
- var FsFormatCurrencyPipe = /** @class */ (function () {
689
- function FsFormatCurrencyPipe(locale) {
690
- this.locale = locale;
691
- }
692
- FsFormatCurrencyPipe.prototype.transform = function (amount, precision, currencyCode) {
693
- if (precision === void 0) { precision = 2; }
694
- return currency(amount, precision, currencyCode);
695
- };
696
- return FsFormatCurrencyPipe;
697
- }());
698
- FsFormatCurrencyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, deps: [{ token: i0.LOCALE_ID }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
699
- FsFormatCurrencyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
700
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, decorators: [{
701
- type: i0.Pipe,
702
- args: [{
703
- name: 'fsFormatCurrency'
704
- }]
705
- }], ctorParameters: function () {
706
- return [{ type: undefined, decorators: [{
707
- type: i0.Inject,
708
- args: [i0.LOCALE_ID]
709
- }] }];
710
- } });
680
+ var KEY_CANCEL = 3;
681
+ var KEY_HELP = 6;
682
+ var KEY_BACKSPACE = 8;
683
+ var KEY_TAB = 9;
684
+ var KEY_CLEAR = 12;
685
+ var KEY_RETURN = 13;
686
+ var KEY_ENTER = 14;
687
+ var KEY_SHIFT = 16;
688
+ var KEY_CONTROL = 17;
689
+ var KEY_ALT = 18;
690
+ var KEY_PAUSE = 19;
691
+ var KEY_CAPS_LOCK = 20;
692
+ var KEY_ESCAPE = 27;
693
+ var KEY_SPACE = 32;
694
+ var KEY_PAGE_UP = 33;
695
+ var KEY_PAGE_DOWN = 34;
696
+ var KEY_END = 35;
697
+ var KEY_HOME = 36;
698
+ var KEY_LEFT = 37;
699
+ var KEY_UP = 38;
700
+ var KEY_RIGHT = 39;
701
+ var KEY_DOWN = 40;
702
+ var KEY_PRINTSCREEN = 44;
703
+ var KEY_INSERT = 45;
704
+ var KEY_DELETE = 46;
705
+ var KEY_0 = 48;
706
+ var KEY_1 = 49;
707
+ var KEY_2 = 50;
708
+ var KEY_3 = 51;
709
+ var KEY_4 = 52;
710
+ var KEY_5 = 53;
711
+ var KEY_6 = 54;
712
+ var KEY_7 = 55;
713
+ var KEY_8 = 56;
714
+ var KEY_9 = 57;
715
+ var KEY_SEMICOLON = 59;
716
+ var KEY_EQUALS = 61;
711
717
 
712
- function truncate(value, limit, completeWords, ellipsis) {
713
- if (limit === void 0) { limit = 100; }
714
- if (completeWords === void 0) { completeWords = false; }
715
- if (ellipsis === void 0) { ellipsis = '...'; }
716
- value = value || '';
717
- if (completeWords) {
718
- limit = value.substr(0, limit).lastIndexOf(' ');
718
+ function length(object) {
719
+ if (Array.isArray(object)) {
720
+ return object.length;
719
721
  }
720
- var result = "" + value.substr(0, limit);
721
- if (result !== value) {
722
- result += ellipsis;
722
+ if (object instanceof Object) {
723
+ return Object.keys(object).length;
723
724
  }
724
- return result;
725
+ return 0;
725
726
  }
726
727
 
727
- var FsFormatTruncatePipe = /** @class */ (function () {
728
- function FsFormatTruncatePipe() {
729
- }
730
- FsFormatTruncatePipe.prototype.transform = function (value, limit, completeWords, ellipsis) {
731
- return truncate(value, limit, completeWords, ellipsis);
732
- };
733
- return FsFormatTruncatePipe;
734
- }());
735
- FsFormatTruncatePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
736
- FsFormatTruncatePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
737
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, decorators: [{
738
- type: i0.Pipe,
739
- args: [{
740
- name: 'fsFormatTruncate'
741
- }]
742
- }], ctorParameters: function () { return []; } });
728
+ function resolve(promise, defaults) {
729
+ if (defaults === void 0) { defaults = []; }
730
+ var result = defaults;
731
+ return new Promise(function (resolve) {
732
+ promise.then(function (data) {
733
+ Object.keys(data).forEach(function (key) { return result[key] = data[key]; });
734
+ resolve(result);
735
+ });
736
+ });
737
+ }
743
738
 
744
- var FsStopPropagationDirective = /** @class */ (function () {
745
- function FsStopPropagationDirective() {
746
- }
747
- FsStopPropagationDirective.prototype.preventClick = function (event) {
748
- event.stopPropagation();
749
- };
750
- return FsStopPropagationDirective;
751
- }());
752
- FsStopPropagationDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
753
- FsStopPropagationDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
754
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, decorators: [{
755
- type: i0.Directive,
756
- args: [{
757
- selector: '[fsStopPropagation]',
758
- }]
759
- }], propDecorators: { preventClick: [{
760
- type: i0.HostListener,
761
- args: ['click', ['$event']]
762
- }] } });
739
+ function uuid() {
740
+ return guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
741
+ }
763
742
 
764
- var FsPreventDefaultDirective = /** @class */ (function () {
765
- function FsPreventDefaultDirective() {
743
+ function value(object, key, def) {
744
+ if (typeof object === 'object' || Array.isArray(object)) {
745
+ if (object.hasOwnProperty(key)) {
746
+ return object[key];
747
+ }
766
748
  }
767
- FsPreventDefaultDirective.prototype.preventClick = function (event) {
768
- event.preventDefault();
769
- };
770
- return FsPreventDefaultDirective;
771
- }());
772
- FsPreventDefaultDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
773
- FsPreventDefaultDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
774
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, decorators: [{
775
- type: i0.Directive,
776
- args: [{
777
- selector: '[fsPreventDefault]',
778
- }]
779
- }], propDecorators: { preventClick: [{
780
- type: i0.HostListener,
781
- args: ['click', ['$event']]
782
- }] } });
749
+ return def;
750
+ }
783
751
 
784
- var FsAutofocusDirective = /** @class */ (function () {
785
- function FsAutofocusDirective(_matInput, _el) {
786
- this._matInput = _matInput;
787
- this._el = _el;
788
- this.fsAutofocus = true;
789
- }
790
- FsAutofocusDirective.prototype.ngAfterViewInit = function () {
791
- if (this.fsAutofocus || this.fsAutofocus === undefined) {
792
- this.focus();
793
- }
794
- };
795
- FsAutofocusDirective.prototype.focus = function () {
796
- var _this = this;
797
- setTimeout(function () {
798
- var tmpEl = document.createElement('input');
799
- tmpEl.style.width = '0';
800
- tmpEl.style.height = '0';
801
- tmpEl.style.margin = '0';
802
- tmpEl.style.padding = '0';
803
- tmpEl.style.border = '0';
804
- tmpEl.style.opacity = '0';
805
- document.body.appendChild(tmpEl);
806
- tmpEl.focus();
807
- if (_this._matInput) {
808
- _this._matInput.focus();
752
+ function isClass(value, cls) {
753
+ if (typeof value === 'object') {
754
+ if (typeof cls === 'string') {
755
+ if (value.constructor) {
756
+ if (value.constructor.name === cls) {
757
+ return true;
758
+ }
809
759
  }
810
- else if (_this._el.nativeElement.focus) {
811
- _this._el.nativeElement.focus();
760
+ }
761
+ else {
762
+ if (value instanceof cls) {
763
+ return true;
812
764
  }
813
- document.body.removeChild(tmpEl);
814
- }, 50);
815
- };
816
- return FsAutofocusDirective;
817
- }());
818
- FsAutofocusDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, deps: [{ token: i1__namespace.MatInput, host: true, optional: true }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
819
- FsAutofocusDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsAutofocusDirective, selector: "[fsAutofocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus" }, ngImport: i0__namespace });
820
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, decorators: [{
821
- type: i0.Directive,
822
- args: [{
823
- selector: '[fsAutofocus],[autofocus]',
824
- }]
825
- }], ctorParameters: function () {
826
- return [{ type: i1__namespace.MatInput, decorators: [{
827
- type: i0.Optional
828
- }, {
829
- type: i0.Host
830
- }] }, { type: i0__namespace.ElementRef }];
831
- }, propDecorators: { fsAutofocus: [{
832
- type: i0.Input
833
- }] } });
765
+ }
766
+ }
767
+ return false;
768
+ }
834
769
 
835
- /*! *****************************************************************************
836
- Copyright (c) Microsoft Corporation.
837
-
838
- Permission to use, copy, modify, and/or distribute this software for any
770
+ function isNumeric(value) {
771
+ var str = String(value);
772
+ return str.length && !!str.match(/^-?\d*\.?\d*$/);
773
+ }
774
+
775
+ function isObject(value) {
776
+ return !!value && typeof value === 'object' && !Array.isArray(value);
777
+ }
778
+
779
+ function throttle(func, wait) {
780
+ var waiting = false; // Initially, we're not waiting
781
+ return function () {
782
+ if (!waiting) { // If we're not waiting
783
+ func.apply(null, arguments); // Execute users function
784
+ waiting = true; // Prevent future invocations
785
+ setTimeout(function () {
786
+ waiting = false; // And allow future invocations
787
+ }, wait);
788
+ }
789
+ };
790
+ }
791
+
792
+ var Operation = /** @class */ (function () {
793
+ function Operation(target, name) {
794
+ this.ready$ = new rxjs.Subject();
795
+ this.name = name ? name : guid();
796
+ if (target instanceof rxjs.Observable) {
797
+ this.target = target;
798
+ }
799
+ else {
800
+ this.target = rxjs.of(target);
801
+ }
802
+ }
803
+ return Operation;
804
+ }());
805
+
806
+ exports.QueueState = void 0;
807
+ (function (QueueState) {
808
+ QueueState["Idle"] = "idle";
809
+ QueueState["Processing"] = "processing";
810
+ })(exports.QueueState || (exports.QueueState = {}));
811
+
812
+ var Queue = /** @class */ (function () {
813
+ function Queue(_limit) {
814
+ if (_limit === void 0) { _limit = Infinity; }
815
+ this._limit = _limit;
816
+ this._queueStats = {
817
+ completed: 0,
818
+ total: 0,
819
+ errors: [],
820
+ };
821
+ this._doneQueueStats = {
822
+ completed: 0,
823
+ total: 0,
824
+ errors: [],
825
+ };
826
+ this._completeQueueStats = {
827
+ completed: 0,
828
+ total: 0,
829
+ errors: [],
830
+ };
831
+ this._done = new rxjs.Subject();
832
+ this._queue = [];
833
+ this._inProgress = [];
834
+ this._state = exports.QueueState.Idle;
835
+ this._destroy$ = new rxjs.Subject();
836
+ // if(_targets) {
837
+ // _targets.forEach((target) => {
838
+ // this.push(target);
839
+ // });
840
+ // }
841
+ }
842
+ Object.defineProperty(Queue.prototype, "total", {
843
+ get: function () {
844
+ return this._queueStats.total;
845
+ },
846
+ enumerable: false,
847
+ configurable: true
848
+ });
849
+ Object.defineProperty(Queue.prototype, "completed", {
850
+ get: function () {
851
+ return this._queueStats.completed;
852
+ },
853
+ enumerable: false,
854
+ configurable: true
855
+ });
856
+ Object.defineProperty(Queue.prototype, "pending", {
857
+ get: function () {
858
+ return this._queue.length;
859
+ },
860
+ enumerable: false,
861
+ configurable: true
862
+ });
863
+ Object.defineProperty(Queue.prototype, "inProgress", {
864
+ get: function () {
865
+ return this._inProgress.length;
866
+ },
867
+ enumerable: false,
868
+ configurable: true
869
+ });
870
+ Object.defineProperty(Queue.prototype, "errors", {
871
+ get: function () {
872
+ return this._queueStats.errors;
873
+ },
874
+ enumerable: false,
875
+ configurable: true
876
+ });
877
+ Object.defineProperty(Queue.prototype, "state", {
878
+ get: function () {
879
+ return this._state;
880
+ },
881
+ enumerable: false,
882
+ configurable: true
883
+ });
884
+ Object.defineProperty(Queue.prototype, "empty", {
885
+ get: function () {
886
+ return !this._queue.length && !this._inProgress.length;
887
+ },
888
+ enumerable: false,
889
+ configurable: true
890
+ });
891
+ Object.defineProperty(Queue.prototype, "pendingOperations", {
892
+ get: function () {
893
+ return this._queue
894
+ .map(function (operation) { return operation.name; });
895
+ },
896
+ enumerable: false,
897
+ configurable: true
898
+ });
899
+ Object.defineProperty(Queue.prototype, "inProgressOperations", {
900
+ get: function () {
901
+ return this._inProgress
902
+ .map(function (operation) { return operation.name; });
903
+ },
904
+ enumerable: false,
905
+ configurable: true
906
+ });
907
+ Queue.prototype.isProcessing = function () {
908
+ return this._state === exports.QueueState.Processing;
909
+ };
910
+ Queue.prototype.isIdle = function () {
911
+ return this._state === exports.QueueState.Idle;
912
+ };
913
+ Queue.prototype.setLimit = function (value) {
914
+ this._limit = value;
915
+ };
916
+ /**
917
+ * @depreated
918
+ */
919
+ Queue.prototype.subscribe = function (fun, err, complete) {
920
+ this.observe$
921
+ .subscribe(fun, err, complete);
922
+ };
923
+ Object.defineProperty(Queue.prototype, "observe$", {
924
+ get: function () {
925
+ return this._done
926
+ .pipe(operators.takeUntil(this._destroy$));
927
+ },
928
+ enumerable: false,
929
+ configurable: true
930
+ });
931
+ Object.defineProperty(Queue.prototype, "complete$", {
932
+ get: function () {
933
+ var _this = this;
934
+ if (!this.isProcessing()) {
935
+ return rxjs.of({ total: 0, completed: 0, errors: [] });
936
+ }
937
+ return this.observe$
938
+ .pipe(operators.take(1), operators.map(function () { return (_this._completeQueueStats); }));
939
+ },
940
+ enumerable: false,
941
+ configurable: true
942
+ });
943
+ Queue.prototype.complete = function (fun, err, complete) {
944
+ this.complete$.subscribe(fun, err, complete);
945
+ };
946
+ Queue.prototype.push = function (target, name) {
947
+ var operation = new Operation(target, name);
948
+ this._queueStats.total++;
949
+ this._doneQueueStats.total++;
950
+ this._completeQueueStats.total++;
951
+ this._state = exports.QueueState.Processing;
952
+ if (this._inProgress.length < this._limit) {
953
+ this._processOperation(operation);
954
+ }
955
+ else {
956
+ this._queue.push(operation);
957
+ }
958
+ return operation.ready$;
959
+ };
960
+ Queue.prototype.clear = function () {
961
+ this._queue = [];
962
+ this._state = exports.QueueState.Idle;
963
+ this._queueStats = {
964
+ total: 0,
965
+ errors: [],
966
+ completed: 0,
967
+ };
968
+ this._clearDoneQueueStats();
969
+ };
970
+ Queue.prototype.destroy = function () {
971
+ this._done.complete();
972
+ this.clear();
973
+ };
974
+ Queue.prototype._processOperation = function (operation) {
975
+ var _this = this;
976
+ this._inProgress.push(operation);
977
+ operation.target
978
+ .pipe(operators.delay(200), // Hack to prevent extra quick proccess execution
979
+ operators.finalize(function () {
980
+ var opIndex = _this._inProgress.indexOf(operation);
981
+ _this._inProgress.splice(opIndex, 1);
982
+ if (_this.empty) {
983
+ _this._state = exports.QueueState.Idle;
984
+ _this._done.next(_this._doneQueueStats);
985
+ _this._clearDoneQueueStats();
986
+ }
987
+ else {
988
+ if (_this._queue.length) {
989
+ var queueItem = _this._queue.shift();
990
+ _this._processOperation(queueItem);
991
+ }
992
+ }
993
+ }), operators.takeUntil(this._destroy$)).subscribe({
994
+ next: function (data) {
995
+ operation.ready$.next(data);
996
+ },
997
+ error: function (error) {
998
+ _this._queueStats.errors.push(error);
999
+ _this._doneQueueStats.errors.push(error);
1000
+ _this._completeQueueStats.errors.push(error);
1001
+ operation.ready$.error(error);
1002
+ },
1003
+ complete: function () {
1004
+ _this._queueStats.completed++;
1005
+ _this._doneQueueStats.completed++;
1006
+ _this._completeQueueStats.completed++;
1007
+ operation.ready$.complete();
1008
+ }
1009
+ });
1010
+ };
1011
+ Queue.prototype._clearDoneQueueStats = function () {
1012
+ this._doneQueueStats = {
1013
+ total: 0,
1014
+ errors: [],
1015
+ completed: 0,
1016
+ };
1017
+ };
1018
+ return Queue;
1019
+ }());
1020
+
1021
+ function removeQueryParams(path) {
1022
+ return path.split('?')[0];
1023
+ }
1024
+
1025
+ function getNormalizedPath(locationSrv) {
1026
+ var path = locationSrv.prepareExternalUrl(locationSrv.path());
1027
+ return removeQueryParams(path);
1028
+ }
1029
+
1030
+ /*! *****************************************************************************
1031
+ Copyright (c) Microsoft Corporation.
1032
+
1033
+ Permission to use, copy, modify, and/or distribute this software for any
839
1034
  purpose with or without fee is hereby granted.
840
1035
 
841
1036
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
@@ -1135,800 +1330,610 @@
1135
1330
  }
1136
1331
  function __classPrivateFieldGet(receiver, state, kind, f) {
1137
1332
  if (kind === "a" && !f)
1138
- throw new TypeError("Private accessor was defined without a getter");
1139
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1140
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1141
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1142
- }
1143
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1144
- if (kind === "m")
1145
- throw new TypeError("Private method is not writable");
1146
- if (kind === "a" && !f)
1147
- throw new TypeError("Private accessor was defined without a setter");
1148
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1149
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1150
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1151
- }
1152
-
1153
- function ordinalNumber(value) {
1154
- value = String(value);
1155
- var index = value.match(templateObject_1 || (templateObject_1 = __makeTemplateObject(["1?.$"], ["1?.$"])));
1156
- var endings = [, 'st', 'nd', 'rd'];
1157
- var ending = endings[index] || 'th';
1158
- return value + ending;
1159
- }
1160
- var templateObject_1;
1161
-
1162
- var FsFormatOrdinalNumberPipe = /** @class */ (function () {
1163
- function FsFormatOrdinalNumberPipe() {
1164
- }
1165
- FsFormatOrdinalNumberPipe.prototype.transform = function (value) {
1166
- return ordinalNumber(value);
1167
- };
1168
- return FsFormatOrdinalNumberPipe;
1169
- }());
1170
- FsFormatOrdinalNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1171
- FsFormatOrdinalNumberPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, name: "fsFormatOrdinalNumber" });
1172
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, decorators: [{
1173
- type: i0.Pipe,
1174
- args: [{
1175
- name: 'fsFormatOrdinalNumber',
1176
- }]
1177
- }] });
1178
-
1179
- function email(value) {
1180
- return !!String(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
1181
- }
1182
-
1183
- function phone(value) {
1184
- var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
1185
- return valid || !String(value).length;
1186
- }
1187
-
1188
- /**
1189
- * Check validity of the url.
1190
- * Protocol (http/https) isn't required.
1191
- * @param value
1192
- * @returns {boolean}
1193
- */
1194
- function url(value) {
1195
- var expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
1196
- var regexp = new RegExp(expression);
1197
- return !!String(value).match(regexp);
1198
- }
1199
-
1200
- function compare(query, item) {
1201
- var value = true;
1202
- for (var key in query) {
1203
- value = value && item[key] == query[key];
1204
- }
1205
- return value;
1206
- }
1207
-
1208
- function filter(array, query) {
1209
- if (typeof query !== 'function') {
1210
- var queryObj_1 = query;
1211
- query = function (item) {
1212
- return compare(queryObj_1, item);
1213
- };
1214
- }
1215
- var isarray = Array.isArray(array);
1216
- var list = isarray ? [] : {};
1217
- if (isarray) {
1218
- array.forEach(function (item, idx) {
1219
- if (query(item)) {
1220
- list.push(item);
1221
- }
1222
- });
1223
- }
1224
- else {
1225
- Object.keys(array).forEach(function (key) {
1226
- if (query(array[key])) {
1227
- list[key] = array[key];
1228
- }
1229
- });
1230
- }
1231
- return list;
1232
- }
1233
-
1234
- function inArray(values, array) {
1235
- if (!Array.isArray(values)) {
1236
- values = [values];
1237
- }
1238
- for (var i = 0, len = values.length; i < len; i++) {
1239
- if (array.indexOf(values[i]) >= 0) {
1240
- return true;
1241
- }
1242
- }
1243
- return false;
1244
- }
1245
-
1246
- function index(array, name, value) {
1247
- if (value === void 0) { value = null; }
1248
- var list = {};
1249
- array.forEach(function (item) {
1250
- list[item[name]] = value ? item[value] : item;
1251
- });
1252
- return list;
1253
- }
1254
-
1255
- function indexOf(array, query) {
1256
- if (typeof query !== 'function') {
1257
- var queryObj_1 = query;
1258
- query = function (item) {
1259
- return compare(queryObj_1, item);
1260
- };
1261
- }
1262
- for (var i = 0, len = array.length; i < len; i++) {
1263
- if (query(array[i])) {
1264
- return i;
1265
- }
1266
- }
1267
- return -1;
1268
- }
1269
-
1270
- function keyExists(array, key) {
1271
- return array.hasOwnProperty(key);
1272
- }
1273
-
1274
- function ksort(unordered) {
1275
- Object.keys(unordered).sort().forEach(function (key) {
1276
- var value = unordered[key];
1277
- delete unordered[key];
1278
- unordered[key] = value;
1279
- });
1280
- }
1281
-
1282
- function list(array, property, index) {
1283
- if (index === void 0) { index = null; }
1284
- var resultList = index ? {} : [];
1285
- array.forEach(function (item, idx) {
1286
- if (index) {
1287
- resultList[item[index]] = item[property];
1288
- }
1289
- else {
1290
- resultList.push(item[property]);
1291
- }
1292
- });
1293
- return resultList;
1294
- }
1295
-
1296
- function nameValue(array, name, value) {
1297
- var list = [];
1298
- if (name || value) {
1299
- var nameFn_1 = typeof name === 'function' ? name : function (item) {
1300
- return item[name];
1301
- };
1302
- var valueFn_1 = typeof value === 'function' ? value : function (item) {
1303
- return item[value];
1304
- };
1305
- array.forEach(function (item) {
1306
- list.push({ name: nameFn_1(item), value: valueFn_1(item) });
1307
- });
1308
- }
1309
- else {
1310
- array.forEach(function (n, v) {
1311
- list.push({ name: n, value: v });
1312
- });
1313
- }
1314
- return list;
1315
- }
1316
-
1317
- function remove(array, query) {
1318
- var idx = indexOf(array, query);
1319
- if (idx >= 0) {
1320
- return array.splice(idx, 1);
1321
- }
1322
- return idx;
1323
- }
1324
-
1325
- function sort(array, query, reverse) {
1326
- if (reverse === void 0) { reverse = false; }
1327
- if (typeof query !== 'function') {
1328
- var queryStr_1 = query;
1329
- query = function (a, b) {
1330
- if (reverse) {
1331
- if (a[queryStr_1] < b[queryStr_1]) {
1332
- return 1;
1333
- }
1334
- else if (a[queryStr_1] > b[queryStr_1]) {
1335
- return -1;
1336
- }
1337
- }
1338
- else {
1339
- if (a[queryStr_1] > b[queryStr_1]) {
1340
- return 1;
1341
- }
1342
- else if (a[queryStr_1] < b[queryStr_1]) {
1343
- return -1;
1344
- }
1345
- }
1346
- return 0;
1347
- };
1348
- }
1349
- array.sort(query);
1350
- return array;
1351
- }
1352
-
1353
- function rsort(array, query) {
1354
- return sort(array, query, true);
1355
- }
1356
-
1357
- function find(array, query) {
1358
- var data = filter(array, query);
1359
- return data.length ? data[0] : null;
1360
- }
1361
-
1362
- function boolean(value) {
1363
- return String(value).toLowerCase() !== 'false' && !!value;
1364
- }
1365
-
1366
- function debounce(func, wait, immediate) {
1367
- var timeout;
1368
- return function () {
1369
- var context = this, args = arguments;
1370
- var later = function () {
1371
- timeout = null;
1372
- if (!immediate)
1373
- func.apply(context, args);
1374
- };
1375
- var callNow = immediate && !timeout;
1376
- clearTimeout(timeout);
1377
- timeout = setTimeout(later, wait);
1378
- if (callNow)
1379
- func.apply(context, args);
1380
- };
1333
+ throw new TypeError("Private accessor was defined without a getter");
1334
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1335
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
1336
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1337
+ }
1338
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
1339
+ if (kind === "m")
1340
+ throw new TypeError("Private method is not writable");
1341
+ if (kind === "a" && !f)
1342
+ throw new TypeError("Private accessor was defined without a setter");
1343
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1344
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
1345
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1381
1346
  }
1382
1347
 
1383
- var KEY_CANCEL = 3;
1384
- var KEY_HELP = 6;
1385
- var KEY_BACKSPACE = 8;
1386
- var KEY_TAB = 9;
1387
- var KEY_CLEAR = 12;
1388
- var KEY_RETURN = 13;
1389
- var KEY_ENTER = 14;
1390
- var KEY_SHIFT = 16;
1391
- var KEY_CONTROL = 17;
1392
- var KEY_ALT = 18;
1393
- var KEY_PAUSE = 19;
1394
- var KEY_CAPS_LOCK = 20;
1395
- var KEY_ESCAPE = 27;
1396
- var KEY_SPACE = 32;
1397
- var KEY_PAGE_UP = 33;
1398
- var KEY_PAGE_DOWN = 34;
1399
- var KEY_END = 35;
1400
- var KEY_HOME = 36;
1401
- var KEY_LEFT = 37;
1402
- var KEY_UP = 38;
1403
- var KEY_RIGHT = 39;
1404
- var KEY_DOWN = 40;
1405
- var KEY_PRINTSCREEN = 44;
1406
- var KEY_INSERT = 45;
1407
- var KEY_DELETE = 46;
1408
- var KEY_0 = 48;
1409
- var KEY_1 = 49;
1410
- var KEY_2 = 50;
1411
- var KEY_3 = 51;
1412
- var KEY_4 = 52;
1413
- var KEY_5 = 53;
1414
- var KEY_6 = 54;
1415
- var KEY_7 = 55;
1416
- var KEY_8 = 56;
1417
- var KEY_9 = 57;
1418
- var KEY_SEMICOLON = 59;
1419
- var KEY_EQUALS = 61;
1348
+ function ordinalNumber(value) {
1349
+ value = String(value);
1350
+ var index = value.match(templateObject_1 || (templateObject_1 = __makeTemplateObject(["1?.$"], ["1?.$"])));
1351
+ var endings = [, 'st', 'nd', 'rd'];
1352
+ var ending = endings[index] || 'th';
1353
+ return value + ending;
1354
+ }
1355
+ var templateObject_1;
1420
1356
 
1421
- function length(object) {
1422
- if (Array.isArray(object)) {
1423
- return object.length;
1357
+ function round(num, decimalPlaces) {
1358
+ if (decimalPlaces === void 0) { decimalPlaces = 0; }
1359
+ num = parseFloat(parseFloat(num).toPrecision(Number.MAX_SAFE_INTEGER.toString().length - 1));
1360
+ var p = Math.pow(10, decimalPlaces);
1361
+ return Math.round(num * p) / p;
1362
+ }
1363
+
1364
+ function clone(obj) {
1365
+ if (obj instanceof Date) {
1366
+ return new Date(obj);
1424
1367
  }
1425
- if (object instanceof Object) {
1426
- return Object.keys(object).length;
1368
+ else if (Array.isArray(obj)) {
1369
+ var arr = [];
1370
+ for (var i = 0; i < obj.length; i++) {
1371
+ arr[i] = clone(obj[i]);
1372
+ }
1373
+ return arr;
1427
1374
  }
1428
- return 0;
1375
+ else if (typeof (obj) === 'object') {
1376
+ var cloned = {};
1377
+ for (var key in obj) {
1378
+ cloned[key] = clone(obj[key]);
1379
+ }
1380
+ return cloned;
1381
+ }
1382
+ return obj;
1429
1383
  }
1430
1384
 
1431
- function resolve(promise, defaults) {
1432
- if (defaults === void 0) { defaults = []; }
1433
- var result = defaults;
1434
- return new Promise(function (resolve) {
1435
- promise.then(function (data) {
1436
- Object.keys(data).forEach(function (key) { return result[key] = data[key]; });
1437
- resolve(result);
1438
- });
1439
- });
1385
+ function toString(value) {
1386
+ if (value === null || value === undefined) {
1387
+ return '';
1388
+ }
1389
+ return "" + value;
1440
1390
  }
1441
1391
 
1442
- function uuid() {
1443
- return guid('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
1392
+ function isArrayEqual(arr1, arr2) {
1393
+ if (!Array.isArray(arr1) || !Array.isArray(arr2) || arr1.length !== arr2.length) {
1394
+ return false;
1395
+ }
1396
+ var sortFn = function (a, b) {
1397
+ if (a < b) {
1398
+ return -1;
1399
+ }
1400
+ else if (a > b) {
1401
+ return 1;
1402
+ }
1403
+ else {
1404
+ return 0;
1405
+ }
1406
+ };
1407
+ arr1 = __spreadArray([], __read(arr1)).sort(sortFn);
1408
+ arr2 = __spreadArray([], __read(arr2)).sort(sortFn);
1409
+ return arr1.every(function (value, index) {
1410
+ return value === arr2[index];
1411
+ });
1444
1412
  }
1445
1413
 
1446
- function value(object, key, def) {
1447
- if (typeof object === 'object' || Array.isArray(object)) {
1448
- if (object.hasOwnProperty(key)) {
1449
- return object[key];
1414
+ var fsSourceLoader = (function () {
1415
+ var _document;
1416
+ var _headElement;
1417
+ var _sources = new Map();
1418
+ var _loadedResources = new Map();
1419
+ // bad way but don't want to bother developer
1420
+ setDocument(document);
1421
+ // but developer can set document at any time
1422
+ function setDocument(document) {
1423
+ _document = document;
1424
+ _headElement = _document === null || _document === void 0 ? void 0 : _document.head;
1425
+ }
1426
+ /**
1427
+ * register a list of the resources for future loading
1428
+ *
1429
+ * example:
1430
+ * sourceLoader.registerResources({
1431
+ * froala: [
1432
+ * '/assets/js/froala/froala_editor.min.js',
1433
+ * '/assets/css/froala_editor.pkgd.min.css',
1434
+ * ],
1435
+ * froala_align: '/assets/js/froala/plugins/align.min.js',
1436
+ * froala_colors: '/assets/js/froala/plugins/colors.min.js',
1437
+ * froala_image: '/assets/js/froala/plugins/image.min.js',
1438
+ * });
1439
+ *
1440
+ */
1441
+ function registerResources(resources) {
1442
+ Object.entries(resources)
1443
+ .forEach(function (_a) {
1444
+ var _b = __read(_a, 2), name = _b[0], path = _b[1];
1445
+ if (typeof path === 'string') {
1446
+ path = [path];
1447
+ }
1448
+ if (!_sources.has(name)) {
1449
+ _sources.set(name, new Set());
1450
+ }
1451
+ var resourcesList = _sources.get(name);
1452
+ path.forEach(function (p) {
1453
+ resourcesList.add(p);
1454
+ });
1455
+ });
1456
+ }
1457
+ /**
1458
+ * load any resource previously registered
1459
+ *
1460
+ * sourceLoader.loadResource('froala')
1461
+ *
1462
+ * or load any js/css file
1463
+ *
1464
+ * sourceLoader.loadResource('/assets/my-source.js')
1465
+ *
1466
+ */
1467
+ function loadResource(name) {
1468
+ if (_loadedResources.has(name)) {
1469
+ return _loadedResources.get(name);
1470
+ }
1471
+ if (_sources.has(name)) {
1472
+ var sourcesForLoading = __spreadArray([], __read(_sources.get(name))).map(function (path) {
1473
+ return _loadResource(path);
1474
+ })
1475
+ .filter(function (v) { return !!v; });
1476
+ return rxjs.combineLatest(sourcesForLoading);
1477
+ }
1478
+ return _loadResource(name);
1479
+ }
1480
+ /**
1481
+ * the same as `loadResource` but you can pass list of the resources for loading
1482
+ */
1483
+ function loadResources(listOfResources) {
1484
+ var resourcesToLoad = listOfResources
1485
+ .reduce(function (acc, name) {
1486
+ var loading$ = loadResource(name);
1487
+ if (loading$) {
1488
+ acc.push(loading$);
1489
+ }
1490
+ return acc;
1491
+ }, []);
1492
+ return rxjs.combineLatest(resourcesToLoad);
1493
+ }
1494
+ ///
1495
+ function _loadResource(path) {
1496
+ if (_isStylesUrl(path)) {
1497
+ return _loadStyles(path);
1498
+ }
1499
+ if (_isJavascriptUrl(path)) {
1500
+ return _loadJs(path);
1501
+ }
1502
+ console.warn("Resource " + path + " can not be identified and loaded");
1503
+ return null;
1504
+ }
1505
+ function _loadJs(scriptPath) {
1506
+ if (!_loadedResources.has(scriptPath)) {
1507
+ var obs$ = new rxjs.Observable(function (obs) {
1508
+ var script = document.createElement('script');
1509
+ script.src = scriptPath;
1510
+ _headElement.appendChild(script);
1511
+ script.onload = function () {
1512
+ obs.next();
1513
+ obs.complete();
1514
+ };
1515
+ script.onerror = function (err) {
1516
+ obs.error(err);
1517
+ };
1518
+ }).pipe(operators.shareReplay(1));
1519
+ _loadedResources.set(scriptPath, obs$);
1520
+ }
1521
+ return _loadedResources.get(scriptPath);
1522
+ }
1523
+ function _loadStyles(stylePath) {
1524
+ if (!_loadedResources.has(stylePath)) {
1525
+ var obs$ = new rxjs.Observable(function (obs) {
1526
+ var style = document.createElement('link');
1527
+ style.id = stylePath;
1528
+ style.rel = 'stylesheet';
1529
+ style.href = "" + stylePath;
1530
+ _headElement.appendChild(style);
1531
+ style.onload = function () {
1532
+ obs.next();
1533
+ obs.complete();
1534
+ };
1535
+ style.onerror = function (err) {
1536
+ obs.error(err);
1537
+ };
1538
+ });
1539
+ _loadedResources.set(stylePath, obs$);
1450
1540
  }
1541
+ return _loadedResources.get(stylePath);
1542
+ }
1543
+ function _isJavascriptUrl(url) {
1544
+ return url.endsWith('.js');
1451
1545
  }
1452
- return def;
1453
- }
1546
+ function _isStylesUrl(url) {
1547
+ return url.endsWith('.css');
1548
+ }
1549
+ return {
1550
+ setDocument: setDocument,
1551
+ registerResources: registerResources,
1552
+ loadResource: loadResource,
1553
+ loadResources: loadResources,
1554
+ };
1555
+ })();
1454
1556
 
1455
- function isClass(value, cls) {
1456
- if (typeof value === 'object') {
1457
- if (typeof cls === 'string') {
1458
- if (value.constructor) {
1459
- if (value.constructor.name === cls) {
1460
- return true;
1461
- }
1462
- }
1463
- }
1464
- else {
1465
- if (value instanceof cls) {
1466
- return true;
1467
- }
1468
- }
1557
+ function number(value, decimals) {
1558
+ if (isNumeric(decimals)) {
1559
+ value = round(value, decimals);
1469
1560
  }
1470
- return false;
1561
+ return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: decimals });
1471
1562
  }
1472
1563
 
1473
- function isNumeric(value) {
1474
- var str = String(value);
1475
- return str.length && !!str.match(/^-?\d*\.?\d*$/);
1476
- }
1564
+ var FsFormatNumberPipe = /** @class */ (function () {
1565
+ function FsFormatNumberPipe() {
1566
+ }
1567
+ FsFormatNumberPipe.prototype.transform = function (value, decimals) {
1568
+ return number(value, decimals);
1569
+ };
1570
+ return FsFormatNumberPipe;
1571
+ }());
1572
+ FsFormatNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1573
+ FsFormatNumberPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, name: "fsFormatNumber" });
1574
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatNumberPipe, decorators: [{
1575
+ type: i0.Pipe,
1576
+ args: [{
1577
+ name: 'fsFormatNumber'
1578
+ }]
1579
+ }] });
1477
1580
 
1478
- function isObject(value) {
1479
- return !!value && typeof value === 'object' && !Array.isArray(value);
1581
+ function currency(amount, precision, currencyCode, locale) {
1582
+ if (precision === void 0) { precision = [2, 10]; }
1583
+ if (currencyCode === void 0) { currencyCode = 'USD'; }
1584
+ if (locale === void 0) { locale = 'en-US'; }
1585
+ var digitsInfo = Array.isArray(precision) ? precision : [precision, precision];
1586
+ amount = round(amount, digitsInfo[1]);
1587
+ return new common.CurrencyPipe(locale)
1588
+ .transform(amount, currencyCode, 'symbol', "1." + digitsInfo[0] + "-" + digitsInfo[1]);
1480
1589
  }
1481
1590
 
1482
- function throttle(func, wait) {
1483
- var waiting = false; // Initially, we're not waiting
1484
- return function () {
1485
- if (!waiting) { // If we're not waiting
1486
- func.apply(null, arguments); // Execute users function
1487
- waiting = true; // Prevent future invocations
1488
- setTimeout(function () {
1489
- waiting = false; // And allow future invocations
1490
- }, wait);
1491
- }
1591
+ var FsFormatCurrencyPipe = /** @class */ (function () {
1592
+ function FsFormatCurrencyPipe(locale) {
1593
+ this.locale = locale;
1594
+ }
1595
+ FsFormatCurrencyPipe.prototype.transform = function (amount, precision, currencyCode) {
1596
+ if (precision === void 0) { precision = 2; }
1597
+ return currency(amount, precision, currencyCode);
1492
1598
  };
1493
- }
1599
+ return FsFormatCurrencyPipe;
1600
+ }());
1601
+ FsFormatCurrencyPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, deps: [{ token: i0.LOCALE_ID }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1602
+ FsFormatCurrencyPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, name: "fsFormatCurrency" });
1603
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatCurrencyPipe, decorators: [{
1604
+ type: i0.Pipe,
1605
+ args: [{
1606
+ name: 'fsFormatCurrency'
1607
+ }]
1608
+ }], ctorParameters: function () {
1609
+ return [{ type: undefined, decorators: [{
1610
+ type: i0.Inject,
1611
+ args: [i0.LOCALE_ID]
1612
+ }] }];
1613
+ } });
1494
1614
 
1495
- var Operation = /** @class */ (function () {
1496
- function Operation(target, name) {
1497
- this.ready$ = new rxjs.Subject();
1498
- this.name = name ? name : guid();
1499
- if (target instanceof rxjs.Observable) {
1500
- this.target = target;
1501
- }
1502
- else {
1503
- this.target = rxjs.of(target);
1504
- }
1615
+ function truncate(value, limit, completeWords, ellipsis) {
1616
+ if (limit === void 0) { limit = 100; }
1617
+ if (completeWords === void 0) { completeWords = false; }
1618
+ if (ellipsis === void 0) { ellipsis = '...'; }
1619
+ value = value || '';
1620
+ if (completeWords) {
1621
+ limit = value.substr(0, limit).lastIndexOf(' ');
1505
1622
  }
1506
- return Operation;
1507
- }());
1508
-
1509
- exports.QueueState = void 0;
1510
- (function (QueueState) {
1511
- QueueState["Idle"] = "idle";
1512
- QueueState["Processing"] = "processing";
1513
- })(exports.QueueState || (exports.QueueState = {}));
1623
+ var result = "" + value.substr(0, limit);
1624
+ if (result !== value) {
1625
+ result += ellipsis;
1626
+ }
1627
+ return result;
1628
+ }
1514
1629
 
1515
- var Queue = /** @class */ (function () {
1516
- function Queue(_limit) {
1517
- if (_limit === void 0) { _limit = Infinity; }
1518
- this._limit = _limit;
1519
- this._queueStats = {
1520
- completed: 0,
1521
- total: 0,
1522
- errors: [],
1523
- };
1524
- this._doneQueueStats = {
1525
- completed: 0,
1526
- total: 0,
1527
- errors: [],
1528
- };
1529
- this._completeQueueStats = {
1530
- completed: 0,
1531
- total: 0,
1532
- errors: [],
1533
- };
1534
- this._done = new rxjs.Subject();
1535
- this._queue = [];
1536
- this._inProgress = [];
1537
- this._state = exports.QueueState.Idle;
1538
- this._destroy$ = new rxjs.Subject();
1539
- // if(_targets) {
1540
- // _targets.forEach((target) => {
1541
- // this.push(target);
1542
- // });
1543
- // }
1630
+ var FsFormatTruncatePipe = /** @class */ (function () {
1631
+ function FsFormatTruncatePipe() {
1544
1632
  }
1545
- Object.defineProperty(Queue.prototype, "total", {
1546
- get: function () {
1547
- return this._queueStats.total;
1548
- },
1549
- enumerable: false,
1550
- configurable: true
1551
- });
1552
- Object.defineProperty(Queue.prototype, "completed", {
1553
- get: function () {
1554
- return this._queueStats.completed;
1555
- },
1556
- enumerable: false,
1557
- configurable: true
1558
- });
1559
- Object.defineProperty(Queue.prototype, "pending", {
1560
- get: function () {
1561
- return this._queue.length;
1562
- },
1563
- enumerable: false,
1564
- configurable: true
1565
- });
1566
- Object.defineProperty(Queue.prototype, "inProgress", {
1567
- get: function () {
1568
- return this._inProgress.length;
1569
- },
1570
- enumerable: false,
1571
- configurable: true
1572
- });
1573
- Object.defineProperty(Queue.prototype, "errors", {
1574
- get: function () {
1575
- return this._queueStats.errors;
1576
- },
1577
- enumerable: false,
1578
- configurable: true
1579
- });
1580
- Object.defineProperty(Queue.prototype, "state", {
1581
- get: function () {
1582
- return this._state;
1583
- },
1584
- enumerable: false,
1585
- configurable: true
1586
- });
1587
- Object.defineProperty(Queue.prototype, "empty", {
1588
- get: function () {
1589
- return !this._queue.length && !this._inProgress.length;
1590
- },
1591
- enumerable: false,
1592
- configurable: true
1593
- });
1594
- Object.defineProperty(Queue.prototype, "pendingOperations", {
1595
- get: function () {
1596
- return this._queue
1597
- .map(function (operation) { return operation.name; });
1598
- },
1599
- enumerable: false,
1600
- configurable: true
1601
- });
1602
- Object.defineProperty(Queue.prototype, "inProgressOperations", {
1603
- get: function () {
1604
- return this._inProgress
1605
- .map(function (operation) { return operation.name; });
1606
- },
1607
- enumerable: false,
1608
- configurable: true
1609
- });
1610
- Queue.prototype.isProcessing = function () {
1611
- return this._state === exports.QueueState.Processing;
1612
- };
1613
- Queue.prototype.isIdle = function () {
1614
- return this._state === exports.QueueState.Idle;
1615
- };
1616
- Queue.prototype.setLimit = function (value) {
1617
- this._limit = value;
1618
- };
1619
- /**
1620
- * @depreated
1621
- */
1622
- Queue.prototype.subscribe = function (fun, err, complete) {
1623
- this.observe$
1624
- .subscribe(fun, err, complete);
1625
- };
1626
- Object.defineProperty(Queue.prototype, "observe$", {
1627
- get: function () {
1628
- return this._done
1629
- .pipe(operators.takeUntil(this._destroy$));
1630
- },
1631
- enumerable: false,
1632
- configurable: true
1633
- });
1634
- Object.defineProperty(Queue.prototype, "complete$", {
1635
- get: function () {
1636
- var _this = this;
1637
- if (!this.isProcessing()) {
1638
- return rxjs.of({ total: 0, completed: 0, errors: [] });
1639
- }
1640
- return this.observe$
1641
- .pipe(operators.take(1), operators.map(function () { return (_this._completeQueueStats); }));
1642
- },
1643
- enumerable: false,
1644
- configurable: true
1645
- });
1646
- Queue.prototype.complete = function (fun, err, complete) {
1647
- this.complete$.subscribe(fun, err, complete);
1633
+ FsFormatTruncatePipe.prototype.transform = function (value, limit, completeWords, ellipsis) {
1634
+ return truncate(value, limit, completeWords, ellipsis);
1648
1635
  };
1649
- Queue.prototype.push = function (target, name) {
1650
- var operation = new Operation(target, name);
1651
- this._queueStats.total++;
1652
- this._doneQueueStats.total++;
1653
- this._completeQueueStats.total++;
1654
- this._state = exports.QueueState.Processing;
1655
- if (this._inProgress.length < this._limit) {
1656
- this._processOperation(operation);
1657
- }
1658
- else {
1659
- this._queue.push(operation);
1660
- }
1661
- return operation.ready$;
1636
+ return FsFormatTruncatePipe;
1637
+ }());
1638
+ FsFormatTruncatePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1639
+ FsFormatTruncatePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, name: "fsFormatTruncate" });
1640
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatTruncatePipe, decorators: [{
1641
+ type: i0.Pipe,
1642
+ args: [{
1643
+ name: 'fsFormatTruncate'
1644
+ }]
1645
+ }], ctorParameters: function () { return []; } });
1646
+
1647
+ var FsStopPropagationDirective = /** @class */ (function () {
1648
+ function FsStopPropagationDirective() {
1649
+ }
1650
+ FsStopPropagationDirective.prototype.preventClick = function (event) {
1651
+ event.stopPropagation();
1662
1652
  };
1663
- Queue.prototype.clear = function () {
1664
- this._queue = [];
1665
- this._state = exports.QueueState.Idle;
1666
- this._queueStats = {
1667
- total: 0,
1668
- errors: [],
1669
- completed: 0,
1670
- };
1671
- this._clearDoneQueueStats();
1653
+ return FsStopPropagationDirective;
1654
+ }());
1655
+ FsStopPropagationDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
1656
+ FsStopPropagationDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsStopPropagationDirective, selector: "[fsStopPropagation]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
1657
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsStopPropagationDirective, decorators: [{
1658
+ type: i0.Directive,
1659
+ args: [{
1660
+ selector: '[fsStopPropagation]',
1661
+ }]
1662
+ }], propDecorators: { preventClick: [{
1663
+ type: i0.HostListener,
1664
+ args: ['click', ['$event']]
1665
+ }] } });
1666
+
1667
+ var FsPreventDefaultDirective = /** @class */ (function () {
1668
+ function FsPreventDefaultDirective() {
1669
+ }
1670
+ FsPreventDefaultDirective.prototype.preventClick = function (event) {
1671
+ event.preventDefault();
1672
1672
  };
1673
- Queue.prototype.destroy = function () {
1674
- this._done.complete();
1675
- this.clear();
1673
+ return FsPreventDefaultDirective;
1674
+ }());
1675
+ FsPreventDefaultDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
1676
+ FsPreventDefaultDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsPreventDefaultDirective, selector: "[fsPreventDefault]", host: { listeners: { "click": "preventClick($event)" } }, ngImport: i0__namespace });
1677
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsPreventDefaultDirective, decorators: [{
1678
+ type: i0.Directive,
1679
+ args: [{
1680
+ selector: '[fsPreventDefault]',
1681
+ }]
1682
+ }], propDecorators: { preventClick: [{
1683
+ type: i0.HostListener,
1684
+ args: ['click', ['$event']]
1685
+ }] } });
1686
+
1687
+ var FsAutofocusDirective = /** @class */ (function () {
1688
+ function FsAutofocusDirective(_matInput, _el) {
1689
+ this._matInput = _matInput;
1690
+ this._el = _el;
1691
+ this.fsAutofocus = true;
1692
+ }
1693
+ FsAutofocusDirective.prototype.ngAfterViewInit = function () {
1694
+ if (this.fsAutofocus || this.fsAutofocus === undefined) {
1695
+ this.focus();
1696
+ }
1676
1697
  };
1677
- Queue.prototype._processOperation = function (operation) {
1698
+ FsAutofocusDirective.prototype.focus = function () {
1678
1699
  var _this = this;
1679
- this._inProgress.push(operation);
1680
- operation.target
1681
- .pipe(operators.delay(200), // Hack to prevent extra quick proccess execution
1682
- operators.finalize(function () {
1683
- var opIndex = _this._inProgress.indexOf(operation);
1684
- _this._inProgress.splice(opIndex, 1);
1685
- if (_this.empty) {
1686
- _this._state = exports.QueueState.Idle;
1687
- _this._done.next(_this._doneQueueStats);
1688
- _this._clearDoneQueueStats();
1689
- }
1690
- else {
1691
- if (_this._queue.length) {
1692
- var queueItem = _this._queue.shift();
1693
- _this._processOperation(queueItem);
1694
- }
1700
+ setTimeout(function () {
1701
+ var tmpEl = document.createElement('input');
1702
+ tmpEl.style.width = '0';
1703
+ tmpEl.style.height = '0';
1704
+ tmpEl.style.margin = '0';
1705
+ tmpEl.style.padding = '0';
1706
+ tmpEl.style.border = '0';
1707
+ tmpEl.style.opacity = '0';
1708
+ document.body.appendChild(tmpEl);
1709
+ tmpEl.focus();
1710
+ if (_this._matInput) {
1711
+ _this._matInput.focus();
1695
1712
  }
1696
- }), operators.takeUntil(this._destroy$)).subscribe({
1697
- next: function (data) {
1698
- operation.ready$.next(data);
1699
- },
1700
- error: function (error) {
1701
- _this._queueStats.errors.push(error);
1702
- _this._doneQueueStats.errors.push(error);
1703
- _this._completeQueueStats.errors.push(error);
1704
- operation.ready$.error(error);
1705
- },
1706
- complete: function () {
1707
- _this._queueStats.completed++;
1708
- _this._doneQueueStats.completed++;
1709
- _this._completeQueueStats.completed++;
1710
- operation.ready$.complete();
1713
+ else if (_this._el.nativeElement.focus) {
1714
+ _this._el.nativeElement.focus();
1711
1715
  }
1712
- });
1716
+ document.body.removeChild(tmpEl);
1717
+ }, 50);
1713
1718
  };
1714
- Queue.prototype._clearDoneQueueStats = function () {
1715
- this._doneQueueStats = {
1716
- total: 0,
1717
- errors: [],
1718
- completed: 0,
1719
- };
1719
+ return FsAutofocusDirective;
1720
+ }());
1721
+ FsAutofocusDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, deps: [{ token: i1__namespace.MatInput, host: true, optional: true }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1722
+ FsAutofocusDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsAutofocusDirective, selector: "[fsAutofocus],[autofocus]", inputs: { fsAutofocus: "fsAutofocus" }, ngImport: i0__namespace });
1723
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsAutofocusDirective, decorators: [{
1724
+ type: i0.Directive,
1725
+ args: [{
1726
+ selector: '[fsAutofocus],[autofocus]',
1727
+ }]
1728
+ }], ctorParameters: function () {
1729
+ return [{ type: i1__namespace.MatInput, decorators: [{
1730
+ type: i0.Optional
1731
+ }, {
1732
+ type: i0.Host
1733
+ }] }, { type: i0__namespace.ElementRef }];
1734
+ }, propDecorators: { fsAutofocus: [{
1735
+ type: i0.Input
1736
+ }] } });
1737
+
1738
+ var FsFormatOrdinalNumberPipe = /** @class */ (function () {
1739
+ function FsFormatOrdinalNumberPipe() {
1740
+ }
1741
+ FsFormatOrdinalNumberPipe.prototype.transform = function (value) {
1742
+ return ordinalNumber(value);
1720
1743
  };
1721
- return Queue;
1722
- }());
1744
+ return FsFormatOrdinalNumberPipe;
1745
+ }());
1746
+ FsFormatOrdinalNumberPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1747
+ FsFormatOrdinalNumberPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, name: "fsFormatOrdinalNumber" });
1748
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormatOrdinalNumberPipe, decorators: [{
1749
+ type: i0.Pipe,
1750
+ args: [{
1751
+ name: 'fsFormatOrdinalNumber',
1752
+ }]
1753
+ }] });
1723
1754
 
1724
- function removeQueryParams(path) {
1725
- return path.split('?')[0];
1755
+ function email(value) {
1756
+ return !!String(value).match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
1726
1757
  }
1727
1758
 
1728
- function getNormalizedPath(locationSrv) {
1729
- var path = locationSrv.prepareExternalUrl(locationSrv.path());
1730
- return removeQueryParams(path);
1759
+ function phone(value) {
1760
+ var valid = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}/.test(value);
1761
+ return valid || !String(value).length;
1731
1762
  }
1732
1763
 
1733
- function round(num, decimalPlaces) {
1734
- if (decimalPlaces === void 0) { decimalPlaces = 0; }
1735
- num = parseFloat(parseFloat(num).toPrecision(Number.MAX_SAFE_INTEGER.toString().length - 1));
1736
- var p = Math.pow(10, decimalPlaces);
1737
- return Math.round(num * p) / p;
1764
+ /**
1765
+ * Check validity of the url.
1766
+ * Protocol (http/https) isn't required.
1767
+ * @param value
1768
+ * @returns {boolean}
1769
+ */
1770
+ function url(value) {
1771
+ var expression = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#%[\]@!\$&'\(\)\*\+,;=.]+$/gm;
1772
+ var regexp = new RegExp(expression);
1773
+ return !!String(value).match(regexp);
1738
1774
  }
1739
1775
 
1740
- function clone(obj) {
1741
- if (obj instanceof Date) {
1742
- return new Date(obj);
1776
+ function compare(query, item) {
1777
+ var value = true;
1778
+ for (var key in query) {
1779
+ value = value && item[key] == query[key];
1743
1780
  }
1744
- else if (Array.isArray(obj)) {
1745
- var arr = [];
1746
- for (var i = 0; i < obj.length; i++) {
1747
- arr[i] = clone(obj[i]);
1748
- }
1749
- return arr;
1781
+ return value;
1782
+ }
1783
+
1784
+ function filter(array, query) {
1785
+ if (typeof query !== 'function') {
1786
+ var queryObj_1 = query;
1787
+ query = function (item) {
1788
+ return compare(queryObj_1, item);
1789
+ };
1750
1790
  }
1751
- else if (typeof (obj) === 'object') {
1752
- var cloned = {};
1753
- for (var key in obj) {
1754
- cloned[key] = clone(obj[key]);
1791
+ var isarray = Array.isArray(array);
1792
+ var list = isarray ? [] : {};
1793
+ if (isarray) {
1794
+ array.forEach(function (item, idx) {
1795
+ if (query(item)) {
1796
+ list.push(item);
1797
+ }
1798
+ });
1799
+ }
1800
+ else {
1801
+ Object.keys(array).forEach(function (key) {
1802
+ if (query(array[key])) {
1803
+ list[key] = array[key];
1804
+ }
1805
+ });
1806
+ }
1807
+ return list;
1808
+ }
1809
+
1810
+ function inArray(values, array) {
1811
+ if (!Array.isArray(values)) {
1812
+ values = [values];
1813
+ }
1814
+ for (var i = 0, len = values.length; i < len; i++) {
1815
+ if (array.indexOf(values[i]) >= 0) {
1816
+ return true;
1755
1817
  }
1756
- return cloned;
1757
1818
  }
1758
- return obj;
1819
+ return false;
1759
1820
  }
1760
1821
 
1761
- function toString(value) {
1762
- if (value === null || value === undefined) {
1763
- return '';
1764
- }
1765
- return "" + value;
1822
+ function index(array, name, value) {
1823
+ if (value === void 0) { value = null; }
1824
+ var list = {};
1825
+ array.forEach(function (item) {
1826
+ list[item[name]] = value ? item[value] : item;
1827
+ });
1828
+ return list;
1766
1829
  }
1767
1830
 
1768
- function isArrayEqual(arr1, arr2) {
1769
- if (!Array.isArray(arr1) || !Array.isArray(arr2) || arr1.length !== arr2.length) {
1770
- return false;
1831
+ function indexOf(array, query) {
1832
+ if (typeof query !== 'function') {
1833
+ var queryObj_1 = query;
1834
+ query = function (item) {
1835
+ return compare(queryObj_1, item);
1836
+ };
1771
1837
  }
1772
- var sortFn = function (a, b) {
1773
- if (a < b) {
1774
- return -1;
1838
+ for (var i = 0, len = array.length; i < len; i++) {
1839
+ if (query(array[i])) {
1840
+ return i;
1775
1841
  }
1776
- else if (a > b) {
1777
- return 1;
1842
+ }
1843
+ return -1;
1844
+ }
1845
+
1846
+ function keyExists(array, key) {
1847
+ return array.hasOwnProperty(key);
1848
+ }
1849
+
1850
+ function ksort(unordered) {
1851
+ Object.keys(unordered).sort().forEach(function (key) {
1852
+ var value = unordered[key];
1853
+ delete unordered[key];
1854
+ unordered[key] = value;
1855
+ });
1856
+ }
1857
+
1858
+ function list(array, property, index) {
1859
+ if (index === void 0) { index = null; }
1860
+ var resultList = index ? {} : [];
1861
+ array.forEach(function (item, idx) {
1862
+ if (index) {
1863
+ resultList[item[index]] = item[property];
1778
1864
  }
1779
1865
  else {
1780
- return 0;
1866
+ resultList.push(item[property]);
1781
1867
  }
1782
- };
1783
- arr1 = __spreadArray([], __read(arr1)).sort(sortFn);
1784
- arr2 = __spreadArray([], __read(arr2)).sort(sortFn);
1785
- return arr1.every(function (value, index) {
1786
- return value === arr2[index];
1787
1868
  });
1869
+ return resultList;
1788
1870
  }
1789
1871
 
1790
- var fsSourceLoader = (function () {
1791
- var _document;
1792
- var _headElement;
1793
- var _sources = new Map();
1794
- var _loadedResources = new Map();
1795
- // bad way but don't want to bother developer
1796
- setDocument(document);
1797
- // but developer can set document at any time
1798
- function setDocument(document) {
1799
- _document = document;
1800
- _headElement = _document === null || _document === void 0 ? void 0 : _document.head;
1872
+ function nameValue(array, name, value) {
1873
+ var list = [];
1874
+ if (name || value) {
1875
+ var nameFn_1 = typeof name === 'function' ? name : function (item) {
1876
+ return item[name];
1877
+ };
1878
+ var valueFn_1 = typeof value === 'function' ? value : function (item) {
1879
+ return item[value];
1880
+ };
1881
+ array.forEach(function (item) {
1882
+ list.push({ name: nameFn_1(item), value: valueFn_1(item) });
1883
+ });
1801
1884
  }
1802
- /**
1803
- * register a list of the resources for future loading
1804
- *
1805
- * example:
1806
- * sourceLoader.registerResources({
1807
- * froala: [
1808
- * '/assets/js/froala/froala_editor.min.js',
1809
- * '/assets/css/froala_editor.pkgd.min.css',
1810
- * ],
1811
- * froala_align: '/assets/js/froala/plugins/align.min.js',
1812
- * froala_colors: '/assets/js/froala/plugins/colors.min.js',
1813
- * froala_image: '/assets/js/froala/plugins/image.min.js',
1814
- * });
1815
- *
1816
- */
1817
- function registerResources(resources) {
1818
- Object.entries(resources)
1819
- .forEach(function (_a) {
1820
- var _b = __read(_a, 2), name = _b[0], path = _b[1];
1821
- if (typeof path === 'string') {
1822
- path = [path];
1823
- }
1824
- if (!_sources.has(name)) {
1825
- _sources.set(name, new Set());
1826
- }
1827
- var resourcesList = _sources.get(name);
1828
- path.forEach(function (p) {
1829
- resourcesList.add(p);
1830
- });
1885
+ else {
1886
+ array.forEach(function (n, v) {
1887
+ list.push({ name: n, value: v });
1831
1888
  });
1832
1889
  }
1833
- /**
1834
- * load any resource previously registered
1835
- *
1836
- * sourceLoader.loadResource('froala')
1837
- *
1838
- * or load any js/css file
1839
- *
1840
- * sourceLoader.loadResource('/assets/my-source.js')
1841
- *
1842
- */
1843
- function loadResource(name) {
1844
- if (_loadedResources.has(name)) {
1845
- return _loadedResources.get(name);
1846
- }
1847
- if (_sources.has(name)) {
1848
- var sourcesForLoading = __spreadArray([], __read(_sources.get(name))).map(function (path) {
1849
- return _loadResource(path);
1850
- })
1851
- .filter(function (v) { return !!v; });
1852
- return rxjs.combineLatest(sourcesForLoading);
1853
- }
1854
- return _loadResource(name);
1890
+ return list;
1891
+ }
1892
+
1893
+ function remove(array, query) {
1894
+ var idx = indexOf(array, query);
1895
+ if (idx >= 0) {
1896
+ return array.splice(idx, 1);
1855
1897
  }
1856
- /**
1857
- * the same as `loadResource` but you can pass list of the resources for loading
1858
- */
1859
- function loadResources(listOfResources) {
1860
- var resourcesToLoad = listOfResources
1861
- .reduce(function (acc, name) {
1862
- var loading$ = loadResource(name);
1863
- if (loading$) {
1864
- acc.push(loading$);
1898
+ return idx;
1899
+ }
1900
+
1901
+ function sort(array, query, reverse) {
1902
+ if (reverse === void 0) { reverse = false; }
1903
+ if (typeof query !== 'function') {
1904
+ var queryStr_1 = query;
1905
+ query = function (a, b) {
1906
+ if (reverse) {
1907
+ if (a[queryStr_1] < b[queryStr_1]) {
1908
+ return 1;
1909
+ }
1910
+ else if (a[queryStr_1] > b[queryStr_1]) {
1911
+ return -1;
1912
+ }
1865
1913
  }
1866
- return acc;
1867
- }, []);
1868
- return rxjs.combineLatest(resourcesToLoad);
1869
- }
1870
- ///
1871
- function _loadResource(path) {
1872
- if (_isStylesUrl(path)) {
1873
- return _loadStyles(path);
1874
- }
1875
- if (_isJavascriptUrl(path)) {
1876
- return _loadJs(path);
1877
- }
1878
- console.warn("Resource " + path + " can not be identified and loaded");
1879
- return null;
1880
- }
1881
- function _loadJs(scriptPath) {
1882
- if (!_loadedResources.has(scriptPath)) {
1883
- var obs$ = new rxjs.Observable(function (obs) {
1884
- var script = document.createElement('script');
1885
- script.src = scriptPath;
1886
- _headElement.appendChild(script);
1887
- script.onload = function () {
1888
- obs.next();
1889
- obs.complete();
1890
- };
1891
- script.onerror = function (err) {
1892
- obs.error(err);
1893
- };
1894
- }).pipe(operators.shareReplay(1));
1895
- _loadedResources.set(scriptPath, obs$);
1896
- }
1897
- return _loadedResources.get(scriptPath);
1898
- }
1899
- function _loadStyles(stylePath) {
1900
- if (!_loadedResources.has(stylePath)) {
1901
- var obs$ = new rxjs.Observable(function (obs) {
1902
- var style = document.createElement('link');
1903
- style.id = stylePath;
1904
- style.rel = 'stylesheet';
1905
- style.href = "" + stylePath;
1906
- _headElement.appendChild(style);
1907
- style.onload = function () {
1908
- obs.next();
1909
- obs.complete();
1910
- };
1911
- style.onerror = function (err) {
1912
- obs.error(err);
1913
- };
1914
- });
1915
- _loadedResources.set(stylePath, obs$);
1916
- }
1917
- return _loadedResources.get(stylePath);
1918
- }
1919
- function _isJavascriptUrl(url) {
1920
- return url.endsWith('.js');
1921
- }
1922
- function _isStylesUrl(url) {
1923
- return url.endsWith('.css');
1914
+ else {
1915
+ if (a[queryStr_1] > b[queryStr_1]) {
1916
+ return 1;
1917
+ }
1918
+ else if (a[queryStr_1] < b[queryStr_1]) {
1919
+ return -1;
1920
+ }
1921
+ }
1922
+ return 0;
1923
+ };
1924
1924
  }
1925
- return {
1926
- setDocument: setDocument,
1927
- registerResources: registerResources,
1928
- loadResource: loadResource,
1929
- loadResources: loadResources,
1930
- };
1931
- })();
1925
+ array.sort(query);
1926
+ return array;
1927
+ }
1928
+
1929
+ function rsort(array, query) {
1930
+ return sort(array, query, true);
1931
+ }
1932
+
1933
+ function find(array, query) {
1934
+ var data = filter(array, query);
1935
+ return data.length ? data[0] : null;
1936
+ }
1932
1937
 
1933
1938
  function acronym(str, length) {
1934
1939
  if (length === void 0) { length = 2; }