import{b as I}from"./chunk-7KOOTHBP.js";import{a as E}from"./chunk-T3QPQ646.js";import{a as y}from"./chunk-77K4SKWD.js";import{Ab as S,Bb as c,Cc as x,Da as f,Ga as s,Gc as P,Ra as h,Wb as w,X as v,Xa as _,Zb as d,_g as M,aa as u,db as r,mb as C,nb as l,ob as m,sa as p,yh as O}from"./chunk-IDYB4NXF.js";import{i as g}from"./chunk-AI7IVZV2.js";var T=(i,t)=>({width:i,height:t});function b(i,t){if(i&1&&m(0,"img",5),i&2){let o=c();r("ngStyle",d(2,T,o.previewWidth(),o.previewHeight()))("src",o.imageSrc,f);}}function z(i,t){if(i&1&&m(0,"div",6),i&2){let o=c();r("ngStyle",d(1,T,o.previewWidth(),o.previewHeight()));}}var B=(()=>{let t=class t{serverService=u(O);inputLabel=p(void 0);inputName=p(void 0);previewWidth=p(void 0);previewHeight=p(void 0);imageSrc;allowedExtensionsMessage="";maxSizeText;serverConfig;bytesPipe;file;constructor(){this.bytesPipe=new E(),this.maxSizeText="max velikost";}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\xED\u0159en\xED: "+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();}propagateChange=e=>{};writeValue(e){this.file=e,this.updatePreview();}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}updatePreview(){this.file&&M(this.file).then(e=>this.imageSrc=e);}};g(t,"\u0275fac",function(a){return new(a||t)();}),g(t,"\u0275cmp",h({type:t,selectors:[["my-preview-upload"]],inputs:{inputLabel:[1,"inputLabel"],inputName:[1,"inputName"],previewWidth:[1,"previewWidth"],previewHeight:[1,"previewHeight"]},features:[w([{provide:y,useExisting:v(()=>t),multi:!0}])],decls:5,vars:7,consts:()=>{let e;return e="N\xE1hled",[[1,"root"],[1,"preview-container"],["placement","right","icon","upload","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(a,n){a&1&&(C(0,"div",0)(1,"div",1)(2,"my-reactive-file",2),S("fileChanged",function(R){return n.onFileChanged(R);}),l(),_(3,b,1,5,"img",3)(4,z,1,4,"div",4),l()()),a&2&&(s(2),r("inputName",n.inputName())("inputLabel",n.inputLabel())("extensions",n.videoImageExtensions)("maxFileSize",n.maxVideoImageSize)("buttonTooltip",n.getReactiveFileButtonTooltip()),s(),r("ngIf",n.imageSrc),s(),r("ngIf",!n.imageSrc));},dependencies:[I,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-OZB5O7YW.css.map */`]}));let i=t;return i;})();export{B as a};/**i18n:1cf7c077143c4c267fdafbe5508f191afcef21bad6aba22a3a8dc180e1003753*///# sourceMappingURL=chunk-B3ACQASL.js.map