@sumaris-net/ngx-components 1.19.20 → 1.19.21
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 +14 -5
- 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/form/entity-editor.class.js +8 -1
- package/esm2015/src/app/core/menu/menu.component.js +5 -5
- package/esm2015/src/app/shared/material/datetime/material.datetime.js +4 -2
- package/esm2015/src/app/shared/material/datetime/testing/mat-date-time.test.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +13 -5
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +1 -0
- package/sumaris-net.ngx-components.metadata.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=$t,ro=function(){function t(){}return t.min=function(t,e){return!t||e&&!t.isSameOrBefore(e)?e:t},t.max=function(t,e){return!t||e&&!t.isSameOrAfter(e)?e:t},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.resetTime=function(t,e,n){if(t){var o=ao(t);return e?o.clone().tz(e,n).startOf("day"):o.clone().startOf("day")}},t.isAtDay=function(t,e,n){return(t=t&&ao(t))?(n&&(t=t.clone().tz(n).startOf("day")),t.day()===e):null},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||j.isMoment(t))return t;var e=oo(t,Xt);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){return oo(t,"x")}function lo(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}}ro.toDateISOString=io,ro.fromDateISOString=ao,ro.toDuration=lo;var co=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=lo(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}();co.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new co(e.ɵɵinject(F.TranslateService))},token:co,providedIn:"root"}),co.decorators=[{type:e.Pipe,args:[{name:"duration"}]},{type:e.Injectable,args:[{providedIn:"root"}]}],co.ctorParameters=function(){return[{type:F.TranslateService}]};var uo=function(){function t(){}return t.prototype.transform=function(t){return null!=t?Math.abs(t):t},t}();uo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new uo},token:uo,providedIn:"root"}),uo.decorators=[{type:e.Pipe,args:[{name:"mathAbs"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var po=function(){function t(){}return t.prototype.transform=function(t){return t%2==0},t}();po.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new po},token:po,providedIn:"root"}),po.decorators=[{type:e.Pipe,args:[{name:"even"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ho=function(){function t(){}return t.prototype.transform=function(t){return t%2!=0},t}();ho.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ho},token:ho,providedIn:"root"}),ho.decorators=[{type:e.Pipe,args:[{name:"odd"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var mo=function(){function t(){}return t.prototype.transform=function(t){return null!=t&&t.length>0},t}();mo.decorators=[{type:e.Pipe,args:[{name:"isNotEmptyArray"}]}];var fo=function(){function t(){}return t.prototype.transform=function(t){return null==t||0===t.length},t}();fo.decorators=[{type:e.Pipe,args:[{name:"isEmptyArray"}]}];var go=function(){function t(){}return t.prototype.transform=function(t,e){e=e||{};var n=null==t?0:t.length;return pe(e.lessThan)?n<e.lessThan:pe(e.greaterThan)?n>e.greaterThan:!!pe(e.equals)&&n===e.equals},t}();go.decorators=[{type:e.Pipe,args:[{name:"isArrayLength"}]}];var bo=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length>0?t[0]:void 0},t}();bo.decorators=[{type:e.Pipe,args:[{name:"arrayFirst"}]}];var yo=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(pe)},t}();yo.decorators=[{type:e.Pipe,args:[{name:"arrayPluck"}]}];var vo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.includes(e)||!1},t}();vo.decorators=[{type:e.Pipe,args:[{name:"arrayIncludes"}]}];var Co=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.filter(e)},t}();Co.decorators=[{type:e.Pipe,args:[{name:"arrayFilter"}]}];var Eo=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}();Eo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Eo},token:Eo,providedIn:"root"}),Eo.decorators=[{type:e.Pipe,args:[{name:"mapGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var wo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.keys(t):null},t}();wo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wo},token:wo,providedIn:"root"}),wo.decorators=[{type:e.Pipe,args:[{name:"mapKeys"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Io=function(){function t(){}return t.prototype.transform=function(t){return t?Object.values(t):null},t}();Io.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Io},token:Io,providedIn:"root"}),Io.decorators=[{type:e.Pipe,args:[{name:"mapValues"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var xo=function(){function t(){}return t.prototype.transform=function(t){return he(t)},t}();xo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new xo},token:xo,providedIn:"root"}),xo.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 de(t)},t}();Oo.ɵprov=e.ɵɵ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=e.ɵɵ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 ko=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length||0},t}();ko.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ko},token:ko,providedIn:"root"}),ko.decorators=[{type:e.Pipe,args:[{name:"strLength"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var So=function(){function t(){}return t.prototype.transform=function(t,e,n){return(null==t?void 0:t.includes(e,n))||!1},t}();So.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new So},token:So,providedIn:"root"}),So.decorators=[{type:e.Pipe,args:[{name:"strIncludes"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var To=function(){function t(t){this.translate=t}return t.prototype.get=function(t,e,n){var o=this;if(!t||!ue(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||de(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(he).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=ae(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}();To.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new To(e.ɵɵinject(F.TranslateService))},token:To,providedIn:"root"}),To.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],To.ctorParameters=function(){return[{type:F.TranslateService}]};var Ao=function(){function t(t){this.translate=t}return t.prototype.transform=function(t,e,n){return t&&t.length?this.translate.instant(t,e,n):t},t}();Ao.decorators=[{type:e.Injectable},{type:e.Pipe,args:[{name:"translateContext"}]}],Ao.ctorParameters=function(){return[{type:To}]};var Ro=function(){function t(){}return t.prototype.transform=function(t){var e;return null===(e=ke(t))||void 0===e?void 0:e.toUpperCase()},t}();Ro.decorators=[{type:e.Pipe,args:[{name:"translatable"}]},{type:e.Injectable}];var Po=function(){function t(){}return t.prototype.transform=function(t,e){return Fe(t,e&&("string"==typeof e?e:e.key),e&&e.defaultValue)},t}();Po.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Po},token:Po,providedIn:"root"}),Po.decorators=[{type:e.Pipe,args:[{name:"propertyGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Do=function(){function t(){this.ngInit=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.ngInit.emit()},t}();Do.decorators=[{type:e.Directive,args:[{selector:"[ngInit]"}]}],Do.propDecorators={ngInit:[{type:e.Output}]};var No=$t,Mo=function(){function t(){}return t.getDoubleRegexp=function(t){if(ue(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.latitude=function(t){var e=t.value;return pe(e)&&(e<-90||e>90)?{latitude:!0}:null},t.longitude=function(t){var e=t.value;return pe(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 he(t.value)?{empty:!0}:null},t.pubkey=function(t){var e=t.value;return!e||"string"==typeof e&&Zt.test(e)?null:{pubkey:!0}},t.integer=function(t){if(de(t.value))return null;var e=parseFloat(t.value);return isNaN(e)||(0|e)!==e?{integer:!0}:null},t.decimal=function(t){var e=this.getDoubleRegexp(null==t?void 0:t.maxDecimals);return function(n){var o=n.value;return Number.isNaN(o)?null:pe(o)&&""!==o&&!e.test(o)?pe(null==t?void 0:t.maxDecimals)?{maxDecimals:{maxDecimals:t.maxDecimals}}:{decimal:!0}:null}},t.validDate=function(t){var e=t.value,n=!e||No.isMoment(e)?e:No(e,Xt);return n&&(!n.isValid()||n.year()<1970)?{validDate:!0}:null},t.dateIsAfter=function(t,e,n){return function(o){var r=ao(o.value);return pe(r)&&pe(t)&&r.isSameOrBefore(t,n)?{dateIsAfter:{minDate:e}}:null}},t.dateIsBefore=function(t,e,n){return function(o){var r=ao(o.value);return pe(r)&&pe(t)&&r.isSameOrAfter(t,n)?{dateIsBefore:{maxDate: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 pe(l)&&pe(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 pe(l)&&pe(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||ge(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}();Mo._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})?$/}},Mo.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",dateIsBefore:"ERROR.FIELD_NOT_VALID_DATE_BEFORE",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",double:"ERROR.FIELD_NOT_VALID_DOUBLE",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"},Mo.double=Mo.decimal;var Fo=function(){function t(){}return t.dateRange=function(t,e,n){var o=he(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 pe(i)&&pe(s)&&i.isAfter(s)?(a.markAsPending(),a.setErrors(Object.assign(Object.assign({},a.errors),r)),r):(Mo.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 pe(a)&&pe(l)&&Math.abs(a.diff(l,o))>n?(s.markAsTouched({onlySelf:!0}),s.markAsPending(),s.setErrors(Object.assign(Object.assign({},s.errors),r)),r):(Mo.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(pe(a)&&pe(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 Mo.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(de(o.value)&&he(r.value)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Mo.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(de(o.value)&&Ee(r.value,!1)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Mo.clearError(o,"required"),null}},t.requiredIfEmpty=function(t,e){return function(n){var o=n.get(t);if(de(o.value)&&de(n.get(e).value)){var r={required:!0};return o.setErrors(r),o.markAsTouched({onlySelf:!0}),r}return Mo.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(pe).map((function(t){return t(e)})).find(pe)||null}},t}(),Lo=function(){function t(){}return t.uniqueEntity=function(t){return function(e){var n,o,r=[];if(e.length){try{for(var i=ae(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 Mo.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=ae(n.controls),s=a.next();!s.done;s=a.next()){var l=s.value;l.controls[t]&&me(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 Mo.clearError(t,"sumMaxValue")})),null}},t}(),jo=function(){function t(){}return t.debounceTime=function(e,n){var o=(null==n?void 0:n.debug)||!1,r=o&&"[debounceTime-validator] #"+t.DEBOUNCE_TIME_VALIDATOR_ID+++" - ",i=we(null==n?void 0:n.debounceTime,250);o&&console.debug(r+"New validator with a debounceTime at "+i+"ms");var a=new D.Subject,s=(null==n?void 0:n.dispose)?D.merge(a,null==n?void 0:n.dispose):a;return o&&(null==n?void 0:n.dispose)&&(null==n||n.dispose.pipe(N.first()).subscribe((function(){console.debug(r+"Stopping")}))),function(t){var l;return o&&console.debug(r+"Form ask validation..."),a.next(),D.timer(i).pipe(N.tap((function(t){o&&(console.debug(r+"Executing..."),l=Date.now())})),N.switchMap((function(n){var o=e(t);return D.isObservable(o)?o:o instanceof Promise?D.from(o):D.of(o)})),N.tap((function(t){return o&&console.debug(r+"Finished in "+(Date.now()-l)+"ms ("+(t?"with errors":"no error")+")",t)})),N.catchError((function(t){throw console.error("[debounceTime-validator] Error while executing validator. Stopping job",t),a.next(),t})),N.tap((function(){return(null==n?void 0:n.markForCheck)&&(null==n?void 0:n.markForCheck())})),N.takeUntil(s))}},t.registerAsyncValidator=function(e,n,o){if(e.asyncValidator)throw Error("Form already have an async validator. Cannot configure job");var r=we(null==o?void 0:o.debounceTime,250),i=new D.Subject,a=t.debounceTime(n,Object.assign(Object.assign({},o),{debounceTime:r,dispose:i}));e.setAsyncValidators(a);var s=new D.Subscription;return s.add((function(){e.clearAsyncValidators(),setTimeout((function(){i.next(),i.unsubscribe()}),r)})),s},t}();function Bo(t,e,n){var o=Vo(t,e);e.patchValue(o,n)}function Vo(t,e){return qo(t,e)}function qo(t,e,n){var o=n?n+".":"";if(e instanceof P.FormGroup){var r={};for(var i in e.controls)r[i]=qo(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 fe(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 qo(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 j.isMoment(t)?io(t):Ce(t)}function Uo(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 Uo(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){Uo(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=Go(t,e);o&&o.disable(n)}))}function zo(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&&(ue(i.emitEvent)||i.emitEvent)&&(o(r)||t.markAsDirty()),a}function Wo(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?Bo({},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 dn((function(){return!0!==t.pending}),e)}function nr(t,e){return dn((function(){return!0!==t.loading}),e)}jo.DEBOUNCE_TIME_VALIDATOR_ID=0;var or=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}(),rr=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 dn((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}();rr.NULL_FORM=new or;var ir=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(Ee(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 zo(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 Wo(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(Lo.requiredArrayMinLength(1))))},t}(),ar=function(){function t(){}return t.isForm=function(t){return t instanceof rr||"dirty"in t&&"enabled"in t&&"valid"in t},t}();function sr(t,e){return t[e].value&&!Ee(t[e+ar.calculatedSuffix].value,!1)}function lr(t,e,n){t[e].setValue(Ve(n)),t[e+ar.calculatedSuffix].setValue(!0)}function cr(t,e){sr(t,e)||ar.setCalculatedValue(t,e,void 0)}ar.copyEntity2Form=Bo,ar.getFormValueFromEntity=Vo,ar.logFormErrors=Uo,ar.getControlFromPath=Go,ar.filterNumberInput=Ye,ar.disableControls=Ho,ar.selectInputContent=ze,ar.markAsTouched=Yo,ar.markAllAsTouched=Yo,ar.markAsUntouched=tr,ar.waitWhilePending=er,ar.waitIdle=nr,ar.updateValueAndValidity=Zo,ar.getFormErrors=$o,ar.addValueInArray=zo,ar.removeValueInArray=Ko,ar.resizeArray=Wo,ar.clearValueInArray=Qo,ar.calculatedSuffix="Calculated",ar.isControlHasInput=sr,ar.setCalculatedValue=lr,ar.resetCalculatedValue=cr;var ur=new e.InjectionToken("appFormErrorKeys"),dr=function(){function t(t,e){this.translate=t,this.errorI18nKeys=Object.assign(Object.assign({},Mo.I18N_ERROR_KEYS),e)}return t.prototype.translateFormErrors=function(t,e){var n=this;if(!t||!t.invalid)return"";var o=e&&e.separator||", ",r=!e||!1!==e.recursive,i=ar.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 ge(c)?r:(r.length&&(r+=o),r+l+": "+c.join(o))}var u=n.translateError(a,i[a]);return ue(u)?r:r+(r.length?o:"")+u}),"")},t.prototype.translateErrors=function(t,e){var n=this,o=e&&e.separator||", ";return t&&Object.keys(t).reduce((function(r,i){var a=t[i];if(a){var s=n.translateControlPath(i,e),l=Object.keys(a).map((function(t){return n.translateError(t,a[t])}));return ge(l)?r:(r.length&&(r+=o),r+s+": "+l.join(o))}var c=n.translateError(i,a);return ue(c)?r:r+(r.length?o:"")+c}),"")},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||"")+ke(t).toUpperCase();return this.translate.instant(n)},t.prototype.translateError=function(t,e){var n=this.errorI18nKeys[t]||"ERROR.FIELD_"+ke(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}();dr.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new dr(e.ɵɵinject(F.TranslateService),e.ɵɵinject(ur,8))},token:dr,providedIn:"root"}),dr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],dr.ctorParameters=function(){return[{type:F.TranslateService},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ur]}]}]};var pr=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&&$e(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.translateFormErrors(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}();pr.decorators=[{type:e.Pipe,args:[{name:"translateFormError",pure:!1}]}],pr.ctorParameters=function(){return[{type:dr},{type:e.ChangeDetectorRef}]};var hr=function(){function t(){}return t.prototype.transform=function(t,e){return t.get(e)},t}();hr.decorators=[{type:e.Pipe,args:[{name:"formGet"}]}];var mr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();mr.decorators=[{type:e.Pipe,args:[{name:"formGetControl"}]}];var fr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();fr.decorators=[{type:e.Pipe,args:[{name:"formGetArray"}]}];var gr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();gr.decorators=[{type:e.Pipe,args:[{name:"formGetGroup"}]}];var br=function(){function t(t,e){this.adapter=t,this._ref=e,this.value=void 0,this._lastControl=null}return t.prototype.transform=function(t,e){var n=this;if(t){if(t===this._lastControl&&$e(e,this._lastPath))return this.value;this._lastControl=t,this._lastPath=e;var o=e?t.get(e):t;return this.value=null==o?void 0:o.value,this._dispose(),!this._onControlValueChanges&&o&&(this._onControlValueChanges=o.valueChanges.subscribe((function(t){n.value=t,n._ref.markForCheck()}))),this.value}this._dispose()},t.prototype.ngOnDestroy=function(){this._dispose()},t.prototype._dispose=function(){void 0!==this._onControlValueChanges&&(this._onControlValueChanges.unsubscribe(),this._onControlValueChanges=void 0)},t}();br.decorators=[{type:e.Pipe,args:[{name:"formGetValue",pure:!1}]}],br.ctorParameters=function(){return[{type:dr},{type:e.ChangeDetectorRef}]};var yr=function(){};yr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule],declarations:[Po,Fn,jn,co,Bn,Zn,Xn,Jn,eo,to,no,uo,ho,po,mo,fo,go,bo,yo,vo,Co,Eo,wo,Io,Oo,xo,_o,ko,So,Ao,Ro,Do,pr,hr,mr,fr,gr,br],exports:[Po,Fn,Bn,jn,co,Zn,Xn,Jn,eo,to,no,uo,ho,po,mo,fo,go,bo,yo,Eo,wo,Io,Oo,xo,_o,ko,So,vo,Co,Ao,Ro,Do,pr,hr,mr,fr,gr,br]}]}];var vr=function(){function t(t,e,n){this.keyboard=n,this._timer=null,this._elementRef=e,this.shouldFocusElement="",this._timer=null,this.timerDelay=100,this._mobile=Rn(window)}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._mobile&&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}();vr.decorators=[{type:e.Directive,args:[{selector:"[autofocus], input[appAutofocus]",inputs:["shouldFocusElement: appAutofocus","timerDelay: autofocusDelay"]}]}],vr.ctorParameters=function(){return[{type:L.Platform},{type:e.ElementRef},{type:V.Keyboard,decorators:[{type:e.Optional}]}]};var Cr=function(){function t(t,e){this.templateRef=t,this.vcRef=e,this.context={$implicit:null,ngVar:null},this.hasView=!1}return Object.defineProperty(t.prototype,"ngVar",{set:function(t){this.context.$implicit=this.context.ngVar=t,this.hasView||(this.vcRef.createEmbeddedView(this.templateRef,this.context),this.hasView=!0)},enumerable:!1,configurable:!0}),t}();Cr.decorators=[{type:e.Directive,args:[{selector:"[ngVar]"}]}],Cr.ctorParameters=function(){return[{type:e.TemplateRef},{type:e.ViewContainerRef}]},Cr.propDecorators={ngVar:[{type:e.Input}]};var Er=function(){function t(){this.fileDropped=new e.EventEmitter}return t.prototype.onDragOver=function(t){t.preventDefault(),t.stopPropagation(),this.fileOver=!0},t.prototype.onDragLeave=function(t){t.preventDefault(),t.stopPropagation(),this.fileOver=!1},t.prototype.ondrop=function(t){var e;t.preventDefault(),t.stopPropagation(),this.fileOver=!1;var n=null===(e=t.dataTransfer)||void 0===e?void 0:e.files;fe(n)&&this.fileDropped.emit(n)},t}();Er.decorators=[{type:e.Directive,args:[{selector:"[appDragAndDrop]"}]}],Er.propDecorators={fileOver:[{type:e.HostBinding,args:["class.fileover"]}],fileDropped:[{type:e.Output}],onDragOver:[{type:e.HostListener,args:["dragover",["$event"]]}],onDragLeave:[{type:e.HostListener,args:["dragleave",["$event"]]}],ondrop:[{type:e.HostListener,args:["drop",["$event"]]}]};var wr=function(){};wr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule],declarations:[vr,Cr,Er],exports:[vr,Cr,Er]}]}];var Ir=function(){};Ir.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,a.ScrollingModule,P.ReactiveFormsModule,yr,wr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,F.TranslateModule.forChild()],exports:[R.MatAutocompleteModule,Mn],declarations:[Mn]}]}];function xr(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 Or(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 _r={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/,"°"]}},kr=function(){},Sr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=kr,this._onTouchedCallback=kr,this._subscription=new D.Subscription,this.disabling=!1,this.writing=!1,this._readonly=!1,this.required=!1,this.floatLabel="auto",this.maxDecimals=3,this.placeholderChar=Jt,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter}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=_r[this.type]&&_r[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=_r[this.type][this.pattern]),"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):ue(this.maxDecimals)?this.maxDecimals=2:this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):2!==this.maxDecimals&&(console.warn("Invalid attribute 'maxDecimals' - Expected value: 2 but get: "+this.maxDecimals+". Other value not implemented."),this.maxDecimals=2),this.showSignControl="DD"!==this.pattern,this._formatFn="latitude"===this.type?Gn:Hn,this._formatOptions={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?Mo.latitude:Mo.longitude]):this.formControl.setValidators("latitude"===this.type?Mo.latitude:Mo.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._formatOptions),{placeholderChar:this.placeholderChar})),n=pe(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._format=function(t,e){return this._formatFn(t,Object.assign(Object.assign({},this._formatOptions),{hideSign:!1,placeholderChar:""}))},t.prototype._onFocus=function(t){var e=this;if(ue(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._formatOptions),{placeholderChar:this.placeholderChar}));o=o&&o.replace("1",this.placeholderChar),setTimeout((function(){e.inputElement.nativeElement.value=o;var n="latitude"===e.type?2:1;We(t.target,n)}),250)}else this.signFormControl.setValue(n)}}else ze(t);return this.onFocus.emit(t),!0},t.prototype._onBlur=function(t){this.checkIfTouched()&&ue(this.value)&&(this.inputElement.nativeElement.value=""),this.onBlur.emit(t)},t.prototype.moveCaretToSeparator=function(t,e){return Qe(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)Qe(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=Ke(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,We(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.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=he(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=pe(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.markForCheck=function(){this.cd.markForCheck()},t}();Sr.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>{{_format(value) }}</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 matSuffix *ngIf="!showSignControl">\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper">\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'latitude\'" translate>ERROR.FIELD_NOT_VALID_LATITUDE</mat-error>\n <mat-error *ngSwitchCase="\'longitude\'" translate>ERROR.FIELD_NOT_VALID_LONGITUDE</mat-error>\n <mat-error *ngSwitchCase="\'min\'">{{\'ERROR.FIELD_MIN_COMPACT\'|translate: {min: _format(formControl.errors.min.min) } }}</mat-error>\n <mat-error *ngSwitchCase="\'max\'">{{\'ERROR.FIELD_MAX_COMPACT\'|translate: {max: _format(formControl.errors.max.max) } }}</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 </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 <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 Sr}))}],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:40px;max-width:55px}mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;white-space:nowrap;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%}"]}]}],Sr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Sr.propDecorators={formControl:[{type:e.Input}],formControlName:[{type:e.Input}],type:[{type:e.Input}],pattern:[{type:e.Input,args:["latLongPattern"]}],required:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],tabindex:[{type:e.Input}],defaultSign:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],readonly:[{type:e.Input}],onBlur:[{type:e.Output}],onFocus:[{type:e.Output}],inputElement:[{type:e.ViewChild,args:["inputElement"]}]};var Tr=function(){};Tr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,q.TextMaskModule,F.TranslateModule.forChild(),v.MatSelectModule],exports:[Sr],declarations:[Sr]}]}];var Ar={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Dr})),multi:!0},Rr=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],Pr=function(){},Dr=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=Pr,this._onTouchedCallback=Pr,this._subscription=new D.Subscription,this._writing=!0,this._disabling=!1,this._readonly=!1,this.mask=Rr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=Jt,this.autofocus=!1,this.startDate=null,this.clearable=!1,this.timezone=null,this.locale=(e.currentLang||e.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.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-field>.");this.mobile=pe(this.mobile)?this.mobile:Rn(window),this._keyboardHideDelay=this.mobile?te:0,this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Mo.validDate]:[this.formControl.validator,Mo.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Mo.validDate]:Mo.validDate),this.textControl=this.formBuilder.control(null,(function(){return t.formControl.errors})),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.textControl.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(){t.textControl.updateValueAndValidity({emitEvent:!1}),t.formControl.touched&&!t.textControl.touched&&t.textControl.markAsTouched(),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=j.isMoment(t)?t.clone():ao(t);if(e&&e.isValid()){e=(this.timezone&&e.tz(this.timezone)||e).startOf("day");var n=this.dateAdapter.format(e,this.datePattern);this.textControl.value!==n&&this.textControl.patchValue(n,{emitEvent:!1})}else this.textControl.patchValue(null,{emitEvent:!1}),this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null));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.textControl.disable({emitEvent:!1}):this.textControl.enable({emitEvent:!1}),this._disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||j.isMoment(t.value))){var e=null;if(t.value){var n=t.value.locale(this.locale).minute(0).seconds(0).millisecond(0).utc(!0);e=this.dateAdapter.format(n,this.datePattern)||null}this.textControl.value!==e&&this.textControl.setValue(e,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.openDatePickerIfMobile=function(t,e){return re(this,void 0,void 0,(function(){return ie(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];He(e)&&e.focus()}))},t.prototype.clear=function(){this.textControl.patchValue(null,{emitEvent:!1}),this.formControl.setValue(null,{emitEvent:!1}),this._onChangeCallback(null),this.markAsTouched(),this.markAsDirty()},t.prototype.updatePattern=function(t){t="COMMON.DATE_PATTERN"!==t?t:"L",this.datePattern!==t&&(this.datePattern=t,this.markForCheck())},t.prototype.checkIfTouched=function(t){this.textControl.touched&&(this._onTouchedCallback(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.onFormChange=function(t){if(!this._writing){if(this._writing=!0,t){for(;-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");t=t.replace("//","/0/").replace(/\/$/,"/0")}var e=he(t)&&this.dateAdapter.parse(t,this.datePattern)||null,n=(e=(e=e&&(this.timezone?e.tz(this.timezone,!0):e)||null)&&e.startOf("day").utc()||null)&&e.isValid()?io(e):t||null;this.formControl.value!==n&&(this._onChangeCallback(n),this.checkIfTouched()),this.textControl.updateValueAndValidity(),this._writing=!1}},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this._keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(t){this.textControl.markAsTouched(t),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Dr.decorators=[{type:e.Component,args:[{selector:"mat-date-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: datePattern} }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\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]="textControl"\n [textMask]="{mask: mask, 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]="textControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final input --\x3e\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n [matDatepickerFilter]="datePickerFilter"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix\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)="clear()"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngSwitchCase="\'dateIsAfter\'">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngSwitchCase="\'dateIsBefore\'">{{\'ERROR.FIELD_NOT_VALID_DATE_BEFORE\' | translate: formControl.errors.dateIsBefore }}</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 </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"\n ></mat-datepicker>\n\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:[Ar],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:B.MomentDateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Dr.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}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],timezone:[{type:e.Input}],datePickerFilter:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Nr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Br})),multi:!0},Mr=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],Fr=/^[012][0-9][:][012345][0-9]$/,Lr=[/[012]/,/\d/,":",/[012345]/,/\d/],jr=function(){},Br=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=jr,this._onTouchedCallback=jr,this._subscription=new D.Subscription,this._writing=!0,this._disabling=!1,this._readonly=!1,this.dayMask=Mr,this.hourMask=Lr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=Jt,this.autofocus=!1,this.startDate=null,this.clearable=!1,this.locale=(e.currentLang||e.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.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.mobile=pe(this.mobile)?this.mobile:Rn(window),this._keyboardHideDelay=this.mobile?te:0,this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Mo.validDate]:[this.formControl.validator,Mo.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Mo.validDate]:Mo.validDate),this.dayControl=this.formBuilder.control(null),this.hourControl=this.formBuilder.control(null,this.mobile?null:P.Validators.pattern(Fr)),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.dayControl.valueChanges,this.hourControl.valueChanges).subscribe((function(e){return t.onFormChange()}))),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.dayControl.patchValue(o,{emitEvent:!1}),this.hourControl.patchValue(a,{emitEvent:!1})}else this.dayControl.patchValue(null,{emitEvent:!1}),this.hourControl.patchValue(null,{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.dayControl.disable({emitEvent:!1}),this.hourControl.disable({emitEvent:!1})):(this.dayControl.enable({emitEvent:!1}),this.hourControl.enable({emitEvent:!1})),this._disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||j.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.dayControl.value!==n&&this.dayControl.setValue(n,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.onTimePickerChange=function(t){this.hourControl.value!==t&&this.hourControl.setValue(t,{emitEvent:!0})},t.prototype.openDatePickerIfMobile=function(t,e){return re(this,void 0,void 0,(function(){return ie(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.openTimePickerIfMobile=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!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.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];He(e)&&e.focus()}))},t.prototype.clear=function(){this.formControl.setValue(null),this.markAsTouched(),this.markAsDirty()},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.checkIfTouched=function(){(this.dayControl.touched||this.hourControl.touched)&&(this._onTouchedCallback(),this.markForCheck())},t.prototype.onFormChange=function(){if(!this._writing){this._writing=!0;var t=this.dayControl.value,e=this.hourControl.value,n=de(e)!==de(t);if(n||this.dayControl.invalid||this.hourControl.invalid)return this.formControl.markAsPending({onlySelf:!0}),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({validDate:n},this.formControl.errors),this.dayControl.errors),this.hourControl.errors)),this.formControl.markAsDirty(),void(this._writing=!1);for(;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var o=t&&this.dateAdapter.parse(t,this.dayPattern)||null,r=(e||"").split(":"),i=parseInt(r[0]||0),a=parseInt(r[1]||0),s=o&&o.locale(this.locale).hour(i).minute(a).seconds(0).millisecond(0).utc();this.emitChange(s),this._writing=!1}},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this._keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.emitChange=function(t){var e=io(t)||null;this.formControl.value!==e&&(this._onChangeCallback(e),this.checkIfTouched())},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(t){this.dayControl.markAsTouched(t),this.hourControl.markAsTouched(t),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Br.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]="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 input --\x3e\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n [matDatepickerFilter]="datePickerFilter"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix\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)="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="\'dateIsBefore\'">{{\'ERROR.FIELD_NOT_VALID_DATE_BEFORE\' | translate: formControl.errors.dateIsBefore }}</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 && (hourControl.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]="hourControl"\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]="hourControl"\n (click)="openTimePickerIfMobile($event)"\n readonly>\n\n <input matInput type="text"\n [formControl]="hourControl"\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:[Nr],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%}"]}]}],Br.ctorParameters=function(){return[{type:B.MomentDateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Br.propDecorators={formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePickerFilter:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],timePicker:[{type:e.ViewChild,args:["timePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Vr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return $r})),multi:!0},qr=[/\d/,/\d/,/\d/,/\d/],Ur=function(){},$r=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=Ur,this._onTouchedCallback=Ur,this.writing=!0,this.disabling=!1,this.dayMask=qr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=Jt,this.clearable=!1,this.locale=(e.currentLang||e.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-short-field>.");this.mobile=pe(this.mobile)?this.mobile:Rn(window),this.keyboardHideDelay=this.mobile?te:0;var e=new D.BehaviorSubject(null);this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?P.Validators.compose([P.Validators.required,Mo.validDate]):Mo.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(de(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,Xt),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,Xt)||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(Xt).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(),Xt);var n=e&&e.isValid()&&e.format(Xt).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 re(this,void 0,void 0,(function(){return ie(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];He(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();$r.decorators=[{type:e.Component,args:[{selector:"mat-date-short-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE</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 <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[Vr],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%}"]}]}],$r.ctorParameters=function(){return[{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},$r.propDecorators={mobile:[{type:e.Input}],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 Gr=function(){};Gr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,$.MatDatepickerModule,B.MatMomentDateModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,F.TranslateModule.forChild(),wr],exports:[g.MatIconModule,Dr,Br,$r],declarations:[Dr,Br,$r]}]}];var Hr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Qr})),multi:!0},zr=/[0-9]\d\d:[0-5]\d/,Wr=[/\d/,/\d/,/\d/,":",/[0-5]/,/\d/],Kr=function(){},Qr=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=Kr,this._onTouchedCallback=Kr,this.writing=!0,this.disabling=!1,this.hourMask=Wr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.maxDecimals=2,this.placeholderChar=Jt,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-duration-field>.");this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.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(zr)]:[function(){return e.getValue()},P.Validators.pattern(zr)]),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(ue(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 "+xr(this._value)),this.textControl.patchValue(xr(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=Or(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];He(e)&&e.focus()}))},t.prototype.moveCaretToSeparator=function(t,e){return Qe(t,":",e)},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Qr.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:[Hr],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%}"]}]}],Qr.ctorParameters=function(){return[{type:L.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Qr.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 Yr=function(){};Yr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,s.MatRippleModule,B.MatMomentDateModule,F.TranslateModule.forChild()],exports:[Qr],declarations:[Qr]}]}];var Xr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Zr})),multi:!0},Jr=function(){},Zr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=Jr,this._onTouchedCallback=Jr,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=we(this.buttonsColCount,2)),this.showRadio=this.showRadio||"always"===this.floatLabel,this.updateTabIndex()},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||pe(this._value),pe(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(){ue(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}();Zr.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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n </mat-form-field>\n </ng-container>\n\n</ng-template>\n\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[Xr],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}"]}]}],Zr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Zr.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"]}]};var ti=function(){};ti.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,k.MatRadioModule,h.MatCheckboxModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,F.TranslateModule.forChild()],exports:[Zr],declarations:[Zr]}]}];var ei,ni=[[{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"}]],oi=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.inputTarget=n&&n.target,o}return ne(e,t),e}(KeyboardEvent);(ei=t.AnimationState||(t.AnimationState={})).ENTER="enter",ei.ENTER_INPUT="enter-input",ei.LEAVE="leave";var ri=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 oi("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}();ri.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:[M.trigger("numpadBackdrop",[M.state("*",M.style({opacity:0,background:"transparent"})),M.state(t.AnimationState.ENTER,M.style({opacity:1})),M.state(t.AnimationState.LEAVE,M.style({opacity:0})),M.transition("* => "+t.AnimationState.ENTER,[M.style({opacity:0}),M.animate("0.4s cubic-bezier(0.25, 0.8, 0.25, 1)")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.style({opacity:1}),M.animate("0.2s cubic-bezier(0.25, 0.8, 0.25, 1)")])]),M.trigger("numpadFadeIn",[M.state("*",M.style({opacity:1,transform:"scale(1)"})),M.state(t.AnimationState.ENTER,M.style({opacity:1,transform:"scale(1)"})),M.state(t.AnimationState.LEAVE,M.style({opacity:0,transform:"scale(0.9)"})),M.transition("* => "+t.AnimationState.ENTER,[M.style({opacity:0,transform:"scale(0.6)"}),M.animate("0.2s ease-out")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.animate("0.2s ease-out")])]),M.trigger("numpadPanelExpansion",[M.state("*",M.style({opacity:1,transform:"scaleY(0) translateY(-50%)"})),M.state(t.AnimationState.ENTER,M.style({opacity:1,transform:"scale(1) translateY(0)"})),M.state(t.AnimationState.LEAVE,M.style({opacity:0,transform:"scale(1) translateY(0)"})),M.transition("* => "+t.AnimationState.ENTER,[M.animate("0.2s ease-out")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.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)}"]}]}],ri.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},ri.propDecorators={onKeydown:[{type:e.HostListener,args:["window:keydown",["$event"]]}]};var ii=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}();ii.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ii(e.ɵɵinject(e.ComponentFactoryResolver),e.ɵɵinject(e.ApplicationRef),e.ɵɵinject(e.INJECTOR),e.ɵɵinject(n.DOCUMENT,8))},token:ii,providedIn:"root"}),ii.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ii.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 ai=function(){function t(t){this.domService=t,this._opened=!1,this.keymap=ni,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(ri,{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}();ai.decorators=[{type:e.Component,args:[{selector:"mat-numpad",template:""}]}],ai.ctorParameters=function(){return[{type:ii}]},ai.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 si=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}();si.decorators=[{type:e.Directive,args:[{selector:"[matNumpad]",providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:si,multi:!0}],host:{"[disabled]":"disabled","(click)":"onClick($event)","(change)":"updateValue($event.target.value)","(blur)":"onTouched()"}}]}],si.ctorParameters=function(){return[{type:e.ElementRef}]},si.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 li=function(){};li.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'}]}],li.propDecorators={appendToInput:[{type:e.Input}],inputElement:[{type:e.Input}]};var ci=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}();ci.decorators=[{type:e.Directive,args:[{selector:"[appendNumpadToInput]"}]}],ci.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},ci.propDecorators={inputElement:[{type:e.Input,args:["appendNumpadToInput"]}],changePosition:[{type:e.HostListener,args:["window:scroll"]}]};var ui=function(){};ui.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild()],exports:[ai,si,ri,li,ci],declarations:[ri,ai,li,si,ci]}]}];var di={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return pi})),multi:!0},pi=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.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.selectInputContent=ze}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&&Ae(e,t.displayAttributes)},this.equals=this.equals||function(t,e){return t&&e&&t.id===e.id},this.mobile=pe(this.mobile)?this.mobile:Rn(window)},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()})),ue(this._value)&&(this.slideTo(0),this.slideChanged()),this.markForCheck()},t.prototype.updateTabIndex=function(){ue(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.equals(t,this._value)||(this._value=t,this.showSlides=pe(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.equals(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 re(this,void 0,void 0,(function(){var t;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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,ln(this.$loaded.pipe(N.filter((function(t){return!0===t}))))]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}();pi.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:[di],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}"]}]}],pi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},pi.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}],equals:[{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"]}],blurred:[{type:e.Output,args:["blur"]}],focused:[{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 hi=function(){};hi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild(),d.MatFormFieldModule,P.ReactiveFormsModule,p.MatInputModule],exports:[pi],declarations:[pi]}]}];var mi=function(){},fi=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=mi,this._onTouchedCallback=mi,this.logPrefix="[mat-chips] ",this.formControlName=null,this.required=!1,this.readonly=!1,this.clearable=!1,this.debounceTime=null,this.i18nPrefix="REFERENTIAL.",this.noResultMessage="COMMON.NO_RESULT",this.itemSize="48px",this.fetchMoreThreshold="15%",this.suggestLengthThreshold=null,this.showLoadingSpinner=!0,this.chipColor=null,this.debug=!1,this.clicked=new e.EventEmitter,this.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.dropButtonClick=new e.EventEmitter(!0),this.keydownEscape=new e.EventEmitter,this.keyupEnter=new e.EventEmitter,this.$inputItems=new D.BehaviorSubject(void 0),this.$filteredItems=new D.BehaviorSubject(void 0),this.inputControl=new P.FormControl,this._fetchMore$=new e.EventEmitter,this._subscription=new D.Subscription,this._$filter=new D.BehaviorSubject(void 0),this._reload$=new D.Subject}return Object.defineProperty(t.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canFetchMore",{get:function(){return this._onFetchMoreCallback&&this._moreItemsCount>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._$filter.value},set:function(t){t!==this._$filter.value&&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",{get:function(){return this.$inputItems},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.$inputItems.next(t)}))):t!==this.$inputItems.value&&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}),Object.defineProperty(t.prototype,"loading",{get:function(){return ue(this.$filteredItems.value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t,e,n=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>.");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.equals=this.equals||this.config.equals,this.mobile=Ee(this.mobile,this.config.mobile),this.suggestLengthThreshold=we(this.suggestLengthThreshold,this.config.suggestLengthThreshold||0),this.showAllOnFocus=Ee(this.showAllOnFocus,Ee(this.config.showAllOnFocus,this.suggestLengthThreshold<=0)),this.showPanelOnFocus=Ee(this.showPanelOnFocus,Ee(this.config.showPanelOnFocus,!0)),this.classList=this.classList||this.config.class,this.debounceTime=we(this.debounceTime,this.config.debounceTime),this.highlightAccent=Ee(this.highlightAccent,Ee(this.config.highlightAccent))),this.displayAttributes=this.displayAttributes||(null===(t=this.filter)||void 0===t?void 0:t.attributes)||["label","name"],this.displayWith=this.displayWith||function(t){return t&&Ae(t,n.displayAttributes)},this.displayColumnSizes=this.displayColumnSizes||1===this.displayAttributes.length&&[void 0]||this.displayAttributes.map((function(t){return t&&(t.endsWith("label")?3:t.endsWith("rankOrder")?2:void 0)})),this.displayColumnNames=this.displayAttributes.map((function(t,e){return n.displayColumnNames&&n.displayColumnNames[e]||n.i18nPrefix+ke(t).toUpperCase()})),this.mobile=Ee(this.mobile,!1),this.equals=this.equals||function(t,e){return t&&e&&t.id===e.id};var o=null===(e=this.classList)||void 0===e?void 0:e.split(" ");if(this.panelWidth=this.panelWidth||o&&((o.includes("min-width-medium")?"300px":o.includes("min-width-large")&&"400px")||o.includes("min-width-xlarge")&&"450px"||o.includes("mat-autocomplete-panel-full-size")&&"100vw"),this.showPanelOnFocus=Ee(this.showPanelOnFocus,!0),this.debounceTime=we(this.debounceTime,250),this.highlightAccent=Ee(this.highlightAccent,!1),this.suggestLengthThreshold=this.suggestLengthThreshold||0,this.matAutocompletePosition=this.matAutocompletePosition||(this.mobile?"above":"auto"),!this.suggestFn){var r=function(t,e){return re(n,void 0,void 0,(function(){return ie(this,(function(n){return[2,Te(this.$inputItems.value,t,Object.assign({searchAttributes:this.displayAttributes},e))]}))}))};this.suggestFn=function(t,e){return re(n,void 0,void 0,(function(){return ie(this,(function(n){switch(n.label){case 0:return ue(this.$inputItems.value)?[4,ln(this.$inputItems)]:[3,2];case 1:n.sent(),n.label=2;case 2:return this.suggestFn=r,[2,this.suggestFn(t,e)]}}))}))}}var i=function(t){return de(t)||"*"===t?n.suggestLengthThreshold<=0:!("string"==typeof t)||t.length>=n.suggestLengthThreshold},a=D.merge(this._reload$,this.inputControl.valueChanges.pipe(N.filter((function(t){return n.enabled&&ye(t)})),N.tap((function(t){return n.showLoadingSpinner&&n.markAsLoading()})),N.filter((function(t){return t.length>=n.suggestLengthThreshold})),N.debounceTime(this.debounceTime)),this.inputControl.valueChanges.pipe(N.startWith(this.inputControl.value),N.filter((function(t){return pe(t)&&"object"==typeof t}))),this.dropButtonClick.pipe(N.filter((function(t){return n.enabled&&(!t||!t.defaultPrevented)})),N.tap((function(t){return n.matInputText.nativeElement.focus()})),N.map((function(t){return n.showAllOnFocus?"*":n.formControl.value})),N.filter(i)),D.merge(D.merge(this.focused,this.clicked).pipe(N.filter((function(t){return n.enabled})),N.map((function(t){return n.showAllOnFocus?"*":n.inputControl.value}))),D.merge(this.$inputItems,this._$filter).pipe(N.filter((function(t){return n.enabled})),N.map((function(t){return n.inputControl.value})))).pipe(N.filter(i),N.distinctUntilChanged((function(t,e){return!n.loading&&(t===e||n.equals(t,e))})))).pipe(N.mergeMap((function(t){return n.suggest(t,n.filter)})),N.tap((function(t){return n.updateImplicitValue(t)}))),s=this._fetchMore$.pipe(N.tap((function(t){return null==t?void 0:t.preventDefault()})),N.filter((function(){return n.canFetchMore})),N.mergeMap((function(){return n.fetchMore()})),N.map((function(t){return(n.$filteredItems.value||[]).concat(t)})));this._subscription.add(D.merge(this.$inputItems,a,s).subscribe((function(t){return n.$filteredItems.next(t)}))),this._subscription.add(this.blurred.pipe(N.map((function(t){return n.formControl.value}))).subscribe((function(t){n._implicitValue&&(n.required&&de(t)||he(t)&&"object"!=typeof t)?(n.writeValue(n._implicitValue),n.formControl.markAsPending({emitEvent:!1,onlySelf:!0}),n.formControl.updateValueAndValidity({emitEvent:!1,onlySelf:!0}),n.checkIfTouched(),n.$filteredItems.next([n._implicitValue])):de(t)&&(n.writeValue(null),n.formControl.markAsPending({emitEvent:!1,onlySelf:!0}),n.formControl.updateValueAndValidity({emitEvent:!1,onlySelf:!0}),n.checkIfTouched(),n.$filteredItems.next(void 0)),n._implicitValue=null,n.closePanel()}))),this._subscription.add(this.formControl.statusChanges.pipe(N.distinctUntilChanged()).subscribe((function(){return n.checkIfTouched()}))),this._subscription.add(this.keydownEscape.subscribe((function(t){n.isOpen&&(null==t||t.stopPropagation(),null==t||t.preventDefault(),n.closePanel())})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._openedSubscription&&this._openedSubscription.unsubscribe(),this.$inputItems.complete(),this.$inputItems.unsubscribe(),this.$filteredItems.complete(),this.$filteredItems.unsubscribe(),this._reload$.complete(),this._$filter.complete(),this.dropButtonClick.complete(),this.clicked.complete(),this.blurred.complete(),this.focused.complete(),this.keydownEscape.complete(),this.keyupEnter.complete(),this._fetchMore$.complete(),this._implicitValue=void 0,this.formControl=null,this.displayWith=null,this.equals=null,this.suggestFn=null,this.$filteredItems=null,this.config=null,this.classList=null,this._onChangeCallback=null,this._onTouchedCallback=null,this._onFetchMoreCallback=null,this.autocomplete&&this.autocomplete.ngOnDestroy()},t.prototype.add=function(t){this.debug&&console.debug(this.logPrefix+"select",t);var e=t.option.value;this.writeValue(le(this.value,[e])),this.matInputText.nativeElement.value="",this.inputControl.setValue("")},t.prototype.remove=function(t){var e=this.value,n=e?e.indexOf(t):-1;if(-1!==n){var o=e.slice();o.splice(n,1),this.writeValue(o),this.closePanel()}},t.prototype.reloadItems=function(t){this._reload$.next(t||"*")},t.prototype.writeValue=function(t){t&&!Array.isArray(t)&&(t=[t]),t!==this.formControl.value?(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)):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;t&&(null===(e=this.autocomplete)||void 0===e?void 0:e.isOpen)&&this.closePanel(),this.cd.markForCheck()},t.prototype.focus=function(){Xe(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,!1):!!(!ze(t)||this.showPanelOnFocus&&this.showAllOnFocus)&&(this.focused.emit(t),!0)},t.prototype.filterInputTextBlurEvent=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,!1):(We(t.target,0,0),this.blurred.emit(t),!0)},t.prototype.filterChipsFocusEvent=function(t){this.debug&&console.debug(this.logPrefix+" Focus in chips list",t),this.matInputText.nativeElement.focus()},t.prototype.clearValue=function(t){this.writeValue(null),t.stopPropagation()},t.prototype._initAutocompleteInfiniteScroll=function(t){var e=this;if(this.autocomplete){this._openedSubscription&&(this._openedSubscription.unsubscribe(),this._subscription.remove(this._openedSubscription));var n=(this.autocomplete._isOpen?D.timer(0):this.autocomplete.opened.pipe(N.debounceTime(200))).pipe(N.map((function(t){return e.getAutocompletePanel()})),N.filter(pe),N.switchMap((function(n){return gn(n,t).pipe(N.takeUntil(e.autocomplete.closed))})));this._openedSubscription=n.subscribe((function(){return e._fetchMore$.emit()})),this._subscription.add(this._openedSubscription)}},Object.defineProperty(t.prototype,"isOpen",{get:function(){var t;return(null===(t=this.autocomplete)||void 0===t?void 0:t.isOpen)||!1},enumerable:!1,configurable:!0}),t.prototype.closePanel=function(){var t,e;(null===(t=this.autocomplete)||void 0===t?void 0:t.isOpen)&&(null===(e=this.autocompleteTrigger)||void 0===e||e.closePanel())},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l=this;return ie(this,(function(c){switch(c.label){case 0:return[4,this.suggestFn(t,e)];case 1:return(n=c.sent())?Array.isArray(n)?(n=n,this._itemCount=n.length||0):(o=n.data,r=n.total,i=n.fetchMore,this._itemCount=we(r,o&&o.length||0),this._onFetchMoreCallback=i,this._moreItemsCount=i&&this._itemCount-o.length||0,n=o):(this._itemCount=0,n=[]),a=(n||[]).slice().filter((function(t){return-1===l.value.findIndex((function(e){return l.equals(t,e)}))})),s=((null==n?void 0:n.length)||0)-((null==a?void 0:a.length)||0),this._itemCount-=s,this.debug&&console.debug(this.logPrefix+" Filtered items by suggestFn:",t,n),[2,n]}}))}))},t.prototype.fetchMore=function(){return re(this,void 0,void 0,(function(){var t,e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return this._onFetchMoreCallback?(t=this._onFetchMoreCallback,this._onFetchMoreCallback=void 0,[4,t()]):[2,[]];case 1:return e=i.sent(),n=e.data,o=e.total,r=e.fetchMore,this._itemCount=o||this._itemCount,this._onFetchMoreCallback=r,this._moreItemsCount=Math.max(0,this._moreItemsCount-n.length),[2,n]}}))}))},t.prototype.updateImplicitValue=function(t){t&&1===t.length?this._implicitValue=t[0]:this._implicitValue=void 0},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.cd.markForCheck(),this._onTouchedCallback())},t.prototype.getAutocompletePanel=function(){var t,e,n=null===(e=null===(t=this.autocomplete)||void 0===t?void 0:t.options.last)||void 0===e?void 0:e._getHostElement().parentElement;return n||console.warn(this.logPrefix+" Unable to find the autocomplete div..."),n},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.markAsLoading=function(){this.$filteredItems.value&&(this.$filteredItems.next(void 0),this._itemCount=void 0,this._implicitValue=void 0,this._onFetchMoreCallback=void 0,this._moreItemsCount=0,this.markForCheck())},t}();fi.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-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n <mat-label>{{placeholder}}</mat-label>\n <mat-chip-list #chipList\n (focus)="filterChipsFocusEvent($event)" >\n <mat-chip\n *ngFor="let item of value"\n [selectable]="false"\n [removable]="!disabled"\n (removed)="remove(item)"\n [color]="chipColor"\n >\n {{displayWith(item)}}\n <mat-icon matChipRemove *ngIf="!disabled">cancel</mat-icon>\n </mat-chip>\n\n <input #matInputText type="text"\n [matAutocomplete]="autocomplete"\n [matAutocompletePosition]="matAutocompletePosition"\n [formControl]="inputControl"\n [appAutofocus]="autofocus"\n [tabindex]="_tabindex"\n [readonly]="disabled"\n [hidden]="disabled"\n [required]="required"\n (click)="clicked.emit($event)"\n (focus)="filterInputTextFocusEvent($event)"\n (blur)="filterInputTextBlurEvent($event)"\n (keydown.escape)="keydownEscape.emit($event)"\n (keyup.enter)="keyupEnter.emit($event)"\n (keyup.arrowdown)="!autocomplete.showPanel && dropButtonClick.emit($event)"\n [matChipInputFor]="chipList"\n >\n </mat-chip-list>\n\n \x3c!-- autocomplete --\x3e\n <mat-autocomplete #autocomplete="matAutocomplete"\n (optionSelected)="add($event)"\n autoActiveFirstOption\n [displayWith]="displayWith"\n [class]="classList"\n [panelWidth]="panelWidth">\n <ion-row class="mat-autocomplete-header ion-no-padding column">\n <ion-col *ngFor="let attr of displayAttributes; index as i" [size]="displayColumnSizes[i]">\n <ion-label [innerHTML]="displayColumnNames[i] | translate"></ion-label>\n </ion-col>\n </ion-row>\n\n <ng-container *ngIf="$filteredItems | async as items; else loadingTemplate">\n \x3c!-- No item option --\x3e\n <mat-option *ngIf="items | isEmptyArray" class="ion-padding text-italic" disabled>\n <ion-label>{{noResultMessage | translate}}</ion-label>\n </mat-option>\n\n <mat-option *ngFor="let item of items" [value]="item" class="ion-no-padding">\n <ion-row [classList]="item.classList">\n <ion-col *ngFor="let path of displayAttributes; index as i;"\n [size]="displayColumnSizes[i]">\n <ion-text [innerHTML]="item | propertyGet: path | highlight: { search: inputControl.value, withAccent: highlightAccent } "></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n \x3c!-- More item --\x3e\n <mat-option *ngIf="_moreItemsCount" (ngInit)="_initAutocompleteInfiniteScroll()"\n class="ion-padding" disabled>\n <ion-skeleton-text [animated]="true" style="width: 100%"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n\n \x3c!-- footer --\x3e\n <ion-row *ngIf="itemCount as count"\n class="mat-autocomplete-footer ion-no-padding">\n <ion-col>\n <ion-text class="ion-float-end ion-padding-end"><i>{{\'COMMON.RESULT_COUNT\'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n \x3c!-- Loading spinner --\x3e\n <ng-template #loadingTemplate>\n <mat-option *ngIf="(matInputText.value | strLength) >= suggestLengthThreshold; else waitMoreCharacterTemplate"\n class="ion-padding" disabled>\n <ion-skeleton-text [animated]="true" style="width: 100%"></ion-skeleton-text>\n </mat-option>\n </ng-template>\n\n \x3c!-- Need more characters --\x3e\n <ng-template #waitMoreCharacterTemplate>\n <mat-option class="ion-padding text-italic" disabled>\n <ion-label>\n {{\'INFO.PLEASE_TYPE_MORE_CHARACTERS\'|translate:{minLength: suggestLengthThreshold} }}\n </ion-label>\n </mat-option>\n </ng-template>\n </mat-autocomplete>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <ng-content select="[matError]"></ng-content>\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\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <button mat-icon-button tabindex="-1"\n type="button"\n (click)="dropButtonClick.emit($event)"\n [hidden]="disabled">\n <mat-icon class="large select-arrow">arrow_drop_down</mat-icon>\n </button>\n <button 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 <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return fi}))}],encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{width:100%;display:inline-block;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%}.mat-form-field-suffix{position:absolute!important;right:0!important;top:calc(100% - 50px)!important}.mat-chip.mat-standard-chip.mat-primary{background-color:var(--ion-color-primary);color:var(--ion-color-primary-contrast)}.mat-chip.mat-standard-chip.mat-secondary{background-color:var(--ion-color-secondary);color:var(--ion-color-secondary-contrast)}.mat-chip.mat-standard-chip.mat-tertiary{background-color:var(--ion-color-tertiary);color:var(--ion-color-tertiary-contrast)}.mat-chip.mat-standard-chip.mat-accent{background-color:var(--ion-color-accent);color:var(--ion-color-accent-contrast)}.mat-chip.mat-standard-chip.mat-warning{background-color:var(--ion-color-warning);color:var(--ion-color-warning-contrast)}"]}]}],fi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},fi.propDecorators={equals:[{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}],autofocus:[{type:e.Input}],config:[{type:e.Input}],i18nPrefix:[{type:e.Input}],noResultMessage:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],panelWidth:[{type:e.Input}],matAutocompletePosition:[{type:e.Input}],itemSize:[{type:e.Input}],fetchMoreThreshold:[{type:e.Input}],suggestLengthThreshold:[{type:e.Input}],showLoadingSpinner:[{type:e.Input}],chipColor:[{type:e.Input}],debug:[{type:e.Input}],clicked:[{type:e.Output,args:["click"]}],blurred:[{type:e.Output,args:["blur"]}],focused:[{type:e.Output,args:["focus"]}],dropButtonClick:[{type:e.Output}],keydownEscape:[{type:e.Output,args:["keydown.escape"]}],keyupEnter:[{type:e.Output,args:["keyup.enter"]}],matInputText:[{type:e.ViewChild,args:["matInputText"]}],autocomplete:[{type:e.ViewChild,args:[R.MatAutocomplete]}],autocompleteTrigger:[{type:e.ViewChild,args:[R.MatAutocompleteTrigger]}],filter:[{type:e.Input}],tabindex:[{type:e.Input}],items:[{type:e.Input}]};var gi=function(){};gi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,wr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,z.MatChipsModule,F.TranslateModule.forChild()],declarations:[fi],exports:[fi]}]}];var bi=function(){function t(t){this.el=t,this._subscription=null,this._$update=new D.Subject}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},set:function(t){this._size!==t&&(this._size=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){this._fill!==t&&(this._fill=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matIcon",{set:function(t){this._matIcon!==t&&(this._matIcon=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ionIcon",{set:function(t){this._ionIcon!==t&&(this._ionIcon=t,this.updateView())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this._size=this._size||"medium",this._color=this._color||"primary","warn"===this._color&&(this._color="warning"),this.updateView(!0),this._subscription=this._$update.pipe(N.debounceTime(100)).subscribe((function(){return t.updateView(!0)}))},t.prototype.ngOnDestroy=function(){var t;null===(t=this._subscription)||void 0===t||t.unsubscribe()},t.prototype.updateView=function(t){if(t){var e=this.el.nativeElement.querySelector(".mat-badge-content");if(e){var n;switch(this._size){case"large":n="24px";break;case"medium":n="22px";break;case"small":n="16px"}var o="";this._matIcon?o='<i class="material-icons" style="font-size: '+n+';">'+this._matIcon+"</i>":this._ionIcon&&(o='<ion-icon style="font-size: '+n+'; pointer-events: none;" name="'+this._ionIcon+'"></ion-icon>'),this._html!==o&&(this._html=o,e.innerHTML=o),"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)"),"inline-block"!==e.style.display&&(e.style.display="inline-block"),"center"!==e.style.alignItems&&(e.style.alignItems="center"),"center"!==e.style.justifyContent&&(e.style.justifyContent="center")}}else this._$update.next()},t}();bi.decorators=[{type:e.Directive,args:[{selector:"[matBadgeIcon], [ionBadgeIcon]",inputs:["size: matBadgeSize","color: matBadgeColor","fill: matBadgeFill"]}]}],bi.ctorParameters=function(){return[{type:e.ElementRef}]},bi.propDecorators={size:[{type:e.Input,args:["matBadgeSize"]}],color:[{type:e.Input,args:["matBadgeColor"]}],fill:[{type:e.Input,args:["matBadgeFill"]}],matIcon:[{type:e.Input,args:["matBadgeIcon"]}],ionIcon:[{type:e.Input,args:["ionBadgeIcon"]}]};var yi=function(){};yi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,S.MatBadgeModule],exports:[bi],declarations:[bi]}]}];var vi=[s.MatCommonModule,l.MatTableModule,c.MatSortModule,u.MatPaginatorModule,d.MatFormFieldModule,p.MatInputModule,o.CdkTableModule,h.MatCheckboxModule,m.MatExpansionModule,f.MatToolbarModule,A.MatDialogModule,g.MatIconModule,b.MatButtonModule,y.MatMenuModule,v.MatSelectModule,C.MatCardModule,E.MatTabsModule,I.MatListModule,w.MatStepperModule,x.MatButtonToggleModule,O.MatProgressSpinnerModule,_.MatProgressBarModule,k.MatRadioModule,S.MatBadgeModule,T.MatSlideToggleModule,r.A11yModule,i.OverlayModule,a.ScrollingModule,s.MatRippleModule,G.MatDividerModule,H.MatTooltipModule,Ir,Tr,Gr,Yr,ti,ui,hi,gi,yi],Ci=function(){};Ci.decorators=[{type:e.NgModule,args:[{imports:vi,exports:vi}]}];var Ei=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}();Ei.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ei},token:Ei,providedIn:"root"}),Ei.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var wi=400,Ii=function(t){function e(){var e=t.apply(this,le(arguments))||this;return e.overrides={press:{time:wi},pinch:{enable:!1},rotate:{enable:!1},swipe:{threshold:30,velocity:.4}},e}return ne(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);Ii.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ii},token:Ii,providedIn:"root"}),Ii.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var xi=function(){},Oi=function(){function t(t,n,o,r,i){this.route=t,this.router=n,this.routerOutlet=o,this.cd=r,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,i&&(this.progressBarMode$=i.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||pe(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||pe(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.hasValidate=Ee(this.hasValidate,this.onValidate.observers.length>0),this.canGoBack=Ee(this.canGoBack,this.routerOutlet.canGoBack()||he(this._backHref)||he(this._defaultBackHref)),this.hasSearch=Ee(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 re(this,void 0,void 0,(function(){var t=this;return ie(this,(function(e){return this.showSearchBar=!this.showSearchBar,this.showSearchBar&&this.searchbar&&setTimeout((function(){return re(t,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return console.debug("[toolbar] calling goBack()"),this._backHref?(t=!this.routerOutlet.canGoBack(),this._backHref.startsWith(".")?[4,this.router.navigate([this._backHref],{relativeTo:this.route,replaceUrl:t})]:[3,2]):[3,5];case 1:return e.sent(),[3,4];case 2:return[4,this.router.navigateByUrl(this._backHref,{replaceUrl:t})];case 3:e.sent(),e.label=4;case 4:return[3,13];case 5:return this.routerOutlet.canGoBack()?[4,this.routerOutlet.pop()]:[3,7];case 6:return e.sent(),[3,13];case 7:return this._defaultBackHref?this._defaultBackHref.startsWith(".")?[4,this.router.navigate([this._defaultBackHref],{relativeTo:this.route,replaceUrl:!0})]:[3,9]:[3,12];case 8:return e.sent(),[3,11];case 9:return[4,this.router.navigateByUrl(this._defaultBackHref,{replaceUrl:!0})];case 10:e.sent(),e.label=11;case 11:return[3,13];case 12:console.error("[toolbar] Cannot go back. Missing attribute 'defaultBackHref' or 'backHref'"),e.label=13;case 13: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}();Oi.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 [menu]="\'left\'"\n [class.cdk-visually-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:xi,useExisting:Oi}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],Oi.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.IonRouterOutlet},{type:e.ChangeDetectorRef},{type:Ei,decorators:[{type:e.Optional}]}]},Oi.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}]}],menuToggle:[{type:e.ViewChild,args:["menuToggle",{static:!0}]}]};var _i=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 ne(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);_i.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _i(e.ɵɵinject(F.TranslateService))},token:_i,providedIn:"root"}),_i.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_i.ctorParameters=function(){return[{type:F.TranslateService}]};var ki=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 Si(t){return"#"+Ai(t[0])+Ai(t[1])+Ai(t[2])}function Ti(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 Ai(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function Ri(t,e,n){n=n?n/100:.5;var o=Ti(t);if(!o)throw Error("Invalid hex color:"+t);var r=Ti(e);if(!r)throw Error("Invalid hex color:"+e);return Si(o.map((function(t,e){return Math.round(t*n+r[e]*(1-n))})))}function Pi(t,e){var n=Ti(t);if(!n)throw Error("Invalid hex color:"+t);return!0===e?.299*n[0]+.587*n[1]+.114*n[2]>186?"#000000":"#FFFFFF":Si(n.map((function(t){return 255-t})))}var Di=function(){},Ni=function(){function t(t,n,o,r){this.translate=t,this.cd=n,this.injector=o,this.formGroupDir=r,this._onChangeCallback=Di,this._onTouchedCallback=Di,this.readonly=!1,this.compact=!1,this.floatLabel="auto",this.onKeyupEnter=new e.EventEmitter,this.filterNumberInput=Ye,this.selectInputContent=ze}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=be(this.required)?this.required:this._definition.required||this.formControl.validator===P.Validators.required||ve(this.required),this.disabled=Ee(this.disabled,Ee(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&&de(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&&Ae(t,e)}},t.prototype.getColorContrast=function(t){return he(t)?Pi(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=tn(t.matInput);e&&(e.tabIndex=t.tabindex,t.cd.markForCheck())}))},t}();Ni.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(\'decimal\')" translate>ERROR.FIELD_NOT_VALID_DECIMAL</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\'" #matInput\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 Ni})),multi:!0}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;position:relative}"]}]}],Ni.ctorParameters=function(){return[{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:e.Injector},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ni.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 Mi=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 re(this,void 0,void 0,(function(){var t;return ie(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 re(this,void 0,void 0,(function(){return ie(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():dn((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.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.ngOnStop=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},t}();Mi.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional}]}]};var Fi=[{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]}],Li=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 ne(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2,this.play("startup")]}))}))},e.prototype.preload=function(t){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return ue(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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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())):ue(n.vibration)&&ue(e&&e.vibrate)&&((e=e||{}).vibrate=!0),Ee(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return ue(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e=this;return ie(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(Fi.map((function(n){return t||(n.vibration=void 0),e.preload(n)})))];case 3:return n.sent(),[2]}}))}))},e.prototype.readAudioMode=function(){return re(this,void 0,void 0,(function(){var t;return ie(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}(Mi);Li.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Li(e.ɵɵinject(L.Platform),e.ɵɵinject(tt.NativeAudio,8),e.ɵɵinject(et.Vibration,8),e.ɵɵinject(nt.AudioManagement,8))},token:Li,providedIn:"root"}),Li.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Li.ctorParameters=function(){return[{type:L.Platform},{type:X.NativeAudio,decorators:[{type:e.Optional}]},{type:J.Vibration,decorators:[{type:e.Optional}]},{type:Z.AudioManagement,decorators:[{type:e.Optional}]}]};var ji=function(){function t(t){this.data=t,this.hotkeys=Array.from(this.data)}return t.prototype.ngOnInit=function(){},t}();ji.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}"]}]}],ji.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[A.MAT_DIALOG_DATA]}]}]};var Bi=function(){function t(t,e,n,o,r){var i=this;this.eventManager=t,this.dialog=e,this.document=n,this.modalController=o,this.popoverController=r,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 i.openHelpModal()}))}return t.prototype.addShortcut=function(t){var e=this,n=Object.assign(Object.assign({},this._defaults),t),o="keydown."+n.keys;return he(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 re(e,void 0,void 0,(function(){var e,i;return ie(this,(function(a){switch(a.label){case 0:return[4,this.modalController.getTop()];case 1:return(i=a.sent())?[3,3]:[4,this.popoverController.getTop()];case 2:i=a.sent(),a.label=3;case 3:return(e=i)&&e.component.name!==n.elementName?(o.preventDefault(),[2]):(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(ji,{width:"500px",data:this._hotkeys})},t}();Bi.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Bi(e.ɵɵinject(K.EventManager),e.ɵɵinject(A.MatDialog),e.ɵɵinject(n.DOCUMENT),e.ɵɵinject(L.ModalController),e.ɵɵinject(L.PopoverController))},token:Bi,providedIn:"root"}),Bi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Bi.ctorParameters=function(){return[{type:K.EventManager},{type:A.MatDialog},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:L.ModalController},{type:L.PopoverController}]};var Vi=function(){};Vi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.MatCommonModule,A.MatDialogModule,F.TranslateModule.forChild()],exports:[ji],declarations:[ji],providers:[Bi]}]}];var qi=480,Ui=640,$i=200,Gi=200,Hi=function(){function t(){}return t.prototype.readFromBlob=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o=this;return ie(this,(function(r){switch(r.label){case 0:if(de(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 re(this,void 0,void 0,(function(){var n,o=this;return ie(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?Gi:n&&n.maxWidth||Ui,a=n&&n.thumbnail?$i:n&&n.maxHeight||qi,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}(),zi=Gt,Wi=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 cn((t||[]).map((function(t){return function(){return n.getImage(t,Object.assign({},e))}})))},t.prototype.getImage=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return ie(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)||zi(),"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,ln(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 Hi).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}();Wi.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Wi(e.ɵɵinject(L.Platform),e.ɵɵinject(Q.HttpClient),e.ɵɵinject(Qt))},token:Wi,providedIn:"root"}),Wi.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[L.Platform,Q.HttpClient]}]}],Wi.ctorParameters=function(){return[{type:L.Platform},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]};var Ki=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=Ee(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}();Ki.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:[""]}]}],Ki.ctorParameters=function(){return[{type:Bi}]},Ki.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 Qi=function(){this.loading=!1,this.color="secondary"};Qi.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 '}]}],Qi.propDecorators={loading:[{type:e.Input}],color:[{type:e.Input}],name:[{type:e.Input}]};var Yi=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}();Yi.alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Xi=require("scrypt-async"),Ji=require("hash.js/lib/hash/sha/256"),Zi=require("hash.js/lib/hash/sha/512"),ta={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}}}},ea=function(){function t(){}return t.prototype.scryptKeypair=function(t,e,n){return new Promise((function(o){Xi(e,t,{N:n&&n.N||ta.constants.SCRYPT_PARAMS.DEFAULT.N,r:n&&n.r||ta.constants.SCRYPT_PARAMS.DEFAULT.r,p:n&&n.p||ta.constants.SCRYPT_PARAMS.DEFAULT.p,dkLen:ta.constants.SEED_LENGTH,encoding:"base64"},(function(t){o(t)}))})).then((function(t){var e=ta.util.decodeBase64(t),n=ta.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=ta.util.decodeUTF8(t),r=ta.sign(o,e.secretKey),i=new Uint8Array(ta.constants.crypto_sign_BYTES),a=0;a<i.length;a++)i[a]=r[a];n(ta.util.encodeBase64(i))}))},t.prototype.verify=function(t,e,n){return new Promise((function(o){var r=ta.util.decodeUTF8(t),i=ta.util.decodeBase64(e),a=Yi.decode(n);o(ta.sign.detached.verify(r,i,a))}))},t.prototype.sha256=function(t){return Ji().update(t).digest("hex")},t.prototype.sha512=function(t){return Zi().update(t).digest("hex")},t.prototype.encodeBase64=function(t){var e=ta.util.decodeUTF8(t);return ta.util.encodeBase64(e)},t}();ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ea},token:ea,providedIn:"root"}),ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var na=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 oa(t,e){return!!t&&t instanceof e}var ra,ia=function(){function t(){}return t.isEntity=function(t){return pe(t.__typename)&&"function"==typeof t.fromObject&&"function"==typeof t.asObject},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||ue(t)&&ue(e)||t&&e&&t[n]===e[n]},t.getPropertyByPath=function(e,n){if(!ue(e)){var o=n.indexOf(".");if(-1===o)return e[n];var r=n.substring(0,o);if(!ue(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=pe(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 re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return ge(n=(t||[]).filter((function(t){return ue(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 pe(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||t.length<=1||!e?t: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(!de(e)&&!de(n)){var o=n.replace(/[-\/\\^$+.()|[\]{}]/g,"\\$&").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&&pe(t.id)&&+t.id<0},t.isRemote=function(e){return e&&!t.isLocal(e)},t.isLocalId=function(t){return pe(t)&&+t<0},t.isRemoteId=function(t){return pe(t)&&+t>=0},t}(),aa=Object.freeze({name:"@sumaris-net/ngx-components",version:void 0,production:!0,baseUrl:"/",defaultLocale:"fr",defaultLatLongFormat:"DDMM",apolloFetchPolicy:"cache-first",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"},account:{enableListenChanges:!0,listenIntervalInSeconds:60},entityEditor:{enableListenChanges:!0,listenIntervalInSeconds:60}}),sa=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 la(t){return t=Object.assign({fromObjectReuseStrategy:"default"},t),function(e){var n,o;if(!aa.production&&!(new e instanceof na))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 ne(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 sa.register(r,i),i}var a=(o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(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 sa.register(r,a),a}}sa.CLASSES_BY_NAME=new Map,t.Peer=ra=function(t){function e(){return t.call(this,ra.TYPENAME)||this}return ne(e,t),e.parseUrl=function(t){var e=new URL(t);return ra.fromObject({dns:e.hostname,port:de(e.port)?void 0:e.port,useSsl:e.protocol&&(e.protocol.startsWith("https")||e.protocol.startsWith("wss")),path:Oe(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(he),(e=[Oe(ra.fromObject(t).url)]).concat.apply(e,le(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=pe(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}(na),t.Peer=ra=oe([la({typename:"PeerVO"})],t.Peer);var ca=function(){function t(){}return t.getText=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(this,(function(r){switch(r.label){case 0:!0===(n=n||{responseType:"text"}).nocache&&(n.headers=n.headers instanceof Q.HttpHeaders?n.headers:new Q.HttpHeaders(n.headers),n.headers.append("Cache-Control","no-cache").append("Pragma","no-cache")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,Object.assign(Object.assign({},n),{responseType:"text"})).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.getJson=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(this,(function(r){switch(r.label){case 0:!0===(n=n||{}).nocache&&(n.headers=n.headers instanceof Q.HttpHeaders?n.headers:new Q.HttpHeaders(n.headers),n.headers.append("Cache-Control","no-cache").append("Pragma","no-cache")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,Object.assign(Object.assign({},n),{responseType:"json"})).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}(),ua=function(){};ua.getNodeInfo=function(e,n,o){return re(this,void 0,void 0,(function(){var r;return ie(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,ca.getJson(e,r+"/api/node/info",o)]}))}))};var da={POSITIVE_INTEGER:/^\d+$/,VERSION_PART_REGEXP:/^[0-9]+|alpha[0-9]+|beta[0-9]+|rc[0-9]+|[0-9]+-SNAPSHOT$/},pa=function(){};function ha(t,e){var n=t.split("."),o=e.split(".");if(!ma(n)||!ma(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 ma(t){for(var e=0;e<t.length;e++){var n=da.POSITIVE_INTEGER.test(t[e]);if(0===e&&!n)return!1;if(!n){if(!da.VERSION_PART_REGEXP.test(t[e]))return!1;t[e]=t[e].replace("-SNAPSHOT",""),n=da.POSITIVE_INTEGER.test(t[e])}n&&(t[e]=parseInt(t[e]))}return!0}pa.compare=ha,pa.isCompatible=function(t,e){return ha(t,e)<=0},pa.isSame=function(t,e){return 0===ha(t,e)};var fa=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&&pa.isCompatible(this.peerMinVersion,t.softwareVersion)},t.prototype.refresh=function(t){this.loading=!0,this.onRefresh.emit(t)},t.prototype.refreshPeers=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:t=t||[],e=[],n=Promise.all(t.map((function(t){return re(r,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ua.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}();fa.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:[bn],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}"]}]}],fa.ctorParameters=function(){return[{type:L.ModalController},{type:e.ChangeDetectorRef},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},fa.propDecorators={canCancel:[{type:e.Input}],allowSelectDownPeer:[{type:e.Input}],onRefresh:[{type:e.Input}]};var ga=$t,ba="settings",ya=["mobile","touchUi"],va={accountInheritance:!0,locale:aa.defaultLocale,latLongFormat:aa.defaultLatLongFormat||"DDMM",pageHistoryMaxSize:3},Ca=new e.InjectionToken("DefaultLocalSettings"),Ea=new e.InjectionToken("LocalSettingsOptions"),wa=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({},va),s.defaultSettings),s._optionDefs=Object.values(a),s.resetData(),s._debug=!r.production,s._debug&&console.debug("[settings] Creating service"),s}return ne(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(){var t;return ue(null===(t=this._data)||void 0===t?void 0:t.mobile)?(console.warn("[settings] Accessing to property 'usageMode' BEFORE service started! Please use ready()"),An(window)?"FIELD":"DESK"):this._data.usageMode},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"mobile",{get:function(){var t;return ue(null===(t=this._data)||void 0===t?void 0:t.mobile)?(console.warn("[settings] Accessing to property 'mobile' BEFORE service started! Please use ready()"),Rn(window)):this._data.mobile},set:function(t){this._data.mobile=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=pe(this._data.mobile)?this._data.mobile:An(window)||Rn(window),this._data.usageMode=Tn(window)||Sn(window)?"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 re(this,void 0,void 0,(function(){var t,e,n;return ie(this,(function(o){switch(o.label){case 0:return t=this._data||{},[4,this.storage.get(ba)];case 1:return he(e=o.sent())&&(console.info("[settings] Restoring previous settings..."),n=JSON.parse(e),ya.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&&t&&("object"!=typeof t?(this._data.properties=this._data.properties||{},this._data.properties[t]=ue(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,ue(e)?t.defaultValue:e);var n=this._data&&this._data.properties&&this._data.properties[t];return pe(n)?n:e},o.prototype.getPropertyAsBoolean=function(t,e){var n=this.getProperty(t,e);return pe(n)?n&&"false"!==n:void 0},o.prototype.getPropertyAsInt=function(t,e){var n=this.getProperty(t,e);return pe(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:pe(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 re(this,void 0,void 0,(function(){var n;return ie(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 $e(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 re(this,void 0,void 0,(function(){var o;return ie(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 he(e)?Fe(this._data.pages,n+"."+e):this._data.pages[n]}},o.prototype.savePageSetting=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(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&&!ge(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):!(!n||"object"!=typeof n||!n.name)&&n.name===t}));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?pe(this.getOfflineFeature(t)):this._data&&fe(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):!(!n||"object"!=typeof n||!n.name)&&n.name===t.name}));-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=ga().toISOString():e={name:t.toLowerCase(),lastSyncDate:ga().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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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 re(this,void 0,void 0,(function(){var o,r,i=this;return ie(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(fe).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 re(this,void 0,void 0,(function(){return ie(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(ba,JSON.stringify(this._data))):(console.debug("[settings] Removing local settings from storage"),this.storage.remove(ba));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||ga(),!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}(Mi);wa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wa(e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.Platform),e.ɵɵinject(st.Storage),e.ɵɵinject(Qt),e.ɵɵinject(Ca,8),e.ɵɵinject(Ea,8))},token:wa,providedIn:"root"}),wa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],wa.ctorParameters=function(){return[{type:F.TranslateService},{type:L.Platform},{type:st.Storage},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ca]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ea]}]}]};var Ia=function(){function t(){}return t.show=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p,h,m,f,g,b=this;return ie(this,(function(y){switch(y.label){case 0:if(!t||!e)return console.error("Missing required argument 'toastController' or 'translate'"),n.message instanceof L.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 L.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(pe).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 L.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(),ge(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}();Ia.counter=0,Ia.stackSize=0;var xa=6e5,Oa=3e5,_a=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(he),N.distinctUntilChanged()),f.onNetworkStatusChanges=new D.BehaviorSubject(null),f.onResetNetworkCache=new e.EventEmitter(!0),f._listeners={},f._mobile=f.settings.mobile,f._mobile?(f._timerRefreshPeriod=xa,f._timerRefreshCondition=function(){return f.online}):(f._timerRefreshPeriod=Oa,f._timerRefreshCondition=function(){return!0}),f.resetData(),f.onStart.subscribe((function(){return f.ngOnAfterStart()})),f._debug=!u.production,f}return ne(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 re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return ie(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,Be(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 re(this,void 0,void 0,(function(){var e;return ie(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:Ee(t&&t.showRetrySuccessToast,!0),showLoadingToast:Ee(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 re(this,void 0,void 0,(function(){var n,o;return ie(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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:return this.environment.peerMinVersion?(n=t&&t.softwareVersion&&pa.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(t){var e=this.computePeerPath(t,"/api/node/info");return this.get(e)},o.prototype.getAppManifest=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=this.computePeerPath(t,"manifest.json"),(null==e?void 0:e.nocache)&&(n+="?t="+Date.now()),[4,this.get(n,e)];case 1:return[2,r.sent()];case 2:return o=r.sent(),this.environment.production?console.error("[network] Cannot load file 'manifest.json'. Please make sure webserver config allow CORS access",o):console.error("[network] Cannot load file 'manifest.json'.",o),[3,3];case 3:return[2]}}))}))},o.prototype.getAppVersion=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),n=this.computePeerPath(t,"version.appup"),(null==e?void 0:e.nocache)&&(n+="?t="+Date.now()),[4,this.getText(n,e)];case 1:return he(o=a.sent())?[2,o]:[3,3];case 2:return r=a.sent(),this.environment.production?console.error("[network] Cannot load file 'version.appup'. Please make sure webserver config allow CORS access"):console.error("[network] Cannot load file 'version.appup'.",r),[3,3];case 3:return[4,this.getAppManifest(t,e)];case 4:return[2,null==(i=a.sent())?void 0:i.version]}}))}))},o.prototype.computePeerPath=function(e,n){if(e=e||this.peer){var o=e instanceof t.Peer?e.url:e;return o.endsWith("/")&&(o=o.substr(0,o.length-1)),n.startsWith("/")||(n="/"+n),o+n}},o.prototype.setForceOffline=function(t,e){if(t=Ee(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",type:"warning"}))}},o.prototype.showSelectPeerModal=function(t){return re(this,void 0,void 0,(function(){var n,o,r,i,a=this;return ie(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:fa,componentProps:{onRefresh:n,peers:o,canCancel:Ee(t.canCancel,!0),allowSelectDownPeer:Ee(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 re(this,void 0,void 0,(function(){var e,n=this;return ie(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(),Be(500)})).then((function(){n._debug&&console.debug("[network] All cache cleared, in "+(Date.now()-e)+"ms")}))]}))}))},o.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return console.info("[network] Starting network..."),(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.resetData(),!1===this._timerRefreshCondition()&&this.stopRefreshTimer(),[2]}))}))},o.prototype.restoreLocally=function(){return re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return[4,this.storage.get(ba)];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.getText=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return n=this.getUri(t),[2,ca.getText(this.http,n,e)]}))}))},o.prototype.get=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return n=this.getUri(t),[2,ca.getJson(this.http,n,e)]}))}))},o.prototype.getUri=function(t){var e=t;if(!e.startsWith("http://")&&!e.startsWith("https://")){var n=this.peer&&this.peer.url;n.endsWith("/")&&(n=n.substr(0,n.length-1)),t.startsWith("/")||(t="/"+t),e=n+t}return 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",type:"warning"})):this.showToast({message:"NETWORK.INFO.OFFLINE",type:"warning"}),this.stop())))},o.prototype.resetData=function(){this._data=null},o.prototype.getDefaultPeers=function(){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){return e=(this.environment.defaultPeers||[]).map(t.Peer.fromObject),[2,Promise.resolve(e)]}))}))},o.prototype.showToast=function(t){return Ia.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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return fe(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}(Mi);_a.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _a(e.ɵɵinject(n.DOCUMENT),e.ɵɵinject(L.Platform),e.ɵɵinject(L.ModalController),e.ɵɵinject(ea),e.ɵɵinject(st.Storage),e.ɵɵinject(wa),e.ɵɵinject(pt.CacheService),e.ɵɵinject(Q.HttpClient),e.ɵɵinject(Qt),e.ɵɵinject(ht.Network,8),e.ɵɵinject(mt.SplashScreen,8),e.ɵɵinject(F.TranslateService,8),e.ɵɵinject(L.ToastController,8))},token:_a,providedIn:"root"}),_a.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_a.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:L.Platform},{type:L.ModalController},{type:ea},{type:st.Storage},{type:wa},{type:dt.CacheService},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:ut.Network,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:L.ToastController,decorators:[{type:e.Optional}]}]};var ka=0,Sa=1,Ta=2,Aa=3,Ra=4,Pa=5,Da=6,Na=7,Ma=8,Fa=9,La=8,ja=10,Ba=11,Va=12,qa=13,Ua=14,$a=15,Ga=104,Ha=350,za=351,Wa=401,Ka=601,Qa=602,Ya=700,Xa=701,Ja=401,Za=403,ts=404,es=520,ns=521,os=553,rs="entities",is=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,"length",{get:function(){var t;return(null===(t=this._cache)||void 0===t?void 0:t.length)||0},enumerable:!1,configurable:!0}),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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return n=this.reduceAndSort(this._cache,t),this._mapToLightEntity&&fe(n.data)&&e&&!0===e.fullLoad?(o=n,[4,cn((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=pe(t.id)&&this._statusById.get(t.id)||{index:void 0};return ue(n.index)?(ue(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!ge(t)||e&&!0===e.reset?(console.info("[entity-storage] Saving "+t.length+" "+this.name+"(s)"),ge(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=pe(t)?this._statusById.get(t):void 0,o=n?n.index:void 0;if(!ue(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(pe);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 void 0===t&&(t={skipIfPristine:!0}),re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return 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])})),ge(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(pe).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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l,c=this;return ie(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?pe(r)?[4,cn((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:pe(o)&&(e=o.filter((function(t){return t&&pe(t.id)})),i=!0,a=[this._storageKey]),u.label=4;case 4:return[3,8];case 5:return pe(o)?(e=o.filter((function(t){return t&&pe(t.id)})),[3,8]):[3,6];case 6:return pe(r)?[4,cn((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=le(s,[this.storageKeyById]),u.label=8;case 8:if(fe(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(),fe(a)?[4,cn(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:Ba,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=ae(this._statusById.values()),r=o.next();!r.done;r=o.next()){var i=r.value;pe(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(!ue(o))return Object.freeze(this._cache[o])},t.prototype.loadFullEntity=function(t,e){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return e=this._statusById.get(t),ue(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 pe(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(ge(t))return{data:[],total:0};if(t=t.filter(pe),!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}:(e.sortBy&&ia.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&&!ge(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}(),as=new e.InjectionToken("localStorageTypePolicies"),ss=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 ne(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.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(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({skipIfPristine:!0})}))),this.registerSubscription(this.platform.pause.subscribe((function(){return re(e,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return console.warn("[entities-storage] Platform will pause: saving..."),[4,this.storeLocally({skipIfPristine:!0})];case 1:return t.sent(),console.warn("[entities-storage] Platform will pause: saving [OK]"),[2]}}))}))}))),console.info("[entities-storage] Starting [OK] in "+(Date.now()-t)+"ms"),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.storeLocally({skipIfPristine:!0})];case 1:return t.sent(),[2]}}))}))},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 re(this,void 0,void 0,(function(){var o;return ie(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 re(this,void 0,void 0,(function(){var o;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n;return ie(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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:return!ge(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o;return ie(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||de(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 re(this,void 0,void 0,(function(){var n,o;return ie(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||de(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,this.ready()];case 1:if(o.sent(),!e||de(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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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||de(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 re(this,void 0,void 0,(function(){var o,r;return ie(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 re(this,void 0,void 0,(function(){var e,o;return ie(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(t){return void 0===t&&(t={skipIfPristine:!0}),this.storeLocally(t)},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 is(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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return[4,this.storage.get(rs)];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(t){return void 0===t&&(t={skipIfPristine:!0}),re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){return t.skipIfPristine&&!this.dirty?[2]: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(),e=this._data&&Object.keys(this._data)||[],n=Date.now(),this._debug&&console.debug("[entities-storage] Persisting..."),[2,cn(e.map((function(n){return function(){o=n;var i=r.getEntityStore(n,{create:!1});if(i)return t.skipIfPristine&&!i.dirty?Promise.resolve():i.persist(t).then((function(t){if(!t){var o=e.findIndex((function(t){return t===n}));-1!==o&&e.splice(o,1)}}));console.warn("[entities-storage] Persisting "+n+": store not found!")}}))).then((function(){return o=void 0,ge(e)?r.storage.remove(rs):r.storage.set(rs,e)})).then((function(){r._debug&&console.debug("[entities-storage] Persisting [OK] "+e.length+" stores saved in "+(Date.now()-n)+"ms..."),r._saving=!1,r.progressBarService.decrease()})).catch((function(t){throw r._saving=!1,r.progressBarService.decrease(),o?console.error("[entities-storage] Error while persisting "+o,t):console.error("[entities-storage] Error while persisting: "+(t&&t.message||t),t),t}))])}))}))},n}(Mi);ss.TRASH_PREFIX="Trash#",ss.REMOTE_PREFIX="Remote#",ss.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ss(e.ɵɵinject(L.Platform),e.ɵɵinject(Ei),e.ɵɵinject(st.Storage),e.ɵɵinject(Qt),e.ɵɵinject(as,8))},token:ss,providedIn:"root"}),ss.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ss.ctorParameters=function(){return[{type:L.Platform},{type:Ei},{type:st.Storage},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[as]}]}]};var ls,cs=function(){function t(){}return t.copy=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a;return ie(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 ge(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,cn(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}(),us=new e.InjectionToken("locales");t.UserSettings=ls=function(t){function e(){return t.call(this,ls.TYPENAME)||this}return ne(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,ue(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){ls.SETTINGS_PROPERTIES.includes(r)?$e(n[r],t[r])||(n[r]=t[r],o=!0):e&&e.includes(r)&&($e(n.content[r],t[r])||(n.content[r]=Object.assign({},t[r]),o=!0))})),o}},e.prototype.asLocalSettings=function(){var t=this,e={};return ls.SETTINGS_PROPERTIES.forEach((function(n){e[n]=t[n]})),Object.keys(this.content).forEach((function(n){e[n]=t.content[n]})),e},e}(na),t.UserSettings.SETTINGS_PROPERTIES=["locale","latLongFormat"],t.UserSettings=ls=oe([la({typename:"UserSettingsVO"})],t.UserSettings);var ds,ps={DISABLE:0,ENABLE:1,TEMPORARY:2,DELETED:3,ALL:99};function hs(t,e){return t&&t.id&&Ae(t,e||["label","name"])||void 0}var ms=ps.ENABLE,fs=ps.DISABLE,gs=ps.TEMPORARY,bs=Object.freeze([{id:ms,icon:"checkmark",label:"REFERENTIAL.STATUS_ENUM.ENABLE"},{id:fs,icon:"close",label:"REFERENTIAL.STATUS_ENUM.DISABLE"},{id:gs,icon:"help",label:"REFERENTIAL.STATUS_ENUM.TEMPORARY"}]),ys=Object.freeze(Ue(bs)),vs=function(t){function e(e){return t.call(this,e)||this}return ne(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}(na);t.Referential=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(vs),t.Referential=oe([la({typename:"ReferentialVO"})],t.Referential);var Cs,Es,ws=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 ia.isNotEmpty(t,"id")},e.isEmpty=function(t){return ia.isEmpty(t,"id")},e.equals=function(t,e){return ia.equals(t,e,"id")},e}(),Is=Object.freeze({minify:!0,keepTypename:!0,keepEntityName:!0,keepLocalId:!0}),xs=Object.freeze({minify:!0,keepTypename:!1,keepEntityName:!1,keepLocalId:!1});function Os(t){return t&&t.id&&t.name||void 0}function _s(t,e){return(t||[]).map(Os).join(e||", ")}t.ReferentialRef=ds=function(t){function e(){return t.call(this,ds.TYPENAME)||this}return ne(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}(na),t.ReferentialRef=ds=oe([la({typename:"ReferentialVO"})],t.ReferentialRef),t.Department=Cs=function(t){function e(){var e=t.call(this,Cs.TYPENAME)||this;return e.entityName=Cs.ENTITY_NAME,e}return ne(e,t),e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||Cs.ENTITY_NAME,this.logo=e.logo,this.siteUrl=e.siteUrl,delete this.entityName},e}(vs),t.Department.ENTITY_NAME="Department",t.Department=Cs=oe([la({typename:"DepartmentVO"})],t.Department);var ks=Object.freeze(["ADMIN","SUPERVISOR","USER","GUEST"]);t.Person=Es=function(e){function n(t){var n=e.call(this,t||Es.TYPENAME)||this;return n.department=null,n}return ne(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=Ts.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=Ts.getMainProfile(this.profiles)},n}(na),t.Person=Es=oe([la({typename:"PersonVO"})],t.Person);var Ss,Ts=function(){function t(){}return t.getMainProfile=function(t){return ge(t)?"GUEST":ks.find((function(e){return t.includes(e)}))||"GUEST"},t.getMainProfileIndex=function(t){if(ge(t))return ks.length-1;var e=ks.findIndex((function(e){return t.includes(e)}));return-1!==e?e:ks.length-1},t.hasUpperOrEqualsProfile=function(e,n){var o=ks.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 As(t){return t&&(t.firstName&&t.firstName+" "||"")+(t.lastName||"")||""}t.Account=Ss=function(e){function n(){var t=e.call(this,Ss.TYPENAME)||this;return t.settings=null,t}return ne(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 As(this)},enumerable:!1,configurable:!0}),n}(t.Person),t.Account=Ss=oe([la({typename:"AccountVO"})],t.Account);var Rs=Gt,Ps="undefined"!=typeof global?global:"undefined"!=typeof window?window:{},Ds=Ps.WebSocket||Ps.MozWebSocket,Ns=function(t,e){return new Ds(t)};function Ms(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"mutation"===e.operation}function Fs(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"subscription"===e.operation}Ns.CLOSED=Ds.CLOSED,Ns.CLOSING=Ds.CLOSING,Ns.CONNECTING=Ds.CONNECTING,Ns.OPEN=Ds.OPEN;var Ls="apollo-tracker-persist";function js(t){return re(this,void 0,void 0,(function(){var e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return o=(n=JSON).parse,[4,t.storage.getItem(Ls)];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 Bs=new e.InjectionToken("graphqlTypePolicies"),Vs=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(pe),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 ne(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(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]=le(n[e.arrayFieldName],[Object.assign({},e.data)]),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var o=we(e.variables&&e.variables.size,-1);o>0&&n[e.arrayFieldName].length>o&&n[e.arrayFieldName].splice(o,n[e.arrayFieldName].length-o),pe(e.totalFieldName)&&(pe(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]=le(n[e.arrayFieldName],r),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var i=we(e.variables&&e.variables.size,-1);i>0&&n[e.arrayFieldName].length>i&&n[e.arrayFieldName].splice(i,n[e.arrayFieldName].length-i),pe(e.totalFieldName)&&(pe(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)}),pe(e.totalFieldName)&&(pe(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(!ue(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})})),pe(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 ia.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):le(n[e.arrayFieldName],[e.data]),pe(e.totalFieldName)&&-1===r&&(pe(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return(t=t||this.client)?(console.info("[graphql] Cleaning cache... "),e=this._debug&&Date.now(),[4,t.cache.reset()]):[3,2];case 1:n.sent(),this._debug&&console.debug("[graphql] Cleaning cache [OK] 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 re(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 ie(this,(function(v){switch(v.label){case 0:return[4,this.network.ready()];case 1:if(v.sent(),console.info("[graphql] Starting graphql..."),t=Rn(window),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:Ns,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 zt.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(Ls,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||Rs();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 Ht.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=[Wt.default,g,f,g,m,c,u,d]):h=[c,u,d],s=new yt.ApolloClient({cache:p,link:yt.ApolloLink.split(Ms,yt.ApolloLink.from(h),yt.ApolloLink.split(Fs,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,js({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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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(Pa))||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===Pa&&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:yt.NetworkStatus.error}},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 Ja:return"ERROR.UNAUTHORIZED";case Za:return"ERROR.FORBIDDEN";case Pa:return"ERROR.UNKNOWN_NETWORK_ERROR";case ns:return"ERROR.BAD_UPDATE_DATE";case es:return"ERROR.DATA_LOCKED";case os: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}(Mi);Vs.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Vs(e.ɵɵinject(L.Platform),e.ɵɵinject(vt.Apollo),e.ɵɵinject(_t.HttpLink),e.ɵɵinject(_a),e.ɵɵinject(st.Storage),e.ɵɵinject(ea),e.ɵɵinject(Qt),e.ɵɵinject(Bs,8))},token:Vs,providedIn:"root"}),Vs.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Vs.ctorParameters=function(){return[{type:L.Platform},{type:vt.Apollo},{type:_t.HttpLink},{type:_a},{type:st.Storage},{type:ea},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Bs]}]}]};var qs=require("hash.js/lib/hash/sha/256"),Us=function(){},$s=function(t){function e(e,n){var o=t.call(this,e)||this;return o.graphql=e,o._mutableWatchQueries=[],o._mutableWatchQueriesMaxCount=3,o._debug=Ee(n&&!n.production,!aa.production),o._logPrefix="[base-graphql-service] ",o}return ne(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;fe(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 re(this,void 0,void 0,(function(){var e,n,o=this;return ie(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||qs().update(JSON.stringify(t.query)).digest("hex").substring(0,8),n=t.variables&&qs().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.map((function(t){return e._mutableWatchQueries.filter((function(e){return e.id.startsWith(t+"|")}))})).reduce((function(t,e){return t.concat.apply(t,le(e))}),[]);if(t.query)return this._mutableWatchQueries.filter((function(e){return e.query===t.query}));if(t.queries)return t.queries.filter(pe).map((function(t){return e._mutableWatchQueries.filter((function(e){return e.query===t}))})).reduce((function(t,e){return t.concat.apply(t,le(e))}),[]);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&&ia.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}(Mi);$s.decorators=[{type:e.Directive}],$s.ctorParameters=function(){return[{type:Vs},{type:Us,decorators:[{type:e.Optional}]}]};var Gs,Hs,zs,Ws,Ks,Qs,Ys,Xs,Js,Zs,tl,el,nl,ol,rl="token",il="pubkey",al="seckey",sl="account",ll="assets/img/person.png",cl={account:yt.gql(Gs||(Gs=ce(["\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(Hs||(Hs=ce(["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 }"])))},ul=yt.gql(zs||(zs=ce(["\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"])),cl.account,cl.settings),dl=yt.gql(Ws||(Ws=ce(["\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"]))),pl={save:yt.gql(Ks||(Ks=ce([" 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 ",""])),cl.account,cl.settings),create:yt.gql(Qs||(Qs=ce(["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 ",""])),cl.account,cl.settings),saveSettings:yt.gql(Ys||(Ys=ce(["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 ",""])),cl.settings)},hl=yt.gql(Xs||(Xs=ce(["\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"]))),ml=yt.gql(Js||(Js=ce(["\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"]))),fl=yt.gql(Zs||(Zs=ce(["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"],["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"]))),gl=yt.gql(tl||(tl=ce(["\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"]))),bl={listenChanges:yt.gql(el||(el=ce(["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 }"])))},yl=function(e){function n(t,n,o,r,i,a,s,l,c){var u=e.call(this,o,c)||this;return u.cryptoService=t,u.network=n,u.graphql=o,u.settings=r,u.storage=i,u.file=a,u.translate=s,u.toastController=l,u.environment=c,u.onLogin=new D.Subject,u.onLogout=new D.Subject,u.onChange=new D.Subject,u.onAuthTokenChange=new D.Subject,u.onAuthBasicChange=new D.Subject,u._listenChangesSubscription=null,u._cache={loaded:!1,keypair:null,authToken:null,authBasic:null,pubkey:null,mainProfile:null,person:null,department:null},u._$additionalFields=new D.BehaviorSubject([]),u._tokenType$=new D.BehaviorSubject(void 0),u._enableListenChanges=!c.account||!1!==c.account.enableListenChanges,u._listenIntervalInSeconds=we(c.account&&c.account.listenIntervalInSeconds,0),u._debug=!c.production,u._debug&&console.debug("[account-service] Creating service"),u.resetData(),u.onAuthTokenChange.subscribe((function(t){return u.graphql.setAuthToken(t)})),u.onAuthBasicChange.subscribe((function(t){return u.graphql.setAuthBasic(t)})),u.network.on("beforeTryOnlineFinish",(function(t){return re(u,void 0,void 0,(function(){return ie(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,Be(500)]);case 1:return e.sent(),this.started?[3,3]:[4,this.ready()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))})),u}return ne(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 re(this,void 0,void 0,(function(){var t=this;return ie(this,(function(e){switch(e.label){case 0:return[4,Promise.all([this.settings.ready(),ln(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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&Ts.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.hasExactProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&this._data.profiles.some((function(e){return e===t}))},n.prototype.hasProfileAndIsEnable=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE)&&Ts.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!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&!Ts.hasUpperOrEqualsProfile(this._data.profiles,"USER")},n.prototype.canUserWriteDataForDepartment=function(t){return ws.isEmpty(t)?this.isAdmin():!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE)&&(this._data.department&&this._data.department.id?this._data.department.id===t.id||Ts.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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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=Yi.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+ll,this._cache.mainProfile=Ts.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),this._enableListenChanges&&this.startListenRemoteChanges(),[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 re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return[4,ln(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return ie(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:ka,message:"ERROR.SCRYPT_ERROR"};case 4:return this._cache.pubkey=Yi.encode(e.publicKey),this._cache.keypair=e,[4,this.storage.get(rl)];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!==Sa)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:Aa,message:"ERROR.UNKNOWN_ACCOUNT_EMAIL"};c.label=16;case 16:throw{code:Ta,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),this._enableListenChanges&&this.startListenRemoteChanges(),[2,this._data]}}))}))},n.prototype.reload=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.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");e=Date.now(),console.debug("[account] Reloading account..."),n=this.isLogin(),r.label=1;case 1:return r.trys.push([1,4,,8]),[4,this.loadData()];case 2:return r.sent(),[4,this.saveLocally()];case 3:return r.sent(),console.debug("[account] Reloading account [OK] in "+(Date.now()-e)+"ms"),this.onLogin.next(this._data),this.onChange.next(this._data),t&&!1===t.showToast||this.showToast({message:"ACCOUNT.INFO.RELOADED",type:"info"}),[2,this._data];case 4:return o=r.sent(),!n||this.isLogin()?[3,6]:(console.error("[account] Reloading account failed. Will force logout...",o),[4,this.logout()]);case 5:return r.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return[2]}}))}))},n.prototype.save=function(t){return re(this,void 0,void 0,(function(){return ie(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+ll,this._cache.mainProfile=Ts.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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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(il),this.storage.remove(rl),this.storage.remove(sl),n&&this.storage.remove("account#"+n)||Promise.resolve(),this.storage.remove(al)])];case 1:return o.sent(),[3,4];case 2:return[4,Promise.all([this.storage.remove(il),this.storage.remove(sl),this.storage.remove(al)])];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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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(sl)]:[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:ul,error:{code:Sa,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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,this.isEmailExists(t)];case 1:if(e.sent())throw{code:Ra,message:"ERROR.EMAIL_ALREADY_REGISTERED"};return[2]}}))}))},n.prototype.isEmailExists=function(t){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return this._debug&&console.debug("[account] Checking if {"+t+"} exists..."),[4,this.graphql.query({query:dl,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 re(this,void 0,void 0,(function(){return ie(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:hl,variables:{email:t,locale:e},error:{code:Da,message:"ERROR.SENT_ACCOUNT_CONFIRMATION_EMAIL_FAILED"}})];case 1:return[2,n.sent()]}}))}))},n.prototype.confirmEmail=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(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:ml,variables:{email:t,code:e},error:{code:Na,message:"ERROR.CONFIRM_ACCOUNT_EMAIL_FAILED"}})];case 1:return[2,(n=o.sent())&&n.confirmAccountEmail]}}))}))},n.prototype.listenChanges=function(t){return this._enableListenChanges?new D.Subscription:this.startListenRemoteChanges(t)},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.asObservable()},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.stopListenRemoteChanges(),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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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+ll,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=Ts.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:Sa,message:"ERROR.LOAD_ACCOUNT_ERROR"};case 6:return[2]}}))}))},n.prototype.listenSettings=function(){return re(this,void 0,void 0,(function(){var t=this;return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return ie(this,(function(c){switch(c.label){case 0:return[4,Promise.all([this.storage.get(il),this.storage.get(rl),this.storage.get(al)])];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:Yi.decode(n),secretKey:Yi.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(sl)];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=Ts.getMainProfile(l.profiles),this._cache.loaded=!0,this.onLogin.next(this._data),this.onChange.next(this._data),this._enableListenChanges&&this.startListenRemoteChanges(),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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(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&&Yi.encode(this._cache.keypair.secretKey)||null,t.avatar&&!t.avatar.endsWith(ll)&&(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(il,this._cache.pubkey),this.storage.set(rl,this._cache.authToken),this.storage.set("account#"+this._cache.pubkey,t),e&&this.storage.set(al,e)||this.storage.remove(al),this.storage.remove(sl)])];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 re(this,void 0,void 0,(function(){var n,o;return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(this,(function(s){switch(s.label){case 0:if(t.pubkey=t.pubkey||e&&Yi.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=ue(t.id))?[3,2]:[4,this.load({fetchPolicy:"network-only"})];case 1:if(!(r=s.sent())||!r.updateDate)throw{code:Fa,message:"ERROR.ACCOUNT_NOT_EXISTS"};this.copyIdAndUpdateDate(r,t),s.label=2;case 2:return delete(i=t.asObject(xs)).profiles,[4,this.graphql.mutate({mutation:o?pl.create:pl.save,variables:{data:i},error:{code:Ma,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 re(this,void 0,void 0,(function(){var e,n,o;return ie(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(xs),[4,this.graphql.mutate({mutation:pl.saveSettings,variables:{data:n},error:{code:La,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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(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:Qa,message:"ERROR.AUTH_SERVER_ERROR"};return t?[4,this.graphql.query({query:fl,variables:{token:t},error:{code:Wa,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:Ka,message:"ERROR.AUTH_CHALLENGE_ERROR"},[4,this.graphql.query({query:gl,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.startListenRemoteChanges=function(t){var e=this;return this._listenChangesSubscription&&this.stopListenRemoteChanges(),this.network.offline?new D.Subscription:(this._listenChangesSubscription=this.watchChanges(t).subscribe({next:function(t){console.debug("[account] Remote update detected at "+t.updateDate),e.reload()},error:function(t){t&&+t.code===ts?(console.info("[account] [WS] Account not exists anymore: force user to logout...",t),e.logout()):t&&+t.code===Ja?(console.info("[account] [WS] Account not authorized: force user to logout...",t),e.logout()):console.warn("[account] [WS] Received error:",t)}}),this._listenChangesSubscription.add((function(){console.debug("[account] Stop watching remote changes"),e._listenChangesSubscription=null})),this._listenChangesSubscription)},n.prototype.stopListenRemoteChanges=function(){var t;null===(t=this._listenChangesSubscription)||void 0===t||t.unsubscribe()},n.prototype.watchChanges=function(t){var e=this;if(!this.started)return D.from(this.ready()).pipe(N.switchMap((function(){return e.watchChanges(t)})));if(!this._cache.pubkey)throw new Error("Not logged in");if(this.network.offline)throw new Error("Cannot watch account changes: network is offline.");var n={interval:we(t&&t.intervalInSeconds,this._listenIntervalInSeconds)};return console.debug("[account] Watching remote changes, every "+n.interval+"s"),this.graphql.subscribe({query:bl.listenChanges,variables:n,error:{code:ja,message:"ERROR.ACCOUNT.SUBSCRIBE_ERROR"}}).pipe(N.map((function(t){return t.data})),N.filter((function(t){var n,o=ao(null===(n=e._data)||void 0===n?void 0:n.updateDate),r=ao(null==t?void 0:t.updateDate);return r&&(!o||!r.isSame(o,"millisecond"))})))},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.prototype.showToast=function(t){return Ia.show(this.toastController,this.translate,t)},n}($s);yl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new yl(e.ɵɵinject(ea),e.ɵɵinject(_a),e.ɵɵinject(Vs),e.ɵɵinject(wa),e.ɵɵinject(st.Storage),e.ɵɵinject(Wi),e.ɵɵinject(F.TranslateService,8),e.ɵɵinject(L.ToastController,8),e.ɵɵinject(Qt))},token:yl,providedIn:"root"}),yl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[Qt]}]}],yl.ctorParameters=function(){return[{type:ea},{type:_a},{type:Vs},{type:wa},{type:st.Storage},{type:Wi},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:L.ToastController,decorators:[{type:e.Optional}]},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},t.Software=nl=function(t){function e(e){return t.call(this,e||nl.TYPENAME)||this}return ne(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=ia.getPropertyArrayAsObject(e.properties):this.properties=Object.assign({},e.properties)},e}(na),t.Software=nl=oe([la({typename:"SoftwareVO"})],t.Software),t.Configuration=ol=function(e){function n(){return e.call(this,ol.TYPENAME)||this}return ne(n,e),n.prototype.clone=function(){return this.copy(new ol)},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 pe(e)?e&&"false"!==e:void 0},n.prototype.getPropertyAsInt=function(t){var e=this.getProperty(t);return pe(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:pe(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 pe(this.properties[t.key])?this.properties[t.key]:t.defaultValue||void 0},n}(t.Software),t.Configuration=ol=oe([la({typename:"ConfigurationVO"})],t.Configuration);var vl,Cl,El,wl,Il,xl=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:us},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"},DB_TIMEZONE:{key:"sumaris.persistence.db.timezone",label:"DB Timezone (readonly)",type:"string",isTransient:!0}}),Ol="configuration",_l={config:yt.gql(vl||(vl=ce(["\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 "])))},kl=yt.gql(Cl||(Cl=ce(["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"],["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"])),_l.config),Sl=yt.gql(El||(El=ce(["\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"])),_l.config),Tl=yt.gql(wl||(wl=ce(["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"],["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"]))),Al=yt.gql(Il||(Il=ce(["\n query CacheStatistics {\n cacheStatistics\n }\n"],["\n query CacheStatistics {\n cacheStatistics\n }\n"]))),Rl=new e.InjectionToken("defaultOptions"),Pl=function(e){function n(t,n,o,r,i,a,s,l,c,u){var d=e.call(this,n,c)||this;return d.platform=t,d.graphql=n,d.storage=o,d.network=r,d.file=i,d.toastController=a,d.translate=s,d.accountService=l,d.environment=c,d.$data=new D.BehaviorSubject(null),d._debug=!c.production,d._debug&&console.debug("[config] Creating service"),d._optionDefs=Object.values(Object.assign(Object.assign({},xl),u)),d}return ne(n,e),Object.defineProperty(n.prototype,"config",{get:function(){return this.started||this.start(),this.$data.pipe(N.filter(pe))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(this,(function(s){switch(s.label){case 0:return n=Date.now(),console.debug("[config] Loading Pod configuration..."),o=e&&e.query||kl,r=e&&e.variables||void 0,[4,this.graphql.query({query:o,variables:r,error:{code:Ya,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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return console.warn("[config] Invalid call of configService.load(id). Please use loadDefault() instead"),[2,this.loadDefault()]}))}))},n.prototype.canUserWrite=function(t,e){return this.accountService.isAdmin()},n.prototype.save=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return console.debug("[config] Saving Pod configuration...",t),e=t.asObject(),[4,this.graphql.mutate({mutation:Sl,variables:{data:e},error:{code:Xa,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(),pe(i=this.$data.value)&&r.label===i.label&&this.$data.next(r),[2,r]}}))}))},n.prototype.getCacheStatistics=function(){return re(this,void 0,void 0,(function(){var t,e,n;return ie(this,(function(o){switch(o.label){case 0:return t=Date.now(),console.debug("[config] Loading server cache statistics..."),[4,this.graphql.query({query:Al,variables:null,error:{code:Ya,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 re(this,void 0,void 0,(function(){var e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return e=Date.now(),console.debug("[config] Clear server cache..."),n=t&&t.cacheName&&{name:t.cacheName}||void 0,[4,this.graphql.query({query:Tl,variables:n,error:{code:Ya,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"no-cache"})];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 re(this,void 0,void 0,(function(){var t,e,n=this;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return[4,this.storage.get(Ol)];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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:return t?[3,2]:[4,this.storage.remove(Ol)];case 1:return s.sent(),[3,8];case 2:if(e=this._debug&&Date.now(),!this.network.online||!Rn(window))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}))),fe(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}))))),fe(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(Ol,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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Ia.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},n}($s);Pl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Pl(e.ɵɵinject(L.Platform),e.ɵɵinject(Vs),e.ɵɵinject(st.Storage),e.ɵɵinject(_a),e.ɵɵinject(Wi),e.ɵɵinject(L.ToastController),e.ɵɵinject(F.TranslateService),e.ɵɵinject(yl),e.ɵɵinject(Qt),e.ɵɵinject(Rl,8))},token:Pl,providedIn:"root"}),Pl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[Rl]}]}],Pl.ctorParameters=function(){return[{type:L.Platform},{type:Vs},{type:st.Storage},{type:_a},{type:Wi},{type:L.ToastController},{type:F.TranslateService},{type:yl},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Rl]}]}]};var Dl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(File),Nl=function(t){this.type=Q.HttpEventType.Response,this.body=pe(null==t?void 0:t.body)?t.body:null,this.status=(null==t?void 0:t.status)||0,this.statusText=(null==t?void 0:t.statusText)||"OK"};function Ml(t){return t&&(t.type===Q.HttpEventType.UploadProgress||t.type===Q.HttpEventType.DownloadProgress)}function Fl(t){return t&&t.type===Q.HttpEventType.Response}var Ll=function(){function t(t,e,n){this.popoverController=t,this.translate=e,this.cd=n,this.uniqueFile=!1,this.instantUpload=!1,this.importing=!1}return Object.defineProperty(t.prototype,"files",{get:function(){return this.uploader.files},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.importing||ge(this.files)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return fe(this.files)},enumerable:!1,configurable:!0}),t.prototype.onValidate=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:if(null==t||t.stopPropagation(),this.importing)return[2];console.debug("[upload-file-popover] Validate form: will upload all files..."),r.label=1;case 1:r.trys.push([1,,8,9]),this.importing=!0,this.resetError(),r.label=2;case 2:return r.trys.push([2,6,,7]),[4,this.uploader.waitIdle()];case 3:return r.sent(),[4,this.uploader.uploadFiles()];case 4:if(r.sent(),ge(e=(this.uploader.processedFiles||[]).filter((function(t){return!t.deleting}))))return[2,this.cancel()];if((n=e.map((function(t){return t.error})).filter(he)).length)throw n.forEach((function(t){return console.error(t)})),{message:"FILE.UPLOAD.ERROR"};return[4,this.popoverController.dismiss(e)];case 5:return r.sent(),[3,7];case 6:return o=r.sent(),this.error=o&&o.message||o,[3,7];case 7:return[3,9];case 8:return this.importing=!1,this.cd.markForCheck(),[7];case 9:return[2]}}))}))},t.prototype.cancel=function(){return this.popoverController.dismiss()},t.prototype.resetError=function(){this.error&&(this.error=null,this.cd.markForCheck())},t}();Ll.decorators=[{type:e.Component,args:[{selector:"app-upload-file-popover",template:'\n<ion-content class="ion-no-padding" scrollY="false">\n <div class="modal-content">\n <app-upload-file\n #uploader\n [uploadFn]="uploadFn"\n [deleteFn]="deleteFn"\n [fileExtension]="fileExtension"\n [instantUpload]="instantUpload"\n [uniqueFile]="uniqueFile"\n [maxParallelUpload]="maxParallelUpload"\n ></app-upload-file>\n </div>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n <div *ngIf="importing" class="importing-info">\n <ion-text color="medium"><small translate>FILE.UPLOAD.IMPORTING</small></ion-text>\n <ion-spinner name="dots" color="accent"></ion-spinner>\n </div>\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="ion-text-wrap" [innerHTML]="error | translate"></ion-label>\n </ion-item>\n </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 <ion-button\n [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onValidate($event)"\n (keyup.enter)="onValidate($event)"\n color="tertiary"\n [disabled]="disabled"\n >\n <ion-label translate>COMMON.BTN_IMPORT</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n',encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".importing-info{-webkit-padding-start:var(--ion-padding);padding-inline-start:var(--ion-padding);display:inline-flex;flex-wrap:nowrap;padding-top:8px}"]}]}],Ll.ctorParameters=function(){return[{type:L.PopoverController},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Ll.propDecorators={uploader:[{type:e.ViewChild,args:["uploader",{static:!0}]}],fileExtension:[{type:e.Input}],title:[{type:e.Input}],uniqueFile:[{type:e.Input}],instantUpload:[{type:e.Input}],uploadFn:[{type:e.Input}],deleteFn:[{type:e.Input}],maxParallelUpload:[{type:e.Input}]};var jl=Object.freeze({ANDROID_APK:"application/vnd.android.package-archive"}),Bl=function(){function t(){}return t.showUploadPopover=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i;return ie(this,(function(a){switch(a.label){case 0:return[4,t.create({component:Ll,componentProps:n,backdropDismiss:!1,keyboardClose:!1,event:e,translucent:!0,cssClass:"popover-large"})];case 1:return[4,(o=a.sent()).present()];case 2:return a.sent(),[4,o.onDidDismiss()];case 3:return r=a.sent(),i=r.data,[2,{role:r.role,data:i||void 0}]}}))}))},t.readAsText=function(t,e){var n=new D.Subject,o=new FileReader;return e=(e||"UTF-8").toLowerCase(),o.onprogress=function(t){var e=t.total||1,o=t.total||0;o<e&&n.next({type:Q.HttpEventType.UploadProgress,loaded:o,total:e})},o.onloadend=function(e){var r=o.result;"string"==typeof r?(n.next(new Nl({body:r})),n.complete()):(console.error("Cannot read file '"+t.name+"' as text"),n.error("Cannot read file as text"))},o.onerror=function(t){console.error("[files] Error while reading file:",t),n.error(t)},o.readAsText(t,e),n.asObservable()},t}(),Vl=function(){function t(){}return t.getFilename=function(t){if(!t)return t;var e=t.trim(),n=e.lastIndexOf("/");-1!==n&&n!==t.length-1&&(e=e.substring(n+1));var o=e.indexOf("?");return-1!==o&&(e=e.substring(0,o)),e},t}(),ql=$t,Ul=Object.freeze({DIRECTORY_DOWNLOADS:"Download",DIRECTORY_DOWNLOADS_OLD:"Downloads"}),$l=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 ne(e,t),e.prototype.is=function(t){switch(t){case"mobile":case"mobileweb":return this.platform.is(t)&&!xn(window);default:return this.platform.is(t)}},Object.defineProperty(e.prototype,"mobile",{get:function(){return pe(this._mobile)?this._mobile:this.is("mobile")},enumerable:!1,configurable:!0}),e.prototype.isCordova=function(){return this._cordova},e.prototype.isAndroidCordova=function(){return this._android&&this._cordova||!1},e.prototype.isIOSCordova=function(){return this._ios&&this._cordova||!1},e.prototype.isApp=function(){return this.isAndroidCordova()||this.isIOSCordova()},e.prototype.isWeb=function(){return!this.isApp()},e.prototype.isMobileWeb=function(){return this.mobile&&this.isWeb()},Object.defineProperty(e.prototype,"canDownload",{get:function(){return this.downloader&&this.isAndroidCordova()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canOpenFile",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.width=function(){return this.platform.width()},e.prototype.height=function(){return this.platform.height()},e.prototype.ngOnStart=function(){var t;return re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:e=Date.now(),this.accountService.tokenType=void 0,console.info("[platform] Starting platform..."),a.label=1;case 1:return a.trys.push([1,8,,9]),this._mobile=this.is("mobile"),this._cordova=this.is("cordova"),this._android=this.is("android"),this._ios=this.is("ios"),this.configureClassList(this._mobile),this.configureCordovaPlugins(),this.settings.mobile=this._mobile,[4,this.configureTranslate()];case 2:return a.sent(),[4,this.storageReady()];case 3:return n=a.sent(),[4,this.migrateStorage(n)];case 4:return a.sent(),[4,Promise.all([this.entitiesStorage.ready(),this.cache.ready().then((function(){return i.configureCache()})),this.settings.ready(),this.networkService.ready(),this.audioProvider.ready()])];case 5:return a.sent(),this.isWeb()&&this.environment.production?[4,this.checkAppVersion({canReload:!0})]:[3,7];case 6:a.sent(),a.label=7;case 7:return this.networkService.onNetworkStatusChanges.pipe(N.skip(1)).subscribe((function(t){return i.configureCache("none"!==t)})),console.info("[platform] Starting platform [OK] {mobile: "+this._mobile+", web: "+this.isWeb()+", downloader: "+this.canDownload+", fileOpener: "+this.canOpenFile+"} in "+(Date.now()-e)+"ms"),this.configService.config.pipe(N.map((function(t){return null==t?void 0:t.getProperty(xl.AUTH_TOKEN_TYPE)})),N.filter(he),N.distinctUntilChanged()).subscribe((function(t){console.info("[platform] Using auth token type {"+t+"}"),i.accountService.tokenType=t})),this._mobile&&setTimeout((function(){var t;null===(t=i.splashScreen)||void 0===t||t.hide(),i.audioProvider.playStartupSound()}),1e3),o=1e3*(this.environment.checkAppVersionIntervalInSeconds||0),this.isWeb()&&this.environment.production&&o>0&&(null===(t=this.checkAppVersionTimer)||void 0===t||t.unsubscribe(),this.checkAppVersionTimer=D.timer(o,o).subscribe((function(t){return i.checkAppVersion({silent:!0,canReload:!1})})),this.registerSubscription(this.checkAppVersionTimer)),[3,9];case 8:return r=a.sent(),[2,this.onStartupError(r)];case 9: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,n,o=this;if(!t||!t.uri)throw new Error("Missing argument 'request' or 'request.uri'");if(this._android&&this.downloader){var r=this._downloadingJobs.get(t.uri);if(r)return r;var i=(null===(e=t.destinationInExternalPublicDir)||void 0===e?void 0:e.subPath)||(null===(n=t.destinationInExternalFilesDir)||void 0===n?void 0:n.subPath)||t.filename||Vl.getFilename(t.uri)||t.title||"download";i=i.toLowerCase().replace(/\s+/g,"-"),t.mimeType!==jl.ANDROID_APK||i.toLowerCase().endsWith(".apk")||(i+=".apk");var a=Object.assign(Object.assign({visibleInDownloadsUi:!0,notificationVisibility:St.NotificationVisibility.VisibleNotifyCompleted},t),{filename:void 0,destinationInExternalPublicDir:t.destinationInExternalFilesDir?void 0:Object.assign(Object.assign({dirType:Ul.DIRECTORY_DOWNLOADS},t.destinationInExternalPublicDir),{subPath:i}),destinationInExternalFilesDir:t.destinationInExternalFilesDir?Object.assign(Object.assign({dirType:Ul.DIRECTORY_DOWNLOADS},t.destinationInExternalFilesDir),{subPath:i}):void 0});return console.debug("[platform] Downloading, using request: "+JSON.stringify(a)),r=D.from(this.downloader.download(a)),this._downloadingJobs.set(a.uri,r),r.pipe(N.tap((function(t){return console.info("[platform] File successfully downloaded at:"+t),o._downloadingJobs.delete(a.uri),t})),N.catchError((function(t){var e;if(console.error("[platform] Unable to download: "+(t&&t.message||t)),o._downloadingJobs.delete(a.uri),(null===(e=a.destinationInExternalPublicDir)||void 0===e?void 0:e.dirType)===Ul.DIRECTORY_DOWNLOADS)return a.destinationInExternalPublicDir.dirType=Ul.DIRECTORY_DOWNLOADS_OLD,o.download(a);throw t})))}return console.warn("[platform] Cannot use Cordova downloader plugin: using browser open()"),this.open(t.uri,"_system","location=no",!0),D.of()},e.prototype.openFile=function(t,e){return console.debug("[platform] Opening file: "+t+" ("+e+") ..."),console.warn("[platform] Cannot use Cordova FileOpener plugin: using browser open()"),this.open(t,"_system","location=no",!0),Promise.resolve()},e.prototype.configureClassList=function(t,e){var n,o;void 0===e&&(e=window),t||t||!(null===(n=e.document.documentElement)||void 0===n?void 0:n.classList.contains("plt-mobile"))&&!(null===(o=e.document.documentElement.classList)||void 0===o?void 0:o.contains("plt-mobileweb"))||(console.warn('[platform] Force class list to: <html class="plt-desktop">. Workaround for Windows touch screen.'),e.document.documentElement.classList.remove("plt-mobile","plt-mobileweb"),e.document.documentElement.classList.add("plt-desktop"))},e.prototype.configureCordovaPlugins=function(){console.info("[platform] Configuring Cordova plugins..."),this.statusBar&&(this.statusBar.styleDefault(),this.statusBar.overlaysWebView(!1)),this.keyboard&&this.keyboard.hideFormAccessoryBar(!0)},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{ql.locale(e.lang),console.debug("[platform] Use locale {"+e.lang+"}")}catch(t){ql.locale("en"),console.warn("[platform] Unknown local for moment lib. Using default [en]")}t.dateAdapter.setLocale(ql.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=Ee(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.checkAppVersion=function(t){var e,n,o;return re(this,void 0,void 0,(function(){var r,i,a,s,l,c;return ie(this,(function(u){switch(u.label){case 0:return this.networkService.offline||!this.isWeb()?[2]:(r=!0===(null==t?void 0:t.silent),i=this.environment.production,a=!t||!1!==t.canReload,r||console.info("[platform] Checking remote app version..."),de(s=this.environment.version)?(console.error("[platform] Missing required value for 'environment.version'. Cannot check remote app version."),null===(e=this.checkAppVersionTimer)||void 0===e||e.unsubscribe(),[2]):[4,this.networkService.getAppVersion()]);case 1:return de(l=u.sent())?(i&&!r&&console.error("[platform] Cannot load remote app version. Skipping version check"),null===(n=this.checkAppVersionTimer)||void 0===n||n.unsubscribe(),[2]):pa.isCompatible(l,s)?(r||console.info("[platform] Checking remote app version [OK] {remote: '"+l+"', actual: '"+s+"'}"),[2]):(c=location.href.replace(/[&]?version=[0-9.]+/gi,""),c+=-1===c.indexOf("?")?"?":"&",(c+="version="+l)===location.href?(a&&console.error("[platform] Reloaded page failed, because version still mismatch! Please check version.appup file (expected app version: "+s+")"),null===(o=this.checkAppVersionTimer)||void 0===o||o.unsubscribe(),[2]):(console.warn("[platform] More recent version detected (remote: "+l+", actual: "+s),a?(console.info("[platform] Will reloading at "+c),location.href=c,[3,4]):[3,2]));case 2:return[4,this.showToast({message:"CONFIRM.RELOAD_APP",messageParams:{version:l,name:this.environment.name},type:"info",duration:-1,buttons:[{text:this.translate.instant("COMMON.BTN_RELOAD"),side:"end",handler:function(){return location.href=c,!0}}]})];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},e.prototype.storageReady=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return console.info("[platform] Starting storage..."),[4,this.storage.ready()];case 1:return t=e.sent(),ue(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a;return ie(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 ge(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",type:"info",duration:3e4})];case 4:r=s.sent(),s.label=5;case 5:return s.trys.push([5,9,,12]),[4,cs.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 Ia.show(e.toastController,e.translate,Object.assign(Object.assign({},t),{onWillPresent:function(t){return n(t)}}))}))},e.prototype.onStartupError=function(t){return re(this,void 0,void 0,(function(){var e,n;return ie(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}(Mi);$l.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new $l(e.ɵɵinject(L.Platform),e.ɵɵinject(gt.Platform),e.ɵɵinject(L.ToastController),e.ɵɵinject(F.TranslateService),e.ɵɵinject(B.MomentDateAdapter),e.ɵɵinject(ss),e.ɵɵinject(wa),e.ɵɵinject(_a),e.ɵɵinject(yl),e.ɵɵinject(Pl),e.ɵɵinject(pt.CacheService),e.ɵɵinject(st.Storage),e.ɵɵinject(Li),e.ɵɵinject(Qt),e.ɵɵinject(Tt.StatusBar,8),e.ɵɵinject(At.Keyboard,8),e.ɵɵinject(mt.SplashScreen,8),e.ɵɵinject(Rt.InAppBrowser,8),e.ɵɵinject(Pt.Downloader,8))},token:$l,providedIn:"root"}),$l.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],$l.ctorParameters=function(){return[{type:L.Platform},{type:gt.Platform},{type:L.ToastController},{type:F.TranslateService},{type:B.MomentDateAdapter},{type:ss},{type:wa},{type:_a},{type:yl},{type:Pl},{type:dt.CacheService},{type:st.Storage},{type:Li},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:ft.StatusBar,decorators:[{type:e.Optional}]},{type:V.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 Gl=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 re(this,void 0,void 0,(function(){return ie(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}();Gl.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'}]}],Gl.ctorParameters=function(){return[{type:e.Injector},{type:L.ModalController},{type:$l},{type:wa},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Gl.propDecorators={title:[{type:e.Input}],markdownContent:[{type:e.Input}],docUrl:[{type:e.Input}],showError:[{type:e.Input}]};var Hl=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 ne(e,t),e.prototype.translateLabels=function(){this.optionalLabel=this.translate.instant("COMMON.OPTIONAL")},e}(w.MatStepperIntl);Hl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Hl(e.ɵɵinject(F.TranslateService))},token:Hl,providedIn:"root"}),Hl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Hl.ctorParameters=function(){return[{type:F.TranslateService}]};var zl=function(){function t(t,e){this.cd=t,this.translate=e,this.uniqueFile=!1,this.instantUpload=!1,this.files=[]}return Object.defineProperty(t.prototype,"processingFiles",{get:function(){return this.files.filter((function(t){return!t.deleting&&pe(t.progress)&&t.progress<1}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"processedFiles",{get:function(){return this.files.filter((function(t){return!t.deleting&&1===t.progress}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"processingFilesCount",{get:function(){return this.processingFiles.length},enumerable:!1,configurable:!0}),t.prototype.onFileDropped=function(t){this.prepareFilesList(t)},t.prototype.fileBrowseHandler=function(t){this.prepareFilesList(t)},t.prototype.deleteFile=function(t){return re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:if(1!==(e=this.files[t]).progress||!this.deleteFn)return[3,6];if(e.deleting)return console.warn("[upload-file] This file already deleting"),[2];o.label=1;case 1:return o.trys.push([1,3,4,5]),e.deleting=!0,[4,this.deleteFn(e)];case 2:return o.sent()?[3,5]:[2];case 3:return n=o.sent(),console.error(n&&n.message||n),[2];case 4:return e.deleting=!1,[7];case 5:return-1===(t=this.files.indexOf(e))?[2]:[3,7];case 6:if(e.progress>0)return console.warn("[upload-file] Cannot remove this file while uploading"),[2];o.label=7;case 7:return this.files.splice(t,1),this.cd.markForCheck(),[2]}}))}))},t.prototype.prepareFilesList=function(t){var e,n;if(t instanceof FileList){n=[];for(var o=0;o<t.length;o++){var r=t.item(o);n.push(r)}}else n=t;(e=this.files).push.apply(e,le(n)),this.fileDropEl.nativeElement.value="",this.instantUpload&&this.uploadFiles(n)},t.prototype.uploadFiles=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){return t||(console.info("[upload-file] Uploading all files..."),t=this.files),e=new D.BehaviorSubject(this.processingFilesCount),(n=new D.Subject).subscribe((function(t){r.cd.markForCheck(),e.next(r.processingFilesCount)})),o=t.map((function(t){return t})).filter((function(t){return t&&ue(t.progress)&&!t.error})).map((function(t,o){return pe(r.maxParallelUpload)?e.pipe(N.debounceTime(o),N.filter((function(t){return t<r.maxParallelUpload})),N.map((function(e){return ue(t.progress)&&(t.progress=0),n.next(),t})),N.first()):(ue(t.progress)&&(t.progress=0),D.of(t))})).map((function(t){return t.pipe(N.filter(pe),N.tap((function(t){return console.debug("[upload-file] "+t.name+": uploading...")})),N.switchMap((function(t){return r.uploadFn(t).pipe(N.filter(pe),N.map((function(e){return Ml(e)?pe(e.loaded)&&e.loaded>=0?t.progress=Math.min(1,e.loaded/(e.total||1)):t.progress=-1:Fl(e)?(t.progress=1,t.response=e,console.debug("[upload-file] "+t.name+": "+(e.statusText||"OK"),t.response)):console.debug("[upload-file] Ignoring a file event: ",e),t})),N.catchError((function(e){var n;return console.error(e),t.error=e&&(e.message||(null===(n=e.error)||void 0===n?void 0:n.message))||"FILE.UPLOAD.ERROR",D.of(t)})),N.tap((function(){n.next(),r.cd.markForCheck()})))})))})),[2,D.forkJoin(o).pipe(N.tap((function(t){return n.complete()}))).toPromise()]}))}))},t.prototype.waitIdle=function(t){var e=this;return dn((function(){return 0===e.processingFilesCount}),t)},t}();zl.decorators=[{type:e.Component,args:[{selector:"app-upload-file",template:'<div *ngIf="!uniqueFile || files.length === 0"\n class="container"\n appDragAndDrop (fileDropped)="onFileDropped($event)">\n <input\n type="file"\n #fileDropRef\n id="fileDropRef"\n multiple\n [accept]="fileExtension"\n (change)="fileBrowseHandler($any($event.target).files)"\n />\n <mat-icon style="font-size: xx-large" color="accent">file_upload</mat-icon>\n <ion-label\n [innerHTML]="\n \'FILE.UPLOAD.DRAG_AND_DROP\' | translate: { extension: !fileExtension ? \'\' : \' (\' + fileExtension + \')\' }\n "\n ></ion-label>\n <ion-button>{{ \'FILE.UPLOAD.BROWSE\' | translate }}</ion-button>\n</div>\n<div class="files-list">\n <div *ngFor="let file of files; index as i"\n class="single-file"\n [class.deleting]="file.deleting">\n <mat-icon>description</mat-icon>\n <div class="info">\n <h4 class="name">\n {{ file.name }}\n </h4>\n <p class="size">\n {{ file.size | fileSize }}\n </p>\n <ion-progress-bar *ngIf="!file.error"\n [value]="file.progress||0"\n [type]="(file.deleting || file.progress === -1) ? \'indeterminate\' : \'determinate\'"></ion-progress-bar>\n <ion-label *ngIf="file.error" color="danger" [innerHTML]="file.error | translate"></ion-label>\n </div>\n \x3c!-- remote from list (before importation) --\x3e\n <button *ngIf="!(file.progress) || file.error" mat-icon-button (click)="deleteFile(i)">\n <mat-icon>clear</mat-icon>\n </button>\n \x3c!-- delete file (remotely - after importation) --\x3e\n <button *ngIf="file.progress === 1 && !!deleteFn && !file.deleting" mat-icon-button (click)="deleteFile(i)">\n <mat-icon>clear</mat-icon>\n </button>\n </div>\n</div>\n',styles:[".container{width:calc(100% - 3rem);min-height:200px;padding:2rem;text-align:center;border:1px dashed #979797;position:relative;margin:1.5rem}.container input{opacity:0;position:absolute;z-index:2;width:100%;height:100%;top:0;left:0;cursor:pointer}.container ion-label{display:block;font-size:20px;font-weight:600;color:#38424c}.container label{display:inline-block;color:#fff;width:183px;height:44px;border-radius:21.5px;background-color:#db202f;padding:8px 16px}.fileover{-webkit-animation:shake 1s;animation:shake 1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.files-list{max-height:300px;overflow:auto}.files-list .single-file{display:flex;flex-grow:1;padding:.5rem;justify-content:space-between;align-items:center;border:1px dashed #979797;margin-bottom:1rem}.files-list .single-file.deleting .name{color:grey!important;font-style:italic!important}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0 0 .25rem}.files-list .single-file .info{width:100%}@-webkit-keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}@keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}"]}]}],zl.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:F.TranslateService}]},zl.propDecorators={fileDropEl:[{type:e.ViewChild,args:["fileDropRef",{static:!1}]}],fileExtension:[{type:e.Input}],uniqueFile:[{type:e.Input}],instantUpload:[{type:e.Input}],uploadFn:[{type:e.Input}],deleteFn:[{type:e.Input}],maxParallelUpload:[{type:e.Input}]};var Wl=new e.InjectionToken("testingPages"),Kl=function(){function t(t,e,n,o){this.route=t,this.router=e,this.translate=n,this.pages=o,console.info("[testing] Loaded tests pages:",o)}return t.prototype.openPage=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.router.navigate([t],{relativeTo:this.route})]}))}))},t}();function Ql(t){return function(){return t.scrollStrategies.close()}}Kl.decorators=[{type:e.Component,args:[{selector:"app-tests-page",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>Tests</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list *ngIf="pages?.length">\n\n <ng-container *ngFor="let item of pages">\n\n <ion-item-divider *ngIf="item.divider; else link">{{item.label}}</ion-item-divider>\n\n <ng-template #link>\n <ion-item tappable class="text-1x"\n (click)="openPage(item.page)">{{item.label}}</ion-item>\n </ng-template>\n </ng-container>\n </ion-list>\n\n</ion-content>\n'}]}],Kl.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:F.TranslateService},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Wl]}]}]};var Yl=function(){function t(){}return t.forRoot=function(e){return console.debug("[shared] Creating module (root)"),{ngModule:t,providers:[{provide:Qt,useValue:e},Ei,Li,Wi,To,Fn,Bn,jn,Zn,Xn,Jn,eo,to,{provide:i.OverlayContainer,useClass:i.FullscreenOverlayContainer},{provide:Q.HTTP_INTERCEPTORS,useClass:ki,multi:!0,deps:[Ei]},{provide:u.MatPaginatorIntl,useClass:_i,deps:[F.TranslateService]},{provide:w.MatStepperIntl,useClass:Hl,deps:[F.TranslateService]},{provide:R.MAT_AUTOCOMPLETE_SCROLL_STRATEGY,useFactory:Ql,deps:[i.Overlay]},{provide:R.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,useValue:{autoActiveFirstOption:!0}},{provide:v.MAT_SELECT_SCROLL_STRATEGY,useFactory:Ql,deps:[i.Overlay]}]}},t}();Yl.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,F.TranslateModule,Y.ColorPickerModule,q.TextMaskModule,rt.DragDropModule,it.MarkdownModule,Ci,wr,yr,Vi],declarations:[Oi,Ki,Ni,Qi,Gl,zl,Ll,Kl],exports:[n.CommonModule,L.IonicModule,F.TranslateModule,P.ReactiveFormsModule,Y.ColorPickerModule,q.TextMaskModule,rt.DragDropModule,it.MarkdownModule,Ci,wr,yr,Vi,Oi,Ki,Ni,Qi,Gl,zl,Ll,Kl]}]}];var Xl=function(){function t(){}return t.askSaveBeforeLeave=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a;return ie(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 re(this,void 0,void 0,(function(){var a;return ie(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 re(this,void 0,void 0,(function(){var i,a,s,l;return ie(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 re(this,void 0,void 0,(function(){var r,i,a,s;return ie(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 re(this,void 0,void 0,(function(){var r,i,a,s;return ie(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 re(this,void 0,void 0,(function(){var i,a,s;return ie(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}(),Jl=function(){function t(t,e){this.translate=t,this.alertCtrl=e,this.debug=!1}return t.prototype.canDeactivate=function(t,e,n,o){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return e=null==t?void 0:t.dirty,n=null==t?void 0:t.valid,o={confirmed:!e,save:!1},this.debug&&console.debug("[dirty-guard] canDeactivate component dirty: "+e+", valid: "+n),e?[4,Xl.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}();Jl.decorators=[{type:e.Injectable}],Jl.ctorParameters=function(){return[{type:F.TranslateService},{type:L.AlertController}]};var Zl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(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}(L.IonicRouteStrategy);Zl.decorators=[{type:e.Injectable}];var tc=function(){console.debug("[shared-routing] Creating module...")};tc.decorators=[{type:e.NgModule,args:[{imports:[W.RouterModule],providers:[{provide:W.RouteReuseStrategy,useClass:Zl},{provide:Jl,useClass:Jl}]}]}],tc.ctorParameters=function(){return[]};var ec=function(){function t(){}return t.prototype.getAsBoolean=function(t,e){var n=this.get(t,e);return pe(n)?n&&"false"!==n:void 0},t.prototype.getAsInt=function(t,e){var n=this.get(t,e);return pe(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:pe(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 pe(t[e.key])?t[e.key]:e.defaultValue||void 0},t}(),nc=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(wa),this.errorTranslator=t.get(dr),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(),this._$ready.unsubscribe(),this._$loading.complete(),this._$loading.unsubscribe()},t.prototype.cancel=function(){this.onCancel.emit()},t.prototype.doSubmit=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(n){switch(n.label){case 0:return this._form?e&&!1===e.checkValid||this._form.valid?[3,2]:[4,ar.waitWhilePending(this._form)]:(this.markAllAsTouched({emitEvent:!0}),[2]);case 1:if(n.sent(),this._form.invalid)return this.markAllAsTouched({emitEvent:!0}),this.debug&&ar.logFormErrors(this._form),[2];n.label=2;case 2:return this.onSubmit.emit(t),[2]}}))}))},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?(ar.copyEntity2Form(t,this.form,Object.assign({emitEvent:!1,onlySelf:!0},e)),e&&!0===e.emitEvent||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=ar.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"),ar.markAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){ar.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 pn(this._$ready,t)},t.prototype.waitIdle=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,ar.waitIdle(this,t)]}))}))},t.prototype.updateValueAndValidity=function(t){ar.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.translateFormErrors(this.form,Object.assign({controlPathTranslator:this},e))},t.prototype.getI18nFieldName=function(t){return(this.i18nFieldPrefix||"")+ke(t).toUpperCase()},t.prototype.registerSubscription=function(t){return this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(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}();nc.decorators=[{type:e.Directive}],nc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormGroup}]},nc.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 oc=function(t){function n(n,o,r){var i=t.call(this,n)||this;return i.injector=n,i.cd=o,i.formBuilder=r,i.showError=!0,i.multiline=!0,i.autoHeight=!1,i.maxLength=2e3,i.autofocus=!1,i.textAreaChanges=new e.EventEmitter,i}return ne(n,t),n.prototype.ngOnInit=function(){var e=this.formBuilder.group({text:[null,pe(this.maxLength)?P.Validators.maxLength(this.maxLength):void 0]});this.control=e.get("text"),this.setForm(e),t.prototype.ngOnInit.call(this)},n.prototype.textAreaChanged=function(t){this.textAreaChanges.emit(this.control.value)},n.prototype.containerResize=function(){var t;null===(t=this.autosizeDirective)||void 0===t||t.resizeToFitContent(!0)},n.prototype.focusInput=function(){this.textArea&&Xe(this.textArea),this.textInput&&Xe(this.textInput)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);oc.decorators=[{type:e.Component,args:[{selector:"app-text-form",template:'<form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n <mat-form-field *ngIf="multiline; else monoline">\n <textarea\n #textArea\n matInput\n [formControl]="control"\n [placeholder]="placeholder"\n [readonly]="control.disabled"\n [class.fixed-height]="!autoHeight"\n [cdkTextareaAutosize]="autoHeight"\n (keyup)="textAreaChanged($event)"\n (keydown.control.enter)="onSubmit.emit($event)"\n [autofocus]="autofocus"\n ></textarea>\n <mat-error *ngIf="control.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: control.errors[\'maxlength\'] }}\n </mat-error>\n <mat-hint *ngIf="maxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]="control"\n [placeholder]="placeholder"\n [readonly]="disabled"\n [appAutofocus]="autofocus"\n (keydown.control.enter)="onSubmit.emit($event)"\n />\n <mat-error *ngIf="control.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: control.errors[\'maxlength\'] }}\n </mat-error>\n <mat-hint *ngIf="maxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n',styles:["textarea.fixed-height{height:11.5em}"]}]}],oc.ctorParameters=function(){return[{type:e.Injector},{type:e.ChangeDetectorRef},{type:P.FormBuilder}]},oc.propDecorators={showError:[{type:e.Input}],placeholder:[{type:e.Input}],multiline:[{type:e.Input}],autoHeight:[{type:e.Input}],maxLength:[{type:e.Input}],autofocus:[{type:e.Input}],textAreaChanges:[{type:e.Output}],textArea:[{type:e.ViewChild,args:["textArea"]}],textInput:[{type:e.ViewChild,args:["textInput"]}],autosizeDirective:[{type:e.ViewChild,args:[Dt.CdkTextareaAutosize]}]};var rc=function(){function t(t,e){this.popoverController=t,this.translate=e,this.placeholder="",this.editing=!0,this.multiline=!0,this.maxLength=2e3,this.autofocus=!1,this.subscription=new D.Subscription}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this.form.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.form.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){var t;return(null===(t=this.form)||void 0===t?void 0:t.valid)||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){var t;return null===(t=this.form)||void 0===t?void 0:t.value.text},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.enable()},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){return t.form.setValue({text:t.text})}),0)},t.prototype.onValidate=function(t){return re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return[4,er(this.form)];case 1:if(n.sent(),!this.valid)return Uo(this.form.control),[2];n.label=2;case 2:return n.trys.push([2,4,,5]),t=this.value,this.disable(),[4,this.popoverController.dismiss(t)];case 3:return n.sent(),this.form.error=null,[3,5];case 4:return e=n.sent(),this.form.error=e&&e.message||e,this.enable(),[3,5];case 5:return[2]}}))}))},t.prototype.disable=function(){this.form.disable()},t.prototype.enable=function(){this.editing&&this.form.enable()},t.prototype.cancel=function(){this.popoverController.dismiss()},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t}();rc.decorators=[{type:e.Component,args:[{selector:"app-text-popover",template:'\n<ion-content class="ion-padding" cdkTrapFocus [cdkTrapFocusAutoCapture]="true">\n <ion-item *ngIf="form.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]="form.error|translate"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]="placeholder"\n [multiline]="multiline"\n [maxLength]="maxLength"\n [autofocus]="editing && autofocus"\n (onSubmit)="onValidate($event)"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n\n </ion-col>\n\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-button\n [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onValidate($event)"\n (keyup.enter)="onValidate($event)"\n color="tertiary"\n [disabled]="disabled"\n [title]="\'COMMON.BTN_VALIDATE_WITH_SHORTCUT_HELP\'|translate">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n'}]}],rc.ctorParameters=function(){return[{type:L.PopoverController},{type:F.TranslateService}]},rc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}],text:[{type:e.Input}],placeholder:[{type:e.Input}],editing:[{type:e.Input}],multiline:[{type:e.Input}],maxLength:[{type:e.Input}],autofocus:[{type:e.Input}]};var ic=function(){function t(){}return t.prototype.ngOnDestroy=function(){},t}();ic.decorators=[{type:e.Directive}];var ac=function(t){function e(e){return t.call(this,e)||this}return ne(e,t),e.prototype.asPodObject=function(){return this.asObject(xs)},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(!ge(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||ws.isNotEmpty(e))},e}(na),sc=function(){function t(){}return t.isEntityFilter=function(t){return!!(t&&t.asPodObject&&t.asFilterFn)},t.fromObject=function(e,n){if(!e)return e;if(oa(e,n))return e;var o=new n;return t.isEntityFilter(o)?o.fromObject(e):Object.assign(o,e),o},t}(),lc=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 ac)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 ne(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(pe),N.mergeMap((function(t){return dn((function(){return!a._saving}))})),N.mergeMap((function(i){return re(a,void 0,void 0,(function(){var i,a,s,l,c,u;return ie(this,(function(d){switch(d.label){case 0:i=[],d.label=1;case 1:return d.trys.push([1,,6,7]),ge(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,le(a)):i,[7];case 7:return[2]}}))}))})))},e.prototype.saveAll=function(t,e){return re(this,void 0,void 0,(function(){var e,n;return ie(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]),fe(this._hiddenData)&&(t=t.concat.apply(t,le(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 re(this,void 0,void 0,(function(){var e,n=this;return ie(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",ia.sort(t,e,n)},e.prototype.asFilter=function(t){return sc.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):ia.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}(ic);lc.decorators=[{type:e.Directive}],lc.ctorParameters=function(){return[{type:Function},{type:Function},{type:void 0}]};var cc=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(Object.assign(Object.assign({},e),{progression:n})).then((function(){(null==e?void 0:e.maxProgression)&&n.next(e.maxProgression),n.complete()})).catch((function(t){return n.error(t)})),n},t.fetchAllPages=function(t,e){var n,o;return re(this,void 0,void 0,(function(){var r,i,a,s,l,c,u,d,p,h;return ie(this,(function(m){switch(m.label){case 0:if(r=we(null==e?void 0:e.maxProgression,100),i=null==e?void 0:e.progression,(u=we(null==e?void 0:e.fetchSize,1e3))<=0)throw new Error("Unable to fetch pages: invalid fetchSize: "+u);d=0,p=[],m.label=1;case 1:return e&&e.logPrefix&&console.debug(e.logPrefix+" Fetching page #"+d/u+"..."),[4,t(d,u)];case 2:h=m.sent(),p=p.concat(h.data),c=h.data&&h.data.length||0,d+=c,ue(a)&&pe(h.total)&&(a=h.total,s=Math.round(h.total/u+.5),i&&(l=r/s,e&&e.logPrefix&&console.debug(e.logPrefix+" {pageCount: "+s+", progress: "+(null===(n=i.value)||void 0===n?void 0:n.toFixed(2))+", pageProgressStep: "+(null==l?void 0:l.toFixed(1))+"}"))),pe(l)&&i.next(i.value+l),(null==e?void 0:e.onPageLoaded)&&e.onPageLoaded(h),m.label=3;case 3:if(c>0&&(ue(a)&&c===u||pe(a)&&d<a))return[3,1];m.label=4;case 4:return pe(l)?(pe(a)&&p.length<a&&(console.warn("A function loadAll() returned a bad total (less than all page's data)! Expected "+a+" but fetch "+p.length),a=p.length,s=Math.round(p.length/u+.5)),l=Math.max(0,r-l*s)):i&&(l=r),e&&e.logPrefix&&console.debug(e.logPrefix+" All pages fetched - {progress: "+(null===(o=i.value)||void 0===o?void 0:o.toFixed(2))+", lastProgressStep: "+(null==l?void 0:l.toFixed(1))),i&&l>0&&i.next(i.value+l),[2,{data:p,total:a}]}}))}))},t}(),uc={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]},dc={},pc=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 dc[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 pe(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 ue(t=pe(t)?t:this._opacity)||t<0||t>1?"rgb("+this._rgbArray.join(",")+")":"rgba("+this._rgbArray.join(",")+","+t+")"},t}();pc.transparent=function(){return new pc([0,0,0],0,"translucent")};var hc=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,pc.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}();hc.custom=function(t,e){return new hc(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=mc(e.mainColorIndex+1,{opacity:e.opacity,startColor:e.startColor,endColor:e.mainColor,format:e.format});return e.mainColorIndex<t-1?n.concat(mc(t-e.mainColorIndex,{opacity:e.opacity,startColor:e.mainColor,endColor:e.endColor,format:e.format})):n}return mc(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:pe(e.mainColorIndex)?e.mainColorIndex:void 0,endColor:e.endColor||void 0,format:e.format}),e)},Object.getOwnPropertyNames(uc).forEach((function(t){dc[t]=new pc(uc[t],1,t)}));function mc(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 fc=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 re(this,void 0,void 0,(function(){var t,e;return ie(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}();fc.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'}]}],fc.ctorParameters=function(){return[{type:yl},{type:L.ModalController}]},fc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var gc=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=i.mobile,d.canWorkOffline=d.settings.hasOfflineFeature(),d._enable=!0,d}return ne(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(xl.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.getPropertyAsBoolean(xl.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){return re(this,void 0,void 0,(function(){var e,n=this;return ie(this,(function(o){switch(o.label){case 0:return t&&(t.preventDefault(),t.stopPropagation()),this.loading?[2]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return ar.logFormErrors(this.form),[2];o.label=2;case 2:return this.markAsLoading(),e=this.form.value,this.showPwd=!1,this.error=null,setTimeout((function(){return n.onSubmit.emit({username:e.username,password:e.password,offline:e.offline})})),[2]}}))}))},n.prototype.register=function(){var t=this;this.onCancel.emit(),setTimeout((function(){return re(t,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:fc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))}),200)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);gc.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:[Cn],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],gc.ctorParameters=function(){return[{type:e.Injector},{type:$l},{type:P.FormBuilder},{type:wa},{type:Pl},{type:L.ModalController},{type:_a},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]},gc.propDecorators={onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var bc=function(){function t(t,e,n){this.accountService=t,this.viewCtrl=e,this.cd=n}return Object.defineProperty(t.prototype,"loading",{get:function(){var t;return null===(t=this.form)||void 0===t?void 0:t.loading},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.form.markAsReady({emitEvent:!1}),this.form.markAsLoaded()},t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.doSubmit=function(){return re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:if(this.form.disabled)return[2];if(!this.form.valid)return this.form.markAllAsTouched(),[2];this.markAsLoading(),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.form.error=n&&n.message||n,this.markAsLoaded(),this.form.enable(),ln(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2];case 4:return[2]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.markAsLoading=function(t){this.form.markAsLoading(t)},t.prototype.markAsLoaded=function(t){this.form.markAsLoaded(t)},t}();bc.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:[""]}]}],bc.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:e.ChangeDetectorRef}]},bc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var yc=new e.InjectionToken("aboutDevelopers"),vc=new e.InjectionToken("aboutPartners"),Cc=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&&qe(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 re(this,void 0,void 0,(function(){return ie(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(xl.FORUM_URL))||this.environment.forumUrl,this.helpUrl=(null==t?void 0:t.getProperty(xl.HELP_URL))||this.environment.helpUrl},t}();Cc.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}"]}]}],Cc.ctorParameters=function(){return[{type:F.TranslateService},{type:L.ModalController},{type:Pl},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[yc]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[vc]}]}]};var Ec=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 wc(t){return t[Math.floor(Math.random()*t.length)]}var Ic=new e.InjectionToken("homeButton"),xc=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){var p,h=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 h.start()})),this.showAccountButton=Ee(null===(p=c.account)||void 0===p?void 0:p.showAccountButton,!0)}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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:bc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.register=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:fc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.logout=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Ia.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.isWeb(),this.canRegister=t.getPropertyAsBoolean(xl.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 pe(t)&&(!e.offline||!t.startsWith("http"))}));if(o.length){var r=wc(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=As(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 Ec.checkIfVisible(e,t.accountService,t._config,{isLogin:t.isLogin,debug:t._debug,logPrefix:"[home]"})})).map((function(e){if(he(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}();xc.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 *ngIf="showAccountButton" 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" [innerHTML]="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:[bn,Cn],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 ion-card-content ion-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)}}"]}]}],xc.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:F.TranslateService},{type:L.ToastController},{type:Pl},{type:$l},{type:e.ChangeDetectorRef},{type:_a},{type:wa},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Inject,args:[us]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Ic]}]}]};var Oc=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=wc(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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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.reload()]:[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}();Oc.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 ion-footer ion-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}}"]}]}],Oc.ctorParameters=function(){return[{type:$l},{type:yl},{type:W.ActivatedRoute},{type:Pl}]};var _c=function(t){function e(e,n){var o=t.call(this)||this;return o.formBuilder=e,o.translate=n,o}return ne(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=ar.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_"+ke(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"),ke(t))},e}(Nt.ValidatorService);_c.decorators=[{type:e.Directive}],_c.ctorParameters=function(){return[{type:P.FormBuilder},{type:F.TranslateService}]};var kc=function(t){function e(e){return t.call(this,e)||this}return ne(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}(_c);kc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new kc(e.ɵɵinject(P.FormBuilder))},token:kc,providedIn:"root"}),kc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],kc.ctorParameters=function(){return[{type:P.FormBuilder}]};var Sc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.formBuilder=e,o.accountService=n,o}return ne(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||Ts.getMainProfile(t.profiles))||"GUEST",P.Validators.required],statusId:[t&&t.statusId||ps.TEMPORARY,P.Validators.required],pubkey:[t&&t.pubkey||null,P.Validators.compose([P.Validators.required,Mo.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(Mo.entity),e.length?P.Validators.compose(e):1===e.length?e[0]:void 0},e}(_c);Sc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Sc(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(yl))},token:Sc,providedIn:"root"}),Sc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sc.ctorParameters=function(){return[{type:P.FormBuilder},{type:yl}]};var Tc=function(e){function n(t,n,o,r,i,a,s,l,c,u,d){var p=e.call(this,t,a.getFormGroup(o.account))||this;return p.formBuilder=n,p.accountService=o,p.network=r,p.router=i,p.validatorService=a,p.settingsValidatorService=s,p.translate=l,p.settings=c,p.cd=u,p.email={confirmed:!1,notConfirmed:!1,sending:!1,error:void 0},p.latLongFormats=Vn,p.saving=!1,p.submitted=!1,p.locales=d,p.settingsForm=s.getFormGroup(o.account&&o.account.settings),p.settingsContentForm=p.settingsForm.controls.content,p.form.addControl("settings",p.settingsForm),p.disable(),p.registerSubscription(p.accountService.onLogin.subscribe((function(t){return p.onLogin(t)}))),p.registerSubscription(p.accountService.onLogout.subscribe((function(){return p.onLogout()}))),p.registerSubscription(p.onCancel.subscribe((function(){p.setValue(p.accountService.account),p.markAsPristine()}))),p.registerSubscription(p.accountService.$additionalFields.subscribe((function(t){p.additionalFields=t.slice(),o.isLogin()?p.onLogin(p.accountService.account):p.markAsLoaded()}))),p}return ne(n,e),n.prototype.ngOnDestroy=function(){var t;e.prototype.ngOnDestroy.call(this),this.stopListenChanges(),null===(t=this.networkSubscription)||void 0===t||t.unsubscribe()},n.prototype.onLogin=function(t){var e,n=this;console.debug("[account] Logged account: ",t),this.isLogin=!0,this.setValue(t),this.email.confirmed=t&&t.email&&t.statusId!==ps.TEMPORARY,this.email.notConfirmed=t&&t.email&&(!t.statusId||t.statusId===ps.TEMPORARY),null===(e=this.networkSubscription)||void 0===e||e.unsubscribe(),this.networkSubscription=this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"!==t}))).subscribe((function(t){t?(n.enable(),n.markAsPristine(),n.startListenChanges()):(n.disable(),n.markAsPristine(),n.stopListenChanges()),n.markAsLoaded()}))},n.prototype.onLogout=function(){var t;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(),null===(t=this.networkSubscription)||void 0===t||t.unsubscribe(),this.stopListenChanges(),this.router.navigateByUrl("/")},n.prototype.refresh=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.disable(),this.markAsLoading(),[2,this.accountService.reload()]}))}))},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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return this.saving?[2,!1]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return ar.logFormErrors(this.form),this.form.markAllAsTouched(),[2,!1];o.label=2;case 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=3;case 3:return o.trys.push([3,5,6,7]),this.disable(),[4,this.accountService.save(e)];case 4:return o.sent(),this.markAsPristine(),[2,!0];case 5:return n=o.sent(),console.error(n),this.error=n&&n.message||n,[2,!1];case 6:return this.saving=!1,this.enable(),[7];case 7: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.forEach((function(e){var n,o,r=t.form.controls[e.key];if(r){((null===(n=e.extra)||void 0===n?void 0:n.account)&&e.extra.account.disabled||!1)&&r.enabled&&r.disable();var i=(null===(o=e.extra)||void 0===o?void 0:o.account)&&e.extra.account.required||!1;!e.required&&i&&r.setValidators(r.validator?P.Validators.compose([r.validator,P.Validators.required]):P.Validators.required)}})),this.markForCheck()},n.prototype.cancel=function(){var t=Object.create(null,{cancel:{get:function(){return e.prototype.cancel}}});return re(this,void 0,void 0,(function(){return ie(this,(function(e){return t.cancel.call(this),[2]}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);Tc.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 (if online) --\x3e\n <ion-button [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n *ngIf="network.online"\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%}"]}]}],Tc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:yl},{type:_a},{type:W.Router},{type:Sc},{type:kc},{type:F.TranslateService},{type:wa},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[us]}]}]};var Ac=function(){this.showRecorder=!0};Ac.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:[bn],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)}"]}]}],Ac.propDecorators={value:[{type:e.Input}],showRecorder:[{type:e.Input}]};var Rc=function(){},Pc=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}();Pc.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:Rc,useExisting:Pc}],styles:[":host{width:100%}:host ion-toolbar{height:var(--app-form-buttons-bar-height);padding:0 6px}:host ion-col{padding:0}"]}]}],Pc.ctorParameters=function(){return[{type:Bi}]},Pc.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 Dc=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=Ee(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}();Dc.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'}]}],Dc.ctorParameters=function(){return[{type:L.NavParams},{type:L.ModalController}]},Dc.propDecorators={columns:[{type:e.Input}],canHideColumns:[{type:e.Input}]};var Nc=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=hs,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}();Nc.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}"]}]}],Nc.ctorParameters=function(){return[{type:yl},{type:Sc},{type:P.FormBuilder},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:wa}]},Nc.propDecorators={stepper:[{type:e.ViewChild,args:["stepper",{static:!0}]}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var Mc=function(){};Mc.decorators=[{type:e.NgModule,args:[{imports:[Q.HttpClientModule],exports:[Q.HttpClientModule]}]}],Mc.ctorParameters=function(){return[]};var Fc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.networkService=n,o}return ne(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=ia.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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return this.networkService.offline?(Mo.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}];Mo.clearError(t,"peerAlive"),n.label=3;case 3:return[2]}}))}))},e}(_c);Fc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Fc(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(_a))},token:Fc,providedIn:"root"}),Fc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Fc.ctorParameters=function(){return[{type:P.FormBuilder},{type:_a}]};var Lc=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 ir(h.form.get("properties"),(function(t){return h.validatorService.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return ue(t)||ue(t.key)&&ue(t.value)}),{allowEmptyArray:!0}),h.mobile=h.platform.mobile,h._enable=!1,h}return ne(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return this.markAsLoading(),console.debug("[settings] Loading settings..."),(t=this.settings.settings).accountInheritance=Ee(t.accountInheritance,!0),t.locale=t.locale||this.translate.currentLang||this.translate.defaultLang,t.latLongFormat=t.latLongFormat||"DDMMSS",t.usageMode=t.usageMode||"DESK",de(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=ia.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 re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return this.saving?[2]:(e&&e.preventDefault(),this.propertiesFormHelper.removeAllEmpty(),this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)]);case 1:if(a.sent(),this.form.invalid)return ar.logFormErrors(this.form),this.form.markAllAsTouched(),[2];a.label=2;case 2:return console.debug("[settings] Saving local settings..."),this.saving=!0,this.error=void 0,this.markForCheck(),[4,this.getValue()];case 3:n=a.sent(),(o=this.form.get("peerUrl").dirty)&&(n.pageHistory=[]),a.label=4;case 4:return a.trys.push([4,6,7,8]),this.disable(),[4,this.settings.apply(n)];case 5:return a.sent(),this.data=n,this.markAsPristine(),o&&(this.network.peer=t.Peer.parseUrl(n.peerUrl)),[2,!0];case 6:return r=a.sent(),console.error(r),this.error=r&&r.message||r,[2,!1];case 7:return this.enable({emitEvent:!1}),this.setAccountInheritance(n.accountInheritance,{emitEvent:!1}),setTimeout((function(){i.saving=!1,i.markForCheck()}),400),[7];case 8: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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.load()];case 1:return t.sent(),[2]}}))}))},n.prototype.close=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.saving?[2]:[2,this.router.navigateByUrl("/",{replaceUrl:!0})]}))}))},n.prototype.clearCache=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Xl.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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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=ia.getPropertyArrayAsObject(t.properties),Promise.resolve(t)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);Lc.decorators=[{type:e.Component,args:[{selector:"page-settings",template:'<app-toolbar [title]="\'SETTINGS.TITLE\'|translate" color="primary"\n [hasValidate]="dirty && !saving"\n [hasClose]="!dirty && !saving"\n (onValidate)="save($event)"\n (onClose)="close($event)">\n\n <ion-buttons slot="end">\n \x3c!-- options menu --\x3e\n <ion-button [matMenuTriggerFor]="optionsMenu"\n *ngIf="!saving"\n [disabled]="saving">\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:Nt.ValidatorService,useExisting:Fc}],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Lc.ctorParameters=function(){return[{type:e.Injector},{type:$l},{type:W.Router},{type:Fc},{type:L.AlertController},{type:F.TranslateService},{type:P.FormBuilder},{type:yl},{type:wa},{type:e.ChangeDetectorRef},{type:_a},{type:Array,decorators:[{type:e.Inject,args:[us]}]}]};var jc=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 ne(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(ge(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 ir(this.formArray,(function(t){return e.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return ue(t)||ue(t.key)&&ue(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&&ue(this.definitionsMapByKey[n])},e.prototype.setValue=function(t){if(t){var e=ia.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}(nc);jc.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}]}],jc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:wa},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},jc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],definitions:[{type:e.Input}]};var Bc=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 Mt.SelectionModel(!0,[]),l.displayWithFn=hs,l.onNewItem=new e.EventEmitter,l.selectionChanges=new e.EventEmitter(!0),l}return ne(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){ar.markAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.markAllAsTouched=function(t){ar.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 ue(t)&&ue(e)||t===e},this.helper=new ir(this.formArray,(function(t){return e.createControl(t)}),this.equalsFn,(function(t){return ue(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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}(nc);Bc.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-color-selected:var(--ion-color-secondary100-contrast)}ion-item.disabled ion-label{color:var(--ion-color-medium-shade,grey)}ion-item{--min-height:48px;background-color:var(--ion-item-background)}ion-item ion-label,ion-item ion-text{color:var(--ion-item-color)}ion-item .action-buttons{visibility:hidden;display:none}ion-item:hover{height:var(--min-height);--ion-item-background-color:var(--ion-color-light);--ion-item-color:var(--ion-color-light-contrast)}ion-item:hover .action-buttons{margin-top:-1px;visibility:visible;display:block}ion-item.selected{--ion-item-background-color-hover:var(--ion-item-background-selected)!important;--ion-item-color-hover:var(--ion-item-color-selected)!important}"]}]}],Bc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:wa},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Bc.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 Vc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"===t},t}();Vc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Vc},token:Vc,providedIn:"root"}),Vc.decorators=[{type:e.Pipe,args:[{name:"isOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var qc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"!==t},t}();qc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new qc},token:qc,providedIn:"root"}),qc.decorators=[{type:e.Pipe,args:[{name:"isNotOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Uc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Ts.personsToString(t,e):Ts.personToString(t)},t}();Uc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Uc},token:Uc,providedIn:"root"}),Uc.decorators=[{type:e.Pipe,args:[{name:"personToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var $c=function(){function e(t,e,n,o,r,i,a,s,l){this.modalCtrl=t,this.configService=e,this.toastController=n,this.alertController=o,this.translate=r,this.cd=i,this.platform=a,this.network=s,this.environment=l,this._subscription=new D.Subscription,this.loading=!0,this.hasDownloader=!1,this.downloading=!1,this.waitingNetwork=!1,this.showUpgradeWarning=!0,this.showOfflineWarning=!0,this.showInstallButton=!1}return e.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(pe)).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())})))},e.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._subscription=null,this.installLinks=null,this.upgradeLinks=null},e.prototype.download=function(t,e){return re(this,void 0,void 0,(function(){var t=this;return ie(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(n){t.platform.canOpenFile&&(e.location=n),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])}))}))},e.prototype.openFile=function(t,e){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(n){switch(n.label){case 0:if(!e||!e.location||!e.mimeType)return console.error("[install-upgrade-card] Missing required argument 'link.location' or 'link.mimeType'"),[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.platform.openFile(e.location,e.mimeType)];case 2:return n.sent(),[3,4];case 3:return t=n.sent(),console.error("[install-upgrade-card] Cannot open file: "+(t&&t.message||t),t),[3,4];case 4:return[2]}}))}))},e.prototype.tryOnline=function(){return re(this,void 0,void 0,(function(){return ie(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]}}))}))},e.prototype.getPlatformName=function(t){switch(t){case"android":return"Android";case"ios":return"iOS";default:return""}},e.prototype.asLink=function(t){return t},e.prototype.checkNeedInstallOrUpdate=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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.hasDownloader=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),fe(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),fe(this.installLinks)?(console.info("[install-upgrade-card] Find install links "+this.installLinks.map((function(t){return t.url})).join(",")),[4,Be(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]}}))}))},e.prototype.getCompatibleInstallLinks=function(t){if(!this.platform.isCordova())return this.platform.isMobileWeb()?t:void 0},e.prototype.getCompatibleUpgradeLinks=function(t,e){var n=this,o=this.environment.version,r=e.getProperty(xl.APP_MIN_VERSION);if(o){if(r&&!pa.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})),fe(i)?i:void 0}}else console.error("Missing value for 'environment.version': cannot check app compatibility!")},e.prototype.getLinks=function(e){var n=[],o=e.getProperty(xl.ANDROID_INSTALL_URL);de(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(xl.APP_MIN_VERSION),a=he(o)&&e.label||this.environment.defaultAppName||"SUMARiS";if(o){var s=void 0,l=void 0,c=Vl.getFilename(o),u=i||"latest";if(null==c?void 0:c.toLowerCase().endsWith(".apk")){l=jl.ANDROID_APK;var d=/-v([1-9][0-9]*\.[0-9]+\.(:?(:?alpha|beta|rc)?[0-9]*))/i.exec(c);u=d&&d[1]||u,he(a)&&"latest"!==u?(c=(a+"-v"+u+".apk").toLowerCase(),s=a+" v"+u):c.indexOf("latest")&&"latest"!==u&&(c=c.replace("latest",u))}n.push({name:a,url:o,platform:"android",version:u,filename:c,title:s,mimeType:l})}return n},e.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(t){e.location=t,e.downloading=!1})).catch((function(){return e.downloading=!1})).then((function(){return t.markForCheck()})))}))},e.prototype.listenDownloadJob=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(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),this.showDownloadCompleteDialog()),[2,n];case 3:throw o=r.sent(),console.error("[install-upgrade-card] Download failed: "+(o&&o.message||o)),this.showDownloadFailedToast(o),o;case 4:return this.downloading=!1,this.markForCheck(),[7];case 5:return[2]}}))}))},e.prototype.showDownloadFailedToast=function(t){return this.showToast({message:"ERROR.DOWNLOAD_FAILED",messageParams:{error:t},type:"error",showCloseButton:!0})},e.prototype.showDownloadCompleteDialog=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(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]}}))}))},e.prototype.markForCheck=function(){this._subscription&&this.cd.markForCheck()},e.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return this._subscription?[4,Ia.show(this.toastController,this.translate,t)]:[2];case 1:return e.sent(),[2]}}))}))},e}();$c.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!-- 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="hasDownloader; else webDownloadButton">\n \x3c!-- Download using platform --\x3e\n <ion-button (click)="download($event, asLink(link))"\n *ngIf="!link.location; else openButton"\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\n \x3c!-- Open APK button --\x3e\n <ng-template #openButton>\n <ion-button *ngIf="link.location"\n (click)="openFile($event, link)"\n color="tertiary" class="ion-float-end" >\n <ion-label translate>COMMON.BTN_INSTALL</ion-label>\n </ion-button>\n </ng-template>\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:[Cn],styles:["ion-text small{font-size:85%}"]}]}],$c.ctorParameters=function(){return[{type:L.ModalController},{type:Pl},{type:L.ToastController},{type:L.AlertController},{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:$l},{type:_a},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},$c.propDecorators={isLogin:[{type:e.Input}],showUpgradeWarning:[{type:e.Input}],showOfflineWarning:[{type:e.Input}],showInstallButton:[{type:e.Input}]};var Gc=function(){function t(){}return t.prototype.transform=function(t){return t&&t.pubkey&&!0},t}();Gc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Gc},token:Gc,providedIn:"root"}),Gc.decorators=[{type:e.Pipe,args:[{name:"isLogin"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Hc=function(){function t(){}return t.prototype.transform=function(t){return As(t)},t}();Hc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Hc},token:Hc,providedIn:"root"}),Hc.decorators=[{type:e.Pipe,args:[{name:"accountToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var zc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?_s(t,e):Os(t)},t}();zc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new zc},token:zc,providedIn:"root"}),zc.decorators=[{type:e.Pipe,args:[{name:"departmentToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Wc=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=Ee(this.canCancel,this.cancelOrDeleteClick.observers.length>0),this.canDelete=Ee(this.canDelete,this.cancelOrDeleteClick.observers.length>0),this.canConfirmAndAdd=Ee(this.canConfirmAndAdd,this.confirmAndAddClick.observers.length>0),this.canBackward=Ee(this.canBackward,this.backward.observers.length>0),this.canForward=Ee(this.canForward,this.forward.observers.length>0),ue(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}();Wc.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'}]}],Wc.ctorParameters=function(){return[{type:l.MatTable},{type:e.ChangeDetectorRef}]},Wc.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 Kc=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}();Kc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Kc},token:Kc,providedIn:"root"}),Kc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Qc=new e.InjectionToken("menuItems"),Yc=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}return t.prototype.ngOnInit=function(){return re(this,void 0,void 0,(function(){var t=this;return ie(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2,this.menu.close("left")]}))}))},t.prototype.openAboutModal=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:Cc})];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 re(this,void 0,void 0,(function(){return ie(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(xl.MENU_ITEMS);if(he(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 '"+xl.MENU_ITEMS.key+"'. Expected an array of menu item",t)}var o={isLogin:this.isLogin,debug:this._debug},r=e.filter((function(e){return Ec.checkIfVisible(e,t.accountService,t._config,o)})).map((function(e){if(he(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}();Yc.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:[bn],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)}}"]}]}],Yc.ctorParameters=function(){return[{type:$l},{type:yl},{type:W.Router},{type:L.MenuController},{type:L.ModalController},{type:L.AlertController},{type:F.TranslateService},{type:Pl},{type:e.ChangeDetectorRef},{type:Kc},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Qc]}]}]},Yc.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}]}]};var Xc=function(){};Xc.decorators=[{type:e.NgModule,args:[{imports:[Yl,W.RouterModule,F.TranslateModule],declarations:[Yc],exports:[F.TranslateModule,Yc]}]}];var Jc=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}();Jc.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'}]}],Jc.propDecorators={icon:[{type:e.Input}],matIcon:[{type:e.Input}],matSvgIcon:[{type:e.Input}],color:[{type:e.Input}],ref:[{type:e.Input}]};var Zc=function(){function t(){this.onUpdateClick=new e.EventEmitter}return t.prototype.ngOnDestroy=function(){this.onUpdateClick.complete()},t}();Zc.decorators=[{type:e.Component,args:[{selector:"app-update-offline-mode-card",template:'\n\x3c!-- Update offline feature card--\x3e\n<ion-card color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngIf="!progressionValue; else progression">\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\n \x3c!-- Update button --\x3e\n <ion-col size="auto">\n <ion-button color="tertiary" class="ion-float-end"\n (click)="onUpdateClick.emit($event)">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-template #progression>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap" [innerHTML]="progressionMessage"></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <ion-progress-bar [value]="progressionValue / 100"></ion-progress-bar>\n </ion-col>\n </ion-row>\n </ng-template>\n </ion-grid>\n\n\n </ion-card-content>\n</ion-card>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Cn],styles:["ion-text small{font-size:85%}"]}]}],Zc.ctorParameters=function(){return[]},Zc.propDecorators={progressionMessage:[{type:e.Input}],progressionValue:[{type:e.Input}],onUpdateClick:[{type:e.Output}]};var tu=function(){function t(){}return t.forRoot=function(){return console.info("[core] Creating module (root)"),{ngModule:t,providers:[$l]}},t}();tu.decorators=[{type:e.NgModule,args:[{imports:[Yl,W.RouterModule,Q.HttpClientModule,dt.CacheModule,st.IonicStorageModule,Ft.NgxJdenticonModule,Mc,Xc],declarations:[Vc,qc,Uc,Gc,Hc,zc,xc,Cc,gc,bc,Nc,fc,Oc,Tc,Lc,fa,$c,Zc,Dc,Wc,Ac,Pc,jc,Bc,Jc,rc,oc],exports:[Yl,W.RouterModule,Mc,Xc,Vc,qc,Uc,Gc,Hc,xc,gc,bc,Dc,Wc,Ac,Pc,Cc,jc,Bc,$c,Zc,zc,Jc,rc,oc]}]}];var eu=$t,nu=Kt,ou=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 re(e,void 0,void 0,(function(){var e,o=this;return ie(this,(function(r){switch(r.label){case 0:return[4,this.modalCtrl.create({component:bc,componentProps:{next:t}})];case 1:return(e=r.sent()).onDidDismiss().then((function(){o.accountService.isLogin()?n(!0):n(!1)})),[2,e.present()]}}))}))}))},t}();ou.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ou(e.ɵɵinject(yl),e.ɵɵinject(L.ModalController),e.ɵɵinject(W.Router),e.ɵɵinject(Qt))},token:ou,providedIn:"root"}),ou.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ou.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:W.Router},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]};var ru=function(t){function e(e,n,o,r,i){var a=t.call(this,e,aa)||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 ia.equals(t,e,"id")},a.isNewFn=i.isNewFn||function(t){return ia.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=!aa.production,a}return ne(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:Va,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 re(this,void 0,void 0,(function(){var n,o;return ie(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:Va,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:Va,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 re(this,void 0,void 0,(function(){var a,s,l,c,u,d,p,h,m,f,g,b=this;return ie(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:Va,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||m.length},c&&(g=(t||0)+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 re(this,void 0,void 0,(function(){return ie(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:Va,message:"ERROR.COUNT_DATA_ERROR"},fetchPolicy:e&&e.fetchPolicy||"network-only"})];case 3:return[2,o.sent().total]}}))}))},e.prototype.canUserWrite=function(t,e){return!!t},e.prototype.saveAll=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:if(ge(t))return[2,t];if(!this.mutations.saveAll){if(!this.mutations.save)throw new Error("Not implemented");return[2,cn((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:qa,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 re(this,void 0,void 0,(function(){var n,o,r,i,a=this;return ie(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:qa,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 re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:if(!this.mutations.deleteAll){if(!this.mutations.delete)throw new Error("Not implemented");return[2,cn((t||[]).map((function(t){return function(){return r.delete(t,e)}})))]}return ge(t=t&&t.filter((function(t){return pe(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:Ua,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 re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(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||ue(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:Ua,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(ue(t))throw Error("Missing argument 'id' ");if(!this.subscriptions.listenChanges)return console.warn(this.constructor.name+".listenChanges() not implemented yet. Will empty observable"),D.of();var o=e&&e.variables||{id:t,interval:we(e&&e.interval,0)};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,fetchPolicy:e&&e.fetchPolicy||"no-cache",variables:o,error:{code:$a,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&&ia.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 sc.fromObject(t,this.filterType)},e.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){return ie(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(pe)},e}($s);ru.decorators=[{type:e.Directive}],ru.ctorParameters=function(){return[{type:Vs},{type:$l},{type:Function},{type:Function},{type:void 0}]};var iu=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){ar.logFormErrors(t.validator,e)},t}(),au=function(){},su=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._fetchMoreFn=null,i.loadingSubject=new D.BehaviorSubject(void 0),i._options=Object.assign({dataServiceOptions:{},debug:r&&!1===r.suppressErrors,keepOriginalDataAfterConfirm:!1},r),i._useValidator=pe(o),i._logTypeName=_e((new e).__typename||"UnknownVO","VO"),i._debug=!0===i._options.debug,i}return ne(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._fetchMoreFn=null,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||[]),i._fetchMoreFn=t.fetchMore),t})))},e.prototype.save=function(){return re(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:if(Ee(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=Ee(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 iu.logRowErrors(t,"[table-datasource] "+a._logTypeName+" row #"+t.id)})),{code:Ha,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 sn(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}));fe(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 ln(this.connect(null))},e.prototype.asyncCreateNew=function(e){var n=Object.create(null,{createNew:{get:function(){return t.prototype.createNew}}});return re(this,void 0,void 0,(function(){var t,o,r;return ie(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.getData=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return[4,this.getRows()];case 1:return t=e.sent(),[2,this.getDataFromRows(t)]}}))}))},e.prototype.fetchMore=function(e){var n=Object.create(null,{updateDatasource:{get:function(){return t.prototype.updateDatasource}}});return re(this,void 0,void 0,(function(){var t,o,r;return ie(this,(function(i){switch(i.label){case 0:return this._fetchMoreFn?this._editingRowCount>0?(console.warn("Cannot fetch more because still editing row"),[2]):(t=this._fetchMoreFn,this._fetchMoreFn=null,[4,t()]):[2,!1];case 1:return fe(null==(o=i.sent())?void 0:o.data)?[2,!1]:[4,this.getData()];case 2:return r=i.sent(),n.updateDatasource.call(this,r.concat.apply(r,le(o.data)),e),this._fetchMoreFn=o.fetchMore,[2,!0]}}))}))},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}(Nt.TableDataSource);su.decorators=[{type:e.Directive}],su.ctorParameters=function(){return[{type:Function},{type:void 0},{type:Nt.ValidatorService},{type:au}]};var lu="displayColumns",cu="sortedColumn",uu="filter",du="pageSize",pu=[20,50,100,200,500],hu=["select","id"],mu=["actions"],fu=["id"],gu=function(){},bu=function(){function t(t,o,r,i){var a=this;this.columns=o,this._dataSource=r,this._filter=i,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 Mt.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=pu,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=hn(),this.onBeforeCancelRows=hn(),this.onBeforeSave=hn(),this.onAfterDeletedRows=new e.EventEmitter,this.onSort=new e.EventEmitter,this.onDirty=new e.EventEmitter,this.onError=new e.EventEmitter,this._paginator=null,this.route=t.get(W.ActivatedRoute),this.router=t.get(W.Router),this.location=t.get(n.Location),this.settings=t.get(wa),this.translate=t.get(F.TranslateService),this.modalCtrl=t.get(L.ModalController),this.alertCtrl=t.get(L.AlertController),this.toastController=t.get(L.ToastController),this.formErrorAdapter=t.get(dr),this.mobile=this.settings.mobile,this._autocompleteConfigHolder=new Pn({getUserAttributes:function(t,e){return a.settings.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[hu.length]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastUserColumn",{get:function(){return this.displayedColumns[this.displayedColumns.length-mu.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.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=Ee(this.readOnly,!1),this.inlineEdition=!this.readOnly&&Ee(this.inlineEdition,!1),this.saveBeforeDelete=Ee(this.saveBeforeDelete,!this.readOnly),this.saveBeforeSort=Ee(this.saveBeforeSort,!this.readOnly),this.saveBeforeFilter=Ee(this.saveBeforeFilter,!this.readOnly),this.keepEditedRowOnSave=Ee(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(null==t?void 0: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.filter((function(){return!t.sort.disabled})),N.mergeMap((function(){return re(t,void 0,void 0,(function(){return ie(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,cu)})))||D.EMPTY,this.paginator&&this.paginator.page.pipe(N.mergeMap((function(){return re(t,void 0,void 0,(function(){return ie(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,du)})))||D.EMPTY).subscribe((function(e){t.onSort.emit(),t.onRefresh.emit(e)})),this.sort&&this.paginator&&this.registerSubscription(this.sort.sortChange.pipe(N.filter((function(){return!t.sort.disabled}))).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.readySubject.unsubscribe(),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 re(this,void 0,void 0,(function(){return ie(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=pe(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){var n,o=this;return e=e||this.editedRow,this.confirmEditCreate(t,e)?(this.editRowById(t,e.id+1,{focusColumn:this.firstUserColumn}),!0):!!(null===(n=e.validator)||void 0===n?void 0:n.pending)&&ar.waitWhilePending(e.validator).then((function(){return o.confirmAndForward(t,e)}))},t.prototype.editRowById=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(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 ar.waitWhilePending(e.validator).then((function(){return o.confirmEditCreate(t,e)})),!1;if(this.debug&&(console.warn("[table] Cannot confirm row, because invalid"),ar.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):e.editing?this.cancelExistingRow(t,e,n):this.deleteExistingRow(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,o,r;return re(this,void 0,void 0,(function(){var i,a,s;return ie(this,(function(l){switch(l.label){case 0:if(t=Object.assign({keepEditing:this.keepEditedRowOnSave},t),this.readOnly)throw{code:za,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)||(null===(n=this.singleSelectedRow)||void 0===n?void 0:n.id):void 0,i=t.keepEditing?pe(this.previouslyEditedRowId)&&(null===(o=this.editedRow)||void 0===o?void 0:o.currentData)||(null===(r=this.singleSelectedRow)||void 0===r?void 0:r.currentData):void 0,!this.confirmEditCreate())throw{code:Ha,message:"ERROR.TABLE_INVALID_ROW_ERROR"};this.markAsSaving(),l.label=1;case 1:return l.trys.push([1,3,4,7]),this.debug&&console.debug("[table] Calling dataSource.save()..."),[4,this._dataSource.save()];case 2:return(a=l.sent())&&this.markAsPristine(),[2,a];case 3:throw s=l.sent(),this.setError(s&&s.message||s),s;case 4:return this.markAsSaved(),pe(this.previouslyEditedRowId)?[4,this.selectRowByIdOrData(this.previouslyEditedRowId,i)]:[3,6];case 5:l.sent(),l.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 re(this,void 0,void 0,(function(){var r,i,a;return ie(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 re(this,void 0,void 0,(function(){var t=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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){var o;return re(this,void 0,void 0,(function(){var r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:if(this.readOnly)throw{code:za,message:"ERROR.TABLE_READ_ONLY"};return(null==t?void 0:t.defaultPrevented)?[2,0]:(null==t||t.preventDefault(),!this._enabled||ge(e)?[2,0]:!this.loading||n&&!1===n.skipIfLoading?-1!==(null===(o=this.editedRow)||void 0===o?void 0:o.id)||!this.editedRow.editing||e.includes(this.editedRow)||this.confirmEditCreate()?[4,this.canDeleteRows(e,n)]:[2,0]:(console.warn("[app-table] Skip deleteRows() because table is busy (loading). Use opts.skipLoading = false to force deletion"),[2,0]));case 1:return s.sent()?(e=e.slice().sort((function(t,e){return t.id>e.id?-1:1})),this.saveBeforeDelete&&fe(e=e.filter((function(t){if(t.validator&&!t.validator.valid){if(-1===t.id||!t.editing)return t.delete(),a.visibleRowCount--,a.totalRowCount--,!1;t.cancelOrDelete(),a.checkIfRowPristine(t,{emitEvent:!1,onlySelf:!0})}return!0})))?[4,this.saveBeforeAction("delete")]:[3,3]):[2,0];case 2:if(!s.sent())return[2];s.label=3;case 3:return s.trys.push([3,6,,7]),(r=e.length)?(this.debug&&console.debug("[table] Delete selected rows..."),[4,this._dataSource.deleteAll(e)]):[3,5];case 4:s.sent(),s.label=5;case 5:return this.selection.clear(),this.editedRow=void 0,this.markAsDirty({emitEvent:!1}),this.markForCheck(),r&&this.onAfterDeletedRows.next(e),[2,r];case 6:throw i=s.sent(),this.setError(i&&i.message||i),i;case 7:return[2]}}))}))},t.prototype.selectRowById=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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)]:[2,!1]}}))}))},t.prototype.selectRowByData=function(t){return re(this,void 0,void 0,(function(){var e,n=this;return ie(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(e=(o.sent()||[]).find((function(e){return n.equals(e.currentData,t)})))?[2,this.clickRow(null,e)]:[2,!1]}}))}))},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()})).catch((function(){return n.markAsLoaded()})),!0))},t.prototype.moveRow=function(t,e){this.dataSource.move(t,e)},t.prototype.ready=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,an(this.readySubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,sn(this.loadingSubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.openSelectColumnsModal=function(t){return re(this,void 0,void 0,(function(){var t,e,n,o,r;return ie(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:Dc,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=hu.concat(r).concat(mu),this.markForCheck(),[4,this.settings.savePageSetting(this.settingsId,r,lu)]):[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 re(e,void 0,void 0,(function(){return ie(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(hu.length).filter((function(e){return-1===t.displayedColumns.indexOf(e)}));return this.displayedColumns.concat(e).filter((function(e){return!hu.includes(e)&&!mu.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){var n=this;if((e=e||this.editedRow)&&e.editing){if(t&&(t.preventDefault(),t.stopPropagation()),-1===e.id){if(e.validator){if(e.validator.pending)return void ar.waitWhilePending(e.validator).then((function(){return n.escapeEditingRow(t,e)}));if(e.validator.invalid)return void this.deleteNewRow(t,e)}}else if(this.confirmBeforeCancel)return void 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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,6,,7]),pe(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 re(this,void 0,void 0,(function(){var n;return ie(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,fn(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 re(this,void 0,void 0,(function(){var n,o;return ie(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(ge(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,fn(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 re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(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,fn(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 re(this,void 0,void 0,(function(){return ie(this,(function(n){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]):ue(t)?(console.warn("[table] Opening row details, but data has no id!"),[2,!1]):[2,this.router.navigate([".",t.toString()],{relativeTo:this.route,queryParams:{}})]):[2,!1]}))}))},t.prototype.openNewRowDetail=function(t){return re(this,void 0,void 0,(function(){return ie(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 fu},t.prototype.getUserColumns=function(){return this.settings.getPageSettings(this.settingsId,lu)},t.prototype.getSortedColumn=function(){var t=this.settings.getPageSettings(this.settingsId,cu),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,du)||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 hu.includes(t)})),o=this.columns.filter((function(t){return mu.includes(t)}));return(e=e.filter((function(e){return!n.includes(e)&&!o.includes(e)&&t.columns.includes(e)}))).push.apply(e,le(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||"")+ke(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(n){return this.undoableDeletion?[2,Xl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.DELETE_ROW":"CONFIRM.DELETE_ROWS",this.alertCtrl,this.translate,t)]:[2,Xl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)]}))}))},t.prototype.askCancelConfirmation=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(n){return[2,Xl.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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,Xl.askActionConfirmation(this.alertCtrl,this.translate,!1,t)]}))}))},t.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[2,Ia.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.translateFormErrors(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 ia.equals(t,e,"id")},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.setLoading=function(t,e){this.loadingSubject.value!==t&&(this.loadingSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.deleteNewRow=function(t,e){if(-1!==e.id)throw new Error("Row must have id = -1");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.deleteExistingRow=function(t,e,n){if(-1===e.id)throw new Error("Row must have an id");if(null==t?void 0:t.defaultPrevented)return 0;null==t||t.preventDefault(),this.deleteRow(null,e,n)},t.prototype.cancelExistingRow=function(t,e,n){var o,r=this;if(-1===e.id||!e.editing)throw new Error("Row cannot be canceling, but only deleting");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&&r.cancelExistingRow(t,e,{interactive:!1})}));var i=e.editing&&(!n||!1!==n.keepEditing);this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),this.checkIfRowPristine(e),i&&this.editRow(void 0,e)},t.prototype.checkIfRowPristine=function(t,e){var n,o;return re(this,void 0,void 0,(function(){return ie(this,(function(r){switch(r.label){case 0:return!0===(null===(n=this.dataSource)||void 0===n?void 0:n.options.keepOriginalDataAfterConfirm)?(null===(o=t.validator)||void 0===o||o.markAsPristine(),e&&!0===e.onlySelf?[3,2]:[4,this.checkIfPristine(e)]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.checkIfPristine=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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 !");pe(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&&ar.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}();bu.decorators=[{type:e.Directive}],bu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:su},{type:void 0}]},bu.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 yu=function(){},vu=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._$ready=new D.BehaviorSubject(!1),this._$loading=new D.BehaviorSubject(!0),this.debug=!1,this.submitted=!1,this.toolbar=null,this.formButtonsBar=null}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,"tables",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof bu}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forms",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof nc}))},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.value||-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(),this._$ready.complete(),this._$ready.unsubscribe(),this._$loading.complete(),this._$loading.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 rr(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,pn(this._$ready,t)]}))}))},t.prototype.waitIdle=function(t){return ar.waitIdle(this,t)},t.prototype.cancel=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return console.debug("[tab-page] Unloading data..."),this.markAsLoading(),this._children.forEach((function(e){e instanceof nc?e.reset(null,t):e instanceof bu&&e.dataSource.disconnect()})),[2]}))}))},t.prototype.reloadWithConfirmation=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){return t=we(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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,Ia.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)ar.logFormErrors(e,n,o);else if(e instanceof rr)e.empty||e.valid||e.waitDelegate({timeout:1e3}).then((function(t){return r.logChildrenFormErrors(t,n,"provider")}));else if(e instanceof bu){if(e.invalid&&e.editedRow&&e.editedRow.validator){var i=e.constructor.name.toLowerCase();ar.logFormErrors(e.editedRow.validator,n,i)}}else if(e instanceof nc){if(!e.empty&&!e.valid)if(e.pending){var a=e.constructor.name.toLowerCase();console.warn(n+" -> "+a+": waiting while pending..."),ar.waitWhilePending(e,{timeout:1e3}).then((function(){return r.logChildrenFormErrors(e.form,n,a)}))}else ar.logFormErrors(e.form,n)}else console.warn(n+" Unknown children sub-form: ",e)},t.prototype.markForCheck=function(){},t}();vu.decorators=[{type:e.Directive}],vu.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.AlertController},{type:F.TranslateService}]},vu.propDecorators={toolbar:[{type:e.ViewChild,args:[xi]}],formButtonsBar:[{type:e.ViewChild,args:[Rc,{static:!0}]}],content:[{type:e.ViewChild,args:[L.IonContent,{static:!0}]}]};var Cu=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 ne(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,pe(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&&pe(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 re(this,void 0,void 0,(function(){return ie(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}(vu);Cu.decorators=[{type:e.Directive}],Cu.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.AlertController},{type:F.TranslateService},{type:yu,decorators:[{type:e.Optional}]}]},Cu.propDecorators={queryTabIndexParamName:[{type:e.Input}],selectedTabIndex:[{type:e.Input}],selectedTabIndexChange:[{type:e.Output}],tabGroup:[{type:e.ViewChild,args:["tabGroup",{static:!0}]}]};var Eu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(yu),wu=function(t){function n(n,o,r,i){var a,s,l=this;return(l=t.call(this,n.get(W.ActivatedRoute),n.get(W.Router),n.get(L.AlertController),n.get(F.TranslateService),i)||this).dataType=o,l.dataService=r,l.saving=!1,l.$title=new D.Subject,l.onUpdateView=new e.EventEmitter,l.environement=n.get(Qt),i=Object.assign({enableListenChanges:(null===(a=l.environement.entityEditor)||void 0===a?void 0:a.enableListenChanges)||!1,listenIntervalInSeconds:we(null===(s=l.environement.entityEditor)||void 0===s?void 0:s.listenIntervalInSeconds,0),pathIdAttribute:"id",autoLoad:!0,autoUpdateRoute:!0,i18nPrefix:""},i),l.settings=n.get(wa),l.errorTranslator=n.get(dr),l.cd=n.get(e.ChangeDetectorRef),l.dateFormat=n.get(Fn),l.toastController=n.get(L.ToastController),l._enableListenChanges=i.enableListenChanges,l._listenIntervalInSeconds=i.listenIntervalInSeconds,l._pathIdAttribute=i.pathIdAttribute,l._autoLoad=i.autoLoad,l._autoLoadDelay=i.autoLoadDelay,l._autoUpdateRoute=i.autoUpdateRoute,l._autoOpenNextTab=i.autoOpenNextTab,l.i18nContext={prefix:i.i18nPrefix,suffix:""},l}return ne(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 ue(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=Ee(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._listenChangesSubscription=null,this.$title.complete(),this.$title.unsubscribe(),this.onUpdateView.complete(),this.onUpdateView.unsubscribe()},n.prototype.loadFromRoute=function(){var t=this.route.snapshot;if(!t||de(this._pathIdAttribute))throw new Error("Unable to load from route: missing 'route' or 'options.pathIdAttribute'.");var e=t.params[this._pathIdAttribute];return ue(e)||"new"===e?this.load(void 0,t.params):(De(e)&&(e=parseInt(e)),this.load(e,t.params))},n.prototype.load=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r;return ie(this,(function(i){switch(i.label){case 0:if(!this.dataService)throw new Error("Cannot load data: missing 'dataService'!");if(this.resetError(),!ue(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,{emitEvent:!1}),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:Ga,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.canUserWrite=function(t,e){return this.dataService.canUserWrite(t,e)},n.prototype.startListenRemoteChanges=function(){var t=this;!this._listenChangesSubscription&&this._enableListenChanges&&(this.isNewData||ia.isLocal(this.data)||(this._listenChangesSubscription=this.listenChanges(this.data.id,{interval:this._listenIntervalInSeconds}).pipe(N.filter(pe)).subscribe((function(e){j.isMoment(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.showToast({message:"ERROR.DATA_UPDATE_DATE_CHANGED",type:"warning",showCloseButton:!0})):(t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"}: reloading page..."),t.reload()))})),this._listenChangesSubscription.add((function(){return t._listenChangesSubscription=null})),this.registerSubscription(this._listenChangesSubscription)))},n.prototype.stopListenRemoteChanges=function(){this._listenChangesSubscription&&(this.unregisterSubscription(this._listenChangesSubscription),this._listenChangesSubscription.unsubscribe(),this._listenChangesSubscription=null)},n.prototype.updateView=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return n=pe(t.id)&&void 0!==this.previousDataId&&this.previousDataId!==t.id,e=Object.assign({updateRoute:this._autoUpdateRoute&&n&&!this.loading,openTabIndex:this._autoOpenNextTab&&n&&ue(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 re(this,void 0,void 0,(function(){var n;return ie(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&&pe(t.id)?t.id:"new",t&&pe(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){pe(t)&&t>this.selectedTabIndex&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.saveAndClose=function(t,e){return re(this,void 0,void 0,(function(){var e;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,n,o;return ie(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.resetError(),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._listenChangesSubscription||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===ns&&pe(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return this.valid?[3,2]:[4,ar.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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?[2,!1]:[4,Xl.askDeleteConfirmation(this.alertCtrl,this.translate)];case 1:if(!r.sent())return[2];console.debug("[data-editor] Asking to delete..."),this.markAsSaving(),this.resetError(),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(){var t;return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return this.markAsLoading(),[4,this.load(null===(t=this.data)||void 0===t?void 0:t.id)];case 1:return e.sent(),[2]}}))}))},n.prototype.unload=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.stopListenRemoteChanges(),this.form.reset(),this.registerForms(),this._dirty=!1,this.data=null,this.saving=!1,[2]}))}))},n.prototype.goBack=function(t){var e;return re(this,void 0,void 0,(function(){return ie(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.resetError=function(t){he(this.error)&&(this.error=null,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.setError=function(t,e){if(t)if("string"==typeof t)console.error("[entity-editor] Error: "+(t||"")),this.error=t;else{console.error("[entity-editor] Error: "+t.message||"",t);var n=t.message&&this.translate.instant(t.message)||t,o=t.details&&"string"!=typeof t.details?t.details.message:t.details;if(he(o))n+='<br/><small class="'+((null==e?void 0:e.detailsCssClass)||"hidden-xs hidden-sm")+'" title="'+o+'">',n+=o.length<70?o:o.substring(0,67)+"...",n+="</small>";this.error=n}else this.error=void 0;e&&!1===e.emitEvent||this.markForCheck()},n.prototype.computeNextTabIndex=function(){var t=this.selectedTabIndex+1;return t<this.tabCount?t:void 0},n.prototype.onBeforeEntityLoad=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onNewEntity=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntityLoaded=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntitySaved=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntityDeleted=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.computeUsageMode=function(t){return this.settings.isUsageMode("FIELD")?"FIELD":"DESK"},n.prototype.waitWhilePending=function(t){return ar.waitWhilePending(this,t)},n.prototype.getValue=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,{title:t,path:this.router.url}]}))}))},n.prototype.removePageHistory=function(t){return re(this,void 0,void 0,(function(){return ie(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.listenChanges=function(t,e){return this.dataService.listenChanges(this.data.id,Object.assign({fetchPolicy:"no-cache"},e))},n.prototype.markForCheck=function(){var t;null===(t=this.cd)||void 0===t||t.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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return e=this.computePageUrl(pe(t.id)?t.id:"new"),fe(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}(Cu);wu.decorators=[{type:e.Directive}],wu.ctorParameters=function(){return[{type:e.Injector},{type:Function},{type:void 0},{type:Eu,decorators:[{type:e.Optional}]}]};var Iu=function(t){function e(e,n,o,r,i,a,s){var l=t.call(this,e,n,new su(o,r,i,a),s)||this;return l.columns=n,l.dataType=o,l.memoryDataService=r,l.validatorService=i,l.canEdit=!1,l.canDelete=!1,l.autoLoad=!1,l}return ne(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}(bu);Iu.decorators=[{type:e.Directive}],Iu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:Function},{type:lc},{type:Nt.ValidatorService},{type:au},{type:void 0}]},Iu.propDecorators={canEdit:[{type:e.Input}],canDelete:[{type:e.Input}]};var xu,Ou={LOAD_USER_EVENTS_ERROR:5e4,SAVE_USER_EVENT_ERROR:50001,SEND_MESSAGE_ERROR:50003},_u={DEBUG_DATA:"DEBUG_DATA",INBOX_MESSAGE:"INBOX_MESSAGE"};t.UserEvent=xu=function(t){function e(){return t.call(this,xu.TYPENAME)||this}return ne(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}(na),t.UserEvent=xu=oe([la({typename:"UserEventVO"})],t.UserEvent);var ku,Su,Tu={userEvent:yt.gql(ku||(ku=ce(["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(Su||(Su=ce(["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,le(arguments))||this;return e.issuer=null,e.recipient=null,e}return ne(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}(ac),t.UserEventFilter=oe([la({typename:"UserEventFilterVO"})],t.UserEventFilter);var Au,Ru,Pu,Du,Nu=yt.gql(Au||(Au=ce(["\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"])),Tu.userEvent),Mu=yt.gql(Ru||(Ru=ce(["\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"])),Tu.lightUserEvent),Fu=yt.gql(Pu||(Pu=ce(["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"],["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"]))),Lu=yt.gql(Du||(Du=ce(["\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"])),Tu.userEvent),ju=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&&!a.production,s}return ne(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),de((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?Lu:Mu,variables:{page:Object.assign(Object.assign({sortBy:"updateDate"},e),{sortDirection:(e.sortDirection||"DESC").toUpperCase()}),filter:n&&n.asPodObject()},arrayFieldName:"data",error:{code:Ou.LOAD_USER_EVENTS_ERROR,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&&we(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 re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return this.fillDefaultProperties(t),e=ue(t.id),n=t.asObject(),o=Date.now(),this._debug&&console.debug("[user-event-service] Saving user event...",n),[4,this.graphql.mutate({mutation:Nu,variables:{data:n},error:{code:Ou.SAVE_USER_EVENT_ERROR,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:Mu,data:Object.assign(Object.assign({},s),{content:null})}),r.insertIntoMutableCachedQueries(n,{query:Lu,data:s})))}})];case 1:return i.sent(),[2,t]}}))}))},n.prototype.deleteAll=function(t,e){return re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return ge(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:Fu,variables:{ids:e},update:function(t){o.removeFromMutableCachedQueriesByIds(t,{query:Mu,ids:e}),o.removeFromMutableCachedQueriesByIds(t,{query:Lu,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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(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=_u.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 na?JSON.stringify(t.asObject({keepTypename:!0,keepLocalId:!0,minify:!1})):JSON.stringify(t):void 0},n.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,Ia.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){ia.copyIdAndUpdateDate(t,e)},n}($s);ju.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ju(e.ɵɵinject(Vs),e.ɵɵinject(yl),e.ɵɵinject(_a),e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.ToastController),e.ɵɵinject(Qt,8))},token:ju,providedIn:"root"}),ju.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ju.ctorParameters=function(){return[{type:Vs},{type:yl},{type:_a},{type:F.TranslateService},{type:L.ToastController},{type:Yt,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]};var Bu={DEBUG_DATA:{matIcon:"bug_report"},INBOX_MESSAGE:{matIcon:"mail"}},Vu=function(e){function n(t,n,o,r,i,a){var s=e.call(this,t,hu.concat(["creationDate","icon","eventType","message"]).concat(mu),null,null)||this;return s.accountService=n,s.service=o,s.entities=r,s.cd=i,s.environment=a,s.i18nColumnPrefix="SOCIAL.USER_EVENT.",s.autoLoad=!1,s.inlineEdition=!1,s.defaultSortBy="creationDate",s.defaultSortDirection="desc",s}return ne(n,e),n.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.dateTimePattern=this.translate.instant("COMMON.DATE_TIME_PATTERN"),this.withContent=Ee(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 su(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})},n.prototype.start=function(){return re(this,void 0,void 0,(function(){return ie(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]}}))}))},n.prototype.getIcon=function(t){return Bu[t.eventType]},n.prototype.getDetail=function(t){if(t){if(t.content&&t.eventType===_u.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),{}}},n.prototype.doAction=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(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]}}))}))},n}(bu);Vu.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.USER_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}"]}]}],Vu.ctorParameters=function(){return[{type:e.Injector},{type:yl},{type:ju},{type:ss},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},Vu.propDecorators={recipient:[{type:e.Input}],withContent:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}]};var qu={INBOX_MESSAGE:"INBOX_MESSAGE",EMAIL:"EMAIL",FEED:"FEED"},Uu=Object.freeze([{id:qu.INBOX_MESSAGE,icon:"notifications",label:"SOCIAL.MESSAGE.TYPE_ENUM.INBOX_MESSAGE"},{id:qu.EMAIL,icon:"mail",label:"SOCIAL.MESSAGE.TYPE_ENUM.EMAIL"},{id:qu.FEED,icon:"paper",label:"SOCIAL.MESSAGE.TYPE_ENUM.FEED"}]);t.Message=function(e){function n(){return e.call(this)||this}return ne(n,e),n.prototype.fromObject=function(n,o){e.prototype.fromObject.call(this,n,o),this.type=n.type,this.issuer=n.issuer&&t.Person.fromObject(n.issuer),this.recipients=n.recipients&&n.recipients.map(t.Person.fromObject),this.subject=n.subject,this.body=n.body},n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,t);return n.recipients=this.recipients&&this.recipients.map((function(e){return e.asObject(t)})),n},n}(na),t.Message=oe([la({typename:"MessageVO"})],t.Message),t.MessageFilter=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n)},e.prototype.buildFilter=function(){return t.prototype.buildFilter.call(this)},e}(ac),t.MessageFilter=oe([la({typename:"MessageFilterVO"})],t.MessageFilter);var $u=function(){function e(t,e,n,o){this.settings=t,this.viewCtrl=e,this.accountService=n,this.cd=o,this.mobile=this.settings.mobile}return e.prototype.ngOnInit=function(){this.canSelectType=Ee(this.canSelectType,this.accountService.isAdmin())},e.prototype.ngAfterViewInit=function(){this.form.markAsReady({emitEvent:!1}),this.data&&(this.data.type=this.data.type||qu.INBOX_MESSAGE,this.form.setValue(this.data)),this.form.markAsLoaded(),this.form.enable()},e.prototype.cancel=function(t){this.viewCtrl.dismiss()},e.prototype.doSubmit=function(e){return re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return this.form.disabled?[2]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(r.sent(),this.form.invalid)return ar.logFormErrors(this.form.form,"[message-modal] "),this.form.markAllAsTouched(),[2];r.label=2;case 2:this.markAsLoading();try{return e=this.form.value,this.form.disable(),n=t.Message.fromObject(e),[2,this.viewCtrl.dismiss(n)]}catch(t){return this.form.error=t&&t.message||t,this.markAsLoaded(),this.form.enable(),ln(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2]}return[2]}}))}))},e.prototype.markForCheck=function(){this.cd.markForCheck()},e.prototype.markAsLoading=function(t){this.form.markAsLoading(t)},e.prototype.markAsLoaded=function(t){this.form.markAsLoaded(t)},e}();$u.decorators=[{type:e.Component,args:[{selector:"app-message-modal",template:'<ion-header>\n <ion-toolbar color="secondary">\n <ion-buttons slot="start">\n <ion-button class="back-button" (click)="cancel($event)" 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 {{\'SOCIAL.MESSAGE.NEW.TITLE\' | translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n\n <ion-button class="back-button" (click)="doSubmit($event)"\n [disabled]="!form.valid"\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 class="ion-padding" >\n\n <ion-item *ngIf="form.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]="form.error|translate"></ion-label>\n </ion-item>\n\n <app-message-form #form (onSubmit)="doSubmit($event)"\n (onCancel)="cancel($event)"\n [canSelectType]="canSelectType"\n [suggestFn]="suggestFn">\n </app-message-form>\n\n</ion-content>\n\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($event)">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button [fill]="form.invalid ? \'clear\' : \'solid\'"\n [disabled]="form.loading || form.invalid"\n (keyup.enter)="doSubmit($event)"\n (click)="doSubmit($event)" color="tertiary">\n <ion-label translate>COMMON.BTN_SEND</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],$u.ctorParameters=function(){return[{type:wa},{type:L.ModalController},{type:yl},{type:e.ChangeDetectorRef}]},$u.propDecorators={suggestFn:[{type:e.Input}],data:[{type:e.Input}],canSelectType:[{type:e.Input}],form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var Gu=function(t){function e(e,n,o){var r=t.call(this,e)||this;return r.formBuilder=n,r.cd=o,r.subjectMinLength=5,r.subjectMaxLength=255,r.bodyMaxLength=2e3,r.bodyAutoHeight=!0,r.canSelectType=!1,r.types=Uu,r.mobile=r.settings.mobile,r}return ne(e,t),e.prototype.ngOnInit=function(){this.setForm(this.formBuilder.group({type:[qu.INBOX_MESSAGE,P.Validators.required],recipients:[null,P.Validators.required],subject:[null,this.subjectMaxLength?P.Validators.compose([P.Validators.required,P.Validators.minLength(this.subjectMinLength),P.Validators.maxLength(this.subjectMaxLength)]):P.Validators.required],body:[null,this.bodyMaxLength?P.Validators.compose([P.Validators.maxLength(this.bodyMaxLength)]):P.Validators.required]}));var t=this.settings.getFieldDisplayAttributes("person",["lastName","firstName","department.name"]);this.registerAutocompleteField("recipients",{showAllOnFocus:!1,suggestFn:this.suggestFn,filter:{statusIds:[ps.TEMPORARY,ps.ENABLE]},attributes:t,displayWith:Ts.personToString,multiple:!0,mobile:this.mobile})},e.prototype.isSamePerson=function(t,e){return ia.equals(t,e,"id")},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}(nc);Gu.decorators=[{type:e.Component,args:[{selector:"app-message-form",template:'\n\n<form [formGroup]="form" class="form-container">\n\n \x3c!-- type --\x3e\n <mat-form-field *ngIf="canSelectType">\n <mat-select formControlName="type" [placeholder]="\'SOCIAL.MESSAGE.TYPE\'|translate">\n <mat-option *ngFor="let item of types" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n \x3c!-- Recipients --\x3e\n <mat-chips-field *ngIf="(form.controls.type.valueChanges|async) !== \'FEED\'"\n formControlName="recipients"\n [placeholder]="\'SOCIAL.MESSAGE.RECIPIENTS\'|translate"\n [config]="autocompleteFields.recipients"\n [equals]="isSamePerson">\n </mat-chips-field>\n\n \x3c!-- Subject --\x3e\n <mat-form-field>\n <input matInput type="text"\n [placeholder]="\'SOCIAL.MESSAGE.SUBJECT\'|translate"\n formControlName="subject"\n autocomplete="off"\n required>\n <mat-error *ngIf="form.controls.subject.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.subject.hasError(\'minlength\')">\n {{ \'ERROR.FIELD_MIN_LENGTH_COMPACT\'|translate }}\n </mat-error>\n <mat-error *ngIf="form.controls.subject.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH_COMPACT\'|translate }}\n </mat-error>\n <mat-hint *ngIf="subjectMaxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: form.controls.subject.value?.length || 0, max: subjectMaxLength } }}\n </mat-hint>\n </mat-form-field>\n\n \x3c!-- Body --\x3e\n <mat-form-field floatLabel="never">\n <textarea matInput type="text"\n [placeholder]="\'SOCIAL.MESSAGE.BODY_HELP\'|translate"\n formControlName="body"\n [class.fixed-height]="!bodyAutoHeight"\n [cdkTextareaAutosize]="bodyAutoHeight"\n (keydown.control.enter)="doSubmit($event)"\n >\n </textarea>\n <mat-error *ngIf="form.controls.body.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: form.controls.body.errors.maxlength }}\n </mat-error>\n <mat-hint *ngIf="bodyMaxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: form.controls.body.value?.length || 0, max: bodyMaxLength } }}\n </mat-hint>\n </mat-form-field>\n\n</form>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["textarea.fixed-height{height:11.5em}textarea{min-height:11.5em}"]}]}],Gu.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]},Gu.propDecorators={suggestFn:[{type:e.Input}],subjectMinLength:[{type:e.Input}],subjectMaxLength:[{type:e.Input}],bodyMaxLength:[{type:e.Input}],bodyAutoHeight:[{type:e.Input}],canSelectType:[{type:e.Input}]};var Hu=function(){};Hu.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,tu,Yl],declarations:[Vu,$u,Gu],exports:[Vu,$u]}]}];var zu,Wu,Ku={send:yt.gql(zu||(zu=ce(["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"],["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"])))},Qu=function(t){function e(e,n,o,r){var i=t.call(this,e,r)||this;return i.graphql=e,i.translate=n,i.toastController=o,i.environment=r,i._debug=!r.production,i}return ne(e,t),e.prototype.send=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s;return ie(this,(function(l){switch(l.label){case 0:n=t.asObject(xs),o=Date.now(),this._debug&&console.debug("[message-service] Send message...",n),l.label=1;case 1:return l.trys.push([1,5,,8]),[4,this.graphql.mutate({mutation:Ku.send,variables:{data:n},error:{code:Ou.SEND_MESSAGE_ERROR,message:"SOCIAL.ERROR.SEND_MESSAGE_ERROR"}})];case 2:return r=l.sent().done,this._debug&&console.debug("[message-service] Send message [OK] in "+(Date.now()-o)+"ms"),!r||e&&!1===e.showToast?[3,4]:[4,this.showToast({type:"info",message:"SOCIAL.INFO.MESSAGE_SENT"})];case 3:l.sent(),l.label=4;case 4:return[2,r];case 5:return i=l.sent(),a=i&&i.message||i,console.error(a),e&&!1===e.showToast?[3,7]:(s=a||"SOCIAL.ERROR.SEND_MESSAGE_ERROR",[4,this.showToast({type:"error",message:s})]);case 6:l.sent(),l.label=7;case 7:return[2,!1];case 8:return[2]}}))}))},e.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,Ia.show(this.toastController,this.translate,Object.assign({type:"info",message:"SOCIAL.INFO.MESSAGE_SENT"},t))]}))}))},e}($s);Qu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Qu(e.ɵɵinject(Vs),e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.ToastController),e.ɵɵinject(Qt,8))},token:Qu,providedIn:"root"}),Qu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Qu.ctorParameters=function(){return[{type:Vs},{type:F.TranslateService},{type:L.ToastController},{type:Yt,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]},t.PersonFilter=Wu=function(t){function e(){return t.call(this,Wu.TYPENAME)||this}return ne(e,t),e.searchFilter=function(t){return t&&Wu.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||(pe(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);fe(this.statusIds)&&n.push((function(t){return e.statusIds.includes(t.statusId)})),fe(this.excludedIds)&&n.push((function(t){return ue(t.id)||!e.excludedIds.includes(t.id)}));var o=ia.searchTextFilter(this.searchAttribute||this.searchAttributes||["lastName","firstName","department.name"],this.searchText);return o&&n.push(o),n},e}(ac),t.PersonFilter=Wu=oe([la({typename:"PersonFilterVO"})],t.PersonFilter);var Yu,Xu,Ju,Zu,td,ed={person:yt.gql(Yu||(Yu=ce(["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 }"])))},nd={loadAll:yt.gql(Xu||(Xu=ce(["\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 ",""])),ed.person),loadAllWithTotal:yt.gql(Ju||(Ju=ce(["\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 ",""])),ed.person)},od={saveAll:yt.gql(Zu||(Zu=ce(["\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 ",""])),ed.person),deleteAll:yt.gql(td||(td=ce(["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"],["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"])))},rd=function(e){function n(n,o,r,i){var a=e.call(this,n,o,t.Person,t.PersonFilter,{queries:nd,mutations:od,defaultSortBy:"lastName",defaultSortDirection:"asc"})||this;return a.graphql=n,a.platform=o,a.network=r,a.entities=i,a._debug=!aa.production,a}return ne(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var s,l,c,u;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(r){return ia.isNotEmpty(t,"id")?[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||[ps.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 re(this,void 0,void 0,(function(){var e,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return e=n&&n.maxProgression||100,t=Object.assign(Object.assign({},t),{statusIds:[ps.ENABLE,ps.TEMPORARY],userProfiles:["SUPERVISOR","USER","GUEST"]}),console.info("[person-service] Importing persons..."),[4,cc.fetchAllPages((function(e,n){return o.loadAll.call(i,e,n,"id",null,t,{debug:!1,fetchPolicy:"network-only",withTotal:0===e,toEntity:!1})}),{progression:null==n?void 0:n.progression,maxProgression:.9*e})];case 1:return r=a.sent(),[4,this.entities.saveAll(r.data,{entityName:"PersonVO",reset:!0})];case 2:return a.sent(),[2]}}))}))},n.prototype.asObject=function(e){if(e){console.debug("TODO check isInstanceOf"),e instanceof 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}(ru);rd.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new rd(e.ɵɵinject(Vs),e.ɵɵinject($l),e.ɵɵinject(_a),e.ɵɵinject(ss))},token:rd,providedIn:"root"}),rd.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],rd.ctorParameters=function(){return[{type:Vs},{type:$l},{type:_a},{type:ss}]};var id=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,Mo.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}();id.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new id(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(Sc))},token:id,providedIn:"root"}),id.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],id.ctorParameters=function(){return[{type:P.FormBuilder},{type:Sc}]};var ad=function(e){function n(n,o,r,i,a,s,l,c,u){var d=e.call(this,n,hu.concat(["avatar","lastName","firstName","email","profile","status","username","usernameExtranet","pubkey"]).concat(r.additionalFields.map((function(t){return t.key}))).concat(mu),new su(t.Person,s,i,{prependNewElements:!1,suppressErrors:u.production,dataServiceOptions:{saveOnlyDirtyRows:!0}}),null)||this;return d.accountService=r,d.validatorService=i,d.configService=a,d.dataService=s,d.messageService=l,d.cd=c,d.profiles=le(ks).reverse(),d.statusList=bs,d.statusById=ys,d.filterCriteriaCount=0,d.useSticky=!1,d.referentialToString=hs,d.canEdit=r.isAdmin(),d.canSendMessage=d.canEdit,d.inlineEdition=d.canEdit,d.confirmBeforeDelete=!0,d.autoLoad=!1,d.i18nColumnPrefix="USER.",d.defaultSortBy="lastName",d.defaultSortDirection="asc",d.filterForm=o.group({searchText:[null],statusId:[null]}),d.additionalFields=(d.accountService.additionalFields||[]).filter((function(t){return pe(t.autocomplete)})).map((function(t){return t.autocomplete=d.registerAutocompleteField(t.key,Object.assign({},t.autocomplete)),t})),d.debug=!u.production,d}return ne(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(xl.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,uu)}))).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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){return this.markAsLoading(),console.debug("[users] Restoring filter from settings..."),e=this.settings.getPageSettings(this.settingsId,uu)||{},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.openComposeMessageModal=function(e){return re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return e=(this.selection.selected||[]).map((function(t){return t.currentData})).map(t.Person.fromObject).map((function(t){var e,n=t.asObject({minify:!0});return n.department=null===(e=t.department)||void 0===e?void 0:e.asObject(),n})),[4,this.modalCtrl.getTop()];case 1:return n=!!a.sent(),[4,this.modalCtrl.create({component:$u,componentProps:{suggestFn:function(t,e,n,o){return i.dataService.suggest(t,e,n,o)},data:{recipients:e}},cssClass:n&&"stack-modal"})];case 2:return[4,(o=a.sent()).present()];case 3:return a.sent(),[4,o.onDidDismiss()];case 4:return(r=a.sent().data)&&r instanceof t.Message?(console.info("[users] received message to send: ",r),[4,this.messageService.send(r)]):[2];case 5:return a.sent(),[2]}}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(bu);ad.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\n \x3c!-- Compose message --\x3e\n <button mat-icon-button *ngIf="canSendMessage"\n [title]="\'USER.LIST.BTN_SEND_MESSAGE\'|translate"\n (click)="openComposeMessageModal($event)">\n <ion-icon name="mail" slot="icon-only"></ion-icon>\n </button>\n\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\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.valueChanges|async"\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:Nt.ValidatorService,useExisting:id}],animations:[Cn],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}"]}]}],ad.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:yl},{type:Nt.ValidatorService},{type:Pl},{type:rd},{type:Qu},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},ad.propDecorators={useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}]};var sd=function(){console.debug("[admin] Creating module")};sd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,tu,Hu,Ci,Ft.NgxJdenticonModule,F.TranslateModule.forChild()],declarations:[ad],exports:[Hu,ad]}]}],sd.ctorParameters=function(){return[]};var ld=[{path:"users",pathMatch:"full",component:ad,canActivate:[ou],canDeactivate:[Jl],data:{profile:"ADMIN"}}],cd=function(){};cd.decorators=[{type:e.NgModule,args:[{imports:[tc,sd,W.RouterModule.forChild(ld)],exports:[W.RouterModule]}]}];var ud=[{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 dd(t,e){if(ue(e))return(t||ud).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||ud).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var pd=function(){function t(t){this.formBuilder=t,this._items=dd(ud,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,Mo.entity],missingEntity:[null,Mo.entity],disableEntity:[null,Mo.entity],entities:[null,Lo.requiredArrayMinLength(1)],farEntity:[null,Mo.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: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:ud.slice(),attributes:["label","name","description","comments"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-far",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entities-items-filter",{service:{suggest:function(e,n){return t.suggest(e,n)}},attributes:["label","name"],multiple:!0})},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){t.farEntityField.suggestLengthThreshold=2,t.farEntityField.reloadItems()}),2e3),setTimeout((function(){return t.loadData()}),1e3)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(this,(function(n){return t={entity:dd(ud)[0],farEntity:dd(ud)[2],missingEntity:{id:-1,label:"??",name:"Missing item"},disableEntity:dd(ud)[2],entities:dd(ud)},this.form.setValue(t),setTimeout((function(){return e.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return re(this,void 0,void 0,(function(){return ie(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(pe).join(" - ")},t.prototype.entitiesToString=function(t){return(t||[]).map(this.entityToString).join(", ")},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=Te(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 re(i,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,Be(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.equals=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,e){var n=this.autocompleteFields.get(e).filter||{};n.searchAttribute=n&&"name"===n.searchAttribute?"label":"name",t.reloadItems()},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();pd.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 [equals]="equals"\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 Entity far in the list (not in first page)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre style="white-space: normal !important;">value: {{stringify(form.controls.farEntity.value)}}</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="farEntity" #farEntityField\n [config]="autocompleteFields.get(\'entity-far\')"\n [mobile]="true"\n [equals]="equals"\n [logPrefix]="\'[combo-mobile-far]\'"\n [debug]="true"\n [required]="true"\n [clearable]="true"\n placeholder="Far entity (in the list)"\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 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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\n [clearable]="true"\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-text color="primary">\n search with a suggestLengthThreshold\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]="true"\n [equals]="equals"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-mobile-suggestLengthThreshold]\'"\n required\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 Multiple value\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>multiple: true</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entities"\n [config]="autocompleteFields.get(\'entities-items-filter\')"\n [placeholder]="\'Multiple\'"\n mobile="true"\n multiple="true"\n [equals]="equals"\n [logPrefix]="\'[combo-mobile-multiple]\'"\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 [equals]="equals"\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(filterChangeField, \'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" #filterChangeField\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [mobile]="true"\n [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Fullscreen\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]="true"\n [class]="\'mat-autocomplete-panel-full-size\'"\n [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-mobile-full-size]\'"\n [debug]="true"\n [showAllOnFocus]="true"\n [showPanelOnFocus]="true"\n ></mat-autocomplete-field>\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></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 [equals]="equals"\n [clearable]="true"\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 search with a suggestLengthThreshold\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 [equals]="equals"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-desktop-suggestLengthThreshold]\'"\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 [equals]="equals"\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 [equals]="equals"\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-text color="primary">\n Multiple value\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>multiple: true</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entities"\n [config]="autocompleteFields.get(\'entities-items-filter\')"\n [placeholder]="\'Multiple\'"\n mobile="false"\n multiple="true"\n [equals]="equals"\n [logPrefix]="\'[combo-desktop-multiple]\'"\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>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 [equals]="equals"\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 [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n [debug]="true"\n [showAllOnFocus]="true"\n [showPanelOnFocus]="true"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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'}]}],pd.ctorParameters=function(){return[{type:P.FormBuilder}]},pd.propDecorators={farEntityField:[{type:e.ViewChild,args:["farEntityField"]}]};var hd=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,Mo.latitude])],longitude:[null,P.Validators.compose([P.Validators.required,Mo.longitude])]}),enable:t.group({latitude:[null,Mo.latitude],longitude:[null,Mo.longitude]}),disable:t.group({latitude:[null,Mo.latitude],longitude:[null,Mo.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 re(this,void 0,void 0,(function(){var t;return ie(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}();hd.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 </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'}]}],hd.ctorParameters=function(){return[{type:P.FormBuilder}]};var md=$t,fd=function(){function t(t,e){this.formBuilder=t,this.dateFormatPipe=e,this.$dates=new D.BehaviorSubject(void 0),this._today=md().startOf("day"),this.form=t.group({empty:[null,P.Validators.required],date:[null,P.Validators.compose([P.Validators.required,Mo.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]=md(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 re(this,void 0,void 0,(function(){var t;return ie(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}();fd.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 [equals]="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 [equals]="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 [equals]="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 [equals]="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'}]}],fd.ctorParameters=function(){return[{type:P.FormBuilder},{type:Fn}]};var gd=$t,bd=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],emptyRequired:[null,P.Validators.required],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null]},{validators:Fo.dateRange("empty","enable")});var o=this.form.get("disable");o.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return o.setValue(t)})),this.showLogPanel=this.showLogPanel||Rn(window)}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e,n=this;return ie(this,(function(o){return t=gd(),e={empty:null,emptyRequired:null,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)),ar.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}();bd.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 [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!-- Empty required value --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value + required\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="emptyRequired"\n placeholder="Date/Time"\n required\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'}]}],bd.ctorParameters=function(){return[{type:L.Platform},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var yd=[{id:1,label:"AAA",name:"Item A"},{id:2,label:"BBB",name:"Item B"},{id:3,label:"CCC",name:"Item C"},{id:4,label:"DDD",name:"Item D"},{id:5,label:"EEE",name:"Item E"},{id:6,label:"FFF",name:"Item F"},{id:7,label:"GGG",name:"Item G"}];function vd(t,e){if(ue(e))return(t||yd).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||yd).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var Cd=function(){function t(t){this.formBuilder=t,this._items=vd(yd,100),this._$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.form=t.group({entity:[null,Mo.entity],entityInitial:[null,Mo.entity],disableEntity:[null,Mo.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,equals:function(t,e){return 0===ia.compare(t,e,1,"id")}}),this.autocompleteFields.add("entity-items",{items:this._items.slice(),attributes:["label","name"],displayWith:this.entityToString,equals:function(t,e){return 0===ia.compare(t,e,1,"id")}}),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 re(this,void 0,void 0,(function(){var t,e,n=this;return ie(this,(function(o){return t=vd(yd),e={entity:t.slice(0,1),entityInitial:t.slice(1,2),disableEntity:t.slice(1,2)},this.form.setValue(e),setTimeout((function(){return n.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return re(this,void 0,void 0,(function(){return ie(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(pe).join(" - ")},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=Te(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 re(i,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,Be(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.equals=function(t,e){return t&&e&&t.id===e.id},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();Cd.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 chipColor="accent"\n [debug]="false"\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 [logPrefix]="\'[mat-chips-initialized] \'"\n chipColor="primary"\n [debug]="true"\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 [equals]="equals"\n [logPrefix]="\'[mat-chips-disabled] \'"\n chipColor="warning"\n [debug]="true"\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 [equals]="equals"\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'}]}],Cd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Ed=function(){this.$icon=new D.BehaviorSubject("alert"),this.$size=new D.BehaviorSubject("small"),this.$fill=new D.BehaviorSubject("solid"),this.$color=new D.BehaviorSubject("danger")};Ed.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 <ion-row class="ion-no-padding">\n <ion-col>\n <mat-icon [style.color]="\'var(--ion-color-secondary)\'"\n matBadge\n [ionBadgeIcon]="$icon|async"\n [matBadgeColor]="$color|async"\n [matBadgeFill]="$fill|async"\n [matBadgeSize]="$size|async"\n matBadgeOverlap="false">\n <ion-icon slot="icon-only"\n [color]="\'secondary\'"\n name="navigate"\n ></ion-icon>\n </mat-icon>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeColor"\n [value]="$color.value"\n (selectionChange)="this.$color.next($event.value)">\n <mat-option [value]="\'primary\'">primary</mat-option>\n <mat-option [value]="\'secondary\'">secondary</mat-option>\n <mat-option [value]="\'tertiary\'">tertiary</mat-option>\n <mat-option [value]="\'danger\'">danger</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="ionBadgeIcon"\n [value]="$icon.value"\n (selectionChange)="this.$icon.next($event.value)">\n <mat-option [value]="\'checkmark-circle\'">checkmark-circle</mat-option>\n <mat-option [value]="\'alert-circle\'">alert-circle</mat-option>\n <mat-option [value]="\'alert\'">alert</mat-option>\n <mat-option [value]="\'flag\'">flag</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeSize"\n [value]="$size.value"\n (selectionChange)="this.$size.next($event.value)">\n <mat-option [value]="\'large\'">large</mat-option>\n <mat-option [value]="\'medium\'">medium</mat-option>\n <mat-option [value]="\'small\'">small</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeFill"\n [value]="$fill.value"\n (selectionChange)="this.$fill.next($event.value)">\n <mat-option [value]="\'clear\'">clear</mat-option>\n <mat-option [value]="\'solid\'">solid</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n </ion-row>\n\n</ion-content>\n'}]}];var wd=function(){function t(t){this.formBuilder=t,this.form=t.group({empty:[null,P.Validators.required],integer:[null,P.Validators.compose([P.Validators.required,Mo.integer])],disable:[null,P.Validators.required],datetime:[null]}),this.form.get("disable").disable()}return t.prototype.ngOnInit=function(){this.loadData()},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){return t={empty:null,integer:99,disable:-111.11},this.form.patchValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t}();wd.decorators=[{type:e.Component,args:[{selector:"app-numpad-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>Numeric pad test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <h1>Numpad test page:</h1>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Decimal field, readonly\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="text" formControlName="empty" placeholder="Empty decimal field"\n autocomplete="off"\n [matNumpad]="numpadDecimal"\n readonly>\n <mat-numpad [decimal]="true" #numpadDecimal></mat-numpad>\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- filled --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Integer field\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="number" formControlName="integer" placeholder="Filled integer field"\n autocomplete="off"\n [matNumpad]="numpadInteger">\n <mat-numpad #numpadInteger [decimal]="false"></mat-numpad>\n\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- append to input --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Attach to input, readonly\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="text" formControlName="integer" placeholder="A number"\n autocomplete="off"\n [matNumpad]="numpadAppendToInput"\n readonly>\n <mat-numpad #numpadAppendToInput [appendToInput]="true"></mat-numpad>\n </mat-form-field>\n\n\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 Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="number" formControlName="disable" placeholder="Disabled field"\n autocomplete="off"\n [matNumpad]="numpadDisabled">\n <mat-numpad #numpadDisabled></mat-numpad>\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n\n \x3c!-- Other field (for comparision) --\x3e\n <ion-row><ion-col><ion-text><h4>Other field type (for style comparision)</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 Mat date time\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="datetime" placeholder="Date/Time field (desktop)">\n </mat-date-time-field>\n\n <mat-date-time-field formControlName="datetime"\n placeholder="Date/Time field (mobile)"\n mobile="true">\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],wd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Id=$t,xd=function(){function t(t,e){this.formBuilder=t,this.cd=e,this.showLogPanel=!0,this.logContent="",this.memoryHide=!1,this.memoryMobile=!0,this.timezone="Indian/Mahe",this.stringify=JSON.stringify,this.form=t.group({empty:[null,Mo.validDate],emptyRequired:[null,P.Validators.compose([P.Validators.required,Mo.validDate])],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null],timezone:[null]},{validators:Fo.dateRange("empty","enable")});var n=this.form.get("disable");n.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return n.setValue(t)})),this.showLogPanel=this.showLogPanel||Rn(window)}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){return t=Id(),e=t.clone().tz(this.timezone).startOf("day"),n={empty:null,emptyRequired:null,enable:io(t),disable:t.clone(),readonly:t.clone(),timezone:e},this.form.setValue(n),this.log("[test-page] Data loaded: "+JSON.stringify(n)),this.form.get("empty").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value n°1: "+JSON.stringify(t))})),this.form.get("enable").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value n°2: "+JSON.stringify(t))})),this.form.get("timezone").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value with timezone: "+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)),ar.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}();xd.decorators=[{type:e.Component,args:[{selector:"app-data-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 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\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-field formControlName="empty"\n *ngIf="!memoryHide"\n placeholder="Date"\n [required]="true"\n [mobile]="memoryMobile"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="empty"\n placeholder="Date"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\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 (required)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.emptyRequired.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="emptyRequired"\n placeholder="Date"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="enable"\n placeholder="Date"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="disable"\n placeholder="Date"\n [required]="true"\n [mobile]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- TimeZone --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>timezone="{{timezone}}" value="{{stringify(form.controls.timezone.value)}}"</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="timezone"\n placeholder="Date"\n [mobile]="true"\n [clearable]="true"\n [timezone]="timezone">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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)="mobileReadonlyField.readonly=$event.checked" [checked]="mobileReadonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-field #mobileReadonlyField formControlName="readonly"\n placeholder="Date"\n [readonly]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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 <hr/>\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-field formControlName="empty"\n placeholder="Date"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\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 (required)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.emptyRequired.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="emptyRequired"\n placeholder="Date"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="enable"\n placeholder="Date"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="disable"\n placeholder="Date"\n [required]="true"\n [mobile]="false">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- TimeZone --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>timezone="{{timezone}}" value={{stringify(form.controls.timezone.value)}}</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="timezone"\n placeholder="Date"\n [mobile]="false"\n [clearable]="true"\n [timezone]="timezone">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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)="desktopReadonlyField.readonly=$event.checked" [checked]="desktopReadonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-field #desktopReadonlyField formControlName="readonly"\n placeholder="Date"\n [readonly]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n </ion-grid>\n\n </form>\n</ion-content>\n'}]}],xd.ctorParameters=function(){return[{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var Od=[{label:"Shared Material components",divider:!0},{label:"Date/Time field",page:"/testing/shared/datetime"},{label:"Date field",page:"/testing/shared/date"},{label:"Autocomplete field",page:"/testing/shared/autocomplete"},{label:"Lat/Long field",page:"/testing/shared/latlong"},{label:"Numeric pad component",page:"/testing/shared/numpad"},{label:"Swipe component",page:"/testing/shared/swipe"},{label:"Chips component",page:"/testing/shared/chips"},{label:"Shared directives",divider:!0},{label:"Badge icon directive",page:"/testing/shared/badge-icon"}],_d=[{path:"",pathMatch:"full",component:Kl},{path:"autocomplete",pathMatch:"full",component:pd},{path:"datetime",pathMatch:"full",component:bd},{path:"date",pathMatch:"full",component:xd},{path:"latlong",pathMatch:"full",component:hd},{path:"numpad",pathMatch:"full",component:wd},{path:"swipe",pathMatch:"full",component:fd},{path:"chips",pathMatch:"full",component:Cd},{path:"badge-icon",pathMatch:"full",component:Ed}],kd=function(){};kd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,Ci,F.TranslateModule.forChild(),W.RouterModule.forChild(_d)],declarations:[bd,xd,pd,hd,wd,fd,Cd,Ed],exports:[Ci,W.RouterModule,bd,xd,pd,hd,wd,fd,Cd]}]}];var Sd=function(){function t(t,e){this.toastController=t,this.translate=e,this.defaultOptions={showCloseButton:!1}}return t.prototype.showToast=function(t){return Ia.show(this.toastController,this.translate,Object.assign(Object.assign(Object.assign({},this.defaultOptions),{message:"This is a message"}),t))},t.prototype.showInfo=function(t){return this.showToast(Object.assign({type:"info",message:"This is a info text !"},t))},t.prototype.showWarning=function(t){return this.showToast(Object.assign({type:"warning",message:"This is a warning text !"},t))},t.prototype.showError=function(t){return this.showToast(Object.assign({type:"error",message:"This is a error text !"},t))},t.prototype.toggleCloseButton=function(){this.defaultOptions.showCloseButton=!this.defaultOptions.showCloseButton},t}();Sd.decorators=[{type:e.Component,args:[{selector:"toast-testing",template:'<ion-toolbar color="primary">\n <ion-title>Toasts</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Toast examples:</p>\n\n <ion-button (click)="showToast()" color="dark">\n default\n </ion-button>\n\n <ion-button (click)="showInfo({duration: 100000})" color="secondary">\n info\n </ion-button>\n\n <ion-button (click)="showWarning()" color="accent">\n warning\n </ion-button>\n\n <ion-button (click)="showError()" color="danger">\n error\n </ion-button>\n\n <br/>\n\n\n <ion-list>\n\n\n <ion-item>\n <ion-checkbox slot="start" [value]="defaultOptions.showCloseButton" (ionChange)="toggleCloseButton()"></ion-checkbox>\n <ion-label>Close button ?</ion-label>\n </ion-item>\n </ion-list>\n\n\n</ion-content>\n'}]}],Sd.ctorParameters=function(){return[{type:L.ToastController},{type:F.TranslateService}]};var Td=[{path:"toast",pathMatch:"full",component:Sd}],Ad=function(){};Ad.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Td)],declarations:[Sd],exports:[W.RouterModule,Sd]}]}];var Rd=function(){function t(t){this.popoverController=t}return t.prototype.showPopover=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return[4,Bl.showUploadPopover(this.popoverController,t,Object.assign({uploadFn:function(t){return r.uploadFile(t)},deleteFn:function(t){return r.deleteFile(t)}},e))];case 1:return n=i.sent().data,o=(n||[]).map((function(t){var e,n;return null===(n=null===(e=t.response)||void 0===e?void 0:e.body)||void 0===n?void 0:n.finalName})),console.info("Popover result: ",o),[2]}}))}))},t.prototype.uploadFile=function(t){var e=new D.Subject,n=t.size/10,o=0;return D.timer(0,250).pipe(N.takeUntil(e),N.map((function(){return(o+=n)<t.size?{type:Q.HttpEventType.UploadProgress,loaded:-1}:(setTimeout((function(){return e.next()}),100),new Q.HttpResponse({body:{finalName:t.name}}))})))},t.prototype.deleteFile=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return console.info("[testing] Simulate remote deletion... (waiting 2s)"),[4,Be(2e3)];case 1:return t.sent(),[2,!0]}}))}))},t}();Rd.decorators=[{type:e.Component,args:[{selector:"upload-file-testing",template:'<ion-toolbar color="primary">\n <ion-title>File upload</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Popover examples:</p>\n\n <ion-button (click)="showPopover($event, {uniqueFile: true})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (unique file)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (many files)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false, instantUpload: true})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (instant upload)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false, instantUpload: true, maxParallelUpload: 3})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (max parallel upload)\n </ion-button>\n\n</ion-content>\n'}]}],Rd.ctorParameters=function(){return[{type:L.PopoverController}]};var Pd=[{path:"upload-file",pathMatch:"full",component:Rd}],Dd=function(){};Dd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Pd)],declarations:[Rd],exports:[W.RouterModule,Rd]}]}];var Nd=le(Od,[{label:"Shared other components",divider:!0},{label:"Toast",page:"/testing/shared/toast"},{label:"File upload",page:"/testing/shared/upload-file"}]),Md=function(){};Md.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),kd,Ad,Dd],exports:[kd,Ad,Dd]}]}],t.ReferentialFilter=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.searchText=e.searchText},e.prototype.buildFilter=function(){var e=t.prototype.buildFilter.call(this),n=ia.searchTextFilter(["label","name"],this.searchText);return n&&e.push(n),e},e}(ac),t.ReferentialFilter=oe([la({typename:"ReferentialFilterVO"})],t.ReferentialFilter);var Fd=function(t){function e(e){var n=t.call(this,e)||this;return n.formBuilder=e,n}return ne(e,t),e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(t,e){return this.formBuilder.group(this.getFormGroupConfig(t,e),this.getFormGroupOptions(t,e))},e.prototype.getFormGroupConfig=function(t,e){var n={id:[t&&t.id||null],updateDate:[t&&t.updateDate||null],creationDate:[t&&t.creationDate||null],statusId:[t&&t.statusId||null,P.Validators.required],levelId:[t&&t.levelId||null],label:[t&&t.label||null,P.Validators.required],name:[t&&t.name||null,P.Validators.required],entityName:[t&&t.entityName||null,P.Validators.required]};return e&&!1===e.withDescription||(n.description=[t&&t.description||null,P.Validators.maxLength(255)]),e&&!1===e.withComments||(n.comments=[t&&t.comments||null,P.Validators.maxLength(2e3)]),n},e.prototype.getFormGroupOptions=function(t,e){return null},e}(_c);Fd.decorators=[{type:e.Injectable}],Fd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Ld=function(e){function n(n,o,r,i){var a=e.call(this,n,le(hu,["label","name","levelId","statusId","updateDate","comments"],mu),new su(t.Referential,new lc(t.Referential,t.ReferentialFilter,{sortByReplacement:{id:"id"}}),o,{suppressErrors:!1}),null)||this;return a.validatorService=o,a.formBuilder=r,a.cd=i,a.canEdit=!0,a.filterCriteriaCount=0,a.groupColumns=["top-start","group-1","group-2","top-end"],a.statusList=bs,a.statusById=ys,a.useSticky=!0,a.enableInfiniteScroll=a.mobile,a.autoLoad=!1,a.inlineEdition=!0,a.i18nColumnPrefix="TABLE.TESTING.",a.confirmBeforeDelete=!0,a.confirmBeforeCancel=!1,a.undoableDeletion=!1,a.saveBeforeDelete=!1,a.saveBeforeSort=!0,a.saveBeforeFilter=!0,a.propagateRowError=!0,a.filterForm=r.group({searchText:[null]}),a.onStartEditingRow.subscribe((function(t){t.validator.patchValue({entityName:"TestVO"},{emitEvent:!1})})),a}return ne(n,e),Object.defineProperty(n.prototype,"hasMoreData",{get:function(){return this.data.length<100},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataService",{get:function(){return this._dataSource.dataService},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var n=this;e.prototype.ngOnInit.call(this),this.registerSubscription(this.filterForm.valueChanges.pipe(N.debounceTime(250),N.filter((function(){return n.filterForm.valid})),N.tap((function(e){var o=t.ReferentialFilter.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,"filter")}))).subscribe()),this.registerAutocompleteField("level",{items:[{id:1,label:"A",name:"item A"},{id:1,label:"B",name:"item B"}],mobile:this.mobile}),this.registerSubscription(this.onRefresh.subscribe((function(){n.filterForm.markAsUntouched(),n.filterForm.markAsPristine()}))),this.markAsReady()},n.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),this.restoreFilter(),this.load()},n.prototype.ngOnDestroy=function(){console.debug("[test-table] Destroying table..."),e.prototype.ngOnDestroy.call(this),this.stopTimer(),this.dataService.ngOnDestroy()},n.prototype.restoreFilter=function(){var e=this.settings.getPageSettings(this.settingsId,"filter");if(console.debug("[table-test] Restoring filter from settings...",e),e){var n=t.ReferentialFilter.fromObject(e);this.filterForm.patchValue(e,{emitEvent:!1}),this.filterCriteriaCount=n.countNotEmptyCriteria(),this.setFilter(n,{emitEvent:!1}),this.markForCheck()}},n.prototype.toggleTimer=function(){pe(this.timer)?this.stopTimer():this.startTimer()},n.prototype.load=function(){console.debug("[test-table] Updating data..."),this.markAsLoading(),ue(this.data)&&(this.data=this.generateData(0,this.enableInfiniteScroll?this.defaultPageSize:n.maxRowCount)),this.dataService.setValue(this.data,{emitEvent:!1}),this.onRefresh.emit(),this.infiniteScroll&&(this.infiniteScroll.disabled=!this.infiniteScroll||this.data.length>=n.maxRowCount)},n.prototype.loadMore=function(t){var e=this;console.debug("[table-test] Loading more...",t),setTimeout((function(){e.data=le(e.data,e.generateData(e.data.length,20)),e.dataService.setValue(e.data,{emitEvent:!1}),e.defaultPageSize=e.data.length,e.infiniteScroll.disabled=e.data.length>=100,e.doRefresh(t)}),500)},n.prototype.save=function(){var t=Object.create(null,{save:{get:function(){return e.prototype.save}}});return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return[4,t.save.call(this)];case 1:return(e=n.sent())&&(this.data=this.dataService.value),[2,e]}}))}))},n.prototype.clearControlValue=function(t,e){return t&&t.stopPropagation(),e.setValue(null),!1},n.prototype.applyFilterAndClosePanel=function(t){this.defaultPageSize=20,this.onRefresh.emit(t),this.filterExpansionPanel.close()},n.prototype.resetFilter=function(e){this.filterForm.reset({},{emitEvent:!0}),this.setFilter(t.ReferentialFilter.fromObject({}),{emitEvent:!0}),this.filterExpansionPanel.close()},n.prototype.startTimer=function(){var t=this;this.stopTimer(),this.timer=setInterval((function(){t.data=null,t.load()}),500)},n.prototype.stopTimer=function(){pe(this.timer)&&(clearInterval(this.timer),this.timer=null)},n.prototype.generateData=function(e,n){e=e||0,n=n||100;for(var o=new Array,r=0;r<n;r++){var i=r+1+e,a=t.Referential.fromObject({id:i,label:"CODE-"+i,name:"Name #"+i,levelId:{id:1,label:"A",name:"Item A"},statusId:ps.ENABLE,comments:"My comment #"+i,creationDate:so(Date.now()-60*r*1e3),updateDate:so(Date.now()-60*r*1e3),entityName:"TestVO"});o.push(a)}return o},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(bu);Ld.maxRowCount=100,Ld.decorators=[{type:e.Component,args:[{selector:"app-table-testing",template:'<app-toolbar color="primary" [canGoBack]="true" [backHref]="\'/testing\'">\n <ion-buttons slot="end">\n\n\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!-- 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\n \x3c!-- start/stop timer to auto-load data --\x3e\n <ion-button *ngIf="!timer" (click)="startTimer()">Start reload</ion-button>\n <ion-button *ngIf="timer" (click)="stopTimer()" color="accent">Stop reload</ion-button>\n </ng-container>\n\n \x3c!-- if row selection --\x3e\n <ng-template #hasSelection>\n\n \x3c!-- delete --\x3e\n <button mat-icon-button\n *ngIf="canEdit" [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n\n \x3c!-- duplicate --\x3e\n <button mat-icon-button\n *ngIf="canEdit && selection.selected | isArrayLength: {equals: 1}"\n [title]="\'COMMON.BTN_DUPLICATE\'|translate"\n (click)="duplicateRow($event, selection.selected[0])">\n <mat-icon>file_copy</mat-icon>\n </button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n<ion-content class="ion-no-padding">\n\n <ion-refresher slot="fixed" *ngIf="mobile" (ionRefresh)="doRefresh($event)">\n <ion-refresher-content></ion-refresher-content>\n </ion-refresher>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="mobile && 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="filter-panel filter-panel-floating">\n <form class="form-container ion-padding-top" [formGroup]="filterForm" (ngSubmit)="applyFilterAndClosePanel($event)">\n\n <ion-grid>\n <ion-row>\n <ion-col>\n \x3c!-- search text --\x3e\n <mat-form-field>\n <ion-icon matPrefix name="search"></ion-icon>\n <input matInput\n formControlName="searchText"\n autocomplete="off"\n [placeholder]="\'TABLE.TESTING.SEARCH_TEXT\'|translate">\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 </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 <ion-text translate>COMMON.BTN_APPLY</ion-text>\n </ion-button>\n </mat-action-row>\n </mat-expansion-panel>\n\n \x3c!-- table --\x3e\n <div [class.table-container]="!enableInfiniteScroll">\n <table #table mat-table matSort matSortDisableClear\n [dataSource]="dataSource"\n [matSortActive]="defaultSortBy"\n [matSortDirection]="defaultSortDirection"\n [trackBy]="trackByFn">\n\n \x3c!-- group header cells --\x3e\n\n <ng-container matColumnDef="top-start" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!canEdit" [attr.colspan]="2">\n \x3c!-- start spacer --\x3e\n </th>\n </ng-container>\n\n <ng-container matColumnDef="group-1">\n <th mat-header-cell *matHeaderCellDef [attr.colspan]="3" style="background-color: whitesmoke; margin-bottom: -1px;">\n <ion-label translate>{{i18nColumnPrefix + \'GROUP_1\'}}</ion-label>\n </th>\n </ng-container>\n\n <ng-container matColumnDef="group-2">\n <th mat-header-cell *matHeaderCellDef [attr.colspan]="3">\n <ion-label translate>{{i18nColumnPrefix + \'GROUP_2\'}}</ion-label>\n </th>\n </ng-container>\n\n <ng-container matColumnDef="top-end" >\n <th mat-header-cell *matHeaderCellDef>\n \x3c!-- end spacer --\x3e\n </th>\n </ng-container>\n\n <ng-container matColumnDef="select" [sticky]="useSticky" [class.mat-column-sticky]="useSticky">\n <th 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 </th>\n <td 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 </td>\n </ng-container>\n\n \x3c!-- Id column --\x3e\n <ng-container matColumnDef="id" [sticky]="useSticky" [class.mat-column-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!-- Label column --\x3e\n <ng-container matColumnDef="label">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.LABEL</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">\n <mat-form-field floatLabel="never">\n <input matInput\n [formControl]="row.validator.controls[\'label\']"\n [placeholder]="\'TABLE.TESTING.LABEL\'|translate"\n [appAutofocus]="row.editing && focusColumn === \'label\'"\n [readonly]="!row.editing">\n <mat-error *ngIf="row.validator.controls[\'label\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Name column --\x3e\n <ng-container matColumnDef="name">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.NAME</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator?.controls.name" [placeholder]="\'TABLE.TESTING.NAME\'|translate"\n [readonly]="!row.editing">\n <mat-error *ngIf="row.validator?.controls.name.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Level column --\x3e\n <ng-container matColumnDef="levelId">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.LEVEL_ID</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\n <mat-autocomplete-field floatLabel="never"\n [formControl]="row.validator.controls.levelId"\n [config]="autocompleteFields.level"\n [readonly]="!row.editing"\n required>\n </mat-autocomplete-field>\n </td>\n </ng-container>\n\n \x3c!-- Status column --\x3e\n <ng-container matColumnDef="statusId">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.STATUS</span>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\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\']" [placeholder]="i18nColumnPrefix + \'STATUS_ID\'|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\n \x3c!-- Creation date column --\x3e\n <ng-container matColumnDef="updateDate">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.UPDATE_DATE</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" class="mat-form-field-disabled">\n <ion-text class="ion-text-end" color="medium" *ngIf="row.id!==-1">\n <small [matTooltip]="\'TABLE.TESTING.CREATION_DATE\'|translate" *ngIf="row.currentData.creationDate; let creationDate">\n <ion-icon name="calendar"></ion-icon>\n {{ creationDate | dateFormat: {time: true} }}\n </small><br/>\n <small [matTooltip]="\'TABLE.TESTING.UPDATE_DATE\'|translate" *ngIf="row.currentData.updateDate; let updateDate">\n <ion-icon name="time-outline"></ion-icon>\n {{ updateDate | dateFormat: {time: true} }}\n </small>\n </ion-text>\n </td>\n </ng-container>\n\n \x3c!-- Comment column --\x3e\n <ng-container matColumnDef="comments">\n <th mat-header-cell *matHeaderCellDef>\n <ion-label translate>TABLE.TESTING.COMMENTS</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">\n <mat-form-field floatLabel="never" *ngIf="row.editing; else iconComment">\n \x3c!--<textarea matInput [formControl]="row.validator?.controls.comments"\n [placeholder]="\'TABLE.TESTING.COMMENTS\'|translate"\n [readonly]="!row.editing"></textarea>--\x3e\n\n <input type="text" matInput [formControl]="row.validator?.controls.comments"\n [placeholder]="\'TABLE.TESTING.COMMENTS\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn === \'comments\'">\n </mat-form-field>\n\n <ng-template #iconComment>\n <mat-icon class="comment"\n *ngIf="row.validator?.controls.comments.value"\n [title]="row.validator?.controls.comments.value"></mat-icon>\n </ng-template>\n </td>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <app-actions-column [stickyEnd]="true" [canCancel]="false"\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 [cellTemplate]="cellInjection">\n\n \x3c!-- cell injection--\x3e\n <ng-template #cellInjection let-row>\n <span *ngIf="row.editing && !row.validator.dirty">-</span>\n </ng-template>\n\n </app-actions-column>\n\n <tr mat-header-row *matHeaderRowDef="groupColumns;" class="mat-toolbar"></tr>\n <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>\n <tr mat-row *matRowDef="let row; columns: displayedColumns;"\n [class.mat-row-selected]="row.editing"\n [class.mat-row-error]="row.validator?.invalid"\n [class.mat-row-disabled]="!row.editing"\n [class.mat-row-dirty]="row.validator?.dirty"\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\n <ion-infinite-scroll *ngIf="enableInfiniteScroll"\n [threshold]="mobile ? \'10%\' : \'2%\'" position="bottom"\n (ionInfinite)="loadMore($event)">\n <ion-infinite-scroll-content\n loadingSpinner="circles"\n [loadingText]="\'COMMON.LOADING_DOTS\'|translate">\n </ion-infinite-scroll-content>\n </ion-infinite-scroll>\n </div>\n</ion-content>\n\n<ion-footer>\n \x3c!-- Paginator --\x3e\n <mat-paginator *ngIf="!enableInfiniteScroll"\n [length]="totalRowCount" [pageSize]="defaultPageSize" [pageSizeOptions]="defaultPageSizeOptions"\n class="mat-paginator-footer"\n showFirstLastButtons>\n </mat-paginator>\n\n <app-form-buttons-bar *ngIf="canEdit && !mobile"\n (onCancel)="load()"\n (onSave)="save()" [disabled]="(loadingSubject|async) || !dirty">\n \x3c!-- error --\x3e\n <ion-item *ngIf="error$|async" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n </app-form-buttons-bar>\n</ion-footer>\n\n<ion-fab slot="fixed" vertical="bottom" horizontal="end"\n *ngIf="canEdit && mobile">\n <ion-fab-button color="tertiary" (click)="addRow($event)">\n <ion-icon name="add"></ion-icon>\n </ion-fab-button>\n</ion-fab>\n',providers:[{provide:_c,useClass:Fd},{provide:bu,useExisting:e.forwardRef((function(){return Ld}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".table-container .mat-table .mat-column-select{min-width:30px}.table-container .mat-table .mat-column-id{min-width:30px;max-width:30px}.table-container .mat-table .mat-column-label,.table-container .mat-table .mat-column-levelId,.table-container .mat-table .mat-column-name,.table-container .mat-table .mat-column-statusId{min-width:150px}.table-container .mat-table .mat-column-comments{min-width:100px;max-width:100px}"]}]}],Ld.ctorParameters=function(){return[{type:e.Injector},{type:_c},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]},Ld.propDecorators={enableInfiniteScroll:[{type:e.Input}],useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}],infiniteScroll:[{type:e.ViewChild,args:[L.IonInfiniteScroll]}]};var jd=function(){};jd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Yl,tu,F.TranslateModule.forChild()],declarations:[Ld],exports:[Ld,F.TranslateModule]}]}];var Bd=function(){function t(t){this.popoverController=t}return t.prototype.showPopover=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return[4,this.popoverController.create({component:rc,componentProps:Object.assign({title:"modalTitle",placeholder:"your text"},e),backdropDismiss:!1,keyboardClose:!1,event:t,translucent:!0,cssClass:"popover-large"})];case 1:return[4,(n=r.sent()).present()];case 2:return r.sent(),[4,n.onDidDismiss()];case 3:return(o=r.sent().data)&&console.info("Popover result: ",o),[2]}}))}))},t}();Bd.decorators=[{type:e.Component,args:[{selector:"text-popover-testing",template:'<ion-toolbar color="primary">\n <ion-title>Text popover</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Multi lines examples:<br/>\n <small>Press Ctrl+Enter to validate</small>\n <small>\n <pre>multiline: true</pre>\n </small>\n </p>\n\n <ion-button (click)="showPopover($event, {})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span>\n </ion-button>\n\n <ion-button (click)="showPopover($event, {autofocus: true})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> (autofocus)\n </ion-button>\n\n <p>One line examples:\n <small>\n <pre>multiline: false</pre>\n </small>\n </p>\n\n\n <ion-button (click)="showPopover($event, {multiline : false})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> \n </ion-button>\n <ion-button (click)="showPopover($event, {multiline : false, autofocus: true})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> (autofocus)\n </ion-button>\n\n\n</ion-content>\n'}]}],Bd.ctorParameters=function(){return[{type:L.PopoverController}]};var Vd=[{path:"text-popover",pathMatch:"full",component:Bd}],qd=function(){};qd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Vd)],declarations:[Bd],exports:[W.RouterModule,Bd]}]}];var Ud=[{path:"",pathMatch:"full",redirectTo:"table"},{path:"table",pathMatch:"full",component:Ld},{path:"text-popover",pathMatch:"full",component:Bd}],$d=function(){};$d.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Ud),jd,qd],exports:[W.RouterModule,jd,qd]}]}],t.APP_ABOUT_DEVELOPERS=yc,t.APP_ABOUT_PARTNERS=vc,t.APP_CONFIG_OPTIONS=Rl,t.APP_FORM_ERROR_I18N_KEYS=ur,t.APP_GRAPHQL_TYPE_POLICIES=Bs,t.APP_HOME_BUTTONS=Ic,t.APP_LOCALES=us,t.APP_LOCAL_SETTINGS=Ca,t.APP_LOCAL_SETTINGS_OPTIONS=Ea,t.APP_LOCAL_STORAGE_TYPE_POLICIES=as,t.APP_MENU_ITEMS=Qc,t.APP_TESTING_PAGES=Wl,t.AboutModal=Cc,t.AccountPage=Tc,t.AccountService=yl,t.AccountToStringPipe=Hc,t.ActionsColumnComponent=Wc,t.AdminModule=sd,t.AdminRoutingModule=cd,t.Alerts=Xl,t.AndroidOsEnvironment=Ul,t.AppEditor=vu,t.AppEditorOptions=Eu,t.AppEntityEditor=wu,t.AppForm=nc,t.AppFormField=Ni,t.AppFormProvider=rr,t.AppFormUtils=ar,t.AppGestureConfig=Ii,t.AppGraphQLModule=Mc,t.AppHelpModal=Gl,t.AppInMemoryTable=Iu,t.AppInstallUpgradeCard=$c,t.AppListForm=Bc,t.AppLoadingSpinner=Qi,t.AppMenuModule=Xc,t.AppNullForm=or,t.AppPropertiesForm=jc,t.AppTabEditor=Cu,t.AppTabEditorOptions=yu,t.AppTable=bu,t.AppTableDataSourceOptions=au,t.AppTableUtils=iu,t.AppValidatorService=_c,t.AppendToInputDirective=ci,t.ArrayFilterPipe=Co,t.ArrayFirstPipe=bo,t.ArrayIncludesPipe=vo,t.ArrayLengthPipe=go,t.ArrayPluckPipe=yo,t.AudioProvider=Li,t.AuthForm=gc,t.AuthGuardService=ou,t.AuthModal=bc,t.AutocompleteTestPage=pd,t.AutofocusDirective=vr,t.Base58=Yi,t.BaseEntityService=ru,t.BaseGraphqlService=$s,t.BaseGraphqlServiceOptions=Us,t.BaseReferential=vs,t.Beans=Ge,t.CORE_CONFIG_OPTIONS=xl,t.CORE_TESTING_PAGES=[{label:"Core components",divider:!0},{label:"Table",page:"/testing/core/table"},{label:"Text popover",page:"/testing/core/text-popover"}],t.CellValueChangeListener=gu,t.ChipsTestPage=Cd,t.Color=pc,t.ColorScale=hc,t.ComponentDirtyGuard=Jl,t.ConfigService=Pl,t.CoreModule=tu,t.CoreTestingModule=$d,t.CryptoService=ea,t.DATE_ISO_PATTERN=Xt,t.DATE_UNIX_MS_TIMESTAMP="x",t.DATE_UNIX_TIMESTAMP="X",t.DEFAULT_PAGE_SIZE=20,t.DEFAULT_PAGE_SIZE_OPTIONS=pu,t.DEFAULT_PLACEHOLDER_CHAR=Jt,t.DEFAULT_REQUIRED_COLUMNS=fu,t.DateDiffDurationPipe=jn,t.DateFormatPipe=Fn,t.DateFromNowPipe=Bn,t.DateTimeTestPage=bd,t.DateUtils=ro,t.DepartmentToStringPipe=zc,t.DragAndDropDirective=Er,t.DurationPipe=co,t.ENTITIES_STORAGE_KEY_PREFIX=rs,t.ENVIRONMENT=Qt,t.EmptyArrayPipe=fo,t.EntitiesService=ic,t.EntitiesStorage=ss,t.EntitiesTableDataSource=su,t.Entity=na,t.EntityClass=la,t.EntityClasses=sa,t.EntityFilter=ac,t.EntityFilterUtils=sc,t.EntityMetadataComponent=Ac,t.EntityStore=is,t.EntityUtils=ia,t.Environment=Yt,t.EvenPipe=po,t.FileResponse=Nl,t.FileService=Wi,t.FileSizePipe=no,t.FilesUtils=Bl,t.FormArrayHelper=ir,t.FormButtonsBarComponent=Pc,t.FormButtonsBarToken=Rc,t.FormErrorTranslatePipe=pr,t.FormErrorTranslator=dr,t.FormFieldValuesHolder=ec,t.FormGetArrayPipe=fr,t.FormGetControlPipe=mr,t.FormGetGroupPipe=gr,t.FormGetPipe=hr,t.FormGetValuePipe=br,t.Fragments=_l,t.GraphqlService=Vs,t.HAMMER_PRESS_TIME=wi,t.HAMMER_TAP_TIME=250,t.HighlightPipe=eo,t.HomePage=xc,t.Hotkeys=Bi,t.HotkeysDialogComponent=ji,t.InMemoryEntitiesService=lc,t.IsLoginAccountPipe=Gc,t.IsNilOrBlankPipe=Oo,t.IsNotNilOrBlankPipe=xo,t.IsNotOnFieldModePipe=qc,t.IsOnFieldModePipe=Vc,t.JobUtils=cc,t.KEYBOARD_HIDE_DELAY_MS=te,t.LAT_LONG_DEFAULT_MAX_DECIMALS=3,t.LAT_LONG_PATTERNS=Vn,t.LatLongFormatPipe=Zn,t.LatLongTestPage=hd,t.LatitudeFormatPipe=Xn,t.LocalSettingsService=wa,t.LongitudeFormatPipe=Jn,t.MINIFY_ENTITY_FOR_LOCAL_STORAGE=Is,t.MINIFY_ENTITY_FOR_POD=xs,t.MapGetPipe=Eo,t.MapKeysPipe=wo,t.MapValuesPipe=Io,t.MatAutocompleteConfigHolder=Pn,t.MatAutocompleteField=Mn,t.MatBadgeIconDirective=bi,t.MatBooleanField=Zr,t.MatChipsField=fi,t.MatDate=Dr,t.MatDateShort=$r,t.MatDateTime=Br,t.MatDuration=Qr,t.MatLatLongField=Sr,t.MatNumpadComponent=ai,t.MatNumpadContainerComponent=ri,t.MatNumpadContent=li,t.MatPaginatorI18n=_i,t.MatStepperI18n=Hl,t.MatSwipeField=pi,t.MaterialTestingModule=kd,t.MathAbsPipe=uo,t.MenuComponent=Yc,t.MenuItems=Ec,t.MenuService=Kc,t.MessageForm=Gu,t.MessageModal=$u,t.MessageService=Qu,t.MessageTypeList=Uu,t.MessageTypes=qu,t.MimeTypes=jl,t.ModalToolbarComponent=Ki,t.NetworkService=_a,t.NgInitDirective=Do,t.NgVarDirective=Cr,t.NotEmptyArrayPipe=mo,t.NumberFormatPipe=to,t.NumpadDirective=si,t.OddPipe=ho,t.PRIORITIZED_AUTHORITIES=ks,t.PUBKEY_REGEXP=Zt,t.PersonFragments=ed,t.PersonService=rd,t.PersonToStringPipe=Uc,t.PersonUtils=Ts,t.PersonValidatorService=id,t.PlatformService=$l,t.ProgressBarService=Ei,t.ProgressInterceptor=ki,t.PropertyGetPipe=Po,t.RESERVED_END_COLUMNS=mu,t.RESERVED_START_COLUMNS=hu,t.ReferentialUtils=ws,t.ReferentialValidatorService=Fd,t.RegisterConfirmPage=Oc,t.SETTINGS_DISPLAY_COLUMNS=lu,t.SETTINGS_FILTER=uu,t.SETTINGS_PAGE_SIZE=du,t.SETTINGS_SORTED_COLUMN=cu,t.SETTINGS_STORAGE_KEY=ba,t.SETTINGS_TRANSIENT_PROPERTIES=ya,t.SHARED_MATERIAL_TESTING_PAGES=Od,t.SHARED_TESTING_PAGES=Nd,t.SPACE_PLACEHOLDER_CHAR=" ",t.SelectPeerModal=fa,t.SettingsPage=Lc,t.SharedAsyncValidators=jo,t.SharedDirectivesModule=wr,t.SharedFormArrayValidators=Lo,t.SharedFormGroupValidators=Fo,t.SharedHotkeysModule=Vi,t.SharedMatAutocompleteModule=Ir,t.SharedMatBadgeIconModule=yi,t.SharedMatBooleanModule=ti,t.SharedMatChipsModule=gi,t.SharedMatDateTimeModule=Gr,t.SharedMatDurationModule=Yr,t.SharedMatLatLongModule=Tr,t.SharedMatNumpadModule=ui,t.SharedMatSwipeModule=hi,t.SharedMaterialModule=Ci,t.SharedModule=Yl,t.SharedPipesModule=yr,t.SharedRoutingModule=tc,t.SharedTestingModule=Md,t.SharedTestsPage=Kl,t.SharedValidators=Mo,t.SocialErrorCodes=Ou,t.SocialModule=Hu,t.StartableService=Mi,t.StatusById=ys,t.StatusIds=ps,t.StatusList=bs,t.StrIncludesPipe=So,t.StrLengthPipe=ko,t.SwipeTestPage=fd,t.TableSelectColumnsComponent=Dc,t.TableTestPage=Ld,t.TableTestingModule=jd,t.TextForm=oc,t.TextPopover=rc,t.TextPopoverTestingModule=qd,t.TextPopoverTestingPage=Bd,t.ToStringPipe=_o,t.Toasts=Ia,t.ToolbarComponent=Oi,t.ToolbarToken=xi,t.TranslatablePipe=Ro,t.TranslateContextPipe=Ao,t.TranslateContextService=To,t.UploadFile=Dl,t.UploadFileComponent=zl,t.UploadFilePopover=Ll,t.UploadFileTestingModule=Dd,t.UploadFileTestingPage=Rd,t.UriUtils=Vl,t.UserEventFragments=Tu,t.UserEventService=ju,t.UserEventTypes=_u,t.UserEventsTable=Vu,t.UsersPage=ad,t.accountToString=As,t.adaptValueToControl=qo,t.addValueInArray=zo,t.arrayDistinct=function(t,e){if(ge(t))return t;e=e||Object.keys(t[0]);var n=new Set;return t.reduce((function(t,o){var r=Ae(o,e,"|");return n.has(r)?t:(n.add(r),t.concat(o))}),[])},t.arrayGroupBy=function(t,e){return ue(t)?null:t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{})},t.arraySize=function(t){return fe(t)&&t.length||0},t.asInputElement=tn,t.canHaveFocus=nn,t.capitalizeFirstLetter=qe,t.chainPromises=cn,t.changeCaseToUnderscore=ke,t.clearValueInArray=Qo,t.copyEntity2Form=Bo,t.createPromiseEvent=mn,t.createPromiseEventEmitter=hn,t.departmentToString=Os,t.departmentsToString=_s,t.disableControls=Ho,t.emitPromiseEvent=fn,t.entityToString=function(t,e){return t&&t.id&&Ae(t,e||["name"])||void 0},t.equals=$e,t.equalsOrNil=function(t,e){return t===e||ue(t)&&ue(e)},t.fadeInAnimation=bn,t.fadeInOutAnimation=yn,t.filterFalse=function(t){return t.pipe(N.filter((function(t){return!1===t})))},t.filterNotNil=function(t){return t.pipe(N.filter(pe))},t.filterNumberInput=Ye,t.filterTrue=function(t){return t.pipe(N.filter((function(t){return!0===t})))},t.firstArrayValue=function(t){return fe(t)?t[0]:void 0},t.firstFalse=function(t){return t.pipe(N.first((function(t){return!1===t})),N.map((function(t){})))},t.firstFalsePromise=sn,t.firstNotNil=rn,t.firstNotNilPromise=ln,t.firstTrue=un,t.firstTruePromise=an,t.focusInput=Xe,t.focusNextInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&Ze(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=on(e,Object.assign({minTabindex:o},n));return!!fe(r)&&(r[0].focus(),!0)},t.focusPreviousInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&Ze(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=on(e,Object.assign({maxTabindex:o},n));return!!fe(r)&&(r[r.length-1].focus(),!0)},t.formatLatitude=Gn,t.formatLongitude=Hn,t.fromDateISOString=ao,t.fromScrollEndEvent=gn,t.fromUnixMsTimestamp=so,t.fromUnixTimestamp=function(t){return oo(t,"X")},t.getCaretPosition=Ke,t.getColorContrast=Pi,t.getColorShade=function(t){return Ri("#000000",t,12)},t.getColorTint=function(t){return Ri("#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=on,t.getFormErrors=$o,t.getFormValueFromEntity=Vo,t.getProperty=Le,t.getPropertyByPath=Fe,t.getPropertyByPathAsString=je,t.getRandomImage=wc,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=Ti,t.isAndroid=Tn,t.isBlankString=ve,t.isControlHasInput=sr,t.isCordova=An,t.isEmptyArray=ge,t.isIOS=Sn,t.isInputElement=Ze,t.isInstanceOf=oa,t.isInt=De,t.isMobile=Rn,t.isNil=ue,t.isNilOrBlank=de,t.isNilOrNaN=function(t){return null==t||"number"==typeof t&&isNaN(t)},t.isNotEmptyArray=fe,t.isNotNil=pe,t.isNotNilBoolean=be,t.isNotNilOrBlank=he,t.isNotNilOrNaN=me,t.isNotNilString=ye,t.isNumber=function(t){return pe(t)&&Ne.test(t)},t.isNumberRange=function(t){return pe(t)&&Me.test(t)},t.isProgressEvent=Ml,t.isResponseEvent=Fl,t.isTouchUi=On,t.isWindows=xn,t.joinProperties=function(t,e,n){if(!t)throw new Error("Could not display an undefined entity.");return e.map((function(e){return Le(t,e)})).filter(he).join(n||" - ")},t.joinPropertiesPath=Ae,t.logFormErrors=Uo,t.markAllAsTouched=Yo,t.markAsUntouched=tr,t.markControlAsTouched=Jo,t.markFormGroupAsTouched=Xo,t.matchMedia=wn,t.matchUpperCase=xe,t.mergeLoadResult=function(t,e){var n,o,r;return{data:(n=t.data||[]).concat.apply(n,le(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=Ri,t.moment=eu,t.moveInputCaretToSeparator=Qe,t.noTrailingSlash=Oe,t.notNilOrDefault=function(t,e){return null!=t?t:e},t.nullIfUndefined=Ce,t.parseLatitudeOrLongitude=Qn,t.propertiesPathComparator=Re,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=Fe(e,t),r=Fe(n,t);return o===r?0:o>r?1:-1}},t.referentialToString=hs,t.referentialsToString=function(t,e,n){return(t||[]).map((function(t){return hs(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(pe)},t.removeDiacritics=Se,t.removeDuplicatesFromArray=function(t,e){return ge(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=cr,t.resizeArray=Wo,t.rgbArrayToHex=Si,t.rgbToHex=function(t,e,n){return"#"+Ai(t)+Ai(e)+Ai(n)},t.round=Ve,t.scrollFactory=Ql,t.selectInputContent=ze,t.selectInputRange=We,t.setCalculatedValue=lr,t.setTabIndex=Je,t.sleep=Be,t.slideInOutAnimation=vn,t.slideUpDownAnimation=Cn,t.sort=function(t,e,n){if(ge(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=Ue,t.splitByProperty=function(t,e){return(t||[]).reduce((function(t,n){var o,r=null===(o=n)||void 0===o?void 0:o[e];return pe(r)&&(t[r]=n),t}),{})},t.startsWithUpperCase=Ie,t.suggestFromArray=Te,t.suggestFromStringArray=function(t,e,n){return de(e="string"==typeof e&&"*"!==e&&e.toUpperCase()||void 0)?t:-1!==e.indexOf("*")?(e=e.replace("*",".*"),t.filter((function(t){return xe(t,e)}))):t.filter((function(t){return Ie(t,e)}))},t.tabindexComparator=en,t.testUserAgent=In,t.toBoolean=Ee,t.toDateISOString=io,t.toDuration=lo,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=we,t.trimEmptyToNull=function(t){var e=t&&t.trim()||void 0;return e&&e.length&&e||null},t.tz=nu,t.uncapitalizeFirstLetter=function(t){return t&&0!==t.length?t.substr(0,1).toLowerCase()+t.substr(1):t},t.updateValueAndValidity=Zo,t.waitFor=dn,t.waitForTrue=pn,t.waitIdle=nr,t.waitWhilePending=er,t.ɵ0=kn,t.ɵa=Zl,t.ɵb=ii,t.ɵc=He,t.ɵd=Nc,t.ɵe=Sc,t.ɵf=fc,t.ɵg=kc,t.ɵh=Fc,t.ɵi=Zc,t.ɵj=Jc,t.ɵk=xd,t.ɵl=wd,t.ɵm=Ed,t.ɵn=Ad,t.ɵo=Sd,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=$t,ro=function(){function t(){}return t.min=function(t,e){return!t||e&&!t.isSameOrBefore(e)?e:t},t.max=function(t,e){return!t||e&&!t.isSameOrAfter(e)?e:t},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.resetTime=function(t,e,n){if(t){var o=ao(t);return e?o.clone().tz(e,n).startOf("day"):o.clone().startOf("day")}},t.isAtDay=function(t,e,n){return(t=t&&ao(t))?(n&&(t=t.clone().tz(n).startOf("day")),t.day()===e):null},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||j.isMoment(t))return t;var e=oo(t,Xt);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){return oo(t,"x")}function lo(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}}ro.toDateISOString=io,ro.fromDateISOString=ao,ro.toDuration=lo;var co=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=lo(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}();co.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new co(e.ɵɵinject(F.TranslateService))},token:co,providedIn:"root"}),co.decorators=[{type:e.Pipe,args:[{name:"duration"}]},{type:e.Injectable,args:[{providedIn:"root"}]}],co.ctorParameters=function(){return[{type:F.TranslateService}]};var uo=function(){function t(){}return t.prototype.transform=function(t){return null!=t?Math.abs(t):t},t}();uo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new uo},token:uo,providedIn:"root"}),uo.decorators=[{type:e.Pipe,args:[{name:"mathAbs"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var po=function(){function t(){}return t.prototype.transform=function(t){return t%2==0},t}();po.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new po},token:po,providedIn:"root"}),po.decorators=[{type:e.Pipe,args:[{name:"even"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var ho=function(){function t(){}return t.prototype.transform=function(t){return t%2!=0},t}();ho.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ho},token:ho,providedIn:"root"}),ho.decorators=[{type:e.Pipe,args:[{name:"odd"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var mo=function(){function t(){}return t.prototype.transform=function(t){return null!=t&&t.length>0},t}();mo.decorators=[{type:e.Pipe,args:[{name:"isNotEmptyArray"}]}];var fo=function(){function t(){}return t.prototype.transform=function(t){return null==t||0===t.length},t}();fo.decorators=[{type:e.Pipe,args:[{name:"isEmptyArray"}]}];var go=function(){function t(){}return t.prototype.transform=function(t,e){e=e||{};var n=null==t?0:t.length;return pe(e.lessThan)?n<e.lessThan:pe(e.greaterThan)?n>e.greaterThan:!!pe(e.equals)&&n===e.equals},t}();go.decorators=[{type:e.Pipe,args:[{name:"isArrayLength"}]}];var bo=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length>0?t[0]:void 0},t}();bo.decorators=[{type:e.Pipe,args:[{name:"arrayFirst"}]}];var yo=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(pe)},t}();yo.decorators=[{type:e.Pipe,args:[{name:"arrayPluck"}]}];var vo=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.includes(e)||!1},t}();vo.decorators=[{type:e.Pipe,args:[{name:"arrayIncludes"}]}];var Co=function(){function t(){}return t.prototype.transform=function(t,e){return t&&t.filter(e)},t}();Co.decorators=[{type:e.Pipe,args:[{name:"arrayFilter"}]}];var Eo=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}();Eo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Eo},token:Eo,providedIn:"root"}),Eo.decorators=[{type:e.Pipe,args:[{name:"mapGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var wo=function(){function t(){}return t.prototype.transform=function(t){return t?Object.keys(t):null},t}();wo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wo},token:wo,providedIn:"root"}),wo.decorators=[{type:e.Pipe,args:[{name:"mapKeys"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Io=function(){function t(){}return t.prototype.transform=function(t){return t?Object.values(t):null},t}();Io.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Io},token:Io,providedIn:"root"}),Io.decorators=[{type:e.Pipe,args:[{name:"mapValues"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var xo=function(){function t(){}return t.prototype.transform=function(t){return he(t)},t}();xo.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new xo},token:xo,providedIn:"root"}),xo.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 de(t)},t}();Oo.ɵprov=e.ɵɵ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=e.ɵɵ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 ko=function(){function t(){}return t.prototype.transform=function(t){return t&&t.length||0},t}();ko.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ko},token:ko,providedIn:"root"}),ko.decorators=[{type:e.Pipe,args:[{name:"strLength"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var So=function(){function t(){}return t.prototype.transform=function(t,e,n){return(null==t?void 0:t.includes(e,n))||!1},t}();So.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new So},token:So,providedIn:"root"}),So.decorators=[{type:e.Pipe,args:[{name:"strIncludes"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var To=function(){function t(t){this.translate=t}return t.prototype.get=function(t,e,n){var o=this;if(!t||!ue(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||de(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(he).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=ae(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}();To.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new To(e.ɵɵinject(F.TranslateService))},token:To,providedIn:"root"}),To.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],To.ctorParameters=function(){return[{type:F.TranslateService}]};var Ao=function(){function t(t){this.translate=t}return t.prototype.transform=function(t,e,n){return t&&t.length?this.translate.instant(t,e,n):t},t}();Ao.decorators=[{type:e.Injectable},{type:e.Pipe,args:[{name:"translateContext"}]}],Ao.ctorParameters=function(){return[{type:To}]};var Ro=function(){function t(){}return t.prototype.transform=function(t){var e;return null===(e=ke(t))||void 0===e?void 0:e.toUpperCase()},t}();Ro.decorators=[{type:e.Pipe,args:[{name:"translatable"}]},{type:e.Injectable}];var Po=function(){function t(){}return t.prototype.transform=function(t,e){return Fe(t,e&&("string"==typeof e?e:e.key),e&&e.defaultValue)},t}();Po.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Po},token:Po,providedIn:"root"}),Po.decorators=[{type:e.Pipe,args:[{name:"propertyGet"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Do=function(){function t(){this.ngInit=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.ngInit.emit()},t}();Do.decorators=[{type:e.Directive,args:[{selector:"[ngInit]"}]}],Do.propDecorators={ngInit:[{type:e.Output}]};var No=$t,Mo=function(){function t(){}return t.getDoubleRegexp=function(t){if(ue(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.latitude=function(t){var e=t.value;return pe(e)&&(e<-90||e>90)?{latitude:!0}:null},t.longitude=function(t){var e=t.value;return pe(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 he(t.value)?{empty:!0}:null},t.pubkey=function(t){var e=t.value;return!e||"string"==typeof e&&Zt.test(e)?null:{pubkey:!0}},t.integer=function(t){if(de(t.value))return null;var e=parseFloat(t.value);return isNaN(e)||(0|e)!==e?{integer:!0}:null},t.decimal=function(t){var e=this.getDoubleRegexp(null==t?void 0:t.maxDecimals);return function(n){var o=n.value;return Number.isNaN(o)?null:pe(o)&&""!==o&&!e.test(o)?pe(null==t?void 0:t.maxDecimals)?{maxDecimals:{maxDecimals:t.maxDecimals}}:{decimal:!0}:null}},t.validDate=function(t){var e=t.value,n=!e||No.isMoment(e)?e:No(e,Xt);return n&&(!n.isValid()||n.year()<1970)?{validDate:!0}:null},t.dateIsAfter=function(t,e,n){return function(o){var r=ao(o.value);return pe(r)&&pe(t)&&r.isSameOrBefore(t,n)?{dateIsAfter:{minDate:e}}:null}},t.dateIsBefore=function(t,e,n){return function(o){var r=ao(o.value);return pe(r)&&pe(t)&&r.isSameOrAfter(t,n)?{dateIsBefore:{maxDate: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 pe(l)&&pe(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 pe(l)&&pe(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||ge(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}();Mo._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})?$/}},Mo.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",dateIsBefore:"ERROR.FIELD_NOT_VALID_DATE_BEFORE",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",double:"ERROR.FIELD_NOT_VALID_DOUBLE",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"},Mo.double=Mo.decimal;var Fo=function(){function t(){}return t.dateRange=function(t,e,n){var o=he(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 pe(i)&&pe(s)&&i.isAfter(s)?(a.markAsPending(),a.setErrors(Object.assign(Object.assign({},a.errors),r)),r):(Mo.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 pe(a)&&pe(l)&&Math.abs(a.diff(l,o))>n?(s.markAsTouched({onlySelf:!0}),s.markAsPending(),s.setErrors(Object.assign(Object.assign({},s.errors),r)),r):(Mo.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(pe(a)&&pe(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 Mo.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(de(o.value)&&he(r.value)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Mo.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(de(o.value)&&Ee(r.value,!1)){var i={required:!0};return o.setErrors(i),o.markAsTouched({onlySelf:!0}),i}return Mo.clearError(o,"required"),null}},t.requiredIfEmpty=function(t,e){return function(n){var o=n.get(t);if(de(o.value)&&de(n.get(e).value)){var r={required:!0};return o.setErrors(r),o.markAsTouched({onlySelf:!0}),r}return Mo.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(pe).map((function(t){return t(e)})).find(pe)||null}},t}(),Lo=function(){function t(){}return t.uniqueEntity=function(t){return function(e){var n,o,r=[];if(e.length){try{for(var i=ae(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 Mo.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=ae(n.controls),s=a.next();!s.done;s=a.next()){var l=s.value;l.controls[t]&&me(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 Mo.clearError(t,"sumMaxValue")})),null}},t}(),jo=function(){function t(){}return t.debounceTime=function(e,n){var o=(null==n?void 0:n.debug)||!1,r=o&&"[debounceTime-validator] #"+t.DEBOUNCE_TIME_VALIDATOR_ID+++" - ",i=we(null==n?void 0:n.debounceTime,250);o&&console.debug(r+"New validator with a debounceTime at "+i+"ms");var a=new D.Subject,s=(null==n?void 0:n.dispose)?D.merge(a,null==n?void 0:n.dispose):a;return o&&(null==n?void 0:n.dispose)&&(null==n||n.dispose.pipe(N.first()).subscribe((function(){console.debug(r+"Stopping")}))),function(t){var l;return o&&console.debug(r+"Form ask validation..."),a.next(),D.timer(i).pipe(N.tap((function(t){o&&(console.debug(r+"Executing..."),l=Date.now())})),N.switchMap((function(n){var o=e(t);return D.isObservable(o)?o:o instanceof Promise?D.from(o):D.of(o)})),N.tap((function(t){return o&&console.debug(r+"Finished in "+(Date.now()-l)+"ms ("+(t?"with errors":"no error")+")",t)})),N.catchError((function(t){throw console.error("[debounceTime-validator] Error while executing validator. Stopping job",t),a.next(),t})),N.tap((function(){return(null==n?void 0:n.markForCheck)&&(null==n?void 0:n.markForCheck())})),N.takeUntil(s))}},t.registerAsyncValidator=function(e,n,o){if(e.asyncValidator)throw Error("Form already have an async validator. Cannot configure job");var r=we(null==o?void 0:o.debounceTime,250),i=new D.Subject,a=t.debounceTime(n,Object.assign(Object.assign({},o),{debounceTime:r,dispose:i}));e.setAsyncValidators(a);var s=new D.Subscription;return s.add((function(){e.clearAsyncValidators(),setTimeout((function(){i.next(),i.unsubscribe()}),r)})),s},t}();function Bo(t,e,n){var o=Vo(t,e);e.patchValue(o,n)}function Vo(t,e){return qo(t,e)}function qo(t,e,n){var o=n?n+".":"";if(e instanceof P.FormGroup){var r={};for(var i in e.controls)r[i]=qo(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 fe(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 qo(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 j.isMoment(t)?io(t):Ce(t)}function Uo(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 Uo(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){Uo(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=Go(t,e);o&&o.disable(n)}))}function zo(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&&(ue(i.emitEvent)||i.emitEvent)&&(o(r)||t.markAsDirty()),a}function Wo(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?Bo({},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 dn((function(){return!0!==t.pending}),e)}function nr(t,e){return dn((function(){return!0!==t.loading}),e)}jo.DEBOUNCE_TIME_VALIDATOR_ID=0;var or=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}(),rr=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 dn((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}();rr.NULL_FORM=new or;var ir=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(Ee(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 zo(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 Wo(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(Lo.requiredArrayMinLength(1))))},t}(),ar=function(){function t(){}return t.isForm=function(t){return t instanceof rr||"dirty"in t&&"enabled"in t&&"valid"in t},t}();function sr(t,e){return t[e].value&&!Ee(t[e+ar.calculatedSuffix].value,!1)}function lr(t,e,n){t[e].setValue(Ve(n)),t[e+ar.calculatedSuffix].setValue(!0)}function cr(t,e){sr(t,e)||ar.setCalculatedValue(t,e,void 0)}ar.copyEntity2Form=Bo,ar.getFormValueFromEntity=Vo,ar.logFormErrors=Uo,ar.getControlFromPath=Go,ar.filterNumberInput=Ye,ar.disableControls=Ho,ar.selectInputContent=ze,ar.markAsTouched=Yo,ar.markAllAsTouched=Yo,ar.markAsUntouched=tr,ar.waitWhilePending=er,ar.waitIdle=nr,ar.updateValueAndValidity=Zo,ar.getFormErrors=$o,ar.addValueInArray=zo,ar.removeValueInArray=Ko,ar.resizeArray=Wo,ar.clearValueInArray=Qo,ar.calculatedSuffix="Calculated",ar.isControlHasInput=sr,ar.setCalculatedValue=lr,ar.resetCalculatedValue=cr;var ur=new e.InjectionToken("appFormErrorKeys"),dr=function(){function t(t,e){this.translate=t,this.errorI18nKeys=Object.assign(Object.assign({},Mo.I18N_ERROR_KEYS),e)}return t.prototype.translateFormErrors=function(t,e){var n=this;if(!t||!t.invalid)return"";var o=e&&e.separator||", ",r=!e||!1!==e.recursive,i=ar.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 ge(c)?r:(r.length&&(r+=o),r+l+": "+c.join(o))}var u=n.translateError(a,i[a]);return ue(u)?r:r+(r.length?o:"")+u}),"")},t.prototype.translateErrors=function(t,e){var n=this,o=e&&e.separator||", ";return t&&Object.keys(t).reduce((function(r,i){var a=t[i];if(a){var s=n.translateControlPath(i,e),l=Object.keys(a).map((function(t){return n.translateError(t,a[t])}));return ge(l)?r:(r.length&&(r+=o),r+s+": "+l.join(o))}var c=n.translateError(i,a);return ue(c)?r:r+(r.length?o:"")+c}),"")},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||"")+ke(t).toUpperCase();return this.translate.instant(n)},t.prototype.translateError=function(t,e){var n=this.errorI18nKeys[t]||"ERROR.FIELD_"+ke(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}();dr.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new dr(e.ɵɵinject(F.TranslateService),e.ɵɵinject(ur,8))},token:dr,providedIn:"root"}),dr.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],dr.ctorParameters=function(){return[{type:F.TranslateService},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[ur]}]}]};var pr=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&&$e(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.translateFormErrors(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}();pr.decorators=[{type:e.Pipe,args:[{name:"translateFormError",pure:!1}]}],pr.ctorParameters=function(){return[{type:dr},{type:e.ChangeDetectorRef}]};var hr=function(){function t(){}return t.prototype.transform=function(t,e){return t.get(e)},t}();hr.decorators=[{type:e.Pipe,args:[{name:"formGet"}]}];var mr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();mr.decorators=[{type:e.Pipe,args:[{name:"formGetControl"}]}];var fr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();fr.decorators=[{type:e.Pipe,args:[{name:"formGetArray"}]}];var gr=function(){function t(){}return t.prototype.transform=function(t,e){return t&&e&&t.get(e)||t},t}();gr.decorators=[{type:e.Pipe,args:[{name:"formGetGroup"}]}];var br=function(){function t(t,e){this.adapter=t,this._ref=e,this.value=void 0,this._lastControl=null}return t.prototype.transform=function(t,e){var n=this;if(t){if(t===this._lastControl&&$e(e,this._lastPath))return this.value;this._lastControl=t,this._lastPath=e;var o=e?t.get(e):t;return this.value=null==o?void 0:o.value,this._dispose(),!this._onControlValueChanges&&o&&(this._onControlValueChanges=o.valueChanges.subscribe((function(t){n.value=t,n._ref.markForCheck()}))),this.value}this._dispose()},t.prototype.ngOnDestroy=function(){this._dispose()},t.prototype._dispose=function(){void 0!==this._onControlValueChanges&&(this._onControlValueChanges.unsubscribe(),this._onControlValueChanges=void 0)},t}();br.decorators=[{type:e.Pipe,args:[{name:"formGetValue",pure:!1}]}],br.ctorParameters=function(){return[{type:dr},{type:e.ChangeDetectorRef}]};var yr=function(){};yr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule],declarations:[Po,Fn,jn,co,Bn,Zn,Xn,Jn,eo,to,no,uo,ho,po,mo,fo,go,bo,yo,vo,Co,Eo,wo,Io,Oo,xo,_o,ko,So,Ao,Ro,Do,pr,hr,mr,fr,gr,br],exports:[Po,Fn,Bn,jn,co,Zn,Xn,Jn,eo,to,no,uo,ho,po,mo,fo,go,bo,yo,Eo,wo,Io,Oo,xo,_o,ko,So,vo,Co,Ao,Ro,Do,pr,hr,mr,fr,gr,br]}]}];var vr=function(){function t(t,e,n){this.keyboard=n,this._timer=null,this._elementRef=e,this.shouldFocusElement="",this._timer=null,this.timerDelay=100,this._mobile=Rn(window)}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._mobile&&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}();vr.decorators=[{type:e.Directive,args:[{selector:"[autofocus], input[appAutofocus]",inputs:["shouldFocusElement: appAutofocus","timerDelay: autofocusDelay"]}]}],vr.ctorParameters=function(){return[{type:L.Platform},{type:e.ElementRef},{type:V.Keyboard,decorators:[{type:e.Optional}]}]};var Cr=function(){function t(t,e){this.templateRef=t,this.vcRef=e,this.context={$implicit:null,ngVar:null},this.hasView=!1}return Object.defineProperty(t.prototype,"ngVar",{set:function(t){this.context.$implicit=this.context.ngVar=t,this.hasView||(this.vcRef.createEmbeddedView(this.templateRef,this.context),this.hasView=!0)},enumerable:!1,configurable:!0}),t}();Cr.decorators=[{type:e.Directive,args:[{selector:"[ngVar]"}]}],Cr.ctorParameters=function(){return[{type:e.TemplateRef},{type:e.ViewContainerRef}]},Cr.propDecorators={ngVar:[{type:e.Input}]};var Er=function(){function t(){this.fileDropped=new e.EventEmitter}return t.prototype.onDragOver=function(t){t.preventDefault(),t.stopPropagation(),this.fileOver=!0},t.prototype.onDragLeave=function(t){t.preventDefault(),t.stopPropagation(),this.fileOver=!1},t.prototype.ondrop=function(t){var e;t.preventDefault(),t.stopPropagation(),this.fileOver=!1;var n=null===(e=t.dataTransfer)||void 0===e?void 0:e.files;fe(n)&&this.fileDropped.emit(n)},t}();Er.decorators=[{type:e.Directive,args:[{selector:"[appDragAndDrop]"}]}],Er.propDecorators={fileOver:[{type:e.HostBinding,args:["class.fileover"]}],fileDropped:[{type:e.Output}],onDragOver:[{type:e.HostListener,args:["dragover",["$event"]]}],onDragLeave:[{type:e.HostListener,args:["dragleave",["$event"]]}],ondrop:[{type:e.HostListener,args:["drop",["$event"]]}]};var wr=function(){};wr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule],declarations:[vr,Cr,Er],exports:[vr,Cr,Er]}]}];var Ir=function(){};Ir.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,a.ScrollingModule,P.ReactiveFormsModule,yr,wr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,F.TranslateModule.forChild()],exports:[R.MatAutocompleteModule,Mn],declarations:[Mn]}]}];function xr(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 Or(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 _r={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/,"°"]}},kr=function(){},Sr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=kr,this._onTouchedCallback=kr,this._subscription=new D.Subscription,this.disabling=!1,this.writing=!1,this._readonly=!1,this.required=!1,this.floatLabel="auto",this.maxDecimals=3,this.placeholderChar=Jt,this.onBlur=new e.EventEmitter,this.onFocus=new e.EventEmitter}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=_r[this.type]&&_r[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=_r[this.type][this.pattern]),"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):ue(this.maxDecimals)?this.maxDecimals=2:this.maxDecimals<0?(console.error("Invalid attribute 'maxDecimals'. Must a positive value."),this.maxDecimals=2):2!==this.maxDecimals&&(console.warn("Invalid attribute 'maxDecimals' - Expected value: 2 but get: "+this.maxDecimals+". Other value not implemented."),this.maxDecimals=2),this.showSignControl="DD"!==this.pattern,this._formatFn="latitude"===this.type?Gn:Hn,this._formatOptions={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?Mo.latitude:Mo.longitude]):this.formControl.setValidators("latitude"===this.type?Mo.latitude:Mo.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._formatOptions),{placeholderChar:this.placeholderChar})),n=pe(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._format=function(t,e){return this._formatFn(t,Object.assign(Object.assign({},this._formatOptions),{hideSign:!1,placeholderChar:""}))},t.prototype._onFocus=function(t){var e=this;if(ue(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._formatOptions),{placeholderChar:this.placeholderChar}));o=o&&o.replace("1",this.placeholderChar),setTimeout((function(){e.inputElement.nativeElement.value=o;var n="latitude"===e.type?2:1;We(t.target,n)}),250)}else this.signFormControl.setValue(n)}}else ze(t);return this.onFocus.emit(t),!0},t.prototype._onBlur=function(t){this.checkIfTouched()&&ue(this.value)&&(this.inputElement.nativeElement.value=""),this.onBlur.emit(t)},t.prototype.moveCaretToSeparator=function(t,e){return Qe(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)Qe(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=Ke(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,We(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.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=he(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=pe(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.markForCheck=function(){this.cd.markForCheck()},t}();Sr.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>{{_format(value) }}</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 matSuffix *ngIf="!showSignControl">\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n <div class="mat-form-field-subscript mat-form-field-subscript-wrapper">\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'latitude\'" translate>ERROR.FIELD_NOT_VALID_LATITUDE</mat-error>\n <mat-error *ngSwitchCase="\'longitude\'" translate>ERROR.FIELD_NOT_VALID_LONGITUDE</mat-error>\n <mat-error *ngSwitchCase="\'min\'">{{\'ERROR.FIELD_MIN_COMPACT\'|translate: {min: _format(formControl.errors.min.min) } }}</mat-error>\n <mat-error *ngSwitchCase="\'max\'">{{\'ERROR.FIELD_MAX_COMPACT\'|translate: {max: _format(formControl.errors.max.max) } }}</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 </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 <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 Sr}))}],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:40px;max-width:55px}mat-form-field{width:100%}mat-form-field .mat-form-field-subscript-wrapper{overflow:visible;white-space:nowrap;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%}"]}]}],Sr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Sr.propDecorators={formControl:[{type:e.Input}],formControlName:[{type:e.Input}],type:[{type:e.Input}],pattern:[{type:e.Input,args:["latLongPattern"]}],required:[{type:e.Input}],floatLabel:[{type:e.Input}],placeholder:[{type:e.Input}],tabindex:[{type:e.Input}],defaultSign:[{type:e.Input}],maxDecimals:[{type:e.Input}],placeholderChar:[{type:e.Input}],readonly:[{type:e.Input}],onBlur:[{type:e.Output}],onFocus:[{type:e.Output}],inputElement:[{type:e.ViewChild,args:["inputElement"]}]};var Tr=function(){};Tr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,q.TextMaskModule,F.TranslateModule.forChild(),v.MatSelectModule],exports:[Sr],declarations:[Sr]}]}];var Ar={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Dr})),multi:!0},Rr=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],Pr=function(){},Dr=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=Pr,this._onTouchedCallback=Pr,this._subscription=new D.Subscription,this._writing=!0,this._disabling=!1,this._readonly=!1,this.mask=Rr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=Jt,this.autofocus=!1,this.startDate=null,this.clearable=!1,this.timezone=null,this.locale=(e.currentLang||e.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.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-field>.");this.mobile=pe(this.mobile)?this.mobile:Rn(window),this._keyboardHideDelay=this.mobile?te:0,this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Mo.validDate]:[this.formControl.validator,Mo.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Mo.validDate]:Mo.validDate),this.textControl=this.formBuilder.control(null,(function(){return t.formControl.errors})),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.textControl.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(){t.textControl.updateValueAndValidity({emitEvent:!1}),t.formControl.touched&&!t.textControl.touched&&t.textControl.markAsTouched(),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=j.isMoment(t)?t.clone():ao(t);if(e&&e.isValid()){e=(this.timezone&&e.tz(this.timezone)||e).startOf("day");var n=this.dateAdapter.format(e,this.datePattern);this.textControl.value!==n&&this.textControl.patchValue(n,{emitEvent:!1})}else this.textControl.patchValue(null,{emitEvent:!1}),this.formControl.value&&(this.formControl.patchValue(null,{emitEvent:!1}),this._onChangeCallback(null));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.textControl.disable({emitEvent:!1}):this.textControl.enable({emitEvent:!1}),this._disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||j.isMoment(t.value))){var e=null;if(t.value){var n=t.value.locale(this.locale).minute(0).seconds(0).millisecond(0).utc(!0);e=this.dateAdapter.format(n,this.datePattern)||null}this.textControl.value!==e&&this.textControl.setValue(e,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.openDatePickerIfMobile=function(t,e){return re(this,void 0,void 0,(function(){return ie(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];He(e)&&e.focus()}))},t.prototype.clear=function(){this.textControl.patchValue(null,{emitEvent:!1}),this.formControl.setValue(null,{emitEvent:!1}),this._onChangeCallback(null),this.markAsTouched(),this.markAsDirty()},t.prototype.updatePattern=function(t){t="COMMON.DATE_PATTERN"!==t?t:"L",this.datePattern!==t&&(this.datePattern=t,this.markForCheck())},t.prototype.checkIfTouched=function(t){this.textControl.touched&&(this._onTouchedCallback(),t&&!1===t.emitEvent||this.markForCheck())},t.prototype.onFormChange=function(t){if(!this._writing){if(this._writing=!0,t){for(;-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");t=t.replace("//","/0/").replace(/\/$/,"/0")}var e=he(t)&&this.dateAdapter.parse(t,this.datePattern)||null,n=(e=(e=e&&(this.timezone?e.tz(this.timezone,!0):e)||null)&&e.startOf("day").utc()||null)&&e.isValid()?io(e):t||null;this.formControl.value!==n&&(this._onChangeCallback(n),this.checkIfTouched()),this.textControl.updateValueAndValidity(),this._writing=!1}},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this._keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(t){this.textControl.markAsTouched(t),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Dr.decorators=[{type:e.Component,args:[{selector:"mat-date-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: datePattern} }}</ion-text>\n</mat-form-field>\n\n\x3c!-- writable --\x3e\n<ng-template #writable>\n <mat-form-field [floatLabel]="floatLabel">\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]="textControl"\n [textMask]="{mask: mask, 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]="textControl"\n (click)="openDatePickerIfMobile($event, datePicker)"\n [required]="required"\n [tabindex]="tabindex"\n readonly>\n\n \x3c!-- Hide the final input --\x3e\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n [matDatepickerFilter]="datePickerFilter"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix\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)="clear()"\n [hidden]="formControl.disabled || !formControl.value">\n <mat-icon>close</mat-icon>\n </button>\n\n \x3c!-- errors --\x3e\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE</mat-error>\n <mat-error *ngSwitchCase="\'dateIsAfter\'">{{\'ERROR.FIELD_NOT_VALID_DATE_AFTER\' | translate: formControl.errors.dateIsAfter }}</mat-error>\n <mat-error *ngSwitchCase="\'dateIsBefore\'">{{\'ERROR.FIELD_NOT_VALID_DATE_BEFORE\' | translate: formControl.errors.dateIsBefore }}</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 </mat-form-field>\n\n <mat-datepicker #datePicker\n [touchUi]="mobile"\n [disabled]="formControl.disabled"\n [startAt]="startDate"\n ></mat-datepicker>\n\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:[Ar],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:B.MomentDateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Dr.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}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],timezone:[{type:e.Input}],datePickerFilter:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Nr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Br})),multi:!0},Mr=[/\d/,/\d/,"/",/\d/,/\d/,"/",/\d/,/\d/,/\d/,/\d/],Fr=/^[012][0-9][:][012345][0-9]$/,Lr=[/[012]/,/\d/,":",/[012345]/,/\d/],jr=function(){},Br=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=jr,this._onTouchedCallback=jr,this._subscription=new D.Subscription,this._writing=!0,this._disabling=!1,this._readonly=!1,this.dayMask=Mr,this.hourMask=Lr,this.floatLabel="auto",this.compact=!1,this.placeholderChar=Jt,this.autofocus=!1,this.startDate=null,this.clearable=!1,this.locale=(e.currentLang||e.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.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.mobile=pe(this.mobile)?this.mobile:Rn(window),this._keyboardHideDelay=this.mobile?te:0,this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.formControl.validator&&this.formControl.validator!==P.Validators.required?this.formControl.setValidators(this.required?[this.formControl.validator,P.Validators.required,Mo.validDate]:[this.formControl.validator,Mo.validDate]):this.formControl.setValidators(this.required?[P.Validators.required,Mo.validDate]:Mo.validDate),this.dayControl=this.formBuilder.control(null),this.hourControl=this.formBuilder.control(null,this.mobile?null:P.Validators.pattern(Fr)),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.dayControl.valueChanges,this.hourControl.valueChanges).subscribe((function(e){return t.onFormChange()}))),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.dayControl.patchValue(o,{emitEvent:!1}),this.hourControl.patchValue(a,{emitEvent:!1})}else this.dayControl.patchValue(null,{emitEvent:!1}),this.hourControl.patchValue(null,{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.dayControl.disable({emitEvent:!1}),this.hourControl.disable({emitEvent:!1})):(this.dayControl.enable({emitEvent:!1}),this.hourControl.enable({emitEvent:!1})),this._disabling=!1,this.markForCheck())},t.prototype.onDatePickerChange=function(t){if(t&&(null===t.value||j.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.dayControl.value!==n&&this.dayControl.setValue(n,{emitEvent:!0})}else console.warn("Invalid MatDatepicker event. Skipping",t)},t.prototype.onTimePickerChange=function(t){this.hourControl.value!==t&&this.hourControl.setValue(t,{emitEvent:!0})},t.prototype.openDatePickerIfMobile=function(t,e){return re(this,void 0,void 0,(function(){return ie(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.openTimePickerIfMobile=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return!this.mobile||t.defaultPrevented?[2]:(this.preventEvent(t),[4,this.waitKeyboardHide(!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.focus=function(){var t=this;this.matInputs.length&&setTimeout((function(){var e=t.matInputs[0];He(e)&&e.focus()}))},t.prototype.clear=function(){this.formControl.setValue(null),this.markAsTouched(),this.markAsDirty()},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.checkIfTouched=function(){(this.dayControl.touched||this.hourControl.touched)&&(this._onTouchedCallback(),this.markForCheck())},t.prototype.onFormChange=function(){if(!this._writing){this._writing=!0;var t=this.dayControl.value,e=this.hourControl.value,n=de(e)!==de(t);if(n||this.dayControl.invalid||this.hourControl.invalid)return this.formControl.markAsPending({onlySelf:!0}),this.formControl.setErrors(Object.assign(Object.assign(Object.assign({validDate:n},this.formControl.errors),this.dayControl.errors),this.hourControl.errors)),(this.dayControl.dirty||this.hourControl.dirty)&&this.formControl.markAsDirty(),void(this._writing=!1);for(;t&&-1!==t.indexOf(this.placeholderChar);)t=t.replace(this.placeholderChar,"");var o=t&&this.dateAdapter.parse(t,this.dayPattern)||null,r=(e||"").split(":"),i=parseInt(r[0]||0),a=parseInt(r[1]||0),s=o&&o.locale(this.locale).hour(i).minute(a).seconds(0).millisecond(0).utc();this.emitChange(s),this._writing=!1}},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this._keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.emitChange=function(t){var e=io(t)||null;this.formControl.value!==e&&(this._onChangeCallback(e),this.checkIfTouched())},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markAsTouched=function(t){this.dayControl.markAsTouched(t),this.hourControl.markAsTouched(t),this._onTouchedCallback(),this.markForCheck()},t.prototype.markAsDirty=function(t){this.formControl.markAsDirty(t)},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Br.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]="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 input --\x3e\n <input matInput type="text" [formControl]="formControl"\n hidden\n [matDatepicker]="datePicker"\n [matDatepickerFilter]="datePickerFilter"\n (dateChange)="onDatePickerChange($event)">\n\n <button type="button" mat-icon-button tabindex="-1" matSuffix\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)="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="\'dateIsBefore\'">{{\'ERROR.FIELD_NOT_VALID_DATE_BEFORE\' | translate: formControl.errors.dateIsBefore }}</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 && (hourControl.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]="hourControl"\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]="hourControl"\n (click)="openTimePickerIfMobile($event)"\n readonly>\n\n <input matInput type="text"\n [formControl]="hourControl"\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:[Nr],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%}"]}]}],Br.ctorParameters=function(){return[{type:B.MomentDateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Br.propDecorators={formControl:[{type:e.Input}],formControlName:[{type:e.Input}],placeholder:[{type:e.Input}],floatLabel:[{type:e.Input}],required:[{type:e.Input}],mobile:[{type:e.Input}],compact:[{type:e.Input}],placeholderChar:[{type:e.Input}],autofocus:[{type:e.Input}],startDate:[{type:e.Input}],clearable:[{type:e.Input}],datePickerFilter:[{type:e.Input}],readonly:[{type:e.Input}],tabindex:[{type:e.Input}],datePicker:[{type:e.ViewChild,args:["datePicker"]}],timePicker:[{type:e.ViewChild,args:["timePicker"]}],matInputs:[{type:e.ViewChildren,args:["matInput"]}]};var Vr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return $r})),multi:!0},qr=[/\d/,/\d/,/\d/,/\d/],Ur=function(){},$r=function(){function t(t,e,n,o,r,i){this.dateAdapter=t,this.translate=e,this.formBuilder=n,this.cd=o,this.keyboard=r,this.formGroupDir=i,this._onChangeCallback=Ur,this._onTouchedCallback=Ur,this.writing=!0,this.disabling=!1,this.dayMask=qr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.placeholderChar=Jt,this.clearable=!1,this.locale=(e.currentLang||e.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-short-field>.");this.mobile=pe(this.mobile)?this.mobile:Rn(window),this.keyboardHideDelay=this.mobile?te:0;var e=new D.BehaviorSubject(null);this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.required),this.dayControl=this.formBuilder.control(null,(function(){return e.getValue()})),this.formControl.setValidators(this.required?P.Validators.compose([P.Validators.required,Mo.validDate]):Mo.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(de(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,Xt),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,Xt)||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(Xt).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(),Xt);var n=e&&e.isValid()&&e.format(Xt).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 re(this,void 0,void 0,(function(){return ie(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];He(e)&&e.focus()}))},t.prototype.waitKeyboardHide=function(t){return re(this,void 0,void 0,(function(){return ie(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,Be(this.keyboardHideDelay)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();$r.decorators=[{type:e.Component,args:[{selector:"mat-date-short-field",template:'\x3c!-- readonly --\x3e\n<mat-form-field *ngIf="readonly else writable">\n <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n\n <input matInput hidden type="text" readonly="true" [formControl]="formControl">\n <ion-text>{{formControl.value|dateFormat: {pattern: displayPattern} }}</ion-text>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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\n <ng-container *ngIf="formControl.touched && formControl.errors|mapKeys|arrayFirst; let errorKey" [ngSwitch]="errorKey">\n <mat-error *ngSwitchCase="\'required\'" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngSwitchCase="\'validDate\'" translate>ERROR.FIELD_NOT_VALID_DATE</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 <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[Vr],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%}"]}]}],$r.ctorParameters=function(){return[{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:V.Keyboard,decorators:[{type:e.Optional}]},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},$r.propDecorators={mobile:[{type:e.Input}],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 Gr=function(){};Gr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,$.MatDatepickerModule,B.MatMomentDateModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,F.TranslateModule.forChild(),wr],exports:[g.MatIconModule,Dr,Br,$r],declarations:[Dr,Br,$r]}]}];var Hr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Qr})),multi:!0},zr=/[0-9]\d\d:[0-5]\d/,Wr=[/\d/,/\d/,/\d/,":",/[0-5]/,/\d/],Kr=function(){},Qr=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=Kr,this._onTouchedCallback=Kr,this.writing=!0,this.disabling=!1,this.hourMask=Wr,this.disabled=!1,this.floatLabel="auto",this.readonly=!1,this.compact=!1,this.maxDecimals=2,this.placeholderChar=Jt,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-duration-field>.");this.required=be(this.required)?this.required:this.formControl.validator===P.Validators.required||ve(this.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(zr)]:[function(){return e.getValue()},P.Validators.pattern(zr)]),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(ue(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 "+xr(this._value)),this.textControl.patchValue(xr(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=Or(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];He(e)&&e.focus()}))},t.prototype.moveCaretToSeparator=function(t,e){return Qe(t,":",e)},t.prototype.updateTabIndex=function(){var t=this;ue(this._tabindex)||-1===this._tabindex||setTimeout((function(){t.matInputs.forEach((function(e,n){Je(e,t._tabindex+n)})),t.markForCheck()}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t}();Qr.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:[Hr],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%}"]}]}],Qr.ctorParameters=function(){return[{type:L.Platform},{type:s.DateAdapter},{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Qr.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 Yr=function(){};Yr.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,s.MatRippleModule,B.MatMomentDateModule,F.TranslateModule.forChild()],exports:[Qr],declarations:[Qr]}]}];var Xr={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return Zr})),multi:!0},Jr=function(){},Zr=function(){function t(t,n,o,r){this.translate=t,this.formBuilder=n,this.cd=o,this.formGroupDir=r,this._onChangeCallback=Jr,this._onTouchedCallback=Jr,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=we(this.buttonsColCount,2)),this.showRadio=this.showRadio||"always"===this.floatLabel,this.updateTabIndex()},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||pe(this._value),pe(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(){ue(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}();Zr.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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\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 <div matPrefix>\n <ng-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\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 <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n </mat-form-field>\n </ng-container>\n\n</ng-template>\n\n\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n<ng-template #matSuffixTemplate>\n <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[Xr],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}"]}]}],Zr.ctorParameters=function(){return[{type:F.TranslateService},{type:P.FormBuilder},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Zr.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"]}]};var ti=function(){};ti.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,s.MatCommonModule,d.MatFormFieldModule,p.MatInputModule,k.MatRadioModule,h.MatCheckboxModule,q.TextMaskModule,U.NgxMaterialTimepickerModule,F.TranslateModule.forChild()],exports:[Zr],declarations:[Zr]}]}];var ei,ni=[[{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"}]],oi=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.inputTarget=n&&n.target,o}return ne(e,t),e}(KeyboardEvent);(ei=t.AnimationState||(t.AnimationState={})).ENTER="enter",ei.ENTER_INPUT="enter-input",ei.LEAVE="leave";var ri=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 oi("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}();ri.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:[M.trigger("numpadBackdrop",[M.state("*",M.style({opacity:0,background:"transparent"})),M.state(t.AnimationState.ENTER,M.style({opacity:1})),M.state(t.AnimationState.LEAVE,M.style({opacity:0})),M.transition("* => "+t.AnimationState.ENTER,[M.style({opacity:0}),M.animate("0.4s cubic-bezier(0.25, 0.8, 0.25, 1)")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.style({opacity:1}),M.animate("0.2s cubic-bezier(0.25, 0.8, 0.25, 1)")])]),M.trigger("numpadFadeIn",[M.state("*",M.style({opacity:1,transform:"scale(1)"})),M.state(t.AnimationState.ENTER,M.style({opacity:1,transform:"scale(1)"})),M.state(t.AnimationState.LEAVE,M.style({opacity:0,transform:"scale(0.9)"})),M.transition("* => "+t.AnimationState.ENTER,[M.style({opacity:0,transform:"scale(0.6)"}),M.animate("0.2s ease-out")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.animate("0.2s ease-out")])]),M.trigger("numpadPanelExpansion",[M.state("*",M.style({opacity:1,transform:"scaleY(0) translateY(-50%)"})),M.state(t.AnimationState.ENTER,M.style({opacity:1,transform:"scale(1) translateY(0)"})),M.state(t.AnimationState.LEAVE,M.style({opacity:0,transform:"scale(1) translateY(0)"})),M.transition("* => "+t.AnimationState.ENTER,[M.animate("0.2s ease-out")]),M.transition(t.AnimationState.ENTER+" => "+t.AnimationState.LEAVE,[M.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)}"]}]}],ri.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},ri.propDecorators={onKeydown:[{type:e.HostListener,args:["window:keydown",["$event"]]}]};var ii=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}();ii.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ii(e.ɵɵinject(e.ComponentFactoryResolver),e.ɵɵinject(e.ApplicationRef),e.ɵɵinject(e.INJECTOR),e.ɵɵinject(n.DOCUMENT,8))},token:ii,providedIn:"root"}),ii.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ii.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 ai=function(){function t(t){this.domService=t,this._opened=!1,this.keymap=ni,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(ri,{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}();ai.decorators=[{type:e.Component,args:[{selector:"mat-numpad",template:""}]}],ai.ctorParameters=function(){return[{type:ii}]},ai.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 si=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}();si.decorators=[{type:e.Directive,args:[{selector:"[matNumpad]",providers:[{provide:P.NG_VALUE_ACCESSOR,useExisting:si,multi:!0}],host:{"[disabled]":"disabled","(click)":"onClick($event)","(change)":"updateValue($event.target.value)","(blur)":"onTouched()"}}]}],si.ctorParameters=function(){return[{type:e.ElementRef}]},si.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 li=function(){};li.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'}]}],li.propDecorators={appendToInput:[{type:e.Input}],inputElement:[{type:e.Input}]};var ci=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}();ci.decorators=[{type:e.Directive,args:[{selector:"[appendNumpadToInput]"}]}],ci.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},ci.propDecorators={inputElement:[{type:e.Input,args:["appendNumpadToInput"]}],changePosition:[{type:e.HostListener,args:["window:scroll"]}]};var ui=function(){};ui.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild()],exports:[ai,si,ri,li,ci],declarations:[ri,ai,li,si,ci]}]}];var di={provide:P.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return pi})),multi:!0},pi=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.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.selectInputContent=ze}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&&Ae(e,t.displayAttributes)},this.equals=this.equals||function(t,e){return t&&e&&t.id===e.id},this.mobile=pe(this.mobile)?this.mobile:Rn(window)},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()})),ue(this._value)&&(this.slideTo(0),this.slideChanged()),this.markForCheck()},t.prototype.updateTabIndex=function(){ue(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.equals(t,this._value)||(this._value=t,this.showSlides=pe(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.equals(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 re(this,void 0,void 0,(function(){var t;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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,ln(this.$loaded.pipe(N.filter((function(t){return!0===t}))))]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}();pi.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:[di],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}"]}]}],pi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},pi.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}],equals:[{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"]}],blurred:[{type:e.Output,args:["blur"]}],focused:[{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 hi=function(){};hi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,b.MatButtonModule,g.MatIconModule,F.TranslateModule.forChild(),d.MatFormFieldModule,P.ReactiveFormsModule,p.MatInputModule],exports:[pi],declarations:[pi]}]}];var mi=function(){},fi=function(){function t(t,n){this.cd=t,this.formGroupDir=n,this._onChangeCallback=mi,this._onTouchedCallback=mi,this.logPrefix="[mat-chips] ",this.formControlName=null,this.required=!1,this.readonly=!1,this.clearable=!1,this.debounceTime=null,this.i18nPrefix="REFERENTIAL.",this.noResultMessage="COMMON.NO_RESULT",this.itemSize="48px",this.fetchMoreThreshold="15%",this.suggestLengthThreshold=null,this.showLoadingSpinner=!0,this.chipColor=null,this.debug=!1,this.clicked=new e.EventEmitter,this.blurred=new e.EventEmitter,this.focused=new e.EventEmitter,this.dropButtonClick=new e.EventEmitter(!0),this.keydownEscape=new e.EventEmitter,this.keyupEnter=new e.EventEmitter,this.$inputItems=new D.BehaviorSubject(void 0),this.$filteredItems=new D.BehaviorSubject(void 0),this.inputControl=new P.FormControl,this._fetchMore$=new e.EventEmitter,this._subscription=new D.Subscription,this._$filter=new D.BehaviorSubject(void 0),this._reload$=new D.Subject}return Object.defineProperty(t.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canFetchMore",{get:function(){return this._onFetchMoreCallback&&this._moreItemsCount>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._$filter.value},set:function(t){t!==this._$filter.value&&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",{get:function(){return this.$inputItems},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.$inputItems.next(t)}))):t!==this.$inputItems.value&&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}),Object.defineProperty(t.prototype,"loading",{get:function(){return ue(this.$filteredItems.value)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t,e,n=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>.");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.equals=this.equals||this.config.equals,this.mobile=Ee(this.mobile,this.config.mobile),this.suggestLengthThreshold=we(this.suggestLengthThreshold,this.config.suggestLengthThreshold||0),this.showAllOnFocus=Ee(this.showAllOnFocus,Ee(this.config.showAllOnFocus,this.suggestLengthThreshold<=0)),this.showPanelOnFocus=Ee(this.showPanelOnFocus,Ee(this.config.showPanelOnFocus,!0)),this.classList=this.classList||this.config.class,this.debounceTime=we(this.debounceTime,this.config.debounceTime),this.highlightAccent=Ee(this.highlightAccent,Ee(this.config.highlightAccent))),this.displayAttributes=this.displayAttributes||(null===(t=this.filter)||void 0===t?void 0:t.attributes)||["label","name"],this.displayWith=this.displayWith||function(t){return t&&Ae(t,n.displayAttributes)},this.displayColumnSizes=this.displayColumnSizes||1===this.displayAttributes.length&&[void 0]||this.displayAttributes.map((function(t){return t&&(t.endsWith("label")?3:t.endsWith("rankOrder")?2:void 0)})),this.displayColumnNames=this.displayAttributes.map((function(t,e){return n.displayColumnNames&&n.displayColumnNames[e]||n.i18nPrefix+ke(t).toUpperCase()})),this.mobile=Ee(this.mobile,!1),this.equals=this.equals||function(t,e){return t&&e&&t.id===e.id};var o=null===(e=this.classList)||void 0===e?void 0:e.split(" ");if(this.panelWidth=this.panelWidth||o&&((o.includes("min-width-medium")?"300px":o.includes("min-width-large")&&"400px")||o.includes("min-width-xlarge")&&"450px"||o.includes("mat-autocomplete-panel-full-size")&&"100vw"),this.showPanelOnFocus=Ee(this.showPanelOnFocus,!0),this.debounceTime=we(this.debounceTime,250),this.highlightAccent=Ee(this.highlightAccent,!1),this.suggestLengthThreshold=this.suggestLengthThreshold||0,this.matAutocompletePosition=this.matAutocompletePosition||(this.mobile?"above":"auto"),!this.suggestFn){var r=function(t,e){return re(n,void 0,void 0,(function(){return ie(this,(function(n){return[2,Te(this.$inputItems.value,t,Object.assign({searchAttributes:this.displayAttributes},e))]}))}))};this.suggestFn=function(t,e){return re(n,void 0,void 0,(function(){return ie(this,(function(n){switch(n.label){case 0:return ue(this.$inputItems.value)?[4,ln(this.$inputItems)]:[3,2];case 1:n.sent(),n.label=2;case 2:return this.suggestFn=r,[2,this.suggestFn(t,e)]}}))}))}}var i=function(t){return de(t)||"*"===t?n.suggestLengthThreshold<=0:!("string"==typeof t)||t.length>=n.suggestLengthThreshold},a=D.merge(this._reload$,this.inputControl.valueChanges.pipe(N.filter((function(t){return n.enabled&&ye(t)})),N.tap((function(t){return n.showLoadingSpinner&&n.markAsLoading()})),N.filter((function(t){return t.length>=n.suggestLengthThreshold})),N.debounceTime(this.debounceTime)),this.inputControl.valueChanges.pipe(N.startWith(this.inputControl.value),N.filter((function(t){return pe(t)&&"object"==typeof t}))),this.dropButtonClick.pipe(N.filter((function(t){return n.enabled&&(!t||!t.defaultPrevented)})),N.tap((function(t){return n.matInputText.nativeElement.focus()})),N.map((function(t){return n.showAllOnFocus?"*":n.formControl.value})),N.filter(i)),D.merge(D.merge(this.focused,this.clicked).pipe(N.filter((function(t){return n.enabled})),N.map((function(t){return n.showAllOnFocus?"*":n.inputControl.value}))),D.merge(this.$inputItems,this._$filter).pipe(N.filter((function(t){return n.enabled})),N.map((function(t){return n.inputControl.value})))).pipe(N.filter(i),N.distinctUntilChanged((function(t,e){return!n.loading&&(t===e||n.equals(t,e))})))).pipe(N.mergeMap((function(t){return n.suggest(t,n.filter)})),N.tap((function(t){return n.updateImplicitValue(t)}))),s=this._fetchMore$.pipe(N.tap((function(t){return null==t?void 0:t.preventDefault()})),N.filter((function(){return n.canFetchMore})),N.mergeMap((function(){return n.fetchMore()})),N.map((function(t){return(n.$filteredItems.value||[]).concat(t)})));this._subscription.add(D.merge(this.$inputItems,a,s).subscribe((function(t){return n.$filteredItems.next(t)}))),this._subscription.add(this.blurred.pipe(N.map((function(t){return n.formControl.value}))).subscribe((function(t){n._implicitValue&&(n.required&&de(t)||he(t)&&"object"!=typeof t)?(n.writeValue(n._implicitValue),n.formControl.markAsPending({emitEvent:!1,onlySelf:!0}),n.formControl.updateValueAndValidity({emitEvent:!1,onlySelf:!0}),n.checkIfTouched(),n.$filteredItems.next([n._implicitValue])):de(t)&&(n.writeValue(null),n.formControl.markAsPending({emitEvent:!1,onlySelf:!0}),n.formControl.updateValueAndValidity({emitEvent:!1,onlySelf:!0}),n.checkIfTouched(),n.$filteredItems.next(void 0)),n._implicitValue=null,n.closePanel()}))),this._subscription.add(this.formControl.statusChanges.pipe(N.distinctUntilChanged()).subscribe((function(){return n.checkIfTouched()}))),this._subscription.add(this.keydownEscape.subscribe((function(t){n.isOpen&&(null==t||t.stopPropagation(),null==t||t.preventDefault(),n.closePanel())})))},t.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._openedSubscription&&this._openedSubscription.unsubscribe(),this.$inputItems.complete(),this.$inputItems.unsubscribe(),this.$filteredItems.complete(),this.$filteredItems.unsubscribe(),this._reload$.complete(),this._$filter.complete(),this.dropButtonClick.complete(),this.clicked.complete(),this.blurred.complete(),this.focused.complete(),this.keydownEscape.complete(),this.keyupEnter.complete(),this._fetchMore$.complete(),this._implicitValue=void 0,this.formControl=null,this.displayWith=null,this.equals=null,this.suggestFn=null,this.$filteredItems=null,this.config=null,this.classList=null,this._onChangeCallback=null,this._onTouchedCallback=null,this._onFetchMoreCallback=null,this.autocomplete&&this.autocomplete.ngOnDestroy()},t.prototype.add=function(t){this.debug&&console.debug(this.logPrefix+"select",t);var e=t.option.value;this.writeValue(le(this.value,[e])),this.matInputText.nativeElement.value="",this.inputControl.setValue("")},t.prototype.remove=function(t){var e=this.value,n=e?e.indexOf(t):-1;if(-1!==n){var o=e.slice();o.splice(n,1),this.writeValue(o),this.closePanel()}},t.prototype.reloadItems=function(t){this._reload$.next(t||"*")},t.prototype.writeValue=function(t){t&&!Array.isArray(t)&&(t=[t]),t!==this.formControl.value?(this.formControl.patchValue(t,{emitEvent:!1}),this._onChangeCallback(t)):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;t&&(null===(e=this.autocomplete)||void 0===e?void 0:e.isOpen)&&this.closePanel(),this.cd.markForCheck()},t.prototype.focus=function(){Xe(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,!1):!!(!ze(t)||this.showPanelOnFocus&&this.showAllOnFocus)&&(this.focused.emit(t),!0)},t.prototype.filterInputTextBlurEvent=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,!1):(We(t.target,0,0),this.blurred.emit(t),!0)},t.prototype.filterChipsFocusEvent=function(t){this.debug&&console.debug(this.logPrefix+" Focus in chips list",t),this.matInputText.nativeElement.focus()},t.prototype.clearValue=function(t){this.writeValue(null),t.stopPropagation()},t.prototype._initAutocompleteInfiniteScroll=function(t){var e=this;if(this.autocomplete){this._openedSubscription&&(this._openedSubscription.unsubscribe(),this._subscription.remove(this._openedSubscription));var n=(this.autocomplete._isOpen?D.timer(0):this.autocomplete.opened.pipe(N.debounceTime(200))).pipe(N.map((function(t){return e.getAutocompletePanel()})),N.filter(pe),N.switchMap((function(n){return gn(n,t).pipe(N.takeUntil(e.autocomplete.closed))})));this._openedSubscription=n.subscribe((function(){return e._fetchMore$.emit()})),this._subscription.add(this._openedSubscription)}},Object.defineProperty(t.prototype,"isOpen",{get:function(){var t;return(null===(t=this.autocomplete)||void 0===t?void 0:t.isOpen)||!1},enumerable:!1,configurable:!0}),t.prototype.closePanel=function(){var t,e;(null===(t=this.autocomplete)||void 0===t?void 0:t.isOpen)&&(null===(e=this.autocompleteTrigger)||void 0===e||e.closePanel())},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l=this;return ie(this,(function(c){switch(c.label){case 0:return[4,this.suggestFn(t,e)];case 1:return(n=c.sent())?Array.isArray(n)?(n=n,this._itemCount=n.length||0):(o=n.data,r=n.total,i=n.fetchMore,this._itemCount=we(r,o&&o.length||0),this._onFetchMoreCallback=i,this._moreItemsCount=i&&this._itemCount-o.length||0,n=o):(this._itemCount=0,n=[]),a=(n||[]).slice().filter((function(t){return-1===l.value.findIndex((function(e){return l.equals(t,e)}))})),s=((null==n?void 0:n.length)||0)-((null==a?void 0:a.length)||0),this._itemCount-=s,this.debug&&console.debug(this.logPrefix+" Filtered items by suggestFn:",t,n),[2,n]}}))}))},t.prototype.fetchMore=function(){return re(this,void 0,void 0,(function(){var t,e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return this._onFetchMoreCallback?(t=this._onFetchMoreCallback,this._onFetchMoreCallback=void 0,[4,t()]):[2,[]];case 1:return e=i.sent(),n=e.data,o=e.total,r=e.fetchMore,this._itemCount=o||this._itemCount,this._onFetchMoreCallback=r,this._moreItemsCount=Math.max(0,this._moreItemsCount-n.length),[2,n]}}))}))},t.prototype.updateImplicitValue=function(t){t&&1===t.length?this._implicitValue=t[0]:this._implicitValue=void 0},t.prototype.checkIfTouched=function(){this.formControl.touched&&(this.cd.markForCheck(),this._onTouchedCallback())},t.prototype.getAutocompletePanel=function(){var t,e,n=null===(e=null===(t=this.autocomplete)||void 0===t?void 0:t.options.last)||void 0===e?void 0:e._getHostElement().parentElement;return n||console.warn(this.logPrefix+" Unable to find the autocomplete div..."),n},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.markAsLoading=function(){this.$filteredItems.value&&(this.$filteredItems.next(void 0),this._itemCount=void 0,this._implicitValue=void 0,this._onFetchMoreCallback=void 0,this._moreItemsCount=0,this.markForCheck())},t}();fi.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-container *ngTemplateOutlet="matPrefixTemplate"></ng-container>\n </div>\n <mat-label>{{placeholder}}</mat-label>\n <mat-chip-list #chipList\n (focus)="filterChipsFocusEvent($event)" >\n <mat-chip\n *ngFor="let item of value"\n [selectable]="false"\n [removable]="!disabled"\n (removed)="remove(item)"\n [color]="chipColor"\n >\n {{displayWith(item)}}\n <mat-icon matChipRemove *ngIf="!disabled">cancel</mat-icon>\n </mat-chip>\n\n <input #matInputText type="text"\n [matAutocomplete]="autocomplete"\n [matAutocompletePosition]="matAutocompletePosition"\n [formControl]="inputControl"\n [appAutofocus]="autofocus"\n [tabindex]="_tabindex"\n [readonly]="disabled"\n [hidden]="disabled"\n [required]="required"\n (click)="clicked.emit($event)"\n (focus)="filterInputTextFocusEvent($event)"\n (blur)="filterInputTextBlurEvent($event)"\n (keydown.escape)="keydownEscape.emit($event)"\n (keyup.enter)="keyupEnter.emit($event)"\n (keyup.arrowdown)="!autocomplete.showPanel && dropButtonClick.emit($event)"\n [matChipInputFor]="chipList"\n >\n </mat-chip-list>\n\n \x3c!-- autocomplete --\x3e\n <mat-autocomplete #autocomplete="matAutocomplete"\n (optionSelected)="add($event)"\n autoActiveFirstOption\n [displayWith]="displayWith"\n [class]="classList"\n [panelWidth]="panelWidth">\n <ion-row class="mat-autocomplete-header ion-no-padding column">\n <ion-col *ngFor="let attr of displayAttributes; index as i" [size]="displayColumnSizes[i]">\n <ion-label [innerHTML]="displayColumnNames[i] | translate"></ion-label>\n </ion-col>\n </ion-row>\n\n <ng-container *ngIf="$filteredItems | async as items; else loadingTemplate">\n \x3c!-- No item option --\x3e\n <mat-option *ngIf="items | isEmptyArray" class="ion-padding text-italic" disabled>\n <ion-label>{{noResultMessage | translate}}</ion-label>\n </mat-option>\n\n <mat-option *ngFor="let item of items" [value]="item" class="ion-no-padding">\n <ion-row [classList]="item.classList">\n <ion-col *ngFor="let path of displayAttributes; index as i;"\n [size]="displayColumnSizes[i]">\n <ion-text [innerHTML]="item | propertyGet: path | highlight: { search: inputControl.value, withAccent: highlightAccent } "></ion-text>\n </ion-col>\n </ion-row>\n </mat-option>\n\n \x3c!-- More item --\x3e\n <mat-option *ngIf="_moreItemsCount" (ngInit)="_initAutocompleteInfiniteScroll()"\n class="ion-padding" disabled>\n <ion-skeleton-text [animated]="true" style="width: 100%"></ion-skeleton-text>\n </mat-option>\n </ng-container>\n\n \x3c!-- footer --\x3e\n <ion-row *ngIf="itemCount as count"\n class="mat-autocomplete-footer ion-no-padding">\n <ion-col>\n <ion-text class="ion-float-end ion-padding-end"><i>{{\'COMMON.RESULT_COUNT\'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n \x3c!-- Loading spinner --\x3e\n <ng-template #loadingTemplate>\n <mat-option *ngIf="(matInputText.value | strLength) >= suggestLengthThreshold; else waitMoreCharacterTemplate"\n class="ion-padding" disabled>\n <ion-skeleton-text [animated]="true" style="width: 100%"></ion-skeleton-text>\n </mat-option>\n </ng-template>\n\n \x3c!-- Need more characters --\x3e\n <ng-template #waitMoreCharacterTemplate>\n <mat-option class="ion-padding text-italic" disabled>\n <ion-label>\n {{\'INFO.PLEASE_TYPE_MORE_CHARACTERS\'|translate:{minLength: suggestLengthThreshold} }}\n </ion-label>\n </mat-option>\n </ng-template>\n </mat-autocomplete>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet="matSuffixTemplate"></ng-container>\n </div>\n\n <mat-error *ngIf="formControl.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <ng-content select="[matError]"></ng-content>\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\n<ng-template #matPrefixTemplate>\n <ng-content select="[matPrefix]"></ng-content>\n</ng-template>\n\n\n<ng-template #matSuffixTemplate>\n <button mat-icon-button tabindex="-1"\n type="button"\n (click)="dropButtonClick.emit($event)"\n [hidden]="disabled">\n <mat-icon class="large select-arrow">arrow_drop_down</mat-icon>\n </button>\n <button 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 <ng-content select="[matSuffix]"></ng-content>\n</ng-template>\n',providers:[{provide:P.NG_VALUE_ACCESSOR,multi:!0,useExisting:e.forwardRef((function(){return fi}))}],encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{width:100%;display:inline-block;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%}.mat-form-field-suffix{position:absolute!important;right:0!important;top:calc(100% - 50px)!important}.mat-chip.mat-standard-chip.mat-primary{background-color:var(--ion-color-primary);color:var(--ion-color-primary-contrast)}.mat-chip.mat-standard-chip.mat-secondary{background-color:var(--ion-color-secondary);color:var(--ion-color-secondary-contrast)}.mat-chip.mat-standard-chip.mat-tertiary{background-color:var(--ion-color-tertiary);color:var(--ion-color-tertiary-contrast)}.mat-chip.mat-standard-chip.mat-accent{background-color:var(--ion-color-accent);color:var(--ion-color-accent-contrast)}.mat-chip.mat-standard-chip.mat-warning{background-color:var(--ion-color-warning);color:var(--ion-color-warning-contrast)}"]}]}],fi.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},fi.propDecorators={equals:[{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}],autofocus:[{type:e.Input}],config:[{type:e.Input}],i18nPrefix:[{type:e.Input}],noResultMessage:[{type:e.Input}],classList:[{type:e.Input,args:["class"]}],panelWidth:[{type:e.Input}],matAutocompletePosition:[{type:e.Input}],itemSize:[{type:e.Input}],fetchMoreThreshold:[{type:e.Input}],suggestLengthThreshold:[{type:e.Input}],showLoadingSpinner:[{type:e.Input}],chipColor:[{type:e.Input}],debug:[{type:e.Input}],clicked:[{type:e.Output,args:["click"]}],blurred:[{type:e.Output,args:["blur"]}],focused:[{type:e.Output,args:["focus"]}],dropButtonClick:[{type:e.Output}],keydownEscape:[{type:e.Output,args:["keydown.escape"]}],keyupEnter:[{type:e.Output,args:["keyup.enter"]}],matInputText:[{type:e.ViewChild,args:["matInputText"]}],autocomplete:[{type:e.ViewChild,args:[R.MatAutocomplete]}],autocompleteTrigger:[{type:e.ViewChild,args:[R.MatAutocompleteTrigger]}],filter:[{type:e.Input}],tabindex:[{type:e.Input}],items:[{type:e.Input}]};var gi=function(){};gi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,yr,wr,s.MatCommonModule,R.MatAutocompleteModule,d.MatFormFieldModule,p.MatInputModule,g.MatIconModule,b.MatButtonModule,v.MatSelectModule,z.MatChipsModule,F.TranslateModule.forChild()],declarations:[fi],exports:[fi]}]}];var bi=function(){function t(t){this.el=t,this._subscription=null,this._$update=new D.Subject}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},set:function(t){this._size!==t&&(this._size=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){this._fill!==t&&(this._fill=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"matIcon",{set:function(t){this._matIcon!==t&&(this._matIcon=t,this.updateView())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ionIcon",{set:function(t){this._ionIcon!==t&&(this._ionIcon=t,this.updateView())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this._size=this._size||"medium",this._color=this._color||"primary","warn"===this._color&&(this._color="warning"),this.updateView(!0),this._subscription=this._$update.pipe(N.debounceTime(100)).subscribe((function(){return t.updateView(!0)}))},t.prototype.ngOnDestroy=function(){var t;null===(t=this._subscription)||void 0===t||t.unsubscribe()},t.prototype.updateView=function(t){if(t){var e=this.el.nativeElement.querySelector(".mat-badge-content");if(e){var n;switch(this._size){case"large":n="24px";break;case"medium":n="22px";break;case"small":n="16px"}var o="";this._matIcon?o='<i class="material-icons" style="font-size: '+n+';">'+this._matIcon+"</i>":this._ionIcon&&(o='<ion-icon style="font-size: '+n+'; pointer-events: none;" name="'+this._ionIcon+'"></ion-icon>'),this._html!==o&&(this._html=o,e.innerHTML=o),"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)"),"inline-block"!==e.style.display&&(e.style.display="inline-block"),"center"!==e.style.alignItems&&(e.style.alignItems="center"),"center"!==e.style.justifyContent&&(e.style.justifyContent="center")}}else this._$update.next()},t}();bi.decorators=[{type:e.Directive,args:[{selector:"[matBadgeIcon], [ionBadgeIcon]",inputs:["size: matBadgeSize","color: matBadgeColor","fill: matBadgeFill"]}]}],bi.ctorParameters=function(){return[{type:e.ElementRef}]},bi.propDecorators={size:[{type:e.Input,args:["matBadgeSize"]}],color:[{type:e.Input,args:["matBadgeColor"]}],fill:[{type:e.Input,args:["matBadgeFill"]}],matIcon:[{type:e.Input,args:["matBadgeIcon"]}],ionIcon:[{type:e.Input,args:["ionBadgeIcon"]}]};var yi=function(){};yi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,S.MatBadgeModule],exports:[bi],declarations:[bi]}]}];var vi=[s.MatCommonModule,l.MatTableModule,c.MatSortModule,u.MatPaginatorModule,d.MatFormFieldModule,p.MatInputModule,o.CdkTableModule,h.MatCheckboxModule,m.MatExpansionModule,f.MatToolbarModule,A.MatDialogModule,g.MatIconModule,b.MatButtonModule,y.MatMenuModule,v.MatSelectModule,C.MatCardModule,E.MatTabsModule,I.MatListModule,w.MatStepperModule,x.MatButtonToggleModule,O.MatProgressSpinnerModule,_.MatProgressBarModule,k.MatRadioModule,S.MatBadgeModule,T.MatSlideToggleModule,r.A11yModule,i.OverlayModule,a.ScrollingModule,s.MatRippleModule,G.MatDividerModule,H.MatTooltipModule,Ir,Tr,Gr,Yr,ti,ui,hi,gi,yi],Ci=function(){};Ci.decorators=[{type:e.NgModule,args:[{imports:vi,exports:vi}]}];var Ei=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}();Ei.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ei},token:Ei,providedIn:"root"}),Ei.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var wi=400,Ii=function(t){function e(){var e=t.apply(this,le(arguments))||this;return e.overrides={press:{time:wi},pinch:{enable:!1},rotate:{enable:!1},swipe:{threshold:30,velocity:.4}},e}return ne(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);Ii.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ii},token:Ii,providedIn:"root"}),Ii.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var xi=function(){},Oi=function(){function t(t,n,o,r,i){this.route=t,this.router=n,this.routerOutlet=o,this.cd=r,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,i&&(this.progressBarMode$=i.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||pe(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||pe(t),this.cd.markForCheck())},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.hasValidate=Ee(this.hasValidate,this.onValidate.observers.length>0),this.canGoBack=Ee(this.canGoBack,this.routerOutlet.canGoBack()||he(this._backHref)||he(this._defaultBackHref)),this.hasSearch=Ee(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 re(this,void 0,void 0,(function(){var t=this;return ie(this,(function(e){return this.showSearchBar=!this.showSearchBar,this.showSearchBar&&this.searchbar&&setTimeout((function(){return re(t,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return console.debug("[toolbar] calling goBack()"),this._backHref?(t=!this.routerOutlet.canGoBack(),this._backHref.startsWith(".")?[4,this.router.navigate([this._backHref],{relativeTo:this.route,replaceUrl:t})]:[3,2]):[3,5];case 1:return e.sent(),[3,4];case 2:return[4,this.router.navigateByUrl(this._backHref,{replaceUrl:t})];case 3:e.sent(),e.label=4;case 4:return[3,13];case 5:return this.routerOutlet.canGoBack()?[4,this.routerOutlet.pop()]:[3,7];case 6:return e.sent(),[3,13];case 7:return this._defaultBackHref?this._defaultBackHref.startsWith(".")?[4,this.router.navigate([this._defaultBackHref],{relativeTo:this.route,replaceUrl:!0})]:[3,9]:[3,12];case 8:return e.sent(),[3,11];case 9:return[4,this.router.navigateByUrl(this._defaultBackHref,{replaceUrl:!0})];case 10:e.sent(),e.label=11;case 11:return[3,13];case 12:console.error("[toolbar] Cannot go back. Missing attribute 'defaultBackHref' or 'backHref'"),e.label=13;case 13: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}();Oi.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 [menu]="\'left\'"\n [class.cdk-visually-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:xi,useExisting:Oi}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],Oi.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.IonRouterOutlet},{type:e.ChangeDetectorRef},{type:Ei,decorators:[{type:e.Optional}]}]},Oi.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}]}],menuToggle:[{type:e.ViewChild,args:["menuToggle",{static:!0}]}]};var _i=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 ne(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);_i.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _i(e.ɵɵinject(F.TranslateService))},token:_i,providedIn:"root"}),_i.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_i.ctorParameters=function(){return[{type:F.TranslateService}]};var ki=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 Si(t){return"#"+Ai(t[0])+Ai(t[1])+Ai(t[2])}function Ti(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 Ai(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function Ri(t,e,n){n=n?n/100:.5;var o=Ti(t);if(!o)throw Error("Invalid hex color:"+t);var r=Ti(e);if(!r)throw Error("Invalid hex color:"+e);return Si(o.map((function(t,e){return Math.round(t*n+r[e]*(1-n))})))}function Pi(t,e){var n=Ti(t);if(!n)throw Error("Invalid hex color:"+t);return!0===e?.299*n[0]+.587*n[1]+.114*n[2]>186?"#000000":"#FFFFFF":Si(n.map((function(t){return 255-t})))}var Di=function(){},Ni=function(){function t(t,n,o,r){this.translate=t,this.cd=n,this.injector=o,this.formGroupDir=r,this._onChangeCallback=Di,this._onTouchedCallback=Di,this.readonly=!1,this.compact=!1,this.floatLabel="auto",this.onKeyupEnter=new e.EventEmitter,this.filterNumberInput=Ye,this.selectInputContent=ze}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=be(this.required)?this.required:this._definition.required||this.formControl.validator===P.Validators.required||ve(this.required),this.disabled=Ee(this.disabled,Ee(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&&de(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&&Ae(t,e)}},t.prototype.getColorContrast=function(t){return he(t)?Pi(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=tn(t.matInput);e&&(e.tabIndex=t.tabindex,t.cd.markForCheck())}))},t}();Ni.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(\'decimal\')" translate>ERROR.FIELD_NOT_VALID_DECIMAL</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\'" #matInput\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 Ni})),multi:!0}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:inline-block;position:relative}"]}]}],Ni.ctorParameters=function(){return[{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:e.Injector},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Ni.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 Mi=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 re(this,void 0,void 0,(function(){var t;return ie(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 re(this,void 0,void 0,(function(){return ie(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():dn((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.unregisterSubscription=function(t){this._subscription.remove(t)},t.prototype.ngOnStop=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},t}();Mi.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional}]}]};var Fi=[{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]}],Li=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 ne(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2,this.play("startup")]}))}))},e.prototype.preload=function(t){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return ue(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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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())):ue(n.vibration)&&ue(e&&e.vibrate)&&((e=e||{}).vibrate=!0),Ee(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return ue(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e=this;return ie(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(Fi.map((function(n){return t||(n.vibration=void 0),e.preload(n)})))];case 3:return n.sent(),[2]}}))}))},e.prototype.readAudioMode=function(){return re(this,void 0,void 0,(function(){var t;return ie(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}(Mi);Li.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Li(e.ɵɵinject(L.Platform),e.ɵɵinject(tt.NativeAudio,8),e.ɵɵinject(et.Vibration,8),e.ɵɵinject(nt.AudioManagement,8))},token:Li,providedIn:"root"}),Li.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Li.ctorParameters=function(){return[{type:L.Platform},{type:X.NativeAudio,decorators:[{type:e.Optional}]},{type:J.Vibration,decorators:[{type:e.Optional}]},{type:Z.AudioManagement,decorators:[{type:e.Optional}]}]};var ji=function(){function t(t){this.data=t,this.hotkeys=Array.from(this.data)}return t.prototype.ngOnInit=function(){},t}();ji.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}"]}]}],ji.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[A.MAT_DIALOG_DATA]}]}]};var Bi=function(){function t(t,e,n,o,r){var i=this;this.eventManager=t,this.dialog=e,this.document=n,this.modalController=o,this.popoverController=r,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 i.openHelpModal()}))}return t.prototype.addShortcut=function(t){var e=this,n=Object.assign(Object.assign({},this._defaults),t),o="keydown."+n.keys;return he(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 re(e,void 0,void 0,(function(){var e,i;return ie(this,(function(a){switch(a.label){case 0:return[4,this.modalController.getTop()];case 1:return(i=a.sent())?[3,3]:[4,this.popoverController.getTop()];case 2:i=a.sent(),a.label=3;case 3:return(e=i)&&e.component.name!==n.elementName?(o.preventDefault(),[2]):(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(ji,{width:"500px",data:this._hotkeys})},t}();Bi.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Bi(e.ɵɵinject(K.EventManager),e.ɵɵinject(A.MatDialog),e.ɵɵinject(n.DOCUMENT),e.ɵɵinject(L.ModalController),e.ɵɵinject(L.PopoverController))},token:Bi,providedIn:"root"}),Bi.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Bi.ctorParameters=function(){return[{type:K.EventManager},{type:A.MatDialog},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:L.ModalController},{type:L.PopoverController}]};var Vi=function(){};Vi.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,s.MatCommonModule,A.MatDialogModule,F.TranslateModule.forChild()],exports:[ji],declarations:[ji],providers:[Bi]}]}];var qi=480,Ui=640,$i=200,Gi=200,Hi=function(){function t(){}return t.prototype.readFromBlob=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o=this;return ie(this,(function(r){switch(r.label){case 0:if(de(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 re(this,void 0,void 0,(function(){var n,o=this;return ie(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?Gi:n&&n.maxWidth||Ui,a=n&&n.thumbnail?$i:n&&n.maxHeight||qi,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}(),zi=Gt,Wi=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 cn((t||[]).map((function(t){return function(){return n.getImage(t,Object.assign({},e))}})))},t.prototype.getImage=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return ie(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)||zi(),"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,ln(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 Hi).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}();Wi.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Wi(e.ɵɵinject(L.Platform),e.ɵɵinject(Q.HttpClient),e.ɵɵinject(Qt))},token:Wi,providedIn:"root"}),Wi.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[L.Platform,Q.HttpClient]}]}],Wi.ctorParameters=function(){return[{type:L.Platform},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]};var Ki=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=Ee(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}();Ki.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:[""]}]}],Ki.ctorParameters=function(){return[{type:Bi}]},Ki.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 Qi=function(){this.loading=!1,this.color="secondary"};Qi.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 '}]}],Qi.propDecorators={loading:[{type:e.Input}],color:[{type:e.Input}],name:[{type:e.Input}]};var Yi=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}();Yi.alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Xi=require("scrypt-async"),Ji=require("hash.js/lib/hash/sha/256"),Zi=require("hash.js/lib/hash/sha/512"),ta={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}}}},ea=function(){function t(){}return t.prototype.scryptKeypair=function(t,e,n){return new Promise((function(o){Xi(e,t,{N:n&&n.N||ta.constants.SCRYPT_PARAMS.DEFAULT.N,r:n&&n.r||ta.constants.SCRYPT_PARAMS.DEFAULT.r,p:n&&n.p||ta.constants.SCRYPT_PARAMS.DEFAULT.p,dkLen:ta.constants.SEED_LENGTH,encoding:"base64"},(function(t){o(t)}))})).then((function(t){var e=ta.util.decodeBase64(t),n=ta.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=ta.util.decodeUTF8(t),r=ta.sign(o,e.secretKey),i=new Uint8Array(ta.constants.crypto_sign_BYTES),a=0;a<i.length;a++)i[a]=r[a];n(ta.util.encodeBase64(i))}))},t.prototype.verify=function(t,e,n){return new Promise((function(o){var r=ta.util.decodeUTF8(t),i=ta.util.decodeBase64(e),a=Yi.decode(n);o(ta.sign.detached.verify(r,i,a))}))},t.prototype.sha256=function(t){return Ji().update(t).digest("hex")},t.prototype.sha512=function(t){return Zi().update(t).digest("hex")},t.prototype.encodeBase64=function(t){var e=ta.util.decodeUTF8(t);return ta.util.encodeBase64(e)},t}();ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ea},token:ea,providedIn:"root"}),ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var na=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 oa(t,e){return!!t&&t instanceof e}var ra,ia=function(){function t(){}return t.isEntity=function(t){return pe(t.__typename)&&"function"==typeof t.fromObject&&"function"==typeof t.asObject},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||ue(t)&&ue(e)||t&&e&&t[n]===e[n]},t.getPropertyByPath=function(e,n){if(!ue(e)){var o=n.indexOf(".");if(-1===o)return e[n];var r=n.substring(0,o);if(!ue(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=pe(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 re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return ge(n=(t||[]).filter((function(t){return ue(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 pe(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||t.length<=1||!e?t: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(!de(e)&&!de(n)){var o=n.replace(/[-\/\\^$+.()|[\]{}]/g,"\\$&").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&&pe(t.id)&&+t.id<0},t.isRemote=function(e){return e&&!t.isLocal(e)},t.isLocalId=function(t){return pe(t)&&+t<0},t.isRemoteId=function(t){return pe(t)&&+t>=0},t}(),aa=Object.freeze({name:"@sumaris-net/ngx-components",version:void 0,production:!0,baseUrl:"/",defaultLocale:"fr",defaultLatLongFormat:"DDMM",apolloFetchPolicy:"cache-first",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"},account:{enableListenChanges:!0,listenIntervalInSeconds:60},entityEditor:{enableListenChanges:!0,listenIntervalInSeconds:60}}),sa=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 la(t){return t=Object.assign({fromObjectReuseStrategy:"default"},t),function(e){var n,o;if(!aa.production&&!(new e instanceof na))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 ne(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 sa.register(r,i),i}var a=(o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(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 sa.register(r,a),a}}sa.CLASSES_BY_NAME=new Map,t.Peer=ra=function(t){function e(){return t.call(this,ra.TYPENAME)||this}return ne(e,t),e.parseUrl=function(t){var e=new URL(t);return ra.fromObject({dns:e.hostname,port:de(e.port)?void 0:e.port,useSsl:e.protocol&&(e.protocol.startsWith("https")||e.protocol.startsWith("wss")),path:Oe(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(he),(e=[Oe(ra.fromObject(t).url)]).concat.apply(e,le(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=pe(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}(na),t.Peer=ra=oe([la({typename:"PeerVO"})],t.Peer);var ca=function(){function t(){}return t.getText=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(this,(function(r){switch(r.label){case 0:!0===(n=n||{responseType:"text"}).nocache&&(n.headers=n.headers instanceof Q.HttpHeaders?n.headers:new Q.HttpHeaders(n.headers),n.headers.append("Cache-Control","no-cache").append("Pragma","no-cache")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,Object.assign(Object.assign({},n),{responseType:"text"})).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.getJson=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(this,(function(r){switch(r.label){case 0:!0===(n=n||{}).nocache&&(n.headers=n.headers instanceof Q.HttpHeaders?n.headers:new Q.HttpHeaders(n.headers),n.headers.append("Cache-Control","no-cache").append("Pragma","no-cache")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.get(e,Object.assign(Object.assign({},n),{responseType:"json"})).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}(),ua=function(){};ua.getNodeInfo=function(e,n,o){return re(this,void 0,void 0,(function(){var r;return ie(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,ca.getJson(e,r+"/api/node/info",o)]}))}))};var da={POSITIVE_INTEGER:/^\d+$/,VERSION_PART_REGEXP:/^[0-9]+|alpha[0-9]+|beta[0-9]+|rc[0-9]+|[0-9]+-SNAPSHOT$/},pa=function(){};function ha(t,e){var n=t.split("."),o=e.split(".");if(!ma(n)||!ma(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 ma(t){for(var e=0;e<t.length;e++){var n=da.POSITIVE_INTEGER.test(t[e]);if(0===e&&!n)return!1;if(!n){if(!da.VERSION_PART_REGEXP.test(t[e]))return!1;t[e]=t[e].replace("-SNAPSHOT",""),n=da.POSITIVE_INTEGER.test(t[e])}n&&(t[e]=parseInt(t[e]))}return!0}pa.compare=ha,pa.isCompatible=function(t,e){return ha(t,e)<=0},pa.isSame=function(t,e){return 0===ha(t,e)};var fa=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&&pa.isCompatible(this.peerMinVersion,t.softwareVersion)},t.prototype.refresh=function(t){this.loading=!0,this.onRefresh.emit(t)},t.prototype.refreshPeers=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:t=t||[],e=[],n=Promise.all(t.map((function(t){return re(r,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ua.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}();fa.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:[bn],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}"]}]}],fa.ctorParameters=function(){return[{type:L.ModalController},{type:e.ChangeDetectorRef},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},fa.propDecorators={canCancel:[{type:e.Input}],allowSelectDownPeer:[{type:e.Input}],onRefresh:[{type:e.Input}]};var ga=$t,ba="settings",ya=["mobile","touchUi"],va={accountInheritance:!0,locale:aa.defaultLocale,latLongFormat:aa.defaultLatLongFormat||"DDMM",pageHistoryMaxSize:3},Ca=new e.InjectionToken("DefaultLocalSettings"),Ea=new e.InjectionToken("LocalSettingsOptions"),wa=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({},va),s.defaultSettings),s._optionDefs=Object.values(a),s.resetData(),s._debug=!r.production,s._debug&&console.debug("[settings] Creating service"),s}return ne(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(){var t;return ue(null===(t=this._data)||void 0===t?void 0:t.mobile)?(console.warn("[settings] Accessing to property 'usageMode' BEFORE service started! Please use ready()"),An(window)?"FIELD":"DESK"):this._data.usageMode},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"mobile",{get:function(){var t;return ue(null===(t=this._data)||void 0===t?void 0:t.mobile)?(console.warn("[settings] Accessing to property 'mobile' BEFORE service started! Please use ready()"),Rn(window)):this._data.mobile},set:function(t){this._data.mobile=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=pe(this._data.mobile)?this._data.mobile:An(window)||Rn(window),this._data.usageMode=Tn(window)||Sn(window)?"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 re(this,void 0,void 0,(function(){var t,e,n;return ie(this,(function(o){switch(o.label){case 0:return t=this._data||{},[4,this.storage.get(ba)];case 1:return he(e=o.sent())&&(console.info("[settings] Restoring previous settings..."),n=JSON.parse(e),ya.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&&t&&("object"!=typeof t?(this._data.properties=this._data.properties||{},this._data.properties[t]=ue(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,ue(e)?t.defaultValue:e);var n=this._data&&this._data.properties&&this._data.properties[t];return pe(n)?n:e},o.prototype.getPropertyAsBoolean=function(t,e){var n=this.getProperty(t,e);return pe(n)?n&&"false"!==n:void 0},o.prototype.getPropertyAsInt=function(t,e){var n=this.getProperty(t,e);return pe(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:pe(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 re(this,void 0,void 0,(function(){var n;return ie(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 $e(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 re(this,void 0,void 0,(function(){var o;return ie(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 he(e)?Fe(this._data.pages,n+"."+e):this._data.pages[n]}},o.prototype.savePageSetting=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(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&&!ge(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):!(!n||"object"!=typeof n||!n.name)&&n.name===t}));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?pe(this.getOfflineFeature(t)):this._data&&fe(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):!(!n||"object"!=typeof n||!n.name)&&n.name===t.name}));-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=ga().toISOString():e={name:t.toLowerCase(),lastSyncDate:ga().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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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 re(this,void 0,void 0,(function(){var o,r,i=this;return ie(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(fe).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 re(this,void 0,void 0,(function(){return ie(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(ba,JSON.stringify(this._data))):(console.debug("[settings] Removing local settings from storage"),this.storage.remove(ba));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||ga(),!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}(Mi);wa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wa(e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.Platform),e.ɵɵinject(st.Storage),e.ɵɵinject(Qt),e.ɵɵinject(Ca,8),e.ɵɵinject(Ea,8))},token:wa,providedIn:"root"}),wa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],wa.ctorParameters=function(){return[{type:F.TranslateService},{type:L.Platform},{type:st.Storage},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ca]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Ea]}]}]};var Ia=function(){function t(){}return t.show=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a,s,l,c,u,d,p,h,m,f,g,b=this;return ie(this,(function(y){switch(y.label){case 0:if(!t||!e)return console.error("Missing required argument 'toastController' or 'translate'"),n.message instanceof L.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 L.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(pe).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 L.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(),ge(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}();Ia.counter=0,Ia.stackSize=0;var xa=6e5,Oa=3e5,_a=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(he),N.distinctUntilChanged()),f.onNetworkStatusChanges=new D.BehaviorSubject(null),f.onResetNetworkCache=new e.EventEmitter(!0),f._listeners={},f._mobile=f.settings.mobile,f._mobile?(f._timerRefreshPeriod=xa,f._timerRefreshCondition=function(){return f.online}):(f._timerRefreshPeriod=Oa,f._timerRefreshCondition=function(){return!0}),f.resetData(),f.onStart.subscribe((function(){return f.ngOnAfterStart()})),f._debug=!u.production,f}return ne(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 re(this,void 0,void 0,(function(){var n,o,r,i,a,s,l,c,u;return ie(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,Be(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 re(this,void 0,void 0,(function(){var e;return ie(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:Ee(t&&t.showRetrySuccessToast,!0),showLoadingToast:Ee(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 re(this,void 0,void 0,(function(){var n,o;return ie(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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:return this.environment.peerMinVersion?(n=t&&t.softwareVersion&&pa.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(t){var e=this.computePeerPath(t,"/api/node/info");return this.get(e)},o.prototype.getAppManifest=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=this.computePeerPath(t,"manifest.json"),(null==e?void 0:e.nocache)&&(n+="?t="+Date.now()),[4,this.get(n,e)];case 1:return[2,r.sent()];case 2:return o=r.sent(),this.environment.production?console.error("[network] Cannot load file 'manifest.json'. Please make sure webserver config allow CORS access",o):console.error("[network] Cannot load file 'manifest.json'.",o),[3,3];case 3:return[2]}}))}))},o.prototype.getAppVersion=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),n=this.computePeerPath(t,"version.appup"),(null==e?void 0:e.nocache)&&(n+="?t="+Date.now()),[4,this.getText(n,e)];case 1:return he(o=a.sent())?[2,o]:[3,3];case 2:return r=a.sent(),this.environment.production?console.error("[network] Cannot load file 'version.appup'. Please make sure webserver config allow CORS access"):console.error("[network] Cannot load file 'version.appup'.",r),[3,3];case 3:return[4,this.getAppManifest(t,e)];case 4:return[2,null==(i=a.sent())?void 0:i.version]}}))}))},o.prototype.computePeerPath=function(e,n){if(e=e||this.peer){var o=e instanceof t.Peer?e.url:e;return o.endsWith("/")&&(o=o.substr(0,o.length-1)),n.startsWith("/")||(n="/"+n),o+n}},o.prototype.setForceOffline=function(t,e){if(t=Ee(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",type:"warning"}))}},o.prototype.showSelectPeerModal=function(t){return re(this,void 0,void 0,(function(){var n,o,r,i,a=this;return ie(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:fa,componentProps:{onRefresh:n,peers:o,canCancel:Ee(t.canCancel,!0),allowSelectDownPeer:Ee(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 re(this,void 0,void 0,(function(){var e,n=this;return ie(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(),Be(500)})).then((function(){n._debug&&console.debug("[network] All cache cleared, in "+(Date.now()-e)+"ms")}))]}))}))},o.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return console.info("[network] Starting network..."),(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.resetData(),!1===this._timerRefreshCondition()&&this.stopRefreshTimer(),[2]}))}))},o.prototype.restoreLocally=function(){return re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return[4,this.storage.get(ba)];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.getText=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return n=this.getUri(t),[2,ca.getText(this.http,n,e)]}))}))},o.prototype.get=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return n=this.getUri(t),[2,ca.getJson(this.http,n,e)]}))}))},o.prototype.getUri=function(t){var e=t;if(!e.startsWith("http://")&&!e.startsWith("https://")){var n=this.peer&&this.peer.url;n.endsWith("/")&&(n=n.substr(0,n.length-1)),t.startsWith("/")||(t="/"+t),e=n+t}return 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",type:"warning"})):this.showToast({message:"NETWORK.INFO.OFFLINE",type:"warning"}),this.stop())))},o.prototype.resetData=function(){this._data=null},o.prototype.getDefaultPeers=function(){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){return e=(this.environment.defaultPeers||[]).map(t.Peer.fromObject),[2,Promise.resolve(e)]}))}))},o.prototype.showToast=function(t){return Ia.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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){return fe(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}(Mi);_a.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _a(e.ɵɵinject(n.DOCUMENT),e.ɵɵinject(L.Platform),e.ɵɵinject(L.ModalController),e.ɵɵinject(ea),e.ɵɵinject(st.Storage),e.ɵɵinject(wa),e.ɵɵinject(pt.CacheService),e.ɵɵinject(Q.HttpClient),e.ɵɵinject(Qt),e.ɵɵinject(ht.Network,8),e.ɵɵinject(mt.SplashScreen,8),e.ɵɵinject(F.TranslateService,8),e.ɵɵinject(L.ToastController,8))},token:_a,providedIn:"root"}),_a.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_a.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:L.Platform},{type:L.ModalController},{type:ea},{type:st.Storage},{type:wa},{type:dt.CacheService},{type:Q.HttpClient},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:ut.Network,decorators:[{type:e.Optional}]},{type:ct.SplashScreen,decorators:[{type:e.Optional}]},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:L.ToastController,decorators:[{type:e.Optional}]}]};var ka=0,Sa=1,Ta=2,Aa=3,Ra=4,Pa=5,Da=6,Na=7,Ma=8,Fa=9,La=8,ja=10,Ba=11,Va=12,qa=13,Ua=14,$a=15,Ga=104,Ha=350,za=351,Wa=401,Ka=601,Qa=602,Ya=700,Xa=701,Ja=401,Za=403,ts=404,es=520,ns=521,os=553,rs="entities",is=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,"length",{get:function(){var t;return(null===(t=this._cache)||void 0===t?void 0:t.length)||0},enumerable:!1,configurable:!0}),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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return n=this.reduceAndSort(this._cache,t),this._mapToLightEntity&&fe(n.data)&&e&&!0===e.fullLoad?(o=n,[4,cn((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=pe(t.id)&&this._statusById.get(t.id)||{index:void 0};return ue(n.index)?(ue(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!ge(t)||e&&!0===e.reset?(console.info("[entity-storage] Saving "+t.length+" "+this.name+"(s)"),ge(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=pe(t)?this._statusById.get(t):void 0,o=n?n.index:void 0;if(!ue(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(pe);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 void 0===t&&(t={skipIfPristine:!0}),re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return 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])})),ge(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(pe).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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l,c=this;return ie(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?pe(r)?[4,cn((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:pe(o)&&(e=o.filter((function(t){return t&&pe(t.id)})),i=!0,a=[this._storageKey]),u.label=4;case 4:return[3,8];case 5:return pe(o)?(e=o.filter((function(t){return t&&pe(t.id)})),[3,8]):[3,6];case 6:return pe(r)?[4,cn((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=le(s,[this.storageKeyById]),u.label=8;case 8:if(fe(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(),fe(a)?[4,cn(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:Ba,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=ae(this._statusById.values()),r=o.next();!r.done;r=o.next()){var i=r.value;pe(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(!ue(o))return Object.freeze(this._cache[o])},t.prototype.loadFullEntity=function(t,e){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return e=this._statusById.get(t),ue(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 pe(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(ge(t))return{data:[],total:0};if(t=t.filter(pe),!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}:(e.sortBy&&ia.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&&!ge(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}(),as=new e.InjectionToken("localStorageTypePolicies"),ss=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 ne(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.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(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({skipIfPristine:!0})}))),this.registerSubscription(this.platform.pause.subscribe((function(){return re(e,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return console.warn("[entities-storage] Platform will pause: saving..."),[4,this.storeLocally({skipIfPristine:!0})];case 1:return t.sent(),console.warn("[entities-storage] Platform will pause: saving [OK]"),[2]}}))}))}))),console.info("[entities-storage] Starting [OK] in "+(Date.now()-t)+"ms"),[2,this._data]}}))}))},n.prototype.ngOnStop=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.storeLocally({skipIfPristine:!0})];case 1:return t.sent(),[2]}}))}))},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 re(this,void 0,void 0,(function(){var o;return ie(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 re(this,void 0,void 0,(function(){var o;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n;return ie(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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:return!ge(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var n,o;return ie(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||de(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 re(this,void 0,void 0,(function(){var n,o;return ie(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||de(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,this.ready()];case 1:if(o.sent(),!e||de(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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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 re(this,void 0,void 0,(function(){var o,r,i;return ie(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||de(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 re(this,void 0,void 0,(function(){var o,r;return ie(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 re(this,void 0,void 0,(function(){var e,o;return ie(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(t){return void 0===t&&(t={skipIfPristine:!0}),this.storeLocally(t)},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 is(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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return[4,this.storage.get(rs)];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(t){return void 0===t&&(t={skipIfPristine:!0}),re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){return t.skipIfPristine&&!this.dirty?[2]: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(),e=this._data&&Object.keys(this._data)||[],n=Date.now(),this._debug&&console.debug("[entities-storage] Persisting..."),[2,cn(e.map((function(n){return function(){o=n;var i=r.getEntityStore(n,{create:!1});if(i)return t.skipIfPristine&&!i.dirty?Promise.resolve():i.persist(t).then((function(t){if(!t){var o=e.findIndex((function(t){return t===n}));-1!==o&&e.splice(o,1)}}));console.warn("[entities-storage] Persisting "+n+": store not found!")}}))).then((function(){return o=void 0,ge(e)?r.storage.remove(rs):r.storage.set(rs,e)})).then((function(){r._debug&&console.debug("[entities-storage] Persisting [OK] "+e.length+" stores saved in "+(Date.now()-n)+"ms..."),r._saving=!1,r.progressBarService.decrease()})).catch((function(t){throw r._saving=!1,r.progressBarService.decrease(),o?console.error("[entities-storage] Error while persisting "+o,t):console.error("[entities-storage] Error while persisting: "+(t&&t.message||t),t),t}))])}))}))},n}(Mi);ss.TRASH_PREFIX="Trash#",ss.REMOTE_PREFIX="Remote#",ss.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ss(e.ɵɵinject(L.Platform),e.ɵɵinject(Ei),e.ɵɵinject(st.Storage),e.ɵɵinject(Qt),e.ɵɵinject(as,8))},token:ss,providedIn:"root"}),ss.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ss.ctorParameters=function(){return[{type:L.Platform},{type:Ei},{type:st.Storage},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[as]}]}]};var ls,cs=function(){function t(){}return t.copy=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a;return ie(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 ge(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,cn(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}(),us=new e.InjectionToken("locales");t.UserSettings=ls=function(t){function e(){return t.call(this,ls.TYPENAME)||this}return ne(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,ue(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){ls.SETTINGS_PROPERTIES.includes(r)?$e(n[r],t[r])||(n[r]=t[r],o=!0):e&&e.includes(r)&&($e(n.content[r],t[r])||(n.content[r]=Object.assign({},t[r]),o=!0))})),o}},e.prototype.asLocalSettings=function(){var t=this,e={};return ls.SETTINGS_PROPERTIES.forEach((function(n){e[n]=t[n]})),Object.keys(this.content).forEach((function(n){e[n]=t.content[n]})),e},e}(na),t.UserSettings.SETTINGS_PROPERTIES=["locale","latLongFormat"],t.UserSettings=ls=oe([la({typename:"UserSettingsVO"})],t.UserSettings);var ds,ps={DISABLE:0,ENABLE:1,TEMPORARY:2,DELETED:3,ALL:99};function hs(t,e){return t&&t.id&&Ae(t,e||["label","name"])||void 0}var ms=ps.ENABLE,fs=ps.DISABLE,gs=ps.TEMPORARY,bs=Object.freeze([{id:ms,icon:"checkmark",label:"REFERENTIAL.STATUS_ENUM.ENABLE"},{id:fs,icon:"close",label:"REFERENTIAL.STATUS_ENUM.DISABLE"},{id:gs,icon:"help",label:"REFERENTIAL.STATUS_ENUM.TEMPORARY"}]),ys=Object.freeze(Ue(bs)),vs=function(t){function e(e){return t.call(this,e)||this}return ne(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}(na);t.Referential=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(vs),t.Referential=oe([la({typename:"ReferentialVO"})],t.Referential);var Cs,Es,ws=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 ia.isNotEmpty(t,"id")},e.isEmpty=function(t){return ia.isEmpty(t,"id")},e.equals=function(t,e){return ia.equals(t,e,"id")},e}(),Is=Object.freeze({minify:!0,keepTypename:!0,keepEntityName:!0,keepLocalId:!0}),xs=Object.freeze({minify:!0,keepTypename:!1,keepEntityName:!1,keepLocalId:!1});function Os(t){return t&&t.id&&t.name||void 0}function _s(t,e){return(t||[]).map(Os).join(e||", ")}t.ReferentialRef=ds=function(t){function e(){return t.call(this,ds.TYPENAME)||this}return ne(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}(na),t.ReferentialRef=ds=oe([la({typename:"ReferentialVO"})],t.ReferentialRef),t.Department=Cs=function(t){function e(){var e=t.call(this,Cs.TYPENAME)||this;return e.entityName=Cs.ENTITY_NAME,e}return ne(e,t),e.prototype.fromObject=function(e){t.prototype.fromObject.call(this,e),this.entityName=e.entityName||Cs.ENTITY_NAME,this.logo=e.logo,this.siteUrl=e.siteUrl,delete this.entityName},e}(vs),t.Department.ENTITY_NAME="Department",t.Department=Cs=oe([la({typename:"DepartmentVO"})],t.Department);var ks=Object.freeze(["ADMIN","SUPERVISOR","USER","GUEST"]);t.Person=Es=function(e){function n(t){var n=e.call(this,t||Es.TYPENAME)||this;return n.department=null,n}return ne(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=Ts.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=Ts.getMainProfile(this.profiles)},n}(na),t.Person=Es=oe([la({typename:"PersonVO"})],t.Person);var Ss,Ts=function(){function t(){}return t.getMainProfile=function(t){return ge(t)?"GUEST":ks.find((function(e){return t.includes(e)}))||"GUEST"},t.getMainProfileIndex=function(t){if(ge(t))return ks.length-1;var e=ks.findIndex((function(e){return t.includes(e)}));return-1!==e?e:ks.length-1},t.hasUpperOrEqualsProfile=function(e,n){var o=ks.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 As(t){return t&&(t.firstName&&t.firstName+" "||"")+(t.lastName||"")||""}t.Account=Ss=function(e){function n(){var t=e.call(this,Ss.TYPENAME)||this;return t.settings=null,t}return ne(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 As(this)},enumerable:!1,configurable:!0}),n}(t.Person),t.Account=Ss=oe([la({typename:"AccountVO"})],t.Account);var Rs=Gt,Ps="undefined"!=typeof global?global:"undefined"!=typeof window?window:{},Ds=Ps.WebSocket||Ps.MozWebSocket,Ns=function(t,e){return new Ds(t)};function Ms(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"mutation"===e.operation}function Fs(t){var e=Et.getMainDefinition(t.query);return"OperationDefinition"===e.kind&&"subscription"===e.operation}Ns.CLOSED=Ds.CLOSED,Ns.CLOSING=Ds.CLOSING,Ns.CONNECTING=Ds.CONNECTING,Ns.OPEN=Ds.OPEN;var Ls="apollo-tracker-persist";function js(t){return re(this,void 0,void 0,(function(){var e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return o=(n=JSON).parse,[4,t.storage.getItem(Ls)];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 Bs=new e.InjectionToken("graphqlTypePolicies"),Vs=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(pe),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 ne(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(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]=le(n[e.arrayFieldName],[Object.assign({},e.data)]),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var o=we(e.variables&&e.variables.size,-1);o>0&&n[e.arrayFieldName].length>o&&n[e.arrayFieldName].splice(o,n[e.arrayFieldName].length-o),pe(e.totalFieldName)&&(pe(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]=le(n[e.arrayFieldName],r),e.sortFn&&n[e.arrayFieldName].sort(e.sortFn);var i=we(e.variables&&e.variables.size,-1);i>0&&n[e.arrayFieldName].length>i&&n[e.arrayFieldName].splice(i,n[e.arrayFieldName].length-i),pe(e.totalFieldName)&&(pe(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)}),pe(e.totalFieldName)&&(pe(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(!ue(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})})),pe(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 ia.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):le(n[e.arrayFieldName],[e.data]),pe(e.totalFieldName)&&-1===r&&(pe(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return(t=t||this.client)?(console.info("[graphql] Cleaning cache... "),e=this._debug&&Date.now(),[4,t.cache.reset()]):[3,2];case 1:n.sent(),this._debug&&console.debug("[graphql] Cleaning cache [OK] 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 re(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 ie(this,(function(v){switch(v.label){case 0:return[4,this.network.ready()];case 1:if(v.sent(),console.info("[graphql] Starting graphql..."),t=Rn(window),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:Ns,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 zt.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(Ls,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||Rs();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 Ht.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=[Wt.default,g,f,g,m,c,u,d]):h=[c,u,d],s=new yt.ApolloClient({cache:p,link:yt.ApolloLink.split(Ms,yt.ApolloLink.from(h),yt.ApolloLink.split(Fs,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,js({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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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(Pa))||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===Pa&&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:yt.NetworkStatus.error}},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 Ja:return"ERROR.UNAUTHORIZED";case Za:return"ERROR.FORBIDDEN";case Pa:return"ERROR.UNKNOWN_NETWORK_ERROR";case ns:return"ERROR.BAD_UPDATE_DATE";case es:return"ERROR.DATA_LOCKED";case os: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}(Mi);Vs.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Vs(e.ɵɵinject(L.Platform),e.ɵɵinject(vt.Apollo),e.ɵɵinject(_t.HttpLink),e.ɵɵinject(_a),e.ɵɵinject(st.Storage),e.ɵɵinject(ea),e.ɵɵinject(Qt),e.ɵɵinject(Bs,8))},token:Vs,providedIn:"root"}),Vs.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Vs.ctorParameters=function(){return[{type:L.Platform},{type:vt.Apollo},{type:_t.HttpLink},{type:_a},{type:st.Storage},{type:ea},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Bs]}]}]};var qs=require("hash.js/lib/hash/sha/256"),Us=function(){},$s=function(t){function e(e,n){var o=t.call(this,e)||this;return o.graphql=e,o._mutableWatchQueries=[],o._mutableWatchQueriesMaxCount=3,o._debug=Ee(n&&!n.production,!aa.production),o._logPrefix="[base-graphql-service] ",o}return ne(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;fe(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 re(this,void 0,void 0,(function(){var e,n,o=this;return ie(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||qs().update(JSON.stringify(t.query)).digest("hex").substring(0,8),n=t.variables&&qs().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.map((function(t){return e._mutableWatchQueries.filter((function(e){return e.id.startsWith(t+"|")}))})).reduce((function(t,e){return t.concat.apply(t,le(e))}),[]);if(t.query)return this._mutableWatchQueries.filter((function(e){return e.query===t.query}));if(t.queries)return t.queries.filter(pe).map((function(t){return e._mutableWatchQueries.filter((function(e){return e.query===t}))})).reduce((function(t,e){return t.concat.apply(t,le(e))}),[]);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&&ia.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}(Mi);$s.decorators=[{type:e.Directive}],$s.ctorParameters=function(){return[{type:Vs},{type:Us,decorators:[{type:e.Optional}]}]};var Gs,Hs,zs,Ws,Ks,Qs,Ys,Xs,Js,Zs,tl,el,nl,ol,rl="token",il="pubkey",al="seckey",sl="account",ll="assets/img/person.png",cl={account:yt.gql(Gs||(Gs=ce(["\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(Hs||(Hs=ce(["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 }"])))},ul=yt.gql(zs||(zs=ce(["\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"])),cl.account,cl.settings),dl=yt.gql(Ws||(Ws=ce(["\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"]))),pl={save:yt.gql(Ks||(Ks=ce([" 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 ",""])),cl.account,cl.settings),create:yt.gql(Qs||(Qs=ce(["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 ",""])),cl.account,cl.settings),saveSettings:yt.gql(Ys||(Ys=ce(["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 ",""])),cl.settings)},hl=yt.gql(Xs||(Xs=ce(["\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"]))),ml=yt.gql(Js||(Js=ce(["\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"]))),fl=yt.gql(Zs||(Zs=ce(["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"],["\n query Auth($token: String){\n authenticate(token: $token)\n }\n"]))),gl=yt.gql(tl||(tl=ce(["\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"]))),bl={listenChanges:yt.gql(el||(el=ce(["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 }"])))},yl=function(e){function n(t,n,o,r,i,a,s,l,c){var u=e.call(this,o,c)||this;return u.cryptoService=t,u.network=n,u.graphql=o,u.settings=r,u.storage=i,u.file=a,u.translate=s,u.toastController=l,u.environment=c,u.onLogin=new D.Subject,u.onLogout=new D.Subject,u.onChange=new D.Subject,u.onAuthTokenChange=new D.Subject,u.onAuthBasicChange=new D.Subject,u._listenChangesSubscription=null,u._cache={loaded:!1,keypair:null,authToken:null,authBasic:null,pubkey:null,mainProfile:null,person:null,department:null},u._$additionalFields=new D.BehaviorSubject([]),u._tokenType$=new D.BehaviorSubject(void 0),u._enableListenChanges=!c.account||!1!==c.account.enableListenChanges,u._listenIntervalInSeconds=we(c.account&&c.account.listenIntervalInSeconds,0),u._debug=!c.production,u._debug&&console.debug("[account-service] Creating service"),u.resetData(),u.onAuthTokenChange.subscribe((function(t){return u.graphql.setAuthToken(t)})),u.onAuthBasicChange.subscribe((function(t){return u.graphql.setAuthBasic(t)})),u.network.on("beforeTryOnlineFinish",(function(t){return re(u,void 0,void 0,(function(){return ie(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,Be(500)]);case 1:return e.sent(),this.started?[3,3]:[4,this.ready()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))})),u}return ne(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 re(this,void 0,void 0,(function(){var t=this;return ie(this,(function(e){switch(e.label){case 0:return[4,Promise.all([this.settings.ready(),ln(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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&Ts.hasUpperOrEqualsProfile(this._data.profiles,t)},n.prototype.hasExactProfile=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&this._data.profiles.some((function(e){return e===t}))},n.prototype.hasProfileAndIsEnable=function(t){return!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE)&&Ts.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!==ps.ENABLE&&this._data.statusId!==ps.TEMPORARY)&&!Ts.hasUpperOrEqualsProfile(this._data.profiles,"USER")},n.prototype.canUserWriteDataForDepartment=function(t){return ws.isEmpty(t)?this.isAdmin():!(!this._data||!this._data.pubkey||this._data.statusId!==ps.ENABLE)&&(this._data.department&&this._data.department.id?this._data.department.id===t.id||Ts.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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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=Yi.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+ll,this._cache.mainProfile=Ts.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),this._enableListenChanges&&this.startListenRemoteChanges(),[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 re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return[4,ln(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return ie(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:ka,message:"ERROR.SCRYPT_ERROR"};case 4:return this._cache.pubkey=Yi.encode(e.publicKey),this._cache.keypair=e,[4,this.storage.get(rl)];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!==Sa)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:Aa,message:"ERROR.UNKNOWN_ACCOUNT_EMAIL"};c.label=16;case 16:throw{code:Ta,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),this._enableListenChanges&&this.startListenRemoteChanges(),[2,this._data]}}))}))},n.prototype.reload=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.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");e=Date.now(),console.debug("[account] Reloading account..."),n=this.isLogin(),r.label=1;case 1:return r.trys.push([1,4,,8]),[4,this.loadData()];case 2:return r.sent(),[4,this.saveLocally()];case 3:return r.sent(),console.debug("[account] Reloading account [OK] in "+(Date.now()-e)+"ms"),this.onLogin.next(this._data),this.onChange.next(this._data),t&&!1===t.showToast||this.showToast({message:"ACCOUNT.INFO.RELOADED",type:"info"}),[2,this._data];case 4:return o=r.sent(),!n||this.isLogin()?[3,6]:(console.error("[account] Reloading account failed. Will force logout...",o),[4,this.logout()]);case 5:return r.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return[2]}}))}))},n.prototype.save=function(t){return re(this,void 0,void 0,(function(){return ie(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+ll,this._cache.mainProfile=Ts.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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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(il),this.storage.remove(rl),this.storage.remove(sl),n&&this.storage.remove("account#"+n)||Promise.resolve(),this.storage.remove(al)])];case 1:return o.sent(),[3,4];case 2:return[4,Promise.all([this.storage.remove(il),this.storage.remove(sl),this.storage.remove(al)])];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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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(sl)]:[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:ul,error:{code:Sa,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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,this.isEmailExists(t)];case 1:if(e.sent())throw{code:Ra,message:"ERROR.EMAIL_ALREADY_REGISTERED"};return[2]}}))}))},n.prototype.isEmailExists=function(t){return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return this._debug&&console.debug("[account] Checking if {"+t+"} exists..."),[4,this.graphql.query({query:dl,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 re(this,void 0,void 0,(function(){return ie(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:hl,variables:{email:t,locale:e},error:{code:Da,message:"ERROR.SENT_ACCOUNT_CONFIRMATION_EMAIL_FAILED"}})];case 1:return[2,n.sent()]}}))}))},n.prototype.confirmEmail=function(t,e){return re(this,void 0,void 0,(function(){var n;return ie(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:ml,variables:{email:t,code:e},error:{code:Na,message:"ERROR.CONFIRM_ACCOUNT_EMAIL_FAILED"}})];case 1:return[2,(n=o.sent())&&n.confirmAccountEmail]}}))}))},n.prototype.listenChanges=function(t){return this._enableListenChanges?new D.Subscription:this.startListenRemoteChanges(t)},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.asObservable()},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.stopListenRemoteChanges(),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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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+ll,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=Ts.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:Sa,message:"ERROR.LOAD_ACCOUNT_ERROR"};case 6:return[2]}}))}))},n.prototype.listenSettings=function(){return re(this,void 0,void 0,(function(){var t=this;return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a,s,l;return ie(this,(function(c){switch(c.label){case 0:return[4,Promise.all([this.storage.get(il),this.storage.get(rl),this.storage.get(al)])];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:Yi.decode(n),secretKey:Yi.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(sl)];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=Ts.getMainProfile(l.profiles),this._cache.loaded=!0,this.onLogin.next(this._data),this.onChange.next(this._data),this._enableListenChanges&&this.startListenRemoteChanges(),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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(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&&Yi.encode(this._cache.keypair.secretKey)||null,t.avatar&&!t.avatar.endsWith(ll)&&(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(il,this._cache.pubkey),this.storage.set(rl,this._cache.authToken),this.storage.set("account#"+this._cache.pubkey,t),e&&this.storage.set(al,e)||this.storage.remove(al),this.storage.remove(sl)])];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 re(this,void 0,void 0,(function(){var n,o;return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(this,(function(s){switch(s.label){case 0:if(t.pubkey=t.pubkey||e&&Yi.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=ue(t.id))?[3,2]:[4,this.load({fetchPolicy:"network-only"})];case 1:if(!(r=s.sent())||!r.updateDate)throw{code:Fa,message:"ERROR.ACCOUNT_NOT_EXISTS"};this.copyIdAndUpdateDate(r,t),s.label=2;case 2:return delete(i=t.asObject(xs)).profiles,[4,this.graphql.mutate({mutation:o?pl.create:pl.save,variables:{data:i},error:{code:Ma,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 re(this,void 0,void 0,(function(){var e,n,o;return ie(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(xs),[4,this.graphql.mutate({mutation:pl.saveSettings,variables:{data:n},error:{code:La,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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(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:Qa,message:"ERROR.AUTH_SERVER_ERROR"};return t?[4,this.graphql.query({query:fl,variables:{token:t},error:{code:Wa,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:Ka,message:"ERROR.AUTH_CHALLENGE_ERROR"},[4,this.graphql.query({query:gl,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.startListenRemoteChanges=function(t){var e=this;return this._listenChangesSubscription&&this.stopListenRemoteChanges(),this.network.offline?new D.Subscription:(this._listenChangesSubscription=this.watchChanges(t).subscribe({next:function(t){console.debug("[account] Remote update detected at "+t.updateDate),e.reload()},error:function(t){t&&+t.code===ts?(console.info("[account] [WS] Account not exists anymore: force user to logout...",t),e.logout()):t&&+t.code===Ja?(console.info("[account] [WS] Account not authorized: force user to logout...",t),e.logout()):console.warn("[account] [WS] Received error:",t)}}),this._listenChangesSubscription.add((function(){console.debug("[account] Stop watching remote changes"),e._listenChangesSubscription=null})),this._listenChangesSubscription)},n.prototype.stopListenRemoteChanges=function(){var t;null===(t=this._listenChangesSubscription)||void 0===t||t.unsubscribe()},n.prototype.watchChanges=function(t){var e=this;if(!this.started)return D.from(this.ready()).pipe(N.switchMap((function(){return e.watchChanges(t)})));if(!this._cache.pubkey)throw new Error("Not logged in");if(this.network.offline)throw new Error("Cannot watch account changes: network is offline.");var n={interval:we(t&&t.intervalInSeconds,this._listenIntervalInSeconds)};return console.debug("[account] Watching remote changes, every "+n.interval+"s"),this.graphql.subscribe({query:bl.listenChanges,variables:n,error:{code:ja,message:"ERROR.ACCOUNT.SUBSCRIBE_ERROR"}}).pipe(N.map((function(t){return t.data})),N.filter((function(t){var n,o=ao(null===(n=e._data)||void 0===n?void 0:n.updateDate),r=ao(null==t?void 0:t.updateDate);return r&&(!o||!r.isSame(o,"millisecond"))})))},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.prototype.showToast=function(t){return Ia.show(this.toastController,this.translate,t)},n}($s);yl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new yl(e.ɵɵinject(ea),e.ɵɵinject(_a),e.ɵɵinject(Vs),e.ɵɵinject(wa),e.ɵɵinject(st.Storage),e.ɵɵinject(Wi),e.ɵɵinject(F.TranslateService,8),e.ɵɵinject(L.ToastController,8),e.ɵɵinject(Qt))},token:yl,providedIn:"root"}),yl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[Qt]}]}],yl.ctorParameters=function(){return[{type:ea},{type:_a},{type:Vs},{type:wa},{type:st.Storage},{type:Wi},{type:F.TranslateService,decorators:[{type:e.Optional}]},{type:L.ToastController,decorators:[{type:e.Optional}]},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},t.Software=nl=function(t){function e(e){return t.call(this,e||nl.TYPENAME)||this}return ne(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=ia.getPropertyArrayAsObject(e.properties):this.properties=Object.assign({},e.properties)},e}(na),t.Software=nl=oe([la({typename:"SoftwareVO"})],t.Software),t.Configuration=ol=function(e){function n(){return e.call(this,ol.TYPENAME)||this}return ne(n,e),n.prototype.clone=function(){return this.copy(new ol)},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 pe(e)?e&&"false"!==e:void 0},n.prototype.getPropertyAsInt=function(t){var e=this.getProperty(t);return pe(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:pe(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 pe(this.properties[t.key])?this.properties[t.key]:t.defaultValue||void 0},n}(t.Software),t.Configuration=ol=oe([la({typename:"ConfigurationVO"})],t.Configuration);var vl,Cl,El,wl,Il,xl=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:us},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"},DB_TIMEZONE:{key:"sumaris.persistence.db.timezone",label:"DB Timezone (readonly)",type:"string",isTransient:!0}}),Ol="configuration",_l={config:yt.gql(vl||(vl=ce(["\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 "])))},kl=yt.gql(Cl||(Cl=ce(["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"],["\nquery Configuration{\n data: configuration{\n ...ConfigFragment\n }\n}\n ","\n"])),_l.config),Sl=yt.gql(El||(El=ce(["\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"])),_l.config),Tl=yt.gql(wl||(wl=ce(["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"],["\n query ClearCache($name: String) {\n clearCache(name: $name)\n }\n"]))),Al=yt.gql(Il||(Il=ce(["\n query CacheStatistics {\n cacheStatistics\n }\n"],["\n query CacheStatistics {\n cacheStatistics\n }\n"]))),Rl=new e.InjectionToken("defaultOptions"),Pl=function(e){function n(t,n,o,r,i,a,s,l,c,u){var d=e.call(this,n,c)||this;return d.platform=t,d.graphql=n,d.storage=o,d.network=r,d.file=i,d.toastController=a,d.translate=s,d.accountService=l,d.environment=c,d.$data=new D.BehaviorSubject(null),d._debug=!c.production,d._debug&&console.debug("[config] Creating service"),d._optionDefs=Object.values(Object.assign(Object.assign({},xl),u)),d}return ne(n,e),Object.defineProperty(n.prototype,"config",{get:function(){return this.started||this.start(),this.$data.pipe(N.filter(pe))},enumerable:!1,configurable:!0}),n.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(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 re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(this,(function(s){switch(s.label){case 0:return n=Date.now(),console.debug("[config] Loading Pod configuration..."),o=e&&e.query||kl,r=e&&e.variables||void 0,[4,this.graphql.query({query:o,variables:r,error:{code:Ya,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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return console.warn("[config] Invalid call of configService.load(id). Please use loadDefault() instead"),[2,this.loadDefault()]}))}))},n.prototype.canUserWrite=function(t,e){return this.accountService.isAdmin()},n.prototype.save=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(this,(function(a){switch(a.label){case 0:return console.debug("[config] Saving Pod configuration...",t),e=t.asObject(),[4,this.graphql.mutate({mutation:Sl,variables:{data:e},error:{code:Xa,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(),pe(i=this.$data.value)&&r.label===i.label&&this.$data.next(r),[2,r]}}))}))},n.prototype.getCacheStatistics=function(){return re(this,void 0,void 0,(function(){var t,e,n;return ie(this,(function(o){switch(o.label){case 0:return t=Date.now(),console.debug("[config] Loading server cache statistics..."),[4,this.graphql.query({query:Al,variables:null,error:{code:Ya,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 re(this,void 0,void 0,(function(){var e,n,o,r;return ie(this,(function(i){switch(i.label){case 0:return e=Date.now(),console.debug("[config] Clear server cache..."),n=t&&t.cacheName&&{name:t.cacheName}||void 0,[4,this.graphql.query({query:Tl,variables:n,error:{code:Ya,message:"ERROR.LOAD_CONFIG_ERROR"},fetchPolicy:"no-cache"})];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 re(this,void 0,void 0,(function(){var t,e,n=this;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return[4,this.storage.get(Ol)];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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:return t?[3,2]:[4,this.storage.remove(Ol)];case 1:return s.sent(),[3,8];case 2:if(e=this._debug&&Date.now(),!this.network.online||!Rn(window))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}))),fe(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}))))),fe(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(Ol,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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Ia.show(this.toastController,this.translate,t)];case 1:return e.sent(),[2]}}))}))},n}($s);Pl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Pl(e.ɵɵinject(L.Platform),e.ɵɵinject(Vs),e.ɵɵinject(st.Storage),e.ɵɵinject(_a),e.ɵɵinject(Wi),e.ɵɵinject(L.ToastController),e.ɵɵinject(F.TranslateService),e.ɵɵinject(yl),e.ɵɵinject(Qt),e.ɵɵinject(Rl,8))},token:Pl,providedIn:"root"}),Pl.decorators=[{type:e.Injectable,args:[{providedIn:"root",deps:[Rl]}]}],Pl.ctorParameters=function(){return[{type:L.Platform},{type:Vs},{type:st.Storage},{type:_a},{type:Wi},{type:L.ToastController},{type:F.TranslateService},{type:yl},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Rl]}]}]};var Dl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(File),Nl=function(t){this.type=Q.HttpEventType.Response,this.body=pe(null==t?void 0:t.body)?t.body:null,this.status=(null==t?void 0:t.status)||0,this.statusText=(null==t?void 0:t.statusText)||"OK"};function Ml(t){return t&&(t.type===Q.HttpEventType.UploadProgress||t.type===Q.HttpEventType.DownloadProgress)}function Fl(t){return t&&t.type===Q.HttpEventType.Response}var Ll=function(){function t(t,e,n){this.popoverController=t,this.translate=e,this.cd=n,this.uniqueFile=!1,this.instantUpload=!1,this.importing=!1}return Object.defineProperty(t.prototype,"files",{get:function(){return this.uploader.files},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this.importing||ge(this.files)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){return fe(this.files)},enumerable:!1,configurable:!0}),t.prototype.onValidate=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:if(null==t||t.stopPropagation(),this.importing)return[2];console.debug("[upload-file-popover] Validate form: will upload all files..."),r.label=1;case 1:r.trys.push([1,,8,9]),this.importing=!0,this.resetError(),r.label=2;case 2:return r.trys.push([2,6,,7]),[4,this.uploader.waitIdle()];case 3:return r.sent(),[4,this.uploader.uploadFiles()];case 4:if(r.sent(),ge(e=(this.uploader.processedFiles||[]).filter((function(t){return!t.deleting}))))return[2,this.cancel()];if((n=e.map((function(t){return t.error})).filter(he)).length)throw n.forEach((function(t){return console.error(t)})),{message:"FILE.UPLOAD.ERROR"};return[4,this.popoverController.dismiss(e)];case 5:return r.sent(),[3,7];case 6:return o=r.sent(),this.error=o&&o.message||o,[3,7];case 7:return[3,9];case 8:return this.importing=!1,this.cd.markForCheck(),[7];case 9:return[2]}}))}))},t.prototype.cancel=function(){return this.popoverController.dismiss()},t.prototype.resetError=function(){this.error&&(this.error=null,this.cd.markForCheck())},t}();Ll.decorators=[{type:e.Component,args:[{selector:"app-upload-file-popover",template:'\n<ion-content class="ion-no-padding" scrollY="false">\n <div class="modal-content">\n <app-upload-file\n #uploader\n [uploadFn]="uploadFn"\n [deleteFn]="deleteFn"\n [fileExtension]="fileExtension"\n [instantUpload]="instantUpload"\n [uniqueFile]="uniqueFile"\n [maxParallelUpload]="maxParallelUpload"\n ></app-upload-file>\n </div>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n <div *ngIf="importing" class="importing-info">\n <ion-text color="medium"><small translate>FILE.UPLOAD.IMPORTING</small></ion-text>\n <ion-spinner name="dots" color="accent"></ion-spinner>\n </div>\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="ion-text-wrap" [innerHTML]="error | translate"></ion-label>\n </ion-item>\n </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 <ion-button\n [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onValidate($event)"\n (keyup.enter)="onValidate($event)"\n color="tertiary"\n [disabled]="disabled"\n >\n <ion-label translate>COMMON.BTN_IMPORT</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n',encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".importing-info{-webkit-padding-start:var(--ion-padding);padding-inline-start:var(--ion-padding);display:inline-flex;flex-wrap:nowrap;padding-top:8px}"]}]}],Ll.ctorParameters=function(){return[{type:L.PopoverController},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Ll.propDecorators={uploader:[{type:e.ViewChild,args:["uploader",{static:!0}]}],fileExtension:[{type:e.Input}],title:[{type:e.Input}],uniqueFile:[{type:e.Input}],instantUpload:[{type:e.Input}],uploadFn:[{type:e.Input}],deleteFn:[{type:e.Input}],maxParallelUpload:[{type:e.Input}]};var jl=Object.freeze({ANDROID_APK:"application/vnd.android.package-archive"}),Bl=function(){function t(){}return t.showUploadPopover=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i;return ie(this,(function(a){switch(a.label){case 0:return[4,t.create({component:Ll,componentProps:n,backdropDismiss:!1,keyboardClose:!1,event:e,translucent:!0,cssClass:"popover-large"})];case 1:return[4,(o=a.sent()).present()];case 2:return a.sent(),[4,o.onDidDismiss()];case 3:return r=a.sent(),i=r.data,[2,{role:r.role,data:i||void 0}]}}))}))},t.readAsText=function(t,e){var n=new D.Subject,o=new FileReader;return e=(e||"UTF-8").toLowerCase(),o.onprogress=function(t){var e=t.total||1,o=t.total||0;o<e&&n.next({type:Q.HttpEventType.UploadProgress,loaded:o,total:e})},o.onloadend=function(e){var r=o.result;"string"==typeof r?(n.next(new Nl({body:r})),n.complete()):(console.error("Cannot read file '"+t.name+"' as text"),n.error("Cannot read file as text"))},o.onerror=function(t){console.error("[files] Error while reading file:",t),n.error(t)},o.readAsText(t,e),n.asObservable()},t}(),Vl=function(){function t(){}return t.getFilename=function(t){if(!t)return t;var e=t.trim(),n=e.lastIndexOf("/");-1!==n&&n!==t.length-1&&(e=e.substring(n+1));var o=e.indexOf("?");return-1!==o&&(e=e.substring(0,o)),e},t}(),ql=$t,Ul=Object.freeze({DIRECTORY_DOWNLOADS:"Download",DIRECTORY_DOWNLOADS_OLD:"Downloads"}),$l=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 ne(e,t),e.prototype.is=function(t){switch(t){case"mobile":case"mobileweb":return this.platform.is(t)&&!xn(window);default:return this.platform.is(t)}},Object.defineProperty(e.prototype,"mobile",{get:function(){return pe(this._mobile)?this._mobile:this.is("mobile")},enumerable:!1,configurable:!0}),e.prototype.isCordova=function(){return this._cordova},e.prototype.isAndroidCordova=function(){return this._android&&this._cordova||!1},e.prototype.isIOSCordova=function(){return this._ios&&this._cordova||!1},e.prototype.isApp=function(){return this.isAndroidCordova()||this.isIOSCordova()},e.prototype.isWeb=function(){return!this.isApp()},e.prototype.isMobileWeb=function(){return this.mobile&&this.isWeb()},Object.defineProperty(e.prototype,"canDownload",{get:function(){return this.downloader&&this.isAndroidCordova()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canOpenFile",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.width=function(){return this.platform.width()},e.prototype.height=function(){return this.platform.height()},e.prototype.ngOnStart=function(){var t;return re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:e=Date.now(),this.accountService.tokenType=void 0,console.info("[platform] Starting platform..."),a.label=1;case 1:return a.trys.push([1,8,,9]),this._mobile=this.is("mobile"),this._cordova=this.is("cordova"),this._android=this.is("android"),this._ios=this.is("ios"),this.configureClassList(this._mobile),this.configureCordovaPlugins(),this.settings.mobile=this._mobile,[4,this.configureTranslate()];case 2:return a.sent(),[4,this.storageReady()];case 3:return n=a.sent(),[4,this.migrateStorage(n)];case 4:return a.sent(),[4,Promise.all([this.entitiesStorage.ready(),this.cache.ready().then((function(){return i.configureCache()})),this.settings.ready(),this.networkService.ready(),this.audioProvider.ready()])];case 5:return a.sent(),this.isWeb()&&this.environment.production?[4,this.checkAppVersion({canReload:!0})]:[3,7];case 6:a.sent(),a.label=7;case 7:return this.networkService.onNetworkStatusChanges.pipe(N.skip(1)).subscribe((function(t){return i.configureCache("none"!==t)})),console.info("[platform] Starting platform [OK] {mobile: "+this._mobile+", web: "+this.isWeb()+", downloader: "+this.canDownload+", fileOpener: "+this.canOpenFile+"} in "+(Date.now()-e)+"ms"),this.configService.config.pipe(N.map((function(t){return null==t?void 0:t.getProperty(xl.AUTH_TOKEN_TYPE)})),N.filter(he),N.distinctUntilChanged()).subscribe((function(t){console.info("[platform] Using auth token type {"+t+"}"),i.accountService.tokenType=t})),this._mobile&&setTimeout((function(){var t;null===(t=i.splashScreen)||void 0===t||t.hide(),i.audioProvider.playStartupSound()}),1e3),o=1e3*(this.environment.checkAppVersionIntervalInSeconds||0),this.isWeb()&&this.environment.production&&o>0&&(null===(t=this.checkAppVersionTimer)||void 0===t||t.unsubscribe(),this.checkAppVersionTimer=D.timer(o,o).subscribe((function(t){return i.checkAppVersion({silent:!0,canReload:!1})})),this.registerSubscription(this.checkAppVersionTimer)),[3,9];case 8:return r=a.sent(),[2,this.onStartupError(r)];case 9: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,n,o=this;if(!t||!t.uri)throw new Error("Missing argument 'request' or 'request.uri'");if(this._android&&this.downloader){var r=this._downloadingJobs.get(t.uri);if(r)return r;var i=(null===(e=t.destinationInExternalPublicDir)||void 0===e?void 0:e.subPath)||(null===(n=t.destinationInExternalFilesDir)||void 0===n?void 0:n.subPath)||t.filename||Vl.getFilename(t.uri)||t.title||"download";i=i.toLowerCase().replace(/\s+/g,"-"),t.mimeType!==jl.ANDROID_APK||i.toLowerCase().endsWith(".apk")||(i+=".apk");var a=Object.assign(Object.assign({visibleInDownloadsUi:!0,notificationVisibility:St.NotificationVisibility.VisibleNotifyCompleted},t),{filename:void 0,destinationInExternalPublicDir:t.destinationInExternalFilesDir?void 0:Object.assign(Object.assign({dirType:Ul.DIRECTORY_DOWNLOADS},t.destinationInExternalPublicDir),{subPath:i}),destinationInExternalFilesDir:t.destinationInExternalFilesDir?Object.assign(Object.assign({dirType:Ul.DIRECTORY_DOWNLOADS},t.destinationInExternalFilesDir),{subPath:i}):void 0});return console.debug("[platform] Downloading, using request: "+JSON.stringify(a)),r=D.from(this.downloader.download(a)),this._downloadingJobs.set(a.uri,r),r.pipe(N.tap((function(t){return console.info("[platform] File successfully downloaded at:"+t),o._downloadingJobs.delete(a.uri),t})),N.catchError((function(t){var e;if(console.error("[platform] Unable to download: "+(t&&t.message||t)),o._downloadingJobs.delete(a.uri),(null===(e=a.destinationInExternalPublicDir)||void 0===e?void 0:e.dirType)===Ul.DIRECTORY_DOWNLOADS)return a.destinationInExternalPublicDir.dirType=Ul.DIRECTORY_DOWNLOADS_OLD,o.download(a);throw t})))}return console.warn("[platform] Cannot use Cordova downloader plugin: using browser open()"),this.open(t.uri,"_system","location=no",!0),D.of()},e.prototype.openFile=function(t,e){return console.debug("[platform] Opening file: "+t+" ("+e+") ..."),console.warn("[platform] Cannot use Cordova FileOpener plugin: using browser open()"),this.open(t,"_system","location=no",!0),Promise.resolve()},e.prototype.configureClassList=function(t,e){var n,o;void 0===e&&(e=window),t||t||!(null===(n=e.document.documentElement)||void 0===n?void 0:n.classList.contains("plt-mobile"))&&!(null===(o=e.document.documentElement.classList)||void 0===o?void 0:o.contains("plt-mobileweb"))||(console.warn('[platform] Force class list to: <html class="plt-desktop">. Workaround for Windows touch screen.'),e.document.documentElement.classList.remove("plt-mobile","plt-mobileweb"),e.document.documentElement.classList.add("plt-desktop"))},e.prototype.configureCordovaPlugins=function(){console.info("[platform] Configuring Cordova plugins..."),this.statusBar&&(this.statusBar.styleDefault(),this.statusBar.overlaysWebView(!1)),this.keyboard&&this.keyboard.hideFormAccessoryBar(!0)},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{ql.locale(e.lang),console.debug("[platform] Use locale {"+e.lang+"}")}catch(t){ql.locale("en"),console.warn("[platform] Unknown local for moment lib. Using default [en]")}t.dateAdapter.setLocale(ql.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=Ee(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.checkAppVersion=function(t){var e,n,o;return re(this,void 0,void 0,(function(){var r,i,a,s,l,c;return ie(this,(function(u){switch(u.label){case 0:return this.networkService.offline||!this.isWeb()?[2]:(r=!0===(null==t?void 0:t.silent),i=this.environment.production,a=!t||!1!==t.canReload,r||console.info("[platform] Checking remote app version..."),de(s=this.environment.version)?(console.error("[platform] Missing required value for 'environment.version'. Cannot check remote app version."),null===(e=this.checkAppVersionTimer)||void 0===e||e.unsubscribe(),[2]):[4,this.networkService.getAppVersion()]);case 1:return de(l=u.sent())?(i&&!r&&console.error("[platform] Cannot load remote app version. Skipping version check"),null===(n=this.checkAppVersionTimer)||void 0===n||n.unsubscribe(),[2]):pa.isCompatible(l,s)?(r||console.info("[platform] Checking remote app version [OK] {remote: '"+l+"', actual: '"+s+"'}"),[2]):(c=location.href.replace(/[&]?version=[0-9.]+/gi,""),c+=-1===c.indexOf("?")?"?":"&",(c+="version="+l)===location.href?(a&&console.error("[platform] Reloaded page failed, because version still mismatch! Please check version.appup file (expected app version: "+s+")"),null===(o=this.checkAppVersionTimer)||void 0===o||o.unsubscribe(),[2]):(console.warn("[platform] More recent version detected (remote: "+l+", actual: "+s),a?(console.info("[platform] Will reloading at "+c),location.href=c,[3,4]):[3,2]));case 2:return[4,this.showToast({message:"CONFIRM.RELOAD_APP",messageParams:{version:l,name:this.environment.name},type:"info",duration:-1,buttons:[{text:this.translate.instant("COMMON.BTN_RELOAD"),side:"end",handler:function(){return location.href=c,!0}}]})];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},e.prototype.storageReady=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return console.info("[platform] Starting storage..."),[4,this.storage.ready()];case 1:return t=e.sent(),ue(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 re(this,void 0,void 0,(function(){var e,n,o,r,i,a;return ie(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 ge(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",type:"info",duration:3e4})];case 4:r=s.sent(),s.label=5;case 5:return s.trys.push([5,9,,12]),[4,cs.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 Ia.show(e.toastController,e.translate,Object.assign(Object.assign({},t),{onWillPresent:function(t){return n(t)}}))}))},e.prototype.onStartupError=function(t){return re(this,void 0,void 0,(function(){var e,n;return ie(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}(Mi);$l.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new $l(e.ɵɵinject(L.Platform),e.ɵɵinject(gt.Platform),e.ɵɵinject(L.ToastController),e.ɵɵinject(F.TranslateService),e.ɵɵinject(B.MomentDateAdapter),e.ɵɵinject(ss),e.ɵɵinject(wa),e.ɵɵinject(_a),e.ɵɵinject(yl),e.ɵɵinject(Pl),e.ɵɵinject(pt.CacheService),e.ɵɵinject(st.Storage),e.ɵɵinject(Li),e.ɵɵinject(Qt),e.ɵɵinject(Tt.StatusBar,8),e.ɵɵinject(At.Keyboard,8),e.ɵɵinject(mt.SplashScreen,8),e.ɵɵinject(Rt.InAppBrowser,8),e.ɵɵinject(Pt.Downloader,8))},token:$l,providedIn:"root"}),$l.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],$l.ctorParameters=function(){return[{type:L.Platform},{type:gt.Platform},{type:L.ToastController},{type:F.TranslateService},{type:B.MomentDateAdapter},{type:ss},{type:wa},{type:_a},{type:yl},{type:Pl},{type:dt.CacheService},{type:st.Storage},{type:Li},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:ft.StatusBar,decorators:[{type:e.Optional}]},{type:V.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 Gl=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 re(this,void 0,void 0,(function(){return ie(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}();Gl.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'}]}],Gl.ctorParameters=function(){return[{type:e.Injector},{type:L.ModalController},{type:$l},{type:wa},{type:F.TranslateService},{type:e.ChangeDetectorRef}]},Gl.propDecorators={title:[{type:e.Input}],markdownContent:[{type:e.Input}],docUrl:[{type:e.Input}],showError:[{type:e.Input}]};var Hl=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 ne(e,t),e.prototype.translateLabels=function(){this.optionalLabel=this.translate.instant("COMMON.OPTIONAL")},e}(w.MatStepperIntl);Hl.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Hl(e.ɵɵinject(F.TranslateService))},token:Hl,providedIn:"root"}),Hl.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Hl.ctorParameters=function(){return[{type:F.TranslateService}]};var zl=function(){function t(t,e){this.cd=t,this.translate=e,this.uniqueFile=!1,this.instantUpload=!1,this.files=[]}return Object.defineProperty(t.prototype,"processingFiles",{get:function(){return this.files.filter((function(t){return!t.deleting&&pe(t.progress)&&t.progress<1}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"processedFiles",{get:function(){return this.files.filter((function(t){return!t.deleting&&1===t.progress}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"processingFilesCount",{get:function(){return this.processingFiles.length},enumerable:!1,configurable:!0}),t.prototype.onFileDropped=function(t){this.prepareFilesList(t)},t.prototype.fileBrowseHandler=function(t){this.prepareFilesList(t)},t.prototype.deleteFile=function(t){return re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:if(1!==(e=this.files[t]).progress||!this.deleteFn)return[3,6];if(e.deleting)return console.warn("[upload-file] This file already deleting"),[2];o.label=1;case 1:return o.trys.push([1,3,4,5]),e.deleting=!0,[4,this.deleteFn(e)];case 2:return o.sent()?[3,5]:[2];case 3:return n=o.sent(),console.error(n&&n.message||n),[2];case 4:return e.deleting=!1,[7];case 5:return-1===(t=this.files.indexOf(e))?[2]:[3,7];case 6:if(e.progress>0)return console.warn("[upload-file] Cannot remove this file while uploading"),[2];o.label=7;case 7:return this.files.splice(t,1),this.cd.markForCheck(),[2]}}))}))},t.prototype.prepareFilesList=function(t){var e,n;if(t instanceof FileList){n=[];for(var o=0;o<t.length;o++){var r=t.item(o);n.push(r)}}else n=t;(e=this.files).push.apply(e,le(n)),this.fileDropEl.nativeElement.value="",this.instantUpload&&this.uploadFiles(n)},t.prototype.uploadFiles=function(t){return re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){return t||(console.info("[upload-file] Uploading all files..."),t=this.files),e=new D.BehaviorSubject(this.processingFilesCount),(n=new D.Subject).subscribe((function(t){r.cd.markForCheck(),e.next(r.processingFilesCount)})),o=t.map((function(t){return t})).filter((function(t){return t&&ue(t.progress)&&!t.error})).map((function(t,o){return pe(r.maxParallelUpload)?e.pipe(N.debounceTime(o),N.filter((function(t){return t<r.maxParallelUpload})),N.map((function(e){return ue(t.progress)&&(t.progress=0),n.next(),t})),N.first()):(ue(t.progress)&&(t.progress=0),D.of(t))})).map((function(t){return t.pipe(N.filter(pe),N.tap((function(t){return console.debug("[upload-file] "+t.name+": uploading...")})),N.switchMap((function(t){return r.uploadFn(t).pipe(N.filter(pe),N.map((function(e){return Ml(e)?pe(e.loaded)&&e.loaded>=0?t.progress=Math.min(1,e.loaded/(e.total||1)):t.progress=-1:Fl(e)?(t.progress=1,t.response=e,console.debug("[upload-file] "+t.name+": "+(e.statusText||"OK"),t.response)):console.debug("[upload-file] Ignoring a file event: ",e),t})),N.catchError((function(e){var n;return console.error(e),t.error=e&&(e.message||(null===(n=e.error)||void 0===n?void 0:n.message))||"FILE.UPLOAD.ERROR",D.of(t)})),N.tap((function(){n.next(),r.cd.markForCheck()})))})))})),[2,D.forkJoin(o).pipe(N.tap((function(t){return n.complete()}))).toPromise()]}))}))},t.prototype.waitIdle=function(t){var e=this;return dn((function(){return 0===e.processingFilesCount}),t)},t}();zl.decorators=[{type:e.Component,args:[{selector:"app-upload-file",template:'<div *ngIf="!uniqueFile || files.length === 0"\n class="container"\n appDragAndDrop (fileDropped)="onFileDropped($event)">\n <input\n type="file"\n #fileDropRef\n id="fileDropRef"\n multiple\n [accept]="fileExtension"\n (change)="fileBrowseHandler($any($event.target).files)"\n />\n <mat-icon style="font-size: xx-large" color="accent">file_upload</mat-icon>\n <ion-label\n [innerHTML]="\n \'FILE.UPLOAD.DRAG_AND_DROP\' | translate: { extension: !fileExtension ? \'\' : \' (\' + fileExtension + \')\' }\n "\n ></ion-label>\n <ion-button>{{ \'FILE.UPLOAD.BROWSE\' | translate }}</ion-button>\n</div>\n<div class="files-list">\n <div *ngFor="let file of files; index as i"\n class="single-file"\n [class.deleting]="file.deleting">\n <mat-icon>description</mat-icon>\n <div class="info">\n <h4 class="name">\n {{ file.name }}\n </h4>\n <p class="size">\n {{ file.size | fileSize }}\n </p>\n <ion-progress-bar *ngIf="!file.error"\n [value]="file.progress||0"\n [type]="(file.deleting || file.progress === -1) ? \'indeterminate\' : \'determinate\'"></ion-progress-bar>\n <ion-label *ngIf="file.error" color="danger" [innerHTML]="file.error | translate"></ion-label>\n </div>\n \x3c!-- remote from list (before importation) --\x3e\n <button *ngIf="!(file.progress) || file.error" mat-icon-button (click)="deleteFile(i)">\n <mat-icon>clear</mat-icon>\n </button>\n \x3c!-- delete file (remotely - after importation) --\x3e\n <button *ngIf="file.progress === 1 && !!deleteFn && !file.deleting" mat-icon-button (click)="deleteFile(i)">\n <mat-icon>clear</mat-icon>\n </button>\n </div>\n</div>\n',styles:[".container{width:calc(100% - 3rem);min-height:200px;padding:2rem;text-align:center;border:1px dashed #979797;position:relative;margin:1.5rem}.container input{opacity:0;position:absolute;z-index:2;width:100%;height:100%;top:0;left:0;cursor:pointer}.container ion-label{display:block;font-size:20px;font-weight:600;color:#38424c}.container label{display:inline-block;color:#fff;width:183px;height:44px;border-radius:21.5px;background-color:#db202f;padding:8px 16px}.fileover{-webkit-animation:shake 1s;animation:shake 1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.files-list{max-height:300px;overflow:auto}.files-list .single-file{display:flex;flex-grow:1;padding:.5rem;justify-content:space-between;align-items:center;border:1px dashed #979797;margin-bottom:1rem}.files-list .single-file.deleting .name{color:grey!important;font-style:italic!important}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0 0 .25rem}.files-list .single-file .info{width:100%}@-webkit-keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}@keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}"]}]}],zl.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:F.TranslateService}]},zl.propDecorators={fileDropEl:[{type:e.ViewChild,args:["fileDropRef",{static:!1}]}],fileExtension:[{type:e.Input}],uniqueFile:[{type:e.Input}],instantUpload:[{type:e.Input}],uploadFn:[{type:e.Input}],deleteFn:[{type:e.Input}],maxParallelUpload:[{type:e.Input}]};var Wl=new e.InjectionToken("testingPages"),Kl=function(){function t(t,e,n,o){this.route=t,this.router=e,this.translate=n,this.pages=o,console.info("[testing] Loaded tests pages:",o)}return t.prototype.openPage=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.router.navigate([t],{relativeTo:this.route})]}))}))},t}();function Ql(t){return function(){return t.scrollStrategies.close()}}Kl.decorators=[{type:e.Component,args:[{selector:"app-tests-page",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>Tests</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n <ion-list *ngIf="pages?.length">\n\n <ng-container *ngFor="let item of pages">\n\n <ion-item-divider *ngIf="item.divider; else link">{{item.label}}</ion-item-divider>\n\n <ng-template #link>\n <ion-item tappable class="text-1x"\n (click)="openPage(item.page)">{{item.label}}</ion-item>\n </ng-template>\n </ng-container>\n </ion-list>\n\n</ion-content>\n'}]}],Kl.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:F.TranslateService},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Wl]}]}]};var Yl=function(){function t(){}return t.forRoot=function(e){return console.debug("[shared] Creating module (root)"),{ngModule:t,providers:[{provide:Qt,useValue:e},Ei,Li,Wi,To,Fn,Bn,jn,Zn,Xn,Jn,eo,to,{provide:i.OverlayContainer,useClass:i.FullscreenOverlayContainer},{provide:Q.HTTP_INTERCEPTORS,useClass:ki,multi:!0,deps:[Ei]},{provide:u.MatPaginatorIntl,useClass:_i,deps:[F.TranslateService]},{provide:w.MatStepperIntl,useClass:Hl,deps:[F.TranslateService]},{provide:R.MAT_AUTOCOMPLETE_SCROLL_STRATEGY,useFactory:Ql,deps:[i.Overlay]},{provide:R.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,useValue:{autoActiveFirstOption:!0}},{provide:v.MAT_SELECT_SCROLL_STRATEGY,useFactory:Ql,deps:[i.Overlay]}]}},t}();Yl.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,F.TranslateModule,Y.ColorPickerModule,q.TextMaskModule,rt.DragDropModule,it.MarkdownModule,Ci,wr,yr,Vi],declarations:[Oi,Ki,Ni,Qi,Gl,zl,Ll,Kl],exports:[n.CommonModule,L.IonicModule,F.TranslateModule,P.ReactiveFormsModule,Y.ColorPickerModule,q.TextMaskModule,rt.DragDropModule,it.MarkdownModule,Ci,wr,yr,Vi,Oi,Ki,Ni,Qi,Gl,zl,Ll,Kl]}]}];var Xl=function(){function t(){}return t.askSaveBeforeLeave=function(t,e,n){return re(this,void 0,void 0,(function(){var o,r,i,a;return ie(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 re(this,void 0,void 0,(function(){var a;return ie(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 re(this,void 0,void 0,(function(){var i,a,s,l;return ie(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 re(this,void 0,void 0,(function(){var r,i,a,s;return ie(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 re(this,void 0,void 0,(function(){var r,i,a,s;return ie(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 re(this,void 0,void 0,(function(){var i,a,s;return ie(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}(),Jl=function(){function t(t,e){this.translate=t,this.alertCtrl=e,this.debug=!1}return t.prototype.canDeactivate=function(t,e,n,o){return re(this,void 0,void 0,(function(){var e,n,o;return ie(this,(function(r){switch(r.label){case 0:return e=null==t?void 0:t.dirty,n=null==t?void 0:t.valid,o={confirmed:!e,save:!1},this.debug&&console.debug("[dirty-guard] canDeactivate component dirty: "+e+", valid: "+n),e?[4,Xl.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}();Jl.decorators=[{type:e.Injectable}],Jl.ctorParameters=function(){return[{type:F.TranslateService},{type:L.AlertController}]};var Zl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(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}(L.IonicRouteStrategy);Zl.decorators=[{type:e.Injectable}];var tc=function(){console.debug("[shared-routing] Creating module...")};tc.decorators=[{type:e.NgModule,args:[{imports:[W.RouterModule],providers:[{provide:W.RouteReuseStrategy,useClass:Zl},{provide:Jl,useClass:Jl}]}]}],tc.ctorParameters=function(){return[]};var ec=function(){function t(){}return t.prototype.getAsBoolean=function(t,e){var n=this.get(t,e);return pe(n)?n&&"false"!==n:void 0},t.prototype.getAsInt=function(t,e){var n=this.get(t,e);return pe(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:pe(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 pe(t[e.key])?t[e.key]:e.defaultValue||void 0},t}(),nc=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(wa),this.errorTranslator=t.get(dr),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(),this._$ready.unsubscribe(),this._$loading.complete(),this._$loading.unsubscribe()},t.prototype.cancel=function(){this.onCancel.emit()},t.prototype.doSubmit=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(n){switch(n.label){case 0:return this._form?e&&!1===e.checkValid||this._form.valid?[3,2]:[4,ar.waitWhilePending(this._form)]:(this.markAllAsTouched({emitEvent:!0}),[2]);case 1:if(n.sent(),this._form.invalid)return this.markAllAsTouched({emitEvent:!0}),this.debug&&ar.logFormErrors(this._form),[2];n.label=2;case 2:return this.onSubmit.emit(t),[2]}}))}))},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?(ar.copyEntity2Form(t,this.form,Object.assign({emitEvent:!1,onlySelf:!0},e)),e&&!0===e.emitEvent||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=ar.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"),ar.markAsTouched(this.form,t),t&&!1===t.emitEvent||this.markForCheck()},t.prototype.markAllAsTouched=function(t){ar.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 pn(this._$ready,t)},t.prototype.waitIdle=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,ar.waitIdle(this,t)]}))}))},t.prototype.updateValueAndValidity=function(t){ar.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.translateFormErrors(this.form,Object.assign({controlPathTranslator:this},e))},t.prototype.getI18nFieldName=function(t){return(this.i18nFieldPrefix||"")+ke(t).toUpperCase()},t.prototype.registerSubscription=function(t){return this._subscription.add(t)},t.prototype.unregisterSubscription=function(t){this._subscription.remove(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}();nc.decorators=[{type:e.Directive}],nc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormGroup}]},nc.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 oc=function(t){function n(n,o,r){var i=t.call(this,n)||this;return i.injector=n,i.cd=o,i.formBuilder=r,i.showError=!0,i.multiline=!0,i.autoHeight=!1,i.maxLength=2e3,i.autofocus=!1,i.textAreaChanges=new e.EventEmitter,i}return ne(n,t),n.prototype.ngOnInit=function(){var e=this.formBuilder.group({text:[null,pe(this.maxLength)?P.Validators.maxLength(this.maxLength):void 0]});this.control=e.get("text"),this.setForm(e),t.prototype.ngOnInit.call(this)},n.prototype.textAreaChanged=function(t){this.textAreaChanges.emit(this.control.value)},n.prototype.containerResize=function(){var t;null===(t=this.autosizeDirective)||void 0===t||t.resizeToFitContent(!0)},n.prototype.focusInput=function(){this.textArea&&Xe(this.textArea),this.textInput&&Xe(this.textInput)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);oc.decorators=[{type:e.Component,args:[{selector:"app-text-form",template:'<form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n <mat-form-field *ngIf="multiline; else monoline">\n <textarea\n #textArea\n matInput\n [formControl]="control"\n [placeholder]="placeholder"\n [readonly]="control.disabled"\n [class.fixed-height]="!autoHeight"\n [cdkTextareaAutosize]="autoHeight"\n (keyup)="textAreaChanged($event)"\n (keydown.control.enter)="onSubmit.emit($event)"\n [autofocus]="autofocus"\n ></textarea>\n <mat-error *ngIf="control.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: control.errors[\'maxlength\'] }}\n </mat-error>\n <mat-hint *ngIf="maxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]="control"\n [placeholder]="placeholder"\n [readonly]="disabled"\n [appAutofocus]="autofocus"\n (keydown.control.enter)="onSubmit.emit($event)"\n />\n <mat-error *ngIf="control.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: control.errors[\'maxlength\'] }}\n </mat-error>\n <mat-hint *ngIf="maxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n',styles:["textarea.fixed-height{height:11.5em}"]}]}],oc.ctorParameters=function(){return[{type:e.Injector},{type:e.ChangeDetectorRef},{type:P.FormBuilder}]},oc.propDecorators={showError:[{type:e.Input}],placeholder:[{type:e.Input}],multiline:[{type:e.Input}],autoHeight:[{type:e.Input}],maxLength:[{type:e.Input}],autofocus:[{type:e.Input}],textAreaChanges:[{type:e.Output}],textArea:[{type:e.ViewChild,args:["textArea"]}],textInput:[{type:e.ViewChild,args:["textInput"]}],autosizeDirective:[{type:e.ViewChild,args:[Dt.CdkTextareaAutosize]}]};var rc=function(){function t(t,e){this.popoverController=t,this.translate=e,this.placeholder="",this.editing=!0,this.multiline=!0,this.maxLength=2e3,this.autofocus=!1,this.subscription=new D.Subscription}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this.form.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.form.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valid",{get:function(){var t;return(null===(t=this.form)||void 0===t?void 0:t.valid)||!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){var t;return null===(t=this.form)||void 0===t?void 0:t.value.text},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.enable()},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){return t.form.setValue({text:t.text})}),0)},t.prototype.onValidate=function(t){return re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return[4,er(this.form)];case 1:if(n.sent(),!this.valid)return Uo(this.form.control),[2];n.label=2;case 2:return n.trys.push([2,4,,5]),t=this.value,this.disable(),[4,this.popoverController.dismiss(t)];case 3:return n.sent(),this.form.error=null,[3,5];case 4:return e=n.sent(),this.form.error=e&&e.message||e,this.enable(),[3,5];case 5:return[2]}}))}))},t.prototype.disable=function(){this.form.disable()},t.prototype.enable=function(){this.editing&&this.form.enable()},t.prototype.cancel=function(){this.popoverController.dismiss()},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t}();rc.decorators=[{type:e.Component,args:[{selector:"app-text-popover",template:'\n<ion-content class="ion-padding" cdkTrapFocus [cdkTrapFocusAutoCapture]="true">\n <ion-item *ngIf="form.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]="form.error|translate"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]="placeholder"\n [multiline]="multiline"\n [maxLength]="maxLength"\n [autofocus]="editing && autofocus"\n (onSubmit)="onValidate($event)"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class="ion-no-padding" nowrap>\n <ion-col>\n\n </ion-col>\n\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-button\n [fill]="disabled ? \'clear\' : \'solid\'"\n (click)="onValidate($event)"\n (keyup.enter)="onValidate($event)"\n color="tertiary"\n [disabled]="disabled"\n [title]="\'COMMON.BTN_VALIDATE_WITH_SHORTCUT_HELP\'|translate">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n'}]}],rc.ctorParameters=function(){return[{type:L.PopoverController},{type:F.TranslateService}]},rc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}],text:[{type:e.Input}],placeholder:[{type:e.Input}],editing:[{type:e.Input}],multiline:[{type:e.Input}],maxLength:[{type:e.Input}],autofocus:[{type:e.Input}]};var ic=function(){function t(){}return t.prototype.ngOnDestroy=function(){},t}();ic.decorators=[{type:e.Directive}];var ac=function(t){function e(e){return t.call(this,e)||this}return ne(e,t),e.prototype.asPodObject=function(){return this.asObject(xs)},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(!ge(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||ws.isNotEmpty(e))},e}(na),sc=function(){function t(){}return t.isEntityFilter=function(t){return!!(t&&t.asPodObject&&t.asFilterFn)},t.fromObject=function(e,n){if(!e)return e;if(oa(e,n))return e;var o=new n;return t.isEntityFilter(o)?o.fromObject(e):Object.assign(o,e),o},t}(),lc=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 ac)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 ne(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(pe),N.mergeMap((function(t){return dn((function(){return!a._saving}))})),N.mergeMap((function(i){return re(a,void 0,void 0,(function(){var i,a,s,l,c,u;return ie(this,(function(d){switch(d.label){case 0:i=[],d.label=1;case 1:return d.trys.push([1,,6,7]),ge(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,le(a)):i,[7];case 7:return[2]}}))}))})))},e.prototype.saveAll=function(t,e){return re(this,void 0,void 0,(function(){var e,n;return ie(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]),fe(this._hiddenData)&&(t=t.concat.apply(t,le(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 re(this,void 0,void 0,(function(){var e,n=this;return ie(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",ia.sort(t,e,n)},e.prototype.asFilter=function(t){return sc.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):ia.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}(ic);lc.decorators=[{type:e.Directive}],lc.ctorParameters=function(){return[{type:Function},{type:Function},{type:void 0}]};var cc=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(Object.assign(Object.assign({},e),{progression:n})).then((function(){(null==e?void 0:e.maxProgression)&&n.next(e.maxProgression),n.complete()})).catch((function(t){return n.error(t)})),n},t.fetchAllPages=function(t,e){var n,o;return re(this,void 0,void 0,(function(){var r,i,a,s,l,c,u,d,p,h;return ie(this,(function(m){switch(m.label){case 0:if(r=we(null==e?void 0:e.maxProgression,100),i=null==e?void 0:e.progression,(u=we(null==e?void 0:e.fetchSize,1e3))<=0)throw new Error("Unable to fetch pages: invalid fetchSize: "+u);d=0,p=[],m.label=1;case 1:return e&&e.logPrefix&&console.debug(e.logPrefix+" Fetching page #"+d/u+"..."),[4,t(d,u)];case 2:h=m.sent(),p=p.concat(h.data),c=h.data&&h.data.length||0,d+=c,ue(a)&&pe(h.total)&&(a=h.total,s=Math.round(h.total/u+.5),i&&(l=r/s,e&&e.logPrefix&&console.debug(e.logPrefix+" {pageCount: "+s+", progress: "+(null===(n=i.value)||void 0===n?void 0:n.toFixed(2))+", pageProgressStep: "+(null==l?void 0:l.toFixed(1))+"}"))),pe(l)&&i.next(i.value+l),(null==e?void 0:e.onPageLoaded)&&e.onPageLoaded(h),m.label=3;case 3:if(c>0&&(ue(a)&&c===u||pe(a)&&d<a))return[3,1];m.label=4;case 4:return pe(l)?(pe(a)&&p.length<a&&(console.warn("A function loadAll() returned a bad total (less than all page's data)! Expected "+a+" but fetch "+p.length),a=p.length,s=Math.round(p.length/u+.5)),l=Math.max(0,r-l*s)):i&&(l=r),e&&e.logPrefix&&console.debug(e.logPrefix+" All pages fetched - {progress: "+(null===(o=i.value)||void 0===o?void 0:o.toFixed(2))+", lastProgressStep: "+(null==l?void 0:l.toFixed(1))),i&&l>0&&i.next(i.value+l),[2,{data:p,total:a}]}}))}))},t}(),uc={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]},dc={},pc=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 dc[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 pe(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 ue(t=pe(t)?t:this._opacity)||t<0||t>1?"rgb("+this._rgbArray.join(",")+")":"rgba("+this._rgbArray.join(",")+","+t+")"},t}();pc.transparent=function(){return new pc([0,0,0],0,"translucent")};var hc=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,pc.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}();hc.custom=function(t,e){return new hc(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=mc(e.mainColorIndex+1,{opacity:e.opacity,startColor:e.startColor,endColor:e.mainColor,format:e.format});return e.mainColorIndex<t-1?n.concat(mc(t-e.mainColorIndex,{opacity:e.opacity,startColor:e.mainColor,endColor:e.endColor,format:e.format})):n}return mc(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:pe(e.mainColorIndex)?e.mainColorIndex:void 0,endColor:e.endColor||void 0,format:e.format}),e)},Object.getOwnPropertyNames(uc).forEach((function(t){dc[t]=new pc(uc[t],1,t)}));function mc(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 fc=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 re(this,void 0,void 0,(function(){var t,e;return ie(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}();fc.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'}]}],fc.ctorParameters=function(){return[{type:yl},{type:L.ModalController}]},fc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var gc=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=i.mobile,d.canWorkOffline=d.settings.hasOfflineFeature(),d._enable=!0,d}return ne(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(xl.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.getPropertyAsBoolean(xl.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){return re(this,void 0,void 0,(function(){var e,n=this;return ie(this,(function(o){switch(o.label){case 0:return t&&(t.preventDefault(),t.stopPropagation()),this.loading?[2]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return ar.logFormErrors(this.form),[2];o.label=2;case 2:return this.markAsLoading(),e=this.form.value,this.showPwd=!1,this.error=null,setTimeout((function(){return n.onSubmit.emit({username:e.username,password:e.password,offline:e.offline})})),[2]}}))}))},n.prototype.register=function(){var t=this;this.onCancel.emit(),setTimeout((function(){return re(t,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:fc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))}),200)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);gc.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:[Cn],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[""]}]}],gc.ctorParameters=function(){return[{type:e.Injector},{type:$l},{type:P.FormBuilder},{type:wa},{type:Pl},{type:L.ModalController},{type:_a},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]},gc.propDecorators={onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var bc=function(){function t(t,e,n){this.accountService=t,this.viewCtrl=e,this.cd=n}return Object.defineProperty(t.prototype,"loading",{get:function(){var t;return null===(t=this.form)||void 0===t?void 0:t.loading},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.form.markAsReady({emitEvent:!1}),this.form.markAsLoaded()},t.prototype.cancel=function(){this.viewCtrl.dismiss()},t.prototype.doSubmit=function(){return re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:if(this.form.disabled)return[2];if(!this.form.valid)return this.form.markAllAsTouched(),[2];this.markAsLoading(),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.form.error=n&&n.message||n,this.markAsLoaded(),this.form.enable(),ln(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2];case 4:return[2]}}))}))},t.prototype.markForCheck=function(){this.cd.markForCheck()},t.prototype.markAsLoading=function(t){this.form.markAsLoading(t)},t.prototype.markAsLoaded=function(t){this.form.markAsLoaded(t)},t}();bc.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:[""]}]}],bc.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:e.ChangeDetectorRef}]},bc.propDecorators={form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var yc=new e.InjectionToken("aboutDevelopers"),vc=new e.InjectionToken("aboutPartners"),Cc=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&&qe(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 re(this,void 0,void 0,(function(){return ie(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(xl.FORUM_URL))||this.environment.forumUrl,this.helpUrl=(null==t?void 0:t.getProperty(xl.HELP_URL))||this.environment.helpUrl},t}();Cc.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}"]}]}],Cc.ctorParameters=function(){return[{type:F.TranslateService},{type:L.ModalController},{type:Pl},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[yc]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[vc]}]}]};var Ec=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 wc(t){return t[Math.floor(Math.random()*t.length)]}var Ic=new e.InjectionToken("homeButton"),xc=function(){function t(t,e,n,o,r,i,a,s,l,c,u,d){var p,h=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 h.start()})),this.showAccountButton=Ee(null===(p=c.account)||void 0===p?void 0:p.showAccountButton,!0)}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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:bc})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.register=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:fc,backdropDismiss:!1})];case 1:return[2,t.sent().present()]}}))}))},t.prototype.logout=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Ia.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.isWeb(),this.canRegister=t.getPropertyAsBoolean(xl.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 pe(t)&&(!e.offline||!t.startsWith("http"))}));if(o.length){var r=wc(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=As(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 Ec.checkIfVisible(e,t.accountService,t._config,{isLogin:t.isLogin,debug:t._debug,logPrefix:"[home]"})})).map((function(e){if(he(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}();xc.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 *ngIf="showAccountButton" 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" [innerHTML]="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:[bn,Cn],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 ion-card-content ion-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)}}"]}]}],xc.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:F.TranslateService},{type:L.ToastController},{type:Pl},{type:$l},{type:e.ChangeDetectorRef},{type:_a},{type:wa},{type:Yt,decorators:[{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Inject,args:[us]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Ic]}]}]};var Oc=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=wc(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 re(this,void 0,void 0,(function(){var n,o,r;return ie(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.reload()]:[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}();Oc.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 ion-footer ion-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}}"]}]}],Oc.ctorParameters=function(){return[{type:$l},{type:yl},{type:W.ActivatedRoute},{type:Pl}]};var _c=function(t){function e(e,n){var o=t.call(this)||this;return o.formBuilder=e,o.translate=n,o}return ne(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=ar.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_"+ke(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"),ke(t))},e}(Nt.ValidatorService);_c.decorators=[{type:e.Directive}],_c.ctorParameters=function(){return[{type:P.FormBuilder},{type:F.TranslateService}]};var kc=function(t){function e(e){return t.call(this,e)||this}return ne(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}(_c);kc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new kc(e.ɵɵinject(P.FormBuilder))},token:kc,providedIn:"root"}),kc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],kc.ctorParameters=function(){return[{type:P.FormBuilder}]};var Sc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.formBuilder=e,o.accountService=n,o}return ne(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||Ts.getMainProfile(t.profiles))||"GUEST",P.Validators.required],statusId:[t&&t.statusId||ps.TEMPORARY,P.Validators.required],pubkey:[t&&t.pubkey||null,P.Validators.compose([P.Validators.required,Mo.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(Mo.entity),e.length?P.Validators.compose(e):1===e.length?e[0]:void 0},e}(_c);Sc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Sc(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(yl))},token:Sc,providedIn:"root"}),Sc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sc.ctorParameters=function(){return[{type:P.FormBuilder},{type:yl}]};var Tc=function(e){function n(t,n,o,r,i,a,s,l,c,u,d){var p=e.call(this,t,a.getFormGroup(o.account))||this;return p.formBuilder=n,p.accountService=o,p.network=r,p.router=i,p.validatorService=a,p.settingsValidatorService=s,p.translate=l,p.settings=c,p.cd=u,p.email={confirmed:!1,notConfirmed:!1,sending:!1,error:void 0},p.latLongFormats=Vn,p.saving=!1,p.submitted=!1,p.locales=d,p.settingsForm=s.getFormGroup(o.account&&o.account.settings),p.settingsContentForm=p.settingsForm.controls.content,p.form.addControl("settings",p.settingsForm),p.disable(),p.registerSubscription(p.accountService.onLogin.subscribe((function(t){return p.onLogin(t)}))),p.registerSubscription(p.accountService.onLogout.subscribe((function(){return p.onLogout()}))),p.registerSubscription(p.onCancel.subscribe((function(){p.setValue(p.accountService.account),p.markAsPristine()}))),p.registerSubscription(p.accountService.$additionalFields.subscribe((function(t){p.additionalFields=t.slice(),o.isLogin()?p.onLogin(p.accountService.account):p.markAsLoaded()}))),p}return ne(n,e),n.prototype.ngOnDestroy=function(){var t;e.prototype.ngOnDestroy.call(this),this.stopListenChanges(),null===(t=this.networkSubscription)||void 0===t||t.unsubscribe()},n.prototype.onLogin=function(t){var e,n=this;console.debug("[account] Logged account: ",t),this.isLogin=!0,this.setValue(t),this.email.confirmed=t&&t.email&&t.statusId!==ps.TEMPORARY,this.email.notConfirmed=t&&t.email&&(!t.statusId||t.statusId===ps.TEMPORARY),null===(e=this.networkSubscription)||void 0===e||e.unsubscribe(),this.networkSubscription=this.network.onNetworkStatusChanges.pipe(N.map((function(t){return"none"!==t}))).subscribe((function(t){t?(n.enable(),n.markAsPristine(),n.startListenChanges()):(n.disable(),n.markAsPristine(),n.stopListenChanges()),n.markAsLoaded()}))},n.prototype.onLogout=function(){var t;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(),null===(t=this.networkSubscription)||void 0===t||t.unsubscribe(),this.stopListenChanges(),this.router.navigateByUrl("/")},n.prototype.refresh=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.disable(),this.markAsLoading(),[2,this.accountService.reload()]}))}))},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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return this.saving?[2,!1]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(o.sent(),this.form.invalid)return ar.logFormErrors(this.form),this.form.markAllAsTouched(),[2,!1];o.label=2;case 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=3;case 3:return o.trys.push([3,5,6,7]),this.disable(),[4,this.accountService.save(e)];case 4:return o.sent(),this.markAsPristine(),[2,!0];case 5:return n=o.sent(),console.error(n),this.error=n&&n.message||n,[2,!1];case 6:return this.saving=!1,this.enable(),[7];case 7: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.forEach((function(e){var n,o,r=t.form.controls[e.key];if(r){((null===(n=e.extra)||void 0===n?void 0:n.account)&&e.extra.account.disabled||!1)&&r.enabled&&r.disable();var i=(null===(o=e.extra)||void 0===o?void 0:o.account)&&e.extra.account.required||!1;!e.required&&i&&r.setValidators(r.validator?P.Validators.compose([r.validator,P.Validators.required]):P.Validators.required)}})),this.markForCheck()},n.prototype.cancel=function(){var t=Object.create(null,{cancel:{get:function(){return e.prototype.cancel}}});return re(this,void 0,void 0,(function(){return ie(this,(function(e){return t.cancel.call(this),[2]}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);Tc.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 (if online) --\x3e\n <ion-button [matTooltip]="\'COMMON.BTN_REFRESH\'|translate"\n *ngIf="network.online"\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%}"]}]}],Tc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:yl},{type:_a},{type:W.Router},{type:Sc},{type:kc},{type:F.TranslateService},{type:wa},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[us]}]}]};var Ac=function(){this.showRecorder=!0};Ac.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:[bn],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)}"]}]}],Ac.propDecorators={value:[{type:e.Input}],showRecorder:[{type:e.Input}]};var Rc=function(){},Pc=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}();Pc.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:Rc,useExisting:Pc}],styles:[":host{width:100%}:host ion-toolbar{height:var(--app-form-buttons-bar-height);padding:0 6px}:host ion-col{padding:0}"]}]}],Pc.ctorParameters=function(){return[{type:Bi}]},Pc.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 Dc=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=Ee(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}();Dc.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'}]}],Dc.ctorParameters=function(){return[{type:L.NavParams},{type:L.ModalController}]},Dc.propDecorators={columns:[{type:e.Input}],canHideColumns:[{type:e.Input}]};var Nc=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=hs,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}();Nc.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}"]}]}],Nc.ctorParameters=function(){return[{type:yl},{type:Sc},{type:P.FormBuilder},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:wa}]},Nc.propDecorators={stepper:[{type:e.ViewChild,args:["stepper",{static:!0}]}],onCancel:[{type:e.Output}],onSubmit:[{type:e.Output}]};var Mc=function(){};Mc.decorators=[{type:e.NgModule,args:[{imports:[Q.HttpClientModule],exports:[Q.HttpClientModule]}]}],Mc.ctorParameters=function(){return[]};var Fc=function(t){function e(e,n){var o=t.call(this,e)||this;return o.networkService=n,o}return ne(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=ia.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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return this.networkService.offline?(Mo.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}];Mo.clearError(t,"peerAlive"),n.label=3;case 3:return[2]}}))}))},e}(_c);Fc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Fc(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(_a))},token:Fc,providedIn:"root"}),Fc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Fc.ctorParameters=function(){return[{type:P.FormBuilder},{type:_a}]};var Lc=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 ir(h.form.get("properties"),(function(t){return h.validatorService.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return ue(t)||ue(t.key)&&ue(t.value)}),{allowEmptyArray:!0}),h.mobile=h.platform.mobile,h._enable=!1,h}return ne(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){var t,e;return ie(this,(function(n){switch(n.label){case 0:return this.markAsLoading(),console.debug("[settings] Loading settings..."),(t=this.settings.settings).accountInheritance=Ee(t.accountInheritance,!0),t.locale=t.locale||this.translate.currentLang||this.translate.defaultLang,t.latLongFormat=t.latLongFormat||"DDMMSS",t.usageMode=t.usageMode||"DESK",de(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=ia.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 re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return this.saving?[2]:(e&&e.preventDefault(),this.propertiesFormHelper.removeAllEmpty(),this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)]);case 1:if(a.sent(),this.form.invalid)return ar.logFormErrors(this.form),this.form.markAllAsTouched(),[2];a.label=2;case 2:return console.debug("[settings] Saving local settings..."),this.saving=!0,this.error=void 0,this.markForCheck(),[4,this.getValue()];case 3:n=a.sent(),(o=this.form.get("peerUrl").dirty)&&(n.pageHistory=[]),a.label=4;case 4:return a.trys.push([4,6,7,8]),this.disable(),[4,this.settings.apply(n)];case 5:return a.sent(),this.data=n,this.markAsPristine(),o&&(this.network.peer=t.Peer.parseUrl(n.peerUrl)),[2,!0];case 6:return r=a.sent(),console.error(r),this.error=r&&r.message||r,[2,!1];case 7:return this.enable({emitEvent:!1}),this.setAccountInheritance(n.accountInheritance,{emitEvent:!1}),setTimeout((function(){i.saving=!1,i.markForCheck()}),400),[7];case 8: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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.load()];case 1:return t.sent(),[2]}}))}))},n.prototype.close=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.saving?[2]:[2,this.router.navigateByUrl("/",{replaceUrl:!0})]}))}))},n.prototype.clearCache=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return[4,Xl.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 re(this,void 0,void 0,(function(){var t,e,n;return ie(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=ia.getPropertyArrayAsObject(t.properties),Promise.resolve(t)},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(nc);Lc.decorators=[{type:e.Component,args:[{selector:"page-settings",template:'<app-toolbar [title]="\'SETTINGS.TITLE\'|translate" color="primary"\n [hasValidate]="dirty && !saving"\n [hasClose]="!dirty && !saving"\n (onValidate)="save($event)"\n (onClose)="close($event)">\n\n <ion-buttons slot="end">\n \x3c!-- options menu --\x3e\n <ion-button [matMenuTriggerFor]="optionsMenu"\n *ngIf="!saving"\n [disabled]="saving">\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:Nt.ValidatorService,useExisting:Fc}],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],Lc.ctorParameters=function(){return[{type:e.Injector},{type:$l},{type:W.Router},{type:Fc},{type:L.AlertController},{type:F.TranslateService},{type:P.FormBuilder},{type:yl},{type:wa},{type:e.ChangeDetectorRef},{type:_a},{type:Array,decorators:[{type:e.Inject,args:[us]}]}]};var jc=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 ne(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(ge(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 ir(this.formArray,(function(t){return e.getPropertyFormGroup(t)}),(function(t,e){return!t&&!e||t.key===e.key}),(function(t){return ue(t)||ue(t.key)&&ue(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&&ue(this.definitionsMapByKey[n])},e.prototype.setValue=function(t){if(t){var e=ia.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}(nc);jc.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}]}],jc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:wa},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},jc.propDecorators={formArrayName:[{type:e.Input}],formArray:[{type:e.Input}],options:[{type:e.Input}],definitions:[{type:e.Input}]};var Bc=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 Mt.SelectionModel(!0,[]),l.displayWithFn=hs,l.onNewItem=new e.EventEmitter,l.selectionChanges=new e.EventEmitter(!0),l}return ne(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){ar.markAsTouched(this.formArray,t),t&&!1===t.emitEvent||this.markForCheck()},n.prototype.markAllAsTouched=function(t){ar.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 ue(t)&&ue(e)||t===e},this.helper=new ir(this.formArray,(function(t){return e.createControl(t)}),this.equalsFn,(function(t){return ue(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 re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(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}(nc);Bc.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-color-selected:var(--ion-color-secondary100-contrast)}ion-item.disabled ion-label{color:var(--ion-color-medium-shade,grey)}ion-item{--min-height:48px;background-color:var(--ion-item-background)}ion-item ion-label,ion-item ion-text{color:var(--ion-item-color)}ion-item .action-buttons{visibility:hidden;display:none}ion-item:hover{height:var(--min-height);--ion-item-background-color:var(--ion-color-light);--ion-item-color:var(--ion-color-light-contrast)}ion-item:hover .action-buttons{margin-top:-1px;visibility:visible;display:block}ion-item.selected{--ion-item-background-color-hover:var(--ion-item-background-selected)!important;--ion-item-color-hover:var(--ion-item-color-selected)!important}"]}]}],Bc.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:s.DateAdapter},{type:wa},{type:e.ChangeDetectorRef},{type:P.FormGroupDirective,decorators:[{type:e.Optional}]}]},Bc.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 Vc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"===t},t}();Vc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Vc},token:Vc,providedIn:"root"}),Vc.decorators=[{type:e.Pipe,args:[{name:"isOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var qc=function(){function t(){}return t.prototype.transform=function(t){return"FIELD"!==t},t}();qc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new qc},token:qc,providedIn:"root"}),qc.decorators=[{type:e.Pipe,args:[{name:"isNotOnField"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Uc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?Ts.personsToString(t,e):Ts.personToString(t)},t}();Uc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Uc},token:Uc,providedIn:"root"}),Uc.decorators=[{type:e.Pipe,args:[{name:"personToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var $c=function(){function e(t,e,n,o,r,i,a,s,l){this.modalCtrl=t,this.configService=e,this.toastController=n,this.alertController=o,this.translate=r,this.cd=i,this.platform=a,this.network=s,this.environment=l,this._subscription=new D.Subscription,this.loading=!0,this.hasDownloader=!1,this.downloading=!1,this.waitingNetwork=!1,this.showUpgradeWarning=!0,this.showOfflineWarning=!0,this.showInstallButton=!1}return e.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(pe)).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())})))},e.prototype.ngOnDestroy=function(){this._subscription.unsubscribe(),this._subscription=null,this.installLinks=null,this.upgradeLinks=null},e.prototype.download=function(t,e){return re(this,void 0,void 0,(function(){var t=this;return ie(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(n){t.platform.canOpenFile&&(e.location=n),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])}))}))},e.prototype.openFile=function(t,e){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(n){switch(n.label){case 0:if(!e||!e.location||!e.mimeType)return console.error("[install-upgrade-card] Missing required argument 'link.location' or 'link.mimeType'"),[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.platform.openFile(e.location,e.mimeType)];case 2:return n.sent(),[3,4];case 3:return t=n.sent(),console.error("[install-upgrade-card] Cannot open file: "+(t&&t.message||t),t),[3,4];case 4:return[2]}}))}))},e.prototype.tryOnline=function(){return re(this,void 0,void 0,(function(){return ie(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]}}))}))},e.prototype.getPlatformName=function(t){switch(t){case"android":return"Android";case"ios":return"iOS";default:return""}},e.prototype.asLink=function(t){return t},e.prototype.checkNeedInstallOrUpdate=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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.hasDownloader=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),fe(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),fe(this.installLinks)?(console.info("[install-upgrade-card] Find install links "+this.installLinks.map((function(t){return t.url})).join(",")),[4,Be(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]}}))}))},e.prototype.getCompatibleInstallLinks=function(t){if(!this.platform.isCordova())return this.platform.isMobileWeb()?t:void 0},e.prototype.getCompatibleUpgradeLinks=function(t,e){var n=this,o=this.environment.version,r=e.getProperty(xl.APP_MIN_VERSION);if(o){if(r&&!pa.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})),fe(i)?i:void 0}}else console.error("Missing value for 'environment.version': cannot check app compatibility!")},e.prototype.getLinks=function(e){var n=[],o=e.getProperty(xl.ANDROID_INSTALL_URL);de(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(xl.APP_MIN_VERSION),a=he(o)&&e.label||this.environment.defaultAppName||"SUMARiS";if(o){var s=void 0,l=void 0,c=Vl.getFilename(o),u=i||"latest";if(null==c?void 0:c.toLowerCase().endsWith(".apk")){l=jl.ANDROID_APK;var d=/-v([1-9][0-9]*\.[0-9]+\.(:?(:?alpha|beta|rc)?[0-9]*))/i.exec(c);u=d&&d[1]||u,he(a)&&"latest"!==u?(c=(a+"-v"+u+".apk").toLowerCase(),s=a+" v"+u):c.indexOf("latest")&&"latest"!==u&&(c=c.replace("latest",u))}n.push({name:a,url:o,platform:"android",version:u,filename:c,title:s,mimeType:l})}return n},e.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(t){e.location=t,e.downloading=!1})).catch((function(){return e.downloading=!1})).then((function(){return t.markForCheck()})))}))},e.prototype.listenDownloadJob=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(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),this.showDownloadCompleteDialog()),[2,n];case 3:throw o=r.sent(),console.error("[install-upgrade-card] Download failed: "+(o&&o.message||o)),this.showDownloadFailedToast(o),o;case 4:return this.downloading=!1,this.markForCheck(),[7];case 5:return[2]}}))}))},e.prototype.showDownloadFailedToast=function(t){return this.showToast({message:"ERROR.DOWNLOAD_FAILED",messageParams:{error:t},type:"error",showCloseButton:!0})},e.prototype.showDownloadCompleteDialog=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(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]}}))}))},e.prototype.markForCheck=function(){this._subscription&&this.cd.markForCheck()},e.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return this._subscription?[4,Ia.show(this.toastController,this.translate,t)]:[2];case 1:return e.sent(),[2]}}))}))},e}();$c.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!-- 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="hasDownloader; else webDownloadButton">\n \x3c!-- Download using platform --\x3e\n <ion-button (click)="download($event, asLink(link))"\n *ngIf="!link.location; else openButton"\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\n \x3c!-- Open APK button --\x3e\n <ng-template #openButton>\n <ion-button *ngIf="link.location"\n (click)="openFile($event, link)"\n color="tertiary" class="ion-float-end" >\n <ion-label translate>COMMON.BTN_INSTALL</ion-label>\n </ion-button>\n </ng-template>\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:[Cn],styles:["ion-text small{font-size:85%}"]}]}],$c.ctorParameters=function(){return[{type:L.ModalController},{type:Pl},{type:L.ToastController},{type:L.AlertController},{type:F.TranslateService},{type:e.ChangeDetectorRef},{type:$l},{type:_a},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},$c.propDecorators={isLogin:[{type:e.Input}],showUpgradeWarning:[{type:e.Input}],showOfflineWarning:[{type:e.Input}],showInstallButton:[{type:e.Input}]};var Gc=function(){function t(){}return t.prototype.transform=function(t){return t&&t.pubkey&&!0},t}();Gc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Gc},token:Gc,providedIn:"root"}),Gc.decorators=[{type:e.Pipe,args:[{name:"isLogin"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Hc=function(){function t(){}return t.prototype.transform=function(t){return As(t)},t}();Hc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Hc},token:Hc,providedIn:"root"}),Hc.decorators=[{type:e.Pipe,args:[{name:"accountToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var zc=function(){function t(){}return t.prototype.transform=function(t,e){return Array.isArray(t)?_s(t,e):Os(t)},t}();zc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new zc},token:zc,providedIn:"root"}),zc.decorators=[{type:e.Pipe,args:[{name:"departmentToString"}]},{type:e.Injectable,args:[{providedIn:"root"}]}];var Wc=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=Ee(this.canCancel,this.cancelOrDeleteClick.observers.length>0),this.canDelete=Ee(this.canDelete,this.cancelOrDeleteClick.observers.length>0),this.canConfirmAndAdd=Ee(this.canConfirmAndAdd,this.confirmAndAddClick.observers.length>0),this.canBackward=Ee(this.canBackward,this.backward.observers.length>0),this.canForward=Ee(this.canForward,this.forward.observers.length>0),ue(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}();Wc.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'}]}],Wc.ctorParameters=function(){return[{type:l.MatTable},{type:e.ChangeDetectorRef}]},Wc.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 Kc=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}();Kc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Kc},token:Kc,providedIn:"root"}),Kc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var Qc=new e.InjectionToken("menuItems"),Yc=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}return t.prototype.ngOnInit=function(){return re(this,void 0,void 0,(function(){var t=this;return ie(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()})),N.map((function(){return t.accountService.isLogin()})),N.distinctUntilChanged()).subscribe((function(e){e?t.onLogin(t.accountService.account):t.onLogout(!0)}))),[2]}}))}))},t.prototype.onLogin=function(t){return re(this,void 0,void 0,(function(){var e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,e=this;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2,this.menu.close("left")]}))}))},t.prototype.openAboutModal=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,this.modalCtrl.create({component:Cc})];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 re(this,void 0,void 0,(function(){return ie(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(xl.MENU_ITEMS);if(he(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 '"+xl.MENU_ITEMS.key+"'. Expected an array of menu item",t)}var o={isLogin:this.isLogin,debug:this._debug},r=e.filter((function(e){return Ec.checkIfVisible(e,t.accountService,t._config,o)})).map((function(e){if(he(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}();Yc.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:[bn],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)}}"]}]}],Yc.ctorParameters=function(){return[{type:$l},{type:yl},{type:W.Router},{type:L.MenuController},{type:L.ModalController},{type:L.AlertController},{type:F.TranslateService},{type:Pl},{type:e.ChangeDetectorRef},{type:Kc},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Inject,args:[Qc]}]}]},Yc.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}]}]};var Xc=function(){};Xc.decorators=[{type:e.NgModule,args:[{imports:[Yl,W.RouterModule,F.TranslateModule],declarations:[Yc],exports:[F.TranslateModule,Yc]}]}];var Jc=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}();Jc.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'}]}],Jc.propDecorators={icon:[{type:e.Input}],matIcon:[{type:e.Input}],matSvgIcon:[{type:e.Input}],color:[{type:e.Input}],ref:[{type:e.Input}]};var Zc=function(){function t(){this.onUpdateClick=new e.EventEmitter}return t.prototype.ngOnDestroy=function(){this.onUpdateClick.complete()},t}();Zc.decorators=[{type:e.Component,args:[{selector:"app-update-offline-mode-card",template:'\n\x3c!-- Update offline feature card--\x3e\n<ion-card color="accent"\n class="main ion-no-margin"\n @slideUpDownAnimation>\n <ion-card-content class="ion-no-padding">\n <ion-grid>\n <ion-row *ngIf="!progressionValue; else progression">\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\n \x3c!-- Update button --\x3e\n <ion-col size="auto">\n <ion-button color="tertiary" class="ion-float-end"\n (click)="onUpdateClick.emit($event)">\n <span translate>NETWORK.BTN_UPDATE</span>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-template #progression>\n <ion-row>\n <ion-col>\n <ion-text class="ion-text-wrap" [innerHTML]="progressionMessage"></ion-text>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <ion-progress-bar [value]="progressionValue / 100"></ion-progress-bar>\n </ion-col>\n </ion-row>\n </ng-template>\n </ion-grid>\n\n\n </ion-card-content>\n</ion-card>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[Cn],styles:["ion-text small{font-size:85%}"]}]}],Zc.ctorParameters=function(){return[]},Zc.propDecorators={progressionMessage:[{type:e.Input}],progressionValue:[{type:e.Input}],onUpdateClick:[{type:e.Output}]};var tu=function(){function t(){}return t.forRoot=function(){return console.info("[core] Creating module (root)"),{ngModule:t,providers:[$l]}},t}();tu.decorators=[{type:e.NgModule,args:[{imports:[Yl,W.RouterModule,Q.HttpClientModule,dt.CacheModule,st.IonicStorageModule,Ft.NgxJdenticonModule,Mc,Xc],declarations:[Vc,qc,Uc,Gc,Hc,zc,xc,Cc,gc,bc,Nc,fc,Oc,Tc,Lc,fa,$c,Zc,Dc,Wc,Ac,Pc,jc,Bc,Jc,rc,oc],exports:[Yl,W.RouterModule,Mc,Xc,Vc,qc,Uc,Gc,Hc,xc,gc,bc,Dc,Wc,Ac,Pc,Cc,jc,Bc,$c,Zc,zc,Jc,rc,oc]}]}];var eu=$t,nu=Kt,ou=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 re(e,void 0,void 0,(function(){var e,o=this;return ie(this,(function(r){switch(r.label){case 0:return[4,this.modalCtrl.create({component:bc,componentProps:{next:t}})];case 1:return(e=r.sent()).onDidDismiss().then((function(){o.accountService.isLogin()?n(!0):n(!1)})),[2,e.present()]}}))}))}))},t}();ou.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ou(e.ɵɵinject(yl),e.ɵɵinject(L.ModalController),e.ɵɵinject(W.Router),e.ɵɵinject(Qt))},token:ou,providedIn:"root"}),ou.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ou.ctorParameters=function(){return[{type:yl},{type:L.ModalController},{type:W.Router},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]};var ru=function(t){function e(e,n,o,r,i){var a=t.call(this,e,aa)||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 ia.equals(t,e,"id")},a.isNewFn=i.isNewFn||function(t){return ia.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=!aa.production,a}return ne(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:Va,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 re(this,void 0,void 0,(function(){var n,o;return ie(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:Va,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:Va,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 re(this,void 0,void 0,(function(){var a,s,l,c,u,d,p,h,m,f,g,b=this;return ie(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:Va,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||m.length},c&&(g=(t||0)+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 re(this,void 0,void 0,(function(){return ie(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:Va,message:"ERROR.COUNT_DATA_ERROR"},fetchPolicy:e&&e.fetchPolicy||"network-only"})];case 3:return[2,o.sent().total]}}))}))},e.prototype.canUserWrite=function(t,e){return!!t},e.prototype.saveAll=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:if(ge(t))return[2,t];if(!this.mutations.saveAll){if(!this.mutations.save)throw new Error("Not implemented");return[2,cn((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:qa,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 re(this,void 0,void 0,(function(){var n,o,r,i,a=this;return ie(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:qa,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 re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:if(!this.mutations.deleteAll){if(!this.mutations.delete)throw new Error("Not implemented");return[2,cn((t||[]).map((function(t){return function(){return r.delete(t,e)}})))]}return ge(t=t&&t.filter((function(t){return pe(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:Ua,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 re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(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||ue(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:Ua,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(ue(t))throw Error("Missing argument 'id' ");if(!this.subscriptions.listenChanges)return console.warn(this.constructor.name+".listenChanges() not implemented yet. Will empty observable"),D.of();var o=e&&e.variables||{id:t,interval:we(e&&e.interval,0)};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,fetchPolicy:e&&e.fetchPolicy||"no-cache",variables:o,error:{code:$a,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&&ia.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 sc.fromObject(t,this.filterType)},e.prototype.ngOnStart=function(){return re(this,void 0,void 0,(function(){return ie(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(pe)},e}($s);ru.decorators=[{type:e.Directive}],ru.ctorParameters=function(){return[{type:Vs},{type:$l},{type:Function},{type:Function},{type:void 0}]};var iu=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){ar.logFormErrors(t.validator,e)},t}(),au=function(){},su=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._fetchMoreFn=null,i.loadingSubject=new D.BehaviorSubject(void 0),i._options=Object.assign({dataServiceOptions:{},debug:r&&!1===r.suppressErrors,keepOriginalDataAfterConfirm:!1},r),i._useValidator=pe(o),i._logTypeName=_e((new e).__typename||"UnknownVO","VO"),i._debug=!0===i._options.debug,i}return ne(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._fetchMoreFn=null,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||[]),i._fetchMoreFn=t.fetchMore),t})))},e.prototype.save=function(){return re(this,void 0,void 0,(function(){var t,e,n,o,r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:if(Ee(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=Ee(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 iu.logRowErrors(t,"[table-datasource] "+a._logTypeName+" row #"+t.id)})),{code:Ha,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 sn(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}));fe(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 ln(this.connect(null))},e.prototype.asyncCreateNew=function(e){var n=Object.create(null,{createNew:{get:function(){return t.prototype.createNew}}});return re(this,void 0,void 0,(function(){var t,o,r;return ie(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.getData=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){switch(e.label){case 0:return[4,this.getRows()];case 1:return t=e.sent(),[2,this.getDataFromRows(t)]}}))}))},e.prototype.fetchMore=function(e){var n=Object.create(null,{updateDatasource:{get:function(){return t.prototype.updateDatasource}}});return re(this,void 0,void 0,(function(){var t,o,r;return ie(this,(function(i){switch(i.label){case 0:return this._fetchMoreFn?this._editingRowCount>0?(console.warn("Cannot fetch more because still editing row"),[2]):(t=this._fetchMoreFn,this._fetchMoreFn=null,[4,t()]):[2,!1];case 1:return fe(null==(o=i.sent())?void 0:o.data)?[2,!1]:[4,this.getData()];case 2:return r=i.sent(),n.updateDatasource.call(this,r.concat.apply(r,le(o.data)),e),this._fetchMoreFn=o.fetchMore,[2,!0]}}))}))},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}(Nt.TableDataSource);su.decorators=[{type:e.Directive}],su.ctorParameters=function(){return[{type:Function},{type:void 0},{type:Nt.ValidatorService},{type:au}]};var lu="displayColumns",cu="sortedColumn",uu="filter",du="pageSize",pu=[20,50,100,200,500],hu=["select","id"],mu=["actions"],fu=["id"],gu=function(){},bu=function(){function t(t,o,r,i){var a=this;this.columns=o,this._dataSource=r,this._filter=i,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 Mt.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=pu,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=hn(),this.onBeforeCancelRows=hn(),this.onBeforeSave=hn(),this.onAfterDeletedRows=new e.EventEmitter,this.onSort=new e.EventEmitter,this.onDirty=new e.EventEmitter,this.onError=new e.EventEmitter,this._paginator=null,this.route=t.get(W.ActivatedRoute),this.router=t.get(W.Router),this.location=t.get(n.Location),this.settings=t.get(wa),this.translate=t.get(F.TranslateService),this.modalCtrl=t.get(L.ModalController),this.alertCtrl=t.get(L.AlertController),this.toastController=t.get(L.ToastController),this.formErrorAdapter=t.get(dr),this.mobile=this.settings.mobile,this._autocompleteConfigHolder=new Pn({getUserAttributes:function(t,e){return a.settings.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[hu.length]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastUserColumn",{get:function(){return this.displayedColumns[this.displayedColumns.length-mu.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.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=Ee(this.readOnly,!1),this.inlineEdition=!this.readOnly&&Ee(this.inlineEdition,!1),this.saveBeforeDelete=Ee(this.saveBeforeDelete,!this.readOnly),this.saveBeforeSort=Ee(this.saveBeforeSort,!this.readOnly),this.saveBeforeFilter=Ee(this.saveBeforeFilter,!this.readOnly),this.keepEditedRowOnSave=Ee(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(null==t?void 0: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.filter((function(){return!t.sort.disabled})),N.mergeMap((function(){return re(t,void 0,void 0,(function(){return ie(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,cu)})))||D.EMPTY,this.paginator&&this.paginator.page.pipe(N.mergeMap((function(){return re(t,void 0,void 0,(function(){return ie(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,du)})))||D.EMPTY).subscribe((function(e){t.onSort.emit(),t.onRefresh.emit(e)})),this.sort&&this.paginator&&this.registerSubscription(this.sort.sortChange.pipe(N.filter((function(){return!t.sort.disabled}))).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.readySubject.unsubscribe(),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 re(this,void 0,void 0,(function(){return ie(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=pe(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){var n,o=this;return e=e||this.editedRow,this.confirmEditCreate(t,e)?(this.editRowById(t,e.id+1,{focusColumn:this.firstUserColumn}),!0):!!(null===(n=e.validator)||void 0===n?void 0:n.pending)&&ar.waitWhilePending(e.validator).then((function(){return o.confirmAndForward(t,e)}))},t.prototype.editRowById=function(t,e,n){return re(this,void 0,void 0,(function(){var o;return ie(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 ar.waitWhilePending(e.validator).then((function(){return o.confirmEditCreate(t,e)})),!1;if(this.debug&&(console.warn("[table] Cannot confirm row, because invalid"),ar.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):e.editing?this.cancelExistingRow(t,e,n):this.deleteExistingRow(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,o,r;return re(this,void 0,void 0,(function(){var i,a,s;return ie(this,(function(l){switch(l.label){case 0:if(t=Object.assign({keepEditing:this.keepEditedRowOnSave},t),this.readOnly)throw{code:za,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)||(null===(n=this.singleSelectedRow)||void 0===n?void 0:n.id):void 0,i=t.keepEditing?pe(this.previouslyEditedRowId)&&(null===(o=this.editedRow)||void 0===o?void 0:o.currentData)||(null===(r=this.singleSelectedRow)||void 0===r?void 0:r.currentData):void 0,!this.confirmEditCreate())throw{code:Ha,message:"ERROR.TABLE_INVALID_ROW_ERROR"};this.markAsSaving(),l.label=1;case 1:return l.trys.push([1,3,4,7]),this.debug&&console.debug("[table] Calling dataSource.save()..."),[4,this._dataSource.save()];case 2:return(a=l.sent())&&this.markAsPristine(),[2,a];case 3:throw s=l.sent(),this.setError(s&&s.message||s),s;case 4:return this.markAsSaved(),pe(this.previouslyEditedRowId)?[4,this.selectRowByIdOrData(this.previouslyEditedRowId,i)]:[3,6];case 5:l.sent(),l.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 re(this,void 0,void 0,(function(){var r,i,a;return ie(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 re(this,void 0,void 0,(function(){var t=this;return ie(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 re(this,void 0,void 0,(function(){return ie(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){var o;return re(this,void 0,void 0,(function(){var r,i,a=this;return ie(this,(function(s){switch(s.label){case 0:if(this.readOnly)throw{code:za,message:"ERROR.TABLE_READ_ONLY"};return(null==t?void 0:t.defaultPrevented)?[2,0]:(null==t||t.preventDefault(),!this._enabled||ge(e)?[2,0]:!this.loading||n&&!1===n.skipIfLoading?-1!==(null===(o=this.editedRow)||void 0===o?void 0:o.id)||!this.editedRow.editing||e.includes(this.editedRow)||this.confirmEditCreate()?[4,this.canDeleteRows(e,n)]:[2,0]:(console.warn("[app-table] Skip deleteRows() because table is busy (loading). Use opts.skipLoading = false to force deletion"),[2,0]));case 1:return s.sent()?(e=e.slice().sort((function(t,e){return t.id>e.id?-1:1})),this.saveBeforeDelete&&fe(e=e.filter((function(t){if(t.validator&&!t.validator.valid){if(-1===t.id||!t.editing)return t.delete(),a.visibleRowCount--,a.totalRowCount--,!1;t.cancelOrDelete(),a.checkIfRowPristine(t,{emitEvent:!1,onlySelf:!0})}return!0})))?[4,this.saveBeforeAction("delete")]:[3,3]):[2,0];case 2:if(!s.sent())return[2];s.label=3;case 3:return s.trys.push([3,6,,7]),(r=e.length)?(this.debug&&console.debug("[table] Delete selected rows..."),[4,this._dataSource.deleteAll(e)]):[3,5];case 4:s.sent(),s.label=5;case 5:return this.selection.clear(),this.editedRow=void 0,this.markAsDirty({emitEvent:!1}),this.markForCheck(),r&&this.onAfterDeletedRows.next(e),[2,r];case 6:throw i=s.sent(),this.setError(i&&i.message||i),i;case 7:return[2]}}))}))},t.prototype.selectRowById=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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)]:[2,!1]}}))}))},t.prototype.selectRowByData=function(t){return re(this,void 0,void 0,(function(){var e,n=this;return ie(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(e=(o.sent()||[]).find((function(e){return n.equals(e.currentData,t)})))?[2,this.clickRow(null,e)]:[2,!1]}}))}))},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()})).catch((function(){return n.markAsLoaded()})),!0))},t.prototype.moveRow=function(t,e){this.dataSource.move(t,e)},t.prototype.ready=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,an(this.readySubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.waitIdle=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return[4,sn(this.loadingSubject)];case 1:return t.sent(),[2]}}))}))},t.prototype.openSelectColumnsModal=function(t){return re(this,void 0,void 0,(function(){var t,e,n,o,r;return ie(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:Dc,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=hu.concat(r).concat(mu),this.markForCheck(),[4,this.settings.savePageSetting(this.settingsId,r,lu)]):[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 re(e,void 0,void 0,(function(){return ie(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(hu.length).filter((function(e){return-1===t.displayedColumns.indexOf(e)}));return this.displayedColumns.concat(e).filter((function(e){return!hu.includes(e)&&!mu.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){var n=this;if((e=e||this.editedRow)&&e.editing){if(t&&(t.preventDefault(),t.stopPropagation()),-1===e.id){if(e.validator){if(e.validator.pending)return void ar.waitWhilePending(e.validator).then((function(){return n.escapeEditingRow(t,e)}));if(e.validator.invalid)return void this.deleteNewRow(t,e)}}else if(this.confirmBeforeCancel)return void 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 re(this,void 0,void 0,(function(){var n;return ie(this,(function(o){switch(o.label){case 0:!1,o.label=1;case 1:return o.trys.push([1,6,,7]),pe(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 re(this,void 0,void 0,(function(){var n;return ie(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,fn(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 re(this,void 0,void 0,(function(){var n,o;return ie(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(ge(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,fn(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 re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(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,fn(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 re(this,void 0,void 0,(function(){return ie(this,(function(n){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]):ue(t)?(console.warn("[table] Opening row details, but data has no id!"),[2,!1]):[2,this.router.navigate([".",t.toString()],{relativeTo:this.route,queryParams:{}})]):[2,!1]}))}))},t.prototype.openNewRowDetail=function(t){return re(this,void 0,void 0,(function(){return ie(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 fu},t.prototype.getUserColumns=function(){return this.settings.getPageSettings(this.settingsId,lu)},t.prototype.getSortedColumn=function(){var t=this.settings.getPageSettings(this.settingsId,cu),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,du)||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 hu.includes(t)})),o=this.columns.filter((function(t){return mu.includes(t)}));return(e=e.filter((function(e){return!n.includes(e)&&!o.includes(e)&&t.columns.includes(e)}))).push.apply(e,le(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||"")+ke(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(n){return this.undoableDeletion?[2,Xl.askConfirmation(1===(null==e?void 0:e.length)?"CONFIRM.DELETE_ROW":"CONFIRM.DELETE_ROWS",this.alertCtrl,this.translate,t)]:[2,Xl.askActionConfirmation(this.alertCtrl,this.translate,!0,t)]}))}))},t.prototype.askCancelConfirmation=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(n){return[2,Xl.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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,Xl.askActionConfirmation(this.alertCtrl,this.translate,!1,t)]}))}))},t.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[2,Ia.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.translateFormErrors(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 ia.equals(t,e,"id")},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.setLoading=function(t,e){this.loadingSubject.value!==t&&(this.loadingSubject.next(t),e&&!1===e.emitEvent||this.markForCheck())},t.prototype.deleteNewRow=function(t,e){if(-1!==e.id)throw new Error("Row must have id = -1");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.deleteExistingRow=function(t,e,n){if(-1===e.id)throw new Error("Row must have an id");if(null==t?void 0:t.defaultPrevented)return 0;null==t||t.preventDefault(),this.deleteRow(null,e,n)},t.prototype.cancelExistingRow=function(t,e,n){var o,r=this;if(-1===e.id||!e.editing)throw new Error("Row cannot be canceling, but only deleting");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&&r.cancelExistingRow(t,e,{interactive:!1})}));var i=e.editing&&(!n||!1!==n.keepEditing);this.editedRow=void 0,this._dataSource.cancelOrDelete(e),this.onCancelOrDeleteRow.next(e),this.checkIfRowPristine(e),i&&this.editRow(void 0,e)},t.prototype.checkIfRowPristine=function(t,e){var n,o;return re(this,void 0,void 0,(function(){return ie(this,(function(r){switch(r.label){case 0:return!0===(null===(n=this.dataSource)||void 0===n?void 0:n.options.keepOriginalDataAfterConfirm)?(null===(o=t.validator)||void 0===o||o.markAsPristine(),e&&!0===e.onlySelf?[3,2]:[4,this.checkIfPristine(e)]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.checkIfPristine=function(t){return re(this,void 0,void 0,(function(){var e;return ie(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 !");pe(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&&ar.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}();bu.decorators=[{type:e.Directive}],bu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:su},{type:void 0}]},bu.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 yu=function(){},vu=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._$ready=new D.BehaviorSubject(!1),this._$loading=new D.BehaviorSubject(!0),this.debug=!1,this.submitted=!1,this.toolbar=null,this.formButtonsBar=null}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,"tables",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof bu}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forms",{get:function(){return this._children&&this._children.filter((function(t){return t instanceof nc}))},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.value||-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(),this._$ready.complete(),this._$ready.unsubscribe(),this._$loading.complete(),this._$loading.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 rr(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,pn(this._$ready,t)]}))}))},t.prototype.waitIdle=function(t){return ar.waitIdle(this,t)},t.prototype.cancel=function(t){return re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return console.debug("[tab-page] Unloading data..."),this.markAsLoading(),this._children.forEach((function(e){e instanceof nc?e.reset(null,t):e instanceof bu&&e.dataSource.disconnect()})),[2]}))}))},t.prototype.reloadWithConfirmation=function(t){return re(this,void 0,void 0,(function(){var e,n,o;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){return t=we(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 re(this,void 0,void 0,(function(){var n,o,r,i;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,Ia.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)ar.logFormErrors(e,n,o);else if(e instanceof rr)e.empty||e.valid||e.waitDelegate({timeout:1e3}).then((function(t){return r.logChildrenFormErrors(t,n,"provider")}));else if(e instanceof bu){if(e.invalid&&e.editedRow&&e.editedRow.validator){var i=e.constructor.name.toLowerCase();ar.logFormErrors(e.editedRow.validator,n,i)}}else if(e instanceof nc){if(!e.empty&&!e.valid)if(e.pending){var a=e.constructor.name.toLowerCase();console.warn(n+" -> "+a+": waiting while pending..."),ar.waitWhilePending(e,{timeout:1e3}).then((function(){return r.logChildrenFormErrors(e.form,n,a)}))}else ar.logFormErrors(e.form,n)}else console.warn(n+" Unknown children sub-form: ",e)},t.prototype.markForCheck=function(){},t}();vu.decorators=[{type:e.Directive}],vu.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.AlertController},{type:F.TranslateService}]},vu.propDecorators={toolbar:[{type:e.ViewChild,args:[xi]}],formButtonsBar:[{type:e.ViewChild,args:[Rc,{static:!0}]}],content:[{type:e.ViewChild,args:[L.IonContent,{static:!0}]}]};var Cu=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 ne(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,pe(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&&pe(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 re(this,void 0,void 0,(function(){return ie(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}(vu);Cu.decorators=[{type:e.Directive}],Cu.ctorParameters=function(){return[{type:W.ActivatedRoute},{type:W.Router},{type:L.AlertController},{type:F.TranslateService},{type:yu,decorators:[{type:e.Optional}]}]},Cu.propDecorators={queryTabIndexParamName:[{type:e.Input}],selectedTabIndex:[{type:e.Input}],selectedTabIndexChange:[{type:e.Output}],tabGroup:[{type:e.ViewChild,args:["tabGroup",{static:!0}]}]};var Eu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e}(yu),wu=function(t){function n(n,o,r,i){var a,s,l=this;return(l=t.call(this,n.get(W.ActivatedRoute),n.get(W.Router),n.get(L.AlertController),n.get(F.TranslateService),i)||this).dataType=o,l.dataService=r,l.saving=!1,l.$title=new D.Subject,l.onUpdateView=new e.EventEmitter,l.environement=n.get(Qt),i=Object.assign({enableListenChanges:(null===(a=l.environement.entityEditor)||void 0===a?void 0:a.enableListenChanges)||!1,listenIntervalInSeconds:we(null===(s=l.environement.entityEditor)||void 0===s?void 0:s.listenIntervalInSeconds,0),pathIdAttribute:"id",autoLoad:!0,autoUpdateRoute:!0,i18nPrefix:""},i),l.settings=n.get(wa),l.errorTranslator=n.get(dr),l.cd=n.get(e.ChangeDetectorRef),l.dateFormat=n.get(Fn),l.toastController=n.get(L.ToastController),l._enableListenChanges=i.enableListenChanges,l._listenIntervalInSeconds=i.listenIntervalInSeconds,l._pathIdAttribute=i.pathIdAttribute,l._autoLoad=i.autoLoad,l._autoLoadDelay=i.autoLoadDelay,l._autoUpdateRoute=i.autoUpdateRoute,l._autoOpenNextTab=i.autoOpenNextTab,l.i18nContext={prefix:i.i18nPrefix,suffix:""},l}return ne(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 ue(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=Ee(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._listenChangesSubscription=null,this.$title.complete(),this.$title.unsubscribe(),this.onUpdateView.complete(),this.onUpdateView.unsubscribe()},n.prototype.waitIdle=function(e){var n=this;return this.saving?dn((function(){return!0!==n.saving})):t.prototype.waitIdle.call(this,e)},n.prototype.loadFromRoute=function(){var t=this.route.snapshot;if(!t||de(this._pathIdAttribute))throw new Error("Unable to load from route: missing 'route' or 'options.pathIdAttribute'.");var e=t.params[this._pathIdAttribute];return ue(e)||"new"===e?this.load(void 0,t.params):(De(e)&&(e=parseInt(e)),this.load(e,t.params))},n.prototype.load=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r;return ie(this,(function(i){switch(i.label){case 0:if(!this.dataService)throw new Error("Cannot load data: missing 'dataService'!");if(this.resetError(),!ue(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,{emitEvent:!1}),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:Ga,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.canUserWrite=function(t,e){return this.dataService.canUserWrite(t,e)},n.prototype.startListenRemoteChanges=function(){var t=this;!this._listenChangesSubscription&&this._enableListenChanges&&(this.isNewData||ia.isLocal(this.data)||(this._listenChangesSubscription=this.listenChanges(this.data.id,{interval:this._listenIntervalInSeconds}).pipe(N.filter(pe)).subscribe((function(e){j.isMoment(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.showToast({message:"ERROR.DATA_UPDATE_DATE_CHANGED",type:"warning",showCloseButton:!0})):(t.debug&&console.debug("[data-editor] Changes detected on server, at {"+e.updateDate+"}: reloading page..."),t.reload()))})),this._listenChangesSubscription.add((function(){return t._listenChangesSubscription=null})),this.registerSubscription(this._listenChangesSubscription)))},n.prototype.stopListenRemoteChanges=function(){this._listenChangesSubscription&&(this.unregisterSubscription(this._listenChangesSubscription),this._listenChangesSubscription.unsubscribe(),this._listenChangesSubscription=null)},n.prototype.updateView=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return n=pe(t.id)&&void 0!==this.previousDataId&&this.previousDataId!==t.id,e=Object.assign({updateRoute:this._autoUpdateRoute&&n&&!this.loading,openTabIndex:this._autoOpenNextTab&&n&&ue(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 re(this,void 0,void 0,(function(){var n;return ie(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&&pe(t.id)?t.id:"new",t&&pe(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){pe(t)&&t>this.selectedTabIndex&&(this.selectedTabIndex=t,this.markForCheck())},n.prototype.saveAndClose=function(t,e){return re(this,void 0,void 0,(function(){var e;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var t,n,o;return ie(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.resetError(),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._listenChangesSubscription||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===ns&&pe(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 re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return this.valid?[3,2]:[4,ar.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 re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return this.loading||this.saving?[2,!1]:[4,Xl.askDeleteConfirmation(this.alertCtrl,this.translate)];case 1:if(!r.sent())return[2];console.debug("[data-editor] Asking to delete..."),this.markAsSaving(),this.resetError(),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(){var t;return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:return this.markAsLoading(),[4,this.load(null===(t=this.data)||void 0===t?void 0:t.id)];case 1:return e.sent(),[2]}}))}))},n.prototype.unload=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return this.stopListenRemoteChanges(),this.form.reset(),this.registerForms(),this._dirty=!1,this.data=null,this.saving=!1,[2]}))}))},n.prototype.goBack=function(t){var e;return re(this,void 0,void 0,(function(){return ie(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.resetError=function(t){he(this.error)&&(this.error=null,t&&!1===t.emitEvent||this.markForCheck())},n.prototype.setError=function(t,e){if(t)if("string"==typeof t)console.error("[entity-editor] Error: "+(t||"")),this.error=t;else{console.error("[entity-editor] Error: "+t.message||"",t);var n=t.message&&this.translate.instant(t.message)||t,o=t.details&&"string"!=typeof t.details?t.details.message:t.details;if(he(o))n+='<br/><small class="'+((null==e?void 0:e.detailsCssClass)||"hidden-xs hidden-sm")+'" title="'+o+'">',n+=o.length<70?o:o.substring(0,67)+"...",n+="</small>";this.error=n}else this.error=void 0;e&&!1===e.emitEvent||this.markForCheck()},n.prototype.computeNextTabIndex=function(){var t=this.selectedTabIndex+1;return t<this.tabCount?t:void 0},n.prototype.onBeforeEntityLoad=function(){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onNewEntity=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntityLoaded=function(t,e){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntitySaved=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.onEntityDeleted=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2]}))}))},n.prototype.computeUsageMode=function(t){return this.settings.isUsageMode("FIELD")?"FIELD":"DESK"},n.prototype.waitWhilePending=function(t){return ar.waitWhilePending(this,t)},n.prototype.getValue=function(){return re(this,void 0,void 0,(function(){var t,e;return ie(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 re(this,void 0,void 0,(function(){var e,n;return ie(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,{title:t,path:this.router.url}]}))}))},n.prototype.removePageHistory=function(t){return re(this,void 0,void 0,(function(){return ie(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.listenChanges=function(t,e){return this.dataService.listenChanges(this.data.id,Object.assign({fetchPolicy:"no-cache"},e))},n.prototype.markForCheck=function(){var t;null===(t=this.cd)||void 0===t||t.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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){switch(o.label){case 0:return e=this.computePageUrl(pe(t.id)?t.id:"new"),fe(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}(Cu);wu.decorators=[{type:e.Directive}],wu.ctorParameters=function(){return[{type:e.Injector},{type:Function},{type:void 0},{type:Eu,decorators:[{type:e.Optional}]}]};var Iu=function(t){function e(e,n,o,r,i,a,s){var l=t.call(this,e,n,new su(o,r,i,a),s)||this;return l.columns=n,l.dataType=o,l.memoryDataService=r,l.validatorService=i,l.canEdit=!1,l.canDelete=!1,l.autoLoad=!1,l}return ne(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}(bu);Iu.decorators=[{type:e.Directive}],Iu.ctorParameters=function(){return[{type:e.Injector},{type:Array},{type:Function},{type:lc},{type:Nt.ValidatorService},{type:au},{type:void 0}]},Iu.propDecorators={canEdit:[{type:e.Input}],canDelete:[{type:e.Input}]};var xu,Ou={LOAD_USER_EVENTS_ERROR:5e4,SAVE_USER_EVENT_ERROR:50001,SEND_MESSAGE_ERROR:50003},_u={DEBUG_DATA:"DEBUG_DATA",INBOX_MESSAGE:"INBOX_MESSAGE"};t.UserEvent=xu=function(t){function e(){return t.call(this,xu.TYPENAME)||this}return ne(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}(na),t.UserEvent=xu=oe([la({typename:"UserEventVO"})],t.UserEvent);var ku,Su,Tu={userEvent:yt.gql(ku||(ku=ce(["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(Su||(Su=ce(["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,le(arguments))||this;return e.issuer=null,e.recipient=null,e}return ne(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}(ac),t.UserEventFilter=oe([la({typename:"UserEventFilterVO"})],t.UserEventFilter);var Au,Ru,Pu,Du,Nu=yt.gql(Au||(Au=ce(["\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"])),Tu.userEvent),Mu=yt.gql(Ru||(Ru=ce(["\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"])),Tu.lightUserEvent),Fu=yt.gql(Pu||(Pu=ce(["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"],["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n"]))),Lu=yt.gql(Du||(Du=ce(["\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"])),Tu.userEvent),ju=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&&!a.production,s}return ne(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),de((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?Lu:Mu,variables:{page:Object.assign(Object.assign({sortBy:"updateDate"},e),{sortDirection:(e.sortDirection||"DESC").toUpperCase()}),filter:n&&n.asPodObject()},arrayFieldName:"data",error:{code:Ou.LOAD_USER_EVENTS_ERROR,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&&we(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 re(this,void 0,void 0,(function(){var e,n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return this.fillDefaultProperties(t),e=ue(t.id),n=t.asObject(),o=Date.now(),this._debug&&console.debug("[user-event-service] Saving user event...",n),[4,this.graphql.mutate({mutation:Nu,variables:{data:n},error:{code:Ou.SAVE_USER_EVENT_ERROR,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:Mu,data:Object.assign(Object.assign({},s),{content:null})}),r.insertIntoMutableCachedQueries(n,{query:Lu,data:s})))}})];case 1:return i.sent(),[2,t]}}))}))},n.prototype.deleteAll=function(t,e){return re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return ge(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:Fu,variables:{ids:e},update:function(t){o.removeFromMutableCachedQueriesByIds(t,{query:Mu,ids:e}),o.removeFromMutableCachedQueriesByIds(t,{query:Lu,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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var e,n,o,r,i;return ie(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=_u.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 na?JSON.stringify(t.asObject({keepTypename:!0,keepLocalId:!0,minify:!1})):JSON.stringify(t):void 0},n.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){switch(e.label){case 0:if(!this.toastController)throw new Error("Missing toastController in component's constructor");return[4,Ia.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){ia.copyIdAndUpdateDate(t,e)},n}($s);ju.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ju(e.ɵɵinject(Vs),e.ɵɵinject(yl),e.ɵɵinject(_a),e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.ToastController),e.ɵɵinject(Qt,8))},token:ju,providedIn:"root"}),ju.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ju.ctorParameters=function(){return[{type:Vs},{type:yl},{type:_a},{type:F.TranslateService},{type:L.ToastController},{type:Yt,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]};var Bu={DEBUG_DATA:{matIcon:"bug_report"},INBOX_MESSAGE:{matIcon:"mail"}},Vu=function(e){function n(t,n,o,r,i,a){var s=e.call(this,t,hu.concat(["creationDate","icon","eventType","message"]).concat(mu),null,null)||this;return s.accountService=n,s.service=o,s.entities=r,s.cd=i,s.environment=a,s.i18nColumnPrefix="SOCIAL.USER_EVENT.",s.autoLoad=!1,s.inlineEdition=!1,s.defaultSortBy="creationDate",s.defaultSortDirection="desc",s}return ne(n,e),n.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this),this.dateTimePattern=this.translate.instant("COMMON.DATE_TIME_PATTERN"),this.withContent=Ee(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 su(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})},n.prototype.start=function(){return re(this,void 0,void 0,(function(){return ie(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]}}))}))},n.prototype.getIcon=function(t){return Bu[t.eventType]},n.prototype.getDetail=function(t){if(t){if(t.content&&t.eventType===_u.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),{}}},n.prototype.doAction=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a;return ie(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]}}))}))},n}(bu);Vu.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.USER_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}"]}]}],Vu.ctorParameters=function(){return[{type:e.Injector},{type:yl},{type:ju},{type:ss},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},Vu.propDecorators={recipient:[{type:e.Input}],withContent:[{type:e.Input}],defaultSortBy:[{type:e.Input}],defaultSortDirection:[{type:e.Input}]};var qu={INBOX_MESSAGE:"INBOX_MESSAGE",EMAIL:"EMAIL",FEED:"FEED"},Uu=Object.freeze([{id:qu.INBOX_MESSAGE,icon:"notifications",label:"SOCIAL.MESSAGE.TYPE_ENUM.INBOX_MESSAGE"},{id:qu.EMAIL,icon:"mail",label:"SOCIAL.MESSAGE.TYPE_ENUM.EMAIL"},{id:qu.FEED,icon:"paper",label:"SOCIAL.MESSAGE.TYPE_ENUM.FEED"}]);t.Message=function(e){function n(){return e.call(this)||this}return ne(n,e),n.prototype.fromObject=function(n,o){e.prototype.fromObject.call(this,n,o),this.type=n.type,this.issuer=n.issuer&&t.Person.fromObject(n.issuer),this.recipients=n.recipients&&n.recipients.map(t.Person.fromObject),this.subject=n.subject,this.body=n.body},n.prototype.asObject=function(t){var n=e.prototype.asObject.call(this,t);return n.recipients=this.recipients&&this.recipients.map((function(e){return e.asObject(t)})),n},n}(na),t.Message=oe([la({typename:"MessageVO"})],t.Message),t.MessageFilter=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n)},e.prototype.buildFilter=function(){return t.prototype.buildFilter.call(this)},e}(ac),t.MessageFilter=oe([la({typename:"MessageFilterVO"})],t.MessageFilter);var $u=function(){function e(t,e,n,o){this.settings=t,this.viewCtrl=e,this.accountService=n,this.cd=o,this.mobile=this.settings.mobile}return e.prototype.ngOnInit=function(){this.canSelectType=Ee(this.canSelectType,this.accountService.isAdmin())},e.prototype.ngAfterViewInit=function(){this.form.markAsReady({emitEvent:!1}),this.data&&(this.data.type=this.data.type||qu.INBOX_MESSAGE,this.form.setValue(this.data)),this.form.markAsLoaded(),this.form.enable()},e.prototype.cancel=function(t){this.viewCtrl.dismiss()},e.prototype.doSubmit=function(e){return re(this,void 0,void 0,(function(){var e,n,o=this;return ie(this,(function(r){switch(r.label){case 0:return this.form.disabled?[2]:this.form.valid?[3,2]:[4,ar.waitWhilePending(this.form)];case 1:if(r.sent(),this.form.invalid)return ar.logFormErrors(this.form.form,"[message-modal] "),this.form.markAllAsTouched(),[2];r.label=2;case 2:this.markAsLoading();try{return e=this.form.value,this.form.disable(),n=t.Message.fromObject(e),[2,this.viewCtrl.dismiss(n)]}catch(t){return this.form.error=t&&t.message||t,this.markAsLoaded(),this.form.enable(),ln(this.form.form.valueChanges).then((function(){o.form.error=null,o.markForCheck()})),[2]}return[2]}}))}))},e.prototype.markForCheck=function(){this.cd.markForCheck()},e.prototype.markAsLoading=function(t){this.form.markAsLoading(t)},e.prototype.markAsLoaded=function(t){this.form.markAsLoaded(t)},e}();$u.decorators=[{type:e.Component,args:[{selector:"app-message-modal",template:'<ion-header>\n <ion-toolbar color="secondary">\n <ion-buttons slot="start">\n <ion-button class="back-button" (click)="cancel($event)" 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 {{\'SOCIAL.MESSAGE.NEW.TITLE\' | translate}}\n </ion-title>\n\n <ion-buttons slot="end">\n\n <ion-button class="back-button" (click)="doSubmit($event)"\n [disabled]="!form.valid"\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 class="ion-padding" >\n\n <ion-item *ngIf="form.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]="form.error|translate"></ion-label>\n </ion-item>\n\n <app-message-form #form (onSubmit)="doSubmit($event)"\n (onCancel)="cancel($event)"\n [canSelectType]="canSelectType"\n [suggestFn]="suggestFn">\n </app-message-form>\n\n</ion-content>\n\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($event)">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n\n <ion-button [fill]="form.invalid ? \'clear\' : \'solid\'"\n [disabled]="form.loading || form.invalid"\n (keyup.enter)="doSubmit($event)"\n (click)="doSubmit($event)" color="tertiary">\n <ion-label translate>COMMON.BTN_SEND</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n\n\n </ion-toolbar>\n</ion-footer>\n',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],$u.ctorParameters=function(){return[{type:wa},{type:L.ModalController},{type:yl},{type:e.ChangeDetectorRef}]},$u.propDecorators={suggestFn:[{type:e.Input}],data:[{type:e.Input}],canSelectType:[{type:e.Input}],form:[{type:e.ViewChild,args:["form",{static:!0}]}]};var Gu=function(t){function e(e,n,o){var r=t.call(this,e)||this;return r.formBuilder=n,r.cd=o,r.subjectMinLength=5,r.subjectMaxLength=255,r.bodyMaxLength=2e3,r.bodyAutoHeight=!0,r.canSelectType=!1,r.types=Uu,r.mobile=r.settings.mobile,r}return ne(e,t),e.prototype.ngOnInit=function(){this.setForm(this.formBuilder.group({type:[qu.INBOX_MESSAGE,P.Validators.required],recipients:[null,P.Validators.required],subject:[null,this.subjectMaxLength?P.Validators.compose([P.Validators.required,P.Validators.minLength(this.subjectMinLength),P.Validators.maxLength(this.subjectMaxLength)]):P.Validators.required],body:[null,this.bodyMaxLength?P.Validators.compose([P.Validators.maxLength(this.bodyMaxLength)]):P.Validators.required]}));var t=this.settings.getFieldDisplayAttributes("person",["lastName","firstName","department.name"]);this.registerAutocompleteField("recipients",{showAllOnFocus:!1,suggestFn:this.suggestFn,filter:{statusIds:[ps.TEMPORARY,ps.ENABLE]},attributes:t,displayWith:Ts.personToString,multiple:!0,mobile:this.mobile})},e.prototype.isSamePerson=function(t,e){return ia.equals(t,e,"id")},e.prototype.markForCheck=function(){this.cd.markForCheck()},e}(nc);Gu.decorators=[{type:e.Component,args:[{selector:"app-message-form",template:'\n\n<form [formGroup]="form" class="form-container">\n\n \x3c!-- type --\x3e\n <mat-form-field *ngIf="canSelectType">\n <mat-select formControlName="type" [placeholder]="\'SOCIAL.MESSAGE.TYPE\'|translate">\n <mat-option *ngFor="let item of types" [value]="item.id">\n <ion-icon [name]="item.icon"></ion-icon>\n {{ item.label |translate }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n \x3c!-- Recipients --\x3e\n <mat-chips-field *ngIf="(form.controls.type.valueChanges|async) !== \'FEED\'"\n formControlName="recipients"\n [placeholder]="\'SOCIAL.MESSAGE.RECIPIENTS\'|translate"\n [config]="autocompleteFields.recipients"\n [equals]="isSamePerson">\n </mat-chips-field>\n\n \x3c!-- Subject --\x3e\n <mat-form-field>\n <input matInput type="text"\n [placeholder]="\'SOCIAL.MESSAGE.SUBJECT\'|translate"\n formControlName="subject"\n autocomplete="off"\n required>\n <mat-error *ngIf="form.controls.subject.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n <mat-error *ngIf="form.controls.subject.hasError(\'minlength\')">\n {{ \'ERROR.FIELD_MIN_LENGTH_COMPACT\'|translate }}\n </mat-error>\n <mat-error *ngIf="form.controls.subject.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH_COMPACT\'|translate }}\n </mat-error>\n <mat-hint *ngIf="subjectMaxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: form.controls.subject.value?.length || 0, max: subjectMaxLength } }}\n </mat-hint>\n </mat-form-field>\n\n \x3c!-- Body --\x3e\n <mat-form-field floatLabel="never">\n <textarea matInput type="text"\n [placeholder]="\'SOCIAL.MESSAGE.BODY_HELP\'|translate"\n formControlName="body"\n [class.fixed-height]="!bodyAutoHeight"\n [cdkTextareaAutosize]="bodyAutoHeight"\n (keydown.control.enter)="doSubmit($event)"\n >\n </textarea>\n <mat-error *ngIf="form.controls.body.hasError(\'maxlength\')">\n {{ \'ERROR.FIELD_MAX_LENGTH\' | translate: form.controls.body.errors.maxlength }}\n </mat-error>\n <mat-hint *ngIf="bodyMaxLength" align="end">\n {{ \'INFO.TEXT_PROGRESS\' | translate: { current: form.controls.body.value?.length || 0, max: bodyMaxLength } }}\n </mat-hint>\n </mat-form-field>\n\n</form>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,styles:["textarea.fixed-height{height:11.5em}textarea{min-height:11.5em}"]}]}],Gu.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]},Gu.propDecorators={suggestFn:[{type:e.Input}],subjectMinLength:[{type:e.Input}],subjectMaxLength:[{type:e.Input}],bodyMaxLength:[{type:e.Input}],bodyAutoHeight:[{type:e.Input}],canSelectType:[{type:e.Input}]};var Hu=function(){};Hu.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,tu,Yl],declarations:[Vu,$u,Gu],exports:[Vu,$u]}]}];var zu,Wu,Ku={send:yt.gql(zu||(zu=ce(["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"],["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"])))},Qu=function(t){function e(e,n,o,r){var i=t.call(this,e,r)||this;return i.graphql=e,i.translate=n,i.toastController=o,i.environment=r,i._debug=!r.production,i}return ne(e,t),e.prototype.send=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i,a,s;return ie(this,(function(l){switch(l.label){case 0:n=t.asObject(xs),o=Date.now(),this._debug&&console.debug("[message-service] Send message...",n),l.label=1;case 1:return l.trys.push([1,5,,8]),[4,this.graphql.mutate({mutation:Ku.send,variables:{data:n},error:{code:Ou.SEND_MESSAGE_ERROR,message:"SOCIAL.ERROR.SEND_MESSAGE_ERROR"}})];case 2:return r=l.sent().done,this._debug&&console.debug("[message-service] Send message [OK] in "+(Date.now()-o)+"ms"),!r||e&&!1===e.showToast?[3,4]:[4,this.showToast({type:"info",message:"SOCIAL.INFO.MESSAGE_SENT"})];case 3:l.sent(),l.label=4;case 4:return[2,r];case 5:return i=l.sent(),a=i&&i.message||i,console.error(a),e&&!1===e.showToast?[3,7]:(s=a||"SOCIAL.ERROR.SEND_MESSAGE_ERROR",[4,this.showToast({type:"error",message:s})]);case 6:l.sent(),l.label=7;case 7:return[2,!1];case 8:return[2]}}))}))},e.prototype.showToast=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(e){return[2,Ia.show(this.toastController,this.translate,Object.assign({type:"info",message:"SOCIAL.INFO.MESSAGE_SENT"},t))]}))}))},e}($s);Qu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Qu(e.ɵɵinject(Vs),e.ɵɵinject(F.TranslateService),e.ɵɵinject(L.ToastController),e.ɵɵinject(Qt,8))},token:Qu,providedIn:"root"}),Qu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Qu.ctorParameters=function(){return[{type:Vs},{type:F.TranslateService},{type:L.ToastController},{type:Yt,decorators:[{type:e.Optional},{type:e.Inject,args:[Qt]}]}]},t.PersonFilter=Wu=function(t){function e(){return t.call(this,Wu.TYPENAME)||this}return ne(e,t),e.searchFilter=function(t){return t&&Wu.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||(pe(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);fe(this.statusIds)&&n.push((function(t){return e.statusIds.includes(t.statusId)})),fe(this.excludedIds)&&n.push((function(t){return ue(t.id)||!e.excludedIds.includes(t.id)}));var o=ia.searchTextFilter(this.searchAttribute||this.searchAttributes||["lastName","firstName","department.name"],this.searchText);return o&&n.push(o),n},e}(ac),t.PersonFilter=Wu=oe([la({typename:"PersonFilterVO"})],t.PersonFilter);var Yu,Xu,Ju,Zu,td,ed={person:yt.gql(Yu||(Yu=ce(["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 }"])))},nd={loadAll:yt.gql(Xu||(Xu=ce(["\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 ",""])),ed.person),loadAllWithTotal:yt.gql(Ju||(Ju=ce(["\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 ",""])),ed.person)},od={saveAll:yt.gql(Zu||(Zu=ce(["\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 ",""])),ed.person),deleteAll:yt.gql(td||(td=ce(["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"],["\n mutation deletePersons($ids:[Int]){\n deletePersons(ids: $ids)\n }"])))},rd=function(e){function n(n,o,r,i){var a=e.call(this,n,o,t.Person,t.PersonFilter,{queries:nd,mutations:od,defaultSortBy:"lastName",defaultSortDirection:"asc"})||this;return a.graphql=n,a.platform=o,a.network=r,a.entities=i,a._debug=!aa.production,a}return ne(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 re(this,void 0,void 0,(function(){return ie(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 re(this,void 0,void 0,(function(){var s,l,c,u;return ie(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 re(this,void 0,void 0,(function(){return ie(this,(function(r){return ia.isNotEmpty(t,"id")?[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||[ps.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 re(this,void 0,void 0,(function(){var e,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return e=n&&n.maxProgression||100,t=Object.assign(Object.assign({},t),{statusIds:[ps.ENABLE,ps.TEMPORARY],userProfiles:["SUPERVISOR","USER","GUEST"]}),console.info("[person-service] Importing persons..."),[4,cc.fetchAllPages((function(e,n){return o.loadAll.call(i,e,n,"id",null,t,{debug:!1,fetchPolicy:"network-only",withTotal:0===e,toEntity:!1})}),{progression:null==n?void 0:n.progression,maxProgression:.9*e})];case 1:return r=a.sent(),[4,this.entities.saveAll(r.data,{entityName:"PersonVO",reset:!0})];case 2:return a.sent(),[2]}}))}))},n.prototype.asObject=function(e){if(e){console.debug("TODO check isInstanceOf"),e instanceof 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}(ru);rd.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new rd(e.ɵɵinject(Vs),e.ɵɵinject($l),e.ɵɵinject(_a),e.ɵɵinject(ss))},token:rd,providedIn:"root"}),rd.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],rd.ctorParameters=function(){return[{type:Vs},{type:$l},{type:_a},{type:ss}]};var id=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,Mo.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}();id.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new id(e.ɵɵinject(P.FormBuilder),e.ɵɵinject(Sc))},token:id,providedIn:"root"}),id.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],id.ctorParameters=function(){return[{type:P.FormBuilder},{type:Sc}]};var ad=function(e){function n(n,o,r,i,a,s,l,c,u){var d=e.call(this,n,hu.concat(["avatar","lastName","firstName","email","profile","status","username","usernameExtranet","pubkey"]).concat(r.additionalFields.map((function(t){return t.key}))).concat(mu),new su(t.Person,s,i,{prependNewElements:!1,suppressErrors:u.production,dataServiceOptions:{saveOnlyDirtyRows:!0}}),null)||this;return d.accountService=r,d.validatorService=i,d.configService=a,d.dataService=s,d.messageService=l,d.cd=c,d.profiles=le(ks).reverse(),d.statusList=bs,d.statusById=ys,d.filterCriteriaCount=0,d.useSticky=!1,d.referentialToString=hs,d.canEdit=r.isAdmin(),d.canSendMessage=d.canEdit,d.inlineEdition=d.canEdit,d.confirmBeforeDelete=!0,d.autoLoad=!1,d.i18nColumnPrefix="USER.",d.defaultSortBy="lastName",d.defaultSortDirection="asc",d.filterForm=o.group({searchText:[null],statusId:[null]}),d.additionalFields=(d.accountService.additionalFields||[]).filter((function(t){return pe(t.autocomplete)})).map((function(t){return t.autocomplete=d.registerAutocompleteField(t.key,Object.assign({},t.autocomplete)),t})),d.debug=!u.production,d}return ne(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(xl.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,uu)}))).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 re(this,void 0,void 0,(function(){var e,n;return ie(this,(function(o){return this.markAsLoading(),console.debug("[users] Restoring filter from settings..."),e=this.settings.getPageSettings(this.settingsId,uu)||{},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.openComposeMessageModal=function(e){return re(this,void 0,void 0,(function(){var e,n,o,r,i=this;return ie(this,(function(a){switch(a.label){case 0:return e=(this.selection.selected||[]).map((function(t){return t.currentData})).map(t.Person.fromObject).map((function(t){var e,n=t.asObject({minify:!0});return n.department=null===(e=t.department)||void 0===e?void 0:e.asObject(),n})),[4,this.modalCtrl.getTop()];case 1:return n=!!a.sent(),[4,this.modalCtrl.create({component:$u,componentProps:{suggestFn:function(t,e,n,o){return i.dataService.suggest(t,e,n,o)},data:{recipients:e}},cssClass:n&&"stack-modal"})];case 2:return[4,(o=a.sent()).present()];case 3:return a.sent(),[4,o.onDidDismiss()];case 4:return(r=a.sent().data)&&r instanceof t.Message?(console.info("[users] received message to send: ",r),[4,this.messageService.send(r)]):[2];case 5:return a.sent(),[2]}}))}))},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(bu);ad.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\n \x3c!-- Compose message --\x3e\n <button mat-icon-button *ngIf="canSendMessage"\n [title]="\'USER.LIST.BTN_SEND_MESSAGE\'|translate"\n (click)="openComposeMessageModal($event)">\n <ion-icon name="mail" slot="icon-only"></ion-icon>\n </button>\n\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\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.valueChanges|async"\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:Nt.ValidatorService,useExisting:id}],animations:[Cn],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}"]}]}],ad.ctorParameters=function(){return[{type:e.Injector},{type:P.FormBuilder},{type:yl},{type:Nt.ValidatorService},{type:Pl},{type:rd},{type:Qu},{type:e.ChangeDetectorRef},{type:void 0,decorators:[{type:e.Inject,args:[Qt]}]}]},ad.propDecorators={useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}]};var sd=function(){console.debug("[admin] Creating module")};sd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,tu,Hu,Ci,Ft.NgxJdenticonModule,F.TranslateModule.forChild()],declarations:[ad],exports:[Hu,ad]}]}],sd.ctorParameters=function(){return[]};var ld=[{path:"users",pathMatch:"full",component:ad,canActivate:[ou],canDeactivate:[Jl],data:{profile:"ADMIN"}}],cd=function(){};cd.decorators=[{type:e.NgModule,args:[{imports:[tc,sd,W.RouterModule.forChild(ld)],exports:[W.RouterModule]}]}];var ud=[{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 dd(t,e){if(ue(e))return(t||ud).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||ud).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var pd=function(){function t(t){this.formBuilder=t,this._items=dd(ud,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,Mo.entity],missingEntity:[null,Mo.entity],disableEntity:[null,Mo.entity],entities:[null,Lo.requiredArrayMinLength(1)],farEntity:[null,Mo.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: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:ud.slice(),attributes:["label","name","description","comments"],displayWith:this.entityToString}),this.autocompleteFields.add("entity-far",{suggestFn:function(e,n){return t.suggest(e,n)},attributes:["label","name"],displayWith:this.entityToString}),this.autocompleteFields.add("entities-items-filter",{service:{suggest:function(e,n){return t.suggest(e,n)}},attributes:["label","name"],multiple:!0})},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){t.farEntityField.suggestLengthThreshold=2,t.farEntityField.reloadItems()}),2e3),setTimeout((function(){return t.loadData()}),1e3)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e=this;return ie(this,(function(n){return t={entity:dd(ud)[0],farEntity:dd(ud)[2],missingEntity:{id:-1,label:"??",name:"Missing item"},disableEntity:dd(ud)[2],entities:dd(ud)},this.form.setValue(t),setTimeout((function(){return e.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return re(this,void 0,void 0,(function(){return ie(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(pe).join(" - ")},t.prototype.entitiesToString=function(t){return(t||[]).map(this.entityToString).join(", ")},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=Te(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 re(i,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,Be(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.equals=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,e){var n=this.autocompleteFields.get(e).filter||{};n.searchAttribute=n&&"name"===n.searchAttribute?"label":"name",t.reloadItems()},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();pd.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 [equals]="equals"\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 Entity far in the list (not in first page)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small>\n <pre style="white-space: normal !important;">value: {{stringify(form.controls.farEntity.value)}}</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="farEntity" #farEntityField\n [config]="autocompleteFields.get(\'entity-far\')"\n [mobile]="true"\n [equals]="equals"\n [logPrefix]="\'[combo-mobile-far]\'"\n [debug]="true"\n [required]="true"\n [clearable]="true"\n placeholder="Far entity (in the list)"\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 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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\n [clearable]="true"\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-text color="primary">\n search with a suggestLengthThreshold\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]="true"\n [equals]="equals"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-mobile-suggestLengthThreshold]\'"\n required\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 Multiple value\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>multiple: true</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entities"\n [config]="autocompleteFields.get(\'entities-items-filter\')"\n [placeholder]="\'Multiple\'"\n mobile="true"\n multiple="true"\n [equals]="equals"\n [logPrefix]="\'[combo-mobile-multiple]\'"\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 [equals]="equals"\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(filterChangeField, \'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" #filterChangeField\n [config]="autocompleteFields.get(\'entity-items-filter\')"\n [mobile]="true"\n [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Fullscreen\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]="true"\n [class]="\'mat-autocomplete-panel-full-size\'"\n [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-mobile-full-size]\'"\n [debug]="true"\n [showAllOnFocus]="true"\n [showPanelOnFocus]="true"\n ></mat-autocomplete-field>\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></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 [equals]="equals"\n [clearable]="true"\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 search with a suggestLengthThreshold\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 [equals]="equals"\n suggestLengthThreshold="3"\n [logPrefix]="\'[combo-desktop-suggestLengthThreshold]\'"\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 [equals]="equals"\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 [equals]="equals"\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-text color="primary">\n Multiple value\n </ion-text>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>multiple: true</pre>\n </small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-autocomplete-field formControlName="entities"\n [config]="autocompleteFields.get(\'entities-items-filter\')"\n [placeholder]="\'Multiple\'"\n mobile="false"\n multiple="true"\n [equals]="equals"\n [logPrefix]="\'[combo-desktop-multiple]\'"\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>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 [equals]="equals"\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 [matAutocompletePosition]="\'above\'"\n [logPrefix]="\'[combo-desktop-full-size]\'"\n [debug]="true"\n [showAllOnFocus]="true"\n [showPanelOnFocus]="true"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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 [equals]="equals"\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'}]}],pd.ctorParameters=function(){return[{type:P.FormBuilder}]},pd.propDecorators={farEntityField:[{type:e.ViewChild,args:["farEntityField"]}]};var hd=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,Mo.latitude])],longitude:[null,P.Validators.compose([P.Validators.required,Mo.longitude])]}),enable:t.group({latitude:[null,Mo.latitude],longitude:[null,Mo.longitude]}),disable:t.group({latitude:[null,Mo.latitude],longitude:[null,Mo.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 re(this,void 0,void 0,(function(){var t;return ie(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}();hd.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 </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'}]}],hd.ctorParameters=function(){return[{type:P.FormBuilder}]};var md=$t,fd=function(){function t(t,e){this.formBuilder=t,this.dateFormatPipe=e,this.$dates=new D.BehaviorSubject(void 0),this._today=md().startOf("day"),this.form=t.group({empty:[null,P.Validators.required],date:[null,P.Validators.compose([P.Validators.required,Mo.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]=md(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 re(this,void 0,void 0,(function(){var t;return ie(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}();fd.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 [equals]="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 [equals]="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 [equals]="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 [equals]="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'}]}],fd.ctorParameters=function(){return[{type:P.FormBuilder},{type:Fn}]};var gd=$t,bd=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],emptyRequired:[null,P.Validators.required],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null]},{validators:Fo.dateRange("empty","enable")});var o=this.form.get("disable");o.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return o.setValue(t)})),this.showLogPanel=this.showLogPanel||Rn(window)}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e,n=this;return ie(this,(function(o){return t=gd(),e={empty:null,emptyRequired:null,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)),ar.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}();bd.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="emptyRequired"\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 [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!-- Empty value + required --\x3e\n <ion-col>\n\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value + required\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="emptyRequired"\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 [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!-- Empty required value --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Empty value + required\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="emptyRequired"\n placeholder="Date/Time"\n required\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'}]}],bd.ctorParameters=function(){return[{type:L.Platform},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var yd=[{id:1,label:"AAA",name:"Item A"},{id:2,label:"BBB",name:"Item B"},{id:3,label:"CCC",name:"Item C"},{id:4,label:"DDD",name:"Item D"},{id:5,label:"EEE",name:"Item E"},{id:6,label:"FFF",name:"Item F"},{id:7,label:"GGG",name:"Item G"}];function vd(t,e){if(ue(e))return(t||yd).map((function(t){return Object.assign({},t)}));for(var n=[],o=1;n.length<e;)n=n.concat((t||yd).map((function(t){var e=t.name+" #"+o;return Object.assign(Object.assign({},t),{id:o++,name:e})})));return n.slice(0,e)}var Cd=function(){function t(t){this.formBuilder=t,this._items=vd(yd,100),this._$items=new D.BehaviorSubject(void 0),this.autocompleteFields=new Pn,this.form=t.group({entity:[null,Mo.entity],entityInitial:[null,Mo.entity],disableEntity:[null,Mo.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,equals:function(t,e){return 0===ia.compare(t,e,1,"id")}}),this.autocompleteFields.add("entity-items",{items:this._items.slice(),attributes:["label","name"],displayWith:this.entityToString,equals:function(t,e){return 0===ia.compare(t,e,1,"id")}}),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 re(this,void 0,void 0,(function(){var t,e,n=this;return ie(this,(function(o){return t=vd(yd),e={entity:t.slice(0,1),entityInitial:t.slice(1,2),disableEntity:t.slice(1,2)},this.form.setValue(e),setTimeout((function(){return n.loadItems()}),1e3),[2]}))}))},t.prototype.loadItems=function(){return re(this,void 0,void 0,(function(){return ie(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(pe).join(" - ")},t.prototype.suggest=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r,i=this;return ie(this,(function(a){return e=Object.assign({offset:0,size:30},e),n=Te(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 re(i,void 0,void 0,(function(){return ie(this,(function(o){switch(o.label){case 0:return[4,Be(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.equals=function(t,e){return t&&e&&t.id===e.id},t.prototype.stringify=function(t){return JSON.stringify(t)},t}();Cd.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 chipColor="accent"\n [debug]="false"\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 [logPrefix]="\'[mat-chips-initialized] \'"\n chipColor="primary"\n [debug]="true"\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 [equals]="equals"\n [logPrefix]="\'[mat-chips-disabled] \'"\n chipColor="warning"\n [debug]="true"\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 [equals]="equals"\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'}]}],Cd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Ed=function(){this.$icon=new D.BehaviorSubject("alert"),this.$size=new D.BehaviorSubject("small"),this.$fill=new D.BehaviorSubject("solid"),this.$color=new D.BehaviorSubject("danger")};Ed.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 <ion-row class="ion-no-padding">\n <ion-col>\n <mat-icon [style.color]="\'var(--ion-color-secondary)\'"\n matBadge\n [ionBadgeIcon]="$icon|async"\n [matBadgeColor]="$color|async"\n [matBadgeFill]="$fill|async"\n [matBadgeSize]="$size|async"\n matBadgeOverlap="false">\n <ion-icon slot="icon-only"\n [color]="\'secondary\'"\n name="navigate"\n ></ion-icon>\n </mat-icon>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeColor"\n [value]="$color.value"\n (selectionChange)="this.$color.next($event.value)">\n <mat-option [value]="\'primary\'">primary</mat-option>\n <mat-option [value]="\'secondary\'">secondary</mat-option>\n <mat-option [value]="\'tertiary\'">tertiary</mat-option>\n <mat-option [value]="\'danger\'">danger</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="ionBadgeIcon"\n [value]="$icon.value"\n (selectionChange)="this.$icon.next($event.value)">\n <mat-option [value]="\'checkmark-circle\'">checkmark-circle</mat-option>\n <mat-option [value]="\'alert-circle\'">alert-circle</mat-option>\n <mat-option [value]="\'alert\'">alert</mat-option>\n <mat-option [value]="\'flag\'">flag</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeSize"\n [value]="$size.value"\n (selectionChange)="this.$size.next($event.value)">\n <mat-option [value]="\'large\'">large</mat-option>\n <mat-option [value]="\'medium\'">medium</mat-option>\n <mat-option [value]="\'small\'">small</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n\n <ion-col>\n <mat-form-field>\n <mat-select placeholder="matBadgeFill"\n [value]="$fill.value"\n (selectionChange)="this.$fill.next($event.value)">\n <mat-option [value]="\'clear\'">clear</mat-option>\n <mat-option [value]="\'solid\'">solid</mat-option>\n </mat-select>\n </mat-form-field>\n </ion-col>\n </ion-row>\n\n</ion-content>\n'}]}];var wd=function(){function t(t){this.formBuilder=t,this.form=t.group({empty:[null,P.Validators.required],integer:[null,P.Validators.compose([P.Validators.required,Mo.integer])],disable:[null,P.Validators.required],datetime:[null]}),this.form.get("disable").disable()}return t.prototype.ngOnInit=function(){this.loadData()},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t;return ie(this,(function(e){return t={empty:null,integer:99,disable:-111.11},this.form.patchValue(t),[2]}))}))},t.prototype.doSubmit=function(t){console.debug("Validate form: ",this.form.value)},t}();wd.decorators=[{type:e.Component,args:[{selector:"app-numpad-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>Numeric pad test page</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n <h1>Numpad test page:</h1>\n\n <form class="form-container" [formGroup]="form" (ngSubmit)="doSubmit($event)">\n\n <ion-grid>\n\n <ion-row>\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Decimal field, readonly\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="text" formControlName="empty" placeholder="Empty decimal field"\n autocomplete="off"\n [matNumpad]="numpadDecimal"\n readonly>\n <mat-numpad [decimal]="true" #numpadDecimal></mat-numpad>\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- filled --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Integer field\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="number" formControlName="integer" placeholder="Filled integer field"\n autocomplete="off"\n [matNumpad]="numpadInteger">\n <mat-numpad #numpadInteger [decimal]="false"></mat-numpad>\n\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- append to input --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n Attach to input, readonly\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="text" formControlName="integer" placeholder="A number"\n autocomplete="off"\n [matNumpad]="numpadAppendToInput"\n readonly>\n <mat-numpad #numpadAppendToInput [appendToInput]="true"></mat-numpad>\n </mat-form-field>\n\n\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 Disabled control\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-form-field >\n <input matInput type="number" formControlName="disable" placeholder="Disabled field"\n autocomplete="off"\n [matNumpad]="numpadDisabled">\n <mat-numpad #numpadDisabled></mat-numpad>\n </mat-form-field>\n\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n\n\n \x3c!-- Other field (for comparision) --\x3e\n <ion-row><ion-col><ion-text><h4>Other field type (for style comparision)</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 Mat date time\n </ion-label>\n </ion-card-title>\n </ion-card-header>\n <ion-card-content>\n <mat-date-time-field formControlName="datetime" placeholder="Date/Time field (desktop)">\n </mat-date-time-field>\n\n <mat-date-time-field formControlName="datetime"\n placeholder="Date/Time field (mobile)"\n mobile="true">\n </mat-date-time-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </form>\n\n</ion-content>\n'}]}],wd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Id=$t,xd=function(){function t(t,e){this.formBuilder=t,this.cd=e,this.showLogPanel=!0,this.logContent="",this.memoryHide=!1,this.memoryMobile=!0,this.timezone="Indian/Mahe",this.stringify=JSON.stringify,this.form=t.group({empty:[null,Mo.validDate],emptyRequired:[null,P.Validators.compose([P.Validators.required,Mo.validDate])],enable:[null,P.Validators.required],disable:[null,P.Validators.required],readonly:[null],timezone:[null]},{validators:Fo.dateRange("empty","enable")});var n=this.form.get("disable");n.disable(),this.form.get("enable").valueChanges.subscribe((function(t){return n.setValue(t)})),this.showLogPanel=this.showLogPanel||Rn(window)}return t.prototype.ngOnInit=function(){var t=this;setTimeout((function(){return t.loadData()}),250)},t.prototype.loadData=function(){return re(this,void 0,void 0,(function(){var t,e,n,o=this;return ie(this,(function(r){return t=Id(),e=t.clone().tz(this.timezone).startOf("day"),n={empty:null,emptyRequired:null,enable:io(t),disable:t.clone(),readonly:t.clone(),timezone:e},this.form.setValue(n),this.log("[test-page] Data loaded: "+JSON.stringify(n)),this.form.get("empty").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value n°1: "+JSON.stringify(t))})),this.form.get("enable").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value n°2: "+JSON.stringify(t))})),this.form.get("timezone").valueChanges.pipe(N.debounceTime(300)).subscribe((function(t){return o.log("[test-page] Value with timezone: "+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)),ar.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}();xd.decorators=[{type:e.Component,args:[{selector:"app-data-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 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\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-field formControlName="empty"\n *ngIf="!memoryHide"\n placeholder="Date"\n [required]="true"\n [mobile]="memoryMobile"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="empty"\n placeholder="Date"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\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 (required)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.emptyRequired.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="emptyRequired"\n placeholder="Date"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="enable"\n placeholder="Date"\n [required]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="disable"\n placeholder="Date"\n [required]="true"\n [mobile]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- TimeZone --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>timezone="{{timezone}}" value="{{stringify(form.controls.timezone.value)}}"</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="timezone"\n placeholder="Date"\n [mobile]="true"\n [clearable]="true"\n [timezone]="timezone">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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)="mobileReadonlyField.readonly=$event.checked" [checked]="mobileReadonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-field #mobileReadonlyField formControlName="readonly"\n placeholder="Date"\n [readonly]="true"\n [mobile]="true"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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 <hr/>\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-field formControlName="empty"\n placeholder="Date"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\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 (required)\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>{{stringify(form.controls.emptyRequired.value)}}</pre></small>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="emptyRequired"\n placeholder="Date"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="enable"\n placeholder="Date"\n [required]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-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-field formControlName="disable"\n placeholder="Date"\n [required]="true"\n [mobile]="false">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n \x3c!-- TimeZone --\x3e\n <ion-col>\n <ion-card>\n <ion-card-header>\n <ion-card-title>\n <ion-label color="primary">\n TimeZone\n </ion-label>\n </ion-card-title>\n <ion-card-subtitle>\n <ion-text color="medium">\n <small><pre>timezone="{{timezone}}" value={{stringify(form.controls.timezone.value)}}</pre></small>\n <pre>Should display using the browser TZ,<br/>but serialize/deserialize for the given TZ</pre>\n </ion-text>\n </ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <mat-date-field formControlName="timezone"\n placeholder="Date"\n [mobile]="false"\n [clearable]="true"\n [timezone]="timezone">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\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)="desktopReadonlyField.readonly=$event.checked" [checked]="desktopReadonlyField.readonly">\n </mat-checkbox>\n\n <mat-date-field #desktopReadonlyField formControlName="readonly"\n placeholder="Date"\n [readonly]="true"\n [mobile]="false"\n [clearable]="true">\n <ion-icon matPrefix name="calendar-outline"></ion-icon>\n </mat-date-field>\n </ion-card-content>\n </ion-card>\n </ion-col>\n\n </ion-row>\n </ion-grid>\n\n </form>\n</ion-content>\n'}]}],xd.ctorParameters=function(){return[{type:P.FormBuilder},{type:e.ChangeDetectorRef}]};var Od=[{label:"Shared Material components",divider:!0},{label:"Date/Time field",page:"/testing/shared/datetime"},{label:"Date field",page:"/testing/shared/date"},{label:"Autocomplete field",page:"/testing/shared/autocomplete"},{label:"Lat/Long field",page:"/testing/shared/latlong"},{label:"Numeric pad component",page:"/testing/shared/numpad"},{label:"Swipe component",page:"/testing/shared/swipe"},{label:"Chips component",page:"/testing/shared/chips"},{label:"Shared directives",divider:!0},{label:"Badge icon directive",page:"/testing/shared/badge-icon"}],_d=[{path:"",pathMatch:"full",component:Kl},{path:"autocomplete",pathMatch:"full",component:pd},{path:"datetime",pathMatch:"full",component:bd},{path:"date",pathMatch:"full",component:xd},{path:"latlong",pathMatch:"full",component:hd},{path:"numpad",pathMatch:"full",component:wd},{path:"swipe",pathMatch:"full",component:fd},{path:"chips",pathMatch:"full",component:Cd},{path:"badge-icon",pathMatch:"full",component:Ed}],kd=function(){};kd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,P.ReactiveFormsModule,Ci,F.TranslateModule.forChild(),W.RouterModule.forChild(_d)],declarations:[bd,xd,pd,hd,wd,fd,Cd,Ed],exports:[Ci,W.RouterModule,bd,xd,pd,hd,wd,fd,Cd]}]}];var Sd=function(){function t(t,e){this.toastController=t,this.translate=e,this.defaultOptions={showCloseButton:!1}}return t.prototype.showToast=function(t){return Ia.show(this.toastController,this.translate,Object.assign(Object.assign(Object.assign({},this.defaultOptions),{message:"This is a message"}),t))},t.prototype.showInfo=function(t){return this.showToast(Object.assign({type:"info",message:"This is a info text !"},t))},t.prototype.showWarning=function(t){return this.showToast(Object.assign({type:"warning",message:"This is a warning text !"},t))},t.prototype.showError=function(t){return this.showToast(Object.assign({type:"error",message:"This is a error text !"},t))},t.prototype.toggleCloseButton=function(){this.defaultOptions.showCloseButton=!this.defaultOptions.showCloseButton},t}();Sd.decorators=[{type:e.Component,args:[{selector:"toast-testing",template:'<ion-toolbar color="primary">\n <ion-title>Toasts</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Toast examples:</p>\n\n <ion-button (click)="showToast()" color="dark">\n default\n </ion-button>\n\n <ion-button (click)="showInfo({duration: 100000})" color="secondary">\n info\n </ion-button>\n\n <ion-button (click)="showWarning()" color="accent">\n warning\n </ion-button>\n\n <ion-button (click)="showError()" color="danger">\n error\n </ion-button>\n\n <br/>\n\n\n <ion-list>\n\n\n <ion-item>\n <ion-checkbox slot="start" [value]="defaultOptions.showCloseButton" (ionChange)="toggleCloseButton()"></ion-checkbox>\n <ion-label>Close button ?</ion-label>\n </ion-item>\n </ion-list>\n\n\n</ion-content>\n'}]}],Sd.ctorParameters=function(){return[{type:L.ToastController},{type:F.TranslateService}]};var Td=[{path:"toast",pathMatch:"full",component:Sd}],Ad=function(){};Ad.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Td)],declarations:[Sd],exports:[W.RouterModule,Sd]}]}];var Rd=function(){function t(t){this.popoverController=t}return t.prototype.showPopover=function(t,e){return re(this,void 0,void 0,(function(){var n,o,r=this;return ie(this,(function(i){switch(i.label){case 0:return[4,Bl.showUploadPopover(this.popoverController,t,Object.assign({uploadFn:function(t){return r.uploadFile(t)},deleteFn:function(t){return r.deleteFile(t)}},e))];case 1:return n=i.sent().data,o=(n||[]).map((function(t){var e,n;return null===(n=null===(e=t.response)||void 0===e?void 0:e.body)||void 0===n?void 0:n.finalName})),console.info("Popover result: ",o),[2]}}))}))},t.prototype.uploadFile=function(t){var e=new D.Subject,n=t.size/10,o=0;return D.timer(0,250).pipe(N.takeUntil(e),N.map((function(){return(o+=n)<t.size?{type:Q.HttpEventType.UploadProgress,loaded:-1}:(setTimeout((function(){return e.next()}),100),new Q.HttpResponse({body:{finalName:t.name}}))})))},t.prototype.deleteFile=function(t){return re(this,void 0,void 0,(function(){return ie(this,(function(t){switch(t.label){case 0:return console.info("[testing] Simulate remote deletion... (waiting 2s)"),[4,Be(2e3)];case 1:return t.sent(),[2,!0]}}))}))},t}();Rd.decorators=[{type:e.Component,args:[{selector:"upload-file-testing",template:'<ion-toolbar color="primary">\n <ion-title>File upload</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Popover examples:</p>\n\n <ion-button (click)="showPopover($event, {uniqueFile: true})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (unique file)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (many files)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false, instantUpload: true})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (instant upload)\n </ion-button>\n\n <ion-button (click)="showPopover($event, {uniqueFile: false, instantUpload: true, maxParallelUpload: 3})" color="tertiary">\n <span translate>COMMON.BTN_IMPORT</span> (max parallel upload)\n </ion-button>\n\n</ion-content>\n'}]}],Rd.ctorParameters=function(){return[{type:L.PopoverController}]};var Pd=[{path:"upload-file",pathMatch:"full",component:Rd}],Dd=function(){};Dd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Pd)],declarations:[Rd],exports:[W.RouterModule,Rd]}]}];var Nd=le(Od,[{label:"Shared other components",divider:!0},{label:"Toast",page:"/testing/shared/toast"},{label:"File upload",page:"/testing/shared/upload-file"}]),Md=function(){};Md.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),kd,Ad,Dd],exports:[kd,Ad,Dd]}]}],t.ReferentialFilter=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ne(e,t),e.prototype.fromObject=function(e,n){t.prototype.fromObject.call(this,e,n),this.searchText=e.searchText},e.prototype.buildFilter=function(){var e=t.prototype.buildFilter.call(this),n=ia.searchTextFilter(["label","name"],this.searchText);return n&&e.push(n),e},e}(ac),t.ReferentialFilter=oe([la({typename:"ReferentialFilterVO"})],t.ReferentialFilter);var Fd=function(t){function e(e){var n=t.call(this,e)||this;return n.formBuilder=e,n}return ne(e,t),e.prototype.getRowValidator=function(){return this.getFormGroup()},e.prototype.getFormGroup=function(t,e){return this.formBuilder.group(this.getFormGroupConfig(t,e),this.getFormGroupOptions(t,e))},e.prototype.getFormGroupConfig=function(t,e){var n={id:[t&&t.id||null],updateDate:[t&&t.updateDate||null],creationDate:[t&&t.creationDate||null],statusId:[t&&t.statusId||null,P.Validators.required],levelId:[t&&t.levelId||null],label:[t&&t.label||null,P.Validators.required],name:[t&&t.name||null,P.Validators.required],entityName:[t&&t.entityName||null,P.Validators.required]};return e&&!1===e.withDescription||(n.description=[t&&t.description||null,P.Validators.maxLength(255)]),e&&!1===e.withComments||(n.comments=[t&&t.comments||null,P.Validators.maxLength(2e3)]),n},e.prototype.getFormGroupOptions=function(t,e){return null},e}(_c);Fd.decorators=[{type:e.Injectable}],Fd.ctorParameters=function(){return[{type:P.FormBuilder}]};var Ld=function(e){function n(n,o,r,i){var a=e.call(this,n,le(hu,["label","name","levelId","statusId","updateDate","comments"],mu),new su(t.Referential,new lc(t.Referential,t.ReferentialFilter,{sortByReplacement:{id:"id"}}),o,{suppressErrors:!1}),null)||this;return a.validatorService=o,a.formBuilder=r,a.cd=i,a.canEdit=!0,a.filterCriteriaCount=0,a.groupColumns=["top-start","group-1","group-2","top-end"],a.statusList=bs,a.statusById=ys,a.useSticky=!0,a.enableInfiniteScroll=a.mobile,a.autoLoad=!1,a.inlineEdition=!0,a.i18nColumnPrefix="TABLE.TESTING.",a.confirmBeforeDelete=!0,a.confirmBeforeCancel=!1,a.undoableDeletion=!1,a.saveBeforeDelete=!1,a.saveBeforeSort=!0,a.saveBeforeFilter=!0,a.propagateRowError=!0,a.filterForm=r.group({searchText:[null]}),a.onStartEditingRow.subscribe((function(t){t.validator.patchValue({entityName:"TestVO"},{emitEvent:!1})})),a}return ne(n,e),Object.defineProperty(n.prototype,"hasMoreData",{get:function(){return this.data.length<100},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataService",{get:function(){return this._dataSource.dataService},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){var n=this;e.prototype.ngOnInit.call(this),this.registerSubscription(this.filterForm.valueChanges.pipe(N.debounceTime(250),N.filter((function(){return n.filterForm.valid})),N.tap((function(e){var o=t.ReferentialFilter.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,"filter")}))).subscribe()),this.registerAutocompleteField("level",{items:[{id:1,label:"A",name:"item A"},{id:1,label:"B",name:"item B"}],mobile:this.mobile}),this.registerSubscription(this.onRefresh.subscribe((function(){n.filterForm.markAsUntouched(),n.filterForm.markAsPristine()}))),this.markAsReady()},n.prototype.ngAfterViewInit=function(){e.prototype.ngAfterViewInit.call(this),this.restoreFilter(),this.load()},n.prototype.ngOnDestroy=function(){console.debug("[test-table] Destroying table..."),e.prototype.ngOnDestroy.call(this),this.stopTimer(),this.dataService.ngOnDestroy()},n.prototype.restoreFilter=function(){var e=this.settings.getPageSettings(this.settingsId,"filter");if(console.debug("[table-test] Restoring filter from settings...",e),e){var n=t.ReferentialFilter.fromObject(e);this.filterForm.patchValue(e,{emitEvent:!1}),this.filterCriteriaCount=n.countNotEmptyCriteria(),this.setFilter(n,{emitEvent:!1}),this.markForCheck()}},n.prototype.toggleTimer=function(){pe(this.timer)?this.stopTimer():this.startTimer()},n.prototype.load=function(){console.debug("[test-table] Updating data..."),this.markAsLoading(),ue(this.data)&&(this.data=this.generateData(0,this.enableInfiniteScroll?this.defaultPageSize:n.maxRowCount)),this.dataService.setValue(this.data,{emitEvent:!1}),this.onRefresh.emit(),this.infiniteScroll&&(this.infiniteScroll.disabled=!this.infiniteScroll||this.data.length>=n.maxRowCount)},n.prototype.loadMore=function(t){var e=this;console.debug("[table-test] Loading more...",t),setTimeout((function(){e.data=le(e.data,e.generateData(e.data.length,20)),e.dataService.setValue(e.data,{emitEvent:!1}),e.defaultPageSize=e.data.length,e.infiniteScroll.disabled=e.data.length>=100,e.doRefresh(t)}),500)},n.prototype.save=function(){var t=Object.create(null,{save:{get:function(){return e.prototype.save}}});return re(this,void 0,void 0,(function(){var e;return ie(this,(function(n){switch(n.label){case 0:return[4,t.save.call(this)];case 1:return(e=n.sent())&&(this.data=this.dataService.value),[2,e]}}))}))},n.prototype.clearControlValue=function(t,e){return t&&t.stopPropagation(),e.setValue(null),!1},n.prototype.applyFilterAndClosePanel=function(t){this.defaultPageSize=20,this.onRefresh.emit(t),this.filterExpansionPanel.close()},n.prototype.resetFilter=function(e){this.filterForm.reset({},{emitEvent:!0}),this.setFilter(t.ReferentialFilter.fromObject({}),{emitEvent:!0}),this.filterExpansionPanel.close()},n.prototype.startTimer=function(){var t=this;this.stopTimer(),this.timer=setInterval((function(){t.data=null,t.load()}),500)},n.prototype.stopTimer=function(){pe(this.timer)&&(clearInterval(this.timer),this.timer=null)},n.prototype.generateData=function(e,n){e=e||0,n=n||100;for(var o=new Array,r=0;r<n;r++){var i=r+1+e,a=t.Referential.fromObject({id:i,label:"CODE-"+i,name:"Name #"+i,levelId:{id:1,label:"A",name:"Item A"},statusId:ps.ENABLE,comments:"My comment #"+i,creationDate:so(Date.now()-60*r*1e3),updateDate:so(Date.now()-60*r*1e3),entityName:"TestVO"});o.push(a)}return o},n.prototype.markForCheck=function(){this.cd.markForCheck()},n}(bu);Ld.maxRowCount=100,Ld.decorators=[{type:e.Component,args:[{selector:"app-table-testing",template:'<app-toolbar color="primary" [canGoBack]="true" [backHref]="\'/testing\'">\n <ion-buttons slot="end">\n\n\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!-- 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\n \x3c!-- start/stop timer to auto-load data --\x3e\n <ion-button *ngIf="!timer" (click)="startTimer()">Start reload</ion-button>\n <ion-button *ngIf="timer" (click)="stopTimer()" color="accent">Stop reload</ion-button>\n </ng-container>\n\n \x3c!-- if row selection --\x3e\n <ng-template #hasSelection>\n\n \x3c!-- delete --\x3e\n <button mat-icon-button\n *ngIf="canEdit" [title]="\'COMMON.BTN_DELETE\'|translate"\n (click)="deleteSelection($event)">\n <mat-icon>delete</mat-icon>\n </button>\n\n \x3c!-- duplicate --\x3e\n <button mat-icon-button\n *ngIf="canEdit && selection.selected | isArrayLength: {equals: 1}"\n [title]="\'COMMON.BTN_DUPLICATE\'|translate"\n (click)="duplicateRow($event, selection.selected[0])">\n <mat-icon>file_copy</mat-icon>\n </button>\n </ng-template>\n </ion-buttons>\n</app-toolbar>\n<ion-content class="ion-no-padding">\n\n <ion-refresher slot="fixed" *ngIf="mobile" (ionRefresh)="doRefresh($event)">\n <ion-refresher-content></ion-refresher-content>\n </ion-refresher>\n\n \x3c!-- error --\x3e\n <ion-item *ngIf="mobile && 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="filter-panel filter-panel-floating">\n <form class="form-container ion-padding-top" [formGroup]="filterForm" (ngSubmit)="applyFilterAndClosePanel($event)">\n\n <ion-grid>\n <ion-row>\n <ion-col>\n \x3c!-- search text --\x3e\n <mat-form-field>\n <ion-icon matPrefix name="search"></ion-icon>\n <input matInput\n formControlName="searchText"\n autocomplete="off"\n [placeholder]="\'TABLE.TESTING.SEARCH_TEXT\'|translate">\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 </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 <ion-text translate>COMMON.BTN_APPLY</ion-text>\n </ion-button>\n </mat-action-row>\n </mat-expansion-panel>\n\n \x3c!-- table --\x3e\n <div [class.table-container]="!enableInfiniteScroll">\n <table #table mat-table matSort matSortDisableClear\n [dataSource]="dataSource"\n [matSortActive]="defaultSortBy"\n [matSortDirection]="defaultSortDirection"\n [trackBy]="trackByFn">\n\n \x3c!-- group header cells --\x3e\n\n <ng-container matColumnDef="top-start" [sticky]="useSticky">\n <th mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!canEdit" [attr.colspan]="2">\n \x3c!-- start spacer --\x3e\n </th>\n </ng-container>\n\n <ng-container matColumnDef="group-1">\n <th mat-header-cell *matHeaderCellDef [attr.colspan]="3" style="background-color: whitesmoke; margin-bottom: -1px;">\n <ion-label translate>{{i18nColumnPrefix + \'GROUP_1\'}}</ion-label>\n </th>\n </ng-container>\n\n <ng-container matColumnDef="group-2">\n <th mat-header-cell *matHeaderCellDef [attr.colspan]="3">\n <ion-label translate>{{i18nColumnPrefix + \'GROUP_2\'}}</ion-label>\n </th>\n </ng-container>\n\n <ng-container matColumnDef="top-end" >\n <th mat-header-cell *matHeaderCellDef>\n \x3c!-- end spacer --\x3e\n </th>\n </ng-container>\n\n <ng-container matColumnDef="select" [sticky]="useSticky" [class.mat-column-sticky]="useSticky">\n <th 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 </th>\n <td 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 </td>\n </ng-container>\n\n \x3c!-- Id column --\x3e\n <ng-container matColumnDef="id" [sticky]="useSticky" [class.mat-column-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!-- Label column --\x3e\n <ng-container matColumnDef="label">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.LABEL</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">\n <mat-form-field floatLabel="never">\n <input matInput\n [formControl]="row.validator.controls[\'label\']"\n [placeholder]="\'TABLE.TESTING.LABEL\'|translate"\n [appAutofocus]="row.editing && focusColumn === \'label\'"\n [readonly]="!row.editing">\n <mat-error *ngIf="row.validator.controls[\'label\'].hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Name column --\x3e\n <ng-container matColumnDef="name">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.NAME</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\n <mat-form-field floatLabel="never">\n <input matInput [formControl]="row.validator?.controls.name" [placeholder]="\'TABLE.TESTING.NAME\'|translate"\n [readonly]="!row.editing">\n <mat-error *ngIf="row.validator?.controls.name.hasError(\'required\')" translate>ERROR.FIELD_REQUIRED</mat-error>\n </mat-form-field>\n </td>\n </ng-container>\n\n \x3c!-- Level column --\x3e\n <ng-container matColumnDef="levelId">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.LEVEL_ID</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\n <mat-autocomplete-field floatLabel="never"\n [formControl]="row.validator.controls.levelId"\n [config]="autocompleteFields.level"\n [readonly]="!row.editing"\n required>\n </mat-autocomplete-field>\n </td>\n </ng-container>\n\n \x3c!-- Status column --\x3e\n <ng-container matColumnDef="statusId">\n <th mat-header-cell *matHeaderCellDef>\n <span translate>USER.STATUS</span>\n </th>\n <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">\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\']" [placeholder]="i18nColumnPrefix + \'STATUS_ID\'|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\n \x3c!-- Creation date column --\x3e\n <ng-container matColumnDef="updateDate">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>TABLE.TESTING.UPDATE_DATE</ion-label>\n </th>\n <td mat-cell *matCellDef="let row" class="mat-form-field-disabled">\n <ion-text class="ion-text-end" color="medium" *ngIf="row.id!==-1">\n <small [matTooltip]="\'TABLE.TESTING.CREATION_DATE\'|translate" *ngIf="row.currentData.creationDate; let creationDate">\n <ion-icon name="calendar"></ion-icon>\n {{ creationDate | dateFormat: {time: true} }}\n </small><br/>\n <small [matTooltip]="\'TABLE.TESTING.UPDATE_DATE\'|translate" *ngIf="row.currentData.updateDate; let updateDate">\n <ion-icon name="time-outline"></ion-icon>\n {{ updateDate | dateFormat: {time: true} }}\n </small>\n </ion-text>\n </td>\n </ng-container>\n\n \x3c!-- Comment column --\x3e\n <ng-container matColumnDef="comments">\n <th mat-header-cell *matHeaderCellDef>\n <ion-label translate>TABLE.TESTING.COMMENTS</ion-label>\n </th>\n <td mat-cell *matCellDef="let row">\n <mat-form-field floatLabel="never" *ngIf="row.editing; else iconComment">\n \x3c!--<textarea matInput [formControl]="row.validator?.controls.comments"\n [placeholder]="\'TABLE.TESTING.COMMENTS\'|translate"\n [readonly]="!row.editing"></textarea>--\x3e\n\n <input type="text" matInput [formControl]="row.validator?.controls.comments"\n [placeholder]="\'TABLE.TESTING.COMMENTS\'|translate"\n [readonly]="!row.editing"\n [appAutofocus]="row.editing && focusColumn === \'comments\'">\n </mat-form-field>\n\n <ng-template #iconComment>\n <mat-icon class="comment"\n *ngIf="row.validator?.controls.comments.value"\n [title]="row.validator?.controls.comments.value"></mat-icon>\n </ng-template>\n </td>\n </ng-container>\n\n \x3c!-- Actions buttons column --\x3e\n <app-actions-column [stickyEnd]="true" [canCancel]="false"\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 [cellTemplate]="cellInjection">\n\n \x3c!-- cell injection--\x3e\n <ng-template #cellInjection let-row>\n <span *ngIf="row.editing && !row.validator.dirty">-</span>\n </ng-template>\n\n </app-actions-column>\n\n <tr mat-header-row *matHeaderRowDef="groupColumns;" class="mat-toolbar"></tr>\n <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>\n <tr mat-row *matRowDef="let row; columns: displayedColumns;"\n [class.mat-row-selected]="row.editing"\n [class.mat-row-error]="row.validator?.invalid"\n [class.mat-row-disabled]="!row.editing"\n [class.mat-row-dirty]="row.validator?.dirty"\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\n <ion-infinite-scroll *ngIf="enableInfiniteScroll"\n [threshold]="mobile ? \'10%\' : \'2%\'" position="bottom"\n (ionInfinite)="loadMore($event)">\n <ion-infinite-scroll-content\n loadingSpinner="circles"\n [loadingText]="\'COMMON.LOADING_DOTS\'|translate">\n </ion-infinite-scroll-content>\n </ion-infinite-scroll>\n </div>\n</ion-content>\n\n<ion-footer>\n \x3c!-- Paginator --\x3e\n <mat-paginator *ngIf="!enableInfiniteScroll"\n [length]="totalRowCount" [pageSize]="defaultPageSize" [pageSizeOptions]="defaultPageSizeOptions"\n class="mat-paginator-footer"\n showFirstLastButtons>\n </mat-paginator>\n\n <app-form-buttons-bar *ngIf="canEdit && !mobile"\n (onCancel)="load()"\n (onSave)="save()" [disabled]="(loadingSubject|async) || !dirty">\n \x3c!-- error --\x3e\n <ion-item *ngIf="error$|async" lines="none">\n <ion-icon color="danger" slot="start" name="alert-circle"></ion-icon>\n <ion-label color="danger" [innerHTML]="error|translate"></ion-label>\n </ion-item>\n </app-form-buttons-bar>\n</ion-footer>\n\n<ion-fab slot="fixed" vertical="bottom" horizontal="end"\n *ngIf="canEdit && mobile">\n <ion-fab-button color="tertiary" (click)="addRow($event)">\n <ion-icon name="add"></ion-icon>\n </ion-fab-button>\n</ion-fab>\n',providers:[{provide:_c,useClass:Fd},{provide:bu,useExisting:e.forwardRef((function(){return Ld}))}],changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[".table-container .mat-table .mat-column-select{min-width:30px}.table-container .mat-table .mat-column-id{min-width:30px;max-width:30px}.table-container .mat-table .mat-column-label,.table-container .mat-table .mat-column-levelId,.table-container .mat-table .mat-column-name,.table-container .mat-table .mat-column-statusId{min-width:150px}.table-container .mat-table .mat-column-comments{min-width:100px;max-width:100px}"]}]}],Ld.ctorParameters=function(){return[{type:e.Injector},{type:_c},{type:P.FormBuilder},{type:e.ChangeDetectorRef}]},Ld.propDecorators={enableInfiniteScroll:[{type:e.Input}],useSticky:[{type:e.Input}],filterExpansionPanel:[{type:e.ViewChild,args:[m.MatExpansionPanel,{static:!0}]}],infiniteScroll:[{type:e.ViewChild,args:[L.IonInfiniteScroll]}]};var jd=function(){};jd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,Yl,tu,F.TranslateModule.forChild()],declarations:[Ld],exports:[Ld,F.TranslateModule]}]}];var Bd=function(){function t(t){this.popoverController=t}return t.prototype.showPopover=function(t,e){return re(this,void 0,void 0,(function(){var n,o;return ie(this,(function(r){switch(r.label){case 0:return[4,this.popoverController.create({component:rc,componentProps:Object.assign({title:"modalTitle",placeholder:"your text"},e),backdropDismiss:!1,keyboardClose:!1,event:t,translucent:!0,cssClass:"popover-large"})];case 1:return[4,(n=r.sent()).present()];case 2:return r.sent(),[4,n.onDidDismiss()];case 3:return(o=r.sent().data)&&console.info("Popover result: ",o),[2]}}))}))},t}();Bd.decorators=[{type:e.Component,args:[{selector:"text-popover-testing",template:'<ion-toolbar color="primary">\n <ion-title>Text popover</ion-title>\n</ion-toolbar>\n\n<ion-content class="ion-padding">\n\n <p>Multi lines examples:<br/>\n <small>Press Ctrl+Enter to validate</small>\n <small>\n <pre>multiline: true</pre>\n </small>\n </p>\n\n <ion-button (click)="showPopover($event, {})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span>\n </ion-button>\n\n <ion-button (click)="showPopover($event, {autofocus: true})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> (autofocus)\n </ion-button>\n\n <p>One line examples:\n <small>\n <pre>multiline: false</pre>\n </small>\n </p>\n\n\n <ion-button (click)="showPopover($event, {multiline : false})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> \n </ion-button>\n <ion-button (click)="showPopover($event, {multiline : false, autofocus: true})" color="tertiary">\n <span translate>COMMON.BTN_SHOW</span> (autofocus)\n </ion-button>\n\n\n</ion-content>\n'}]}],Bd.ctorParameters=function(){return[{type:L.PopoverController}]};var Vd=[{path:"text-popover",pathMatch:"full",component:Bd}],qd=function(){};qd.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,L.IonicModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Vd)],declarations:[Bd],exports:[W.RouterModule,Bd]}]}];var Ud=[{path:"",pathMatch:"full",redirectTo:"table"},{path:"table",pathMatch:"full",component:Ld},{path:"text-popover",pathMatch:"full",component:Bd}],$d=function(){};$d.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule,F.TranslateModule.forChild(),W.RouterModule.forChild(Ud),jd,qd],exports:[W.RouterModule,jd,qd]}]}],t.APP_ABOUT_DEVELOPERS=yc,t.APP_ABOUT_PARTNERS=vc,t.APP_CONFIG_OPTIONS=Rl,t.APP_FORM_ERROR_I18N_KEYS=ur,t.APP_GRAPHQL_TYPE_POLICIES=Bs,t.APP_HOME_BUTTONS=Ic,t.APP_LOCALES=us,t.APP_LOCAL_SETTINGS=Ca,t.APP_LOCAL_SETTINGS_OPTIONS=Ea,t.APP_LOCAL_STORAGE_TYPE_POLICIES=as,t.APP_MENU_ITEMS=Qc,t.APP_TESTING_PAGES=Wl,t.AboutModal=Cc,t.AccountPage=Tc,t.AccountService=yl,t.AccountToStringPipe=Hc,t.ActionsColumnComponent=Wc,t.AdminModule=sd,t.AdminRoutingModule=cd,t.Alerts=Xl,t.AndroidOsEnvironment=Ul,t.AppEditor=vu,t.AppEditorOptions=Eu,t.AppEntityEditor=wu,t.AppForm=nc,t.AppFormField=Ni,t.AppFormProvider=rr,t.AppFormUtils=ar,t.AppGestureConfig=Ii,t.AppGraphQLModule=Mc,t.AppHelpModal=Gl,t.AppInMemoryTable=Iu,t.AppInstallUpgradeCard=$c,t.AppListForm=Bc,t.AppLoadingSpinner=Qi,t.AppMenuModule=Xc,t.AppNullForm=or,t.AppPropertiesForm=jc,t.AppTabEditor=Cu,t.AppTabEditorOptions=yu,t.AppTable=bu,t.AppTableDataSourceOptions=au,t.AppTableUtils=iu,t.AppValidatorService=_c,t.AppendToInputDirective=ci,t.ArrayFilterPipe=Co,t.ArrayFirstPipe=bo,t.ArrayIncludesPipe=vo,t.ArrayLengthPipe=go,t.ArrayPluckPipe=yo,t.AudioProvider=Li,t.AuthForm=gc,t.AuthGuardService=ou,t.AuthModal=bc,t.AutocompleteTestPage=pd,t.AutofocusDirective=vr,t.Base58=Yi,t.BaseEntityService=ru,t.BaseGraphqlService=$s,t.BaseGraphqlServiceOptions=Us,t.BaseReferential=vs,t.Beans=Ge,t.CORE_CONFIG_OPTIONS=xl,t.CORE_TESTING_PAGES=[{label:"Core components",divider:!0},{label:"Table",page:"/testing/core/table"},{label:"Text popover",page:"/testing/core/text-popover"}],t.CellValueChangeListener=gu,t.ChipsTestPage=Cd,t.Color=pc,t.ColorScale=hc,t.ComponentDirtyGuard=Jl,t.ConfigService=Pl,t.CoreModule=tu,t.CoreTestingModule=$d,t.CryptoService=ea,t.DATE_ISO_PATTERN=Xt,t.DATE_UNIX_MS_TIMESTAMP="x",t.DATE_UNIX_TIMESTAMP="X",t.DEFAULT_PAGE_SIZE=20,t.DEFAULT_PAGE_SIZE_OPTIONS=pu,t.DEFAULT_PLACEHOLDER_CHAR=Jt,t.DEFAULT_REQUIRED_COLUMNS=fu,t.DateDiffDurationPipe=jn,t.DateFormatPipe=Fn,t.DateFromNowPipe=Bn,t.DateTimeTestPage=bd,t.DateUtils=ro,t.DepartmentToStringPipe=zc,t.DragAndDropDirective=Er,t.DurationPipe=co,t.ENTITIES_STORAGE_KEY_PREFIX=rs,t.ENVIRONMENT=Qt,t.EmptyArrayPipe=fo,t.EntitiesService=ic,t.EntitiesStorage=ss,t.EntitiesTableDataSource=su,t.Entity=na,t.EntityClass=la,t.EntityClasses=sa,t.EntityFilter=ac,t.EntityFilterUtils=sc,t.EntityMetadataComponent=Ac,t.EntityStore=is,t.EntityUtils=ia,t.Environment=Yt,t.EvenPipe=po,t.FileResponse=Nl,t.FileService=Wi,t.FileSizePipe=no,t.FilesUtils=Bl,t.FormArrayHelper=ir,t.FormButtonsBarComponent=Pc,t.FormButtonsBarToken=Rc,t.FormErrorTranslatePipe=pr,t.FormErrorTranslator=dr,t.FormFieldValuesHolder=ec,t.FormGetArrayPipe=fr,t.FormGetControlPipe=mr,t.FormGetGroupPipe=gr,t.FormGetPipe=hr,t.FormGetValuePipe=br,t.Fragments=_l,t.GraphqlService=Vs,t.HAMMER_PRESS_TIME=wi,t.HAMMER_TAP_TIME=250,t.HighlightPipe=eo,t.HomePage=xc,t.Hotkeys=Bi,t.HotkeysDialogComponent=ji,t.InMemoryEntitiesService=lc,t.IsLoginAccountPipe=Gc,t.IsNilOrBlankPipe=Oo,t.IsNotNilOrBlankPipe=xo,t.IsNotOnFieldModePipe=qc,t.IsOnFieldModePipe=Vc,t.JobUtils=cc,t.KEYBOARD_HIDE_DELAY_MS=te,t.LAT_LONG_DEFAULT_MAX_DECIMALS=3,t.LAT_LONG_PATTERNS=Vn,t.LatLongFormatPipe=Zn,t.LatLongTestPage=hd,t.LatitudeFormatPipe=Xn,t.LocalSettingsService=wa,t.LongitudeFormatPipe=Jn,t.MINIFY_ENTITY_FOR_LOCAL_STORAGE=Is,t.MINIFY_ENTITY_FOR_POD=xs,t.MapGetPipe=Eo,t.MapKeysPipe=wo,t.MapValuesPipe=Io,t.MatAutocompleteConfigHolder=Pn,t.MatAutocompleteField=Mn,t.MatBadgeIconDirective=bi,t.MatBooleanField=Zr,t.MatChipsField=fi,t.MatDate=Dr,t.MatDateShort=$r,t.MatDateTime=Br,t.MatDuration=Qr,t.MatLatLongField=Sr,t.MatNumpadComponent=ai,t.MatNumpadContainerComponent=ri,t.MatNumpadContent=li,t.MatPaginatorI18n=_i,t.MatStepperI18n=Hl,t.MatSwipeField=pi,t.MaterialTestingModule=kd,t.MathAbsPipe=uo,t.MenuComponent=Yc,t.MenuItems=Ec,t.MenuService=Kc,t.MessageForm=Gu,t.MessageModal=$u,t.MessageService=Qu,t.MessageTypeList=Uu,t.MessageTypes=qu,t.MimeTypes=jl,t.ModalToolbarComponent=Ki,t.NetworkService=_a,t.NgInitDirective=Do,t.NgVarDirective=Cr,t.NotEmptyArrayPipe=mo,t.NumberFormatPipe=to,t.NumpadDirective=si,t.OddPipe=ho,t.PRIORITIZED_AUTHORITIES=ks,t.PUBKEY_REGEXP=Zt,t.PersonFragments=ed,t.PersonService=rd,t.PersonToStringPipe=Uc,t.PersonUtils=Ts,t.PersonValidatorService=id,t.PlatformService=$l,t.ProgressBarService=Ei,t.ProgressInterceptor=ki,t.PropertyGetPipe=Po,t.RESERVED_END_COLUMNS=mu,t.RESERVED_START_COLUMNS=hu,t.ReferentialUtils=ws,t.ReferentialValidatorService=Fd,t.RegisterConfirmPage=Oc,t.SETTINGS_DISPLAY_COLUMNS=lu,t.SETTINGS_FILTER=uu,t.SETTINGS_PAGE_SIZE=du,t.SETTINGS_SORTED_COLUMN=cu,t.SETTINGS_STORAGE_KEY=ba,t.SETTINGS_TRANSIENT_PROPERTIES=ya,t.SHARED_MATERIAL_TESTING_PAGES=Od,t.SHARED_TESTING_PAGES=Nd,t.SPACE_PLACEHOLDER_CHAR=" ",t.SelectPeerModal=fa,t.SettingsPage=Lc,t.SharedAsyncValidators=jo,t.SharedDirectivesModule=wr,t.SharedFormArrayValidators=Lo,t.SharedFormGroupValidators=Fo,t.SharedHotkeysModule=Vi,t.SharedMatAutocompleteModule=Ir,t.SharedMatBadgeIconModule=yi,t.SharedMatBooleanModule=ti,t.SharedMatChipsModule=gi,t.SharedMatDateTimeModule=Gr,t.SharedMatDurationModule=Yr,t.SharedMatLatLongModule=Tr,t.SharedMatNumpadModule=ui,t.SharedMatSwipeModule=hi,t.SharedMaterialModule=Ci,t.SharedModule=Yl,t.SharedPipesModule=yr,t.SharedRoutingModule=tc,t.SharedTestingModule=Md,t.SharedTestsPage=Kl,t.SharedValidators=Mo,t.SocialErrorCodes=Ou,t.SocialModule=Hu,t.StartableService=Mi,t.StatusById=ys,t.StatusIds=ps,t.StatusList=bs,t.StrIncludesPipe=So,t.StrLengthPipe=ko,t.SwipeTestPage=fd,t.TableSelectColumnsComponent=Dc,t.TableTestPage=Ld,t.TableTestingModule=jd,t.TextForm=oc,t.TextPopover=rc,t.TextPopoverTestingModule=qd,t.TextPopoverTestingPage=Bd,t.ToStringPipe=_o,t.Toasts=Ia,t.ToolbarComponent=Oi,t.ToolbarToken=xi,t.TranslatablePipe=Ro,t.TranslateContextPipe=Ao,t.TranslateContextService=To,t.UploadFile=Dl,t.UploadFileComponent=zl,t.UploadFilePopover=Ll,t.UploadFileTestingModule=Dd,t.UploadFileTestingPage=Rd,t.UriUtils=Vl,t.UserEventFragments=Tu,t.UserEventService=ju,t.UserEventTypes=_u,t.UserEventsTable=Vu,t.UsersPage=ad,t.accountToString=As,t.adaptValueToControl=qo,t.addValueInArray=zo,t.arrayDistinct=function(t,e){if(ge(t))return t;e=e||Object.keys(t[0]);var n=new Set;return t.reduce((function(t,o){var r=Ae(o,e,"|");return n.has(r)?t:(n.add(r),t.concat(o))}),[])},t.arrayGroupBy=function(t,e){return ue(t)?null:t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{})},t.arraySize=function(t){return fe(t)&&t.length||0},t.asInputElement=tn,t.canHaveFocus=nn,t.capitalizeFirstLetter=qe,t.chainPromises=cn,t.changeCaseToUnderscore=ke,t.clearValueInArray=Qo,t.copyEntity2Form=Bo,t.createPromiseEvent=mn,t.createPromiseEventEmitter=hn,t.departmentToString=Os,t.departmentsToString=_s,t.disableControls=Ho,t.emitPromiseEvent=fn,t.entityToString=function(t,e){return t&&t.id&&Ae(t,e||["name"])||void 0},t.equals=$e,t.equalsOrNil=function(t,e){return t===e||ue(t)&&ue(e)},t.fadeInAnimation=bn,t.fadeInOutAnimation=yn,t.filterFalse=function(t){return t.pipe(N.filter((function(t){return!1===t})))},t.filterNotNil=function(t){return t.pipe(N.filter(pe))},t.filterNumberInput=Ye,t.filterTrue=function(t){return t.pipe(N.filter((function(t){return!0===t})))},t.firstArrayValue=function(t){return fe(t)?t[0]:void 0},t.firstFalse=function(t){return t.pipe(N.first((function(t){return!1===t})),N.map((function(t){})))},t.firstFalsePromise=sn,t.firstNotNil=rn,t.firstNotNilPromise=ln,t.firstTrue=un,t.firstTruePromise=an,t.focusInput=Xe,t.focusNextInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&Ze(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=on(e,Object.assign({minTabindex:o},n));return!!fe(r)&&(r[0].focus(),!0)},t.focusPreviousInput=function(t,e,n){t&&(t.preventDefault(),t.stopPropagation());var o=t&&Ze(t.target)?t.target.tabIndex||t.target.tabindex:void 0,r=on(e,Object.assign({maxTabindex:o},n));return!!fe(r)&&(r[r.length-1].focus(),!0)},t.formatLatitude=Gn,t.formatLongitude=Hn,t.fromDateISOString=ao,t.fromScrollEndEvent=gn,t.fromUnixMsTimestamp=so,t.fromUnixTimestamp=function(t){return oo(t,"X")},t.getCaretPosition=Ke,t.getColorContrast=Pi,t.getColorShade=function(t){return Ri("#000000",t,12)},t.getColorTint=function(t){return Ri("#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=on,t.getFormErrors=$o,t.getFormValueFromEntity=Vo,t.getProperty=Le,t.getPropertyByPath=Fe,t.getPropertyByPathAsString=je,t.getRandomImage=wc,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=Ti,t.isAndroid=Tn,t.isBlankString=ve,t.isControlHasInput=sr,t.isCordova=An,t.isEmptyArray=ge,t.isIOS=Sn,t.isInputElement=Ze,t.isInstanceOf=oa,t.isInt=De,t.isMobile=Rn,t.isNil=ue,t.isNilOrBlank=de,t.isNilOrNaN=function(t){return null==t||"number"==typeof t&&isNaN(t)},t.isNotEmptyArray=fe,t.isNotNil=pe,t.isNotNilBoolean=be,t.isNotNilOrBlank=he,t.isNotNilOrNaN=me,t.isNotNilString=ye,t.isNumber=function(t){return pe(t)&&Ne.test(t)},t.isNumberRange=function(t){return pe(t)&&Me.test(t)},t.isProgressEvent=Ml,t.isResponseEvent=Fl,t.isTouchUi=On,t.isWindows=xn,t.joinProperties=function(t,e,n){if(!t)throw new Error("Could not display an undefined entity.");return e.map((function(e){return Le(t,e)})).filter(he).join(n||" - ")},t.joinPropertiesPath=Ae,t.logFormErrors=Uo,t.markAllAsTouched=Yo,t.markAsUntouched=tr,t.markControlAsTouched=Jo,t.markFormGroupAsTouched=Xo,t.matchMedia=wn,t.matchUpperCase=xe,t.mergeLoadResult=function(t,e){var n,o,r;return{data:(n=t.data||[]).concat.apply(n,le(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=Ri,t.moment=eu,t.moveInputCaretToSeparator=Qe,t.noTrailingSlash=Oe,t.notNilOrDefault=function(t,e){return null!=t?t:e},t.nullIfUndefined=Ce,t.parseLatitudeOrLongitude=Qn,t.propertiesPathComparator=Re,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=Fe(e,t),r=Fe(n,t);return o===r?0:o>r?1:-1}},t.referentialToString=hs,t.referentialsToString=function(t,e,n){return(t||[]).map((function(t){return hs(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(pe)},t.removeDiacritics=Se,t.removeDuplicatesFromArray=function(t,e){return ge(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=cr,t.resizeArray=Wo,t.rgbArrayToHex=Si,t.rgbToHex=function(t,e,n){return"#"+Ai(t)+Ai(e)+Ai(n)},t.round=Ve,t.scrollFactory=Ql,t.selectInputContent=ze,t.selectInputRange=We,t.setCalculatedValue=lr,t.setTabIndex=Je,t.sleep=Be,t.slideInOutAnimation=vn,t.slideUpDownAnimation=Cn,t.sort=function(t,e,n){if(ge(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=Ue,t.splitByProperty=function(t,e){return(t||[]).reduce((function(t,n){var o,r=null===(o=n)||void 0===o?void 0:o[e];return pe(r)&&(t[r]=n),t}),{})},t.startsWithUpperCase=Ie,t.suggestFromArray=Te,t.suggestFromStringArray=function(t,e,n){return de(e="string"==typeof e&&"*"!==e&&e.toUpperCase()||void 0)?t:-1!==e.indexOf("*")?(e=e.replace("*",".*"),t.filter((function(t){return xe(t,e)}))):t.filter((function(t){return Ie(t,e)}))},t.tabindexComparator=en,t.testUserAgent=In,t.toBoolean=Ee,t.toDateISOString=io,t.toDuration=lo,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=we,t.trimEmptyToNull=function(t){var e=t&&t.trim()||void 0;return e&&e.length&&e||null},t.tz=nu,t.uncapitalizeFirstLetter=function(t){return t&&0!==t.length?t.substr(0,1).toLowerCase()+t.substr(1):t},t.updateValueAndValidity=Zo,t.waitFor=dn,t.waitForTrue=pn,t.waitIdle=nr,t.waitWhilePending=er,t.ɵ0=kn,t.ɵa=Zl,t.ɵb=ii,t.ɵc=He,t.ɵd=Nc,t.ɵe=Sc,t.ɵf=fc,t.ɵg=kc,t.ɵh=Fc,t.ɵi=Zc,t.ɵj=Jc,t.ɵk=xd,t.ɵl=wd,t.ɵm=Ed,t.ɵn=Ad,t.ɵo=Sd,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
25
25
|
//# sourceMappingURL=sumaris-net.ngx-components.umd.min.js.map
|