1import{k as u}from"./chunk-YMMN3CSX.js";import{Ha as l,_ as o,da as c}from"./chunk-M2CYWTPL.js";var d=class i{isBrowser=u(c(l));urlStatus=new Map;resolved=new Map;async resolveBestUrl(t){let r=t.preview??void 0,e=t.path??void 0,s=`${r??""}||${e??""}`;if(this.resolved.has(s))return this.resolved.get(s);if(!this.isBrowser){let a=r||e||null;return this.resolved.set(s,a),a}let n=[e,r].filter(a=>!!a);for(let a of n)if(await this.isUrlOk(a))return this.resolved.set(s,a),a;return this.resolved.set(s,null),null}getDownloadName(t,r){let e=t.name??"file";if(!(!!t.preview&&r===t.preview&&t.preview!==t.path))return e;let n=e.lastIndexOf(".");return n>0?`${e.slice(0,n)}_preview${e.slice(n)}`:`${e}_preview`}markBad(t){this.urlStatus.set(t,"bad")}async isUrlOk(t){let r=this.urlStatus.get(t);if(r==="ok")return!0;if(r==="bad")return!1;try{if((await fetch(t,{method:"HEAD",cache:"no-store"})).ok)return this.urlStatus.set(t,"ok"),!0}catch{}try{let e=await fetch(t,{method:"GET",headers:{Range:"bytes=0-0"},cache:"no-store"}),s=e.ok||e.status===206;return this.urlStatus.set(t,s?"ok":"bad"),s}catch{return this.urlStatus.set(t,"bad"),!1}}static \u0275fac=function(r){return new(r||i)};static \u0275prov=o({token:i,factory:i.\u0275fac})};export{d 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.