File size: 4,302 Bytes
2517be1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /**
* Unified exports for all utility functions
* Import utilities from '$lib/utils' for cleaner imports
*
* For browser-only utilities (pdf-processing, audio-recording, svg-to-png,
* webp-to-png, process-uploaded-files, convert-files-to-extra), use:
* import { ... } from '$lib/utils/browser-only'
*/
// API utilities
export { getAuthHeaders, getJsonHeaders } from './api-headers';
export { apiFetch, apiFetchWithParams, apiPost, type ApiFetchOptions } from './api-fetch';
export { validateApiKey } from './api-key-validation';
// Attachment utilities
export { getAttachmentDisplayItems } from './attachment-display';
export { isTextFile, isImageFile, isPdfFile, isAudioFile } from './attachment-type';
// Textarea utilities
export { default as autoResizeTextarea } from './autoresize-textarea';
// Branching utilities
export {
filterByLeafNodeId,
findLeafNode,
findDescendantMessages,
getMessageSiblings,
getMessageDisplayList,
hasMessageSiblings,
getNextSibling,
getPreviousSibling
} from './branching';
// Code
export { highlightCode, detectIncompleteCodeBlock, type IncompleteCodeBlock } from './code';
// Config helpers
export { setConfigValue, getConfigValue, configToParameterRecord } from './config-helpers';
// CORS Proxy
export { buildProxiedUrl, getProxiedUrlString } from './cors-proxy';
// Conversation utilities
export { createMessageCountMap, getMessageCount } from './conversation-utils';
// Clipboard utilities
export {
copyToClipboard,
copyCodeToClipboard,
formatMessageForClipboard,
parseClipboardContent,
hasClipboardAttachments
} from './clipboard';
// File preview utilities
export { getFileTypeLabel } from './file-preview';
export { getPreviewText } from './text';
// File type utilities
export {
getFileTypeCategory,
getFileTypeCategoryByExtension,
getFileTypeByExtension,
isFileTypeSupported
} from './file-type';
// Formatting utilities
export {
formatFileSize,
formatParameters,
formatNumber,
formatJsonPretty,
formatTime,
formatPerformanceTime,
formatAttachmentText
} from './formatters';
// IME utilities
export { isIMEComposing } from './is-ime-composing';
// LaTeX utilities
export { maskInlineLaTeX, preprocessLaTeX } from './latex-protection';
// Modality file validation utilities
export {
isFileTypeSupportedByModel,
filterFilesByModalities,
generateModalityErrorMessage
} from './modality-file-validation';
// Model name utilities
export { normalizeModelName, isValidModelName } from './model-names';
// Portal utilities
export { portalToBody } from './portal-to-body';
// Precision utilities
export { normalizeFloatingPoint, normalizeNumber } from './precision';
// Syntax highlighting utilities
export { getLanguageFromFilename } from './syntax-highlight-language';
// Text file utilities
export { isTextFileByName, readFileAsText, isLikelyTextFile } from './text-files';
// Debounce utilities
export { debounce } from './debounce';
// Sanitization utilities
export { sanitizeKeyValuePairKey, sanitizeKeyValuePairValue } from './sanitize';
// Image error fallback utilities
export { getImageErrorFallbackHtml } from './image-error-fallback';
// MCP utilities
export {
detectMcpTransportFromUrl,
parseMcpServerSettings,
getMcpLogLevelIcon,
getMcpLogLevelClass,
isImageMimeType,
parseResourcePath,
getDisplayName,
getResourceDisplayName,
isCodeResource,
isImageResource,
getResourceIcon,
getResourceTextContent,
getResourceBlobContent,
downloadResourceContent
} from './mcp';
// URI Template utilities
export {
extractTemplateVariables,
expandTemplate,
isTemplateComplete,
normalizeResourceUri,
type UriTemplateVariable
} from './uri-template';
// Data URL utilities
export { createBase64DataUrl } from './data-url';
// Header utilities
export { parseHeadersToArray, serializeHeaders } from './headers';
// Favicon utilities
export { getFaviconUrl } from './favicon';
// Agentic content parsing utilities
export { parseAgenticContent, type AgenticSection } from './agentic';
// Cache utilities
export { TTLCache, ReactiveTTLMap, type TTLCacheOptions } from './cache-ttl';
// Abort signal utilities
export {
throwIfAborted,
isAbortError,
createLinkedController,
createTimeoutSignal,
withAbortSignal
} from './abort';
// Cryptography utilities
export { uuid } from './uuid';
|