@fayz-ai/admin 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,19 +13,19 @@ import { usePermissionOptional, usePermissionsStore, PermissionsProvider } from
13
13
  export { PermissionsProvider, useHasPermission, usePermission, usePermissionOptional, usePermissions, usePermissionsStore } from './chunk-WJ3H3RJN.js';
14
14
  import { useOrganizationStore } from './chunk-5GWUM4SM.js';
15
15
  export { getPersistedOrgId, useOrganizationStore } from './chunk-5GWUM4SM.js';
16
- import * as React111 from 'react';
17
- import React111__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext } from 'react';
18
- import { createDebug, resetActiveUnit, setUnitMode, setActiveUnitId, setScopedResources, tl, EMPTY_APP_CONFIG, fetchAppConfig, getSupabaseClientOptional, createSafeDataProvider, isKnownMissing, rememberIfMissing, deriveEntityKey, registerEntity, getActiveTenantId, resolveDataProvider, bulkRemove, emitDomainEvent, entityEventKey, errorMessage, useTranslation, useDataChanged, emitDataChanged, exportCSV, formatDateTime as formatDateTime$1, formatDate as formatDate$1, formatCurrency as formatCurrency$1, bulkCreate, matchesRange, isConnectorCategory, usePluginRuntimeOptional, useDataVersion, reportAppError, getWidgetsForZone, resolvePluginComponent, setCurrentLocale, resolveLocale, resolvePluginRuntime, PluginRuntimeProvider, I18nProvider, getAllEntities, resolveIntegrationSurface, defineApp, registerScaffold, useActiveTenantId, invalidateAppConfig, toTenantPluginBindings, useConnectorsForPlugin, renderApp as renderApp$1, parseRangeFilter, isFilterObject, connectionKey, useManifest, registerEventSink, usePluginRuntime, installGlobalErrorHandlers, applyNavComposition, mergeTranslations, coreTranslations, attachPersistentCache, getPersistentCache, createMockProvider, listConnections, connectorPlanes, connectorPermissions, connectorEntities, preferredPlane, connectorDirection, countByTenant, searchEverything, getComponent, getPluginFactory, connectorSettings, groupedPermissions, invocationPlane, missingRequiredSettings, isSettingSet, getEntityByKey, connectorSubscribesTo, eventKeyMatches, formatPostalCode, isValidPostalCode, lookupPostalCode } from '@fayz-ai/core';
16
+ import * as React113 from 'react';
17
+ import React113__default, { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext } from 'react';
18
+ import { createDebug, resetActiveUnit, setUnitMode, setActiveUnitId, setScopedResources, tl, EMPTY_APP_CONFIG, fetchAppConfig, getSupabaseClientOptional, createSafeDataProvider, isKnownMissing, rememberIfMissing, deriveEntityKey, registerEntity, getActiveTenantId, resolveDataProvider, bulkRemove, emitDomainEvent, entityEventKey, errorMessage, useTranslation, useDataChanged, emitDataChanged, exportCSV, formatDateTime as formatDateTime$1, formatDate as formatDate$1, formatCurrency as formatCurrency$1, bulkCreate, matchesRange, isConnectorCategory, usePluginRuntimeOptional, useDataVersion, reportAppError, getWidgetsForZone, resolvePluginComponent, setCurrentLocale, resolveLocale, resolvePluginRuntime, PluginRuntimeProvider, I18nProvider, getAllEntities, resolveIntegrationSurface, defineApp, registerScaffold, useActiveTenantId, invalidateAppConfig, toTenantPluginBindings, useConnectorsForPlugin, renderApp as renderApp$1, parseRangeFilter, isFilterObject, connectionKey, useManifest, registerEventSink, usePluginRuntime, installGlobalErrorHandlers, applyNavComposition, mergeTranslations, coreTranslations, attachPersistentCache, getPersistentCache, createMockProvider, listConnections, connectorPlanes, connectorPermissions, connectorEntities, preferredPlane, connectorDirection, countByTenant, getCurrentLocale, searchEverything, getComponent, getPluginFactory, connectorSettings, groupedPermissions, invocationPlane, missingRequiredSettings, isSettingSet, getEntityByKey, connectorSubscribesTo, eventKeyMatches, formatPostalCode, isValidPostalCode, lookupPostalCode } from '@fayz-ai/core';
19
19
  export { ConnectorRuntimeTokenUnavailableError, createSafeDataProvider, formatDate, formatDateTime, getActiveLocale, getActiveTenantId, getConnectorRuntimeTokenSource, getCurrentLocale, getSupabaseClientOptional, preloadLocale, resolveBackendEnv, setConnectorRuntimeTokenSource, setCurrentLocale, tl, useActiveTenantId } from '@fayz-ai/core';
20
20
  import { usePasswordSetupGate, SetPasswordPage, AuthGate, AuthProvider, createAuthRuntime } from '@fayz-ai/plugin-auth';
21
21
  export { LoginPage } from '@fayz-ai/plugin-auth';
22
- import { toast, usePageTrailParent, navigateToCrumb, Button, PageHeader, ConfirmDialog, useRowSelection, getLucideIcon, FilterChip, Dropdown, DropdownTrigger, Hint, cn as cn$1, DropdownContent, DropdownLabel, DropdownItem, DropdownSeparator, RefreshButton, PageHeaderActions, PageTabs, StatTiles, Card, BulkActionBar, DataTable, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalFooter, Badge, PageActionBar, ICON_MAP, Sheet, SheetContent, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Checkbox, useTourStore, setTourNavigator, TourSpotlight, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Wizard, SidebarOnboarding, OnboardingWidget, useLayoutStore, Skeleton, useSaveBar, useBackHandler, SubpageHeader, Separator, Tabs, TabsList, TabsTrigger, TabsContent, CardContent, ModalBody, ToastProvider, NavTransitionProvider, ListView, Thumbnail, ModalPortal, ModalOverlay, SearchSelect, CurrencyInput, SearchField, ChevronPager, Popover, PopoverTrigger, PopoverContent, useModuleLayout, PhoneLink, normalizePhone, SearchCombobox, HeaderTabs, usePageTrail, AppShellSkeleton, Switch, ModuleLayoutProvider, AppShell, PageTransition, MarkdownEditor, PhoneField, PageRail, RailNavItem, createFayzTheme, Avatar, AvatarImage, AvatarFallback, Markdown, PageTrail, RowActions, CardTitle, CardDescription, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownRadioGroup, DropdownRadioItem, CardHeader, CardFooter, SegmentedControl } from '@fayz-ai/ui';
22
+ import { toast, usePageTrailParent, navigateToCrumb, Button, PageHeader, ConfirmDialog, useRowSelection, getLucideIcon, FilterChip, Dropdown, DropdownTrigger, Hint, cn as cn$1, DropdownContent, DropdownLabel, DropdownItem, DropdownSeparator, RefreshButton, PageHeaderActions, PageTabs, StatTiles, Card, BulkActionBar, DataTable, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalFooter, Badge, PageActionBar, ICON_MAP, Sheet, SheetContent, SheetBody, useIsWide, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Checkbox, useTourStore, setTourNavigator, TourSpotlight, PracticeOverlay, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Wizard, SidebarOnboarding, OnboardingWidget, useLayoutStore, Skeleton, useSaveBar, useBackHandler, SubpageHeader, Separator, Tabs, TabsList, TabsTrigger, TabsContent, CardContent, ModalBody, ToastProvider, NavTransitionProvider, ListView, Thumbnail, ModalPortal, ModalOverlay, SearchSelect, CurrencyInput, SearchField, ChevronPager, Popover, PopoverTrigger, PopoverContent, useModuleLayout, PhoneLink, normalizePhone, SearchCombobox, HeaderTabs, usePageTrail, AppShellSkeleton, usePracticeStore, Switch, ModuleLayoutProvider, AppShell, PageTransition, MarkdownEditor, PhoneField, PageRail, RailNavItem, createFayzTheme, Avatar, AvatarImage, AvatarFallback, Markdown, PageTrail, RowActions, CardTitle, CardDescription, DropdownSub, DropdownSubTrigger, DropdownSubContent, DropdownRadioGroup, DropdownRadioItem, CardHeader, CardFooter, SegmentedControl } from '@fayz-ai/ui';
23
23
  export { createFayzTheme, fayzThemePresets } from '@fayz-ai/ui';
24
24
  import { useAuthStore, useAuth, buildAppHandoffUrl } from '@fayz-ai/auth';
25
25
  export { useAuth } from '@fayz-ai/auth';
26
26
  import { create, useStore as useStore$1 } from 'zustand';
27
27
  import * as LucideIcons3 from 'lucide-react';
28
- import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, Play, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck, CalendarCheck, CalendarOff } from 'lucide-react';
28
+ import { Trash2, Upload, Search, ArrowDown, ArrowUp, ArrowUpDown, Check, Download, ChevronLeft, ChevronRight, AlertTriangle, Pencil, Inbox, Package, Sparkles, Plug, DollarSign, Clock, X, WandSparkles, Loader2, ArrowDownToLine, ArrowUpFromLine, CheckCircle2, Crown, ArrowRight, History, SquarePen, Settings2, Mic, User, Plus, Minus, ListChecks, ChevronDown, ArrowLeft, Calendar, ClipboardList, CheckSquare, BookOpen, Lock, PinOff, Pin, Eye, Users, StickyNote, CheckSquare2, Square, Building2, RotateCcw, Copy, Globe, LayoutTemplate, Store, ChevronsUpDown, ExternalLink, PenSquare, RefreshCw, XCircle, Camera, Edit, Star, Link2Off, Layers, ShoppingBag, ChevronUp, List, LayoutGrid, CircleDollarSign, Receipt, Settings, Mail, MessageCircle, Cake, HelpCircle, Wrench, TableProperties, ShieldCheck, MessageSquare, Paperclip, Infinity, CheckCheck, PartyPopper, Compass, Play, MapPin, ArrowUpRight, Pause, CalendarDays, CircleCheckBig, UserX, Ban, CircleAlert, CircleEllipsis, FileText, CircleDashed, Power, ArrowRightLeft, File as File$1, FileImage, FileSpreadsheet, AlertCircle, CreditCard, SlidersHorizontal, Puzzle, Shield, Palette, ShieldAlert, UserCog, LogOut, Bell, ImagePlus, Database, Radio, Zap, Save, UserPlus, Contact, UserMinus, Send, Sun, Moon, Monitor, Languages, Info, LocateFixed, Link2, KeyRound, Bug, Heart, Briefcase, BarChart3, Tag, Truck, CalendarCheck, CalendarOff } from 'lucide-react';
29
29
  import { createPortal } from 'react-dom';
30
30
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
31
31
  import { profileHasSystemPermission, mergeLimitDeclarations } from '@fayz-ai/core/access';
@@ -70,7 +70,7 @@ function useWorkspaceSetupGate(enabled) {
70
70
  const close = useWorkspaceSetupStore((s) => s.close);
71
71
  const path = useAdminPath();
72
72
  const onRoute = path === WORKSPACE_SETUP_ROUTE;
73
- const exitDeliberate = React111.useCallback(() => {
73
+ const exitDeliberate = React113.useCallback(() => {
74
74
  close();
75
75
  if (onRoute) navigateTo("/");
76
76
  }, [close, onRoute]);
@@ -639,7 +639,11 @@ function buildDataPrimitiveTools(input) {
639
639
  for (const registry4 of defs) {
640
640
  if (registry4.readOnly) continue;
641
641
  const key = `${pluginId}:${registry4.id}`;
642
- options.push({ key, label: registry4.entity.namePlural ?? registry4.entity.name });
642
+ options.push({
643
+ key,
644
+ label: registry4.entity.namePlural ?? registry4.entity.name,
645
+ ...registry4.agentHint ? { hint: registry4.agentHint } : {}
646
+ });
643
647
  schema.push({ key, fields: registry4.entity.fields ?? [] });
644
648
  }
645
649
  }
@@ -650,7 +654,7 @@ function buildDataPrimitiveTools(input) {
650
654
  }
651
655
  if (!options.length) return [];
652
656
  const keys = options.map((o) => o.key);
653
- const catalogLine = options.map((o) => `${o.key} (${o.label.toLowerCase()})`).join(", ");
657
+ const catalogLine = options.map((o) => `${o.key} (${o.label.toLowerCase()}${o.hint ? ` \u2014 ${o.hint}` : ""})`).join(", ");
654
658
  return [
655
659
  {
656
660
  id: "data.find-anything",
@@ -1100,6 +1104,9 @@ async function readAllRows(digest) {
1100
1104
  function listAttachmentNames() {
1101
1105
  return [...registry.values()].map((e) => e.parsed).filter((d) => !!d?.headers?.length).map((d) => d.name);
1102
1106
  }
1107
+ function nonTabularAttachmentNames() {
1108
+ return [...registry.values()].map((e) => e.parsed).filter((d) => !!d && !d.headers?.length && !d.sheets?.length).map((d) => d.name);
1109
+ }
1103
1110
  var SPREADSHEET_EXT = /\.(xlsx|xlsm|xls)$/i;
1104
1111
  var CSV_EXT = /\.(csv|tsv)$/i;
1105
1112
  var TEXT_EXT = /\.(txt|md|markdown|json|log)$/i;
@@ -1860,7 +1867,7 @@ function getServerVersion() {
1860
1867
  return 0;
1861
1868
  }
1862
1869
  function useAssistantActivity() {
1863
- React111.useSyncExternalStore(subscribe, getVersion, getServerVersion);
1870
+ React113.useSyncExternalStore(subscribe, getVersion, getServerVersion);
1864
1871
  return pickActivity(activities);
1865
1872
  }
1866
1873
  var STATE_RANK = {
@@ -1876,22 +1883,22 @@ function pickActivity(list) {
1876
1883
  return pool.find((a) => a.kind === "recording") ?? pool[0];
1877
1884
  }
1878
1885
  function useAssistantLaunchers() {
1879
- React111.useSyncExternalStore(subscribe, getVersion, getServerVersion);
1886
+ React113.useSyncExternalStore(subscribe, getVersion, getServerVersion);
1880
1887
  return launchers;
1881
1888
  }
1882
1889
  function useLaunchersForRole(role) {
1883
1890
  const all = useAssistantLaunchers();
1884
- return React111.useMemo(() => all.filter((l) => !l.role || l.role === role), [all, role]);
1891
+ return React113.useMemo(() => all.filter((l) => !l.role || l.role === role), [all, role]);
1885
1892
  }
1886
1893
  function usePublishAssistantActivity(activity) {
1887
1894
  const id = activity?.id;
1888
1895
  const key = activity ? `${activity.id}|${activity.kind}|${activity.label}|${activity.state}|${activity.elapsedMs ?? ""}|${(activity.actions ?? []).map((a) => a.intent).join(",")}|${activity.confirm?.acknowledge ?? ""}` : null;
1889
- const ref = React111.useRef(activity);
1896
+ const ref = React113.useRef(activity);
1890
1897
  ref.current = activity;
1891
- React111.useEffect(() => {
1898
+ React113.useEffect(() => {
1892
1899
  if (ref.current) publishAssistantActivity(ref.current);
1893
1900
  }, [key]);
1894
- React111.useEffect(() => {
1901
+ React113.useEffect(() => {
1895
1902
  if (!id) return;
1896
1903
  return () => withdrawAssistantActivity(id);
1897
1904
  }, [id]);
@@ -1899,12 +1906,12 @@ function usePublishAssistantActivity(activity) {
1899
1906
  function useRegisterAssistantLauncher(launcher) {
1900
1907
  const id = launcher?.id;
1901
1908
  const key = launcher ? `${launcher.id}|${launcher.label}|${launcher.disabled ? "1" : "0"}|${launcher.role ?? ""}` : null;
1902
- const ref = React111.useRef(launcher);
1909
+ const ref = React113.useRef(launcher);
1903
1910
  ref.current = launcher;
1904
- React111.useEffect(() => {
1911
+ React113.useEffect(() => {
1905
1912
  if (ref.current) registerAssistantLauncher(ref.current);
1906
1913
  }, [key]);
1907
- React111.useEffect(() => {
1914
+ React113.useEffect(() => {
1908
1915
  if (!id) return;
1909
1916
  return () => unregisterAssistantLauncher(id);
1910
1917
  }, [id]);
@@ -2002,42 +2009,42 @@ function useRightRailPanel(panel) {
2002
2009
  const sublabel = panel?.sublabel;
2003
2010
  const badgeCount = panel?.badge?.count;
2004
2011
  const badgeTone = panel?.badge?.tone;
2005
- const initial = React111.useRef({ label: label2, icon });
2006
- React111.useEffect(() => {
2012
+ const initial = React113.useRef({ label: label2, icon });
2013
+ React113.useEffect(() => {
2007
2014
  if (!id || !Component2) return;
2008
2015
  register({ id, label: initial.current.label ?? id, order, Component: Component2, icon: initial.current.icon });
2009
2016
  return () => unregister(id);
2010
2017
  }, [id, order, Component2, register, unregister]);
2011
- React111.useEffect(() => {
2018
+ React113.useEffect(() => {
2012
2019
  if (!id) return;
2013
2020
  updateMeta(id, { label: label2, icon, iconBare, trailing, sublabel });
2014
2021
  }, [id, label2, icon, iconBare, trailing, sublabel, updateMeta]);
2015
- React111.useEffect(() => {
2022
+ React113.useEffect(() => {
2016
2023
  if (!id) return;
2017
2024
  updateBadge(id, badgeCount !== void 0 ? { count: badgeCount, tone: badgeTone } : void 0);
2018
2025
  }, [id, badgeCount, badgeTone, updateBadge]);
2019
2026
  }
2020
- var RightRailActionsSlotContext = React111.createContext(null);
2027
+ var RightRailActionsSlotContext = React113.createContext(null);
2021
2028
  var RightRailActionsSlotProvider = RightRailActionsSlotContext.Provider;
2022
2029
  function RightRailActions({ children }) {
2023
- const slot = React111.useContext(RightRailActionsSlotContext);
2030
+ const slot = React113.useContext(RightRailActionsSlotContext);
2024
2031
  if (slot) return createPortal(children, slot);
2025
2032
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-0.5 px-2 pt-1.5", children });
2026
2033
  }
2027
- var RightRailLeadingSlotContext = React111.createContext(null);
2034
+ var RightRailLeadingSlotContext = React113.createContext(null);
2028
2035
  var RightRailLeadingSlotProvider = RightRailLeadingSlotContext.Provider;
2029
2036
  function RightRailLeading({ children }) {
2030
- const slot = React111.useContext(RightRailLeadingSlotContext);
2037
+ const slot = React113.useContext(RightRailLeadingSlotContext);
2031
2038
  if (slot) return createPortal(children, slot);
2032
2039
  return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 px-2 pt-1.5", children });
2033
2040
  }
2034
2041
  function useRightRailReselect(id, handler) {
2035
2042
  const reselects = useRightRailStore((s) => s.reselects);
2036
2043
  const reselectId = useRightRailStore((s) => s.reselectId);
2037
- const ref = React111.useRef(handler);
2044
+ const ref = React113.useRef(handler);
2038
2045
  ref.current = handler;
2039
- const seen = React111.useRef(reselects);
2040
- React111.useEffect(() => {
2046
+ const seen = React113.useRef(reselects);
2047
+ React113.useEffect(() => {
2041
2048
  if (reselects === seen.current) return;
2042
2049
  seen.current = reselects;
2043
2050
  if (reselectId === id) ref.current();
@@ -2053,9 +2060,9 @@ function useRightRailDrill(drill) {
2053
2060
  const keepActions = drill?.keepActions;
2054
2061
  const avatarName = drill?.avatar?.name;
2055
2062
  const avatarSrc = drill?.avatar?.src;
2056
- const backRef = React111.useRef(drill?.back);
2063
+ const backRef = React113.useRef(drill?.back);
2057
2064
  backRef.current = drill?.back;
2058
- React111.useEffect(() => {
2065
+ React113.useEffect(() => {
2059
2066
  if (!title) return;
2060
2067
  setDrill({
2061
2068
  title,
@@ -2170,7 +2177,7 @@ function buildPersonaGuidance() {
2170
2177
  }
2171
2178
  function useRegisterStaff(staff) {
2172
2179
  const setAgent = useAgentStore((s) => s.setAgent);
2173
- React111__default.useEffect(() => {
2180
+ React113__default.useEffect(() => {
2174
2181
  if (staff && staff.length > 1) {
2175
2182
  console.warn(
2176
2183
  `[fayz] chat.staff lists ${staff.length} agents; an app has one. Using "${soleAgent(staff)?.name}" and ignoring the rest \u2014 see chat.agent.`
@@ -2203,7 +2210,7 @@ function AssistantInvite({ className, ...def }) {
2203
2210
  const { id, persona, headline, pitch, description, placeholder, auto } = def;
2204
2211
  const suggestions = def.suggestions;
2205
2212
  const suggestionKey = JSON.stringify(suggestions ?? []);
2206
- React111.useEffect(() => {
2213
+ React113.useEffect(() => {
2207
2214
  if (!hasAssistant) return;
2208
2215
  setInvite({
2209
2216
  id,
@@ -2217,11 +2224,11 @@ function AssistantInvite({ className, ...def }) {
2217
2224
  });
2218
2225
  return () => setInvite(null, id);
2219
2226
  }, [hasAssistant, id, persona, headline, pitch, description, placeholder, auto, suggestionKey, setInvite]);
2220
- const anchorRef = React111.useRef(null);
2221
- const [box, setBox] = React111.useState(null);
2227
+ const anchorRef = React113.useRef(null);
2228
+ const [box, setBox] = React113.useState(null);
2222
2229
  const docked = stage === "dock" && !railOpen && hasAssistant;
2223
2230
  const showing = hasAssistant && (stage === "hero" || docked);
2224
- React111.useEffect(() => {
2231
+ React113.useEffect(() => {
2225
2232
  if (!showing) return;
2226
2233
  const el = anchorRef.current;
2227
2234
  if (!el) return;
@@ -2242,7 +2249,7 @@ function AssistantInvite({ className, ...def }) {
2242
2249
  }, [showing]);
2243
2250
  const setDockBox = useAssistantInviteStore((s) => s.setDockBox);
2244
2251
  const wide = useWideViewport();
2245
- React111.useEffect(() => {
2252
+ React113.useEffect(() => {
2246
2253
  if (!docked || !wide || !box) {
2247
2254
  setDockBox(null);
2248
2255
  return;
@@ -2256,7 +2263,7 @@ function AssistantInvite({ className, ...def }) {
2256
2263
  function useAsk() {
2257
2264
  const queuePrompt = useChatStore((s) => s.queuePrompt);
2258
2265
  const dismiss = useAssistantInviteStore((s) => s.dismiss);
2259
- return React111.useCallback(
2266
+ return React113.useCallback(
2260
2267
  (text2) => {
2261
2268
  const trimmed = text2.trim();
2262
2269
  if (!trimmed) return;
@@ -2274,9 +2281,9 @@ function InviteHero({
2274
2281
  const { t } = useTranslation$1();
2275
2282
  const user = useAuthStore((s) => s.user);
2276
2283
  const ask = useAsk();
2277
- const [draft, setDraft] = React111.useState("");
2284
+ const [draft, setDraft] = React113.useState("");
2278
2285
  const name = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
2279
- React111.useEffect(() => {
2286
+ React113.useEffect(() => {
2280
2287
  const onKey = (event) => {
2281
2288
  if (event.key === "Escape") onDismiss();
2282
2289
  };
@@ -2338,8 +2345,8 @@ function InviteHero({
2338
2345
  );
2339
2346
  }
2340
2347
  function useMorphIn(skip = false) {
2341
- const [entered, setEntered] = React111.useState(() => skip || prefersReducedMotion());
2342
- React111.useEffect(() => {
2348
+ const [entered, setEntered] = React113.useState(() => skip || prefersReducedMotion());
2349
+ React113.useEffect(() => {
2343
2350
  if (entered) return;
2344
2351
  let second = 0;
2345
2352
  const first = requestAnimationFrame(() => {
@@ -2358,10 +2365,10 @@ function prefersReducedMotion() {
2358
2365
  var lastDockExit = null;
2359
2366
  var RESUME_WINDOW_MS = 700;
2360
2367
  function useWideViewport() {
2361
- const [wide, setWide] = React111.useState(
2368
+ const [wide, setWide] = React113.useState(
2362
2369
  () => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
2363
2370
  );
2364
- React111.useEffect(() => {
2371
+ React113.useEffect(() => {
2365
2372
  const query = window.matchMedia?.("(min-width: 768px)");
2366
2373
  if (!query) return;
2367
2374
  const sync = () => setWide(query.matches);
@@ -2392,18 +2399,18 @@ function InviteDock({ def, left, maxWidth }) {
2392
2399
  const setOpen = useChatStore((s) => s.setOpen);
2393
2400
  const railOpen = useRightRailStore((s) => s.open);
2394
2401
  const railWidth = useRightRailStore((s) => s.width);
2395
- const [draft, setDraft] = React111.useState("");
2396
- const resumed = React111.useRef(
2402
+ const [draft, setDraft] = React113.useState("");
2403
+ const resumed = React113.useRef(
2397
2404
  !!lastDockExit && lastDockExit.id === def.id && Date.now() - lastDockExit.at < RESUME_WINDOW_MS
2398
2405
  ).current;
2399
- React111.useEffect(() => () => {
2406
+ React113.useEffect(() => () => {
2400
2407
  lastDockExit = { id: def.id, at: Date.now() };
2401
2408
  }, [def.id]);
2402
2409
  const entered = useMorphIn(resumed);
2403
2410
  const width = Math.min(maxWidth, DOCK_MAX_WIDTH);
2404
2411
  const morph = morphStyles({ left, width }, railOpen, railWidth);
2405
- const [settled, setSettled] = React111.useState(resumed);
2406
- React111.useEffect(() => {
2412
+ const [settled, setSettled] = React113.useState(resumed);
2413
+ React113.useEffect(() => {
2407
2414
  if (!entered || settled) return;
2408
2415
  const id = setTimeout(() => setSettled(true), MORPH_MS + 60);
2409
2416
  return () => clearTimeout(id);
@@ -2537,7 +2544,7 @@ function MorphBackPill() {
2537
2544
  const railWidth = useRightRailStore((s) => s.width);
2538
2545
  const { t } = useTranslation$1();
2539
2546
  const collapsed = useMorphIn();
2540
- React111.useEffect(() => {
2547
+ React113.useEffect(() => {
2541
2548
  if (prefersReducedMotion()) {
2542
2549
  endLeave();
2543
2550
  return;
@@ -3353,9 +3360,10 @@ registerAIToolHandler("proposeImport", async (args, ctx) => {
3353
3360
  const digest = resolveAttachmentDigest(fileName);
3354
3361
  if (!digest) {
3355
3362
  const names = listAttachmentNames();
3363
+ const other = nonTabularAttachmentNames();
3356
3364
  return {
3357
3365
  error: "no_file",
3358
- message: names.length ? `No readable file called "${fileName ?? ""}". Attached right now: ${names.join(", ")}.` : "There is no readable file attached to this conversation. Ask the user to attach a CSV."
3366
+ message: names.length ? `No readable file called "${fileName ?? ""}". Attached right now: ${names.join(", ")}.` : other.length ? `${other.join(", ")} is attached, but it has no columns \u2014 importing is for spreadsheets and CSVs. If it is a photo or a scan, READ IT: it is in front of you, so answer from what is written on it and use the tool that matches what the user asked for. Do not ask for a CSV.` : "There is no file attached to this conversation. Ask the user to attach a CSV or a spreadsheet."
3359
3367
  };
3360
3368
  }
3361
3369
  const headers = (digest.headers ?? []).filter((h) => h.trim());
@@ -4500,12 +4508,12 @@ function detectActivePluginId(runtime) {
4500
4508
  function useAITools() {
4501
4509
  const runtime = usePluginRuntimeOptional();
4502
4510
  const access = useAccessOptional();
4503
- const surfaceVersion = React111.useSyncExternalStore(subscribeSurfaces, getSurfaceVersion, getSurfaceVersion);
4511
+ const surfaceVersion = React113.useSyncExternalStore(subscribeSurfaces, getSurfaceVersion, getSurfaceVersion);
4504
4512
  const features = usePermissionsStore((s) => s.features);
4505
4513
  const profiles = usePermissionsStore((s) => s.profiles);
4506
4514
  const hasSystem = useSystemPermission();
4507
4515
  const canManagePermissions = hasSystem("manage_permissions");
4508
- return React111.useMemo(() => {
4516
+ return React113.useMemo(() => {
4509
4517
  const hasPermission = runtime?.context.hasPermission;
4510
4518
  const can = access.can;
4511
4519
  const verticalId = runtime?.context.tenant?.verticalId;
@@ -5513,8 +5521,8 @@ function loadCatalog() {
5513
5521
  return catalogPromise;
5514
5522
  }
5515
5523
  function useConnectorCatalog() {
5516
- const [catalog, setCatalog] = React111__default.useState(null);
5517
- React111__default.useEffect(() => {
5524
+ const [catalog, setCatalog] = React113__default.useState(null);
5525
+ React113__default.useEffect(() => {
5518
5526
  let cancelled = false;
5519
5527
  void loadCatalog().then((list) => {
5520
5528
  if (!cancelled) setCatalog(list);
@@ -5538,7 +5546,7 @@ function refreshConnectors() {
5538
5546
  _revisionListeners.forEach((listener) => listener());
5539
5547
  }
5540
5548
  function useConnectorsRevision() {
5541
- return React111__default.useSyncExternalStore(
5549
+ return React113__default.useSyncExternalStore(
5542
5550
  (listener) => {
5543
5551
  _revisionListeners.add(listener);
5544
5552
  return () => _revisionListeners.delete(listener);
@@ -5557,11 +5565,11 @@ function loadGrants(key, fetcher) {
5557
5565
  }
5558
5566
  function useInstalledModuleIds() {
5559
5567
  const runtime = usePluginRuntimeOptional();
5560
- return React111__default.useMemo(() => (runtime?.plugins ?? []).map((p) => p.id), [runtime]);
5568
+ return React113__default.useMemo(() => (runtime?.plugins ?? []).map((p) => p.id), [runtime]);
5561
5569
  }
5562
5570
  function useInstalledDefinitions(hostPluginId) {
5563
5571
  const runtime = usePluginRuntimeOptional();
5564
- return React111__default.useMemo(() => {
5572
+ return React113__default.useMemo(() => {
5565
5573
  const byHost = runtime?.connectorsByHost;
5566
5574
  if (!byHost) return [];
5567
5575
  if (hostPluginId) return byHost.get(hostPluginId) ?? [];
@@ -5574,12 +5582,12 @@ function useConnectors(options = {}) {
5574
5582
  const catalog = useConnectorCatalog();
5575
5583
  const tenant = useTenantOptional();
5576
5584
  const tenantId2 = tenant?.org?.id;
5577
- const connection = React111__default.useMemo(() => resolveFayzAgentConnection(), []);
5578
- const [installed, setInstalled] = React111__default.useState(null);
5579
- const [grants, setGrants] = React111__default.useState(null);
5580
- const [error, setError] = React111__default.useState(null);
5585
+ const connection = React113__default.useMemo(() => resolveFayzAgentConnection(), []);
5586
+ const [installed, setInstalled] = React113__default.useState(null);
5587
+ const [grants, setGrants] = React113__default.useState(null);
5588
+ const [error, setError] = React113__default.useState(null);
5581
5589
  const nonce = useConnectorsRevision();
5582
- const call2 = React111__default.useCallback(
5590
+ const call2 = React113__default.useCallback(
5583
5591
  async (path, init) => {
5584
5592
  if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
5585
5593
  const supabase = getFayzSupabaseClientOptional();
@@ -5599,7 +5607,7 @@ function useConnectors(options = {}) {
5599
5607
  },
5600
5608
  [connection]
5601
5609
  );
5602
- React111__default.useEffect(() => {
5610
+ React113__default.useEffect(() => {
5603
5611
  let cancelled = false;
5604
5612
  void loadConnectorStatuses(definitions, tenantId2).then((list) => {
5605
5613
  if (!cancelled) setInstalled(list);
@@ -5608,7 +5616,7 @@ function useConnectors(options = {}) {
5608
5616
  cancelled = true;
5609
5617
  };
5610
5618
  }, [definitions, tenantId2, nonce]);
5611
- React111__default.useEffect(() => {
5619
+ React113__default.useEffect(() => {
5612
5620
  if (!includeGrants || !connection || !tenantId2) {
5613
5621
  setGrants(includeGrants ? null : []);
5614
5622
  return;
@@ -5632,7 +5640,7 @@ function useConnectors(options = {}) {
5632
5640
  cancelled = true;
5633
5641
  };
5634
5642
  }, [call2, tenantId2, includeGrants, connection, nonce]);
5635
- const revokeGrant = React111__default.useCallback(
5643
+ const revokeGrant = React113__default.useCallback(
5636
5644
  async (connector) => {
5637
5645
  const response = await call2(`/${connector.id}`, { method: "DELETE" });
5638
5646
  if (!response.ok) {
@@ -5645,7 +5653,7 @@ function useConnectors(options = {}) {
5645
5653
  [call2]
5646
5654
  );
5647
5655
  const waitingGrants = includeGrants && !!connection && !!tenantId2 && grants === null;
5648
- const connectors = React111__default.useMemo(() => {
5656
+ const connectors = React113__default.useMemo(() => {
5649
5657
  if (installed === null || waitingGrants) return null;
5650
5658
  return buildConnectorList({
5651
5659
  installed,
@@ -5887,9 +5895,9 @@ function ConnectorMark({
5887
5895
  connector,
5888
5896
  size = "md"
5889
5897
  }) {
5890
- const candidates = React111__default.useMemo(() => markCandidates(connector), [connector.logoUrl, connector.name]);
5891
- const [attempt, setAttempt] = React111__default.useState(0);
5892
- React111__default.useEffect(() => setAttempt(0), [connector.id]);
5898
+ const candidates = React113__default.useMemo(() => markCandidates(connector), [connector.logoUrl, connector.name]);
5899
+ const [attempt, setAttempt] = React113__default.useState(0);
5900
+ React113__default.useEffect(() => setAttempt(0), [connector.id]);
5893
5901
  const box = size === "sm" ? "h-9 w-9" : "h-10 w-10";
5894
5902
  const glyph = size === "sm" ? "h-4 w-4" : "h-5 w-5";
5895
5903
  if (connector.builtIn) {
@@ -7133,6 +7141,14 @@ function useChat(options) {
7133
7141
  const d = new Date(Date.now() + (i + 1) * 864e5);
7134
7142
  return `${d.toLocaleDateString("pt-BR", { weekday: "long" })}=${d.toISOString().slice(0, 10)}`;
7135
7143
  }).join(", ");
7144
+ const seenCalls = /* @__PURE__ */ new Map();
7145
+ const callKey = (call2) => `${call2.name}:${JSON.stringify(call2.arguments ?? {})}`;
7146
+ const repeatResult = (previous) => JSON.stringify({
7147
+ ok: true,
7148
+ alreadyDone: true,
7149
+ previousResult: previous.slice(0, 1500),
7150
+ message: "THIS EXACT CALL ALREADY RAN in this turn and its result is above \u2014 it was NOT run again, and nothing new was written. Do not call it a third time. Use what it returned (ids included) and answer the person."
7151
+ });
7136
7152
  const collectRecordLinks = (content2) => {
7137
7153
  rememberRecordRefs(content2);
7138
7154
  const links = extractRecordLinks(content2);
@@ -7250,13 +7266,19 @@ ${JSON.stringify(snapshot.length === 1 ? snapshot[0] : snapshot)}` : void 0
7250
7266
  }
7251
7267
  useChatStore.getState().setActiveTools(response.toolCalls.map((c) => c.name));
7252
7268
  try {
7253
- toolResults = await Promise.all(
7254
- response.toolCalls.map(async (call2) => {
7255
- const content2 = await executeGuarded(call2, toolByName.get(call2.name), toolContext);
7256
- collectRecordLinks(content2);
7257
- return { toolCallId: call2.id, content: content2 };
7258
- })
7259
- );
7269
+ toolResults = [];
7270
+ for (const call2 of response.toolCalls) {
7271
+ const key = callKey(call2);
7272
+ const previous = seenCalls.get(key);
7273
+ if (previous !== void 0) {
7274
+ toolResults.push({ toolCallId: call2.id, content: repeatResult(previous) });
7275
+ continue;
7276
+ }
7277
+ const content2 = await executeGuarded(call2, toolByName.get(call2.name), toolContext);
7278
+ seenCalls.set(key, content2);
7279
+ collectRecordLinks(content2);
7280
+ toolResults.push({ toolCallId: call2.id, content: content2 });
7281
+ }
7260
7282
  const autoApproved = new Set(useChatStore.getState().autoApprovedTools);
7261
7283
  useChatStore.getState().appendToolCallsToLastAssistant(
7262
7284
  response.toolCalls.map((call2, i) => {
@@ -7282,15 +7304,23 @@ ${JSON.stringify(snapshot.length === 1 ? snapshot[0] : snapshot)}` : void 0
7282
7304
  async (content) => {
7283
7305
  stopSpeaking();
7284
7306
  const attachments = useChatStore.getState().consumePendingAttachments();
7285
- const filesToRead = useChatStore.getState().consumeQueuedFilesToRead();
7286
- if (!content.trim() && !attachments.length && !filesToRead?.length) return;
7307
+ const queuedToRead = useChatStore.getState().consumeQueuedFilesToRead();
7308
+ const attachedToRead = attachments.map((a) => getAttachmentFile(a.id)).filter((f) => !!f && (f.type.startsWith("image/") || f.type === "application/pdf"));
7309
+ const filesToRead = (queuedToRead?.length ? queuedToRead : attachedToRead).slice(0, 1);
7310
+ if (!content.trim() && !attachments.length && !filesToRead.length) return;
7287
7311
  const shown = [
7288
- ...attachments.map((a) => ({
7289
- name: a.name,
7290
- kind: a.kind,
7291
- ...a.rowCount === void 0 ? {} : { rowCount: a.rowCount }
7292
- })),
7293
- ...(filesToRead ?? []).map((f) => ({
7312
+ ...attachments.map((a) => {
7313
+ const file = a.kind === "image" ? getAttachmentFile(a.id) : void 0;
7314
+ return {
7315
+ name: a.name,
7316
+ kind: a.kind,
7317
+ ...a.rowCount === void 0 ? {} : { rowCount: a.rowCount },
7318
+ ...file && typeof URL !== "undefined" ? { previewUrl: URL.createObjectURL(file) } : {}
7319
+ };
7320
+ }),
7321
+ // Só o que veio de uma TELA: a foto anexada pelo composer já está na
7322
+ // linha acima, e listá-la nas duas mostraria o mesmo recibo duas vezes.
7323
+ ...(queuedToRead ?? []).map((f) => ({
7294
7324
  name: f.name,
7295
7325
  kind: detectKind(f),
7296
7326
  // A miniatura é feita do arquivo ORIGINAL: o que se manda para o
@@ -7496,9 +7526,9 @@ function prefersReducedMotion2() {
7496
7526
  return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
7497
7527
  }
7498
7528
  function TypewriterText({ text: text2, speed = 26, onDone }) {
7499
- const [displayed, setDisplayed] = React111.useState("");
7500
- const indexRef = React111.useRef(0);
7501
- React111.useEffect(() => {
7529
+ const [displayed, setDisplayed] = React113.useState("");
7530
+ const indexRef = React113.useRef(0);
7531
+ React113.useEffect(() => {
7502
7532
  if (prefersReducedMotion2()) {
7503
7533
  setDisplayed(text2);
7504
7534
  onDone?.();
@@ -7575,11 +7605,11 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7575
7605
  const { contextualSuggestions } = useAITools();
7576
7606
  const { sendMessage } = useChat({ apiEndpoint, systemPrompt, agent });
7577
7607
  const { t } = useTranslation$1();
7578
- const [phase, setPhase] = React111.useState("idle");
7579
- const [activeSuggestion, setActiveSuggestion] = React111.useState(null);
7580
- const timersRef = React111.useRef([]);
7581
- const prevSuggestionRef = React111.useRef(null);
7582
- React111.useEffect(ensureStyles, []);
7608
+ const [phase, setPhase] = React113.useState("idle");
7609
+ const [activeSuggestion, setActiveSuggestion] = React113.useState(null);
7610
+ const timersRef = React113.useRef([]);
7611
+ const prevSuggestionRef = React113.useRef(null);
7612
+ React113.useEffect(ensureStyles, []);
7583
7613
  const clearTimers = () => {
7584
7614
  timersRef.current.forEach(clearTimeout);
7585
7615
  timersRef.current = [];
@@ -7592,10 +7622,10 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7592
7622
  const invited = useAssistantInviteStore((s) => !!s.invite && s.stage === "dock");
7593
7623
  const dockOnScreen = useAssistantInviteStore((s) => !!s.dockBox);
7594
7624
  const morphingBack = useAssistantInviteStore((s) => !!s.leaving);
7595
- const [wide, setWide] = React111.useState(
7625
+ const [wide, setWide] = React113.useState(
7596
7626
  () => typeof window !== "undefined" && !!window.matchMedia?.("(min-width: 768px)").matches
7597
7627
  );
7598
- React111.useEffect(() => {
7628
+ React113.useEffect(() => {
7599
7629
  const query = window.matchMedia?.("(min-width: 768px)");
7600
7630
  if (!query) return;
7601
7631
  const sync = () => setWide(query.matches);
@@ -7604,7 +7634,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7604
7634
  return () => query.removeEventListener("change", sync);
7605
7635
  }, []);
7606
7636
  const teaserAllowed = !hasMessages && !activity && !invited && !teaserDismissed() && teaserShownCount() < TEASER_MAX_PER_SESSION;
7607
- React111.useEffect(() => {
7637
+ React113.useEffect(() => {
7608
7638
  if (expanded || !topSuggestion || !topLabel || !teaserAllowed || teaserSeen().includes(topLabel)) {
7609
7639
  if (phase !== "idle") {
7610
7640
  clearTimers();
@@ -7635,14 +7665,14 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7635
7665
  }, 9e3);
7636
7666
  return clearTimers;
7637
7667
  }, [topLabel, expanded, teaserAllowed]);
7638
- React111.useEffect(() => {
7668
+ React113.useEffect(() => {
7639
7669
  if (expanded && phase !== "idle") {
7640
7670
  clearTimers();
7641
7671
  setPhase("idle");
7642
7672
  }
7643
7673
  }, [expanded]);
7644
- const [entrance, setEntrance] = React111.useState("pending");
7645
- React111.useEffect(() => {
7674
+ const [entrance, setEntrance] = React113.useState("pending");
7675
+ React113.useEffect(() => {
7646
7676
  if (!currentOrg || entrance !== "pending") return;
7647
7677
  if (prefersReducedMotion2()) {
7648
7678
  setEntrance("done");
@@ -7652,9 +7682,9 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7652
7682
  const timer = setTimeout(() => setEntrance("done"), 1600);
7653
7683
  return () => clearTimeout(timer);
7654
7684
  }, [currentOrg, entrance]);
7655
- const [poppingBack, setPoppingBack] = React111.useState(false);
7656
- const wasMorphing = React111.useRef(false);
7657
- React111.useEffect(() => {
7685
+ const [poppingBack, setPoppingBack] = React113.useState(false);
7686
+ const wasMorphing = React113.useRef(false);
7687
+ React113.useEffect(() => {
7658
7688
  const was = wasMorphing.current;
7659
7689
  wasMorphing.current = morphingBack;
7660
7690
  if (!was || morphingBack || prefersReducedMotion2()) return;
@@ -7908,7 +7938,7 @@ function ChatFab({ className, apiEndpoint, systemPrompt, agent, voice }) {
7908
7938
  var MAX_SUGGESTIONS = 5;
7909
7939
  function ChatSuggestions({ suggestions, onSelect, onDismiss, compact }) {
7910
7940
  const { t } = useTranslation$1();
7911
- const [open, setOpen] = React111.useState(true);
7941
+ const [open, setOpen] = React113.useState(true);
7912
7942
  const visible = suggestions.slice(0, compact ? 3 : MAX_SUGGESTIONS);
7913
7943
  if (!visible.length) return null;
7914
7944
  return /* @__PURE__ */ jsxs(
@@ -7987,8 +8017,8 @@ function SuggestionRow({
7987
8017
  detail,
7988
8018
  onSelect
7989
8019
  }) {
7990
- const labelRef = React111.useRef(null);
7991
- const [showDetail, setShowDetail] = React111.useState(false);
8020
+ const labelRef = React113.useRef(null);
8021
+ const [showDetail, setShowDetail] = React113.useState(false);
7992
8022
  const evaluate = () => {
7993
8023
  const el = labelRef.current;
7994
8024
  const clipped = !!el && el.scrollWidth > el.clientWidth + 1;
@@ -8082,8 +8112,8 @@ function ChatToolsPanel({ toolGroups, onClose }) {
8082
8112
  }
8083
8113
  function AutoApprovalsSection() {
8084
8114
  const { t } = useTranslation$1();
8085
- const [rules, setRules] = React111.useState(() => listAutoApprovals());
8086
- React111.useEffect(() => subscribeAutoApprovals(() => setRules(listAutoApprovals())), []);
8115
+ const [rules, setRules] = React113.useState(() => listAutoApprovals());
8116
+ React113.useEffect(() => subscribeAutoApprovals(() => setRules(listAutoApprovals())), []);
8087
8117
  if (!rules.length) return null;
8088
8118
  return /* @__PURE__ */ jsxs("div", { className: "border-b border-border/40 px-3 py-2.5", children: [
8089
8119
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1 pb-1.5", children: [
@@ -8136,14 +8166,14 @@ function bucketOf(iso) {
8136
8166
  var ORDER = ["today", "yesterday", "week", "older"];
8137
8167
  function ChatHistory({ conversations, activeId, onSelect }) {
8138
8168
  const { t } = useTranslation$1();
8139
- const [query, setQuery] = React111.useState("");
8169
+ const [query, setQuery] = React113.useState("");
8140
8170
  const mine = conversations;
8141
- const filtered = React111.useMemo(() => {
8171
+ const filtered = React113.useMemo(() => {
8142
8172
  const needle = query.trim().toLowerCase();
8143
8173
  if (!needle) return mine;
8144
8174
  return mine.filter((c) => (c.title ?? "").toLowerCase().includes(needle));
8145
8175
  }, [mine, query]);
8146
- const groups = React111.useMemo(() => {
8176
+ const groups = React113.useMemo(() => {
8147
8177
  const map = /* @__PURE__ */ new Map();
8148
8178
  for (const conversation of filtered) {
8149
8179
  const bucket = bucketOf(conversation.updatedAt);
@@ -8222,14 +8252,127 @@ function formatWhen(iso) {
8222
8252
  const sameDay = (/* @__PURE__ */ new Date()).toDateString() === date.toDateString();
8223
8253
  return sameDay ? date.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }) : date.toLocaleDateString(void 0, { day: "2-digit", month: "short" });
8224
8254
  }
8255
+ function StepChecklist({ items }) {
8256
+ return /* @__PURE__ */ jsx("ol", { className: "border-t border-border/60 px-3 py-2", children: items.map((it, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 py-1 text-[12px]", children: [
8257
+ /* @__PURE__ */ jsx(
8258
+ "span",
8259
+ {
8260
+ className: "mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[10px] font-semibold tabular-nums " + (it.done ? "bg-primary text-primary-foreground" : it.current ? "bg-primary/15 text-primary ring-1 ring-primary" : "bg-muted text-muted-foreground"),
8261
+ children: it.done ? /* @__PURE__ */ jsx(Check, { className: "h-2.5 w-2.5" }) : i + 1
8262
+ }
8263
+ ),
8264
+ /* @__PURE__ */ jsx(
8265
+ "span",
8266
+ {
8267
+ className: "leading-snug " + (it.done ? "text-muted-foreground line-through decoration-muted-foreground/40" : it.current ? "font-medium text-foreground" : "text-muted-foreground"),
8268
+ children: it.label
8269
+ }
8270
+ )
8271
+ ] }, i)) });
8272
+ }
8273
+ function CoachCard({
8274
+ icon,
8275
+ title,
8276
+ subtitle,
8277
+ items,
8278
+ actions
8279
+ }) {
8280
+ return /* @__PURE__ */ jsxs("div", { className: "mx-3 mb-2 overflow-hidden rounded-xl border border-border bg-muted/40", children: [
8281
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 px-3 py-2", children: [
8282
+ icon,
8283
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
8284
+ /* @__PURE__ */ jsx("p", { className: "truncate text-[12px] font-semibold text-foreground", children: title }),
8285
+ /* @__PURE__ */ jsx("p", { className: "truncate text-[11px] text-muted-foreground", children: subtitle })
8286
+ ] }),
8287
+ actions
8288
+ ] }),
8289
+ /* @__PURE__ */ jsx(StepChecklist, { items })
8290
+ ] });
8291
+ }
8292
+ var LiveDot = /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2 shrink-0", children: [
8293
+ /* @__PURE__ */ jsx("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60" }),
8294
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-primary" })
8295
+ ] });
8296
+ function TourCoachCard() {
8297
+ const tour = useTourStore((s) => s.tour);
8298
+ const index = useTourStore((s) => s.index);
8299
+ const lastTour = useTourStore((s) => s.lastTour);
8300
+ const lastOutcome = useTourStore((s) => s.lastOutcome);
8301
+ const stop = useTourStore((s) => s.stop);
8302
+ const restart = useTourStore((s) => s.restart);
8303
+ const [dismissedId, setDismissedId] = React113.useState(null);
8304
+ const pTitle = usePracticeStore((s) => s.title);
8305
+ const pSteps = usePracticeStore((s) => s.steps);
8306
+ const pDone = usePracticeStore((s) => s.done);
8307
+ if (pTitle && pSteps.length > 0) {
8308
+ const doneCount = pSteps.filter((s) => pDone.includes(s.anchor)).length;
8309
+ const nextIdx = pSteps.findIndex((s) => !pDone.includes(s.anchor));
8310
+ return /* @__PURE__ */ jsx(
8311
+ CoachCard,
8312
+ {
8313
+ icon: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5 shrink-0 text-primary" }),
8314
+ title: pTitle,
8315
+ subtitle: `${tl("Now you try \u2014 fill it in", "Agora \xE9 voc\xEA \u2014 preencha")} \xB7 ${doneCount}/${pSteps.length}`,
8316
+ items: pSteps.map((s, i) => ({
8317
+ label: s.label,
8318
+ done: pDone.includes(s.anchor),
8319
+ current: i === nextIdx
8320
+ }))
8321
+ }
8322
+ );
8323
+ }
8324
+ const running = !!tour;
8325
+ const shown = tour ?? lastTour;
8326
+ if (!shown) return null;
8327
+ if (!running && shown.id === dismissedId) return null;
8328
+ if (!running && shown.practice?.length && lastOutcome?.tourId === shown.id) return null;
8329
+ const total = shown.stops.length;
8330
+ const completed = !running && lastOutcome?.tourId === shown.id && lastOutcome.completed;
8331
+ const doneThrough = running ? index : completed ? total : lastOutcome?.tourId === shown.id ? index : 0;
8332
+ return /* @__PURE__ */ jsx(
8333
+ CoachCard,
8334
+ {
8335
+ icon: completed ? /* @__PURE__ */ jsx(PartyPopper, { className: "h-3.5 w-3.5 shrink-0 text-primary" }) : running ? LiveDot : /* @__PURE__ */ jsx(Compass, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
8336
+ title: shown.title ?? tl("Guided tour", "Tour guiado"),
8337
+ subtitle: completed ? tl("Done \u2014 nice work!", "Conclu\xEDdo \u2014 mandou bem!") : `${Math.min(doneThrough, total)}/${total} ${tl("steps", "passos")}`,
8338
+ items: shown.stops.map((s, i) => ({
8339
+ label: s.title,
8340
+ done: i < doneThrough,
8341
+ current: running && i === index
8342
+ })),
8343
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
8344
+ /* @__PURE__ */ jsx(
8345
+ "button",
8346
+ {
8347
+ type: "button",
8348
+ onClick: restart,
8349
+ title: tl("Restart tour", "Reiniciar tour"),
8350
+ className: "rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
8351
+ children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-3.5 w-3.5" })
8352
+ }
8353
+ ),
8354
+ /* @__PURE__ */ jsx(
8355
+ "button",
8356
+ {
8357
+ type: "button",
8358
+ onClick: () => running ? stop(false) : setDismissedId(shown.id),
8359
+ title: running ? tl("End tour", "Encerrar tour") : tl("Dismiss", "Dispensar"),
8360
+ className: "rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
8361
+ children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
8362
+ }
8363
+ )
8364
+ ] })
8365
+ }
8366
+ );
8367
+ }
8225
8368
  function AssistantRecordingView({ activity }) {
8226
8369
  const { t } = useTranslation$1();
8227
8370
  const pending2 = activity.state === "pending";
8228
8371
  const live = activity.state === "running" || activity.state === "paused";
8229
8372
  const running = activity.state === "running";
8230
8373
  const actions = activity.actions ?? [];
8231
- const [acknowledged, setAcknowledged] = React111.useState(false);
8232
- React111.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
8374
+ const [acknowledged, setAcknowledged] = React113.useState(false);
8375
+ React113.useEffect(() => setAcknowledged(false), [activity.id, activity.state]);
8233
8376
  const withheld = pending2 && !!activity.confirm && !acknowledged;
8234
8377
  const primary = actions.filter((a) => a.intent !== "discard");
8235
8378
  const discard = actions.find((a) => a.intent === "discard");
@@ -8445,10 +8588,10 @@ function RightRailPage({
8445
8588
  const closePage = useRightRailStore((s) => s.closePage);
8446
8589
  const active2 = hosted && open;
8447
8590
  const pageOpen = useRightRailStore((s) => s.pageOpen);
8448
- const onCloseRef = React111.useRef(onClose);
8591
+ const onCloseRef = React113.useRef(onClose);
8449
8592
  onCloseRef.current = onClose;
8450
- const claimed = React111.useRef(false);
8451
- React111.useEffect(() => {
8593
+ const claimed = React113.useRef(false);
8594
+ React113.useEffect(() => {
8452
8595
  if (!active2) return;
8453
8596
  showPage();
8454
8597
  claimed.current = true;
@@ -8457,7 +8600,7 @@ function RightRailPage({
8457
8600
  closePage();
8458
8601
  };
8459
8602
  }, [active2, showPage, closePage]);
8460
- React111.useEffect(() => {
8603
+ React113.useEffect(() => {
8461
8604
  if (!claimed.current) return;
8462
8605
  if (!useRightRailStore.getState().pageOpen) onCloseRef.current();
8463
8606
  }, [pageOpen]);
@@ -8660,15 +8803,15 @@ function ConnectorSyncActions({
8660
8803
  actions,
8661
8804
  onRan
8662
8805
  }) {
8663
- const [running, setRunning] = React111__default.useState(null);
8664
- const [open, setOpen] = React111__default.useState(null);
8665
- const [pending2, setPending] = React111__default.useState(null);
8666
- const [hidden, setHidden] = React111__default.useState(() => /* @__PURE__ */ new Set());
8667
- const [queued, setQueued] = React111__default.useState({});
8668
- const [nonce, setNonce] = React111__default.useState(0);
8669
- const [expanded, setExpanded] = React111__default.useState(false);
8670
- const [resolved, setResolved] = React111__default.useState(false);
8671
- React111__default.useEffect(() => {
8806
+ const [running, setRunning] = React113__default.useState(null);
8807
+ const [open, setOpen] = React113__default.useState(null);
8808
+ const [pending2, setPending] = React113__default.useState(null);
8809
+ const [hidden, setHidden] = React113__default.useState(() => /* @__PURE__ */ new Set());
8810
+ const [queued, setQueued] = React113__default.useState({});
8811
+ const [nonce, setNonce] = React113__default.useState(0);
8812
+ const [expanded, setExpanded] = React113__default.useState(false);
8813
+ const [resolved, setResolved] = React113__default.useState(false);
8814
+ React113__default.useEffect(() => {
8672
8815
  let cancelled = false;
8673
8816
  setResolved(false);
8674
8817
  void Promise.all(
@@ -8853,10 +8996,10 @@ function formatRelative(iso, t) {
8853
8996
  }
8854
8997
  function useConnectorRuns(connector) {
8855
8998
  const listRuns = connector.definition?.listRuns;
8856
- const [runs, setRuns] = React111__default.useState([]);
8857
- const [loading, setLoading] = React111__default.useState(!!listRuns);
8858
- const [nonce, setNonce] = React111__default.useState(0);
8859
- React111__default.useEffect(() => {
8999
+ const [runs, setRuns] = React113__default.useState([]);
9000
+ const [loading, setLoading] = React113__default.useState(!!listRuns);
9001
+ const [nonce, setNonce] = React113__default.useState(0);
9002
+ React113__default.useEffect(() => {
8860
9003
  if (!listRuns) {
8861
9004
  setRuns([]);
8862
9005
  setLoading(false);
@@ -8878,7 +9021,7 @@ function useConnectorRuns(connector) {
8878
9021
  return {
8879
9022
  runs,
8880
9023
  loading,
8881
- reload: React111__default.useCallback(() => setNonce((n) => n + 1), []),
9024
+ reload: React113__default.useCallback(() => setNonce((n) => n + 1), []),
8882
9025
  failing: isFailing(runs)
8883
9026
  };
8884
9027
  }
@@ -8978,7 +9121,7 @@ function RunFailure({ run }) {
8978
9121
  ),
8979
9122
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: t("connectors.runs.seeDetails") })
8980
9123
  ] }),
8981
- facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(React111__default.Fragment, { children: [
9124
+ facts.length > 0 && /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 border-t border-border px-2 py-2 text-[11px] leading-relaxed", children: facts.map(([label2, value]) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
8982
9125
  /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: label2 }),
8983
9126
  /* @__PURE__ */ jsx("dd", { className: "min-w-0 break-words font-mono text-foreground/80", children: value })
8984
9127
  ] }, label2)) }),
@@ -9147,13 +9290,13 @@ function ConnectorSettingsPanel({
9147
9290
  const { t } = useTranslation$1();
9148
9291
  const def = connector.definition;
9149
9292
  const settings = def ? connectorSettings(def) : [];
9150
- const [values, setValues] = React111__default.useState(
9293
+ const [values, setValues] = React113__default.useState(
9151
9294
  () => initialValues(settings, {})
9152
9295
  );
9153
- const [loaded2, setLoaded] = React111__default.useState(false);
9154
- const [saving, setSaving] = React111__default.useState(false);
9155
- const [dirty, setDirty] = React111__default.useState(false);
9156
- React111__default.useEffect(() => {
9296
+ const [loaded2, setLoaded] = React113__default.useState(false);
9297
+ const [saving, setSaving] = React113__default.useState(false);
9298
+ const [dirty, setDirty] = React113__default.useState(false);
9299
+ React113__default.useEffect(() => {
9157
9300
  if (settings.length === 0 || !def?.getSettings) return;
9158
9301
  let cancelled = false;
9159
9302
  setLoaded(false);
@@ -9404,13 +9547,13 @@ function ConnectorInstall({
9404
9547
  }) {
9405
9548
  const { t } = useTranslation$1();
9406
9549
  const def = connector.definition;
9407
- const [plane, setPlane] = React111__default.useState(
9550
+ const [plane, setPlane] = React113__default.useState(
9408
9551
  connector.planes.includes("agentic") ? "agentic" : connector.planes[0]
9409
9552
  );
9410
- const [values, setValues] = React111__default.useState({});
9411
- const secrets = React111__default.useRef({});
9412
- const [busy, setBusy] = React111__default.useState(null);
9413
- React111__default.useEffect(() => {
9553
+ const [values, setValues] = React113__default.useState({});
9554
+ const secrets = React113__default.useRef({});
9555
+ const [busy, setBusy] = React113__default.useState(null);
9556
+ React113__default.useEffect(() => {
9414
9557
  setValues({});
9415
9558
  secrets.current = {};
9416
9559
  setBusy(null);
@@ -9451,15 +9594,15 @@ function ConnectorHome({
9451
9594
  const needsSetup = connector.state === "needs_setup";
9452
9595
  const settingsAvailable = hasOperatingSettings(connector);
9453
9596
  const runsAvailable = hasRunHistory(connector);
9454
- const [tab, setTab] = React111__default.useState(
9597
+ const [tab, setTab] = React113__default.useState(
9455
9598
  needsSetup && settingsAvailable ? "settings" : "overview"
9456
9599
  );
9457
- const [busy, setBusy] = React111__default.useState(null);
9600
+ const [busy, setBusy] = React113__default.useState(null);
9458
9601
  const run = useRunner(setBusy, onChanged);
9459
- const [values, setValues] = React111__default.useState({});
9460
- const secrets = React111__default.useRef({});
9602
+ const [values, setValues] = React113__default.useState({});
9603
+ const secrets = React113__default.useRef({});
9461
9604
  const runs = useConnectorRuns(connector);
9462
- React111__default.useEffect(() => {
9605
+ React113__default.useEffect(() => {
9463
9606
  setTab(needsSetup && settingsAvailable ? "settings" : "overview");
9464
9607
  setBusy(null);
9465
9608
  setValues({});
@@ -9549,7 +9692,7 @@ function ConnectorHome({
9549
9692
  }
9550
9693
  function useRunner(setBusy, onChanged) {
9551
9694
  const { t } = useTranslation$1();
9552
- return React111__default.useCallback(
9695
+ return React113__default.useCallback(
9553
9696
  async (kind, fn, okMessage) => {
9554
9697
  setBusy(kind);
9555
9698
  try {
@@ -9665,7 +9808,7 @@ function ConnectPanel({
9665
9808
  const sinkMissing = needsSink && !getConnectorCredentialSink();
9666
9809
  const secretFieldCount = (def.fields ?? []).filter(isSecretField).length;
9667
9810
  const hasStoredCredential = connector.state === "connected" || connector.state === "needs_setup";
9668
- const [formKey, setFormKey] = React111__default.useState(0);
9811
+ const [formKey, setFormKey] = React113__default.useState(0);
9669
9812
  if (def.authKind === "oauth") {
9670
9813
  return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9671
9814
  /* @__PURE__ */ jsx(Note, { children: t("connectors.authorize.oauthOnly") }),
@@ -9798,7 +9941,7 @@ function GrantRevoke({
9798
9941
  onRevoke
9799
9942
  }) {
9800
9943
  const { t } = useTranslation$1();
9801
- const [revoking, setRevoking] = React111__default.useState(false);
9944
+ const [revoking, setRevoking] = React113__default.useState(false);
9802
9945
  if (connector.revocable === false) {
9803
9946
  return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("connectors.partOfApp") });
9804
9947
  }
@@ -9837,14 +9980,14 @@ function ConnectorsPanel({ onClose }) {
9837
9980
  const { connectors, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
9838
9981
  const selectedId = useConnectorsSurface((s) => s.selected);
9839
9982
  const select = useConnectorsSurface((s) => s.select);
9840
- const [query, setQuery] = React111__default.useState("");
9841
- const [failure, setFailure] = React111__default.useState(null);
9842
- const [revoking, setRevoking] = React111__default.useState(null);
9843
- const selected = React111__default.useMemo(
9983
+ const [query, setQuery] = React113__default.useState("");
9984
+ const [failure, setFailure] = React113__default.useState(null);
9985
+ const [revoking, setRevoking] = React113__default.useState(null);
9986
+ const selected = React113__default.useMemo(
9844
9987
  () => (connectors ?? []).find((c) => c.id === selectedId) ?? null,
9845
9988
  [connectors, selectedId]
9846
9989
  );
9847
- const filtered = React111__default.useMemo(
9990
+ const filtered = React113__default.useMemo(
9848
9991
  () => filterConnectors(connectors ?? [], "outbound", query),
9849
9992
  [connectors, query]
9850
9993
  );
@@ -9855,9 +9998,9 @@ function ConnectorsPanel({ onClose }) {
9855
9998
  back: onClose
9856
9999
  } : null
9857
10000
  );
9858
- const closeRef = React111__default.useRef(onClose);
10001
+ const closeRef = React113__default.useRef(onClose);
9859
10002
  closeRef.current = onClose;
9860
- React111__default.useEffect(() => {
10003
+ React113__default.useEffect(() => {
9861
10004
  if (hosted && !selectedId) closeRef.current();
9862
10005
  }, [hosted, selectedId]);
9863
10006
  return /* @__PURE__ */ jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
@@ -9985,20 +10128,20 @@ function useDictation({
9985
10128
  onInterim
9986
10129
  }) {
9987
10130
  const resolvedLocale = locale ?? (typeof navigator !== "undefined" ? navigator.language || "pt-BR" : "pt-BR");
9988
- const [state, setState] = React111.useState("idle");
9989
- const [error, setError] = React111.useState(null);
9990
- const sessionRef = React111.useRef(null);
9991
- const callbacks = React111.useRef({ onTranscript, onInterim });
10131
+ const [state, setState] = React113.useState("idle");
10132
+ const [error, setError] = React113.useState(null);
10133
+ const sessionRef = React113.useRef(null);
10134
+ const callbacks = React113.useRef({ onTranscript, onInterim });
9992
10135
  callbacks.current = { onTranscript, onInterim };
9993
- const supported = React111.useMemo(
10136
+ const supported = React113.useMemo(
9994
10137
  () => isDictationSupported(!!transcribeEndpoint),
9995
10138
  [transcribeEndpoint]
9996
10139
  );
9997
- const finish = React111.useCallback(() => {
10140
+ const finish = React113.useCallback(() => {
9998
10141
  sessionRef.current = null;
9999
10142
  setState("idle");
10000
10143
  }, []);
10001
- const start = React111.useCallback(() => {
10144
+ const start = React113.useCallback(() => {
10002
10145
  if (sessionRef.current || !supported) return;
10003
10146
  stopSpeaking();
10004
10147
  setError(null);
@@ -10019,28 +10162,28 @@ function useDictation({
10019
10162
  }
10020
10163
  );
10021
10164
  }, [finish, resolvedLocale, supported, transcribeEndpoint]);
10022
- const stop = React111.useCallback(() => {
10165
+ const stop = React113.useCallback(() => {
10023
10166
  if (!sessionRef.current) return;
10024
10167
  if (transcribeEndpoint) setState("transcribing");
10025
10168
  sessionRef.current.stop();
10026
10169
  }, [transcribeEndpoint]);
10027
- const cancel = React111.useCallback(() => {
10170
+ const cancel = React113.useCallback(() => {
10028
10171
  sessionRef.current?.cancel();
10029
10172
  sessionRef.current = null;
10030
10173
  setState("idle");
10031
10174
  setError(null);
10032
10175
  }, []);
10033
- const toggle = React111.useCallback(() => {
10176
+ const toggle = React113.useCallback(() => {
10034
10177
  if (state === "listening" || state === "transcribing") stop();
10035
10178
  else start();
10036
10179
  }, [state, start, stop]);
10037
- React111.useEffect(() => () => sessionRef.current?.cancel(), []);
10180
+ React113.useEffect(() => () => sessionRef.current?.cancel(), []);
10038
10181
  return { supported, state, error, start, stop, cancel, toggle, clearError: () => setError(null) };
10039
10182
  }
10040
10183
  function useMicLevels(active2, bandCount = 28, externalStream) {
10041
- const levelsRef = React111.useRef(new Float32Array(bandCount));
10042
- const [available, setAvailable] = React111.useState(false);
10043
- React111.useEffect(() => {
10184
+ const levelsRef = React113.useRef(new Float32Array(bandCount));
10185
+ const [available, setAvailable] = React113.useState(false);
10186
+ React113.useEffect(() => {
10044
10187
  if (!active2) {
10045
10188
  levelsRef.current.fill(0);
10046
10189
  setAvailable(false);
@@ -10109,8 +10252,8 @@ var KIND_ICON = {
10109
10252
  binary: File$1
10110
10253
  };
10111
10254
  function useFileDrop(enabled, onFiles) {
10112
- const [dragging, setDragging] = React111.useState(false);
10113
- const depth = React111.useRef(0);
10255
+ const [dragging, setDragging] = React113.useState(false);
10256
+ const depth = React113.useRef(0);
10114
10257
  const carriesFiles = (event) => Array.from(event.dataTransfer?.types ?? []).includes("Files");
10115
10258
  const reset = () => {
10116
10259
  depth.current = 0;
@@ -10170,7 +10313,7 @@ function AttachmentChips({
10170
10313
  onRemove
10171
10314
  }) {
10172
10315
  const { t } = useTranslation$1();
10173
- const [openId, setOpenId] = React111.useState(null);
10316
+ const [openId, setOpenId] = React113.useState(null);
10174
10317
  if (!attachments.length) return null;
10175
10318
  const opened = attachments.find((a) => a.id === openId);
10176
10319
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -10311,8 +10454,8 @@ function ChatComposer({
10311
10454
  autoFocus
10312
10455
  }) {
10313
10456
  const { t } = useTranslation$1();
10314
- const [input, setInput] = React111.useState("");
10315
- const textareaRef = React111.useRef(null);
10457
+ const [input, setInput] = React113.useState("");
10458
+ const textareaRef = React113.useRef(null);
10316
10459
  const voiceStartRequested = useChatStore((s) => s.voiceStartRequested);
10317
10460
  const consumeVoiceStart = useChatStore((s) => s.consumeVoiceStart);
10318
10461
  const draft = useChatStore((s) => s.draft);
@@ -10325,13 +10468,13 @@ function ChatComposer({
10325
10468
  const removeAttachment = useChatStore((s) => s.removeAttachment);
10326
10469
  const composerMedia = useChatStore((s) => s.composerMedia);
10327
10470
  const clearComposerMedia = useChatStore((s) => s.clearComposerMedia);
10328
- const fileInputRef = React111.useRef(null);
10471
+ const fileInputRef = React113.useRef(null);
10329
10472
  const autoSend = voice?.autoSend === true;
10330
10473
  const micEnabled = voice?.input !== false;
10331
10474
  const canAttach = isConfigured && !blocked && !isStreaming;
10332
10475
  const parsing = attachments.some((a) => a.status === "parsing");
10333
10476
  const readyAttachments = attachments.filter((a) => a.status === "ready").length;
10334
- const submit = React111.useCallback(
10477
+ const submit = React113.useCallback(
10335
10478
  (text2) => {
10336
10479
  const trimmed = text2.trim();
10337
10480
  const media = useChatStore.getState().composerMedia;
@@ -10361,7 +10504,7 @@ function ChatComposer({
10361
10504
  }
10362
10505
  }
10363
10506
  });
10364
- React111.useEffect(() => {
10507
+ React113.useEffect(() => {
10365
10508
  if (!autoFocus) return;
10366
10509
  const id = requestAnimationFrame(() => textareaRef.current?.focus());
10367
10510
  return () => cancelAnimationFrame(id);
@@ -10373,7 +10516,7 @@ function ChatComposer({
10373
10516
  const WAVEFORM_BANDS = 56;
10374
10517
  const activity = useAssistantActivity();
10375
10518
  const sessionRecording = activity?.kind === "recording" && activity.state === "running";
10376
- const sessionStream = React111.useMemo(
10519
+ const sessionStream = React113.useMemo(
10377
10520
  () => sessionRecording ? activity?.stream?.() ?? null : null,
10378
10521
  [sessionRecording, activity]
10379
10522
  );
@@ -10385,12 +10528,12 @@ function ChatComposer({
10385
10528
  );
10386
10529
  const sessionPause = activity?.actions?.find((a) => a.intent === "pause" || a.intent === "resume");
10387
10530
  const sessionOwnsMic = activity?.kind === "recording" && (activity.state === "running" || activity.state === "paused");
10388
- React111.useEffect(() => {
10531
+ React113.useEffect(() => {
10389
10532
  if (!voiceStartRequested) return;
10390
10533
  consumeVoiceStart();
10391
10534
  if (showMic) dictation.start();
10392
10535
  }, [voiceStartRequested, showMic]);
10393
- React111.useEffect(() => {
10536
+ React113.useEffect(() => {
10394
10537
  if (!focusRequested) return;
10395
10538
  let frames = 0;
10396
10539
  let raf = 0;
@@ -10407,7 +10550,7 @@ function ChatComposer({
10407
10550
  raf = requestAnimationFrame(tick);
10408
10551
  return () => cancelAnimationFrame(raf);
10409
10552
  }, [focusRequested, consumeComposerFocus]);
10410
- React111.useEffect(() => {
10553
+ React113.useEffect(() => {
10411
10554
  if (!draft) return;
10412
10555
  setInput(draft);
10413
10556
  setDraft("");
@@ -10417,7 +10560,7 @@ function ChatComposer({
10417
10560
  el.setSelectionRange(draft.length, draft.length);
10418
10561
  }
10419
10562
  }, [draft, setDraft]);
10420
- React111.useLayoutEffect(() => {
10563
+ React113.useLayoutEffect(() => {
10421
10564
  const el = textareaRef.current;
10422
10565
  if (!el) return;
10423
10566
  const style = getComputedStyle(el);
@@ -10620,8 +10763,8 @@ function UploadRequestCard() {
10620
10763
  const removeUploadFile = useChatStore((s) => s.removeUploadFile);
10621
10764
  const submitUpload = useChatStore((s) => s.submitUpload);
10622
10765
  const clearUploadRequest = useChatStore((s) => s.clearUploadRequest);
10623
- const cameraRef = React111.useRef(null);
10624
- const browseRef = React111.useRef(null);
10766
+ const cameraRef = React113.useRef(null);
10767
+ const browseRef = React113.useRef(null);
10625
10768
  if (!request) return null;
10626
10769
  const working = request.status === "working";
10627
10770
  const accept = request.accept ?? "image/*";
@@ -10763,8 +10906,8 @@ function LiveWaveform({
10763
10906
  compact,
10764
10907
  tone = "primary"
10765
10908
  }) {
10766
- const barsRef = React111.useRef([]);
10767
- React111.useEffect(() => {
10909
+ const barsRef = React113.useRef([]);
10910
+ React113.useEffect(() => {
10768
10911
  if (!live) return;
10769
10912
  let frame = 0;
10770
10913
  const draw = () => {
@@ -10812,6 +10955,25 @@ function LiveWaveform({
10812
10955
  )
10813
10956
  );
10814
10957
  }
10958
+ function MdLink({ href, children }) {
10959
+ const external = /^https?:\/\//.test(href);
10960
+ if (external) {
10961
+ return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noreferrer", className: "underline underline-offset-2", children });
10962
+ }
10963
+ const path = href.startsWith("#") ? href.slice(1) : href;
10964
+ return /* @__PURE__ */ jsx(
10965
+ "a",
10966
+ {
10967
+ href: `#${path}`,
10968
+ onClick: (e) => {
10969
+ e.preventDefault();
10970
+ navigateTo(path);
10971
+ },
10972
+ className: "font-medium text-primary underline underline-offset-2 hover:text-primary/80",
10973
+ children
10974
+ }
10975
+ );
10976
+ }
10815
10977
  function renderInline(text2, keyBase) {
10816
10978
  const out = [];
10817
10979
  const pattern = /(`[^`]+`)|(\*\*[^*]+\*\*)|(\*[^*]+\*)|(\[[^\]]+\]\([^)\s]+\))/g;
@@ -10834,7 +10996,7 @@ function renderInline(text2, keyBase) {
10834
10996
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(token);
10835
10997
  if (link && /^(https?:\/\/|\/|#)/.test(link[2])) {
10836
10998
  out.push(
10837
- /* @__PURE__ */ jsx("a", { href: link[2], target: "_blank", rel: "noreferrer", className: "underline underline-offset-2", children: renderInline(link[1], key) }, key)
10999
+ /* @__PURE__ */ jsx(MdLink, { href: link[2], children: renderInline(link[1], key) }, key)
10838
11000
  );
10839
11001
  } else {
10840
11002
  out.push(token);
@@ -10845,6 +11007,7 @@ function renderInline(text2, keyBase) {
10845
11007
  if (last < text2.length) out.push(text2.slice(last));
10846
11008
  return out;
10847
11009
  }
11010
+ var LIST_RE = /^(\s*)([-*]|\d+[.)])\s+(.*)$/;
10848
11011
  function ChatMarkdown({ content }) {
10849
11012
  const blocks = [];
10850
11013
  const lines = content.split("\n");
@@ -10858,28 +11021,64 @@ function ChatMarkdown({ content }) {
10858
11021
  }
10859
11022
  const heading = /^(#{1,4})\s+(.*)$/.exec(line);
10860
11023
  if (heading) {
11024
+ const major = heading[1].length <= 2;
10861
11025
  blocks.push(
10862
- /* @__PURE__ */ jsx("p", { className: "mt-1.5 font-semibold first:mt-0", children: renderInline(heading[2], `h${key}`) }, key++)
11026
+ /* @__PURE__ */ jsx(
11027
+ "p",
11028
+ {
11029
+ className: major ? "mt-3 text-[14px] font-bold first:mt-0" : "mt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground first:mt-0",
11030
+ children: renderInline(heading[2], `h${key}`)
11031
+ },
11032
+ key++
11033
+ )
10863
11034
  );
10864
11035
  i++;
10865
11036
  continue;
10866
11037
  }
10867
- if (/^\s*([-*]|\d+[.)])\s+/.test(line)) {
11038
+ const listStart = LIST_RE.exec(line);
11039
+ if (listStart) {
11040
+ const baseIndent = listStart[1].length;
11041
+ const ordered = /^\d/.test(listStart[2]);
11042
+ const start = ordered ? parseInt(listStart[2], 10) : void 0;
10868
11043
  const items = [];
10869
- const ordered = /^\s*\d+[.)]\s+/.test(line);
10870
- while (i < lines.length && /^\s*([-*]|\d+[.)])\s+/.test(lines[i])) {
10871
- const item = lines[i].replace(/^\s*([-*]|\d+[.)])\s+/, "");
10872
- items.push(/* @__PURE__ */ jsx("li", { children: renderInline(item, `li${key}-${items.length}`) }, items.length));
11044
+ while (i < lines.length) {
11045
+ const m = LIST_RE.exec(lines[i]);
11046
+ if (!m) break;
11047
+ if (m[1].length > baseIndent) {
11048
+ const subOrdered = /^\d/.test(m[2]);
11049
+ const subStart = subOrdered ? parseInt(m[2], 10) : void 0;
11050
+ const subItems = [];
11051
+ while (i < lines.length) {
11052
+ const sm = LIST_RE.exec(lines[i]);
11053
+ if (!sm || sm[1].length <= baseIndent) break;
11054
+ subItems.push(/* @__PURE__ */ jsx("li", { children: renderInline(sm[3], `sli${key}-${subItems.length}`) }, subItems.length));
11055
+ i++;
11056
+ }
11057
+ const sub = subOrdered ? /* @__PURE__ */ jsx("ol", { start: subStart, className: "mt-0.5 space-y-0.5 pl-4 list-decimal", children: subItems }, `sub${items.length}`) : /* @__PURE__ */ jsx("ul", { className: "mt-0.5 space-y-0.5 pl-4 list-disc", children: subItems }, `sub${items.length}`);
11058
+ const prev = items.pop();
11059
+ if (prev && React113.isValidElement(prev)) {
11060
+ items.push(
11061
+ /* @__PURE__ */ jsxs("li", { children: [
11062
+ prev.props.children,
11063
+ sub
11064
+ ] }, items.length)
11065
+ );
11066
+ } else {
11067
+ items.push(/* @__PURE__ */ jsx("li", { children: sub }, items.length));
11068
+ }
11069
+ continue;
11070
+ }
11071
+ items.push(/* @__PURE__ */ jsx("li", { children: renderInline(m[3], `li${key}-${items.length}`) }, items.length));
10873
11072
  i++;
10874
11073
  }
10875
11074
  const listClass = "my-1 space-y-0.5 pl-4 first:mt-0 last:mb-0";
10876
11075
  blocks.push(
10877
- ordered ? /* @__PURE__ */ jsx("ol", { className: `${listClass} list-decimal`, children: items }, key++) : /* @__PURE__ */ jsx("ul", { className: `${listClass} list-disc`, children: items }, key++)
11076
+ ordered ? /* @__PURE__ */ jsx("ol", { start, className: `${listClass} list-decimal`, children: items }, key++) : /* @__PURE__ */ jsx("ul", { className: `${listClass} list-disc`, children: items }, key++)
10878
11077
  );
10879
11078
  continue;
10880
11079
  }
10881
11080
  const para = [];
10882
- while (i < lines.length && lines[i].trim() && !/^\s*([-*]|\d+[.)])\s+/.test(lines[i]) && !/^#{1,4}\s+/.test(lines[i])) {
11081
+ while (i < lines.length && lines[i].trim() && !LIST_RE.test(lines[i]) && !/^#{1,4}\s+/.test(lines[i])) {
10883
11082
  if (para.length) para.push(/* @__PURE__ */ jsx("br", {}, `br${key}-${para.length}`));
10884
11083
  para.push(...renderInline(lines[i], `p${key}-${para.length}`));
10885
11084
  i++;
@@ -10954,7 +11153,7 @@ var CARD_CTA = {
10954
11153
  function useConnectorJourney(card) {
10955
11154
  const panelAvailable = useConnectorsPanelAvailable();
10956
11155
  useChatStore((s) => s.setOpen);
10957
- return React111.useCallback(() => {
11156
+ return React113.useCallback(() => {
10958
11157
  if (panelAvailable && card.id) {
10959
11158
  openConnectorsPanel({ id: card.id });
10960
11159
  return;
@@ -11044,7 +11243,7 @@ function ConnectorSuggestionRow({ card }) {
11044
11243
  ] });
11045
11244
  }
11046
11245
  function ConnectorSuggestionGroup({ cards }) {
11047
- const shelves = React111.useMemo(() => shelveByCategory(cards), [cards]);
11246
+ const shelves = React113.useMemo(() => shelveByCategory(cards), [cards]);
11048
11247
  return /* @__PURE__ */ jsx("div", { className: "w-full max-w-[88%] overflow-hidden rounded-xl border border-border/60 bg-card/60 motion-safe:animate-zoom-in", children: shelves.map((shelf, shelfIndex) => /* @__PURE__ */ jsxs("div", { className: cn(shelfIndex > 0 && "border-t border-border/50"), children: [
11049
11248
  shelf.label && /* @__PURE__ */ jsx("p", { className: "bg-background/40 px-2.5 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: shelf.label }),
11050
11249
  /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/40", children: shelf.items.map((card) => /* @__PURE__ */ jsx(ConnectorSuggestionRow, { card }, card.slug ?? card.id ?? card.name)) })
@@ -11054,8 +11253,8 @@ function ChoiceCard({ card }) {
11054
11253
  const queuePrompt = useChatStore((s) => s.queuePrompt);
11055
11254
  const isStreaming = useChatStore((s) => s.isStreaming);
11056
11255
  const messages = useChatStore((s) => s.messages);
11057
- const [optimistic, setOptimistic] = React111.useState(null);
11058
- const answeredInThread = React111.useMemo(
11256
+ const [optimistic, setOptimistic] = React113.useState(null);
11257
+ const answeredInThread = React113.useMemo(
11059
11258
  () => answeredOptionId(messages, card.options),
11060
11259
  [messages, card.options]
11061
11260
  );
@@ -11110,7 +11309,7 @@ function humanizeToolName(name) {
11110
11309
  }
11111
11310
  function ToolCallRow({ call: call2 }) {
11112
11311
  const { t } = useTranslation$1();
11113
- const [open, setOpen] = React111.useState(false);
11312
+ const [open, setOpen] = React113.useState(false);
11114
11313
  const failed = call2.declined || /"error"\s*:/.test(call2.result ?? "");
11115
11314
  return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-xl border border-border/50 bg-muted/30", children: [
11116
11315
  /* @__PURE__ */ jsxs(
@@ -11187,15 +11386,15 @@ function HandoffNotice({ notice }) {
11187
11386
  }
11188
11387
  function MessageBubble({ message, isPending }) {
11189
11388
  const isUser = message.role === "user";
11190
- const connectorCards = React111.useMemo(
11389
+ const connectorCards = React113.useMemo(
11191
11390
  () => (message.cards ?? []).filter((card) => card.kind === "connector"),
11192
11391
  [message.cards]
11193
11392
  );
11194
- const choiceCards = React111.useMemo(
11393
+ const choiceCards = React113.useMemo(
11195
11394
  () => (message.cards ?? []).filter((card) => card.kind === "choice"),
11196
11395
  [message.cards]
11197
11396
  );
11198
- const routedLinks = React111.useMemo(
11397
+ const routedLinks = React113.useMemo(
11199
11398
  () => (message.links ?? []).filter(
11200
11399
  (l) => !!l.path || !!resolveEntityRoute(l.archetype, l.kind, l.entityKey)
11201
11400
  ),
@@ -11286,9 +11485,9 @@ function ConfirmActionCard({
11286
11485
  onResolveAll
11287
11486
  }) {
11288
11487
  const { t } = useTranslation$1();
11289
- const schema = React111.useMemo(() => action.fields ?? [], [action.fields]);
11488
+ const schema = React113.useMemo(() => action.fields ?? [], [action.fields]);
11290
11489
  const partial = action.partial === true;
11291
- const seedValues = React111.useCallback(
11490
+ const seedValues = React113.useCallback(
11292
11491
  (params) => {
11293
11492
  if (partial) return { ...params };
11294
11493
  const seeded = {};
@@ -11297,18 +11496,18 @@ function ConfirmActionCard({
11297
11496
  },
11298
11497
  [schema, partial]
11299
11498
  );
11300
- const [values, setValues] = React111.useState(() => seedValues(action.params));
11301
- const [showAll, setShowAll] = React111.useState(false);
11499
+ const [values, setValues] = React113.useState(() => seedValues(action.params));
11500
+ const [showAll, setShowAll] = React113.useState(false);
11302
11501
  const batch = Math.max(0, sameToolQueued);
11303
- React111.useEffect(() => setValues(seedValues(action.params)), [action.params, seedValues]);
11502
+ React113.useEffect(() => setValues(seedValues(action.params)), [action.params, seedValues]);
11304
11503
  const isSet = (v) => v !== void 0 && v !== null && v !== "";
11305
- const primaryKeys = React111.useMemo(() => {
11504
+ const primaryKeys = React113.useMemo(() => {
11306
11505
  const keys = Object.keys(action.params).filter((k) => isSet(action.params[k]));
11307
11506
  if (partial) return keys;
11308
11507
  for (const f of schema) if (f.required && !keys.includes(f.key)) keys.push(f.key);
11309
11508
  return keys;
11310
11509
  }, [action.params, schema, partial]);
11311
- const extraKeys = React111.useMemo(
11510
+ const extraKeys = React113.useMemo(
11312
11511
  () => schema.map((f) => f.key).filter((k) => !primaryKeys.includes(k) && k !== "id"),
11313
11512
  [schema, primaryKeys]
11314
11513
  );
@@ -11325,20 +11524,20 @@ function ConfirmActionCard({
11325
11524
  const translatedTool = t(toolKey);
11326
11525
  const heading = action.title ?? (translatedTool !== toolKey ? translatedTool : humanizeToolName(action.toolName));
11327
11526
  const ruleLabel = action.scopeLabel ?? heading;
11328
- const missingRequiredKeys = React111.useMemo(
11527
+ const missingRequiredKeys = React113.useMemo(
11329
11528
  () => partial ? [] : schema.filter((f) => f.required && !isSet(values[f.key])).map((f) => f.key),
11330
11529
  [schema, values, partial]
11331
11530
  );
11332
11531
  const canConfirm = missingRequiredKeys.length === 0;
11333
- const submitted = React111.useCallback(
11532
+ const submitted = React113.useCallback(
11334
11533
  () => partial ? Object.fromEntries(Object.entries(values).filter(([, v]) => isSet(v))) : values,
11335
11534
  [partial, values]
11336
11535
  );
11337
- const approve = React111.useCallback(() => {
11536
+ const approve = React113.useCallback(() => {
11338
11537
  if (canConfirm) onResolve(true, submitted());
11339
11538
  }, [canConfirm, onResolve, submitted]);
11340
- const decline = React111.useCallback(() => onResolve(false), [onResolve]);
11341
- const approveAlways = React111.useCallback(() => {
11539
+ const decline = React113.useCallback(() => onResolve(false), [onResolve]);
11540
+ const approveAlways = React113.useCallback(() => {
11342
11541
  if (!canConfirm) return;
11343
11542
  grantAutoApproval({
11344
11543
  toolName: action.toolName,
@@ -11348,7 +11547,7 @@ function ConfirmActionCard({
11348
11547
  });
11349
11548
  onResolve(true, submitted());
11350
11549
  }, [canConfirm, action.toolName, action.scope, ruleLabel, destructive, onResolve, submitted]);
11351
- React111.useEffect(() => {
11550
+ React113.useEffect(() => {
11352
11551
  const handler = (event) => {
11353
11552
  const target = event.target;
11354
11553
  const typing = target?.tagName === "INPUT" || target?.tagName === "TEXTAREA" || target?.tagName === "SELECT";
@@ -11584,8 +11783,10 @@ function formatValue(value) {
11584
11783
  }
11585
11784
  return text2;
11586
11785
  }
11786
+ var PLAIN_DATE = /^\d{4}-\d{2}-\d{2}$/;
11587
11787
  function toInputDate(value, type) {
11588
11788
  if (typeof value !== "string" || !value) return "";
11789
+ if (PLAIN_DATE.test(value)) return type === "time" ? "" : value.slice(0, 10);
11589
11790
  const parsed = new Date(value);
11590
11791
  if (Number.isNaN(parsed.getTime())) return value;
11591
11792
  const pad = (n) => String(n).padStart(2, "0");
@@ -11644,7 +11845,8 @@ function FieldInput({
11644
11845
  onChange: (e) => {
11645
11846
  const raw = e.target.value;
11646
11847
  if (!raw) return onChange("");
11647
- onChange(type === "time" ? raw : new Date(raw).toISOString());
11848
+ if (type === "time" || type === "date") return onChange(raw);
11849
+ onChange(new Date(raw).toISOString());
11648
11850
  },
11649
11851
  className: base
11650
11852
  }
@@ -11682,8 +11884,8 @@ var TYPE_MS = 620;
11682
11884
  var MIN_CHAR_MS = 12;
11683
11885
  var MAX_CHAR_MS = 34;
11684
11886
  function usePrefersReducedMotion() {
11685
- const [reduced, setReduced] = React111.useState(false);
11686
- React111.useEffect(() => {
11887
+ const [reduced, setReduced] = React113.useState(false);
11888
+ React113.useEffect(() => {
11687
11889
  if (typeof matchMedia !== "function") return;
11688
11890
  const query = matchMedia("(prefers-reduced-motion: reduce)");
11689
11891
  const sync = () => setReduced(query.matches);
@@ -11702,10 +11904,10 @@ function TypedText({
11702
11904
  onDone
11703
11905
  }) {
11704
11906
  const reduced = usePrefersReducedMotion();
11705
- const [count, setCount] = React111.useState(reduced ? text2.length : 0);
11706
- const done = React111.useRef(onDone);
11907
+ const [count, setCount] = React113.useState(reduced ? text2.length : 0);
11908
+ const done = React113.useRef(onDone);
11707
11909
  done.current = onDone;
11708
- React111.useEffect(() => {
11910
+ React113.useEffect(() => {
11709
11911
  if (!start) {
11710
11912
  setCount(0);
11711
11913
  return;
@@ -11745,9 +11947,9 @@ function RevealSequence({
11745
11947
  children
11746
11948
  }) {
11747
11949
  const reduced = usePrefersReducedMotion();
11748
- const items = React111.Children.toArray(children);
11749
- const [shown, setShown] = React111.useState(0);
11750
- React111.useEffect(() => {
11950
+ const items = React113.Children.toArray(children);
11951
+ const [shown, setShown] = React113.useState(0);
11952
+ React113.useEffect(() => {
11751
11953
  if (!start) {
11752
11954
  setShown(0);
11753
11955
  return;
@@ -11809,7 +12011,7 @@ function UpgradePrompt({ feature, inline, className }) {
11809
12011
  const currentPlan = plans.find((p) => p.id === currentPlanId);
11810
12012
  const currentPrice = currentPlan?.price ?? 0;
11811
12013
  const currentPlanName = currentPlan?.name ?? tr("billing.free", "Free");
11812
- const featureName = React111.useMemo(() => {
12014
+ const featureName = React113.useMemo(() => {
11813
12015
  if (!feature) return null;
11814
12016
  const label2 = features.find((f) => f.id === feature)?.label;
11815
12017
  if (label2) return featureDisplayName(label2);
@@ -11817,7 +12019,7 @@ function UpgradePrompt({ feature, inline, className }) {
11817
12019
  const named = t(key);
11818
12020
  return named && named !== key ? named : featureDisplayName(feature);
11819
12021
  }, [features, feature, t]);
11820
- const unlockingPlans = React111.useMemo(
12022
+ const unlockingPlans = React113.useMemo(
11821
12023
  () => plans.filter((p) => p.id !== currentPlanId && p.price > currentPrice && planUnlocks(p, feature)).sort((a, b) => a.price - b.price),
11822
12024
  [plans, currentPlanId, currentPrice, feature]
11823
12025
  );
@@ -11998,26 +12200,26 @@ function ChatConversation({
11998
12200
  usable && !pendingAction && !isStreaming,
11999
12201
  receiveFiles
12000
12202
  );
12001
- React111.useEffect(ensureIntroStyles, []);
12002
- const [view, setView] = React111.useState(
12203
+ React113.useEffect(ensureIntroStyles, []);
12204
+ const [view, setView] = React113.useState(
12003
12205
  () => useChatStore.getState().messages.length > 0 ? "thread" : "list"
12004
12206
  );
12005
- const [drawer, setDrawer] = React111.useState("none");
12006
- const [introStep, setIntroStep] = React111.useState(0);
12007
- const [atBottom, setAtBottom] = React111.useState(true);
12008
- const scrollRef = React111.useRef(null);
12207
+ const [drawer, setDrawer] = React113.useState("none");
12208
+ const [introStep, setIntroStep] = React113.useState(0);
12209
+ const [atBottom, setAtBottom] = React113.useState(true);
12210
+ const scrollRef = React113.useRef(null);
12009
12211
  const hasMessages = messages.length > 0;
12010
12212
  const showThread = view === "thread" && hasMessages;
12011
12213
  const totalTools = toolGroups.reduce((sum, g) => sum + g.tools.length, 0);
12012
- const scrollToBottom = React111.useCallback((behavior = "smooth") => {
12214
+ const scrollToBottom = React113.useCallback((behavior = "smooth") => {
12013
12215
  const el = scrollRef.current;
12014
12216
  if (!el) return;
12015
12217
  el.scrollTo({ top: el.scrollHeight, behavior });
12016
12218
  }, []);
12017
- React111.useEffect(() => {
12219
+ React113.useEffect(() => {
12018
12220
  if (atBottom) scrollToBottom();
12019
12221
  }, [messages, activeTools, pendingAction, atBottom, scrollToBottom]);
12020
- React111.useEffect(() => {
12222
+ React113.useEffect(() => {
12021
12223
  loadConversations();
12022
12224
  setSuggestionsOpen(useChatStore.getState().messages.length === 0);
12023
12225
  return () => stopSpeaking();
@@ -12034,7 +12236,7 @@ function ChatConversation({
12034
12236
  };
12035
12237
  const queuedPrompt = useChatStore((s) => s.queuedPrompt);
12036
12238
  const consumeQueuedPrompt = useChatStore((s) => s.consumeQueuedPrompt);
12037
- React111.useEffect(() => {
12239
+ React113.useEffect(() => {
12038
12240
  if (!queuedPrompt) return;
12039
12241
  const prompt = consumeQueuedPrompt();
12040
12242
  if (prompt && usable) send(prompt);
@@ -12066,7 +12268,7 @@ function ChatConversation({
12066
12268
  );
12067
12269
  const connectorsPending = useConnectorsSurface((s) => s.pending);
12068
12270
  const consumeConnectorsRequest = useConnectorsSurface((s) => s.consume);
12069
- React111.useEffect(() => {
12271
+ React113.useEffect(() => {
12070
12272
  if (!connectorsPending) return;
12071
12273
  setDrawer("connectors");
12072
12274
  consumeConnectorsRequest();
@@ -12074,7 +12276,7 @@ function ChatConversation({
12074
12276
  const greetingName = (user?.fullName || user?.email || "").split(/[\s@]/)[0];
12075
12277
  const invite = useAssistantInviteStore((s) => s.invite);
12076
12278
  const introKey = `${onDuty?.role ?? "solo"}:${invite?.id ?? ""}`;
12077
- React111.useEffect(() => setIntroStep(0), [introKey]);
12279
+ React113.useEffect(() => setIntroStep(0), [introKey]);
12078
12280
  const greeting = invite ? (invite.pitch ?? invite.headline).replace("{{name}}", greetingName) : onDuty?.greeting ? onDuty.greeting.replace("{{name}}", greetingName) : greetingName ? t("chat.greetingNamed", { name: greetingName }) : t("chat.greeting");
12079
12281
  const greetingHint = invite?.description ?? onDuty?.goal ?? t("chat.greetingHint");
12080
12282
  const openers = invite?.suggestions?.length ? invite.suggestions : onDuty?.suggestions?.length ? onDuty.suggestions : suggestions.length ? suggestions : [
@@ -12324,6 +12526,7 @@ function ChatConversation({
12324
12526
  }
12325
12527
  )
12326
12528
  ] }),
12529
+ drawer === "none" && /* @__PURE__ */ jsx(TourCoachCard, {}),
12327
12530
  drawer === "none" && !pendingActivity && /* @__PURE__ */ jsx(
12328
12531
  ChatComposer,
12329
12532
  {
@@ -12394,7 +12597,7 @@ function AgentAvatar({
12394
12597
  size = "md",
12395
12598
  className
12396
12599
  }) {
12397
- const [failed, setFailed] = React111.useState(false);
12600
+ const [failed, setFailed] = React113.useState(false);
12398
12601
  const { box, text: text2, px } = SIZES[size];
12399
12602
  return /* @__PURE__ */ jsxs(
12400
12603
  "span",
@@ -13166,7 +13369,7 @@ function TaskStatusGroup({ status, tasks }) {
13166
13369
  function useDelegateToAssistant() {
13167
13370
  const queuePrompt = useChatStore((s) => s.queuePrompt);
13168
13371
  const openPanel = useRightRailStore((s) => s.openPanel);
13169
- return React111.useCallback(
13372
+ return React113.useCallback(
13170
13373
  (prompt) => {
13171
13374
  queuePrompt(prompt);
13172
13375
  openPanel("chat");
@@ -13403,12 +13606,12 @@ function TasksPanel() {
13403
13606
  const fetchTasks = useTasksStore((s) => s.fetchTasks);
13404
13607
  const fetchLabels = useTasksStore((s) => s.fetchLabels);
13405
13608
  const fetchSummary = useTasksStore((s) => s.fetchSummary);
13406
- React111__default.useEffect(() => {
13609
+ React113__default.useEffect(() => {
13407
13610
  void fetchTasks();
13408
13611
  void fetchLabels();
13409
13612
  void fetchSummary();
13410
13613
  }, [fetchTasks, fetchLabels, fetchSummary]);
13411
- const { onboarding, grouped } = React111__default.useMemo(() => {
13614
+ const { onboarding, grouped } = React113__default.useMemo(() => {
13412
13615
  const split = splitOnboardingTasks(tasks);
13413
13616
  const map = /* @__PURE__ */ new Map();
13414
13617
  for (const s of STATUS_ORDER) map.set(s, []);
@@ -13443,7 +13646,7 @@ function TasksPanel() {
13443
13646
  function useTasksSummaryLine() {
13444
13647
  const t = useTranslation();
13445
13648
  const summary = useTasksStore((s) => s.summary);
13446
- return React111__default.useMemo(() => {
13649
+ return React113__default.useMemo(() => {
13447
13650
  if (!summary) return "";
13448
13651
  const parts = [];
13449
13652
  if (summary.overdue > 0) parts.push(`${summary.overdue} ${t("tasks.summary.overdue")}`);
@@ -13468,16 +13671,16 @@ function TasksRailPanel() {
13468
13671
  const fetchSummary = useTasksStore((s) => s.fetchSummary);
13469
13672
  const setCurrentUserId = useTasksStore((s) => s.setCurrentUserId);
13470
13673
  const userId = useAuthStore6((s) => s.user?.id);
13471
- React111__default.useEffect(() => {
13674
+ React113__default.useEffect(() => {
13472
13675
  void fetchSummary();
13473
13676
  }, [fetchSummary]);
13474
- React111__default.useEffect(() => {
13677
+ React113__default.useEffect(() => {
13475
13678
  setCurrentUserId(userId ?? null);
13476
13679
  }, [userId, setCurrentUserId]);
13477
13680
  const openCount = summary ? summary.todo + summary.inProgress : 0;
13478
13681
  const defer = tasksSurfaceOwner() === "plugin";
13479
13682
  useRightRailPanel(
13480
- React111__default.useMemo(
13683
+ React113__default.useMemo(
13481
13684
  () => defer ? null : {
13482
13685
  id: "tasks",
13483
13686
  label: t("tasks.drawer.title") || "Tasks",
@@ -13501,15 +13704,15 @@ var useSettingsTabsStore = create((set, get) => ({
13501
13704
  }));
13502
13705
  function usePublishSettingsTabs(ids) {
13503
13706
  const key = ids.join(",");
13504
- React111.useEffect(() => {
13707
+ React113.useEffect(() => {
13505
13708
  useSettingsTabsStore.getState().setIds(key ? key.split(",") : []);
13506
13709
  }, [key]);
13507
13710
  }
13508
13711
  function useAgentSurface(contribution) {
13509
- const ref = React111.useRef(contribution);
13712
+ const ref = React113.useRef(contribution);
13510
13713
  ref.current = contribution;
13511
13714
  const id = contribution.id;
13512
- React111.useEffect(() => {
13715
+ React113.useEffect(() => {
13513
13716
  registerSurface({ id, get: () => ref.current });
13514
13717
  const names = (ref.current.tools ?? []).map((t) => t.tool.name);
13515
13718
  for (const name of names) {
@@ -14178,22 +14381,30 @@ var TOOLS = [
14178
14381
  {
14179
14382
  id: "onboarding.highlight",
14180
14383
  name: "highlightFeature",
14181
- description: 'Points at things on screen: dims the page and spotlights one control at a time with a short note. Use it to TEACH \u2014 "this is where a new order lands". Anchors must come from `anchorsOnScreen` in the surface state; anything else points at nothing.',
14384
+ description: 'Points at things on screen: dims the page, a big cursor travels to one control at a time, and a short note explains it. Use it to TEACH \u2014 "this is where a new order lands". Anchors must come from `anchorsOnScreen` OR from `featureMap` in the surface state; a featureMap anchor lives on another screen, so send its `route` along. Anything else points at nothing.',
14182
14385
  icon: "Sparkles",
14183
14386
  mode: "read",
14184
14387
  parameters: {
14185
14388
  type: "object",
14186
14389
  properties: {
14390
+ title: {
14391
+ type: "string",
14392
+ description: 'Short name for the running-tour badge, e.g. "Contas a Pagar". Optional.'
14393
+ },
14187
14394
  stops: {
14188
14395
  type: "array",
14189
14396
  description: "The stops, in order. One is fine.",
14190
14397
  items: {
14191
14398
  type: "object",
14192
14399
  properties: {
14193
- anchor: { type: "string", description: "An anchor id from anchorsOnScreen." },
14400
+ anchor: { type: "string", description: "An anchor id from anchorsOnScreen or featureMap." },
14194
14401
  title: { type: "string", description: "Short label \u2014 what this control is." },
14195
14402
  body: { type: "string", description: "One sentence on why it matters. Optional." },
14196
- route: { type: "string", description: "Open this page first, when the anchor is on another screen." }
14403
+ route: { type: "string", description: "Open this page first, when the anchor is on another screen." },
14404
+ waitForUser: {
14405
+ type: "boolean",
14406
+ description: "Handover: no next button \u2014 the person is meant to CLICK the highlighted control, and the tour steps aside when they do. Use it on the stop where they act."
14407
+ }
14197
14408
  },
14198
14409
  required: ["anchor", "title"]
14199
14410
  }
@@ -14272,10 +14483,18 @@ function anchorsOnScreen() {
14272
14483
  }
14273
14484
  return Array.from(seen).slice(0, 60);
14274
14485
  }
14486
+ function featureMap() {
14487
+ return listSetupGuides().filter((g) => !!g.route).slice(0, 40).map((g) => ({
14488
+ feature: g.feature,
14489
+ title: g.title,
14490
+ route: g.route,
14491
+ anchors: (g.steps ?? []).filter((s) => !!s.anchor).map((s) => ({ anchor: s.anchor, route: s.route, do: s.do }))
14492
+ }));
14493
+ }
14275
14494
  function ActivationAgentSurface({ programs }) {
14276
- const programsRef = React111.useRef(programs);
14495
+ const programsRef = React113.useRef(programs);
14277
14496
  programsRef.current = programs;
14278
- const contribution = React111.useMemo(
14497
+ const contribution = React113.useMemo(
14279
14498
  () => ({
14280
14499
  id: "onboarding.activation",
14281
14500
  pluginId: "onboarding",
@@ -14310,7 +14529,8 @@ function ActivationAgentSurface({ programs }) {
14310
14529
  guide: getSetupGuideForStep(next.key)?.feature ?? null
14311
14530
  } : null,
14312
14531
  steps,
14313
- anchorsOnScreen: anchorsOnScreen()
14532
+ anchorsOnScreen: anchorsOnScreen(),
14533
+ featureMap: featureMap()
14314
14534
  }
14315
14535
  };
14316
14536
  },
@@ -14417,10 +14637,12 @@ function ActivationAgentSurface({ programs }) {
14417
14637
  anchor: String(s["anchor"]),
14418
14638
  title: String(s["title"]),
14419
14639
  body: typeof s["body"] === "string" ? s["body"] : void 0,
14420
- route: typeof s["route"] === "string" ? s["route"] : void 0
14640
+ route: typeof s["route"] === "string" ? s["route"] : void 0,
14641
+ waitForUser: s["waitForUser"] === true
14421
14642
  }));
14422
14643
  if (stops.length === 0) return { error: "no_stops", message: "Give me at least one anchor to point at." };
14423
- useTourStore.getState().start({ id: `agent.${Date.now()}`, stops });
14644
+ const title = typeof args["title"] === "string" ? args["title"] : void 0;
14645
+ useTourStore.getState().start({ id: `agent.${Date.now()}`, title, stops });
14424
14646
  return { started: stops.length };
14425
14647
  }
14426
14648
  }
@@ -14540,7 +14762,7 @@ var TOOLS2 = [
14540
14762
  {
14541
14763
  id: "setup.start",
14542
14764
  name: "startFeatureSetup",
14543
- description: "Opens a feature's screen and returns its guide in one move, so you can start setting it up WITH the person instead of describing where to click. Call it when they accept the offer to be walked through a feature.",
14765
+ description: `Walks the person to a feature ON SCREEN: opens its page and runs a guided tour \u2014 a big cursor travels stop by stop through the feature's anchored steps \u2014 then returns the guide so you can narrate. THE tool for "me mostra", "como eu crio X", "onde fica X": showing beats describing. One tool for every feature \u2014 pass the feature id, never ask for a feature-specific tool.`,
14544
14766
  icon: "Compass",
14545
14767
  mode: "read",
14546
14768
  parameters: {
@@ -14555,24 +14777,39 @@ var INSTRUCTIONS = tl(
14555
14777
  `# Setting features up
14556
14778
  Every feature in this product has a SETUP GUIDE \u2014 what it is for, what has to exist before it works, the steps, and where people get it wrong. \`setupGuides\` in the surface state is the catalog; \`readSetupGuide\` is the guide itself.
14557
14779
 
14780
+ ## THE RULE, above everything else
14781
+ When the person asks HOW to do something that has a guide in \`setupGuides\` ("como crio/cadastro/lan\xE7o X", "como uso X", "me mostra", "onde fica X"), your FIRST action is \`startFeatureSetup({feature})\` \u2014 before writing ANY prose. It runs the on-screen tour (a big cursor walks them there, then footprints let them do it). NEVER answer such a question with a written list of steps when a guide exists: that is the one thing this product does better than a manual, and skipping it is the failure. Match the ask to a guide's \`title\`/\`answers\` in \`setupGuides\`; only if none matches do you fall back to prose. After the tour is running, add a SHORT note \u2014 do not re-list the steps the cursor is already showing.
14782
+
14558
14783
  - Anything that sounds like "how do I start using X", "how does X work", "X is not doing anything" is a guide read FIRST. Never answer it from the screen alone: what is missing is usually on another screen entirely.
14559
14784
  - Check the PREREQUISITES before the steps, using each one's "done when". Then say only what is genuinely still missing. Reading a list of five prerequisites back at somebody who has four of them is how a product feels like paperwork.
14560
14785
  - Do the steps marked as yours \u2014 do not narrate a tool call you could just make. Hand the rest over: open the screen, point at the one control, say in one line what it wants, and stop.
14786
+ - "Show me", "how do I create/register X", "where is X" \u2192 call \`startFeatureSetup\` FIRST. It walks the person there on screen \u2014 a big cursor, stop by stop. Showing beats describing: never answer a "how do I" with a list of clicks when a tour exists for it. Use \`navigateTo\`/\`highlightFeature\` for one-off pointing; never ask for a feature-specific tool.
14787
+ - The \`feature\` id MUST come from \`setupGuides\` in the surface state (or \`findSetupGuide\`) \u2014 NEVER invent one like "resto:tables". If \`startFeatureSetup\` returns \`unknown_feature\`, its \`available\` list has the real ids; retry with the closest, or tell the person there is no tour for it yet.
14788
+ - \`startFeatureSetup\` ALREADY runs the whole tour (every step). Do NOT also call \`highlightFeature\` after it \u2014 a second tour replaces the first and truncates it to your improvised stops. \`highlightFeature\` is only for pointing at something with no guide of its own.
14789
+ - FORMAT long answers in sections with \`###\` headings (e.g. ### Configura\xE7\xF5es, ### Passo a passo, ### Dicas). Number steps continuously (1, 2, 3\u2026), sub-details as an indented list under their step.
14790
+ - Every screen you mention is a LINK, never a bare route: \`[Configura\xE7\xF5es \u203A Financeiro \u203A Plano de contas](/settings/financial/chart-of-accounts)\` \u2014 label from the guide's own menu path (\`where\`), URL from its \`route\`. A person clicks it and lands there with the chat still open.
14561
14791
  - Say the warnings BEFORE the person spends an hour on one, not after.
14562
14792
  - When a guide says the feature is unavailable or manual-only, say that plainly. Never route around it.
14563
14793
  - Finish by naming what this unlocks and offering the next feature, once.`,
14564
14794
  `# Colocando uma funcionalidade de p\xE9
14565
14795
  Toda funcionalidade deste produto tem um GUIA DE IMPLANTA\xC7\xC3O \u2014 para que serve, o que precisa existir antes de funcionar, os passos, e onde as pessoas erram. \`setupGuides\` no estado da tela \xE9 o cat\xE1logo; \`readSetupGuide\` \xE9 o guia.
14566
14796
 
14797
+ ## A REGRA, acima de tudo
14798
+ Quando a pessoa perguntar COMO fazer algo que tem guia em \`setupGuides\` ("como crio/cadastro/lan\xE7o X", "como uso X", "me mostra", "onde fica X"), sua PRIMEIRA a\xE7\xE3o \xE9 \`startFeatureSetup({feature})\` \u2014 antes de QUALQUER texto. Ele roda o tour na tela (um cursor grande leva a pessoa at\xE9 l\xE1 e depois marcadores deixam ela fazer). NUNCA responda esse tipo de pergunta com uma lista de passos escrita quando existe guia: \xE9 justamente o que este produto faz melhor que um manual, e pular isso \xE9 o erro. Case o pedido com o \`title\`/\`answers\` de um guia em \`setupGuides\`; s\xF3 cai no texto se NENHUM casar. Com o tour rodando, acrescente uma nota CURTA \u2014 n\xE3o re-liste os passos que o cursor j\xE1 est\xE1 mostrando.
14799
+
14567
14800
  - Qualquer coisa do tipo "como eu come\xE7o a usar X", "como funciona X", "X n\xE3o est\xE1 fazendo nada" come\xE7a lendo o guia. Nunca responda s\xF3 pela tela: o que falta costuma estar em outra tela.
14568
14801
  - Confira os PR\xC9-REQUISITOS antes dos passos, usando o "pronto quando" de cada um. Depois diga s\xF3 o que realmente falta. Recitar cinco pr\xE9-requisitos para quem j\xE1 tem quatro \xE9 o que faz um produto parecer burocracia.
14569
14802
  - Fa\xE7a os passos que s\xE3o seus \u2014 n\xE3o narre uma chamada de ferramenta que voc\xEA poderia simplesmente fazer. O resto \xE9 da pessoa: abra a tela, aponte o \xFAnico controle, diga em uma linha o que ele quer, e pare.
14803
+ - "Me mostra", "como eu crio/cadastro X", "onde fica X" \u2192 chame \`startFeatureSetup\` PRIMEIRO. Ele leva a pessoa na tela \u2014 um cursor grande, parada por parada. Mostrar ganha de descrever: nunca responda um "como fa\xE7o" com uma lista de cliques quando existe tour para isso. Use \`navigateTo\`/\`highlightFeature\` para apontar algo avulso; nunca pe\xE7a uma ferramenta espec\xEDfica de feature.
14804
+ - \`startFeatureSetup\` J\xC1 roda o tour inteiro (todas as paradas). N\xC3O chame \`highlightFeature\` depois dele \u2014 um segundo tour substitui o primeiro e o corta nas suas paradas improvisadas. \`highlightFeature\` \xE9 s\xF3 para apontar algo que n\xE3o tem guia pr\xF3prio.
14805
+ - FORMATE respostas longas em se\xE7\xF5es com \`###\` (ex.: ### Configura\xE7\xF5es, ### Passo a passo, ### Dicas). Numere os passos de forma cont\xEDnua (1, 2, 3\u2026); detalhes de um passo v\xE3o como sublista indentada embaixo dele.
14806
+ - Toda tela citada \xE9 um LINK, nunca rota crua: \`[Configura\xE7\xF5es \u203A Financeiro \u203A Plano de contas](/settings/financial/chart-of-accounts)\` \u2014 o r\xF3tulo \xE9 o caminho de menu do guia (\`where\`), a URL \xE9 a \`route\`. A pessoa clica e cai l\xE1 com o chat aberto do lado.
14570
14807
  - Diga os avisos ANTES de a pessoa perder uma hora com um deles, n\xE3o depois.
14571
14808
  - Quando o guia disser que a funcionalidade n\xE3o existe ou n\xE3o d\xE1 para configurar, diga isso com todas as letras. Nunca contorne.
14572
14809
  - Termine dizendo o que isso destrava e oferecendo a pr\xF3xima, uma vez s\xF3.`
14573
14810
  );
14574
14811
  function SetupAgentSurface() {
14575
- const contribution = React111.useMemo(
14812
+ const contribution = React113.useMemo(
14576
14813
  () => ({
14577
14814
  id: "setup.guides",
14578
14815
  pluginId: "setup",
@@ -14633,8 +14870,19 @@ function SetupAgentSurface() {
14633
14870
  tool: TOOLS2[2],
14634
14871
  execute: (args) => {
14635
14872
  const feature = String(args["feature"] ?? "");
14636
- const guide = getSetupGuide(feature);
14637
- if (!guide) return { error: "unknown_feature", message: `No setup guide for "${feature}".` };
14873
+ let guide = getSetupGuide(feature);
14874
+ if (!guide) {
14875
+ const normalized = feature.replace(/[:._-]+/g, " ").replace(/\bresto\b/gi, " ").trim();
14876
+ guide = searchSetupGuides(normalized, 1)[0];
14877
+ }
14878
+ if (!guide) {
14879
+ const available = listSetupGuides().map((g) => ({ feature: g.feature, title: g.title }));
14880
+ return {
14881
+ error: "unknown_feature",
14882
+ message: `No guide "${feature}". Pick a feature from this list (or say there is no tour for it):`,
14883
+ available
14884
+ };
14885
+ }
14638
14886
  if (guide.status === "unavailable") {
14639
14887
  return {
14640
14888
  opened: null,
@@ -14643,8 +14891,23 @@ function SetupAgentSurface() {
14643
14891
  };
14644
14892
  }
14645
14893
  if (guide.route) navigateTo(guide.route);
14646
- const stops = (guide.steps ?? []).filter((s) => s.anchor).slice(0, 1).map((s) => ({ anchor: s.anchor, title: s.do, ...s.why ? { body: s.why } : {} }));
14647
- if (stops.length > 0) useTourStore.getState().start({ id: `setup.${guide.feature}`, stops });
14894
+ const anchored = (guide.steps ?? []).filter((s) => s.anchor);
14895
+ const stops = anchored.map((s) => ({
14896
+ anchor: s.anchor,
14897
+ title: s.do,
14898
+ ...s.why ? { body: s.why } : {},
14899
+ ...s.route ? { route: s.route } : {},
14900
+ ...s.handOver ? { waitForUser: true } : {}
14901
+ }));
14902
+ const practice = (guide.practice ?? []).map((p) => ({ anchor: p.anchor, label: p.label, final: p.final }));
14903
+ if (stops.length > 0) {
14904
+ useTourStore.getState().start({
14905
+ id: `setup.${guide.feature}`,
14906
+ title: guide.title,
14907
+ stops,
14908
+ ...practice.length ? { practice } : {}
14909
+ });
14910
+ }
14648
14911
  return {
14649
14912
  opened: guide.route ?? null,
14650
14913
  feature: guide.feature,
@@ -14662,7 +14925,7 @@ function SetupAgentSurface() {
14662
14925
  }
14663
14926
  var DEBOUNCE_MS = 1200;
14664
14927
  function useActivationWatch() {
14665
- React111.useEffect(() => {
14928
+ React113.useEffect(() => {
14666
14929
  let timer = null;
14667
14930
  let running = false;
14668
14931
  const sweep = async () => {
@@ -14701,7 +14964,7 @@ function useActivationWatch() {
14701
14964
  off();
14702
14965
  };
14703
14966
  }, []);
14704
- React111.useEffect(() => {
14967
+ React113.useEffect(() => {
14705
14968
  useActivationStore.setState({
14706
14969
  onStepCompleted: (step, by) => {
14707
14970
  const state = useActivationStore.getState();
@@ -15358,7 +15621,7 @@ function ActivationProvider() {
15358
15621
  const programs = runtime?.onboardingPrograms ?? [];
15359
15622
  const settingsIds = useSettingsTabsStore((s) => s.ids);
15360
15623
  const routeKey = (runtime?.routes.length ?? 0) + ":" + settingsIds.join(",");
15361
- const hasRoute = React111.useMemo(() => {
15624
+ const hasRoute = React113.useMemo(() => {
15362
15625
  const known = /* @__PURE__ */ new Set(["/", "/settings"]);
15363
15626
  for (const route of runtime?.routes ?? []) known.add(route.path);
15364
15627
  for (const id of settingsIds) known.add(`/settings/${id}`);
@@ -15366,14 +15629,14 @@ function ActivationProvider() {
15366
15629
  }, [routeKey]);
15367
15630
  const answers = useBusinessProfileStore((s) => s.profile?.answers);
15368
15631
  const programKey = programs.map((p) => p.id).join(",");
15369
- const catalog = React111.useMemo(
15632
+ const catalog = React113.useMemo(
15370
15633
  () => buildActivationCatalog({ verticalId, programs, hasRoute, answers }),
15371
15634
  [verticalId, programKey, hasRoute, answers]
15372
15635
  );
15373
- React111.useEffect(() => {
15636
+ React113.useEffect(() => {
15374
15637
  setCatalog(catalog);
15375
15638
  }, [catalog, setCatalog]);
15376
- React111.useEffect(() => {
15639
+ React113.useEffect(() => {
15377
15640
  if (!tenantId2) return;
15378
15641
  let cancelled = false;
15379
15642
  void (async () => {
@@ -15405,14 +15668,14 @@ function ActivationProvider() {
15405
15668
  cancelled = true;
15406
15669
  };
15407
15670
  }, [tenantId2, catalog, answers, hasRoute, settingsIds, user?.id, load]);
15408
- React111.useEffect(() => {
15671
+ React113.useEffect(() => {
15409
15672
  if (!tenantId2) {
15410
15673
  useBusinessProfileStore.getState().clear();
15411
15674
  return;
15412
15675
  }
15413
15676
  void useBusinessProfileStore.getState().load(tenantId2, orgName);
15414
15677
  }, [tenantId2, orgName]);
15415
- React111.useEffect(() => {
15678
+ React113.useEffect(() => {
15416
15679
  if (!tenantId2) return;
15417
15680
  const key = `${GREETING_FLAG}:${tenantId2}`;
15418
15681
  let pending2 = false;
@@ -15434,10 +15697,10 @@ function ActivationProvider() {
15434
15697
  return () => window.clearTimeout(timer);
15435
15698
  }, [tenantId2]);
15436
15699
  const guides = runtime?.setupGuides;
15437
- React111.useEffect(() => {
15700
+ React113.useEffect(() => {
15438
15701
  setRuntimeSetupGuides(guides ?? []);
15439
15702
  }, [guides]);
15440
- React111.useEffect(() => {
15703
+ React113.useEffect(() => {
15441
15704
  setTourNavigator(navigateTo);
15442
15705
  return () => setTourNavigator(void 0);
15443
15706
  }, []);
@@ -15460,7 +15723,8 @@ function ActivationProvider() {
15460
15723
  )
15461
15724
  }
15462
15725
  }
15463
- )
15726
+ ),
15727
+ /* @__PURE__ */ jsx(PracticeOverlay, {})
15464
15728
  ] });
15465
15729
  }
15466
15730
  var useHandbookStore = create((set, get) => ({
@@ -15609,7 +15873,7 @@ Escrita:
15609
15873
  E quando a coisa precisa ser FEITA em vez de lembrada, \xE9 tarefa e n\xE3o p\xE1gina \u2014 crie com createRecord na entidade Task.`
15610
15874
  );
15611
15875
  function HandbookAgentSurface() {
15612
- const contribution = React111.useMemo(
15876
+ const contribution = React113.useMemo(
15613
15877
  () => ({
15614
15878
  id: "handbook",
15615
15879
  pluginId: "handbook",
@@ -15720,18 +15984,18 @@ function NotebookPanel() {
15720
15984
  const userId = useHandbookStore((s) => s.userId);
15721
15985
  const write3 = useHandbookStore((s) => s.write);
15722
15986
  const remove = useHandbookStore((s) => s.remove);
15723
- const [filter, setFilter] = React111.useState("all");
15724
- const [search, setSearch] = React111.useState("");
15725
- const [draft, setDraft] = React111.useState(null);
15726
- const [preview, setPreview] = React111.useState(false);
15727
- const [confirming, setConfirming] = React111.useState(null);
15728
- const entries2 = React111.useMemo(
15987
+ const [filter, setFilter] = React113.useState("all");
15988
+ const [search, setSearch] = React113.useState("");
15989
+ const [draft, setDraft] = React113.useState(null);
15990
+ const [preview, setPreview] = React113.useState(false);
15991
+ const [confirming, setConfirming] = React113.useState(null);
15992
+ const entries2 = React113.useMemo(
15729
15993
  () => (pages ?? []).map((p) => ({ page: p, entry: toEntry2(p) })),
15730
15994
  [pages]
15731
15995
  );
15732
- const timer = React111.useRef(null);
15733
- const inFlight = React111.useRef(false);
15734
- const persist = React111.useCallback(async (d) => {
15996
+ const timer = React113.useRef(null);
15997
+ const inFlight = React113.useRef(false);
15998
+ const persist = React113.useCallback(async (d) => {
15735
15999
  const title = titleFromBody(d.body);
15736
16000
  if (!title && !d.body.trim()) return d.id;
15737
16001
  const filed = d.folder !== null;
@@ -15753,7 +16017,7 @@ function NotebookPanel() {
15753
16017
  });
15754
16018
  return saved?.id ?? d.id;
15755
16019
  }, [write3, userId]);
15756
- const schedule = React111.useCallback((next) => {
16020
+ const schedule = React113.useCallback((next) => {
15757
16021
  setDraft(next);
15758
16022
  if (timer.current) clearTimeout(timer.current);
15759
16023
  timer.current = setTimeout(() => {
@@ -15785,7 +16049,7 @@ function NotebookPanel() {
15785
16049
  legacyId: null
15786
16050
  });
15787
16051
  };
15788
- const folders = React111.useMemo(() => {
16052
+ const folders = React113.useMemo(() => {
15789
16053
  const set = /* @__PURE__ */ new Set();
15790
16054
  for (const { page } of entries2) {
15791
16055
  if (page.kind !== "doc" || !page.path) continue;
@@ -16177,10 +16441,10 @@ ${body}`
16177
16441
  }
16178
16442
  function NoteTodosSection({ noteId, noteTitle }) {
16179
16443
  const adapter = useNotesTasksBridge((s) => s.adapter);
16180
- const [todos, setTodos] = React111.useState([]);
16181
- const [draft, setDraft] = React111.useState("");
16182
- const [busy, setBusy] = React111.useState(false);
16183
- React111.useEffect(() => {
16444
+ const [todos, setTodos] = React113.useState([]);
16445
+ const [draft, setDraft] = React113.useState("");
16446
+ const [busy, setBusy] = React113.useState(false);
16447
+ React113.useEffect(() => {
16184
16448
  if (!adapter) return;
16185
16449
  let alive = true;
16186
16450
  adapter.listTodos(noteId).then((rows) => {
@@ -16310,7 +16574,7 @@ function NotebookRailPanel() {
16310
16574
  const pages = useHandbookStore((s) => s.pages);
16311
16575
  const count = pages?.length ?? 0;
16312
16576
  useRightRailPanel(
16313
- React111.useMemo(
16577
+ React113.useMemo(
16314
16578
  () => ({
16315
16579
  id: "notes",
16316
16580
  label: tl("Notes", "Notas"),
@@ -16329,10 +16593,10 @@ function HandbookProvider() {
16329
16593
  const userId = useAuthStore((s) => s.user?.id);
16330
16594
  const load = useHandbookStore((s) => s.load);
16331
16595
  const setUser = useHandbookStore((s) => s.setUser);
16332
- React111.useEffect(() => {
16596
+ React113.useEffect(() => {
16333
16597
  setUser(userId);
16334
16598
  }, [userId, setUser]);
16335
- React111.useEffect(() => {
16599
+ React113.useEffect(() => {
16336
16600
  if (tenantId2) void load(tenantId2);
16337
16601
  }, [tenantId2, load]);
16338
16602
  useLocalNotesImport(tenantId2, userId);
@@ -16342,7 +16606,7 @@ function HandbookProvider() {
16342
16606
  ] });
16343
16607
  }
16344
16608
  function useLocalNotesImport(tenantId2, userId) {
16345
- React111.useEffect(() => {
16609
+ React113.useEffect(() => {
16346
16610
  if (!tenantId2 || !userId) return;
16347
16611
  const source = `fayz.notes.${tenantId2}.${userId}`;
16348
16612
  const flag = `fayz.notes.imported.${tenantId2}.${userId}`;
@@ -16390,7 +16654,7 @@ function useUnitBootstrap() {
16390
16654
  const tenant = useTenantOptional();
16391
16655
  const userId = useAuthStore((s) => s.user?.id);
16392
16656
  const orgId = tenant?.org?.id;
16393
- React111.useEffect(() => {
16657
+ React113.useEffect(() => {
16394
16658
  if (!orgId) return;
16395
16659
  const { loadedFor, load, reset } = useUnitStore.getState();
16396
16660
  if (loadedFor && loadedFor !== orgId) reset();
@@ -16429,19 +16693,19 @@ function UnitMembersTab({ item }) {
16429
16693
  const orgMembers = useOrganizationStore((s) => s.members);
16430
16694
  const profiles = usePermissionsStore((s) => s.profiles);
16431
16695
  const unitMode = useUnitStore((s) => s.unitMode);
16432
- const [rows, setRows] = React111.useState(null);
16433
- const [activity, setActivity] = React111.useState({});
16434
- const [adding, setAdding] = React111.useState(false);
16435
- const [busy, setBusy] = React111.useState(null);
16436
- const reload = React111.useCallback(async () => {
16696
+ const [rows, setRows] = React113.useState(null);
16697
+ const [activity, setActivity] = React113.useState({});
16698
+ const [adding, setAdding] = React113.useState(false);
16699
+ const [busy, setBusy] = React113.useState(null);
16700
+ const reload = React113.useCallback(async () => {
16437
16701
  if (!unitId) return;
16438
16702
  setRows(await fetchUnitMembers(unitId));
16439
16703
  }, [unitId]);
16440
16704
  const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
16441
- React111.useEffect(() => {
16705
+ React113.useEffect(() => {
16442
16706
  void reload();
16443
16707
  }, [reload, version5]);
16444
- React111.useEffect(() => {
16708
+ React113.useEffect(() => {
16445
16709
  if (!orgId) return;
16446
16710
  let alive = true;
16447
16711
  void fetchMemberActivity(orgId).then((a) => {
@@ -16451,7 +16715,7 @@ function UnitMembersTab({ item }) {
16451
16715
  alive = false;
16452
16716
  };
16453
16717
  }, [orgId]);
16454
- const byUser = React111.useMemo(() => {
16718
+ const byUser = React113.useMemo(() => {
16455
16719
  const map = /* @__PURE__ */ new Map();
16456
16720
  for (const m of orgMembers) {
16457
16721
  map.set(m.userId, {
@@ -16463,7 +16727,7 @@ function UnitMembersTab({ item }) {
16463
16727
  }
16464
16728
  return map;
16465
16729
  }, [orgMembers]);
16466
- const available = React111.useMemo(
16730
+ const available = React113.useMemo(
16467
16731
  () => orgMembers.filter((m) => !(rows ?? []).some((r) => r.userId === m.userId)),
16468
16732
  [orgMembers, rows]
16469
16733
  );
@@ -16669,15 +16933,15 @@ function MemberAccessBody({
16669
16933
  const units = useUnitStore((s) => s.units);
16670
16934
  const byId = useUnitStore((s) => s.byId);
16671
16935
  const profiles = usePermissionsStore((s) => s.profiles);
16672
- const [bindings, setBindings] = React111.useState([]);
16673
- const [loading, setLoading] = React111.useState(false);
16674
- const [adding, setAdding] = React111.useState(false);
16675
- const branches = React111.useMemo(() => units.filter((u) => u.isActive !== false), [units]);
16676
- const unbound = React111.useMemo(
16936
+ const [bindings, setBindings] = React113.useState([]);
16937
+ const [loading, setLoading] = React113.useState(false);
16938
+ const [adding, setAdding] = React113.useState(false);
16939
+ const branches = React113.useMemo(() => units.filter((u) => u.isActive !== false), [units]);
16940
+ const unbound = React113.useMemo(
16677
16941
  () => branches.filter((u) => !bindings.some((b) => b.locationId === u.id)),
16678
16942
  [branches, bindings]
16679
16943
  );
16680
- const reload = React111.useCallback(async () => {
16944
+ const reload = React113.useCallback(async () => {
16681
16945
  if (!userId) return;
16682
16946
  setLoading(true);
16683
16947
  try {
@@ -16687,7 +16951,7 @@ function MemberAccessBody({
16687
16951
  }
16688
16952
  }, [userId]);
16689
16953
  const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
16690
- React111.useEffect(() => {
16954
+ React113.useEffect(() => {
16691
16955
  void reload();
16692
16956
  }, [reload, version5]);
16693
16957
  async function add(unitId) {
@@ -17429,13 +17693,13 @@ function surveyTokenFromPath(pathname) {
17429
17693
  return m ? decodeURIComponent(m[1]) : null;
17430
17694
  }
17431
17695
  function PublicSurveyPage({ token, appName }) {
17432
- const [loaded2, setLoaded] = React111__default.useState(null);
17433
- const [draft, setDraft] = React111__default.useState({});
17434
- const [name, setName] = React111__default.useState("");
17435
- const [sending, setSending] = React111__default.useState(false);
17436
- const [sent, setSent] = React111__default.useState(null);
17437
- const [failed, setFailed] = React111__default.useState(null);
17438
- React111__default.useEffect(() => {
17696
+ const [loaded2, setLoaded] = React113__default.useState(null);
17697
+ const [draft, setDraft] = React113__default.useState({});
17698
+ const [name, setName] = React113__default.useState("");
17699
+ const [sending, setSending] = React113__default.useState(false);
17700
+ const [sent, setSent] = React113__default.useState(null);
17701
+ const [failed, setFailed] = React113__default.useState(null);
17702
+ React113__default.useEffect(() => {
17439
17703
  let alive = true;
17440
17704
  const client3 = getFayzSupabaseClientOptional();
17441
17705
  if (!client3) {
@@ -17605,7 +17869,7 @@ function Closed({ status, message }) {
17605
17869
  /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: c.body })
17606
17870
  ] });
17607
17871
  }
17608
- var RouteErrorBoundary = class extends React111.Component {
17872
+ var RouteErrorBoundary = class extends React113.Component {
17609
17873
  constructor() {
17610
17874
  super(...arguments);
17611
17875
  this.state = { crashed: false, report: null };
@@ -17647,7 +17911,7 @@ var RouteErrorBoundary = class extends React111.Component {
17647
17911
  }
17648
17912
  };
17649
17913
  function RouteErrorScreen({ report, tr, onBack, onRetry, backLabel }) {
17650
- const [copied, setCopied] = React111.useState(false);
17914
+ const [copied, setCopied] = React113.useState(false);
17651
17915
  const copyDetails = () => {
17652
17916
  if (!report || typeof navigator === "undefined" || !navigator.clipboard) return;
17653
17917
  const details = [
@@ -17737,9 +18001,9 @@ function UnitSwitching({ unitName, isAll, onDone }) {
17737
18001
  const v = t(key);
17738
18002
  return !v || v === key ? fallback : v;
17739
18003
  };
17740
- const doneRef = React111.useRef(onDone);
18004
+ const doneRef = React113.useRef(onDone);
17741
18005
  doneRef.current = onDone;
17742
- React111.useEffect(() => {
18006
+ React113.useEffect(() => {
17743
18007
  const id = window.setTimeout(() => doneRef.current(), HOLD_MS);
17744
18008
  return () => window.clearTimeout(id);
17745
18009
  }, []);
@@ -17922,16 +18186,16 @@ function WorkspaceSetupFlow({
17922
18186
  const user = useAuthStore((s) => s.user);
17923
18187
  const { switchOrg } = useTenant();
17924
18188
  const closeSetup = useWorkspaceSetupStore((s) => s.close);
17925
- const uploadLogo = React111.useMemo(
18189
+ const uploadLogo = React113.useMemo(
17926
18190
  () => user ? createLogoUploader(user.id) : void 0,
17927
18191
  [user?.id]
17928
18192
  );
17929
- const country = React111.useMemo(
18193
+ const country = React113.useMemo(
17930
18194
  () => currency === "BRL" || (locale ?? "").toLowerCase().startsWith("pt") ? "BR" : void 0,
17931
18195
  [currency, locale]
17932
18196
  );
17933
- const stepsRef = React111.useRef([]);
17934
- const analyzeSite = React111.useMemo(
18197
+ const stepsRef = React113.useRef([]);
18198
+ const analyzeSite = React113.useMemo(
17935
18199
  () => createSiteAnalyzer({
17936
18200
  apiBaseUrl: resolveFayzApiBaseUrl(),
17937
18201
  steps: () => stepsRef.current,
@@ -17939,7 +18203,7 @@ function WorkspaceSetupFlow({
17939
18203
  }),
17940
18204
  [locale]
17941
18205
  );
17942
- const steps = React111.useMemo(
18206
+ const steps = React113.useMemo(
17943
18207
  () => buildWorkspaceSetupSteps({
17944
18208
  verticalId,
17945
18209
  uploadLogo,
@@ -17951,13 +18215,13 @@ function WorkspaceSetupFlow({
17951
18215
  [verticalId, uploadLogo, media, country, analyzeSite]
17952
18216
  );
17953
18217
  stepsRef.current = steps;
17954
- const initialValues2 = React111.useMemo(
18218
+ const initialValues2 = React113.useMemo(
17955
18219
  // Seeding the contact email with the account's own is one field fewer to
17956
18220
  // type, and it is right far more often than it is wrong.
17957
18221
  () => user?.email ? { "workspace.email": user.email } : {},
17958
18222
  [user?.email]
17959
18223
  );
17960
- const onSubmit = React111.useCallback(
18224
+ const onSubmit = React113.useCallback(
17961
18225
  async (values) => {
17962
18226
  if (!user) throw new Error(tl("You are signed out.", "Sua sess\xE3o terminou."));
17963
18227
  const org = await submitWorkspaceSetup({
@@ -18074,16 +18338,16 @@ function GettingStartedWidget() {
18074
18338
  const t = useTranslation();
18075
18339
  const rows = useActivationStore((s) => s.rows);
18076
18340
  const catalog = useActivationStore((s) => s.catalog);
18077
- const steps = React111.useMemo(
18341
+ const steps = React113.useMemo(
18078
18342
  () => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
18079
18343
  [rows, catalog]
18080
18344
  );
18081
- const onNavigate = React111.useCallback((path) => {
18345
+ const onNavigate = React113.useCallback((path) => {
18082
18346
  const step = useActivationStore.getState().catalog.find((s) => s.route === path);
18083
18347
  navigateTo(path);
18084
18348
  if (step?.tour) useTourStore.getState().start(step.tour);
18085
18349
  }, []);
18086
- const onAskAgent = React111.useCallback((step) => {
18350
+ const onAskAgent = React113.useCallback((step) => {
18087
18351
  void startGuidedRun(step.id);
18088
18352
  }, []);
18089
18353
  if (!rows || rows.length === 0) return null;
@@ -18094,7 +18358,9 @@ function GettingStartedWidget() {
18094
18358
  steps,
18095
18359
  onNavigate,
18096
18360
  onAskAgent,
18097
- askAgentLabel: tl("Set it up with the assistant", "Configurar com o assistente")
18361
+ askAgentLabel: tl("Set it up with the assistant", "Configurar com o assistente"),
18362
+ maxVisible: 5,
18363
+ seeAllLabel: tl("+{n} more later", "mais {n} depois")
18098
18364
  }
18099
18365
  );
18100
18366
  }
@@ -18106,16 +18372,16 @@ function ActivationChecklistCard({
18106
18372
  }) {
18107
18373
  const rows = useActivationStore((s) => s.rows);
18108
18374
  const catalog = useActivationStore((s) => s.catalog);
18109
- const steps = React111.useMemo(
18375
+ const steps = React113.useMemo(
18110
18376
  () => selectSteps({ ...useActivationStore.getState(), rows, catalog }),
18111
18377
  [rows, catalog]
18112
18378
  );
18113
- const onNavigate = React111.useCallback((path) => {
18379
+ const onNavigate = React113.useCallback((path) => {
18114
18380
  const step = useActivationStore.getState().catalog.find((s) => s.route === path);
18115
18381
  navigateTo(path);
18116
18382
  if (step?.tour) useTourStore.getState().start(step.tour);
18117
18383
  }, []);
18118
- const onAskAgent = React111.useCallback((step) => {
18384
+ const onAskAgent = React113.useCallback((step) => {
18119
18385
  void startGuidedRun(step.id);
18120
18386
  }, []);
18121
18387
  if (!rows || rows.length === 0) return null;
@@ -18129,13 +18395,15 @@ function ActivationChecklistCard({
18129
18395
  onAskAgent,
18130
18396
  askAgentLabel: tl("Set it up with the assistant", "Configurar com o assistente"),
18131
18397
  hideWhenComplete,
18398
+ maxVisible: 5,
18399
+ seeAllLabel: tl("+{n} more after these", "mais {n} depois destes"),
18132
18400
  className
18133
18401
  }
18134
18402
  );
18135
18403
  }
18136
- var WidgetSurfaceContext = React111.createContext("rail");
18404
+ var WidgetSurfaceContext = React113.createContext("rail");
18137
18405
  function useWidgetSurface() {
18138
- return React111.useContext(WidgetSurfaceContext);
18406
+ return React113.useContext(WidgetSurfaceContext);
18139
18407
  }
18140
18408
  function WidgetSlot({
18141
18409
  zone,
@@ -18179,7 +18447,7 @@ function useNavContribution(id, entries2) {
18179
18447
  const setContribution = useNavContributionsStore((s) => s.setContribution);
18180
18448
  const clearContribution = useNavContributionsStore((s) => s.clearContribution);
18181
18449
  const key = JSON.stringify(entries2);
18182
- React111.useEffect(() => {
18450
+ React113.useEffect(() => {
18183
18451
  setContribution(id, entries2);
18184
18452
  return () => clearContribution(id);
18185
18453
  }, [id, key]);
@@ -18249,7 +18517,7 @@ function useAppDirectory() {
18249
18517
  const tenantId2 = useActiveTenantId();
18250
18518
  const apps = useAppDirectoryStore((s) => s.apps);
18251
18519
  const load = useAppDirectoryStore((s) => s.load);
18252
- React111.useEffect(() => {
18520
+ React113.useEffect(() => {
18253
18521
  if (tenantId2) void load(tenantId2, resolveAppId());
18254
18522
  }, [tenantId2, load]);
18255
18523
  return { apps };
@@ -18341,7 +18609,7 @@ var CSS2 = `
18341
18609
  }
18342
18610
  `;
18343
18611
  function useWordmarkStyle() {
18344
- React111.useEffect(() => {
18612
+ React113.useEffect(() => {
18345
18613
  if (typeof document === "undefined") return;
18346
18614
  const existing = document.getElementById(STYLE_ID2);
18347
18615
  if (existing) {
@@ -18575,7 +18843,7 @@ var SWAP_CSS = `
18575
18843
  }
18576
18844
  `;
18577
18845
  function useSwapStyle() {
18578
- React111.useEffect(() => {
18846
+ React113.useEffect(() => {
18579
18847
  if (typeof document === "undefined" || document.getElementById(SWAP_STYLE_ID)) return;
18580
18848
  const el = document.createElement("style");
18581
18849
  el.id = SWAP_STYLE_ID;
@@ -18584,9 +18852,9 @@ function useSwapStyle() {
18584
18852
  }, []);
18585
18853
  }
18586
18854
  function AppSwitcherView({ apps, mark, logo, collapsed = false, label: label2, onSelect }) {
18587
- const [hovered, setHovered] = React111.useState(false);
18588
- const [open, setOpen] = React111.useState(false);
18589
- const [pending2, setPending] = React111.useState(null);
18855
+ const [hovered, setHovered] = React113.useState(false);
18856
+ const [open, setOpen] = React113.useState(false);
18857
+ const [pending2, setPending] = React113.useState(null);
18590
18858
  const active2 = hovered || open;
18591
18859
  useSwapStyle();
18592
18860
  const brand = /* @__PURE__ */ jsx(BrandFace, { mark, logo, collapsed });
@@ -18721,7 +18989,7 @@ function useContextualNav(nav) {
18721
18989
  const setNav = useContextualNavStore((s) => s.setNav);
18722
18990
  const clearNav = useContextualNavStore((s) => s.clearNav);
18723
18991
  const key = nav ? JSON.stringify(nav) : null;
18724
- React111.useEffect(() => {
18992
+ React113.useEffect(() => {
18725
18993
  if (!nav) return;
18726
18994
  setNav(nav);
18727
18995
  return () => clearNav(nav.base);
@@ -18878,10 +19146,10 @@ function SeuSiteWidget({ fallback, onEdit }) {
18878
19146
  const load = useFayzProjectsStore((s) => s.load);
18879
19147
  const loadedFor = useFayzProjectsStore((s) => s.loadedFor);
18880
19148
  const collapsed = useLayoutStore((s) => s.sidebarCollapsed);
18881
- const [selectedId, setSelectedId] = React111.useState(null);
18882
- const [hovered, setHovered] = React111.useState(false);
18883
- const [primed, setPrimed] = React111.useState(false);
18884
- const closeTimer = React111.useRef(null);
19149
+ const [selectedId, setSelectedId] = React113.useState(null);
19150
+ const [hovered, setHovered] = React113.useState(false);
19151
+ const [primed, setPrimed] = React113.useState(false);
19152
+ const closeTimer = React113.useRef(null);
18885
19153
  const cancelClose = () => {
18886
19154
  if (closeTimer.current) {
18887
19155
  clearTimeout(closeTimer.current);
@@ -18897,8 +19165,8 @@ function SeuSiteWidget({ fallback, onEdit }) {
18897
19165
  cancelClose();
18898
19166
  closeTimer.current = setTimeout(() => setHovered(false), 140);
18899
19167
  };
18900
- React111.useEffect(() => () => cancelClose(), []);
18901
- React111.useEffect(() => {
19168
+ React113.useEffect(() => () => cancelClose(), []);
19169
+ React113.useEffect(() => {
18902
19170
  if (loadedFor !== (currentOrgId ?? null)) void load(currentOrgId);
18903
19171
  }, [currentOrgId, loadedFor, load]);
18904
19172
  const active2 = projects.find((p) => p.id === selectedId) ?? defaultProjectOf(projects) ?? synthFromFallback(fallback);
@@ -19009,10 +19277,10 @@ function SitePreview({
19009
19277
  onEdit,
19010
19278
  tr
19011
19279
  }) {
19012
- const [nonce, setNonce] = React111.useState(0);
19013
- const [loading, setLoading] = React111.useState(true);
19280
+ const [nonce, setNonce] = React113.useState(0);
19281
+ const [loading, setLoading] = React113.useState(true);
19014
19282
  const url = previewSourceOf(project);
19015
- React111.useEffect(() => {
19283
+ React113.useEffect(() => {
19016
19284
  setLoading(true);
19017
19285
  }, [nonce, url]);
19018
19286
  const action = "flex items-center gap-1.5 rounded-button px-2 py-1 text-[11.5px] font-medium text-sidebar-foreground/80 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground disabled:cursor-not-allowed disabled:opacity-40";
@@ -19122,10 +19390,10 @@ function RightRail({ frame = true, attached = true }) {
19122
19390
  const pageOpen = useRightRailStore((s) => s.pageOpen);
19123
19391
  const setPageSlot = useRightRailStore((s) => s.setPageSlot);
19124
19392
  const setWidth = useRightRailStore((s) => s.setWidth);
19125
- const rootRef = React111.useRef(null);
19126
- const [actionsSlot, setActionsSlot] = React111.useState(null);
19127
- const [leadingSlot, setLeadingSlot] = React111.useState(null);
19128
- React111.useEffect(() => {
19393
+ const rootRef = React113.useRef(null);
19394
+ const [actionsSlot, setActionsSlot] = React113.useState(null);
19395
+ const [leadingSlot, setLeadingSlot] = React113.useState(null);
19396
+ React113.useEffect(() => {
19129
19397
  if (!open) return;
19130
19398
  const el = rootRef.current;
19131
19399
  if (!el) return;
@@ -19147,8 +19415,8 @@ function RightRail({ frame = true, attached = true }) {
19147
19415
  el.removeEventListener("transitionend", publish);
19148
19416
  };
19149
19417
  }, [open, setWidth]);
19150
- const [narrow, setNarrow] = React111.useState(false);
19151
- React111.useEffect(() => {
19418
+ const [narrow, setNarrow] = React113.useState(false);
19419
+ React113.useEffect(() => {
19152
19420
  if (!open) return;
19153
19421
  const el = rootRef.current;
19154
19422
  if (!el) return;
@@ -19189,6 +19457,7 @@ function RightRail({ frame = true, attached = true }) {
19189
19457
  ref: rootRef,
19190
19458
  role: "complementary",
19191
19459
  "aria-label": current2.label,
19460
+ "data-tour-exempt": true,
19192
19461
  className: cn(
19193
19462
  // The page's own surface, not `card`. The rail is a COLUMN of the app,
19194
19463
  // not a white panel laid over it: painted card it came out a shade
@@ -19466,9 +19735,9 @@ var TYPE_COLORS = {
19466
19735
  fix: "text-success"
19467
19736
  };
19468
19737
  function ChangelogFeed({ changelogUrl, className }) {
19469
- const [entries2, setEntries] = React111.useState([]);
19470
- const [loading, setLoading] = React111.useState(false);
19471
- React111.useEffect(() => {
19738
+ const [entries2, setEntries] = React113.useState([]);
19739
+ const [loading, setLoading] = React113.useState(false);
19740
+ React113.useEffect(() => {
19472
19741
  if (!changelogUrl) return;
19473
19742
  setLoading(true);
19474
19743
  fetch(changelogUrl).then((r) => r.json()).then((data) => setEntries(data)).catch(() => setEntries([])).finally(() => setLoading(false));
@@ -19531,7 +19800,7 @@ function NotificationInbox({
19531
19800
  changelogUrl,
19532
19801
  className
19533
19802
  }) {
19534
- const [activeTab, setActiveTab] = React111.useState("inbox");
19803
+ const [activeTab, setActiveTab] = React113.useState("inbox");
19535
19804
  const unreadCount = notifications.filter((n) => !n.read).length;
19536
19805
  const inboxNotifications = notifications.filter((n) => n.category !== "changelog");
19537
19806
  return /* @__PURE__ */ jsxs("div", { className: cn("flex w-80 flex-col", className), children: [
@@ -19628,11 +19897,11 @@ function NotificationInbox({
19628
19897
  }
19629
19898
  function BrandAgentSurface() {
19630
19899
  const org = useOrganizationStore((s) => s.currentOrg);
19631
- const brand = React111__default.useMemo(
19900
+ const brand = React113__default.useMemo(
19632
19901
  () => normalizeBrand(org?.settings?.branding, { name: org?.name, logoUrl: org?.logoUrl }),
19633
19902
  [org?.settings, org?.name, org?.logoUrl]
19634
19903
  );
19635
- const surface = React111__default.useMemo(() => ({
19904
+ const surface = React113__default.useMemo(() => ({
19636
19905
  id: "core.brand",
19637
19906
  describe: () => ({
19638
19907
  title: "Marca da casa",
@@ -19645,15 +19914,15 @@ function BrandAgentSurface() {
19645
19914
  return null;
19646
19915
  }
19647
19916
  function ConnectConsentPage({ appName, logo }) {
19648
- const [state, setState] = React111__default.useState({ status: "loading" });
19649
- const [tenantId2, setTenantId] = React111__default.useState("");
19650
- const request = React111__default.useMemo(
19917
+ const [state, setState] = React113__default.useState({ status: "loading" });
19918
+ const [tenantId2, setTenantId] = React113__default.useState("");
19919
+ const request = React113__default.useMemo(
19651
19920
  () => new URLSearchParams(window.location.search).get("request") ?? "",
19652
19921
  []
19653
19922
  );
19654
- const connection = React111__default.useMemo(() => resolveFayzAgentConnection(), []);
19923
+ const connection = React113__default.useMemo(() => resolveFayzAgentConnection(), []);
19655
19924
  const product = appName ?? document.title ?? "este app";
19656
- const authorizedFetch = React111__default.useCallback(
19925
+ const authorizedFetch = React113__default.useCallback(
19657
19926
  async (path, init) => {
19658
19927
  if (!connection) throw new Error("Este app n\xE3o est\xE1 ligado a um projeto Fayz.");
19659
19928
  const supabase = getFayzSupabaseClientOptional();
@@ -19677,7 +19946,7 @@ function ConnectConsentPage({ appName, logo }) {
19677
19946
  },
19678
19947
  [connection]
19679
19948
  );
19680
- React111__default.useEffect(() => {
19949
+ React113__default.useEffect(() => {
19681
19950
  let cancelled = false;
19682
19951
  (async () => {
19683
19952
  if (!request) {
@@ -19921,7 +20190,7 @@ function Row2({ label: label2, value }) {
19921
20190
  function PageActions({ actions, className }) {
19922
20191
  const access = useAccessOptional();
19923
20192
  const openUpgrade = useUpgradeModalStore((s) => s.open);
19924
- const resolved = React111__default.useMemo(
20193
+ const resolved = React113__default.useMemo(
19925
20194
  () => actions.map((a) => {
19926
20195
  const { permission, limitKey, onSelect, ...rest } = a;
19927
20196
  let hidden = false;
@@ -19951,25 +20220,25 @@ function AddConnectorPanel({
19951
20220
  onSelect
19952
20221
  }) {
19953
20222
  const { t } = useTranslation$1();
19954
- const [query, setQuery] = React111__default.useState("");
20223
+ const [query, setQuery] = React113__default.useState("");
19955
20224
  const modules = useInstalledModuleIds();
19956
20225
  const catalog = useConnectorCatalog();
19957
20226
  const scoped = !!categories?.length;
19958
- const addable = React111__default.useMemo(
20227
+ const addable = React113__default.useMemo(
19959
20228
  () => inCategories(addableConnectors(connectors ?? []), categories),
19960
20229
  [connectors, categories]
19961
20230
  );
19962
- const shelf = React111__default.useMemo(() => {
20231
+ const shelf = React113__default.useMemo(() => {
19963
20232
  if (connectors === null) return [];
19964
20233
  return inCategories(
19965
20234
  shelfIntegrations({ present: connectors, installedModules: modules, catalog: catalog ?? [] }),
19966
20235
  categories
19967
20236
  );
19968
20237
  }, [connectors, modules, catalog, categories]);
19969
- const filtered = React111__default.useMemo(() => filterConnectors(addable, "all", query), [addable, query]);
19970
- const filteredShelf = React111__default.useMemo(() => filterAvailable(shelf, query), [shelf, query]);
19971
- const soon = React111__default.useMemo(() => comingSoonHere(filteredShelf), [filteredShelf]);
19972
- const elsewhere = React111__default.useMemo(() => withAnotherModule(filteredShelf), [filteredShelf]);
20238
+ const filtered = React113__default.useMemo(() => filterConnectors(addable, "all", query), [addable, query]);
20239
+ const filteredShelf = React113__default.useMemo(() => filterAvailable(shelf, query), [shelf, query]);
20240
+ const soon = React113__default.useMemo(() => comingSoonHere(filteredShelf), [filteredShelf]);
20241
+ const elsewhere = React113__default.useMemo(() => withAnotherModule(filteredShelf), [filteredShelf]);
19973
20242
  const searchable = addable.length + shelf.length > 6;
19974
20243
  return /* @__PURE__ */ jsx(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ModalContent, { size: "2xl", children: [
19975
20244
  /* @__PURE__ */ jsxs(ModalHeader, { children: [
@@ -20128,22 +20397,22 @@ function AddConnectorButton({ onClick }) {
20128
20397
  function ConnectorsTab() {
20129
20398
  const { t } = useTranslation$1();
20130
20399
  const { connectors, error, reload, revokeGrant, agentAvailable, tenantReady } = useConnectors();
20131
- const [adding, setAdding] = React111__default.useState(false);
20132
- const [selected, setSelected] = React111__default.useState(null);
20133
- const [filter, setFilter] = React111__default.useState("all");
20134
- const [failure, setFailure] = React111__default.useState(null);
20135
- const [revoking, setRevoking] = React111__default.useState(null);
20400
+ const [adding, setAdding] = React113__default.useState(false);
20401
+ const [selected, setSelected] = React113__default.useState(null);
20402
+ const [filter, setFilter] = React113__default.useState("all");
20403
+ const [failure, setFailure] = React113__default.useState(null);
20404
+ const [revoking, setRevoking] = React113__default.useState(null);
20136
20405
  const assistantAvailable = useConnectorsPanelAvailable();
20137
- const openJourney = React111__default.useCallback(
20406
+ const openJourney = React113__default.useCallback(
20138
20407
  (connector) => {
20139
20408
  if (assistantAvailable) openConnectorsPanel(connector);
20140
20409
  else setSelected(connector);
20141
20410
  },
20142
20411
  [assistantAvailable]
20143
20412
  );
20144
- const visible = React111__default.useMemo(() => filterConnectors(connectors ?? [], filter), [connectors, filter]);
20145
- const groups = React111__default.useMemo(() => groupConnectors(visible), [visible]);
20146
- React111__default.useEffect(() => {
20413
+ const visible = React113__default.useMemo(() => filterConnectors(connectors ?? [], filter), [connectors, filter]);
20414
+ const groups = React113__default.useMemo(() => groupConnectors(visible), [visible]);
20415
+ React113__default.useEffect(() => {
20147
20416
  if (!selected || !connectors) return;
20148
20417
  const fresh = connectors.find((c) => c.id === selected.id);
20149
20418
  if (fresh && fresh !== selected) setSelected(fresh);
@@ -20178,7 +20447,7 @@ function ConnectorsTab() {
20178
20447
  (connectors?.length ?? 0) > 4 && /* @__PURE__ */ jsx(Filters, { value: filter, onChange: setFilter }),
20179
20448
  connectors === null && /* @__PURE__ */ jsx(ConnectionsSkeleton, {}),
20180
20449
  connectors !== null && visible.length === 0 && /* @__PURE__ */ jsx(Empty2, { title: t("connectors.emptyTitle"), body: t("connectors.emptyBody") }),
20181
- visible.length > 0 && /* @__PURE__ */ jsx("ul", { className: "fayz-glass-surface divide-y divide-border overflow-hidden rounded-card border bg-card text-card-foreground shadow-sm", children: groups.map((group) => /* @__PURE__ */ jsxs(React111__default.Fragment, { children: [
20450
+ visible.length > 0 && /* @__PURE__ */ jsx("ul", { className: "fayz-glass-surface divide-y divide-border overflow-hidden rounded-card border bg-card text-card-foreground shadow-sm", children: groups.map((group) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
20182
20451
  groups.length > 1 && /* @__PURE__ */ jsx(
20183
20452
  "li",
20184
20453
  {
@@ -20316,7 +20585,7 @@ function oauthFailureMessage(t, result) {
20316
20585
  function useConnectorOAuthReturn() {
20317
20586
  const { t } = useTranslation$1();
20318
20587
  const runtime = usePluginRuntimeOptional();
20319
- React111__default.useEffect(() => {
20588
+ React113__default.useEffect(() => {
20320
20589
  if (typeof window === "undefined") return;
20321
20590
  const result = readConnectorOAuthReturn(window.location.search);
20322
20591
  if (!result) return;
@@ -20351,8 +20620,8 @@ function ConnectorDeliveries({
20351
20620
  limit = 10
20352
20621
  }) {
20353
20622
  const { t } = useTranslation$1();
20354
- const [rows, setRows] = React111__default.useState(null);
20355
- React111__default.useEffect(() => {
20623
+ const [rows, setRows] = React113__default.useState(null);
20624
+ React113__default.useEffect(() => {
20356
20625
  let cancelled = false;
20357
20626
  void load({ limit }).then((r) => {
20358
20627
  if (!cancelled) setRows(r);
@@ -20426,11 +20695,11 @@ var CURRENCIES = [
20426
20695
  function CompanySettings({ tenant, onSave }) {
20427
20696
  const { t } = useTranslation$1();
20428
20697
  const { locale: uiLocale, setLocale: setUiLocale } = useLocaleStore();
20429
- const [name, setName] = React111.useState(tenant?.name ?? "");
20430
- const [timezone, setTimezone] = React111.useState(tenant?.settings?.timezone ?? "UTC");
20431
- const [currency, setCurrency] = React111.useState(tenant?.settings?.currency ?? "USD");
20432
- const [saving, setSaving] = React111.useState(false);
20433
- React111.useEffect(() => {
20698
+ const [name, setName] = React113.useState(tenant?.name ?? "");
20699
+ const [timezone, setTimezone] = React113.useState(tenant?.settings?.timezone ?? "UTC");
20700
+ const [currency, setCurrency] = React113.useState(tenant?.settings?.currency ?? "USD");
20701
+ const [saving, setSaving] = React113.useState(false);
20702
+ React113.useEffect(() => {
20434
20703
  if (tenant) {
20435
20704
  setName(tenant.name);
20436
20705
  setTimezone(tenant.settings?.timezone ?? "UTC");
@@ -20522,15 +20791,15 @@ function UnitModeCard() {
20522
20791
  const units = useUnitStore((s) => s.units);
20523
20792
  const setMode = useUnitStore((s) => s.setMode);
20524
20793
  const load = useUnitStore((s) => s.load);
20525
- const [unbound, setUnbound] = React111.useState(null);
20526
- const [bindEveryone, setBindEveryone] = React111.useState(true);
20527
- const [pending2, setPending] = React111.useState(null);
20528
- const [saving, setSaving] = React111.useState(false);
20529
- const headquarters = React111.useMemo(
20794
+ const [unbound, setUnbound] = React113.useState(null);
20795
+ const [bindEveryone, setBindEveryone] = React113.useState(true);
20796
+ const [pending2, setPending] = React113.useState(null);
20797
+ const [saving, setSaving] = React113.useState(false);
20798
+ const headquarters = React113.useMemo(
20530
20799
  () => units.find((u) => u.isHeadquarters && u.kind !== "region") ?? units.find((u) => u.kind !== "region"),
20531
20800
  [units]
20532
20801
  );
20533
- React111.useEffect(() => {
20802
+ React113.useEffect(() => {
20534
20803
  if (!org?.id || unitMode) return;
20535
20804
  let alive = true;
20536
20805
  void countUnboundMembers(org.id).then((n) => {
@@ -20694,10 +20963,10 @@ function getInitials(name) {
20694
20963
  }
20695
20964
  function UserProfile({ user, onSave, onAvatarChange }) {
20696
20965
  const { t } = useTranslation$1();
20697
- const [fullName, setFullName] = React111.useState(user?.fullName ?? "");
20698
- const [saving, setSaving] = React111.useState(false);
20699
- const fileInputRef = React111.useRef(null);
20700
- React111.useEffect(() => {
20966
+ const [fullName, setFullName] = React113.useState(user?.fullName ?? "");
20967
+ const [saving, setSaving] = React113.useState(false);
20968
+ const fileInputRef = React113.useRef(null);
20969
+ React113.useEffect(() => {
20701
20970
  if (user) {
20702
20971
  setFullName(user.fullName);
20703
20972
  }
@@ -20837,8 +21106,8 @@ async function fetchMyPersonId(tenantId2, userId) {
20837
21106
  function useMyPersonId(enabled = true) {
20838
21107
  const orgId = useOrganizationStore((s) => s.currentOrg?.id);
20839
21108
  const userId = useAuthStore((s) => s.user?.id);
20840
- const [personId, setPersonId] = React111.useState(void 0);
20841
- React111.useEffect(() => {
21109
+ const [personId, setPersonId] = React113.useState(void 0);
21110
+ React113.useEffect(() => {
20842
21111
  if (!enabled || !orgId || !userId) return;
20843
21112
  let alive = true;
20844
21113
  void dedup(`self:person:${orgId}:${userId}`, () => fetchMyPersonId(orgId, userId)).then((id) => {
@@ -20898,18 +21167,18 @@ function MyWorkspaceCard() {
20898
21167
  const myUnitIds = useUnitStore((s) => s.myUnitIds);
20899
21168
  const activeUnitId = useUnitStore((s) => s.activeUnitId);
20900
21169
  const entryReason = useUnitStore((s) => s.entryReason);
20901
- const [person, setPerson] = React111.useState(void 0);
20902
- const [candidate, setCandidate] = React111.useState(null);
20903
- const [linking, setLinking] = React111.useState(false);
21170
+ const [person, setPerson] = React113.useState(void 0);
21171
+ const [candidate, setCandidate] = React113.useState(null);
21172
+ const [linking, setLinking] = React113.useState(false);
20904
21173
  const orgId = currentOrg?.id;
20905
21174
  const userId = user?.id;
20906
- const load = React111.useCallback(async () => {
21175
+ const load = React113.useCallback(async () => {
20907
21176
  if (!orgId || !userId) return;
20908
21177
  const linked = await fetchMyPersonRecord(orgId, userId);
20909
21178
  setPerson(linked);
20910
21179
  setCandidate(linked ? null : await findMyPersonCandidate(orgId, user?.email, staffKinds));
20911
21180
  }, [orgId, userId, user?.email, staffKinds]);
20912
- React111.useEffect(() => {
21181
+ React113.useEffect(() => {
20913
21182
  void load();
20914
21183
  }, [load]);
20915
21184
  if (!currentOrg) return null;
@@ -21003,10 +21272,10 @@ var useStore = create((set) => ({
21003
21272
  function useHeaderAction(zone, action) {
21004
21273
  const register = useStore((s) => s.register);
21005
21274
  const unregister = useStore((s) => s.unregister);
21006
- const latest = React111.useRef(action);
21275
+ const latest = React113.useRef(action);
21007
21276
  latest.current = action;
21008
21277
  const id = action?.id;
21009
- React111.useEffect(() => {
21278
+ React113.useEffect(() => {
21010
21279
  if (!zone || !id) return;
21011
21280
  const current2 = latest.current;
21012
21281
  if (current2) register(zone, { ...current2, onSelect: () => latest.current?.onSelect() });
@@ -21015,7 +21284,7 @@ function useHeaderAction(zone, action) {
21015
21284
  }
21016
21285
  function useHeaderActions(zone) {
21017
21286
  const byZone = useStore((s) => s.byZone);
21018
- return React111.useMemo(() => Object.values(byZone[zone] ?? {}), [byZone, zone]);
21287
+ return React113.useMemo(() => Object.values(byZone[zone] ?? {}), [byZone, zone]);
21019
21288
  }
21020
21289
  function useUserLabel(userId) {
21021
21290
  const members = useOrganizationStore((s) => s.members);
@@ -21056,7 +21325,7 @@ function formatStamp(value) {
21056
21325
  if (!value) return null;
21057
21326
  const date = new Date(String(value));
21058
21327
  if (Number.isNaN(date.getTime())) return null;
21059
- return date.toLocaleString(void 0, {
21328
+ return date.toLocaleString(getCurrentLocale(), {
21060
21329
  day: "2-digit",
21061
21330
  month: "2-digit",
21062
21331
  year: "numeric",
@@ -21745,7 +22014,7 @@ function SubjectFormLayout({ fields, allFields, fieldGroups, values, onChange, r
21745
22014
  const IconComponent = getLucideIcon(entityIcon ?? "Heart") ?? Heart;
21746
22015
  return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
21747
22016
  /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "pt-5", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-5", children: [
21748
- /* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children: React111__default.createElement(IconComponent, { className: "h-8 w-8" }) }),
22017
+ /* @__PURE__ */ jsx("div", { className: "flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary", children: React113__default.createElement(IconComponent, { className: "h-8 w-8" }) }),
21749
22018
  /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-4", children: [
21750
22019
  /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
21751
22020
  nameField && /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1.5", children: [
@@ -22213,14 +22482,14 @@ function ImageSlot({
22213
22482
  onDraftFile
22214
22483
  }) {
22215
22484
  const t = useTranslation();
22216
- const inputRef = React111__default.useRef(null);
22217
- const [url, setUrl] = React111__default.useState(() => image.get(row));
22218
- const [busy, setBusy] = React111__default.useState(false);
22219
- const [error, setError] = React111__default.useState(null);
22220
- const draftUrlRef = React111__default.useRef(null);
22485
+ const inputRef = React113__default.useRef(null);
22486
+ const [url, setUrl] = React113__default.useState(() => image.get(row));
22487
+ const [busy, setBusy] = React113__default.useState(false);
22488
+ const [error, setError] = React113__default.useState(null);
22489
+ const draftUrlRef = React113__default.useRef(null);
22221
22490
  const currentUrl = image.get(row);
22222
22491
  const draftFile = image.draftField ? row[image.draftField] : void 0;
22223
- React111__default.useEffect(() => {
22492
+ React113__default.useEffect(() => {
22224
22493
  if (draftFile) return;
22225
22494
  if (draftUrlRef.current) {
22226
22495
  URL.revokeObjectURL(draftUrlRef.current);
@@ -22228,7 +22497,7 @@ function ImageSlot({
22228
22497
  }
22229
22498
  setUrl(currentUrl);
22230
22499
  }, [currentUrl, draftFile]);
22231
- React111__default.useEffect(() => () => {
22500
+ React113__default.useEffect(() => () => {
22232
22501
  if (draftUrlRef.current) URL.revokeObjectURL(draftUrlRef.current);
22233
22502
  }, []);
22234
22503
  const acceptsDraft = !canEdit && Boolean(image.draftField && onDraftFile);
@@ -22346,7 +22615,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
22346
22615
  const [values, setValues] = useState(computeInit);
22347
22616
  const [saving, setSaving] = useState(false);
22348
22617
  const [invalidKeys, setInvalidKeys] = useState(EMPTY_KEYS);
22349
- const initialRef = React111__default.useRef(JSON.stringify(values));
22618
+ const initialRef = React113__default.useRef(JSON.stringify(values));
22350
22619
  useEffect(() => {
22351
22620
  const init = computeInit();
22352
22621
  setValues(init);
@@ -22391,7 +22660,7 @@ function CrudFormPage({ entityDef, mode, initialData, onSubmit, onCancel, namePl
22391
22660
  if (submitRef) submitRef.current = () => {
22392
22661
  void submit();
22393
22662
  };
22394
- React111__default.useEffect(() => () => {
22663
+ React113__default.useEffect(() => () => {
22395
22664
  if (submitRef) submitRef.current = null;
22396
22665
  }, [submitRef]);
22397
22666
  const dirty = JSON.stringify(values) !== initialRef.current;
@@ -22991,7 +23260,7 @@ function CrudListView({
22991
23260
  if (onImport) {
22992
23261
  createRoutes.push({ id: "import", label: t("crud.import.action"), description: t("crud.import.hint"), icon: "Upload", action: onImport });
22993
23262
  }
22994
- const createActions = React111__default.useMemo(() => {
23263
+ const createActions = React113__default.useMemo(() => {
22995
23264
  const out = createRoutes.map((qa, i) => ({
22996
23265
  id: qa.id,
22997
23266
  label: qa.label,
@@ -23388,9 +23657,9 @@ function buildCrudSurfaceContribution(read3) {
23388
23657
  };
23389
23658
  }
23390
23659
  function CrudAgentSurface(props) {
23391
- const ref = React111.useRef(props);
23660
+ const ref = React113.useRef(props);
23392
23661
  ref.current = props;
23393
- const contribution = React111.useMemo(
23662
+ const contribution = React113.useMemo(
23394
23663
  () => buildCrudSurfaceContribution(() => ref.current),
23395
23664
  []
23396
23665
  );
@@ -23441,7 +23710,7 @@ function useFieldRules(entityKey) {
23441
23710
  };
23442
23711
  }, [entityKey, fieldRules]);
23443
23712
  }
23444
- var ImportWizard2 = React111__default.lazy(
23713
+ var ImportWizard2 = React113__default.lazy(
23445
23714
  () => import('./ImportWizard-CISHGNQC.js').then((m) => ({ default: m.ImportWizard }))
23446
23715
  );
23447
23716
  var PAGE_SIZE = 50;
@@ -23926,7 +24195,7 @@ function CrudPage({ entityDef: rawEntityDef, useStore: useStore2, basePath, disp
23926
24195
  displayValue: deleteItem ? deleteItem[displayField] : void 0
23927
24196
  }
23928
24197
  ),
23929
- /* @__PURE__ */ jsx(React111__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
24198
+ /* @__PURE__ */ jsx(React113__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
23930
24199
  ImportWizard2,
23931
24200
  {
23932
24201
  open: importOpen,
@@ -24232,7 +24501,7 @@ function columnOf(entity, key) {
24232
24501
  function RelatedListTab({ item, related }) {
24233
24502
  const parentId = item?.id;
24234
24503
  const pathname = useHashPath();
24235
- const Page = React111.useMemo(() => {
24504
+ const Page = React113.useMemo(() => {
24236
24505
  if (!parentId) return null;
24237
24506
  const child = related.entity;
24238
24507
  const fkColumn = columnOf(child, related.foreignKey);
@@ -24259,8 +24528,8 @@ function tabBasePath(pathname, tabId) {
24259
24528
  }
24260
24529
  function useHashPath() {
24261
24530
  const read3 = () => typeof window === "undefined" ? "/" : window.location.hash.slice(1) || "/";
24262
- const [path, setPath] = React111.useState(read3);
24263
- React111.useEffect(() => {
24531
+ const [path, setPath] = React113.useState(read3);
24532
+ React113.useEffect(() => {
24264
24533
  const handler = () => setPath(read3());
24265
24534
  window.addEventListener("hashchange", handler);
24266
24535
  return () => window.removeEventListener("hashchange", handler);
@@ -24650,30 +24919,30 @@ function AccessTab({ item }) {
24650
24919
  const hasSystemPermission = useSystemPermission();
24651
24920
  const canManageTeam = hasSystemPermission("manage_team");
24652
24921
  const guardSeats = useLimitGuard("users");
24653
- const [access, setAccess] = React111.useState(void 0);
24654
- const [email, setEmail] = React111.useState(person?.email ?? "");
24655
- const [roleId, setRoleId] = React111.useState("");
24656
- const [busy, setBusy] = React111.useState(false);
24657
- const [confirmRemove, setConfirmRemove] = React111.useState(false);
24658
- React111.useEffect(() => {
24922
+ const [access, setAccess] = React113.useState(void 0);
24923
+ const [email, setEmail] = React113.useState(person?.email ?? "");
24924
+ const [roleId, setRoleId] = React113.useState("");
24925
+ const [busy, setBusy] = React113.useState(false);
24926
+ const [confirmRemove, setConfirmRemove] = React113.useState(false);
24927
+ React113.useEffect(() => {
24659
24928
  if (!roleId && profiles.length) setRoleId(profiles[1]?.id ?? profiles[0].id);
24660
24929
  }, [profiles, roleId]);
24661
- React111.useEffect(() => {
24930
+ React113.useEffect(() => {
24662
24931
  setEmail(person?.email ?? "");
24663
24932
  }, [person?.email]);
24664
- const reload = React111.useCallback(async () => {
24933
+ const reload = React113.useCallback(async () => {
24665
24934
  if (!personId) return;
24666
24935
  setAccess(await fetchPersonAccess(personId));
24667
24936
  }, [personId]);
24668
- React111.useEffect(() => {
24937
+ React113.useEffect(() => {
24669
24938
  void reload();
24670
24939
  }, [reload]);
24671
- React111.useEffect(() => {
24940
+ React113.useEffect(() => {
24672
24941
  if (!adapter || !currentOrg || invites.length > 0) return;
24673
24942
  adapter.listInvites(currentOrg.id).then(setInvites).catch(() => {
24674
24943
  });
24675
24944
  }, [adapter, currentOrg?.id]);
24676
- const pendingInvite = React111.useMemo(() => {
24945
+ const pendingInvite = React113.useMemo(() => {
24677
24946
  const target = (person?.email ?? "").trim().toLowerCase();
24678
24947
  if (!target) return void 0;
24679
24948
  return invites.find((i) => i.status === "pending" && i.email.toLowerCase() === target);
@@ -24898,10 +25167,10 @@ async function setPersonBookable(personId, isBookable) {
24898
25167
  }
24899
25168
  function BookableToggle({ personId }) {
24900
25169
  const t = useTranslation();
24901
- const [value, setValue] = React111__default.useState(null);
24902
- const [loading, setLoading] = React111__default.useState(true);
24903
- const [saving, setSaving] = React111__default.useState(false);
24904
- React111__default.useEffect(() => {
25170
+ const [value, setValue] = React113__default.useState(null);
25171
+ const [loading, setLoading] = React113__default.useState(true);
25172
+ const [saving, setSaving] = React113__default.useState(false);
25173
+ React113__default.useEffect(() => {
24905
25174
  let cancelled = false;
24906
25175
  setLoading(true);
24907
25176
  getPersonBookable(personId).then((v) => {
@@ -24951,11 +25220,11 @@ function PersonUnitsTab({ item }) {
24951
25220
  const units = useUnitStore((s) => s.units);
24952
25221
  const unitMode = useUnitStore((s) => s.unitMode);
24953
25222
  const profiles = usePermissionsStore((s) => s.profiles);
24954
- const [userId, setUserId] = React111.useState(void 0);
24955
- const [bindings, setBindings] = React111.useState({});
24956
- const [busy, setBusy] = React111.useState(null);
25223
+ const [userId, setUserId] = React113.useState(void 0);
25224
+ const [bindings, setBindings] = React113.useState({});
25225
+ const [busy, setBusy] = React113.useState(null);
24957
25226
  const bindingsVersion = useDataVersion(UNIT_ACCESS_CHANGED);
24958
- React111.useEffect(() => {
25227
+ React113.useEffect(() => {
24959
25228
  if (!personId) return;
24960
25229
  let alive = true;
24961
25230
  void fetchUserIdForPerson(personId).then((uid2) => {
@@ -24965,11 +25234,11 @@ function PersonUnitsTab({ item }) {
24965
25234
  alive = false;
24966
25235
  };
24967
25236
  }, [personId]);
24968
- const reload = React111.useCallback(async (uid2) => {
25237
+ const reload = React113.useCallback(async (uid2) => {
24969
25238
  const rows = await fetchMemberUnits(uid2);
24970
25239
  setBindings(Object.fromEntries(rows.map((r) => [r.locationId, r.role])));
24971
25240
  }, []);
24972
- React111.useEffect(() => {
25241
+ React113.useEffect(() => {
24973
25242
  if (userId) void reload(userId);
24974
25243
  }, [userId, reload, bindingsVersion]);
24975
25244
  async function toggle(unitId, on) {
@@ -25064,7 +25333,7 @@ function PersonUnitsTab({ item }) {
25064
25333
  ] })
25065
25334
  ] }) });
25066
25335
  }
25067
- var ScheduleEditor = React111__default.lazy(
25336
+ var ScheduleEditor = React113__default.lazy(
25068
25337
  () => import('./ScheduleEditor-B7PLFGVM.js').then((m) => ({ default: m.ScheduleEditor }))
25069
25338
  );
25070
25339
  function ComingSoon({ icon: Icon, title, description }) {
@@ -25147,7 +25416,7 @@ function ScheduleTab({ item }) {
25147
25416
  }
25148
25417
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
25149
25418
  /* @__PURE__ */ jsx(BookableToggle, { personId: item.id }),
25150
- /* @__PURE__ */ jsx(React111__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ScheduleEditor, { assigneeId: item.id }) })
25419
+ /* @__PURE__ */ jsx(React113__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ScheduleEditor, { assigneeId: item.id }) })
25151
25420
  ] });
25152
25421
  }
25153
25422
  var PERSON_DETAIL_TABS = [
@@ -25528,7 +25797,7 @@ function InlineEditor({
25528
25797
  }) {
25529
25798
  const [draft, setDraft] = useState(value ?? "");
25530
25799
  const [saving, setSaving] = useState(false);
25531
- const inputRef = React111__default.useRef(null);
25800
+ const inputRef = React113__default.useRef(null);
25532
25801
  useEffect(() => {
25533
25802
  inputRef.current?.focus();
25534
25803
  if (inputRef.current instanceof HTMLInputElement) inputRef.current.select();
@@ -25805,7 +26074,7 @@ function CrudDetailPage({
25805
26074
  const displayFieldDef = entityDef.fields.find((f) => f.key === displayField);
25806
26075
  const nameEditable = Boolean(onFieldSave) && Boolean(displayFieldDef) && isInlineEditable(displayFieldDef);
25807
26076
  const [editingName, setEditingName] = useState(false);
25808
- const imageInputRef = React111__default.useRef(null);
26077
+ const imageInputRef = React113__default.useRef(null);
25809
26078
  const runtime = usePluginRuntimeOptional();
25810
26079
  const archetypeTabs = getArchetypeTabs(entityDef.layout, entityDef.data?.archetypeKind);
25811
26080
  const relatedTabs = (entityDef.relatedLists ?? []).map((related) => ({
@@ -25860,7 +26129,7 @@ function CrudDetailPage({
25860
26129
  const base = `${basePath}/${item.id}/${selectedTab}`;
25861
26130
  window.history.replaceState(null, "", `#${segments.length ? `${base}/${segments.join("/")}` : base}`);
25862
26131
  }, [basePath, item.id, selectedTab, embedded]);
25863
- const headerNode = React111__default.useMemo(
26132
+ const headerNode = React113__default.useMemo(
25864
26133
  () => embedded ? null : /* @__PURE__ */ jsx(SubpageHeader, { title: displayValue, parentLabel: namePlural, onBack }),
25865
26134
  [embedded, displayValue, namePlural, onBack]
25866
26135
  );
@@ -25985,12 +26254,12 @@ function CrudDetailPage({
25985
26254
  ] }, tab.id);
25986
26255
  })
25987
26256
  ] }),
25988
- /* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ? React111__default.createElement(entityDef.overviewComponent, { item, entityDef }) : /* @__PURE__ */ jsx(OverviewTab, { entityDef, item, compact: embedded, onFieldSave }) }),
26257
+ /* @__PURE__ */ jsx(TabsContent, { value: "overview", className: embedded ? "mt-2" : "mt-4", children: entityDef.overviewComponent ? React113__default.createElement(entityDef.overviewComponent, { item, entityDef }) : /* @__PURE__ */ jsx(OverviewTab, { entityDef, item, compact: embedded, onFieldSave }) }),
25989
26258
  customTabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, { value: tab.id, className: "mt-4", children: tab.component ? (
25990
26259
  // `tabPath` only to the tab the URL is actually addressing —
25991
26260
  // handing it to every tab would have the documents tab trying to
25992
26261
  // open a recording id when the user switches across.
25993
- React111__default.createElement(tab.component, {
26262
+ React113__default.createElement(tab.component, {
25994
26263
  item,
25995
26264
  entityDef,
25996
26265
  ...tab.id === selectedTab ? { tabPath, setTabPath } : {},
@@ -26022,8 +26291,8 @@ function MyRecordPanel() {
26022
26291
  const userId = useAuthStore((s) => s.user?.id);
26023
26292
  const members = useOrganizationStore((s) => s.members);
26024
26293
  const myRole = members.find((m) => m.userId === userId)?.profileName;
26025
- const [state, setState] = React111.useState({ status: "loading" });
26026
- const load = React111.useCallback(async () => {
26294
+ const [state, setState] = React113.useState({ status: "loading" });
26295
+ const load = React113.useCallback(async () => {
26027
26296
  if (!orgId || !userId) return;
26028
26297
  const person = await dedup(`self:record:${orgId}:${userId}`, () => fetchMyPersonRecord(orgId, userId));
26029
26298
  if (!person) return setState({ status: "none" });
@@ -26040,10 +26309,10 @@ function MyRecordPanel() {
26040
26309
  setState({ status: "none" });
26041
26310
  }
26042
26311
  }, [orgId, userId]);
26043
- React111.useEffect(() => {
26312
+ React113.useEffect(() => {
26044
26313
  void load();
26045
26314
  }, [load]);
26046
- const changePhoto = React111.useCallback(async (file) => {
26315
+ const changePhoto = React113.useCallback(async (file) => {
26047
26316
  if (state.status !== "ready") return;
26048
26317
  const supabase = getFayzSupabaseClientOptional();
26049
26318
  if (!supabase) return;
@@ -26099,8 +26368,8 @@ function ConnectedUserProfile() {
26099
26368
  const myPersonId = useMyPersonId();
26100
26369
  const hasRecord = Boolean(myPersonId);
26101
26370
  const setUser = useAuthStore((s) => s.setUser);
26102
- const [profile, setProfile] = React111.useState(null);
26103
- React111.useEffect(() => {
26371
+ const [profile, setProfile] = React113.useState(null);
26372
+ React113.useEffect(() => {
26104
26373
  const supabase = getFayzSupabaseClientOptional();
26105
26374
  if (!user || !supabase) return;
26106
26375
  let cancelled = false;
@@ -26211,9 +26480,9 @@ function SecuritySettings({
26211
26480
  onTenantSecurityChange
26212
26481
  }) {
26213
26482
  const { t } = useTranslation$1();
26214
- const [resetting, setResetting] = React111.useState(false);
26215
- const [resetSent, setResetSent] = React111.useState(false);
26216
- const [savingTenant, setSavingTenant] = React111.useState(false);
26483
+ const [resetting, setResetting] = React113.useState(false);
26484
+ const [resetSent, setResetSent] = React113.useState(false);
26485
+ const [savingTenant, setSavingTenant] = React113.useState(false);
26217
26486
  const handleResetPassword = async () => {
26218
26487
  if (!onResetPassword) return;
26219
26488
  setResetting(true);
@@ -26387,8 +26656,8 @@ function FileUploadField({
26387
26656
  hint
26388
26657
  }) {
26389
26658
  const { t } = useTranslation$1();
26390
- const inputRef = React111.useRef(null);
26391
- const [preview, setPreview] = React111.useState(null);
26659
+ const inputRef = React113.useRef(null);
26660
+ const [preview, setPreview] = React113.useState(null);
26392
26661
  const handleChange = (e) => {
26393
26662
  const file = e.target.files?.[0];
26394
26663
  if (file) {
@@ -26554,13 +26823,13 @@ function BrandPreview({ brand, t }) {
26554
26823
  }
26555
26824
  function BrandingSettings({ brand, onSave }) {
26556
26825
  const { t } = useTranslation$1();
26557
- const [section, setSection] = React111.useState("identity");
26558
- const [saved, setSaved] = React111.useState(brand ?? EMPTY_BRAND);
26559
- const [draft, setDraft] = React111.useState(brand ?? EMPTY_BRAND);
26560
- const [logoFile, setLogoFile] = React111.useState(null);
26561
- const [faviconFile, setFaviconFile] = React111.useState(null);
26562
- const [saving, setSaving] = React111.useState(false);
26563
- React111.useEffect(() => {
26826
+ const [section, setSection] = React113.useState("identity");
26827
+ const [saved, setSaved] = React113.useState(brand ?? EMPTY_BRAND);
26828
+ const [draft, setDraft] = React113.useState(brand ?? EMPTY_BRAND);
26829
+ const [logoFile, setLogoFile] = React113.useState(null);
26830
+ const [faviconFile, setFaviconFile] = React113.useState(null);
26831
+ const [saving, setSaving] = React113.useState(false);
26832
+ React113.useEffect(() => {
26564
26833
  if (brand) {
26565
26834
  setSaved(brand);
26566
26835
  setDraft(brand);
@@ -26844,11 +27113,11 @@ function ConnectedBrandingSettings() {
26844
27113
  toast.error("N\xE3o foi poss\xEDvel salvar a marca", { description: err?.message });
26845
27114
  }
26846
27115
  };
26847
- const [brand, setBrand] = React111.useState(() => normalizeBrand(
27116
+ const [brand, setBrand] = React113.useState(() => normalizeBrand(
26848
27117
  (currentOrg?.settings ?? {}).branding,
26849
27118
  { name: currentOrg?.name, logoUrl: currentOrg?.logoUrl }
26850
27119
  ));
26851
- React111.useEffect(() => {
27120
+ React113.useEffect(() => {
26852
27121
  let alive = true;
26853
27122
  void (async () => {
26854
27123
  try {
@@ -26969,12 +27238,12 @@ function ProjectsSettings() {
26969
27238
  const projects = useFayzProjectsStore((s) => s.projects);
26970
27239
  const load = useFayzProjectsStore((s) => s.load);
26971
27240
  const refresh = useFayzProjectsStore((s) => s.refresh);
26972
- const [linking, setLinking] = React111.useState(false);
27241
+ const [linking, setLinking] = React113.useState(false);
26973
27242
  const connected = isPlatformConnected();
26974
- React111.useEffect(() => {
27243
+ React113.useEffect(() => {
26975
27244
  void load(currentOrgId);
26976
27245
  }, [currentOrgId, load]);
26977
- React111.useEffect(() => {
27246
+ React113.useEffect(() => {
26978
27247
  if (!connected || projects.length === 0) return;
26979
27248
  let cancelled = false;
26980
27249
  void (async () => {
@@ -27046,7 +27315,7 @@ function SiteRow({
27046
27315
  showDefaultAction,
27047
27316
  onChanged
27048
27317
  }) {
27049
- const [busy, setBusy] = React111.useState(false);
27318
+ const [busy, setBusy] = React113.useState(false);
27050
27319
  const editorUrl = editorUrlOf(project);
27051
27320
  const run = async (action) => {
27052
27321
  setBusy(true);
@@ -27117,7 +27386,7 @@ function SiteRow({
27117
27386
  ] });
27118
27387
  }
27119
27388
  function LinkSiteModal({ onClose, onLinked }) {
27120
- const [mode, setMode] = React111.useState("import");
27389
+ const [mode, setMode] = React113.useState("import");
27121
27390
  return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(ModalContent, { size: "lg", children: [
27122
27391
  /* @__PURE__ */ jsxs(ModalHeader, { children: [
27123
27392
  /* @__PURE__ */ jsx(ModalTitle, { children: "Vincular um site" }),
@@ -27153,11 +27422,11 @@ function ModeTab({
27153
27422
  }
27154
27423
  function ImportPane({ onLinked }) {
27155
27424
  const linked = useFayzProjectsStore((s) => s.projects);
27156
- const [search, setSearch] = React111.useState("");
27157
- const [remote, setRemote] = React111.useState(null);
27158
- const [error, setError] = React111.useState(null);
27159
- const [linkingId, setLinkingId] = React111.useState(null);
27160
- React111.useEffect(() => {
27425
+ const [search, setSearch] = React113.useState("");
27426
+ const [remote, setRemote] = React113.useState(null);
27427
+ const [error, setError] = React113.useState(null);
27428
+ const [linkingId, setLinkingId] = React113.useState(null);
27429
+ React113.useEffect(() => {
27161
27430
  let cancelled = false;
27162
27431
  setError(null);
27163
27432
  const timer = setTimeout(() => {
@@ -27239,9 +27508,9 @@ function ImportPane({ onLinked }) {
27239
27508
  }
27240
27509
  function CreatePane({ onLinked, onCancel }) {
27241
27510
  const linked = useFayzProjectsStore((s) => s.projects);
27242
- const [prompt, setPrompt] = React111.useState("");
27243
- const [busy, setBusy] = React111.useState(false);
27244
- const [error, setError] = React111.useState(null);
27511
+ const [prompt, setPrompt] = React113.useState("");
27512
+ const [busy, setBusy] = React113.useState(false);
27513
+ const [error, setError] = React113.useState(null);
27245
27514
  const tooShort = prompt.trim().length < PROMPT_MIN_CHARS;
27246
27515
  const submit = async () => {
27247
27516
  setBusy(true);
@@ -27294,7 +27563,7 @@ function useCoreSettingsTabs({
27294
27563
  showBranding = true
27295
27564
  } = {}) {
27296
27565
  const { t } = useTranslation$1();
27297
- return React111.useMemo(() => [
27566
+ return React113.useMemo(() => [
27298
27567
  ...showCompany ? [{ id: "general", label: t("settings.general"), icon: /* @__PURE__ */ jsx(Building2, { className: "h-4 w-4" }), iconName: "Building2", component: /* @__PURE__ */ jsx(ConnectedCompanySettings, {}) }] : [],
27299
27568
  { id: "profile", label: t("settings.profile"), icon: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }), iconName: "User", component: /* @__PURE__ */ jsx(ConnectedUserProfile, {}) },
27300
27569
  { id: "security", label: t("settings.security"), icon: /* @__PURE__ */ jsx(Shield, { className: "h-4 w-4" }), iconName: "Shield", component: /* @__PURE__ */ jsx(ConnectedSecuritySettings, {}) },
@@ -27335,10 +27604,10 @@ function SettingsPage({
27335
27604
  }
27336
27605
  return null;
27337
27606
  }
27338
- const [activeTab, setActiveTab] = React111.useState(() => {
27607
+ const [activeTab, setActiveTab] = React113.useState(() => {
27339
27608
  return getTabFromHash() ?? defaultTab ?? null;
27340
27609
  });
27341
- React111.useEffect(() => {
27610
+ React113.useEffect(() => {
27342
27611
  const handler = () => {
27343
27612
  const tab = getTabFromHash();
27344
27613
  if (tab) setActiveTab(tab);
@@ -27361,7 +27630,7 @@ function SettingsPage({
27361
27630
  setActiveTab(null);
27362
27631
  window.location.hash = "/settings";
27363
27632
  };
27364
- const sections = React111.useMemo(() => {
27633
+ const sections = React113.useMemo(() => {
27365
27634
  const out = [];
27366
27635
  for (const tab of resolvedTabs) {
27367
27636
  const heading = tab.isPlugin ? tab.group ?? t("common.plugins") : null;
@@ -27432,14 +27701,14 @@ function InviteMemberDialog({ open, onOpenChange, defaultEmail }) {
27432
27701
  const profiles = usePermissionsStore((s) => s.profiles);
27433
27702
  const setInvites = useInviteStore((s) => s.setInvites);
27434
27703
  const { user } = useAuthStore();
27435
- const [emails, setEmails] = React111.useState([defaultEmail ?? ""]);
27436
- const [profileId, setProfileId] = React111.useState(profiles[1]?.id ?? profiles[0]?.id ?? "");
27437
- const [sending, setSending] = React111.useState(false);
27438
- const [sent, setSent] = React111.useState(false);
27439
- React111.useEffect(() => {
27704
+ const [emails, setEmails] = React113.useState([defaultEmail ?? ""]);
27705
+ const [profileId, setProfileId] = React113.useState(profiles[1]?.id ?? profiles[0]?.id ?? "");
27706
+ const [sending, setSending] = React113.useState(false);
27707
+ const [sent, setSent] = React113.useState(false);
27708
+ React113.useEffect(() => {
27440
27709
  if (open) setEmails([defaultEmail ?? ""]);
27441
27710
  }, [open, defaultEmail]);
27442
- React111.useEffect(() => {
27711
+ React113.useEffect(() => {
27443
27712
  if (!profileId && profiles.length) setProfileId(profiles[1]?.id ?? profiles[0].id);
27444
27713
  }, [profiles, profileId]);
27445
27714
  const addEmail = () => setEmails((prev) => [...prev, ""]);
@@ -27607,7 +27876,7 @@ function UnitSwitcher({ collapsed = false }) {
27607
27876
  const myUnitIds = useUnitStore((s) => s.myUnitIds);
27608
27877
  const activeUnitId = useUnitStore((s) => s.activeUnitId);
27609
27878
  const beginSwitch = useUnitSwitchingStore((s) => s.begin);
27610
- const [query, setQuery] = React111.useState("");
27879
+ const [query, setQuery] = React113.useState("");
27611
27880
  const singular = label(t, "unit.singular", "unidade");
27612
27881
  const plural = label(t, "unit.plural", "unidades");
27613
27882
  if (!unitMode) return null;
@@ -27632,13 +27901,13 @@ function UnitSwitcher({ collapsed = false }) {
27632
27901
  }
27633
27902
  const renderNode = (node, depth) => {
27634
27903
  if (node.kind === "region") {
27635
- return /* @__PURE__ */ jsxs(React111.Fragment, { children: [
27904
+ return /* @__PURE__ */ jsxs(React113.Fragment, { children: [
27636
27905
  /* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
27637
27906
  node.children.map((child) => renderNode(child, depth + 1))
27638
27907
  ] }, node.id);
27639
27908
  }
27640
27909
  if (!reachable.includes(node.id)) return null;
27641
- return /* @__PURE__ */ jsxs(React111.Fragment, { children: [
27910
+ return /* @__PURE__ */ jsxs(React113.Fragment, { children: [
27642
27911
  /* @__PURE__ */ jsxs(
27643
27912
  DropdownItem,
27644
27913
  {
@@ -27720,8 +27989,8 @@ function UnitSwitcher({ collapsed = false }) {
27720
27989
  var SEARCH_THRESHOLD = 7;
27721
27990
  function UnitMenuSection() {
27722
27991
  useUnitBootstrap();
27723
- const [query, setQuery] = React111.useState("");
27724
- const [locating, setLocating] = React111.useState(false);
27992
+ const [query, setQuery] = React113.useState("");
27993
+ const [locating, setLocating] = React113.useState(false);
27725
27994
  const unitMode = useUnitStore((s) => s.unitMode);
27726
27995
  const units = useUnitStore((s) => s.units);
27727
27996
  const tree = useUnitStore((s) => s.tree);
@@ -27741,13 +28010,13 @@ function UnitMenuSection() {
27741
28010
  (c) => (c.kind === "region" || reachable.includes(c.id)) && (matches2(node) || matches2(c))
27742
28011
  );
27743
28012
  if (visibleChildren.length === 0) return null;
27744
- return /* @__PURE__ */ jsxs(React111.Fragment, { children: [
28013
+ return /* @__PURE__ */ jsxs(React113.Fragment, { children: [
27745
28014
  /* @__PURE__ */ jsx(DropdownLabel, { className: "px-2 pt-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: node.name }),
27746
28015
  visibleChildren.map((child) => renderNode(child, depth + 1))
27747
28016
  ] }, node.id);
27748
28017
  }
27749
28018
  if (!reachable.includes(node.id) || !matches2(node)) return null;
27750
- return /* @__PURE__ */ jsxs(React111.Fragment, { children: [
28019
+ return /* @__PURE__ */ jsxs(React113.Fragment, { children: [
27751
28020
  /* @__PURE__ */ jsxs(
27752
28021
  DropdownItem,
27753
28022
  {
@@ -27925,9 +28194,9 @@ function MemberUnitsCell({
27925
28194
  const byId = useUnitStore((s) => s.byId);
27926
28195
  const unitMode = useUnitStore((s) => s.unitMode);
27927
28196
  const openUnit = useUnitPanel((s) => s.openUnit);
27928
- const [unitIds, setUnitIds] = React111.useState(null);
28197
+ const [unitIds, setUnitIds] = React113.useState(null);
27929
28198
  const version5 = useDataVersion(UNIT_ACCESS_CHANGED);
27930
- React111.useEffect(() => {
28199
+ React113.useEffect(() => {
27931
28200
  if (!userId) {
27932
28201
  setUnitIds([]);
27933
28202
  return;
@@ -27985,10 +28254,10 @@ function TeamTab() {
27985
28254
  const { user } = useAuthStore();
27986
28255
  const hasSystemPermission = useSystemPermission();
27987
28256
  const personMode = teamPersonKinds.length > 0 && typeof adapter?.listTeam === "function";
27988
- const [team, setTeam] = React111.useState(null);
27989
- const [inviteOpen, setInviteOpen] = React111.useState(false);
28257
+ const [team, setTeam] = React113.useState(null);
28258
+ const [inviteOpen, setInviteOpen] = React113.useState(false);
27990
28259
  const guardSeats = useLimitGuard("users");
27991
- const [inviteEmail, setInviteEmail] = React111.useState(void 0);
28260
+ const [inviteEmail, setInviteEmail] = React113.useState(void 0);
27992
28261
  const handleOpenInvite = async (row) => {
27993
28262
  if (row && !row.email && row.personId && entityRouteHasDetail("person", row.kind)) {
27994
28263
  openEntity(row.personId, "person", row.kind, "access");
@@ -27998,7 +28267,7 @@ function TeamTab() {
27998
28267
  setInviteEmail(row?.email || void 0);
27999
28268
  setInviteOpen(true);
28000
28269
  };
28001
- const reloadTeam = React111.useCallback(async () => {
28270
+ const reloadTeam = React113.useCallback(async () => {
28002
28271
  if (!adapter || !currentOrg) return;
28003
28272
  if (personMode && adapter.listTeam) {
28004
28273
  setTeam(await adapter.listTeam(currentOrg.id, teamPersonKinds));
@@ -28006,12 +28275,12 @@ function TeamTab() {
28006
28275
  setMembers(await adapter.listMembers(currentOrg.id));
28007
28276
  }
28008
28277
  }, [adapter, currentOrg?.id, personMode, teamPersonKinds, setMembers]);
28009
- React111.useEffect(() => {
28278
+ React113.useEffect(() => {
28010
28279
  if (personMode && adapter?.listTeam && currentOrg) {
28011
28280
  dedup("team:people:" + currentOrg.id, () => adapter.listTeam(currentOrg.id, teamPersonKinds)).then(setTeam).catch(() => setTeam([]));
28012
28281
  }
28013
28282
  }, [personMode, adapter, currentOrg?.id, teamPersonKinds.join(",")]);
28014
- React111.useEffect(() => {
28283
+ React113.useEffect(() => {
28015
28284
  if (adapter && currentOrg) {
28016
28285
  dedup("team:invites:" + currentOrg.id, () => adapter.listInvites(currentOrg.id)).then(setInvites).catch(() => {
28017
28286
  });
@@ -28092,7 +28361,7 @@ function TeamTab() {
28092
28361
  };
28093
28362
  const { t } = useTranslation$1();
28094
28363
  const canManageTeam = hasSystemPermission("manage_team");
28095
- const inviteActions = React111.useMemo(() => [{
28364
+ const inviteActions = React113.useMemo(() => [{
28096
28365
  id: "invite",
28097
28366
  label: t("organization.team.invite"),
28098
28367
  icon: UserPlus,
@@ -28279,13 +28548,13 @@ var SYSTEM_PERMISSIONS = [
28279
28548
  ];
28280
28549
  function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, isNew, parentLabel }) {
28281
28550
  const { t } = useTranslation$1();
28282
- const [name, setName] = React111.useState(profile?.name ?? "");
28283
- const [description, setDescription] = React111.useState(profile?.description ?? "");
28284
- const [systemPerms, setSystemPerms] = React111.useState(profile?.systemPermissions ?? []);
28285
- const [grants, setGrants] = React111.useState(profile?.grants ?? {});
28286
- const [collapsed, setCollapsed] = React111.useState(/* @__PURE__ */ new Set());
28287
- const [search, setSearch] = React111.useState("");
28288
- const initial = React111.useRef({
28551
+ const [name, setName] = React113.useState(profile?.name ?? "");
28552
+ const [description, setDescription] = React113.useState(profile?.description ?? "");
28553
+ const [systemPerms, setSystemPerms] = React113.useState(profile?.systemPermissions ?? []);
28554
+ const [grants, setGrants] = React113.useState(profile?.grants ?? {});
28555
+ const [collapsed, setCollapsed] = React113.useState(/* @__PURE__ */ new Set());
28556
+ const [search, setSearch] = React113.useState("");
28557
+ const initial = React113.useRef({
28289
28558
  name: profile?.name ?? "",
28290
28559
  description: profile?.description ?? "",
28291
28560
  systemPerms: JSON.stringify(profile?.systemPermissions ?? []),
@@ -28322,7 +28591,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
28322
28591
  onDiscard: onCancel,
28323
28592
  saveLabel: isNew ? t("organization.permissions.createProfile") : t("organization.permissions.updateProfile")
28324
28593
  });
28325
- const groups = React111.useMemo(() => {
28594
+ const groups = React113.useMemo(() => {
28326
28595
  const filtered = search ? features.filter((f) => f.label.toLowerCase().includes(search.toLowerCase())) : features;
28327
28596
  const map = /* @__PURE__ */ new Map();
28328
28597
  for (const f of filtered) {
@@ -28391,7 +28660,7 @@ function PermissionMatrixEditor({ features, profile, onSave, onCancel, saving, i
28391
28660
  }
28392
28661
  ) }) })
28393
28662
  ] }, sp.id)),
28394
- Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(React111.Fragment, { children: [
28663
+ Array.from(groups.entries()).map(([groupName, groupFeatures]) => /* @__PURE__ */ jsxs(React113.Fragment, { children: [
28395
28664
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "p-2 px-3", children: /* @__PURE__ */ jsxs(
28396
28665
  "button",
28397
28666
  {
@@ -28463,12 +28732,12 @@ function PermissionProfilesTab() {
28463
28732
  const startImpersonation = usePermissionsStore((s) => s.startImpersonation);
28464
28733
  const canPreview = (realProfile?.systemPermissions ?? []).includes("manage_permissions") ?? false;
28465
28734
  const { t } = useTranslation$1();
28466
- const [editingProfile, setEditingProfile] = React111.useState(null);
28467
- const [creating, setCreating] = React111.useState(false);
28468
- const [duplicateSource, setDuplicateSource] = React111.useState(null);
28469
- const [saving, setSaving] = React111.useState(false);
28470
- const [error, setError] = React111.useState(null);
28471
- const [deleting, setDeleting] = React111.useState(null);
28735
+ const [editingProfile, setEditingProfile] = React113.useState(null);
28736
+ const [creating, setCreating] = React113.useState(false);
28737
+ const [duplicateSource, setDuplicateSource] = React113.useState(null);
28738
+ const [saving, setSaving] = React113.useState(false);
28739
+ const [error, setError] = React113.useState(null);
28740
+ const [deleting, setDeleting] = React113.useState(null);
28472
28741
  const handleDuplicate = (profile) => {
28473
28742
  setEditingProfile(null);
28474
28743
  setCreating(false);
@@ -28478,9 +28747,9 @@ function PermissionProfilesTab() {
28478
28747
  isSystem: false
28479
28748
  });
28480
28749
  };
28481
- const surfaceRef = React111.useRef({ features, profiles, adapter, currentOrg, setProfiles });
28750
+ const surfaceRef = React113.useRef({ features, profiles, adapter, currentOrg, setProfiles });
28482
28751
  surfaceRef.current = { features, profiles, adapter, currentOrg, setProfiles };
28483
- const agentSurface = React111.useMemo(() => ({
28752
+ const agentSurface = React113.useMemo(() => ({
28484
28753
  id: "org.permissions",
28485
28754
  instructions: PERMISSIONS_INSTRUCTIONS,
28486
28755
  describe: () => {
@@ -28534,7 +28803,7 @@ function PermissionProfilesTab() {
28534
28803
  }]
28535
28804
  }), []);
28536
28805
  useAgentSurface(agentSurface);
28537
- const createActions = React111.useMemo(() => [
28806
+ const createActions = React113.useMemo(() => [
28538
28807
  {
28539
28808
  id: "new",
28540
28809
  label: t("organization.permissions.createProfile"),
@@ -28563,7 +28832,7 @@ function PermissionProfilesTab() {
28563
28832
  })
28564
28833
  }
28565
28834
  ], [t]);
28566
- const memberCountByProfile = React111.useMemo(() => {
28835
+ const memberCountByProfile = React113.useMemo(() => {
28567
28836
  const counts = {};
28568
28837
  for (const m of members) {
28569
28838
  counts[m.profileId] = (counts[m.profileId] ?? 0) + 1;
@@ -28868,7 +29137,7 @@ function FieldRulesSettings({ entities, rules: initialRules, onSave }) {
28868
29137
  const [saving, setSaving] = useState(false);
28869
29138
  const [search, setSearch] = useState("");
28870
29139
  const [showMore, setShowMore] = useState(false);
28871
- React111.useEffect(() => {
29140
+ React113.useEffect(() => {
28872
29141
  setDraft(initialRules);
28873
29142
  }, [initialRules]);
28874
29143
  const isDirty = useMemo(
@@ -29268,19 +29537,19 @@ function SoftLimitWidget() {
29268
29537
  function LimitProbe({ limitKey }) {
29269
29538
  const info = useLimit(limitKey);
29270
29539
  const report = useSoftLimitStore((s) => s.report);
29271
- React111.useEffect(() => {
29540
+ React113.useEffect(() => {
29272
29541
  report(limitKey, info);
29273
29542
  }, [limitKey, info, report]);
29274
29543
  return null;
29275
29544
  }
29276
29545
  function SoftLimitProbes({ keys }) {
29277
- const monitored = React111.useMemo(() => Array.from(new Set(keys)), [keys]);
29546
+ const monitored = React113.useMemo(() => Array.from(new Set(keys)), [keys]);
29278
29547
  return /* @__PURE__ */ jsx(Fragment, { children: monitored.map((k) => /* @__PURE__ */ jsx(LimitProbe, { limitKey: k }, k)) });
29279
29548
  }
29280
- var CommandPalette = React111.lazy(
29549
+ var CommandPalette = React113.lazy(
29281
29550
  () => import('./CommandPalette-GQ6SPITD.js').then((m) => ({ default: m.CommandPalette }))
29282
29551
  );
29283
- var SubscriptionPage = React111.lazy(
29552
+ var SubscriptionPage = React113.lazy(
29284
29553
  () => import('./SubscriptionPage-KYMUCZRW.js').then((m) => ({ default: m.SubscriptionPage }))
29285
29554
  );
29286
29555
  function orgInitials(name) {
@@ -29638,9 +29907,9 @@ function PluginHeaderControls() {
29638
29907
  }
29639
29908
  function AdminNotifications() {
29640
29909
  const { notifications, unreadCount, fetchNotifications, markAsRead, markAllAsRead } = useNotifications();
29641
- const [open, setOpen] = React111.useState(false);
29642
- const fetchedRef = React111.useRef(false);
29643
- React111.useEffect(() => {
29910
+ const [open, setOpen] = React113.useState(false);
29911
+ const fetchedRef = React113.useRef(false);
29912
+ React113.useEffect(() => {
29644
29913
  if (fetchedRef.current) return;
29645
29914
  fetchedRef.current = true;
29646
29915
  void fetchNotifications();
@@ -29775,7 +30044,7 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
29775
30044
  // sidebar ICON_MAP, which made the settings rail fall back to Home.
29776
30045
  icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4" }),
29777
30046
  iconName: "CreditCard",
29778
- component: /* @__PURE__ */ jsx(React111.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SubscriptionPage, {}) })
30047
+ component: /* @__PURE__ */ jsx(React113.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SubscriptionPage, {}) })
29779
30048
  });
29780
30049
  }
29781
30050
  if (showOrgSettings) {
@@ -29803,9 +30072,9 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
29803
30072
  settingsTabs.push({
29804
30073
  id: tab.id,
29805
30074
  label: translated === labelKey ? tab.label : translated,
29806
- icon: React111.createElement(IconComp, { className: "h-4 w-4" }),
30075
+ icon: React113.createElement(IconComp, { className: "h-4 w-4" }),
29807
30076
  iconName,
29808
- component: React111.createElement(tab.component),
30077
+ component: React113.createElement(tab.component),
29809
30078
  // Flag plugin-contributed tabs so SettingsPage draws the core/plugins divider.
29810
30079
  isPlugin: true,
29811
30080
  group: tab.group
@@ -29813,13 +30082,13 @@ function buildSettingsTabs(pluginTabs, can, hasSystem, t, showOrgSettings, hasBi
29813
30082
  }
29814
30083
  return settingsTabs;
29815
30084
  }
29816
- function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages = [], showSettings = true, showOrgSettings = false, showBranding = true, hiddenSettingsTabs, settingsGroups, showOrgSwitcher = true, setup = "wizard", contentFrame = true, moduleNav, bottomNav, onBottomNavAction, mobileHeader, shellMounts = [], sidebarFooter, navChildConnector, site, locales }) {
30085
+ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages = [], showSettings = true, showOrgSettings = false, showBranding = true, hiddenSettingsTabs, settingsGroups, showOrgSwitcher = true, setup = "wizard", contentFrame = true, moduleNav, bottomNav, onBottomNavAction, mobileHeader, shellMounts = [], sidebarFooter, navChildConnector, site, locales, trialDays }) {
29817
30086
  const runtime = usePluginRuntime();
29818
30087
  const t = useTranslation();
29819
30088
  const can = usePermissionOptional();
29820
30089
  const access = useAccessOptional();
29821
30090
  const currentProfile = usePermissionsStore((s) => s.currentProfile);
29822
- const hasSystem = React111.useCallback(
30091
+ const hasSystem = React113.useCallback(
29823
30092
  (perm) => {
29824
30093
  if (!currentProfile) return false;
29825
30094
  if (currentProfile.id === "owner" || currentProfile.name?.toLowerCase() === "owner") return true;
@@ -29833,7 +30102,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29833
30102
  };
29834
30103
  const path = useAdminPath();
29835
30104
  const { user, signOut } = useAuth();
29836
- React111.useEffect(() => installGlobalErrorHandlers(), []);
30105
+ React113.useEffect(() => installGlobalErrorHandlers(), []);
29837
30106
  const railOpen = useRightRailStore((s) => s.open);
29838
30107
  const railHasPanels = useRightRailStore((s) => s.panels.length > 0);
29839
30108
  const railActive = useRightRailStore((s) => s.active);
@@ -29841,15 +30110,15 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29841
30110
  const hasChatPanel = useRightRailStore((s) => s.panels.some((pn) => pn.id === "chat"));
29842
30111
  const rightRail = railHasPanels ? /* @__PURE__ */ jsx(RightRail, { frame: contentFrame, attached: layout !== "topbar" }) : null;
29843
30112
  const setRailMounted = useRightRailStore((s) => s.setMounted);
29844
- React111.useEffect(() => {
30113
+ React113.useEffect(() => {
29845
30114
  setRailMounted(true);
29846
30115
  return () => setRailMounted(false);
29847
30116
  }, [setRailMounted]);
29848
30117
  useConnectorOAuthReturn();
29849
30118
  const railWidthLive = useRightRailStore((s) => s.width);
29850
30119
  const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed);
29851
- const railAutoCollapsedRef = React111.useRef(false);
29852
- React111.useEffect(() => {
30120
+ const railAutoCollapsedRef = React113.useRef(false);
30121
+ React113.useEffect(() => {
29853
30122
  if (layout !== "sidebar") return;
29854
30123
  const SIDEBAR_EXPANDED = 224;
29855
30124
  const MIN_CONTENT = 620;
@@ -29871,22 +30140,22 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29871
30140
  window.addEventListener("resize", apply);
29872
30141
  return () => window.removeEventListener("resize", apply);
29873
30142
  }, [railOpen, railWidthLive, layout, setSidebarCollapsed]);
29874
- const [railWidth] = React111.useState(() => readRightRailWidth());
30143
+ const [railWidth] = React113.useState(() => readRightRailWidth());
29875
30144
  const billingPlans = useBillingStore((s) => s.plans);
29876
30145
  const hasBilling = billingPlans.length > 0;
29877
30146
  const orgPlan = useTenantOptional()?.org?.plan;
29878
- const planBadge = React111.useMemo(
30147
+ const planBadge = React113.useMemo(
29879
30148
  () => hasBilling ? resolvePlanBadge(orgPlan, billingPlans) : null,
29880
30149
  [hasBilling, orgPlan, billingPlans]
29881
30150
  );
29882
- const softLimitKeys = React111.useMemo(() => {
30151
+ const softLimitKeys = React113.useMemo(() => {
29883
30152
  const plan = billingPlans.find((p) => p.id === (orgPlan || "free"));
29884
30153
  return Object.keys(getPlanEntitlements(plan)?.limits ?? {});
29885
30154
  }, [billingPlans, orgPlan]);
29886
30155
  const overshoots = useOvershoots();
29887
30156
  const navContributions = useNavContributionsStore((s) => s.contributions);
29888
30157
  const appConfigNav = useAppConfigStore((state) => state.config.nav);
29889
- const navigation = React111.useMemo(() => {
30158
+ const navigation = React113.useMemo(() => {
29890
30159
  const contributed = Object.values(navContributions).flat();
29891
30160
  const flat = [...runtime.navigation, ...contributed].map((entry) => ({ ...navEntryToItem(entry), position: entry.position, indexChild: entry.indexChild })).sort(compareNavigation);
29892
30161
  const items = [];
@@ -29931,7 +30200,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29931
30200
  return { ...item, premium: dec.premium, children };
29932
30201
  }).filter((item) => item !== null).sort(compareNavigation);
29933
30202
  }, [runtime.navigation, navContributions, pages, access]);
29934
- const composedNavigation = React111.useMemo(() => {
30203
+ const composedNavigation = React113.useMemo(() => {
29935
30204
  if (!appConfigNav.length) return navigation;
29936
30205
  const keyed = navigation.map((item) => ({ ...item, key: item.route }));
29937
30206
  return applyNavComposition(keyed, appConfigNav).map((item) => {
@@ -29945,13 +30214,13 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29945
30214
  };
29946
30215
  });
29947
30216
  }, [navigation, appConfigNav]);
29948
- const resolvedBottomNav = React111.useMemo(
30217
+ const resolvedBottomNav = React113.useMemo(
29949
30218
  () => deriveBottomNav(navigation, bottomNav, { assistant: hasChatPanel }),
29950
30219
  [navigation, bottomNav, hasChatPanel]
29951
30220
  );
29952
30221
  const commandPaletteOpen = useLayoutStore((s) => s.commandPaletteOpen);
29953
30222
  const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen);
29954
- const commandItems = React111.useMemo(() => {
30223
+ const commandItems = React113.useMemo(() => {
29955
30224
  const navGroup = tr("layout.commandPalette.navigation", "Navigation");
29956
30225
  const items = [];
29957
30226
  for (const nav of navigation) {
@@ -29963,7 +30232,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29963
30232
  return items;
29964
30233
  }, [navigation]);
29965
30234
  const globalSearch = useGlobalSearch();
29966
- const routes = React111.useMemo(() => {
30235
+ const routes = React113.useMemo(() => {
29967
30236
  const list = [];
29968
30237
  const entityRouteMap = /* @__PURE__ */ new Map();
29969
30238
  for (const r of runtime.routes) {
@@ -29986,14 +30255,14 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
29986
30255
  setEntityRouteMap(entityRouteMap);
29987
30256
  return list.sort((a, b) => routeScore(b.path) - routeScore(a.path));
29988
30257
  }, [runtime.routes, pages, showSettings]);
29989
- const match = React111.useMemo(() => {
30258
+ const match = React113.useMemo(() => {
29990
30259
  for (const r of routes) {
29991
30260
  const params = matchRoute(r.path, path);
29992
30261
  if (params) return { route: r, params };
29993
30262
  }
29994
30263
  return null;
29995
30264
  }, [routes, path]);
29996
- React111.useEffect(() => {
30265
+ React113.useEffect(() => {
29997
30266
  if (!match && (path === "/" || path === "") && navigation.length > 0) {
29998
30267
  navigateTo(navigation[0].route);
29999
30268
  }
@@ -30001,11 +30270,11 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30001
30270
  const ActiveComponent = match?.route.Component;
30002
30271
  const activeParams = match?.params ?? {};
30003
30272
  const routeKey = (match?.route.path ?? path).replace(/\/\*$/, "");
30004
- const settingsTabs = React111.useMemo(
30273
+ const settingsTabs = React113.useMemo(
30005
30274
  () => buildSettingsTabs(runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling),
30006
30275
  [runtime.settingsTabs, can, hasSystem, t, showOrgSettings, hasBilling]
30007
30276
  );
30008
- const profileRoute = React111.useMemo(() => {
30277
+ const profileRoute = React113.useMemo(() => {
30009
30278
  const explicit = routes.find((r) => r.path === "/perfil" || r.path === "/profile");
30010
30279
  if (explicit) return explicit.path;
30011
30280
  return showSettings ? "/settings/profile" : null;
@@ -30013,7 +30282,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30013
30282
  const onProfile = profileRoute ? () => navigateTo(profileRoute) : void 0;
30014
30283
  const onBilling = hasBilling && showSettings ? () => navigateTo("/settings/subscription") : void 0;
30015
30284
  const coreSettingsTabs = useCoreSettingsTabs({ showCompany: showBranding, showBranding });
30016
- const allSettingsTabs = React111.useMemo(
30285
+ const allSettingsTabs = React113.useMemo(
30017
30286
  () => {
30018
30287
  const hidden = new Set(hiddenSettingsTabs ?? []);
30019
30288
  const visible = [...coreSettingsTabs, ...settingsTabs].filter((tab) => !hidden.has(tab.id));
@@ -30029,12 +30298,12 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30029
30298
  const moduleRail = !inSettings && layout === "sidebar" && contextualNav && (path === contextualNav.base || path.startsWith(contextualNav.base + "/")) ? contextualNav : null;
30030
30299
  const settingsPathActive = showSettings && (path === "/settings" || path.startsWith("/settings/"));
30031
30300
  const activeSettingsTab = settingsPathActive ? path === "/settings" ? null : path.slice("/settings/".length).split("/")[0] : void 0;
30032
- const settingsTabDef = React111.useMemo(() => {
30301
+ const settingsTabDef = React113.useMemo(() => {
30033
30302
  if (!showSettings || !path.startsWith("/settings/")) return void 0;
30034
30303
  const id = path.slice("/settings/".length).split("/")[0];
30035
30304
  return allSettingsTabs.find((tab) => tab.id === id);
30036
30305
  }, [showSettings, path, allSettingsTabs]);
30037
- const settingsNavigation = React111.useMemo(
30306
+ const settingsNavigation = React113.useMemo(
30038
30307
  () => allSettingsTabs.map((tab) => ({
30039
30308
  id: `settings:${tab.id}`,
30040
30309
  label: tab.label,
@@ -30052,10 +30321,10 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30052
30321
  const shellUser = user ? { fullName: user.fullName ?? user.email, email: user.email, avatarUrl: user.avatarUrl } : void 0;
30053
30322
  const moduleVariant = moduleNav ?? (layout === "sidebar" ? "tabs" : "rail");
30054
30323
  const setRailAvailable = useContextualNavStore((s) => s.setRailAvailable);
30055
- React111.useEffect(() => {
30324
+ React113.useEffect(() => {
30056
30325
  setRailAvailable(layout === "sidebar" && moduleVariant !== "rail");
30057
30326
  }, [layout, moduleVariant, setRailAvailable]);
30058
- const activePageTitle = React111.useMemo(() => {
30327
+ const activePageTitle = React113.useMemo(() => {
30059
30328
  if (settingsTabDef) return settingsTabDef.label;
30060
30329
  if (path === "/settings" || path.startsWith("/settings/")) return tr("common.settings", "Settings");
30061
30330
  if (match?.route.title) return match.route.title;
@@ -30066,7 +30335,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30066
30335
  );
30067
30336
  return hit?.label ?? candidates.find((n) => n.route === "/")?.label ?? "";
30068
30337
  }, [navigation, path, tr, match, settingsTabDef]);
30069
- const parentBack = React111.useMemo(() => {
30338
+ const parentBack = React113.useMemo(() => {
30070
30339
  if (settingsTabDef) {
30071
30340
  const first = allSettingsTabs[0]?.id;
30072
30341
  return {
@@ -30149,9 +30418,9 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30149
30418
  sidebarBeforeNav: contextualRail ? void 0 : /* @__PURE__ */ jsx(WidgetSlot, { zone: "shell.sidebar.before-nav" }),
30150
30419
  sidebarFooterContent: contextualRail ? void 0 : /* @__PURE__ */ jsxs(Fragment, { children: [
30151
30420
  /* @__PURE__ */ jsx(GettingStartedWidget, {}),
30152
- /* @__PURE__ */ jsx(TrialWidget, {}),
30421
+ /* @__PURE__ */ jsx(TrialWidget, { totalDays: trialDays }),
30153
30422
  /* @__PURE__ */ jsx(SoftLimitWidget, {}),
30154
- overshoots.length === 0 && /* @__PURE__ */ jsx(
30423
+ overshoots.length === 0 && site !== false && /* @__PURE__ */ jsx(
30155
30424
  SeuSiteWidget,
30156
30425
  {
30157
30426
  fallback: site,
@@ -30275,7 +30544,7 @@ function AdminShellInner({ appName, layout = "sidebar", logo, markLogo, pages =
30275
30544
  ]
30276
30545
  }
30277
30546
  ),
30278
- /* @__PURE__ */ jsx(React111.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
30547
+ /* @__PURE__ */ jsx(React113.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
30279
30548
  CommandPalette,
30280
30549
  {
30281
30550
  commands: commandItems,
@@ -30471,7 +30740,7 @@ function buildI18nConfig(config) {
30471
30740
  function BillingInitializer({ config }) {
30472
30741
  const setPlans = useBillingStore((s) => s.setPlans);
30473
30742
  const setCheckout = useBillingStore((s) => s.setCheckout);
30474
- React111.useEffect(() => {
30743
+ React113.useEffect(() => {
30475
30744
  if (config.billing?.plans) setPlans(config.billing.plans.map(normalizeBillingPlan));
30476
30745
  setCheckout(config.billing?.onCheckout ?? null);
30477
30746
  }, [config.billing, setPlans, setCheckout]);
@@ -30501,7 +30770,7 @@ function ThemeInitializer({ config }) {
30501
30770
  const brandColor = useOrganizationStore(
30502
30771
  (s) => normalizeBrand(s.currentOrg?.settings?.branding).tokens.color?.primary
30503
30772
  );
30504
- React111.useEffect(() => {
30773
+ React113.useEffect(() => {
30505
30774
  const brand = brandColor ? hexToHslTriplet(brandColor) : null;
30506
30775
  if (config.theme) {
30507
30776
  const themed = brand ? { ...config.theme, brand } : config.theme;
@@ -30517,20 +30786,20 @@ function ThemeInitializer({ config }) {
30517
30786
  return null;
30518
30787
  }
30519
30788
  function PersistentCacheInitializer() {
30520
- React111.useEffect(() => {
30789
+ React113.useEffect(() => {
30521
30790
  attachPersistentCache();
30522
30791
  void getPersistentCache()?.hydrate();
30523
30792
  }, []);
30524
30793
  return null;
30525
30794
  }
30526
30795
  function FayzEventBridgeInitializer({ config }) {
30527
- React111.useEffect(() => startFayzEventBridge(config.chat?.agent), [config.chat?.agent]);
30796
+ React113.useEffect(() => startFayzEventBridge(config.chat?.agent), [config.chat?.agent]);
30528
30797
  return null;
30529
30798
  }
30530
30799
  function TeamInitializer({ config }) {
30531
30800
  const setTeamPersonKinds = useOrganizationStore((s) => s.setTeamPersonKinds);
30532
30801
  const kinds = config.team?.personKinds;
30533
- React111.useEffect(() => {
30802
+ React113.useEffect(() => {
30534
30803
  setTeamPersonKinds(kinds ?? []);
30535
30804
  }, [setTeamPersonKinds, kinds]);
30536
30805
  return null;
@@ -30546,7 +30815,7 @@ function ChatRailPanel({ config }) {
30546
30815
  const agent = config.chat?.agent;
30547
30816
  const voice = config.chat?.voice;
30548
30817
  const whatsapp = config.chat?.whatsapp;
30549
- const Component2 = React111.useMemo(() => {
30818
+ const Component2 = React113.useMemo(() => {
30550
30819
  const Panel = () => /* @__PURE__ */ jsx(
30551
30820
  ChatConversation,
30552
30821
  {
@@ -30563,8 +30832,8 @@ function ChatRailPanel({ config }) {
30563
30832
  const conversations = useChatStore((s) => s.conversations);
30564
30833
  const setConversations = useChatStore((s) => s.setConversations);
30565
30834
  const user = useAuthStore((s) => s.user);
30566
- const connection = React111.useMemo(() => resolveFayzAgentConnection(agent), [agent]);
30567
- React111.useEffect(() => {
30835
+ const connection = React113.useMemo(() => resolveFayzAgentConnection(agent), [agent]);
30836
+ React113.useEffect(() => {
30568
30837
  if (!connection) return;
30569
30838
  getFayzAgentClient(connection).listConversations(user?.id).then(setConversations).catch(() => {
30570
30839
  });
@@ -30573,14 +30842,14 @@ function ChatRailPanel({ config }) {
30573
30842
  useAssistantInviteStore((s) => s.invite?.id === ASK_AI_HANDOFF_ID);
30574
30843
  const activeAgent = useAgent();
30575
30844
  const persona = activeAgent?.name ?? invitePersona;
30576
- const icon = React111.useMemo(
30845
+ const icon = React113.useMemo(
30577
30846
  () => activeAgent ? function AgentTabIcon() {
30578
30847
  return /* @__PURE__ */ jsx(AgentAvatar, { name: activeAgent.name, avatar: activeAgent.avatar, size: "sm" });
30579
30848
  } : Sparkles,
30580
30849
  [activeAgent]
30581
30850
  );
30582
30851
  useRightRailPanel(
30583
- React111.useMemo(
30852
+ React113.useMemo(
30584
30853
  () => ({
30585
30854
  id: "chat",
30586
30855
  label: persona ?? "Chat",
@@ -30594,17 +30863,17 @@ function ChatRailPanel({ config }) {
30594
30863
  [Component2, conversations.length, persona, icon, activeAgent]
30595
30864
  )
30596
30865
  );
30597
- React111.useEffect(() => {
30866
+ React113.useEffect(() => {
30598
30867
  if (chatOpen) openPanel("chat");
30599
30868
  }, [chatOpen, openPanel]);
30600
- React111.useEffect(() => {
30869
+ React113.useEffect(() => {
30601
30870
  if (!(railOpen && railActive === "chat")) setChatOpen(false);
30602
30871
  }, [railOpen, railActive, setChatOpen]);
30603
30872
  return null;
30604
30873
  }
30605
30874
  function AdminProviders({ config, children }) {
30606
30875
  const currentOrg = useOrganizationStore((s) => s.currentOrg);
30607
- const hasFayzAgent = React111.useMemo(
30876
+ const hasFayzAgent = React113.useMemo(
30608
30877
  () => !!resolveFayzAgentConnection(config.chat?.agent),
30609
30878
  [config.chat?.agent]
30610
30879
  );
@@ -30613,7 +30882,7 @@ function AdminProviders({ config, children }) {
30613
30882
  const surface = config.chat?.surface ?? "dock";
30614
30883
  const onConsentScreen = typeof window !== "undefined" && window.location.pathname.replace(/\/+$/, "").endsWith("/connect");
30615
30884
  const showFab = assistantEnabled && surface === "dock" && !onConsentScreen;
30616
- const resolved = React111.useMemo(() => {
30885
+ const resolved = React113.useMemo(() => {
30617
30886
  if (config.supabaseUrl && config.supabaseAnonKey) {
30618
30887
  createFayzSupabaseClient(config.supabaseUrl, config.supabaseAnonKey);
30619
30888
  }
@@ -30629,7 +30898,7 @@ function AdminProviders({ config, children }) {
30629
30898
  };
30630
30899
  }, [config]);
30631
30900
  const path = useAdminPath();
30632
- const runtime = React111.useMemo(
30901
+ const runtime = React113.useMemo(
30633
30902
  () => resolvePluginRuntime({
30634
30903
  plugins: resolved.plugins,
30635
30904
  context: {
@@ -30975,8 +31244,8 @@ function manifestToFayzConfig(manifest, surfaceName) {
30975
31244
  };
30976
31245
  }
30977
31246
  function AdminScaffold({ manifest, surface }) {
30978
- const config = React111.useMemo(() => manifestToFayzConfig(manifest, surface), [manifest, surface]);
30979
- const authShellProps = React111.useMemo(() => getAuthShellProps(config.auth), [config.auth]);
31247
+ const config = React113.useMemo(() => manifestToFayzConfig(manifest, surface), [manifest, surface]);
31248
+ const authShellProps = React113.useMemo(() => getAuthShellProps(config.auth), [config.auth]);
30980
31249
  return /* @__PURE__ */ jsx(AdminProviders, { config, children: /* @__PURE__ */ jsx(
30981
31250
  AdminShell,
30982
31251
  {
@@ -31373,12 +31642,12 @@ function CrudRecordModal({
31373
31642
  essentialFirst,
31374
31643
  notice
31375
31644
  }) {
31376
- const [record, setRecord] = React111.useState(null);
31377
- const [loading, setLoading] = React111.useState(false);
31378
- const [saving, setSaving] = React111.useState(false);
31379
- const [error, setError] = React111.useState(null);
31380
- const formId = React111.useId();
31381
- React111.useEffect(() => {
31645
+ const [record, setRecord] = React113.useState(null);
31646
+ const [loading, setLoading] = React113.useState(false);
31647
+ const [saving, setSaving] = React113.useState(false);
31648
+ const [error, setError] = React113.useState(null);
31649
+ const formId = React113.useId();
31650
+ React113.useEffect(() => {
31382
31651
  if (!open) return;
31383
31652
  setError(null);
31384
31653
  if (mode === "create" || !load) {
@@ -31454,9 +31723,9 @@ function LookupCreateInline({
31454
31723
  className
31455
31724
  }) {
31456
31725
  const t = useTranslation();
31457
- const [saving, setSaving] = React111.useState(false);
31458
- const [error, setError] = React111.useState(null);
31459
- const submitForm = React111.useRef(null);
31726
+ const [saving, setSaving] = React113.useState(false);
31727
+ const [error, setError] = React113.useState(null);
31728
+ const submitForm = React113.useRef(null);
31460
31729
  async function submit(data) {
31461
31730
  setSaving(true);
31462
31731
  setError(null);
@@ -31533,17 +31802,17 @@ function LookupCreateInline({
31533
31802
  );
31534
31803
  }
31535
31804
  function useLookupCreate(lookup2, onCreated, options = {}) {
31536
- const [draftName, setDraftName] = React111.useState(null);
31805
+ const [draftName, setDraftName] = React113.useState(null);
31537
31806
  const can = usePermissionOptional();
31538
31807
  const entityDef = lookup2?.entityDef;
31539
31808
  const feature = entityDef?.permission?.feature;
31540
31809
  const allowed = !feature || can(feature, "create");
31541
31810
  const canCreate = !!lookup2?.create && allowed;
31542
- const createByName = React111.useCallback(async (name) => {
31811
+ const createByName = React113.useCallback(async (name) => {
31543
31812
  if (!lookup2?.create) return;
31544
31813
  onCreated(await lookup2.create({ name }));
31545
31814
  }, [lookup2, onCreated]);
31546
- const onCreate = React111.useMemo(() => {
31815
+ const onCreate = React113.useMemo(() => {
31547
31816
  if (!canCreate) return void 0;
31548
31817
  if (!entityDef) return (name) => {
31549
31818
  void createByName(name);
@@ -31631,8 +31900,8 @@ function OrderFormItemRow({
31631
31900
  const rawKindLabel = itemTypes.find((tp) => tp.value === itemKind)?.label ?? itemKind;
31632
31901
  const kindLabel = !itemKind || itemKind === "other" ? null : rawKindLabel;
31633
31902
  const hasAdjustments = (discount ?? 0) > 0 || (surcharge ?? 0) > 0;
31634
- const [showAdjustments, setShowAdjustments] = React111.useState(hasAdjustments);
31635
- const [openExtras, setOpenExtras] = React111.useState(
31903
+ const [showAdjustments, setShowAdjustments] = React113.useState(hasAdjustments);
31904
+ const [openExtras, setOpenExtras] = React113.useState(
31636
31905
  () => (extraFieldGroups ?? []).filter((g) => g.filled).map((g) => g.id)
31637
31906
  );
31638
31907
  const lookup2 = entityLookups[itemKind];
@@ -31906,9 +32175,10 @@ function OrderFormItemsCard({
31906
32175
  header,
31907
32176
  emptyLabel = "Nenhum item adicionado",
31908
32177
  emptyActionLabel = "Adicione o primeiro item",
31909
- children
32178
+ children,
32179
+ "data-tour": dataTour
31910
32180
  }) {
31911
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col overflow-hidden rounded-card border bg-card", children: [
32181
+ return /* @__PURE__ */ jsxs("div", { "data-tour": dataTour, className: "flex flex-col overflow-hidden rounded-card border bg-card", children: [
31912
32182
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
31913
32183
  /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: label2 }),
31914
32184
  onAdd && /* @__PURE__ */ jsxs(
@@ -32275,7 +32545,7 @@ function OrderCreateScreen({
32275
32545
  errorActions,
32276
32546
  saveBar
32277
32547
  }) {
32278
- const subtotal = React111.useMemo(
32548
+ const subtotal = React113.useMemo(
32279
32549
  () => lines.reduce((sum, line) => sum + line.unitPrice * line.quantity, 0),
32280
32550
  [lines]
32281
32551
  );
@@ -32426,7 +32696,7 @@ function mergeLines(current2, incoming) {
32426
32696
  return merged;
32427
32697
  }
32428
32698
  function ItemPicker({ search, onPick }) {
32429
- const [open, setOpen] = React111.useState(false);
32699
+ const [open, setOpen] = React113.useState(false);
32430
32700
  return /* @__PURE__ */ jsxs(Fragment, { children: [
32431
32701
  /* @__PURE__ */ jsxs(
32432
32702
  "button",
@@ -32485,8 +32755,8 @@ function KanbanBoard({
32485
32755
  toolbarActions
32486
32756
  }) {
32487
32757
  const collapsible = !!onToggleColumn;
32488
- const frameRef = React111.useRef(null);
32489
- const centerFocused = React111.useCallback((event) => {
32758
+ const frameRef = React113.useRef(null);
32759
+ const centerFocused = React113.useCallback((event) => {
32490
32760
  const frame = frameRef.current;
32491
32761
  const column = event.target?.closest("[data-kanban-column]");
32492
32762
  if (!frame || !column || frame.scrollWidth <= frame.clientWidth) return;
@@ -32591,10 +32861,10 @@ function BoardFrame({
32591
32861
  toolbarActions,
32592
32862
  className = ""
32593
32863
  }) {
32594
- const [open, setOpen] = React111.useState(false);
32595
- const inputRef = React111.useRef(null);
32864
+ const [open, setOpen] = React113.useState(false);
32865
+ const inputRef = React113.useRef(null);
32596
32866
  const expanded = open || !!search;
32597
- React111.useEffect(() => {
32867
+ React113.useEffect(() => {
32598
32868
  if (open) inputRef.current?.focus();
32599
32869
  }, [open]);
32600
32870
  function collapse() {
@@ -32673,14 +32943,14 @@ function OrderBoardView({
32673
32943
  rowId,
32674
32944
  selectedRowId
32675
32945
  }) {
32676
- const getId = React111.useCallback(
32946
+ const getId = React113.useCallback(
32677
32947
  (row) => rowId ? rowId(row) : String(row.id ?? ""),
32678
32948
  [rowId]
32679
32949
  );
32680
- const [lastClicked, setLastClicked] = React111.useState(null);
32681
- const [advancing, setAdvancing] = React111.useState({});
32950
+ const [lastClicked, setLastClicked] = React113.useState(null);
32951
+ const [advancing, setAdvancing] = React113.useState({});
32682
32952
  const selected = selectedRowId !== void 0 ? selectedRowId : lastClicked;
32683
- const grouped = React111.useMemo(() => {
32953
+ const grouped = React113.useMemo(() => {
32684
32954
  const map = /* @__PURE__ */ new Map();
32685
32955
  for (const col of board.columns) map.set(col.id, []);
32686
32956
  for (const row of rows) {
@@ -32804,24 +33074,24 @@ function OrderListView({
32804
33074
  boards,
32805
33075
  viewKey
32806
33076
  }) {
32807
- const [search, setSearch] = React111.useState("");
32808
- const [page, setPage] = React111.useState(1);
32809
- const [rawSelection, setRawSelection] = React111.useState([]);
32810
- const offered = React111.useMemo(
33077
+ const [search, setSearch] = React113.useState("");
33078
+ const [page, setPage] = React113.useState(1);
33079
+ const [rawSelection, setRawSelection] = React113.useState([]);
33080
+ const offered = React113.useMemo(
32811
33081
  () => views && views.length > 0 ? views : ["list"],
32812
33082
  [views]
32813
33083
  );
32814
- const customFor = React111.useCallback(
33084
+ const customFor = React113.useCallback(
32815
33085
  (id) => boards?.[id]?.render ?? null,
32816
33086
  [boards]
32817
33087
  );
32818
- const boardFor = React111.useCallback(
33088
+ const boardFor = React113.useCallback(
32819
33089
  (id) => (id === "board" ? board : boards?.[id]?.config) ?? null,
32820
33090
  [board, boards]
32821
33091
  );
32822
33092
  const canBoard = offered.length > 1 && offered.some((id) => id !== "list" && (!!boardFor(id) || !!customFor(id)));
32823
33093
  const storageKey2 = viewKey ? `fayz.orderView.${viewKey}` : null;
32824
- const [view, setView] = React111.useState(() => {
33094
+ const [view, setView] = React113.useState(() => {
32825
33095
  const fallback = offered.includes(defaultView) ? defaultView : offered[0];
32826
33096
  if (!storageKey2) return fallback;
32827
33097
  try {
@@ -32831,7 +33101,7 @@ function OrderListView({
32831
33101
  return fallback;
32832
33102
  }
32833
33103
  });
32834
- const viewTabs = React111.useMemo(
33104
+ const viewTabs = React113.useMemo(
32835
33105
  () => offered.map((option) => ({
32836
33106
  value: option,
32837
33107
  label: option === "list" ? "Lista" : boards?.[option]?.label ?? "Quadro",
@@ -32839,7 +33109,7 @@ function OrderListView({
32839
33109
  })),
32840
33110
  [offered, boards]
32841
33111
  );
32842
- const chooseView = React111.useCallback((next) => {
33112
+ const chooseView = React113.useCallback((next) => {
32843
33113
  setView(next);
32844
33114
  if (!storageKey2) return;
32845
33115
  try {
@@ -32857,7 +33127,7 @@ function OrderListView({
32857
33127
  const activeBoard = view === "list" ? null : boardFor(view);
32858
33128
  const activeCustom = view === "list" ? null : customFor(view);
32859
33129
  const showingBoard = !!activeBoard || !!activeCustom;
32860
- const cols = React111.useMemo(
33130
+ const cols = React113.useMemo(
32861
33131
  () => columns.map((c) => ({
32862
33132
  id: c.key,
32863
33133
  header: () => /* @__PURE__ */ jsx("div", { className: c.align === "right" ? "text-right" : "", children: c.header }),
@@ -32865,25 +33135,25 @@ function OrderListView({
32865
33135
  })),
32866
33136
  [columns]
32867
33137
  );
32868
- const filtered = React111.useMemo(() => {
33138
+ const filtered = React113.useMemo(() => {
32869
33139
  const term = search.trim().toLowerCase();
32870
33140
  if (!term || !searchText) return rows;
32871
33141
  return rows.filter((row) => searchText(row).toLowerCase().includes(term));
32872
33142
  }, [rows, search, searchText]);
32873
- React111.useEffect(() => {
33143
+ React113.useEffect(() => {
32874
33144
  setPage(1);
32875
33145
  }, [search]);
32876
33146
  const paged = pageSize > 0 ? filtered.slice((page - 1) * pageSize, page * pageSize) : filtered;
32877
- const getId = React111.useCallback(
33147
+ const getId = React113.useCallback(
32878
33148
  (row) => rowId ? rowId(row) : String(row.id ?? ""),
32879
33149
  [rowId]
32880
33150
  );
32881
- const pageIds = React111.useMemo(() => paged.map(getId), [paged, getId]);
32882
- const selectedIds = React111.useMemo(
33151
+ const pageIds = React113.useMemo(() => paged.map(getId), [paged, getId]);
33152
+ const selectedIds = React113.useMemo(
32883
33153
  () => rawSelection.filter((id) => pageIds.includes(id)),
32884
33154
  [rawSelection, pageIds]
32885
33155
  );
32886
- const selectedRows = React111.useMemo(
33156
+ const selectedRows = React113.useMemo(
32887
33157
  () => paged.filter((row) => selectedIds.includes(getId(row))),
32888
33158
  [paged, selectedIds, getId]
32889
33159
  );
@@ -33033,13 +33303,13 @@ function PaymentStatusBadge({
33033
33303
  receiveLabel = "Receber",
33034
33304
  onOpenDetails
33035
33305
  }) {
33036
- const [open, setOpen] = React111__default.useState(false);
33037
- const [lines, setLines] = React111__default.useState(null);
33038
- const timer = React111__default.useRef(null);
33039
- React111__default.useEffect(() => {
33306
+ const [open, setOpen] = React113__default.useState(false);
33307
+ const [lines, setLines] = React113__default.useState(null);
33308
+ const timer = React113__default.useRef(null);
33309
+ React113__default.useEffect(() => {
33040
33310
  setLines(null);
33041
33311
  }, [status, paidAmount]);
33042
- const load = React111__default.useCallback(() => {
33312
+ const load = React113__default.useCallback(() => {
33043
33313
  if (lines || !onLoadDetails) return;
33044
33314
  void onLoadDetails().then(setLines).catch(() => setLines([]));
33045
33315
  }, [lines, onLoadDetails]);
@@ -33174,13 +33444,13 @@ function invalidateOrdersPaymentStatus(orderId) {
33174
33444
  else cache2.clear();
33175
33445
  }
33176
33446
  function useOrdersPaymentStatus(orderIds) {
33177
- const key = React111.useMemo(
33447
+ const key = React113.useMemo(
33178
33448
  () => Array.from(new Set(orderIds.filter(Boolean))).sort().join(","),
33179
33449
  [orderIds]
33180
33450
  );
33181
- const [byOrder, setByOrder] = React111.useState(() => /* @__PURE__ */ new Map());
33182
- const [loading, setLoading] = React111.useState(false);
33183
- const load = React111.useCallback(async (force = false) => {
33451
+ const [byOrder, setByOrder] = React113.useState(() => /* @__PURE__ */ new Map());
33452
+ const [loading, setLoading] = React113.useState(false);
33453
+ const load = React113.useCallback(async (force = false) => {
33184
33454
  const ids = key ? key.split(",") : [];
33185
33455
  if (ids.length === 0) {
33186
33456
  setByOrder(/* @__PURE__ */ new Map());
@@ -33211,7 +33481,7 @@ function useOrdersPaymentStatus(orderIds) {
33211
33481
  }
33212
33482
  setByOrder(new Map(ids.map((id) => [id, cache2.get(id)]).filter(([, v]) => Boolean(v))));
33213
33483
  }, [key]);
33214
- React111.useEffect(() => {
33484
+ React113.useEffect(() => {
33215
33485
  void load();
33216
33486
  }, [load]);
33217
33487
  return { byOrder, loading, reload: () => load(true) };
@@ -33278,12 +33548,12 @@ function money(value, currency) {
33278
33548
  return value.toLocaleString("pt-BR", { style: "currency", currency: currency || "BRL" });
33279
33549
  }
33280
33550
  function useOrderDetail(orderId) {
33281
- const [order, setOrder] = React111.useState(null);
33282
- const [loading, setLoading] = React111.useState(false);
33283
- const [error, setError] = React111.useState(null);
33284
- const [nonce, setNonce] = React111.useState(0);
33285
- const reload = React111.useCallback(() => setNonce((n) => n + 1), []);
33286
- React111.useEffect(() => {
33551
+ const [order, setOrder] = React113.useState(null);
33552
+ const [loading, setLoading] = React113.useState(false);
33553
+ const [error, setError] = React113.useState(null);
33554
+ const [nonce, setNonce] = React113.useState(0);
33555
+ const reload = React113.useCallback(() => setNonce((n) => n + 1), []);
33556
+ React113.useEffect(() => {
33287
33557
  if (!orderId) {
33288
33558
  setOrder(null);
33289
33559
  setError(null);
@@ -33402,8 +33672,8 @@ function OrderDetailRail({
33402
33672
  }) {
33403
33673
  const { order, loading, error, reload } = useOrderDetail(orderId);
33404
33674
  const { byOrder: paymentByOrder } = useOrdersPaymentStatus([orderId]);
33405
- const [running, setRunning] = React111.useState(null);
33406
- const [pending2, setPending] = React111.useState(null);
33675
+ const [running, setRunning] = React113.useState(null);
33676
+ const [pending2, setPending] = React113.useState(null);
33407
33677
  const perform = async (action) => {
33408
33678
  if (!order) return;
33409
33679
  setRunning(action.id);
@@ -33558,11 +33828,11 @@ function receivableTone(value) {
33558
33828
  return "warning";
33559
33829
  }
33560
33830
  function useOrderReceivable(orderId) {
33561
- const [receivable, setReceivable] = React111.useState(
33831
+ const [receivable, setReceivable] = React113.useState(
33562
33832
  () => orderId ? cache3.get(orderId) ?? null : null
33563
33833
  );
33564
- const [loading, setLoading] = React111.useState(() => Boolean(orderId) && !cache3.has(orderId));
33565
- const reload = React111.useCallback(async (force = false) => {
33834
+ const [loading, setLoading] = React113.useState(() => Boolean(orderId) && !cache3.has(orderId));
33835
+ const reload = React113.useCallback(async (force = false) => {
33566
33836
  if (!orderId) return;
33567
33837
  const db2 = getSupabaseClientOptional();
33568
33838
  if (!db2) {
@@ -33585,7 +33855,7 @@ function useOrderReceivable(orderId) {
33585
33855
  setReceivable(next);
33586
33856
  setLoading(false);
33587
33857
  }, [orderId]);
33588
- React111.useEffect(() => {
33858
+ React113.useEffect(() => {
33589
33859
  void reload();
33590
33860
  }, [reload]);
33591
33861
  return { receivable, loading, reload };
@@ -33738,15 +34008,15 @@ function linesOf(order) {
33738
34008
  }
33739
34009
  function useOrderEditor(orderId) {
33740
34010
  const { order, loading, error } = useOrderDetail(orderId);
33741
- const [lines, setLines] = React111.useState([]);
33742
- const [saving, setSaving] = React111.useState(false);
33743
- const originalRef = React111.useRef([]);
33744
- React111.useEffect(() => {
34011
+ const [lines, setLines] = React113.useState([]);
34012
+ const [saving, setSaving] = React113.useState(false);
34013
+ const originalRef = React113.useRef([]);
34014
+ React113.useEffect(() => {
33745
34015
  const seeded = linesOf(order);
33746
34016
  originalRef.current = seeded;
33747
34017
  setLines(seeded);
33748
34018
  }, [order]);
33749
- const dirty = React111.useMemo(() => {
34019
+ const dirty = React113.useMemo(() => {
33750
34020
  const before = originalRef.current;
33751
34021
  if (before.length !== lines.length) return true;
33752
34022
  return lines.some((line, i) => {
@@ -33754,7 +34024,7 @@ function useOrderEditor(orderId) {
33754
34024
  return !was || was.key !== line.key || was.quantity !== line.quantity || was.unitPrice !== line.unitPrice;
33755
34025
  });
33756
34026
  }, [lines]);
33757
- const save = React111.useCallback(async () => {
34027
+ const save = React113.useCallback(async () => {
33758
34028
  if (!orderId || !order) return { ok: false, error: "Pedido n\xE3o carregado" };
33759
34029
  const db2 = getSupabaseClientOptional();
33760
34030
  if (!db2) return { ok: false, error: "Sem conex\xE3o" };
@@ -34246,11 +34516,11 @@ function PersonTimeline({
34246
34516
  pageSize,
34247
34517
  activeSourceIds
34248
34518
  });
34249
- const toneBySource = React111__default.useMemo(
34519
+ const toneBySource = React113__default.useMemo(
34250
34520
  () => new Map(sources2.map((s) => [s.id, s.tone ?? "neutral"])),
34251
34521
  [sources2]
34252
34522
  );
34253
- const hrefFor = React111__default.useCallback(
34523
+ const hrefFor = React113__default.useCallback(
34254
34524
  (item) => {
34255
34525
  if (item.href) return item.href;
34256
34526
  if (!recordPath || !item.targetTab) return void 0;
@@ -34293,19 +34563,19 @@ function PersonTimeline({
34293
34563
  }
34294
34564
  function createPlaceholder(title, description) {
34295
34565
  return function PlaceholderPage() {
34296
- return React111__default.createElement(
34566
+ return React113__default.createElement(
34297
34567
  "div",
34298
34568
  { className: "mx-auto max-w-4xl" },
34299
- React111__default.createElement("h1", { className: "text-3xl font-bold text-foreground" }, title),
34300
- description ? React111__default.createElement("p", { className: "mt-1 text-muted-foreground" }, description) : null,
34301
- React111__default.createElement(
34569
+ React113__default.createElement("h1", { className: "text-3xl font-bold text-foreground" }, title),
34570
+ description ? React113__default.createElement("p", { className: "mt-1 text-muted-foreground" }, description) : null,
34571
+ React113__default.createElement(
34302
34572
  "div",
34303
34573
  { className: "mt-8 flex items-center justify-center rounded-card border border-dashed border-border bg-card p-16" },
34304
- React111__default.createElement(
34574
+ React113__default.createElement(
34305
34575
  "div",
34306
34576
  { className: "text-center" },
34307
- React111__default.createElement("p", { className: "text-lg font-medium text-muted-foreground" }, "Coming Soon"),
34308
- React111__default.createElement(
34577
+ React113__default.createElement("p", { className: "text-lg font-medium text-muted-foreground" }, "Coming Soon"),
34578
+ React113__default.createElement(
34309
34579
  "p",
34310
34580
  { className: "mt-1 text-sm text-muted-foreground/70" },
34311
34581
  "This module is being built as a plugin."
@@ -34386,7 +34656,7 @@ function ModuleActionBar({
34386
34656
  trailing
34387
34657
  }) {
34388
34658
  const t = useTranslation();
34389
- const actions = React111__default.useMemo(() => {
34659
+ const actions = React113__default.useMemo(() => {
34390
34660
  const out = (quickActions ?? []).map((qa, i) => ({
34391
34661
  id: qa.id,
34392
34662
  label: qa.label,
@@ -34418,9 +34688,9 @@ function ModuleActionBar({
34418
34688
  ] });
34419
34689
  }
34420
34690
  function createPluginContext(displayName) {
34421
- const ConfigContext = React111__default.createContext(null);
34422
- const ProviderContext = React111__default.createContext(null);
34423
- const StoreContext = React111__default.createContext(null);
34691
+ const ConfigContext = React113__default.createContext(null);
34692
+ const ProviderContext = React113__default.createContext(null);
34693
+ const StoreContext = React113__default.createContext(null);
34424
34694
  const ContextProvider = ({
34425
34695
  config,
34426
34696
  provider: provider2,
@@ -34429,17 +34699,17 @@ function createPluginContext(displayName) {
34429
34699
  }) => /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx(ProviderContext.Provider, { value: provider2, children: /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children }) }) });
34430
34700
  ContextProvider.displayName = `${displayName}ContextProvider`;
34431
34701
  function useConfig() {
34432
- const ctx = React111__default.useContext(ConfigContext);
34702
+ const ctx = React113__default.useContext(ConfigContext);
34433
34703
  if (!ctx) throw new Error(`useConfig must be used within ${displayName}`);
34434
34704
  return ctx;
34435
34705
  }
34436
34706
  function useProvider() {
34437
- const ctx = React111__default.useContext(ProviderContext);
34707
+ const ctx = React113__default.useContext(ProviderContext);
34438
34708
  if (!ctx) throw new Error(`useProvider must be used within ${displayName}`);
34439
34709
  return ctx;
34440
34710
  }
34441
34711
  function useStore2(selector) {
34442
- const store = React111__default.useContext(StoreContext);
34712
+ const store = React113__default.useContext(StoreContext);
34443
34713
  if (!store) throw new Error(`useStore must be used within ${displayName}`);
34444
34714
  return useStore$1(store, selector);
34445
34715
  }
@@ -34496,7 +34766,7 @@ function PluginRegistryManager({ registries, routeBase, className }) {
34496
34766
  return registries[0]?.id ?? "";
34497
34767
  };
34498
34768
  const [activeTab, setActiveTab] = useState(getTabFromHash);
34499
- React111__default.useEffect(() => {
34769
+ React113__default.useEffect(() => {
34500
34770
  if (!routeBase) return;
34501
34771
  const handler = () => setActiveTab(getTabFromHash());
34502
34772
  window.addEventListener("hashchange", handler);
@@ -35391,10 +35661,10 @@ function useTeachMe(def) {
35391
35661
  return useFeatureHelp(def).teach;
35392
35662
  }
35393
35663
  function useFeatureHelp(def) {
35394
- const ref = React111.useRef(def);
35664
+ const ref = React113.useRef(def);
35395
35665
  ref.current = def;
35396
35666
  const id = `teach.${def.feature}`;
35397
- const contribution = React111.useMemo(
35667
+ const contribution = React113.useMemo(
35398
35668
  () => ({
35399
35669
  id,
35400
35670
  pluginId: "teach-me",
@@ -35428,7 +35698,7 @@ function useFeatureHelp(def) {
35428
35698
  [id]
35429
35699
  );
35430
35700
  useAgentSurface(contribution);
35431
- return React111.useMemo(
35701
+ return React113.useMemo(
35432
35702
  () => ({
35433
35703
  help: () => helpWith(ref.current),
35434
35704
  teach: () => teachMe(ref.current),
@@ -35594,21 +35864,21 @@ function ConnectorsHub({ hostPluginId }) {
35594
35864
  const { t } = useTranslation$1();
35595
35865
  const { connectors, reload } = useConnectors({ includeGrants: false });
35596
35866
  const assistantAvailable = useConnectorsPanelAvailable();
35597
- const [selected, setSelected] = React111__default.useState(null);
35598
- const [adding, setAdding] = React111__default.useState(false);
35599
- const hosted = React111__default.useMemo(
35867
+ const [selected, setSelected] = React113__default.useState(null);
35868
+ const [adding, setAdding] = React113__default.useState(false);
35869
+ const hosted = React113__default.useMemo(
35600
35870
  () => (connectors ?? []).filter((c) => c.hostPluginId === hostPluginId),
35601
35871
  [connectors, hostPluginId]
35602
35872
  );
35603
- const categories = React111__default.useMemo(
35873
+ const categories = React113__default.useMemo(
35604
35874
  () => [...new Set(hosted.map((c) => c.category).filter((c) => !!c))],
35605
35875
  [hosted]
35606
35876
  );
35607
- const scoped = React111__default.useMemo(() => {
35877
+ const scoped = React113__default.useMemo(() => {
35608
35878
  const siblings = inCategories(connectors ?? [], categories).filter((c) => c.hostPluginId !== hostPluginId);
35609
35879
  return [...hosted, ...siblings];
35610
35880
  }, [connectors, hosted, categories, hostPluginId]);
35611
- React111__default.useEffect(() => {
35881
+ React113__default.useEffect(() => {
35612
35882
  if (!selected || !connectors) return;
35613
35883
  const fresh = connectors.find((c) => c.id === selected.id);
35614
35884
  if (fresh && fresh !== selected) setSelected(fresh);
@@ -35743,7 +36013,7 @@ function PropertiesTab({ registries, routeBase, regLabel }) {
35743
36013
  return registries[0]?.id ?? "";
35744
36014
  }
35745
36015
  const [active2, setActive] = useState(getActive);
35746
- React111__default.useEffect(() => {
36016
+ React113__default.useEffect(() => {
35747
36017
  const handler = () => setActive(getActive());
35748
36018
  window.addEventListener("hashchange", handler);
35749
36019
  return () => window.removeEventListener("hashchange", handler);
@@ -35818,7 +36088,7 @@ function PluginSettingsPanel({ title, generalSettings, registries, customTabs, r
35818
36088
  return tabs[0]?.id ?? "";
35819
36089
  }
35820
36090
  const [activeTab, setActiveTab] = useState(getActiveFromHash);
35821
- React111__default.useEffect(() => {
36091
+ React113__default.useEffect(() => {
35822
36092
  const handler = () => setActiveTab(getActiveFromHash());
35823
36093
  window.addEventListener("hashchange", handler);
35824
36094
  return () => window.removeEventListener("hashchange", handler);
@@ -35845,6 +36115,6 @@ var renderApp = (...args) => {
35845
36115
  return renderApp$1(...args);
35846
36116
  };
35847
36117
 
35848
- export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AdminProviders, AdminScaffold, AdminShell, AskAIButton, AskAIMenuItem, AssistantInvite, BoardFrame, ChatConversation, ClientOrdersTab, ConnectConsentPage, ConnectorDeliveries, ConnectorDetail, ConnectorMark, ConnectorRow, ConnectorSyncActions, ConnectorsHub, ConnectorsTab, ContactPicker, CredentialSinkMissingError, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ONBOARDING_TASK_SOURCE, ORDER_CHANNEL_LABELS, ORDER_KIND_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PermissionGate, PersonLink2 as PersonLink, PersonTimeline, PlatformError, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordPickerModal, RegistryCrudView2 as RegistryCrudView, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TASK_PRIORITIES, TASK_STATUSES, TaskCard, TaskDetail, TaskGroup, TaskLabelBadge, TaskLabelBadges, TaskPriorityBadge, TaskQuickAdd, TaskSourceBadge, TaskStatusGroup, TasksFilterBar, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, activePluginIds, appendHandbookPage, askAI, beautyPack, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkSlugAvailable, claimTasksSurface, connectorOptions, connectorRoute, connectorRows, createArchetypeLookup, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createMockTasksProvider, createCrudPage as createNativeCrudPage, createPlaceholder, createPlatformProject, createPluginContext, createSupabaseTasksProvider, createViewRouter, currentBusinessProfileBlock, dedup, defaultProjectOf, defineSaas, deleteFayzProject, deriveAgentContract, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency4 as formatCurrency, formatSetupGuide, getActiveAgent, getAgent, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonBookable, getPersonLookup, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTasksProvider, getTimelineSources, hasPlugin, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, normalizePath, openAssistant, openAssistantAs, openConnectorsPanel, openEntity, orderChannelColumn, orderIsEditable, orderKindColumn, orientationTour, parseViewId, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAdminScaffold, registerAssistantLauncher, registerEntityPath, registerNotesTasksAdapter, registerPersonLookup, registerRailPage, registerSetupGuides, registerTimelineSource, renderApp, renderHandbookOutline, requestChatUpload, requestProjectChange, resetLoadedTools, resolveEntityAnchor, resolveEntityHref, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setPersonBookable, setTasksProvider, setUpWithMe, slugify, soleAgent, splitConnectorValues, splitOnboardingTasks, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, summariseSetupGuides, taskEntityDef, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAssistantLauncher, unregisterTimelineSource, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAppConfig, useAppConfigStore, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBusinessProfileStore, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderReceivable, useOrdersPaymentStatus, usePersonTimeline, usePluginPrefs, usePublishAssistantActivity, useRegisterAssistantLauncher, useRightRailDrill, useRightRailHosted, useRightRailPanel, useRightRailStore, useSettingsTabsStore, useShellRailAvailable, useTasksStore, useTasksSummaryLine, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitStore, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
36118
+ export { ALWAYS_ON_TOOLS, ActivationChecklistCard, ActivationProvider, AddConnectorButton, AddConnectorPanel, AdminProviders, AdminScaffold, AdminShell, AskAIButton, AskAIMenuItem, AssistantInvite, BoardFrame, ChatConversation, ClientOrdersTab, ConnectConsentPage, ConnectorDeliveries, ConnectorDetail, ConnectorMark, ConnectorRow, ConnectorSyncActions, ConnectorsHub, ConnectorsTab, ContactPicker, CredentialSinkMissingError, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, DeleteConfirmDialog, DetailTabHeader, EntitlementGate, EntityLink, GetStarted, GettingStartedWidget, NotebookPanel as HandbookPanel, HandbookProvider, NotebookRailPanel as HandbookRailPanel, KanbanBoard, LimitGate, LookupCreateInline, MemberAccessRailPage, ModuleActionBar, MultiSelectRow, NOTE_LABEL_PREFIX, NotebookPanel, NotebookRailPanel, ONBOARDING_TASK_SOURCE, ORDER_CHANNEL_LABELS, ORDER_KIND_LABELS, OTHER_CONNECTOR, OrderAmount, OrderBoardView, OrderCreateScreen, OrderDetailBlock, OrderDetailPage, OrderDetailRail, OrderDetailRow, OrderDetailSkeleton, OrderDetailView, OrderFormAddItemStep, OrderDetailBlock as OrderFormBlock, OrderFormItemRow, OrderFormItemsCard, OrderFormSkeleton, OrderFormView, OrderListView, OrderPaymentChip, PAYMENT_STATUS_CONFIG, PAYMENT_STATUS_LABEL, PageActions, PaymentStatusBadge, PermissionGate, PersonLink2 as PersonLink, PersonTimeline, PlatformError, PluginRegistryManager, PluginSettingsPanel, ProjectsSettings, QUESTION_PACKS, QuickActionsButton, RECEIVABLE_LABEL, RecordPickerModal, RegistryCrudView2 as RegistryCrudView, RightRailActions, RightRailLeading, RightRailPage, RouteErrorBoundary, RouteErrorScreen, SelectRow, SettingsGroup, SettingsTabs, SetupAgentSurface, SetupMeLink, SeuSiteWidget, StateChip, TASK_PRIORITIES, TASK_STATUSES, TaskCard, TaskDetail, TaskGroup, TaskLabelBadge, TaskLabelBadges, TaskPriorityBadge, TaskQuickAdd, TaskSourceBadge, TaskStatusGroup, TasksFilterBar, TasksPanel, TasksRailPanel, TeachMeLink, TextRow, ToggleRow, UnitSwitcher, UnitsSettingsPage, UpgradePrompt, WORKSPACE_SETUP_FLOW_ID, WORKSPACE_SETUP_FLOW_VERSION, WORKSPACE_SETUP_ROUTE, WidgetSlot, WorkspaceSetupFlow, WorkspaceSetupGate, activePluginIds, appendHandbookPage, askAI, beautyPack, brandMark, buildBusinessProfile, buildHandbookTree, buildWorkspaceSetupSteps, businessProfileBlock, categoryLabel, checkSlugAvailable, claimTasksSurface, connectorOptions, connectorRoute, connectorRows, createArchetypeLookup, createClientOrdersProvider, createCrudPage, createFayzApp, createFayzProject, createLogoUploader, createMockTasksProvider, createCrudPage as createNativeCrudPage, createPlaceholder, createPlatformProject, createPluginContext, createSupabaseTasksProvider, createViewRouter, currentBusinessProfileBlock, dedup, defaultProjectOf, defineSaas, deleteFayzProject, deriveAgentContract, duplicateWrite, ensureChecklist, exportToCSV, filterConnectors, foodPack, formatActivityElapsed, formatCurrency4 as formatCurrency, formatSetupGuide, getActiveAgent, getAgent, getDefaultFayzProject, getFayzAgentClient, getGenerationStatus, getHost, getPersonBookable, getPersonLookup, getPersonPath, getPreview, getQuestionPack, getRailPage, getSetupGuide, getSetupGuideForStep, getTasksProvider, getTimelineSources, hasPlugin, helpWith, humanizeWriteError, inferVerticalId, invalidateOrderReceivable, invalidateOrdersPaymentStatus, invalidateRelationOptions, isPlatformConnected, listFayzProjects, listHandbook, listPlatformProjects, listSetupGuides, loadArea, loadTools, loadedToolNames, mergeLines, needsCredentialSink, normalizePath, openAssistant, openAssistantAs, openConnectorsPanel, openEntity, orderChannelColumn, orderIsEditable, orderKindColumn, orientationTour, parseViewId, publishAssistantActivity, readAttachmentBytes, readHandbookPage, readSetupAnswers, receivableTone, recordOnboardingResponse, registerAdminScaffold, registerAssistantLauncher, registerEntityPath, registerNotesTasksAdapter, registerPersonLookup, registerRailPage, registerSetupGuides, registerTimelineSource, renderApp, renderHandbookOutline, requestChatUpload, requestProjectChange, resetLoadedTools, resolveEntityAnchor, resolveEntityHref, resolveEntityRoute, resolveFayzAgentConnection, resolveSetupMode, resolveVerticalId, retailPack, revealPage, runWelcome, searchHandbook, searchSetupGuides, setPersonBookable, setTasksProvider, setUpWithMe, slugify, soleAgent, splitConnectorValues, splitOnboardingTasks, startGuidedRun, startPreview, stopPreview, submitConnection, submitWorkspaceSetup, summariseSetupGuides, taskEntityDef, tasksSurfaceOwner, teachMe, toInlineFile, toOrderDetailReceivable, unregisterAssistantLauncher, unregisterTimelineSource, updateFayzProject, useActivationStore, useActiveAgent, useAgent, useAgentStore, useAgentSurface, useAppConfig, useAppConfigStore, useAssistantActivity, useAssistantInviteStore, useAssistantLaunchers, useBusinessProfileStore, useChatStore, useConnectors, useConnectorsPanelAvailable, useContextualNav, useContextualNavStore, useDelegateToAssistant, useFayzProjectsStore, useFeatureHelp, useFieldRules, useHandbookStore, useHasRightRail, useHeaderAction, useHeaderActions, useLaunchersForRole, useLookupCreate, useMemberAccessPanel, useModuleNavigation, useNavContribution, useNavContributionsStore, useNotesTasksBridge, useOrderDetail, useOrderEditor, useOrderReceivable, useOrdersPaymentStatus, usePersonTimeline, usePluginPrefs, usePublishAssistantActivity, useRegisterAssistantLauncher, useRightRailDrill, useRightRailHosted, useRightRailPanel, useRightRailStore, useSettingsTabsStore, useShellRailAvailable, useTasksStore, useTasksSummaryLine, useTeachMe, useTenantPluginSettings, useUnitBootstrap, useUnitStore, useWidgetSurface, useWorkspaceSetupBusy, useWorkspaceSetupGate, useWorkspaceSetupStore, validateSetupGuides, withdrawAssistantActivity, writeHandbookPage };
35849
36119
  //# sourceMappingURL=index.js.map
35850
36120
  //# sourceMappingURL=index.js.map