1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,618566,(e,t,o)=>{t.exports=e.r(976562)},531278,e=>{"use strict";var t=e.i(717521);e.s(["Loader2",()=>t.default])},810980,e=>{"use strict";let t=(0,e.i(475254).default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",()=>t],810980)},991799,e=>{"use strict";let t=(0,e.i(475254).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",()=>t],991799)},16862,e=>{"use strict";var t=e.i(271645),o=e.i(920755);function r(){let[e,r]=(0,t.useState)(null),[n,a]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{let e=(0,o.createClient)();(async()=>{if(navigator.onLine){let{data:{user:t}}=await e.auth.getUser();r(t)}else{let{data:{session:t}}=await e.auth.getSession();r(t?.user??null)}a(!1)})();let{data:{subscription:t}}=e.auth.onAuthStateChange((e,t)=>{r(t?.user??null)});return()=>{t.unsubscribe()}},[]),{user:e,isLoading:n}}e.s(["useAuthUser",()=>r])},245077,e=>{"use strict";var t=e.i(271645),o=e.i(672464),r=e.i(786681),n=e.i(695557),a=e.i(930571);function i(){let[e,i]=(0,o.useAtom)(r.extensionAvailableAtom),[,s]=(0,o.useAtom)(r.desktopAppAtom);return(0,t.useEffect)(()=>{(0,a.isDesktopApp)()&&(s(!0),console.log("[Extension] Running in desktop app â IPC bridge active"));let e=(0,n.getExtensionAvailability)();i(e),e?console.log("[Extension] Browser extension detected and available"):console.log("[Extension] Browser extension not detected - using server proxy");let t=()=>{(0,n.resetExtensionCache)(),i(!0),console.log("[Extension] Browser extension detected! (via event)")};return document.addEventListener("bab-extension-available",t),()=>document.removeEventListener("bab-extension-available",t)},[i]),e}function s(){return(0,o.useAtomValue)(r.extensionAvailableAtom)}
1function l(){return(0,o.useAtomValue)(r.desktopAppAtom)}e.s(["useExtensionAvailable",()=>s,"useExtensionDetection",()=>i,"useIsDesktopApp",()=>l])},786681,e=>{"use strict";var t=e.i(639372),o=e.i(265172);let r=(0,o.createJSONStorage)(()=>localStorage),n=(0,o.atomWithStorage)("extension-available",!1,r),a=(0,t.atom)(!1),i=(0,t.atom)(!1),s=(0,t.atom)([]),l=(0,o.atomWithStorage)("extension-enabled",!0),c=(0,o.atomWithStorage)("auto-save-offline",!1);(0,t.atom)(e=>{let t=e(n),o=e(l);return t&&o});let u=(0,o.atomWithStorage)("extension-stats",{feedsFetchedViaExtension:0,feedsFetchedViaProxy:0,textExtractionsViaExtension:0,textExtractionsViaProxy:0}),d=(0,t.atom)(null),g=(0,t.atom)(e=>null!==e(d),(e,t,o)=>{o||t(d,null)});e.s(["autoSaveOfflineAtom",0,c,"desktopAppAtom",0,a,"extensionAvailableAtom",0,n,"extensionPromptDataAtom",0,d,"extensionPromptOpenAtom",0,g,"extensionQueueModalOpenAtom",0,i,"extensionStatsAtom",0,u,"pendingExtensionSubscriptionsAtom",0,s])},695557,e=>{"use strict";var t=e.i(611573);let o=null;function r(){return null===o&&(o=!0===window.__BLOGS_ARE_BACK_EXTENSION__)&&console.log("[Extension Bridge] Browser extension detected"),o}function n(){o=null}function a(){return window.__BLOGS_ARE_BACK_EXTENSION_VERSION__||null}function i(e){let t=a();return!!t&&function(e,t){let o=e.split(".").map(Number),r=t.split(".").map(Number);for(let e=0;e<Math.max(o.length,r.length);e++){let t=o[e]||0,n=r[e]||0;if(t<n)return -1;if(t>n)return 1}return 0}(t,e)>=0}let s={DISCOVER_IMAGES:"1.8.0",BATCH_FEED_FETCH:"1.9.0",BATCH_IMAGE_DISCOVERY:"1.9.0",ACKNOWLEDGE_UPDATES:"1.9.1",SAVE_POST_OFFLINE:"2.0.0",GET_ALL_SAVED_POST_GUIDS:"2.1.0",SAVE_ARTICLE:"2.2.0",SAVE_BY_URL:"2.3.0",GET_SAVED_POSTS_INDEX:"2.3.0",GET_SAVED_POST_CONTENT:"2.3.0"};function l(e,t,o=35e3){return window.__BLOGS_ARE_BACK_DESKTOP__&&window.electronBridge?window.electronBridge.invoke(e.type,e).then(e=>{if(e.success)return e;throw new c(e.error||"IPC error",e.status)}):new Promise((r,n)=>{let a=e.requestId,i=e=>{e.origin===window.location.origin&&e.data.type===t&&e.data.requestId===a&&(window.removeEventListener("message",i),clearTimeout(s),e.data.success?r(e.data):n(new c(e.data.error||"Unknown extension error",e.data.status)))};window.addEventListener("message",i);let s=setTimeout(()=>{window.removeEventListener("message",i),n(new c(`Extension request timeout after ${o}ms`,void 0))},o);try{window.postMessage(e,window.location.origin)}catch(e){window.removeEventListener("message",i),clearTimeout(s),n(new c(`Failed to send message to extension: ${e instanceof Error?e.message:"Unknown error"}`,void 0))}})}class c extends Error{httpStatus;constructor(e,t){super(e),this.name="ExtensionError",this.httpStatus=t}}async function u(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID(),o=await l({type:"FETCH_FEED",feedUrl:e,requestId:t},"FEED_RESPONSE");if(!o.data)throw new c("Extension returned no data",o.status);
1return{data:o.data,fromCache:o._offline,cachedAt:o._cachedAt}}async function d(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID(),o=await l({type:"FETCH_PAGE",url:e,requestId:t},"PAGE_RESPONSE");if(!o.data)throw new c("Extension returned no data",o.status);return o.data}async function g(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID(),o=await l({type:"EXTRACT_READABLE_TEXT",url:e,requestId:t},"READABLE_TEXT_RESPONSE");if(!o.data)throw new c("Extension returned no data",o.status);return o.data}async function m(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID(),o=await l({type:"EXTRACT_READABLE_HTML",url:e,requestId:t},"READABLE_HTML_RESPONSE");if(!o.data)throw new c("Extension returned no data",o.status);return o.data}function h(e,t,o,n,a){if(r())try{let r=localStorage.getItem("last-cloud-user-id")||void 0,i=o.map(e=>({feedUrl:e.feedUrl,title:e.title,lastPostDate:e.lastPostDate?.getTime()??null})),s={type:"SYNC_ALL_BLOGS",directoryBlogs:e,communityBlogs:t,customBlogs:i,followedFeedUrls:n,lastVisit:a?.getTime()??null,userId:r};window.postMessage(s,window.location.origin),console.log("[Extension Bridge] Synced all blogs:",e.length,"directory,",t.length,"community,",o.length,"custom,",n.length,"feed URLs")}catch(e){console.log("[Extension Bridge] Failed to sync all blogs:",e)}}function f(e){return e instanceof c}function E(){return r()}function y(e,t,o=35e3){return window.__BLOGS_ARE_BACK_DESKTOP__&&window.electronBridge?window.electronBridge.invoke(e.type,e).then(e=>{if(e.success)return e;throw new c(e.error||"IPC error",e.status)}):new Promise((r,n)=>{let a=e.requestId,i=e=>{e.origin===window.location.origin&&e.data.type===t&&e.data.requestId===a&&(window.removeEventListener("message",i),clearTimeout(s),e.data.success?r(e.data):n(new c(e.data.error||"Unknown extension error",e.data.status)))};window.addEventListener("message",i);let s=setTimeout(()=>{window.removeEventListener("message",i),n(new c(`Extension request timeout after ${o}ms`,void 0))},o);try{window.postMessage(e,window.location.origin)}catch(e){window.removeEventListener("message",i),clearTimeout(s),n(new c(`Failed to send message to extension: ${e instanceof Error?e.message:"Unknown error"}`,void 0))}})}async function p(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID();return(await y({type:"DISCOVER_FEEDS",blogUrl:e,requestId:t},"DISCOVER_FEEDS_RESPONSE",45e3)).feeds||[]}async function w(e){if(!r())throw new c("Extension not installed");let t=crypto.randomUUID(),o=await y({type:"TEST_BLOG_STATUS",feedUrl:e,requestId:t},"TEST_BLOG_STATUS_RESPONSE",6e4);if(!o.result)throw new c("Extension returned no test results");return o.result}async function S(e){if(!r())throw new c("Extension not installed");if(!i(s.DISCOVER_IMAGES)){let e=a();return console.log(`[Extension Bridge] Image discovery requires extension v${s.DISCOVER_IMAGES}+, current version: ${e||"unknown"}. Skipping.`),{}}let t=crypto.randomUUID();return(await y({type:"DISCOVER_IMAGES",blogUrl:e,requestId:t},"DISCOVER_IMAGES_RESPONSE",3e4)).images||{}}async function b(e,t){if(!r())throw new c("Extension not installed");if(!i(s.BATCH_IMAGE_DISCOVERY)){let t=a();console.log(`[Extension Bridge] Batch image discovery requires extension v${s.BATCH_IMAGE_DISCOVERY}+, current version: ${t||"unknown"}. Falling back to sequential discovery.`);let o=[],r=0,n=0;for(let t of e)try{let e=await S(t);o.push({blogUrl:t,success:!0,images:e}),r++}catch(e){o.push({blogUrl:t,success:!1,error:e instanceof Error?e.message:"Unknown error"}),n++}return{results:o,totalProcessed:e.length,successCount:r,errorCount:n}}if(0===e.length)return{results:[],totalProcessed:0,successCount:0,errorCount:0};let o=crypto.randomUUID(),n=Math.min(3e4+1e4*e.length,3e5),l=await y({type:"DISCOVER_IMAGES_BATCH",blogUrls:e,requestId:o,maxConcurrent:t},"DISCOVER_IMAGES_BATCH_RESPONSE",n);return{results:l.results,totalProcessed:l.totalProcessed,successCount:l.successCount,errorCount:l.errorCount}}async function A(){if(!r())throw new c("Extension not installed");let e=crypto.randomUUID();try{return(await y({type:"GET_ANALYTICS",requestId:e},"ANALYTICS_RESPONSE",5e3)).data||null}catch(e){if(e instanceof c&&e.message.includes("timeout"))return console.log("[Extension Bridge] Extension does not support GET_ANALYTICS (older version)"),null;throw e}}async function v(e){if(!r())throw new c("Extension not installed");if(!i(s.ACKNOWLEDGE_UPDATES))return console.log("[Extension Bridge] Extension ver
1sion does not support ACKNOWLEDGE_UPDATES (requires 1.9.1+)"),null;let t=crypto.randomUUID();try{let o=await y({type:"ACKNOWLEDGE_UPDATES",requestId:t,sources:e},"ACKNOWLEDGE_UPDATES_RESPONSE",5e3);return{success:o.success,acknowledgedCount:o.acknowledgedCount??0}}catch(e){if(e instanceof c&&e.message.includes("timeout"))return console.log("[Extension Bridge] ACKNOWLEDGE_UPDATES timed out unexpectedly"),null;throw e}}async function _(e,o){if(!r())return{success:!1,error:"Extension not installed"};if(!i(s.SAVE_POST_OFFLINE))return{success:!1,error:"Extension version does not support offline saving"};let n=("content"in e?e.content:void 0)||(e.guidHash?await (0,t.getPostContent)(e.guidHash):null),a=crypto.randomUUID(),l={guid:e.guid||e.link,link:e.link,title:e.title,author:e.author,pubDate:e.pubDate?new Date(e.pubDate).getTime():null,description:e.description,image:e.image,blogId:e.blogId,blogTitle:e.blogTitle,blogIcon:e.blogIcon,blogFeedUrl:o,rssContent:n??void 0};try{let e=await y({type:"SAVE_POST_OFFLINE",requestId:a,post:l},"SAVE_POST_OFFLINE_RESPONSE",6e4);return{success:e.success,alreadySaved:e.alreadySaved}}catch(e){return{success:!1,error:e instanceof c?e.message:"Unknown error"}}}async function x(e){if(!r()||!i(s.SAVE_POST_OFFLINE))return!1;let t=crypto.randomUUID();try{return(await y({type:"DELETE_SAVED_POST",requestId:t,guid:e},"DELETE_SAVED_POST_RESPONSE",5e3)).success}catch{return!1}}async function C(e){if(!r()||!i(s.SAVE_POST_OFFLINE))return!1;let t=crypto.randomUUID();try{return(await y({type:"REEXTRACT_SAVED_POST",requestId:t,guid:e},"REEXTRACT_SAVED_POST_RESPONSE",6e4)).success}catch{return!1}}async function k(){if(!r()||!i(s.GET_ALL_SAVED_POST_GUIDS))return null;let e=crypto.randomUUID();try{return(await y({type:"GET_ALL_SAVED_POST_GUIDS",requestId:e},"ALL_SAVED_POST_GUIDS_RESPONSE",5e3)).guids}catch{return null}}async function T(e){if(!r())return{success:!1,error:"Extension not installed"};
1if(!i(s.SAVE_BY_URL))return{success:!1,error:"Extension version does not support save by URL"};let t=crypto.randomUUID();try{let o=await y({type:"SAVE_BY_URL",requestId:t,url:e},"SAVE_BY_URL_RESPONSE",6e4);return{success:o.success,post:o.post,error:o.error}}catch(e){return{success:!1,error:e instanceof c?e.message:"Unknown error"}}}async function B(){if(!r()||!window.__BLOGS_ARE_BACK_DESKTOP__&&!i(s.GET_SAVED_POSTS_INDEX))return null;let e=crypto.randomUUID();try{let t=await y({type:"GET_SAVED_POSTS_INDEX",requestId:e},"SAVED_POSTS_INDEX_RESPONSE",1e4);return t.posts??t.data??null}catch{return null}}async function D(e){if(!r()||!window.__BLOGS_ARE_BACK_DESKTOP__&&!i(s.GET_SAVED_POST_CONTENT))return null;let t=crypto.randomUUID();try{let o=await y({type:"GET_SAVED_POST_CONTENT",requestId:t,guid:e},"SAVED_POST_CONTENT_RESPONSE",1e4);return o.htmlContent??("string"==typeof o.data?o.data:null)}catch{return null}}e.s(["EXTENSION_FEATURE_VERSIONS",0,s,"acknowledgeUpdates",()=>v,"deleteSavedPostViaExtension",()=>x,"discoverFeedsViaExtension",()=>p,"discoverImagesBatchViaExtension",()=>b,"discoverImagesViaExtension",()=>S,"extensionSupportsFeature",()=>i,"extractHtmlViaExtension",()=>m,"extractTextViaExtension",()=>g,"fetchFeedViaExtension",()=>u,"fetchPageViaExtension",()=>d,"getAllSavedPostGuidsViaExtension",()=>k,"getExtensionAnalytics",()=>A,"getExtensionAvailability",()=>r,"getSavedPostContentViaExtension",()=>D,"getSavedPostsIndexViaExtension",()=>B,"isExtensionError",()=>f,"reextractSavedPostViaExtension",()=>C,"resetExtensionCache",()=>n,"saveByUrlViaExtension",()=>T,"savePostOfflineViaExtension",()=>_,"shouldUseExtension",()=>E,"syncAllBlogsToExtension",()=>h,"testBlogStatusViaExtension",()=>w])},930571,e=>{"use strict";function t(){return!0===window.__BLOGS_ARE_BACK_DESKTOP__}e.s(["isDesktopApp",()=>t])},70955,e=>{"use strict";var t=e.i(790224);async function o(e,o){try{return await e.getBlogs(o)}catch(e){return(0,t.logError)("Error fetching user blogs:",e,{userId:o}),[]}}async function r(e,o,r){try{let t=await e.addBlog(o,r);return{success:!0,data:t}}catch(e){return(0,t.logError)("Error adding blog:",e,{userId:o,feedUrl:r.feed_url}),{success:!1,error:e instanceof Error?e.message:"Failed to add blog",errorCode:e?.code}}}async function n(e,t,o,r="custom"){try{return await e.deleteBlog(t,o,r),{success:!0}}catch(e){return console.error("Error deleting blog:",e),{success:!1,error:e instanceof Error?e.message:"Failed to delete blog"}}}async function a(e,t,o,r,n="custom"){try{return await e.updateBlogTags(t,o,r,n),{success:!0}}catch(e){return console.error("Error updating blog tags:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update tags"}}}async function i(e,t,o,r=[],n){try{let a=await e.followDirectoryBlog(t,o,r,n);return{success:!0,data:a}}catch(e){return console.error("Error following directory blog:",e),{success:!1,error:e instanceof Error?e.message:"Failed to follow blog"}}}async function s(e,t,o){try{return await e.unfollowDirectoryBlog(t,o),{success:!0}}catch(e){return console.error("Error unfollowing directory blog:",e),{success:!1,error:e instanceof Error?e.message:"Failed to unfollow blog"}}}async function l(e,t,o,r=[],n){try{let a=await e.followCommunityBlog(t,o,r,n);return{success:!0,data:a}}catch(e){return console.error("Error following community blog:",e),{success:!1,error:e instanceof Error?e.message:"Failed to follow blog"}}}async function c(e,t,o){try{return await e.unfollowCommunityBlog(t,o),{success:!0}}catch(e){return console.error("Error unfollowing community blog:",e),{success:!1,error:e instanceof Error?e.message:"Failed to unfollow blog"}}}async function u(e,t,o,r,n){try{return await e.updateBlogStatusValues?.(t,o,r,n),{success:!0}}catch(e){return console.error("Error updating blog status values:",e),{success:!1,error:e instanceof Error?e.message:"Failed to update status values"}}}e.s(["addBlog",()=>r,"deleteBlog",()=>n,"followCommunityBlog",()=>l,"followDirectoryBlog",()=>i,"getAllBlogs",()=>o,"unfollowCommunityBlog",()=>c,"unfollowDirectoryBlog",()=>s,"updateBlogStatusValues",()=>u,"updateBlogTags",()=>a])},149012,e=>{"use strict";var t=e.i(610399);let o="content",r=null;async function n(){return r||(r=await (0,t.openDB)("blogs-are-back-content-cache",1,{upgrade(e){if(!e.objectStoreNames.contains(o)){let t=e.createObjectStore(o,{keyPath:"url"});t.createIndex("by-cachedAt","cachedAt"),t.createIndex("by-blogId","blogId")}}}))}function a(e){try{return JSON.stringify(e).length}catch{return 102400}}function i(e){return new Date().getTime()-e.getTime()<6048e5}async function s(){let e=await n(),t=await e.getAll(o);return{totalSize:t.reduce((e,t)=>
1e+a(t),0),entryCount:t.length,entries:t}}async function l(e=.2){let t=await n(),r=await t.getAll(o);if(0===r.length)return 0;let a=r.sort((e,t)=>new Date(e.cachedAt).getTime()-new Date(t.cachedAt).getTime()),i=Math.max(1,Math.floor(r.length*e)),s=a.slice(0,i);return await Promise.all(s.map(e=>t.delete(o,e.url))),console.log(`[ContentCache] Evicted ${s.length} oldest entries to free up space`),s.length}async function c(e){try{let t=await n(),r=await t.get(o,e);if(!r)return null;if(!i(new Date(r.cachedAt)))return await t.delete(o,e),console.log(`[ContentCache] Expired entry removed for: ${e}`),null;return console.log(`[ContentCache] Cache hit for: ${e} (source: ${r.source})`),r}catch(e){return console.error("[ContentCache] Error getting cached content:",e),null}}async function u(e,t,r,c){if(!t.htmlContent&&!t.textContent)return void console.warn("[ContentCache] No content to cache, skipping:",e);try{let u=await n(),d=await u.get(o,e),g=d&&i(new Date(d.cachedAt))?d:null,m={url:e,guid:c?.guid??g?.guid,htmlContent:t.htmlContent??g?.htmlContent,textContent:t.textContent??g?.textContent,title:t.title??g?.title,excerpt:t.excerpt??g?.excerpt,byline:t.byline??g?.byline,image:t.image??g?.image,length:t.length??g?.length,source:r,cachedAt:new Date,blogId:c?.blogId??g?.blogId},h=await s(),f=a(m);if(h.entryCount>=500||h.totalSize+f>0x3200000){let e=(h.totalSize/1024/1024).toFixed(2),t=(f/1024).toFixed(2);console.log(`[ContentCache] Limit approaching (${h.entryCount} entries, ${e}MB + ${t}KB). Evicting...`),await l()}await u.put(o,m);let E=g?"Updated":"Cached",y=m.htmlContent?"html":"",p=m.textContent?"text":"",w=[y,p].filter(Boolean).join("+");console.log(`[ContentCache] ${E} content for: ${e} (${w}, source: ${r}, size: ${(f/1024).toFixed(1)}KB)`)}catch(e){console.error("[ContentCache] Error caching content:",e)}}async function d(e){try{let t=(await n()).transaction(o,"readwrite"),r=t.store.index("by-blogId"),a=0,i=await r.openCursor(IDBKeyRange.only(e));for(;i;)await i.delete(),a++,i=await i.continue();return await t.done,a>0&&console.log(`[ContentCache] Deleted ${a} cached entries for blog: ${e}`),a}catch(e){return console.error("[ContentCache] Error deleting cached content for blog:",e),0}}e.s(["deleteCachedContentForBlog",()=>d,"getCachedContent",()=>c,"setCachedContent",()=>u])},839428,e=>{"use strict";var t=e.i(266027),o=e.i(954616),r=e.i(912598),n=e.i(846696),a=e.i(70955),i=e.i(568385),s=e.i(853419),l=e.i(149012),
1c=e.i(611573);function u(){let e=(0,i.useStorageContext)(),o=e?.adapter??null,r=e?.userId??null;return(0,t.useQuery)({queryKey:["blogs","followed",r],queryFn:async()=>await (0,a.getAllBlogs)(o,r),enabled:!!o&&!!r,networkMode:"always",staleTime:3e5,refetchOnWindowFocus:!0})}function d(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,u=e?.userId??null,d=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({blogId:e,source:o,feedUrl:r})=>{if(!t||!u)throw Error("Storage not initialized");let n=await (0,a.deleteBlog)(t,u,e,o||"custom");if(!n.success)throw Error(n.error||"Failed to remove blog");return{blogId:e,feedUrl:r}},onSuccess:(e,t)=>{(0,s.trackBlogUnfollowed)(t.source||"custom"),d.invalidateQueries({queryKey:["blogs","followed",u]}),d.invalidateQueries({queryKey:["timeline"]}),n.toast.success("Blog removed"),(0,l.deleteCachedContentForBlog)(e.blogId).catch(e=>console.warn("[useRemoveBlog] Failed to cleanup content cache:",e)),e.feedUrl&&(0,c.cleanupCacheForFeed)(e.feedUrl).catch(e=>console.warn("[useRemoveBlog] Failed to cleanup feed cache:",e))},onError:e=>{n.toast.error(`Failed to remove blog: ${e.message}`)}})}function g(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,l=e?.userId??null,c=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({directoryBlogId:e,tags:o,directoryBlogData:r})=>{if(!t||!l)throw Error("Storage not initialized");let n=await (0,a.followDirectoryBlog)(t,l,e,o||[],r);if(!n.success){if(n.error?.includes("already following"))throw Error("Already following this blog");if(n.error?.includes("Blog limit reached")||n.error?.includes("limit")){let e=Error("Blog limit reached");throw e.name="LimitError",e}throw Error(n.error||"Failed to follow blog")}return n.data},onSuccess:(e,t)=>{(0,s.trackDirectoryFollow)(t.directoryBlogId),c.invalidateQueries({queryKey:["blogs","followed",l]}),c.invalidateQueries({queryKey:["timeline"]}),c.invalidateQueries({queryKey:["user-blog-counts"]}),n.toast.success("Blog added to your timeline")},onError:e=>{e.message.includes("already following")?n.toast.error("You are already following this blog"):"LimitError"===e.name||e.message.includes("Blog limit reached")?n.toast.error("Blog limit reached",{description:"You have reached the maximum total number of blogs allowed. Delete some existing blogs to add more."}):n.toast.error(`Failed to follow blog: ${e.message}`)}})}function m(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,u=e?.userId??null,d=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({directoryBlogId:e,feedUrl:o})=>{if(!t||!u)throw Error("Storage not initialized");let r=await (0,a.unfollowDirectoryBlog)(t,u,e);if(!r.success)throw Error(r.error||"Failed to unfollow blog");return{directoryBlogId:e,feedUrl:o}},onSuccess:e=>{(0,s.trackBlogUnfollowed)("directory"),d.invalidateQueries({queryKey:["blogs","followed",u]}),d.invalidateQueries({queryKey:["timeline"]}),d.invalidateQueries({queryKey:["user-blog-counts"]}),n.toast.success("Blog removed from timeline"),(0,l.deleteCachedContentForBlog)(e.directoryBlogId).catch(e=>console.warn("[useUnfollowDirectoryBlog] Failed to cleanup content cache:",e)),e.feedUrl&&(0,c.cleanupCacheForFeed)(e.feedUrl).catch(e=>console.warn("[useUnfollowDirectoryBlog] Failed to cleanup feed cache:",e))},onError:e=>{n.toast.error(`Failed to unfollow blog: ${e.message}`)}})}function h(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,l=e?.userId??null,c=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({communityBlogId:e,tags:o,communityBlogData:r})=>{if(!t||!l)throw Error("Storage not initialized");let n=await (0,a.followCommunityBlog)(t,l,e,o||[],r);if(!n.success){if(n.error?.includes("already following"))throw Error("Already following this blog");if(n.error?.includes("Blog limit reached")||n.error?.includes("limit")){let e=Error("Blog limit reached");throw e.name="LimitError",e}throw Error(n.error||"Failed to follow blog")}return n.data},onSuccess:(e,t)=>{(0,s.trackCommunityFollow)(t.communityBlogId),c.invalidateQueries({queryKey:["blogs","followed",l]}),c.invalidateQueries({queryKey:["timeline"]}),c.invalidateQueries({queryKey:["user-blog-counts"]}),n.toast.success("Blog added to your timeline")},onError:e=>{e.message.includes("already following")?n.toast.error("You are already following this blog"):"LimitError"===e.name||e.message.includes("Blog limit reached")?n.toast.error("Blog limit reached",{description:"You have reached the maximum total number of blogs allowed. Delete some existing blogs to add more."}):n.toast.error(`Failed to follow blog: ${e.message}`)}})}function f(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,u=e?.userId??null,d=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({communityBlogId:e,feedUrl:o})=>{if(!t||!u)throw Error("Storage not initialized");let r=await (0,a.unfollowCommunityBlog)(t,u,e);if(!r.success)throw Error(r.error||"Failed to unfollow blog");return{communityBlogId:e,feedUrl:o}},onSuccess:e=>{(0,s.trackBlogUnfollowed)("community"),d.invalidateQueries({queryKey:["blogs","followed",u]}),d.invalidateQueries({queryKey:["timeline"]}),d.invalidateQueries({queryKey:["user-blog-counts"]}),n.toast.success("Blog removed from timeline"),(0,l.deleteCachedContentForBlog)(e.communityBlogId).catch(e=>console.warn("[useUnfollowCommunityBlog] Failed to cleanup content cache:",e)),e.feedUrl&&(0,c.cleanupCacheForFeed)(e.feedUrl).cat
1ch(e=>console.warn("[useUnfollowCommunityBlog] Failed to cleanup feed cache:",e))},onError:e=>{n.toast.error(`Failed to unfollow blog: ${e.message}`)}})}function E(){let e=(0,i.useStorageContext)(),t=e?.adapter??null,l=e?.userId??null,c=(0,r.useQueryClient)();return(0,o.useMutation)({mutationFn:async({blogId:e,tags:o,source:r})=>{if(!t||!l)throw Error("Storage not initialized");let n=await (0,a.updateBlogTags)(t,l,e,o,r||"custom");if(!n.success)throw Error(n.error||"Failed to update tags");return o.length},onSuccess:e=>{(0,s.trackBlogTagsUpdated)(e),c.invalidateQueries({queryKey:["blogs","followed",l]}),n.toast.success("Tags updated")},onError:e=>{n.toast.error(`Failed to update tags: ${e.message}`)}})}e.s(["useFollowCommunityBlog",()=>h,"useFollowDirectoryBlog",()=>g,"useFollowedBlogs",()=>u,"useRemoveBlog",()=>d,"useUnfollowCommunityBlog",()=>f,"useUnfollowDirectoryBlog",()=>m,"useUpdateBlogTags",()=>E])},151363,e=>{"use strict";var t=e.i(639372),o=e.i(979775);function r(e){return{proxyUrl:e.proxy_url,apiKey:e.api_key,isEnabled:e.is_enabled,mobileOnly:e.mobile_only,useForDirectoryBlogs:e.use_for_directory_blogs??!1,isValidated:e.is_validated,lastValidatedAt:e.validated_at,lastError:e.last_error,consecutiveFailures:e.consecutive_failures,capabilities:e.capabilities,provider:e.provider,version:e.version}}let n=(0,t.atom)(null),a=(0,o.atomWithDebouncedStorage)((0,o.getProjectSpecificKey)("custom-proxy-config-stored"),null,100),i=(0,t.atom)(!1),s=(0,t.atom)(!1),l=(0,t.atom)(e=>{let t=e(n),o=e(i);return!!t&&!!t.isValidated&&!!t.isEnabled&&(!t.mobileOnly||!!o)});(0,t.atom)(e=>{let t=e(l),o=e(n);return t&&o?o.proxyUrl:null}),(0,t.atom)(e=>{let t=e(l),o=e(n);return t&&o?o.apiKey:null});let c=(0,t.atom)(e=>{let t=e(l),o=e(n);return t&&o?o.capabilities:{fetch:!1,parse:!1}});(0,t.atom)(e=>e(c).parse),(0,t.atom)(e=>e(c).discover??!1);let u=(0,o.atomWithDebouncedStorage)((0,o.getProjectSpecificKey)("custom-proxy-debug-expanded"),!1,100);e.s(["activeProxyCapabilitiesAtom",0,c,"customProxyConfigAtom",0,n,"customProxyConfigStoredAtom",0,a,"customProxyDebugExpandedAtom",0,u,"customProxyLoadedAtom",0,s,"hasCustomProxyAtom",0,l,"isMobileDeviceAtom",0,i,"storageToUiConfig",()=>r])},585870,e=>{"use strict";let t="last_auth_method";function o(e){try{localStorage.setItem(t,e)}catch(e){console.warn("[Auth] Failed to save last auth method:",e)}}function r(){try{let e=localStorage.getItem(t);if(e&&["email","github","google","apple"].includes(e))return e;return null}catch(e){return console.warn("[Auth] Failed to read last auth method:",e),null}}e.s(["getLastAuthMethod",()=>r,"setLastAuthMethod",()=>o])},340842,e=>{"use strict";var t=e.i(639372);let o=(0,t.atom)(!1);o.debugLabel="swReady";let r=(0,t.atom)(!1);r.debugLabel="swError";let n=(0,t.atom)(!1);n.debugLabel="swDevMode";let a=(0,t.atom)(!1);a.debugLabel="swUpdating";let i=(0,t.atom)(!1);i.debugLabel="modalChunksReady";let s=(0,t.atom)(!1);s.debugLabel="layoutChunksReady";let l=(0,t.atom)(!1);l.debugLabel="settingsChunksReady";let c=(0,t.atom)(!1);c.debugLabel="readerAssetsReady";let u=(0,t.atom)(e=>{let t=e(o),n=e(r),a=e(i),u=e(s),d=e(l);return{"service-worker":n?"error":t?"ready":"pending","app-shell":a&&u&&d?"ready":"pending","reader-assets":e(c)?"ready":"pending"}});u.debugLabel="offlineReadiness";let d=(0,t.atom)(null);d.debugLabel="cacheValidation";let g=(0,t.atom)(e=>{let t=e(u);return"ready"===t["service-worker"]&&"ready"===t["app-shell"]&&"ready"===t["reader-assets"]});g.debugLabel="offlineReady",e.s(["cacheValidationAtom",0,d,"layoutChunksReadyAtom",0,s,"modalChunksReadyAtom",0,i,"offlineReadinessAtom",0,u,"offlineReadyAtom",0,g,"readerAssetsReadyAtom",0,c,"settingsChunksReadyAtom",0,l,"swDevModeAtom",0,n,"swErrorAtom",0,r,"swReadyAtom",0,o,"swUpdatingAtom",0,a])},514690,e=>{"use strict";let t=[{id:"default",name:"Default",description:"Clean neutral theme with balanced contrast",mode:"both",preview:{primary:"oklch(0.205 0 0)",background:"oklch(1 0 0)",accent:"oklch(0.97 0 0)"}},{id:"nord",name:"Nord",description:"Cool minimal theme with blue-gray tones",mode:"both",preview:{primary:"oklch(0.72 0.07 220.70)",background:"oklch(0.25 0.02 221.57)",accent:"oklch(0.60 0.08 235.38)"}},{id:"candyland",name:"Candyland",description:"Playful theme with vibrant pinks and purples",mode:"both",expanded:!0,preview:{primary:"oklch(0.87 0.07 7.11)",background:"oklch(0.98 0 228.42)",accent:"oklch(0.97 0.21 109.76)"}},{id:"catppuccin",name:"Catppuccin",description:"Soothing pastel theme with lavender and purple tones",mode:"both",expanded:!0,preview:{primary:"oklch(0.5547 0.2503 297.0156)",background:"oklch(0.9578 0.0058 264.5321)",accent:"oklch(0.682 0.1448 235.3822)"}},{id:"neon-dusk",name:"Neon Dusk",description:"Warm retro theme with hot pink and teal accents",mode:"both",preview:{primary:"oklch(0.63 0.22 353)",background:"oklch(0.27 0.005 68)",accent:"oklch(0.62 0.08 216)"}},{id:"warm-tide",name:"Warm Tide",description:"Cozy retro theme with calming ocean teal tones highlights",mode:"both",preview:{primary:"oklch(0.62 0.08 216)",background:"oklch(0.27 0.005 68)",accent:"oklch(0.960 0.040 83.138)"}},{id:"warm-tide-pink",name:"Warm Tide Duo",description:"Blended retro theme with teal tones and hot pink accents",mode:"both",expanded:!0,preview:{primary:"oklch(0.62 0.08 216)",background:"oklch(0.27 0.005 68)",accent:"oklch(0.63 0.22 353)"}}
1,{id:"claude",name:"Claude",description:"Warm, friendly theme inspired by Claude AI",author:"Claude",mode:"better-dark",expanded:!0,preview:{primary:"oklch(0.62 0.14 39.04)",background:"oklch(0.98 0.01 95.1)",accent:"oklch(0.92 0.01 92.99)"}},{id:"tangerine",name:"Tangerine",description:"Fresh and energetic theme with vibrant orange accents",mode:"better-dark",preview:{primary:"oklch(0.6397 0.172 36.4421)",background:"oklch(0.264 0.0305 262.68)",accent:"oklch(0.9119 0.0222 243.8174)"}},{id:"tokyo-night",name:"Tokyo Night",description:"Vibrant dark theme with blue and purple hues",mode:"better-dark",expanded:!0,preview:{primary:"oklch(0.65 0.15 254.62)",background:"oklch(0.20 0.03 250.00)",accent:"oklch(0.70 0.13 204.09)"}},{id:"one-dark",name:"One Dark",description:"Atom's popular dark theme with balanced colors",mode:"better-dark",expanded:!0,preview:{primary:"oklch(0.64 0.15 237.64)",background:"oklch(0.22 0.02 220.70)",accent:"oklch(0.67 0.11 204.09)"}},{id:"dracula",name:"Dracula",description:"Dark theme with vibrant purple and pink accents",mode:"better-dark",preview:{primary:"oklch(0.70 0.17 297.02)",background:"oklch(0.22 0.02 285.89)",accent:"oklch(0.80 0.15 193.24)"}},{id:"cupcake",name:"Cupcake",description:"Sweet pastel theme with teal and pink accents",mode:"light",preview:{primary:"oklch(85% 0.138 181.071)",background:"oklch(97.788% 0.004 56.375)",accent:"oklch(89% 0.061 343.231)"}},{id:"silk",name:"Silk",description:"Elegant minimal theme with lime green accents",mode:"light",preview:{primary:"oklch(23.27% 0.0249 284.3)",background:"oklch(97% 0.0035 67.78)",accent:"oklch(94.22% 0.2505 117.44)"}},{id:"sunset",name:"Sunset",description:"Warm dark theme with orange and purple accents",mode:"dark",preview:{primary:"oklch(74.703% 0.158 39.947)",background:"oklch(22% 0.019 237.69)",accent:"oklch(71.294% 0.166 299.844)"}},{id:"dim",name:"Dim",description:"Muted dark theme with lime green highlights",mode:"dark",preview:{primary:"oklch(86.133% 0.141 139.549)",background:"oklch(30.857% 0.023 264.149)",accent:"oklch(74.229% 0.133 311.379)"}}];function o(e){return t.find(t=>t.id===e)}function r(){return t[0]}function n(e){return t.some(t=>t.id===e)}function a(e,t){return"both"===e.mode||"better-light"===e.mode||"better-dark"===e.mode||(t?"dark"===e.mode:"light"===e.mode)}function i(){return{both:t.filter(e=>"both"===e.mode),"better-dark":t.filter(e=>"better-dark"===e.mode),dark:t.filter(e=>"dark"===e.mode),"better-light":t.filter(e=>"better-light"===e.mode),light:t.filter(e=>"light"===e.mode)}}function s(e){return e?["both","better-dark","dark","better-light","light"]:["both","better-light","light","better-dark","dark"]}e.s(["AVAILABLE_THEMES",0,t,"THEME_MODE_LABELS",0,{both:"All Modes","better-dark":"Better in Dark Mode",dark:"Dark Mode Only","better-light":"Better in Light Mode",light:"Light Mode Only"},"getDefaultTheme",()=>r,"getThemeById",()=>o,"getThemeModeOrder",()=>s,"getThemesGroupedByMode",()=>i,"isThemeCompatibleWithMode",()=>a,"isValidThemeId",()=>n])},686964,e=>{"use strict";var t=e.i(271645),o=e.i(585870),r=e.i(618566);let n=["email","github","google","apple"];function a(){return!function(){let e=(0,r.useRouter)(),a=(0,r.usePathname)(),i=(0,r.useSearchParams)(),[s,l]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(s)return;let t=i.get("login_method");if(t&&n.includes(t)){(0,o.setLastAuthMethod)(t);let r=new URLSearchParams(i.toString());r.delete("login_method");let n=r.toString()?`?${r.toString()}`:"";e.replace(`${a}${n}`,{scroll:!1}),l(!0)}},[i,a,e,s])}(),null}e.s(["LoginMethodTracker",()=>a],686964)},317304,e=>{"use strict";var t=e.i(843476),o=e.i(245077),r=e.i(271645),n=e.i(672464),a=e.i(839428),i=e.i(786681),s=e.i(16862);e.i(247167);var l=e.i(695557);function c({children:e}){return(0,o.useExtensionDetection)(),!function({disabled:e=!1}={}){let{data:t=[],isSuccess:o}=(0,a.useFollowedBlogs)(),s=(0,n.useSetAtom)(i.extensionQueueModalOpenAtom),l=(0,n.useSetAtom)(i.pendingExtensionSubscriptionsAtom),c=(0,r.useRef)(!1),u=(0,r.useRef)(t);u.current=t;let d=(0,r.useRef)([]),g=(0,r.useCallback)(e=>{let t=e.toLowerCase().replace(/\/$/,"");for(let e of u.current){let o=e.feed_url?.toLowerCase().replace(/\/$/,""),r=e.url?.toLowerCase().replace(/\/$/,"");if(o===t||r===t)return{isDuplicate:!0,existingBlogTitle:e.title}}return{isDuplicate:!1}},[]),m=(0,r.useCallback)(async e=>{if(0===e.length)return new Map;try{let t=await fetch("/api/extension/check-catalog-matches",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscriptions:e.map(e=>({feedUrl:e.feedUrl,pageUrl:e.pageUrl,feedTitle:e.feedTitle}))})});if(!t.ok)return console.error("[Extension Queue] Catalog match API failed:",t.status),new Map;let o=await t.json(),r=new Map;for(let e of o.matches||[])r.set(e.subscription.feedUrl,{catalogType:e.catalogBlog.catalogType,blogId:e.catalogBlog.id,title:e.catalogBlog.title,url:e.catalogBlog.url,feed_url:e.catalogBlog.feed_url,site_icon:e.catalogBlog.site_icon||void 0,description:e.catalogBlog.description||void 0,follower_count:e.catalogBlog.follower_count,category:e.catalogBlog.category||void 0,has_full_content:e.catalogBlog.has_full_content||void 0,languages:e.catalogBlog.languages||void 0,matchType:e.matchType});return r}catch(e){return console.error("[Extension Queue] Failed to check catalog matches:",e),new Map}},[]),h=(0,r.useCallback)(async e=>{if(c.current)return void console.log("[Extension Queue] Already processing, skipping");
1c.current=!0,console.log(`[Extension Queue] Processing ${e.length} subscription(s)`);let t=e.map(e=>{let{isDuplicate:t,existingBlogTitle:o}=g(e.feedUrl);return{...e,isDuplicate:t,existingBlogTitle:o}}),o=t.filter(e=>!e.isDuplicate),r=await m(o.map(e=>({feedUrl:e.feedUrl,pageUrl:e.pageUrl,feedTitle:e.feedTitle,queuedAt:e.queuedAt})));l(t.map(e=>{let t=r.get(e.feedUrl);return{...e,catalogMatch:t,useCatalogVersion:!!t||void 0}})),s(!0),c.current=!1},[g,m,l,s]),f=(0,r.useCallback)(e=>{let t=new Set;return e.filter(e=>{let o=e.feedUrl.toLowerCase().replace(/\/$/,"");return!t.has(o)&&(t.add(o),!0)})},[]),E=(0,r.useCallback)(e=>{if(!o){let t=new Set(d.current.map(e=>e.feedUrl.toLowerCase().replace(/\/$/,""))),o=e.filter(e=>!t.has(e.feedUrl.toLowerCase().replace(/\/$/,"")));o.length>0&&(console.log(`[Extension Queue] Blogs not loaded yet, queuing ${o.length} subscription(s) (${e.length-o.length} duplicates skipped)`),d.current=[...d.current,...o]);return}h(f(e))},[o,h,f]);(0,r.useEffect)(()=>{if(o&&d.current.length>0){console.log(`[Extension Queue] Blogs loaded, processing ${d.current.length} queued subscription(s)`);let e=d.current;d.current=[],h(e)}},[o,h]);let y=e=>"object"!=typeof e||null===e||"SUBSCRIBE_TO_FEED"!==e.type?null:Array.isArray(e.subscriptions)&&0!==e.subscriptions.length?e.subscriptions:(console.warn("[Extension Queue] Received empty subscriptions array"),null);(0,r.useEffect)(()=>{if(e)return;console.log("[Extension Queue] Setting up subscription queue listeners");let t=e=>{console.log("[Extension Queue] Received CustomEvent from extension");let t=y(e.detail);t&&E(t)},o=e=>{if(e.origin!==window.location.origin||e.data?.type!=="SUBSCRIBE_TO_FEED")return;console.log("[Extension Queue] Received postMessage from extension");let t=y(e.data);t&&E(t)};return document.addEventListener("bab-extension-subscriptions",t),window.addEventListener("message",o),console.log("[Extension Queue] Requesting subscriptions from extension"),document.dispatchEvent(new CustomEvent("bab-request-subscriptions")),()=>{document.removeEventListener("bab-extension-subscriptions",t),window.removeEventListener("message",o)}},[E,e])}({disabled:(0,o.useIsDesktopApp)()}),!function(){let{user:e}=(0,s.useAuthUser)(),t=(0,n.useAtomValue)(i.extensionAvailableAtom),o=(0,n.useAtomValue)(i.extensionStatsAtom),a=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(a.current||!e)return;let r=o.feedsFetchedViaExtension>0||o.textExtractionsViaExtension>0;if(!t&&!r)return;let n="analytics-beacon-last-sent",i=sessionStorage.getItem(n),s=new Date().toDateString();if(i===s){a.current=!0;return}let l=setTimeout(async()=>{if(navigator.onLine)try{(await fetch("/api/analytics/extension-beacon",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedFetches:o.feedsFetchedViaExtension,textExtractions:o.textExtractionsViaExtension,browser:function(){if("u"<typeof navigator)return"other";let e=navigator.userAgent.toLowerCase();return e.includes("edg/")?"edge":e.includes("chrome")&&!e.includes("edg/")?"chrome":e.includes("firefox")?"firefox":e.includes("safari")&&!e.includes("chrome")?"safari":"other"}()})})).ok&&(sessionStorage.setItem(n,s),a.current=!0)}catch(e){console.debug("Analytics beacon failed:",e)}},2e3);return()=>clearTimeout(l)},[e,t,o])}(),!function(){let{user:e}=(0,s.useAuthUser)(),t=(0,n.useAtomValue)(i.extensionAvailableAtom),o=(0,r.useRef)(null),a=(0,r.useRef)(!1),c=(0,r.useCallback)(async()=>{if(!1!==o.current)try{let e=await (0,l.getExtensionAnalytics)();if(!e){console.debug("[Analytics Sync] Extension does not support rich analytics"),o.current=!1;return}if(o.current=!0,!navigator.onLine)return;(await fetch("/api/analytics/extension-analytics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,browser:function(){if("u"<typeof navigator)return"other";let e=navigator.userAgent.toLowerCase();return e.includes("edg/")?"edge":e.includes("chrome")&&!e.includes("edg/")?"chrome":e.includes("firefox")?"firefox":e.includes("safari")&&!e.includes("chrome")?"safari":"other"}()})})).ok&&console.debug("[Analytics Sync] Extension analytics synced successfully")}catch(e){console.debug("[Analytics Sync] Failed to sync extension analytics:",e)}},[]);(0,r.useEffect)(()=>
1{if(a.current||!e||!t)return;a.current=!0;let o=setTimeout(c,3e3);return()=>clearTimeout(o)},[e,t,c]),(0,r.useEffect)(()=>{},[c]),(0,r.useEffect)(()=>{let r;if(!e||!t)return;let n=()=>{let e,t,a,i;r=setTimeout(()=>{!1!==o.current&&c(),n()},(t=(e=new Date).getMinutes(),a=e.getSeconds(),i=e.getMilliseconds(),60*((15*Math.ceil((t+1)/15)-t+60)%60||15)*1e3-1e3*a-i))};return n(),()=>clearTimeout(r)},[e,t,c])}(),(0,t.jsx)(t.Fragment,{children:e})}e.s(["ExtensionProvider",()=>c],317304)},998328,e=>{"use strict";var t=e.i(843476),o=e.i(271645),r=e.i(672464),n=e.i(151363),a=e.i(568385),i=e.i(105069);function s({children:e}){let s=(0,i.default)(),l=(0,r.useSetAtom)(n.customProxyConfigAtom),c=(0,r.useSetAtom)(n.customProxyConfigStoredAtom),u=(0,r.useSetAtom)(n.customProxyLoadedAtom),d=(0,r.useSetAtom)(n.isMobileDeviceAtom),g=(0,r.useAtomValue)(n.customProxyLoadedAtom),m=(0,o.useRef)(!1),h=(0,o.useRef)(!1),f=(0,a.useStorageContext)(),E=f?.adapter??null,y=f?.userId??null,p=!f?.isLoading&&null!==E&&null!==y;return(0,o.useEffect)(()=>{d(s)},[s,d]),(0,o.useEffect)(()=>{!async function(){if(p&&E&&y&&!g&&!h.current&&!m.current){m.current=!0;try{console.log("[CustomProxyLoader] Loading proxy config...");let e=await E.getCustomProxyConfig(y);if(e){let t=(0,n.storageToUiConfig)(e);l(t),c(t),console.log("[CustomProxyLoader] Proxy config loaded:",{url:t.proxyUrl,isEnabled:t.isEnabled,isValidated:t.isValidated})}else l(null),c(null),console.log("[CustomProxyLoader] No proxy config found");h.current=!0}catch(e){console.error("[CustomProxyLoader] Failed to load config:",e),l(null),c(null),h.current=!0}finally{u(!0),m.current=!1}}}()},[p,E,y,g,l,u,c]),(0,t.jsx)(t.Fragment,{children:e})}e.s(["CustomProxyLoader",()=>s])},395642,e=>{"use strict";var t=e.i(672464),o=e.i(271645),r=e.i(363178),n=e.i(584540),a=e.i(514690);function i(){let[e,i]=(0,t.useAtom)(n.themeIdAtom),{resolvedTheme:s}=(0,r.useTheme)(),l="dark"===s;return(0,o.useEffect)(()=>{let e=localStorage.getItem("blogs-are-back-theme");e&&(0,a.isValidThemeId)(e)&&i(e)},[i]),(0,o.useEffect)(()=>{if(localStorage.setItem("blogs-are-back-theme",e),"default"===e){let e=document.getElementById("theme-css");e&&e.remove();return}let t=(0,a.getThemeById)(e);if(!t||!(0,a.isThemeCompatibleWithMode)(t,l)){let e=document.getElementById("theme-css");e&&e.remove();return}let o=`/styles/themes/${e}.css`,r=document.getElementById("theme-css");r?r.href=o:((r=document.createElement("link")).id="theme-css",r.rel="stylesheet",r.href=o,document.head.appendChild(r))},[e,l]),null}e.s(["ThemeLoader",()=>i])},772285,e=>{"use strict";var t=e.i(271645),o=e.i(672464),r=e.i(340842);function n(){let e=(0,o.useSetAtom)(r.swReadyAtom),n=(0,o.useSetAtom)(r.swErrorAtom),a=(0,o.useSetAtom)(r.swDevModeAtom),i=(0,o.useSetAtom)(r.swUpdatingAtom);return(0,t.useEffect)(()=>{if(!("serviceWorker"in navigator))return;navigator.serviceWorker.controller&&e(!0);let t=e=>{e.data?.type==="SYNC_QUEUE_FLUSH"&&window.dispatchEvent(new CustomEvent("sw-sync-flush"))};navigator.serviceWorker.addEventListener("message",t);let o=()=>{navigator.serviceWorker.ready.then(()=>{e(!0)}),navigator.serviceWorker.register("/serwist/sw.js",{scope:"/",type:"module"}).then(t=>{console.log("[SW] registered, scope:",t.scope),t.addEventListener("updatefound",()=>{let e=t.installing;e&&(i(!0),console.log("[SW] new version installing..."),e.addEventListener("statechange",()=>{("activated"===e.state||"redundant"===e.state)&&(i(!1),"activated"===e.state&&console.log("[SW] new version activated"))}))}),navigator.serviceWorker.controller&&e(!0)}).catch(e=>{console.error("[SW] registration failed:",e),n(!0)})};return"complete"===document.readyState?o():window.addEventListener("load",o,{once:!0}),()=>{window.removeEventListener("load",o),navigator.serviceWorker.removeEventListener("message",t)}},[e,n,a,i]),null}e.s(["ServiceWorkerRegistration",()=>n])},438079,e=>{e.v(e=>Promise.resolve().then(()=>e(483476)))}]);
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.