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AAKF,EAAM,KAC3DD,EAAYpH,KAAKsH,E,KACZ,CACL,MAAME,GAAO,IAAAnB,eAAc,OAAQ,CAAE7M,KAAK,KAAAyL,SAAUkC,EAAUtH,IAC9DuH,EAAYpH,KAAKwH,E,EAIrB,OAAOJ,CACT,CCtBO,MAAMK,GACXC,GACoD,mBAAPA,E,cCAxC,SAASC,GAAaC,EAAkBC,GAE7C,GAAIC,aAAaC,QAAQ,SAAUjC,QAAQkC,IAAI,QAASxN,KAAKyN,UAAUJ,EAAO,KAAM,QAC/E,CACH,MAAMK,EAAW,mBACXC,EAAO,IAAIC,KAAK,CAAC5N,KAAKyN,UAAUJ,IAAS,CAAExD,KAAM6D,KACvD,cAASC,EAAM,GAAGP,GAAY,SAAUM,E,CAE5C,CCVO,MAAMG,GAAa1O,GAAkB2O,gBAAgB3O,G,cCGrD,MAAM4O,GAAsBC,IAC/B,MAAOtN,KAAO0M,GAAYY,EAAanH,MAAM,KAC7C,MAAO,CAAEnG,KAAI0M,UAAU,KAAAa,QAAOb,EAASrG,KAAK,MAAO,EAG1CmH,GAAqB,CAACxN,EAAsB0M,IACrD,GAAG1M,MAAM,KAAAyN,QAAOf,K,kCCLb,MAAM,GAAW,CAAmBF,EAAsBkB,KAC/D,eAAUlB,EAAI,OAAF,QACVmB,UAAU,UAAC,GAAAC,KAAI,CAACC,SAAS,YACtBH,G","sources":["webpack://core/./components/Finder/Finder.styles.ts","webpack://core/./components/Finder/utils/define-tree-node-properties.ts","webpack://core/./components/Finder/utils/default-title-render.tsx","webpack://core/./components/Finder/utils/parse-paste-info.ts","webpack://core/./components/Finder/utils/finder-emitter.ts","webpack://core/./utils/create-hash-dataset.ts","webpack://core/./utils/env.ts","webpack://core/./utils/filter-option.ts","webpack://core/./utils/typed-object-methods.ts","webpack://core/./utils/name-of.ts","webpack://core/./utils/redirect.ts","webpack://core/./utils/documents-to-hash-objects.ts","webpack://core/./utils/get-options.ts","webpack://core/./utils/get-path-id.ts","webpack://core/./utils/loop.ts","webpack://core/./utils/set-path.ts","webpack://core/./utils/find-assignment-item.ts","webpack://core/./utils/create-list-to-tree.ts","webpack://core/./utils/create-document-list-to-tree.ts","webpack://core/./utils/get-color-hex.ts","webpack://core/./utils/date-format.ts","webpack://core/./utils/get-export-file-name.ts","webpack://core/./utils/promise-with-abort-controller.ts","webpack://core/./utils/for-each-tree.ts","webpack://core/./utils/format-value-with-precision.ts","webpack://core/./utils/array-move.ts","webpack://core/./utils/normalize-selected-ids.ts","webpack://core/./utils/get-document-order.ts","webpack://core/./utils/currency-tools.ts","webpack://core/./utils/timezone-tools.ts","webpack://core/./utils/is-uuid.ts","webpack://core/./utils/uuid.ts","webpack://core/./utils/clipboard-is-granted.ts","webpack://core/./utils/clipboard-read-paste-info.ts","webpack://core/./utils/element-to-string.ts","webpack://core/./utils/file-read-async.ts","webpack://core/./utils/parse-img.ts","webpack://core/./utils/is-type.ts","webpack://core/./utils/download-json.ts","webpack://core/./utils/deep-clone.ts","webpack://core/./utils/attachment-id.ts","webpack://core/./utils/loadable.tsx"],"sourcesContent":["import type { StyledComponent } from 'styled-components';\nimport styled from 'styled-components';\nimport type { TreeProps } from 'antd/lib/tree';\nimport { Tree, Empty } from '../ui';\nimport type { TreeNode } from './types';\n\nexport const StyledFinder: StyledComponent> = styled(Tree)`\n height: 100%;\n\n .ant-tree-list {\n height: 100%;\n\n .ant-tree-node-content-wrapper {\n .ant-tree-iconEle {\n width: auto;\n\n .ant-tag {\n margin-top: 2px;\n\n .anticon {\n margin-right: 2px;\n }\n }\n }\n }\n }\n\n .ant-tree-treenode-selected {\n background: var(--ant-primary-1);\n box-shadow: 0 1px 0 #cbe6ff, 0px -1px 0 #cbe6ff;\n }\n\n .ant-tree-node-content-wrapper.ant-tree-node-selected {\n background: transparent;\n }\n\n .ant-tree-node-content-wrapper:hover {\n background: transparent;\n }\n\n .ant-tree-treenode {\n padding: 0;\n transition: all 0.3s, border 0s, line-height 0s, box-shadow 0s;\n }\n\n .ant-tree-treenode:not(.ant-tree-treenode-selected):nth-child(odd) {\n background: #fafafa;\n }\n\n .ant-tree-treenode:hover:nth-child(odd),\n .ant-tree-treenode:hover {\n background: #fafafa;\n }\n\n .ant-tree-node-content-wrapper {\n display: flex;\n }\n\n .ant-tree-title {\n flex: auto;\n white-space: nowrap;\n width: 1px;\n .ant-tag.ant-tag-small {\n overflow: initial;\n text-overflow: unset;\n }\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .ant-tree-iconEle {\n flex: 0 0 20px;\n }\n\n .ant-dropdown-trigger {\n width: 100%;\n display: inline-block;\n }\n`;\n\nexport const StyledTitle = styled.span`\n display: flex;\n align-items: center;\n`;\n\nexport const StyledEmpty = styled(Empty)`\n height: 100%;\n`;\n","import type { BaseEntity } from '../../../base';\nimport type { TreeNode } from '../types';\n\nexport function defineTreeNodeProperties(\n advancedProperties: PropertyDescriptorMap & ThisType> = {},\n) {\n return (node: Partial>) => {\n Object.defineProperties(node, {\n isLeaf: {\n enumerable: true,\n get(this: TreeNode) {\n const { composite, meta } = this.docState.document;\n if (composite) return true;\n\n const { childrenIds } = meta;\n return !childrenIds || childrenIds.length === 0;\n },\n },\n\n key: {\n enumerable: true,\n get(this: TreeNode) {\n return this.docState.document._id;\n },\n },\n\n title: {\n enumerable: true,\n get() {\n return this.docState.document.data.title;\n },\n },\n\n getContextMenuItems: {\n enumerable: true,\n value(this: TreeNode) {\n return null;\n },\n },\n ...advancedProperties,\n });\n };\n}\n","import type { BaseEntity } from 'core/base';\nimport type { TreeNode } from '../types';\nimport { StyledTitle } from '../Finder.styles';\n\nexport const defaultTitleRender = (node: TreeNode) => {\n const { addonBefore, addonAfter, title, docState, hasError } = node;\n\n const _className = `w-100 ${hasError ? 'error' : ''}`;\n\n return (\n \n {addonBefore || null}\n\n {title}\n\n {addonAfter || null}\n \n );\n};\n","import type { BaseEntity } from 'core/base';\nimport type { PasteInfo } from '../types';\n\n/**\n * Returns tuple types that include every string in union\n * TupleUnion;\n * [\"bar\", \"leet\"] | [\"leet\", \"bar\"];\n */\ntype TupleUnion = {\n [S in U]: Exclude extends never ? [...R, S] : TupleUnion, [...R, S]>;\n}[U] &\n string[];\n\nconst KEYS: TupleUnion = ['documents', 'rootId', 'isExport', 'isCopy'];\n\nexport const parsePasteInfo = (\n str: string,\n): PasteInfo | null => {\n try {\n const info = JSON.parse(str);\n\n if (KEYS.every(key => Object.hasOwn(info, key))) {\n return info as PasteInfo;\n }\n\n return null;\n } catch {\n return null;\n }\n};\n","import mitt from 'mitt';\nimport type { FinderEmitterEvents } from '../types';\n\nconst finderEmitter = mitt();\n\nexport { finderEmitter };\n","// eslint-disable-next-line @typescript-eslint/no-empty-function\nexport const createHashDataset = (dataset: any[], callback: any | undefined = () => {}) =>\n dataset.reduce((tree: any, data: any) => {\n const { _id: id } = data;\n\n const values = callback(data);\n\n // eslint-disable-next-line no-param-reassign\n tree[id] = { id, ...values };\n\n return tree;\n }, {});\n","// Combine env vars passed by Gitlab Runner,\n// Docker etc during execution over build stage\n\nexport const env: Record = {\n API_URL: process.env.API_URL,\n NODE_ENV: process.env.NODE_ENV,\n ATTACHMENT_SERVICE_URI: process.env.ATTACHMENT_SERVICE_URI,\n PDF_SERVICE_URI: process.env.PDF_SERVICE_URI,\n FROALA_EDITOR_KEY: process.env.FROALA_EDITOR_KEY,\n DOCS_URL: process.env.DOCS_URL,\n CDN_SERVICE_HOST: process.env.CDN_SERVICE_HOST,\n LOG_URL: process.env.LOG_URL,\n METRICS_URL: process.env.METRICS_URL,\n FEATURE_FLAGS: process.env.FEATURE_FLAGS,\n // @ts-ignore\n ...(window.env ?? null),\n}; // Not secure way\n\nexport const isDev = process.env.NODE_ENV === 'development';\n\nexport const isProd = process.env.NODE_ENV === 'production';\n\nexport const isLocalURL = window.location.hostname === 'localhost';\n\nexport const isDevURL = window.location.hostname.includes('.dev.');\n\nexport const isStagingURL = window.location.hostname.includes('staging.');\n\nexport const isE2EURL = window.location.hostname.includes('web-e2e');\n","export const filterOption = (input: string, option: { label: string }) =>\n option.label.toLowerCase().includes(input.toLowerCase());\n","export function objectEntries>(obj: T) {\n return Object.entries(obj) as [K, T[K]][];\n}\n\nexport function objectKeys>(obj: T) {\n return Object.keys(obj) as K[];\n}\n\nexport function objectValues>(obj: T) {\n return Object.values(obj) as T[K][];\n}\n\nexport function objectFromEntries(arr: [T, K][]) {\n return Object.fromEntries(arr) as Record;\n}\n","type Cons = T extends readonly any[]\n ? ((h: H, ...t: T) => void) extends (...r: infer R) => void\n ? R\n : never\n : never;\n\ntype Prev = [\n never,\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n ...0[]\n];\n\ntype Paths = [D] extends [never]\n ? never\n : T extends object\n ? {\n [K in Exclude]-?:\n | [K]\n | (Paths extends infer P ? (P extends [] ? never : Cons) : never);\n }[Exclude]\n : [];\n\nexport type Leaves = [D] extends [never]\n ? never\n : T extends object\n ? { [K in keyof T]-?: Cons> }[keyof T]\n : [];\n\n// type PathArg = T extends string[] ? Paths : keyof D;\n\n// TODO: path should accept string and string array\nexport const nameof = (path: Paths) => path;\n","import { navigateToUrl } from 'single-spa';\n\nexport const redirect = (path: string): void => navigateToUrl(`/${path}`.replace('//', '/'));\n","import keyBy from 'lodash/keyBy';\n/**\n * @deprecated Use keyBy directly\n * @param array\n * @returns\n */\nexport const documentsToHashObject = (array: unknown[]) => keyBy(array, '_id');\n","import isString from 'lodash/isString';\n\nconst getReversedArray = (isReversed: boolean, item: [string | number, string | number]) =>\n isReversed ? [item[0], item[1]] : [item[1], item[0]];\n\nexport const getOptions = (\n entries: [string | number, string | number][] | string[],\n isReversed: boolean = false,\n transformLabel = (l: string): string => l,\n) => {\n return entries.map(item => {\n if (isString(item)) {\n return { value: item, label: transformLabel(item.toString()) };\n }\n\n const [label, value] = getReversedArray(isReversed, item);\n\n return { value, label: transformLabel(label.toString()) };\n });\n};\n\nexport type ReturnOptionsType = (\n | { label: string; value: string }\n | { label: string; value: string | number }\n)[];\n","export const getPathId = (location: any) => location.pathname.slice(1).replace('#/', '');\n","const loop = (array: any[], key: string, callback: (item: any) => void, field = 'key') => {\n let index = 0;\n\n while (array[index]) {\n const item = array[index];\n\n if (item[field] === key) {\n callback({ item, index, array });\n\n return;\n }\n\n if (item.children && item.children.length) {\n loop(item.children, key, callback, field);\n }\n\n index++;\n }\n};\n\nexport { loop };\n","export const setPath = (navigate: any, id: any) => navigate(`/${id}`); // TODO: avoid using this helper\n","export const findAssigmentItem = (items: any, id: string) =>\n items.find(({ refId }: any) => refId === id);\n","import type { BaseEntity } from '../base';\nimport type { DocumentId, Dictionary } from '../types';\n\ntype Node = { [x in TKey]?: Node[] } & { parentNode?: Node };\n\ntype Options = {\n nestedKey: TKey;\n connectParentNode?: boolean;\n lazy?: boolean;\n};\n\nexport interface ListToTree<\n TList extends Dictionary,\n TKey extends string,\n TNode extends Node,\n> {\n (rootIds: DocumentId[], list: TList): TNode[];\n}\n\nexport const createListToTree = <\n TDoc extends BaseEntity,\n TList extends Dictionary,\n TKey extends string,\n TNode extends Node,\n>(\n createNode: (item: TList[keyof TList & string]) => TNode | void,\n getDocument: (item: TList[keyof TList & string]) => TDoc | void,\n options: Options,\n): ListToTree => {\n const { connectParentNode = true, nestedKey, lazy = true }: Options = options;\n\n return (rootIds: DocumentId[], list: TList) => {\n function createNodesTree(id: keyof TList & string) {\n const item = list[id];\n const document = getDocument(item);\n const node = createNode(item);\n\n if (!document || !node) return;\n\n const { childrenIds } = document.meta;\n if (childrenIds && childrenIds.length > 0 && !document.composite) {\n let children: TNode[] | undefined;\n\n let i = 0;\n while (i < childrenIds.length) {\n const childNode = createNodesTree(childrenIds[i++]);\n if (childNode) {\n if (connectParentNode) {\n childNode.parentNode = node;\n }\n\n children ??= [];\n children.push(childNode);\n }\n }\n\n // If there are no children, parent doesn't need to be created as well.\n if (children || lazy) {\n return {\n ...node,\n [nestedKey]: children,\n };\n }\n } else {\n return node;\n }\n }\n\n return rootIds.map(id => createNodesTree(id)).filter((node): node is TNode => !!node);\n };\n};\n","import type { BaseEntity } from '../base';\nimport type { TreeNode } from '../components';\nimport type { DocumentState } from '../store';\nimport type { DocumentId, Dictionary } from '../types';\n\ntype Options = {\n nestedKey: TKey;\n connectParentNode?: boolean;\n lazy?: boolean;\n};\n\nexport interface DocumentListToTree<\n TDoc extends BaseEntity,\n TList extends Dictionary,\n TNode extends TreeNode,\n> {\n (rootIds: DocumentId[], list: TList): TNode[];\n}\n\nexport const createDocumentListToTree = <\n TDoc extends BaseEntity,\n TList extends Dictionary,\n TKey extends string,\n TNode extends TreeNode,\n>(\n createNode: (item: TList[keyof TList & string]) => TNode | void,\n getDocument: (item: TList[keyof TList & string]) => TDoc | void,\n options: Options,\n): DocumentListToTree => {\n const { connectParentNode = true, nestedKey, lazy = true }: Options = options;\n\n return (rootIds: DocumentId[], list: TList) => {\n function createNodesTree(id: keyof TList & string) {\n const item = list[id];\n const document = getDocument(item);\n const node = createNode(item);\n\n if (!document || !node || !item) return;\n\n const { childrenIds } = document.meta;\n\n let hasError = !!item.errors?.length;\n\n if (childrenIds && childrenIds.length > 0 && !document.composite) {\n let children: TNode[] | undefined;\n\n let i = 0;\n while (i < childrenIds.length) {\n const childNode = createNodesTree(childrenIds[i++]);\n\n hasError ||= !!childNode?.hasError;\n\n if (childNode) {\n if (connectParentNode) {\n childNode.parentNode = node;\n }\n\n children ??= [];\n children.push(childNode);\n }\n }\n\n // If there are no children, parent doesn't need to be created as well.\n if (children || lazy) {\n return {\n ...node,\n hasError,\n [nestedKey]: children,\n };\n }\n } else {\n node.hasError = hasError;\n return node;\n }\n }\n\n return rootIds.map(id => createNodesTree(id)).filter((node): node is TNode => !!node);\n };\n};\n","import type { ColorsPalette } from '../components/ui/Design';\nimport { colors } from '../components/ui/Design';\nimport type { HEX } from '../types';\n\nexport const STYLE_CODE = 5;\n\nexport const getColorHex = (colorName: ColorsPalette, colorCode?: number): HEX => {\n const color = colors[colorName];\n\n if (colorCode === undefined) {\n return color.primary as HEX;\n }\n\n return color[colorCode] as HEX;\n};\n","export const dateFormat = (date = new Date()) => {\n const year = new Intl.DateTimeFormat('default', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n })\n .format(date)\n .split('/')\n .reverse()\n .join('-');\n\n const time = new Intl.DateTimeFormat('default', {\n hour: '2-digit',\n minute: '2-digit',\n }).format(date);\n\n // YYYY-MM-DD HH:mm\n return `${year} ${time}`;\n};\n","import kebabCase from 'lodash/kebabCase';\nimport { dateFormat } from './date-format';\n\nexport const getExportFileName = (...args: any) => {\n const name = [...args, dateFormat()].join('-');\n\n return kebabCase(name);\n};\n","type PromisePrune = T extends Promise ? Awaited : T;\n\nexport function promiseWithAbortCtrl(promiseOrData: F, signal: AbortSignal) {\n return Promise.resolve(promiseOrData).then(data => {\n signal.throwIfAborted();\n\n return data as PromisePrune;\n });\n}\n","export const forEachTree = (\n array: T[],\n callback: (item: T, level: number, index: number) => void,\n nestedKey = 'children',\n) => {\n const iterate = (arr: T[], level = 0) => {\n let i = 0;\n const { length } = arr;\n\n while (i < length) {\n const item = arr[i];\n const children = item[nestedKey];\n\n callback(item, level, i);\n\n if (children?.length > 0) {\n iterate(children, level + 1);\n }\n\n i++;\n }\n };\n\n iterate(array);\n};\n","export const formatValueWithPrecision = (\n num: number | string,\n precision = 2,\n local = 'en-US',\n): string =>\n new Intl.NumberFormat(local, {\n useGrouping: true,\n minimumFractionDigits: precision,\n maximumFractionDigits: precision,\n })\n .format(+num)\n .replace(/,/g, ' ');\n","export function arrayMoveMutable(array: unknown[], fromIndex: number, toIndex: number) {\n const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;\n\n if (startIndex >= 0 && startIndex < array.length) {\n const endIndex = toIndex < 0 ? array.length + toIndex : toIndex;\n\n const [item] = array.splice(fromIndex, 1);\n array.splice(endIndex, 0, item);\n }\n}\n\nexport function arrayMoveImmutable(\n array: readonly ValueType[],\n fromIndex: number,\n toIndex: number,\n): ValueType[] {\n const newArray = [...array];\n arrayMoveMutable(newArray, fromIndex, toIndex);\n return newArray;\n}\n","import type { DocumentId } from '../types';\nimport type { BaseEntity } from '../base';\n\nexport const normalizeSelectedIds = (doc: BaseEntity, ids?: DocumentId[]) => {\n if (ids && ids.includes(doc._id)) {\n return ids;\n }\n\n return [doc._id];\n};\n","import type { BaseEntity } from '../base';\n\nexport const getDocumentOrder = (document: BaseEntity, parentDocument: BaseEntity) => {\n const { childrenIds } = parentDocument.meta;\n\n return childrenIds ? childrenIds.indexOf(document._id) : -1;\n};\n","export const getCurrencySymbol = (code: string, local = window.navigator.language): string => {\n try {\n const formatter = new Intl.NumberFormat(local, {\n style: 'currency',\n currency: code,\n });\n const parts = formatter.formatToParts(0);\n const symbolPart = parts.find(({ type }) => type === 'currency');\n\n return symbolPart?.value || '';\n } catch {\n return '';\n }\n};\n\nexport const getCurrencyName = (code: string, local = window.navigator.language) => {\n const displayNames = new Intl.DisplayNames([local], { type: 'currency' });\n return displayNames.of(code) || '';\n};\n\n// TODO: need to remove ts-ignore when we will update Typescript to 5.1 and fix type for it\nconst getAllCurrency = (): string[] => {\n // @ts-ignore\n if (typeof Intl.supportedValuesOf !== 'undefined') {\n // @ts-expect-error TS2339: Property 'supportedValuesOf' does not exist on type 'typeof Intl'.\n return Intl.supportedValuesOf('currency');\n }\n\n return [];\n};\n\nexport const getFormattedCurrencyList = () =>\n getAllCurrency().map(currency => ({\n label: `${currency} (${getCurrencySymbol(currency)}) - ${getCurrencyName(currency)}`,\n value: currency,\n }));\n","export const getTimeZoneList = () => {\n // @ts-expect-error TS2339: Property 'supportedValuesOf' does not exist on type 'typeof Intl'.\n if (Intl.supportedValuesOf) return Intl.supportedValuesOf('timeZone');\n\n throw new Error(\"Property 'supportedValuesOf' does not exist on type 'typeof Intl'\");\n};\n\nexport const getTimeZones = () => {\n const timezones = getTimeZoneList();\n\n return timezones.map((val: string) => ({\n label: `${val}`,\n value: val,\n }));\n};\n","import { isUUID as isUuid } from 'class-validator';\nimport type { UUIDVersion } from 'class-validator';\nimport type { UUID } from 'short-uuid';\n\nexport const isUUID = (str: unknown, ver: UUIDVersion = 4): str is UUID => isUuid(str, ver);\n","const SPLITTER = '-' as const;\n\ntype SP = typeof SPLITTER;\n\nexport type UUUIDVersion = 1 | 2 | 3 | 4 | 5;\n\nexport type UUID = Ver extends 1\n ? string & { _uuidV1: true }\n : Ver extends 2\n ? `${string}${SP}${string}` & { _uuidV2: true }\n : Ver extends 3\n ? `${string}${SP}${string}${SP}${string}` & { _uuidV3: true }\n : Ver extends 4\n ? `${string}${SP}${string}${SP}${string}${SP}${string}` & { _uuidV4: true }\n : Ver extends 5\n ? `${string}${SP}${string}${SP}${string}${SP}${string}${SP}${string}` & { _uuidV5: true }\n : never;\n\nexport const uuid = (ver = 5 as Ver) => {\n if (ver > 5 || ver < 1) {\n throw new Error('Version range is not supported');\n }\n\n const id = crypto.randomUUID();\n\n return id.split(SPLITTER).slice(0, ver).join(SPLITTER) as UUID;\n};\n","export const clipboardIsGranted = async () => {\n const responses = await Promise.all([\n navigator.permissions.query({\n // @ts-ignore\n name: 'clipboard-write',\n }),\n navigator.permissions.query({\n // @ts-ignore\n name: 'clipboard-read',\n }),\n ]);\n\n return responses.every(({ state }) => state !== 'denied');\n};\n","import type { BaseEntity } from 'core/base';\nimport { parsePasteInfo } from '../components/Finder/utils';\n\nexport const clipboardReadPasteInfo = () => {\n const { clipboard } = navigator;\n\n return (\n clipboard\n .readText()\n .then((text: string) => parsePasteInfo(text))\n // eslint-disable-next-line no-console\n .catch(console.error)\n ); // ignore error\n};\n","import { renderToString } from 'react-dom/server';\nimport type { ComponentClass, FunctionComponent, PropsWithChildren, ReactElement } from 'react';\nimport { createElement, isValidElement } from 'react';\n\nfunction elementToString(el: ReactElement): string;\nfunction elementToString

>(\n el: FunctionComponent

| ComponentClass

,\n props?: P,\n): string;\nfunction elementToString

>(\n el: FunctionComponent

| ComponentClass

| ReactElement,\n props?: P,\n) {\n if (isValidElement(el)) {\n return renderToString(el);\n }\n\n return renderToString(createElement(el, props));\n}\n\nexport { elementToString };\n","export const fileReadAsync = (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = (event) => {\n resolve(event.target?.result);\n };\n\n reader.onerror = () => {\n reject(new Error('Error reading file.'));\n };\n\n reader.readAsArrayBuffer(file);\n });\n};","import { createElement } from \"react\";\nimport { uuid } from \"short-uuid\";\n \nexport function parseImg(text: string): JSX.Element[] {\n const imgRegex = /(?=]+>)|(?<=]+>)/g;\n const srcRegex = /src=['\"]([^'\"]+)['\"]/i;\n const splitText = text.split(imgRegex);\n const parsedItems: JSX.Element[] = [];\n\n for (let i = 0; i < splitText.length; i++) {\n const match = splitText[i].match(srcRegex);\n\n if (match) {\n const img = createElement('img', { key: uuid(), src: match[1] });\n parsedItems.push(img);\n } else {\n const span = createElement('span', { key: uuid() }, splitText[i]);\n parsedItems.push(span);\n }\n }\n\n return parsedItems;\n}","export const isFunction = (\n fn: unknown,\n): fn is (...args: TArgs) => TReturn => typeof fn === 'function';\n","import download from 'downloadjs';\n\nexport function downloadJson(fileName: string, model: unknown) {\n // eslint-disable-next-line no-console\n if (localStorage.getItem('debug')) console.log('model', JSON.stringify(model, null, 2));\n else {\n const mimeType = 'application/json';\n const blob = new Blob([JSON.stringify(model)], { type: mimeType });\n download(blob, `${fileName || 'none'}`, mimeType);\n }\n}\n","export const deepClone = (data: unknown) => structuredClone(data);\n","import { encode, decode } from 'js-base64';\nimport type { Attachment, AttachmentId } from \"../types\"\n\nexport const decodeAttachmentId = (attachmentId: AttachmentId): Attachment => {\n const [id, ...fileName] = attachmentId.split('_') as [Attachment[\"id\"], Attachment[\"fileName\"]];\n return { id, fileName: decode(fileName.join('_')) };\n}\n\nexport const encodeAttachmentId = (id: Attachment[\"id\"], fileName: Attachment[\"fileName\"]): AttachmentId => \n `${id}_${encode(fileName)}`","import type { SuspenseProps } from 'react';\nimport { loadable as _loadable } from 'react-lazily/loadable';\nimport { Spin } from '../components/ui';\n\nexport const loadable = (fn: () => Promise, opts?: Partial) =>\n _loadable(fn, {\n fallback: ,\n ...opts,\n });\n"],"names":["StyledFinder","Tree","StyledTitle","StyledEmpty","Empty","defineTreeNodeProperties","advancedProperties","node","Object","defineProperties","isLeaf","enumerable","get","composite","meta","this","docState","document","childrenIds","length","key","_id","title","data","getContextMenuItems","value","defaultTitleRender","addonBefore","addonAfter","hasError","_className","className","KEYS","parsePasteInfo","str","info","JSON","parse","every","hasOwn","finderEmitter","createHashDataset","dataset","callback","reduce","tree","id","values","env","API_URL","NODE_ENV","ATTACHMENT_SERVICE_URI","PDF_SERVICE_URI","FROALA_EDITOR_KEY","DOCS_URL","CDN_SERVICE_HOST","LOG_URL","METRICS_URL","FEATURE_FLAGS","window","isDev","isProd","isLocalURL","location","hostname","isDevURL","includes","isStagingURL","isE2EURL","filterOption","input","option","label","toLowerCase","objectEntries","obj","entries","objectKeys","keys","objectValues","objectFromEntries","arr","fromEntries","nameof","path","redirect","navigateToUrl","replace","documentsToHashObject","array","getOptions","isReversed","transformLabel","l","map","item","toString","getReversedArray","getPathId","pathname","slice","loop","field","index","children","setPath","navigate","findAssigmentItem","items","find","refId","createListToTree","createNode","getDocument","options","connectParentNode","nestedKey","lazy","rootIds","list","createNodesTree","i","childNode","parentNode","push","filter","createDocumentListToTree","errors","STYLE_CODE","getColorHex","colorName","colorCode","color","colors","undefined","primary","dateFormat","date","Date","Intl","DateTimeFormat","year","month","day","format","split","reverse","join","hour","minute","getExportFileName","args","name","promiseWithAbortCtrl","promiseOrData","signal","Promise","resolve","then","throwIfAborted","forEachTree","iterate","level","formatValueWithPrecision","num","precision","local","NumberFormat","useGrouping","minimumFractionDigits","maximumFractionDigits","arrayMoveMutable","fromIndex","toIndex","startIndex","endIndex","splice","arrayMoveImmutable","newArray","normalizeSelectedIds","doc","ids","getDocumentOrder","parentDocument","indexOf","getCurrencySymbol","code","navigator","language","symbolPart","style","currency","formatToParts","type","getCurrencyName","DisplayNames","of","getFormattedCurrencyList","supportedValuesOf","getTimeZoneList","Error","getTimeZones","val","isUUID","ver","uuid","crypto","randomUUID","clipboardIsGranted","all","permissions","query","state","clipboardReadPasteInfo","clipboard","readText","text","catch","console","error","elementToString","el","props","isValidElement","renderToString","createElement","fileReadAsync","file","reject","reader","FileReader","onload","event","target","result","onerror","readAsArrayBuffer","parseImg","srcRegex","splitText","parsedItems","match","img","src","span","isFunction","fn","downloadJson","fileName","model","localStorage","getItem","log","stringify","mimeType","blob","Blob","deepClone","structuredClone","decodeAttachmentId","attachmentId","decode","encodeAttachmentId","encode","opts","fallback","Spin","position"],"sourceRoot":""}