@the-portland-company/shell 0.93.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/app-chrome.cjs +105 -46
  3. package/dist/app-chrome.cjs.map +1 -1
  4. package/dist/app-chrome.d.cts +2 -1
  5. package/dist/app-chrome.d.ts +2 -1
  6. package/dist/app-chrome.js +6 -50
  7. package/dist/app-chrome.js.map +1 -1
  8. package/dist/app-icons.cjs +9 -0
  9. package/dist/app-icons.cjs.map +1 -1
  10. package/dist/app-icons.d.cts +5 -3
  11. package/dist/app-icons.d.ts +5 -3
  12. package/dist/app-icons.js +9 -1
  13. package/dist/app-icons.js.map +1 -1
  14. package/dist/brand-favicon.cjs +87 -0
  15. package/dist/brand-favicon.cjs.map +1 -0
  16. package/dist/brand-favicon.d.cts +18 -0
  17. package/dist/brand-favicon.d.ts +18 -0
  18. package/dist/brand-favicon.js +4 -0
  19. package/dist/brand-favicon.js.map +1 -0
  20. package/dist/{chunk-EN5ANFMB.js → chunk-BA3GITRQ.js} +4 -4
  21. package/dist/{chunk-EN5ANFMB.js.map → chunk-BA3GITRQ.js.map} +1 -1
  22. package/dist/chunk-BMR5WAWH.js +111 -0
  23. package/dist/chunk-BMR5WAWH.js.map +1 -0
  24. package/dist/{chunk-Y66PVCZO.js → chunk-JQ53VZO5.js} +68 -3
  25. package/dist/chunk-JQ53VZO5.js.map +1 -0
  26. package/dist/{index-BAFJZuRA.d.cts → index-AIzWNzl-.d.cts} +22 -1
  27. package/dist/{index-DoSs3sQY.d.ts → index-Byjq0Whp.d.ts} +22 -1
  28. package/dist/index.cjs +147 -0
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +3 -2
  31. package/dist/index.d.ts +3 -2
  32. package/dist/index.js +3 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/native.cjs +148 -3
  35. package/dist/native.cjs.map +1 -1
  36. package/dist/native.d.cts +2 -1
  37. package/dist/native.d.ts +2 -1
  38. package/dist/native.js +4 -3
  39. package/package.json +6 -1
  40. package/dist/chunk-Y66PVCZO.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties, ComponentType } from 'react';
3
3
  import { ThemePreference as ThemePreference$1 } from './theme-preference.cjs';
4
+ import './brand-favicon.cjs';
4
5
 
5
6
  type CardProps = {
6
7
  title?: string;
@@ -12,6 +13,26 @@ type CardProps = {
12
13
  };
13
14
  declare function Card({ title, children, minH, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
14
15
 
16
+ type AiCreditsStateKind = 'out' | 'paused' | 'waiting';
17
+ /** Organization Settings → Subscription & Billing → Wallet, on this organization. */
18
+ declare function aiCreditsWalletUrl(orgId?: string | null): string;
19
+ declare const AI_CREDITS_STATE_TITLES: Record<AiCreditsStateKind, string>;
20
+ type AiCreditsStateProps = {
21
+ kind: AiCreditsStateKind;
22
+ orgId?: string | null;
23
+ /** Account Admins see the Wallet buttons; others are told to ask one. */
24
+ isAccountAdmin: boolean;
25
+ /** paused: when the last output was made; null when there has been none. */
26
+ lastOutputAt?: Date | string | null;
27
+ /** Shows "Check again" (re-ask can-start). */
28
+ onCheckAgain?: () => void;
29
+ /** Overrides the time format (tests, or an app's own locale). */
30
+ formatTime?: (at: Date) => string;
31
+ className?: string;
32
+ style?: CSSProperties;
33
+ };
34
+ declare function AiCreditsState({ kind, orgId, isAccountAdmin, lastOutputAt, onCheckAgain, formatTime, className, style, }: AiCreditsStateProps): react_jsx_runtime.JSX.Element;
35
+
15
36
  type FormColumnProps = {
16
37
  children: ReactNode;
17
38
  className?: string;
@@ -1168,4 +1189,4 @@ type NavAppShellProps = {
1168
1189
  };
1169
1190
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
1170
1191
 
1171
- export { NavBetaBanner as $, CREDIT_TYPE_ORDER as A, type BreadcrumbBarProps as B, Card as C, type CampaignFeatureAvailability as D, type ChromeMe as E, FormColumn as F, type ChromeNotificationAlert as G, HeaderTabBar as H, type ChromeNotificationImport as I, type ChromeNotificationQuarantine as J, KNOWN_TAB_GLYPHS as K, type ChromeNotificationReply as L, type ChromeNotificationsPayload as M, type NavItem as N, type ChromeOrgSummary as O, type PageHeaderProps as P, type CommunicationsFuelStatus as Q, type CreditHealthState as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type CreditTypeKey as U, CreditsAction as V, type CreditsIconState as W, FuelAction as X, type FuelChannelStatus as Y, NavAppShell as Z, type NavAppShellProps as _, type CommsNotification as a, type NavBetaBannerProps as a0, type NavBrand as a1, NavChromeProvider as a2, NavDisplayAction as a3, type NavLinkProps as a4, type NavLinkedAccount as a5, type NavModeOption as a6, type NavOrg as a7, type NavRoleBadge as a8, NavSidebar as a9, creditTooltipLine as aA, creditsAriaLabel as aB, creditsIconState as aC, envChipClasses as aD, isNavItemActive as aE, modeIdFromLabel as aF, resolveOrgLogoUrl as aG, shortEnvLabel as aH, shortUserName as aI, standardPolitogyNav as aJ, topBarIconButtonClass as aK, useChromeMe as aL, useChromeOrgs as aM, useNavChromeDedupedFetch as aN, useNavChromeFetcher as aO, useThemePreference as aP, type NavSidebarProps as aa, type NavTab as ab, NavTabStrip as ac, type NavTabStripProps as ad, NavThemeControl as ae, NavTopBar as af, type NavTopBarAction as ag, type NavTopBarProps as ah, type NavUser as ai, NotificationsAction as aj, PageHeader as ak, type PageHeaderMode as al, SPECS_ORIGIN as am, SpecOverlayAction as an, type StandardNavOptions as ao, SupportAction as ap, type ThemePreference as aq, TopBarCountBadge as ar, type TopBarIconTone as as, TopBarPanelArrow as at, TopBarPopover as au, TopBarTooltip as av, TopBarWidgetSlot as aw, clearBetaBannerDismissal as ax, creditGaugeRatio as ay, creditStateWord as az, type CommsNotificationKind as b, type HeaderTabBarItem as c, type NotificationsAdapter as d, type NotificationsFeed as e, createCommsNotificationsAdapter as f, emptyNotificationsFeed as g, type NavIcon as h, type NavBreadcrumb as i, type StandardNavMode as j, type NavLinkComponent as k, type NavChromeFetcher as l, type NavMode as m, normalizeNotificationsFeed as n, type NavUserMenu as o, type NavOrgOption as p, type NavFooterLink as q, resolveTabGlyph as r, type NavFooter as s, type NavDisplayMode as t, BETA_BANNER_DISMISS_KEY as u, BreadcrumbBar as v, CAMPAIGN_FEATURE_AVAILABILITY as w, CORE_APP_ORIGIN as x, CORE_BILLING_PATH as y, CREDIT_TYPE_LABELS as z };
1192
+ export { FuelAction as $, AI_CREDITS_STATE_TITLES as A, type BreadcrumbBarProps as B, Card as C, CORE_APP_ORIGIN as D, CORE_BILLING_PATH as E, FormColumn as F, CREDIT_TYPE_LABELS as G, HeaderTabBar as H, CREDIT_TYPE_ORDER as I, type CampaignFeatureAvailability as J, KNOWN_TAB_GLYPHS as K, type ChromeMe as L, type ChromeNotificationAlert as M, type NavItem as N, type ChromeNotificationImport as O, type PageHeaderProps as P, type ChromeNotificationQuarantine as Q, type ChromeNotificationReply as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type ChromeNotificationsPayload as U, type ChromeOrgSummary as V, type CommunicationsFuelStatus as W, type CreditHealthState as X, type CreditTypeKey as Y, CreditsAction as Z, type CreditsIconState as _, AiCreditsState as a, type FuelChannelStatus as a0, NavAppShell as a1, type NavAppShellProps as a2, NavBetaBanner as a3, type NavBetaBannerProps as a4, type NavBrand as a5, NavChromeProvider as a6, NavDisplayAction as a7, type NavLinkProps as a8, type NavLinkedAccount as a9, TopBarWidgetSlot as aA, clearBetaBannerDismissal as aB, creditGaugeRatio as aC, creditStateWord as aD, creditTooltipLine as aE, creditsAriaLabel as aF, creditsIconState as aG, envChipClasses as aH, isNavItemActive as aI, modeIdFromLabel as aJ, resolveOrgLogoUrl as aK, shortEnvLabel as aL, shortUserName as aM, standardPolitogyNav as aN, topBarIconButtonClass as aO, useChromeMe as aP, useChromeOrgs as aQ, useNavChromeDedupedFetch as aR, useNavChromeFetcher as aS, useThemePreference as aT, type NavModeOption as aa, type NavOrg as ab, type NavRoleBadge as ac, NavSidebar as ad, type NavSidebarProps as ae, type NavTab as af, NavTabStrip as ag, type NavTabStripProps as ah, NavThemeControl as ai, NavTopBar as aj, type NavTopBarAction as ak, type NavTopBarProps as al, type NavUser as am, NotificationsAction as an, PageHeader as ao, type PageHeaderMode as ap, SPECS_ORIGIN as aq, SpecOverlayAction as ar, type StandardNavOptions as as, SupportAction as at, type ThemePreference as au, TopBarCountBadge as av, type TopBarIconTone as aw, TopBarPanelArrow as ax, TopBarPopover as ay, TopBarTooltip as az, type AiCreditsStateKind as b, type CommsNotification as c, type CommsNotificationKind as d, type HeaderTabBarItem as e, type NotificationsAdapter as f, type NotificationsFeed as g, aiCreditsWalletUrl as h, createCommsNotificationsAdapter as i, emptyNotificationsFeed as j, type NavIcon as k, type NavBreadcrumb as l, type StandardNavMode as m, normalizeNotificationsFeed as n, type NavLinkComponent as o, type NavChromeFetcher as p, type NavMode as q, resolveTabGlyph as r, type NavUserMenu as s, type NavOrgOption as t, type NavFooterLink as u, type NavFooter as v, type NavDisplayMode as w, BETA_BANNER_DISMISS_KEY as x, BreadcrumbBar as y, CAMPAIGN_FEATURE_AVAILABILITY as z };
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties, ComponentType } from 'react';
3
3
  import { ThemePreference as ThemePreference$1 } from './theme-preference.js';
4
+ import './brand-favicon.js';
4
5
 
5
6
  type CardProps = {
6
7
  title?: string;
@@ -12,6 +13,26 @@ type CardProps = {
12
13
  };
13
14
  declare function Card({ title, children, minH, className, style, ...props }: CardProps): react_jsx_runtime.JSX.Element;
14
15
 
16
+ type AiCreditsStateKind = 'out' | 'paused' | 'waiting';
17
+ /** Organization Settings → Subscription & Billing → Wallet, on this organization. */
18
+ declare function aiCreditsWalletUrl(orgId?: string | null): string;
19
+ declare const AI_CREDITS_STATE_TITLES: Record<AiCreditsStateKind, string>;
20
+ type AiCreditsStateProps = {
21
+ kind: AiCreditsStateKind;
22
+ orgId?: string | null;
23
+ /** Account Admins see the Wallet buttons; others are told to ask one. */
24
+ isAccountAdmin: boolean;
25
+ /** paused: when the last output was made; null when there has been none. */
26
+ lastOutputAt?: Date | string | null;
27
+ /** Shows "Check again" (re-ask can-start). */
28
+ onCheckAgain?: () => void;
29
+ /** Overrides the time format (tests, or an app's own locale). */
30
+ formatTime?: (at: Date) => string;
31
+ className?: string;
32
+ style?: CSSProperties;
33
+ };
34
+ declare function AiCreditsState({ kind, orgId, isAccountAdmin, lastOutputAt, onCheckAgain, formatTime, className, style, }: AiCreditsStateProps): react_jsx_runtime.JSX.Element;
35
+
15
36
  type FormColumnProps = {
16
37
  children: ReactNode;
17
38
  className?: string;
@@ -1168,4 +1189,4 @@ type NavAppShellProps = {
1168
1189
  };
1169
1190
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
1170
1191
 
1171
- export { NavBetaBanner as $, CREDIT_TYPE_ORDER as A, type BreadcrumbBarProps as B, Card as C, type CampaignFeatureAvailability as D, type ChromeMe as E, FormColumn as F, type ChromeNotificationAlert as G, HeaderTabBar as H, type ChromeNotificationImport as I, type ChromeNotificationQuarantine as J, KNOWN_TAB_GLYPHS as K, type ChromeNotificationReply as L, type ChromeNotificationsPayload as M, type NavItem as N, type ChromeOrgSummary as O, type PageHeaderProps as P, type CommunicationsFuelStatus as Q, type CreditHealthState as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type CreditTypeKey as U, CreditsAction as V, type CreditsIconState as W, FuelAction as X, type FuelChannelStatus as Y, NavAppShell as Z, type NavAppShellProps as _, type CommsNotification as a, type NavBetaBannerProps as a0, type NavBrand as a1, NavChromeProvider as a2, NavDisplayAction as a3, type NavLinkProps as a4, type NavLinkedAccount as a5, type NavModeOption as a6, type NavOrg as a7, type NavRoleBadge as a8, NavSidebar as a9, creditTooltipLine as aA, creditsAriaLabel as aB, creditsIconState as aC, envChipClasses as aD, isNavItemActive as aE, modeIdFromLabel as aF, resolveOrgLogoUrl as aG, shortEnvLabel as aH, shortUserName as aI, standardPolitogyNav as aJ, topBarIconButtonClass as aK, useChromeMe as aL, useChromeOrgs as aM, useNavChromeDedupedFetch as aN, useNavChromeFetcher as aO, useThemePreference as aP, type NavSidebarProps as aa, type NavTab as ab, NavTabStrip as ac, type NavTabStripProps as ad, NavThemeControl as ae, NavTopBar as af, type NavTopBarAction as ag, type NavTopBarProps as ah, type NavUser as ai, NotificationsAction as aj, PageHeader as ak, type PageHeaderMode as al, SPECS_ORIGIN as am, SpecOverlayAction as an, type StandardNavOptions as ao, SupportAction as ap, type ThemePreference as aq, TopBarCountBadge as ar, type TopBarIconTone as as, TopBarPanelArrow as at, TopBarPopover as au, TopBarTooltip as av, TopBarWidgetSlot as aw, clearBetaBannerDismissal as ax, creditGaugeRatio as ay, creditStateWord as az, type CommsNotificationKind as b, type HeaderTabBarItem as c, type NotificationsAdapter as d, type NotificationsFeed as e, createCommsNotificationsAdapter as f, emptyNotificationsFeed as g, type NavIcon as h, type NavBreadcrumb as i, type StandardNavMode as j, type NavLinkComponent as k, type NavChromeFetcher as l, type NavMode as m, normalizeNotificationsFeed as n, type NavUserMenu as o, type NavOrgOption as p, type NavFooterLink as q, resolveTabGlyph as r, type NavFooter as s, type NavDisplayMode as t, BETA_BANNER_DISMISS_KEY as u, BreadcrumbBar as v, CAMPAIGN_FEATURE_AVAILABILITY as w, CORE_APP_ORIGIN as x, CORE_BILLING_PATH as y, CREDIT_TYPE_LABELS as z };
1192
+ export { FuelAction as $, AI_CREDITS_STATE_TITLES as A, type BreadcrumbBarProps as B, Card as C, CORE_APP_ORIGIN as D, CORE_BILLING_PATH as E, FormColumn as F, CREDIT_TYPE_LABELS as G, HeaderTabBar as H, CREDIT_TYPE_ORDER as I, type CampaignFeatureAvailability as J, KNOWN_TAB_GLYPHS as K, type ChromeMe as L, type ChromeNotificationAlert as M, type NavItem as N, type ChromeNotificationImport as O, type PageHeaderProps as P, type ChromeNotificationQuarantine as Q, type ChromeNotificationReply as R, type StandardNavIconKey as S, type TabGlyphComponent as T, type ChromeNotificationsPayload as U, type ChromeOrgSummary as V, type CommunicationsFuelStatus as W, type CreditHealthState as X, type CreditTypeKey as Y, CreditsAction as Z, type CreditsIconState as _, AiCreditsState as a, type FuelChannelStatus as a0, NavAppShell as a1, type NavAppShellProps as a2, NavBetaBanner as a3, type NavBetaBannerProps as a4, type NavBrand as a5, NavChromeProvider as a6, NavDisplayAction as a7, type NavLinkProps as a8, type NavLinkedAccount as a9, TopBarWidgetSlot as aA, clearBetaBannerDismissal as aB, creditGaugeRatio as aC, creditStateWord as aD, creditTooltipLine as aE, creditsAriaLabel as aF, creditsIconState as aG, envChipClasses as aH, isNavItemActive as aI, modeIdFromLabel as aJ, resolveOrgLogoUrl as aK, shortEnvLabel as aL, shortUserName as aM, standardPolitogyNav as aN, topBarIconButtonClass as aO, useChromeMe as aP, useChromeOrgs as aQ, useNavChromeDedupedFetch as aR, useNavChromeFetcher as aS, useThemePreference as aT, type NavModeOption as aa, type NavOrg as ab, type NavRoleBadge as ac, NavSidebar as ad, type NavSidebarProps as ae, type NavTab as af, NavTabStrip as ag, type NavTabStripProps as ah, NavThemeControl as ai, NavTopBar as aj, type NavTopBarAction as ak, type NavTopBarProps as al, type NavUser as am, NotificationsAction as an, PageHeader as ao, type PageHeaderMode as ap, SPECS_ORIGIN as aq, SpecOverlayAction as ar, type StandardNavOptions as as, SupportAction as at, type ThemePreference as au, TopBarCountBadge as av, type TopBarIconTone as aw, TopBarPanelArrow as ax, TopBarPopover as ay, TopBarTooltip as az, type AiCreditsStateKind as b, type CommsNotification as c, type CommsNotificationKind as d, type HeaderTabBarItem as e, type NotificationsAdapter as f, type NotificationsFeed as g, aiCreditsWalletUrl as h, createCommsNotificationsAdapter as i, emptyNotificationsFeed as j, type NavIcon as k, type NavBreadcrumb as l, type StandardNavMode as m, normalizeNotificationsFeed as n, type NavLinkComponent as o, type NavChromeFetcher as p, type NavMode as q, resolveTabGlyph as r, type NavUserMenu as s, type NavOrgOption as t, type NavFooterLink as u, type NavFooter as v, type NavDisplayMode as w, BETA_BANNER_DISMISS_KEY as x, BreadcrumbBar as y, CAMPAIGN_FEATURE_AVAILABILITY as z };
package/dist/index.cjs CHANGED
@@ -855,6 +855,71 @@ function Card({
855
855
  }
856
856
  );
857
857
  }
858
+ var SETTINGS_ORIGIN = "https://settings.politogyvrm.com";
859
+ var WALLET_PATH = "/organization-settings/subscription-billing/wallet";
860
+ function aiCreditsWalletUrl(orgId) {
861
+ const url = new URL(WALLET_PATH, SETTINGS_ORIGIN);
862
+ if (orgId) url.searchParams.set("org", orgId);
863
+ return url.toString();
864
+ }
865
+ var AI_CREDITS_STATE_TITLES = {
866
+ out: "Out of AI Credits",
867
+ paused: "Paused \u2014 out of AI Credits",
868
+ waiting: "Waiting for AI Credits"
869
+ };
870
+ var MUTED = { color: "var(--color-text-muted, #6b7280)" };
871
+ var BUTTON = {
872
+ display: "inline-block",
873
+ borderRadius: 6,
874
+ padding: "6px 12px",
875
+ fontSize: 12,
876
+ fontWeight: 600,
877
+ textDecoration: "none"
878
+ };
879
+ var PRIMARY = { ...BUTTON, background: "var(--color-text, #2F3136)", color: "#fff" };
880
+ var SECONDARY = {
881
+ ...BUTTON,
882
+ border: "1px solid var(--color-border, #e5e7eb)",
883
+ color: "var(--color-text, #2F3136)"
884
+ };
885
+ var defaultFormat = (at) => at.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
886
+ function detail(kind, lastOutputAt, format) {
887
+ if (kind === "paused") return lastOutputAt ? `Last updated ${format(lastOutputAt)}.` : "Nothing has been generated yet.";
888
+ if (kind === "waiting") return "This step is kept and starts on its own once AI Credits are added.";
889
+ return null;
890
+ }
891
+ function AiCreditsState({
892
+ kind,
893
+ orgId,
894
+ isAccountAdmin,
895
+ lastOutputAt,
896
+ onCheckAgain,
897
+ formatTime = defaultFormat,
898
+ className,
899
+ style
900
+ }) {
901
+ const at = lastOutputAt == null ? null : lastOutputAt instanceof Date ? lastOutputAt : new Date(lastOutputAt);
902
+ const last = at && !Number.isNaN(at.getTime()) ? at : null;
903
+ const text = detail(kind, last, formatTime);
904
+ const wallet = aiCreditsWalletUrl(orgId);
905
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "status", "data-ai-credits-state": kind, className, style: { fontSize: 14, ...style }, children: [
906
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontWeight: 600 }, children: AI_CREDITS_STATE_TITLES[kind] }),
907
+ text && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: text }),
908
+ isAccountAdmin ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginTop: 8, display: "flex", flexWrap: "wrap", gap: 8 }, children: [
909
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: PRIMARY, children: "Buy AI Credits" }),
910
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: wallet, style: SECONDARY, children: "Turn on auto top-off" })
911
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "4px 0 0", ...MUTED }, children: "Ask an Account Admin to add AI Credits." }),
912
+ onCheckAgain && /* @__PURE__ */ jsxRuntime.jsx(
913
+ "button",
914
+ {
915
+ type: "button",
916
+ onClick: onCheckAgain,
917
+ style: { marginTop: 8, padding: 0, border: 0, background: "none", fontSize: 12, textDecoration: "underline", cursor: "pointer", ...MUTED },
918
+ children: "Check again"
919
+ }
920
+ )
921
+ ] });
922
+ }
858
923
  function FormColumn({ children, className }) {
859
924
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-shell-form-column": "", className: clsx5__default.default("w-full max-w-[960px]", className), children });
860
925
  }
@@ -1602,6 +1667,80 @@ function BrandIcon({
1602
1667
  }
1603
1668
  );
1604
1669
  }
1670
+ function parseCssUrl(value) {
1671
+ if (!value) return null;
1672
+ const m = /^url\(\s*(['"]?)(.*?)\1\s*\)$/i.exec(value.trim());
1673
+ const url = m?.[2]?.trim();
1674
+ return url && /^https:\/\//i.test(url) ? url : null;
1675
+ }
1676
+ function readBrandAsset(kind) {
1677
+ if (typeof document === "undefined") return null;
1678
+ try {
1679
+ return parseCssUrl(
1680
+ window.getComputedStyle(document.documentElement).getPropertyValue(`--asset-${kind}`)
1681
+ );
1682
+ } catch {
1683
+ return null;
1684
+ }
1685
+ }
1686
+
1687
+ // src/lib/brandFavicon.ts
1688
+ var BRAND_FAVICON_LINK_ID = "politogy-brand-favicon";
1689
+ var BRAND_APPLE_ICON_LINK_ID = "politogy-brand-apple-icon";
1690
+ function upsertLink(id, rel, href) {
1691
+ let link = document.getElementById(id);
1692
+ if (!link) {
1693
+ link = document.createElement("link");
1694
+ link.id = id;
1695
+ link.rel = rel;
1696
+ }
1697
+ if (link.getAttribute("href") !== href) link.href = href;
1698
+ const icons = document.head.querySelectorAll(`link[rel~="${rel.split(" ")[0]}"]`);
1699
+ if (icons[icons.length - 1] !== link) document.head.appendChild(link);
1700
+ }
1701
+ function applyBrandFavicon() {
1702
+ if (typeof document === "undefined") return false;
1703
+ const favicon = readBrandAsset("favicon");
1704
+ if (!favicon) return false;
1705
+ upsertLink(BRAND_FAVICON_LINK_ID, "icon", favicon);
1706
+ const apple = readBrandAsset("apple-icon");
1707
+ if (apple) upsertLink(BRAND_APPLE_ICON_LINK_ID, "apple-touch-icon", apple);
1708
+ return true;
1709
+ }
1710
+ var RETRY_MS = [0, 250, 1e3, 3e3];
1711
+ function watchBrandFavicon() {
1712
+ if (typeof document === "undefined") return () => {
1713
+ };
1714
+ let done = false;
1715
+ const apply = () => {
1716
+ if (!done) applyBrandFavicon();
1717
+ };
1718
+ const sheets = /* @__PURE__ */ new Set();
1719
+ const listen = () => {
1720
+ document.querySelectorAll('link[rel="stylesheet"][href*="api/tokens"]').forEach((l) => {
1721
+ if (sheets.has(l)) return;
1722
+ sheets.add(l);
1723
+ l.addEventListener("load", apply);
1724
+ });
1725
+ };
1726
+ listen();
1727
+ const timers = RETRY_MS.map((ms) => window.setTimeout(apply, ms));
1728
+ const observer = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
1729
+ listen();
1730
+ apply();
1731
+ });
1732
+ observer?.observe(document.head, { childList: true });
1733
+ return () => {
1734
+ done = true;
1735
+ sheets.forEach((l) => l.removeEventListener("load", apply));
1736
+ timers.forEach((t) => window.clearTimeout(t));
1737
+ observer?.disconnect();
1738
+ };
1739
+ }
1740
+ function BrandFavicon() {
1741
+ react$1.useEffect(() => watchBrandFavicon(), []);
1742
+ return null;
1743
+ }
1605
1744
 
1606
1745
  // src/lib/orgColors.ts
1607
1746
  var HEX_COLOR_PATTERN = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
@@ -1900,6 +2039,11 @@ function SpeculationRulesScript({ items }) {
1900
2039
  return null;
1901
2040
  }
1902
2041
 
2042
+ exports.AI_CREDITS_STATE_TITLES = AI_CREDITS_STATE_TITLES;
2043
+ exports.AiCreditsState = AiCreditsState;
2044
+ exports.BRAND_APPLE_ICON_LINK_ID = BRAND_APPLE_ICON_LINK_ID;
2045
+ exports.BRAND_FAVICON_LINK_ID = BRAND_FAVICON_LINK_ID;
2046
+ exports.BrandFavicon = BrandFavicon;
1903
2047
  exports.BrandIcon = BrandIcon;
1904
2048
  exports.BrandLogo = BrandLogo;
1905
2049
  exports.BreadcrumbBar = BreadcrumbBar;
@@ -1921,6 +2065,8 @@ exports.ShellProvider = ShellProvider;
1921
2065
  exports.ShellRoleContext = ShellRoleContext;
1922
2066
  exports.ShellSupportProviderContext = ShellSupportProviderContext;
1923
2067
  exports.SpeculationRulesScript = SpeculationRulesScript;
2068
+ exports.aiCreditsWalletUrl = aiCreditsWalletUrl;
2069
+ exports.applyBrandFavicon = applyBrandFavicon;
1924
2070
  exports.buildNavSpeculationRules = buildNavSpeculationRules;
1925
2071
  exports.buildSpeculationRules = buildSpeculationRules;
1926
2072
  exports.collectSiblingAppUrls = collectSiblingAppUrls;
@@ -1948,5 +2094,6 @@ exports.useShellNavigationPreference = useShellNavigationPreference;
1948
2094
  exports.useShellOrganization = useShellOrganization;
1949
2095
  exports.useShellRole = useShellRole;
1950
2096
  exports.useShellSupport = useShellSupport;
2097
+ exports.watchBrandFavicon = watchBrandFavicon;
1951
2098
  //# sourceMappingURL=index.cjs.map
1952
2099
  //# sourceMappingURL=index.cjs.map