1import{a as y}from"./chunk-GBRQKVYB.js";import{a as E}from"./chunk-CJWEDDVW.js";import{a as F}from"./chunk-GCE2MEC6.js";import{a as U}from"./chunk-W2ZMKN4C.js";import{t as I}from"./chunk-47CSRN7C.js";import{c as x}from"./chunk-SKH2MXBC.js";import{Ya as s,fa as S,va as m,ya as w}from"./chunk-YE3BF7DR.js";var b=class f{constructor(h,a,o,r,p,g,v){this.elementRef=h;this.modalService=a;this.settingService=o;this.fileService=r;this.appService=p;this.userService=g;this.authService=v}end=new m;error=new m;start=new m;multiple;isfile;additional;reg;param;obj;contentsize;size;issuper;minw;maxw;minh;maxh;nativeElement;ngOnInit(){this.nativeElement=this.elementRef.nativeElement,this.setupDirective()}setupDirective(){let h=!!this.multiple,a=!!this.isfile,o=null,r=this.obj||{};this.additional&&(o=this.additional);let p=(e,i)=>e===null||e.test(i),g=(e,i)=>{let l=window.URL||window.webkitURL;if(l&&this.contentsize){let t=new Image;t.onload=()=>{if(this.maxw&&t.width>parseInt(this.maxw)){this.modalService.showAlert("El ancho m\xE1ximo de la im\xE1gen debe ser "+this.maxw+"px");return}if(this.maxh&&t.height>parseInt(this.maxh)){this.modalService.showAlert("La altura m\xE1xima de la im\xE1gen debe ser "+this.maxh+"px");return}if(this.minw&&t.width<parseInt(this.minw)){this.modalService.showAlert("El ancho m\xEDnimo de la im\xE1gen debe ser "+this.minw+"px");return}if(this.minh&&t.height<parseInt(this.minh)){this.modalService.showAlert("La altura m\xEDnima de la im\xE1gen debe ser "+this.minh+"px");return}i.call(this,e)},t.src=l.createObjectURL(e)}else i.call(this,e)},v=(e,i)=>{!isNaN(i)&&i!==100&&(e.progress=i+"%")},u=(e,i)=>{this.fileService.progressFile&&this.fileService.progressFile.splice(this.fileService.progressFile.indexOf(e),1),h?(r.files||(r.files=[]),!a&&(!r.imagePrincipal||!r.imagePrincipal.filePath)&&i.isImage&&(r.imagePrincipal={fileID:i.fileID,filePath:i.filePath}),r.files.push(i)):(e.fileID=i.fileID,e.progress="100%",e.filePath=i.filePath,e.isImage=i.isImage,e.name=i.name,i.fileBigImage&&(e.fileBigImage=i.fileBigImage),this.end?.emit({file:e,additional:o}),this.nativeElement.value="")},d=e=>{this.modalService.showAlert(this.settingService.settings.resources["File.ErrorUploadServer"]),this.fileService.progressFile&&this.fileService.progressFile.splice(this.fileService.progressFile.indexOf(e),1),this.nativeElement.value=""},A=e=>{let i=this.reg?new RegExp(this.reg,"gi"):null,l=0;if(this.size?l=parseInt(this.size):l=this.authService.user.isAuthorize?this.settingService.settings.general.maxUploadFileSizeAdminUsers:this.settingService.settings.general.maxUploadFileSizePublicUsers,e.size===0)this.modalService.showAlert("El archivo que intentas subir no tiene peso"),this.nativeElement.value="";else if(e.size>l)this.modalService.showAlert(this.appService.format(this.settingService.settings.resources["File.ErrorUpload"],Math.round(l/1024/1024).toString())),this.nativeElement.value="";else if(p(i,e.name)){this.fileService.progressFile||(this.fileService.progressFile=[]);let t={progress:0,name:e.name};this.fileService.progressFile.push(t),this.start?.emit({item:t,additional:o});let c=null;this.param&&(c=this.param),this.issuper?this.fileService.uploadSuper(e,c,n=>v(t,n)).subscribe({next:n=>u(t,n),error:()=>d(t)}):this.fileService.upload(e,c,n=>v(t,n)).subscribe({next:n=>u(t,n),error:()=>d(t)})}else this.modalService.showAlert(this.settingService.settings.resources["File.ErrorUploadType"]),this.nativeElement.value=""},z=()=>{if(this.nativeElement.files&&this.nativeElement.files.length)for(let e=0;e<this.nativeElement.files.length;e++){let i=this.reg?new RegExp(this.reg,"gi"):null;p(i,this.nativeElement.files[e].name)?g(this.nativeElement.files[e],A):(this.modalService.showAlert(this.settingService.settings.resources["File.ErrorUploadType"]),this.nativeElement.value="")}};this.nativeElement.addEventListener("change",z)}static \u0275fac=function(a){return new(a||f)(s(w),s(I),s(x),s(U),s(F),s(E),s(y))};static \u0275dir=S({type:f,selectors:[["","appUploadFile",""]],inputs:{multiple:"multiple",isfile:"isfile",additional:"additional",reg:"reg",param:"param",obj:"obj",contentsize:"contentsize",size:"size",issuper:"issuper",minw:"minw",maxw:"maxw",minh:"minh",maxh:"maxh"},outputs:{end:"end",error:"error",start:"start"},standalone:!0})};export{b as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.