import{a as W}from"./chunk-QEXK3RM7.js";import{a as B}from"./chunk-FE553XN2.js";import{a as G}from"./chunk-CA7DUKLG.js";import{C as U,a as F,g as L,n as V}from"./chunk-AWFGIQSJ.js";import{Cb as S,Db as _,Ea as y,Gc as z,Gh as H,Ha as m,Jc as D,Pb as x,Rc as I,Sa as E,Wb as O,X as M,Xb as R,Ya as v,Yb as T,aa as b,ac as A,cc as N,eb as l,gh as $,ha as p,ia as d,jb as C,ob as g,pb as c,qb as f,ta as a,tc as P,ub as w}from"./chunk-GKQGDBUU.js";import{i as u}from"./chunk-QVFSZZWQ.js";var X=t=>({"buttons-aside":t});function j(t,n){if(t&1&&f(0,"img",2),t&2){let r=_();l("ngStyle",r.previewSize())("src",r.imageSrc,y);}}function q(t,n){if(t&1&&f(0,"div",3),t&2){let r=_();l("ngStyle",r.previewSize());}}function Q(t,n){if(t&1){let r=w();g(0,"my-delete-button",7),S("click",function(){p(r),_();let o=x(5);return d(o.reset());}),c();}}var le=(()=>{let n=class n{serverService=b(H);inputName=a.required();inputLabel=a(void 0);displayDelete=a(!1,{transform:P});buttonsAside=a(!1,{transform:P});previewSize=a(void 0);imageSrc;allowedExtensionsMessage="";maxSizeText;file;serverConfig;bytesPipe;constructor(){this.bytesPipe=new B(),this.maxSizeText="max ve\u013Ekos\u0165";}get videoImageExtensions(){return this.serverConfig.video.image.extensions;}get maxVideoImageSize(){return this.serverConfig.video.image.size.max;}get maxVideoImageSizeInBytes(){return this.bytesPipe.transform(this.maxVideoImageSize);}getReactiveFileButtonTooltip(){return"(roz\u0161\xEDrenia: "+this.videoImageExtensions+", "+this.maxSizeText+": "+this.maxVideoImageSizeInBytes+")";}ngOnInit(){this.serverConfig=this.serverService.getHTMLConfig(),this.allowedExtensionsMessage=this.videoImageExtensions.join(", ");}onFileChanged(i){this.file=i,this.propagateChange(this.file),this.updatePreview();}propagateChange=i=>{};writeValue(i){this.file=i,this.updatePreview();}registerOnChange(i){this.propagateChange=i;}registerOnTouched(){}updatePreview(){this.file?$(this.file).then(i=>this.imageSrc=i):this.imageSrc=void 0;}};u(n,"\u0275fac",function(o){return new(o||n)();}),u(n,"\u0275cmp",E({type:n,selectors:[["my-preview-upload"]],inputs:{inputName:[1,"inputName"],inputLabel:[1,"inputLabel"],displayDelete:[1,"displayDelete"],buttonsAside:[1,"buttonsAside"],previewSize:[1,"previewSize"]},features:[A([{provide:F,useExisting:M(()=>n),multi:!0}])],decls:7,vars:11,consts:()=>{let i;i="N\xE1h\u013Ead";let o;return o="Delete the image",[["reactiveFile",""],[1,"preview-container",3,"ngClass"],["alt",i,1,"preview",3,"ngStyle","src"],[1,"preview","no-image",3,"ngStyle"],[1,"buttons"],["placement","right","icon","upload","theme","primary",3,"ngModelChange","fileChanged","ngModel","inputName","inputLabel","extensions","maxFileSize","buttonTooltip"],["title",o,"theme","danger"],["title",o,"theme","danger",3,"click"]];},template:function(o,e){if(o&1){let h=w();g(0,"div",1),v(1,j,1,2,"img",2)(2,q,1,1,"div",3),g(3,"div",4)(4,"my-reactive-file",5,0),T("ngModelChange",function(s){return p(h),R(e.file,s)||(e.file=s),d(s);}),S("fileChanged",function(s){return p(h),d(e.onFileChanged(s));}),c(),v(6,Q,1,0,"my-delete-button",6),c()();}o&2&&(l("ngClass",N(9,X,e.buttonsAside())),m(),C(e.imageSrc?1:2),m(3),O("ngModel",e.file),l("inputName",e.inputName())("inputLabel",e.inputLabel())("extensions",e.videoImageExtensions)("maxFileSize",e.maxVideoImageSize)("buttonTooltip",e.getReactiveFileButtonTooltip()),m(2),C(e.displayDelete()&&e.file?6:-1));},dependencies:[I,z,D,U,L,V,W,G],styles:[`[_nghost-%COMP%]{display:block}.preview-container[_ngcontent-%COMP%], .preview[_ngcontent-%COMP%]{height:100%;width:100%}.preview-container[_ngcontent-%COMP%]{position:relative}.preview-container[_ngcontent-%COMP%]   .buttons[_ngcontent-%COMP%]{display:flex;gap:10px}.preview-container[_ngcontent-%COMP%]   .preview[_ngcontent-%COMP%]{object-fit:cover;border-radius:4px;max-width:100%}.preview-container[_ngcontent-%COMP%]:not(.buttons-aside)   .buttons[_ngcontent-%COMP%]{position:absolute;bottom:10px;left:10px;flex-wrap:wrap}.preview-container[_ngcontent-%COMP%]:not(.buttons-aside)   .preview.no-image[_ngcontent-%COMP%]{border:2px solid var(--secondary-icon-color);background-color:var(--bg)}.preview-container.buttons-aside[_ngcontent-%COMP%]{text-align:center;border:1px solid var(--secondary-icon-color);border-radius:4px;width:min-content;padding-inline-start:calc(1.275rem + .3vw);padding-inline-end:calc(1.275rem + .3vw);padding-top:1rem;padding-bottom:1rem}@media (min-width: 1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-start:1.5rem}}@media (min-width: 1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-end:1.5rem}}.preview-container.buttons-aside[_ngcontent-%COMP%]   .buttons[_ngcontent-%COMP%]{margin-top:1rem}
/*# sourceMappingURL=preview-upload.component-OFG3FQCP.css.map */`]}));let t=n;return t;})();export{le as a};/**i18n:42345378061bf3c93df67acfa161b751a7b03cc91f3ede7c1f1cdf2bba62fe26*///# sourceMappingURL=chunk-G4H235M3.js.map