import{a as I}from"./chunk-DVDDNBHR.js";import{a as E}from"./chunk-ZTACZQT5.js";import{a as P}from"./chunk-I267ADJP.js";import{$a as r,Ca as d,Fa as s,Ga as u,Hf as y,La as f,Pb as S,Sa as h,Sb as c,Y as v,hg as M,ib as _,jb as g,kb as l,vc as w,wb as C,xb as m,zc as x}from"./chunk-4JM6MIZ5.js";import{i as p}from"./chunk-QJQRWPYR.js";var O=(i,t)=>({width:i,height:t});function R(i,t){if(i&1&&l(0,"img",5),i&2){let o=m();r("ngStyle",c(2,O,o.previewWidth,o.previewHeight))("src",o.imageSrc,d);}}function b(i,t){if(i&1&&l(0,"div",6),i&2){let o=m();r("ngStyle",c(1,O,o.previewWidth,o.previewHeight));}}var B=(()=>{let t=class t{serverService;inputLabel;inputName;previewWidth;previewHeight;imageSrc;allowedExtensionsMessage="";maxSizeText;serverConfig;bytesPipe;file;constructor(e){this.serverService=e,this.bytesPipe=new E(),this.maxSizeText="gehieneko tamaina";}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"(luzapenak: "+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&&y(this.file).then(e=>this.imageSrc=e);}};p(t,"\u0275fac",function(a){return new(a||t)(u(M));}),p(t,"\u0275cmp",f({type:t,selectors:[["my-preview-upload"]],inputs:{inputLabel:"inputLabel",inputName:"inputName",previewWidth:"previewWidth",previewHeight:"previewHeight"},features:[S([{provide:P,useExisting:v(()=>t),multi:!0}])],decls:5,vars:7,consts:()=>{let e;return e="Aurrebista",[[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(a,n){a&1&&(_(0,"div",0)(1,"div",1)(2,"my-reactive-file",2),C("fileChanged",function(T){return n.onFileChanged(T);}),g(),h(3,R,1,5,"img",3)(4,b,1,4,"div",4),g()()),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,w,x],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 i=t;return i;})();export{B as a};/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*///# sourceMappingURL=chunk-CYHZLAIM.js.map