PageSourceSearch

https://www.forthelong.run/assets/pushSubscription-vzO9AQ6U.js

js forthelong.run collected 2026-10-02 11:31:17 UTC 4,065 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1ece3cfb-3553-5295-b40e-45ccdb30efbd")}catch(e){}}();
3import{t as e}from"./pwaPromptConfig-AUACWOQD.js";import{L as t}from"./QueryClientProvider-Cdu2unP4.js";import{i as n}from"./nectarPageBlock-Dhr05eLZ.js";var r=(e,t)=>`communityAppPush:${e}:${t}`,i=new Map,a=`community-push-changed`,o=e=>{try{return localStorage.getItem(e)}catch{return i.get(e)??null}},s=(e,t)=>{i.set(e,t);try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}window.dispatchEvent(new Event(a))},c=()=>document.querySelector(`link[rel="manifest"]`)?.getAttribute(`href`)===`/community/manifest.webmanifest`,l=()=>window.matchMedia(`(display-mode: standalone)`).matches||`standalone`in navigator&&navigator.standalone===!0,u=()=>window.location.pathname===`/community`||window.location.pathname.startsWith(`/community/`),d=async()=>{let e=await navigator.serviceWorker.getRegistration(`/community`);return!e||new URL(e.scope).pathname.replace(/\/$/,``)!==`/community`?null:e},f,p=e=>{f=e,window.dispatchEvent(new Event(a))},m=()=>f,h=Promise.resolve(),g=e=>{let t=h.then(e,e);return h=t.catch(()=>void 0),t},_=async e=>{let t=m();if(!t?.trackingEnabled)return!0;let n=new TextEncoder().encode(JSON.stringify(e.toJSON())),r=await crypto.subtle.digest(`SHA-256`,n),i=Array.from(new Uint8Array(r),e=>e.toString(16).padStart(2,`0`)).join(``);return o(t.storageKey)===i},v=async(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),1e4);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(r)}},y=async e=>{if(!(`serviceWorker`in navigator))return null;let t=await(u()?d():navigator.serviceWorker.getRegistration());return t?.pushManager?t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e}):null},b=async()=>{if(!(`serviceWorker`in navigator))return null;let e=await(await(u()?d():navigator.serviceWorker.getRegistration()))?.pushManager.getSubscription();if(!e)return null;if(!await e.unsubscribe())throw Error(`Push unsubscribe failed`);return e},x=(e,n,r)=>({headers:{"Content-Type":`application/json`,...n?{"X-CSRF-Token":n.csrfToken}:{}},body:JSON.stringify(n||r?{subscription:e,...n?{community_context:!0,previous_hash:o(n.storageKey)}:{},nectar_page_block:r??n?.pageBlock,nectar_anonymous_user_id:t(),nectar_is_pwa:l()}:e)}),S=async(e,t=m())=>{let n=await v(`/push/subscribe`,{method:`POST`,...x(e,t)});if(n.ok&&t){let e=await n.json();if(typeof e.data_hash!=`string`)return!1;s(t.storageKey,e.data_hash)}return n.ok},C=async(e,t=m(),n)=>{let r=await v(`/push/unsubscribe`,{method:`POST`,...x(e,t??void 0,n)});return r.ok&&t&&s(t.storageKey,null),r.ok},w=[e.communityPush,e.communityInstall,e.communityInstallCallout],T=async()=>{for(let e of w)try{localStorage.removeItem(e)}catch{}try{sessionStorage.removeItem(e.communityInstallCalloutVisit)}catch{}try{await g(async()=>{let e=m();if(`serviceWorker`in navigator){let t;if(navigator.serviceWorker.getRegistrations)t=await navigator.serviceWorker.getRegistrations();else{let e=await navigator.serviceWorker.getRegistration();t=e?[e]:[]}for(let r of t){let t=r.scope?new URL(r.scope).pathname.replace(/\/$/,``):``;if(t!==``&&t!==`/community`)continue;let i=await r.pushManager?.getSubscription();i&&await i.unsubscribe()&&await C(i,t===`/community`?e:null,n.CommunityAppLogout)}}if(e){let r=o(e.storageKey);r&&(await v(`/push/unsubscribe`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-CSRF-Token":e.csrfToken},body:JSON.stringify({community_context:!0,data_hash:r,nectar_page_block:n.CommunityAppLogout,nectar_anonymous_user_id:t(),nectar_is_pwa:l()})})).ok&&s(e.storageKey,null)}})}catch{}};export{p as _,C as a,r as c,d,c as f,o as g,l as h,T as i,v as l,u as m,S as n,a as o,_ as p,b as r,s,y as t,m as u,g as v};
4//# sourceMappingURL=pushSubscription-vzO9AQ6U.js.map
5//# debugId=1ece3cfb-3553-5295-b40e-45ccdb30efbd

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.