feedkeeper 0.28.6 → 0.28.8
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.
- package/package.json +1 -1
- package/server/dist/feeds/archive.js +18 -5
- package/server/dist/feeds/contentNoise.js +23 -4
- package/server/dist/feeds/heroImage.js +30 -1
- package/server/dist/feeds/imageTypes.js +9 -0
- package/server/package.json +1 -1
- package/web/dist/assets/{index-BW3PMJVN.js → index-CyPm9mJM.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/sw.js +8 -3
package/package.json
CHANGED
|
@@ -9,8 +9,9 @@ import { loadFullText } from "./fullText.js";
|
|
|
9
9
|
import { canAccessItem, findItemById, findItemForUser } from "./repository.js";
|
|
10
10
|
import { decodeEntities } from "./text.js";
|
|
11
11
|
import { ImageCache, ImageCacheBusyError } from "./imageCache.js";
|
|
12
|
-
import { detectImageType } from "./imageTypes.js";
|
|
12
|
+
import { detectImageType, isVectorImageUrl } from "./imageTypes.js";
|
|
13
13
|
export { detectImageType } from "./imageTypes.js";
|
|
14
|
+
import { comparableImageKey } from "./heroImage.js";
|
|
14
15
|
const MAX_IMAGES_PER_ARTICLE = 30;
|
|
15
16
|
const MAX_IMAGE_BYTES = 5 * 1024 * 1024;
|
|
16
17
|
const FILE_NAME = /^\d+-[0-9a-f]{16}\.(jpg|png|webp|gif|avif)$/;
|
|
@@ -289,11 +290,23 @@ export function withArchivedImages(items, origin, apiBase = "/api", withContent
|
|
|
289
290
|
if (!images)
|
|
290
291
|
return item;
|
|
291
292
|
const hero = item.image_url ? resolveImageUrl(item.image_url, item.link) : null;
|
|
293
|
+
const heroId = hero ? images.get(hero) : undefined;
|
|
294
|
+
let effectiveImages = images;
|
|
295
|
+
if (hero && heroId !== undefined) {
|
|
296
|
+
const heroKey = comparableImageKey(hero);
|
|
297
|
+
if (heroKey) {
|
|
298
|
+
effectiveImages = new Map(images);
|
|
299
|
+
for (const [url] of images) {
|
|
300
|
+
if (comparableImageKey(url) === heroKey)
|
|
301
|
+
effectiveImages.set(url, heroId);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
292
305
|
return {
|
|
293
306
|
...item,
|
|
294
|
-
image_url:
|
|
295
|
-
content_html: withContent && item.content_html ? rewriteArchivedImages(item.content_html, item.link,
|
|
296
|
-
full_content_html: withContent && item.full_content_html ? rewriteArchivedImages(item.full_content_html, item.link,
|
|
307
|
+
image_url: heroId !== undefined ? archivedImageUrl(origin, heroId, apiBase) : item.image_url,
|
|
308
|
+
content_html: withContent && item.content_html ? rewriteArchivedImages(item.content_html, item.link, effectiveImages, origin, apiBase) : item.content_html,
|
|
309
|
+
full_content_html: withContent && item.full_content_html ? rewriteArchivedImages(item.full_content_html, item.link, effectiveImages, origin, apiBase) : item.full_content_html,
|
|
297
310
|
};
|
|
298
311
|
});
|
|
299
312
|
}
|
|
@@ -312,7 +325,7 @@ function proxiedImageUrl(origin, itemId, imageUrl, apiBase = "/api") {
|
|
|
312
325
|
export function withProxiedImages(items, origin, apiBase = "/api", withContent = true) {
|
|
313
326
|
const own = `${origin.replace(/\/$/, "")}/api/`;
|
|
314
327
|
return items.map((item) => {
|
|
315
|
-
const urls = new Set(itemImageUrls(item).filter((url) => !url.startsWith(own)));
|
|
328
|
+
const urls = new Set(itemImageUrls(item).filter((url) => !url.startsWith(own) && !isVectorImageUrl(url)));
|
|
316
329
|
if (urls.size === 0)
|
|
317
330
|
return item;
|
|
318
331
|
const replace = (url) => (urls.has(url) ? proxiedImageUrl(origin, item.id, url, apiBase) : undefined);
|
|
@@ -50,9 +50,10 @@ const PRODUCT_CARD_CHARACTERS = 220;
|
|
|
50
50
|
const PRICE = /(?:\d[\d.,]*\s?(?:€|EUR|\$|USD|£|GBP|CHF)|(?:€|\$|£)\s?\d)/;
|
|
51
51
|
const MONTHS = "Januar|Februar|März|Maerz|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember|January|February|March|June|July|October|December|Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec|Jan\\.|Feb\\.";
|
|
52
52
|
const TIME_OF_DAY = "(?:[,\\s•·|-]+\\d{1,2}[:.]\\d{2}(?::\\d{2})?(?:\\s?(?:Uhr|[ap]\\.?m\\.?))?)?";
|
|
53
|
-
|
|
53
|
+
const DATE_PREFIX = "(?:(?:stand|zuletzt aktualisiert|aktualisiert(?:\\s+am)?|ver(?:ö|oe)ffentlicht(?:\\s+am)?|erschienen(?:\\s+am)?|updated(?:\\s+on)?|published(?:\\s+on)?|posted(?:\\s+on)?)\\s*[:·|•-]*\\s*)?";
|
|
54
|
+
/** A whole line that is a date, with or without a time or status prefix: `Stand: 19.10.2026 • 14:34 Uhr`, `15. Oktober 2026, 10:51 Uhr`, `Oct 15, 2026`. */
|
|
54
55
|
const DATE_PART = `(?:\\d{1,2}\\.\\s?\\d{1,2}\\.\\s?\\d{2,4}|\\d{1,2}\\.?\\s(?:${MONTHS})\\.?\\s\\d{4}|(?:${MONTHS})\\.?\\s\\d{1,2},?\\s\\d{4})`;
|
|
55
|
-
const DATE_ONLY = new RegExp(`^${DATE_PART}${TIME_OF_DAY}$`, "iu");
|
|
56
|
+
const DATE_ONLY = new RegExp(`^${DATE_PREFIX}${DATE_PART}${TIME_OF_DAY}$`, "iu");
|
|
56
57
|
/** The date at the end of a byline (`von Michael Bartl I 15.10.2026 - 11:41`): the author stays, the date is in the reader's head. */
|
|
57
58
|
const BYLINE = /^(von|by|text|autor(in)?|author|written by|words by|story by|report(ed)? by|posted by|photo(s)? by)\b/i;
|
|
58
59
|
const BYLINE_DATE_TAIL = new RegExp(`(?:^|\\s)[|•·–—I-]\\s*${DATE_PART}${TIME_OF_DAY}\\s*$`, "iu");
|
|
@@ -85,7 +86,9 @@ function removeReaderNoise(root, title, stats, author) {
|
|
|
85
86
|
const drop = (element, rule) => {
|
|
86
87
|
if (!element.parentNode)
|
|
87
88
|
return;
|
|
89
|
+
const parent = element.parentNode;
|
|
88
90
|
element.remove();
|
|
91
|
+
pruneEmpty(parent);
|
|
89
92
|
stats[rule] = (stats[rule] ?? 0) + 1;
|
|
90
93
|
changed = true;
|
|
91
94
|
};
|
|
@@ -324,7 +327,7 @@ function removeReaderNoise(root, title, stats, author) {
|
|
|
324
327
|
});
|
|
325
328
|
return changed;
|
|
326
329
|
}
|
|
327
|
-
const PRESENTATIONAL_TAGS = new Set(["FONT", "BIG", "SMALL", "CENTER", "TT", "U", "STRIKE", "S", "BASEFONT", "BLINK", "NOBR", "SPAN", "MARK"]);
|
|
330
|
+
const PRESENTATIONAL_TAGS = new Set(["FONT", "BIG", "SMALL", "CENTER", "TT", "U", "STRIKE", "S", "BASEFONT", "BLINK", "NOBR", "SPAN", "MARK", "PICTURE"]);
|
|
328
331
|
const PRESENTATIONAL_ATTRIBUTES = ["style", "class", "color", "face", "size", "bgcolor", "align", "valign", "border", "cellpadding",
|
|
329
332
|
"cellspacing", "background", "hspace", "vspace", "nowrap"];
|
|
330
333
|
const SIZED_TAGS = new Set(["IMG", "VIDEO", "CANVAS", "IFRAME", "EMBED", "OBJECT"]);
|
|
@@ -350,7 +353,7 @@ function wrapChildren(element, tag) {
|
|
|
350
353
|
*/
|
|
351
354
|
function removeTypography(root, stats) {
|
|
352
355
|
let changed = false;
|
|
353
|
-
root.querySelectorAll("style, link[rel~='stylesheet']").forEach(node => { node.remove(); changed = true; });
|
|
356
|
+
root.querySelectorAll("style, link[rel~='stylesheet'], picture > source").forEach(node => { node.remove(); changed = true; });
|
|
354
357
|
const targets = new Set([...root.querySelectorAll("a[href^='#']")].map(anchor => (anchor.getAttribute("href") ?? "").slice(1)));
|
|
355
358
|
for (const element of [...root.querySelectorAll("*")]) {
|
|
356
359
|
const style = element.getAttribute("style") ?? "";
|
|
@@ -559,6 +562,22 @@ function resolveCustomImages(root, stats) {
|
|
|
559
562
|
wrapper.replaceWith(...wrapper.childNodes);
|
|
560
563
|
changed = true;
|
|
561
564
|
}
|
|
565
|
+
for (const picture of [...root.querySelectorAll("picture")]) {
|
|
566
|
+
const image = picture.querySelector("img");
|
|
567
|
+
if (!image)
|
|
568
|
+
continue;
|
|
569
|
+
const current = (image.getAttribute("src") ?? "").trim();
|
|
570
|
+
if (current && !/^data:/i.test(current))
|
|
571
|
+
continue;
|
|
572
|
+
for (const source of picture.querySelectorAll("source[srcset]")) {
|
|
573
|
+
const candidate = (source.getAttribute("srcset") ?? "").split(",")[0]?.trim().split(/\s+/)[0] ?? "";
|
|
574
|
+
if (candidate && !/^data:/i.test(candidate)) {
|
|
575
|
+
image.setAttribute("src", candidate);
|
|
576
|
+
changed = true;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
562
581
|
if (changed)
|
|
563
582
|
stats["custom-image"] = (stats["custom-image"] ?? 0) + 1;
|
|
564
583
|
return changed;
|
|
@@ -27,10 +27,39 @@ export function imageVariant(raw) {
|
|
|
27
27
|
const rest = new URLSearchParams(url.searchParams);
|
|
28
28
|
for (const name of ["w", "width", "h", "height", "q", "quality", "fit", "dpr"])
|
|
29
29
|
rest.delete(name);
|
|
30
|
-
|
|
30
|
+
const normalizedPath = path
|
|
31
|
+
.replace(/(?:\/[^/]+)?\/\d{1,4}x\d{1,4}(?:-[a-z0-9]+)?(?=\/[^/]+$)/i, "/_")
|
|
32
|
+
.replace(/\.(?:webp|jpeg)$/i, ".jpg");
|
|
33
|
+
return { key: `${url.origin}${normalizedPath}?${rest.toString()}`, width: Number(url.searchParams.get(widthParam)) };
|
|
31
34
|
}
|
|
32
35
|
return null;
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Canonical identity of an image across CDN size presets, aspect-ratio crop directories, format extensions and width
|
|
39
|
+
* query parameters, while keeping origin, non-size directories and picture-identifying query parameters intact.
|
|
40
|
+
*/
|
|
41
|
+
export function comparableImageKey(raw, baseUrl) {
|
|
42
|
+
if (!raw)
|
|
43
|
+
return null;
|
|
44
|
+
let url;
|
|
45
|
+
try {
|
|
46
|
+
url = new URL(decodeEntities(raw.trim()), baseUrl ?? undefined);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
52
|
+
return null;
|
|
53
|
+
url.hash = "";
|
|
54
|
+
url.pathname = url.pathname
|
|
55
|
+
.replace(/[-_]\d{2,4}x\d{2,4}(?=\.\w+$)/, "")
|
|
56
|
+
.replace(/\/\d{1,4}(?=\/[^/]{12,}$)/, "/_")
|
|
57
|
+
.replace(/(?:\/[^/]+)?\/\d{1,4}x\d{1,4}(?:-[a-z0-9]+)?(?=\/[^/]+$)/i, "/_")
|
|
58
|
+
.replace(/\.(?:webp|jpeg)$/i, ".jpg");
|
|
59
|
+
for (const name of ["w", "width", "h", "height", "q", "quality", "fit", "dpr"])
|
|
60
|
+
url.searchParams.delete(name);
|
|
61
|
+
return url.toString();
|
|
62
|
+
}
|
|
34
63
|
/** Every image address in the HTML: `src` of images and each entry of a `srcset`. */
|
|
35
64
|
function imageAddresses(html, baseUrl) {
|
|
36
65
|
const found = new Set();
|
|
@@ -13,4 +13,13 @@ export function detectImageType(data) {
|
|
|
13
13
|
return { mime: "image/avif", ext: "avif" };
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
+
/** Vector images are never served by the image proxy, so their addresses stay as the publisher wrote them. */
|
|
17
|
+
export function isVectorImageUrl(url) {
|
|
18
|
+
try {
|
|
19
|
+
return new URL(url).pathname.toLowerCase().endsWith(".svg");
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
16
25
|
//# sourceMappingURL=imageTypes.js.map
|
package/server/package.json
CHANGED
|
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
|
|
|
10
10
|
|
|
11
11
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=ur(),d;if(t){let e=typeof t==`string`?Yt(t):t;Wt(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Qt(e,{pathname:p});Gt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Gt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Er(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Dn([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Dn([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?_.createElement(er.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function br(){let e=Nr(),t=Nn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=_.createElement(_.Fragment,null,_.createElement(`p`,null,`💿 Hey developer 👋`),_.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,_.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,_.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),_.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:i},n):null,o)}var xr=_.createElement(br,null),Sr=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=sr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:_.createElement(tr.Provider,{value:this.props.routeContext},_.createElement(nr.Provider,{value:e,children:this.props.component}));return this.context?_.createElement(wr,{error:e},t):t}};Sr.contextType=Jn;var Cr=new WeakMap;function wr({children:e,error:t}){let{basename:n,navigator:r}=_.useContext($n);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=or(t.digest);if(e){let i=Cr.get(t);if(i)throw i;let a=In(e.location,n),o=a.absoluteURL||a.to;if(Vn(e.location,o,Rn(r),`allow-explicit`),Gn(o))throw Error(`Invalid redirect location`);if(Fn&&!Cr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Cr.set(t,n),n}}return _.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function Tr({routeContext:e,match:t,children:n}){let r=_.useContext(Kn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(tr.Provider,{value:e},n)}function Er(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Wt(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Pn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||xr,o&&(s<0&&c===0?(Ir(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?_.createElement(n.route.Component,null):n.route.element?n.route.element:e,_.createElement(Tr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?_.createElement(Sr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Dr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Or(e){let t=_.useContext(Kn);return Wt(t,Dr(e)),t}function kr(e){let t=_.useContext(qn);return Wt(t,Dr(e)),t}function Ar(e){let t=_.useContext(tr);return Wt(t,Dr(e)),t}function jr(e){let t=Ar(e),n=t.matches[t.matches.length-1];return Wt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Mr(){return jr(`useRouteId`)}function Nr(){let e=_.useContext(nr),t=kr(`useRouteError`),n=jr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Pr(){let{router:e}=Or(`useNavigate`),t=jr(`useNavigate`),n=_.useRef(!1);return fr(()=>{n.current=!0}),_.useCallback(async(r,i={})=>{Gt(n.current,dr),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Fr={};function Ir(e,t,n){!t&&!Fr[e]&&(Fr[e]=!0,Gt(!1,n))}_.memo(Lr);function Lr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return yr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Rr({to:e,replace:t,state:n,relative:r}){Wt(lr(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=_.useContext($n);Gt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=_.useContext(tr),{pathname:s}=ur(),c=pr(),l=Tn(e,wn(o),s,r===`path`);Vn(typeof e==`string`?e:Jt(e),a.createHref(l),Rn(a),`reject`);let u=JSON.stringify(l);return _.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function zr(e){return gr(e.context)}function Br(e){Wt(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Vr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){Wt(!lr(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=_.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Yt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=_.useMemo(()=>{let e=yn(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Gt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:_.createElement($n.Provider,{value:c},_.createElement(er.Provider,{children:t,value:h}))}function Hr({children:e,location:t}){return vr(Ur(e),t)}_.Component;function Ur(e,t=[]){let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,Ur(e.props.children,i));return}Wt(e.type===Br,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wt(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Ur(e.props.children,i)),n.push(a)}),n}var Wr=`get`,Gr=`application/x-www-form-urlencoded`;function Kr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function qr(e){return Kr(e)&&e.tagName.toLowerCase()===`button`}function Jr(e){return Kr(e)&&e.tagName.toLowerCase()===`form`}function Yr(e){return Kr(e)&&e.tagName.toLowerCase()===`input`}function Xr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Zr(e,t){return e.button===0&&(!t||t===`_self`)&&!Xr(e)}function Qr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function $r(e,t){let n=Qr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var ei=null;function ti(){if(ei===null)try{new FormData(document.createElement(`form`),0),ei=!1}catch{ei=!0}return ei}var ni=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ri(e){return e!=null&&!ni.has(e)?(Gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Gr}"`),null):e}function ii(e,t){let n,r,i,a,o;if(Jr(e)){let o=e.getAttribute(`action`);r=o?yn(o,t):null,n=e.getAttribute(`method`)||Wr,i=ri(e.getAttribute(`enctype`))||Gr,a=new FormData(e)}else if(qr(e)||Yr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?yn(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Wr,i=ri(e.getAttribute(`formenctype`))||ri(o.getAttribute(`enctype`))||Gr,a=new FormData(o,e),!ti()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Kr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Wr,r=null,i=Gr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ai(e,t){if(e===!1||e==null)throw Error(t)}function oi(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&yn(i.pathname,t)===`/`?`${On(t)}/_root.${r}`:`${On(i.pathname)}.${r}`,i}async function si(e,t){if(e.id in t)return t[e.id];try{let n=await Lt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ci(e){return e!=null&&typeof e.page==`string`}function li(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function ui(e,t,n){return hi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await si(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(li).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function di(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function fi(e,t,{includeHydrateFallback:n}={}){return pi(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function pi(e){return[...new Set(e)]}function mi(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function hi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!ci(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(mi(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function gi(){let e=_.useContext(Kn);return ai(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function _i(){let e=_.useContext(qn);return ai(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var vi=_.createContext(void 0);vi.displayName=`FrameworkContext`;function yi(){let e=_.useContext(vi);return ai(e,`You must render this element inside a <HydratedRouter> element`),e}function bi(e,t){let n=_.useContext(vi),[r,i]=_.useState(!1),[a,o]=_.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=_.useRef(null);_.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),_.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:xi(s,p),onBlur:xi(c,m),onMouseEnter:xi(l,p),onMouseLeave:xi(u,m),onTouchStart:xi(d,p)}]:[a,f,{}]:[!1,f,{}]}function xi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Si({page:e,...t}){let n=Yn(),{nonce:r}=yi(),{router:i}=gi(),a=_.useMemo(()=>Qt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?_.createElement(wi,{page:e,matches:a,...t}):_.createElement(Ti,{page:e,matches:a,...t})):null}function Ci(e){let{manifest:t,routeModules:n}=yi(),[r,i]=_.useState([]);return _.useEffect(()=>{let r=!1;return ui(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function wi({page:e,matches:t,...n}){let r=ur(),{future:i}=yi(),{basename:a}=gi(),o=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=oi(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return _.createElement(_.Fragment,null,o.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Ti({page:e,matches:t,...n}){let r=ur(),{future:i,manifest:a,routeModules:o}=yi(),{basename:s}=gi(),{loaderData:c,matches:l}=_i(),u=_.useMemo(()=>di(e,t,l,a,r,`data`),[e,t,l,a,r]),d=_.useMemo(()=>di(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=oi(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=_.useMemo(()=>fi(d,a),[d,a]),m=Ci(d);return _.createElement(_.Fragment,null,f.map(e=>_.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>_.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>_.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Ei(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}_.Component;var Di=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Di&&(window.__reactRouterVersion=`7.18.4`)}catch{}function Oi({basename:e,children:t,useTransitions:n,window:r}){let i=_.useRef();i.current??=Ut({window:r,v5Compat:!0});let a=i.current,[o,s]=_.useState({action:a.action,location:a.location}),c=_.useCallback(e=>{n===!1?s(e):_.startTransition(()=>s(e))},[n]);return _.useLayoutEffect(()=>a.listen(c),[a,c]),_.createElement(Vr,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ki=_.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:v}=_.useContext($n),y=typeof l==`string`&&Rt.test(l),b=In(l,h);l=b.to;let x=cr(l,{relative:r}),S=ur(),C=null;if(o){let e=Tn(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Dn([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=bi(n,p),D=Pi(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:v});function ee(t){e&&e(t),t.defaultPrevented||D(t)}let O=!(b.isExternal||i),te=_.createElement(`a`,{...p,...E,href:(O?C:void 0)||b.absoluteURL||x,onClick:O?ee:e,ref:Ei(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?_.createElement(_.Fragment,null,te,_.createElement(Si,{page:x})):te});ki.displayName=`Link`;var Ai=_.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=_r(a,{relative:c.relative}),d=ur(),f=_.useContext(qn),{navigator:p,basename:m}=_.useContext($n),h=f!=null&&Bi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=yn(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=v===g||!r&&v.startsWith(g)&&v.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return _.createElement(ki,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Ai.displayName=`NavLink`;var ji=_.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Wr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=_.useContext($n),g=Ri(),v=zi(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&Rt.test(s);return _.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?_.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});ji.displayName=`Form`;function Mi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ni(e){let t=_.useContext(Kn);return Wt(t,Mi(e)),t}function Pi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=pr(),d=ur(),f=_r(e,{relative:o});return _.useCallback(p=>{if(Zr(p,t)){p.preventDefault();let t=n===void 0?Jt(d)===Jt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?_.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Fi(e){Gt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(Qr(e)),n=_.useRef(!1),r=ur(),i=_.useMemo(()=>$r(r.search,n.current?null:t.current),[r.search]),a=pr();return[i,_.useCallback((e,t)=>{let r=Qr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Ii=0,Li=()=>`__${String(++Ii)}__`;function Ri(){let{router:e}=Ni(`useSubmit`),{basename:t}=_.useContext($n),n=Mr(),r=e.fetch,i=e.navigate;return _.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ii(e,t);if(a.navigate===!1){let e=a.fetcherKey||Li();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function zi(e,{relative:t}={}){let{basename:n}=_.useContext($n),r=_.useContext(tr);Wt(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={..._r(e||`.`,{relative:t})},o=ur();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Dn([n,a.pathname])),Jt(a)}function Bi(e,{relative:t}={}){let n=_.useContext(Xn);Wt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ni(`useViewTransitionState`),i=_r(e,{relative:t});if(!n.isTransitioning)return!1;let a=yn(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=yn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return hn(i.pathname,o)!=null||hn(i.pathname,a)!=null}var Vi=`fk_offline_owner`,Hi=null;function Ui(e){Hi=e;try{e===null?localStorage.removeItem(Vi):localStorage.setItem(Vi,String(e)),localStorage.removeItem(`fk_offline_queue`),localStorage.removeItem(`fk_saved_synced_at`)}catch{}}function Wi(){try{return Hi!==null&&localStorage.getItem(Vi)===String(Hi)?Hi:null}catch{return null}}var Gi=()=>{let e=Wi();return e===null?null:`fk_offline_queue-${e}`},Ki=new Set;function qi(){let e=Gi();if(e===null)return new Map;try{return new Map(JSON.parse(localStorage.getItem(e)??`[]`))}catch{return new Map}}function Ji(e){let t=Gi();if(t!==null){try{e.size===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify([...e]))}catch{}Ki.forEach(e=>e())}}var Yi=(e,t)=>`${e}:${t}`;function Xi(e,t,n){let r=qi();r.set(Yi(e,t),n),Ji(r)}function Zi(e,t){let n=qi();n.delete(Yi(e,t))&&Ji(n)}function Qi(){qi().size>0&&Ji(new Map)}function $i(){return qi().size}function ea(e){return Ki.add(e),window.addEventListener(`storage`,e),()=>{Ki.delete(e),window.removeEventListener(`storage`,e)}}function ta(){return[...qi()].map(([e,t])=>{let[n,r]=e.split(`:`);return{action:n,itemId:Number(r),value:t}})}function na(e){let t=qi();return t.size===0?e:e.map(e=>{let n=t.get(Yi(`read`,e.id)),r=t.get(Yi(`bookmark`,e.id));return n===void 0&&r===void 0?e:{...e,read:n??e.read,bookmarked:r??e.bookmarked}})}async function ra(e,t){let n=0,r=Wi();for(let{action:i,itemId:a,value:o}of ta()){if(r===null||Wi()!==r)return n;try{await e(i,a,o)}catch(e){if(t(e))return n}if(Wi()!==r)return n;Zi(i,a),n++}return n}var ia=`fk-offline`,aa=`fk-api`,z=`/__offline/articles`,oa=`fk_offline_saved`,sa=`fk_saved_synced_at`,ca=()=>typeof window<`u`&&`caches`in window;function la(){try{return localStorage.getItem(oa)!==`false`}catch{return!0}}function ua(e){try{localStorage.setItem(oa,String(e))}catch{}}async function da(){let e=Wi();if(!ca()||e===null)return null;try{let t=await(await caches.open(`${ia}-${e}`)).match(z),n=t?await t.json():null;return Wi()===e&&n?.userId===e?n:null}catch{return null}}async function fa(e){let t=Wi();if(!ca()||t===null||e.userId!==t)return;let n=await caches.open(`${ia}-${t}`);Wi()===t&&await n.put(z,new Response(JSON.stringify(e),{headers:{"Content-Type":`application/json`}}))}async function pa(){if(!ca())return;let e=Wi();await caches.delete(e===null?ia:`${ia}-${e}`);try{localStorage.removeItem(e===null?sa:`${sa}-${e}`)}catch{}}function ma(e){let t=new Set;return[...e.saved,...e.recent].filter(e=>!t.has(e.id)&&t.add(e.id))}function ha(e,t,n){let r=n.search?.trim().toLowerCase(),i=e.filter(e=>n.bookmarkedOnly&&!e.bookmarked||n.unreadOnly&&!n.bookmarkedOnly&&e.read||n.feedId&&e.feed_id!==n.feedId||n.folderId&&t[e.feed_id]!==n.folderId?!1:!r||[e.title,e.content_snippet,e.full_content_html,e.content_html].some(e=>e?.toLowerCase().includes(r))),a=n.bookmarkedOnly?i:[...i].sort((e,t)=>(t.published_at??``).localeCompare(e.published_at??``)),o=n.offset??0;return a.slice(o,n.limit?o+n.limit:void 0)}var ga=class extends Error{status;code;data;constructor(e,t,n){super(t),this.status=e,this.code=t,this.data=n}};async function B(e,t){let n=new Headers(t?.headers);n.has(`Content-Type`)||n.set(`Content-Type`,`application/json`);let r;try{r=await fetch(`/api${e}`,{credentials:`include`,...t,headers:n})}catch{throw new ga(0,`unreachable`)}if(r.status===204)return;let i=await r.json().catch(()=>({}));if(!r.ok)throw new ga(r.status,i.error??`unknown_error`,i);return i}function _a(e,t,n){return e===`read`?B(`/items/${t}/${n?`read`:`unread`}`,{method:`POST`}):B(`/items/${t}/bookmark`,{method:n?`POST`:`DELETE`})}async function va(e,t,n){try{await _a(e,t,n),Zi(e,t)}catch(r){if(!(r instanceof ga&&r.status===0))throw r;Xi(e,t,n)}}function ya(e){return e instanceof ga&&e.status===0}function ba(e){return e instanceof ga&&(e.status===0||e.status===401||e.status===408||e.status===429||e.status>=500)}function xa(e){return e.avatar_updated_at?`/api/auth/me/avatar?v=${encodeURIComponent(e.avatar_updated_at)}`:null}var V={getConfig:()=>B(`/config`),onboardingStatus:()=>B(`/onboarding/status`),onboard:e=>B(`/onboarding`,{method:`POST`,body:JSON.stringify(e)}),login:(e,t)=>B(`/auth/login`,{method:`POST`,body:JSON.stringify({email:e,password:t})}),logout:()=>B(`/auth/logout`,{method:`POST`}),changePassword:(e,t)=>B(`/auth/change-password`,{method:`POST`,body:JSON.stringify({currentPassword:e,newPassword:t})}),me:()=>B(`/auth/me`),updateProfile:e=>B(`/auth/me`,{method:`PATCH`,body:JSON.stringify({displayName:e})}),uploadAvatar:e=>B(`/auth/me/avatar`,{method:`PUT`,headers:{"Content-Type":e.type},body:e}),deleteAvatar:()=>B(`/auth/me/avatar`,{method:`DELETE`}),dismissIntro:()=>B(`/auth/me/intro`,{method:`POST`}),listUsers:()=>B(`/auth/users`),createUser:e=>B(`/auth/users`,{method:`POST`,body:JSON.stringify(e)}),listFeeds:()=>B(`/feeds`),discoverFeeds:e=>B(`/feeds/discover`,{method:`POST`,body:JSON.stringify({url:e})}),subscribeFeed:(e,t,n)=>B(`/feeds`,{method:`POST`,body:JSON.stringify({url:e,label:t,folderId:n})}),unsubscribeFeed:e=>B(`/feeds/${e}`,{method:`DELETE`}),updateFeed:(e,t)=>B(`/feeds/${e}`,{method:`PATCH`,body:JSON.stringify(t)}),pushKey:()=>B(`/push/key`),savePushDevice:e=>B(`/push/devices`,{method:`POST`,body:JSON.stringify(e)}),checkPushDevice:e=>B(`/push/devices/check`,{method:`POST`,body:JSON.stringify({endpoint:e})}),removePushDevice:e=>B(`/push/devices/remove`,{method:`POST`,body:JSON.stringify({endpoint:e})}),sendTestPush:e=>B(`/push/test`,{method:`POST`,body:JSON.stringify({language:e})}),reorderFeeds:e=>B(`/feeds/reorder`,{method:`PUT`,body:JSON.stringify({feedIds:e})}),exportOpmlUrl:()=>`/api/feeds/opml`,importOpml:e=>B(`/feeds/opml`,{method:`POST`,headers:{"Content-Type":`application/xml`},body:e}),refreshFeed:e=>B(`/feeds/${e}/refresh`,{method:`POST`}),refreshAllFeeds:()=>B(`/feeds/refresh-all`,{method:`POST`}),listFolders:()=>B(`/folders`),createFolder:e=>B(`/folders`,{method:`POST`,body:JSON.stringify({name:e})}),updateFolder:(e,t)=>B(`/folders/${e}`,{method:`PATCH`,body:JSON.stringify({name:t})}),deleteFolder:e=>B(`/folders/${e}`,{method:`DELETE`}),markFolderRead:e=>B(`/folders/${e}/read`,{method:`POST`}),listItems:async(e={})=>{let t=new URLSearchParams;e.feedId&&t.set(`feedId`,String(e.feedId)),e.folderId&&t.set(`folderId`,String(e.folderId)),e.unreadOnly&&t.set(`unreadOnly`,`true`),e.bookmarkedOnly&&t.set(`bookmarkedOnly`,`true`),e.includeMuted&&t.set(`includeMuted`,`true`),e.offline&&t.set(`offline`,`true`),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset));let n=t.toString(),r=async()=>{let t=await da();return t?ha(na(ma(t)),t.feedFolders,e):null};if(!navigator.onLine&&!e.offline){let e=await r();if(e)return e}try{return na(await B(`/items${n?`?${n}`:``}`))}catch(e){if(ya(e)){let e=await r();if(e)return e}throw e}},markRead:e=>va(`read`,e,!0),markUnread:e=>va(`read`,e,!1),bookmarkItem:e=>va(`bookmark`,e,!0),unbookmarkItem:e=>va(`bookmark`,e,!1),extractContent:e=>B(`/items/${e}/extract-content`,{method:`POST`}),markAllRead:e=>{let t=typeof e==`number`?e:e?.feedId,n=typeof e==`object`?e?.folderId:void 0;return B(`/items/mark-all-read`,{method:`POST`,body:JSON.stringify({feedId:t,folderId:n})})},listMutedKeywords:()=>B(`/filters/muted`),addMutedKeyword:e=>B(`/filters/muted`,{method:`POST`,body:JSON.stringify({keyword:e})}),deleteMutedKeyword:e=>B(`/filters/muted/${e}`,{method:`DELETE`}),listDevices:()=>B(`/v1/devices`),createPairingCode:()=>B(`/v1/pairing-codes`,{method:`POST`}),revokeDevice:e=>B(`/v1/devices/${e}`,{method:`DELETE`}),listTokens:()=>B(`/tokens`),createToken:(e,t)=>B(`/tokens`,{method:`POST`,body:JSON.stringify({name:e,scope:t})}),deleteToken:e=>B(`/tokens/${e}`,{method:`DELETE`}),listOAuthGrants:()=>B(`/oauth-grants`),deleteOAuthGrant:e=>B(`/oauth-grants/${e}`,{method:`DELETE`}),getRetention:()=>B(`/system/retention`),updateRetention:e=>B(`/system/retention`,{method:`PATCH`,body:JSON.stringify(e)}),runCleanup:()=>B(`/system/cleanup`,{method:`POST`})},Sa=100,Ca=300,wa=1500,Ta=100,Ea=3e5,Da=/https?:\/\/[^"'\s<>)]+(\/api\/(?:archive\/images\/\d+|items\/\d+\/image\?src=[^"'\s<>)]+))/g,Oa=null,ka=0;function Aa(){ka++}function ja(){try{return Number(localStorage.getItem(`fk_saved_synced_at-${Wi()}`))||0}catch{return 0}}function Ma(e,t){return e?.replace(Da,(e,n)=>{let r=`${window.location.origin}${n}`;return t.add(r),r})}function Na(e,t){return{...e,image_url:Ma(e.image_url,t),content_html:Ma(e.content_html,t),full_content_html:Ma(e.full_content_html,t)}}async function Pa(e,t,n){let r=t.slice(0,wa),i=async()=>{for(let t=r.shift();t&&!n();t=r.shift()){let r=await e.match(t,{ignoreVary:!0}),i=/\/api\/archive\/images\/\d+/.test(new URL(t).pathname),a=Number(r?.headers.get(`cache-control`)?.match(/max-age=(\d+)/)?.[1]??0),o=r&&Date.now()-Date.parse(r.headers.get(`date`)??``)<Math.min(a,21600)*1e3;if(!(r&&(i||o)))try{let r=await fetch(t,{credentials:`include`});r.ok&&!n()&&await e.put(t,r)}catch{}}};await Promise.all([i(),i(),i(),i()])}async function Fa(e,t){for(let n of await e.keys())/\/api\/(archive\/images\/|items\/\d+\/image)/.test(n.url)&&!t.has(n.url)&&await e.delete(n)}async function Ia(){return navigator.onLine?ra(_a,ba):0}async function La(){await Ra({force:await Ia()>0})}function Ra(e={}){let t=Wi();if(t===null||!(`caches`in window)||!la()||!navigator.onLine)return Promise.resolve(null);if(Oa)return e.force?Oa.then(()=>Ra(e)):Oa;if(!e.force&&Date.now()-ja()<Ea)return Promise.resolve(null);let n=ka,r=()=>n!==ka||Wi()!==t;return Oa=(async()=>{try{let e=new Set,n=[];for(let e=0;n.length<Ca;e+=Sa){let t=await V.listItems({bookmarkedOnly:!0,limit:Sa,offset:e,offline:!0});if(n.push(...t),t.length<Sa)break}let i=await V.listItems({unreadOnly:!0,limit:Ta,offline:!0}),a=await V.listFeeds().catch(()=>[]),o=n.slice(0,Ca).map(t=>Na(t,e)),s=i.map(t=>Na(t,e));if(r())return null;let c=await caches.open(aa);return r()||(await Pa(c,[...e],r),r())||(await Fa(c,e),r())||(await fa({userId:t,savedAt:new Date().toISOString(),saved:o,recent:s,feedFolders:Object.fromEntries(a.map(e=>[e.id,e.folder_id]))}),r())?null:(localStorage.setItem(`${sa}-${t}`,String(Date.now())),new Set([...o,...s].map(e=>e.id)).size)}catch{return null}finally{Oa=null}})(),Oa}async function za(){await pa(),`caches`in window&&await Fa(await caches.open(aa),new Set)}var Ba=`feedkeeper_items_scroll_y`,Va=(()=>{try{return Number(sessionStorage.getItem(Ba)||`0`)}catch{return 0}})();function Ha(){return Va}function Ua(e){Va=Math.max(0,e);try{sessionStorage.setItem(Ba,String(Math.round(Va)))}catch{}}function Wa(){Ua(0)}function Ga(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}async function Ka(){return await navigator.serviceWorker.getRegistration()??null}async function qa(){if(!Ga())return`unsupported`;if(Notification.permission===`denied`)return`blocked`;let e=await(await Ka())?.pushManager.getSubscription();if(!e)return`off`;let{registered:t}=await V.checkPushDevice(e.endpoint).catch(()=>({registered:!0}));return t?`on`:`off`}function Ja(e){let t=(e+`=`.repeat((4-e.length%4)%4)).replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=new Uint8Array(new ArrayBuffer(n.length));for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}async function Ya(){if(!Ga())return`unsupported`;let e=await Ka();if(!e)return`unsupported`;if(await Notification.requestPermission()!==`granted`)return`blocked`;let{publicKey:t}=await V.pushKey(),n=(await e.pushManager.getSubscription()??await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ja(t)})).toJSON();return!n.endpoint||!n.keys?.p256dh||!n.keys.auth?`off`:(await V.savePushDevice({endpoint:n.endpoint,keys:{p256dh:n.keys.p256dh,auth:n.keys.auth}}),`on`)}async function Xa(){let e=await(await Ka())?.pushManager.getSubscription();e&&(await V.removePushDevice(e.endpoint).catch(()=>void 0),await e.unsubscribe().catch(()=>void 0))}function Za(e){let t=navigator;t.setAppBadge&&t.clearAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge()).catch(()=>void 0)}async function Qa(){if(navigator.onLine)try{Za((await V.listFeeds()).filter(e=>e.badge!==0).reduce((e,t)=>e+t.unread_count,0))}catch{}}var $a=`fk:items-changed`;function eo(){window.dispatchEvent(new Event($a))}function to(e){return window.addEventListener($a,e),()=>window.removeEventListener($a,e)}function no(){`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).then(()=>navigator.serviceWorker.ready).then(e=>{let t=performance.getEntriesByType(`resource`).map(e=>new URL(e.name)).filter(e=>e.origin===window.location.origin&&e.pathname.startsWith(`/assets/`)).map(e=>e.pathname);e.active?.postMessage({type:`cache-urls`,urls:t})}).catch(()=>void 0)})}async function ro(){if(Aa(),Qi(),Za(0),Ui(null),!(`caches`in window))return;let e=await caches.keys();await Promise.all(e.filter(e=>e===`fk-api`||e===`fk-offline`||e.startsWith(`fk-offline-`)).map(e=>caches.delete(e)))}var io=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=io()}))(),ao=(0,_.createContext)(null);function oo({children:e}){let t=(0,_.useRef)(0),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);async function u(){let e=++t.current;Aa(),s(!0),l(!1);try{let n=await V.onboardingStatus();if(e!==t.current)return;if(n.needsOnboarding){a(!0),r(null);return}a(!1);try{let n=await V.me();if(e!==t.current)return;Ui(n.id),r(n)}catch(n){if(e!==t.current)return;n instanceof ga&&n.status===401?(r(null),await ro()):n instanceof ga&&n.status===0?l(!0):(console.error(`Auth check failed:`,n),r(null))}}catch(n){if(e!==t.current)return;n instanceof ga&&n.status===0?l(!0):console.error(`Failed to check onboarding/auth status:`,n),r(null)}finally{e===t.current&&s(!1)}}async function d(){await Xa().catch(()=>void 0),await V.logout(),await ro(),Wa(),r(null)}return(0,_.useEffect)(()=>{u();let e=e=>{e.key===`fk_offline_owner`&&u()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,H.jsx)(ao.Provider,{value:{user:n,loading:o,needsOnboarding:i,unreachable:c,refresh:u,logout:d,setCurrentUser:r},children:e})}function so(){let e=(0,_.useContext)(ao);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}var co=`M435.6,124.8l0,-73.2l-435.6,0l-0,816l92.4,-0l0,-381.6l325.2,0l-0,-74.4l-325.2,0l0,-286.8l343.2,0zM1065.6,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM1722,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM2396.4,830.4l0,-830.4l-90,0l0,278.4c-18,-8.4,-97.2,-39.6,-188.4,-39.6c-164.4,0,-262.8,106.8,-262.8,306c0,242.4,86.4,337.2,279.6,337.2c121.2,-0,216,-32.4,261.6,-51.6zm-90,-48c-21.6,12,-84,33.6,-171.6,33.6c-129.6,0,-188.4,-78,-188.4,-271.2c0,-159.6,63.6,-238.8,189.6,-238.8c72,0,146.4,28.8,170.4,38.4l0,438zM3187.2,867.6l-386.4,-427.2l355.2,-388.8l-120,0l-340.8,388.8l367.2,427.2l124.8,-0zm-494.4,-0l-0,-816l-92.4,0l0,816l92.4,-0zM3776.4,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM4432.8,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM5133.6,544.8c0,-210,-92.4,-306,-282,-306c-118.8,0,-231.6,36,-260.4,50.4l-0,832.8l90,0l0,-280.8c16.8,13.2,99.6,40.8,187.2,40.8c165.6,0,265.2,-92.4,265.2,-337.2zm-93.6,0c0,194.4,-57.6,271.2,-188.4,271.2c-69.6,0,-141.6,-25.2,-170.4,-37.2l0,-439.2c18,-8.4,81.6,-33.6,171.6,-33.6c120,0,187.2,68.4,187.2,238.8zM5792.4,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM6256.8,313.2l0,-68.4c-9.6,-1.2,-50.4,-6,-66,-6c-106.8,0,-223.2,39.6,-240,48l-0,580.8l90,-0l0,-531.6c16.8,-6,90,-28.8,158.4,-28.8c14.4,0,45.6,3.6,57.6,6z`;function lo(){return(0,H.jsx)(`svg`,{className:`wordmark`,viewBox:`0 0 6257 1122`,role:`img`,"aria-label":`FeedKeeper`,children:(0,H.jsx)(`path`,{d:co})})}function uo({size:e=28}){return(0,H.jsxs)(`span`,{className:`brand-lockup`,style:{"--m":`${e}px`},children:[(0,H.jsx)(`img`,{src:`/logo.svg`,alt:``}),(0,H.jsx)(lo,{})]})}var fo=({isActive:e})=>`relative z-10 flex h-full items-center gap-2 rounded-lg px-3 text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${e?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`;function po({onItemsClick:e}){let{t,i18n:n}=L(),r=ur(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null);return(0,_.useLayoutEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{let t=e.querySelector(`a[aria-current="page"]`);o(t?{left:t.offsetLeft,width:t.offsetWidth}:null)};t();let n=new ResizeObserver(t);return e.querySelectorAll(`a`).forEach(e=>n.observe(e)),()=>n.disconnect()},[r.pathname,n.resolvedLanguage]),(0,H.jsxs)(`nav`,{ref:i,className:`relative hidden h-9 items-center rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-0.5 md:flex`,children:[a&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0.5 left-0 rounded-lg border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] shadow-sm transition-[transform,width] duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none`,style:{width:a.width,transform:`translateX(${a.left}px)`}}),(0,H.jsxs)(Ai,{to:`/items`,onClick:e,className:fo,children:[(0,H.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h12`})}),t(`nav.items`)]}),(0,H.jsxs)(Ai,{to:`/feeds`,className:fo,children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M4 11a9 9 0 0 1 9 9`}),(0,H.jsx)(`path`,{d:`M4 4a16 16 0 0 1 16 16`}),(0,H.jsx)(`circle`,{cx:`5`,cy:`19`,r:`1`})]}),t(`nav.feeds`)]})]})}var mo=`fk_theme`,ho=new Set,go=(()=>{try{let e=localStorage.getItem(mo);return e===`light`||e===`dark`?e:`system`}catch{return`system`}})();function _o(e){return ho.add(e),()=>ho.delete(e)}function vo(){return go}function yo(e){go=e,e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.setAttribute(`data-theme`,e);try{e===`system`?localStorage.removeItem(mo):localStorage.setItem(mo,e)}catch{}ho.forEach(e=>e())}function bo({standalone:e,hasPrompt:t,userAgent:n,maxTouchPoints:r}){if(e)return`installed`;if(t)return`prompt`;if(/iPhone|iPad|iPod/.test(n)||/Macintosh/.test(n)&&r>1)return`ios`;let i=/Safari\//.test(n)&&!/Chrome|Chromium|CriOS|FxiOS|Edg|OPR|Firefox/.test(n);return/Macintosh/.test(n)&&i?`mac-safari`:`unsupported`}var xo=null,So=!1,Co=new Set,wo=()=>Co.forEach(e=>e());function To(){window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),xo=e,wo()}),window.addEventListener(`appinstalled`,()=>{xo=null,So=!0,wo()})}function Eo(e){Co.add(e);let t=window.matchMedia(`(display-mode: standalone)`);return t.addEventListener(`change`,e),()=>{Co.delete(e),t.removeEventListener(`change`,e)}}function Do(){return bo({standalone:So||window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,hasPrompt:xo!==null,userAgent:navigator.userAgent,maxTouchPoints:navigator.maxTouchPoints??0})}async function Oo(){let e=xo;if(!e)return;xo=null,await e.prompt();let{outcome:t}=await e.userChoice;t===`accepted`&&(So=!0),wo()}function ko(e,t){let n=e.trim().split(/\s+/).filter(Boolean);return n.length===0?t.charAt(0).toUpperCase()||`?`:(n[0].charAt(0)+(n.length>1?n[n.length-1].charAt(0):``)).toUpperCase()}function Ao({user:e,className:t=``}){let n=xa(e),[r,i]=(0,_.useState)(null);return(0,H.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-[var(--c-border)] bg-[var(--c-mobile-nav-active)] font-semibold tracking-wide text-[var(--c-text)] ${t}`,children:n&&r!==n?(0,H.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,onError:()=>i(n)}):(0,H.jsx)(`span`,{"aria-hidden":`true`,children:ko(e.display_name,e.email)})})}var jo=`feedkeeper:extensions-changed`,Mo=[`login`,`menu`,`page`],No=/^[a-z0-9][a-z0-9-]{0,63}$/,Po=(e,t)=>typeof e==`string`&&e.trim().length>0&&e.length<=t,U=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function Fo(e){return U(e)?typeof e.id==`string`&&No.test(e.id)&&Po(e.label,80)&&Po(e.description,300)&&Po(e.group,60)&&(e.shortLabel===void 0||Po(e.shortLabel,40))&&(e.icon===void 0||Array.isArray(e.icon)&&e.icon.length<=8&&e.icon.every(e=>typeof e==`string`&&e.length<=400))&&(e.admin===void 0||typeof e.admin==`boolean`)&&typeof e.mount==`function`:!1}function Io(e,t,n){let r=U(e)&&U(e.settings)?e.settings:{},i=new Set(Array.isArray(r.hidden)?r.hidden.filter(e=>typeof e==`string`&&t.includes(e)):[]),a=new Set(t),o=[];for(let e of Array.isArray(r.sections)?r.sections:[])Fo(e)&&!a.has(e.id)&&(a.add(e.id),(!e.admin||n)&&o.push(e));return{hidden:i,sections:o}}function Lo(e){let t=[];for(let n of e){let e=n.group??``,r=t.find(t=>t.group===e);r?r.sections.push(n):t.push({group:e,sections:[n]})}return t}function Ro(e,t){if(typeof e==`string`)return e;if(!U(e))return null;let n=t.toLowerCase();for(let t of[n,n.split(`-`)[0],`en`]){let n=Object.entries(e).find(([e])=>e.toLowerCase()===t)?.[1];if(typeof n==`string`)return n}return Object.values(e).find(e=>typeof e==`string`)??null}function zo(e){return/[\u0000-\u001f\\]/.test(e)||e.length>500?!1:/^\/(?![/\\])/.test(e)||/^https?:\/\/[^\s/]+/i.test(e)}function W(e,t,n){let r=U(e)&&Array.isArray(e.footerLinks)?e.footerLinks:[],i=[];for(let e of r.slice(0,8)){if(!U(e))continue;let r=Ro(e.label,t),a=Ro(e.href,t);if(!r||!Po(r,60)||!a||!zo(a)||n&&Array.isArray(e.placements)&&!e.placements.some(e=>e===n&&Mo.includes(e)))continue;let o=typeof e.icon==`string`&&zo(e.icon)?e.icon:null;i.push({label:r,href:a,newTab:e.newTab===!0||/^https?:/i.test(a),icon:o})}return i}function Bo(e){let t=U(e)?e.loginForm:void 0;return U(t)&&typeof t.mount==`function`?t:null}function Vo(e){let t=U(e)?e.passwordCard:void 0;return!U(t)||typeof t.mount!=`function`?null:{mount:t.mount,...typeof t.applies==`function`?{applies:t.applies}:{}}}function Ho(e){let t=U(e)?e.onboarding:void 0;return U(t)&&typeof t.mount==`function`?t:null}function Uo(e){if(typeof e!=`string`||e.length>500)return null;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&!t.username&&!t.password?t.toString():null}catch{return null}}function Wo(e,t,n){let r=U(e)&&U(e.starterPacks)?e.starterPacks:{},i=Array.isArray(r.packs)?r.packs:[],a=new Map;if(r.replace!==!0)for(let e of t)a.set(e.id,e);for(let e of i.slice(0,12))U(e)&&typeof e.id==`string`&&No.test(e.id)&&Array.isArray(e.feeds)&&a.set(e.id,e);let o=[];for(let e of a.values()){let t=Ro(e.title,n);if(!t||!Po(t,60))continue;let r=[];for(let t of e.feeds.slice(0,20)){if(!U(t)||!Po(t.title,80))continue;let e=Uo(t.url);e&&r.push({title:t.title,url:e,lang:typeof t.lang==`string`?t.lang.toLowerCase().split(`-`)[0]:``})}r.length>0&&o.push({id:e.id,title:t,description:Ro(e.description,n)??``,feeds:r})}return o}function Go(e){let t=U(e)?e.articlesNotice:void 0;return!U(t)||typeof t.mount!=`function`?null:{mount:t.mount,...typeof t.applies==`function`?{applies:t.applies}:{}}}function Ko(e,t){let n=U(e)&&U(e.meta)?e.meta:{},r=Ro(n.title,t)?.trim()??null,i=Ro(n.description,t)?.trim()??null;return{title:r&&Po(r,80)?r:null,description:i&&Po(i,300)?i:null}}var qo=0;function Jo(e){let t=()=>{qo++,e()};return window.addEventListener(jo,t),()=>window.removeEventListener(jo,t)}function Yo(){return(0,_.useSyncExternalStore)(Jo,()=>qo),window.feedkeeperExtensions}var Xo={login:`mt-4 justify-center text-xs`,menu:`border-t border-[var(--c-border)] px-3 py-2.5 text-xs`,page:`mt-10 border-t border-[var(--c-border)] pt-4 text-xs`};function Zo({placement:e}){let{t,i18n:n}=L(),r=W(Yo(),n.resolvedLanguage||`en`,e);return r.length===0?null:(0,H.jsx)(`nav`,{"aria-label":t(`nav.footerLinks`),className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[var(--c-text-muted)] ${Xo[e]}`,children:r.map((e,t)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[t>0&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`opacity-50`,children:`•`}),(0,H.jsxs)(`a`,{href:e.href,...e.newTab?{target:`_blank`,rel:`noopener noreferrer`}:{},className:`transition-colors hover:text-[var(--c-text)] hover:underline`,children:[e.icon&&(0,H.jsx)(`img`,{src:e.icon,alt:``,width:14,height:14,className:`mr-1.5 inline-block align-[-2px]`}),e.label]})]},`${e.href}-${t}`))})}var Qo={light:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,H.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41`})]}),dark:(0,H.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`}),system:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`path`,{d:`M12 3a9 9 0 0 1 0 18Z`,fill:`currentColor`,stroke:`none`})]})},$o=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-[var(--c-text)] transition-colors hover:bg-[var(--c-surface-hover)] focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] cursor-pointer`;function es(){let{t:e}=L(),{user:t,logout:n}=so(),r=ur(),i=(0,_.useSyncExternalStore)(_o,vo),a=(0,_.useSyncExternalStore)(Eo,Do),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useId)();if((0,_.useEffect)(()=>s(!1),[r.pathname]),(0,_.useEffect)(()=>{if(!o)return;let e=e=>{c.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&(s(!1),l.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[o]),!t)return null;let d={light:e(`settings.themeLight`),dark:e(`settings.themeDark`),system:e(`settings.themeSystem`)};return(0,H.jsxs)(`div`,{ref:c,className:`relative`,children:[(0,H.jsx)(`button`,{ref:l,type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-controls":u,"aria-label":e(`nav.account`),title:t.display_name||t.email,className:`flex rounded-full transition-shadow cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--c-blue3)] ${o||r.pathname.startsWith(`/settings`)?`ring-2 ring-[var(--c-blue3)] ring-offset-2 ring-offset-[var(--c-surface)]`:`hover:ring-2 hover:ring-[var(--c-border)] hover:ring-offset-2 hover:ring-offset-[var(--c-surface)]`}`,children:(0,H.jsx)(Ao,{user:t,className:`h-9 w-9 text-xs`})}),o&&(0,H.jsxs)(`div`,{id:u,className:`card animate-fade-in absolute right-0 top-full z-50 mt-2 w-72 max-w-[calc(100vw-2rem)] p-1.5 shadow-xl`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 px-3 pt-2 pb-3`,children:[(0,H.jsx)(Ao,{user:t,className:`h-10 w-10 text-sm`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-[var(--c-text)]`,children:t.display_name||t.email}),t.display_name&&(0,H.jsx)(`p`,{className:`truncate text-xs text-[var(--c-text-muted)]`,children:t.email})]})]}),(0,H.jsxs)(`div`,{className:`border-t border-[var(--c-border)] px-3 py-3`,children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:e(`settings.theme`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-3 gap-1 rounded-xl border border-[var(--c-border)] p-0.5`,role:`group`,"aria-label":e(`settings.theme`),children:Object.keys(Qo).map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>yo(e),"aria-pressed":i===e,className:`flex h-8 items-center justify-center gap-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${i===e?`border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] text-[var(--c-text)] shadow-sm`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,H.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:Qo[e]}),d[e]]},e))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col border-t border-[var(--c-border)] pt-1.5`,children:[(0,H.jsxs)(Ai,{to:`/settings`,className:`${$o} max-md:hidden`,children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4 text-[var(--c-text-muted)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,H.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),e(`nav.settings`)]}),a===`prompt`&&(0,H.jsxs)(`button`,{type:`button`,className:$o,onClick:()=>{s(!1),Oo()},children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4 text-[var(--c-text-muted)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M12 3v12M7 10l5 5 5-5`}),(0,H.jsx)(`path`,{d:`M5 21h14`})]}),e(`settings.installApp`)]}),(0,H.jsxs)(`button`,{type:`button`,className:`${$o} text-[var(--c-danger)]! hover:bg-[var(--c-danger-bg)]!`,onClick:()=>{s(!1),n()},children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}),(0,H.jsx)(`polyline`,{points:`16 17 21 12 16 7`}),(0,H.jsx)(`line`,{x1:`21`,y1:`12`,x2:`9`,y2:`12`})]}),e(`nav.logout`)]})]}),(0,H.jsx)(Zo,{placement:`menu`})]})]})}function ts(e){return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}}function ns(){return(0,_.useSyncExternalStore)(ts,()=>navigator.onLine,()=>!0)}function rs(){let{t:e}=L(),t=(0,_.useSyncExternalStore)(ea,$i,()=>0);return ns()?null:(0,H.jsxs)(`div`,{role:`status`,className:`border-b px-4 py-2 text-center text-sm text-[var(--c-text-muted)]`,style:{borderColor:`var(--c-border)`,backgroundColor:`var(--c-surface)`},children:[e(`common.offlineBanner`),t>0&&` ${e(`common.offlinePending`,{count:t})}`]})}function is(){let{t:e}=L(),{refresh:t}=so();return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-[var(--c-bg)] px-6 text-center`,children:[(0,H.jsx)(`img`,{src:`/logo.svg`,alt:``,className:`h-12 w-12`}),(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,style:{fontFamily:`Manrope, sans-serif`},children:e(`common.offlineTitle`)}),(0,H.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`common.offlineText`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void t(),className:`btn-primary`,children:e(`common.retry`)})]})}var as=[],os=1,ss=new Set,cs=()=>ss.forEach(e=>e());function ls(e){return ss.add(e),()=>ss.delete(e)}function us(){return as}function ds(e){as=as.filter(t=>t.id!==e),cs()}function fs(e,t){let n=os++;as=[...as.slice(-2),{id:n,type:e,message:t}],cs(),window.setTimeout(()=>ds(n),e===`error`?7e3:4e3)}var G={success:e=>fs(`success`,e),error:e=>fs(`error`,e),info:e=>fs(`info`,e)};function ps(){let{t:e}=L(),t=(0,_.useSyncExternalStore)(ls,us);return(0,H.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed inset-x-0 bottom-[calc(6.5rem+env(safe-area-inset-bottom,0px))] z-[60] flex flex-col items-center gap-2 px-4 md:bottom-6`,children:t.map(t=>(0,H.jsxs)(`div`,{role:t.type===`error`?`alert`:`status`,className:`card animate-fade-in pointer-events-auto flex w-full max-w-md items-start gap-3 px-4 py-3 text-sm`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:[(0,H.jsx)(`span`,{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-white ${t.type===`error`?`bg-[var(--c-danger)]`:t.type===`info`?`bg-[var(--c-text-muted)]`:`bg-[var(--c-green3)]`}`,"aria-hidden":`true`,children:(0,H.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:t.type===`error`?(0,H.jsx)(`path`,{d:`M12 7v6M12 17h.01`}):t.type===`info`?(0,H.jsx)(`path`,{d:`M12 7h.01M12 11v6`}):(0,H.jsx)(`path`,{d:`m5 12 5 5 9-10`})})}),(0,H.jsx)(`p`,{className:`min-w-0 flex-1 text-[var(--c-text)]`,children:t.message}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>ds(t.id),"aria-label":e(`common.close`),className:`-mr-1 shrink-0 rounded p-0.5 text-[var(--c-text-muted)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,H.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]},t.id))})}function ms(){let{t:e}=L(),t=ur();(0,_.useEffect)(()=>{let e=()=>void La(),t=()=>document.visibilityState===`visible`&&e();return e(),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t)}},[]),(0,_.useEffect)(()=>{let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>void Qa(),800)},n=()=>document.visibilityState===`visible`&&t();t();let r=window.setInterval(t,12e4);window.addEventListener(`online`,t),document.addEventListener(`visibilitychange`,n);let i=to(t);return()=>{window.clearTimeout(e),window.clearInterval(r),window.removeEventListener(`online`,t),document.removeEventListener(`visibilitychange`,n),i()}},[]),(0,_.useEffect)(()=>{t.pathname!==`/items`&&(window.scrollTo({top:0,left:0,behavior:`instant`}),requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:`instant`})}))},[t.pathname]);let n=()=>{t.pathname===`/items`&&(Wa(),window.scrollTo({top:0,left:0,behavior:`smooth`}))},r=t.pathname.startsWith(`/feeds`)?1:t.pathname.startsWith(`/settings`)?2:0;return(0,H.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,H.jsx)(`header`,{"data-app-header":!0,className:`sticky top-0 z-30 backdrop-blur-md border-b`,style:{borderColor:`var(--c-border)`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`,paddingTop:`env(safe-area-inset-top, 0px)`},children:(0,H.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-3 flex items-center justify-between gap-4`,children:[(0,H.jsx)(Ai,{to:`/items`,onClick:n,className:`flex items-center gap-2.5 shrink-0 hover:opacity-85 transition-opacity`,children:(0,H.jsx)(uo,{size:28})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(po,{onItemsClick:n}),(0,H.jsx)(es,{})]})]})}),(0,H.jsx)(rs,{}),(0,H.jsx)(`main`,{className:`flex-1 max-w-5xl w-full mx-auto px-4 pt-4 pb-24 md:py-6`,children:(0,H.jsx)(`div`,{className:`animate-page-fade`,children:(0,H.jsx)(zr,{})},t.pathname)}),(0,H.jsx)(ps,{}),(0,H.jsx)(`nav`,{className:`mobile-bottom-nav md:hidden fixed left-3 right-3 max-w-sm mx-auto z-40 pointer-events-auto no-drag select-none`,"aria-label":e(`nav.menu`),children:(0,H.jsxs)(`div`,{className:`relative flex items-center justify-between p-1.5 rounded-full border backdrop-blur-2xl backdrop-saturate-180 transition-all duration-300 no-drag select-none`,style:{backgroundColor:`color-mix(in srgb, var(--c-surface) 80%, transparent)`,borderColor:`var(--c-border)`,borderWidth:`1px`,boxShadow:`0 2px 12px -4px rgba(0, 0, 0, 0.3)`},onContextMenu:e=>e.preventDefault(),children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-1.5 bottom-1.5 left-1.5 rounded-full bg-[var(--c-mobile-nav-active)] border border-[var(--c-mobile-nav-active-border)] shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] pointer-events-none no-drag`,style:{width:`calc((100% - 0.75rem) / 3)`,transform:`translateX(calc(${r} * 100%))`}}),(0,H.jsx)(Ai,{to:`/items`,onClick:n,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,H.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,H.jsx)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h12`})}),(0,H.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.items`)})]})}),(0,H.jsx)(Ai,{to:`/feeds`,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,H.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,H.jsxs)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M4 11a9 9 0 0 1 9 9`}),(0,H.jsx)(`path`,{d:`M4 4a16 16 0 0 1 16 16`}),(0,H.jsx)(`circle`,{cx:`5`,cy:`19`,r:`1`})]}),(0,H.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.feeds`)})]})}),(0,H.jsx)(Ai,{to:`/settings`,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,H.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,H.jsxs)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,H.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,H.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.settings`)})]})})]})})]})}function hs(){let{t:e}=L(),{refresh:t}=so(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1);async function f(r){r.preventDefault(),d(!0),l(null);try{await V.onboard({email:n,password:o,displayName:i}),await t()}catch{l(e(`common.error`))}finally{d(!1)}}return(0,H.jsx)(`div`,{className:`min-h-screen flex items-center justify-center px-4`,children:(0,H.jsxs)(`div`,{className:`card p-8 w-full max-w-md`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col items-center mb-6 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-3`,children:(0,H.jsx)(uo,{size:44})}),(0,H.jsx)(`p`,{className:`text-sm mt-1`,style:{color:`var(--c-text-muted)`},children:e(`onboarding.subtitle`)})]}),(0,H.jsxs)(`form`,{onSubmit:f,className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.emailLabel`)}),(0,H.jsx)(`input`,{type:`email`,required:!0,className:`input`,value:n,onChange:e=>r(e.target.value)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.displayNameLabel`)}),(0,H.jsx)(`input`,{type:`text`,required:!0,className:`input`,value:i,onChange:e=>a(e.target.value)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.passwordLabel`)}),(0,H.jsx)(`input`,{type:`password`,required:!0,minLength:10,className:`input`,value:o,onChange:e=>s(e.target.value)}),(0,H.jsx)(`p`,{className:`text-xs mt-1`,style:{color:`var(--c-text-muted)`},children:e(`onboarding.passwordHint`)})]}),c&&(0,H.jsx)(`p`,{className:`text-sm text-danger`,children:c}),(0,H.jsx)(`button`,{type:`submit`,disabled:u,className:`btn-primary`,children:e(`onboarding.submit`)})]}),(0,H.jsxs)(`div`,{className:`mt-6 pt-4 border-t text-sm`,style:{borderColor:`var(--c-border)`},children:[(0,H.jsx)(`p`,{className:`font-medium`,children:e(`onboarding.orUseCli`)}),(0,H.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(`onboarding.cliHint`)})]})]})})}function gs(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function _s(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function vs(){return ys.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var ys={stubThis:e=>e};function bs(e){let{id:t}=e;return{...e,id:_s(t),transports:e.transports,type:e.type}}function xs(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var Ss=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function Cs({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Ss({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new Ss({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new Ss({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new Ss({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new Ss({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Ss({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new Ss({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Ss({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!xs(t))return new Ss({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Ss({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new Ss({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new Ss({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var ws=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},Ts=[`cross-platform`,`platform`];function Es(e){if(e&&!(Ts.indexOf(e)<0))return e}async function Ds(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!vs())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:_s(t.challenge),user:{...t.user,id:_s(t.user.id)},excludeCredentials:t.excludeCredentials?.map(bs)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=ws.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Cs({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){Os(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=gs(e))}catch(e){Os(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=gs(c.getAuthenticatorData())}catch(e){Os(`getAuthenticatorData()`,e)}return{id:o,rawId:gs(s),response:{attestationObject:gs(c.attestationObject),clientDataJSON:gs(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Es(a.authenticatorAttachment)}}function Os(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function ks(){if(!vs())return As.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?As.stubThis(new Promise(e=>e(!1))):As.stubThis(e.isConditionalMediationAvailable())}var As={stubThis:e=>e};function js({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Ss({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Ss({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!xs(t))return new Ss({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Ss({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new Ss({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Ms(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!vs())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(bs));let a={...t,challenge:_s(t.challenge),allowCredentials:i},o={};if(n){if(!await ks())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=ws.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw js({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=gs(u.userHandle)),{id:c,rawId:gs(l),response:{authenticatorData:gs(u.authenticatorData),clientDataJSON:gs(u.clientDataJSON),signature:gs(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Es(s.authenticatorAttachment)}}async function Ns(e,t,n=`POST`,r){let i=await fetch(`/api/auth/security${e}`,{method:n,signal:r,credentials:`same-origin`,headers:{"Content-Type":`application/json`},...t===void 0?{}:{body:JSON.stringify(t)}}),a=i.status===204?void 0:await i.json();if(!i.ok)throw new ga(i.status,a.error,a);return a}async function Ps(){let e=await Ns(`/reauth/passkey/options`,{}),t=await Ms({optionsJSON:e.publicKey});return(await Ns(`/reauth/passkey/verify`,{challengeId:e.challengeId,credential:t})).reauthToken}async function Fs(e,t){let n=await Ns(`/passkeys/register/options`,{reauthToken:e}),r=await Ds({optionsJSON:n.publicKey});await Ns(`/passkeys/register/verify`,{challengeId:n.challengeId,credential:r,name:t})}function Is(e){let t,n;function r(){t?.abort(),t=void 0,clearTimeout(n)}async function i(a=!0){if(t&&a)return;r();let o=new AbortController,{signal:s}=o;t=o;let c=!1;try{if(a){let t=await window.PublicKeyCredential?.isConditionalMediationAvailable?.().catch(()=>!1)??!1;if(s.aborted||(e.onAutofill(t),!t))return}let t=await Ns(`/passkeys/options`,{},`POST`,s);if(s.aborted)return;a&&(n=setTimeout(()=>{r(),i()},24e4));let o=await navigator.credentials.get({signal:s,...a?{mediation:`conditional`}:{},publicKey:{...t.publicKey,extensions:t.publicKey.extensions,challenge:_s(t.publicKey.challenge),allowCredentials:a?[]:t.publicKey.allowCredentials?.map(e=>({type:`public-key`,id:_s(e.id),transports:e.transports}))}});if(s.aborted||!o)return;clearTimeout(n),c=!0,e.onSelect();let l=o.response,u={id:o.id,rawId:gs(o.rawId),type:o.type,clientExtensionResults:o.getClientExtensionResults(),response:{clientDataJSON:gs(l.clientDataJSON),authenticatorData:gs(l.authenticatorData),signature:gs(l.signature),userHandle:l.userHandle?gs(l.userHandle):null}};await Ns(`/passkeys/verify`,{challengeId:t.challengeId,credential:u},`POST`,s),s.aborted||await e.onSuccess()}catch(t){s.aborted||(c||!a?e.onError(t):(!(t instanceof Error)||t.name!==`NotAllowedError`)&&e.onAutofill(!1))}finally{t===o&&(clearTimeout(n),t=void 0)}}return{start:i,stop:r}}function Ls({name:e,mount:t}){let n=(0,_.useRef)(null),r=L().i18n.resolvedLanguage;return(0,_.useEffect)(()=>{let r=n.current;if(!r)return;let i;try{i=t(r)}catch(t){console.error(`[extensions] "${e}" failed to open`,t)}return()=>{try{typeof i==`function`&&i()}catch(t){console.error(`[extensions] "${e}" failed to close`,t)}r.replaceChildren()}},[e,r]),(0,H.jsx)(`div`,{ref:n,className:`min-w-0`})}function Rs(){let{t:e}=L(),{refresh:t}=so(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(),f=(0,_.useRef)(void 0),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!0),[S,C]=(0,_.useState)(`https://github.com/visualfusion/feedkeeper`),[w,T]=(0,_.useState)(null),E=Bo(Yo()),D=E?.mount,ee=(0,_.useEffectEvent)(async()=>{await k(),y(!1)}),O=(0,_.useEffectEvent)(()=>{g(e(`login.error`)),y(!1)});(0,_.useEffect)(()=>{if(!c||i||D)return;let e=Is({onAutofill:d,onSelect:()=>{y(!0),g(null)},onSuccess:ee,onError:O});f.current=e,e.start();let t=()=>{e.start()},n=()=>{e.stop(),y(!1)};return window.addEventListener(`pagehide`,n),window.addEventListener(`pageshow`,t),()=>{e.stop(),f.current=void 0,window.removeEventListener(`pagehide`,n),window.removeEventListener(`pageshow`,t)}},[c,i,D]),(0,_.useEffect)(()=>{Ns(`/config`,void 0,`GET`).then(e=>l(e.passkeys)).catch(()=>{}),V.getConfig().then(e=>{e&&(x(e.showGithubLink),e.githubUrl&&C(e.githubUrl),e.loginSubtitle&&T(e.loginSubtitle))}).catch(()=>{})},[]);async function te(t){if(t.preventDefault(),!v){f.current?.stop(),y(!0),g(null);try{i?await Ns(`/mfa`,{challengeId:i,code:o}):await V.login(n,p),await k()}catch(t){t instanceof ga&&t.code===`mfa_required`?(a(t.data.challengeId),m(``)):(g(e(`login.error`)),f.current?.start())}finally{y(!1)}}}async function k(){let e=new URLSearchParams(window.location.search).get(`next`);e?.startsWith(`/oauth/authorize?`)?window.location.assign(e):await t()}return(0,H.jsxs)(`div`,{className:`min-h-screen flex flex-col items-center justify-center px-4`,children:[(0,H.jsxs)(`div`,{className:`card p-8 w-full max-w-sm`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col items-center mb-6 text-center`,children:[(0,H.jsx)(`h1`,{className:`mb-3`,children:(0,H.jsx)(uo,{size:44})}),(0,H.jsx)(`p`,{className:`text-xs mt-1`,style:{color:`var(--c-text-muted)`},children:w??e(`login.subtitle`)})]}),E?(0,H.jsx)(Ls,{name:`login-form`,mount:E.mount}):(0,H.jsxs)(`form`,{onSubmit:te,className:`flex flex-col gap-4`,children:[!i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`login-email`,className:`text-sm font-medium block mb-1`,children:e(`login.emailLabel`)}),(0,H.jsx)(`input`,{id:`login-email`,name:`username`,type:`email`,autoComplete:`username webauthn`,required:!0,autoFocus:!0,className:`input`,value:n,onChange:e=>r(e.target.value),onFocus:()=>{v||f.current?.start()}})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{htmlFor:`login-password`,className:`text-sm font-medium block mb-1`,children:e(`login.passwordLabel`)}),(0,H.jsx)(`input`,{type:`password`,id:`login-password`,name:`password`,autoComplete:`current-password`,required:!0,className:`input`,value:p,onChange:e=>m(e.target.value)})]})]}),i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`label`,{htmlFor:`mfa-code`,children:e(`security.code`)}),(0,H.jsx)(`input`,{id:`mfa-code`,className:`input`,autoFocus:!0,autoComplete:`one-time-code`,value:o,onChange:e=>s(e.target.value),required:!0}),(0,H.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{a(void 0),s(``)},children:e(`security.cancel`)})]}),c&&!i&&u===!1&&(0,H.jsx)(`button`,{type:`button`,className:`text-sm underline`,disabled:v,onClick:()=>void f.current?.start(!1),children:e(`security.signInPasskey`)}),h&&(0,H.jsx)(`p`,{className:`text-sm text-danger`,children:h}),(0,H.jsx)(`button`,{type:`submit`,disabled:v,className:`btn-primary`,children:e(`login.submit`)})]})]}),(0,H.jsx)(Zo,{placement:`login`}),b&&(0,H.jsx)(`div`,{className:`mt-4 text-center`,children:(0,H.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-[var(--c-text-muted)] hover:text-[var(--c-text)] transition-colors opacity-80 hover:opacity-100`,children:[(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,H.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.53 1.032 1.53 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z`})}),(0,H.jsx)(`span`,{children:e(`login.viewOnGithub`)})]})})]})}function zs({className:e=``,size:t=`md`,center:n=!0}){let{t:r}=L(),i=(0,H.jsx)(`div`,{className:`rounded-full animate-spin border-[var(--c-border)] border-t-[var(--c-blue1)] dark:border-t-white/80 ${{sm:`w-5 h-5 border-2`,md:`w-8 h-8 border-[2.5px]`,lg:`w-10 h-10 border-3`}[t]} ${e}`,role:`status`,"aria-label":r(`common.loading`)});return n?(0,H.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center min-h-[45vh] w-full py-12 animate-fade-in`,children:i}):i}function Bs({label:e,items:t,className:n=``}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useId)();return(0,_.useLayoutEffect)(()=>{if(!r||!c.current)return;let e=c.current.getBoundingClientRect();o(window.innerHeight-e.bottom<48*t.length+24)},[r,t.length]),(0,_.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&(i(!1),c.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,H.jsxs)(`div`,{ref:s,className:`relative ${n}`,children:[(0,H.jsx)(`button`,{ref:c,type:`button`,onClick:e=>{e.stopPropagation(),i(e=>!e)},"aria-label":e,title:e,"aria-expanded":r,"aria-controls":l,className:`flex h-9 w-9 items-center justify-center rounded-lg text-[var(--c-text-muted)] transition-colors hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] cursor-pointer ${r?`bg-[var(--c-surface-hover)] text-[var(--c-text)]`:``}`,children:(0,H.jsxs)(`svg`,{className:`h-5 w-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.8`}),(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.8`}),(0,H.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.8`})]})}),r&&(0,H.jsx)(`div`,{id:l,className:`card animate-fade-in absolute right-0 z-40 w-64 p-1.5 ${a?`bottom-full mb-2`:`top-full mt-2`}`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:t.map(e=>(0,H.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:t=>{t.stopPropagation(),i(!1),e.onSelect()},className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors disabled:opacity-50 cursor-pointer disabled:cursor-default ${e.danger?`text-[var(--c-danger)] hover:bg-[var(--c-danger-bg)]`:`text-[var(--c-text)] hover:bg-[var(--c-surface-hover)]`}`,children:[e.icon&&(0,H.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center ${e.danger?``:`text-[var(--c-text-muted)]`}`,children:e.icon}),e.label]},e.label))})]})}function Vs(){let{user:e}=so(),t=e?.capabilities;return{syncAllowed:!t||t.features.sync===!0,manageUrl:t?.manageUrl??null}}function Hs({value:e,onChange:t,options:n,placeholder:r,className:i=``,size:a=`md`,disabled:o=!1,ariaLabel:s}){let{t:c}=L(),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(-1),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=(0,_.useId)(),g=n.find(t=>t.value===e);(0,_.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&u(!1)}if(l)return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[l]),(0,_.useEffect)(()=>{if(l){let t=n.findIndex(t=>t.value===e);f(t>=0?t:0)}},[l,e,n]),(0,_.useEffect)(()=>{if(l&&d>=0&&m.current){let e=m.current.querySelector(`[data-index="${d}"]`);e&&e.scrollIntoView({block:`nearest`})}},[d,l]);function v(e){if(!o){if(!l){(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(!0));return}e.key===`Escape`?(e.preventDefault(),u(!1)):e.key===`ArrowDown`?(e.preventDefault(),f(e=>e<n.length-1?e+1:0)):e.key===`ArrowUp`?(e.preventDefault(),f(e=>e>0?e-1:n.length-1)):e.key===`Home`?(e.preventDefault(),f(0)):e.key===`End`?(e.preventDefault(),f(n.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d>=0&&d<n.length&&(t(n[d].value),u(!1)))}}let y=[];n.forEach((e,t)=>{let n=e.group??null,r=y.find(e=>e.groupName===n);r||(r={groupName:n,items:[]},y.push(r)),r.items.push({opt:e,index:t})});let b=a===`sm`;return(0,H.jsxs)(`div`,{ref:p,className:`relative inline-block ${i}`,onKeyDown:v,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u(!1)},children:[(0,H.jsxs)(`button`,{type:`button`,id:h,role:`combobox`,"aria-label":s,"aria-haspopup":`listbox`,"aria-expanded":l,"aria-controls":l?`${h}-listbox`:void 0,"aria-activedescendant":l&&d>=0?`${h}-option-${d}`:void 0,disabled:o,onClick:()=>!o&&u(e=>!e),className:`w-full flex items-center justify-between gap-2 text-left font-normal transition-colors cursor-pointer select-none rounded-lg border bg-[var(--c-surface)] text-[var(--c-text)] shadow-xs hover:border-[var(--c-blue3)] focus:outline-none focus:border-[var(--c-blue3)] ${l?`border-[var(--c-blue3)]`:`border-[var(--c-border)]`} ${b?`px-2.5 py-1 text-xs min-h-[30px]`:`px-3 py-1.5 text-sm min-h-[38px]`} ${o?`opacity-50 cursor-not-allowed`:``}`,children:[(0,H.jsx)(`span`,{className:`truncate flex items-center gap-1.5`,children:g?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`truncate`,children:g.label}),g.badge!==void 0&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.2 rounded-full font-medium shrink-0`,style:{backgroundColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:g.badge})]}):(0,H.jsx)(`span`,{style:{color:`var(--c-text-muted)`},children:r??`—`})}),(0,H.jsx)(`svg`,{className:`shrink-0 transition-transform duration-200 opacity-60 ${l?`rotate-180`:``} ${b?`w-3 h-3`:`w-3.5 h-3.5`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,H.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})]}),l&&(0,H.jsx)(`div`,{className:`absolute left-0 mt-1 w-full min-w-[180px] max-w-xs sm:max-w-none rounded-lg border border-[var(--c-border)] bg-[var(--c-surface)] shadow-lg z-50 overflow-hidden`,style:{backdropFilter:`blur(8px)`},children:(0,H.jsx)(`ul`,{ref:m,id:`${h}-listbox`,role:`listbox`,"aria-labelledby":h,className:`max-h-60 overflow-y-auto py-1 text-[var(--c-text)] focus:outline-none`,children:n.length===0?(0,H.jsx)(`li`,{className:`px-3 py-2 text-xs italic`,style:{color:`var(--c-text-muted)`},children:r??c(`common.noOptions`)}):y.map((n,r)=>(0,H.jsxs)(`li`,{role:`group`,"aria-label":n.groupName??void 0,children:[n.groupName&&(0,H.jsx)(`div`,{className:`px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wider select-none border-t first:border-t-0`,style:{borderColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:n.groupName}),(0,H.jsx)(`ul`,{role:`presentation`,children:n.items.map(({opt:n,index:r})=>{let i=n.value===e,a=r===d;return(0,H.jsxs)(`li`,{id:`${h}-option-${r}`,"data-index":r,role:`option`,"aria-selected":i,onClick:()=>{t(n.value),u(!1)},onMouseEnter:()=>f(r),className:`flex items-center justify-between gap-2 cursor-pointer select-none transition-colors ${b?`px-2.5 py-1.5 text-xs`:`px-3 py-2 text-sm`} ${a?`bg-[var(--c-border)]/40 text-[var(--c-text)]`:`text-[var(--c-text)]`} ${i?`font-medium bg-[var(--c-blue1)]/10`:``}`,children:[(0,H.jsxs)(`span`,{className:`truncate flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:n.label}),n.badge!==void 0&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.2 rounded-full font-medium shrink-0`,style:{backgroundColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:n.badge})]}),i&&(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,style:{color:`var(--c-blue3)`},viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})]},n.value)})})]},n.groupName??`ungrouped-${r}`))})})]})}var Us=new Map;function Ws(e){let t=Us.get(e);return t||(t=new Promise(t=>{let n=new Image;n.onload=()=>t(n.naturalWidth>0&&n.naturalHeight>0),n.onerror=()=>t(!1),n.src=e}),Us.set(e,t)),t}function Gs({feedId:e,iconUrl:t,siteUrl:n,feedUrl:r,articleUrl:i,className:a}){let o=JSON.stringify([e,t,n,r,i]),[s,c]=(0,_.useState)(null);return(0,_.useEffect)(()=>{let a=!1;c(null);async function s(){if(e){let t=`/api/feeds/${e}/icon`;await Ws(t)&&(a||c({key:o,url:t}));return}let s=new Set;t&&/^https?:\/\//i.test(t)&&s.add(t);for(let e of[n,r,i])if(e)try{let t=new URL(e);(t.protocol===`https:`||t.protocol===`http:`)&&s.add(`${t.origin}/favicon.ico`)}catch{}for(let e of s)if(await Ws(e)){a||c({key:o,url:e});return}}return s(),()=>{a=!0}},[o]),!s||s.key!==o?null:(0,H.jsx)(`img`,{src:s.url,alt:``,className:a,loading:`lazy`,onError:()=>{Us.set(s.url,Promise.resolve(!1)),c(null)}})}var Ks=[[`day`,864e5],[`hour`,36e5],[`minute`,6e4]];function qs(e,t,n=Date.now()){let r=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),i=e.getTime()-n;for(let[e,t]of Ks)if(Math.abs(i)>=t)return r.format(Math.round(i/t),e);return r.format(0,`minute`)}function Js({children:e,className:t=`h-4 w-4`}){return(0,H.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e})}var Ys=({className:e})=>(0,H.jsxs)(Js,{className:e,children:[(0,H.jsx)(`path`,{d:`M21 12a9 9 0 1 1-2.64-6.36`}),(0,H.jsx)(`path`,{d:`M21 3v6h-6`})]}),Xs=()=>(0,H.jsx)(Js,{children:(0,H.jsx)(`path`,{d:`M2 12l4 4 6-7M10 16l2 0 8-9`})}),Zs=()=>(0,H.jsxs)(Js,{children:[(0,H.jsx)(`path`,{d:`M12 20h9`}),(0,H.jsx)(`path`,{d:`M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),Qs=()=>(0,H.jsx)(Js,{children:(0,H.jsx)(`path`,{d:`M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6`})}),$s=({className:e})=>(0,H.jsx)(Js,{className:e,children:(0,H.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),ec=()=>(0,H.jsxs)(Js,{children:[(0,H.jsx)(`path`,{d:`M12 15V3M7 8l5-5 5 5`}),(0,H.jsx)(`path`,{d:`M5 21h14`})]}),tc=()=>(0,H.jsxs)(Js,{children:[(0,H.jsx)(`path`,{d:`M12 3v12M7 10l5 5 5-5`}),(0,H.jsx)(`path`,{d:`M5 21h14`})]}),nc=()=>(0,H.jsx)(Js,{children:(0,H.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}),rc=()=>(0,H.jsxs)(Js,{className:`h-4 w-4`,children:[(0,H.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,H.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),ic=()=>(0,H.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[6,12,18].flatMap(e=>[9,15].map(t=>(0,H.jsx)(`circle`,{cx:t,cy:e,r:`1.5`},`${t}-${e}`)))}),ac=()=>(0,H.jsx)(Js,{className:`h-5 w-5`,children:(0,H.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),oc=()=>(0,H.jsxs)(Js,{className:`h-3.5 w-3.5 shrink-0`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`path`,{d:`M12 8v4M12 16h.01`})]}),sc=({className:e=`h-3.5 w-3.5`})=>(0,H.jsxs)(Js,{className:e,children:[(0,H.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,H.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]});function cc(e,t){return t<60?e(`feeds.minutesShort`,{count:t}):e(`feeds.hoursShort`,{count:Math.round(t/60)})}function lc(e){try{return e?new URL(e).hostname.replace(/^www\./,``):null}catch{return null}}function uc({feed:e,folderOptions:t,intervalOptions:n,onClose:r,onSaved:i}){let{t:a}=L(),[o,s]=(0,_.useState)(e.label?.trim()||e.title?.trim()||e.url),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(e.folder_id??null),[f,p]=(0,_.useState)(e.poll_interval_minutes),[m,h]=(0,_.useState)(e.full_text_mode!==`never`),[g,v]=(0,_.useState)(e.notify!==0),[y,b]=(0,_.useState)(e.badge!==0),[x,S]=(0,_.useState)(!1);async function C(){S(!0);try{await V.updateFeed(e.id,{...c?{label:o.trim()||null}:{},folderId:u,pollIntervalMinutes:f,fullTextMode:m?`auto`:`never`,notify:g,badge:y}),eo(),G.success(a(`feeds.changesSaved`)),r(),await i()}catch{G.error(a(`common.error`))}finally{S(!1)}}return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-[var(--c-border)] bg-[var(--c-bg)]/60 px-4 py-4 sm:px-5`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.labelPlaceholder`),(0,H.jsx)(`input`,{type:`text`,className:`input text-sm`,placeholder:e.title??e.url,value:o,onChange:e=>{s(e.target.value),l(!0)}})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.folder`),(0,H.jsx)(Hs,{value:u?String(u):``,onChange:e=>d(e?Number(e):null),options:t,className:`w-full`,placeholder:a(`feeds.noFolder`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.interval`),(0,H.jsx)(Hs,{value:String(f),onChange:e=>p(Number(e)),options:n,className:`w-full`})]})]}),(0,H.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:m,onChange:e=>h(e.target.checked)}),(0,H.jsxs)(`span`,{children:[a(`feeds.fullText`),(0,H.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:e.full_text_blocked_at?a(`feeds.fullTextBlocked`):a(`feeds.fullTextHint`)})]})]}),Ga()&&(0,H.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:g,onChange:e=>v(e.target.checked)}),(0,H.jsxs)(`span`,{children:[a(`feeds.notify`),(0,H.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:a(`feeds.notifyHint`)})]})]}),`setAppBadge`in navigator&&(0,H.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:y,onChange:e=>b(e.target.checked)}),(0,H.jsxs)(`span`,{children:[a(`feeds.badge`),(0,H.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:a(`feeds.badgeHint`)})]})]}),(0,H.jsx)(`p`,{className:`truncate font-mono text-xs text-[var(--c-text-muted)]`,title:e.url,children:e.url}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:r,className:`btn-secondary px-3 py-1.5 text-sm`,children:a(`common.cancel`)}),(0,H.jsx)(`button`,{type:`button`,onClick:C,disabled:x,className:`btn-primary px-4 py-1.5 text-sm`,children:a(`common.save`)})]})]})}function dc({feed:e,editing:t,refreshing:n,highlighted:r=!1,folderOptions:i,intervalOptions:a,onEdit:o,onRefresh:s,onMarkRead:c,onUnsubscribe:l,onSaved:u,drag:d}){let{t:f,i18n:p}=L(),{syncAllowed:m}=Vs(),h=e.label??e.title??e.url,g=lc(e.site_url)??lc(e.url),_=!!e.last_error,v=!e.last_polled_at,y=[{label:f(n?`feeds.refreshing`:`feeds.refreshFeed`),icon:(0,H.jsx)(Ys,{className:`h-4 w-4 ${n?`animate-spin`:``}`}),onSelect:s,disabled:n||!m},...e.unread_count>0?[{label:f(`feeds.markAllRead`),icon:(0,H.jsx)(Xs,{}),onSelect:c}]:[],{label:f(`feeds.edit`),icon:(0,H.jsx)(Zs,{}),onSelect:()=>o(!t)},{label:f(`feeds.unsubscribe`),icon:(0,H.jsx)(Qs,{}),onSelect:l,danger:!0}];return(0,H.jsxs)(`li`,{id:`feed-${e.id}`,draggable:!!d&&!t,onDragStart:d?.onDragStart,onDragOver:d?.onDragOver,onDragEnd:d?.onDragEnd,className:`group/feed relative scroll-mt-28 first:rounded-t-xl last:rounded-b-xl transition-[opacity,background-color] duration-700 ${r?`bg-[var(--c-mobile-nav-active)]`:``} ${d?.isDragging?`opacity-40`:``} ${d?.isDragOver?`shadow-[inset_0_2px_0_var(--c-blue3)]`:``}`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5 sm:px-5`,children:[d&&(0,H.jsx)(`span`,{className:`absolute left-0.5 top-[1.4rem] hidden cursor-grab text-[var(--c-text-muted)] opacity-0 transition-opacity group-hover/feed:opacity-60 active:cursor-grabbing sm:block`,title:f(`feeds.dragHandle`),"aria-hidden":`true`,children:(0,H.jsx)(ic,{})}),(0,H.jsx)(Gs,{feedId:e.id,iconUrl:e.icon_url,siteUrl:e.site_url,feedUrl:e.url,className:`h-5 w-5 shrink-0 rounded object-contain`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(_||v)&&(0,H.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${_?`bg-[var(--c-danger)]`:`bg-[var(--c-text-muted)]`}`,title:_?f(`feeds.statusFailing`,{count:e.consecutive_errors||1}):f(`feeds.statusPending`)}),(0,H.jsx)(ki,{to:`/items?feed=${e.id}`,className:`truncate font-semibold text-[var(--c-text)] hover:underline`,children:h}),e.notify!==0&&(0,H.jsx)(`span`,{className:`inline-flex shrink-0 items-center text-[var(--c-text-muted)]`,title:f(`feeds.notifyActive`),"aria-label":f(`feeds.notifyActive`),children:(0,H.jsx)(sc,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-[var(--c-text-muted)]`,children:[g,f(`feeds.everyInterval`,{interval:cc(f,e.poll_interval_minutes)}),e.last_polled_at?f(`feeds.checkedAgo`,{time:qs(new Date(e.last_polled_at),p.resolvedLanguage)}):f(`feeds.statusPending`)].filter(Boolean).join(` · `)}),_&&(0,H.jsxs)(`p`,{className:`mt-1.5 flex items-start gap-1.5 text-xs text-[var(--c-danger)]`,title:e.last_error??void 0,children:[(0,H.jsx)(oc,{}),(0,H.jsx)(`span`,{className:`line-clamp-2 break-all`,children:e.last_error})]})]}),e.unread_count>0&&(0,H.jsx)(ki,{to:`/items?feed=${e.id}`,className:`shrink-0 rounded-full bg-[var(--c-mobile-nav-active)] px-2.5 py-0.5 text-xs font-semibold tabular-nums text-[var(--c-text)] hover:bg-[var(--c-border)]`,title:f(`feeds.unread`,{count:e.unread_count}),children:e.unread_count}),(0,H.jsx)(Bs,{label:f(`feeds.moreActions`),items:y,className:`-mr-2 shrink-0`})]}),t&&(0,H.jsx)(uc,{feed:e,folderOptions:i,intervalOptions:a,onClose:()=>o(!1),onSaved:u})]})}var fc=[{id:`news`,title:{en:`News`,de:`Nachrichten`,ja:`ニュース`},description:{en:`Headlines from public broadcasters and newspapers.`,de:`Schlagzeilen von öffentlich-rechtlichen Sendern und Zeitungen.`,ja:`放送局や新聞社の主要ニュース。`},feeds:[{title:`Tagesschau`,url:`https://www.tagesschau.de/index~rss2.xml`,lang:`de`},{title:`Deutschlandfunk Nachrichten`,url:`https://www.deutschlandfunk.de/nachrichten-100.rss`,lang:`de`},{title:`ZEIT ONLINE`,url:`https://newsfeed.zeit.de/index`,lang:`de`},{title:`DER SPIEGEL`,url:`https://www.spiegel.de/schlagzeilen/index.rss`,lang:`de`},{title:`BBC News`,url:`https://feeds.bbci.co.uk/news/rss.xml`,lang:`en`},{title:`The Guardian – World`,url:`https://www.theguardian.com/world/rss`,lang:`en`},{title:`NPR News`,url:`https://feeds.npr.org/1001/rss.xml`,lang:`en`},{title:`NHK 主要ニュース`,url:`https://www.nhk.or.jp/rss/news/cat0.xml`,lang:`ja`},{title:`NHK 国際`,url:`https://www3.nhk.or.jp/rss/news/cat6.xml`,lang:`ja`},{title:`朝日新聞デジタル`,url:`https://www.asahi.com/rss/asahi/newsheadlines.rdf`,lang:`ja`}]},{id:`technology`,title:{en:`Technology`,de:`Technik`,ja:`テクノロジー`},description:{en:`News and background on software, hardware and the web.`,de:`Nachrichten und Hintergründe zu Software, Hardware und Netz.`,ja:`ソフトウェア、ハードウェア、ウェブのニュースと解説。`},feeds:[{title:`heise online`,url:`https://www.heise.de/rss/heise-atom.xml`,lang:`de`},{title:`Golem.de`,url:`https://www.golem.de/rss.php?feed=RSS2.0`,lang:`de`},{title:`netzpolitik.org`,url:`https://netzpolitik.org/feed/`,lang:`de`},{title:`Ars Technica`,url:`https://feeds.arstechnica.com/arstechnica/index`,lang:`en`},{title:`The Verge`,url:`https://www.theverge.com/rss/index.xml`,lang:`en`},{title:`Hacker News`,url:`https://hnrss.org/frontpage`,lang:`en`},{title:`ITmedia`,url:`https://rss.itmedia.co.jp/rss/2.0/itmedia_all.xml`,lang:`ja`},{title:`GIGAZINE`,url:`https://gigazine.net/news/rss_2.0/`,lang:`ja`},{title:`Publickey`,url:`https://www.publickey1.jp/atom.xml`,lang:`ja`},{title:`ギズモード・ジャパン`,url:`https://www.gizmodo.jp/index.xml`,lang:`ja`}]},{id:`apple`,title:{en:`Apple`,de:`Apple`,ja:`Apple`},description:{en:`iPhone, Mac and everything around them.`,de:`iPhone, Mac und alles drumherum.`,ja:`iPhone、Macとその周辺の話題。`},feeds:[{title:`iPhone-Ticker`,url:`https://www.iphone-ticker.de/feed/`,lang:`de`},{title:`apfelpatient`,url:`https://www.apfelpatient.de/feed`,lang:`de`},{title:`Macerkopf`,url:`https://www.macerkopf.de/feed/`,lang:`de`},{title:`ifun.de`,url:`https://www.ifun.de/feed/`,lang:`de`},{title:`MacTechNews`,url:`https://www.mactechnews.de/Rss/News.x`,lang:`de`},{title:`Daring Fireball`,url:`https://daringfireball.net/feeds/main`,lang:`en`},{title:`MacStories`,url:`https://www.macstories.net/feed/`,lang:`en`},{title:`MacRumors`,url:`https://feeds.macrumors.com/MacRumors-All`,lang:`en`},{title:`9to5Mac`,url:`https://9to5mac.com/feed/`,lang:`en`},{title:`iPhone Mania`,url:`https://iphone-mania.jp/feed/`,lang:`ja`},{title:`Apple Info. (Applech2)`,url:`https://applech2.com/feed`,lang:`ja`}]},{id:`science`,title:{en:`Science`,de:`Wissenschaft`,ja:`科学`},description:{en:`Research, space and nature.`,de:`Forschung, Weltraum und Natur.`,ja:`研究、宇宙、自然。`},feeds:[{title:`Spektrum der Wissenschaft`,url:`https://www.spektrum.de/alias/rss/spektrum-de-rss-feed/996406`,lang:`de`},{title:`scinexx`,url:`https://www.scinexx.de/feed/`,lang:`de`},{title:`Quanta Magazine`,url:`https://www.quantamagazine.org/feed/`,lang:`en`},{title:`NASA`,url:`https://www.nasa.gov/feed/`,lang:`en`},{title:`Nature`,url:`https://www.nature.com/nature.rss`,lang:`en`},{title:`ScienceDaily`,url:`https://www.sciencedaily.com/rss/all.xml`,lang:`en`},{title:`sorae 宇宙へのポータルサイト`,url:`https://sorae.info/feed`,lang:`ja`},{title:`ナゾロジー`,url:`https://nazology.kusuguru.co.jp/feed`,lang:`ja`},{title:`日経サイエンス`,url:`https://www.nikkei-science.com/?feed=rss2`,lang:`ja`}]},{id:`design`,title:{en:`Design`,de:`Design`,ja:`デザイン`},description:{en:`Web design, interfaces and creative work.`,de:`Webdesign, Oberflächen und kreative Arbeit.`,ja:`ウェブデザイン、UI、クリエイティブ。`},feeds:[{title:`Smashing Magazine`,url:`https://www.smashingmagazine.com/feed/`,lang:`en`},{title:`A List Apart`,url:`https://alistapart.com/main/feed/`,lang:`en`},{title:`UX Collective`,url:`https://uxdesign.cc/feed`,lang:`en`},{title:`Creative Bloq`,url:`https://www.creativebloq.com/feeds/all`,lang:`en`},{title:`designboom`,url:`https://www.designboom.com/feed/`,lang:`en`},{title:`コリス`,url:`https://coliss.com/feed/`,lang:`ja`},{title:`AXIS`,url:`https://www.axismag.jp/feed`,lang:`ja`},{title:`Web Creator Box`,url:`https://www.webcreatorbox.com/feed`,lang:`ja`}]}];function pc(e,t){let n=t.toLowerCase().split(`-`)[0],r=e.feeds.filter(e=>e.lang===n||e.lang===``),i=n===`en`||n===`ja`&&r.length>0?[]:e.feeds.filter(e=>e.lang===`en`);return[...r,...i]}function mc({folderOptions:e,defaultFolderId:t,initialUrl:n=``,compact:r=!1,onClose:i,onAdded:a}){let{t:o}=L(),[s,c]=(0,_.useState)(n),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(t),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)([]);async function v(e,t){m(!0),g([]);try{let n=await V.subscribeFeed(e,t,d);c(``),u(``),await a(n)}catch(e){e instanceof ga&&e.code===`multiple_feeds_found`&&e.data&&typeof e.data==`object`&&`feeds`in e.data?g(e.data.feeds):e instanceof ga&&e.code===`already_subscribed`?G.error(o(`feeds.alreadySubscribed`)):e instanceof ga&&(e.code===`no_feeds_found`||e.code===`invalid_feed`)?G.error(o(`feeds.noFeedsFoundOnPage`)):G.error(o(`feeds.subscribeFailed`))}finally{m(!1)}}function y(e){e.preventDefault();let t=s.trim();t&&!/^https?:\/\//i.test(t)&&(t=t.startsWith(`//`)?`https:${t}`:`https://${t}`),v(t,l.trim()||null)}return(0,H.jsxs)(`section`,{className:r?`flex flex-col gap-4`:`card animate-fade-in flex flex-col gap-4 p-4 sm:p-5`,children:[!r&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:o(`feeds.addFeed`)}),(0,H.jsx)(`button`,{type:`button`,onClick:i,className:`rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,"aria-label":o(`common.close`),children:(0,H.jsx)(ac,{})})]}),(0,H.jsxs)(`form`,{onSubmit:y,className:`flex flex-col gap-3 ${r?`sm:flex-row sm:items-start`:``}`,children:[(0,H.jsx)(`input`,{type:`text`,required:!0,autoFocus:!r,placeholder:o(`feeds.urlPlaceholder`),className:r?`input sm:flex-1`:`input`,value:s,onChange:e=>{c(e.target.value),h.length&&g([])}}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[!r&&(0,H.jsx)(`input`,{type:`text`,placeholder:o(`feeds.labelPlaceholder`),className:`input sm:flex-1`,value:l,onChange:e=>u(e.target.value)}),!r&&(0,H.jsx)(Hs,{value:d?String(d):``,onChange:e=>f(e?Number(e):null),options:e,className:`w-full sm:w-52`,placeholder:o(`feeds.noFolder`)}),(0,H.jsx)(`button`,{type:`submit`,disabled:p,className:`btn-primary whitespace-nowrap`,children:o(p?`feeds.subscribing`:`feeds.subscribe`)})]})]}),h.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:o(`feeds.multipleFeedsFound`)}),(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)]`,children:h.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.title??e.url}),(0,H.jsx)(`p`,{className:`truncate text-xs text-[var(--c-text-muted)]`,children:e.url})]}),(0,H.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>v(e.url,e.title||l.trim()||null),className:`btn-primary shrink-0 px-3 py-1.5 text-xs`,children:o(`feeds.subscribe`)})]},e.url))})]})]})}function hc(){let{t:e}=L(),{manageUrl:t}=Vs();return(0,H.jsxs)(`section`,{role:`status`,className:`card flex flex-col gap-2 p-4 sm:p-5`,"aria-labelledby":`plan-notice-title`,children:[(0,H.jsx)(`h2`,{id:`plan-notice-title`,className:`text-base font-semibold`,children:e(`plan.limitedTitle`)}),(0,H.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:e(`plan.limitedText`)}),t&&(0,H.jsx)(`a`,{href:t,className:`btn-primary self-start`,style:{textDecoration:`none`},children:e(`plan.view`)})]})}async function gc(e){try{let t=(await V.listFolders()).folders.find(t=>t.name===e);return t?t.id:(await V.createFolder(e)).id}catch{return null}}function _c({onSubscribed:e}){let{t,i18n:n}=L(),{syncAllowed:r}=Vs(),i=Yo(),a=Ho(i),o=n.resolvedLanguage||`en`,s=(0,_.useMemo)(()=>Wo(i,fc,o).map(e=>({...e,feeds:pc(e,o)})).filter(e=>e.feeds.length>0),[i,o]),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(new Set),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=s.find(e=>e.id===c)??null,y=v?v.feeds.filter(e=>!u.has(e.url)):[];function b(e){d(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}async function x(n){let r=n.feeds.filter(e=>!u.has(e.url));if(r.length===0)return;p({done:0,total:r.length});let i=await gc(n.title),a=0,o=0,s=0,c=[...r];await Promise.all(Array.from({length:Math.min(3,r.length)},async()=>{for(let e=c.shift();e;e=c.shift()){try{await V.subscribeFeed(e.url,null,i),a++}catch(e){e instanceof ga&&e.code===`already_subscribed`?a++:o++}p({done:++s,total:r.length})}})),p(null),o>0?G.error(t(`welcome.packPartial`,{added:a,failed:o})):G.success(t(`welcome.packAdded`,{count:a})),a>0&&await e()}async function S(n){let r=n.target.files?.[0];if(r){h(!0);try{let n=await V.importOpml(await r.text());n.failed>0?G.error(t(`feeds.importPartial`,{imported:n.imported,skipped:n.skipped,failed:n.failed})):G.success(t(`feeds.importSuccess`,{imported:n.imported,skipped:n.skipped})),n.imported>0&&await e()}catch{G.error(t(`feeds.importFailed`))}finally{h(!1),g.current&&(g.current.value=``)}}}async function C(n){G.success(t(`feeds.subscribedToast`,{title:n.label||n.title||n.url})),await e()}let w=f!==null||m;if(!r)return(0,H.jsx)(hc,{});function T({id:e}){switch(e){case`news`:return(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,H.jsx)(`path`,{d:`M18 14h-8`}),(0,H.jsx)(`path`,{d:`M15 18h-5`}),(0,H.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]});case`technology`:return(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`}),(0,H.jsx)(`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`}),(0,H.jsx)(`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`})]});case`apple`:return(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M15.97 6.37c.62-.75 1.04-1.8 0.93-2.85-.9.04-1.99.6-2.63 1.35-.57.65-1.07 1.71-.93 2.73.99.08 2.02-.48 2.63-1.23Z`})});case`science`:return(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2`}),(0,H.jsx)(`path`,{d:`M8.5 2h7`}),(0,H.jsx)(`path`,{d:`M7 16h10`})]});case`design`:return(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`}),(0,H.jsx)(`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`}),(0,H.jsx)(`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}),(0,H.jsx)(`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`}),(0,H.jsx)(`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.563-2.512 5.563-5.563C22 6.5 17.5 2 12 2Z`})]});default:return null}}return(0,H.jsxs)(`section`,{className:`card flex flex-col gap-6 p-5 sm:p-7 shadow-xs`,"aria-labelledby":`welcome-title`,children:[(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{id:`welcome-title`,className:`text-xl sm:text-2xl font-bold tracking-tight text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.title`)}),(0,H.jsx)(`p`,{className:`max-w-xl text-xs sm:text-sm text-[var(--c-text-muted)] mt-0.5 leading-relaxed`,children:t(`welcome.intro`)})]})}),a&&(0,H.jsx)(Ls,{name:`onboarding`,mount:a.mount}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[s.length>0&&(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col gap-3.5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`polygon`,{points:`16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76`})]})}),(0,H.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.packsTitle`)})]}),(0,H.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)] mt-1 ml-9.5`,children:t(`welcome.packsHint`)})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t(`welcome.packsTitle`),children:s.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":c===e.id,disabled:w,onClick:()=>{l(c===e.id?null:e.id),d(new Set)},className:`inline-flex items-center gap-2 rounded-full border px-3.5 py-1.5 text-xs sm:text-sm font-semibold cursor-pointer transition-all ${c===e.id?`border-[var(--c-blue1)] bg-[var(--c-blue1)] text-white shadow-xs`:`border-[var(--c-border)] bg-[var(--c-surface)] hover:border-[var(--c-blue3)] hover:bg-[var(--c-surface-hover)] text-[var(--c-text)]`}`,children:[(0,H.jsx)(T,{id:e.id}),(0,H.jsx)(`span`,{children:e.title})]},e.id))}),v&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2 animate-fade-in border-t border-[var(--c-border)]/60`,children:[v.description&&(0,H.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)]`,children:v.description}),(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)]`,children:v.feeds.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3.5 py-2.5 hover:bg-[var(--c-surface-hover)]/50 transition-colors`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!u.has(e.url),disabled:w,onChange:()=>b(e.url),className:`rounded accent-[var(--c-blue1)]`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs sm:text-sm font-medium`,children:e.title}),e.lang&&(0,H.jsx)(`span`,{className:`shrink-0 text-[0.625rem] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded bg-[var(--c-surface-hover)] text-[var(--c-text-muted)]`,children:e.lang})]})},e.url))}),(0,H.jsx)(`button`,{type:`button`,disabled:w||y.length===0,onClick:()=>void x(v),className:`btn-primary self-start text-xs sm:text-sm font-semibold px-4 py-2`,children:f?t(`welcome.subscribingProgress`,{done:f.done,total:f.total}):t(`welcome.subscribePack`,{count:y.length})})]})]}),(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col gap-3.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}),(0,H.jsx)(`path`,{d:`M2 12h20`})]})}),(0,H.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.addTitle`)})]}),(0,H.jsx)(mc,{compact:!0,folderOptions:[],defaultFolderId:null,onClose:()=>{},onAdded:C})]}),(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M21 8v13H3V8`}),(0,H.jsx)(`path`,{d:`M1 3h22v5H1z`}),(0,H.jsx)(`path`,{d:`M10 12h4`})]})}),(0,H.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.importTitle`)})]}),(0,H.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)] mt-1 ml-9.5`,children:t(`welcome.importHint`)})]}),(0,H.jsxs)(`button`,{type:`button`,disabled:w,onClick:()=>g.current?.click(),className:`btn-secondary inline-flex items-center gap-2 shrink-0 text-xs sm:text-sm font-semibold px-4 py-2`,children:[(0,H.jsx)(ec,{}),t(m?`feeds.importing`:`feeds.importOpml`)]}),(0,H.jsx)(`input`,{type:`file`,ref:g,onChange:S,accept:`.opml,.xml,text/xml,application/xml`,className:`hidden`})]})]})]})}function vc({folder:e,onRenamed:t}){let{t:n}=L(),[r,i]=(0,_.useState)(e.name);async function a(){let a=r.trim();if(!a||a===e.name){i(e.name);return}try{await V.updateFolder(e.id,a),G.success(n(`feeds.folderRenamed`,{name:a})),await t()}catch{i(e.name),G.error(n(`common.error`))}}return(0,H.jsx)(`input`,{className:`input h-9 min-h-0 flex-1 border-transparent bg-transparent px-2 text-sm shadow-none hover:border-[var(--c-border)] focus:border-[var(--c-border)]`,value:r,onChange:e=>i(e.target.value),onBlur:()=>void a(),onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&i(e.name)}})}function yc({folders:e,onClose:t,onChanged:n}){let{t:r}=L(),{syncAllowed:i}=Vs(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1);async function l(e){if(e.preventDefault(),a.trim()){c(!0);try{await V.createFolder(a.trim()),G.success(r(`feeds.folderCreated`,{name:a.trim()})),o(``),await n()}catch{G.error(r(`common.error`))}finally{c(!1)}}}async function u(e){if(confirm(r(`feeds.deleteFolderConfirm`,{name:e.name})))try{await V.deleteFolder(e.id),G.success(r(`feeds.folderDeleted`,{name:e.name})),await n()}catch{G.error(r(`common.error`))}}return(0,H.jsxs)(`section`,{className:`card animate-fade-in flex flex-col gap-4 p-4 sm:p-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`feeds.manageFolders`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs text-[var(--c-text-muted)]`,children:r(`feeds.renameFolderHint`)})]}),(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,"aria-label":r(`common.close`),children:(0,H.jsx)(ac,{})})]}),e.length>0&&(0,H.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)]`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,H.jsx)(vc,{folder:e,onRenamed:n},e.name),(0,H.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-[var(--c-text-muted)]`,children:r(`feeds.feedCount`,{count:e.feed_count??0})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`rounded-lg p-2 text-[var(--c-text-muted)] hover:bg-[var(--c-danger-bg)] hover:text-[var(--c-danger)] cursor-pointer`,"aria-label":r(`common.delete`),title:r(`common.delete`),children:(0,H.jsx)(Qs,{})})]},e.id))}),(0,H.jsxs)(`form`,{onSubmit:l,className:`flex gap-2`,children:[(0,H.jsx)(`input`,{type:`text`,disabled:!i,placeholder:r(`feeds.newFolderPlaceholder`),className:`input flex-1`,value:a,onChange:e=>o(e.target.value)}),(0,H.jsx)(`button`,{type:`submit`,disabled:s||!i||!a.trim(),title:i?void 0:r(`plan.unavailable`),className:`btn-primary whitespace-nowrap`,children:r(`feeds.addFolder`)})]})]})}function bc(e,t,n){e.deferred?G.info(n(`feeds.refreshPendingToast`,{title:t})):e.error?G.error(n(`feeds.refreshFailedToast`,{title:t,error:e.error})):G.success(n(`feeds.refreshedToast`,{title:t,count:e.newItems}))}function xc(e,t){e.deferred?G.info(t(`feeds.refreshAllPendingToast`,{count:e.deferred,newItems:e.newItems})):e.errors||G.success(t(`feeds.refreshedAllToast`,{count:e.refreshed,newItems:e.newItems})),e.errors>0&&G.error(t(`feeds.failingCount`,{count:e.errors}))}var Sc=[5,15,30,60,180,360,720,1440],Cc=`none`;function wc(e,t){return!t||[e.label,e.title,e.url,e.site_url].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function Tc(){let{t:e}=L(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(new Set),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``),[v,y]=Fi(),[b]=(0,_.useState)(()=>[v.get(`url`),v.get(`text`),v.get(`add`)].filter(Boolean).join(` `).match(/https?:\/\/[^\s]+/i)?.[0]??``);(0,_.useEffect)(()=>{(v.has(`add`)||v.has(`url`)||v.has(`text`))&&(k&&c(`add`),y({},{replace:!0}))},[]);let[x,S]=(0,_.useState)(`all`),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,ee]=(0,_.useState)(null),O=(0,_.useRef)(null);async function te(){try{let[e,t]=await Promise.all([V.listFeeds(),V.listFolders().catch(()=>({folders:[]}))]);n(e),i(t.folders)}catch(e){console.error(`Failed to load feeds:`,e)}finally{o(!1)}}(0,_.useEffect)(()=>{te()},[]),(0,_.useEffect)(()=>{if(D===null)return;document.getElementById(`feed-${D}`)?.scrollIntoView({behavior:`smooth`,block:`center`});let e=window.setTimeout(()=>ee(null),2500);return()=>window.clearTimeout(e)},[D,t]);let{syncAllowed:k}=Vs(),ne=e=>(e.label??e.title??e.url).replace(/\s+/g,` `).trim();async function A(t){G.success(e(`feeds.subscribedToast`,{title:ne(t)})),g(``),S(`all`),await te(),ee(t.id)}let re=(0,_.useMemo)(()=>[{value:``,label:e(`feeds.noFolder`)},...r.map(e=>({value:String(e.id),label:e.name}))],[r,e]),ie=(0,_.useMemo)(()=>Sc.map(t=>({value:String(t),label:cc(e,t)})),[e]),ae=(0,_.useMemo)(()=>{let n=new Map;for(let e of t){let t=e.folder_id??null;n.set(t,[...n.get(t)??[],e])}let i=[...r].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({key:`folder:${e.id}`,name:e.name,feeds:n.get(e.id)??[]}));return i.push({key:Cc,name:e(`feeds.uncategorized`),feeds:n.get(null)??[]}),i.filter(e=>e.feeds.length>0)},[t,r,e]),oe=(0,_.useMemo)(()=>ae.filter(e=>x===`all`||x===`failing`||e.key===x).map(e=>({...e,feeds:e.feeds.filter(e=>wc(e,h)&&(x!==`failing`||!!e.last_error))})).filter(e=>e.feeds.length>0),[ae,x,h]),se=t.reduce((e,t)=>e+t.unread_count,0),ce=t.filter(e=>e.last_error).length,j=!h&&x!==`failing`;async function le(){if(!C||C.from===C.over){w(null);return}let e=ae.map(e=>{if(e.key!==C.group)return e.feeds;let t=[...e.feeds],[n]=t.splice(C.from,1);return t.splice(C.over,0,n),t}).flat();n(e),w(null);try{await V.reorderFeeds(e.map(e=>e.id))}catch(e){console.error(`Failed to save feed order:`,e),await te()}}async function M(t){f(e=>new Set(e).add(t));try{let r=await V.refreshFeed(t);r.feed?n(e=>e.map(e=>e.id===t?r.feed:e)):await te(),bc(r,r.feed?ne(r.feed):``,e)}catch{G.error(e(`common.error`))}finally{f(e=>{let n=new Set(e);return n.delete(t),n})}}async function ue(){m(!0);try{let t=await V.refreshAllFeeds();await te(),xc(t,e)}catch{G.error(e(`common.error`))}finally{m(!1)}}async function de(t){if(confirm(e(`feeds.unsubscribeConfirm`,{title:ne(t)})))try{await V.unsubscribeFeed(t.id),G.success(e(`feeds.unsubscribedToast`,{title:ne(t)})),await te()}catch{G.error(e(`common.error`))}}async function fe(t){try{await V.markAllRead(t.id),G.success(e(`feeds.markedReadToast`,{title:ne(t)})),await te()}catch{G.error(e(`common.error`))}}function pe(){let e=document.createElement(`a`);e.href=V.exportOpmlUrl(),e.download=`feedkeeper-subscriptions.opml`,e.click()}async function me(t){let n=t.target.files?.[0];if(n){E(!0);try{let t=await V.importOpml(await n.text());t.failed>0?G.error(e(`feeds.importPartial`,{imported:t.imported,skipped:t.skipped,failed:t.failed})):G.success(e(`feeds.importSuccess`,{imported:t.imported,skipped:t.skipped})),await te()}catch{G.error(e(`feeds.importFailed`))}finally{E(!1),O.current&&(O.current.value=``)}}}let he=[{key:`all`,label:e(`feeds.filterAll`),count:t.length},...ae.map(e=>({key:e.key,label:e.name,count:e.feeds.length})),...ce>0?[{key:`failing`,label:e(`feeds.filterFailing`),count:ce,danger:!0}]:[]];return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 pb-24`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`feeds.title`)}),!a&&t.length>0&&(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:[e(`feeds.feedCount`,{count:t.length}),` · `,e(`feeds.unread`,{count:se}),ce>0&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(`button`,{type:`button`,onClick:()=>S(`failing`),className:`text-[var(--c-danger)] hover:underline cursor-pointer`,children:e(`feeds.failingCount`,{count:ce})})]})]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(a||t.length>0)&&(0,H.jsxs)(`button`,{type:`button`,disabled:!k,title:k?void 0:e(`plan.unavailable`),onClick:()=>c(s===`add`?null:`add`),className:`btn-primary inline-flex items-center gap-1.5 whitespace-nowrap`,children:[(0,H.jsx)($s,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:e(`feeds.addFeed`)}),(0,H.jsx)(`span`,{className:`sm:hidden`,children:e(`feeds.addFeedShort`)})]}),(0,H.jsx)(Bs,{label:e(`feeds.moreActions`),items:[{label:e(p?`feeds.refreshing`:`feeds.refreshAll`),icon:(0,H.jsx)(Ys,{className:`h-4 w-4 ${p?`animate-spin`:``}`}),onSelect:ue,disabled:p||!k},{label:e(`feeds.manageFolders`),icon:(0,H.jsx)(nc,{}),onSelect:()=>c(`folders`)},{label:e(T?`feeds.importing`:`feeds.importOpml`),icon:(0,H.jsx)(ec,{}),onSelect:()=>O.current?.click(),disabled:T||!k},{label:e(`feeds.exportOpml`),icon:(0,H.jsx)(tc,{}),onSelect:pe}]}),(0,H.jsx)(`input`,{type:`file`,ref:O,onChange:me,accept:`.opml,.xml,text/xml,application/xml`,className:`hidden`})]})]}),!k&&t.length>0&&(0,H.jsx)(hc,{}),s===`add`&&k&&(0,H.jsx)(mc,{folderOptions:re,defaultFolderId:x.startsWith(`folder:`)?Number(x.slice(7)):null,initialUrl:b,onClose:()=>c(null),onAdded:A}),s===`folders`&&(0,H.jsx)(yc,{folders:r,onClose:()=>c(null),onChanged:te}),a?(0,H.jsx)(zs,{size:`lg`}):t.length===0?s!==`add`&&(0,H.jsx)(_c,{onSubscribed:te}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--c-text-muted)] opacity-60`,children:(0,H.jsx)(rc,{})}),(0,H.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:e(`feeds.searchPlaceholder`),"aria-label":e(`feeds.searchPlaceholder`),className:`input pl-9`})]}),(0,H.jsx)(`div`,{className:`-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:flex-wrap sm:overflow-visible sm:px-0`,role:`group`,"aria-label":e(`feeds.folder`),children:he.map(e=>{let t=x===e.key;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>S(e.key),"aria-pressed":t,className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition-colors cursor-pointer ${t?`border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] text-[var(--c-text)]`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`} ${e.danger&&!t?`text-[var(--c-danger)]`:``}`,children:[e.label,e.count!==void 0&&(0,H.jsx)(`span`,{className:`text-xs tabular-nums opacity-70`,children:e.count})]},e.key)})})]}),oe.length===0?(0,H.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:e(`feeds.noMatches`)}):(0,H.jsx)(`div`,{className:`flex flex-col gap-6 animate-page-fade`,children:oe.map(t=>{let n=t.feeds.reduce((e,t)=>e+t.unread_count,0);return(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-3 px-1`,children:[(0,H.jsx)(`h2`,{className:`truncate text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:t.name}),(0,H.jsxs)(`span`,{className:`shrink-0 text-xs text-[var(--c-text-muted)]`,children:[e(`feeds.feedCount`,{count:t.feeds.length}),n>0&&` · ${e(`feeds.unread`,{count:n})}`]})]}),(0,H.jsx)(`ul`,{className:`card divide-y divide-[var(--c-border)]`,children:t.feeds.map((e,n)=>(0,H.jsx)(dc,{feed:e,editing:l===e.id,refreshing:d.has(e.id),highlighted:D===e.id,folderOptions:re,intervalOptions:ie,onEdit:t=>u(t?e.id:null),onRefresh:()=>void M(e.id),onMarkRead:()=>void fe(e),onUnsubscribe:()=>void de(e),onSaved:te,drag:j&&t.feeds.length>1?{isDragging:C?.group===t.key&&C.from===n,isDragOver:C?.group===t.key&&C.over===n&&C.from!==n,onDragStart:r=>{r.dataTransfer.effectAllowed=`move`,r.dataTransfer.setData(`text/plain`,String(e.id)),w({group:t.key,from:n,over:n})},onDragOver:e=>{C?.group===t.key&&(e.preventDefault(),C.over!==n&&w({...C,over:n}))},onDragEnd:()=>void le()}:void 0},e.id))})]},t.key)})})]})]})}function Ec(){let[e,t]=(0,_.useState)(()=>new Date);return(0,_.useEffect)(()=>{let n=new Date(e);n.setHours(24,0,1,0);let r=window.setTimeout(()=>t(new Date),n.getTime()-Date.now());return()=>window.clearTimeout(r)},[e]),e}function Dc({className:e=``}){let{i18n:t}=L(),n=Ec(),r=e=>new Intl.DateTimeFormat(t.resolvedLanguage,{weekday:`long`,day:`numeric`,month:`long`,...e?{year:`numeric`}:{}}).format(n);return(0,H.jsxs)(`time`,{dateTime:n.toLocaleDateString(`sv-SE`),className:`truncate text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)] ${e}`,children:[(0,H.jsx)(`span`,{className:`sm:hidden`,children:r(!1)}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:r(!0)})]})}var Oc=c(m(),1);function kc(e,t){this.v=e,this.k=t}function Ac(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jc(e){if(Array.isArray(e))return e}function Mc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Nc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
12
12
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pc(e,t){return jc(e)||Mc(e,t)||Fc(e,t)||Nc()}function Fc(e,t){if(e){if(typeof e==`string`)return Ac(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ac(e,t):void 0}}function Ic(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof kc;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Ic.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Ic.prototype.next=function(e){return this._invoke(`next`,e)},Ic.prototype.throw=function(e){return this._invoke(`throw`,e)},Ic.prototype.return=function(e){return this._invoke(`return`,e)};var Lc=Object.entries,Rc=Object.setPrototypeOf,zc=Object.isFrozen,Bc=Object.getPrototypeOf,Vc=Object.getOwnPropertyDescriptor,Hc=Object.freeze,Uc=Object.seal,Wc=Object.create,Gc=typeof Reflect<`u`&&Reflect,Kc=Gc.apply,qc=Gc.construct;Hc||=function(e){return e},Uc||=function(e){return e},Kc||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},qc||=function(e){return new e(...[...arguments].slice(1))};var Jc=_l(Array.prototype.forEach);Array.prototype.indexOf;var Yc=_l(Array.prototype.lastIndexOf),Xc=_l(Array.prototype.pop),Zc=_l(Array.prototype.push),Qc=_l(Array.prototype.slice),$c=_l(Array.prototype.splice),el=Array.isArray,tl=vl(Set),nl=_l(Set.prototype.add),rl=_l(Set.prototype.has),il=_l(String.prototype.toLowerCase),al=_l(String.prototype.toString),ol=_l(String.prototype.match),sl=_l(String.prototype.replace),cl=_l(String.prototype.indexOf),ll=_l(String.prototype.trim),ul=_l(Number.prototype.toString),dl=_l(Boolean.prototype.toString),fl=typeof BigInt>`u`?null:_l(BigInt.prototype.toString),pl=typeof Symbol>`u`?null:_l(Symbol.prototype.toString),ml=_l(Object.prototype.hasOwnProperty),hl=_l(Object.prototype.toString),K=_l(RegExp.prototype.test),gl=vl(TypeError);function _l(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Kc(e,t,n)}}function vl(e){return function(){return qc(e,[...arguments])}}function q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:il;if(Rc&&Rc(e,null),!el(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(zc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function yl(e){for(let t=0;t<e.length;t++)ml(e,t)||(e[t]=null);return e}function bl(e){let t=Wc(null);for(let r of Lc(e)){var n=Pc(r,2);let i=n[0],a=n[1];ml(e,i)&&(t[i]=el(a)?yl(a):a&&typeof a==`object`&&a.constructor===Object?bl(a):a)}return t}function xl(e){switch(typeof e){case`string`:return e;case`number`:return ul(e);case`boolean`:return dl(e);case`bigint`:return fl?fl(e):`0`;case`symbol`:return pl?pl(e):`Symbol()`;case`undefined`:return hl(e);case`function`:case`object`:{if(e===null)return hl(e);let t=e,n=Sl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:hl(e)}return hl(e)}default:return hl(e)}}function Sl(e,t){for(;e!==null;){let n=Vc(e,t);if(n){if(n.get)return _l(n.get);if(typeof n.value==`function`)return _l(n.value)}e=Bc(e)}function n(){return null}return n}function Cl(e,t){for(;e!==null;){let n=Vc(e,t);if(n)return n.get?_l(n.get):null;e=Bc(e)}return null}function wl(e){try{return K(e,``),!0}catch{return!1}}var Tl=Hc(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),El=Hc(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Dl=Hc([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ol=Hc([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),kl=Hc(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Al=Hc([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),jl=Hc([`#text`]),Ml=Hc(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Nl=Hc(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Pl=Hc(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Fl=Hc([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Il=Uc(/{{[\w\W]*|^[\w\W]*}}/g),Ll=Uc(/<%[\w\W]*|^[\w\W]*%>/g),Rl=Uc(/\${[\w\W]*/g),zl=Uc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bl=Uc(/^aria-[\-\w]+$/),Vl=Uc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hl=Uc(/^(?:\w+script|data):/i),Ul=Uc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wl=Uc(/^html$/i),Gl=Uc(/^[a-z][.\w]*(-[.\w]+)+$/i),Kl=Uc(/<[/\w!]/g),ql=Uc(/<[/\w]/g),Jl=Uc(/<\/no(script|embed|frames)/i),Yl=Uc(/\/>/i),Xl={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Zl=Hc(q({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Ql=function(){return typeof window>`u`?null:window},$l=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},eu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tu=function(e,t,n,r){return ml(e,t)&&el(e[t])?q(r.base?bl(r.base):{},e[t],r.transform):n},J=function(e,t,n){let r=ml(e,t)?e[t]:void 0;return r&&typeof r==`object`?bl(r):n()};function nu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ql(),t=e=>nu(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Xl.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Sl(d,`cloneNode`),p=Sl(d,`remove`),m=Sl(d,`removeAttributeNode`),h=Sl(d,`nextSibling`),g=Sl(d,`childNodes`),_=Sl(d,`parentNode`),v=Sl(d,`shadowRoot`),y=Sl(d,`attributes`),b=o&&o.prototype?Sl(o.prototype,`nodeType`):null,x=o&&o.prototype?Sl(o.prototype,`nodeName`):null,S=o&&o.prototype?Sl(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=Cl(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,ee=``,O,te=!1,k=0,ne=function(){if(k>0)throw gl(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},A=function(e){ne(),k++;try{return D.createHTML(e)}finally{k--}},re=function(e){ne(),k++;try{return D.createScriptURL(e)}finally{k--}},ie=function(){return te||=(O=$l(u,i),!0),O},ae=n,oe=ae.implementation,se=ae.createNodeIterator,ce=ae.createDocumentFragment,j=ae.getElementsByTagName,le=r.importNode,M=eu();t.isSupported=typeof Lc==`function`&&typeof _==`function`&&oe&&oe.createHTMLDocument!==void 0;let ue=Il,de=Ll,fe=Rl,pe=zl,me=Bl,he=Hl,ge=Ul,_e=Gl,N=Vl,P=null,ve=q({},[...Tl,...El,...Dl,...kl,...jl]),F=null,ye=q({},[...Ml,...Nl,...Pl,...Fl]),be=Object.seal(Wc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xe=null,I=null,Se=Object.seal(Wc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ce=!0,we=!0,Te=!1,Ee=!0,De=!1,Oe=!0,ke=!1,Ae=!1,je=null,Me=null,Ne=!1,Pe=!1,Fe=!1,Ie=!1,Le=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He=null,Ue={},We=null,Ge=q({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ke=null,qe=q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Je=null,Ye=q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,Qe=`http://www.w3.org/1999/xhtml`,$e=Qe,et=!1,tt=null,nt=q({},[Xe,Ze,Qe],al),L=Hc([`mi`,`mo`,`mn`,`ms`,`mtext`]),rt=q({},L),it=Hc([`annotation-xml`]),at=q({},it),ot=q({},[`title`,`style`,`font`,`a`,`script`]),st=null,ct=[`application/xhtml+xml`,`text/html`],lt=null,ut=null,dt=n.createElement(`form`),ft=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ut&&ut===e)return;(!e||typeof e!=`object`)&&(e={}),e=bl(e),st=ct.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,lt=st===`application/xhtml+xml`?al:il,P=tu(e,`ALLOWED_TAGS`,ve,{transform:lt}),F=tu(e,`ALLOWED_ATTR`,ye,{transform:lt}),tt=tu(e,`ALLOWED_NAMESPACES`,nt,{transform:al}),Je=tu(e,`ADD_URI_SAFE_ATTR`,Ye,{transform:lt,base:Ye}),Ke=tu(e,`ADD_DATA_URI_TAGS`,qe,{transform:lt,base:qe}),We=tu(e,`FORBID_CONTENTS`,Ge,{transform:lt}),xe=tu(e,`FORBID_TAGS`,bl({}),{transform:lt}),I=tu(e,`FORBID_ATTR`,bl({}),{transform:lt}),Ue=ml(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?bl(e.USE_PROFILES):e.USE_PROFILES:!1,Ce=e.ALLOW_ARIA_ATTR!==!1,we=e.ALLOW_DATA_ATTR!==!1,Te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=e.SAFE_FOR_TEMPLATES||!1,Oe=e.SAFE_FOR_XML!==!1,ke=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Ne=e.FORCE_BODY||!1,Le=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,N=wl(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Vl,$e=typeof e.NAMESPACE==`string`?e.NAMESPACE:Qe,rt=J(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>q({},L)),at=J(e,`HTML_INTEGRATION_POINTS`,()=>q({},it));let t=J(e,`CUSTOM_ELEMENT_HANDLING`,()=>Wc(null));if(be=Wc(null),ml(t,`tagNameCheck`)&&ft(t.tagNameCheck)&&(be.tagNameCheck=t.tagNameCheck),ml(t,`attributeNameCheck`)&&ft(t.attributeNameCheck)&&(be.attributeNameCheck=t.attributeNameCheck),ml(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(be.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Uc(be),De&&(we=!1),Fe&&(Pe=!0),Ue&&(P=q({},jl),F=Wc(null),Ue.html===!0&&(q(P,Tl),q(F,Ml)),Ue.svg===!0&&(q(P,El),q(F,Nl),q(F,Fl)),Ue.svgFilters===!0&&(q(P,Dl),q(F,Nl),q(F,Fl)),Ue.mathMl===!0&&(q(P,kl),q(F,Pl),q(F,Fl))),Se.tagCheck=null,Se.attributeCheck=null,ml(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Se.tagCheck=e.ADD_TAGS:el(e.ADD_TAGS)&&(P===ve&&(P=bl(P)),q(P,e.ADD_TAGS,lt))),ml(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Se.attributeCheck=e.ADD_ATTR:el(e.ADD_ATTR)&&(F===ye&&(F=bl(F)),q(F,e.ADD_ATTR,lt))),ml(e,`ADD_FORBID_CONTENTS`)&&el(e.ADD_FORBID_CONTENTS)&&(We===Ge&&(We=bl(We)),q(We,e.ADD_FORBID_CONTENTS,lt)),Be&&(P[`#text`]=!0),ke&&q(P,[`html`,`head`,`body`]),P.table&&(q(P,[`tbody`]),delete xe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw gl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw gl(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{ee=A(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,ee=``):(D===void 0&&(D=ie()),D&&typeof ee==`string`&&(ee=A(``)));Hc&&Hc(e),ut=e},mt=q({},[...El,...Dl,...Ol]),ht=q({},[...kl,...Al]),gt=function(e,t,n){return t.namespaceURI===Qe?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||rt[n]):!!mt[e]},_t=function(e,t,n){return t.namespaceURI===Qe?e===`math`:t.namespaceURI===Ze?e===`math`&&at[n]:!!ht[e]},vt=function(e,t,n){return t.namespaceURI===Ze&&!at[n]||t.namespaceURI===Xe&&!rt[n]?!1:!ht[e]&&(ot[e]||!mt[e])},yt=function(e){let t=E(e),n=il(w(e)),r=_(e),i,a;return r&&C(r)===Xl.element?(i={namespaceURI:E(r)},a=il(w(r))):(i={namespaceURI:$e},a=`template`),tt[t]?t===Ze?gt(n,i,a):t===Xe?_t(n,i,a):t===Qe?vt(n,i,a):!!(st===`application/xhtml+xml`&&tt[t]):!1},bt=function(e){Zc(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw gl(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},xt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},St=function(e){Et(e);let t=g(e);t&&Jc(Qc(t),e=>{try{p(e)}catch{}});let n=C(e)===Xl.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&xt(e,r,i)}},Ct=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Zc(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Pe||Fe)try{bt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},wt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||F[lt(i)]||xt(e,r,i)}},Tt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===Xl.element){let t=v(e);Vt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Et=function(e){Tt(e,e=>{C(e)===Xl.element&&wt(e)})},Dt=function(e){let t=[];return Tt(e,e=>{t.push(e)},!0),t},Ot=function(e,t){let n=tl();Jc(Dt(e),e=>{C(e)===Xl.element&&nl(n,e)}),Jc(t,e=>{C(e)===Xl.element&&!rl(n,e)&&wt(e)})},kt=function(e,n){let r=!1;return Jc(t.removed,t=>{t.element&&(r||=t.element===e,Et(t.element))}),Ot(e,n),r},At=function(e,t){let n=He,r=null,i=()=>(r||(r=tl(),Jc(t,e=>{nl(r,e)})),r);for(let t=0;;t++){let r=Dt(e),a=[e],o=!1;if(Jc(r,e=>{C(e)===Xl.documentFragment?Zc(a,e):!o&&!rl(n,e)&&(o=rl(i(),e))}),!o)return;if(t>=8)throw gl(`the tree kept changing during in-place sanitization; refusing to return it`);Jc(a,(t,n)=>{jt(t,n>0,e,i())})}},jt=function(e,t,n,r){let i=It(e),a;for(;a=i.nextNode();)rl(r,a)&&!rl(He,a)&&(t&&Ut(M.uponSanitizeShadowNode,a,null),Jt(a,n),tn(a,n),Vt(a.content)&&nn(a.content))},Mt=function(e){He&&nl(He,e)},Nt=function(e,t){return Oe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Pt=function(e){Oe&&Tt(e,e=>{let t=C(e);if(t===Xl.processingInstruction||t===Xl.comment&&K(ql,e.data)){try{p(e)}catch{}return!1}if(t===Xl.element){let t=e,n=lt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Nt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Ft=function(e){let t=null,r=null;if(Ne)e=`<remove></remove>`+e;else{let t=ol(e,/^[\r\n\t ]+/);r=t&&t[0]}st===`application/xhtml+xml`&&$e===Qe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?A(e):e;if($e===Qe)try{t=new l().parseFromString(i,st)}catch{}if(!t||!t.documentElement){t=oe.createDocument($e,`template`,null);try{t.documentElement.innerHTML=et?ee:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),$e===Qe?j.call(t,ke?`html`:`body`)[0]:ke?t.documentElement:a},It=function(e){let t=S?S(e):e.ownerDocument;return se.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Lt=function(e){return e=sl(e,ue,` `),e=sl(e,de,` `),e=sl(e,fe,` `),e},Rt=function(e){zt(e);let t=e.querySelectorAll?.call(e,`template`);t&&Jc(t,e=>{Vt(e.content)&&Rt(e.content)})},zt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=se.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Lt(r.data),r=n.nextNode()},Bt=function(e){let t=x?x(e):null;return typeof t!=`string`||lt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Xl.documentFragment}catch{return!1}},Ht=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ut(e,n,r){e.length!==0&&Jc(e,e=>{e.call(t,n,r,ut)})}let Wt=function(e,t){return!!(Oe&&e.hasChildNodes()&&!Ht(e.firstElementChild)&&K(Kl,e.textContent)&&K(Kl,e.innerHTML)||Oe&&Zl[t]&&C(e)===Xl.element&&E(e)===Qe&&(Ht(e.firstElementChild)||typeof e.textContent==`string`&&K(Kl,e.textContent))||e.nodeType===Xl.processingInstruction||Oe&&e.nodeType===Xl.comment&&K(ql,e.data))},Gt=function(e,t){return e instanceof RegExp?K(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kt=function(e,t,n){if(!xe[t]&&Zt(t)&&Gt(be.tagNameCheck,t))return!1;if(Be&&!We[t]&&!We[il(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return bt(e),!0},R=function(e,t,n,r){return e.length===0?t:t===n||t===r?bl(t):t},qt=function(e,t){return e===t||_(e)!==null?!1:(Ve&&Et(e),!0)},Jt=function(e,n){if(Mt(e),Ut(M.beforeSanitizeElements,e,null),qt(e,n))return!0;if(Bt(e))return bt(e),!0;let r=lt(w(e));if(P=R(M.uponSanitizeElement,P,ve,je),Ut(M.uponSanitizeElement,e,{tagName:r,allowedTags:P}),qt(e,n))return!0;if(Wt(e,r))return bt(e),!0;if(xe[r]||!(Se.tagCheck instanceof Function&&Se.tagCheck(r))&&!P[r]){let t=Kt(e,r,n);return t===!1&&(Ut(M.afterSanitizeElements,e,null),qt(e,n))?!0:t}if(C(e)===Xl.element&&!yt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&K(Jl,e.innerHTML))return bt(e),!0;if(De&&e.nodeType===Xl.text){let n=Lt(e.textContent);e.textContent!==n&&(Zc(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ut(M.afterSanitizeElements,e,null),qt(e,n)},Yt=function(e,t,r){if(I[t]||Nt(t,e)||Le&&(t===`id`||t===`name`)&&(r in n||r in dt))return!1;let i=F[t]||Se.attributeCheck instanceof Function&&Se.attributeCheck(t,e);return we&&K(pe,t)||Ce&&K(me,t)?!0:i?Je[t]||K(N,sl(r,ge,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&cl(r,`data:`)===0&&Ke[e]||Te&&!K(he,sl(r,ge,``))?!0:!r:Zt(e)&&Gt(be.tagNameCheck,e)&&Gt(be.attributeNameCheck,t,e)||t===`is`&&be.allowCustomizedBuiltInElements&&Gt(be.tagNameCheck,r)},Xt=q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Zt=function(e){return!Xt[il(e)]&&K(_e,e)},Qt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return A(r);case`TrustedScriptURL`:return re(r)}return r},$t=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Bt(e)||(bt(e),!1)}catch{return Ct(t,e),!1}},en=function(e,t){return Oe&&K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:il(e)===`attributename`&&ol(t,`href`)!==null},tn=function(e,n){if(Ut(M.beforeSanitizeAttributes,e,null),qt(e,n))return;let r=e.attributes;if(!r||Bt(e))return;F=R(M.uponSanitizeAttribute,F,ye,Me);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0},a=r.length,o=lt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=lt(s),d=l,f=s===`value`?d:ll(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ut(M.uponSanitizeAttribute,e,i),f=i.attrValue,Re&&(u===`id`||u===`name`)&&cl(f,ze)!==0&&(Ct(s,e,n),f=ze+f,p=!0),en(s,f)){Ct(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){Ct(s,e,n);continue}if(!Ee&&K(Yl,f)){Ct(s,e,n);continue}if(De&&(f=Lt(f)),!Yt(o,u,f)){Ct(s,e,n);continue}f=Qt(o,u,c,f),f!==d&&$t(e,s,c,f)&&p&&Xc(t.removed)}}Ut(M.afterSanitizeAttributes,e,null),qt(e,n)},nn=function(e){let t=null,n=It(e);for(Ut(M.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ut(M.uponSanitizeShadowNode,t,null),Jt(t,e),tn(t,e),Vt(t.content)&&nn(t.content),C(t)===Xl.element){let e=v(t);Vt(e)&&(rn(e),nn(e))}De&&zt(e),Ut(M.afterSanitizeShadowDOM,e,null)},rn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){nn(e.shadow);continue}let n=e.node,r=C(n)===Xl.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&<(e)===`template`){let e=n.content;Vt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Vt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(et=!e,et&&(e=`<!-->`),typeof e!=`string`&&!Ht(e)&&(e=xl(e),typeof e!=`string`))throw gl(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ae?(P=je,F=Me):pt(n),(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&(P=bl(P)),M.uponSanitizeAttribute.length>0&&(F=bl(F)),t.removed=[];let c=Ve&&typeof e!=`string`&&Ht(e),l=[],u=He;if(c){Pt(e);let t=w(e);if(typeof t==`string`){let n=lt(t);if(!P[n]||xe[n])throw St(e),gl(`root node is forbidden and cannot be sanitized in-place`)}if(Bt(e))throw St(e),gl(`root node is clobbered and cannot be sanitized in-place`);l=Dt(e),He=tl()}else if(Ht(e))i=Ft(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Xl.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),rn(i);else{if(!Pe&&!De&&!ke&&e.indexOf(`<`)===-1)return D&&Ie?A(e):e;if(i=Ft(e),!i)return Pe?null:Ie?ee:``}i&&Ne&&bt(i.firstChild);let d=c?e:i;try{c&&rn(e);let t=It(d);for(;o=t.nextNode();)Jt(o,d),tn(o,d),Vt(o.content)&&nn(o.content);c&&At(e,l)}catch(t){throw c&&(St(e),kt(e,l)),t}finally{He=u}if(c){if(kt(e,l))throw gl(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return De&&Rt(e),e}if(Pe){if(De&&Rt(i),Fe)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(F.shadowroot||F.shadowrootmode)&&(s=le.call(r,s,!0)),s}let f=ke?i.outerHTML:i.innerHTML;return ke&&P[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&K(Wl,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
13
|
-
`+f),De&&(f=Lt(f)),D&&Ie?A(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(e),Ae=!0,je=P,Me=F},t.clearConfig=function(){ut=null,Ae=!1,je=null,Me=null,D=O,ee=``},t.isValidAttribute=function(e,t,n){ut||pt({});let r=lt(e),i=lt(t);return typeof n==`string`&&(en(t,n)||!Ee&&K(Yl,n))?!1:Yt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&ml(M,e)&&Zc(M[e],t)},t.removeHook=function(e,t){if(ml(M,e)){if(t!==void 0){let n=Yc(M[e],t);return n===-1?void 0:$c(M[e],n,1)[0]}return Xc(M[e])}},t.removeHooks=function(e){ml(M,e)&&(M[e]=[])},t.removeAllHooks=function(){M=eu()},t}var ru=nu();function iu(e,t){try{let n=new URL(e,t||void 0);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function au(e){if(!e)return``;try{return new URL(e).pathname.split(`/`).filter(Boolean).at(-1)?.toLowerCase()??``}catch{return``}}var ou={USE_PROFILES:{html:!0},ALLOWED_ATTR:[`href`,`src`,`alt`,`title`,`width`,`height`],ALLOW_DATA_ATTR:!1,FORBID_TAGS:[`form`,`input`,`button`,`textarea`,`select`,`style`,`video`,`audio`,`source`]};function su(e,t){return e.getAttribute(`width`)===`1`&&e.getAttribute(`height`)===`1`||!!(t&&/feedsportal\.com|feedburner\.com|pixel\.wp\.com|statcounter\.com/i.test(t))}function cu(e){let t=Number(e.getAttribute(`width`)),n=Number(e.getAttribute(`height`));return t>0&&t<160||n>0&&n<100}function lu(e,t){if(!e)return null;let n=ru.sanitize(e,ou),r=new DOMParser().parseFromString(n,`text/html`);for(let e of r.querySelectorAll(`img`)){let n=r.createRange();if(n.selectNodeContents(r.body),n.setEndBefore(e),n.toString().trim().length>160)return null;let i=iu(e.getAttribute(`src`)??``,t);if(i&&!su(e,i)&&!cu(e))return i}return null}function uu(e,t={}){if(!e)return``;let n=ru.sanitize(e,ou),r=new DOMParser().parseFromString(n,`text/html`),i=t.heroImageUrl?iu(t.heroImageUrl,t.baseUrl):null,a=au(i),o=r.body.textContent?.trim().length??0,s=null,c=null;Array.from(r.querySelectorAll(`img`)).forEach((e,n)=>{let l=iu(e.getAttribute(`src`)??``,t.baseUrl),u=au(l),d=!!(i&&l&&(l===i||a&&u===a||n===0&&o<400)),f=!1;if(l&&l===c&&s){let t=r.createRange();t.setStartAfter(s),t.setEndBefore(e),f=!t.toString().trim()}!l||su(e,l)||d||f?e.remove():(e.setAttribute(`src`,l),e.removeAttribute(`loading`),s=e,c=l)}),r.querySelectorAll(`a`).forEach(e=>{let n=iu(e.getAttribute(`href`)??``,t.baseUrl);n?(e.setAttribute(`href`,n),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):e.removeAttribute(`href`)}),r.querySelectorAll(`p, div, figure, a`).forEach(e=>{!e.textContent?.trim()&&!e.querySelector(`img`)&&e.remove()});let l=Array.from(r.body.childNodes);if(l.some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())&&!r.body.querySelector(`p`)){let e=r.createElement(`p`);l.forEach(t=>e.appendChild(t)),r.body.appendChild(e)}return ru.sanitize(r.body.innerHTML,ou)}function du(e){return e?Math.max(1,Math.ceil(e.trim().split(/\s+/).length/200)):1}function fu({item:e,isOpen:t,onClose:n,onToggleBookmark:r,onToggleRead:i,onNext:a,onPrevious:o,onItemUpdated:s,hasNext:c=!1,hasPrev:l=!1}){let{t:u,i18n:d}=L(),[f,p]=(0,_.useState)(61),m=(0,_.useRef)(null),h=(0,_.useCallback)(e=>{if(m.current?.disconnect(),!e)return;let t=()=>p(e.offsetHeight);t(),m.current=new ResizeObserver(t),m.current.observe(e)},[]),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(null),T=e?.author||C,[E,D]=(0,_.useState)(null),[ee,O]=(0,_.useState)(!1),te=e?.feed_full_text_mode===`never`,[k,ne]=(0,_.useState)(null),A=e?.link?iu(e.link):null;(0,_.useEffect)(()=>{S(!!e?.full_content_html),D(null),O(!1),w(null)},[e?.id,e?.full_content_html]),(0,_.useEffect)(()=>{t&&e&&A&&localStorage.getItem(`feedkeeper_auto_reader_mode`)!==`false`&&!e.full_content_html&&!te&&navigator.onLine&&re()},[t,e?.id]),(0,_.useEffect)(()=>{if(t){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t]);let re=(0,_.useCallback)(async()=>{if(e&&!y){if(e.full_content_html){S(e=>!e);return}if(A){b(!0),D(null),O(!1);try{let t=await V.extractContent(e.id),n={...e,full_content_html:t.full_content_html};t.byline&&w(t.byline),S(!0),s?.(n)}catch(e){e instanceof ga&&e.code===`consent_wall`?O(!0):e instanceof ga&&e.status===0?D(u(`common.offlineAction`)):e instanceof ga&&e.code===`full_text_disabled`||(console.error(`Failed to extract full text:`,e),D(u(`reader.extractionFailed`)))}finally{b(!1)}}}},[e,y,A,u,s]);(0,_.useEffect)(()=>{if(!t||!e)return;let s=e;function u(e){document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||(e.key===`Escape`?(e.preventDefault(),n()):(e.key===`j`||e.key===`ArrowRight`)&&c&&a?(e.preventDefault(),a()):(e.key===`k`||e.key===`ArrowLeft`)&&l&&o?(e.preventDefault(),o()):e.key===`s`||e.key===`S`?(e.preventDefault(),r(s)):e.key===`m`||e.key===`M`?(e.preventDefault(),i(s)):e.key===`r`||e.key===`R`?(e.preventDefault(),re()):(e.key===`o`||e.key===`O`)&&A&&(e.preventDefault(),window.open(A,`_blank`,`noopener,noreferrer`)))}return window.addEventListener(`keydown`,u),()=>window.removeEventListener(`keydown`,u)},[t,e,A,c,l,a,o,n,r,i,re]);let ie=(0,_.useMemo)(()=>e?.published_at?new Date(e.published_at):null,[e?.published_at]),ae=(0,_.useMemo)(()=>ie?new Intl.DateTimeFormat(d.resolvedLanguage,{dateStyle:`medium`}).format(ie):``,[ie,d.resolvedLanguage]),oe=(0,_.useMemo)(()=>ie?new Intl.DateTimeFormat(d.resolvedLanguage,{timeStyle:`short`}).format(ie):``,[ie,d.resolvedLanguage]),se=x?e?.full_content_html:e?.content_html,ce=(0,_.useMemo)(()=>e?.image_url??lu(se??``,e?.link),[e?.image_url,se,e?.link]);(0,_.useEffect)(()=>{if(ne(null),!t||!ce)return;let e=!1,n=new Image;return n.onload=()=>{!e&&n.naturalWidth>0&&n.naturalHeight>0&&ne({src:ce,width:n.naturalWidth,height:n.naturalHeight})},n.src=ce,()=>{e=!0}},[t,ce]);let j=k?.src===ce?k:null,le=j!==null&&j.width<=320&&j.height<=240,M=(0,_.useMemo)(()=>e&&se?uu(se,{heroImageUrl:ce,baseUrl:e.link}):``,[e,se,ce]),ue=(0,_.useMemo)(()=>du((se??e?.content_snippet??``).replace(/<[^>]+>/g,` `)),[se,e?.content_snippet]);return!t||!e?null:(0,Oc.createPortal)((0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,H.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-xs transition-opacity animate-fade-in`,onClick:n,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`relative z-10 w-full sm:max-w-2xl md:max-w-3xl h-full h-[100dvh] bg-[var(--c-surface)] shadow-2xl flex flex-col border-0 sm:border-l border-[var(--c-border)] animate-drawer-in`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title??u(`items.title`),children:[(0,H.jsxs)(`header`,{ref:h,className:`absolute inset-x-0 top-0 z-20 px-4 py-3 border-b border-[var(--c-border)] backdrop-blur-md transform-gpu flex items-center justify-between gap-3`,style:{paddingTop:`max(0.75rem, env(safe-area-inset-top, 0px))`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`},children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,H.jsx)(Gs,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.feed_title})]}),(0,H.jsx)(`button`,{type:`button`,onClick:n,title:u(`reader.close`),"aria-label":u(`reader.close`),className:`w-9 h-9 -mr-1 rounded-xl text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/60 active:scale-95 transition-all cursor-pointer flex items-center justify-center shrink-0`,children:(0,H.jsxs)(`svg`,{className:`w-6 h-6`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,H.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,H.jsxs)(`main`,{className:`flex-1 overflow-y-auto overscroll-contain transform-gpu`,style:{paddingTop:f},children:[j&&!le&&(0,H.jsx)(`img`,{src:j.src,alt:``,className:`block w-full max-h-[380px] object-cover`,onError:()=>ne(null)}),(0,H.jsx)(`div`,{className:`px-5 sm:px-10 py-6 sm:py-8`,style:{paddingBottom:`max(2rem, env(safe-area-inset-bottom, 0px))`},children:(0,H.jsxs)(`article`,{className:`max-w-prose mx-auto`,children:[(0,H.jsxs)(`div`,{className:`flow-root`,children:[j&&le&&(0,H.jsx)(`div`,{className:`float-right ml-4 mb-3 sm:ml-6 rounded-xl overflow-hidden border border-[var(--c-border)] bg-[var(--c-bg)] shadow-xs`,style:{width:j.width,maxWidth:`42%`},children:(0,H.jsx)(`img`,{src:j.src,alt:``,className:`block w-full h-auto`,onError:()=>ne(null)})}),(0,H.jsx)(`h1`,{className:`text-2xl sm:text-3xl font-bold font-['Manrope'] text-[var(--c-text)] leading-snug tracking-tight mb-3`,children:e.title})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-[var(--c-text-muted)] pb-5 border-b border-[var(--c-border)] mb-6 font-medium`,children:[T&&(0,H.jsx)(`span`,{children:T}),ae&&(0,H.jsxs)(H.Fragment,{children:[T&&(0,H.jsx)(`span`,{children:`•`}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,H.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,H.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,H.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,H.jsx)(`span`,{children:ae})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,H.jsx)(`span`,{children:oe})]})]}),(T||ae)&&(0,H.jsx)(`span`,{children:`•`}),(0,H.jsx)(`span`,{children:u(`reader.readingTime`,{count:ue})})]}),ee&&(0,H.jsxs)(`div`,{className:`mb-6 p-4 rounded-xl border border-[var(--c-border)] bg-[var(--c-bg)] text-sm text-[var(--c-text-muted)] flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{children:u(`reader.consentWall`)}),A&&(0,H.jsx)(`a`,{href:A,target:`_blank`,rel:`noreferrer noopener`,className:`btn-primary text-sm whitespace-nowrap self-start sm:self-center`,children:u(`reader.readOriginal`)})]}),E&&(0,H.jsxs)(`div`,{className:`mb-6 p-4 rounded-xl bg-red-500/10 border border-red-500/30 text-red-600 dark:text-red-400 text-xs flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{children:E}),A&&(0,H.jsx)(`a`,{href:A,target:`_blank`,rel:`noreferrer noopener`,className:`underline font-semibold whitespace-nowrap hover:opacity-80`,children:u(`reader.openOriginal`)})]}),M?(0,H.jsx)(`div`,{className:`reader-content`,dangerouslySetInnerHTML:{__html:M}}):e.content_snippet?(0,H.jsx)(`div`,{className:`reader-content`,children:e.content_snippet.split(`
|
|
13
|
+
`+f),De&&(f=Lt(f)),D&&Ie?A(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pt(e),Ae=!0,je=P,Me=F},t.clearConfig=function(){ut=null,Ae=!1,je=null,Me=null,D=O,ee=``},t.isValidAttribute=function(e,t,n){ut||pt({});let r=lt(e),i=lt(t);return typeof n==`string`&&(en(t,n)||!Ee&&K(Yl,n))?!1:Yt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&ml(M,e)&&Zc(M[e],t)},t.removeHook=function(e,t){if(ml(M,e)){if(t!==void 0){let n=Yc(M[e],t);return n===-1?void 0:$c(M[e],n,1)[0]}return Xc(M[e])}},t.removeHooks=function(e){ml(M,e)&&(M[e]=[])},t.removeAllHooks=function(){M=eu()},t}var ru=nu();function iu(e,t){try{let n=new URL(e,t||void 0);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function au(e){if(!e)return``;try{return new URL(e).pathname.split(`/`).filter(Boolean).at(-1)?.toLowerCase()?.replace(/[-_]\d{2,4}x\d{2,4}(?=\.\w+$)/,``).replace(/\.(?:webp|jpeg)$/,`.jpg`)??``}catch{return``}}var ou={USE_PROFILES:{html:!0},ALLOWED_ATTR:[`href`,`src`,`alt`,`title`,`width`,`height`],ALLOW_DATA_ATTR:!1,FORBID_TAGS:[`form`,`input`,`button`,`textarea`,`select`,`style`,`video`,`audio`,`source`]};function su(e,t){return e.getAttribute(`width`)===`1`&&e.getAttribute(`height`)===`1`||!!(t&&/feedsportal\.com|feedburner\.com|pixel\.wp\.com|statcounter\.com/i.test(t))}function cu(e){let t=Number(e.getAttribute(`width`)),n=Number(e.getAttribute(`height`));return t>0&&t<160||n>0&&n<100}function lu(e,t){if(!e)return null;let n=ru.sanitize(e,ou),r=new DOMParser().parseFromString(n,`text/html`);for(let e of r.querySelectorAll(`img`)){let n=r.createRange();if(n.selectNodeContents(r.body),n.setEndBefore(e),n.toString().trim().length>160)return null;let i=iu(e.getAttribute(`src`)??``,t);if(i&&!su(e,i)&&!cu(e))return i}return null}function uu(e,t={}){if(!e)return``;let n=ru.sanitize(e,ou),r=new DOMParser().parseFromString(n,`text/html`),i=t.heroImageUrl?iu(t.heroImageUrl,t.baseUrl):null,a=au(i),o=r.body.textContent?.trim().length??0,s=null,c=null;Array.from(r.querySelectorAll(`img`)).forEach((e,n)=>{let l=iu(e.getAttribute(`src`)??``,t.baseUrl),u=au(l),d=!1;if(n===0&&i?.includes(`/archive/images/`)&&l?.includes(`/archive/images/`)){let t=r.createRange();t.selectNodeContents(r.body),t.setEndBefore(e),d=!t.toString().trim()}let f=!!(i&&l&&(l===i||a&&u===a||d||n===0&&o<400)),p=!1;if(l&&l===c&&s){let t=r.createRange();t.setStartAfter(s),t.setEndBefore(e),p=!t.toString().trim()}if(!l||su(e,l)||f||p){let t=f?e.getAttribute(`alt`)?.trim():null,n=e.closest(`p`);e.remove(),t&&t.length>=15&&n&&n.textContent?.trim()===t&&!n.querySelector(`img`)&&n.remove()}else e.setAttribute(`src`,l),e.removeAttribute(`loading`),s=e,c=l}),r.querySelectorAll(`a`).forEach(e=>{let n=iu(e.getAttribute(`href`)??``,t.baseUrl);n?(e.setAttribute(`href`,n),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):e.removeAttribute(`href`)}),r.querySelectorAll(`p, div, figure, a`).forEach(e=>{!e.textContent?.trim()&&!e.querySelector(`img`)&&e.remove()});let l=Array.from(r.body.childNodes);if(l.some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())&&!r.body.querySelector(`p`)){let e=r.createElement(`p`);l.forEach(t=>e.appendChild(t)),r.body.appendChild(e)}return ru.sanitize(r.body.innerHTML,ou)}function du(e){return e?Math.max(1,Math.ceil(e.trim().split(/\s+/).length/200)):1}function fu({item:e,isOpen:t,onClose:n,onToggleBookmark:r,onToggleRead:i,onNext:a,onPrevious:o,onItemUpdated:s,hasNext:c=!1,hasPrev:l=!1}){let{t:u,i18n:d}=L(),[f,p]=(0,_.useState)(61),m=(0,_.useRef)(null),h=(0,_.useCallback)(e=>{if(m.current?.disconnect(),!e)return;let t=()=>p(e.offsetHeight);t(),m.current=new ResizeObserver(t),m.current.observe(e)},[]),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(null),T=e?.author||C,[E,D]=(0,_.useState)(null),[ee,O]=(0,_.useState)(!1),te=e?.feed_full_text_mode===`never`,[k,ne]=(0,_.useState)(null),A=e?.link?iu(e.link):null;(0,_.useEffect)(()=>{S(!!e?.full_content_html),D(null),O(!1),w(null)},[e?.id,e?.full_content_html]),(0,_.useEffect)(()=>{t&&e&&A&&localStorage.getItem(`feedkeeper_auto_reader_mode`)!==`false`&&!e.full_content_html&&!te&&navigator.onLine&&re()},[t,e?.id]),(0,_.useEffect)(()=>{if(t){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t]);let re=(0,_.useCallback)(async()=>{if(e&&!y){if(e.full_content_html){S(e=>!e);return}if(A){b(!0),D(null),O(!1);try{let t=await V.extractContent(e.id),n={...e,full_content_html:t.full_content_html};t.byline&&w(t.byline),S(!0),s?.(n)}catch(e){e instanceof ga&&e.code===`consent_wall`?O(!0):e instanceof ga&&e.status===0?D(u(`common.offlineAction`)):e instanceof ga&&e.code===`full_text_disabled`||(console.error(`Failed to extract full text:`,e),D(u(`reader.extractionFailed`)))}finally{b(!1)}}}},[e,y,A,u,s]);(0,_.useEffect)(()=>{if(!t||!e)return;let s=e;function u(e){document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement||(e.key===`Escape`?(e.preventDefault(),n()):(e.key===`j`||e.key===`ArrowRight`)&&c&&a?(e.preventDefault(),a()):(e.key===`k`||e.key===`ArrowLeft`)&&l&&o?(e.preventDefault(),o()):e.key===`s`||e.key===`S`?(e.preventDefault(),r(s)):e.key===`m`||e.key===`M`?(e.preventDefault(),i(s)):e.key===`r`||e.key===`R`?(e.preventDefault(),re()):(e.key===`o`||e.key===`O`)&&A&&(e.preventDefault(),window.open(A,`_blank`,`noopener,noreferrer`)))}return window.addEventListener(`keydown`,u),()=>window.removeEventListener(`keydown`,u)},[t,e,A,c,l,a,o,n,r,i,re]);let ie=(0,_.useMemo)(()=>e?.published_at?new Date(e.published_at):null,[e?.published_at]),ae=(0,_.useMemo)(()=>ie?new Intl.DateTimeFormat(d.resolvedLanguage,{dateStyle:`medium`}).format(ie):``,[ie,d.resolvedLanguage]),oe=(0,_.useMemo)(()=>ie?new Intl.DateTimeFormat(d.resolvedLanguage,{timeStyle:`short`}).format(ie):``,[ie,d.resolvedLanguage]),se=x?e?.full_content_html:e?.content_html,ce=(0,_.useMemo)(()=>e?.image_url??lu(se??``,e?.link),[e?.image_url,se,e?.link]);(0,_.useEffect)(()=>{if(ne(null),!t||!ce)return;let e=!1,n=new Image;return n.onload=()=>{!e&&n.naturalWidth>0&&n.naturalHeight>0&&ne({src:ce,width:n.naturalWidth,height:n.naturalHeight})},n.src=ce,()=>{e=!0}},[t,ce]);let j=k?.src===ce?k:null,le=j!==null&&j.width<=320&&j.height<=240,M=(0,_.useMemo)(()=>e&&se?uu(se,{heroImageUrl:ce,baseUrl:e.link}):``,[e,se,ce]),ue=(0,_.useMemo)(()=>du((se??e?.content_snippet??``).replace(/<[^>]+>/g,` `)),[se,e?.content_snippet]);return!t||!e?null:(0,Oc.createPortal)((0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,H.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-xs transition-opacity animate-fade-in`,onClick:n,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`relative z-10 w-full sm:max-w-2xl md:max-w-3xl h-full h-[100dvh] bg-[var(--c-surface)] shadow-2xl flex flex-col border-0 sm:border-l border-[var(--c-border)] animate-drawer-in`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title??u(`items.title`),children:[(0,H.jsxs)(`header`,{ref:h,className:`absolute inset-x-0 top-0 z-20 px-4 py-3 border-b border-[var(--c-border)] backdrop-blur-md transform-gpu flex items-center justify-between gap-3`,style:{paddingTop:`max(0.75rem, env(safe-area-inset-top, 0px))`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`},children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,H.jsx)(Gs,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.feed_title})]}),(0,H.jsx)(`button`,{type:`button`,onClick:n,title:u(`reader.close`),"aria-label":u(`reader.close`),className:`w-9 h-9 -mr-1 rounded-xl text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/60 active:scale-95 transition-all cursor-pointer flex items-center justify-center shrink-0`,children:(0,H.jsxs)(`svg`,{className:`w-6 h-6`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,H.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,H.jsxs)(`main`,{className:`flex-1 overflow-y-auto overscroll-contain transform-gpu`,style:{paddingTop:f},children:[j&&!le&&(0,H.jsx)(`img`,{src:j.src,alt:``,className:`block w-full max-h-[380px] object-cover`,onError:()=>ne(null)}),(0,H.jsx)(`div`,{className:`px-5 sm:px-10 py-6 sm:py-8`,style:{paddingBottom:`max(2rem, env(safe-area-inset-bottom, 0px))`},children:(0,H.jsxs)(`article`,{className:`max-w-prose mx-auto`,children:[(0,H.jsxs)(`div`,{className:`flow-root`,children:[j&&le&&(0,H.jsx)(`div`,{className:`float-right ml-4 mb-3 sm:ml-6 rounded-xl overflow-hidden border border-[var(--c-border)] bg-[var(--c-bg)] shadow-xs`,style:{width:j.width,maxWidth:`42%`},children:(0,H.jsx)(`img`,{src:j.src,alt:``,className:`block w-full h-auto`,onError:()=>ne(null)})}),(0,H.jsx)(`h1`,{className:`text-2xl sm:text-3xl font-bold font-['Manrope'] text-[var(--c-text)] leading-snug tracking-tight mb-3`,children:e.title})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-[var(--c-text-muted)] pb-5 border-b border-[var(--c-border)] mb-6 font-medium`,children:[T&&(0,H.jsx)(`span`,{children:T}),ae&&(0,H.jsxs)(H.Fragment,{children:[T&&(0,H.jsx)(`span`,{children:`•`}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,H.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,H.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,H.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,H.jsx)(`span`,{children:ae})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,H.jsx)(`span`,{children:oe})]})]}),(T||ae)&&(0,H.jsx)(`span`,{children:`•`}),(0,H.jsx)(`span`,{children:u(`reader.readingTime`,{count:ue})})]}),ee&&(0,H.jsxs)(`div`,{className:`mb-6 p-4 rounded-xl border border-[var(--c-border)] bg-[var(--c-bg)] text-sm text-[var(--c-text-muted)] flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{children:u(`reader.consentWall`)}),A&&(0,H.jsx)(`a`,{href:A,target:`_blank`,rel:`noreferrer noopener`,className:`btn-primary text-sm whitespace-nowrap self-start sm:self-center`,children:u(`reader.readOriginal`)})]}),E&&(0,H.jsxs)(`div`,{className:`mb-6 p-4 rounded-xl bg-red-500/10 border border-red-500/30 text-red-600 dark:text-red-400 text-xs flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{children:E}),A&&(0,H.jsx)(`a`,{href:A,target:`_blank`,rel:`noreferrer noopener`,className:`underline font-semibold whitespace-nowrap hover:opacity-80`,children:u(`reader.openOriginal`)})]}),M?(0,H.jsx)(`div`,{className:`reader-content`,dangerouslySetInnerHTML:{__html:M}}):e.content_snippet?(0,H.jsx)(`div`,{className:`reader-content`,children:e.content_snippet.split(`
|
|
14
14
|
|
|
15
15
|
`).map((e,t)=>(0,H.jsx)(`p`,{children:e},t))}):(0,H.jsx)(`p`,{className:`text-[var(--c-text-muted)] italic`,children:u(`items.noItems`)}),(0,H.jsxs)(`div`,{className:`mt-12 pt-6 border-t border-[var(--c-border)]/60 flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:o,disabled:!l,title:u(`reader.previous`),"aria-label":u(`reader.previous`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 active:scale-95 disabled:opacity-30 disabled:cursor-not-allowed transition-all cursor-pointer`,children:(0,H.jsx)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:a,disabled:!c,title:u(`reader.next`),"aria-label":u(`reader.next`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 active:scale-95 disabled:opacity-30 disabled:cursor-not-allowed transition-all cursor-pointer`,children:(0,H.jsx)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A&&(!te||e.full_content_html)&&(0,H.jsx)(`button`,{type:`button`,onClick:re,disabled:y,title:u(x?`reader.togglePreview`:`reader.toggleFullText`),"aria-label":u(x?`reader.togglePreview`:`reader.toggleFullText`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${x?`bg-[var(--c-blue1)]/15 border-[var(--c-blue1)]/40 text-[var(--c-blue1)]`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40`}`,children:y?(0,H.jsx)(`svg`,{className:`w-4 h-4 animate-spin text-[var(--c-blue1)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,strokeDasharray:`32`,strokeDashoffset:`12`})}):(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`}),(0,H.jsx)(`path`,{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`})]})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e),title:e.bookmarked?u(`reader.unbookmark`):u(`reader.bookmark`),"aria-label":e.bookmarked?u(`reader.unbookmark`):u(`reader.bookmark`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${e.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,H.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:e.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>i(e),title:e.read?u(`reader.markUnread`):u(`reader.markRead`),"aria-label":e.read?u(`reader.markUnread`):u(`reader.markRead`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${e.read?`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`:`border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,H.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:e.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:async()=>{if(A)try{await navigator.clipboard.writeText(A),v(!0),setTimeout(()=>v(!1),2e3)}catch{}},title:u(g?`reader.linkCopied`:`reader.copyLink`),"aria-label":u(`reader.copyLink`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 transition-all active:scale-95 cursor-pointer relative`,children:g?(0,H.jsx)(`svg`,{className:`w-4 h-4 text-emerald-500`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),(0,H.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}),A&&(0,H.jsx)(`a`,{href:A,target:`_blank`,rel:`noreferrer noopener`,title:u(`reader.openOriginal`),"aria-label":u(`reader.openOriginal`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 transition-all active:scale-95`,children:(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}),(0,H.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,H.jsx)(`line`,{x1:`10`,y1:`14`,x2:`21`,y2:`3`})]})})]})]})]})})]})]})]}),document.body)}var pu=650;function mu(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`script, style, noscript, template, svg, [hidden], [aria-hidden='true']`).forEach(e=>e.remove()),t.content.querySelectorAll(`p, div, li, br, blockquote, section, article, h1, h2, h3, h4, h5, h6`).forEach(e=>e.after(` `)),t.content.textContent?.replace(/\s+/g,` `).trim()??``}function hu(e){let t=e.full_content_html?.trim()?mu(e.full_content_html):``,n=!t&&e.content_html?.trim()?mu(e.content_html):``,r=e.content_snippet?.replace(/\s+/g,` `).trim()??``,i=t||(n.length>=r.length?n:r);return i?i.length>pu?`${i.slice(0,pu).trimEnd()}…`:i:null}function gu({item:e,className:t}){let n=(0,_.useMemo)(()=>hu(e),[e]);return n?(0,H.jsx)(`p`,{className:t,children:n}):null}function _u(e){let t=0,n=-5;return e.map((e,r)=>{let i=/^https?:\/\//i.test(e.image_url??``),a=(e.content_snippet?.trim().length??0)>=220,o=(i||a)&&r-n>=5&&t<=1;return t=(t+(o?2:1))%3,o&&(n=r),o})}function vu(e){let t=e.map(()=>!1),n=[],r=0;return e.forEach((i,a)=>{n.push(a),r+=i?2:1,r===3&&(n.some(t=>e[t])&&n.forEach(n=>{t[n]=!e[n]}),n=[],r=0)}),t}function yu({url:e,featured:t}){let[n,r]=(0,_.useState)(`loading`);return!e||!/^https?:\/\//i.test(e)?null:(0,H.jsx)(`div`,{className:n===`hidden`?`hidden`:`overflow-hidden border-b border-[var(--c-border)] bg-[var(--c-bg)]`,children:(0,H.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`w-full object-cover transition-transform duration-300 group-hover:scale-[1.025] ${t?`aspect-[16/9]`:`aspect-[3/2]`} ${n===`visible`?`opacity-100`:`opacity-0`}`,onLoad:e=>{let{naturalWidth:n,naturalHeight:i}=e.currentTarget;r(n>=(t?400:160)&&i>=(t?220:100)?`visible`:`hidden`)},onError:()=>r(`hidden`)})})}function bu({item:e,featured:t,besideFeature:n,onOpen:r,onBookmark:i,onRead:a}){let{t:o,i18n:s}=L(),c=e.published_at?new Date(e.published_at):null,l=c&&!Number.isNaN(c.getTime())?c:null,u=l?new Intl.DateTimeFormat(s.resolvedLanguage,{dateStyle:`medium`}).format(l):null,d=l?new Intl.DateTimeFormat(s.resolvedLanguage,{timeStyle:`short`}).format(l):null;return(0,H.jsx)(`li`,{className:t?`lg:col-span-2`:``,children:(0,H.jsxs)(`article`,{className:`card group relative flex h-full flex-col overflow-hidden transition-colors duration-150 hover:border-[var(--c-blue3)] hover:bg-[var(--c-surface-hover)]`,style:{opacity:e.read?.65:1},children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 rounded-xl focus-visible:outline-2 focus-visible:outline-offset-[-3px] focus-visible:outline-[var(--c-blue3)]`,"aria-label":e.title||e.feed_title||o(`items.title`),onClick:()=>r(e)}),(0,H.jsx)(yu,{url:e.image_url,featured:t},e.image_url??``),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col ${t?`p-5 sm:p-6`:`p-4 sm:p-5`}`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex min-w-0 items-center gap-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,H.jsx)(Gs,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.feed_title})]}),(0,H.jsx)(`h2`,{className:`text-[var(--c-text)] ${t?`text-xl leading-tight sm:text-2xl`:`text-lg leading-snug`} font-semibold`,children:e.title||e.feed_title}),(0,H.jsx)(gu,{item:e,className:`mt-3 text-sm leading-relaxed text-[var(--c-text-muted)] ${t?`line-clamp-4`:n?`line-clamp-3 lg:line-clamp-12`:`line-clamp-3`}`}),(0,H.jsxs)(`div`,{className:`pointer-events-none relative z-20 mt-auto flex flex-wrap items-center gap-x-3 gap-y-2 pt-5 text-xs text-[var(--c-text-muted)]`,children:[u&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:d??void 0,children:[(0,H.jsxs)(`svg`,{className:`h-3.5 w-3.5 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,H.jsx)(`path`,{d:`M8 2v4M16 2v4M3 10h18`})]}),u]}),d&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`h-3.5 w-3.5 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`path`,{d:`M12 6v6l4 2`})]}),d]}),(0,H.jsxs)(`div`,{className:`pointer-events-auto ml-auto flex items-center gap-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>i(e),title:e.bookmarked?o(`items.unbookmark`):o(`items.bookmark`),"aria-label":e.bookmarked?o(`items.unbookmark`):o(`items.bookmark`),className:`grid h-8 w-8 place-items-center rounded-lg border transition-colors ${e.bookmarked?`border-amber-500/40 bg-amber-500/15 text-amber-500`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500`}`,children:(0,H.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:e.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(e),title:e.read?o(`items.markUnread`):o(`items.markRead`),"aria-label":e.read?o(`items.markUnread`):o(`items.markRead`),className:`grid h-8 w-8 place-items-center rounded-lg border border-[var(--c-border)] transition-colors ${e.read?`text-[var(--c-text-muted)]`:`text-[var(--c-blue3)]`}`,children:(0,H.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:e.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,"aria-hidden":`true`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})]})]})})}function xu({items:e,onOpen:t,onBookmark:n,onRead:r}){let i=(0,_.useMemo)(()=>_u(e),[e]),a=(0,_.useMemo)(()=>vu(i),[i]);return(0,H.jsx)(`ul`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 sm:gap-5 animate-page-fade`,children:e.map((e,o)=>(0,H.jsx)(bu,{item:e,featured:i[o],besideFeature:a[o],onOpen:t,onBookmark:n,onRead:r},e.id))})}var Su=68,Cu=92,wu=`input, select, textarea, [contenteditable='true'], [data-no-pull]`;function Tu(){let e=e=>{e.preventDefault(),e.stopPropagation()};window.addEventListener(`click`,e,{capture:!0,once:!0}),window.setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function Eu({children:e,disabled:t=!1,onRefresh:n}){let{t:r}=L(),i=(0,_.useRef)(null),a=(0,_.useRef)(0),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),m=(0,_.useCallback)(()=>{u||(p(!1),d(!0),s(56),n().catch(()=>p(!0)).finally(()=>{d(!1),s(0)}))},[u,n]);(0,_.useEffect)(()=>{let e=i.current;if(!e)return;let n=null;function r(){n=null,a.current=0,l(!1),s(0)}function o(e){t||u||e.touches.length!==1||window.scrollY>1||!window.matchMedia(`(any-pointer: coarse)`).matches||document.body.style.overflow===`hidden`||e.target.closest(wu)||(n={x:e.touches[0].clientX,y:e.touches[0].clientY})}function c(e){if(!n||e.touches.length!==1)return;let t=e.touches[0].clientX-n.x,i=e.touches[0].clientY-n.y;if(window.scrollY>1||Math.abs(t)>Math.abs(i)){r();return}if(i<=0){a.current=0,s(0);return}e.preventDefault();let o=Math.min(Cu,i*.72);a.current=o,l(!0),s(o)}function d(){if(!n)return;let e=a.current>=Su;a.current>8&&Tu(),r(),e&&m()}return e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,c,{passive:!1}),e.addEventListener(`touchend`,d),e.addEventListener(`touchcancel`,r),()=>{e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,c),e.removeEventListener(`touchend`,d),e.removeEventListener(`touchcancel`,r)}},[t,u,n,m]);let h=u?1:Math.min(1,o/Su);return(0,H.jsxs)(`div`,{ref:i,children:[(0,H.jsx)(`button`,{type:`button`,className:`sr-only focus:not-sr-only sm:hidden`,onClick:m,disabled:t||u,children:r(`items.refresh`)}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`relative flex items-center justify-center overflow-hidden`,style:{height:o,transition:c?`none`:`height 220ms ease-out`},children:(0,H.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text)] shadow-sm`,style:{opacity:Math.min(1,o/30),transform:`scale(${.65+h*.35})`},children:(0,H.jsxs)(`svg`,{className:`h-5 w-5 ${u?`animate-spin motion-reduce:animate-none`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:u?void 0:{transform:`rotate(${h*270}deg)`},children:[(0,H.jsx)(`path`,{d:`M18 7a8 8 0 1 0 2 5`,pathLength:`100`,strokeDasharray:`${h*100} 100`}),(0,H.jsx)(`path`,{d:`M18 3v4h-4`,opacity:h})]})})}),u&&(0,H.jsx)(`span`,{className:`sr-only`,role:`status`,children:r(`items.refreshing`)}),f&&(0,H.jsx)(`p`,{className:`mb-3 text-center text-sm text-[var(--c-danger)]`,role:`alert`,children:r(`items.refreshFailed`)}),e]})}function Du(){let{user:e}=so(),t=Go(Yo()),[n,r]=(0,_.useState)(!1),i=!!e?.intro_dismissed_at;return(0,_.useEffect)(()=>{let n=!0;if(r(!1),t&&e&&i)return Promise.resolve(!t.applies||t.applies({id:e.id,email:e.email,display_name:e.display_name??null})).then(e=>{n&&r(e===!0)}).catch(()=>{n&&r(!1)}),()=>{n=!1}},[t?.mount,t?.applies,e?.id,i]),!t||!n?null:(0,H.jsx)(Ls,{name:`articles-notice`,mount:t.mount})}function Ou(){let{t:e}=L(),{user:t,setCurrentUser:n}=so(),[r,i]=(0,_.useState)(!1);if(!t||t.intro_dismissed_at)return null;async function a(){i(!0);try{n(await V.dismissIntro())}catch{i(!1)}}let o=[{key:`views`,className:`hidden sm:flex`,icon:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,H.jsx)(`path`,{d:`M18 14h-8`}),(0,H.jsx)(`path`,{d:`M15 18h-5`}),(0,H.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]})},{key:`unread`,solid:!0,icon:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})},{key:`star`,icon:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})},{key:`folders`,icon:(0,H.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}];return(0,H.jsxs)(`section`,{className:`card animate-fade-in flex flex-col gap-5 p-5 sm:p-7 shadow-xs`,"aria-labelledby":`intro-title`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{id:`intro-title`,className:`text-xl sm:text-2xl font-bold tracking-tight text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:e(`intro.title`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs sm:text-sm leading-relaxed text-[var(--c-text-muted)]`,children:e(`intro.subtitle`)})]}),(0,H.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":e(`common.close`),className:`shrink-0 rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,H.jsx)(ac,{})})]}),(0,H.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:o.map(t=>(0,H.jsxs)(`li`,{className:`flex items-start gap-3.5 rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 ${t.className??``}`,children:[(0,H.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text)]`,children:(0,H.jsx)(`svg`,{className:t.solid?`h-3.5 w-3.5`:`h-4 w-4`,viewBox:`0 0 24 24`,fill:t.solid?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:t.solid?2.2:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:t.icon})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:e(`intro.${t.key}Title`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-xs sm:text-sm leading-relaxed text-[var(--c-text-muted)]`,children:e(`intro.${t.key}Text`)})]})]},t.key))}),(0,H.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`btn-primary self-start`,children:e(`intro.done`)})]})}var ku=50;function Au(){return(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,H.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]})}var ju=`(max-width: 639px)`;function Mu(){return(0,_.useSyncExternalStore)(e=>{let t=window.matchMedia(ju);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(ju).matches)}function Nu(){let{t:e,i18n:t}=L(),[n,r]=Fi(),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),{syncAllowed:c}=Vs(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),w=(0,_.useRef)(0),T=(0,_.useRef)(0),E=(0,_.useRef)(!1),[D,ee]=(0,_.useState)(null),[O,te]=(0,_.useState)(()=>{try{return localStorage.getItem(`feedkeeper_items_view`)===`newspaper`?`newspaper`:`list`}catch{return`list`}}),k=Mu()?`newspaper`:O;function ne(e){if(e!==O){Wa(),te(e),window.scrollTo({top:0,behavior:`instant`});try{localStorage.setItem(`feedkeeper_items_view`,e)}catch{}}}let A=`feedkeeper_filter_scope`,re=`feedkeeper_filter_unread`,ie=`feedkeeper_filter_bookmarked`,ae=n.get(`article`),oe=(()=>{let e=n.get(`feed`);if(e)return`feed:${e}`;let t=n.get(`folder`);if(t)return`folder:${t}`;try{let e=localStorage.getItem(A);if(e)return e}catch{}return``})(),se=(()=>{try{let e=localStorage.getItem(re);if(e!==null)return e===`true`}catch{}return!0})(),ce=(()=>{if(n.get(`saved`)===`1`)return!0;if(n.get(`article`))return!1;try{let e=localStorage.getItem(ie);if(e!==null)return e===`true`}catch{}return!1})(),[j,le]=(0,_.useState)(oe),[M,ue]=(0,_.useState)(se),[de,fe]=(0,_.useState)(ce),pe=M&&!de,[me,he]=(0,_.useState)(``),[ge,_e]=(0,_.useState)(!1),N=(0,_.useRef)(null),P=(0,_.useRef)(null),ve=(0,_.useRef)(null),[F,ye]=(0,_.useState)(61),[be,xe]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=document.querySelector(`[data-app-header]`);if(!e)return;let t=new ResizeObserver(()=>ye(e.getBoundingClientRect().height));return t.observe(e),()=>t.disconnect()},[]),(0,_.useEffect)(()=>{function e(){let e=ve.current?.getBoundingClientRect().top;xe(window.scrollY>0&&e!==void 0&&e<=F+1)}return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[F]),(0,_.useEffect)(()=>{ge&&N.current?.focus()},[ge]),(0,_.useEffect)(()=>{let e=window.matchMedia(`(min-width: 640px)`),t=()=>{e.matches&&_e(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);function I(){_e(!1),requestAnimationFrame(()=>P.current?.focus())}function Se(e){Wa(),he(e)}function Ce(){Wa(),ue(e=>{let t=!e;try{localStorage.setItem(re,String(t))}catch{}return t})}function we(){Wa(),fe(e=>{let t=!e;try{localStorage.setItem(ie,String(t))}catch{}return t})}(0,_.useEffect)(()=>{if(p||E.current)return;let e=Ha(),t=requestAnimationFrame(()=>{e>0&&window.scrollTo({top:e,behavior:`instant`}),E.current=!0});return()=>cancelAnimationFrame(t)},[p]),(0,_.useEffect)(()=>{function e(){E.current&&document.body.style.overflow!==`hidden`&&Ua(window.scrollY)}return window.addEventListener(`scroll`,e,{passive:!0}),()=>{E.current&&document.body.style.overflow!==`hidden`&&Ua(window.scrollY),window.removeEventListener(`scroll`,e)}},[]),(0,_.useEffect)(()=>{let e=n.get(`feed`),t=n.get(`folder`);if(e){let t=`feed:${e}`;t!==j&&Wa(),le(t);try{localStorage.setItem(A,t)}catch{}}else if(t){let e=`folder:${t}`;e!==j&&Wa(),le(e);try{localStorage.setItem(A,e)}catch{}}else if(oe&&!n.toString()){let e=new URLSearchParams(n);oe.startsWith(`feed:`)?e.set(`feed`,oe.slice(5)):oe.startsWith(`folder:`)&&e.set(`folder`,oe.slice(7)),r(e,{replace:!0})}},[n]);function Te(e){Wa(),le(e);try{e?localStorage.setItem(A,e):localStorage.removeItem(A)}catch{}let t=new URLSearchParams(n);t.delete(`feed`),t.delete(`folder`),e.startsWith(`feed:`)?t.set(`feed`,e.slice(5)):e.startsWith(`folder:`)&&t.set(`folder`,e.slice(7)),r(t,{replace:!0})}(0,_.useEffect)(()=>{Promise.all([V.listFeeds(),V.listFolders().catch(()=>({folders:[]}))]).then(([e,t])=>{a(e),u(t.folders),s(!0)}).catch(e=>console.error(`Failed to load initial feeds/folders:`,e))},[]);let Ee=j.startsWith(`feed:`)?Number(j.slice(5)):void 0,De=j.startsWith(`folder:`)?Number(j.slice(7)):void 0,Oe=!me&&!de&&Ee===void 0&&De===void 0,ke=Oe&&i.length>0&&i.every(e=>!e.last_polled_at);async function Ae(){try{let[e,t]=await Promise.all([V.listFeeds(),V.listFolders().catch(()=>({folders:[]}))]);return e.length===0&&(n.has(`folder`)||n.has(`feed`))&&(r({},{replace:!0}),le(``)),a(e),u(t.folders),s(!0),e}catch(e){return console.error(`Failed to reload feeds:`,e),null}}async function je(){await Ae(),await Me(),eo()}async function Me(){let e=++w.current;m(!0),g(!1),x(!1),y(!1);try{let t=await V.listItems({feedId:Ee,folderId:De,unreadOnly:pe,bookmarkedOnly:de,search:me||void 0,limit:ku});e===w.current&&(f(t),T.current=t.length,C(t.length===ku))}catch(t){e===w.current&&(console.error(`Failed to load items:`,t),g(!0))}finally{e===w.current&&m(!1)}}async function Ne(){if(v||!S)return;let e=w.current;y(!0),x(!1);try{let t=await V.listItems({feedId:Ee,folderId:De,unreadOnly:pe,bookmarkedOnly:de,search:me||void 0,limit:ku,offset:T.current});e===w.current&&(T.current+=t.length,f(e=>{let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}),C(t.length===ku))}catch(t){e===w.current&&(console.error(`Failed to load more items:`,t),x(!0))}finally{e===w.current&&y(!1)}}(0,_.useEffect)(()=>{f([]),m(!0),C(!1),y(!1);let e=setTimeout(()=>{Me()},200);return()=>{clearTimeout(e),w.current++}},[j,M,de,me]),(0,_.useEffect)(()=>{if(!ke)return;let e=0,t=setInterval(()=>{e++,Ae().then(e=>{e?.some(e=>e.last_polled_at)&&Me()}),e>=45&&clearInterval(t)},4e3);return()=>clearInterval(t)},[ke]);let Pe=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(ae){let e=d.find(e=>e.id===Number(ae));ee(e??null),e&&!e.read&&Pe.current!==e.id&&(Pe.current=e.id,V.markRead(e.id).then(eo).catch(()=>{}),f(t=>t.map(t=>t.id===e.id?{...t,read:!0}:t)))}else ee(null)},[ae,d]);function Fe(e){ee(e),e.read||(V.markRead(e.id).then(eo).catch(()=>{}),f(t=>t.map(t=>t.id===e.id?{...t,read:!0}:t)),ee({...e,read:!0}));let t=new URLSearchParams(n);t.set(`article`,String(e.id)),r(t)}function Ie(){ee(null);let e=new URLSearchParams(n);e.delete(`article`),r(e)}let Le=D?d.findIndex(e=>e.id===D.id):-1,Re=Le>=0&&Le<d.length-1,ze=Le>0;function Be(){Re&&Fe(d[Le+1])}function Ve(){ze&&Fe(d[Le-1])}async function He(t){try{await t()}catch(t){if(!(t instanceof ga&&t.status===0))throw t;G.error(e(`common.offlineAction`))}}async function Ue(e){let t=!e.read;e.read?await V.markUnread(e.id):await V.markRead(e.id),eo(),f(n=>n.map(n=>n.id===e.id?{...n,read:t}:n)),D?.id===e.id&&ee(e=>e?{...e,read:t}:null)}async function We(e){let t=!e.bookmarked;e.bookmarked?await V.unbookmarkItem(e.id):await V.bookmarkItem(e.id),window.setTimeout(()=>void Ra({force:!0}),t?2e4:0),f(n=>de&&!t&&D?.id!==e.id?n.filter(t=>t.id!==e.id):n.map(n=>n.id===e.id?{...n,bookmarked:t}:n)),D?.id===e.id&&ee(e=>e?{...e,bookmarked:t}:null)}async function Ge(){await He(async()=>{await V.markAllRead({feedId:Ee,folderId:De}),await Me(),eo()})}let[Ke,qe]=(0,_.useState)(!1);async function Je(){qe(!0);try{let t=await V.refreshAllFeeds();await Me(),xc(t,e)}catch{G.error(e(`items.refreshFailed`))}finally{qe(!1)}}let Ye=new Intl.DateTimeFormat(t.resolvedLanguage,{dateStyle:`medium`}),Xe=new Intl.DateTimeFormat(t.resolvedLanguage,{timeStyle:`short`}),Ze=(0,_.useMemo)(()=>{let t=[{value:``,label:e(`items.allFeeds`)}];if(l.length>0)for(let n of l)t.push({value:`folder:${n.id}`,label:n.name,group:e(`feeds.folderGroup`),badge:n.unread_count});for(let n of i)t.push({value:`feed:${n.id}`,label:n.label??n.title??n.url,group:e(`feeds.feedGroup`),badge:n.unread_count});return t},[l,i,e]),Qe=j?Ze.find(e=>e.value===j)?.label??e(`items.title`):e(`items.allFeeds`);function $e(e){f(t=>t.map(t=>t.id===e.id?e:t)),D?.id===e.id&&ee(e)}let et=(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 sm:gap-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 sm:gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`sr-only`,children:Qe}),(0,H.jsx)(Dc,{className:`block`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`relative hidden h-11 w-[220px] shrink-0 grid-cols-2 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-1 sm:grid`,role:`group`,"aria-label":e(`items.viewMode`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-1 left-1 w-[calc((100%-0.5rem)/2)] rounded-lg border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none`,style:{transform:O===`newspaper`?`translateX(100%)`:`translateX(0)`}}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>ne(`list`),title:e(`items.listView`),"aria-label":e(`items.listView`),"aria-pressed":O===`list`,className:`relative z-10 flex h-full min-w-0 items-center justify-center gap-1.5 rounded-lg text-xs sm:text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${O===`list`?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4 transition-transform duration-200 motion-reduce:transition-none ${O===`list`?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M8 6h12M8 12h12M8 18h12`}),(0,H.jsx)(`circle`,{cx:`4`,cy:`6`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,H.jsx)(`circle`,{cx:`4`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,H.jsx)(`circle`,{cx:`4`,cy:`18`,r:`1`,fill:`currentColor`,stroke:`none`})]}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:e(`items.listView`)})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>ne(`newspaper`),title:e(`items.newspaperView`),"aria-label":e(`items.newspaperView`),"aria-pressed":O===`newspaper`,className:`relative z-10 flex h-full min-w-0 items-center justify-center gap-1.5 rounded-lg text-xs sm:text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${O===`newspaper`?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,H.jsxs)(`svg`,{className:`h-4 w-4 transition-transform duration-200 motion-reduce:transition-none ${O===`newspaper`?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,H.jsx)(`path`,{d:`M18 14h-8`}),(0,H.jsx)(`path`,{d:`M15 18h-5`}),(0,H.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:e(`items.newspaperView`)})]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:Je,disabled:Ke||!c,title:e(c?Ke?`items.refreshing`:`items.refresh`:`plan.unavailable`),"aria-label":e(Ke?`items.refreshing`:`items.refresh`),className:`btn-secondary hidden h-11 w-11 shrink-0 items-center justify-center p-0! sm:flex`,children:(0,H.jsx)(Ys,{className:`h-5 w-5 ${Ke?`animate-spin motion-reduce:animate-none`:``}`})}),(0,H.jsx)(`button`,{type:`button`,onClick:Ge,title:e(`feeds.markAllRead`),"aria-label":e(`feeds.markAllRead`),className:`btn-secondary flex h-11 w-11 shrink-0 items-center justify-center p-0!`,children:(0,H.jsx)(`svg`,{className:`h-5 w-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M3 12l4 4 6-7M11 16l3 0 7-8`})})})]})]}),(0,H.jsxs)(`div`,{ref:ve,className:`sticky z-20 py-2`,style:{top:F},children:[be&&(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-px bottom-0 left-1/2 w-screen -translate-x-1/2 border-y border-[var(--c-border)] backdrop-blur-md`,style:{backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`}}),(0,H.jsxs)(`div`,{className:`items-toolbar relative z-10 flex items-center gap-2 sm:gap-3 ${ge?`items-toolbar-open`:``}`,children:[(0,H.jsx)(`div`,{className:`items-toolbar-scope min-w-0 flex-1 sm:flex-none sm:w-64`,inert:ge,children:(0,H.jsx)(Hs,{value:j,onChange:Te,options:Ze,className:`w-full`,placeholder:e(`items.allFeeds`)})}),(0,H.jsxs)(`div`,{className:`relative hidden sm:block flex-1 min-w-0`,children:[(0,H.jsx)(`input`,{type:`search`,placeholder:e(`items.searchPlaceholder`),"aria-label":e(`items.searchPlaceholder`),className:`input w-full pl-9 pr-3`,value:me,onChange:e=>Se(e.target.value)}),(0,H.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none opacity-45 text-[var(--c-text-muted)]`,children:(0,H.jsx)(Au,{})})]}),(0,H.jsxs)(`div`,{className:`items-toolbar-search relative h-[38px] min-w-0 overflow-hidden sm:hidden`,children:[(0,H.jsx)(`button`,{ref:P,type:`button`,onClick:()=>_e(!0),"aria-label":e(`items.searchPlaceholder`),"aria-controls":`mobile-article-search`,"aria-expanded":ge,title:e(`items.searchPlaceholder`),"aria-hidden":ge,tabIndex:ge?-1:0,className:`absolute inset-y-0 left-0 z-10 flex w-[38px] items-center justify-center rounded-lg border transition-opacity duration-150 ${ge?`pointer-events-none opacity-0`:me?`border-[var(--c-blue3)] bg-[var(--c-surface-hover)] text-[var(--c-text)] opacity-100`:`border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text-muted)] opacity-100`}`,children:(0,H.jsx)(Au,{})}),(0,H.jsxs)(`div`,{className:`flex h-full min-w-0 items-center gap-2 transition-opacity duration-200 ${ge?`opacity-100 delay-75`:`pointer-events-none opacity-0`}`,inert:!ge,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--c-text-muted)] opacity-60`,children:(0,H.jsx)(Au,{})}),(0,H.jsx)(`input`,{id:`mobile-article-search`,ref:N,type:`search`,placeholder:e(`items.searchPlaceholder`),"aria-label":e(`items.searchPlaceholder`),className:`input min-w-0 flex-1 pl-9`,value:me,onChange:e=>Se(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()}}),(0,H.jsx)(`button`,{type:`button`,onClick:I,"aria-label":e(`common.close`),title:e(`common.close`),className:`w-[38px] h-[38px] rounded-lg border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text-muted)] flex items-center justify-center shrink-0 cursor-pointer`,children:(0,H.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,H.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,H.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]}),(0,H.jsxs)(`div`,{className:`items-toolbar-filters flex items-center gap-1.5 sm:gap-2 shrink-0`,inert:ge,children:[(0,H.jsx)(`button`,{type:`button`,onClick:we,title:e(de?`items.all`:`items.bookmarkedOnly`),"aria-label":e(`items.bookmarkedOnly`),"aria-pressed":de,className:`w-[38px] h-[38px] rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${de?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,H.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:de?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:Ce,disabled:de,title:e(de?`items.unreadIgnoredInSaved`:M?`items.all`:`items.unreadOnly`),"aria-label":e(`items.unreadOnly`),"aria-pressed":pe,className:`w-[38px] h-[38px] rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 ${pe?`bg-[var(--c-surface-hover)] border-[var(--c-blue3)] text-[var(--c-text)] shadow-xs`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`}`,children:(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:pe?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})]}),o&&i.length>0&&!c&&(0,H.jsx)(hc,{}),o&&i.length>0&&!h&&(0,H.jsx)(Ou,{}),o&&i.length>0&&!h&&(0,H.jsx)(Du,{}),h?(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,H.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(`items.loadFailed`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void Me(),className:`btn-secondary`,children:e(`common.retry`)})]}):p&&d.length===0?(0,H.jsx)(zs,{size:`lg`}):d.length===0&&o&&i.length===0?(0,H.jsx)(_c,{onSubscribed:je}):d.length===0&&ke?(0,H.jsxs)(`div`,{role:`status`,className:`card flex flex-col items-center gap-3 px-6 py-12 text-center`,children:[(0,H.jsx)(zs,{size:`lg`}),(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`welcome.fetchingTitle`)}),(0,H.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`welcome.fetchingHint`)})]}):d.length===0&&Oe&&pe&&i.length>0?(0,H.jsxs)(`div`,{className:`card flex flex-col items-center gap-3 px-6 py-12 text-center`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`items.allReadTitle`)}),(0,H.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`items.allReadHint`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>ue(!1),className:`btn-secondary mt-1`,children:e(`items.all`)})]}):d.length===0?(0,H.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(de&&!me?`items.noSaved`:me?`items.noResults`:`items.noItems`)}):k===`newspaper`?(0,H.jsx)(xu,{items:d,onOpen:Fe,onBookmark:We,onRead:Ue}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-4 sm:gap-5 animate-page-fade`,children:d.map(t=>{let n=t.published_at?new Date(t.published_at):null;return(0,H.jsx)(`li`,{onClick:()=>Fe(t),className:`card overflow-hidden p-4 sm:p-0 transition-colors duration-150 hover:bg-[var(--c-surface-hover)] hover:border-[var(--c-blue3)]/60 cursor-pointer group/card`,style:{opacity:t.read?.6:1},children:(0,H.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-stretch justify-between gap-3 sm:gap-0`,children:[t.image_url&&(0,H.jsx)(`div`,{className:`order-first w-[calc(100%+2rem)] -mx-4 -mt-4 sm:m-0 sm:w-52 sm:min-w-52 h-48 sm:h-auto sm:self-stretch overflow-hidden shrink-0 border-b sm:border-b-0 sm:border-r bg-[var(--c-bg)] group transition-opacity hover:opacity-90 block`,style:{borderColor:`var(--c-border)`},children:(0,H.jsx)(`img`,{src:t.image_url,alt:``,className:`w-full h-full object-cover group-hover:scale-105 transition-transform duration-200`,loading:`lazy`,onError:e=>{let t=e.currentTarget.parentElement;t&&(t.style.display=`none`)}})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 sm:p-5 sm:pr-3 flex flex-col justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex min-w-0 items-center gap-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,H.jsx)(Gs,{feedId:t.feed_id,iconUrl:t.feed_icon_url,siteUrl:t.feed_site_url,feedUrl:t.feed_url,articleUrl:t.link,className:`w-3.5 h-3.5 rounded-xs shrink-0 object-contain`}),(0,H.jsx)(`span`,{className:`truncate`,children:t.feed_title})]}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-[var(--c-text)]`,children:t.title}),(0,H.jsx)(gu,{item:t,className:`mt-3 text-sm leading-relaxed line-clamp-3 text-[var(--c-text-muted)]`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs pt-5`,style:{color:`var(--c-text-muted)`},children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 min-w-0`,children:n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,H.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,H.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,H.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,H.jsx)(`span`,{children:Ye.format(n)})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,H.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,H.jsx)(`span`,{children:Xe.format(n)})]})]})}),(0,H.jsxs)(`div`,{className:`flex sm:hidden items-center gap-2 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),We(t)},title:t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),"aria-label":t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),className:`w-8 h-8 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,H.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Ue(t)},title:t.read?e(`items.markUnread`):e(`items.markRead`),"aria-label":t.read?e(`items.markUnread`):e(`items.markRead`),className:`w-8 h-8 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.read?`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:t.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})]}),(0,H.jsxs)(`div`,{className:`hidden sm:flex items-center gap-2 pt-5 pr-5 shrink-0 self-start`,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),We(t)},title:t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),"aria-label":t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),className:`w-9 h-9 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,H.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Ue(t)},title:t.read?e(`items.markUnread`):e(`items.markRead`),"aria-label":t.read?e(`items.markUnread`):e(`items.markRead`),className:`w-9 h-9 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.read?`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,H.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:t.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})},t.id)})}),!h&&d.length>0&&(S||b)&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{Ne()},disabled:v,className:`btn-secondary self-center`,children:e(v?`common.loading`:b?`common.retry`:`common.loadMore`)}),(0,H.jsx)(fu,{item:D,isOpen:!!D,onClose:Ie,onToggleBookmark:We,onToggleRead:Ue,onNext:Be,onPrevious:Ve,onItemUpdated:$e,hasNext:Re,hasPrev:ze})]});return(0,H.jsx)(Eu,{disabled:p||!c||!!D||ge,onRefresh:Je,children:et})}function Pu(e,t){let n=Math.min(e,t);return{sx:Math.round((e-n)/2),sy:Math.round((t-n)/2),size:n}}async function Fu(e){let t=await createImageBitmap(e);try{let{sx:e,sy:n,size:r}=Pu(t.width,t.height),i=document.createElement(`canvas`);i.width=256,i.height=256;let a=i.getContext(`2d`);if(!a)throw Error(`canvas_unavailable`);return a.fillStyle=`#ffffff`,a.fillRect(0,0,256,256),a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,256,256),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`encode_failed`)),`image/jpeg`,.88)})}finally{t.close()}}function Iu({title:e,description:t,children:n,footer:r}){return(0,H.jsxs)(`section`,{className:`card`,children:[(e||t)&&(0,H.jsxs)(`header`,{className:`px-5 pt-5 pb-1 sm:px-6`,children:[e&&(0,H.jsx)(`h3`,{className:`text-base font-semibold`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:t})]}),(0,H.jsx)(`div`,{className:`divide-y divide-[var(--c-border)]`,children:n}),r&&(0,H.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-[var(--c-border)] px-5 py-4 sm:px-6`,children:r})]})}function Lu({label:e,hint:t,htmlFor:n,children:r,stacked:i=!1,inline:a=!1}){return(0,H.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`flex-col`:a?`flex-row items-center justify-between gap-4 sm:gap-6`:`flex-col sm:flex-row sm:items-center sm:justify-between sm:gap-6`}`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`label`,{htmlFor:n,className:`text-sm font-medium`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-0.5 text-sm text-[var(--c-text-muted)]`,children:t})]}),r&&(0,H.jsx)(`div`,{className:i?``:`shrink-0`,children:r})]})}function Ru({children:e}){return(0,H.jsx)(`div`,{className:`px-5 py-4 sm:px-6`,children:e})}function zu({id:e,checked:t,onChange:n,label:r}){return(0,H.jsxs)(`label`,{className:`relative inline-flex cursor-pointer items-center`,children:[(0,H.jsx)(`input`,{id:e,type:`checkbox`,className:`peer sr-only`,checked:t,onChange:e=>n(e.target.checked),"aria-label":r}),(0,H.jsx)(`span`,{className:`h-6 w-11 rounded-full bg-[var(--c-border)] transition-colors peer-checked:bg-[var(--c-blue1)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--c-blue3)] after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white after:shadow-sm after:transition-transform after:content-[''] peer-checked:after:translate-x-5`})]})}function Bu({message:e}){return e?(0,H.jsx)(`p`,{role:`status`,className:`text-sm ${e.type===`error`?`text-danger`:`text-[var(--c-green3)]`}`,children:e.text}):null}function Vu({title:e,description:t}){return(0,H.jsxs)(`div`,{className:`mb-5`,children:[(0,H.jsx)(`h2`,{className:`text-xl font-semibold`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:t})]})}var Hu=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),Uu=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),Wu=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Gu=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ku=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),qu=o((e=>{var t=Uu().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Ju=o((e=>{var t=Uu().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Yu=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Xu=o((e=>{var t=Wu(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Y=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Zu=o((e=>{var t=Y();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),X=o(((e,t)=>{var n=Zu();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Z=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Q=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
16
16
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Qu=o((e=>{var t=Z(),n=Q();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),$u=o((e=>{var t=Uu(),n=Xu(),r=Wu(),i=Qu(),a=Z(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ed=o((e=>{var t=Uu(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),td=o(((e,t)=>{var n=Qu();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),nd=o(((e,t)=>{var n=Qu(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),rd=o(((e,t)=>{var n=Qu();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),id=o(((e,t)=>{var n=Qu(),r=Uu();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
package/web/dist/index.html
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<meta name="twitter:image" content="/logo.svg" />
|
|
31
31
|
<!-- Inline so the splash paints before any script or stylesheet loads -->
|
|
32
32
|
<style>html{background:#f8fafc}html[data-theme=dark]{background:#0b0f17}@media (prefers-color-scheme:dark){html:not([data-theme=light]){background:#0b0f17}}#splash{z-index:100;background:inherit;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:fixed;inset:0}#splash img{width:62px;height:62px;animation:.4s both splash-in}#splash.splash-hidden{opacity:0;pointer-events:none}@keyframes splash-in{0%{opacity:0;transform:scale(.92)}}@media (prefers-reduced-motion:reduce){#splash,#splash img{transition:none;animation:none}}</style>
|
|
33
|
-
<script type="module" crossorigin src="/assets/index-
|
|
33
|
+
<script type="module" crossorigin src="/assets/index-CyPm9mJM.js"></script>
|
|
34
34
|
<link rel="stylesheet" crossorigin href="/assets/index-BprbGvrl.css">
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|
package/web/dist/sw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// FeedKeeper service worker. Built into dist/sw.js, where the placeholder below is
|
|
2
2
|
// replaced with a hash of the build's file names so every release gets its own app cache.
|
|
3
|
-
const BUILD_ID = "
|
|
3
|
+
const BUILD_ID = "eee4dedcca1a";
|
|
4
4
|
const STATIC_CACHE = `fk-static-${BUILD_ID}`;
|
|
5
5
|
const API_CACHE = "fk-api";
|
|
6
6
|
let privateGeneration = 0;
|
|
@@ -173,12 +173,17 @@ async function mutableImage(request) {
|
|
|
173
173
|
} catch { return generation === privateGeneration ? cached ?? Response.error() : Response.error(); }
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
async function networkFirst(cacheName, request, limit) {
|
|
176
|
+
async function networkFirst(cacheName, request, limit, retried = false) {
|
|
177
177
|
let generation = privateGeneration;
|
|
178
178
|
let cache = await caches.open(cacheName);
|
|
179
179
|
try {
|
|
180
180
|
const response = await withTimeout(fetch(request), NETWORK_TIMEOUT_MS);
|
|
181
|
-
if (generation !== privateGeneration)
|
|
181
|
+
if (generation !== privateGeneration) {
|
|
182
|
+
// Parallel requests during a login race with the cache reset. The answer may belong to the old
|
|
183
|
+
// session, so it is neither cached nor returned; asking again must not look like a lost connection.
|
|
184
|
+
if (!retried) return await networkFirst(cacheName, request, limit, true);
|
|
185
|
+
throw new Error("session_changed");
|
|
186
|
+
}
|
|
182
187
|
if (new URL(request.url).pathname === "/api/auth/me" && generation === privateGeneration) {
|
|
183
188
|
if (response.ok) {
|
|
184
189
|
const user = await response.clone().json();
|