import{E as $,m as I,o as D,p as B}from"./chunk-PMIZVEYT.js";import{a as L}from"./chunk-MJV6N5M3.js";import{Ab as M,Bb as _,Cc as S,Da as y,Ga as p,Hc as N,Lb as A,Ma as h,Mb as R,Nb as w,Ra as P,Wf as z,Xa as g,Xf as G,Yf as H,aa as b,db as a,ga as u,ha as f,ic as x,mb as l,nb as c,ob as d,ra as C,rb as T,sa as E,sb as v,wb as m,wg as U}from"./chunk-WVVK4EBY.js";import{i as s}from"./chunk-LV2JZWXA.js";var k=["bannerfileInput"],F=["bannerPopover"];function V(e,i){if(e&1&&d(0,"img",11),e&2){let o=_();a("src",o.preview||o.bannerUrl(),y);}}function X(e,i){e&1&&T(0);}function j(e,i){if(e&1&&(l(0,"div",12),g(1,X,1,0,"ng-container",13),c()),e&2){let o=_(),n=w(7);a("ngbTooltip",o.bannerFormat),p(),a("ngTemplateOutlet",n);}}function Q(e,i){e&1&&T(0);}function Y(e,i){if(e&1){let o=v();l(0,"div",14)(1,"button",15),d(2,"my-global-icon",16),l(3,"span"),m(4,2),c()(),l(5,"div",17)(6,"div",18),g(7,Q,1,0,"ng-container",13),c(),l(8,"button",19),M("click",function(){u(o);let t=_();return f(t.deleteBanner());}),d(9,"my-global-icon",20),l(10,"span"),m(11,3),c()()()();}if(e&2){let o=_(),n=w(7);p(6),a("ngbTooltip",o.bannerFormat),p(),a("ngTemplateOutlet",n);}}function q(e,i){if(e&1){let o=v();d(0,"my-global-icon",21),l(1,"label",22),m(2,4),c(),l(3,"input",23,1),M("change",function(){u(o);let t=_();return f(t.onBannerChange());}),c();}if(e&2){let o=_();p(3),a("accept",o.bannerExtensions);}}var re=(()=>{let i=class i{serverService=b(U);notifier=b(z);bannerfileInput=h("bannerfileInput");bannerPopover=h("bannerPopover");bannerUrl=E(void 0);previewImage=E(!1);bannerChange=C();bannerDelete=C();bannerFormat="";maxBannerSize=0;bannerExtensions="";preview;ngOnInit(){let n=this.serverService.getHTMLConfig();this.maxBannerSize=n.banner.file.size.max,this.bannerExtensions=n.banner.file.extensions.join(", "),this.bannerFormat="relaci\xF3 6/1, mida recomanada: 1920x317, mida m\xE0xima: "+G(this.maxBannerSize)+", extensions: "+this.bannerExtensions+"";}onBannerChange(){let n=this.bannerfileInput().nativeElement.files[0];if(n.size>this.maxBannerSize){this.notifier.error("Error","Aquesta imatge \xE9s massa gran.");return;}let t=new FormData();t.append("bannerfile",n),this.bannerPopover()?.close(),this.bannerChange.emit(t),this.previewImage()&&H(n).then(r=>this.preview=r);}deleteBanner(){this.preview=void 0,this.bannerDelete.emit();}hasBanner(){return!!this.preview||!!this.bannerUrl();}};s(i,"\u0275fac",function(t){return new(t||i)();}),s(i,"\u0275cmp",P({type:i,selectors:[["my-actor-banner-edit"]],viewQuery:function(t,r){t&1&&(A(r.bannerfileInput,k,5),A(r.bannerPopover,F,5)),t&2&&R(2);},inputs:{bannerUrl:[1,"bannerUrl"],previewImage:[1,"previewImage"]},outputs:{bannerChange:"bannerChange",bannerDelete:"bannerDelete"},decls:8,vars:3,consts:()=>{let n;n="Canviar el vostre b\xE0ner";let t;t="Eliminar el b\xE0ner";let r;return r="Pujar un b\xE0ner nou",[["uploadNewBanner",""],["bannerfileInput",""],n,t,r,[1,"actor"],[1,"actor-img-edit-container"],[1,"banner-placeholder"],["alt","Banner",3,"src",4,"ngIf"],["class","actor-img-edit-button button-file primary-button button-focus-within","placement","right","container","body",3,"ngbTooltip",4,"ngIf"],["ngbDropdown","","placement","right",4,"ngIf"],["alt","Banner",3,"src"],["placement","right","container","body",1,"actor-img-edit-button","button-file","primary-button","button-focus-within",3,"ngbTooltip"],[4,"ngTemplateOutlet"],["ngbDropdown","","placement","right"],["type","button","ngbDropdownToggle","",1,"actor-img-edit-button","button-file","primary-button"],["iconName","edit"],["ngbDropdownMenu",""],[1,"dropdown-item","dropdown-file","button-focus-within",3,"ngbTooltip"],["type","button",1,"dropdown-item",3,"click"],["iconName","delete"],["iconName","upload"],["for","bannerfile"],["type","file","name","bannerfile","id","bannerfile",3,"change","accept"]];},template:function(t,r){t&1&&(l(0,"div",5)(1,"div",6)(2,"div",7),g(3,V,1,1,"img",8),c(),g(4,j,2,2,"div",9)(5,Y,12,2,"div",10),c()(),g(6,q,5,1,"ng-template",null,0,x)),t&2&&(p(3),a("ngIf",r.hasBanner()),p(),a("ngIf",!r.hasBanner()),p(),a("ngIf",r.hasBanner()));},dependencies:[S,$,N,B,D,L,I],styles:[`.dropdown-file[_ngcontent-%COMP%]{position:relative;overflow:hidden;display:inline-block}.dropdown-file[_ngcontent-%COMP%]   input[type=file][_ngcontent-%COMP%]{position:absolute;top:0;right:0;width:100%;height:100%;font-size:100px;text-align:end;filter:alpha(opacity=0);opacity:0;outline:none;background:var(--bg);cursor:inherit;display:block}.actor-img-edit-button[_ngcontent-%COMP%]{width:31px;cursor:pointer;display:flex;justify-content:center;align-items:center}.actor-img-edit-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:19px;height:19px;line-height:19px}.actor-img-edit-button[_ngcontent-%COMP%]:not(.icon-only)   my-global-icon[_ngcontent-%COMP%]{margin-inline-end:0}label[_ngcontent-%COMP%]{font-weight:400;font-size:inherit;color:inherit;margin:0}
/*# sourceMappingURL=actor-image-edit-NRUAYZCV.css.map */`,`.banner-placeholder[_ngcontent-%COMP%]{position:relative;height:0;width:100%;padding-top:16.6666666667%}.banner-placeholder[_ngcontent-%COMP%] > div[_ngcontent-%COMP%], .banner-placeholder[_ngcontent-%COMP%] > img[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0}.banner-placeholder[_ngcontent-%COMP%]{background-color:var(--bg-secondary-500)}.actor-img-edit-container[_ngcontent-%COMP%]{position:relative;display:flex;justify-content:center;align-items:center}.dropdown[_ngcontent-%COMP%]{position:absolute}.dropdown[_ngcontent-%COMP%] > .actor-img-edit-button[_ngcontent-%COMP%]{position:relative}.actor-img-edit-button[_ngcontent-%COMP%]{width:auto;position:absolute}.actor-img-edit-button[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{font-weight:600;margin-bottom:0}.button-focus-within[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 .2rem var(--fg-100)}.dropdown-item[_ngcontent-%COMP%]{padding:var(--input-y-padding) 15px}.dropdown-item[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]{width:22px;opacity:.7;position:relative;top:-2px;margin-inline-end:.625rem}.dropdown-toggle[_ngcontent-%COMP%]:after{display:none}
/*# sourceMappingURL=actor-banner-edit.component-FNYDMAR4.css.map */`]}));let e=i;return e;})();export{re as a};/**i18n:b046b42d3b2db5c4a6153f28081b96130c38e9218feb7118271ff63b274934c4*///# sourceMappingURL=chunk-5KLYT5WQ.js.map