@arbidocs/blocks 0.4.11 → 0.4.13

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
@@ -11,9 +11,9 @@ export { Accordion, AvatarBlock, Banner, BlockImage, BlockLink, CTABanner, Colum
11
11
  export { Timeline } from './chunk-OVEQERPO.js';
12
12
  export { TIMELINE_ZOOM, TimelineCalendar, TimelineGantt, TimelineZoomControl, dayKey, formatSpan, monthLabel, parseIso, utcDay } from './chunk-4EZVCGRL.js';
13
13
  export { Callout } from './chunk-UJE32SST.js';
14
- export { ACTION_LABELS, AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_LIVE_RUNS_BANNER_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_COLUMN_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_ROW_ACTIONS_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, EMPTY_WORKFLOW_SCOPE, GoalCriteria, LiveRunsBanner, NewTaskEmptyAction, RecurrenceBuilder, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, STATUS_LABELS, SchemaForm, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TRIGGER_LABELS, TaskComposer, TaskPlan, TaskRowActions, TaskRunsDialog, TasksBulkBar, TasksToolbar, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WorkflowConfigDialog, WorkflowLauncher, agentConfigSectionToValues, agentCreatorToConfigSection, authModeFor, buildLaunch, buildRRule, composePersona, composeWorkflowPrompt, createTaskColumns, defaultInputs, defaultTaskComposerValues, deriveAgentName, describeRRule, formatElapsed, goalProgress, humanizeSection, inferType, inputsFromContext, isAgenticWorkflow, isEmptyWorkflowScope, isOutOfBounds, isValidAgentName, isWorkflowScope, isoToLocalInput, localInputToIso, nextCriterionId, parseRRule, prettifyKey, promptFieldName, skillToWorkflow, statusBadgeVariant, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, validateInputs, workflowAccepts, workflowFromFrontmatter, workflowTaskFields, workflowsAccepting, workflowsForHost } from './chunk-CVFBSUXL.js';
15
- import './chunk-NUNKSZKU.js';
14
+ export { ACTION_LABELS, AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_LIVE_RUNS_BANNER_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_COLUMN_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_ROW_ACTIONS_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, EMPTY_WORKFLOW_SCOPE, GoalCriteria, LiveRunsBanner, NewTaskEmptyAction, RecurrenceBuilder, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, STATUS_LABELS, SchemaForm, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TRIGGER_LABELS, TaskComposer, TaskPlan, TaskRowActions, TaskRunsDialog, TasksBulkBar, TasksToolbar, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WorkflowConfigDialog, WorkflowLauncher, agentConfigSectionToValues, agentCreatorToConfigSection, authModeFor, buildLaunch, buildRRule, composePersona, composeWorkflowPrompt, createTaskColumns, defaultInputs, defaultTaskComposerValues, deriveAgentName, describeRRule, formatElapsed, goalProgress, humanizeSection, inferType, inputsFromContext, isAgenticWorkflow, isEmptyWorkflowScope, isOutOfBounds, isValidAgentName, isWorkflowScope, isoToLocalInput, localInputToIso, nextCriterionId, parseRRule, prettifyKey, promptFieldName, skillToWorkflow, statusBadgeVariant, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, validateInputs, workflowAccepts, workflowFromFrontmatter, workflowTaskFields, workflowsAccepting, workflowsForHost } from './chunk-YP264PVL.js';
16
15
  import './chunk-NJL4LIXX.js';
16
+ import './chunk-NUNKSZKU.js';
17
17
  import './chunk-CQCC7LE7.js';
18
18
  export { DEFAULT_TAB_HEADER_LABELS, TabHeader } from './chunk-UBNVIIBT.js';
19
19
  export { EmptyState } from './chunk-P6GHJSLR.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/blocks",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "Composable, domain-neutral UI blocks for ARBI apps, organised by capability (retrieval, facts, agents, workspaces, citations, collaboration) plus shell, theme and site primitives, on top of @arbidocs/react.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -194,7 +194,7 @@
194
194
  "example:test:e2e": "playwright test -c examples/custom-ui/playwright.config.ts"
195
195
  },
196
196
  "dependencies": {
197
- "@arbidocs/client": "0.4.11",
197
+ "@arbidocs/client": "0.4.13",
198
198
  "@dnd-kit/core": "^6.3.1",
199
199
  "@dnd-kit/sortable": "^10.0.0",
200
200
  "@dnd-kit/utilities": "^3.2.2",
@@ -209,7 +209,7 @@
209
209
  "zustand": "^5.0.14"
210
210
  },
211
211
  "peerDependencies": {
212
- "@arbidocs/react": "0.4.11",
212
+ "@arbidocs/react": "0.4.13",
213
213
  "@mdxeditor/editor": "^4.0.4",
214
214
  "@measured/puck": ">=0.20",
215
215
  "@playwright/test": ">=1.40",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":[],"mappings":";;;;;AA2BA,SAAS,aAAA,CAAc;AAAA,EACrB;AACF,CAAA,EAEuB;AACrB,EAAA,MAAM,cAAA,GAAiB,aAAa,eAAe,CAAA;AACnD,EAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAA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AAAA,YACZ,WAAA,EAAY;AAAA,YACZ,mBAAA,EAAoB;AAAA,YACpB,UAAA,EAAW;AAAA,YACX,gBAAA,EAAiB;AAAA,YACjB,WAAA,EAAY;AAAA,YACZ,sBAAA,EAAuB;AAAA,YACvB,aAAA,CAAc;AAAA,cACZ,eAAA,EAAiB,sBACf,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,QAAA,EAAA,EAAS,CAAA;AAAA,oCACT,SAAA,EAAA,EAAU,CAAA;AAAA,oCACV,0BAAA,EAAA,EAA2B,CAAA;AAAA,oCAC3B,SAAA,EAAA,EAAU,CAAA;AAAA,oCACV,eAAA,EAAA,EAAgB,CAAA;AAAA,oCAChB,WAAA,EAAA,EAAY,CAAA;AAAA,oCACZ,SAAA,EAAA,EAAU,CAAA;AAAA,oCACV,UAAA,EAAA,EAAW,CAAA;AAAA,oCACX,WAAA,EAAA,EAAY,CAAA;AAAA,oCACZ,mBAAA,EAAA,EAAoB,CAAA;AAAA,gBACpB,6BACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,kCAAA,GAAA,CAAC,SAAA,EAAA,EAAU,CAAA;AAAA,kCACX,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAQ,SAAA,EAAW;AAAA,iBAAA,EACpC;AAAA,eAAA,EAEJ;AAAA,aAEH;AAAA;AACH;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-HSFGOA6V.js","sourcesContent":["import { useRef, type ReactNode } from 'react'\nimport {\n MDXEditor,\n type MDXEditorMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/artifacts/editor/ArtifactMarkdownEditor.tsx"],"names":["usePublisher","insertMarkdown$","jsx","Fragment","useRef","testIdOr","MDXEditor","headingsPlugin","listsPlugin","quotePlugin","thematicBreakPlugin","linkPlugin","linkDialogPlugin","tablePlugin","markdownShortcutPlugin","toolbarPlugin","jsxs","UndoRedo","Separator","BoldItalicUnderlineToggles","BlockTypeSelect","ListsToggle","CreateLink","InsertTable","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orMethods,\n headingsPlugin,\n listsPlugin,\n quotePlugin,\n thematicBreakPlugin,\n linkPlugin,\n linkDialogPlugin,\n tablePlugin,\n markdownShortcutPlugin,\n toolbarPlugin,\n UndoRedo,\n BoldItalicUnderlineToggles,\n BlockTypeSelect,\n ListsToggle,\n CreateLink,\n InsertTable,\n InsertThematicBreak,\n Separator,\n insertMarkdown$,\n usePublisher,\n} from '@mdxeditor/editor'\nimport { testIdOr } from '../../chat/test-id'\n\n/** Renders the host's dictation control; `insert` puts text at the cursor. */\nfunction DictationSlot({\n render,\n}: {\n render: (insert: (markdown: string) => void) => ReactNode\n}): React.ReactElement {\n const insertMarkdown = usePublisher(insertMarkdown$)\n return <>{render(insertMarkdown)}</>\n}\n\nexport interface ArtifactMarkdownEditorLabels {\n /** The accessible name of the editor region. */\n editor: string\n placeholder: string\n}\n\nexport const DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS: ArtifactMarkdownEditorLabels = {\n editor: 'Document editor',\n placeholder: 'Start typing…',\n}\n\nexport interface ArtifactMarkdownEditorProps {\n /** Current markdown (controlled by the parent). */\n markdown: string\n /** Called with the new markdown whenever the document changes. */\n onChange: (markdown: string) => void\n /**\n * Fired exactly once per editor instance, with the markdown the editor produces on mount.\n * MDXEditor canonicalises the source as it parses (table padding, escapes, thematic-break\n * style), so the first `onChange` after mount is the round-tripped form of the input, not a\n * user edit. Use it to adopt the normalised form as the baseline so entering edit mode does\n * not look dirty. Remount via `key` to receive it for the next document.\n */\n onNormalized?: (normalized: string) => void\n /**\n * A dictation control for the toolbar (the host owns recording and transcription, for example\n * `@arbidocs/react`'s `InlineMicButton`). It gets a function that inserts text at the cursor.\n */\n dictation?: (insert: (markdown: string) => void) => ReactNode\n labels?: Partial<ArtifactMarkdownEditorLabels>\n testId?: string\n}\n\n/**\n * WYSIWYG editor for artifact documents: the user edits the rendered document directly and the\n * editor round-trips Markdown, so `onChange` always yields markdown a save can persist unchanged.\n *\n *\n * Heavy (Lexical via MDXEditor): mount it behind a lazy boundary. The host imports\n * `@mdxeditor/editor/style.css` once and, from the module that lazily imports this one, a module\n * that defines the global `Prism` FIRST (assign the prismjs core to `globalThis.Prism`):\n * `@lexical/code` reads it while it evaluates, and a library cannot order that in every bundler.\n */\nexport function ArtifactMarkdownEditor({\n markdown,\n onChange,\n onNormalized,\n dictation,\n labels,\n testId,\n}: ArtifactMarkdownEditorProps): React.ReactElement {\n const l = { ...DEFAULT_ARTIFACT_MARKDOWN_EDITOR_LABELS, ...labels }\n const ref = useRef<MDXEditorMethods>(null)\n // Latched until MDXEditor fires its first onChange after mount: that is the canonicalisation\n // round-trip, not a user edit.\n const pendingNormalizationRef = useRef(true)\n\n return (\n <div\n role=\"group\"\n aria-label={l.editor}\n data-testid={testIdOr(testId, { testId: 'artifact-markdown-editor' })}\n className=\"h-full pointer-coarse:[&_[role=toolbar]_button]:min-h-11 pointer-coarse:[&_[role=toolbar]_button]:min-w-11\"\n >\n <MDXEditor\n ref={ref}\n markdown={markdown}\n onChange={(next) => {\n if (pendingNormalizationRef.current) {\n pendingNormalizationRef.current = false\n onNormalized?.(next)\n }\n onChange(next)\n }}\n contentEditableClassName=\"markdown-content max-w-none px-6 py-4 outline-none min-h-full\"\n className=\"h-full overflow-auto bg-background\"\n placeholder={<span className=\"text-muted-foreground\">{l.placeholder}</span>}\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n thematicBreakPlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n markdownShortcutPlugin(),\n toolbarPlugin({\n toolbarContents: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <BlockTypeSelect />\n <ListsToggle />\n <Separator />\n <CreateLink />\n <InsertTable />\n <InsertThematicBreak />\n {dictation && (\n <>\n <Separator />\n <DictationSlot render={dictation} />\n </>\n )}\n </>\n ),\n }),\n ]}\n />\n </div>\n )\n}\n"]}