PageSourceSearch

https://stargaze.zone/assets/useVolumeHistory-D9B8fU4X.js

js stargaze.zone collected 2026-09-25 19:42:34 UTC 2,843 bytes, 1 lines download raw bytes

1import{k as w,a as P}from"./skeleton-Pgs-xxbJ.js";import{$ as q}from"./query-Bzt2pQMc.js";import{D as A}from"./TimeIntervalSelector-BnFzUQlg.js";import{c as E,s as V,d as x,e as C}from"./time-range-Y84yTYsK.js";function L(s){return s?.history.map(e=>({t:e.timestamp,volumeUsd:e.volumeUsd,salesCount:e.salesCount}))??[]}function H(s){return s?.history.map(e=>({t:e.timestamp,volumeUsd:e.volumeUsd,mintsCount:e.mintsCount}))??[]}const F=2*24*60*60*1e3,T=200*24*60*60*1e3;function R(s){const e=s[0]?.t,o=s[s.length-1]?.t,n=e&&o?new Date(o).getTime()-new Date(e).getTime():T;return n<=F?{axisTick:t=>new Date(t).toLocaleTimeString("en-US",{hour:"numeric",hour12:!1,minute:"2-digit"}),tooltipLabel:t=>new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",hour12:!1,minute:"2-digit"})}:n<=T?{axisTick:t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"}),tooltipLabel:t=>new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}:{axisTick:t=>new Date(t).toLocaleDateString("en-US",{month:"short",year:"numeric"}),tooltipLabel:t=>new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}}function N(s){if(s.length<4)return null;const e=[...s].sort((i,r)=>i-r),o=i=>{const r=(e.length-1)*i,a=Math.floor(r),h=r-a,u=e[a+1];return u!=null?e[a]+h*(u-e[a]):e[a]},n=o(.25),t=o(.75),m=t-n;return{lo:n-1.5*m,hi:t+1.5*m}}function d(s,e){return s.reduce((o,n)=>{const t=n[e];return o+(typeof t=="number"?t:0)},0)}function W(s,e={}){const{collectionAddr:o,doubleWindow:n,gran:t,serverData:m,enabled:i}=e,r=e.era??A,a=r!=="all",h={...E(s,{doubleWindow:n,gran:t}),...o?{collectionAddr:o}:{}},u=q.useQuery("get","/api/v1/analytics/volume-history",{params:{query:h}},{...m&&!a?{initialData:m}:{},placeholderData:w,staleTime:6e4,enabled:!a&&i!==!1}),l=V(s,{doubleWindow:n,gran:t}),y=P({queryKey:["internal","/api/analytics/era","sales",r,l.bucket,l.start,l.end],enabled:a&&i!==!1,queryFn:async({signal:b})=>{const k=new URLSearchParams({view:"sales",era:r,bucket:l.bucket,start:l.start,end:l.end}),S=await fetch(`/api/analytics/era?${k}`,{signal:b});if(!S.ok)throw new Error(`era series failed (HTTP ${S.status})`);return await S.json()},placeholderData:w,staleTime:6e4}),c=a?y.data:u.data,f=a?y.isLoading:u.isLoading,g=a?y.isError:u.isError;if(!c)return{points:[],totals:null,volumeChange:null,salesChange:null,isLoading:f,isError:g};if(!n)return{points:L(c),totals:{volumeUsd:c.totals.volumeUsd,salesCount:c.totals.salesCount},volumeChange:null,salesChange:null,isLoading:f,isError:g};const{current:p,previous:v}=x(c.history,s),D=d(p,"volumeUsd"),U=d(p,"salesCount");return{points:L({...c,history:p}),totals:{volumeUsd:D,salesCount:U},volumeChange:C(D,d(v,"volumeUsd")),salesChange:C(U,d(v,"salesCount")),isLoading:f,isError:g}}export{N as c,R as d,H as t,W as u};

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.