text: (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{"7pIB":function(e,t,i){"use strict";i.d(t,"a",(function(){return c})),i.d(t,"b",(function(){return l}));var n=i("fXoL"),s=i("ofXK");class o{constructor(e){var t;this.rawFile=e;let i=(t=e)&&(t.nodeName||t.prop&&t.attr&&t.find)?e.value:e;this["_createFrom"+("string"==typeof i?"FakePath":"Object")](i)}_createFromFakePath(e){this.lastModifiedDate=void 0,this.size=void 0,this.type="like/"+e.slice(e.lastIndexOf(".")+1).toLowerCase(),this.name=e.slice(e.lastIndexOf("/")+e.lastIndexOf("\\")+2)}_createFromObject(e){this.size=e.size,this.type=e.type,this.name=e.name}}class r{constructor(e,t,i){this.url="/",this.headers=[],this.withCredentials=!0,this.formData=[],this.isReady=!1,this.isUploading=!1,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!1,this.isError=!1,this.progress=0,this.index=void 0,this.uploader=e,this.some=t,this.options=i,this.file=new o(t),this._file=t,e.options&&(this.method=e.options.method||"POST",this.alias=e.options.itemAlias||"file"),this.url=e.options.url}upload(){try{this.uploader.uploadItem(this)}catch(e){this.uploader._onCompleteItem(this,"",0,{}),this.uploader._onErrorItem(this,"",0,{})}}cancel(){this.uploader.cancelItem(this)}remove(){this.uploader.removeFromQueue(this)}onBeforeUpload(){}onBuildForm(e){return{form:e}}onProgress(e){return{progress:e}}onSuccess(e,t,i){return{response:e,status:t,headers:i}}onError(e,t,i){return{response:e,status:t,headers:i}}onCancel(e,t,i){return{response:e,status:t,headers:i}}onComplete(e,t,i){return{response:e,status:t,headers:i}}_onBeforeUpload(){this.isReady=!0,this.isUploading=!0,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!1,this.isError=!1,this.progress=0,this.onBeforeUpload()}_onBuildForm(e){this.onBuildForm(e)}_onProgress(e){this.progress=e,this.onProgress(e)}_onSuccess(e,t,i){this.isReady=!1,this.isUploading=!1,this.isUploaded=!0,this.isSuccess=!0,this.isCancel=!1,this.isError=!1,this.progress=100,this.index=void 0,this.onSuccess(e,t,i)}_onError(e,t,i){this.isReady=!1,this.isUploading=!1,this.isUploaded=!0,this.isSuccess=!1,this.isCancel=!1,this.isError=!0,this.progress=0,this.index=void 0,this.onError(e,t,i)}_onCancel(e,t,i){this.isReady=!1,this.isUploading=!1,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!0,this.isError=!1,this.progress=0,this.index=void 0,this.onCancel(e,t,i)}_onComplete(e,t,i){this.onComplete(e,t,i),this.uploader.options.removeAfterUpload&&this.remove()}_prepareToUploading(){this.index=this.index||++this.uploader._nextIndex,this.isReady=!0}}let a=(()=>{class e{static getMimeClass(e){let t="application";return-1!==this.mime_psd.indexOf(e.type)||e.type.match("image.*")?t="image":e.type.match("video.*")?t="video":e.type.match("audio.*")?t="audio":"application/pdf"===e.type?t="pdf":-1!==this.mime_compress.indexOf(e.type)?t="compress":-1!==this.mime_doc.indexOf(e.type)?t="doc":-1!==this.mime_xsl.indexOf(e.type)?t="xls":-1!==this.mime_ppt.indexOf(e.type)&&(t="ppt"),"application"===t&&(t=this.fileTypeDetection(e.name)),t}static fileTypeDetection(e){let t={jpg:"image",jpeg:"image",tif:"image",psd:"image",bmp:"image",png:"image",nef:"image",tiff:"image",cr2:"image",dwg:"image",cdr:"image",ai:"image",indd:"image",pin:"image",cdp:"image",skp:"image",stp:"image","3dm":"image",mp3:"audio",wav:"audio",wma:"audio",mod:"audio",m4a:"audio",compress:"compress",zip:"compress",rar:"compress","7z":"compress",lz:"compress",z01:"compress",bz2:"compress",gz:"compress",pdf:"pdf",xls:"xls",xlsx:"xls",ods:"xls",mp4:"video",avi:"video",wmv:"video",mpg:"video",mts:"video",flv:"video","3gp":"video",vob:"video",m4v:"video",mpeg:"video",m2ts:"video",mov:"video",doc:"doc",docx:"doc",eps:"doc",txt:"doc",odt:"doc",rtf:"doc",ppt:"ppt",pptx:"ppt",pps:"ppt",ppsx:"ppt",odp:"ppt"},i=e.split(".");if(i.length<2)return"application";let n=i[i.length-1].toLowerCase();return void 0===t[n]?"application":t[n]}}return e.mime_doc=["application/msword","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-word.template.macroEnabled.12"],e.mime_xsl=["application/vnd.ms-excel","application/vnd.ms-excel","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-excel.template.macroEnabled.12","application/vnd.ms-excel.addin.macroEnabled.12","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],e.mime_ppt=["application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/vnd.ms-powerpoint.addin.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],e.mime_psd=["image/photoshop","image/x-photoshop","image/psd","application/photoshop","application/psd","zz-application/zz-winassoc-psd"],e.mime_compress=["application/x-gtar","application/x-gcompress","application/compress","application/x-tar","application/x-rar-compressed","application/octet-stream","application/x-zip-compressed","application/zip-compressed","application/x-7z-compressed","application/gzip","application/x-bzip2"],e})();class l{constructor(e){this.isUploading=!1,this.queue=[],this.progress=0,this._nextIndex=0,this.options={autoUpload:!1,isHTML5:!0,filters:[],removeAfterUpload:!1,disableMultipart:!1,formatDataFunction:e=>e._file,formatDataFunctionIsAsync:!1},this.setOptions(e),this.response=new n.n}setOptions(e){this.options=Object.assign(this.options,e),this.authToken=this.options.authToken,this.authTokenHeader=this.options.authTokenHeader||"Authorization",this.autoUpload=this.options.autoUpload,this.options.filters.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.options.maxFileSize&&this.options.filters.unshift({name:"fileSize",fn:this._fileSizeFilter}),this.options.allowedFileType&&this.options.filters.unshift({name:"fileType",fn:this._fileTypeFilter}),this.options.allowedMimeType&&this.options.filters.unshift({name:"mimeType",fn:this._mimeTypeFilter});for(let t=0;t<this.queue.length;t++)this.queue[t].url=this.options.url}addToQueue(e,t,i){let n=[];for(let o of e)n.push(o);let s=this._getFilters(i),a=this.queue.length,l=[];n.map(e=>{t||(t=this.options);let i=new o(e);if(this._isValidFile(i,s,t)){let i=new r(this,e,t);l.push(i),this.queue.push(i),this._onAfterAddingFile(i)}else this._onWhenAddingFileFailed(i,s[this._failFilterIndex],t)}),this.queue.length!==a&&(this._onAfterAddingAll(l),this.progress=this._getTotalProgress()),this._render(),this.options.autoUpload&&this.uploadAll()}removeFromQueue(e){let t=this.getIndexOfItem(e),i=this.queue[t];i.isUploading&&i.cancel(),this.queue.splice(t,1),this.progress=this._getTotalProgress()}clearQueue(){for(;this.queue.length;)this.queue[0].remove();this.progress=0}uploadItem(e){let t=this.getIndexOfItem(e),i=this.queue[t],n=this.options.isHTML5?"_xhrTransport":"_iframeTransport";i._prepareToUploading(),this.isUploading||(this.isUploading=!0,this[n](i))}cancelItem(e){let t=this.getIndexOfItem(e),i=this.queue[t];i&&i.isUploading&&(this.options.isHTML5?i._xhr:i._form).abort()}uploadAll(){let e=this.getNotUploadedItems().filter(e=>!e.isUploading);e.length&&(e.map(e=>e._prepareToUploading()),e[0].upload())}cancelAll(){this.getNotUploadedItems().map(e=>e.cancel())}isFile(e){return function(e){return File&&e instanceof File}(e)}isFileLikeObject(e){return e instanceof o}getIndexOfItem(e){return"number"==typeof e?e:this.queue.indexOf(e)}getNotUploadedItems(){return this.queue.filter(e=>!e.isUploaded)}getReadyItems(){return this.queue.filter(e=>e.isReady&&!e.isUploading).sort((e,t)=>e.index-t.index)}destroy(){}onAfterAddingAll(e){return{fileItems:e}}onBuildItemForm(e,t){return{fileItem:e,form:t}}onAfterAddingFile(e){return{fileItem:e}}onWhenAddingFileFailed(e,t,i){return{item:e,filter:t,options:i}}onBeforeUploadItem(e){return{fileItem:e}}onProgressItem(e,t){return{fileItem:e,progress:t}}onProgressAll(e){return{progress:e}}onSuccessItem(e,t,i,n){return{item:e,response:t,status:i,headers:n}}onErrorItem(e,t,i,n){return{item:e,response:t,status:i,headers:n}}onCancelItem(e,t,i,n){return{item:e,response:t,status:i,headers:n}}onCompleteItem(e,t,i,n){return{item:e,response:t,status:i,headers:n}}onCompleteAll(){}_mimeTypeFilter(e){return!(this.options.allowedMimeType&&-1===this.options.allowedMimeType.indexOf(e.type))}_fileSizeFilter(e){return!(this.options.maxFileSize&&e.size>this.options.maxFileSize)}_fileTypeFilter(e){return!(this.options.allowedFileType&&-1===this.options.allowedFileType.indexOf(a.getMimeClass(e)))}_onErrorItem(e,t,i,n){e._onError(t,i,n),this.onErrorItem(e,t,i,n)}_onCompleteItem(e,t,i,n){e._onComplete(t,i,n),this.onCompleteItem(e,t,i,n);let s=this.getReadyItems()[0];this.isUploading=!1,s?s.upload():(this.onCompleteAll(),this.progress=this._getTotalProgress(),this._render())}_headersGetter(e){return t=>t?e[t.toLowerCase()]||void 0:e}_xhrTransport(e){let t,i=this,n=e._xhr=new XMLHttpRequest;if(this._onBeforeUploadItem(e),"number"!=typeof e._file.size)throw new TypeError("The file specified is no longer valid");if(this.options.disableMultipart)t=this.options.formatDataFunction(e);else{t=new FormData,this._onBuildItemForm(e,t);const i=()=>t.append(e.alias,e._file,e.file.name);this.options.parametersBeforeFiles||i(),void 0!==this.options.additionalParameter&&Object.keys(this.options.additionalParameter).forEach(i=>{let n=this.options.additionalParameter[i];"string"==typeof n&&n.indexOf("{{file_name}}")>=0&&(n=n.replace("{{file_name}}",e.file.name)),t.append(i,n)}),this.options.parametersBeforeFiles&&i()}if(n.upload.onprogress=t=>{let i=Math.round(t.lengthComputable?100*t.loaded/t.total:0);this._onProgressItem(e,i)},n.onload=()=>{let t=this._parseHeaders(n.getAllResponseHeaders()),i=this._transformResponse(n.response,t);this["_on"+(this._isSuccessCode(n.status)?"Success":"Error")+"Item"](e,i,n.status,t),this._onCompleteItem(e,i,n.status,t)},n.onerror=()=>{let t=this._parseHeaders(n.getAllResponseHeaders()),i=this._transformResponse(n.response,t);this._onErrorItem(e,i,n.status,t),this._onCompleteItem(e,i,n.status,t)},n.onabort=()=>{let t=this._parseHeaders(n.getAllResponseHeaders()),i=this._transformResponse(n.response,t);this._onCancelItem(e,i,n.status,t),this._onCompleteItem(e,i,n.status,t)},n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials,this.options.headers)for(let s of this.options.headers)n.setRequestHeader(s.name,s.value);if(e.headers.length)for(let s of e.headers)n.setRequestHeader(s.name,s.value);this.authToken&&n.setRequestHeader(this.authTokenHeader,this.authToken),n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&i.response.emit(n.responseText)},this.options.formatDataFunctionIsAsync?t.then(e=>n.send(JSON.stringify(e))):n.send(t),this._render()}_getTotalProgress(e=0){if(this.options.removeAfterUpload)return e;let t=this.getNotUploadedItems().length,i=100/this.queue.length;return Math.round((t?this.queue.length-t:this.queue.length)*i+e*i/100)}_getFilters(e){if(!e)return this.options.filters;if(Array.isArray(e))return e;if("string"==typeof e){let t=e.match(/[^\s,]+/g);return this.options.filters.filter(e=>-1!==t.indexOf(e.name))}return this.options.filters}_render(){}_queueLimitFilter(){return void 0===this.options.queueLimit||this.queue.length<this.options.queueLimit}_isValidFile(e,t,i){return this._failFilterIndex=-1,!t.length||t.every(t=>(this._failFilterIndex++,t.fn.call(this,e,i)))}_isSuccessCode(e){return e>=200&&e<300||304===e}_transformResponse(e,t){return e}_parseHeaders(e){let t,i,n,s={};return e?(e.split("\n").map(e=>{n=e.indexOf(":"),t=e.slice(0,n).trim().toLowerCase(),i=e.slice(n+1).trim(),t&&(s[t]=s[t]?s[t]+", "+i:i)}),s):s}_onWhenAddingFileFailed(e,t,i){this.onWhenAddingFileFailed(e,t,i)}_onAfterAddingFile(e){this.onAfterAddingFile(e)}_onAfterAddingAll(e){this.onAfterAddingAll(e)}_onBeforeUploadItem(e){e._onBeforeUpload(),this.onBeforeUploadItem(e)}_onBuildItemForm(e,t){e._onBuildForm(t),this.onBuildItemForm(e,t)}_onProgressItem(e,t){let i=this._getTotalProgress(t);this.progress=i,e._onProgress(t),this.onProgressItem(e,t),this.onProgressAll(i),this._render()}_onSuccessItem(e,t,i,n){e._onSuccess(t,i,n),this.onSuccessItem(e,t,i,n)}_onCancelItem(e,t,i,n){e._onCancel(t,i,n),this.onCancelItem(e,t,i,n)}}let c=(()=>{class e{}return e.\u0275mod=n.Jb({type:e}),e.\u0275inj=n.Ib({factory:function(t){return new(t||e)},imports:[[s.c]]}),e})()},AI31:function(e,t,i){"use strict";i.d(t,"a",(function(){return d}));var n=i("fXoL"),s=i("tyNb"),o=i("ofXK");const r=["component"];function a(e,t){}function l(e,t){1&e&&(n.Rb(0,"div"),n.Cc(1,a,0,0,"ng-template",null,3,n.Dc),n.Qb())}function c(e,t){if(1&e&&(n.Rb(0,"div"),n.Rb(1,"h6"),n.Ec(2),n.Qb(),n.Rb(3,"small"),n.Ec(4),n.fc(5,"uppercase"),n.Qb(),n.Qb()),2&e){const e=n.ec();n.yb(2),n.Fc(e.resource.toTitle(e.prop,e.route)),n.yb(2),n.Fc(n.gc(5,2,e.prop.title))}}function p(e,t){if(1&e&&(n.Rb(0,"div"),n.Rb(1,"h6"),n.Ec(2),n.Qb(),n.Rb(3,"small"),n.Ec(4),n.fc(5,"uppercase"),n.Qb(),n.Qb()),2&e){const e=n.ec();n.yb(2),n.Fc(e.resource.toTitle(e.prop)),n.yb(2),n.Fc(n.gc(5,2,e.prop.title))}}let d=(()=>{class e{constructor(e,t){this.resolver=e,this.route=t}ngAfterViewInit(){if("component"===this.prop.type){const e=this.resolver.resolveComponentFactory(this.prop.component.type);this.instance=this.component.createComponent(e),this.prop.component.configureInstance(this.instance,this.resource,this.prop),this.instance.changeDetectorRef.detectChanges()}}ngOnDestroy(){this.instance&&this.instance.destroy()}}return e.\u0275fac=function(t){return new(t||e)(n.Lb(n.j),n.Lb(s.a))},e.\u0275cmp=n.Fb({type:e,selectors:[["app-resource-property-details"]],viewQuery:function(e,t){var i;1&e&&n.Jc(r,!0,n.P),2&e&&n.sc(i=n.dc())&&(t.component=i.first)},inputs:{resource:"resource",prop:"prop"},decls:4,vars:3,consts:[[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["component",""]],template:function(e,t){1&e&&(n.Pb(0,0),n.Cc(1,l,3,0,"div",1),n.Cc(2,c,6,4,"div",1),n.Cc(3,p,6,4,"div",2),n.Ob()),2&e&&(n.lc("ngSwitch",t.prop.type),n.yb(1),n.lc("ngSwitchCase","component"),n.yb(1),n.lc("ngSwitchCase","data"))},directives:[o.y,o.z,o.A],pipes:[o.I],styles:[""]}),e})()},AMeL:function(e,t,i){"use strict";i.d(t,"a",(function(){return m}));var n=i("fXoL"),s=i("tyNb"),o=i("OC8m"),r=i("1kSV"),a=i("ofXK"),l=i("AI31"),c=i("m1XX");const p=["content"];function d(e,t){if(1&e&&n.Mb(0,"app-resource-property-details",14),2&e){const e=t.$implicit,i=n.ec(2);n.lc("resource",i.context.data)("prop",e)}}function h(e,t){if(1&e&&(n.Rb(0,"button",15),n.Ec(1," Print "),n.Qb()),2&e){const e=n.ec(2);n.lc("useExistingCss",!0)("printTitle",e.context.title)}}function u(e,t){if(1&e){const e=n.Sb();n.Rb(0,"div",2),n.Rb(1,"h6",3),n.Ec(2),n.Qb(),n.Rb(3,"button",4),n.cc("click",(function(){return n.uc(e),n.ec().done()})),n.Rb(4,"span",5),n.Ec(5,"\xd7"),n.Qb(),n.Qb(),n.Qb(),n.Rb(6,"div",6),n.Rb(7,"div",7),n.Cc(8,d,1,2,"app-resource-property-details",8),n.Qb(),n.Rb(9,"div",9),n.Rb(10,"div",10),n.Cc(11,h,2,2,"button",11),n.Rb(12,"button",12),n.cc("click",(function(){return n.uc(e),n.ec().done()})),n.Mb(13,"i",13),n.Ec(14," Done "),n.Qb(),n.Qb(),n.Qb(),n.Qb()}if(2&e){const e=n.ec();n.yb(2),n.Fc(e.context.title),n.yb(6),n.lc("ngForOf",e.context.properties),n.yb(3),n.lc("ngIf",e.context.printable)}}let m=(()=>{class e{constructor(e,t,i,n){this.router=e,this.notifier=t,this.modalService=i,this.route=n}ngAfterViewInit(){if(!this.context||!this.context.data||!this.context.properties)return this.notifier.warning("Something went wrong, Undefined context","Resource Details"),void this.done();this.modal=this.modalService.open(this.content,{size:"md",backdrop:"static",keyboard:!1}),history.state.print&&setTimeout(()=>{document.getElementById("printer").click()},2e3)}done(){var e,t;const i=(null===(t=null===(e=this.context)||void 0===e?void 0:e.urls)||void 0===t?void 0:t.tableUrl)||"/users";console.log(i),this.router.navigateByUrl(i).then(e=>{var t;e&&(null===(t=this.modal)||void 0===t||t.dismiss(),this.modalService.dismissAll())})}}return e.\u0275fac=function(t){return new(t||e)(n.Lb(s.f),n.Lb(o.a),n.Lb(r.r),n.Lb(s.a))},e.\u0275cmp=n.Fb({type:e,selectors:[["app-resource-details"]],viewQuery:function(e,t){var i;1&e&&n.Jc(p,!0),2&e&&n.sc(i=n.dc())&&(t.content=i.first)},inputs:{context:"context"},decls:4,vars:1,consts:[["type","info",3,"close"],["content",""],[1,"modal-header"],[1,"modal-title","pt-1","mt-1"],["type","button",1,"close",2,"border","none","outline","none",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","resource-details",1,"list-group"],["class","list-group-item list-group-item-action",3,"resource","prop",4,"ngFor","ngForOf"],[1,"row"],[1,"col-12","text-right"],["id","printer","class","btn btn-md btn-rounded btn-secondary px-3","printSectionId","resource-details","ngxPrint","",3,"useExistingCss","printTitle",4,"ngIf"],["type","button",1,"btn","btn-md","btn-rounded","btn-primary","px-3",3,"click"],[1,"nc-icon","nc-check-2"],[1,"list-group-item","list-group-item-action",3,"resource","prop"],["id","printer","printSectionId","resource-details","ngxPrint","",1,"btn","btn-md","btn-rounded","btn-secondary","px-3",3,"useExistingCss","printTitle"]],template:function(e,t){1&e&&(n.Rb(0,"ngb-alert",0),n.cc("close",(function(){return t.done()})),n.Ec(1),n.Qb(),n.Cc(2,u,15,3,"ng-template",null,1,n.Dc)),2&e&&(n.yb(1),n.Fc(t.context.title))},directives:[r.c,a.t,a.u,l.a,c.a],styles:[""]}),e})()},PS3Z:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));class n{constructor(e,t,i,n,s){this.id=e,this.type=t,this.url=i,this.name=n}}},QGA0:function(e,t,i){"use strict";i.d(t,"a",(function(){return v}));var n=i("mrSG"),s=i("fXoL"),o=i("PS3Z"),r=i("AytR"),a=i("7pIB"),l=i("lGQG"),c=i("OC8m"),p=i("X9o6"),d=i("ofXK"),h=i("1kSV");function u(e,t){if(1&e){const e=s.Sb();s.Rb(0,"tr"),s.Rb(1,"td"),s.Mb(2,"img",16),s.Qb(),s.Rb(3,"td",17),s.Rb(4,"strong"),s.Ec(5),s.Qb(),s.Qb(),s.Rb(6,"td"),s.Ec(7),s.Qb(),s.Rb(8,"td",18),s.Rb(9,"i",19),s.cc("click",(function(){s.uc(e);const i=t.$implicit;return s.ec(2).delete(i)})),s.Qb(),s.Qb(),s.Qb()}if(2&e){const e=t.$implicit;s.yb(2),s.lc("src",e.url,s.wc)("alt",e.name),s.yb(3),s.Fc(e.name),s.yb(2),s.Fc(0==e.type?"Image":"Video")}}function m(e,t){if(1&e&&(s.Rb(0,"div",0),s.Rb(1,"div",5),s.Rb(2,"div",6),s.Rb(3,"label",7),s.Ec(4,"Current attachments"),s.Qb(),s.Rb(5,"div",8),s.Rb(6,"div",9),s.Rb(7,"table",10),s.Rb(8,"thead"),s.Rb(9,"tr"),s.Rb(10,"th",11),s.Ec(11),s.Qb(),s.Qb(),s.Rb(12,"tr"),s.Rb(13,"th",12),s.Ec(14,"\xa0"),s.Qb(),s.Rb(15,"th",13),s.Ec(16,"Name"),s.Qb(),s.Rb(17,"th",12),s.Ec(18,"Type"),s.Qb(),s.Rb(19,"th",14),s.Ec(20,"\xa0"),s.Qb(),s.Qb(),s.Qb(),s.Rb(21,"tbody"),s.Cc(22,u,10,4,"tr",15),s.Qb(),s.Qb(),s.Qb(),s.Qb(),s.Qb(),s.Qb(),s.Qb()),2&e){const e=s.ec();s.yb(11),s.Gc(" Selected: ",null==e.attachments?null:e.attachments.length," "),s.yb(11),s.lc("ngForOf",e.attachments)}}function b(e,t){if(1&e&&(s.Rb(0,"td"),s.Ec(1),s.fc(2,"number"),s.Qb()),2&e){const e=s.ec().$implicit;s.yb(1),s.Gc(" ",s.hc(2,1,(null==e||null==e.file?null:e.file.size)/1024/1024,".2")," MB ")}}function f(e,t){if(1&e&&(s.Rb(0,"tr"),s.Rb(1,"td"),s.Rb(2,"strong"),s.Ec(3),s.Qb(),s.Qb(),s.Cc(4,b,3,4,"td",27),s.Qb()),2&e){const e=t.$implicit,i=s.ec(2);s.yb(3),s.Fc(null==e||null==e.file?null:e.file.name),s.yb(1),s.lc("ngIf",i.uploader.options.isHTML5)}}function g(e,t){if(1&e){const e=s.Sb();s.Rb(0,"div",0),s.Rb(1,"div",5),s.Rb(2,"div",6),s.Rb(3,"label",20),s.Ec(4,"Upload queue"),s.Qb(),s.Rb(5,"div",8),s.Rb(6,"div",9),s.Rb(7,"table",10),s.Rb(8,"thead"),s.Rb(9,"tr"),s.Rb(10,"th",21),s.Ec(11),s.Qb(),s.Qb(),s.Rb(12,"tr"),s.Rb(13,"th"),s.Ec(14,"Name"),s.Qb(),s.Rb(15,"th"),s.Ec(16,"Size"),s.Qb(),s.Qb(),s.Qb(),s.Rb(17,"tbody"),s.Cc(18,f,5,2,"tr",15),s.Qb(),s.Qb(),s.Qb(),s.Qb(),s.Qb(),s.Rb(19,"div",6),s.Rb(20,"label",22),s.Ec(21," Queue progress "),s.Qb(),s.Rb(22,"div",8),s.Mb(23,"ngb-progressbar",23),s.Qb(),s.Qb(),s.Rb(24,"div",6),s.Rb(25,"button",24),s.cc("click",(function(){return s.uc(e),s.ec().uploader.uploadAll()})),s.Ec(26," Upload "),s.Qb(),s.Rb(27,"button",25),s.cc("click",(function(){return s.uc(e),s.ec().uploader.cancelAll()})),s.Ec(28," Cancel "),s.Qb(),s.Rb(29,"button",26),s.cc("click",(function(){return s.uc(e),s.ec().uploader.clearQueue()})),s.Ec(30," Remove "),s.Qb(),s.Qb(),s.Qb(),s.Qb()}if(2&e){const e=s.ec();s.yb(11),s.Gc("Queue length: ",null==e.uploader||null==e.uploader.queue?null:e.uploader.queue.length,""),s.yb(7),s.lc("ngForOf",e.uploader.queue),s.yb(5),s.lc("value",e.uploader.progress),s.yb(2),s.lc("disabled",!e.uploader.getNotUploadedItems().length),s.yb(2),s.lc("disabled",!e.uploader.isUploading),s.yb(2),s.lc("disabled",!e.uploader.queue.length)}}let v=(()=>{class e{constructor(e,t,i){this.auth=e,this.notifier=t,this.compressor=i,this.valueChange=new s.n}get value(){var e;return null===(e=this.attachments)||void 0===e?void 0:e.map(e=>Number.parseInt(e.id.toString(),10))}ngOnInit(){this.attachments&&Array.isArray(this.attachments)||(this.attachments=[]),this.initializeUploader()}fileChoserClick(){return Object(n.a)(this,void 0,void 0,(function*(){const e=yield this.compressor.uploadFile(),t=yield this.compressor.compressFile(e.image,e.orientation,50,50),i=this.base64ToBlob(t,"attachment-"+Date.now(),"image/png");this.uploader.addToQueue([i])}))}fileChoserChange(e){return Object(n.a)(this,void 0,void 0,(function*(){const t=e.target.files;for(let e=0;e<t.length;e++){const i=t.item(e),n=yield i.text();this.compressor.compressFile(n,this.compressor.DOC_ORIENTATION.NotDefined,50,50).then(e=>{const t=this.base64ToBlob(e,i.name,i.type);this.uploader.addToQueue([t])})}}))}initializeUploader(){this.uploader=new a.b({url:r.a.prepareUrl("attachmentUploadUrl"),authToken:"Bearer "+this.auth.appUser.token,allowedFileType:["image","video"],allowedMimeType:["image/png","image/jpg","image/jpeg"],autoUpload:!1,removeAfterUpload:!0,maxFileSize:5242880}),this.hasBaseDropZoneOver=!1,this.hasAnotherDropZoneOver=!1,this.uploader.onWhenAddingFileFailed=(e,t)=>{this.notifier.error(`File rejected because of '${t.name}'`,`Item '${e.name}'`)},this.uploader.onAfterAddingFile=e=>{this.attachments.length+this.uploader.queue.length>this.limit&&(this.uploader.removeFromQueue(e),this.notifier.warning("You cannot add more than "+this.limit+" attachments"))},this.uploader.onBuildItemForm=(e,t)=>{e.withCredentials=!1,t.append("type",e.file.type.split("/")[0])},this.uploader.onSuccessItem=(e,t,i,n)=>{const s=JSON.parse(t),r=new o.a(s.id,s.type,s.url,s.name);this.attachments.push(r),this.notifier.success("Attachment uploaded successfully!","Uploader"),this.valueChange.next({ids:this.value,entities:this.attachments})},this.uploader.onErrorItem=(e,t)=>{this.notifier.error("Failed to upload attachment","Uploader")}}fileOverBase(e){this.hasBaseDropZoneOver=e}fileOverAnother(e){this.hasAnotherDropZoneOver=e}delete(e){console.log(this.attachments),this.attachments.splice(this.attachments.indexOf(e),1),this.valueChange.next({ids:this.value,entities:this.attachments})}base64ToBlob(e,t,i){const n=atob(e.split(",")[1]),s=(e.split(",")[0].split(":")[1].split(";"),new ArrayBuffer(n.length)),o=new Uint8Array(s);for(let a=0;a<n.length;a++)o[a]=n.charCodeAt(a);const r=new DataView(s);return new File([r],t,{type:i})}}return e.\u0275fac=function(t){return new(t||e)(s.Lb(l.a),s.Lb(c.a),s.Lb(p.a))},e.\u0275cmp=s.Fb({type:e,selectors:[["app-attachments-uploader"]],inputs:{attachments:"attachments",limit:"limit"},outputs:{valueChange:"valueChange"},decls:9,vars:3,consts:[[1,"row"],[1,"col-md-12","mb-0"],[1,"btn","btn-md","btn-pill","btn-secondary","px-3",3,"disabled","click"],[1,"folder","outline","icon"],["class","row",4,"ngIf"],[1,"col-12"],[1,"form-group"],[1,"font-bold"],[1,"form-control"],[1,"table-responsive","overflow-hidden"],[1,"table","table-stripped"],["colspan","5",1,"text-danger"],[1,"text-info"],["colspan","3",1,"text-info"],[1,"text-info","text-right"],[4,"ngFor","ngForOf"],["width","50","height","50",3,"src","alt"],["colspan","3"],[1,"text-right","actions"],[1,"nc-icon","nc-simple-remove",3,"click"],[1,"h5"],["colspan","5"],[1,"h6"],[3,"value"],[1,"btn","btn-sm","btn-success",3,"disabled","click"],[1,"btn","btn-sm","btn-warning",3,"disabled","click"],[1,"btn","btn-sm","btn-danger",3,"disabled","click"],[4,"ngIf"]],template:function(e,t){1&e&&(s.Rb(0,"div",0),s.Rb(1,"div",1),s.Rb(2,"button",2),s.cc("click",(function(){return t.fileChoserClick()})),s.Mb(3,"i",3),s.Ec(4," Pick Files "),s.Qb(),s.Rb(5,"div"),s.Ec(6,"\xa0"),s.Qb(),s.Qb(),s.Qb(),s.Cc(7,m,23,2,"div",4),s.Cc(8,g,31,6,"div",4)),2&e&&(s.yb(2),s.lc("disabled",(null==t.attachments?null:t.attachments.length)===t.limit),s.yb(5),s.lc("ngIf",(null==t.attachments?null:t.attachments.length)>0),s.yb(1),s.lc("ngIf",(null==t.uploader||null==t.uploader.queue?null:t.uploader.queue.length)>0))},directives:[d.u,d.t,h.M],pipes:[d.g],styles:["[_nghost-%COMP%]   .actions[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:20px;margin-right:0;line-height:20px;width:25px;text-align:center;opacity:.8;cursor:pointer}[_nghost-%COMP%]   .actions[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]:hover{opacity:1}"]}),e})()},X9o6:function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i("fXoL");const s=function(){var e={Up:1,Down:3,Right:6,Left:8,UpMirrored:2,DownMirrored:4,LeftMirrored:5,RightMirrored:7,NotJpeg:-1,NotDefined:-2};return e[e.Up]="Up",e[e.Down]="Down",e[e.Right]="Right",e[e.Left]="Left",e[e.UpMirrored]="UpMirrored",e[e.DownMirrored]="DownMirrored",e[e.LeftMirrored]="LeftMirrored",e[e.RightMirrored]="RightMirrored",e[e.NotJpeg]="NotJpeg",e[e.NotDefined]="NotDefined",e}();class o{static getOrientation(e,t){const i=new FileReader;try{i.onload=function(e){const n=new DataView(i.result);if(65496!==n.getUint16(0,!1))return t(-2);const s=n.byteLength;let o=2;for(;o<s;){const e=n.getUint16(o,!1);if(o+=2,65505===e){if(1165519206!==n.getUint32(o+=2,!1))return t(-1);const e=18761===n.getUint16(o+=6,!1);o+=n.getUint32(o+4,e);const i=n.getUint16(o,e);o+=2;for(let s=0;s<i;s++)if(274===n.getUint16(o+12*s,e))return t(n.getUint16(o+12*s+8,e))}else{if(65280!=(65280&e))break;o+=n.getUint16(o,!1)}}return t(-1)},i.readAsArrayBuffer(e)}catch(n){return t(0)}}static uploadFile(e){return new Promise((function(t,i){const n=e.createElement("input");e.setStyle(n,"display","none"),e.setProperty(n,"type","file"),e.setProperty(n,"accept","image/*"),e.listen(n,"click",e=>{e.target.value=null}),e.listen(n,"change",e=>{const n=e.target.files[0],s=new FileReader;s.onloadend=e=>{try{o.getOrientation(n,e=>{t({image:s.result,orientation:e})})}catch(e){i(e)}};try{s.readAsDataURL(n)}catch(r){console.warn("ngx-image-compress - probably no file have been selected: "+r),i("No file selected")}}),n.click()}))}static compress(e,t,i,n=50,o=50){return new Promise((function(r,a){o/=100,n/=100;const l=new Image;l.onload=function(){const a=i.createElement("canvas"),c=a.getContext("2d");let p,d;if(p=l.naturalWidth,d=l.naturalHeight,t===s.Right||t===s.Left){const e=p;p=d,d=e}a.width=p*n,a.height=d*n;const h=Math.PI/180;t===s.Up?c.drawImage(l,0,0,a.width,a.height):t===s.Right?(c.save(),c.rotate(90*h),c.translate(0,-a.width),c.drawImage(l,0,0,a.height,a.width),c.restore()):t===s.Left?(c.save(),c.rotate(-90*h),c.translate(-a.width,0),c.drawImage(l,0,0,a.height,a.width),c.restore()):t===s.Down?(c.save(),c.rotate(180*h),c.translate(-a.width,-a.height),c.drawImage(l,0,0,a.width,a.height),c.restore()):c.drawImage(l,0,0,a.width,a.height);const u=e.substr(5,e.split(";")[0].length-5),m=a.toDataURL(u,o);r(m)},l.src=e}))}static byteCount(e){return encodeURI(e).split(/%..|./).length-1}}let r=(()=>{class e{constructor(e){this.DOC_ORIENTATION=s,this.render=e.createRenderer(null,null)}byteCount(e){return o.byteCount(e)}uploadFile(){return o.uploadFile(this.render)}compressFile(e,t,i=50,n=50){return o.compress(e,t,this.render,i,n)}}return e.\u0275fac=function(t){return new(t||e)(n.Zb(n.E))},e.\u0275prov=n.Hb({token:e,factory:e.\u0275fac}),e})()},bz7F:function(e,t,i){"use strict";i.d(t,"a",(function(){return h}));var n=i("fXoL"),s=i("ofXK"),o=i("1kSV");function r(e,t){if(1&e&&n.Mb(0,"img",7),2&e){const e=n.ec(2).$implicit;n.lc("src",e.url,n.wc)("alt",e.name)}}function a(e,t){if(1&e&&(n.Rb(0,"video",8),n.Mb(1,"source",9),n.Qb()),2&e){const e=n.ec(2).$implicit;n.yb(1),n.lc("src",e.url,n.wc)}}function l(e,t){if(1&e&&(n.Rb(0,"div",4),n.Cc(1,r,1,2,"img",5),n.Cc(2,a,2,1,"video",6),n.Qb()),2&e){const e=n.ec().$implicit;n.yb(1),n.lc("ngIf",0===e.type),n.yb(1),n.lc("ngIf",1===e.type)}}function c(e,t){1&e&&n.Cc(0,l,3,2,"ng-template",3)}function p(e,t){if(1&e&&(n.Rb(0,"ngb-carousel"),n.Cc(1,c,1,0,void 0,2),n.Qb()),2&e){const e=n.ec();n.yb(1),n.lc("ngForOf",e.attachments)}}function d(e,t){1&e&&(n.Rb(0,"ngb-alert",10),n.Rb(1,"h6"),n.Ec(2,"Problem!"),n.Qb(),n.Rb(3,"ul"),n.Rb(4,"li"),n.Ec(5,"Your attachments list is empty"),n.Qb(),n.Rb(6,"li"),n.Ec(7,"Something went wrong while initializing."),n.Qb(),n.Qb(),n.Qb()),2&e&&n.lc("dismissible",!1)}let h=(()=>{class e{constructor(){}ngOnInit(){console.log(this.attachments),this.attachments=Array.isArray(this.attachments)?this.attachments.filter(e=>null!=e&&void 0!==e):[]}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=n.Fb({type:e,selectors:[["app-attachments-viewer"]],inputs:{attachments:"attachments"},decls:3,vars:2,consts:[[4,"ngIf","ngIfElse"],["message",""],[4,"ngFor","ngForOf"],["ngbSlide",""],[1,"picsum-img-wrapper"],[3,"src","alt",4,"ngIf"],["controls","",4,"ngIf"],[3,"src","alt"],["controls",""],[3,"src"],["type","danger",3,"dismissible"]],template:function(e,t){if(1&e&&(n.Cc(0,p,2,1,"ngb-carousel",0),n.Cc(1,d,8,1,"ng-template",null,1,n.Dc)),2&e){const e=n.tc(2);n.lc("ngIf",t.attachments&&t.attachments.length>0)("ngIfElse",e)}},directives:[s.u,o.e,s.t,o.Q,o.c],styles:["[_nghost-%COMP%]   ngb-carousel[_ngcontent-%COMP%]{outline:none}[_nghost-%COMP%]   .picsum-img-wrapper[_ngcontent-%COMP%]   img[_ngcontent-%COMP%], [_nghost-%COMP%]   .picsum-img-wrapper[_ngcontent-%COMP%]   video[_ngcontent-%COMP%], [_nghost-%COMP%]   ngb-carousel[_ngcontent-%COMP%]{width:100%;height:400px}"]}),e})()},nHkx:function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var n=i("ofXK"),s=i("1kSV"),o=i("3Pt+"),r=i("7pIB"),a=i("X9o6"),l=i("fXoL");let c=(()=>{class e{}return e.\u0275mod=l.Jb({type:e}),e.\u0275inj=l.Ib({factory:function(t){return new(t||e)},providers:[a.a],imports:[[n.c,s.s,o.y,r.a]]}),e})()},"w+MF":function(e,t,i){"use strict";i.d(t,"a",(function(){return d}));var n=i("AytR"),s=i("fXoL"),o=i("tk/3"),r=i("tyNb"),a=i("1kSV"),l=i("OC8m");const c=["content"];function p(e,t){if(1&e){const e=s.Sb();s.Rb(0,"div",2),s.Rb(1,"h6",3),s.Ec(2),s.Qb(),s.Rb(3,"p"),s.Ec(4),s.Qb(),s.Qb(),s.Rb(5,"div",4),s.Rb(6,"button",5),s.cc("click",(function(){return s.uc(e),s.ec().delete()})),s.Ec(7,"Delete"),s.Qb(),s.Rb(8,"button",6),s.cc("click",(function(){return s.uc(e),s.ec().ok()})),s.Ec(9,"Cancel"),s.Qb(),s.Qb()}if(2&e){const e=s.ec();s.yb(2),s.Fc(null==e.context?null:e.context.title),s.yb(2),s.Fc(null==e.context?null:e.context.description),s.yb(2),s.lc("disabled",e.uploading)}}let d=(()=>{class e{constructor(e,t,i,n,s){this.http=e,this.router=t,this.route=i,this.modalService=n,this.notifier=s,this.uploading=!1}ngAfterViewInit(){this.modal=this.modalService.open(this.content,{backdrop:"static",keyboard:!1,size:"sm"}),this.modal&&this.context&&this.context.data||this.ok()}delete(){this.uploading=!0,this.http.delete(n.a.prepareUrl(this.context.deleteUrl,this.context.data)).subscribe(e=>{if(e)return history.state.runResolvers=!0,this.notifier.success("Resource deleted successfully"),this.ok(),void(this.uploading=!1);this.uploading=!1,this.notifier.error("Somthing went wrong, Failed to delete the resource")},e=>this.uploading=!1)}ok(){this.modal?this.modal.dismiss():this.modalService.dismissAll(),this.router.navigate(["../../"],{relativeTo:this.route})}}return e.\u0275fac=function(t){return new(t||e)(s.Lb(o.b),s.Lb(r.f),s.Lb(r.a),s.Lb(a.r),s.Lb(l.a))},e.\u0275cmp=s.Fb({type:e,selectors:[["app-resource-delete"]],viewQuery:function(e,t){var i;1&e&&s.Jc(c,!0),2&e&&s.sc(i=s.dc())&&(t.content=i.first)},inputs:{context:"context"},decls:4,vars:0,consts:[["type","info",3,"close"],["content",""],[1,"modal-body"],[1,"modal-title","mt-1","pt-2"],[1,"modal-footer"],[1,"btn","btn-sm","btn-rounded","btn-danger",3,"disabled","click"],[1,"btn","btn-sm","btn-rounded","btn-secondary",3,"click"]],template:function(e,t){1&e&&(s.Rb(0,"ngb-alert",0),s.cc("close",(function(){return t.ok()})),s.Ec(1,"Delete resource"),s.Qb(),s.Cc(2,p,10,3,"ng-template",null,1,s.Dc))},directives:[a.c],styles:[""]}),e})()}}]);