@burdenoff/microfe-subscriberbot 2026.1107.2 → 2026.1107.4

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 (28) hide show
  1. package/dist/stories/pages/BankConnectionsPage.stories.d.ts +1 -0
  2. package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
  3. package/dist/stories/support/bankingFixtures.d.ts +3 -0
  4. package/dist/stories/support/bankingFixtures.d.ts.map +1 -1
  5. package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
  6. package/dist/subscriberbot/components/StatusBadge.js +1 -0
  7. package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
  8. package/dist/subscriberbot/components/viz.d.ts +5 -2
  9. package/dist/subscriberbot/components/viz.d.ts.map +1 -1
  10. package/dist/subscriberbot/components/viz.js +122 -126
  11. package/dist/subscriberbot/components/viz.js.map +1 -1
  12. package/dist/subscriberbot/hooks/useBankingApi.d.ts +1 -0
  13. package/dist/subscriberbot/hooks/useBankingApi.d.ts.map +1 -1
  14. package/dist/subscriberbot/hooks/useBankingApi.js +1 -1
  15. package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -1
  16. package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
  17. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +294 -248
  18. package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
  19. package/dist/subscriberbot/pages/providers/ProviderInsights.d.ts.map +1 -1
  20. package/dist/subscriberbot/pages/providers/ProviderInsights.js +4 -1
  21. package/dist/subscriberbot/pages/providers/ProviderInsights.js.map +1 -1
  22. package/dist/subscriberbot/types/banking.d.ts +1 -1
  23. package/dist/subscriberbot/types/banking.d.ts.map +1 -1
  24. package/dist/subscriberbot/utils/chartScale.d.ts +32 -0
  25. package/dist/subscriberbot/utils/chartScale.d.ts.map +1 -0
  26. package/dist/subscriberbot/utils/chartScale.js +45 -0
  27. package/dist/subscriberbot/utils/chartScale.js.map +1 -0
  28. package/package.json +1 -1
@@ -10,4 +10,5 @@ export declare const ViewTracked: Story;
10
10
  export declare const ImportStatement: Story;
11
11
  export declare const Empty: Story;
12
12
  export declare const ImportRequiresStatement: Story;
13
+ export declare const NeedsAttention: Story;
13
14
  //# sourceMappingURL=BankConnectionsPage.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BankConnectionsPage.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/pages/BankConnectionsPage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAQ5F,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,mBAAmB,CAQ1C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KASzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAmB7B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAgBrC,CAAC"}
1
+ {"version":3,"file":"BankConnectionsPage.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/pages/BankConnectionsPage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAY5F,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,mBAAmB,CAQ1C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KASzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAmB7B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAgBrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAY5B,CAAC"}
@@ -2,6 +2,9 @@ import { SubBankConnection, SubRecurringCharge } from '../../subscriberbot/types
2
2
  import { GraphqlMockHandlers } from './graphqlMock';
3
3
 
4
4
  export declare const bankConnection: SubBankConnection;
5
+ /** Linked Plaid connections that need the customer (BOFF-10810). */
6
+ export declare const attentionConnections: SubBankConnection[];
7
+ export declare function attentionBankingHandlers(): GraphqlMockHandlers;
5
8
  export declare const recurringCharges: SubRecurringCharge[];
6
9
  export declare function bankingHandlers(plaidAvailable?: boolean): GraphqlMockHandlers;
7
10
  export declare function emptyBankingHandlers(): GraphqlMockHandlers;
@@ -1 +1 @@
1
- {"version":3,"file":"bankingFixtures.d.ts","sourceRoot":"","sources":["../../../src/stories/support/bankingFixtures.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,eAAe,CAAC;AAuB3E,eAAO,MAAM,cAAc,EAAE,iBAsB5B,CAAC;AA0BF,eAAO,MAAM,gBAAgB,EAAE,kBAAkB,EAoBhD,CAAC;AAOF,wBAAgB,eAAe,CAAC,cAAc,UAAQ,GAAG,mBAAmB,CA0B3E;AAED,wBAAgB,oBAAoB,IAAI,mBAAmB,CAO1D"}
1
+ {"version":3,"file":"bankingFixtures.d.ts","sourceRoot":"","sources":["../../../src/stories/support/bankingFixtures.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,eAAe,CAAC;AAuB3E,eAAO,MAAM,cAAc,EAAE,iBAsB5B,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAiBnD,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,mBAAmB,CAK9D;AA0BD,eAAO,MAAM,gBAAgB,EAAE,kBAAkB,EAoBhD,CAAC;AAOF,wBAAgB,eAAe,CAAC,cAAc,UAAQ,GAAG,mBAAmB,CA0B3E;AAED,wBAAgB,oBAAoB,IAAI,mBAAmB,CAO1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwB5C,CAAC"}
1
+ {"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0ED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwB5C,CAAC"}
@@ -31,6 +31,7 @@ var i = {
31
31
  NEEDS_REAUTH: "warning",
32
32
  ERROR: "destructive",
33
33
  DISCONNECTED: "secondary",
34
+ REVOKED: "destructive",
34
35
  AUTONOMOUS: "success",
35
36
  SUGGEST_ONLY: "info",
36
37
  DISABLED: "secondary",
@@ -1 +1 @@
1
- {"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Status Badge Component\n * @module subscriberbot/components\n *\n * A colored badge for Subscriber Bot domain statuses (relationship lifecycle,\n * invoice status, agent posture, channel verification, provider status,\n * workflow state) with semantic color mapping. Accepts the raw server enum\n * value (e.g. \"ACTIVE\", \"PAST_DUE\", \"SUGGEST_ONLY\").\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['ACTIVE', 'AUTONOMOUS', 'TRIAL', 'EXPIRING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Relationship lifecycle\n ACTIVE: 'success',\n TRIAL: 'info',\n PAUSED: 'warning',\n PAST_DUE: 'destructive',\n LAPSED: 'warning',\n EXPIRED: 'secondary',\n CANCELLED: 'destructive',\n\n // Invoice status\n DRAFT: 'secondary',\n ISSUED: 'info',\n PAID: 'success',\n OVERDUE: 'destructive',\n FAILED: 'destructive',\n REFUNDED: 'outline',\n\n // Bank connections (BOFF-4161)\n NEEDS_REAUTH: 'warning',\n ERROR: 'destructive',\n DISCONNECTED: 'secondary',\n\n // Agent posture\n AUTONOMOUS: 'success',\n SUGGEST_ONLY: 'info',\n DISABLED: 'secondary',\n\n // Channel verification / payment instrument\n VERIFIED: 'success',\n PENDING: 'warning',\n EXPIRING: 'warning',\n REMOVED: 'outline',\n\n // Provider status\n CLAIMED: 'success',\n UNVERIFIED: 'secondary',\n DEPRECATED: 'outline',\n\n // Workflow status\n ARCHIVED: 'outline',\n\n // Adapter submission / marketplace report moderation status\n APPROVED: 'success',\n REJECTED: 'destructive',\n DISMISSED: 'outline',\n RESOLVED: 'success',\n\n // AI decision status (DISMISSED shared with moderation above)\n PROPOSED: 'info',\n APPLYING: 'warning',\n APPLIED: 'success',\n STALE: 'secondary',\n FLAGGED: 'warning',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const { formatEnumLabel } = useFormatters();\n\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;AACX,GAIM,IAAe,IAAI,IAAI;CAAC;CAAU;CAAc;CAAS;AAAU,CAAC,GAEpE,IAAiD;CAErD,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,WAAW;CAGX,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CAGV,cAAc;CACd,OAAO;CACP,cAAc;CAGd,YAAY;CACZ,cAAc;CACd,UAAU;CAGV,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CAGT,SAAS;CACT,YAAY;CACZ,YAAY;CAGZ,UAAU;CAGV,UAAU;CACV,UAAU;CACV,WAAW;CACX,UAAU;CAGV,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,SAAS;AACX,GAEa,KAAqC,EAAE,WAAQ,mBAAgB;CAC1E,IAAM,EAAE,uBAAoB,EAAc,GAEpC,IAAM,EAAO,YAAY,GACzB,IAAU,EAAiB,MAAQ,aACnC,IAAS,EAAa,IAAI,CAAG;CAEnC,OACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,CACF;YALF,CAOG,KACC,kBAAC,QAAD;GACE,eAAY;GACZ,WAAU;EACX,CAAA,GAEF,EAAgB,CAAM,CACnB;;AAEV"}
1
+ {"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Status Badge Component\n * @module subscriberbot/components\n *\n * A colored badge for Subscriber Bot domain statuses (relationship lifecycle,\n * invoice status, agent posture, channel verification, provider status,\n * workflow state) with semantic color mapping. Accepts the raw server enum\n * value (e.g. \"ACTIVE\", \"PAST_DUE\", \"SUGGEST_ONLY\").\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['ACTIVE', 'AUTONOMOUS', 'TRIAL', 'EXPIRING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Relationship lifecycle\n ACTIVE: 'success',\n TRIAL: 'info',\n PAUSED: 'warning',\n PAST_DUE: 'destructive',\n LAPSED: 'warning',\n EXPIRED: 'secondary',\n CANCELLED: 'destructive',\n\n // Invoice status\n DRAFT: 'secondary',\n ISSUED: 'info',\n PAID: 'success',\n OVERDUE: 'destructive',\n FAILED: 'destructive',\n REFUNDED: 'outline',\n\n // Bank connections (BOFF-4161)\n NEEDS_REAUTH: 'warning',\n ERROR: 'destructive',\n DISCONNECTED: 'secondary',\n REVOKED: 'destructive',\n\n // Agent posture\n AUTONOMOUS: 'success',\n SUGGEST_ONLY: 'info',\n DISABLED: 'secondary',\n\n // Channel verification / payment instrument\n VERIFIED: 'success',\n PENDING: 'warning',\n EXPIRING: 'warning',\n REMOVED: 'outline',\n\n // Provider status\n CLAIMED: 'success',\n UNVERIFIED: 'secondary',\n DEPRECATED: 'outline',\n\n // Workflow status\n ARCHIVED: 'outline',\n\n // Adapter submission / marketplace report moderation status\n APPROVED: 'success',\n REJECTED: 'destructive',\n DISMISSED: 'outline',\n RESOLVED: 'success',\n\n // AI decision status (DISMISSED shared with moderation above)\n PROPOSED: 'info',\n APPLYING: 'warning',\n APPLIED: 'success',\n STALE: 'secondary',\n FLAGGED: 'warning',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const { formatEnumLabel } = useFormatters();\n\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;AACX,GAIM,IAAe,IAAI,IAAI;CAAC;CAAU;CAAc;CAAS;AAAU,CAAC,GAEpE,IAAiD;CAErD,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,WAAW;CAGX,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CAGV,cAAc;CACd,OAAO;CACP,cAAc;CACd,SAAS;CAGT,YAAY;CACZ,cAAc;CACd,UAAU;CAGV,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CAGT,SAAS;CACT,YAAY;CACZ,YAAY;CAGZ,UAAU;CAGV,UAAU;CACV,UAAU;CACV,WAAW;CACX,UAAU;CAGV,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,SAAS;AACX,GAEa,KAAqC,EAAE,WAAQ,mBAAgB;CAC1E,IAAM,EAAE,uBAAoB,EAAc,GAEpC,IAAM,EAAO,YAAY,GACzB,IAAU,EAAiB,MAAQ,aACnC,IAAS,EAAa,IAAI,CAAG;CAEnC,OACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,CACF;YALF,CAOG,KACC,kBAAC,QAAD;GACE,eAAY;GACZ,WAAU;EACX,CAAA,GAEF,EAAgB,CAAM,CACnB;;AAEV"}
@@ -73,8 +73,11 @@ export interface PriceChartSeries {
73
73
  }
74
74
  export declare const PriceHistoryChart: FC<{
75
75
  series: PriceChartSeries[];
76
- /** Formats a y-axis value (e.g. as currency). */
77
- valueFormat: (n: number) => string;
76
+ /**
77
+ * Formats a y-axis value (e.g. as currency). `fractionDigits` is the
78
+ * precision the axis step needs so neighbouring labels never repeat.
79
+ */
80
+ valueFormat: (n: number, fractionDigits: number) => string;
78
81
  /** Formats an x-axis date. */
79
82
  dateFormat: (d: Date) => string;
80
83
  /** Right edge of the time axis; defaults to the latest point. */
@@ -1 +1 @@
1
- {"version":3,"file":"viz.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/viz.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,kDAAkD;AAClD,eAAO,MAAM,YAAY,2MASf,CAAC;AAQX,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC;IACrB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CA8DA,CAAC;AAKF,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC;IACtB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAgBA,CAAC;AAKF,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CA0BA,CAAC;AAKF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;I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Q,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CA0BA,CAAC;AAWF,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAOD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B;;;OAGG;IACH,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3D,8BAA8B;IAC9B,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,iEAAiE;IACjE,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAyIA,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { useTr as e } from "../hooks/useTr.js";
2
2
  import { cn as t } from "../utils/cn.js";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { niceScale as n } from "../utils/chartScale.js";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
5
  //#region src/subscriberbot/components/viz.tsx
5
- var i = [
6
+ var a = [
6
7
  "var(--color-chart-1)",
7
8
  "var(--color-chart-2)",
8
9
  "var(--color-chart-3)",
@@ -11,114 +12,114 @@ var i = [
11
12
  "var(--color-chart-6)",
12
13
  "var(--color-chart-7)",
13
14
  "var(--color-chart-8)"
14
- ], a = "var(--color-chart-positive)", o = "var(--color-chart-negative)", s = "var(--color-chart-grid)", c = "var(--color-status-warning-text)", l = "var(--color-status-success-text)", u = (e, t) => t ?? i[e % i.length], d = ({ data: e, size: i = 160, thickness: a = 18, centerLabel: o, centerSub: c, className: l }) => {
15
- let d = e.reduce((e, t) => e + Math.max(0, t.value), 0), f = (i - a) / 2, p = 2 * Math.PI * f, m = i / 2, h = 0, g = e.map((e) => `${e.label}: ${e.value}`).join(", ");
16
- return /* @__PURE__ */ r("div", {
15
+ ], o = "var(--color-chart-positive)", s = "var(--color-chart-negative)", c = "var(--color-chart-grid)", l = "var(--color-status-warning-text)", u = "var(--color-status-success-text)", d = (e, t) => t ?? a[e % a.length], f = ({ data: e, size: n = 160, thickness: a = 18, centerLabel: o, centerSub: s, className: l }) => {
16
+ let u = e.reduce((e, t) => e + Math.max(0, t.value), 0), f = (n - a) / 2, p = 2 * Math.PI * f, m = n / 2, h = 0, g = e.map((e) => `${e.label}: ${e.value}`).join(", ");
17
+ return /* @__PURE__ */ i("div", {
17
18
  className: t("relative inline-flex items-center justify-center", l),
18
- children: [/* @__PURE__ */ r("svg", {
19
- width: i,
20
- height: i,
21
- viewBox: `0 0 ${i} ${i}`,
19
+ children: [/* @__PURE__ */ i("svg", {
20
+ width: n,
21
+ height: n,
22
+ viewBox: `0 0 ${n} ${n}`,
22
23
  role: "img",
23
24
  "aria-label": `Donut chart. ${g}`,
24
25
  className: "max-w-full",
25
- children: [/* @__PURE__ */ n("circle", {
26
+ children: [/* @__PURE__ */ r("circle", {
26
27
  cx: m,
27
28
  cy: m,
28
29
  r: f,
29
30
  fill: "none",
30
- stroke: s,
31
+ stroke: c,
31
32
  strokeWidth: a,
32
33
  opacity: .4
33
- }), d > 0 && e.map((e, t) => {
34
- let r = Math.max(0, e.value) / d * p, i = /* @__PURE__ */ n("circle", {
34
+ }), u > 0 && e.map((e, t) => {
35
+ let n = Math.max(0, e.value) / u * p, i = /* @__PURE__ */ r("circle", {
35
36
  cx: m,
36
37
  cy: m,
37
38
  r: f,
38
39
  fill: "none",
39
- stroke: u(t, e.color),
40
+ stroke: d(t, e.color),
40
41
  strokeWidth: a,
41
- strokeDasharray: `${r} ${p - r}`,
42
+ strokeDasharray: `${n} ${p - n}`,
42
43
  strokeDashoffset: -h,
43
44
  strokeLinecap: "butt",
44
45
  transform: `rotate(-90 ${m} ${m})`
45
46
  }, t);
46
- return h += r, i;
47
+ return h += n, i;
47
48
  })]
48
- }), (o || c) && /* @__PURE__ */ r("div", {
49
+ }), (o || s) && /* @__PURE__ */ i("div", {
49
50
  className: "absolute inset-0 flex flex-col items-center justify-center text-center",
50
- children: [o && /* @__PURE__ */ n("span", {
51
+ children: [o && /* @__PURE__ */ r("span", {
51
52
  className: "text-xl font-bold text-text-primary tabular-nums leading-none",
52
53
  children: o
53
- }), c && /* @__PURE__ */ n("span", {
54
+ }), s && /* @__PURE__ */ r("span", {
54
55
  className: "mt-1 text-xs text-text-secondary",
55
- children: c
56
+ children: s
56
57
  })]
57
58
  })]
58
59
  });
59
- }, f = ({ data: e, valueFormat: i, className: a }) => /* @__PURE__ */ n("ul", {
60
+ }, p = ({ data: e, valueFormat: n, className: a }) => /* @__PURE__ */ r("ul", {
60
61
  className: t("space-y-2", a),
61
- children: e.map((e, t) => /* @__PURE__ */ r("li", {
62
+ children: e.map((e, t) => /* @__PURE__ */ i("li", {
62
63
  className: "flex items-center gap-2 text-sm",
63
64
  children: [
64
- /* @__PURE__ */ n("span", {
65
+ /* @__PURE__ */ r("span", {
65
66
  className: "h-2.5 w-2.5 shrink-0 rounded-full",
66
- style: { backgroundColor: u(t, e.color) },
67
+ style: { backgroundColor: d(t, e.color) },
67
68
  "aria-hidden": !0
68
69
  }),
69
- /* @__PURE__ */ n("span", {
70
+ /* @__PURE__ */ r("span", {
70
71
  className: "flex-1 truncate text-text-secondary",
71
72
  children: e.label
72
73
  }),
73
- /* @__PURE__ */ n("span", {
74
+ /* @__PURE__ */ r("span", {
74
75
  className: "font-medium text-text-primary tabular-nums",
75
- children: i ? i(e.value) : e.value
76
+ children: n ? n(e.value) : e.value
76
77
  })
77
78
  ]
78
79
  }, t))
79
- }), p = ({ data: i, valueFormat: a, className: o }) => {
80
- let c = e(), l = Math.max(1, ...i.map((e) => e.value));
81
- return /* @__PURE__ */ n("ul", {
80
+ }), m = ({ data: n, valueFormat: a, className: o }) => {
81
+ let s = e(), l = Math.max(1, ...n.map((e) => e.value));
82
+ return /* @__PURE__ */ r("ul", {
82
83
  className: t("space-y-3", o),
83
- "aria-label": c("charts.barLabel", "Bar chart"),
84
- children: i.map((e, t) => /* @__PURE__ */ r("li", { children: [/* @__PURE__ */ r("div", {
84
+ "aria-label": s("charts.barLabel", "Bar chart"),
85
+ children: n.map((e, t) => /* @__PURE__ */ i("li", { children: [/* @__PURE__ */ i("div", {
85
86
  className: "flex items-center justify-between text-sm",
86
- children: [/* @__PURE__ */ n("span", {
87
+ children: [/* @__PURE__ */ r("span", {
87
88
  className: "truncate text-text-secondary",
88
89
  children: e.label
89
- }), /* @__PURE__ */ n("span", {
90
+ }), /* @__PURE__ */ r("span", {
90
91
  className: "font-medium text-text-primary tabular-nums",
91
92
  children: a ? a(e.value) : e.value
92
93
  })]
93
- }), /* @__PURE__ */ n("div", {
94
+ }), /* @__PURE__ */ r("div", {
94
95
  className: "mt-1.5 h-2 w-full overflow-hidden rounded-full",
95
- style: { backgroundColor: s },
96
- children: /* @__PURE__ */ n("div", {
96
+ style: { backgroundColor: c },
97
+ children: /* @__PURE__ */ r("div", {
97
98
  className: "h-full rounded-full transition-all",
98
99
  style: {
99
100
  width: `${e.value / l * 100}%`,
100
- backgroundColor: u(t, e.color)
101
+ backgroundColor: d(t, e.color)
101
102
  }
102
103
  })
103
104
  })] }, t))
104
105
  });
105
- }, m = ({ points: i, width: s = 220, height: c = 56, positive: l = !0, className: u }) => {
106
+ }, h = ({ points: n, width: a = 220, height: c = 56, positive: l = !0, className: u }) => {
106
107
  let d = e();
107
- if (i.length < 2) return null;
108
- let f = Math.max(...i), p = Math.min(...i), m = f - p || 1, h = l ? a : o, g = s / (i.length - 1), _ = i.map((e, t) => [t * g, c - (e - p) / m * (c - 8) - 4]).map(([e, t], n) => `${n === 0 ? "M" : "L"}${e.toFixed(1)},${t.toFixed(1)}`).join(" "), v = `${_} L${s},${c} L0,${c} Z`;
109
- return /* @__PURE__ */ r("svg", {
110
- width: s,
108
+ if (n.length < 2) return null;
109
+ let f = Math.max(...n), p = Math.min(...n), m = f - p || 1, h = l ? o : s, g = a / (n.length - 1), _ = n.map((e, t) => [t * g, c - (e - p) / m * (c - 8) - 4]).map(([e, t], n) => `${n === 0 ? "M" : "L"}${e.toFixed(1)},${t.toFixed(1)}`).join(" "), v = `${_} L${a},${c} L0,${c} Z`;
110
+ return /* @__PURE__ */ i("svg", {
111
+ width: a,
111
112
  height: c,
112
- viewBox: `0 0 ${s} ${c}`,
113
+ viewBox: `0 0 ${a} ${c}`,
113
114
  role: "img",
114
115
  "aria-label": d("charts.trendLabel", "Trend sparkline"),
115
116
  className: t("max-w-full", u),
116
117
  preserveAspectRatio: "none",
117
- children: [/* @__PURE__ */ n("path", {
118
+ children: [/* @__PURE__ */ r("path", {
118
119
  d: v,
119
120
  fill: h,
120
121
  opacity: .12
121
- }), /* @__PURE__ */ n("path", {
122
+ }), /* @__PURE__ */ r("path", {
122
123
  d: _,
123
124
  fill: "none",
124
125
  stroke: h,
@@ -127,24 +128,24 @@ var i = [
127
128
  strokeLinecap: "round"
128
129
  })]
129
130
  });
130
- }, h = ({ value: e, max: i = 100, size: a = 120, label: u, className: d }) => {
131
- let f = Math.max(0, Math.min(1, e / i)), p = a / 2 - 10, m = a / 2, h = Math.PI * p, g = f >= .66 ? l : f >= .33 ? c : o;
132
- return /* @__PURE__ */ r("div", {
131
+ }, g = ({ value: e, max: n = 100, size: a = 120, label: o, className: d }) => {
132
+ let f = Math.max(0, Math.min(1, e / n)), p = a / 2 - 10, m = a / 2, h = Math.PI * p, g = f >= .66 ? u : f >= .33 ? l : s;
133
+ return /* @__PURE__ */ i("div", {
133
134
  className: t("inline-flex flex-col items-center", d),
134
- children: [/* @__PURE__ */ r("svg", {
135
+ children: [/* @__PURE__ */ i("svg", {
135
136
  width: a,
136
137
  height: a / 2 + 8,
137
138
  viewBox: `0 0 ${a} ${a / 2 + 8}`,
138
139
  role: "img",
139
140
  "aria-label": `Gauge: ${Math.round(f * 100)} percent`,
140
141
  className: "max-w-full",
141
- children: [/* @__PURE__ */ n("path", {
142
+ children: [/* @__PURE__ */ r("path", {
142
143
  d: `M10 ${m} A ${p} ${p} 0 0 1 ${a - 10} ${m}`,
143
144
  fill: "none",
144
- stroke: s,
145
+ stroke: c,
145
146
  strokeWidth: 10,
146
147
  strokeLinecap: "round"
147
- }), /* @__PURE__ */ n("path", {
148
+ }), /* @__PURE__ */ r("path", {
148
149
  d: `M10 ${m} A ${p} ${p} 0 0 1 ${a - 10} ${m}`,
149
150
  fill: "none",
150
151
  stroke: g,
@@ -152,59 +153,59 @@ var i = [
152
153
  strokeLinecap: "round",
153
154
  strokeDasharray: `${f * h} ${h}`
154
155
  })]
155
- }), /* @__PURE__ */ r("div", {
156
+ }), /* @__PURE__ */ i("div", {
156
157
  className: "-mt-4 text-center",
157
- children: [/* @__PURE__ */ n("span", {
158
+ children: [/* @__PURE__ */ r("span", {
158
159
  className: "text-lg font-bold text-text-primary tabular-nums",
159
160
  children: Math.round(e)
160
- }), u && /* @__PURE__ */ n("p", {
161
+ }), o && /* @__PURE__ */ r("p", {
161
162
  className: "text-xs text-text-secondary",
162
- children: u
163
+ children: o
163
164
  })]
164
165
  })]
165
166
  });
166
- }, g = {
167
+ }, _ = {
167
168
  default: "var(--color-accent-indigo)",
168
- positive: l,
169
- warning: c,
169
+ positive: u,
170
+ warning: l,
170
171
  muted: "var(--color-text-secondary)"
171
- }, _ = ({ items: e, className: i }) => /* @__PURE__ */ n("ol", {
172
- className: t("relative space-y-5 ps-6 before:absolute before:start-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border-subtle", i),
173
- children: e.map((e, t) => /* @__PURE__ */ r("li", {
172
+ }, v = ({ items: e, className: n }) => /* @__PURE__ */ r("ol", {
173
+ className: t("relative space-y-5 ps-6 before:absolute before:start-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border-subtle", n),
174
+ children: e.map((e, t) => /* @__PURE__ */ i("li", {
174
175
  className: "relative",
175
176
  children: [
176
- /* @__PURE__ */ n("span", {
177
+ /* @__PURE__ */ r("span", {
177
178
  className: "absolute -start-[22px] top-1 h-3 w-3 rounded-full ring-4 ring-bg-surface",
178
- style: { backgroundColor: g[e.tone ?? "default"] },
179
+ style: { backgroundColor: _[e.tone ?? "default"] },
179
180
  "aria-hidden": !0
180
181
  }),
181
- /* @__PURE__ */ r("div", {
182
+ /* @__PURE__ */ i("div", {
182
183
  className: "flex items-baseline justify-between gap-2",
183
- children: [/* @__PURE__ */ n("p", {
184
+ children: [/* @__PURE__ */ r("p", {
184
185
  className: "text-sm font-medium text-text-primary",
185
186
  children: e.title
186
- }), e.meta && /* @__PURE__ */ n("span", {
187
+ }), e.meta && /* @__PURE__ */ r("span", {
187
188
  className: "text-sm tabular-nums text-text-primary",
188
189
  children: e.meta
189
190
  })]
190
191
  }),
191
- e.sub && /* @__PURE__ */ n("p", {
192
+ e.sub && /* @__PURE__ */ r("p", {
192
193
  className: "text-xs text-text-secondary",
193
194
  children: e.sub
194
195
  })
195
196
  ]
196
197
  }, t))
197
- }), v = ({ value: e, max: r = 100, label: i, tone: a = "accent", className: u }) => {
198
- let d = Math.max(0, Math.min(1, r ? e / r : 0)), f = a === "positive" ? l : a === "warning" ? c : a === "negative" ? o : "var(--color-accent-indigo)";
199
- return /* @__PURE__ */ n("div", {
200
- className: t("h-2 w-full overflow-hidden rounded-full", u),
201
- style: { backgroundColor: s },
198
+ }), y = ({ value: e, max: n = 100, label: i, tone: a = "accent", className: o }) => {
199
+ let d = Math.max(0, Math.min(1, n ? e / n : 0)), f = a === "positive" ? u : a === "warning" ? l : a === "negative" ? s : "var(--color-accent-indigo)";
200
+ return /* @__PURE__ */ r("div", {
201
+ className: t("h-2 w-full overflow-hidden rounded-full", o),
202
+ style: { backgroundColor: c },
202
203
  role: "progressbar",
203
204
  "aria-label": i,
204
205
  "aria-valuenow": Math.round(d * 100),
205
206
  "aria-valuemin": 0,
206
207
  "aria-valuemax": 100,
207
- children: /* @__PURE__ */ n("div", {
208
+ children: /* @__PURE__ */ r("div", {
208
209
  className: "h-full rounded-full transition-all",
209
210
  style: {
210
211
  width: `${d * 100}%`,
@@ -212,99 +213,94 @@ var i = [
212
213
  }
213
214
  })
214
215
  });
215
- }, y = 640, b = 220, x = {
216
+ }, b = 640, x = 220, S = {
216
217
  top: 12,
217
218
  right: 16,
218
219
  bottom: 28,
219
220
  left: 64
220
- }, S = 864e5, C = ({ series: e, valueFormat: i, dateFormat: a, now: o, ariaLabel: c, className: l }) => {
221
- let d = e.flatMap((e) => e.points), f = d.flatMap((e) => e.value === null ? [] : [e.value]);
222
- if (f.length === 0) return null;
223
- let p = d.map((e) => new Date(e.at).getTime()), m = Math.min(...p), h = Math.max(...p, o ? o.getTime() : -Infinity);
224
- h - m < S && (m -= 15 * S, h += 15 * S);
225
- let g = Math.min(...f), _ = Math.max(...f), v = _ === g ? Math.max(Math.abs(_) * .2, 1) : (_ - g) * .15, C = Math.max(0, g - v), w = _ + v, T = y - x.left - x.right, E = b - x.top - x.bottom, D = (e) => x.left + (e - m) / (h - m) * T, O = (e) => x.top + E - (e - C) / (w - C) * E, k = [
226
- 0,
227
- 1,
228
- 2,
229
- 3
230
- ].map((e) => C + (w - C) * e / 3), A = [
221
+ }, C = 864e5, w = ({ series: e, valueFormat: a, dateFormat: o, now: s, ariaLabel: l, className: u }) => {
222
+ let f = e.flatMap((e) => e.points), p = f.flatMap((e) => e.value === null ? [] : [e.value]);
223
+ if (p.length === 0) return null;
224
+ let m = f.map((e) => new Date(e.at).getTime()), h = Math.min(...m), g = Math.max(...m, s ? s.getTime() : -Infinity);
225
+ g - h < C && (h -= 15 * C, g += 15 * C);
226
+ let _ = Math.min(...p), v = Math.max(...p), y = v === _ ? Math.max(Math.abs(v) * .2, 1) : (v - _) * .15, w = n(_ >= 0 ? Math.max(0, _ - y) : _ - y, v + y, 4), T = w.min, E = w.max, D = b - S.left - S.right, O = x - S.top - S.bottom, k = (e) => S.left + (e - h) / (g - h) * D, A = (e) => S.top + O - (e - T) / (E - T) * O, j = w.ticks, M = [
231
227
  0,
232
228
  .5,
233
229
  1
234
- ].map((e) => new Date(m + (h - m) * e));
235
- return /* @__PURE__ */ r("div", {
236
- className: t("w-full", l),
237
- children: [/* @__PURE__ */ r("svg", {
238
- viewBox: `0 0 ${y} ${b}`,
230
+ ].map((e) => new Date(h + (g - h) * e));
231
+ return /* @__PURE__ */ i("div", {
232
+ className: t("w-full", u),
233
+ children: [/* @__PURE__ */ i("svg", {
234
+ viewBox: `0 0 ${b} ${x}`,
239
235
  role: "img",
240
- "aria-label": c,
236
+ "aria-label": l,
241
237
  className: "h-auto w-full",
242
238
  children: [
243
- k.map((e, t) => /* @__PURE__ */ r("g", { children: [/* @__PURE__ */ n("line", {
244
- x1: x.left,
245
- x2: y - x.right,
246
- y1: O(e),
247
- y2: O(e),
248
- stroke: s,
239
+ j.map((e, t) => /* @__PURE__ */ i("g", { children: [/* @__PURE__ */ r("line", {
240
+ x1: S.left,
241
+ x2: b - S.right,
242
+ y1: A(e),
243
+ y2: A(e),
244
+ stroke: c,
249
245
  strokeWidth: 1
250
- }), /* @__PURE__ */ n("text", {
251
- x: x.left - 8,
252
- y: O(e) + 4,
246
+ }), /* @__PURE__ */ r("text", {
247
+ x: S.left - 8,
248
+ y: A(e) + 4,
253
249
  textAnchor: "end",
254
250
  fontSize: 11,
255
251
  fill: "var(--color-text-secondary)",
256
- children: i(e)
252
+ children: a(e, w.fractionDigits)
257
253
  })] }, `y${t}`)),
258
- A.map((e, t) => /* @__PURE__ */ n("text", {
259
- x: D(e.getTime()),
260
- y: b - 8,
254
+ M.map((e, t) => /* @__PURE__ */ r("text", {
255
+ x: k(e.getTime()),
256
+ y: x - 8,
261
257
  textAnchor: t === 0 ? "start" : t === 2 ? "end" : "middle",
262
258
  fontSize: 11,
263
259
  fill: "var(--color-text-secondary)",
264
- children: a(e)
260
+ children: o(e)
265
261
  }, `x${t}`)),
266
262
  e.map((e, t) => {
267
- let i = u(t), a = [...e.points].sort((e, t) => new Date(e.at).getTime() - new Date(t.at).getTime()), o = "";
263
+ let n = d(t), a = [...e.points].sort((e, t) => new Date(e.at).getTime() - new Date(t.at).getTime()), o = "";
268
264
  if (e.mode === "step") {
269
265
  let e = !1;
270
266
  for (let t of a) {
271
- let n = D(new Date(t.at).getTime()).toFixed(1);
267
+ let n = k(new Date(t.at).getTime()).toFixed(1);
272
268
  if (t.value === null) {
273
269
  e && (o += ` H${n}`), e = !1;
274
270
  continue;
275
271
  }
276
- let r = O(t.value).toFixed(1);
272
+ let r = A(t.value).toFixed(1);
277
273
  o += e ? ` H${n} V${r}` : ` M${n},${r}`, e = !0;
278
274
  }
279
- e && (o += ` H${D(h).toFixed(1)}`), o = o.trim();
275
+ e && (o += ` H${k(g).toFixed(1)}`), o = o.trim();
280
276
  }
281
- return /* @__PURE__ */ r("g", {
277
+ return /* @__PURE__ */ i("g", {
282
278
  "data-series": e.key,
283
- children: [o && /* @__PURE__ */ n("path", {
279
+ children: [o && /* @__PURE__ */ r("path", {
284
280
  d: o,
285
281
  fill: "none",
286
- stroke: i,
282
+ stroke: n,
287
283
  strokeWidth: 2,
288
284
  strokeLinejoin: "round"
289
- }), a.map((t, r) => t.value === null ? null : /* @__PURE__ */ n("circle", {
290
- cx: D(new Date(t.at).getTime()),
291
- cy: O(t.value),
285
+ }), a.map((t, i) => t.value === null ? null : /* @__PURE__ */ r("circle", {
286
+ cx: k(new Date(t.at).getTime()),
287
+ cy: A(t.value),
292
288
  r: e.mode === "dots" ? 3.5 : 4,
293
- fill: e.mode === "dots" ? "var(--color-bg-surface)" : i,
294
- stroke: i,
289
+ fill: e.mode === "dots" ? "var(--color-bg-surface)" : n,
290
+ stroke: n,
295
291
  strokeWidth: 2,
296
- children: t.title && /* @__PURE__ */ n("title", { children: t.title })
297
- }, `${e.key}-${r}`))]
292
+ children: t.title && /* @__PURE__ */ r("title", { children: t.title })
293
+ }, `${e.key}-${i}`))]
298
294
  }, e.key);
299
295
  })
300
296
  ]
301
- }), /* @__PURE__ */ n("ul", {
297
+ }), /* @__PURE__ */ r("ul", {
302
298
  className: "mt-2 flex flex-wrap gap-x-4 gap-y-1",
303
- children: e.map((e, i) => /* @__PURE__ */ r("li", {
299
+ children: e.map((e, n) => /* @__PURE__ */ i("li", {
304
300
  className: "flex items-center gap-1.5 text-xs text-text-secondary",
305
- children: [/* @__PURE__ */ n("span", {
301
+ children: [/* @__PURE__ */ r("span", {
306
302
  className: t("h-2.5 w-2.5 shrink-0", e.mode === "dots" ? "rounded-full border-2" : "rounded-sm"),
307
- style: e.mode === "dots" ? { borderColor: u(i) } : { backgroundColor: u(i) },
303
+ style: e.mode === "dots" ? { borderColor: d(n) } : { backgroundColor: d(n) },
308
304
  "aria-hidden": !0
309
305
  }), e.label]
310
306
  }, e.key))
@@ -312,6 +308,6 @@ var i = [
312
308
  });
313
309
  };
314
310
  //#endregion
315
- export { p as BarList, i as CHART_COLORS, d as Donut, h as Gauge, f as Legend, v as MiniProgress, C as PriceHistoryChart, m as Sparkline, _ as Timeline };
311
+ export { m as BarList, a as CHART_COLORS, f as Donut, g as Gauge, p as Legend, y as MiniProgress, w as PriceHistoryChart, h as Sparkline, v as Timeline };
316
312
 
317
313
  //# sourceMappingURL=viz.js.map