Implement legal terms, Android client compatibility and more

This commit is contained in:
2026-07-13 13:13:05 +03:00
Unverified
parent 54cf37df6c
commit 6de18d0ddc
73 changed files with 3922 additions and 635 deletions
+4
View File
@@ -15,6 +15,8 @@ import { delay } from "./utils/utils";
const HomePage = lazy(() => import("./pages/home/HomePage"));
const AuthPage = lazy(() => import("./pages/auth/AuthPage"));
const ChatPage = lazy(() => import("./pages/chat/ui/ChatPage"));
const PrivacyPage = lazy(() => import("./pages/legal/LegalPages").then(m => ({ default: m.PrivacyPage })));
const TermsPage = lazy(() => import("./pages/legal/LegalPages").then(m => ({ default: m.TermsPage })));
const routeConfig: RouteObject[] = [
{ path: "/", element: <HomePage /> },
@@ -22,6 +24,8 @@ const routeConfig: RouteObject[] = [
{ path: "/login", element: <Navigate to="/auth?mode=login" replace /> },
{ path: "/register", element: <Navigate to="/auth?mode=register" replace /> },
{ path: "/download-app", element: <DownloadAppPage /> },
{ path: "/privacy", element: <PrivacyPage /> },
{ path: "/terms", element: <TermsPage /> },
{
path: "/chat",
element: (
+23
View File
@@ -0,0 +1,23 @@
import { MaterialIcon } from "@/utils/material";
import { avatarGradientFromUserId } from "@/core/avatarGradient";
import styles from "@/pages/chat/css/deleted-user-avatar.module.scss";
interface DeletedUserAvatarProps {
userId: number;
className?: string;
iconClassName?: string;
}
export function DeletedUserAvatar({ userId, className, iconClassName }: DeletedUserAvatarProps) {
return (
<div
className={className ?? styles.deletedUserAvatar}
style={{ background: avatarGradientFromUserId(userId) }}
>
<MaterialIcon
name="account_circle_off--outlined"
className={iconClassName ?? styles.deletedUserAvatarIcon}
/>
</div>
);
}
-39
View File
@@ -170,45 +170,6 @@ export async function verifyUser(userId: number, token: string): Promise<{verifi
return null;
}
}
/**
* In-memory cache for user similarity results
* Key: userId, Value: similarity result
*/
const similarityCache = new Map<number, {isSimilar: boolean, similarTo?: string} | null>();
/**
* Checks if a user is similar to any verified user
* Results are cached in memory to avoid redundant API calls
*/
export async function checkUserSimilarity(userId: number, token: string): Promise<{isSimilar: boolean, similarTo?: string} | null> {
// Check cache first
if (similarityCache.has(userId)) {
return similarityCache.get(userId) ?? null;
}
try {
const response = await fetch(`${API_BASE_URL}/user/check-similarity/${userId}`, {
headers: getAuthHeaders(token, true)
});
let result: {isSimilar: boolean, similarTo?: string} | null = null;
if (response.ok) {
result = await response.json();
}
// Cache the result (even if null/error)
similarityCache.set(userId, result);
return result;
} catch (error) {
console.error('Error checking user similarity:', error);
const result: null = null;
// Cache null result to avoid retrying on errors
similarityCache.set(userId, result);
return result;
}
}
/**
* Suspends a user account (admin only)
*/
-39
View File
@@ -170,45 +170,6 @@ export async function verifyUser(userId: number, token: string): Promise<{verifi
return null;
}
}
/**
* In-memory cache for user similarity results
* Key: userId, Value: similarity result
*/
const similarityCache = new Map<number, {isSimilar: boolean, similarTo?: string} | null>();
/**
* Checks if a user is similar to any verified user
* Results are cached in memory to avoid redundant API calls
*/
export async function checkUserSimilarity(userId: number, token: string): Promise<{isSimilar: boolean, similarTo?: string} | null> {
// Check cache first
if (similarityCache.has(userId)) {
return similarityCache.get(userId) ?? null;
}
try {
const response = await fetch(`${API_BASE_URL}/user/check-similarity/${userId}`, {
headers: getAuthHeaders(token)
});
let result: {isSimilar: boolean, similarTo?: string} | null = null;
if (response.ok) {
result = await response.json();
}
// Cache the result (even if null/error)
similarityCache.set(userId, result);
return result;
} catch (error) {
console.error('Error checking user similarity:', error);
const result: null = null;
// Cache null result to avoid retrying on errors
similarityCache.set(userId, result);
return result;
}
}
/**
* Suspends a user account (admin only)
*/
-39
View File
@@ -150,42 +150,3 @@ export async function fetchById(token: string, userId: number): Promise<UserProf
}
}
/**
* In-memory cache for user similarity results
* Key: userId, Value: similarity result
*/
const similarityCache = new Map<number, {isSimilar: boolean, similarTo?: string} | null>();
/**
* Checks if a user is similar to any verified user
* Results are cached in memory to avoid redundant API calls
*/
export async function checkSimilarity(userId: number, token: string): Promise<{isSimilar: boolean, similarTo?: string} | null> {
// Check cache first
if (similarityCache.has(userId)) {
return similarityCache.get(userId) ?? null;
}
try {
const response = await fetch(`${API_BASE_URL}/user/check-similarity/${userId}`, {
headers: getAuthHeaders(token, true)
});
let result: {isSimilar: boolean, similarTo?: string} | null = null;
if (response.ok) {
result = await response.json();
}
// Cache the result (even if null/error)
similarityCache.set(userId, result);
return result;
} catch (error) {
console.error('Error checking user similarity:', error);
const result: null = null;
// Cache null result to avoid retrying on errors
similarityCache.set(userId, result);
return result;
}
}
+22
View File
@@ -0,0 +1,22 @@
/** Java [String.hashCode] for cross-platform parity with Android avatar gradients. */
function javaStringHashCode(value: string): number {
let hash = 0;
for (let i = 0; i < value.length; i++) {
hash = (Math.imul(31, hash) + value.charCodeAt(i)) | 0;
}
return hash;
}
function rgbFromHash(hash: number, offset: number): string {
const r = Math.abs(hash % 256);
const g = Math.abs(Math.floor(hash / 256) % 256);
const b = Math.abs(Math.floor(hash / 65536) % 256);
const clamp = (channel: number) => Math.min(255, Math.max(0, channel));
return `rgb(${clamp(r + offset)}, ${clamp(g + offset)}, ${clamp(b + offset)})`;
}
/** CSS linear-gradient matching [generateGradientFromName] on Android for a user id seed. */
export function avatarGradientFromUserId(userId: number): string {
const hash = javaStringHashCode(String(userId));
return `linear-gradient(135deg, ${rgbFromHash(hash, 100)}, ${rgbFromHash(hash, 50)})`;
}
+31 -29
View File
@@ -1,37 +1,32 @@
import { useState, useEffect } from "react";
import api from "@/core/api";
import { useUserStore } from "@/state/user";
import { MaterialIcon } from "@/utils/material";
export type VerificationStatus = "verified" | "warning" | "blocked" | "none";
interface StatusBadgeProps {
verified: boolean;
userId?: number;
verificationStatus?: VerificationStatus | null;
/** @deprecated Use verificationStatus instead */
verified?: boolean;
size?: "small" | "medium" | "large";
}
export function StatusBadge({ verified, userId, size = "small" }: StatusBadgeProps) {
const [isSimilarToVerified, setIsSimilarToVerified] = useState(false);
const { user } = useUserStore();
function resolveVerificationStatus(
verificationStatus?: VerificationStatus | null,
verified?: boolean,
): VerificationStatus {
if (verificationStatus) {
return verificationStatus;
}
if (verified) {
return "verified";
}
return "none";
}
export function StatusBadge({ verificationStatus, verified, size = "small" }: StatusBadgeProps) {
const status = resolveVerificationStatus(verificationStatus, verified);
const className = `status-badge ${size}`;
// Check similarity for unverified users
useEffect(() => {
if (!verified && userId && user.authToken) {
api.user.profile.checkSimilarity(userId, user.authToken)
.then(result => {
setIsSimilarToVerified(result?.isSimilar || false);
})
.catch(error => {
console.error('Error checking similarity:', error);
setIsSimilarToVerified(false);
});
} else {
setIsSimilarToVerified(false);
}
}, [verified, userId, user.authToken]);
if (verified) {
if (status === "verified") {
return (
<span className={`${className} verified`} title="Подтверждённый аккаунт">
<MaterialIcon name="verified--filled" />
@@ -39,7 +34,7 @@ export function StatusBadge({ verified, userId, size = "small" }: StatusBadgePro
);
}
if (isSimilarToVerified) {
if (status === "warning") {
return (
<span className={`${className} warning`} title="Похож на подтверждённый аккаунт">
<MaterialIcon name="warning--filled" />
@@ -47,6 +42,13 @@ export function StatusBadge({ verified, userId, size = "small" }: StatusBadgePro
);
}
// Don't show anything if not verified and not similar
if (status === "blocked") {
return (
<span className={`${className} blocked`} title="Аккаунт заблокирован">
<MaterialIcon name="block--filled" />
</span>
);
}
return null;
}
}
@@ -0,0 +1,13 @@
import { Link } from "react-router-dom";
import legalStyles from "@/core/legal/legal.module.scss";
export function LegalInlineLinks() {
return (
<p className={legalStyles.legalInlineLinks}>
Регистрируясь, вы соглашаетесь с{" "}
<Link to="/terms">пользовательским соглашением</Link>
<span className={legalStyles.legalInlineLinksSep}>·</span>
<Link to="/privacy">политикой конфиденциальности</Link>
</p>
);
}
@@ -0,0 +1,197 @@
import { useCallback, useEffect, useMemo, useState, type MouseEvent } from "react";
import { useNavigate } from "react-router-dom";
import { parse } from "marked";
import { escape as escapeHtml } from "he";
import { MaterialButton, MaterialIcon } from "@/utils/material";
import { fitPathToUnitSquare, getMaterialShapePath } from "./materialShapes";
import { legalMaterialIconName, parseLegalMarkdown, type LegalSection } from "./fcDirective";
import { rewriteLegalDocumentHref, rewriteLegalLinksInHtml } from "./legalLinks";
import {
loadLegalDocument,
type LegalDocumentKind,
} from "./legalDocumentLoader";
import { LegalPageShell } from "./LegalPageShell";
import styles from "./legal.module.scss";
const CACHED_BANNER_TEXT =
"Показана сохранённая копия документа. Содержимое может быть устаревшим.";
function wrapMarkdownTables(html: string): string {
return html.replace(
/<table\b[^>]*>[\s\S]*?<\/table>/gi,
(table) => `<div class="legalTableScroll">${table}</div>`,
);
}
function renderMarkdownBody(markdown: string): string {
const html = parse(markdown, { breaks: true, gfm: true }) as string;
return wrapMarkdownTables(rewriteLegalLinksInHtml(html));
}
function ExpressiveSectionHeader({
section,
}: {
section: LegalSection;
}) {
const shapePath = useMemo(
() => getMaterialShapePath(section.directive.shape),
[section.directive.shape],
);
const shapeFit = useMemo(
() => fitPathToUnitSquare(shapePath),
[shapePath],
);
const iconName = legalMaterialIconName(section.directive.icon);
return (
<div className={styles.sectionHeader}>
<div className={styles.sectionIconFrame}>
<svg
viewBox="0 0 1 1"
className={styles.sectionIconShape}
aria-hidden="true"
>
<g transform={shapeFit.transform}>
<path d={shapePath} className={styles.sectionShapeFill} />
</g>
</svg>
<MaterialIcon name={iconName} className={styles.sectionIconGlyph} />
</div>
<h2 className={styles.sectionTitle}>{section.title}</h2>
</div>
);
}
interface LegalMarkdownPageProps {
kind: LegalDocumentKind;
}
export function LegalMarkdownPage({ kind }: LegalMarkdownPageProps) {
const navigate = useNavigate();
const [loadAttempt, setLoadAttempt] = useState(0);
const [markdown, setMarkdown] = useState<string | null>(null);
const [isCached, setIsCached] = useState(false);
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
const handleContentClick = useCallback((event: MouseEvent<HTMLDivElement>) => {
const anchor = (event.target as HTMLElement).closest("a");
if (!anchor) return;
const href = anchor.getAttribute("href");
if (!href) return;
const clientRoute = rewriteLegalDocumentHref(href) ?? (
href === "/terms" || href === "/privacy" ? href : null
);
if (!clientRoute) return;
event.preventDefault();
navigate(clientRoute);
}, [navigate]);
const retry = useCallback(() => {
setLoadAttempt((attempt) => attempt + 1);
}, []);
useEffect(() => {
let cancelled = false;
const abortController = new AbortController();
setMarkdown(null);
setError(null);
setIsCached(false);
setLoading(true);
loadLegalDocument(kind, abortController.signal)
.then((result) => {
if (cancelled) return;
if (result.status === "error") {
setError(result.message);
return;
}
setMarkdown(result.markdown);
setIsCached(result.fromCache);
})
.catch((e: unknown) => {
if (cancelled || (e instanceof DOMException && e.name === "AbortError")) {
return;
}
setError("Не удалось загрузить документ. Проверьте подключение к интернету и попробуйте снова.");
})
.finally(() => {
if (!cancelled) {
setLoading(false);
}
});
return () => {
cancelled = true;
abortController.abort();
};
}, [kind, loadAttempt]);
const content = (() => {
if (loading) {
return (
<div className={styles.legalPage}>
<p className={styles.loading}>Загрузка</p>
</div>
);
}
if (error) {
return (
<div className={styles.legalPage}>
<div className={styles.errorState}>
<p className={styles.error}>{escapeHtml(error)}</p>
<MaterialButton onClick={retry}>Повторить</MaterialButton>
</div>
</div>
);
}
if (!markdown) {
return (
<div className={styles.legalPage}>
<p className={styles.loading}>Загрузка</p>
</div>
);
}
const { preamble, sections } = parseLegalMarkdown(markdown);
return (
<div className={styles.legalPage} onClick={handleContentClick}>
{isCached ? (
<div className={styles.cachedBanner} role="status">
{CACHED_BANNER_TEXT}
</div>
) : null}
{preamble ? (
<div
className={styles.preamble}
dangerouslySetInnerHTML={{ __html: renderMarkdownBody(preamble) }}
/>
) : null}
{sections.map((section, index) => (
<section key={`${section.title}-${index}`} className={styles.section}>
<ExpressiveSectionHeader section={section} />
<div
className={styles.sectionBody}
dangerouslySetInnerHTML={{ __html: renderMarkdownBody(section.bodyMarkdown) }}
/>
</section>
))}
</div>
);
})();
return <LegalPageShell>{content}</LegalPageShell>;
}
export type { LegalDocumentKind };
@@ -0,0 +1,26 @@
import type { ReactNode } from "react";
import { useNavigate } from "react-router-dom";
import { HomeHeader } from "@/pages/home/HomeHeader";
import { HomeFooter } from "@/pages/home/HomeFooter";
import homeStyles from "@/pages/home/home.module.scss";
import styles from "./legal.module.scss";
interface LegalPageShellProps {
children: ReactNode;
}
export function LegalPageShell({ children }: LegalPageShellProps) {
const navigate = useNavigate();
const scrollToDownload = () => {
navigate("/");
};
return (
<div className={homeStyles.homepage}>
<HomeHeader onScrollToDownload={scrollToDownload} />
<main className={styles.legalMain}>{children}</main>
<HomeFooter onScrollToDownload={scrollToDownload} />
</div>
);
}
+84
View File
@@ -0,0 +1,84 @@
/**
* Parses `<!-- fc:shape=Cookie4Sided icon=shield -->` directives before section headers.
*/
export interface FcSectionDirective {
shape: string;
icon: string;
}
const FC_DIRECTIVE_RE = /<!--\s*fc:([^>]+?)\s*-->/i;
function parseDirectiveBody(body: string): FcSectionDirective | null {
const shapeMatch = body.match(/shape=([A-Za-z0-9_]+)/);
const iconMatch = body.match(/icon=([A-Za-z0-9_-]+)/);
if (!shapeMatch || !iconMatch) return null;
return { shape: shapeMatch[1], icon: iconMatch[1] };
}
export function parseFcDirective(line: string): FcSectionDirective | null {
const match = line.match(FC_DIRECTIVE_RE);
if (!match) return null;
return parseDirectiveBody(match[1]);
}
export interface LegalSection {
directive: FcSectionDirective;
title: string;
bodyMarkdown: string;
}
/**
* Split markdown into sections keyed by fc directives + `##` headings.
*/
export function parseLegalMarkdown(markdown: string): { preamble: string; sections: LegalSection[] } {
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
const preambleLines: string[] = [];
const sections: LegalSection[] = [];
let i = 0;
while (i < lines.length) {
const directive = parseFcDirective(lines[i]);
if (directive && i + 1 < lines.length && lines[i + 1].startsWith("## ")) {
const title = lines[i + 1].slice(3).trim();
i += 2;
const bodyLines: string[] = [];
while (i < lines.length) {
if (parseFcDirective(lines[i]) && i + 1 < lines.length && lines[i + 1].startsWith("## ")) {
break;
}
bodyLines.push(lines[i]);
i += 1;
}
sections.push({
directive,
title,
bodyMarkdown: bodyLines.join("\n").trim(),
});
} else if (sections.length === 0) {
preambleLines.push(lines[i]);
i += 1;
} else {
i += 1;
}
}
return {
preamble: preambleLines.join("\n").trim(),
sections,
};
}
export function staticIconUrl(icon: string): string {
return `/api/static/icons/${encodeURIComponent(icon)}.webp`;
}
/** Maps legal-doc icon keys to Material Symbols names (Google Fonts). */
const LEGAL_MATERIAL_ICON: Record<string, string> = {
privacy: "privacy_tip",
terms: "contract",
};
export function legalMaterialIconName(icon: string): string {
return LEGAL_MATERIAL_ICON[icon] ?? icon;
}
+236
View File
@@ -0,0 +1,236 @@
@use "../../css/material" as *;
.legalMain {
flex: 1;
width: 100%;
}
.legalPage {
max-width: 720px;
margin: 0 auto;
padding: 32px 20px 64px;
color: $color-dark-on-surface;
}
.loading,
.error {
font-size: 1rem;
color: $color-dark-on-surface-variant;
text-align: center;
}
.error {
color: $color-dark-error;
}
.errorState {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
}
.cachedBanner {
margin-bottom: 24px;
padding: 12px 16px;
border-radius: 12px;
background: $color-dark-secondary-container;
color: $color-dark-on-secondary-container;
font-size: 0.875rem;
line-height: 1.45;
text-align: center;
}
.preamble {
margin-bottom: 36px;
font-size: 0.95rem;
line-height: 1.55;
color: $color-dark-on-surface-variant;
text-align: center;
:global(blockquote) {
margin: 0;
padding: 0;
border: none;
}
:global(p) {
margin: 0 0 0.75em;
}
:global(.legalTableScroll) {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin: 0 0 0.75em;
max-width: 100%;
text-align: left;
}
:global(table) {
width: max-content;
min-width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
:global(th),
:global(td) {
padding: 8px 12px;
text-align: left;
vertical-align: top;
border: 1px solid $color-dark-outline-variant;
}
:global(th) {
font-weight: 600;
background: $color-dark-surface-container-low;
}
}
.section {
margin-bottom: 40px;
}
.sectionHeader {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 12px;
margin-bottom: 16px;
}
$expressive-hero-shape-size: 110px;
$expressive-hero-icon-size: 50px;
.sectionIconFrame {
width: $expressive-hero-shape-size;
height: $expressive-hero-shape-size;
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.sectionIconShape {
position: absolute;
top: 50%;
left: 50%;
width: $expressive-hero-shape-size;
height: $expressive-hero-shape-size;
transform: translate(-50%, -50%);
display: block;
}
.sectionShapeFill {
fill: $color-dark-primary-container;
}
.sectionIconGlyph {
font-size: $expressive-hero-icon-size !important;
width: $expressive-hero-icon-size !important;
height: $expressive-hero-icon-size !important;
position: relative;
z-index: 1;
color: $color-dark-on-primary-container;
}
.sectionTitle {
margin: 0;
font-size: 1.25rem;
font-weight: 600;
line-height: 1.3;
}
.sectionBody {
font-size: 0.95rem;
line-height: 1.55;
:global(h3) {
font-size: calc((0.95rem + 1.25rem) / 2);
font-weight: 600;
line-height: 1.4;
margin: 1.25em 0 0.5em;
&:first-child {
margin-top: 0;
}
}
:global(h2) {
font-size: 1.125rem;
font-weight: 600;
line-height: 1.35;
margin: 1.5em 0 0.5em;
&:first-child {
margin-top: 0;
}
}
:global(p) {
margin: 0 0 0.75em;
}
:global(ul),
:global(ol) {
margin: 0 0 0.75em;
padding-left: 1.25em;
}
:global(li) {
margin-bottom: 0.35em;
}
:global(a) {
color: $color-dark-primary;
}
:global(.legalTableScroll) {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin: 0 0 0.75em;
max-width: 100%;
}
:global(table) {
width: max-content;
min-width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
:global(th),
:global(td) {
padding: 8px 12px;
text-align: left;
vertical-align: top;
border: 1px solid $color-dark-outline-variant;
}
:global(th) {
font-weight: 600;
background: $color-dark-surface-container-low;
}
}
.legalInlineLinks {
font-size: 0.875rem;
color: $color-dark-on-surface-variant;
margin-top: 12px;
a {
color: $color-dark-primary;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
.legalInlineLinksSep {
margin: 0 6px;
opacity: 0.5;
}
@@ -0,0 +1,81 @@
import { delay } from "@/utils/utils";
export type LegalDocumentKind = "privacy" | "terms";
export const LEGAL_DOCUMENT_PATH: Record<LegalDocumentKind, string> = {
privacy: "/api/static/PRIVACY.md",
terms: "/api/static/TERMS.md",
};
const RETRY_WINDOW_MS = 5000;
const RETRY_DELAY_MS = 1000;
const CACHE_KEY: Record<LegalDocumentKind, string> = {
privacy: "fromchat:legal:privacy",
terms: "fromchat:legal:terms",
};
export type LegalDocumentLoadResult =
| { status: "success"; markdown: string; fromCache: false }
| { status: "cached"; markdown: string; fromCache: true }
| { status: "error"; message: string };
function readCache(kind: LegalDocumentKind): string | null {
try {
return localStorage.getItem(CACHE_KEY[kind]);
} catch {
return null;
}
}
function writeCache(kind: LegalDocumentKind, markdown: string): void {
try {
localStorage.setItem(CACHE_KEY[kind], markdown);
} catch {
// best-effort
}
}
async function fetchOnce(path: string): Promise<string> {
const response = await fetch(path);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.text();
}
export async function loadLegalDocument(
kind: LegalDocumentKind,
signal?: AbortSignal,
): Promise<LegalDocumentLoadResult> {
const path = LEGAL_DOCUMENT_PATH[kind];
const start = Date.now();
while (true) {
if (signal?.aborted) {
throw new DOMException("Aborted", "AbortError");
}
try {
const markdown = await fetchOnce(path);
writeCache(kind, markdown);
return { status: "success", markdown, fromCache: false };
} catch {
const elapsed = Date.now() - start;
if (elapsed >= RETRY_WINDOW_MS) {
break;
}
await delay(RETRY_DELAY_MS);
}
}
const cached = readCache(kind);
if (cached != null && cached.length > 0) {
return { status: "cached", markdown: cached, fromCache: true };
}
return {
status: "error",
message: "Не удалось загрузить документ. Проверьте подключение к интернету и попробуйте снова.",
};
}
+19
View File
@@ -0,0 +1,19 @@
const LEGAL_STATIC_LINK_RE = /(?:^|\/)?(?:api\/)?static\/(TERMS|PRIVACY)\.md$/i;
/**
* Maps static legal markdown API paths to client routes.
* Returns null when the href is not a legal document link.
*/
export function rewriteLegalDocumentHref(href: string): string | null {
const path = href.replace(/\\/g, "/").split("?")[0].split("#")[0].replace(/\/+$/, "");
const match = path.match(LEGAL_STATIC_LINK_RE);
if (!match) return null;
return match[1].toUpperCase() === "TERMS" ? "/terms" : "/privacy";
}
export function rewriteLegalLinksInHtml(html: string): string {
return html.replace(/href="([^"]+)"/g, (full, href: string) => {
const rewritten = rewriteLegalDocumentHref(href);
return rewritten ? `href="${rewritten}"` : full;
});
}
@@ -0,0 +1,39 @@
/** Auto-generated from MaterialShapes via Robolectric — do not edit. */
export const MATERIAL_SHAPE_PATHS: Record<string, string> = {
"Arch": "M 0.146 0.146 L 0.181 0.114 L 0.22 0.085 L 0.261 0.06 L 0.305 0.039 L 0.351 0.022 L 0.399 0.01 L 0.448 0.002 L 0.5 0 L 0.551 0.002 L 0.6 0.01 L 0.648 0.022 L 0.694 0.039 L 0.738 0.06 L 0.779 0.085 L 0.818 0.114 L 0.853 0.146 L 0.885 0.181 L 0.914 0.22 L 0.939 0.261 L 0.96 0.305 L 0.977 0.351 L 0.989 0.399 L 0.997 0.448 L 0.999 0.5 L 1 0.858 L 0.997 0.887 L 0.988 0.913 L 0.975 0.937 L 0.958 0.958 L 0.937 0.975 L 0.913 0.988 L 0.887 0.997 L 0.858 1 L 0.141 0.999 L 0.112 0.997 L 0.086 0.988 L 0.062 0.975 L 0.041 0.958 L 0.024 0.937 L 0.011 0.913 L 0.002 0.887 L 0 0.858 L 0 0.5 L 0.002 0.448 L 0.01 0.399 L 0.022 0.351 L 0.039 0.305 L 0.06 0.261 L 0.085 0.22 L 0.114 0.181 L 0.146 0.146 L 0.146 0.146 Z",
"Arrow": "M 0.499 0.836 L 0.468 0.838 L 0.438 0.843 L 0.277 0.878 L 0.249 0.882 L 0.221 0.882 L 0.194 0.878 L 0.169 0.87 L 0.146 0.858 L 0.125 0.844 L 0.106 0.827 L 0.09 0.807 L 0.077 0.785 L 0.066 0.762 L 0.059 0.738 L 0.055 0.712 L 0.055 0.686 L 0.059 0.659 L 0.068 0.633 L 0.081 0.607 L 0.172 0.452 L 0.269 0.291 L 0.311 0.227 L 0.349 0.175 L 0.386 0.135 L 0.422 0.106 L 0.459 0.089 L 0.498 0.083 L 0.537 0.089 L 0.575 0.106 L 0.611 0.135 L 0.648 0.175 L 0.686 0.227 L 0.728 0.29 L 0.825 0.451 L 0.916 0.602 L 0.929 0.629 L 0.938 0.656 L 0.942 0.683 L 0.942 0.71 L 0.938 0.737 L 0.931 0.762 L 0.92 0.785 L 0.906 0.808 L 0.889 0.827 L 0.87 0.845 L 0.848 0.86 L 0.824 0.871 L 0.799 0.879 L 0.772 0.884 L 0.743 0.884 L 0.713 0.879 L 0.56 0.843 L 0.529 0.838 L 0.499 0.836 L 0.499 0.836 Z",
"Boom": "M 0.454 0.287 L 0.459 0.281 L 0.493 0.01 L 0.495 0.006 L 0.5 0.004 L 0.504 0.006 L 0.506 0.01 L 0.541 0.281 L 0.546 0.287 L 0.553 0.284 L 0.694 0.05 L 0.698 0.047 L 0.703 0.048 L 0.706 0.051 L 0.707 0.056 L 0.628 0.317 L 0.63 0.325 L 0.638 0.325 L 0.862 0.169 L 0.867 0.167 L 0.871 0.17 L 0.873 0.174 L 0.871 0.179 L 0.693 0.385 L 0.692 0.394 L 0.699 0.397 L 0.967 0.345 L 0.972 0.346 L 0.975 0.35 L 0.975 0.355 L 0.971 0.358 L 0.725 0.474 L 0.721 0.481 L 0.726 0.488 L 0.991 0.549 L 0.996 0.552 L 0.997 0.557 L 0.995 0.561 L 0.99 0.563 L 0.717 0.569 L 0.711 0.573 L 0.713 0.581 L 0.931 0.745 L 0.933 0.75 L 0.933 0.754 L 0.929 0.758 L 0.924 0.757 L 0.672 0.652 L 0.664 0.653 L 0.664 0.661 L 0.795 0.9 L 0.796 0.905 L 0.793 0.909 L 0.789 0.91 L 0.784 0.908 L 0.598 0.709 L 0.59 0.708 L 0.585 0.714 L 0.609 0.986 L 0.607 0.991 L 0.603 0.994 L 0.599 0.993 L 0.595 0.989 L 0.506 0.731 L 0.499 0.727 L 0.493 0.731 L 0.404 0.989 L 0.4 0.993 L 0.395 0.994 L 0.391 0.991 L 0.39 0.986 L 0.413 0.714 L 0.409 0.707 L 0.401 0.709 L 0.215 0.908 L 0.21 0.91 L 0.206 0.909 L 0.203 0.905 L 0.204 0.9 L 0.335 0.661 L 0.334 0.653 L 0.326 0.651 L 0.075 0.757 L 0.07 0.757 L 0.066 0.754 L 0.065 0.75 L 0.068 0.745 L 0.286 0.58 L 0.288 0.573 L 0.282 0.568 L 0.009 0.563 L 0.004 0.561 L 0.002 0.557 L 0.003 0.552 L 0.008 0.549 L 0.273 0.487 L 0.279 0.481 L 0.275 0.474 L 0.028 0.358 L 0.024 0.355 L 0.024 0.35 L 0.027 0.346 L 0.032 0.345 L 0.3 0.396 L 0.307 0.393 L 0.306 0.385 L 0.128 0.179 L 0.126 0.174 L 0.128 0.17 L 0.132 0.167 L 0.137 0.169 L 0.361 0.324 L 0.369 0.324 L 0.372 0.317 L 0.292 0.056 L 0.293 0.051 L 0.296 0.047 L 0.301 0.047 L 0.305 0.05 L 0.446 0.284 L 0.454 0.287 L 0.454 0.287 Z",
"Bun": "M 0.796 0.5 L 0.806 0.503 L 0.85 0.522 L 0.89 0.548 L 0.912 0.569 L 0.932 0.592 L 0.949 0.617 L 0.962 0.643 L 0.973 0.671 L 0.98 0.7 L 0.983 0.731 L 0.983 0.761 L 0.983 0.762 L 0.975 0.81 L 0.958 0.855 L 0.934 0.896 L 0.903 0.931 L 0.866 0.96 L 0.824 0.981 L 0.778 0.995 L 0.729 1 L 0.27 1 L 0.221 0.995 L 0.175 0.981 L 0.133 0.96 L 0.096 0.931 L 0.065 0.896 L 0.041 0.855 L 0.024 0.81 L 0.016 0.762 L 0.016 0.761 L 0.016 0.731 L 0.019 0.7 L 0.026 0.671 L 0.037 0.643 L 0.05 0.617 L 0.067 0.592 L 0.087 0.569 L 0.109 0.548 L 0.149 0.522 L 0.193 0.503 L 0.203 0.5 L 0.193 0.496 L 0.149 0.477 L 0.109 0.451 L 0.087 0.43 L 0.067 0.407 L 0.05 0.382 L 0.037 0.356 L 0.026 0.328 L 0.019 0.299 L 0.016 0.268 L 0.016 0.238 L 0.016 0.237 L 0.024 0.189 L 0.041 0.144 L 0.065 0.103 L 0.096 0.068 L 0.133 0.039 L 0.175 0.018 L 0.221 0.004 L 0.27 0 L 0.729 0 L 0.778 0.004 L 0.824 0.018 L 0.866 0.039 L 0.903 0.068 L 0.934 0.103 L 0.958 0.144 L 0.975 0.189 L 0.983 0.237 L 0.983 0.238 L 0.983 0.268 L 0.98 0.299 L 0.973 0.328 L 0.962 0.356 L 0.949 0.382 L 0.932 0.407 L 0.912 0.43 L 0.89 0.451 L 0.85 0.477 L 0.806 0.496 L 0.796 0.5 L 0.796 0.5 Z",
"Burst": "M 0.5 0 L 0.505 0.003 L 0.588 0.152 L 0.592 0.155 L 0.597 0.154 L 0.743 0.067 L 0.749 0.067 L 0.752 0.072 L 0.75 0.243 L 0.752 0.247 L 0.756 0.249 L 0.926 0.247 L 0.932 0.25 L 0.932 0.256 L 0.844 0.403 L 0.844 0.407 L 0.847 0.411 L 0.995 0.494 L 0.998 0.499 L 0.995 0.504 L 0.846 0.588 L 0.844 0.592 L 0.844 0.596 L 0.932 0.742 L 0.932 0.748 L 0.926 0.751 L 0.755 0.749 L 0.751 0.751 L 0.749 0.755 L 0.752 0.926 L 0.749 0.931 L 0.743 0.931 L 0.596 0.844 L 0.591 0.843 L 0.588 0.846 L 0.505 0.995 L 0.499 0.998 L 0.494 0.995 L 0.411 0.846 L 0.407 0.843 L 0.402 0.844 L 0.256 0.931 L 0.25 0.931 L 0.247 0.926 L 0.249 0.755 L 0.247 0.751 L 0.243 0.749 L 0.073 0.751 L 0.067 0.748 L 0.067 0.742 L 0.155 0.595 L 0.155 0.591 L 0.152 0.587 L 0.004 0.504 L 0.001 0.499 L 0.004 0.494 L 0.153 0.41 L 0.155 0.406 L 0.155 0.402 L 0.067 0.256 L 0.067 0.249 L 0.073 0.246 L 0.244 0.249 L 0.248 0.247 L 0.25 0.243 L 0.247 0.072 L 0.25 0.067 L 0.256 0.067 L 0.403 0.154 L 0.408 0.155 L 0.411 0.152 L 0.494 0.003 L 0.5 0 L 0.5 0 Z",
"Circle": "M 1 0.5 L 0.998 0.538 L 0.993 0.577 L 0.986 0.615 L 0.975 0.653 L 0.962 0.689 L 0.945 0.725 L 0.926 0.759 L 0.905 0.791 L 0.881 0.821 L 0.854 0.85 L 0.826 0.876 L 0.795 0.901 L 0.763 0.922 L 0.728 0.942 L 0.693 0.958 L 0.657 0.971 L 0.619 0.982 L 0.581 0.989 L 0.543 0.994 L 0.504 0.995 L 0.464 0.994 L 0.426 0.989 L 0.388 0.982 L 0.35 0.971 L 0.314 0.958 L 0.279 0.942 L 0.245 0.922 L 0.212 0.901 L 0.181 0.876 L 0.153 0.85 L 0.126 0.821 L 0.102 0.791 L 0.081 0.759 L 0.062 0.725 L 0.045 0.689 L 0.032 0.653 L 0.021 0.615 L 0.014 0.577 L 0.009 0.538 L 0.008 0.499 L 0.009 0.461 L 0.014 0.422 L 0.021 0.384 L 0.032 0.346 L 0.045 0.31 L 0.062 0.274 L 0.081 0.24 L 0.102 0.208 L 0.126 0.178 L 0.153 0.149 L 0.181 0.123 L 0.212 0.098 L 0.245 0.077 L 0.279 0.057 L 0.314 0.041 L 0.35 0.028 L 0.388 0.017 L 0.426 0.01 L 0.464 0.005 L 0.504 0.004 L 0.543 0.005 L 0.581 0.01 L 0.619 0.017 L 0.657 0.028 L 0.693 0.041 L 0.728 0.057 L 0.763 0.077 L 0.795 0.098 L 0.826 0.123 L 0.854 0.149 L 0.881 0.178 L 0.905 0.208 L 0.926 0.24 L 0.945 0.274 L 0.962 0.31 L 0.975 0.346 L 0.986 0.384 L 0.993 0.422 L 0.998 0.461 L 1 0.5 L 1 0.5 Z",
"ClamShell": "M 0.187 0.815 L 0.154 0.79 L 0.129 0.756 L 0.023 0.567 L 0.01 0.534 L 0.005 0.499 L 0.01 0.465 L 0.023 0.432 L 0.128 0.243 L 0.153 0.209 L 0.186 0.184 L 0.224 0.168 L 0.266 0.162 L 0.733 0.162 L 0.774 0.168 L 0.812 0.184 L 0.845 0.209 L 0.87 0.243 L 0.976 0.432 L 0.989 0.465 L 0.994 0.5 L 0.989 0.534 L 0.976 0.567 L 0.871 0.756 L 0.846 0.79 L 0.813 0.815 L 0.775 0.831 L 0.733 0.837 L 0.266 0.837 L 0.225 0.831 L 0.187 0.815 L 0.187 0.815 Z",
"Clover4Leaf": "M 0.5 0.098 L 0.514 0.086 L 0.558 0.058 L 0.606 0.039 L 0.655 0.029 L 0.706 0.028 L 0.755 0.036 L 0.803 0.052 L 0.848 0.077 L 0.888 0.111 L 0.922 0.151 L 0.947 0.196 L 0.963 0.244 L 0.971 0.293 L 0.97 0.344 L 0.96 0.393 L 0.941 0.441 L 0.913 0.485 L 0.901 0.5 L 0.913 0.514 L 0.941 0.558 L 0.96 0.606 L 0.97 0.655 L 0.971 0.706 L 0.963 0.755 L 0.947 0.803 L 0.922 0.848 L 0.888 0.888 L 0.848 0.922 L 0.803 0.947 L 0.755 0.963 L 0.706 0.971 L 0.655 0.97 L 0.606 0.96 L 0.558 0.941 L 0.514 0.913 L 0.5 0.901 L 0.485 0.913 L 0.441 0.941 L 0.393 0.96 L 0.344 0.97 L 0.293 0.971 L 0.244 0.963 L 0.196 0.947 L 0.151 0.922 L 0.111 0.888 L 0.077 0.848 L 0.052 0.803 L 0.036 0.755 L 0.028 0.706 L 0.029 0.655 L 0.039 0.606 L 0.058 0.558 L 0.086 0.514 L 0.098 0.5 L 0.086 0.485 L 0.058 0.441 L 0.039 0.393 L 0.029 0.344 L 0.028 0.293 L 0.036 0.244 L 0.052 0.196 L 0.077 0.151 L 0.111 0.111 L 0.151 0.077 L 0.196 0.052 L 0.244 0.036 L 0.293 0.028 L 0.344 0.029 L 0.393 0.039 L 0.441 0.058 L 0.485 0.086 L 0.5 0.098 L 0.5 0.098 Z",
"Clover8Leaf": "M 0.499 0.071 L 0.521 0.059 L 0.564 0.043 L 0.607 0.037 L 0.649 0.04 L 0.69 0.053 L 0.726 0.074 L 0.758 0.103 L 0.783 0.139 L 0.799 0.182 L 0.803 0.196 L 0.826 0.204 L 0.868 0.222 L 0.903 0.248 L 0.93 0.281 L 0.95 0.318 L 0.961 0.359 L 0.962 0.402 L 0.954 0.445 L 0.936 0.487 L 0.928 0.499 L 0.94 0.521 L 0.956 0.564 L 0.962 0.607 L 0.959 0.649 L 0.946 0.69 L 0.925 0.726 L 0.896 0.758 L 0.86 0.783 L 0.817 0.799 L 0.803 0.803 L 0.795 0.826 L 0.777 0.868 L 0.751 0.903 L 0.718 0.93 L 0.681 0.95 L 0.64 0.961 L 0.597 0.962 L 0.554 0.954 L 0.512 0.936 L 0.499 0.928 L 0.478 0.94 L 0.435 0.956 L 0.392 0.962 L 0.35 0.959 L 0.309 0.946 L 0.273 0.925 L 0.241 0.896 L 0.216 0.86 L 0.2 0.817 L 0.196 0.803 L 0.173 0.795 L 0.131 0.777 L 0.096 0.751 L 0.069 0.718 L 0.049 0.681 L 0.038 0.64 L 0.037 0.597 L 0.045 0.554 L 0.063 0.512 L 0.071 0.499 L 0.059 0.478 L 0.043 0.435 L 0.037 0.392 L 0.04 0.35 L 0.053 0.309 L 0.074 0.273 L 0.103 0.241 L 0.139 0.216 L 0.182 0.2 L 0.196 0.196 L 0.204 0.173 L 0.222 0.131 L 0.248 0.096 L 0.281 0.069 L 0.318 0.049 L 0.359 0.038 L 0.402 0.037 L 0.445 0.045 L 0.487 0.063 L 0.499 0.071 L 0.499 0.071 Z",
"Cookie12Sided": "M 0.5 0.005 L 0.519 0.007 L 0.537 0.012 L 0.554 0.022 L 0.57 0.036 L 0.59 0.053 L 0.615 0.063 L 0.641 0.066 L 0.668 0.062 L 0.688 0.058 L 0.708 0.058 L 0.727 0.062 L 0.744 0.07 L 0.76 0.081 L 0.773 0.096 L 0.783 0.113 L 0.79 0.132 L 0.799 0.157 L 0.815 0.179 L 0.836 0.195 L 0.862 0.204 L 0.881 0.211 L 0.898 0.221 L 0.912 0.234 L 0.924 0.25 L 0.931 0.267 L 0.936 0.286 L 0.936 0.306 L 0.932 0.326 L 0.927 0.352 L 0.931 0.379 L 0.941 0.403 L 0.958 0.424 L 0.972 0.44 L 0.981 0.457 L 0.987 0.475 L 0.989 0.494 L 0.987 0.513 L 0.981 0.532 L 0.972 0.549 L 0.958 0.564 L 0.941 0.585 L 0.931 0.61 L 0.927 0.636 L 0.932 0.663 L 0.936 0.683 L 0.936 0.703 L 0.931 0.722 L 0.924 0.739 L 0.912 0.755 L 0.898 0.768 L 0.881 0.778 L 0.862 0.784 L 0.836 0.794 L 0.815 0.81 L 0.799 0.831 L 0.79 0.857 L 0.783 0.876 L 0.773 0.893 L 0.76 0.907 L 0.744 0.918 L 0.727 0.926 L 0.708 0.931 L 0.688 0.931 L 0.668 0.927 L 0.641 0.922 L 0.615 0.925 L 0.59 0.936 L 0.57 0.953 L 0.554 0.967 L 0.537 0.976 L 0.519 0.982 L 0.499 0.984 L 0.48 0.982 L 0.462 0.976 L 0.445 0.967 L 0.429 0.953 L 0.409 0.936 L 0.384 0.925 L 0.358 0.922 L 0.331 0.927 L 0.311 0.931 L 0.291 0.931 L 0.272 0.926 L 0.255 0.918 L 0.239 0.907 L 0.226 0.893 L 0.216 0.876 L 0.209 0.857 L 0.2 0.831 L 0.184 0.81 L 0.163 0.794 L 0.137 0.784 L 0.118 0.778 L 0.101 0.768 L 0.087 0.755 L 0.075 0.739 L 0.068 0.722 L 0.063 0.703 L 0.063 0.683 L 0.067 0.663 L 0.072 0.636 L 0.068 0.61 L 0.058 0.585 L 0.041 0.564 L 0.027 0.549 L 0.018 0.532 L 0.012 0.513 L 0.01 0.494 L 0.012 0.475 L 0.018 0.457 L 0.027 0.44 L 0.041 0.424 L 0.058 0.403 L 0.068 0.379 L 0.072 0.352 L 0.067 0.326 L 0.063 0.306 L 0.063 0.286 L 0.068 0.267 L 0.075 0.25 L 0.087 0.234 L 0.101 0.221 L 0.118 0.211 L 0.137 0.204 L 0.163 0.195 L 0.184 0.179 L 0.2 0.157 L 0.209 0.132 L 0.216 0.113 L 0.226 0.096 L 0.239 0.081 L 0.255 0.07 L 0.272 0.062 L 0.291 0.058 L 0.311 0.058 L 0.331 0.062 L 0.358 0.066 L 0.384 0.063 L 0.409 0.053 L 0.429 0.036 L 0.445 0.022 L 0.462 0.012 L 0.48 0.007 L 0.5 0.005 L 0.5 0.005 Z",
"Cookie4Sided": "M 0.871 0.87 L 0.847 0.892 L 0.819 0.909 L 0.79 0.923 L 0.759 0.932 L 0.726 0.937 L 0.692 0.936 L 0.657 0.93 L 0.621 0.918 L 0.581 0.9 L 0.541 0.888 L 0.5 0.884 L 0.459 0.888 L 0.419 0.901 L 0.378 0.918 L 0.343 0.93 L 0.308 0.936 L 0.274 0.937 L 0.241 0.932 L 0.21 0.923 L 0.18 0.91 L 0.153 0.892 L 0.129 0.871 L 0.108 0.846 L 0.09 0.819 L 0.076 0.79 L 0.067 0.758 L 0.062 0.725 L 0.063 0.691 L 0.069 0.657 L 0.081 0.621 L 0.099 0.581 L 0.111 0.541 L 0.115 0.5 L 0.111 0.458 L 0.099 0.419 L 0.081 0.378 L 0.069 0.343 L 0.063 0.308 L 0.062 0.274 L 0.067 0.241 L 0.076 0.21 L 0.09 0.18 L 0.107 0.153 L 0.128 0.129 L 0.153 0.107 L 0.18 0.09 L 0.209 0.076 L 0.241 0.067 L 0.274 0.062 L 0.308 0.063 L 0.343 0.069 L 0.378 0.081 L 0.419 0.099 L 0.459 0.111 L 0.5 0.115 L 0.541 0.111 L 0.581 0.098 L 0.621 0.081 L 0.656 0.069 L 0.691 0.063 L 0.725 0.062 L 0.758 0.067 L 0.789 0.076 L 0.819 0.089 L 0.846 0.107 L 0.87 0.128 L 0.892 0.153 L 0.909 0.18 L 0.923 0.209 L 0.932 0.241 L 0.937 0.274 L 0.936 0.308 L 0.93 0.342 L 0.918 0.378 L 0.901 0.418 L 0.888 0.458 L 0.884 0.499 L 0.888 0.541 L 0.901 0.58 L 0.918 0.621 L 0.93 0.656 L 0.937 0.691 L 0.937 0.725 L 0.933 0.758 L 0.923 0.789 L 0.91 0.819 L 0.892 0.846 L 0.871 0.87 L 0.871 0.87 Z",
"Cookie6Sided": "M 0.716 0.872 L 0.692 0.889 L 0.669 0.908 L 0.668 0.909 L 0.63 0.939 L 0.589 0.96 L 0.545 0.973 L 0.5 0.977 L 0.454 0.972 L 0.41 0.96 L 0.369 0.938 L 0.331 0.909 L 0.309 0.89 L 0.285 0.873 L 0.259 0.86 L 0.231 0.851 L 0.229 0.85 L 0.185 0.832 L 0.145 0.807 L 0.112 0.775 L 0.086 0.738 L 0.067 0.697 L 0.056 0.652 L 0.054 0.606 L 0.061 0.559 L 0.066 0.53 L 0.068 0.501 L 0.067 0.471 L 0.061 0.443 L 0.061 0.441 L 0.054 0.393 L 0.056 0.347 L 0.067 0.302 L 0.086 0.261 L 0.112 0.224 L 0.146 0.192 L 0.185 0.167 L 0.229 0.149 L 0.257 0.14 L 0.283 0.127 L 0.307 0.11 L 0.33 0.091 L 0.331 0.09 L 0.369 0.06 L 0.41 0.039 L 0.454 0.026 L 0.499 0.022 L 0.545 0.027 L 0.589 0.039 L 0.63 0.061 L 0.668 0.09 L 0.69 0.109 L 0.714 0.126 L 0.74 0.139 L 0.768 0.148 L 0.77 0.149 L 0.814 0.167 L 0.854 0.192 L 0.887 0.224 L 0.913 0.261 L 0.932 0.302 L 0.943 0.347 L 0.945 0.393 L 0.938 0.44 L 0.933 0.469 L 0.931 0.498 L 0.932 0.528 L 0.938 0.556 L 0.938 0.558 L 0.945 0.606 L 0.943 0.652 L 0.932 0.697 L 0.913 0.738 L 0.887 0.775 L 0.853 0.807 L 0.814 0.832 L 0.77 0.85 L 0.742 0.859 L 0.716 0.872 L 0.716 0.872 Z",
"Cookie7Sided": "M 0.5 0.021 L 0.536 0.025 L 0.571 0.035 L 0.604 0.053 L 0.634 0.077 L 0.659 0.098 L 0.686 0.114 L 0.716 0.125 L 0.748 0.132 L 0.785 0.14 L 0.82 0.155 L 0.85 0.176 L 0.875 0.202 L 0.895 0.233 L 0.909 0.267 L 0.916 0.304 L 0.916 0.342 L 0.915 0.374 L 0.919 0.406 L 0.929 0.436 L 0.944 0.465 L 0.961 0.499 L 0.97 0.536 L 0.973 0.572 L 0.968 0.609 L 0.956 0.643 L 0.938 0.676 L 0.914 0.704 L 0.884 0.728 L 0.858 0.747 L 0.836 0.77 L 0.818 0.797 L 0.805 0.826 L 0.789 0.861 L 0.767 0.891 L 0.739 0.916 L 0.708 0.935 L 0.674 0.947 L 0.637 0.953 L 0.6 0.952 L 0.562 0.943 L 0.531 0.935 L 0.5 0.932 L 0.468 0.935 L 0.437 0.943 L 0.399 0.952 L 0.362 0.953 L 0.325 0.947 L 0.291 0.935 L 0.26 0.916 L 0.232 0.891 L 0.21 0.861 L 0.194 0.826 L 0.181 0.797 L 0.163 0.77 L 0.141 0.747 L 0.115 0.728 L 0.085 0.704 L 0.061 0.676 L 0.043 0.643 L 0.031 0.609 L 0.026 0.572 L 0.029 0.536 L 0.038 0.499 L 0.055 0.465 L 0.07 0.436 L 0.08 0.406 L 0.084 0.374 L 0.083 0.342 L 0.083 0.304 L 0.09 0.267 L 0.104 0.233 L 0.124 0.202 L 0.149 0.176 L 0.179 0.155 L 0.214 0.14 L 0.251 0.132 L 0.283 0.125 L 0.313 0.114 L 0.34 0.098 L 0.365 0.077 L 0.395 0.053 L 0.428 0.035 L 0.463 0.025 L 0.5 0.021 L 0.5 0.021 Z",
"Cookie9Sided": "M 0.5 0.014 L 0.527 0.016 L 0.553 0.023 L 0.578 0.036 L 0.601 0.053 L 0.625 0.071 L 0.651 0.083 L 0.68 0.09 L 0.709 0.092 L 0.738 0.094 L 0.765 0.101 L 0.79 0.112 L 0.812 0.128 L 0.832 0.147 L 0.847 0.17 L 0.859 0.195 L 0.865 0.223 L 0.872 0.252 L 0.884 0.278 L 0.901 0.302 L 0.923 0.322 L 0.943 0.342 L 0.96 0.365 L 0.972 0.39 L 0.979 0.416 L 0.981 0.443 L 0.979 0.471 L 0.971 0.497 L 0.958 0.523 L 0.945 0.549 L 0.937 0.578 L 0.935 0.607 L 0.938 0.636 L 0.941 0.665 L 0.939 0.692 L 0.933 0.719 L 0.921 0.744 L 0.905 0.766 L 0.886 0.786 L 0.863 0.801 L 0.836 0.812 L 0.809 0.824 L 0.785 0.841 L 0.764 0.862 L 0.748 0.886 L 0.733 0.91 L 0.713 0.93 L 0.691 0.946 L 0.666 0.958 L 0.64 0.965 L 0.612 0.967 L 0.584 0.964 L 0.557 0.956 L 0.529 0.947 L 0.499 0.945 L 0.47 0.947 L 0.442 0.956 L 0.415 0.964 L 0.387 0.967 L 0.359 0.965 L 0.333 0.958 L 0.308 0.946 L 0.286 0.93 L 0.266 0.91 L 0.251 0.886 L 0.235 0.862 L 0.214 0.841 L 0.19 0.824 L 0.163 0.812 L 0.136 0.801 L 0.113 0.786 L 0.094 0.766 L 0.078 0.744 L 0.066 0.719 L 0.06 0.692 L 0.058 0.665 L 0.061 0.636 L 0.064 0.607 L 0.062 0.578 L 0.054 0.549 L 0.041 0.523 L 0.028 0.497 L 0.02 0.471 L 0.018 0.443 L 0.02 0.416 L 0.027 0.39 L 0.039 0.365 L 0.056 0.342 L 0.076 0.322 L 0.098 0.302 L 0.115 0.278 L 0.127 0.252 L 0.134 0.223 L 0.14 0.195 L 0.152 0.17 L 0.167 0.147 L 0.187 0.128 L 0.209 0.112 L 0.234 0.101 L 0.261 0.094 L 0.29 0.092 L 0.319 0.09 L 0.348 0.083 L 0.374 0.071 L 0.398 0.053 L 0.421 0.036 L 0.446 0.023 L 0.472 0.016 L 0.5 0.014 L 0.5 0.014 Z",
"Diamond": "M 0.499 1 L 0.459 0.994 L 0.421 0.977 L 0.402 0.962 L 0.381 0.939 L 0.319 0.861 L 0.117 0.6 L 0.103 0.577 L 0.093 0.554 L 0.086 0.529 L 0.084 0.503 L 0.086 0.478 L 0.093 0.453 L 0.103 0.429 L 0.117 0.407 L 0.319 0.146 L 0.381 0.067 L 0.402 0.044 L 0.421 0.029 L 0.459 0.013 L 0.5 0.007 L 0.54 0.013 L 0.578 0.029 L 0.597 0.044 L 0.618 0.067 L 0.68 0.146 L 0.882 0.407 L 0.896 0.429 L 0.906 0.453 L 0.913 0.478 L 0.915 0.503 L 0.913 0.529 L 0.906 0.554 L 0.896 0.577 L 0.882 0.6 L 0.68 0.861 L 0.618 0.939 L 0.597 0.962 L 0.578 0.977 L 0.54 0.994 L 0.499 1 L 0.499 1 Z",
"Fan": "M 0.957 0.955 L 0.926 0.979 L 0.889 0.995 L 0.852 0.999 L 0.788 1 L 0.151 1 L 0.12 0.996 L 0.092 0.988 L 0.066 0.974 L 0.044 0.955 L 0.026 0.933 L 0.012 0.907 L 0.003 0.879 L 0 0.849 L 0 0.149 L 0.003 0.119 L 0.012 0.091 L 0.026 0.065 L 0.044 0.043 L 0.067 0.025 L 0.093 0.012 L 0.121 0.004 L 0.151 0.001 L 0.214 0.003 L 0.293 0.009 L 0.37 0.022 L 0.444 0.042 L 0.515 0.069 L 0.583 0.102 L 0.646 0.142 L 0.706 0.187 L 0.761 0.237 L 0.812 0.292 L 0.857 0.351 L 0.896 0.415 L 0.93 0.483 L 0.957 0.554 L 0.977 0.628 L 0.991 0.704 L 0.997 0.783 L 0.997 0.785 L 0.998 0.849 L 0.995 0.886 L 0.98 0.923 L 0.957 0.955 L 0.957 0.955 Z",
"Flower": "M 0.369 0.186 L 0.396 0.107 L 0.407 0.079 L 0.423 0.053 L 0.442 0.03 L 0.465 0.01 L 0.479 0.002 L 0.495 0 L 0.503 0 L 0.519 0.002 L 0.533 0.01 L 0.556 0.03 L 0.575 0.053 L 0.591 0.079 L 0.603 0.107 L 0.629 0.186 L 0.704 0.148 L 0.732 0.137 L 0.761 0.13 L 0.791 0.127 L 0.821 0.129 L 0.837 0.134 L 0.85 0.143 L 0.855 0.148 L 0.865 0.161 L 0.87 0.177 L 0.871 0.207 L 0.869 0.237 L 0.862 0.267 L 0.85 0.295 L 0.813 0.369 L 0.892 0.396 L 0.92 0.407 L 0.946 0.423 L 0.969 0.442 L 0.989 0.465 L 0.997 0.479 L 0.999 0.495 L 0.999 0.503 L 0.997 0.519 L 0.989 0.533 L 0.969 0.556 L 0.946 0.575 L 0.92 0.591 L 0.892 0.603 L 0.813 0.629 L 0.851 0.704 L 0.862 0.732 L 0.869 0.761 L 0.872 0.791 L 0.87 0.821 L 0.865 0.837 L 0.856 0.85 L 0.851 0.855 L 0.838 0.865 L 0.822 0.87 L 0.792 0.871 L 0.762 0.869 L 0.732 0.862 L 0.704 0.85 L 0.63 0.813 L 0.603 0.892 L 0.592 0.92 L 0.576 0.946 L 0.557 0.969 L 0.534 0.989 L 0.52 0.997 L 0.504 0.999 L 0.496 0.999 L 0.48 0.997 L 0.466 0.989 L 0.443 0.969 L 0.424 0.946 L 0.408 0.92 L 0.396 0.892 L 0.37 0.813 L 0.295 0.851 L 0.267 0.862 L 0.238 0.869 L 0.208 0.872 L 0.178 0.87 L 0.162 0.865 L 0.149 0.856 L 0.144 0.851 L 0.134 0.838 L 0.129 0.822 L 0.128 0.792 L 0.13 0.762 L 0.137 0.732 L 0.149 0.704 L 0.186 0.63 L 0.107 0.603 L 0.079 0.592 L 0.053 0.576 L 0.03 0.557 L 0.01 0.534 L 0.002 0.52 L 0 0.504 L 0 0.496 L 0.002 0.48 L 0.01 0.466 L 0.03 0.443 L 0.053 0.424 L 0.079 0.408 L 0.107 0.396 L 0.186 0.37 L 0.148 0.295 L 0.137 0.267 L 0.13 0.238 L 0.127 0.208 L 0.129 0.178 L 0.134 0.162 L 0.143 0.149 L 0.148 0.144 L 0.161 0.134 L 0.177 0.129 L 0.207 0.128 L 0.237 0.13 L 0.267 0.137 L 0.295 0.149 L 0.369 0.186 L 0.369 0.186 Z",
"Gem": "M 0.499 0.999 L 0.475 0.998 L 0.445 0.993 L 0.412 0.982 L 0.321 0.942 L 0.136 0.857 L 0.106 0.84 L 0.08 0.82 L 0.058 0.795 L 0.04 0.767 L 0.027 0.737 L 0.018 0.705 L 0.015 0.672 L 0.017 0.638 L 0.059 0.354 L 0.07 0.309 L 0.089 0.268 L 0.117 0.232 L 0.151 0.201 L 0.378 0.039 L 0.406 0.022 L 0.436 0.01 L 0.468 0.002 L 0.501 0 L 0.534 0.002 L 0.566 0.01 L 0.596 0.022 L 0.624 0.04 L 0.85 0.203 L 0.884 0.233 L 0.911 0.27 L 0.931 0.311 L 0.942 0.355 L 0.982 0.64 L 0.984 0.674 L 0.981 0.707 L 0.972 0.739 L 0.959 0.769 L 0.941 0.797 L 0.918 0.821 L 0.892 0.842 L 0.862 0.859 L 0.677 0.943 L 0.586 0.982 L 0.553 0.993 L 0.523 0.998 L 0.499 0.999 L 0.499 0.999 Z",
"Ghostish": "M 0.5 0 L 0.548 0.002 L 0.596 0.009 L 0.641 0.021 L 0.685 0.037 L 0.727 0.057 L 0.766 0.081 L 0.803 0.108 L 0.837 0.139 L 0.867 0.173 L 0.895 0.21 L 0.919 0.249 L 0.939 0.291 L 0.955 0.334 L 0.966 0.38 L 0.974 0.427 L 0.976 0.476 L 0.976 0.76 L 0.974 0.786 L 0.969 0.812 L 0.961 0.836 L 0.95 0.858 L 0.936 0.878 L 0.92 0.896 L 0.881 0.926 L 0.837 0.945 L 0.813 0.95 L 0.789 0.953 L 0.764 0.952 L 0.739 0.948 L 0.714 0.94 L 0.69 0.929 L 0.624 0.892 L 0.597 0.88 L 0.569 0.871 L 0.54 0.865 L 0.51 0.863 L 0.489 0.863 L 0.459 0.865 L 0.43 0.871 L 0.402 0.88 L 0.375 0.892 L 0.309 0.929 L 0.285 0.94 L 0.26 0.948 L 0.235 0.952 L 0.21 0.953 L 0.186 0.95 L 0.162 0.945 L 0.118 0.926 L 0.079 0.896 L 0.063 0.878 L 0.049 0.858 L 0.038 0.836 L 0.03 0.812 L 0.025 0.786 L 0.023 0.76 L 0.023 0.476 L 0.025 0.427 L 0.033 0.38 L 0.044 0.334 L 0.06 0.291 L 0.08 0.249 L 0.104 0.21 L 0.132 0.173 L 0.162 0.139 L 0.196 0.108 L 0.233 0.081 L 0.272 0.057 L 0.314 0.037 L 0.358 0.021 L 0.403 0.009 L 0.451 0.002 L 0.5 0 L 0.5 0 Z",
"Heart": "M 0.5 0.285 L 0.504 0.283 L 0.619 0.151 L 0.654 0.12 L 0.693 0.097 L 0.736 0.084 L 0.779 0.081 L 0.823 0.087 L 0.865 0.101 L 0.903 0.125 L 0.936 0.159 L 0.957 0.19 L 0.971 0.224 L 0.98 0.259 L 0.983 0.295 L 0.979 0.331 L 0.969 0.367 L 0.954 0.4 L 0.932 0.431 L 0.501 0.944 L 0.5 0.945 L 0.498 0.944 L 0.067 0.431 L 0.045 0.4 L 0.03 0.367 L 0.02 0.331 L 0.016 0.295 L 0.019 0.259 L 0.028 0.224 L 0.042 0.19 L 0.063 0.159 L 0.096 0.125 L 0.134 0.101 L 0.176 0.087 L 0.22 0.081 L 0.263 0.084 L 0.306 0.097 L 0.345 0.12 L 0.38 0.151 L 0.495 0.283 L 0.5 0.285 L 0.5 0.285 Z",
"Oval": "M 0.908 0.091 L 0.931 0.118 L 0.951 0.15 L 0.966 0.184 L 0.977 0.222 L 0.983 0.263 L 0.984 0.306 L 0.981 0.35 L 0.973 0.396 L 0.961 0.442 L 0.944 0.489 L 0.923 0.537 L 0.897 0.585 L 0.868 0.631 L 0.835 0.677 L 0.799 0.72 L 0.761 0.761 L 0.72 0.799 L 0.677 0.835 L 0.631 0.868 L 0.585 0.897 L 0.537 0.923 L 0.489 0.944 L 0.442 0.961 L 0.396 0.973 L 0.35 0.981 L 0.306 0.984 L 0.263 0.983 L 0.222 0.977 L 0.184 0.966 L 0.15 0.951 L 0.118 0.931 L 0.091 0.908 L 0.068 0.881 L 0.048 0.849 L 0.033 0.815 L 0.022 0.777 L 0.016 0.736 L 0.015 0.693 L 0.018 0.649 L 0.026 0.603 L 0.038 0.557 L 0.055 0.51 L 0.076 0.462 L 0.102 0.414 L 0.131 0.368 L 0.164 0.322 L 0.2 0.279 L 0.238 0.238 L 0.279 0.2 L 0.322 0.164 L 0.368 0.131 L 0.414 0.102 L 0.462 0.076 L 0.51 0.055 L 0.557 0.038 L 0.603 0.026 L 0.649 0.018 L 0.693 0.015 L 0.736 0.016 L 0.777 0.022 L 0.815 0.033 L 0.849 0.048 L 0.881 0.068 L 0.908 0.091 L 0.908 0.091 Z",
"Pentagon": "M 0.499 0.042 L 0.525 0.044 L 0.55 0.05 L 0.573 0.06 L 0.596 0.073 L 0.918 0.3 L 0.938 0.317 L 0.955 0.336 L 0.968 0.358 L 0.977 0.381 L 0.983 0.405 L 0.985 0.43 L 0.983 0.456 L 0.977 0.481 L 0.856 0.844 L 0.846 0.868 L 0.832 0.89 L 0.815 0.909 L 0.796 0.926 L 0.774 0.939 L 0.751 0.949 L 0.726 0.955 L 0.7 0.957 L 0.299 0.957 L 0.273 0.955 L 0.248 0.949 L 0.225 0.939 L 0.203 0.926 L 0.184 0.909 L 0.167 0.89 L 0.153 0.868 L 0.143 0.844 L 0.022 0.481 L 0.016 0.456 L 0.014 0.43 L 0.016 0.405 L 0.022 0.381 L 0.031 0.358 L 0.044 0.336 L 0.061 0.317 L 0.081 0.3 L 0.403 0.073 L 0.426 0.06 L 0.449 0.05 L 0.474 0.044 L 0.499 0.042 L 0.499 0.042 Z",
"Pill": "M 0.873 0.126 L 0.919 0.181 L 0.938 0.211 L 0.955 0.243 L 0.969 0.276 L 0.981 0.31 L 0.99 0.346 L 0.995 0.383 L 1 0.428 L 0.997 0.471 L 0.991 0.513 L 0.98 0.554 L 0.966 0.595 L 0.947 0.633 L 0.925 0.67 L 0.9 0.704 L 0.871 0.736 L 0.736 0.871 L 0.704 0.9 L 0.67 0.925 L 0.633 0.947 L 0.595 0.966 L 0.554 0.98 L 0.513 0.991 L 0.471 0.997 L 0.428 1 L 0.383 0.995 L 0.346 0.99 L 0.31 0.981 L 0.276 0.969 L 0.243 0.955 L 0.211 0.938 L 0.181 0.919 L 0.126 0.873 L 0.08 0.818 L 0.061 0.788 L 0.044 0.756 L 0.03 0.723 L 0.018 0.689 L 0.009 0.653 L 0.004 0.616 L 0 0.571 L 0.002 0.528 L 0.008 0.486 L 0.019 0.445 L 0.033 0.404 L 0.052 0.366 L 0.074 0.329 L 0.099 0.295 L 0.128 0.263 L 0.263 0.128 L 0.295 0.099 L 0.329 0.074 L 0.366 0.052 L 0.404 0.033 L 0.445 0.019 L 0.486 0.008 L 0.528 0.002 L 0.571 0 L 0.616 0.004 L 0.653 0.009 L 0.689 0.018 L 0.723 0.03 L 0.756 0.044 L 0.788 0.061 L 0.818 0.08 L 0.873 0.126 L 0.873 0.126 Z",
"PixelCircle": "M 0.499 0 L 0.704 0 L 0.704 0.065 L 0.843 0.065 L 0.843 0.148 L 0.926 0.148 L 0.926 0.296 L 1 0.296 L 1 0.704 L 0.926 0.704 L 0.926 0.852 L 0.843 0.852 L 0.843 0.935 L 0.704 0.934 L 0.704 1 L 0.499 1 L 0.295 0.999 L 0.295 0.934 L 0.157 0.935 L 0.156 0.851 L 0.073 0.851 L 0.074 0.704 L 0 0.704 L 0 0.295 L 0.074 0.295 L 0.074 0.148 L 0.157 0.147 L 0.157 0.064 L 0.296 0.065 L 0.295 0 L 0.499 0 L 0.499 0 Z",
"PixelTriangle": "M 0.111 0.499 L 0.114 0 L 0.288 0 L 0.288 0.087 L 0.422 0.087 L 0.422 0.17 L 0.561 0.17 L 0.561 0.265 L 0.674 0.265 L 0.676 0.343 L 0.789 0.343 L 0.789 0.438 L 0.888 0.438 L 0.888 0.561 L 0.789 0.561 L 0.789 0.655 L 0.675 0.656 L 0.674 0.735 L 0.561 0.734 L 0.56 0.829 L 0.422 0.829 L 0.422 0.912 L 0.288 0.912 L 0.288 1 L 0.114 1 L 0.111 0.499 L 0.111 0.499 Z",
"Puffy": "M 0.5 0.17 L 0.517 0.143 L 0.533 0.126 L 0.554 0.113 L 0.579 0.105 L 0.607 0.103 L 0.634 0.107 L 0.659 0.116 L 0.679 0.129 L 0.694 0.146 L 0.702 0.158 L 0.713 0.18 L 0.718 0.203 L 0.72 0.225 L 0.732 0.21 L 0.748 0.199 L 0.767 0.191 L 0.787 0.186 L 0.809 0.185 L 0.83 0.188 L 0.85 0.195 L 0.868 0.206 L 0.871 0.209 L 0.889 0.225 L 0.902 0.244 L 0.911 0.263 L 0.916 0.284 L 0.917 0.291 L 0.916 0.316 L 0.91 0.341 L 0.897 0.364 L 0.878 0.386 L 0.884 0.386 L 0.908 0.387 L 0.931 0.393 L 0.95 0.403 L 0.966 0.417 L 0.981 0.435 L 0.991 0.455 L 0.997 0.476 L 1 0.497 L 1 0.502 L 0.997 0.523 L 0.991 0.544 L 0.981 0.564 L 0.966 0.582 L 0.95 0.596 L 0.931 0.606 L 0.908 0.612 L 0.884 0.613 L 0.878 0.613 L 0.897 0.635 L 0.91 0.658 L 0.916 0.683 L 0.917 0.708 L 0.916 0.715 L 0.911 0.736 L 0.902 0.755 L 0.889 0.774 L 0.871 0.79 L 0.868 0.793 L 0.85 0.804 L 0.83 0.811 L 0.809 0.814 L 0.787 0.813 L 0.767 0.808 L 0.748 0.8 L 0.732 0.789 L 0.72 0.774 L 0.718 0.796 L 0.713 0.819 L 0.702 0.841 L 0.694 0.853 L 0.679 0.87 L 0.659 0.883 L 0.634 0.892 L 0.607 0.896 L 0.579 0.894 L 0.554 0.886 L 0.533 0.873 L 0.517 0.856 L 0.5 0.829 L 0.482 0.856 L 0.466 0.873 L 0.445 0.886 L 0.42 0.894 L 0.392 0.896 L 0.365 0.892 L 0.34 0.883 L 0.32 0.87 L 0.305 0.853 L 0.297 0.841 L 0.286 0.819 L 0.281 0.796 L 0.279 0.774 L 0.267 0.789 L 0.251 0.8 L 0.232 0.808 L 0.212 0.813 L 0.19 0.814 L 0.169 0.811 L 0.149 0.804 L 0.131 0.793 L 0.128 0.79 L 0.11 0.774 L 0.097 0.755 L 0.088 0.736 L 0.083 0.715 L 0.082 0.708 L 0.083 0.683 L 0.089 0.658 L 0.102 0.635 L 0.121 0.613 L 0.115 0.613 L 0.091 0.612 L 0.068 0.606 L 0.049 0.596 L 0.033 0.582 L 0.018 0.564 L 0.008 0.544 L 0.002 0.523 L 0 0.502 L 0 0.497 L 0.002 0.476 L 0.008 0.455 L 0.018 0.435 L 0.033 0.417 L 0.049 0.403 L 0.068 0.393 L 0.091 0.387 L 0.115 0.386 L 0.121 0.386 L 0.102 0.364 L 0.089 0.341 L 0.083 0.316 L 0.082 0.291 L 0.083 0.284 L 0.088 0.263 L 0.097 0.244 L 0.11 0.225 L 0.128 0.209 L 0.131 0.206 L 0.149 0.195 L 0.169 0.188 L 0.19 0.185 L 0.212 0.186 L 0.232 0.191 L 0.251 0.199 L 0.267 0.21 L 0.279 0.225 L 0.281 0.203 L 0.286 0.18 L 0.297 0.158 L 0.305 0.146 L 0.32 0.129 L 0.34 0.116 L 0.365 0.107 L 0.392 0.103 L 0.42 0.105 L 0.445 0.113 L 0.466 0.126 L 0.482 0.143 L 0.5 0.17 L 0.5 0.17 Z",
"PuffyDiamond": "M 0.778 0.221 L 0.8 0.249 L 0.815 0.281 L 0.821 0.318 L 0.818 0.356 L 0.818 0.356 L 0.833 0.354 L 0.865 0.353 L 0.896 0.359 L 0.924 0.372 L 0.949 0.389 L 0.97 0.411 L 0.986 0.438 L 0.996 0.467 L 1 0.499 L 0.996 0.532 L 0.986 0.561 L 0.97 0.588 L 0.949 0.61 L 0.924 0.627 L 0.896 0.64 L 0.865 0.646 L 0.833 0.645 L 0.818 0.643 L 0.818 0.643 L 0.821 0.681 L 0.815 0.718 L 0.8 0.75 L 0.778 0.778 L 0.75 0.8 L 0.718 0.815 L 0.681 0.821 L 0.643 0.818 L 0.643 0.818 L 0.645 0.833 L 0.646 0.865 L 0.64 0.896 L 0.627 0.924 L 0.61 0.949 L 0.588 0.97 L 0.561 0.986 L 0.532 0.996 L 0.499 1 L 0.467 0.996 L 0.438 0.986 L 0.411 0.97 L 0.389 0.949 L 0.372 0.924 L 0.359 0.896 L 0.353 0.865 L 0.354 0.833 L 0.356 0.818 L 0.356 0.818 L 0.318 0.821 L 0.281 0.815 L 0.249 0.8 L 0.221 0.778 L 0.199 0.75 L 0.184 0.718 L 0.178 0.681 L 0.181 0.643 L 0.181 0.642 L 0.166 0.645 L 0.134 0.646 L 0.103 0.64 L 0.075 0.627 L 0.05 0.61 L 0.029 0.588 L 0.013 0.561 L 0.003 0.532 L 0 0.499 L 0.003 0.467 L 0.013 0.438 L 0.029 0.411 L 0.05 0.389 L 0.075 0.372 L 0.103 0.359 L 0.134 0.353 L 0.166 0.354 L 0.181 0.356 L 0.181 0.356 L 0.178 0.318 L 0.184 0.281 L 0.199 0.249 L 0.221 0.221 L 0.249 0.199 L 0.281 0.184 L 0.318 0.178 L 0.356 0.181 L 0.357 0.181 L 0.354 0.166 L 0.353 0.134 L 0.359 0.103 L 0.372 0.075 L 0.389 0.05 L 0.411 0.029 L 0.438 0.013 L 0.467 0.003 L 0.5 0 L 0.532 0.003 L 0.561 0.013 L 0.588 0.029 L 0.61 0.05 L 0.627 0.075 L 0.64 0.103 L 0.646 0.134 L 0.645 0.166 L 0.643 0.181 L 0.643 0.181 L 0.681 0.178 L 0.718 0.184 L 0.75 0.199 L 0.778 0.221 L 0.778 0.221 Z",
"SemiCircle": "M 0.969 0.781 L 0.954 0.794 L 0.936 0.804 L 0.916 0.81 L 0.895 0.812 L 0.104 0.812 L 0.083 0.81 L 0.063 0.804 L 0.045 0.794 L 0.03 0.781 L 0.017 0.766 L 0.008 0.748 L 0.002 0.729 L 0 0.708 L 0 0.687 L 0.002 0.636 L 0.01 0.586 L 0.022 0.538 L 0.039 0.492 L 0.06 0.449 L 0.085 0.407 L 0.114 0.369 L 0.146 0.333 L 0.181 0.301 L 0.22 0.272 L 0.261 0.247 L 0.305 0.226 L 0.351 0.209 L 0.399 0.197 L 0.448 0.19 L 0.5 0.187 L 0.551 0.19 L 0.6 0.197 L 0.648 0.209 L 0.694 0.226 L 0.738 0.247 L 0.779 0.272 L 0.818 0.301 L 0.853 0.333 L 0.885 0.369 L 0.914 0.407 L 0.939 0.449 L 0.96 0.492 L 0.977 0.538 L 0.989 0.586 L 0.997 0.636 L 1 0.687 L 1 0.708 L 0.997 0.729 L 0.991 0.748 L 0.982 0.766 L 0.969 0.781 L 0.969 0.781 Z",
"Slanted": "M 0.875 0.914 L 0.85 0.933 L 0.832 0.942 L 0.812 0.949 L 0.762 0.958 L 0.698 0.961 L 0.613 0.961 L 0.201 0.96 L 0.185 0.959 L 0.147 0.954 L 0.112 0.942 L 0.08 0.923 L 0.054 0.899 L 0.032 0.87 L 0.017 0.837 L 0.008 0.801 L 0.007 0.762 L 0.009 0.746 L 0.05 0.341 L 0.059 0.257 L 0.068 0.193 L 0.082 0.145 L 0.091 0.125 L 0.102 0.108 L 0.124 0.085 L 0.149 0.066 L 0.167 0.057 L 0.187 0.05 L 0.237 0.041 L 0.301 0.038 L 0.386 0.038 L 0.798 0.039 L 0.814 0.04 L 0.852 0.045 L 0.887 0.057 L 0.919 0.076 L 0.945 0.1 L 0.967 0.129 L 0.982 0.162 L 0.991 0.198 L 0.992 0.237 L 0.99 0.253 L 0.949 0.658 L 0.94 0.742 L 0.931 0.806 L 0.917 0.854 L 0.908 0.874 L 0.897 0.891 L 0.875 0.914 L 0.875 0.914 Z",
"SoftBoom": "M 0.733 0.453 L 0.793 0.444 L 0.84 0.439 L 0.887 0.441 L 0.923 0.445 L 0.949 0.451 L 0.974 0.463 L 0.98 0.466 L 0.994 0.48 L 0.999 0.5 L 0.994 0.52 L 0.98 0.535 L 0.974 0.538 L 0.949 0.549 L 0.922 0.555 L 0.887 0.559 L 0.84 0.561 L 0.793 0.556 L 0.733 0.546 L 0.792 0.56 L 0.837 0.574 L 0.88 0.594 L 0.911 0.611 L 0.934 0.627 L 0.952 0.647 L 0.956 0.652 L 0.964 0.671 L 0.961 0.691 L 0.949 0.708 L 0.93 0.716 L 0.923 0.717 L 0.896 0.717 L 0.869 0.713 L 0.835 0.703 L 0.791 0.686 L 0.749 0.664 L 0.698 0.632 L 0.746 0.667 L 0.783 0.698 L 0.815 0.733 L 0.837 0.76 L 0.852 0.783 L 0.861 0.809 L 0.863 0.815 L 0.863 0.836 L 0.853 0.854 L 0.835 0.864 L 0.814 0.864 L 0.808 0.862 L 0.782 0.853 L 0.759 0.838 L 0.732 0.816 L 0.697 0.783 L 0.667 0.747 L 0.632 0.698 L 0.663 0.749 L 0.685 0.791 L 0.702 0.836 L 0.712 0.87 L 0.716 0.897 L 0.715 0.924 L 0.714 0.93 L 0.706 0.949 L 0.69 0.962 L 0.67 0.964 L 0.651 0.957 L 0.646 0.953 L 0.626 0.934 L 0.61 0.911 L 0.593 0.88 L 0.573 0.837 L 0.559 0.792 L 0.546 0.733 L 0.555 0.793 L 0.56 0.84 L 0.558 0.887 L 0.554 0.923 L 0.548 0.949 L 0.536 0.974 L 0.533 0.98 L 0.519 0.994 L 0.499 0.999 L 0.479 0.994 L 0.464 0.98 L 0.461 0.974 L 0.45 0.949 L 0.444 0.922 L 0.44 0.887 L 0.438 0.84 L 0.443 0.793 L 0.453 0.733 L 0.439 0.792 L 0.425 0.837 L 0.405 0.88 L 0.388 0.911 L 0.372 0.934 L 0.352 0.952 L 0.347 0.956 L 0.328 0.964 L 0.308 0.961 L 0.291 0.949 L 0.283 0.93 L 0.282 0.923 L 0.282 0.896 L 0.286 0.869 L 0.296 0.835 L 0.313 0.791 L 0.335 0.749 L 0.367 0.698 L 0.332 0.746 L 0.301 0.783 L 0.266 0.815 L 0.239 0.837 L 0.216 0.852 L 0.19 0.861 L 0.184 0.863 L 0.163 0.863 L 0.145 0.853 L 0.135 0.835 L 0.135 0.814 L 0.137 0.808 L 0.146 0.782 L 0.161 0.759 L 0.183 0.732 L 0.216 0.697 L 0.252 0.667 L 0.301 0.632 L 0.25 0.663 L 0.208 0.685 L 0.163 0.702 L 0.129 0.712 L 0.102 0.716 L 0.075 0.715 L 0.069 0.714 L 0.05 0.706 L 0.037 0.69 L 0.035 0.67 L 0.042 0.651 L 0.046 0.646 L 0.065 0.626 L 0.088 0.61 L 0.119 0.593 L 0.162 0.573 L 0.207 0.559 L 0.266 0.546 L 0.206 0.555 L 0.159 0.56 L 0.112 0.558 L 0.076 0.554 L 0.05 0.548 L 0.025 0.536 L 0.019 0.533 L 0.005 0.519 L 0 0.499 L 0.005 0.479 L 0.019 0.464 L 0.025 0.461 L 0.05 0.45 L 0.077 0.444 L 0.112 0.44 L 0.159 0.438 L 0.206 0.443 L 0.266 0.453 L 0.207 0.439 L 0.162 0.425 L 0.119 0.405 L 0.088 0.388 L 0.065 0.372 L 0.047 0.352 L 0.043 0.347 L 0.035 0.328 L 0.038 0.308 L 0.05 0.291 L 0.069 0.283 L 0.076 0.282 L 0.103 0.282 L 0.13 0.286 L 0.164 0.296 L 0.208 0.313 L 0.25 0.335 L 0.301 0.367 L 0.253 0.332 L 0.216 0.301 L 0.184 0.266 L 0.162 0.239 L 0.147 0.216 L 0.138 0.19 L 0.136 0.184 L 0.136 0.163 L 0.146 0.145 L 0.164 0.135 L 0.185 0.135 L 0.191 0.137 L 0.217 0.146 L 0.24 0.161 L 0.267 0.183 L 0.302 0.216 L 0.332 0.252 L 0.367 0.301 L 0.336 0.25 L 0.314 0.208 L 0.297 0.163 L 0.287 0.129 L 0.283 0.102 L 0.284 0.075 L 0.285 0.069 L 0.293 0.05 L 0.309 0.037 L 0.329 0.035 L 0.348 0.042 L 0.353 0.046 L 0.373 0.065 L 0.389 0.088 L 0.406 0.119 L 0.426 0.162 L 0.44 0.207 L 0.453 0.266 L 0.444 0.206 L 0.439 0.159 L 0.441 0.112 L 0.445 0.076 L 0.451 0.05 L 0.463 0.025 L 0.466 0.019 L 0.48 0.005 L 0.5 0 L 0.52 0.005 L 0.535 0.019 L 0.538 0.025 L 0.549 0.05 L 0.555 0.077 L 0.559 0.112 L 0.561 0.159 L 0.556 0.206 L 0.546 0.266 L 0.56 0.207 L 0.574 0.162 L 0.594 0.119 L 0.611 0.088 L 0.627 0.065 L 0.647 0.047 L 0.652 0.043 L 0.671 0.035 L 0.691 0.038 L 0.708 0.05 L 0.716 0.069 L 0.717 0.076 L 0.717 0.103 L 0.713 0.13 L 0.703 0.164 L 0.686 0.208 L 0.664 0.25 L 0.632 0.301 L 0.667 0.253 L 0.698 0.216 L 0.733 0.184 L 0.76 0.162 L 0.783 0.147 L 0.809 0.138 L 0.815 0.136 L 0.836 0.136 L 0.854 0.146 L 0.864 0.164 L 0.864 0.185 L 0.862 0.191 L 0.853 0.217 L 0.838 0.24 L 0.816 0.267 L 0.783 0.302 L 0.747 0.332 L 0.698 0.367 L 0.749 0.336 L 0.791 0.314 L 0.836 0.297 L 0.87 0.287 L 0.897 0.283 L 0.924 0.284 L 0.93 0.285 L 0.949 0.293 L 0.962 0.309 L 0.964 0.329 L 0.957 0.348 L 0.953 0.353 L 0.934 0.373 L 0.911 0.389 L 0.88 0.406 L 0.837 0.426 L 0.792 0.44 L 0.733 0.453 L 0.733 0.453 Z",
"SoftBurst": "M 0.186 0.272 L 0.194 0.256 L 0.196 0.238 L 0.189 0.148 L 0.19 0.134 L 0.194 0.121 L 0.201 0.111 L 0.21 0.102 L 0.221 0.096 L 0.234 0.092 L 0.247 0.092 L 0.26 0.096 L 0.344 0.13 L 0.362 0.134 L 0.38 0.131 L 0.396 0.123 L 0.408 0.109 L 0.455 0.032 L 0.464 0.022 L 0.474 0.014 L 0.486 0.009 L 0.499 0.008 L 0.512 0.009 L 0.524 0.014 L 0.534 0.021 L 0.543 0.032 L 0.591 0.109 L 0.603 0.123 L 0.619 0.131 L 0.637 0.134 L 0.655 0.13 L 0.738 0.095 L 0.751 0.092 L 0.765 0.092 L 0.777 0.095 L 0.788 0.101 L 0.798 0.11 L 0.805 0.121 L 0.809 0.133 L 0.81 0.147 L 0.803 0.237 L 0.805 0.256 L 0.813 0.272 L 0.826 0.284 L 0.842 0.292 L 0.93 0.313 L 0.943 0.318 L 0.954 0.326 L 0.962 0.336 L 0.967 0.347 L 0.97 0.36 L 0.969 0.372 L 0.965 0.385 L 0.957 0.397 L 0.899 0.466 L 0.89 0.482 L 0.887 0.499 L 0.89 0.517 L 0.899 0.533 L 0.957 0.602 L 0.965 0.613 L 0.969 0.626 L 0.97 0.639 L 0.967 0.651 L 0.962 0.663 L 0.954 0.673 L 0.943 0.68 L 0.93 0.685 L 0.842 0.707 L 0.826 0.715 L 0.813 0.727 L 0.805 0.743 L 0.803 0.761 L 0.81 0.851 L 0.809 0.865 L 0.805 0.878 L 0.798 0.888 L 0.789 0.897 L 0.778 0.903 L 0.765 0.907 L 0.752 0.907 L 0.739 0.903 L 0.655 0.869 L 0.637 0.865 L 0.619 0.868 L 0.603 0.876 L 0.591 0.89 L 0.544 0.967 L 0.535 0.977 L 0.525 0.985 L 0.513 0.99 L 0.5 0.991 L 0.487 0.99 L 0.475 0.985 L 0.465 0.978 L 0.456 0.967 L 0.408 0.89 L 0.396 0.876 L 0.38 0.868 L 0.362 0.865 L 0.344 0.869 L 0.261 0.904 L 0.248 0.907 L 0.234 0.907 L 0.222 0.904 L 0.211 0.898 L 0.201 0.889 L 0.194 0.878 L 0.19 0.866 L 0.189 0.852 L 0.196 0.762 L 0.194 0.743 L 0.186 0.727 L 0.173 0.715 L 0.157 0.707 L 0.069 0.686 L 0.056 0.681 L 0.045 0.673 L 0.037 0.663 L 0.032 0.652 L 0.029 0.639 L 0.03 0.627 L 0.034 0.614 L 0.042 0.602 L 0.1 0.533 L 0.109 0.517 L 0.112 0.5 L 0.109 0.482 L 0.1 0.466 L 0.042 0.397 L 0.034 0.386 L 0.03 0.373 L 0.029 0.36 L 0.032 0.348 L 0.037 0.336 L 0.045 0.326 L 0.056 0.319 L 0.069 0.314 L 0.157 0.292 L 0.173 0.284 L 0.186 0.272 L 0.186 0.272 Z",
"Square": "M 0.912 0.912 L 0.867 0.948 L 0.816 0.976 L 0.76 0.993 L 0.73 0.998 L 0.7 1 L 0.3 1 L 0.269 0.998 L 0.239 0.993 L 0.183 0.976 L 0.132 0.948 L 0.087 0.912 L 0.051 0.867 L 0.023 0.816 L 0.006 0.76 L 0.001 0.73 L 0 0.7 L 0 0.3 L 0.001 0.269 L 0.006 0.239 L 0.023 0.183 L 0.051 0.132 L 0.087 0.087 L 0.132 0.051 L 0.183 0.023 L 0.239 0.006 L 0.269 0.001 L 0.3 0 L 0.7 0 L 0.73 0.001 L 0.76 0.006 L 0.816 0.023 L 0.867 0.051 L 0.912 0.087 L 0.948 0.132 L 0.976 0.183 L 0.993 0.239 L 0.998 0.269 L 1 0.3 L 1 0.7 L 0.998 0.73 L 0.993 0.76 L 0.976 0.816 L 0.948 0.867 L 0.912 0.912 L 0.912 0.912 Z",
"Sunny": "M 0.996 0.5 L 0.992 0.526 L 0.978 0.55 L 0.902 0.639 L 0.889 0.66 L 0.884 0.683 L 0.874 0.8 L 0.867 0.827 L 0.852 0.849 L 0.83 0.864 L 0.803 0.871 L 0.686 0.881 L 0.663 0.886 L 0.642 0.899 L 0.553 0.975 L 0.529 0.989 L 0.503 0.993 L 0.476 0.989 L 0.452 0.975 L 0.363 0.899 L 0.342 0.886 L 0.319 0.881 L 0.202 0.871 L 0.175 0.864 L 0.153 0.849 L 0.138 0.827 L 0.131 0.8 L 0.122 0.683 L 0.116 0.66 L 0.103 0.639 L 0.027 0.55 L 0.013 0.526 L 0.009 0.499 L 0.013 0.473 L 0.027 0.449 L 0.103 0.36 L 0.116 0.339 L 0.122 0.316 L 0.131 0.199 L 0.138 0.172 L 0.153 0.15 L 0.175 0.135 L 0.202 0.128 L 0.319 0.118 L 0.342 0.113 L 0.363 0.1 L 0.452 0.024 L 0.476 0.01 L 0.503 0.006 L 0.529 0.01 L 0.553 0.024 L 0.642 0.1 L 0.663 0.113 L 0.686 0.118 L 0.803 0.128 L 0.83 0.135 L 0.852 0.15 L 0.867 0.172 L 0.874 0.199 L 0.884 0.316 L 0.889 0.339 L 0.902 0.36 L 0.978 0.449 L 0.992 0.473 L 0.996 0.5 L 0.996 0.5 Z",
"Triangle": "M 0.5 0.077 L 0.532 0.081 L 0.563 0.094 L 0.59 0.114 L 0.612 0.142 L 0.95 0.727 L 0.963 0.76 L 0.967 0.794 L 0.962 0.827 L 0.95 0.857 L 0.93 0.883 L 0.904 0.903 L 0.873 0.917 L 0.837 0.922 L 0.162 0.922 L 0.126 0.917 L 0.095 0.903 L 0.069 0.883 L 0.049 0.857 L 0.037 0.827 L 0.032 0.794 L 0.036 0.76 L 0.049 0.727 L 0.387 0.142 L 0.409 0.114 L 0.436 0.094 L 0.467 0.081 L 0.5 0.077 L 0.5 0.077 Z",
"VerySunny": "M 0.5 0.993 L 0.479 0.99 L 0.46 0.983 L 0.443 0.97 L 0.429 0.953 L 0.393 0.893 L 0.376 0.873 L 0.353 0.859 L 0.328 0.853 L 0.302 0.855 L 0.234 0.872 L 0.212 0.875 L 0.191 0.871 L 0.172 0.863 L 0.155 0.85 L 0.143 0.834 L 0.134 0.815 L 0.131 0.794 L 0.134 0.772 L 0.151 0.704 L 0.153 0.678 L 0.147 0.652 L 0.133 0.63 L 0.113 0.613 L 0.053 0.577 L 0.036 0.563 L 0.023 0.546 L 0.015 0.527 L 0.013 0.506 L 0.015 0.486 L 0.023 0.466 L 0.036 0.449 L 0.053 0.435 L 0.113 0.399 L 0.133 0.382 L 0.147 0.36 L 0.153 0.335 L 0.151 0.308 L 0.134 0.241 L 0.131 0.218 L 0.134 0.197 L 0.143 0.178 L 0.155 0.162 L 0.172 0.149 L 0.191 0.141 L 0.212 0.138 L 0.234 0.14 L 0.302 0.157 L 0.328 0.16 L 0.353 0.153 L 0.375 0.14 L 0.393 0.12 L 0.428 0.06 L 0.442 0.042 L 0.46 0.03 L 0.479 0.022 L 0.499 0.02 L 0.52 0.022 L 0.539 0.03 L 0.556 0.042 L 0.57 0.06 L 0.606 0.12 L 0.623 0.14 L 0.646 0.153 L 0.671 0.16 L 0.697 0.157 L 0.765 0.14 L 0.787 0.138 L 0.808 0.141 L 0.827 0.149 L 0.844 0.162 L 0.856 0.178 L 0.865 0.197 L 0.868 0.218 L 0.865 0.241 L 0.848 0.308 L 0.846 0.335 L 0.852 0.36 L 0.866 0.382 L 0.886 0.399 L 0.946 0.435 L 0.963 0.449 L 0.976 0.466 L 0.984 0.486 L 0.986 0.506 L 0.984 0.527 L 0.976 0.546 L 0.963 0.563 L 0.946 0.577 L 0.886 0.613 L 0.866 0.63 L 0.852 0.652 L 0.846 0.678 L 0.848 0.704 L 0.865 0.772 L 0.868 0.794 L 0.865 0.815 L 0.856 0.834 L 0.844 0.85 L 0.827 0.863 L 0.808 0.871 L 0.787 0.875 L 0.765 0.872 L 0.697 0.855 L 0.671 0.853 L 0.646 0.859 L 0.624 0.872 L 0.606 0.893 L 0.571 0.953 L 0.557 0.97 L 0.539 0.983 L 0.52 0.99 L 0.5 0.993 L 0.5 0.993 Z",
};
+130
View File
@@ -0,0 +1,130 @@
/** Material expressive shape SVG paths — generated from Compose MaterialShapes. */
export { MATERIAL_SHAPE_PATHS } from "./materialShapes.generated";
import { MATERIAL_SHAPE_PATHS } from "./materialShapes.generated";
export type MaterialShapeName = keyof typeof MATERIAL_SHAPE_PATHS;
export function getMaterialShapePath(name: string): string {
return MATERIAL_SHAPE_PATHS[name] ?? MATERIAL_SHAPE_PATHS.Circle;
}
interface PathBounds {
minX: number;
minY: number;
maxX: number;
maxY: number;
}
export interface PathUnitSquareFit {
transform: string;
}
const pathFitCache = new Map<string, PathUnitSquareFit>();
/**
* Parses M/L/Z path commands and returns axis-aligned bounds of all vertices.
* Generated Material shape paths use only these commands.
*/
function computePathBounds(pathD: string): PathBounds {
const tokens = pathD.trim().match(/[MLZmlz]|[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g);
if (!tokens?.length) {
return { minX: 0, minY: 0, maxX: 1, maxY: 1 };
}
let minX = Infinity;
let minY = Infinity;
let maxX = -Infinity;
let maxY = -Infinity;
let curX = 0;
let curY = 0;
let startX = 0;
let startY = 0;
let cmd = "";
let i = 0;
const extend = (x: number, y: number) => {
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
curX = x;
curY = y;
};
while (i < tokens.length) {
const token = tokens[i];
if (/^[A-Za-z]$/.test(token)) {
cmd = token;
i++;
if (cmd === "Z" || cmd === "z") {
extend(startX, startY);
}
continue;
}
const x = Number(tokens[i++]);
const y = Number(tokens[i++]);
let absX = x;
let absY = y;
switch (cmd) {
case "M":
absX = x;
absY = y;
startX = absX;
startY = absY;
cmd = "L";
break;
case "m":
absX = curX + x;
absY = curY + y;
startX = absX;
startY = absY;
cmd = "l";
break;
case "L":
absX = x;
absY = y;
break;
case "l":
absX = curX + x;
absY = curY + y;
break;
default:
continue;
}
extend(absX, absY);
}
return { minX, minY, maxX, maxY };
}
/**
* Maps a normalized Material shape path to fill viewBox `0 0 1 1` edge-to-edge.
*/
export function fitPathToUnitSquare(pathD: string): PathUnitSquareFit {
const cached = pathFitCache.get(pathD);
if (cached) {
return cached;
}
const { minX, minY, maxX, maxY } = computePathBounds(pathD);
const width = maxX - minX;
const height = maxY - minY;
if (width <= 0 || height <= 0) {
const fallback = { transform: "" };
pathFitCache.set(pathD, fallback);
return fallback;
}
const sx = 1 / width;
const sy = 1 / height;
const fit: PathUnitSquareFit = {
transform: `scale(${sx}, ${sy}) translate(${-minX}, ${-minY})`,
};
pathFitCache.set(pathD, fit);
return fit;
}
+7
View File
@@ -39,6 +39,8 @@ export interface Rect extends Size2D {
// App types
export type VerificationStatus = "verified" | "warning" | "blocked" | "none";
/**
* Chat message structure
* @interface Message
@@ -70,6 +72,7 @@ export interface Message {
timestamp: string;
profile_picture?: string;
verified?: boolean;
verification_status?: VerificationStatus;
reply_to?: Message;
files?: Attachment[];
reactions?: Reaction[];
@@ -118,6 +121,7 @@ export interface User {
bio?: string;
profile_picture: string;
verified?: boolean;
verification_status?: VerificationStatus;
suspended?: boolean;
suspension_reason?: string | null;
deleted?: boolean;
@@ -144,6 +148,9 @@ export interface UserProfile {
last_seen: string;
created_at: string;
verified?: boolean;
verification_status?: VerificationStatus;
deleted?: boolean;
suspended?: boolean;
}
// ----------
+51
View File
@@ -0,0 +1,51 @@
import { parseApiTimestamp } from "@/utils/utils";
const DELETED_USERNAME_PREFIX = "#deleted";
export function isDeletedUser(user: { deleted?: boolean }): boolean {
return Boolean(user.deleted);
}
export function isSuspendedUser(user: { suspended?: boolean; deleted?: boolean }): boolean {
return Boolean(user.suspended) && !user.deleted;
}
export function isDeletedAccountUsername(username: string | undefined | null): boolean {
return Boolean(username?.startsWith(DELETED_USERNAME_PREFIX));
}
export function isDeletedPeer(user: {
id?: number;
deleted?: boolean;
username?: string | null;
}): boolean {
return isDeletedUser(user) || isDeletedAccountUsername(user.username);
}
export const DELETED_ACCOUNT_LABEL = "Deleted account";
export function deletedUserLabel(): string {
return DELETED_ACCOUNT_LABEL;
}
export function displayNameForUser(user: {
id?: number;
display_name?: string | null;
username?: string | null;
deleted?: boolean;
}): string {
if (isDeletedPeer(user)) {
return deletedUserLabel();
}
return user.display_name?.trim() || user.username?.trim() || "";
}
export function isEpochLastSeen(lastSeen: string | undefined | null): boolean {
if (!lastSeen) return false;
const time = parseApiTimestamp(lastSeen).getTime();
return !Number.isNaN(time) && time <= 0;
}
export function formatDeletedUserLastSeen(): string {
return "был(а) давно";
}
+3
View File
@@ -9,6 +9,7 @@ import api from "@/core/api";
import { AuthTextField, type AuthTextFieldHandle } from "./AuthTextField";
import type { Alert, AlertType } from "./Auth";
import { AuthHeader, AlertsContainer } from "./Auth";
import { LegalInlineLinks } from "@/core/legal/LegalInlineLinks";
import styles from "./auth.module.scss";
const registerFieldVariants: Variants = {
@@ -235,6 +236,8 @@ export function RegisterForm({ onSwitchMode }: RegisterFormProps) {
</MaterialButton>
</motion.div>
</div>
<LegalInlineLinks />
</motion.form>
</div>
@@ -177,6 +177,21 @@
object-fit: cover;
border: 2px solid $color-dark-outline;
}
.deletedUserAvatar {
width: 100%;
height: 100%;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid $color-dark-outline;
.deletedUserAvatarIcon {
font-size: 24px;
color: white;
}
}
}
.messageInner {
@@ -0,0 +1,15 @@
@use "@/css/material" as *;
.deletedUserAvatar {
width: 100%;
height: 100%;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid $color-dark-outline;
}
.deletedUserAvatarIcon {
color: white;
}
@@ -178,3 +178,17 @@
line-clamp: 2;
-webkit-box-orient: vertical;
}
.deletedUserAvatar {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
.deletedUserAvatarIcon {
font-size: 24px;
color: white;
}
}
@@ -28,6 +28,23 @@
border: 3px solid $color-dark-outline;
}
.deletedAvatar {
width: 120px;
height: 120px;
border-radius: 60px;
display: flex;
align-items: center;
justify-content: center;
border: 3px solid $color-dark-outline;
}
.deletedAvatarIcon {
width: 64px;
height: 64px;
font-size: 64px;
color: white;
}
.profilePictureEditOverlay {
position: absolute;
top: 0;
@@ -138,3 +138,9 @@
}
}
.deleteChatBar {
display: flex;
justify-content: center;
padding: 12px 16px 16px;
}
+39 -21
View File
@@ -14,6 +14,9 @@ import { OnlineStatus } from "./right/OnlineStatus";
import { Input } from "@/core/components/Input";
import { StyledDialog } from "@/core/components/StyledDialog";
import { MaterialButton, MaterialFab, MaterialIcon } from "@/utils/material";
import { displayNameForUser, isDeletedPeer } from "@/core/userDisplay";
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
import { parseApiTimestamp } from "@/utils/utils";
import styles from "@/pages/chat/css/profile-dialog.module.scss";
interface SectionProps {
@@ -102,9 +105,12 @@ export function ProfileDialog() {
if (userProfile) {
freshData = {
...userProfile,
userId: userProfile.id, // Preserve the userId field
userId: userProfile.id,
memberSince: userProfile.created_at,
isOwnProfile: profileData.isOwnProfile
isOwnProfile: profileData.isOwnProfile,
deleted: userProfile.deleted,
verification_status: userProfile.verification_status,
suspended: userProfile.suspended,
};
}
}
@@ -329,7 +335,7 @@ export function ProfileDialog() {
}
function formatDate(dateString: string) {
return new Date(dateString).toLocaleDateString("ru-RU", {
return parseApiTimestamp(dateString).toLocaleDateString("ru-RU", {
year: "numeric",
month: "long",
day: "numeric"
@@ -410,6 +416,8 @@ export function ProfileDialog() {
if (!currentData) return null;
const isDeletedProfile = isDeletedPeer(currentData);
return (
<StyledDialog
open={isOpen}
@@ -431,16 +439,24 @@ export function ProfileDialog() {
}
>
<div className={styles.profilePictureSection}>
<img
className={styles.profilePicture}
src={currentData.profilePicture || defaultAvatar}
alt="Profile Picture"
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
{isDeletedProfile ? (
<DeletedUserAvatar
userId={currentData.userId!}
className={styles.deletedAvatar}
iconClassName={styles.deletedAvatarIcon}
/>
) : (
<img
className={styles.profilePicture}
src={currentData.profilePicture || defaultAvatar}
alt="Profile Picture"
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
)}
{currentData.isOwnProfile && (
{currentData.isOwnProfile && !isDeletedProfile && (
<div
className={styles.profilePictureEditOverlay}
onClick={handleProfilePictureClick}
@@ -456,29 +472,31 @@ export function ProfileDialog() {
autoresizing={true}
className={styles.usernameInput}
type="text"
value={currentData.display_name}
value={isDeletedProfile ? displayNameForUser(currentData) : currentData.display_name}
onChange={handleDisplayNameChange}
readOnly={!currentData.isOwnProfile}
placeholder="Имя" />
<StatusBadge
verified={currentData.verified || false}
userId={currentData.userId}
size="large" />
{!isDeletedProfile && (
<StatusBadge
verificationStatus={currentData.verification_status}
verified={currentData.verified || false}
size="large" />
)}
</div>
{errors.display_name && (
<div className={styles.errorMessage}>{errors.display_name}</div>
)}
</div>
{(currentData?.userId || currentData?.isOwnProfile) && !currentData.deleted && (
{(currentData?.userId || currentData?.isOwnProfile) && !isDeletedProfile && (
<div className={styles.onlineStatusSection}>
<OnlineStatus userId={currentData.userId || user.currentUser!.id} />
</div>
)}
{/* Admin Actions Section - Hide for deleted users */}
{!currentData.isOwnProfile && user.currentUser?.id === 1 && !currentData.deleted && (
{!currentData.isOwnProfile && user.currentUser?.id === 1 && !isDeletedProfile && (
<div className={styles.adminActionsSection}>
<h3 className={styles.adminActionsHeader}>Admin Actions</h3>
<div className={styles.adminButtons}>
@@ -510,7 +528,7 @@ export function ProfileDialog() {
)}
{/* Verify button for non-admin owner */}
{!currentData.isOwnProfile && currentData.userId && user.currentUser?.id !== 1 && (
{!currentData.isOwnProfile && currentData.userId && user.currentUser?.id !== 1 && !isDeletedProfile && (
<div className={styles.verifySection}>
<VerifyButton
userId={currentData.userId}
@@ -523,7 +541,7 @@ export function ProfileDialog() {
)}
{/* Hide profile sections for deleted users */}
{!currentData.deleted && (
{!isDeletedProfile && (
<div className={styles.profileSections}>
<Section
type="username"
@@ -4,12 +4,14 @@ import { useChatStore } from "@/state/chat";
import { useDM, type DMUser } from "@/pages/chat/hooks/useDM";
import api from "@/core/api";
import { StatusBadge } from "@/core/components/StatusBadge";
import type { Message } from "@/core/types";
import type { Message, VerificationStatus } from "@/core/types";
import { websocket } from "@/core/websocket";
import { onlineStatusManager } from "@/core/onlineStatusManager";
import { OnlineIndicator } from "@/pages/chat/ui/right/OnlineIndicator";
import defaultAvatar from "@/images/default-avatar.png";
import { MaterialBadge, MaterialCircularProgress, MaterialList, MaterialListItem } from "@/utils/material";
import { MaterialBadge, MaterialCircularProgress, MaterialIcon, MaterialList, MaterialListItem } from "@/utils/material";
import { displayNameForUser, isDeletedPeer } from "@/core/userDisplay";
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
import styles from "@/pages/chat/css/left-panel.module.scss";
interface PublicChat {
@@ -31,6 +33,7 @@ interface DMConversation {
unreadCount: number;
publicKey?: string | null;
verified?: boolean;
verification_status?: VerificationStatus;
}
type ChatItem = PublicChat | DMConversation;
@@ -73,6 +76,7 @@ export function UnifiedChatsList() {
...dmUsers.map((user: DMUser) => ({
...user,
userId: user.id,
display_name: displayNameForUser({ ...user, id: user.id }),
type: "dm" as const
})),
{
@@ -180,6 +184,19 @@ export function UnifiedChatsList() {
return <MaterialCircularProgress />;
}
if (user.isSuspended) {
return (
<MaterialList className={styles.unifiedChatsList}>
<MaterialListItem
headline="Аккаунт заблокирован"
style={{ cursor: "pointer" }}
>
<MaterialIcon name="block--filled" slot="icon" />
</MaterialListItem>
</MaterialList>
);
}
return (
<MaterialList className={styles.unifiedChatsList}>
{allChats.map((chat) => {
@@ -212,40 +229,53 @@ export function UnifiedChatsList() {
);
}
const isDeletedDm = isDeletedPeer(chat);
const displayName = displayNameForUser({ ...chat, id: chat.id });
return (
<MaterialListItem
key={`dm-${chat.id}`}
headline={chat.display_name}
headline={displayName}
onClick={() => handleDMClick(chat)}
style={{ cursor: "pointer" }}
>
<div slot="headline" className="dm-list-headline">
{chat.display_name}
<StatusBadge
verified={chat.verified || false}
userId={chat.userId}
size="small"
/>
{displayName}
{!isDeletedDm && (
<StatusBadge
verificationStatus={chat.verification_status}
verified={chat.verified || false}
size="small"
/>
)}
</div>
<span slot="description" className={styles.listDescription}>
{chat.lastMessage || "Нет сообщений"}
</span>
<div slot="icon" style={{ position: "relative", width: "40px", height: "40px", display: "inline-block" }}>
<img
src={chat.profile_picture || defaultAvatar}
alt={chat.display_name}
style={{
width: "40px",
height: "40px",
borderRadius: "50%",
objectFit: "cover",
display: "block"
}}
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
<OnlineIndicator userId={chat.id} />
{isDeletedDm ? (
<DeletedUserAvatar
userId={chat.id}
className={styles.deletedUserAvatar}
iconClassName={styles.deletedUserAvatarIcon}
/>
) : (
<img
src={chat.profile_picture || defaultAvatar}
alt={displayName}
style={{
width: "40px",
height: "40px",
borderRadius: "50%",
objectFit: "cover",
display: "block"
}}
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
)}
{!isDeletedDm && <OnlineIndicator userId={chat.id} />}
</div>
{chat.unreadCount > 0 && (
<MaterialBadge slot="end-icon">
@@ -215,9 +215,9 @@ export function UsernameSearch({ containerRef, headerRef, bottomAppBarRef }: Use
<div className={styles.searchResultBody}>
<div className={styles.searchResultHeadline}>
{searchUser.username}
<StatusBadge
<StatusBadge
verificationStatus={searchUser.verification_status}
verified={searchUser.verified || false}
userId={searchUser.id}
size="small"
/>
</div>
@@ -17,10 +17,10 @@ export function AccountPanel({ onClose }: AccountPanelProps) {
try {
await confirm({
headline: "Delete Account?",
description: "This will permanently delete your account and all your data. This action cannot be undone.",
confirmText: "Delete",
cancelText: "Cancel"
headline: "Удалить аккаунт?",
description: "Профиль будет удалён без возможности восстановления, логин освободится. Отправленные сообщения могут остаться в чатах.",
confirmText: "Удалить",
cancelText: "Отмена"
});
await api.user.auth.deleteAccount(authToken);
@@ -5,6 +5,7 @@ import { useUserStore } from "@/state/user";
import api from "@/core/api";
import type { DeviceInfo } from "@/core/api/user/devices";
import { confirm } from "mdui/functions/confirm";
import { parseApiTimestamp } from "@/utils/utils";
import styles from "@/pages/chat/css/settings-dialog.module.scss";
export function DevicesPanel() {
@@ -92,7 +93,7 @@ export function DevicesPanel() {
function formatLastSeen(dateStr: string | undefined): string {
if (!dateStr) return "Never";
const date = new Date(dateStr);
const date = parseApiTimestamp(dateStr);
const now = new Date();
const diffMs = now.getTime() - date.getTime();
const diffMins = Math.floor(diffMs / 60000);
+27 -13
View File
@@ -14,6 +14,8 @@ import { useImmer } from "use-immer";
import { createPortal } from "react-dom";
import { parseProfileLink } from "@/core/profileLinks";
import { MaterialCircularProgress, MaterialIconButton, MaterialList, MaterialListItem } from "@/utils/material";
import { displayNameForUser, isDeletedPeer } from "@/core/userDisplay";
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
import styles from "@/pages/chat/css/Message.module.scss";
import replyPreviewStyles from "@/pages/chat/css/reply-preview.module.scss";
@@ -517,6 +519,8 @@ export function Message({ message, isAuthor, onContextMenu, onReactionClick, isD
return messageText.length > 0 && emojiRegex.test(messageText) && messageText.length <= 4; // Most emojis are 1-4 characters
}, [messageText]);
const isDeletedSender = isDeletedPeer({ id: message.user_id, username: message.username });
return (
<>
<div
@@ -526,13 +530,21 @@ export function Message({ message, isAuthor, onContextMenu, onReactionClick, isD
>
{!isAuthor && !isDm && (
<div className={styles.messageProfilePic} onClick={handleProfileClick}>
<img
src={message.profile_picture || defaultAvatar}
alt={message.username}
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
{isDeletedSender ? (
<DeletedUserAvatar
userId={message.user_id}
className={styles.deletedUserAvatar}
iconClassName={styles.deletedUserAvatarIcon}
/>
) : (
<img
src={message.profile_picture || defaultAvatar}
alt={message.username}
onError={(e) => {
e.target.src = defaultAvatar;
}}
/>
)}
</div>
)}
@@ -541,12 +553,14 @@ export function Message({ message, isAuthor, onContextMenu, onReactionClick, isD
<div
className={styles.messageUsername}
onClick={handleProfileClick}>
{message.username}
<StatusBadge
verified={message.verified || false}
userId={message.user_id}
size="small"
/>
{displayNameForUser({ id: message.user_id, username: message.username })}
{!isDeletedSender && (
<StatusBadge
verificationStatus={message.verification_status}
verified={message.verified || false}
size="small"
/>
)}
</div>
)}
@@ -17,7 +17,7 @@ import { TypingIndicator } from "./TypingIndicator";
import { OnlineStatus } from "./OnlineStatus";
import { typingManager } from "@/core/typingManager";
import { PublicChatPanel } from "./panels/PublicChatPanel";
import { MaterialIcon, MaterialIconButton } from "@/utils/material";
import { MaterialButton, MaterialIcon, MaterialIconButton } from "@/utils/material";
import styles from "@/pages/chat/css/layout.module.scss";
import rightPanelStyles from "@/pages/chat/css/right-panel.module.scss";
@@ -52,7 +52,7 @@ function ChatHeaderText({ panel }: { panel: MessagePanel | null }) {
}
export function MessagePanelRenderer({ panel }: MessagePanelRendererProps) {
const { applyPendingPanel, isSwitching, pendingPanel, activePanel, setIsSwitching } = useChatStore();
const { applyPendingPanel, isSwitching, pendingPanel, activePanel, setIsSwitching, setActivePanel } = useChatStore();
const { setProfileDialog } = useProfileStore();
const messagePanelRef = useRef<HTMLDivElement>(null);
const [panelState, setPanelState] = useState<MessagePanelState | null>(null);
@@ -71,8 +71,38 @@ export function MessagePanelRenderer({ panel }: MessagePanelRendererProps) {
// Drag & drop
const [isDragging, setIsDragging] = useState(false);
const dragCounterRef = useRef(0);
const [peerDeleted, setPeerDeleted] = useState(false);
const addFilesRef = useRef<null | ((files: File[]) => void)>(null);
useEffect(() => {
let cancelled = false;
setPeerDeleted(false);
if (!panel?.isDm()) return;
const dmPanel = panel as DMPanel;
dmPanel.getProfile().then((profile) => {
if (!cancelled) {
setPeerDeleted(Boolean(profile?.deleted));
}
});
return () => {
cancelled = true;
};
}, [panel]);
async function handleDeleteDeletedPeerChat() {
if (!panel?.isDm()) return;
const dmPanel = panel as DMPanel;
const messages = [...dmPanel.getMessages()].filter((message) => message.id > 0);
for (const message of messages) {
await dmPanel.handleDeleteMessage(message.id);
}
dmPanel.clearMessages();
setActivePanel(null);
}
useEffect(() => {
if (!panel || !panelState) return;
@@ -307,7 +337,7 @@ export function MessagePanelRenderer({ panel }: MessagePanelRendererProps) {
<h4 id="chat-name">{panelState?.title || "Выбор чата"}</h4>
<ChatHeaderText panel={panel} />
</div>
{panel?.isDm() && (
{panel?.isDm() && !peerDeleted && (
<MaterialIconButton onClick={handleCallClick} icon="call--filled" />
)}
</div>
@@ -376,7 +406,17 @@ export function MessagePanelRenderer({ panel }: MessagePanelRendererProps) {
</div>
)}
{panel && (
{panel && (peerDeleted && panel.isDm() ? (
<div className={rightPanelStyles.deleteChatBar}>
<MaterialButton
variant="filled"
color="error"
onClick={handleDeleteDeletedPeerChat}
>
Удалить чат
</MaterialButton>
</div>
) : (
<ChatInputWrapper
onSendMessage={(text, files) => {
panel.handleSendMessage(text, replyTo?.id, files);
@@ -433,7 +473,7 @@ export function MessagePanelRenderer({ panel }: MessagePanelRendererProps) {
}
}}
/>
)}
))}
</div>
{panel && (
@@ -7,6 +7,8 @@
import { usePresenceStore } from "@/state/presence";
import { useUserStore } from "@/state/user";
import { formatDeletedUserLastSeen, isEpochLastSeen } from "@/core/userDisplay";
import { parseApiTimestamp } from "@/utils/utils";
import styles from "@/pages/chat/css/TypingIndicators.module.scss";
interface OnlineStatusProps {
@@ -20,7 +22,10 @@ export function OnlineStatus({ userId, showLastSeen = false }: OnlineStatusProps
const status = userId === user.currentUser?.id ? { online: true, lastSeen: new Date().toISOString() } : onlineStatuses.get(userId);
function formatLastSeen(lastSeen: string): string {
const date = new Date(lastSeen);
if (isEpochLastSeen(lastSeen)) {
return formatDeletedUserLastSeen();
}
const date = parseApiTimestamp(lastSeen);
const now = new Date();
const diffMs = now.getTime() - date.getTime();
const diffMins = Math.floor(diffMs / (1000 * 60));
@@ -400,6 +400,7 @@ export class DMPanel extends MessagePanel {
bio: userProfile.bio,
memberSince: userProfile.created_at,
online: userProfile.online,
deleted: userProfile.deleted,
isOwnProfile: false
};
} catch (error) {
@@ -1,4 +1,5 @@
import { MaterialIcon } from "@/utils/material";
import { Link } from "react-router-dom";
import styles from "./download-app.module.scss";
export default function DownloadAppPage() {
@@ -20,6 +21,11 @@ export default function DownloadAppPage() {
iOS
</a>
</div>
<p>
<Link to="/privacy">Политика конфиденциальности</Link>
{" · "}
<Link to="/terms">Пользовательское соглашение</Link>
</p>
<p>
<a href="https://t.me/denis0001-dev">Написать в поддержку</a>
</p>
+10
View File
@@ -65,6 +65,16 @@ export function HomeFooter({ onScrollToDownload }: HomeFooterProps) {
Лицензия
</a>
</div>
<div className={styles.footerSection}>
<Link to="/privacy" className={styles.footerLink}>
<MaterialIcon name="shield" className={styles.footerLinkIcon} />
Политика конфиденциальности
</Link>
<Link to="/terms" className={styles.footerLink}>
<MaterialIcon name="description" className={styles.footerLinkIcon} />
Пользовательское соглашение
</Link>
</div>
<div className={styles.footerSection}>
<a
href="https://t.me/fromchat_ch"
+6
View File
@@ -0,0 +1,6 @@
import { LegalMarkdownPage } from "@/core/legal/LegalMarkdownPage";
const PrivacyPage = () => <LegalMarkdownPage kind="privacy" />;
const TermsPage = () => <LegalMarkdownPage kind="terms" />;
export { PrivacyPage, TermsPage };
+2 -1
View File
@@ -1,4 +1,4 @@
import type { Message, User } from "@/core/types";
import type { Message, User, VerificationStatus } from "@/core/types";
import { MessagePanel } from "@/pages/chat/ui/right/panels/MessagePanel";
import { PublicChatPanel } from "@/pages/chat/ui/right/panels/PublicChatPanel";
import { DMPanel } from "@/pages/chat/ui/right/panels/DMPanel";
@@ -17,6 +17,7 @@ export interface ProfileDialogData {
online?: boolean;
isOwnProfile: boolean;
verified?: boolean;
verification_status?: VerificationStatus;
suspended?: boolean;
suspension_reason?: string | null;
deleted?: boolean;
+14 -5
View File
@@ -11,7 +11,7 @@ import type { UserState } from "./types";
interface UserStore {
user: UserState;
setUser: (token: string, user: User) => void;
logout: () => void;
logout: () => Promise<void>;
restoreFromStorage: () => Promise<void>;
setSuspended: (reason: string) => void;
}
@@ -46,12 +46,21 @@ export const useUserStore = create<UserStore>((set) => ({
// Ping will be sent automatically on WebSocket reconnect
// No need to send here to avoid duplicate pings
},
logout: () => {
logout: async () => {
const token = useUserStore.getState().user.authToken;
if (token) {
try {
await api.user.auth.logout(token);
} catch (error) {
console.error("Server logout failed:", error);
}
}
try {
localStorage.removeItem('authToken');
localStorage.removeItem('currentUser');
localStorage.removeItem("authToken");
localStorage.removeItem("currentUser");
} catch (error) {
console.error('Failed to clear localStorage:', error);
console.error("Failed to clear localStorage:", error);
}
onlineStatusManager.setAuthToken(null);
+24 -8
View File
@@ -6,19 +6,35 @@
*/
/**
* Formats a timestamp string to HH:MM format
* Parses API timestamps into a Date in the user's local timezone.
* Zone-less ISO strings from the server are treated as UTC (append Z),
* matching Android's parseMessageInstant behavior.
*/
export function parseApiTimestamp(dateString: string): Date {
const raw = dateString.trim();
if (!raw) return new Date(NaN);
const normalized = raw.includes(" ") ? raw.replace(" ", "T") : raw;
const hasOffset =
/[zZ]$/.test(normalized) ||
/[+-]\d{2}:?\d{2}$/.test(normalized);
return new Date(hasOffset ? normalized : `${normalized}Z`);
}
/**
* Formats a timestamp string to HH:MM in the user's local timezone.
* @param {string} dateString - ISO timestamp string to format
* @returns {string} Formatted time string in HH:MM format
* @example
* formatTime('2024-01-15T14:30:00Z'); // Returns "14:30"
* formatTime('2024-01-15T14:30:00Z'); // Returns local "17:30" in UTC+3
*/
export function formatTime(dateString: string): string {
const date = new Date(dateString);
let hours = date.getHours();
let minutes = date.getMinutes();
const hoursString = hours < 10 ? '0' + hours : hours;
const minutesString = minutes < 10 ? '0' + minutes : minutes;
return hoursString + ':' + minutesString;
const date = parseApiTimestamp(dateString);
if (Number.isNaN(date.getTime())) return "";
const hours = date.getHours();
const minutes = date.getMinutes();
const hoursString = hours < 10 ? "0" + hours : String(hours);
const minutesString = minutes < 10 ? "0" + minutes : String(minutes);
return hoursString + ":" + minutesString;
}
/**