PageSourceSearch

https://438punk.house/packs/streaming-BYWdcb4n.js

js 438punk.house collected 2026-10-09 01:06:25 UTC 8,127 bytes, 2 lines download raw bytes

1import{g as $}from"./load_locale-CSV-V5M8.js";import"./client-By3tlFYA.js";import{y as _,g as G,D as N}from"./index-DN3cA6_s.js";import{b9 as x,ba as R,bb as W,bc as j,bd as B,be as M,bf as P,bg as J,bh as D,bi as L,bj as A,bk as q,bl as I,bm as F,bn as H,bo as z,G as K,bp as Q,bq as U}from"./useSelectableClick-BJt1tH7m.js";var d={},g={},w;function V(){if(w)return g;w=1,Object.defineProperty(g,"__esModule",{value:!0}),g.createBackoff=s;var t={exponential:function(a,l){return Math.floor(Math.random()*Math.pow(2,a)*l)},fibonacci:function(a,l){var e=1;if(a>e)for(var n=1,e=2,r=2;r<a;r++){var c=n+e;n=e,e=c}return Math.floor(Math.random()*e*l)}};function s(o,a){return new i(t[o],a)}function i(o,a){this.func=o,this.attempts=0,this.delay=typeof a.initialDelay<"u"?a.initialDelay:100}return i.prototype.backoff=function(){setTimeout(this.onReady,this.func(++this.attempts,this.delay))},g}const Y={},X=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"})),Z=_(X);var C;function ee(){if(C)return d;C=1,Object.defineProperty(d,"__esModule",{value:!0});var t=function(){function l(e,n){for(var r=0;r<n.length;r++){var c=n[r];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}return function(e,n,r){return n&&l(e.prototype,n),r&&l(e,r),e}}();function s(l,e){if(!(l instanceof e))throw new TypeError("Cannot call a class as a function")}var i=V().createBackoff,o=typeof WebSocket<"u"?WebSocket:Z,a=function(){function l(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};s(this,l),this.url=e,this.protocols=n,this.reconnectEnabled=!0,this.listeners={},this.backoff=i(r.backoff||"exponential",r),this.backoff.onReady=this.onBackoffReady.bind(this),(typeof r.connect>"u"||r.connect)&&this.open()}return t(l,[{key:"open",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.isReconnect=n;var r=this.ws&&this.ws.binaryType;this.ws=new o(this.url,this.protocols),this.ws.onclose=this.onCloseCallback.bind(this),this.ws.onerror=this.onErrorCallback.bind(this),this.ws.onmessage=this.onMessageCallback.bind(this),this.ws.onopen=this.onOpenCallback.bind(this),r&&(this.ws.binaryType=r)}},{key:"onBackoffReady",value:function(n,r){this.open(!0)}},{key:"onCloseCallback",value:function(n){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&n.code<3e3&&this.backoff.backoff()}},{key:"onErrorCallback",value:function(){this.listeners.onerror&&this.listeners.onerror.apply(null,arguments)}},{key:"onMessageCallback",value:function(){this.listeners.onmessage&&this.listeners.onmessage.apply(null,arguments)}},{key:"onOpenCallback",value:function(){this.listeners.onopen&&this.listeners.onopen.apply(null,arguments),this.isReconnect&&this.listeners.onreconnect&&this.listeners.onreconnect.apply(null,arguments),this.isReconnect=!1}},{key:"close",value:function(n,r){typeof n>"u"&&(n=1e3),this.reconnectEnabled=!1,this.ws.close(n,r)}},{key:"send",value:function(n){this.ws.send(n)}},{key:"bufferedAmount",get:function(){return this.ws.bufferedAmount}},{key:"readyState",get:function(){return this.ws.readyState}},{key:"binaryType",get:function(){return this.ws.binaryType},set:function(n){this.ws.binaryType=n}},{key:"extensions",get:function(){return this.ws.extensions},set:function(n){this.ws.extensions=n}},{key:"protocol",get:function(){return this.ws.protocol},set:function(n){this.ws.protocol=n}},{key:"onclose",set:function(n){this.listeners.onclose=n},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(n){this.listeners.onerror=n},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(n){this.listeners.onmessage=n},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(n){this.listeners.onopen=n},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(n){this.listeners.onreconnect=n},get:function(){return this.listeners.onreconnect}}]),l}();return a.CONNECTING=o.CONNECTING,a.OPEN=o.OPEN,a.CLOSING=o.CLOSING,a.CLOSED=o.CLOSED,d.default=a,d}var te=ee();const k=G(te);let h;const p=[],b={},ne=t=>{p.push(t)},se=t=>{const s=p.indexOf(t);s!==-1&&p.splice(s,1)},E=({channelName:t,params:s,onConnect:i})=>{const o=v(t,s);b[o]=b[o]||0,b[o]===0&&h.send(JSON.stringify({type:"subscribe",stream:t,...s})),b[o]+=1,i()},T=({channelName:t,params:s,onDisconnect:i})=>{const o=v(t,s);b[o]=b[o]||1,b[o]===1&&h.readyState===k.OPEN&&h.send(JSON.stringify({type:"unsubscribe",stream:t,...s})),b[o]-=1,i()},oe={connected(){p.forEach(t=>E(t))},received(t){const{stream:s}=t;p.filter(({channelName:i,params:o})=>{const a=s[0];if(s.length===1)return i===a;const l=s[1];return["hashtag","hashtag:local"].includes(i)?i===a&&o.tag===l:i==="list"?i===a&&o.list===l:!1}
1).forEach(i=>{i.onReceive(t)})},disconnected(){p.forEach(t=>T(t))},reconnected(){}},v=(t,s)=>Object.keys(s).length===0?t:"".concat(t,"&").concat(Object.keys(s).map(i=>"".concat(i,"=").concat(s[i])).join("&")),ie=(t,s,i)=>(o,a)=>{const l=a().getIn(["meta","streaming_api_base_url"]),e=N(),{onConnect:n,onReceive:r,onDisconnect:c}=i(o,a);if(!e)throw new Error("Trying to connect to the streaming server but no access token is available.");if(!l.startsWith("ws")){const u=S(l,e,v(t,s),{connected(){n()},received(y){r(y)},disconnected(){c()},reconnected(){n()}});return()=>{u.close()}}const f={channelName:t,params:s,onConnect:n,onReceive:r,onDisconnect:c};return ne(f),h?h.readyState===k.OPEN&&E(f):h=S(l,e,"",oe),()=>{se(f),T(f)}},re=["update","delete","notification","conversation","filters_changed","announcement","announcement.delete","announcement.reaction"],ae=(t,s)=>{s({event:t.type,payload:t.data})},S=(t,s,i,{connected:o,received:a,disconnected:l,reconnected:e})=>{const n=i.split("&");if(i=n.shift(),t.startsWith("ws")){const c=new k("".concat(t,"/api/v1/streaming/?").concat(n.join("&")),s);return c.onopen=o,c.onmessage=f=>a(JSON.parse(f.data)),c.onclose=l,c.onreconnect=e,c}i=i.replace(/:/g,"/"),i.endsWith(":media")&&(i=i.replace("/media",""),n.push("only_media=true")),n.push("access_token=".concat(s));const r=new EventSource("".concat(t,"/api/v1/streaming/").concat(i,"?").concat(n.join("&")));return r.onopen=()=>{o()},re.forEach(c=>{r.addEventListener(c,f=>ae(f,a))}),r.onerror=l,r},O=t=>Math.floor(Math.random()*Math.floor(t)),m=(t,s,i={},o={})=>{const{messages:a}=$(),l=s.startsWith("public")||s.startsWith("hashtag");return ie(s,i,(e,n)=>{const r=n().getIn(["meta","locale"]);let c;const f=async u=>{await u(e,n),c=setTimeout(()=>f(u),2e4+O(2e4))};return{onConnect(){e(q(t)),c&&(clearTimeout(c),c=null),o.fillGaps&&e(o.fillGaps())},onDisconnect(){e(A({timeline:t})),o.fallback&&(c=setTimeout(()=>f(o.fallback),O(4e4)))},onReceive(u){switch(u.event){case"update":e(L(t,JSON.parse(u.payload),{accept:o.accept,bogusQuotePolicy:l}));break;case"status.update":e(D(JSON.parse(u.payload),{bogusQuotePolicy:l}));break;case"delete":e(J(u.payload));break;case"notification":{const y=JSON.parse(u.payload);e(M(y,a,r)),e(P(y));break}case"notifications_merged":{e(B());break}case"conversation":e(j(JSON.parse(u.payload)));break;case"announcement":e(W(JSON.parse(u.payload)));break;case"announcement.reaction":e(R(JSON.parse(u.payload)));break;case"announcement.delete":e(x(u.payload));break}}}})};async function ce(t){await t(K({maxId:void 0}));try{await t(Q())}catch(s){}await t(U())}const he=()=>m("home","user",{},{fallback:ce,fillGaps:I}),pe=({onlyMedia:t}={})=>m("community".concat(t?":media":""),"public:local".concat(t?":media":""),{},{fillGaps:()=>F({onlyMedia:t})}),me=({onlyMedia:t,onlyRemote:s}={})=>m("public".concat(s?":remote":"").concat(t?":media":""),"public".concat(s?":remote":"").concat(t?":media":""),{},{fillGaps:()=>H({onlyMedia:t,onlyRemote:s})}),ye=(t,s,i,o)=>m("hashtag:".concat(t).concat(i?":local":""),"hashtag".concat(i?":local":""),{tag:s},{accept:o}),de=()=>m("direct","direct"),ge=t=>m("list:".concat(t),"list",{list:t},{fillGaps:()=>z(t)});export{me as a,pe as b,he as c,ye as d,de as e,ge as f};
2//# sourceMappingURL=streaming-BYWdcb4n.js.map

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.