1import{Ea as w}from"./chunk-ZXUCJQPB.js";import{ha as p,ma as u}from"./chunk-ZTKHQC5D.js";import{g as c}from"./chunk-RA2WU32H.js";var I=(()=>{let s=class s{constructor(e){this.dialog=e,this.posterSizeRestriction={width:1235,height:338},this.thumbnailSizeRestriction={width:250,height:250},this.imageTypesAllowed=["image/jpeg","image/jpg","image/png"]}openThumbnailCropDialog(e){let t={file:e,maintainAspectRatio:!0,aspectRatio:this.thumbnailSizeRestriction.width/this.thumbnailSizeRestriction.height,cropperMinWidth:this.thumbnailSizeRestriction.width};return this.openCropDialog(t)}openPosterCropDialog(e){let t={file:e,maintainAspectRatio:!0,aspectRatio:this.posterSizeRestriction.width/this.posterSizeRestriction.height,cropperMinWidth:this.posterSizeRestriction.width};return this.openCropDialog(t)}validatePoster(e){let t=new Image;return t.src=URL.createObjectURL(e),new Promise(i=>{t.onload=()=>t.width<this.posterSizeRestriction.width||t.height<this.posterSizeRestriction.height?i(!1):i(!0)})}validateThumbnail(e){let t=new Image;return t.src=URL.createObjectURL(e),new Promise(i=>{t.onload=()=>t.width<this.thumbnailSizeRestriction.width||t.height<this.thumbnailSizeRestriction.height?i(!1):i(!0)})}getWidthHeight(e){let t=new Image;return t.src=URL.createObjectURL(e),new Promise(i=>{t.onload=()=>i({width:t.width,height:t.height})})}resizeImage(e){return c(this,null,function*(){let{file:t,targetWidth:i,targetHeight:r}=e;try{let o="auto",a="auto",d=yield this.getWidthHeight(t);return d.width/i>d.height/r?a=r:o=i,yield new Promise((R,f)=>{let b=t.name,g=new FileReader;g.readAsDataURL(t),g.onload=j=>{let h=new Image;h.src=j.target.result,h.onload=()=>{let n=document.createElement("canvas");o!=="auto"?(n.width=o,n.height=h.height*(o/h.width)):a!=="auto"&&(n.height=a,n.width=h.width*(a/h.height));let m=n.getContext("2d");m.drawImage(h,0,0,n.width,n.height),m.canvas.toBlob(z=>{let S=new File([z],b,{type:"image/jpeg",lastModified:Date.now()});R(S)},"image/jpeg",1)},g.onerror=n=>f(n)}})}catch(o){return Promise.reject(o)}})}base64ToFile(e,t){return c(this,null,function*(){let r=yield(yield fetch(e)).blob();return new File([r],t,{type:"image/jpeg"})})}getBase64(e){return new Promise((t,i)=>{let r=new FileReader;
1r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=o=>i(o)})}downloadFile(e,t){let i=document.createElement("a");i.href=e,i.download=t,i.click()}convertBytesToMBs(e){return e/(1024*1024)}openCropDialog(e){return c(this,null,function*(){let t=yield import("./chunk-NSBZQVET.js").then(i=>i.CropImageComponent);return new Promise(i=>{this.dialog.open(t,{data:e,disableClose:!0}).onClose.subscribe(o=>{if(!o){i(null);return}this.base64ToFile(o,e.file.name.split(".").slice(0,-1).join(".")+".jpeg").then(a=>{i(a)}).catch(a=>{console.error(a),i(null)})})})})}};s.\u0275fac=function(t){return new(t||s)(u(w))},s.\u0275prov=p({token:s,factory:s.\u0275fac,providedIn:"root"});let l=s;return l})();export{I 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.