import{a as O}from"./chunk-KQJ2QY7W.js";import{a as I}from"./chunk-7H2UZR47.js";import{a as y}from"./chunk-K34LZIA3.js";import{Ca as p,Da as f,Jb as C,Kb as w,Lf as M,Na as h,Nb as c,Va as a,X as v,ba as d,cb as _,db as g,eb as l,kg as E,qb as S,rb as m,tc as x,xc as P,za as u}from"./chunk-X3RCWQ3R.js";import{i}from"./chunk-SR6RTMQI.js";var T=(t,n)=>({width:t,height:n});function b(t,n){if(t&1&&l(0,"img",5),t&2){let r=m();a("ngStyle",c(2,T,r.previewWidth,r.previewHeight))("src",r.imageSrc,u);}}function z(t,n){if(t&1&&l(0,"div",6),t&2){let r=m();a("ngStyle",c(1,T,r.previewWidth,r.previewHeight));}}var j=(()=>{let n=class n{constructor(e){i(this,"serverService");i(this,"inputLabel");i(this,"inputName");i(this,"previewWidth");i(this,"previewHeight");i(this,"imageSrc");i(this,"allowedExtensionsMessage","");i(this,"maxSizeText");i(this,"serverConfig");i(this,"bytesPipe");i(this,"file");i(this,"propagateChange",e=>{});this.serverService=e,this.bytesPipe=new I(),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(e){this.file=e,this.propagateChange(this.file),this.updatePreview();}writeValue(e){this.file=e,this.updatePreview();}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}updatePreview(){this.file&&M(this.file).then(e=>this.imageSrc=e);}};i(n,"\u0275fac",function(s){return new(s||n)(f(E));}),i(n,"\u0275cmp",d({type:n,selectors:[["my-preview-upload"]],inputs:{inputLabel:"inputLabel",inputName:"inputName",previewWidth:"previewWidth",previewHeight:"previewHeight"},standalone:!0,features:[C([{provide:y,useExisting:v(()=>n),multi:!0}]),w],decls:5,vars:7,consts:()=>{let e;return e="N\xE1h\u013Ead",[[1,"root"],[1,"preview-container"],["placement","right","icon","edit","theme","primary",3,"fileChanged","inputName","inputLabel","extensions","maxFileSize","buttonTooltip"],["class","preview","alt",e,3,"ngStyle","src",4,"ngIf"],["class","preview no-image",3,"ngStyle",4,"ngIf"],["alt",e,1,"preview",3,"ngStyle","src"],[1,"preview","no-image",3,"ngStyle"]];},template:function(s,o){s&1&&(_(0,"div",0)(1,"div",1)(2,"my-reactive-file",2),S("fileChanged",function(R){return o.onFileChanged(R);}),g(),h(3,b,1,5,"img",3)(4,z,1,4,"div",4),g()()),s&2&&(p(2),a("inputName",o.inputName)("inputLabel",o.inputLabel)("extensions",o.videoImageExtensions)("maxFileSize",o.maxVideoImageSize)("buttonTooltip",o.getReactiveFileButtonTooltip()),p(),a("ngIf",o.imageSrc),p(),a("ngIf",!o.imageSrc));},dependencies:[O,x,P],styles:[`.root[_ngcontent-%COMP%]{height:auto;display:flex;flex-direction:column}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]{position:relative}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   my-reactive-file[_ngcontent-%COMP%]{position:absolute;bottom:10px;left:10px}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   .preview[_ngcontent-%COMP%]{object-fit:cover;border-radius:4px;max-width:100%}.root[_ngcontent-%COMP%]   .preview-container[_ngcontent-%COMP%]   .preview.no-image[_ngcontent-%COMP%]{border:2px solid #808080;background-color:var(--bg)}
/*# sourceMappingURL=preview-upload.component-6FJI6WDK.css.map */`]}));let t=n;return t;})();export{j as a};/**i18n:3d16453f213eb5db982e7e7dd90631843ac5d3f860726a614777c3e9e3f9b57e*///# sourceMappingURL=chunk-TTSBZGQV.js.map