1import{a as k}from"./chunk-WZBVDNS6.js";import{a as S,b as y,c as U}from"./chunk-SHTGYNA2.js";import{A as g,C as m,x as H,y as u}from"./chunk-4YERUHPX.js";import{B as l,O as b,R as d,V as $,_ as h,k as v,p as w}from"./chunk-DQGQ5ICO.js";var T=class f{constructor(e,t,i,s,o){this.http=e;this.settingService=t;this.helperService=i;this.httpClient=s;this.httpClient=new m(o)}progressFile=[];apiUrl="/api/v1/uploadfiles/";m2mToken=null;tokenExpiration=0;getM2MToken(){let e=Date.now();if(this.m2mToken&&this.tokenExpiration>e)return v(this.m2mToken);let{tokenEndpoint:t,client_id:i,client_secret:s,grant_type:o,scope:r}=y.m2mAuth,a=btoa(`${i}:${s}`),c=new u({"Content-Type":"application/x-www-form-urlencoded",Authorization:`Basic ${a}`}),n=new URLSearchParams;return n.set("grant_type",o),n.set("scope",r),this.httpClient.post(t,n.toString(),{headers:c}).pipe(d(p=>{this.m2mToken=p.access_token,this.tokenExpiration=e+(p.expires_in-60)*1e3}),b(p=>v(p.access_token)),l(p=>{throw p}))}getHeaders(e){return new u({"X-External-Authorization":`Bearer ${e}`})}buildPqrsUrl(e){let t=y.PqrsMCD;return t&&t.length?`${t}${e}`:e}crop(e,t){t.width=Math.round(t.width),t.height=Math.round(t.height);let i=`/api/v1/uploadfiles/${e}/crop`;return this.http.post(i,t)}getCodeYoutube(e){if(e){let t=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed|shorts\/)|(watch\?))\??v?=?([^#\&\?]*).*/,i=e.match(t);return i&&i[7].length===11?i[7]:!1}return!1}getPreviewYoutube(e){return`//i.ytimg.com/vi/${e}/hqdefault.jpg`}upload(e,t,i){let s=new FormData;s.append("file",e);let o=`${this.apiUrl}${t||""}`;return this.http.post(o,s,{headers:new u().set("Content-Type","undefined"),observe:"events",reportProgress:!0,responseType:"json"}).pipe(d(r=>{if(r.type===g.UploadProgress&&r.total){let a=Math.ceil(r.loaded/r.total*100);i&&i(a)}}),l(r=>{throw console.error("Upload failed",r),r}))}uploadFilePqr(e,t,i,s){return this.getM2MToken().pipe(b(o=>{let r=this.getHeaders(o),a=new FormData;a.append("file",e);let c=`${this.apiUrl}${t||""}`;return this.http.post(s?this.buildPqrsUrl(c):c,a,{headers:r,observe:"events",reportProgress:!0,responseType:"json"}).pipe(d(n=>{if(n.type===g.UploadProgress&&n.total){let p=Math.ceil(n.loaded/n.total*100);i&&i(p)}}),l(n=>{throw console.error("Upload failed",n),n}))}))}getSuper(e){let t=`${this.apiUrl}${e}`;return this.http.get(t,{headers:{include:"0"}})}deleteSuper(e){let t=`${this.apiUrl}${e}`;return this.http.del(t,{headers:{include:"0"}})}uploadSuper(e,t,i){let s=new FormData;s.append("file",e);let o=`${this.settingService.globalApiUrl}/api/v1/uploadfiles/`;return this.http.post(o,s,{headers:new u().set("Content-Type","undefined"),observe:"events",reportProgress:!0,responseType:"json",timeout:108e5}).pipe(d(r=>{if(r.type===g.UploadProgress&&r.total){let a=Math.ceil(r.loaded/r.total*100);i&&i(a)}}),l(r=>{throw console.error("Upload failed",r),r}))}uploadFileMessage(e,t,i){let s=new FormData;s.append("file",e);let o=`${this.settingService.globalApiUrl}/api/v1/uploadfiles/${t||""}`;return this.http.post(o,s,{headers:new u().set("Content-Type","undefined"),observe:"events",reportProgress:!0,responseType:"json"}).pipe(d(r=>{if(r.type===g.UploadProgress&&r.total){let a=Math.ceil(r.loaded/r.total*100);i&&i(a)}}),l(r=>{throw console.error("Upload failed",r),r}))}downloadFile(e,t={},i){return this.http.getTextResponse("/api/v1/downloadtoken").pipe(w(s=>{let o=Object.keys(t).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`).join("&");return o=o?`?${o}&token=${s}`:`?token=${s}`,i?e+o:this.settingService.settings.authorityDomain+e+o}))}getUrlPreview(e){return this.http.get("/api/v1/pagepreviews/",{params:{url:e}})}getImgFile(e){let t=`${this.apiUrl}/gallery-images/${e}`;return this.http.get(t)}static \u0275fac=function(t){return new(t||f)(h(S),h(U),h(k),h(m),h(H))};static \u0275prov=$({token:f,factory:f.\u0275fac,providedIn:"root"})};export{T 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.