import{C as Au,Ca as dA,Fn as MV,Gn as NV,Hi as Zt,Ja as g,Kr as Tu,Ns as rh,Oo as jw,Ra as f5,Sc as x$,So as jV,V as CI,X as D$,Zs as th,_s as ph,ai as Vj,eo as h5,et as DI,gt as Ex,jt as Gj,k as Bb,n as $B,nr as O3,s as $a,ss as o5,tc as uAe,ur as P3,vc as wf,yc as wp,za as fA}from"./chunk-b0nJCs5_.js";import{A as qn,O as ln,r as D,s as Jn}from"./chunk-Cmet2Nw-.js";import{n as r,t as j}from"./chunk-DsKBogZp.js";import{t as m}from"./chunk-DWd4safw.js";var X=i=>({"buttons-aside":i});function W(i,e){if(i&1&&th(0,`img`,2),i&2){let t=D$();Ex(`ngStyle`,t.previewSize())(`src`,t.imageSrc,jw)}}function q(i,e){if(i&1&&th(0,`div`,3),i&2)Ex(`ngStyle`,D$().previewSize())}function J(i,e){if(i&1){let t=jV();wp(0,`my-delete-button`,7),rh(`click`,function(){CI(t),D$();return DI(x$(5).reset())}),Bb()}}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="최대 크기"}getReactiveFileButtonTooltip(){return `(확장자: ${this.imageExtensions.join(`, `)}, 최대 크기: ${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?uAe(this.file).then(e=>this.imageSrc=e):this.imageSrc=void 0}static ɵfac=function(t){return new(t||i)};static ɵcmp=$a({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:[f5([{provide:D,useExisting:wf(()=>i),multi:!0}])],decls:7,vars:11,consts:()=>{let e;e="미리 보기";let t;return t="이미지 삭제하기",[[`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=jV();wp(0,`div`,1),NV(1,W,1,2,`img`,2)(2,q,1,1,`div`,3),wp(3,`div`,4)(4,`my-reactive-file`,5,0),fA(`ngModelChange`,function(a){return CI(g),o5(n.file,a)||(n.file=a),DI(a)}),rh(`fileChanged`,function(a){return n.onFileChanged(a)}),Bb(),Vj(),NV(6,J,1,0,`my-delete-button`,6),Bb()()}t&2&&(Ex(`ngClass`,h5(9,X,n.buttonsAside())),$B(),MV(n.imageSrc?1:2),$B(3),dA(`ngModel`,n.file),Ex(`inputName`,n.inputName())(`inputLabel`,n.inputLabel())(`extensions`,n.imageExtensions)(`maxFileSize`,n.maxImageSize)(`buttonTooltip`,n.getReactiveFileButtonTooltip()),Gj(),$B(2),MV(n.displayDelete()&&n.file?6:-1))},dependencies:[Au,O3,P3,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=8e24e921-2ecc-5500-b29b-6bf6c703a6aa
//# sourceMappingURL=chunk-DGv871DT2.js.map