1const u=["full_path_medium","full_path_large","full_path_resized","full_path_thumb","full_path"],_=(t,{defaultKey:e}={defaultKey:"full_path_medium"})=>{if(typeof t=="string")return t;if(e.endsWith("webp")&&t?.[e])return t[e];if(!e.endsWith("webp")){const s=e+"_webp";if(t?.[s])return t[s];if(t?.[e])return t[e]}const r=Object.keys(t).filter(s=>s.endsWith("webp"));for(const s of r)if(t?.[s])return t[s];if(t?.[e])return t[e];for(const s in u)if(t?.[s])return t[s];return""},f={full_path_thumb:200,full_path_medium:670,full_path_large:1030,full_path_desktop:1440,full_path_resized:1980},p=t=>t?/\.(jpg|jpeg|png|webp|gif|avif|svg|jfiff|tiff|bmp)(\?.*)?$/i.test(t):!1,w=t=>t?[...Object.keys(f),"full_path"].some(r=>p(t[r])||p(t[`${r}_webp`])):!1,d=(t,e=2e3)=>!t||typeof t!="string"?Promise.resolve(!1):new Promise(r=>{const s=new AbortController,n=s.signal;let l=null;l=setTimeout(()=>{s.abort()},e);try{fetch(t,{method:"HEAD",mode:"cors",signal:n}).then(o=>{clearTimeout(l),r(o.ok)}).catch(()=>{clearTimeout(l),r(!1)})}catch{clearTimeout(l),r(!1)}}),i=(t,e)=>{const r=Object.keys(f).filter(s=>f[s]<=e).sort((s,n)=>f[n]-f[s]);for(const s of r)if(p(t[s]))return t[s];return t?.full_path_resized||t?.full_path||""},c=(t,e)=>{const r=[],s=[];for(const n in f){const l=f[n];if(e&&l>e)continue;const o=t[`${n}_webp`];p(o)&&r.push(`${o} ${l}w`);const a=t[n];p(a)&&s.push(`${a} ${l}w`)}return{webpSrcsetParts:r,standardSrcsetParts:s}};function h(t){return!!t&&!!t.item&&Object.values(t?.item).length>0}const k=(t,e=!1,r)=>{if(!t)return{sources:[],fallbackSrc:""};const s=[];if(h(t)){const n=t.item?.full_path_resized||t.item?.full_path||"";return{sources:s,fallbackSrc:n}}else{const n=e&&!r;n&&t.full_path_webp&&s.push({media:"(min-width: 1981px)",type:"image/webp",srcset:t.full_path_webp}),n&&t.full_path&&s.push({media:"(min-width: 1981px)",type:"image/jpeg",srcset:t.full_path});const{webpSrcsetParts:l,standardSrcsetParts:o}=c(t,r);l.length>0&&s.push({type:"image/webp",srcset:l.join(", ")}),o.length>0&&s.push({type:"image/jpeg",srcset:o.join(", ")});const a=r?i(t,r):t?.full_path_resized||t?.full_path||"";return{sources:s,fallbackSrc:a}}};export{k as a,_ as g,w as h,d as v};
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.