playlist-data-engine 1.5.8 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";var Y=Object.create;var N=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var j=(h,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of B(e))!V.call(h,a)&&a!==t&&N(h,a,{get:()=>e[a],enumerable:!(s=z(e,a))||s.enumerable});return h};var I=(h,e,t)=>(t=h!=null?Y(K(h)):{},j(e||!h||!h.__esModule?N(t,"default",{value:h,enumerable:!0}):t,h));var $=(h=>(h[h.DEBUG=0]="DEBUG",h[h.INFO=1]="INFO",h[h.WARN=2]="WARN",h[h.ERROR=3]="ERROR",h[h.NONE=4]="NONE",h))($||{});const X={0:"DEBUG",1:"INFO",2:"WARN",3:"ERROR",4:"NONE"};let k=1,W=!0,_=!0,E=null,D=!1,A=!1;class C{constructor(e){this.context=e}static for(e){return new C(e)}static enableDiagnosticMode(){D=!0,k=0}static disableDiagnosticMode(){D=!1,k=1}static isDiagnosticMode(){return D}static enableVerbose(){A=!0,k=0}static disableVerbose(){A=!1,k=1}static isVerbose(){return A}static setVerbose(e){A=e,k=e?0:1}static setLevel(e){k=e}static getLevel(){return k}static configure(e){e.level!==void 0&&(k=e.level),e.includeTimestamp!==void 0&&(W=e.includeTimestamp),e.includeContext!==void 0&&(_=e.includeContext),e.customHandler!==void 0&&(E=e.customHandler)}static reset(){k=1,W=!0,_=!0,E=null,D=!1,A=!1}debug(e,t){this.log(0,e,t)}info(e,t){this.log(1,e,t)}warn(e,t){this.log(2,e,t)}error(e,t){this.log(3,e,t)}log(e,t,s){if(e<k)return;const a={timestamp:new Date,level:e,context:this.context,message:t,data:s};if(E){E(a);return}const r=this.formatMessage(a);switch(e){case 0:s!==void 0?console.debug(r,s):console.debug(r);break;case 1:s!==void 0?console.info(r,s):console.info(r);break;case 2:s!==void 0?console.warn(r,s):console.warn(r);break;case 3:s!==void 0?console.error(r,s):console.error(r);break}}formatMessage(e){const t=[];return W&&t.push(this.formatTimestamp(e.timestamp)),t.push(`[${X[e.level]}]`),_&&e.context&&t.push(`[${e.context}]`),t.push(e.message),t.join(" ")}formatTimestamp(e){const t=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),r=e.getMilliseconds().toString().padStart(3,"0");return`${t}:${s}:${a}.${r}`}}function J(h){return C.for(h)}const M=[{host:"arweave.net",protocol:"https",priority:3},{host:"ardrive.net",protocol:"https",priority:2},{host:"turbo-gateway.com",protocol:"https",priority:1}],F=["arweave.net","arweave.dev","www.arweave.net","ardrive.net","turbo-gateway.com","irys.xyz","ar-io.dev","ar-io.net","arweave.rocks","g8way.io"];function T(h){if(!h||typeof h!="string")return!1;if(h.startsWith("ar://"))return!0;const e=h.toLowerCase();try{const t=new URL(h).hostname;return F.some(s=>t===s||t.endsWith("."+s))}catch{return F.some(t=>e.includes(t))}}function S(h){if(!h||typeof h!="string"||!T(h))return null;let e=null,t="";if(h.startsWith("ar://")){const l=h.slice(5),i=l.indexOf("/");return i!==-1?(e=l.slice(0,i),t=l.slice(i)):e=l,e.length===43&&/^[A-Za-z0-9_-]+$/.test(e)?{txId:e,originalUrl:h,pathSuffix:t}:null}let s=h;try{const l=new URL(h);s=l.pathname+l.search}catch{}const a=/[A-Za-z0-9_-]{43}/g,r=s.match(a);if(r&&r.length>0){e=r[0];const l=h.indexOf(e);if(l!==-1){const i=h.slice(l+43),c=Math.min(i.indexOf("?")===-1?1/0:i.indexOf("?"),i.indexOf("#")===-1?1/0:i.indexOf("#"));c===1/0?t=i:t=i.slice(0,c)}return{txId:e,originalUrl:h,pathSuffix:t}}return null}function G(h,e,t=""){return`${e.protocol||"https"}://${e.host}/${h}${t}`}function q(h,e=M,t=""){return e.sort((s,a)=>s.priority-a.priority).map(s=>G(h,s,t))}async function Z(){try{return await import("@ar.io/wayfinder-core")}catch{return null}}async function Q(){try{return await import("@ar.io/sdk")}catch{return null}}const ee="https://solana-rpc.publicnode.com",te=5e3,se=864e5,L="arweave_active_gateway",H="arweave_ranked_gateways";class x{constructor(e){this.cache=new Map,this.logger=C.for("ArweaveGateway"),this.hitCount=0,this.missCount=0,this.healthData=new Map,this.originalPriorities=new Map,this.MAX_HEALTH_RECORDS=50,this.inflightResolves=new Map,this.inflightControllers=new Map,this.wayfinder=null,this.wayfinderGatewaysProvider=null,this.rankedGatewaysCache=null,this.rankedGatewaysCacheTimestamp=0,this.RANKED_GATEWAYS_TTL_MS=1440*60*1e3,this.activeGateway=null,this.lastFetchTiming=0,this.consecutiveSlowResponses=0,this.gateways=(e?.gateways??M).map(s=>({...s})),this.timeout=e?.timeout??te,this.cacheTTL=e?.cacheTTL??se,this.slowResponseThreshold=e?.slowResponseThreshold??8e3,this.maxSlowResponses=e?.maxSlowResponses??3,this.solanaRpcUrl=e?.solanaRpcUrl??ee,this.hasCustomSolanaRpc=typeof e?.solanaRpcUrl=="string"&&e.solanaRpcUrl.length>0,this.wayfinderSortBy=e?.wayfinderSortBy??"weights.compositeWeight",this.wayfinderPrimaryLimit=e?.wayfinderPrimaryLimit??50,this.wayfinderFallbackLimit=e?.wayfinderFallbackLimit??100,this.wayfinderStrategy=e?.wayfinderStrategy??"composite-ping-random",this.gateways.sort((s,a)=>s.priority-a.priority),this.gateways.forEach(s=>{this.originalPriorities.set(s.host,s.priority)}),this.activeGateway=this.loadPersistedGateway();const t=this.loadPersistedRankedGateways();t&&(this.rankedGatewaysCache=t),Promise.all([Z(),Q(),Promise.resolve().then(()=>require("./index.browser-g8_n-BSM.cjs"))]).then(([s,a,r])=>{if(s&&a)try{const{FastestPingRoutingStrategy:l,RandomRoutingStrategy:i,CompositeRoutingStrategy:c,RoundRobinRoutingStrategy:n,NetworkGatewaysProvider:y}=s,u=a.ARIO,o=r.createSolanaRpc(this.solanaRpcUrl),f=u.init({rpc:o}),w=this.wrapProviderWithCache(new y({ario:f,sortBy:this.wayfinderSortBy,limit:this.wayfinderPrimaryLimit})),g=this.wrapProviderWithCache(new y({ario:f,sortBy:this.wayfinderSortBy,limit:this.wayfinderFallbackLimit}));this.wayfinderGatewaysProvider=w;const d=(()=>{switch(this.wayfinderStrategy){case"random-only":return new i({gatewaysProvider:g});case"ping-only":return new l({timeoutMs:3e3,gatewaysProvider:w});case"round-robin":return new n({gateways:[],gatewaysProvider:w});default:return new c({strategies:[new l({timeoutMs:3e3,gatewaysProvider:w}),new i({gatewaysProvider:g})]})}})();this.wayfinder=s.createWayfinderClient({routingStrategy:d}),this.logger.info("Wayfinder client initialized",{strategy:this.wayfinderStrategy,sortBy:this.wayfinderSortBy,primaryLimit:this.wayfinderPrimaryLimit,fallbackLimit:this.wayfinderFallbackLimit})}catch(l){this.logger.warn("Failed to configure Wayfinder routing strategy, using defaults",{error:l}),this.wayfinder=s.createWayfinderClient(),this.logger.info("Wayfinder client initialized with default routing")}else s&&(this.wayfinder=s.createWayfinderClient(),this.logger.info("Wayfinder client initialized with default routing (SDK unavailable)"))}).catch(()=>{this.logger.debug("Wayfinder client initialization failed, using static gateways")}),this.logger.info("Gateway manager initialized",{gateways:this.gateways.map(s=>s.host),timeout:this.timeout,cacheTTL:this.cacheTTL,activeGateway:this.activeGateway?.host??null})}withTimeout(e,t,s){return new Promise((a,r)=>{const l=setTimeout(()=>r(new Error(s)),t);e.then(i=>{clearTimeout(l),a(i)},i=>{clearTimeout(l),r(i)})})}wrapProviderWithCache(e){let t=null,s=0,a=null;const r=()=>t!==null&&t.length>0&&Date.now()<s,i=this.loadPersistedRankedGateways();return i&&i.length>0&&(t=i,s=(this.rankedGatewaysCacheTimestamp||Date.now())+this.RANKED_GATEWAYS_TTL_MS),{getGateways:async()=>r()?t:a||(a=(async()=>{try{const c=await e.getGateways();return c&&c.length>0&&(t=c,s=Date.now()+this.RANKED_GATEWAYS_TTL_MS,this.rankedGatewaysCacheTimestamp=Date.now(),this.rankedGatewaysCache=c,this.persistRankedGateways(c,this.rankedGatewaysCacheTimestamp)),c}catch(c){if(this.logger.warn("Ranked gateway fetch failed, serving stale list",{error:c}),t&&t.length>0)return t;throw c}finally{a=null}})(),a)}}resolveUrlSimple(e){if(!T(e))return e;const t=S(e);if(!t)return e;const s=this.activeGateway??this.gateways[0];return this.logger.debug("[gateway] resolveUrlSimple",{txId:t.txId,gateway:s.host,pathSuffix:t.pathSuffix||void 0}),G(t.txId,s,t.pathSuffix)}setPreferredGateway(e){const t=this.gateways.find(s=>s.host===e);return t?(this.activeGateway=t,this.lastFetchTiming=0,this.consecutiveSlowResponses=0,this.persistGateway(t),this.logger.info("Preferred gateway set",{host:e}),!0):(this.logger.warn("Cannot set preferred gateway — not in gateway list",{host:e,available:this.gateways.map(s=>s.host)}),!1)}clearPreferredGateway(){this.activeGateway=null,this.lastFetchTiming=0,this.consecutiveSlowResponses=0,this.clearPersistedGateway(),this.cache.clear(),this.logger.info("Preferred gateway cleared, will re-discover on next resolve")}getDiagnostics(){const e=this.gateways.map(t=>{const s=this.healthData.get(t.host)??[],a=s.length,r=a>0?Math.round(s.reduce((i,c)=>i+c.responseTime,0)/a):0,l=a>0?s.filter(i=>i.success).length/a:1;return{host:t.host,avgMs:r,successRate:Math.round(l*100)/100,checks:a}});return{activeGateway:this.activeGateway?.host??null,activeGatewayAge:null,availableGateways:this.gateways.map(t=>t.host),lastFetchTiming:this.lastFetchTiming,consecutiveSlowResponses:this.consecutiveSlowResponses,healthSummary:e}}async resolveUrl(e,t){const s=t?.signal;if(s?.aborted)return this.logger.debug("resolveUrl called with already-aborted signal, returning original URL"),e;if(!T(e))return e;const a=S(e);if(!a)return this.logger.warn("Failed to parse Arweave URL, returning original",{url:e}),e;const{txId:r,pathSuffix:l}=a,i=this.getCachedGateway(r);if(i){this.hitCount++;const o=G(r,i,l);return this.logger.debug("Cache hit for txId",{txId:r,gateway:i.host,pathSuffix:l}),o}const c=this.activeGateway?.host??"none";this.consecutiveSlowResponses>=this.maxSlowResponses&&(this.logger.warn("Proactive gateway rotation triggered",{slowCount:this.consecutiveSlowResponses,threshold:this.maxSlowResponses,previousGateway:c}),this.activeGateway=null,this.consecutiveSlowResponses=0,this.clearPersistedGateway(),this.cache.clear());const n=this.inflightResolves.get(r);if(n)return this.logger.debug("Reusing in-flight resolve for txId",{txId:r}),n;const y=new AbortController;s&&s.addEventListener("abort",()=>y.abort(),{once:!0});const u=this.resolveGatewayChain(e,r,l,y.signal,t).finally(()=>{this.inflightResolves.delete(r),this.inflightControllers.delete(r)});return this.inflightResolves.set(r,u),this.inflightControllers.set(r,y),u}async resolveGatewayChain(e,t,s,a,r){const l=Date.now(),i=r?.bypassArweaveNet??!1;let c=null,n=null;if(e.startsWith("https://")||e.startsWith("http://"))try{const g=new URL(e),d={host:g.host,protocol:g.protocol.replace(":",""),priority:0},m=Date.now(),p=await this.checkAndSetGateway(e,t,s,d,a),R=Date.now()-m;if(p){if(this.logger.info(`[gateway] Step 0 (original): ${p.kind}`,{host:d.host,ms:R,totalMs:Date.now()-l}),p.kind==="verified")return p.url;n??=p.url}else this.logger.info("[gateway] Step 0 (original): failed",{host:d.host,ms:R});c=d.host}catch{}if(this.activeGateway&&this.activeGateway.host!==c){const g=Date.now(),d=await this.checkAndSetGateway(e,t,s,this.activeGateway,a),m=Date.now()-g;if(d){if(this.logger.info(`[gateway] Step 1 (persisted): ${d.kind}`,{host:this.activeGateway.host,ms:m,totalMs:Date.now()-l}),d.kind==="verified")return d.url;n??=d.url}else this.logger.info("[gateway] Step 1 (persisted): failed, clearing",{ms:m}),this.activeGateway=null,this.clearPersistedGateway()}if(!i&&c!=="arweave.net"){const g=this.gateways.find(d=>d.host==="arweave.net");if(g){const d=Date.now(),m=await this.checkAndSetGateway(e,t,s,g,a),p=Date.now()-d;if(m){if(this.logger.info(`[gateway] Step 2 (arweave.net): ${m.kind}`,{ms:p,totalMs:Date.now()-l}),m.kind==="verified")return m.url;n??=m.url}else this.logger.info("[gateway] Step 2 (arweave.net): failed",{ms:p})}}const y=Date.now(),u=await this.tryFallbackGateways(e,t,s,a,c),o=Date.now()-y;if(u){if(this.logger.info(`[gateway] Step 3 (fallbacks): ${u.kind}`,{ms:o,totalMs:Date.now()-l}),u.kind==="verified")return u.url;n??=u.url}else this.logger.info("[gateway] Step 3 (fallbacks): failed",{ms:o});const f=!this.hasCustomSolanaRpc,w=r?.bypassWayfinder??f;if(this.wayfinder&&!w){const g=Date.now();this.logger.info("[gateway] Step 4 (wayfinder): trying");const d=await this.tryWayfinder(t,s,a,c),m=Date.now()-g;if(d){if(this.logger.info(`[gateway] Step 4 (wayfinder): ${d.kind}`,{ms:m,totalMs:Date.now()-l}),d.kind==="verified")return d.url;n??=d.url}else this.logger.info("[gateway] Step 4 (wayfinder): failed",{ms:m})}return n?(this.logger.warn("No gateway verified, returning best maybe-result",{txId:t,pathSuffix:s,maybeUrl:n}),n):(this.logger.warn("All gateways (arweave.net + Wayfinder + fallbacks) failed, returning original URL",{txId:t,pathSuffix:s,originalUrl:e}),e)}async reportGatewayFailure(e,t){const{signal:s,reason:a,excludeHost:r}=t??{};if(s?.aborted)return this.logger.debug("reportGatewayFailure called with already-aborted signal, returning original URL"),e;if(a==="user-cancel-fast")return this.logger.debug("User cancelled quickly, keeping current gateway"),e;const l=S(e);if(!l)return e;const{txId:i,pathSuffix:c}=l;this.logger.warn("Gateway failure reported, finding new gateway",{failedHost:this.activeGateway?.host,txId:i,reason:a??"load-error"});const n=this.activeGateway?.host??r;this.activeGateway=null,this.cache.delete(i),this.clearPersistedGateway();const y=this.gateways.find(f=>f.host==="arweave.net"&&f.host!==n);if(y){const f=await this.checkAndSetGateway(e,i,c,y,s);if(f)return f.url}if(this.wayfinder){const f=await this.tryWayfinder(i,c,s);if(f)return f.url}const u=this.gateways;n&&(this.gateways=this.gateways.filter(f=>f.host!==n));const o=await this.tryFallbackGateways(e,i,c,s);return this.gateways=u,o?o.url:e}reportFetchSuccess(e){this.lastFetchTiming=e,e>=this.slowResponseThreshold?(this.consecutiveSlowResponses++,this.logger.warn("Slow fetch response recorded",{timingMs:e,threshold:this.slowResponseThreshold,consecutiveSlow:this.consecutiveSlowResponses,maxAllowed:this.maxSlowResponses,gateway:this.activeGateway?.host??"none"})):(this.consecutiveSlowResponses>0&&this.logger.info("Fetch timing recovered, resetting slow counter",{timingMs:e,previousSlowCount:this.consecutiveSlowResponses}),this.consecutiveSlowResponses=0)}async checkAndSetGateway(e,t,s,a,r){if(r?.aborted)return null;const l=await this.checkGateway(t,a,s,r);if(l===!0){this.setActiveGateway(a,t);const i=G(t,a,s);return this.logger.info("Gateway resolved",{txId:t,gateway:a.host,pathSuffix:s,workingUrl:i}),{kind:"verified",url:i}}if(l==="maybe"){const i=G(t,a,s);return this.logger.info("Gateway maybe resolved (no-cors)",{txId:t,gateway:a.host,pathSuffix:s,workingUrl:i}),{kind:"maybe",url:i}}return null}async tryFallbackGateways(e,t,s,a,r){this.missCount++;const l=.7,i=3,c=this.gateways.filter(w=>w.host!=="arweave.net"&&w.host!==r),n=c.filter(w=>{const{rate:g,totalChecks:d}=this.getFailureRate(w.host);return!(d>=i&&g>l)}),y=n.length>0?n:c;if(a?.aborted||y.length===0)return null;const u=async w=>{if(a?.aborted||w.length===0)return null;const g=new AbortController,d=()=>g.abort();a?.addEventListener("abort",d,{once:!0});let m=null,p=null,R=!1;try{const P=await Promise.allSettled(w.map(async v=>{const b=await this.checkGateway(t,v,s,g.signal);if(!b)throw new Error(`Gateway ${v.host} failed check`);const U=G(t,v,s),O=b===!0?"verified":"maybe";return R||(R=!0,O==="verified"?(this.setActiveGateway(v,t),this.logger.info("Gateway resolved via fallback",{txId:t,gateway:v.host,pathSuffix:s,workingUrl:U})):this.logger.info("Gateway maybe resolved via fallback (no-cors)",{txId:t,gateway:v.host,pathSuffix:s,workingUrl:U})),{kind:O,url:U}}));for(const v of P){if(v.status!=="fulfilled")continue;const b=v.value;if(b.kind==="verified"&&!m?m={kind:"verified",url:b.url}:b.kind==="maybe"&&!p&&(p={kind:"maybe",url:b.url}),m)break}return m??p}finally{a?.removeEventListener("abort",d)}},o=await u(y);if(o&&o.kind==="verified")return o;let f=o;if(n.length<c.length&&!a?.aborted){const w=c.filter(d=>!n.some(m=>m.host===d.host)).map(d=>d.host);this.logger.debug("Healthy gateways exhausted, retrying with previously unhealthy",{excludedHosts:w});const g=await u(c);if(g&&(g.kind==="verified"||!f))return g}return f}async getRankedGatewaysCached(e){if(!this.wayfinderGatewaysProvider)return null;try{const t=await this.withTimeout(this.wayfinderGatewaysProvider.getGateways(),this.timeout+2e3,"Wayfinder provider getGateways timed out");return e?.aborted?null:t&&t.length>0?t:null}catch(t){return this.logger.debug("Ranked gateway list unavailable",{error:t}),null}}async tryWayfinder(e,t,s,a){if(!this.wayfinder)return null;let r=null;const l=10,i=new Set;a&&i.add(a);const c=`https://arweave.net/${e}${t}`;try{this.logger.debug("Resolving via Wayfinder (first pick)",{txId:e,normalizedUrl:c});const u=await this.withTimeout(this.wayfinder.resolveUrl({originalUrl:c}),this.timeout+2e3,"Wayfinder resolution timed out");if(s?.aborted)return null;const o=u.hostname;if(i.has(o))this.logger.debug("Wayfinder first pick was already excluded, skipping to walk",{host:o});else{const f=u.protocol.replace(":",""),w={host:o,protocol:f,priority:0},g=await this.checkGateway(e,w,t,s);if(g){const d=G(e,w,t),m=g===!0?"verified":"maybe";if(m==="verified"?(this.setActiveGateway(w,e),this.logger.info("Gateway resolved via Wayfinder (first pick)",{txId:e,gateway:o,pathSuffix:t,workingUrl:d})):this.logger.info("Gateway maybe resolved via Wayfinder (first pick, no-cors)",{txId:e,gateway:o,pathSuffix:t,workingUrl:d}),m==="verified")return{kind:m,url:d};r??={kind:m,url:d}}else this.logger.debug("Wayfinder first pick failed verify, will walk ranked list",{host:o});i.add(o)}}catch(u){this.logger.debug("Wayfinder first pick threw, will walk ranked list",{error:u})}if(s?.aborted)return r;const n=await this.getRankedGatewaysCached(s);if(!n||n.length===0||s?.aborted)return r;const y=n.filter(u=>!i.has(u.hostname)).slice(0,l);this.logger.debug("Walking Wayfinder ranked list",{txId:e,poolSize:n.length,walkSize:y.length});for(const u of y){if(s?.aborted)return r;const o={host:u.hostname,protocol:u.protocol.replace(":",""),priority:0},f=await this.checkGateway(e,o,t,s);if(f){const w=G(e,o,t),g=f===!0?"verified":"maybe";if(g==="verified")return this.setActiveGateway(o,e),this.logger.info("Gateway resolved via Wayfinder ranked walk",{txId:e,gateway:o.host,pathSuffix:t,workingUrl:w}),{kind:g,url:w};this.logger.info("Gateway maybe resolved via Wayfinder ranked walk (no-cors)",{txId:e,gateway:o.host,pathSuffix:t,workingUrl:w}),r??={kind:g,url:w}}i.add(o.host)}return r?this.logger.debug("Wayfinder returning best maybe-result (no verified match)",{txId:e,checkedHosts:Array.from(i),maybeUrl:r.url}):this.logger.debug("Wayfinder ranked walk exhausted with no match",{txId:e,checkedHosts:Array.from(i)}),r}setActiveGateway(e,t){this.activeGateway=e,this.lastFetchTiming=0,this.consecutiveSlowResponses=0,this.setCache(t,e),this.persistGateway(e)}loadPersistedGateway(){try{if(typeof localStorage>"u")return null;const e=localStorage.getItem(L);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t.host=="string"&&typeof t.protocol=="string"){if(typeof t.timestamp=="number"&&Date.now()-t.timestamp>72e5)return this.logger.info("Ignoring persisted gateway — expired (older than 2 hours)",{host:t.host}),this.clearPersistedGateway(),null;this.logger.info("Restored active gateway from localStorage",{host:t.host});const{timestamp:a,...r}=t;return r}}catch{}return null}loadPersistedRankedGateways(){try{if(typeof localStorage>"u")return null;const e=localStorage.getItem(H);if(!e)return null;const t=JSON.parse(e);if(!t||!Array.isArray(t.gateways)||typeof t.timestamp!="number")return null;const s=Date.now()-t.timestamp;if(s>this.RANKED_GATEWAYS_TTL_MS)return this.logger.info("Ignoring persisted ranked gateway list — expired",{ageMs:s}),this.clearPersistedRankedGateways(),null;const a=[];for(const r of t.gateways)if(typeof r=="string")try{a.push(new URL(r))}catch{}return a.length===0?null:(this.rankedGatewaysCacheTimestamp=t.timestamp,this.logger.info("Restored ranked gateway list from localStorage",{size:a.length,ageMs:s}),a)}catch{return null}}persistRankedGateways(e,t){try{if(typeof localStorage>"u")return;const s={gateways:e.map(a=>a.toString()),timestamp:t};localStorage.setItem(H,JSON.stringify(s))}catch{}}clearPersistedRankedGateways(){try{if(typeof localStorage>"u")return;localStorage.removeItem(H)}catch{}}persistGateway(e){try{if(typeof localStorage>"u")return;const t={...e,timestamp:Date.now()};localStorage.setItem(L,JSON.stringify(t))}catch{}}clearPersistedGateway(){try{if(typeof localStorage>"u")return;localStorage.removeItem(L)}catch{}}async checkGateway(e,t,s="",a){const r=G(e,t,s),l=Date.now(),i=new AbortController,c=setTimeout(()=>i.abort(),this.timeout),n=()=>i.abort();a?.addEventListener("abort",n,{once:!0});try{const y=await fetch(r,{method:"HEAD",mode:"cors",signal:i.signal});clearTimeout(c),a?.removeEventListener("abort",n);const u=Date.now()-l,o=y.ok||y.status>=200&&y.status<400;return this.recordGatewayResponse(t.host,u,o),o}catch(y){clearTimeout(c),a?.removeEventListener("abort",n);const u=Date.now()-l;if(this.recordGatewayResponse(t.host,u,!1),y instanceof Error&&y.name==="AbortError"){const o=a?.aborted;return this.logger.debug(o?"Gateway check aborted by external signal":"Gateway check timed out",{txId:e,gateway:t.host,timeout:this.timeout}),!1}if(y instanceof TypeError){this.logger.debug("HEAD failed (likely CORS), retrying with no-cors",{txId:e,gateway:t.host,error:y.message});try{await fetch(r,{method:"GET",mode:"no-cors",signal:i.signal});const o=Date.now()-l;return this.recordGatewayResponse(t.host,o,!0),"maybe"}catch{const o=Date.now()-l;return this.recordGatewayResponse(t.host,o,!1),!1}}return this.logger.debug("Gateway HEAD failed",{txId:e,gateway:t.host,error:y instanceof Error?y.message:String(y)}),!1}}getCachedGateway(e){const t=this.cache.get(e);return t?this.isCacheValid(t)?t.workingGateway:(this.cache.delete(e),null):null}setCache(e,t){const s={txId:e,workingGateway:t,timestamp:Date.now(),ttl:this.cacheTTL};this.cache.set(e,s),this.logger.debug("Cached working gateway",{txId:e,gateway:t.host})}clearCache(){const e=this.cache.size;this.cache.clear(),this.hitCount=0,this.missCount=0,this.logger.info("Cache cleared",{entriesRemoved:e})}invalidateCacheForUrl(e){if(!T(e))return;const t=S(e);t&&(this.cache.delete(t.txId),this.activeGateway=null,this.clearPersistedGateway())}async prefetchUrls(e,t){const s=t?.concurrency??5,a=t?.continueOnError??!0,r=[];let l=0,i=0,c=0;for(let n=0;n<e.length;n+=s){const y=e.slice(n,n+s),u=await Promise.allSettled(y.map(async o=>{if(!T(o))return{url:o,txId:"",success:!1,error:"Not an Arweave URL"};const f=S(o);if(!f)return{url:o,txId:"",success:!1,error:"Failed to parse Arweave URL"};const w=this.getCachedGateway(f.txId);if(w)return{url:o,txId:f.txId,success:!0,gateway:w};await this.resolveUrl(o);const g=this.getCachedGateway(f.txId);return g?{url:o,txId:f.txId,success:!0,gateway:g}:{url:o,txId:f.txId,success:!1,error:"All gateways failed"}}));for(const o of u)if(o.status==="fulfilled"){const f=o.value;r.push(f),f.error==="Not an Arweave URL"?c++:f.success?l++:i++}else i++,r.push({url:"unknown",txId:"",success:!1,error:o.reason?.message??"Unknown error"});if(!a&&i>0){this.logger.warn("Prefetch stopped due to failures",{failed:i,processed:r.length});break}}return this.logger.info("Prefetch complete",{total:e.length,succeeded:l,failed:i,skipped:c}),{total:e.length,succeeded:l,failed:i,skipped:c,entries:r}}getCacheStats(){const e=Array.from(this.cache.entries()),t=Date.now(),s=e.filter(([,a])=>t-a.timestamp<a.ttl).map(([a])=>a);return{size:s.length,txIds:s,hitCount:this.hitCount,missCount:this.missCount,ttl:this.cacheTTL}}getCacheEntries(){return Array.from(this.cache.values())}isCacheValid(e){return Date.now()-e.timestamp<e.ttl}getFailureRate(e){const t=this.healthData.get(e);return!t||t.length===0?{rate:0,totalChecks:0}:{rate:t.filter(a=>!a.success).length/t.length,totalChecks:t.length}}getAverageResponseTime(e){const t=this.healthData.get(e);return!t||t.length===0?0:t.reduce((s,a)=>s+a.responseTime,0)/t.length}recordGatewayResponse(e,t,s){this.healthData.has(e)||this.healthData.set(e,[]);const a=this.healthData.get(e);a.push({responseTime:t,success:s,timestamp:Date.now()}),a.length>this.MAX_HEALTH_RECORDS&&a.shift()}reportFetchTiming(e,t,s){this.recordGatewayResponse(e,t,s),this.logger.debug("Fetch timing reported",{host:e,timingMs:t,success:s})}getGatewayHealth(e){const t=this.gateways.find(o=>o.host===e);if(!t)return;const s=this.healthData.get(e)||[],a=this.originalPriorities.get(e)??t.priority;if(s.length===0)return{host:e,priority:t.priority,originalPriority:a,successCount:0,failureCount:0,totalChecks:0,successRate:0,averageResponseTime:0,lastSuccess:null,lastFailure:null,isHealthy:!0};const r=s.filter(o=>o.success).length,l=s.filter(o=>!o.success).length,i=r/s.length,c=Math.round(s.reduce((o,f)=>o+f.responseTime,0)/s.length),n=s.filter(o=>o.success).pop()?.timestamp??null,y=s.filter(o=>!o.success).pop()?.timestamp??null,u=i>=.5;return{host:e,priority:t.priority,originalPriority:a,successCount:r,failureCount:l,totalChecks:s.length,successRate:i,averageResponseTime:c,lastSuccess:n,lastFailure:y,isHealthy:u}}getAllGatewayHealth(){return this.gateways.map(e=>this.getGatewayHealth(e.host))}adjustGatewayPriorities(e){const t=e?.minChecks??3,s=e?.healthyThreshold??.5,r=this.getAllGatewayHealth().reduce((n,y)=>n+y.totalChecks,0);if(r<t)return this.logger.debug("Not enough health data to adjust priorities",{totalChecks:r,required:t}),[...this.gateways];const l=this.gateways.map((n,y)=>({gateway:n,originalIndex:y}));l.sort((n,y)=>{const u=this.getGatewayHealth(n.gateway.host),o=this.getGatewayHealth(y.gateway.host),f=u.successRate>=s||u.totalChecks===0,w=o.successRate>=s||o.totalChecks===0;if(f&&!w)return-1;if(!f&&w)return 1;if(u.totalChecks>0&&o.totalChecks>0){const g=u.averageResponseTime-o.averageResponseTime;if(Math.abs(g)>100)return g}if(u.totalChecks>0&&o.totalChecks>0){const g=o.successRate-u.successRate;if(Math.abs(g)>.1)return g}return n.originalIndex-y.originalIndex});const i=l.map(n=>n.gateway),c=Math.min(...Array.from(this.originalPriorities.values()));return i.forEach((n,y)=>{n.priority=c+y}),this.gateways=i,this.logger.info("Gateway priorities adjusted",{newOrder:this.gateways.map(n=>({host:n.host,priority:n.priority,health:this.getGatewayHealth(n.host)}))}),[...this.gateways]}async runHealthCheck(e){const t=Date.now(),s=e?.txId??"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk012345",a=e?.healthyThreshold??.5;e?.fastThreshold,this.logger.info("Starting gateway health check",{txId:s,gateways:this.gateways.map(w=>w.host)});const r=this.gateways.map(async w=>{const g=Date.now();let d=!1,m=this.timeout;try{const p=G(s,w),R=new AbortController,P=setTimeout(()=>R.abort(),this.timeout),v=await fetch(p,{method:"HEAD",mode:"cors",signal:R.signal});clearTimeout(P),m=Date.now()-g,d=v.ok||v.status>=200&&v.status<400}catch{m=Date.now()-g,d=!1}return this.recordGatewayResponse(w.host,m,d),{host:w.host,success:d,responseTime:m}}),l=await Promise.all(r),i=this.getAllGatewayHealth(),c=[],n=[];let y=null,u=1/0;for(const w of l){const g=i.find(d=>d.host===w.host);w.success&&w.responseTime<u&&(u=w.responseTime,y=w.host),(g.successRate>=a||g.totalChecks===1)&&w.success?c.push(w.host):n.push(w.host)}const o=Date.now()-t;e?.adjustPriorities&&this.adjustGatewayPriorities({minChecks:e.minChecksForAdjustment??1,healthyThreshold:a});const f={timestamp:t,gateways:i,healthyGateways:c,unhealthyGateways:n,fastestGateway:y,totalTime:o};return this.logger.info("Health check complete",{healthyGateways:c,unhealthyGateways:n,fastestGateway:y,totalTime:o}),f}resetGatewayPriorities(){this.gateways.forEach(e=>{const t=this.originalPriorities.get(e.host);t!==void 0&&(e.priority=t)}),this.gateways.sort((e,t)=>{const s=this.originalPriorities.get(e.host)??e.priority,a=this.originalPriorities.get(t.host)??t.priority;return s-a}),this.logger.info("Gateway priorities reset to original values",{gateways:this.gateways.map(e=>({host:e.host,priority:e.priority}))})}clearHealthData(){this.healthData.clear(),this.logger.info("Health data cleared")}}const ae=new x;exports.ArweaveGatewayManager=x;exports.DEFAULT_GATEWAYS=M;exports.KNOWN_GATEWAY_HOSTS=F;exports.LogLevel=$;exports.Logger=C;exports.arweaveGatewayManager=ae;exports.constructGatewayUrl=G;exports.createLogger=J;exports.getAllGatewayUrls=q;exports.isArweaveUrl=T;exports.parseArweaveUrl=S;
@@ -438,7 +438,20 @@ export declare class MusicClassifier {
438
438
  /**
439
439
  * Analyzes audio to extract genre, mood, and vibe data.
440
440
  */
441
- analyze(audioUrl: string): Promise<MusicClassificationProfile>;
441
+ /**
442
+ * Analyze a track. Accepts either:
443
+ * - a `string` URL: the engine fetches + decodes + downsamples via Web
444
+ * Audio (main-thread path). Backward-compatible with all existing callers.
445
+ * - an `{ audioSignal, sampleRate? }` object: caller has already fetched,
446
+ * decoded, AND downsampled to mono PCM. Used when running inside a Web
447
+ * Worker (no Web Audio available there). `sampleRate` defaults to 16000
448
+ * (essentia.js's required rate); the engine skips fetch + decode +
449
+ * downsample and runs only the slice + ML inference on the provided signal.
450
+ */
451
+ analyze(input: string | {
452
+ audioSignal: Float32Array;
453
+ sampleRate?: number;
454
+ }): Promise<MusicClassificationProfile>;
442
455
  /**
443
456
  * Runs a classifier model on pre-computed embeddings.
444
457
  *
@@ -1 +1 @@
1
- {"version":3,"file":"MusicClassifier.d.ts","sourceRoot":"","sources":["../../../src/core/analysis/MusicClassifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,0BAA0B,EAG7B,MAAM,0BAA0B,CAAC;AAKlC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,aA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