@arbidocs/blocks 0.4.102 → 0.4.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/agents/index.cjs +207 -207
  2. package/dist/agents/index.js +2 -2
  3. package/dist/{chunk-AOFATOT3.cjs → chunk-2A4MDHJR.cjs} +7 -5
  4. package/dist/chunk-2A4MDHJR.cjs.map +1 -0
  5. package/dist/{chunk-G5JH2YMQ.js → chunk-4GFB5U3K.js} +3 -3
  6. package/dist/{chunk-G5JH2YMQ.js.map → chunk-4GFB5U3K.js.map} +1 -1
  7. package/dist/chunk-5FYU7ZIU.cjs +139 -0
  8. package/dist/chunk-5FYU7ZIU.cjs.map +1 -0
  9. package/dist/{chunk-Y5XW57U4.cjs → chunk-7LLLQUM7.cjs} +5 -5
  10. package/dist/{chunk-Y5XW57U4.cjs.map → chunk-7LLLQUM7.cjs.map} +1 -1
  11. package/dist/{chunk-D3QPYKZG.js → chunk-EPHGD4YV.js} +7 -6
  12. package/dist/chunk-EPHGD4YV.js.map +1 -0
  13. package/dist/chunk-HFZ45FD3.js +133 -0
  14. package/dist/chunk-HFZ45FD3.js.map +1 -0
  15. package/dist/{chunk-5NQIBJPP.js → chunk-NJX774HB.js} +3 -3
  16. package/dist/{chunk-5NQIBJPP.js.map → chunk-NJX774HB.js.map} +1 -1
  17. package/dist/{chunk-DDYXFALG.cjs → chunk-NW3LFDZL.cjs} +3 -3
  18. package/dist/{chunk-DDYXFALG.cjs.map → chunk-NW3LFDZL.cjs.map} +1 -1
  19. package/dist/{chunk-YGREW5TZ.js → chunk-PIT2YZCK.js} +3 -3
  20. package/dist/{chunk-YGREW5TZ.js.map → chunk-PIT2YZCK.js.map} +1 -1
  21. package/dist/{chunk-Z3G65XHZ.js → chunk-S55VDTX3.js} +3 -3
  22. package/dist/{chunk-Z3G65XHZ.js.map → chunk-S55VDTX3.js.map} +1 -1
  23. package/dist/{chunk-LENXDIMY.cjs → chunk-SKSE4OT6.cjs} +22 -22
  24. package/dist/{chunk-LENXDIMY.cjs.map → chunk-SKSE4OT6.cjs.map} +1 -1
  25. package/dist/{chunk-ZT2EBBSC.cjs → chunk-TP3FAP5J.cjs} +5 -5
  26. package/dist/{chunk-ZT2EBBSC.cjs.map → chunk-TP3FAP5J.cjs.map} +1 -1
  27. package/dist/{chunk-MYALCKDR.js → chunk-W2RTZOK3.js} +1533 -263
  28. package/dist/chunk-W2RTZOK3.js.map +1 -0
  29. package/dist/{chunk-FAGQTB3D.cjs → chunk-ZWWN4CUL.cjs} +1690 -408
  30. package/dist/chunk-ZWWN4CUL.cjs.map +1 -0
  31. package/dist/connect/docx.cjs +8 -7
  32. package/dist/connect/docx.cjs.map +1 -1
  33. package/dist/connect/docx.js +6 -5
  34. package/dist/connect/docx.js.map +1 -1
  35. package/dist/connect/index.cjs +12 -11
  36. package/dist/connect/index.cjs.map +1 -1
  37. package/dist/connect/index.js +5 -4
  38. package/dist/connect/index.js.map +1 -1
  39. package/dist/docx/LinkHoverCard.d.ts +24 -0
  40. package/dist/docx/NativeDocxEditor.d.ts +6 -0
  41. package/dist/docx/RibbonMenu.d.ts +4 -1
  42. package/dist/docx/RibbonOverflow.d.ts +27 -0
  43. package/dist/docx/WordReferences.d.ts +3 -2
  44. package/dist/docx/beforeSave.d.ts +9 -0
  45. package/dist/docx/definitions/fragment.d.ts +19 -1
  46. package/dist/docx/definitions/port.d.ts +43 -11
  47. package/dist/docx/index.cjs +85 -36
  48. package/dist/docx/index.cjs.map +1 -1
  49. package/dist/docx/index.d.ts +6 -0
  50. package/dist/docx/index.js +5 -4
  51. package/dist/docx/index.js.map +1 -1
  52. package/dist/docx/noteStyles.d.ts +46 -0
  53. package/dist/docx/overflowPlan.d.ts +15 -0
  54. package/dist/docx/references/CrossReferences.d.ts +97 -0
  55. package/dist/docx/references/EditorMenus.d.ts +10 -0
  56. package/dist/docx/references/commands.d.ts +119 -0
  57. package/dist/docx/references/numbering.d.ts +49 -0
  58. package/dist/docx/references/passages.d.ts +32 -0
  59. package/dist/docx/references/port.d.ts +20 -0
  60. package/dist/facts/index.cjs +22 -129
  61. package/dist/facts/index.cjs.map +1 -1
  62. package/dist/facts/index.js +3 -125
  63. package/dist/facts/index.js.map +1 -1
  64. package/dist/files/index.cjs +1 -1
  65. package/dist/files/index.js +1 -1
  66. package/dist/home/index.cjs +1 -1
  67. package/dist/home/index.js +1 -1
  68. package/dist/index.cjs +314 -314
  69. package/dist/index.js +8 -8
  70. package/dist/shell/index.cjs +1 -1
  71. package/dist/shell/index.js +1 -1
  72. package/dist/studio/index.cjs +1 -1
  73. package/dist/studio/index.js +1 -1
  74. package/dist/tags/ooxml.d.ts +4 -0
  75. package/dist/workflow-canvas/index.cjs +9 -9
  76. package/dist/workflow-canvas/index.js +2 -2
  77. package/node_modules/@arbidocs/coedit/package.json +1 -1
  78. package/package.json +4 -4
  79. package/src/docx/README.md +32 -0
  80. package/src/docx/styles.css +73 -5
  81. package/dist/chunk-AOFATOT3.cjs.map +0 -1
  82. package/dist/chunk-D3QPYKZG.js.map +0 -1
  83. package/dist/chunk-FAGQTB3D.cjs.map +0 -1
  84. package/dist/chunk-MYALCKDR.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  "use client";
2
2
  export { ApplyLabelButton, ApplyLabelDialog, DEFAULT_APPLY_LABEL_DIALOG_LABELS, DEFAULT_RELEVANCE_STEPS, DEFAULT_SEARCH_BAR_LABELS, DEFAULT_SEARCH_EMPTY_STATE_LABELS, DEFAULT_SEARCH_GROUP_HEADER_LABELS, DEFAULT_SEARCH_NO_RESULTS_LABELS, DEFAULT_SEARCH_PAGINATION_LABELS, DEFAULT_SEARCH_TOTALS_LABELS, DOCUMENT_SEARCH_NOUNS, Highlight, RelevanceThreshold, SearchBar, SearchControlsBar, SearchEmptyState, SearchErrorBanner, SearchGroupCard, SearchGroupHeader, SearchNoResults, SearchPageBody, SearchPageFrame, SearchPageHeader, SearchPagination, SearchPillToggle, SearchResultList, SearchResultsInner, SearchResultsMain, SearchToolbarRow, SearchTotalsHeadline, getPageNumbers, highlightTerms, searchNouns, splitByTerms, stripMarkdownLinks } from './chunk-2MJWWPHY.js';
3
- export { UsageMeter } from './chunk-D5T53XCL.js';
4
3
  export { ActionCluster, AskField, AskRow, AskTrigger, DEFAULT_ASK_FIELD_LABELS, DEFAULT_INSTALL_PROMPT_LABELS, DEFAULT_MOBILE_BARS_LABELS, DEFAULT_OFFLINE_PILL_LABELS, DEFAULT_REMOTE_CONTROL_PILL_LABELS, DEFAULT_SIDEBAR_LABELS, DEFAULT_TIP_CARD_LABELS, DEFAULT_WORKSPACE_KIND_LABELS, DEFAULT_WORKSPACE_SWITCHER_LABELS, INSTALL_PROMPT_DISMISSED_KEY, InfoBar, InstallPrompt, MobileAppBar, MobileTabBar, NotificationBell, OfflinePill, RemoteControlPill, STATUS_ROW_BASE_CLASS, STATUS_ROW_TONES, Sidebar, SidebarBadgeRow, SidebarRowAction, SidebarRowHoverContext, SplitLayout, StatusBadge, StatusRow, TipCard, UserMenu, WorkspaceIdentity, WorkspaceSwitcher, getInstallInstructions, initInstallPrompt, isIosDevice, promptAppInstall, resolveSidebarLayout, useInstallPrompt, useSidebarContext, useSidebarSettle, workspaceKindColor, workspaceKindMeta } from './chunk-VLOPZHFH.js';
5
4
  export { ArticleList, Chart, CheckList, CollectionDetail, CtaBand, DefinitionList, EditorialHeading, EditorialHero, EditorialProse, EditorialSection, Eyebrow, PanelGrid, ProofStrip, PullQuote, Reveal, TagList } from './chunk-LYUO3E6V.js';
5
+ export { UsageMeter } from './chunk-D5T53XCL.js';
6
6
  export { DataTable, DataTableBlock, MetricCard, PageHeader, StatGroup } from './chunk-ZCF2JJFA.js';
7
7
  export { Accordion, AvatarBlock, Banner, BlockImage, BlockLink, CTABanner, Columns, ContactForm, Container, FAQ, FONT_PAIRINGS, FeatureGrid, Footer, Gallery, Hero, ListBlock, LogoCloud, MediaText, Navbar, PricingTable, ProfileCard, RichTextBlock, SectionHeading, Spacer, Steps, THEME_STYLE_ID, Tabs, TeamGrid, Testimonial, TestimonialGrid, ThemeEditor, VideoEmbed, applyFontVars, applyStoredTheme, applyThemeVars, clearFontVars, clearThemeVars, createThemeStore, fontPackages, getFontPairing, matchFontPairing, tid, toEmbedUrl, toHslTriplet } from './chunk-DLBUFHLY.js';
8
8
  export { Timeline } from './chunk-OVEQERPO.js';
9
9
  export { MemberAvatarStack } from './chunk-XNOASBGW.js';
10
- import { DEFAULT_TAG_TABLE_LABELS, rowLinks, TagTableCell } from './chunk-Z3G65XHZ.js';
11
- export { DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DEFAULT_THREAD_FOLLOW_LABELS, DEFAULT_WORKSPACE_ACTIVITY_LABELS, DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagTable, TagTableCell, ThreadFollowButton, ThreadFollowMenuItem, WorkspaceActivityList, WorkspaceNotificationMenu, cellText, cellValue, fieldWrites, isGap, parseCell, rowLinks, tagTableDocumentXml, tagTableDocx, tagTableMarkdown, workspaceActivityHeadline, workspaceActivityTarget } from './chunk-Z3G65XHZ.js';
10
+ import { DEFAULT_TAG_TABLE_LABELS, rowLinks, TagTableCell } from './chunk-S55VDTX3.js';
11
+ export { DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DEFAULT_THREAD_FOLLOW_LABELS, DEFAULT_WORKSPACE_ACTIVITY_LABELS, DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagTable, TagTableCell, ThreadFollowButton, ThreadFollowMenuItem, WorkspaceActivityList, WorkspaceNotificationMenu, cellText, cellValue, fieldWrites, isGap, parseCell, rowLinks, tagTableDocumentXml, tagTableDocx, tagTableMarkdown, workspaceActivityHeadline, workspaceActivityTarget } from './chunk-S55VDTX3.js';
12
12
  import { DetailLoading, DetailBody, DetailSection, DetailFields, DetailField, DetailLinkList, DetailLinkItem, DetailEmpty } from './chunk-ZCOVDK2E.js';
13
13
  export { DEFAULT_DETAIL_PANEL_LABELS, DetailBody, DetailEmpty, DetailField, DetailFields, DetailLinkItem, DetailLinkList, DetailLoading, DetailPanel, DetailSection } from './chunk-ZCOVDK2E.js';
14
- import { groupDefinitions, compareDefinitions, minuteUtc, page, cell, documentXml, paragraph, docxPackage, TABLE_DOCUMENT_STYLES } from './chunk-D3QPYKZG.js';
15
- export { DEFINITIONS_LABEL, DEFINITION_BOOKMARK_PREFIX, compareDefinitions, compareTerms, definitionBookmark, definitionIdOfBookmark, definitionLabels, filterTermGroups, groupDefinitions, parseDefinition, termKey, toDefinition } from './chunk-D3QPYKZG.js';
14
+ import { groupDefinitions, compareDefinitions, minuteUtc, page, cell, documentXml, paragraph, docxPackage, TABLE_DOCUMENT_STYLES } from './chunk-EPHGD4YV.js';
15
+ export { DEFINITIONS_LABEL, DEFINITION_BOOKMARK_PREFIX, compareDefinitions, compareTerms, definitionBookmark, definitionIdOfBookmark, definitionLabels, filterTermGroups, groupDefinitions, parseDefinition, termKey, toDefinition } from './chunk-EPHGD4YV.js';
16
16
  export { DEFAULT_SEARCH_HIT_LABELS, SearchHit } from './chunk-A2YAC22G.js';
17
17
  export { TIMELINE_ZOOM, TimelineCalendar, TimelineGantt, TimelineZoomControl, dayKey, formatSpan, monthLabel, parseIso, utcDay } from './chunk-4EZVCGRL.js';
18
18
  import './chunk-AF6RDAJF.js';
19
19
  export { Callout } from './chunk-UJE32SST.js';
20
- export { 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, ConversationListView, ConversationTurnSpeaker, 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_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_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_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, EntityChip, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowThreadStartedBy, WorkflowThreadStrip, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, groupThreadActivity, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, isAgenticWorkflow, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isoToLocalInput, linkedRunsFromActivity, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, resolveScopeInputs, skillSlug, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, useWorkflowPreview, workflowFromSkillMarkdown, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowToSkillMarkdown, workflowTriggerType, workflowWhen } from './chunk-5NQIBJPP.js';
20
+ export { 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, ConversationListView, ConversationTurnSpeaker, 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_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_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_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, EntityChip, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowThreadStartedBy, WorkflowThreadStrip, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, groupThreadActivity, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, isAgenticWorkflow, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isoToLocalInput, linkedRunsFromActivity, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, resolveScopeInputs, skillSlug, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, useWorkflowPreview, workflowFromSkillMarkdown, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowToSkillMarkdown, workflowTriggerType, workflowWhen } from './chunk-NJX774HB.js';
21
21
  import './chunk-4XJZ6AAY.js';
22
22
  export { EmptyState } from './chunk-P6GHJSLR.js';
23
23
  export { ActionStepBody, ApprovalEvidence, AssigneeLine, DEFAULT_ASSIGNEE_WORDING, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, EMPTY_WORKFLOW_SCOPE, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, SchemaForm, SendBackControl, TaskActivityTimeline, WorkflowRunner, activeStepId, assigneeName, buildLaunch, canAssign, composeStepPrompt, composeWorkflowPrompt, defaultInputs, dependsOn, fieldToFrontmatter, fillRunText, fillStepInputs, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, initialRunInputs, inputsFromContext, isEmptyWorkflowScope, isIncompleteSignal, isPersonAction, isPersonStep, isRunFinished, isSteppedWorkflow, isWorkflowScope, layoutFromPlanSteps, nextAction, orderSteps, promptFieldName, reviewInstructions, runFields, runFieldsOf, runThreadTitle, sendBackTargets, skillToWorkflow, splitDocRef, stepConfigProblems, stepDependencies, stepFields, stepLevels, stepPhase, stepStatesFromActivity, stepWindow, taskActivityHeadline, toPlanAssignee, toPlanDocumentRef, toPlanSteps, upstreamSteps, useWorkflowView, validateInputs, validateStep, validateWorkflowGraph, workflowAccepts, workflowFromFrontmatter, workflowSteps, workflowsAccepting, workflowsForHost } from './chunk-PGDL26TQ.js';
@@ -34,6 +34,8 @@ import './chunk-XD2M6LIG.js';
34
34
  export { ActionLink } from './chunk-S7PSMMRG.js';
35
35
  export { AccountRecoveryDialog, AuthAlert, AuthConsent, AuthDivider, AuthField, AuthFieldBadge, AuthFooterLinks, AuthHeading, AuthHero, AuthInput, AuthLayout, AuthLink, AuthNote, AuthOfflineBadge, AuthSubmitButton, AuthTabs, DEFAULT_ACCOUNT_RECOVERY_DIALOG_LABELS, DEFAULT_AUTH_CONSENT_LABELS, DEFAULT_AUTH_FOOTER_LINKS_LABELS, DEFAULT_AUTH_OFFLINE_BADGE_LABELS, DEFAULT_RECOVERY_KEY_DIALOG_LABELS, DEFAULT_REVEALABLE_PASSWORD_INPUT_LABELS, DEFAULT_SSO_LOGIN_BUTTON_LABELS, RecoveryKeyDialog, RevealablePasswordInput, SsoLoginButton } from './chunk-SFXVNFES.js';
36
36
  export { DEFAULT_PASSWORD_STRENGTH_INPUT_LABELS, PasswordStrengthInput } from './chunk-VILAPTCB.js';
37
+ export { CitationEditor, DEFAULT_PASSAGE_PILL_LABELS, DEFAULT_QUIET_MARK_LABELS, LabelMark, NoteMark, PassageMark, PassagePill, QuietLink, useCopyText } from './chunk-XQKGYGCJ.js';
38
+ export { BlocksProvider, useBlocksEnvironment } from './chunk-76JDDMSP.js';
37
39
  export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, getParticipantTints, hasMessageBody, isLongPastedText, useDismissibleCard, useLongPaste, useRecipientDraft } from './chunk-ICBAFX5B.js';
38
40
  export { DEFAULT_DOCK_WIDTH, Toaster } from './chunk-BV7FEMSI.js';
39
41
  export { AssistantDock, AssistantDockToggle, AssistantModeToggle, ChatDocuments, ChatMessageContent, ChatPage, ChatThreadList, ChatThreadSelect, CitationMark, Composer, ComposerBranchingNotice, ComposerContainer, ComposerDock, ComposerFrame, ComposerInput, ComposerRoot, ComposerSend, ComposerToolbar, ComposerVoiceButton, ContextChip, ConversationEmpty, DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS, DEFAULT_CHAT_PAGE_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_CONVERSATION_EMPTY_LABELS, DEFAULT_MESSAGE_ALERT_LABELS, DEFAULT_MESSAGE_LABELS, DEFAULT_MESSAGE_LIST_LABELS, DEFAULT_WORKFLOW_STEP_CHIP_LABELS, Message, MessageActionButton, MessageActionMenu, MessageAlert, MessageBody, MessageBubble, MessageByline, MessageContent, MessageFooter, MessageList, MessageListBanner, MessageListEmpty, MessageListRoot, MessageListRow, MessageListRows, MessageListStatus, MessageListTail, MessageNarration, MessageRoot, MessageSources, MessageSubagentBadge, ScrollToBottom, SourceChip, WorkflowStepChip, toSpeakableText, useAssistantDock, useChatSurface, useRegisterEmbeddedChat, useStreamAnnouncement } from './chunk-EWSEQEPL.js';
@@ -41,8 +43,6 @@ export { BlocksTooltipProvider, DEFAULT_OVERLAY_ZONE_ID, DEFAULT_PAGE_CONTAINER_
41
43
  export { useMentionAutocomplete } from './chunk-HOXKR26S.js';
42
44
  export { DEFAULT_MENTION_LABELS, MENTION_HREF_PREFIX, MentionChip, MentionMenu, extractMentions, filterMentionCandidates, findMentionQuery, insertMention, linkMentions, mentionFromHref, toMessageMentions, useListKeyNav } from './chunk-AA3PT6KR.js';
43
45
  import './chunk-NPLYHR2E.js';
44
- export { CitationEditor, DEFAULT_PASSAGE_PILL_LABELS, DEFAULT_QUIET_MARK_LABELS, LabelMark, NoteMark, PassageMark, PassagePill, QuietLink, useCopyText } from './chunk-XQKGYGCJ.js';
45
- export { BlocksProvider, useBlocksEnvironment } from './chunk-76JDDMSP.js';
46
46
  export { daysUntil, displayName, fmtDate, fmtDateTime, formatCount, formatCurrency, formatPageRefs, fromNow, hrs, initials, pct, pluralize } from './chunk-OXF2IFXG.js';
47
47
  export { ActionMenu, AddContactsForm, AddContactsResults, ContactCard, DEFAULT_ADD_CONTACTS_LABELS, DEFAULT_CONTACT_CARD_LABELS, DEFAULT_CONTACT_OUTCOME_LABELS, DEFAULT_DM_ACCESS_REQUEST_BANNER_LABELS, DEFAULT_DM_GRANT_ACCESS_DIALOG_LABELS, DEFAULT_DM_INVITE_CHIP_LABELS, DEFAULT_DM_THREAD_FRAME_LABELS, DEFAULT_MAIL_FOLDER_TREE_LABELS, DEFAULT_RECIPIENT_PICKER_LABELS, DmAccessRequestBanner, DmGrantAccessDialogView, DmInviteAvatar, DmInviteChip, DmNewTabIcon, DmThreadFrame, DmThreadHeader, MAX_INVITE_EMAILS, MailFolderTree, MemberBulkActions, MemberListLoading, MemberMutedText, MemberNameCell, MemberRoleCell, RecipientPicker, RoleSelect, WorkspaceDeleteButton, buildMailFolderTree, contactToVCard, descendantFolderIds, downloadVCard, isInboxFolder, parseEmails, toAddContactsRow, toAddContactsRows, toggleMailFolder, vCardFilename } from './chunk-7C35WXYB.js';
48
48
  import './chunk-NBV56SGU.js';
@@ -5,10 +5,10 @@ var chunkHBF4BDRU_cjs = require('../chunk-HBF4BDRU.cjs');
5
5
  var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
6
6
  var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
7
7
  require('../chunk-OB5F4577.cjs');
8
+ require('../chunk-C54XEN5T.cjs');
8
9
  var chunkXKSFJYOD_cjs = require('../chunk-XKSFJYOD.cjs');
9
10
  var chunkVGOFFCMT_cjs = require('../chunk-VGOFFCMT.cjs');
10
11
  require('../chunk-PPCATBOY.cjs');
11
- require('../chunk-C54XEN5T.cjs');
12
12
  var chunkFX3K6LNZ_cjs = require('../chunk-FX3K6LNZ.cjs');
13
13
  require('../chunk-MHVNT4J3.cjs');
14
14
  require('../chunk-DES3K4SD.cjs');
@@ -3,10 +3,10 @@ export { ActionCluster, AskField, AskRow, AskTrigger, DEFAULT_ASK_FIELD_LABELS,
3
3
  export { DEFAULT_TAB_HEADER_LABELS, TabHeader } from '../chunk-4WWM3GQ5.js';
4
4
  export { DEFAULT_FILTER_FIELDS, DEFAULT_FILTER_INPUT_LABELS, FilterInput } from '../chunk-YU2KUMGE.js';
5
5
  import '../chunk-S7PSMMRG.js';
6
+ import '../chunk-76JDDMSP.js';
6
7
  export { DEFAULT_DOCK_WIDTH, Toaster } from '../chunk-BV7FEMSI.js';
7
8
  export { DEFAULT_OVERLAY_ZONE_ID, DEFAULT_PAGE_CONTAINER_PADDING, DEFAULT_SIDEBAR_TOGGLE_BUTTON_LABELS, PageContainer, SHELL_BOTTOM_INSET_VAR, Shell, SidebarToggleButton, ToolButton, useDrawerBehavior, useOverlayZoneId, useShellBottomInset } from '../chunk-KZJAG7T3.js';
8
9
  import '../chunk-NPLYHR2E.js';
9
- import '../chunk-76JDDMSP.js';
10
10
  export { BREAKPOINT_QUERIES, useIsNarrow, useIsPhone, useIsTouchScreen, useMediaQuery } from '../chunk-SLSBJRWW.js';
11
11
  import '../chunk-7F6CBP3Z.js';
12
12
  import '../chunk-VUNV25KB.js';
@@ -10,12 +10,12 @@ require('../chunk-VPPX5XUF.cjs');
10
10
  var chunkPCB2BPN3_cjs = require('../chunk-PCB2BPN3.cjs');
11
11
  var chunkZW6FPIFC_cjs = require('../chunk-ZW6FPIFC.cjs');
12
12
  require('../chunk-OB5F4577.cjs');
13
+ var chunkC54XEN5T_cjs = require('../chunk-C54XEN5T.cjs');
13
14
  require('../chunk-MP6FK43E.cjs');
14
15
  require('../chunk-VGOFFCMT.cjs');
15
16
  require('../chunk-B4SRYJLM.cjs');
16
17
  require('../chunk-7UTB4PHM.cjs');
17
18
  require('../chunk-PPCATBOY.cjs');
18
- var chunkC54XEN5T_cjs = require('../chunk-C54XEN5T.cjs');
19
19
  var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
20
20
  require('../chunk-MHVNT4J3.cjs');
21
21
  require('../chunk-DES3K4SD.cjs');
@@ -9,12 +9,12 @@ import '../chunk-4EZVCGRL.js';
9
9
  import { Callout } from '../chunk-UJE32SST.js';
10
10
  import { EmptyState } from '../chunk-P6GHJSLR.js';
11
11
  import '../chunk-S7PSMMRG.js';
12
+ import { useBlocksEnvironment } from '../chunk-76JDDMSP.js';
12
13
  import '../chunk-EWSEQEPL.js';
13
14
  import '../chunk-KZJAG7T3.js';
14
15
  import '../chunk-HOXKR26S.js';
15
16
  import '../chunk-AA3PT6KR.js';
16
17
  import '../chunk-NPLYHR2E.js';
17
- import { useBlocksEnvironment } from '../chunk-76JDDMSP.js';
18
18
  import { formatCount } from '../chunk-OXF2IFXG.js';
19
19
  import '../chunk-7F6CBP3Z.js';
20
20
  import '../chunk-VUNV25KB.js';
@@ -36,6 +36,8 @@ export declare const DOC_DEFAULTS = "<w:docDefaults><w:rPrDefault><w:rPr><w:rFon
36
36
  * and the bordered `TagTableGrid` table.
37
37
  */
38
38
  export declare const TABLE_DOCUMENT_STYLES: string;
39
+ /** A relationship to an external hyperlink target, for `w:hyperlink r:id`. */
40
+ export declare const hyperlinkRelationship: (id: string, url: string) => string;
39
41
  /** The minimal `.docx` package: a document, its styles, and its title and time. */
40
42
  export declare function docxPackage(parts: {
41
43
  document: string;
@@ -43,4 +45,6 @@ export declare function docxPackage(parts: {
43
45
  title: string;
44
46
  /** ISO time; default now. */
45
47
  at?: string;
48
+ /** Further `word/document.xml` relationships (e.g. {@link hyperlinkRelationship}). */
49
+ relationships?: string;
46
50
  }): Uint8Array;
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
5
- var chunkDDYXFALG_cjs = require('../chunk-DDYXFALG.cjs');
5
+ var chunkNW3LFDZL_cjs = require('../chunk-NW3LFDZL.cjs');
6
6
  require('../chunk-S5HZBXZA.cjs');
7
7
  require('../chunk-ZW6FPIFC.cjs');
8
8
  var chunk3US5OIDQ_cjs = require('../chunk-3US5OIDQ.cjs');
@@ -17,10 +17,10 @@ require('../chunk-2EI7NCUA.cjs');
17
17
  require('../chunk-Z5VUZ6YD.cjs');
18
18
  require('../chunk-7D737FLE.cjs');
19
19
  require('../chunk-OB5F4577.cjs');
20
+ require('../chunk-C54XEN5T.cjs');
20
21
  require('../chunk-B4SRYJLM.cjs');
21
22
  require('../chunk-7UTB4PHM.cjs');
22
23
  require('../chunk-PPCATBOY.cjs');
23
- require('../chunk-C54XEN5T.cjs');
24
24
  require('../chunk-KDG6FER6.cjs');
25
25
  require('../chunk-ULWRNGGE.cjs');
26
26
  require('../chunk-IXALYQT7.cjs');
@@ -1615,7 +1615,7 @@ function triggerFields(trigger, clearOthers) {
1615
1615
  return {
1616
1616
  timezone: trigger.timezone,
1617
1617
  rrule: trigger.start === "repeat" ? trigger.rrule.trim() : none,
1618
- run_at: trigger.start === "once" ? chunkDDYXFALG_cjs.localInputToIso(trigger.runAt) : none,
1618
+ run_at: trigger.start === "once" ? chunkNW3LFDZL_cjs.localInputToIso(trigger.runAt) : none,
1619
1619
  event_kind: trigger.start === "event" ? trigger.eventKind.trim() : none,
1620
1620
  // A step signal is `workflow_signal` narrowed to one signal name.
1621
1621
  event_filter: filter ?? none,
@@ -1674,7 +1674,7 @@ function workflowRecordToBuilder(record) {
1674
1674
  ...record.skill_ref ? { workflow: record.skill_ref } : { run: { kind: "prompt", promptTemplate: record.prompt } }
1675
1675
  }
1676
1676
  ] : [];
1677
- const when = chunkDDYXFALG_cjs.workflowWhen(record);
1677
+ const when = chunkNW3LFDZL_cjs.workflowWhen(record);
1678
1678
  return {
1679
1679
  workflow: {
1680
1680
  id: record.external_id,
@@ -1688,7 +1688,7 @@ function workflowRecordToBuilder(record) {
1688
1688
  trigger: {
1689
1689
  ...DEFAULT_WORKFLOW_TRIGGER,
1690
1690
  start: when === "now" ? "manual" : when,
1691
- runAt: chunkDDYXFALG_cjs.isoToLocalInput(record.run_at),
1691
+ runAt: chunkNW3LFDZL_cjs.isoToLocalInput(record.run_at),
1692
1692
  rrule: record.rrule ?? "",
1693
1693
  timezone: record.timezone || DEFAULT_WORKFLOW_TRIGGER.timezone,
1694
1694
  eventKind: record.event_kind ?? "",
@@ -1744,7 +1744,7 @@ function triggerSummary(trigger, options = {}) {
1744
1744
  case "once":
1745
1745
  return trigger.runAt ? new Date(trigger.runAt).toLocaleString() : l.starts.once;
1746
1746
  case "repeat":
1747
- return trigger.rrule ? chunkDDYXFALG_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
1747
+ return trigger.rrule ? chunkNW3LFDZL_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
1748
1748
  case "event":
1749
1749
  if (isSignalTrigger(trigger))
1750
1750
  return trigger.signal ? l.signalSummary.replace("{signal}", trigger.signal) : l.stepSignals;
@@ -1803,7 +1803,7 @@ function TriggerInspector({
1803
1803
  }
1804
1804
  )
1805
1805
  ] }),
1806
- trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkDDYXFALG_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
1806
+ trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkNW3LFDZL_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
1807
1807
  trigger.start === "event" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1808
1808
  /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.event }),
1809
1809
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1855,7 +1855,7 @@ function TriggerInspector({
1855
1855
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1856
1856
  /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.agent }),
1857
1857
  /* @__PURE__ */ jsxRuntime.jsx(
1858
- chunkDDYXFALG_cjs.AgentSelect,
1858
+ chunkNW3LFDZL_cjs.AgentSelect,
1859
1859
  {
1860
1860
  agents,
1861
1861
  value: trigger.agentId,
@@ -2706,7 +2706,7 @@ function WorkflowPreview({
2706
2706
  renderIcon,
2707
2707
  testId
2708
2708
  }) {
2709
- const run = chunkDDYXFALG_cjs.useWorkflowPreview(workflow, {
2709
+ const run = chunkNW3LFDZL_cjs.useWorkflowPreview(workflow, {
2710
2710
  resolveWorkflow: (id) => workflows.find((w) => w.id === id),
2711
2711
  compose,
2712
2712
  answer
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useConnection } from '../chunk-OYMWV45N.js';
3
- import { workflowWhen, isoToLocalInput, describeRRule, RecurrenceBuilder, AgentSelect, useWorkflowPreview, localInputToIso } from '../chunk-5NQIBJPP.js';
3
+ import { workflowWhen, isoToLocalInput, describeRRule, RecurrenceBuilder, AgentSelect, useWorkflowPreview, localInputToIso } from '../chunk-NJX774HB.js';
4
4
  import '../chunk-4XJZ6AAY.js';
5
5
  import '../chunk-P6GHJSLR.js';
6
6
  import { workflowSteps, dependsOn, stepLevels, isIncompleteSignal, runFields, upstreamSteps, stepDependencies, canAssign, fromPlanSteps, layoutFromPlanSteps, validateWorkflowGraph, stepConfigProblems, WorkflowRunner, skillToWorkflow, assigneeName, orderSteps, toPlanSteps } from '../chunk-PGDL26TQ.js';
@@ -15,10 +15,10 @@ import '../chunk-YU2KUMGE.js';
15
15
  import '../chunk-DDF5GPIJ.js';
16
16
  import '../chunk-XD2M6LIG.js';
17
17
  import '../chunk-S7PSMMRG.js';
18
+ import '../chunk-76JDDMSP.js';
18
19
  import '../chunk-HOXKR26S.js';
19
20
  import '../chunk-AA3PT6KR.js';
20
21
  import '../chunk-NPLYHR2E.js';
21
- import '../chunk-76JDDMSP.js';
22
22
  import '../chunk-OXF2IFXG.js';
23
23
  import '../chunk-TX2ZICS7.js';
24
24
  import '../chunk-ZPLG7QYF.js';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/coedit",
3
- "version": "0.4.102",
3
+ "version": "0.4.104",
4
4
  "description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbidocs/blocks",
3
- "version": "0.4.102",
3
+ "version": "0.4.104",
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",
@@ -267,8 +267,8 @@
267
267
  "example:test:e2e": "playwright test -c examples/custom-ui/playwright.config.ts"
268
268
  },
269
269
  "dependencies": {
270
- "@arbidocs/client": "0.4.102",
271
- "@arbidocs/coedit": "0.4.102",
270
+ "@arbidocs/client": "0.4.104",
271
+ "@arbidocs/coedit": "0.4.104",
272
272
  "@dnd-kit/core": "^6.3.1",
273
273
  "@dnd-kit/sortable": "^10.0.0",
274
274
  "@dnd-kit/utilities": "^3.2.2",
@@ -310,7 +310,7 @@
310
310
  "y-protocols": "^1.0.6"
311
311
  },
312
312
  "peerDependencies": {
313
- "@arbidocs/react": "0.4.102",
313
+ "@arbidocs/react": "0.4.104",
314
314
  "@lexical/html": "0.35.0",
315
315
  "@lexical/link": "0.35.0",
316
316
  "@lexical/list": "0.35.0",
@@ -77,6 +77,28 @@ the end). Hovering a term shows its definition. The terms are read from
77
77
  the facts with `parseDefinition`/`groupDefinitions` (root entry), which also print the glossary
78
78
  (`glossaryDocx`, `glossaryMarkdown`).
79
79
 
80
+ Cross-references: Insert › Cross-reference and the right-click menu (which keeps the editor's own
81
+ Cut, Copy and Paste rows and adds Insert defined term and Insert cross-reference) refer to a
82
+ numbered clause or a heading the way Word does — a hidden `_Ref…` bookmark on the target and a
83
+ `REF _Ref… \r \h` field (paragraph number) or `REF _Ref… \h` (heading text) at the caret, which
84
+ follows renumbering. Cached results are brought up to date when the document loads and before Save
85
+ version or download, so Word reads the current number too. Give the adapter `references`
86
+ (`DocxReferencesAdapter`: documents, their passages, the app link to a passage and how to open it)
87
+ to also refer to a passage of another document: the reference text ("SPA, clause 8.2") is
88
+ inserted as a link to the app address of that passage, opened in the app on click. Hovering a
89
+ reference shows what it points at.
90
+
91
+ Cross-references read as such: both kinds are in the "Cross Reference" character style (added to
92
+ the document when it lacks one — a house template's own definition wins), with a screen tip Word
93
+ shows too ("Cross-reference to clause 2.2", "Cross-reference: SPA, clause 8.2 — opens in ARBI").
94
+ A reference to another document links to the absolute platform address of the passage. When a
95
+ reference's target is deleted, updating keeps its last text in the "Cross Reference Broken" style
96
+ instead of leaving Word's "Error! Reference source not found."; References › Update
97
+ cross-references lists those.
98
+ While suggesting, an inserted cross-reference is one tracked insertion (through
99
+ `useTrackedOrNoted`, like a defined term or a Quick Part), so rejecting it removes it; marking its
100
+ target (the hidden bookmark) and bringing a stale number up to date are direct edits.
101
+
80
102
  Layout, tables and pictures (`layout/`): the ribbon's Layout tab offers Margins, Orientation and
81
103
  Size galleries (written to the caret's section with `setPageSetup`), Breaks (page, next-page and
82
104
  continuous section breaks) and the engine's Page Setup dialog. The contextual Table tab (caret in a
@@ -87,6 +109,16 @@ text, rotate and flip, and Insert caption (a `Caption`-style paragraph numbered
87
109
  Give the adapter `imageGeneration` and Insert offers Generate image: the picture comes back as an
88
110
  ordinary inline picture at the caret, its alt text the prompt, its bytes a media part of the DOCX.
89
111
 
112
+ Ribbon width: when a tab's controls do not fit, they collapse into a trailing More ("…") menu, as in
113
+ Word: lowest priority first, the rightmost first among equals (`RibbonOverflow`, `RibbonItem`).
114
+ A collapsed control is the same component, shown in the menu beside its label. Undo, Redo and Save
115
+ always stay in the ribbon.
116
+
117
+ Footnotes and endnotes: References › Insert footnote / Insert endnote (Ctrl+Alt+F / Ctrl+Alt+D)
118
+ first adds Word's note styles when the document has none (a new blank note has none), so the
119
+ reference and the note number are superscript and the note text is smaller. The note then takes the
120
+ "footnote text" (or "endnote text") style and gets a space after its number, as in Word.
121
+
90
122
  What the engine does not do yet, so the ribbon shows it disabled with the engine's reason:
91
123
 
92
124
  - Text columns: `w:cols` in an opened document lay out and save unchanged, but no command writes
@@ -1,4 +1,4 @@
1
- @import "./layout/layout.css";
1
+ @import './layout/layout.css';
2
2
 
3
3
  .native-docx-viewer {
4
4
  position: relative;
@@ -310,6 +310,73 @@
310
310
  padding-inline: 4px;
311
311
  }
312
312
 
313
+ .native-docx-ribbon-popover[hidden] {
314
+ display: none;
315
+ }
316
+
317
+ /* A tab's row: what does not fit collapses into the trailing More ("…") menu. */
318
+ .native-docx-ribbon .docx-toolbar > .native-docx-ribbon-row {
319
+ display: flex;
320
+ flex: 1 1 0;
321
+ align-items: center;
322
+ gap: 2px;
323
+ min-width: 0;
324
+ }
325
+ .native-docx-ribbon-item {
326
+ display: flex;
327
+ flex: none;
328
+ align-items: center;
329
+ gap: 2px;
330
+ }
331
+ .native-docx-ribbon-item[hidden] {
332
+ display: none;
333
+ }
334
+ .native-docx-ribbon-popover.native-docx-ribbon-more {
335
+ width: 240px;
336
+ padding: 4px;
337
+ }
338
+ .native-docx-ribbon-more-list {
339
+ display: flex;
340
+ flex-direction: column;
341
+ gap: 2px;
342
+ width: 100%;
343
+ }
344
+ .native-docx-ribbon-more-row {
345
+ position: relative;
346
+ display: flex;
347
+ align-items: center;
348
+ gap: 8px;
349
+ min-height: 32px;
350
+ padding: 0 8px 0 2px;
351
+ border-radius: 4px;
352
+ font-size: 12px;
353
+ cursor: pointer;
354
+ }
355
+ .native-docx-ribbon-more-row:hover {
356
+ background: hsl(var(--muted));
357
+ }
358
+ /* A control that draws nothing (an action the host does not offer) has no row. */
359
+ .native-docx-ribbon-more-row:has(> .native-docx-ribbon-more-control:empty) {
360
+ display: none;
361
+ }
362
+ .native-docx-ribbon-more-control {
363
+ display: flex;
364
+ flex: none;
365
+ align-items: center;
366
+ gap: 2px;
367
+ }
368
+ .native-docx-ribbon-more-label {
369
+ flex: 1;
370
+ min-width: 0;
371
+ overflow: hidden;
372
+ text-overflow: ellipsis;
373
+ white-space: nowrap;
374
+ }
375
+ /* A panel opened from the More menu (Font, a gallery) drops under its own row. */
376
+ .native-docx-ribbon-more-row .native-docx-ribbon-popover {
377
+ z-index: 1;
378
+ }
379
+
313
380
  /* Home › Styles: the current paragraph style, opening the document's style gallery. */
314
381
  .native-docx-ribbon-trigger.native-docx-style-trigger {
315
382
  display: flex;
@@ -325,7 +392,7 @@
325
392
  text-overflow: ellipsis;
326
393
  white-space: nowrap;
327
394
  }
328
- .native-docx-ribbon-menu:has(.native-docx-style-trigger) .native-docx-ribbon-popover {
395
+ .native-docx-ribbon-menu:has(> .native-docx-style-trigger) > .native-docx-ribbon-popover {
329
396
  right: auto;
330
397
  left: 72px;
331
398
  width: 300px;
@@ -733,7 +800,8 @@
733
800
  }
734
801
  /* With a pointer that hovers, a resting card shows only its content; its controls come with it. */
735
802
  @media (hover: hover) {
736
- .native-docx-review-pane .native-docx-review-card:not([data-active]):not(:hover):not(:focus-within)
803
+ .native-docx-review-pane
804
+ .native-docx-review-card:not([data-active]):not(:hover):not(:focus-within)
737
805
  :is(.native-docx-review-tools, .native-docx-review-decide) {
738
806
  opacity: 0;
739
807
  }
@@ -985,8 +1053,8 @@
985
1053
  }
986
1054
 
987
1055
  /* Insert › Quick Parts and Design › House template panels. */
988
- .native-docx-ribbon-menu:has([data-testid='docx-quick-parts']) .native-docx-ribbon-popover,
989
- .native-docx-ribbon-menu:has([data-testid='docx-house-template']) .native-docx-ribbon-popover {
1056
+ .native-docx-ribbon-menu:has(> [data-testid='docx-quick-parts']) > .native-docx-ribbon-popover,
1057
+ .native-docx-ribbon-menu:has(> [data-testid='docx-house-template']) > .native-docx-ribbon-popover {
990
1058
  width: 340px;
991
1059
  padding: 8px;
992
1060
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tags/definitions.ts","../src/tags/ooxml.ts"],"names":["decodeWhitespaceEntities","zipSync","strToU8"],"mappings":";;;;;;AAWO,IAAM,iBAAA,GAAoB;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,EAAA,OAAOC,cAAA,CAAQ;AAAA,IACb,qBAAA,EAAuBC,eAAQ,aAAa,CAAA;AAAA,IAC5C,aAAA,EAAeA,eAAQ,SAAS,CAAA;AAAA,IAChC,qBAAqBA,cAAA,CAAQ,OAAA,CAAQ,KAAA,CAAM,KAAA,EAAO,EAAE,CAAC,CAAA;AAAA,IACrD,mBAAA,EAAqBA,cAAA,CAAQ,KAAA,CAAM,QAAQ,CAAA;AAAA,IAC3C,iBAAA,EAAmBA,cAAA,CAAQ,KAAA,CAAM,MAAM,CAAA;AAAA,IACvC,8BAAA,EAAgCA,eAAQ,aAAa;AAAA,GACtD,CAAA;AACH","file":"chunk-AOFATOT3.cjs","sourcesContent":["/**\n * Defined terms. A definition is an ordinary fact carrying the workspace's \"Definitions\" label; its\n * TERM is read from the start of its text — `\"Shares\" means …`, `**Business Day** shall mean …`,\n * `Completion: the date …` — and facts defining the same term (one per agreement, say) are grouped,\n * a confirmed one preferred over the rest, then the most recent. Pure helpers, no React: the Word\n * editor inserts terms with them and the Tags page prints the glossary with them.\n */\n\nimport { decodeWhitespaceEntities } from '../facts/fact-text'\n\n/** The label that marks a fact as a definition. */\nexport const DEFINITIONS_LABEL = 'Definitions'\n\n/** A label on a definition other than {@link DEFINITIONS_LABEL} (e.g. the agreement it is from). */\nexport interface DefinitionLabel {\n id: string\n name: string\n}\n\n/** A definition fact, as the host reads it. */\nexport interface DefinitionSource {\n /** The fact's id (`fct-…`). */\n id: string\n /** The fact text, as written (it may be Markdown). */\n text: string\n /** A human vouched for it: preferred over unconfirmed definitions of the same term. */\n confirmed?: boolean\n /** ISO time it was last written; the most recent wins between equals. */\n updatedAt?: string\n /** Where it comes from: the cited document's name. */\n source?: string\n /** Its other labels, e.g. the agreement (\"SPA\") it defines a term of. */\n labels?: DefinitionLabel[]\n}\n\n/** A definition's text split into its term and the rest. */\nexport interface ParsedDefinition {\n /** The term as written, without quotes or emphasis (`Business Day`). */\n term: string\n /** What follows the term, its connecting word included (`means a day …`, `: the date …`). */\n rest: string\n /** Just the meaning, the connecting word dropped (`a day …`). */\n meaning: string\n}\n\n/** A parsed definition fact. */\nexport interface Definition extends DefinitionSource, ParsedDefinition {\n /** The term's matching key (case and whitespace folded). */\n key: string\n}\n\n/** Every definition of one term, the preferred one first. */\nexport interface DefinedTermGroup {\n key: string\n /** The term as the preferred definition writes it. */\n term: string\n /** The preferred definition (first of {@link DefinedTermGroup.definitions}). */\n preferred: Definition\n definitions: Definition[]\n}\n\nconst QUOTES = `\"“”„‟'‘’‚‛«»`\nconst OPEN_CLOSE: Record<string, string> = {\n '\"': '\"',\n '“': '”',\n '„': '“',\n '‟': '”',\n \"'\": \"'\",\n '‘': '’',\n '‚': '‘',\n '‛': '’',\n '«': '»',\n}\nconst EMPHASIS = /^(\\*\\*|__|\\*|_)/\n/** The words (or punctuation) joining a term to its meaning, longest first. */\nconst CONNECTORS =\n /^(?:shall\\s+(?:have\\s+the\\s+meaning|mean|include)s?|ha(?:s|ve)\\s+the\\s+meanings?|means?\\s+and\\s+includes?|means|mean|includes|include|[:—–]|\\s-\\s|-\\s)/i\nconst MAX_TERM_LENGTH = 80\nconst MAX_TERM_WORDS = 10\n\n/** Markdown emphasis and escapes dropped, entity-encoded whitespace decoded, whitespace collapsed. */\nfunction plain(text: string): string {\n return decodeWhitespaceEntities(text)\n .replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!\"'])/g, '$1')\n .replace(/(\\*\\*|__)(.+?)\\1/g, '$2')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/** The matching key of a term: case and whitespace folded, quotes and emphasis dropped. */\nexport function termKey(term: string): string {\n return plain(term)\n .replace(new RegExp(`[${QUOTES}*_]`, 'g'), '')\n .replace(/\\s+/g, ' ')\n .trim()\n .toLowerCase()\n}\n\nconst validTerm = (term: string) =>\n term.length > 0 &&\n term.length <= MAX_TERM_LENGTH &&\n term.split(/\\s+/).length <= MAX_TERM_WORDS &&\n /\\p{L}/u.test(term)\n\n/** A connector at the start of `rest` (after optional whitespace): its length, or 0. */\nfunction connectorAt(rest: string): number {\n const lead = rest.length - rest.trimStart().length\n // A spaced hyphen needs its leading space, so try the raw text before the trimmed one.\n const spaced = /^\\s-\\s/.exec(rest)\n if (spaced) return spaced[0].length\n const match = CONNECTORS.exec(rest.slice(lead))\n return match ? lead + match[0].length : 0\n}\n\n/**\n * Read a definition's term from the start of its text, or `null` when it does not start with one.\n *\n * Optional straight or curly quotes and bold markers around the term are dropped; the term is what\n * comes before \"means\", \"shall mean\", \"includes\", \"has the meaning\", a colon, or a dash. A quoted\n * term is taken whole, so `\"Long-Stop Date\" means …` keeps its hyphen.\n */\nexport function parseDefinition(text: string): ParsedDefinition | null {\n let s = plain(text)\n // Leading emphasis markers (`**\"Shares\"** means`), any order with the opening quote.\n for (let i = 0; i < 3; i++) s = s.replace(EMPHASIS, '').trimStart()\n let term: string\n let rest: string\n const open = s[0]\n const close = open ? OPEN_CLOSE[open] : undefined\n if (close) {\n const end = s.indexOf(close, 1)\n if (end < 0) return null\n term = s.slice(1, end)\n rest = s.slice(end + 1)\n // Emphasis or a closing quote between the term and its connector (`\"Shares\"**`, `**\"X**\"`).\n rest = rest.replace(new RegExp(`^(?:\\\\*\\\\*|__|\\\\*|_|[${QUOTES}])+`), '')\n } else {\n // Unquoted: the term runs up to the first connector.\n const match =\n /^(.+?)(\\s+(?:shall\\s+(?:have\\s+the\\s+meaning|mean|include)s?|ha(?:s|ve)\\s+the\\s+meanings?|means?\\s+and\\s+includes?|means|includes)\\b|\\s*[:—–]|\\s+-\\s)/i.exec(\n s\n )\n if (!match) return null\n term = match[1]\n rest = s.slice(match[1].length)\n }\n term = term.replace(/(\\*\\*|__|\\*|_)/g, '').trim()\n const joint = connectorAt(rest)\n if (!joint || !validTerm(term)) return null\n const meaning = rest.slice(joint).trim()\n if (!meaning) return null\n return { term, rest: rest.replace(/^\\s+/, ' ').replace(/^ (?=[:—–])/, ''), meaning }\n}\n\n/** A definition parsed, or `null` when its text names no term. */\nexport function toDefinition(source: DefinitionSource): Definition | null {\n const parsed = parseDefinition(source.text)\n return parsed ? { ...source, ...parsed, key: termKey(parsed.term) } : null\n}\n\nconst time = (iso?: string) => (iso ? Date.parse(iso) || 0 : 0)\n\n/** Preferred first: confirmed, then most recently written, then by id (stable). */\nexport function compareDefinitions(a: DefinitionSource, b: DefinitionSource): number {\n return (\n Number(!!b.confirmed) - Number(!!a.confirmed) ||\n time(b.updatedAt) - time(a.updatedAt) ||\n a.id.localeCompare(b.id)\n )\n}\n\n/** Alphabetical order of terms, as a reader sorts a glossary (case and accents folded). */\nexport const compareTerms = (a: string, b: string) =>\n a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true })\n\n/**\n * Definitions grouped by term, alphabetically, each group's preferred definition first. Facts whose\n * text names no term are returned apart (`unparsed`), so a host can say how many it could not read.\n * With `labelId`, only definitions carrying that label (one agreement's, say) are kept.\n */\nexport function groupDefinitions(\n sources: readonly DefinitionSource[],\n options: { labelId?: string | null } = {}\n): { groups: DefinedTermGroup[]; unparsed: DefinitionSource[] } {\n const byKey = new Map<string, Definition[]>()\n const unparsed: DefinitionSource[] = []\n for (const source of sources) {\n if (options.labelId && !source.labels?.some((l) => l.id === options.labelId)) continue\n const definition = toDefinition(source)\n if (!definition) {\n unparsed.push(source)\n continue\n }\n const list = byKey.get(definition.key) ?? []\n list.push(definition)\n byKey.set(definition.key, list)\n }\n const groups = [...byKey.entries()].map(([key, list]) => {\n const definitions = [...list].sort(compareDefinitions)\n return { key, term: definitions[0].term, preferred: definitions[0], definitions }\n })\n groups.sort((a, b) => compareTerms(a.term, b.term))\n return { groups, unparsed }\n}\n\n/** The labels (agreements) definitions carry besides the Definitions label, by name. */\nexport function definitionLabels(sources: readonly DefinitionSource[]): DefinitionLabel[] {\n const byId = new Map<string, DefinitionLabel>()\n for (const s of sources) for (const l of s.labels ?? []) byId.set(l.id, l)\n return [...byId.values()].sort((a, b) => compareTerms(a.name, b.name))\n}\n\n/** Groups whose term matches a typed query: prefix matches first, then any word, then anywhere. */\nexport function filterTermGroups(\n groups: readonly DefinedTermGroup[],\n query: string\n): DefinedTermGroup[] {\n const q = termKey(query)\n if (!q) return [...groups]\n const rank = (g: DefinedTermGroup) =>\n g.key.startsWith(q) ? 0 : g.key.split(' ').some((w) => w.startsWith(q)) ? 1 : 2\n return groups\n .filter((g) => g.key.includes(q))\n .map((g) => ({ g, r: rank(g) }))\n .sort((a, b) => a.r - b.r || compareTerms(a.g.term, b.g.term))\n .map(({ g }) => g)\n}\n\n/** Prefix of every bookmark a defined term links to: hidden in Word (leading underscore). */\nexport const DEFINITION_BOOKMARK_PREFIX = '_dt_'\nconst MAX_BOOKMARK_LENGTH = 40\n\n/**\n * The Word bookmark of a definition: `_dt_` and the fact id in valid bookmark characters\n * (`fct-AbC12345` → `_dt_fct_AbC12345`), at most 40 characters as Word requires.\n */\nexport function definitionBookmark(factId: string): string {\n return (DEFINITION_BOOKMARK_PREFIX + factId.replace(/[^A-Za-z0-9_]/g, '_')).slice(\n 0,\n MAX_BOOKMARK_LENGTH\n )\n}\n\n/** The fact id a definition bookmark names, or `null` for any other bookmark. */\nexport function definitionIdOfBookmark(name: string): string | null {\n const match = /^_dt_([a-z]{3})_([A-Za-z0-9]+)$/.exec(name)\n return match ? `${match[1]}-${match[2]}` : null\n}\n","/**\n * The small WordprocessingML vocabulary the tags exports write: escaped runs, paragraphs, table\n * cells, an A4 page, and the minimal package around a `word/document.xml`. Zipped with `fflate`, so\n * the result opens in the native Word editor and in Word without pulling the editor engine in.\n */\n\nimport { strToU8, zipSync } from 'fflate'\n\nexport const DOCX_MIME_TYPE =\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n\nexport const W_NAMESPACES =\n 'xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"'\n\n// Text that is not allowed in XML 1.0 at all (control characters) is dropped, not escaped.\n// eslint-disable-next-line no-control-regex\nconst INVALID_XML = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F￾￿]/g\n\n/** Text as XML character data or an attribute value. */\nexport const esc = (text: string) =>\n text\n .replace(INVALID_XML, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\nexport interface Run {\n text: string\n bold?: boolean\n italic?: boolean\n muted?: boolean\n}\n\nexport const run = ({ text, bold, italic, muted }: Run) => {\n const props = [bold && '<w:b/>', italic && '<w:i/>', muted && '<w:color w:val=\"595959\"/>']\n .filter(Boolean)\n .join('')\n // Line breaks inside a value become Word line breaks rather than being lost.\n const body = text\n .split(/\\r?\\n/)\n .map((line) => `<w:t xml:space=\"preserve\">${esc(line)}</w:t>`)\n .join('<w:br/>')\n return `<w:r>${props ? `<w:rPr>${props}</w:rPr>` : ''}${body}</w:r>`\n}\n\nexport const paragraph = (runs: Run[], style?: string) =>\n `<w:p>${style ? `<w:pPr><w:pStyle w:val=\"${style}\"/></w:pPr>` : ''}${runs.map(run).join('')}</w:p>`\n\n/** A table cell: its paragraphs (a cell must hold at least one), shaded when given a fill. */\nexport const cell = (paragraphs: string[], width: number, fill?: string) =>\n `<w:tc><w:tcPr><w:tcW w:w=\"${width}\" w:type=\"dxa\"/>${\n fill ? `<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"${fill}\"/>` : ''\n }</w:tcPr>${paragraphs.length ? paragraphs.join('') : '<w:p/>'}</w:tc>`\n\n/** Page geometry in twips (A4), turned for landscape. */\nexport function page(landscape: boolean) {\n const [short, long] = [11906, 16838]\n const margin = landscape ? 1080 : 1440\n const width = landscape ? long : short\n return {\n margin,\n textWidth: width - 2 * margin,\n sectPr: `<w:sectPr><w:pgSz w:w=\"${landscape ? long : short}\" w:h=\"${landscape ? short : long}\"${\n landscape ? ' w:orient=\"landscape\"' : ''\n }/><w:pgMar w:top=\"${margin}\" w:right=\"${margin}\" w:bottom=\"${margin}\" w:left=\"${margin}\" w:header=\"708\" w:footer=\"708\" w:gutter=\"0\"/></w:sectPr>`,\n }\n}\n\n/** `YYYY-MM-DD HH:MM` (UTC) of an ISO time, for a \"taken at\" line. */\nexport const minuteUtc = (at: string) => new Date(at).toISOString().slice(0, 16).replace('T', ' ')\n\n/** A `word/document.xml` around body content (paragraphs, tables, then the section). */\nexport const documentXml = (body: string) =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<w:document ${W_NAMESPACES}><w:body>${body}</w:body></w:document>`\n\n/** `word/styles.xml` holding the given style definitions. */\nexport const stylesXml = (defaults: string, styles: string) =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<w:styles xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">${defaults}${styles}</w:styles>`\n\n/** Calibri 11pt (en-GB), 8pt after each paragraph: the document defaults the exports share. */\nexport const DOC_DEFAULTS = `<w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:eastAsia=\"Calibri\" w:cs=\"Calibri\"/><w:sz w:val=\"22\"/><w:szCs w:val=\"22\"/><w:lang w:val=\"en-GB\"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after=\"160\" w:line=\"259\" w:lineRule=\"auto\"/></w:pPr></w:pPrDefault></w:docDefaults>`\n\n/**\n * Styles of a document that is a title and a table: `Title`, the compact `TagTableCell` paragraph\n * and the bordered `TagTableGrid` table.\n */\nexport const TABLE_DOCUMENT_STYLES = stylesXml(\n DOC_DEFAULTS,\n `<w:style w:type=\"paragraph\" w:default=\"1\" w:styleId=\"Normal\"><w:name w:val=\"Normal\"/><w:qFormat/></w:style><w:style w:type=\"paragraph\" w:styleId=\"Title\"><w:name w:val=\"Title\"/><w:basedOn w:val=\"Normal\"/><w:next w:val=\"Normal\"/><w:qFormat/><w:pPr><w:spacing w:after=\"80\" w:line=\"240\" w:lineRule=\"auto\"/></w:pPr><w:rPr><w:sz w:val=\"48\"/><w:szCs w:val=\"48\"/></w:rPr></w:style><w:style w:type=\"paragraph\" w:customStyle=\"1\" w:styleId=\"TagTableCell\"><w:name w:val=\"Tag Table Cell\"/><w:basedOn w:val=\"Normal\"/><w:qFormat/><w:pPr><w:spacing w:after=\"40\" w:line=\"240\" w:lineRule=\"auto\"/></w:pPr><w:rPr><w:sz w:val=\"18\"/><w:szCs w:val=\"18\"/></w:rPr></w:style><w:style w:type=\"table\" w:default=\"1\" w:styleId=\"TableNormal\"><w:name w:val=\"Normal Table\"/><w:tblPr><w:tblInd w:w=\"0\" w:type=\"dxa\"/><w:tblCellMar><w:top w:w=\"0\" w:type=\"dxa\"/><w:left w:w=\"108\" w:type=\"dxa\"/><w:bottom w:w=\"0\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr></w:style><w:style w:type=\"table\" w:customStyle=\"1\" w:styleId=\"TagTableGrid\"><w:name w:val=\"Tag Table\"/><w:basedOn w:val=\"TableNormal\"/><w:tblPr><w:tblBorders><w:top w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:left w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:bottom w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:right w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:insideH w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:insideV w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/></w:tblBorders><w:tblCellMar><w:top w:w=\"60\" w:type=\"dxa\"/><w:left w:w=\"100\" w:type=\"dxa\"/><w:bottom w:w=\"60\" w:type=\"dxa\"/><w:right w:w=\"100\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr></w:style>`\n)\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/word/document.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/><Override PartName=\"/word/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"/><Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"word/document.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"docProps/core.xml\"/></Relationships>`\n\nconst DOCUMENT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\nconst coreXml = (\n title: string,\n at: string\n) => `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dc:title>${esc(\n title\n)}</dc:title><dcterms:created xsi:type=\"dcterms:W3CDTF\">${at}</dcterms:created><dcterms:modified xsi:type=\"dcterms:W3CDTF\">${at}</dcterms:modified></cp:coreProperties>`\n\n/** The minimal `.docx` package: a document, its styles, and its title and time. */\nexport function docxPackage(parts: {\n document: string\n styles: string\n title: string\n /** ISO time; default now. */\n at?: string\n}): Uint8Array {\n const at = new Date(parts.at ?? Date.now()).toISOString().replace(/\\.\\d{3}Z$/, 'Z')\n return zipSync({\n '[Content_Types].xml': strToU8(CONTENT_TYPES),\n '_rels/.rels': strToU8(ROOT_RELS),\n 'docProps/core.xml': strToU8(coreXml(parts.title, at)),\n 'word/document.xml': strToU8(parts.document),\n 'word/styles.xml': strToU8(parts.styles),\n 'word/_rels/document.xml.rels': strToU8(DOCUMENT_RELS),\n })\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tags/definitions.ts","../src/tags/ooxml.ts"],"names":[],"mappings":";;;;AAWO,IAAM,iBAAA,GAAoB;AAkDjC,IAAM,MAAA,GAAS,CAAA,0DAAA,CAAA;AACf,IAAM,UAAA,GAAqC;AAAA,EACzC,GAAA,EAAK,GAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,GAAA,EAAK,GAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,QAAA,EAAK,QAAA;AAAA,EACL,MAAA,EAAK;AACP,CAAA;AACA,IAAM,QAAA,GAAW,iBAAA;AAEjB,IAAM,UAAA,GACJ,yJAAA;AACF,IAAM,eAAA,GAAkB,EAAA;AACxB,IAAM,cAAA,GAAiB,EAAA;AAGvB,SAAS,MAAM,IAAA,EAAsB;AACnC,EAAA,OAAO,wBAAA,CAAyB,IAAI,CAAA,CACjC,OAAA,CAAQ,+BAA+B,IAAI,CAAA,CAC3C,OAAA,CAAQ,mBAAA,EAAqB,IAAI,CAAA,CACjC,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;AAGO,SAAS,QAAQ,IAAA,EAAsB;AA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AAA,GAAgB,CAAA;AAAA,umBAAA,CAAA;AAGtB,IAAM,SAAA,GAAY,CAAA;AAAA,mYAAA,CAAA;AAGlB,IAAM,aAAA,GAAgB,CAAA;AAAA,mOAAA,CAAA;AAGtB,IAAM,OAAA,GAAU,CACd,KAAA,EACA,EAAA,KACG,CAAA;AAAA,4PAAA,EACyP,GAAA;AAAA,EAC5P;AACF,CAAC,CAAA,sDAAA,EAAyD,EAAE,CAAA,8DAAA,EAAiE,EAAE,CAAA,uCAAA,CAAA;AAGxH,SAAS,YAAY,KAAA,EAMb;AACb,EAAA,MAAM,EAAA,GAAK,IAAI,IAAA,CAAK,KAAA,CAAM,EAAA,IAAM,IAAA,CAAK,GAAA,EAAK,CAAA,CAAE,WAAA,EAAY,CAAE,OAAA,CAAQ,aAAa,GAAG,CAAA;AAClF,EAAA,OAAO,OAAA,CAAQ;AAAA,IACb,qBAAA,EAAuB,QAAQ,aAAa,CAAA;AAAA,IAC5C,aAAA,EAAe,QAAQ,SAAS,CAAA;AAAA,IAChC,qBAAqB,OAAA,CAAQ,OAAA,CAAQ,KAAA,CAAM,KAAA,EAAO,EAAE,CAAC,CAAA;AAAA,IACrD,mBAAA,EAAqB,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAA;AAAA,IAC3C,iBAAA,EAAmB,OAAA,CAAQ,KAAA,CAAM,MAAM,CAAA;AAAA,IACvC,8BAAA,EAAgC,QAAQ,aAAa;AAAA,GACtD,CAAA;AACH","file":"chunk-D3QPYKZG.js","sourcesContent":["/**\n * Defined terms. A definition is an ordinary fact carrying the workspace's \"Definitions\" label; its\n * TERM is read from the start of its text — `\"Shares\" means …`, `**Business Day** shall mean …`,\n * `Completion: the date …` — and facts defining the same term (one per agreement, say) are grouped,\n * a confirmed one preferred over the rest, then the most recent. Pure helpers, no React: the Word\n * editor inserts terms with them and the Tags page prints the glossary with them.\n */\n\nimport { decodeWhitespaceEntities } from '../facts/fact-text'\n\n/** The label that marks a fact as a definition. */\nexport const DEFINITIONS_LABEL = 'Definitions'\n\n/** A label on a definition other than {@link DEFINITIONS_LABEL} (e.g. the agreement it is from). */\nexport interface DefinitionLabel {\n id: string\n name: string\n}\n\n/** A definition fact, as the host reads it. */\nexport interface DefinitionSource {\n /** The fact's id (`fct-…`). */\n id: string\n /** The fact text, as written (it may be Markdown). */\n text: string\n /** A human vouched for it: preferred over unconfirmed definitions of the same term. */\n confirmed?: boolean\n /** ISO time it was last written; the most recent wins between equals. */\n updatedAt?: string\n /** Where it comes from: the cited document's name. */\n source?: string\n /** Its other labels, e.g. the agreement (\"SPA\") it defines a term of. */\n labels?: DefinitionLabel[]\n}\n\n/** A definition's text split into its term and the rest. */\nexport interface ParsedDefinition {\n /** The term as written, without quotes or emphasis (`Business Day`). */\n term: string\n /** What follows the term, its connecting word included (`means a day …`, `: the date …`). */\n rest: string\n /** Just the meaning, the connecting word dropped (`a day …`). */\n meaning: string\n}\n\n/** A parsed definition fact. */\nexport interface Definition extends DefinitionSource, ParsedDefinition {\n /** The term's matching key (case and whitespace folded). */\n key: string\n}\n\n/** Every definition of one term, the preferred one first. */\nexport interface DefinedTermGroup {\n key: string\n /** The term as the preferred definition writes it. */\n term: string\n /** The preferred definition (first of {@link DefinedTermGroup.definitions}). */\n preferred: Definition\n definitions: Definition[]\n}\n\nconst QUOTES = `\"“”„‟'‘’‚‛«»`\nconst OPEN_CLOSE: Record<string, string> = {\n '\"': '\"',\n '“': '”',\n '„': '“',\n '‟': '”',\n \"'\": \"'\",\n '‘': '’',\n '‚': '‘',\n '‛': '’',\n '«': '»',\n}\nconst EMPHASIS = /^(\\*\\*|__|\\*|_)/\n/** The words (or punctuation) joining a term to its meaning, longest first. */\nconst CONNECTORS =\n /^(?:shall\\s+(?:have\\s+the\\s+meaning|mean|include)s?|ha(?:s|ve)\\s+the\\s+meanings?|means?\\s+and\\s+includes?|means|mean|includes|include|[:—–]|\\s-\\s|-\\s)/i\nconst MAX_TERM_LENGTH = 80\nconst MAX_TERM_WORDS = 10\n\n/** Markdown emphasis and escapes dropped, entity-encoded whitespace decoded, whitespace collapsed. */\nfunction plain(text: string): string {\n return decodeWhitespaceEntities(text)\n .replace(/\\\\([\\\\`*_{}[\\]()#+\\-.!\"'])/g, '$1')\n .replace(/(\\*\\*|__)(.+?)\\1/g, '$2')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/** The matching key of a term: case and whitespace folded, quotes and emphasis dropped. */\nexport function termKey(term: string): string {\n return plain(term)\n .replace(new RegExp(`[${QUOTES}*_]`, 'g'), '')\n .replace(/\\s+/g, ' ')\n .trim()\n .toLowerCase()\n}\n\nconst validTerm = (term: string) =>\n term.length > 0 &&\n term.length <= MAX_TERM_LENGTH &&\n term.split(/\\s+/).length <= MAX_TERM_WORDS &&\n /\\p{L}/u.test(term)\n\n/** A connector at the start of `rest` (after optional whitespace): its length, or 0. */\nfunction connectorAt(rest: string): number {\n const lead = rest.length - rest.trimStart().length\n // A spaced hyphen needs its leading space, so try the raw text before the trimmed one.\n const spaced = /^\\s-\\s/.exec(rest)\n if (spaced) return spaced[0].length\n const match = CONNECTORS.exec(rest.slice(lead))\n return match ? lead + match[0].length : 0\n}\n\n/**\n * Read a definition's term from the start of its text, or `null` when it does not start with one.\n *\n * Optional straight or curly quotes and bold markers around the term are dropped; the term is what\n * comes before \"means\", \"shall mean\", \"includes\", \"has the meaning\", a colon, or a dash. A quoted\n * term is taken whole, so `\"Long-Stop Date\" means …` keeps its hyphen.\n */\nexport function parseDefinition(text: string): ParsedDefinition | null {\n let s = plain(text)\n // Leading emphasis markers (`**\"Shares\"** means`), any order with the opening quote.\n for (let i = 0; i < 3; i++) s = s.replace(EMPHASIS, '').trimStart()\n let term: string\n let rest: string\n const open = s[0]\n const close = open ? OPEN_CLOSE[open] : undefined\n if (close) {\n const end = s.indexOf(close, 1)\n if (end < 0) return null\n term = s.slice(1, end)\n rest = s.slice(end + 1)\n // Emphasis or a closing quote between the term and its connector (`\"Shares\"**`, `**\"X**\"`).\n rest = rest.replace(new RegExp(`^(?:\\\\*\\\\*|__|\\\\*|_|[${QUOTES}])+`), '')\n } else {\n // Unquoted: the term runs up to the first connector.\n const match =\n /^(.+?)(\\s+(?:shall\\s+(?:have\\s+the\\s+meaning|mean|include)s?|ha(?:s|ve)\\s+the\\s+meanings?|means?\\s+and\\s+includes?|means|includes)\\b|\\s*[:—–]|\\s+-\\s)/i.exec(\n s\n )\n if (!match) return null\n term = match[1]\n rest = s.slice(match[1].length)\n }\n term = term.replace(/(\\*\\*|__|\\*|_)/g, '').trim()\n const joint = connectorAt(rest)\n if (!joint || !validTerm(term)) return null\n const meaning = rest.slice(joint).trim()\n if (!meaning) return null\n return { term, rest: rest.replace(/^\\s+/, ' ').replace(/^ (?=[:—–])/, ''), meaning }\n}\n\n/** A definition parsed, or `null` when its text names no term. */\nexport function toDefinition(source: DefinitionSource): Definition | null {\n const parsed = parseDefinition(source.text)\n return parsed ? { ...source, ...parsed, key: termKey(parsed.term) } : null\n}\n\nconst time = (iso?: string) => (iso ? Date.parse(iso) || 0 : 0)\n\n/** Preferred first: confirmed, then most recently written, then by id (stable). */\nexport function compareDefinitions(a: DefinitionSource, b: DefinitionSource): number {\n return (\n Number(!!b.confirmed) - Number(!!a.confirmed) ||\n time(b.updatedAt) - time(a.updatedAt) ||\n a.id.localeCompare(b.id)\n )\n}\n\n/** Alphabetical order of terms, as a reader sorts a glossary (case and accents folded). */\nexport const compareTerms = (a: string, b: string) =>\n a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true })\n\n/**\n * Definitions grouped by term, alphabetically, each group's preferred definition first. Facts whose\n * text names no term are returned apart (`unparsed`), so a host can say how many it could not read.\n * With `labelId`, only definitions carrying that label (one agreement's, say) are kept.\n */\nexport function groupDefinitions(\n sources: readonly DefinitionSource[],\n options: { labelId?: string | null } = {}\n): { groups: DefinedTermGroup[]; unparsed: DefinitionSource[] } {\n const byKey = new Map<string, Definition[]>()\n const unparsed: DefinitionSource[] = []\n for (const source of sources) {\n if (options.labelId && !source.labels?.some((l) => l.id === options.labelId)) continue\n const definition = toDefinition(source)\n if (!definition) {\n unparsed.push(source)\n continue\n }\n const list = byKey.get(definition.key) ?? []\n list.push(definition)\n byKey.set(definition.key, list)\n }\n const groups = [...byKey.entries()].map(([key, list]) => {\n const definitions = [...list].sort(compareDefinitions)\n return { key, term: definitions[0].term, preferred: definitions[0], definitions }\n })\n groups.sort((a, b) => compareTerms(a.term, b.term))\n return { groups, unparsed }\n}\n\n/** The labels (agreements) definitions carry besides the Definitions label, by name. */\nexport function definitionLabels(sources: readonly DefinitionSource[]): DefinitionLabel[] {\n const byId = new Map<string, DefinitionLabel>()\n for (const s of sources) for (const l of s.labels ?? []) byId.set(l.id, l)\n return [...byId.values()].sort((a, b) => compareTerms(a.name, b.name))\n}\n\n/** Groups whose term matches a typed query: prefix matches first, then any word, then anywhere. */\nexport function filterTermGroups(\n groups: readonly DefinedTermGroup[],\n query: string\n): DefinedTermGroup[] {\n const q = termKey(query)\n if (!q) return [...groups]\n const rank = (g: DefinedTermGroup) =>\n g.key.startsWith(q) ? 0 : g.key.split(' ').some((w) => w.startsWith(q)) ? 1 : 2\n return groups\n .filter((g) => g.key.includes(q))\n .map((g) => ({ g, r: rank(g) }))\n .sort((a, b) => a.r - b.r || compareTerms(a.g.term, b.g.term))\n .map(({ g }) => g)\n}\n\n/** Prefix of every bookmark a defined term links to: hidden in Word (leading underscore). */\nexport const DEFINITION_BOOKMARK_PREFIX = '_dt_'\nconst MAX_BOOKMARK_LENGTH = 40\n\n/**\n * The Word bookmark of a definition: `_dt_` and the fact id in valid bookmark characters\n * (`fct-AbC12345` → `_dt_fct_AbC12345`), at most 40 characters as Word requires.\n */\nexport function definitionBookmark(factId: string): string {\n return (DEFINITION_BOOKMARK_PREFIX + factId.replace(/[^A-Za-z0-9_]/g, '_')).slice(\n 0,\n MAX_BOOKMARK_LENGTH\n )\n}\n\n/** The fact id a definition bookmark names, or `null` for any other bookmark. */\nexport function definitionIdOfBookmark(name: string): string | null {\n const match = /^_dt_([a-z]{3})_([A-Za-z0-9]+)$/.exec(name)\n return match ? `${match[1]}-${match[2]}` : null\n}\n","/**\n * The small WordprocessingML vocabulary the tags exports write: escaped runs, paragraphs, table\n * cells, an A4 page, and the minimal package around a `word/document.xml`. Zipped with `fflate`, so\n * the result opens in the native Word editor and in Word without pulling the editor engine in.\n */\n\nimport { strToU8, zipSync } from 'fflate'\n\nexport const DOCX_MIME_TYPE =\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n\nexport const W_NAMESPACES =\n 'xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"'\n\n// Text that is not allowed in XML 1.0 at all (control characters) is dropped, not escaped.\n// eslint-disable-next-line no-control-regex\nconst INVALID_XML = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F￾￿]/g\n\n/** Text as XML character data or an attribute value. */\nexport const esc = (text: string) =>\n text\n .replace(INVALID_XML, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\nexport interface Run {\n text: string\n bold?: boolean\n italic?: boolean\n muted?: boolean\n}\n\nexport const run = ({ text, bold, italic, muted }: Run) => {\n const props = [bold && '<w:b/>', italic && '<w:i/>', muted && '<w:color w:val=\"595959\"/>']\n .filter(Boolean)\n .join('')\n // Line breaks inside a value become Word line breaks rather than being lost.\n const body = text\n .split(/\\r?\\n/)\n .map((line) => `<w:t xml:space=\"preserve\">${esc(line)}</w:t>`)\n .join('<w:br/>')\n return `<w:r>${props ? `<w:rPr>${props}</w:rPr>` : ''}${body}</w:r>`\n}\n\nexport const paragraph = (runs: Run[], style?: string) =>\n `<w:p>${style ? `<w:pPr><w:pStyle w:val=\"${style}\"/></w:pPr>` : ''}${runs.map(run).join('')}</w:p>`\n\n/** A table cell: its paragraphs (a cell must hold at least one), shaded when given a fill. */\nexport const cell = (paragraphs: string[], width: number, fill?: string) =>\n `<w:tc><w:tcPr><w:tcW w:w=\"${width}\" w:type=\"dxa\"/>${\n fill ? `<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"${fill}\"/>` : ''\n }</w:tcPr>${paragraphs.length ? paragraphs.join('') : '<w:p/>'}</w:tc>`\n\n/** Page geometry in twips (A4), turned for landscape. */\nexport function page(landscape: boolean) {\n const [short, long] = [11906, 16838]\n const margin = landscape ? 1080 : 1440\n const width = landscape ? long : short\n return {\n margin,\n textWidth: width - 2 * margin,\n sectPr: `<w:sectPr><w:pgSz w:w=\"${landscape ? long : short}\" w:h=\"${landscape ? short : long}\"${\n landscape ? ' w:orient=\"landscape\"' : ''\n }/><w:pgMar w:top=\"${margin}\" w:right=\"${margin}\" w:bottom=\"${margin}\" w:left=\"${margin}\" w:header=\"708\" w:footer=\"708\" w:gutter=\"0\"/></w:sectPr>`,\n }\n}\n\n/** `YYYY-MM-DD HH:MM` (UTC) of an ISO time, for a \"taken at\" line. */\nexport const minuteUtc = (at: string) => new Date(at).toISOString().slice(0, 16).replace('T', ' ')\n\n/** A `word/document.xml` around body content (paragraphs, tables, then the section). */\nexport const documentXml = (body: string) =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<w:document ${W_NAMESPACES}><w:body>${body}</w:body></w:document>`\n\n/** `word/styles.xml` holding the given style definitions. */\nexport const stylesXml = (defaults: string, styles: string) =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<w:styles xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">${defaults}${styles}</w:styles>`\n\n/** Calibri 11pt (en-GB), 8pt after each paragraph: the document defaults the exports share. */\nexport const DOC_DEFAULTS = `<w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:eastAsia=\"Calibri\" w:cs=\"Calibri\"/><w:sz w:val=\"22\"/><w:szCs w:val=\"22\"/><w:lang w:val=\"en-GB\"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after=\"160\" w:line=\"259\" w:lineRule=\"auto\"/></w:pPr></w:pPrDefault></w:docDefaults>`\n\n/**\n * Styles of a document that is a title and a table: `Title`, the compact `TagTableCell` paragraph\n * and the bordered `TagTableGrid` table.\n */\nexport const TABLE_DOCUMENT_STYLES = stylesXml(\n DOC_DEFAULTS,\n `<w:style w:type=\"paragraph\" w:default=\"1\" w:styleId=\"Normal\"><w:name w:val=\"Normal\"/><w:qFormat/></w:style><w:style w:type=\"paragraph\" w:styleId=\"Title\"><w:name w:val=\"Title\"/><w:basedOn w:val=\"Normal\"/><w:next w:val=\"Normal\"/><w:qFormat/><w:pPr><w:spacing w:after=\"80\" w:line=\"240\" w:lineRule=\"auto\"/></w:pPr><w:rPr><w:sz w:val=\"48\"/><w:szCs w:val=\"48\"/></w:rPr></w:style><w:style w:type=\"paragraph\" w:customStyle=\"1\" w:styleId=\"TagTableCell\"><w:name w:val=\"Tag Table Cell\"/><w:basedOn w:val=\"Normal\"/><w:qFormat/><w:pPr><w:spacing w:after=\"40\" w:line=\"240\" w:lineRule=\"auto\"/></w:pPr><w:rPr><w:sz w:val=\"18\"/><w:szCs w:val=\"18\"/></w:rPr></w:style><w:style w:type=\"table\" w:default=\"1\" w:styleId=\"TableNormal\"><w:name w:val=\"Normal Table\"/><w:tblPr><w:tblInd w:w=\"0\" w:type=\"dxa\"/><w:tblCellMar><w:top w:w=\"0\" w:type=\"dxa\"/><w:left w:w=\"108\" w:type=\"dxa\"/><w:bottom w:w=\"0\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr></w:style><w:style w:type=\"table\" w:customStyle=\"1\" w:styleId=\"TagTableGrid\"><w:name w:val=\"Tag Table\"/><w:basedOn w:val=\"TableNormal\"/><w:tblPr><w:tblBorders><w:top w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:left w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:bottom w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:right w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:insideH w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/><w:insideV w:val=\"single\" w:sz=\"4\" w:space=\"0\" w:color=\"BFBFBF\"/></w:tblBorders><w:tblCellMar><w:top w:w=\"60\" w:type=\"dxa\"/><w:left w:w=\"100\" w:type=\"dxa\"/><w:bottom w:w=\"60\" w:type=\"dxa\"/><w:right w:w=\"100\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr></w:style>`\n)\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/word/document.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/><Override PartName=\"/word/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"/><Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"word/document.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"docProps/core.xml\"/></Relationships>`\n\nconst DOCUMENT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\nconst coreXml = (\n title: string,\n at: string\n) => `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dc:title>${esc(\n title\n)}</dc:title><dcterms:created xsi:type=\"dcterms:W3CDTF\">${at}</dcterms:created><dcterms:modified xsi:type=\"dcterms:W3CDTF\">${at}</dcterms:modified></cp:coreProperties>`\n\n/** The minimal `.docx` package: a document, its styles, and its title and time. */\nexport function docxPackage(parts: {\n document: string\n styles: string\n title: string\n /** ISO time; default now. */\n at?: string\n}): Uint8Array {\n const at = new Date(parts.at ?? Date.now()).toISOString().replace(/\\.\\d{3}Z$/, 'Z')\n return zipSync({\n '[Content_Types].xml': strToU8(CONTENT_TYPES),\n '_rels/.rels': strToU8(ROOT_RELS),\n 'docProps/core.xml': strToU8(coreXml(parts.title, at)),\n 'word/document.xml': strToU8(parts.document),\n 'word/styles.xml': strToU8(parts.styles),\n 'word/_rels/document.xml.rels': strToU8(DOCUMENT_RELS),\n })\n}\n"]}