1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SoundCloudTrackId-CaZtzSsR.js","assets/vendor-react-DRA7ZGpe.js","assets/index-BKjvWqUb.js","assets/vendor-socketio-Dj7dGIag.js","assets/SimilarSongsFinder-CQ9GC3Wv.js","assets/InterviewInvite-CN1BAINA.js","assets/index-Bn6-BEXJ.css"])))=>i.map(i=>d[i]); 2import{t as g,M as k,T as v,Y as S,Z as _,g as b,U as R,_ as m}from"./index-BKjvWqUb.js";import{r as f,j as d}from"./vendor-react-DRA7ZGpe.js";import{p}from"./SimilarSongsFinder-CQ9GC3Wv.js";import"./vendor-socketio-Dj7dGIag.js";const T=R(()=>m(()=>import("./SoundCloudTrackId-CaZtzSsR.js").then(e=>e.d),__vite__mapDeps([0,1,2,3,4,5,6])),()=>m(()=>import("./SoundCloudTrackId-CaZtzSsR.js").then(e=>e.c),__vite__mapDeps([0,1,2,3,4,5,6])),"Loading TrackRadar..."),w="https://www.instagram.com/p/DFwL2BSNlHu/",P="/api/instagram/v2/analyze-stream",x="/api/soundcloud/preview-stream",L={id:1,email:"[email protected]",username:"lab",name:"Lab",role:"user",spotify_save_enabled:!1};function U(){return p.tracks.map((e,t)=>{var a,i;const s=(i=(a=e.platforms.spotify)==null?void 0:a.match(/track\/([A-Za-z0-9]+)/))==null?void 0:i[1];return{artist:e.artist,title:e.title,confidence:.94-t%5*.04,source:t%4===0?"caption":"audio-recognition",spotifyId:s,spotifyUri:s?`spotify:track:${s}`:void 0,spotifyUrl:e.platforms.spotify,albumArt:e.artwork??void 0,appleMusicUrl:e.platforms.appleMusic,bandcampUrl:e.platforms.bandcamp,discogsUrl:e.platforms.discogs,timeSeconds:t*237}})}function E(e,t){const s=new TextEncoder,a=(n,c)=>s.encode(`event: ${n} 3data: ${JSON.stringify(c)} 4 5`),i=U(),o=i.slice(0,4),r=n=>new Promise(c=>setTimeout(c,n)),u=new ReadableStream({async start(n){if(n.enqueue(a("progress",{stage:"initializing",progress:5,message:t?"Reading mix details...":"Connecting to Instagram...",tracksFound:0})),await r(300),n.enqueue(a("progress",{stage:"downloading",progress:30,message:t?"Reading the tracklist and comments...":"Reading the post, caption and comments...",tracksFound:0})),await r(300),e.seed==="error"){n.enqueue(a("error",{message:"Something went wrong on our side. Please try again.",error:"Something went wrong on our side. Please try again."})),n.close();return}if(n.enqueue(a("progress",{stage:"fingerprinting",progress:60,message:t?"Matching tracks on Spotify and Bandcamp...":"Fingerprinting the audio...",tracksFound:o.length})),n.enqueue(a("partial-tracks",{tracks:o})),e.seed==="loading")return;await r(300),n.enqueue(a("progress",{stage:"enriching",progress:90,message:"Finding streaming links...",tracksFound:i.length})),await r(300);const c=e.seed==="empty"?[]:i;n.enqueue(a("complete",{success:!0,tracks:c,tracksFound:c.length,metadata:{username:t?p.artistName:"soundsnacks",postUrl:t?p.sourceUrl:w}})),n.close()}});return new Response(u,{status:200,headers:{"Content-Type":"text/event-stream"}})}function I(e){const t=window.fetch.bind(window),s=(a,i=200)=>new Response(JSON.stringify(a),{status:i,headers:{"Content-Type":"application/json"}});return window.fetch=async(a,i)=>{const o=typeof a=="string"?a:a instanceof URL?a.toString():a.url,r=new URL(o,window.location.origin).pathname;if(r==="/api/auth/me")return e.auth?s({success:!0,user:L}):s({success:!1,error:"Not authenticated"},401);if(r==="/api/quota/track-count")return s({success:!0,count:60876});if(r==="/api/analytics/event"||r.startsWith("/api/analytics/"))return s({ok:!0});if(r==="/api/health")return s({status:"ok"});if(r==="/api/notifications/unread-count")return s({count:0});if(r.startsWith("/api/notifications"))return s([]);if(r==="/api/spotify/status")return s({authenticated:!1});const u=r===P,n=r===x;if(!u&&!n)return t(a,i);if(e.seed==="offline")throw new TypeError("Failed to fetch");return e.seed==="limit"?s({message:"You've used your free analysis. Sign up free for 3 every month.",paywall:!0},429):E(e,n)},()=>{window.fetch=t}}function M(){const e=t=>btoa(JSON.stringify(t)).replace(/=+$/,"").replace(/\+/g,"-").replace(/\//g,"_");return`${e({alg:"none",typ:"JWT"})}.${e({sub:"lab",userId:1,exp:Math.floor(Date.now()/1e3)+3600})}.lab`}function $(){const[e]=f.useState(()=>{const t=new URLSearchParams(window.location.search),s=t.get("theme");if(s==="light"||s==="dark")try{window.localStorage.setItem("tr-theme",s)}catch{}const a=t.get("seed")??"idle",i=t.get("auth")==="1",o=t.get("platform"),r=window.location.pathname;try{sessionStorage.removeItem("tr_landing_logged"),sessionStorage.removeItem("tr_input_focused")}catch{}(o==="instagram"||o==="soundcloud")&&t.set("url",o==="instagram"?w:p.sourceUrl),t.get("utm")==="1"&&t.set("utm_source","reddit"),window.history.replaceState({},"",`${r}?${t.toString()}`);const u=window.history.replaceState.bind(window.history);window.history.replaceState=(c,h,l)=>{const y=l==null?"":l.toString();u(c,h,y==="/"?r:l??void 0)},a==="offline"&&Object.defineProperty(window.navigator,"onLine",{c
5onfigurable:!0,get:()=>!1}),i&&g.setToken(M());const n=I({seed:a,auth:i});return()=>{n(),window.history.replaceState=u,i&&g.removeToken(),a==="offline"&&delete window.navigator.onLine}});return f.useEffect(()=>e,[e]),d.jsx(k,{children:d.jsx(v,{children:d.jsx(S,{children:d.jsxs(_,{children:[d.jsx(T,{}),d.jsx(b,{})]})})})})}export{$ as default};
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.