import{Ar as Tu,Da as e5,Eo as kb,Ga as g$,Gr as Va,Ia as f$,Io as lA,Is as rh,J as EI,Kn as Pw,Lr as Uj,Oa as eAe,Oi as Zt,Oo as kj,Q as EV,Qi as bV,Qr as W$,T as C3,Wa as g,Yi as bI,Za as gx,Zo as n5,_s as ph,ec as th,gc as wf,it as FB,p as Au,pr as S3,u as AV,ua as cA,vc as wp}from"./chunk-B_pj7Jpm.js";import{A as qn,O as ln,r as D,s as Jn}from"./chunk-BPHMC4rz.js";import{t as m}from"./chunk-BD06qecY2.js";import{n as j,t as r}from"./chunk-mhEVtCsW.js";var X=i=>({"buttons-aside":i});function W(i,e){if(i&1&&th(0,`img`,2),i&2){let t=f$();gx(`ngStyle`,t.previewSize())(`src`,t.imageSrc,Pw)}}function q(i,e){if(i&1&&th(0,`div`,3),i&2)gx(`ngStyle`,f$().previewSize())}function J(i,e){if(i&1){let t=AV();wp(0,`my-delete-button`,7),rh(`click`,function(){EI(t),f$();return bI(g$(5).reset())}),kb()}}var k=class i{serverService=g(Zt);inputName=ph.required();inputLabel=ph();displayDelete=ph(!1,{transform:Tu});buttonsAside=ph(!1,{transform:Tu});previewSize=ph();fileConstraints=ph();imageSrc;maxSizeText;file;imageExtensions=[];maxImageSize;maxImageSizeInBytes;allowedExtensionsMessage=``;serverConfig;bytesPipe;constructor(){this.bytesPipe=new m,this.maxSizeText="mărime maximă"}getReactiveFileButtonTooltip(){return `(extensii: ${this.imageExtensions.join(`, `)}, mărime maximă: ${this.maxImageSizeInBytes})`}ngOnInit(){this.serverConfig=this.serverService.getHTMLConfig();let e=this.fileConstraints()??this.serverConfig.video.image;this.imageExtensions=e.extensions,this.maxImageSize=e.size.max,this.maxImageSizeInBytes=this.bytesPipe.transform(this.maxImageSize),this.allowedExtensionsMessage=this.imageExtensions.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?eAe(this.file).then(e=>this.imageSrc=e):this.imageSrc=void 0}static ɵfac=function(t){return new(t||i)};static ɵcmp=Va({type:i,selectors:[[`my-image-input`]],inputs:{inputName:[1,`inputName`],inputLabel:[1,`inputLabel`],displayDelete:[1,`displayDelete`],buttonsAside:[1,`buttonsAside`],previewSize:[1,`previewSize`],fileConstraints:[1,`fileConstraints`]},features:[e5([{provide:D,useExisting:wf(()=>i),multi:!0}])],decls:7,vars:11,consts:()=>{let e;e="Previzualizare";let t;return t="Șterge imaginea",[[`reactiveFile`,``],[1,`preview-container`,3,`ngClass`],[`alt`,e,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`,t,`theme`,`danger`],[`title`,t,`theme`,`danger`,3,`click`]]},template:function(t,n){if(t&1){let g=AV();wp(0,`div`,1),EV(1,W,1,2,`img`,2)(2,q,1,1,`div`,3),wp(3,`div`,4)(4,`my-reactive-file`,5,0),lA(`ngModelChange`,function(a){return EI(g),W$(n.file,a)||(n.file=a),bI(a)}),rh(`fileChanged`,function(a){return n.onFileChanged(a)}),kb(),kj(),EV(6,J,1,0,`my-delete-button`,6),kb()()}t&2&&(gx(`ngClass`,n5(9,X,n.buttonsAside())),FB(),bV(n.imageSrc?1:2),FB(3),cA(`ngModel`,n.file),gx(`inputName`,n.inputName())(`inputLabel`,n.inputLabel())(`extensions`,n.imageExtensions)(`maxFileSize`,n.maxImageSize)(`buttonTooltip`,n.getReactiveFileButtonTooltip()),Uj(),FB(2),bV(n.displayDelete()&&n.file?6:-1))},dependencies:[Au,S3,C3,Jn,qn,ln,j,r],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(--%NS%secondary-icon-color);background-color:var(--%NS%bg)}.preview-container.buttons-aside[_ngcontent-%COMP%]{text-align:center;border:1px solid var(--%NS%secondary-icon-color);border-radius:4px;width:min-content;padding-inline-start:calc(1.275rem + .3vw)}@media(min-width:1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-start:1.5rem}}.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-end:calc(1.275rem + .3vw)}@media(min-width:1200px){.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-inline-end:1.5rem}}.preview-container.buttons-aside[_ngcontent-%COMP%]{padding-top:1rem;padding-bottom:1rem}.preview-container.buttons-aside[_ngcontent-%COMP%]   .buttons[_ngcontent-%COMP%]{margin-top:1rem}`],changeDetection:1})};export{k as t};
//# debugId=8cc198c6-3134-5aa7-8625-29728dd0a2e4
//# sourceMappingURL=chunk-DaUEjKCf.js.map