@sumaris-net/ngx-components 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sumaris-net.ngx-components.umd.js +25 -29
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +17 -15
- package/esm2015/src/app/core/services/platform.service.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +17 -15
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
var no=function(){function t(){this.units=["bytes","KB","MB","GB","TB","PB"]}return t.prototype.transform=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=2),isNaN(parseFloat(String(t)))||!isFinite(t))return"?";for(var n=0;t>=1024;)t/=1024,n++;return t.toFixed(+e)+" "+this.units[n]},t}();no.decorators=[{type:e.Pipe,args:[{name:"fileSize"}]}];var oo=Ht,ro=function(){function t(){this.toDateISOString=io,this.fromDateISOString=ao,this.toDuration=so}return t.min=function(t,e){return t&&e&&t.isSameOrBefore(e)?t:e},t.max=function(t,e){return t&&(!e||t.isSameOrAfter(e))?t:e},t.equals=function(e,n){return t.isSame(e,n)},t.isSame=function(t,e,n){var o=ao(t),r=ao(e);return!o&&!r||o.isSame(r,n)},t}();function io(t){if(t)return"string"==typeof t&&-1===t.indexOf("+")&&t.lastIndexOf("Z")===t.length-1?t:(t=ao(t))&&t.toISOString()||void 0}function ao(t){if(!t||L.isMoment(t))return t;var e=oo(t,ge);if(e.isValid())return e;if("string"==typeof t){if(console.warn("Wrong date format - Trying to convert from local time: "+t),10===t.length)return oo(t,"X");if(13===t.length)return oo(t,"x")}console.warn("Unable to parse date: "+t)}function so(t,e){if(t){var n=oo.duration(t,e);return n.milliseconds()>=990&&n.add(1e3-n.milliseconds(),"ms"),n.seconds()>=59&&n.add(60-n.seconds(),"s"),n}}var lo=function(){function t(t){this.translate=t,this.dayUnit=t.instant("COMMON.DAY_UNIT")}return t.prototype.transform=function(t,e){if(!t)return"";var n=so(t,e&&e.unit||"hours"),o=n.days(),r=n.hours().toString().padStart(2,"0"),i=n.minutes().toString().padStart(2,"0");return(o>0?o.toString()+(this.dayUnit+" "):"")+r+":"+i},t}();lo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new lo(jt.ɵɵinject($t.TranslateService))},token:lo,providedIn:"root"}),lo.decorators=[{type:e.Pipe,args:[{name:"duration"}]},{type:e.Injectable,args:[{providedIn:"root"}]}],lo.ctorParameters=function(){return[{type:F.TranslateService}]};var co=function(){function t(){}return t.prototype.transform=function(t){return null!=t?Math.abs(t):t},t}();co.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new co},token:co,providedIn:"root"}),co.decorators=[{type:e.Pipe,args:[{name:"mathAbs"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var uo=function(){function t(){}return t.prototype.transform=function(t){return t%2==0},t}();uo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new uo},token:uo,providedIn:"root"}),uo.decorators=[{type:e.Pipe,args:[{name:"even"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var po=function(){function t(){}return t.prototype.transform=function(t){return t%2!=0},t}();po.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new po},token:po,providedIn:"root"}),po.decorators=[{type:e.Pipe,args:[{name:"odd"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ho=function(){function t(){}return t.prototype.transform=function(t){return null!=t&&t.length>0},t}();ho.decorators=[{type:e.Pipe,args:[{name:"isNotEmptyArray"}]}];var mo=function(){function t(){}return t.prototype.transform=function(t){return null==t||0===t.length},t}();mo.decorators=[{type:e.Pipe,args:[{name:"isEmptyArray"}]}];var fo=function(){function t(){}return t.prototype.transform=function(t,e){e=e||{};var n=null==t?0:t.length;return Re(e.lessThan)?n<e.lessThan:Re(e.greaterThan)?n>e.greaterThan:!!Re(e.equals)&&n===e.equals},t}();fo.decorators=[{type:e.Pipe,args:[{name:"isArrayLength"}]}];var go=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length>0?t[0]:void 0},t}();go.decorators=[{type:e.Pipe,args:[{name:"arrayFirst"}]}];var bo=function(){function t(){}return t.prototype.transform=function(t,e){return!0!==e.omitNil?(t||[]).map((function(t){return t&&t[e.property]})):(t||[]).map((function(t){return t&&t[e.property]})).filter(Re)},t}();bo.decorators=[{type:e.Pipe,args:[{name:"arrayPluck"}]}];var yo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.includes(e)||!1},t}();yo.decorators=[{type:e.Pipe,args:[{name:"arrayIncludes"}]}];var vo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.filter(e)},t}();vo.decorators=[{type:e.Pipe,args:[{name:"arrayFilter"}]}];var Co=function(){function t(){}return t.prototype.transform=function(t,e){if(!t)return null;var n=e&&"object"==typeof e?e.key:e;return n?t[n]:null},t}();Co.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Co},token:Co,providedIn:"root"}),Co.decorators=[{type:e.Pipe,args:[{name:"mapGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Eo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.keys(t):null},t}();Eo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Eo},token:Eo,providedIn:"root"}),Eo.decorators=[{type:e.Pipe,args:[{name:"mapKeys"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var wo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.values(t):null},t}();wo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new wo},token:wo,providedIn:"root"}),wo.decorators=[{type:e.Pipe,args:[{name:"mapValues"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Io=function(){function t(){}return t.prototype.transform=function(t){return Pe(t)},t}();Io.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Io},token:Io,providedIn:"root"}),Io.decorators=[{type:e.Pipe,args:[{name:"isNotNilOrBlank"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Oo=function(){function t(){}return t.prototype.transform=function(t){return Te(t)},t}();Oo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Oo},token:Oo,providedIn:"root"}),Oo.decorators=[{type:e.Pipe,args:[{name:"isNilOrBlank"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var _o=function(){function t(){}return t.prototype.transform=function(t){return null!=t?t.toString():""},t}();_o.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new _o},token:_o,providedIn:"root"}),_o.decorators=[{type:e.Pipe,args:[{name:"toString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var xo=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length||0},t}();xo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new xo},token:xo,providedIn:"root"}),xo.decorators=[{type:e.Pipe,args:[{name:"strLength"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ko=function(){function t(t){this.translate=t}return t.prototype.get=function(t,e,n){var o=this;if(!t||!Ae(e))return this.translate.get(t,n);var r=this.contextualKeys(t,e);return this.translate.get(r,n).pipe(N.map((function(t){return o.findFirstValid(r,t)})))},t.prototype.instant=function(t,e,n){if(!t||Te(e))return this.translate.instant(t,n);var o=this.contextualKeys(t,e),r=this.translate.instant(o,n);return this.findFirstValid(o,r)},t.prototype.contextualKeys=function(t,e){var n=this;return e.split(".").filter(Pe).reduce((function(t,e){var n=t.length>0?t[t.length-1]+".":"";return t.concat(n+e)}),[]).reverse().map((function(e){return n.contextualKey(t,e)})).concat(t)},t.prototype.contextualKey=function(t,e){e.endsWith(".")||(e+=".");var n=t.split(".");return 1===n.length?""+e+t:n.slice(0,n.length-1).concat(e+n[n.length-1]).join(".")},t.prototype.findFirstValid=function(t,e){var n,o;try{for(var r=_e(t),i=r.next();!i.done;i=r.next()){var a=i.value;if(e[a]!==a)return e[a]}}catch(t){n={error:t}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(n)throw n.error}}return e[t[t.length-1]]},t}();ko.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ko(jt.ɵɵinject($t.TranslateService))},token:ko,providedIn:"root"}),ko.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ko.ctorParameters=function(){return[{type:F.TranslateService}]};var So=function(){function t(t){this.translate=t}return t.prototype.transform=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!t||!t.length)return t;var o=e&&e.length?e[0]:"";return e=o&&e.slice(1),this.translate.instant(t,o,e)},t}();So.decorators=[{type:e.Injectable},{type:e.Pipe,args:[{name:"translateContext"}]}],So.ctorParameters=function(){return[{type:ko}]};var Ao=function(){function t(){}return t.prototype.transform=function(t){var e;return null===(e=Ge(t))||void 0===e?void 0:e.toUpperCase()},t}();Ao.decorators=[{type:e.Pipe,args:[{name:"translatable"}]},{type:e.Injectable}];var To=function(){function t(){}return t.prototype.transform=function(t,e){return Ze(t,e&&("string"==typeof e?e:e.key),e&&e.defaultValue)},t}();To.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new To},token:To,providedIn:"root"}),To.decorators=[{type:e.Pipe,args:[{name:"propertyGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Ro=function(){function t(){this.ngInit=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.ngInit.emit()},t}();Ro.decorators=[{type:e.Directive,args:[{selector:"[ngInit]"}]}],Ro.propDecorators={ngInit:[{type:e.Output}]};var Po=Ht,Do=function(){function t(){}return t.getDoubleRegexp=function(t){if(Ae(t))return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;if(t<0)throw new Error("Invalid maxDecimals value: "+t);var e=this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t];return e||(this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t]=new RegExp("^[-]?[0-9]+([.,][0-9]{1,"+t+"})?$"),this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t])},t.validDate=function(t){var e=t.value,n=!e||Po.isMoment(e)?e:Po(t.value,ge);return n&&(!n.isValid()||n.year()<1970)?{validDate:!0}:null},t.latitude=function(t){var e=t.value;return Re(e)&&(e<-90||e>90)?{latitude:!0}:null},t.longitude=function(t){var e=t.value;return Re(e)&&(e<-180||e>180)?{longitude:!0}:null},t.object=function(t){var e=t.value;return e&&"object"!=typeof e?{object:!0}:null},t.entity=function(t){var e=t.value;return!e||"object"==typeof e&&void 0!==e.id&&null!==e.id?null:{entity:!0}},t.empty=function(t){return Pe(t.value)?{empty:!0}:null},t.pubkey=function(t){var e=t.value;return!e||"string"==typeof e&&ye.test(e)?null:{pubkey:!0}},t.integer=function(t){if(Te(t.value))return null;var e=parseFloat(t.value);return isNaN(e)||(0|e)!==e?{integer:!0}:null},t.double=function(t){var e=this.getDoubleRegexp(null==t?void 0:t.maxDecimals);return function(n){var o=n.value;return Number.isNaN(o)?null:Re(o)&&""!==o&&!e.test(o)?{maxDecimals:{maxDecimals:null==t?void 0:t.maxDecimals}}:null}},t.dateIsAfter=function(t,e,n){return function(o){var r=ao(o.value);return Re(r)&&Re(t)&&r.isSameOrBefore(t,n)?{dateIsAfter:{minDate:e}}:null}},t.dateRangeEnd=function(e,n){var o=n?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i,a=null===(i=n.parent)||void 0===i?void 0:i.get(e);if(!a)return console.warn("Cannot find brother control '"+e+"' in the parent form"),null;var s=ao(a.value),l=ao(n.value);return Re(l)&&Re(s)&&l.isSameOrBefore(s)?r:(t.clearError(n,o),null)}},t.dateRangeStart=function(e,n){var o=n?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i,a=null===(i=n.parent)||void 0===i?void 0:i.get(e);if(!a)return console.warn("Cannot find control '"+e+"' in the parent form"),null;var s=ao(a.value),l=ao(n.value);return Re(l)&&Re(s)&&l.isSameOrAfter(s)?r:(t.clearError(n,o),null)}},t.copyParentErrors=function(t){return function(e){if(e.errors)return null;var n=e.parent&&e.parent.errors;return!n||Fe(t)?n:Object.keys(n).reduce((function(e,o){return t.includes(o)&&(e[o]=n[o]),e}),{})}},t.clearError=function(t,e){if(t.hasError(e)){var n=t.errors;n&&n[e]&&(1===Object.getOwnPropertyNames(n).length?t.setErrors(null):(delete n[e],t.setErrors(n)))}},t}();Do._REGEXP_CACHE={DOUBLE_BY_MAX_DECIMALS:{NO_LIMIT:/^[-]?[0-9]+([.,][0-9]*)?$/,1:/^[-]?[0-9]+([.,][0-9])?$/,2:/^[-]?[0-9]+([.,][0-9]{1,2})?$/,3:/^[-]?[0-9]+([.,][0-9]{1,2})?$/}},Do.I18N_ERROR_KEYS={required:"ERROR.FIELD_REQUIRED",min:"ERROR.FIELD_MIN",max:"ERROR.FIELD_MAX",minlength:"ERROR.FIELD_MIN_LENGTH",maxlength:"ERROR.FIELD_MAX_LENGTH",pubkey:"ERROR.FIELD_NOT_VALID_PUBKEY",validDate:"ERROR.FIELD_NOT_VALID_DATE",dateIsAfter:"ERROR.FIELD_NOT_VALID_DATE_AFTER",dateRange:"ERROR.FIELD_NOT_VALID_DATE_RANGE",dateMinDuration:"ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION",dateMaxDuration:"ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION",maxDecimals:"ERROR.FIELD_MAXIMUM_DECIMALS",integer:"ERROR.FIELD_NOT_VALID_INTEGER",email:"ERROR.FIELD_NOT_VALID_EMAIL",latitude:"ERROR.FIELD_NOT_VALID_LATITUDE",longitude:"ERROR.FIELD_NOT_VALID_LONGITUDE",pattern:"ERROR.FIELD_NOT_VALID_PATTERN",unique:"ERROR.FIELD_NOT_UNIQUE",entity:"ERROR.FIELD_INVALID"};var No=function(){function t(){}return t.dateRange=function(t,e,n){var o=Pe(n)?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i=ao(n.get(t).value),a=n.get(e),s=ao(a.value);return Re(i)&&Re(s)&&i.isAfter(s)?(a.markAsPending(),a.setErrors(Object.assign(Object.assign({},a.errors),r)),r):(Do.clearError(a,o),null)}},t.dateMaxDuration=function(t,e,n,o){var r={dateMaxDuration:!0};return function(i){var a=ao(i.get(t).value),s=i.get(e),l=ao(s.value);return Re(a)&&Re(l)&&Math.abs(a.diff(l,o))>n?(s.markAsTouched({onlySelf:!0}),s.markAsPending(),s.setErrors(Object.assign(Object.assign({},s.errors),r)),r):(Do.clearError(s,"dateMaxDuration"),null)}},t.dateMinDuration=function(t,e,n,o){return function(r){var i=r.get(e),a=ao(r.get(t).value),s=ao(i.value);if(Re(a)&&Re(s)&&Math.abs(a.diff(s,o))<n){var l=i.errors||{};return l.dateMinDuration=!0,i.setErrors(l),i.markAsTouched({onlySelf:!0}),{dateMinDuration:!0}}return Do.clearError(i,"dateMinDuration"),null}},t.requiredIf=function(t,e){return function(n){var o=n.get(t),r=e instanceof P.AbstractControl?e:n.get(e);if(!r)throw new Error("Unable to find field to check!");if(Te(o.value)&&Pe(r.value)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Do.clearError(o,"required"),null}},t.requiredIfTrue=function(t,e){return function(n){var o=n.get(t),r=e instanceof P.AbstractControl?e:n.get(e);if(!r)throw new Error("Unable to find field to check!");if(Te(o.value)&&je(r.value,!1)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Do.clearError(o,"required"),null}},t.requiredIfEmpty=function(t,e){return function(n){var o=n.get(t);if(Te(o.value)&&Te(n.get(e).value)){var r={required:!0};return o.setErrors(r),o.markAsTouched({onlySelf:!0}),r}return Do.clearError(o,"required"),null}},t.propagateIfDirty=function(t,e,n){return function(o){var r=o.get(t),i=o.get(e);return r.dirty&&i.value!==n&&i.setValue(n),null}},t.prototype.first=function(t){return function(e){return t.filter(Re).map((function(t){return t(e)})).find(Re)||null}},t}(),Fo=function(){function t(){}return t.uniqueEntity=function(t){return function(e){var n,o,r=[];if(e.length){try{for(var i=_e(e.controls),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.controls[t]){var l=s.controls[t].value;l&&l.id&&r.push(s.controls[t])}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}var c=r.reduce((function(t,e){var n=e.value.id;return t[n]?t[n]++:t[n]=1,t}),{}),u={uniqueEntity:!0},d=!1;if(r.filter((function(t){return c[t.value.id]>1})).forEach((function(t){var e=t.errors||{};e=Object.assign(Object.assign({},e),u),t.setErrors(e),t.markAsTouched({onlySelf:!0}),d=!0})),d)return u}return r.forEach((function(t){return Do.clearError(t,"uniqueEntity")})),null}},t.requiredArrayMinLength=function(t){return t=t||1,function(e){return!e||e.length<t?{required:!0}:null}},t.validSumMaxValue=function(t,e){return function(n){var o,r,i=[];if(n.length){try{for(var a=_e(n.controls),s=a.next();!s.done;s=a.next()){var l=s.value;l.controls[t]&&De(l.controls[t].value)&&i.push(l.controls[t])}}catch(t){o={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}if(i.reduce((function(t,e){return t+e.value}),0)>e){var c={sumMaxValue:!0};return i.forEach((function(t){var e=t.errors||{};e=Object.assign(Object.assign({},e),c),t.setErrors(e),t.markAsTouched({onlySelf:!0})})),c}}return i.forEach((function(t){return Do.clearError(t,"sumMaxValue")})),null}},t}(),Mo=function(){function t(){this.invalid=!1,this.valid=!1,this.dirty=!1,this.empty=!0,this.pending=!1,this.error=null,this.enabled=!1,this.loading=!1}return Object.defineProperty(t.prototype,"disabled",{get:function(){return!this.enabled},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){},t.prototype.enable=function(t){},t.prototype.markAsPristine=function(t){},t.prototype.markAsUntouched=function(t){},t.prototype.markAsTouched=function(t){},t.prototype.markAllAsTouched=function(t){},t.prototype.markAsDirty=function(t){},t.prototype.markAsLoading=function(t){},t.prototype.markAsLoaded=function(t){},t.prototype.markAsReady=function(t){},t.prototype.waitIdle=function(t){return Promise.reject(!1)},t.prototype.ready=function(){return Promise.reject(!0)},t}(),Lo=function(){function t(t){this.getterFn=t}return Object.defineProperty(t.prototype,"delegate",{get:function(){return this.getterFn()||t.NULL_FORM},enumerable:!1,configurable:!0}),t.prototype.waitDelegate=function(t){var e,n=this;return kn((function(){return!!(e=n.getterFn())}),t).then((function(t){return e}))},Object.defineProperty(t.prototype,"enabled",{get:function(){return this.delegate.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.delegate.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.delegate.error},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){return this.delegate.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.delegate.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.delegate.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this.delegate.empty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){return this.delegate.pending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this.delegate.loading},enumerable:!1,configurable:!0}),t.prototype.ready=function(){return this.delegate.ready()},t.prototype.waitIdle=function(t){return this.delegate.waitIdle()},t.prototype.disable=function(t){return this.delegate.disable(t)},t.prototype.enable=function(t){return this.delegate.enable(t)},t.prototype.markAsPristine=function(t){return this.delegate.markAsPristine(t)},t.prototype.markAsUntouched=function(t){return this.delegate.markAsUntouched(t)},t.prototype.markAsTouched=function(t){return this.delegate.markAsTouched(t)},t.prototype.markAllAsTouched=function(t){return this.delegate.markAllAsTouched(t)},t.prototype.markAsDirty=function(t){return this.delegate.markAsDirty(t)},t.prototype.markAsLoading=function(t){return this.delegate.markAsLoading(t)},t.prototype.markAsLoaded=function(t){return this.delegate.markAsLoaded(t)},t.prototype.markAsReady=function(t){return this.delegate.markAsReady(t)},t}();Lo.NULL_FORM=new Mo;var jo=function(){function t(){}return t.isForm=function(t){return t instanceof Lo||"dirty"in t&&"enabled"in t&&"valid"in t},t}();function Bo(t,e,n){var o=Uo(t,e);e.patchValue(o,n)}function Uo(t,e){return Vo(t,e)}function Vo(t,e,n){var o=n?n+".":"";if(e instanceof P.FormGroup){var r={};for(var i in e.controls)r[i]=Vo(t&&t[i],e.controls[i],o+i);return r}if(e instanceof P.FormArray){if("string"==typeof t&&(t=t.split("|")),!Array.isArray(t)||0===e.length)return Ne(t)&&console.warn("WARN: please resize the FormArray '"+n+"' to the same length of the input array"),[];var a=e.at(0);if((r=t.map((function(t,e){return Vo(t,a,o+"#"+e)}))).length>e.length)if(a instanceof P.FormControl)for(var s=e.length;s<r.length;s++)e.push(new P.FormControl(null,a.validator));else console.warn("WARN: please resize the FormArray '"+(n||"")+"' to the same length of the input array"),r=r.slice(0,e.length);else if(r.length<e.length)for(s=r.length;s<e.length;s++)r.push(null);return r}if(e instanceof P.FormControl)return L.isMoment(t)?io(t):Le(t)}function qo(t,e,n){t&&!t.valid&&(e=e||"",t instanceof P.FormGroup?(n||console.warn(e+" Form errors:"),t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})),t.controls&&Object.keys(t.controls).forEach((function(o){return qo(t.controls[o],e,n?n+"/"+o:o)}))):t instanceof P.FormArray?(t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})),t.controls.forEach((function(t,o){qo(t,e,n?n+"#"+o:"#"+o)}))):t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})))}function $o(t,e){if(t&&!t.valid){if((e=e||{}).result=e.result||{},t instanceof P.FormGroup){if(t.errors&&(e.controlName?e.result[e.controlName]=Object.assign({},t.errors):e.result=Object.assign(Object.assign({},e.result),t.errors)),!e||!1!==e.recursive)for(var n in t.controls){var o=t.controls[n];o&&o.enabled&&$o(o,Object.assign(Object.assign({},e),{controlName:e.controlName?[e.controlName,n].join("."):n,result:e.result}))}}else t instanceof P.FormArray?t.controls.forEach((function(t,n){$o(t,Object.assign(Object.assign({},e),{controlName:(e.controlName||"")+"#"+n,result:e.result}))})):t.errors&&(e.controlName?e.result[e.controlName]=Object.assign({},t.errors):e.result=Object.assign(Object.assign({},e.result),t.errors));return e.result}}function Go(t,e){var n=e.indexOf(".");if(-1===n)return t.controls[e];var o=e.substring(0,n);if(t.controls[o]instanceof P.FormGroup)return Go(t.controls[o],e.substring(n+1));throw new Error("Invalid form path: '"+o+"' should be a form group.")}function Ho(t,e,n){(e||[]).forEach((function(e){var o=jo.getControlFromPath(t,e);o&&o.disable(n)}))}function Wo(t,e,n,o,r,i){i=i||{emitEvent:!0};var a=!1,s=-1;if(o(r)||(s=(t.value||[]).findIndex((function(t){return n(r,t)}))),-1===s&&t.length&&o(t.at(t.length-1).value)&&(s=t.length-1),-1!==s)o(r)||(t.at(s).patchValue(r,i),a=!0);else{var l=e(r);t.push(l),a=!0}return a&&(Ae(i.emitEvent)||i.emitEvent)&&(o(r)||t.markAsDirty()),a}function zo(t,e,n){var o=t.length!==n;if(t.length<n)for(;t.length<n;)t.push(e());else if(t.length>n)for(;t.length>n;)t.removeAt(t.length-1);return o}function Ko(t,e,n){return t.removeAt(n),t.markAsDirty(),!0}function Qo(t,e,n){var o=t.at(n);return!e(o.value)&&(o instanceof P.FormGroup?jo.copyEntity2Form({},o):o instanceof P.FormArray?o.setValue([]):o.setValue(null),t.markAsDirty(),!0)}function Yo(t,e){t&&(t instanceof P.FormGroup?Xo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t instanceof P.FormArray?(t.markAsTouched({onlySelf:!0}),(t.controls||[]).forEach((function(t){return Jo(t,Object.assign(Object.assign({},e),{onlySelf:!0}))}))):(t.markAsTouched({onlySelf:!0}),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))))}function Xo(t,e){t&&(t.markAsTouched(e),Object.keys(t.controls).map((function(e){return t.controls[e]})).filter((function(t){return t.enabled})).forEach((function(t){return Jo(t,e)})),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0})))}function Jo(t,e){t&&(t instanceof P.FormGroup?Yo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t instanceof P.FormArray?(t.controls||[]).forEach((function(t){return Jo(t,Object.assign(Object.assign({},e),{onlySelf:!0}))})):(t.markAsTouched({onlySelf:!0}),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))))}function Zo(t,e){t&&(t.updateValueAndValidity(e),Object.keys(t.controls).map((function(e){return t.controls[e]})).filter((function(t){return t.enabled})).forEach((function(t){t instanceof P.FormGroup?Zo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))})))}function tr(t,e){t&&(t.markAsUntouched(e),Object.getOwnPropertyNames(t.controls).forEach((function(e){var n=t.get(e);n instanceof P.FormGroup?tr(n,{onlySelf:!0}):(n.markAsUntouched({onlySelf:!0}),n.setErrors(null))})))}function er(t,e){return kn((function(){return!0!==t.pending}),e)}function nr(t,e){return kn((function(){return!0!==t.loading}),e)}function or(t,e){return t[e].value&&!je(t[e+jo.calculatedSuffix].value,!1)}function rr(t,e,n){t[e].setValue(on(n)),t[e+jo.calculatedSuffix].setValue(!0)}function ir(t,e){jo.isControlHasInput(t,e)||jo.setCalculatedValue(t,e,void 0)}jo.copyEntity2Form=Bo,jo.getFormValueFromEntity=Uo,jo.logFormErrors=qo,jo.getControlFromPath=Go,jo.filterNumberInput=mn,jo.disableControls=Ho,jo.selectInputContent=un,jo.markAsTouched=Yo,jo.markAllAsTouched=Yo,jo.markAsUntouched=tr,jo.waitWhilePending=er,jo.waitIdle=nr,jo.updateValueAndValidity=Zo,jo.getFormErrors=$o,jo.addValueInArray=Wo,jo.removeValueInArray=Ko,jo.resizeArray=zo,jo.clearValueInArray=Qo,jo.calculatedSuffix="Calculated",jo.isControlHasInput=or,jo.setCalculatedValue=rr,jo.resetCalculatedValue=ir;var ar=function(){function t(t,e,n,o,r){this._formArray=t,this.createControl=e,this.equals=n,this.isEmpty=o,this._validators=r&&r.validators,this.setAllowEmptyArray(je(r&&r.allowEmptyArray,!1))}return t.getOrCreateArray=function(t,e,n){var o=e.get(n);return o||(o=t.array([]),e.addControl(n,o)),o},Object.defineProperty(t.prototype,"allowEmptyArray",{get:function(){return this._allowEmptyArray},set:function(t){this.setAllowEmptyArray(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formArray",{get:function(){return this._formArray},enumerable:!1,configurable:!0}),t.prototype.add=function(t,e){return Wo(this._formArray,this.createControl,this.equals,this.isEmpty,t,e)},t.prototype.removeAt=function(t){return this._allowEmptyArray||1!==this._formArray.length?Ko(this._formArray,this.isEmpty,t):Qo(this._formArray,this.isEmpty,t)},t.prototype.resize=function(t){return zo(this._formArray,this.createControl,t)},t.prototype.clearAt=function(t){return Qo(this._formArray,this.isEmpty,t)},t.prototype.isLast=function(t){return this._formArray.length-1===t},t.prototype.removeAllEmpty=function(){for(var t=this,e=this._formArray.controls.findIndex((function(e){return t.isEmpty(e.value)}));-1!==e;)this.removeAt(e),e=this._formArray.controls.findIndex((function(e){return t.isEmpty(e.value)}))},t.prototype.size=function(){return this._formArray.length},t.prototype.at=function(t){return this._formArray.at(t)},t.prototype.disable=function(t){this._formArray.controls.forEach((function(e){return e.disable(t)}))},t.prototype.enable=function(t){this._formArray.controls.forEach((function(e){return e.enable(t)}))},t.prototype.forEach=function(t){for(var e=this.size(),n=0;n<e;n++){var o=this._formArray.at(n);o&&t(o)}},t.prototype.setAllowEmptyArray=function(t){this._allowEmptyArray!==t&&(this._allowEmptyArray=t,this._allowEmptyArray?this._formArray.setValidators(this._validators||null):this._formArray.setValidators((this._validators||[]).concat(Fo.requiredArrayMinLength(1))))},t}(),sr=new e.InjectionToken("appFormErrorKeys"),lr=function(){function t(t,e){this.translate=t,this.errorI18nKeys=Object.assign(Object.assign({},Do.I18N_ERROR_KEYS),e)}return t.prototype.translateErrors=function(t,e){var n=this;if(!t||!t.invalid)return"";var o=e&&e.separator||", ",r=!e||!1!==e.recursive,i=jo.getFormErrors(t,{recursive:r});return i&&Object.keys(i).reduce((function(r,a){var s=t.get(a);if(s){var l=n.translateControlPath(a,e),c=Object.keys(s.errors).map((function(t){return n.translateError(t,s.errors[t])}));return Fe(c)?r:(r.length&&(r+=o),r+l+": "+c.join(o))}var u=n.translateError(a,i[a]);return Ae(u)?r:r+(r.length?o:"")+u}),"")},t.prototype.translateControlPath=function(t,e){if(null==e?void 0:e.controlPathTranslator)return null==e?void 0:e.controlPathTranslator.translateControlPath(t);var n=(e&&e.i18nPrefix||"")+Ge(t).toUpperCase();return this.translate.instant(n)},t.prototype.translateError=function(t,e){var n=this.errorI18nKeys[t]||"ERROR.FIELD_"+Ge(t).toUpperCase(),o=this.translate.instant(n,e);return n!==o||"string"==typeof e&&e!==(o=this.translate.instant(e))?o:(console.error("[form-error-adapter] Cannot translate error key '"+t+"'. Please add more formErrorsKey into APP_FORM_ERROR_I18N_KEYS injection token"),t)},t}();lr.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new lr(jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(sr,8))},token:lr,providedIn:"root"}),lr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],lr.ctorParameters=function(){return[{type:F.TranslateService},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[sr]}]}]};var cr=function(){function t(t,e){this.adapter=t,this._ref=e,this.value="",this._lastForm=null,this._lastOptions=null}return t.prototype.transform=function(t,e){var n=this;return t?(t===this._lastForm&&sn(e,this._lastOptions)||(this._lastForm=t,this._lastOptions=e,this._updateValue(t,e),this._dispose(),this._onFormStatusChange||(this._onFormStatusChange=t.statusChanges.subscribe((function(o){n._updateValue(t,e,o)})))),this.value):(this._dispose(),"")},t.prototype.ngOnDestroy=function(){this._dispose()},t.prototype._updateValue=function(t,e,n){"INVALID"===n||t.invalid?(this.value=this.adapter.translateErrors(t,e),this._ref.markForCheck()):void 0!==this.value&&(this.value=void 0,this._ref.markForCheck())},t.prototype._dispose=function(){void 0!==this._onFormStatusChange&&(this._onFormStatusChange.unsubscribe(),this._onFormStatusChange=void 0)},t}();cr.decorators=[{type:e.Pipe,args:[{name:"translateFormError",pure:!1}]}],cr.ctorParameters=function(){return[{type:lr},{type:e.ChangeDetectorRef}]};var ur=function(){};ur.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,F.TranslateModule],declarations:[To,Mn,jn,lo,Bn,Xn,Jn,Zn,eo,to,no,co,po,uo,ho,mo,fo,go,bo,yo,vo,Co,Eo,wo,Oo,Io,_o,xo,So,Ao,Ro,cr],exports:[To,Mn,Bn,jn,lo,Xn,Jn,Zn,eo,to,no,co,po,uo,ho,mo,fo,go,bo,Co,Eo,wo,Oo,Io,_o,xo,yo,vo,So,Ao,Ro,cr]}]}];var dr=function(){function t(t,e,n){var o=this;this.keyboard=n,this.timer=null,this.elementRef=t,this.shouldFocusElement="",this.timer=null,this.timerDelay=100,e.ready().then((function(){o.touchUi=e.is("mobile")||e.is("tablet")}))}return t.prototype.ngAfterContentInit=function(){""===this.shouldFocusElement&&this.startFocusWorkflow()},t.prototype.ngOnChanges=function(t){t.timerDelay&&"number"!=typeof this.timerDelay&&isNaN(this.timerDelay=+this.timerDelay)&&(this.timerDelay=100),t.shouldFocusElement&&(this.shouldFocusElement?this.startFocusWorkflow():this.stopFocusWorkflow())},t.prototype.ngOnDestroy=function(){this.stopFocusWorkflow()},t.prototype.startFocusWorkflow=function(){var t=this;this.touchUi&&this.keyboard&&!1===this.keyboard.isVisible||this.timer||(this.timer=setTimeout((function(){t.timer=null,t.elementRef.nativeElement.focus()}),this.timerDelay))},t.prototype.stopFocusWorkflow=function(){clearTimeout(this.timer),this.timer=null},t}();dr.decorators=[{type:e.Directive,args:[{selector:"[autofocus], input[appAutofocus]",inputs:["shouldFocusElement: appAutofocus","timerDelay: autofocusDelay"]}]}],dr.ctorParameters=function(){return[{type:e.ElementRef},{type:M.Platform},{type:B.Keyboard,decorators:[{type:e.Optional}]}]};var pr=function(){};pr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule],declarations:[dr],exports:[dr]}]}];var hr=function(){};hr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,a.ScrollingModule,P.ReactiveFormsModule,ur,pr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,F.TranslateModule.forChild()],exports:[R.MatAutocompleteModule,Fn],declarations:[Fn]}]}];function mr(t){if(null==t)return null;var e=Math.floor(t),n=Math.round(60*(t-e));return[e.toString().padStart(3,"0"),n.toString().padStart(2,"0")].join(":")}function fr(t,e,n){for(var o=t||"";-1!==o.indexOf(n);)o=o.replace(n,"");var r=o.split(":");return function(t,e){if(e>0){var n=Math.pow(10,e);return Math.trunc(t*n+.5)/n}if(0===e)return Math.trunc(t+.5);return t}(parseInt(r[0]||"0")+(parseInt(r[1]||"0")+.5)/60,e)}var gr={latitude:{DDMMSS:[" ",/\d/,/\d/,"°"," ",/\d/,/\d/,"'"," ",/\d/,/\d/,".",/\d/,/\d/,'"'],DDMM:[" ",/\d/,/\d/,"°"," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,"'"],DD:[/[+-]/," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,"°"]},longitude:{DDMMSS:[/\d/,/\d/,/\d/,"°"," ",/\d/,/\d/,"'"," ",/\d/,/\d/,".",/\d/,/\d/,'"'],DDMM:[/\d/,/\d/,/\d/,"°"," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,"'"],DD:[/[+-]/,/\d/,/\d/,/\d/,".",/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,"°"]}},br=function(){},yr=function(){function t(t,n,o,r,i){this.platform=t,this.translate=n,this.formBuilder=o,this.cd=r,this.formGroupDir=i,this._onChangeCallback=br,this._onTouchedCallback=br,this._subscription=new D.Subscription,this.disabling=!1,this.writing=!1,this._readonly=!1,this.maxDecimals=3,this.placeholderChar=be,this.floatLabel="auto",this.required=!1,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.mobile=this.platform.is("mobile")}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this.readonly||this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){this._readonly=t,this.markForCheck()},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.type=this.type||"latitude",this.pattern=this.pattern||"DDMM",this.mask=gr[this.type]&&gr[this.type][this.pattern],this.mask||(console.error("Invalid attribute value. Expected: type: 'latitude|longitude' and latlongPattern: 'DD|DDMM|DDMMSS'"),this.type="latitude",this.pattern="DDMM",this.mask=gr[this.type][this.pattern]),this.maxDecimals&&(this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):"DD"===this.pattern?(console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern."),this.maxDecimals=7):"DDMMSS"===this.pattern?(console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern."),this.maxDecimals=0):2!==this.maxDecimals&&(console.warn("Invalid attribute 'maxDecimals' - Expected value: 2. Other value not implemented."),this.maxDecimals=2)),this.showSignControl="DD"!==this.pattern,this.formatFn="latitude"===this.type?Gn:Hn,this.formatFnOptions={pattern:this.pattern,maxDecimals:this.maxDecimals,hideSign:this.showSignControl},this.inputPlaceholder="COMMON.LAT_LONG."+("longitude"===this.type?"D":"")+this.pattern+"_PLACEHOLDER",this.textFormControl=this.formBuilder.control(this.required?[null,P.Validators.required]:[null]),this.textMaskConfig={mask:this.mask,keepCharPositions:!0,placeholderChar:this.placeholderChar},this.signFormControl=this.formBuilder.control(this.required?[null,P.Validators.required]:[null]),this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-latlong-field>.");var e=this.formControl.validator;e?this.formControl.setValidators([e,"latitude"===this.type?Do.latitude:Do.longitude]):this.formControl.setValidators("latitude"===this.type?Do.latitude:Do.longitude),this._subscription.add(D.merge(this.textFormControl.valueChanges,this.signFormControl.valueChanges).subscribe((function(e){return t.onFormChange(t.textFormControl.value)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(e){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(e){return t.markForCheck()})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){this.value="string"==typeof t?parseFloat(t.replace(/,/g,".")):t,this.writing=!0;var e=this.formatFn(this.value,Object.assign(Object.assign({},this.formatFnOptions),{placeholderChar:this.placeholderChar})),n=Re(this.value)?this.value<0?-1:1:this.defaultSign?"-"===this.defaultSign?-1:1:null;this.textFormControl.patchValue(e,{emitEvent:!1}),this.signFormControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck()}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,t?(this.textFormControl.disable({onlySelf:!0,emitEvent:!1}),this.signFormControl.disable({onlySelf:!0,emitEvent:!1})):(this.textFormControl.enable({onlySelf:!0,emitEvent:!1}),this.signFormControl.enable({onlySelf:!0,emitEvent:!1})),this.disabling=!1,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,this.textFormControl.invalid||this.signFormControl.invalid)return this.formControl.markAsPending(),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({},this.formControl.errors),this.textFormControl.errors),this.signFormControl.errors)),void(this.writing=!1);var e=Pe(t)?Qn(t,this.pattern,7,this.placeholderChar):null;if(isNaN(e))return this.formControl.markAsPending(),this.formControl.setErrors("latitude"===this.type?{latitude:!0}:{longitude:!0}),void(this.writing=!1);var n="DD"===this.pattern?1:this.signFormControl.value||1;this.value=Re(e)?n*e:null,this.formControl.patchValue(this.value,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(this.value)}},t.prototype.checkIfTouched=function(){return!(!this.formControl.touched&&!this.textFormControl.touched)&&(this.markForCheck(),this._onTouchedCallback(),!0)},t.prototype._onFocus=function(t){var e=this;if(Ae(this.value)){if(this.defaultSign){var n="-"===this.defaultSign?-1:1;if("DD"===this.pattern){var o=this.formatFn(n,Object.assign(Object.assign({},this.formatFnOptions),{placeholderChar:this.placeholderChar}));o=o&&o.replace("1",this.placeholderChar),setTimeout((function(){e.inputElement.nativeElement.value=o;var n="latitude"===e.type?2:1;dn(t.target,n)}),250)}else this.signFormControl.setValue(n)}}else un(t);return this.onFocus.emit(t),!0},t.prototype._onBlur=function(t){this.checkIfTouched()&&Ae(this.value)&&(this.inputElement.nativeElement.value=""),this.onBlur.emit(t)},t.prototype.moveCaretToSeparator=function(t,e){return hn(t," ",e)},t.prototype.onKeypress=function(t){var e=this;if(t.which>=48&&t.which<=57||t.which>=37&&t.which<=40);else if("."===t.key||","===t.key)hn(t,".");else if(t.keyCode>=37&&t.keyCode<=40||46==t.keyCode||8==t.which||9==t.keyCode);else if(43===t.keyCode||45===t.keyCode){var n=pn(t.target);if("DD"===this.pattern&&n>0){var o=t.key,r=this.inputElement.nativeElement.value;if(r&&!r.startsWith(o)){var i=o+(r.length>1?r.substr(1):"");this.inputElement.nativeElement.value=i,dn(this.inputElement.nativeElement,n)}t.preventDefault()}}else"N"===t.key||"S"===t.key||"E"===t.key||"W"===t.key||("n"===t.key||"s"===t.key||"e"===t.key||"w"===t.key?setTimeout((function(){e.inputElement.nativeElement.value=e.inputElement.nativeElement.value.toUpperCase()}),10):t.preventDefault())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();yr.decorators=[{type:e.Component,args:[{selector:"mat-latlong-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text"\n readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{formatFn(value, formatFnOptions)}}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding no-wrap">\n <ion-col class="text ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-disabled]="formControl.disabled"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n\n <mat-label *ngIf="placeholder">{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput #inputElement\n type="text"\n autocomplete="off"\n [textMask]="textMaskConfig"\n [formControl]="textFormControl"\n [placeholder]="inputPlaceholder|translate"\n (keypress)="onKeypress($event)"\n (keydown.tab)="moveCaretToSeparator($event, true)"\n (keydown.shift.tab)="moveCaretToSeparator($event, false)"\n (focus)="_onFocus($event)"\n (blur)="_onBlur($event)"\n [required]="required"\n [tabindex]="tabindex">\n\n <div *ngIf="!showSignControl" matSuffix #injectMatSuffix></div>\n\n \x3c!--<div matSuffix *ngIf="!showSignControl"><ng-content select="[matSuffix]"></ng-content></div>--\x3e\n\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper">\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'latitude\')" translate>ERROR.FIELD_NOT_VALID_LATITUDE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'longitude\')" translate>ERROR.FIELD_NOT_VALID_LONGITUDE</mat-error>\n <ng-content select="mat-error"></ng-content>\n </ng-container>\n\n \x3c!-- mat hint --\x3e\n <div class="mat-form-field-hint-wrapper" [hidden]="formControl.invalid">\n <div class="mat-form-field-hint-spacer"></div>\n <ng-content select="mat-hint"></ng-content>\n </div>\n </div>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- sign --\x3e\n <ion-col class="sign ion-no-padding" [ngSwitch]="type" *ngIf="showSignControl">\n\n \x3c!-- sign on latitude --\x3e\n <mat-form-field *ngSwitchCase="\'latitude\'"\n floatLabel="never"\n [class.mat-form-field-invalid]="formControl.touched && signFormControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.LAT_LONG.LAT_SIGN_PLACEHOLDER</mat-label>\n <mat-select [formControl]="signFormControl"\n [tabindex]="tabindex+1">\n <mat-option [value]="1">{{\'COMMON.LAT_LONG.LAT_SIGN_N\'|translate}}</mat-option>\n <mat-option [value]="-1" >{{\'COMMON.LAT_LONG.LAT_SIGN_S\'|translate}}</mat-option>\n </mat-select>\n\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n </mat-form-field>\n\n \x3c!-- sign on longitude --\x3e\n <mat-form-field floatLabel="never"\n *ngSwitchCase="\'longitude\'"\n [class.mat-form-field-invalid]="formControl.touched && signFormControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.LAT_LONG.LONG_SIGN_PLACEHOLDER</mat-label>\n <mat-select [formControl]="signFormControl"\n [tabindex]="tabindex+2">\n <mat-option [value]="1" translate>{{\'COMMON.LAT_LONG.LONG_SIGN_E\'|translate}}</mat-option>\n <mat-option [value]="-1" translate>{{\'COMMON.LAT_LONG.LONG_SIGN_W\'|translate}}</mat-option>\n </mat-select>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return yr}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;min-width:140px;position:relative;--ion-grid-column-padding:0}mat-form-field .datetime-md{padding:0!important}ion-row{flex-wrap:nowrap}ion-row ion-col.text{min-width:80px}ion-row ion-col.sign{min-width:60px;max-width:70px}mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;top:100%}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}mat-error{text-align:right;width:100%}"]}]}],yr.ctorParameters=function(){return[{type:M.Platform},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},yr.propDecorators={mobile:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],type:[{type:e.Input}],pattern:[{type:e.Input,args:["latLongPattern"]}],defaultSign:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],tabindex:[{type:e.Input}],onBlur:[{type:e.Output}],onFocus:[{type:e.Output}],inputElement:[{type:e.ViewChild,args:["inputElement"]}]};var vr=function(){};vr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,U.TextMaskModule,F.TranslateModule.forChild(),v.MatSelectModule],exports:[yr],declarations:[yr]}]}];var Cr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ir})),multi:!0},Er=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],wr=function(){},Ir=function(){function t(t,e,n,o,r,i,a){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.keyboard=i,this.formGroupDir=a,this._onChangeCallback=wr,this._onTouchedCallback=wr,this._subscription=new D.Subscription,this.writing=!0,this.disabling=!1,this.dayMask=Er,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=be,this.autofocus=!1,this.clearable=!1,this.mobile=t.is("mobile"),this.keyboardHideDelay=this.mobile?ve:0,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return io(this._value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required);var e=new D.BehaviorSubject(null);this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?[P.Validators.required,Do.validDate]:Do.validDate),this.updatePattern(this.translate.instant("COMMON.DATE_PATTERN")),this._subscription.add(this.translate.get("COMMON.DATE_PATTERN").subscribe((function(e){return t.updatePattern(e)}))),this._subscription.add(this.dayControl.valueChanges.subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(n){"INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.dayControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){if(Te(t))return this.writing=!0,this.dayControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=this.dateAdapter.parse(t,ge),this._value&&(this.writing=!0,this.dayControl.patchValue(this.dateAdapter.format(this._value.clone().startOf("day"),this.dayPattern),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.dayControl.disable({onlySelf:!0,emitEvent:!1}):this.dayControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(!this.writing&&t&&t.value){this.writing=!0;var e,n=t.value;e=(n=(n="string"==typeof n&&this.dateAdapter.parse(n,ge)||n)&&n.utc(!0).hour(0).minute(0).seconds(0).millisecond(0))&&n.clone().startOf("day"),this.dayControl.setValue(n&&this.dateAdapter.format(e,this.dayPattern),{emitEvent:!1});var o=n&&this.dateAdapter.format(n,ge).replace("+00:00","Z");this.formControl.patchValue(o,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(o)}},t.prototype.updatePattern=function(t){t="COMMON.DATE_PATTERN"!==t?t:"L",this.displayPattern!==t&&(this.displayPattern=t,this.dayPattern=t,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){for(this.writing=!0;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var e;e=(e=t&&this.dateAdapter.parse(t,this.dayPattern)||null)&&e.utc(!0).hour(0).minute(0).seconds(0).millisecond(0),this._value=e&&this.dateAdapter.parse(e.clone(),ge);var n=e&&e.isValid()&&this.dateAdapter.format(e,ge).replace("+00:00","Z")||e;this.formControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(n)}},t.prototype.checkIfTouched=function(){this.dayControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=e||this.datePicker)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard&&this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.keyboardHideDelay>0&&t?[4,nn(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ir.decorators=[{type:e.Component,args:[{selector:"mat-date-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dayControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker)"\n (keyup.escape)="preventEvent($event)"\n [required]="required"\n [tabindex]="tabindex"\n [appAutofocus]="autofocus">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dayControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final control --\x3e\n <input matInput type="text"\n [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n (dateChange)="onDatePickerChange($event)">\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="openDatePicker($event, datePicker)"\n [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="writeValue(null)"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'validDate\')" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateIsAfter\')">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateRange\')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMaxDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMinDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngIf="formControl.hasError(\'msg\')">{{formControl.errors.msg}}</mat-error>\n </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n',providers:[Cr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}:host [no-padding]{--ion-grid-column-padding:0}:host [nowrap]{flex-wrap:nowrap}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md,mat-form-field ion-datetime{padding:0!important}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Ir.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ir.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Or={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ar})),multi:!0},_r=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],xr=/^[012][0-9][:][012345][0-9]$/,kr=[/[012]/,/\d/,":",/[012345]/,/\d/],Sr=function(){},Ar=function(){function t(t,e,n,o,r,i,a){this.platform=t,this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.keyboard=r,this.cd=i,this.formGroupDir=a,this._onChangeCallback=Sr,this._onTouchedCallback=Sr,this._subscription=new D.Subscription,this.writing=!0,this.disabling=!1,this._readonly=!1,this.dayMask=_r,this.hourMask=kr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=be,this.autofocus=!1,this.clearable=!1,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){this._readonly=t,this.markForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.mobile=Ae(this.mobile)?this.platform.is("mobile"):this.mobile,this.waitHideKeyboardDelay=this.mobile?ve:0,this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Do.validDate]:[this.formControl.validator,Do.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Do.validDate]:Do.validDate),this.dateFormControl=this.formBuilder.control(null,this.required?P.Validators.required:null);var e=this.required?this.mobile?P.Validators.required:P.Validators.compose([P.Validators.required,P.Validators.pattern(xr)]):this.mobile?null:P.Validators.pattern(xr);this.timeFormControl=this.formBuilder.control(null,e),this._subscription.add(this.translate.get(["COMMON.DATE_PATTERN","COMMON.DATE_TIME_PATTERN"]).subscribe((function(e){return t.updatePattern(e)}))),this._subscription.add(D.merge(this.dateFormControl.valueChanges,this.timeFormControl.valueChanges).subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(e){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(){return t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){this.writing=!0;var e=ao(t);if(e&&e.isValid()){var n=e.clone().startOf("day"),o=this.dateAdapter.format(n,this.dayPattern),r=e.hour();r=r<10?"0"+r:r;var i=e.minutes(),a=r+":"+(i=i<10?"0"+i:i);this.dateFormControl.patchValue(o,{emitEvent:!1}),this.timeFormControl.patchValue(a,{emitEvent:!1})}else this.dateFormControl.patchValue(null,{emitEvent:!1}),this.timeFormControl.patchValue(null,{emitEvent:!1});this.writing=!1,this.markForCheck()}},t.prototype.onFormChange=function(t){if(!this.writing){this.writing=!0;var e=this.dateFormControl.value,n=this.timeFormControl.value,o=Te(n)!==Te(e);if(o||this.dateFormControl.invalid||this.timeFormControl.invalid)return this.formControl.markAsPending({onlySelf:!0}),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({validDate:o},this.formControl.errors),this.dateFormControl.errors),this.timeFormControl.errors)),this.formControl.markAsDirty(),void(this.writing=!1);for(;e&&-1!==e.indexOf(this.placeholderChar);)e=e.replace(this.placeholderChar,"");var r=e&&this.dateAdapter.parse(e,this.dayPattern)||null,i=(n||"").split(":"),a=parseInt(i[0]||0),s=parseInt(i[1]||0),l=r&&r.locale(this.locale).hour(a).minute(s).seconds(0).millisecond(0).utc();this.emitChange(l),this.writing=!1}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,t?(this.dateFormControl.disable({emitEvent:!1}),this.timeFormControl.disable({emitEvent:!1})):(this.dateFormControl.enable({emitEvent:!1}),this.timeFormControl.enable({emitEvent:!1})),this.disabling=!1,this.markForCheck())},t.prototype.updatePattern=function(t){this.displayPattern="COMMON.DATE_TIME_PATTERN"!==t["COMMON.DATE_TIME_PATTERN"]?t["COMMON.DATE_TIME_PATTERN"]:"L LT",this.dayPattern="COMMON.DATE_PATTERN"!==t["COMMON.DATE_PATTERN"]?t["COMMON.DATE_PATTERN"]:"L"},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||L.isMoment(t.value))){var e=t.value&&t.value.locale(this.locale).hour(0).minute(0).seconds(0).millisecond(0).utc(!0),n=e&&this.dateAdapter.format(e,this.dayPattern)||null;this.dateFormControl.value!==n&&this.dateFormControl.setValue(n,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.onTimePickerChange=function(t){this.timeFormControl.value!==t&&this.timeFormControl.setValue(t,{emitEvent:!0})},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.hideKeyboard(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=e||this.datePicker)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.openTimePickerIfMobile=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.hideKeyboard(!0)]);case 1:return e.sent(),this.openTimePicker(null),[2]}}))}))},t.prototype.openTimePicker=function(t){this.timePicker&&(this.preventEvent(t),this.timePicker.open())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.checkIfTouched=function(){(this.dateFormControl.touched||this.timeFormControl.touched)&&(this._onTouchedCallback(),this.markForCheck())},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.clear=function(){this.formControl.setValue(null),this.markAsTouched(),this.markAsDirty()},t.prototype.emitChange=function(t){var e=io(t)||null;this.formControl.value!==e&&(this._onChangeCallback(e),this.checkIfTouched())},t.prototype.hideKeyboard=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.waitHideKeyboardDelay>0&&t?[4,nn(this.waitHideKeyboardDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(){this.dateFormControl.markAsTouched(),this.timeFormControl.markAsTouched(),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ar.decorators=[{type:e.Component,args:[{selector:"mat-date-time-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text"\n readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable + time --\x3e\n<ng-template #writable >\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding no-wrap" nowrap>\n\n \x3c!-- day --\x3e\n <ion-col class="day ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dateFormControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker)"\n (keyup.escape)="preventEvent($event)"\n [required]="required"\n [tabindex]="tabindex"\n [appAutofocus]="autofocus">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dateFormControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix #datePickerButton2 (click)="openDatePicker($event, datePicker)" [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clear()"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"></mat-datepicker>\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper" >\n \x3c!-- errors --\x3e\n <ng-container [ngSwitch]="formControl.touched && formControl.errors|mapKeys|arrayFirst">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE_TIME</mat-error>\n <mat-error *ngSwitchCase="\'dateIsAfter\'">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngSwitchCase="\'dateRange\'" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngSwitchCase="\'dateMaxDuration\'" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngSwitchCase="\'dateMinDuration\'" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngSwitchCase="\'msg\'">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</mat-error>\n </ng-container>\n <ng-content select="mat-error"></ng-content>\n\n \x3c!-- mat hint --\x3e\n <div class="mat-form-field-hint-wrapper" [class.cdk-visually-hidden]="formControl.invalid">\n <div class="mat-form-field-hint-spacer"></div>\n <ng-content select="mat-hint"></ng-content>\n </div>\n </div>\n\n </ion-col>\n\n \x3c!-- hour --\x3e\n <ion-col class="hour ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-invalid]="formControl.touched && (timeFormControl.invalid || formControl.invalid)">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.TIME</mat-label>\n <input matInput #matInput type="text"\n *ngIf="!mobile"\n [formControl]="timeFormControl"\n autocomplete="off"\n min="0" max="23"\n [textMask]="{mask: hourMask, keepCharPositions: true, placeholderChar: placeholderChar, guide: true}"\n [placeholder]="\'COMMON.TIME_PLACEHOLDER\'|translate"\n [required]="required"\n (keyup.arrowdown)="openTimePicker($event)"\n (keyup.escape)="preventEvent($event)"\n (blur)="checkIfTouched()"\n [tabindex]="tabindex !== undefined ? tabindex+1 : undefined">\n\n <input matInput #matInput type="text"\n *ngIf="mobile"\n [formControl]="timeFormControl"\n (click)="openTimePickerIfMobile($event)"\n readonly>\n\n <input matInput type="text"\n [formControl]="timeFormControl"\n hidden\n [ngxTimepicker]="timePicker"\n [format]="24">\n\n <button matSuffix type="button" mat-icon-button\n tabindex="-1"\n *ngIf="!compact && !mobile"\n [disabled]="formControl.disabled"\n (click)="openTimePicker($event)" >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n <button matSuffix type="button" mat-icon-button\n tabindex="-1"\n *ngIf="!compact && mobile"\n [disabled]="formControl.disabled"\n (click)="openTimePickerIfMobile($event)">\n <mat-icon>access_time</mat-icon>\n </button>\n\n <ngx-material-timepicker #timePicker [@.disabled]="true"\n (timeSet)="onTimePickerChange($event)"\n [ESC]="!mobile"\n [defaultTime]="\'00:00\'"\n [cancelBtnTmpl]="timePickerCancelButton"\n [confirmBtnTmpl]="timePickerOkButton"\n [preventOverlayClick]="mobile"\n [enableKeyboardInput]="false"\n [disableAnimation]="true">\n \x3c!-- cancel button --\x3e\n <ng-template #timePickerCancelButton>\n <ion-button fill="clear" color="dark">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n </ng-template>\n\n \x3c!-- confirm button --\x3e\n <ng-template #timePickerOkButton>\n <ion-button fill="solid" color="tertiary">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ng-template>\n\n </ngx-material-timepicker>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n\n</ng-template>\n\n<ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n</ng-template>\n\n<ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n',providers:[Or],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative;--ion-grid-column-padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}ion-row.no-wrap{flex-wrap:nowrap}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Ar.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:B.Keyboard},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ar.propDecorators={mobile:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],timePicker:[{type:e.ViewChild,args:["timePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Tr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Dr})),multi:!0},Rr=[/\d/,/\d/,/\d/,/\d/],Pr=function(){},Dr=function(){function t(t,e,n,o,r,i,a){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.keyboard=i,this.formGroupDir=a,this._onChangeCallback=Pr,this._onTouchedCallback=Pr,this.writing=!0,this.disabling=!1,this.dayMask=Rr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=be,this.clearable=!1,this.mobile=t.is("mobile"),this.keyboardHideDelay=this.mobile?ve:0,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return io(this._value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");var e=new D.BehaviorSubject(null);this.required=je(this.required,this.formControl.validator===P.Validators.required),this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?P.Validators.compose([P.Validators.required,Do.validDate]):Do.validDate);var n=this.translate.instant(["COMMON.DATE_YEAR_PATTERN"]);this.updatePattern(n),this.dayControl.valueChanges.subscribe((function(e){return t.onFormChange(e)})),this.formControl.statusChanges.subscribe((function(n){t.readonly||t.writing||t.disabling||("INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.dayControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck())})),this.updateTabIndex(),this.writing=!1},t.prototype.writeValue=function(t){if(!this.writing){if(Te(t))return this.writing=!0,this.dayControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=this.dateAdapter.parse(t,ge),this._value&&(this.writing=!0,this.dayControl.patchValue(this._value.clone().startOf("day").format(this.dayPattern),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.dayControl.disable({onlySelf:!0,emitEvent:!1}):this.dayControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(!this.writing&&t&&t.value){this.writing=!0;var e,n=t.value;e=(n=(n="string"==typeof n&&this.dateAdapter.parse(n,ge)||n)&&n.utc(!0).hour(0).minute(0).seconds(0).millisecond(0))&&n.clone().startOf("day"),this.dayControl.setValue(e&&e.format(this.dayPattern),{emitEvent:!1});var o=n&&n.format(ge).replace("+00:00","Z");this.formControl.patchValue(o,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(o)}},t.prototype.updatePattern=function(t){this.displayPattern=this.displayPattern="COMMON.DATE_YEAR_PATTERN"!==t["COMMON.DATE_YEAR_PATTERN"]?t["COMMON.DATE_YEAR_PATTERN"]:"L",this.dayPattern="COMMON.DATE_YEAR_PATTERN"!==t["COMMON.DATE_YEAR_PATTERN"]?t["COMMON.DATE_YEAR_PATTERN"]:"L"},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,this.dayControl.invalid)return this.formControl.markAsPending(),this.formControl.setErrors(Object.assign({},this.dayControl.errors)),void(this.writing=!1);for(;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var e;e=(e=t&&this.dateAdapter.parse(t,this.dayPattern)||null)&&e.utc(!0).hour(0).minute(0).seconds(0).millisecond(0),this._value=e&&this.dateAdapter.parse(e.clone(),ge);var n=e&&e.isValid()&&e.format(ge).replace("+00:00","Z")||e;this.formControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(n)}},t.prototype.checkIfTouched=function(){this.dayControl.touched&&(this.markForCheck(),this._onTouchedCallback(),this.onDatePickerChange(this.dayControl))},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=this.datePicker1||this.datePicker2)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.closeDatePicker=function(t,e){this.formControl.setValue(t),e.close()},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard&&this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.keyboardHideDelay>0&&t?[4,nn(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Dr.decorators=[{type:e.Component,args:[{selector:"mat-date-short-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dayControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_YEAR_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker1)"\n (keyup.escape)="preventEvent($event)"\n (click)="matInput.select()"\n [required]="required"\n [tabindex]="tabindex">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dayControl"\n (click)="openDatePickerIfMobile($event, datePicker1)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final control --\x3e\n <input matInput type="text"\n [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker1"\n (dateChange)="onDatePickerChange($event)">\n\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="openDatePicker($event, datePicker1)"\n [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="writeValue(null)"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'validDate\')" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateIsAfter\')">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateRange\')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMaxDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMinDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngIf="formControl.hasError(\'msg\')">{{formControl.errors.msg}}</mat-error>\n <ng-content select="mat-error"></ng-content>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView="multi-year"\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n (yearSelected)="closeDatePicker($event, datePicker1)"\n [startAt]="startDate"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n',providers:[Tr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}:host [no-padding]{--ion-grid-column-padding:0}:host [nowrap]{flex-wrap:nowrap}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md,mat-form-field ion-datetime{padding:0!important}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Dr.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Dr.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker1:[{type:e.ViewChild,args:["datePicker1"]}],datePicker2:[{type:e.ViewChild,args:["datePicker2"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Nr=function(){};Nr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,q.MatDatepickerModule,j.MatMomentDateModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,F.TranslateModule.forChild(),pr],exports:[g.MatIconModule,Ir,Ar,Dr],declarations:[Ir,Ar,Dr]}]}];var Fr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ur})),multi:!0},Mr=/[0-9]\d\d:[0-5]\d/,Lr=[/\d/,/\d/,/\d/,":",/[0-5]/,/\d/],jr=function(){},Br=jr,Ur=function(){function t(t,e,n,o,r,i){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.formGroupDir=i,this._subscription=new D.Subscription,this._onChangeCallback=jr,this._onTouchedCallback=jr,this.writing=!0,this.disabling=!1,this.hourMask=Lr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.maxDecimals=2,this.placeholderChar=be,this.clearable=!1}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.maxDecimals&&(this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):this.maxDecimals<2&&(console.warn("Invalid attribute 'maxDecimals' - Value should be more than 2, otherwise the round trip conversion will lose minutes."),this.maxDecimals=2)),this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required);var e=new D.BehaviorSubject(null);this.textControl=this.formBuilder.control(null,null),this.textControl.setValidators(this.required?[P.Validators.required,function(){return e.getValue()},P.Validators.pattern(Mr)]:[function(){return e.getValue()},P.Validators.pattern(Mr)]),this._subscription.add(this.textControl.valueChanges.subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(n){"INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.textControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){if(Ae(t))return this.writing=!0,this.textControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=t,isNaN(this._value)||(this.writing=!0,console.debug("[mat-duration] Formatted hour: "+this._value+" to "+mr(this._value)),this.textControl.patchValue(mr(this._value),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.textControl.disable({onlySelf:!0,emitEvent:!1}):this.textControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,console.debug("[mat-duration] onFormChange:",t),this.textControl.hasError("pattern")||this.textControl.hasError("required"))return this.formControl.markAsPending(),this.formControl.setErrors({pattern:this.textControl.errors.pattern,required:this.textControl.errors.required}),void(this.writing=!1);this._value=fr(t||"",this.maxDecimals,this.placeholderChar),console.debug("[mat-duration] Setting duration: ",this._value),this.formControl.patchValue(this._value,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(this._value)}},t.prototype.checkIfTouched=function(){this.textControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.moveCaretToSeparator=function(t,e){return hn(t,":",e)},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ur.decorators=[{type:e.Component,args:[{selector:"mat-duration-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{ formControl.value|duration }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-disabled]="formControl.disabled"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.TIME</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput type="text"\n autocomplete="off"\n [formControl]="textControl"\n [textMask]="{mask: hourMask, keepCharPositions: true, placeholderChar: placeholderChar, guide: true}"\n [placeholder]="\'COMMON.DURATION_PLACEHOLDER\'|translate"\n [required]="required"\n (keydown.tab)="moveCaretToSeparator($event, true)"\n (keydown.shift.tab)="moveCaretToSeparator($event, false)"\n (keyup.escape)="preventEvent($event)"\n (blur)="checkIfTouched()"\n [tabindex]="tabindex !== undefined ? tabindex+1 : undefined">\n\n\n \x3c!-- errors --\x3e\n <mat-error *ngIf="!formControl.hasError(\'required\') && textControl.hasError(\'pattern\')" translate>ERROR.FIELD_NOT_VALID_PATTERN</mat-error>\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{(compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\') | translate:formControl.errors.min }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors.max }}</mat-error>\n\n <ng-content select="mat-error"></ng-content>\n </mat-form-field>\n</ng-template>\n\n',providers:[Fr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;min-width:140px;position:relative;--ion-grid-column-padding:0}:host,mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;top:100%}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}mat-error{text-align:right;width:100%}"]}]}],Ur.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ur.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],tabindex:[{type:e.Input}],clearable:[{type:e.Input}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Vr=function(){};Vr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,s.MatRippleModule,j.MatMomentDateModule,F.TranslateModule.forChild()],exports:[Ur],declarations:[Ur]}]}];var qr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Gr})),multi:!0},$r=function(){},Gr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=$r,this._onTouchedCallback=$r,this._writing=!1,this.showRadio=!1,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.required=!1,this.compact=!1,this.yesLabel="COMMON.YES",this.noLabel="COMMON.NO",this.showButtonIcons=!0,this.yesIcon="checkmark",this.noIcon="close",this.onPressEnter=new e.EventEmitter,this.onBlur=new e.EventEmitter}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this._onChangeCallback(t))},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-boolean-field>.");this.style=this.style||(this.compact?"checkbox":"radio"),"button"===this.style&&(this.buttonsColCount=Be(this.buttonsColCount,2)),this.showRadio=this.showRadio||"always"===this.floatLabel,this.updateTabIndex()},t.prototype.ngAfterViewInit=function(){var t=this;this.suffixDiv&&this.suffixInjections.find((function(e){return e.nativeElement.append(t.suffixDiv.nativeElement),t.suffixDiv.nativeElement.classList.remove("cdk-visually-hidden"),!0}))},t.prototype.writeValue=function(t,e){var n=this;this._writing||(this._writing=!0,t!==this._value&&(this._value=t,this.showRadio="always"===this.floatLabel||Re(this._value),Re(this.tabindex)&&setTimeout((function(){return n.updateTabIndex()}))),this._writing=!1,"button"===this.style&&(t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)),e&&this.onPressEnter.emit(e)),this.markForCheck())},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype._onBlur=function(t){this.checkIfTouched(),this.onBlur.emit(t)},t.prototype._onFocusFakeInput=function(t){t.preventDefault(),this.fakeInput&&(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1),this.focus()},t.prototype.focus=function(){var t=this;this.showRadio=!0,setTimeout((function(){t.yesButton?t.yesButton.focus():t.checkboxButton&&t.checkboxButton.focus(),t.updateTabIndex()})),this.markForCheck()},t.prototype.onRadioValueChanged=function(t){this._writing||(this._writing=!0,this._value=t.value,this.checkIfTouched(),this._onChangeCallback(t.value),this._writing=!1)},t.prototype.onCheckboxValueChanged=function(t){this._writing||(this._writing=!0,this._value=t.checked,this.checkIfTouched(),this._onChangeCallback(t.checked),this._writing=!1)},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.updateTabIndex=function(){Ae(this._tabindex)||-1===this._tabindex||(this.fakeInput&&(this.showRadio?(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1):(this.fakeInput.nativeElement.classList.remove("hidden"),this.fakeInput.nativeElement.tabIndex=this._tabindex)),this.yesButton?(this.yesButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex:-1,this.noButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex+1:-1):this.checkboxButton&&(this.checkboxButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex:-1),this.markForCheck())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Gr.decorators=[{type:e.Component,args:[{selector:"mat-boolean-field",template:'<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled {{classList}}">\n <input matInput hidden type="text" readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{(formControl.value == null && \'COMMON.EMPTY_OPTION\' || (formControl.value === true && yesLabel) || noLabel) | translate }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <ng-container [ngSwitch]="style">\n\n \x3c!-- Radio --\x3e\n <mat-form-field *ngSwitchCase="\'radio\'"\n [floatLabel]="showRadio && (!floatLabel || floatLabel === \'auto\') ? \'always\': floatLabel"\n class="mat-boolean-field mat-boolean-field-radio {{classList}}">\n <mat-label *ngIf="placeholder && floatLabel!==\'never\'">\n {{placeholder}}\n <span [hidden]="showRadio">({{yesLabel|translate}}/{{\'COMMON.NO\'|translate}})</span>\n </mat-label>\n\n <input matInput #fakeInput type="text" readonly="true"\n [formControl]="formControl"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showRadio"\n [tabindex]="tabindex">\n\n \x3c!-- radio button --\x3e\n <mat-radio-group [hidden]="!showRadio"\n [formControl]="formControl"\n (change)="onRadioValueChanged($event)">\n <mat-radio-button #yesButton [value]="true">\n <span>{{yesLabel|translate}}</span>\n </mat-radio-button> \n <mat-radio-button #noButton [value]="false">\n <span>{{noLabel|translate}}</span>\n </mat-radio-button>\n </mat-radio-group>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Checkbox --\x3e\n <mat-form-field *ngSwitchCase="\'checkbox\'"\n [floatLabel]="floatLabel"\n class="mat-boolean-field mat-boolean-field-checkbox {{classList}}">\n <mat-label *ngIf="placeholder && !showRadio">\n {{placeholder}}\n </mat-label>\n\n <input matInput #matInput\n [formControl]="formControl"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showRadio"\n [tabindex]="tabindex">\n\n <ion-label> </ion-label>\n\n \x3c!-- checkbox, when compact --\x3e\n <mat-checkbox #checkboxButton\n [formControl]="formControl"\n (change)="onCheckboxValueChanged($event)"\n [indeterminate]="value===undefined"\n [hidden]="!showRadio"\n [tabindex]="tabindex">\n </mat-checkbox>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Buttons --\x3e\n <mat-form-field *ngSwitchCase="\'button\'"\n [floatLabel]="floatLabel === \'never\' ? \'never\' : \'always\'"\n class="mat-boolean-field mat-boolean-field-button {{classList}}">\n <input matInput type="text" hidden\n [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required">\n <div class="mat-form-field-buttons"\n [style.--buttons-col-count]="buttonsColCount"\n *ngIf="!formControl.disabled; else disabledLabel">\n \x3c!-- yes --\x3e\n <ion-button class="mat-form-field-button"\n [tabindex]="_tabindex"\n (click)="writeValue(true, $event)"\n (keyup.enter)="writeValue(true, $event)"\n [color]="_value == null ? \'tertiary\' : (_value === true) ? \'accent\' : \'light\'">\n <ion-icon *ngIf="showButtonIcons && yesIcon; let icon" slot="start" [name]="icon"></ion-icon>\n {{yesLabel|translate}}\n </ion-button>\n\n \x3c!-- No button --\x3e\n <ion-button class="mat-form-field-button"\n [tabindex]="_tabindex !== undefined ? (_tabindex + 1) : undefined"\n (click)="writeValue(false, $event)"\n (keyup.enter)="writeValue(false, $event)"\n [color]="_value == null ? \'tertiary\' : (_value === false) ? \'accent\' : \'light\'">\n <ion-icon *ngIf="showButtonIcons && noIcon; let icon" slot="start" [name]="icon"></ion-icon>\n {{noLabel|translate}}\n </ion-button>\n </div>\n <ng-template #disabledLabel>\n <ion-label><i translate>COMMON.EMPTY_OPTION</i></ion-label>\n </ng-template>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </ng-container>\n\n <div class="cdk-visually-hidden">\n <div #suffix><ng-content select="[matSuffix]"></ng-content></div>\n </div>\n\n</ng-template>\n\n\n',providers:[qr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{width:100%}.mat-form-field.mat-boolean-field-radio{margin-top:-2px}.mat-form-field.mat-boolean-field-button{margin-top:-4px}.mat-form-field .mat-form-field-buttons{width:100%;display:flex;flex-flow:row wrap;justify-content:flex-start;align-items:center}.mat-form-field .mat-form-field-buttons .mat-form-field-button{--flex-basis:calc(100% / var(--buttons-col-count, 2));flex:0 1 var(--flex-basis);max-width:min(var(--flex-basis),150px);white-space:normal;padding:0 2px;height:40px}"]}]}],Gr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Gr.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],style:[{type:e.Input}],buttonsColCount:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],yesLabel:[{type:e.Input}],noLabel:[{type:e.Input}],showButtonIcons:[{type:e.Input}],yesIcon:[{type:e.Input}],noIcon:[{type:e.Input}],onPressEnter:[{type:e.Output,args:["keyup.enter"]}],onBlur:[{type:e.Output}],tabindex:[{type:e.Input}],value:[{type:e.Input}],yesButton:[{type:e.ViewChild,args:["yesButton"]}],noButton:[{type:e.ViewChild,args:["noButton"]}],checkboxButton:[{type:e.ViewChild,args:["checkboxButton"]}],fakeInput:[{type:e.ViewChild,args:["fakeInput"]}],suffixDiv:[{type:e.ViewChild,args:["suffix",{static:!1}]}],suffixInjections:[{type:e.ViewChildren,args:["injectMatSuffix"]}]};var Hr=function(){};Hr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,k.MatRadioModule,h.MatCheckboxModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,F.TranslateModule.forChild()],exports:[Gr],declarations:[Gr]}]}];var Wr,zr=[[{key:"1"},{key:"2"},{key:"3"},{key:"Backspace",icon:"backspace",color:"light"}],[{key:"4"},{key:"5"},{key:"6"},{key:"Tab",label:"COMMON.BTN_NEXT_SHORT",color:"light"}],[{key:"7"},{key:"8"},{key:"9"},{key:".",label:"COMMON.BTN_DECIMAL_SEPARATOR",color:"light"}],[null,{key:"0"},null,{key:"Enter",icon:"checkmark",color:"tertiary"}]],Kr=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.inputTarget=n&&n.target,o}return Ee(e,t),e}(KeyboardEvent);t.AnimationState=void 0,(Wr=t.AnimationState||(t.AnimationState={})).ENTER="enter",Wr.ENTER_INPUT="enter-input",Wr.LEAVE="leave";var Qr=function(){function e(e){this.cd=e,this.debug=!0,this.backdropState=t.AnimationState.LEAVE,this.columnCount=4,this.filteredKeymap=new D.BehaviorSubject(void 0),this.debug&&console.debug("[numpad-container] Creating component")}return e.prototype.ngOnInit=function(){if(!this.keymap||!this.keymap.length)throw new Error("An invalid 'keymap' was sent to numpad container");this.disableAnimation||(this.appendToInput?this.panelState=t.AnimationState.ENTER:this.modalState=t.AnimationState.ENTER),this.noBackdrop=this.noBackdrop||this.appendToInput,this.noBackdrop||(this.backdropState=t.AnimationState.ENTER);var e=this.defineFilteredKeymap();this.filteredKeymap.next(e),this.columnCount=e.reduce((function(t,e){return e&&Math.max(t,e.length)}),0),this.debug&&console.debug("[numpad-container] columnCount="+this.columnCount)},e.prototype.ngOnDestroy=function(){},e.prototype.onButtonClick=function(t,e){this.debug&&console.debug("[numpad-container] onKeyPress() ",e.key);var n=new Kr("keypress",{key:e.key,target:this.inputElement});this.numpadRef.keypress.next(n)},e.prototype.onKeydown=function(t){console.debug("[numpad-container] onKeypress()",t),this.numpadRef.keypress.next(t)},e.prototype.overlayClick=function(t){this.close()},e.prototype.close=function(){this.disableAnimation?this.numpadRef.close():(this.modalState&&(this.modalState=t.AnimationState.LEAVE),this.panelState&&(this.panelState=t.AnimationState.LEAVE),this.backdropState&&(this.backdropState=t.AnimationState.LEAVE),this.markForCheck())},e.prototype.animationDone=function(e){"done"===e.phaseName&&e.toState===t.AnimationState.LEAVE&&this.numpadRef.close()},e.prototype.defineFilteredKeymap=function(){var t=this.keymap;return this.decimal||(t=t.map((function(t){return t.map((function(t){return t&&"."!==t.key&&","!==t.key?t:null}))}))),t},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}();Qr.decorators=[{type:e.Component,args:[{selector:"mat-numpad-container",template:'<div class="numpad-backdrop-overlay"\n *ngIf="!noBackdrop"\n (click)="overlayClick($event)"\n [@numpadBackdrop]="backdropState">\n</div>\n<div class="numpad-overlay">\n <mat-numpad-content [appendToInput]="appendToInput"\n [inputElement]="inputElement" cdkTrapFocus>\n <div class="numpad {{position}}"\n [class.panel]="appendToInput"\n [@numpadPanelExpansion]="panelState"\n (@numpadPanelExpansion.done)="animationDone($event)"\n [@numpadFadeIn]="modalState"\n (@numpadFadeIn.done)="animationDone($event)">\n <ion-grid>\n <ion-row *ngFor="let row of filteredKeymap | async">\n <ion-col size="{{12/columnCount}}" *ngFor="let item of row">\n <ion-button mat-button expand="block"\n *ngIf="item"\n [color]="item.color || \'secondary\'"\n (click)="onButtonClick($event, item)">\n <ion-icon *ngIf="item.icon; else label" slot="icon-only" [name]="item.icon"></ion-icon>\n <ng-template #label>\n <ion-label>{{ (item.label || item.key) | translate }}</ion-label>\n </ng-template>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n </div>\n </mat-numpad-content>\n</div>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[$.trigger("numpadBackdrop",[$.state("*",$.style({opacity:0,background:"transparent"})),$.state(t.AnimationState.ENTER,$.style({opacity:1})),$.state(t.AnimationState.LEAVE,$.style({opacity:0})),$.transition("* => "+t.AnimationState.ENTER,[$.style({opacity:0}),$.animate("0.4s cubic-bezier(0.25, 0.8, 0.25, 1)")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.style({opacity:1}),$.animate("0.2s cubic-bezier(0.25, 0.8, 0.25, 1)")])]),$.trigger("numpadFadeIn",[$.state("*",$.style({opacity:1,transform:"scale(1)"})),$.state(t.AnimationState.ENTER,$.style({opacity:1,transform:"scale(1)"})),$.state(t.AnimationState.LEAVE,$.style({opacity:0,transform:"scale(0.9)"})),$.transition("* => "+t.AnimationState.ENTER,[$.style({opacity:0,transform:"scale(0.6)"}),$.animate("0.2s ease-out")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.animate("0.2s ease-out")])]),$.trigger("numpadPanelExpansion",[$.state("*",$.style({opacity:1,transform:"scaleY(0) translateY(-50%)"})),$.state(t.AnimationState.ENTER,$.style({opacity:1,transform:"scale(1) translateY(0)"})),$.state(t.AnimationState.LEAVE,$.style({opacity:0,transform:"scale(1) translateY(0)"})),$.transition("* => "+t.AnimationState.ENTER,[$.animate("0.2s ease-out")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.animate("0.2s ease-out")])])],styles:[":host{display:inline-block;max-width:300px;--ion-grid-padding:0;--ion-grid-column-padding:0;--background-color:#fff;--padding:8px}.numpad-backdrop-overlay{position:absolute;top:0;bottom:0;left:0;right:0;background:rgba(0,0,0,.32);z-index:1000;pointer-events:auto;-webkit-tap-highlight-color:transparent}.numpad-overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1000;pointer-events:none}.numpad{width:300px;border-radius:4px;outline:none;position:static;z-index:1000;pointer-events:auto;background-color:var(--background-color,transparent);padding:var(--padding,5px);box-shadow:0 14px 45px rgba(0,0,0,.25),0 10px 18px rgba(0,0,0,.22)}.numpad.panel{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}"]}]}],Qr.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},Qr.propDecorators={onKeydown:[{type:e.HostListener,args:["window:keydown",["$event"]]}]};var Yr=function(){function t(t,e,n,o){this.cfr=t,this.appRef=e,this.injector=n,this.document=o}return t.prototype.appendNumpadToBody=function(t,e){var n=this;this.componentRef=this.cfr.resolveComponentFactory(t).create(this.injector),Object.keys(e).forEach((function(t){return n.componentRef.instance[t]=e[t]})),this.appRef.attachView(this.componentRef.hostView);var o=this.componentRef.hostView.rootNodes[0];this.document.body.appendChild(o)},t.prototype.destroyNumpad=function(){this.componentRef.destroy(),this.appRef.detachView(this.componentRef.hostView)},t}();Yr.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Yr(jt.ɵɵinject(jt.ComponentFactoryResolver),jt.ɵɵinject(jt.ApplicationRef),jt.ɵɵinject(jt.INJECTOR),jt.ɵɵinject(Bt.DOCUMENT,8))},token:Yr,providedIn:"root"}),Yr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Yr.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ApplicationRef},{type:e.Injector},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[n.DOCUMENT]}]}]};var Xr=function(){function t(t){this.domService=t,this._opened=!1,this.keymap=zr,this.decimal=!0,this.disableAnimation=!1,this.noBackdrop=!1,this.position="bottom",this.keypress=new e.EventEmitter,this.closed=new e.EventEmitter}return Object.defineProperty(t.prototype,"opened",{get:function(){return this._opened},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputElement",{get:function(){return this._inputRef&&this._inputRef.element},enumerable:!1,configurable:!0}),t.prototype.registerInput=function(t){if(this._inputRef)throw new Error("A Numpad can only be registered to one input.");this._inputRef=t},t.prototype.open=function(){this._opened||(console.debug("[numpad] Opening numpad..."),this.domService.appendNumpadToBody(Qr,{numpadRef:this,decimal:this.decimal,keymap:this.keymap,inputElement:this.inputElement,appendToInput:this.appendToInput,disableAnimation:this.disableAnimation,noBackdrop:this.noBackdrop,position:this.position}),this._opened=!0)},t.prototype.close=function(){console.debug("[numpad] Closing numpad..."),this.domService.destroyNumpad(),this._opened=!1,this.closed.next()},t}();Xr.decorators=[{type:e.Component,args:[{selector:"mat-numpad",template:""}]}],Xr.ctorParameters=function(){return[{type:Yr}]},Xr.propDecorators={keymap:[{type:e.Input}],decimal:[{type:e.Input}],appendToInput:[{type:e.Input}],disableAnimation:[{type:e.Input}],noBackdrop:[{type:e.Input}],position:[{type:e.Input}],keypress:[{type:e.Output}],closed:[{type:e.Output}]};var Jr=function(){function t(t){this.elementRef=t,this._value="",this.numpadSubscriptions=[],this.onTouched=function(){},this.onChange=function(){}}return Object.defineProperty(t.prototype,"numpad",{set:function(t){this.registerNumpad(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value?this._value:""},set:function(t){this._value=t||"",this.updateInputValue()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.elementRef&&this.elementRef.nativeElement},enumerable:!1,configurable:!0}),t.prototype.updateValue=function(t){console.debug("[numpad-directive] updateValue()",t),this.value=t,this.onChange(t)},t.prototype.ngOnChanges=function(t){},t.prototype.onClick=function(t){this.disableClick||(this._numpad.open(),t.preventDefault(),t.stopPropagation())},t.prototype.writeValue=function(t){this.value=t},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype.ngOnDestroy=function(){this.numpadSubscriptions.forEach((function(t){return t.unsubscribe()}))},t.prototype.registerNumpad=function(t){var e=this;if(!t)throw new Error("MatNumpadComponent is not defined. Please make sure you passed the numpad to matNumpad directive");console.debug("[numpad-directive] Registering numpad",t),this._numpad=t,this._numpad.registerInput(this),this.numpadSubscriptions.push(this._numpad.keypress.pipe().subscribe((function(t){return e.applyingKey(t)})))},t.prototype.applyingKey=function(t){console.debug("[numpad-directive] Receiving key="+t.key);var e=null!==this.value&&void 0!==this.value?this.value:"";if(e="number"==typeof e?""+e:e.replace(",","."),"."===t.key||","===t.key)-1===e.indexOf(".")&&(e+=".");else if("Backspace"===t.key)e=e.length>1?e.substr(0,e.length-1):"";else{if("Enter"===t.key||13===t.keyCode)return void this._numpad.close();if("Tab"===t.key)return;if("Escape"===t.key)return void this._numpad.close();e+=t.key||""}this.updateValue(e),this.onTouched()},t.prototype.updateInputValue=function(){this.elementRef.nativeElement.value=this.value},t}();Jr.decorators=[{type:e.Directive,args:[{selector:"[matNumpad]",providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:Jr,multi:!0}],host:{"[disabled]":"disabled","(click)":"onClick($event)","(change)":"updateValue($event.target.value)","(blur)":"onTouched()"}}]}],Jr.ctorParameters=function(){return[{type:e.ElementRef}]},Jr.propDecorators={keymap:[{type:e.Input}],numpad:[{type:e.Input,args:["matNumpad"]}],value:[{type:e.Input}],disabled:[{type:e.Input}],decimal:[{type:e.Input}],disableClick:[{type:e.Input}],onClick:[{type:e.HostListener,args:["click",["$event"]]}]};var Zr=function(){};Zr.decorators=[{type:e.Component,args:[{selector:"mat-numpad-content",template:'<div [appendNumpadToInput]="inputElement" *ngIf="appendToInput; else modal">\n \x3c!--suppress HtmlUnknownAttribute --\x3e\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</div>\n\n<ng-template #modal>\n \x3c!--suppress HtmlUnknownAttribute --\x3e\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n'}]}],Zr.propDecorators={appendToInput:[{type:e.Input}],inputElement:[{type:e.Input}]};var ti=function(){function t(t,e){this.renderer=e,this.element=t.nativeElement}return Object.defineProperty(t.prototype,"inputCords",{get:function(){return this.inputElement.getBoundingClientRect()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"directionY",{get:function(){var t=this.element.offsetHeight,e=this._inputCords,n=e.bottom,o=e.top,r=(window&&window.innerHeight)-n<t;return r&&o>t?"top":r&&o<t?"center":"bottom"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"directionX",{get:function(){var t=this.element.offsetWidth,e=this._inputCords,n=e.left,o=e.right,r=(window&&window.innerWidth)-n<t;return r&&o>t?"end":r&&o<t?"center":"start"},enumerable:!1,configurable:!0}),t.prototype.ngAfterViewInit=function(){this._inputCords=this.inputCords,this._directionY=this.directionY,this._directionX=this.directionX,this.append()},t.prototype.changePosition=function(){var t=this.inputCords,e=t.left,n=t.right,o=t.bottom,r=t.top,i=this.defineElementYByDirection(e,n),a=this.defineElementYByDirection(r,o);this.setStyle("left",i+"px"),this.setStyle("top",a+"px")},t.prototype.append=function(){var t=this._inputCords,e=t.left,n=t.right,o=t.bottom,r=t.top,i=this.defineElementXByDirection(e,n),a=this.defineElementYByDirection(r,o);this.setStyle("position","fixed"),this.setStyle("left",i+"px"),this.setStyle("top",a+"px")},t.prototype.setStyle=function(t,e){this.renderer.setStyle(this.element,t,e)},t.prototype.defineElementYByDirection=function(t,e){return"top"===this._directionY?t-this.element.offsetHeight:"center"===this._directionY?t-this.element.offsetHeight/2:e},t.prototype.defineElementXByDirection=function(t,e){return"end"===this._directionX?e-this.element.offsetWidth:"center"===this._directionX?e-this.element.offsetWidth/2:t},t}();ti.decorators=[{type:e.Directive,args:[{selector:"[appendNumpadToInput]"}]}],ti.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},ti.propDecorators={inputElement:[{type:e.Input,args:["appendNumpadToInput"]}],changePosition:[{type:e.HostListener,args:["window:scroll"]}]};var ei=function(){};ei.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild()],exports:[Xr,Jr,Qr,Zr,ti],declarations:[Qr,Xr,Zr,Jr,ti]}]}];var ni={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return oi})),multi:!0},oi=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=D.noop,this._onTouchedCallback=D.noop,this._subscription=new D.Subscription,this._writing=!1,this.showSlides=!1,this.$items=new D.BehaviorSubject(void 0),this.$loaded=new D.BehaviorSubject(!1),this.logPrefix="[mat-swipe-field]",this.debug=!1,this.required=!1,this.clearable=!1,this.onClick=new e.EventEmitter,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.selectInputContent=un}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.$items.getValue()},set:function(t){var e=this;this._itemsSubscription&&(console.warn(this.logPrefix+" Items received twice !"),this._subscription.remove(this._itemsSubscription),this._itemsSubscription.unsubscribe()),D.isObservable(t)?this._itemsSubscription=this._subscription.add(t.subscribe((function(t){e.loadItems(t)}))):t!==this.$items.getValue()&&this.loadItems(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"itemCount",{get:function(){return(this.$items.getValue()||[]).length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.formControl.enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-swipe-field>.");this.displayAttributes=this.displayAttributes||["label","name"],this.displayWith=this.displayWith||function(e){return e&&ze(e,t.displayAttributes)},this.compareWithFn=this.compareWithFn||function(t,e){return t&&e&&t.id===e.id},this.mobile=je(this.mobile,!1)},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._value=void 0,this.$items.complete()},t.prototype._onFocusFakeInput=function(t){t.preventDefault(),this.fakeInput&&(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1),this.focus()},t.prototype.focus=function(){var t=this;this.showSlides=!0,setTimeout((function(){t.prevButton&&t.prevButton.focus(),t.updateTabIndex()})),Ae(this._value)&&(this.slideTo(0),this.slideChanged()),this.markForCheck()},t.prototype.updateTabIndex=function(){Ae(this._tabindex)||-1===this._tabindex||(this.fakeInput&&(this.showSlides?(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1):(this.fakeInput.nativeElement.classList.remove("hidden"),this.fakeInput.nativeElement.tabIndex=this._tabindex)),this.prevButton&&this.nextButton&&(this.prevButton._elementRef.nativeElement.tabIndex=this.showSlides?this._tabindex:-1,this.nextButton._elementRef.nativeElement.tabIndex=this.showSlides?this._tabindex+1:-1),this.markForCheck())},t.prototype.writeValue=function(t){var e=this;this._writing||(this._writing=!0,this.compareWithFn(t,this._value)||(this._value=t,this.showSlides=Re(this._value),this.updateSlides(),setTimeout((function(){return e.updateTabIndex()}))),this._writing=!1,this.markForCheck())},t.prototype.clearValue=function(t){var e=this;t.stopPropagation(),this._writing=!0,this.debug&&console.debug(this.logPrefix+" clear value"),this._value=void 0,this.formControl.patchValue(null,{emitEvent:!1}),this.showSlides=!1,setTimeout((function(){e.updateTabIndex(),e.slideTo(0),setTimeout((function(){e._writing=!1}),100)})),this._onChangeCallback(null),this.markForCheck()},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){var e=this;this.slides.lockSwipes(t).then((function(){return e.updateButtons()})),this.cd.markForCheck()},t.prototype.previous=function(){this.slides.slidePrev()},t.prototype.next=function(){this.slides.slideNext()},t.prototype.reachStart=function(t){this.previousDisabled=t},t.prototype.reachEnd=function(t){this.nextDisabled=t},t.prototype.slidesLoaded=function(){this.$loaded.next(!0)},t.prototype.slideChanged=function(){var t=this;this.slides.getActiveIndex().then((function(e){if(!t._writing){t._writing=!0;var n=(t.$items.getValue()||[])[e]||void 0;t.debug&&console.debug(t.logPrefix+" slide changed ActiveIndex:"+e+", new value:"+n),t.formControl.patchValue(n,{emitEvent:!1}),t._writing=!1,t.checkIfTouched(),t._onChangeCallback(n)}}))},t.prototype.loadItems=function(t){var e=this;this.$loaded.next(!1),this.$items.next(t),this.ready().then((function(){return e.slides.update()}))},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.updateSlides=function(){var t=this;if(this.showSlides){var e=(this.$items.getValue()||[]).findIndex((function(e){return t.compareWithFn(e,t._value)}));e>=0?this.slideTo(e):(console.warn(this.logPrefix+" Item not found",this._value),this.slideTo(0))}},t.prototype.slideTo=function(t){var e=this;this.slides.slideTo(t,0,!1).then((function(){return e.slides.update().then((function(){return e.updateButtons()}))}))},t.prototype.updateButtons=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return[4,this.slides.getActiveIndex()];case 1:return t=e.sent(),this.debug&&console.debug(this.logPrefix+" update buttons ActiveIndex:"+t),this.previousDisabled=0===t||this.disabled,this.nextDisabled=t===this.itemCount-1||this.disabled,[2]}}))}))},t.prototype.getSlides=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.ready()];case 1:return t.sent(),[2,this.slides]}}))}))},t.prototype.ready=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return!1!==this.$loaded.getValue()?[3,2]:(this.debug&&console.debug(this.logPrefix+" waiting slides to be ready..."),[4,_n(this.$loaded.pipe(N.filter((function(t){return!0===t}))))]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}();oi.decorators=[{type:e.Component,args:[{selector:"mat-swipe-field",template:'<mat-form-field [floatLabel]="showSlides && (!floatLabel || floatLabel === \'auto\') ? \'always\': floatLabel"\n [class]="classList"\n [class.mat-form-field-disabled]="disabled">\n <mat-label *ngIf="placeholder && floatLabel!==\'never\'">\n {{placeholder}}\n </mat-label>\n <input matInput #fakeInput type="text"\n [formControl]="formControl"\n [readonly]="true"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showSlides"\n [tabindex]="tabindex">\n\n <div class="slides-container" [class.hidden]="!showSlides">\n <ion-slides #slides\n [options]="slidesOptions"\n (ionSlidesDidLoad)="slidesLoaded()"\n (ionSlideReachStart)="reachStart(true)"\n (ionSlideReachEnd)="reachEnd(true)"\n (ionSlideNextEnd)="reachStart(false)"\n (ionSlidePrevEnd)="reachEnd(false)"\n (ionSlideDidChange)="slideChanged()"\n >\n <ion-slide *ngFor="let item of $items | async">\n <ion-label>{{ displayWith(item) }}</ion-label>\n </ion-slide>\n\n </ion-slides>\n </div>\n\n <button #prevButton\n mat-icon-button\n type="button"\n class="button-prev"\n [hidden]="!showSlides"\n [disabled]="previousDisabled"\n (click)="previous()">\n <mat-icon>chevron_left</mat-icon>\n </button>\n <button #nextButton\n mat-icon-button\n type="button"\n class="button-next"\n [hidden]="!showSlides"\n [disabled]="nextDisabled"\n (click)="next()">\n <mat-icon>chevron_right</mat-icon>\n </button>\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clearValue($event)"\n [hidden]="disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'entity\')" translate>ERROR.FIELD_INVALID</mat-error>\n\n</mat-form-field>\n',providers:[ni],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}input.hidden{display:none}.slides-container .swiper-slide{font-size:16px!important}.slides-container.hidden{visibility:hidden;height:0!important}.button-next,.button-prev{position:absolute;top:calc(50% - 20px);z-index:10}.button-prev{left:0;right:auto}.button-next{left:auto;right:0}"]}]}],oi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},oi.propDecorators={logPrefix:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],debug:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],clearable:[{type:e.Input}],compareWithFn:[{type:e.Input}],displayWith:[{type:e.Input}],displayAttributes:[{type:e.Input}],appAutofocus:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],tabindex:[{type:e.Input}],items:[{type:e.Input}],onClick:[{type:e.Output,args:["click"]}],onBlur:[{type:e.Output,args:["blur"]}],onFocus:[{type:e.Output,args:["focus"]}],fakeInput:[{type:e.ViewChild,args:["fakeInput"]}],slides:[{type:e.ViewChild,args:["slides",{static:!0}]}],prevButton:[{type:e.ViewChild,args:["prevButton"]}],nextButton:[{type:e.ViewChild,args:["nextButton"]}]};var ri=function(){};ri.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild(),d.MatFormFieldModule,P.ReactiveFormsModule,p.MatInputModule],exports:[oi],declarations:[oi]}]}];var ii=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=function(t){},this._onTouchedCallback=function(){},this.logPrefix="[mat-chips] ",this.required=!1,this.readonly=!1,this.clearable=!1,this.debounceTime=250,this.highlightAccent=!1,this.i18nPrefix="REFERENTIAL.",this.noResultMessage="COMMON.NO_RESULT",this.debug=!1,this.clicked=new e.EventEmitter,this.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.$inputItems=new D.BehaviorSubject(void 0),this.onDropButtonClick=new e.EventEmitter(!0),this.inputControl=new P.FormControl,this.getPropertyByPath=Ze,this._subscription=new D.Subscription,this._$filter=new D.BehaviorSubject(void 0)}return Object.defineProperty(t.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._$filter.getValue()},set:function(t){this.debug&&console.debug(this.logPrefix+" Setting filter:",t),t!==this._$filter.getValue()&&this._$filter.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){this._tabindex=t,this.markForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{set:function(t){var e=this;this._itemsSubscription&&(console.warn("Items received twice !"),this._subscription.remove(this._itemsSubscription),this._itemsSubscription.unsubscribe()),D.isObservable(t)?this._itemsSubscription=this._subscription.add(t.subscribe((function(t){return e.$inputItems.next(t)}))):t!==this.$inputItems.getValue()&&this.$inputItems.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value||[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.readonly||this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return!this.readonly&&this.formControl.enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-chips-field>.");if(this.config&&(this.suggestFn=this.suggestFn||this.config.suggestFn,!this.suggestFn&&this.config.items&&(this.items=this.config.items),this.filter=this.filter||this.config.filter,this.displayAttributes=this.displayAttributes||this.config.attributes,this.displayColumnSizes=this.displayColumnSizes||this.config.columnSizes,this.displayColumnNames=this.displayColumnNames||this.config.columnNames,this.displayWith=this.displayWith||this.config.displayWith,this.compareWith=this.compareWith||this.config.compareWith,this.mobile=je(this.mobile,this.config.mobile),this.showAllOnFocus=je(this.showAllOnFocus,je(this.config.showAllOnFocus,!0)),this.showPanelOnFocus=je(this.showPanelOnFocus,je(this.config.showPanelOnFocus,!0)),this.class=this.class||this.config.class),this.displayAttributes=this.displayAttributes||this.filter&&this.filter.attributes||["label","name"],this.displayWith=this.displayWith||function(e){return e&&ze(e,t.displayAttributes)},this.compareWith=this.compareWith||function(t,e){return t&&e&&t.id===e.id},this.displayColumnSizes=this.displayColumnSizes||this.displayAttributes.map((function(t){return t&&t.endsWith("label")?2:t&&t.endsWith("rankOrder")?1:void 0})),this.displayColumnNames=this.displayAttributes.map((function(e,n){return t.displayColumnNames&&t.displayColumnNames[n]||t.i18nPrefix+Ge(e).toUpperCase()})),this.mobile=je(this.mobile,!1),!this.suggestFn){var e=function(e,n){return Ie(t,void 0,void 0,(function(){var t,o,r;return Oe(this,(function(i){switch(i.label){case 0:return this.debug&&console.debug(this.logPrefix+" Calling suggestFromArray with value=",e),[4,We(this.$inputItems.getValue(),e,Object.assign({searchAttributes:this.displayAttributes},n))];case 1:return t=i.sent(),o=t.data,r=t.total,this._itemCount=Be(r,o&&o.length||0),[2,{data:o,total:r}]}}))}))};this.suggestFn=function(n,o){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return Ae(this.$inputItems.getValue())?(this.debug&&console.debug("[mat-chips] Waiting items to be set..."),[4,_n(this.$inputItems)]):[3,2];case 1:t.sent(),this.debug&&console.debug("[mat-chips] Received items:",this.$inputItems.getValue()),t.label=2;case 2:return this.suggestFn=e,[2,this.suggest(n,o)]}}))}))}}this._subscription.add(this.onDropButtonClick.pipe(N.filter((function(e){return(!e||!e.defaultPrevented)&&t.formControl.enabled}))).subscribe((function(){t.matInputText.nativeElement.focus()})));var n=D.merge(D.merge(this.focused,this.clicked).pipe(N.filter((function(e){return t.enabled})),N.map((function(e){return t.showAllOnFocus?"*":t.inputControl.value}))),this.inputControl.valueChanges.pipe(N.startWith(this.inputControl.value),N.filter((function(t){return Re(t)&&"object"==typeof t||Me(t)&&!t.includes("**")})),N.tap((function(e){t.debug&&console.debug(t.logPrefix+" valueChanges:",e)})),N.debounceTime(this.debounceTime)),this.$inputItems.pipe(N.map((function(){return t.formControl.value}))),this._$filter.pipe(N.map((function(){return t.formControl.value}))));this.filteredItems$=n.pipe(N.distinctUntilChanged(),N.switchMap((function(e){return t.suggest(e,t.filter)})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.$inputItems.complete()},t.prototype.add=function(t){this.debug&&console.debug(this.logPrefix+"select",t);var e=t.option.value;this.writeValue(ke(this.value,[e])),this.matInputText.nativeElement.value="",this.inputControl.setValue("")},t.prototype.remove=function(t){var e=this.value&&this.value.indexOf(t);if(e>=0){var n=this.value.slice();n.splice(e,1),this.writeValue(n),this.inputControl.setValue("")}},t.prototype.reloadItems=function(){this.onDropButtonClick.emit()},t.prototype.writeValue=function(t){this.debug&&console.debug(this.logPrefix+" Writing value: ",t),t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t))},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.cd.markForCheck()},t.prototype.focus=function(){fn(this.matInputText)},t.prototype.filterInputTextFocusEvent=function(t){if(t&&!t.defaultPrevented)return t.relatedTarget instanceof HTMLElement&&"MAT-OPTION"===t.relatedTarget.tagName?(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,this.debug&&console.debug(this.logPrefix+" Cancelling focus event"),!1):!!(!un(t)||this.showPanelOnFocus&&this.showAllOnFocus)&&(this.debug&&console.debug(this.logPrefix+" Emit focus event"),this.focused.emit(t),!0)},t.prototype.clearValue=function(t){this.writeValue(null),t.stopPropagation()},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return[4,this.suggestFn(t,e)];case 1:return(n=s.sent())?Array.isArray(n)?(n=n,this._itemCount=n.length||0):(o=n.data,r=n.total,n=o,this._itemCount=Be(r,o&&o.length||0)):(this._itemCount=0,n=[]),i=(n||[]).slice().filter((function(t){return-1===a.value.findIndex((function(e){return a.compareWith(t,e)}))})),this._itemCount=this._itemCount-(((null==n?void 0:n.length)||0)-((null==i?void 0:i.length)||0)),this.debug&&console.debug(this.logPrefix+" Filtered items by suggestFn:",t,n),[2,n]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();ii.decorators=[{type:e.Component,args:[{selector:"mat-chips-field",template:'<ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col class="ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel" class="material-chips" [class.mat-form-field-disabled]="disabled">\n <div matPrefix>\n <ng-content select="[matPrefix]"></ng-content>\n </div>\n <mat-label>{{placeholder}}</mat-label>\n <mat-chip-list #chipList>\n <mat-chip\n *ngFor="let item of value"\n [selectable]="false"\n [removable]="!disabled"\n (removed)="remove(item)">\n {{displayWith(item)}}\n <mat-icon matChipRemove *ngIf="!disabled">cancel</mat-icon>\n </mat-chip>\n\n <input matInput #matInputText type="text"\n [matAutocomplete]="autoCombo"\n [formControl]="inputControl"\n [appAutofocus]="appAutofocus"\n [tabindex]="_tabindex"\n [readonly]="disabled"\n [hidden]="disabled"\n [required]="required"\n (click)="clicked.emit($event)"\n (blur)="blurred.emit($event)"\n (focus)="filterInputTextFocusEvent($event)"\n (keyup.arrowdown)="!autoCombo.showPanel && onDropButtonClick.emit($event)"\n [matChipInputFor]="chipList"\n >\n </mat-chip-list>\n\n \x3c!-- autocomplete --\x3e\n <mat-autocomplete #autoCombo="matAutocomplete"\n (optionSelected)="add($event)"\n autoActiveFirstOption\n [displayWith]="displayWith"\n [class]="class">\n <ng-container *ngIf="(filteredItems$ | async) as items">\n <ion-row class="mat-autocomplete-header ion-no-padding">\n <ion-col *ngFor="let attr of displayAttributes; index as i; last as isLast" [size]="displayColumnSizes[i]">\n <ion-label [innerHTML]="displayColumnNames[i] | translate"></ion-label>\n <ion-text color="light" *ngIf="isLast" class="ion-float-end ion-padding-end"><i>{{\'COMMON.RESULT_COUNT\'|translate: {count: itemCount} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n \x3c!-- No item option --\x3e\n <mat-option *ngIf="!items.length" class="ion-no-padding" [disabled]="true">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding">\n <ion-label><i>{{noResultMessage | translate}}</i></ion-label>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <mat-option *ngFor="let item of items" [value]="item" class="ion-no-padding">\n <ion-row>\n <ion-col *ngFor="let attr of displayAttributes; index as i;"\n [size]="displayColumnSizes[i]">\n <ion-text [innerHTML]="getPropertyByPath(item, attr) | highlight: { search: inputControl.value, withAccent: highlightAccent } "></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="onDropButtonClick.emit($event)"\n [hidden]="disabled">\n <mat-icon class="large select-arrow">arrow_drop_down</mat-icon>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clearValue($event)"\n [hidden]="disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n <ng-content matSuffix select="[matSuffix]"></ng-content>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n </mat-form-field>\n\n </ion-col>\n <ion-col size="auto" class="ion-align-self-center">\n <ng-content select="[matAfter]"></ng-content>\n </ion-col>\n </ion-row>\n</ion-grid>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return ii}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{position:relative}:host.ion-text-wrap ion-label{white-space:normal!important}button[hidden]{display:none}mat-icon.select-arrow{color:rgba(0,0,0,.47);font-size:150%}"]}]}],ii.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},ii.propDecorators={compareWith:[{type:e.Input}],logPrefix:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],suggestFn:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],readonly:[{type:e.Input}],clearable:[{type:e.Input}],debounceTime:[{type:e.Input}],displayWith:[{type:e.Input}],displayAttributes:[{type:e.Input}],displayColumnSizes:[{type:e.Input}],displayColumnNames:[{type:e.Input}],highlightAccent:[{type:e.Input}],showAllOnFocus:[{type:e.Input}],showPanelOnFocus:[{type:e.Input}],appAutofocus:[{type:e.Input}],config:[{type:e.Input}],i18nPrefix:[{type:e.Input}],noResultMessage:[{type:e.Input}],class:[{type:e.Input}],debug:[{type:e.Input}],clicked:[{type:e.Output}],blurred:[{type:e.Output}],focused:[{type:e.Output}],matInputText:[{type:e.ViewChild,args:["matInputText"]}],autocompleteTrigger:[{type:e.ViewChild,args:[R.MatAutocompleteTrigger]}],filter:[{type:e.Input}],tabindex:[{type:e.Input}],items:[{type:e.Input}]};var ai=function(){};ai.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,pr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,W.MatChipsModule,F.TranslateModule.forChild()],declarations:[ii],exports:[ii]}]}];var si=function(){function t(t){this.el=t}return t.prototype.ngOnInit=function(){var t;switch(this.size=this.size||"medium",this.color=this.color||"primary","warn"===this.color&&(this.color="warning"),this.size){case"large":t="24px";break;case"medium":t="22px";break;case"small":t="16px"}var e=this.el.nativeElement.querySelector(".mat-badge-content");e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center","clear"===this.fill?(e.style.color="var(--ion-color-"+this.color+")",e.style.background="transparent"):(e.style.background="var(--ion-color-"+this.color+")",e.style.color="var(--ion-color-"+this.color+"-contrast)"),this.matIcon?e.innerHTML='<i class="material-icons" style="font-size: '+t+';">'+this.matIcon+"</i>":this.ionIcon&&(e.innerHTML='<ion-icon style="font-size: '+t+'; pointer-events: none;" name="'+this.ionIcon+'"></ion-icon>')},t}();si.decorators=[{type:e.Directive,args:[{selector:"[matBadgeIcon], [ionBadgeIcon]",inputs:["size: matBadgeSize","color: matBadgeColor","fill: matBadgeFill"]}]}],si.ctorParameters=function(){return[{type:e.ElementRef}]},si.propDecorators={matIcon:[{type:e.Input,args:["matBadgeIcon"]}],ionIcon:[{type:e.Input,args:["ionBadgeIcon"]}]};var li=function(){};li.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,S.MatBadgeModule],exports:[si],declarations:[si]}]}];var ci=[s.MatCommonModule,l.MatTableModule,c.MatSortModule,u.MatPaginatorModule,d.MatFormFieldModule,p.MatInputModule,o.CdkTableModule,h.MatCheckboxModule,m.MatExpansionModule,f.MatToolbarModule,T.MatDialogModule,g.MatIconModule,b.MatButtonModule,y.MatMenuModule,v.MatSelectModule,C.MatCardModule,E.MatTabsModule,I.MatListModule,w.MatStepperModule,O.MatButtonToggleModule,_.MatProgressSpinnerModule,x.MatProgressBarModule,k.MatRadioModule,S.MatBadgeModule,A.MatSlideToggleModule,r.A11yModule,i.OverlayModule,a.ScrollingModule,s.MatRippleModule,G.MatDividerModule,H.MatTooltipModule,hr,vr,Nr,Vr,Hr,ei,ri,ai,li],ui=function(){};ui.decorators=[{type:e.NgModule,args:[{imports:ci,exports:ci}]}];var di=function(){function t(){this._requestsRunning=0,this.onProgressChanged=new e.EventEmitter}return t.prototype.list=function(){return this._requestsRunning},t.prototype.increase=function(){this._requestsRunning++,1===this._requestsRunning&&this.onProgressChanged.emit("query")},t.prototype.decrease=function(){this._requestsRunning>0&&this._requestsRunning--,0===this._requestsRunning&&this.onProgressChanged.emit("none")},t}();di.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new di},token:di,providedIn:"root"}),di.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var pi=400,hi=function(t){function e(){var e=t.apply(this,ke(arguments))||this;return e.overrides={press:{time:pi},pinch:{enable:!1},rotate:{enable:!1},swipe:{threshold:30,velocity:.4}},e}return Ee(e,t),e.prototype.buildHammer=function(t){console.debug("[gesture] Applying HammerJS config to ",t.tagName);var e=new window.Hammer(t);for(var n in this.overrides)n&&e.get(n).set(this.overrides[n]);return e},e}(K.HammerGestureConfig);hi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new hi},token:hi,providedIn:"root"}),hi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var mi=function(){},fi=function(){function t(t,n,o,r){this.router=t,this.routerOutlet=n,this.cd=o,this._closeTapCount=0,this._validateTapCount=0,this.title="",this.color="primary",this.class="",this.hasValidate=!1,this.hasClose=!1,this.canShowMenu=!0,this.onValidate=new e.EventEmitter,this.onClose=new e.EventEmitter,this.onValidateAndClose=new e.EventEmitter,this.onBackClick=new e.EventEmitter,this.onSearch=new e.EventEmitter,this.showSearchBar=!1,r&&(this.progressBarMode$=r.onProgressChanged.pipe(N.startWith("none"),N.tap((function(t){return"[toolbar] Updating progressBarMode: "+t})),N.debounceTime(100),N.distinctUntilChanged()))}return Object.defineProperty(t.prototype,"backHref",{get:function(){return this._backHref},set:function(t){t!==this._backHref&&(this._backHref=t,this.canGoBack=this.canGoBack||Re(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackHref",{get:function(){return this._defaultBackHref},set:function(t){t!==this._defaultBackHref&&(this._defaultBackHref=t,this.canGoBack=this.canGoBack||Re(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.hasValidate=je(this.hasValidate,this.onValidate.observers.length>0),this.canGoBack=je(this.canGoBack,this.routerOutlet.canGoBack()||Pe(this._backHref)||Pe(this._defaultBackHref)),this.hasSearch=je(this.hasSearch,this.onSearch.observers.length>0)},t.prototype.ngOnDestroy=function(){this.onBackClick.complete(),this.onBackClick.unsubscribe(),this.onValidate.complete(),this.onValidate.unsubscribe(),this.onClose.complete(),this.onClose.unsubscribe(),this.onValidateAndClose.complete(),this.onValidateAndClose.unsubscribe(),this.onSearch.complete(),this.onSearch.unsubscribe()},t.prototype.toggleSearchBar=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){return this.showSearchBar=!this.showSearchBar,this.showSearchBar&&this.searchbar&&setTimeout((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.searchbar.setFocus()];case 1:return t.sent(),[2]}}))}))}),300),[2]}))}))},t.prototype.doBackClick=function(t){this.onBackClick.emit(t),t.defaultPrevented||this.goBack()},t.prototype.goBack=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.debug("[toolbar] calling goBack()"),this._backHref?[4,this.router.navigateByUrl(this._backHref)]:[3,2];case 1:return t.sent(),[3,7];case 2:return this.routerOutlet.canGoBack()?[4,this.routerOutlet.pop()]:[3,4];case 3:return t.sent(),[3,7];case 4:return this._defaultBackHref?[4,this.router.navigateByUrl(this._defaultBackHref)]:[3,6];case 5:return t.sent(),[3,7];case 6:console.error("[toolbar] Cannot go back. Missing attribute 'defaultBackHref' or 'backHref'"),t.label=7;case 7:return[2]}}))}))},t.prototype.tapClose=function(t){var e=this;this._validateTapCount>0||(this._closeTapCount=t.tapCount,setTimeout((function(){t.tapCount<e._closeTapCount||(e.onClose.emit(t.srcEvent||t),e._closeTapCount=0)}),500))},t.prototype.tapValidate=function(t){var e=this;this.onValidateAndClose.observers.length?(this._validateTapCount=t.tapCount,setTimeout((function(){t.tapCount<e._validateTapCount||(1===e._validateTapCount?e.onValidate.emit(t.srcEvent||t):e._validateTapCount>=2&&e.onValidateAndClose.emit(t.srcEvent||t),e._validateTapCount=0)}),410)):this.onValidate.emit(t.srcEvent||t)},t}();fi.decorators=[{type:e.Component,args:[{selector:"app-toolbar",template:'<ion-header [class]="class">\n <ion-toolbar [color]="color">\n\n <ion-buttons slot="start">\n\n \x3c!-- back button --\x3e\n <ion-button class="back-button"\n *ngIf="canGoBack"\n (click)="doBackClick($event)"\n routerDirection="back" >\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n\n \x3c!-- show menu button --\x3e\n <ion-menu-toggle [hidden]="canGoBack || !canShowMenu">\n <ion-button>\n <ion-icon slot="icon-only" name="menu"></ion-icon>\n </ion-button>\n </ion-menu-toggle>\n\n <ng-content select="[slot=start]"></ng-content>\n </ion-buttons>\n\n <ion-title [innerHTML]="title"></ion-title>\n\n <ng-content select="ion-title"></ng-content>\n\n <ng-content select="ion-buttons[slot=end]"></ng-content>\n\n <ion-buttons slot="end" collapse="true">\n\n <ng-content select="[slot=end]"></ng-content>\n\n \x3c!-- search bar --\x3e\n <ion-searchbar #searchbar animated\n type="search"\n *ngIf="hasSearch"\n [class.cdk-visually-hidden]="!showSearchBar"\n show-cancel-button="always"\n (ionChange)="onSearch.emit($event)"\n (ionCancel)="toggleSearchBar()">\n </ion-searchbar>\n\n \x3c!-- search button --\x3e\n <ion-button (click)="toggleSearchBar()"\n *ngIf="hasSearch && !showSearchBar">\n <ion-icon slot="icon-only" name="search"></ion-icon>\n </ion-button>\n\n \x3c!-- close button --\x3e\n <ion-button *ngIf="hasClose"\n (tap)="tapClose($event)"\n class="visible-xs visible-sm visible-mobile">\n <ion-icon slot="icon-only" name="close"></ion-icon>\n </ion-button>\n\n \x3c!-- validate button --\x3e\n <ion-button *ngIf="hasValidate"\n (tap)="tapValidate($event)"\n class="visible-xs visible-sm visible-mobile">\n <ion-icon slot="icon-only" name="save"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n\n \x3c!-- progress bar --\x3e\n <mat-progress-bar [color]="color" [mode]="progressBarMode$ | async">\n </mat-progress-bar>\n</ion-header>\n',providers:[{provide:mi,useExisting:fi}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],fi.ctorParameters=function(){return[{type:z.Router},{type:M.IonRouterOutlet},{type:e.ChangeDetectorRef},{type:di,decorators:[{type:e.Optional}]}]},fi.propDecorators={title:[{type:e.Input}],color:[{type:e.Input}],class:[{type:e.Input}],backHref:[{type:e.Input}],defaultBackHref:[{type:e.Input}],hasValidate:[{type:e.Input}],hasClose:[{type:e.Input}],hasSearch:[{type:e.Input}],canGoBack:[{type:e.Input}],canShowMenu:[{type:e.Input}],onValidate:[{type:e.Output}],onClose:[{type:e.Output}],onValidateAndClose:[{type:e.Output}],onBackClick:[{type:e.Output}],onSearch:[{type:e.Output}],searchbar:[{type:e.ViewChild,args:["searchbar",{static:!0}]}]};var gi=function(t){function e(e){var n=t.call(this)||this;return n.translate=e,n.itemsPerPageLabel="Items per page",n.nextPageLabel="Next page",n.previousPageLabel="Previous page",n.getRangeLabel=function(t,e,n){var o=this.translate?this.translate.instant("COMMON.PAGINATOR.OF"):"of";if(0===n||0===e)return"0 "+o+" "+n;var r=t*e;return r+1+" - "+(r<(n=Math.max(n,0))?Math.min(r+e,n):r+e)+" "+o+" "+n},n.translate=e,e.onLangChange.subscribe((function(){return n.translateLabels()})),n.translateLabels(),n}return Ee(e,t),e.prototype.translateLabels=function(){this.itemsPerPageLabel=this.translate.instant("COMMON.PAGINATOR.ITEMS_PER_PAGE"),this.nextPageLabel=this.translate.instant("COMMON.PAGINATOR.NEXT_PAGE"),this.previousPageLabel=this.translate.instant("COMMON.PAGINATOR.PREVIOUS_PAGE")},e}(u.MatPaginatorIntl);gi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new gi(jt.ɵɵinject($t.TranslateService))},token:gi,providedIn:"root"}),gi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],gi.ctorParameters=function(){return[{type:F.TranslateService}]};var bi=function(){function t(t){this.progressBarService=t}return t.prototype.intercept=function(t,e){var n=this;return this.progressBarService.increase(),e.handle(t).pipe(N.tap((function(t){t instanceof Q.HttpResponse&&n.progressBarService.decrease()})),N.catchError((function(t,e){throw n.progressBarService.decrease(),t})))},t}();function yi(t){return"#"+Ci(t[0])+Ci(t[1])+Ci(t[2])}function vi(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null}function Ci(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function Ei(t,e,n){n=n?n/100:.5;var o=vi(t);if(!o)throw Error("Invalid hex color:"+t);var r=vi(e);if(!r)throw Error("Invalid hex color:"+e);return yi(o.map((function(t,e){return Math.round(t*n+r[e]*(1-n))})))}function wi(t,e){var n=vi(t);if(!n)throw Error("Invalid hex color:"+t);return!0===e?.299*n[0]+.587*n[1]+.114*n[2]>186?"#000000":"#FFFFFF":yi(n.map((function(t){return 255-t})))}var Ii=function(){},Oi=function(){function t(t,n,o,r){this.translate=t,this.cd=n,this.injector=o,this.formGroupDir=r,this._onChangeCallback=Ii,this._onTouchedCallback=Ii,this.readonly=!1,this.compact=!1,this.floatLabel="auto",this.onKeyupEnter=new e.EventEmitter,this.filterNumberInput=mn,this.selectInputContent=un}return Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition!==t&&(this._definition=t,this.type=null==t?void 0:t.type,this.cd.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){if(!this._definition)throw new Error("Missing mandatory attribute 'definition' in <app-form-field>.");if("object"!=typeof this._definition)throw new Error("Invalid attribute 'definition' in <app-form-field>. Should be an object.");if(!this.type)throw new Error("Invalid attribute 'definition' in <app-form-field>. Missing type !");this.checkAndResolveFormControl(),this.placeholder=this.placeholder||this._definition.label&&this.translate.instant(this._definition.label),this.required=je(this.required,je(this._definition.required,!1)),this.disabled=je(this.disabled,je(this._definition.disabled,!1)),this.updateTabIndex(),"double"===this.type?this.numberInputStep=this.computeNumberInputStep(this._definition):"enum"===this.type&&this._definition.values instanceof e.InjectionToken&&(this._definition.values=this.computeValuesFromToken(this._definition.values))},t.prototype.writeValue=function(t){"integer"!==this.type&&"double"!==this.type||!Number.isNaN(t)?"boolean"===this.type&&"string"==typeof t?t="false"!==t:"date"===this.type?t=io(t):"entity"===this.type&&Te(t)&&(t=null):t=null,t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)),this.cd.markForCheck()},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabled!==t&&(this.disabled=t,this.cd.markForCheck())},t.prototype.markAsTouched=function(){this.formControl.touched&&(this.cd.markForCheck(),this._onTouchedCallback())},t.prototype.filterAlphanumericalInput=function(t){13===t.keyCode&&this.onKeyupEnter.observers.length&&this.onKeyupEnter.emit(t)},t.prototype.focus=function(){this.matInput&&this.matInput.nativeElement.focus()},t.prototype.getDisplayValueFn=function(t){if(t.autocomplete&&t.autocomplete.displayWith)return function(e){return t.autocomplete.displayWith(e)};var e=t.autocomplete&&t.autocomplete.attributes||["label","name"];return function(t){return t&&ze(t,e)}},t.prototype.getColorContrast=function(t){return Pe(t)?wi(t,!0):void 0},t.prototype.computeNumberInputStep=function(t){if(t.maximumNumberDecimals>0){var e="0.";if(t.maximumNumberDecimals>1)for(var n=0;n<t.maximumNumberDecimals-1;n++)e+="0";return e+="1"}return"1"},t.prototype.computeValuesFromToken=function(t){var e=this.injector.get(t);return Array.isArray(e)?e:[]},t.prototype.checkAndResolveFormControl=function(){var t=this;if(!this.formControl){if(this.formGroupDir){!this.formControlName&&this._definition.key&&(this.formControlName=this._definition.key);var e=(this.formGroupDir.directives||[]).find((function(e){return t.formControlName&&e.name===t.formControlName}));this.formControl=e&&e.control,this.formControl||(this.formControl=this.formGroupDir.form.get(this.formControlName))}if(!this.formControl)throw new Error("Missing attribute 'formControl' or 'formControlName' in <app-form-field> component.")}},t.prototype.updateTabIndex=function(){var t=this;this.tabindex&&-1!==this.tabindex&&setTimeout((function(){var e=yn(t.matInput);e&&(e.tabIndex=t.tabindex,t.cd.markForCheck())}))},t}();Oi.decorators=[{type:e.Component,args:[{selector:"app-form-field",template:'<ng-container [ngSwitch]="type">\n\n \x3c!-- integer --\x3e\n <mat-form-field *ngSwitchCase="\'integer\'" [floatLabel]="floatLabel" [class]="classList">\n <input matInput #matInput\n type="number"\n autocomplete="off"\n [readonly]="readonly"\n [min]="definition.minValue"\n [max]="definition.maxValue"\n pattern="-?[0-9]*"\n step="1"\n [appAutofocus]="autofocus"\n [placeholder]="placeholder"\n (keyup.enter)="onKeyupEnter.emit($event)"\n (keypress)="filterNumberInput($event, false)"\n [formControl]="formControl"\n [required]="required"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{(compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\') | translate:formControl.errors[\'min\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors[\'max\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'pattern\')">\n {{\'ERROR.FIELD_NOT_VALID_INTEGER\'| translate }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'integer\')">\n {{\'ERROR.FIELD_NOT_VALID_INTEGER\'| translate }}</mat-error>\n\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- double --\x3e\n <mat-form-field *ngSwitchCase="\'double\'" [floatLabel]="floatLabel" [class]="classList">\n\n <input matInput #matInput\n type="number"\n decimal="true"\n autocomplete="off"\n [min]="definition.minValue"\n [max]="definition.maxValue"\n [appAutofocus]="autofocus"\n [readonly]="readonly"\n [placeholder]="placeholder"\n [step]="numberInputStep"\n (keypress)="filterNumberInput($event, true)"\n [formControl]="formControl"\n [required]="required"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{ (compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\')| translate:formControl.errors[\'min\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors[\'max\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'maxDecimals\')">\n {{ (compact ? \'ERROR.FIELD_MAXIMUM_DECIMALS_COMPACT\' : \'ERROR.FIELD_MAXIMUM_DECIMALS\')| translate:{max:\n definition.maximumNumberDecimals} }}</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- boolean --\x3e\n <mat-boolean-field *ngSwitchCase="\'boolean\'" #matInput\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [compact]="compact"\n [tabindex]="tabindex"\n [readonly]="readonly">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-boolean-field>\n\n \x3c!-- date --\x3e\n <mat-date-field *ngSwitchCase="\'date\'" #matInput\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="compact ? (\'COMMON.DATE_PLACEHOLDER\'|translate): placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [readonly]="readonly"\n [compact]="compact"\n [tabindex]="tabindex"\n [autofocus]="autofocus">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-date-field>\n\n \x3c!-- date time --\x3e\n <mat-date-time-field *ngSwitchCase="\'dateTime\'"\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="compact ? (\'COMMON.DATE_TIME_PLACEHOLDER\'|translate): placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [readonly]="readonly"\n [compact]="compact"\n [tabindex]="tabindex"\n [autofocus]="autofocus">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-date-time-field>\n\n \x3c!-- enum --\x3e\n <mat-form-field *ngSwitchCase="\'enum\'" [floatLabel]="floatLabel" [class]="classList">\n <mat-select [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required"\n [tabindex]="tabindex"\n (keyup.enter)="onKeyupEnter.emit($event)">\n <mat-option *ngFor="let item of definition.values" [value]="item.key || item">{{ (item.value || item) | translate }}</mat-option>\n </mat-select>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- color --\x3e\n <mat-form-field *ngSwitchCase="\'color\'" [floatLabel]="floatLabel" [class]="classList">\n\n <ion-icon margin-right name="color-fill" matPrefix></ion-icon>\n\n <input matInput autocomplete="off"\n [appAutofocus]="autofocus"\n [formControl]="formControl"\n [style.color]="getColorContrast(formControl.value)"\n [style.background]="formControl.value"\n [colorPicker]="formControl.value"\n (colorPickerChange)="writeValue($event)"\n [cpSaveClickOutside]="true"\n cpPosition="top"\n cpOutputFormat="hex"\n [cpOKButton]="false"\n [required]="required"/>\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- string --\x3e\n <mat-form-field *ngSwitchCase="\'string\'" [floatLabel]="floatLabel" [class]="classList">\n <input matInput #matInput\n autocomplete="off"\n [appAutofocus]="autofocus"\n [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required"\n [readonly]="readonly"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)"\n (keypress)="filterAlphanumericalInput($event)"\n (keyup.enter)="onKeyupEnter.emit($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- auto-complete --\x3e\n <mat-autocomplete-field *ngSwitchCase="\'entity\'"\n [class]="classList"\n [autofocus]="autofocus"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [formControl]="formControl"\n [config]="definition.autocomplete"\n [required]="required"\n [displayWith]="getDisplayValueFn(definition)">\n <ng-content select="[matPrefix]"></ng-content>\n <ng-content select="[matSuffix]"></ng-content>\n </mat-autocomplete-field>\n\n \x3c!-- multi auto-complete --\x3e\n <mat-chips-field *ngSwitchCase="\'entities\'"\n [class]="classList"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [formControl]="formControl"\n [config]="definition.autocomplete"\n [required]="required"\n [displayWith]="getDisplayValueFn(definition)">\n <ng-content select="[matPrefix]"></ng-content>\n <ng-content select="[matSuffix]"></ng-content>\n </mat-chips-field>\n\n \x3c!-- other --\x3e\n <div *ngSwitchDefault>\n <mat-error *ngIf="type">Unknown type {{type}} for option {{definition.key}}. Please report this error.</mat-error>\n <mat-error *ngIf="!type">Error on option field. Please check console log for details.</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </div>\n\n</ng-container>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Oi})),multi:!0}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;position:relative}"]}]}],Oi.ctorParameters=function(){return[{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:e.Injector},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Oi.propDecorators={definition:[{type:e.Input}],required:[{type:e.Input}],readonly:[{type:e.Input}],disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],compact:[{type:e.Input}],floatLabel:[{type:e.Input}],tabindex:[{type:e.Input}],autofocus:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],onKeyupEnter:[{type:e.Output,args:["keyup.enter"]}],matInput:[{type:e.ViewChild,args:["matInput"]}]};var _i=function(){function t(t){this.onStart=new D.Subject,this._debug=!1,this._startByReadyFunction=!0,this._data=null,this._started=!1,this._startPromise=null,this._startPrerequisite=null,this._subscription=null,this._startPrerequisite=t?function(){return t.ready()}:function(){return Promise.resolve()}}return t.prototype.start=function(){var t=this;return this._startPromise?this._startPromise:this._started?Promise.resolve(this._data):(this._startPromise=this._startPrerequisite().then((function(){return t.ngOnStart()})).then((function(e){return t._data=e,t._started=!0,t._startPromise=void 0,t.onStart.next(t._data),t._data})).catch((function(e){return console.error("Failed to start a service: "+(e&&e.message||e),e),t._started=!1,t._startPromise=null,null})),this._startPromise)},t.prototype.stop=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this._subscription&&(this._subscription.unsubscribe(),this._subscription=null),[4,this.ngOnStop()];case 1:return e.sent(),this._started=!1,this._startPromise=void 0,[3,3];case 2:return t=e.sent(),console.error("Failed to stop a service: "+(t&&t.message||t),t),[3,3];case 3:return[2]}}))}))},t.prototype.restart=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this._startPromise?[4,this._startPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._started?[4,this.stop()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2,this.start()]}}))}))},Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"starting",{get:function(){return!!this._startPromise},enumerable:!1,configurable:!0}),t.prototype.ready=function(){var t=this;return this._started?Promise.resolve(this._data):this._startPromise?this._startPromise:this._startByReadyFunction?this.start():kn((function(){return t._started})).then((function(){return t._data}))},t.prototype.registerSubscription=function(t){return this._subscription=this._subscription||new D.Subscription,this._subscription.add(t)},t.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},t}();_i.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional}]}]};var xi=[{id:"beep-confirm",assetPath:"assets/audio/beep-confirm.mp3",vibration:250},{id:"beep-error",assetPath:"assets/audio/beep-error.mp3",vibration:1e3},{id:"startup",assetPath:"assets/audio/unfa-ping.mp3",vibration:[1,500,250,750]}],ki=function(t){function e(e,n,o,r){var i=t.call(this,e)||this;return i.platform=e,i.nativeAudio=n,i.vibration=o,i.audioManagement=r,i._audioMode=Z.AudioManagement.AudioMode.NORMAL,i._preloadedSounds={},i._htmlAudioCache={},i.start(),i}return Ee(e,t),e.prototype.playBeepConfirm=function(){return this.play("beep-confirm",{vibrate:this._audioMode===Z.AudioManagement.AudioMode.VIBRATE})},e.prototype.playBeepError=function(){return this.play("beep-error",{vibrate:!0})},e.prototype.playStartupSound=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.play("startup")]}))}))},e.prototype.preload=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return Ae(this._audioType)?[4,this.ready()]:[3,2];case 1:n.sent(),n.label=2;case 2:if("native"!==this._audioType)return[3,7];console.info("[audio] Preloading audio file '"+t.assetPath+"'..."),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,this.nativeAudio.preloadSimple(t.id,t.assetPath)];case 4:return n.sent(),console.info("[audio] Preloading audio file '"+t.assetPath+"' [OK]"),[3,6];case 5:return e=n.sent(),console.error("[audio] Unable to preload audio file '"+t.assetPath+"': "+(e&&e.message||e),e),[3,6];case 6:return[3,8];case 7:this._htmlAudioCache[t.id]=new Audio(t.assetPath),n.label=8;case 8:return this._preloadedSounds[t.id]=t,[2]}}))}))},e.prototype.play=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:i.sent(),i.label=2;case 2:if(!(n=this._preloadedSounds[t]))throw Error("Unable to find audio with id: "+t+". Please call preload() before playing a sound.");return this._audioMode===Z.AudioManagement.AudioMode.SILENT?[2]:(o=[],this._audioMode===Z.AudioManagement.AudioMode.NORMAL?"native"===this._audioType?o.push(this.nativeAudio.play(n.id)):(r=this._htmlAudioCache[t]||new Audio(n.assetPath),o.push(r.play())):Ae(n.vibration)&&Ae(e&&e.vibrate)&&((e=e||{}).vibrate=!0),je(e&&e.vibrate,!!n.vibration)&&o.push(this.vibrate(e&&e.vibrationTimes||n.vibration)),[2,(1===o.length?o[0]:Promise.all(o)).catch((function(e){console.error("[audio] Error while playing audio sound '"+t+"': "+(e&&e.message||e),e)}))])}}))}))},e.prototype.unload=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return Ae(this._audioType)?[4,this.ready()]:[3,2];case 1:n.sent(),n.label=2;case 2:if(this._preloadedSounds[t]=void 0,"native"!==this._audioType)return[3,7];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,this.nativeAudio.unload(t)];case 4:return n.sent(),[3,6];case 5:return e=n.sent(),console.error("[audio] Unable to unload audio '"+t+"': "+(e&&e.message||e),e),[3,6];case 6:return[3,8];case 7:this._htmlAudioCache[t].remove(),this._htmlAudioCache[t]=void 0,n.label=8;case 8:return[2]}}))}))},e.prototype.vibrate=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:e.sent(),e.label=2;case 2:return this.vibration?(this.vibration.vibrate(t||250),[2]):[2]}}))}))},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return t=this.platform.is("cordova"),this._audioType=t&&this.nativeAudio?"native":"html5",console.info("[audio] Starting audio provider {"+this._audioType+"}..."),t&&this.audioManagement?[4,this.readAudioMode()]:[3,2];case 1:n.sent(),n.label=2;case 2:return console.debug("[audio] Preloading audio sounds..."),[4,Promise.all(xi.map((function(n){return t||(n.vibration=void 0),e.preload(n)})))];case 3:return n.sent(),[2]}}))}))},e.prototype.readAudioMode=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return[4,this.audioManagement.getAudioMode()];case 1:return t=e.sent(),this._audioMode=t&&t.audioMode||Z.AudioManagement.AudioMode.NORMAL,console.debug("[audio] Detected device audio mode {"+t.label+"} ("+this._audioMode+")"),[2]}}))}))},e}(_i);ki.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ki(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Yt.NativeAudio,8),jt.ɵɵinject(Xt.Vibration,8),jt.ɵɵinject(Jt.AudioManagement,8))},token:ki,providedIn:"root"}),ki.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ki.ctorParameters=function(){return[{type:M.Platform},{type:X.NativeAudio,decorators:[{type:e.Optional}]},{type:J.Vibration,decorators:[{type:e.Optional}]},{type:Z.AudioManagement,decorators:[{type:e.Optional}]}]};var Si=function(){function t(t){this.data=t,this.hotkeys=Array.from(this.data)}return t.prototype.ngOnInit=function(){},t}();Si.decorators=[{type:e.Component,args:[{template:'<table>\n <tbody>\n <tr *ngFor="let keys of hotkeys">\n <td>{{ keys[1] | translate }}</td>\n\n <td class="text-right">\n <kbd>{{ keys[0] }}</kbd>\n </td>\n </tr>\n </tbody>\n</table>\n',styles:[":host table{border-collapse:collapse;width:100%;margin-bottom:1rem;color:#212529}:host th{font-weight:500;text-align:left;vertical-align:bottom;padding:.75rem;border-bottom:2px solid #dee2e6}:host td,:host th{border-top:1px solid #dee2e6}:host td{vertical-align:top;padding:.75rem .75rem .75rem 0}:host kbd{margin-right:6px;background-color:#fafbfc;border:1px solid #d1d5da;border-bottom-color:#c6cbd1;border-radius:3px;box-shadow:inset 0 -1px 0 #c6cbd1;color:#444d56;display:inline-block;font-size:12px;line-height:10px;padding:3px 5px;vertical-align:middle}"]}]}],Si.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[T.MAT_DIALOG_DATA]}]}]};var Ai=function(){function t(t,e,n,o){var r=this;this.eventManager=t,this.dialog=e,this.document=n,this.modalController=o,this._debug=!1,this._hotkeys=new Map,this._defaults={element:this.document,preventDefault:!0},this._debug&&console.debug("[hotkeys] Starting hotkeys service... Press Shift+? to get help modal."),this.addShortcut({keys:"shift.?"}).subscribe((function(){return r.openHelpModal()}))}return t.prototype.addShortcut=function(t){var e=this,n=Object.assign(Object.assign({},this._defaults),t),o="keydown."+n.keys;return Pe(n.description)?(this._debug&&console.debug("[hotkeys] Add shortcut {"+t.keys+"}: "+n.description),this._hotkeys.set(n.keys,n.description)):this._debug&&console.debug("[hotkeys] Add shortcut {"+t.keys+"}"),new D.Observable((function(r){var i=e.eventManager.addEventListener(n.element,o,(function(o){return Ie(e,void 0,void 0,(function(){var e;return Oe(this,(function(i){switch(i.label){case 0:return[4,this.modalController.getTop()];case 1:return(e=i.sent())&&e.component.name!==n.elementName||(o instanceof KeyboardEvent&&o.repeat||(n.preventDefault&&o.preventDefault(),this._debug&&console.debug("[hotkeys] Shortcut {"+t.keys+"} detected..."),r.next(o))),[2]}}))}))}));return function(){i(),e._hotkeys.delete(n.keys)}}))},t.prototype.openHelpModal=function(){this.dialog.open(Si,{width:"500px",data:this._hotkeys})},t}();Ai.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ai(jt.ɵɵinject(Kt.EventManager),jt.ɵɵinject(Vt.MatDialog),jt.ɵɵinject(Bt.DOCUMENT),jt.ɵɵinject(Gt.ModalController))},token:Ai,providedIn:"root"}),Ai.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ai.ctorParameters=function(){return[{type:K.EventManager},{type:T.MatDialog},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:M.ModalController}]};var Ti=function(){};Ti.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.MatCommonModule,T.MatDialogModule,F.TranslateModule.forChild()],exports:[Si],declarations:[Si],providers:[Ai]}]}];var Ri=480,Pi=640,Di=200,Ni=200,Fi=function(){function t(){}return t.prototype.readFromBlob=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!t)throw new Error("Illegal argument: missing file");return[4,new Promise((function(e,n){var o=new FileReader;o.addEventListener("load",(function(t){return e(o.result)}),!1),o.readAsDataURL(t)}))];case 1:return[2,e.sent()]}}))}))},t.prototype.readAndResizeFromUrl=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(Te(t))throw new Error("Illegal argument: missing path");(n=document.createElement("img")).crossOrigin="anonymous",r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,new Promise((function(r,i){n.addEventListener("load",o.createImageOnLoadResizeFn(r,i,e),!1),n.addEventListener("error",i),n.src=t}))];case 2:return[2,r.sent()];case 3:throw r.sent(),new Error("Failed to load and resize image {"+t+"}");case 4:return n.remove(),[7];case 5:return[2]}}))}))},t.prototype.readAndResizeFromBlob=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!t)throw new Error("Illegal argument: missing file");(n=document.createElement("img")).crossOrigin="anonymous",r.label=1;case 1:return r.trys.push([1,,3,4]),[4,new Promise((function(r,i){var a=new FileReader;a.addEventListener("load",(function(t){n.onload=o.createImageOnLoadResizeFn(r,i,e),n.src=a.result}),!1),a.readAsDataURL(t)}))];case 2:return[2,r.sent()];case 3:return n.remove(),[7];case 4:return[2]}}))}))},t.prototype.createImageOnLoadResizeFn=function(t,e,n){return function(o){var r,i=n&&n.thumbnail?Ni:n&&n.maxWidth||Pi,a=n&&n.thumbnail?Di:n&&n.maxHeight||Ri,s=o.target.width,l=o.target.height,c=document.createElement("canvas");try{if(n&&n.thumbnail){s>l?(s*=a/l,l=a):(l*=i/s,s=i),c.width=i,c.height=a,r=c.getContext("2d");var u=Math.trunc((i-s)/2+.5),d=Math.trunc((a-l)/2+.5);r.drawImage(o.target,u,d,i+-2*u,a+-2*d)}else s>l?s>i&&(l*=i/s,s=i):l>a&&(s*=a/l,l=a),c.width=s,c.height=l,(r=c.getContext("2d")).drawImage(o.target,0,0,c.width,c.height);var p=c.toDataURL();t(p)}catch(t){e(t)}finally{c.remove()}}},t}(),Mi=Zt,Li=function(){function t(t,e,n){var o=this;this.platform=t,this.http=e,this.environment=n,this._started=!1,this._debug=!n.production,t.ready().then((function(){return o.start()}))}return Object.defineProperty(t.prototype,"canUseFileSystem",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.getImages=function(t,e){var n=this;if(!this._started)throw new Error("Platform must be started first!");return xn((t||[]).map((function(t){return function(){return n.getImage(t,Object.assign({},e))}})))},t.prototype.getImage=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:if(n=e&&e.responseType||(this.canUseFileSystem?"file":"dataUrl"),o=this._debug,r=o&&Date.now(),o&&console.debug("[file] Fetching image {"+t+"} into "+n+"..."),-1===(i=t.lastIndexOf("/")))throw new Error("Invalid URL: "+t);if(a=i<t.length-1&&t.substring(i+1)||Mi(),"file"!==n||!this.canUseFileSystem)return[3,4];console.warn("WARN: [file] Fetching image {"+t+"} in local file..."),s=this._imageDirectory+a,d.label=1;case 1:return d.trys.push([1,3,,4]),[4,_n(this.http.get(t,{observe:"body",responseType:"blob",reportProgress:!1}))];case 2:return l=d.sent(),console.debug("[file] Getting blob :"+l.type),o&&console.debug("[file] Fetching image {"+t+"} into "+n+" [OK] in "+(Date.now()-r)+"ms"),[2,s];case 3:return c=d.sent(),console.error("[file] Error while download "+t+": "+(c&&c.message||c)),n="dataUrl",[3,4];case 4:return"dataUrl"!==n?[3,6]:[4,(new Fi).readAndResizeFromUrl(t,e)];case 5:return u=d.sent(),o&&console.debug("[file] Fetching image {"+t+"} into "+n+" [OK] in "+(Date.now()-r)+"ms"),[2,u];case 6:return[2,t]}}))}))},t.prototype.start=function(){this.canUseFileSystem,this._started=!0},t}();Li.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Li(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Qt.HttpClient),jt.ɵɵinject(me))},token:Li,providedIn:"root"}),Li.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[M.Platform,Q.HttpClient]}]}],Li.ctorParameters=function(){return[{type:M.Platform},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var ji=function(){function t(t){this.hotkeys=t,this._subscription=new D.Subscription,this.modalName="modal-toolbar",this.title="",this.color="primary",this.showSpinner=!1,this.validateIcon={icon:"checkmark"},this.cancel=new e.EventEmitter,this.validate=new e.EventEmitter}return t.prototype.ngOnInit=function(){var t=this;this.canValidate=je(this.canValidate,this.validate.observers.length>0),this._subscription.add(this.hotkeys.addShortcut({keys:"control.s",description:"COMMON.BTN_VALIDATE",elementName:this.modalName}).pipe(N.filter((function(){return t.canValidate}))).subscribe((function(e){return t.validate.emit(e)}))),this._subscription.add(this.hotkeys.addShortcut({keys:"escape",description:"COMMON.BTN_CLOSE",elementName:this.modalName}).subscribe((function(e){return t.cancel.emit(e)})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t}();ji.decorators=[{type:e.Component,args:[{selector:"app-modal-toolbar",template:'<ion-header>\n <ion-toolbar [color]="color">\n <ion-buttons slot="start">\n <ion-button visible-xs visible-sm visible-mobile\n (click)="cancel.emit()">\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n\n <ng-content select="[slot=start]"></ng-content>\n </ion-buttons>\n\n <ion-title [innerHTML]="title"></ion-title>\n\n <ng-content select="ion-title"></ng-content>\n\n <ng-content select="ion-buttons[slot=end]"></ng-content>\n\n <ion-buttons slot="end">\n\n <ng-content select="ion-button[slot=end]"></ng-content>\n\n <ion-spinner *ngIf="showSpinner"></ion-spinner>\n\n <ion-button visible-xs visible-sm visible-mobile\n *ngIf="canValidate"\n (click)="validate.emit($event)">\n <ion-icon slot="icon-only" *ngIf="validateIcon?.icon" [name]="validateIcon.icon"></ion-icon>\n <mat-icon slot="icon-only" *ngIf="validateIcon?.matIcon" >{{validateIcon.matIcon}}</mat-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],ji.ctorParameters=function(){return[{type:Ai}]},ji.propDecorators={modalName:[{type:e.Input}],title:[{type:e.Input}],color:[{type:e.Input}],showSpinner:[{type:e.Input}],canValidate:[{type:e.Input}],validateIcon:[{type:e.Input}],cancel:[{type:e.Output}],validate:[{type:e.Output}]};var Bi=function(){this.loading=!1,this.color="secondary"};Bi.decorators=[{type:e.Component,args:[{selector:"app-loading-spinner",template:'\n <ion-spinner *ngIf="loading; else content" [color]="color" [name]="name"></ion-spinner>\n <ng-template #content>\n <ng-content></ng-content>\n </ng-template>\n '}]}],Bi.propDecorators={loading:[{type:e.Input}],color:[{type:e.Input}],name:[{type:e.Input}]};var Ui=function(){function t(){}return t.getAlphabetMap=function(){if(!t.alphabetMap){this.alphabetMap={};for(var e=0;e<t.alphabet.length;e++)t.alphabetMap[t.alphabet.charAt(e)]=e}return t.alphabetMap},t.encode=function(e){if(0===e.length)return"";var n,o,r=[0];for(n=0;n<e.length;n++){for(o=0;o<r.length;o++)r[o]<<=8;r[r.length-1]+=e[n];var i=0;for(o=r.length-1;o>=0;o--)r[o]+=i,i=r[o]/58|0,r[o]%=58;for(;i;)r.unshift(i),i=r[0]/58|0,r[0]%=58}for(n=0;n<e.length-1&&0===e[n];n++)r.unshift(0);return r.map((function(e){return t.alphabet[e]})).join("")},t.decode=function(e){if(0===e.length)return new Uint8Array;var n,o,r=e.split("").map((function(e){return t.getAlphabetMap()[e]})),i=[0];for(n=0;n<r.length;n++){for(o=0;o<i.length;o++)i[o]*=58;i[i.length-1]+=r[n];var a=0;for(o=i.length-1;o>=0;o--)i[o]+=a,a=i[o]>>8,i[o]&=255;for(;a;)i.unshift(a),a=i[0]>>8,i[0]&=255}for(n=0;n<r.length-1&&0===r[n];n++)i.unshift(0);return new Uint8Array(i)},t}();Ui.alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Vi=require("scrypt-async"),qi=require("hash.js/lib/hash/sha/256"),$i=require("hash.js/lib/hash/sha/512"),Gi={sign:at.sign,box:at.box,hash:at.hash,verify:at.verify,util:require("tweetnacl-util"),constants:{crypto_sign_BYTES:64,SEED_LENGTH:32,SCRYPT_PARAMS:{SIMPLE:{N:2048,r:8,p:1,memory:-1},DEFAULT:{N:4096,r:16,p:1,memory:-1},SECURE:{N:16384,r:32,p:2,memory:-1},HARDEST:{N:65536,r:32,p:4,memory:-1},EXTREME:{N:262144,r:64,p:8,memory:-1}}}},Hi=function(){function t(){}return t.prototype.scryptKeypair=function(t,e,n){return new Promise((function(o){Vi(e,t,{N:n&&n.N||Gi.constants.SCRYPT_PARAMS.DEFAULT.N,r:n&&n.r||Gi.constants.SCRYPT_PARAMS.DEFAULT.r,p:n&&n.p||Gi.constants.SCRYPT_PARAMS.DEFAULT.p,dkLen:Gi.constants.SEED_LENGTH,encoding:"base64"},(function(t){o(t)}))})).then((function(t){var e=Gi.util.decodeBase64(t),n=Gi.sign.keyPair.fromSeed(e);return{publicKey:n.publicKey,secretKey:n.secretKey}}))},t.prototype.sign=function(t,e){return new Promise((function(n){for(var o=Gi.util.decodeUTF8(t),r=Gi.sign(o,e.secretKey),i=new Uint8Array(Gi.constants.crypto_sign_BYTES),a=0;a<i.length;a++)i[a]=r[a];n(Gi.util.encodeBase64(i))}))},t.prototype.verify=function(t,e,n){return new Promise((function(o){var r=Gi.util.decodeUTF8(t),i=Gi.util.decodeBase64(e),a=Ui.decode(n);o(Gi.sign.detached.verify(r,i,a))}))},t.prototype.sha256=function(t){return qi().update(t).digest("hex")},t.prototype.sha512=function(t){return $i().update(t).digest("hex")},t.prototype.encodeBase64=function(t){var e=Gi.util.decodeUTF8(t);return Gi.util.encodeBase64(e)},t}();Hi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Hi},token:Hi,providedIn:"root"}),Hi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Wi=function(){function t(t){this.id=null,this.updateDate=null,this.__typename=t||null}return t.prototype.clone=function(t){var e=new this.constructor;return this.copy(e,t),e},t.prototype.copy=function(t,e){t.fromObject(this.asObject(e),e)},t.prototype.asObject=function(t){var e=Object.assign({},this);return t&&!0===t.keepTypename||delete e.__typename,(null==e.id||t&&!1===t.keepLocalId&&e.id<0)&&delete e.id,e.updateDate=io(this.updateDate),e},t.prototype.fromObject=function(t,e){this.id=t.id||0===t.id?t.id:void 0,this.updateDate=ao(t.updateDate),this.__typename=t.__typename||this.__typename},t.prototype.equals=function(t){return t&&this.id===t.id},t}();function zi(t,e){return!!t&&t instanceof e}var Ki,Qi=function(){function t(){}return t.isNotEmpty=function(t,e){return!!t&&null!==t[e]&&void 0!==t[e]},t.isEmpty=function(t,e){return!t||null===t[e]||void 0===t[e]},t.equals=function(t,e,n){return n=n||"id",t===e||Ae(t)&&Ae(e)||t&&e&&t[n]===e[n]},t.getPropertyByPath=function(e,n){if(!Ae(e)){var o=n.indexOf(".");if(-1===o)return e[n];var r=n.substring(0,o);if(!Ae(e[r])){if(e[r]&&"object"==typeof e[r])return t.getPropertyByPath(e[r],n.substring(o+1));throw new Error("Invalid form path: '"+r+"' is not an valid object.")}}},t.getArrayAsMap=function(t){return(t||[]).reduce((function(t,e){return t[e.key]=e.value,t}),{})},t.getMapAsArray=function(t){return Array.isArray(t)?t:Object.getOwnPropertyNames(t||{}).map((function(e){return{key:e,value:t[e]}}))},t.getPropertyArrayAsObject=function(t){return(t||[]).reduce((function(t,e){return t[e.key]=e.value,t}),{})},t.copyIdAndUpdateDate=function(t,e){t&&(e.id=Re(t.id)?t.id:e.id,e.updateDate=ao(t.updateDate)||e.updateDate,t.creationDate&&(e.creationDate=ao(t.creationDate)))},t.fillLocalIds=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return Fe(n=(t||[]).filter((function(t){return Ae(t.id)||0===t.id})))?[2]:[4,e(n[0],n.length)];case 1:return o=r.sent()+1,o=t.filter((function(t){return Re(t.id)&&t.id<0})).reduce((function(t,e){return Math.min(t,e.id)}),o),n.forEach((function(t){return t.id=--o})),[2]}}))}))},t.cleanIdAndUpdateDate=function(t){t&&(t.id=null,t.updateDate=null)},t.cleanIdsAndUpdateDates=function(e){(e||[]).forEach(t.cleanIdAndUpdateDate)},t.sort=function(t,e,n){return t.sort(this.sortComparator(e,n))},t.sortComparator=function(e,n){var o=n&&"asc"!==n?-1:1,r=e||"id";return function(e,n){var i=t.getPropertyByPath(e,r),a=t.getPropertyByPath(n,r);return t.compare(i,a,o)}},t.compare=function(e,n,o,r){return r=r||"id",t.isNotEmpty(e,r)&&t.isNotEmpty(n,r)?t.equals(e,n,r)?0:e[r]>n[r]?o:-1*o:e===n?0:e>n?o:-1*o},t.compareValue=function(t,e,n){return t===e?0:t>e?n:-1*n},t.filter=function(t,e,n){var o=this.searchTextFilter(e,n);return t.filter(o)},t.searchTextFilter=function(e,n){if(!Te(e)&&!Te(n)){var o=n.replace(/[.]/g,"[.]").replace(/[*]+/g,".*");if(".*"!==o){var r="^"+o,i="^.*"+o;if("string"==typeof e){var a=!e||-1===e.indexOf("."),s=e.toLowerCase().endsWith("label")||e.toLowerCase().endsWith("code"),l=new RegExp(s&&r||i,"i");return a?function(t){return l.test(t[e])}:function(n){return l.test(t.getPropertyByPath(n,e))}}var c=e.map((function(t){var e=t.toLowerCase().endsWith("label")||t.toLowerCase().endsWith("code");return new RegExp(e&&r||i,"i")}));return function(n){return-1!==e.findIndex((function(e,o){return c[o].test(t.getPropertyByPath(n,e))}))}}}},t.treeToArray=function(t){var e=this;return t?(t.children||[]).reduce((function(n,o){return o.parent=t,n.concat(e.treeToArray(o))}),[t]):null},t.listOfTreeToArray=function(t){var e=this;return t&&t.length?t.reduce((function(t,n){return t.concat(e.treeToArray(n))}),[]):null},t.treeFillParent=function(t){var e=this;if(!t)return null;(t.children||[]).forEach((function(n){n.parent=t,e.treeFillParent(n)}))},t.isLocal=function(t){return t&&Re(t.id)&&+t.id<0},t.isRemote=function(e){return e&&!t.isLocal(e)},t.isLocalId=function(t){return Re(t)&&+t<0},t}(),Yi=Object.freeze({name:"@sumaris-net/ngx-components",version:void 0,production:!0,baseUrl:"/",defaultLocale:"fr",defaultLatLongFormat:"DDMM",apolloFetchPolicy:"cache-first",listenRemoteChanges:!1,persistCache:!1,peerMinVersion:"1.8.0",defaultPeers:[{host:"localhost",port:8080},{host:"localhost",port:8081},{host:"192.168.0.45",port:8080},{host:"192.168.0.24",port:8080},{host:"192.168.0.29",port:8080},{host:"sih.sfa.sc",port:80},{host:"test.sumaris.net",port:443}],defaultAppName:"SUMARiS",defaultAndroidInstallUrl:"https://play.google.com/store/apps/details?id=net.sumaris.app",storage:{driverOrder:["sqlite","indexeddb","websql","localstorage"]},sourceUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/ngx-sumaris-components",reportIssueUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/ngx-sumaris-components/-/issues",forumUrl:"https://forum.sumaris.net",helpUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/blob/master/user-manual/index_fr.md",defaultAuthValues:{username:"admin@sumaris.net",password:"admin"}}),Xi=function(){function t(){}return t.register=function(e,n){var o=$e(e,"VO");t.CLASSES_BY_NAME.set(o,n)},t.get=function(e){var n=t.CLASSES_BY_NAME.get(e);if(!n)throw new Error("Cannot found entity class '"+e+"'. Make sure it exists and has the @EntityClass decorator.");return n},t.fromObject=function(e,n){if(!e)return e;var o=n&&n.entityName||$e(e.__typename||(null==n?void 0:n.typename),"VO");if(!o)throw new Error("Missing one of 'value.__typename', 'opts.entityName', or 'opts.typename'.");var r=t.get(o);if("function"!=typeof r.fromObject)throw new Error("Cannot found the static function '"+o+".fromObject()'. Make sure this function has been declared and the entity class has the @EntityClass decorator");return r.fromObject(e,n)},t}();function Ji(t){return t=Object.assign({fromObjectReuseStrategy:"default"},t),function(e){var n,o;if(!Yi.production&&!(new e instanceof Wi))throw new Error("Class "+e.name+" must extends <<Entity>> to be able to use @FromObject!");var r=t.typename||e.name+"VO";if("clone"===t.fromObjectReuseStrategy){var i=(n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.fromObject=function(t,e){if(t){if(t instanceof i)return t.clone(e);var n=new i;return n.fromObject(t,e),n}},e.asObject=function(t,e){if(t)return t instanceof i?t.asObject(e):Object.assign({},t)},e}(e),n.TYPENAME=r,n);return Xi.register(r,i),i}var a=(o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.fromObject=function(t,e){if(t){if(t instanceof a)return t;var n=new a;return n.fromObject(t,e),n}},e.asObject=function(t,e){if(t)return t instanceof a?t.asObject(e):t},e}(e),o.TYPENAME=r,o);return Xi.register(r,a),a}}Xi.CLASSES_BY_NAME=new Map,t.Peer=Ki=function(t){function e(){return t.call(this,Ki.TYPENAME)||this}return Ee(e,t),e.parseUrl=function(t){var e=new URL(t);return Ki.fromObject({dns:e.hostname,port:Te(e.port)?void 0:e.port,useSsl:e.protocol&&(e.protocol.startsWith("https")||e.protocol.startsWith("wss")),path:qe(e.pathname)})},e.path=function(t){for(var e,n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(!t)throw new Error("Missing required argument 'peer'!");return n=(n||[]).map((function(t){return t.startsWith("./")?t.substring(2):t.startsWith("/")?t.substring(1):t})).filter(Pe),(e=[qe(Ki.fromObject(t).url)]).concat.apply(e,ke(n)).join("/")},e.prototype.asObject=function(e){return t.prototype.asObject.call(this,e)},e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.dns=e.dns||e.host,this.ipv4=e.ipv4,this.ipv6=e.ipv6,this.port=Re(e.port)?+e.port:void 0,this.pubkey=e.pubkey,this.useSsl=e.useSsl||443===this.port,this.path=e.path||""},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.pubkey===e.pubkey&&this.url===e.url},Object.defineProperty(e.prototype,"url",{get:function(){return(this.useSsl?"https://":"http://")+this.hostAndPort+(this.path||"")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAndPort",{get:function(){return(this.dns||this.ipv4||this.ipv6)+(this.port&&80!==this.port&&443!==this.port?":"+this.port:"")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reachable",{get:function(){return this.status&&"UP"===this.status},enumerable:!1,configurable:!0}),e}(Wi),t.Peer=Ki=we([Ji({typename:"PeerVO"})],t.Peer);var Zi=$.trigger("fadeInAnimation",[$.transition(":enter",[$.style({opacity:0}),$.animate(".3s",$.style({opacity:1}))])]),ta=$.trigger("fadeInOutAnimation",[$.transition(":enter",[$.style({opacity:0}),$.animate(".3s",$.style({opacity:1}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({opacity:0}))])]),ea=$.trigger("slideInOutAnimation",[$.state("*",$.style({position:"relative",top:0,left:0,right:0,bottom:0,opacity:1})),$.transition(":enter",[$.style({left:"400%",opacity:0}),$.animate(".3s ease-in-out",$.style({left:0,opacity:.8}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({left:"400%",opacity:0}))])]),na=$.trigger("slideUpDownAnimation",[$.state("*",$.style({transform:"translateY(0)",opacity:1})),$.transition(":enter",[$.style({transform:"translateY(-400%)",opacity:0}),$.animate(".3s ease-in-out",$.style({transform:"translateY(0)",opacity:1}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({transform:"translateY(-100%)",opacity:0}))])]),oa=function(){function t(){}return t.getResource=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:n=Object.assign({},n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,n).toPromise()];case 2:return[2,r.sent()];case 3:throw(o=r.sent())&&o.message?console.error("[network] Error on get request "+e+": "+o.message,o):console.error("[network] Error on get request "+e+": "+(o&&o.statusText)+" - "+JSON.stringify(o)),{code:o.status,message:"ERROR.UNKNOWN_NETWORK_ERROR"};case 4:return[2]}}))}))},t}(),ra=function(){};ra.getNodeInfo=function(e,n,o){return Ie(this,void 0,void 0,(function(){var r;return Oe(this,(function(i){if(!n)throw Error("Missing argument 'peer'.");return(r=n instanceof t.Peer?n.url:n).endsWith("/")&&(r=r.substr(0,r.length-1)),[2,oa.getResource(e,r+"/api/node/info",o)]}))}))};var ia={POSITIVE_INTEGER:/^\d+$/,VERSION_PART_REGEXP:/^[0-9]+|alpha[0-9]+|beta[0-9]+|rc[0-9]+|[0-9]+-SNAPSHOT$/},aa=function(){};function sa(t,e){var n=t.split("."),o=e.split(".");if(!la(n)||!la(o))return NaN;for(var r=0;r<n.length;++r){if(o.length===r)return 1;if(n[r]!==o[r])return n[r]>o[r]?1:-1}return n.length!=o.length?-1:0}function la(t){for(var e=0;e<t.length;e++){var n=ia.POSITIVE_INTEGER.test(t[e]);if(0===e&&!n)return!1;if(!n){if(!ia.VERSION_PART_REGEXP.test(t[e]))return!1;t[e]=t[e].replace("-SNAPSHOT",""),n=ia.POSITIVE_INTEGER.test(t[e])}n&&(t[e]=parseInt(t[e]))}return!0}aa.compare=sa,aa.isCompatible=function(t,e){return sa(t,e)<=0};var ca=function(){function t(t,n,o,r){this.viewCtrl=t,this.cd=n,this.http=o,this.environment=r,this._subscription=new D.Subscription,this.loading=!0,this.$peers=new D.Subject,this.peerMinVersion=this.environment.peerMinVersion,this.canCancel=!0,this.allowSelectDownPeer=!0,this.onRefresh=new e.EventEmitter}return Object.defineProperty(t.prototype,"peers",{set:function(t){var e=this;this._subscription.add(t.subscribe((function(t){return e.refreshPeers(t)})))},enumerable:!1,configurable:!0}),t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.selectPeer=function(t){(this.allowSelectDownPeer||t.reachable&&this.isCompatible(t))&&(console.debug("[select-peer-modal] Selected peer: {url: '"+t.url+"'}"),this.viewCtrl.dismiss(t))},t.prototype.isCompatible=function(t){return!this.peerMinVersion||t&&t.softwareVersion&&aa.isCompatible(this.peerMinVersion,t.softwareVersion)},t.prototype.refresh=function(t){this.loading=!0,this.onRefresh.emit(t)},t.prototype.refreshPeers=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:t=t||[],e=[],n=Promise.all(t.map((function(t){return Ie(r,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return[4,this.refreshPeer(t)];case 1:return n.sent(),this._subscription.closed?[2]:(e.push(t),e.sort((function(t,e){return t.reachable&&!e.reachable?-1:!t.reachable&&e.reachable?1:t.hostAndPort<e.hostAndPort?-1:t.hostAndPort>e.hostAndPort?1:0})),this.$peers.next(e),[2,t])}}))}))}))),this._subscription.add(this.$peers.subscribe((function(){return r.cd.markForCheck()}))),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._subscription.closed||console.error(o),[3,4];case 4:return this.loading=!1,this.cd.markForCheck(),[2]}}))}))},t.prototype.refreshPeer=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ra.getNodeInfo(this.http,t.url)];case 1:return e=o.sent(),t.status="UP",t.softwareName=e.softwareName,t.softwareVersion=e.softwareVersion,t.label=e.nodeLabel,t.name=e.nodeName,[3,3];case 2:return n=o.sent(),this._subscription.closed||n&&n.message&&console.error("[select-peer] "+n.message,n),t.status="DOWN",[3,3];case 3:return[2,t]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();ca.decorators=[{type:e.Component,args:[{selector:"select-peer-modal",template:'<ion-header>\n <ion-toolbar color="light">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()" *ngIf="canCancel"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'NETWORK.PEER.SELECT_MODAL.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n \x3c!-- loader --\x3e\n <ion-spinner *ngIf="loading; else endButtons"></ion-spinner>\n\n <ng-template #endButtons>\n \x3c!-- refresh button --\x3e\n <ion-button *ngIf="onRefresh.observers | isNotEmptyArray"\n [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="refresh($event)">\n <mat-icon slot="icon-only">refresh</mat-icon>\n </ion-button>\n </ng-template>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list>\n\n <ion-list-header>\n <ion-label class="ion-text-wrap">\n <p translate>NETWORK.PEER.SELECT_MODAL.HELP</p>\n </ion-label>\n </ion-list-header>\n\n <ion-item *ngFor="let peer of $peers | async"\n tappable\n (click)="selectPeer(peer)"\n detail\n @fadeInAnimation>\n\n \x3c!-- icon --\x3e\n <ion-avatar slot="start" *ngIf="peer.reachable" >\n <ion-img [src]="peer.favicon || (peer.url + \'/api/favicon\')"></ion-img>\n </ion-avatar>\n <ion-icon slot="start" *ngIf="!peer.reachable" name="desktop" color="medium" class="ion-text-center"></ion-icon>\n\n \x3c!-- Peer is UP --\x3e\n <ion-grid *ngIf="peer.reachable">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding">\n <ion-label class="ion-text-wrap">\n <ion-text color="dark">\n <h3>{{peer.hostAndPort}}{{peer.path}}</h3>\n </ion-text>\n <ion-text color="primary">\n <h4>{{peer.label}}</h4>\n </ion-text>\n </ion-label>\n </ion-col>\n <ion-col class="ion-no-padding">\n <ion-label class="ion-text-wrap ion-text-center" color="medium">\n <h3>{{peer.softwareName}}</h3>\n <h4 *ngIf="!peerMinVersion || isCompatible(peer); else invalidVersion">\n <small>v{{peer.softwareVersion}}</small>\n </h4>\n <ng-template #invalidVersion>\n <ion-text color="danger" [matTooltip]="\'NETWORK.PEER.SELECT_MODAL.NOT_COMPATIBLE_HELP\'|translate: {version: peerMinVersion} ">\n <h4 class="ion-color-danger">\n <small><mat-icon>warning</mat-icon>v{{peer.softwareVersion}}</small>\n </h4>\n </ion-text>\n </ng-template>\n </ion-label>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Peer is DOWN --\x3e\n <ion-label class="ion-text-wrap" *ngIf="!peer.reachable">\n <ion-text color="medium">\n <h3>{{peer.hostAndPort}}{{peer.path}}</h3>\n </ion-text>\n <ion-text color="danger">\n <h4>\n <small><ion-icon size="small" name="close-circle"></ion-icon></small>\n <span translate>NETWORK.PEER.OFFLINE</span>\n </h4>\n </ion-text>\n </ion-label>\n </ion-item>\n </ion-list>\n\n</ion-content>\n\n\n<ion-footer *ngIf="canCancel" hidden-xs hidden-sm hidden-mobile>\n\n <ion-toolbar>\n\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n\n \x3c!-- buttons --\x3e\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Zi],styles:["ion-item h4 ion-icon,ion-item h4 mat-icon{height:14px;width:14px;font-size:14px;line-height:14px}ion-item h4 small ion-icon,ion-item h4 small mat-icon{height:12px;width:12px;font-size:12px;line-height:12px}"]}]}],ca.ctorParameters=function(){return[{type:M.ModalController},{type:e.ChangeDetectorRef},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},ca.propDecorators={canCancel:[{type:e.Input}],allowSelectDownPeer:[{type:e.Input}],onRefresh:[{type:e.Input}]};var ua=Ht,da="settings",pa=["mobile","touchUi"],ha={accountInheritance:!0,locale:Yi.defaultLocale,latLongFormat:Yi.defaultLatLongFormat||"DDMM",pageHistoryMaxSize:3},ma=new e.InjectionToken("DefaultLocalSettings"),fa=new e.InjectionToken("LocalSettingsOptions"),ga=function(n){function o(t,e,o,r,i,a){var s=n.call(this,e)||this;return s.translate=t,s.platform=e,s.storage=o,s.environment=r,s.defaultSettings=i,s.onChange=new D.Subject,s.defaultSettings=Object.assign(Object.assign({},ha),s.defaultSettings),s._optionDefs=Object.values(a),s.resetData(),s._debug=!r.production,s._debug&&console.debug("[settings] Creating service"),s}return Ee(o,n),Object.defineProperty(o.prototype,"settings",{get:function(){return this._data||this.defaultSettings},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"locale",{get:function(){return this._data&&this._data.locale||this.translate.currentLang||this.translate.defaultLang},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"latLongFormat",{get:function(){return this._data&&this._data.latLongFormat||"DDMM"},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"usageMode",{get:function(){return this._data&&this._data.usageMode||(this.mobile?"FIELD":"DESK")},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"mobile",{get:function(){return this._data&&je(this._data.mobile,this.platform.is("mobile"))},set:function(t){this._data.mobile=t},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"touchUi",{get:function(){return this._data.touchUi},set:function(t){this._data.touchUi=t},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"pageHistory",{get:function(){return this._data&&this._data.pageHistory||[]},enumerable:!1,configurable:!0}),o.prototype.ngOnStart=function(){return console.info("[settings] Starting service..."),this._data.mobile=Re(this._data.mobile)?this._data.mobile:this.platform.is("mobile"),this._data.touchUi=this._data.mobile||this.platform.is("phablet")||this.platform.is("tablet"),this._data.usageMode=this.platform.is("android")?"FIELD":"DESK",this.restoreLocally()},o.prototype.isUsageMode=function(t){return this.usageMode===t},o.prototype.isOnFieldMode=function(t){return"FIELD"===(t||this.usageMode)},o.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=this._data||{},[4,this.storage.get(da)];case 1:return Pe(e=o.sent())&&(console.info("[settings] Restoring previous settings..."),n=JSON.parse(e),pa.forEach((function(t){delete n[t]})),t=Object.assign(t,n)),this.onChange.next(t),[2,t]}}))}))},o.prototype.setProperty=function(t,e){this._data&&("object"!=typeof t?(this._data.properties=this._data.properties||{},this._data.properties[t]=Ae(e)?void 0:e.toString()):this.setProperty(t.key,e))},o.prototype.getProperty=function(t,e){if("object"==typeof t)return this.getProperty(t.key,Ae(e)?t.defaultValue:e);var n=this._data&&this._data.properties&&this._data.properties[t];return Re(n)?n:e},o.prototype.getPropertyAsBoolean=function(t,e){var n=this.getProperty(t,e);return Re(n)?n&&"false"!==n:void 0},o.prototype.getPropertyAsInt=function(t,e){var n=this.getProperty(t,e);return Re(n)?parseInt(n):void 0},o.prototype.getPropertyAsNumbers=function(t,e){var n=this.getProperty(t,e);return"string"==typeof n?n.split(",").map(parseFloat)||void 0:Re(n)?[parseFloat(n)]:void 0},o.prototype.getPropertyAsStrings=function(t,e){var n=this.getProperty(t,e);return n&&n.split(",")||void 0},o.prototype.apply=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:o.sent(),o.label=2;case 2:return sn(n=Object.assign(Object.assign({},this._data),t),this._data)?[2]:(this._data=n,e&&e.persistImmediate?[4,this.persistLocally(!0)]:[3,4]);case 3:return o.sent(),[3,5];case 4:this.persistLocally(),o.label=5;case 5:return e&&!1===e.emitEvent||this.onChange.next(this._data),[2]}}))}))},o.prototype.applyProperty=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return(o={})[t]=e,[4,this.apply(o,n)];case 1:return r.sent(),[2]}}))}))},o.prototype.getPageSettings=function(t,e){if(this._data&&this._data.pages){var n=t.replace(/[/]/g,"__");return Pe(e)?Ze(this._data.pages,n+"."+e):this._data.pages[n]}},o.prototype.savePageSetting=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){return this._data=this._data||this.defaultSettings,this._data.pages=this._data.pages||{},o=t.replace(/[/]/g,"__"),n?(this._data.pages[o]=this._data.pages[o]||{},this._data.pages[o][n]=e):this._data.pages[o]=e,this.persistLocally(),[2]}))}))},o.prototype.getOfflineFeature=function(t){if(this._data&&this._data.offlineFeatures&&!Fe(this._data.offlineFeatures)){if(!t)throw Error("Missing 'featureName' argument");var e=(t=t.toLowerCase())+"#",n=this._data.offlineFeatures.find((function(n){return"string"==typeof n?n.toLowerCase().startsWith(e):"object"==typeof n&&n.name?n.name===t:void 0}));if(n){if("string"==typeof n){var o=n.substring(e.length);return console.debug("["+t+"] Last synchronization date: "+o),{name:t,lastSyncDate:o}}return n}}},o.prototype.getOfflineFeatureLastSyncDate=function(t){var e=this.getOfflineFeature(t);return e&&ao(e.lastSyncDate)},o.prototype.hasOfflineFeature=function(t){return t?Re(this.getOfflineFeature(t)):this._data&&Ne(this._data.offlineFeatures)},o.prototype.saveOfflineFeature=function(t){this._data=this._data||this.defaultSettings,this._data.offlineFeatures=this._data.offlineFeatures||[],t.name=t.name.toLowerCase();var e=t.name+"#",n=this._data.offlineFeatures.findIndex((function(n){return"string"==typeof n?n.toLowerCase().startsWith(e):"object"==typeof n&&n.name?n.name===t.name:void 0}));-1!==n?this._data.offlineFeatures[n]=t:this._data.offlineFeatures.push(t),this.persistLocally()},o.prototype.markOfflineFeatureAsSync=function(t){var e=this.getOfflineFeature(t);e?e.lastSyncDate=ua().toISOString():e={name:t.toLowerCase(),lastSyncDate:ua().toISOString()},this.saveOfflineFeature(e)},o.prototype.removeOfflineFeatures=function(){this._data&&this._data.offlineFeatures&&(this._data.offlineFeatures=[],this.persistLocally())},o.prototype.getFieldDisplayAttributes=function(t,e){var n=this._data&&this._data.properties&&this._data.properties["sumaris.field."+t+".attributes"];return n?n.split(","):e||["label","name"]},o.prototype.getPageFieldDefaultValue=function(t,e){return this.getPageSettings(t,"field."+e+".defaultValue")},Object.defineProperty(o.prototype,"optionDefs",{get:function(){return this._optionDefs},enumerable:!1,configurable:!0}),o.prototype.registerOption=function(t){if(-1!==this._optionDefs.findIndex((function(e){return e.key===t.key})))throw new Error("Additional additional property {"+t.key+"} already define.");this._debug&&console.debug("[settings] Adding additional property {"+t.key+"}",t),this._optionDefs.push(t)},o.prototype.registerOptions=function(t){var e=this;(t||[]).forEach((function(t){return e.registerOption(t)}))},o.prototype.addToPageHistory=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return n||this.fillPageHistoryDefaults(t,e),n=n||this._data.pageHistory,-1!==(o=n.findIndex((function(e){return e.path===t.path||t.path.startsWith(e.path+"/")})))?[3,1]:(console.debug("[settings] Adding page to history: ",t),n.splice(0,0,t),[3,4]);case 1:return r=n[o],n[o].path!==t.path?[3,2]:(console.debug("[settings] Updating existing page in history: ",t),n.splice(o,1),t.children=r.children||[],n.splice(0,0,t),[3,4]);case 2:return r.children=r.children||[],r.time=t.time,[4,this.addToPageHistory(t,e,r.children)];case 3:a.sent(),a.label=4;case 4:return n!==this._data.pageHistory?[3,6]:(this._data.pageHistory.length>this._data.pageHistoryMaxSize&&(i=n.splice(this._data.pageHistoryMaxSize,n.length-this._data.pageHistoryMaxSize),console.debug("[settings] Pages removed from history: ",i)),[4,this.applyProperty("pageHistory",n)]);case 5:a.sent(),a.label=6;case 6:return[2]}}))}))},o.prototype.removePageHistory=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:return n=n||this._data.pageHistory,o=n.findIndex((function(e){return e.path===t})),(r=-1!==o)?(console.debug("[settings] Remove page history: ",t),n.splice(o,1)):r=-1!==n.map((function(t){return t.children})).filter(Ne).findIndex((function(n){return i.removePageHistory(t,e,n)})),r&&n===this._data.pageHistory?[4,this.applyProperty("pageHistory",this._data.pageHistory)]:[3,2];case 1:a.sent(),a.label=2;case 2:return[2,r]}}))}))},o.prototype.clearPageHistory=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.applyProperty("pageHistory",[],{persistImmediate:!0})];case 1:return t.sent(),[2]}}))}))},o.prototype.resetData=function(){this._data=Object.assign(Object.assign({},this._data),this.defaultSettings),this._data.locale=this.translate.currentLang||this.translate.defaultLang,this._data.mobile=void 0,this._data.usageMode=void 0,this._data.pageHistory=[];var e=this.environment.defaultPeer&&t.Peer.fromObject(this.environment.defaultPeer);this._data.peerUrl=e&&e.url||void 0,this.started&&this.onChange.next(this._data)},o.prototype.persistLocally=function(t){var n=this;if(t)return this._data?(console.debug("[settings] Store local settings",this._data),this.storage.set(da,JSON.stringify(this._data))):(console.debug("[settings] Removing local settings from storage"),this.storage.remove(da));this._$persist||(this._$persist=new e.EventEmitter(!0),this._$persist.pipe(N.debounceTime(2e3),N.filter((function(){return n.started}))).subscribe((function(){return n.persistLocally(!0)}))),this._$persist.emit()},o.prototype.fillPageHistoryDefaults=function(t,e){if(!t||!t.title||!t.path)throw Error("Missing required argument 'page', 'page.path' or 'page.title'");if(t.time=t.time||ua(),!e||!1!==e.removeTitleSmallTag){var n=t.title.indexOf("</small>");-1!==n&&(t.title=t.title.substring(n+"</small>".length)),t.title=t.title.replace(/[ ]*class='hidden-xs hidden-sm'/g,"")}return e&&!1===e.removePathQueryParams||(t.path=t.path.replace(/[?].*$/,"")),t},o}(_i);ga.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ga(jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(te.Storage),jt.ɵɵinject(me),jt.ɵɵinject(ma,8),jt.ɵɵinject(fa,8))},token:ga,providedIn:"root"}),ga.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[ma,fa]}]}],ga.ctorParameters=function(){return[{type:F.TranslateService},{type:M.Platform},{type:st.Storage},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ma]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[fa]}]}]};var ba=function(){function t(){}return t.show=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p,h,m,f,g,b=this;return Oe(this,(function(y){switch(y.label){case 0:if(!t||!e)return console.error("Missing required argument 'toastController' or 'translate'"),n.message instanceof M.IonicSafeString?console.info("[toasts] message: "+(e&&e.instant(n.message.value)||n.message.value)):"string"==typeof n.message&&console.info("[toasts] message: "+(e&&e.instant(n.message,n.messageParams)||n.message)),[2,Promise.resolve({})];if(this.counter++,o=this.stackSize,this.stackSize<4?this.stackSize++:(this.stackSize=1,o=0),r=function(){b.counter--,0===b.counter?b.stackSize=0:b.stackSize==o+1&&b.stackSize--},i=n.message&&n.message instanceof M.IonicSafeString?n.message.value:n.message,a=[i],n.header&&a.push(n.header),n.showCloseButton&&(n.buttons=n.buttons||[],-1!==(l=n.buttons.map((function(t){return"object"==typeof t&&t||void 0})).filter(Re).findIndex((function(t){return"close"===t.role})))?s=n.buttons[l]:(s={role:"close"},n.buttons.push(s)),s.text=s.text||"COMMON.BTN_OK",a.push(s.text)),c=n.cssClass&&"string"==typeof n.cssClass&&n.cssClass.split(",")||n.cssClass||[],n.type)switch(n.type){case"error":n.header="ERROR",c.push("danger");break;case"warning":c.push("accent");break;case"info":c.push("secondary")}return n.cssClass=c,u=e.instant(a),n.messageParams&&(u[i]=e.instant(i,n.messageParams)),s&&(s.text=u[s.text]),d=n.position||("ios"===n.mode?"bottom":"top"),n.enterAnimation||"middle"===d||(h=75*o-75*(p="top"===d?1:-1),m=p*o*75,n.enterAnimation=function(t,e){return M.createAnimation().addElement(t.querySelector(".toast-wrapper")).duration(250).fromTo("transform","translateY("+h+"px)","translateY("+m+"px)").fromTo("opacity","0","1")}),[4,t.create(Object.assign(Object.assign({position:d,duration:n.showCloseButton?1e4:4e3},n),{message:u[i],header:n.header&&u[n.header]||void 0}))];case 1:return f=y.sent(),n.onWillPresent&&n.onWillPresent(f),[4,f.present()];case 2:return y.sent(),Fe(n.buttons)?(f.onDidDismiss().then(r),[2,null]):[3,3];case 3:return[4,f.onDidDismiss()];case 4:return g=y.sent(),r(),[2,g]}}))}))},t}();ba.counter=0,ba.stackSize=0;var ya=6e5,va=3e5,Ca=function(n){function o(t,o,r,i,a,s,l,c,u,d,p,h,m){var f=n.call(this,o)||this;return f._document=t,f.platform=o,f.modalCtrl=r,f.cryptoService=i,f.storage=a,f.settings=s,f.cache=l,f.http=c,f.environment=u,f.network=d,f.splashScreen=p,f.translate=h,f.toastController=m,f.onPeerChanges=f.onStart.pipe(N.map((function(t){return t&&t.url})),N.filter(Pe),N.distinctUntilChanged()),f.onNetworkStatusChanges=new D.BehaviorSubject(null),f.onResetNetworkCache=new e.EventEmitter(!0),f._listeners={},f._mobile=f.platform.is("mobile"),f._mobile?(f._timerRefreshPeriod=ya,f._timerRefreshCondition=function(){return f.online}):(f._timerRefreshPeriod=va,f._timerRefreshCondition=function(){return!0}),f.resetData(),f.onStart.subscribe((function(){return f.ngOnAfterStart()})),f._debug=!u.production,f}return Ee(o,n),Object.defineProperty(o.prototype,"online",{get:function(){return"none"!==this.connectionType},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"offline",{get:function(){return"none"===this.connectionType},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"connectionType",{get:function(){return this._forceOffline?"none":this.started&&this._deviceConnectionType||"unknown"},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"peer",{get:function(){return this._data&&this._data.clone()},set:function(t){this._startingPeer=t,this.restart()},enumerable:!1,configurable:!0}),o.prototype.on=function(t,e){switch(t){case"start":return this.onStart.subscribe((function(){return e()}));case"peerChanged":return this.onPeerChanges.subscribe((function(){return e()}));case"statusChanged":return this.onNetworkStatusChanges.subscribe((function(t){return e(t)}));case"resetCache":return this.onResetNetworkCache.subscribe((function(){return e()}));default:return this.addListener(t,e)}},o.prototype.tryOnline=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:return this._forceOffline&&"none"!==this._deviceConnectionType?(n=Date.now(),(o=!e||!1!==e.showLoadingToast)?[4,this.showToast({message:"NETWORK.INFO.RETRY_TO_CONNECT",duration:1e4,onWillPresent:function(t){return r=t}})]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return d.trys.push([2,10,,11]),console.info("[network] Checking connection to pod..."),[4,this.settings.ready()];case 3:return(i=d.sent()).peerUrl?(a=t.Peer.parseUrl(i.peerUrl),[4,this.checkPeerAlive(a)]):[2,!1];case 4:return s=d.sent(),(l=s)?[4,this.checkPeerCompatible(s)]:[3,6];case 5:l=d.sent(),d.label=6;case 6:return l?(this.setForceOffline(!1),this._startingPeer=a,[4,this.restart()]):[3,9];case 7:return d.sent(),[4,this.emit("beforeTryOnlineFinish",this.online)];case 8:d.sent(),d.label=9;case 9:return[3,11];case 10:return c=d.sent(),console.error(c&&c.message||c),[3,11];case 11:return o?[4,nn(2e3-(Date.now()-n))]:[3,14];case 12:return d.sent(),r?[4,r.dismiss()]:[3,14];case 13:d.sent(),d.label=14;case 14:if(u=this.online)e&&!1===e.showOnlineToast||this.showToast({message:"NETWORK.INFO.ONLINE",type:"info"});else if(e&&!0===e.showOfflineToast)return[2,this.showOfflineToast({showRetryButton:!1})];return[2,this.started&&u]}}))}))},o.prototype.showOfflineToast=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.online?[2]:t&&!1===t.showRetryButton?[3,3]:[4,this.showToast({message:t&&t.message||"ERROR.NETWORK_REQUIRED",type:"warning",showCloseButton:!0,duration:1e5,buttons:[{role:"refresh",text:this.translate.instant("NETWORK.BTN_CHECK_ALIVE")}]})];case 1:return(e=n.sent())&&"refresh"===e.role?this.online?[2,!0]:[4,this.tryOnline({showOfflineToast:!1,showOnlineToast:je(t&&t.showRetrySuccessToast,!0),showLoadingToast:je(t&&t.showRetryLoadingToast,!0)})]:[2,!1];case 2:if(n.sent())return t&&t.onRetrySuccess&&setTimeout(t.onRetrySuccess),[2,!0];t=Object.assign(Object.assign({},t),{showRetryButton:!1,showCloseButton:!0}),n.label=3;case 3:return this.showToast(Object.assign({message:"ERROR.NETWORK_REQUIRED",type:"error"},t)),[2,!1]}}))}))},o.prototype.checkPeerAlive=function(e,n){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return(e=e||this.peer)?[3,2]:[4,this.settings.ready()];case 1:if(!(n=r.sent()).peerUrl)return[2,void 0];e=t.Peer.parseUrl(n.peerUrl),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getNodeInfo(e)];case 3:return[2,r.sent()];case 4:return o=r.sent(),console.debug("[network] Cannot get /api/node/info from peer: "+(o&&o.message||o),o),[2,void 0];case 5:return[2]}}))}))},o.prototype.checkPeerCompatible=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.environment.peerMinVersion?(n=t&&t.softwareVersion&&aa.isCompatible(this.environment.peerMinVersion,t.softwareVersion))||e&&!1===e.showToast?[3,2]:[4,this.showToast({type:"error",message:"NETWORK.ERROR.NOT_COMPATIBLE_PEER",messageParams:{version:this.environment.peerMinVersion},showCloseButton:!0})]:[2,!0];case 1:o.sent(),o.label=2;case 2:return[2,n]}}))}))},o.prototype.getNodeInfo=function(e){if(e=e||this.peer){var n=zi(e,t.Peer)?e.url:e;return n.endsWith("/")&&(n=n.substr(0,n.length-1)),this.get(n+"/api/node/info")}},o.prototype.setForceOffline=function(t,e){if(t=je(t,!0),this._forceOffline!==t){var n=this.connectionType;this._forceOffline=t;var o=this.connectionType;n!==o&&(console.info("[network] Connection changed to {"+o+"}"),this.onNetworkStatusChanges.next(o),"none"!==o||e&&!1===e.showToast||this.showToast({message:"NETWORK.INFO.OFFLINE_HELP"}))}},o.prototype.showSelectPeerModal=function(t){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return t=t||{},n=new e.EventEmitter,o=n.pipe(N.mergeMap((function(t){return a.getDefaultPeers()})),N.map((function(t){return t||[]}))),[4,this.modalCtrl.create({component:ca,componentProps:{onRefresh:n,peers:o,canCancel:je(t.canCancel,!0),allowSelectDownPeer:je(t.allowSelectDownPeer,!0)},keyboardClose:!0,showBackdrop:!0})];case 1:return[4,(r=s.sent()).present()];case 2:return s.sent(),n.emit(),[4,r.onWillDismiss()];case 3:return i=s.sent().data,n.complete(),[2,i&&i||void 0]}}))}))},o.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){return e=this._debug&&Date.now(),console.info("[network] Clearing all caches..."),[2,this.cache.clearAll().then((function(){if(!t||!1!==t.emitEvent&&n.onResetNetworkCache.observers.length)return n.onResetNetworkCache.emit(),nn(500)})).then((function(){n._debug&&console.debug("[network] All cache cleared, in "+(Date.now()-e)+"ms")}))]}))}))},o.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[network] Starting network...",this._startingPeer),(e=this._startingPeer)?[3,2]:[4,this.restoreLocally()];case 1:e=n.sent(),n.label=2;case 2:!(t=e)&&this.splashScreen&&this.splashScreen.hide(),n.label=3;case 3:return t?[3,5]:(console.debug("[network] No peer defined. Asking user to choose a peer."),[4,this.showSelectPeerModal({allowSelectDownPeer:!1})]);case 4:return t=n.sent(),[3,3];case 5:return console.info("[network] Starting service [OK] {peer: '"+t.url+"', online: "+this.online+"}"),[2,t]}}))}))},o.prototype.ngOnAfterStart=function(){var t;return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.settings.apply({peerUrl:this._data.url})];case 1:return n.sent(),this.onDeviceConnectionChanged((null===(t=this.network)||void 0===t?void 0:t.type)||"unknown"),this.startRefreshTimer(),this.network&&(this.registerSubscription(this.network.onDisconnect().subscribe((function(){return e.onDeviceConnectionChanged("none")}))),this.registerSubscription(this.network.onConnect().subscribe((function(){return e.onDeviceConnectionChanged(e.network.type)})))),[2]}}))}))},o.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.resetData(),!1===this._timerRefreshCondition()&&this.stopRefreshTimer(),[2]}))}))},o.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return[4,this.storage.get(da)];case 1:return e=a.sent(),(n=e&&JSON.parse(e)||void 0)&&n.peerUrl?(console.debug("[network] Use peer {"+n.peerUrl+"} (found in the local storage)"),[2,t.Peer.parseUrl(n.peerUrl)]):this.environment.defaultPeer?[2,t.Peer.fromObject(this.environment.defaultPeer)]:(o=this._document&&this._document.location)&&o.protocol&&o.protocol.startsWith("http")?(r=this._document.location.host,i=t.Peer.parseUrl(""+this._document.location.protocol+r+this.environment.baseUrl),[4,this.checkPeerAlive(i)]):[3,3];case 2:if(a.sent())return[2,i];a.label=3;case 3:return[2,void 0]}}))}))},o.prototype.stopRefreshTimer=function(){this._timerSubscription&&(this._timerSubscription.unsubscribe(),this._timerSubscription=void 0)},o.prototype.startRefreshTimer=function(){var t,e=this;this._timerSubscription||(console.info("[network] Starting refresh timer, every "+this._timerRefreshPeriod+"ms..."),this._timerSubscription=D.timer(this._timerRefreshPeriod,this._timerRefreshPeriod).pipe(N.filter(this._timerRefreshCondition),N.tap((function(){return console.debug("[network] Checking connection to pod...")})),N.mergeMap((function(){return e.checkPeerAlive(e.peer)})),N.filter((function(e){return!!e!=!!t})),N.tap((function(e){return t=e})),N.mergeMap((function(t){return e.checkPeerCompatible(t,{showToast:!0})}))).subscribe((function(t){t&&e.offline?(e.setForceOffline(!1),e.restart()):!t&&e.online&&(e.setForceOffline(!0),e.stop())})),this._timerSubscription.add((function(){return console.debug("[network] Refresh timer stopped")})))},o.prototype.get=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){return(n=t).startsWith("http://")||n.startsWith("https://")||((o=this.peer&&this.peer.url).endsWith("/")&&(o=o.substr(0,o.length-1)),t.startsWith("/")||(t="/"+t),n=o+t),[2,oa.getResource(this.http,n,e)]}))}))},o.prototype.onDeviceConnectionChanged=function(t){(t=(t||"unknown").toLowerCase()).startsWith("cell")&&(t="cell"),t!==this._deviceConnectionType&&(this._deviceConnectionType=t,this._forceOffline||(console.info("[network] Connection changed to {"+this._deviceConnectionType+"}"),this.onNetworkStatusChanges.next(this._deviceConnectionType),"none"===this._deviceConnectionType&&(this._mobile?(this._forceOffline=!0,this.showToast({message:"NETWORK.INFO.OFFLINE_HELP"})):this.showToast({message:"NETWORK.INFO.OFFLINE"}),this.stop())))},o.prototype.resetData=function(){this._data=null},o.prototype.getDefaultPeers=function(){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){return e=(this.environment.defaultPeers||[]).map(t.Peer.fromObject),[2,Promise.resolve(e)]}))}))},o.prototype.showToast=function(t){return ba.show(this.toastController,this.translate,t)},o.prototype.addListener=function(t,e){var n=this;return this._listeners[t]=this._listeners[t]||[],this._listeners[t].push(e),new D.Subscription((function(){var o=n._listeners[t].indexOf(e);-1!==o&&n._listeners[t].splice(o,1)}))},o.prototype.emit=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){return Ne(n=this._listeners[t])?(console.info("[network-service] Trigger "+t+" hook: Executing "+n.length+" callbacks..."),[2,Promise.all(n.map((function(n){var o=n(e);if(o)return o.catch((function(e){return console.error("Error while executing hook "+t,e)}))})))]):[2]}))}))},o}(_i);Ca.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ca(jt.ɵɵinject(Bt.DOCUMENT),jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Gt.ModalController),jt.ɵɵinject(Hi),jt.ɵɵinject(te.Storage),jt.ɵɵinject(ga),jt.ɵɵinject(ee.CacheService),jt.ɵɵinject(Qt.HttpClient),jt.ɵɵinject(me),jt.ɵɵinject(ne.Network,8),jt.ɵɵinject(oe.SplashScreen,8),jt.ɵɵinject($t.TranslateService,8),jt.ɵɵinject(Gt.ToastController,8))},token:Ca,providedIn:"root"}),Ca.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ca.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:M.Platform},{type:M.ModalController},{type:Hi},{type:st.Storage},{type:ga},{type:dt.CacheService},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ut.Network,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:M.ToastController,decorators:[{type:e.Optional}]}]};var Ea=0,wa=1,Ia=2,Oa=3,_a=4,xa=5,ka=6,Sa=7,Aa=8,Ta=9,Ra=8,Pa=10,Da=11,Na=12,Fa=13,Ma=14,La=15,ja=104,Ba=350,Ua=351,Va=401,qa=601,$a=602,Ga=700,Ha=701,Wa=401,za=403,Ka=404,Qa=520,Ya=521,Xa=553,Ja="entities",Za=function(){function t(t,e,n){this.name=t,this.storage=e,this._onChange=new D.BehaviorSubject(!0),this._dirty=!1,this.policy=n||{},this.reset({emitEvent:!1}),this._dirty=!1,this._loaded=!1,this._storageKey="entities#"+t,this._mapToLightEntity=this.createLightEntityMapFn(this.policy)}return Object.defineProperty(t.prototype,"cache",{get:function(){return this._cache},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this._dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isByIdMode",{get:function(){return"by-id"===this.policy.mode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storageKeyById",{get:function(){return this._storageKey+"#ids"},enumerable:!1,configurable:!0}),t.prototype.nextValue=function(){return this._sequence=this._sequence-1,this._dirty=!0,this._sequence},t.prototype.currentValue=function(){return this._sequence},t.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this._mapToLightEntity||e&&!1===e.fullLoad?[3,2]:[4,this.loadFullEntity(t,e)];case 1:return[2,n.sent()];case 2:return[2,this.loadCachedEntity(t,e)]}}))}))},t.prototype.watchAll=function(t,e){var n=this;return this._mapToLightEntity&&e&&!0===e.fullLoad?(console.warn("[entity-store] WARN: Watching full entities, splited by id in entity store. This can be long! Please make sure you need full entities here."),this._onChange.pipe(N.map((function(e){return n.reduceAndSort(n._cache,t)})),N.mergeMap((function(t){return Promise.all((t.data||[]).map((function(t){return n.loadFullEntity(t.id,e)}))).then((function(e){return{data:e,total:t.total}}))})))):this._onChange.pipe(N.map((function(e){return n.reduceAndSort(n._cache,t)})))},t.prototype.loadAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return n=this.reduceAndSort(this._cache,t),this._mapToLightEntity&&Ne(n.data)&&e&&!0===e.fullLoad?(o=n,[4,xn((n.data||[]).map((function(t){return function(){return r.load(t.id)}})))]):[3,2];case 1:o.data=i.sent(),i.label=2;case 2:return[2,n]}}))}))},t.prototype.save=function(t,e){var n=Re(t.id)&&this._statusById.get(t.id)||{index:void 0};return Ae(n.index)?(Ae(t.id)?t.id=this.nextValue():+t.id<0&&+t.id>this._sequence&&(console.warn("Trying to save a local entity with an id > sequence. Will replace id by sequence next value"),t.id=this.nextValue()),this._statusById.set(t.id,n),n.index=this._cache.push(t)-1):this._cache[n.index]=t,n.dirty=!0,this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),t},t.prototype.saveAll=function(t,e){var n,o=this;return!Fe(t)||e&&!0===e.reset?(console.info("[entity-storage] Saving "+t.length+" "+this.name+"(s)"),Fe(this._cache)||e&&e.reset?this.setEntities(t,{emitEvent:!1}):n=t.map((function(t){return o.save(t,{emitEvent:!1})})),this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),n||this._cache.slice()):t},t.prototype.delete=function(t,e){var n=Re(t)?this._statusById.get(t):void 0,o=n?n.index:void 0;if(!Ae(o)){var r=this._cache[o];if(r)return this._cache[o]=void 0,this._statusById.delete(r.id),this.isByIdMode&&this.storage.remove(this._storageKey+"#"+t),this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),r}},t.prototype.deleteMany=function(t,e){var n=this,o=(t||[]).map((function(t){return n.delete(t,{emitEvent:!1})})).filter(Re);return o.length?(e&&!1===e.emitEvent||this.emitEvent(),o):[]},t.prototype.reset=function(t){this._cache=[],this._sequence=0,this._statusById=new Map,this._dirty=!0,this._loaded=!0,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.persist=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return(t=Object.assign({skipIfPristine:this.policy.skipNonLocalEntities},t)).skipIfPristine&&!this._dirty?(console.debug("[entity-storage] Persisting "+this.name+" not need. Skip"),[2,this._cache.length]):(e=this.isByIdMode&&Array.from(this._statusById.values()).filter((function(e){return!t.skipIfPristine||e&&e.dirty})).map((function(t){return t.index})),n=this._cache.slice(),this.markAsPristine({emitEvent:!1}),e&&this._mapToLightEntity&&e.forEach((function(t){return o._cache[t]=o._mapToLightEntity(n[t])})),Fe(n)?[4,this.storage.remove(this._storageKey)]:[3,2]);case 1:return r.sent(),[3,7];case 2:return this.isByIdMode?[4,this.storage.set(this.storageKeyById,n.filter(Re).map((function(t){return t.id})))]:[3,5];case 3:return r.sent(),[4,Promise.all(e.map((function(t){var e=n[t];return console.debug("[entity-storage] Persisting "+o.name+"#"+e.id+"..."),o.storage.set(o._storageKey+"#"+e.id,e)})))];case 4:return r.sent(),console.info("[entity-storage] Persisting "+e.length+"/"+n.length+" "+this.name+"(s)..."),[3,7];case 5:return console.info("[entity-storage] Persisting "+n.length+" "+this.name+"(s)..."),[4,this.storage.set(this._storageKey,n)];case 6:r.sent(),r.label=7;case 7:return[2,n.length]}}))}))},t.prototype.restore=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l,c=this;return Oe(this,(function(u){switch(u.label){case 0:return[4,Promise.all([this.storage.get(this._storageKey),this.storage.get(this.storageKeyById)])];case 1:return n=u.sent(),o=n[0]&&Array.isArray(n[0])?n[0]:null,r=n[1]&&Array.isArray(n[1])?n[1]:null,i=!1,this.isByIdMode?Re(r)?[4,xn((s=r.map((function(t){return c._storageKey+"#"+t}))).map((function(t){return function(){return c.storage.get(t)}})))]:[3,3]:[3,5];case 2:return e=u.sent(),[3,4];case 3:Re(o)&&(e=o.filter((function(t){return t&&Re(t.id)})),i=!0,a=[this._storageKey]),u.label=4;case 4:return[3,8];case 5:return Re(o)?(e=o.filter((function(t){return t&&Re(t.id)})),[3,8]):[3,6];case 6:return Re(r)?[4,xn((s=r.map((function(t){return c._storageKey+"#"+t}))).map((function(t){return function(){return c.storage.get(t)}})))]:[3,8];case 7:e=u.sent(),i=!0,a=ke(s,[this.storageKeyById]),u.label=8;case 8:if(Ne(e)&&(e.length>=1e3&&console.warn("[entity-storage] - Restoring "+e.length+" "+this.name+". Check if not too many elements?!"),this._mapToLightEntity&&!i&&(e=e.map(this._mapToLightEntity))),this.setEntities(e||[],Object.assign(Object.assign({},t),{emitEvent:!1})),this._dirty=!1,!i)return[3,14];u.label=9;case 9:return u.trys.push([9,13,,14]),console.warn("[entity-storage] - Migrate "+this.name+" into {mode: '"+this.policy.mode+"'}..."),[4,this.persist({skipIfPristine:!1})];case 10:return u.sent(),Ne(a)?[4,xn(a.map((function(t){return function(){return c.storage.remove(t)}})))]:[3,12];case 11:u.sent(),u.label=12;case 12:return[3,14];case 13:throw l=u.sent(),console.error(l),{code:Da,message:"ERROR.ENTITY_STORAGE_MIGRATION_FAILED",details:l};case 14:return t&&!1===t.emitEvent||this.emitEvent(),[2,this._cache.length]}}))}))},t.prototype.markAsDirty=function(t){this._dirty=!0,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.markAsPristine=function(t){var e,n;try{for(var o=_e(this._statusById.values()),r=o.next();!r.done;r=o.next()){var i=r.value;Re(i)&&(i.dirty=!1)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}this._dirty=!1,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.loadCachedEntity=function(t,e){var n=this._statusById.get(t),o=n&&n.index;if(!Ae(o))return Object.freeze(this._cache[o])},t.prototype.loadFullEntity=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this._statusById.get(t),Ae(n=e&&e.index)?[2,void 0]:!1!==e.dirty?[3,2]:(console.debug("[entity-storage] Full reloading "+this.name+"#"+t+"..."),[4,this.storage.get(this._storageKey+"#"+t)]);case 1:if(o=r.sent())return[2,o];r.label=2;case 2:return[2,this._cache[n]]}}))}))},t.prototype.setEntities=function(t,e){var n=this;t=(t||[]).filter((function(t){return Re(t)&&(!n.policy.skipNonLocalEntities||+t.id<0)})),this._cache=t,this._sequence=this._cache.reduce((function(t,e){return+e.id<0?Math.min(t,+e.id):t}),0),this._statusById.clear(),this._cache.forEach((function(t,e){n._statusById.set(t.id,{index:e,dirty:!1})})),this._loaded=!0,e&&!1===e.emitEvent||this.emitEvent()},t.prototype.reduceAndSort=function(t,e){if(Fe(t))return{data:[],total:0};if(t=t.filter(Re),!e)return{data:t,total:t.length};e.filter&&(t=t.filter(e.filter));var n=t.length;return 0===e.size?{data:[],total:n}:(t.length&&e.sortBy&&Qi.sort(t,e.sortBy,e.sortDirection),e.offset>0?t=e.offset>=t.length||0===e.size?[]:e.size>0&&e.offset+e.size<t.length?t.slice(e.offset,e.offset+e.size):t.slice(e.offset):e.size>0?t=t.slice(0,e.size):e.size,{data:t,total:n})},t.prototype.createLightEntityMapFn=function(t){if("by-id"===t.mode&&!Fe(t.lightFieldsExcludes)){var e=Object.freeze(this.policy.lightFieldsExcludes.reduce((function(t,e){return t[e]=void 0,t}),{}));return function(t){return t?Object.assign({},t,e):void 0}}},t.prototype.emitEvent=function(){this._onChange.next(!0)},t}(),ts=new e.InjectionToken("localStorageTypePolicies"),es=function(t){function n(n,o,r,i,a){var s=t.call(this,n)||this;return s.platform=n,s.progressBarService=o,s.storage=r,s.environment=i,s._$save=new e.EventEmitter(!0),s._dirty=!1,s._saving=!1,s._typePolicies=a||{},s._saveTimerPeriod=i.storageSavePeriodMs||1e4,s._data={},s._debug=!i.production,s._debug&&console.debug("[entities-storage] Creating service"),s}return Ee(n,t),Object.defineProperty(n.prototype,"dirty",{get:function(){return this._dirty||Object.values(this._data).some((function(t){return t.dirty}))},enumerable:!1,configurable:!0}),n.prototype.watchAll=function(t,e,o){var r=this;if(!this.started)return D.defer((function(){return r.ready()})).pipe(N.switchMap((function(){return r.watchAll(t,e,o)})));this.progressBarService.increase();var i=e&&e.trash?n.TRASH_PREFIX+t:t,a=this.getEntityStore(i,{create:!0}).watchAll(e,o);return a.pipe(N.first()).subscribe((function(){return r.progressBarService.decrease()})),a},n.prototype.loadAll=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:try{return this.progressBarService.increase(),this._debug&&console.debug("[entities-storage] Loading "+t+"..."),(o=this.getEntityStore(t,{create:!1}))?[2,o.loadAll(e,n)]:[2,{data:[],total:0}]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.load=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.ready()];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),this.progressBarService.increase(),(o=this.getEntityStore(e,{create:!1}))?[4,o.load(t,n)]:[2,void 0];case 3:return[2,r.sent()];case 4:return this.progressBarService.decrease(),[7];case 5:return[2]}}))}))},n.prototype.nextValue=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.ready()];case 1:return e.sent(),this._dirty=!0,[2,this.getEntityStore(this.detectEntityName(t)).nextValue()]}}))}))},n.prototype.nextValues=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return[4,this.ready()];case 1:for(a.sent(),this._dirty=!0,n=this.detectEntityName(t),o=this.getEntityStore(n),r=o.nextValue(),i=0;i<e-1;i++)o.nextValue();return this._debug&&console.debug("[entities-storage] Reserving range ["+r+","+o.currentValue()+"] for "+n+"'s sequence"),[2,r]}}))}))},n.prototype.currentValue=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.ready()];case 1:return e.sent(),[2,this.getEntityStore(this.detectEntityName(t)).currentValue()]}}))}))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2];case 1:o.sent(),o.label=2;case 2:try{return this.progressBarService.increase(),this._dirty=!0,n=e&&e.entityName||this.detectEntityName(t),this.getEntityStore(n).save(t,e),this._$save.emit(),[2,t]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return!Fe(t)||e&&!0===e.reset?this.started?[3,2]:[4,this.ready()]:[2,t];case 1:o.sent(),o.label=2;case 2:try{return this.progressBarService.increase(),this._dirty=!0,n=e&&e.entityName||this.detectEntityName(t[0]),[2,this.getEntityStore(n).saveAll(t,e)]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.delete=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:n.sent(),n.label=2;case 2:return[2,this.deleteById(t.id,Object.assign(Object.assign({},e),{entityName:e&&e.entityName||this.detectEntityName(t)}))]}}))}))},n.prototype.deleteById=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'entityName'");try{return this.progressBarService.increase(),(n=this.getEntityStore(e.entityName,{create:!1}))?((o=n.delete(t,e))&&(this._dirty=!0,this._$save.emit()),[2,o]):[2,void 0]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.deleteMany=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'opts.entityName'");try{return this.progressBarService.increase(),(n=this.getEntityStore(e.entityName,{create:!1}))?((o=n.deleteMany(t,e)).length>0&&(this._dirty=!0,this._$save.emit()),[2,o]):[2,void 0]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.deleteFromTrash=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:n.sent(),n.label=2;case 2:return[2,this.deleteFromTrashById(t.id,Object.assign(Object.assign({},e),{entityName:e&&e.entityName||this.detectEntityName(t)}))]}}))}))},n.prototype.deleteFromTrashById=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,this.ready()];case 1:if(o.sent(),!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'entityName'");return[2,this.deleteById(t,Object.assign(Object.assign({},e),{entityName:n.TRASH_PREFIX+e.entityName}))]}}))}))},n.prototype.moveToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:a.sent(),a.label=2;case 2:return o=e&&e.entityName||this.detectEntityName(t),(r=this.getEntityStore(o))&&r.delete(t.id,e),t.id=void 0,i=n.TRASH_PREFIX+o,this.getEntityStore(i).save(t,e),this._$save.emit(),[2,t]}}))}))},n.prototype.moveManyToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:a.sent(),a.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts.entityName'");return(o=this.getEntityStore(e.entityName,{create:!1}))?((r=o.deleteMany(t,e)).length>0&&(r.forEach((function(t){return t.id=void 0})),i=n.TRASH_PREFIX+e.entityName,this.getEntityStore(i,{create:!0}).saveAll(r,e),this._dirty=!0,this._$save.emit()),[2,r]):[2,void 0]}}))}))},n.prototype.saveToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r;return Oe(this,(function(i){switch(i.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:i.sent(),i.label=2;case 2:return o=e&&e.entityName||this.detectEntityName(t),r=n.TRASH_PREFIX+o,this.getEntityStore(r).save(t,e),this._$save.emit(),[2,t]}}))}))},n.prototype.clearTrash=function(t){return Ie(this,void 0,void 0,(function(){var e,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:return e=n.TRASH_PREFIX+t,(o=this.getEntityStore(e,{create:!1}))?(o.reset(),this._dirty=!0,this._$save.emit(),[2]):[2]}}))}))},n.prototype.persist=function(){return this._dirty?this.storeLocally():Promise.resolve()},n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return t=Date.now(),console.info("[entities-storage] Starting entity storage..."),[4,this.restoreLocally()];case 1:return n.sent(),this.registerSubscription(D.merge(this._$save,D.timer(this._saveTimerPeriod,this._saveTimerPeriod)).pipe(N.throttleTime(this._saveTimerPeriod)).subscribe((function(){return e.storeLocally()}))),console.info("[entities-storage] Starting [OK] in "+(Date.now()-t)+"ms"),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.dirty?[4,this.storeLocally()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},n.prototype.getEntityStore=function(t,e){var n=this._data[t];if(!(n||e&&!1===e.create)){this._debug&&console.debug("[entities-storage] Creating store "+t);var o=this._typePolicies[t];n=new Za(t,this.storage,o),this._data[t]=n}return n},n.prototype.detectEntityName=function(t){if(!t)throw Error("Unable to detect entityName of object: "+t);return"string"==typeof t?t:t.__typename?t.__typename:t.constructor.name+"VO"},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.storage.get(Ja)];case 1:return(t=r.sent())?(e=this._debug&&Date.now(),this._debug&&console.info("[entities-storage] Restoring entities..."),[4,Promise.all(t.map((function(t){return o.getEntityStore(t)})).map((function(t){return t.restore()})))]):[2];case 2:return n=r.sent().reduce((function(t,e){return t+e}),0),this._debug&&console.debug("[entities-storage] Restoring entities [OK] "+n+" entities found in "+(Date.now()-e)+"ms"),[2]}}))}))},n.prototype.storeLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){return this.dirty?this._saving?(this._debug&&console.debug("[entities-storage] Previous persist not finished. Waiting..."),this._$save.emit(),[2]):(this._saving=!0,this._dirty=!1,this.progressBarService.increase(),t=this._data&&Object.keys(this._data)||[],e=Date.now(),this._debug&&console.debug("[entities-storage] Persisting..."),[2,xn(t.map((function(e){return function(){n=e;var r=o.getEntityStore(e,{create:!1});if(r)return r.persist().then((function(n){n||t.splice(t.findIndex((function(t){return t===e})),1)}));console.warn("[entities-storage] Persisting "+e+": store not found!")}}))).then((function(){return n=void 0,Fe(t)?o.storage.remove(Ja):o.storage.set(Ja,t)})).then((function(){o._debug&&console.debug("[entities-storage] Persisting [OK] "+t.length+" stores saved in "+(Date.now()-e)+"ms..."),o._saving=!1,o.progressBarService.decrease()})).catch((function(t){throw o._saving=!1,o.progressBarService.decrease(),n?console.error("[entities-storage] Error while persisting "+n,t):console.error("[entities-storage] Error while persisting: "+(t&&t.message||t),t),t}))]):[2]}))}))},n}(_i);es.TRASH_PREFIX="Trash#",es.REMOTE_PREFIX="Remote#",es.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new es(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(di),jt.ɵɵinject(te.Storage),jt.ɵɵinject(me),jt.ɵɵinject(ts,8))},token:es,providedIn:"root"}),es.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],es.ctorParameters=function(){return[{type:M.Platform},{type:di},{type:st.Storage},{type:fe,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ts]}]}]};var ns,os=function(){function t(){}return t.copy=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(!t||!e||t===e)throw new Error("Invalid 'from' or 'to' arguments. Must be not null storage");return n=Object.assign({deleteAfterCopy:!1},n),(r=n.keys)?[3,2]:[4,t.keys()];case 1:r=s.sent(),s.label=2;case 2:return Fe(o=r)?[2,Promise.resolve()]:(i=Date.now(),console.info("[storage-utils] Copying "+o.length+" keys from '"+t.driver()+"' to '"+e.driver()+"'... {deleteAfterCopy: "+n.deleteAfterCopy),a=0,[2,xn(o.map((function(o){return function(){return t.getItem(o).then((function(t){return e.setItem(o,t)})).then((function(){return n.deleteAfterCopy&&t.removeItem(o)})).catch((function(t){console.error("[storage-utils] Error during migration of key '"+o+"'",t),a++}))}}))).then((function(){if(0!==a)throw{message:"ERROR.COPY_STORAGE_ERROR"};console.info("[storage-utils] Migrating data [OK] in "+(Date.now()-i)+"ms")}))])}}))}))},t}(),rs=new e.InjectionToken("locales");t.UserSettings=ns=function(t){function e(){return t.call(this,ns.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return(null==e?void 0:e.minify)&&(n.content=this.content&&JSON.stringify(n.content)||void 0),n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e),this.locale=e.locale,this.latLongFormat=e.latLongFormat,Ae(e.content)||"object"==typeof e.content?this.content=e.content||{}:this.content=e.content&&JSON.parse(e.content)||{},this.nonce=e.nonce},e.prototype.merge=function(t,e){var n=this;if(t){this.content={};var o=!1;return Object.keys(t).forEach((function(r){ns.SETTINGS_PROPERTIES.includes(r)?sn(n[r],t[r])||(n[r]=t[r],o=!0):e&&e.includes(r)&&(sn(n.content[r],t[r])||(n.content[r]=Object.assign({},t[r]),o=!0))})),o}},e.prototype.asLocalSettings=function(){var t=this,e={};return ns.SETTINGS_PROPERTIES.forEach((function(n){e[n]=t[n]})),Object.keys(this.content).forEach((function(n){e[n]=t.content[n]})),e},e}(Wi),t.UserSettings.SETTINGS_PROPERTIES=["locale","latLongFormat"],t.UserSettings=ns=we([Ji({typename:"UserSettingsVO"})],t.UserSettings);var is,as={DISABLE:0,ENABLE:1,TEMPORARY:2,DELETED:3,ALL:99};function ss(t,e){return t&&t.id&&ze(t,e||["label","name"])||void 0}var ls=as.ENABLE,cs=as.DISABLE,us=as.TEMPORARY,ds=Object.freeze([{id:ls,icon:"checkmark",label:"REFERENTIAL.STATUS_ENUM.ENABLE"},{id:cs,icon:"close",label:"REFERENTIAL.STATUS_ENUM.DISABLE"},{id:us,icon:"help",label:"REFERENTIAL.STATUS_ENUM.TEMPORARY"}]),ps=Object.freeze(an(ds)),hs=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.asObject=function(e){if(e&&e.minify)return{id:this.id,entityName:e.keepEntityName&&this.entityName||void 0,__typename:e.keepTypename&&this.__typename||void 0};var n=t.prototype.asObject.call(this,e);return n.creationDate=io(this.creationDate),e&&!1===e.keepTypename&&delete n.entityName,n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.label=e.label,this.name=e.name,this.description=e.description,this.comments=e.comments,this.statusId=e.statusId,this.validityStatusId=e.validityStatusId,this.levelId=e.levelId&&0!==e.levelId?e.levelId:void 0,this.parentId=e.parentId,this.creationDate=ao(e.creationDate),this.entityName=e.entityName},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.entityName===e.entityName},e}(Wi);t.Referential=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e}(hs),t.Referential=we([Ji({typename:"ReferentialVO"})],t.Referential);var ms,fs,gs=function(){function e(){}return e.fromObject=function(e){if(!e||e instanceof t.Referential)return e;var n=new t.Referential;return n.fromObject(e),n},e.isNotEmpty=function(t){return Qi.isNotEmpty(t,"id")},e.isNotEmptyReferential=function(t){return Qi.isNotEmpty(t,"id")},e.isEmpty=function(t){return Qi.isEmpty(t,"id")},e.equals=function(t,e){return Qi.equals(t,e,"id")},e}(),bs=Object.freeze({minify:!0,keepTypename:!0,keepEntityName:!0,keepLocalId:!0}),ys=Object.freeze({minify:!0,keepTypename:!1,keepEntityName:!1,keepLocalId:!1});function vs(t){return t&&t.id&&t.name||void 0}function Cs(t,e){return(t||[]).map(vs).join(e||", ")}t.ReferentialRef=is=function(t){function e(){return t.call(this,is.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){if(e&&e.minify)return{id:this.id,entityName:e.keepEntityName&&this.entityName||void 0,__typename:e.keepTypename&&this.__typename||void 0};var n=t.prototype.asObject.call(this,e);return e&&!1===e.keepEntityName&&delete n.entityName,n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||this.entityName,this.label=e.label,this.name=e.name,this.statusId=e.statusId,this.levelId=e.levelId},e}(Wi),t.ReferentialRef=is=we([Ji({typename:"ReferentialVO"})],t.ReferentialRef),t.Department=ms=function(t){function e(){var e=t.call(this,ms.TYPENAME)||this;return e.entityName=ms.ENTITY_NAME,e}return Ee(e,t),e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||ms.ENTITY_NAME,this.logo=e.logo,this.siteUrl=e.siteUrl,delete this.entityName},e}(hs),t.Department.ENTITY_NAME="Department",t.Department=ms=we([Ji({typename:"DepartmentVO"})],t.Department);var Es=Object.freeze(["ADMIN","SUPERVISOR","USER","GUEST"]);t.Person=fs=function(e){function n(t){var n=e.call(this,t||fs.TYPENAME)||this;return n.department=null,n}return Ee(n,e),n.prototype.asObject=function(t){if(t&&t.minify)return{id:this.id,__typename:t.keepTypename&&this.__typename||void 0,firstName:this.firstName,lastName:this.lastName};var n=e.prototype.asObject.call(this,t);return n.department=this.department&&this.department.asObject(t)||void 0,n.profiles=this.profiles&&this.profiles.slice(0)||[],n.profiles=this.mainProfile&&[this.mainProfile]||n.profiles,n.creationDate=io(this.creationDate),t&&!0===t.minify||(n.mainProfile=Is.getMainProfile(n.profiles)),n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.firstName=n.firstName,this.lastName=n.lastName,this.email=n.email,this.creationDate=ao(n.creationDate),this.pubkey=n.pubkey,this.username=n.username,this.usernameExtranet=n.usernameExtranet,this.avatar=n.avatar,this.statusId=n.statusId,this.department=n.department&&t.Department.fromObject(n.department)||void 0,this.profiles=n.profiles&&n.profiles.slice(0)||[],n.mainProfile&&!this.profiles.find((function(t){return t===n.mainProfile}))&&(this.profiles=this.profiles.concat(n.mainProfile)),this.mainProfile=Is.getMainProfile(this.profiles)},n}(Wi),t.Person=fs=we([Ji({typename:"PersonVO"})],t.Person);var ws,Is=function(){function t(){}return t.getMainProfile=function(t){return Fe(t)?"GUEST":Es.find((function(e){return t.includes(e)}))||"GUEST"},t.getMainProfileIndex=function(t){if(Fe(t))return Es.length-1;var e=Es.findIndex((function(e){return t.includes(e)}));return-1!==e?e:Es.length-1},t.hasUpperOrEqualsProfile=function(e,n){var o=Es.indexOf(n);return-1!==o&&t.getMainProfileIndex(e)<=o},t.personToString=function(t){return t&&t.id&&t.lastName+" "+t.firstName||void 0},t.personsToString=function(e,n){return(e||[]).map(t.personToString).join(n||", ")},t}();function Os(t){return t&&(t.firstName&&t.firstName+" "||"")+(t.lastName||"")||""}t.Account=ws=function(e){function n(){var t=e.call(this,ws.TYPENAME)||this;return t.settings=null,t}return Ee(n,e),n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,Object.assign(Object.assign({},t),{minify:!1}));return n.settings=this.settings&&this.settings.asObject(t)||void 0,(null==t?void 0:t.minify)&&delete n.mainProfile,n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.settings=n.settings&&t.UserSettings.fromObject(n.settings)},n.prototype.asPerson=function(){var e=t.Person.fromObject(this.asObject({keepTypename:!0}));return e.__typename=t.Person.TYPENAME,e},Object.defineProperty(n.prototype,"displayName",{get:function(){return Os(this)},enumerable:!1,configurable:!0}),n}(t.Person),t.Account=ws=we([Ji({typename:"AccountVO"})],t.Account);var _s=Zt,xs="undefined"!=typeof global?global:"undefined"!=typeof window?window:{},ks=xs.WebSocket||xs.MozWebSocket,Ss=function(t,e){return new ks(t)};function As(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"mutation"===e.operation}function Ts(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"subscription"===e.operation}Ss.CLOSED=ks.CLOSED,Ss.CLOSING=ks.CLOSING,Ss.CONNECTING=ks.CONNECTING,Ss.OPEN=ks.OPEN;var Rs="apollo-tracker-persist";function Ps(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return o=(n=JSON).parse,[4,t.storage.getItem(Rs)];case 1:return(e=o.apply(n,[i.sent()]))?(t.debug&&console.debug("[apollo-tracker-link] Restoring tracked queries",e),r=(e||[]).map((function(e){var n=JSON.parse(e.contextJSON),o=JSON.parse(e.queryJSON),r=JSON.parse(e.variablesJSON);return t.apolloClient.mutate({context:n,mutation:o,optimisticResponse:n.optimisticResponse,variables:r})})),[2,Promise.all(r)]):[2]}}))}))}var Ds=new e.InjectionToken("graphqlTypePolicies"),Ns=function(t){function n(e,n,o,r,i,a,s,l){var c=t.call(this,e)||this;return c.platform=e,c.apollo=n,c.httpLink=o,c.network=r,c.storage=i,c.cryptoService=a,c.environment=s,c.typePolicies=l,c.connectionParams={},c.onNetworkError=new D.Subject,c.customErrors={},c._debug=!s.production,c._defaultFetchPolicy=s.apolloFetchPolicy,c._networkStatusChanged$=r.onNetworkStatusChanges.pipe(N.filter(Re),N.distinctUntilChanged()),c.onNetworkError.pipe(N.throttleTime(300),N.filter((function(){return c.network.online})),N.mergeMap((function(){return c.network.checkPeerAlive()})),N.filter((function(t){return!t}))).subscribe((function(){return c.network.setForceOffline(!0,{showToast:!0})})),c}return Ee(n,t),Object.defineProperty(n.prototype,"client",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cache",{get:function(){return this.apollo.client.cache},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"defaultFetchPolicy",{get:function(){return this._defaultFetchPolicy},enumerable:!1,configurable:!0}),n.prototype.setAuthToken=function(t){t?(console.debug("[graphql] Apply token authentication to headers"),this.connectionParams.authToken=t):(console.debug("[graphql] Remove token authentication from headers"),delete this.connectionParams.authToken,this.clearCache())},n.prototype.setAuthBasic=function(t){t?(console.debug("[graphql] Apply basic authentication to headers"),this.connectionParams.authBasic=t):(console.debug("[graphql] Remove basic authentication from headers"),delete this.connectionParams.authBasic,this.clearCache())},n.prototype.addResolver=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:e.sent(),e.label=2;case 2:return this.apollo.client.addResolvers(t),[2]}}))}))},n.prototype.query=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.client.query({query:t.query,variables:t.variables,fetchPolicy:t.fetchPolicy||this._defaultFetchPolicy||void 0})];case 3:return e=o.sent(),[3,5];case 4:return n=o.sent(),e=this.toApolloError(n,t.error),[3,5];case 5:if(e.errors)throw e.errors[0];return[2,e.data]}}))}))},n.prototype.watchQueryRef=function(t){return this.apollo.watchQuery({query:t.query,variables:t.variables,fetchPolicy:t.fetchPolicy||this._defaultFetchPolicy||void 0,notifyOnNetworkStatusChange:!0})},n.prototype.queryRefValuesChanges=function(t,e){var n=this;return t.valueChanges.pipe(N.catchError((function(t){return n.onApolloError(t,e.error)})),N.filter((function(t){return t.networkStatus===yt.NetworkStatus.ready||t.networkStatus===yt.NetworkStatus.error})),N.map((function(t){var e=t.data,n=t.errors;if(n)throw n[0];return e})))},n.prototype.watchQuery=function(t){var e=this.watchQueryRef(t);return this.queryRefValuesChanges(e,t)},n.prototype.mutate=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:return(t.forceOffline||this.network.offline)&&t.offlineResponse?"function"!=typeof t.offlineResponse?[3,2]:(t.context=t.context||{},e=t.offlineResponse,n=t,[4,e(t.context)]):[3,4];case 1:return n.optimisticResponse=a.sent(),this._debug&&console.debug("[graphql] [offline] Using an optimistic response: ",t.optimisticResponse),[3,3];case 2:t.optimisticResponse=t.offlineResponse,a.label=3;case 3:if(t.forceOffline)return o={data:t.optimisticResponse},t.update&&t.update(this.apollo.client.cache,o),[2,o.data];a.label=4;case 4:return[4,this.apollo.mutate({mutation:t.mutation,variables:t.variables,context:t.context,optimisticResponse:t.optimisticResponse,update:t.update}).pipe(N.catchError((function(e){return i.onApolloError(e,t.error)})),N.first()).toPromise()];case 5:if(r=a.sent(),Array.isArray(r.errors))throw r.errors[0];return[2,r.data]}}))}))},n.prototype.subscribe=function(t,e){var n=this;return this.apollo.subscribe({query:t.query,fetchPolicy:t&&t.fetchPolicy||"network-only",errorPolicy:t&&t.errorPolicy||void 0,variables:t.variables},Object.assign({useZone:!0},e)).pipe(N.catchError((function(e){return n.onApolloError(e,t.error)})),N.map((function(t){var e=t.data,n=t.errors;if(n)throw n[0];return e})))},n.prototype.insertIntoQueryCache=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){(n=Object.assign({},n))[e.arrayFieldName]=ke(n[e.arrayFieldName],[Object.assign({},e.data)]),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var o=Be(e.variables&&e.variables.size,-1);o>0&&n[e.arrayFieldName].length>o&&n[e.arrayFieldName].splice(o,n[e.arrayFieldName].length-o),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.totalFieldName]+=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n})}else console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName)}catch(t){this._debug&&console.error("[graphql] Error while updating cache: ",t)}},n.prototype.addManyToQueryCache=function(t,e){if(e.data&&e.data.length){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){n=Object.assign({},n);var o=e.equalsFn||function(t,e){return t.id===e.id&&t.entityName===e.entityName},r=e.data.filter((function(t){return-1===n[e.arrayFieldName].findIndex((function(e){return o(t,e)}))}));if(!r.length)return;n[e.arrayFieldName]=ke(n[e.arrayFieldName],r),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var i=Be(e.variables&&e.variables.size,-1);i>0&&n[e.arrayFieldName].length>i&&n[e.arrayFieldName].splice(i,n[e.arrayFieldName].length-i),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.arrayFieldName]+=r.length:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n})}else console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName)}catch(t){this._debug&&console.warn("[graphql] Error while updating cache: ",t)}}},n.prototype.removeFromCachedQueryById=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){var o=(n=Object.assign({},n))[e.arrayFieldName].findIndex((function(t){return t.id===e.ids}));if(-1===o)return!1;n[e.arrayFieldName]=n[e.arrayFieldName].slice();var r=n[e.arrayFieldName].splice(o,1)[0];return t.evict({id:t.identify(r)}),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.totalFieldName]-=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n}),!0}return console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName),!1}catch(t){return this._debug&&console.warn("[graphql] Error while removing from cache: ",t),!1}},n.prototype.removeFromCachedQueryByIds=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery(e);if(!n||!n[e.arrayFieldName])return console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName),0;var o=(n=Object.assign({},n))[e.arrayFieldName].reduce((function(t,n,o){return e.ids.includes(n.id)?t.concat(o):t}),[]);if(o.length<=0)return 0;if(!Ae(e.totalFieldName))return n[e.arrayFieldName]=n[e.arrayFieldName].slice(),o.reverse().map((function(t){return n[e.arrayFieldName].splice(t,1)[0]})).map((function(e){return t.identify(e)})).forEach((function(e){return t.evict({id:e})})),Re(n[e.totalFieldName])?n[e.totalFieldName]-=o.length:console.warn("[graphql] Unable to update the total in cached query. Unknown result part: "+e.totalFieldName),t.writeQuery({query:e.query,variables:e.variables,data:n}),o.length;o.map((function(t){return n[e.arrayFieldName][t]})).map((function(e){return t.identify(e)})).forEach((function(e){return t.evict({id:e})}))}catch(t){return this._debug&&console.warn("[graphql] Error while removing from cache: ",t),0}},n.prototype.updateToQueryCache=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery(e);if(n&&n[e.arrayFieldName]){n=Object.assign({},n);var o=e.equalsFn||function(t,e){return Qi.equals(t,e,"id")},r=n[e.arrayFieldName].findIndex((function(t){return o(e.data,t)}));return n[e.arrayFieldName]=-1!==r?n[e.arrayFieldName].slice().splice(r,1,e.data):ke(n[e.arrayFieldName],[e.data]),Re(e.totalFieldName)&&-1===r&&(Re(n[e.totalFieldName])?n[e.totalFieldName]+=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),void t.writeQuery({query:e.query,variables:e.variables,data:n})}}catch(t){this._debug&&console.warn("[graphql] Error while updating cache: ",t)}},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return(t=t||this.client)?(console.info("[graphql] Clearing Apollo client's cache... "),e=this._debug&&Date.now(),[4,t.cache.reset()]):[3,2];case 1:n.sent(),this._debug&&console.debug("[graphql] Apollo client's cache cleared, in "+(Date.now()-e)+"ms"),n.label=2;case 2:return[2]}}))}))},n.prototype.registerCustomError=function(t){this.customErrors=Object.assign(Object.assign({},this.customErrors),t)},n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,n,o,r,i,a,s,l,c,u,d,p,h,m,f,g,b,y=this;return Oe(this,(function(v){switch(v.label){case 0:return[4,this.network.ready()];case 1:if(v.sent(),console.info("[graphql] Starting graphql..."),t=this.platform.is("mobile")||this.platform.is("mobileweb"),n=!t,!(o=this.network.peer))throw Error("[graphql] Missing peer. Unable to start graphql service");return r=o.url+"/graphql",i=String.prototype.replace.call(r,/^http(s)?:/,"ws$1:")+"/websocket",console.info("[graphql] Base uri: "+r),console.info("[graphql] Subscription uri: "+i),this.httpParams=this.httpParams||{},this.httpParams.uri=r,this.wsParams=Object.assign(Object.assign({},this.wsParams),{options:{lazy:!0,reconnect:!0,connectionParams:this.connectionParams},webSocketImpl:Ss,uri:i}),a=new kt.IonicStorageWrapper(this.storage),(s=this.apollo.client)?[3,4]:(console.debug("[apollo] Creating GraphQL client..."),l=new Ct.WebSocketLink(this.wsParams),c=new wt.RetryLink,u=new yt.ApolloLink((function(t,e){var n=[];y.connectionParams.authToken&&n.push("token "+y.connectionParams.authToken),y.connectionParams.authBasic&&n.push("Basic "+y.connectionParams.authBasic);var o=(new Q.HttpHeaders).append("Authorization",n);return t.setContext(Object.assign(Object.assign({},t.getContext()),{headers:o})),e(t)})),d=this.httpLink.create(this.httpParams),p=new yt.InMemoryCache({typePolicies:this.typePolicies}),this.environment.persistCache?(console.debug("[graphql] Starting persistence cache..."),[4,kt.persistCache({cache:p,storage:a,trigger:this.platform.is("android")?"background":"write",debounce:1e3,debug:!0})]):[3,3]);case 2:v.sent(),v.label=3;case 3:h=void 0,n?(m=new se.default,C={storage:a,onNetworkStatusChange:this._networkStatusChanged$,debounce:1e3,debug:!0},E=new e.EventEmitter,w={},I=new D.BehaviorSubject("none"),C.onNetworkStatusChange.subscribe((function(t){return I.next(t)})),E.pipe(N.debounceTime(C.debounce||1e3),N.switchMap((function(){return I})),N.filter((function(t){return"none"===t&&!!C.storage}))).subscribe((function(){var t=Object.getOwnPropertyNames(w).map((function(t){return w[t]})).filter((function(t){return void 0!==t}));return C.debug&&console.debug("[apollo-tracker-link] Saving tracked queries to storage",t),C.storage.setItem(Rs,JSON.stringify(t))})),f=new yt.ApolloLink((function(t,e){var n=t.getContext();if(!n||!n.tracked)return e(t);var o=n.serializationKey||_s();console.debug("[apollo-tracker-link] Watching tracked query {"+t.operationName+"#"+o+"}");var r=Object.assign(Object.assign({},n),{optimisticResponse:null,cache:null}),i={id:o,name:t.operationName,queryJSON:JSON.stringify(t.query),variablesJSON:JSON.stringify(t.variables),contextJSON:JSON.stringify(r)};w[o]=i,E.emit();var a=e(t).map((function(e){return console.debug("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} succeed!",e),delete w[o],E.emit(w),e}));return"none"===I.getValue()&&(n.optimisticResponse?console.debug("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} has optimistic response: ",n.optimisticResponse):console.warn("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} missing 'context.optimisticResponse': waiting network UP before to continue...")),a})),g=new ae.default,this.registerSubscription(this._networkStatusChanged$.subscribe((function(t){"none"===t?(console.info("[graphql] offline mode: enable mutations buffer"),g.close()):(console.info("[graphql] online mode: disable mutations buffer"),g.open())}))),h=[le.default,g,f,g,m,c,u,d]):h=[c,u,d],s=new yt.ApolloClient({cache:p,link:yt.ApolloLink.split(As,yt.ApolloLink.from(h),yt.ApolloLink.split(Ts,l,yt.ApolloLink.from([c,u,d]))),connectToDevTools:!this.environment.production}),this.apollo.client=s,v.label=4;case 4:if(!n||!this.environment.persistCache)return[3,8];v.label=5;case 5:return v.trys.push([5,7,,8]),[4,Ps({apolloClient:s,storage:a,debug:!0})];case 6:return v.sent(),[3,8];case 7:return b=v.sent(),console.error("[graphql] Failed to restore tracked queries from storage: "+(b&&b.message||b),b),[3,8];case 8:return this.registerSubscription(this.network.on("start",(function(){return y.restart()}))),this.registerSubscription(this.network.on("resetCache",(function(){return y.clearCache()}))),console.info("[graphql] Starting graphql [OK]"),[2,s]}var C,E,w,I}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.info("[graphql] Stopping graphql service..."),[4,this.resetClient()];case 1:return t.sent(),[2]}}))}))},n.prototype.resetClient=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return(t=t||this.apollo.client)?(console.info("[graphql] Resetting apollo client..."),t.stop(),[4,Promise.all([t.clearStore(),this.clearCache(t)])]):[2];case 1:return e.sent(),[2]}}))}))},n.prototype.onApolloError=function(t,e){return D.of(this.toApolloError(t,e))},n.prototype.toApolloError=function(t,e){var n=t.networkError&&(t.networkError.error&&this.toAppError(t.networkError.error)||this.toAppError(t.networkError)||t.networkError.error&&this.createAppErrorByCode(t.networkError.error.status)||this.createAppErrorByCode(xa))||t.graphQLErrors&&t.graphQLErrors.length&&this.toAppError(t.graphQLErrors[0])||this.toAppError(t)||this.toAppError(t.originalError)||t.graphQLErrors&&t.graphQLErrors[0]||t;return console.error("[graphql] "+(n&&n.message||n),n.stack||""),n&&n.code===xa&&t.networkError&&t.networkError.message&&(console.error("[graphql] original error: "+t.networkError.message),this.onNetworkError.next(n)),n&&n.code||!e||(n=Object.assign(Object.assign({},e),{details:n,stack:t.stack})),{data:null,errors:[n],loading:!1,networkStatus:null}},n.prototype.createAppErrorByCode=function(t){if(this.getI18nErrorMessageByCode(t))return{code:t,message:this.getI18nErrorMessageByCode(t)}},n.prototype.getI18nErrorMessageByCode=function(t){var e=this.customErrors[t];if(e)return e;switch(t){case Wa:return"ERROR.UNAUTHORIZED";case za:return"ERROR.FORBIDDEN";case xa:return"ERROR.UNKNOWN_NETWORK_ERROR";case Ya:return"ERROR.BAD_UPDATE_DATE";case Qa:return"ERROR.DATA_LOCKED";case Xa:return"ERROR.BAD_APP_VERSION"}},n.prototype.toAppError=function(t){var e=t,n=t&&t.message||t;if("string"==typeof n&&0===n.trim().indexOf('{"code":'))try{e=JSON.parse(n.replace("\n"," ").replace("\r",""))}catch(t){console.error("Unable to parse error as JSON: ",t)}if(e&&e.code)return this.createAppErrorByCode(e.code)||e&&e.message||e},n}(_i);Ns.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ns(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(ie.Apollo),jt.ɵɵinject(ce.HttpLink),jt.ɵɵinject(Ca),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Hi),jt.ɵɵinject(me),jt.ɵɵinject(Ds,8))},token:Ns,providedIn:"root"}),Ns.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ns.ctorParameters=function(){return[{type:M.Platform},{type:vt.Apollo},{type:xt.HttpLink},{type:Ca},{type:st.Storage},{type:Hi},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ds]}]}]};var Fs=require("hash.js/lib/hash/sha/256"),Ms=function(){},Ls=function(t){function e(e,n){var o=t.call(this,e)||this;return o.graphql=e,o._mutableWatchQueries=[],o._mutableWatchQueriesMaxCount=3,o._debug=je(n&&!n.production,!Yi.production),o._logPrefix="[base-graphql-service] ",o}return Ee(e,t),e.prototype.mutableWatchQuery=function(t){if(t.fetchPolicy=t.fetchPolicy||this.graphql.defaultFetchPolicy,"no-cache"===t.fetchPolicy)return this.graphql.watchQuery(t);if(!t.arrayFieldName)return this._debug&&console.warn(this._logPrefix+"̀Missing 'opts.arrayFieldName' : unable to create a mutable watch query"),this.graphql.watchQuery(t);var e,n,o=this.computeMutableWatchQueryId(t),r=this._mutableWatchQueries.filter((function(t){return t.id===o}));return 1===r.length?((e=r[0]).counter+=1,n=e.queryRef,this._debug&&console.debug(this._logPrefix+"Find same mutable watch query (same variables) {"+o+"}. Skip register"),"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(console.warn(this._logPrefix+" Mutable query already exists, and fetchPolicy="+t.fetchPolicy+". Force refetch query..."),n.refetch(e.variables))):(n=this.graphql.watchQueryRef(t),this.registerNewMutableWatchQuery({id:o,query:t.query,queryRef:n,variables:t.variables,arrayFieldName:t.arrayFieldName,totalFieldName:t.totalFieldName,insertFilterFn:t.insertFilterFn,sortFn:t.sortFn,counter:1})),this.graphql.queryRefValuesChanges(n,t)},e.prototype.insertIntoMutableCachedQueries=function(t,e){var n=this,o=this.findMutableWatchQueries(e);o.length&&o.forEach((function(o){if(Array.isArray(e.data)){var r=o.insertFilterFn?e.data.filter((function(t){return o.insertFilterFn(t)})):e.data;Ne(r)&&(n._debug&&console.debug("[base-data-service] Inserting data into watching query: ",o.id),n.graphql.addManyToQueryCache(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,sortFn:o.sortFn,data:r}))}else o.insertFilterFn&&!o.insertFilterFn(e.data)||(n._debug&&console.debug("[base-data-service] Inserting data into watching query: ",o.id),n.graphql.insertIntoQueryCache(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,sortFn:o.sortFn,data:e.data}))}))},e.prototype.removeFromMutableCachedQueriesByIds=function(t,e){var n=this,o=this.findMutableWatchQueries(e);if(o.length)return console.debug("[base-data-service] Removing data from watching queries: ",o),o.map((function(o){return Array.isArray(e.ids)?n.graphql.removeFromCachedQueryByIds(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,ids:e.ids}):n.graphql.removeFromCachedQueryById(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,ids:e.ids})?1:0})).reduce((function(t,e){return t+e}),0)},e.prototype.refetchMutableWatchQueries=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!(e=this.findMutableWatchQueries(t)).length)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return o._debug&&console.debug(o._logPrefix+"Refetching mutable watch query {"+e.id+"}"),e.queryRef.refetch(Object.assign(Object.assign({},e.variables),t.variables))})))];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),console.error(this._logPrefix+"Error while refetching mutable watch queries",n),[3,4];case 4:return[2]}}))}))},e.prototype.computeMutableWatchQueryId=function(t){var e=t.queryName||Fs().update(JSON.stringify(t.query)).digest("hex").substring(0,8),n=t.variables&&Fs().update(JSON.stringify(t.variables)).digest("hex").substring(0,8)||"";return[e,t.arrayFieldName,n].join("|")},e.prototype.findMutableWatchQueries=function(t){var e=this;if(t.queryName)return this._mutableWatchQueries.filter((function(e){return e.id.startsWith(t.queryName+"|")}));if(t.queryNames)return t.queryNames.reduce((function(t,n){return t.concat(e._mutableWatchQueries.filter((function(t){return t.id.startsWith(n+"|")})))}),[]);if(t.query)return this._mutableWatchQueries.filter((function(e){return e.query===t.query}));if(t.queries)return t.queries.filter(Re).reduce((function(t,n){return t.concat(e._mutableWatchQueries.filter((function(t){return t.query===n})))}),[]);throw Error("Invalid options: only one property must be set")},e.prototype.registerNewMutableWatchQuery=function(t){if(this._debug&&console.debug(this._logPrefix+"Register new mutable watch query {"+t.id+"}"),this._mutableWatchQueriesMaxCount>0&&this._mutableWatchQueries.length>=this._mutableWatchQueriesMaxCount){var e=this._mutableWatchQueries.splice(0,1+this._mutableWatchQueries.length-this._mutableWatchQueriesMaxCount);console.warn(this._logPrefix+"Removing older mutable watching queries (stack exceed max of "+this._mutableWatchQueriesMaxCount+"): ",e.map((function(t){return t.id})))}!t.sortFn&&t.variables&&t.variables.sortBy&&(t.sortFn=t.variables&&t.variables.sortBy&&Qi.sortComparator(t.variables.sortBy,t.variables.sortDirection||"asc")),this._mutableWatchQueries.push(t)},e.prototype.findRefetchQueries=function(t){return this.findMutableWatchQueries(t).map((function(t){return{query:t.query,variables:t.variables}}))},e.prototype.ngOnStart=function(){return Promise.resolve(null)},e}(_i);Ls.decorators=[{type:e.Directive}],Ls.ctorParameters=function(){return[{type:Ns},{type:Ms,decorators:[{type:e.Optional}]}]};var js,Bs,Us,Vs,qs,$s,Gs,Hs,Ws,zs,Ks,Qs,Ys,Xs,Js="token",Zs="pubkey",tl="seckey",el="account",nl="assets/img/person.png",ol={account:yt.gql(js||(js=Se(["\n fragment AccountFragment on AccountVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n settings {\n ...UserSettingsFragment\n }\n department {\n id\n label\n name\n __typename\n }\n __typename\n }"],["\n fragment AccountFragment on AccountVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n settings {\n ...UserSettingsFragment\n }\n department {\n id\n label\n name\n __typename\n }\n __typename\n }"]))),settings:yt.gql(Bs||(Bs=Se(["fragment UserSettingsFragment on UserSettingsVO {\n id\n locale\n latLongFormat\n content\n nonce\n updateDate\n __typename\n }"],["fragment UserSettingsFragment on UserSettingsVO {\n id\n locale\n latLongFormat\n content\n nonce\n updateDate\n __typename\n }"])))},rl=yt.gql(Us||(Us=Se(["\n query Account {\n data: account {\n ...AccountFragment\n }\n }\n ","\n ","\n"],["\n query Account {\n data: account {\n ...AccountFragment\n }\n }\n ","\n ","\n"])),ol.account,ol.settings),il=yt.gql(Vs||(Vs=Se(["\n query IsEmailExists($email: String, $hash: String){\n isEmailExists(email: $email, hash: $hash)\n }\n"],["\n query IsEmailExists($email: String, $hash: String){\n isEmailExists(email: $email, hash: $hash)\n }\n"]))),al={save:yt.gql(qs||(qs=Se([" mutation SaveAccount($data:AccountVOInput){\n data: saveAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""],[" mutation SaveAccount($data:AccountVOInput){\n data: saveAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""])),ol.account,ol.settings),create:yt.gql($s||($s=Se(["mutation CreateAccount($data:AccountVOInput){\n data: createAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""],["mutation CreateAccount($data:AccountVOInput){\n data: createAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""])),ol.account,ol.settings),saveSettings:yt.gql(Gs||(Gs=Se(["mutation SaveSettings($data:UserSettingsVOInput){\n data: saveSettings(settings: $data){\n ...UserSettingsFragment\n }\n }\n ",""],["mutation SaveSettings($data:UserSettingsVOInput){\n data: saveSettings(settings: $data){\n ...UserSettingsFragment\n }\n }\n ",""])),ol.settings)},sl=yt.gql(Hs||(Hs=Se(["\n mutation sendAccountConfirmationEmail($email:String, $locale:String){\n sendAccountConfirmationEmail(email: $email, locale: $locale)\n }\n"],["\n mutation sendAccountConfirmationEmail($email:String, $locale:String){\n sendAccountConfirmationEmail(email: $email, locale: $locale)\n }\n"]))),ll=yt.gql(Ws||(Ws=Se(["\n mutation confirmAccountEmail($email:String, $code:String){\n confirmAccountEmail(email: $email, code: $code)\n }\n"],["\n mutation confirmAccountEmail($email:String, $code:String){\n confirmAccountEmail(email: $email, code: $code)\n }\n"]))),cl=yt.gql(zs||(zs=Se(["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"],["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"]))),ul=yt.gql(Ks||(Ks=Se(["\n query AuthChallenge{\n authChallenge{\n challenge\n pubkey\n signature\n }\n }\n"],["\n query AuthChallenge{\n authChallenge{\n challenge\n pubkey\n signature\n }\n }\n"]))),dl={listenChanges:yt.gql(Qs||(Qs=Se(["subscription updateAccount($interval: Int){\n data: updateAccount(interval: $interval) {\n id\n updateDate\n }\n }"],["subscription updateAccount($interval: Int){\n data: updateAccount(interval: $interval) {\n id\n updateDate\n }\n }"])))},pl=function(e){function n(t,n,o,r,i,a,s){var l=e.call(this,o,s)||this;return l.cryptoService=t,l.network=n,l.graphql=o,l.settings=r,l.storage=i,l.file=a,l.environment=s,l.onLogin=new D.Subject,l.onLogout=new D.Subject,l.onChange=new D.Subject,l.onAuthTokenChange=new D.Subject,l.onAuthBasicChange=new D.Subject,l._cache={loaded:!1,keypair:null,authToken:null,authBasic:null,pubkey:null,mainProfile:null,person:null,department:null},l._$additionalFields=new D.BehaviorSubject([]),l._tokenType$=new D.BehaviorSubject(void 0),l._debug=!s.production,l._debug&&console.debug("[account-service] Creating service"),l.resetData(),l.onAuthTokenChange.subscribe((function(t){return l.graphql.setAuthToken(t)})),l.onAuthBasicChange.subscribe((function(t){return l.graphql.setAuthBasic(t)})),l.network.on("beforeTryOnlineFinish",(function(t){return Ie(l,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return!t||this.started&&!this.isLogin()?[3,3]:(console.debug("[account] Force networkService.tryOnline() to wait, that graphql and account service is restarted..."),[4,nn(500)]);case 1:return e.sent(),this.started?[3,3]:[4,this.ready()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))})),l}return Ee(n,e),Object.defineProperty(n.prototype,"account",{get:function(){return this._cache.loaded?this._data:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"person",{get:function(){return this._cache.loaded&&!this._cache.person&&(this._cache.person=this._cache.loaded?this._data.asPerson():void 0),this._cache.person},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"department",{get:function(){return this._cache.loaded&&!this._cache.department&&(this._cache.department=this._cache.loaded?this._data.asPerson().department:void 0),this._cache.department},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tokenType",{get:function(){return this._tokenType$.value},set:function(t){this._tokenType$.value!==t&&(console.info("[account] Using authentication token type: "+t),this._tokenType$.next(t),this._cache.authToken=void 0,this.onAuthTokenChange.next(void 0),this._cache.authBasic=void 0,this.onAuthBasicChange.next(void 0))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return[4,Promise.all([this.settings.ready(),_n(this._tokenType$)])];case 1:return e.sent(),this.registerSubscription(this.graphql.onStart.subscribe((function(){t.started&&t.isLogin()&&(console.debug("[account] Restarting, to retry to authenticate..."),t.restart())}))),[4,this.restoreLocally()];case 2:return e.sent(),[4,this.listenSettings()];case 3:return e.sent(),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){return t=this._cache.authToken&&!0,e=this._cache.authBasic&&!0,n=t||e,this.resetData(),n&&(this.onLogout.next(),this.onChange.next(void 0),t&&this.onAuthTokenChange.next(void 0),e&&this.onAuthBasicChange.next(void 0)),[2]}))}))},n.prototype.isLogin=function(){return!(!this._cache.pubkey||!this._cache.loaded)},n.prototype.isAuth=function(){return!!(this._cache.pubkey&&this._cache.keypair&&this._cache.keypair.secretKey)},n.prototype.hasMinProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&Is.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.hasExactProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&this._data.profiles.some((function(e){return e===t}))},n.prototype.hasProfileAndIsEnable=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE)&&Is.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.isAdmin=function(){return this.hasProfileAndIsEnable("ADMIN")},n.prototype.isSupervisor=function(){return this.hasProfileAndIsEnable("SUPERVISOR")},n.prototype.isUser=function(){return this.hasProfileAndIsEnable("USER")},n.prototype.isUsageMode=function(t){return this.settings.isUsageMode(t)},n.prototype.isOnlyGuest=function(){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&!Is.hasUpperOrEqualsProfile(this._data.profiles,"USER")},n.prototype.canUserWriteDataForDepartment=function(t){return gs.isEmpty(t)?(this.isAdmin()||console.warn("Unable to check if user has right: invalid recorderDepartment",t),this.isAdmin()):!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE)&&(this._data.department&&this._data.department.id?this._data.department.id===t.id||Is.hasUpperOrEqualsProfile(this._data.profiles,"SUPERVISOR"):(console.warn("User account has no department ! Unable to check write right against recorderDepartment"),!1))},n.prototype.register=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(this.isLogin())throw new Error("User already login. Please logout before register.");if(!e.username||!e.password)throw new Error("Missing required username or password");this._debug&&console.debug("[account] Register new user account...",e.account),this._cache.loaded=!1,n=Date.now(),a.label=1;case 1:return a.trys.push([1,6,,7]),[4,this.cryptoService.scryptKeypair(e.username,e.password)];case 2:return o=a.sent(),e.account.pubkey=Ui.encode(o.publicKey),e.account.settings=e.account.settings||new t.UserSettings,e.account.settings.locale=this.settings.locale,e.account.settings.latLongFormat=this.settings.latLongFormat,e.account.settings.content=e.account.settings.content||{},e.account.department.id=e.account.department.id||this.environment.defaultDepartmentId,this._cache.keypair=o,[4,this.saveRemotely(e.account,o)];case 3:return(r=a.sent()).avatar=r.avatar||this.environment.baseUrl+nl,this._cache.mainProfile=Is.getMainProfile(r.profiles),this._data=r,this._cache.pubkey=r.pubkey,[4,this.authenticate(e)];case 4:return a.sent(),this._cache.loaded=!0,[4,this.saveLocally()];case 5:return a.sent(),console.debug("[account] Account successfully registered in "+(Date.now()-n)+"ms"),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data];case 6:throw i=a.sent(),console.error(i&&i.message||i),this.resetData(),i;case 7:return[2]}}))}))},n.prototype.authenticate=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return[4,_n(this._tokenType$)];case 1:if("basic"===(e=r.sent())||"basic-and-token"===e){if(!(this._cache.authBasic||this._cache.authToken&&"basic-and-token"===e)){if(!t||!t.username||!t.password)throw new Error("Missing username and password");this._cache.authBasic=this.cryptoService.encodeBase64(t.username+":"+t.password)}this.onAuthBasicChange.next(this._cache.authBasic)}if("token"!==e&&"basic-and-token"!==e)return[3,5];r.label=2;case 2:return r.trys.push([2,4,,5]),n=this._cache,[4,this.authenticateAndGetToken(this._cache.authToken)];case 3:return n.authToken=r.sent(),[3,5];case 4:throw o=r.sent(),console.error(o),this.resetData(),o;case 5:return"basic-and-token"===e&&(this._cache.authBasic=void 0,this.onAuthBasicChange.next(void 0)),[2]}}))}))},n.prototype.login=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:if(!t||!t.username||!t.password)throw new Error("Missing required username or password");console.debug("[account] Login..."),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.cryptoService.scryptKeypair(t.username,t.password)];case 2:return e=c.sent(),[3,4];case 3:throw n=c.sent(),console.error(n),this.resetData(),{code:Ea,message:"ERROR.SCRYPT_ERROR"};case 4:return this._cache.pubkey=Ui.encode(e.publicKey),this._cache.keypair=e,[4,this.storage.get(Js)];case 5:return o=(o=c.sent())&&o.startsWith(this._cache.pubkey)&&o||null,(r=this.settings.hasOfflineFeature()&&(this.network.offline||!0===t.offline))?(this._cache.authToken=o,this.network.setForceOffline(!0,{showToast:!1}),console.info("[account] Login [OK] {pubkey: "+this._cache.pubkey.substr(0,8)+"}, {offline: true}"),[3,9]):[3,6];case 6:return c.trys.push([6,8,,9]),[4,this.authenticate(t)];case 7:return c.sent(),[3,9];case 8:throw i=c.sent(),console.error(i),this.resetData(),i;case 9:return c.trys.push([9,11,,18]),[4,this.loadData({offline:r,fetchPolicy:"network-only"})];case 10:return c.sent(),[3,18];case 11:if(!(a=c.sent())||+a.code!==wa)return[3,17];if(-1===t.username.indexOf("@"))return[3,16];s=void 0,c.label=12;case 12:return c.trys.push([12,14,,15]),[4,this.isEmailExists(t.username)];case 13:return s=c.sent(),[3,15];case 14:throw c.sent(),a;case 15:if(!s)throw{code:Oa,message:"ERROR.UNKNOWN_ACCOUNT_EMAIL"};c.label=16;case 16:throw{code:Ia,message:"ERROR.BAD_PASSWORD"};case 17:throw a;case 18:return c.trys.push([18,20,,21]),[4,this.saveLocally()];case 19:return c.sent(),[3,21];case 20:throw l=c.sent(),console.error(l),this.resetData(),l;case 21:return this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.refresh=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");if(this.network.offline)throw new Error("Cannot check account in offline mode");return[4,this.loadData()];case 1:return t.sent(),[4,this.saveLocally()];case 2:return t.sent(),console.debug("[account] Successfully reload account"),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.save=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this._cache.pubkey?this._cache.pubkey!==t.pubkey?[2,Promise.reject("Not user account")]:[4,this.saveRemotely(t,this._cache.keypair)]:[2,Promise.reject("User not logged")];case 1:return(t=e.sent()).avatar=t.avatar||this.environment.baseUrl+nl,this._cache.mainProfile=Is.getMainProfile(t.profiles),this._data=t,this._cache.loaded=!0,[4,this.saveLocally()];case 2:return e.sent(),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.logout=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=this._cache.authToken&&!0,e=this._cache.authBasic&&!0,n=this._cache&&this._cache.pubkey,this.resetData(),this.settings.hasOfflineFeature()?[3,2]:[4,Promise.all([this.storage.remove(Zs),this.storage.remove(Js),this.storage.remove(el),n&&this.storage.remove("account#"+n)||Promise.resolve(),this.storage.remove(tl)])];case 1:return o.sent(),[3,4];case 2:return[4,Promise.all([this.storage.remove(Zs),this.storage.remove(el),this.storage.remove(tl)])];case 3:o.sent(),o.label=4;case 4:return[4,this.settings.clearPageHistory()];case 5:return o.sent(),this.onLogout.next(),t&&this.onAuthTokenChange.next(void 0),e&&this.onAuthBasicChange.next(void 0),this.onChange.next(void 0),[2]}}))}))},n.prototype.load=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return n=this._debug&&Date.now(),this._debug&&console.debug("[account] Loading account..."),this.network.offline&&(!e||"network-only"!==e.fetchPolicy&&"no-cache"!==e.fetchPolicy)||e&&!0===e.offline?[4,this.storage.get(el)]:[3,4];case 1:return(o=(o=(o=a.sent())&&"string"==typeof o&&JSON.parse(o)||o)&&this._cache.pubkey&&o.pubkey===this._cache.pubkey&&o||null)||!this._cache.pubkey?[3,3]:[4,this.storage.get("account#"+this._cache.pubkey)];case 2:o=(o=a.sent())&&"string"==typeof o&&JSON.parse(o)||o,a.label=3;case 3:return[3,6];case 4:return[4,this.graphql.query({query:rl,error:{code:wa,message:"ERROR.LOAD_ACCOUNT_ERROR"},fetchPolicy:e&&e.fetchPolicy||"no-cache"})];case 5:r=a.sent().data,o=r,a.label=6;case 6:return o?(i=t.Account.fromObject(o),this._debug&&console.debug("[account] Account loaded in "+(Date.now()-n)+"ms",i),[2,i]):(console.warn("[account] Account not found !"),[2,void 0])}}))}))},n.prototype.checkEmailAvailable=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.isEmailExists(t)];case 1:if(e.sent())throw{code:_a,message:"ERROR.EMAIL_ALREADY_REGISTERED"};return[2]}}))}))},n.prototype.isEmailExists=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this._debug&&console.debug("[account] Checking if {"+t+"} exists..."),[4,this.graphql.query({query:il,variables:{email:t,hash:void 0}})];case 1:return e=n.sent(),this._debug&&console.debug("[account] Email exist: "+(e&&e.isEmailExists)),[2,e&&e.isEmailExists]}}))}))},n.prototype.sendConfirmationEmail=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return e=e||this.settings.locale,console.debug("[account] Sending confirmation email to {"+t+"} with locale {"+e+"}..."),[4,this.graphql.mutate({mutation:sl,variables:{email:t,locale:e},error:{code:ka,message:"ERROR.SENT_ACCOUNT_CONFIRMATION_EMAIL_FAILED"}})];case 1:return[2,n.sent()]}}))}))},n.prototype.confirmEmail=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return console.debug("[account] Sendng confirm request for email {"+t+"} with code {"+e+"}..."),[4,this.graphql.mutate({mutation:ll,variables:{email:t,code:e},error:{code:Sa,message:"ERROR.CONFIRM_ACCOUNT_EMAIL_FAILED"}})];case 1:return[2,(n=o.sent())&&n.confirmAccountEmail]}}))}))},n.prototype.listenChanges=function(){var t=this;if(!this._cache.pubkey)return D.Subscription.EMPTY;var e=this;console.debug("[account] [WS] Listening changes");var n=this.graphql.subscribe({query:dl.listenChanges,variables:{interval:10},error:{code:Pa,message:"ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR"}}).subscribe({next:function(n){var o=n.data;return Ie(t,void 0,void 0,(function(){var t;return Oe(this,(function(n){switch(n.label){case 0:return o?io(null===(t=e._data)||void 0===t?void 0:t.updateDate)===o.updateDate?[3,2]:(console.debug("[account] [WS] Detected update on {"+o.updateDate+"}"),[4,e.refresh()]):[2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},error:function(n){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return n&&+n.code===Ka?(console.info("[account] Account not exists anymore: force user to logout...",n),[4,e.logout()]):[3,2];case 1:return t.sent(),[3,5];case 2:return n&&+n.code===Wa?(console.info("[account] Account not authorized: force user to logout...",n),[4,e.logout()]):[3,4];case 3:return t.sent(),[3,5];case 4:console.warn("[account] [WS] Received error:",n),t.label=5;case 5:return[2]}}))}))},complete:function(){console.debug("[account] [WS] Completed")}});return n.add((function(){return console.debug("[account] [WS] Stop listening changes")})),n},Object.defineProperty(n.prototype,"additionalFields",{get:function(){return this._$additionalFields.getValue()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"$additionalFields",{get:function(){return this._$additionalFields},enumerable:!1,configurable:!0}),n.prototype.getAdditionalField=function(t){return this._$additionalFields.getValue().find((function(e){return e.key===t}))},n.prototype.registerAdditionalField=function(t){var e=this._$additionalFields.getValue();if(e.find((function(e){return e.key===t.key})))throw new Error("Additional account field {key: "+t.key+"} already define.");this._debug&&console.debug("[account] Found additional account's field {key: "+t.key+"}"),this._$additionalFields.next(e.concat(t))},n.prototype.resetData=function(){this._cache.loaded=!1,this._cache.keypair=null,this._cache.authToken=null,this._cache.authBasic=null,this._cache.pubkey=null,this._cache.mainProfile=null,this._cache.person=null,this._cache.department=null,this._data=new t.Account},n.prototype.loadData=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");this._cache.loaded=!1,i.label=1;case 1:return i.trys.push([1,5,,6]),[4,this.load(e)];case 2:return(n=i.sent()||new t.Account).avatar=n.avatar||this.environment.baseUrl+nl,n.settings=n.settings||new t.UserSettings,n.settings.locale=n.settings.locale||this.settings.locale,n.settings.latLongFormat=n.settings.latLongFormat||this.settings.latLongFormat||"DDMM",n.settings.content=n.settings.content||{},this._cache.mainProfile=Is.getMainProfile(n.profiles),this._data?this._data.fromObject(n):this._data=n,this._cache.loaded=!0,n.settings?(o=Object.assign(Object.assign({},this.settings.settings),n.settings.asLocalSettings()),[4,this.settings.apply(o)]):[3,4];case 3:i.sent(),i.label=4;case 4:return[2,this._data];case 5:if(r=i.sent(),this.resetData(),r.code&&r.message)throw r;throw console.error(r),{code:wa,message:"ERROR.LOAD_ACCOUNT_ERROR"};case 6:return[2]}}))}))},n.prototype.listenSettings=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){return this.registerSubscription(this.settings.onChange.pipe(N.debounceTime(1e3),N.filter((function(){return t.isLogin()&&t.network.online}))).subscribe((function(e){return t.saveLocalSettingsRemotely(e)}))),[2]}))}))},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:return[4,Promise.all([this.storage.get(Zs),this.storage.get(Js),this.storage.get(tl)])];case 1:if(e=c.sent(),n=e[0],o=e[1],r=e[2],!n)return[2];if(!(o||r||!1))return[2];if(this._debug&&console.debug("[account] Account restoration..."),this._cache.authToken=o,this._cache.pubkey=n,this._cache.keypair=r&&{publicKey:Ui.decode(n),secretKey:Ui.decode(r)}||null,!this.network.online)return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.authenticate()];case 3:if(c.sent(),!this._cache.authToken&&!this._cache.authBasic)throw new Error("Authentication failed");return[3,5];case 4:return i=c.sent(),this.settings.hasOfflineFeature()?(console.warn("[account] Unable to authenticate on pod: forcing offline mode"),this.network.setForceOffline(!0,{showToast:!1}),[3,5]):(console.error(i),this.logout(),[2]);case 5:return[4,this.storage.get("account#"+n)];case 6:return(a=c.sent())?[3,8]:[4,this.storage.get(el)];case 7:s=c.sent(),a=s&&("string"==typeof s&&JSON.parse(a)||s),c.label=8;case 8:return a&&a.pubkey===n?(l=t.Account.fromObject(a),this._data=l,this._cache.mainProfile=Is.getMainProfile(l.profiles),this._cache.loaded=!0,this.onLogin.next(this._data),this.onChange.next(this._data),this._debug&&console.debug("[account] Account restoration [OK] {pubkey: "+n.substr(0,8)+"}, {profile: "+this._cache.mainProfile+"}"),[2,l]):[2]}}))}))},n.prototype.saveLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");return this._debug&&console.debug("[account] Saving account {"+this._cache.pubkey.substring(0,6)+"} in local storage..."),t=this._data.asObject({keepTypename:!0}),e=this._cache.keypair&&this._cache.keypair.secretKey&&Ui.encode(this._cache.keypair.secretKey)||null,t.avatar&&!t.avatar.endsWith(nl)&&(t.avatar.startsWith("http://")||t.avatar.startsWith("https://"))&&this.network.online?[4,this.file.getImage(t.avatar,{thumbnail:!0,responseType:"dataUrl"}).then((function(t){t&&o._debug&&console.debug("[account] Image fetched: ",t.substring(0,50))})).catch((function(e){console.error("[account] Error while fetching image: "+t.avatar+": "+e)}))]:[3,2];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,Promise.all([this.storage.set(Zs,this._cache.pubkey),this.storage.set(Js,this._cache.authToken),this.storage.set("account#"+this._cache.pubkey,t),e&&this.storage.set(tl,e)||this.storage.remove(tl),this.storage.remove(el)])];case 3:return r.sent(),this._debug&&console.debug("[account] Account saved in local storage"),[3,5];case 4:return n=r.sent(),console.error("[account] Error while saving account locally: "+(n&&n.message||n),n),[3,5];case 5:return[2]}}))}))},n.prototype.saveLocalSettingsRemotely=function(e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return e&&this.isLogin()&&!1!==e.accountInheritance?(n=this.account,o=t.UserSettings.fromObject(n.settings)||new t.UserSettings,o.merge(e,["locale","latLongFormat","properties"])?(this.account.settings=o,[4,this.saveSettingsRemotely(o)]):[2]):[2];case 1:return r.sent(),[2]}}))}))},n.prototype.saveRemotely=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(t.pubkey=t.pubkey||e&&Ui.encode(e.publicKey),!t.pubkey)throw new Error("Missing account pubkey");return n=this._debug&&Date.now(),this._debug&&console.debug("[account] Saving account remotely..."),(o=Ae(t.id))?[3,2]:[4,this.load({fetchPolicy:"network-only"})];case 1:if(!(r=s.sent())||!r.updateDate)throw{code:Ta,message:"ERROR.ACCOUNT_NOT_EXISTS"};this.copyIdAndUpdateDate(r,t),s.label=2;case 2:return delete(i=t.asObject(ys)).profiles,[4,this.graphql.mutate({mutation:o?al.create:al.save,variables:{data:i},error:{code:Aa,message:"ERROR.SAVE_ACCOUNT_ERROR"}})];case 3:return a=s.sent().data,this.copyIdAndUpdateDate(a,t),this._debug&&console.debug("[account] Account remotely saved in "+(Date.now()-n)+"ms"),[2,t]}}))}))},n.prototype.saveSettingsRemotely=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this._debug&&Date.now(),this._debug&&console.debug("[account] Saving settings remotely..."),n=t.asObject(ys),[4,this.graphql.mutate({mutation:al.saveSettings,variables:{data:n},error:{code:Ra,message:"ERROR.SAVE_SETTINGS_ERROR"}})];case 1:return o=r.sent().data,this.copyIdAndUpdateDateSettings(o,t),this._debug&&console.debug("[account] Settings remotely saved in "+(Date.now()-e)+"ms"),this.account&&(this.account.settings=t),[2]}}))}))},n.prototype.authenticateAndGetToken=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");if(e||console.info("[account] Authentication on pod..."),e>4)throw this._debug&&console.debug("[account] Failed to authentication on pod (after "+e+" attempts)"),{code:$a,message:"ERROR.AUTH_SERVER_ERROR"};return t?[4,this.graphql.query({query:cl,variables:{token:t},error:{code:Va,message:"ERROR.UNAUTHORIZED"},fetchPolicy:"no-cache"})]:[3,2];case 1:if((n=s.sent())&&n.authenticate)return this.onAuthTokenChange.next(t),console.info("[account] Authentication on pod [OK] {pubkey: '"+this._cache.pubkey.substr(0,8)+"'}"),[2,t];s.label=2;case 2:return o={code:qa,message:"ERROR.AUTH_CHALLENGE_ERROR"},[4,this.graphql.query({query:ul,variables:{},error:o,fetchPolicy:"network-only"})];case 3:if(!(r=s.sent())||!r.authChallenge)throw o;return[4,this.cryptoService.verify(r.authChallenge.challenge,r.authChallenge.signature,r.authChallenge.pubkey)];case 4:return s.sent()||console.warn("FIXME: Bad peer signature on auth challenge !",r.authChallenge),[4,this.cryptoService.sign(r.authChallenge.challenge,this._cache.keypair)];case 5:return i=s.sent(),a=this._cache.pubkey+":"+r.authChallenge.challenge+"|"+i,[4,this.authenticateAndGetToken(a,(e||1)+1)];case 6:return[2,s.sent()]}}))}))},n.prototype.copyIdAndUpdateDate=function(t,e){t&&(e.id=t.id||e.id,e.updateDate=t.updateDate||e.updateDate,this.copyIdAndUpdateDateSettings(t.settings,e.settings))},n.prototype.copyIdAndUpdateDateSettings=function(t,e){t&&(e.id=t.id||e.id,e.updateDate=t.updateDate||e.updateDate)},n}(Ls);pl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new pl(jt.ɵɵinject(Hi),jt.ɵɵinject(Ca),jt.ɵɵinject(Ns),jt.ɵɵinject(ga),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Li),jt.ɵɵinject(me))},token:pl,providedIn:"root"}),pl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pl.ctorParameters=function(){return[{type:Hi},{type:Ca},{type:Ns},{type:ga},{type:st.Storage},{type:Li},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},t.Software=Ys=function(t){function e(e){return t.call(this,e||Ys.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return n.creationDate=io(this.creationDate),n.properties=this.properties,n},e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.label=e.label,this.name=e.name,this.description=e.description,this.comments=e.comments,this.creationDate=ao(e.creationDate),this.statusId=e.statusId,e.properties&&Array.isArray(e.properties)?this.properties=Qi.getPropertyArrayAsObject(e.properties):this.properties=Object.assign({},e.properties)},e}(Wi),t.Software=Ys=we([Ji({typename:"SoftwareVO"})],t.Software),t.Configuration=Xs=function(e){function n(){return e.call(this,Xs.TYPENAME)||this}return Ee(n,e),n.prototype.clone=function(){return this.copy(new Xs)},n.prototype.copy=function(t){return t.fromObject(this),t},n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,t);return n.partners=this.partners&&this.partners.map((function(e){return e.asObject(t)}))||void 0,n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.smallLogo=n.smallLogo,this.largeLogo=n.largeLogo,this.backgroundImages=n.backgroundImages,this.partners=n.partners&&n.partners.map(t.Department.fromObject)||void 0},n.prototype.getPropertyAsBoolean=function(t){var e=this.getProperty(t);return Re(e)?e&&"false"!==e:void 0},n.prototype.getPropertyAsInt=function(t){var e=this.getProperty(t);return Re(e)?parseInt(e):void 0},n.prototype.getPropertyAsNumbers=function(t){var e=this.getProperty(t);return"string"==typeof e?e.split(",").map(parseFloat)||void 0:Re(e)?[parseFloat(e)]:void 0},n.prototype.getPropertyAsStrings=function(t){var e=this.getProperty(t);return e&&e.split(",")||void 0},n.prototype.getProperty=function(t){return Re(this.properties[t.key])?this.properties[t.key]:t.defaultValue||void 0},n}(t.Software),t.Configuration=Xs=we([Ji({typename:"ConfigurationVO"})],t.Configuration);var hl,ml,fl,gl,bl,yl=Object.freeze({LOGO:{key:"sumaris.logo",label:"CONFIGURATION.OPTIONS.LOGO",type:"string"},FAVICON:{key:"sumaris.favicon",label:"CONFIGURATION.OPTIONS.FAVICON",type:"string"},DEFAULT_LOCALE:{key:"sumaris.defaultLocale",label:"CONFIGURATION.OPTIONS.DEFAULT_LOCALE",type:"enum",values:rs},DEFAULT_LAT_LONG_FORMAT:{key:"sumaris.defaultLatLongFormat",label:"CONFIGURATION.OPTIONS.DEFAULT_LATLONG_FORMAT",type:"enum",values:[{key:"DDMMSS",value:"COMMON.LAT_LONG.DDMMSS_PLACEHOLDER"},{key:"DDMM",value:"COMMON.LAT_LONG.DDMM_PLACEHOLDER"},{key:"DD",value:"COMMON.LAT_LONG.DD_PLACEHOLDER"}]},REGISTRATION_ENABLE:{key:"sumaris.registration.enable",label:"CONFIGURATION.OPTIONS.HOME.ENABLE_REGISTRATION",type:"boolean",defaultValue:!0},AUTH_TOKEN_TYPE:{key:"sumaris.auth.token.type",label:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE_PLACEHOLDER",type:"enum",values:[{key:"token",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.TOKEN"},{key:"basic",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.BASIC"},{key:"basic-and-token",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.BASIC_AND_TOKEN"}],defaultValue:"token"},GRAVATAR_ENABLE:{key:"sumaris.gravatar.enable",label:"CONFIGURATION.OPTIONS.ENABLE_GRAVATAR",type:"boolean",defaultValue:!1},GRAVATAR_URL:{key:"sumaris.gravatar.url",label:"CONFIGURATION.OPTIONS.GRAVATAR_URL",type:"string",defaultValue:"https://www.gravatar.com/avatar/{md5}"},TESTING:{key:"sumaris.testing.enable",label:"CONFIGURATION.OPTIONS.TESTING",type:"boolean"},APP_MIN_VERSION:{key:"sumaris.app.version.min",label:"CONFIGURATION.OPTIONS.APP_MIN_VERSION",type:"string"},HELP_URL:{key:"sumaris.help.url",label:"CONFIGURATION.OPTIONS.HELP_URL",type:"string"},FORUM_URL:{key:"sumaris.forum.url",label:"CONFIGURATION.OPTIONS.FORUM_URL",type:"string"},LOGO_LARGE:{key:"sumaris.logo.large",label:"CONFIGURATION.OPTIONS.HOME.LOGO_LARGE",type:"string"},MENU_ITEMS:{key:"sumaris.menu.items",label:"CONFIGURATION.OPTIONS.MENU.ITEMS",type:"string"},HOME_PARTNERS_DEPARTMENTS:{key:"sumaris.partner.departments",label:"CONFIGURATION.OPTIONS.HOME.PARTNER_DEPARTMENTS",type:"string"},HOME_BACKGROUND_IMAGE:{key:"sumaris.background.images",label:"CONFIGURATION.OPTIONS.HOME.BACKGROUND_IMAGES",type:"string"},COLOR_PRIMARY:{key:"sumaris.color.primary",label:"CONFIGURATION.OPTIONS.COLORS.PRIMARY",type:"color"},COLOR_SECONDARY:{key:"sumaris.color.secondary",label:"CONFIGURATION.OPTIONS.COLORS.SECONDARY",type:"color"},COLOR_TERTIARY:{key:"sumaris.color.tertiary",label:"CONFIGURATION.OPTIONS.COLORS.TERTIARY",type:"color"},COLOR_SUCCESS:{key:"sumaris.color.success",label:"CONFIGURATION.OPTIONS.COLORS.SUCCESS",type:"color"},COLOR_WARNING:{key:"sumaris.color.warning",label:"CONFIGURATION.OPTIONS.COLORS.WARNING",type:"color"},COLOR_ACCENT:{key:"sumaris.color.accent",label:"CONFIGURATION.OPTIONS.COLORS.ACCENT",type:"color"},COLOR_DANGER:{key:"sumaris.color.danger",label:"CONFIGURATION.OPTIONS.COLORS.DANGER",type:"color"},ANDROID_INSTALL_URL:{key:"sumaris.android.install.url",label:"CONFIGURATION.OPTIONS.ANDROID_INSTALL_URL",type:"string"}}),vl="configuration",Cl={config:yt.gql(hl||(hl=Se(["\n fragment ConfigFragment on ConfigurationVO {\n id\n label\n name\n description\n comments\n properties\n smallLogo\n largeLogo\n backgroundImages\n partners {\n id\n label\n name\n logo\n siteUrl\n __typename\n }\n updateDate\n creationDate\n statusId\n __typename\n }\n "],["\n fragment ConfigFragment on ConfigurationVO {\n id\n label\n name\n description\n comments\n properties\n smallLogo\n largeLogo\n backgroundImages\n partners {\n id\n label\n name\n logo\n siteUrl\n __typename\n }\n updateDate\n creationDate\n statusId\n __typename\n }\n "])))},El=yt.gql(ml||(ml=Se(["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"],["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"])),Cl.config),wl=yt.gql(fl||(fl=Se(["\n mutation SaveConfiguration($data: ConfigurationVOInput){\n data: saveConfiguration(config: $data){\n ...ConfigFragment\n }\n }\n ","\n"],["\n mutation SaveConfiguration($data: ConfigurationVOInput){\n data: saveConfiguration(config: $data){\n ...ConfigFragment\n }\n }\n ","\n"])),Cl.config),Il=yt.gql(gl||(gl=Se(["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"],["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"]))),Ol=yt.gql(bl||(bl=Se(["\n query CacheStatistics {\n cacheStatistics\n }\n"],["\n query CacheStatistics {\n cacheStatistics\n }\n"]))),_l=new e.InjectionToken("defaultOptions"),xl=function(e){function n(t,n,o,r,i,a,s,l,c){var u=e.call(this,n,l)||this;return u.platform=t,u.graphql=n,u.storage=o,u.network=r,u.file=i,u.toastController=a,u.translate=s,u.environment=l,u.$data=new D.BehaviorSubject(null),u._debug=!l.production,u._debug&&console.debug("[config] Creating service"),u._optionDefs=Object.values(Object.assign(Object.assign({},yl),c)),u}return Ee(n,e),Object.defineProperty(n.prototype,"config",{get:function(){return this.started||this.start(),this.$data.pipe(N.filter(Re))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[config] Starting configuration..."),[4,this.loadOrRestoreLocally()];case 1:return t=n.sent(),this.$data.next(t),this.registerSubscription(this.graphql.onStart.subscribe((function(){return e.restart()}))),[2,t]}}))}))},n.prototype.loadDefault=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return n=Date.now(),console.debug("[config] Loading Pod configuration..."),o=e&&e.query||El,r=e&&e.variables||void 0,[4,this.graphql.query({query:o,variables:r,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:e&&e.fetchPolicy||void 0})];case 1:return i=s.sent(),a=i&&i.data?t.Configuration.fromObject(i.data):void 0,console.info("[config] Pod configuration loaded in "+(Date.now()-n)+"ms:",a),[2,a]}}))}))},n.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return console.warn("[config] Invalid call of configService.load(id). Please use loadDefault() instead"),[2,this.loadDefault()]}))}))},n.prototype.save=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return console.debug("[config] Saving Pod configuration...",t),e=t.asObject(),[4,this.graphql.mutate({mutation:wl,variables:{data:e},error:{code:Ha,message:"ERROR.SAVE_CONFIG_ERROR"}})];case 1:return n=a.sent(),o=n&&n.data,t.id=o&&o.id||t.id,t.updateDate=o&&o.updateDate||t.updateDate,console.debug("[config] Pod configuration saved!"),[4,this.loadDefault({fetchPolicy:"network-only"})];case 2:return r=a.sent(),Re(i=this.$data.value)&&r.label===i.label&&this.$data.next(r),[2,r]}}))}))},n.prototype.getCacheStatistics=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=Date.now(),console.debug("[config] Loading server cache statistics..."),[4,this.graphql.query({query:Ol,variables:null,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"network-only"})];case 1:return e=o.sent(),n=e&&e.cacheStatistics||void 0,console.info("[config] Server cache statistics loaded in "+(Date.now()-t)+"ms:",n),[2,n]}}))}))},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return e=Date.now(),console.debug("[config] Clear server cache..."),n={name:t&&t.cacheName}||void 0,[4,this.graphql.query({query:Il,variables:n,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"network-only"})];case 1:return o=i.sent(),r=o&&o.clearCache||void 0,console.info("[config] Clear server cache in "+(Date.now()-e)+"ms:",r),[2,r]}}))}))},n.prototype.delete=function(t,e){throw new Error("Not implemented yet!")},n.prototype.listenChanges=function(t,e){return new D.Subject},Object.defineProperty(n.prototype,"optionDefs",{get:function(){return this._optionDefs},enumerable:!1,configurable:!0}),n.prototype.loadOrRestoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n=this;return Oe(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.loadDefault({fetchPolicy:"network-only"})];case 2:return t=o.sent(),!0,[3,4];case 3:return e=o.sent(),console.error(e&&e.message||e,e),[3,4];case 4:return t?(setTimeout((function(){return n.storeLocally(t)}),1e3),[3,7]):[3,5];case 5:return[4,this.restoreLocally()];case 6:t=o.sent(),o.label=7;case 7:return t.label=t.label||this.environment.name,t.name=t.name!==t.label?t.name:void 0,[2,t]}}))}))},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.storage.get(vl)];case 1:if(n=o.sent()){if(console.debug("[config] Restoring configuration from local storage..."),"string"==typeof n)try{e=t.Configuration.fromObject(JSON.parse(n))}catch(t){console.error("Failed to parse config found in local storage: "+(t&&t.message||t),t)}else"object"==typeof n&&(e=t.Configuration.fromObject(n));console.debug("[config] Restoring configuration [OK]")}return e||(console.debug("[config] No configuration found. Using environment..."),e=t.Configuration.fromObject(this.environment)),[2,e]}}))}))},n.prototype.storeLocally=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return t?[3,2]:[4,this.storage.remove(vl)];case 1:return s.sent(),[3,8];case 2:if(e=this._debug&&Date.now(),!this.network.online||!this.platform.is("mobile"))return[3,6];if(n=[],t.largeLogo&&t.largeLogo.startsWith("http")&&n.push(this.file.getImage(t.largeLogo).then((function(e){return t.largeLogo=e}))),t.smallLogo&&t.smallLogo.startsWith("http")&&n.push(this.file.getImage(t.smallLogo).then((function(e){return t.smallLogo=e}))),Ne(t.backgroundImages)&&(o={maxWidth:this.platform.width(),maxHeight:this.platform.height()},-1!==(r=t.backgroundImages.findIndex((function(t){return t&&t.startsWith("http")})))&&(t.backgroundImages=t.backgroundImages.slice(),n.push(this.file.getImage(t.backgroundImages[r],o).then((function(e){return t.backgroundImages[r]=e}))))),Ne(t.partners)&&t.partners.forEach((function(t,e){t&&t.logo&&t.logo.startsWith("http")&&n.push(a.file.getImage(t.logo,{maxHeight:50}).then((function(e){return t.logo=e})).catch((function(e){console.error(e&&e.message||e),delete t.logo})))})),!n.length)return[3,6];this._debug&&console.debug("[config] Fetching "+n.length+" images..."),s.label=3;case 3:return s.trys.push([3,5,,6]),[4,Promise.all(n)];case 4:return s.sent(),this._debug&&console.debug("[config] Fetching "+n.length+" images [OK] in "+(Date.now()-e)+"ms"),[3,6];case 5:return i=s.sent(),console.error("[config] Failed to fetch image(s): "+(i&&i.message||i),i),[3,6];case 6:return e=this._debug&&Date.now(),this._debug&&console.debug("[config] Saving config into local storage..."),[4,this.storage.set(vl,t.asObject())];case 7:s.sent(),this._debug&&console.debug("[config] Saving config into local storage [OK] in "+(Date.now()-e)+"ms"),s.label=8;case 8:return[2]}}))}))},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},n}(Ls);xl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new xl(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Ns),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Ca),jt.ɵɵinject(Li),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(me),jt.ɵɵinject(_l,8))},token:xl,providedIn:"root"}),xl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[_l]}]}],xl.ctorParameters=function(){return[{type:M.Platform},{type:Ns},{type:st.Storage},{type:Ca},{type:Li},{type:M.ToastController},{type:F.TranslateService},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[_l]}]}]};var kl=Ht,Sl=function(t){function e(e,n,o,r,i,a,s,l,c,u,d,p,h,m,f,g,b,y,v){var C=t.call(this,e)||this;return C.platform=e,C.cdkPlatform=n,C.toastController=o,C.translate=r,C.dateAdapter=i,C.entitiesStorage=a,C.settings=s,C.networkService=l,C.accountService=c,C.configService=u,C.cache=d,C.storage=p,C.audioProvider=h,C.environment=m,C.statusBar=f,C.keyboard=g,C.splashScreen=b,C.browser=y,C.downloader=v,C._downloadingJobs=new Map,C._debug=!m.production,C._debug&&console.debug("[platform] Creating service"),C}return Ee(e,t),Object.defineProperty(e.prototype,"mobile",{get:function(){return Re(this._mobile)?this._mobile:this.platform.is("mobile")},enumerable:!1,configurable:!0}),e.prototype.is=function(t){return this.platform.is(t)},e.prototype.isWebOrDesktop=function(){return!this.platform.is("mobile")||this.platform.is("mobileweb")},e.prototype.isAndroidCordova=function(){return this._android&&this._cordova},Object.defineProperty(e.prototype,"canDownload",{get:function(){return Re(this.downloader)},enumerable:!1,configurable:!0}),e.prototype.width=function(){return this.platform.width()},e.prototype.height=function(){return this.platform.height()},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:t=Date.now(),this.accountService.tokenType=void 0,console.info("[platform] Starting platform..."),r.label=1;case 1:return r.trys.push([1,6,,7]),this._mobile=this.platform.is("mobile"),this._cordova=this.platform.is("cordova"),this._android=this.platform.is("android"),this.configureCordovaPlugins(this._mobile),this.touchUi=this._mobile||this.platform.is("tablet")||this.platform.is("phablet"),this._mobile&&(this.settings.mobile=this._mobile,this.settings.touchUi=this.touchUi),[4,this.configureTranslate()];case 2:return r.sent(),[4,this.storageReady()];case 3:return e=r.sent(),[4,this.migrateStorage(e)];case 4:return r.sent(),[4,Promise.all([this.entitiesStorage.ready(),this.cache.ready().then((function(){return o.configureCache()})),this.settings.ready(),this.networkService.ready(),this.audioProvider.ready()])];case 5:return r.sent(),console.info("[platform] Starting platform [OK] {mobile: "+this._mobile+", touchUi: "+this.touchUi+", downloader: "+this.canDownload+"} in "+(Date.now()-t)+"ms"),this.networkService.onNetworkStatusChanges.pipe(N.skip(1)).subscribe((function(t){return o.configureCache("none"!==t)})),this.configService.config.pipe(N.map((function(t){return null==t?void 0:t.getProperty(yl.AUTH_TOKEN_TYPE)})),N.filter(Pe),N.distinctUntilChanged()).subscribe((function(t){console.info("[platform] Using auth token type {"+t+"}"),o.accountService.tokenType=t})),this.mobile&&setTimeout((function(){var t;null===(t=o.splashScreen)||void 0===t||t.hide(),o.audioProvider.playStartupSound()}),1e3),[3,7];case 6:return n=r.sent(),[2,this.onStartupError(n)];case 7:return[2]}}))}))},e.prototype.open=function(t,e,n,o){console.info("[platform] Opening link: "+t),this.browser&&this._mobile?this.browser.create(t,e,n).show():window.open(t,e,n,o)},e.prototype.getDownloadingJob=function(t){return this._downloadingJobs.get(t)},e.prototype.download=function(t){var e=this;if(!t||!t.uri)throw new Error("Missing argument 'request' or 'request.uri'");if(this._android&&this.downloader){var n=this._downloadingJobs.get(t.uri);return n||(t=Object.assign(Object.assign({visibleInDownloadsUi:!0,notificationVisibility:St.NotificationVisibility.VisibleNotifyCompleted,title:t.title||t.filename},t),{destinationInExternalFilesDir:Object.assign({dirType:"Downloads",subPath:t.filename||t.title||""},t.destinationInExternalFilesDir)}),console.debug("[platform] Downloading, using request: "+JSON.stringify(t)),n=D.from(this.downloader.download(t)),this._downloadingJobs.set(t.uri,n),n.pipe(N.tap((function(n){console.info("[platform] File successfully downloaded at:"+n),e._downloadingJobs.delete(t.uri)})),N.catchError((function(n){throw console.error("[platform] Unable to download: "+(n&&n.message||n)),e._downloadingJobs.delete(t.uri),n}))))}return console.warn("[platform] Cannot use Android downloader: using browser open()"),this.open(t.uri,"_system","location=no",!0),D.of()},e.prototype.configureCordovaPlugins=function(t){console.info("[platform] Configuring Cordova plugins..."),this.statusBar&&(this.statusBar.styleDefault(),this.statusBar.overlaysWebView(!1)),this.keyboard&&this.keyboard.hideFormAccessoryBar(!0),this.browser},e.prototype.configureTranslate=function(){var t=this;console.info("[platform] Configuring i18n ..."),this.translate.setDefaultLang(this.environment.defaultLocale),this.translate.onLangChange.subscribe((function(e){if(e&&e.lang){"en"===e.lang&&(e.lang="en_GB");try{kl.locale(e.lang),console.debug("[platform] Use locale {"+e.lang+"}")}catch(t){kl.locale("en"),console.warn("[platform] Unknown local for moment lib. Using default [en]")}t.dateAdapter.setLocale(kl.locale())}})),this.settings.onChange.subscribe((function(e){e&&e.locale&&e.locale!==t.translate.currentLang&&t.translate.use(e.locale)})),this.accountService.onLogin.subscribe((function(e){if(e.settings&&t.settings.settings.accountInheritance){var n=e.settings.asLocalSettings();t.settings.apply(n)}}))},e.prototype.configureCache=function(t){var e=(t=je(t,this.cache.isOnline()))?3600:2592e3;console.info("[platform] Configuring cache [OK] {online: "+t+", timeToLive: "+e/3600+"h, offlineInvalidate: false}"),this.cache.setDefaultTTL(e),this.cache.setOfflineInvalidate(!1)},e.prototype.storageReady=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return console.info("[platform] Starting storage..."),[4,this.storage.ready()];case 1:return t=e.sent(),Ae(t.driver())?(console.error("[platform] NO DRIVER DEFINED IN STORAGE. Local storage cannot be used !"),[2,Promise.resolve(t)]):(console.info("[platform] Starting storage [OK] {name: '"+t.config().name+"', driver: '"+t.driver()+"', size: "+t.config().size),console.debug("[platform] Storage supports: {"+t.WEBSQL+": "+t.supports(t.WEBSQL)+", "+t.INDEXEDDB+": "+t.supports(t.INDEXEDDB)+", "+t.LOCALSTORAGE+": "+t.supports(t.LOCALSTORAGE)+"}"),[2,t])}}))}))},e.prototype.migrateStorage=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return t&&("cordovaSQLiteDriver"===t.driver()&&(t.supports(t.INDEXEDDB)||t.supports(t.WEBSQL))||t.driver()===t.WEBSQL&&t.supports(t.INDEXEDDB))?[4,(e=t.createInstance({name:t.config().name,storeName:t.config().storeName,driver:[t.INDEXEDDB,t.WEBSQL]})).keys()]:[2];case 1:return Fe(n=s.sent())?(console.debug("[platform] Old storage is empty: dropping unused instance {name: '"+t.config().name+"', driver: '"+e.driver()+"'}"),[4,e.dropInstance()]):[3,3];case 2:return s.sent(),[3,12];case 3:return o=Date.now(),console.info("[platform] Starting storage migration..."),[4,this.showToast({message:"INFO.DATA_MIGRATION_STARTED",duration:3e4})];case 4:r=s.sent(),s.label=5;case 5:return s.trys.push([5,9,,12]),[4,os.copy(e,t,{keys:n,deleteAfterCopy:!1})];case 6:return s.sent(),i=Date.now()-o,setTimeout((function(){return r.dismiss()}),Math.max(2e3-i,0)),[4,this.showToast({message:"INFO.DATA_MIGRATION_SUCCEED",type:"info",showCloseButton:!0})];case 7:return s.sent(),console.info("[platform] Starting storage migration [OK]"),console.info("[platform] Drop old storage {name: '"+t.config().name+"', driver: '"+e.driver()+"'}"),[4,e.dropInstance()];case 8:return s.sent(),[3,12];case 9:return a=s.sent(),console.error(a&&a.message||a,a),[4,r.dismiss()];case 10:return s.sent(),[4,this.showToast({message:"ERROR.DATA_MIGRATION_FAILED",type:"error",showCloseButton:!0})];case 11:return s.sent(),[3,12];case 12:return[2]}}))}))},e.prototype.showToast=function(t){var e=this;if(!this.toastController)throw new Error("Missing toastController in component's constructor");return new Promise((function(n){return ba.show(e.toastController,e.translate,Object.assign(Object.assign({},t),{onWillPresent:function(t){return n(t)}}))}))},e.prototype.onStartupError=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return console.error("[platform] Failed starting the platform! ",t),e=t&&t.message||t,n=t&&(t.details&&t.details.message||t.details),11===t.code&&this.cdkPlatform.FIREFOX&&(e="ERROR.FIREFOX_NO_STORAGE"),this.translate?[4,this.translate.get(e).toPromise()]:[3,2];case 1:return e=o.sent(),t&&t.code&&(e+=" {code: "+t.code+"}"),[3,3];case 2:e="Fatal error: Please contact your administrator.\n\n{code: "+(t&&t.code||"null")+', message: "'+e+'"}',o.label=3;case 3:return this.toastController?(n&&(e+="<br/><small>"+n+"</small>"),[4,this.showToast({type:"error",duration:-1,showCloseButton:!0,message:e})]):[3,5];case 4:return o.sent(),[3,6];case 5:window?(n&&(e+='\n\n{cause: "'+n+'"}'),window.alert(e)):(console.error(e),t&&t.details&&console.error("cause",t.details)),o.label=6;case 6:return[2]}}))}))},e}(_i);Sl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Sl(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(re.Platform),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Wt.MomentDateAdapter),jt.ɵɵinject(es),jt.ɵɵinject(ga),jt.ɵɵinject(Ca),jt.ɵɵinject(pl),jt.ɵɵinject(xl),jt.ɵɵinject(ee.CacheService),jt.ɵɵinject(te.Storage),jt.ɵɵinject(ki),jt.ɵɵinject(me),jt.ɵɵinject(ue.StatusBar,8),jt.ɵɵinject(de.Keyboard,8),jt.ɵɵinject(oe.SplashScreen,8),jt.ɵɵinject(pe.InAppBrowser,8),jt.ɵɵinject(he.Downloader,8))},token:Sl,providedIn:"root"}),Sl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sl.ctorParameters=function(){return[{type:M.Platform},{type:gt.Platform},{type:M.ToastController},{type:F.TranslateService},{type:j.MomentDateAdapter},{type:es},{type:ga},{type:Ca},{type:pl},{type:xl},{type:dt.CacheService},{type:st.Storage},{type:ki},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ft.StatusBar,decorators:[{type:e.Optional}]},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:bt.InAppBrowser,decorators:[{type:e.Optional}]},{type:St.Downloader,decorators:[{type:e.Optional}]}]};var Al=function(){function t(t,e,n,o,r,i){this.injector=t,this.viewCtrl=e,this.platform=n,this.settings=o,this.translate=r,this.cd=i,this.loading=!0,this.error=void 0,this.showError=!0}return t.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.viewCtrl.dismiss()];case 1:return t.sent(),[2]}}))}))},t.prototype.markAsLoaded=function(){this.loading=!1,this.error=null},t.prototype.onLoadError=function(t){console.error(t),this.error=t,this.loading=!1},t}();Al.decorators=[{type:e.Component,args:[{selector:"app-help-modal",template:'<app-modal-toolbar color="light"\n [title]="title"\n (cancel)="close($event)"\n [showSpinner]="loading">\n</app-modal-toolbar>\n\n<ion-content class="ion-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error && showError" visible-xs visible-sm visible-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <markdown *ngIf="markdownContent"\n [data]="markdownContent"\n (ready)="markAsLoaded()"\n emoji>\n </markdown>\n\n <markdown *ngIf="docUrl"\n [src]="docUrl + \'.md\'"\n (load)="markAsLoaded()"\n (error)="onLoadError($event)"\n emoji></markdown>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="tertiary" (click)="close()">{{\'COMMON.BTN_CLOSE\'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n\n\n'}]}],Al.ctorParameters=function(){return[{type:e.Injector},{type:M.ModalController},{type:Sl},{type:ga},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Al.propDecorators={title:[{type:e.Input}],markdownContent:[{type:e.Input}],docUrl:[{type:e.Input}],showError:[{type:e.Input}]};var Tl=function(t){function e(e){var n=t.call(this)||this;return n.translate=e,e.onLangChange.subscribe((function(){return n.translateLabels()})),n.translateLabels(),n}return Ee(e,t),e.prototype.translateLabels=function(){this.optionalLabel=this.translate.instant("COMMON.OPTIONAL")},e}(w.MatStepperIntl);function Rl(t){return function(){return t.scrollStrategies.close()}}Tl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Tl(jt.ɵɵinject($t.TranslateService))},token:Tl,providedIn:"root"}),Tl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tl.ctorParameters=function(){return[{type:F.TranslateService}]};var Pl=function(){function t(){}return t.forRoot=function(e){return console.debug("[shared] Creating module (root)"),{ngModule:t,providers:[{provide:me,useValue:e},di,ki,Li,ko,Mn,Bn,jn,Xn,Jn,Zn,eo,to,{provide:i.OverlayContainer,useClass:i.FullscreenOverlayContainer},{provide:Q.HTTP_INTERCEPTORS,useClass:bi,multi:!0,deps:[di]},{provide:u.MatPaginatorIntl,useClass:gi,deps:[F.TranslateService]},{provide:w.MatStepperIntl,useClass:Tl,deps:[F.TranslateService]},{provide:R.MAT_AUTOCOMPLETE_SCROLL_STRATEGY,useFactory:Rl,deps:[i.Overlay]},{provide:R.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,useValue:{autoActiveFirstOption:!0}},{provide:v.MAT_SELECT_SCROLL_STRATEGY,useFactory:Rl,deps:[i.Overlay]}]}},t}();Pl.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,F.TranslateModule,Y.ColorPickerModule,U.TextMaskModule,rt.DragDropModule,it.MarkdownModule,ui,pr,ur,Ti],declarations:[fi,ji,Oi,Bi,Al],exports:[n.CommonModule,M.IonicModule,F.TranslateModule,P.ReactiveFormsModule,Y.ColorPickerModule,U.TextMaskModule,rt.DragDropModule,it.MarkdownModule,ui,pr,ur,Ti,fi,ji,Oi,Bi,Al]}]}];var Dl=function(){function t(){}return t.askSaveBeforeLeave=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return o=!1,r=!1,i=e.instant(["COMMON.BTN_SAVE","COMMON.BTN_CANCEL","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE","CONFIRM.ALERT_HEADER"]),[4,t.create({header:i["CONFIRM.ALERT_HEADER"],message:i["CONFIRM.SAVE"],buttons:[{text:i["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){r=!0}},{text:i["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){}},{text:i["COMMON.BTN_SAVE"],handler:function(){o=!0}}]})];case 1:return[4,(a=s.sent()).present()];case 2:return s.sent(),[4,a.onDidDismiss()];case 3:return s.sent(),o?[2,!0]:r?(n&&n.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askActionConfirmation=function(e,n,o,r,i){return Ie(this,void 0,void 0,(function(){var a;return Oe(this,(function(s){return a=!0===o?"CONFIRM.ACTION_IMMEDIATE":"CONFIRM.ACTION",[2,t.askConfirmation(a,e,n,r,i)]}))}))},t.askConfirmation=function(t,e,n,o,r){return Ie(this,void 0,void 0,(function(){var i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:if(!e||!n)throw new Error("Missing required argument 'alertCtrl' or 'translate'");return i=!1,a=!1,s=n.instant(["COMMON.BTN_YES_CONTINUE","COMMON.BTN_CANCEL",t,"CONFIRM.ALERT_HEADER"],r),[4,e.create({header:s["CONFIRM.ALERT_HEADER"],message:s[t],buttons:[{text:s["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){a=!0}},{text:s["COMMON.BTN_YES_CONTINUE"],handler:function(){i=!0}}]})];case 1:return[4,(l=c.sent()).present()];case 2:return c.sent(),[4,l.onDidDismiss()];case 3:return c.sent(),i?[2,!0]:a?(o&&o.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askDeleteConfirmation=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var r,i,a,s;return Oe(this,(function(l){switch(l.label){case 0:return r=!1,i=!1,a=e.instant(["COMMON.BTN_YES_DELETE","COMMON.BTN_CANCEL","CONFIRM.DELETE","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:a["CONFIRM.ALERT_HEADER"],message:a["CONFIRM.DELETE"],buttons:[{text:a["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){i=!0}},{text:a["COMMON.BTN_YES_DELETE"],handler:function(){r=!0}}]})];case 1:return[4,(s=l.sent()).present()];case 2:return l.sent(),[4,s.onDidDismiss()];case 3:return l.sent(),r?[2,!0]:i?(n&&n.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askSaveBeforeAction=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var r,i,a,s;return Oe(this,(function(l){switch(l.label){case 0:return r=!1,i=!1,n&&n.valid?(s=e.instant(["COMMON.BTN_CANCEL","COMMON.BTN_SAVE","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE_BEFORE_CONTINUE","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:s["CONFIRM.ALERT_HEADER"],message:s["CONFIRM.SAVE_BEFORE_CONTINUE"],buttons:[{text:s["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){}},{text:s["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){i=!0}},{text:s["COMMON.BTN_SAVE"],handler:function(){r=!0,i=!0}}]})]):[3,2];case 1:return a=l.sent(),[3,4];case 2:return s=e.instant(["COMMON.BTN_ABORT_CHANGES","COMMON.BTN_CANCEL","CONFIRM.CANCEL_CHANGES","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:s["CONFIRM.ALERT_HEADER"],message:s["CONFIRM.CANCEL_CHANGES"],buttons:[{text:s["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){i=!0}},{text:s["COMMON.BTN_CANCEL"],role:"cancel",handler:function(){}}]})];case 3:a=l.sent(),l.label=4;case 4:return[4,a.present()];case 5:return l.sent(),[4,a.onDidDismiss()];case 6:return l.sent(),[2,{confirmed:i,save:r}]}}))}))},t.showError=function(t,e,n,o,r){return Ie(this,void 0,void 0,(function(){var i,a,s;return Oe(this,(function(l){switch(l.label){case 0:if(!t||!e||!n)throw new Error("Missing a required argument ('messageKey', 'alertCtrl' or 'translate')");return i=o&&o.titleKey||"ERROR.ALERT_HEADER",a=n.instant(["COMMON.BTN_OK",t,i],r),[4,e.create({header:a[i],message:a[t],buttons:[{text:a["COMMON.BTN_OK"],role:"cancel"}]})];case 1:return[4,(s=l.sent()).present()];case 2:return l.sent(),[4,s.onDidDismiss()];case 3:return l.sent(),[2]}}))}))},t}(),Nl=function(){function t(t,e){this.translate=t,this.alertCtrl=e,this.debug=!1}return t.prototype.canDeactivate=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=t.dirty,n=t.valid,o={confirmed:!e,save:!1},this.debug&&console.debug("[dirty-guard] canDeactivate component dirty: "+e+", valid: "+n),e?[4,Dl.askSaveBeforeAction(this.alertCtrl,this.translate,{valid:n})]:[3,2];case 1:o=r.sent(),r.label=2;case 2:return this.debug&&console.debug("[dirty-guard] confirm: "+o.confirmed),o.confirmed?o.save?(this.debug&&console.debug("[dirty-guard] do save"),[4,t.save()]):[3,4]:[3,6];case 3:return r.sent()?[3,5]:(this.debug&&console.debug("[dirty-guard] save failed, cancel deactivate"),[2,!1]);case 4:this.debug&&console.debug("[dirty-guard] do cancel"),e&&t.cancel(),r.label=5;case 5:return[2,!0];case 6:return[2,!1]}}))}))},t}();Nl.decorators=[{type:e.Injectable}],Nl.ctorParameters=function(){return[{type:F.TranslateService},{type:M.AlertController}]};var Fl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.prototype.shouldReuseRoute=function(e,n){var o=t.prototype.shouldReuseRoute.call(this,e,n);if(!o&&e.routeConfig&&e.routeConfig===n.routeConfig){var r=e.routeConfig.data&&e.routeConfig.data.pathIdParam||"id",i="new"===n.params[r]?n.queryParams[r]||n.queryParams.id||"new":n.params[r],a="new"===e.params[r]?e.queryParams[r]||e.queryParams.id||"new":e.params[r];return"new"!==a&&"new"!==i&&a===i}return o},e}(M.IonicRouteStrategy);Fl.decorators=[{type:e.Injectable}];var Ml=function(){console.debug("[shared-routing] Creating module...")};Ml.decorators=[{type:e.NgModule,args:[{imports:[z.RouterModule],providers:[{provide:z.RouteReuseStrategy,useClass:Fl},{provide:Nl,useClass:Nl}]}]}],Ml.ctorParameters=function(){return[]};var Ll=function(){function t(){}return t.prototype.getAsBoolean=function(t,e){var n=this.get(t,e);return Re(n)?n&&"false"!==n:void 0},t.prototype.getAsInt=function(t,e){var n=this.get(t,e);return Re(n)?parseInt(n):void 0},t.prototype.getAsNumbers=function(t,e){var n=this.get(t,e);return"string"==typeof n?n.split(",").map(parseFloat)||void 0:Re(n)?[parseFloat(n)]:void 0},t.prototype.getAsStrings=function(t,e){var n=this.get(t,e);return n&&n.split(",")||void 0},t.prototype.get=function(t,e){return Re(t[e.key])?t[e.key]:e.defaultValue||void 0},t}();var jl=function(){function t(){}return t.prototype.ngOnDestroy=function(){},t}();jl.decorators=[{type:e.Directive}];var Bl=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.asPodObject=function(){return this.asObject(ys)},e.prototype.isEmpty=function(){return 0===this.countNotEmptyCriteria()},e.prototype.countNotEmptyCriteria=function(){var t=this,e=this.asPodObject();return Object.keys(e).filter((function(n){return t.isCriteriaNotEmpty(n,e[n])})).length},e.prototype.asFilterFn=function(){var t=this.buildFilter();if(!Fe(t))return function(e){return!t.find((function(t){return!t(e)}))}},e.prototype.buildFilter=function(){return[]},e.prototype.isCriteriaNotEmpty=function(t,e){return null!=e&&("string"==typeof e&&""!==e.trim()||"number"==typeof e&&!isNaN(e)||"boolean"==typeof e||e.length>0||gs.isNotEmpty(e))},e}(Wi),Ul=function(){function t(){}return t.isEntityFilter=function(t){return!!(t&&t.asPodObject&&t.asFilterFn)},t.fromObject=function(e,n){if(!e)return e;if(zi(e,n))return e;var o=new n;return t.isEntityFilter(o)?o.fromObject(e):Object.assign(o,e),o},t}(),Vl=function(t){function e(e,n,o){var r=t.call(this)||this;return r.dataType=e,r.filterType=n,r.debug=!1,r.dirty=!1,r._saving=!1,r._onChange=new D.BehaviorSubject(!0),o=Object.assign({onSort:r.sort},o),r._sortFn=o.onSort,r._onLoad=o.onLoad,r._onSaveFn=o.onSave,r._equalsFn=o.equals,r._filterFnFactory=o.filterFnFactory||function(t){var e=r.asFilter(t);if(e instanceof Bl)return e.asFilterFn()},r._sortByReplacement=Object.assign({id:-1!==Object.getOwnPropertyNames(new e).findIndex((function(t){return"rankOrder"===t}))?"rankOrder":void 0},o.sortByReplacement),r}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.data},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),e.prototype.ngOnDestroy=function(){this.debug&&console.debug("[memory-data-service] Destroying..."),this._onChange.complete(),this._onChange.unsubscribe()},e.prototype.setValue=function(t,e){this.data!==t&&(this._hiddenData=[],this.data=t,e&&!1===e.emitEvent||this._onChange.next(!0)),this.dirty=!1},e.prototype.watchAll=function(t,e,n,o,r,i){var a=this;return t=t>=0?t:0,e=e>=0?e:-1,this.data||console.warn("[memory-data-service] Waiting value to be set..."),this._onChange.pipe(N.filter(Re),N.mergeMap((function(t){return kn((function(){return!a._saving}))})),N.mergeMap((function(i){return Ie(a,void 0,void 0,(function(){var i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:i=[],d.label=1;case 1:return d.trys.push([1,,6,7]),Fe(this.data)?[2,{data:[],total:0}]:(s=this._sortFn(this.data||[],n,o),this._onLoad?(l=this._onLoad(s))instanceof Promise?[4,l]:[3,3]:[3,5]);case 2:return c=d.sent(),[3,4];case 3:c=l,d.label=4;case 4:s=c,d.label=5;case 5:return s=this.filter(s,r,i),u=s.length,0===e?(a=s,[2,{data:[],total:u}]):(t>0?t>=s.length?(a=s,s=[]):(a=e>0&&t+e<s.length?s.slice(0,t-1).concat(s.slice(t+e)):s.slice(0,t-1),s=e>0&&t+e<s.length?s.slice(t,t+e):s.slice(t)):e>0&&(a=s.slice(e),s=s.slice(0,e)),s===this.data&&(s=s.slice()),[2,{data:s,total:u}]);case 6:return this._hiddenData=a?i.concat.apply(i,ke(a)):i,[7];case 7:return[2]}}))}))})))},e.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:if(!this.data)throw new Error("[memory-service] Could not save, because value not set");this.markAsSaving(),o.label=1;case 1:return o.trys.push([1,,6,7]),Ne(this._hiddenData)&&(t=t.concat.apply(t,ke(this._hiddenData))),this._onSaveFn?(e=this._onSaveFn(t))instanceof Promise?[4,e]:[3,3]:[3,5];case 2:return n=o.sent(),[3,4];case 3:n=e,o.label=4;case 4:t=n,o.label=5;case 5:return this.data=t,this.dirty=!0,[2,this.data];case 6:return this.markAsSaved(),[7];case 7:return[2]}}))}))},e.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){if(!this.data)throw new Error("[memory-service] Could not delete, because value not set");return e=this.data.filter((function(e){return!(-1!==t.findIndex((function(t){return n.equals(t,e)})))})),this.data.length-e.length>0&&(this.data=e,this.dirty=!0,this._onChange.next(!0)),[2]}))}))},e.prototype.sort=function(t,e,n){return e=e&&this._sortByReplacement[e]||e||"id",Qi.sort(t,e,n)},e.prototype.asFilter=function(t){return Ul.fromObject(t,this.filterType)},e.prototype.addSortByReplacement=function(t,e){this._sortByReplacement[t]=e},e.prototype.equals=function(t,e){return this._equalsFn?this._equalsFn(t,e):t&&t.equals?t.equals(e):Qi.equals(t,e,"id")},e.prototype.filter=function(t,e,n){var o=this._filterFnFactory&&this._filterFnFactory(e);if(o){var r=[];return t.forEach((function(t){o(t)?r.push(t):n.push(t)})),r}return t},e.prototype.connect=function(){var t=this;return this._onChange.pipe(N.map((function(e){var n=t.data||[];return{data:n,total:n.length}})))},e.prototype.markAsSaving=function(){this._saving=!0},e.prototype.markAsSaved=function(){this._saving=!1},e}(jl);Vl.decorators=[{type:e.Directive}],Vl.ctorParameters=function(){return[{type:Function},{type:Function},{type:void 0}]};var ql=function(){function t(){}return t.defers=function(e,n){return e.map((function(e){return t.defer(e,n)}))},t.defer=function(e,n){return D.defer((function(){return t.run(e,n)}))},t.run=function(t,e){var n=new D.BehaviorSubject(0);return t(n,e).then((function(){e&&e.maxProgression&&n.next(e.maxProgression),n.complete()})).catch((function(t){return n.error(t)})),n},t.fetchAllPages=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p;return Oe(this,(function(h){switch(h.label){case 0:o=n&&n.maxProgression||void 0,l=n&&n.fetchSize||1e3,c=0,u=[],h.label=1;case 1:return n&&n.logPrefix&&console.debug(n.logPrefix+" Fetching page #"+c/l+"..."),[4,t(c,l)];case 2:d=h.sent(),u=u.concat(d.data),s=d.data&&d.data.length||0,c+=s,Ae(r)&&Re(d.total)&&(r=d.total,i=Math.round(d.total/l+.5),a=o?o/i:void 0),Re(a)&&e.next(e.getValue()+a),n&&n.onPageLoaded&&n.onPageLoaded(d),h.label=3;case 3:if(s>0&&(Ae(r)&&s===l||Re(r)&&c<r))return[3,1];h.label=4;case 4:return Re(a)?(Re(r)&&u.length<r&&(console.warn("A function loadAll() returned a bad total (less than all page's data)! Expected "+r+" but fetch "+u.length),r=u.length,i=Math.round(u.length/l+.5)),(p=n.maxProgression-a*i)>0&&e.next(e.getValue()+p)):n.maxProgression&&e.next(e.getValue()+n.maxProgression),[2,{data:u,total:r}]}}))}))},t}(),$l={white:[255,255,255],primary:[20,67,145],secondary:[117,196,253],tertiary:[91,94,244],danger:[245,61,61],light:[244,245,248],medium:[152,154,162],dark:[34,36,40],red:[255,0,0],green:[0,255,0],blue:[0,0,255]},Gl={},Hl=function(){function t(t,e,n){void 0===n&&(n="custom"),this._rgbArray=t,this._opacity=e,this._name=n}return t.get=function(t){return Gl[t]},t.parseRgba=function(e){if(!e||!e.startsWith("rgb(")&&!e.startsWith("rgba("))return null;var n=e.replace("rgb(","").replace("rgba(","").replace(")","").split(",");return 3!==n.length&&4!==n.length?null:new t([+n[0],+n[1],+n[2]],4===n.length&&+n[3]||1,"custom")},Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"opacity",{get:function(){return Re(this._opacity)?this._opacity:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgb",{get:function(){return this._rgbArray},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"r",{get:function(){return this._rgbArray[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"g",{get:function(){return this._rgbArray[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"b",{get:function(){return this._rgbArray[2]},enumerable:!1,configurable:!0}),t.prototype.rgba=function(t){return Ae(t=Re(t)?t:this._opacity)||t<0||t>1?"rgb("+this._rgbArray.join(",")+")":"rgba("+this._rgbArray.join(",")+","+t+")"},t}();Hl.transparent=function(){return new Hl([0,0,0],0,"translucent")};var Wl=function(){function t(t,e){this.colorArray=t;var n=(e=e||{}).upperMax?t.length-1:t.length;this._min=e.min||0,this._max=e.max||n,this._rangeSize=Math.round((this._max-this._min)/n),this._legendItems=this.computeLegend()}return t.default=function(){return t.custom(25)},t.fix=function(t,e){return Array.apply(null,Array(t||25)).map(String.prototype.valueOf,Hl.get(e||"primary").rgba(.5))},Object.defineProperty(t.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"legend",{get:function(){return{items:this._legendItems}},enumerable:!1,configurable:!0}),t.prototype.getValueColor=function(t){var e=Math.floor(t*(this.colorArray.length-1)/this._max);return this.colorArray[e]},t.prototype.computeLegend=function(){var t=this;return this.colorArray.map((function(e,n){var o=n*t._rangeSize,r=o+t._rangeSize;return{color:e,label:r<t._max?o.toLocaleString()+" - "+r.toLocaleString():" >= "+o}}))},t}();Wl.custom=function(t,e){return new Wl(function(t,e){if((e=e||{}).opacity=e.opacity>0&&e.opacity<1?e.opacity:1,e.startColor=e.startColor||[255,255,190],e.mainColorIndex=e.mainColorIndex&&e.mainColorIndex<t-1?e.mainColorIndex:t-1,e.endColor=e.endColor||[255,0,0],e.format=e.format||"rgb",e.mainColor){var n=zl(e.mainColorIndex+1,{opacity:e.opacity,startColor:e.startColor,endColor:e.mainColor,format:e.format});return e.mainColorIndex<t-1?n.concat(zl(t-e.mainColorIndex,{opacity:e.opacity,startColor:e.mainColor,endColor:e.endColor,format:e.format})):n}return zl(t,{opacity:e.opacity,startColor:e.startColor,endColor:e.endColor,format:e.format})}(t,{opacity:(e=e||{}).opacity,startColor:e.startColor||void 0,mainColor:e.mainColor||void 0,mainColorIndex:Re(e.mainColorIndex)?e.mainColorIndex:void 0,endColor:e.endColor||void 0,format:e.format}),e)},Object.getOwnPropertyNames($l).forEach((function(t){Gl[t]=new Hl($l[t],1,t)}));function zl(t,e){(e=e||{}).opacity=e.opacity>0&&e.opacity<1?e.opacity:1,e.startColor=e.startColor||[255,255,255],e.endColor=e.endColor||[255,0,0],e.format=e.format||"rgb";for(var n=[],o=e.startColor.slice(),r=[Math.round((e.endColor[0]-e.startColor[0])/t),Math.round((e.endColor[1]-e.startColor[1])/t),Math.round((e.endColor[2]-e.startColor[2])/t)],i=0;i<t-1;i++){for(var a=0;a<3;a++)o[a]+=r[a];n.push(o.slice())}return n.push(e.endColor.slice()),"array"===e.format?n:"rgb"===e.format?e.opacity>=1?n.map((function(t){return"rgb("+t.join(",")+")"})):n.map((function(t){return"rgba("+t.concat(e.opacity).join(",")+")"})):n}var Kl=[{id:1,label:"AAA",name:"Item A",description:"Very long description A",comments:"Very very long comments... again for A"},{id:2,label:"BBB",name:"Item B",description:"Very long description B",comments:"Very very long comments... again for B"},{id:3,label:"CCC",name:"Item C",description:"Very long description C",comments:"Very very long comments... again for C"}];function Ql(t,e){if(Ae(e))return(t||Kl).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||Kl).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var Yl=function(){function t(t){this.formBuilder=t,this._items=Ql(Kl,100),this.$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.memoryHide=!1,this.memoryMobile=!0,this.memoryAutocompleteFieldName="entity-$items",this.mode="mobile",this.form=t.group({entity:[null,Do.entity],missingEntity:[null,Do.entity],disableEntity:[null,Do.entity]}),this.form.get("disableEntity").disable()}return t.prototype.ngOnInit=function(){var t=this;this.autocompleteFields.add("entity-suggestFn",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString,showAllOnFocus:!1}),this.autocompleteFields.add("entity-items",{items:this._items.slice(),attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-$items",{items:this.$items,attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items-filter",{service:{suggest:function(e,n){return t.suggest(e,n)}},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items-large",{items:Kl.slice(),attributes:["label","name","description","comments"],displayWith:this.entityToString}),this.loadData()},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){return t={entity:Ql(Kl)[0],missingEntity:{id:-1,label:"??",name:"Missing item"},disableEntity:Ql(Kl)[2]},this.form.setValue(t),setTimeout((function(){return e.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.$items.next(this._items.slice()),[2]}))}))},t.prototype.entityToString=function(t){return[t&&t.label||void 0,t&&t.name||void 0].filter(Re).join(" - ")},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=We(this._items,t,Object.assign(Object.assign({},e),{searchAttributes:["label","name"]})),o=n.total||n.data.length,(r=e.offset+n.data.length)<o?(e=Object.assign(Object.assign({},e),{offset:r}),[2,{total:o,data:n.data,fetchMore:function(n){return Ie(i,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,nn(1e3)];case 1:return o.sent(),[2,this.suggest(t,Object.assign(Object.assign({},e),n))]}}))}))}}]):[2,n]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.compareWithFn=function(t,e){return t&&e&&t.id===e.id},t.prototype.toggleMode=function(t){this.mode!==t&&(this.mode=t,this.stopMemoryTimer())},t.prototype.startMemoryTimer=function(){var t=this;this.memoryTimer=setInterval((function(){t.memoryHide=!t.memoryHide}),50)},t.prototype.stopMemoryTimer=function(){clearInterval(this.memoryTimer),this.memoryTimer=null,this.memoryHide=!1},t.prototype.updateFilter=function(t){var e=this.autocompleteFields.get(t).filter||{};e.searchAttribute=e&&"name"===e.searchAttribute?"label":"name"},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();Yl.decorators=[{type:e.Component,args:[{selector:"app-autocomplete-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Autocomplete field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n \x3c!-- Tab nav - mobile/desktop mode --\x3e\n <nav mat-tab-nav-bar>\n <a mat-tab-link\n [active]="mode===\'mobile\'"\n (click)="toggleMode(\'mobile\')">\n <mat-label>Mobile</mat-label>\n </a>\n <a mat-tab-link [active]="mode===\'desktop\'"\n (click)="toggleMode(\'desktop\')">\n <mat-label>Desktop</mat-label>\n </a>\n <a mat-tab-link [active]="mode===\'memory\'"\n (click)="toggleMode(\'memory\')">\n <mat-label>Memory leak debug</mat-label>\n </a>\n <a mat-tab-link\n [active]="mode===\'temp\'"\n (click)="toggleMode(\'temp\')">\n <mat-label>Temporary</mat-label>\n </a>\n </nav>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n \x3c!--<ion-grid *ngIf="mode === \'temp\'">\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an Observable\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>items: Observable<any[]></pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [logPrefix]="\'[combo-desktop-2]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n\n </ion-card>\n </ion-col>\n </ion-row>\n\n\n </ion-grid>--\x3e\n\n\n <ion-grid *ngIf="mode === \'memory\'">\n\n \x3c!-- debugging memory leak --\x3e\n <ion-row>\n <ion-col>\n <ion-text><h4>Debug memory leak</h4></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col size="2">\n <mat-form-field floatLabel="always">\n <input matInput type="text" hidden placeholder="Items type">\n <mat-select (selectionChange)="memoryAutocompleteFieldName=$event.value" [value]="memoryAutocompleteFieldName">\n <mat-option value="entity-$items">Observable</mat-option>\n <mat-option value="entity-suggestFn">Suggest function</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n <ion-col size="1" class="ion-no-padding">\n <mat-form-field floatLabel="always">\n <input matInput type="text" hidden placeholder="Mobile ?">\n <mat-checkbox (change)="memoryMobile=$event.checked" [checked]="memoryMobile">\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n\n <ion-col size="2">\n <ion-button *ngIf="!memoryTimer" (click)="startMemoryTimer()" color="tertiary">Start</ion-button>\n <ion-button *ngIf="memoryTimer" (click)="stopMemoryTimer()" color="tertiary">Stop</ion-button>\n </ion-col>\n </ion-row>\n\n <ion-row>\n <ion-col>\n <mat-autocomplete-field formControlName="entity"\n *ngIf="!memoryHide && memoryAutocompleteFieldName"\n [config]="autocompleteFields.get(memoryAutocompleteFieldName)"\n [mobile]="memoryMobile"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-memory-leak]\'">\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n \x3c!-- Mobile mode --\x3e\n <ion-grid *ngIf="mode === \'mobile\'">\n\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Suggest() function\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, suggestFn: (searchText, filter) => any[]</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-1]\'"\n [required]="true"\n placeholder="Suggest field"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Items is an Observable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-observable]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Control value if missing in items\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="missingEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-2]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-2]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n\n <ion-row>\n <ion-col size="9">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Change filter\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <ion-button (click)="updateFilter(\'entity-items-filter\')">Filter on: {{autocompleteFields.get(\'entity-items-filter\').filter?.searchAttribute }}</ion-button>\n </ion-col>\n <ion-col>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-filter]\'"\n ></mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="3">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Large combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class="min-width-large"</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="true"\n class="min-width-large"\n panelWidth="400px"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-large]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Readonly toggle\n </ion-text>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid>\n <ion-row>\n <ion-col size="3">\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n Readonly ?\n </mat-checkbox>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <mat-autocomplete-field #readonlyField formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items\')"\n [placeholder]="\'Entity\'"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-readonly]\'"\n [readonly]="true"\n [clearable]="!readonlyField.readonly">\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Desktop mode --\x3e\n <ion-grid *ngIf="mode === \'desktop\'">\n <ion-row>\n <ion-col>\n <ion-text><h4>Desktop mode</h4></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n items from suggest function\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>suggest: (value, filter) => LoadResult<any>\nsuggestLengthThreshold: \'3\'</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [placeholder]="\'Entity\'"\n [mobile]="false"\n [compareWith]="compareWithFn"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-desktop-suggest]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an array\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: [], value: {{stringify(form.controls.entity.value)}}</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items\')"\n [logPrefix]="\'[combo-desktop-array-1]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an Observable\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [logPrefix]="\'[combo-desktop-2]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Control value if missing in items\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="missingEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-missing]\'"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Full size panel\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class: \'mat-autocomplete-panel-full-size\'</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [class]="\'mat-autocomplete-panel-full-size\'"\n [compareWith]="compareWithFn"\n [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-disable]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-readonly]\'"\n [readonly]="true"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n <ion-row>\n <ion-col size="9">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Full size combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class="mat-autocomplete-panel-full-size"</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="false"\n class="mat-autocomplete-panel-full-size"\n panelWidth="100vw"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="3">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Large combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>panelWidth: string</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="false"\n panelWidth="400px"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-large]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Readonly toggle\n </ion-text>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid>\n <ion-row>\n <ion-col size="3">\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n Readonly ?\n </mat-checkbox>\n </ion-col>\n <ion-col size="3">\n <mat-checkbox #showIcons [checked]="false">\n Icons ?\n </mat-checkbox>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <mat-autocomplete-field #readonlyField formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [placeholder]="\'Entity\'"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-readonly]\'"\n [readonly]="true"\n [clearable]="!readonlyField.readonly">\n <mat-icon matPrefix *ngIf="showIcons.checked">keyboard_arrow_right</mat-icon>\n <mat-icon matSuffix *ngIf="showIcons.checked">keyboard_arrow_left</mat-icon>\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],Yl.ctorParameters=function(){return[{type:P.FormBuilder}]};var Xl=function(){function t(t){this.formBuilder=t,this.stringify=JSON.stringify,this.form=t.group({empty:t.group({latitude:[null,P.Validators.compose([P.Validators.required,Do.latitude])],longitude:[null,P.Validators.compose([P.Validators.required,Do.longitude])]}),enable:t.group({latitude:[null,Do.latitude],longitude:[null,Do.longitude]}),disable:t.group({latitude:[null,Do.latitude],longitude:[null,Do.longitude]})});var e=this.form.get("disable");e.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return e.setValue(t)}))}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={empty:{latitude:null,longitude:null},enable:{latitude:50.1,longitude:-2},disable:{latitude:50.1,longitude:-2}},this.form.setValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.geoPosition=function(t){return console.debug("Click on geoLocation button",t),t.preventDefault(),t.stopPropagation(),!1},t}();Xl.decorators=[{type:e.Component,args:[{selector:"app-latlong-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Lat/Long field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n \x3c!-- Empty value --\x3e\n <form *ngIf="form.get(\'empty\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n <ion-row><ion-col><ion-text><h4>Empty, with defaults</h4></ion-text></ion-col></ion-row>\n\n <ion-row >\n\n \x3c!-- DD Default sign --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DD, defaultSign \'-\'\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DD"\n defaultSign="-"\n placeholder="Latitude">\n <mat-icon matPrefix>room</mat-icon>\n <button matSuffix mat-icon-button (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DD"\n defaultSign="-"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- DDMM Default sign --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMM, defaultSign \'+\'\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Latitude">\n\n <mat-icon matPrefix >room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Mobile + DDMM --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Mobile=true\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Latitude"\n mobile="true">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n <form *ngIf="form.get(\'enable\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n \x3c!-- With value --\x3e\n <ion-row><ion-col><ion-text><h4>With value</h4></ion-text></ion-col></ion-row>\n\n <ion-row>\n\n \x3c!-- DD --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DD\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DD"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DD"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- DDMMSS --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMM\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n\n \x3c!-- DDMMSS --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMMSS\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMMSS"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMMSS"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n \x3c!-- Disable --\x3e\n <form *ngIf="form.get(\'disable\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n <ion-row><ion-col><ion-text><h4>Disabled control</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude">\n <mat-icon matPrefix>room</mat-icon>\n <mat-icon matSuffix>gps_fixed</mat-icon>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly (control is enable)\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n </mat-checkbox>\n\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field #readonlyField [formControl]="form.get(\'enable.latitude\')"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude"\n [readonly]="true">\n <mat-icon matPrefix>room</mat-icon>\n <mat-icon matSuffix>gps_fixed</mat-icon>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n </form>\n\n</ion-content>\n'}]}],Xl.ctorParameters=function(){return[{type:P.FormBuilder}]};var Jl=new e.InjectionToken("testingPages"),Zl=function(){function t(t,e,n,o){this.route=t,this.router=e,this.translate=n,this.pages=o,console.log("Testing pages:",o)}return t.prototype.openPage=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,this.router.navigate([t],{relativeTo:this.route})]}))}))},t}();Zl.decorators=[{type:e.Component,args:[{selector:"app-material-testing",template:'\n<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Material components</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list>\n\n <ion-item-divider>Shared Material components</ion-item-divider>\n\n <ion-item tappable class="text-1x" (click)="openPage(\'./datetime\')">\n Date/Time field\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./autocomplete\')">\n Autocomplete field\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./latlong\')">\n Lat/Long field\n </ion-item>\n\x3c!-- <ion-item tappable class="text-1x" (click)="openPage(\'./numpad\')">--\x3e\n\x3c!-- Numeric pad component--\x3e\n\x3c!-- </ion-item>--\x3e\n <ion-item tappable class="text-1x" (click)="openPage(\'./swipe\')">\n Swipe component\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./chips\')">\n Chips component\n </ion-item>\n\n <ion-item-divider>Directive</ion-item-divider>\n <ion-item tappable class="text-1x" (click)="openPage(\'./badge-icon\')">\n Badge icon directive\n </ion-item>\n\n <ng-container *ngIf="pages && pages.length">\n <ion-item-divider>Other components</ion-item-divider>\n\n <ion-item *ngFor="let item of pages"\n tappable class="text-1x"\n (click)="openPage(item.page)">{{item.label}}</ion-item>\n\n </ng-container>\n </ion-list>\n\n</ion-content>\n'}]}],Zl.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:F.TranslateService},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Jl]}]}]};var tc=Ht,ec=function(){function t(t,e){this.formBuilder=t,this.dateFormatPipe=e,this.$dates=new D.BehaviorSubject(void 0),this._today=tc().startOf("day"),this.form=t.group({empty:[null,P.Validators.required],date:[null,P.Validators.compose([P.Validators.required,Do.validDate])],disabledEmpty:[null,P.Validators.required],disabledDate:[null,P.Validators.required]}),this.form.get("disabledEmpty").disable(),this.form.get("disabledDate").disable()}return t.prototype.ngOnInit=function(){for(var t=this,e=[],n=0;n<7;n++)e[n]=tc(this._today).add(n-3,"day");this.$dates.next(e),this.loadData(),this.form.valueChanges.pipe(N.distinctUntilChanged()).subscribe((function(){return console.debug(t.form.value)}))},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={empty:null,date:this._today,disabledEmpty:null,disabledDate:this._today},this.form.patchValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.displayDate=function(){var t=this;return function(e){return t.dateFormatPipe.transform(e,{pattern:"dddd L"}).toString()}},t.prototype.compareDate=function(){return function(t,e){return t&&e&&t.isSame(e)||!1}},t}();ec.decorators=[{type:e.Component,args:[{selector:"app-swipe-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Swipe test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <h1>Swipe page:</h1>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n \x3c!-- empty --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="empty"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [tabindex]="1"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- date --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Date\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="date"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="2"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n <ion-row>\n \x3c!-- disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled empty\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="disabledEmpty"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="3"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n\x3c!-- read-only--\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled with date\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="disabledDate"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="4"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],ec.ctorParameters=function(){return[{type:P.FormBuilder},{type:Mn}]};var nc=Ht,oc=function(){function t(t,e,n){this.platform=t,this.formBuilder=e,this.cd=n,this.showLogPanel=!0,this.logContent="",this.memoryHide=!1,this.memoryMobile=!0,this.stringify=JSON.stringify,this.form=e.group({empty:[null,P.Validators.required],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null]},{validators:No.dateRange("empty","enable")});var o=this.form.get("disable");o.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return o.setValue(t)}));var r=t.is("mobile");this.showLogPanel=this.showLogPanel||r}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t,e,n=this;return Oe(this,(function(o){return t=nc(),e={empty:io(t.clone().add(2,"hours")),enable:io(t),disable:t,readonly:t},this.form.setValue(e),this.log("[test-page] Data loaded: "+JSON.stringify(e)),this.form.get("empty").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return n.log("[test-page] Value n°1: "+JSON.stringify(t))})),this.form.get("enable").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return n.log("[test-page] Value n°2: "+JSON.stringify(t))})),[2]}))}))},t.prototype.doSubmit=function(t){this.form.markAllAsTouched(),this.log("[test-page] Form content: "+JSON.stringify(this.form.value)),this.log("[test-page] Form status: "+this.form.status),this.form.invalid&&(this.log("[test-page] Form errors: "+JSON.stringify(this.form.errors)),jo.logFormErrors(this.form))},t.prototype.log=function(t){console.debug(t),this.showLogPanel&&(this.logContent+=t+"<br/>",this.cd.markForCheck())},t.prototype.clearLogPanel=function(){this.logContent="",this.cd.markForCheck()},t.prototype.startMemoryTimer=function(){var t=this;this.memoryTimer=setInterval((function(){t.memoryHide=!t.memoryHide}),50)},t.prototype.stopMemoryTimer=function(){clearInterval(this.memoryTimer),this.memoryTimer=null,this.memoryHide=!1},t}();oc.decorators=[{type:e.Component,args:[{selector:"app-data-time-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Date/Time field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n \x3c!-- debugging memory leak --\x3e\n <ion-row><ion-col><ion-text><h4>Debug memory leak</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col size="2">\n <ion-button *ngIf="!memoryTimer" (click)="startMemoryTimer()">Start timer</ion-button>\n <ion-button *ngIf="memoryTimer" (click)="stopMemoryTimer()">Stop timer</ion-button>\n </ion-col>\n <ion-col size="2">\n <mat-form-field floatLabel="never">\n <input matInput type="text" hidden>\n <mat-checkbox (change)="memoryMobile=$event.checked" [value]="memoryMobile">\n Mobile ?\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n <ion-col>\n <mat-date-time-field formControlName="empty"\n *ngIf="!memoryHide"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="memoryMobile"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-col>\n </ion-row>\n\n \x3c!-- Mobile mode --\x3e\n <ion-row><ion-col><ion-text><h4>Mobile mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n \x3c!-- Empty value --\x3e\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="empty"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Enable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="enable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="disable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n \x3c!-- debug console --\x3e\n <ion-row>\n \x3c!-- buttons --\x3e\n <ion-col size="2">\n \x3c!-- submit form --\x3e\n <ion-button (click)="doSubmit($event)"\n fill="outline">\n <ion-icon name="checkmark" slot="icon-only"></ion-icon>\n </ion-button>\n\n \x3c!-- clear log --\x3e\n <ion-button (click)="clearLogPanel()"\n fill="outline">\n <ion-icon name="trash" slot="icon-only"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size="10" *ngIf="showLogPanel">\n <ion-text color="primary">Log:<br/></ion-text>\n <div class="ion-padding-start">\n <ion-text color="medium">\n <small [innerHTML]="logContent"></small>\n </ion-text>\n </div>\n </ion-col>\n </ion-row>\n\n \x3c!-- Desktop mode --\x3e\n <ion-row><ion-col><ion-text><h4>Desktop mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n \x3c!-- Empty value --\x3e\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="empty"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Enable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="enable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="disable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Readonly --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly toggle\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.readonly.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-time-field #readonlyField formControlName="readonly"\n placeholder="Date/Time"\n [readonly]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n</ion-content>\n'}]}],oc.ctorParameters=function(){return[{type:M.Platform},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var rc=[{id:1,label:"AAA",name:"Item A"},{id:2,label:"BBB",name:"Item B"},{id:3,label:"CCC",name:"Item C"}];function ic(t){return(t||rc).map((function(t){return Object.assign({},t)}))}var ac=function(){function t(t){this.formBuilder=t,this._items=ic(rc),this._$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.form=t.group({entity:[null,Do.entity],entityInitial:[null,Do.entity],disableEntity:[null,Do.entity]}),this.form.get("disableEntity").disable()}return t.prototype.ngOnInit=function(){var t=this;this.autocompleteFields.add("entity-suggestFn",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items",{items:rc.slice(),attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-$items",{items:this._$items,attributes:["label","name"],displayWith:this.entityToString}),this.loadData(),setTimeout((function(){return t.loadItems()}),1e3)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={entity:[],entityInitial:rc.slice(1,2),disableEntity:rc.slice(1,2)},this.form.setValue(t),[2]}))}))},t.prototype.loadItems=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this._$items.next(ic(rc)),[2]}))}))},t.prototype.entityToString=function(t){return[t&&t.label||void 0,t&&t.name||void 0].filter(Re).join(" - ")},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return[2,We(this._items,t,Object.assign(Object.assign({},e),{searchAttributes:["label","name"]}))]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.compareWithFn=function(t,e){return t&&e&&t.id===e.id},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();ac.decorators=[{type:e.Component,args:[{selector:"app-chips-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Chips field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Suggest() function\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <pre><small>suggestFn: (searchText, filter) => any[]</small></pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [logPrefix]="\'[mat-chips-empty] \'"\n [compareWith]="compareWithFn"\n ></mat-chips-field>\n {{stringify(form.controls.entity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Suggest() function with initial value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <pre><small>suggestFn: (searchText, filter) => any[]</small></pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entityInitial"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-initialized] \'"\n ></mat-chips-field>\n {{stringify(form.controls.entityInitial.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-disabled] \'"\n ></mat-chips-field>\n {{stringify(form.controls.disableEntity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-readonly] \'"\n [readonly]="true"\n ></mat-chips-field>\n {{stringify(form.controls.entity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],ac.ctorParameters=function(){return[{type:P.FormBuilder}]};var sc=function(){};sc.decorators=[{type:e.Component,args:[{selector:"mat-badge-icon-test",template:'\n<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>matBadgeIcon directive</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n \x3c!-- small badge --\x3e\n <p>\n <ion-text color="tertiary">\n <span matBadge matIcon="check"\n matBadgeSize="small"\n matBadgeColor="accent"\n matBadgeOverlap="false">Small badge</span>\n </ion-text>\n </p>\n\n \x3c!-- medium badge --\x3e\n <p>\n <ion-text matBadge matBadgeIcon="check"\n matBadgeSize="medium"\n matBadgeColor="tertiary"\n matBadgeOverlap="false"\n >Medium badge</ion-text>\n </p>\n\n \x3c!-- small badge --\x3e\n <p>\n <ion-label matBadge matBadgeIcon="close" matBadgeSize="large"\n matBadgeOverlap="false">Large badge</ion-label>\n </p>\n\n \x3c!-- default size badge --\x3e\n <p>\n <ion-label matBadge matBadgeIcon="check" matBadgeColor="success"\n matBadgeOverlap="false">Badge (no size, no color)\n </ion-label>\n </p>\n\n \x3c!-- ion icon --\x3e\n <p>\n <ion-label matBadge\n ionBadgeIcon="checkmark"\n matBadgeColor="success"\n matBadgeOverlap="false">Badge with ion-icon\n </ion-label>\n </p>\n\n \x3c!-- ion icon clear --\x3e\n <p>\n <ion-label matBadge\n ionBadgeIcon="checkmark-circle"\n matBadgeColor="tertiary"\n matBadgeFill="clear"\n matBadgeOverlap="false">Badge with clear icon\n </ion-label>\n </p>\n\n\n</ion-content>\n'}]}];var lc=[{path:"",pathMatch:"full",component:Zl},{path:"autocomplete",pathMatch:"full",component:Yl},{path:"datetime",pathMatch:"full",component:oc},{path:"latlong",pathMatch:"full",component:Xl},{path:"swipe",pathMatch:"full",component:ec},{path:"chips",pathMatch:"full",component:ac},{path:"badge-icon",pathMatch:"full",component:sc}],cc=function(){};cc.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ui,F.TranslateModule.forChild(),z.RouterModule.forChild(lc)],declarations:[Zl,oc,Yl,Xl,ec,ac,sc],exports:[ui,z.RouterModule,oc,Zl,Yl,Xl,ec,ac]}]}];var uc=function(){};uc.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),cc],exports:[cc]}]}];var dc=function(){function t(t,e){this.accountService=t,this.viewCtrl=e,this.sending=!1}return t.prototype.cancel=function(){console.debug("[register] cancelled"),this.viewCtrl.dismiss()},t.prototype.doSubmit=function(t){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:if(this.form.form.disabled||this.sending)return[2];if(!this.form.valid||!this.form.isEnd())return this.form.markAsTouched(),[2];this.sending=!0,t=this.form.value,this.form.disable(),n.label=1;case 1:return n.trys.push([1,4,5,6]),console.debug("[register] Sending registration to server...",t),[4,this.accountService.register(t)];case 2:return n.sent(),console.debug("[register] Account registered!"),[4,this.viewCtrl.dismiss()];case 3:return n.sent(),[3,6];case 4:return e=n.sent(),this.form.error=e&&e.message||e,this.form.enable(),[3,6];case 5:return this.sending=!1,[7];case 6:return[2]}}))}))},t}();dc.decorators=[{type:e.Component,args:[{selector:"modal-register",template:'<ion-header>\n <ion-toolbar color="secondary">\n <ion-buttons slot="start">\n <ion-button *ngIf="form.isBeginning()" (click)="cancel()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n <ion-button *ngIf="!form.isBeginning()" (click)="form.slidePrev()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title translate>REGISTER.TITLE</ion-title>\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="sending"></ion-spinner>\n\n <ion-button *ngIf="!form.isEnd()" (click)="form.slideNext()"\n visible-xs visible-sm visible-mobile>\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n <ion-button *ngIf="form.isEnd() && !sending" (click)="doSubmit()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="send"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <form-register (onSubmit)="doSubmit()" (onCancel)="cancel()" #form>\n </form-register>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n \x3c!-- buttons --\x3e\n <ion-toolbar>\n\n <ion-row>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button *ngIf="form.isBeginning()" fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button *ngIf="!form.isBeginning()" fill="clear" color="dark" (click)="form.slidePrev()" [disabled]="sending">\n <ion-icon slot="start" name="arrow-back"></ion-icon>\n <ion-label translate>COMMON.BTN_BACK</ion-label>\n </ion-button>\n\n <ion-button *ngIf="!form.isEnd()" (click)="form.slideNext()" fill="solid" color="tertiary">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n <ion-button *ngIf="form.isEnd()" (click)="doSubmit()" fill="solid" [disabled]="sending" color="tertiary">\n <span translate>COMMON.BTN_SEND</span>\n <ion-icon slot="end" name="send"></ion-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n'}]}],dc.ctorParameters=function(){return[{type:pl},{type:M.ModalController}]},dc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var pc=function(){function t(t,n){var o=this;this.error=null,this._enable=!1,this._$ready=new D.BehaviorSubject(!1),this._$loading=new D.BehaviorSubject(!0),this.i18nFieldPrefix=null,this._subscription=new D.Subscription,this.debug=!1,this.onCancel=new e.EventEmitter,this.onSubmit=new e.EventEmitter,n&&this.setForm(n),this.translate=t.get(F.TranslateService),this.settings=t.get(ga),this.errorTranslator=t.get(lr),this.autocompleteHelper=new Pn(this.settings&&{getUserAttributes:function(t,e){return o.settings.getFieldDisplayAttributes(t,e)}}),this.autocompleteFields=this.autocompleteHelper.fields}return Object.defineProperty(t.prototype,"_loading",{get:function(){return this._$loading.value},set:function(t){this._$loading.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._$loading.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.form.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.form&&this.form.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){return!this.form||this.form.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){return!this.form||this.form.dirty&&this.form.pending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.form&&this.form.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return!this.form||!this.form.dirty&&!this.form.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"untouched",{get:function(){return!this.form||this.form.untouched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enable},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){var e;null===(e=this.form)||void 0===e||e.disable(t),this._enable&&(this._enable=!1,t&&!0===t.emitEvent||this.markForCheck())},t.prototype.enable=function(t){var e;null===(e=this.form)||void 0===e||e.enable(t),this._enable||(this._enable=!0,t&&!0===t.emitEvent||this.markForCheck())},Object.defineProperty(t.prototype,"form",{get:function(){return this._form},set:function(t){this.setForm(t)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this._enable?this.enable():this.disable(),this.errorTranslatorOptions=this.errorTranslatorOptions||{controlPathTranslator:this}},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.onCancel.complete(),this.onCancel.unsubscribe(),this.onSubmit.complete(),this.onSubmit.unsubscribe(),this._$ready.complete()},t.prototype.cancel=function(){this.onCancel.emit()},t.prototype.doSubmit=function(t){this.form&&this.form.valid?this.onSubmit.emit(t):this.markAllAsTouched({emitEvent:!0})},t.prototype.setForm=function(t){var e=this;this._form!==t&&(this._form=t,this._subscription.add(this._form.statusChanges.subscribe((function(t){return e.markForCheck()}))))},t.prototype.setValue=function(t,e){t?(this.debug&&console.debug("[form] Updating form (using entity)",t),jo.copyEntity2Form(t,this.form,e),e&&!1===e.emitEvent||(this.markAsLoaded({emitEvent:!1}),this.markForCheck())):console.warn("[form] Trying to set an empty value to form. Skipping")},t.prototype.reset=function(t,e){if(t){this.debug&&console.debug("[form] Resetting form (using entity)",t);var n=jo.getFormValueFromEntity(t,this.form);this.form.reset(n,{emitEvent:!1,onlySelf:!0})}else this.form.reset(null,{emitEvent:!1,onlySelf:!0});e&&!0===e.emitEvent||this.markForCheck()},t.prototype.markAsPristine=function(t){this.form.markAsPristine(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsUntouched=function(t){this.form.markAsUntouched(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsTouched=function(t){console.warn("TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0"),jo.markAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){jo.markAllAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsDirty=function(t){this.form.markAsDirty(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsLoading=function(t){!0!==this._$loading.value&&(this._$loading.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoaded=function(t){!1!==this._$loading.value&&(this._$loading.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsReady=function(t){!0!==this._$ready.value&&(this._$ready.next(!0),"function"==typeof this.ngOnReady&&this.ngOnReady())},t.prototype.ready=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this._$ready)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,jo.waitIdle(this,t)]}))}))},t.prototype.updateValueAndValidity=function(t){jo.updateValueAndValidity(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.translateControlPath=function(t){var e,n=this.getI18nFieldName(t);return(null===(e=this.translate)||void 0===e?void 0:e.instant(n))||n},t.prototype.getFormError=function(t,e){if(t&&this.errorTranslator)return this.errorTranslator.translateErrors(this.form,Object.assign({controlPathTranslator:this},e))},t.prototype.getI18nFieldName=function(t){return(this.i18nFieldPrefix||"")+Ge(t).toUpperCase()},t.prototype.registerSubscription=function(t){return this._subscription.add(t)},t.prototype.registerAutocompleteField=function(t,e){return this.autocompleteHelper.add(t,e)},t.prototype.markForCheck=function(){console.warn("markForCheck() has been called, but is not overwritten by component "+this.constructor.name)},t}();pc.decorators=[{type:e.Directive}],pc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormGroup}]},pc.propDecorators={debug:[{type:e.Input}],tabindex:[{type:e.Input}],errorTranslatorOptions:[{type:e.Input}],form:[{type:e.Input}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var hc=function(t){function n(n,o,r,i,a,s,l,c,u){var d=t.call(this,n,r.group({username:[null,P.Validators.required],password:[null,P.Validators.required],offline:[l.offline]}))||this;return d.configService=a,d.modalCtrl=s,d.network=l,d.cd=c,d.environment=u,d.canWorkOffline=!1,d.showPwd=!1,d.onCancel=new e.EventEmitter,d.onSubmit=new e.EventEmitter,d.mobile=o.mobile,d.canWorkOffline=d.settings.hasOfflineFeature(),d._enable=!0,d}return Ee(n,t),n.prototype.disable=function(e){t.prototype.disable.call(this,e),this.showPwd=!1},n.prototype.ngOnInit=function(){var e=this;t.prototype.ngOnInit.call(this),this.registerSubscription(this.configService.config.subscribe((function(t){"token"===t.getProperty(yl.AUTH_TOKEN_TYPE)?(e.usernamePlaceholder="USER.EMAIL",e.form.get("username").setValidators(P.Validators.compose([P.Validators.required,P.Validators.email]))):(e.usernamePlaceholder="USER.USERNAME",e.form.get("username").setValidators(P.Validators.required)),e.canRegister=t.getProperty(yl.REGISTRATION_ENABLE),e.markForCheck()}))),this.environment&&!1===this.environment.production&&this.environment.defaultAuthValues&&this.form.patchValue(this.environment.defaultAuthValues)},n.prototype.cancel=function(){this.onCancel.emit()},n.prototype.doSubmit=function(t){var e=this;if(t&&(t.preventDefault(),t.stopPropagation()),!this.form.invalid&&!this.loading){this.markAsLoading();var n=this.form.value;this.showPwd=!1,this.error=null,this.registerSubscription(this.onSubmit.pipe(N.debounceTime(500)).subscribe((function(t){return e.markAsLoaded()}))),setTimeout((function(){return e.onSubmit.emit({username:n.username,password:n.password,offline:n.offline})}))}},n.prototype.register=function(){var t=this;this.onCancel.emit(),setTimeout((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:dc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))}),200)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);hc.decorators=[{type:e.Component,args:[{selector:"app-form-auth",template:'<form [formGroup]="form" novalidate (ngSubmit)="doSubmit($event)" class="form-container ion-padding" (keyup.enter)="doSubmit($event)">\n\n \x3c!-- error --\x3e\n <ion-item lines="none" *ngIf="error && !loading" @slideUpDownAnimation>\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- Username --\x3e\n <mat-form-field>\n <input matInput [appAutofocus]="true" [autofocusDelay]="500"\n [placeholder]="usernamePlaceholder|translate"\n formControlName="username"\n autocomplete="off"\n required>\n <mat-error *ngIf="form.controls.username.hasError(\'required\') && form.controls.username.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.username.hasError(\'email\') && form.controls.username.dirty">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.PASSWORD\'|translate"\n formControlName="password"\n autocomplete="section-red new-password"\n [type]="showPwd ? \'text\' : \'password\'"\n (keyup.enter)="doSubmit($event)"\n required>\n\n \x3c!-- Show pwd button --\x3e\n <button matSuffix type="button"\n mat-icon-button\n *ngIf="mobile"\n (click)="showPwd = !showPwd"\n tabindex="-1">\n <mat-icon>{{showPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="form.controls.password.hasError(\'required\') && form.controls.password.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <ng-container *ngIf="canWorkOffline">\n \x3c!-- Force offline (desktop) --\x3e\n <mat-form-field hidden-xs hidden-sm hidden-mobile color="medium">\n <input matInput hidden formControlName="offline" type="text">\n\n \x3c!-- check box --\x3e\n <mat-checkbox\n [disabled]="network.offline"\n (change)="form.controls.offline.setValue($event.checked)"\n [checked]="form.controls.offline.value">\n <ion-text color="medium" translate>AUTH.OFFLINE_MODE</ion-text>\n </mat-checkbox>\n </mat-form-field>\n\n \x3c!-- Force offline (mobile) --\x3e\n <mat-form-field visible-xs visible-sm visible-mobile\n color="medium">\n <input matInput hidden formControlName="offline" type="text">\n \x3c!-- slide toggle --\x3e\n <ion-text color="medium" translate>AUTH.OFFLINE_MODE</ion-text>\n <mat-slide-toggle matSuffix\n [disabled]="network.offline"\n (change)="form.controls.offline.setValue($event.checked)"\n [checked]="form.controls.offline.value">\n </mat-slide-toggle>\n </mat-form-field>\n </ng-container>\n\n \x3c!-- Not register yet ? --\x3e\n <p *ngIf="canRegister" class="padding" style="text-align: center;">\n <span translate>AUTH.NO_ACCOUNT_QUESTION</span>\n <br/>\n <a href="#" (click)="register()">\n <span translate>AUTH.BTN_REGISTER</span>\n </a>\n </p>\n</form>\n',animations:[na],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],hc.ctorParameters=function(){return[{type:e.Injector},{type:Sl},{type:P.FormBuilder},{type:ga},{type:xl},{type:M.ModalController},{type:Ca},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[me]}]}]},hc.propDecorators={onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var mc=function(){function t(t,e,n){this.accountService=t,this.viewCtrl=e,this.changeDetectorRef=n,this.loading=!1}return t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.doSubmit=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(this.form.disabled)return[2];if(!this.form.valid)return this.form.markAsTouched(),[2];this.loading=!0,r.label=1;case 1:return r.trys.push([1,3,,4]),t=this.form.value,this.form.disable(),[4,this.accountService.login(t)];case 2:return e=r.sent(),[2,this.viewCtrl.dismiss(e)];case 3:return n=r.sent(),this.loading=!1,this.form.error=n&&n.message||n,this.markForCheck(),this.form.enable(),_n(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2];case 4:return[2]}}))}))},t.prototype.markForCheck=function(){this.changeDetectorRef.markForCheck()},t}();mc.decorators=[{type:e.Component,args:[{template:'<ion-header>\n <ion-toolbar color="accent">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()" visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'AUTH.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="loading"></ion-spinner>\n\n <ion-button\n (click)="doSubmit()" *ngIf="!loading"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="checkmark"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <app-form-auth #form\n (onSubmit)="doSubmit()"\n (onCancel)="cancel()">\n </app-form-auth>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n\n <ion-toolbar>\n\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n\n \x3c!-- buttons --\x3e\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button [fill]="form.invalid ? \'clear\' : \'solid\'"\n [disabled]="loading || form.invalid"\n (click)="doSubmit()"\n (keyup.enter)="doSubmit()"\n color="tertiary">\n <ion-label translate>AUTH.BTN_LOGIN</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],mc.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:e.ChangeDetectorRef}]},mc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var fc=new e.InjectionToken("aboutDevelopers"),gc=new e.InjectionToken("aboutPartners"),bc=function(){function t(t,e,n,o,r,i){var a=this;this.translate=t,this.modalController=e,this.configService=n,this.environment=o,this.developers=r,this.partners=i,this._subscription=new D.Subscription,this.name=t.instant("APP_NAME"),"APP_NAME"===this.name&&(this.name=o&&o.name&&rn(o.name)||void 0),this.version=o&&o.version,this.sourceUrl=o&&o.sourceUrl,this.reportIssueUrl=o&&o.reportIssueUrl,this.forumUrl=o&&o.forumUrl,this.helpUrl=o&&o.helpUrl,this.config$=n.config,this._subscription.add(this.config$.subscribe((function(t){return a.setConfig(t)})))}return t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.close=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalController.dismiss()];case 1:return t.sent(),[2]}}))}))},t.prototype.setConfig=function(t){this.forumUrl=(null==t?void 0:t.getProperty(yl.FORUM_URL))||this.environment.forumUrl,this.helpUrl=(null==t?void 0:t.getProperty(yl.HELP_URL))||this.environment.helpUrl},t}();bc.decorators=[{type:e.Component,args:[{selector:"modal-about",template:'<ion-header>\n <ion-toolbar color="light">\n\n <ion-title>\n {{\'ABOUT.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-button (click)="close()" visible-xs visible-sm visible-mobile>\n {{\'COMMON.BTN_CLOSE\'|translate}}\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <ion-list lines="none">\n\n \x3c!-- Peer info --\x3e\n <ion-item *ngIf="config$ | async; let config">\n <span slot="start"> </span>\n <ion-label class="ion-text-wrap" >\n <h2>\n <b>{{config.label}}</b> - <span [innerHTML]="config.name"></span>\n </h2>\n <p *ngIf="config.description">\n <markdown [data]="config.description"\n emoji>\n </markdown>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Version info --\x3e\n <ion-item>\n <span slot="start"> </span>\n <ion-label class="ion-text-wrap">\n <h2>\n <small *ngIf="name">{{\'ABOUT.POWERED_BY\'|translate}}</small> {{name}}\n <span *ngIf="version" [innerHTML]="\'ABOUT.VERSION\'| translate: {version: version}"></span>\n </h2>\n <p [innerHTML]="\'ABOUT.LICENSE\'| translate"></p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Help --\x3e\n <ion-item *ngIf="forumUrl || helpUrl">\n <mat-icon slot="start">help_outline</mat-icon>\n <ion-label>\n <p>\n {{\'ABOUT.HELP\'|translate}}\n </p>\n <p>\n <ion-button fill="solid" color="accent" href="{{helpUrl}}" target="help" size="default">\n <mat-icon slot="start">description</mat-icon>\n <ion-text translate>ABOUT.USER_MANUAL</ion-text>\n </ion-button>\n <ion-button fill="solid" color="secondary" href="{{forumUrl}}" target="forum" size="default">\n <ion-icon slot="start" name="chatbubbles"></ion-icon>\n <ion-text translate>ABOUT.FORUM</ion-text>\n </ion-button>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Report issue --\x3e\n <ion-item *ngIf="reportIssueUrl">\n <ion-icon slot="start" name="bug" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.REPORT_ISSUE\'|translate}}\n </p>\n <p>\n <a color="primary" href="{{reportIssueUrl}}" target="_system" translate>ABOUT.BTN_REPORT_ISSUE</a>\n </p>\n </ion-label>\n </ion-item>\n\n\n \x3c!-- Source code --\x3e\n <ion-item *ngIf="sourceUrl">\n <ion-icon slot="start" name="code" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.SOURCE_CODE\'|translate}}\n </p>\n <p>\n <a color="primary" href="{{sourceUrl}}" target="_system">{{sourceUrl}}</a>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Developers --\x3e\n <ion-item *ngIf="developers | isNotEmptyArray">\n <ion-icon slot="start" name="people" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.DEVELOPED_BY\'|translate}}\n </p>\n <ion-list lines="none">\n <ion-item *ngFor="let item of developers"\n class="ion-no-padding">\n <img slot="end" src="{{item.logo}}">\n <ion-label>\n <p>\n <a color="primary" href="{{item.siteUrl}}" target="_system">{{item.name||item.label}}</a>\n </p>\n </ion-label>\n </ion-item>\n </ion-list>\n </ion-label>\n </ion-item>\n\n \x3c!-- Partners --\x3e\n <ion-item class="item-partners" *ngIf="partners | isNotEmptyArray">\n <ion-icon slot="start" name="megaphone" color="dark"></ion-icon>\n <ion-text>\n <p>{{\'ABOUT.PARTNERS\'|translate}}</p>\n <p>\n <a *ngFor="let item of partners" href="{{item.siteUrl}}" class="partners" target="_system">\n <img src="{{item.logo}}">\n </a>\n </p>\n </ion-text>\n </ion-item>\n </ion-list>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="tertiary" (click)="close()">{{\'COMMON.BTN_CLOSE\'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n',styles:[".item-partners ion-text{height:auto}.item-partners ion-text p:last-child{display:flex;flex-wrap:wrap;flex-direction:row;justify-content:space-between}.item-partners ion-text p:last-child a{padding:2px}.item-partners ion-text p:last-child a img{text-align:center;display:inline-block;max-height:40px}"]}]}],bc.ctorParameters=function(){return[{type:F.TranslateService},{type:M.ModalController},{type:xl},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[fc]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[gc]}]}]};var yc=function(){function t(){}return t.checkIfVisible=function(t,e,n,o){if(o=o||{},t.profile){if(!(e.isLogin()&&e.hasMinProfile(t.profile)))return o.debug&&console.debug((o&&o.logPrefix||"[menu]")+" Hide item '"+t.title+"': need the min profile '"+t.profile+"' to access path '"+t.path+"'"),!1}else if(t.exactProfile){if(!e.hasExactProfile(t.exactProfile))return o.debug&&console.debug((o&&o.logPrefix||"[menu]")+" Hide item '"+t.title+"': need exact profile '"+t.exactProfile+"' to access path '"+t.path+"'"),!1}if(t.ifProperty&&!(n&&"true"===n.properties[t.ifProperty]))return o.debug&&console.debug("[menu] Config property '"+t.ifProperty+"' not 'true' for ",t.path),!1;return!0},t}();function vc(t){return t[Math.floor(Math.random()*t.length)]}var Cc=new e.InjectionToken("homeButton"),Ec=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){var p=this;this.accountService=t,this.modalCtrl=e,this.translate=n,this.toastController=o,this.configService=r,this.platform=i,this.cd=a,this.network=s,this.settings=l,this.environment=c,this.locales=u,this.buttons=d,this._started=!1,this._subscription=new D.Subscription,this.loading=!0,this.waitingNetwork=!1,this.showSpinner=!0,this.accountName="",this.$partners=new D.BehaviorSubject(null),this.loadingBanner=!0,this.pageHistory=[],this.$filteredButtons=new D.BehaviorSubject(void 0),this._debug=!c.production,this.showSpinner=!this.platform.started,this.platform.ready().then((function(){return p.start()}))}return Object.defineProperty(t.prototype,"currentLocaleCode",{get:function(){return this.loading?"":(this.translate.currentLang||this.translate.defaultLang).substr(0,2)},enumerable:!1,configurable:!0}),t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.login=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:mc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.register=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:dc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.logout=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.accountService.logout()];case 1:return t.sent(),this.offline?[4,this.tryOnline()]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype.changeLanguage=function(t){var e=this;this.settings.apply({locale:t}).then((function(){e.markForCheck()}))},t.prototype.getPagePath=function(t){return t&&t.path},t.prototype.tryOnline=function(){var t=this;this.waitingNetwork=!0,this.markForCheck(),this.network.tryOnline({showLoadingToast:!1,showOnlineToast:!0,showOfflineToast:!1}).then((function(){t.waitingNetwork=!1,t.markForCheck()}))},t.prototype.start=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return[4,this.accountService.ready()];case 1:return s.sent(),this.isLogin=this.accountService.isLogin(),this.isLogin&&this.onLogin(this.accountService.account),this.offline=this.network.offline,this._subscription.add(this.accountService.onLogin.subscribe((function(t){return a.onLogin(t)}))),this._subscription.add(this.accountService.onLogout.subscribe((function(){return a.onLogout()}))),this._subscription.add(this.configService.config.subscribe((function(t){return a.onConfigLoaded(t)}))),e=(t=this._subscription).add,o=(n=this.settings.onChange).pipe,r=[N.debounceTime(3e3)],i=N.startWith,[4,this.settings.ready()];case 2:return e.apply(t,[o.apply(n,r.concat([i.apply(void 0,[s.sent()])])).subscribe((function(t){return a.onSettingsChanged(t)}))]),this._subscription.add(this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"===t})),N.distinctUntilChanged()).subscribe((function(t){a.offline=t,a.markForCheck()}))),this._started=!0,[2]}}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},t.prototype.onConfigLoaded=function(t){var e=this;console.debug("[home] Applying configuration",t),this._config=t,this.appName=t.label||this.environment.defaultAppName||"SUMARiS",this.logo=t.largeLogo||t.smallLogo||void 0,this.description=t.name,this.isWeb=this.platform.isWebOrDesktop(),this.canRegister=t.getPropertyAsBoolean(yl.REGISTRATION_ENABLE);var n=(t.partners||[]).filter((function(t){return t&&t.logo}));if(this.$partners.next(n),this.loadingBanner=0===n.length,!this.contentStyle){var o=(t.backgroundImages||[]).filter((function(t){return Re(t)&&(!e.offline||!t.startsWith("http"))}));if(o.length){var r=vc(o);this.contentStyle=r&&{"background-image":"url("+r+")"}||{}}else{var i=t.properties&&t.properties["sumaris.color.primary"]||"var(--ion-color-primary)";this.contentStyle=i&&{"background-color":i}||{}}}this.refreshButtons(),this.markForCheck(),this.loading&&setTimeout((function(){e.loading=!1,e.markForCheck()}),500)},t.prototype.onSettingsChanged=function(t){t.pageHistory!==this.pageHistory&&(console.debug("[home] Page history loaded"),this.pageHistory=t.pageHistory||[]),this.markForCheck()},t.prototype.onLogin=function(t){t&&(this.isLogin=!0,this.accountName=Os(t),this.refreshButtons(),this.markForCheck())},t.prototype.onLogout=function(){this.isLogin=!1,this.accountName="",this.pageHistory=[],this.refreshButtons(),this.markForCheck()},t.prototype.refreshButtons=function(){var t=this;if(this._config){this._debug&&console.debug("[home] Refreshing buttons...");var e=(this.buttons||[]).filter((function(e){return yc.checkIfVisible(e,t.accountService,t._config,{isLogin:t.isLogin,debug:t._debug,logPrefix:"[home]"})})).map((function(e){if(Pe(e.titleProperty)&&t._config){var n=t._config.properties[e.titleProperty];if(n)return Object.assign(Object.assign({},e),{title:n})}return e}));this.$filteredButtons.next(e)}},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ec.decorators=[{type:e.Component,args:[{moduleId:module.id.toString(),selector:"app-page-home",template:'<app-toolbar [canGoBack]="false"\n visible-xs visible-sm visible-mobile>\n\n \x3c!-- change locale button --\x3e\n <ion-button slot="end" *ngIf="currentLocaleCode; let code"\n [matMenuTriggerFor]="localeMenu">\n <ion-label class="ion-text-uppercase"> {{ code }}</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n</app-toolbar>\n\n\x3c!-- change locale menu --\x3e\n<mat-menu #localeMenu="matMenu">\n <button *ngFor="let item of locales"\n mat-menu-item\n (click)="changeLanguage(item.key)">\n <ion-label>{{item.value}}</ion-label>\n </button>\n</mat-menu>\n\n<ion-content [ngStyle]="contentStyle" no-padding-xs>\n\n \x3c!-- loading spinner --\x3e\n <div class="loading-page" [class.cdk-visually-hidden]="!loading">\n <div class="spinner" *ngIf="loading && showSpinner">\n <p>Loading...</p>\n <div class="sk-cube1 sk-cube"></div>\n <div class="sk-cube2 sk-cube"></div>\n <div class="sk-cube4 sk-cube"></div>\n <div class="sk-cube3 sk-cube"></div>\n </div>\n </div>\n\n \x3c!-- Desktop: translucent top toolbar --\x3e\n <div hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar translucent>\n <ion-buttons slot="start">\n <ion-menu-toggle>\n <ion-button color="light" fill="clear">\n <ion-icon slot="icon-only" name="menu"></ion-icon>\n </ion-button>\n </ion-menu-toggle>\n </ion-buttons>\n\n <ion-buttons slot="end">\n \x3c!-- change locale button --\x3e\n <ion-button color="secondary" fill="solid"\n *ngIf="currentLocaleCode; let code"\n [matMenuTriggerFor]="localeMenu">\n <ion-label class="ion-text-uppercase"> {{ code }}</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n </div>\n\n \x3c!-- Install (and upgrade) card --\x3e\n <app-install-upgrade-card [isLogin]="isLogin"\n showInstallButton="true">\n </app-install-upgrade-card>\n\n \x3c!-- Welcome card --\x3e\n <ion-card *ngIf="!loading"\n class="main welcome ion-padding ion-text-center ion-align-self-center"\n @fadeInAnimation>\n <ion-card-header>\n <ion-card-title class="ion-text-center">\n <span *ngIf="isWeb" [innerHTML]="\'HOME.WELCOME_WEB\'|translate: {appName: appName}"></span>\n <span *ngIf="!isWeb" [innerHTML]="\'HOME.WELCOME_APP\'|translate: {appName: appName}"></span>\n </ion-card-title>\n <ion-card-subtitle [innerHTML]="description">\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content class="ion-no-padding">\n <ion-text color="primary">\n <img class="logo" *ngIf="logo" src="{{ logo }}">\n </ion-text>\n \x3c!-- register help text --\x3e\n <ion-text *ngIf="!isLogin && canRegister">\n <br/>\n <span translate>HOME.REGISTER_HELP</span>\n </ion-text>\n </ion-card-content>\n\n <ion-footer class="ion-padding-top">\n\n \x3c!-- If NOT login --\x3e\n <ng-container *ngIf="!isLogin; else loginButtons;">\n\n <ion-button *ngIf="canRegister" expand="block" color="tertiary" (click)="register()">\n <span translate>HOME.BTN_REGISTER</span>\n </ion-button>\n <ion-button expand="block" color="light" [routerLink]="[\'/\']" (click)="login()">\n <span translate>AUTH.BTN_LOGIN</span>\n </ion-button>\n\n </ng-container>\n\n \x3c!-- If user login --\x3e\n <ng-template #loginButtons>\n\n \x3c!-- Feature buttons --\x3e\n <ng-container *ngIf="$filteredButtons | async as buttons">\n <ng-container *ngFor="let item of buttons">\n <ion-button *ngIf="item.path"\n expand="block" color="tertiary"\n [class]="item.cssClass"\n [routerLink]="item.path"\n routerDirection="root">\n <ion-icon slot="start" class="ion-float-start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" class="ion-float-start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-text>{{\'HOME.BTN_DATA_ENTRY\'|translate: {name: (item.title | translate) } }}</ion-text>\n </ion-button>\n\n \x3c!-- divider --\x3e\n <div *ngIf="!item.path && !item.action" [class]="item.cssClass">\n <ion-label translate>{{item.title}} </ion-label>\n </div>\n </ng-container>\n\n \x3c!--<p *ngIf="buttons.length" class="visible-mobile"> </p>--\x3e\n </ng-container>\n\n <ion-button expand="block" color="secondary" [routerLink]="[\'/account\']">\n <ion-icon slot="start" class="ion-float-start" name="person-circle"></ion-icon>\n <ion-text translate>HOME.BTN_MY_ACCOUNT</ion-text>\n </ion-button>\n\n <p hidden-xs hidden-sm hidden-mobile>\n <ion-text [innerHTML]="\'HOME.NOT_THIS_ACCOUNT_QUESTION\' | translate: {displayName: accountName }"></ion-text>\n <br/>\n <ion-text>\n <a href="#" (click)="logout($event)">\n <span translate>HOME.BTN_DISCONNECT</span>\n </a>\n </ion-text>\n </p>\n\n\n </ng-template>\n\n </ion-footer>\n </ion-card>\n\n \x3c!-- Page history --\x3e\n <ion-grid *ngIf="!loading && isLogin && pageHistory.length; else bottomBanner"\n class="history-container ion-align-self-center">\n <ion-row>\n <ion-col size="12" size-xl="" *ngFor="let page of pageHistory; trackBy: getPagePath"\n class="ion-text-center">\n <ion-card class="ion-align-self-start ion-text-start" @fadeInAnimation>\n <ion-card-header class="ion-no-padding">\n \x3c!-- top bar --\x3e\n <ion-card-subtitle>\n <button type="button" tabindex="-1"\n (click)="settings.removePageHistory(page.path)"\n mat-icon-button class="ion-float-start ion-no-margin">\n <mat-icon>close</mat-icon>\n </button>\n <ion-label [innerHTML]="page.subtitle|translate"></ion-label>\n <ion-text class="ion-float-end" [title]="page.time|dateFormat:{time: true}">\n <small><ion-icon name="time-outline"></ion-icon> {{ page.time|dateFromNow }}</small> \n </ion-text>\n </ion-card-subtitle>\n\n \x3c!-- main page --\x3e\n <ion-card-title class="ion-no-margin ion-no-padding">\n <ion-item detail="true"\n tappable class="text-1x"\n [routerLink]="page.path"\n routerDirection="root" lines="none">\n \x3c!-- page icon--\x3e\n <ion-icon *ngIf="page.icon" slot="start" [name]="page.icon"></ion-icon>\n <mat-icon *ngIf="page.matIcon" slot="start">{{page.matIcon}}</mat-icon>\n\n <ion-label color="primary" [title]="page.title">{{page.title}}</ion-label>\n </ion-item>\n </ion-card-title>\n </ion-card-header>\n\n \x3c!-- children pages --\x3e\n <ion-card-content class="ion-no-padding ion-padding-start" *ngIf="page.children?.length">\n <ion-list class="ion-no-padding">\n <ion-item detail="true"\n *ngFor="let childPage of page.children"\n tappable class="text-1x"\n [routerLink]="childPage.path"\n routerDirection="root">\n \x3c!-- page icon--\x3e\n <ion-icon *ngIf="childPage.icon" slot="start" color="dark" [name]="childPage.icon"></ion-icon>\n <mat-icon *ngIf="childPage.matIcon" slot="start" color="dark">{{childPage.matIcon}}</mat-icon>\n\n <ion-label color="dark" [innerHTML]="childPage.title"></ion-label>\n </ion-item>\n </ion-list>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Display configured Departments logos --\x3e\n <ng-template #bottomBanner>\n <div class="bottom-banner ion-text-center ion-padding" *ngIf="!loadingBanner" @fadeInAnimation>\n <a href="{{ item.siteUrl }}" *ngFor="let item of $partners | async ">\n <img class="logo" src="{{ item.logo }}" alt="{{item.label}}" [title]="item.label" />\n </a>\n </div>\n </ng-template>\n\n\n</ion-content>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Zi,na],styles:["h1,h2,h3,h4,h5{white-space:normal}.center,ion-content ion-card.welcome img{text-align:center;display:inline-block}ion-content{--background:transparent;background-size:cover;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;display:inline-block;padding:15px}ion-content,ion-content .loading-page{background-color:var(--ion-color-primary)}ion-content .loading-page{display:block;height:100%;width:100%;position:absolute;z-index:5;transition:background .5s linear;-webkit-transition:background 1.5s linear}ion-content .loading-page.hidden{background-color:rgba(var(--ion-color-primary),0)}ion-content ion-card{z-index:9}ion-content ion-card ion-card-header{display:block}ion-content ion-card ion-card-header ion-card-subtitle,ion-content ion-card ion-card-header ion-card-title{display:block;width:100%}ion-content ion-card.main{min-width:240px;max-width:400px;margin-left:auto;margin-right:auto}ion-content ion-card.welcome{background-color:hsla(0,0%,100%,.7)}ion-content ion-card.welcome button{margin-top:16px}ion-content ion-card.welcome img{max-width:250px}ion-content .history-container{margin-left:auto;margin-right:auto}ion-content .history-container ion-card{display:inline-block;box-sizing:border-box;z-index:8;min-width:240px;max-width:400px;width:100%;margin-left:auto;margin-right:auto;background-color:hsla(0,0%,100%,.7)}ion-content .history-container ion-card ion-card-header ion-card-subtitle{height:40px}ion-content .history-container ion-card ion-card-header ion-card-subtitle button[float-start]{z-index:99;margin:0}ion-content .history-container ion-card ion-card-header ion-card-subtitle ion-label{line-height:40px}ion-content .history-container ion-card ion-card-header ion-card-subtitle ion-label[float-end]{padding-right:16px;font-weight:400}ion-content .history-container ion-card ion-card-header ion-card-title ion-item{--ion-item-background:$transparent;--ion-item-icon-color:var(--ion-color-primary);--ion-item-text-color:var(--ion-color-primary)}ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-icon[slot=start],ion-content .history-container ion-card ion-card-header ion-card-title ion-item mat-icon[slot=start]{margin-right:unset;-webkit-margin-end:16px!important;margin-inline-end:16px!important;color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-label,ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-text{color:var(--ion-item-text-color)!important;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}ion-content .history-container ion-card ion-card-content ion-list{--ion-item-background:var(--ion-color-transparent)}ion-content .history-container ion-card ion-card-content ion-list ion-item{--ion-item-icon-color:var(--ion-color-dark);--ion-item-text-color:var(--ion-color-dark)}ion-content .history-container ion-card ion-card-content ion-list ion-item ion-icon[slot=start],ion-content .history-container ion-card ion-card-content ion-list ion-item mat-icon[slot=start]{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor;margin-right:unset;-webkit-margin-end:16px!important;margin-inline-end:16px!important}ion-content .history-container ion-card ion-card-content ion-list ion-item ion-label,ion-content .history-container ion-card ion-card-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-content .bottom-banner{background-color:hsla(0,0%,100%,.7);min-width:240px;z-index:0;position:absolute;left:16px;right:16px;bottom:16px}ion-content .bottom-banner img.logo{max-height:50px;margin-left:8px}ion-content ion-text{text-align:center}@media screen and (max-width:575px){ion-content ion-card{min-width:160px;width:calc(100% - 20px);max-width:100%;margin-left:10px;margin-right:10px}ion-content ion-card h1{margin-top:0;font-size:20px}ion-content ion-card button{margin-top:8px}ion-content .bottom-banner{display:block;position:unset}ion-content .bottom-banner img.logo{max-height:30px}}@media screen and (max-width:767px) and (min-width:576px){ion-content{min-height:555px}ion-content .bottom-banner img.logo{max-height:40px}}@media screen and (min-width:768px){ion-content{min-height:calc(100% - 100px)}}"]}]}],Ec.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:F.TranslateService},{type:M.ToastController},{type:xl},{type:Sl},{type:e.ChangeDetectorRef},{type:Ca},{type:ga},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Inject,args:[rs]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Cc]}]}]};var wc=function(){function t(t,e,n,o){var r=this;this.platform=t,this.accountService=e,this.activatedRoute=n,this.configService=o,this.subscriptions=[],this.loading=!0,this.contentStyle={},this.platform.ready().then((function(){r.isLogin=e.isLogin(),r.subscriptions.push(r.accountService.onLogin.subscribe((function(t){return r.isLogin=!0}))),r.subscriptions.push(r.accountService.onLogout.subscribe((function(){return r.isLogin=!1}))),r.subscriptions.push(r.activatedRoute.paramMap.subscribe((function(t){return r.doConfirm(t.get("email"),t.get("code"))}))),r.configService.config.subscribe((function(t){if(t&&t.backgroundImages&&t.backgroundImages.length){var e=vc(t.backgroundImages);r.contentStyle={"background-image":"url("+e+")"}}else{var n=t.properties&&t.properties["sumaris.color.primary"]||"#144391";r.contentStyle={"background-color":n}}r.loading=!1}))}))}return t.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(t){return t.unsubscribe()})),this.subscriptions=[]},t.prototype.doConfirm=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(this.email=t,!e)return this.loading=!1,this.error=void 0,[2];i.label=1;case 1:return i.trys.push([1,7,,8]),this.accountService.isLogin()?(n=this.accountService.account,o=n&&n.email,t==o?[3,3]:[4,this.accountService.logout()]):[3,3];case 2:return i.sent(),[2,this.doConfirm(t,e)];case 3:return[4,this.accountService.confirmEmail(t,e)];case 4:return i.sent()&&this.isLogin?[4,this.accountService.refresh()]:[3,6];case 5:i.sent(),i.label=6;case 6:return this.loading=!1,[3,8];case 7:return r=i.sent(),this.error=r&&r.message||r,this.loading=!1,[3,8];case 8:return[2]}}))}))},t}();wc.decorators=[{type:e.Component,args:[{selector:"page-register-confirm",template:'<app-toolbar [title]="\'REGISTER.CONFIRMED.TITLE\'|translate" color="primary">\n</app-toolbar>\n\n\n<ion-content class="bg-image-cover center ion-padding" [ngStyle]="contentStyle">\n\n <p class="hidden-xs ion-padding"> <br /><br /></p>\n <p class="hidden-xs"> </p>\n\n\n <ion-card>\n <ion-card-content>\n\n <div>\n <ng-container *ngIf="loading">\n <h4 translate>REGISTER.CONFIRMED.LOADING</h4>\n <p><ion-spinner></ion-spinner></p>\n </ng-container>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="!loading && error">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n </div>\n\n <div *ngIf="!loading && !error">\n <h3>\n <ion-icon name="checkmark"></ion-icon>\n <b translate>REGISTER.CONFIRMED.SUB_TITLE</b>\n </h3>\n\n <ion-text>\n <p [innerHTML]="\'REGISTER.CONFIRMED.SUCCESS\'|translate: {email: email}"></p>\n <p *ngIf="!isLogin" [innerHTML]="\'REGISTER.CONFIRMED.LOGIN_HELP\'|translate"></p>\n </ion-text>\n\n </div>\n\n </ion-card-content>\n\n <ion-footer *ngIf="!loading">\n <ion-button expand="full" color="primary" [routerLink]="[\'/account\']" *ngIf="!isLogin">\n <ion-icon name="log-in" slot="start"></ion-icon>\n <span translate>AUTH.BTN_LOGIN</span>\n </ion-button>\n\n <ion-button expand="full" color="secondary" [routerLink]="[\'/account\']" *ngIf="isLogin">\n <ion-icon name="contact" slot="start"></ion-icon>\n <span translate>HOME.BTN_MY_ACCOUNT</span>\n </ion-button>\n </ion-footer>\n </ion-card>\n\n</ion-content>\n',styles:["h1,h2,h3,h4,h5{white-space:normal}.bottom-banner,.center,ion-card,ion-card img,ion-content,ion-text{text-align:center;display:inline-block}ion-content{--ion-background-color:transparent;background-size:cover;display:inline-block;padding:15px}ion-card{padding:var(--ion-padding);background-color:hsla(0,0%,100%,.7);min-width:240px;max-width:400px;z-index:9}ion-card button{margin-top:16px}ion-card img{max-width:250px}.bottom-banner{padding:var(--ion-padding);background-color:hsla(0,0%,100%,.7);min-width:240px;z-index:0}.bottom-banner img.logo{max-height:50px;margin-left:8px}@media screen and (max-width:575px){ion-content ion-card{min-width:160px;width:auto;max-width:260px}ion-content ion-card img{max-width:100px;margin-left:8px}ion-content ion-card button{margin-top:8px}.bottom-banner img.logo{max-height:30px}}@media screen and (max-width:767px) and (min-width:576px){ion-content{min-height:555px}.bottom-banner img.logo{max-height:40px}}@media screen and (min-width:768px){ion-content{min-height:606px}.main-content{padding-bottom:0}.bottom-banner{position:absolute;bottom:16px;left:16px;right:16px}}"]}]}],wc.ctorParameters=function(){return[{type:Sl},{type:pl},{type:z.ActivatedRoute},{type:xl}]};var Ic=function(t){function e(e,n){var o=t.call(this)||this;return o.formBuilder=e,o.translate=n,o}return Ee(e,t),e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(t){return this.formBuilder.group(this.getFormGroupConfig(t))},e.prototype.getFormGroupConfig=function(t){return{}},e.prototype.getI18nFormErrors=function(t){var e=jo.getFormErrors(t);return this.getI18nErrors(e)},e.prototype.getI18nErrors=function(t){var e=this;return Object.keys(t||{}).map((function(n){return e.getI18nError(n,t[n])}))},e.prototype.getI18nError=function(t,e){var n="ERROR.FIELD_"+Ge(t).toUpperCase(),o=this.translate.instant(n,e);return n!==o?o:"string"==typeof e?e:(console.error("[validator] Cannot translate error key '"+t+"'. Please override translateError() in your validator"),Ge(t))},e}(Dt.ValidatorService);Ic.decorators=[{type:e.Directive}],Ic.ctorParameters=function(){return[{type:P.FormBuilder},{type:F.TranslateService}]};var Oc=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.getFormGroup=function(t){return this.formBuilder.group({id:[t&&t.id||null],updateDate:[t&&t.updateDate||null],locale:[t&&t.locale||null,P.Validators.required],latLongFormat:[t&&t.latLongFormat||null,P.Validators.required],content:this.formBuilder.group({}),nonce:[t&&t.nonce||null]})},e}(Ic);Oc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Oc(jt.ɵɵinject(qt.FormBuilder))},token:Oc,providedIn:"root"}),Oc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Oc.ctorParameters=function(){return[{type:P.FormBuilder}]};var _c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.formBuilder=e,o.accountService=n,o}return Ee(e,t),e.prototype.getFormGroupConfig=function(t){var e=this,n={id:[""],updateDate:[""],creationDate:[""],lastName:[t&&t.lastName||null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])],firstName:[t&&t.firstName||null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])],email:[t&&t.email||null,P.Validators.compose([P.Validators.required,P.Validators.email])],mainProfile:[t&&(t.mainProfile||Is.getMainProfile(t.profiles))||"GUEST",P.Validators.required],statusId:[t&&t.statusId||as.TEMPORARY,P.Validators.required],pubkey:[t&&t.pubkey||null,P.Validators.compose([P.Validators.required,Do.pubkey])]};return this.accountService.additionalFields.forEach((function(o){n[o.key]=[t&&t[o.key]||null,e.getValidators(o)]})),n},e.prototype.getValidators=function(t){var e=[];return t.extra&&t.extra.account&&t.extra.account.required&&e.push(P.Validators.required),"entity"===t.type&&e.push(Do.entity),e.length?P.Validators.compose(e):1===e.length?e[0]:void 0},e}(Ic);_c.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new _c(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(pl))},token:_c,providedIn:"root"}),_c.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_c.ctorParameters=function(){return[{type:P.FormBuilder},{type:pl}]};var xc=function(e){function n(t,n,o,r,i,a,s,l,c,u){var d=e.call(this,t,i.getFormGroup(r.account))||this;return d.router=n,d.formBuilder=o,d.accountService=r,d.validatorService=i,d.settingsValidatorService=a,d.translate=s,d.settings=l,d.cd=c,d.email={confirmed:!1,notConfirmed:!1,sending:!1,error:void 0},d.latLongFormats=Un,d.saving=!1,d.submitted=!1,d.locales=u,d.settingsForm=a.getFormGroup(r.account&&r.account.settings),d.settingsContentForm=d.settingsForm.controls.content,d.form.addControl("settings",d.settingsForm),d.disable(),d.registerSubscription(d.accountService.onLogin.subscribe((function(t){return d.onLogin(t)}))),d.registerSubscription(d.accountService.onLogout.subscribe((function(){return d.onLogout()}))),d.registerSubscription(d.onCancel.subscribe((function(){d.setValue(d.accountService.account),d.markAsPristine()}))),d.registerSubscription(d.accountService.$additionalFields.subscribe((function(t){d.additionalFields=t.slice(),r.isLogin()?d.onLogin(d.accountService.account):d.markAsLoaded()}))),d}return Ee(n,e),n.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.stopListenChanges()},n.prototype.onLogin=function(t){console.debug("[account] Logged account: ",t),this.isLogin=!0,this.setValue(t),this.email.confirmed=t&&t.email&&t.statusId!==as.TEMPORARY,this.email.notConfirmed=t&&t.email&&(!t.statusId||t.statusId===as.TEMPORARY),this.enable(),this.markAsPristine(),this.startListenChanges(),this.markAsLoaded()},n.prototype.onLogout=function(){this.isLogin=!1,this.email.confirmed=!1,this.email.notConfirmed=!1,this.email.sending=!1,this.email.error=void 0,this.form.reset(),this.disable(),this.stopListenChanges(),this.router.navigateByUrl("/")},n.prototype.refresh=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.disable(),this.markAsLoading(),[2,this.accountService.refresh()]}))}))},n.prototype.startListenChanges=function(){this.changesSubscription||(this.changesSubscription=this.accountService.listenChanges())},n.prototype.stopListenChanges=function(){this.changesSubscription&&(this.changesSubscription.unsubscribe(),this.changesSubscription=void 0)},n.prototype.sendConfirmationEmail=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:if((e=this.form.value).email=this.form.controls.email.value,!e.email||!this.email.notConfirmed)return t.preventDefault(),[2,!1];this.email.sending=!0,console.debug("[account] Sending confirmation email..."),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.accountService.sendConfirmationEmail(e.email,e.settings&&e.settings.locale||this.translate.currentLang)];case 2:return o.sent(),console.debug("[account] Confirmation email sent."),this.email.sending=!1,[3,4];case 3:return n=o.sent(),this.email.sending=!1,this.email.error=n&&n.message||n,[3,4];case 4:return[2]}}))}))},n.prototype.save=function(e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return this.saving?[2]:[4,jo.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return jo.logFormErrors(this.form),[2];this.submitted=!0,this.saving=!0,this.error=void 0,e=t.Account.fromObject(Object.assign(Object.assign({},this.accountService.account.asObject()),this.form.value)),console.debug("[account] Saving account...",e),o.label=2;case 2:return o.trys.push([2,4,5,6]),this.disable(),[4,this.accountService.save(e)];case 3:return o.sent(),this.markAsPristine(),[3,6];case 4:return n=o.sent(),console.error(n),this.error=n&&n.message||n,[3,6];case 5:return this.saving=!1,this.enable(),[7];case 6:return[2]}}))}))},n.prototype.enable=function(){var t=this;e.prototype.enable.call(this),this.form.controls.email.disable(),this.form.controls.mainProfile.disable(),this.form.controls.pubkey.disable(),this.additionalFields.filter((function(t){return t.extra&&t.extra.account&&t.extra.account.disabled||!1})).forEach((function(e){t.form.controls[e.key].disable()})),this.markForCheck()},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);xc.decorators=[{type:e.Component,args:[{selector:"app-page-account",template:'<app-toolbar [title]="\'ACCOUNT.TITLE\'|translate" color="primary"\n [hasValidate]="form.dirty && !saving"\n (onValidate)="save($event)"\n [canGoBack]="false">\n\n <ion-buttons slot="end">\n \x3c!-- loader --\x3e\n <ion-spinner *ngIf="loading || saving; else endButtons"></ion-spinner>\n\n <ng-template #endButtons>\n \x3c!-- refresh button --\x3e\n <ion-button [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="refresh($event)">\n <mat-icon slot="icon-only">refresh</mat-icon>\n </ion-button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n\n<ion-content>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <form [formGroup]="form" novalidate (ngSubmit)="save($event)" class="form-container">\n\n <mat-tab-group>\n\n \x3c!-- TAB: user details --\x3e\n <mat-tab label="{{\'ACCOUNT.USER_DETAILS.TITLE\'|translate}}" class="ion-padding">\n <ng-template mat-tab-label>\n <mat-icon>\n <ion-icon matPrefix slot="start" name="person-circle"></ion-icon>\n </mat-icon>\n <ion-label>{{\'ACCOUNT.USER_DETAILS.TITLE\'|translate}}</ion-label>\n <ion-icon slot="end" name="alert-circle" color="danger" *ngIf="submitted && form.invalid"></ion-icon>\n </ng-template>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="3"> </ion-col>\n\n <ion-col class="ion-padding">\n <p [innerHTML]="\'ACCOUNT.USER_DETAILS.DESCRIPTION\'|translate"></p>\n\n \x3c!--h1>Identité</h1--\x3e\n\n \x3c!-- Email --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.EMAIL\'|translate"\n formControlName="email" autocomplete="section-red email">\n <mat-error *ngIf="form.controls.email.hasError(\'required\') && form.controls.email.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.email.hasError(\'email\') && form.controls.email.dirty">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n <ion-grid *ngIf="email.notConfirmed" class="ion-no-padding ion-padding-bottom">\n <ion-row>\n <ion-col color="danger">\n <ion-icon slot="start" color="danger" name="alert-circle" color="danger"></ion-icon>\n <ion-text [innerHTML]="\'ACCOUNT.EMAIL_NOT_CONFIRMED_LABEL\'|translate"></ion-text>\n </ion-col>\n </ion-row>\n\n <ion-row style="height: 51px;">\n <ion-col style="text-align: right;">\n <ion-text>\n <small [innerHTML]="\'ACCOUNT.EMAIL_NOT_RECEIVED_QUESTION\'|translate"></small>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="secondary" *ngIf="!email.sending" (click)="sendConfirmationEmail($event)">\n {{\'ACCOUNT.BTN_RESEND\'|translate}}\n </ion-button>\n <ion-spinner class="ion-no-padding" *ngIf="email.sending"></ion-spinner>\n </ion-col>\n </ion-row>\n\n <ion-row *ngIf="email.error && !email.sending">\n <ion-col>\n <span *ngIf="email.error && !email.sending" [innerHTML]="email.error|translate"></span>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Last name --\x3e\n <mat-form-field>\n <input matInput [appAutofocus]="true" [autofocusDelay]="500" [placeholder]="\'USER.LAST_NAME\'|translate"\n formControlName="lastName"\n autocomplete="section-blue family-name"\n required>\n <mat-error *ngIf="form.controls.lastName.hasError(\'required\') && form.controls.lastName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.lastName.hasError(\'minlength\') && form.controls.lastName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- First name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.FIRST_NAME\'|translate" formControlName="firstName" autocomplete="section-blue given-name"\n required>\n <mat-error *ngIf="form.controls.firstName.hasError(\'required\') && form.controls.firstName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.firstName.hasError(\'minlength\') && form.controls.firstName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n\n \x3c!-- Additional fields --\x3e\n <ng-container *ngFor="let definition of additionalFields">\n <app-form-field [definition]="definition"\n [formControlName]="definition.key"\n [required]="definition.extra && definition.extra.account && definition.extra.account.required || false">\n </app-form-field>\n </ng-container>\n\n <h3 translate>ACCOUNT.USER_DETAILS.TECHNICAL_DIVIDER</h3>\n\n \x3c!-- profile --\x3e\n <mat-form-field>\n <input matInput hidden readonly="true" [placeholder]="\'ACCOUNT.USER_DETAILS.PROFILE\'|translate"\n formControlName="mainProfile" required>\n <span>{{\'USER.PROFILE_ENUM.\'+form.controls.mainProfile.value | translate}}</span>\n <mat-error *ngIf="form.controls.firstName.hasError(\'mainProfile\') && form.controls.mainProfile.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- pubkey --\x3e\n <mat-form-field>\n <input matInput readonly="true" [placeholder]="\'ACCOUNT.USER_DETAILS.PUBKEY\'|translate" formControlName="pubkey"\n required>\n <mat-error *ngIf="form.controls.firstName.hasError(\'pubkey\') && form.controls.firstName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.firstName.hasError(\'pubkey\') && form.controls.firstName.dirty">\n <span translate>ERROR.FIELD_NOT_VALID_PUBKEY</span>\n </mat-error>\n </mat-form-field>\n\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="3"> </ion-col>\n </ion-row>\n </ion-grid>\n </mat-tab>\n\n \x3c!-- TAB: settings --\x3e\n <mat-tab label="{{\'ACCOUNT.SETTINGS.TITLE\'|translate}}" formGroupName="settings">\n <ng-template mat-tab-label>\n <mat-icon>\n <ion-icon matPrefix slot="start" name="settings"></ion-icon>\n </mat-icon>\n <ion-label translate>ACCOUNT.SETTINGS.TITLE</ion-label>\n </ng-template>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="3"> \n </ion-col>\n\n <ion-col class="ion-padding">\n\n <p [innerHTML]="\'ACCOUNT.SETTINGS.DESCRIPTION\'|translate"></p>\n\n <mat-form-field>\n <mat-select [placeholder]="\'ACCOUNT.SETTINGS.LOCALE\'|translate" formControlName="locale" required>\n <mat-option *ngFor="let item of locales" [value]="item.key">\n {{item.value}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="settingsForm.controls.locale.hasError(\'required\') && settingsForm.controls.locale.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- lat/long format--\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'ACCOUNT.SETTINGS.LAT_LONG_FORMAT\'|translate" formControlName="latLongFormat"\n required>\n <mat-option *ngFor="let item of latLongFormats" [value]="item">\n {{\'COMMON.LAT_LONG.\'+item+\'_PLACEHOLDER\'|translate}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="settingsForm.controls.latLongFormat.hasError(\'required\') && settingsForm.controls.latLongFormat.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <form formGroupName="content">\n\n\n </form>\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="3"> \n </ion-col>\n </ion-row>\n </ion-grid>\n </mat-tab>\n </mat-tab-group>\n\n\n </form>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <app-form-buttons-bar (onCancel)="cancel()" (onSave)="save($event)" [disabled]="!form.dirty || saving"></app-form-buttons-bar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["mat-tab-group .mat-tab-body-content{padding:var(--ion-grid-padding);display:grid}form,form mat-form-field{width:100%}"]}]}],xc.ctorParameters=function(){return[{type:e.Injector},{type:z.Router},{type:P.FormBuilder},{type:pl},{type:_c},{type:Oc},{type:F.TranslateService},{type:ga},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[rs]}]}]};var kc=function(){this.showRecorder=!0};kc.decorators=[{type:e.Component,args:[{selector:"app-entity-metadata",template:'<ng-container *ngIf="value && value.id">\n <ion-card @fadeInAnimation>\n\n \x3c!-- recorder --\x3e\n <ion-item color="light"\n *ngIf="showRecorder && value && (value.recorderDepartment || value.recorderPerson)">\n\n \x3c!-- recorder avatar --\x3e\n <ion-avatar slot="start" *ngIf="value.recorderPerson; let recorderPerson">\n <img *ngIf="recorderPerson.avatar; else generateAvatar"\n src="{{ recorderPerson.avatar }}">\n <ng-template #generateAvatar>\n <svg *ngIf="recorderPerson.id; let personId"\n width="38" height="38" [data-jdenticon-value]="personId"></svg>\n </ng-template>\n </ion-avatar>\n\n \x3c!-- recorder name --\x3e\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n </ion-item>\n\n <ion-card-content>\n <ion-label class="ion-text-wrap status">\n \x3c!-- creation date --\x3e\n <ion-text *ngIf="value.creationDate">\n <ion-icon name="calendar"></ion-icon> \n <span translate>COMMON.CREATED_ON</span>\n <span>\n <b>{{ value.creationDate | dateFormat: {time: true} }}</b>\n </span>\n </ion-text>\n\n \x3c!-- update date --\x3e\n <ion-text *ngIf="value.updateDate && value.updateDate != value.creationDate">\n <br *ngIf="value.creationDate"/>\n <ion-label>\n <ion-icon name="time-outline"></ion-icon> \n <span translate>COMMON.UPDATED_ON</span>\n <span> {{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n',animations:[Zi],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:1px solid rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content * ion-label.status,ion-card ion-card-content ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}"]}]}],kc.propDecorators={value:[{type:e.Input}],showRecorder:[{type:e.Input}]};var Sc=function(){},Ac=function(){function t(t){var n=this;this.hotkeys=t,this._subscription=new D.Subscription,this.disabled=!1,this.disabledCancel=!1,this.onCancel=new e.EventEmitter,this.onSave=new e.EventEmitter,this.onNext=new e.EventEmitter,this.onBack=new e.EventEmitter,this._subscription.add(t.addShortcut({keys:"control.s",description:"COMMON.BTN_SAVE"}).pipe(N.filter((function(t){return!n.disabled}))).subscribe((function(t){return n.onSave.emit(t)}))),this._subscription.add(t.addShortcut({keys:"control.z",description:"COMMON.BTN_RESET"}).pipe(N.filter((function(t){return!n.disabled&&!n.disabledCancel}))).subscribe((function(t){return n.onCancel.emit(t)}))),this._subscription.add(t.addShortcut({keys:"escape",description:"COMMON.BTN_CLOSE",preventDefault:!1}).pipe(N.filter((function(t){return!t.defaultPrevented}))).subscribe((function(t){return n.onBack.emit(t)})))}return t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.onCancel.complete(),this.onSave.complete(),this.onNext.complete(),this.onBack.complete()},t}();Ac.decorators=[{type:e.Component,args:[{selector:"app-form-buttons-bar",template:'<ion-toolbar [class]="classList">\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n <ng-content></ng-content>\n </ion-col>\n\n <ion-col size="auto">\n\n \x3c!-- close (go back) --\x3e\n <ion-button fill="clear" color="dark" (click)="onBack.emit($event)"\n (keyup.enter)="onBack.emit($event)"\n *ngIf="onBack.observers | isNotEmptyArray">\n <ion-label translate>COMMON.BTN_CLOSE</ion-label>\n </ion-button>\n\n \x3c!-- reload --\x3e\n <ion-button fill="clear" color="dark" (click)="onCancel.emit($event)"\n (keyup.enter)="onCancel.emit($event)"\n [disabled]="disabledCancel">\n <ion-icon slot="start" name="refresh"></ion-icon>\n <ion-label translate>COMMON.BTN_RESET</ion-label>\n </ion-button>\n\n \x3c!-- next --\x3e\n <ion-button fill="solid" (click)="onNext.emit($event)" (keyup.enter)="onNext.emit($event)" *ngIf="onNext.observers | isNotEmptyArray">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n \x3c!-- save --\x3e\n <ion-button [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onSave.emit($event)"\n (keyup.enter)="onSave.emit($event)" color="danger"\n [disabled]="disabled">\n <ion-label [innerHTML]="\'COMMON.BTN_SAVE_WITH_SHORTCUT\'|translate" [title]="\'COMMON.BTN_SAVE_WITH_SHORTCUT_HELP\'|translate"></ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n</ion-toolbar>\n',providers:[{provide:Sc,useExisting:Ac}],styles:[":host{width:100%}:host ion-toolbar{height:var(--app-form-buttons-bar-height);padding:0 6px}:host ion-col{padding:0}"]}]}],Ac.ctorParameters=function(){return[{type:Ai}]},Ac.propDecorators={disabled:[{type:e.Input}],disabledCancel:[{type:e.Input}],classList:[{type:e.Input}],onCancel:[{type:e.Output}],onSave:[{type:e.Output}],onNext:[{type:e.Output}],onBack:[{type:e.Output}]};var Tc=function(){function t(t,e){this.navParams=t,this.viewCtrl=e,this.canHideColumns=!0}return t.prototype.ngOnInit=function(){var t=this;this.columns=this.columns||this.navParams.data&&this.navParams.data.columns||[],this.columns.forEach((function(e){e.visible=!1===t.canHideColumns||e.visible,e.canHide=je(e.canHide,t.canHideColumns)}))},t.prototype.onRenderItems=function(t){var e=this.columns.splice(t.detail.from,1)[0];this.columns.splice(t.detail.to,0,e),t.detail.complete()},t.prototype.close=function(){this.viewCtrl.dismiss(this.columns)},t.prototype.cancel=function(){this.viewCtrl.dismiss()},t}();Tc.decorators=[{type:e.Component,args:[{selector:"table-select-columns",template:'<ion-header>\n <ion-toolbar color="light">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'COMMON.DISPLAYED_COLUMNS\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-button (click)="close()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="checkmark"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n\n<ion-content>\n <ion-list>\n \x3c!-- See doc: https://beta.ionicframework.com/docs/api/reorder/ --\x3e\n\n <ion-reorder-group disabled="false" (ionItemReorder)="onRenderItems($event)">\n <ion-item *ngFor="let column of columns">\n <ion-label>{{column.label|translate}}</ion-label>\n <ion-toggle slot="end"\n *ngIf="column.canHide"\n [checked]="column.visible" (ionChange)="column.visible=!column.visible"></ion-toggle>\n <ion-reorder slot="end"></ion-reorder>\n </ion-item>\n </ion-reorder-group>\n </ion-list>\n</ion-content>\n\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button fill="solid" (click)="close()" color="tertiary">\n <ion-label translate>COMMON.BTN_APPLY</ion-label>\n </ion-button>\n\n </ion-col>\n </ion-row>\n\n </ion-toolbar>\n</ion-footer>\n'}]}],Tc.ctorParameters=function(){return[{type:M.NavParams},{type:M.ModalController}]},Tc.propDecorators={columns:[{type:e.Input}],canHideColumns:[{type:e.Input}]};var Rc=function(){function n(t,n,o,r,i){var a=this;this.accountService=t,this.accountValidatorService=n,this.formBuilder=o,this.environment=r,this.settings=i,this.debug=!1,this.subscriptions=[],this.sending=!1,this.showPwd=!1,this.showConfirmPwd=!1,this.onCancel=new e.EventEmitter,this.onSubmit=new e.EventEmitter,this.referentialToString=ss,this.forms=[],this.forms.push(o.group({email:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.email]),this.emailAvailability(this.accountService)),confirmEmail:new P.FormControl(null,P.Validators.compose([P.Validators.required,this.equalsValidator("email")]))})),this.forms.push(o.group({password:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(8)])),confirmPassword:new P.FormControl(null,P.Validators.compose([P.Validators.required,this.equalsValidator("password")]))}));var s={lastName:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])),firstName:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)]))};this.autocompleteHelper=new Pn(i&&{getUserAttributes:function(t,e){return i.getFieldDisplayAttributes(t,e)}}),this.additionalFields=this.accountService.additionalFields.filter((function(t){return t.extra&&t.extra.registration&&t.extra.registration.required})),this.additionalFields.forEach((function(t){s[t.key]=new P.FormControl(null,a.accountValidatorService.getValidators(t)),"entity"===t.type&&(t.autocomplete=a.autocompleteHelper.add(t.key,t.autocomplete))})),this.forms.push(o.group(s)),this.form=o.group({emailStep:this.forms[0],passwordStep:this.forms[1],detailsStep:this.forms[2]})}return n.prototype.ngOnInit=function(){this.environment.production||this.form.setValue({emailStep:{email:"contact@e-is.pro",confirmEmail:"contact@e-is.pro"},passwordStep:{password:"contactera",confirmPassword:"contactera"},detailsStep:{lastName:"Lavenier 2",firstName:"Benoit",department:null}})},Object.defineProperty(n.prototype,"value",{get:function(){var e={username:this.form.value.emailStep.email,password:this.form.value.passwordStep.password,account:new t.Account};return e.account.fromObject(this.form.value.detailsStep),e.account.email=e.username,e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"valid",{get:function(){return this.form.valid},enumerable:!1,configurable:!0}),n.prototype.isEnd=function(){return 2===this.stepper.selectedIndex},n.prototype.isBeginning=function(){return 0===this.stepper.selectedIndex},n.prototype.slidePrev=function(){return this.stepper.previous()},n.prototype.slideNext=function(t){return t&&(t.stopPropagation(),t.preventDefault()),this.stepper.next()},n.prototype.equalsValidator=function(t){return function(e){return e.parent&&e.value!==e.parent.value[t]?{equals:!0}:null}},n.prototype.emailAvailability=function(t){return function(e){return D.timer(500).pipe(N.mergeMap((function(){return t.checkEmailAvailable(e.value).then((function(t){return null})).catch((function(t){return console.error(t),{availability:!0}}))})))}},n.prototype.cancel=function(){this.onCancel.emit()},n.prototype.doSubmit=function(t){this.form.invalid||(this.sending=!0,this.onSubmit.emit(this.value))},n.prototype.markAsTouched=function(){this.form.markAsTouched()},n.prototype.disable=function(){this.form.disable()},n.prototype.enable=function(){this.form.enable()},n}();Rc.decorators=[{type:e.Component,args:[{selector:"form-register",template:'<mat-horizontal-stepper linear #stepper="matHorizontalStepper">\n\n \x3c!-- Step 1: Username --\x3e\n <mat-step [stepControl]="forms[0]" *ngIf="forms[0].controls; let controls">\n\n <form [formGroup]="forms[0]" class="form-container ion-padding" (keyup.enter)="slideNext($event)">\n <ng-template matStepLabel>{{\'REGISTER.STEP_EMAIL\'|translate}}</ng-template>\n\n \x3c!-- Email --\x3e\n <mat-form-field>\n <input matInput\n [appAutofocus]="true" [autofocusDelay]="500" [placeholder]="\'USER.EMAIL\'|translate"\n formControlName="email" autocomplete="off" required>\n <mat-error *ngIf="controls.email.hasError(\'required\') && controls.email.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.email.hasError(\'email\') && !controls.email.hasError(\'required\') && controls.email.touched">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n <mat-error *ngIf="controls.email.hasError(\'availability\') && controls.email.touched" translate>REGISTER.ERROR.EMAIL_ALREADY_REGISTERED</mat-error>\n\n </mat-form-field>\n\n \x3c!-- Confirm Email --\x3e\n <mat-form-field>\n <input matInput autocomplete="off" matFormFieldControl [placeholder]="\'REGISTER.CONFIRM_EMAIL\'|translate" formControlName="confirmEmail">\n <mat-error *ngIf="controls.confirmEmail.hasError(\'required\') && controls.confirmEmail.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.confirmEmail.hasError(\'equals\') && controls.confirmEmail.touched">\n <span>{{\'REGISTER.ERROR.NOT_SAME_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n </form>\n </mat-step>\n\n\n \x3c!-- Step 2: Password --\x3e\n <mat-step [stepControl]="forms[1]" *ngIf="forms[1].controls; let controls">\n\n <form [formGroup]="forms[1]" class="form-container ion-padding" (keyup.enter)="slideNext($event)">\n\n <ng-template matStepLabel>{{\'REGISTER.STEP_PASSWORD\'|translate}}</ng-template>\n\n \x3c!-- Password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.PASSWORD\'|translate"\n formControlName="password"\n autocomplete="section-red new-password"\n [type]="showPwd ? \'text\' : \'password\'"\n required>\n <button matSuffix mat-icon-button\n type="button"\n (click)="showPwd = !showPwd"\n tabindex="-1">\n <mat-icon>{{showPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="controls.password.hasError(\'required\') && controls.password.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.password.hasError(\'minlength\') && controls.password.touched">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 8} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Confirm password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'REGISTER.CONFIRM_PASSWORD\'|translate"\n formControlName="confirmPassword"\n autocomplete="section-red new-password"\n [type]="showConfirmPwd ? \'text\' : \'password\'"\n required>\n <button mat-icon-button matSuffix\n (click)="showConfirmPwd = !showConfirmPwd"\n tabindex="-1">\n <mat-icon>{{showConfirmPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="controls.confirmPassword.hasError(\'required\') && controls.confirmPassword.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.confirmPassword.hasError(\'equals\') && controls.confirmPassword.touched">\n <span>{{\'REGISTER.ERROR.NOT_SAME_PASSWORD\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n </form>\n </mat-step>\n\n\n \x3c!-- Step 3: user details --\x3e\n <mat-step [stepControl]="forms[2]" *ngIf="forms[2].controls; let controls">\n\n <form [formGroup]="forms[2]" (ngSubmit)="doSubmit($event)" class="form-container ion-padding" (keyup.enter)="doSubmit()">\n\n <ng-template matStepLabel>{{\'REGISTER.STEP_USER_DETAILS\'|translate}}</ng-template>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error && !sending" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- Last name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.LAST_NAME\'|translate" formControlName="lastName" autocomplete="section-blue family-name"\n required>\n <mat-error *ngIf="controls.lastName.hasError(\'required\') && controls.lastName.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.lastName.hasError(\'minlength\') && controls.lastName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- First name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.FIRST_NAME\'|translate" formControlName="firstName" autocomplete="section-blue given-name"\n required>\n <mat-error *ngIf="controls.firstName.hasError(\'required\') && controls.firstName.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.firstName.hasError(\'minlength\') && controls.firstName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Additional fields --\x3e\n <app-form-field *ngFor="let field of additionalFields"\n [definition]="field"\n [formControlName]="field.key"\n [required]="true">\n </app-form-field>\n\n </form>\n </mat-step>\n</mat-horizontal-stepper>\n',styles:["form ion-toolbar.toolbar-buttons .toolbar-content{text-align:right}form ion-toolbar.toolbar-buttons .toolbar-background{border:0;background:inherit!important}"]}]}],Rc.ctorParameters=function(){return[{type:pl},{type:_c},{type:P.FormBuilder},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ga}]},Rc.propDecorators={stepper:[{type:e.ViewChild,args:["stepper",{static:!0}]}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var Pc=function(){};Pc.decorators=[{type:e.NgModule,args:[{imports:[Q.HttpClientModule],exports:[Q.HttpClientModule]}]}],Pc.ctorParameters=function(){return[]};var Dc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.networkService=n,o}return Ee(e,t),e.prototype.getFormGroup=function(t){var e=this;return this.formBuilder.group({accountInheritance:[t&&t.accountInheritance||!0,P.Validators.required],locale:[t&&t.locale||null,P.Validators.required],latLongFormat:[t&&t.latLongFormat||null,P.Validators.required],usageMode:[t&&t.usageMode||"DESK",P.Validators.required],peerUrl:[t&&t.peerUrl,P.Validators.required],properties:this.getPropertiesArray(t&&t.properties)},{asyncValidators:function(t){return e.peerAlive(t.get("peerUrl"))}})},e.prototype.getPropertiesArray=function(t){var e=this,n=Qi.getMapAsArray(t||{});return this.formBuilder.array(n.map((function(t){return e.getPropertyFormGroup(t)})))},e.prototype.getPropertyFormGroup=function(t){return this.formBuilder.group({key:[t&&t.key||null,P.Validators.compose([P.Validators.required,P.Validators.max(50)])],value:[t&&t.value||null,P.Validators.compose([P.Validators.required,P.Validators.max(100)])]})},e.prototype.peerAlive=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.networkService.offline?(Do.clearError(t,"peerAlive"),[3,3]):[3,1];case 1:return[4,this.networkService.checkPeerAlive(t.value)];case 2:if(!n.sent())return(e=t.errors||{}).peerAlive=!0,t.setErrors(e),t.markAsTouched({onlySelf:!0}),[2,{peerAlive:!0}];Do.clearError(t,"peerAlive"),n.label=3;case 3:return[2]}}))}))},e}(Ic);Dc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Dc(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(Ca))},token:Dc,providedIn:"root"}),Dc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Dc.ctorParameters=function(){return[{type:P.FormBuilder},{type:Ca}]};var Nc=function(e){function n(t,n,o,r,i,a,s,l,c,u,d,p){var h=e.call(this,t,r.getFormGroup())||this;return h.platform=n,h.router=o,h.validatorService=r,h.alertCtrl=i,h.translate=a,h.formBuilder=s,h.accountService=l,h.settings=c,h.cd=u,h.network=d,h.locales=p,h.saving=!1,h.usageModes=["FIELD","DESK"],h.propertyDefinitionsByKey={},h.propertyDefinitionsByIndex={},h.latLongFormats=["DDMMSS","DDMM","DD"],h.propertiesFormHelper=new ar(h.form.get("properties"),(function(t){return h.validatorService.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return Ae(t)||Ae(t.key)&&Ae(t.value)}),{allowEmptyArray:!0}),h.mobile=h.platform.mobile,h._enable=!1,h}return Ee(n,e),Object.defineProperty(n.prototype,"accountInheritance",{get:function(){return this.form.controls.accountInheritance.value},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLogin",{get:function(){return this.accountService.isLogin()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"propertiesForm",{get:function(){return this.form.get("properties")},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var t=Object.create(null,{ngOnInit:{get:function(){return e.prototype.ngOnInit}}});return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return t.ngOnInit.call(this),[4,this.platform.ready()];case 1:return n.sent(),this.propertyDefinitions=this.settings.optionDefs.slice(),this.propertyDefinitions.forEach((function(t){return e.propertyDefinitionsByKey[t.key]=t})),[4,this.load()];case 2:return n.sent(),this.registerSubscription(D.merge(this.accountService.onLogin,this.accountService.onLogout).subscribe((function(){return e.setAccountInheritance(e.accountInheritance)}))),[2]}}))}))},n.prototype.getPropertyDefinition=function(t){var e=this.propertyDefinitionsByIndex[t];return e||(e=this.updatePropertyDefinition(t),this.propertyDefinitionsByIndex[t]=e),e},n.prototype.updatePropertyDefinition=function(t){var e=this.propertiesForm.at(t).controls.key.value,n=e&&this.propertyDefinitionsByKey[e]||null;return this.propertyDefinitionsByIndex[t]=n,this.markForCheck(),n},n.prototype.removePropertyAt=function(t){this.propertiesFormHelper.removeAt(t),this.propertyDefinitionsByIndex={},this.markForCheck()},n.prototype.load=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return this.markAsLoading(),console.debug("[settings] Loading settings..."),(t=this.settings.settings).accountInheritance=je(t.accountInheritance,!0),t.locale=t.locale||this.translate.currentLang||this.translate.defaultLang,t.latLongFormat=t.latLongFormat||"DDMMSS",t.usageMode=t.usageMode||"DESK",Te(t.peerUrl)?[4,this.network.ready()]:[3,2];case 1:n.sent(),e=this.network.peer,t.peerUrl=e&&e.url,n.label=2;case 2:return this.updateView(t),[2]}}))}))},n.prototype.updateView=function(t){if(t){this.data=t;var e=Object.assign({},t);e.properties=Qi.getMapAsArray(t.properties||{}),this.propertiesFormHelper.resize(e.properties.length),this.form.patchValue(e,{emitEvent:!1}),this.markAsPristine(),this.enable({emitEvent:!1}),this.setAccountInheritance(t.accountInheritance,{emitEvent:!1}),this.markAsLoaded(),this.error=null,this.markForCheck()}},n.prototype.save=function(e,n){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.saving?[2]:(this.propertiesFormHelper.removeAllEmpty(),this.form.invalid&&this.debug&&jo.logFormErrors(this.form),console.debug("[settings] Saving local settings..."),this.saving=!0,this.error=void 0,[4,this.getValue()]);case 1:e=r.sent(),(n=this.form.get("peerUrl").dirty)&&(e.pageHistory=[]),r.label=2;case 2:return r.trys.push([2,4,5,6]),this.disable(),[4,this.settings.apply(e)];case 3:return r.sent(),this.data=e,this.markAsPristine(),n&&(this.network.peer=t.Peer.parseUrl(e.peerUrl)),[2,!0];case 4:return o=r.sent(),console.error(o),this.error=o&&o.message||o,[2,!1];case 5:return this.enable({emitEvent:!1}),this.setAccountInheritance(e.accountInheritance,{emitEvent:!1}),this.saving=!1,this.markForCheck(),[7];case 6:return[2]}}))}))},n.prototype.setAccountInheritance=function(t,e){if(this.form.controls.accountInheritance.setValue(t,e),this.data.accountInheritance!==t&&this.form.controls.accountInheritance.markAsDirty({onlySelf:!1}),t)if(this.isLogin){var n=this.accountService.account;n.settings&&(n.settings.locale&&this.form.get("locale").setValue(n.settings.locale,e),n.settings.latLongFormat&&this.form.get("latLongFormat").setValue(n.settings.latLongFormat,e)),this.form.get("locale").disable(e),this.form.get("latLongFormat").disable(e)}else this.form.get("locale").enable(e),this.form.get("latLongFormat").enable(e);else this.form.get("locale").setValue(this.data.locale,e),this.form.get("latLongFormat").setValue(this.data.latLongFormat,e),this.form.get("locale").enable(e),this.form.get("latLongFormat").enable(e);e&&!e.emitEvent||this.markForCheck()},n.prototype.showSelectPeerModal=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.network.showSelectPeerModal(t)];case 1:return(e=o.sent())&&e.url&&((n=this.form.get("peerUrl")).setValue(e.url,{emitEvent:!0,onlySelf:!1}),n.markAsDirty({onlySelf:!1}),this.markAsDirty()),[2]}}))}))},n.prototype.cancel=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.load()];case 1:return t.sent(),[2]}}))}))},n.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.saving?[2]:this.dirty?[4,Dl.askSaveBeforeLeave(this.alertCtrl,this.translate)]:[3,3];case 1:return e.sent()?[4,this.save(t)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2,this.router.navigateByUrl("/",{skipLocationChange:!0})]}}))}))},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,Dl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)];case 1:return e.sent()?[4,this.network.clearCache()]:[3,3];case 2:e.sent(),this.settings.removeOfflineFeatures(),e.label=3;case 3:return[2]}}))}))},n.prototype.getValue=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.getJsonValueToSave()];case 1:return(t=o.sent()).accountInheritance&&this.isLogin&&(e=this.accountService.account,n=e&&e.settings,console.debug("[settings] Applying account inheritance {locale: '"+n.locale+"', latLongFormat: '"+n.latLongFormat+"'}..."),t.locale=n.locale||t.locale,t.latLongFormat=n.latLongFormat||t.latLongFormat),[2,t]}}))}))},n.prototype.getJsonValueToSave=function(){var t=this.form.value;return t.properties=Qi.getPropertyArrayAsObject(t.properties),Promise.resolve(t)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);Nc.decorators=[{type:e.Component,args:[{selector:"page-settings",template:'<app-toolbar [title]="\'SETTINGS.TITLE\'|translate" color="primary"\n [hasValidate]="form.dirty && !saving"\n [hasClose]="!form.dirty && !saving"\n (onValidate)="save($event)"\n (onClose)="close($event)">\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="loading || saving"></ion-spinner>\n\n \x3c!-- options menu --\x3e\n <ion-button [matMenuTriggerFor]="optionsMenu">\n <mat-icon slot="icon-only">more_vert</mat-icon>\n </ion-button>\n </ion-buttons>\n</app-toolbar>\n\n\x3c!-- Options menu --\x3e\n<mat-menu #optionsMenu="matMenu">\n \x3c!-- Clear cache --\x3e\n <button mat-menu-item (click)="clearCache($event)">\n <ion-label translate>SETTINGS.BTN_CLEAR_CACHE</ion-label>\n </button>\n\n \x3c!-- Reset --\x3e\n <button mat-menu-item\n [disabled]="!dirty"\n (click)="cancel($event)">\n <ion-label>\n <mat-icon><ion-icon slot="start" name="refresh"></ion-icon></mat-icon> \n <span translate>COMMON.BTN_RESET</span>\n </ion-label>\n </button>\n</mat-menu>\n\n<ion-content>\n\n <form [formGroup]="form" novalidate (ngSubmit)="save($event)" class="form-container">\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="2"> \n </ion-col>\n\n <ion-col class="ion-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <p [innerHTML]="\'SETTINGS.DESCRIPTION\'|translate"></p>\n\n \x3c!-- account inheritance (desktop) --\x3e\n <mat-form-field [hidden]="!isLogin" *ngIf="!mobile; else accountInheritanceMobile">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- check box (if desktop) --\x3e\n <mat-checkbox\n *ngIf="!mobile; else accountInheritanceMobile"\n (change)="setAccountInheritance($event.checked)"\n [checked]="accountInheritance">\n <span translate>SETTINGS.INHERIT_FROM_ACCOUNT</span>\n </mat-checkbox>\n\n <mat-error *ngIf="form.controls.accountInheritance.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- account inheritance (if mobile) --\x3e\n <ng-template #accountInheritanceMobile>\n <mat-form-field [hidden]="!isLogin">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- slide toggle --\x3e\n <ion-text translate>SETTINGS.INHERIT_FROM_ACCOUNT</ion-text>\n <mat-slide-toggle matSuffix\n (change)="setAccountInheritance($event.checked)"\n [checked]="accountInheritance">\n\n </mat-slide-toggle>\n <mat-error *ngIf="form.controls.accountInheritance.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ng-template>\n\n \x3c!-- locale --\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.LOCALE\'|translate" formControlName="locale" required>\n <mat-option *ngFor="let item of locales" [value]="item.key">\n {{item.value}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="form.controls.locale.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Network entry --\x3e\n <h3>\n <ion-text translate>SETTINGS.NETWORK_DIVIDER</ion-text>\n </h3>\n\n \x3c!-- Peer address --\x3e\n <mat-form-field>\n <input matInput type="text" [placeholder]="\'SETTINGS.PEER_URL\'|translate" formControlName="peerUrl"\n required>\n\n <button mat-icon-button type="button" matSuffix (click)="showSelectPeerModal()" tabindex="-1"\n [title]="\'SETTINGS.BTN_CHANGE_PEER\'|translate">\n <mat-icon>search</mat-icon>\n </button>\n\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'peerAlive\')"\n translate>SETTINGS.ERROR.PEER_NOT_REACHABLE\n </mat-error>\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'peerNotCompatible\')"\n translate>SETTINGS.ERROR.PEER_NOT_COMPATIBLE\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Offline mode (if mobile) --\x3e\n <mat-form-field *ngIf="mobile">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- slide toggle --\x3e\n <ion-text translate>SETTINGS.OFFLINE_MODE</ion-text>\n <mat-slide-toggle matSuffix\n (change)="network.setForceOffline($event.checked)"\n [checked]="network.offline">\n\n </mat-slide-toggle>\n </mat-form-field>\n\n \x3c!-- Data entry --\x3e\n <h3>\n <ion-text translate>SETTINGS.DATA_ENTRY_DIVIDER</ion-text>\n </h3>\n\n \x3c!-- Usage mode --\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.USAGE_MODE\'|translate" formControlName="usageMode"\n required>\n <mat-option *ngFor="let item of usageModes" [value]="item">\n {{\'SETTINGS.USAGE_MODES.\'+item|translate}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="form.controls.usageMode.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- lat/long format--\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.LAT_LONG_FORMAT\'|translate" formControlName="latLongFormat"\n required>\n <mat-option *ngFor="let item of latLongFormats" [value]="item">\n {{\'COMMON.LAT_LONG.\'+item+\'_PLACEHOLDER\'|translate}}\n </mat-option>\n </mat-select>\n <mat-error\n *ngIf="form.controls.latLongFormat.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- fields options --\x3e\n <ion-grid formArrayName="properties" class="ion-no-padding">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding ion-align-self-end" size="12">\n <span class="toolbar-spacer"></span>\n\n \x3c!-- Show more options --\x3e\n <ion-button color="light" *ngIf="propertiesForm?.length === 0"\n [title]="\'SETTINGS.BTN_SHOW_MORE_HELP\'|translate"\n (click)="propertiesFormHelper.add()">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n \x3c!-- Fields options --\x3e\n <ng-container *ngFor="let propertyForm of propertiesForm?.controls; let i=index">\n <ion-row class="ion-no-padding" [formGroupName]="i">\n\n \x3c!-- property key --\x3e\n <ion-col class="ion-no-padding">\n <mat-form-field>\n <mat-select formControlName="key"\n [placeholder]=" \'SETTINGS.PROPERTY_KEY\'|translate">\n <mat-option *ngFor="let item of propertyDefinitions" [value]="item.key">{{ item.label | translate }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- property value --\x3e\n <ion-col class="ion-no-padding" padding-left>\n <app-form-field *ngIf="getPropertyDefinition(i); let definition"\n floatLabel="never"\n [definition]="definition"\n [formControl]="propertyForm.controls.value"\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [required]="true">\n </app-form-field>\n </ion-col>\n <ion-col size="2" class="ion-no-padding">\n <button type="button" mat-icon-button color="light"\n [disabled]="loading"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="removePropertyAt(i)">\n <mat-icon>close</mat-icon>\n </button>\n <button *ngIf="propertiesFormHelper.isLast(i)"\n type="button"\n mat-icon-button\n color="light"\n [disabled]="loading"\n [title]="\'SETTINGS.BTN_ADD_PROPERTY\'|translate"\n (click)="propertiesFormHelper.add()">\n <mat-icon>add</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n </ng-container>\n </ion-grid>\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="2"> \n </ion-col>\n </ion-row>\n </ion-grid>\n\n\n </form>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <app-form-buttons-bar (onCancel)="cancel()" (onSave)="save($event)" [disabled]="!form.dirty || saving"></app-form-buttons-bar>\n</ion-footer>\n',providers:[{provide:Dt.ValidatorService,useExisting:Dc}],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Nc.ctorParameters=function(){return[{type:e.Injector},{type:Sl},{type:z.Router},{type:Dc},{type:M.AlertController},{type:F.TranslateService},{type:P.FormBuilder},{type:pl},{type:ga},{type:e.ChangeDetectorRef},{type:Ca},{type:Array,decorators:[{type:e.Inject,args:[rs]}]}]};var Fc=function(t){function e(e,n,o,r,i,a){var s=t.call(this,e,null)||this;return s.formBuilder=n,s.dateAdapter=o,s.settings=r,s.cd=i,s.formGroupDir=a,s.definitionsMapByKey={},s.definitionsByIndex={},s}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.formArray.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fieldForms",{get:function(){return this.formArray.controls},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;if(Fe(this.definitions))throw new Error("Missing or invalid attribute 'definitions'");this.definitionsMapByKey={},this.definitions.forEach((function(t){e.definitionsMapByKey[t.key]=t}));var n=this.formArray&&this.formArray.parent||this.formGroupDir&&this.formGroupDir.form||this.formBuilder.group({});this.setForm(n),this.formArray=this.formArray||this.formArrayName&&n.get(this.formArrayName),this.formArrayName=this.formArrayName||this.formArray&&Object.keys(n.controls).find((function(t){return n.get(t)===e.formArray}))||"properties",this.formArray||(console.warn("Missing array control '"+this.formArrayName+"'. Will create it!"),this.formArray=this.formBuilder.array([]),this.form.addControl(this.formArrayName,this.formArray)),this.helper=new ar(this.formArray,(function(t){return e.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return Ae(t)||Ae(t.key)&&Ae(t.value)}),this.options),t.prototype.ngOnInit.call(this)},e.prototype.getDefinitionAt=function(t){var e=this.definitionsByIndex[t];return e||(e=this.updateDefinitionAt(t),this.definitionsByIndex[t]=e),e},e.prototype.updateDefinitionAt=function(t){var e=this.formArray.at(t).controls.key.value,n=e&&this.definitionsMapByKey[e]||null;return this.definitionsByIndex[t]=n,this.markForCheck(),n},e.prototype.removeAt=function(t){this.helper.removeAt(t),this.definitionsByIndex={},this.markForCheck()},e.prototype.isUnknownField=function(t){var e=t.get("key"),n=e&&e.value;return n&&Ae(this.definitionsMapByKey[n])},e.prototype.setValue=function(t){if(t){var e=Qi.getMapAsArray(t);this.helper.resize(e.length),this.helper.formArray.patchValue(e,{emitEvent:!1}),this.markAsPristine(),this.markAsLoaded()}},e.prototype.getPropertyFormGroup=function(t){return this.formBuilder.group({key:[t&&t.key||null,P.Validators.compose([P.Validators.required,P.Validators.max(50)])],value:[t&&t.value||null,P.Validators.required]})},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}(pc);Fc.decorators=[{type:e.Component,args:[{selector:"app-properties-form",template:'\n\x3c!-- Properties --\x3e\n<form [formGroup]="form" class="form-container">\n <ion-grid *ngIf="!loading; else propertiesSkeleton"\n formArrayName="properties" class="ion-no-padding" >\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding ion-align-self-end" size="12">\n <span class="toolbar-spacer"></span>\n\n \x3c!-- Show more options --\x3e\n <ion-button color="light" *ngIf="formArray?.length === 0"\n [title]="\'SETTINGS.BTN_SHOW_MORE_HELP\'|translate"\n (click)="helper.add()">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-container *ngFor="let fieldForm of fieldForms; let i=index">\n <ion-row class="ion-no-padding" [formGroupName]="i">\n\n \x3c!-- property key --\x3e\n <ion-col size="6" class="ion-no-padding">\n <mat-form-field floatLabel="never">\n <mat-select [formControl]="fieldForm.controls.key"\n [placeholder]="\'SETTINGS.PROPERTY_KEY\'|translate"\n (selectionChange)="updateDefinitionAt(i)"\n [tabindex]="20+i*2"\n required>\n\n \x3c!-- When option\'s key not a well known option, add it as first select option --\x3e\n <mat-option *ngIf="isUnknownField(fieldForm)" [value]="fieldForm.controls.key.value">\n {{fieldForm.controls.key.value}}\n </mat-option>\n\n <mat-option *ngFor="let item of definitions" [value]="item.key">{{ item.label | translate }}\n </mat-option>\n\n </mat-select>\n\n <mat-error *ngIf="fieldForm.controls.key.hasError(\'required\') && !helper.isLast(i)"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- property value --\x3e\n <ion-col class="ion-no-padding" padding-left >\n <app-form-field *ngIf="getDefinitionAt(i) else unknownValue; let definition; "\n floatLabel="never"\n [definition]="definition"\n [formControl]="fieldForm.controls.value"\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [required]="true"\n [tabindex]="20+i*2 + 1">\n </app-form-field>\n <ng-template #unknownValue>\n <mat-form-field floatLabel="never">\n <input type="text" matInput\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [formControl]="fieldForm.controls.value"\n [required]="true"\n [tabindex]="20+i*2 + 1">\n </mat-form-field>\n </ng-template>\n </ion-col>\n\n <ion-col size="auto" class="ion-no-padding">\n <button type="button" mat-icon-button color="light"\n [disabled]="disabled"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="removeAt(i)">\n <mat-icon>close</mat-icon>\n </button>\n <button [hidden]="!helper.isLast(i)"\n type="button"\n mat-icon-button\n color="light"\n [disabled]="disabled"\n [title]="\'SETTINGS.BTN_ADD_PROPERTY\'|translate"\n (click)="helper.add()">\n <mat-icon>add</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n </ng-container>\n </ion-grid>\n</form>\n\n<ng-template #propertiesSkeleton>\n\n <ion-grid class="ion-no-padding">\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n </ion-grid>\n\n</ng-template>\n\n<ng-template #propertyRowSkeleton>\n\n <ion-row>\n \x3c!-- property key --\x3e\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n <ion-icon name="arrow-dropdown" matSuffix></ion-icon>\n </mat-form-field>\n </ion-col>\n \x3c!-- value --\x3e\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n </mat-form-field>\n </ion-col>\n \x3c!-- buttons --\x3e\n <ion-col size="2">\n <button type="button" mat-icon-button color="light"\n [disabled]="true">\n <mat-icon>close</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Fc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:ga},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Fc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],definitions:[{type:e.Input}]};var Mc=function(t){function n(n,o,r,i,a,s){var l=t.call(this,n,null)||this;return l.injector=n,l.formBuilder=o,l.dateAdapter=r,l.settings=i,l.cd=a,l.formGroupDir=s,l.selection=new Nt.SelectionModel(!0,[]),l.displayWithFn=ss,l.onNewItem=new e.EventEmitter,l.selectionChanges=new e.EventEmitter(!0),l}return Ee(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.formArray.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"itemControls",{get:function(){return this.formArray&&this.formArray.controls},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"length",{get:function(){return this.helper?this.helper.size():0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"empty",{get:function(){return 0===this.length},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"touched",{get:function(){return this.formArray&&(this.formArray.touched||-1!==(this.formArray.controls||[]).findIndex((function(t){return t.touched})))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"untouched",{get:function(){return!this.formArray||this.formArray.untouched||-1===(this.formArray.controls||[]).findIndex((function(t){return t.touched}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dirty",{get:function(){return this.formArray&&this.formArray.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"invalid",{get:function(){return!this.formArray||this.formArray.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"valid",{get:function(){return this.formArray&&this.formArray.valid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pending",{get:function(){return!this.formArray||this.formArray.pending},enumerable:!1,configurable:!0}),n.prototype.markAsTouched=function(t){jo.markAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.markAllAsTouched=function(t){jo.markAllAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.ngOnInit=function(){var e=this;this.options=Object.assign({allowEmptyArray:!0,allowMultipleSelection:!0,buttons:[]},this.options);var n=this.formArray&&this.formArray.parent||this.formGroupDir&&this.formGroupDir.form||this.formBuilder.group({});this.setForm(n),this.formArray=this.formArray||this.formArrayName&&n.get(this.formArrayName),this.formArrayName=this.formArrayName||this.formArray&&Object.keys(n.controls).find((function(t){return n.get(t)===e.formArray}))||"properties",this.formArray||(console.warn("Missing array control '"+this.formArrayName+"'. Will create it!"),this.formArray=this.formBuilder.array([]),this.form.addControl(this.formArrayName,this.formArray)),this.equalsFn=this.equalsFn||function(t,e){return Ae(t)&&Ae(e)||t===e},this.helper=new ar(this.formArray,(function(t){return e.createControl(t)}),this.equalsFn,(function(t){return Ae(t)}),this.options),t.prototype.ngOnInit.call(this)},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.onNewItem.complete(),this.onNewItem.unsubscribe(),this.selectionChanges.complete(),this.selectionChanges.unsubscribe()},n.prototype.setValue=function(t){t=t||[],this.helper?(this.helper.resize(t.length),this.helper.formArray.patchValue(t,{emitEvent:!1})):console.warn("TODO: cannot applyied setValue() on fromArray, because formArrayHelper not exists yet !"),this.selection.clear(),this.markAsPristine(),this.markAsLoaded()},n.prototype.isAllSelected=function(){return this.selection.selected.length===this.length},n.prototype.masterToggle=function(t){return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){return this.loading||(this.isAllSelected()?this.selection.clear():this.value.forEach((function(t){return e.selection.select(t)})),t&&!1===t.emitEvent||this.selectionChanges.emit(this.selection.selected)),[2]}))}))},n.prototype.onItemClick=function(t,e,n){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){return e&&!t.defaultPrevented&&this.selectionChanges.observers.length?(t.ctrlKey&&this.options.allowMultipleSelection?this.selection.toggle(e):!this.selection.isSelected(e)||this.options.allowMultipleSelection&&this.selection.selected.length>1?(this.selection.clear(),this.selection.select(e)):this.selection.clear(),n&&!1===n.emitEvent||this.selectionChanges.emit(this.selection.selected),[2]):[2]}))}))},n.prototype.onItemButtonClick=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(r){switch(r.label){case 0:return t.click&&t.click(e,n,o),[4,this.onItemClick(e,n)];case 1:return r.sent(),[2]}}))}))},n.prototype.hasSelection=function(){return this.selection.hasValue()},n.prototype.onNewClick=function(t){this.onNewItem.emit(t)},n.prototype.add=function(t,e){this.helper.add(t,{emitEvent:!0})&&(this.options.allowMultipleSelection||this.selection.clear(),this.selection.toggle(t),this.markForCheck(),e&&!1===e.emitEvent||this.selectionChanges.emit(this.selection.selected))},n.prototype.removeAt=function(t){var e=this.helper.at(t).value;this.selection.isSelected(e)&&this.selection.deselect(e),this.helper.removeAt(t)},n.prototype.displayWith=function(t){return this.displayWithFn?this.displayWithFn(t):t},n.prototype.createControl=function(t){return this.formBuilder.control(t||null,P.Validators.required)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);Mc.decorators=[{type:e.Component,args:[{selector:"app-list-form",template:'\n<ng-container *ngIf="!loading; else listSkeleton">\n\n \x3c!-- List --\x3e\n <ion-list class="ion-no-padding" >\n\n <ng-container *ngFor="let itemControl of itemControls; index as i; last as last">\n <ion-item *ngIf="itemControl.value; let item"\n [class.disabled]="disabled" tappable\n (click)="onItemClick($event, item)"\n [color]="selection.isSelected(item) ? \'secondary100\' : undefined"\n [button]="selectionChanges.observers.length > 0">\n <ion-label>{{displayWith(item)}}</ion-label>\n\n \x3c!-- buttons --\x3e\n <ion-buttons slot="end" *ngIf="enabled" class="action-buttons">\n <ion-button fill="clear" (click)="removeAt(i)">\n <ion-icon slot="icon-only" name="trash"></ion-icon>\n </ion-button>\n\n <ion-button *ngFor="let button of options.buttons"\n fill="clear" [color]="button.color"\n [class.cdk-visually-hidden]="button.disabled|async"\n (click)="onItemButtonClick(button, $event, item, i)"\n [title]="(button.title || \'\')|translate">\n <ion-icon slot="icon-only" [name]="button.icon"></ion-icon>\n </ion-button>\n\n </ion-buttons>\n </ion-item>\n </ng-container>\n </ion-list>\n\n \x3c!-- Add button --\x3e\n <ion-button color="tertiary" fill="clear"\n *ngIf="enabled && onNewItem.observers.length; else emptyText"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="onNewClick($event)" >\n <ion-icon slot="start" name="add"></ion-icon>\n <ion-label translate>COMMON.BTN_ADD</ion-label>\n </ion-button>\n\n \x3c!-- Empty (if readonly) --\x3e\n <ng-template #emptyText>\n <ion-text *ngIf="!length" color="medium"><i translate>COMMON.EMPTY_OPTION</i></ion-text>\n </ng-template>\n</ng-container>\n\n<ng-template #listSkeleton>\n\n <ion-list>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n </ion-list>\n\n</ng-template>\n\n<ng-template #itemSkeleton>\n\n <ion-item>\n <ion-label>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n </ion-label>\n </ion-item>\n\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-secondary100-contrast);--ion-item-icon-color-selected:var(--ion-color-secondary100-contrast)}ion-item.disabled ion-label{color:var(--ion-color-medium-shade,grey)}ion-item .action-buttons{visibility:hidden;display:none}ion-item:hover{height:48px!important}ion-item:hover .action-buttons{margin-top:-1px;visibility:visible;display:block}ion-item.selected{background:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-item.selected ion-label,ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}"]}]}],Mc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:ga},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Mc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],displayWithFn:[{type:e.Input,args:["displayWith"]}],equalsFn:[{type:e.Input,args:["equals"]}],onNewItem:[{type:e.Output}],selectionChanges:[{type:e.Output}]};var Lc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"===t},t}();Lc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Lc},token:Lc,providedIn:"root"}),Lc.decorators=[{type:e.Pipe,args:[{name:"isOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var jc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"!==t},t}();jc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new jc},token:jc,providedIn:"root"}),jc.decorators=[{type:e.Pipe,args:[{name:"isNotOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Bc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Is.personsToString(t,e):Is.personToString(t)},t}();Bc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Bc},token:Bc,providedIn:"root"}),Bc.decorators=[{type:e.Pipe,args:[{name:"personToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Uc=Object.freeze({ANDROID_APK:"application/vnd.android.package-archive"}),Vc=function(){function n(t,n,o,r,i,a,s,l,c){this.modalCtrl=t,this.configService=n,this.toastController=o,this.alertController=r,this.translate=i,this.cd=a,this.platform=s,this.network=l,this.environment=c,this._subscription=new D.Subscription,this._showUpdateOfflineFeature=!1,this.loading=!0,this.canDownload=!1,this.downloading=!1,this.waitingNetwork=!1,this.showUpgradeWarning=!0,this.showOfflineWarning=!0,this.showInstallButton=!1,this.onUpdateOfflineModeClick=new e.EventEmitter}return Object.defineProperty(n.prototype,"showUpdateOfflineFeature",{get:function(){return this._showUpdateOfflineFeature},set:function(t){t!==this._showUpdateOfflineFeature&&(this._showUpdateOfflineFeature=t,this.markForCheck())},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var t=this;this.offline=this.network.offline,this._subscription.add(D.from(this.network.ready()).pipe(N.debounceTime(1e3),N.switchMap((function(){return t.configService.config})),N.filter(Re)).subscribe((function(e){return t.checkNeedInstallOrUpdate(e)}))),this._subscription.add(this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"===t})),N.distinctUntilChanged()).subscribe((function(e){t.offline!==e&&(t.offline=e,t.markForCheck())})))},n.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._subscription=null,this.onUpdateOfflineModeClick.complete(),this.installLinks=null,this.upgradeLinks=null},n.prototype.download=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:if(!e||!e.url)return console.error("[install-upgrade-card] Missing required argument 'link.url'"),[2];e.downloading=!0,this.markForCheck(),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this.listenDownloadJob(e.url,this.platform.download({uri:e.url,title:e.title,filename:e.filename,mimeType:e.mimeType}))];case 2:return t.sent(),[3,4];case 3:return e.downloading=!1,this.markForCheck(),[7];case 4:return[2]}}))}))},n.prototype.tryOnline=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:this.waitingNetwork=!0,this.markForCheck(),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this.network.tryOnline({showLoadingToast:!1,showOnlineToast:!0,showOfflineToast:!1})];case 2:return t.sent(),[3,4];case 3:return this.waitingNetwork=!1,this.markForCheck(),[7];case 4:return[2]}}))}))},n.prototype.getPlatformName=function(t){switch(t){case"android":return"Android";case"ios":return"iOS";default:return""}},n.prototype.asLink=function(t){return t},n.prototype.checkNeedInstallOrUpdate=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:if(!t)return[2];console.info("[install-upgrade-card] Check if need to install or upgrade..."),this.canDownload=this.platform.canDownload,n.label=1;case 1:return n.trys.push([1,,5,6]),e=this.getLinks(t),this.upgradeLinks=this.getCompatibleUpgradeLinks(e,t),Ne(this.upgradeLinks)?(console.info("[install-upgrade-card] Find upgrade links: "+this.upgradeLinks.map((function(t){return t.url})).join(",")),this.installLinks=null,this.listenDownloadJobs(),[3,4]):[3,2];case 2:return this.installLinks=this.getCompatibleInstallLinks(e),Ne(this.installLinks)?(console.info("[install-upgrade-card] Find install links "+this.installLinks.map((function(t){return t.url})).join(",")),[4,nn(1e3)]):[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return this.loading=!1,this.markForCheck(),[7];case 6:return[2]}}))}))},n.prototype.getCompatibleInstallLinks=function(t){if(!this.platform.is("cordova"))return this.platform.is("mobileweb")?t:void 0},n.prototype.getCompatibleUpgradeLinks=function(t,e){var n=this,o=this.environment.version,r=e.getProperty(yl.APP_MIN_VERSION);if(o){if(r&&!aa.isCompatible(r,o)){var i=t.filter((function(t){return n.platform.is("mobileweb")||t.platform&&n.platform.is(t.platform)}));return i.forEach((function(t){t.version=t.version||r})),Ne(i)?i:void 0}}else console.error("Missing value for 'environment.version': cannot check app compatibility!")},n.prototype.getLinks=function(e){var n=[],o=e.getProperty(yl.ANDROID_INSTALL_URL);Te(o)&&(o=this.environment.defaultAndroidInstallUrl||null);var r=this.network.peer;r&&(o.startsWith("./")||o.startsWith("/"))&&(o=t.Peer.path(r,o));var i=e.getProperty(yl.APP_MIN_VERSION),a=Pe(o)&&e.label||this.environment.defaultAppName||"SUMARiS";if(o){var s=void 0,l=void 0,c=this.getFilename(o),u=i||"latest";if(null==c?void 0:c.endsWith(".apk")){l=Uc.ANDROID_APK;var d=/-v([1-9][0-9]*\.[0-9]+\.(:?(:?alpha|beta|rc)?[0-9]*))/i.exec(c);u=d&&d[1]||u,Pe(a)&&"latest"!==u?(c=(a+"-v"+u+".apk").toLowerCase(),s=a+" v"+u):c.indexOf("latest")&&(c=c.replace("latest",u))}n.push({name:a,url:o,platform:"android",version:u,filename:c,title:s,mimeType:l})}return n},n.prototype.getFilename=function(t){if(t){var e=t.substring(t.lastIndexOf("/")+1),n=e.indexOf("?");return-1!==n?e.substring(0,n):e}},n.prototype.listenDownloadJobs=function(){var t=this;(this.upgradeLinks||[]).forEach((function(e){var n=t.platform.getDownloadingJob(e.url);n&&t.listenDownloadJob(e.url,n)}))},n.prototype.listenDownloadJob=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:if(!t||!e)return[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.downloading?console.info("[install-upgrade-card] Platform is already downloading!"):(console.info("[install-upgrade-card] Asking platform to download '"+t+"'..."),this.downloading=!0,this.markForCheck()),[4,e.toPromise()];case 2:return(n=r.sent())?(console.info("[install-upgrade-card] File downloaded at: "+n),[2,this.showDownloadCompleteDialog()]):[3,5];case 3:return o=r.sent(),console.error("[install-upgrade-card] Download failed: "+(o&&o.message||o)),[2,this.showDownloadFailedToast(o)];case 4:return this.downloading=!1,this.markForCheck(),[7];case 5:return[2]}}))}))},n.prototype.showDownloadFailedToast=function(t){return this.showToast({message:"ERROR.DOWNLOAD_FAILED",messageParams:{error:t},type:"error",showCloseButton:!0})},n.prototype.showDownloadCompleteDialog=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return this._subscription?[4,this.translate.get(["INFO.ALERT_HEADER","INFO.UPDATE_APP_DOWNLOADED","COMMON.BTN_CLOSE"]).toPromise()]:[2];case 1:return t=n.sent(),[4,this.alertController.create({header:t["INFO.ALERT_HEADER"],message:t["INFO.UPDATE_APP_DOWNLOADED"],buttons:[{text:t["COMMON.BTN_CLOSE"],role:"cancel",cssClass:"secondary"}]})];case 2:return[4,(e=n.sent()).present()];case 3:return n.sent(),[4,e.onDidDismiss()];case 4:return n.sent(),[2]}}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this._subscription?[4,ba.show(this.toastController,this.translate,t)]:[2];case 1:return e.sent(),[2]}}))}))},n}();Vc.decorators=[{type:e.Component,args:[{selector:"app-install-upgrade-card",template:'\n\n\x3c!-- Offline mode card--\x3e\n<ion-card *ngIf="showOfflineWarning && (!loading && offline || waitingNetwork)"\n color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap" *ngIf="!waitingNetwork; else waitingNetworkText">\n <h4>\n <b *ngIf="isLogin; else notLogin" [innerHTML]="\'NETWORK.INFO.OFFLINE_OR_UNAUTHORIZED\'| translate"></b>\n <ng-template #notLogin>\n <b [innerHTML]="\'NETWORK.INFO.OFFLINE\'| translate"></b>\n </ng-template>\n </h4>\n <h3>\n <small [innerHTML]="\'NETWORK.INFO.OFFLINE_HELP\'|translate"></small>\n </h3>\n </ion-text>\n <ng-template #waitingNetworkText>\n <ion-text class="ion-text-wrap" [innerHTML]="\'NETWORK.INFO.RETRY_TO_CONNECT\'| translate"></ion-text>\n </ng-template>\n </ion-col>\n <ion-col size="auto">\n\n \x3c!-- Retry button --\x3e\n <ion-button *ngIf="!waitingNetwork; else waitingSpinner" color="tertiary" class="ion-float-end"\n (click)="tryOnline()">\n <span translate>NETWORK.BTN_CHECK_ALIVE</span>\n </ion-button>\n\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Upgrade links --\x3e\n<ion-card *ngIf="showUpgradeWarning && !loading && !offline && upgradeLinks"\n color="accent"\n class="ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngFor="let link of upgradeLinks; last as last">\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h3>\n <span *ngIf="link.version" [innerHTML]="\'INFO.UPDATE_APP_TO_VERSION\'| translate: link"></span>\n <span *ngIf="!link.version" [innerHTML]="\'INFO.UPDATE_APP\'| translate: link"></span>\n </h3>\n <h4>\n <small *ngIf="last" [innerHTML]="\'INFO.UPDATE_APP_HELP\'|translate"></small>\n </h4>\n </ion-text>\n </ion-col>\n\n <ion-col size="auto">\n <ng-container *ngTemplateOutlet="downloadButton; context: { $implicit: link }"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Install links --\x3e\n<ion-card *ngIf="showInstallButton && !loading && !offline && installLinks"\n color="secondary"\n class="ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngFor="let link of installLinks; last as last">\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h3 [innerHTML]="\'INFO.DOWNLOAD_APP_TITLE\'| translate: {name: link.name, platform: getPlatformName(link.platform) }"></h3>\n <h4><small *ngIf="last" [innerHTML]="\'INFO.DOWNLOAD_APP_HELP\'|translate"></small></h4>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n <ng-container *ngTemplateOutlet="downloadButton; context: { $implicit: link }"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Update offline feature card--\x3e\n<ion-card *ngIf="showUpdateOfflineFeature && !loading && !offline"\n color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h4>\n <b [innerHTML]="\'NETWORK.INFO.UPDATE_OFFLINE_MODE\'| translate"></b>\n </h4>\n <h3>\n <small [innerHTML]="\'NETWORK.INFO.UPDATE_OFFLINE_MODE_HELP\'|translate"></small>\n </h3>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n\n \x3c!-- Retry button --\x3e\n <ion-button color="tertiary" class="ion-float-end"\n (click)="onUpdateOfflineModeClick.emit($event)">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Display a download button, depending on the link URL, and the device platform --\x3e\n<ng-template #downloadButton let-link>\n\n <ng-container *ngIf="link.filename; else redirectButton">\n\n <ng-container *ngIf="canDownload; else webDownloadButton">\n \x3c!-- Download using platform --\x3e\n <ion-button (click)="download($event, asLink(link))"\n [disabled]="link.downloading"\n color="tertiary" class="ion-float-end">\n <ion-icon slot="start" *ngIf="!link.downloading" name="download"></ion-icon>\n <ion-spinner slot="start" class="ion-no-padding" *ngIf="link.downloading"></ion-spinner>\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-container>\n\n \x3c!-- Web download button --\x3e\n <ng-template #webDownloadButton>\n <ion-button [download]="link.downloadFilename"\n [href]="link.url"\n color="tertiary" class="ion-float-end" >\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-template>\n </ng-container>\n\n \x3c!-- Web redirect button --\x3e\n <ng-template #redirectButton>\n <ion-button [href]="link.url" rel="external" color="tertiary" class="ion-float-end" target="_blank">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n </ion-button>\n </ng-template>\n</ng-template>\n\n\n\x3c!-- Waiting spinner --\x3e\n<ng-template #waitingSpinner>\n <ion-spinner color="light"></ion-spinner>\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[na],styles:["ion-text small{font-size:85%}"]}]}],Vc.ctorParameters=function(){return[{type:M.ModalController},{type:xl},{type:M.ToastController},{type:M.AlertController},{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:Sl},{type:Ca},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Vc.propDecorators={isLogin:[{type:e.Input}],showUpgradeWarning:[{type:e.Input}],showOfflineWarning:[{type:e.Input}],showInstallButton:[{type:e.Input}],showUpdateOfflineFeature:[{type:e.Input}],onUpdateOfflineModeClick:[{type:e.Output}]};var qc=function(){function t(){}return t.prototype.transform=function(t){return t&&t.pubkey&&!0},t}();qc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new qc},token:qc,providedIn:"root"}),qc.decorators=[{type:e.Pipe,args:[{name:"isLogin"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var $c=function(){function t(){}return t.prototype.transform=function(t){return Os(t)},t}();$c.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new $c},token:$c,providedIn:"root"}),$c.decorators=[{type:e.Pipe,args:[{name:"accountToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Gc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Cs(t,e):vs(t)},t}();Gc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Gc},token:Gc,providedIn:"root"}),Gc.decorators=[{type:e.Pipe,args:[{name:"departmentToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Hc=function(){function t(){this._toggledSubject=new D.Subject,this._visibleSubject=new D.Subject}return Object.defineProperty(t.prototype,"menuToggled$",{get:function(){return this._toggledSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"menuVisible$",{get:function(){return this._visibleSubject.asObservable()},enumerable:!1,configurable:!0}),t.prototype.toggleMenu=function(){this._toggledSubject.next()},t.prototype.menuVisible=function(t){this._visibleSubject.next(t)},t}();Hc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Hc},token:Hc,providedIn:"root"}),Hc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Wc=new e.InjectionToken("menuItems"),zc=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){this.platformService=t,this.accountService=e,this.router=n,this.menu=o,this.modalCtrl=r,this.alertController=i,this.translate=a,this.configService=s,this.cd=l,this.menuService=c,this.environment=u,this.items=d,this._subscription=new D.Subscription,this.loading=!0,this.isLogin=!1,this.$items=new D.BehaviorSubject(void 0),this.appVersion=this.environment.version,this.side="left",this._debug=!u.production,this.onResize()}return t.prototype.onResize=function(t){this._screenWidth=window.innerWidth,console.debug("[menu] Screen size (px): "+this._screenWidth)},t.prototype.ngOnInit=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return this.splitPaneOpened=!0,this.splitPane.when="lg",[4,this.platformService.ready()];case 1:return e.sent(),this.splitPaneOpened=!0,this.menuService.menuToggled$.subscribe((function(){return t.toggleSplitPane()})),this._subscription.add(D.merge(this.accountService.onLogin,this.accountService.onLogout,this.configService.config.pipe(N.tap((function(e){return t._config=e})))).pipe(N.mergeMap((function(){return t.accountService.ready()}))).subscribe((function(e){t.accountService.isLogin()?t.onLogin(t.accountService.account):t.onLogout(!0)}))),[2]}}))}))},t.prototype.onLogin=function(t){return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[menu] Update using logged account"),this.accountAvatar=t.avatar,this.accountName=t.displayName,this.accountEmail=t.email,this.isLogin=!0,[4,this.refreshMenuItems()];case 1:return n.sent(),setTimeout((function(){e.loading=!1,e.detectChanges()}),500),[2]}}))}))},t.prototype.onLogout=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return t||console.debug("[menu] logout"),this.isLogin=!1,this.accountAvatar=null,this.accountEmail=null,this.accountName=null,[4,this.refreshMenuItems()];case 1:return e.sent(),t?[3,3]:[4,this.router.navigate([""])];case 2:e.sent(),e.label=3;case 3:return this.loading=!1,this.detectChanges(),[2]}}))}))},t.prototype.logout=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.translate.get(["AUTH.LOGOUT.CONFIRM_TITLE","AUTH.LOGOUT.CONFIRM_MESSAGE","COMMON.BTN_CANCEL","AUTH.LOGOUT.BTN_CONFIRM"]).toPromise()];case 1:return t=n.sent(),[4,this.alertController.create({header:t["AUTH.LOGOUT.CONFIRM_TITLE"],message:t["AUTH.LOGOUT.CONFIRM_MESSAGE"],buttons:[{text:t["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary"},{text:t["AUTH.LOGOUT.BTN_CONFIRM"],cssClass:"ion-color-primary",handler:function(){e.accountService.logout(),setTimeout((function(){return e.router.navigateByUrl("/",{replaceUrl:!0})}),100)}}]})];case 2:return[4,n.sent().present()];case 3:return n.sent(),[2]}}))}))},t.prototype.menuClose=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.menu.close("left")]}))}))},t.prototype.openAboutModal=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:bc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.toggleSplitPane=function(t){t&&t.defaultPrevented||(t&&t.preventDefault(),this.splitPaneOpened=!this.splitPaneOpened,this.splitPaneOpened?this.splitPane.when="lg":this.splitPane.when=!1,this.menuService.menuVisible(this.splitPaneOpened),this.detectChanges())},t.prototype.doAction=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:switch(this.menuClose(),t){case"logout":return[3,1];case"about":return[3,3]}return[3,5];case 1:return[4,this.logout()];case 2:case 4:return n.sent(),[3,6];case 3:return[4,this.openAboutModal(e)];case 5:throw new Error("Unknown action: "+t);case 6:return[2]}}))}))},t.prototype.onSwipeRight=function(t){return!(!t||"touch"!==t.pointerType||t.velocity<.4)&&(t.center.x-t.distance<=50?(t.preventDefault(),!1):void 0)},t.prototype.refreshMenuItems=function(){var t=this;this._debug&&console.debug("[menu] Refreshing menu items...");var e=this.items||[],n=this._config&&this._config.getProperty(yl.MENU_ITEMS);if(Pe(n))try{e=(JSON.parse(n)||[]).reduce((function(t,e){var n;if(e.after&&-1!==(n=t.findIndex((function(t){return t.title===e.after}))))return t.slice(0,n+1).concat(e).concat(t.slice(n+1));if(e.before&&-1!==(n=t.findIndex((function(t){return t.title===e.before}))))return t.slice(0,n).concat(e).concat(t.slice(n));return t.concat(e)}),e)}catch(t){console.error("[menu] Invalid value for option '"+yl.MENU_ITEMS.key+"'. Expected an array of menu item",t)}var o={isLogin:this.isLogin,debug:this._debug},r=e.filter((function(e){return yc.checkIfVisible(e,t.accountService,t._config,o)})).map((function(e){if(Pe(e.titleProperty)&&t._config){var n=t._config.properties[e.titleProperty];if(n)return Object.assign(Object.assign({},e),{title:n})}return e}));this.$items.next(r)},t.prototype.detectChanges=function(){this.cd.detectChanges()},t}();zc.decorators=[{type:e.Component,args:[{selector:"app-menu",template:'<ion-split-pane #splitPane contentId="menu-content" (swiperight)="onSwipeRight($event)">\n\n <ion-menu id="menu" menuId="left" contentId="menu-content">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf="isLogin; else notLogin" class="ion-toolbar-top">\n <ion-grid>\n <ion-row>\n <ion-col size="4">\n <button type="button" mat-flat-button\n class="user-avatar" [class.primary]="!accountAvatar"\n [style.background-image]="\'url(\'+(accountAvatar||\'./assets/img/person.png\')+\')\'"\n [routerLink]="[\'/account\']"\n routerDirection="root"\n routerLinkActive="ion-color-primary"\n (click)="menuClose()">\n </button>\n </ion-col>\n <ion-col size="8" class="user-logo">\n <img *ngIf="logo" src="{{logo}}" [title]="\'APP_NAME\'|translate: {appName: appName}" width="108px;"/>\n <span *ngIf="!logo" width="108px;">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class="ion-no-padding">\n\n <button mat-button type="button"\n [routerLink]="[\'/account\']"\n routerDirection="root"\n routerLinkActive="ion-color-primary"\n (click)="menuClose()">\n <ion-label color="primary" class="ion-text-wrap ion-text-start">\n <h3 class="no-margin username">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n \x3c!-- User not logged --\x3e\n <ng-template #notLogin>\n <mat-toolbar class="ion-padding" @fadeInAnimation\n style="height: unset; display: block; margin: auto; text-align: center;">\n <img *ngIf="logo" src="{{logo}}" [title]="\'APP_NAME\'|translate: {appName: appName}" width="150px;">\n <span *ngIf="!logo" style="width: 150px">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]="isLogin">\n\n <ion-list lines="none">\n <ion-menu-toggle auto-hide="false"\n [class.flex-spacer]="item.cssClass == \'flex-spacer\'"\n *ngFor="let item of $items | async">\n\n \x3c!-- link --\x3e\n <ion-item *ngIf="!loading && item.path"\n @fadeInAnimation\n class="{{item.cssClass}} {{item.color}} text-1x"\n tappable\n [routerLink]="item.path"\n routerDirection="root"\n routerLinkActive="selected"\n [routerLinkActiveOptions]="{exact: (item.path === \'/\')}">\n <ion-icon slot="start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n \x3c!-- action --\x3e\n <ion-item *ngIf="!loading && item.action"\n @fadeInAnimation\n class="{{item.cssClass}} {{item.color}} text-1x"\n tappable\n (click)="doAction(item.action, $event)">\n <ion-icon slot="start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n \x3c!-- divider --\x3e\n <ion-item-divider @fadeInAnimation\n class="{{item.cssClass}} {{item.color}}"\n *ngIf="!loading && !item.path && !item.action">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class="hidden-xs hidden-sm">\n <ion-toolbar>\n\n <ion-buttons slot="start">\n <ion-button mat-icon-button color="accent" (click)="openAboutModal($event)">\n <mat-icon slot="icon-only">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)="openAboutModal($event)" color="medium">\n {{\'MENU.FOOTER_VERSION_ABOUT\'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot="end">\n <button mat-icon-button color="accent" (click)="toggleSplitPane($event)"\n class="hidden-xs hidden-sm hidden-md"\n [title]="(splitPaneOpened ? \'COMMON.BTN_HIDE_MENU\' : \'COMMON.BTN_SHOW_MENU\') |translate">\n <mat-icon><span>{{splitPaneOpened ? \'«\' : \'»\'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n',animations:[Zi],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid var(--ion-color-primary);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]}]}],zc.ctorParameters=function(){return[{type:Sl},{type:pl},{type:z.Router},{type:M.MenuController},{type:M.ModalController},{type:M.AlertController},{type:F.TranslateService},{type:xl},{type:e.ChangeDetectorRef},{type:Hc},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Wc]}]}]},zc.propDecorators={logo:[{type:e.Input}],appName:[{type:e.Input}],appVersion:[{type:e.Input}],side:[{type:e.Input}],splitPane:[{type:e.ViewChild,args:["splitPane",{static:!0}]}],onResize:[{type:e.HostListener,args:["window:resize",["$event"]]}]};var Kc=function(){};Kc.decorators=[{type:e.NgModule,args:[{imports:[Pl,z.RouterModule,F.TranslateModule],declarations:[zc],exports:[F.TranslateModule,zc]}]}];var Qc=function(){function t(t,n){if(this.table=t,this.cd=n,this.stickyEnd=!1,this.optionsTitle="COMMON.BTN_OPTIONS",this.optionsClick=new e.EventEmitter,this.cancelOrDeleteClick=new e.EventEmitter,this.confirmAndAddClick=new e.EventEmitter,this.backward=new e.EventEmitter,this.forward=new e.EventEmitter,!t)throw new Error("[actions-column] this column component must be inside a MatTable component")}return t.prototype.ngOnInit=function(){this.cd.detectChanges(),this.table.addColumnDef(this.columnDef),this.canCancel=je(this.canCancel,this.cancelOrDeleteClick.observers.length>0),this.canDelete=je(this.canDelete,this.cancelOrDeleteClick.observers.length>0),this.canConfirmAndAdd=je(this.canConfirmAndAdd,this.confirmAndAddClick.observers.length>0),this.canBackward=je(this.canBackward,this.backward.observers.length>0),this.canForward=je(this.canForward,this.forward.observers.length>0),Ae(this.dirtyIcon)&&(this.dirtyIcon="star")},t.prototype.ngOnDestroy=function(){this.table.removeColumnDef(this.columnDef),this.optionsClick.complete(),this.optionsClick.unsubscribe(),this.cancelOrDeleteClick.complete(),this.cancelOrDeleteClick.unsubscribe(),this.confirmAndAddClick.complete(),this.confirmAndAddClick.unsubscribe(),this.backward.complete(),this.backward.unsubscribe(),this.forward.complete(),this.forward.unsubscribe()},t}();Qc.decorators=[{type:e.Component,args:[{selector:"app-actions-column",template:'<ng-container matColumnDef="actions" [stickyEnd]="stickyEnd">\n <th mat-header-cell *matHeaderCellDef [class]="classList" [class.mat-column-sticky]="stickyEnd">\n <button mat-icon-button\n *ngIf="optionsClick.observers | isNotEmptyArray"\n [title]="optionsTitle | translate"\n (click)="optionsClick.emit($event)">\n <mat-icon>more_vert</mat-icon>\n </button>\n <ng-content select="[matHeader]"></ng-content>\n </th>\n <td mat-cell *matCellDef="let row" [class]="classList">\n <ng-container *ngIf="row.editing; else view">\n\n \x3c!-- pending --\x3e\n <ion-spinner *ngIf="row.validator?.pending" name="dots" class="center"></ion-spinner>\n\n \x3c!-- new row --\x3e\n <ng-container *ngIf="row.id === -1; else existingRow">\n\n \x3c!-- delete button --\x3e\n <button mat-icon-button color="light"\n *ngIf="canDelete && row.validator.invalid"\n [title]="\'COMMON.BTN_DELETE\' | translate"\n (click)="cancelOrDeleteClick.emit({event: $event, row: row})">\n <mat-icon>delete_outline</mat-icon>\n </button>\n\n \x3c!-- add button --\x3e\n <button mat-icon-button color="light"\n *ngIf="!canForward && canConfirmAndAdd && row.validator.valid"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="confirmAndAddClick.emit({event: $event, row: row})">\n <mat-icon>add</mat-icon>\n </button>\n\n \x3c!-- next button (invisible - focusable only) --\x3e\n <button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canForward && row.validator.valid"\n (focus)="this.forward.emit({event: $event, row: row})">\n </button>\n </ng-container>\n\n \x3c!-- existing row --\x3e\n <ng-template #existingRow>\n \x3c!-- cancel button --\x3e\n <button mat-icon-button color="light"\n *ngIf="canCancel && row.validator.dirty"\n [title]="\'COMMON.BTN_UNDO\' | translate"\n (click)="cancelOrDeleteClick.emit({event: $event, row: row})">\n <mat-icon>undo</mat-icon>\n </button>\n\n \x3c!-- next button (invisible - focusable only) --\x3e\n <button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canForward && row.validator.valid"\n (focus)="this.forward.emit({event: $event, row: row})">\n </button>\n </ng-template>\n\n </ng-container>\n\n <ng-template #view>\n \x3c!-- dirty icon --\x3e\n <ion-icon *ngIf="dirtyIcon && row.validator?.dirty" [name]="dirtyIcon" color="accent" class="dirty-icon"></ion-icon>\n\n \x3c!-- backward button (invisible - focusable only) --\x3e\n <button mat-icon-button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canBackward"\n (focus)="this.backward.emit({event: $event, row: row})">\n </button>\n </ng-template>\n\n <ng-container *ngTemplateOutlet="cellTemplate; context: { $implicit: row }"></ng-container>\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n <ng-content select="[matFooter]"></ng-content>\n </td>\n</ng-container>\n'}]}],Qc.ctorParameters=function(){return[{type:l.MatTable},{type:e.ChangeDetectorRef}]},Qc.propDecorators={columnDef:[{type:e.ViewChild,args:[l.MatColumnDef]}],matMenuTrigger:[{type:e.ViewChild,args:[y.MatMenuTrigger]}],stickyEnd:[{type:e.Input}],canCancel:[{type:e.Input}],canDelete:[{type:e.Input}],canBackward:[{type:e.Input}],canForward:[{type:e.Input}],canConfirmAndAdd:[{type:e.Input}],dirtyIcon:[{type:e.Input}],optionsTitle:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],cellTemplate:[{type:e.Input}],optionsClick:[{type:e.Output}],cancelOrDeleteClick:[{type:e.Output}],confirmAndAddClick:[{type:e.Output}],backward:[{type:e.Output}],forward:[{type:e.Output}]};var Yc=function(){function t(){this.icon=null,this.matIcon=null,this.matSvgIcon=null,this.color=null}return Object.defineProperty(t.prototype,"ref",{set:function(t){this.icon=t.icon,this.matIcon=t.matIcon,this.matSvgIcon=t.matSvgIcon},enumerable:!1,configurable:!0}),t}();Yc.decorators=[{type:e.Component,args:[{selector:"app-icon",template:'<ion-icon *ngIf="icon; else matIconTemplate" slot="icon-only"\n [color]="color"\n [name]="icon"\n></ion-icon>\n<ng-template #matIconTemplate>\n <mat-icon [svgIcon]="matSvgIcon"\n [style.color]="\'var(--ion-color-\'+color+\')\'">{{matIcon}}</mat-icon>\n</ng-template>\n\n'}]}],Yc.propDecorators={icon:[{type:e.Input}],matIcon:[{type:e.Input}],matSvgIcon:[{type:e.Input}],color:[{type:e.Input}],ref:[{type:e.Input}]};var Xc=function(){function t(){}return t.forRoot=function(){return console.info("[core] Creating module (root)"),{ngModule:t,providers:[Sl]}},t}();Xc.decorators=[{type:e.NgModule,args:[{imports:[Pl,z.RouterModule,Q.HttpClientModule,Pc,dt.CacheModule,st.IonicStorageModule,Ft.NgxJdenticonModule,Kc],declarations:[Lc,jc,Bc,qc,$c,Gc,Ec,bc,hc,mc,Rc,dc,wc,xc,Nc,ca,Vc,Tc,Qc,kc,Ac,Fc,Mc,Yc],exports:[Pl,z.RouterModule,Pc,Kc,Lc,jc,Bc,qc,$c,Ec,hc,mc,Tc,Qc,kc,Ac,bc,Fc,Mc,Vc,Gc,Yc]}]}];var Jc=function(){function t(t,e,n,o){this.accountService=t,this.modalCtrl=e,this.router=n,this.environment=o,this._debug=!o.production}return t.prototype.canActivate=function(t,e){var n=this;return this.accountService.started?this.accountService.isLogin()?t.data&&t.data.profile&&!this.accountService.hasMinProfile(t.data.profile)?(this._debug&&console.debug("[auth-gard] Not authorized access to /"+t.url.join("/")+". Missing required profile: "+t.data.profile),!1):(this._debug&&console.debug("[auth-gard] Authorized access to /"+t.url.join("/")),!0):(this._debug&&console.debug("[auth-gard] Need authentication for page /"+t.url.join("/")),this.login(t).then((function(o){return o?n.canActivate(t,e):(n._debug&&console.debug("[auth-gard] Authentication cancelled. Could not access to /"+t.url.join("/")),n.router.parseUrl("/home"))}))):this.accountService.ready().then((function(){return n.canActivate(t,e)}))},t.prototype.login=function(t){var e=this;return new Promise((function(n){return Ie(e,void 0,void 0,(function(){var e,o=this;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.modalCtrl.create({component:mc,componentProps:{next:t}})];case 1:return(e=r.sent()).onDidDismiss().then((function(){o.accountService.isLogin()?n(!0):n(!1)})),[2,e.present()]}}))}))}))},t}();Jc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Jc(jt.ɵɵinject(pl),jt.ɵɵinject(Gt.ModalController),jt.ɵɵinject(zt.Router),jt.ɵɵinject(me))},token:Jc,providedIn:"root"}),Jc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Jc.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:z.Router},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var Zc=function(t){function e(e,n,o,r,i){var a=t.call(this,e,Yi)||this;a.graphql=e,a.platform=n,a.dataType=o,a.filterType=r,a.queries=i.queries,a.mutations=i.mutations||{},a.subscriptions=i.subscriptions||{},a.equalsFn=i.equalsFn||function(t,e){return Qi.equals(t,e,"id")},a.isNewFn=i.isNewFn||function(t){return Qi.isNotEmpty(t,"id")},a.defaultSortBy=i.defaultSortBy||"id",a.defaultSortDirection=i.defaultSortDirection||"asc",a.watchQueriesUpdatePolicy=i.watchQueriesUpdatePolicy||"update-cache";var s=new o;return a._typename=s.__typename||"UnknownVO",a._logTypeName=$e(a._typename,"VO"),a._debug=!Yi.production,a}return Ee(e,t),e.prototype.watch=function(t,e){var n=this;this._debug&&console.debug(this._logPrefix+"Watching "+this._logTypeName+" {"+t+"}...");var o=e&&e.query||this.queries.load;return this.graphql.watchQuery({query:o,variables:{id:t},fetchPolicy:e&&e.fetchPolicy||void 0,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"}}).pipe(N.map((function(t){var o=t.data;return e&&!1===e.toEntity?o:o&&n.fromObject(o)})))},e.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this._debug&&console.debug(this._logPrefix+"Loading "+this._logTypeName+" {"+t+"}..."),n=e&&e.query||this.queries.load,[4,this.graphql.query({query:n,variables:{id:t},fetchPolicy:e&&e.fetchPolicy||void 0,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"}})];case 1:return o=r.sent().data,[2,e&&!1===e.toEntity?o:o&&this.fromObject(o)]}}))}))},e.prototype.watchAll=function(t,e,n,o,r,i){var a=this;r=this.asFilter(r);var s={offset:t||0,size:e||100,sortBy:n||this.defaultSortBy,sortDirection:o||this.defaultSortDirection,filter:r&&r.asPodObject()},l=this._debug&&Date.now();this._debug&&console.debug(this._logPrefix+"Watching "+this._logTypeName+"...",s);var c=(!i||!1!==i.withTotal)&&this.queries.loadAllWithTotal&&!0,u=i&&i.query||(c?this.queries.loadAllWithTotal:this.queries.loadAll);return this.mutableWatchQuery({queryName:c?"LoadAllWithTotal":"LoadAll",query:u,arrayFieldName:"data",totalFieldName:c?"total":void 0,insertFilterFn:r&&r.asFilterFn(),variables:s,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"},fetchPolicy:i&&i.fetchPolicy||void 0}).pipe(N.map((function(t){var e=t.data,n=t.total,o=i&&!1===i.toEntity?e||[]:(e||[]).map((function(t){return a.fromObject(t)}));return l&&(console.debug(a._logPrefix+(a._logTypeName+" loaded in ")+(Date.now()-l)+"ms",o),l=null),{data:o,total:n}})))},e.prototype.loadAll=function(t,e,n,o,r,i){return Ie(this,void 0,void 0,(function(){var a,s,l,c,u,d,p,h,m,f,g,b=this;return Oe(this,(function(y){switch(y.label){case 0:return a=this._debug&&(!i||!1!==i.debug),r=this.asFilter(r),s={offset:t||0,size:e||100,sortBy:n||"id",sortDirection:o||"asc",filter:r&&r.asPodObject()},l=Date.now(),a&&console.debug(this._logPrefix+"Loading "+this._logTypeName+"...",s),c=(!i||!1!==i.withTotal)&&this.queries.loadAllWithTotal&&!0,u=i&&i.query||(c?this.queries.loadAllWithTotal:this.queries.loadAll),[4,this.graphql.query({query:u,variables:s,error:{code:Na,message:"ERROR.LOAD_DATA_ERROR"},fetchPolicy:i&&i.fetchPolicy||"network-only"})];case 1:return d=y.sent(),p=d.data,h=d.total,m=i&&!1===i.toEntity?p||[]:(p||[]).map((function(t){return b.fromObject(t)})),a&&console.debug(this._logPrefix+(this._logTypeName+" items loaded in ")+(Date.now()-l)+"ms"),f={data:m,total:h},c&&(g=t+m.length)<f.total&&(f.fetchMore=function(){return b.loadAll(g,e,n,o,r,i)}),[2,f]}}))}))},e.prototype.countAll=function(t,e){var n;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:if(this.queries.countAll)return[3,2];if(!this.queries.loadAllWithTotal)throw new Error("Not implemented");return[4,this.loadAll(0,1,null,null,t,{withTotal:!0})];case 1:return[2,(null===(n=o.sent())||void 0===n?void 0:n.total)||0];case 2:return t=this.asFilter(t),[4,this.graphql.query({query:this.queries.countAll,variables:{filter:t&&t.asPodObject()},error:{code:Na,message:"ERROR.COUNT_DATA_ERROR"},fetchPolicy:e&&e.fetchPolicy||"network-only"})];case 3:return[2,o.sent().total]}}))}))},e.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:if(Fe(t))return[2,t];if(!this.mutations.saveAll){if(!this.mutations.save)throw new Error("Not implemented");return[2,xn((t||[]).map((function(t){return function(){return i.save(t,e)}})))]}return n=!1,o=t.map((function(t){return n=n||i.isNewFn(t),i.fillDefaultProperties(t),i.asObject(t)})),r=Date.now(),this._debug&&console.debug(this._logPrefix+"Saving all "+this._logTypeName+"...",o),[4,this.graphql.mutate({mutation:this.mutations.saveAll,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{data:o},error:{code:Fa,message:"ERROR.SAVE_DATA_ERROR"},update:function(o,a){var s=a.data,l=s&&s.data;l&&(t.forEach((function(t){var e=l.find((function(e){return i.equalsFn(e,t)}));i.copyIdAndUpdateDate(e,t)})),n&&"update-cache"===i.watchQueriesUpdatePolicy&&i.insertIntoMutableCachedQueries(o,{queries:i.getLoadQueries(),data:l})),e&&e.update&&e.update(o,{data:s}),i._debug&&console.debug(i._logTypeName+" saved in "+(Date.now()-r)+"ms",t)}})];case 1:return a.sent(),[2,t]}}))}))},e.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:if(this.mutations.save)return[3,2];if(!this.mutations.saveAll)throw new Error("Not implemented");return[4,this.saveAll([t],e)];case 1:return[2,(n=s.sent())&&n[0]];case 2:return this.fillDefaultProperties(t),o=this.asObject(t),r=this.isNewFn(o),i=Date.now(),this._debug&&console.debug(this._logPrefix+"Saving "+this._logTypeName+"...",o),[4,this.graphql.mutate({mutation:this.mutations.save,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{data:o},error:{code:Fa,message:"ERROR.SAVE_DATA_ERROR"},update:function(n,o){var s=o.data,l=s&&s.data;a.copyIdAndUpdateDate(l,t),r&&"update-cache"===a.watchQueriesUpdatePolicy&&a.insertIntoMutableCachedQueries(n,{queries:a.getLoadQueries(),data:l}),e&&e.update&&e.update(n,{data:s}),a._debug&&console.debug(a._logPrefix+(t.__typename+" saved in ")+(Date.now()-i)+"ms",t)}})];case 3:return s.sent(),[2,t]}}))}))},e.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:if(!this.mutations.deleteAll){if(!this.mutations.delete)throw new Error("Not implemented");return[2,xn((t||[]).map((function(t){return function(){return r.delete(t,e)}})))]}return Fe(t=t&&t.filter((function(t){return Re(t.id)})))?[2]:(n=t.map((function(t){return t.id})),o=Date.now(),this._debug&&console.debug(this._logPrefix+"Deleting "+this._logTypeName+"...",n),[4,this.graphql.mutate({mutation:this.mutations.deleteAll,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{ids:n},error:{code:Ma,message:"ERROR.DELETE_DATA_ERROR"},update:function(t,i){"update-cache"===r.watchQueriesUpdatePolicy&&r.removeFromMutableCachedQueriesByIds(t,{queries:r.getLoadQueries(),ids:n}),e&&e.update&&e.update(t,i),r._debug&&console.debug(r._logPrefix+(r._logTypeName+" deleted in ")+(Date.now()-o)+"ms")}})]);case 1:return i.sent(),[2]}}))}))},e.prototype.delete=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:if(this.mutations.delete)return[3,2];if(!this.mutations.deleteAll)throw new Error("Not implemented");return[4,this.deleteAll([t],e)];case 1:return[2,(n=a.sent())&&n[0]];case 2:return!t||Ae(t.id)?[2]:(o=t.id,r=new Date,this._debug&&console.debug(this._logPrefix+"Deleting "+this._logTypeName+" {"+o+"}..."),[4,this.graphql.mutate({mutation:this.mutations.delete,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{id:o},error:{code:Ma,message:"ERROR.DELETE_DATA_ERROR"},update:function(t,n){"update-cache"===i.watchQueriesUpdatePolicy&&i.removeFromMutableCachedQueriesByIds(t,{queries:i.getLoadQueries(),ids:[o]}),e&&e.update&&e.update(t,n),i._debug&&console.debug(i._logPrefix+(i._logTypeName+" deleted in ")+((new Date).getTime()-r.getTime())+"ms")}})]);case 3:return a.sent(),[2]}}))}))},e.prototype.listenChanges=function(t,e){var n=this;if(Ae(t))throw Error("Missing argument 'id' ");if(!this.subscriptions.listenChanges)throw Error("Not implemented!");var o=e&&e.variables||{id:t,interval:e&&e.interval||10};return this._debug&&console.debug(this._logPrefix+"[WS] Listening for changes on "+this._logTypeName+" {"+t+"}..."),this.graphql.subscribe({query:e&&e.query||this.subscriptions.listenChanges,variables:o,error:{code:La,message:"ERROR.SUBSCRIBE_DATA_ERROR"}}).pipe(N.map((function(o){var r=o.data,i=e&&!1===e.toEntity?r:r&&n.fromObject(r);return i&&n._debug&&console.debug(n._logPrefix+"[WS] Received changes on "+n._logTypeName+" {"+t+"}",i),i||console.warn(n._logPrefix+"[WS] Received deletion on "+n._logTypeName+" {"+t+"} - TODO check implementation"),i})))},e.prototype.copyIdAndUpdateDate=function(t,e){t&&Qi.copyIdAndUpdateDate(t,e)},e.prototype.fromObject=function(t){if(!t)return t;var e=new this.dataType;return e.fromObject(t),e},e.prototype.asFilter=function(t){return Ul.fromObject(t,this.filterType)},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.platform.mobile||(this._mutableWatchQueriesMaxCount=-1),[2]}))}))},e.prototype.fillDefaultProperties=function(t){},e.prototype.asObject=function(t,e){return t.asObject(e)},e.prototype.getRefetchQueriesForMutation=function(t){if(t&&t.refetchQueries)return t.refetchQueries;if("refetch-queries"===this.watchQueriesUpdatePolicy){var e=this.getLoadQueries();if(e.length)return this.findRefetchQueries({queries:e})}},e.prototype.getLoadQueries=function(){return[this.queries.loadAll,this.queries.loadAllWithTotal].filter(Re)},e}(Ls);Zc.decorators=[{type:e.Directive}],Zc.ctorParameters=function(){return[{type:Ns},{type:Sl},{type:Function},{type:Function},{type:void 0}]};var tu=function(){function t(){}return t.waitIdle=function(t){if(!t||!t.dataSource)throw new Error("Invalid table. Missing table or table.dataSource");return t.dataSource.waitIdle()},t.logRowErrors=function(t,e){jo.logFormErrors(t.validator,e)},t}(),eu=function(){},nu=function(t){function e(e,n,o,r){var i=t.call(this,[],e,o,r)||this;return i.dataService=n,i._creating=!1,i._saving=!1,i._useValidator=!1,i._stopWatching$=new D.Subject,i._editingRowCount=0,i.loadingSubject=new D.BehaviorSubject(void 0),i._options=Object.assign({dataServiceOptions:{},debug:r&&!1===r.suppressErrors,keepOriginalDataAfterConfirm:!1},r),i._useValidator=Re(o),i._logTypeName=$e((new e).__typename||"UnknownVO","VO"),i._debug=!0===i._options.debug,i}return Ee(e,t),Object.defineProperty(e.prototype,"serviceOptions",{get:function(){return this._options.dataServiceOptions},set:function(t){this._options.dataServiceOptions=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaded",{get:function(){return!1===this.loadingSubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return!1!==this.loadingSubject.value},enumerable:!1,configurable:!0}),e.prototype.ngOnDestroy=function(){this._stopWatching$.next(),this._stopWatching$.complete(),this._stopWatching$.unsubscribe(),this.loadingSubject.complete(),this.loadingSubject.unsubscribe()},e.prototype.watchAll=function(t,e,n,o,r){var i=this;return this._stopWatching$.next(),this._editingRowCount=0,this.markAsLoading(),this.dataService.watchAll(t,e,n,o,r,this.serviceOptions).pipe(N.takeUntil(this._stopWatching$),N.catchError((function(t){return i.handleError(t,"ERROR.LOAD_DATA_ERROR")})),N.map((function(t){return i._saving?console.info("[table-datasource] Received "+i._logTypeName+" data (from service), but still saving: skip"):i._editingRowCount>0?console.warn("[table-datasource] Received "+i._logTypeName+" data, while "+i._editingRowCount+" rows still editing: skip; Please check save() implementation in the table!"):i.updateDatasource(t.data||[]),t})))},e.prototype.save=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:if(je(this.serviceOptions.readOnly,!1))return console.error("[table-datasource] Enable to save, because serviceOptions.readOnly=true"),[2,!1];if(this._saving)return console.warn("[table-datasource] Trying to save "+this._logTypeName+" rows twice. Skip"),[2,!1];this._saving=!0,this.markAsLoading(),t=je(this.serviceOptions.saveOnlyDirtyRows,!1),s.label=1;case 1:return s.trys.push([1,4,5,6]),this._debug&&console.debug("[table-datasource] Saving "+this._logTypeName+" rows... {onlyDirty: "+t+"}"),[4,this.getRows()];case 2:if(e=s.sent(),(n=e.filter((function(t){return t.editing&&!t.confirmEditCreate()}))).length)throw this._debug&&n.forEach((function(t){return tu.logRowErrors(t,"[table-datasource] "+a._logTypeName+" row #"+t.id)})),{code:Ba,message:"ERROR.TABLE_INVALID_ROW_ERROR"};return this._editingRowCount=0,o=void 0,this._useValidator?(r=[],o=e.map((function(e){var n=new a.dataConstructor;return n.fromObject(e.currentData),t&&e.validator.dirty&&r.push(n),n})),t||(r=o)):(o=e.map((function(t){return t.currentData})),r=o),t&&!r.length?(this._debug&&console.debug("[table-datasource] No "+this._logTypeName+" data to save. Skip"),[2,!1]):(this._debug&&console.debug("[table-datasource] Asking service to save this "+this._logTypeName+" data:",r),[4,this.dataService.saveAll(r,this.serviceOptions)]);case 3:return s.sent(),this._debug&&console.debug("[table-datasource] Saving "+this._logTypeName+" data [OK]"),this.updateDatasource(o,{emitEvent:!1}),[2,!0];case 4:throw i=s.sent(),this._debug&&console.error("[table-datasource] Error while saving: "+i&&i.message||i),i;case 5:return this._saving=!1,this.markAsLoaded(),[7];case 6:return[2]}}))}))},e.prototype.updateDatasource=function(e,n){this._debug&&console.debug("[table-datasource] Updating datasource with data:",e),t.prototype.updateDatasource.call(this,e,n),n&&!1===n.emitEvent||this.markAsLoaded()},e.prototype.createNew=function(t){this.asyncCreateNew(t)},e.prototype.connect=function(e){return t.prototype.connect.call(this,e)},e.prototype.disconnect=function(e){t.prototype.disconnect.call(this,e),this._stopWatching$.next()},e.prototype.waitIdle=function(t){return On(this.loadingSubject.asObservable().pipe(N.debounceTime(t||100)))},e.prototype.confirmCreate=function(e){return!!t.prototype.confirmCreate.call(this,e)&&(e.editing&&e.validator&&(console.warn("[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false"),e.validator.disable({onlySelf:!0,emitEvent:!1})),!0)},e.prototype.confirmEdit=function(e){return!!t.prototype.confirmEdit.call(this,e)&&(e.editing&&e.validator&&(console.warn("[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false"),e.validator.disable({onlySelf:!0,emitEvent:!1})),!0)},e.prototype.startEdit=function(t){this._debug&&console.debug("[table-datasource] Start to edit row",t),t.startEdit(),this._editingRowCount++},e.prototype.cancelOrDelete=function(t){this._debug&&console.debug("[table-datasource] Cancelling or deleting row",t),t.cancelOrDelete(),this._editingRowCount--},e.prototype.handleError=function(t,e){var n=t&&t.message||t;throw console.error("[table-datasource] Service "+this._logTypeName+" sent error: "+n,t),this.markAsLoaded(),new Error(e||n)},e.prototype.handleErrorPromise=function(t){var e=t&&t.message||t;throw console.error("[table-datasource] Service "+this._logTypeName+" sent error: "+e,t),this.markAsLoaded(),t},e.prototype.delete=function(e){var n=this;if(-1===e)return t.prototype.delete.call(this,e);var o=this.getRow(e);o?(this.loadingSubject.next(!0),this.dataService.deleteAll([o.currentData],this.serviceOptions).catch((function(t){return n.handleErrorPromise(t)})).then((function(){setTimeout((function(){n.getRow(e)===o&&t.prototype.delete.call(n,e),n.loadingSubject.next(!1)}),300)}))):console.error("[table-datasource] Row to delete with id="+e+" not found")},e.prototype.deleteAll=function(e){var n=this;this.markAsLoading();var o=e.map((function(t){return t.currentData})),r=e.reduce((function(t,e){return t[e.id]=e,t}),{}),i=this,a=t.prototype.delete;return this.dataService.deleteAll(o,this.serviceOptions).catch((function(t){return n.handleErrorPromise(t)})).then((function(){var t=Object.getOwnPropertyNames(r).reduce((function(t,e){var n=r[e];return i.getRow(+e)===n?t.concat(n):t}),[]).sort((function(t,e){return t.id>e.id?-1:1}));Ne(t)&&(console.warn("[table-datasource] Force deletion of "+t.length+" rows (Is service applying deletion to observable ?)"),t.forEach((function(t){return a.call(i,t.id)}))),n.loadingSubject.next(!1)}))},e.prototype.getRows=function(){return _n(this.connect(null))},e.prototype.asyncCreateNew=function(e){var n=Object.create(null,{createNew:{get:function(){return t.prototype.createNew}}});return Ie(this,void 0,void 0,(function(){var t,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(this._creating)return[2];if(this._creating=!0,n.createNew.call(this,e),!((t=this.getRow(-1))&&this._options&&this._options.onRowCreated))return[3,4];if(!((o=this._options.onRowCreated(t))instanceof Promise))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,o];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),console.error(r&&r.message||r,r),[3,4];case 4:return this._editingRowCount++,this._creating=!1,[2]}}))}))},e.prototype.markAsLoading=function(){!0!==this.loadingSubject.value&&this.loadingSubject.next(!0)},e.prototype.markAsLoaded=function(){!1!==this.loadingSubject.value&&this.loadingSubject.next(!1)},e}(Dt.TableDataSource);nu.decorators=[{type:e.Directive}],nu.ctorParameters=function(){return[{type:Function},{type:void 0},{type:Dt.ValidatorService},{type:eu}]};var ou="displayColumns",ru="sortedColumn",iu="filter",au="pageSize",su=[20,50,100,200,500],lu=["select","id"],cu=["actions"],uu=["id"],du=function(){},pu=function(){function t(t,n,o,r,i,a,s,l,c,u){this.route=t,this.router=n,this.platform=o,this.location=r,this.modalCtrl=i,this.settings=a,this.columns=s,this._dataSource=l,this._filter=c,this._initialized=!1,this._subscription=new D.Subscription,this._cellValueChangesDefs={},this._enabled=!0,this._destroy$=new D.Subject,this.allowRowDetail=!0,this.excludesColumns=[],this.totalRowCount=null,this.readySubject=new D.BehaviorSubject(!1),this.loadingSubject=new D.BehaviorSubject(!0),this.savingSubject=new D.BehaviorSubject(!1),this.dirtySubject=new D.BehaviorSubject(!1),this.errorSubject=new D.BehaviorSubject(void 0),this.isRateLimitReached=!1,this.selection=new Nt.SelectionModel(!0,[]),this.editedRow=void 0,this.i18nColumnPrefix="COMMON.",this.autoLoad=!0,this.focusFirstColumn=!1,this.confirmBeforeDelete=!1,this.confirmBeforeCancel=!1,this.undoableDeletion=!1,this.propagateRowError=!1,this.defaultPageSize=20,this.defaultPageSizeOptions=su,this.onRefresh=new e.EventEmitter,this.onOpenRow=new e.EventEmitter,this.onNewRow=new e.EventEmitter,this.onStartEditingRow=new e.EventEmitter,this.onConfirmEditCreateRow=new e.EventEmitter,this.onCancelOrDeleteRow=new e.EventEmitter,this.onBeforeDeleteRows=Sn(),this.onBeforeCancelRows=Sn(),this.onBeforeSave=Sn(),this.onAfterDeletedRows=new e.EventEmitter,this.onSort=new e.EventEmitter,this.onDirty=new e.EventEmitter,this.onError=new e.EventEmitter,this._paginator=null,this.mobile=this.platform.is("mobile"),this.translate=null==u?void 0:u.get(F.TranslateService),this.formErrorAdapter=null==u?void 0:u.get(lr),this.alertCtrl=null==u?void 0:u.get(M.AlertController),this.toastController=null==u?void 0:u.get(M.ToastController),this._autocompleteConfigHolder=new Pn({getUserAttributes:function(t,e){return a.getFieldDisplayAttributes(t,e)}}),this.autocompleteFields=this._autocompleteConfigHolder.fields}return Object.defineProperty(t.prototype,"error",{get:function(){return this.errorSubject.value},set:function(t){this.setError(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error$",{get:function(){return this.errorSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading$",{get:function(){return this.loadingSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"saving$",{get:function(){return this.savingSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstUserColumn",{get:function(){return this.displayedColumns[lu.length]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastUserColumn",{get:function(){return this.displayedColumns[this.displayedColumns.length-cu.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){this.setDatasource(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter},set:function(t){this.setFilter(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this.loading||0===this.totalRowCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.dirtySubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){var t;return!this.editedRow||!this.editedRow.editing||(null===(t=this.editedRow.validator)||void 0===t?void 0:t.valid)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){var t;return!(!this.editedRow||!this.editedRow.editing)&&(null===(t=this.editedRow.validator)||void 0===t?void 0:t.invalid)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){var t;return!(!this.editedRow||!this.editedRow.editing)&&(null===(t=this.editedRow.validator)||void 0===t?void 0:t.pending)},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){this.sort&&(this.sort.disabled=!0),this._enabled=!1},t.prototype.enable=function(t){this.sort&&(this.sort.disabled=!1),this._enabled=!0},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enabled},set:function(t){t!==!this._enabled&&(t?this.disable({emitEvent:!1}):this.enable({emitEvent:!1}))},enumerable:!1,configurable:!0}),t.prototype.markAsDirty=function(t){!0!==this.dirtySubject.value&&(this.dirtySubject.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsPristine=function(t){!1!==this.dirtySubject.value&&(this.dirtySubject.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsUntouched=function(t){var e;(!1!==this.dirtySubject.value||this.editedRow&&this.editedRow.id!==this.previouslyEditedRowId)&&(this.dirtySubject.next(!1),(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&this.dataSource.cancelOrDelete(this.editedRow),this.editedRow=null,t&&!1===t.emitEvent||this.markForCheck()),this.previouslyEditedRowId=void 0},t.prototype.markAsTouched=function(t){var e,n;console.warn("TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0"),(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&(null===(n=this.editedRow.validator)||void 0===n||n.markAllAsTouched(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAllAsTouched=function(t){var e,n;(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&(null===(n=this.editedRow.validator)||void 0===n||n.markAllAsTouched(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsSaving=function(t){!0!==this.savingSubject.value&&(this.focusColumn=void 0,this.savingSubject.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsSaved=function(t){!1!==this.savingSubject.value&&(this.savingSubject.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoading=function(t){this.setLoading(!0,t)},t.prototype.markAsLoaded=function(t){this.setLoading(!1,t)},t.prototype.markRowAsDirty=function(t,e){var n;(t=t||this.editedRow)&&(null===(n=t.validator)||void 0===n||n.markAsDirty(e)),this.markAsDirty(e)},t.prototype.markAsReady=function(t){!0!==this.readySubject.value&&(this.readySubject.next(!0),"function"==typeof this.ngOnReady&&this.ngOnReady())},Object.defineProperty(t.prototype,"loading",{get:function(){return this.loadingSubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return!this.loadingSubject.value},enumerable:!1,configurable:!0}),t.prototype.enableSort=function(){this.sort&&(this.sort.disabled=!1)},t.prototype.disableSort=function(){this.sort&&(this.sort.disabled=!0)},Object.defineProperty(t.prototype,"pageSize",{get:function(){return this.paginator&&this.paginator.pageSize||this.defaultPageSize||20},set:function(t){this.defaultPageSize=t,this.paginator&&(this.paginator.pageSize=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageOffset",{get:function(){return this.paginator&&this.paginator.pageIndex*this.paginator.pageSize||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortActive",{get:function(){return this.sort&&this.sort.active},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortDirection",{get:function(){return this.sort&&this.sort.direction&&("desc"===this.sort.direction?"desc":"asc")||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paginator",{get:function(){return this._paginator||this.childPaginator},set:function(t){this._paginator=t},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(!this._initialized){if(this._initialized=!0,this.readOnly=je(this.readOnly,!1),this.inlineEdition=!this.readOnly&&je(this.inlineEdition,!1),this.saveBeforeDelete=je(this.saveBeforeDelete,!this.readOnly),this.saveBeforeSort=je(this.saveBeforeSort,!this.readOnly),this.saveBeforeFilter=je(this.saveBeforeFilter,!this.readOnly),this.keepEditedRowOnSave=je(this.keepEditedRowOnSave,this.inlineEdition),this.errorTranslatorOptions=this.errorTranslatorOptions||{separator:", ",controlPathTranslator:this},this.confirmBeforeDelete&&!this.alertCtrl)throw Error("Missing 'alertCtrl' or 'injector' in component's constructor.");this.settingsId=this.settingsId||this.generateTableId(),this.displayedColumns=this.getDisplayColumns();var e=this.getSortedColumn();this.defaultSortBy=e.id,this.defaultSortDirection=e.start,this.defaultPageSize=this.getPageSize(),this.registerSubscription(this.errorSubject.subscribe((function(e){return t.onError.emit(e)}))),this.registerSubscription(this.dirtySubject.subscribe((function(e){return t.onDirty.emit(e)}))),this.registerSubscription(this.onStartEditingRow.pipe(N.filter((function(t){return t.validator&&!0})),N.mergeMap((function(e){return e.validator.valueChanges.pipe(N.takeUntil(D.combineLatest([t.onStartEditingRow,t._destroy$])),N.map((function(){var t;return null===(t=e.validator)||void 0===t?void 0:t.dirty})),N.filter((function(t){return!0===t})),N.first())}))).subscribe((function(){return t.markAsDirty()}))),this.registerSubscription(this.onRefresh.pipe(N.startWith(this.autoLoad?{}:"skip"),N.switchMap((function(e){return t.dirtySubject.next(!1),t.selection.clear(),"skip"===e?D.of(void 0):t._dataSource?(t.debug&&console.debug("[table] Calling dataSource.watchAll()..."),t._dataSource.watchAll(t.pageOffset,t.pageSize,t.sortActive,t.sortDirection,t._filter)):(t.debug&&console.debug("[table] Skipping data load: no dataSource defined"),D.of(void 0))})),N.catchError((function(e){return t.debug&&console.error(e),t.setError(e&&e.message||e),D.of(void 0)}))).subscribe((function(e){return t.updateView(e)}))),this._dataSource&&this.listenDatasourceLoading(this._dataSource)}},t.prototype.ngAfterViewInit=function(){var t=this;this.debug&&(this.table||setTimeout((function(){t.table||console.warn("[table] Missing <mat-table> in the HTML template (after waiting 500ms)! Component: "+t.constructor.name)}),500),this.displayedColumns||console.warn("[table] Missing 'displayedColumns'. Did you call super.ngOnInit() in component "+this.constructor.name+" ?")),D.merge(this.sort&&this.sort.sortChange.pipe(N.mergeMap((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.saveBeforeAction("sort")]}))}))})),N.filter((function(t){return!0===t})),N.tap((function(){var e=[t.sort.active,t.sort.direction||"asc"].join(":");t.settings.savePageSetting(t.settingsId,e,ru)})))||D.EMPTY,this.paginator&&this.paginator.page.pipe(N.mergeMap((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.saveBeforeAction("sort")]}))}))})),N.filter((function(t){return!0===t})),N.tap((function(){return t.settings.savePageSetting(t.settingsId,t.paginator.pageSize,au)})))||D.EMPTY).subscribe((function(e){t.onSort.emit(),t.onRefresh.emit(e)})),this.sort&&this.paginator&&this.registerSubscription(this.sort.sortChange.subscribe((function(){return t.paginator.pageIndex=0})))},t.prototype.ngOnDestroy=function(){var t,e=this;this._subscription.unsubscribe(),Object.keys(this._cellValueChangesDefs).forEach((function(t){return e.stopCellValueChanges(t,!0)})),this._cellValueChangesDefs={},this.loadingSubject.unsubscribe(),this.savingSubject.unsubscribe(),this.errorSubject.unsubscribe(),this.dirtySubject.unsubscribe(),this.onRefresh.unsubscribe(),this.onOpenRow.unsubscribe(),this.onNewRow.unsubscribe(),this.onStartEditingRow.unsubscribe(),this.onConfirmEditCreateRow.unsubscribe(),this.onCancelOrDeleteRow.unsubscribe(),this.onBeforeDeleteRows.unsubscribe(),this.onBeforeCancelRows.unsubscribe(),this.onBeforeSave.unsubscribe(),this.onAfterDeletedRows.unsubscribe(),this.onSort.unsubscribe(),this.onDirty.unsubscribe(),this.onError.unsubscribe(),this._destroy$.next(),this._destroy$.unsubscribe(),null===(t=this._dataSource)||void 0===t||t.ngOnDestroy()},t.prototype.updateView=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return t?(t&&t.data?(this.isRateLimitReached=!this.paginator||t.data.length<this.paginator.pageSize,this.visibleRowCount=t.data.length,this.totalRowCount=Re(t.total)?t.total:(this.paginator&&this.paginator.pageIndex*(this.paginator.pageSize||20)||0)+this.visibleRowCount,this.debug&&console.debug("[table] "+t.data.length+" rows loaded")):(this.isRateLimitReached=!0,this.totalRowCount=0,this.visibleRowCount=0),e&&!1===e.emitEvent||(this.markAsUntouched({emitEvent:!1}),this.markAsPristine({emitEvent:!1}),this.markAsLoaded({emitEvent:!1})),this.markForCheck(),[2]):[2]}))}))},t.prototype.setDatasource=function(t){if(this._dataSource)throw new Error("[table] dataSource already set !");t&&this._dataSource!==t&&(this._dataSource=t,this._initialized&&this.listenDatasourceLoading(t))},t.prototype.resetDataSource=function(){var t;this._dataSourceLoadingSubscription&&(this._dataSourceLoadingSubscription.unsubscribe(),this._subscription.remove(this._dataSourceLoadingSubscription)),null===(t=this._dataSource)||void 0===t||t.ngOnDestroy(),this._dataSource=null},t.prototype.addColumnDef=function(t){this.table.addColumnDef(t)},t.prototype.removeColumnDef=function(t){this.table.removeColumnDef(t)},t.prototype.setFilter=function(t,e){var n=this;e=e||{emitEvent:!0},this.saveBeforeFilter&&this.dirty?this.saveBeforeAction("filter").then((function(o){o&&n.applyFilter(t,e)})):this.applyFilter(t,e)},t.prototype.confirmAndAdd=function(t,e){return!!this.confirmEditCreate(t,e)&&this.addRow(t)},t.prototype.confirmAndBackward=function(t,e){var n,o,r=this,i=this.editedRow;return i&&-1===i.id&&(null===(n=i.validator)||void 0===n?void 0:n.invalid)&&!(null===(o=i.validator)||void 0===o?void 0:o.dirty)?(this.deleteNewRow(t,i),this.waitIdle().then((function(){return r.editRowById(t,e.id,{focusColumn:r.lastUserColumn})})),!0):(this.editRow(t,e,{focusColumn:this.lastUserColumn}),!0)},t.prototype.confirmAndForward=function(t,e){return e=e||this.editedRow,!!this.confirmEditCreate(t,e)&&(this.editRowById(t,e.id+1,{focusColumn:this.firstUserColumn}),!0)},t.prototype.editRowById=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return e<0?[2]:e>=this.visibleRowCount?(this.focusColumn=n&&n.focusColumn||this.firstUserColumn,this.addRow(t),[3,3]):[3,1];case 1:return[4,this.dataSource.getRow(e)];case 2:o=r.sent(),this.editRow(t,o,n),r.label=3;case 3:return[2]}}))}))},t.prototype.confirmEditCreate=function(t,e){var n,o=this;if(!(e=e||this.editedRow)||!e.editing)return!0;if(null==t||t.stopPropagation(),e.confirmEditCreate())return e===this.editedRow&&(this.editedRow=void 0),(null===(n=e.validator)||void 0===n?void 0:n.dirty)&&this.markAsDirty({emitEvent:!1}),this.resetError(),this.onConfirmEditCreateRow.next(e),!0;if(e.validator){if(e.validator.pending)return jo.waitWhilePending(e.validator).then((function(){return o.confirmEditCreate(t,e)})),!1;if(this.debug&&(console.warn("[table] Cannot confirm row, because invalid"),jo.logFormErrors(e.validator,"[table] ")),e.validator.markAllAsTouched(),this.propagateRowError){var r=this.getRowError(e);this.setError(r)}}return!1},t.prototype.cancelOrDelete=function(t,e,n){-1===e.id?this.deleteNewRow(t,e):this.cancelExistingRow(t,e,n)},t.prototype.addRow=function(t,e){return this.debug&&console.debug("[table] Asking for new row..."),!!this._enabled&&(this.inlineEdition?!!this.confirmEditCreate()&&(this.addRowToTable(e),!0):(this.openNewRowDetail(t),!1))},t.prototype.save=function(t){var e,n;return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(t=Object.assign({keepEditing:this.keepEditedRowOnSave},t),this.readOnly)throw{code:Ua,message:"ERROR.TABLE_READ_ONLY"};if(this.resetError(),this.previouslyEditedRowId=t.keepEditing&&(null===(e=this.editedRow)||void 0===e?void 0:e.editing)?this.editedRow.id:void 0,o=Re(this.previouslyEditedRowId)&&this.editedRow.currentData||(null===(n=this.singleSelectedRow)||void 0===n?void 0:n.currentData),!this.confirmEditCreate())throw{code:Ba,message:"ERROR.TABLE_INVALID_ROW_ERROR"};this.markAsSaving(),a.label=1;case 1:return a.trys.push([1,3,4,7]),this.debug&&console.debug("[table] Calling dataSource.save()..."),[4,this._dataSource.save()];case 2:return(r=a.sent())&&this.markAsPristine(),[2,r];case 3:throw i=a.sent(),this.setError(i&&i.message||i),i;case 4:return this.markAsSaved(),Re(this.previouslyEditedRowId)?[4,this.selectRowByIdOrData(this.previouslyEditedRowId,o)]:[3,6];case 5:a.sent(),a.label=6;case 6:return[7];case 7:return[2]}}))}))},t.prototype.cancel=function(t,e){var n=this;if((!e||!1!==e.interactive)&&this.dirty&&(this.confirmBeforeCancel||this.onBeforeCancelRows.observers.length>0))return null==t||t.stopPropagation(),void this.canCancelRows().then((function(t){t&&n.cancel(null,{interactive:!1})}));this.onRefresh.emit()},t.prototype.duplicateRow=function(t,e,n){var o;return Ie(this,void 0,void 0,(function(){var r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return null==t||t.stopPropagation(),(e=e||this.singleSelectedRow)&&this.confirmEditCreate(t,e)?[4,this.addRowToTable(e.id+1)]:[2,!1];case 1:return r=s.sent(),i=Object.assign(Object.assign({},e.currentData),{id:null}),n&&n.skipProperties&&(a=r.currentData,n.skipProperties.forEach((function(t){return i[t]=a[t]}))),r.validator?(r.validator.patchValue(i),r.validator.markAsDirty()):((null===(o=r.currentData)||void 0===o?void 0:o.fromObject)?r.currentData.fromObject(i):r.currentData=i,this.markAsDirty()),this.clickRow(void 0,r),[2]}}))}))},t.prototype.isAllSelected=function(){return this.selection.selected.length===this.totalRowCount||this.selection.selected.length===this.visibleRowCount},t.prototype.masterToggle=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return this.loading?[2]:this.isAllSelected()?(this.selection.clear(),[3,3]):[3,1];case 1:return[4,this._dataSource.getRows()];case 2:e.sent().forEach((function(e){return t.selection.select(e)})),e.label=3;case 3:return[2]}}))}))},t.prototype.deleteSelection=function(t){return this.deleteRows(t,this.selection.selected)},t.prototype.deleteRow=function(t,e,n){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,this.deleteRows(t,[e],n)];case 1:return[2,1===o.sent()]}}))}))},t.prototype.deleteRows=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(this.readOnly)throw{code:Ua,message:"ERROR.TABLE_READ_ONLY"};return(null==t?void 0:t.defaultPrevented)?[2,0]:(null==t||t.preventDefault(),this._enabled?this.loading||Fe(e)?[2,0]:[4,this.canDeleteRows(e,n)]:[2,0]);case 1:return a.sent()?this.saveBeforeDelete?(e.filter((function(t){var e;return!(null===(e=t.validator)||void 0===e?void 0:e.valid)})).forEach((function(t){return t.cancelOrDelete()})),[4,this.saveBeforeAction("delete")]):[3,3]:[2,0];case 2:if(!a.sent())return[2];a.label=3;case 3:this.debug&&console.debug("[table] Delete selection..."),o=e.slice().sort((function(t,e){return t.id>e.id?-1:1})),a.label=4;case 4:return a.trys.push([4,6,,7]),r=o.length,[4,this._dataSource.deleteAll(o)];case 5:return a.sent(),this.selection.clear(),this.editedRow=void 0,this.markAsDirty({emitEvent:!1}),this.markForCheck(),this.onAfterDeletedRows.next(o),[2,r];case 6:throw i=a.sent(),this.setError(i&&i.message||i),i;case 7:return[2]}}))}))},t.prototype.selectRowById=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return void 0===t?[2,!1]:[4,this.waitIdle()];case 1:return n.sent(),e=this.dataSource.getRow(t),[2,this.clickRow(null,e)]}}))}))},t.prototype.selectRowByData=function(t){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){switch(o.label){case 0:return void 0===t?[2,Promise.resolve(!1)]:[4,this.waitIdle()];case 1:return o.sent(),[4,this.dataSource.getRows()];case 2:return[2,(e=(o.sent()||[]).find((function(e){return n.equals(e.currentData,t)})))&&this.clickRow(null,e)]}}))}))},t.prototype.clickRow=function(t,e){var n=this;return this.loading?(this.debug&&console.debug("[table] Waiting before apply clickRow() (datasource is busy)..."),this.waitIdle().then((function(){return n.clickRow(t,e)})),!1):!(-1!==e.id&&!e.editing)||!(null==t?void 0:t.defaultPrevented)&&(this.inlineEdition?this.editRow(t,e,{focusColumn:void 0}):(t&&(t.stopPropagation(),t.preventDefault()),this.markAsLoading(),this.openRow(e.currentData.id,e).then((function(){return n.markAsLoaded()})),!0))},t.prototype.moveRow=function(t,e){this.dataSource.move(t,e)},t.prototype.ready=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this.readySubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,On(this.loadingSubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.openSelectColumnsModal=function(t){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return t=this.getCurrentColumns(),[4,this.modalCtrl.getTop()];case 1:return e=!!i.sent(),[4,this.modalCtrl.create({component:Tc,componentProps:{columns:t},cssClass:e&&"stack-modal"})];case 2:return[4,(n=i.sent()).present()];case 3:return i.sent(),[4,n.onDidDismiss()];case 4:return(o=i.sent().data)?(r=(o||[]).filter((function(t){return!1===t.canHide||t.visible})).map((function(t){return t.name}))||[],this.displayedColumns=lu.concat(r).concat(cu),this.markForCheck(),[4,this.settings.savePageSetting(this.settingsId,r,ou)]):[2];case 5:return i.sent(),[2]}}))}))},t.prototype.trackByFn=function(t,e){return e.id},t.prototype.doRefresh=function(t){var e=this;this.onRefresh.emit(t),(null==t?void 0:t.target)&&t.target.complete&&setTimeout((function(){return Ie(e,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.waitIdle()];case 1:return e.sent(),t.target.complete(),[2]}}))}))}))},t.prototype.getCurrentColumns=function(){var t=this,e=this.columns.slice(lu.length).filter((function(e){return-1===t.displayedColumns.indexOf(e)}));return this.displayedColumns.concat(e).filter((function(e){return!lu.includes(e)&&!cu.includes(e)&&!t.excludesColumns.includes(e)})).map((function(e){return{name:e,label:t.getI18nColumnName(e),visible:-1!==t.displayedColumns.indexOf(e),canHide:-1===t.getRequiredColumns().indexOf(e)}}))},t.prototype.escapeEditingRow=function(t,e){(e=e||this.editedRow)&&e.editing&&(t&&(t.preventDefault(),t.stopPropagation()),-1===e.id&&e.validator.invalid?this.deleteNewRow(t,e):this.confirmBeforeCancel?this.cancelExistingRow(t,e,{keepEditing:!1}):this.confirmEditCreate(t,e))},t.prototype.translateControlPath=function(t){var e,n=this.getI18nColumnName(t);return(null===(e=this.translate)||void 0===e?void 0:e.instant(n))||n},t.prototype.editRow=function(t,e,n){return!!this._enabled&&(this.editedRow===e||!(null==t?void 0:t.defaultPrevented)&&(!!this.confirmEditCreate()&&(e.editing||this.loading||(this.focusColumn=n&&n.focusColumn||this.focusColumn,this._dataSource.startEdit(e)),this.editedRow=e,this.onStartEditingRow.emit(e),!0)))},t.prototype.selectRowByIdOrData=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,6,,7]),Re(t)||-1!==t?[4,this.selectRowById(t)]:[3,3];case 2:if(o.sent())return[2,!0];console.warn("[app-table] Save: Cannot reselect row by row.id: ",t),o.label=3;case 3:return e?[4,this.selectRowByData(e)]:[3,5];case 4:if(o.sent())return[2,!0];console.warn("[app-table] Save: Cannot reselect row by data: ",e),o.label=5;case 5:return[2,!1];case 6:return n=o.sent(),console.error(n&&n.message||n),[2,!1];case 7:return[2]}}))}))},Object.defineProperty(t.prototype,"singleSelectedRow",{get:function(){var t;return 1===(null===(t=this.selection.selected)||void 0===t?void 0:t.length)?this.selection.selected[0]:void 0},enumerable:!1,configurable:!0}),t.prototype.canDeleteRows=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:if(!(this.onBeforeDeleteRows.observers.length>0))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Tn(this.onBeforeDeleteRows,"canDelete",{detail:{rows:t}})];case 2:return o.sent()?[3,4]:[2,!1];case 3:if("CANCELLED"===(n=o.sent()))return[2,!1];throw console.error("Error while checking if can delete rows",n),n;case 4:return!this.confirmBeforeDelete||e&&!1===e.interactive?[2,!0]:[2,this.askDeleteConfirmation(null,t)]}}))}))},t.prototype.canCancelRows=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return(n=t)?[3,2]:[4,this.dataSource.getRows()];case 1:n=r.sent().filter((function(t){var e;return null===(e=t.validator)||void 0===e?void 0:e.dirty})),r.label=2;case 2:if(Fe(t=n))return[2,!0];if(!(this.onBeforeCancelRows.observers.length>0))return[3,6];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,Tn(this.onBeforeCancelRows,"canCancel",{detail:{rows:t}})];case 4:return r.sent()?[3,6]:[2,!1];case 5:if("CANCELLED"===(o=r.sent()))return[2,!1];throw console.error("Error while checking if can cancel rows",o),o;case 6:return!this.confirmBeforeCancel||e&&!1===e.interactive?[2,!0]:[2,this.askCancelConfirmation(null,t)]}}))}))},t.prototype.saveBeforeAction=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(!this.dirty)return[2,!0];switch(t){case"delete":e=this.saveBeforeDelete;break;case"filter":e=this.saveBeforeFilter;break;case"sort":e=this.saveBeforeSort;break;default:e=!0}if(n=!0,!e)return[3,4];if(!(this.onBeforeSave.observers.length>0))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Tn(this.onBeforeSave,"beforeSave",{detail:{action:t,valid:this.valid}})];case 2:return o=a.sent(),n=o.confirmed,e=o.save,[3,4];case 3:if("CANCELLED"===(r=a.sent()))return[2,!1];throw console.error("Error while checking if can delete rows",r),r;case 4:return n?e?[4,this.save()]:[3,6]:[3,7];case 5:return i=a.sent(),this.markAsDirty(),[2,i];case 6:return[2,!0];case 7:return[2,!1]}}))}))},t.prototype.openRow=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return this.allowRowDetail?(this.debug&&this.dirty&&console.warn("[table] Opening row details, but table has unsaved changes!"),this.onOpenRow.observers.length?(this.onOpenRow.emit({id:t,row:e}),[2,!0]):Ae(t)?(console.warn("[table] Opening row details, but data has no id!"),[2,!1]):[4,this.router.navigate([t],{relativeTo:this.route,queryParams:{}})]):[3,2];case 1:return[2,n.sent()];case 2:return[2,!1]}}))}))},t.prototype.openNewRowDetail=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.allowRowDetail?this.onNewRow.observers.length?(this.onNewRow.emit(t),[2,!0]):[4,this.router.navigate(["new"],{relativeTo:this.route})]:[2,!1];case 1:return[2,e.sent()]}}))}))},t.prototype.getRequiredColumns=function(){return uu},t.prototype.getUserColumns=function(){return this.settings.getPageSettings(this.settingsId,ou)},t.prototype.getSortedColumn=function(){var t=this.settings.getPageSettings(this.settingsId,ru),e=t&&t.split(":");return e&&2===e.length&&this.columns.includes(e[0])?{id:e[0],start:"desc"===e[1]?"desc":"asc",disableClear:!1}:this.defaultSortBy?{id:this.defaultSortBy,start:this.defaultSortDirection||"asc",disableClear:!1}:{id:"id",start:"asc",disableClear:!1}},t.prototype.getPageSize=function(){return this.settings.getPageSettings(this.settingsId,au)||this.defaultPageSize},t.prototype.getDisplayColumns=function(){var t=this,e=this.getUserColumns();if(!e)return this.columns.filter((function(e){return!t.excludesColumns.includes(e)}));var n=this.columns.filter((function(t){return lu.includes(t)})),o=this.columns.filter((function(t){return cu.includes(t)}));return(e=e.filter((function(e){return!n.includes(e)&&!o.includes(e)&&t.columns.includes(e)}))).push.apply(e,ke(this.getRequiredColumns().filter((function(t){return!n.includes(t)&&!o.includes(t)&&!e.includes(t)})))),n.concat(e).concat(o).filter((function(e){return!t.excludesColumns.includes(e)}))},t.prototype.updateColumns=function(){this.displayedColumns=this.getDisplayColumns(),this.loading||this.markForCheck()},t.prototype.registerSubscription=function(t){this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.registerAutocompleteField=function(t,e){return this._autocompleteConfigHolder.add(t,e)},t.prototype.getI18nColumnName=function(t){return(this.i18nColumnPrefix||"")+Ge(t).toUpperCase()},t.prototype.generateTableId=function(){return this.location.path(!0).replace(/[?].*$/g,"").replace(/\/[\d]+/g,"_id")+"_"+this.constructor.name},t.prototype.addRowToTable=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.focusFirstColumn=!0,[4,this._dataSource.asyncCreateNew(t)];case 1:return e.sent(),this.editedRow=this._dataSource.getRow(-1),this.onStartEditingRow.emit(this.editedRow),this.totalRowCount++,this.visibleRowCount++,this.markAsDirty({emitEvent:!1}),this.markForCheck(),[2,this.editedRow]}}))}))},t.prototype.registerCellValueChanges=function(t,e,n){var o=this;e=e||t,n=n||!1;var r=this._cellValueChangesDefs[t];if(r&&(r.formPath!==e||r.emitInitialValue!==n))throw Error("Already register a cell value change for this name, with different 'formPath' or 'emitInitialValue'. Please use same arguments.");return r||(this.debug&&console.debug("[table] New listener {"+t+"} for value changes on path "+e),r={subject:new D.Subject,subscription:null,formPath:e,emitInitialValue:n},this._cellValueChangesDefs[t]=r,this.registerSubscription(this.onStartEditingRow.subscribe((function(e){return o.startCellValueChanges(t,e)})))),r.subject},t.prototype.setShowColumn=function(t,e,n){if(!this.excludesColumns.includes(t)!==e){if(e){var o=this.excludesColumns.findIndex((function(e){return e===t}));o>=0&&this.excludesColumns.splice(o,1)}else this.excludesColumns.push(t);!this.displayedColumns||n&&!1===n.emitEvent||this.updateColumns()}},t.prototype.getShowColumn=function(t){return!this.excludesColumns.includes(t)},t.prototype.startsWithUpperCase=function(t,e){return t&&t.toUpperCase().startsWith(e)},t.prototype.markForCheck=function(){},t.prototype.askDeleteConfirmation=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return this.undoableDeletion?[2,Dl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.DELETE_ROW":"CONFIRM.DELETE_ROWS",this.alertCtrl,this.translate,t)]:[2,Dl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)]}))}))},t.prototype.askCancelConfirmation=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return[2,Dl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.CANCEL_ROW":"CONFIRM.CANCEL_ROWS",this.alertCtrl,this.translate,t)]}))}))},t.prototype.askRestoreConfirmation=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,Dl.askActionConfirmation(this.alertCtrl,this.translate,!1,t)]}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[2,ba.show(this.toastController,this.translate,t)]}))}))},t.prototype.resetError=function(t){this.setError(void 0,t)},t.prototype.getRowError=function(t,e){if((t=t||this.editedRow)&&this.formErrorAdapter)return this.formErrorAdapter.translateErrors(t.validator,Object.assign(Object.assign({},this.errorTranslatorOptions),e))},t.prototype.setError=function(t,e){this.errorSubject.value!==t&&(this.errorSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.equals=function(t,e){return Qi.equals(t,e,"id")},t.prototype.setLoading=function(t,e){this.loadingSubject.value!==t&&(this.loadingSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.deleteNewRow=function(t,e){null==t||t.stopPropagation(),this.selection.clear(),this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),this.resetError(),this.totalRowCount--,this.visibleRowCount--},t.prototype.cancelExistingRow=function(t,e,n){var o,r,i,a=this;if(!(!n||!1!==n.interactive)&&(null===(o=e.validator)||void 0===o?void 0:o.dirty)&&(this.confirmBeforeCancel||this.onBeforeCancelRows.observers.length>0))return t.stopPropagation(),void this.canCancelRows([e],n).then((function(n){n&&a.cancelExistingRow(t,e,{interactive:!1})}));var s=e.editing&&(!n||!1!==n.keepEditing);this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),!0===(null===(r=this.dataSource)||void 0===r?void 0:r.options.keepOriginalDataAfterConfirm)&&(null===(i=e.validator)||void 0===i||i.markAsPristine(),this.checkIfPristine()),s&&this.editRow(void 0,e)},t.prototype.checkIfPristine=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.dirty?[4,this._dataSource.getRows()]:[2];case 1:return e=n.sent(),-1===(e||[]).findIndex((function(t){var e;return null===(e=t.validator)||void 0===e?void 0:e.dirty}))&&this.markAsPristine(t),[2]}}))}))},t.prototype.applyFilter=function(t,e){this.debug&&console.debug("[table] Applying filter",t),this._filter=t,e&&e.emitEvent&&(this.paginator&&this.paginator.pageIndex>0&&(this.paginator.pageIndex=0),this.onRefresh.emit())},t.prototype.listenDatasourceLoading=function(t){var e=this;if(!t)throw new Error("[table] dataSource not set !");Re(this._dataSourceLoadingSubscription)&&(this.debug&&console.debug("[table] Many call to listenDatasource(): Cleaning previous subscriptions..."),this._dataSourceLoadingSubscription.unsubscribe(),this._subscription.remove(this._dataSourceLoadingSubscription)),this._dataSourceLoadingSubscription=this._dataSource.loadingSubject.pipe(N.distinctUntilChanged(),N.tap((function(t){return t&&e.setLoading(!0)})),N.debounceTime(250),N.tap((function(t){return!t&&e.setLoading(!1)}))).subscribe(),this._subscription.add(this._dataSourceLoadingSubscription)},t.prototype.startCellValueChanges=function(t,e){var n=this._cellValueChangesDefs[t];if(n){n.subscription?(n.subscription.unsubscribe(),n.subscription=null):this.debug&&console.debug("[table] Start values changes on row path {"+n.formPath+"}");var o=e.validator&&jo.getControlFromPath(e.validator,n.formPath);o?(n.subscription=o.valueChanges.pipe(N.filter((function(){return o.enabled}))).subscribe((function(t){return n.subject.next(t)})),!1!==n.emitInitialValue&&n.subject.next(o.value)):console.warn("[table] Could not listen cell changes: no validator or invalid form path {"+n.formPath+"}")}else console.warn("[table] Listener with name {"+t+"} not registered! Please call registerCellValueChanges() before;")},t.prototype.stopCellValueChanges=function(t,e){var n=this._cellValueChangesDefs[t];n&&(n.subscription&&(this.debug&&console.debug("[table] Stop value changes on row path {"+n.formPath+"}"),n.subscription.unsubscribe(),n.subscription=null),e&&n.subject&&(n.subject.complete(),n.subject.unsubscribe()))},t}();pu.decorators=[{type:e.Directive}],pu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:void 0},{type:n.Location},{type:M.ModalController},{type:ga},{type:Array},{type:nu},{type:void 0},{type:e.Injector}]},pu.propDecorators={settingsId:[{type:e.Input}],debug:[{type:e.Input}],i18nColumnPrefix:[{type:e.Input}],i18nColumnSuffix:[{type:e.Input}],autoLoad:[{type:e.Input}],readOnly:[{type:e.Input}],inlineEdition:[{type:e.Input}],focusFirstColumn:[{type:e.Input}],confirmBeforeDelete:[{type:e.Input}],confirmBeforeCancel:[{type:e.Input}],undoableDeletion:[{type:e.Input}],saveBeforeDelete:[{type:e.Input}],keepEditedRowOnSave:[{type:e.Input}],saveBeforeSort:[{type:e.Input}],saveBeforeFilter:[{type:e.Input}],propagateRowError:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}],defaultPageSize:[{type:e.Input}],defaultPageSizeOptions:[{type:e.Input}],focusColumn:[{type:e.Input}],dataSource:[{type:e.Input}],filter:[{type:e.Input}],onRefresh:[{type:e.Output}],onOpenRow:[{type:e.Output}],onNewRow:[{type:e.Output}],onStartEditingRow:[{type:e.Output}],onConfirmEditCreateRow:[{type:e.Output}],onCancelOrDeleteRow:[{type:e.Output}],onBeforeDeleteRows:[{type:e.Output}],onBeforeCancelRows:[{type:e.Output}],onBeforeSave:[{type:e.Output}],onAfterDeletedRows:[{type:e.Output}],onSort:[{type:e.Output}],onDirty:[{type:e.Output}],onError:[{type:e.Output}],disabled:[{type:e.Input}],paginator:[{type:e.Input}],table:[{type:e.ViewChild,args:[l.MatTable,{static:!1}]}],childPaginator:[{type:e.ViewChild,args:[u.MatPaginator,{static:!1}]}],sort:[{type:e.ViewChild,args:[c.MatSort,{static:!1}]}]};var hu=function(){},mu=function(){function t(t,e,n,o){this.route=t,this.router=e,this.alertCtrl=n,this.translate=o,this._subscription=new D.Subscription,this._enabled=!1,this._dirty=!1,this._loading=!0,this._$ready=new D.BehaviorSubject(!1),this.debug=!1,this.submitted=!1,this.toolbar=null,this.formButtonsBar=null}return Object.defineProperty(t.prototype,"tables",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof pu}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forms",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof pc}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){var t;return this._dirty||-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.dirty})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return!this._children||-1===this._children.findIndex((function(t){return t.enabled&&!t.valid}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){var t;return-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.invalid})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){var t;return-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.pending})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){var t;return this._loading||-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.loading})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.formButtonsBar&&this.registerSubscription(this.formButtonsBar.onBack.subscribe((function(e){return t.goBack(e)})))},t.prototype.ngAfterViewInit=function(){},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.addChildForm=function(t){if(!t)throw new Error("Trying to register an undefined child form");return this._children=this._children||[],"function"==typeof t?this._children.push(new Lo(t)):this._children.push(t),this},t.prototype.addChildForms=function(t){var e=this;return(t||[]).forEach((function(t){return e.addChildForm(t)})),this},t.prototype.disable=function(t){var e;this._enabled=!1,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.disable(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.enable=function(t){var e;this._enabled=!0,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.enable(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsPristine=function(t){var e;this.error=null,this.submitted=!1,this._dirty=!1,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsPristine(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsUntouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(t){return t.markAsUntouched()})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsTouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsTouched(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAllAsTouched(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsDirty=function(t){this._dirty=!0,this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsLoading=function(t){this._loading||(this._loading=!0,t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoaded=function(t){var e;this._loading&&(this._loading=!1,t&&!0===t.onlySelf||null===(e=this.forms)||void 0===e||e.forEach((function(e){return e.markAsLoaded(t)})),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsReady=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsReady(t)})),this._$ready.next(!0)},t.prototype.ready=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this._$ready)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return jo.waitIdle(this,t)},t.prototype.cancel=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.isNewData?[4,this.unload()]:[3,2];case 1:return t.sent(),[3,4];case 2:return this.dirty?[4,this.reload()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},t.prototype.unload=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return console.debug("[tab-page] Unloading data..."),this.markAsLoading(),this._children.forEach((function(e){e instanceof pc?e.reset(null,t):e instanceof pu&&e.dataSource.disconnect()})),[2]}))}))},t.prototype.reloadWithConfirmation=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this.dirty,t||!e?[3,4]:(n=this.translate.instant(["COMMON.BTN_ABORT_CHANGES","COMMON.BTN_CANCEL","CONFIRM.CANCEL_CHANGES","CONFIRM.ALERT_HEADER"]),[4,this.alertCtrl.create({header:n["CONFIRM.ALERT_HEADER"],message:n["CONFIRM.CANCEL_CHANGES"],buttons:[{text:n["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){t=!0}},{text:n["COMMON.BTN_CANCEL"],role:"cancel",handler:function(){}}]})]);case 1:return[4,(o=r.sent()).present()];case 2:return r.sent(),[4,o.onDidDismiss()];case 3:r.sent(),r.label=4;case 4:return!t&&e?[3,6]:(this.scrollToTop(),this.disable(),[4,this.reload()]);case 5:return[2,r.sent()];case 6:return[2]}}))}))},t.prototype.goBack=function(t){var e;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return(null===(e=this.toolbar)||void 0===e?void 0:e.canGoBack)?[2,this.toolbar.goBack()]:[2,this.router.navigateByUrl("/")]}))}))},t.prototype.logFormErrors=function(){var t,e=this;this.debug&&console.debug("[app-tab-editor] Page not valid. Checking where (forms, tables)..."),null===(t=this._children)||void 0===t||t.forEach((function(t){return e.logChildrenFormErrors(t)}))},t.prototype.scrollToTop=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){return t=Be(t,500),this.content?[2,this.content.scrollToTop(t)]:(console.warn("[tab-editor] Cannot scroll to top. (no 'ion-content' tag found "+this.constructor.name),e=window.setInterval((function(){var t=window.pageYOffset;t>0?window.scrollTo(0,t-20):window.clearInterval(e)}),16),[2])}))}))},t.prototype.registerSubscription=function(t){this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.saveIfDirtyAndConfirm=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return this.dirty?(n=!1,o=!1,r=this.translate.instant(["COMMON.BTN_SAVE","COMMON.BTN_CANCEL","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE","CONFIRM.ALERT_HEADER"]),[4,this.alertCtrl.create({header:r["CONFIRM.ALERT_HEADER"],message:r["CONFIRM.SAVE"],buttons:[{text:r["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){o=!0}},{text:r["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){}},{text:r["COMMON.BTN_SAVE"],handler:function(){n=!0}}]})]):[2,!0];case 1:return[4,(i=a.sent()).present()];case 2:return a.sent(),[4,i.onDidDismiss()];case 3:return a.sent(),n?[4,this.save(t,e)]:[2,!o];case 4:return[2,a.sent()]}}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},t.prototype.logChildrenFormErrors=function(e,n,o){var r=this;if(n=n||"[app-tab-editor] ",e instanceof t)e.logFormErrors();else if(e instanceof P.AbstractControl)jo.logFormErrors(e,n,o);else if(e instanceof Lo)e.empty||e.valid||e.waitDelegate({timeout:1e3}).then((function(t){return r.logChildrenFormErrors(t,n,"provider")}));else if(e instanceof pu){if(e.invalid&&e.editedRow&&e.editedRow.validator){var i=e.constructor.name.toLowerCase();jo.logFormErrors(e.editedRow.validator,n,i)}}else if(e instanceof pc){if(!e.empty&&!e.valid)if(e.pending){var a=e.constructor.name.toLowerCase();console.warn(n+" -> "+a+": waiting while pending..."),jo.waitWhilePending(e,{timeout:1e3}).then((function(){return r.logChildrenFormErrors(e.form,n,a)}))}else jo.logFormErrors(e.form,n)}else console.warn(n+" Unknown children sub-form: ",e)},t.prototype.markForCheck=function(){},t}();mu.decorators=[{type:e.Directive}],mu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:M.AlertController},{type:F.TranslateService}]},mu.propDecorators={toolbar:[{type:e.ViewChild,args:[mi]}],formButtonsBar:[{type:e.ViewChild,args:[Sc,{static:!0}]}],content:[{type:e.ViewChild,args:[M.IonContent,{static:!0}]}]};var fu=function(t){function n(n,o,r,i,a){var s=t.call(this,n,o,r,i)||this;return s.route=n,s.router=o,s.alertCtrl=r,s.translate=i,s._selectedTabIndex=0,s.selectedTabIndexChange=new e.EventEmitter,a=Object.assign({tabCount:1,enableSwipe:!0,tabGroupAnimationDuration:"200ms"},a),s.tabCount=a.tabCount,s.enableSwipe=a.enableSwipe,s.tabGroupAnimationDuration=a.tabGroupAnimationDuration,s}return Ee(n,t),Object.defineProperty(n.prototype,"selectedTabIndex",{get:function(){return this._selectedTabIndex},set:function(t){this.setSelectedTabIndex(t)},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var e=this;t.prototype.ngOnInit.call(this),this.queryTabIndexParamName=this.queryTabIndexParamName||"tab",this.tabGroup&&this.registerSubscription(this.route.queryParams.subscribe((function(t){if(e.queryParams=Object.assign({},t),e.tabCount>1&&e.queryTabIndexParamName){var n=t[e.queryTabIndexParamName];e.queryParams[e.queryTabIndexParamName]=n&&parseInt(n)||void 0,Re(e.queryParams[e.queryTabIndexParamName])&&(e.selectedTabIndex=e.queryParams[e.queryTabIndexParamName])}setTimeout((function(){return e.tabGroup.realignInkBar()}),500)})))},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.selectedTabIndexChange.complete()},n.prototype.setSelectedTabIndex=function(t,e){var n=this;t<0?t=0:t>this.tabCount-1&&(console.warn("[tab-editor] Invalid tab index "+t+". Max value is "+(this.tabCount-1)),t=this._selectedTabIndex),this._selectedTabIndex=t,this.selectedTabIndexChange.next(t),!this.tabGroup||e&&!1===e.realignInkBar?e&&!1===e.emitEvent||this.markForCheck():(this.tabGroup.selectedIndex=t,this.markForCheck(),setTimeout((function(){return n.tabGroup.realignInkBar()}),200))},n.prototype.onTabChange=function(t,e){return!(e=e||this.queryTabIndexParamName)||(!this.queryParams||+this.queryParams[e]!==t.index)&&(this.queryParams=this.queryParams||{},this.queryParams[e]=t.index,"tab"===e&&Re(this.queryParams.subtab)&&delete this.queryParams.subtab,this.router.navigate(["."],{relativeTo:this.route,queryParams:this.queryParams,replaceUrl:!0}),!0)},n.prototype.onSwipeTab=function(t){var e=this;if(!this.enableSwipe||!t||t.defaultPrevented||t.srcEvent&&t.srcEvent.defaultPrevented||"touch"!==t.pointerType)return!1;var n=this.selectedTabIndex;switch(t.type){case"swipeleft":var o=n>=this.tabCount-1;n=o?0:n+1;break;case"swiperight":n=n<=0?this.tabCount:n-1;break;default:return console.error("[tab-page] Unknown swipe action: "+t.type),!1}return setTimeout((function(){e.selectedTabIndex=n,e.markForCheck()})),!0},n.prototype.onSubTabChange=function(t){this.onTabChange(t,"subtab")},n.prototype.unload=function(e){var n=Object.create(null,{unload:{get:function(){return t.prototype.unload}}});return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.selectedTabIndex=0,[4,n.unload.call(this,e)];case 1:return t.sent(),[2]}}))}))},n}(mu);fu.decorators=[{type:e.Directive}],fu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:M.AlertController},{type:F.TranslateService},{type:hu,decorators:[{type:e.Optional}]}]},fu.propDecorators={queryTabIndexParamName:[{type:e.Input}],selectedTabIndex:[{type:e.Input}],selectedTabIndexChange:[{type:e.Output}],tabGroup:[{type:e.ViewChild,args:["tabGroup",{static:!0}]}]};var gu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e}(hu),bu=function(t){function n(n,o,r,i){var a=t.call(this,n.get(z.ActivatedRoute),n.get(z.Router),n.get(M.AlertController),n.get(F.TranslateService),i)||this;return a.dataType=o,a.dataService=r,a.saving=!1,a.hasRemoteListener=!1,a.$title=new D.Subject,a.onUpdateView=new e.EventEmitter,i=Object.assign({enableListenChanges:!0===n.get(me).listenRemoteChanges,pathIdAttribute:"id",autoLoad:!0,autoUpdateRoute:!0,i18nPrefix:""},i),a.settings=n.get(ga),a.formErrorAdapter=n.get(lr),a.cd=n.get(e.ChangeDetectorRef),a.dateFormat=n.get(Mn),a.toastController=n.get(M.ToastController),a._enableListenChanges=i.enableListenChanges,a._pathIdAttribute=i.pathIdAttribute,a._autoLoad=i.autoLoad,a._autoLoadDelay=i.autoLoadDelay,a._autoUpdateRoute=i.autoUpdateRoute,a._autoOpenNextTab=i.autoOpenNextTab,a.i18nContext={prefix:i.i18nPrefix,suffix:""},a}return Ee(n,t),Object.defineProperty(n.prototype,"usageMode",{get:function(){return this._usageMode},set:function(t){this._usageMode!==t&&(this._usageMode=t,this.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isOnFieldMode",{get:function(){return this.settings.isOnFieldMode(this._usageMode)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isNewData",{get:function(){var t;return Ae(null===(t=this.data)||void 0===t?void 0:t.id)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"service",{get:function(){return this.dataService},enumerable:!1,configurable:!0}),n.prototype.markAsSaving=function(t){this.saving||(this.saving=!0,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.markAsSaved=function(t){this.saving&&(this.saving=!1,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.ngOnInit=function(){t.prototype.ngOnInit.call(this),this._autoOpenNextTab=je(this._autoOpenNextTab,!this.isOnFieldMode),this.historyIcon=this.historyIcon||{icon:"list"},this.registerForms(),this.disable()},n.prototype.ngAfterViewInit=function(){var e=this;t.prototype.ngAfterViewInit.call(this),this._autoLoad&&setTimeout((function(){return e.loadFromRoute()}),this._autoLoadDelay)},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.$title.complete(),this.$title.unsubscribe(),this.onUpdateView.complete(),this.onUpdateView.unsubscribe()},n.prototype.loadFromRoute=function(){var t=this.route.snapshot;if(!t||Te(this._pathIdAttribute))throw new Error("Unable to load from route: missing 'route' or 'options.pathIdAttribute'.");var e=t.params[this._pathIdAttribute];return Ae(e)||"new"===e?this.load(void 0,t.params):(Ye(e)&&(e=parseInt(e)),this.load(e,t.params))},n.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(!this.dataService)throw new Error("Cannot load data: missing 'dataService'!");if(this.error=null,!Ae(t))return[3,7];i.label=1;case 1:return i.trys.push([1,4,5,6]),o=new this.dataType,this._usageMode=this.computeUsageMode(o),[4,this.onNewEntity(o,e)];case 2:return i.sent(),[4,this.updateView(o,Object.assign({openTabIndex:0},e))];case 3:return i.sent(),[3,6];case 4:return n=i.sent(),this.setError(n),this.selectedTabIndex=0,[3,6];case 5:return this.markAsLoaded(),[7];case 6:return[3,13];case 7:return i.trys.push([7,11,12,13]),[4,this.dataService.load(t,e)];case 8:if(!(o=i.sent()))throw{code:ja,message:"ERROR.DATA_NO_FOUND"};return this._usageMode=this.computeUsageMode(o),[4,this.onEntityLoaded(o,e)];case 9:return i.sent(),[4,this.updateView(o,e)];case 10:return i.sent(),this.startListenRemoteChanges(),[3,13];case 11:return r=i.sent(),this.setError(r),this.selectedTabIndex=0,[3,13];case 12:return this.markAsLoaded(),[7];case 13:return[2]}}))}))},n.prototype.startListenRemoteChanges=function(){var t=this;this.hasRemoteListener||!this._enableListenChanges||this.isNewData||(this.hasRemoteListener=!0,this.registerSubscription(this.dataService.listenChanges(this.data.id).pipe(N.filter(Re)).subscribe((function(e){e.updateDate&&e.updateDate.isAfter(t.data.updateDate)&&(t.dirty?t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"}, but page is dirty: skip reloading."):(t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"} : reloading page..."),t.updateView(e)))})).add((function(){return t.hasRemoteListener=!1}))))},n.prototype.updateView=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return n=Re(t.id)&&void 0!==this.previousDataId&&this.previousDataId!==t.id,e=Object.assign({updateRoute:this._autoUpdateRoute&&n&&!this.loading,openTabIndex:this._autoOpenNextTab&&n&&Ae(this.previousDataId)&&this.computeNextTabIndex()},e),this.data=t,this.previousDataId=t.id||null,[4,this.ready()];case 1:return i.sent(),(o=this.setValue(t))?[4,o]:[3,3];case 2:i.sent(),i.label=3;case 3:return e&&!1===e.emitEvent||(this.markAsPristine(),this.markAsUntouched(),this.updateViewState(t),!0===e.updateRoute?this.updateTabAndRoute(t,e).then((function(){return r.updateTitle(t)})):(this.updateTabIndex(e.openTabIndex),this.updateTitle(t)),this.onUpdateView.emit(t)),[2]}}))}))},n.prototype.updateViewState=function(t,e){this.isNewData||this.canUserWrite(t)?this.enable(e):(this.disable(e),this.tables.forEach((function(t){return t.enableSort()})))},n.prototype.updateTabAndRoute=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.queryParams=this.queryParams||{},this.updateTabIndex(e&&e.openTabIndex),this.queryParams.tab=this.selectedTabIndex,(n={})[this._pathIdAttribute]=t&&Re(t.id)?t.id:"new",t&&Re(t.id)?[4,this.router.navigate(["."],{relativeTo:this.route,queryParams:Object.assign(Object.assign({},this.queryParams),n)})]:[3,2];case 1:return o.sent(),[3,4];case 2:return[4,this.router.navigate(["..","new"],{relativeTo:this.route,queryParams:Object.assign(Object.assign({},this.queryParams),n)})];case 3:o.sent(),o.label=4;case 4:return[4,this.updateRoute(t,this.queryParams)];case 5:return o.sent(),[2]}}))}))},n.prototype.updateTabIndex=function(t){Re(t)&&t>this.selectedTabIndex&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.saveAndClose=function(t,e){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.save(t)];case 1:return(e=n.sent())?[4,this.close(t)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2,e]}}))}))},n.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){if(t){if(t.defaultPrevented)return[2];t.preventDefault(),t.stopPropagation()}return[2,this.goBack()]}))}))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var t,n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?(console.debug("[data-editor] Skip save: editor is busy (loading or saving)"),[2,!1]):this.dirty?[4,this.waitWhilePending()]:(console.debug("[data-editor] Skip save: editor not dirty"),[2,!0]);case 1:if(r.sent(),this.invalid)return this.markAllAsTouched(),this.logFormErrors(),this.openFirstInvalidTab(),this.submitted=!0,[2,!1];this.markAsSaving(),this.error=void 0,this.debug&&console.debug("[data-editor] Saving data..."),r.label=2;case 2:return r.trys.push([2,7,8,9]),[4,this.getValue()];case 3:return t=r.sent(),this.disable(),[4,this.dataService.save(t,e)];case 4:return n=r.sent(),[4,this.onEntitySaved(n)];case 5:return r.sent(),[4,this.updateView(n,e)];case 6:return r.sent(),this.hasRemoteListener||this.startListenRemoteChanges(),this.submitted=!1,[2,!0];case 7:return o=r.sent(),this.submitted=!0,this.setError(o),this.selectedTabIndex=0,this.scrollToTop(),this.markAsDirty(),this.enable(),o.code===Ya&&Re(this.data.id)&&this.dataService.load(this.data.id,{fetchPolicy:"network-only"}).then((function(){console.debug("[data-editor] Data cache reloaded. User can reload page")})),[2,!1];case 8:return this.markAsSaved(),[7];case 9:return[2]}}))}))},n.prototype.saveAndGetDataIfValid=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.valid?[3,2]:[4,jo.waitWhilePending(this)];case 1:if(t.sent(),this.invalid)return this.openFirstInvalidTab(),[2,void 0];t.label=2;case 2:return this.dirty?[4,this.save(new Event("save"))]:[3,4];case 3:if(!t.sent())return[2,void 0];t.label=4;case 4:return[2,this.data]}}))}))},n.prototype.delete=function(t){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?[2,!1]:[4,Dl.askDeleteConfirmation(this.alertCtrl,this.translate)];case 1:if(!r.sent())return[2];console.debug("[data-editor] Asking to delete..."),this.markAsSaving(),this.error=void 0,r.label=2;case 2:return r.trys.push([2,7,,8]),[4,this.getValue()];case 3:return t=r.sent(),e=this.isNewData,this.disable(),e?[3,5]:[4,this.dataService.delete(t)];case 4:r.sent(),r.label=5;case 5:return[4,this.onEntityDeleted(t)];case 6:return r.sent(),this.removePageHistory(),[3,8];case 7:return n=r.sent(),this.submitted=!0,this.setError(n),this.selectedTabIndex=0,this.markAsSaved(),this.enable(),[2,!1];case 8:return[4,setTimeout((function(){return o.goBack()}),500)];case 9:return r.sent(),[2,!0]}}))}))},n.prototype.reload=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.markAsLoading(),[4,this.load(this.data&&this.data.id)];case 1:return t.sent(),[2]}}))}))},n.prototype.goBack=function(t){var e;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return(null===(e=this.toolbar)||void 0===e?void 0:e.canGoBack)?[2,this.toolbar.goBack()]:this.defaultBackHref?[2,this.router.navigateByUrl(this.defaultBackHref)]:[2,this.router.navigateByUrl("/")]}))}))},n.prototype.setError=function(t){console.error("[entity-editor] Error: "+t&&t.message||"",t);var e=t&&t.message&&this.translate.instant(t.message)||t,n=t&&t.details&&(t.details.message||t.details)||void 0;n&&(e+='<br/><small class="hidden-xs hidden-sm" title="'+n+'">',e+=n.length<70?n:n.substring(0,67)+"...",e+="</small>"),this.error=e},n.prototype.computeNextTabIndex=function(){var t=this.selectedTabIndex+1;return t<this.tabCount?t:void 0},n.prototype.unload=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.form.reset(),this.registerForms(),this._dirty=!1,this.data=null,this.saving=!1,[2]}))}))},n.prototype.onBeforeEntityLoad=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onNewEntity=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntityLoaded=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntitySaved=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntityDeleted=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.computeUsageMode=function(t){return this.settings.isUsageMode("FIELD")?"FIELD":"DESK"},n.prototype.waitWhilePending=function(t){return jo.waitWhilePending(this,t)},n.prototype.getValue=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.getJsonValueToSave()];case 1:return t=n.sent(),(e=new this.dataType).fromObject(t),[2,e]}}))}))},n.prototype.getJsonValueToSave=function(){return Promise.resolve(this.form.value)},n.prototype.updateTitle=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=t||this.data,[4,this.computeTitle(t)];case 1:return e=o.sent(),this.$title.next(e),this.isNewData?[3,3]:[4,this.computePageHistory(e)];case 2:return n=o.sent(),[2,this.addToPageHistory(n)];case 3:return[2]}}))}))},n.prototype.addToPageHistory=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return t?[2,this.settings.addToPageHistory(t,Object.assign({removePathQueryParams:!0,removeTitleSmallTag:!0,emitEvent:!1},e))]:[2]}))}))},n.prototype.computePageHistory=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,{title:t,path:this.router.url}]}))}))},n.prototype.removePageHistory=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,this.settings.removePageHistory(this.router.url,t)]}))}))},n.prototype.computePageUrl=function(t){var e=this.getParentPageUrl();return e&&e+"/"+t},n.prototype.getParentPageUrl=function(t){var e=this.defaultBackHref;return!0!==t&&e&&-1!==e.indexOf("?")&&(e=e.substr(0,e.indexOf("?"))),e},n.prototype.markForCheck=function(){this.cd.markForCheck()},n.prototype.openFirstInvalidTab=function(){var t=this.getFirstInvalidTabIndex();-1!==t&&this.selectedTabIndex!==t&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.updateRoute=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return e=this.computePageUrl(Re(t.id)?t.id:"new"),Ne(n=e&&"string"==typeof e?e.split("/"):e)?[4,this.router.navigate(n,{replaceUrl:!0,queryParams:this.queryParams})]:[3,2];case 1:return[2,o.sent()];case 2:console.warn("Skip page route update. Invalid page path: ",e),o.label=3;case 3:return[2]}}))}))},n}(fu);bu.decorators=[{type:e.Directive}],bu.ctorParameters=function(){return[{type:e.Injector},{type:Function},{type:void 0},{type:gu,decorators:[{type:e.Optional}]}]};var yu=function(t){function e(e,o,r,i,a,s,l){var c=t.call(this,e.get(z.ActivatedRoute),e.get(z.Router),e.get(M.Platform),e.get(n.Location),e.get(M.ModalController),e.get(ga),o,new nu(r,i,a,s),l,e)||this;return c.injector=e,c.columns=o,c.dataType=r,c.memoryDataService=i,c.validatorService=a,c.canEdit=!1,c.canDelete=!1,c.autoLoad=!1,c}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.memoryDataService.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){t.prototype.ngOnInit.call(this)},e.prototype.setValue=function(t,e){this.error&&(this.setError(null),this.markForCheck()),this.memoryDataService.value=t,e&&!1===e.emitEvent||this.onRefresh.emit()},e.prototype.equals=function(t,e){return this.memoryDataService.equals(t,e)},e}(pu);yu.decorators=[{type:e.Directive}],yu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:Function},{type:Vl},{type:Dt.ValidatorService},{type:eu},{type:void 0}]},yu.propDecorators={canEdit:[{type:e.Input}],canDelete:[{type:e.Input}]};var vu,Cu=5e4,Eu=50001,wu={DEBUG_DATA:"DEBUG_DATA",INBOX_MESSAGE:"INBOX_MESSAGE"};t.UserEvent=vu=function(t){function e(){return t.call(this,vu.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return"object"==typeof n.content&&(n.content=JSON.stringify(n.content)),n},e.prototype.fromObject=function(e){Object.assign(this,e),t.prototype.fromObject.call(this,e),this.creationDate=ao(e.creationDate);try{"string"==typeof e.content&&e.content.startsWith("{")&&(this.content=JSON.parse(e.content)),this.content&&"string"==typeof this.content.context&&this.content.context.startsWith("{")&&(this.content.context=JSON.parse(this.content.context))}catch(t){console.error("Error during UserEvent deserialization",t)}},e}(Wi),t.UserEvent=vu=we([Ji({typename:"UserEventVO"})],t.UserEvent);var Iu,Ou,_u={userEvent:yt.gql(Iu||(Iu=Se(["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"],["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"]))),lightUserEvent:yt.gql(Ou||(Ou=Se(["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"],["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"])))};t.UserEventFilter=function(t){function e(){var e=t.apply(this,ke(arguments))||this;return e.issuer=null,e.recipient=null,e}return Ee(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.issuer=e.issuer,this.recipient=e.recipient},e.prototype.buildFilter=function(){var e=this,n=t.prototype.buildFilter.call(this);return this.issuer&&n.push((function(t){return t.issuer===e.issuer})),this.recipient&&n.push((function(t){return t.recipient===e.recipient})),n},e}(Bl),t.UserEventFilter=we([Ji({typename:"UserEventVO"})],t.UserEventFilter);var xu,ku,Su,Au,Tu=yt.gql(xu||(xu=Se(["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ","\n"],["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ","\n"])),_u.userEvent),Ru=yt.gql(ku||(ku=Se(["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ","\n"],["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ","\n"])),_u.lightUserEvent),Pu=yt.gql(Su||(Su=Se(["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"],["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"]))),Du=yt.gql(Au||(Au=Se(["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ","\n"],["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ","\n"])),_u.userEvent),Nu=function(e){function n(t,n,o,r,i,a){var s=e.call(this,t,a)||this;return s.graphql=t,s.accountService=n,s.network=o,s.translate=r,s.toastController=i,s.environment=a,s._userEventActions=[],s._debug=!a.production,s}return Ee(n,e),n.prototype.watchAll=function(t,e,n,o,r,i){return this.watchPage({offset:t,size:e,sortBy:n,sortDirection:o},r,i)},n.prototype.watchPage=function(e,n,o){var r=this._debug&&Date.now();if(console.debug("[user-event-service] Loading user events...",n),Te((n=this.asFilter(n)).recipient)||!this.accountService.isAdmin()){var i=this.accountService.account.pubkey;i!==n.recipient&&(console.warn("[user-events-service] Force user event filter.recipient="+i),n.recipient=i)}var a=o&&!0===o.withContent;return this.mutableWatchQuery({queryName:a?"LoadAllWithContent":"LoadAll",query:a?Du:Ru,variables:{page:Object.assign(Object.assign({sortBy:"updateDate"},e),{sortDirection:(e.sortDirection||"DESC").toUpperCase()}),filter:n&&n.asPodObject()},arrayFieldName:"data",error:{code:Cu,message:"SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR"},fetchPolicy:o&&o.fetchPolicy||void 0}).pipe(N.map((function(e){var n=e&&(e.data||[]).map(t.UserEvent.fromObject);return r&&(console.debug("[user-event-service] "+n.length+" user events loaded in "+(Date.now()-r)+"ms"),r=null),{data:n,total:e&&Be(e.total,n.length)}})))},n.prototype.saveAll=function(t,e){var n=this;return Promise.all(t.map((function(t){return n.save(t,e)})))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return this.fillDefaultProperties(t),e=Ae(t.id),n=t.asObject(),o=Date.now(),this._debug&&console.debug("[user-event-service] Saving user event...",n),[4,this.graphql.mutate({mutation:Tu,variables:{data:n},error:{code:Eu,message:"SOCIAL.ERROR.SAVE_USER_EVENT_ERROR"},update:function(n,i){var a=i.data,s=a&&a.data;s&&(r._debug&&console.debug("[user-event-service] User event saved in "+(Date.now()-o)+"ms",t),r.copyIdAndUpdateDate(s,t),e&&(r.insertIntoMutableCachedQueries(n,{query:Ru,data:Object.assign(Object.assign({},s),{content:null})}),r.insertIntoMutableCachedQueries(n,{query:Du,data:s})))}})];case 1:return i.sent(),[2,t]}}))}))},n.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return Fe(e=t&&t.map((function(t){return t.id})))?[2]:(n=Date.now(),this._debug&&console.debug("[user-event-service] Deleting events... ids:",e),[4,this.graphql.mutate({mutation:Pu,variables:{ids:e},update:function(t){o.removeFromMutableCachedQueriesByIds(t,{query:Ru,ids:e}),o.removeFromMutableCachedQueriesByIds(t,{query:Du,ids:e}),o._debug&&console.debug("[user-event-service] Events deleted in "+(Date.now()-n)+"ms")}})]);case 1:return r.sent(),[2]}}))}))},n.prototype.delete=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return t?[4,this.deleteAll([t])]:[2];case 1:return e.sent(),[2]}}))}))},n.prototype.listenChanges=function(t,e){return console.warn("TODO: implement listen changes on user events"),D.of()},n.prototype.registerAction=function(t){console.info("[user-event-service] Registering action "+t.name+" for "+t.__typename),this._userEventActions.push(t)},n.prototype.getActionsByTypename=function(t){return this._userEventActions.filter((function(e){return e.__typename===t}))},n.prototype.showToastErrorWithContext=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return(e=t.message||t.error&&t.error.message||t.error)&&"string"==typeof e||(e="ERROR.UNKNOWN_TECHNICAL_ERROR"),this.network.offline?(this.showToast({message:e,type:"error"}),[2]):((e=this.translate.instant(e))&&-1!==e.indexOf("<small>")&&(e=e.substr(0,e.indexOf("<small>")-1)),[4,this.showToast({type:"error",duration:15e3,message:e+"<br/><br/><b>"+this.translate.instant("CONFIRM.SEND_DEBUG_DATA")+"</b>",buttons:[{icon:"bug",text:this.translate.instant("COMMON.BTN_SEND"),role:"send"}]})]);case 1:if(!(n=a.sent())||"send"!==n.role)return[2];a.label=2;case 2:return a.trys.push([2,6,,7]),this._debug&&console.debug("Sending debug data..."),"function"==typeof(o=t&&t.context)&&(o=o()),o instanceof Promise?[4,o]:[3,4];case 3:o=a.sent(),a.label=4;case 4:return[4,this.sendDataForDebug({message:e,error:t.error||void 0,context:this.convertObjectToString(o)})];case 5:return r=a.sent(),console.info("Debug data successfully sent to admin",r),this.showToast({type:"info",message:"INFO.DEBUG_DATA_SEND",showCloseButton:!0}),[3,7];case 6:return i=a.sent(),console.error("Error while sending debug data:",i),[3,7];case 7:return[2]}}))}))},n.prototype.sendDataForDebug=function(e){var n=new t.UserEvent;return n.eventType=wu.DEBUG_DATA,n.content=this.convertObjectToString(e),this.save(n)},n.prototype.asFilter=function(e){return t.UserEventFilter.fromObject(e)},n.prototype.convertObjectToString=function(t){return"string"==typeof t?t:"object"==typeof t?t instanceof Wi?JSON.stringify(t.asObject({keepTypename:!0,keepLocalId:!0,minify:!1})):JSON.stringify(t):void 0},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,ba.show(this.toastController,this.translate,t)];case 1:return[2,e.sent()]}}))}))},n.prototype.fillDefaultProperties=function(t){t.issuer=this.accountService.account.pubkey,console.warn("TODO: sign user event before sending")},n.prototype.copyIdAndUpdateDate=function(t,e){Qi.copyIdAndUpdateDate(t,e)},n}(Ls);Nu.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Nu(jt.ɵɵinject(Ns),jt.ɵɵinject(pl),jt.ɵɵinject(Ca),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject(me))},token:Nu,providedIn:"root"}),Nu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Nu.ctorParameters=function(){return[{type:Ns},{type:pl},{type:Ca},{type:F.TranslateService},{type:M.ToastController},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var Fu={DEBUG_DATA:{matIcon:"bug_report"},INBOX_MESSAGE:{matIcon:"mail"}},Mu=function(e){function o(t,o,r,i,a,s){var l=e.call(this,t.get(z.ActivatedRoute),t.get(z.Router),t.get(M.Platform),t.get(n.Location),t.get(M.ModalController),t.get(ga),lu.concat(["creationDate","icon","eventType","message"]).concat(cu),null,null,t)||this;return l.injector=t,l.accountService=o,l.service=r,l.entities=i,l.cd=a,l.environment=s,l.i18nColumnPrefix="SOCIAL.USER_EVENT.",l.autoLoad=!1,l.inlineEdition=!1,l.defaultSortBy="creationDate",l.defaultSortDirection="desc",l}return Ee(o,e),o.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.dateTimePattern=this.translate.instant("COMMON.DATE_TIME_PATTERN"),this.withContent=je(this.withContent,!1);var n=this.accountService.account,o=n&&n.pubkey;this.isAdmin=this.accountService.isAdmin(),this.canEdit=this.isAdmin||o===this.recipient,this.canDelete=this.canEdit,this.setDatasource(new nu(t.UserEvent,this.service,null,{prependNewElements:!1,suppressErrors:!0,dataServiceOptions:{withContent:this.withContent}}));var r=this.filter||new t.UserEventFilter;r.recipient=this.recipient,this.setFilter(r,{emitEvent:!0})},o.prototype.start=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.debug("[user-event] Starting..."),[4,this.accountService.ready()];case 1:return t.sent(),this.onRefresh.emit(),[2]}}))}))},o.prototype.getIcon=function(t){return Fu[t.eventType]},o.prototype.getDetail=function(t){if(t){if(t.content&&t.eventType===wu.DEBUG_DATA){var e=t.content.context;if(e&&e.__typename)return{actions:this.service.getActionsByTypename(e.__typename),title:t.content.error&&t.content.error.message||t.content.message,description:t.content.error&&t.content.error.details||void 0}}return console.debug("TODO: implement getDetail() for event: ",t),{}}},o.prototype.doAction=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(n=e.currentData,o=n.content&&n.content.context,this.markAsLoading(),!t||"function"!=typeof t.executeAction)return[3,7];s.label=1;case 1:return s.trys.push([1,5,6,7]),(r=t.executeAction(n,o))instanceof Promise?[4,r]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=r,s.label=4;case 4:return r=i,[3,7];case 5:return a=s.sent(),this.setError(a&&a.message||a),console.error("[user-event] Failed to execute action "+t.name+": "+(a&&a.message||a),a),[3,7];case 6:return this.markAsLoaded(),[7];case 7:return[2]}}))}))},o}(pu);Mu.decorators=[{type:e.Component,args:[{selector:"app-user-events-table",template:'\n\x3c!-- Type = options menu --\x3e\n<mat-menu #optionsMenu="matMenu" xPosition="after">\n\n \x3c!-- display columns --\x3e\n <button mat-menu-item\n (click)="openSelectColumnsModal($event)">\n <mat-icon>view_column</mat-icon>\n <ion-label translate>COMMON.DISPLAYED_COLUMNS_DOTS</ion-label>\n </button>\n\n</mat-menu>\n\n\x3c!-- top header --\x3e\n<mat-toolbar>\n\n <ng-container *ngIf="!selection.hasValue(); else hasSelection">\n\n <button mat-icon-button [title]="\'COMMON.BTN_REFRESH\'|translate" (click)="onRefresh.emit()">\n <mat-icon>refresh</mat-icon>\n </button>\n\n </ng-container>\n\n \x3c!-- if row selection --\x3e\n <ng-template #hasSelection>\n\n \x3c!-- delete --\x3e\n <button mat-icon-button class="hidden-xs hidden-sm" *ngIf="canDelete"\n [title]="\'COMMON.BTN_DELETE\'|translate" (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" hidden-xs hidden-sm hidden-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <div class="toolbar-spacer"></div>\n\n <button mat-icon-button\n [title]="\'COMMON.BTN_OPTIONS\'|translate"\n [matMenuTriggerFor]="optionsMenu">\n <mat-icon>more_vert</mat-icon>\n </button>\n</mat-toolbar>\n\n\n<mat-table [dataSource]="dataSource" matSort\n [matSortActive]="defaultSortBy"\n [matSortDirection]="defaultSortDirection"\n matSortDisableClear [trackBy]="trackByFn">\n\n \x3c!-- select --\x3e\n <ng-container matColumnDef="select">\n <mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!canEdit">\n <mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"\n [indeterminate]="selection.hasValue() && !isAllSelected()">\n </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!canEdit">\n <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">\n </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n \x3c!-- id --\x3e\n <ng-container matColumnDef="id">\n <mat-header-cell *matHeaderCellDef mat-sort-header [class.cdk-visually-hidden]="!isAdmin">\n <app-loading-spinner [loading]="loadingSubject|async"><ion-label>#</ion-label></app-loading-spinner>\n </mat-header-cell>\n <mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!isAdmin">{{ row.currentData.id | mathAbs }}</mat-cell>\n </ng-container>\n\n \x3c!-- creationDate --\x3e\n <ng-container matColumnDef="creationDate">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.CREATION_DATE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row">\n <ion-text>\n {{row.currentData.creationDate | dateFromNow }}<br/>\n <ion-text color="medium"><small>{{row.currentData.creationDate | dateFormat: {time: true} }}</small></ion-text>\n </ion-text>\n </mat-cell>\n </ng-container>\n\n \x3c!-- icon --\x3e\n <ng-container matColumnDef="icon">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <ng-container *ngIf="getIcon(row.currentData); let details">\n <ion-icon slot="start" *ngIf="details.icon" [name]="details.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="details.matIcon">{{details.matIcon}}</mat-icon>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n \x3c!-- event type --\x3e\n <ng-container matColumnDef="eventType">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.EVENT_TYPE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <span>{{\'SOCIAL.EVENT_TYPE_ENUM.\' + row.currentData.eventType | translate}}</span>\n </mat-cell>\n </ng-container>\n\n \x3c!-- message --\x3e\n <ng-container matColumnDef="message">\n <mat-header-cell *matHeaderCellDef>\n <ion-label translate>SOCIAL.USER_EVENT.MESSAGE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <ng-container *ngIf="getDetail(row.currentData); let details">\n <ion-text [innerHTML]="details.title|translate">\n </ion-text>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <ng-container matColumnDef="actions">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef="let row">\n <ng-container *ngIf="getDetail(row.currentData); let details">\n <button mat-icon-button color="light"\n *ngFor="let action of details.actions"\n [title]="action.title |translate"\n [color]="action.color"\n (click)="doAction(action, row)">\n <ion-icon slot="start" *ngIf="action.icon" [name]="action.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="action.matIcon">{{action.matIcon}}</mat-icon>\n </button>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>\n <mat-row *matRowDef="let row; columns: displayedColumns;"\n class="mat-row-disabled"\n (click)="clickRow($event, row)"></mat-row>\n\n</mat-table>\n\n<ion-row class="ion-no-padding">\n <ion-col></ion-col>\n <ion-col class="ion-no-padding" size="auto">\n <mat-paginator [length]="totalRowCount" [pageSize]="defaultPageSize" [pageSizeOptions]="defaultPageSizeOptions" showFirstLastButtons>\n </mat-paginator>\n </ion-col>\n</ion-row>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".mat-header-row .mat-column-icon,.mat-row .mat-column-icon{max-width:40px;padding-left:0}.mat-header-row .mat-column-icon ion-icon,.mat-header-row .mat-column-icon mat-icon,.mat-row .mat-column-icon ion-icon,.mat-row .mat-column-icon mat-icon{font-size:1.2em;height:1.2em;width:1.2em}.mat-header-row .mat-column-creationDate,.mat-row .mat-column-creationDate{min-width:100px;max-width:120px}"]}]}],Mu.ctorParameters=function(){return[{type:e.Injector},{type:pl},{type:Nu},{type:es},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Mu.propDecorators={recipient:[{type:e.Input}],withContent:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}]};var Lu,ju=function(){function t(){}return t.forRoot=function(){return console.debug("[social] Creating module (root)"),{ngModule:t,providers:[Nu]}},t}();ju.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Xc],declarations:[Mu],exports:[Mu]}]}],t.PersonFilter=Lu=function(t){function e(){return t.call(this,Lu.TYPENAME)||this}return Ee(e,t),e.searchFilter=function(t){return t&&Lu.fromObject(t).asFilterFn()},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.email=e.email,this.pubkey=e.pubkey,this.searchText=e.searchText,this.statusIds=e.statusIds||(Re(e.statusId)?[e.statusId]:void 0),this.userProfiles=e.userProfiles,this.excludedIds=e.excludedIds,this.searchAttribute=e.searchAttribute,this.searchAttributes=e.searchAttributes},e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return n.email=this.email,n.pubkey=this.pubkey,n.searchText=this.searchText,n.statusIds=this.statusIds,n.userProfiles=this.userProfiles,n.excludedIds=this.excludedIds,n.searchAttribute=this.searchAttribute,n.searchAttributes=this.searchAttributes,n},e.prototype.buildFilter=function(){var e=this,n=t.prototype.buildFilter.call(this);Ne(this.statusIds)&&n.push((function(t){return e.statusIds.includes(t.statusId)})),Ne(this.excludedIds)&&n.push((function(t){return Ae(t.id)||!e.excludedIds.includes(t.id)}));var o=Qi.searchTextFilter(this.searchAttribute||this.searchAttributes||["lastName","firstName","department.name"],this.searchText);return o&&n.push(o),n},e}(Bl),t.PersonFilter=Lu=we([Ji({typename:"PersonFilterVO"})],t.PersonFilter);var Bu,Uu,Vu,qu,$u,Gu={person:yt.gql(Bu||(Bu=Se(["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"],["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"])))},Hu={loadAll:yt.gql(Uu||(Uu=Se(["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ",""],["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ",""])),Gu.person),loadAllWithTotal:yt.gql(Vu||(Vu=Se(["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ",""],["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ",""])),Gu.person)},Wu={saveAll:yt.gql(qu||(qu=Se(["\n mutation savePersons($data:[PersonVOInput]){\n data: savePersons(persons: $data){\n ...PersonFragment\n }\n }\n ",""],["\n mutation savePersons($data:[PersonVOInput]){\n data: savePersons(persons: $data){\n ...PersonFragment\n }\n }\n ",""])),Gu.person),deleteAll:yt.gql($u||($u=Se(["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"],["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"])))},zu=function(e){function n(n,o,r,i){var a=e.call(this,n,o,t.Person,t.PersonFilter,{queries:Hu,mutations:Wu,defaultSortBy:"lastName",defaultSortDirection:"asc"})||this;return a.graphql=n,a.platform=o,a.network=r,a.entities=i,a._debug=!Yi.production,a}return Ee(n,e),n.prototype.loadAll=function(t,n,o,r,i,a){var s=Object.create(null,{loadAll:{get:function(){return e.prototype.loadAll}}});return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return this.network.offline&&(!a||"network-only"!==a.fetchPolicy)?[2,this.loadAllLocally(t,n,o,r,i,a)]:[2,s.loadAll.call(this,t,n,o,r,i,a)]}))}))},n.prototype.loadAllLocally=function(e,n,o,r,i,a){return Ie(this,void 0,void 0,(function(){var s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:return i=this.asFilter(i),s={offset:e||0,size:n||100,sortBy:o||this.defaultSortBy,sortDirection:r||this.defaultSortDirection,filter:i&&i.asFilterFn()},[4,this.entities.loadAll("PersonVO",s)];case 1:return l=d.sent(),c=l.data,u=l.total,[2,{data:a&&!1===a.toEntity?c||[]:(c||[]).map(t.Person.fromObject),total:u}]}}))}))},n.prototype.suggest=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(r){return gs.isNotEmpty(t)?[2,{data:[t]}]:(t="string"==typeof t&&"*"!==t&&t||void 0,n=n||e.searchAttribute||e.searchAttributes&&e.searchAttributes[0],[2,this.loadAll(0,t?10:30,n,o,Object.assign(Object.assign({},e),{searchText:t,statusIds:e&&e.statusIds||[as.ENABLE],userProfiles:e&&e.userProfiles}),{withTotal:!0})])}))}))},n.prototype.executeImport=function(t,n){var o=Object.create(null,{loadAll:{get:function(){return e.prototype.loadAll}}});return Ie(this,void 0,void 0,(function(){var e,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return e=n&&n.maxProgression||100,r={statusIds:[as.ENABLE,as.TEMPORARY],userProfiles:["SUPERVISOR","USER","GUEST"]},console.info("[person-service] Importing persons..."),[4,ql.fetchAllPages((function(t,e){return o.loadAll.call(a,t,e,"id",null,r,{debug:!1,fetchPolicy:"network-only",withTotal:0===t,toEntity:!1})}),t,{maxProgression:.9*e})];case 1:return i=s.sent(),[4,this.entities.saveAll(i.data,{entityName:"PersonVO",reset:!0})];case 2:return s.sent(),[2]}}))}))},n.prototype.asObject=function(e){if(e){console.debug("TODO check isInstanceOf"),zi(e,t.Person)||(e=t.Person.fromObject(e));var n=e.asObject();return delete n.mainProfile,n.department=e.department&&e.department.asObject(!0),n}},n}(Zc);zu.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new zu(jt.ɵɵinject(Ns),jt.ɵɵinject(Sl),jt.ɵɵinject(Ca),jt.ɵɵinject(es))},token:zu,providedIn:"root"}),zu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],zu.ctorParameters=function(){return[{type:Ns},{type:Sl},{type:Ca},{type:es}]};var Ku=function(){function e(t,e){this.formBuilder=t,this.accountValidatorService=e}return e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(e){var n=this.accountValidatorService.getFormGroupConfig(e&&t.Account.fromObject(e.asObject()));return n.pubkey=[e&&e.pubkey||null,Do.pubkey],n.username=[e&&e.username||null,P.Validators.minLength(2)],n.usernameExtranet=[e&&e.usernameExtranet||null,P.Validators.minLength(2)],n.avatar=[e&&e.avatar||null],this.formBuilder.group(n)},e}();Ku.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ku(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(_c))},token:Ku,providedIn:"root"}),Ku.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ku.ctorParameters=function(){return[{type:P.FormBuilder},{type:_c}]};var Qu=function(e){function n(n,o,r,i,a,s,l,c,u,d,p,h,m,f){var g=e.call(this,n,o,r,i,a,l,lu.concat(["avatar","lastName","firstName","email","profile","status","username","usernameExtranet","pubkey"]).concat(s.additionalFields.map((function(t){return t.key}))).concat(cu),new nu(t.Person,d,c,{prependNewElements:!1,suppressErrors:f.production,dataServiceOptions:{saveOnlyDirtyRows:!0}}),null,m)||this;return g.route=n,g.router=o,g.platform=r,g.location=i,g.modalCtrl=a,g.accountService=s,g.settings=l,g.validatorService=c,g.configService=u,g.dataService=d,g.cd=p,g.canEdit=!1,g.profiles=ke(Es).reverse(),g.filterCriteriaCount=0,g.statusList=ds,g.statusById=ps,g.useSticky=!1,g.referentialToString=ss,g.inlineEdition=s.isAdmin(),g.canEdit=s.isAdmin(),g.confirmBeforeDelete=!0,g.autoLoad=!1,g.i18nColumnPrefix="USER.",g.defaultSortBy="lastName",g.defaultSortDirection="asc",g.filterForm=h.group({searchText:[null],statusId:[null]}),g.additionalFields=(g.accountService.additionalFields||[]).filter((function(t){return Re(t.autocomplete)})).map((function(t){return t.autocomplete=g.registerAutocompleteField(t.key,Object.assign({},t.autocomplete)),t})),g.debug=!f.production,g}return Ee(n,e),Object.defineProperty(n.prototype,"showUsernameColumn",{set:function(t){this.setShowColumn("username",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"showUsernameExtranetColumn",{set:function(t){this.setShowColumn("usernameExtranet",t)},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var n=this;e.prototype.ngOnInit.call(this),this.registerSubscription(this.configService.config.subscribe((function(t){var e=t.getProperty(yl.AUTH_TOKEN_TYPE);switch(console.debug("[users] AuthTokenType="+e),e){case"basic":n.setShowColumn("pubkey",!1,{emitEvent:!1});case"basic-and-token":n.setShowColumn("username",!0,{emitEvent:!1}),n.setShowColumn("usernameExtranet",!0,{emitEvent:!1});break;case"token":n.setShowColumn("pubkey",!0,{emitEvent:!1}),n.setShowColumn("username",!1,{emitEvent:!1}),n.setShowColumn("usernameExtranet",!1,{emitEvent:!1})}n.updateColumns(),n.onRefresh.emit()}))),this.registerSubscription(this.onRefresh.subscribe((function(){n.filterForm.markAsUntouched(),n.filterForm.markAsPristine()}))),this.registerSubscription(this.filterForm.valueChanges.pipe(N.debounceTime(250),N.filter((function(){return n.filterForm.valid})),N.tap((function(e){var o=t.PersonFilter.fromObject(e);n.filterCriteriaCount=o.countNotEmptyCriteria(),n.markForCheck(),n.setFilter(o,{emitEvent:!1})})),N.debounceTime(500),N.tap((function(t){return n.settings.savePageSetting(n.settingsId,t,iu)}))).subscribe()),this.restoreFilterOrLoad()},n.prototype.applyFilterAndClosePanel=function(t){this.onRefresh.emit(t),this.filterExpansionPanel.close()},n.prototype.resetFilter=function(t){this.totalRowCount=void 0,this.filterCriteriaCount=0,this.markAsLoading(),this.filterForm.reset(),this.setFilter(null)},n.prototype.restoreFilterOrLoad=function(){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){return this.markAsLoading(),console.debug("[users] Restoring filter from settings..."),e=this.settings.getPageSettings(this.settingsId,iu)||{},n=t.PersonFilter.fromObject(e),this.filterForm.patchValue(e),this.setFilter(n,{emitEvent:!0}),[2]}))}))},n.prototype.clearControlValue=function(t,e){return t&&t.stopPropagation(),e.setValue(null),!1},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pu);Qu.decorators=[{type:e.Component,args:[{selector:"app-users-table",template:'<app-toolbar [title]="\'USER.LIST.TITLE\'|translate"\n color="primary"\n [canGoBack]="false"\n [hasValidate]="!(loadingSubject|async) && dirty"\n (onValidate)="save()">\n <ion-buttons slot="end">\n <ng-container *ngIf="!selection.hasValue(); else hasSelection">\n \x3c!-- Add --\x3e\n <button mat-icon-button\n *ngIf="canEdit && !mobile"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="addRow()">\n <mat-icon>add</mat-icon>\n </button>\n\n \x3c!-- Refresh --\x3e\n <button mat-icon-button *ngIf="!mobile"\n [title]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="onRefresh.emit()">\n <mat-icon>refresh</mat-icon>\n </button>\n\n \x3c!-- reset filter --\x3e\n <button mat-icon-button (click)="resetFilter()"\n *ngIf="filterCriteriaCount">\n <mat-icon color="accent">filter_list_alt</mat-icon>\n <mat-icon class="icon-secondary" style="left: 16px; top: 5px; font-weight: bold;">close</mat-icon>\n </button>\n\n \x3c!-- show filter --\x3e\n <button mat-icon-button (click)="filterExpansionPanel.toggle()">\n <mat-icon *ngIf="filterCriteriaCount; else emptyFilter"\n [matBadge]="filterCriteriaCount"\n matBadgeColor="accent"\n matBadgeSize="small"\n matBadgePosition="above after">filter_list_alt\n </mat-icon>\n <ng-template #emptyFilter>\n <mat-icon>filter_list_alt</mat-icon>\n </ng-template>\n </button>\n </ng-container>\n\n <ng-template #hasSelection>\n \x3c!-- delete --\x3e\n <button mat-icon-button\n class="hidden-xs hidden-sm"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n\n<ion-content class="ion-no-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="errorSubject|async ; let error" lines="none" @slideUpDownAnimation>\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- search --\x3e\n <mat-expansion-panel #filterExpansionPanel class="ion-no-padding filter-panel filter-panel-floating">\n <form class="form-container ion-padding" [formGroup]="filterForm" (ngSubmit)="onRefresh.emit()">\n <ion-grid>\n <ion-row>\n <ion-col>\n \x3c!-- search --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.LIST.FILTER.SEARCH\'|translate" formControlName="searchText">\n\n <button mat-icon-button matSuffix tabindex="-1"\n type="button"\n (click)="clearControlValue($event, filterForm.controls.searchText)"\n [hidden]="filterForm.controls.searchText.disabled || !filterForm.controls.searchText.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n \x3c!-- status --\x3e\n <mat-form-field>\n <mat-select formControlName="statusId" [placeholder]="\'USER.STATUS\'|translate">\n <mat-option [value]="null"><i><span translate>COMMON.EMPTY_OPTION</span></i></mat-option>\n <mat-option *ngFor="let item of statusList" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n\n <button mat-icon-button matSuffix tabindex="-1"\n type="button"\n (click)="clearControlValue($event, filterForm.controls.statusId)"\n [hidden]="filterForm.controls.statusId.disabled || !filterForm.controls.statusId.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n <mat-action-row>\n \x3c!-- Counter --\x3e\n <ion-label [hidden]="(loadingSubject|async) || filterForm.dirty"\n [color]="empty && \'danger\'"\n class="ion-padding">\n {{ (totalRowCount ? \'COMMON.RESULT_COUNT\' : \'COMMON.NO_RESULT\') | translate: {\n count: (totalRowCount |\n numberFormat)\n } }}\n </ion-label>\n\n <div class="toolbar-spacer"></div>\n\n \x3c!-- Close panel --\x3e\n <ion-button mat-button fill="clear" color="dark"\n (click)="filterExpansionPanel.close()"\n [disabled]="loadingSubject|async">\n <ion-text translate>COMMON.BTN_CLOSE</ion-text>\n </ion-button>\n\n \x3c!-- Search button --\x3e\n <ion-button mat-button\n [color]="filterForm.dirty ? \'tertiary\' : \'dark\'"\n [fill]="filterForm.dirty ? \'solid\' : \'clear\'"\n (click)="applyFilterAndClosePanel($event)"\n [disabled]="loadingSubject|async">\n <ion-text translate>COMMON.BTN_APPLY</ion-text>\n </ion-button>\n\n </mat-action-row>\n </mat-expansion-panel>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" visible-xs visible-sm visible-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <div class="table-container">\n <table #table mat-table matSort\n [dataSource]="dataSource"\n [matSortActive]="defaultSortBy" [matSortDirection]="defaultSortDirection"\n matSortDisableClear [trackBy]="trackByFn">\n\n <ng-container matColumnDef="select" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!inlineEdition">\n <mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"\n [indeterminate]="selection.hasValue() && !isAllSelected()">\n </mat-checkbox>\n </th>\n <td mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!inlineEdition">\n <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">\n </mat-checkbox>\n </td>\n </ng-container>\n\n \x3c!-- Id Column --\x3e\n <ng-container matColumnDef="id" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label>#</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">{{ row.currentData.id }}</td>\n </ng-container>\n\n \x3c!-- avatar Column --\x3e\n <ng-container matColumnDef="avatar" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef="let row">\n <div class="avatar" *ngIf="row.currentData.avatar; else generateIcon"\n [ngStyle]="{\'background-image\':\'url(\'+row.currentData.avatar+\')\'}"></div>\n <ng-template #generateIcon>\n <div class="avatar">\n <svg width="38" width="38" [data-jdenticon-value]="row.currentData.id"></svg>\n </div>\n </ng-template>\n </td>\n </ng-container>\n\n \x3c!-- lastName --\x3e\n <ng-container matColumnDef="lastName">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.LAST_NAME</span>\n </th>\n <td mat-cell *matCellDef="let row" (click)="focusColumn=\'lastName\'">\n <mat-form-field floatLabel="never">\n <input matInput\n [formControl]="row.validator.controls[\'lastName\']"\n [placeholder]="\'USER.LAST_NAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'lastName\'">\n <mat-error *ngIf="row.validator.controls[\'lastName\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'lastName\'].hasError(\'minlength\')">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n </td>\n\n </ng-container>\n\n \x3c!-- firstname --\x3e\n <ng-container matColumnDef="firstName">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.FIRST_NAME</span>\n </th>\n <td mat-cell *matCellDef="let row"\n\n (click)="focusColumn=\'firstName\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls[\'firstName\']"\n [placeholder]="\'USER.FIRST_NAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'firstName\'">\n <mat-error *ngIf="row.validator.controls[\'firstName\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'firstName\'].hasError(\'minlength\')">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- email --\x3e\n <ng-container matColumnDef="email">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.EMAIL</span>\n </th>\n <td mat-cell *matCellDef="let row" (click)="focusColumn=\'email\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls[\'email\']"\n [placeholder]="\'USER.EMAIL\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'email\'">\n <mat-error *ngIf="row.validator.controls[\'email\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'email\'].hasError(\'email\')">\n <span translate>ERROR.FIELD_NOT_VALID_EMAIL</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- additional fields --\x3e\n <ng-container *ngFor="let definition of additionalFields" [matColumnDef]="definition.key">\n <th mat-header-cell *matHeaderCellDef>\n <span>{{definition.label|translate}}</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=definition.key">\n <app-form-field floatLabel="never"\n [definition]="definition"\n [formControl]="row.validator.controls[definition.key]"\n [required]="definition.extra?.account?.required"\n [autofocus]="row.editing && focusColumn===definition.ke">\n </app-form-field>\n </td>\n </ng-container>\n\n \x3c!-- profile column --\x3e\n <ng-container matColumnDef="profile">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.PROFILE</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'profile\'">\n <mat-form-field floatLabel="never">\n <mat-select [formControl]="row.validator.controls[\'mainProfile\']"\n [placeholder]="\'USER.PROFILE\'|translate">\n <mat-option *ngFor="let item of profiles" [value]="item">\n {{ (\'USER.PROFILE_ENUM.\' + item) | uppercase |translate }}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="row.validator.controls[\'mainProfile\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Status column --\x3e\n <ng-container matColumnDef="status">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.STATUS</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'status\'">\n <mat-form-field floatLabel="never">\n <ion-icon matPrefix *ngIf="row.validator.controls[\'statusId\'].value >=0" [name]="statusById[row.validator.controls[\'statusId\'].value]?.icon"></ion-icon>\n\n <mat-select [formControl]="row.validator.controls[\'statusId\']"\n [placeholder]="\'REFERENTIAL.STATUS\'|translate">\n <mat-select-trigger>\n <span *ngIf="row.validator.controls[\'statusId\'].value >=0">\n {{ statusById[row.validator.controls[\'statusId\'].value]?.label | translate}}</span>\n </mat-select-trigger>\n <mat-option *ngFor="let item of statusList" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="row.validator.controls[\'statusId\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- username --\x3e\n <ng-container matColumnDef="username">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.USERNAME</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'username\'">\n <mat-form-field floatLabel="never" >\n <input matInput [formControl]="row.validator.controls.username"\n [placeholder]="\'USER.USERNAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'username\'">\n <mat-error *ngIf="row.validator.controls.username.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- username extranet --\x3e\n <ng-container matColumnDef="usernameExtranet">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.USERNAME_EXTRANET</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'usernameExtranet\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls.usernameExtranet"\n [placeholder]="\'USER.USERNAME_EXTRANET\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'usernameExtranet\'">\n <mat-error *ngIf="row.validator.controls.usernameExtranet.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- pubkey --\x3e\n <ng-container matColumnDef="pubkey">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.PUBKEY</span>\n </th>\n <td mat-cell *matCellDef="let row"\n [title]="row.validator.controls[\'pubkey\'].value"\n (click)="focusColumn=\'pubkey\'">\n <mat-form-field floatLabel="never" >\n <input matInput [formControl]="row.validator.controls[\'pubkey\']" [placeholder]="\'USER.PUBKEY\'|translate"\n [readonly]="!row.editing" autocomplete="off">\n <mat-error *ngIf="row.validator.controls[\'pubkey\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'pubkey\'].hasError(\'pubkey\')">\n <span translate>ERROR.FIELD_NOT_VALID_PUBKEY</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <app-actions-column [stickyEnd]="useSticky"\n (optionsClick)="openSelectColumnsModal($event)"\n (cancelOrDeleteClick)="cancelOrDelete($event.event, $event.row)"\n (confirmAndAddClick)="confirmAndAdd($event.event, $event.row)"\n (backward)="confirmAndBackward($event.event, $event.row)"\n (forward)="confirmAndForward($event.event, $event.row)"\n [canCancel]="false">\n </app-actions-column>\n\n <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>\n <tr mat-row *matRowDef="let row; columns: displayedColumns;"\n [class.mat-row-error]="row.validator.invalid"\n [class.mat-row-dirty]="row.currentData.dirty"\n [class.mat-row-disabled]="!row.editing"\n (click)="clickRow($event, row)"\n (keydown.escape)="escapeEditingRow($event)"\n [cdkTrapFocus]="row.validator.invalid"></tr>\n </table>\n\n <ng-container *ngIf="loadingSubject|async; else noResult">\n <ion-item>\n <ion-skeleton-text animated></ion-skeleton-text>\n </ion-item>\n </ng-container>\n\n <ng-template #noResult>\n <ion-item *ngIf="totalRowCount === 0">\n <ion-text color="danger" class="text-italic" translate>COMMON.NO_RESULT</ion-text>\n </ion-item>\n </ng-template>\n </div>\n</ion-content>\n\n<ion-footer>\n <mat-paginator class="mat-paginator-footer"\n [length]="totalRowCount" [pageSize]="defaultPageSize"\n [pageSizeOptions]="defaultPageSizeOptions" showFirstLastButtons>\n </mat-paginator>\n\n <app-form-buttons-bar *ngIf="!mobile && inlineEdition"\n (onCancel)="onRefresh.emit()" (onSave)="save()" [disabled]="(loadingSubject|async) || !dirty"></app-form-buttons-bar>\n</ion-footer>\n\n<ion-fab slot="fixed" vertical="bottom" horizontal="end" *ngIf="mobile">\n <ion-fab-button color="tertiary" (click)="addRow()">\n <ion-icon name="add"></ion-icon>\n </ion-fab-button>\n</ion-fab>\n',providers:[{provide:Dt.ValidatorService,useExisting:Ku}],animations:[na],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".mat-expansion-panel{margin-bottom:5px}.mat-expansion-panel .form-container mat-form-field{width:100%}.mat-expansion-panel mat-action-row ion-label{line-height:36px}.table-container{height:100%}.mat-table .mat-cell .avatar{height:40px;width:40px;margin:2px 0 0;background-size:cover;background-repeat:no-repeat;background-position:50%}.mat-table .mat-column-id{width:30px}.mat-table .mat-column-avatar{width:50px}.mat-table .mat-column-avatar .avatar{border-radius:5px;border:1px solid rgba(var(--ion-color-secondary-rgb),.5)}.mat-table .mat-column-firstName,.mat-table .mat-column-lastName{min-width:80px}.mat-table .mat-column-email{min-width:120px}.mat-table .mat-column-profile{min-width:110px}.mat-table .mat-column-status{min-width:130px}.mat-table .mat-column-department{min-width:150px}"]}]}],Qu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:Sl},{type:n.Location},{type:M.ModalController},{type:pl},{type:ga},{type:Dt.ValidatorService},{type:xl},{type:zu},{type:e.ChangeDetectorRef},{type:P.FormBuilder},{type:e.Injector},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Qu.propDecorators={useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}]};var Yu=function(){console.debug("[admin] Creating module")};Yu.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Xc,ju,ui,Ft.NgxJdenticonModule,F.TranslateModule.forChild()],declarations:[Qu],exports:[Qu]}]}],Yu.ctorParameters=function(){return[]};var Xu=[{path:"users",pathMatch:"full",component:Qu,canActivate:[Jc],data:{profile:"ADMIN"}}],Ju=function(){};Ju.decorators=[{type:e.NgModule,args:[{imports:[Ml,Yu,z.RouterModule.forChild(Xu)],exports:[z.RouterModule]}]}];t.APP_ABOUT_DEVELOPERS=fc,t.APP_ABOUT_PARTNERS=gc,t.APP_CONFIG_OPTIONS=_l,t.APP_FORM_ERROR_I18N_KEYS=sr,t.APP_GRAPHQL_TYPE_POLICIES=Ds,t.APP_HOME_BUTTONS=Cc,t.APP_LOCALES=rs,t.APP_LOCAL_SETTINGS=ma,t.APP_LOCAL_SETTINGS_OPTIONS=fa,t.APP_LOCAL_STORAGE_TYPE_POLICIES=ts,t.APP_MENU_ITEMS=Wc,t.APP_TESTING_PAGES=Jl,t.AboutModal=bc,t.AccountPage=xc,t.AccountService=pl,t.AccountToStringPipe=$c,t.ActionsColumnComponent=Qc,t.AdminModule=Yu,t.AdminRoutingModule=Ju,t.Alerts=Dl,t.AppEditor=mu,t.AppEditorOptions=gu,t.AppEntityEditor=bu,t.AppForm=pc,t.AppFormField=Oi,t.AppFormProvider=Lo,t.AppFormUtils=jo,t.AppGestureConfig=hi,t.AppGraphQLModule=Pc,t.AppHelpModal=Al,t.AppInMemoryTable=yu,t.AppInstallUpgradeCard=Vc,t.AppListForm=Mc,t.AppLoadingSpinner=Bi,t.AppMenuModule=Kc,t.AppNullForm=Mo,t.AppPropertiesForm=Fc,t.AppTabEditor=fu,t.AppTabEditorOptions=hu,t.AppTable=pu,t.AppTableDataSourceOptions=eu,t.AppTableUtils=tu,t.AppValidatorService=Ic,t.AppendToInputDirective=ti,t.ArrayFilterPipe=vo,t.ArrayFirstPipe=go,t.ArrayIncludesPipe=yo,t.ArrayLengthPipe=fo,t.ArrayPluckPipe=bo,t.AudioProvider=ki,t.AuthForm=hc,t.AuthGuardService=Jc,t.AuthModal=mc,t.AutocompleteTestPage=Yl,t.AutofocusDirective=dr,t.Base58=Ui,t.BaseEntityService=Zc,t.BaseGraphqlService=Ls,t.BaseGraphqlServiceOptions=Ms,t.BaseReferential=hs,t.Beans=ln,t.CORE_CONFIG_OPTIONS=yl,t.CellValueChangeListener=du,t.ChipsTestPage=ac,t.Color=Hl,t.ColorScale=Wl,t.ComponentDirtyGuard=Nl,t.ConfigService=xl,t.CoreModule=Xc,t.CryptoService=Hi,t.DATE_ISO_PATTERN=ge,t.DATE_UNIX_MS_TIMESTAMP="x",t.DATE_UNIX_TIMESTAMP="X",t.DEFAULT_PAGE_SIZE=20,t.DEFAULT_PAGE_SIZE_OPTIONS=su,t.DEFAULT_PLACEHOLDER_CHAR=be,t.DEFAULT_REQUIRED_COLUMNS=uu,t.DateDiffDurationPipe=jn,t.DateFormatPipe=Mn,t.DateFromNowPipe=Bn,t.DateTimeTestPage=oc,t.DateUtils=ro,t.DepartmentToStringPipe=Gc,t.DurationPipe=lo,t.ENTITIES_STORAGE_KEY_PREFIX=Ja,t.ENVIRONMENT=me,t.EmptyArrayPipe=mo,t.EntitiesService=jl,t.EntitiesStorage=es,t.EntitiesTableDataSource=nu,t.Entity=Wi,t.EntityClass=Ji,t.EntityClasses=Xi,t.EntityFilter=Bl,t.EntityFilterUtils=Ul,t.EntityMetadataComponent=kc,t.EntityStore=Za,t.EntityUtils=Qi,t.Environment=fe,t.ErrorCodes={LOAD_PERSONS_ERROR:100,SAVE_PERSONS_ERROR:101,DELETE_PERSONS_ERROR:102},t.EvenPipe=uo,t.FileService=Li,t.FileSizePipe=no,t.FormArrayHelper=ar,t.FormButtonsBarComponent=Ac,t.FormButtonsBarToken=Sc,t.FormErrorTranslatePipe=cr,t.FormErrorTranslator=lr,t.FormFieldValuesHolder=Ll,t.Fragments=Cl,t.GraphqlService=Ns,t.HAMMER_PRESS_TIME=pi,t.HAMMER_TAP_TIME=250,t.HighlightPipe=eo,t.HomePage=Ec,t.Hotkeys=Ai,t.HotkeysDialogComponent=Si,t.InMemoryEntitiesService=Vl,t.IsLoginAccountPipe=qc,t.IsNilOrBlankPipe=Oo,t.IsNotNilOrBlankPipe=Io,t.IsNotOnFieldModePipe=jc,t.IsOnFieldModePipe=Lc,t.JobUtils=ql,t.KEYBOARD_HIDE_DELAY_MS=ve,t.LAT_LONG_DEFAULT_MAX_DECIMALS=3,t.LAT_LONG_PATTERNS=Un,t.LatLongFormatPipe=Xn,t.LatLongTestPage=Xl,t.LatitudeFormatPipe=Jn,t.LocalSettingsService=ga,t.LongitudeFormatPipe=Zn,t.MINIFY_ENTITY_FOR_LOCAL_STORAGE=bs,t.MINIFY_ENTITY_FOR_POD=ys,t.MapGetPipe=Co,t.MapKeysPipe=Eo,t.MapValuesPipe=wo,t.MatAutocompleteConfigHolder=Pn,t.MatAutocompleteField=Fn,t.MatBooleanField=Gr,t.MatChipsField=ii,t.MatDate=Ir,t.MatDateShort=Dr,t.MatDateTime=Ar,t.MatDuration=Ur,t.MatLatLongField=yr,t.MatNumpadComponent=Xr,t.MatNumpadContainerComponent=Qr,t.MatNumpadContent=Zr,t.MatPaginatorI18n=gi,t.MatStepperI18n=Tl,t.MatSwipeField=oi,t.MaterialChipsModule=ai,t.MaterialTestingModule=cc,t.MaterialTestingPage=Zl,t.MathAbsPipe=co,t.MenuComponent=zc,t.MenuItems=yc,t.MenuService=Hc,t.ModalToolbarComponent=ji,t.NetworkService=Ca,t.NgInitDirective=Ro,t.NotEmptyArrayPipe=ho,t.NumberFormatPipe=to,t.NumpadDirective=Jr,t.OddPipe=po,t.PRIORITIZED_AUTHORITIES=Es,t.PUBKEY_REGEXP=ye,t.PersonFragments=Gu,t.PersonService=zu,t.PersonToStringPipe=Bc,t.PersonUtils=Is,t.PersonValidatorService=Ku,t.PlatformService=Sl,t.ProgressBarService=di,t.ProgressInterceptor=bi,t.PropertyGetPipe=To,t.RESERVED_END_COLUMNS=cu,t.RESERVED_START_COLUMNS=lu,t.ReferentialUtils=gs,t.RegisterConfirmPage=wc,t.SETTINGS_DISPLAY_COLUMNS=ou,t.SETTINGS_FILTER=iu,t.SETTINGS_PAGE_SIZE=au,t.SETTINGS_SORTED_COLUMN=ru,t.SETTINGS_STORAGE_KEY=da,t.SETTINGS_TRANSIENT_PROPERTIES=pa,t.SPACE_PLACEHOLDER_CHAR=" ",t.SelectPeerModal=ca,t.SettingsPage=Nc,t.SharedDirectivesModule=pr,t.SharedFormArrayValidators=Fo,t.SharedFormGroupValidators=No,t.SharedHotkeysModule=Ti,t.SharedMatAutocompleteModule=hr,t.SharedMatBooleanModule=Hr,t.SharedMatDateTimeModule=Nr,t.SharedMatDurationModule=Vr,t.SharedMatLatLongModule=vr,t.SharedMatNumpadModule=ei,t.SharedMatSwipeModule=ri,t.SharedMaterialModule=ui,t.SharedModule=Pl,t.SharedPipesModule=ur,t.SharedRoutingModule=Ml,t.SharedTestingModule=uc,t.SharedValidators=Do,t.SocialModule=ju,t.StartableService=_i,t.StatusById=ps,t.StatusIds=as,t.StatusList=ds,t.StrLengthPipe=xo,t.SwipeTestPage=ec,t.TableSelectColumnsComponent=Tc,t.ToStringPipe=_o,t.Toasts=ba,t.ToolbarComponent=fi,t.ToolbarToken=mi,t.TranslatablePipe=Ao,t.TranslateContextPipe=So,t.TranslateContextService=ko,t.UserEventService=Nu,t.UserEventTypes=wu,t.UserEventsTable=Mu,t.UsersPage=Qu,t.accountToString=Os,t.adaptValueToControl=Vo,t.addValueInArray=Wo,t.arrayDistinct=function(t,e){if(Fe(t))return t;e=e||Object.keys(t[0]);var n=new Set;return t.reduce((function(t,o){var r=ze(o,e,"|");return n.has(r)?t:(n.add(r),t.concat(o))}),[])},t.arrayGroupBy=function(t,e){return Ae(t)?null:t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{})},t.arraySize=function(t){return Ne(t)&&t.length||0},t.asInputElement=yn,t.canHaveFocus=Cn,t.capitalizeFirstLetter=rn,t.chainPromises=xn,t.changeCaseToUnderscore=Ge,t.clearValueInArray=Qo,t.copyEntity2Form=Bo,t.createPromiseEvent=An,t.createPromiseEventEmitter=Sn,t.departmentToString=vs,t.departmentsToString=Cs,t.disableControls=Ho,t.emitPromiseEvent=Tn,t.entityToString=function(t,e){return t&&t.id&&ze(t,e||["name"])||void 0},t.equals=sn,t.equalsOrNil=function(t,e){return t===e||Ae(t)&&Ae(e)},t.fadeInAnimation=Zi,t.fadeInOutAnimation=ta,t.filterFalse=function(t){return t.pipe(N.filter((function(t){return!1===t})))},t.filterNotNil=function(t){return t.pipe(N.filter(Re))},t.filterNumberInput=mn,t.filterTrue=function(t){return t.pipe(N.filter((function(t){return!0===t})))},t.firstArrayValue=function(t){return Ne(t)?t[0]:void 0},t.firstFalsePromise=On,t.firstNotNil=wn,t.firstNotNilPromise=_n,t.firstTruePromise=In,t.focusInput=fn,t.focusNextInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&bn(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=En(e,Object.assign({minTabindex:o},n));return!!Ne(r)&&(r[0].focus(),!0)},t.focusPreviousInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&bn(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=En(e,Object.assign({maxTabindex:o},n));return!!Ne(r)&&(r[r.length-1].focus(),!0)},t.formatLatitude=Gn,t.formatLongitude=Hn,t.fromDateISOString=ao,t.fromScrollEndEvent=Rn,t.fromUnixMsTimestamp=function(t){return oo(t,"x")},t.fromUnixTimestamp=function(t){return oo(t,"X")},t.getCaretPosition=pn,t.getColorContrast=wi,t.getColorShade=function(t){return Ei("#000000",t,12)},t.getColorTint=function(t){return Ei("#ffffff",t,10)},t.getConnectionType=function(t){switch(t){case ut.Connection.NONE:return"none";case ut.Connection.ETHERNET:return"ethernet";case ut.Connection.WIFI:return"wifi";case ut.Connection.CELL:case ut.Connection.CELL_2G:case ut.Connection.CELL_3G:case ut.Connection.CELL_4G:return"cell";case ut.Connection.UNKNOWN:return"unknown";default:return"ethernet"}},t.getControlFromPath=Go,t.getFocusableInputElements=En,t.getFormErrors=$o,t.getFormValueFromEntity=Uo,t.getProperty=tn,t.getPropertyByPath=Ze,t.getPropertyByPathAsString=en,t.getRandomImage=vc,t.hexToRgb=function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},t.hexToRgbArray=vi,t.isControlHasInput=or,t.isEmptyArray=Fe,t.isInputElement=bn,t.isInstanceOf=zi,t.isInt=Ye,t.isNil=Ae,t.isNilOrBlank=Te,t.isNilOrNaN=function(t){return null==t||"number"==typeof t&&isNaN(t)},t.isNotEmptyArray=Ne,t.isNotNil=Re,t.isNotNilOrBlank=Pe,t.isNotNilOrNaN=De,t.isNotNilString=Me,t.isNumber=function(t){return Re(t)&&Xe.test(t)},t.isNumberRange=function(t){return Re(t)&&Je.test(t)},t.joinProperties=function(t,e,n){if(!t)throw new Error("Could not display an undefined entity.");return e.map((function(e){return tn(t,e)})).filter(Pe).join(n||" - ")},t.joinPropertiesPath=ze,t.logFormErrors=qo,t.markAllAsTouched=Yo,t.markAsUntouched=tr,t.markControlAsTouched=Jo,t.markFormGroupAsTouched=Xo,t.matchUpperCase=Ve,t.mergeLoadResult=function(t,e){var n,o,r;return{data:(n=t.data||[]).concat.apply(n,ke(e.data)),total:(t.total||(null===(o=t.data)||void 0===o?void 0:o.length)||0)+(e.total||(null===(r=e.data)||void 0===r?void 0:r.length)||0)}},t.mixHex=Ei,t.moveInputCaretToSeparator=hn,t.noTrailingSlash=qe,t.notNilOrDefault=function(t,e){return null!=t?t:e},t.nullIfUndefined=Le,t.parseLatitudeOrLongitude=Qn,t.propertiesPathComparator=Ke,t.propertyComparator=function(t,e){return function(n,o){var r=void 0!==n[t]?n[t]:e,i=o[t]?o[t]:e;return r===i?0:r>i?1:-1}},t.propertyPathComparator=function(t){return function(e,n){var o=Ze(e,t),r=Ze(n,t);return o===r?0:o>r?1:-1}},t.referentialToString=ss,t.referentialsToString=function(t,e,n){return(t||[]).map((function(t){return ss(t,e)})).join(n||", ")},t.remove=function(t,e){return t.slice().find((function(n,o){return!!e(n)&&(t.splice(o,1),!0)}))},t.removeAll=function(t,e){var n=0;return t.slice().map((function(o,r){return e(o)?(n++,t.splice(r-n+1,1)[0]):null})).filter(Re)},t.removeDiacritics=He,t.removeDuplicatesFromArray=function(t,e){return Fe(t)?t:e?t.filter((function(t,n,o){return o.findIndex((function(n){return n&&t&&n[e]===t[e]}))===n})):t.filter((function(t,e,n){return n.findIndex((function(e){return e&&t&&e===t}))===e}))},t.removeEnd=$e,t.removeValueInArray=Ko,t.replaceAll=function(t,e,n){for(;t&&-1!==t.indexOf(e);)t=t.replace(e,n);return t},t.resetCalculatedValue=ir,t.resizeArray=zo,t.rgbArrayToHex=yi,t.rgbToHex=function(t,e,n){return"#"+Ci(t)+Ci(e)+Ci(n)},t.round=on,t.scrollFactory=Rl,t.selectInputContent=un,t.selectInputRange=dn,t.setCalculatedValue=rr,t.setTabIndex=gn,t.sleep=nn,t.slideInOutAnimation=ea,t.slideUpDownAnimation=na,t.sort=function(t,e,n){if(Fe(t))return t;var o=n?new Intl.Collator(void 0,n).compare:function(t,e){return t===e?0:t>e?1:-1};return t.slice().sort((function(t,n){return o(t[e],n[e])}))},t.splitById=an,t.splitByProperty=function(t,e){return(t||[]).reduce((function(t,n){var o=null==n?void 0:n[e];return Re(o)&&(t[o]=n),t}),{})},t.startsWithUpperCase=Ue,t.suggestFromArray=We,t.suggestFromStringArray=function(t,e,n){return Te(e="string"==typeof e&&"*"!==e&&e.toUpperCase()||void 0)?t:-1!==e.indexOf("*")?(e=e.replace("*",".*"),t.filter((function(t){return Ve(t,e)}))):t.filter((function(t){return Ue(t,e)}))},t.tabindexComparator=vn,t.toBoolean=je,t.toDateISOString=io,t.toDuration=so,t.toFloat=function(t,e){return null!=t?parseFloat(t):e},t.toInt=function(t,e){return null!=t?parseInt(t,0):e},t.toNotNil=function(t,e){return null!=t?t:e},t.toNumber=Be,t.trimEmptyToNull=function(t){var e=t&&t.trim()||void 0;return e&&e.length&&e||null},t.uncapitalizeFirstLetter=function(t){return t&&0!==t.length?t.substr(0,1).toLowerCase()+t.substr(1):t},t.updateValueAndValidity=Zo,t.waitFor=kn,t.waitIdle=nr,t.waitWhilePending=er,t["ɵ0"]=Br,t["ɵa"]=Fl,t["ɵb"]=Yr,t["ɵc"]=li,t["ɵd"]=si,t["ɵe"]=cn,t["ɵf"]=sc,t["ɵg"]=Rc,t["ɵh"]=_c,t["ɵi"]=dc,t["ɵj"]=Oc,t["ɵk"]=Dc,t["ɵl"]=Yc,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
24
|
+
var no=function(){function t(){this.units=["bytes","KB","MB","GB","TB","PB"]}return t.prototype.transform=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=2),isNaN(parseFloat(String(t)))||!isFinite(t))return"?";for(var n=0;t>=1024;)t/=1024,n++;return t.toFixed(+e)+" "+this.units[n]},t}();no.decorators=[{type:e.Pipe,args:[{name:"fileSize"}]}];var oo=Ht,ro=function(){function t(){this.toDateISOString=io,this.fromDateISOString=ao,this.toDuration=so}return t.min=function(t,e){return t&&e&&t.isSameOrBefore(e)?t:e},t.max=function(t,e){return t&&(!e||t.isSameOrAfter(e))?t:e},t.equals=function(e,n){return t.isSame(e,n)},t.isSame=function(t,e,n){var o=ao(t),r=ao(e);return!o&&!r||o.isSame(r,n)},t}();function io(t){if(t)return"string"==typeof t&&-1===t.indexOf("+")&&t.lastIndexOf("Z")===t.length-1?t:(t=ao(t))&&t.toISOString()||void 0}function ao(t){if(!t||L.isMoment(t))return t;var e=oo(t,ge);if(e.isValid())return e;if("string"==typeof t){if(console.warn("Wrong date format - Trying to convert from local time: "+t),10===t.length)return oo(t,"X");if(13===t.length)return oo(t,"x")}console.warn("Unable to parse date: "+t)}function so(t,e){if(t){var n=oo.duration(t,e);return n.milliseconds()>=990&&n.add(1e3-n.milliseconds(),"ms"),n.seconds()>=59&&n.add(60-n.seconds(),"s"),n}}var lo=function(){function t(t){this.translate=t,this.dayUnit=t.instant("COMMON.DAY_UNIT")}return t.prototype.transform=function(t,e){if(!t)return"";var n=so(t,e&&e.unit||"hours"),o=n.days(),r=n.hours().toString().padStart(2,"0"),i=n.minutes().toString().padStart(2,"0");return(o>0?o.toString()+(this.dayUnit+" "):"")+r+":"+i},t}();lo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new lo(jt.ɵɵinject($t.TranslateService))},token:lo,providedIn:"root"}),lo.decorators=[{type:e.Pipe,args:[{name:"duration"}]},{type:e.Injectable,args:[{providedIn:"root"}]}],lo.ctorParameters=function(){return[{type:F.TranslateService}]};var co=function(){function t(){}return t.prototype.transform=function(t){return null!=t?Math.abs(t):t},t}();co.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new co},token:co,providedIn:"root"}),co.decorators=[{type:e.Pipe,args:[{name:"mathAbs"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var uo=function(){function t(){}return t.prototype.transform=function(t){return t%2==0},t}();uo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new uo},token:uo,providedIn:"root"}),uo.decorators=[{type:e.Pipe,args:[{name:"even"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var po=function(){function t(){}return t.prototype.transform=function(t){return t%2!=0},t}();po.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new po},token:po,providedIn:"root"}),po.decorators=[{type:e.Pipe,args:[{name:"odd"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ho=function(){function t(){}return t.prototype.transform=function(t){return null!=t&&t.length>0},t}();ho.decorators=[{type:e.Pipe,args:[{name:"isNotEmptyArray"}]}];var mo=function(){function t(){}return t.prototype.transform=function(t){return null==t||0===t.length},t}();mo.decorators=[{type:e.Pipe,args:[{name:"isEmptyArray"}]}];var fo=function(){function t(){}return t.prototype.transform=function(t,e){e=e||{};var n=null==t?0:t.length;return Re(e.lessThan)?n<e.lessThan:Re(e.greaterThan)?n>e.greaterThan:!!Re(e.equals)&&n===e.equals},t}();fo.decorators=[{type:e.Pipe,args:[{name:"isArrayLength"}]}];var go=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length>0?t[0]:void 0},t}();go.decorators=[{type:e.Pipe,args:[{name:"arrayFirst"}]}];var bo=function(){function t(){}return t.prototype.transform=function(t,e){return!0!==e.omitNil?(t||[]).map((function(t){return t&&t[e.property]})):(t||[]).map((function(t){return t&&t[e.property]})).filter(Re)},t}();bo.decorators=[{type:e.Pipe,args:[{name:"arrayPluck"}]}];var yo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.includes(e)||!1},t}();yo.decorators=[{type:e.Pipe,args:[{name:"arrayIncludes"}]}];var vo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.filter(e)},t}();vo.decorators=[{type:e.Pipe,args:[{name:"arrayFilter"}]}];var Co=function(){function t(){}return t.prototype.transform=function(t,e){if(!t)return null;var n=e&&"object"==typeof e?e.key:e;return n?t[n]:null},t}();Co.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Co},token:Co,providedIn:"root"}),Co.decorators=[{type:e.Pipe,args:[{name:"mapGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Eo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.keys(t):null},t}();Eo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Eo},token:Eo,providedIn:"root"}),Eo.decorators=[{type:e.Pipe,args:[{name:"mapKeys"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var wo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.values(t):null},t}();wo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new wo},token:wo,providedIn:"root"}),wo.decorators=[{type:e.Pipe,args:[{name:"mapValues"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Io=function(){function t(){}return t.prototype.transform=function(t){return Pe(t)},t}();Io.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Io},token:Io,providedIn:"root"}),Io.decorators=[{type:e.Pipe,args:[{name:"isNotNilOrBlank"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Oo=function(){function t(){}return t.prototype.transform=function(t){return Te(t)},t}();Oo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Oo},token:Oo,providedIn:"root"}),Oo.decorators=[{type:e.Pipe,args:[{name:"isNilOrBlank"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var _o=function(){function t(){}return t.prototype.transform=function(t){return null!=t?t.toString():""},t}();_o.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new _o},token:_o,providedIn:"root"}),_o.decorators=[{type:e.Pipe,args:[{name:"toString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var xo=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length||0},t}();xo.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new xo},token:xo,providedIn:"root"}),xo.decorators=[{type:e.Pipe,args:[{name:"strLength"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ko=function(){function t(t){this.translate=t}return t.prototype.get=function(t,e,n){var o=this;if(!t||!Ae(e))return this.translate.get(t,n);var r=this.contextualKeys(t,e);return this.translate.get(r,n).pipe(N.map((function(t){return o.findFirstValid(r,t)})))},t.prototype.instant=function(t,e,n){if(!t||Te(e))return this.translate.instant(t,n);var o=this.contextualKeys(t,e),r=this.translate.instant(o,n);return this.findFirstValid(o,r)},t.prototype.contextualKeys=function(t,e){var n=this;return e.split(".").filter(Pe).reduce((function(t,e){var n=t.length>0?t[t.length-1]+".":"";return t.concat(n+e)}),[]).reverse().map((function(e){return n.contextualKey(t,e)})).concat(t)},t.prototype.contextualKey=function(t,e){e.endsWith(".")||(e+=".");var n=t.split(".");return 1===n.length?""+e+t:n.slice(0,n.length-1).concat(e+n[n.length-1]).join(".")},t.prototype.findFirstValid=function(t,e){var n,o;try{for(var r=_e(t),i=r.next();!i.done;i=r.next()){var a=i.value;if(e[a]!==a)return e[a]}}catch(t){n={error:t}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(n)throw n.error}}return e[t[t.length-1]]},t}();ko.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ko(jt.ɵɵinject($t.TranslateService))},token:ko,providedIn:"root"}),ko.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ko.ctorParameters=function(){return[{type:F.TranslateService}]};var So=function(){function t(t){this.translate=t}return t.prototype.transform=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!t||!t.length)return t;var o=e&&e.length?e[0]:"";return e=o&&e.slice(1),this.translate.instant(t,o,e)},t}();So.decorators=[{type:e.Injectable},{type:e.Pipe,args:[{name:"translateContext"}]}],So.ctorParameters=function(){return[{type:ko}]};var Ao=function(){function t(){}return t.prototype.transform=function(t){var e;return null===(e=Ge(t))||void 0===e?void 0:e.toUpperCase()},t}();Ao.decorators=[{type:e.Pipe,args:[{name:"translatable"}]},{type:e.Injectable}];var To=function(){function t(){}return t.prototype.transform=function(t,e){return Ze(t,e&&("string"==typeof e?e:e.key),e&&e.defaultValue)},t}();To.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new To},token:To,providedIn:"root"}),To.decorators=[{type:e.Pipe,args:[{name:"propertyGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Ro=function(){function t(){this.ngInit=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.ngInit.emit()},t}();Ro.decorators=[{type:e.Directive,args:[{selector:"[ngInit]"}]}],Ro.propDecorators={ngInit:[{type:e.Output}]};var Po=Ht,Do=function(){function t(){}return t.getDoubleRegexp=function(t){if(Ae(t))return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;if(t<0)throw new Error("Invalid maxDecimals value: "+t);var e=this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t];return e||(this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t]=new RegExp("^[-]?[0-9]+([.,][0-9]{1,"+t+"})?$"),this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[t])},t.validDate=function(t){var e=t.value,n=!e||Po.isMoment(e)?e:Po(t.value,ge);return n&&(!n.isValid()||n.year()<1970)?{validDate:!0}:null},t.latitude=function(t){var e=t.value;return Re(e)&&(e<-90||e>90)?{latitude:!0}:null},t.longitude=function(t){var e=t.value;return Re(e)&&(e<-180||e>180)?{longitude:!0}:null},t.object=function(t){var e=t.value;return e&&"object"!=typeof e?{object:!0}:null},t.entity=function(t){var e=t.value;return!e||"object"==typeof e&&void 0!==e.id&&null!==e.id?null:{entity:!0}},t.empty=function(t){return Pe(t.value)?{empty:!0}:null},t.pubkey=function(t){var e=t.value;return!e||"string"==typeof e&&ye.test(e)?null:{pubkey:!0}},t.integer=function(t){if(Te(t.value))return null;var e=parseFloat(t.value);return isNaN(e)||(0|e)!==e?{integer:!0}:null},t.double=function(t){var e=this.getDoubleRegexp(null==t?void 0:t.maxDecimals);return function(n){var o=n.value;return Number.isNaN(o)?null:Re(o)&&""!==o&&!e.test(o)?{maxDecimals:{maxDecimals:null==t?void 0:t.maxDecimals}}:null}},t.dateIsAfter=function(t,e,n){return function(o){var r=ao(o.value);return Re(r)&&Re(t)&&r.isSameOrBefore(t,n)?{dateIsAfter:{minDate:e}}:null}},t.dateRangeEnd=function(e,n){var o=n?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i,a=null===(i=n.parent)||void 0===i?void 0:i.get(e);if(!a)return console.warn("Cannot find brother control '"+e+"' in the parent form"),null;var s=ao(a.value),l=ao(n.value);return Re(l)&&Re(s)&&l.isSameOrBefore(s)?r:(t.clearError(n,o),null)}},t.dateRangeStart=function(e,n){var o=n?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i,a=null===(i=n.parent)||void 0===i?void 0:i.get(e);if(!a)return console.warn("Cannot find control '"+e+"' in the parent form"),null;var s=ao(a.value),l=ao(n.value);return Re(l)&&Re(s)&&l.isSameOrAfter(s)?r:(t.clearError(n,o),null)}},t.copyParentErrors=function(t){return function(e){if(e.errors)return null;var n=e.parent&&e.parent.errors;return!n||Fe(t)?n:Object.keys(n).reduce((function(e,o){return t.includes(o)&&(e[o]=n[o]),e}),{})}},t.clearError=function(t,e){if(t.hasError(e)){var n=t.errors;n&&n[e]&&(1===Object.getOwnPropertyNames(n).length?t.setErrors(null):(delete n[e],t.setErrors(n)))}},t}();Do._REGEXP_CACHE={DOUBLE_BY_MAX_DECIMALS:{NO_LIMIT:/^[-]?[0-9]+([.,][0-9]*)?$/,1:/^[-]?[0-9]+([.,][0-9])?$/,2:/^[-]?[0-9]+([.,][0-9]{1,2})?$/,3:/^[-]?[0-9]+([.,][0-9]{1,2})?$/}},Do.I18N_ERROR_KEYS={required:"ERROR.FIELD_REQUIRED",min:"ERROR.FIELD_MIN",max:"ERROR.FIELD_MAX",minlength:"ERROR.FIELD_MIN_LENGTH",maxlength:"ERROR.FIELD_MAX_LENGTH",pubkey:"ERROR.FIELD_NOT_VALID_PUBKEY",validDate:"ERROR.FIELD_NOT_VALID_DATE",dateIsAfter:"ERROR.FIELD_NOT_VALID_DATE_AFTER",dateRange:"ERROR.FIELD_NOT_VALID_DATE_RANGE",dateMinDuration:"ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION",dateMaxDuration:"ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION",maxDecimals:"ERROR.FIELD_MAXIMUM_DECIMALS",integer:"ERROR.FIELD_NOT_VALID_INTEGER",email:"ERROR.FIELD_NOT_VALID_EMAIL",latitude:"ERROR.FIELD_NOT_VALID_LATITUDE",longitude:"ERROR.FIELD_NOT_VALID_LONGITUDE",pattern:"ERROR.FIELD_NOT_VALID_PATTERN",unique:"ERROR.FIELD_NOT_UNIQUE",entity:"ERROR.FIELD_INVALID"};var No=function(){function t(){}return t.dateRange=function(t,e,n){var o=Pe(n)?"msg":"dateRange",r=n?{msg:n}:{dateRange:!0};return function(n){var i=ao(n.get(t).value),a=n.get(e),s=ao(a.value);return Re(i)&&Re(s)&&i.isAfter(s)?(a.markAsPending(),a.setErrors(Object.assign(Object.assign({},a.errors),r)),r):(Do.clearError(a,o),null)}},t.dateMaxDuration=function(t,e,n,o){var r={dateMaxDuration:!0};return function(i){var a=ao(i.get(t).value),s=i.get(e),l=ao(s.value);return Re(a)&&Re(l)&&Math.abs(a.diff(l,o))>n?(s.markAsTouched({onlySelf:!0}),s.markAsPending(),s.setErrors(Object.assign(Object.assign({},s.errors),r)),r):(Do.clearError(s,"dateMaxDuration"),null)}},t.dateMinDuration=function(t,e,n,o){return function(r){var i=r.get(e),a=ao(r.get(t).value),s=ao(i.value);if(Re(a)&&Re(s)&&Math.abs(a.diff(s,o))<n){var l=i.errors||{};return l.dateMinDuration=!0,i.setErrors(l),i.markAsTouched({onlySelf:!0}),{dateMinDuration:!0}}return Do.clearError(i,"dateMinDuration"),null}},t.requiredIf=function(t,e){return function(n){var o=n.get(t),r=e instanceof P.AbstractControl?e:n.get(e);if(!r)throw new Error("Unable to find field to check!");if(Te(o.value)&&Pe(r.value)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Do.clearError(o,"required"),null}},t.requiredIfTrue=function(t,e){return function(n){var o=n.get(t),r=e instanceof P.AbstractControl?e:n.get(e);if(!r)throw new Error("Unable to find field to check!");if(Te(o.value)&&je(r.value,!1)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Do.clearError(o,"required"),null}},t.requiredIfEmpty=function(t,e){return function(n){var o=n.get(t);if(Te(o.value)&&Te(n.get(e).value)){var r={required:!0};return o.setErrors(r),o.markAsTouched({onlySelf:!0}),r}return Do.clearError(o,"required"),null}},t.propagateIfDirty=function(t,e,n){return function(o){var r=o.get(t),i=o.get(e);return r.dirty&&i.value!==n&&i.setValue(n),null}},t.prototype.first=function(t){return function(e){return t.filter(Re).map((function(t){return t(e)})).find(Re)||null}},t}(),Fo=function(){function t(){}return t.uniqueEntity=function(t){return function(e){var n,o,r=[];if(e.length){try{for(var i=_e(e.controls),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.controls[t]){var l=s.controls[t].value;l&&l.id&&r.push(s.controls[t])}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}var c=r.reduce((function(t,e){var n=e.value.id;return t[n]?t[n]++:t[n]=1,t}),{}),u={uniqueEntity:!0},d=!1;if(r.filter((function(t){return c[t.value.id]>1})).forEach((function(t){var e=t.errors||{};e=Object.assign(Object.assign({},e),u),t.setErrors(e),t.markAsTouched({onlySelf:!0}),d=!0})),d)return u}return r.forEach((function(t){return Do.clearError(t,"uniqueEntity")})),null}},t.requiredArrayMinLength=function(t){return t=t||1,function(e){return!e||e.length<t?{required:!0}:null}},t.validSumMaxValue=function(t,e){return function(n){var o,r,i=[];if(n.length){try{for(var a=_e(n.controls),s=a.next();!s.done;s=a.next()){var l=s.value;l.controls[t]&&De(l.controls[t].value)&&i.push(l.controls[t])}}catch(t){o={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}if(i.reduce((function(t,e){return t+e.value}),0)>e){var c={sumMaxValue:!0};return i.forEach((function(t){var e=t.errors||{};e=Object.assign(Object.assign({},e),c),t.setErrors(e),t.markAsTouched({onlySelf:!0})})),c}}return i.forEach((function(t){return Do.clearError(t,"sumMaxValue")})),null}},t}(),Mo=function(){function t(){this.invalid=!1,this.valid=!1,this.dirty=!1,this.empty=!0,this.pending=!1,this.error=null,this.enabled=!1,this.loading=!1}return Object.defineProperty(t.prototype,"disabled",{get:function(){return!this.enabled},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){},t.prototype.enable=function(t){},t.prototype.markAsPristine=function(t){},t.prototype.markAsUntouched=function(t){},t.prototype.markAsTouched=function(t){},t.prototype.markAllAsTouched=function(t){},t.prototype.markAsDirty=function(t){},t.prototype.markAsLoading=function(t){},t.prototype.markAsLoaded=function(t){},t.prototype.markAsReady=function(t){},t.prototype.waitIdle=function(t){return Promise.reject(!1)},t.prototype.ready=function(){return Promise.reject(!0)},t}(),Lo=function(){function t(t){this.getterFn=t}return Object.defineProperty(t.prototype,"delegate",{get:function(){return this.getterFn()||t.NULL_FORM},enumerable:!1,configurable:!0}),t.prototype.waitDelegate=function(t){var e,n=this;return kn((function(){return!!(e=n.getterFn())}),t).then((function(t){return e}))},Object.defineProperty(t.prototype,"enabled",{get:function(){return this.delegate.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.delegate.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error",{get:function(){return this.delegate.error},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){return this.delegate.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.delegate.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.delegate.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this.delegate.empty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){return this.delegate.pending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this.delegate.loading},enumerable:!1,configurable:!0}),t.prototype.ready=function(){return this.delegate.ready()},t.prototype.waitIdle=function(t){return this.delegate.waitIdle()},t.prototype.disable=function(t){return this.delegate.disable(t)},t.prototype.enable=function(t){return this.delegate.enable(t)},t.prototype.markAsPristine=function(t){return this.delegate.markAsPristine(t)},t.prototype.markAsUntouched=function(t){return this.delegate.markAsUntouched(t)},t.prototype.markAsTouched=function(t){return this.delegate.markAsTouched(t)},t.prototype.markAllAsTouched=function(t){return this.delegate.markAllAsTouched(t)},t.prototype.markAsDirty=function(t){return this.delegate.markAsDirty(t)},t.prototype.markAsLoading=function(t){return this.delegate.markAsLoading(t)},t.prototype.markAsLoaded=function(t){return this.delegate.markAsLoaded(t)},t.prototype.markAsReady=function(t){return this.delegate.markAsReady(t)},t}();Lo.NULL_FORM=new Mo;var jo=function(){function t(){}return t.isForm=function(t){return t instanceof Lo||"dirty"in t&&"enabled"in t&&"valid"in t},t}();function Bo(t,e,n){var o=Uo(t,e);e.patchValue(o,n)}function Uo(t,e){return Vo(t,e)}function Vo(t,e,n){var o=n?n+".":"";if(e instanceof P.FormGroup){var r={};for(var i in e.controls)r[i]=Vo(t&&t[i],e.controls[i],o+i);return r}if(e instanceof P.FormArray){if("string"==typeof t&&(t=t.split("|")),!Array.isArray(t)||0===e.length)return Ne(t)&&console.warn("WARN: please resize the FormArray '"+n+"' to the same length of the input array"),[];var a=e.at(0);if((r=t.map((function(t,e){return Vo(t,a,o+"#"+e)}))).length>e.length)if(a instanceof P.FormControl)for(var s=e.length;s<r.length;s++)e.push(new P.FormControl(null,a.validator));else console.warn("WARN: please resize the FormArray '"+(n||"")+"' to the same length of the input array"),r=r.slice(0,e.length);else if(r.length<e.length)for(s=r.length;s<e.length;s++)r.push(null);return r}if(e instanceof P.FormControl)return L.isMoment(t)?io(t):Le(t)}function qo(t,e,n){t&&!t.valid&&(e=e||"",t instanceof P.FormGroup?(n||console.warn(e+" Form errors:"),t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})),t.controls&&Object.keys(t.controls).forEach((function(o){return qo(t.controls[o],e,n?n+"/"+o:o)}))):t instanceof P.FormArray?(t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})),t.controls.forEach((function(t,o){qo(t,e,n?n+"#"+o:"#"+o)}))):t.errors&&Object.keys(t.errors).forEach((function(t){return console.warn(e+" -> "+(n||"")+" ("+t+")")})))}function $o(t,e){if(t&&!t.valid){if((e=e||{}).result=e.result||{},t instanceof P.FormGroup){if(t.errors&&(e.controlName?e.result[e.controlName]=Object.assign({},t.errors):e.result=Object.assign(Object.assign({},e.result),t.errors)),!e||!1!==e.recursive)for(var n in t.controls){var o=t.controls[n];o&&o.enabled&&$o(o,Object.assign(Object.assign({},e),{controlName:e.controlName?[e.controlName,n].join("."):n,result:e.result}))}}else t instanceof P.FormArray?t.controls.forEach((function(t,n){$o(t,Object.assign(Object.assign({},e),{controlName:(e.controlName||"")+"#"+n,result:e.result}))})):t.errors&&(e.controlName?e.result[e.controlName]=Object.assign({},t.errors):e.result=Object.assign(Object.assign({},e.result),t.errors));return e.result}}function Go(t,e){var n=e.indexOf(".");if(-1===n)return t.controls[e];var o=e.substring(0,n);if(t.controls[o]instanceof P.FormGroup)return Go(t.controls[o],e.substring(n+1));throw new Error("Invalid form path: '"+o+"' should be a form group.")}function Ho(t,e,n){(e||[]).forEach((function(e){var o=jo.getControlFromPath(t,e);o&&o.disable(n)}))}function Wo(t,e,n,o,r,i){i=i||{emitEvent:!0};var a=!1,s=-1;if(o(r)||(s=(t.value||[]).findIndex((function(t){return n(r,t)}))),-1===s&&t.length&&o(t.at(t.length-1).value)&&(s=t.length-1),-1!==s)o(r)||(t.at(s).patchValue(r,i),a=!0);else{var l=e(r);t.push(l),a=!0}return a&&(Ae(i.emitEvent)||i.emitEvent)&&(o(r)||t.markAsDirty()),a}function zo(t,e,n){var o=t.length!==n;if(t.length<n)for(;t.length<n;)t.push(e());else if(t.length>n)for(;t.length>n;)t.removeAt(t.length-1);return o}function Ko(t,e,n){return t.removeAt(n),t.markAsDirty(),!0}function Qo(t,e,n){var o=t.at(n);return!e(o.value)&&(o instanceof P.FormGroup?jo.copyEntity2Form({},o):o instanceof P.FormArray?o.setValue([]):o.setValue(null),t.markAsDirty(),!0)}function Yo(t,e){t&&(t instanceof P.FormGroup?Xo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t instanceof P.FormArray?(t.markAsTouched({onlySelf:!0}),(t.controls||[]).forEach((function(t){return Jo(t,Object.assign(Object.assign({},e),{onlySelf:!0}))}))):(t.markAsTouched({onlySelf:!0}),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))))}function Xo(t,e){t&&(t.markAsTouched(e),Object.keys(t.controls).map((function(e){return t.controls[e]})).filter((function(t){return t.enabled})).forEach((function(t){return Jo(t,e)})),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0})))}function Jo(t,e){t&&(t instanceof P.FormGroup?Yo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t instanceof P.FormArray?(t.controls||[]).forEach((function(t){return Jo(t,Object.assign(Object.assign({},e),{onlySelf:!0}))})):(t.markAsTouched({onlySelf:!0}),t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))))}function Zo(t,e){t&&(t.updateValueAndValidity(e),Object.keys(t.controls).map((function(e){return t.controls[e]})).filter((function(t){return t.enabled})).forEach((function(t){t instanceof P.FormGroup?Zo(t,Object.assign(Object.assign({},e),{onlySelf:!0})):t.updateValueAndValidity(Object.assign(Object.assign({},e),{onlySelf:!0}))})))}function tr(t,e){t&&(t.markAsUntouched(e),Object.getOwnPropertyNames(t.controls).forEach((function(e){var n=t.get(e);n instanceof P.FormGroup?tr(n,{onlySelf:!0}):(n.markAsUntouched({onlySelf:!0}),n.setErrors(null))})))}function er(t,e){return kn((function(){return!0!==t.pending}),e)}function nr(t,e){return kn((function(){return!0!==t.loading}),e)}function or(t,e){return t[e].value&&!je(t[e+jo.calculatedSuffix].value,!1)}function rr(t,e,n){t[e].setValue(on(n)),t[e+jo.calculatedSuffix].setValue(!0)}function ir(t,e){jo.isControlHasInput(t,e)||jo.setCalculatedValue(t,e,void 0)}jo.copyEntity2Form=Bo,jo.getFormValueFromEntity=Uo,jo.logFormErrors=qo,jo.getControlFromPath=Go,jo.filterNumberInput=mn,jo.disableControls=Ho,jo.selectInputContent=un,jo.markAsTouched=Yo,jo.markAllAsTouched=Yo,jo.markAsUntouched=tr,jo.waitWhilePending=er,jo.waitIdle=nr,jo.updateValueAndValidity=Zo,jo.getFormErrors=$o,jo.addValueInArray=Wo,jo.removeValueInArray=Ko,jo.resizeArray=zo,jo.clearValueInArray=Qo,jo.calculatedSuffix="Calculated",jo.isControlHasInput=or,jo.setCalculatedValue=rr,jo.resetCalculatedValue=ir;var ar=function(){function t(t,e,n,o,r){this._formArray=t,this.createControl=e,this.equals=n,this.isEmpty=o,this._validators=r&&r.validators,this.setAllowEmptyArray(je(r&&r.allowEmptyArray,!1))}return t.getOrCreateArray=function(t,e,n){var o=e.get(n);return o||(o=t.array([]),e.addControl(n,o)),o},Object.defineProperty(t.prototype,"allowEmptyArray",{get:function(){return this._allowEmptyArray},set:function(t){this.setAllowEmptyArray(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formArray",{get:function(){return this._formArray},enumerable:!1,configurable:!0}),t.prototype.add=function(t,e){return Wo(this._formArray,this.createControl,this.equals,this.isEmpty,t,e)},t.prototype.removeAt=function(t){return this._allowEmptyArray||1!==this._formArray.length?Ko(this._formArray,this.isEmpty,t):Qo(this._formArray,this.isEmpty,t)},t.prototype.resize=function(t){return zo(this._formArray,this.createControl,t)},t.prototype.clearAt=function(t){return Qo(this._formArray,this.isEmpty,t)},t.prototype.isLast=function(t){return this._formArray.length-1===t},t.prototype.removeAllEmpty=function(){for(var t=this,e=this._formArray.controls.findIndex((function(e){return t.isEmpty(e.value)}));-1!==e;)this.removeAt(e),e=this._formArray.controls.findIndex((function(e){return t.isEmpty(e.value)}))},t.prototype.size=function(){return this._formArray.length},t.prototype.at=function(t){return this._formArray.at(t)},t.prototype.disable=function(t){this._formArray.controls.forEach((function(e){return e.disable(t)}))},t.prototype.enable=function(t){this._formArray.controls.forEach((function(e){return e.enable(t)}))},t.prototype.forEach=function(t){for(var e=this.size(),n=0;n<e;n++){var o=this._formArray.at(n);o&&t(o)}},t.prototype.setAllowEmptyArray=function(t){this._allowEmptyArray!==t&&(this._allowEmptyArray=t,this._allowEmptyArray?this._formArray.setValidators(this._validators||null):this._formArray.setValidators((this._validators||[]).concat(Fo.requiredArrayMinLength(1))))},t}(),sr=new e.InjectionToken("appFormErrorKeys"),lr=function(){function t(t,e){this.translate=t,this.errorI18nKeys=Object.assign(Object.assign({},Do.I18N_ERROR_KEYS),e)}return t.prototype.translateErrors=function(t,e){var n=this;if(!t||!t.invalid)return"";var o=e&&e.separator||", ",r=!e||!1!==e.recursive,i=jo.getFormErrors(t,{recursive:r});return i&&Object.keys(i).reduce((function(r,a){var s=t.get(a);if(s){var l=n.translateControlPath(a,e),c=Object.keys(s.errors).map((function(t){return n.translateError(t,s.errors[t])}));return Fe(c)?r:(r.length&&(r+=o),r+l+": "+c.join(o))}var u=n.translateError(a,i[a]);return Ae(u)?r:r+(r.length?o:"")+u}),"")},t.prototype.translateControlPath=function(t,e){if(null==e?void 0:e.controlPathTranslator)return null==e?void 0:e.controlPathTranslator.translateControlPath(t);var n=(e&&e.i18nPrefix||"")+Ge(t).toUpperCase();return this.translate.instant(n)},t.prototype.translateError=function(t,e){var n=this.errorI18nKeys[t]||"ERROR.FIELD_"+Ge(t).toUpperCase(),o=this.translate.instant(n,e);return n!==o||"string"==typeof e&&e!==(o=this.translate.instant(e))?o:(console.error("[form-error-adapter] Cannot translate error key '"+t+"'. Please add more formErrorsKey into APP_FORM_ERROR_I18N_KEYS injection token"),t)},t}();lr.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new lr(jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(sr,8))},token:lr,providedIn:"root"}),lr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],lr.ctorParameters=function(){return[{type:F.TranslateService},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[sr]}]}]};var cr=function(){function t(t,e){this.adapter=t,this._ref=e,this.value="",this._lastForm=null,this._lastOptions=null}return t.prototype.transform=function(t,e){var n=this;return t?(t===this._lastForm&&sn(e,this._lastOptions)||(this._lastForm=t,this._lastOptions=e,this._updateValue(t,e),this._dispose(),this._onFormStatusChange||(this._onFormStatusChange=t.statusChanges.subscribe((function(o){n._updateValue(t,e,o)})))),this.value):(this._dispose(),"")},t.prototype.ngOnDestroy=function(){this._dispose()},t.prototype._updateValue=function(t,e,n){"INVALID"===n||t.invalid?(this.value=this.adapter.translateErrors(t,e),this._ref.markForCheck()):void 0!==this.value&&(this.value=void 0,this._ref.markForCheck())},t.prototype._dispose=function(){void 0!==this._onFormStatusChange&&(this._onFormStatusChange.unsubscribe(),this._onFormStatusChange=void 0)},t}();cr.decorators=[{type:e.Pipe,args:[{name:"translateFormError",pure:!1}]}],cr.ctorParameters=function(){return[{type:lr},{type:e.ChangeDetectorRef}]};var ur=function(){};ur.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,F.TranslateModule],declarations:[To,Mn,jn,lo,Bn,Xn,Jn,Zn,eo,to,no,co,po,uo,ho,mo,fo,go,bo,yo,vo,Co,Eo,wo,Oo,Io,_o,xo,So,Ao,Ro,cr],exports:[To,Mn,Bn,jn,lo,Xn,Jn,Zn,eo,to,no,co,po,uo,ho,mo,fo,go,bo,Co,Eo,wo,Oo,Io,_o,xo,yo,vo,So,Ao,Ro,cr]}]}];var dr=function(){function t(t,e,n){var o=this;this.keyboard=n,this.timer=null,this.elementRef=t,this.shouldFocusElement="",this.timer=null,this.timerDelay=100,e.ready().then((function(){o.touchUi=e.is("mobile")||e.is("tablet")}))}return t.prototype.ngAfterContentInit=function(){""===this.shouldFocusElement&&this.startFocusWorkflow()},t.prototype.ngOnChanges=function(t){t.timerDelay&&"number"!=typeof this.timerDelay&&isNaN(this.timerDelay=+this.timerDelay)&&(this.timerDelay=100),t.shouldFocusElement&&(this.shouldFocusElement?this.startFocusWorkflow():this.stopFocusWorkflow())},t.prototype.ngOnDestroy=function(){this.stopFocusWorkflow()},t.prototype.startFocusWorkflow=function(){var t=this;this.touchUi&&this.keyboard&&!1===this.keyboard.isVisible||this.timer||(this.timer=setTimeout((function(){t.timer=null,t.elementRef.nativeElement.focus()}),this.timerDelay))},t.prototype.stopFocusWorkflow=function(){clearTimeout(this.timer),this.timer=null},t}();dr.decorators=[{type:e.Directive,args:[{selector:"[autofocus], input[appAutofocus]",inputs:["shouldFocusElement: appAutofocus","timerDelay: autofocusDelay"]}]}],dr.ctorParameters=function(){return[{type:e.ElementRef},{type:M.Platform},{type:B.Keyboard,decorators:[{type:e.Optional}]}]};var pr=function(){};pr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule],declarations:[dr],exports:[dr]}]}];var hr=function(){};hr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,a.ScrollingModule,P.ReactiveFormsModule,ur,pr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,F.TranslateModule.forChild()],exports:[R.MatAutocompleteModule,Fn],declarations:[Fn]}]}];function mr(t){if(null==t)return null;var e=Math.floor(t),n=Math.round(60*(t-e));return[e.toString().padStart(3,"0"),n.toString().padStart(2,"0")].join(":")}function fr(t,e,n){for(var o=t||"";-1!==o.indexOf(n);)o=o.replace(n,"");var r=o.split(":");return function(t,e){if(e>0){var n=Math.pow(10,e);return Math.trunc(t*n+.5)/n}if(0===e)return Math.trunc(t+.5);return t}(parseInt(r[0]||"0")+(parseInt(r[1]||"0")+.5)/60,e)}var gr={latitude:{DDMMSS:[" ",/\d/,/\d/,"°"," ",/\d/,/\d/,"'"," ",/\d/,/\d/,".",/\d/,/\d/,'"'],DDMM:[" ",/\d/,/\d/,"°"," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,"'"],DD:[/[+-]/," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,"°"]},longitude:{DDMMSS:[/\d/,/\d/,/\d/,"°"," ",/\d/,/\d/,"'"," ",/\d/,/\d/,".",/\d/,/\d/,'"'],DDMM:[/\d/,/\d/,/\d/,"°"," ",/\d/,/\d/,".",/\d/,/\d/,/\d/,"'"],DD:[/[+-]/,/\d/,/\d/,/\d/,".",/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,/\d/,"°"]}},br=function(){},yr=function(){function t(t,n,o,r,i){this.platform=t,this.translate=n,this.formBuilder=o,this.cd=r,this.formGroupDir=i,this._onChangeCallback=br,this._onTouchedCallback=br,this._subscription=new D.Subscription,this.disabling=!1,this.writing=!1,this._readonly=!1,this.maxDecimals=3,this.placeholderChar=be,this.floatLabel="auto",this.required=!1,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.mobile=this.platform.is("mobile")}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this.readonly||this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){this._readonly=t,this.markForCheck()},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.type=this.type||"latitude",this.pattern=this.pattern||"DDMM",this.mask=gr[this.type]&&gr[this.type][this.pattern],this.mask||(console.error("Invalid attribute value. Expected: type: 'latitude|longitude' and latlongPattern: 'DD|DDMM|DDMMSS'"),this.type="latitude",this.pattern="DDMM",this.mask=gr[this.type][this.pattern]),this.maxDecimals&&(this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):"DD"===this.pattern?(console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern."),this.maxDecimals=7):"DDMMSS"===this.pattern?(console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern."),this.maxDecimals=0):2!==this.maxDecimals&&(console.warn("Invalid attribute 'maxDecimals' - Expected value: 2. Other value not implemented."),this.maxDecimals=2)),this.showSignControl="DD"!==this.pattern,this.formatFn="latitude"===this.type?Gn:Hn,this.formatFnOptions={pattern:this.pattern,maxDecimals:this.maxDecimals,hideSign:this.showSignControl},this.inputPlaceholder="COMMON.LAT_LONG."+("longitude"===this.type?"D":"")+this.pattern+"_PLACEHOLDER",this.textFormControl=this.formBuilder.control(this.required?[null,P.Validators.required]:[null]),this.textMaskConfig={mask:this.mask,keepCharPositions:!0,placeholderChar:this.placeholderChar},this.signFormControl=this.formBuilder.control(this.required?[null,P.Validators.required]:[null]),this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-latlong-field>.");var e=this.formControl.validator;e?this.formControl.setValidators([e,"latitude"===this.type?Do.latitude:Do.longitude]):this.formControl.setValidators("latitude"===this.type?Do.latitude:Do.longitude),this._subscription.add(D.merge(this.textFormControl.valueChanges,this.signFormControl.valueChanges).subscribe((function(e){return t.onFormChange(t.textFormControl.value)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(e){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(e){return t.markForCheck()})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){this.value="string"==typeof t?parseFloat(t.replace(/,/g,".")):t,this.writing=!0;var e=this.formatFn(this.value,Object.assign(Object.assign({},this.formatFnOptions),{placeholderChar:this.placeholderChar})),n=Re(this.value)?this.value<0?-1:1:this.defaultSign?"-"===this.defaultSign?-1:1:null;this.textFormControl.patchValue(e,{emitEvent:!1}),this.signFormControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck()}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,t?(this.textFormControl.disable({onlySelf:!0,emitEvent:!1}),this.signFormControl.disable({onlySelf:!0,emitEvent:!1})):(this.textFormControl.enable({onlySelf:!0,emitEvent:!1}),this.signFormControl.enable({onlySelf:!0,emitEvent:!1})),this.disabling=!1,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,this.textFormControl.invalid||this.signFormControl.invalid)return this.formControl.markAsPending(),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({},this.formControl.errors),this.textFormControl.errors),this.signFormControl.errors)),void(this.writing=!1);var e=Pe(t)?Qn(t,this.pattern,7,this.placeholderChar):null;if(isNaN(e))return this.formControl.markAsPending(),this.formControl.setErrors("latitude"===this.type?{latitude:!0}:{longitude:!0}),void(this.writing=!1);var n="DD"===this.pattern?1:this.signFormControl.value||1;this.value=Re(e)?n*e:null,this.formControl.patchValue(this.value,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(this.value)}},t.prototype.checkIfTouched=function(){return!(!this.formControl.touched&&!this.textFormControl.touched)&&(this.markForCheck(),this._onTouchedCallback(),!0)},t.prototype._onFocus=function(t){var e=this;if(Ae(this.value)){if(this.defaultSign){var n="-"===this.defaultSign?-1:1;if("DD"===this.pattern){var o=this.formatFn(n,Object.assign(Object.assign({},this.formatFnOptions),{placeholderChar:this.placeholderChar}));o=o&&o.replace("1",this.placeholderChar),setTimeout((function(){e.inputElement.nativeElement.value=o;var n="latitude"===e.type?2:1;dn(t.target,n)}),250)}else this.signFormControl.setValue(n)}}else un(t);return this.onFocus.emit(t),!0},t.prototype._onBlur=function(t){this.checkIfTouched()&&Ae(this.value)&&(this.inputElement.nativeElement.value=""),this.onBlur.emit(t)},t.prototype.moveCaretToSeparator=function(t,e){return hn(t," ",e)},t.prototype.onKeypress=function(t){var e=this;if(t.which>=48&&t.which<=57||t.which>=37&&t.which<=40);else if("."===t.key||","===t.key)hn(t,".");else if(t.keyCode>=37&&t.keyCode<=40||46==t.keyCode||8==t.which||9==t.keyCode);else if(43===t.keyCode||45===t.keyCode){var n=pn(t.target);if("DD"===this.pattern&&n>0){var o=t.key,r=this.inputElement.nativeElement.value;if(r&&!r.startsWith(o)){var i=o+(r.length>1?r.substr(1):"");this.inputElement.nativeElement.value=i,dn(this.inputElement.nativeElement,n)}t.preventDefault()}}else"N"===t.key||"S"===t.key||"E"===t.key||"W"===t.key||("n"===t.key||"s"===t.key||"e"===t.key||"w"===t.key?setTimeout((function(){e.inputElement.nativeElement.value=e.inputElement.nativeElement.value.toUpperCase()}),10):t.preventDefault())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();yr.decorators=[{type:e.Component,args:[{selector:"mat-latlong-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text"\n readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{formatFn(value, formatFnOptions)}}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding no-wrap">\n <ion-col class="text ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-disabled]="formControl.disabled"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n\n <mat-label *ngIf="placeholder">{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput #inputElement\n type="text"\n autocomplete="off"\n [textMask]="textMaskConfig"\n [formControl]="textFormControl"\n [placeholder]="inputPlaceholder|translate"\n (keypress)="onKeypress($event)"\n (keydown.tab)="moveCaretToSeparator($event, true)"\n (keydown.shift.tab)="moveCaretToSeparator($event, false)"\n (focus)="_onFocus($event)"\n (blur)="_onBlur($event)"\n [required]="required"\n [tabindex]="tabindex">\n\n <div *ngIf="!showSignControl" matSuffix #injectMatSuffix></div>\n\n \x3c!--<div matSuffix *ngIf="!showSignControl"><ng-content select="[matSuffix]"></ng-content></div>--\x3e\n\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper">\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'latitude\')" translate>ERROR.FIELD_NOT_VALID_LATITUDE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'longitude\')" translate>ERROR.FIELD_NOT_VALID_LONGITUDE</mat-error>\n <ng-content select="mat-error"></ng-content>\n </ng-container>\n\n \x3c!-- mat hint --\x3e\n <div class="mat-form-field-hint-wrapper" [hidden]="formControl.invalid">\n <div class="mat-form-field-hint-spacer"></div>\n <ng-content select="mat-hint"></ng-content>\n </div>\n </div>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- sign --\x3e\n <ion-col class="sign ion-no-padding" [ngSwitch]="type" *ngIf="showSignControl">\n\n \x3c!-- sign on latitude --\x3e\n <mat-form-field *ngSwitchCase="\'latitude\'"\n floatLabel="never"\n [class.mat-form-field-invalid]="formControl.touched && signFormControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.LAT_LONG.LAT_SIGN_PLACEHOLDER</mat-label>\n <mat-select [formControl]="signFormControl"\n [tabindex]="tabindex+1">\n <mat-option [value]="1">{{\'COMMON.LAT_LONG.LAT_SIGN_N\'|translate}}</mat-option>\n <mat-option [value]="-1" >{{\'COMMON.LAT_LONG.LAT_SIGN_S\'|translate}}</mat-option>\n </mat-select>\n\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n </mat-form-field>\n\n \x3c!-- sign on longitude --\x3e\n <mat-form-field floatLabel="never"\n *ngSwitchCase="\'longitude\'"\n [class.mat-form-field-invalid]="formControl.touched && signFormControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.LAT_LONG.LONG_SIGN_PLACEHOLDER</mat-label>\n <mat-select [formControl]="signFormControl"\n [tabindex]="tabindex+2">\n <mat-option [value]="1" translate>{{\'COMMON.LAT_LONG.LONG_SIGN_E\'|translate}}</mat-option>\n <mat-option [value]="-1" translate>{{\'COMMON.LAT_LONG.LONG_SIGN_W\'|translate}}</mat-option>\n </mat-select>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return yr}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;min-width:140px;position:relative;--ion-grid-column-padding:0}mat-form-field .datetime-md{padding:0!important}ion-row{flex-wrap:nowrap}ion-row ion-col.text{min-width:80px}ion-row ion-col.sign{min-width:60px;max-width:70px}mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;top:100%}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}mat-error{text-align:right;width:100%}"]}]}],yr.ctorParameters=function(){return[{type:M.Platform},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},yr.propDecorators={mobile:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],type:[{type:e.Input}],pattern:[{type:e.Input,args:["latLongPattern"]}],defaultSign:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],tabindex:[{type:e.Input}],onBlur:[{type:e.Output}],onFocus:[{type:e.Output}],inputElement:[{type:e.ViewChild,args:["inputElement"]}]};var vr=function(){};vr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,U.TextMaskModule,F.TranslateModule.forChild(),v.MatSelectModule],exports:[yr],declarations:[yr]}]}];var Cr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ir})),multi:!0},Er=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],wr=function(){},Ir=function(){function t(t,e,n,o,r,i,a){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.keyboard=i,this.formGroupDir=a,this._onChangeCallback=wr,this._onTouchedCallback=wr,this._subscription=new D.Subscription,this.writing=!0,this.disabling=!1,this.dayMask=Er,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=be,this.autofocus=!1,this.clearable=!1,this.mobile=t.is("mobile"),this.keyboardHideDelay=this.mobile?ve:0,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return io(this._value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required);var e=new D.BehaviorSubject(null);this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?[P.Validators.required,Do.validDate]:Do.validDate),this.updatePattern(this.translate.instant("COMMON.DATE_PATTERN")),this._subscription.add(this.translate.get("COMMON.DATE_PATTERN").subscribe((function(e){return t.updatePattern(e)}))),this._subscription.add(this.dayControl.valueChanges.subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(n){"INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.dayControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){if(Te(t))return this.writing=!0,this.dayControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=this.dateAdapter.parse(t,ge),this._value&&(this.writing=!0,this.dayControl.patchValue(this.dateAdapter.format(this._value.clone().startOf("day"),this.dayPattern),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.dayControl.disable({onlySelf:!0,emitEvent:!1}):this.dayControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(!this.writing&&t&&t.value){this.writing=!0;var e,n=t.value;e=(n=(n="string"==typeof n&&this.dateAdapter.parse(n,ge)||n)&&n.utc(!0).hour(0).minute(0).seconds(0).millisecond(0))&&n.clone().startOf("day"),this.dayControl.setValue(n&&this.dateAdapter.format(e,this.dayPattern),{emitEvent:!1});var o=n&&this.dateAdapter.format(n,ge).replace("+00:00","Z");this.formControl.patchValue(o,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(o)}},t.prototype.updatePattern=function(t){t="COMMON.DATE_PATTERN"!==t?t:"L",this.displayPattern!==t&&(this.displayPattern=t,this.dayPattern=t,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){for(this.writing=!0;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var e;e=(e=t&&this.dateAdapter.parse(t,this.dayPattern)||null)&&e.utc(!0).hour(0).minute(0).seconds(0).millisecond(0),this._value=e&&this.dateAdapter.parse(e.clone(),ge);var n=e&&e.isValid()&&this.dateAdapter.format(e,ge).replace("+00:00","Z")||e;this.formControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(n)}},t.prototype.checkIfTouched=function(){this.dayControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=e||this.datePicker)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard&&this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.keyboardHideDelay>0&&t?[4,nn(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ir.decorators=[{type:e.Component,args:[{selector:"mat-date-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dayControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker)"\n (keyup.escape)="preventEvent($event)"\n [required]="required"\n [tabindex]="tabindex"\n [appAutofocus]="autofocus">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dayControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final control --\x3e\n <input matInput type="text"\n [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n (dateChange)="onDatePickerChange($event)">\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="openDatePicker($event, datePicker)"\n [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="writeValue(null)"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'validDate\')" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateIsAfter\')">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateRange\')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMaxDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMinDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngIf="formControl.hasError(\'msg\')">{{formControl.errors.msg}}</mat-error>\n </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n\n',providers:[Cr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}:host [no-padding]{--ion-grid-column-padding:0}:host [nowrap]{flex-wrap:nowrap}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md,mat-form-field ion-datetime{padding:0!important}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Ir.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ir.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Or={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ar})),multi:!0},_r=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],xr=/^[012][0-9][:][012345][0-9]$/,kr=[/[012]/,/\d/,":",/[012345]/,/\d/],Sr=function(){},Ar=function(){function t(t,e,n,o,r,i,a){this.platform=t,this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.keyboard=r,this.cd=i,this.formGroupDir=a,this._onChangeCallback=Sr,this._onTouchedCallback=Sr,this._subscription=new D.Subscription,this.writing=!0,this.disabling=!1,this._readonly=!1,this.dayMask=_r,this.hourMask=kr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=be,this.autofocus=!1,this.clearable=!1,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){this._readonly=t,this.markForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.mobile=Ae(this.mobile)?this.platform.is("mobile"):this.mobile,this.waitHideKeyboardDelay=this.mobile?ve:0,this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Do.validDate]:[this.formControl.validator,Do.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Do.validDate]:Do.validDate),this.dateFormControl=this.formBuilder.control(null,this.required?P.Validators.required:null);var e=this.required?this.mobile?P.Validators.required:P.Validators.compose([P.Validators.required,P.Validators.pattern(xr)]):this.mobile?null:P.Validators.pattern(xr);this.timeFormControl=this.formBuilder.control(null,e),this._subscription.add(this.translate.get(["COMMON.DATE_PATTERN","COMMON.DATE_TIME_PATTERN"]).subscribe((function(e){return t.updatePattern(e)}))),this._subscription.add(D.merge(this.dateFormControl.valueChanges,this.timeFormControl.valueChanges).subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(e){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(){return t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){this.writing=!0;var e=ao(t);if(e&&e.isValid()){var n=e.clone().startOf("day"),o=this.dateAdapter.format(n,this.dayPattern),r=e.hour();r=r<10?"0"+r:r;var i=e.minutes(),a=r+":"+(i=i<10?"0"+i:i);this.dateFormControl.patchValue(o,{emitEvent:!1}),this.timeFormControl.patchValue(a,{emitEvent:!1})}else this.dateFormControl.patchValue(null,{emitEvent:!1}),this.timeFormControl.patchValue(null,{emitEvent:!1});this.writing=!1,this.markForCheck()}},t.prototype.onFormChange=function(t){if(!this.writing){this.writing=!0;var e=this.dateFormControl.value,n=this.timeFormControl.value,o=Te(n)!==Te(e);if(o||this.dateFormControl.invalid||this.timeFormControl.invalid)return this.formControl.markAsPending({onlySelf:!0}),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({validDate:o},this.formControl.errors),this.dateFormControl.errors),this.timeFormControl.errors)),this.formControl.markAsDirty(),void(this.writing=!1);for(;e&&-1!==e.indexOf(this.placeholderChar);)e=e.replace(this.placeholderChar,"");var r=e&&this.dateAdapter.parse(e,this.dayPattern)||null,i=(n||"").split(":"),a=parseInt(i[0]||0),s=parseInt(i[1]||0),l=r&&r.locale(this.locale).hour(a).minute(s).seconds(0).millisecond(0).utc();this.emitChange(l),this.writing=!1}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,t?(this.dateFormControl.disable({emitEvent:!1}),this.timeFormControl.disable({emitEvent:!1})):(this.dateFormControl.enable({emitEvent:!1}),this.timeFormControl.enable({emitEvent:!1})),this.disabling=!1,this.markForCheck())},t.prototype.updatePattern=function(t){this.displayPattern="COMMON.DATE_TIME_PATTERN"!==t["COMMON.DATE_TIME_PATTERN"]?t["COMMON.DATE_TIME_PATTERN"]:"L LT",this.dayPattern="COMMON.DATE_PATTERN"!==t["COMMON.DATE_PATTERN"]?t["COMMON.DATE_PATTERN"]:"L"},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||L.isMoment(t.value))){var e=t.value&&t.value.locale(this.locale).hour(0).minute(0).seconds(0).millisecond(0).utc(!0),n=e&&this.dateAdapter.format(e,this.dayPattern)||null;this.dateFormControl.value!==n&&this.dateFormControl.setValue(n,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.onTimePickerChange=function(t){this.timeFormControl.value!==t&&this.timeFormControl.setValue(t,{emitEvent:!0})},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.hideKeyboard(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=e||this.datePicker)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.openTimePickerIfMobile=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.hideKeyboard(!0)]);case 1:return e.sent(),this.openTimePicker(null),[2]}}))}))},t.prototype.openTimePicker=function(t){this.timePicker&&(this.preventEvent(t),this.timePicker.open())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.checkIfTouched=function(){(this.dateFormControl.touched||this.timeFormControl.touched)&&(this._onTouchedCallback(),this.markForCheck())},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.clear=function(){this.formControl.setValue(null),this.markAsTouched(),this.markAsDirty()},t.prototype.emitChange=function(t){var e=io(t)||null;this.formControl.value!==e&&(this._onChangeCallback(e),this.checkIfTouched())},t.prototype.hideKeyboard=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.waitHideKeyboardDelay>0&&t?[4,nn(this.waitHideKeyboardDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(){this.dateFormControl.markAsTouched(),this.timeFormControl.markAsTouched(),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ar.decorators=[{type:e.Component,args:[{selector:"mat-date-time-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled">\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text"\n readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable + time --\x3e\n<ng-template #writable >\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding no-wrap" nowrap>\n\n \x3c!-- day --\x3e\n <ion-col class="day ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dateFormControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker)"\n (keyup.escape)="preventEvent($event)"\n [required]="required"\n [tabindex]="tabindex"\n [appAutofocus]="autofocus">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dateFormControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix #datePickerButton2 (click)="openDatePicker($event, datePicker)" [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clear()"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"></mat-datepicker>\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper" >\n \x3c!-- errors --\x3e\n <ng-container [ngSwitch]="formControl.touched && formControl.errors|mapKeys|arrayFirst">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE_TIME</mat-error>\n <mat-error *ngSwitchCase="\'dateIsAfter\'">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngSwitchCase="\'dateRange\'" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngSwitchCase="\'dateMaxDuration\'" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngSwitchCase="\'dateMinDuration\'" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngSwitchCase="\'msg\'">{{(formControl.errors.msg?.key || formControl.errors.msg) | translate: formControl.errors.msg?.params}}</mat-error>\n </ng-container>\n <ng-content select="mat-error"></ng-content>\n\n \x3c!-- mat hint --\x3e\n <div class="mat-form-field-hint-wrapper" [class.cdk-visually-hidden]="formControl.invalid">\n <div class="mat-form-field-hint-spacer"></div>\n <ng-content select="mat-hint"></ng-content>\n </div>\n </div>\n\n </ion-col>\n\n \x3c!-- hour --\x3e\n <ion-col class="hour ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-invalid]="formControl.touched && (timeFormControl.invalid || formControl.invalid)">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.TIME</mat-label>\n <input matInput #matInput type="text"\n *ngIf="!mobile"\n [formControl]="timeFormControl"\n autocomplete="off"\n min="0" max="23"\n [textMask]="{mask: hourMask, keepCharPositions: true, placeholderChar: placeholderChar, guide: true}"\n [placeholder]="\'COMMON.TIME_PLACEHOLDER\'|translate"\n [required]="required"\n (keyup.arrowdown)="openTimePicker($event)"\n (keyup.escape)="preventEvent($event)"\n (blur)="checkIfTouched()"\n [tabindex]="tabindex !== undefined ? tabindex+1 : undefined">\n\n <input matInput #matInput type="text"\n *ngIf="mobile"\n [formControl]="timeFormControl"\n (click)="openTimePickerIfMobile($event)"\n readonly>\n\n <input matInput type="text"\n [formControl]="timeFormControl"\n hidden\n [ngxTimepicker]="timePicker"\n [format]="24">\n\n <button matSuffix type="button" mat-icon-button\n tabindex="-1"\n *ngIf="!compact && !mobile"\n [disabled]="formControl.disabled"\n (click)="openTimePicker($event)" >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n <button matSuffix type="button" mat-icon-button\n tabindex="-1"\n *ngIf="!compact && mobile"\n [disabled]="formControl.disabled"\n (click)="openTimePickerIfMobile($event)">\n <mat-icon>access_time</mat-icon>\n </button>\n\n <ngx-material-timepicker #timePicker [@.disabled]="true"\n (timeSet)="onTimePickerChange($event)"\n [ESC]="!mobile"\n [defaultTime]="\'00:00\'"\n [cancelBtnTmpl]="timePickerCancelButton"\n [confirmBtnTmpl]="timePickerOkButton"\n [preventOverlayClick]="mobile"\n [enableKeyboardInput]="false"\n [disableAnimation]="true">\n \x3c!-- cancel button --\x3e\n <ng-template #timePickerCancelButton>\n <ion-button fill="clear" color="dark">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n </ng-template>\n\n \x3c!-- confirm button --\x3e\n <ng-template #timePickerOkButton>\n <ion-button fill="solid" color="tertiary">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ng-template>\n\n </ngx-material-timepicker>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n\n</ng-template>\n\n<ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n</ng-template>\n\n<ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n</ng-template>\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n',providers:[Or],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative;--ion-grid-column-padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md{padding:0!important}ion-row.no-wrap{flex-wrap:nowrap}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Ar.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:B.Keyboard},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ar.propDecorators={mobile:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],timePicker:[{type:e.ViewChild,args:["timePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Tr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Dr})),multi:!0},Rr=[/\d/,/\d/,/\d/,/\d/],Pr=function(){},Dr=function(){function t(t,e,n,o,r,i,a){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.keyboard=i,this.formGroupDir=a,this._onChangeCallback=Pr,this._onTouchedCallback=Pr,this.writing=!0,this.disabling=!1,this.dayMask=Rr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=be,this.clearable=!1,this.mobile=t.is("mobile"),this.keyboardHideDelay=this.mobile?ve:0,this.locale=(n.currentLang||n.defaultLang).substr(0,2)}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return io(this._value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");var e=new D.BehaviorSubject(null);this.required=je(this.required,this.formControl.validator===P.Validators.required),this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?P.Validators.compose([P.Validators.required,Do.validDate]):Do.validDate);var n=this.translate.instant(["COMMON.DATE_YEAR_PATTERN"]);this.updatePattern(n),this.dayControl.valueChanges.subscribe((function(e){return t.onFormChange(e)})),this.formControl.statusChanges.subscribe((function(n){t.readonly||t.writing||t.disabling||("INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.dayControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck())})),this.updateTabIndex(),this.writing=!1},t.prototype.writeValue=function(t){if(!this.writing){if(Te(t))return this.writing=!0,this.dayControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=this.dateAdapter.parse(t,ge),this._value&&(this.writing=!0,this.dayControl.patchValue(this._value.clone().startOf("day").format(this.dayPattern),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.dayControl.disable({onlySelf:!0,emitEvent:!1}):this.dayControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(!this.writing&&t&&t.value){this.writing=!0;var e,n=t.value;e=(n=(n="string"==typeof n&&this.dateAdapter.parse(n,ge)||n)&&n.utc(!0).hour(0).minute(0).seconds(0).millisecond(0))&&n.clone().startOf("day"),this.dayControl.setValue(e&&e.format(this.dayPattern),{emitEvent:!1});var o=n&&n.format(ge).replace("+00:00","Z");this.formControl.patchValue(o,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(o)}},t.prototype.updatePattern=function(t){this.displayPattern=this.displayPattern="COMMON.DATE_YEAR_PATTERN"!==t["COMMON.DATE_YEAR_PATTERN"]?t["COMMON.DATE_YEAR_PATTERN"]:"L",this.dayPattern="COMMON.DATE_YEAR_PATTERN"!==t["COMMON.DATE_YEAR_PATTERN"]?t["COMMON.DATE_YEAR_PATTERN"]:"L"},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,this.dayControl.invalid)return this.formControl.markAsPending(),this.formControl.setErrors(Object.assign({},this.dayControl.errors)),void(this.writing=!1);for(;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var e;e=(e=t&&this.dateAdapter.parse(t,this.dayPattern)||null)&&e.utc(!0).hour(0).minute(0).seconds(0).millisecond(0),this._value=e&&this.dateAdapter.parse(e.clone(),ge);var n=e&&e.isValid()&&e.format(ge).replace("+00:00","Z")||e;this.formControl.patchValue(n,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(n)}},t.prototype.checkIfTouched=function(){this.dayControl.touched&&(this.markForCheck(),this._onTouchedCallback(),this.onDatePickerChange(this.dayControl))},t.prototype.openDatePickerIfMobile=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!1)]);case 1:return n.sent(),this.openDatePicker(null,e),[2]}}))}))},t.prototype.openDatePicker=function(t,e){(e=this.datePicker1||this.datePicker2)&&(t&&this.preventEvent(t),e.opened||e.open())},t.prototype.closeDatePicker=function(t,e){this.formControl.setValue(t),e.close()},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.keyboard&&this.keyboard.isVisible?(this.keyboard.hide(),[4,this.keyboard.onKeyboardHide().pipe(N.first()).toPromise()]):[2];case 1:return e.sent(),this.keyboardHideDelay>0&&t?[4,nn(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Dr.decorators=[{type:e.Component,args:[{selector:"mat-date-short-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\n\n <mat-label>{{placeholder}}</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="!mobile"\n [formControl]="dayControl"\n [textMask]="{mask: dayMask, keepCharPositions: true, placeholderChar: placeholderChar}"\n [placeholder]="\'COMMON.DATE_YEAR_PLACEHOLDER\'|translate"\n (blur)="checkIfTouched()"\n (keyup.arrowdown)="openDatePicker($event, datePicker1)"\n (keyup.escape)="preventEvent($event)"\n (click)="matInput.select()"\n [required]="required"\n [tabindex]="tabindex">\n <input matInput #matInput autocomplete="off" type="text"\n *ngIf="mobile"\n [formControl]="dayControl"\n (click)="openDatePickerIfMobile($event, datePicker1)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final control --\x3e\n <input matInput type="text"\n [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker1"\n (dateChange)="onDatePickerChange($event)">\n\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="openDatePicker($event, datePicker1)"\n [disabled]="formControl.disabled">\n <div *ngIf="mobile; then iconDate; else iconDesktop"></div>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="writeValue(null)"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'validDate\')" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateIsAfter\')">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'dateRange\')" translate>ERROR.FIELD_NOT_VALID_DATE_RANGE</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMaxDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MAX_DURATION</mat-error>\n <mat-error *ngIf="!formControl.hasError(\'dateRange\') && formControl.hasError(\'dateMinDuration\')" translate>ERROR.FIELD_NOT_VALID_DATE_MIN_DURATION</mat-error>\n <mat-error *ngIf="formControl.hasError(\'msg\')">{{formControl.errors.msg}}</mat-error>\n <ng-content select="mat-error"></ng-content>\n </mat-form-field>\n\n <mat-datepicker #datePicker1\n startView="multi-year"\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n (yearSelected)="closeDatePicker($event, datePicker1)"\n [startAt]="startDate"></mat-datepicker>\n\n <ng-template #iconDesktop>\n <mat-icon>keyboard_arrow_down</mat-icon>\n </ng-template>\n\n <ng-template #iconDate>\n <mat-icon>date_range</mat-icon>\n </ng-template>\n\n</ng-template>\n',providers:[Tr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}:host [no-padding]{--ion-grid-column-padding:0}:host [nowrap]{flex-wrap:nowrap}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}mat-form-field .datetime-md,mat-form-field ion-datetime{padding:0!important}ion-col.day{min-width:100px}ion-col.day .mat-form-field-subscript-wrapper{overflow:visible;right:-64px;width:calc(100% + 64px)}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}ion-col.day .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}ion-col.hour{min-width:55px;max-width:65px}ion-col.hour mat-form-field{width:100%}ion-col.hour mat-form-field input[type=text],ion-col.hour mat-form-field mat-label{text-align:left;min-width:50px}mat-form-field.mat-form-field-disabled ion-col.day{min-width:100px}.hour .mat-form-field-label{max-width:40px}.hour mat-form-field.mat-form-field-should-float .mat-form-field-placeholder{max-width:inherit}mat-error{text-align:right;width:100%}"]}]}],Dr.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Dr.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],tabindex:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePicker1:[{type:e.ViewChild,args:["datePicker1"]}],datePicker2:[{type:e.ViewChild,args:["datePicker2"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Nr=function(){};Nr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,q.MatDatepickerModule,j.MatMomentDateModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,F.TranslateModule.forChild(),pr],exports:[g.MatIconModule,Ir,Ar,Dr],declarations:[Ir,Ar,Dr]}]}];var Fr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Ur})),multi:!0},Mr=/[0-9]\d\d:[0-5]\d/,Lr=[/\d/,/\d/,/\d/,":",/[0-5]/,/\d/],jr=function(){},Br=jr,Ur=function(){function t(t,e,n,o,r,i){this.dateAdapter=e,this.translate=n,this.formBuilder=o,this.cd=r,this.formGroupDir=i,this._subscription=new D.Subscription,this._onChangeCallback=jr,this._onTouchedCallback=jr,this.writing=!0,this.disabling=!1,this.hourMask=Lr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.maxDecimals=2,this.placeholderChar=be,this.clearable=!1}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.maxDecimals&&(this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):this.maxDecimals<2&&(console.warn("Invalid attribute 'maxDecimals' - Value should be more than 2, otherwise the round trip conversion will lose minutes."),this.maxDecimals=2)),this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-date-time-field>.");this.required=je(this.required,this.formControl.validator===P.Validators.required);var e=new D.BehaviorSubject(null);this.textControl=this.formBuilder.control(null,null),this.textControl.setValidators(this.required?[P.Validators.required,function(){return e.getValue()},P.Validators.pattern(Mr)]:[function(){return e.getValue()},P.Validators.pattern(Mr)]),this._subscription.add(this.textControl.valueChanges.subscribe((function(e){return t.onFormChange(e)}))),this._subscription.add(this.formControl.statusChanges.pipe(N.filter((function(){return!t.readonly&&!t.writing&&!t.disabling}))).subscribe((function(n){"INVALID"===n?e.next(t.formControl.errors):"VALID"===n&&e.next(null),t.textControl.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),t.markForCheck()}))),this.updateTabIndex(),this.writing=!1},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.writeValue=function(t){if(!this.writing){if(Ae(t))return this.writing=!0,this.textControl.patchValue(null,{emitEvent:!1}),this._value=void 0,this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null)),this.writing=!1,void this.markForCheck();this._value=t,isNaN(this._value)||(this.writing=!0,console.debug("[mat-duration] Formatted hour: "+this._value+" to "+mr(this._value)),this.textControl.patchValue(mr(this._value),{emitEvent:!1}),this.writing=!1,this.markForCheck())}},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabling||(this.disabling=!0,this.disabled=t,t?this.textControl.disable({onlySelf:!0,emitEvent:!1}):this.textControl.enable({onlySelf:!0,emitEvent:!1}),this.disabling=!1,this.markForCheck())},t.prototype.onFormChange=function(t){if(!this.writing){if(this.writing=!0,console.debug("[mat-duration] onFormChange:",t),this.textControl.hasError("pattern")||this.textControl.hasError("required"))return this.formControl.markAsPending(),this.formControl.setErrors({pattern:this.textControl.errors.pattern,required:this.textControl.errors.required}),void(this.writing=!1);this._value=fr(t||"",this.maxDecimals,this.placeholderChar),console.debug("[mat-duration] Setting duration: ",this._value),this.formControl.patchValue(this._value,{emitEvent:!1}),this.writing=!1,this.markForCheck(),this._onChangeCallback(this._value)}},t.prototype.checkIfTouched=function(){this.textControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.preventEvent=function(t){t&&(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1)},t.prototype.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];cn(e)&&e.focus()}))},t.prototype.moveCaretToSeparator=function(t,e){return hn(t,":",e)},t.prototype.updateTabIndex=function(){var t=this;Ae(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){gn(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ur.decorators=[{type:e.Component,args:[{selector:"mat-duration-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{ formControl.value|duration }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel"\n [class.mat-form-field-disabled]="formControl.disabled"\n [class.mat-form-field-invalid]="formControl.touched && formControl.invalid">\n <mat-label *ngIf="placeholder && floatLabel != \'never\'" translate>COMMON.TIME</mat-label>\n\n <div matPrefix><ng-content select="[matPrefix]"></ng-content></div>\n\n <input matInput #matInput type="text"\n autocomplete="off"\n [formControl]="textControl"\n [textMask]="{mask: hourMask, keepCharPositions: true, placeholderChar: placeholderChar, guide: true}"\n [placeholder]="\'COMMON.DURATION_PLACEHOLDER\'|translate"\n [required]="required"\n (keydown.tab)="moveCaretToSeparator($event, true)"\n (keydown.shift.tab)="moveCaretToSeparator($event, false)"\n (keyup.escape)="preventEvent($event)"\n (blur)="checkIfTouched()"\n [tabindex]="tabindex !== undefined ? tabindex+1 : undefined">\n\n\n \x3c!-- errors --\x3e\n <mat-error *ngIf="!formControl.hasError(\'required\') && textControl.hasError(\'pattern\')" translate>ERROR.FIELD_NOT_VALID_PATTERN</mat-error>\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{(compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\') | translate:formControl.errors.min }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors.max }}</mat-error>\n\n <ng-content select="mat-error"></ng-content>\n </mat-form-field>\n</ng-template>\n\n',providers:[Fr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;min-width:140px;position:relative;--ion-grid-column-padding:0}:host,mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;top:100%}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper{display:flex}mat-form-field .mat-form-field-subscript-wrapper .mat-form-field-hint-wrapper .mat-form-field-hint-spacer{flex:1 0 1em}mat-error{text-align:right;width:100%}"]}]}],Ur.ctorParameters=function(){return[{type:M.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ur.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],tabindex:[{type:e.Input}],clearable:[{type:e.Input}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Vr=function(){};Vr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,s.MatRippleModule,j.MatMomentDateModule,F.TranslateModule.forChild()],exports:[Ur],declarations:[Ur]}]}];var qr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Gr})),multi:!0},$r=function(){},Gr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=$r,this._onTouchedCallback=$r,this._writing=!1,this.showRadio=!1,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.required=!1,this.compact=!1,this.yesLabel="COMMON.YES",this.noLabel="COMMON.NO",this.showButtonIcons=!0,this.yesIcon="checkmark",this.noIcon="close",this.onPressEnter=new e.EventEmitter,this.onBlur=new e.EventEmitter}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this._onChangeCallback(t))},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-boolean-field>.");this.style=this.style||(this.compact?"checkbox":"radio"),"button"===this.style&&(this.buttonsColCount=Be(this.buttonsColCount,2)),this.showRadio=this.showRadio||"always"===this.floatLabel,this.updateTabIndex()},t.prototype.ngAfterViewInit=function(){var t=this;this.suffixDiv&&this.suffixInjections.find((function(e){return e.nativeElement.append(t.suffixDiv.nativeElement),t.suffixDiv.nativeElement.classList.remove("cdk-visually-hidden"),!0}))},t.prototype.writeValue=function(t,e){var n=this;this._writing||(this._writing=!0,t!==this._value&&(this._value=t,this.showRadio="always"===this.floatLabel||Re(this._value),Re(this.tabindex)&&setTimeout((function(){return n.updateTabIndex()}))),this._writing=!1,"button"===this.style&&(t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)),e&&this.onPressEnter.emit(e)),this.markForCheck())},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype._onBlur=function(t){this.checkIfTouched(),this.onBlur.emit(t)},t.prototype._onFocusFakeInput=function(t){t.preventDefault(),this.fakeInput&&(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1),this.focus()},t.prototype.focus=function(){var t=this;this.showRadio=!0,setTimeout((function(){t.yesButton?t.yesButton.focus():t.checkboxButton&&t.checkboxButton.focus(),t.updateTabIndex()})),this.markForCheck()},t.prototype.onRadioValueChanged=function(t){this._writing||(this._writing=!0,this._value=t.value,this.checkIfTouched(),this._onChangeCallback(t.value),this._writing=!1)},t.prototype.onCheckboxValueChanged=function(t){this._writing||(this._writing=!0,this._value=t.checked,this.checkIfTouched(),this._onChangeCallback(t.checked),this._writing=!1)},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.updateTabIndex=function(){Ae(this._tabindex)||-1===this._tabindex||(this.fakeInput&&(this.showRadio?(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1):(this.fakeInput.nativeElement.classList.remove("hidden"),this.fakeInput.nativeElement.tabIndex=this._tabindex)),this.yesButton?(this.yesButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex:-1,this.noButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex+1:-1):this.checkboxButton&&(this.checkboxButton._inputElement.nativeElement.tabIndex=this.showRadio?this._tabindex:-1),this.markForCheck())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Gr.decorators=[{type:e.Component,args:[{selector:"mat-boolean-field",template:'<mat-form-field *ngIf="readonly; else writable"\n [floatLabel]="floatLabel"\n class="mat-form-field-disabled {{classList}}">\n <input matInput hidden type="text" readonly\n [placeholder]="placeholder"\n [formControl]="formControl">\n <ion-text>{{(formControl.value == null && \'COMMON.EMPTY_OPTION\' || (formControl.value === true && yesLabel) || noLabel) | translate }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <ng-container [ngSwitch]="style">\n\n \x3c!-- Radio --\x3e\n <mat-form-field *ngSwitchCase="\'radio\'"\n [floatLabel]="showRadio && (!floatLabel || floatLabel === \'auto\') ? \'always\': floatLabel"\n class="mat-boolean-field mat-boolean-field-radio {{classList}}">\n <mat-label *ngIf="placeholder && floatLabel!==\'never\'">\n {{placeholder}}\n <span [hidden]="showRadio">({{yesLabel|translate}}/{{\'COMMON.NO\'|translate}})</span>\n </mat-label>\n\n <input matInput #fakeInput type="text" readonly="true"\n [formControl]="formControl"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showRadio"\n [tabindex]="tabindex">\n\n \x3c!-- radio button --\x3e\n <mat-radio-group [hidden]="!showRadio"\n [formControl]="formControl"\n (change)="onRadioValueChanged($event)">\n <mat-radio-button #yesButton [value]="true">\n <span>{{yesLabel|translate}}</span>\n </mat-radio-button> \n <mat-radio-button #noButton [value]="false">\n <span>{{noLabel|translate}}</span>\n </mat-radio-button>\n </mat-radio-group>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Checkbox --\x3e\n <mat-form-field *ngSwitchCase="\'checkbox\'"\n [floatLabel]="floatLabel"\n class="mat-boolean-field mat-boolean-field-checkbox {{classList}}">\n <mat-label *ngIf="placeholder && !showRadio">\n {{placeholder}}\n </mat-label>\n\n <input matInput #matInput\n [formControl]="formControl"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showRadio"\n [tabindex]="tabindex">\n\n <ion-label> </ion-label>\n\n \x3c!-- checkbox, when compact --\x3e\n <mat-checkbox #checkboxButton\n [formControl]="formControl"\n (change)="onCheckboxValueChanged($event)"\n [indeterminate]="value===undefined"\n [hidden]="!showRadio"\n [tabindex]="tabindex">\n </mat-checkbox>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Buttons --\x3e\n <mat-form-field *ngSwitchCase="\'button\'"\n [floatLabel]="floatLabel === \'never\' ? \'never\' : \'always\'"\n class="mat-boolean-field mat-boolean-field-button {{classList}}">\n <input matInput type="text" hidden\n [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required">\n <div class="mat-form-field-buttons"\n [style.--buttons-col-count]="buttonsColCount"\n *ngIf="!formControl.disabled; else disabledLabel">\n \x3c!-- yes --\x3e\n <ion-button class="mat-form-field-button"\n [tabindex]="_tabindex"\n (click)="writeValue(true, $event)"\n (keyup.enter)="writeValue(true, $event)"\n [color]="_value == null ? \'tertiary\' : (_value === true) ? \'accent\' : \'light\'">\n <ion-icon *ngIf="showButtonIcons && yesIcon; let icon" slot="start" [name]="icon"></ion-icon>\n {{yesLabel|translate}}\n </ion-button>\n\n \x3c!-- No button --\x3e\n <ion-button class="mat-form-field-button"\n [tabindex]="_tabindex !== undefined ? (_tabindex + 1) : undefined"\n (click)="writeValue(false, $event)"\n (keyup.enter)="writeValue(false, $event)"\n [color]="_value == null ? \'tertiary\' : (_value === false) ? \'accent\' : \'light\'">\n <ion-icon *ngIf="showButtonIcons && noIcon; let icon" slot="start" [name]="icon"></ion-icon>\n {{noLabel|translate}}\n </ion-button>\n </div>\n <ng-template #disabledLabel>\n <ion-label><i translate>COMMON.EMPTY_OPTION</i></ion-label>\n </ng-template>\n\n <div matSuffix #injectMatSuffix></div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </ng-container>\n\n <div class="cdk-visually-hidden">\n <div #suffix><ng-content select="[matSuffix]"></ng-content></div>\n </div>\n\n</ng-template>\n\n\n',providers:[qr],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{width:100%}.mat-form-field.mat-boolean-field-radio{margin-top:-2px}.mat-form-field.mat-boolean-field-button{margin-top:-4px}.mat-form-field .mat-form-field-buttons{width:100%;display:flex;flex-flow:row wrap;justify-content:flex-start;align-items:center}.mat-form-field .mat-form-field-buttons .mat-form-field-button{--flex-basis:calc(100% / var(--buttons-col-count, 2));flex:0 1 var(--flex-basis);max-width:min(var(--flex-basis),150px);white-space:normal;padding:0 2px;height:40px}"]}]}],Gr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Gr.propDecorators={disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],readonly:[{type:e.Input}],required:[{type:e.Input}],compact:[{type:e.Input}],style:[{type:e.Input}],buttonsColCount:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],yesLabel:[{type:e.Input}],noLabel:[{type:e.Input}],showButtonIcons:[{type:e.Input}],yesIcon:[{type:e.Input}],noIcon:[{type:e.Input}],onPressEnter:[{type:e.Output,args:["keyup.enter"]}],onBlur:[{type:e.Output}],tabindex:[{type:e.Input}],value:[{type:e.Input}],yesButton:[{type:e.ViewChild,args:["yesButton"]}],noButton:[{type:e.ViewChild,args:["noButton"]}],checkboxButton:[{type:e.ViewChild,args:["checkboxButton"]}],fakeInput:[{type:e.ViewChild,args:["fakeInput"]}],suffixDiv:[{type:e.ViewChild,args:["suffix",{static:!1}]}],suffixInjections:[{type:e.ViewChildren,args:["injectMatSuffix"]}]};var Hr=function(){};Hr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,k.MatRadioModule,h.MatCheckboxModule,U.TextMaskModule,V.NgxMaterialTimepickerModule,F.TranslateModule.forChild()],exports:[Gr],declarations:[Gr]}]}];var Wr,zr=[[{key:"1"},{key:"2"},{key:"3"},{key:"Backspace",icon:"backspace",color:"light"}],[{key:"4"},{key:"5"},{key:"6"},{key:"Tab",label:"COMMON.BTN_NEXT_SHORT",color:"light"}],[{key:"7"},{key:"8"},{key:"9"},{key:".",label:"COMMON.BTN_DECIMAL_SEPARATOR",color:"light"}],[null,{key:"0"},null,{key:"Enter",icon:"checkmark",color:"tertiary"}]],Kr=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.inputTarget=n&&n.target,o}return Ee(e,t),e}(KeyboardEvent);t.AnimationState=void 0,(Wr=t.AnimationState||(t.AnimationState={})).ENTER="enter",Wr.ENTER_INPUT="enter-input",Wr.LEAVE="leave";var Qr=function(){function e(e){this.cd=e,this.debug=!0,this.backdropState=t.AnimationState.LEAVE,this.columnCount=4,this.filteredKeymap=new D.BehaviorSubject(void 0),this.debug&&console.debug("[numpad-container] Creating component")}return e.prototype.ngOnInit=function(){if(!this.keymap||!this.keymap.length)throw new Error("An invalid 'keymap' was sent to numpad container");this.disableAnimation||(this.appendToInput?this.panelState=t.AnimationState.ENTER:this.modalState=t.AnimationState.ENTER),this.noBackdrop=this.noBackdrop||this.appendToInput,this.noBackdrop||(this.backdropState=t.AnimationState.ENTER);var e=this.defineFilteredKeymap();this.filteredKeymap.next(e),this.columnCount=e.reduce((function(t,e){return e&&Math.max(t,e.length)}),0),this.debug&&console.debug("[numpad-container] columnCount="+this.columnCount)},e.prototype.ngOnDestroy=function(){},e.prototype.onButtonClick=function(t,e){this.debug&&console.debug("[numpad-container] onKeyPress() ",e.key);var n=new Kr("keypress",{key:e.key,target:this.inputElement});this.numpadRef.keypress.next(n)},e.prototype.onKeydown=function(t){console.debug("[numpad-container] onKeypress()",t),this.numpadRef.keypress.next(t)},e.prototype.overlayClick=function(t){this.close()},e.prototype.close=function(){this.disableAnimation?this.numpadRef.close():(this.modalState&&(this.modalState=t.AnimationState.LEAVE),this.panelState&&(this.panelState=t.AnimationState.LEAVE),this.backdropState&&(this.backdropState=t.AnimationState.LEAVE),this.markForCheck())},e.prototype.animationDone=function(e){"done"===e.phaseName&&e.toState===t.AnimationState.LEAVE&&this.numpadRef.close()},e.prototype.defineFilteredKeymap=function(){var t=this.keymap;return this.decimal||(t=t.map((function(t){return t.map((function(t){return t&&"."!==t.key&&","!==t.key?t:null}))}))),t},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}();Qr.decorators=[{type:e.Component,args:[{selector:"mat-numpad-container",template:'<div class="numpad-backdrop-overlay"\n *ngIf="!noBackdrop"\n (click)="overlayClick($event)"\n [@numpadBackdrop]="backdropState">\n</div>\n<div class="numpad-overlay">\n <mat-numpad-content [appendToInput]="appendToInput"\n [inputElement]="inputElement" cdkTrapFocus>\n <div class="numpad {{position}}"\n [class.panel]="appendToInput"\n [@numpadPanelExpansion]="panelState"\n (@numpadPanelExpansion.done)="animationDone($event)"\n [@numpadFadeIn]="modalState"\n (@numpadFadeIn.done)="animationDone($event)">\n <ion-grid>\n <ion-row *ngFor="let row of filteredKeymap | async">\n <ion-col size="{{12/columnCount}}" *ngFor="let item of row">\n <ion-button mat-button expand="block"\n *ngIf="item"\n [color]="item.color || \'secondary\'"\n (click)="onButtonClick($event, item)">\n <ion-icon *ngIf="item.icon; else label" slot="icon-only" [name]="item.icon"></ion-icon>\n <ng-template #label>\n <ion-label>{{ (item.label || item.key) | translate }}</ion-label>\n </ng-template>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n </div>\n </mat-numpad-content>\n</div>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[$.trigger("numpadBackdrop",[$.state("*",$.style({opacity:0,background:"transparent"})),$.state(t.AnimationState.ENTER,$.style({opacity:1})),$.state(t.AnimationState.LEAVE,$.style({opacity:0})),$.transition("* => "+t.AnimationState.ENTER,[$.style({opacity:0}),$.animate("0.4s cubic-bezier(0.25, 0.8, 0.25, 1)")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.style({opacity:1}),$.animate("0.2s cubic-bezier(0.25, 0.8, 0.25, 1)")])]),$.trigger("numpadFadeIn",[$.state("*",$.style({opacity:1,transform:"scale(1)"})),$.state(t.AnimationState.ENTER,$.style({opacity:1,transform:"scale(1)"})),$.state(t.AnimationState.LEAVE,$.style({opacity:0,transform:"scale(0.9)"})),$.transition("* => "+t.AnimationState.ENTER,[$.style({opacity:0,transform:"scale(0.6)"}),$.animate("0.2s ease-out")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.animate("0.2s ease-out")])]),$.trigger("numpadPanelExpansion",[$.state("*",$.style({opacity:1,transform:"scaleY(0) translateY(-50%)"})),$.state(t.AnimationState.ENTER,$.style({opacity:1,transform:"scale(1) translateY(0)"})),$.state(t.AnimationState.LEAVE,$.style({opacity:0,transform:"scale(1) translateY(0)"})),$.transition("* => "+t.AnimationState.ENTER,[$.animate("0.2s ease-out")]),$.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[$.animate("0.2s ease-out")])])],styles:[":host{display:inline-block;max-width:300px;--ion-grid-padding:0;--ion-grid-column-padding:0;--background-color:#fff;--padding:8px}.numpad-backdrop-overlay{position:absolute;top:0;bottom:0;left:0;right:0;background:rgba(0,0,0,.32);z-index:1000;pointer-events:auto;-webkit-tap-highlight-color:transparent}.numpad-overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1000;pointer-events:none}.numpad{width:300px;border-radius:4px;outline:none;position:static;z-index:1000;pointer-events:auto;background-color:var(--background-color,transparent);padding:var(--padding,5px);box-shadow:0 14px 45px rgba(0,0,0,.25),0 10px 18px rgba(0,0,0,.22)}.numpad.panel{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}"]}]}],Qr.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},Qr.propDecorators={onKeydown:[{type:e.HostListener,args:["window:keydown",["$event"]]}]};var Yr=function(){function t(t,e,n,o){this.cfr=t,this.appRef=e,this.injector=n,this.document=o}return t.prototype.appendNumpadToBody=function(t,e){var n=this;this.componentRef=this.cfr.resolveComponentFactory(t).create(this.injector),Object.keys(e).forEach((function(t){return n.componentRef.instance[t]=e[t]})),this.appRef.attachView(this.componentRef.hostView);var o=this.componentRef.hostView.rootNodes[0];this.document.body.appendChild(o)},t.prototype.destroyNumpad=function(){this.componentRef.destroy(),this.appRef.detachView(this.componentRef.hostView)},t}();Yr.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Yr(jt.ɵɵinject(jt.ComponentFactoryResolver),jt.ɵɵinject(jt.ApplicationRef),jt.ɵɵinject(jt.INJECTOR),jt.ɵɵinject(Bt.DOCUMENT,8))},token:Yr,providedIn:"root"}),Yr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Yr.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ApplicationRef},{type:e.Injector},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[n.DOCUMENT]}]}]};var Xr=function(){function t(t){this.domService=t,this._opened=!1,this.keymap=zr,this.decimal=!0,this.disableAnimation=!1,this.noBackdrop=!1,this.position="bottom",this.keypress=new e.EventEmitter,this.closed=new e.EventEmitter}return Object.defineProperty(t.prototype,"opened",{get:function(){return this._opened},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputElement",{get:function(){return this._inputRef&&this._inputRef.element},enumerable:!1,configurable:!0}),t.prototype.registerInput=function(t){if(this._inputRef)throw new Error("A Numpad can only be registered to one input.");this._inputRef=t},t.prototype.open=function(){this._opened||(console.debug("[numpad] Opening numpad..."),this.domService.appendNumpadToBody(Qr,{numpadRef:this,decimal:this.decimal,keymap:this.keymap,inputElement:this.inputElement,appendToInput:this.appendToInput,disableAnimation:this.disableAnimation,noBackdrop:this.noBackdrop,position:this.position}),this._opened=!0)},t.prototype.close=function(){console.debug("[numpad] Closing numpad..."),this.domService.destroyNumpad(),this._opened=!1,this.closed.next()},t}();Xr.decorators=[{type:e.Component,args:[{selector:"mat-numpad",template:""}]}],Xr.ctorParameters=function(){return[{type:Yr}]},Xr.propDecorators={keymap:[{type:e.Input}],decimal:[{type:e.Input}],appendToInput:[{type:e.Input}],disableAnimation:[{type:e.Input}],noBackdrop:[{type:e.Input}],position:[{type:e.Input}],keypress:[{type:e.Output}],closed:[{type:e.Output}]};var Jr=function(){function t(t){this.elementRef=t,this._value="",this.numpadSubscriptions=[],this.onTouched=function(){},this.onChange=function(){}}return Object.defineProperty(t.prototype,"numpad",{set:function(t){this.registerNumpad(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value?this._value:""},set:function(t){this._value=t||"",this.updateInputValue()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.elementRef&&this.elementRef.nativeElement},enumerable:!1,configurable:!0}),t.prototype.updateValue=function(t){console.debug("[numpad-directive] updateValue()",t),this.value=t,this.onChange(t)},t.prototype.ngOnChanges=function(t){},t.prototype.onClick=function(t){this.disableClick||(this._numpad.open(),t.preventDefault(),t.stopPropagation())},t.prototype.writeValue=function(t){this.value=t},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype.ngOnDestroy=function(){this.numpadSubscriptions.forEach((function(t){return t.unsubscribe()}))},t.prototype.registerNumpad=function(t){var e=this;if(!t)throw new Error("MatNumpadComponent is not defined. Please make sure you passed the numpad to matNumpad directive");console.debug("[numpad-directive] Registering numpad",t),this._numpad=t,this._numpad.registerInput(this),this.numpadSubscriptions.push(this._numpad.keypress.pipe().subscribe((function(t){return e.applyingKey(t)})))},t.prototype.applyingKey=function(t){console.debug("[numpad-directive] Receiving key="+t.key);var e=null!==this.value&&void 0!==this.value?this.value:"";if(e="number"==typeof e?""+e:e.replace(",","."),"."===t.key||","===t.key)-1===e.indexOf(".")&&(e+=".");else if("Backspace"===t.key)e=e.length>1?e.substr(0,e.length-1):"";else{if("Enter"===t.key||13===t.keyCode)return void this._numpad.close();if("Tab"===t.key)return;if("Escape"===t.key)return void this._numpad.close();e+=t.key||""}this.updateValue(e),this.onTouched()},t.prototype.updateInputValue=function(){this.elementRef.nativeElement.value=this.value},t}();Jr.decorators=[{type:e.Directive,args:[{selector:"[matNumpad]",providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:Jr,multi:!0}],host:{"[disabled]":"disabled","(click)":"onClick($event)","(change)":"updateValue($event.target.value)","(blur)":"onTouched()"}}]}],Jr.ctorParameters=function(){return[{type:e.ElementRef}]},Jr.propDecorators={keymap:[{type:e.Input}],numpad:[{type:e.Input,args:["matNumpad"]}],value:[{type:e.Input}],disabled:[{type:e.Input}],decimal:[{type:e.Input}],disableClick:[{type:e.Input}],onClick:[{type:e.HostListener,args:["click",["$event"]]}]};var Zr=function(){};Zr.decorators=[{type:e.Component,args:[{selector:"mat-numpad-content",template:'<div [appendNumpadToInput]="inputElement" *ngIf="appendToInput; else modal">\n \x3c!--suppress HtmlUnknownAttribute --\x3e\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</div>\n\n<ng-template #modal>\n \x3c!--suppress HtmlUnknownAttribute --\x3e\n <ng-container *ngTemplateOutlet="content"></ng-container>\n</ng-template>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n'}]}],Zr.propDecorators={appendToInput:[{type:e.Input}],inputElement:[{type:e.Input}]};var ti=function(){function t(t,e){this.renderer=e,this.element=t.nativeElement}return Object.defineProperty(t.prototype,"inputCords",{get:function(){return this.inputElement.getBoundingClientRect()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"directionY",{get:function(){var t=this.element.offsetHeight,e=this._inputCords,n=e.bottom,o=e.top,r=(window&&window.innerHeight)-n<t;return r&&o>t?"top":r&&o<t?"center":"bottom"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"directionX",{get:function(){var t=this.element.offsetWidth,e=this._inputCords,n=e.left,o=e.right,r=(window&&window.innerWidth)-n<t;return r&&o>t?"end":r&&o<t?"center":"start"},enumerable:!1,configurable:!0}),t.prototype.ngAfterViewInit=function(){this._inputCords=this.inputCords,this._directionY=this.directionY,this._directionX=this.directionX,this.append()},t.prototype.changePosition=function(){var t=this.inputCords,e=t.left,n=t.right,o=t.bottom,r=t.top,i=this.defineElementYByDirection(e,n),a=this.defineElementYByDirection(r,o);this.setStyle("left",i+"px"),this.setStyle("top",a+"px")},t.prototype.append=function(){var t=this._inputCords,e=t.left,n=t.right,o=t.bottom,r=t.top,i=this.defineElementXByDirection(e,n),a=this.defineElementYByDirection(r,o);this.setStyle("position","fixed"),this.setStyle("left",i+"px"),this.setStyle("top",a+"px")},t.prototype.setStyle=function(t,e){this.renderer.setStyle(this.element,t,e)},t.prototype.defineElementYByDirection=function(t,e){return"top"===this._directionY?t-this.element.offsetHeight:"center"===this._directionY?t-this.element.offsetHeight/2:e},t.prototype.defineElementXByDirection=function(t,e){return"end"===this._directionX?e-this.element.offsetWidth:"center"===this._directionX?e-this.element.offsetWidth/2:t},t}();ti.decorators=[{type:e.Directive,args:[{selector:"[appendNumpadToInput]"}]}],ti.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},ti.propDecorators={inputElement:[{type:e.Input,args:["appendNumpadToInput"]}],changePosition:[{type:e.HostListener,args:["window:scroll"]}]};var ei=function(){};ei.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild()],exports:[Xr,Jr,Qr,Zr,ti],declarations:[Qr,Xr,Zr,Jr,ti]}]}];var ni={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return oi})),multi:!0},oi=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=D.noop,this._onTouchedCallback=D.noop,this._subscription=new D.Subscription,this._writing=!1,this.showSlides=!1,this.$items=new D.BehaviorSubject(void 0),this.$loaded=new D.BehaviorSubject(!1),this.logPrefix="[mat-swipe-field]",this.debug=!1,this.required=!1,this.clearable=!1,this.onClick=new e.EventEmitter,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.selectInputContent=un}return Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){var e=this;this._tabindex!==t&&(this._tabindex=t,setTimeout((function(){return e.updateTabIndex()})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.$items.getValue()},set:function(t){var e=this;this._itemsSubscription&&(console.warn(this.logPrefix+" Items received twice !"),this._subscription.remove(this._itemsSubscription),this._itemsSubscription.unsubscribe()),D.isObservable(t)?this._itemsSubscription=this._subscription.add(t.subscribe((function(t){e.loadItems(t)}))):t!==this.$items.getValue()&&this.loadItems(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"itemCount",{get:function(){return(this.$items.getValue()||[]).length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.formControl.enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-swipe-field>.");this.displayAttributes=this.displayAttributes||["label","name"],this.displayWith=this.displayWith||function(e){return e&&ze(e,t.displayAttributes)},this.compareWithFn=this.compareWithFn||function(t,e){return t&&e&&t.id===e.id},this.mobile=je(this.mobile,!1)},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._value=void 0,this.$items.complete()},t.prototype._onFocusFakeInput=function(t){t.preventDefault(),this.fakeInput&&(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1),this.focus()},t.prototype.focus=function(){var t=this;this.showSlides=!0,setTimeout((function(){t.prevButton&&t.prevButton.focus(),t.updateTabIndex()})),Ae(this._value)&&(this.slideTo(0),this.slideChanged()),this.markForCheck()},t.prototype.updateTabIndex=function(){Ae(this._tabindex)||-1===this._tabindex||(this.fakeInput&&(this.showSlides?(this.fakeInput.nativeElement.classList.add("hidden"),this.fakeInput.nativeElement.tabIndex=-1):(this.fakeInput.nativeElement.classList.remove("hidden"),this.fakeInput.nativeElement.tabIndex=this._tabindex)),this.prevButton&&this.nextButton&&(this.prevButton._elementRef.nativeElement.tabIndex=this.showSlides?this._tabindex:-1,this.nextButton._elementRef.nativeElement.tabIndex=this.showSlides?this._tabindex+1:-1),this.markForCheck())},t.prototype.writeValue=function(t){var e=this;this._writing||(this._writing=!0,this.compareWithFn(t,this._value)||(this._value=t,this.showSlides=Re(this._value),this.updateSlides(),setTimeout((function(){return e.updateTabIndex()}))),this._writing=!1,this.markForCheck())},t.prototype.clearValue=function(t){var e=this;t.stopPropagation(),this._writing=!0,this.debug&&console.debug(this.logPrefix+" clear value"),this._value=void 0,this.formControl.patchValue(null,{emitEvent:!1}),this.showSlides=!1,setTimeout((function(){e.updateTabIndex(),e.slideTo(0),setTimeout((function(){e._writing=!1}),100)})),this._onChangeCallback(null),this.markForCheck()},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){var e=this;this.slides.lockSwipes(t).then((function(){return e.updateButtons()})),this.cd.markForCheck()},t.prototype.previous=function(){this.slides.slidePrev()},t.prototype.next=function(){this.slides.slideNext()},t.prototype.reachStart=function(t){this.previousDisabled=t},t.prototype.reachEnd=function(t){this.nextDisabled=t},t.prototype.slidesLoaded=function(){this.$loaded.next(!0)},t.prototype.slideChanged=function(){var t=this;this.slides.getActiveIndex().then((function(e){if(!t._writing){t._writing=!0;var n=(t.$items.getValue()||[])[e]||void 0;t.debug&&console.debug(t.logPrefix+" slide changed ActiveIndex:"+e+", new value:"+n),t.formControl.patchValue(n,{emitEvent:!1}),t._writing=!1,t.checkIfTouched(),t._onChangeCallback(n)}}))},t.prototype.loadItems=function(t){var e=this;this.$loaded.next(!1),this.$items.next(t),this.ready().then((function(){return e.slides.update()}))},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.markForCheck(),this._onTouchedCallback())},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.updateSlides=function(){var t=this;if(this.showSlides){var e=(this.$items.getValue()||[]).findIndex((function(e){return t.compareWithFn(e,t._value)}));e>=0?this.slideTo(e):(console.warn(this.logPrefix+" Item not found",this._value),this.slideTo(0))}},t.prototype.slideTo=function(t){var e=this;this.slides.slideTo(t,0,!1).then((function(){return e.slides.update().then((function(){return e.updateButtons()}))}))},t.prototype.updateButtons=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return[4,this.slides.getActiveIndex()];case 1:return t=e.sent(),this.debug&&console.debug(this.logPrefix+" update buttons ActiveIndex:"+t),this.previousDisabled=0===t||this.disabled,this.nextDisabled=t===this.itemCount-1||this.disabled,[2]}}))}))},t.prototype.getSlides=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.ready()];case 1:return t.sent(),[2,this.slides]}}))}))},t.prototype.ready=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return!1!==this.$loaded.getValue()?[3,2]:(this.debug&&console.debug(this.logPrefix+" waiting slides to be ready..."),[4,_n(this.$loaded.pipe(N.filter((function(t){return!0===t}))))]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}();oi.decorators=[{type:e.Component,args:[{selector:"mat-swipe-field",template:'<mat-form-field [floatLabel]="showSlides && (!floatLabel || floatLabel === \'auto\') ? \'always\': floatLabel"\n [class]="classList"\n [class.mat-form-field-disabled]="disabled">\n <mat-label *ngIf="placeholder && floatLabel!==\'never\'">\n {{placeholder}}\n </mat-label>\n <input matInput #fakeInput type="text"\n [formControl]="formControl"\n [readonly]="true"\n (focus)="_onFocusFakeInput($event)"\n [required]="required"\n [class.cdk-visually-hidden]="showSlides"\n [tabindex]="tabindex">\n\n <div class="slides-container" [class.hidden]="!showSlides">\n <ion-slides #slides\n [options]="slidesOptions"\n (ionSlidesDidLoad)="slidesLoaded()"\n (ionSlideReachStart)="reachStart(true)"\n (ionSlideReachEnd)="reachEnd(true)"\n (ionSlideNextEnd)="reachStart(false)"\n (ionSlidePrevEnd)="reachEnd(false)"\n (ionSlideDidChange)="slideChanged()"\n >\n <ion-slide *ngFor="let item of $items | async">\n <ion-label>{{ displayWith(item) }}</ion-label>\n </ion-slide>\n\n </ion-slides>\n </div>\n\n <button #prevButton\n mat-icon-button\n type="button"\n class="button-prev"\n [hidden]="!showSlides"\n [disabled]="previousDisabled"\n (click)="previous()">\n <mat-icon>chevron_left</mat-icon>\n </button>\n <button #nextButton\n mat-icon-button\n type="button"\n class="button-next"\n [hidden]="!showSlides"\n [disabled]="nextDisabled"\n (click)="next()">\n <mat-icon>chevron_right</mat-icon>\n </button>\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clearValue($event)"\n [hidden]="disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'entity\')" translate>ERROR.FIELD_INVALID</mat-error>\n\n</mat-form-field>\n',providers:[ni],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;width:100%;position:relative}input.hidden{display:none}.slides-container .swiper-slide{font-size:16px!important}.slides-container.hidden{visibility:hidden;height:0!important}.button-next,.button-prev{position:absolute;top:calc(50% - 20px);z-index:10}.button-prev{left:0;right:auto}.button-next{left:auto;right:0}"]}]}],oi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},oi.propDecorators={logPrefix:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],debug:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],clearable:[{type:e.Input}],compareWithFn:[{type:e.Input}],displayWith:[{type:e.Input}],displayAttributes:[{type:e.Input}],appAutofocus:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],tabindex:[{type:e.Input}],items:[{type:e.Input}],onClick:[{type:e.Output,args:["click"]}],onBlur:[{type:e.Output,args:["blur"]}],onFocus:[{type:e.Output,args:["focus"]}],fakeInput:[{type:e.ViewChild,args:["fakeInput"]}],slides:[{type:e.ViewChild,args:["slides",{static:!0}]}],prevButton:[{type:e.ViewChild,args:["prevButton"]}],nextButton:[{type:e.ViewChild,args:["nextButton"]}]};var ri=function(){};ri.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild(),d.MatFormFieldModule,P.ReactiveFormsModule,p.MatInputModule],exports:[oi],declarations:[oi]}]}];var ii=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=function(t){},this._onTouchedCallback=function(){},this.logPrefix="[mat-chips] ",this.required=!1,this.readonly=!1,this.clearable=!1,this.debounceTime=250,this.highlightAccent=!1,this.i18nPrefix="REFERENTIAL.",this.noResultMessage="COMMON.NO_RESULT",this.debug=!1,this.clicked=new e.EventEmitter,this.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.$inputItems=new D.BehaviorSubject(void 0),this.onDropButtonClick=new e.EventEmitter(!0),this.inputControl=new P.FormControl,this.getPropertyByPath=Ze,this._subscription=new D.Subscription,this._$filter=new D.BehaviorSubject(void 0)}return Object.defineProperty(t.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._$filter.getValue()},set:function(t){this.debug&&console.debug(this.logPrefix+" Setting filter:",t),t!==this._$filter.getValue()&&this._$filter.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){this._tabindex=t,this.markForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{set:function(t){var e=this;this._itemsSubscription&&(console.warn("Items received twice !"),this._subscription.remove(this._itemsSubscription),this._itemsSubscription.unsubscribe()),D.isObservable(t)?this._itemsSubscription=this._subscription.add(t.subscribe((function(t){return e.$inputItems.next(t)}))):t!==this.$inputItems.getValue()&&this.$inputItems.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value||[]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.readonly||this.formControl.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return!this.readonly&&this.formControl.enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(this.formControl=this.formControl||this.formControlName&&this.formGroupDir&&this.formGroupDir.form.get(this.formControlName),!this.formControl)throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-chips-field>.");if(this.config&&(this.suggestFn=this.suggestFn||this.config.suggestFn,!this.suggestFn&&this.config.items&&(this.items=this.config.items),this.filter=this.filter||this.config.filter,this.displayAttributes=this.displayAttributes||this.config.attributes,this.displayColumnSizes=this.displayColumnSizes||this.config.columnSizes,this.displayColumnNames=this.displayColumnNames||this.config.columnNames,this.displayWith=this.displayWith||this.config.displayWith,this.compareWith=this.compareWith||this.config.compareWith,this.mobile=je(this.mobile,this.config.mobile),this.showAllOnFocus=je(this.showAllOnFocus,je(this.config.showAllOnFocus,!0)),this.showPanelOnFocus=je(this.showPanelOnFocus,je(this.config.showPanelOnFocus,!0)),this.class=this.class||this.config.class),this.displayAttributes=this.displayAttributes||this.filter&&this.filter.attributes||["label","name"],this.displayWith=this.displayWith||function(e){return e&&ze(e,t.displayAttributes)},this.compareWith=this.compareWith||function(t,e){return t&&e&&t.id===e.id},this.displayColumnSizes=this.displayColumnSizes||this.displayAttributes.map((function(t){return t&&t.endsWith("label")?2:t&&t.endsWith("rankOrder")?1:void 0})),this.displayColumnNames=this.displayAttributes.map((function(e,n){return t.displayColumnNames&&t.displayColumnNames[n]||t.i18nPrefix+Ge(e).toUpperCase()})),this.mobile=je(this.mobile,!1),!this.suggestFn){var e=function(e,n){return Ie(t,void 0,void 0,(function(){var t,o,r;return Oe(this,(function(i){switch(i.label){case 0:return this.debug&&console.debug(this.logPrefix+" Calling suggestFromArray with value=",e),[4,We(this.$inputItems.getValue(),e,Object.assign({searchAttributes:this.displayAttributes},n))];case 1:return t=i.sent(),o=t.data,r=t.total,this._itemCount=Be(r,o&&o.length||0),[2,{data:o,total:r}]}}))}))};this.suggestFn=function(n,o){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return Ae(this.$inputItems.getValue())?(this.debug&&console.debug("[mat-chips] Waiting items to be set..."),[4,_n(this.$inputItems)]):[3,2];case 1:t.sent(),this.debug&&console.debug("[mat-chips] Received items:",this.$inputItems.getValue()),t.label=2;case 2:return this.suggestFn=e,[2,this.suggest(n,o)]}}))}))}}this._subscription.add(this.onDropButtonClick.pipe(N.filter((function(e){return(!e||!e.defaultPrevented)&&t.formControl.enabled}))).subscribe((function(){t.matInputText.nativeElement.focus()})));var n=D.merge(D.merge(this.focused,this.clicked).pipe(N.filter((function(e){return t.enabled})),N.map((function(e){return t.showAllOnFocus?"*":t.inputControl.value}))),this.inputControl.valueChanges.pipe(N.startWith(this.inputControl.value),N.filter((function(t){return Re(t)&&"object"==typeof t||Me(t)&&!t.includes("**")})),N.tap((function(e){t.debug&&console.debug(t.logPrefix+" valueChanges:",e)})),N.debounceTime(this.debounceTime)),this.$inputItems.pipe(N.map((function(){return t.formControl.value}))),this._$filter.pipe(N.map((function(){return t.formControl.value}))));this.filteredItems$=n.pipe(N.distinctUntilChanged(),N.switchMap((function(e){return t.suggest(e,t.filter)})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.$inputItems.complete()},t.prototype.add=function(t){this.debug&&console.debug(this.logPrefix+"select",t);var e=t.option.value;this.writeValue(ke(this.value,[e])),this.matInputText.nativeElement.value="",this.inputControl.setValue("")},t.prototype.remove=function(t){var e=this.value&&this.value.indexOf(t);if(e>=0){var n=this.value.slice();n.splice(e,1),this.writeValue(n),this.inputControl.setValue("")}},t.prototype.reloadItems=function(){this.onDropButtonClick.emit()},t.prototype.writeValue=function(t){this.debug&&console.debug(this.logPrefix+" Writing value: ",t),t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t))},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.cd.markForCheck()},t.prototype.focus=function(){fn(this.matInputText)},t.prototype.filterInputTextFocusEvent=function(t){if(t&&!t.defaultPrevented)return t.relatedTarget instanceof HTMLElement&&"MAT-OPTION"===t.relatedTarget.tagName?(t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,this.debug&&console.debug(this.logPrefix+" Cancelling focus event"),!1):!!(!un(t)||this.showPanelOnFocus&&this.showAllOnFocus)&&(this.debug&&console.debug(this.logPrefix+" Emit focus event"),this.focused.emit(t),!0)},t.prototype.clearValue=function(t){this.writeValue(null),t.stopPropagation()},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return[4,this.suggestFn(t,e)];case 1:return(n=s.sent())?Array.isArray(n)?(n=n,this._itemCount=n.length||0):(o=n.data,r=n.total,n=o,this._itemCount=Be(r,o&&o.length||0)):(this._itemCount=0,n=[]),i=(n||[]).slice().filter((function(t){return-1===a.value.findIndex((function(e){return a.compareWith(t,e)}))})),this._itemCount=this._itemCount-(((null==n?void 0:n.length)||0)-((null==i?void 0:i.length)||0)),this.debug&&console.debug(this.logPrefix+" Filtered items by suggestFn:",t,n),[2,n]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();ii.decorators=[{type:e.Component,args:[{selector:"mat-chips-field",template:'<ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col class="ion-no-padding">\n <mat-form-field [floatLabel]="floatLabel" class="material-chips" [class.mat-form-field-disabled]="disabled">\n <div matPrefix>\n <ng-content select="[matPrefix]"></ng-content>\n </div>\n <mat-label>{{placeholder}}</mat-label>\n <mat-chip-list #chipList>\n <mat-chip\n *ngFor="let item of value"\n [selectable]="false"\n [removable]="!disabled"\n (removed)="remove(item)">\n {{displayWith(item)}}\n <mat-icon matChipRemove *ngIf="!disabled">cancel</mat-icon>\n </mat-chip>\n\n <input matInput #matInputText type="text"\n [matAutocomplete]="autoCombo"\n [formControl]="inputControl"\n [appAutofocus]="appAutofocus"\n [tabindex]="_tabindex"\n [readonly]="disabled"\n [hidden]="disabled"\n [required]="required"\n (click)="clicked.emit($event)"\n (blur)="blurred.emit($event)"\n (focus)="filterInputTextFocusEvent($event)"\n (keyup.arrowdown)="!autoCombo.showPanel && onDropButtonClick.emit($event)"\n [matChipInputFor]="chipList"\n >\n </mat-chip-list>\n\n \x3c!-- autocomplete --\x3e\n <mat-autocomplete #autoCombo="matAutocomplete"\n (optionSelected)="add($event)"\n autoActiveFirstOption\n [displayWith]="displayWith"\n [class]="class">\n <ng-container *ngIf="(filteredItems$ | async) as items">\n <ion-row class="mat-autocomplete-header ion-no-padding">\n <ion-col *ngFor="let attr of displayAttributes; index as i; last as isLast" [size]="displayColumnSizes[i]">\n <ion-label [innerHTML]="displayColumnNames[i] | translate"></ion-label>\n <ion-text color="light" *ngIf="isLast" class="ion-float-end ion-padding-end"><i>{{\'COMMON.RESULT_COUNT\'|translate: {count: itemCount} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n \x3c!-- No item option --\x3e\n <mat-option *ngIf="!items.length" class="ion-no-padding" [disabled]="true">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding">\n <ion-label><i>{{noResultMessage | translate}}</i></ion-label>\n </ion-col>\n </ion-row>\n </mat-option>\n\n <mat-option *ngFor="let item of items" [value]="item" class="ion-no-padding">\n <ion-row>\n <ion-col *ngFor="let attr of displayAttributes; index as i;"\n [size]="displayColumnSizes[i]">\n <ion-text [innerHTML]="getPropertyByPath(item, attr) | highlight: { search: inputControl.value, withAccent: highlightAccent } "></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n </ng-container>\n </mat-autocomplete>\n\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n (click)="onDropButtonClick.emit($event)"\n [hidden]="disabled">\n <mat-icon class="large select-arrow">arrow_drop_down</mat-icon>\n </button>\n <button matSuffix mat-icon-button tabindex="-1"\n type="button"\n *ngIf="clearable"\n (click)="clearValue($event)"\n [hidden]="disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n <ng-content matSuffix select="[matSuffix]"></ng-content>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n </mat-form-field>\n\n </ion-col>\n <ion-col size="auto" class="ion-align-self-center">\n <ng-content select="[matAfter]"></ng-content>\n </ion-col>\n </ion-row>\n</ion-grid>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return ii}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{position:relative}:host.ion-text-wrap ion-label{white-space:normal!important}button[hidden]{display:none}mat-icon.select-arrow{color:rgba(0,0,0,.47);font-size:150%}"]}]}],ii.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},ii.propDecorators={compareWith:[{type:e.Input}],logPrefix:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],suggestFn:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],readonly:[{type:e.Input}],clearable:[{type:e.Input}],debounceTime:[{type:e.Input}],displayWith:[{type:e.Input}],displayAttributes:[{type:e.Input}],displayColumnSizes:[{type:e.Input}],displayColumnNames:[{type:e.Input}],highlightAccent:[{type:e.Input}],showAllOnFocus:[{type:e.Input}],showPanelOnFocus:[{type:e.Input}],appAutofocus:[{type:e.Input}],config:[{type:e.Input}],i18nPrefix:[{type:e.Input}],noResultMessage:[{type:e.Input}],class:[{type:e.Input}],debug:[{type:e.Input}],clicked:[{type:e.Output}],blurred:[{type:e.Output}],focused:[{type:e.Output}],matInputText:[{type:e.ViewChild,args:["matInputText"]}],autocompleteTrigger:[{type:e.ViewChild,args:[R.MatAutocompleteTrigger]}],filter:[{type:e.Input}],tabindex:[{type:e.Input}],items:[{type:e.Input}]};var ai=function(){};ai.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ur,pr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,W.MatChipsModule,F.TranslateModule.forChild()],declarations:[ii],exports:[ii]}]}];var si=function(){function t(t){this.el=t}return t.prototype.ngOnInit=function(){var t;switch(this.size=this.size||"medium",this.color=this.color||"primary","warn"===this.color&&(this.color="warning"),this.size){case"large":t="24px";break;case"medium":t="22px";break;case"small":t="16px"}var e=this.el.nativeElement.querySelector(".mat-badge-content");e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center","clear"===this.fill?(e.style.color="var(--ion-color-"+this.color+")",e.style.background="transparent"):(e.style.background="var(--ion-color-"+this.color+")",e.style.color="var(--ion-color-"+this.color+"-contrast)"),this.matIcon?e.innerHTML='<i class="material-icons" style="font-size: '+t+';">'+this.matIcon+"</i>":this.ionIcon&&(e.innerHTML='<ion-icon style="font-size: '+t+'; pointer-events: none;" name="'+this.ionIcon+'"></ion-icon>')},t}();si.decorators=[{type:e.Directive,args:[{selector:"[matBadgeIcon], [ionBadgeIcon]",inputs:["size: matBadgeSize","color: matBadgeColor","fill: matBadgeFill"]}]}],si.ctorParameters=function(){return[{type:e.ElementRef}]},si.propDecorators={matIcon:[{type:e.Input,args:["matBadgeIcon"]}],ionIcon:[{type:e.Input,args:["ionBadgeIcon"]}]};var li=function(){};li.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,S.MatBadgeModule],exports:[si],declarations:[si]}]}];var ci=[s.MatCommonModule,l.MatTableModule,c.MatSortModule,u.MatPaginatorModule,d.MatFormFieldModule,p.MatInputModule,o.CdkTableModule,h.MatCheckboxModule,m.MatExpansionModule,f.MatToolbarModule,T.MatDialogModule,g.MatIconModule,b.MatButtonModule,y.MatMenuModule,v.MatSelectModule,C.MatCardModule,E.MatTabsModule,I.MatListModule,w.MatStepperModule,O.MatButtonToggleModule,_.MatProgressSpinnerModule,x.MatProgressBarModule,k.MatRadioModule,S.MatBadgeModule,A.MatSlideToggleModule,r.A11yModule,i.OverlayModule,a.ScrollingModule,s.MatRippleModule,G.MatDividerModule,H.MatTooltipModule,hr,vr,Nr,Vr,Hr,ei,ri,ai,li],ui=function(){};ui.decorators=[{type:e.NgModule,args:[{imports:ci,exports:ci}]}];var di=function(){function t(){this._requestsRunning=0,this.onProgressChanged=new e.EventEmitter}return t.prototype.list=function(){return this._requestsRunning},t.prototype.increase=function(){this._requestsRunning++,1===this._requestsRunning&&this.onProgressChanged.emit("query")},t.prototype.decrease=function(){this._requestsRunning>0&&this._requestsRunning--,0===this._requestsRunning&&this.onProgressChanged.emit("none")},t}();di.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new di},token:di,providedIn:"root"}),di.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var pi=400,hi=function(t){function e(){var e=t.apply(this,ke(arguments))||this;return e.overrides={press:{time:pi},pinch:{enable:!1},rotate:{enable:!1},swipe:{threshold:30,velocity:.4}},e}return Ee(e,t),e.prototype.buildHammer=function(t){console.debug("[gesture] Applying HammerJS config to ",t.tagName);var e=new window.Hammer(t);for(var n in this.overrides)n&&e.get(n).set(this.overrides[n]);return e},e}(K.HammerGestureConfig);hi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new hi},token:hi,providedIn:"root"}),hi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var mi=function(){},fi=function(){function t(t,n,o,r){this.router=t,this.routerOutlet=n,this.cd=o,this._closeTapCount=0,this._validateTapCount=0,this.title="",this.color="primary",this.class="",this.hasValidate=!1,this.hasClose=!1,this.canShowMenu=!0,this.onValidate=new e.EventEmitter,this.onClose=new e.EventEmitter,this.onValidateAndClose=new e.EventEmitter,this.onBackClick=new e.EventEmitter,this.onSearch=new e.EventEmitter,this.showSearchBar=!1,r&&(this.progressBarMode$=r.onProgressChanged.pipe(N.startWith("none"),N.tap((function(t){return"[toolbar] Updating progressBarMode: "+t})),N.debounceTime(100),N.distinctUntilChanged()))}return Object.defineProperty(t.prototype,"backHref",{get:function(){return this._backHref},set:function(t){t!==this._backHref&&(this._backHref=t,this.canGoBack=this.canGoBack||Re(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultBackHref",{get:function(){return this._defaultBackHref},set:function(t){t!==this._defaultBackHref&&(this._defaultBackHref=t,this.canGoBack=this.canGoBack||Re(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.hasValidate=je(this.hasValidate,this.onValidate.observers.length>0),this.canGoBack=je(this.canGoBack,this.routerOutlet.canGoBack()||Pe(this._backHref)||Pe(this._defaultBackHref)),this.hasSearch=je(this.hasSearch,this.onSearch.observers.length>0)},t.prototype.ngOnDestroy=function(){this.onBackClick.complete(),this.onBackClick.unsubscribe(),this.onValidate.complete(),this.onValidate.unsubscribe(),this.onClose.complete(),this.onClose.unsubscribe(),this.onValidateAndClose.complete(),this.onValidateAndClose.unsubscribe(),this.onSearch.complete(),this.onSearch.unsubscribe()},t.prototype.toggleSearchBar=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){return this.showSearchBar=!this.showSearchBar,this.showSearchBar&&this.searchbar&&setTimeout((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.searchbar.setFocus()];case 1:return t.sent(),[2]}}))}))}),300),[2]}))}))},t.prototype.doBackClick=function(t){this.onBackClick.emit(t),t.defaultPrevented||this.goBack()},t.prototype.goBack=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.debug("[toolbar] calling goBack()"),this._backHref?[4,this.router.navigateByUrl(this._backHref)]:[3,2];case 1:return t.sent(),[3,7];case 2:return this.routerOutlet.canGoBack()?[4,this.routerOutlet.pop()]:[3,4];case 3:return t.sent(),[3,7];case 4:return this._defaultBackHref?[4,this.router.navigateByUrl(this._defaultBackHref)]:[3,6];case 5:return t.sent(),[3,7];case 6:console.error("[toolbar] Cannot go back. Missing attribute 'defaultBackHref' or 'backHref'"),t.label=7;case 7:return[2]}}))}))},t.prototype.tapClose=function(t){var e=this;this._validateTapCount>0||(this._closeTapCount=t.tapCount,setTimeout((function(){t.tapCount<e._closeTapCount||(e.onClose.emit(t.srcEvent||t),e._closeTapCount=0)}),500))},t.prototype.tapValidate=function(t){var e=this;this.onValidateAndClose.observers.length?(this._validateTapCount=t.tapCount,setTimeout((function(){t.tapCount<e._validateTapCount||(1===e._validateTapCount?e.onValidate.emit(t.srcEvent||t):e._validateTapCount>=2&&e.onValidateAndClose.emit(t.srcEvent||t),e._validateTapCount=0)}),410)):this.onValidate.emit(t.srcEvent||t)},t}();fi.decorators=[{type:e.Component,args:[{selector:"app-toolbar",template:'<ion-header [class]="class">\n <ion-toolbar [color]="color">\n\n <ion-buttons slot="start">\n\n \x3c!-- back button --\x3e\n <ion-button class="back-button"\n *ngIf="canGoBack"\n (click)="doBackClick($event)"\n routerDirection="back" >\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n\n \x3c!-- show menu button --\x3e\n <ion-menu-toggle [hidden]="canGoBack || !canShowMenu">\n <ion-button>\n <ion-icon slot="icon-only" name="menu"></ion-icon>\n </ion-button>\n </ion-menu-toggle>\n\n <ng-content select="[slot=start]"></ng-content>\n </ion-buttons>\n\n <ion-title [innerHTML]="title"></ion-title>\n\n <ng-content select="ion-title"></ng-content>\n\n <ng-content select="ion-buttons[slot=end]"></ng-content>\n\n <ion-buttons slot="end" collapse="true">\n\n <ng-content select="[slot=end]"></ng-content>\n\n \x3c!-- search bar --\x3e\n <ion-searchbar #searchbar animated\n type="search"\n *ngIf="hasSearch"\n [class.cdk-visually-hidden]="!showSearchBar"\n show-cancel-button="always"\n (ionChange)="onSearch.emit($event)"\n (ionCancel)="toggleSearchBar()">\n </ion-searchbar>\n\n \x3c!-- search button --\x3e\n <ion-button (click)="toggleSearchBar()"\n *ngIf="hasSearch && !showSearchBar">\n <ion-icon slot="icon-only" name="search"></ion-icon>\n </ion-button>\n\n \x3c!-- close button --\x3e\n <ion-button *ngIf="hasClose"\n (tap)="tapClose($event)"\n class="visible-xs visible-sm visible-mobile">\n <ion-icon slot="icon-only" name="close"></ion-icon>\n </ion-button>\n\n \x3c!-- validate button --\x3e\n <ion-button *ngIf="hasValidate"\n (tap)="tapValidate($event)"\n class="visible-xs visible-sm visible-mobile">\n <ion-icon slot="icon-only" name="save"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n\n \x3c!-- progress bar --\x3e\n <mat-progress-bar [color]="color" [mode]="progressBarMode$ | async">\n </mat-progress-bar>\n</ion-header>\n',providers:[{provide:mi,useExisting:fi}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],fi.ctorParameters=function(){return[{type:z.Router},{type:M.IonRouterOutlet},{type:e.ChangeDetectorRef},{type:di,decorators:[{type:e.Optional}]}]},fi.propDecorators={title:[{type:e.Input}],color:[{type:e.Input}],class:[{type:e.Input}],backHref:[{type:e.Input}],defaultBackHref:[{type:e.Input}],hasValidate:[{type:e.Input}],hasClose:[{type:e.Input}],hasSearch:[{type:e.Input}],canGoBack:[{type:e.Input}],canShowMenu:[{type:e.Input}],onValidate:[{type:e.Output}],onClose:[{type:e.Output}],onValidateAndClose:[{type:e.Output}],onBackClick:[{type:e.Output}],onSearch:[{type:e.Output}],searchbar:[{type:e.ViewChild,args:["searchbar",{static:!0}]}]};var gi=function(t){function e(e){var n=t.call(this)||this;return n.translate=e,n.itemsPerPageLabel="Items per page",n.nextPageLabel="Next page",n.previousPageLabel="Previous page",n.getRangeLabel=function(t,e,n){var o=this.translate?this.translate.instant("COMMON.PAGINATOR.OF"):"of";if(0===n||0===e)return"0 "+o+" "+n;var r=t*e;return r+1+" - "+(r<(n=Math.max(n,0))?Math.min(r+e,n):r+e)+" "+o+" "+n},n.translate=e,e.onLangChange.subscribe((function(){return n.translateLabels()})),n.translateLabels(),n}return Ee(e,t),e.prototype.translateLabels=function(){this.itemsPerPageLabel=this.translate.instant("COMMON.PAGINATOR.ITEMS_PER_PAGE"),this.nextPageLabel=this.translate.instant("COMMON.PAGINATOR.NEXT_PAGE"),this.previousPageLabel=this.translate.instant("COMMON.PAGINATOR.PREVIOUS_PAGE")},e}(u.MatPaginatorIntl);gi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new gi(jt.ɵɵinject($t.TranslateService))},token:gi,providedIn:"root"}),gi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],gi.ctorParameters=function(){return[{type:F.TranslateService}]};var bi=function(){function t(t){this.progressBarService=t}return t.prototype.intercept=function(t,e){var n=this;return this.progressBarService.increase(),e.handle(t).pipe(N.tap((function(t){t instanceof Q.HttpResponse&&n.progressBarService.decrease()})),N.catchError((function(t,e){throw n.progressBarService.decrease(),t})))},t}();function yi(t){return"#"+Ci(t[0])+Ci(t[1])+Ci(t[2])}function vi(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null}function Ci(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function Ei(t,e,n){n=n?n/100:.5;var o=vi(t);if(!o)throw Error("Invalid hex color:"+t);var r=vi(e);if(!r)throw Error("Invalid hex color:"+e);return yi(o.map((function(t,e){return Math.round(t*n+r[e]*(1-n))})))}function wi(t,e){var n=vi(t);if(!n)throw Error("Invalid hex color:"+t);return!0===e?.299*n[0]+.587*n[1]+.114*n[2]>186?"#000000":"#FFFFFF":yi(n.map((function(t){return 255-t})))}var Ii=function(){},Oi=function(){function t(t,n,o,r){this.translate=t,this.cd=n,this.injector=o,this.formGroupDir=r,this._onChangeCallback=Ii,this._onTouchedCallback=Ii,this.readonly=!1,this.compact=!1,this.floatLabel="auto",this.onKeyupEnter=new e.EventEmitter,this.filterNumberInput=mn,this.selectInputContent=un}return Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition!==t&&(this._definition=t,this.type=null==t?void 0:t.type,this.cd.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.formControl.value},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){if(!this._definition)throw new Error("Missing mandatory attribute 'definition' in <app-form-field>.");if("object"!=typeof this._definition)throw new Error("Invalid attribute 'definition' in <app-form-field>. Should be an object.");if(!this.type)throw new Error("Invalid attribute 'definition' in <app-form-field>. Missing type !");this.checkAndResolveFormControl(),this.placeholder=this.placeholder||this._definition.label&&this.translate.instant(this._definition.label),this.required=je(this.required,je(this._definition.required,!1)),this.disabled=je(this.disabled,je(this._definition.disabled,!1)),this.updateTabIndex(),"double"===this.type?this.numberInputStep=this.computeNumberInputStep(this._definition):"enum"===this.type&&this._definition.values instanceof e.InjectionToken&&(this._definition.values=this.computeValuesFromToken(this._definition.values))},t.prototype.writeValue=function(t){"integer"!==this.type&&"double"!==this.type||!Number.isNaN(t)?"boolean"===this.type&&"string"==typeof t?t="false"!==t:"date"===this.type?t=io(t):"entity"===this.type&&Te(t)&&(t=null):t=null,t!==this.formControl.value&&(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)),this.cd.markForCheck()},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.setDisabledState=function(t){this.disabled!==t&&(this.disabled=t,this.cd.markForCheck())},t.prototype.markAsTouched=function(){this.formControl.touched&&(this.cd.markForCheck(),this._onTouchedCallback())},t.prototype.filterAlphanumericalInput=function(t){13===t.keyCode&&this.onKeyupEnter.observers.length&&this.onKeyupEnter.emit(t)},t.prototype.focus=function(){this.matInput&&this.matInput.nativeElement.focus()},t.prototype.getDisplayValueFn=function(t){if(t.autocomplete&&t.autocomplete.displayWith)return function(e){return t.autocomplete.displayWith(e)};var e=t.autocomplete&&t.autocomplete.attributes||["label","name"];return function(t){return t&&ze(t,e)}},t.prototype.getColorContrast=function(t){return Pe(t)?wi(t,!0):void 0},t.prototype.computeNumberInputStep=function(t){if(t.maximumNumberDecimals>0){var e="0.";if(t.maximumNumberDecimals>1)for(var n=0;n<t.maximumNumberDecimals-1;n++)e+="0";return e+="1"}return"1"},t.prototype.computeValuesFromToken=function(t){var e=this.injector.get(t);return Array.isArray(e)?e:[]},t.prototype.checkAndResolveFormControl=function(){var t=this;if(!this.formControl){if(this.formGroupDir){!this.formControlName&&this._definition.key&&(this.formControlName=this._definition.key);var e=(this.formGroupDir.directives||[]).find((function(e){return t.formControlName&&e.name===t.formControlName}));this.formControl=e&&e.control,this.formControl||(this.formControl=this.formGroupDir.form.get(this.formControlName))}if(!this.formControl)throw new Error("Missing attribute 'formControl' or 'formControlName' in <app-form-field> component.")}},t.prototype.updateTabIndex=function(){var t=this;this.tabindex&&-1!==this.tabindex&&setTimeout((function(){var e=yn(t.matInput);e&&(e.tabIndex=t.tabindex,t.cd.markForCheck())}))},t}();Oi.decorators=[{type:e.Component,args:[{selector:"app-form-field",template:'<ng-container [ngSwitch]="type">\n\n \x3c!-- integer --\x3e\n <mat-form-field *ngSwitchCase="\'integer\'" [floatLabel]="floatLabel" [class]="classList">\n <input matInput #matInput\n type="number"\n autocomplete="off"\n [readonly]="readonly"\n [min]="definition.minValue"\n [max]="definition.maxValue"\n pattern="-?[0-9]*"\n step="1"\n [appAutofocus]="autofocus"\n [placeholder]="placeholder"\n (keyup.enter)="onKeyupEnter.emit($event)"\n (keypress)="filterNumberInput($event, false)"\n [formControl]="formControl"\n [required]="required"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{(compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\') | translate:formControl.errors[\'min\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors[\'max\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'pattern\')">\n {{\'ERROR.FIELD_NOT_VALID_INTEGER\'| translate }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'integer\')">\n {{\'ERROR.FIELD_NOT_VALID_INTEGER\'| translate }}</mat-error>\n\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- double --\x3e\n <mat-form-field *ngSwitchCase="\'double\'" [floatLabel]="floatLabel" [class]="classList">\n\n <input matInput #matInput\n type="number"\n decimal="true"\n autocomplete="off"\n [min]="definition.minValue"\n [max]="definition.maxValue"\n [appAutofocus]="autofocus"\n [readonly]="readonly"\n [placeholder]="placeholder"\n [step]="numberInputStep"\n (keypress)="filterNumberInput($event, true)"\n [formControl]="formControl"\n [required]="required"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="formControl.hasError(\'min\')">\n {{ (compact ? \'ERROR.FIELD_MIN_COMPACT\' : \'ERROR.FIELD_MIN\')| translate:formControl.errors[\'min\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'max\')">\n {{(compact ? \'ERROR.FIELD_MAX_COMPACT\' : \'ERROR.FIELD_MAX\') | translate:formControl.errors[\'max\'] }}</mat-error>\n <mat-error *ngIf="formControl.hasError(\'maxDecimals\')">\n {{ (compact ? \'ERROR.FIELD_MAXIMUM_DECIMALS_COMPACT\' : \'ERROR.FIELD_MAXIMUM_DECIMALS\')| translate:{max:\n definition.maximumNumberDecimals} }}</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- boolean --\x3e\n <mat-boolean-field *ngSwitchCase="\'boolean\'" #matInput\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [compact]="compact"\n [tabindex]="tabindex"\n [readonly]="readonly">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-boolean-field>\n\n \x3c!-- date --\x3e\n <mat-date-field *ngSwitchCase="\'date\'" #matInput\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="compact ? (\'COMMON.DATE_PLACEHOLDER\'|translate): placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [readonly]="readonly"\n [compact]="compact"\n [tabindex]="tabindex"\n [autofocus]="autofocus">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-date-field>\n\n \x3c!-- date time --\x3e\n <mat-date-time-field *ngSwitchCase="\'dateTime\'"\n [class]="classList"\n [formControl]="formControl"\n [placeholder]="compact ? (\'COMMON.DATE_TIME_PLACEHOLDER\'|translate): placeholder"\n [floatLabel]="floatLabel"\n [required]="required"\n [readonly]="readonly"\n [compact]="compact"\n [tabindex]="tabindex"\n [autofocus]="autofocus">\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-date-time-field>\n\n \x3c!-- enum --\x3e\n <mat-form-field *ngSwitchCase="\'enum\'" [floatLabel]="floatLabel" [class]="classList">\n <mat-select [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required"\n [tabindex]="tabindex"\n (keyup.enter)="onKeyupEnter.emit($event)">\n <mat-option *ngFor="let item of definition.values" [value]="item.key || item">{{ (item.value || item) | translate }}</mat-option>\n </mat-select>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- color --\x3e\n <mat-form-field *ngSwitchCase="\'color\'" [floatLabel]="floatLabel" [class]="classList">\n\n <ion-icon margin-right name="color-fill" matPrefix></ion-icon>\n\n <input matInput autocomplete="off"\n [appAutofocus]="autofocus"\n [formControl]="formControl"\n [style.color]="getColorContrast(formControl.value)"\n [style.background]="formControl.value"\n [colorPicker]="formControl.value"\n (colorPickerChange)="writeValue($event)"\n [cpSaveClickOutside]="true"\n cpPosition="top"\n cpOutputFormat="hex"\n [cpOKButton]="false"\n [required]="required"/>\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- string --\x3e\n <mat-form-field *ngSwitchCase="\'string\'" [floatLabel]="floatLabel" [class]="classList">\n <input matInput #matInput\n autocomplete="off"\n [appAutofocus]="autofocus"\n [formControl]="formControl"\n [placeholder]="placeholder"\n [required]="required"\n [readonly]="readonly"\n [tabIndex]="tabindex"\n (click)="selectInputContent($event)"\n (keypress)="filterAlphanumericalInput($event)"\n (keyup.enter)="onKeyupEnter.emit($event)">\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </mat-form-field>\n\n \x3c!-- auto-complete --\x3e\n <mat-autocomplete-field *ngSwitchCase="\'entity\'"\n [class]="classList"\n [autofocus]="autofocus"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [formControl]="formControl"\n [config]="definition.autocomplete"\n [required]="required"\n [displayWith]="getDisplayValueFn(definition)">\n <ng-content select="[matPrefix]"></ng-content>\n <ng-content select="[matSuffix]"></ng-content>\n </mat-autocomplete-field>\n\n \x3c!-- multi auto-complete --\x3e\n <mat-chips-field *ngSwitchCase="\'entities\'"\n [class]="classList"\n [placeholder]="placeholder"\n [floatLabel]="floatLabel"\n [formControl]="formControl"\n [config]="definition.autocomplete"\n [required]="required"\n [displayWith]="getDisplayValueFn(definition)">\n <ng-content select="[matPrefix]"></ng-content>\n <ng-content select="[matSuffix]"></ng-content>\n </mat-chips-field>\n\n \x3c!-- other --\x3e\n <div *ngSwitchDefault>\n <mat-error *ngIf="type">Unknown type {{type}} for option {{definition.key}}. Please report this error.</mat-error>\n <mat-error *ngIf="!type">Error on option field. Please check console log for details.</mat-error>\n <div matSuffix>\n <ng-content select="[matSuffix]"></ng-content>\n </div>\n </div>\n\n</ng-container>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Oi})),multi:!0}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;position:relative}"]}]}],Oi.ctorParameters=function(){return[{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:e.Injector},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Oi.propDecorators={definition:[{type:e.Input}],required:[{type:e.Input}],readonly:[{type:e.Input}],disabled:[{type:e.Input}],formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],compact:[{type:e.Input}],floatLabel:[{type:e.Input}],tabindex:[{type:e.Input}],autofocus:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],onKeyupEnter:[{type:e.Output,args:["keyup.enter"]}],matInput:[{type:e.ViewChild,args:["matInput"]}]};var _i=function(){function t(t){this.onStart=new D.Subject,this._debug=!1,this._startByReadyFunction=!0,this._data=null,this._started=!1,this._startPromise=null,this._startPrerequisite=null,this._subscription=null,this._startPrerequisite=t?function(){return t.ready()}:function(){return Promise.resolve()}}return t.prototype.start=function(){var t=this;return this._startPromise?this._startPromise:this._started?Promise.resolve(this._data):(this._startPromise=this._startPrerequisite().then((function(){return t.ngOnStart()})).then((function(e){return t._data=e,t._started=!0,t._startPromise=void 0,t.onStart.next(t._data),t._data})).catch((function(e){return console.error("Failed to start a service: "+(e&&e.message||e),e),t._started=!1,t._startPromise=null,null})),this._startPromise)},t.prototype.stop=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this._subscription&&(this._subscription.unsubscribe(),this._subscription=null),[4,this.ngOnStop()];case 1:return e.sent(),this._started=!1,this._startPromise=void 0,[3,3];case 2:return t=e.sent(),console.error("Failed to stop a service: "+(t&&t.message||t),t),[3,3];case 3:return[2]}}))}))},t.prototype.restart=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this._startPromise?[4,this._startPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._started?[4,this.stop()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2,this.start()]}}))}))},Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"starting",{get:function(){return!!this._startPromise},enumerable:!1,configurable:!0}),t.prototype.ready=function(){var t=this;return this._started?Promise.resolve(this._data):this._startPromise?this._startPromise:this._startByReadyFunction?this.start():kn((function(){return t._started})).then((function(){return t._data}))},t.prototype.registerSubscription=function(t){return this._subscription=this._subscription||new D.Subscription,this._subscription.add(t)},t.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},t}();_i.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional}]}]};var xi=[{id:"beep-confirm",assetPath:"assets/audio/beep-confirm.mp3",vibration:250},{id:"beep-error",assetPath:"assets/audio/beep-error.mp3",vibration:1e3},{id:"startup",assetPath:"assets/audio/unfa-ping.mp3",vibration:[1,500,250,750]}],ki=function(t){function e(e,n,o,r){var i=t.call(this,e)||this;return i.platform=e,i.nativeAudio=n,i.vibration=o,i.audioManagement=r,i._audioMode=Z.AudioManagement.AudioMode.NORMAL,i._preloadedSounds={},i._htmlAudioCache={},i.start(),i}return Ee(e,t),e.prototype.playBeepConfirm=function(){return this.play("beep-confirm",{vibrate:this._audioMode===Z.AudioManagement.AudioMode.VIBRATE})},e.prototype.playBeepError=function(){return this.play("beep-error",{vibrate:!0})},e.prototype.playStartupSound=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.play("startup")]}))}))},e.prototype.preload=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return Ae(this._audioType)?[4,this.ready()]:[3,2];case 1:n.sent(),n.label=2;case 2:if("native"!==this._audioType)return[3,7];console.info("[audio] Preloading audio file '"+t.assetPath+"'..."),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,this.nativeAudio.preloadSimple(t.id,t.assetPath)];case 4:return n.sent(),console.info("[audio] Preloading audio file '"+t.assetPath+"' [OK]"),[3,6];case 5:return e=n.sent(),console.error("[audio] Unable to preload audio file '"+t.assetPath+"': "+(e&&e.message||e),e),[3,6];case 6:return[3,8];case 7:this._htmlAudioCache[t.id]=new Audio(t.assetPath),n.label=8;case 8:return this._preloadedSounds[t.id]=t,[2]}}))}))},e.prototype.play=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:i.sent(),i.label=2;case 2:if(!(n=this._preloadedSounds[t]))throw Error("Unable to find audio with id: "+t+". Please call preload() before playing a sound.");return this._audioMode===Z.AudioManagement.AudioMode.SILENT?[2]:(o=[],this._audioMode===Z.AudioManagement.AudioMode.NORMAL?"native"===this._audioType?o.push(this.nativeAudio.play(n.id)):(r=this._htmlAudioCache[t]||new Audio(n.assetPath),o.push(r.play())):Ae(n.vibration)&&Ae(e&&e.vibrate)&&((e=e||{}).vibrate=!0),je(e&&e.vibrate,!!n.vibration)&&o.push(this.vibrate(e&&e.vibrationTimes||n.vibration)),[2,(1===o.length?o[0]:Promise.all(o)).catch((function(e){console.error("[audio] Error while playing audio sound '"+t+"': "+(e&&e.message||e),e)}))])}}))}))},e.prototype.unload=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return Ae(this._audioType)?[4,this.ready()]:[3,2];case 1:n.sent(),n.label=2;case 2:if(this._preloadedSounds[t]=void 0,"native"!==this._audioType)return[3,7];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,this.nativeAudio.unload(t)];case 4:return n.sent(),[3,6];case 5:return e=n.sent(),console.error("[audio] Unable to unload audio '"+t+"': "+(e&&e.message||e),e),[3,6];case 6:return[3,8];case 7:this._htmlAudioCache[t].remove(),this._htmlAudioCache[t]=void 0,n.label=8;case 8:return[2]}}))}))},e.prototype.vibrate=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:e.sent(),e.label=2;case 2:return this.vibration?(this.vibration.vibrate(t||250),[2]):[2]}}))}))},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return t=this.platform.is("cordova"),this._audioType=t&&this.nativeAudio?"native":"html5",console.info("[audio] Starting audio provider {"+this._audioType+"}..."),t&&this.audioManagement?[4,this.readAudioMode()]:[3,2];case 1:n.sent(),n.label=2;case 2:return console.debug("[audio] Preloading audio sounds..."),[4,Promise.all(xi.map((function(n){return t||(n.vibration=void 0),e.preload(n)})))];case 3:return n.sent(),[2]}}))}))},e.prototype.readAudioMode=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return[4,this.audioManagement.getAudioMode()];case 1:return t=e.sent(),this._audioMode=t&&t.audioMode||Z.AudioManagement.AudioMode.NORMAL,console.debug("[audio] Detected device audio mode {"+t.label+"} ("+this._audioMode+")"),[2]}}))}))},e}(_i);ki.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ki(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Yt.NativeAudio,8),jt.ɵɵinject(Xt.Vibration,8),jt.ɵɵinject(Jt.AudioManagement,8))},token:ki,providedIn:"root"}),ki.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ki.ctorParameters=function(){return[{type:M.Platform},{type:X.NativeAudio,decorators:[{type:e.Optional}]},{type:J.Vibration,decorators:[{type:e.Optional}]},{type:Z.AudioManagement,decorators:[{type:e.Optional}]}]};var Si=function(){function t(t){this.data=t,this.hotkeys=Array.from(this.data)}return t.prototype.ngOnInit=function(){},t}();Si.decorators=[{type:e.Component,args:[{template:'<table>\n <tbody>\n <tr *ngFor="let keys of hotkeys">\n <td>{{ keys[1] | translate }}</td>\n\n <td class="text-right">\n <kbd>{{ keys[0] }}</kbd>\n </td>\n </tr>\n </tbody>\n</table>\n',styles:[":host table{border-collapse:collapse;width:100%;margin-bottom:1rem;color:#212529}:host th{font-weight:500;text-align:left;vertical-align:bottom;padding:.75rem;border-bottom:2px solid #dee2e6}:host td,:host th{border-top:1px solid #dee2e6}:host td{vertical-align:top;padding:.75rem .75rem .75rem 0}:host kbd{margin-right:6px;background-color:#fafbfc;border:1px solid #d1d5da;border-bottom-color:#c6cbd1;border-radius:3px;box-shadow:inset 0 -1px 0 #c6cbd1;color:#444d56;display:inline-block;font-size:12px;line-height:10px;padding:3px 5px;vertical-align:middle}"]}]}],Si.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[T.MAT_DIALOG_DATA]}]}]};var Ai=function(){function t(t,e,n,o){var r=this;this.eventManager=t,this.dialog=e,this.document=n,this.modalController=o,this._debug=!1,this._hotkeys=new Map,this._defaults={element:this.document,preventDefault:!0},this._debug&&console.debug("[hotkeys] Starting hotkeys service... Press Shift+? to get help modal."),this.addShortcut({keys:"shift.?"}).subscribe((function(){return r.openHelpModal()}))}return t.prototype.addShortcut=function(t){var e=this,n=Object.assign(Object.assign({},this._defaults),t),o="keydown."+n.keys;return Pe(n.description)?(this._debug&&console.debug("[hotkeys] Add shortcut {"+t.keys+"}: "+n.description),this._hotkeys.set(n.keys,n.description)):this._debug&&console.debug("[hotkeys] Add shortcut {"+t.keys+"}"),new D.Observable((function(r){var i=e.eventManager.addEventListener(n.element,o,(function(o){return Ie(e,void 0,void 0,(function(){var e;return Oe(this,(function(i){switch(i.label){case 0:return[4,this.modalController.getTop()];case 1:return(e=i.sent())&&e.component.name!==n.elementName||(o instanceof KeyboardEvent&&o.repeat||(n.preventDefault&&o.preventDefault(),this._debug&&console.debug("[hotkeys] Shortcut {"+t.keys+"} detected..."),r.next(o))),[2]}}))}))}));return function(){i(),e._hotkeys.delete(n.keys)}}))},t.prototype.openHelpModal=function(){this.dialog.open(Si,{width:"500px",data:this._hotkeys})},t}();Ai.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ai(jt.ɵɵinject(Kt.EventManager),jt.ɵɵinject(Vt.MatDialog),jt.ɵɵinject(Bt.DOCUMENT),jt.ɵɵinject(Gt.ModalController))},token:Ai,providedIn:"root"}),Ai.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ai.ctorParameters=function(){return[{type:K.EventManager},{type:T.MatDialog},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:M.ModalController}]};var Ti=function(){};Ti.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.MatCommonModule,T.MatDialogModule,F.TranslateModule.forChild()],exports:[Si],declarations:[Si],providers:[Ai]}]}];var Ri=480,Pi=640,Di=200,Ni=200,Fi=function(){function t(){}return t.prototype.readFromBlob=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!t)throw new Error("Illegal argument: missing file");return[4,new Promise((function(e,n){var o=new FileReader;o.addEventListener("load",(function(t){return e(o.result)}),!1),o.readAsDataURL(t)}))];case 1:return[2,e.sent()]}}))}))},t.prototype.readAndResizeFromUrl=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(Te(t))throw new Error("Illegal argument: missing path");(n=document.createElement("img")).crossOrigin="anonymous",r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,new Promise((function(r,i){n.addEventListener("load",o.createImageOnLoadResizeFn(r,i,e),!1),n.addEventListener("error",i),n.src=t}))];case 2:return[2,r.sent()];case 3:throw r.sent(),new Error("Failed to load and resize image {"+t+"}");case 4:return n.remove(),[7];case 5:return[2]}}))}))},t.prototype.readAndResizeFromBlob=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!t)throw new Error("Illegal argument: missing file");(n=document.createElement("img")).crossOrigin="anonymous",r.label=1;case 1:return r.trys.push([1,,3,4]),[4,new Promise((function(r,i){var a=new FileReader;a.addEventListener("load",(function(t){n.onload=o.createImageOnLoadResizeFn(r,i,e),n.src=a.result}),!1),a.readAsDataURL(t)}))];case 2:return[2,r.sent()];case 3:return n.remove(),[7];case 4:return[2]}}))}))},t.prototype.createImageOnLoadResizeFn=function(t,e,n){return function(o){var r,i=n&&n.thumbnail?Ni:n&&n.maxWidth||Pi,a=n&&n.thumbnail?Di:n&&n.maxHeight||Ri,s=o.target.width,l=o.target.height,c=document.createElement("canvas");try{if(n&&n.thumbnail){s>l?(s*=a/l,l=a):(l*=i/s,s=i),c.width=i,c.height=a,r=c.getContext("2d");var u=Math.trunc((i-s)/2+.5),d=Math.trunc((a-l)/2+.5);r.drawImage(o.target,u,d,i+-2*u,a+-2*d)}else s>l?s>i&&(l*=i/s,s=i):l>a&&(s*=a/l,l=a),c.width=s,c.height=l,(r=c.getContext("2d")).drawImage(o.target,0,0,c.width,c.height);var p=c.toDataURL();t(p)}catch(t){e(t)}finally{c.remove()}}},t}(),Mi=Zt,Li=function(){function t(t,e,n){var o=this;this.platform=t,this.http=e,this.environment=n,this._started=!1,this._debug=!n.production,t.ready().then((function(){return o.start()}))}return Object.defineProperty(t.prototype,"canUseFileSystem",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.getImages=function(t,e){var n=this;if(!this._started)throw new Error("Platform must be started first!");return xn((t||[]).map((function(t){return function(){return n.getImage(t,Object.assign({},e))}})))},t.prototype.getImage=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:if(n=e&&e.responseType||(this.canUseFileSystem?"file":"dataUrl"),o=this._debug,r=o&&Date.now(),o&&console.debug("[file] Fetching image {"+t+"} into "+n+"..."),-1===(i=t.lastIndexOf("/")))throw new Error("Invalid URL: "+t);if(a=i<t.length-1&&t.substring(i+1)||Mi(),"file"!==n||!this.canUseFileSystem)return[3,4];console.warn("WARN: [file] Fetching image {"+t+"} in local file..."),s=this._imageDirectory+a,d.label=1;case 1:return d.trys.push([1,3,,4]),[4,_n(this.http.get(t,{observe:"body",responseType:"blob",reportProgress:!1}))];case 2:return l=d.sent(),console.debug("[file] Getting blob :"+l.type),o&&console.debug("[file] Fetching image {"+t+"} into "+n+" [OK] in "+(Date.now()-r)+"ms"),[2,s];case 3:return c=d.sent(),console.error("[file] Error while download "+t+": "+(c&&c.message||c)),n="dataUrl",[3,4];case 4:return"dataUrl"!==n?[3,6]:[4,(new Fi).readAndResizeFromUrl(t,e)];case 5:return u=d.sent(),o&&console.debug("[file] Fetching image {"+t+"} into "+n+" [OK] in "+(Date.now()-r)+"ms"),[2,u];case 6:return[2,t]}}))}))},t.prototype.start=function(){this.canUseFileSystem,this._started=!0},t}();Li.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Li(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Qt.HttpClient),jt.ɵɵinject(me))},token:Li,providedIn:"root"}),Li.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[M.Platform,Q.HttpClient]}]}],Li.ctorParameters=function(){return[{type:M.Platform},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var ji=function(){function t(t){this.hotkeys=t,this._subscription=new D.Subscription,this.modalName="modal-toolbar",this.title="",this.color="primary",this.showSpinner=!1,this.validateIcon={icon:"checkmark"},this.cancel=new e.EventEmitter,this.validate=new e.EventEmitter}return t.prototype.ngOnInit=function(){var t=this;this.canValidate=je(this.canValidate,this.validate.observers.length>0),this._subscription.add(this.hotkeys.addShortcut({keys:"control.s",description:"COMMON.BTN_VALIDATE",elementName:this.modalName}).pipe(N.filter((function(){return t.canValidate}))).subscribe((function(e){return t.validate.emit(e)}))),this._subscription.add(this.hotkeys.addShortcut({keys:"escape",description:"COMMON.BTN_CLOSE",elementName:this.modalName}).subscribe((function(e){return t.cancel.emit(e)})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t}();ji.decorators=[{type:e.Component,args:[{selector:"app-modal-toolbar",template:'<ion-header>\n <ion-toolbar [color]="color">\n <ion-buttons slot="start">\n <ion-button visible-xs visible-sm visible-mobile\n (click)="cancel.emit()">\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n\n <ng-content select="[slot=start]"></ng-content>\n </ion-buttons>\n\n <ion-title [innerHTML]="title"></ion-title>\n\n <ng-content select="ion-title"></ng-content>\n\n <ng-content select="ion-buttons[slot=end]"></ng-content>\n\n <ion-buttons slot="end">\n\n <ng-content select="ion-button[slot=end]"></ng-content>\n\n <ion-spinner *ngIf="showSpinner"></ion-spinner>\n\n <ion-button visible-xs visible-sm visible-mobile\n *ngIf="canValidate"\n (click)="validate.emit($event)">\n <ion-icon slot="icon-only" *ngIf="validateIcon?.icon" [name]="validateIcon.icon"></ion-icon>\n <mat-icon slot="icon-only" *ngIf="validateIcon?.matIcon" >{{validateIcon.matIcon}}</mat-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],ji.ctorParameters=function(){return[{type:Ai}]},ji.propDecorators={modalName:[{type:e.Input}],title:[{type:e.Input}],color:[{type:e.Input}],showSpinner:[{type:e.Input}],canValidate:[{type:e.Input}],validateIcon:[{type:e.Input}],cancel:[{type:e.Output}],validate:[{type:e.Output}]};var Bi=function(){this.loading=!1,this.color="secondary"};Bi.decorators=[{type:e.Component,args:[{selector:"app-loading-spinner",template:'\n <ion-spinner *ngIf="loading; else content" [color]="color" [name]="name"></ion-spinner>\n <ng-template #content>\n <ng-content></ng-content>\n </ng-template>\n '}]}],Bi.propDecorators={loading:[{type:e.Input}],color:[{type:e.Input}],name:[{type:e.Input}]};var Ui=function(){function t(){}return t.getAlphabetMap=function(){if(!t.alphabetMap){this.alphabetMap={};for(var e=0;e<t.alphabet.length;e++)t.alphabetMap[t.alphabet.charAt(e)]=e}return t.alphabetMap},t.encode=function(e){if(0===e.length)return"";var n,o,r=[0];for(n=0;n<e.length;n++){for(o=0;o<r.length;o++)r[o]<<=8;r[r.length-1]+=e[n];var i=0;for(o=r.length-1;o>=0;o--)r[o]+=i,i=r[o]/58|0,r[o]%=58;for(;i;)r.unshift(i),i=r[0]/58|0,r[0]%=58}for(n=0;n<e.length-1&&0===e[n];n++)r.unshift(0);return r.map((function(e){return t.alphabet[e]})).join("")},t.decode=function(e){if(0===e.length)return new Uint8Array;var n,o,r=e.split("").map((function(e){return t.getAlphabetMap()[e]})),i=[0];for(n=0;n<r.length;n++){for(o=0;o<i.length;o++)i[o]*=58;i[i.length-1]+=r[n];var a=0;for(o=i.length-1;o>=0;o--)i[o]+=a,a=i[o]>>8,i[o]&=255;for(;a;)i.unshift(a),a=i[0]>>8,i[0]&=255}for(n=0;n<r.length-1&&0===r[n];n++)i.unshift(0);return new Uint8Array(i)},t}();Ui.alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Vi=require("scrypt-async"),qi=require("hash.js/lib/hash/sha/256"),$i=require("hash.js/lib/hash/sha/512"),Gi={sign:at.sign,box:at.box,hash:at.hash,verify:at.verify,util:require("tweetnacl-util"),constants:{crypto_sign_BYTES:64,SEED_LENGTH:32,SCRYPT_PARAMS:{SIMPLE:{N:2048,r:8,p:1,memory:-1},DEFAULT:{N:4096,r:16,p:1,memory:-1},SECURE:{N:16384,r:32,p:2,memory:-1},HARDEST:{N:65536,r:32,p:4,memory:-1},EXTREME:{N:262144,r:64,p:8,memory:-1}}}},Hi=function(){function t(){}return t.prototype.scryptKeypair=function(t,e,n){return new Promise((function(o){Vi(e,t,{N:n&&n.N||Gi.constants.SCRYPT_PARAMS.DEFAULT.N,r:n&&n.r||Gi.constants.SCRYPT_PARAMS.DEFAULT.r,p:n&&n.p||Gi.constants.SCRYPT_PARAMS.DEFAULT.p,dkLen:Gi.constants.SEED_LENGTH,encoding:"base64"},(function(t){o(t)}))})).then((function(t){var e=Gi.util.decodeBase64(t),n=Gi.sign.keyPair.fromSeed(e);return{publicKey:n.publicKey,secretKey:n.secretKey}}))},t.prototype.sign=function(t,e){return new Promise((function(n){for(var o=Gi.util.decodeUTF8(t),r=Gi.sign(o,e.secretKey),i=new Uint8Array(Gi.constants.crypto_sign_BYTES),a=0;a<i.length;a++)i[a]=r[a];n(Gi.util.encodeBase64(i))}))},t.prototype.verify=function(t,e,n){return new Promise((function(o){var r=Gi.util.decodeUTF8(t),i=Gi.util.decodeBase64(e),a=Ui.decode(n);o(Gi.sign.detached.verify(r,i,a))}))},t.prototype.sha256=function(t){return qi().update(t).digest("hex")},t.prototype.sha512=function(t){return $i().update(t).digest("hex")},t.prototype.encodeBase64=function(t){var e=Gi.util.decodeUTF8(t);return Gi.util.encodeBase64(e)},t}();Hi.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Hi},token:Hi,providedIn:"root"}),Hi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Wi=function(){function t(t){this.id=null,this.updateDate=null,this.__typename=t||null}return t.prototype.clone=function(t){var e=new this.constructor;return this.copy(e,t),e},t.prototype.copy=function(t,e){t.fromObject(this.asObject(e),e)},t.prototype.asObject=function(t){var e=Object.assign({},this);return t&&!0===t.keepTypename||delete e.__typename,(null==e.id||t&&!1===t.keepLocalId&&e.id<0)&&delete e.id,e.updateDate=io(this.updateDate),e},t.prototype.fromObject=function(t,e){this.id=t.id||0===t.id?t.id:void 0,this.updateDate=ao(t.updateDate),this.__typename=t.__typename||this.__typename},t.prototype.equals=function(t){return t&&this.id===t.id},t}();function zi(t,e){return!!t&&t instanceof e}var Ki,Qi=function(){function t(){}return t.isNotEmpty=function(t,e){return!!t&&null!==t[e]&&void 0!==t[e]},t.isEmpty=function(t,e){return!t||null===t[e]||void 0===t[e]},t.equals=function(t,e,n){return n=n||"id",t===e||Ae(t)&&Ae(e)||t&&e&&t[n]===e[n]},t.getPropertyByPath=function(e,n){if(!Ae(e)){var o=n.indexOf(".");if(-1===o)return e[n];var r=n.substring(0,o);if(!Ae(e[r])){if(e[r]&&"object"==typeof e[r])return t.getPropertyByPath(e[r],n.substring(o+1));throw new Error("Invalid form path: '"+r+"' is not an valid object.")}}},t.getArrayAsMap=function(t){return(t||[]).reduce((function(t,e){return t[e.key]=e.value,t}),{})},t.getMapAsArray=function(t){return Array.isArray(t)?t:Object.getOwnPropertyNames(t||{}).map((function(e){return{key:e,value:t[e]}}))},t.getPropertyArrayAsObject=function(t){return(t||[]).reduce((function(t,e){return t[e.key]=e.value,t}),{})},t.copyIdAndUpdateDate=function(t,e){t&&(e.id=Re(t.id)?t.id:e.id,e.updateDate=ao(t.updateDate)||e.updateDate,t.creationDate&&(e.creationDate=ao(t.creationDate)))},t.fillLocalIds=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return Fe(n=(t||[]).filter((function(t){return Ae(t.id)||0===t.id})))?[2]:[4,e(n[0],n.length)];case 1:return o=r.sent()+1,o=t.filter((function(t){return Re(t.id)&&t.id<0})).reduce((function(t,e){return Math.min(t,e.id)}),o),n.forEach((function(t){return t.id=--o})),[2]}}))}))},t.cleanIdAndUpdateDate=function(t){t&&(t.id=null,t.updateDate=null)},t.cleanIdsAndUpdateDates=function(e){(e||[]).forEach(t.cleanIdAndUpdateDate)},t.sort=function(t,e,n){return t.sort(this.sortComparator(e,n))},t.sortComparator=function(e,n){var o=n&&"asc"!==n?-1:1,r=e||"id";return function(e,n){var i=t.getPropertyByPath(e,r),a=t.getPropertyByPath(n,r);return t.compare(i,a,o)}},t.compare=function(e,n,o,r){return r=r||"id",t.isNotEmpty(e,r)&&t.isNotEmpty(n,r)?t.equals(e,n,r)?0:e[r]>n[r]?o:-1*o:e===n?0:e>n?o:-1*o},t.compareValue=function(t,e,n){return t===e?0:t>e?n:-1*n},t.filter=function(t,e,n){var o=this.searchTextFilter(e,n);return t.filter(o)},t.searchTextFilter=function(e,n){if(!Te(e)&&!Te(n)){var o=n.replace(/[.]/g,"[.]").replace(/[*]+/g,".*");if(".*"!==o){var r="^"+o,i="^.*"+o;if("string"==typeof e){var a=!e||-1===e.indexOf("."),s=e.toLowerCase().endsWith("label")||e.toLowerCase().endsWith("code"),l=new RegExp(s&&r||i,"i");return a?function(t){return l.test(t[e])}:function(n){return l.test(t.getPropertyByPath(n,e))}}var c=e.map((function(t){var e=t.toLowerCase().endsWith("label")||t.toLowerCase().endsWith("code");return new RegExp(e&&r||i,"i")}));return function(n){return-1!==e.findIndex((function(e,o){return c[o].test(t.getPropertyByPath(n,e))}))}}}},t.treeToArray=function(t){var e=this;return t?(t.children||[]).reduce((function(n,o){return o.parent=t,n.concat(e.treeToArray(o))}),[t]):null},t.listOfTreeToArray=function(t){var e=this;return t&&t.length?t.reduce((function(t,n){return t.concat(e.treeToArray(n))}),[]):null},t.treeFillParent=function(t){var e=this;if(!t)return null;(t.children||[]).forEach((function(n){n.parent=t,e.treeFillParent(n)}))},t.isLocal=function(t){return t&&Re(t.id)&&+t.id<0},t.isRemote=function(e){return e&&!t.isLocal(e)},t.isLocalId=function(t){return Re(t)&&+t<0},t}(),Yi=Object.freeze({name:"@sumaris-net/ngx-components",version:void 0,production:!0,baseUrl:"/",defaultLocale:"fr",defaultLatLongFormat:"DDMM",apolloFetchPolicy:"cache-first",listenRemoteChanges:!1,persistCache:!1,peerMinVersion:"1.8.0",defaultPeers:[{host:"localhost",port:8080},{host:"localhost",port:8081},{host:"192.168.0.45",port:8080},{host:"192.168.0.24",port:8080},{host:"192.168.0.29",port:8080},{host:"sih.sfa.sc",port:80},{host:"test.sumaris.net",port:443}],defaultAppName:"SUMARiS",defaultAndroidInstallUrl:"https://play.google.com/store/apps/details?id=net.sumaris.app",storage:{driverOrder:["sqlite","indexeddb","websql","localstorage"]},sourceUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/ngx-sumaris-components",reportIssueUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/ngx-sumaris-components/-/issues",forumUrl:"https://forum.sumaris.net",helpUrl:"https://gitlab.ifremer.fr/sih-public/sumaris/sumaris-doc/-/blob/master/user-manual/index_fr.md",defaultAuthValues:{username:"admin@sumaris.net",password:"admin"}}),Xi=function(){function t(){}return t.register=function(e,n){var o=$e(e,"VO");t.CLASSES_BY_NAME.set(o,n)},t.get=function(e){var n=t.CLASSES_BY_NAME.get(e);if(!n)throw new Error("Cannot found entity class '"+e+"'. Make sure it exists and has the @EntityClass decorator.");return n},t.fromObject=function(e,n){if(!e)return e;var o=n&&n.entityName||$e(e.__typename||(null==n?void 0:n.typename),"VO");if(!o)throw new Error("Missing one of 'value.__typename', 'opts.entityName', or 'opts.typename'.");var r=t.get(o);if("function"!=typeof r.fromObject)throw new Error("Cannot found the static function '"+o+".fromObject()'. Make sure this function has been declared and the entity class has the @EntityClass decorator");return r.fromObject(e,n)},t}();function Ji(t){return t=Object.assign({fromObjectReuseStrategy:"default"},t),function(e){var n,o;if(!Yi.production&&!(new e instanceof Wi))throw new Error("Class "+e.name+" must extends <<Entity>> to be able to use @FromObject!");var r=t.typename||e.name+"VO";if("clone"===t.fromObjectReuseStrategy){var i=(n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.fromObject=function(t,e){if(t){if(t instanceof i)return t.clone(e);var n=new i;return n.fromObject(t,e),n}},e.asObject=function(t,e){if(t)return t instanceof i?t.asObject(e):Object.assign({},t)},e}(e),n.TYPENAME=r,n);return Xi.register(r,i),i}var a=(o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.fromObject=function(t,e){if(t){if(t instanceof a)return t;var n=new a;return n.fromObject(t,e),n}},e.asObject=function(t,e){if(t)return t instanceof a?t.asObject(e):t},e}(e),o.TYPENAME=r,o);return Xi.register(r,a),a}}Xi.CLASSES_BY_NAME=new Map,t.Peer=Ki=function(t){function e(){return t.call(this,Ki.TYPENAME)||this}return Ee(e,t),e.parseUrl=function(t){var e=new URL(t);return Ki.fromObject({dns:e.hostname,port:Te(e.port)?void 0:e.port,useSsl:e.protocol&&(e.protocol.startsWith("https")||e.protocol.startsWith("wss")),path:qe(e.pathname)})},e.path=function(t){for(var e,n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(!t)throw new Error("Missing required argument 'peer'!");return n=(n||[]).map((function(t){return t.startsWith("./")?t.substring(2):t.startsWith("/")?t.substring(1):t})).filter(Pe),(e=[qe(Ki.fromObject(t).url)]).concat.apply(e,ke(n)).join("/")},e.prototype.asObject=function(e){return t.prototype.asObject.call(this,e)},e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.dns=e.dns||e.host,this.ipv4=e.ipv4,this.ipv6=e.ipv6,this.port=Re(e.port)?+e.port:void 0,this.pubkey=e.pubkey,this.useSsl=e.useSsl||443===this.port,this.path=e.path||""},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.pubkey===e.pubkey&&this.url===e.url},Object.defineProperty(e.prototype,"url",{get:function(){return(this.useSsl?"https://":"http://")+this.hostAndPort+(this.path||"")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAndPort",{get:function(){return(this.dns||this.ipv4||this.ipv6)+(this.port&&80!==this.port&&443!==this.port?":"+this.port:"")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reachable",{get:function(){return this.status&&"UP"===this.status},enumerable:!1,configurable:!0}),e}(Wi),t.Peer=Ki=we([Ji({typename:"PeerVO"})],t.Peer);var Zi=$.trigger("fadeInAnimation",[$.transition(":enter",[$.style({opacity:0}),$.animate(".3s",$.style({opacity:1}))])]),ta=$.trigger("fadeInOutAnimation",[$.transition(":enter",[$.style({opacity:0}),$.animate(".3s",$.style({opacity:1}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({opacity:0}))])]),ea=$.trigger("slideInOutAnimation",[$.state("*",$.style({position:"relative",top:0,left:0,right:0,bottom:0,opacity:1})),$.transition(":enter",[$.style({left:"400%",opacity:0}),$.animate(".3s ease-in-out",$.style({left:0,opacity:.8}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({left:"400%",opacity:0}))])]),na=$.trigger("slideUpDownAnimation",[$.state("*",$.style({transform:"translateY(0)",opacity:1})),$.transition(":enter",[$.style({transform:"translateY(-400%)",opacity:0}),$.animate(".3s ease-in-out",$.style({transform:"translateY(0)",opacity:1}))]),$.transition(":leave",[$.animate(".5s ease-in-out",$.style({transform:"translateY(-100%)",opacity:0}))])]),oa=function(){function t(){}return t.getResource=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:n=Object.assign({},n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,n).toPromise()];case 2:return[2,r.sent()];case 3:throw(o=r.sent())&&o.message?console.error("[network] Error on get request "+e+": "+o.message,o):console.error("[network] Error on get request "+e+": "+(o&&o.statusText)+" - "+JSON.stringify(o)),{code:o.status,message:"ERROR.UNKNOWN_NETWORK_ERROR"};case 4:return[2]}}))}))},t}(),ra=function(){};ra.getNodeInfo=function(e,n,o){return Ie(this,void 0,void 0,(function(){var r;return Oe(this,(function(i){if(!n)throw Error("Missing argument 'peer'.");return(r=n instanceof t.Peer?n.url:n).endsWith("/")&&(r=r.substr(0,r.length-1)),[2,oa.getResource(e,r+"/api/node/info",o)]}))}))};var ia={POSITIVE_INTEGER:/^\d+$/,VERSION_PART_REGEXP:/^[0-9]+|alpha[0-9]+|beta[0-9]+|rc[0-9]+|[0-9]+-SNAPSHOT$/},aa=function(){};function sa(t,e){var n=t.split("."),o=e.split(".");if(!la(n)||!la(o))return NaN;for(var r=0;r<n.length;++r){if(o.length===r)return 1;if(n[r]!==o[r])return n[r]>o[r]?1:-1}return n.length!=o.length?-1:0}function la(t){for(var e=0;e<t.length;e++){var n=ia.POSITIVE_INTEGER.test(t[e]);if(0===e&&!n)return!1;if(!n){if(!ia.VERSION_PART_REGEXP.test(t[e]))return!1;t[e]=t[e].replace("-SNAPSHOT",""),n=ia.POSITIVE_INTEGER.test(t[e])}n&&(t[e]=parseInt(t[e]))}return!0}aa.compare=sa,aa.isCompatible=function(t,e){return sa(t,e)<=0};var ca=function(){function t(t,n,o,r){this.viewCtrl=t,this.cd=n,this.http=o,this.environment=r,this._subscription=new D.Subscription,this.loading=!0,this.$peers=new D.Subject,this.peerMinVersion=this.environment.peerMinVersion,this.canCancel=!0,this.allowSelectDownPeer=!0,this.onRefresh=new e.EventEmitter}return Object.defineProperty(t.prototype,"peers",{set:function(t){var e=this;this._subscription.add(t.subscribe((function(t){return e.refreshPeers(t)})))},enumerable:!1,configurable:!0}),t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.selectPeer=function(t){(this.allowSelectDownPeer||t.reachable&&this.isCompatible(t))&&(console.debug("[select-peer-modal] Selected peer: {url: '"+t.url+"'}"),this.viewCtrl.dismiss(t))},t.prototype.isCompatible=function(t){return!this.peerMinVersion||t&&t.softwareVersion&&aa.isCompatible(this.peerMinVersion,t.softwareVersion)},t.prototype.refresh=function(t){this.loading=!0,this.onRefresh.emit(t)},t.prototype.refreshPeers=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:t=t||[],e=[],n=Promise.all(t.map((function(t){return Ie(r,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return[4,this.refreshPeer(t)];case 1:return n.sent(),this._subscription.closed?[2]:(e.push(t),e.sort((function(t,e){return t.reachable&&!e.reachable?-1:!t.reachable&&e.reachable?1:t.hostAndPort<e.hostAndPort?-1:t.hostAndPort>e.hostAndPort?1:0})),this.$peers.next(e),[2,t])}}))}))}))),this._subscription.add(this.$peers.subscribe((function(){return r.cd.markForCheck()}))),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._subscription.closed||console.error(o),[3,4];case 4:return this.loading=!1,this.cd.markForCheck(),[2]}}))}))},t.prototype.refreshPeer=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ra.getNodeInfo(this.http,t.url)];case 1:return e=o.sent(),t.status="UP",t.softwareName=e.softwareName,t.softwareVersion=e.softwareVersion,t.label=e.nodeLabel,t.name=e.nodeName,[3,3];case 2:return n=o.sent(),this._subscription.closed||n&&n.message&&console.error("[select-peer] "+n.message,n),t.status="DOWN",[3,3];case 3:return[2,t]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();ca.decorators=[{type:e.Component,args:[{selector:"select-peer-modal",template:'<ion-header>\n <ion-toolbar color="light">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()" *ngIf="canCancel"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'NETWORK.PEER.SELECT_MODAL.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n \x3c!-- loader --\x3e\n <ion-spinner *ngIf="loading; else endButtons"></ion-spinner>\n\n <ng-template #endButtons>\n \x3c!-- refresh button --\x3e\n <ion-button *ngIf="onRefresh.observers | isNotEmptyArray"\n [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="refresh($event)">\n <mat-icon slot="icon-only">refresh</mat-icon>\n </ion-button>\n </ng-template>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list>\n\n <ion-list-header>\n <ion-label class="ion-text-wrap">\n <p translate>NETWORK.PEER.SELECT_MODAL.HELP</p>\n </ion-label>\n </ion-list-header>\n\n <ion-item *ngFor="let peer of $peers | async"\n tappable\n (click)="selectPeer(peer)"\n detail\n @fadeInAnimation>\n\n \x3c!-- icon --\x3e\n <ion-avatar slot="start" *ngIf="peer.reachable" >\n <ion-img [src]="peer.favicon || (peer.url + \'/api/favicon\')"></ion-img>\n </ion-avatar>\n <ion-icon slot="start" *ngIf="!peer.reachable" name="desktop" color="medium" class="ion-text-center"></ion-icon>\n\n \x3c!-- Peer is UP --\x3e\n <ion-grid *ngIf="peer.reachable">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding">\n <ion-label class="ion-text-wrap">\n <ion-text color="dark">\n <h3>{{peer.hostAndPort}}{{peer.path}}</h3>\n </ion-text>\n <ion-text color="primary">\n <h4>{{peer.label}}</h4>\n </ion-text>\n </ion-label>\n </ion-col>\n <ion-col class="ion-no-padding">\n <ion-label class="ion-text-wrap ion-text-center" color="medium">\n <h3>{{peer.softwareName}}</h3>\n <h4 *ngIf="!peerMinVersion || isCompatible(peer); else invalidVersion">\n <small>v{{peer.softwareVersion}}</small>\n </h4>\n <ng-template #invalidVersion>\n <ion-text color="danger" [matTooltip]="\'NETWORK.PEER.SELECT_MODAL.NOT_COMPATIBLE_HELP\'|translate: {version: peerMinVersion} ">\n <h4 class="ion-color-danger">\n <small><mat-icon>warning</mat-icon>v{{peer.softwareVersion}}</small>\n </h4>\n </ion-text>\n </ng-template>\n </ion-label>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Peer is DOWN --\x3e\n <ion-label class="ion-text-wrap" *ngIf="!peer.reachable">\n <ion-text color="medium">\n <h3>{{peer.hostAndPort}}{{peer.path}}</h3>\n </ion-text>\n <ion-text color="danger">\n <h4>\n <small><ion-icon size="small" name="close-circle"></ion-icon></small>\n <span translate>NETWORK.PEER.OFFLINE</span>\n </h4>\n </ion-text>\n </ion-label>\n </ion-item>\n </ion-list>\n\n</ion-content>\n\n\n<ion-footer *ngIf="canCancel" hidden-xs hidden-sm hidden-mobile>\n\n <ion-toolbar>\n\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n\n \x3c!-- buttons --\x3e\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Zi],styles:["ion-item h4 ion-icon,ion-item h4 mat-icon{height:14px;width:14px;font-size:14px;line-height:14px}ion-item h4 small ion-icon,ion-item h4 small mat-icon{height:12px;width:12px;font-size:12px;line-height:12px}"]}]}],ca.ctorParameters=function(){return[{type:M.ModalController},{type:e.ChangeDetectorRef},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},ca.propDecorators={canCancel:[{type:e.Input}],allowSelectDownPeer:[{type:e.Input}],onRefresh:[{type:e.Input}]};var ua=Ht,da="settings",pa=["mobile","touchUi"],ha={accountInheritance:!0,locale:Yi.defaultLocale,latLongFormat:Yi.defaultLatLongFormat||"DDMM",pageHistoryMaxSize:3},ma=new e.InjectionToken("DefaultLocalSettings"),fa=new e.InjectionToken("LocalSettingsOptions"),ga=function(n){function o(t,e,o,r,i,a){var s=n.call(this,e)||this;return s.translate=t,s.platform=e,s.storage=o,s.environment=r,s.defaultSettings=i,s.onChange=new D.Subject,s.defaultSettings=Object.assign(Object.assign({},ha),s.defaultSettings),s._optionDefs=Object.values(a),s.resetData(),s._debug=!r.production,s._debug&&console.debug("[settings] Creating service"),s}return Ee(o,n),Object.defineProperty(o.prototype,"settings",{get:function(){return this._data||this.defaultSettings},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"locale",{get:function(){return this._data&&this._data.locale||this.translate.currentLang||this.translate.defaultLang},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"latLongFormat",{get:function(){return this._data&&this._data.latLongFormat||"DDMM"},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"usageMode",{get:function(){return this._data&&this._data.usageMode||(this.mobile?"FIELD":"DESK")},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"mobile",{get:function(){return this._data&&je(this._data.mobile,this.platform.is("mobile"))},set:function(t){this._data.mobile=t},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"touchUi",{get:function(){return this._data.touchUi},set:function(t){this._data.touchUi=t},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"pageHistory",{get:function(){return this._data&&this._data.pageHistory||[]},enumerable:!1,configurable:!0}),o.prototype.ngOnStart=function(){return console.info("[settings] Starting service..."),this._data.mobile=Re(this._data.mobile)?this._data.mobile:this.platform.is("mobile"),this._data.touchUi=this._data.mobile||this.platform.is("phablet")||this.platform.is("tablet"),this._data.usageMode=this.platform.is("android")?"FIELD":"DESK",this.restoreLocally()},o.prototype.isUsageMode=function(t){return this.usageMode===t},o.prototype.isOnFieldMode=function(t){return"FIELD"===(t||this.usageMode)},o.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=this._data||{},[4,this.storage.get(da)];case 1:return Pe(e=o.sent())&&(console.info("[settings] Restoring previous settings..."),n=JSON.parse(e),pa.forEach((function(t){delete n[t]})),t=Object.assign(t,n)),this.onChange.next(t),[2,t]}}))}))},o.prototype.setProperty=function(t,e){this._data&&("object"!=typeof t?(this._data.properties=this._data.properties||{},this._data.properties[t]=Ae(e)?void 0:e.toString()):this.setProperty(t.key,e))},o.prototype.getProperty=function(t,e){if("object"==typeof t)return this.getProperty(t.key,Ae(e)?t.defaultValue:e);var n=this._data&&this._data.properties&&this._data.properties[t];return Re(n)?n:e},o.prototype.getPropertyAsBoolean=function(t,e){var n=this.getProperty(t,e);return Re(n)?n&&"false"!==n:void 0},o.prototype.getPropertyAsInt=function(t,e){var n=this.getProperty(t,e);return Re(n)?parseInt(n):void 0},o.prototype.getPropertyAsNumbers=function(t,e){var n=this.getProperty(t,e);return"string"==typeof n?n.split(",").map(parseFloat)||void 0:Re(n)?[parseFloat(n)]:void 0},o.prototype.getPropertyAsStrings=function(t,e){var n=this.getProperty(t,e);return n&&n.split(",")||void 0},o.prototype.apply=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:o.sent(),o.label=2;case 2:return sn(n=Object.assign(Object.assign({},this._data),t),this._data)?[2]:(this._data=n,e&&e.persistImmediate?[4,this.persistLocally(!0)]:[3,4]);case 3:return o.sent(),[3,5];case 4:this.persistLocally(),o.label=5;case 5:return e&&!1===e.emitEvent||this.onChange.next(this._data),[2]}}))}))},o.prototype.applyProperty=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return(o={})[t]=e,[4,this.apply(o,n)];case 1:return r.sent(),[2]}}))}))},o.prototype.getPageSettings=function(t,e){if(this._data&&this._data.pages){var n=t.replace(/[/]/g,"__");return Pe(e)?Ze(this._data.pages,n+"."+e):this._data.pages[n]}},o.prototype.savePageSetting=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){return this._data=this._data||this.defaultSettings,this._data.pages=this._data.pages||{},o=t.replace(/[/]/g,"__"),n?(this._data.pages[o]=this._data.pages[o]||{},this._data.pages[o][n]=e):this._data.pages[o]=e,this.persistLocally(),[2]}))}))},o.prototype.getOfflineFeature=function(t){if(this._data&&this._data.offlineFeatures&&!Fe(this._data.offlineFeatures)){if(!t)throw Error("Missing 'featureName' argument");var e=(t=t.toLowerCase())+"#",n=this._data.offlineFeatures.find((function(n){return"string"==typeof n?n.toLowerCase().startsWith(e):"object"==typeof n&&n.name?n.name===t:void 0}));if(n){if("string"==typeof n){var o=n.substring(e.length);return console.debug("["+t+"] Last synchronization date: "+o),{name:t,lastSyncDate:o}}return n}}},o.prototype.getOfflineFeatureLastSyncDate=function(t){var e=this.getOfflineFeature(t);return e&&ao(e.lastSyncDate)},o.prototype.hasOfflineFeature=function(t){return t?Re(this.getOfflineFeature(t)):this._data&&Ne(this._data.offlineFeatures)},o.prototype.saveOfflineFeature=function(t){this._data=this._data||this.defaultSettings,this._data.offlineFeatures=this._data.offlineFeatures||[],t.name=t.name.toLowerCase();var e=t.name+"#",n=this._data.offlineFeatures.findIndex((function(n){return"string"==typeof n?n.toLowerCase().startsWith(e):"object"==typeof n&&n.name?n.name===t.name:void 0}));-1!==n?this._data.offlineFeatures[n]=t:this._data.offlineFeatures.push(t),this.persistLocally()},o.prototype.markOfflineFeatureAsSync=function(t){var e=this.getOfflineFeature(t);e?e.lastSyncDate=ua().toISOString():e={name:t.toLowerCase(),lastSyncDate:ua().toISOString()},this.saveOfflineFeature(e)},o.prototype.removeOfflineFeatures=function(){this._data&&this._data.offlineFeatures&&(this._data.offlineFeatures=[],this.persistLocally())},o.prototype.getFieldDisplayAttributes=function(t,e){var n=this._data&&this._data.properties&&this._data.properties["sumaris.field."+t+".attributes"];return n?n.split(","):e||["label","name"]},o.prototype.getPageFieldDefaultValue=function(t,e){return this.getPageSettings(t,"field."+e+".defaultValue")},Object.defineProperty(o.prototype,"optionDefs",{get:function(){return this._optionDefs},enumerable:!1,configurable:!0}),o.prototype.registerOption=function(t){if(-1!==this._optionDefs.findIndex((function(e){return e.key===t.key})))throw new Error("Additional additional property {"+t.key+"} already define.");this._debug&&console.debug("[settings] Adding additional property {"+t.key+"}",t),this._optionDefs.push(t)},o.prototype.registerOptions=function(t){var e=this;(t||[]).forEach((function(t){return e.registerOption(t)}))},o.prototype.addToPageHistory=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return n||this.fillPageHistoryDefaults(t,e),n=n||this._data.pageHistory,-1!==(o=n.findIndex((function(e){return e.path===t.path||t.path.startsWith(e.path+"/")})))?[3,1]:(console.debug("[settings] Adding page to history: ",t),n.splice(0,0,t),[3,4]);case 1:return r=n[o],n[o].path!==t.path?[3,2]:(console.debug("[settings] Updating existing page in history: ",t),n.splice(o,1),t.children=r.children||[],n.splice(0,0,t),[3,4]);case 2:return r.children=r.children||[],r.time=t.time,[4,this.addToPageHistory(t,e,r.children)];case 3:a.sent(),a.label=4;case 4:return n!==this._data.pageHistory?[3,6]:(this._data.pageHistory.length>this._data.pageHistoryMaxSize&&(i=n.splice(this._data.pageHistoryMaxSize,n.length-this._data.pageHistoryMaxSize),console.debug("[settings] Pages removed from history: ",i)),[4,this.applyProperty("pageHistory",n)]);case 5:a.sent(),a.label=6;case 6:return[2]}}))}))},o.prototype.removePageHistory=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:return n=n||this._data.pageHistory,o=n.findIndex((function(e){return e.path===t})),(r=-1!==o)?(console.debug("[settings] Remove page history: ",t),n.splice(o,1)):r=-1!==n.map((function(t){return t.children})).filter(Ne).findIndex((function(n){return i.removePageHistory(t,e,n)})),r&&n===this._data.pageHistory?[4,this.applyProperty("pageHistory",this._data.pageHistory)]:[3,2];case 1:a.sent(),a.label=2;case 2:return[2,r]}}))}))},o.prototype.clearPageHistory=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.applyProperty("pageHistory",[],{persistImmediate:!0})];case 1:return t.sent(),[2]}}))}))},o.prototype.resetData=function(){this._data=Object.assign(Object.assign({},this._data),this.defaultSettings),this._data.locale=this.translate.currentLang||this.translate.defaultLang,this._data.mobile=void 0,this._data.usageMode=void 0,this._data.pageHistory=[];var e=this.environment.defaultPeer&&t.Peer.fromObject(this.environment.defaultPeer);this._data.peerUrl=e&&e.url||void 0,this.started&&this.onChange.next(this._data)},o.prototype.persistLocally=function(t){var n=this;if(t)return this._data?(console.debug("[settings] Store local settings",this._data),this.storage.set(da,JSON.stringify(this._data))):(console.debug("[settings] Removing local settings from storage"),this.storage.remove(da));this._$persist||(this._$persist=new e.EventEmitter(!0),this._$persist.pipe(N.debounceTime(2e3),N.filter((function(){return n.started}))).subscribe((function(){return n.persistLocally(!0)}))),this._$persist.emit()},o.prototype.fillPageHistoryDefaults=function(t,e){if(!t||!t.title||!t.path)throw Error("Missing required argument 'page', 'page.path' or 'page.title'");if(t.time=t.time||ua(),!e||!1!==e.removeTitleSmallTag){var n=t.title.indexOf("</small>");-1!==n&&(t.title=t.title.substring(n+"</small>".length)),t.title=t.title.replace(/[ ]*class='hidden-xs hidden-sm'/g,"")}return e&&!1===e.removePathQueryParams||(t.path=t.path.replace(/[?].*$/,"")),t},o}(_i);ga.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new ga(jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(te.Storage),jt.ɵɵinject(me),jt.ɵɵinject(ma,8),jt.ɵɵinject(fa,8))},token:ga,providedIn:"root"}),ga.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[ma,fa]}]}],ga.ctorParameters=function(){return[{type:F.TranslateService},{type:M.Platform},{type:st.Storage},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ma]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[fa]}]}]};var ba=function(){function t(){}return t.show=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p,h,m,f,g,b=this;return Oe(this,(function(y){switch(y.label){case 0:if(!t||!e)return console.error("Missing required argument 'toastController' or 'translate'"),n.message instanceof M.IonicSafeString?console.info("[toasts] message: "+(e&&e.instant(n.message.value)||n.message.value)):"string"==typeof n.message&&console.info("[toasts] message: "+(e&&e.instant(n.message,n.messageParams)||n.message)),[2,Promise.resolve({})];if(this.counter++,o=this.stackSize,this.stackSize<4?this.stackSize++:(this.stackSize=1,o=0),r=function(){b.counter--,0===b.counter?b.stackSize=0:b.stackSize==o+1&&b.stackSize--},i=n.message&&n.message instanceof M.IonicSafeString?n.message.value:n.message,a=[i],n.header&&a.push(n.header),n.showCloseButton&&(n.buttons=n.buttons||[],-1!==(l=n.buttons.map((function(t){return"object"==typeof t&&t||void 0})).filter(Re).findIndex((function(t){return"close"===t.role})))?s=n.buttons[l]:(s={role:"close"},n.buttons.push(s)),s.text=s.text||"COMMON.BTN_OK",a.push(s.text)),c=n.cssClass&&"string"==typeof n.cssClass&&n.cssClass.split(",")||n.cssClass||[],n.type)switch(n.type){case"error":n.header="ERROR",c.push("danger");break;case"warning":c.push("accent");break;case"info":c.push("secondary")}return n.cssClass=c,u=e.instant(a),n.messageParams&&(u[i]=e.instant(i,n.messageParams)),s&&(s.text=u[s.text]),d=n.position||("ios"===n.mode?"bottom":"top"),n.enterAnimation||"middle"===d||(h=75*o-75*(p="top"===d?1:-1),m=p*o*75,n.enterAnimation=function(t,e){return M.createAnimation().addElement(t.querySelector(".toast-wrapper")).duration(250).fromTo("transform","translateY("+h+"px)","translateY("+m+"px)").fromTo("opacity","0","1")}),[4,t.create(Object.assign(Object.assign({position:d,duration:n.showCloseButton?1e4:4e3},n),{message:u[i],header:n.header&&u[n.header]||void 0}))];case 1:return f=y.sent(),n.onWillPresent&&n.onWillPresent(f),[4,f.present()];case 2:return y.sent(),Fe(n.buttons)?(f.onDidDismiss().then(r),[2,null]):[3,3];case 3:return[4,f.onDidDismiss()];case 4:return g=y.sent(),r(),[2,g]}}))}))},t}();ba.counter=0,ba.stackSize=0;var ya=6e5,va=3e5,Ca=function(n){function o(t,o,r,i,a,s,l,c,u,d,p,h,m){var f=n.call(this,o)||this;return f._document=t,f.platform=o,f.modalCtrl=r,f.cryptoService=i,f.storage=a,f.settings=s,f.cache=l,f.http=c,f.environment=u,f.network=d,f.splashScreen=p,f.translate=h,f.toastController=m,f.onPeerChanges=f.onStart.pipe(N.map((function(t){return t&&t.url})),N.filter(Pe),N.distinctUntilChanged()),f.onNetworkStatusChanges=new D.BehaviorSubject(null),f.onResetNetworkCache=new e.EventEmitter(!0),f._listeners={},f._mobile=f.platform.is("mobile"),f._mobile?(f._timerRefreshPeriod=ya,f._timerRefreshCondition=function(){return f.online}):(f._timerRefreshPeriod=va,f._timerRefreshCondition=function(){return!0}),f.resetData(),f.onStart.subscribe((function(){return f.ngOnAfterStart()})),f._debug=!u.production,f}return Ee(o,n),Object.defineProperty(o.prototype,"online",{get:function(){return"none"!==this.connectionType},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"offline",{get:function(){return"none"===this.connectionType},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"connectionType",{get:function(){return this._forceOffline?"none":this.started&&this._deviceConnectionType||"unknown"},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"peer",{get:function(){return this._data&&this._data.clone()},set:function(t){this._startingPeer=t,this.restart()},enumerable:!1,configurable:!0}),o.prototype.on=function(t,e){switch(t){case"start":return this.onStart.subscribe((function(){return e()}));case"peerChanged":return this.onPeerChanges.subscribe((function(){return e()}));case"statusChanged":return this.onNetworkStatusChanges.subscribe((function(t){return e(t)}));case"resetCache":return this.onResetNetworkCache.subscribe((function(){return e()}));default:return this.addListener(t,e)}},o.prototype.tryOnline=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:return this._forceOffline&&"none"!==this._deviceConnectionType?(n=Date.now(),(o=!e||!1!==e.showLoadingToast)?[4,this.showToast({message:"NETWORK.INFO.RETRY_TO_CONNECT",duration:1e4,onWillPresent:function(t){return r=t}})]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return d.trys.push([2,10,,11]),console.info("[network] Checking connection to pod..."),[4,this.settings.ready()];case 3:return(i=d.sent()).peerUrl?(a=t.Peer.parseUrl(i.peerUrl),[4,this.checkPeerAlive(a)]):[2,!1];case 4:return s=d.sent(),(l=s)?[4,this.checkPeerCompatible(s)]:[3,6];case 5:l=d.sent(),d.label=6;case 6:return l?(this.setForceOffline(!1),this._startingPeer=a,[4,this.restart()]):[3,9];case 7:return d.sent(),[4,this.emit("beforeTryOnlineFinish",this.online)];case 8:d.sent(),d.label=9;case 9:return[3,11];case 10:return c=d.sent(),console.error(c&&c.message||c),[3,11];case 11:return o?[4,nn(2e3-(Date.now()-n))]:[3,14];case 12:return d.sent(),r?[4,r.dismiss()]:[3,14];case 13:d.sent(),d.label=14;case 14:if(u=this.online)e&&!1===e.showOnlineToast||this.showToast({message:"NETWORK.INFO.ONLINE",type:"info"});else if(e&&!0===e.showOfflineToast)return[2,this.showOfflineToast({showRetryButton:!1})];return[2,this.started&&u]}}))}))},o.prototype.showOfflineToast=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.online?[2]:t&&!1===t.showRetryButton?[3,3]:[4,this.showToast({message:t&&t.message||"ERROR.NETWORK_REQUIRED",type:"warning",showCloseButton:!0,duration:1e5,buttons:[{role:"refresh",text:this.translate.instant("NETWORK.BTN_CHECK_ALIVE")}]})];case 1:return(e=n.sent())&&"refresh"===e.role?this.online?[2,!0]:[4,this.tryOnline({showOfflineToast:!1,showOnlineToast:je(t&&t.showRetrySuccessToast,!0),showLoadingToast:je(t&&t.showRetryLoadingToast,!0)})]:[2,!1];case 2:if(n.sent())return t&&t.onRetrySuccess&&setTimeout(t.onRetrySuccess),[2,!0];t=Object.assign(Object.assign({},t),{showRetryButton:!1,showCloseButton:!0}),n.label=3;case 3:return this.showToast(Object.assign({message:"ERROR.NETWORK_REQUIRED",type:"error"},t)),[2,!1]}}))}))},o.prototype.checkPeerAlive=function(e,n){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return(e=e||this.peer)?[3,2]:[4,this.settings.ready()];case 1:if(!(n=r.sent()).peerUrl)return[2,void 0];e=t.Peer.parseUrl(n.peerUrl),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getNodeInfo(e)];case 3:return[2,r.sent()];case 4:return o=r.sent(),console.debug("[network] Cannot get /api/node/info from peer: "+(o&&o.message||o),o),[2,void 0];case 5:return[2]}}))}))},o.prototype.checkPeerCompatible=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.environment.peerMinVersion?(n=t&&t.softwareVersion&&aa.isCompatible(this.environment.peerMinVersion,t.softwareVersion))||e&&!1===e.showToast?[3,2]:[4,this.showToast({type:"error",message:"NETWORK.ERROR.NOT_COMPATIBLE_PEER",messageParams:{version:this.environment.peerMinVersion},showCloseButton:!0})]:[2,!0];case 1:o.sent(),o.label=2;case 2:return[2,n]}}))}))},o.prototype.getNodeInfo=function(e){if(e=e||this.peer){var n=zi(e,t.Peer)?e.url:e;return n.endsWith("/")&&(n=n.substr(0,n.length-1)),this.get(n+"/api/node/info")}},o.prototype.setForceOffline=function(t,e){if(t=je(t,!0),this._forceOffline!==t){var n=this.connectionType;this._forceOffline=t;var o=this.connectionType;n!==o&&(console.info("[network] Connection changed to {"+o+"}"),this.onNetworkStatusChanges.next(o),"none"!==o||e&&!1===e.showToast||this.showToast({message:"NETWORK.INFO.OFFLINE_HELP"}))}},o.prototype.showSelectPeerModal=function(t){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return t=t||{},n=new e.EventEmitter,o=n.pipe(N.mergeMap((function(t){return a.getDefaultPeers()})),N.map((function(t){return t||[]}))),[4,this.modalCtrl.create({component:ca,componentProps:{onRefresh:n,peers:o,canCancel:je(t.canCancel,!0),allowSelectDownPeer:je(t.allowSelectDownPeer,!0)},keyboardClose:!0,showBackdrop:!0})];case 1:return[4,(r=s.sent()).present()];case 2:return s.sent(),n.emit(),[4,r.onWillDismiss()];case 3:return i=s.sent().data,n.complete(),[2,i&&i||void 0]}}))}))},o.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){return e=this._debug&&Date.now(),console.info("[network] Clearing all caches..."),[2,this.cache.clearAll().then((function(){if(!t||!1!==t.emitEvent&&n.onResetNetworkCache.observers.length)return n.onResetNetworkCache.emit(),nn(500)})).then((function(){n._debug&&console.debug("[network] All cache cleared, in "+(Date.now()-e)+"ms")}))]}))}))},o.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[network] Starting network...",this._startingPeer),(e=this._startingPeer)?[3,2]:[4,this.restoreLocally()];case 1:e=n.sent(),n.label=2;case 2:!(t=e)&&this.splashScreen&&this.splashScreen.hide(),n.label=3;case 3:return t?[3,5]:(console.debug("[network] No peer defined. Asking user to choose a peer."),[4,this.showSelectPeerModal({allowSelectDownPeer:!1})]);case 4:return t=n.sent(),[3,3];case 5:return console.info("[network] Starting service [OK] {peer: '"+t.url+"', online: "+this.online+"}"),[2,t]}}))}))},o.prototype.ngOnAfterStart=function(){var t;return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.settings.apply({peerUrl:this._data.url})];case 1:return n.sent(),this.onDeviceConnectionChanged((null===(t=this.network)||void 0===t?void 0:t.type)||"unknown"),this.startRefreshTimer(),this.network&&(this.registerSubscription(this.network.onDisconnect().subscribe((function(){return e.onDeviceConnectionChanged("none")}))),this.registerSubscription(this.network.onConnect().subscribe((function(){return e.onDeviceConnectionChanged(e.network.type)})))),[2]}}))}))},o.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.resetData(),!1===this._timerRefreshCondition()&&this.stopRefreshTimer(),[2]}))}))},o.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return[4,this.storage.get(da)];case 1:return e=a.sent(),(n=e&&JSON.parse(e)||void 0)&&n.peerUrl?(console.debug("[network] Use peer {"+n.peerUrl+"} (found in the local storage)"),[2,t.Peer.parseUrl(n.peerUrl)]):this.environment.defaultPeer?[2,t.Peer.fromObject(this.environment.defaultPeer)]:(o=this._document&&this._document.location)&&o.protocol&&o.protocol.startsWith("http")?(r=this._document.location.host,i=t.Peer.parseUrl(""+this._document.location.protocol+r+this.environment.baseUrl),[4,this.checkPeerAlive(i)]):[3,3];case 2:if(a.sent())return[2,i];a.label=3;case 3:return[2,void 0]}}))}))},o.prototype.stopRefreshTimer=function(){this._timerSubscription&&(this._timerSubscription.unsubscribe(),this._timerSubscription=void 0)},o.prototype.startRefreshTimer=function(){var t,e=this;this._timerSubscription||(console.info("[network] Starting refresh timer, every "+this._timerRefreshPeriod+"ms..."),this._timerSubscription=D.timer(this._timerRefreshPeriod,this._timerRefreshPeriod).pipe(N.filter(this._timerRefreshCondition),N.tap((function(){return console.debug("[network] Checking connection to pod...")})),N.mergeMap((function(){return e.checkPeerAlive(e.peer)})),N.filter((function(e){return!!e!=!!t})),N.tap((function(e){return t=e})),N.mergeMap((function(t){return e.checkPeerCompatible(t,{showToast:!0})}))).subscribe((function(t){t&&e.offline?(e.setForceOffline(!1),e.restart()):!t&&e.online&&(e.setForceOffline(!0),e.stop())})),this._timerSubscription.add((function(){return console.debug("[network] Refresh timer stopped")})))},o.prototype.get=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){return(n=t).startsWith("http://")||n.startsWith("https://")||((o=this.peer&&this.peer.url).endsWith("/")&&(o=o.substr(0,o.length-1)),t.startsWith("/")||(t="/"+t),n=o+t),[2,oa.getResource(this.http,n,e)]}))}))},o.prototype.onDeviceConnectionChanged=function(t){(t=(t||"unknown").toLowerCase()).startsWith("cell")&&(t="cell"),t!==this._deviceConnectionType&&(this._deviceConnectionType=t,this._forceOffline||(console.info("[network] Connection changed to {"+this._deviceConnectionType+"}"),this.onNetworkStatusChanges.next(this._deviceConnectionType),"none"===this._deviceConnectionType&&(this._mobile?(this._forceOffline=!0,this.showToast({message:"NETWORK.INFO.OFFLINE_HELP"})):this.showToast({message:"NETWORK.INFO.OFFLINE"}),this.stop())))},o.prototype.resetData=function(){this._data=null},o.prototype.getDefaultPeers=function(){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){return e=(this.environment.defaultPeers||[]).map(t.Peer.fromObject),[2,Promise.resolve(e)]}))}))},o.prototype.showToast=function(t){return ba.show(this.toastController,this.translate,t)},o.prototype.addListener=function(t,e){var n=this;return this._listeners[t]=this._listeners[t]||[],this._listeners[t].push(e),new D.Subscription((function(){var o=n._listeners[t].indexOf(e);-1!==o&&n._listeners[t].splice(o,1)}))},o.prototype.emit=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){return Ne(n=this._listeners[t])?(console.info("[network-service] Trigger "+t+" hook: Executing "+n.length+" callbacks..."),[2,Promise.all(n.map((function(n){var o=n(e);if(o)return o.catch((function(e){return console.error("Error while executing hook "+t,e)}))})))]):[2]}))}))},o}(_i);Ca.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ca(jt.ɵɵinject(Bt.DOCUMENT),jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Gt.ModalController),jt.ɵɵinject(Hi),jt.ɵɵinject(te.Storage),jt.ɵɵinject(ga),jt.ɵɵinject(ee.CacheService),jt.ɵɵinject(Qt.HttpClient),jt.ɵɵinject(me),jt.ɵɵinject(ne.Network,8),jt.ɵɵinject(oe.SplashScreen,8),jt.ɵɵinject($t.TranslateService,8),jt.ɵɵinject(Gt.ToastController,8))},token:Ca,providedIn:"root"}),Ca.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ca.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:M.Platform},{type:M.ModalController},{type:Hi},{type:st.Storage},{type:ga},{type:dt.CacheService},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ut.Network,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:M.ToastController,decorators:[{type:e.Optional}]}]};var Ea=0,wa=1,Ia=2,Oa=3,_a=4,xa=5,ka=6,Sa=7,Aa=8,Ta=9,Ra=8,Pa=10,Da=11,Na=12,Fa=13,Ma=14,La=15,ja=104,Ba=350,Ua=351,Va=401,qa=601,$a=602,Ga=700,Ha=701,Wa=401,za=403,Ka=404,Qa=520,Ya=521,Xa=553,Ja="entities",Za=function(){function t(t,e,n){this.name=t,this.storage=e,this._onChange=new D.BehaviorSubject(!0),this._dirty=!1,this.policy=n||{},this.reset({emitEvent:!1}),this._dirty=!1,this._loaded=!1,this._storageKey="entities#"+t,this._mapToLightEntity=this.createLightEntityMapFn(this.policy)}return Object.defineProperty(t.prototype,"cache",{get:function(){return this._cache},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this._dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isByIdMode",{get:function(){return"by-id"===this.policy.mode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storageKeyById",{get:function(){return this._storageKey+"#ids"},enumerable:!1,configurable:!0}),t.prototype.nextValue=function(){return this._sequence=this._sequence-1,this._dirty=!0,this._sequence},t.prototype.currentValue=function(){return this._sequence},t.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return!this._mapToLightEntity||e&&!1===e.fullLoad?[3,2]:[4,this.loadFullEntity(t,e)];case 1:return[2,n.sent()];case 2:return[2,this.loadCachedEntity(t,e)]}}))}))},t.prototype.watchAll=function(t,e){var n=this;return this._mapToLightEntity&&e&&!0===e.fullLoad?(console.warn("[entity-store] WARN: Watching full entities, splited by id in entity store. This can be long! Please make sure you need full entities here."),this._onChange.pipe(N.map((function(e){return n.reduceAndSort(n._cache,t)})),N.mergeMap((function(t){return Promise.all((t.data||[]).map((function(t){return n.loadFullEntity(t.id,e)}))).then((function(e){return{data:e,total:t.total}}))})))):this._onChange.pipe(N.map((function(e){return n.reduceAndSort(n._cache,t)})))},t.prototype.loadAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return n=this.reduceAndSort(this._cache,t),this._mapToLightEntity&&Ne(n.data)&&e&&!0===e.fullLoad?(o=n,[4,xn((n.data||[]).map((function(t){return function(){return r.load(t.id)}})))]):[3,2];case 1:o.data=i.sent(),i.label=2;case 2:return[2,n]}}))}))},t.prototype.save=function(t,e){var n=Re(t.id)&&this._statusById.get(t.id)||{index:void 0};return Ae(n.index)?(Ae(t.id)?t.id=this.nextValue():+t.id<0&&+t.id>this._sequence&&(console.warn("Trying to save a local entity with an id > sequence. Will replace id by sequence next value"),t.id=this.nextValue()),this._statusById.set(t.id,n),n.index=this._cache.push(t)-1):this._cache[n.index]=t,n.dirty=!0,this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),t},t.prototype.saveAll=function(t,e){var n,o=this;return!Fe(t)||e&&!0===e.reset?(console.info("[entity-storage] Saving "+t.length+" "+this.name+"(s)"),Fe(this._cache)||e&&e.reset?this.setEntities(t,{emitEvent:!1}):n=t.map((function(t){return o.save(t,{emitEvent:!1})})),this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),n||this._cache.slice()):t},t.prototype.delete=function(t,e){var n=Re(t)?this._statusById.get(t):void 0,o=n?n.index:void 0;if(!Ae(o)){var r=this._cache[o];if(r)return this._cache[o]=void 0,this._statusById.delete(r.id),this.isByIdMode&&this.storage.remove(this._storageKey+"#"+t),this._dirty=!0,e&&!1===e.emitEvent||this.emitEvent(),r}},t.prototype.deleteMany=function(t,e){var n=this,o=(t||[]).map((function(t){return n.delete(t,{emitEvent:!1})})).filter(Re);return o.length?(e&&!1===e.emitEvent||this.emitEvent(),o):[]},t.prototype.reset=function(t){this._cache=[],this._sequence=0,this._statusById=new Map,this._dirty=!0,this._loaded=!0,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.persist=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return(t=Object.assign({skipIfPristine:this.policy.skipNonLocalEntities},t)).skipIfPristine&&!this._dirty?(console.debug("[entity-storage] Persisting "+this.name+" not need. Skip"),[2,this._cache.length]):(e=this.isByIdMode&&Array.from(this._statusById.values()).filter((function(e){return!t.skipIfPristine||e&&e.dirty})).map((function(t){return t.index})),n=this._cache.slice(),this.markAsPristine({emitEvent:!1}),e&&this._mapToLightEntity&&e.forEach((function(t){return o._cache[t]=o._mapToLightEntity(n[t])})),Fe(n)?[4,this.storage.remove(this._storageKey)]:[3,2]);case 1:return r.sent(),[3,7];case 2:return this.isByIdMode?[4,this.storage.set(this.storageKeyById,n.filter(Re).map((function(t){return t.id})))]:[3,5];case 3:return r.sent(),[4,Promise.all(e.map((function(t){var e=n[t];return console.debug("[entity-storage] Persisting "+o.name+"#"+e.id+"..."),o.storage.set(o._storageKey+"#"+e.id,e)})))];case 4:return r.sent(),console.info("[entity-storage] Persisting "+e.length+"/"+n.length+" "+this.name+"(s)..."),[3,7];case 5:return console.info("[entity-storage] Persisting "+n.length+" "+this.name+"(s)..."),[4,this.storage.set(this._storageKey,n)];case 6:r.sent(),r.label=7;case 7:return[2,n.length]}}))}))},t.prototype.restore=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l,c=this;return Oe(this,(function(u){switch(u.label){case 0:return[4,Promise.all([this.storage.get(this._storageKey),this.storage.get(this.storageKeyById)])];case 1:return n=u.sent(),o=n[0]&&Array.isArray(n[0])?n[0]:null,r=n[1]&&Array.isArray(n[1])?n[1]:null,i=!1,this.isByIdMode?Re(r)?[4,xn((s=r.map((function(t){return c._storageKey+"#"+t}))).map((function(t){return function(){return c.storage.get(t)}})))]:[3,3]:[3,5];case 2:return e=u.sent(),[3,4];case 3:Re(o)&&(e=o.filter((function(t){return t&&Re(t.id)})),i=!0,a=[this._storageKey]),u.label=4;case 4:return[3,8];case 5:return Re(o)?(e=o.filter((function(t){return t&&Re(t.id)})),[3,8]):[3,6];case 6:return Re(r)?[4,xn((s=r.map((function(t){return c._storageKey+"#"+t}))).map((function(t){return function(){return c.storage.get(t)}})))]:[3,8];case 7:e=u.sent(),i=!0,a=ke(s,[this.storageKeyById]),u.label=8;case 8:if(Ne(e)&&(e.length>=1e3&&console.warn("[entity-storage] - Restoring "+e.length+" "+this.name+". Check if not too many elements?!"),this._mapToLightEntity&&!i&&(e=e.map(this._mapToLightEntity))),this.setEntities(e||[],Object.assign(Object.assign({},t),{emitEvent:!1})),this._dirty=!1,!i)return[3,14];u.label=9;case 9:return u.trys.push([9,13,,14]),console.warn("[entity-storage] - Migrate "+this.name+" into {mode: '"+this.policy.mode+"'}..."),[4,this.persist({skipIfPristine:!1})];case 10:return u.sent(),Ne(a)?[4,xn(a.map((function(t){return function(){return c.storage.remove(t)}})))]:[3,12];case 11:u.sent(),u.label=12;case 12:return[3,14];case 13:throw l=u.sent(),console.error(l),{code:Da,message:"ERROR.ENTITY_STORAGE_MIGRATION_FAILED",details:l};case 14:return t&&!1===t.emitEvent||this.emitEvent(),[2,this._cache.length]}}))}))},t.prototype.markAsDirty=function(t){this._dirty=!0,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.markAsPristine=function(t){var e,n;try{for(var o=_e(this._statusById.values()),r=o.next();!r.done;r=o.next()){var i=r.value;Re(i)&&(i.dirty=!1)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}this._dirty=!1,t&&!1===t.emitEvent||this.emitEvent()},t.prototype.loadCachedEntity=function(t,e){var n=this._statusById.get(t),o=n&&n.index;if(!Ae(o))return Object.freeze(this._cache[o])},t.prototype.loadFullEntity=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this._statusById.get(t),Ae(n=e&&e.index)?[2,void 0]:!1!==e.dirty?[3,2]:(console.debug("[entity-storage] Full reloading "+this.name+"#"+t+"..."),[4,this.storage.get(this._storageKey+"#"+t)]);case 1:if(o=r.sent())return[2,o];r.label=2;case 2:return[2,this._cache[n]]}}))}))},t.prototype.setEntities=function(t,e){var n=this;t=(t||[]).filter((function(t){return Re(t)&&(!n.policy.skipNonLocalEntities||+t.id<0)})),this._cache=t,this._sequence=this._cache.reduce((function(t,e){return+e.id<0?Math.min(t,+e.id):t}),0),this._statusById.clear(),this._cache.forEach((function(t,e){n._statusById.set(t.id,{index:e,dirty:!1})})),this._loaded=!0,e&&!1===e.emitEvent||this.emitEvent()},t.prototype.reduceAndSort=function(t,e){if(Fe(t))return{data:[],total:0};if(t=t.filter(Re),!e)return{data:t,total:t.length};e.filter&&(t=t.filter(e.filter));var n=t.length;return 0===e.size?{data:[],total:n}:(t.length&&e.sortBy&&Qi.sort(t,e.sortBy,e.sortDirection),e.offset>0?t=e.offset>=t.length||0===e.size?[]:e.size>0&&e.offset+e.size<t.length?t.slice(e.offset,e.offset+e.size):t.slice(e.offset):e.size>0?t=t.slice(0,e.size):e.size,{data:t,total:n})},t.prototype.createLightEntityMapFn=function(t){if("by-id"===t.mode&&!Fe(t.lightFieldsExcludes)){var e=Object.freeze(this.policy.lightFieldsExcludes.reduce((function(t,e){return t[e]=void 0,t}),{}));return function(t){return t?Object.assign({},t,e):void 0}}},t.prototype.emitEvent=function(){this._onChange.next(!0)},t}(),ts=new e.InjectionToken("localStorageTypePolicies"),es=function(t){function n(n,o,r,i,a){var s=t.call(this,n)||this;return s.platform=n,s.progressBarService=o,s.storage=r,s.environment=i,s._$save=new e.EventEmitter(!0),s._dirty=!1,s._saving=!1,s._typePolicies=a||{},s._saveTimerPeriod=i.storageSavePeriodMs||1e4,s._data={},s._debug=!i.production,s._debug&&console.debug("[entities-storage] Creating service"),s}return Ee(n,t),Object.defineProperty(n.prototype,"dirty",{get:function(){return this._dirty||Object.values(this._data).some((function(t){return t.dirty}))},enumerable:!1,configurable:!0}),n.prototype.watchAll=function(t,e,o){var r=this;if(!this.started)return D.defer((function(){return r.ready()})).pipe(N.switchMap((function(){return r.watchAll(t,e,o)})));this.progressBarService.increase();var i=e&&e.trash?n.TRASH_PREFIX+t:t,a=this.getEntityStore(i,{create:!0}).watchAll(e,o);return a.pipe(N.first()).subscribe((function(){return r.progressBarService.decrease()})),a},n.prototype.loadAll=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:try{return this.progressBarService.increase(),this._debug&&console.debug("[entities-storage] Loading "+t+"..."),(o=this.getEntityStore(t,{create:!1}))?[2,o.loadAll(e,n)]:[2,{data:[],total:0}]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.load=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.ready()];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),this.progressBarService.increase(),(o=this.getEntityStore(e,{create:!1}))?[4,o.load(t,n)]:[2,void 0];case 3:return[2,r.sent()];case 4:return this.progressBarService.decrease(),[7];case 5:return[2]}}))}))},n.prototype.nextValue=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.ready()];case 1:return e.sent(),this._dirty=!0,[2,this.getEntityStore(this.detectEntityName(t)).nextValue()]}}))}))},n.prototype.nextValues=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return[4,this.ready()];case 1:for(a.sent(),this._dirty=!0,n=this.detectEntityName(t),o=this.getEntityStore(n),r=o.nextValue(),i=0;i<e-1;i++)o.nextValue();return this._debug&&console.debug("[entities-storage] Reserving range ["+r+","+o.currentValue()+"] for "+n+"'s sequence"),[2,r]}}))}))},n.prototype.currentValue=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.ready()];case 1:return e.sent(),[2,this.getEntityStore(this.detectEntityName(t)).currentValue()]}}))}))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2];case 1:o.sent(),o.label=2;case 2:try{return this.progressBarService.increase(),this._dirty=!0,n=e&&e.entityName||this.detectEntityName(t),this.getEntityStore(n).save(t,e),this._$save.emit(),[2,t]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return!Fe(t)||e&&!0===e.reset?this.started?[3,2]:[4,this.ready()]:[2,t];case 1:o.sent(),o.label=2;case 2:try{return this.progressBarService.increase(),this._dirty=!0,n=e&&e.entityName||this.detectEntityName(t[0]),[2,this.getEntityStore(n).saveAll(t,e)]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.delete=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:n.sent(),n.label=2;case 2:return[2,this.deleteById(t.id,Object.assign(Object.assign({},e),{entityName:e&&e.entityName||this.detectEntityName(t)}))]}}))}))},n.prototype.deleteById=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'entityName'");try{return this.progressBarService.increase(),(n=this.getEntityStore(e.entityName,{create:!1}))?((o=n.delete(t,e))&&(this._dirty=!0,this._$save.emit()),[2,o]):[2,void 0]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.deleteMany=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'opts.entityName'");try{return this.progressBarService.increase(),(n=this.getEntityStore(e.entityName,{create:!1}))?((o=n.deleteMany(t,e)).length>0&&(this._dirty=!0,this._$save.emit()),[2,o]):[2,void 0]}finally{this.progressBarService.decrease()}return[2]}}))}))},n.prototype.deleteFromTrash=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:n.sent(),n.label=2;case 2:return[2,this.deleteFromTrashById(t.id,Object.assign(Object.assign({},e),{entityName:e&&e.entityName||this.detectEntityName(t)}))]}}))}))},n.prototype.deleteFromTrashById=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,this.ready()];case 1:if(o.sent(),!e||Te(e.entityName))throw new Error("Missing argument 'opts' or 'entityName'");return[2,this.deleteById(t,Object.assign(Object.assign({},e),{entityName:n.TRASH_PREFIX+e.entityName}))]}}))}))},n.prototype.moveToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:a.sent(),a.label=2;case 2:return o=e&&e.entityName||this.detectEntityName(t),(r=this.getEntityStore(o))&&r.delete(t.id,e),t.id=void 0,i=n.TRASH_PREFIX+o,this.getEntityStore(i).save(t,e),this._$save.emit(),[2,t]}}))}))},n.prototype.moveManyToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:a.sent(),a.label=2;case 2:if(!e||Te(e.entityName))throw new Error("Missing argument 'opts.entityName'");return(o=this.getEntityStore(e.entityName,{create:!1}))?((r=o.deleteMany(t,e)).length>0&&(r.forEach((function(t){return t.id=void 0})),i=n.TRASH_PREFIX+e.entityName,this.getEntityStore(i,{create:!0}).saveAll(r,e),this._dirty=!0,this._$save.emit()),[2,r]):[2,void 0]}}))}))},n.prototype.saveToTrash=function(t,e){return Ie(this,void 0,void 0,(function(){var o,r;return Oe(this,(function(i){switch(i.label){case 0:return t?this.started?[3,2]:[4,this.ready()]:[2,void 0];case 1:i.sent(),i.label=2;case 2:return o=e&&e.entityName||this.detectEntityName(t),r=n.TRASH_PREFIX+o,this.getEntityStore(r).save(t,e),this._$save.emit(),[2,t]}}))}))},n.prototype.clearTrash=function(t){return Ie(this,void 0,void 0,(function(){var e,o;return Oe(this,(function(r){switch(r.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:r.sent(),r.label=2;case 2:return e=n.TRASH_PREFIX+t,(o=this.getEntityStore(e,{create:!1}))?(o.reset(),this._dirty=!0,this._$save.emit(),[2]):[2]}}))}))},n.prototype.persist=function(){return this._dirty?this.storeLocally():Promise.resolve()},n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return t=Date.now(),console.info("[entities-storage] Starting entity storage..."),[4,this.restoreLocally()];case 1:return n.sent(),this.registerSubscription(D.merge(this._$save,D.timer(this._saveTimerPeriod,this._saveTimerPeriod)).pipe(N.throttleTime(this._saveTimerPeriod)).subscribe((function(){return e.storeLocally()}))),console.info("[entities-storage] Starting [OK] in "+(Date.now()-t)+"ms"),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.dirty?[4,this.storeLocally()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},n.prototype.getEntityStore=function(t,e){var n=this._data[t];if(!(n||e&&!1===e.create)){this._debug&&console.debug("[entities-storage] Creating store "+t);var o=this._typePolicies[t];n=new Za(t,this.storage,o),this._data[t]=n}return n},n.prototype.detectEntityName=function(t){if(!t)throw Error("Unable to detect entityName of object: "+t);return"string"==typeof t?t:t.__typename?t.__typename:t.constructor.name+"VO"},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.storage.get(Ja)];case 1:return(t=r.sent())?(e=this._debug&&Date.now(),this._debug&&console.info("[entities-storage] Restoring entities..."),[4,Promise.all(t.map((function(t){return o.getEntityStore(t)})).map((function(t){return t.restore()})))]):[2];case 2:return n=r.sent().reduce((function(t,e){return t+e}),0),this._debug&&console.debug("[entities-storage] Restoring entities [OK] "+n+" entities found in "+(Date.now()-e)+"ms"),[2]}}))}))},n.prototype.storeLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){return this.dirty?this._saving?(this._debug&&console.debug("[entities-storage] Previous persist not finished. Waiting..."),this._$save.emit(),[2]):(this._saving=!0,this._dirty=!1,this.progressBarService.increase(),t=this._data&&Object.keys(this._data)||[],e=Date.now(),this._debug&&console.debug("[entities-storage] Persisting..."),[2,xn(t.map((function(e){return function(){n=e;var r=o.getEntityStore(e,{create:!1});if(r)return r.persist().then((function(n){n||t.splice(t.findIndex((function(t){return t===e})),1)}));console.warn("[entities-storage] Persisting "+e+": store not found!")}}))).then((function(){return n=void 0,Fe(t)?o.storage.remove(Ja):o.storage.set(Ja,t)})).then((function(){o._debug&&console.debug("[entities-storage] Persisting [OK] "+t.length+" stores saved in "+(Date.now()-e)+"ms..."),o._saving=!1,o.progressBarService.decrease()})).catch((function(t){throw o._saving=!1,o.progressBarService.decrease(),n?console.error("[entities-storage] Error while persisting "+n,t):console.error("[entities-storage] Error while persisting: "+(t&&t.message||t),t),t}))]):[2]}))}))},n}(_i);es.TRASH_PREFIX="Trash#",es.REMOTE_PREFIX="Remote#",es.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new es(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(di),jt.ɵɵinject(te.Storage),jt.ɵɵinject(me),jt.ɵɵinject(ts,8))},token:es,providedIn:"root"}),es.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],es.ctorParameters=function(){return[{type:M.Platform},{type:di},{type:st.Storage},{type:fe,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ts]}]}]};var ns,os=function(){function t(){}return t.copy=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(!t||!e||t===e)throw new Error("Invalid 'from' or 'to' arguments. Must be not null storage");return n=Object.assign({deleteAfterCopy:!1},n),(r=n.keys)?[3,2]:[4,t.keys()];case 1:r=s.sent(),s.label=2;case 2:return Fe(o=r)?[2,Promise.resolve()]:(i=Date.now(),console.info("[storage-utils] Copying "+o.length+" keys from '"+t.driver()+"' to '"+e.driver()+"'... {deleteAfterCopy: "+n.deleteAfterCopy),a=0,[2,xn(o.map((function(o){return function(){return t.getItem(o).then((function(t){return e.setItem(o,t)})).then((function(){return n.deleteAfterCopy&&t.removeItem(o)})).catch((function(t){console.error("[storage-utils] Error during migration of key '"+o+"'",t),a++}))}}))).then((function(){if(0!==a)throw{message:"ERROR.COPY_STORAGE_ERROR"};console.info("[storage-utils] Migrating data [OK] in "+(Date.now()-i)+"ms")}))])}}))}))},t}(),rs=new e.InjectionToken("locales");t.UserSettings=ns=function(t){function e(){return t.call(this,ns.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return(null==e?void 0:e.minify)&&(n.content=this.content&&JSON.stringify(n.content)||void 0),n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e),this.locale=e.locale,this.latLongFormat=e.latLongFormat,Ae(e.content)||"object"==typeof e.content?this.content=e.content||{}:this.content=e.content&&JSON.parse(e.content)||{},this.nonce=e.nonce},e.prototype.merge=function(t,e){var n=this;if(t){this.content={};var o=!1;return Object.keys(t).forEach((function(r){ns.SETTINGS_PROPERTIES.includes(r)?sn(n[r],t[r])||(n[r]=t[r],o=!0):e&&e.includes(r)&&(sn(n.content[r],t[r])||(n.content[r]=Object.assign({},t[r]),o=!0))})),o}},e.prototype.asLocalSettings=function(){var t=this,e={};return ns.SETTINGS_PROPERTIES.forEach((function(n){e[n]=t[n]})),Object.keys(this.content).forEach((function(n){e[n]=t.content[n]})),e},e}(Wi),t.UserSettings.SETTINGS_PROPERTIES=["locale","latLongFormat"],t.UserSettings=ns=we([Ji({typename:"UserSettingsVO"})],t.UserSettings);var is,as={DISABLE:0,ENABLE:1,TEMPORARY:2,DELETED:3,ALL:99};function ss(t,e){return t&&t.id&&ze(t,e||["label","name"])||void 0}var ls=as.ENABLE,cs=as.DISABLE,us=as.TEMPORARY,ds=Object.freeze([{id:ls,icon:"checkmark",label:"REFERENTIAL.STATUS_ENUM.ENABLE"},{id:cs,icon:"close",label:"REFERENTIAL.STATUS_ENUM.DISABLE"},{id:us,icon:"help",label:"REFERENTIAL.STATUS_ENUM.TEMPORARY"}]),ps=Object.freeze(an(ds)),hs=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.asObject=function(e){if(e&&e.minify)return{id:this.id,entityName:e.keepEntityName&&this.entityName||void 0,__typename:e.keepTypename&&this.__typename||void 0};var n=t.prototype.asObject.call(this,e);return n.creationDate=io(this.creationDate),e&&!1===e.keepTypename&&delete n.entityName,n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.label=e.label,this.name=e.name,this.description=e.description,this.comments=e.comments,this.statusId=e.statusId,this.validityStatusId=e.validityStatusId,this.levelId=e.levelId&&0!==e.levelId?e.levelId:void 0,this.parentId=e.parentId,this.creationDate=ao(e.creationDate),this.entityName=e.entityName},e.prototype.equals=function(e){return t.prototype.equals.call(this,e)&&this.entityName===e.entityName},e}(Wi);t.Referential=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e}(hs),t.Referential=we([Ji({typename:"ReferentialVO"})],t.Referential);var ms,fs,gs=function(){function e(){}return e.fromObject=function(e){if(!e||e instanceof t.Referential)return e;var n=new t.Referential;return n.fromObject(e),n},e.isNotEmpty=function(t){return Qi.isNotEmpty(t,"id")},e.isNotEmptyReferential=function(t){return Qi.isNotEmpty(t,"id")},e.isEmpty=function(t){return Qi.isEmpty(t,"id")},e.equals=function(t,e){return Qi.equals(t,e,"id")},e}(),bs=Object.freeze({minify:!0,keepTypename:!0,keepEntityName:!0,keepLocalId:!0}),ys=Object.freeze({minify:!0,keepTypename:!1,keepEntityName:!1,keepLocalId:!1});function vs(t){return t&&t.id&&t.name||void 0}function Cs(t,e){return(t||[]).map(vs).join(e||", ")}t.ReferentialRef=is=function(t){function e(){return t.call(this,is.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){if(e&&e.minify)return{id:this.id,entityName:e.keepEntityName&&this.entityName||void 0,__typename:e.keepTypename&&this.__typename||void 0};var n=t.prototype.asObject.call(this,e);return e&&!1===e.keepEntityName&&delete n.entityName,n},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||this.entityName,this.label=e.label,this.name=e.name,this.statusId=e.statusId,this.levelId=e.levelId},e}(Wi),t.ReferentialRef=is=we([Ji({typename:"ReferentialVO"})],t.ReferentialRef),t.Department=ms=function(t){function e(){var e=t.call(this,ms.TYPENAME)||this;return e.entityName=ms.ENTITY_NAME,e}return Ee(e,t),e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||ms.ENTITY_NAME,this.logo=e.logo,this.siteUrl=e.siteUrl,delete this.entityName},e}(hs),t.Department.ENTITY_NAME="Department",t.Department=ms=we([Ji({typename:"DepartmentVO"})],t.Department);var Es=Object.freeze(["ADMIN","SUPERVISOR","USER","GUEST"]);t.Person=fs=function(e){function n(t){var n=e.call(this,t||fs.TYPENAME)||this;return n.department=null,n}return Ee(n,e),n.prototype.asObject=function(t){if(t&&t.minify)return{id:this.id,__typename:t.keepTypename&&this.__typename||void 0,firstName:this.firstName,lastName:this.lastName};var n=e.prototype.asObject.call(this,t);return n.department=this.department&&this.department.asObject(t)||void 0,n.profiles=this.profiles&&this.profiles.slice(0)||[],n.profiles=this.mainProfile&&[this.mainProfile]||n.profiles,n.creationDate=io(this.creationDate),t&&!0===t.minify||(n.mainProfile=Is.getMainProfile(n.profiles)),n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.firstName=n.firstName,this.lastName=n.lastName,this.email=n.email,this.creationDate=ao(n.creationDate),this.pubkey=n.pubkey,this.username=n.username,this.usernameExtranet=n.usernameExtranet,this.avatar=n.avatar,this.statusId=n.statusId,this.department=n.department&&t.Department.fromObject(n.department)||void 0,this.profiles=n.profiles&&n.profiles.slice(0)||[],n.mainProfile&&!this.profiles.find((function(t){return t===n.mainProfile}))&&(this.profiles=this.profiles.concat(n.mainProfile)),this.mainProfile=Is.getMainProfile(this.profiles)},n}(Wi),t.Person=fs=we([Ji({typename:"PersonVO"})],t.Person);var ws,Is=function(){function t(){}return t.getMainProfile=function(t){return Fe(t)?"GUEST":Es.find((function(e){return t.includes(e)}))||"GUEST"},t.getMainProfileIndex=function(t){if(Fe(t))return Es.length-1;var e=Es.findIndex((function(e){return t.includes(e)}));return-1!==e?e:Es.length-1},t.hasUpperOrEqualsProfile=function(e,n){var o=Es.indexOf(n);return-1!==o&&t.getMainProfileIndex(e)<=o},t.personToString=function(t){return t&&t.id&&t.lastName+" "+t.firstName||void 0},t.personsToString=function(e,n){return(e||[]).map(t.personToString).join(n||", ")},t}();function Os(t){return t&&(t.firstName&&t.firstName+" "||"")+(t.lastName||"")||""}t.Account=ws=function(e){function n(){var t=e.call(this,ws.TYPENAME)||this;return t.settings=null,t}return Ee(n,e),n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,Object.assign(Object.assign({},t),{minify:!1}));return n.settings=this.settings&&this.settings.asObject(t)||void 0,(null==t?void 0:t.minify)&&delete n.mainProfile,n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.settings=n.settings&&t.UserSettings.fromObject(n.settings)},n.prototype.asPerson=function(){var e=t.Person.fromObject(this.asObject({keepTypename:!0}));return e.__typename=t.Person.TYPENAME,e},Object.defineProperty(n.prototype,"displayName",{get:function(){return Os(this)},enumerable:!1,configurable:!0}),n}(t.Person),t.Account=ws=we([Ji({typename:"AccountVO"})],t.Account);var _s=Zt,xs="undefined"!=typeof global?global:"undefined"!=typeof window?window:{},ks=xs.WebSocket||xs.MozWebSocket,Ss=function(t,e){return new ks(t)};function As(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"mutation"===e.operation}function Ts(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"subscription"===e.operation}Ss.CLOSED=ks.CLOSED,Ss.CLOSING=ks.CLOSING,Ss.CONNECTING=ks.CONNECTING,Ss.OPEN=ks.OPEN;var Rs="apollo-tracker-persist";function Ps(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return o=(n=JSON).parse,[4,t.storage.getItem(Rs)];case 1:return(e=o.apply(n,[i.sent()]))?(t.debug&&console.debug("[apollo-tracker-link] Restoring tracked queries",e),r=(e||[]).map((function(e){var n=JSON.parse(e.contextJSON),o=JSON.parse(e.queryJSON),r=JSON.parse(e.variablesJSON);return t.apolloClient.mutate({context:n,mutation:o,optimisticResponse:n.optimisticResponse,variables:r})})),[2,Promise.all(r)]):[2]}}))}))}var Ds=new e.InjectionToken("graphqlTypePolicies"),Ns=function(t){function n(e,n,o,r,i,a,s,l){var c=t.call(this,e)||this;return c.platform=e,c.apollo=n,c.httpLink=o,c.network=r,c.storage=i,c.cryptoService=a,c.environment=s,c.typePolicies=l,c.connectionParams={},c.onNetworkError=new D.Subject,c.customErrors={},c._debug=!s.production,c._defaultFetchPolicy=s.apolloFetchPolicy,c._networkStatusChanged$=r.onNetworkStatusChanges.pipe(N.filter(Re),N.distinctUntilChanged()),c.onNetworkError.pipe(N.throttleTime(300),N.filter((function(){return c.network.online})),N.mergeMap((function(){return c.network.checkPeerAlive()})),N.filter((function(t){return!t}))).subscribe((function(){return c.network.setForceOffline(!0,{showToast:!0})})),c}return Ee(n,t),Object.defineProperty(n.prototype,"client",{get:function(){return this._data},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cache",{get:function(){return this.apollo.client.cache},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"defaultFetchPolicy",{get:function(){return this._defaultFetchPolicy},enumerable:!1,configurable:!0}),n.prototype.setAuthToken=function(t){t?(console.debug("[graphql] Apply token authentication to headers"),this.connectionParams.authToken=t):(console.debug("[graphql] Remove token authentication from headers"),delete this.connectionParams.authToken,this.clearCache())},n.prototype.setAuthBasic=function(t){t?(console.debug("[graphql] Apply basic authentication to headers"),this.connectionParams.authBasic=t):(console.debug("[graphql] Remove basic authentication from headers"),delete this.connectionParams.authBasic,this.clearCache())},n.prototype.addResolver=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:e.sent(),e.label=2;case 2:return this.apollo.client.addResolvers(t),[2]}}))}))},n.prototype.query=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return this.started?[3,2]:[4,this.ready()];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.client.query({query:t.query,variables:t.variables,fetchPolicy:t.fetchPolicy||this._defaultFetchPolicy||void 0})];case 3:return e=o.sent(),[3,5];case 4:return n=o.sent(),e=this.toApolloError(n,t.error),[3,5];case 5:if(e.errors)throw e.errors[0];return[2,e.data]}}))}))},n.prototype.watchQueryRef=function(t){return this.apollo.watchQuery({query:t.query,variables:t.variables,fetchPolicy:t.fetchPolicy||this._defaultFetchPolicy||void 0,notifyOnNetworkStatusChange:!0})},n.prototype.queryRefValuesChanges=function(t,e){var n=this;return t.valueChanges.pipe(N.catchError((function(t){return n.onApolloError(t,e.error)})),N.filter((function(t){return t.networkStatus===yt.NetworkStatus.ready||t.networkStatus===yt.NetworkStatus.error})),N.map((function(t){var e=t.data,n=t.errors;if(n)throw n[0];return e})))},n.prototype.watchQuery=function(t){var e=this.watchQueryRef(t);return this.queryRefValuesChanges(e,t)},n.prototype.mutate=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:return(t.forceOffline||this.network.offline)&&t.offlineResponse?"function"!=typeof t.offlineResponse?[3,2]:(t.context=t.context||{},e=t.offlineResponse,n=t,[4,e(t.context)]):[3,4];case 1:return n.optimisticResponse=a.sent(),this._debug&&console.debug("[graphql] [offline] Using an optimistic response: ",t.optimisticResponse),[3,3];case 2:t.optimisticResponse=t.offlineResponse,a.label=3;case 3:if(t.forceOffline)return o={data:t.optimisticResponse},t.update&&t.update(this.apollo.client.cache,o),[2,o.data];a.label=4;case 4:return[4,this.apollo.mutate({mutation:t.mutation,variables:t.variables,context:t.context,optimisticResponse:t.optimisticResponse,update:t.update}).pipe(N.catchError((function(e){return i.onApolloError(e,t.error)})),N.first()).toPromise()];case 5:if(r=a.sent(),Array.isArray(r.errors))throw r.errors[0];return[2,r.data]}}))}))},n.prototype.subscribe=function(t,e){var n=this;return this.apollo.subscribe({query:t.query,fetchPolicy:t&&t.fetchPolicy||"network-only",errorPolicy:t&&t.errorPolicy||void 0,variables:t.variables},Object.assign({useZone:!0},e)).pipe(N.catchError((function(e){return n.onApolloError(e,t.error)})),N.map((function(t){var e=t.data,n=t.errors;if(n)throw n[0];return e})))},n.prototype.insertIntoQueryCache=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){(n=Object.assign({},n))[e.arrayFieldName]=ke(n[e.arrayFieldName],[Object.assign({},e.data)]),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var o=Be(e.variables&&e.variables.size,-1);o>0&&n[e.arrayFieldName].length>o&&n[e.arrayFieldName].splice(o,n[e.arrayFieldName].length-o),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.totalFieldName]+=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n})}else console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName)}catch(t){this._debug&&console.error("[graphql] Error while updating cache: ",t)}},n.prototype.addManyToQueryCache=function(t,e){if(e.data&&e.data.length){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){n=Object.assign({},n);var o=e.equalsFn||function(t,e){return t.id===e.id&&t.entityName===e.entityName},r=e.data.filter((function(t){return-1===n[e.arrayFieldName].findIndex((function(e){return o(t,e)}))}));if(!r.length)return;n[e.arrayFieldName]=ke(n[e.arrayFieldName],r),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var i=Be(e.variables&&e.variables.size,-1);i>0&&n[e.arrayFieldName].length>i&&n[e.arrayFieldName].splice(i,n[e.arrayFieldName].length-i),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.arrayFieldName]+=r.length:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n})}else console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName)}catch(t){this._debug&&console.warn("[graphql] Error while updating cache: ",t)}}},n.prototype.removeFromCachedQueryById=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery({query:e.query,variables:e.variables});if(n&&n[e.arrayFieldName]){var o=(n=Object.assign({},n))[e.arrayFieldName].findIndex((function(t){return t.id===e.ids}));if(-1===o)return!1;n[e.arrayFieldName]=n[e.arrayFieldName].slice();var r=n[e.arrayFieldName].splice(o,1)[0];return t.evict({id:t.identify(r)}),Re(e.totalFieldName)&&(Re(n[e.totalFieldName])?n[e.totalFieldName]-=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),t.writeQuery({query:e.query,variables:e.variables,data:n}),!0}return console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName),!1}catch(t){return this._debug&&console.warn("[graphql] Error while removing from cache: ",t),!1}},n.prototype.removeFromCachedQueryByIds=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery(e);if(!n||!n[e.arrayFieldName])return console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.arrayFieldName),0;var o=(n=Object.assign({},n))[e.arrayFieldName].reduce((function(t,n,o){return e.ids.includes(n.id)?t.concat(o):t}),[]);if(o.length<=0)return 0;if(!Ae(e.totalFieldName))return n[e.arrayFieldName]=n[e.arrayFieldName].slice(),o.reverse().map((function(t){return n[e.arrayFieldName].splice(t,1)[0]})).map((function(e){return t.identify(e)})).forEach((function(e){return t.evict({id:e})})),Re(n[e.totalFieldName])?n[e.totalFieldName]-=o.length:console.warn("[graphql] Unable to update the total in cached query. Unknown result part: "+e.totalFieldName),t.writeQuery({query:e.query,variables:e.variables,data:n}),o.length;o.map((function(t){return n[e.arrayFieldName][t]})).map((function(e){return t.identify(e)})).forEach((function(e){return t.evict({id:e})}))}catch(t){return this._debug&&console.warn("[graphql] Error while removing from cache: ",t),0}},n.prototype.updateToQueryCache=function(t,e){t=t||this.apollo.client.cache,e.arrayFieldName=e.arrayFieldName||"data";try{var n=t.readQuery(e);if(n&&n[e.arrayFieldName]){n=Object.assign({},n);var o=e.equalsFn||function(t,e){return Qi.equals(t,e,"id")},r=n[e.arrayFieldName].findIndex((function(t){return o(e.data,t)}));return n[e.arrayFieldName]=-1!==r?n[e.arrayFieldName].slice().splice(r,1,e.data):ke(n[e.arrayFieldName],[e.data]),Re(e.totalFieldName)&&-1===r&&(Re(n[e.totalFieldName])?n[e.totalFieldName]+=1:console.warn("[graphql] Unable to update cached query. Unknown result part: "+e.totalFieldName)),void t.writeQuery({query:e.query,variables:e.variables,data:n})}}catch(t){this._debug&&console.warn("[graphql] Error while updating cache: ",t)}},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return(t=t||this.client)?(console.info("[graphql] Clearing Apollo client's cache... "),e=this._debug&&Date.now(),[4,t.cache.reset()]):[3,2];case 1:n.sent(),this._debug&&console.debug("[graphql] Apollo client's cache cleared, in "+(Date.now()-e)+"ms"),n.label=2;case 2:return[2]}}))}))},n.prototype.registerCustomError=function(t){this.customErrors=Object.assign(Object.assign({},this.customErrors),t)},n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,n,o,r,i,a,s,l,c,u,d,p,h,m,f,g,b,y=this;return Oe(this,(function(v){switch(v.label){case 0:return[4,this.network.ready()];case 1:if(v.sent(),console.info("[graphql] Starting graphql..."),t=this.platform.is("mobile")||this.platform.is("mobileweb"),n=!t,!(o=this.network.peer))throw Error("[graphql] Missing peer. Unable to start graphql service");return r=o.url+"/graphql",i=String.prototype.replace.call(r,/^http(s)?:/,"ws$1:")+"/websocket",console.info("[graphql] Base uri: "+r),console.info("[graphql] Subscription uri: "+i),this.httpParams=this.httpParams||{},this.httpParams.uri=r,this.wsParams=Object.assign(Object.assign({},this.wsParams),{options:{lazy:!0,reconnect:!0,connectionParams:this.connectionParams},webSocketImpl:Ss,uri:i}),a=new kt.IonicStorageWrapper(this.storage),(s=this.apollo.client)?[3,4]:(console.debug("[apollo] Creating GraphQL client..."),l=new Ct.WebSocketLink(this.wsParams),c=new wt.RetryLink,u=new yt.ApolloLink((function(t,e){var n=[];y.connectionParams.authToken&&n.push("token "+y.connectionParams.authToken),y.connectionParams.authBasic&&n.push("Basic "+y.connectionParams.authBasic);var o=(new Q.HttpHeaders).append("Authorization",n);return t.setContext(Object.assign(Object.assign({},t.getContext()),{headers:o})),e(t)})),d=this.httpLink.create(this.httpParams),p=new yt.InMemoryCache({typePolicies:this.typePolicies}),this.environment.persistCache?(console.debug("[graphql] Starting persistence cache..."),[4,kt.persistCache({cache:p,storage:a,trigger:this.platform.is("android")?"background":"write",debounce:1e3,debug:!0})]):[3,3]);case 2:v.sent(),v.label=3;case 3:h=void 0,n?(m=new se.default,C={storage:a,onNetworkStatusChange:this._networkStatusChanged$,debounce:1e3,debug:!0},E=new e.EventEmitter,w={},I=new D.BehaviorSubject("none"),C.onNetworkStatusChange.subscribe((function(t){return I.next(t)})),E.pipe(N.debounceTime(C.debounce||1e3),N.switchMap((function(){return I})),N.filter((function(t){return"none"===t&&!!C.storage}))).subscribe((function(){var t=Object.getOwnPropertyNames(w).map((function(t){return w[t]})).filter((function(t){return void 0!==t}));return C.debug&&console.debug("[apollo-tracker-link] Saving tracked queries to storage",t),C.storage.setItem(Rs,JSON.stringify(t))})),f=new yt.ApolloLink((function(t,e){var n=t.getContext();if(!n||!n.tracked)return e(t);var o=n.serializationKey||_s();console.debug("[apollo-tracker-link] Watching tracked query {"+t.operationName+"#"+o+"}");var r=Object.assign(Object.assign({},n),{optimisticResponse:null,cache:null}),i={id:o,name:t.operationName,queryJSON:JSON.stringify(t.query),variablesJSON:JSON.stringify(t.variables),contextJSON:JSON.stringify(r)};w[o]=i,E.emit();var a=e(t).map((function(e){return console.debug("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} succeed!",e),delete w[o],E.emit(w),e}));return"none"===I.getValue()&&(n.optimisticResponse?console.debug("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} has optimistic response: ",n.optimisticResponse):console.warn("[apollo-tracker-link] Query {"+t.operationName+"#"+o+"} missing 'context.optimisticResponse': waiting network UP before to continue...")),a})),g=new ae.default,this.registerSubscription(this._networkStatusChanged$.subscribe((function(t){"none"===t?(console.info("[graphql] offline mode: enable mutations buffer"),g.close()):(console.info("[graphql] online mode: disable mutations buffer"),g.open())}))),h=[le.default,g,f,g,m,c,u,d]):h=[c,u,d],s=new yt.ApolloClient({cache:p,link:yt.ApolloLink.split(As,yt.ApolloLink.from(h),yt.ApolloLink.split(Ts,l,yt.ApolloLink.from([c,u,d]))),connectToDevTools:!this.environment.production}),this.apollo.client=s,v.label=4;case 4:if(!n||!this.environment.persistCache)return[3,8];v.label=5;case 5:return v.trys.push([5,7,,8]),[4,Ps({apolloClient:s,storage:a,debug:!0})];case 6:return v.sent(),[3,8];case 7:return b=v.sent(),console.error("[graphql] Failed to restore tracked queries from storage: "+(b&&b.message||b),b),[3,8];case 8:return this.registerSubscription(this.network.on("start",(function(){return y.restart()}))),this.registerSubscription(this.network.on("resetCache",(function(){return y.clearCache()}))),console.info("[graphql] Starting graphql [OK]"),[2,s]}var C,E,w,I}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.info("[graphql] Stopping graphql service..."),[4,this.resetClient()];case 1:return t.sent(),[2]}}))}))},n.prototype.resetClient=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return(t=t||this.apollo.client)?(console.info("[graphql] Resetting apollo client..."),t.stop(),[4,Promise.all([t.clearStore(),this.clearCache(t)])]):[2];case 1:return e.sent(),[2]}}))}))},n.prototype.onApolloError=function(t,e){return D.of(this.toApolloError(t,e))},n.prototype.toApolloError=function(t,e){var n=t.networkError&&(t.networkError.error&&this.toAppError(t.networkError.error)||this.toAppError(t.networkError)||t.networkError.error&&this.createAppErrorByCode(t.networkError.error.status)||this.createAppErrorByCode(xa))||t.graphQLErrors&&t.graphQLErrors.length&&this.toAppError(t.graphQLErrors[0])||this.toAppError(t)||this.toAppError(t.originalError)||t.graphQLErrors&&t.graphQLErrors[0]||t;return console.error("[graphql] "+(n&&n.message||n),n.stack||""),n&&n.code===xa&&t.networkError&&t.networkError.message&&(console.error("[graphql] original error: "+t.networkError.message),this.onNetworkError.next(n)),n&&n.code||!e||(n=Object.assign(Object.assign({},e),{details:n,stack:t.stack})),{data:null,errors:[n],loading:!1,networkStatus:null}},n.prototype.createAppErrorByCode=function(t){if(this.getI18nErrorMessageByCode(t))return{code:t,message:this.getI18nErrorMessageByCode(t)}},n.prototype.getI18nErrorMessageByCode=function(t){var e=this.customErrors[t];if(e)return e;switch(t){case Wa:return"ERROR.UNAUTHORIZED";case za:return"ERROR.FORBIDDEN";case xa:return"ERROR.UNKNOWN_NETWORK_ERROR";case Ya:return"ERROR.BAD_UPDATE_DATE";case Qa:return"ERROR.DATA_LOCKED";case Xa:return"ERROR.BAD_APP_VERSION"}},n.prototype.toAppError=function(t){var e=t,n=t&&t.message||t;if("string"==typeof n&&0===n.trim().indexOf('{"code":'))try{e=JSON.parse(n.replace("\n"," ").replace("\r",""))}catch(t){console.error("Unable to parse error as JSON: ",t)}if(e&&e.code)return this.createAppErrorByCode(e.code)||e&&e.message||e},n}(_i);Ns.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ns(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(ie.Apollo),jt.ɵɵinject(ce.HttpLink),jt.ɵɵinject(Ca),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Hi),jt.ɵɵinject(me),jt.ɵɵinject(Ds,8))},token:Ns,providedIn:"root"}),Ns.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ns.ctorParameters=function(){return[{type:M.Platform},{type:vt.Apollo},{type:xt.HttpLink},{type:Ca},{type:st.Storage},{type:Hi},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ds]}]}]};var Fs=require("hash.js/lib/hash/sha/256"),Ms=function(){},Ls=function(t){function e(e,n){var o=t.call(this,e)||this;return o.graphql=e,o._mutableWatchQueries=[],o._mutableWatchQueriesMaxCount=3,o._debug=je(n&&!n.production,!Yi.production),o._logPrefix="[base-graphql-service] ",o}return Ee(e,t),e.prototype.mutableWatchQuery=function(t){if(t.fetchPolicy=t.fetchPolicy||this.graphql.defaultFetchPolicy,"no-cache"===t.fetchPolicy)return this.graphql.watchQuery(t);if(!t.arrayFieldName)return this._debug&&console.warn(this._logPrefix+"̀Missing 'opts.arrayFieldName' : unable to create a mutable watch query"),this.graphql.watchQuery(t);var e,n,o=this.computeMutableWatchQueryId(t),r=this._mutableWatchQueries.filter((function(t){return t.id===o}));return 1===r.length?((e=r[0]).counter+=1,n=e.queryRef,this._debug&&console.debug(this._logPrefix+"Find same mutable watch query (same variables) {"+o+"}. Skip register"),"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(console.warn(this._logPrefix+" Mutable query already exists, and fetchPolicy="+t.fetchPolicy+". Force refetch query..."),n.refetch(e.variables))):(n=this.graphql.watchQueryRef(t),this.registerNewMutableWatchQuery({id:o,query:t.query,queryRef:n,variables:t.variables,arrayFieldName:t.arrayFieldName,totalFieldName:t.totalFieldName,insertFilterFn:t.insertFilterFn,sortFn:t.sortFn,counter:1})),this.graphql.queryRefValuesChanges(n,t)},e.prototype.insertIntoMutableCachedQueries=function(t,e){var n=this,o=this.findMutableWatchQueries(e);o.length&&o.forEach((function(o){if(Array.isArray(e.data)){var r=o.insertFilterFn?e.data.filter((function(t){return o.insertFilterFn(t)})):e.data;Ne(r)&&(n._debug&&console.debug("[base-data-service] Inserting data into watching query: ",o.id),n.graphql.addManyToQueryCache(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,sortFn:o.sortFn,data:r}))}else o.insertFilterFn&&!o.insertFilterFn(e.data)||(n._debug&&console.debug("[base-data-service] Inserting data into watching query: ",o.id),n.graphql.insertIntoQueryCache(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,sortFn:o.sortFn,data:e.data}))}))},e.prototype.removeFromMutableCachedQueriesByIds=function(t,e){var n=this,o=this.findMutableWatchQueries(e);if(o.length)return console.debug("[base-data-service] Removing data from watching queries: ",o),o.map((function(o){return Array.isArray(e.ids)?n.graphql.removeFromCachedQueryByIds(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,ids:e.ids}):n.graphql.removeFromCachedQueryById(t,{query:o.query,variables:o.variables,arrayFieldName:o.arrayFieldName,totalFieldName:o.totalFieldName,ids:e.ids})?1:0})).reduce((function(t,e){return t+e}),0)},e.prototype.refetchMutableWatchQueries=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!(e=this.findMutableWatchQueries(t)).length)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return o._debug&&console.debug(o._logPrefix+"Refetching mutable watch query {"+e.id+"}"),e.queryRef.refetch(Object.assign(Object.assign({},e.variables),t.variables))})))];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),console.error(this._logPrefix+"Error while refetching mutable watch queries",n),[3,4];case 4:return[2]}}))}))},e.prototype.computeMutableWatchQueryId=function(t){var e=t.queryName||Fs().update(JSON.stringify(t.query)).digest("hex").substring(0,8),n=t.variables&&Fs().update(JSON.stringify(t.variables)).digest("hex").substring(0,8)||"";return[e,t.arrayFieldName,n].join("|")},e.prototype.findMutableWatchQueries=function(t){var e=this;if(t.queryName)return this._mutableWatchQueries.filter((function(e){return e.id.startsWith(t.queryName+"|")}));if(t.queryNames)return t.queryNames.reduce((function(t,n){return t.concat(e._mutableWatchQueries.filter((function(t){return t.id.startsWith(n+"|")})))}),[]);if(t.query)return this._mutableWatchQueries.filter((function(e){return e.query===t.query}));if(t.queries)return t.queries.filter(Re).reduce((function(t,n){return t.concat(e._mutableWatchQueries.filter((function(t){return t.query===n})))}),[]);throw Error("Invalid options: only one property must be set")},e.prototype.registerNewMutableWatchQuery=function(t){if(this._debug&&console.debug(this._logPrefix+"Register new mutable watch query {"+t.id+"}"),this._mutableWatchQueriesMaxCount>0&&this._mutableWatchQueries.length>=this._mutableWatchQueriesMaxCount){var e=this._mutableWatchQueries.splice(0,1+this._mutableWatchQueries.length-this._mutableWatchQueriesMaxCount);console.warn(this._logPrefix+"Removing older mutable watching queries (stack exceed max of "+this._mutableWatchQueriesMaxCount+"): ",e.map((function(t){return t.id})))}!t.sortFn&&t.variables&&t.variables.sortBy&&(t.sortFn=t.variables&&t.variables.sortBy&&Qi.sortComparator(t.variables.sortBy,t.variables.sortDirection||"asc")),this._mutableWatchQueries.push(t)},e.prototype.findRefetchQueries=function(t){return this.findMutableWatchQueries(t).map((function(t){return{query:t.query,variables:t.variables}}))},e.prototype.ngOnStart=function(){return Promise.resolve(null)},e}(_i);Ls.decorators=[{type:e.Directive}],Ls.ctorParameters=function(){return[{type:Ns},{type:Ms,decorators:[{type:e.Optional}]}]};var js,Bs,Us,Vs,qs,$s,Gs,Hs,Ws,zs,Ks,Qs,Ys,Xs,Js="token",Zs="pubkey",tl="seckey",el="account",nl="assets/img/person.png",ol={account:yt.gql(js||(js=Se(["\n fragment AccountFragment on AccountVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n settings {\n ...UserSettingsFragment\n }\n department {\n id\n label\n name\n __typename\n }\n __typename\n }"],["\n fragment AccountFragment on AccountVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n settings {\n ...UserSettingsFragment\n }\n department {\n id\n label\n name\n __typename\n }\n __typename\n }"]))),settings:yt.gql(Bs||(Bs=Se(["fragment UserSettingsFragment on UserSettingsVO {\n id\n locale\n latLongFormat\n content\n nonce\n updateDate\n __typename\n }"],["fragment UserSettingsFragment on UserSettingsVO {\n id\n locale\n latLongFormat\n content\n nonce\n updateDate\n __typename\n }"])))},rl=yt.gql(Us||(Us=Se(["\n query Account {\n data: account {\n ...AccountFragment\n }\n }\n ","\n ","\n"],["\n query Account {\n data: account {\n ...AccountFragment\n }\n }\n ","\n ","\n"])),ol.account,ol.settings),il=yt.gql(Vs||(Vs=Se(["\n query IsEmailExists($email: String, $hash: String){\n isEmailExists(email: $email, hash: $hash)\n }\n"],["\n query IsEmailExists($email: String, $hash: String){\n isEmailExists(email: $email, hash: $hash)\n }\n"]))),al={save:yt.gql(qs||(qs=Se([" mutation SaveAccount($data:AccountVOInput){\n data: saveAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""],[" mutation SaveAccount($data:AccountVOInput){\n data: saveAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""])),ol.account,ol.settings),create:yt.gql($s||($s=Se(["mutation CreateAccount($data:AccountVOInput){\n data: createAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""],["mutation CreateAccount($data:AccountVOInput){\n data: createAccount(account: $data){\n ...AccountFragment\n }\n }\n ","\n ",""])),ol.account,ol.settings),saveSettings:yt.gql(Gs||(Gs=Se(["mutation SaveSettings($data:UserSettingsVOInput){\n data: saveSettings(settings: $data){\n ...UserSettingsFragment\n }\n }\n ",""],["mutation SaveSettings($data:UserSettingsVOInput){\n data: saveSettings(settings: $data){\n ...UserSettingsFragment\n }\n }\n ",""])),ol.settings)},sl=yt.gql(Hs||(Hs=Se(["\n mutation sendAccountConfirmationEmail($email:String, $locale:String){\n sendAccountConfirmationEmail(email: $email, locale: $locale)\n }\n"],["\n mutation sendAccountConfirmationEmail($email:String, $locale:String){\n sendAccountConfirmationEmail(email: $email, locale: $locale)\n }\n"]))),ll=yt.gql(Ws||(Ws=Se(["\n mutation confirmAccountEmail($email:String, $code:String){\n confirmAccountEmail(email: $email, code: $code)\n }\n"],["\n mutation confirmAccountEmail($email:String, $code:String){\n confirmAccountEmail(email: $email, code: $code)\n }\n"]))),cl=yt.gql(zs||(zs=Se(["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"],["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"]))),ul=yt.gql(Ks||(Ks=Se(["\n query AuthChallenge{\n authChallenge{\n challenge\n pubkey\n signature\n }\n }\n"],["\n query AuthChallenge{\n authChallenge{\n challenge\n pubkey\n signature\n }\n }\n"]))),dl={listenChanges:yt.gql(Qs||(Qs=Se(["subscription updateAccount($interval: Int){\n data: updateAccount(interval: $interval) {\n id\n updateDate\n }\n }"],["subscription updateAccount($interval: Int){\n data: updateAccount(interval: $interval) {\n id\n updateDate\n }\n }"])))},pl=function(e){function n(t,n,o,r,i,a,s){var l=e.call(this,o,s)||this;return l.cryptoService=t,l.network=n,l.graphql=o,l.settings=r,l.storage=i,l.file=a,l.environment=s,l.onLogin=new D.Subject,l.onLogout=new D.Subject,l.onChange=new D.Subject,l.onAuthTokenChange=new D.Subject,l.onAuthBasicChange=new D.Subject,l._cache={loaded:!1,keypair:null,authToken:null,authBasic:null,pubkey:null,mainProfile:null,person:null,department:null},l._$additionalFields=new D.BehaviorSubject([]),l._tokenType$=new D.BehaviorSubject(void 0),l._debug=!s.production,l._debug&&console.debug("[account-service] Creating service"),l.resetData(),l.onAuthTokenChange.subscribe((function(t){return l.graphql.setAuthToken(t)})),l.onAuthBasicChange.subscribe((function(t){return l.graphql.setAuthBasic(t)})),l.network.on("beforeTryOnlineFinish",(function(t){return Ie(l,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return!t||this.started&&!this.isLogin()?[3,3]:(console.debug("[account] Force networkService.tryOnline() to wait, that graphql and account service is restarted..."),[4,nn(500)]);case 1:return e.sent(),this.started?[3,3]:[4,this.ready()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))})),l}return Ee(n,e),Object.defineProperty(n.prototype,"account",{get:function(){return this._cache.loaded?this._data:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"person",{get:function(){return this._cache.loaded&&!this._cache.person&&(this._cache.person=this._cache.loaded?this._data.asPerson():void 0),this._cache.person},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"department",{get:function(){return this._cache.loaded&&!this._cache.department&&(this._cache.department=this._cache.loaded?this._data.asPerson().department:void 0),this._cache.department},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tokenType",{get:function(){return this._tokenType$.value},set:function(t){this._tokenType$.value!==t&&(console.info("[account] Using authentication token type: "+t),this._tokenType$.next(t),this._cache.authToken=void 0,this.onAuthTokenChange.next(void 0),this._cache.authBasic=void 0,this.onAuthBasicChange.next(void 0))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return[4,Promise.all([this.settings.ready(),_n(this._tokenType$)])];case 1:return e.sent(),this.registerSubscription(this.graphql.onStart.subscribe((function(){t.started&&t.isLogin()&&(console.debug("[account] Restarting, to retry to authenticate..."),t.restart())}))),[4,this.restoreLocally()];case 2:return e.sent(),[4,this.listenSettings()];case 3:return e.sent(),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){return t=this._cache.authToken&&!0,e=this._cache.authBasic&&!0,n=t||e,this.resetData(),n&&(this.onLogout.next(),this.onChange.next(void 0),t&&this.onAuthTokenChange.next(void 0),e&&this.onAuthBasicChange.next(void 0)),[2]}))}))},n.prototype.isLogin=function(){return!(!this._cache.pubkey||!this._cache.loaded)},n.prototype.isAuth=function(){return!!(this._cache.pubkey&&this._cache.keypair&&this._cache.keypair.secretKey)},n.prototype.hasMinProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&Is.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.hasExactProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&this._data.profiles.some((function(e){return e===t}))},n.prototype.hasProfileAndIsEnable=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE)&&Is.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.isAdmin=function(){return this.hasProfileAndIsEnable("ADMIN")},n.prototype.isSupervisor=function(){return this.hasProfileAndIsEnable("SUPERVISOR")},n.prototype.isUser=function(){return this.hasProfileAndIsEnable("USER")},n.prototype.isUsageMode=function(t){return this.settings.isUsageMode(t)},n.prototype.isOnlyGuest=function(){return!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE&&this._data.statusId!==as.TEMPORARY)&&!Is.hasUpperOrEqualsProfile(this._data.profiles,"USER")},n.prototype.canUserWriteDataForDepartment=function(t){return gs.isEmpty(t)?(this.isAdmin()||console.warn("Unable to check if user has right: invalid recorderDepartment",t),this.isAdmin()):!(!this._data||!this._data.pubkey||this._data.statusId!==as.ENABLE)&&(this._data.department&&this._data.department.id?this._data.department.id===t.id||Is.hasUpperOrEqualsProfile(this._data.profiles,"SUPERVISOR"):(console.warn("User account has no department ! Unable to check write right against recorderDepartment"),!1))},n.prototype.register=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(this.isLogin())throw new Error("User already login. Please logout before register.");if(!e.username||!e.password)throw new Error("Missing required username or password");this._debug&&console.debug("[account] Register new user account...",e.account),this._cache.loaded=!1,n=Date.now(),a.label=1;case 1:return a.trys.push([1,6,,7]),[4,this.cryptoService.scryptKeypair(e.username,e.password)];case 2:return o=a.sent(),e.account.pubkey=Ui.encode(o.publicKey),e.account.settings=e.account.settings||new t.UserSettings,e.account.settings.locale=this.settings.locale,e.account.settings.latLongFormat=this.settings.latLongFormat,e.account.settings.content=e.account.settings.content||{},e.account.department.id=e.account.department.id||this.environment.defaultDepartmentId,this._cache.keypair=o,[4,this.saveRemotely(e.account,o)];case 3:return(r=a.sent()).avatar=r.avatar||this.environment.baseUrl+nl,this._cache.mainProfile=Is.getMainProfile(r.profiles),this._data=r,this._cache.pubkey=r.pubkey,[4,this.authenticate(e)];case 4:return a.sent(),this._cache.loaded=!0,[4,this.saveLocally()];case 5:return a.sent(),console.debug("[account] Account successfully registered in "+(Date.now()-n)+"ms"),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data];case 6:throw i=a.sent(),console.error(i&&i.message||i),this.resetData(),i;case 7:return[2]}}))}))},n.prototype.authenticate=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return[4,_n(this._tokenType$)];case 1:if("basic"===(e=r.sent())||"basic-and-token"===e){if(!(this._cache.authBasic||this._cache.authToken&&"basic-and-token"===e)){if(!t||!t.username||!t.password)throw new Error("Missing username and password");this._cache.authBasic=this.cryptoService.encodeBase64(t.username+":"+t.password)}this.onAuthBasicChange.next(this._cache.authBasic)}if("token"!==e&&"basic-and-token"!==e)return[3,5];r.label=2;case 2:return r.trys.push([2,4,,5]),n=this._cache,[4,this.authenticateAndGetToken(this._cache.authToken)];case 3:return n.authToken=r.sent(),[3,5];case 4:throw o=r.sent(),console.error(o),this.resetData(),o;case 5:return"basic-and-token"===e&&(this._cache.authBasic=void 0,this.onAuthBasicChange.next(void 0)),[2]}}))}))},n.prototype.login=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:if(!t||!t.username||!t.password)throw new Error("Missing required username or password");console.debug("[account] Login..."),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.cryptoService.scryptKeypair(t.username,t.password)];case 2:return e=c.sent(),[3,4];case 3:throw n=c.sent(),console.error(n),this.resetData(),{code:Ea,message:"ERROR.SCRYPT_ERROR"};case 4:return this._cache.pubkey=Ui.encode(e.publicKey),this._cache.keypair=e,[4,this.storage.get(Js)];case 5:return o=(o=c.sent())&&o.startsWith(this._cache.pubkey)&&o||null,(r=this.settings.hasOfflineFeature()&&(this.network.offline||!0===t.offline))?(this._cache.authToken=o,this.network.setForceOffline(!0,{showToast:!1}),console.info("[account] Login [OK] {pubkey: "+this._cache.pubkey.substr(0,8)+"}, {offline: true}"),[3,9]):[3,6];case 6:return c.trys.push([6,8,,9]),[4,this.authenticate(t)];case 7:return c.sent(),[3,9];case 8:throw i=c.sent(),console.error(i),this.resetData(),i;case 9:return c.trys.push([9,11,,18]),[4,this.loadData({offline:r,fetchPolicy:"network-only"})];case 10:return c.sent(),[3,18];case 11:if(!(a=c.sent())||+a.code!==wa)return[3,17];if(-1===t.username.indexOf("@"))return[3,16];s=void 0,c.label=12;case 12:return c.trys.push([12,14,,15]),[4,this.isEmailExists(t.username)];case 13:return s=c.sent(),[3,15];case 14:throw c.sent(),a;case 15:if(!s)throw{code:Oa,message:"ERROR.UNKNOWN_ACCOUNT_EMAIL"};c.label=16;case 16:throw{code:Ia,message:"ERROR.BAD_PASSWORD"};case 17:throw a;case 18:return c.trys.push([18,20,,21]),[4,this.saveLocally()];case 19:return c.sent(),[3,21];case 20:throw l=c.sent(),console.error(l),this.resetData(),l;case 21:return this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.refresh=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");if(this.network.offline)throw new Error("Cannot check account in offline mode");return[4,this.loadData()];case 1:return t.sent(),[4,this.saveLocally()];case 2:return t.sent(),console.debug("[account] Successfully reload account"),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.save=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this._cache.pubkey?this._cache.pubkey!==t.pubkey?[2,Promise.reject("Not user account")]:[4,this.saveRemotely(t,this._cache.keypair)]:[2,Promise.reject("User not logged")];case 1:return(t=e.sent()).avatar=t.avatar||this.environment.baseUrl+nl,this._cache.mainProfile=Is.getMainProfile(t.profiles),this._data=t,this._cache.loaded=!0,[4,this.saveLocally()];case 2:return e.sent(),this.onLogin.next(this._data),this.onChange.next(this._data),[2,this._data]}}))}))},n.prototype.logout=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=this._cache.authToken&&!0,e=this._cache.authBasic&&!0,n=this._cache&&this._cache.pubkey,this.resetData(),this.settings.hasOfflineFeature()?[3,2]:[4,Promise.all([this.storage.remove(Zs),this.storage.remove(Js),this.storage.remove(el),n&&this.storage.remove("account#"+n)||Promise.resolve(),this.storage.remove(tl)])];case 1:return o.sent(),[3,4];case 2:return[4,Promise.all([this.storage.remove(Zs),this.storage.remove(el),this.storage.remove(tl)])];case 3:o.sent(),o.label=4;case 4:return[4,this.settings.clearPageHistory()];case 5:return o.sent(),this.onLogout.next(),t&&this.onAuthTokenChange.next(void 0),e&&this.onAuthBasicChange.next(void 0),this.onChange.next(void 0),[2]}}))}))},n.prototype.load=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return n=this._debug&&Date.now(),this._debug&&console.debug("[account] Loading account..."),this.network.offline&&(!e||"network-only"!==e.fetchPolicy&&"no-cache"!==e.fetchPolicy)||e&&!0===e.offline?[4,this.storage.get(el)]:[3,4];case 1:return(o=(o=(o=a.sent())&&"string"==typeof o&&JSON.parse(o)||o)&&this._cache.pubkey&&o.pubkey===this._cache.pubkey&&o||null)||!this._cache.pubkey?[3,3]:[4,this.storage.get("account#"+this._cache.pubkey)];case 2:o=(o=a.sent())&&"string"==typeof o&&JSON.parse(o)||o,a.label=3;case 3:return[3,6];case 4:return[4,this.graphql.query({query:rl,error:{code:wa,message:"ERROR.LOAD_ACCOUNT_ERROR"},fetchPolicy:e&&e.fetchPolicy||"no-cache"})];case 5:r=a.sent().data,o=r,a.label=6;case 6:return o?(i=t.Account.fromObject(o),this._debug&&console.debug("[account] Account loaded in "+(Date.now()-n)+"ms",i),[2,i]):(console.warn("[account] Account not found !"),[2,void 0])}}))}))},n.prototype.checkEmailAvailable=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.isEmailExists(t)];case 1:if(e.sent())throw{code:_a,message:"ERROR.EMAIL_ALREADY_REGISTERED"};return[2]}}))}))},n.prototype.isEmailExists=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this._debug&&console.debug("[account] Checking if {"+t+"} exists..."),[4,this.graphql.query({query:il,variables:{email:t,hash:void 0}})];case 1:return e=n.sent(),this._debug&&console.debug("[account] Email exist: "+(e&&e.isEmailExists)),[2,e&&e.isEmailExists]}}))}))},n.prototype.sendConfirmationEmail=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return e=e||this.settings.locale,console.debug("[account] Sending confirmation email to {"+t+"} with locale {"+e+"}..."),[4,this.graphql.mutate({mutation:sl,variables:{email:t,locale:e},error:{code:ka,message:"ERROR.SENT_ACCOUNT_CONFIRMATION_EMAIL_FAILED"}})];case 1:return[2,n.sent()]}}))}))},n.prototype.confirmEmail=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return console.debug("[account] Sendng confirm request for email {"+t+"} with code {"+e+"}..."),[4,this.graphql.mutate({mutation:ll,variables:{email:t,code:e},error:{code:Sa,message:"ERROR.CONFIRM_ACCOUNT_EMAIL_FAILED"}})];case 1:return[2,(n=o.sent())&&n.confirmAccountEmail]}}))}))},n.prototype.listenChanges=function(){var t=this;if(!this._cache.pubkey)return D.Subscription.EMPTY;var e=this;console.debug("[account] [WS] Listening changes");var n=this.graphql.subscribe({query:dl.listenChanges,variables:{interval:10},error:{code:Pa,message:"ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR"}}).subscribe({next:function(n){var o=n.data;return Ie(t,void 0,void 0,(function(){var t;return Oe(this,(function(n){switch(n.label){case 0:return o?io(null===(t=e._data)||void 0===t?void 0:t.updateDate)===o.updateDate?[3,2]:(console.debug("[account] [WS] Detected update on {"+o.updateDate+"}"),[4,e.refresh()]):[2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},error:function(n){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return n&&+n.code===Ka?(console.info("[account] Account not exists anymore: force user to logout...",n),[4,e.logout()]):[3,2];case 1:return t.sent(),[3,5];case 2:return n&&+n.code===Wa?(console.info("[account] Account not authorized: force user to logout...",n),[4,e.logout()]):[3,4];case 3:return t.sent(),[3,5];case 4:console.warn("[account] [WS] Received error:",n),t.label=5;case 5:return[2]}}))}))},complete:function(){console.debug("[account] [WS] Completed")}});return n.add((function(){return console.debug("[account] [WS] Stop listening changes")})),n},Object.defineProperty(n.prototype,"additionalFields",{get:function(){return this._$additionalFields.getValue()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"$additionalFields",{get:function(){return this._$additionalFields},enumerable:!1,configurable:!0}),n.prototype.getAdditionalField=function(t){return this._$additionalFields.getValue().find((function(e){return e.key===t}))},n.prototype.registerAdditionalField=function(t){var e=this._$additionalFields.getValue();if(e.find((function(e){return e.key===t.key})))throw new Error("Additional account field {key: "+t.key+"} already define.");this._debug&&console.debug("[account] Found additional account's field {key: "+t.key+"}"),this._$additionalFields.next(e.concat(t))},n.prototype.resetData=function(){this._cache.loaded=!1,this._cache.keypair=null,this._cache.authToken=null,this._cache.authBasic=null,this._cache.pubkey=null,this._cache.mainProfile=null,this._cache.person=null,this._cache.department=null,this._data=new t.Account},n.prototype.loadData=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");this._cache.loaded=!1,i.label=1;case 1:return i.trys.push([1,5,,6]),[4,this.load(e)];case 2:return(n=i.sent()||new t.Account).avatar=n.avatar||this.environment.baseUrl+nl,n.settings=n.settings||new t.UserSettings,n.settings.locale=n.settings.locale||this.settings.locale,n.settings.latLongFormat=n.settings.latLongFormat||this.settings.latLongFormat||"DDMM",n.settings.content=n.settings.content||{},this._cache.mainProfile=Is.getMainProfile(n.profiles),this._data?this._data.fromObject(n):this._data=n,this._cache.loaded=!0,n.settings?(o=Object.assign(Object.assign({},this.settings.settings),n.settings.asLocalSettings()),[4,this.settings.apply(o)]):[3,4];case 3:i.sent(),i.label=4;case 4:return[2,this._data];case 5:if(r=i.sent(),this.resetData(),r.code&&r.message)throw r;throw console.error(r),{code:wa,message:"ERROR.LOAD_ACCOUNT_ERROR"};case 6:return[2]}}))}))},n.prototype.listenSettings=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){return this.registerSubscription(this.settings.onChange.pipe(N.debounceTime(1e3),N.filter((function(){return t.isLogin()&&t.network.online}))).subscribe((function(e){return t.saveLocalSettingsRemotely(e)}))),[2]}))}))},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:return[4,Promise.all([this.storage.get(Zs),this.storage.get(Js),this.storage.get(tl)])];case 1:if(e=c.sent(),n=e[0],o=e[1],r=e[2],!n)return[2];if(!(o||r||!1))return[2];if(this._debug&&console.debug("[account] Account restoration..."),this._cache.authToken=o,this._cache.pubkey=n,this._cache.keypair=r&&{publicKey:Ui.decode(n),secretKey:Ui.decode(r)}||null,!this.network.online)return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.authenticate()];case 3:if(c.sent(),!this._cache.authToken&&!this._cache.authBasic)throw new Error("Authentication failed");return[3,5];case 4:return i=c.sent(),this.settings.hasOfflineFeature()?(console.warn("[account] Unable to authenticate on pod: forcing offline mode"),this.network.setForceOffline(!0,{showToast:!1}),[3,5]):(console.error(i),this.logout(),[2]);case 5:return[4,this.storage.get("account#"+n)];case 6:return(a=c.sent())?[3,8]:[4,this.storage.get(el)];case 7:s=c.sent(),a=s&&("string"==typeof s&&JSON.parse(a)||s),c.label=8;case 8:return a&&a.pubkey===n?(l=t.Account.fromObject(a),this._data=l,this._cache.mainProfile=Is.getMainProfile(l.profiles),this._cache.loaded=!0,this.onLogin.next(this._data),this.onChange.next(this._data),this._debug&&console.debug("[account] Account restoration [OK] {pubkey: "+n.substr(0,8)+"}, {profile: "+this._cache.mainProfile+"}"),[2,l]):[2]}}))}))},n.prototype.saveLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");return this._debug&&console.debug("[account] Saving account {"+this._cache.pubkey.substring(0,6)+"} in local storage..."),t=this._data.asObject({keepTypename:!0}),e=this._cache.keypair&&this._cache.keypair.secretKey&&Ui.encode(this._cache.keypair.secretKey)||null,t.avatar&&!t.avatar.endsWith(nl)&&(t.avatar.startsWith("http://")||t.avatar.startsWith("https://"))&&this.network.online?[4,this.file.getImage(t.avatar,{thumbnail:!0,responseType:"dataUrl"}).then((function(t){t&&o._debug&&console.debug("[account] Image fetched: ",t.substring(0,50))})).catch((function(e){console.error("[account] Error while fetching image: "+t.avatar+": "+e)}))]:[3,2];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,Promise.all([this.storage.set(Zs,this._cache.pubkey),this.storage.set(Js,this._cache.authToken),this.storage.set("account#"+this._cache.pubkey,t),e&&this.storage.set(tl,e)||this.storage.remove(tl),this.storage.remove(el)])];case 3:return r.sent(),this._debug&&console.debug("[account] Account saved in local storage"),[3,5];case 4:return n=r.sent(),console.error("[account] Error while saving account locally: "+(n&&n.message||n),n),[3,5];case 5:return[2]}}))}))},n.prototype.saveLocalSettingsRemotely=function(e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return e&&this.isLogin()&&!1!==e.accountInheritance?(n=this.account,o=t.UserSettings.fromObject(n.settings)||new t.UserSettings,o.merge(e,["locale","latLongFormat","properties"])?(this.account.settings=o,[4,this.saveSettingsRemotely(o)]):[2]):[2];case 1:return r.sent(),[2]}}))}))},n.prototype.saveRemotely=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(t.pubkey=t.pubkey||e&&Ui.encode(e.publicKey),!t.pubkey)throw new Error("Missing account pubkey");return n=this._debug&&Date.now(),this._debug&&console.debug("[account] Saving account remotely..."),(o=Ae(t.id))?[3,2]:[4,this.load({fetchPolicy:"network-only"})];case 1:if(!(r=s.sent())||!r.updateDate)throw{code:Ta,message:"ERROR.ACCOUNT_NOT_EXISTS"};this.copyIdAndUpdateDate(r,t),s.label=2;case 2:return delete(i=t.asObject(ys)).profiles,[4,this.graphql.mutate({mutation:o?al.create:al.save,variables:{data:i},error:{code:Aa,message:"ERROR.SAVE_ACCOUNT_ERROR"}})];case 3:return a=s.sent().data,this.copyIdAndUpdateDate(a,t),this._debug&&console.debug("[account] Account remotely saved in "+(Date.now()-n)+"ms"),[2,t]}}))}))},n.prototype.saveSettingsRemotely=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this._debug&&Date.now(),this._debug&&console.debug("[account] Saving settings remotely..."),n=t.asObject(ys),[4,this.graphql.mutate({mutation:al.saveSettings,variables:{data:n},error:{code:Ra,message:"ERROR.SAVE_SETTINGS_ERROR"}})];case 1:return o=r.sent().data,this.copyIdAndUpdateDateSettings(o,t),this._debug&&console.debug("[account] Settings remotely saved in "+(Date.now()-e)+"ms"),this.account&&(this.account.settings=t),[2]}}))}))},n.prototype.authenticateAndGetToken=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(!this._cache.pubkey)throw new Error("User not logged");if(e||console.info("[account] Authentication on pod..."),e>4)throw this._debug&&console.debug("[account] Failed to authentication on pod (after "+e+" attempts)"),{code:$a,message:"ERROR.AUTH_SERVER_ERROR"};return t?[4,this.graphql.query({query:cl,variables:{token:t},error:{code:Va,message:"ERROR.UNAUTHORIZED"},fetchPolicy:"no-cache"})]:[3,2];case 1:if((n=s.sent())&&n.authenticate)return this.onAuthTokenChange.next(t),console.info("[account] Authentication on pod [OK] {pubkey: '"+this._cache.pubkey.substr(0,8)+"'}"),[2,t];s.label=2;case 2:return o={code:qa,message:"ERROR.AUTH_CHALLENGE_ERROR"},[4,this.graphql.query({query:ul,variables:{},error:o,fetchPolicy:"network-only"})];case 3:if(!(r=s.sent())||!r.authChallenge)throw o;return[4,this.cryptoService.verify(r.authChallenge.challenge,r.authChallenge.signature,r.authChallenge.pubkey)];case 4:return s.sent()||console.warn("FIXME: Bad peer signature on auth challenge !",r.authChallenge),[4,this.cryptoService.sign(r.authChallenge.challenge,this._cache.keypair)];case 5:return i=s.sent(),a=this._cache.pubkey+":"+r.authChallenge.challenge+"|"+i,[4,this.authenticateAndGetToken(a,(e||1)+1)];case 6:return[2,s.sent()]}}))}))},n.prototype.copyIdAndUpdateDate=function(t,e){t&&(e.id=t.id||e.id,e.updateDate=t.updateDate||e.updateDate,this.copyIdAndUpdateDateSettings(t.settings,e.settings))},n.prototype.copyIdAndUpdateDateSettings=function(t,e){t&&(e.id=t.id||e.id,e.updateDate=t.updateDate||e.updateDate)},n}(Ls);pl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new pl(jt.ɵɵinject(Hi),jt.ɵɵinject(Ca),jt.ɵɵinject(Ns),jt.ɵɵinject(ga),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Li),jt.ɵɵinject(me))},token:pl,providedIn:"root"}),pl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pl.ctorParameters=function(){return[{type:Hi},{type:Ca},{type:Ns},{type:ga},{type:st.Storage},{type:Li},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},t.Software=Ys=function(t){function e(e){return t.call(this,e||Ys.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return n.creationDate=io(this.creationDate),n.properties=this.properties,n},e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.label=e.label,this.name=e.name,this.description=e.description,this.comments=e.comments,this.creationDate=ao(e.creationDate),this.statusId=e.statusId,e.properties&&Array.isArray(e.properties)?this.properties=Qi.getPropertyArrayAsObject(e.properties):this.properties=Object.assign({},e.properties)},e}(Wi),t.Software=Ys=we([Ji({typename:"SoftwareVO"})],t.Software),t.Configuration=Xs=function(e){function n(){return e.call(this,Xs.TYPENAME)||this}return Ee(n,e),n.prototype.clone=function(){return this.copy(new Xs)},n.prototype.copy=function(t){return t.fromObject(this),t},n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,t);return n.partners=this.partners&&this.partners.map((function(e){return e.asObject(t)}))||void 0,n},n.prototype.fromObject=function(n){e.prototype.fromObject.call(this,n),this.smallLogo=n.smallLogo,this.largeLogo=n.largeLogo,this.backgroundImages=n.backgroundImages,this.partners=n.partners&&n.partners.map(t.Department.fromObject)||void 0},n.prototype.getPropertyAsBoolean=function(t){var e=this.getProperty(t);return Re(e)?e&&"false"!==e:void 0},n.prototype.getPropertyAsInt=function(t){var e=this.getProperty(t);return Re(e)?parseInt(e):void 0},n.prototype.getPropertyAsNumbers=function(t){var e=this.getProperty(t);return"string"==typeof e?e.split(",").map(parseFloat)||void 0:Re(e)?[parseFloat(e)]:void 0},n.prototype.getPropertyAsStrings=function(t){var e=this.getProperty(t);return e&&e.split(",")||void 0},n.prototype.getProperty=function(t){return Re(this.properties[t.key])?this.properties[t.key]:t.defaultValue||void 0},n}(t.Software),t.Configuration=Xs=we([Ji({typename:"ConfigurationVO"})],t.Configuration);var hl,ml,fl,gl,bl,yl=Object.freeze({LOGO:{key:"sumaris.logo",label:"CONFIGURATION.OPTIONS.LOGO",type:"string"},FAVICON:{key:"sumaris.favicon",label:"CONFIGURATION.OPTIONS.FAVICON",type:"string"},DEFAULT_LOCALE:{key:"sumaris.defaultLocale",label:"CONFIGURATION.OPTIONS.DEFAULT_LOCALE",type:"enum",values:rs},DEFAULT_LAT_LONG_FORMAT:{key:"sumaris.defaultLatLongFormat",label:"CONFIGURATION.OPTIONS.DEFAULT_LATLONG_FORMAT",type:"enum",values:[{key:"DDMMSS",value:"COMMON.LAT_LONG.DDMMSS_PLACEHOLDER"},{key:"DDMM",value:"COMMON.LAT_LONG.DDMM_PLACEHOLDER"},{key:"DD",value:"COMMON.LAT_LONG.DD_PLACEHOLDER"}]},REGISTRATION_ENABLE:{key:"sumaris.registration.enable",label:"CONFIGURATION.OPTIONS.HOME.ENABLE_REGISTRATION",type:"boolean",defaultValue:!0},AUTH_TOKEN_TYPE:{key:"sumaris.auth.token.type",label:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE_PLACEHOLDER",type:"enum",values:[{key:"token",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.TOKEN"},{key:"basic",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.BASIC"},{key:"basic-and-token",value:"CONFIGURATION.OPTIONS.AUTH_TOKEN_TYPE.BASIC_AND_TOKEN"}],defaultValue:"token"},GRAVATAR_ENABLE:{key:"sumaris.gravatar.enable",label:"CONFIGURATION.OPTIONS.ENABLE_GRAVATAR",type:"boolean",defaultValue:!1},GRAVATAR_URL:{key:"sumaris.gravatar.url",label:"CONFIGURATION.OPTIONS.GRAVATAR_URL",type:"string",defaultValue:"https://www.gravatar.com/avatar/{md5}"},TESTING:{key:"sumaris.testing.enable",label:"CONFIGURATION.OPTIONS.TESTING",type:"boolean"},APP_MIN_VERSION:{key:"sumaris.app.version.min",label:"CONFIGURATION.OPTIONS.APP_MIN_VERSION",type:"string"},HELP_URL:{key:"sumaris.help.url",label:"CONFIGURATION.OPTIONS.HELP_URL",type:"string"},FORUM_URL:{key:"sumaris.forum.url",label:"CONFIGURATION.OPTIONS.FORUM_URL",type:"string"},LOGO_LARGE:{key:"sumaris.logo.large",label:"CONFIGURATION.OPTIONS.HOME.LOGO_LARGE",type:"string"},MENU_ITEMS:{key:"sumaris.menu.items",label:"CONFIGURATION.OPTIONS.MENU.ITEMS",type:"string"},HOME_PARTNERS_DEPARTMENTS:{key:"sumaris.partner.departments",label:"CONFIGURATION.OPTIONS.HOME.PARTNER_DEPARTMENTS",type:"string"},HOME_BACKGROUND_IMAGE:{key:"sumaris.background.images",label:"CONFIGURATION.OPTIONS.HOME.BACKGROUND_IMAGES",type:"string"},COLOR_PRIMARY:{key:"sumaris.color.primary",label:"CONFIGURATION.OPTIONS.COLORS.PRIMARY",type:"color"},COLOR_SECONDARY:{key:"sumaris.color.secondary",label:"CONFIGURATION.OPTIONS.COLORS.SECONDARY",type:"color"},COLOR_TERTIARY:{key:"sumaris.color.tertiary",label:"CONFIGURATION.OPTIONS.COLORS.TERTIARY",type:"color"},COLOR_SUCCESS:{key:"sumaris.color.success",label:"CONFIGURATION.OPTIONS.COLORS.SUCCESS",type:"color"},COLOR_WARNING:{key:"sumaris.color.warning",label:"CONFIGURATION.OPTIONS.COLORS.WARNING",type:"color"},COLOR_ACCENT:{key:"sumaris.color.accent",label:"CONFIGURATION.OPTIONS.COLORS.ACCENT",type:"color"},COLOR_DANGER:{key:"sumaris.color.danger",label:"CONFIGURATION.OPTIONS.COLORS.DANGER",type:"color"},ANDROID_INSTALL_URL:{key:"sumaris.android.install.url",label:"CONFIGURATION.OPTIONS.ANDROID_INSTALL_URL",type:"string"}}),vl="configuration",Cl={config:yt.gql(hl||(hl=Se(["\n fragment ConfigFragment on ConfigurationVO {\n id\n label\n name\n description\n comments\n properties\n smallLogo\n largeLogo\n backgroundImages\n partners {\n id\n label\n name\n logo\n siteUrl\n __typename\n }\n updateDate\n creationDate\n statusId\n __typename\n }\n "],["\n fragment ConfigFragment on ConfigurationVO {\n id\n label\n name\n description\n comments\n properties\n smallLogo\n largeLogo\n backgroundImages\n partners {\n id\n label\n name\n logo\n siteUrl\n __typename\n }\n updateDate\n creationDate\n statusId\n __typename\n }\n "])))},El=yt.gql(ml||(ml=Se(["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"],["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"])),Cl.config),wl=yt.gql(fl||(fl=Se(["\n mutation SaveConfiguration($data: ConfigurationVOInput){\n data: saveConfiguration(config: $data){\n ...ConfigFragment\n }\n }\n ","\n"],["\n mutation SaveConfiguration($data: ConfigurationVOInput){\n data: saveConfiguration(config: $data){\n ...ConfigFragment\n }\n }\n ","\n"])),Cl.config),Il=yt.gql(gl||(gl=Se(["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"],["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"]))),Ol=yt.gql(bl||(bl=Se(["\n query CacheStatistics {\n cacheStatistics\n }\n"],["\n query CacheStatistics {\n cacheStatistics\n }\n"]))),_l=new e.InjectionToken("defaultOptions"),xl=function(e){function n(t,n,o,r,i,a,s,l,c){var u=e.call(this,n,l)||this;return u.platform=t,u.graphql=n,u.storage=o,u.network=r,u.file=i,u.toastController=a,u.translate=s,u.environment=l,u.$data=new D.BehaviorSubject(null),u._debug=!l.production,u._debug&&console.debug("[config] Creating service"),u._optionDefs=Object.values(Object.assign(Object.assign({},yl),c)),u}return Ee(n,e),Object.defineProperty(n.prototype,"config",{get:function(){return this.started||this.start(),this.$data.pipe(N.filter(Re))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[config] Starting configuration..."),[4,this.loadOrRestoreLocally()];case 1:return t=n.sent(),this.$data.next(t),this.registerSubscription(this.graphql.onStart.subscribe((function(){return e.restart()}))),[2,t]}}))}))},n.prototype.loadDefault=function(e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return n=Date.now(),console.debug("[config] Loading Pod configuration..."),o=e&&e.query||El,r=e&&e.variables||void 0,[4,this.graphql.query({query:o,variables:r,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:e&&e.fetchPolicy||void 0})];case 1:return i=s.sent(),a=i&&i.data?t.Configuration.fromObject(i.data):void 0,console.info("[config] Pod configuration loaded in "+(Date.now()-n)+"ms:",a),[2,a]}}))}))},n.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return console.warn("[config] Invalid call of configService.load(id). Please use loadDefault() instead"),[2,this.loadDefault()]}))}))},n.prototype.save=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return console.debug("[config] Saving Pod configuration...",t),e=t.asObject(),[4,this.graphql.mutate({mutation:wl,variables:{data:e},error:{code:Ha,message:"ERROR.SAVE_CONFIG_ERROR"}})];case 1:return n=a.sent(),o=n&&n.data,t.id=o&&o.id||t.id,t.updateDate=o&&o.updateDate||t.updateDate,console.debug("[config] Pod configuration saved!"),[4,this.loadDefault({fetchPolicy:"network-only"})];case 2:return r=a.sent(),Re(i=this.$data.value)&&r.label===i.label&&this.$data.next(r),[2,r]}}))}))},n.prototype.getCacheStatistics=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=Date.now(),console.debug("[config] Loading server cache statistics..."),[4,this.graphql.query({query:Ol,variables:null,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"network-only"})];case 1:return e=o.sent(),n=e&&e.cacheStatistics||void 0,console.info("[config] Server cache statistics loaded in "+(Date.now()-t)+"ms:",n),[2,n]}}))}))},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return e=Date.now(),console.debug("[config] Clear server cache..."),n={name:t&&t.cacheName}||void 0,[4,this.graphql.query({query:Il,variables:n,error:{code:Ga,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"network-only"})];case 1:return o=i.sent(),r=o&&o.clearCache||void 0,console.info("[config] Clear server cache in "+(Date.now()-e)+"ms:",r),[2,r]}}))}))},n.prototype.delete=function(t,e){throw new Error("Not implemented yet!")},n.prototype.listenChanges=function(t,e){return new D.Subject},Object.defineProperty(n.prototype,"optionDefs",{get:function(){return this._optionDefs},enumerable:!1,configurable:!0}),n.prototype.loadOrRestoreLocally=function(){return Ie(this,void 0,void 0,(function(){var t,e,n=this;return Oe(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.loadDefault({fetchPolicy:"network-only"})];case 2:return t=o.sent(),!0,[3,4];case 3:return e=o.sent(),console.error(e&&e.message||e,e),[3,4];case 4:return t?(setTimeout((function(){return n.storeLocally(t)}),1e3),[3,7]):[3,5];case 5:return[4,this.restoreLocally()];case 6:t=o.sent(),o.label=7;case 7:return t.label=t.label||this.environment.name,t.name=t.name!==t.label?t.name:void 0,[2,t]}}))}))},n.prototype.restoreLocally=function(){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.storage.get(vl)];case 1:if(n=o.sent()){if(console.debug("[config] Restoring configuration from local storage..."),"string"==typeof n)try{e=t.Configuration.fromObject(JSON.parse(n))}catch(t){console.error("Failed to parse config found in local storage: "+(t&&t.message||t),t)}else"object"==typeof n&&(e=t.Configuration.fromObject(n));console.debug("[config] Restoring configuration [OK]")}return e||(console.debug("[config] No configuration found. Using environment..."),e=t.Configuration.fromObject(this.environment)),[2,e]}}))}))},n.prototype.storeLocally=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return t?[3,2]:[4,this.storage.remove(vl)];case 1:return s.sent(),[3,8];case 2:if(e=this._debug&&Date.now(),!this.network.online||!this.platform.is("mobile"))return[3,6];if(n=[],t.largeLogo&&t.largeLogo.startsWith("http")&&n.push(this.file.getImage(t.largeLogo).then((function(e){return t.largeLogo=e}))),t.smallLogo&&t.smallLogo.startsWith("http")&&n.push(this.file.getImage(t.smallLogo).then((function(e){return t.smallLogo=e}))),Ne(t.backgroundImages)&&(o={maxWidth:this.platform.width(),maxHeight:this.platform.height()},-1!==(r=t.backgroundImages.findIndex((function(t){return t&&t.startsWith("http")})))&&(t.backgroundImages=t.backgroundImages.slice(),n.push(this.file.getImage(t.backgroundImages[r],o).then((function(e){return t.backgroundImages[r]=e}))))),Ne(t.partners)&&t.partners.forEach((function(t,e){t&&t.logo&&t.logo.startsWith("http")&&n.push(a.file.getImage(t.logo,{maxHeight:50}).then((function(e){return t.logo=e})).catch((function(e){console.error(e&&e.message||e),delete t.logo})))})),!n.length)return[3,6];this._debug&&console.debug("[config] Fetching "+n.length+" images..."),s.label=3;case 3:return s.trys.push([3,5,,6]),[4,Promise.all(n)];case 4:return s.sent(),this._debug&&console.debug("[config] Fetching "+n.length+" images [OK] in "+(Date.now()-e)+"ms"),[3,6];case 5:return i=s.sent(),console.error("[config] Failed to fetch image(s): "+(i&&i.message||i),i),[3,6];case 6:return e=this._debug&&Date.now(),this._debug&&console.debug("[config] Saving config into local storage..."),[4,this.storage.set(vl,t.asObject())];case 7:s.sent(),this._debug&&console.debug("[config] Saving config into local storage [OK] in "+(Date.now()-e)+"ms"),s.label=8;case 8:return[2]}}))}))},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},n}(Ls);xl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new xl(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(Ns),jt.ɵɵinject(te.Storage),jt.ɵɵinject(Ca),jt.ɵɵinject(Li),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(me),jt.ɵɵinject(_l,8))},token:xl,providedIn:"root"}),xl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[_l]}]}],xl.ctorParameters=function(){return[{type:M.Platform},{type:Ns},{type:st.Storage},{type:Ca},{type:Li},{type:M.ToastController},{type:F.TranslateService},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[_l]}]}]};var kl=Ht,Sl=function(t){function e(e,n,o,r,i,a,s,l,c,u,d,p,h,m,f,g,b,y,v){var C=t.call(this,e)||this;return C.platform=e,C.cdkPlatform=n,C.toastController=o,C.translate=r,C.dateAdapter=i,C.entitiesStorage=a,C.settings=s,C.networkService=l,C.accountService=c,C.configService=u,C.cache=d,C.storage=p,C.audioProvider=h,C.environment=m,C.statusBar=f,C.keyboard=g,C.splashScreen=b,C.browser=y,C.downloader=v,C._downloadingJobs=new Map,C._debug=!m.production,C._debug&&console.debug("[platform] Creating service"),C}return Ee(e,t),Object.defineProperty(e.prototype,"mobile",{get:function(){return Re(this._mobile)?this._mobile:this.platform.is("mobile")},enumerable:!1,configurable:!0}),e.prototype.is=function(t){return this.platform.is(t)},e.prototype.isWebOrDesktop=function(){return!this.platform.is("mobile")||this.platform.is("mobileweb")},e.prototype.isAndroidCordova=function(){return this._android&&this._cordova},Object.defineProperty(e.prototype,"canDownload",{get:function(){return Re(this.downloader)},enumerable:!1,configurable:!0}),e.prototype.width=function(){return this.platform.width()},e.prototype.height=function(){return this.platform.height()},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:t=Date.now(),this.accountService.tokenType=void 0,console.info("[platform] Starting platform..."),r.label=1;case 1:return r.trys.push([1,6,,7]),this._mobile=this.platform.is("mobile"),this._cordova=this.platform.is("cordova"),this._android=this.platform.is("android"),this.configureCordovaPlugins(this._mobile),this.touchUi=this._mobile||this.platform.is("tablet")||this.platform.is("phablet"),this._mobile&&(this.settings.mobile=this._mobile,this.settings.touchUi=this.touchUi),[4,this.configureTranslate()];case 2:return r.sent(),[4,this.storageReady()];case 3:return e=r.sent(),[4,this.migrateStorage(e)];case 4:return r.sent(),[4,Promise.all([this.entitiesStorage.ready(),this.cache.ready().then((function(){return o.configureCache()})),this.settings.ready(),this.networkService.ready(),this.audioProvider.ready()])];case 5:return r.sent(),console.info("[platform] Starting platform [OK] {mobile: "+this._mobile+", touchUi: "+this.touchUi+", downloader: "+this.canDownload+"} in "+(Date.now()-t)+"ms"),this.networkService.onNetworkStatusChanges.pipe(N.skip(1)).subscribe((function(t){return o.configureCache("none"!==t)})),this.configService.config.pipe(N.map((function(t){return null==t?void 0:t.getProperty(yl.AUTH_TOKEN_TYPE)})),N.filter(Pe),N.distinctUntilChanged()).subscribe((function(t){console.info("[platform] Using auth token type {"+t+"}"),o.accountService.tokenType=t})),this.mobile&&setTimeout((function(){var t;null===(t=o.splashScreen)||void 0===t||t.hide(),o.audioProvider.playStartupSound()}),1e3),[3,7];case 6:return n=r.sent(),[2,this.onStartupError(n)];case 7:return[2]}}))}))},e.prototype.open=function(t,e,n,o){console.info("[platform] Opening link: "+t),this.browser&&this._mobile?this.browser.create(t,e,n).show():window.open(t,e,n,o)},e.prototype.getDownloadingJob=function(t){return this._downloadingJobs.get(t)},e.prototype.download=function(t){var e=this;if(!t||!t.uri)throw new Error("Missing argument 'request' or 'request.uri'");if(this._android&&this.downloader){var n=this._downloadingJobs.get(t.uri);return n||(t=Object.assign(Object.assign({visibleInDownloadsUi:!0,notificationVisibility:St.NotificationVisibility.VisibleNotifyCompleted,title:t.title||t.filename},t),{destinationInExternalPublicDir:Object.assign({dirType:"Downloads",subPath:t.filename||t.title||""},t.destinationInExternalPublicDir)}),console.debug("[platform] Downloading, using request: "+JSON.stringify(t)),n=D.from(this.downloader.download(t)),this._downloadingJobs.set(t.uri,n),n.pipe(N.tap((function(n){console.info("[platform] File successfully downloaded at:"+n),e._downloadingJobs.delete(t.uri)})),N.catchError((function(n){throw console.error("[platform] Unable to download: "+(n&&n.message||n)),e._downloadingJobs.delete(t.uri),n}))))}return console.warn("[platform] Cannot use Android downloader: using browser open()"),this.open(t.uri,"_system","location=no",!0),D.of()},e.prototype.configureCordovaPlugins=function(t){console.info("[platform] Configuring Cordova plugins..."),this.statusBar&&(this.statusBar.styleDefault(),this.statusBar.overlaysWebView(!1)),this.keyboard&&this.keyboard.hideFormAccessoryBar(!0),this.browser},e.prototype.configureTranslate=function(){var t=this;console.info("[platform] Configuring i18n ..."),this.translate.setDefaultLang(this.environment.defaultLocale),this.translate.onLangChange.subscribe((function(e){if(e&&e.lang){"en"===e.lang&&(e.lang="en_GB");try{kl.locale(e.lang),console.debug("[platform] Use locale {"+e.lang+"}")}catch(t){kl.locale("en"),console.warn("[platform] Unknown local for moment lib. Using default [en]")}t.dateAdapter.setLocale(kl.locale())}})),this.settings.onChange.subscribe((function(e){e&&e.locale&&e.locale!==t.translate.currentLang&&t.translate.use(e.locale)})),this.accountService.onLogin.subscribe((function(e){if(e.settings&&t.settings.settings.accountInheritance){var n=e.settings.asLocalSettings();t.settings.apply(n)}}))},e.prototype.configureCache=function(t){var e=(t=je(t,this.cache.isOnline()))?3600:2592e3;console.info("[platform] Configuring cache [OK] {online: "+t+", timeToLive: "+e/3600+"h, offlineInvalidate: false}"),this.cache.setDefaultTTL(e),this.cache.setOfflineInvalidate(!1)},e.prototype.storageReady=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){switch(e.label){case 0:return console.info("[platform] Starting storage..."),[4,this.storage.ready()];case 1:return t=e.sent(),Ae(t.driver())?(console.error("[platform] NO DRIVER DEFINED IN STORAGE. Local storage cannot be used !"),[2,Promise.resolve(t)]):(console.info("[platform] Starting storage [OK] {name: '"+t.config().name+"', driver: '"+t.driver()+"', size: "+t.config().size),console.debug("[platform] Storage supports: {"+t.WEBSQL+": "+t.supports(t.WEBSQL)+", "+t.INDEXEDDB+": "+t.supports(t.INDEXEDDB)+", "+t.LOCALSTORAGE+": "+t.supports(t.LOCALSTORAGE)+"}"),[2,t])}}))}))},e.prototype.migrateStorage=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return t&&("cordovaSQLiteDriver"===t.driver()&&(t.supports(t.INDEXEDDB)||t.supports(t.WEBSQL))||t.driver()===t.WEBSQL&&t.supports(t.INDEXEDDB))?[4,(e=t.createInstance({name:t.config().name,storeName:t.config().storeName,driver:[t.INDEXEDDB,t.WEBSQL]})).keys()]:[2];case 1:return Fe(n=s.sent())?(console.debug("[platform] Old storage is empty: dropping unused instance {name: '"+t.config().name+"', driver: '"+e.driver()+"'}"),[4,e.dropInstance()]):[3,3];case 2:return s.sent(),[3,12];case 3:return o=Date.now(),console.info("[platform] Starting storage migration..."),[4,this.showToast({message:"INFO.DATA_MIGRATION_STARTED",duration:3e4})];case 4:r=s.sent(),s.label=5;case 5:return s.trys.push([5,9,,12]),[4,os.copy(e,t,{keys:n,deleteAfterCopy:!1})];case 6:return s.sent(),i=Date.now()-o,setTimeout((function(){return r.dismiss()}),Math.max(2e3-i,0)),[4,this.showToast({message:"INFO.DATA_MIGRATION_SUCCEED",type:"info",showCloseButton:!0})];case 7:return s.sent(),console.info("[platform] Starting storage migration [OK]"),console.info("[platform] Drop old storage {name: '"+t.config().name+"', driver: '"+e.driver()+"'}"),[4,e.dropInstance()];case 8:return s.sent(),[3,12];case 9:return a=s.sent(),console.error(a&&a.message||a,a),[4,r.dismiss()];case 10:return s.sent(),[4,this.showToast({message:"ERROR.DATA_MIGRATION_FAILED",type:"error",showCloseButton:!0})];case 11:return s.sent(),[3,12];case 12:return[2]}}))}))},e.prototype.showToast=function(t){var e=this;if(!this.toastController)throw new Error("Missing toastController in component's constructor");return new Promise((function(n){return ba.show(e.toastController,e.translate,Object.assign(Object.assign({},t),{onWillPresent:function(t){return n(t)}}))}))},e.prototype.onStartupError=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return console.error("[platform] Failed starting the platform! ",t),e=t&&t.message||t,n=t&&(t.details&&t.details.message||t.details),11===t.code&&this.cdkPlatform.FIREFOX&&(e="ERROR.FIREFOX_NO_STORAGE"),this.translate?[4,this.translate.get(e).toPromise()]:[3,2];case 1:return e=o.sent(),t&&t.code&&(e+=" {code: "+t.code+"}"),[3,3];case 2:e="Fatal error: Please contact your administrator.\n\n{code: "+(t&&t.code||"null")+', message: "'+e+'"}',o.label=3;case 3:return this.toastController?(n&&(e+="<br/><small>"+n+"</small>"),[4,this.showToast({type:"error",duration:-1,showCloseButton:!0,message:e})]):[3,5];case 4:return o.sent(),[3,6];case 5:window?(n&&(e+='\n\n{cause: "'+n+'"}'),window.alert(e)):(console.error(e),t&&t.details&&console.error("cause",t.details)),o.label=6;case 6:return[2]}}))}))},e}(_i);Sl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Sl(jt.ɵɵinject(Gt.Platform),jt.ɵɵinject(re.Platform),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Wt.MomentDateAdapter),jt.ɵɵinject(es),jt.ɵɵinject(ga),jt.ɵɵinject(Ca),jt.ɵɵinject(pl),jt.ɵɵinject(xl),jt.ɵɵinject(ee.CacheService),jt.ɵɵinject(te.Storage),jt.ɵɵinject(ki),jt.ɵɵinject(me),jt.ɵɵinject(ue.StatusBar,8),jt.ɵɵinject(de.Keyboard,8),jt.ɵɵinject(oe.SplashScreen,8),jt.ɵɵinject(pe.InAppBrowser,8),jt.ɵɵinject(he.Downloader,8))},token:Sl,providedIn:"root"}),Sl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sl.ctorParameters=function(){return[{type:M.Platform},{type:gt.Platform},{type:M.ToastController},{type:F.TranslateService},{type:j.MomentDateAdapter},{type:es},{type:ga},{type:Ca},{type:pl},{type:xl},{type:dt.CacheService},{type:st.Storage},{type:ki},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ft.StatusBar,decorators:[{type:e.Optional}]},{type:B.Keyboard,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:bt.InAppBrowser,decorators:[{type:e.Optional}]},{type:St.Downloader,decorators:[{type:e.Optional}]}]};var Al=function(){function t(t,e,n,o,r,i){this.injector=t,this.viewCtrl=e,this.platform=n,this.settings=o,this.translate=r,this.cd=i,this.loading=!0,this.error=void 0,this.showError=!0}return t.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.viewCtrl.dismiss()];case 1:return t.sent(),[2]}}))}))},t.prototype.markAsLoaded=function(){this.loading=!1,this.error=null},t.prototype.onLoadError=function(t){console.error(t),this.error=t,this.loading=!1},t}();Al.decorators=[{type:e.Component,args:[{selector:"app-help-modal",template:'<app-modal-toolbar color="light"\n [title]="title"\n (cancel)="close($event)"\n [showSpinner]="loading">\n</app-modal-toolbar>\n\n<ion-content class="ion-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error && showError" visible-xs visible-sm visible-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <markdown *ngIf="markdownContent"\n [data]="markdownContent"\n (ready)="markAsLoaded()"\n emoji>\n </markdown>\n\n <markdown *ngIf="docUrl"\n [src]="docUrl + \'.md\'"\n (load)="markAsLoaded()"\n (error)="onLoadError($event)"\n emoji></markdown>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="tertiary" (click)="close()">{{\'COMMON.BTN_CLOSE\'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n\n\n'}]}],Al.ctorParameters=function(){return[{type:e.Injector},{type:M.ModalController},{type:Sl},{type:ga},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Al.propDecorators={title:[{type:e.Input}],markdownContent:[{type:e.Input}],docUrl:[{type:e.Input}],showError:[{type:e.Input}]};var Tl=function(t){function e(e){var n=t.call(this)||this;return n.translate=e,e.onLangChange.subscribe((function(){return n.translateLabels()})),n.translateLabels(),n}return Ee(e,t),e.prototype.translateLabels=function(){this.optionalLabel=this.translate.instant("COMMON.OPTIONAL")},e}(w.MatStepperIntl);function Rl(t){return function(){return t.scrollStrategies.close()}}Tl.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Tl(jt.ɵɵinject($t.TranslateService))},token:Tl,providedIn:"root"}),Tl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tl.ctorParameters=function(){return[{type:F.TranslateService}]};var Pl=function(){function t(){}return t.forRoot=function(e){return console.debug("[shared] Creating module (root)"),{ngModule:t,providers:[{provide:me,useValue:e},di,ki,Li,ko,Mn,Bn,jn,Xn,Jn,Zn,eo,to,{provide:i.OverlayContainer,useClass:i.FullscreenOverlayContainer},{provide:Q.HTTP_INTERCEPTORS,useClass:bi,multi:!0,deps:[di]},{provide:u.MatPaginatorIntl,useClass:gi,deps:[F.TranslateService]},{provide:w.MatStepperIntl,useClass:Tl,deps:[F.TranslateService]},{provide:R.MAT_AUTOCOMPLETE_SCROLL_STRATEGY,useFactory:Rl,deps:[i.Overlay]},{provide:R.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,useValue:{autoActiveFirstOption:!0}},{provide:v.MAT_SELECT_SCROLL_STRATEGY,useFactory:Rl,deps:[i.Overlay]}]}},t}();Pl.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,F.TranslateModule,Y.ColorPickerModule,U.TextMaskModule,rt.DragDropModule,it.MarkdownModule,ui,pr,ur,Ti],declarations:[fi,ji,Oi,Bi,Al],exports:[n.CommonModule,M.IonicModule,F.TranslateModule,P.ReactiveFormsModule,Y.ColorPickerModule,U.TextMaskModule,rt.DragDropModule,it.MarkdownModule,ui,pr,ur,Ti,fi,ji,Oi,Bi,Al]}]}];var Dl=function(){function t(){}return t.askSaveBeforeLeave=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return o=!1,r=!1,i=e.instant(["COMMON.BTN_SAVE","COMMON.BTN_CANCEL","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE","CONFIRM.ALERT_HEADER"]),[4,t.create({header:i["CONFIRM.ALERT_HEADER"],message:i["CONFIRM.SAVE"],buttons:[{text:i["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){r=!0}},{text:i["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){}},{text:i["COMMON.BTN_SAVE"],handler:function(){o=!0}}]})];case 1:return[4,(a=s.sent()).present()];case 2:return s.sent(),[4,a.onDidDismiss()];case 3:return s.sent(),o?[2,!0]:r?(n&&n.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askActionConfirmation=function(e,n,o,r,i){return Ie(this,void 0,void 0,(function(){var a;return Oe(this,(function(s){return a=!0===o?"CONFIRM.ACTION_IMMEDIATE":"CONFIRM.ACTION",[2,t.askConfirmation(a,e,n,r,i)]}))}))},t.askConfirmation=function(t,e,n,o,r){return Ie(this,void 0,void 0,(function(){var i,a,s,l;return Oe(this,(function(c){switch(c.label){case 0:if(!e||!n)throw new Error("Missing required argument 'alertCtrl' or 'translate'");return i=!1,a=!1,s=n.instant(["COMMON.BTN_YES_CONTINUE","COMMON.BTN_CANCEL",t,"CONFIRM.ALERT_HEADER"],r),[4,e.create({header:s["CONFIRM.ALERT_HEADER"],message:s[t],buttons:[{text:s["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){a=!0}},{text:s["COMMON.BTN_YES_CONTINUE"],handler:function(){i=!0}}]})];case 1:return[4,(l=c.sent()).present()];case 2:return c.sent(),[4,l.onDidDismiss()];case 3:return c.sent(),i?[2,!0]:a?(o&&o.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askDeleteConfirmation=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var r,i,a,s;return Oe(this,(function(l){switch(l.label){case 0:return r=!1,i=!1,a=e.instant(["COMMON.BTN_YES_DELETE","COMMON.BTN_CANCEL","CONFIRM.DELETE","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:a["CONFIRM.ALERT_HEADER"],message:a["CONFIRM.DELETE"],buttons:[{text:a["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){i=!0}},{text:a["COMMON.BTN_YES_DELETE"],handler:function(){r=!0}}]})];case 1:return[4,(s=l.sent()).present()];case 2:return l.sent(),[4,s.onDidDismiss()];case 3:return l.sent(),r?[2,!0]:i?(n&&n.preventDefault(),[2,void 0]):[2,!1]}}))}))},t.askSaveBeforeAction=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var r,i,a,s;return Oe(this,(function(l){switch(l.label){case 0:return r=!1,i=!1,n&&n.valid?(s=e.instant(["COMMON.BTN_CANCEL","COMMON.BTN_SAVE","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE_BEFORE_CONTINUE","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:s["CONFIRM.ALERT_HEADER"],message:s["CONFIRM.SAVE_BEFORE_CONTINUE"],buttons:[{text:s["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){}},{text:s["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){i=!0}},{text:s["COMMON.BTN_SAVE"],handler:function(){r=!0,i=!0}}]})]):[3,2];case 1:return a=l.sent(),[3,4];case 2:return s=e.instant(["COMMON.BTN_ABORT_CHANGES","COMMON.BTN_CANCEL","CONFIRM.CANCEL_CHANGES","CONFIRM.ALERT_HEADER"],o),[4,t.create({header:s["CONFIRM.ALERT_HEADER"],message:s["CONFIRM.CANCEL_CHANGES"],buttons:[{text:s["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){i=!0}},{text:s["COMMON.BTN_CANCEL"],role:"cancel",handler:function(){}}]})];case 3:a=l.sent(),l.label=4;case 4:return[4,a.present()];case 5:return l.sent(),[4,a.onDidDismiss()];case 6:return l.sent(),[2,{confirmed:i,save:r}]}}))}))},t.showError=function(t,e,n,o,r){return Ie(this,void 0,void 0,(function(){var i,a,s;return Oe(this,(function(l){switch(l.label){case 0:if(!t||!e||!n)throw new Error("Missing a required argument ('messageKey', 'alertCtrl' or 'translate')");return i=o&&o.titleKey||"ERROR.ALERT_HEADER",a=n.instant(["COMMON.BTN_OK",t,i],r),[4,e.create({header:a[i],message:a[t],buttons:[{text:a["COMMON.BTN_OK"],role:"cancel"}]})];case 1:return[4,(s=l.sent()).present()];case 2:return l.sent(),[4,s.onDidDismiss()];case 3:return l.sent(),[2]}}))}))},t}(),Nl=function(){function t(t,e){this.translate=t,this.alertCtrl=e,this.debug=!1}return t.prototype.canDeactivate=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=t.dirty,n=t.valid,o={confirmed:!e,save:!1},this.debug&&console.debug("[dirty-guard] canDeactivate component dirty: "+e+", valid: "+n),e?[4,Dl.askSaveBeforeAction(this.alertCtrl,this.translate,{valid:n})]:[3,2];case 1:o=r.sent(),r.label=2;case 2:return this.debug&&console.debug("[dirty-guard] confirm: "+o.confirmed),o.confirmed?o.save?(this.debug&&console.debug("[dirty-guard] do save"),[4,t.save()]):[3,4]:[3,6];case 3:return r.sent()?[3,5]:(this.debug&&console.debug("[dirty-guard] save failed, cancel deactivate"),[2,!1]);case 4:this.debug&&console.debug("[dirty-guard] do cancel"),e&&t.cancel(),r.label=5;case 5:return[2,!0];case 6:return[2,!1]}}))}))},t}();Nl.decorators=[{type:e.Injectable}],Nl.ctorParameters=function(){return[{type:F.TranslateService},{type:M.AlertController}]};var Fl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e.prototype.shouldReuseRoute=function(e,n){var o=t.prototype.shouldReuseRoute.call(this,e,n);if(!o&&e.routeConfig&&e.routeConfig===n.routeConfig){var r=e.routeConfig.data&&e.routeConfig.data.pathIdParam||"id",i="new"===n.params[r]?n.queryParams[r]||n.queryParams.id||"new":n.params[r],a="new"===e.params[r]?e.queryParams[r]||e.queryParams.id||"new":e.params[r];return"new"!==a&&"new"!==i&&a===i}return o},e}(M.IonicRouteStrategy);Fl.decorators=[{type:e.Injectable}];var Ml=function(){console.debug("[shared-routing] Creating module...")};Ml.decorators=[{type:e.NgModule,args:[{imports:[z.RouterModule],providers:[{provide:z.RouteReuseStrategy,useClass:Fl},{provide:Nl,useClass:Nl}]}]}],Ml.ctorParameters=function(){return[]};var Ll=function(){function t(){}return t.prototype.getAsBoolean=function(t,e){var n=this.get(t,e);return Re(n)?n&&"false"!==n:void 0},t.prototype.getAsInt=function(t,e){var n=this.get(t,e);return Re(n)?parseInt(n):void 0},t.prototype.getAsNumbers=function(t,e){var n=this.get(t,e);return"string"==typeof n?n.split(",").map(parseFloat)||void 0:Re(n)?[parseFloat(n)]:void 0},t.prototype.getAsStrings=function(t,e){var n=this.get(t,e);return n&&n.split(",")||void 0},t.prototype.get=function(t,e){return Re(t[e.key])?t[e.key]:e.defaultValue||void 0},t}();var jl=function(){function t(){}return t.prototype.ngOnDestroy=function(){},t}();jl.decorators=[{type:e.Directive}];var Bl=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.asPodObject=function(){return this.asObject(ys)},e.prototype.isEmpty=function(){return 0===this.countNotEmptyCriteria()},e.prototype.countNotEmptyCriteria=function(){var t=this,e=this.asPodObject();return Object.keys(e).filter((function(n){return t.isCriteriaNotEmpty(n,e[n])})).length},e.prototype.asFilterFn=function(){var t=this.buildFilter();if(!Fe(t))return function(e){return!t.find((function(t){return!t(e)}))}},e.prototype.buildFilter=function(){return[]},e.prototype.isCriteriaNotEmpty=function(t,e){return null!=e&&("string"==typeof e&&""!==e.trim()||"number"==typeof e&&!isNaN(e)||"boolean"==typeof e||e.length>0||gs.isNotEmpty(e))},e}(Wi),Ul=function(){function t(){}return t.isEntityFilter=function(t){return!!(t&&t.asPodObject&&t.asFilterFn)},t.fromObject=function(e,n){if(!e)return e;if(zi(e,n))return e;var o=new n;return t.isEntityFilter(o)?o.fromObject(e):Object.assign(o,e),o},t}(),Vl=function(t){function e(e,n,o){var r=t.call(this)||this;return r.dataType=e,r.filterType=n,r.debug=!1,r.dirty=!1,r._saving=!1,r._onChange=new D.BehaviorSubject(!0),o=Object.assign({onSort:r.sort},o),r._sortFn=o.onSort,r._onLoad=o.onLoad,r._onSaveFn=o.onSave,r._equalsFn=o.equals,r._filterFnFactory=o.filterFnFactory||function(t){var e=r.asFilter(t);if(e instanceof Bl)return e.asFilterFn()},r._sortByReplacement=Object.assign({id:-1!==Object.getOwnPropertyNames(new e).findIndex((function(t){return"rankOrder"===t}))?"rankOrder":void 0},o.sortByReplacement),r}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.data},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),e.prototype.ngOnDestroy=function(){this.debug&&console.debug("[memory-data-service] Destroying..."),this._onChange.complete(),this._onChange.unsubscribe()},e.prototype.setValue=function(t,e){this.data!==t&&(this._hiddenData=[],this.data=t,e&&!1===e.emitEvent||this._onChange.next(!0)),this.dirty=!1},e.prototype.watchAll=function(t,e,n,o,r,i){var a=this;return t=t>=0?t:0,e=e>=0?e:-1,this.data||console.warn("[memory-data-service] Waiting value to be set..."),this._onChange.pipe(N.filter(Re),N.mergeMap((function(t){return kn((function(){return!a._saving}))})),N.mergeMap((function(i){return Ie(a,void 0,void 0,(function(){var i,a,s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:i=[],d.label=1;case 1:return d.trys.push([1,,6,7]),Fe(this.data)?[2,{data:[],total:0}]:(s=this._sortFn(this.data||[],n,o),this._onLoad?(l=this._onLoad(s))instanceof Promise?[4,l]:[3,3]:[3,5]);case 2:return c=d.sent(),[3,4];case 3:c=l,d.label=4;case 4:s=c,d.label=5;case 5:return s=this.filter(s,r,i),u=s.length,0===e?(a=s,[2,{data:[],total:u}]):(t>0?t>=s.length?(a=s,s=[]):(a=e>0&&t+e<s.length?s.slice(0,t-1).concat(s.slice(t+e)):s.slice(0,t-1),s=e>0&&t+e<s.length?s.slice(t,t+e):s.slice(t)):e>0&&(a=s.slice(e),s=s.slice(0,e)),s===this.data&&(s=s.slice()),[2,{data:s,total:u}]);case 6:return this._hiddenData=a?i.concat.apply(i,ke(a)):i,[7];case 7:return[2]}}))}))})))},e.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:if(!this.data)throw new Error("[memory-service] Could not save, because value not set");this.markAsSaving(),o.label=1;case 1:return o.trys.push([1,,6,7]),Ne(this._hiddenData)&&(t=t.concat.apply(t,ke(this._hiddenData))),this._onSaveFn?(e=this._onSaveFn(t))instanceof Promise?[4,e]:[3,3]:[3,5];case 2:return n=o.sent(),[3,4];case 3:n=e,o.label=4;case 4:t=n,o.label=5;case 5:return this.data=t,this.dirty=!0,[2,this.data];case 6:return this.markAsSaved(),[7];case 7:return[2]}}))}))},e.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){if(!this.data)throw new Error("[memory-service] Could not delete, because value not set");return e=this.data.filter((function(e){return!(-1!==t.findIndex((function(t){return n.equals(t,e)})))})),this.data.length-e.length>0&&(this.data=e,this.dirty=!0,this._onChange.next(!0)),[2]}))}))},e.prototype.sort=function(t,e,n){return e=e&&this._sortByReplacement[e]||e||"id",Qi.sort(t,e,n)},e.prototype.asFilter=function(t){return Ul.fromObject(t,this.filterType)},e.prototype.addSortByReplacement=function(t,e){this._sortByReplacement[t]=e},e.prototype.equals=function(t,e){return this._equalsFn?this._equalsFn(t,e):t&&t.equals?t.equals(e):Qi.equals(t,e,"id")},e.prototype.filter=function(t,e,n){var o=this._filterFnFactory&&this._filterFnFactory(e);if(o){var r=[];return t.forEach((function(t){o(t)?r.push(t):n.push(t)})),r}return t},e.prototype.connect=function(){var t=this;return this._onChange.pipe(N.map((function(e){var n=t.data||[];return{data:n,total:n.length}})))},e.prototype.markAsSaving=function(){this._saving=!0},e.prototype.markAsSaved=function(){this._saving=!1},e}(jl);Vl.decorators=[{type:e.Directive}],Vl.ctorParameters=function(){return[{type:Function},{type:Function},{type:void 0}]};var ql=function(){function t(){}return t.defers=function(e,n){return e.map((function(e){return t.defer(e,n)}))},t.defer=function(e,n){return D.defer((function(){return t.run(e,n)}))},t.run=function(t,e){var n=new D.BehaviorSubject(0);return t(n,e).then((function(){e&&e.maxProgression&&n.next(e.maxProgression),n.complete()})).catch((function(t){return n.error(t)})),n},t.fetchAllPages=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p;return Oe(this,(function(h){switch(h.label){case 0:o=n&&n.maxProgression||void 0,l=n&&n.fetchSize||1e3,c=0,u=[],h.label=1;case 1:return n&&n.logPrefix&&console.debug(n.logPrefix+" Fetching page #"+c/l+"..."),[4,t(c,l)];case 2:d=h.sent(),u=u.concat(d.data),s=d.data&&d.data.length||0,c+=s,Ae(r)&&Re(d.total)&&(r=d.total,i=Math.round(d.total/l+.5),a=o?o/i:void 0),Re(a)&&e.next(e.getValue()+a),n&&n.onPageLoaded&&n.onPageLoaded(d),h.label=3;case 3:if(s>0&&(Ae(r)&&s===l||Re(r)&&c<r))return[3,1];h.label=4;case 4:return Re(a)?(Re(r)&&u.length<r&&(console.warn("A function loadAll() returned a bad total (less than all page's data)! Expected "+r+" but fetch "+u.length),r=u.length,i=Math.round(u.length/l+.5)),(p=n.maxProgression-a*i)>0&&e.next(e.getValue()+p)):n.maxProgression&&e.next(e.getValue()+n.maxProgression),[2,{data:u,total:r}]}}))}))},t}(),$l={white:[255,255,255],primary:[20,67,145],secondary:[117,196,253],tertiary:[91,94,244],danger:[245,61,61],light:[244,245,248],medium:[152,154,162],dark:[34,36,40],red:[255,0,0],green:[0,255,0],blue:[0,0,255]},Gl={},Hl=function(){function t(t,e,n){void 0===n&&(n="custom"),this._rgbArray=t,this._opacity=e,this._name=n}return t.get=function(t){return Gl[t]},t.parseRgba=function(e){if(!e||!e.startsWith("rgb(")&&!e.startsWith("rgba("))return null;var n=e.replace("rgb(","").replace("rgba(","").replace(")","").split(",");return 3!==n.length&&4!==n.length?null:new t([+n[0],+n[1],+n[2]],4===n.length&&+n[3]||1,"custom")},Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"opacity",{get:function(){return Re(this._opacity)?this._opacity:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgb",{get:function(){return this._rgbArray},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"r",{get:function(){return this._rgbArray[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"g",{get:function(){return this._rgbArray[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"b",{get:function(){return this._rgbArray[2]},enumerable:!1,configurable:!0}),t.prototype.rgba=function(t){return Ae(t=Re(t)?t:this._opacity)||t<0||t>1?"rgb("+this._rgbArray.join(",")+")":"rgba("+this._rgbArray.join(",")+","+t+")"},t}();Hl.transparent=function(){return new Hl([0,0,0],0,"translucent")};var Wl=function(){function t(t,e){this.colorArray=t;var n=(e=e||{}).upperMax?t.length-1:t.length;this._min=e.min||0,this._max=e.max||n,this._rangeSize=Math.round((this._max-this._min)/n),this._legendItems=this.computeLegend()}return t.default=function(){return t.custom(25)},t.fix=function(t,e){return Array.apply(null,Array(t||25)).map(String.prototype.valueOf,Hl.get(e||"primary").rgba(.5))},Object.defineProperty(t.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"legend",{get:function(){return{items:this._legendItems}},enumerable:!1,configurable:!0}),t.prototype.getValueColor=function(t){var e=Math.floor(t*(this.colorArray.length-1)/this._max);return this.colorArray[e]},t.prototype.computeLegend=function(){var t=this;return this.colorArray.map((function(e,n){var o=n*t._rangeSize,r=o+t._rangeSize;return{color:e,label:r<t._max?o.toLocaleString()+" - "+r.toLocaleString():" >= "+o}}))},t}();Wl.custom=function(t,e){return new Wl(function(t,e){if((e=e||{}).opacity=e.opacity>0&&e.opacity<1?e.opacity:1,e.startColor=e.startColor||[255,255,190],e.mainColorIndex=e.mainColorIndex&&e.mainColorIndex<t-1?e.mainColorIndex:t-1,e.endColor=e.endColor||[255,0,0],e.format=e.format||"rgb",e.mainColor){var n=zl(e.mainColorIndex+1,{opacity:e.opacity,startColor:e.startColor,endColor:e.mainColor,format:e.format});return e.mainColorIndex<t-1?n.concat(zl(t-e.mainColorIndex,{opacity:e.opacity,startColor:e.mainColor,endColor:e.endColor,format:e.format})):n}return zl(t,{opacity:e.opacity,startColor:e.startColor,endColor:e.endColor,format:e.format})}(t,{opacity:(e=e||{}).opacity,startColor:e.startColor||void 0,mainColor:e.mainColor||void 0,mainColorIndex:Re(e.mainColorIndex)?e.mainColorIndex:void 0,endColor:e.endColor||void 0,format:e.format}),e)},Object.getOwnPropertyNames($l).forEach((function(t){Gl[t]=new Hl($l[t],1,t)}));function zl(t,e){(e=e||{}).opacity=e.opacity>0&&e.opacity<1?e.opacity:1,e.startColor=e.startColor||[255,255,255],e.endColor=e.endColor||[255,0,0],e.format=e.format||"rgb";for(var n=[],o=e.startColor.slice(),r=[Math.round((e.endColor[0]-e.startColor[0])/t),Math.round((e.endColor[1]-e.startColor[1])/t),Math.round((e.endColor[2]-e.startColor[2])/t)],i=0;i<t-1;i++){for(var a=0;a<3;a++)o[a]+=r[a];n.push(o.slice())}return n.push(e.endColor.slice()),"array"===e.format?n:"rgb"===e.format?e.opacity>=1?n.map((function(t){return"rgb("+t.join(",")+")"})):n.map((function(t){return"rgba("+t.concat(e.opacity).join(",")+")"})):n}var Kl=[{id:1,label:"AAA",name:"Item A",description:"Very long description A",comments:"Very very long comments... again for A"},{id:2,label:"BBB",name:"Item B",description:"Very long description B",comments:"Very very long comments... again for B"},{id:3,label:"CCC",name:"Item C",description:"Very long description C",comments:"Very very long comments... again for C"}];function Ql(t,e){if(Ae(e))return(t||Kl).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||Kl).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var Yl=function(){function t(t){this.formBuilder=t,this._items=Ql(Kl,100),this.$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.memoryHide=!1,this.memoryMobile=!0,this.memoryAutocompleteFieldName="entity-$items",this.mode="mobile",this.form=t.group({entity:[null,Do.entity],missingEntity:[null,Do.entity],disableEntity:[null,Do.entity]}),this.form.get("disableEntity").disable()}return t.prototype.ngOnInit=function(){var t=this;this.autocompleteFields.add("entity-suggestFn",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString,showAllOnFocus:!1}),this.autocompleteFields.add("entity-items",{items:this._items.slice(),attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-$items",{items:this.$items,attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items-filter",{service:{suggest:function(e,n){return t.suggest(e,n)}},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items-large",{items:Kl.slice(),attributes:["label","name","description","comments"],displayWith:this.entityToString}),this.loadData()},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){return t={entity:Ql(Kl)[0],missingEntity:{id:-1,label:"??",name:"Missing item"},disableEntity:Ql(Kl)[2]},this.form.setValue(t),setTimeout((function(){return e.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.$items.next(this._items.slice()),[2]}))}))},t.prototype.entityToString=function(t){return[t&&t.label||void 0,t&&t.name||void 0].filter(Re).join(" - ")},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=We(this._items,t,Object.assign(Object.assign({},e),{searchAttributes:["label","name"]})),o=n.total||n.data.length,(r=e.offset+n.data.length)<o?(e=Object.assign(Object.assign({},e),{offset:r}),[2,{total:o,data:n.data,fetchMore:function(n){return Ie(i,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,nn(1e3)];case 1:return o.sent(),[2,this.suggest(t,Object.assign(Object.assign({},e),n))]}}))}))}}]):[2,n]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.compareWithFn=function(t,e){return t&&e&&t.id===e.id},t.prototype.toggleMode=function(t){this.mode!==t&&(this.mode=t,this.stopMemoryTimer())},t.prototype.startMemoryTimer=function(){var t=this;this.memoryTimer=setInterval((function(){t.memoryHide=!t.memoryHide}),50)},t.prototype.stopMemoryTimer=function(){clearInterval(this.memoryTimer),this.memoryTimer=null,this.memoryHide=!1},t.prototype.updateFilter=function(t){var e=this.autocompleteFields.get(t).filter||{};e.searchAttribute=e&&"name"===e.searchAttribute?"label":"name"},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();Yl.decorators=[{type:e.Component,args:[{selector:"app-autocomplete-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Autocomplete field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n \x3c!-- Tab nav - mobile/desktop mode --\x3e\n <nav mat-tab-nav-bar>\n <a mat-tab-link\n [active]="mode===\'mobile\'"\n (click)="toggleMode(\'mobile\')">\n <mat-label>Mobile</mat-label>\n </a>\n <a mat-tab-link [active]="mode===\'desktop\'"\n (click)="toggleMode(\'desktop\')">\n <mat-label>Desktop</mat-label>\n </a>\n <a mat-tab-link [active]="mode===\'memory\'"\n (click)="toggleMode(\'memory\')">\n <mat-label>Memory leak debug</mat-label>\n </a>\n <a mat-tab-link\n [active]="mode===\'temp\'"\n (click)="toggleMode(\'temp\')">\n <mat-label>Temporary</mat-label>\n </a>\n </nav>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n \x3c!--<ion-grid *ngIf="mode === \'temp\'">\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an Observable\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>items: Observable<any[]></pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [logPrefix]="\'[combo-desktop-2]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n\n </ion-card>\n </ion-col>\n </ion-row>\n\n\n </ion-grid>--\x3e\n\n\n <ion-grid *ngIf="mode === \'memory\'">\n\n \x3c!-- debugging memory leak --\x3e\n <ion-row>\n <ion-col>\n <ion-text><h4>Debug memory leak</h4></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col size="2">\n <mat-form-field floatLabel="always">\n <input matInput type="text" hidden placeholder="Items type">\n <mat-select (selectionChange)="memoryAutocompleteFieldName=$event.value" [value]="memoryAutocompleteFieldName">\n <mat-option value="entity-$items">Observable</mat-option>\n <mat-option value="entity-suggestFn">Suggest function</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n <ion-col size="1" class="ion-no-padding">\n <mat-form-field floatLabel="always">\n <input matInput type="text" hidden placeholder="Mobile ?">\n <mat-checkbox (change)="memoryMobile=$event.checked" [checked]="memoryMobile">\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n\n <ion-col size="2">\n <ion-button *ngIf="!memoryTimer" (click)="startMemoryTimer()" color="tertiary">Start</ion-button>\n <ion-button *ngIf="memoryTimer" (click)="stopMemoryTimer()" color="tertiary">Stop</ion-button>\n </ion-col>\n </ion-row>\n\n <ion-row>\n <ion-col>\n <mat-autocomplete-field formControlName="entity"\n *ngIf="!memoryHide && memoryAutocompleteFieldName"\n [config]="autocompleteFields.get(memoryAutocompleteFieldName)"\n [mobile]="memoryMobile"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-memory-leak]\'">\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n \x3c!-- Mobile mode --\x3e\n <ion-grid *ngIf="mode === \'mobile\'">\n\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Suggest() function\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, suggestFn: (searchText, filter) => any[]</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-1]\'"\n [required]="true"\n placeholder="Suggest field"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Items is an Observable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-observable]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Control value if missing in items\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>mobile: true, items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="missingEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-2]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-2]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n\n <ion-row>\n <ion-col size="9">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Change filter\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <ion-button (click)="updateFilter(\'entity-items-filter\')">Filter on: {{autocompleteFields.get(\'entity-items-filter\').filter?.searchAttribute }}</ion-button>\n </ion-col>\n <ion-col>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-filter]\'"\n ></mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="3">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Large combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class="min-width-large"</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="true"\n class="min-width-large"\n panelWidth="400px"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-large]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Readonly toggle\n </ion-text>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid>\n <ion-row>\n <ion-col size="3">\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n Readonly ?\n </mat-checkbox>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <mat-autocomplete-field #readonlyField formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items\')"\n [placeholder]="\'Entity\'"\n [mobile]="true"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-mobile-readonly]\'"\n [readonly]="true"\n [clearable]="!readonlyField.readonly">\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Desktop mode --\x3e\n <ion-grid *ngIf="mode === \'desktop\'">\n <ion-row>\n <ion-col>\n <ion-text><h4>Desktop mode</h4></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n items from suggest function\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>suggest: (value, filter) => LoadResult<any>\nsuggestLengthThreshold: \'3\'</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [placeholder]="\'Entity\'"\n [mobile]="false"\n [compareWith]="compareWithFn"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-desktop-suggest]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an array\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: [], value: {{stringify(form.controls.entity.value)}}</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items\')"\n [logPrefix]="\'[combo-desktop-array-1]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Items is an Observable\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [logPrefix]="\'[combo-desktop-2]\'"\n [compareWith]="compareWithFn"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Control value if missing in items\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>items: Observable<any[]></pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="missingEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-missing]\'"\n [mobile]="false"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Full size panel\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class: \'mat-autocomplete-panel-full-size\'</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [class]="\'mat-autocomplete-panel-full-size\'"\n [compareWith]="compareWithFn"\n [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-disable]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-$items\')"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-readonly]\'"\n [readonly]="true"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n <ion-row>\n <ion-col size="9">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Full size combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>class="mat-autocomplete-panel-full-size"</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="false"\n class="mat-autocomplete-panel-full-size"\n panelWidth="100vw"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="3">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Large combo\n </ion-label>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre>panelWidth: string</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-large\')"\n [mobile]="false"\n panelWidth="400px"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-large]\'"\n ></mat-autocomplete-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col size="6">\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Readonly toggle\n </ion-text>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <ion-grid>\n <ion-row>\n <ion-col size="3">\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n Readonly ?\n </mat-checkbox>\n </ion-col>\n <ion-col size="3">\n <mat-checkbox #showIcons [checked]="false">\n Icons ?\n </mat-checkbox>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <mat-autocomplete-field #readonlyField formControlName="entity"\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [placeholder]="\'Entity\'"\n [mobile]="false"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[combo-desktop-readonly]\'"\n [readonly]="true"\n [clearable]="!readonlyField.readonly">\n <mat-icon matPrefix *ngIf="showIcons.checked">keyboard_arrow_right</mat-icon>\n <mat-icon matSuffix *ngIf="showIcons.checked">keyboard_arrow_left</mat-icon>\n </mat-autocomplete-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],Yl.ctorParameters=function(){return[{type:P.FormBuilder}]};var Xl=function(){function t(t){this.formBuilder=t,this.stringify=JSON.stringify,this.form=t.group({empty:t.group({latitude:[null,P.Validators.compose([P.Validators.required,Do.latitude])],longitude:[null,P.Validators.compose([P.Validators.required,Do.longitude])]}),enable:t.group({latitude:[null,Do.latitude],longitude:[null,Do.longitude]}),disable:t.group({latitude:[null,Do.latitude],longitude:[null,Do.longitude]})});var e=this.form.get("disable");e.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return e.setValue(t)}))}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={empty:{latitude:null,longitude:null},enable:{latitude:50.1,longitude:-2},disable:{latitude:50.1,longitude:-2}},this.form.setValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.geoPosition=function(t){return console.debug("Click on geoLocation button",t),t.preventDefault(),t.stopPropagation(),!1},t}();Xl.decorators=[{type:e.Component,args:[{selector:"app-latlong-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Lat/Long field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n \x3c!-- Empty value --\x3e\n <form *ngIf="form.get(\'empty\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n <ion-row><ion-col><ion-text><h4>Empty, with defaults</h4></ion-text></ion-col></ion-row>\n\n <ion-row >\n\n \x3c!-- DD Default sign --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DD, defaultSign \'-\'\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DD"\n defaultSign="-"\n placeholder="Latitude">\n <mat-icon matPrefix>room</mat-icon>\n <button matSuffix mat-icon-button (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DD"\n defaultSign="-"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- DDMM Default sign --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMM, defaultSign \'+\'\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Latitude">\n\n <mat-icon matPrefix >room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Mobile + DDMM --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Mobile=true\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Latitude"\n mobile="true">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n defaultSign="+"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n <form *ngIf="form.get(\'enable\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n \x3c!-- With value --\x3e\n <ion-row><ion-col><ion-text><h4>With value</h4></ion-text></ion-col></ion-row>\n\n <ion-row>\n\n \x3c!-- DD --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DD\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DD"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DD"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- DDMMSS --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMM\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n\n \x3c!-- DDMMSS --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Format DDMMSS\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMMSS"\n placeholder="Latitude">\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMMSS"\n placeholder="Longitude">\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n \x3c!-- Disable --\x3e\n <form *ngIf="form.get(\'disable\') as formGroup" [formGroup]="formGroup">\n <ion-grid>\n <ion-row><ion-col><ion-text><h4>Disabled control</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(formGroup.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field formControlName="latitude"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude">\n <mat-icon matPrefix>room</mat-icon>\n <mat-icon matSuffix>gps_fixed</mat-icon>\n </mat-latlong-field>\n </ion-col>\n <ion-col>\n <mat-latlong-field formControlName="longitude"\n type="longitude"\n latLongPattern="DDMM"\n placeholder="Longitude">\n <mat-icon matPrefix>room</mat-icon>\n <button type="button" mat-icon-button matSuffix\n (click)="geoPosition($event)">\n <mat-icon>gps_fixed</mat-icon>\n </button>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly (control is enable)\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n </mat-checkbox>\n\n <ion-grid class="ion-no-padding">\n <ion-row>\n <ion-col>\n <mat-latlong-field #readonlyField [formControl]="form.get(\'enable.latitude\')"\n type="latitude"\n latLongPattern="DDMM"\n placeholder="Latitude"\n [readonly]="true">\n <mat-icon matPrefix>room</mat-icon>\n <mat-icon matSuffix>gps_fixed</mat-icon>\n </mat-latlong-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n </form>\n\n</ion-content>\n'}]}],Xl.ctorParameters=function(){return[{type:P.FormBuilder}]};var Jl=new e.InjectionToken("testingPages"),Zl=function(){function t(t,e,n,o){this.route=t,this.router=e,this.translate=n,this.pages=o,console.log("Testing pages:",o)}return t.prototype.openPage=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,this.router.navigate([t],{relativeTo:this.route})]}))}))},t}();Zl.decorators=[{type:e.Component,args:[{selector:"app-material-testing",template:'\n<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Material components</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list>\n\n <ion-item-divider>Shared Material components</ion-item-divider>\n\n <ion-item tappable class="text-1x" (click)="openPage(\'./datetime\')">\n Date/Time field\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./autocomplete\')">\n Autocomplete field\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./latlong\')">\n Lat/Long field\n </ion-item>\n\x3c!-- <ion-item tappable class="text-1x" (click)="openPage(\'./numpad\')">--\x3e\n\x3c!-- Numeric pad component--\x3e\n\x3c!-- </ion-item>--\x3e\n <ion-item tappable class="text-1x" (click)="openPage(\'./swipe\')">\n Swipe component\n </ion-item>\n <ion-item tappable class="text-1x" (click)="openPage(\'./chips\')">\n Chips component\n </ion-item>\n\n <ion-item-divider>Directive</ion-item-divider>\n <ion-item tappable class="text-1x" (click)="openPage(\'./badge-icon\')">\n Badge icon directive\n </ion-item>\n\n <ng-container *ngIf="pages && pages.length">\n <ion-item-divider>Other components</ion-item-divider>\n\n <ion-item *ngFor="let item of pages"\n tappable class="text-1x"\n (click)="openPage(item.page)">{{item.label}}</ion-item>\n\n </ng-container>\n </ion-list>\n\n</ion-content>\n'}]}],Zl.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:F.TranslateService},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Jl]}]}]};var tc=Ht,ec=function(){function t(t,e){this.formBuilder=t,this.dateFormatPipe=e,this.$dates=new D.BehaviorSubject(void 0),this._today=tc().startOf("day"),this.form=t.group({empty:[null,P.Validators.required],date:[null,P.Validators.compose([P.Validators.required,Do.validDate])],disabledEmpty:[null,P.Validators.required],disabledDate:[null,P.Validators.required]}),this.form.get("disabledEmpty").disable(),this.form.get("disabledDate").disable()}return t.prototype.ngOnInit=function(){for(var t=this,e=[],n=0;n<7;n++)e[n]=tc(this._today).add(n-3,"day");this.$dates.next(e),this.loadData(),this.form.valueChanges.pipe(N.distinctUntilChanged()).subscribe((function(){return console.debug(t.form.value)}))},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={empty:null,date:this._today,disabledEmpty:null,disabledDate:this._today},this.form.patchValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.displayDate=function(){var t=this;return function(e){return t.dateFormatPipe.transform(e,{pattern:"dddd L"}).toString()}},t.prototype.compareDate=function(){return function(t,e){return t&&e&&t.isSame(e)||!1}},t}();ec.decorators=[{type:e.Component,args:[{selector:"app-swipe-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Swipe test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <h1>Swipe page:</h1>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n \x3c!-- empty --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="empty"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [tabindex]="1"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- date --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Date\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="date"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="2"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n <ion-row>\n \x3c!-- disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled empty\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="disabledEmpty"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="3"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n\x3c!-- read-only--\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled with date\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-swipe-field formControlName="disabledDate"\n placeholder="placeholder"\n [items]="$dates"\n [displayWith]="displayDate()"\n [compareWithFn]="compareDate()"\n [clearable]="true"\n [tabindex]="4"\n [debug]="true"\n >\n </mat-swipe-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],ec.ctorParameters=function(){return[{type:P.FormBuilder},{type:Mn}]};var nc=Ht,oc=function(){function t(t,e,n){this.platform=t,this.formBuilder=e,this.cd=n,this.showLogPanel=!0,this.logContent="",this.memoryHide=!1,this.memoryMobile=!0,this.stringify=JSON.stringify,this.form=e.group({empty:[null,P.Validators.required],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null]},{validators:No.dateRange("empty","enable")});var o=this.form.get("disable");o.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return o.setValue(t)}));var r=t.is("mobile");this.showLogPanel=this.showLogPanel||r}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t,e,n=this;return Oe(this,(function(o){return t=nc(),e={empty:io(t.clone().add(2,"hours")),enable:io(t),disable:t,readonly:t},this.form.setValue(e),this.log("[test-page] Data loaded: "+JSON.stringify(e)),this.form.get("empty").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return n.log("[test-page] Value n°1: "+JSON.stringify(t))})),this.form.get("enable").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return n.log("[test-page] Value n°2: "+JSON.stringify(t))})),[2]}))}))},t.prototype.doSubmit=function(t){this.form.markAllAsTouched(),this.log("[test-page] Form content: "+JSON.stringify(this.form.value)),this.log("[test-page] Form status: "+this.form.status),this.form.invalid&&(this.log("[test-page] Form errors: "+JSON.stringify(this.form.errors)),jo.logFormErrors(this.form))},t.prototype.log=function(t){console.debug(t),this.showLogPanel&&(this.logContent+=t+"<br/>",this.cd.markForCheck())},t.prototype.clearLogPanel=function(){this.logContent="",this.cd.markForCheck()},t.prototype.startMemoryTimer=function(){var t=this;this.memoryTimer=setInterval((function(){t.memoryHide=!t.memoryHide}),50)},t.prototype.stopMemoryTimer=function(){clearInterval(this.memoryTimer),this.memoryTimer=null,this.memoryHide=!1},t}();oc.decorators=[{type:e.Component,args:[{selector:"app-data-time-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Date/Time field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n \x3c!-- debugging memory leak --\x3e\n <ion-row><ion-col><ion-text><h4>Debug memory leak</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col size="2">\n <ion-button *ngIf="!memoryTimer" (click)="startMemoryTimer()">Start timer</ion-button>\n <ion-button *ngIf="memoryTimer" (click)="stopMemoryTimer()">Stop timer</ion-button>\n </ion-col>\n <ion-col size="2">\n <mat-form-field floatLabel="never">\n <input matInput type="text" hidden>\n <mat-checkbox (change)="memoryMobile=$event.checked" [value]="memoryMobile">\n Mobile ?\n </mat-checkbox>\n </mat-form-field>\n </ion-col>\n <ion-col>\n <mat-date-time-field formControlName="empty"\n *ngIf="!memoryHide"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="memoryMobile"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-col>\n </ion-row>\n\n \x3c!-- Mobile mode --\x3e\n <ion-row><ion-col><ion-text><h4>Mobile mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n \x3c!-- Empty value --\x3e\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="empty"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Enable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="enable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="disable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n \x3c!-- debug console --\x3e\n <ion-row>\n \x3c!-- buttons --\x3e\n <ion-col size="2">\n \x3c!-- submit form --\x3e\n <ion-button (click)="doSubmit($event)"\n fill="outline">\n <ion-icon name="checkmark" slot="icon-only"></ion-icon>\n </ion-button>\n\n \x3c!-- clear log --\x3e\n <ion-button (click)="clearLogPanel()"\n fill="outline">\n <ion-icon name="trash" slot="icon-only"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size="10" *ngIf="showLogPanel">\n <ion-text color="primary">Log:<br/></ion-text>\n <div class="ion-padding-start">\n <ion-text color="medium">\n <small [innerHTML]="logContent"></small>\n </ion-text>\n </div>\n </ion-col>\n </ion-row>\n\n \x3c!-- Desktop mode --\x3e\n <ion-row><ion-col><ion-text><h4>Desktop mode</h4></ion-text></ion-col></ion-row>\n <ion-row>\n <ion-col>\n\n \x3c!-- Empty value --\x3e\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.empty.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="empty"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Enable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n With value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.enable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="enable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Disable --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disable\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.disable.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="disable"\n placeholder="Date/Time"\n [required]="true"\n [mobile]="false">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- Readonly --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly toggle\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.readonly.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-checkbox (change)="readonlyField.readonly=$event.checked" [checked]="readonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-time-field #readonlyField formControlName="readonly"\n placeholder="Date/Time"\n [readonly]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-time-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n</ion-content>\n'}]}],oc.ctorParameters=function(){return[{type:M.Platform},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var rc=[{id:1,label:"AAA",name:"Item A"},{id:2,label:"BBB",name:"Item B"},{id:3,label:"CCC",name:"Item C"}];function ic(t){return(t||rc).map((function(t){return Object.assign({},t)}))}var ac=function(){function t(t){this.formBuilder=t,this._items=ic(rc),this._$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.form=t.group({entity:[null,Do.entity],entityInitial:[null,Do.entity],disableEntity:[null,Do.entity]}),this.form.get("disableEntity").disable()}return t.prototype.ngOnInit=function(){var t=this;this.autocompleteFields.add("entity-suggestFn",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-items",{items:rc.slice(),attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-$items",{items:this._$items,attributes:["label","name"],displayWith:this.entityToString}),this.loadData(),setTimeout((function(){return t.loadItems()}),1e3)},t.prototype.loadData=function(){return Ie(this,void 0,void 0,(function(){var t;return Oe(this,(function(e){return t={entity:[],entityInitial:rc.slice(1,2),disableEntity:rc.slice(1,2)},this.form.setValue(t),[2]}))}))},t.prototype.loadItems=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this._$items.next(ic(rc)),[2]}))}))},t.prototype.entityToString=function(t){return[t&&t.label||void 0,t&&t.name||void 0].filter(Re).join(" - ")},t.prototype.suggest=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return[2,We(this._items,t,Object.assign(Object.assign({},e),{searchAttributes:["label","name"]}))]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t.prototype.compareWithFn=function(t,e){return t&&e&&t.id===e.id},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();ac.decorators=[{type:e.Component,args:[{selector:"app-chips-test",template:'<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Chips field test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-text color="primary">\n Suggest() function\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <pre><small>suggestFn: (searchText, filter) => any[]</small></pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [logPrefix]="\'[mat-chips-empty] \'"\n [compareWith]="compareWithFn"\n ></mat-chips-field>\n {{stringify(form.controls.entity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Suggest() function with initial value\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <pre><small>suggestFn: (searchText, filter) => any[]</small></pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entityInitial"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-initialized] \'"\n ></mat-chips-field>\n {{stringify(form.controls.entityInitial.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="disableEntity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-disabled] \'"\n ></mat-chips-field>\n {{stringify(form.controls.disableEntity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Readonly control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-chips-field formControlName="entity"\n [config]="autocompleteFields.get(\'entity-suggestFn\')"\n [compareWith]="compareWithFn"\n [logPrefix]="\'[mat-chips-readonly] \'"\n [readonly]="true"\n ></mat-chips-field>\n {{stringify(form.controls.entity.value)}}\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],ac.ctorParameters=function(){return[{type:P.FormBuilder}]};var sc=function(){};sc.decorators=[{type:e.Component,args:[{selector:"mat-badge-icon-test",template:'\n<ion-header>\n <ion-toolbar color="primary">\n\n <ion-buttons slot="start">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>matBadgeIcon directive</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n \x3c!-- small badge --\x3e\n <p>\n <ion-text color="tertiary">\n <span matBadge matIcon="check"\n matBadgeSize="small"\n matBadgeColor="accent"\n matBadgeOverlap="false">Small badge</span>\n </ion-text>\n </p>\n\n \x3c!-- medium badge --\x3e\n <p>\n <ion-text matBadge matBadgeIcon="check"\n matBadgeSize="medium"\n matBadgeColor="tertiary"\n matBadgeOverlap="false"\n >Medium badge</ion-text>\n </p>\n\n \x3c!-- small badge --\x3e\n <p>\n <ion-label matBadge matBadgeIcon="close" matBadgeSize="large"\n matBadgeOverlap="false">Large badge</ion-label>\n </p>\n\n \x3c!-- default size badge --\x3e\n <p>\n <ion-label matBadge matBadgeIcon="check" matBadgeColor="success"\n matBadgeOverlap="false">Badge (no size, no color)\n </ion-label>\n </p>\n\n \x3c!-- ion icon --\x3e\n <p>\n <ion-label matBadge\n ionBadgeIcon="checkmark"\n matBadgeColor="success"\n matBadgeOverlap="false">Badge with ion-icon\n </ion-label>\n </p>\n\n \x3c!-- ion icon clear --\x3e\n <p>\n <ion-label matBadge\n ionBadgeIcon="checkmark-circle"\n matBadgeColor="tertiary"\n matBadgeFill="clear"\n matBadgeOverlap="false">Badge with clear icon\n </ion-label>\n </p>\n\n\n</ion-content>\n'}]}];var lc=[{path:"",pathMatch:"full",component:Zl},{path:"autocomplete",pathMatch:"full",component:Yl},{path:"datetime",pathMatch:"full",component:oc},{path:"latlong",pathMatch:"full",component:Xl},{path:"swipe",pathMatch:"full",component:ec},{path:"chips",pathMatch:"full",component:ac},{path:"badge-icon",pathMatch:"full",component:sc}],cc=function(){};cc.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,M.IonicModule,P.ReactiveFormsModule,ui,F.TranslateModule.forChild(),z.RouterModule.forChild(lc)],declarations:[Zl,oc,Yl,Xl,ec,ac,sc],exports:[ui,z.RouterModule,oc,Zl,Yl,Xl,ec,ac]}]}];var uc=function(){};uc.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),cc],exports:[cc]}]}];var dc=function(){function t(t,e){this.accountService=t,this.viewCtrl=e,this.sending=!1}return t.prototype.cancel=function(){console.debug("[register] cancelled"),this.viewCtrl.dismiss()},t.prototype.doSubmit=function(t){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:if(this.form.form.disabled||this.sending)return[2];if(!this.form.valid||!this.form.isEnd())return this.form.markAsTouched(),[2];this.sending=!0,t=this.form.value,this.form.disable(),n.label=1;case 1:return n.trys.push([1,4,5,6]),console.debug("[register] Sending registration to server...",t),[4,this.accountService.register(t)];case 2:return n.sent(),console.debug("[register] Account registered!"),[4,this.viewCtrl.dismiss()];case 3:return n.sent(),[3,6];case 4:return e=n.sent(),this.form.error=e&&e.message||e,this.form.enable(),[3,6];case 5:return this.sending=!1,[7];case 6:return[2]}}))}))},t}();dc.decorators=[{type:e.Component,args:[{selector:"modal-register",template:'<ion-header>\n <ion-toolbar color="secondary">\n <ion-buttons slot="start">\n <ion-button *ngIf="form.isBeginning()" (click)="cancel()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n <ion-button *ngIf="!form.isBeginning()" (click)="form.slidePrev()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title translate>REGISTER.TITLE</ion-title>\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="sending"></ion-spinner>\n\n <ion-button *ngIf="!form.isEnd()" (click)="form.slideNext()"\n visible-xs visible-sm visible-mobile>\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n <ion-button *ngIf="form.isEnd() && !sending" (click)="doSubmit()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="send"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <form-register (onSubmit)="doSubmit()" (onCancel)="cancel()" #form>\n </form-register>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n \x3c!-- buttons --\x3e\n <ion-toolbar>\n\n <ion-row>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button *ngIf="form.isBeginning()" fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button *ngIf="!form.isBeginning()" fill="clear" color="dark" (click)="form.slidePrev()" [disabled]="sending">\n <ion-icon slot="start" name="arrow-back"></ion-icon>\n <ion-label translate>COMMON.BTN_BACK</ion-label>\n </ion-button>\n\n <ion-button *ngIf="!form.isEnd()" (click)="form.slideNext()" fill="solid" color="tertiary">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n <ion-button *ngIf="form.isEnd()" (click)="doSubmit()" fill="solid" [disabled]="sending" color="tertiary">\n <span translate>COMMON.BTN_SEND</span>\n <ion-icon slot="end" name="send"></ion-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n'}]}],dc.ctorParameters=function(){return[{type:pl},{type:M.ModalController}]},dc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var pc=function(){function t(t,n){var o=this;this.error=null,this._enable=!1,this._$ready=new D.BehaviorSubject(!1),this._$loading=new D.BehaviorSubject(!0),this.i18nFieldPrefix=null,this._subscription=new D.Subscription,this.debug=!1,this.onCancel=new e.EventEmitter,this.onSubmit=new e.EventEmitter,n&&this.setForm(n),this.translate=t.get(F.TranslateService),this.settings=t.get(ga),this.errorTranslator=t.get(lr),this.autocompleteHelper=new Pn(this.settings&&{getUserAttributes:function(t,e){return o.settings.getFieldDisplayAttributes(t,e)}}),this.autocompleteFields=this.autocompleteHelper.fields}return Object.defineProperty(t.prototype,"_loading",{get:function(){return this._$loading.value},set:function(t){this._$loading.next(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){return this._$loading.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.form.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.form&&this.form.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){return!this.form||this.form.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){return!this.form||this.form.dirty&&this.form.pending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return this.form&&this.form.valid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return!this.form||!this.form.dirty&&!this.form.touched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"untouched",{get:function(){return!this.form||this.form.untouched},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enable},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){var e;null===(e=this.form)||void 0===e||e.disable(t),this._enable&&(this._enable=!1,t&&!0===t.emitEvent||this.markForCheck())},t.prototype.enable=function(t){var e;null===(e=this.form)||void 0===e||e.enable(t),this._enable||(this._enable=!0,t&&!0===t.emitEvent||this.markForCheck())},Object.defineProperty(t.prototype,"form",{get:function(){return this._form},set:function(t){this.setForm(t)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this._enable?this.enable():this.disable(),this.errorTranslatorOptions=this.errorTranslatorOptions||{controlPathTranslator:this}},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.onCancel.complete(),this.onCancel.unsubscribe(),this.onSubmit.complete(),this.onSubmit.unsubscribe(),this._$ready.complete()},t.prototype.cancel=function(){this.onCancel.emit()},t.prototype.doSubmit=function(t){this.form&&this.form.valid?this.onSubmit.emit(t):this.markAllAsTouched({emitEvent:!0})},t.prototype.setForm=function(t){var e=this;this._form!==t&&(this._form=t,this._subscription.add(this._form.statusChanges.subscribe((function(t){return e.markForCheck()}))))},t.prototype.setValue=function(t,e){t?(this.debug&&console.debug("[form] Updating form (using entity)",t),jo.copyEntity2Form(t,this.form,e),e&&!1===e.emitEvent||(this.markAsLoaded({emitEvent:!1}),this.markForCheck())):console.warn("[form] Trying to set an empty value to form. Skipping")},t.prototype.reset=function(t,e){if(t){this.debug&&console.debug("[form] Resetting form (using entity)",t);var n=jo.getFormValueFromEntity(t,this.form);this.form.reset(n,{emitEvent:!1,onlySelf:!0})}else this.form.reset(null,{emitEvent:!1,onlySelf:!0});e&&!0===e.emitEvent||this.markForCheck()},t.prototype.markAsPristine=function(t){this.form.markAsPristine(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsUntouched=function(t){this.form.markAsUntouched(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsTouched=function(t){console.warn("TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0"),jo.markAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){jo.markAllAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsDirty=function(t){this.form.markAsDirty(t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsLoading=function(t){!0!==this._$loading.value&&(this._$loading.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoaded=function(t){!1!==this._$loading.value&&(this._$loading.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsReady=function(t){!0!==this._$ready.value&&(this._$ready.next(!0),"function"==typeof this.ngOnReady&&this.ngOnReady())},t.prototype.ready=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this._$ready)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,jo.waitIdle(this,t)]}))}))},t.prototype.updateValueAndValidity=function(t){jo.updateValueAndValidity(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.translateControlPath=function(t){var e,n=this.getI18nFieldName(t);return(null===(e=this.translate)||void 0===e?void 0:e.instant(n))||n},t.prototype.getFormError=function(t,e){if(t&&this.errorTranslator)return this.errorTranslator.translateErrors(this.form,Object.assign({controlPathTranslator:this},e))},t.prototype.getI18nFieldName=function(t){return(this.i18nFieldPrefix||"")+Ge(t).toUpperCase()},t.prototype.registerSubscription=function(t){return this._subscription.add(t)},t.prototype.registerAutocompleteField=function(t,e){return this.autocompleteHelper.add(t,e)},t.prototype.markForCheck=function(){console.warn("markForCheck() has been called, but is not overwritten by component "+this.constructor.name)},t}();pc.decorators=[{type:e.Directive}],pc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormGroup}]},pc.propDecorators={debug:[{type:e.Input}],tabindex:[{type:e.Input}],errorTranslatorOptions:[{type:e.Input}],form:[{type:e.Input}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var hc=function(t){function n(n,o,r,i,a,s,l,c,u){var d=t.call(this,n,r.group({username:[null,P.Validators.required],password:[null,P.Validators.required],offline:[l.offline]}))||this;return d.configService=a,d.modalCtrl=s,d.network=l,d.cd=c,d.environment=u,d.canWorkOffline=!1,d.showPwd=!1,d.onCancel=new e.EventEmitter,d.onSubmit=new e.EventEmitter,d.mobile=o.mobile,d.canWorkOffline=d.settings.hasOfflineFeature(),d._enable=!0,d}return Ee(n,t),n.prototype.disable=function(e){t.prototype.disable.call(this,e),this.showPwd=!1},n.prototype.ngOnInit=function(){var e=this;t.prototype.ngOnInit.call(this),this.registerSubscription(this.configService.config.subscribe((function(t){"token"===t.getProperty(yl.AUTH_TOKEN_TYPE)?(e.usernamePlaceholder="USER.EMAIL",e.form.get("username").setValidators(P.Validators.compose([P.Validators.required,P.Validators.email]))):(e.usernamePlaceholder="USER.USERNAME",e.form.get("username").setValidators(P.Validators.required)),e.canRegister=t.getProperty(yl.REGISTRATION_ENABLE),e.markForCheck()}))),this.environment&&!1===this.environment.production&&this.environment.defaultAuthValues&&this.form.patchValue(this.environment.defaultAuthValues)},n.prototype.cancel=function(){this.onCancel.emit()},n.prototype.doSubmit=function(t){var e=this;if(t&&(t.preventDefault(),t.stopPropagation()),!this.form.invalid&&!this.loading){this.markAsLoading();var n=this.form.value;this.showPwd=!1,this.error=null,this.registerSubscription(this.onSubmit.pipe(N.debounceTime(500)).subscribe((function(t){return e.markAsLoaded()}))),setTimeout((function(){return e.onSubmit.emit({username:n.username,password:n.password,offline:n.offline})}))}},n.prototype.register=function(){var t=this;this.onCancel.emit(),setTimeout((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:dc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))}),200)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);hc.decorators=[{type:e.Component,args:[{selector:"app-form-auth",template:'<form [formGroup]="form" novalidate (ngSubmit)="doSubmit($event)" class="form-container ion-padding" (keyup.enter)="doSubmit($event)">\n\n \x3c!-- error --\x3e\n <ion-item lines="none" *ngIf="error && !loading" @slideUpDownAnimation>\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- Username --\x3e\n <mat-form-field>\n <input matInput [appAutofocus]="true" [autofocusDelay]="500"\n [placeholder]="usernamePlaceholder|translate"\n formControlName="username"\n autocomplete="off"\n required>\n <mat-error *ngIf="form.controls.username.hasError(\'required\') && form.controls.username.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.username.hasError(\'email\') && form.controls.username.dirty">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.PASSWORD\'|translate"\n formControlName="password"\n autocomplete="section-red new-password"\n [type]="showPwd ? \'text\' : \'password\'"\n (keyup.enter)="doSubmit($event)"\n required>\n\n \x3c!-- Show pwd button --\x3e\n <button matSuffix type="button"\n mat-icon-button\n *ngIf="mobile"\n (click)="showPwd = !showPwd"\n tabindex="-1">\n <mat-icon>{{showPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="form.controls.password.hasError(\'required\') && form.controls.password.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <ng-container *ngIf="canWorkOffline">\n \x3c!-- Force offline (desktop) --\x3e\n <mat-form-field hidden-xs hidden-sm hidden-mobile color="medium">\n <input matInput hidden formControlName="offline" type="text">\n\n \x3c!-- check box --\x3e\n <mat-checkbox\n [disabled]="network.offline"\n (change)="form.controls.offline.setValue($event.checked)"\n [checked]="form.controls.offline.value">\n <ion-text color="medium" translate>AUTH.OFFLINE_MODE</ion-text>\n </mat-checkbox>\n </mat-form-field>\n\n \x3c!-- Force offline (mobile) --\x3e\n <mat-form-field visible-xs visible-sm visible-mobile\n color="medium">\n <input matInput hidden formControlName="offline" type="text">\n \x3c!-- slide toggle --\x3e\n <ion-text color="medium" translate>AUTH.OFFLINE_MODE</ion-text>\n <mat-slide-toggle matSuffix\n [disabled]="network.offline"\n (change)="form.controls.offline.setValue($event.checked)"\n [checked]="form.controls.offline.value">\n </mat-slide-toggle>\n </mat-form-field>\n </ng-container>\n\n \x3c!-- Not register yet ? --\x3e\n <p *ngIf="canRegister" class="padding" style="text-align: center;">\n <span translate>AUTH.NO_ACCOUNT_QUESTION</span>\n <br/>\n <a href="#" (click)="register()">\n <span translate>AUTH.BTN_REGISTER</span>\n </a>\n </p>\n</form>\n',animations:[na],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],hc.ctorParameters=function(){return[{type:e.Injector},{type:Sl},{type:P.FormBuilder},{type:ga},{type:xl},{type:M.ModalController},{type:Ca},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[me]}]}]},hc.propDecorators={onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var mc=function(){function t(t,e,n){this.accountService=t,this.viewCtrl=e,this.changeDetectorRef=n,this.loading=!1}return t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.doSubmit=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:if(this.form.disabled)return[2];if(!this.form.valid)return this.form.markAsTouched(),[2];this.loading=!0,r.label=1;case 1:return r.trys.push([1,3,,4]),t=this.form.value,this.form.disable(),[4,this.accountService.login(t)];case 2:return e=r.sent(),[2,this.viewCtrl.dismiss(e)];case 3:return n=r.sent(),this.loading=!1,this.form.error=n&&n.message||n,this.markForCheck(),this.form.enable(),_n(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2];case 4:return[2]}}))}))},t.prototype.markForCheck=function(){this.changeDetectorRef.markForCheck()},t}();mc.decorators=[{type:e.Component,args:[{template:'<ion-header>\n <ion-toolbar color="accent">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()" visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'AUTH.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="loading"></ion-spinner>\n\n <ion-button\n (click)="doSubmit()" *ngIf="!loading"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="checkmark"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <app-form-auth #form\n (onSubmit)="doSubmit()"\n (onCancel)="cancel()">\n </app-form-auth>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n\n <ion-toolbar>\n\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n\n \x3c!-- buttons --\x3e\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button [fill]="form.invalid ? \'clear\' : \'solid\'"\n [disabled]="loading || form.invalid"\n (click)="doSubmit()"\n (keyup.enter)="doSubmit()"\n color="tertiary">\n <ion-label translate>AUTH.BTN_LOGIN</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],mc.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:e.ChangeDetectorRef}]},mc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var fc=new e.InjectionToken("aboutDevelopers"),gc=new e.InjectionToken("aboutPartners"),bc=function(){function t(t,e,n,o,r,i){var a=this;this.translate=t,this.modalController=e,this.configService=n,this.environment=o,this.developers=r,this.partners=i,this._subscription=new D.Subscription,this.name=t.instant("APP_NAME"),"APP_NAME"===this.name&&(this.name=o&&o.name&&rn(o.name)||void 0),this.version=o&&o.version,this.sourceUrl=o&&o.sourceUrl,this.reportIssueUrl=o&&o.reportIssueUrl,this.forumUrl=o&&o.forumUrl,this.helpUrl=o&&o.helpUrl,this.config$=n.config,this._subscription.add(this.config$.subscribe((function(t){return a.setConfig(t)})))}return t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.close=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalController.dismiss()];case 1:return t.sent(),[2]}}))}))},t.prototype.setConfig=function(t){this.forumUrl=(null==t?void 0:t.getProperty(yl.FORUM_URL))||this.environment.forumUrl,this.helpUrl=(null==t?void 0:t.getProperty(yl.HELP_URL))||this.environment.helpUrl},t}();bc.decorators=[{type:e.Component,args:[{selector:"modal-about",template:'<ion-header>\n <ion-toolbar color="light">\n\n <ion-title>\n {{\'ABOUT.TITLE\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-button (click)="close()" visible-xs visible-sm visible-mobile>\n {{\'COMMON.BTN_CLOSE\'|translate}}\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <ion-list lines="none">\n\n \x3c!-- Peer info --\x3e\n <ion-item *ngIf="config$ | async; let config">\n <span slot="start"> </span>\n <ion-label class="ion-text-wrap" >\n <h2>\n <b>{{config.label}}</b> - <span [innerHTML]="config.name"></span>\n </h2>\n <p *ngIf="config.description">\n <markdown [data]="config.description"\n emoji>\n </markdown>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Version info --\x3e\n <ion-item>\n <span slot="start"> </span>\n <ion-label class="ion-text-wrap">\n <h2>\n <small *ngIf="name">{{\'ABOUT.POWERED_BY\'|translate}}</small> {{name}}\n <span *ngIf="version" [innerHTML]="\'ABOUT.VERSION\'| translate: {version: version}"></span>\n </h2>\n <p [innerHTML]="\'ABOUT.LICENSE\'| translate"></p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Help --\x3e\n <ion-item *ngIf="forumUrl || helpUrl">\n <mat-icon slot="start">help_outline</mat-icon>\n <ion-label>\n <p>\n {{\'ABOUT.HELP\'|translate}}\n </p>\n <p>\n <ion-button fill="solid" color="accent" href="{{helpUrl}}" target="help" size="default">\n <mat-icon slot="start">description</mat-icon>\n <ion-text translate>ABOUT.USER_MANUAL</ion-text>\n </ion-button>\n <ion-button fill="solid" color="secondary" href="{{forumUrl}}" target="forum" size="default">\n <ion-icon slot="start" name="chatbubbles"></ion-icon>\n <ion-text translate>ABOUT.FORUM</ion-text>\n </ion-button>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Report issue --\x3e\n <ion-item *ngIf="reportIssueUrl">\n <ion-icon slot="start" name="bug" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.REPORT_ISSUE\'|translate}}\n </p>\n <p>\n <a color="primary" href="{{reportIssueUrl}}" target="_system" translate>ABOUT.BTN_REPORT_ISSUE</a>\n </p>\n </ion-label>\n </ion-item>\n\n\n \x3c!-- Source code --\x3e\n <ion-item *ngIf="sourceUrl">\n <ion-icon slot="start" name="code" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.SOURCE_CODE\'|translate}}\n </p>\n <p>\n <a color="primary" href="{{sourceUrl}}" target="_system">{{sourceUrl}}</a>\n </p>\n </ion-label>\n </ion-item>\n\n \x3c!-- Developers --\x3e\n <ion-item *ngIf="developers | isNotEmptyArray">\n <ion-icon slot="start" name="people" color="dark"></ion-icon>\n <ion-label>\n <p>\n {{\'ABOUT.DEVELOPED_BY\'|translate}}\n </p>\n <ion-list lines="none">\n <ion-item *ngFor="let item of developers"\n class="ion-no-padding">\n <img slot="end" src="{{item.logo}}">\n <ion-label>\n <p>\n <a color="primary" href="{{item.siteUrl}}" target="_system">{{item.name||item.label}}</a>\n </p>\n </ion-label>\n </ion-item>\n </ion-list>\n </ion-label>\n </ion-item>\n\n \x3c!-- Partners --\x3e\n <ion-item class="item-partners" *ngIf="partners | isNotEmptyArray">\n <ion-icon slot="start" name="megaphone" color="dark"></ion-icon>\n <ion-text>\n <p>{{\'ABOUT.PARTNERS\'|translate}}</p>\n <p>\n <a *ngFor="let item of partners" href="{{item.siteUrl}}" class="partners" target="_system">\n <img src="{{item.logo}}">\n </a>\n </p>\n </ion-text>\n </ion-item>\n </ion-list>\n\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="tertiary" (click)="close()">{{\'COMMON.BTN_CLOSE\'|translate}}</ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n',styles:[".item-partners ion-text{height:auto}.item-partners ion-text p:last-child{display:flex;flex-wrap:wrap;flex-direction:row;justify-content:space-between}.item-partners ion-text p:last-child a{padding:2px}.item-partners ion-text p:last-child a img{text-align:center;display:inline-block;max-height:40px}"]}]}],bc.ctorParameters=function(){return[{type:F.TranslateService},{type:M.ModalController},{type:xl},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[fc]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[gc]}]}]};var yc=function(){function t(){}return t.checkIfVisible=function(t,e,n,o){if(o=o||{},t.profile){if(!(e.isLogin()&&e.hasMinProfile(t.profile)))return o.debug&&console.debug((o&&o.logPrefix||"[menu]")+" Hide item '"+t.title+"': need the min profile '"+t.profile+"' to access path '"+t.path+"'"),!1}else if(t.exactProfile){if(!e.hasExactProfile(t.exactProfile))return o.debug&&console.debug((o&&o.logPrefix||"[menu]")+" Hide item '"+t.title+"': need exact profile '"+t.exactProfile+"' to access path '"+t.path+"'"),!1}if(t.ifProperty&&!(n&&"true"===n.properties[t.ifProperty]))return o.debug&&console.debug("[menu] Config property '"+t.ifProperty+"' not 'true' for ",t.path),!1;return!0},t}();function vc(t){return t[Math.floor(Math.random()*t.length)]}var Cc=new e.InjectionToken("homeButton"),Ec=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){var p=this;this.accountService=t,this.modalCtrl=e,this.translate=n,this.toastController=o,this.configService=r,this.platform=i,this.cd=a,this.network=s,this.settings=l,this.environment=c,this.locales=u,this.buttons=d,this._started=!1,this._subscription=new D.Subscription,this.loading=!0,this.waitingNetwork=!1,this.showSpinner=!0,this.accountName="",this.$partners=new D.BehaviorSubject(null),this.loadingBanner=!0,this.pageHistory=[],this.$filteredButtons=new D.BehaviorSubject(void 0),this._debug=!c.production,this.showSpinner=!this.platform.started,this.platform.ready().then((function(){return p.start()}))}return Object.defineProperty(t.prototype,"currentLocaleCode",{get:function(){return this.loading?"":(this.translate.currentLang||this.translate.defaultLang).substr(0,2)},enumerable:!1,configurable:!0}),t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.login=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:mc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.register=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:dc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.logout=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.accountService.logout()];case 1:return t.sent(),this.offline?[4,this.tryOnline()]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype.changeLanguage=function(t){var e=this;this.settings.apply({locale:t}).then((function(){e.markForCheck()}))},t.prototype.getPagePath=function(t){return t&&t.path},t.prototype.tryOnline=function(){var t=this;this.waitingNetwork=!0,this.markForCheck(),this.network.tryOnline({showLoadingToast:!1,showOnlineToast:!0,showOfflineToast:!1}).then((function(){t.waitingNetwork=!1,t.markForCheck()}))},t.prototype.start=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return[4,this.accountService.ready()];case 1:return s.sent(),this.isLogin=this.accountService.isLogin(),this.isLogin&&this.onLogin(this.accountService.account),this.offline=this.network.offline,this._subscription.add(this.accountService.onLogin.subscribe((function(t){return a.onLogin(t)}))),this._subscription.add(this.accountService.onLogout.subscribe((function(){return a.onLogout()}))),this._subscription.add(this.configService.config.subscribe((function(t){return a.onConfigLoaded(t)}))),e=(t=this._subscription).add,o=(n=this.settings.onChange).pipe,r=[N.debounceTime(3e3)],i=N.startWith,[4,this.settings.ready()];case 2:return e.apply(t,[o.apply(n,r.concat([i.apply(void 0,[s.sent()])])).subscribe((function(t){return a.onSettingsChanged(t)}))]),this._subscription.add(this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"===t})),N.distinctUntilChanged()).subscribe((function(t){a.offline=t,a.markForCheck()}))),this._started=!0,[2]}}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},t.prototype.onConfigLoaded=function(t){var e=this;console.debug("[home] Applying configuration",t),this._config=t,this.appName=t.label||this.environment.defaultAppName||"SUMARiS",this.logo=t.largeLogo||t.smallLogo||void 0,this.description=t.name,this.isWeb=this.platform.isWebOrDesktop(),this.canRegister=t.getPropertyAsBoolean(yl.REGISTRATION_ENABLE);var n=(t.partners||[]).filter((function(t){return t&&t.logo}));if(this.$partners.next(n),this.loadingBanner=0===n.length,!this.contentStyle){var o=(t.backgroundImages||[]).filter((function(t){return Re(t)&&(!e.offline||!t.startsWith("http"))}));if(o.length){var r=vc(o);this.contentStyle=r&&{"background-image":"url("+r+")"}||{}}else{var i=t.properties&&t.properties["sumaris.color.primary"]||"var(--ion-color-primary)";this.contentStyle=i&&{"background-color":i}||{}}}this.refreshButtons(),this.markForCheck(),this.loading&&setTimeout((function(){e.loading=!1,e.markForCheck()}),500)},t.prototype.onSettingsChanged=function(t){t.pageHistory!==this.pageHistory&&(console.debug("[home] Page history loaded"),this.pageHistory=t.pageHistory||[]),this.markForCheck()},t.prototype.onLogin=function(t){t&&(this.isLogin=!0,this.accountName=Os(t),this.refreshButtons(),this.markForCheck())},t.prototype.onLogout=function(){this.isLogin=!1,this.accountName="",this.pageHistory=[],this.refreshButtons(),this.markForCheck()},t.prototype.refreshButtons=function(){var t=this;if(this._config){this._debug&&console.debug("[home] Refreshing buttons...");var e=(this.buttons||[]).filter((function(e){return yc.checkIfVisible(e,t.accountService,t._config,{isLogin:t.isLogin,debug:t._debug,logPrefix:"[home]"})})).map((function(e){if(Pe(e.titleProperty)&&t._config){var n=t._config.properties[e.titleProperty];if(n)return Object.assign(Object.assign({},e),{title:n})}return e}));this.$filteredButtons.next(e)}},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Ec.decorators=[{type:e.Component,args:[{moduleId:module.id.toString(),selector:"app-page-home",template:'<app-toolbar [canGoBack]="false"\n visible-xs visible-sm visible-mobile>\n\n \x3c!-- change locale button --\x3e\n <ion-button slot="end" *ngIf="currentLocaleCode; let code"\n [matMenuTriggerFor]="localeMenu">\n <ion-label class="ion-text-uppercase"> {{ code }}</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n</app-toolbar>\n\n\x3c!-- change locale menu --\x3e\n<mat-menu #localeMenu="matMenu">\n <button *ngFor="let item of locales"\n mat-menu-item\n (click)="changeLanguage(item.key)">\n <ion-label>{{item.value}}</ion-label>\n </button>\n</mat-menu>\n\n<ion-content [ngStyle]="contentStyle" no-padding-xs>\n\n \x3c!-- loading spinner --\x3e\n <div class="loading-page" [class.cdk-visually-hidden]="!loading">\n <div class="spinner" *ngIf="loading && showSpinner">\n <p>Loading...</p>\n <div class="sk-cube1 sk-cube"></div>\n <div class="sk-cube2 sk-cube"></div>\n <div class="sk-cube4 sk-cube"></div>\n <div class="sk-cube3 sk-cube"></div>\n </div>\n </div>\n\n \x3c!-- Desktop: translucent top toolbar --\x3e\n <div hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar translucent>\n <ion-buttons slot="start">\n <ion-menu-toggle>\n <ion-button color="light" fill="clear">\n <ion-icon slot="icon-only" name="menu"></ion-icon>\n </ion-button>\n </ion-menu-toggle>\n </ion-buttons>\n\n <ion-buttons slot="end">\n \x3c!-- change locale button --\x3e\n <ion-button color="secondary" fill="solid"\n *ngIf="currentLocaleCode; let code"\n [matMenuTriggerFor]="localeMenu">\n <ion-label class="ion-text-uppercase"> {{ code }}</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n </div>\n\n \x3c!-- Install (and upgrade) card --\x3e\n <app-install-upgrade-card [isLogin]="isLogin"\n showInstallButton="true">\n </app-install-upgrade-card>\n\n \x3c!-- Welcome card --\x3e\n <ion-card *ngIf="!loading"\n class="main welcome ion-padding ion-text-center ion-align-self-center"\n @fadeInAnimation>\n <ion-card-header>\n <ion-card-title class="ion-text-center">\n <span *ngIf="isWeb" [innerHTML]="\'HOME.WELCOME_WEB\'|translate: {appName: appName}"></span>\n <span *ngIf="!isWeb" [innerHTML]="\'HOME.WELCOME_APP\'|translate: {appName: appName}"></span>\n </ion-card-title>\n <ion-card-subtitle [innerHTML]="description">\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content class="ion-no-padding">\n <ion-text color="primary">\n <img class="logo" *ngIf="logo" src="{{ logo }}">\n </ion-text>\n \x3c!-- register help text --\x3e\n <ion-text *ngIf="!isLogin && canRegister">\n <br/>\n <span translate>HOME.REGISTER_HELP</span>\n </ion-text>\n </ion-card-content>\n\n <ion-footer class="ion-padding-top">\n\n \x3c!-- If NOT login --\x3e\n <ng-container *ngIf="!isLogin; else loginButtons;">\n\n <ion-button *ngIf="canRegister" expand="block" color="tertiary" (click)="register()">\n <span translate>HOME.BTN_REGISTER</span>\n </ion-button>\n <ion-button expand="block" color="light" [routerLink]="[\'/\']" (click)="login()">\n <span translate>AUTH.BTN_LOGIN</span>\n </ion-button>\n\n </ng-container>\n\n \x3c!-- If user login --\x3e\n <ng-template #loginButtons>\n\n \x3c!-- Feature buttons --\x3e\n <ng-container *ngIf="$filteredButtons | async as buttons">\n <ng-container *ngFor="let item of buttons">\n <ion-button *ngIf="item.path"\n expand="block" color="tertiary"\n [class]="item.cssClass"\n [routerLink]="item.path"\n routerDirection="root">\n <ion-icon slot="start" class="ion-float-start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" class="ion-float-start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-text>{{\'HOME.BTN_DATA_ENTRY\'|translate: {name: (item.title | translate) } }}</ion-text>\n </ion-button>\n\n \x3c!-- divider --\x3e\n <div *ngIf="!item.path && !item.action" [class]="item.cssClass">\n <ion-label translate>{{item.title}} </ion-label>\n </div>\n </ng-container>\n\n \x3c!--<p *ngIf="buttons.length" class="visible-mobile"> </p>--\x3e\n </ng-container>\n\n <ion-button expand="block" color="secondary" [routerLink]="[\'/account\']">\n <ion-icon slot="start" class="ion-float-start" name="person-circle"></ion-icon>\n <ion-text translate>HOME.BTN_MY_ACCOUNT</ion-text>\n </ion-button>\n\n <p hidden-xs hidden-sm hidden-mobile>\n <ion-text [innerHTML]="\'HOME.NOT_THIS_ACCOUNT_QUESTION\' | translate: {displayName: accountName }"></ion-text>\n <br/>\n <ion-text>\n <a href="#" (click)="logout($event)">\n <span translate>HOME.BTN_DISCONNECT</span>\n </a>\n </ion-text>\n </p>\n\n\n </ng-template>\n\n </ion-footer>\n </ion-card>\n\n \x3c!-- Page history --\x3e\n <ion-grid *ngIf="!loading && isLogin && pageHistory.length; else bottomBanner"\n class="history-container ion-align-self-center">\n <ion-row>\n <ion-col size="12" size-xl="" *ngFor="let page of pageHistory; trackBy: getPagePath"\n class="ion-text-center">\n <ion-card class="ion-align-self-start ion-text-start" @fadeInAnimation>\n <ion-card-header class="ion-no-padding">\n \x3c!-- top bar --\x3e\n <ion-card-subtitle>\n <button type="button" tabindex="-1"\n (click)="settings.removePageHistory(page.path)"\n mat-icon-button class="ion-float-start ion-no-margin">\n <mat-icon>close</mat-icon>\n </button>\n <ion-label [innerHTML]="page.subtitle|translate"></ion-label>\n <ion-text class="ion-float-end" [title]="page.time|dateFormat:{time: true}">\n <small><ion-icon name="time-outline"></ion-icon> {{ page.time|dateFromNow }}</small> \n </ion-text>\n </ion-card-subtitle>\n\n \x3c!-- main page --\x3e\n <ion-card-title class="ion-no-margin ion-no-padding">\n <ion-item detail="true"\n tappable class="text-1x"\n [routerLink]="page.path"\n routerDirection="root" lines="none">\n \x3c!-- page icon--\x3e\n <ion-icon *ngIf="page.icon" slot="start" [name]="page.icon"></ion-icon>\n <mat-icon *ngIf="page.matIcon" slot="start">{{page.matIcon}}</mat-icon>\n\n <ion-label color="primary" [title]="page.title">{{page.title}}</ion-label>\n </ion-item>\n </ion-card-title>\n </ion-card-header>\n\n \x3c!-- children pages --\x3e\n <ion-card-content class="ion-no-padding ion-padding-start" *ngIf="page.children?.length">\n <ion-list class="ion-no-padding">\n <ion-item detail="true"\n *ngFor="let childPage of page.children"\n tappable class="text-1x"\n [routerLink]="childPage.path"\n routerDirection="root">\n \x3c!-- page icon--\x3e\n <ion-icon *ngIf="childPage.icon" slot="start" color="dark" [name]="childPage.icon"></ion-icon>\n <mat-icon *ngIf="childPage.matIcon" slot="start" color="dark">{{childPage.matIcon}}</mat-icon>\n\n <ion-label color="dark" [innerHTML]="childPage.title"></ion-label>\n </ion-item>\n </ion-list>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Display configured Departments logos --\x3e\n <ng-template #bottomBanner>\n <div class="bottom-banner ion-text-center ion-padding" *ngIf="!loadingBanner" @fadeInAnimation>\n <a href="{{ item.siteUrl }}" *ngFor="let item of $partners | async ">\n <img class="logo" src="{{ item.logo }}" alt="{{item.label}}" [title]="item.label" />\n </a>\n </div>\n </ng-template>\n\n\n</ion-content>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Zi,na],styles:["h1,h2,h3,h4,h5{white-space:normal}.center,ion-content ion-card.welcome img{text-align:center;display:inline-block}ion-content{--background:transparent;background-size:cover;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;display:inline-block;padding:15px}ion-content,ion-content .loading-page{background-color:var(--ion-color-primary)}ion-content .loading-page{display:block;height:100%;width:100%;position:absolute;z-index:5;transition:background .5s linear;-webkit-transition:background 1.5s linear}ion-content .loading-page.hidden{background-color:rgba(var(--ion-color-primary),0)}ion-content ion-card{z-index:9}ion-content ion-card ion-card-header{display:block}ion-content ion-card ion-card-header ion-card-subtitle,ion-content ion-card ion-card-header ion-card-title{display:block;width:100%}ion-content ion-card.main{min-width:240px;max-width:400px;margin-left:auto;margin-right:auto}ion-content ion-card.welcome{background-color:hsla(0,0%,100%,.7)}ion-content ion-card.welcome button{margin-top:16px}ion-content ion-card.welcome img{max-width:250px}ion-content .history-container{margin-left:auto;margin-right:auto}ion-content .history-container ion-card{display:inline-block;box-sizing:border-box;z-index:8;min-width:240px;max-width:400px;width:100%;margin-left:auto;margin-right:auto;background-color:hsla(0,0%,100%,.7)}ion-content .history-container ion-card ion-card-header ion-card-subtitle{height:40px}ion-content .history-container ion-card ion-card-header ion-card-subtitle button[float-start]{z-index:99;margin:0}ion-content .history-container ion-card ion-card-header ion-card-subtitle ion-label{line-height:40px}ion-content .history-container ion-card ion-card-header ion-card-subtitle ion-label[float-end]{padding-right:16px;font-weight:400}ion-content .history-container ion-card ion-card-header ion-card-title ion-item{--ion-item-background:$transparent;--ion-item-icon-color:var(--ion-color-primary);--ion-item-text-color:var(--ion-color-primary)}ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-icon[slot=start],ion-content .history-container ion-card ion-card-header ion-card-title ion-item mat-icon[slot=start]{margin-right:unset;-webkit-margin-end:16px!important;margin-inline-end:16px!important;color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-label,ion-content .history-container ion-card ion-card-header ion-card-title ion-item ion-text{color:var(--ion-item-text-color)!important;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}ion-content .history-container ion-card ion-card-content ion-list{--ion-item-background:var(--ion-color-transparent)}ion-content .history-container ion-card ion-card-content ion-list ion-item{--ion-item-icon-color:var(--ion-color-dark);--ion-item-text-color:var(--ion-color-dark)}ion-content .history-container ion-card ion-card-content ion-list ion-item ion-icon[slot=start],ion-content .history-container ion-card ion-card-content ion-list ion-item mat-icon[slot=start]{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor;margin-right:unset;-webkit-margin-end:16px!important;margin-inline-end:16px!important}ion-content .history-container ion-card ion-card-content ion-list ion-item ion-label,ion-content .history-container ion-card ion-card-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-content .bottom-banner{background-color:hsla(0,0%,100%,.7);min-width:240px;z-index:0;position:absolute;left:16px;right:16px;bottom:16px}ion-content .bottom-banner img.logo{max-height:50px;margin-left:8px}ion-content ion-text{text-align:center}@media screen and (max-width:575px){ion-content ion-card{min-width:160px;width:calc(100% - 20px);max-width:100%;margin-left:10px;margin-right:10px}ion-content ion-card h1{margin-top:0;font-size:20px}ion-content ion-card button{margin-top:8px}ion-content .bottom-banner{display:block;position:unset}ion-content .bottom-banner img.logo{max-height:30px}}@media screen and (max-width:767px) and (min-width:576px){ion-content{min-height:555px}ion-content .bottom-banner img.logo{max-height:40px}}@media screen and (min-width:768px){ion-content{min-height:calc(100% - 100px)}}"]}]}],Ec.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:F.TranslateService},{type:M.ToastController},{type:xl},{type:Sl},{type:e.ChangeDetectorRef},{type:Ca},{type:ga},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Inject,args:[rs]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Cc]}]}]};var wc=function(){function t(t,e,n,o){var r=this;this.platform=t,this.accountService=e,this.activatedRoute=n,this.configService=o,this.subscriptions=[],this.loading=!0,this.contentStyle={},this.platform.ready().then((function(){r.isLogin=e.isLogin(),r.subscriptions.push(r.accountService.onLogin.subscribe((function(t){return r.isLogin=!0}))),r.subscriptions.push(r.accountService.onLogout.subscribe((function(){return r.isLogin=!1}))),r.subscriptions.push(r.activatedRoute.paramMap.subscribe((function(t){return r.doConfirm(t.get("email"),t.get("code"))}))),r.configService.config.subscribe((function(t){if(t&&t.backgroundImages&&t.backgroundImages.length){var e=vc(t.backgroundImages);r.contentStyle={"background-image":"url("+e+")"}}else{var n=t.properties&&t.properties["sumaris.color.primary"]||"#144391";r.contentStyle={"background-color":n}}r.loading=!1}))}))}return t.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(t){return t.unsubscribe()})),this.subscriptions=[]},t.prototype.doConfirm=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(this.email=t,!e)return this.loading=!1,this.error=void 0,[2];i.label=1;case 1:return i.trys.push([1,7,,8]),this.accountService.isLogin()?(n=this.accountService.account,o=n&&n.email,t==o?[3,3]:[4,this.accountService.logout()]):[3,3];case 2:return i.sent(),[2,this.doConfirm(t,e)];case 3:return[4,this.accountService.confirmEmail(t,e)];case 4:return i.sent()&&this.isLogin?[4,this.accountService.refresh()]:[3,6];case 5:i.sent(),i.label=6;case 6:return this.loading=!1,[3,8];case 7:return r=i.sent(),this.error=r&&r.message||r,this.loading=!1,[3,8];case 8:return[2]}}))}))},t}();wc.decorators=[{type:e.Component,args:[{selector:"page-register-confirm",template:'<app-toolbar [title]="\'REGISTER.CONFIRMED.TITLE\'|translate" color="primary">\n</app-toolbar>\n\n\n<ion-content class="bg-image-cover center ion-padding" [ngStyle]="contentStyle">\n\n <p class="hidden-xs ion-padding"> <br /><br /></p>\n <p class="hidden-xs"> </p>\n\n\n <ion-card>\n <ion-card-content>\n\n <div>\n <ng-container *ngIf="loading">\n <h4 translate>REGISTER.CONFIRMED.LOADING</h4>\n <p><ion-spinner></ion-spinner></p>\n </ng-container>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="!loading && error">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n </div>\n\n <div *ngIf="!loading && !error">\n <h3>\n <ion-icon name="checkmark"></ion-icon>\n <b translate>REGISTER.CONFIRMED.SUB_TITLE</b>\n </h3>\n\n <ion-text>\n <p [innerHTML]="\'REGISTER.CONFIRMED.SUCCESS\'|translate: {email: email}"></p>\n <p *ngIf="!isLogin" [innerHTML]="\'REGISTER.CONFIRMED.LOGIN_HELP\'|translate"></p>\n </ion-text>\n\n </div>\n\n </ion-card-content>\n\n <ion-footer *ngIf="!loading">\n <ion-button expand="full" color="primary" [routerLink]="[\'/account\']" *ngIf="!isLogin">\n <ion-icon name="log-in" slot="start"></ion-icon>\n <span translate>AUTH.BTN_LOGIN</span>\n </ion-button>\n\n <ion-button expand="full" color="secondary" [routerLink]="[\'/account\']" *ngIf="isLogin">\n <ion-icon name="contact" slot="start"></ion-icon>\n <span translate>HOME.BTN_MY_ACCOUNT</span>\n </ion-button>\n </ion-footer>\n </ion-card>\n\n</ion-content>\n',styles:["h1,h2,h3,h4,h5{white-space:normal}.bottom-banner,.center,ion-card,ion-card img,ion-content,ion-text{text-align:center;display:inline-block}ion-content{--ion-background-color:transparent;background-size:cover;display:inline-block;padding:15px}ion-card{padding:var(--ion-padding);background-color:hsla(0,0%,100%,.7);min-width:240px;max-width:400px;z-index:9}ion-card button{margin-top:16px}ion-card img{max-width:250px}.bottom-banner{padding:var(--ion-padding);background-color:hsla(0,0%,100%,.7);min-width:240px;z-index:0}.bottom-banner img.logo{max-height:50px;margin-left:8px}@media screen and (max-width:575px){ion-content ion-card{min-width:160px;width:auto;max-width:260px}ion-content ion-card img{max-width:100px;margin-left:8px}ion-content ion-card button{margin-top:8px}.bottom-banner img.logo{max-height:30px}}@media screen and (max-width:767px) and (min-width:576px){ion-content{min-height:555px}.bottom-banner img.logo{max-height:40px}}@media screen and (min-width:768px){ion-content{min-height:606px}.main-content{padding-bottom:0}.bottom-banner{position:absolute;bottom:16px;left:16px;right:16px}}"]}]}],wc.ctorParameters=function(){return[{type:Sl},{type:pl},{type:z.ActivatedRoute},{type:xl}]};var Ic=function(t){function e(e,n){var o=t.call(this)||this;return o.formBuilder=e,o.translate=n,o}return Ee(e,t),e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(t){return this.formBuilder.group(this.getFormGroupConfig(t))},e.prototype.getFormGroupConfig=function(t){return{}},e.prototype.getI18nFormErrors=function(t){var e=jo.getFormErrors(t);return this.getI18nErrors(e)},e.prototype.getI18nErrors=function(t){var e=this;return Object.keys(t||{}).map((function(n){return e.getI18nError(n,t[n])}))},e.prototype.getI18nError=function(t,e){var n="ERROR.FIELD_"+Ge(t).toUpperCase(),o=this.translate.instant(n,e);return n!==o?o:"string"==typeof e?e:(console.error("[validator] Cannot translate error key '"+t+"'. Please override translateError() in your validator"),Ge(t))},e}(Dt.ValidatorService);Ic.decorators=[{type:e.Directive}],Ic.ctorParameters=function(){return[{type:P.FormBuilder},{type:F.TranslateService}]};var Oc=function(t){function e(e){return t.call(this,e)||this}return Ee(e,t),e.prototype.getFormGroup=function(t){return this.formBuilder.group({id:[t&&t.id||null],updateDate:[t&&t.updateDate||null],locale:[t&&t.locale||null,P.Validators.required],latLongFormat:[t&&t.latLongFormat||null,P.Validators.required],content:this.formBuilder.group({}),nonce:[t&&t.nonce||null]})},e}(Ic);Oc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Oc(jt.ɵɵinject(qt.FormBuilder))},token:Oc,providedIn:"root"}),Oc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Oc.ctorParameters=function(){return[{type:P.FormBuilder}]};var _c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.formBuilder=e,o.accountService=n,o}return Ee(e,t),e.prototype.getFormGroupConfig=function(t){var e=this,n={id:[""],updateDate:[""],creationDate:[""],lastName:[t&&t.lastName||null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])],firstName:[t&&t.firstName||null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])],email:[t&&t.email||null,P.Validators.compose([P.Validators.required,P.Validators.email])],mainProfile:[t&&(t.mainProfile||Is.getMainProfile(t.profiles))||"GUEST",P.Validators.required],statusId:[t&&t.statusId||as.TEMPORARY,P.Validators.required],pubkey:[t&&t.pubkey||null,P.Validators.compose([P.Validators.required,Do.pubkey])]};return this.accountService.additionalFields.forEach((function(o){n[o.key]=[t&&t[o.key]||null,e.getValidators(o)]})),n},e.prototype.getValidators=function(t){var e=[];return t.extra&&t.extra.account&&t.extra.account.required&&e.push(P.Validators.required),"entity"===t.type&&e.push(Do.entity),e.length?P.Validators.compose(e):1===e.length?e[0]:void 0},e}(Ic);_c.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new _c(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(pl))},token:_c,providedIn:"root"}),_c.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_c.ctorParameters=function(){return[{type:P.FormBuilder},{type:pl}]};var xc=function(e){function n(t,n,o,r,i,a,s,l,c,u){var d=e.call(this,t,i.getFormGroup(r.account))||this;return d.router=n,d.formBuilder=o,d.accountService=r,d.validatorService=i,d.settingsValidatorService=a,d.translate=s,d.settings=l,d.cd=c,d.email={confirmed:!1,notConfirmed:!1,sending:!1,error:void 0},d.latLongFormats=Un,d.saving=!1,d.submitted=!1,d.locales=u,d.settingsForm=a.getFormGroup(r.account&&r.account.settings),d.settingsContentForm=d.settingsForm.controls.content,d.form.addControl("settings",d.settingsForm),d.disable(),d.registerSubscription(d.accountService.onLogin.subscribe((function(t){return d.onLogin(t)}))),d.registerSubscription(d.accountService.onLogout.subscribe((function(){return d.onLogout()}))),d.registerSubscription(d.onCancel.subscribe((function(){d.setValue(d.accountService.account),d.markAsPristine()}))),d.registerSubscription(d.accountService.$additionalFields.subscribe((function(t){d.additionalFields=t.slice(),r.isLogin()?d.onLogin(d.accountService.account):d.markAsLoaded()}))),d}return Ee(n,e),n.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this),this.stopListenChanges()},n.prototype.onLogin=function(t){console.debug("[account] Logged account: ",t),this.isLogin=!0,this.setValue(t),this.email.confirmed=t&&t.email&&t.statusId!==as.TEMPORARY,this.email.notConfirmed=t&&t.email&&(!t.statusId||t.statusId===as.TEMPORARY),this.enable(),this.markAsPristine(),this.startListenChanges(),this.markAsLoaded()},n.prototype.onLogout=function(){this.isLogin=!1,this.email.confirmed=!1,this.email.notConfirmed=!1,this.email.sending=!1,this.email.error=void 0,this.form.reset(),this.disable(),this.stopListenChanges(),this.router.navigateByUrl("/")},n.prototype.refresh=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.disable(),this.markAsLoading(),[2,this.accountService.refresh()]}))}))},n.prototype.startListenChanges=function(){this.changesSubscription||(this.changesSubscription=this.accountService.listenChanges())},n.prototype.stopListenChanges=function(){this.changesSubscription&&(this.changesSubscription.unsubscribe(),this.changesSubscription=void 0)},n.prototype.sendConfirmationEmail=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:if((e=this.form.value).email=this.form.controls.email.value,!e.email||!this.email.notConfirmed)return t.preventDefault(),[2,!1];this.email.sending=!0,console.debug("[account] Sending confirmation email..."),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.accountService.sendConfirmationEmail(e.email,e.settings&&e.settings.locale||this.translate.currentLang)];case 2:return o.sent(),console.debug("[account] Confirmation email sent."),this.email.sending=!1,[3,4];case 3:return n=o.sent(),this.email.sending=!1,this.email.error=n&&n.message||n,[3,4];case 4:return[2]}}))}))},n.prototype.save=function(e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return this.saving?[2]:[4,jo.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return jo.logFormErrors(this.form),[2];this.submitted=!0,this.saving=!0,this.error=void 0,e=t.Account.fromObject(Object.assign(Object.assign({},this.accountService.account.asObject()),this.form.value)),console.debug("[account] Saving account...",e),o.label=2;case 2:return o.trys.push([2,4,5,6]),this.disable(),[4,this.accountService.save(e)];case 3:return o.sent(),this.markAsPristine(),[3,6];case 4:return n=o.sent(),console.error(n),this.error=n&&n.message||n,[3,6];case 5:return this.saving=!1,this.enable(),[7];case 6:return[2]}}))}))},n.prototype.enable=function(){var t=this;e.prototype.enable.call(this),this.form.controls.email.disable(),this.form.controls.mainProfile.disable(),this.form.controls.pubkey.disable(),this.additionalFields.filter((function(t){return t.extra&&t.extra.account&&t.extra.account.disabled||!1})).forEach((function(e){t.form.controls[e.key].disable()})),this.markForCheck()},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);xc.decorators=[{type:e.Component,args:[{selector:"app-page-account",template:'<app-toolbar [title]="\'ACCOUNT.TITLE\'|translate" color="primary"\n [hasValidate]="form.dirty && !saving"\n (onValidate)="save($event)"\n [canGoBack]="false">\n\n <ion-buttons slot="end">\n \x3c!-- loader --\x3e\n <ion-spinner *ngIf="loading || saving; else endButtons"></ion-spinner>\n\n <ng-template #endButtons>\n \x3c!-- refresh button --\x3e\n <ion-button [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="refresh($event)">\n <mat-icon slot="icon-only">refresh</mat-icon>\n </ion-button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n\n<ion-content>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <form [formGroup]="form" novalidate (ngSubmit)="save($event)" class="form-container">\n\n <mat-tab-group>\n\n \x3c!-- TAB: user details --\x3e\n <mat-tab label="{{\'ACCOUNT.USER_DETAILS.TITLE\'|translate}}" class="ion-padding">\n <ng-template mat-tab-label>\n <mat-icon>\n <ion-icon matPrefix slot="start" name="person-circle"></ion-icon>\n </mat-icon>\n <ion-label>{{\'ACCOUNT.USER_DETAILS.TITLE\'|translate}}</ion-label>\n <ion-icon slot="end" name="alert-circle" color="danger" *ngIf="submitted && form.invalid"></ion-icon>\n </ng-template>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="3"> </ion-col>\n\n <ion-col class="ion-padding">\n <p [innerHTML]="\'ACCOUNT.USER_DETAILS.DESCRIPTION\'|translate"></p>\n\n \x3c!--h1>Identité</h1--\x3e\n\n \x3c!-- Email --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.EMAIL\'|translate"\n formControlName="email" autocomplete="section-red email">\n <mat-error *ngIf="form.controls.email.hasError(\'required\') && form.controls.email.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.email.hasError(\'email\') && form.controls.email.dirty">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n <ion-grid *ngIf="email.notConfirmed" class="ion-no-padding ion-padding-bottom">\n <ion-row>\n <ion-col color="danger">\n <ion-icon slot="start" color="danger" name="alert-circle" color="danger"></ion-icon>\n <ion-text [innerHTML]="\'ACCOUNT.EMAIL_NOT_CONFIRMED_LABEL\'|translate"></ion-text>\n </ion-col>\n </ion-row>\n\n <ion-row style="height: 51px;">\n <ion-col style="text-align: right;">\n <ion-text>\n <small [innerHTML]="\'ACCOUNT.EMAIL_NOT_RECEIVED_QUESTION\'|translate"></small>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n <ion-button fill="solid" color="secondary" *ngIf="!email.sending" (click)="sendConfirmationEmail($event)">\n {{\'ACCOUNT.BTN_RESEND\'|translate}}\n </ion-button>\n <ion-spinner class="ion-no-padding" *ngIf="email.sending"></ion-spinner>\n </ion-col>\n </ion-row>\n\n <ion-row *ngIf="email.error && !email.sending">\n <ion-col>\n <span *ngIf="email.error && !email.sending" [innerHTML]="email.error|translate"></span>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n \x3c!-- Last name --\x3e\n <mat-form-field>\n <input matInput [appAutofocus]="true" [autofocusDelay]="500" [placeholder]="\'USER.LAST_NAME\'|translate"\n formControlName="lastName"\n autocomplete="section-blue family-name"\n required>\n <mat-error *ngIf="form.controls.lastName.hasError(\'required\') && form.controls.lastName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.lastName.hasError(\'minlength\') && form.controls.lastName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- First name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.FIRST_NAME\'|translate" formControlName="firstName" autocomplete="section-blue given-name"\n required>\n <mat-error *ngIf="form.controls.firstName.hasError(\'required\') && form.controls.firstName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.firstName.hasError(\'minlength\') && form.controls.firstName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n\n \x3c!-- Additional fields --\x3e\n <ng-container *ngFor="let definition of additionalFields">\n <app-form-field [definition]="definition"\n [formControlName]="definition.key"\n [required]="definition.extra && definition.extra.account && definition.extra.account.required || false">\n </app-form-field>\n </ng-container>\n\n <h3 translate>ACCOUNT.USER_DETAILS.TECHNICAL_DIVIDER</h3>\n\n \x3c!-- profile --\x3e\n <mat-form-field>\n <input matInput hidden readonly="true" [placeholder]="\'ACCOUNT.USER_DETAILS.PROFILE\'|translate"\n formControlName="mainProfile" required>\n <span>{{\'USER.PROFILE_ENUM.\'+form.controls.mainProfile.value | translate}}</span>\n <mat-error *ngIf="form.controls.firstName.hasError(\'mainProfile\') && form.controls.mainProfile.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- pubkey --\x3e\n <mat-form-field>\n <input matInput readonly="true" [placeholder]="\'ACCOUNT.USER_DETAILS.PUBKEY\'|translate" formControlName="pubkey"\n required>\n <mat-error *ngIf="form.controls.firstName.hasError(\'pubkey\') && form.controls.firstName.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.firstName.hasError(\'pubkey\') && form.controls.firstName.dirty">\n <span translate>ERROR.FIELD_NOT_VALID_PUBKEY</span>\n </mat-error>\n </mat-form-field>\n\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="3"> </ion-col>\n </ion-row>\n </ion-grid>\n </mat-tab>\n\n \x3c!-- TAB: settings --\x3e\n <mat-tab label="{{\'ACCOUNT.SETTINGS.TITLE\'|translate}}" formGroupName="settings">\n <ng-template mat-tab-label>\n <mat-icon>\n <ion-icon matPrefix slot="start" name="settings"></ion-icon>\n </mat-icon>\n <ion-label translate>ACCOUNT.SETTINGS.TITLE</ion-label>\n </ng-template>\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="3"> \n </ion-col>\n\n <ion-col class="ion-padding">\n\n <p [innerHTML]="\'ACCOUNT.SETTINGS.DESCRIPTION\'|translate"></p>\n\n <mat-form-field>\n <mat-select [placeholder]="\'ACCOUNT.SETTINGS.LOCALE\'|translate" formControlName="locale" required>\n <mat-option *ngFor="let item of locales" [value]="item.key">\n {{item.value}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="settingsForm.controls.locale.hasError(\'required\') && settingsForm.controls.locale.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- lat/long format--\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'ACCOUNT.SETTINGS.LAT_LONG_FORMAT\'|translate" formControlName="latLongFormat"\n required>\n <mat-option *ngFor="let item of latLongFormats" [value]="item">\n {{\'COMMON.LAT_LONG.\'+item+\'_PLACEHOLDER\'|translate}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="settingsForm.controls.latLongFormat.hasError(\'required\') && settingsForm.controls.latLongFormat.dirty"\n translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n <form formGroupName="content">\n\n\n </form>\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="3"> \n </ion-col>\n </ion-row>\n </ion-grid>\n </mat-tab>\n </mat-tab-group>\n\n\n </form>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <app-form-buttons-bar (onCancel)="cancel()" (onSave)="save($event)" [disabled]="!form.dirty || saving"></app-form-buttons-bar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["mat-tab-group .mat-tab-body-content{padding:var(--ion-grid-padding);display:grid}form,form mat-form-field{width:100%}"]}]}],xc.ctorParameters=function(){return[{type:e.Injector},{type:z.Router},{type:P.FormBuilder},{type:pl},{type:_c},{type:Oc},{type:F.TranslateService},{type:ga},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[rs]}]}]};var kc=function(){this.showRecorder=!0};kc.decorators=[{type:e.Component,args:[{selector:"app-entity-metadata",template:'<ng-container *ngIf="value && value.id">\n <ion-card @fadeInAnimation>\n\n \x3c!-- recorder --\x3e\n <ion-item color="light"\n *ngIf="showRecorder && value && (value.recorderDepartment || value.recorderPerson)">\n\n \x3c!-- recorder avatar --\x3e\n <ion-avatar slot="start" *ngIf="value.recorderPerson; let recorderPerson">\n <img *ngIf="recorderPerson.avatar; else generateAvatar"\n src="{{ recorderPerson.avatar }}">\n <ng-template #generateAvatar>\n <svg *ngIf="recorderPerson.id; let personId"\n width="38" height="38" [data-jdenticon-value]="personId"></svg>\n </ng-template>\n </ion-avatar>\n\n \x3c!-- recorder name --\x3e\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n </ion-item>\n\n <ion-card-content>\n <ion-label class="ion-text-wrap status">\n \x3c!-- creation date --\x3e\n <ion-text *ngIf="value.creationDate">\n <ion-icon name="calendar"></ion-icon> \n <span translate>COMMON.CREATED_ON</span>\n <span>\n <b>{{ value.creationDate | dateFormat: {time: true} }}</b>\n </span>\n </ion-text>\n\n \x3c!-- update date --\x3e\n <ion-text *ngIf="value.updateDate && value.updateDate != value.creationDate">\n <br *ngIf="value.creationDate"/>\n <ion-label>\n <ion-icon name="time-outline"></ion-icon> \n <span translate>COMMON.UPDATED_ON</span>\n <span> {{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n',animations:[Zi],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:1px solid rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content * ion-label.status,ion-card ion-card-content ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}"]}]}],kc.propDecorators={value:[{type:e.Input}],showRecorder:[{type:e.Input}]};var Sc=function(){},Ac=function(){function t(t){var n=this;this.hotkeys=t,this._subscription=new D.Subscription,this.disabled=!1,this.disabledCancel=!1,this.onCancel=new e.EventEmitter,this.onSave=new e.EventEmitter,this.onNext=new e.EventEmitter,this.onBack=new e.EventEmitter,this._subscription.add(t.addShortcut({keys:"control.s",description:"COMMON.BTN_SAVE"}).pipe(N.filter((function(t){return!n.disabled}))).subscribe((function(t){return n.onSave.emit(t)}))),this._subscription.add(t.addShortcut({keys:"control.z",description:"COMMON.BTN_RESET"}).pipe(N.filter((function(t){return!n.disabled&&!n.disabledCancel}))).subscribe((function(t){return n.onCancel.emit(t)}))),this._subscription.add(t.addShortcut({keys:"escape",description:"COMMON.BTN_CLOSE",preventDefault:!1}).pipe(N.filter((function(t){return!t.defaultPrevented}))).subscribe((function(t){return n.onBack.emit(t)})))}return t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this.onCancel.complete(),this.onSave.complete(),this.onNext.complete(),this.onBack.complete()},t}();Ac.decorators=[{type:e.Component,args:[{selector:"app-form-buttons-bar",template:'<ion-toolbar [class]="classList">\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n <ng-content></ng-content>\n </ion-col>\n\n <ion-col size="auto">\n\n \x3c!-- close (go back) --\x3e\n <ion-button fill="clear" color="dark" (click)="onBack.emit($event)"\n (keyup.enter)="onBack.emit($event)"\n *ngIf="onBack.observers | isNotEmptyArray">\n <ion-label translate>COMMON.BTN_CLOSE</ion-label>\n </ion-button>\n\n \x3c!-- reload --\x3e\n <ion-button fill="clear" color="dark" (click)="onCancel.emit($event)"\n (keyup.enter)="onCancel.emit($event)"\n [disabled]="disabledCancel">\n <ion-icon slot="start" name="refresh"></ion-icon>\n <ion-label translate>COMMON.BTN_RESET</ion-label>\n </ion-button>\n\n \x3c!-- next --\x3e\n <ion-button fill="solid" (click)="onNext.emit($event)" (keyup.enter)="onNext.emit($event)" *ngIf="onNext.observers | isNotEmptyArray">\n <ion-label translate>COMMON.BTN_NEXT</ion-label>\n <ion-icon slot="end" name="arrow-forward"></ion-icon>\n </ion-button>\n\n \x3c!-- save --\x3e\n <ion-button [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onSave.emit($event)"\n (keyup.enter)="onSave.emit($event)" color="danger"\n [disabled]="disabled">\n <ion-label [innerHTML]="\'COMMON.BTN_SAVE_WITH_SHORTCUT\'|translate" [title]="\'COMMON.BTN_SAVE_WITH_SHORTCUT_HELP\'|translate"></ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n</ion-toolbar>\n',providers:[{provide:Sc,useExisting:Ac}],styles:[":host{width:100%}:host ion-toolbar{height:var(--app-form-buttons-bar-height);padding:0 6px}:host ion-col{padding:0}"]}]}],Ac.ctorParameters=function(){return[{type:Ai}]},Ac.propDecorators={disabled:[{type:e.Input}],disabledCancel:[{type:e.Input}],classList:[{type:e.Input}],onCancel:[{type:e.Output}],onSave:[{type:e.Output}],onNext:[{type:e.Output}],onBack:[{type:e.Output}]};var Tc=function(){function t(t,e){this.navParams=t,this.viewCtrl=e,this.canHideColumns=!0}return t.prototype.ngOnInit=function(){var t=this;this.columns=this.columns||this.navParams.data&&this.navParams.data.columns||[],this.columns.forEach((function(e){e.visible=!1===t.canHideColumns||e.visible,e.canHide=je(e.canHide,t.canHideColumns)}))},t.prototype.onRenderItems=function(t){var e=this.columns.splice(t.detail.from,1)[0];this.columns.splice(t.detail.to,0,e),t.detail.complete()},t.prototype.close=function(){this.viewCtrl.dismiss(this.columns)},t.prototype.cancel=function(){this.viewCtrl.dismiss()},t}();Tc.decorators=[{type:e.Component,args:[{selector:"table-select-columns",template:'<ion-header>\n <ion-toolbar color="light">\n <ion-buttons slot="start">\n <ion-button (click)="cancel()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="arrow-back"></ion-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title>\n {{\'COMMON.DISPLAYED_COLUMNS\'|translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n <ion-button (click)="close()"\n visible-xs visible-sm visible-mobile>\n <ion-icon slot="icon-only" name="checkmark"></ion-icon>\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n\n<ion-content>\n <ion-list>\n \x3c!-- See doc: https://beta.ionicframework.com/docs/api/reorder/ --\x3e\n\n <ion-reorder-group disabled="false" (ionItemReorder)="onRenderItems($event)">\n <ion-item *ngFor="let column of columns">\n <ion-label>{{column.label|translate}}</ion-label>\n <ion-toggle slot="end"\n *ngIf="column.canHide"\n [checked]="column.visible" (ionChange)="column.visible=!column.visible"></ion-toggle>\n <ion-reorder slot="end"></ion-reorder>\n </ion-item>\n </ion-reorder-group>\n </ion-list>\n</ion-content>\n\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <ion-toolbar>\n <ion-row>\n <ion-col></ion-col>\n <ion-col size="auto">\n <ion-button fill="clear" color="dark" (click)="cancel()">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button fill="solid" (click)="close()" color="tertiary">\n <ion-label translate>COMMON.BTN_APPLY</ion-label>\n </ion-button>\n\n </ion-col>\n </ion-row>\n\n </ion-toolbar>\n</ion-footer>\n'}]}],Tc.ctorParameters=function(){return[{type:M.NavParams},{type:M.ModalController}]},Tc.propDecorators={columns:[{type:e.Input}],canHideColumns:[{type:e.Input}]};var Rc=function(){function n(t,n,o,r,i){var a=this;this.accountService=t,this.accountValidatorService=n,this.formBuilder=o,this.environment=r,this.settings=i,this.debug=!1,this.subscriptions=[],this.sending=!1,this.showPwd=!1,this.showConfirmPwd=!1,this.onCancel=new e.EventEmitter,this.onSubmit=new e.EventEmitter,this.referentialToString=ss,this.forms=[],this.forms.push(o.group({email:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.email]),this.emailAvailability(this.accountService)),confirmEmail:new P.FormControl(null,P.Validators.compose([P.Validators.required,this.equalsValidator("email")]))})),this.forms.push(o.group({password:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(8)])),confirmPassword:new P.FormControl(null,P.Validators.compose([P.Validators.required,this.equalsValidator("password")]))}));var s={lastName:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)])),firstName:new P.FormControl(null,P.Validators.compose([P.Validators.required,P.Validators.minLength(2)]))};this.autocompleteHelper=new Pn(i&&{getUserAttributes:function(t,e){return i.getFieldDisplayAttributes(t,e)}}),this.additionalFields=this.accountService.additionalFields.filter((function(t){return t.extra&&t.extra.registration&&t.extra.registration.required})),this.additionalFields.forEach((function(t){s[t.key]=new P.FormControl(null,a.accountValidatorService.getValidators(t)),"entity"===t.type&&(t.autocomplete=a.autocompleteHelper.add(t.key,t.autocomplete))})),this.forms.push(o.group(s)),this.form=o.group({emailStep:this.forms[0],passwordStep:this.forms[1],detailsStep:this.forms[2]})}return n.prototype.ngOnInit=function(){this.environment.production||this.form.setValue({emailStep:{email:"contact@e-is.pro",confirmEmail:"contact@e-is.pro"},passwordStep:{password:"contactera",confirmPassword:"contactera"},detailsStep:{lastName:"Lavenier 2",firstName:"Benoit",department:null}})},Object.defineProperty(n.prototype,"value",{get:function(){var e={username:this.form.value.emailStep.email,password:this.form.value.passwordStep.password,account:new t.Account};return e.account.fromObject(this.form.value.detailsStep),e.account.email=e.username,e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"valid",{get:function(){return this.form.valid},enumerable:!1,configurable:!0}),n.prototype.isEnd=function(){return 2===this.stepper.selectedIndex},n.prototype.isBeginning=function(){return 0===this.stepper.selectedIndex},n.prototype.slidePrev=function(){return this.stepper.previous()},n.prototype.slideNext=function(t){return t&&(t.stopPropagation(),t.preventDefault()),this.stepper.next()},n.prototype.equalsValidator=function(t){return function(e){return e.parent&&e.value!==e.parent.value[t]?{equals:!0}:null}},n.prototype.emailAvailability=function(t){return function(e){return D.timer(500).pipe(N.mergeMap((function(){return t.checkEmailAvailable(e.value).then((function(t){return null})).catch((function(t){return console.error(t),{availability:!0}}))})))}},n.prototype.cancel=function(){this.onCancel.emit()},n.prototype.doSubmit=function(t){this.form.invalid||(this.sending=!0,this.onSubmit.emit(this.value))},n.prototype.markAsTouched=function(){this.form.markAsTouched()},n.prototype.disable=function(){this.form.disable()},n.prototype.enable=function(){this.form.enable()},n}();Rc.decorators=[{type:e.Component,args:[{selector:"form-register",template:'<mat-horizontal-stepper linear #stepper="matHorizontalStepper">\n\n \x3c!-- Step 1: Username --\x3e\n <mat-step [stepControl]="forms[0]" *ngIf="forms[0].controls; let controls">\n\n <form [formGroup]="forms[0]" class="form-container ion-padding" (keyup.enter)="slideNext($event)">\n <ng-template matStepLabel>{{\'REGISTER.STEP_EMAIL\'|translate}}</ng-template>\n\n \x3c!-- Email --\x3e\n <mat-form-field>\n <input matInput\n [appAutofocus]="true" [autofocusDelay]="500" [placeholder]="\'USER.EMAIL\'|translate"\n formControlName="email" autocomplete="off" required>\n <mat-error *ngIf="controls.email.hasError(\'required\') && controls.email.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.email.hasError(\'email\') && !controls.email.hasError(\'required\') && controls.email.touched">\n <span>{{\'ERROR.FIELD_NOT_VALID_EMAIL\' | translate }}</span>\n </mat-error>\n <mat-error *ngIf="controls.email.hasError(\'availability\') && controls.email.touched" translate>REGISTER.ERROR.EMAIL_ALREADY_REGISTERED</mat-error>\n\n </mat-form-field>\n\n \x3c!-- Confirm Email --\x3e\n <mat-form-field>\n <input matInput autocomplete="off" matFormFieldControl [placeholder]="\'REGISTER.CONFIRM_EMAIL\'|translate" formControlName="confirmEmail">\n <mat-error *ngIf="controls.confirmEmail.hasError(\'required\') && controls.confirmEmail.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.confirmEmail.hasError(\'equals\') && controls.confirmEmail.touched">\n <span>{{\'REGISTER.ERROR.NOT_SAME_EMAIL\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n </form>\n </mat-step>\n\n\n \x3c!-- Step 2: Password --\x3e\n <mat-step [stepControl]="forms[1]" *ngIf="forms[1].controls; let controls">\n\n <form [formGroup]="forms[1]" class="form-container ion-padding" (keyup.enter)="slideNext($event)">\n\n <ng-template matStepLabel>{{\'REGISTER.STEP_PASSWORD\'|translate}}</ng-template>\n\n \x3c!-- Password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.PASSWORD\'|translate"\n formControlName="password"\n autocomplete="section-red new-password"\n [type]="showPwd ? \'text\' : \'password\'"\n required>\n <button matSuffix mat-icon-button\n type="button"\n (click)="showPwd = !showPwd"\n tabindex="-1">\n <mat-icon>{{showPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="controls.password.hasError(\'required\') && controls.password.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.password.hasError(\'minlength\') && controls.password.touched">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 8} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Confirm password --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'REGISTER.CONFIRM_PASSWORD\'|translate"\n formControlName="confirmPassword"\n autocomplete="section-red new-password"\n [type]="showConfirmPwd ? \'text\' : \'password\'"\n required>\n <button mat-icon-button matSuffix\n (click)="showConfirmPwd = !showConfirmPwd"\n tabindex="-1">\n <mat-icon>{{showConfirmPwd ? \'visibility_off\' : \'visibility\'}}</mat-icon>\n </button>\n <mat-error *ngIf="controls.confirmPassword.hasError(\'required\') && controls.confirmPassword.touched" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.confirmPassword.hasError(\'equals\') && controls.confirmPassword.touched">\n <span>{{\'REGISTER.ERROR.NOT_SAME_PASSWORD\' | translate }}</span>\n </mat-error>\n </mat-form-field>\n\n </form>\n </mat-step>\n\n\n \x3c!-- Step 3: user details --\x3e\n <mat-step [stepControl]="forms[2]" *ngIf="forms[2].controls; let controls">\n\n <form [formGroup]="forms[2]" (ngSubmit)="doSubmit($event)" class="form-container ion-padding" (keyup.enter)="doSubmit()">\n\n <ng-template matStepLabel>{{\'REGISTER.STEP_USER_DETAILS\'|translate}}</ng-template>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error && !sending" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- Last name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.LAST_NAME\'|translate" formControlName="lastName" autocomplete="section-blue family-name"\n required>\n <mat-error *ngIf="controls.lastName.hasError(\'required\') && controls.lastName.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.lastName.hasError(\'minlength\') && controls.lastName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- First name --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.FIRST_NAME\'|translate" formControlName="firstName" autocomplete="section-blue given-name"\n required>\n <mat-error *ngIf="controls.firstName.hasError(\'required\') && controls.firstName.dirty" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="controls.firstName.hasError(\'minlength\') && controls.firstName.dirty">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Additional fields --\x3e\n <app-form-field *ngFor="let field of additionalFields"\n [definition]="field"\n [formControlName]="field.key"\n [required]="true">\n </app-form-field>\n\n </form>\n </mat-step>\n</mat-horizontal-stepper>\n',styles:["form ion-toolbar.toolbar-buttons .toolbar-content{text-align:right}form ion-toolbar.toolbar-buttons .toolbar-background{border:0;background:inherit!important}"]}]}],Rc.ctorParameters=function(){return[{type:pl},{type:_c},{type:P.FormBuilder},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:ga}]},Rc.propDecorators={stepper:[{type:e.ViewChild,args:["stepper",{static:!0}]}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var Pc=function(){};Pc.decorators=[{type:e.NgModule,args:[{imports:[Q.HttpClientModule],exports:[Q.HttpClientModule]}]}],Pc.ctorParameters=function(){return[]};var Dc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.networkService=n,o}return Ee(e,t),e.prototype.getFormGroup=function(t){var e=this;return this.formBuilder.group({accountInheritance:[t&&t.accountInheritance||!0,P.Validators.required],locale:[t&&t.locale||null,P.Validators.required],latLongFormat:[t&&t.latLongFormat||null,P.Validators.required],usageMode:[t&&t.usageMode||"DESK",P.Validators.required],peerUrl:[t&&t.peerUrl,P.Validators.required],properties:this.getPropertiesArray(t&&t.properties)},{asyncValidators:function(t){return e.peerAlive(t.get("peerUrl"))}})},e.prototype.getPropertiesArray=function(t){var e=this,n=Qi.getMapAsArray(t||{});return this.formBuilder.array(n.map((function(t){return e.getPropertyFormGroup(t)})))},e.prototype.getPropertyFormGroup=function(t){return this.formBuilder.group({key:[t&&t.key||null,P.Validators.compose([P.Validators.required,P.Validators.max(50)])],value:[t&&t.value||null,P.Validators.compose([P.Validators.required,P.Validators.max(100)])]})},e.prototype.peerAlive=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.networkService.offline?(Do.clearError(t,"peerAlive"),[3,3]):[3,1];case 1:return[4,this.networkService.checkPeerAlive(t.value)];case 2:if(!n.sent())return(e=t.errors||{}).peerAlive=!0,t.setErrors(e),t.markAsTouched({onlySelf:!0}),[2,{peerAlive:!0}];Do.clearError(t,"peerAlive"),n.label=3;case 3:return[2]}}))}))},e}(Ic);Dc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Dc(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(Ca))},token:Dc,providedIn:"root"}),Dc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Dc.ctorParameters=function(){return[{type:P.FormBuilder},{type:Ca}]};var Nc=function(e){function n(t,n,o,r,i,a,s,l,c,u,d,p){var h=e.call(this,t,r.getFormGroup())||this;return h.platform=n,h.router=o,h.validatorService=r,h.alertCtrl=i,h.translate=a,h.formBuilder=s,h.accountService=l,h.settings=c,h.cd=u,h.network=d,h.locales=p,h.saving=!1,h.usageModes=["FIELD","DESK"],h.propertyDefinitionsByKey={},h.propertyDefinitionsByIndex={},h.latLongFormats=["DDMMSS","DDMM","DD"],h.propertiesFormHelper=new ar(h.form.get("properties"),(function(t){return h.validatorService.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return Ae(t)||Ae(t.key)&&Ae(t.value)}),{allowEmptyArray:!0}),h.mobile=h.platform.mobile,h._enable=!1,h}return Ee(n,e),Object.defineProperty(n.prototype,"accountInheritance",{get:function(){return this.form.controls.accountInheritance.value},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLogin",{get:function(){return this.accountService.isLogin()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"propertiesForm",{get:function(){return this.form.get("properties")},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var t=Object.create(null,{ngOnInit:{get:function(){return e.prototype.ngOnInit}}});return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return t.ngOnInit.call(this),[4,this.platform.ready()];case 1:return n.sent(),this.propertyDefinitions=this.settings.optionDefs.slice(),this.propertyDefinitions.forEach((function(t){return e.propertyDefinitionsByKey[t.key]=t})),[4,this.load()];case 2:return n.sent(),this.registerSubscription(D.merge(this.accountService.onLogin,this.accountService.onLogout).subscribe((function(){return e.setAccountInheritance(e.accountInheritance)}))),[2]}}))}))},n.prototype.getPropertyDefinition=function(t){var e=this.propertyDefinitionsByIndex[t];return e||(e=this.updatePropertyDefinition(t),this.propertyDefinitionsByIndex[t]=e),e},n.prototype.updatePropertyDefinition=function(t){var e=this.propertiesForm.at(t).controls.key.value,n=e&&this.propertyDefinitionsByKey[e]||null;return this.propertyDefinitionsByIndex[t]=n,this.markForCheck(),n},n.prototype.removePropertyAt=function(t){this.propertiesFormHelper.removeAt(t),this.propertyDefinitionsByIndex={},this.markForCheck()},n.prototype.load=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return this.markAsLoading(),console.debug("[settings] Loading settings..."),(t=this.settings.settings).accountInheritance=je(t.accountInheritance,!0),t.locale=t.locale||this.translate.currentLang||this.translate.defaultLang,t.latLongFormat=t.latLongFormat||"DDMMSS",t.usageMode=t.usageMode||"DESK",Te(t.peerUrl)?[4,this.network.ready()]:[3,2];case 1:n.sent(),e=this.network.peer,t.peerUrl=e&&e.url,n.label=2;case 2:return this.updateView(t),[2]}}))}))},n.prototype.updateView=function(t){if(t){this.data=t;var e=Object.assign({},t);e.properties=Qi.getMapAsArray(t.properties||{}),this.propertiesFormHelper.resize(e.properties.length),this.form.patchValue(e,{emitEvent:!1}),this.markAsPristine(),this.enable({emitEvent:!1}),this.setAccountInheritance(t.accountInheritance,{emitEvent:!1}),this.markAsLoaded(),this.error=null,this.markForCheck()}},n.prototype.save=function(e,n){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.saving?[2]:(this.propertiesFormHelper.removeAllEmpty(),this.form.invalid&&this.debug&&jo.logFormErrors(this.form),console.debug("[settings] Saving local settings..."),this.saving=!0,this.error=void 0,[4,this.getValue()]);case 1:e=r.sent(),(n=this.form.get("peerUrl").dirty)&&(e.pageHistory=[]),r.label=2;case 2:return r.trys.push([2,4,5,6]),this.disable(),[4,this.settings.apply(e)];case 3:return r.sent(),this.data=e,this.markAsPristine(),n&&(this.network.peer=t.Peer.parseUrl(e.peerUrl)),[2,!0];case 4:return o=r.sent(),console.error(o),this.error=o&&o.message||o,[2,!1];case 5:return this.enable({emitEvent:!1}),this.setAccountInheritance(e.accountInheritance,{emitEvent:!1}),this.saving=!1,this.markForCheck(),[7];case 6:return[2]}}))}))},n.prototype.setAccountInheritance=function(t,e){if(this.form.controls.accountInheritance.setValue(t,e),this.data.accountInheritance!==t&&this.form.controls.accountInheritance.markAsDirty({onlySelf:!1}),t)if(this.isLogin){var n=this.accountService.account;n.settings&&(n.settings.locale&&this.form.get("locale").setValue(n.settings.locale,e),n.settings.latLongFormat&&this.form.get("latLongFormat").setValue(n.settings.latLongFormat,e)),this.form.get("locale").disable(e),this.form.get("latLongFormat").disable(e)}else this.form.get("locale").enable(e),this.form.get("latLongFormat").enable(e);else this.form.get("locale").setValue(this.data.locale,e),this.form.get("latLongFormat").setValue(this.data.latLongFormat,e),this.form.get("locale").enable(e),this.form.get("latLongFormat").enable(e);e&&!e.emitEvent||this.markForCheck()},n.prototype.showSelectPeerModal=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.network.showSelectPeerModal(t)];case 1:return(e=o.sent())&&e.url&&((n=this.form.get("peerUrl")).setValue(e.url,{emitEvent:!0,onlySelf:!1}),n.markAsDirty({onlySelf:!1}),this.markAsDirty()),[2]}}))}))},n.prototype.cancel=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.load()];case 1:return t.sent(),[2]}}))}))},n.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.saving?[2]:this.dirty?[4,Dl.askSaveBeforeLeave(this.alertCtrl,this.translate)]:[3,3];case 1:return e.sent()?[4,this.save(t)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2,this.router.navigateByUrl("/",{skipLocationChange:!0})]}}))}))},n.prototype.clearCache=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,Dl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)];case 1:return e.sent()?[4,this.network.clearCache()]:[3,3];case 2:e.sent(),this.settings.removeOfflineFeatures(),e.label=3;case 3:return[2]}}))}))},n.prototype.getValue=function(){return Ie(this,void 0,void 0,(function(){var t,e,n;return Oe(this,(function(o){switch(o.label){case 0:return[4,this.getJsonValueToSave()];case 1:return(t=o.sent()).accountInheritance&&this.isLogin&&(e=this.accountService.account,n=e&&e.settings,console.debug("[settings] Applying account inheritance {locale: '"+n.locale+"', latLongFormat: '"+n.latLongFormat+"'}..."),t.locale=n.locale||t.locale,t.latLongFormat=n.latLongFormat||t.latLongFormat),[2,t]}}))}))},n.prototype.getJsonValueToSave=function(){var t=this.form.value;return t.properties=Qi.getPropertyArrayAsObject(t.properties),Promise.resolve(t)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);Nc.decorators=[{type:e.Component,args:[{selector:"page-settings",template:'<app-toolbar [title]="\'SETTINGS.TITLE\'|translate" color="primary"\n [hasValidate]="form.dirty && !saving"\n [hasClose]="!form.dirty && !saving"\n (onValidate)="save($event)"\n (onClose)="close($event)">\n\n <ion-buttons slot="end">\n <ion-spinner *ngIf="loading || saving"></ion-spinner>\n\n \x3c!-- options menu --\x3e\n <ion-button [matMenuTriggerFor]="optionsMenu">\n <mat-icon slot="icon-only">more_vert</mat-icon>\n </ion-button>\n </ion-buttons>\n</app-toolbar>\n\n\x3c!-- Options menu --\x3e\n<mat-menu #optionsMenu="matMenu">\n \x3c!-- Clear cache --\x3e\n <button mat-menu-item (click)="clearCache($event)">\n <ion-label translate>SETTINGS.BTN_CLEAR_CACHE</ion-label>\n </button>\n\n \x3c!-- Reset --\x3e\n <button mat-menu-item\n [disabled]="!dirty"\n (click)="cancel($event)">\n <ion-label>\n <mat-icon><ion-icon slot="start" name="refresh"></ion-icon></mat-icon> \n <span translate>COMMON.BTN_RESET</span>\n </ion-label>\n </button>\n</mat-menu>\n\n<ion-content>\n\n <form [formGroup]="form" novalidate (ngSubmit)="save($event)" class="form-container">\n\n <ion-grid class="ion-no-padding">\n <ion-row class="ion-no-padding">\n\n \x3c!-- left margin --\x3e\n <ion-col size="0" size-lg="2"> \n </ion-col>\n\n <ion-col class="ion-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <p [innerHTML]="\'SETTINGS.DESCRIPTION\'|translate"></p>\n\n \x3c!-- account inheritance (desktop) --\x3e\n <mat-form-field [hidden]="!isLogin" *ngIf="!mobile; else accountInheritanceMobile">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- check box (if desktop) --\x3e\n <mat-checkbox\n *ngIf="!mobile; else accountInheritanceMobile"\n (change)="setAccountInheritance($event.checked)"\n [checked]="accountInheritance">\n <span translate>SETTINGS.INHERIT_FROM_ACCOUNT</span>\n </mat-checkbox>\n\n <mat-error *ngIf="form.controls.accountInheritance.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- account inheritance (if mobile) --\x3e\n <ng-template #accountInheritanceMobile>\n <mat-form-field [hidden]="!isLogin">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- slide toggle --\x3e\n <ion-text translate>SETTINGS.INHERIT_FROM_ACCOUNT</ion-text>\n <mat-slide-toggle matSuffix\n (change)="setAccountInheritance($event.checked)"\n [checked]="accountInheritance">\n\n </mat-slide-toggle>\n <mat-error *ngIf="form.controls.accountInheritance.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ng-template>\n\n \x3c!-- locale --\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.LOCALE\'|translate" formControlName="locale" required>\n <mat-option *ngFor="let item of locales" [value]="item.key">\n {{item.value}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="form.controls.locale.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n\n \x3c!-- Network entry --\x3e\n <h3>\n <ion-text translate>SETTINGS.NETWORK_DIVIDER</ion-text>\n </h3>\n\n \x3c!-- Peer address --\x3e\n <mat-form-field>\n <input matInput type="text" [placeholder]="\'SETTINGS.PEER_URL\'|translate" formControlName="peerUrl"\n required>\n\n <button mat-icon-button type="button" matSuffix (click)="showSelectPeerModal()" tabindex="-1"\n [title]="\'SETTINGS.BTN_CHANGE_PEER\'|translate">\n <mat-icon>search</mat-icon>\n </button>\n\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'peerAlive\')"\n translate>SETTINGS.ERROR.PEER_NOT_REACHABLE\n </mat-error>\n <mat-error *ngIf="form.controls.peerUrl.hasError(\'peerNotCompatible\')"\n translate>SETTINGS.ERROR.PEER_NOT_COMPATIBLE\n </mat-error>\n </mat-form-field>\n\n \x3c!-- Offline mode (if mobile) --\x3e\n <mat-form-field *ngIf="mobile">\n <input matInput hidden formControlName="accountInheritance" type="text">\n\n \x3c!-- slide toggle --\x3e\n <ion-text translate>SETTINGS.OFFLINE_MODE</ion-text>\n <mat-slide-toggle matSuffix\n (change)="network.setForceOffline($event.checked)"\n [checked]="network.offline">\n\n </mat-slide-toggle>\n </mat-form-field>\n\n \x3c!-- Data entry --\x3e\n <h3>\n <ion-text translate>SETTINGS.DATA_ENTRY_DIVIDER</ion-text>\n </h3>\n\n \x3c!-- Usage mode --\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.USAGE_MODE\'|translate" formControlName="usageMode"\n required>\n <mat-option *ngFor="let item of usageModes" [value]="item">\n {{\'SETTINGS.USAGE_MODES.\'+item|translate}}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="form.controls.usageMode.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- lat/long format--\x3e\n <mat-form-field>\n <mat-select [placeholder]="\'SETTINGS.LAT_LONG_FORMAT\'|translate" formControlName="latLongFormat"\n required>\n <mat-option *ngFor="let item of latLongFormats" [value]="item">\n {{\'COMMON.LAT_LONG.\'+item+\'_PLACEHOLDER\'|translate}}\n </mat-option>\n </mat-select>\n <mat-error\n *ngIf="form.controls.latLongFormat.hasError(\'required\')"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n\n \x3c!-- fields options --\x3e\n <ion-grid formArrayName="properties" class="ion-no-padding">\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding ion-align-self-end" size="12">\n <span class="toolbar-spacer"></span>\n\n \x3c!-- Show more options --\x3e\n <ion-button color="light" *ngIf="propertiesForm?.length === 0"\n [title]="\'SETTINGS.BTN_SHOW_MORE_HELP\'|translate"\n (click)="propertiesFormHelper.add()">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n \x3c!-- Fields options --\x3e\n <ng-container *ngFor="let propertyForm of propertiesForm?.controls; let i=index">\n <ion-row class="ion-no-padding" [formGroupName]="i">\n\n \x3c!-- property key --\x3e\n <ion-col class="ion-no-padding">\n <mat-form-field>\n <mat-select formControlName="key"\n [placeholder]=" \'SETTINGS.PROPERTY_KEY\'|translate">\n <mat-option *ngFor="let item of propertyDefinitions" [value]="item.key">{{ item.label | translate }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- property value --\x3e\n <ion-col class="ion-no-padding" padding-left>\n <app-form-field *ngIf="getPropertyDefinition(i); let definition"\n floatLabel="never"\n [definition]="definition"\n [formControl]="propertyForm.controls.value"\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [required]="true">\n </app-form-field>\n </ion-col>\n <ion-col size="2" class="ion-no-padding">\n <button type="button" mat-icon-button color="light"\n [disabled]="loading"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="removePropertyAt(i)">\n <mat-icon>close</mat-icon>\n </button>\n <button *ngIf="propertiesFormHelper.isLast(i)"\n type="button"\n mat-icon-button\n color="light"\n [disabled]="loading"\n [title]="\'SETTINGS.BTN_ADD_PROPERTY\'|translate"\n (click)="propertiesFormHelper.add()">\n <mat-icon>add</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n </ng-container>\n </ion-grid>\n </ion-col>\n\n \x3c!-- right margin --\x3e\n <ion-col size="0" size-lg="2"> \n </ion-col>\n </ion-row>\n </ion-grid>\n\n\n </form>\n</ion-content>\n\n<ion-footer hidden-xs hidden-sm hidden-mobile>\n <app-form-buttons-bar (onCancel)="cancel()" (onSave)="save($event)" [disabled]="!form.dirty || saving"></app-form-buttons-bar>\n</ion-footer>\n',providers:[{provide:Dt.ValidatorService,useExisting:Dc}],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Nc.ctorParameters=function(){return[{type:e.Injector},{type:Sl},{type:z.Router},{type:Dc},{type:M.AlertController},{type:F.TranslateService},{type:P.FormBuilder},{type:pl},{type:ga},{type:e.ChangeDetectorRef},{type:Ca},{type:Array,decorators:[{type:e.Inject,args:[rs]}]}]};var Fc=function(t){function e(e,n,o,r,i,a){var s=t.call(this,e,null)||this;return s.formBuilder=n,s.dateAdapter=o,s.settings=r,s.cd=i,s.formGroupDir=a,s.definitionsMapByKey={},s.definitionsByIndex={},s}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.formArray.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fieldForms",{get:function(){return this.formArray.controls},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;if(Fe(this.definitions))throw new Error("Missing or invalid attribute 'definitions'");this.definitionsMapByKey={},this.definitions.forEach((function(t){e.definitionsMapByKey[t.key]=t}));var n=this.formArray&&this.formArray.parent||this.formGroupDir&&this.formGroupDir.form||this.formBuilder.group({});this.setForm(n),this.formArray=this.formArray||this.formArrayName&&n.get(this.formArrayName),this.formArrayName=this.formArrayName||this.formArray&&Object.keys(n.controls).find((function(t){return n.get(t)===e.formArray}))||"properties",this.formArray||(console.warn("Missing array control '"+this.formArrayName+"'. Will create it!"),this.formArray=this.formBuilder.array([]),this.form.addControl(this.formArrayName,this.formArray)),this.helper=new ar(this.formArray,(function(t){return e.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return Ae(t)||Ae(t.key)&&Ae(t.value)}),this.options),t.prototype.ngOnInit.call(this)},e.prototype.getDefinitionAt=function(t){var e=this.definitionsByIndex[t];return e||(e=this.updateDefinitionAt(t),this.definitionsByIndex[t]=e),e},e.prototype.updateDefinitionAt=function(t){var e=this.formArray.at(t).controls.key.value,n=e&&this.definitionsMapByKey[e]||null;return this.definitionsByIndex[t]=n,this.markForCheck(),n},e.prototype.removeAt=function(t){this.helper.removeAt(t),this.definitionsByIndex={},this.markForCheck()},e.prototype.isUnknownField=function(t){var e=t.get("key"),n=e&&e.value;return n&&Ae(this.definitionsMapByKey[n])},e.prototype.setValue=function(t){if(t){var e=Qi.getMapAsArray(t);this.helper.resize(e.length),this.helper.formArray.patchValue(e,{emitEvent:!1}),this.markAsPristine(),this.markAsLoaded()}},e.prototype.getPropertyFormGroup=function(t){return this.formBuilder.group({key:[t&&t.key||null,P.Validators.compose([P.Validators.required,P.Validators.max(50)])],value:[t&&t.value||null,P.Validators.required]})},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}(pc);Fc.decorators=[{type:e.Component,args:[{selector:"app-properties-form",template:'\n\x3c!-- Properties --\x3e\n<form [formGroup]="form" class="form-container">\n <ion-grid *ngIf="!loading; else propertiesSkeleton"\n formArrayName="properties" class="ion-no-padding" >\n <ion-row class="ion-no-padding">\n <ion-col class="ion-no-padding ion-align-self-end" size="12">\n <span class="toolbar-spacer"></span>\n\n \x3c!-- Show more options --\x3e\n <ion-button color="light" *ngIf="formArray?.length === 0"\n [title]="\'SETTINGS.BTN_SHOW_MORE_HELP\'|translate"\n (click)="helper.add()">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot="end">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-container *ngFor="let fieldForm of fieldForms; let i=index">\n <ion-row class="ion-no-padding" [formGroupName]="i">\n\n \x3c!-- property key --\x3e\n <ion-col size="6" class="ion-no-padding">\n <mat-form-field floatLabel="never">\n <mat-select [formControl]="fieldForm.controls.key"\n [placeholder]="\'SETTINGS.PROPERTY_KEY\'|translate"\n (selectionChange)="updateDefinitionAt(i)"\n [tabindex]="20+i*2"\n required>\n\n \x3c!-- When option\'s key not a well known option, add it as first select option --\x3e\n <mat-option *ngIf="isUnknownField(fieldForm)" [value]="fieldForm.controls.key.value">\n {{fieldForm.controls.key.value}}\n </mat-option>\n\n <mat-option *ngFor="let item of definitions" [value]="item.key">{{ item.label | translate }}\n </mat-option>\n\n </mat-select>\n\n <mat-error *ngIf="fieldForm.controls.key.hasError(\'required\') && !helper.isLast(i)"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ion-col>\n\n \x3c!-- property value --\x3e\n <ion-col class="ion-no-padding" padding-left >\n <app-form-field *ngIf="getDefinitionAt(i) else unknownValue; let definition; "\n floatLabel="never"\n [definition]="definition"\n [formControl]="fieldForm.controls.value"\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [required]="true"\n [tabindex]="20+i*2 + 1">\n </app-form-field>\n <ng-template #unknownValue>\n <mat-form-field floatLabel="never">\n <input type="text" matInput\n [placeholder]="\'SETTINGS.PROPERTY_VALUE\' | translate"\n [formControl]="fieldForm.controls.value"\n [required]="true"\n [tabindex]="20+i*2 + 1">\n </mat-form-field>\n </ng-template>\n </ion-col>\n\n <ion-col size="auto" class="ion-no-padding">\n <button type="button" mat-icon-button color="light"\n [disabled]="disabled"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="removeAt(i)">\n <mat-icon>close</mat-icon>\n </button>\n <button [hidden]="!helper.isLast(i)"\n type="button"\n mat-icon-button\n color="light"\n [disabled]="disabled"\n [title]="\'SETTINGS.BTN_ADD_PROPERTY\'|translate"\n (click)="helper.add()">\n <mat-icon>add</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n </ng-container>\n </ion-grid>\n</form>\n\n<ng-template #propertiesSkeleton>\n\n <ion-grid class="ion-no-padding">\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="propertyRowSkeleton"></ng-container>\n </ion-grid>\n\n</ng-template>\n\n<ng-template #propertyRowSkeleton>\n\n <ion-row>\n \x3c!-- property key --\x3e\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n <ion-icon name="arrow-dropdown" matSuffix></ion-icon>\n </mat-form-field>\n </ion-col>\n \x3c!-- value --\x3e\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n </mat-form-field>\n </ion-col>\n \x3c!-- buttons --\x3e\n <ion-col size="2">\n <button type="button" mat-icon-button color="light"\n [disabled]="true">\n <mat-icon>close</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Fc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:ga},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Fc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],definitions:[{type:e.Input}]};var Mc=function(t){function n(n,o,r,i,a,s){var l=t.call(this,n,null)||this;return l.injector=n,l.formBuilder=o,l.dateAdapter=r,l.settings=i,l.cd=a,l.formGroupDir=s,l.selection=new Nt.SelectionModel(!0,[]),l.displayWithFn=ss,l.onNewItem=new e.EventEmitter,l.selectionChanges=new e.EventEmitter(!0),l}return Ee(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.formArray.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"itemControls",{get:function(){return this.formArray&&this.formArray.controls},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"length",{get:function(){return this.helper?this.helper.size():0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"empty",{get:function(){return 0===this.length},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"touched",{get:function(){return this.formArray&&(this.formArray.touched||-1!==(this.formArray.controls||[]).findIndex((function(t){return t.touched})))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"untouched",{get:function(){return!this.formArray||this.formArray.untouched||-1===(this.formArray.controls||[]).findIndex((function(t){return t.touched}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dirty",{get:function(){return this.formArray&&this.formArray.dirty},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"invalid",{get:function(){return!this.formArray||this.formArray.invalid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"valid",{get:function(){return this.formArray&&this.formArray.valid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pending",{get:function(){return!this.formArray||this.formArray.pending},enumerable:!1,configurable:!0}),n.prototype.markAsTouched=function(t){jo.markAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.markAllAsTouched=function(t){jo.markAllAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.ngOnInit=function(){var e=this;this.options=Object.assign({allowEmptyArray:!0,allowMultipleSelection:!0,buttons:[]},this.options);var n=this.formArray&&this.formArray.parent||this.formGroupDir&&this.formGroupDir.form||this.formBuilder.group({});this.setForm(n),this.formArray=this.formArray||this.formArrayName&&n.get(this.formArrayName),this.formArrayName=this.formArrayName||this.formArray&&Object.keys(n.controls).find((function(t){return n.get(t)===e.formArray}))||"properties",this.formArray||(console.warn("Missing array control '"+this.formArrayName+"'. Will create it!"),this.formArray=this.formBuilder.array([]),this.form.addControl(this.formArrayName,this.formArray)),this.equalsFn=this.equalsFn||function(t,e){return Ae(t)&&Ae(e)||t===e},this.helper=new ar(this.formArray,(function(t){return e.createControl(t)}),this.equalsFn,(function(t){return Ae(t)}),this.options),t.prototype.ngOnInit.call(this)},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.onNewItem.complete(),this.onNewItem.unsubscribe(),this.selectionChanges.complete(),this.selectionChanges.unsubscribe()},n.prototype.setValue=function(t){t=t||[],this.helper?(this.helper.resize(t.length),this.helper.formArray.patchValue(t,{emitEvent:!1})):console.warn("TODO: cannot applyied setValue() on fromArray, because formArrayHelper not exists yet !"),this.selection.clear(),this.markAsPristine(),this.markAsLoaded()},n.prototype.isAllSelected=function(){return this.selection.selected.length===this.length},n.prototype.masterToggle=function(t){return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){return this.loading||(this.isAllSelected()?this.selection.clear():this.value.forEach((function(t){return e.selection.select(t)})),t&&!1===t.emitEvent||this.selectionChanges.emit(this.selection.selected)),[2]}))}))},n.prototype.onItemClick=function(t,e,n){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){return e&&!t.defaultPrevented&&this.selectionChanges.observers.length?(t.ctrlKey&&this.options.allowMultipleSelection?this.selection.toggle(e):!this.selection.isSelected(e)||this.options.allowMultipleSelection&&this.selection.selected.length>1?(this.selection.clear(),this.selection.select(e)):this.selection.clear(),n&&!1===n.emitEvent||this.selectionChanges.emit(this.selection.selected),[2]):[2]}))}))},n.prototype.onItemButtonClick=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(r){switch(r.label){case 0:return t.click&&t.click(e,n,o),[4,this.onItemClick(e,n)];case 1:return r.sent(),[2]}}))}))},n.prototype.hasSelection=function(){return this.selection.hasValue()},n.prototype.onNewClick=function(t){this.onNewItem.emit(t)},n.prototype.add=function(t,e){this.helper.add(t,{emitEvent:!0})&&(this.options.allowMultipleSelection||this.selection.clear(),this.selection.toggle(t),this.markForCheck(),e&&!1===e.emitEvent||this.selectionChanges.emit(this.selection.selected))},n.prototype.removeAt=function(t){var e=this.helper.at(t).value;this.selection.isSelected(e)&&this.selection.deselect(e),this.helper.removeAt(t)},n.prototype.displayWith=function(t){return this.displayWithFn?this.displayWithFn(t):t},n.prototype.createControl=function(t){return this.formBuilder.control(t||null,P.Validators.required)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pc);Mc.decorators=[{type:e.Component,args:[{selector:"app-list-form",template:'\n<ng-container *ngIf="!loading; else listSkeleton">\n\n \x3c!-- List --\x3e\n <ion-list class="ion-no-padding" >\n\n <ng-container *ngFor="let itemControl of itemControls; index as i; last as last">\n <ion-item *ngIf="itemControl.value; let item"\n [class.disabled]="disabled" tappable\n (click)="onItemClick($event, item)"\n [color]="selection.isSelected(item) ? \'secondary100\' : undefined"\n [button]="selectionChanges.observers.length > 0">\n <ion-label>{{displayWith(item)}}</ion-label>\n\n \x3c!-- buttons --\x3e\n <ion-buttons slot="end" *ngIf="enabled" class="action-buttons">\n <ion-button fill="clear" (click)="removeAt(i)">\n <ion-icon slot="icon-only" name="trash"></ion-icon>\n </ion-button>\n\n <ion-button *ngFor="let button of options.buttons"\n fill="clear" [color]="button.color"\n [class.cdk-visually-hidden]="button.disabled|async"\n (click)="onItemButtonClick(button, $event, item, i)"\n [title]="(button.title || \'\')|translate">\n <ion-icon slot="icon-only" [name]="button.icon"></ion-icon>\n </ion-button>\n\n </ion-buttons>\n </ion-item>\n </ng-container>\n </ion-list>\n\n \x3c!-- Add button --\x3e\n <ion-button color="tertiary" fill="clear"\n *ngIf="enabled && onNewItem.observers.length; else emptyText"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="onNewClick($event)" >\n <ion-icon slot="start" name="add"></ion-icon>\n <ion-label translate>COMMON.BTN_ADD</ion-label>\n </ion-button>\n\n \x3c!-- Empty (if readonly) --\x3e\n <ng-template #emptyText>\n <ion-text *ngIf="!length" color="medium"><i translate>COMMON.EMPTY_OPTION</i></ion-text>\n </ng-template>\n</ng-container>\n\n<ng-template #listSkeleton>\n\n <ion-list>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n <ng-container *ngTemplateOutlet="itemSkeleton"></ng-container>\n </ion-list>\n\n</ng-template>\n\n<ng-template #itemSkeleton>\n\n <ion-item>\n <ion-label>\n <ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>\n </ion-label>\n </ion-item>\n\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-secondary100-contrast);--ion-item-icon-color-selected:var(--ion-color-secondary100-contrast)}ion-item.disabled ion-label{color:var(--ion-color-medium-shade,grey)}ion-item .action-buttons{visibility:hidden;display:none}ion-item:hover{height:48px!important}ion-item:hover .action-buttons{margin-top:-1px;visibility:visible;display:block}ion-item.selected{background:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-item.selected ion-label,ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}"]}]}],Mc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:ga},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Mc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],displayWithFn:[{type:e.Input,args:["displayWith"]}],equalsFn:[{type:e.Input,args:["equals"]}],onNewItem:[{type:e.Output}],selectionChanges:[{type:e.Output}]};var Lc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"===t},t}();Lc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Lc},token:Lc,providedIn:"root"}),Lc.decorators=[{type:e.Pipe,args:[{name:"isOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var jc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"!==t},t}();jc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new jc},token:jc,providedIn:"root"}),jc.decorators=[{type:e.Pipe,args:[{name:"isNotOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Bc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Is.personsToString(t,e):Is.personToString(t)},t}();Bc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Bc},token:Bc,providedIn:"root"}),Bc.decorators=[{type:e.Pipe,args:[{name:"personToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Uc=Object.freeze({ANDROID_APK:"application/vnd.android.package-archive"}),Vc=function(){function n(t,n,o,r,i,a,s,l,c){this.modalCtrl=t,this.configService=n,this.toastController=o,this.alertController=r,this.translate=i,this.cd=a,this.platform=s,this.network=l,this.environment=c,this._subscription=new D.Subscription,this._showUpdateOfflineFeature=!1,this.loading=!0,this.canDownload=!1,this.downloading=!1,this.waitingNetwork=!1,this.showUpgradeWarning=!0,this.showOfflineWarning=!0,this.showInstallButton=!1,this.onUpdateOfflineModeClick=new e.EventEmitter}return Object.defineProperty(n.prototype,"showUpdateOfflineFeature",{get:function(){return this._showUpdateOfflineFeature},set:function(t){t!==this._showUpdateOfflineFeature&&(this._showUpdateOfflineFeature=t,this.markForCheck())},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var t=this;this.offline=this.network.offline,this._subscription.add(D.from(this.network.ready()).pipe(N.debounceTime(1e3),N.switchMap((function(){return t.configService.config})),N.filter(Re)).subscribe((function(e){return t.checkNeedInstallOrUpdate(e)}))),this._subscription.add(this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"===t})),N.distinctUntilChanged()).subscribe((function(e){t.offline!==e&&(t.offline=e,t.markForCheck())})))},n.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._subscription=null,this.onUpdateOfflineModeClick.complete(),this.installLinks=null,this.upgradeLinks=null},n.prototype.download=function(t,e){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(n){return e&&e.url?(e.downloading=!0,this.markForCheck(),this.listenDownloadJob(e.url,this.platform.download({uri:e.url,title:e.title,filename:e.filename,mimeType:e.mimeType})).then((function(){return e.downloading=!1})).catch((function(){return e.downloading=!1})).then((function(){return t.markForCheck()})),[2]):(console.error("[install-upgrade-card] Missing required argument 'link.url'"),[2])}))}))},n.prototype.tryOnline=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:this.waitingNetwork=!0,this.markForCheck(),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,this.network.tryOnline({showLoadingToast:!1,showOnlineToast:!0,showOfflineToast:!1})];case 2:return t.sent(),[3,4];case 3:return this.waitingNetwork=!1,this.markForCheck(),[7];case 4:return[2]}}))}))},n.prototype.getPlatformName=function(t){switch(t){case"android":return"Android";case"ios":return"iOS";default:return""}},n.prototype.asLink=function(t){return t},n.prototype.checkNeedInstallOrUpdate=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:if(!t)return[2];console.info("[install-upgrade-card] Check if need to install or upgrade..."),this.canDownload=this.platform.canDownload,n.label=1;case 1:return n.trys.push([1,,5,6]),e=this.getLinks(t),this.upgradeLinks=this.getCompatibleUpgradeLinks(e,t),Ne(this.upgradeLinks)?(console.info("[install-upgrade-card] Find upgrade links: "+this.upgradeLinks.map((function(t){return t.url})).join(",")),this.installLinks=null,this.listenDownloadJobs(),[3,4]):[3,2];case 2:return this.installLinks=this.getCompatibleInstallLinks(e),Ne(this.installLinks)?(console.info("[install-upgrade-card] Find install links "+this.installLinks.map((function(t){return t.url})).join(",")),[4,nn(1e3)]):[3,4];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return this.loading=!1,this.markForCheck(),[7];case 6:return[2]}}))}))},n.prototype.getCompatibleInstallLinks=function(t){if(!this.platform.is("cordova"))return this.platform.is("mobileweb")?t:void 0},n.prototype.getCompatibleUpgradeLinks=function(t,e){var n=this,o=this.environment.version,r=e.getProperty(yl.APP_MIN_VERSION);if(o){if(r&&!aa.isCompatible(r,o)){var i=t.filter((function(t){return n.platform.is("mobileweb")||t.platform&&n.platform.is(t.platform)}));return i.forEach((function(t){t.version=t.version||r})),Ne(i)?i:void 0}}else console.error("Missing value for 'environment.version': cannot check app compatibility!")},n.prototype.getLinks=function(e){var n=[],o=e.getProperty(yl.ANDROID_INSTALL_URL);Te(o)&&(o=this.environment.defaultAndroidInstallUrl||null);var r=this.network.peer;r&&(o.startsWith("./")||o.startsWith("/"))&&(o=t.Peer.path(r,o));var i=e.getProperty(yl.APP_MIN_VERSION),a=Pe(o)&&e.label||this.environment.defaultAppName||"SUMARiS";if(o){var s=void 0,l=void 0,c=this.getFilename(o),u=i||"latest";if(null==c?void 0:c.endsWith(".apk")){l=Uc.ANDROID_APK;var d=/-v([1-9][0-9]*\.[0-9]+\.(:?(:?alpha|beta|rc)?[0-9]*))/i.exec(c);u=d&&d[1]||u,Pe(a)&&"latest"!==u?(c=(a+"-v"+u+".apk").toLowerCase(),s=a+" v"+u):c.indexOf("latest")&&(c=c.replace("latest",u))}n.push({name:a,url:o,platform:"android",version:u,filename:c,title:s,mimeType:l})}return n},n.prototype.getFilename=function(t){if(t){var e=t.substring(t.lastIndexOf("/")+1),n=e.indexOf("?");return-1!==n?e.substring(0,n):e}},n.prototype.listenDownloadJobs=function(){var t=this;(this.upgradeLinks||[]).forEach((function(e){var n=t.platform.getDownloadingJob(e.url);n&&(e.downloading=!0,t.listenDownloadJob(e.url,n).then((function(){return e.downloading=!1})).catch((function(){return e.downloading=!1})).then((function(){return t.markForCheck()})))}))},n.prototype.listenDownloadJob=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:if(!t||!e)return[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.downloading?console.info("[install-upgrade-card] Platform is already downloading!"):(console.info("[install-upgrade-card] Asking platform to download '"+t+"'..."),this.downloading=!0,this.markForCheck()),[4,e.toPromise()];case 2:return(n=r.sent())?(console.info("[install-upgrade-card] File downloaded at: "+n),[2,this.showDownloadCompleteDialog()]):[3,5];case 3:return o=r.sent(),console.error("[install-upgrade-card] Download failed: "+(o&&o.message||o)),[2,this.showDownloadFailedToast(o)];case 4:return this.downloading=!1,this.markForCheck(),[7];case 5:return[2]}}))}))},n.prototype.showDownloadFailedToast=function(t){return this.showToast({message:"ERROR.DOWNLOAD_FAILED",messageParams:{error:t},type:"error",showCloseButton:!0})},n.prototype.showDownloadCompleteDialog=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return this._subscription?[4,this.translate.get(["INFO.ALERT_HEADER","INFO.UPDATE_APP_DOWNLOADED","COMMON.BTN_CLOSE"]).toPromise()]:[2];case 1:return t=n.sent(),[4,this.alertController.create({header:t["INFO.ALERT_HEADER"],message:t["INFO.UPDATE_APP_DOWNLOADED"],buttons:[{text:t["COMMON.BTN_CLOSE"],role:"cancel",cssClass:"secondary"}]})];case 2:return[4,(e=n.sent()).present()];case 3:return n.sent(),[4,e.onDidDismiss()];case 4:return n.sent(),[2]}}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this._subscription?[4,ba.show(this.toastController,this.translate,t)]:[2];case 1:return e.sent(),[2]}}))}))},n}();Vc.decorators=[{type:e.Component,args:[{selector:"app-install-upgrade-card",template:'\n\n\x3c!-- Offline mode card--\x3e\n<ion-card *ngIf="showOfflineWarning && (!loading && offline || waitingNetwork)"\n color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap" *ngIf="!waitingNetwork; else waitingNetworkText">\n <h4>\n <b *ngIf="isLogin; else notLogin" [innerHTML]="\'NETWORK.INFO.OFFLINE_OR_UNAUTHORIZED\'| translate"></b>\n <ng-template #notLogin>\n <b [innerHTML]="\'NETWORK.INFO.OFFLINE\'| translate"></b>\n </ng-template>\n </h4>\n <h3>\n <small [innerHTML]="\'NETWORK.INFO.OFFLINE_HELP\'|translate"></small>\n </h3>\n </ion-text>\n <ng-template #waitingNetworkText>\n <ion-text class="ion-text-wrap" [innerHTML]="\'NETWORK.INFO.RETRY_TO_CONNECT\'| translate"></ion-text>\n </ng-template>\n </ion-col>\n <ion-col size="auto">\n\n \x3c!-- Retry button --\x3e\n <ion-button *ngIf="!waitingNetwork; else waitingSpinner" color="tertiary" class="ion-float-end"\n (click)="tryOnline()">\n <span translate>NETWORK.BTN_CHECK_ALIVE</span>\n </ion-button>\n\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Upgrade links --\x3e\n<ion-card *ngIf="showUpgradeWarning && !loading && !offline && upgradeLinks"\n color="accent"\n class="ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngFor="let link of upgradeLinks; last as last">\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h3>\n <span *ngIf="link.version" [innerHTML]="\'INFO.UPDATE_APP_TO_VERSION\'| translate: link"></span>\n <span *ngIf="!link.version" [innerHTML]="\'INFO.UPDATE_APP\'| translate: link"></span>\n </h3>\n <h4>\n <small *ngIf="last" [innerHTML]="\'INFO.UPDATE_APP_HELP\'|translate"></small>\n </h4>\n </ion-text>\n </ion-col>\n\n <ion-col size="auto">\n <ng-container *ngTemplateOutlet="downloadButton; context: { $implicit: link }"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Install links --\x3e\n<ion-card *ngIf="showInstallButton && !loading && !offline && installLinks"\n color="secondary"\n class="ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngFor="let link of installLinks; last as last">\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h3 [innerHTML]="\'INFO.DOWNLOAD_APP_TITLE\'| translate: {name: link.name, platform: getPlatformName(link.platform) }"></h3>\n <h4><small *ngIf="last" [innerHTML]="\'INFO.DOWNLOAD_APP_HELP\'|translate"></small></h4>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n <ng-container *ngTemplateOutlet="downloadButton; context: { $implicit: link }"></ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Update offline feature card--\x3e\n<ion-card *ngIf="showUpdateOfflineFeature && !loading && !offline"\n color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap">\n <h4>\n <b [innerHTML]="\'NETWORK.INFO.UPDATE_OFFLINE_MODE\'| translate"></b>\n </h4>\n <h3>\n <small [innerHTML]="\'NETWORK.INFO.UPDATE_OFFLINE_MODE_HELP\'|translate"></small>\n </h3>\n </ion-text>\n </ion-col>\n <ion-col size="auto">\n\n \x3c!-- Retry button --\x3e\n <ion-button color="tertiary" class="ion-float-end"\n (click)="onUpdateOfflineModeClick.emit($event)">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-card-content>\n</ion-card>\n\n\x3c!-- Display a download button, depending on the link URL, and the device platform --\x3e\n<ng-template #downloadButton let-link>\n\n <ng-container *ngIf="link.filename; else redirectButton">\n\n <ng-container *ngIf="canDownload; else webDownloadButton">\n \x3c!-- Download using platform --\x3e\n <ion-button (click)="download($event, asLink(link))"\n [disabled]="link.downloading"\n color="tertiary" class="ion-float-end">\n <ion-icon slot="start" *ngIf="!link.downloading" name="download"></ion-icon>\n <ion-spinner slot="start" class="ion-no-padding" *ngIf="link.downloading"></ion-spinner>\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-container>\n\n \x3c!-- Web download button --\x3e\n <ng-template #webDownloadButton>\n <ion-button [download]="link.downloadFilename"\n [href]="link.url"\n color="tertiary" class="ion-float-end" >\n <ion-label translate>COMMON.BTN_DOWNLOAD</ion-label>\n </ion-button>\n </ng-template>\n </ng-container>\n\n \x3c!-- Web redirect button --\x3e\n <ng-template #redirectButton>\n <ion-button [href]="link.url" rel="external" color="tertiary" class="ion-float-end" target="_blank">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n </ion-button>\n </ng-template>\n</ng-template>\n\n\n\x3c!-- Waiting spinner --\x3e\n<ng-template #waitingSpinner>\n <ion-spinner color="light"></ion-spinner>\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[na],styles:["ion-text small{font-size:85%}"]}]}],Vc.ctorParameters=function(){return[{type:M.ModalController},{type:xl},{type:M.ToastController},{type:M.AlertController},{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:Sl},{type:Ca},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Vc.propDecorators={isLogin:[{type:e.Input}],showUpgradeWarning:[{type:e.Input}],showOfflineWarning:[{type:e.Input}],showInstallButton:[{type:e.Input}],showUpdateOfflineFeature:[{type:e.Input}],onUpdateOfflineModeClick:[{type:e.Output}]};var qc=function(){function t(){}return t.prototype.transform=function(t){return t&&t.pubkey&&!0},t}();qc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new qc},token:qc,providedIn:"root"}),qc.decorators=[{type:e.Pipe,args:[{name:"isLogin"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var $c=function(){function t(){}return t.prototype.transform=function(t){return Os(t)},t}();$c.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new $c},token:$c,providedIn:"root"}),$c.decorators=[{type:e.Pipe,args:[{name:"accountToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Gc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Cs(t,e):vs(t)},t}();Gc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Gc},token:Gc,providedIn:"root"}),Gc.decorators=[{type:e.Pipe,args:[{name:"departmentToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Hc=function(){function t(){this._toggledSubject=new D.Subject,this._visibleSubject=new D.Subject}return Object.defineProperty(t.prototype,"menuToggled$",{get:function(){return this._toggledSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"menuVisible$",{get:function(){return this._visibleSubject.asObservable()},enumerable:!1,configurable:!0}),t.prototype.toggleMenu=function(){this._toggledSubject.next()},t.prototype.menuVisible=function(t){this._visibleSubject.next(t)},t}();Hc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Hc},token:Hc,providedIn:"root"}),Hc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Wc=new e.InjectionToken("menuItems"),zc=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){this.platformService=t,this.accountService=e,this.router=n,this.menu=o,this.modalCtrl=r,this.alertController=i,this.translate=a,this.configService=s,this.cd=l,this.menuService=c,this.environment=u,this.items=d,this._subscription=new D.Subscription,this.loading=!0,this.isLogin=!1,this.$items=new D.BehaviorSubject(void 0),this.appVersion=this.environment.version,this.side="left",this._debug=!u.production,this.onResize()}return t.prototype.onResize=function(t){this._screenWidth=window.innerWidth,console.debug("[menu] Screen size (px): "+this._screenWidth)},t.prototype.ngOnInit=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return this.splitPaneOpened=!0,this.splitPane.when="lg",[4,this.platformService.ready()];case 1:return e.sent(),this.splitPaneOpened=!0,this.menuService.menuToggled$.subscribe((function(){return t.toggleSplitPane()})),this._subscription.add(D.merge(this.accountService.onLogin,this.accountService.onLogout,this.configService.config.pipe(N.tap((function(e){return t._config=e})))).pipe(N.mergeMap((function(){return t.accountService.ready()}))).subscribe((function(e){t.accountService.isLogin()?t.onLogin(t.accountService.account):t.onLogout(!0)}))),[2]}}))}))},t.prototype.onLogin=function(t){return Ie(this,void 0,void 0,(function(){var e=this;return Oe(this,(function(n){switch(n.label){case 0:return console.info("[menu] Update using logged account"),this.accountAvatar=t.avatar,this.accountName=t.displayName,this.accountEmail=t.email,this.isLogin=!0,[4,this.refreshMenuItems()];case 1:return n.sent(),setTimeout((function(){e.loading=!1,e.detectChanges()}),500),[2]}}))}))},t.prototype.onLogout=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return t||console.debug("[menu] logout"),this.isLogin=!1,this.accountAvatar=null,this.accountEmail=null,this.accountName=null,[4,this.refreshMenuItems()];case 1:return e.sent(),t?[3,3]:[4,this.router.navigate([""])];case 2:e.sent(),e.label=3;case 3:return this.loading=!1,this.detectChanges(),[2]}}))}))},t.prototype.logout=function(){return Ie(this,void 0,void 0,(function(){var t,e=this;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.translate.get(["AUTH.LOGOUT.CONFIRM_TITLE","AUTH.LOGOUT.CONFIRM_MESSAGE","COMMON.BTN_CANCEL","AUTH.LOGOUT.BTN_CONFIRM"]).toPromise()];case 1:return t=n.sent(),[4,this.alertController.create({header:t["AUTH.LOGOUT.CONFIRM_TITLE"],message:t["AUTH.LOGOUT.CONFIRM_MESSAGE"],buttons:[{text:t["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary"},{text:t["AUTH.LOGOUT.BTN_CONFIRM"],cssClass:"ion-color-primary",handler:function(){e.accountService.logout(),setTimeout((function(){return e.router.navigateByUrl("/",{replaceUrl:!0})}),100)}}]})];case 2:return[4,n.sent().present()];case 3:return n.sent(),[2]}}))}))},t.prototype.menuClose=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.menu.close("left")]}))}))},t.prototype.openAboutModal=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:bc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.toggleSplitPane=function(t){t&&t.defaultPrevented||(t&&t.preventDefault(),this.splitPaneOpened=!this.splitPaneOpened,this.splitPaneOpened?this.splitPane.when="lg":this.splitPane.when=!1,this.menuService.menuVisible(this.splitPaneOpened),this.detectChanges())},t.prototype.doAction=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:switch(this.menuClose(),t){case"logout":return[3,1];case"about":return[3,3]}return[3,5];case 1:return[4,this.logout()];case 2:case 4:return n.sent(),[3,6];case 3:return[4,this.openAboutModal(e)];case 5:throw new Error("Unknown action: "+t);case 6:return[2]}}))}))},t.prototype.onSwipeRight=function(t){return!(!t||"touch"!==t.pointerType||t.velocity<.4)&&(t.center.x-t.distance<=50?(t.preventDefault(),!1):void 0)},t.prototype.refreshMenuItems=function(){var t=this;this._debug&&console.debug("[menu] Refreshing menu items...");var e=this.items||[],n=this._config&&this._config.getProperty(yl.MENU_ITEMS);if(Pe(n))try{e=(JSON.parse(n)||[]).reduce((function(t,e){var n;if(e.after&&-1!==(n=t.findIndex((function(t){return t.title===e.after}))))return t.slice(0,n+1).concat(e).concat(t.slice(n+1));if(e.before&&-1!==(n=t.findIndex((function(t){return t.title===e.before}))))return t.slice(0,n).concat(e).concat(t.slice(n));return t.concat(e)}),e)}catch(t){console.error("[menu] Invalid value for option '"+yl.MENU_ITEMS.key+"'. Expected an array of menu item",t)}var o={isLogin:this.isLogin,debug:this._debug},r=e.filter((function(e){return yc.checkIfVisible(e,t.accountService,t._config,o)})).map((function(e){if(Pe(e.titleProperty)&&t._config){var n=t._config.properties[e.titleProperty];if(n)return Object.assign(Object.assign({},e),{title:n})}return e}));this.$items.next(r)},t.prototype.detectChanges=function(){this.cd.detectChanges()},t}();zc.decorators=[{type:e.Component,args:[{selector:"app-menu",template:'<ion-split-pane #splitPane contentId="menu-content" (swiperight)="onSwipeRight($event)">\n\n <ion-menu id="menu" menuId="left" contentId="menu-content">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf="isLogin; else notLogin" class="ion-toolbar-top">\n <ion-grid>\n <ion-row>\n <ion-col size="4">\n <button type="button" mat-flat-button\n class="user-avatar" [class.primary]="!accountAvatar"\n [style.background-image]="\'url(\'+(accountAvatar||\'./assets/img/person.png\')+\')\'"\n [routerLink]="[\'/account\']"\n routerDirection="root"\n routerLinkActive="ion-color-primary"\n (click)="menuClose()">\n </button>\n </ion-col>\n <ion-col size="8" class="user-logo">\n <img *ngIf="logo" src="{{logo}}" [title]="\'APP_NAME\'|translate: {appName: appName}" width="108px;"/>\n <span *ngIf="!logo" width="108px;">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class="ion-no-padding">\n\n <button mat-button type="button"\n [routerLink]="[\'/account\']"\n routerDirection="root"\n routerLinkActive="ion-color-primary"\n (click)="menuClose()">\n <ion-label color="primary" class="ion-text-wrap ion-text-start">\n <h3 class="no-margin username">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n \x3c!-- User not logged --\x3e\n <ng-template #notLogin>\n <mat-toolbar class="ion-padding" @fadeInAnimation\n style="height: unset; display: block; margin: auto; text-align: center;">\n <img *ngIf="logo" src="{{logo}}" [title]="\'APP_NAME\'|translate: {appName: appName}" width="150px;">\n <span *ngIf="!logo" style="width: 150px">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]="isLogin">\n\n <ion-list lines="none">\n <ion-menu-toggle auto-hide="false"\n [class.flex-spacer]="item.cssClass == \'flex-spacer\'"\n *ngFor="let item of $items | async">\n\n \x3c!-- link --\x3e\n <ion-item *ngIf="!loading && item.path"\n @fadeInAnimation\n class="{{item.cssClass}} {{item.color}} text-1x"\n tappable\n [routerLink]="item.path"\n routerDirection="root"\n routerLinkActive="selected"\n [routerLinkActiveOptions]="{exact: (item.path === \'/\')}">\n <ion-icon slot="start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n \x3c!-- action --\x3e\n <ion-item *ngIf="!loading && item.action"\n @fadeInAnimation\n class="{{item.cssClass}} {{item.color}} text-1x"\n tappable\n (click)="doAction(item.action, $event)">\n <ion-icon slot="start" *ngIf="item.icon" [name]="item.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="item.matIcon">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n \x3c!-- divider --\x3e\n <ion-item-divider @fadeInAnimation\n class="{{item.cssClass}} {{item.color}}"\n *ngIf="!loading && !item.path && !item.action">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class="hidden-xs hidden-sm">\n <ion-toolbar>\n\n <ion-buttons slot="start">\n <ion-button mat-icon-button color="accent" (click)="openAboutModal($event)">\n <mat-icon slot="icon-only">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)="openAboutModal($event)" color="medium">\n {{\'MENU.FOOTER_VERSION_ABOUT\'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot="end">\n <button mat-icon-button color="accent" (click)="toggleSplitPane($event)"\n class="hidden-xs hidden-sm hidden-md"\n [title]="(splitPaneOpened ? \'COMMON.BTN_HIDE_MENU\' : \'COMMON.BTN_SHOW_MENU\') |translate">\n <mat-icon><span>{{splitPaneOpened ? \'«\' : \'»\'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n',animations:[Zi],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid var(--ion-color-primary);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]}]}],zc.ctorParameters=function(){return[{type:Sl},{type:pl},{type:z.Router},{type:M.MenuController},{type:M.ModalController},{type:M.AlertController},{type:F.TranslateService},{type:xl},{type:e.ChangeDetectorRef},{type:Hc},{type:void 0,decorators:[{type:e.Inject,args:[me]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Wc]}]}]},zc.propDecorators={logo:[{type:e.Input}],appName:[{type:e.Input}],appVersion:[{type:e.Input}],side:[{type:e.Input}],splitPane:[{type:e.ViewChild,args:["splitPane",{static:!0}]}],onResize:[{type:e.HostListener,args:["window:resize",["$event"]]}]};var Kc=function(){};Kc.decorators=[{type:e.NgModule,args:[{imports:[Pl,z.RouterModule,F.TranslateModule],declarations:[zc],exports:[F.TranslateModule,zc]}]}];var Qc=function(){function t(t,n){if(this.table=t,this.cd=n,this.stickyEnd=!1,this.optionsTitle="COMMON.BTN_OPTIONS",this.optionsClick=new e.EventEmitter,this.cancelOrDeleteClick=new e.EventEmitter,this.confirmAndAddClick=new e.EventEmitter,this.backward=new e.EventEmitter,this.forward=new e.EventEmitter,!t)throw new Error("[actions-column] this column component must be inside a MatTable component")}return t.prototype.ngOnInit=function(){this.cd.detectChanges(),this.table.addColumnDef(this.columnDef),this.canCancel=je(this.canCancel,this.cancelOrDeleteClick.observers.length>0),this.canDelete=je(this.canDelete,this.cancelOrDeleteClick.observers.length>0),this.canConfirmAndAdd=je(this.canConfirmAndAdd,this.confirmAndAddClick.observers.length>0),this.canBackward=je(this.canBackward,this.backward.observers.length>0),this.canForward=je(this.canForward,this.forward.observers.length>0),Ae(this.dirtyIcon)&&(this.dirtyIcon="star")},t.prototype.ngOnDestroy=function(){this.table.removeColumnDef(this.columnDef),this.optionsClick.complete(),this.optionsClick.unsubscribe(),this.cancelOrDeleteClick.complete(),this.cancelOrDeleteClick.unsubscribe(),this.confirmAndAddClick.complete(),this.confirmAndAddClick.unsubscribe(),this.backward.complete(),this.backward.unsubscribe(),this.forward.complete(),this.forward.unsubscribe()},t}();Qc.decorators=[{type:e.Component,args:[{selector:"app-actions-column",template:'<ng-container matColumnDef="actions" [stickyEnd]="stickyEnd">\n <th mat-header-cell *matHeaderCellDef [class]="classList" [class.mat-column-sticky]="stickyEnd">\n <button mat-icon-button\n *ngIf="optionsClick.observers | isNotEmptyArray"\n [title]="optionsTitle | translate"\n (click)="optionsClick.emit($event)">\n <mat-icon>more_vert</mat-icon>\n </button>\n <ng-content select="[matHeader]"></ng-content>\n </th>\n <td mat-cell *matCellDef="let row" [class]="classList">\n <ng-container *ngIf="row.editing; else view">\n\n \x3c!-- pending --\x3e\n <ion-spinner *ngIf="row.validator?.pending" name="dots" class="center"></ion-spinner>\n\n \x3c!-- new row --\x3e\n <ng-container *ngIf="row.id === -1; else existingRow">\n\n \x3c!-- delete button --\x3e\n <button mat-icon-button color="light"\n *ngIf="canDelete && row.validator.invalid"\n [title]="\'COMMON.BTN_DELETE\' | translate"\n (click)="cancelOrDeleteClick.emit({event: $event, row: row})">\n <mat-icon>delete_outline</mat-icon>\n </button>\n\n \x3c!-- add button --\x3e\n <button mat-icon-button color="light"\n *ngIf="!canForward && canConfirmAndAdd && row.validator.valid"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="confirmAndAddClick.emit({event: $event, row: row})">\n <mat-icon>add</mat-icon>\n </button>\n\n \x3c!-- next button (invisible - focusable only) --\x3e\n <button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canForward && row.validator.valid"\n (focus)="this.forward.emit({event: $event, row: row})">\n </button>\n </ng-container>\n\n \x3c!-- existing row --\x3e\n <ng-template #existingRow>\n \x3c!-- cancel button --\x3e\n <button mat-icon-button color="light"\n *ngIf="canCancel && row.validator.dirty"\n [title]="\'COMMON.BTN_UNDO\' | translate"\n (click)="cancelOrDeleteClick.emit({event: $event, row: row})">\n <mat-icon>undo</mat-icon>\n </button>\n\n \x3c!-- next button (invisible - focusable only) --\x3e\n <button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canForward && row.validator.valid"\n (focus)="this.forward.emit({event: $event, row: row})">\n </button>\n </ng-template>\n\n </ng-container>\n\n <ng-template #view>\n \x3c!-- dirty icon --\x3e\n <ion-icon *ngIf="dirtyIcon && row.validator?.dirty" [name]="dirtyIcon" color="accent" class="dirty-icon"></ion-icon>\n\n \x3c!-- backward button (invisible - focusable only) --\x3e\n <button mat-icon-button style="color: transparent; width: 0; padding: 0; margin: 0;"\n *ngIf="canBackward"\n (focus)="this.backward.emit({event: $event, row: row})">\n </button>\n </ng-template>\n\n <ng-container *ngTemplateOutlet="cellTemplate; context: { $implicit: row }"></ng-container>\n </td>\n\n <td mat-footer-cell *matFooterCellDef>\n <ng-content select="[matFooter]"></ng-content>\n </td>\n</ng-container>\n'}]}],Qc.ctorParameters=function(){return[{type:l.MatTable},{type:e.ChangeDetectorRef}]},Qc.propDecorators={columnDef:[{type:e.ViewChild,args:[l.MatColumnDef]}],matMenuTrigger:[{type:e.ViewChild,args:[y.MatMenuTrigger]}],stickyEnd:[{type:e.Input}],canCancel:[{type:e.Input}],canDelete:[{type:e.Input}],canBackward:[{type:e.Input}],canForward:[{type:e.Input}],canConfirmAndAdd:[{type:e.Input}],dirtyIcon:[{type:e.Input}],optionsTitle:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],cellTemplate:[{type:e.Input}],optionsClick:[{type:e.Output}],cancelOrDeleteClick:[{type:e.Output}],confirmAndAddClick:[{type:e.Output}],backward:[{type:e.Output}],forward:[{type:e.Output}]};var Yc=function(){function t(){this.icon=null,this.matIcon=null,this.matSvgIcon=null,this.color=null}return Object.defineProperty(t.prototype,"ref",{set:function(t){this.icon=t.icon,this.matIcon=t.matIcon,this.matSvgIcon=t.matSvgIcon},enumerable:!1,configurable:!0}),t}();Yc.decorators=[{type:e.Component,args:[{selector:"app-icon",template:'<ion-icon *ngIf="icon; else matIconTemplate" slot="icon-only"\n [color]="color"\n [name]="icon"\n></ion-icon>\n<ng-template #matIconTemplate>\n <mat-icon [svgIcon]="matSvgIcon"\n [style.color]="\'var(--ion-color-\'+color+\')\'">{{matIcon}}</mat-icon>\n</ng-template>\n\n'}]}],Yc.propDecorators={icon:[{type:e.Input}],matIcon:[{type:e.Input}],matSvgIcon:[{type:e.Input}],color:[{type:e.Input}],ref:[{type:e.Input}]};var Xc=function(){function t(){}return t.forRoot=function(){return console.info("[core] Creating module (root)"),{ngModule:t,providers:[Sl]}},t}();Xc.decorators=[{type:e.NgModule,args:[{imports:[Pl,z.RouterModule,Q.HttpClientModule,Pc,dt.CacheModule,st.IonicStorageModule,Ft.NgxJdenticonModule,Kc],declarations:[Lc,jc,Bc,qc,$c,Gc,Ec,bc,hc,mc,Rc,dc,wc,xc,Nc,ca,Vc,Tc,Qc,kc,Ac,Fc,Mc,Yc],exports:[Pl,z.RouterModule,Pc,Kc,Lc,jc,Bc,qc,$c,Ec,hc,mc,Tc,Qc,kc,Ac,bc,Fc,Mc,Vc,Gc,Yc]}]}];var Jc=function(){function t(t,e,n,o){this.accountService=t,this.modalCtrl=e,this.router=n,this.environment=o,this._debug=!o.production}return t.prototype.canActivate=function(t,e){var n=this;return this.accountService.started?this.accountService.isLogin()?t.data&&t.data.profile&&!this.accountService.hasMinProfile(t.data.profile)?(this._debug&&console.debug("[auth-gard] Not authorized access to /"+t.url.join("/")+". Missing required profile: "+t.data.profile),!1):(this._debug&&console.debug("[auth-gard] Authorized access to /"+t.url.join("/")),!0):(this._debug&&console.debug("[auth-gard] Need authentication for page /"+t.url.join("/")),this.login(t).then((function(o){return o?n.canActivate(t,e):(n._debug&&console.debug("[auth-gard] Authentication cancelled. Could not access to /"+t.url.join("/")),n.router.parseUrl("/home"))}))):this.accountService.ready().then((function(){return n.canActivate(t,e)}))},t.prototype.login=function(t){var e=this;return new Promise((function(n){return Ie(e,void 0,void 0,(function(){var e,o=this;return Oe(this,(function(r){switch(r.label){case 0:return[4,this.modalCtrl.create({component:mc,componentProps:{next:t}})];case 1:return(e=r.sent()).onDidDismiss().then((function(){o.accountService.isLogin()?n(!0):n(!1)})),[2,e.present()]}}))}))}))},t}();Jc.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Jc(jt.ɵɵinject(pl),jt.ɵɵinject(Gt.ModalController),jt.ɵɵinject(zt.Router),jt.ɵɵinject(me))},token:Jc,providedIn:"root"}),Jc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Jc.ctorParameters=function(){return[{type:pl},{type:M.ModalController},{type:z.Router},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var Zc=function(t){function e(e,n,o,r,i){var a=t.call(this,e,Yi)||this;a.graphql=e,a.platform=n,a.dataType=o,a.filterType=r,a.queries=i.queries,a.mutations=i.mutations||{},a.subscriptions=i.subscriptions||{},a.equalsFn=i.equalsFn||function(t,e){return Qi.equals(t,e,"id")},a.isNewFn=i.isNewFn||function(t){return Qi.isNotEmpty(t,"id")},a.defaultSortBy=i.defaultSortBy||"id",a.defaultSortDirection=i.defaultSortDirection||"asc",a.watchQueriesUpdatePolicy=i.watchQueriesUpdatePolicy||"update-cache";var s=new o;return a._typename=s.__typename||"UnknownVO",a._logTypeName=$e(a._typename,"VO"),a._debug=!Yi.production,a}return Ee(e,t),e.prototype.watch=function(t,e){var n=this;this._debug&&console.debug(this._logPrefix+"Watching "+this._logTypeName+" {"+t+"}...");var o=e&&e.query||this.queries.load;return this.graphql.watchQuery({query:o,variables:{id:t},fetchPolicy:e&&e.fetchPolicy||void 0,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"}}).pipe(N.map((function(t){var o=t.data;return e&&!1===e.toEntity?o:o&&n.fromObject(o)})))},e.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return this._debug&&console.debug(this._logPrefix+"Loading "+this._logTypeName+" {"+t+"}..."),n=e&&e.query||this.queries.load,[4,this.graphql.query({query:n,variables:{id:t},fetchPolicy:e&&e.fetchPolicy||void 0,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"}})];case 1:return o=r.sent().data,[2,e&&!1===e.toEntity?o:o&&this.fromObject(o)]}}))}))},e.prototype.watchAll=function(t,e,n,o,r,i){var a=this;r=this.asFilter(r);var s={offset:t||0,size:e||100,sortBy:n||this.defaultSortBy,sortDirection:o||this.defaultSortDirection,filter:r&&r.asPodObject()},l=this._debug&&Date.now();this._debug&&console.debug(this._logPrefix+"Watching "+this._logTypeName+"...",s);var c=(!i||!1!==i.withTotal)&&this.queries.loadAllWithTotal&&!0,u=i&&i.query||(c?this.queries.loadAllWithTotal:this.queries.loadAll);return this.mutableWatchQuery({queryName:c?"LoadAllWithTotal":"LoadAll",query:u,arrayFieldName:"data",totalFieldName:c?"total":void 0,insertFilterFn:r&&r.asFilterFn(),variables:s,error:{code:Na,message:"REFERENTIAL.ERROR.LOAD_DATA_ERROR"},fetchPolicy:i&&i.fetchPolicy||void 0}).pipe(N.map((function(t){var e=t.data,n=t.total,o=i&&!1===i.toEntity?e||[]:(e||[]).map((function(t){return a.fromObject(t)}));return l&&(console.debug(a._logPrefix+(a._logTypeName+" loaded in ")+(Date.now()-l)+"ms",o),l=null),{data:o,total:n}})))},e.prototype.loadAll=function(t,e,n,o,r,i){return Ie(this,void 0,void 0,(function(){var a,s,l,c,u,d,p,h,m,f,g,b=this;return Oe(this,(function(y){switch(y.label){case 0:return a=this._debug&&(!i||!1!==i.debug),r=this.asFilter(r),s={offset:t||0,size:e||100,sortBy:n||"id",sortDirection:o||"asc",filter:r&&r.asPodObject()},l=Date.now(),a&&console.debug(this._logPrefix+"Loading "+this._logTypeName+"...",s),c=(!i||!1!==i.withTotal)&&this.queries.loadAllWithTotal&&!0,u=i&&i.query||(c?this.queries.loadAllWithTotal:this.queries.loadAll),[4,this.graphql.query({query:u,variables:s,error:{code:Na,message:"ERROR.LOAD_DATA_ERROR"},fetchPolicy:i&&i.fetchPolicy||"network-only"})];case 1:return d=y.sent(),p=d.data,h=d.total,m=i&&!1===i.toEntity?p||[]:(p||[]).map((function(t){return b.fromObject(t)})),a&&console.debug(this._logPrefix+(this._logTypeName+" items loaded in ")+(Date.now()-l)+"ms"),f={data:m,total:h},c&&(g=t+m.length)<f.total&&(f.fetchMore=function(){return b.loadAll(g,e,n,o,r,i)}),[2,f]}}))}))},e.prototype.countAll=function(t,e){var n;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:if(this.queries.countAll)return[3,2];if(!this.queries.loadAllWithTotal)throw new Error("Not implemented");return[4,this.loadAll(0,1,null,null,t,{withTotal:!0})];case 1:return[2,(null===(n=o.sent())||void 0===n?void 0:n.total)||0];case 2:return t=this.asFilter(t),[4,this.graphql.query({query:this.queries.countAll,variables:{filter:t&&t.asPodObject()},error:{code:Na,message:"ERROR.COUNT_DATA_ERROR"},fetchPolicy:e&&e.fetchPolicy||"network-only"})];case 3:return[2,o.sent().total]}}))}))},e.prototype.saveAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:if(Fe(t))return[2,t];if(!this.mutations.saveAll){if(!this.mutations.save)throw new Error("Not implemented");return[2,xn((t||[]).map((function(t){return function(){return i.save(t,e)}})))]}return n=!1,o=t.map((function(t){return n=n||i.isNewFn(t),i.fillDefaultProperties(t),i.asObject(t)})),r=Date.now(),this._debug&&console.debug(this._logPrefix+"Saving all "+this._logTypeName+"...",o),[4,this.graphql.mutate({mutation:this.mutations.saveAll,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{data:o},error:{code:Fa,message:"ERROR.SAVE_DATA_ERROR"},update:function(o,a){var s=a.data,l=s&&s.data;l&&(t.forEach((function(t){var e=l.find((function(e){return i.equalsFn(e,t)}));i.copyIdAndUpdateDate(e,t)})),n&&"update-cache"===i.watchQueriesUpdatePolicy&&i.insertIntoMutableCachedQueries(o,{queries:i.getLoadQueries(),data:l})),e&&e.update&&e.update(o,{data:s}),i._debug&&console.debug(i._logTypeName+" saved in "+(Date.now()-r)+"ms",t)}})];case 1:return a.sent(),[2,t]}}))}))},e.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:if(this.mutations.save)return[3,2];if(!this.mutations.saveAll)throw new Error("Not implemented");return[4,this.saveAll([t],e)];case 1:return[2,(n=s.sent())&&n[0]];case 2:return this.fillDefaultProperties(t),o=this.asObject(t),r=this.isNewFn(o),i=Date.now(),this._debug&&console.debug(this._logPrefix+"Saving "+this._logTypeName+"...",o),[4,this.graphql.mutate({mutation:this.mutations.save,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{data:o},error:{code:Fa,message:"ERROR.SAVE_DATA_ERROR"},update:function(n,o){var s=o.data,l=s&&s.data;a.copyIdAndUpdateDate(l,t),r&&"update-cache"===a.watchQueriesUpdatePolicy&&a.insertIntoMutableCachedQueries(n,{queries:a.getLoadQueries(),data:l}),e&&e.update&&e.update(n,{data:s}),a._debug&&console.debug(a._logPrefix+(t.__typename+" saved in ")+(Date.now()-i)+"ms",t)}})];case 3:return s.sent(),[2,t]}}))}))},e.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:if(!this.mutations.deleteAll){if(!this.mutations.delete)throw new Error("Not implemented");return[2,xn((t||[]).map((function(t){return function(){return r.delete(t,e)}})))]}return Fe(t=t&&t.filter((function(t){return Re(t.id)})))?[2]:(n=t.map((function(t){return t.id})),o=Date.now(),this._debug&&console.debug(this._logPrefix+"Deleting "+this._logTypeName+"...",n),[4,this.graphql.mutate({mutation:this.mutations.deleteAll,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{ids:n},error:{code:Ma,message:"ERROR.DELETE_DATA_ERROR"},update:function(t,i){"update-cache"===r.watchQueriesUpdatePolicy&&r.removeFromMutableCachedQueriesByIds(t,{queries:r.getLoadQueries(),ids:n}),e&&e.update&&e.update(t,i),r._debug&&console.debug(r._logPrefix+(r._logTypeName+" deleted in ")+(Date.now()-o)+"ms")}})]);case 1:return i.sent(),[2]}}))}))},e.prototype.delete=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i=this;return Oe(this,(function(a){switch(a.label){case 0:if(this.mutations.delete)return[3,2];if(!this.mutations.deleteAll)throw new Error("Not implemented");return[4,this.deleteAll([t],e)];case 1:return[2,(n=a.sent())&&n[0]];case 2:return!t||Ae(t.id)?[2]:(o=t.id,r=new Date,this._debug&&console.debug(this._logPrefix+"Deleting "+this._logTypeName+" {"+o+"}..."),[4,this.graphql.mutate({mutation:this.mutations.delete,refetchQueries:this.getRefetchQueriesForMutation(e),awaitRefetchQueries:e&&e.awaitRefetchQueries,variables:{id:o},error:{code:Ma,message:"ERROR.DELETE_DATA_ERROR"},update:function(t,n){"update-cache"===i.watchQueriesUpdatePolicy&&i.removeFromMutableCachedQueriesByIds(t,{queries:i.getLoadQueries(),ids:[o]}),e&&e.update&&e.update(t,n),i._debug&&console.debug(i._logPrefix+(i._logTypeName+" deleted in ")+((new Date).getTime()-r.getTime())+"ms")}})]);case 3:return a.sent(),[2]}}))}))},e.prototype.listenChanges=function(t,e){var n=this;if(Ae(t))throw Error("Missing argument 'id' ");if(!this.subscriptions.listenChanges)throw Error("Not implemented!");var o=e&&e.variables||{id:t,interval:e&&e.interval||10};return this._debug&&console.debug(this._logPrefix+"[WS] Listening for changes on "+this._logTypeName+" {"+t+"}..."),this.graphql.subscribe({query:e&&e.query||this.subscriptions.listenChanges,variables:o,error:{code:La,message:"ERROR.SUBSCRIBE_DATA_ERROR"}}).pipe(N.map((function(o){var r=o.data,i=e&&!1===e.toEntity?r:r&&n.fromObject(r);return i&&n._debug&&console.debug(n._logPrefix+"[WS] Received changes on "+n._logTypeName+" {"+t+"}",i),i||console.warn(n._logPrefix+"[WS] Received deletion on "+n._logTypeName+" {"+t+"} - TODO check implementation"),i})))},e.prototype.copyIdAndUpdateDate=function(t,e){t&&Qi.copyIdAndUpdateDate(t,e)},e.prototype.fromObject=function(t){if(!t)return t;var e=new this.dataType;return e.fromObject(t),e},e.prototype.asFilter=function(t){return Ul.fromObject(t,this.filterType)},e.prototype.ngOnStart=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.platform.mobile||(this._mutableWatchQueriesMaxCount=-1),[2]}))}))},e.prototype.fillDefaultProperties=function(t){},e.prototype.asObject=function(t,e){return t.asObject(e)},e.prototype.getRefetchQueriesForMutation=function(t){if(t&&t.refetchQueries)return t.refetchQueries;if("refetch-queries"===this.watchQueriesUpdatePolicy){var e=this.getLoadQueries();if(e.length)return this.findRefetchQueries({queries:e})}},e.prototype.getLoadQueries=function(){return[this.queries.loadAll,this.queries.loadAllWithTotal].filter(Re)},e}(Ls);Zc.decorators=[{type:e.Directive}],Zc.ctorParameters=function(){return[{type:Ns},{type:Sl},{type:Function},{type:Function},{type:void 0}]};var tu=function(){function t(){}return t.waitIdle=function(t){if(!t||!t.dataSource)throw new Error("Invalid table. Missing table or table.dataSource");return t.dataSource.waitIdle()},t.logRowErrors=function(t,e){jo.logFormErrors(t.validator,e)},t}(),eu=function(){},nu=function(t){function e(e,n,o,r){var i=t.call(this,[],e,o,r)||this;return i.dataService=n,i._creating=!1,i._saving=!1,i._useValidator=!1,i._stopWatching$=new D.Subject,i._editingRowCount=0,i.loadingSubject=new D.BehaviorSubject(void 0),i._options=Object.assign({dataServiceOptions:{},debug:r&&!1===r.suppressErrors,keepOriginalDataAfterConfirm:!1},r),i._useValidator=Re(o),i._logTypeName=$e((new e).__typename||"UnknownVO","VO"),i._debug=!0===i._options.debug,i}return Ee(e,t),Object.defineProperty(e.prototype,"serviceOptions",{get:function(){return this._options.dataServiceOptions},set:function(t){this._options.dataServiceOptions=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaded",{get:function(){return!1===this.loadingSubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return!1!==this.loadingSubject.value},enumerable:!1,configurable:!0}),e.prototype.ngOnDestroy=function(){this._stopWatching$.next(),this._stopWatching$.complete(),this._stopWatching$.unsubscribe(),this.loadingSubject.complete(),this.loadingSubject.unsubscribe()},e.prototype.watchAll=function(t,e,n,o,r){var i=this;return this._stopWatching$.next(),this._editingRowCount=0,this.markAsLoading(),this.dataService.watchAll(t,e,n,o,r,this.serviceOptions).pipe(N.takeUntil(this._stopWatching$),N.catchError((function(t){return i.handleError(t,"ERROR.LOAD_DATA_ERROR")})),N.map((function(t){return i._saving?console.info("[table-datasource] Received "+i._logTypeName+" data (from service), but still saving: skip"):i._editingRowCount>0?console.warn("[table-datasource] Received "+i._logTypeName+" data, while "+i._editingRowCount+" rows still editing: skip; Please check save() implementation in the table!"):i.updateDatasource(t.data||[]),t})))},e.prototype.save=function(){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:if(je(this.serviceOptions.readOnly,!1))return console.error("[table-datasource] Enable to save, because serviceOptions.readOnly=true"),[2,!1];if(this._saving)return console.warn("[table-datasource] Trying to save "+this._logTypeName+" rows twice. Skip"),[2,!1];this._saving=!0,this.markAsLoading(),t=je(this.serviceOptions.saveOnlyDirtyRows,!1),s.label=1;case 1:return s.trys.push([1,4,5,6]),this._debug&&console.debug("[table-datasource] Saving "+this._logTypeName+" rows... {onlyDirty: "+t+"}"),[4,this.getRows()];case 2:if(e=s.sent(),(n=e.filter((function(t){return t.editing&&!t.confirmEditCreate()}))).length)throw this._debug&&n.forEach((function(t){return tu.logRowErrors(t,"[table-datasource] "+a._logTypeName+" row #"+t.id)})),{code:Ba,message:"ERROR.TABLE_INVALID_ROW_ERROR"};return this._editingRowCount=0,o=void 0,this._useValidator?(r=[],o=e.map((function(e){var n=new a.dataConstructor;return n.fromObject(e.currentData),t&&e.validator.dirty&&r.push(n),n})),t||(r=o)):(o=e.map((function(t){return t.currentData})),r=o),t&&!r.length?(this._debug&&console.debug("[table-datasource] No "+this._logTypeName+" data to save. Skip"),[2,!1]):(this._debug&&console.debug("[table-datasource] Asking service to save this "+this._logTypeName+" data:",r),[4,this.dataService.saveAll(r,this.serviceOptions)]);case 3:return s.sent(),this._debug&&console.debug("[table-datasource] Saving "+this._logTypeName+" data [OK]"),this.updateDatasource(o,{emitEvent:!1}),[2,!0];case 4:throw i=s.sent(),this._debug&&console.error("[table-datasource] Error while saving: "+i&&i.message||i),i;case 5:return this._saving=!1,this.markAsLoaded(),[7];case 6:return[2]}}))}))},e.prototype.updateDatasource=function(e,n){this._debug&&console.debug("[table-datasource] Updating datasource with data:",e),t.prototype.updateDatasource.call(this,e,n),n&&!1===n.emitEvent||this.markAsLoaded()},e.prototype.createNew=function(t){this.asyncCreateNew(t)},e.prototype.connect=function(e){return t.prototype.connect.call(this,e)},e.prototype.disconnect=function(e){t.prototype.disconnect.call(this,e),this._stopWatching$.next()},e.prototype.waitIdle=function(t){return On(this.loadingSubject.asObservable().pipe(N.debounceTime(t||100)))},e.prototype.confirmCreate=function(e){return!!t.prototype.confirmCreate.call(this,e)&&(e.editing&&e.validator&&(console.warn("[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false"),e.validator.disable({onlySelf:!0,emitEvent:!1})),!0)},e.prototype.confirmEdit=function(e){return!!t.prototype.confirmEdit.call(this,e)&&(e.editing&&e.validator&&(console.warn("[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false"),e.validator.disable({onlySelf:!0,emitEvent:!1})),!0)},e.prototype.startEdit=function(t){this._debug&&console.debug("[table-datasource] Start to edit row",t),t.startEdit(),this._editingRowCount++},e.prototype.cancelOrDelete=function(t){this._debug&&console.debug("[table-datasource] Cancelling or deleting row",t),t.cancelOrDelete(),this._editingRowCount--},e.prototype.handleError=function(t,e){var n=t&&t.message||t;throw console.error("[table-datasource] Service "+this._logTypeName+" sent error: "+n,t),this.markAsLoaded(),new Error(e||n)},e.prototype.handleErrorPromise=function(t){var e=t&&t.message||t;throw console.error("[table-datasource] Service "+this._logTypeName+" sent error: "+e,t),this.markAsLoaded(),t},e.prototype.delete=function(e){var n=this;if(-1===e)return t.prototype.delete.call(this,e);var o=this.getRow(e);o?(this.loadingSubject.next(!0),this.dataService.deleteAll([o.currentData],this.serviceOptions).catch((function(t){return n.handleErrorPromise(t)})).then((function(){setTimeout((function(){n.getRow(e)===o&&t.prototype.delete.call(n,e),n.loadingSubject.next(!1)}),300)}))):console.error("[table-datasource] Row to delete with id="+e+" not found")},e.prototype.deleteAll=function(e){var n=this;this.markAsLoading();var o=e.map((function(t){return t.currentData})),r=e.reduce((function(t,e){return t[e.id]=e,t}),{}),i=this,a=t.prototype.delete;return this.dataService.deleteAll(o,this.serviceOptions).catch((function(t){return n.handleErrorPromise(t)})).then((function(){var t=Object.getOwnPropertyNames(r).reduce((function(t,e){var n=r[e];return i.getRow(+e)===n?t.concat(n):t}),[]).sort((function(t,e){return t.id>e.id?-1:1}));Ne(t)&&(console.warn("[table-datasource] Force deletion of "+t.length+" rows (Is service applying deletion to observable ?)"),t.forEach((function(t){return a.call(i,t.id)}))),n.loadingSubject.next(!1)}))},e.prototype.getRows=function(){return _n(this.connect(null))},e.prototype.asyncCreateNew=function(e){var n=Object.create(null,{createNew:{get:function(){return t.prototype.createNew}}});return Ie(this,void 0,void 0,(function(){var t,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(this._creating)return[2];if(this._creating=!0,n.createNew.call(this,e),!((t=this.getRow(-1))&&this._options&&this._options.onRowCreated))return[3,4];if(!((o=this._options.onRowCreated(t))instanceof Promise))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,o];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),console.error(r&&r.message||r,r),[3,4];case 4:return this._editingRowCount++,this._creating=!1,[2]}}))}))},e.prototype.markAsLoading=function(){!0!==this.loadingSubject.value&&this.loadingSubject.next(!0)},e.prototype.markAsLoaded=function(){!1!==this.loadingSubject.value&&this.loadingSubject.next(!1)},e}(Dt.TableDataSource);nu.decorators=[{type:e.Directive}],nu.ctorParameters=function(){return[{type:Function},{type:void 0},{type:Dt.ValidatorService},{type:eu}]};var ou="displayColumns",ru="sortedColumn",iu="filter",au="pageSize",su=[20,50,100,200,500],lu=["select","id"],cu=["actions"],uu=["id"],du=function(){},pu=function(){function t(t,n,o,r,i,a,s,l,c,u){this.route=t,this.router=n,this.platform=o,this.location=r,this.modalCtrl=i,this.settings=a,this.columns=s,this._dataSource=l,this._filter=c,this._initialized=!1,this._subscription=new D.Subscription,this._cellValueChangesDefs={},this._enabled=!0,this._destroy$=new D.Subject,this.allowRowDetail=!0,this.excludesColumns=[],this.totalRowCount=null,this.readySubject=new D.BehaviorSubject(!1),this.loadingSubject=new D.BehaviorSubject(!0),this.savingSubject=new D.BehaviorSubject(!1),this.dirtySubject=new D.BehaviorSubject(!1),this.errorSubject=new D.BehaviorSubject(void 0),this.isRateLimitReached=!1,this.selection=new Nt.SelectionModel(!0,[]),this.editedRow=void 0,this.i18nColumnPrefix="COMMON.",this.autoLoad=!0,this.focusFirstColumn=!1,this.confirmBeforeDelete=!1,this.confirmBeforeCancel=!1,this.undoableDeletion=!1,this.propagateRowError=!1,this.defaultPageSize=20,this.defaultPageSizeOptions=su,this.onRefresh=new e.EventEmitter,this.onOpenRow=new e.EventEmitter,this.onNewRow=new e.EventEmitter,this.onStartEditingRow=new e.EventEmitter,this.onConfirmEditCreateRow=new e.EventEmitter,this.onCancelOrDeleteRow=new e.EventEmitter,this.onBeforeDeleteRows=Sn(),this.onBeforeCancelRows=Sn(),this.onBeforeSave=Sn(),this.onAfterDeletedRows=new e.EventEmitter,this.onSort=new e.EventEmitter,this.onDirty=new e.EventEmitter,this.onError=new e.EventEmitter,this._paginator=null,this.mobile=this.platform.is("mobile"),this.translate=null==u?void 0:u.get(F.TranslateService),this.formErrorAdapter=null==u?void 0:u.get(lr),this.alertCtrl=null==u?void 0:u.get(M.AlertController),this.toastController=null==u?void 0:u.get(M.ToastController),this._autocompleteConfigHolder=new Pn({getUserAttributes:function(t,e){return a.getFieldDisplayAttributes(t,e)}}),this.autocompleteFields=this._autocompleteConfigHolder.fields}return Object.defineProperty(t.prototype,"error",{get:function(){return this.errorSubject.value},set:function(t){this.setError(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"error$",{get:function(){return this.errorSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading$",{get:function(){return this.loadingSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"saving$",{get:function(){return this.savingSubject.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"firstUserColumn",{get:function(){return this.displayedColumns[lu.length]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastUserColumn",{get:function(){return this.displayedColumns[this.displayedColumns.length-cu.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){return this._dataSource},set:function(t){this.setDatasource(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter},set:function(t){this.setFilter(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this.loading||0===this.totalRowCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.dirtySubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){var t;return!this.editedRow||!this.editedRow.editing||(null===(t=this.editedRow.validator)||void 0===t?void 0:t.valid)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){var t;return!(!this.editedRow||!this.editedRow.editing)&&(null===(t=this.editedRow.validator)||void 0===t?void 0:t.invalid)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){var t;return!(!this.editedRow||!this.editedRow.editing)&&(null===(t=this.editedRow.validator)||void 0===t?void 0:t.pending)},enumerable:!1,configurable:!0}),t.prototype.disable=function(t){this.sort&&(this.sort.disabled=!0),this._enabled=!1},t.prototype.enable=function(t){this.sort&&(this.sort.disabled=!1),this._enabled=!0},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enabled},set:function(t){t!==!this._enabled&&(t?this.disable({emitEvent:!1}):this.enable({emitEvent:!1}))},enumerable:!1,configurable:!0}),t.prototype.markAsDirty=function(t){!0!==this.dirtySubject.value&&(this.dirtySubject.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsPristine=function(t){!1!==this.dirtySubject.value&&(this.dirtySubject.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsUntouched=function(t){var e;(!1!==this.dirtySubject.value||this.editedRow&&this.editedRow.id!==this.previouslyEditedRowId)&&(this.dirtySubject.next(!1),(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&this.dataSource.cancelOrDelete(this.editedRow),this.editedRow=null,t&&!1===t.emitEvent||this.markForCheck()),this.previouslyEditedRowId=void 0},t.prototype.markAsTouched=function(t){var e,n;console.warn("TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0"),(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&(null===(n=this.editedRow.validator)||void 0===n||n.markAllAsTouched(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAllAsTouched=function(t){var e,n;(null===(e=this.editedRow)||void 0===e?void 0:e.editing)&&(null===(n=this.editedRow.validator)||void 0===n||n.markAllAsTouched(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsSaving=function(t){!0!==this.savingSubject.value&&(this.focusColumn=void 0,this.savingSubject.next(!0),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsSaved=function(t){!1!==this.savingSubject.value&&(this.savingSubject.next(!1),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoading=function(t){this.setLoading(!0,t)},t.prototype.markAsLoaded=function(t){this.setLoading(!1,t)},t.prototype.markRowAsDirty=function(t,e){var n;(t=t||this.editedRow)&&(null===(n=t.validator)||void 0===n||n.markAsDirty(e)),this.markAsDirty(e)},t.prototype.markAsReady=function(t){!0!==this.readySubject.value&&(this.readySubject.next(!0),"function"==typeof this.ngOnReady&&this.ngOnReady())},Object.defineProperty(t.prototype,"loading",{get:function(){return this.loadingSubject.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaded",{get:function(){return!this.loadingSubject.value},enumerable:!1,configurable:!0}),t.prototype.enableSort=function(){this.sort&&(this.sort.disabled=!1)},t.prototype.disableSort=function(){this.sort&&(this.sort.disabled=!0)},Object.defineProperty(t.prototype,"pageSize",{get:function(){return this.paginator&&this.paginator.pageSize||this.defaultPageSize||20},set:function(t){this.defaultPageSize=t,this.paginator&&(this.paginator.pageSize=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageOffset",{get:function(){return this.paginator&&this.paginator.pageIndex*this.paginator.pageSize||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortActive",{get:function(){return this.sort&&this.sort.active},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sortDirection",{get:function(){return this.sort&&this.sort.direction&&("desc"===this.sort.direction?"desc":"asc")||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paginator",{get:function(){return this._paginator||this.childPaginator},set:function(t){this._paginator=t},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;if(!this._initialized){if(this._initialized=!0,this.readOnly=je(this.readOnly,!1),this.inlineEdition=!this.readOnly&&je(this.inlineEdition,!1),this.saveBeforeDelete=je(this.saveBeforeDelete,!this.readOnly),this.saveBeforeSort=je(this.saveBeforeSort,!this.readOnly),this.saveBeforeFilter=je(this.saveBeforeFilter,!this.readOnly),this.keepEditedRowOnSave=je(this.keepEditedRowOnSave,this.inlineEdition),this.errorTranslatorOptions=this.errorTranslatorOptions||{separator:", ",controlPathTranslator:this},this.confirmBeforeDelete&&!this.alertCtrl)throw Error("Missing 'alertCtrl' or 'injector' in component's constructor.");this.settingsId=this.settingsId||this.generateTableId(),this.displayedColumns=this.getDisplayColumns();var e=this.getSortedColumn();this.defaultSortBy=e.id,this.defaultSortDirection=e.start,this.defaultPageSize=this.getPageSize(),this.registerSubscription(this.errorSubject.subscribe((function(e){return t.onError.emit(e)}))),this.registerSubscription(this.dirtySubject.subscribe((function(e){return t.onDirty.emit(e)}))),this.registerSubscription(this.onStartEditingRow.pipe(N.filter((function(t){return t.validator&&!0})),N.mergeMap((function(e){return e.validator.valueChanges.pipe(N.takeUntil(D.combineLatest([t.onStartEditingRow,t._destroy$])),N.map((function(){var t;return null===(t=e.validator)||void 0===t?void 0:t.dirty})),N.filter((function(t){return!0===t})),N.first())}))).subscribe((function(){return t.markAsDirty()}))),this.registerSubscription(this.onRefresh.pipe(N.startWith(this.autoLoad?{}:"skip"),N.switchMap((function(e){return t.dirtySubject.next(!1),t.selection.clear(),"skip"===e?D.of(void 0):t._dataSource?(t.debug&&console.debug("[table] Calling dataSource.watchAll()..."),t._dataSource.watchAll(t.pageOffset,t.pageSize,t.sortActive,t.sortDirection,t._filter)):(t.debug&&console.debug("[table] Skipping data load: no dataSource defined"),D.of(void 0))})),N.catchError((function(e){return t.debug&&console.error(e),t.setError(e&&e.message||e),D.of(void 0)}))).subscribe((function(e){return t.updateView(e)}))),this._dataSource&&this.listenDatasourceLoading(this._dataSource)}},t.prototype.ngAfterViewInit=function(){var t=this;this.debug&&(this.table||setTimeout((function(){t.table||console.warn("[table] Missing <mat-table> in the HTML template (after waiting 500ms)! Component: "+t.constructor.name)}),500),this.displayedColumns||console.warn("[table] Missing 'displayedColumns'. Did you call super.ngOnInit() in component "+this.constructor.name+" ?")),D.merge(this.sort&&this.sort.sortChange.pipe(N.mergeMap((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.saveBeforeAction("sort")]}))}))})),N.filter((function(t){return!0===t})),N.tap((function(){var e=[t.sort.active,t.sort.direction||"asc"].join(":");t.settings.savePageSetting(t.settingsId,e,ru)})))||D.EMPTY,this.paginator&&this.paginator.page.pipe(N.mergeMap((function(){return Ie(t,void 0,void 0,(function(){return Oe(this,(function(t){return[2,this.saveBeforeAction("sort")]}))}))})),N.filter((function(t){return!0===t})),N.tap((function(){return t.settings.savePageSetting(t.settingsId,t.paginator.pageSize,au)})))||D.EMPTY).subscribe((function(e){t.onSort.emit(),t.onRefresh.emit(e)})),this.sort&&this.paginator&&this.registerSubscription(this.sort.sortChange.subscribe((function(){return t.paginator.pageIndex=0})))},t.prototype.ngOnDestroy=function(){var t,e=this;this._subscription.unsubscribe(),Object.keys(this._cellValueChangesDefs).forEach((function(t){return e.stopCellValueChanges(t,!0)})),this._cellValueChangesDefs={},this.loadingSubject.unsubscribe(),this.savingSubject.unsubscribe(),this.errorSubject.unsubscribe(),this.dirtySubject.unsubscribe(),this.onRefresh.unsubscribe(),this.onOpenRow.unsubscribe(),this.onNewRow.unsubscribe(),this.onStartEditingRow.unsubscribe(),this.onConfirmEditCreateRow.unsubscribe(),this.onCancelOrDeleteRow.unsubscribe(),this.onBeforeDeleteRows.unsubscribe(),this.onBeforeCancelRows.unsubscribe(),this.onBeforeSave.unsubscribe(),this.onAfterDeletedRows.unsubscribe(),this.onSort.unsubscribe(),this.onDirty.unsubscribe(),this.onError.unsubscribe(),this._destroy$.next(),this._destroy$.unsubscribe(),null===(t=this._dataSource)||void 0===t||t.ngOnDestroy()},t.prototype.updateView=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return t?(t&&t.data?(this.isRateLimitReached=!this.paginator||t.data.length<this.paginator.pageSize,this.visibleRowCount=t.data.length,this.totalRowCount=Re(t.total)?t.total:(this.paginator&&this.paginator.pageIndex*(this.paginator.pageSize||20)||0)+this.visibleRowCount,this.debug&&console.debug("[table] "+t.data.length+" rows loaded")):(this.isRateLimitReached=!0,this.totalRowCount=0,this.visibleRowCount=0),e&&!1===e.emitEvent||(this.markAsUntouched({emitEvent:!1}),this.markAsPristine({emitEvent:!1}),this.markAsLoaded({emitEvent:!1})),this.markForCheck(),[2]):[2]}))}))},t.prototype.setDatasource=function(t){if(this._dataSource)throw new Error("[table] dataSource already set !");t&&this._dataSource!==t&&(this._dataSource=t,this._initialized&&this.listenDatasourceLoading(t))},t.prototype.resetDataSource=function(){var t;this._dataSourceLoadingSubscription&&(this._dataSourceLoadingSubscription.unsubscribe(),this._subscription.remove(this._dataSourceLoadingSubscription)),null===(t=this._dataSource)||void 0===t||t.ngOnDestroy(),this._dataSource=null},t.prototype.addColumnDef=function(t){this.table.addColumnDef(t)},t.prototype.removeColumnDef=function(t){this.table.removeColumnDef(t)},t.prototype.setFilter=function(t,e){var n=this;e=e||{emitEvent:!0},this.saveBeforeFilter&&this.dirty?this.saveBeforeAction("filter").then((function(o){o&&n.applyFilter(t,e)})):this.applyFilter(t,e)},t.prototype.confirmAndAdd=function(t,e){return!!this.confirmEditCreate(t,e)&&this.addRow(t)},t.prototype.confirmAndBackward=function(t,e){var n,o,r=this,i=this.editedRow;return i&&-1===i.id&&(null===(n=i.validator)||void 0===n?void 0:n.invalid)&&!(null===(o=i.validator)||void 0===o?void 0:o.dirty)?(this.deleteNewRow(t,i),this.waitIdle().then((function(){return r.editRowById(t,e.id,{focusColumn:r.lastUserColumn})})),!0):(this.editRow(t,e,{focusColumn:this.lastUserColumn}),!0)},t.prototype.confirmAndForward=function(t,e){return e=e||this.editedRow,!!this.confirmEditCreate(t,e)&&(this.editRowById(t,e.id+1,{focusColumn:this.firstUserColumn}),!0)},t.prototype.editRowById=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o;return Oe(this,(function(r){switch(r.label){case 0:return e<0?[2]:e>=this.visibleRowCount?(this.focusColumn=n&&n.focusColumn||this.firstUserColumn,this.addRow(t),[3,3]):[3,1];case 1:return[4,this.dataSource.getRow(e)];case 2:o=r.sent(),this.editRow(t,o,n),r.label=3;case 3:return[2]}}))}))},t.prototype.confirmEditCreate=function(t,e){var n,o=this;if(!(e=e||this.editedRow)||!e.editing)return!0;if(null==t||t.stopPropagation(),e.confirmEditCreate())return e===this.editedRow&&(this.editedRow=void 0),(null===(n=e.validator)||void 0===n?void 0:n.dirty)&&this.markAsDirty({emitEvent:!1}),this.resetError(),this.onConfirmEditCreateRow.next(e),!0;if(e.validator){if(e.validator.pending)return jo.waitWhilePending(e.validator).then((function(){return o.confirmEditCreate(t,e)})),!1;if(this.debug&&(console.warn("[table] Cannot confirm row, because invalid"),jo.logFormErrors(e.validator,"[table] ")),e.validator.markAllAsTouched(),this.propagateRowError){var r=this.getRowError(e);this.setError(r)}}return!1},t.prototype.cancelOrDelete=function(t,e,n){-1===e.id?this.deleteNewRow(t,e):this.cancelExistingRow(t,e,n)},t.prototype.addRow=function(t,e){return this.debug&&console.debug("[table] Asking for new row..."),!!this._enabled&&(this.inlineEdition?!!this.confirmEditCreate()&&(this.addRowToTable(e),!0):(this.openNewRowDetail(t),!1))},t.prototype.save=function(t){var e,n;return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(t=Object.assign({keepEditing:this.keepEditedRowOnSave},t),this.readOnly)throw{code:Ua,message:"ERROR.TABLE_READ_ONLY"};if(this.resetError(),this.previouslyEditedRowId=t.keepEditing&&(null===(e=this.editedRow)||void 0===e?void 0:e.editing)?this.editedRow.id:void 0,o=Re(this.previouslyEditedRowId)&&this.editedRow.currentData||(null===(n=this.singleSelectedRow)||void 0===n?void 0:n.currentData),!this.confirmEditCreate())throw{code:Ba,message:"ERROR.TABLE_INVALID_ROW_ERROR"};this.markAsSaving(),a.label=1;case 1:return a.trys.push([1,3,4,7]),this.debug&&console.debug("[table] Calling dataSource.save()..."),[4,this._dataSource.save()];case 2:return(r=a.sent())&&this.markAsPristine(),[2,r];case 3:throw i=a.sent(),this.setError(i&&i.message||i),i;case 4:return this.markAsSaved(),Re(this.previouslyEditedRowId)?[4,this.selectRowByIdOrData(this.previouslyEditedRowId,o)]:[3,6];case 5:a.sent(),a.label=6;case 6:return[7];case 7:return[2]}}))}))},t.prototype.cancel=function(t,e){var n=this;if((!e||!1!==e.interactive)&&this.dirty&&(this.confirmBeforeCancel||this.onBeforeCancelRows.observers.length>0))return null==t||t.stopPropagation(),void this.canCancelRows().then((function(t){t&&n.cancel(null,{interactive:!1})}));this.onRefresh.emit()},t.prototype.duplicateRow=function(t,e,n){var o;return Ie(this,void 0,void 0,(function(){var r,i,a;return Oe(this,(function(s){switch(s.label){case 0:return null==t||t.stopPropagation(),(e=e||this.singleSelectedRow)&&this.confirmEditCreate(t,e)?[4,this.addRowToTable(e.id+1)]:[2,!1];case 1:return r=s.sent(),i=Object.assign(Object.assign({},e.currentData),{id:null}),n&&n.skipProperties&&(a=r.currentData,n.skipProperties.forEach((function(t){return i[t]=a[t]}))),r.validator?(r.validator.patchValue(i),r.validator.markAsDirty()):((null===(o=r.currentData)||void 0===o?void 0:o.fromObject)?r.currentData.fromObject(i):r.currentData=i,this.markAsDirty()),this.clickRow(void 0,r),[2]}}))}))},t.prototype.isAllSelected=function(){return this.selection.selected.length===this.totalRowCount||this.selection.selected.length===this.visibleRowCount},t.prototype.masterToggle=function(){return Ie(this,void 0,void 0,(function(){var t=this;return Oe(this,(function(e){switch(e.label){case 0:return this.loading?[2]:this.isAllSelected()?(this.selection.clear(),[3,3]):[3,1];case 1:return[4,this._dataSource.getRows()];case 2:e.sent().forEach((function(e){return t.selection.select(e)})),e.label=3;case 3:return[2]}}))}))},t.prototype.deleteSelection=function(t){return this.deleteRows(t,this.selection.selected)},t.prototype.deleteRow=function(t,e,n){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(o){switch(o.label){case 0:return[4,this.deleteRows(t,[e],n)];case 1:return[2,1===o.sent()]}}))}))},t.prototype.deleteRows=function(t,e,n){return Ie(this,void 0,void 0,(function(){var o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(this.readOnly)throw{code:Ua,message:"ERROR.TABLE_READ_ONLY"};return(null==t?void 0:t.defaultPrevented)?[2,0]:(null==t||t.preventDefault(),this._enabled?this.loading||Fe(e)?[2,0]:[4,this.canDeleteRows(e,n)]:[2,0]);case 1:return a.sent()?this.saveBeforeDelete?(e.filter((function(t){var e;return!(null===(e=t.validator)||void 0===e?void 0:e.valid)})).forEach((function(t){return t.cancelOrDelete()})),[4,this.saveBeforeAction("delete")]):[3,3]:[2,0];case 2:if(!a.sent())return[2];a.label=3;case 3:this.debug&&console.debug("[table] Delete selection..."),o=e.slice().sort((function(t,e){return t.id>e.id?-1:1})),a.label=4;case 4:return a.trys.push([4,6,,7]),r=o.length,[4,this._dataSource.deleteAll(o)];case 5:return a.sent(),this.selection.clear(),this.editedRow=void 0,this.markAsDirty({emitEvent:!1}),this.markForCheck(),this.onAfterDeletedRows.next(o),[2,r];case 6:throw i=a.sent(),this.setError(i&&i.message||i),i;case 7:return[2]}}))}))},t.prototype.selectRowById=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return void 0===t?[2,!1]:[4,this.waitIdle()];case 1:return n.sent(),e=this.dataSource.getRow(t),[2,this.clickRow(null,e)]}}))}))},t.prototype.selectRowByData=function(t){return Ie(this,void 0,void 0,(function(){var e,n=this;return Oe(this,(function(o){switch(o.label){case 0:return void 0===t?[2,Promise.resolve(!1)]:[4,this.waitIdle()];case 1:return o.sent(),[4,this.dataSource.getRows()];case 2:return[2,(e=(o.sent()||[]).find((function(e){return n.equals(e.currentData,t)})))&&this.clickRow(null,e)]}}))}))},t.prototype.clickRow=function(t,e){var n=this;return this.loading?(this.debug&&console.debug("[table] Waiting before apply clickRow() (datasource is busy)..."),this.waitIdle().then((function(){return n.clickRow(t,e)})),!1):!(-1!==e.id&&!e.editing)||!(null==t?void 0:t.defaultPrevented)&&(this.inlineEdition?this.editRow(t,e,{focusColumn:void 0}):(t&&(t.stopPropagation(),t.preventDefault()),this.markAsLoading(),this.openRow(e.currentData.id,e).then((function(){return n.markAsLoaded()})),!0))},t.prototype.moveRow=function(t,e){this.dataSource.move(t,e)},t.prototype.ready=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this.readySubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,On(this.loadingSubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.openSelectColumnsModal=function(t){return Ie(this,void 0,void 0,(function(){var t,e,n,o,r;return Oe(this,(function(i){switch(i.label){case 0:return t=this.getCurrentColumns(),[4,this.modalCtrl.getTop()];case 1:return e=!!i.sent(),[4,this.modalCtrl.create({component:Tc,componentProps:{columns:t},cssClass:e&&"stack-modal"})];case 2:return[4,(n=i.sent()).present()];case 3:return i.sent(),[4,n.onDidDismiss()];case 4:return(o=i.sent().data)?(r=(o||[]).filter((function(t){return!1===t.canHide||t.visible})).map((function(t){return t.name}))||[],this.displayedColumns=lu.concat(r).concat(cu),this.markForCheck(),[4,this.settings.savePageSetting(this.settingsId,r,ou)]):[2];case 5:return i.sent(),[2]}}))}))},t.prototype.trackByFn=function(t,e){return e.id},t.prototype.doRefresh=function(t){var e=this;this.onRefresh.emit(t),(null==t?void 0:t.target)&&t.target.complete&&setTimeout((function(){return Ie(e,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return[4,this.waitIdle()];case 1:return e.sent(),t.target.complete(),[2]}}))}))}))},t.prototype.getCurrentColumns=function(){var t=this,e=this.columns.slice(lu.length).filter((function(e){return-1===t.displayedColumns.indexOf(e)}));return this.displayedColumns.concat(e).filter((function(e){return!lu.includes(e)&&!cu.includes(e)&&!t.excludesColumns.includes(e)})).map((function(e){return{name:e,label:t.getI18nColumnName(e),visible:-1!==t.displayedColumns.indexOf(e),canHide:-1===t.getRequiredColumns().indexOf(e)}}))},t.prototype.escapeEditingRow=function(t,e){(e=e||this.editedRow)&&e.editing&&(t&&(t.preventDefault(),t.stopPropagation()),-1===e.id&&e.validator.invalid?this.deleteNewRow(t,e):this.confirmBeforeCancel?this.cancelExistingRow(t,e,{keepEditing:!1}):this.confirmEditCreate(t,e))},t.prototype.translateControlPath=function(t){var e,n=this.getI18nColumnName(t);return(null===(e=this.translate)||void 0===e?void 0:e.instant(n))||n},t.prototype.editRow=function(t,e,n){return!!this._enabled&&(this.editedRow===e||!(null==t?void 0:t.defaultPrevented)&&(!!this.confirmEditCreate()&&(e.editing||this.loading||(this.focusColumn=n&&n.focusColumn||this.focusColumn,this._dataSource.startEdit(e)),this.editedRow=e,this.onStartEditingRow.emit(e),!0)))},t.prototype.selectRowByIdOrData=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,6,,7]),Re(t)||-1!==t?[4,this.selectRowById(t)]:[3,3];case 2:if(o.sent())return[2,!0];console.warn("[app-table] Save: Cannot reselect row by row.id: ",t),o.label=3;case 3:return e?[4,this.selectRowByData(e)]:[3,5];case 4:if(o.sent())return[2,!0];console.warn("[app-table] Save: Cannot reselect row by data: ",e),o.label=5;case 5:return[2,!1];case 6:return n=o.sent(),console.error(n&&n.message||n),[2,!1];case 7:return[2]}}))}))},Object.defineProperty(t.prototype,"singleSelectedRow",{get:function(){var t;return 1===(null===(t=this.selection.selected)||void 0===t?void 0:t.length)?this.selection.selected[0]:void 0},enumerable:!1,configurable:!0}),t.prototype.canDeleteRows=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:if(!(this.onBeforeDeleteRows.observers.length>0))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Tn(this.onBeforeDeleteRows,"canDelete",{detail:{rows:t}})];case 2:return o.sent()?[3,4]:[2,!1];case 3:if("CANCELLED"===(n=o.sent()))return[2,!1];throw console.error("Error while checking if can delete rows",n),n;case 4:return!this.confirmBeforeDelete||e&&!1===e.interactive?[2,!0]:[2,this.askDeleteConfirmation(null,t)]}}))}))},t.prototype.canCancelRows=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o;return Oe(this,(function(r){switch(r.label){case 0:return(n=t)?[3,2]:[4,this.dataSource.getRows()];case 1:n=r.sent().filter((function(t){var e;return null===(e=t.validator)||void 0===e?void 0:e.dirty})),r.label=2;case 2:if(Fe(t=n))return[2,!0];if(!(this.onBeforeCancelRows.observers.length>0))return[3,6];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,Tn(this.onBeforeCancelRows,"canCancel",{detail:{rows:t}})];case 4:return r.sent()?[3,6]:[2,!1];case 5:if("CANCELLED"===(o=r.sent()))return[2,!1];throw console.error("Error while checking if can cancel rows",o),o;case 6:return!this.confirmBeforeCancel||e&&!1===e.interactive?[2,!0]:[2,this.askCancelConfirmation(null,t)]}}))}))},t.prototype.saveBeforeAction=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:if(!this.dirty)return[2,!0];switch(t){case"delete":e=this.saveBeforeDelete;break;case"filter":e=this.saveBeforeFilter;break;case"sort":e=this.saveBeforeSort;break;default:e=!0}if(n=!0,!e)return[3,4];if(!(this.onBeforeSave.observers.length>0))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Tn(this.onBeforeSave,"beforeSave",{detail:{action:t,valid:this.valid}})];case 2:return o=a.sent(),n=o.confirmed,e=o.save,[3,4];case 3:if("CANCELLED"===(r=a.sent()))return[2,!1];throw console.error("Error while checking if can delete rows",r),r;case 4:return n?e?[4,this.save()]:[3,6]:[3,7];case 5:return i=a.sent(),this.markAsDirty(),[2,i];case 6:return[2,!0];case 7:return[2,!1]}}))}))},t.prototype.openRow=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){switch(n.label){case 0:return this.allowRowDetail?(this.debug&&this.dirty&&console.warn("[table] Opening row details, but table has unsaved changes!"),this.onOpenRow.observers.length?(this.onOpenRow.emit({id:t,row:e}),[2,!0]):Ae(t)?(console.warn("[table] Opening row details, but data has no id!"),[2,!1]):[4,this.router.navigate([t],{relativeTo:this.route,queryParams:{}})]):[3,2];case 1:return[2,n.sent()];case 2:return[2,!1]}}))}))},t.prototype.openNewRowDetail=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.allowRowDetail?this.onNewRow.observers.length?(this.onNewRow.emit(t),[2,!0]):[4,this.router.navigate(["new"],{relativeTo:this.route})]:[2,!1];case 1:return[2,e.sent()]}}))}))},t.prototype.getRequiredColumns=function(){return uu},t.prototype.getUserColumns=function(){return this.settings.getPageSettings(this.settingsId,ou)},t.prototype.getSortedColumn=function(){var t=this.settings.getPageSettings(this.settingsId,ru),e=t&&t.split(":");return e&&2===e.length&&this.columns.includes(e[0])?{id:e[0],start:"desc"===e[1]?"desc":"asc",disableClear:!1}:this.defaultSortBy?{id:this.defaultSortBy,start:this.defaultSortDirection||"asc",disableClear:!1}:{id:"id",start:"asc",disableClear:!1}},t.prototype.getPageSize=function(){return this.settings.getPageSettings(this.settingsId,au)||this.defaultPageSize},t.prototype.getDisplayColumns=function(){var t=this,e=this.getUserColumns();if(!e)return this.columns.filter((function(e){return!t.excludesColumns.includes(e)}));var n=this.columns.filter((function(t){return lu.includes(t)})),o=this.columns.filter((function(t){return cu.includes(t)}));return(e=e.filter((function(e){return!n.includes(e)&&!o.includes(e)&&t.columns.includes(e)}))).push.apply(e,ke(this.getRequiredColumns().filter((function(t){return!n.includes(t)&&!o.includes(t)&&!e.includes(t)})))),n.concat(e).concat(o).filter((function(e){return!t.excludesColumns.includes(e)}))},t.prototype.updateColumns=function(){this.displayedColumns=this.getDisplayColumns(),this.loading||this.markForCheck()},t.prototype.registerSubscription=function(t){this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.registerAutocompleteField=function(t,e){return this._autocompleteConfigHolder.add(t,e)},t.prototype.getI18nColumnName=function(t){return(this.i18nColumnPrefix||"")+Ge(t).toUpperCase()},t.prototype.generateTableId=function(){return this.location.path(!0).replace(/[?].*$/g,"").replace(/\/[\d]+/g,"_id")+"_"+this.constructor.name},t.prototype.addRowToTable=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return this.focusFirstColumn=!0,[4,this._dataSource.asyncCreateNew(t)];case 1:return e.sent(),this.editedRow=this._dataSource.getRow(-1),this.onStartEditingRow.emit(this.editedRow),this.totalRowCount++,this.visibleRowCount++,this.markAsDirty({emitEvent:!1}),this.markForCheck(),[2,this.editedRow]}}))}))},t.prototype.registerCellValueChanges=function(t,e,n){var o=this;e=e||t,n=n||!1;var r=this._cellValueChangesDefs[t];if(r&&(r.formPath!==e||r.emitInitialValue!==n))throw Error("Already register a cell value change for this name, with different 'formPath' or 'emitInitialValue'. Please use same arguments.");return r||(this.debug&&console.debug("[table] New listener {"+t+"} for value changes on path "+e),r={subject:new D.Subject,subscription:null,formPath:e,emitInitialValue:n},this._cellValueChangesDefs[t]=r,this.registerSubscription(this.onStartEditingRow.subscribe((function(e){return o.startCellValueChanges(t,e)})))),r.subject},t.prototype.setShowColumn=function(t,e,n){if(!this.excludesColumns.includes(t)!==e){if(e){var o=this.excludesColumns.findIndex((function(e){return e===t}));o>=0&&this.excludesColumns.splice(o,1)}else this.excludesColumns.push(t);!this.displayedColumns||n&&!1===n.emitEvent||this.updateColumns()}},t.prototype.getShowColumn=function(t){return!this.excludesColumns.includes(t)},t.prototype.startsWithUpperCase=function(t,e){return t&&t.toUpperCase().startsWith(e)},t.prototype.markForCheck=function(){},t.prototype.askDeleteConfirmation=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return this.undoableDeletion?[2,Dl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.DELETE_ROW":"CONFIRM.DELETE_ROWS",this.alertCtrl,this.translate,t)]:[2,Dl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)]}))}))},t.prototype.askCancelConfirmation=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return[2,Dl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.CANCEL_ROW":"CONFIRM.CANCEL_ROWS",this.alertCtrl,this.translate,t)]}))}))},t.prototype.askRestoreConfirmation=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,Dl.askActionConfirmation(this.alertCtrl,this.translate,!1,t)]}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[2,ba.show(this.toastController,this.translate,t)]}))}))},t.prototype.resetError=function(t){this.setError(void 0,t)},t.prototype.getRowError=function(t,e){if((t=t||this.editedRow)&&this.formErrorAdapter)return this.formErrorAdapter.translateErrors(t.validator,Object.assign(Object.assign({},this.errorTranslatorOptions),e))},t.prototype.setError=function(t,e){this.errorSubject.value!==t&&(this.errorSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.equals=function(t,e){return Qi.equals(t,e,"id")},t.prototype.setLoading=function(t,e){this.loadingSubject.value!==t&&(this.loadingSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.deleteNewRow=function(t,e){null==t||t.stopPropagation(),this.selection.clear(),this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),this.resetError(),this.totalRowCount--,this.visibleRowCount--},t.prototype.cancelExistingRow=function(t,e,n){var o,r,i,a=this;if(!(!n||!1!==n.interactive)&&(null===(o=e.validator)||void 0===o?void 0:o.dirty)&&(this.confirmBeforeCancel||this.onBeforeCancelRows.observers.length>0))return t.stopPropagation(),void this.canCancelRows([e],n).then((function(n){n&&a.cancelExistingRow(t,e,{interactive:!1})}));var s=e.editing&&(!n||!1!==n.keepEditing);this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),!0===(null===(r=this.dataSource)||void 0===r?void 0:r.options.keepOriginalDataAfterConfirm)&&(null===(i=e.validator)||void 0===i||i.markAsPristine(),this.checkIfPristine()),s&&this.editRow(void 0,e)},t.prototype.checkIfPristine=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return this.dirty?[4,this._dataSource.getRows()]:[2];case 1:return e=n.sent(),-1===(e||[]).findIndex((function(t){var e;return null===(e=t.validator)||void 0===e?void 0:e.dirty}))&&this.markAsPristine(t),[2]}}))}))},t.prototype.applyFilter=function(t,e){this.debug&&console.debug("[table] Applying filter",t),this._filter=t,e&&e.emitEvent&&(this.paginator&&this.paginator.pageIndex>0&&(this.paginator.pageIndex=0),this.onRefresh.emit())},t.prototype.listenDatasourceLoading=function(t){var e=this;if(!t)throw new Error("[table] dataSource not set !");Re(this._dataSourceLoadingSubscription)&&(this.debug&&console.debug("[table] Many call to listenDatasource(): Cleaning previous subscriptions..."),this._dataSourceLoadingSubscription.unsubscribe(),this._subscription.remove(this._dataSourceLoadingSubscription)),this._dataSourceLoadingSubscription=this._dataSource.loadingSubject.pipe(N.distinctUntilChanged(),N.tap((function(t){return t&&e.setLoading(!0)})),N.debounceTime(250),N.tap((function(t){return!t&&e.setLoading(!1)}))).subscribe(),this._subscription.add(this._dataSourceLoadingSubscription)},t.prototype.startCellValueChanges=function(t,e){var n=this._cellValueChangesDefs[t];if(n){n.subscription?(n.subscription.unsubscribe(),n.subscription=null):this.debug&&console.debug("[table] Start values changes on row path {"+n.formPath+"}");var o=e.validator&&jo.getControlFromPath(e.validator,n.formPath);o?(n.subscription=o.valueChanges.pipe(N.filter((function(){return o.enabled}))).subscribe((function(t){return n.subject.next(t)})),!1!==n.emitInitialValue&&n.subject.next(o.value)):console.warn("[table] Could not listen cell changes: no validator or invalid form path {"+n.formPath+"}")}else console.warn("[table] Listener with name {"+t+"} not registered! Please call registerCellValueChanges() before;")},t.prototype.stopCellValueChanges=function(t,e){var n=this._cellValueChangesDefs[t];n&&(n.subscription&&(this.debug&&console.debug("[table] Stop value changes on row path {"+n.formPath+"}"),n.subscription.unsubscribe(),n.subscription=null),e&&n.subject&&(n.subject.complete(),n.subject.unsubscribe()))},t}();pu.decorators=[{type:e.Directive}],pu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:void 0},{type:n.Location},{type:M.ModalController},{type:ga},{type:Array},{type:nu},{type:void 0},{type:e.Injector}]},pu.propDecorators={settingsId:[{type:e.Input}],debug:[{type:e.Input}],i18nColumnPrefix:[{type:e.Input}],i18nColumnSuffix:[{type:e.Input}],autoLoad:[{type:e.Input}],readOnly:[{type:e.Input}],inlineEdition:[{type:e.Input}],focusFirstColumn:[{type:e.Input}],confirmBeforeDelete:[{type:e.Input}],confirmBeforeCancel:[{type:e.Input}],undoableDeletion:[{type:e.Input}],saveBeforeDelete:[{type:e.Input}],keepEditedRowOnSave:[{type:e.Input}],saveBeforeSort:[{type:e.Input}],saveBeforeFilter:[{type:e.Input}],propagateRowError:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}],defaultPageSize:[{type:e.Input}],defaultPageSizeOptions:[{type:e.Input}],focusColumn:[{type:e.Input}],dataSource:[{type:e.Input}],filter:[{type:e.Input}],onRefresh:[{type:e.Output}],onOpenRow:[{type:e.Output}],onNewRow:[{type:e.Output}],onStartEditingRow:[{type:e.Output}],onConfirmEditCreateRow:[{type:e.Output}],onCancelOrDeleteRow:[{type:e.Output}],onBeforeDeleteRows:[{type:e.Output}],onBeforeCancelRows:[{type:e.Output}],onBeforeSave:[{type:e.Output}],onAfterDeletedRows:[{type:e.Output}],onSort:[{type:e.Output}],onDirty:[{type:e.Output}],onError:[{type:e.Output}],disabled:[{type:e.Input}],paginator:[{type:e.Input}],table:[{type:e.ViewChild,args:[l.MatTable,{static:!1}]}],childPaginator:[{type:e.ViewChild,args:[u.MatPaginator,{static:!1}]}],sort:[{type:e.ViewChild,args:[c.MatSort,{static:!1}]}]};var hu=function(){},mu=function(){function t(t,e,n,o){this.route=t,this.router=e,this.alertCtrl=n,this.translate=o,this._subscription=new D.Subscription,this._enabled=!1,this._dirty=!1,this._loading=!0,this._$ready=new D.BehaviorSubject(!1),this.debug=!1,this.submitted=!1,this.toolbar=null,this.formButtonsBar=null}return Object.defineProperty(t.prototype,"tables",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof pu}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forms",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof pc}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){var t;return this._dirty||-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.dirty})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return!this._children||-1===this._children.findIndex((function(t){return t.enabled&&!t.valid}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invalid",{get:function(){var t;return-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.invalid})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pending",{get:function(){var t;return-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.pending})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loading",{get:function(){var t;return this._loading||-1!==(null===(t=this._children)||void 0===t?void 0:t.findIndex((function(t){return t.enabled&&t.loading})))||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return!this._enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.formButtonsBar&&this.registerSubscription(this.formButtonsBar.onBack.subscribe((function(e){return t.goBack(e)})))},t.prototype.ngAfterViewInit=function(){},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe()},t.prototype.addChildForm=function(t){if(!t)throw new Error("Trying to register an undefined child form");return this._children=this._children||[],"function"==typeof t?this._children.push(new Lo(t)):this._children.push(t),this},t.prototype.addChildForms=function(t){var e=this;return(t||[]).forEach((function(t){return e.addChildForm(t)})),this},t.prototype.disable=function(t){var e;this._enabled=!1,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.disable(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.enable=function(t){var e;this._enabled=!0,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.enable(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsPristine=function(t){var e;this.error=null,this.submitted=!1,this._dirty=!1,null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsPristine(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsUntouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(t){return t.markAsUntouched()})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsTouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsTouched(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAllAsTouched(t)})),this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsDirty=function(t){this._dirty=!0,this.loading||t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAsLoading=function(t){this._loading||(this._loading=!0,t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsLoaded=function(t){var e;this._loading&&(this._loading=!1,t&&!0===t.onlySelf||null===(e=this.forms)||void 0===e||e.forEach((function(e){return e.markAsLoaded(t)})),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.markAsReady=function(t){var e;null===(e=this._children)||void 0===e||e.forEach((function(e){return e.markAsReady(t)})),this._$ready.next(!0)},t.prototype.ready=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return[4,In(this._$ready)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return jo.waitIdle(this,t)},t.prototype.cancel=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.isNewData?[4,this.unload()]:[3,2];case 1:return t.sent(),[3,4];case 2:return this.dirty?[4,this.reload()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},t.prototype.unload=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return console.debug("[tab-page] Unloading data..."),this.markAsLoading(),this._children.forEach((function(e){e instanceof pc?e.reset(null,t):e instanceof pu&&e.dataSource.disconnect()})),[2]}))}))},t.prototype.reloadWithConfirmation=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o;return Oe(this,(function(r){switch(r.label){case 0:return e=this.dirty,t||!e?[3,4]:(n=this.translate.instant(["COMMON.BTN_ABORT_CHANGES","COMMON.BTN_CANCEL","CONFIRM.CANCEL_CHANGES","CONFIRM.ALERT_HEADER"]),[4,this.alertCtrl.create({header:n["CONFIRM.ALERT_HEADER"],message:n["CONFIRM.CANCEL_CHANGES"],buttons:[{text:n["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){t=!0}},{text:n["COMMON.BTN_CANCEL"],role:"cancel",handler:function(){}}]})]);case 1:return[4,(o=r.sent()).present()];case 2:return r.sent(),[4,o.onDidDismiss()];case 3:r.sent(),r.label=4;case 4:return!t&&e?[3,6]:(this.scrollToTop(),this.disable(),[4,this.reload()]);case 5:return[2,r.sent()];case 6:return[2]}}))}))},t.prototype.goBack=function(t){var e;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return(null===(e=this.toolbar)||void 0===e?void 0:e.canGoBack)?[2,this.toolbar.goBack()]:[2,this.router.navigateByUrl("/")]}))}))},t.prototype.logFormErrors=function(){var t,e=this;this.debug&&console.debug("[app-tab-editor] Page not valid. Checking where (forms, tables)..."),null===(t=this._children)||void 0===t||t.forEach((function(t){return e.logChildrenFormErrors(t)}))},t.prototype.scrollToTop=function(t){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){return t=Be(t,500),this.content?[2,this.content.scrollToTop(t)]:(console.warn("[tab-editor] Cannot scroll to top. (no 'ion-content' tag found "+this.constructor.name),e=window.setInterval((function(){var t=window.pageYOffset;t>0?window.scrollTo(0,t-20):window.clearInterval(e)}),16),[2])}))}))},t.prototype.registerSubscription=function(t){this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.saveIfDirtyAndConfirm=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return this.dirty?(n=!1,o=!1,r=this.translate.instant(["COMMON.BTN_SAVE","COMMON.BTN_CANCEL","COMMON.BTN_ABORT_CHANGES","CONFIRM.SAVE","CONFIRM.ALERT_HEADER"]),[4,this.alertCtrl.create({header:r["CONFIRM.ALERT_HEADER"],message:r["CONFIRM.SAVE"],buttons:[{text:r["COMMON.BTN_CANCEL"],role:"cancel",cssClass:"secondary",handler:function(){o=!0}},{text:r["COMMON.BTN_ABORT_CHANGES"],cssClass:"secondary",handler:function(){}},{text:r["COMMON.BTN_SAVE"],handler:function(){n=!0}}]})]):[2,!0];case 1:return[4,(i=a.sent()).present()];case 2:return a.sent(),[4,i.onDidDismiss()];case 3:return a.sent(),n?[4,this.save(t,e)]:[2,!o];case 4:return[2,a.sent()]}}))}))},t.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,ba.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},t.prototype.logChildrenFormErrors=function(e,n,o){var r=this;if(n=n||"[app-tab-editor] ",e instanceof t)e.logFormErrors();else if(e instanceof P.AbstractControl)jo.logFormErrors(e,n,o);else if(e instanceof Lo)e.empty||e.valid||e.waitDelegate({timeout:1e3}).then((function(t){return r.logChildrenFormErrors(t,n,"provider")}));else if(e instanceof pu){if(e.invalid&&e.editedRow&&e.editedRow.validator){var i=e.constructor.name.toLowerCase();jo.logFormErrors(e.editedRow.validator,n,i)}}else if(e instanceof pc){if(!e.empty&&!e.valid)if(e.pending){var a=e.constructor.name.toLowerCase();console.warn(n+" -> "+a+": waiting while pending..."),jo.waitWhilePending(e,{timeout:1e3}).then((function(){return r.logChildrenFormErrors(e.form,n,a)}))}else jo.logFormErrors(e.form,n)}else console.warn(n+" Unknown children sub-form: ",e)},t.prototype.markForCheck=function(){},t}();mu.decorators=[{type:e.Directive}],mu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:M.AlertController},{type:F.TranslateService}]},mu.propDecorators={toolbar:[{type:e.ViewChild,args:[mi]}],formButtonsBar:[{type:e.ViewChild,args:[Sc,{static:!0}]}],content:[{type:e.ViewChild,args:[M.IonContent,{static:!0}]}]};var fu=function(t){function n(n,o,r,i,a){var s=t.call(this,n,o,r,i)||this;return s.route=n,s.router=o,s.alertCtrl=r,s.translate=i,s._selectedTabIndex=0,s.selectedTabIndexChange=new e.EventEmitter,a=Object.assign({tabCount:1,enableSwipe:!0,tabGroupAnimationDuration:"200ms"},a),s.tabCount=a.tabCount,s.enableSwipe=a.enableSwipe,s.tabGroupAnimationDuration=a.tabGroupAnimationDuration,s}return Ee(n,t),Object.defineProperty(n.prototype,"selectedTabIndex",{get:function(){return this._selectedTabIndex},set:function(t){this.setSelectedTabIndex(t)},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var e=this;t.prototype.ngOnInit.call(this),this.queryTabIndexParamName=this.queryTabIndexParamName||"tab",this.tabGroup&&this.registerSubscription(this.route.queryParams.subscribe((function(t){if(e.queryParams=Object.assign({},t),e.tabCount>1&&e.queryTabIndexParamName){var n=t[e.queryTabIndexParamName];e.queryParams[e.queryTabIndexParamName]=n&&parseInt(n)||void 0,Re(e.queryParams[e.queryTabIndexParamName])&&(e.selectedTabIndex=e.queryParams[e.queryTabIndexParamName])}setTimeout((function(){return e.tabGroup.realignInkBar()}),500)})))},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.selectedTabIndexChange.complete()},n.prototype.setSelectedTabIndex=function(t,e){var n=this;t<0?t=0:t>this.tabCount-1&&(console.warn("[tab-editor] Invalid tab index "+t+". Max value is "+(this.tabCount-1)),t=this._selectedTabIndex),this._selectedTabIndex=t,this.selectedTabIndexChange.next(t),!this.tabGroup||e&&!1===e.realignInkBar?e&&!1===e.emitEvent||this.markForCheck():(this.tabGroup.selectedIndex=t,this.markForCheck(),setTimeout((function(){return n.tabGroup.realignInkBar()}),200))},n.prototype.onTabChange=function(t,e){return!(e=e||this.queryTabIndexParamName)||(!this.queryParams||+this.queryParams[e]!==t.index)&&(this.queryParams=this.queryParams||{},this.queryParams[e]=t.index,"tab"===e&&Re(this.queryParams.subtab)&&delete this.queryParams.subtab,this.router.navigate(["."],{relativeTo:this.route,queryParams:this.queryParams,replaceUrl:!0}),!0)},n.prototype.onSwipeTab=function(t){var e=this;if(!this.enableSwipe||!t||t.defaultPrevented||t.srcEvent&&t.srcEvent.defaultPrevented||"touch"!==t.pointerType)return!1;var n=this.selectedTabIndex;switch(t.type){case"swipeleft":var o=n>=this.tabCount-1;n=o?0:n+1;break;case"swiperight":n=n<=0?this.tabCount:n-1;break;default:return console.error("[tab-page] Unknown swipe action: "+t.type),!1}return setTimeout((function(){e.selectedTabIndex=n,e.markForCheck()})),!0},n.prototype.onSubTabChange=function(t){this.onTabChange(t,"subtab")},n.prototype.unload=function(e){var n=Object.create(null,{unload:{get:function(){return t.prototype.unload}}});return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.selectedTabIndex=0,[4,n.unload.call(this,e)];case 1:return t.sent(),[2]}}))}))},n}(mu);fu.decorators=[{type:e.Directive}],fu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:M.AlertController},{type:F.TranslateService},{type:hu,decorators:[{type:e.Optional}]}]},fu.propDecorators={queryTabIndexParamName:[{type:e.Input}],selectedTabIndex:[{type:e.Input}],selectedTabIndexChange:[{type:e.Output}],tabGroup:[{type:e.ViewChild,args:["tabGroup",{static:!0}]}]};var gu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ee(e,t),e}(hu),bu=function(t){function n(n,o,r,i){var a=t.call(this,n.get(z.ActivatedRoute),n.get(z.Router),n.get(M.AlertController),n.get(F.TranslateService),i)||this;return a.dataType=o,a.dataService=r,a.saving=!1,a.hasRemoteListener=!1,a.$title=new D.Subject,a.onUpdateView=new e.EventEmitter,i=Object.assign({enableListenChanges:!0===n.get(me).listenRemoteChanges,pathIdAttribute:"id",autoLoad:!0,autoUpdateRoute:!0,i18nPrefix:""},i),a.settings=n.get(ga),a.formErrorAdapter=n.get(lr),a.cd=n.get(e.ChangeDetectorRef),a.dateFormat=n.get(Mn),a.toastController=n.get(M.ToastController),a._enableListenChanges=i.enableListenChanges,a._pathIdAttribute=i.pathIdAttribute,a._autoLoad=i.autoLoad,a._autoLoadDelay=i.autoLoadDelay,a._autoUpdateRoute=i.autoUpdateRoute,a._autoOpenNextTab=i.autoOpenNextTab,a.i18nContext={prefix:i.i18nPrefix,suffix:""},a}return Ee(n,t),Object.defineProperty(n.prototype,"usageMode",{get:function(){return this._usageMode},set:function(t){this._usageMode!==t&&(this._usageMode=t,this.markForCheck())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isOnFieldMode",{get:function(){return this.settings.isOnFieldMode(this._usageMode)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isNewData",{get:function(){var t;return Ae(null===(t=this.data)||void 0===t?void 0:t.id)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"loading",{get:function(){return this._loading},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"service",{get:function(){return this.dataService},enumerable:!1,configurable:!0}),n.prototype.markAsSaving=function(t){this.saving||(this.saving=!0,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.markAsSaved=function(t){this.saving&&(this.saving=!1,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.ngOnInit=function(){t.prototype.ngOnInit.call(this),this._autoOpenNextTab=je(this._autoOpenNextTab,!this.isOnFieldMode),this.historyIcon=this.historyIcon||{icon:"list"},this.registerForms(),this.disable()},n.prototype.ngAfterViewInit=function(){var e=this;t.prototype.ngAfterViewInit.call(this),this._autoLoad&&setTimeout((function(){return e.loadFromRoute()}),this._autoLoadDelay)},n.prototype.ngOnDestroy=function(){t.prototype.ngOnDestroy.call(this),this.$title.complete(),this.$title.unsubscribe(),this.onUpdateView.complete(),this.onUpdateView.unsubscribe()},n.prototype.loadFromRoute=function(){var t=this.route.snapshot;if(!t||Te(this._pathIdAttribute))throw new Error("Unable to load from route: missing 'route' or 'options.pathIdAttribute'.");var e=t.params[this._pathIdAttribute];return Ae(e)||"new"===e?this.load(void 0,t.params):(Ye(e)&&(e=parseInt(e)),this.load(e,t.params))},n.prototype.load=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r;return Oe(this,(function(i){switch(i.label){case 0:if(!this.dataService)throw new Error("Cannot load data: missing 'dataService'!");if(this.error=null,!Ae(t))return[3,7];i.label=1;case 1:return i.trys.push([1,4,5,6]),o=new this.dataType,this._usageMode=this.computeUsageMode(o),[4,this.onNewEntity(o,e)];case 2:return i.sent(),[4,this.updateView(o,Object.assign({openTabIndex:0},e))];case 3:return i.sent(),[3,6];case 4:return n=i.sent(),this.setError(n),this.selectedTabIndex=0,[3,6];case 5:return this.markAsLoaded(),[7];case 6:return[3,13];case 7:return i.trys.push([7,11,12,13]),[4,this.dataService.load(t,e)];case 8:if(!(o=i.sent()))throw{code:ja,message:"ERROR.DATA_NO_FOUND"};return this._usageMode=this.computeUsageMode(o),[4,this.onEntityLoaded(o,e)];case 9:return i.sent(),[4,this.updateView(o,e)];case 10:return i.sent(),this.startListenRemoteChanges(),[3,13];case 11:return r=i.sent(),this.setError(r),this.selectedTabIndex=0,[3,13];case 12:return this.markAsLoaded(),[7];case 13:return[2]}}))}))},n.prototype.startListenRemoteChanges=function(){var t=this;this.hasRemoteListener||!this._enableListenChanges||this.isNewData||(this.hasRemoteListener=!0,this.registerSubscription(this.dataService.listenChanges(this.data.id).pipe(N.filter(Re)).subscribe((function(e){e.updateDate&&e.updateDate.isAfter(t.data.updateDate)&&(t.dirty?t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"}, but page is dirty: skip reloading."):(t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"} : reloading page..."),t.updateView(e)))})).add((function(){return t.hasRemoteListener=!1}))))},n.prototype.updateView=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return n=Re(t.id)&&void 0!==this.previousDataId&&this.previousDataId!==t.id,e=Object.assign({updateRoute:this._autoUpdateRoute&&n&&!this.loading,openTabIndex:this._autoOpenNextTab&&n&&Ae(this.previousDataId)&&this.computeNextTabIndex()},e),this.data=t,this.previousDataId=t.id||null,[4,this.ready()];case 1:return i.sent(),(o=this.setValue(t))?[4,o]:[3,3];case 2:i.sent(),i.label=3;case 3:return e&&!1===e.emitEvent||(this.markAsPristine(),this.markAsUntouched(),this.updateViewState(t),!0===e.updateRoute?this.updateTabAndRoute(t,e).then((function(){return r.updateTitle(t)})):(this.updateTabIndex(e.openTabIndex),this.updateTitle(t)),this.onUpdateView.emit(t)),[2]}}))}))},n.prototype.updateViewState=function(t,e){this.isNewData||this.canUserWrite(t)?this.enable(e):(this.disable(e),this.tables.forEach((function(t){return t.enableSort()})))},n.prototype.updateTabAndRoute=function(t,e){return Ie(this,void 0,void 0,(function(){var n;return Oe(this,(function(o){switch(o.label){case 0:return this.queryParams=this.queryParams||{},this.updateTabIndex(e&&e.openTabIndex),this.queryParams.tab=this.selectedTabIndex,(n={})[this._pathIdAttribute]=t&&Re(t.id)?t.id:"new",t&&Re(t.id)?[4,this.router.navigate(["."],{relativeTo:this.route,queryParams:Object.assign(Object.assign({},this.queryParams),n)})]:[3,2];case 1:return o.sent(),[3,4];case 2:return[4,this.router.navigate(["..","new"],{relativeTo:this.route,queryParams:Object.assign(Object.assign({},this.queryParams),n)})];case 3:o.sent(),o.label=4;case 4:return[4,this.updateRoute(t,this.queryParams)];case 5:return o.sent(),[2]}}))}))},n.prototype.updateTabIndex=function(t){Re(t)&&t>this.selectedTabIndex&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.saveAndClose=function(t,e){return Ie(this,void 0,void 0,(function(){var e;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.save(t)];case 1:return(e=n.sent())?[4,this.close(t)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2,e]}}))}))},n.prototype.close=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){if(t){if(t.defaultPrevented)return[2];t.preventDefault(),t.stopPropagation()}return[2,this.goBack()]}))}))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var t,n,o;return Oe(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?(console.debug("[data-editor] Skip save: editor is busy (loading or saving)"),[2,!1]):this.dirty?[4,this.waitWhilePending()]:(console.debug("[data-editor] Skip save: editor not dirty"),[2,!0]);case 1:if(r.sent(),this.invalid)return this.markAllAsTouched(),this.logFormErrors(),this.openFirstInvalidTab(),this.submitted=!0,[2,!1];this.markAsSaving(),this.error=void 0,this.debug&&console.debug("[data-editor] Saving data..."),r.label=2;case 2:return r.trys.push([2,7,8,9]),[4,this.getValue()];case 3:return t=r.sent(),this.disable(),[4,this.dataService.save(t,e)];case 4:return n=r.sent(),[4,this.onEntitySaved(n)];case 5:return r.sent(),[4,this.updateView(n,e)];case 6:return r.sent(),this.hasRemoteListener||this.startListenRemoteChanges(),this.submitted=!1,[2,!0];case 7:return o=r.sent(),this.submitted=!0,this.setError(o),this.selectedTabIndex=0,this.scrollToTop(),this.markAsDirty(),this.enable(),o.code===Ya&&Re(this.data.id)&&this.dataService.load(this.data.id,{fetchPolicy:"network-only"}).then((function(){console.debug("[data-editor] Data cache reloaded. User can reload page")})),[2,!1];case 8:return this.markAsSaved(),[7];case 9:return[2]}}))}))},n.prototype.saveAndGetDataIfValid=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.valid?[3,2]:[4,jo.waitWhilePending(this)];case 1:if(t.sent(),this.invalid)return this.openFirstInvalidTab(),[2,void 0];t.label=2;case 2:return this.dirty?[4,this.save(new Event("save"))]:[3,4];case 3:if(!t.sent())return[2,void 0];t.label=4;case 4:return[2,this.data]}}))}))},n.prototype.delete=function(t){return Ie(this,void 0,void 0,(function(){var t,e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?[2,!1]:[4,Dl.askDeleteConfirmation(this.alertCtrl,this.translate)];case 1:if(!r.sent())return[2];console.debug("[data-editor] Asking to delete..."),this.markAsSaving(),this.error=void 0,r.label=2;case 2:return r.trys.push([2,7,,8]),[4,this.getValue()];case 3:return t=r.sent(),e=this.isNewData,this.disable(),e?[3,5]:[4,this.dataService.delete(t)];case 4:r.sent(),r.label=5;case 5:return[4,this.onEntityDeleted(t)];case 6:return r.sent(),this.removePageHistory(),[3,8];case 7:return n=r.sent(),this.submitted=!0,this.setError(n),this.selectedTabIndex=0,this.markAsSaved(),this.enable(),[2,!1];case 8:return[4,setTimeout((function(){return o.goBack()}),500)];case 9:return r.sent(),[2,!0]}}))}))},n.prototype.reload=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return this.markAsLoading(),[4,this.load(this.data&&this.data.id)];case 1:return t.sent(),[2]}}))}))},n.prototype.goBack=function(t){var e;return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return(null===(e=this.toolbar)||void 0===e?void 0:e.canGoBack)?[2,this.toolbar.goBack()]:this.defaultBackHref?[2,this.router.navigateByUrl(this.defaultBackHref)]:[2,this.router.navigateByUrl("/")]}))}))},n.prototype.setError=function(t){console.error("[entity-editor] Error: "+t&&t.message||"",t);var e=t&&t.message&&this.translate.instant(t.message)||t,n=t&&t.details&&(t.details.message||t.details)||void 0;n&&(e+='<br/><small class="hidden-xs hidden-sm" title="'+n+'">',e+=n.length<70?n:n.substring(0,67)+"...",e+="</small>"),this.error=e},n.prototype.computeNextTabIndex=function(){var t=this.selectedTabIndex+1;return t<this.tabCount?t:void 0},n.prototype.unload=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return this.form.reset(),this.registerForms(),this._dirty=!1,this.data=null,this.saving=!1,[2]}))}))},n.prototype.onBeforeEntityLoad=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onNewEntity=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntityLoaded=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntitySaved=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.onEntityDeleted=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){return[2]}))}))},n.prototype.computeUsageMode=function(t){return this.settings.isUsageMode("FIELD")?"FIELD":"DESK"},n.prototype.waitWhilePending=function(t){return jo.waitWhilePending(this,t)},n.prototype.getValue=function(){return Ie(this,void 0,void 0,(function(){var t,e;return Oe(this,(function(n){switch(n.label){case 0:return[4,this.getJsonValueToSave()];case 1:return t=n.sent(),(e=new this.dataType).fromObject(t),[2,e]}}))}))},n.prototype.getJsonValueToSave=function(){return Promise.resolve(this.form.value)},n.prototype.updateTitle=function(t){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return t=t||this.data,[4,this.computeTitle(t)];case 1:return e=o.sent(),this.$title.next(e),this.isNewData?[3,3]:[4,this.computePageHistory(e)];case 2:return n=o.sent(),[2,this.addToPageHistory(n)];case 3:return[2]}}))}))},n.prototype.addToPageHistory=function(t,e){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(n){return t?[2,this.settings.addToPageHistory(t,Object.assign({removePathQueryParams:!0,removeTitleSmallTag:!0,emitEvent:!1},e))]:[2]}))}))},n.prototype.computePageHistory=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,{title:t,path:this.router.url}]}))}))},n.prototype.removePageHistory=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return[2,this.settings.removePageHistory(this.router.url,t)]}))}))},n.prototype.computePageUrl=function(t){var e=this.getParentPageUrl();return e&&e+"/"+t},n.prototype.getParentPageUrl=function(t){var e=this.defaultBackHref;return!0!==t&&e&&-1!==e.indexOf("?")&&(e=e.substr(0,e.indexOf("?"))),e},n.prototype.markForCheck=function(){this.cd.markForCheck()},n.prototype.openFirstInvalidTab=function(){var t=this.getFirstInvalidTabIndex();-1!==t&&this.selectedTabIndex!==t&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.updateRoute=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){switch(o.label){case 0:return e=this.computePageUrl(Re(t.id)?t.id:"new"),Ne(n=e&&"string"==typeof e?e.split("/"):e)?[4,this.router.navigate(n,{replaceUrl:!0,queryParams:this.queryParams})]:[3,2];case 1:return[2,o.sent()];case 2:console.warn("Skip page route update. Invalid page path: ",e),o.label=3;case 3:return[2]}}))}))},n}(fu);bu.decorators=[{type:e.Directive}],bu.ctorParameters=function(){return[{type:e.Injector},{type:Function},{type:void 0},{type:gu,decorators:[{type:e.Optional}]}]};var yu=function(t){function e(e,o,r,i,a,s,l){var c=t.call(this,e.get(z.ActivatedRoute),e.get(z.Router),e.get(M.Platform),e.get(n.Location),e.get(M.ModalController),e.get(ga),o,new nu(r,i,a,s),l,e)||this;return c.injector=e,c.columns=o,c.dataType=r,c.memoryDataService=i,c.validatorService=a,c.canEdit=!1,c.canDelete=!1,c.autoLoad=!1,c}return Ee(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.memoryDataService.value},set:function(t){this.setValue(t)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){t.prototype.ngOnInit.call(this)},e.prototype.setValue=function(t,e){this.error&&(this.setError(null),this.markForCheck()),this.memoryDataService.value=t,e&&!1===e.emitEvent||this.onRefresh.emit()},e.prototype.equals=function(t,e){return this.memoryDataService.equals(t,e)},e}(pu);yu.decorators=[{type:e.Directive}],yu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:Function},{type:Vl},{type:Dt.ValidatorService},{type:eu},{type:void 0}]},yu.propDecorators={canEdit:[{type:e.Input}],canDelete:[{type:e.Input}]};var vu,Cu=5e4,Eu=50001,wu={DEBUG_DATA:"DEBUG_DATA",INBOX_MESSAGE:"INBOX_MESSAGE"};t.UserEvent=vu=function(t){function e(){return t.call(this,vu.TYPENAME)||this}return Ee(e,t),e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return"object"==typeof n.content&&(n.content=JSON.stringify(n.content)),n},e.prototype.fromObject=function(e){Object.assign(this,e),t.prototype.fromObject.call(this,e),this.creationDate=ao(e.creationDate);try{"string"==typeof e.content&&e.content.startsWith("{")&&(this.content=JSON.parse(e.content)),this.content&&"string"==typeof this.content.context&&this.content.context.startsWith("{")&&(this.content.context=JSON.parse(this.content.context))}catch(t){console.error("Error during UserEvent deserialization",t)}},e}(Wi),t.UserEvent=vu=we([Ji({typename:"UserEventVO"})],t.UserEvent);var Iu,Ou,_u={userEvent:yt.gql(Iu||(Iu=Se(["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"],["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"]))),lightUserEvent:yt.gql(Ou||(Ou=Se(["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"],["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"])))};t.UserEventFilter=function(t){function e(){var e=t.apply(this,ke(arguments))||this;return e.issuer=null,e.recipient=null,e}return Ee(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.issuer=e.issuer,this.recipient=e.recipient},e.prototype.buildFilter=function(){var e=this,n=t.prototype.buildFilter.call(this);return this.issuer&&n.push((function(t){return t.issuer===e.issuer})),this.recipient&&n.push((function(t){return t.recipient===e.recipient})),n},e}(Bl),t.UserEventFilter=we([Ji({typename:"UserEventVO"})],t.UserEventFilter);var xu,ku,Su,Au,Tu=yt.gql(xu||(xu=Se(["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ","\n"],["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ","\n"])),_u.userEvent),Ru=yt.gql(ku||(ku=Se(["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ","\n"],["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ","\n"])),_u.lightUserEvent),Pu=yt.gql(Su||(Su=Se(["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"],["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"]))),Du=yt.gql(Au||(Au=Se(["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ","\n"],["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ","\n"])),_u.userEvent),Nu=function(e){function n(t,n,o,r,i,a){var s=e.call(this,t,a)||this;return s.graphql=t,s.accountService=n,s.network=o,s.translate=r,s.toastController=i,s.environment=a,s._userEventActions=[],s._debug=!a.production,s}return Ee(n,e),n.prototype.watchAll=function(t,e,n,o,r,i){return this.watchPage({offset:t,size:e,sortBy:n,sortDirection:o},r,i)},n.prototype.watchPage=function(e,n,o){var r=this._debug&&Date.now();if(console.debug("[user-event-service] Loading user events...",n),Te((n=this.asFilter(n)).recipient)||!this.accountService.isAdmin()){var i=this.accountService.account.pubkey;i!==n.recipient&&(console.warn("[user-events-service] Force user event filter.recipient="+i),n.recipient=i)}var a=o&&!0===o.withContent;return this.mutableWatchQuery({queryName:a?"LoadAllWithContent":"LoadAll",query:a?Du:Ru,variables:{page:Object.assign(Object.assign({sortBy:"updateDate"},e),{sortDirection:(e.sortDirection||"DESC").toUpperCase()}),filter:n&&n.asPodObject()},arrayFieldName:"data",error:{code:Cu,message:"SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR"},fetchPolicy:o&&o.fetchPolicy||void 0}).pipe(N.map((function(e){var n=e&&(e.data||[]).map(t.UserEvent.fromObject);return r&&(console.debug("[user-event-service] "+n.length+" user events loaded in "+(Date.now()-r)+"ms"),r=null),{data:n,total:e&&Be(e.total,n.length)}})))},n.prototype.saveAll=function(t,e){var n=this;return Promise.all(t.map((function(t){return n.save(t,e)})))},n.prototype.save=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o,r=this;return Oe(this,(function(i){switch(i.label){case 0:return this.fillDefaultProperties(t),e=Ae(t.id),n=t.asObject(),o=Date.now(),this._debug&&console.debug("[user-event-service] Saving user event...",n),[4,this.graphql.mutate({mutation:Tu,variables:{data:n},error:{code:Eu,message:"SOCIAL.ERROR.SAVE_USER_EVENT_ERROR"},update:function(n,i){var a=i.data,s=a&&a.data;s&&(r._debug&&console.debug("[user-event-service] User event saved in "+(Date.now()-o)+"ms",t),r.copyIdAndUpdateDate(s,t),e&&(r.insertIntoMutableCachedQueries(n,{query:Ru,data:Object.assign(Object.assign({},s),{content:null})}),r.insertIntoMutableCachedQueries(n,{query:Du,data:s})))}})];case 1:return i.sent(),[2,t]}}))}))},n.prototype.deleteAll=function(t,e){return Ie(this,void 0,void 0,(function(){var e,n,o=this;return Oe(this,(function(r){switch(r.label){case 0:return Fe(e=t&&t.map((function(t){return t.id})))?[2]:(n=Date.now(),this._debug&&console.debug("[user-event-service] Deleting events... ids:",e),[4,this.graphql.mutate({mutation:Pu,variables:{ids:e},update:function(t){o.removeFromMutableCachedQueriesByIds(t,{query:Ru,ids:e}),o.removeFromMutableCachedQueriesByIds(t,{query:Du,ids:e}),o._debug&&console.debug("[user-event-service] Events deleted in "+(Date.now()-n)+"ms")}})]);case 1:return r.sent(),[2]}}))}))},n.prototype.delete=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:return t?[4,this.deleteAll([t])]:[2];case 1:return e.sent(),[2]}}))}))},n.prototype.listenChanges=function(t,e){return console.warn("TODO: implement listen changes on user events"),D.of()},n.prototype.registerAction=function(t){console.info("[user-event-service] Registering action "+t.name+" for "+t.__typename),this._userEventActions.push(t)},n.prototype.getActionsByTypename=function(t){return this._userEventActions.filter((function(e){return e.__typename===t}))},n.prototype.showToastErrorWithContext=function(t){return Ie(this,void 0,void 0,(function(){var e,n,o,r,i;return Oe(this,(function(a){switch(a.label){case 0:return(e=t.message||t.error&&t.error.message||t.error)&&"string"==typeof e||(e="ERROR.UNKNOWN_TECHNICAL_ERROR"),this.network.offline?(this.showToast({message:e,type:"error"}),[2]):((e=this.translate.instant(e))&&-1!==e.indexOf("<small>")&&(e=e.substr(0,e.indexOf("<small>")-1)),[4,this.showToast({type:"error",duration:15e3,message:e+"<br/><br/><b>"+this.translate.instant("CONFIRM.SEND_DEBUG_DATA")+"</b>",buttons:[{icon:"bug",text:this.translate.instant("COMMON.BTN_SEND"),role:"send"}]})]);case 1:if(!(n=a.sent())||"send"!==n.role)return[2];a.label=2;case 2:return a.trys.push([2,6,,7]),this._debug&&console.debug("Sending debug data..."),"function"==typeof(o=t&&t.context)&&(o=o()),o instanceof Promise?[4,o]:[3,4];case 3:o=a.sent(),a.label=4;case 4:return[4,this.sendDataForDebug({message:e,error:t.error||void 0,context:this.convertObjectToString(o)})];case 5:return r=a.sent(),console.info("Debug data successfully sent to admin",r),this.showToast({type:"info",message:"INFO.DEBUG_DATA_SEND",showCloseButton:!0}),[3,7];case 6:return i=a.sent(),console.error("Error while sending debug data:",i),[3,7];case 7:return[2]}}))}))},n.prototype.sendDataForDebug=function(e){var n=new t.UserEvent;return n.eventType=wu.DEBUG_DATA,n.content=this.convertObjectToString(e),this.save(n)},n.prototype.asFilter=function(e){return t.UserEventFilter.fromObject(e)},n.prototype.convertObjectToString=function(t){return"string"==typeof t?t:"object"==typeof t?t instanceof Wi?JSON.stringify(t.asObject({keepTypename:!0,keepLocalId:!0,minify:!1})):JSON.stringify(t):void 0},n.prototype.showToast=function(t){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,ba.show(this.toastController,this.translate,t)];case 1:return[2,e.sent()]}}))}))},n.prototype.fillDefaultProperties=function(t){t.issuer=this.accountService.account.pubkey,console.warn("TODO: sign user event before sending")},n.prototype.copyIdAndUpdateDate=function(t,e){Qi.copyIdAndUpdateDate(t,e)},n}(Ls);Nu.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Nu(jt.ɵɵinject(Ns),jt.ɵɵinject(pl),jt.ɵɵinject(Ca),jt.ɵɵinject($t.TranslateService),jt.ɵɵinject(Gt.ToastController),jt.ɵɵinject(me))},token:Nu,providedIn:"root"}),Nu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Nu.ctorParameters=function(){return[{type:Ns},{type:pl},{type:Ca},{type:F.TranslateService},{type:M.ToastController},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]};var Fu={DEBUG_DATA:{matIcon:"bug_report"},INBOX_MESSAGE:{matIcon:"mail"}},Mu=function(e){function o(t,o,r,i,a,s){var l=e.call(this,t.get(z.ActivatedRoute),t.get(z.Router),t.get(M.Platform),t.get(n.Location),t.get(M.ModalController),t.get(ga),lu.concat(["creationDate","icon","eventType","message"]).concat(cu),null,null,t)||this;return l.injector=t,l.accountService=o,l.service=r,l.entities=i,l.cd=a,l.environment=s,l.i18nColumnPrefix="SOCIAL.USER_EVENT.",l.autoLoad=!1,l.inlineEdition=!1,l.defaultSortBy="creationDate",l.defaultSortDirection="desc",l}return Ee(o,e),o.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.dateTimePattern=this.translate.instant("COMMON.DATE_TIME_PATTERN"),this.withContent=je(this.withContent,!1);var n=this.accountService.account,o=n&&n.pubkey;this.isAdmin=this.accountService.isAdmin(),this.canEdit=this.isAdmin||o===this.recipient,this.canDelete=this.canEdit,this.setDatasource(new nu(t.UserEvent,this.service,null,{prependNewElements:!1,suppressErrors:!0,dataServiceOptions:{withContent:this.withContent}}));var r=this.filter||new t.UserEventFilter;r.recipient=this.recipient,this.setFilter(r,{emitEvent:!0})},o.prototype.start=function(){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(t){switch(t.label){case 0:return console.debug("[user-event] Starting..."),[4,this.accountService.ready()];case 1:return t.sent(),this.onRefresh.emit(),[2]}}))}))},o.prototype.getIcon=function(t){return Fu[t.eventType]},o.prototype.getDetail=function(t){if(t){if(t.content&&t.eventType===wu.DEBUG_DATA){var e=t.content.context;if(e&&e.__typename)return{actions:this.service.getActionsByTypename(e.__typename),title:t.content.error&&t.content.error.message||t.content.message,description:t.content.error&&t.content.error.details||void 0}}return console.debug("TODO: implement getDetail() for event: ",t),{}}},o.prototype.doAction=function(t,e){return Ie(this,void 0,void 0,(function(){var n,o,r,i,a;return Oe(this,(function(s){switch(s.label){case 0:if(n=e.currentData,o=n.content&&n.content.context,this.markAsLoading(),!t||"function"!=typeof t.executeAction)return[3,7];s.label=1;case 1:return s.trys.push([1,5,6,7]),(r=t.executeAction(n,o))instanceof Promise?[4,r]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=r,s.label=4;case 4:return r=i,[3,7];case 5:return a=s.sent(),this.setError(a&&a.message||a),console.error("[user-event] Failed to execute action "+t.name+": "+(a&&a.message||a),a),[3,7];case 6:return this.markAsLoaded(),[7];case 7:return[2]}}))}))},o}(pu);Mu.decorators=[{type:e.Component,args:[{selector:"app-user-events-table",template:'\n\x3c!-- Type = options menu --\x3e\n<mat-menu #optionsMenu="matMenu" xPosition="after">\n\n \x3c!-- display columns --\x3e\n <button mat-menu-item\n (click)="openSelectColumnsModal($event)">\n <mat-icon>view_column</mat-icon>\n <ion-label translate>COMMON.DISPLAYED_COLUMNS_DOTS</ion-label>\n </button>\n\n</mat-menu>\n\n\x3c!-- top header --\x3e\n<mat-toolbar>\n\n <ng-container *ngIf="!selection.hasValue(); else hasSelection">\n\n <button mat-icon-button [title]="\'COMMON.BTN_REFRESH\'|translate" (click)="onRefresh.emit()">\n <mat-icon>refresh</mat-icon>\n </button>\n\n </ng-container>\n\n \x3c!-- if row selection --\x3e\n <ng-template #hasSelection>\n\n \x3c!-- delete --\x3e\n <button mat-icon-button class="hidden-xs hidden-sm" *ngIf="canDelete"\n [title]="\'COMMON.BTN_DELETE\'|translate" (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" hidden-xs hidden-sm hidden-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <div class="toolbar-spacer"></div>\n\n <button mat-icon-button\n [title]="\'COMMON.BTN_OPTIONS\'|translate"\n [matMenuTriggerFor]="optionsMenu">\n <mat-icon>more_vert</mat-icon>\n </button>\n</mat-toolbar>\n\n\n<mat-table [dataSource]="dataSource" matSort\n [matSortActive]="defaultSortBy"\n [matSortDirection]="defaultSortDirection"\n matSortDisableClear [trackBy]="trackByFn">\n\n \x3c!-- select --\x3e\n <ng-container matColumnDef="select">\n <mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!canEdit">\n <mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"\n [indeterminate]="selection.hasValue() && !isAllSelected()">\n </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!canEdit">\n <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">\n </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n \x3c!-- id --\x3e\n <ng-container matColumnDef="id">\n <mat-header-cell *matHeaderCellDef mat-sort-header [class.cdk-visually-hidden]="!isAdmin">\n <app-loading-spinner [loading]="loadingSubject|async"><ion-label>#</ion-label></app-loading-spinner>\n </mat-header-cell>\n <mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!isAdmin">{{ row.currentData.id | mathAbs }}</mat-cell>\n </ng-container>\n\n \x3c!-- creationDate --\x3e\n <ng-container matColumnDef="creationDate">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.CREATION_DATE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row">\n <ion-text>\n {{row.currentData.creationDate | dateFromNow }}<br/>\n <ion-text color="medium"><small>{{row.currentData.creationDate | dateFormat: {time: true} }}</small></ion-text>\n </ion-text>\n </mat-cell>\n </ng-container>\n\n \x3c!-- icon --\x3e\n <ng-container matColumnDef="icon">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <ng-container *ngIf="getIcon(row.currentData); let details">\n <ion-icon slot="start" *ngIf="details.icon" [name]="details.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="details.matIcon">{{details.matIcon}}</mat-icon>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n \x3c!-- event type --\x3e\n <ng-container matColumnDef="eventType">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.EVENT_TYPE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <span>{{\'SOCIAL.EVENT_TYPE_ENUM.\' + row.currentData.eventType | translate}}</span>\n </mat-cell>\n </ng-container>\n\n \x3c!-- message --\x3e\n <ng-container matColumnDef="message">\n <mat-header-cell *matHeaderCellDef>\n <ion-label translate>SOCIAL.USER_EVENT.MESSAGE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef="let row;">\n <ng-container *ngIf="getDetail(row.currentData); let details">\n <ion-text [innerHTML]="details.title|translate">\n </ion-text>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <ng-container matColumnDef="actions">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef="let row">\n <ng-container *ngIf="getDetail(row.currentData); let details">\n <button mat-icon-button color="light"\n *ngFor="let action of details.actions"\n [title]="action.title |translate"\n [color]="action.color"\n (click)="doAction(action, row)">\n <ion-icon slot="start" *ngIf="action.icon" [name]="action.icon"></ion-icon>\n <mat-icon slot="start" *ngIf="action.matIcon">{{action.matIcon}}</mat-icon>\n </button>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>\n <mat-row *matRowDef="let row; columns: displayedColumns;"\n class="mat-row-disabled"\n (click)="clickRow($event, row)"></mat-row>\n\n</mat-table>\n\n<ion-row class="ion-no-padding">\n <ion-col></ion-col>\n <ion-col class="ion-no-padding" size="auto">\n <mat-paginator [length]="totalRowCount" [pageSize]="defaultPageSize" [pageSizeOptions]="defaultPageSizeOptions" showFirstLastButtons>\n </mat-paginator>\n </ion-col>\n</ion-row>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".mat-header-row .mat-column-icon,.mat-row .mat-column-icon{max-width:40px;padding-left:0}.mat-header-row .mat-column-icon ion-icon,.mat-header-row .mat-column-icon mat-icon,.mat-row .mat-column-icon ion-icon,.mat-row .mat-column-icon mat-icon{font-size:1.2em;height:1.2em;width:1.2em}.mat-header-row .mat-column-creationDate,.mat-row .mat-column-creationDate{min-width:100px;max-width:120px}"]}]}],Mu.ctorParameters=function(){return[{type:e.Injector},{type:pl},{type:Nu},{type:es},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Mu.propDecorators={recipient:[{type:e.Input}],withContent:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}]};var Lu,ju=function(){function t(){}return t.forRoot=function(){return console.debug("[social] Creating module (root)"),{ngModule:t,providers:[Nu]}},t}();ju.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Xc],declarations:[Mu],exports:[Mu]}]}],t.PersonFilter=Lu=function(t){function e(){return t.call(this,Lu.TYPENAME)||this}return Ee(e,t),e.searchFilter=function(t){return t&&Lu.fromObject(t).asFilterFn()},e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.email=e.email,this.pubkey=e.pubkey,this.searchText=e.searchText,this.statusIds=e.statusIds||(Re(e.statusId)?[e.statusId]:void 0),this.userProfiles=e.userProfiles,this.excludedIds=e.excludedIds,this.searchAttribute=e.searchAttribute,this.searchAttributes=e.searchAttributes},e.prototype.asObject=function(e){var n=t.prototype.asObject.call(this,e);return n.email=this.email,n.pubkey=this.pubkey,n.searchText=this.searchText,n.statusIds=this.statusIds,n.userProfiles=this.userProfiles,n.excludedIds=this.excludedIds,n.searchAttribute=this.searchAttribute,n.searchAttributes=this.searchAttributes,n},e.prototype.buildFilter=function(){var e=this,n=t.prototype.buildFilter.call(this);Ne(this.statusIds)&&n.push((function(t){return e.statusIds.includes(t.statusId)})),Ne(this.excludedIds)&&n.push((function(t){return Ae(t.id)||!e.excludedIds.includes(t.id)}));var o=Qi.searchTextFilter(this.searchAttribute||this.searchAttributes||["lastName","firstName","department.name"],this.searchText);return o&&n.push(o),n},e}(Bl),t.PersonFilter=Lu=we([Ji({typename:"PersonFilterVO"})],t.PersonFilter);var Bu,Uu,Vu,qu,$u,Gu={person:yt.gql(Bu||(Bu=Se(["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"],["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"])))},Hu={loadAll:yt.gql(Uu||(Uu=Se(["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ",""],["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ",""])),Gu.person),loadAllWithTotal:yt.gql(Vu||(Vu=Se(["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ",""],["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ",""])),Gu.person)},Wu={saveAll:yt.gql(qu||(qu=Se(["\n mutation savePersons($data:[PersonVOInput]){\n data: savePersons(persons: $data){\n ...PersonFragment\n }\n }\n ",""],["\n mutation savePersons($data:[PersonVOInput]){\n data: savePersons(persons: $data){\n ...PersonFragment\n }\n }\n ",""])),Gu.person),deleteAll:yt.gql($u||($u=Se(["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"],["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"])))},zu=function(e){function n(n,o,r,i){var a=e.call(this,n,o,t.Person,t.PersonFilter,{queries:Hu,mutations:Wu,defaultSortBy:"lastName",defaultSortDirection:"asc"})||this;return a.graphql=n,a.platform=o,a.network=r,a.entities=i,a._debug=!Yi.production,a}return Ee(n,e),n.prototype.loadAll=function(t,n,o,r,i,a){var s=Object.create(null,{loadAll:{get:function(){return e.prototype.loadAll}}});return Ie(this,void 0,void 0,(function(){return Oe(this,(function(e){return this.network.offline&&(!a||"network-only"!==a.fetchPolicy)?[2,this.loadAllLocally(t,n,o,r,i,a)]:[2,s.loadAll.call(this,t,n,o,r,i,a)]}))}))},n.prototype.loadAllLocally=function(e,n,o,r,i,a){return Ie(this,void 0,void 0,(function(){var s,l,c,u;return Oe(this,(function(d){switch(d.label){case 0:return i=this.asFilter(i),s={offset:e||0,size:n||100,sortBy:o||this.defaultSortBy,sortDirection:r||this.defaultSortDirection,filter:i&&i.asFilterFn()},[4,this.entities.loadAll("PersonVO",s)];case 1:return l=d.sent(),c=l.data,u=l.total,[2,{data:a&&!1===a.toEntity?c||[]:(c||[]).map(t.Person.fromObject),total:u}]}}))}))},n.prototype.suggest=function(t,e,n,o){return Ie(this,void 0,void 0,(function(){return Oe(this,(function(r){return gs.isNotEmpty(t)?[2,{data:[t]}]:(t="string"==typeof t&&"*"!==t&&t||void 0,n=n||e.searchAttribute||e.searchAttributes&&e.searchAttributes[0],[2,this.loadAll(0,t?10:30,n,o,Object.assign(Object.assign({},e),{searchText:t,statusIds:e&&e.statusIds||[as.ENABLE],userProfiles:e&&e.userProfiles}),{withTotal:!0})])}))}))},n.prototype.executeImport=function(t,n){var o=Object.create(null,{loadAll:{get:function(){return e.prototype.loadAll}}});return Ie(this,void 0,void 0,(function(){var e,r,i,a=this;return Oe(this,(function(s){switch(s.label){case 0:return e=n&&n.maxProgression||100,r={statusIds:[as.ENABLE,as.TEMPORARY],userProfiles:["SUPERVISOR","USER","GUEST"]},console.info("[person-service] Importing persons..."),[4,ql.fetchAllPages((function(t,e){return o.loadAll.call(a,t,e,"id",null,r,{debug:!1,fetchPolicy:"network-only",withTotal:0===t,toEntity:!1})}),t,{maxProgression:.9*e})];case 1:return i=s.sent(),[4,this.entities.saveAll(i.data,{entityName:"PersonVO",reset:!0})];case 2:return s.sent(),[2]}}))}))},n.prototype.asObject=function(e){if(e){console.debug("TODO check isInstanceOf"),zi(e,t.Person)||(e=t.Person.fromObject(e));var n=e.asObject();return delete n.mainProfile,n.department=e.department&&e.department.asObject(!0),n}},n}(Zc);zu.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new zu(jt.ɵɵinject(Ns),jt.ɵɵinject(Sl),jt.ɵɵinject(Ca),jt.ɵɵinject(es))},token:zu,providedIn:"root"}),zu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],zu.ctorParameters=function(){return[{type:Ns},{type:Sl},{type:Ca},{type:es}]};var Ku=function(){function e(t,e){this.formBuilder=t,this.accountValidatorService=e}return e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(e){var n=this.accountValidatorService.getFormGroupConfig(e&&t.Account.fromObject(e.asObject()));return n.pubkey=[e&&e.pubkey||null,Do.pubkey],n.username=[e&&e.username||null,P.Validators.minLength(2)],n.usernameExtranet=[e&&e.usernameExtranet||null,P.Validators.minLength(2)],n.avatar=[e&&e.avatar||null],this.formBuilder.group(n)},e}();Ku.ɵprov=jt.ɵɵdefineInjectable({factory:function(){return new Ku(jt.ɵɵinject(qt.FormBuilder),jt.ɵɵinject(_c))},token:Ku,providedIn:"root"}),Ku.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ku.ctorParameters=function(){return[{type:P.FormBuilder},{type:_c}]};var Qu=function(e){function n(n,o,r,i,a,s,l,c,u,d,p,h,m,f){var g=e.call(this,n,o,r,i,a,l,lu.concat(["avatar","lastName","firstName","email","profile","status","username","usernameExtranet","pubkey"]).concat(s.additionalFields.map((function(t){return t.key}))).concat(cu),new nu(t.Person,d,c,{prependNewElements:!1,suppressErrors:f.production,dataServiceOptions:{saveOnlyDirtyRows:!0}}),null,m)||this;return g.route=n,g.router=o,g.platform=r,g.location=i,g.modalCtrl=a,g.accountService=s,g.settings=l,g.validatorService=c,g.configService=u,g.dataService=d,g.cd=p,g.canEdit=!1,g.profiles=ke(Es).reverse(),g.filterCriteriaCount=0,g.statusList=ds,g.statusById=ps,g.useSticky=!1,g.referentialToString=ss,g.inlineEdition=s.isAdmin(),g.canEdit=s.isAdmin(),g.confirmBeforeDelete=!0,g.autoLoad=!1,g.i18nColumnPrefix="USER.",g.defaultSortBy="lastName",g.defaultSortDirection="asc",g.filterForm=h.group({searchText:[null],statusId:[null]}),g.additionalFields=(g.accountService.additionalFields||[]).filter((function(t){return Re(t.autocomplete)})).map((function(t){return t.autocomplete=g.registerAutocompleteField(t.key,Object.assign({},t.autocomplete)),t})),g.debug=!f.production,g}return Ee(n,e),Object.defineProperty(n.prototype,"showUsernameColumn",{set:function(t){this.setShowColumn("username",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"showUsernameExtranetColumn",{set:function(t){this.setShowColumn("usernameExtranet",t)},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var n=this;e.prototype.ngOnInit.call(this),this.registerSubscription(this.configService.config.subscribe((function(t){var e=t.getProperty(yl.AUTH_TOKEN_TYPE);switch(console.debug("[users] AuthTokenType="+e),e){case"basic":n.setShowColumn("pubkey",!1,{emitEvent:!1});case"basic-and-token":n.setShowColumn("username",!0,{emitEvent:!1}),n.setShowColumn("usernameExtranet",!0,{emitEvent:!1});break;case"token":n.setShowColumn("pubkey",!0,{emitEvent:!1}),n.setShowColumn("username",!1,{emitEvent:!1}),n.setShowColumn("usernameExtranet",!1,{emitEvent:!1})}n.updateColumns(),n.onRefresh.emit()}))),this.registerSubscription(this.onRefresh.subscribe((function(){n.filterForm.markAsUntouched(),n.filterForm.markAsPristine()}))),this.registerSubscription(this.filterForm.valueChanges.pipe(N.debounceTime(250),N.filter((function(){return n.filterForm.valid})),N.tap((function(e){var o=t.PersonFilter.fromObject(e);n.filterCriteriaCount=o.countNotEmptyCriteria(),n.markForCheck(),n.setFilter(o,{emitEvent:!1})})),N.debounceTime(500),N.tap((function(t){return n.settings.savePageSetting(n.settingsId,t,iu)}))).subscribe()),this.restoreFilterOrLoad()},n.prototype.applyFilterAndClosePanel=function(t){this.onRefresh.emit(t),this.filterExpansionPanel.close()},n.prototype.resetFilter=function(t){this.totalRowCount=void 0,this.filterCriteriaCount=0,this.markAsLoading(),this.filterForm.reset(),this.setFilter(null)},n.prototype.restoreFilterOrLoad=function(){return Ie(this,void 0,void 0,(function(){var e,n;return Oe(this,(function(o){return this.markAsLoading(),console.debug("[users] Restoring filter from settings..."),e=this.settings.getPageSettings(this.settingsId,iu)||{},n=t.PersonFilter.fromObject(e),this.filterForm.patchValue(e),this.setFilter(n,{emitEvent:!0}),[2]}))}))},n.prototype.clearControlValue=function(t,e){return t&&t.stopPropagation(),e.setValue(null),!1},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(pu);Qu.decorators=[{type:e.Component,args:[{selector:"app-users-table",template:'<app-toolbar [title]="\'USER.LIST.TITLE\'|translate"\n color="primary"\n [canGoBack]="false"\n [hasValidate]="!(loadingSubject|async) && dirty"\n (onValidate)="save()">\n <ion-buttons slot="end">\n <ng-container *ngIf="!selection.hasValue(); else hasSelection">\n \x3c!-- Add --\x3e\n <button mat-icon-button\n *ngIf="canEdit && !mobile"\n [title]="\'COMMON.BTN_ADD\'|translate"\n (click)="addRow()">\n <mat-icon>add</mat-icon>\n </button>\n\n \x3c!-- Refresh --\x3e\n <button mat-icon-button *ngIf="!mobile"\n [title]="\'COMMON.BTN_REFRESH\'|translate"\n (click)="onRefresh.emit()">\n <mat-icon>refresh</mat-icon>\n </button>\n\n \x3c!-- reset filter --\x3e\n <button mat-icon-button (click)="resetFilter()"\n *ngIf="filterCriteriaCount">\n <mat-icon color="accent">filter_list_alt</mat-icon>\n <mat-icon class="icon-secondary" style="left: 16px; top: 5px; font-weight: bold;">close</mat-icon>\n </button>\n\n \x3c!-- show filter --\x3e\n <button mat-icon-button (click)="filterExpansionPanel.toggle()">\n <mat-icon *ngIf="filterCriteriaCount; else emptyFilter"\n [matBadge]="filterCriteriaCount"\n matBadgeColor="accent"\n matBadgeSize="small"\n matBadgePosition="above after">filter_list_alt\n </mat-icon>\n <ng-template #emptyFilter>\n <mat-icon>filter_list_alt</mat-icon>\n </ng-template>\n </button>\n </ng-container>\n\n <ng-template #hasSelection>\n \x3c!-- delete --\x3e\n <button mat-icon-button\n class="hidden-xs hidden-sm"\n [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n\n<ion-content class="ion-no-padding">\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="errorSubject|async ; let error" lines="none" @slideUpDownAnimation>\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n \x3c!-- search --\x3e\n <mat-expansion-panel #filterExpansionPanel class="ion-no-padding filter-panel filter-panel-floating">\n <form class="form-container ion-padding" [formGroup]="filterForm" (ngSubmit)="onRefresh.emit()">\n <ion-grid>\n <ion-row>\n <ion-col>\n \x3c!-- search --\x3e\n <mat-form-field>\n <input matInput [placeholder]="\'USER.LIST.FILTER.SEARCH\'|translate" formControlName="searchText">\n\n <button mat-icon-button matSuffix tabindex="-1"\n type="button"\n (click)="clearControlValue($event, filterForm.controls.searchText)"\n [hidden]="filterForm.controls.searchText.disabled || !filterForm.controls.searchText.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n \x3c!-- status --\x3e\n <mat-form-field>\n <mat-select formControlName="statusId" [placeholder]="\'USER.STATUS\'|translate">\n <mat-option [value]="null"><i><span translate>COMMON.EMPTY_OPTION</span></i></mat-option>\n <mat-option *ngFor="let item of statusList" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n\n <button mat-icon-button matSuffix tabindex="-1"\n type="button"\n (click)="clearControlValue($event, filterForm.controls.statusId)"\n [hidden]="filterForm.controls.statusId.disabled || !filterForm.controls.statusId.value">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n </ion-col>\n </ion-row>\n </ion-grid>\n </form>\n\n <mat-action-row>\n \x3c!-- Counter --\x3e\n <ion-label [hidden]="(loadingSubject|async) || filterForm.dirty"\n [color]="empty && \'danger\'"\n class="ion-padding">\n {{ (totalRowCount ? \'COMMON.RESULT_COUNT\' : \'COMMON.NO_RESULT\') | translate: {\n count: (totalRowCount |\n numberFormat)\n } }}\n </ion-label>\n\n <div class="toolbar-spacer"></div>\n\n \x3c!-- Close panel --\x3e\n <ion-button mat-button fill="clear" color="dark"\n (click)="filterExpansionPanel.close()"\n [disabled]="loadingSubject|async">\n <ion-text translate>COMMON.BTN_CLOSE</ion-text>\n </ion-button>\n\n \x3c!-- Search button --\x3e\n <ion-button mat-button\n [color]="filterForm.dirty ? \'tertiary\' : \'dark\'"\n [fill]="filterForm.dirty ? \'solid\' : \'clear\'"\n (click)="applyFilterAndClosePanel($event)"\n [disabled]="loadingSubject|async">\n <ion-text translate>COMMON.BTN_APPLY</ion-text>\n </ion-button>\n\n </mat-action-row>\n </mat-expansion-panel>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="error" visible-xs visible-sm visible-mobile lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" class="error" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n\n <div class="table-container">\n <table #table mat-table matSort\n [dataSource]="dataSource"\n [matSortActive]="defaultSortBy" [matSortDirection]="defaultSortDirection"\n matSortDisableClear [trackBy]="trackByFn">\n\n <ng-container matColumnDef="select" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!inlineEdition">\n <mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"\n [indeterminate]="selection.hasValue() && !isAllSelected()">\n </mat-checkbox>\n </th>\n <td mat-cell *matCellDef="let row" [class.cdk-visually-hidden]="!inlineEdition">\n <mat-checkbox (click)="$event.stopPropagation()" (change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">\n </mat-checkbox>\n </td>\n </ng-container>\n\n \x3c!-- Id Column --\x3e\n <ng-container matColumnDef="id" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label>#</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">{{ row.currentData.id }}</td>\n </ng-container>\n\n \x3c!-- avatar Column --\x3e\n <ng-container matColumnDef="avatar" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef></th>\n <td mat-cell *matCellDef="let row">\n <div class="avatar" *ngIf="row.currentData.avatar; else generateIcon"\n [ngStyle]="{\'background-image\':\'url(\'+row.currentData.avatar+\')\'}"></div>\n <ng-template #generateIcon>\n <div class="avatar">\n <svg width="38" width="38" [data-jdenticon-value]="row.currentData.id"></svg>\n </div>\n </ng-template>\n </td>\n </ng-container>\n\n \x3c!-- lastName --\x3e\n <ng-container matColumnDef="lastName">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.LAST_NAME</span>\n </th>\n <td mat-cell *matCellDef="let row" (click)="focusColumn=\'lastName\'">\n <mat-form-field floatLabel="never">\n <input matInput\n [formControl]="row.validator.controls[\'lastName\']"\n [placeholder]="\'USER.LAST_NAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'lastName\'">\n <mat-error *ngIf="row.validator.controls[\'lastName\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'lastName\'].hasError(\'minlength\')">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n\n </td>\n\n </ng-container>\n\n \x3c!-- firstname --\x3e\n <ng-container matColumnDef="firstName">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.FIRST_NAME</span>\n </th>\n <td mat-cell *matCellDef="let row"\n\n (click)="focusColumn=\'firstName\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls[\'firstName\']"\n [placeholder]="\'USER.FIRST_NAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'firstName\'">\n <mat-error *ngIf="row.validator.controls[\'firstName\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'firstName\'].hasError(\'minlength\')">\n <span>{{\'ERROR.FIELD_MIN_LENGTH\' | translate: {minLength: 2} }}</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- email --\x3e\n <ng-container matColumnDef="email">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.EMAIL</span>\n </th>\n <td mat-cell *matCellDef="let row" (click)="focusColumn=\'email\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls[\'email\']"\n [placeholder]="\'USER.EMAIL\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'email\'">\n <mat-error *ngIf="row.validator.controls[\'email\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'email\'].hasError(\'email\')">\n <span translate>ERROR.FIELD_NOT_VALID_EMAIL</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- additional fields --\x3e\n <ng-container *ngFor="let definition of additionalFields" [matColumnDef]="definition.key">\n <th mat-header-cell *matHeaderCellDef>\n <span>{{definition.label|translate}}</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=definition.key">\n <app-form-field floatLabel="never"\n [definition]="definition"\n [formControl]="row.validator.controls[definition.key]"\n [required]="definition.extra?.account?.required"\n [autofocus]="row.editing && focusColumn===definition.ke">\n </app-form-field>\n </td>\n </ng-container>\n\n \x3c!-- profile column --\x3e\n <ng-container matColumnDef="profile">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.PROFILE</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'profile\'">\n <mat-form-field floatLabel="never">\n <mat-select [formControl]="row.validator.controls[\'mainProfile\']"\n [placeholder]="\'USER.PROFILE\'|translate">\n <mat-option *ngFor="let item of profiles" [value]="item">\n {{ (\'USER.PROFILE_ENUM.\' + item) | uppercase |translate }}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="row.validator.controls[\'mainProfile\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Status column --\x3e\n <ng-container matColumnDef="status">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.STATUS</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'status\'">\n <mat-form-field floatLabel="never">\n <ion-icon matPrefix *ngIf="row.validator.controls[\'statusId\'].value >=0" [name]="statusById[row.validator.controls[\'statusId\'].value]?.icon"></ion-icon>\n\n <mat-select [formControl]="row.validator.controls[\'statusId\']"\n [placeholder]="\'REFERENTIAL.STATUS\'|translate">\n <mat-select-trigger>\n <span *ngIf="row.validator.controls[\'statusId\'].value >=0">\n {{ statusById[row.validator.controls[\'statusId\'].value]?.label | translate}}</span>\n </mat-select-trigger>\n <mat-option *ngFor="let item of statusList" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n <mat-error *ngIf="row.validator.controls[\'statusId\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- username --\x3e\n <ng-container matColumnDef="username">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.USERNAME</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'username\'">\n <mat-form-field floatLabel="never" >\n <input matInput [formControl]="row.validator.controls.username"\n [placeholder]="\'USER.USERNAME\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'username\'">\n <mat-error *ngIf="row.validator.controls.username.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- username extranet --\x3e\n <ng-container matColumnDef="usernameExtranet">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.USERNAME_EXTRANET</span>\n </th>\n <td mat-cell *matCellDef="let row"\n (click)="focusColumn=\'usernameExtranet\'">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator.controls.usernameExtranet"\n [placeholder]="\'USER.USERNAME_EXTRANET\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn===\'usernameExtranet\'">\n <mat-error *ngIf="row.validator.controls.usernameExtranet.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- pubkey --\x3e\n <ng-container matColumnDef="pubkey">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <span translate>USER.PUBKEY</span>\n </th>\n <td mat-cell *matCellDef="let row"\n [title]="row.validator.controls[\'pubkey\'].value"\n (click)="focusColumn=\'pubkey\'">\n <mat-form-field floatLabel="never" >\n <input matInput [formControl]="row.validator.controls[\'pubkey\']" [placeholder]="\'USER.PUBKEY\'|translate"\n [readonly]="!row.editing" autocomplete="off">\n <mat-error *ngIf="row.validator.controls[\'pubkey\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="row.validator.controls[\'pubkey\'].hasError(\'pubkey\')">\n <span translate>ERROR.FIELD_NOT_VALID_PUBKEY</span>\n </mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <app-actions-column [stickyEnd]="useSticky"\n (optionsClick)="openSelectColumnsModal($event)"\n (cancelOrDeleteClick)="cancelOrDelete($event.event, $event.row)"\n (confirmAndAddClick)="confirmAndAdd($event.event, $event.row)"\n (backward)="confirmAndBackward($event.event, $event.row)"\n (forward)="confirmAndForward($event.event, $event.row)"\n [canCancel]="false">\n </app-actions-column>\n\n <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>\n <tr mat-row *matRowDef="let row; columns: displayedColumns;"\n [class.mat-row-error]="row.validator.invalid"\n [class.mat-row-dirty]="row.currentData.dirty"\n [class.mat-row-disabled]="!row.editing"\n (click)="clickRow($event, row)"\n (keydown.escape)="escapeEditingRow($event)"\n [cdkTrapFocus]="row.validator.invalid"></tr>\n </table>\n\n <ng-container *ngIf="loadingSubject|async; else noResult">\n <ion-item>\n <ion-skeleton-text animated></ion-skeleton-text>\n </ion-item>\n </ng-container>\n\n <ng-template #noResult>\n <ion-item *ngIf="totalRowCount === 0">\n <ion-text color="danger" class="text-italic" translate>COMMON.NO_RESULT</ion-text>\n </ion-item>\n </ng-template>\n </div>\n</ion-content>\n\n<ion-footer>\n <mat-paginator class="mat-paginator-footer"\n [length]="totalRowCount" [pageSize]="defaultPageSize"\n [pageSizeOptions]="defaultPageSizeOptions" showFirstLastButtons>\n </mat-paginator>\n\n <app-form-buttons-bar *ngIf="!mobile && inlineEdition"\n (onCancel)="onRefresh.emit()" (onSave)="save()" [disabled]="(loadingSubject|async) || !dirty"></app-form-buttons-bar>\n</ion-footer>\n\n<ion-fab slot="fixed" vertical="bottom" horizontal="end" *ngIf="mobile">\n <ion-fab-button color="tertiary" (click)="addRow()">\n <ion-icon name="add"></ion-icon>\n </ion-fab-button>\n</ion-fab>\n',providers:[{provide:Dt.ValidatorService,useExisting:Ku}],animations:[na],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".mat-expansion-panel{margin-bottom:5px}.mat-expansion-panel .form-container mat-form-field{width:100%}.mat-expansion-panel mat-action-row ion-label{line-height:36px}.table-container{height:100%}.mat-table .mat-cell .avatar{height:40px;width:40px;margin:2px 0 0;background-size:cover;background-repeat:no-repeat;background-position:50%}.mat-table .mat-column-id{width:30px}.mat-table .mat-column-avatar{width:50px}.mat-table .mat-column-avatar .avatar{border-radius:5px;border:1px solid rgba(var(--ion-color-secondary-rgb),.5)}.mat-table .mat-column-firstName,.mat-table .mat-column-lastName{min-width:80px}.mat-table .mat-column-email{min-width:120px}.mat-table .mat-column-profile{min-width:110px}.mat-table .mat-column-status{min-width:130px}.mat-table .mat-column-department{min-width:150px}"]}]}],Qu.ctorParameters=function(){return[{type:z.ActivatedRoute},{type:z.Router},{type:Sl},{type:n.Location},{type:M.ModalController},{type:pl},{type:ga},{type:Dt.ValidatorService},{type:xl},{type:zu},{type:e.ChangeDetectorRef},{type:P.FormBuilder},{type:e.Injector},{type:void 0,decorators:[{type:e.Inject,args:[me]}]}]},Qu.propDecorators={useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}]};var Yu=function(){console.debug("[admin] Creating module")};Yu.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Xc,ju,ui,Ft.NgxJdenticonModule,F.TranslateModule.forChild()],declarations:[Qu],exports:[Qu]}]}],Yu.ctorParameters=function(){return[]};var Xu=[{path:"users",pathMatch:"full",component:Qu,canActivate:[Jc],data:{profile:"ADMIN"}}],Ju=function(){};Ju.decorators=[{type:e.NgModule,args:[{imports:[Ml,Yu,z.RouterModule.forChild(Xu)],exports:[z.RouterModule]}]}];t.APP_ABOUT_DEVELOPERS=fc,t.APP_ABOUT_PARTNERS=gc,t.APP_CONFIG_OPTIONS=_l,t.APP_FORM_ERROR_I18N_KEYS=sr,t.APP_GRAPHQL_TYPE_POLICIES=Ds,t.APP_HOME_BUTTONS=Cc,t.APP_LOCALES=rs,t.APP_LOCAL_SETTINGS=ma,t.APP_LOCAL_SETTINGS_OPTIONS=fa,t.APP_LOCAL_STORAGE_TYPE_POLICIES=ts,t.APP_MENU_ITEMS=Wc,t.APP_TESTING_PAGES=Jl,t.AboutModal=bc,t.AccountPage=xc,t.AccountService=pl,t.AccountToStringPipe=$c,t.ActionsColumnComponent=Qc,t.AdminModule=Yu,t.AdminRoutingModule=Ju,t.Alerts=Dl,t.AppEditor=mu,t.AppEditorOptions=gu,t.AppEntityEditor=bu,t.AppForm=pc,t.AppFormField=Oi,t.AppFormProvider=Lo,t.AppFormUtils=jo,t.AppGestureConfig=hi,t.AppGraphQLModule=Pc,t.AppHelpModal=Al,t.AppInMemoryTable=yu,t.AppInstallUpgradeCard=Vc,t.AppListForm=Mc,t.AppLoadingSpinner=Bi,t.AppMenuModule=Kc,t.AppNullForm=Mo,t.AppPropertiesForm=Fc,t.AppTabEditor=fu,t.AppTabEditorOptions=hu,t.AppTable=pu,t.AppTableDataSourceOptions=eu,t.AppTableUtils=tu,t.AppValidatorService=Ic,t.AppendToInputDirective=ti,t.ArrayFilterPipe=vo,t.ArrayFirstPipe=go,t.ArrayIncludesPipe=yo,t.ArrayLengthPipe=fo,t.ArrayPluckPipe=bo,t.AudioProvider=ki,t.AuthForm=hc,t.AuthGuardService=Jc,t.AuthModal=mc,t.AutocompleteTestPage=Yl,t.AutofocusDirective=dr,t.Base58=Ui,t.BaseEntityService=Zc,t.BaseGraphqlService=Ls,t.BaseGraphqlServiceOptions=Ms,t.BaseReferential=hs,t.Beans=ln,t.CORE_CONFIG_OPTIONS=yl,t.CellValueChangeListener=du,t.ChipsTestPage=ac,t.Color=Hl,t.ColorScale=Wl,t.ComponentDirtyGuard=Nl,t.ConfigService=xl,t.CoreModule=Xc,t.CryptoService=Hi,t.DATE_ISO_PATTERN=ge,t.DATE_UNIX_MS_TIMESTAMP="x",t.DATE_UNIX_TIMESTAMP="X",t.DEFAULT_PAGE_SIZE=20,t.DEFAULT_PAGE_SIZE_OPTIONS=su,t.DEFAULT_PLACEHOLDER_CHAR=be,t.DEFAULT_REQUIRED_COLUMNS=uu,t.DateDiffDurationPipe=jn,t.DateFormatPipe=Mn,t.DateFromNowPipe=Bn,t.DateTimeTestPage=oc,t.DateUtils=ro,t.DepartmentToStringPipe=Gc,t.DurationPipe=lo,t.ENTITIES_STORAGE_KEY_PREFIX=Ja,t.ENVIRONMENT=me,t.EmptyArrayPipe=mo,t.EntitiesService=jl,t.EntitiesStorage=es,t.EntitiesTableDataSource=nu,t.Entity=Wi,t.EntityClass=Ji,t.EntityClasses=Xi,t.EntityFilter=Bl,t.EntityFilterUtils=Ul,t.EntityMetadataComponent=kc,t.EntityStore=Za,t.EntityUtils=Qi,t.Environment=fe,t.ErrorCodes={LOAD_PERSONS_ERROR:100,SAVE_PERSONS_ERROR:101,DELETE_PERSONS_ERROR:102},t.EvenPipe=uo,t.FileService=Li,t.FileSizePipe=no,t.FormArrayHelper=ar,t.FormButtonsBarComponent=Ac,t.FormButtonsBarToken=Sc,t.FormErrorTranslatePipe=cr,t.FormErrorTranslator=lr,t.FormFieldValuesHolder=Ll,t.Fragments=Cl,t.GraphqlService=Ns,t.HAMMER_PRESS_TIME=pi,t.HAMMER_TAP_TIME=250,t.HighlightPipe=eo,t.HomePage=Ec,t.Hotkeys=Ai,t.HotkeysDialogComponent=Si,t.InMemoryEntitiesService=Vl,t.IsLoginAccountPipe=qc,t.IsNilOrBlankPipe=Oo,t.IsNotNilOrBlankPipe=Io,t.IsNotOnFieldModePipe=jc,t.IsOnFieldModePipe=Lc,t.JobUtils=ql,t.KEYBOARD_HIDE_DELAY_MS=ve,t.LAT_LONG_DEFAULT_MAX_DECIMALS=3,t.LAT_LONG_PATTERNS=Un,t.LatLongFormatPipe=Xn,t.LatLongTestPage=Xl,t.LatitudeFormatPipe=Jn,t.LocalSettingsService=ga,t.LongitudeFormatPipe=Zn,t.MINIFY_ENTITY_FOR_LOCAL_STORAGE=bs,t.MINIFY_ENTITY_FOR_POD=ys,t.MapGetPipe=Co,t.MapKeysPipe=Eo,t.MapValuesPipe=wo,t.MatAutocompleteConfigHolder=Pn,t.MatAutocompleteField=Fn,t.MatBooleanField=Gr,t.MatChipsField=ii,t.MatDate=Ir,t.MatDateShort=Dr,t.MatDateTime=Ar,t.MatDuration=Ur,t.MatLatLongField=yr,t.MatNumpadComponent=Xr,t.MatNumpadContainerComponent=Qr,t.MatNumpadContent=Zr,t.MatPaginatorI18n=gi,t.MatStepperI18n=Tl,t.MatSwipeField=oi,t.MaterialChipsModule=ai,t.MaterialTestingModule=cc,t.MaterialTestingPage=Zl,t.MathAbsPipe=co,t.MenuComponent=zc,t.MenuItems=yc,t.MenuService=Hc,t.ModalToolbarComponent=ji,t.NetworkService=Ca,t.NgInitDirective=Ro,t.NotEmptyArrayPipe=ho,t.NumberFormatPipe=to,t.NumpadDirective=Jr,t.OddPipe=po,t.PRIORITIZED_AUTHORITIES=Es,t.PUBKEY_REGEXP=ye,t.PersonFragments=Gu,t.PersonService=zu,t.PersonToStringPipe=Bc,t.PersonUtils=Is,t.PersonValidatorService=Ku,t.PlatformService=Sl,t.ProgressBarService=di,t.ProgressInterceptor=bi,t.PropertyGetPipe=To,t.RESERVED_END_COLUMNS=cu,t.RESERVED_START_COLUMNS=lu,t.ReferentialUtils=gs,t.RegisterConfirmPage=wc,t.SETTINGS_DISPLAY_COLUMNS=ou,t.SETTINGS_FILTER=iu,t.SETTINGS_PAGE_SIZE=au,t.SETTINGS_SORTED_COLUMN=ru,t.SETTINGS_STORAGE_KEY=da,t.SETTINGS_TRANSIENT_PROPERTIES=pa,t.SPACE_PLACEHOLDER_CHAR=" ",t.SelectPeerModal=ca,t.SettingsPage=Nc,t.SharedDirectivesModule=pr,t.SharedFormArrayValidators=Fo,t.SharedFormGroupValidators=No,t.SharedHotkeysModule=Ti,t.SharedMatAutocompleteModule=hr,t.SharedMatBooleanModule=Hr,t.SharedMatDateTimeModule=Nr,t.SharedMatDurationModule=Vr,t.SharedMatLatLongModule=vr,t.SharedMatNumpadModule=ei,t.SharedMatSwipeModule=ri,t.SharedMaterialModule=ui,t.SharedModule=Pl,t.SharedPipesModule=ur,t.SharedRoutingModule=Ml,t.SharedTestingModule=uc,t.SharedValidators=Do,t.SocialModule=ju,t.StartableService=_i,t.StatusById=ps,t.StatusIds=as,t.StatusList=ds,t.StrLengthPipe=xo,t.SwipeTestPage=ec,t.TableSelectColumnsComponent=Tc,t.ToStringPipe=_o,t.Toasts=ba,t.ToolbarComponent=fi,t.ToolbarToken=mi,t.TranslatablePipe=Ao,t.TranslateContextPipe=So,t.TranslateContextService=ko,t.UserEventService=Nu,t.UserEventTypes=wu,t.UserEventsTable=Mu,t.UsersPage=Qu,t.accountToString=Os,t.adaptValueToControl=Vo,t.addValueInArray=Wo,t.arrayDistinct=function(t,e){if(Fe(t))return t;e=e||Object.keys(t[0]);var n=new Set;return t.reduce((function(t,o){var r=ze(o,e,"|");return n.has(r)?t:(n.add(r),t.concat(o))}),[])},t.arrayGroupBy=function(t,e){return Ae(t)?null:t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{})},t.arraySize=function(t){return Ne(t)&&t.length||0},t.asInputElement=yn,t.canHaveFocus=Cn,t.capitalizeFirstLetter=rn,t.chainPromises=xn,t.changeCaseToUnderscore=Ge,t.clearValueInArray=Qo,t.copyEntity2Form=Bo,t.createPromiseEvent=An,t.createPromiseEventEmitter=Sn,t.departmentToString=vs,t.departmentsToString=Cs,t.disableControls=Ho,t.emitPromiseEvent=Tn,t.entityToString=function(t,e){return t&&t.id&&ze(t,e||["name"])||void 0},t.equals=sn,t.equalsOrNil=function(t,e){return t===e||Ae(t)&&Ae(e)},t.fadeInAnimation=Zi,t.fadeInOutAnimation=ta,t.filterFalse=function(t){return t.pipe(N.filter((function(t){return!1===t})))},t.filterNotNil=function(t){return t.pipe(N.filter(Re))},t.filterNumberInput=mn,t.filterTrue=function(t){return t.pipe(N.filter((function(t){return!0===t})))},t.firstArrayValue=function(t){return Ne(t)?t[0]:void 0},t.firstFalsePromise=On,t.firstNotNil=wn,t.firstNotNilPromise=_n,t.firstTruePromise=In,t.focusInput=fn,t.focusNextInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&bn(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=En(e,Object.assign({minTabindex:o},n));return!!Ne(r)&&(r[0].focus(),!0)},t.focusPreviousInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&bn(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=En(e,Object.assign({maxTabindex:o},n));return!!Ne(r)&&(r[r.length-1].focus(),!0)},t.formatLatitude=Gn,t.formatLongitude=Hn,t.fromDateISOString=ao,t.fromScrollEndEvent=Rn,t.fromUnixMsTimestamp=function(t){return oo(t,"x")},t.fromUnixTimestamp=function(t){return oo(t,"X")},t.getCaretPosition=pn,t.getColorContrast=wi,t.getColorShade=function(t){return Ei("#000000",t,12)},t.getColorTint=function(t){return Ei("#ffffff",t,10)},t.getConnectionType=function(t){switch(t){case ut.Connection.NONE:return"none";case ut.Connection.ETHERNET:return"ethernet";case ut.Connection.WIFI:return"wifi";case ut.Connection.CELL:case ut.Connection.CELL_2G:case ut.Connection.CELL_3G:case ut.Connection.CELL_4G:return"cell";case ut.Connection.UNKNOWN:return"unknown";default:return"ethernet"}},t.getControlFromPath=Go,t.getFocusableInputElements=En,t.getFormErrors=$o,t.getFormValueFromEntity=Uo,t.getProperty=tn,t.getPropertyByPath=Ze,t.getPropertyByPathAsString=en,t.getRandomImage=vc,t.hexToRgb=function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},t.hexToRgbArray=vi,t.isControlHasInput=or,t.isEmptyArray=Fe,t.isInputElement=bn,t.isInstanceOf=zi,t.isInt=Ye,t.isNil=Ae,t.isNilOrBlank=Te,t.isNilOrNaN=function(t){return null==t||"number"==typeof t&&isNaN(t)},t.isNotEmptyArray=Ne,t.isNotNil=Re,t.isNotNilOrBlank=Pe,t.isNotNilOrNaN=De,t.isNotNilString=Me,t.isNumber=function(t){return Re(t)&&Xe.test(t)},t.isNumberRange=function(t){return Re(t)&&Je.test(t)},t.joinProperties=function(t,e,n){if(!t)throw new Error("Could not display an undefined entity.");return e.map((function(e){return tn(t,e)})).filter(Pe).join(n||" - ")},t.joinPropertiesPath=ze,t.logFormErrors=qo,t.markAllAsTouched=Yo,t.markAsUntouched=tr,t.markControlAsTouched=Jo,t.markFormGroupAsTouched=Xo,t.matchUpperCase=Ve,t.mergeLoadResult=function(t,e){var n,o,r;return{data:(n=t.data||[]).concat.apply(n,ke(e.data)),total:(t.total||(null===(o=t.data)||void 0===o?void 0:o.length)||0)+(e.total||(null===(r=e.data)||void 0===r?void 0:r.length)||0)}},t.mixHex=Ei,t.moveInputCaretToSeparator=hn,t.noTrailingSlash=qe,t.notNilOrDefault=function(t,e){return null!=t?t:e},t.nullIfUndefined=Le,t.parseLatitudeOrLongitude=Qn,t.propertiesPathComparator=Ke,t.propertyComparator=function(t,e){return function(n,o){var r=void 0!==n[t]?n[t]:e,i=o[t]?o[t]:e;return r===i?0:r>i?1:-1}},t.propertyPathComparator=function(t){return function(e,n){var o=Ze(e,t),r=Ze(n,t);return o===r?0:o>r?1:-1}},t.referentialToString=ss,t.referentialsToString=function(t,e,n){return(t||[]).map((function(t){return ss(t,e)})).join(n||", ")},t.remove=function(t,e){return t.slice().find((function(n,o){return!!e(n)&&(t.splice(o,1),!0)}))},t.removeAll=function(t,e){var n=0;return t.slice().map((function(o,r){return e(o)?(n++,t.splice(r-n+1,1)[0]):null})).filter(Re)},t.removeDiacritics=He,t.removeDuplicatesFromArray=function(t,e){return Fe(t)?t:e?t.filter((function(t,n,o){return o.findIndex((function(n){return n&&t&&n[e]===t[e]}))===n})):t.filter((function(t,e,n){return n.findIndex((function(e){return e&&t&&e===t}))===e}))},t.removeEnd=$e,t.removeValueInArray=Ko,t.replaceAll=function(t,e,n){for(;t&&-1!==t.indexOf(e);)t=t.replace(e,n);return t},t.resetCalculatedValue=ir,t.resizeArray=zo,t.rgbArrayToHex=yi,t.rgbToHex=function(t,e,n){return"#"+Ci(t)+Ci(e)+Ci(n)},t.round=on,t.scrollFactory=Rl,t.selectInputContent=un,t.selectInputRange=dn,t.setCalculatedValue=rr,t.setTabIndex=gn,t.sleep=nn,t.slideInOutAnimation=ea,t.slideUpDownAnimation=na,t.sort=function(t,e,n){if(Fe(t))return t;var o=n?new Intl.Collator(void 0,n).compare:function(t,e){return t===e?0:t>e?1:-1};return t.slice().sort((function(t,n){return o(t[e],n[e])}))},t.splitById=an,t.splitByProperty=function(t,e){return(t||[]).reduce((function(t,n){var o=null==n?void 0:n[e];return Re(o)&&(t[o]=n),t}),{})},t.startsWithUpperCase=Ue,t.suggestFromArray=We,t.suggestFromStringArray=function(t,e,n){return Te(e="string"==typeof e&&"*"!==e&&e.toUpperCase()||void 0)?t:-1!==e.indexOf("*")?(e=e.replace("*",".*"),t.filter((function(t){return Ve(t,e)}))):t.filter((function(t){return Ue(t,e)}))},t.tabindexComparator=vn,t.toBoolean=je,t.toDateISOString=io,t.toDuration=so,t.toFloat=function(t,e){return null!=t?parseFloat(t):e},t.toInt=function(t,e){return null!=t?parseInt(t,0):e},t.toNotNil=function(t,e){return null!=t?t:e},t.toNumber=Be,t.trimEmptyToNull=function(t){var e=t&&t.trim()||void 0;return e&&e.length&&e||null},t.uncapitalizeFirstLetter=function(t){return t&&0!==t.length?t.substr(0,1).toLowerCase()+t.substr(1):t},t.updateValueAndValidity=Zo,t.waitFor=kn,t.waitIdle=nr,t.waitWhilePending=er,t["ɵ0"]=Br,t["ɵa"]=Fl,t["ɵb"]=Yr,t["ɵc"]=li,t["ɵd"]=si,t["ɵe"]=cn,t["ɵf"]=sc,t["ɵg"]=Rc,t["ɵh"]=_c,t["ɵi"]=dc,t["ɵj"]=Oc,t["ɵk"]=Dc,t["ɵl"]=Yc,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
25
25
|
//# sourceMappingURL=sumaris-net.ngx-components.umd.min.js.map
|