File: /mnt/data/smarthr-co-in/demo/angular/template/chunk-HAJAHZS2.js
import{e as ne}from"./chunk-2U5AECGN.js";import"./chunk-ROUB2DV5.js";import"./chunk-D2NXOKOR.js";import"./chunk-3OLHRZ2P.js";import"./chunk-OH3XPIE7.js";import"./chunk-PYXABXFS.js";import"./chunk-RAVHNKJU.js";import{y as te}from"./chunk-7PPOABPU.js";import{a as ie}from"./chunk-ILLDEPHH.js";import{d as R}from"./chunk-WA2UGD5L.js";import"./chunk-BT37DHWM.js";import{Ab as Y,Cb as X,Eb as P,Ec as B,Hd as N,Kb as J,Pb as k,Qb as j,Rb as T,Sb as f,Tb as l,Ub as s,Vb as b,ab as U,ac as y,bc as Q,cc as g,ec as C,fa as H,fb as _,fc as F,ga as W,gc as z,hc as $,ic as K,jc as V,kb as O,kc as E,pa as v,qa as h,qc as q,ra as A,rc as ee,sb as I,tc as c,wd as M,yb as x,zb as G}from"./chunk-AQ27DSQO.js";import{f as w}from"./chunk-EQDQRRRY.js";var re=[[["ngx-dropzone-label"]]],le=["ngx-dropzone-label"];function fe(i,r){if(i&1){let e=y();l(0,"ngx-dropzone-remove-badge",1),g("click",function(o){v(e);let n=C();return h(n._remove(o))}),s()}}var _e=["fileInput"],ve=[[["ngx-dropzone-preview"]],"*",[["ngx-dropzone-label"]]],he=["ngx-dropzone-preview","*","ngx-dropzone-label"];function xe(i,r){i&1&&z(0,2,["*ngIf","!_hasPreviews"])}function be(i,r){if(i&1){let e=y();l(0,"ngx-dropzone-remove-badge",2),g("click",function(o){v(e);let n=C();return h(n._remove(o))}),s()}}var se=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=Y({type:i,selectors:[["ngx-dropzone-label"]],standalone:!1}),i})();function D(i){return i!=null&&`${i}`!="false"}function ye(i){return!isNaN(parseFloat(i))&&!isNaN(Number(i))?Number(i):null}var ae=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=x({type:i,selectors:[["ngx-dropzone-remove-badge"]],standalone:!1,decls:3,vars:0,consts:[["x1","0","y1","0","x2","10","y2","10"],["x1","0","y1","10","x2","10","y2","0"]],template:function(e,t){e&1&&(A(),l(0,"svg"),b(1,"line",0)(2,"line",1),s())},styles:["[_nghost-%COMP%]{display:flex;justify-content:center;align-items:center;height:22px;width:22px;position:absolute;top:5px;right:5px;border-radius:50%;background:#bbb;color:#333;cursor:pointer}[_nghost-%COMP%]:hover{background:#aeaeae}[_nghost-%COMP%] > svg[_ngcontent-%COMP%]{height:10px;width:10px}[_nghost-%COMP%] > svg[_ngcontent-%COMP%] > line[_ngcontent-%COMP%]{stroke-width:2px;stroke:#fff}"]}),i})(),Z=(function(i){return i[i.BACKSPACE=8]="BACKSPACE",i[i.DELETE=46]="DELETE",i})(Z||{}),L=(()=>{class i{constructor(e){this.sanitizer=e,this._removable=!1,this.removed=new O,this.tabIndex=0}set file(e){this._file=e}get file(){return this._file}get removable(){return this._removable}set removable(e){this._removable=D(e)}keyEvent(e){switch(e.keyCode){case Z.BACKSPACE:case Z.DELETE:this.remove();break;default:break}}get hostStyle(){return this.sanitizer.bypassSecurityTrustStyle(`
display: flex;
height: 140px;
min-height: 140px;
min-width: 180px;
max-width: 180px;
justify-content: center;
align-items: center;
padding: 0 20px;
margin: 10px;
border-radius: 5px;
position: relative;
`)}_remove(e){e.stopPropagation(),this.remove()}remove(){this._removable&&this.removed.next(this.file)}readFile(){return w(this,null,function*(){return new Promise((e,t)=>{let o=new FileReader;if(o.onload=n=>{e(n.target.result)},o.onerror=n=>{console.error(`FileReader failed on file ${this.file.name}.`),t(n)},!this.file)return t("No file to read. Please provide a file using the [file] Input property.");o.readAsDataURL(this.file)})})}}return i.\u0275fac=function(e){return new(e||i)(I(R))},i.\u0275cmp=x({type:i,selectors:[["ngx-dropzone-preview"]],hostVars:3,hostBindings:function(e,t){e&1&&g("keyup",function(n){return t.keyEvent(n)}),e&2&&(Q("tabIndex",t.tabIndex),ee(t.hostStyle))},inputs:{file:"file",removable:"removable"},outputs:{removed:"removed"},standalone:!1,ngContentSelectors:le,decls:2,vars:1,consts:[[3,"click",4,"ngIf"],[3,"click"]],template:function(e,t){e&1&&(F(re),z(0),P(1,fe,1,0,"ngx-dropzone-remove-badge",0)),e&2&&(_(),f("ngIf",t.removable))},dependencies:[ae,M],styles:["[_nghost-%COMP%]{background-image:linear-gradient(to top,#ededed,#efefef,#f1f1f1,#f4f4f4,#f6f6f6)}[_nghost-%COMP%]:hover, [_nghost-%COMP%]:focus{background-image:linear-gradient(to top,#e3e3e3,#ebeaea,#e8e7e7,#ebeaea,#f4f4f4);outline:0}[_nghost-%COMP%]:hover ngx-dropzone-remove-badge[_ngcontent-%COMP%], [_nghost-%COMP%]:focus ngx-dropzone-remove-badge[_ngcontent-%COMP%]{opacity:1}[_nghost-%COMP%] ngx-dropzone-remove-badge[_ngcontent-%COMP%]{opacity:0}[_nghost-%COMP%] ngx-dropzone-label{overflow-wrap:break-word}"]}),i})(),oe=(()=>{class i{parseFileList(e,t,o,n){let d=[],p=[];for(let m=0;m<e.length;m++){let u=e.item(m);if(!this.isAccepted(u,t)){this.rejectFile(p,u,"type");continue}if(o&&u.size>o){this.rejectFile(p,u,"size");continue}if(!n&&d.length>=1){this.rejectFile(p,u,"no_multiple");continue}d.push(u)}return{addedFiles:d,rejectedFiles:p}}isAccepted(e,t){if(t==="*")return!0;let o=t.split(",").map(a=>a.toLowerCase().trim()),n=e.type.toLowerCase(),d=e.name.toLowerCase();return!!o.find(a=>a.endsWith("/*")?n.split("/")[0]===a.split("/")[0]:a.startsWith(".")?d.endsWith(a):a==n)}rejectFile(e,t,o){let n=t;n.reason=o,e.push(n)}}return i.\u0275fac=function(e){return new(e||i)},i.\u0275prov=H({token:i,factory:i.\u0275fac}),i})(),de=(()=>{class i{constructor(e){this.service=e,this.change=new O,this.accept="*",this._disabled=!1,this._multiple=!0,this._maxFileSize=void 0,this._expandable=!1,this._disableClick=!1,this._processDirectoryDrop=!1,this._isHovered=!1}get _hasPreviews(){return!!this._previewChildren.length}get disabled(){return this._disabled}set disabled(e){this._disabled=D(e),this._isHovered&&(this._isHovered=!1)}get multiple(){return this._multiple}set multiple(e){this._multiple=D(e)}get maxFileSize(){return this._maxFileSize}set maxFileSize(e){this._maxFileSize=ye(e)}get expandable(){return this._expandable}set expandable(e){this._expandable=D(e)}get disableClick(){return this._disableClick}set disableClick(e){this._disableClick=D(e)}get processDirectoryDrop(){return this._processDirectoryDrop}set processDirectoryDrop(e){this._processDirectoryDrop=D(e)}_onClick(){this.disableClick||this.showFileSelector()}_onDragOver(e){this.disabled||(this.preventDefault(e),this._isHovered=!0)}_onDragLeave(){this._isHovered=!1}_onDrop(e){if(!this.disabled)if(this.preventDefault(e),this._isHovered=!1,!this.processDirectoryDrop||!DataTransferItem.prototype.webkitGetAsEntry)this.handleFileDrop(e.dataTransfer.files);else{let t=e.dataTransfer.items;if(t.length>0){let o=[],n=[];for(let p=0;p<t.length;p++){let a=t[p].webkitGetAsEntry();a.isFile?o.push(e.dataTransfer.files[p]):a.isDirectory&&n.push(a)}let d=new DataTransfer;if(o.forEach(p=>{d.items.add(p)}),!n.length&&d.items.length&&this.handleFileDrop(d.files),n.length){let p=[];for(let a of n)p.push(this.extractFilesFromDirectory(a));Promise.all(p).then(a=>{a.reduce((m,u)=>[...m,...u]).forEach(m=>{d.items.add(m)}),this.handleFileDrop(d.files)})}}}}extractFilesFromDirectory(e){function t(o){return w(this,null,function*(){try{return yield new Promise((n,d)=>o.file(n,d))}catch(n){console.log("Error converting a fileEntry to a File: ",n)}})}return new Promise((o,n)=>{let d=[],p=e.createReader(),a=()=>{p.readEntries(m=>w(null,null,function*(){if(!m.length)o(d);else{let u=m.filter(S=>S.isFile);for(let S of u){let me=yield t(S);d.push(me)}a()}}))};a()})}showFileSelector(){this.disabled||this._fileInput.nativeElement.click()}_onFilesSelected(e){let t=e.target.files;this.handleFileDrop(t),this._fileInput.nativeElement.value="",this.preventDefault(e)}handleFileDrop(e){let t=this.service.parseFileList(e,this.accept,this.maxFileSize,this.multiple);this.change.next({addedFiles:t.addedFiles,rejectedFiles:t.rejectedFiles,source:this})}preventDefault(e){e.preventDefault(),e.stopPropagation()}}return i.\u0275fac=function(e){return new(e||i)(I(oe,2))},i.\u0275cmp=x({type:i,selectors:[["ngx-dropzone"],["","ngx-dropzone",""]],contentQueries:function(e,t,o){if(e&1&&$(o,L,5),e&2){let n;V(n=E())&&(t._previewChildren=n)}},viewQuery:function(e,t){if(e&1&&K(_e,7),e&2){let o;V(o=E())&&(t._fileInput=o.first)}},hostVars:8,hostBindings:function(e,t){e&1&&g("click",function(){return t._onClick()})("dragover",function(n){return t._onDragOver(n)})("dragleave",function(){return t._onDragLeave()})("drop",function(n){return t._onDrop(n)}),e&2&&q("ngx-dz-disabled",t.disabled)("expandable",t.expandable)("unclickable",t.disableClick)("ngx-dz-hovered",t._isHovered)},inputs:{accept:"accept",disabled:"disabled",multiple:"multiple",maxFileSize:"maxFileSize",expandable:"expandable",disableClick:"disableClick",processDirectoryDrop:"processDirectoryDrop",id:"id",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedBy:[0,"aria-describedby","ariaDescribedBy"]},outputs:{change:"change"},standalone:!1,features:[B([oe])],ngContentSelectors:he,decls:5,vars:8,consts:[["fileInput",""],["type","file",3,"change","id","multiple","accept","disabled"],[4,"ngIf"]],template:function(e,t){if(e&1){let o=y();F(ve),l(0,"input",1,0),g("change",function(d){return v(o),h(t._onFilesSelected(d))}),s(),P(2,xe,1,0,"ng-content",2),z(3),z(4,1)}e&2&&(f("id",t.id)("multiple",t.multiple)("accept",t.accept)("disabled",t.disabled),J("aria-label",t.ariaLabel)("aria-labelledby",t.ariaLabelledby)("aria-describedby",t.ariaDescribedBy),_(2),f("ngIf",!t._hasPreviews))},dependencies:[M],styles:["[_nghost-%COMP%]{display:flex;align-items:center;height:180px;background:#fff;cursor:pointer;color:#717386;border:2px dashed #717386;border-radius:5px;font-size:16px;overflow-x:auto}.ngx-dz-hovered[_nghost-%COMP%]{border-style:solid}.ngx-dz-disabled[_nghost-%COMP%]{opacity:.5;cursor:no-drop;pointer-events:none}.expandable[_nghost-%COMP%]{overflow:hidden;height:unset;min-height:180px;flex-wrap:wrap}.unclickable[_nghost-%COMP%]{cursor:default}[_nghost-%COMP%] ngx-dropzone-label{text-align:center;z-index:10;margin:10px auto}[_nghost-%COMP%] input[_ngcontent-%COMP%]{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute;z-index:-1}[_nghost-%COMP%] input[_ngcontent-%COMP%]:focus + ngx-dropzone-label{outline:1px dotted #000;outline:-webkit-focus-ring-color auto 5px}"]}),i})(),pe=(()=>{class i extends L{constructor(e){super(e),this.defaultImgLoading="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBiYWNrZ3JvdW5kOiByZ2IoMjQxLCAyNDIsIDI0Mykgbm9uZSByZXBlYXQgc2Nyb2xsIDAlIDAlOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgd2lkdGg9IjIyNHB4IiBoZWlnaHQ9IjIyNHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSIxNCIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2U9IiM4NWEyYjYiIHN0cm9rZS1kYXNoYXJyYXk9IjIxLjk5MTE0ODU3NTEyODU1MiAyMS45OTExNDg1NzUxMjg1NTIiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+CiAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGR1cj0iMS4xNjI3OTA2OTc2NzQ0MTg0cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGtleVRpbWVzPSIwOzEiIHZhbHVlcz0iMCA1MCA1MDszNjAgNTAgNTAiPjwvYW5pbWF0ZVRyYW5zZm9ybT4KPC9jaXJjbGU+CjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjEwIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZT0iI2JiY2VkZCIgc3Ryb2tlLWRhc2hhcnJheT0iMTUuNzA3OTYzMjY3OTQ4OTY2IDE1LjcwNzk2MzI2Nzk0ODk2NiIgc3Ryb2tlLWRhc2hvZmZzZXQ9IjE1LjcwNzk2MzI2Nzk0ODk2NiIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj4KICA8YW5pbWF0ZVRyYW5zZm9ybSBhdHRyaWJ1dGVOYW1lPSJ0cmFuc2Zvcm0iIHR5cGU9InJvdGF0ZSIgZHVyPSIxLjE2Mjc5MDY5NzY3NDQxODRzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIga2V5VGltZXM9IjA7MSIgdmFsdWVzPSIwIDUwIDUwOy0zNjAgNTAgNTAiPjwvYW5pbWF0ZVRyYW5zZm9ybT4KPC9jaXJjbGU+CjwhLS0gW2xkaW9dIGdlbmVyYXRlZCBieSBodHRwczovL2xvYWRpbmcuaW8vIC0tPjwvc3ZnPg==",this.imageSrc=this.sanitizer.bypassSecurityTrustUrl(this.defaultImgLoading)}set file(e){this._file=e,this.renderImage()}get file(){return this._file}ngOnInit(){this.renderImage()}renderImage(){this.readFile().then(e=>setTimeout(()=>this.imageSrc=e)).catch(e=>console.error(e))}}return i.\u0275fac=function(e){return new(e||i)(I(R))},i.\u0275cmp=x({type:i,selectors:[["ngx-dropzone-image-preview"]],inputs:{file:"file"},standalone:!1,features:[B([{provide:L,useExisting:i}]),X],ngContentSelectors:le,decls:3,vars:2,consts:[[3,"src"],[3,"click",4,"ngIf"],[3,"click"]],template:function(e,t){e&1&&(F(re),b(0,"img",0),z(1),P(2,be,1,0,"ngx-dropzone-remove-badge",1)),e&2&&(f("src",t.imageSrc,U),_(2),f("ngIf",t.removable))},dependencies:[ae,M],styles:["[_nghost-%COMP%]{min-width:unset!important;max-width:unset!important;padding:0!important}[_nghost-%COMP%]:hover img[_ngcontent-%COMP%], [_nghost-%COMP%]:focus img[_ngcontent-%COMP%]{opacity:.7}[_nghost-%COMP%]:hover ngx-dropzone-remove-badge[_ngcontent-%COMP%], [_nghost-%COMP%]:focus ngx-dropzone-remove-badge[_ngcontent-%COMP%]{opacity:1}[_nghost-%COMP%] ngx-dropzone-remove-badge[_ngcontent-%COMP%]{opacity:0}[_nghost-%COMP%] img[_ngcontent-%COMP%]{max-height:100%;border-radius:5px;opacity:.8}[_nghost-%COMP%] ngx-dropzone-label{position:absolute;overflow-wrap:break-word}"]}),i})();var ce=(()=>{class i{}return i.\u0275fac=function(e){return new(e||i)},i.\u0275mod=G({type:i}),i.\u0275inj=W({imports:[[N]]}),i})();function ze(i,r){if(i&1){let e=y();l(0,"ngx-dropzone-image-preview",20),g("removed",function(){let o=v(e).$implicit,n=C();return h(n.onRemoveSingle(o))}),s()}if(i&2){let e=r.$implicit;f("file",e)("removable",!0)}}function De(i,r){if(i&1){let e=y();l(0,"ngx-dropzone-image-preview",20),g("removed",function(){let o=v(e).$implicit,n=C();return h(n.onRemoveMultiple(o))}),s()}if(i&2){let e=r.$implicit;f("file",e)("removable",!0)}}var ge=class i{routes=ie;singleFile=[];multipleFiles=[];onSingleSelect(r){this.singleFile=[],this.singleFile.push(...r.addedFiles)}onMultipleSelect(r){this.multipleFiles.push(...r.addedFiles)}onRemoveSingle(r){this.singleFile.splice(this.singleFile.indexOf(r),1)}onRemoveMultiple(r){this.multipleFiles.splice(this.multipleFiles.indexOf(r),1)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=x({type:i,selectors:[["app-form-fileupload"]],decls:46,vars:1,consts:[[1,"page-header"],[1,"row"],[1,"col-sm-12"],[1,"page-title"],[1,"col-md-12"],[1,"card"],[1,"card-header"],[1,"card-title"],[1,"card-body"],["data-upload-id","myFirstImage",1,"custom-file-container"],["href","javascript:void(0)","title","Clear Image",1,"custom-file-container__image-clear"],[1,"service-upload",3,"change","multiple"],[1,"drop-browse","align-center"],[1,"d-flex"],[1,"text-primary","ms-1"],[1,"text-muted"],["ngProjectAs","ngx-dropzone-preview",5,["ngx-dropzone-preview"],3,"file","removable"],["data-upload-id","mySecondImage",1,"custom-file-container"],[1,"service-upload",3,"change"],[1,"custom-file-container__image-preview"],["ngProjectAs","ngx-dropzone-preview",5,["ngx-dropzone-preview"],3,"removed","file","removable"]],template:function(e,t){e&1&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),c(4,"File Upload"),s()()()(),l(5,"div",1)(6,"div",4)(7,"div",5)(8,"div",6)(9,"h5",7),c(10,"Single File Upload"),s()(),l(11,"div",8)(12,"div",9)(13,"label"),c(14,"Upload (Single File) "),b(15,"a",10),s(),l(16,"ngx-dropzone",11),g("change",function(n){return t.onSingleSelect(n)}),l(17,"ngx-dropzone-label",12)(18,"div",13),c(19," Drop your files here or"),l(20,"span",14),c(21,"browse"),s()(),l(22,"span",15),c(23,"Maximum size: 50MB"),s()(),j(24,ze,1,2,"ngx-dropzone-image-preview",16,k),s()()()(),l(26,"div",5)(27,"div",6)(28,"h5",7),c(29,"Multiple File Upload"),s()(),l(30,"div",8)(31,"div",17)(32,"label"),c(33,"Upload (Allow Multiple) "),b(34,"a",10),s(),l(35,"ngx-dropzone",18),g("change",function(n){return t.onMultipleSelect(n)}),l(36,"ngx-dropzone-label",12)(37,"div",13),c(38," Drop your files here or"),l(39,"span",14),c(40,"browse"),s()(),l(41,"span",15),c(42,"Maximum size: 50MB"),s()(),j(43,De,1,2,"ngx-dropzone-image-preview",16,k),s(),b(45,"div",19),s()()()()()),e&2&&(_(16),f("multiple",!1),_(8),T(t.singleFile),_(19),T(t.multipleFiles))},dependencies:[N,te,ne,ce,de,se,pe],encapsulation:2})};export{ge as FormFileuploadComponent};