{
  "version": 3,
  "sources": ["../../card/new_elm.tsx", "../../card/card.tsx", "../../card/card_chrome.tsx", "../../comments/comments.tsx", "../../comments/comment.tsx", "../../../lib.web.utils/decorate_urls.ts", "../../comments/comment_menu.tsx", "../../card/card_menu.tsx", "../../card/task.tsx", "../../card/file_card.tsx", "../../card/image_file_card.tsx", "../../card/note_card.tsx", "../../../lib.web.rich_text_editor/toggle_checklist_item.ts", "../../card/error_card.tsx"],
  "sourcesContent": ["import * as React from \"react\"\nimport {Icon, IconButton} from \"@cling/lib.web.mdc\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {Board, Card, Note} from \"@cling/lib.shared.model\"\nimport {observer} from \"mobx-react\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {BoardContext} from \"../board_context\"\nimport {useCardPermission} from \"../state/permission_hooks\"\nimport model_actions from \"../state/model_actions\"\nimport {show_snackbar_if_board_size_soft_limit_is_exceeded} from \"../state/patch\"\nimport {with_shortcut} from \"../utils\"\n\nexport const NewElmFAB = observer(() => {\n    const {\n        current_board: {board, display_version},\n    } = React.useContext(BoardContext)\n    const on_click_on_add = React.useCallback(() => {\n        if (board && show_snackbar_if_board_size_soft_limit_is_exceeded(board.uid)) {\n            return\n        }\n        const add_immediately_pos = should_add_immediately(board)\n        if (board && add_immediately_pos) {\n            // Shortcut: The board is empty, add a card directly.\n            const card_uid = model_actions.add_card_locally(board, add_immediately_pos, {\n                note: new Note({}),\n            })\n            if (card_uid !== \"quota_exceeded\") {\n                ui_actions.start_editing_card(board.uid, card_uid)\n            }\n            return\n        }\n        ui_actions.start_adding_pasting_new_card(\"add\")\n    }, [board])\n    const on_click_on_paste = React.useCallback(() => {\n        if (board && show_snackbar_if_board_size_soft_limit_is_exceeded(board.uid)) {\n            return\n        }\n        const add_immediately_pos = should_add_immediately(board)\n        if (board && add_immediately_pos) {\n            // Shortcut: The board is empty, paste a card directly.\n            model_actions.paste_card(board, add_immediately_pos)\n            return\n        }\n        ui_actions.start_adding_pasting_new_card(\"paste\")\n    }, [board])\n    const on_cancel = React.useCallback(() => {\n        ui_actions.stop_adding_pasting_new_card()\n    }, [])\n    React.useEffect(() => {\n        const on_keydown = (event: KeyboardEvent) => {\n            if (!ui_state.let_user_select_where_to_add_a_card || event.key !== \"Escape\") {\n                return\n            }\n            event.stopPropagation()\n            event.preventDefault()\n            ui_actions.stop_adding_pasting_new_card()\n        }\n        document.addEventListener(\"keydown\", on_keydown)\n        return () => document.removeEventListener(\"keydown\", on_keydown)\n    }, [])\n    if (ui_state.is_card_editor_open || ui_state.search_state.all_boards) {\n        return null\n    }\n    if (display_version !== \"latest\") {\n        return null\n    }\n    const permissions = useCardPermission(board?.root)\n    if (!permissions.can_add_card) {\n        return null\n    }\n    return (\n        <div\n            className={classNames(\"new-elm-fab\", {\n                \"new-elm-fab--shown\": ui_state.app_bar_shown,\n                \"new-elm-fab--hidden\": !ui_state.app_bar_shown,\n                \"new-elm-fab--with-toast\": ui_state.toast_shown,\n            })}\n            data-test-id=\"NewElmFAB\"\n        >\n            <div\n                className={classNames(\"new-elm-fab__help\", {\n                    \"new-elm-fab__help--hidden\": !ui_state.let_user_select_where_to_add_a_card,\n                    \"new-elm-fab__help--shown\": !!ui_state.let_user_select_where_to_add_a_card,\n                })}\n            >\n                <div>\n                    {ui_state.let_user_select_where_to_add_a_card === \"add\" &&\n                        i18n.click_x_to_add_a_card(\n                            <Icon small icon=\"add\" className=\"new-elm-fab-mini__button\" />,\n                        )}\n                    {ui_state.let_user_select_where_to_add_a_card === \"paste\" &&\n                        i18n.click_x_to_paste_a_card(\n                            <Icon\n                                small\n                                icon=\"content_paste\"\n                                className=\"new-elm-fab-mini__button\"\n                            />,\n                        )}\n                </div>\n            </div>\n            <IconButton\n                className={classNames(\"new-elm-fab__button--paste\", {\n                    \"new-elm-fab__button--paste-hidden\":\n                        !!ui_state.let_user_select_where_to_add_a_card,\n                    \"new-elm-fab__button--paste-shown\":\n                        !ui_state.let_user_select_where_to_add_a_card,\n                })}\n                disabled={ui_state.paste_disabled(permissions)}\n                small\n                onClick={on_click_on_paste}\n                icon=\"content_paste\"\n                tooltip={with_shortcut(i18n.paste, \"v\")}\n                data-test-id=\"NewElmFAB_paste\"\n            />\n            <IconButton\n                className={\n                    ui_state.let_user_select_where_to_add_a_card\n                        ? \"new-elm-fab__button--cancel\"\n                        : \"new-elm-fab__button--add\"\n                }\n                data-test-id=\"NewElmFAB_add\"\n                onClick={ui_state.let_user_select_where_to_add_a_card ? on_cancel : on_click_on_add}\n                icon={ui_state.let_user_select_where_to_add_a_card ? \"close\" : \"add\"}\n                tooltip={with_shortcut(i18n.add_a_card, \"a\")}\n            />\n        </div>\n    )\n})\n\nfunction should_add_immediately(board?: Board) {\n    if (!board) {\n        return\n    }\n    // TODO (new_elm): Test that thouroughly.\n    const visible_columns = [...board.columns].filter((x) =>\n        ui_state.search_state.has_visible_children(x),\n    )\n    if (visible_columns.every((x) => x.inbox)) {\n        const is_inbox_visible = ui_state.layout_state.first_visible_column_index === 0\n        if (!is_inbox_visible || !ui_state.search_state.has_visible_children(board.inbox)) {\n            return {\n                target_card_uid: is_inbox_visible ? board.inbox.uid : board.root.uid,\n                target_pos: 1,\n            }\n        }\n    }\n}\n\nexport const NewElmMiniFAB = ({card, pos}: {card: Card; pos?: \"append_to_column\" | \"after\"}) => {\n    const {\n        current_board: {board},\n    } = React.useContext(BoardContext)\n    const on_add = React.useCallback(() => {\n        ui_actions.stop_adding_pasting_new_card()\n        if (!board) {\n            return\n        }\n        if (show_snackbar_if_board_size_soft_limit_is_exceeded(board.uid)) {\n            return\n        }\n        const card_uid = model_actions.add_card_locally(\n            board,\n            pos === \"append_to_column\"\n                ? {target_card_uid: card.uid, target_pos: 424242424242}\n                : pos === \"after\"\n                  ? {target_card_uid: card.parent.uid, target_pos: card.parent_pos + 1}\n                  : {target_card_uid: card.parent.uid, target_pos: card.parent_pos},\n            {note: new Note({})},\n        )\n        if (card_uid !== \"quota_exceeded\") {\n            ui_actions.start_editing_card(board.uid, card_uid)\n        }\n    }, [board, card, pos])\n    const on_paste = React.useCallback(() => {\n        ui_actions.stop_adding_pasting_new_card()\n        if (!board) {\n            return\n        }\n        if (show_snackbar_if_board_size_soft_limit_is_exceeded(board.uid)) {\n            return\n        }\n        model_actions.paste_card(\n            board,\n            pos === \"append_to_column\"\n                ? {target_card_uid: card.uid, target_pos: 424242424242}\n                : pos === \"after\"\n                  ? {target_card_uid: card.parent.uid, target_pos: card.parent_pos + 1}\n                  : {target_card_uid: card.parent.uid, target_pos: card.parent_pos},\n        )\n    }, [board, card, pos])\n    const is_adding = ui_state.let_user_select_where_to_add_a_card === \"add\"\n    return (\n        <div className=\"new-elm-fab-mini\" data-test-id=\"NewElmMiniFAB\">\n            <IconButton\n                className=\"new-elm-fab-mini__button\"\n                small\n                onClick={is_adding ? on_add : on_paste}\n                icon={is_adding ? \"add\" : \"content_paste\"}\n                tooltip={is_adding ? i18n.add_a_card : i18n.paste_from_clipboard}\n                data-test-id=\"NewElmMiniFAB_button\"\n            />\n        </div>\n    )\n}\n", "import * as React from \"react\"\nimport {runInAction} from \"mobx\"\nimport {observer} from \"mobx-react\"\nimport {\n    Card as CardModel,\n    CardUID,\n    FileCard as FileCardModel,\n    LinkCard as LinkCardModel,\n    NoteCard as NoteCardModel,\n    Note,\n    Link,\n    File,\n    Inbox,\n    Column,\n    Root,\n} from \"@cling/lib.shared.model\"\nimport {ui_state} from \"../state/index\"\nimport {CardChrome} from \"./card_chrome\"\nimport {FileCard, FileCard_estimated_height} from \"./file_card\"\nimport {LinkCard, LinkCard_estimated_height} from \"./link_card\"\nimport {NoteCard, NoteCard_estimated_height} from \"./note_card\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {profiler} from \"../profiler\"\nimport {ErrorCard} from \"./error_card\"\nimport {error_to_string, assert_never} from \"@cling/lib.shared.utils\"\nimport {sha256} from \"@cling/lib.shared.crypto\"\nimport {Buffer} from \"buffer\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport type {CardPermissions} from \"@cling/lib.web.resources\"\nimport {useCardPermission} from \"../state/permission_hooks\"\nimport {scraped_by_search_bot} from \"@cling/lib.web.utils\"\nimport {React_lazy, React_suspense} from \"@cling/lib.web.lazy_load/suspense\"\nconst CardChromeEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/card_chrome_editor\"),\n    \"eager_load\",\n)\nconst FileCardEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/file_card_editor\"),\n    \"eager_load\",\n)\nconst LinkCardEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/link_card_editor\"),\n    \"eager_load\",\n)\nconst NoteCardEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/note_card_editor\"),\n    \"eager_load\",\n)\nconst TitleImageEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/title_image_editor\"),\n    \"eager_load\",\n)\nconst UserMediaEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/client.web_app/card/user_media_editor\"),\n    \"eager_load\",\n)\n\ninterface Props {\n    card: CardModel\n    /**\n     * If given, the `Card` is the \"ghost\", which is only visible during drag & drop.\n     */\n    dnd_ghost_ref?: (ref: ReactRef<HTMLDivElement>) => void\n    force_card_level?: number // Override `card_level(card)`\n}\n\ninterface CommonCardProps {\n    permissions: CardPermissions\n    visible_children: ReadonlyArray<CardModel>\n}\n\ntype NoteCardProps = Props & CommonCardProps & {card: NoteCardModel}\ntype LinkCardProps = Props & CommonCardProps & {card: LinkCardModel}\ntype FileCardProps = Props & CommonCardProps & {card: FileCardModel}\n\nlet intersection_observer: IntersectionObserver\nif (window.IntersectionObserver && !scraped_by_search_bot()) {\n    intersection_observer = new IntersectionObserver((entries: IntersectionObserverEntry[]) => {\n        for (const entry of entries) {\n            // Note: We don't use the `isIntersecting` property alone here,\n            //       because some older browsers do not support it.\n            //       (see https://caniuse.com/#search=IntersectionObserver)\n            if (entry.isIntersecting || entry.intersectionRatio > 0) {\n                runInAction(() => {\n                    ui_state.fully_rendered_cards.set(\n                        entry.target.getAttribute(\"data-card-uid\") as CardUID,\n                        true,\n                    )\n                })\n                intersection_observer.unobserve(entry.target)\n            }\n        }\n    })\n} else {\n    intersection_observer = {\n        observe(elm: HTMLElement) {\n            runInAction(() => {\n                ui_state.fully_rendered_cards.set(\n                    elm.getAttribute(\"data-card-uid\") as CardUID,\n                    true,\n                )\n            })\n        },\n        unobserve() {\n            // Do nothing.\n        },\n    } as any\n}\n\n/**\n * This is just a very broad heuristic erring on the side of lower height.\n */\nexport function estimated_card_height(card: CardModel) {\n    let height = 38\n    if (card.kind instanceof Note) {\n        height = NoteCard_estimated_height(card as NoteCardModel)\n    } else if (card.kind instanceof Link) {\n        height = LinkCard_estimated_height(card as LinkCardModel)\n    } else if (card.kind instanceof File) {\n        height = FileCard_estimated_height(card as FileCardModel)\n    } else if (\n        card.kind instanceof Inbox ||\n        card.kind instanceof Column ||\n        card.kind instanceof Root\n    ) {\n        // Just to be complete (and make the `assert_never` work).\n    } else {\n        assert_never(card.kind)\n    }\n    height += ui_state.search_state\n        .visible_children(card)\n        .reduce((sum, x) => sum + estimated_card_height(x), 0)\n    return height\n}\n\nexport function is_card_needed_for_highlighting(card: CardModel): boolean {\n    if (!ui_state.highlighted_card_state) {\n        return false\n    }\n    const target = ui_state.highlighted_card\n    if (!target || target.inbox) {\n        return false\n    }\n    if (card.uid === target.uid) {\n        return true\n    }\n    const card_positions: number[] = [card.parent_pos]\n    const card_col = card.find_parent((x) => {\n        card_positions.unshift(x.parent_pos)\n        return !!x.column || !!x.inbox\n    })!\n    const [target_col, target_positions] = ui_state.highlighted_card_column_and_positions!\n    if (card_col.uid === target_col.uid) {\n        // Ok, we are in the same column, now determine if the card comes before the\n        // highlighted card.\n        for (let i = 0; i < Math.min(target_positions.length, card_positions.length); i++) {\n            if (card_positions[i] > target_positions[i]) {\n                return false\n            }\n        }\n        return true\n    }\n    return false\n}\n\nexport const Card = observer(({card, dnd_ghost_ref, force_card_level}: Props) => {\n    const permissions = useCardPermission(card)\n    const [error_code, set_error_code] = React.useState<string>(\"\")\n    React.useEffect(() => profiler.on_card_mounted(), [])\n    const intersection_observer_elm = React.useRef()\n    const intersection_observer_ref = React.useCallback((elm) => {\n        if (elm) {\n            intersection_observer_elm.current = elm\n            intersection_observer.observe(elm)\n        } else {\n            intersection_observer.unobserve(intersection_observer_elm.current!)\n            intersection_observer_elm.current = undefined\n        }\n    }, [])\n    if (error_code) {\n        return <ErrorCard card={card} error_code={error_code} />\n    }\n    try {\n        const is_dnd_ghost = !!dnd_ghost_ref\n        const is_dnd_preview = card._is_dragged && !is_dnd_ghost\n        // Don't delay rendering in certain scenarios.\n        const dont_delay_rendering =\n            ui_state.editing_card(card) || is_dnd_ghost || is_card_needed_for_highlighting(card)\n        if (!ui_state.fully_rendered_cards.has(card.uid) && !dont_delay_rendering) {\n            const height = estimated_card_height(card)\n            return (\n                <div\n                    ref={intersection_observer_ref}\n                    style={{width: \"100%\", height: `${height}px`}}\n                    data-card-uid={card.uid}\n                    data-test-id=\"Card_placeholder\"\n                />\n            )\n        }\n        const visible_children = ui_state.search_state.visible_children(card)\n        const p = {card, permissions, visible_children, force_card_level}\n        const {note, link, file} = card\n        const editing_card = ui_state.editing_card(card)\n        let children\n        if (!process.env.F_PUBLIC && editing_card) {\n            children = (\n                <React_suspense>\n                    <CardChromeEditor {...p} render_card={Card}>\n                        <React_suspense>\n                            {ui_state.special_editor(card) === \"title\" ? (\n                                <TitleImageEditor />\n                            ) : ui_state.special_editor(card) ? (\n                                <UserMediaEditor media_type={ui_state.special_editor(card)} />\n                            ) : note ? (\n                                <NoteCardEditor {...(p as NoteCardProps)} />\n                            ) : link ? (\n                                <LinkCardEditor {...(p as LinkCardProps)} />\n                            ) : file ? (\n                                <FileCardEditor {...(p as FileCardProps)} />\n                            ) : (\n                                (() => {\n                                    throw new Error(\n                                        \"Don't know how to render editor for card ${card.uid} on board ${board.uid}\",\n                                    )\n                                })()\n                            )}\n                        </React_suspense>\n                    </CardChromeEditor>\n                </React_suspense>\n            )\n        } else {\n            children = (\n                <CardChrome {...p} render_card={Card}>\n                    {note ? (\n                        <NoteCard {...(p as NoteCardProps)} />\n                    ) : link ? (\n                        <LinkCard {...(p as LinkCardProps)} />\n                    ) : file ? (\n                        <FileCard {...(p as FileCardProps)} />\n                    ) : (\n                        (() => {\n                            throw new Error(\n                                \"Don't know how to render card ${card.uid} on board ${board.uid}\",\n                            )\n                        })()\n                    )}\n                </CardChrome>\n            )\n        }\n        return (\n            <div\n                ref={dnd_ghost_ref}\n                className={classNames({\n                    dnd__card: !card.inbox,\n                    dnd__ghost: is_dnd_ghost,\n                    dnd__preview: is_dnd_preview,\n                    \"dnd__top-level-card\": card.inbox,\n                    \"dnd__has-visible-children\": visible_children.length,\n                })}\n                data-card-uid={card.uid /* Needed by drag & drop. */}\n                data-test-id=\"Card_full\"\n            >\n                {children}\n            </div>\n        )\n    } catch (error) {\n        let fallback_error_code = \"\"\n        try {\n            let s = error_to_string(error)\n            if (s.length > 1000) {\n                s = s.substring(0, 500) + \"...\" + s.substring(s.length - 500)\n            }\n            const a = sha256(Buffer.from(s))\n            fallback_error_code += a[0] + a[1]\n        } catch (e) {\n            report_error(\"Failed to calculate error code\", e)\n        }\n        report_error(\n            `Failed to render card -- showing error card (error_code: ${fallback_error_code})`,\n            error,\n        )\n        set_error_code(fallback_error_code)\n        return <ErrorCard card={card} error_code={fallback_error_code} />\n    }\n})\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport * as MDC from \"@cling/lib.web.mdc\"\nimport {Icon} from \"@cling/lib.web.mdc\"\nimport {BoardType, Card as CardModel, CardUID, is_RemovedComment} from \"@cling/lib.shared.model\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {running_on_mobile_device} from \"@cling/lib.web.utils\"\nimport {Comments} from \"../comments/comments\"\nimport {card_level} from \"./utils\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {CardMenuDesktop, CardMenuMobile} from \"./card_menu\"\nimport {Task} from \"./task\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {Link} from \"@reach/router/index\"\nimport type {CardPermissions} from \"@cling/lib.web.resources\"\nimport {board_name} from \"../board/board_name\"\nimport {BoardContext} from \"../board_context\"\nimport {NewElmMiniFAB} from \"./new_elm\"\nimport {runInAction} from \"mobx\"\nimport {is_cling_hp} from \"../utils\"\n\ninterface Props {\n    card: CardModel\n    permissions: CardPermissions\n    visible_children: ReadonlyArray<CardModel>\n    className?: string\n    children?: any\n    render_card: React.ComponentType<{card: CardModel}>\n    force_card_level?: number // Override `card_level(card)`\n}\n\nexport const CardChrome = observer(\n    ({\n        card,\n        permissions,\n        visible_children,\n        className,\n        children,\n        render_card,\n        force_card_level,\n    }: Props) => {\n        const {\n            current_board: {board},\n        } = React.useContext(BoardContext)\n        const main_elm = React.useRef<HTMLElement | undefined | null>()\n        const on_mouse_over = React.useCallback(() => {\n            ui_actions.show_card_menus(card)\n        }, [card])\n        const on_click_on_comments = React.useCallback(() => {\n            ui_actions.open_comments(card)\n        }, [card])\n        const on_click_on_hidden_cards = React.useCallback(() => {\n            ui_actions.toggle_children_collapsed(card)\n        }, [card])\n        const on_click_on_non_regular_board = React.useCallback(\n            (e: React.SyntheticEvent) => {\n                if (board?.board_type === BoardType.trashcan && !ui_state.trashcan_shown) {\n                    ui_actions.toggle_trashcan_shown()\n                }\n                if (board?.board_type === BoardType.clipboard && !ui_state.clipboard_shown) {\n                    ui_actions.toggle_clipboard_shown()\n                }\n                ui_state.search_state.end_search()\n                e.stopPropagation()\n                e.preventDefault()\n            },\n            [board],\n        )\n        const update_main_ref = React.useCallback(\n            (elm: ReactRef<HTMLElement>) => {\n                main_elm.current = elm\n                if (\n                    ui_state.highlighted_card_state?.already_scrolled_into_view ||\n                    ui_state.highlighted_card_state?.card_uid !== card.uid\n                ) {\n                    return\n                }\n                setTimeout(() => {\n                    requestAnimationFrame(() => {\n                        if (!main_elm.current) {\n                            return\n                        }\n                        // We only want to scroll the card into view exactly once.\n                        runInAction(() => {\n                            if (!ui_state.highlighted_card_state) {\n                                return\n                            }\n                            ui_state.highlighted_card_state.already_scrolled_into_view = true\n                        })\n                        ui_state.layout_state.scroll_column_into_view(main_elm.current)\n                        main_elm.current.scrollIntoView()\n                        const scroll_container = main_elm.current.closest(\".fwc__main-column\")\n                        if (scroll_container) {\n                            // Add a little space on top ...\n                            scroll_container.scrollTop = Math.max(\n                                0,\n                                scroll_container.scrollTop - 100,\n                            )\n                        }\n                    })\n                }, 200)\n            },\n            [card.uid],\n        )\n        React.useEffect(() => {\n            return () => {\n                if (ui_state.card_menus_shown(card.uid)) {\n                    ui_actions.hide_card_menus()\n                }\n            }\n        }, [card.uid])\n        const children_collapsed = ui_state.is_children_collapsed(card)\n        const render_collapsed_children = React.useMemo(() => {\n            if (visible_children.length > 0 && children_collapsed) {\n                // Note: We need to render the drag & drop preview,\n                //       if it is one of the visible children ...\n                const first_child = visible_children[0]\n                const last_child = visible_children[visible_children.length - 1]\n                const render_collapsed_cards = (\n                    hidden_card_uid: CardUID,\n                    num_cards_hidden: number,\n                ) => (\n                    <div\n                        className={classNames(\"card-one-line-aux\", \"dnd__collapsed-cards\")}\n                        data-card-uid={hidden_card_uid /* ... needed by drag & drop */}\n                    >\n                        <a className=\"action\" onClick={on_click_on_hidden_cards} draggable={false}>\n                            <Icon icon=\"expand_more\" small primary />\n                            <div>{i18n.num_cards_hidden(num_cards_hidden)}</div>\n                        </a>\n                    </div>\n                )\n                const render_dnd_preview = (dragged_card: CardModel) =>\n                    React.createElement(render_card, {key: dragged_card.uid, card: dragged_card})\n                if (first_child._is_dragged) {\n                    if (visible_children.length === 1) {\n                        return render_dnd_preview(first_child)\n                    } else {\n                        return (\n                            <>\n                                {render_dnd_preview(first_child)}\n                                <div style={{height: \"10px\"}} />\n                                {render_collapsed_cards(\n                                    last_child.uid,\n                                    visible_children.length - 1,\n                                )}\n                            </>\n                        )\n                    }\n                } else if (last_child._is_dragged) {\n                    return (\n                        <>\n                            {render_collapsed_cards(first_child.uid, visible_children.length - 1)}\n                            {render_dnd_preview(last_child)}\n                        </>\n                    )\n                }\n                return render_collapsed_cards(first_child.uid, visible_children.length)\n            }\n        }, [visible_children, children_collapsed, on_click_on_hidden_cards, render_card])\n        const render_children = React.useMemo(() => {\n            if (!children_collapsed) {\n                return visible_children.map((x) =>\n                    React.createElement(render_card, {key: x.uid, card: x}),\n                )\n            }\n        }, [visible_children, children_collapsed, render_card])\n        const card_menus_shown = ui_state.card_menus_shown(card)\n        const is_new_or_changed = ui_state.is_new_or_changed(card)\n        const level = force_card_level ?? card_level(card)\n        const comments_shown = ui_state.comments_shown(card)\n        const {color} = card\n        const matches_directly = ui_state.search_state.matches_directly(card)\n        let new_comments_badge = false\n        for (const x of card.comments) {\n            if (ui_state.is_new_or_changed(x)) {\n                new_comments_badge = true\n                break\n            }\n        }\n        const is_highlighted = ui_state.highlighted_card_state?.card_uid === card.uid\n        const show_comments_aux_line =\n            !comments_shown && card.comments.some((x) => !is_RemovedComment(x))\n        let num_comments\n        if (show_comments_aux_line) {\n            num_comments = i18n.num_comments(card.comments.length)\n            if (ui_state.search_state.has_matching_comments(card)) {\n                num_comments = ui_state.search_state.highlight_all(num_comments)\n            }\n        }\n        return (\n            <>\n                {is_new_or_changed === \"children\" && (\n                    <div className=\"card__new-or-changed-badge mdcx-badge mdcx-badge--small mdcx-badge--secondary\">\n                        &nbsp;\n                    </div>\n                )}\n                {!!ui_state.let_user_select_where_to_add_a_card && <NewElmMiniFAB card={card} />}\n                <div\n                    className={classNames(\n                        \"card card--no-user-select\",\n                        className,\n                        `card--color-${color}`,\n                        `card--level-${level}`,\n                        {\n                            \"card--archived\": card.archived,\n                            \"card--menu-shown\": card_menus_shown,\n                        },\n                    )}\n                    data-test-id=\"Card\"\n                    ref={is_highlighted ? update_main_ref : undefined}\n                >\n                    {!is_cling_hp() && running_on_mobile_device() && (\n                        <CardMenuMobile\n                            card={card}\n                            permissions={permissions}\n                            has_visible_children={visible_children.length > 0}\n                        />\n                    )}\n                    {!is_cling_hp() && !running_on_mobile_device() && card_menus_shown && (\n                        <CardMenuDesktop\n                            card={card}\n                            permissions={permissions}\n                            has_visible_children={visible_children.length > 0}\n                        />\n                    )}\n                    <div onMouseMove={running_on_mobile_device() ? undefined : on_mouse_over}>\n                        <MDC.Card\n                            className={classNames(`card--color-${color}`, {\n                                \"card__mdc-card--with-children\": visible_children.length,\n                                \"card--search-match\":\n                                    !is_highlighted &&\n                                    matches_directly &&\n                                    ui_state.search_state.is_search_narrowing_down &&\n                                    !ui_state.search_state.all_boards &&\n                                    ui_state.main_view !== \"calendar\",\n                                \"card--new-or-changed\": is_new_or_changed === \"self\",\n                                \"card--highlighted\": is_highlighted,\n                            })}\n                        >\n                            {ui_state.search_state.all_boards && ui_state.search_state.order && (\n                                <div\n                                    className=\"card-one-line-aux card-one-line-aux--no-icon card-one-line-aux--with-action card-one-line-aux--top\"\n                                    data-test-board-uid={card.board_uid}\n                                >\n                                    {(running_on_mobile_device() ||\n                                        board?.is_dashboard_or_user_board) && (\n                                        <Link\n                                            className=\"action\"\n                                            to={`/c/${card.uid}`}\n                                            draggable={false}\n                                        >\n                                            <Icon\n                                                icon={\n                                                    board?.board_type === BoardType.people\n                                                        ? \"face\"\n                                                        : \"dashboard\"\n                                                }\n                                                small\n                                                primary\n                                            />\n                                            <div>{board_name(board!)}</div>\n                                        </Link>\n                                    )}\n                                    {!running_on_mobile_device() &&\n                                        !board?.is_dashboard_or_user_board && (\n                                            <a\n                                                className=\"action\"\n                                                href=\"#\"\n                                                onClick={on_click_on_non_regular_board}\n                                                draggable={false}\n                                            >\n                                                <Icon\n                                                    icon={\n                                                        board?.board_type === BoardType.people\n                                                            ? \"face\"\n                                                            : \"dashboard\"\n                                                    }\n                                                    small\n                                                    primary\n                                                />\n                                                <div>{board_name(board!)}</div>\n                                            </a>\n                                        )}\n                                </div>\n                            )}\n                            <article className=\"card__content\">\n                                <div className=\"card__children\">{children}</div>\n                                {card.task && (\n                                    <Task\n                                        className=\"card-one-line-aux\"\n                                        card={card}\n                                        permissions={permissions}\n                                    />\n                                )}\n                                {show_comments_aux_line && (\n                                    <aside className=\"card-one-line-aux card-one-line-aux--with-action\">\n                                        <a\n                                            className=\"action\"\n                                            onClick={on_click_on_comments}\n                                            data-test-id=\"CardChrome_show_comments\"\n                                            draggable={false}\n                                        >\n                                            {new_comments_badge && (\n                                                <div className=\"card__new-or-changed-badge mdcx-badge mdcx-badge--small mdcx-badge--secondary\" />\n                                            )}\n                                            <Icon icon=\"comment\" small primary outlined />\n                                            <div data-test-id=\"CardChrome_num_comments\">\n                                                {num_comments}\n                                            </div>\n                                        </a>\n                                        <div />\n                                    </aside>\n                                )}\n                                {comments_shown && (\n                                    <Comments\n                                        className=\"card-aux card-aux--below\"\n                                        permissions={permissions}\n                                        comments={card.comments}\n                                        card={card}\n                                        initial_focus={ui_state.should_focus_comment_editor_once(\n                                            card,\n                                        )}\n                                    />\n                                )}\n                                {children_collapsed && render_collapsed_children}\n                            </article>\n                        </MDC.Card>\n                    </div>\n                    {!children_collapsed && render_children}\n                </div>\n            </>\n        )\n    },\n)\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport * as MDC from \"@cling/lib.web.mdc\"\nimport {Button, IconButton} from \"@cling/lib.web.mdc\"\nimport type {Card as CardModel, Comment as CommentModel} from \"@cling/lib.shared.model\"\nimport {Comment} from \"./comment\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport type {RichTextEditor as RichTextEditorType} from \"@cling/lib.web.rich_text_editor/rich_text_editor\"\nimport {current_user, ui_actions, ui_state} from \"../state/index\"\nimport model_actions from \"../state/model_actions\"\nimport scrollIntoView from \"smooth-scroll-into-view-if-needed\"\nimport {running_on_mobile_device} from \"@cling/lib.web.utils\"\nimport {LIMIT_HTML} from \"@cling/lib.shared.limits\"\nimport {assert} from \"@cling/lib.shared.utils\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {BoardContext} from \"../board_context\"\nimport {runInAction} from \"mobx\"\nimport {React_lazy, React_suspense} from \"@cling/lib.web.lazy_load/suspense\"\n\nconst RichTextEditor = React_lazy(\n    () => import(process.env.F_PUBLIC_LAZY || \"@cling/lib.web.rich_text_editor/rich_text_editor\"),\n    \"eager_load\",\n)\ninterface Props {\n    comments: Array<CommentModel>\n    card: CardModel\n    permissions: {can_add_comment: boolean}\n    className?: string\n    onMouseDown?: React.MouseEventHandler<HTMLDivElement>\n    initial_focus?: boolean\n}\n\nfunction scroll_down(elm: any) {\n    if (elm) {\n        elm.scrollTop = elm.scrollHeight\n    }\n}\n\nexport const Comments = observer(\n    ({initial_focus, comments, card, permissions, className, onMouseDown}: Props) => {\n        const {\n            current_board: {board, display_version},\n        } = React.useContext(BoardContext)\n        const list_ref = React.createRef()\n        const rich_text_editor_ref = React.useRef<RichTextEditorType>()\n        const [start_index, set_start_index] = React.useState(Math.max(0, comments.length - 3))\n        const [valid_comment_entered, set_valid_comment_entered] = React.useState(false)\n        const [max_length_exceeded, set_max_length_exceeded] = React.useState(false)\n        const [should_scroll_into_view, set_should_scroll_into_view] = React.useState<\n            {focus_editor: boolean; smooth: boolean} | undefined\n        >(initial_focus ? {focus_editor: !running_on_mobile_device(), smooth: true} : undefined)\n        const scroll_into_view_ref = React.useCallback(\n            (elm) => {\n                if (!should_scroll_into_view || !elm) {\n                    return\n                }\n                if (!rich_text_editor_ref.current) {\n                    // We use `React_suspense`  and thus have to wait until the suspended components\n                    // are rendered. That's why we simply re-trigger.\n                    setTimeout(() => scroll_into_view_ref(elm), 100)\n                    return\n                }\n                scrollIntoView(elm, {\n                    scrollMode: \"if-needed\",\n                    block: running_on_mobile_device() ? \"end\" : \"nearest\",\n                    behavior: should_scroll_into_view.smooth ? \"smooth\" : \"auto\",\n                })\n                if (should_scroll_into_view.focus_editor) {\n                    rich_text_editor_ref.current.focus()\n                }\n                set_should_scroll_into_view(undefined)\n            },\n            [should_scroll_into_view],\n        )\n        const add_comment = React.useCallback(\n            (e?: React.SyntheticEvent) => {\n                e?.stopPropagation()\n                if (!rich_text_editor_ref.current || !board) {\n                    return\n                }\n                const {safe_html} = rich_text_editor_ref.current\n                if (!safe_html || safe_html.length > LIMIT_HTML.upper_bound) {\n                    return\n                }\n                assert(\n                    display_version === \"latest\",\n                    \"Comments can only be added to the latest version of a board\",\n                )\n                rich_text_editor_ref.current.reset()\n                model_actions.add_comment(board, card, safe_html)\n                set_should_scroll_into_view({focus_editor: true, smooth: false})\n            },\n            [board, card, display_version, rich_text_editor_ref],\n        )\n        React.useEffect(() => {\n            if (list_ref.current) {\n                scroll_down(list_ref.current)\n            }\n        }, [list_ref])\n        React.useEffect(() => {\n            const interval_id = setInterval(() => {\n                let new_max_length_exceeded: boolean\n                let new_valid_comment_entered: boolean\n                if (!rich_text_editor_ref.current) {\n                    new_max_length_exceeded = false\n                    new_valid_comment_entered = false\n                } else {\n                    const {safe_html} = rich_text_editor_ref.current\n                    new_max_length_exceeded = safe_html.length > LIMIT_HTML.upper_bound\n                    new_valid_comment_entered = safe_html.length > 0 && !new_max_length_exceeded\n                }\n                set_valid_comment_entered(new_valid_comment_entered)\n                set_max_length_exceeded(new_max_length_exceeded)\n            }, 367)\n            return () => clearInterval(interval_id)\n        }, [])\n        const decrease_start_index = React.useCallback(() => {\n            set_start_index(Math.max(0, start_index - 3))\n        }, [start_index])\n        const close = React.useCallback(() => {\n            ui_actions.hide_comments(card)\n        }, [card])\n        const on_escape = React.useCallback(() => {\n            ;(document.activeElement as HTMLElement)?.blur?.()\n        }, [])\n        const on_key_down = React.useCallback(() => {\n            if (ui_state.app_bar_shown) {\n                runInAction(() => (ui_state.app_bar_shown = false))\n            }\n        }, [])\n        return (\n            <div className={classNames(\"comments\", className)} onMouseDown={onMouseDown}>\n                <div className=\"comments__close\">\n                    <IconButton icon=\"close\" small onClick={close} />\n                </div>\n                <div className=\"comments__header\">{i18n.comments}</div>\n                {start_index > 0 && (\n                    <div className=\"comments__show-older\">\n                        <Button\n                            onClick={decrease_start_index}\n                            data-test-id=\"Comments_show_older\"\n                            icon=\"arrow_upward\"\n                            outlined\n                        >\n                            {i18n.show_older_comments}\n                        </Button>\n                    </div>\n                )}\n                <div className=\"comments__content\">\n                    {comments.slice(start_index).map((comment) => (\n                        <Comment\n                            key={comment.uid}\n                            comment={comment}\n                            permissions={current_user.comment_permissions(board!, comment)}\n                        />\n                    ))}\n                </div>\n                {!process.env.F_PUBLIC && permissions.can_add_comment && (\n                    <React_suspense>\n                        <div className=\"comments__add\">\n                            <div className=\"comments__add_editor\" data-test-id=\"Comments_add\">\n                                <RichTextEditor\n                                    ref={rich_text_editor_ref}\n                                    placeholder={i18n.comment_on}\n                                    toolbar_mode=\"none\"\n                                    show_error={\n                                        max_length_exceeded ? i18n.the_text_is_too_long : \"\"\n                                    }\n                                    onModEnter={add_comment}\n                                    onEscape={on_escape}\n                                    onKeyDown={running_on_mobile_device() ? on_key_down : undefined}\n                                    data-test-id=\"Comments_rich_text_editor\"\n                                />\n                            </div>\n                            <div>\n                                <MDC.IconButton\n                                    icon=\"send\"\n                                    data-test-id=\"Comments_add_send\"\n                                    primary\n                                    small\n                                    onClick={add_comment}\n                                    tooltip={i18n.send_comment}\n                                    tabIndex={-1}\n                                    disabled={!valid_comment_entered}\n                                />\n                            </div>\n                        </div>\n                        <div className=\"comments__scroll_into_view\" ref={scroll_into_view_ref} />\n                    </React_suspense>\n                )}\n            </div>\n        )\n    },\n)\n", "import * as React from \"react\"\nimport {\n    Comment as CommentModel,\n    NoteComment as NoteCommentModel,\n    RemovedComment,\n    is_NoteComment,\n    is_RemovedComment,\n} from \"@cling/lib.shared.model\"\nimport {current_user, ui_state} from \"../state/index\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {observer} from \"mobx-react\"\nimport {decorate_emojis, emojis_should_be_large} from \"@cling/lib.web.utils/decorate_emojis\"\nimport {decorate_urls} from \"@cling/lib.web.utils/decorate_urls\"\nimport {PrincipalInfo} from \"../account/principal_info\"\nimport {RelDate} from \"../misc/rel_date\"\nimport {CommentMenuDesktop, CommentMenuMobile} from \"./comment_menu\"\nimport {running_on_mobile_device} from \"@cling/lib.web.utils\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport type {CommentPermissions} from \"@cling/lib.web.resources\"\n\ninterface Props {\n    comment: CommentModel\n    permissions: CommentPermissions\n}\n\nexport const Comment = observer(({comment, permissions}: Props) => {\n    const [desktop_menu_shown, set_menu_shown] = React.useState(false)\n    const render_rel_date_callback = React.useCallback(\n        (time_elm: React.ReactElement<HTMLTimeElement>) => (\n            <div className=\"comment__content-header-date\" data-test-ignore>\n                {time_elm}\n            </div>\n        ),\n        [],\n    )\n    const show_menu = React.useCallback(() => set_menu_shown(true), [])\n    const hide_menu = React.useCallback(() => set_menu_shown(false), [])\n    const is_new_or_changed = ui_state.is_new_or_changed(comment)\n    const is_removed = is_RemovedComment(comment)\n    return (\n        <div\n            className={classNames(\"comment\", {\n                \"comment--current-user\":\n                    comment.last_change.account_uid === current_user.account.uid,\n                \"comment--new-or-changed\": is_new_or_changed,\n            })}\n            onMouseOver={show_menu}\n            onMouseLeave={hide_menu}\n        >\n            {!is_removed && !running_on_mobile_device() && desktop_menu_shown && (\n                <CommentMenuDesktop comment={comment} permissions={permissions} />\n            )}\n            <div className=\"comment__avatar\">\n                <PrincipalInfo uid={comment.first_change.account_uid} display=\"avatar\" />\n            </div>\n            <div className=\"comment__content\">\n                <div className=\"comment__content-header\">\n                    <PrincipalInfo\n                        className=\"comment__content-header-principal\"\n                        uid={comment.first_change.account_uid}\n                        display=\"full_name\"\n                    />\n                    <RelDate render={render_rel_date_callback} date={comment.first_change.date} />\n                    {!is_removed && running_on_mobile_device() && (\n                        <CommentMenuMobile comment={comment} permissions={permissions} />\n                    )}\n                </div>\n                {is_NoteComment(comment) && <NoteComment comment={comment} />}\n                {is_RemovedComment(comment) && <RemovedComment comment={comment} />}\n            </div>\n        </div>\n    )\n})\n\nconst RemovedComment = observer(({comment}: {comment: RemovedComment}) => {\n    return (\n        <div className=\"comment__content-removed rich-text\">\n            [\n            {i18n.removed_by(\n                <PrincipalInfo\n                    display=\"full_name_no_teams\"\n                    uid={comment.kind.change.account_uid}\n                />,\n                comment.kind.change.date,\n            )}\n            ]\n        </div>\n    )\n})\n\nconst NoteComment = observer(({comment}: {comment: NoteCommentModel}) => {\n    const matches = ui_state.search_state.search_matches(comment)\n    const safe_html = ui_state.search_state.highlight_match(comment, \"safe_html\", matches)\n    const large_emojis = emojis_should_be_large(safe_html)\n    return (\n        <div className=\"comment__content-html rich-text\">\n            <div\n                data-test-id=\"Comment_safe_html\"\n                dangerouslySetInnerHTML={{\n                    __html: decorate_urls(\n                        decorate_emojis(safe_html, large_emojis ? \"emoji emoji--large\" : \"emoji\"),\n                    ),\n                }}\n            />\n        </div>\n    )\n})\n", "import {find_urls} from \"@cling/lib.shared.utils/find_urls\"\n\nexport function decorate_urls(safe_html: string): string {\n    const a = find_urls(safe_html)\n    if (!a.length) {\n        return safe_html\n    }\n    const r: string[] = []\n    let i = 0\n    for (const [offset, length] of a) {\n        r.push(safe_html.substring(i, offset))\n        const url = safe_html.substr(offset, length)\n        let malformed: 1 | undefined\n        try {\n            decodeURI(url)\n        } catch {\n            malformed = 1\n        }\n        r.push(\n            `<a href=\"${url}\"${malformed ? ' class=\"malformed\"' : \"\"}${\n                process.env.F_PUBLIC ? \"\" : ' target=\"_blank\"'\n            } rel=\"noopener\">${pretty_url(url)}</a>`,\n        )\n        i = offset + length\n    }\n    r.push(safe_html.substr(i))\n    return r.join(\"\")\n}\n\nfunction pretty_url(url: string) {\n    if (url.startsWith(\"https://\")) {\n        url = url.substr(\"https://\".length)\n    } else if (url.startsWith(\"http://\")) {\n        url = url.substr(\"http://\".length)\n    }\n    if (url.length <= 120) {\n        return url\n    }\n    return url.substr(0, 117) + \"...\"\n}\n", "import {observer} from \"mobx-react\"\nimport type {Comment} from \"@cling/lib.shared.model\"\nimport * as React from \"react\"\nimport {IconButton} from \"@cling/lib.web.mdc/icon_button\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport model_actions from \"../state/model_actions\"\nimport {trap_browser_back} from \"@cling/lib.web.utils\"\nimport {Button} from \"@cling/lib.web.mdc/button\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {BoardContext} from \"../board_context\"\nimport type {CommentPermissions} from \"@cling/lib.web.resources\"\nimport {assert} from \"@cling/lib.shared.utils\"\nimport ReactDOM from \"react-dom\"\n\nexport const CommentMenuDesktop = observer(\n    ({comment, permissions}: {comment: Comment; permissions: CommentPermissions}) => {\n        const {current_board} = React.useContext(BoardContext)\n        const on_remove = React.useCallback(() => {\n            if (!current_board.board) {\n                return\n            }\n            assert(\n                current_board.display_version === \"latest\",\n                \"Comments cannot be removed if display_version is not `latest`\",\n            )\n            model_actions.remove_comment(current_board.board, comment)\n        }, [current_board, comment])\n        if (!permissions.can_remove_comment) {\n            return null\n        }\n        return (\n            <div className=\"card-menu card-menu-desktop comment-menu\">\n                <div className=\"card-menu-desktop__content\">\n                    <IconButton\n                        key=\"remove\"\n                        disabled={!permissions.can_remove_comment}\n                        tooltip={i18n.remove}\n                        icon=\"delete\"\n                        outlined\n                        onClick={on_remove}\n                        data-test-id=\"CommentMenu_remove\"\n                    />\n                </div>\n            </div>\n        )\n    },\n)\n\nexport const CommentMenuMobile = observer(\n    ({comment, permissions}: {comment: Comment; permissions: CommentPermissions}) => {\n        const {current_board} = React.useContext(BoardContext)\n        const [open, set_open] = React.useState(false)\n        const trap_browser_back_dispose = React.useRef<(() => void) | undefined>(undefined)\n        React.useEffect(() => {\n            if (open) {\n                ui_actions.show_global_backdrop(() => set_open(false))\n                trap_browser_back_dispose.current = trap_browser_back(\"comment_menu\", () =>\n                    set_open(false),\n                )\n                return trap_browser_back_dispose.current\n            } else {\n                ui_actions.hide_global_backdrop()\n            }\n        }, [open])\n        const on_remove = React.useCallback(() => {\n            set_open(false)\n            trap_browser_back_dispose.current?.()\n            if (!current_board.board) {\n                return\n            }\n            assert(\n                current_board.display_version === \"latest\",\n                \"Comments cannot be removed if display_version is not `latest`\",\n            )\n            model_actions.remove_comment(current_board.board, comment)\n        }, [current_board, comment])\n        const show_menu = React.useCallback(() => {\n            set_open(true)\n        }, [])\n        const hide_menu = React.useCallback(() => {\n            set_open(false)\n        }, [])\n        if (!permissions.can_remove_comment) {\n            return null\n        }\n        if (!open) {\n            return (\n                <IconButton\n                    icon=\"more_vert\"\n                    small\n                    className=\"comment-menu-mobile__placeholder\"\n                    data-test-id=\"CommentMenu_open\"\n                    onClick={show_menu}\n                />\n            )\n        }\n        return ReactDOM.createPortal(\n            <nav\n                className=\"card-menu-mobile\"\n                data-test-id=\"CommentMenu\"\n                style={{width: ui_state.layout_state.layout.main_layout.column_width}}\n            >\n                <div className=\"card-menu-mobile__content\">\n                    <div className=\"card-menu-mobile__quick-items\">\n                        <div key=\"placeholder_1\" />\n                        <div key=\"placeholder_2\" />\n                        <div key=\"placeholder_3\" />\n                        <IconButton\n                            key=\"remove\"\n                            className=\"card-menu__remove\"\n                            disabled={!permissions.can_remove_comment}\n                            label={i18n.remove}\n                            icon=\"delete\"\n                            outlined\n                            onClick={on_remove}\n                            data-test-id=\"CommentMenu_remove\"\n                        />\n                    </div>\n                    <Button\n                        key=\"close\"\n                        icon=\"close\"\n                        className=\"card-menu-mobile__cancel\"\n                        onClick={hide_menu}\n                        raised\n                        data-test-id=\"CommentMenu_close\"\n                    >\n                        {i18n.cancel}\n                    </Button>\n                </div>\n            </nav>,\n            document.body,\n        )\n    },\n)\n", "import * as React from \"react\"\nimport {\n    Board,\n    BoardType,\n    Card,\n    EngagementType,\n    extract_linked_board_and_card_uid,\n    FileCard,\n    ImageCardDisplayKind,\n    is_FileCard,\n    is_LinkCard,\n    is_NoteCard,\n    may_have_thumbnail,\n} from \"@cling/lib.shared.model\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {observer} from \"mobx-react\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport model_actions from \"../state/model_actions\"\nimport {\n    Button,\n    Icon,\n    IconButton,\n    Menu,\n    MenuItem,\n    MenuItemDivider,\n    Snackbar,\n} from \"@cling/lib.web.mdc\"\nimport {reaction} from \"mobx\"\nimport {running_on_mobile_device} from \"@cling/lib.web.utils\"\nimport {download} from \"../misc/download\"\nimport {cancel_event, trap_browser_back} from \"@cling/lib.web.utils\"\nimport {RelDate} from \"../misc/rel_date\"\nimport {PrincipalInfo} from \"../account/principal_info\"\nimport {board_info_resource, CardPermissions} from \"@cling/lib.web.resources\"\nimport {nop, not_null} from \"@cling/lib.shared.utils\"\nimport {above_card_insert_pos, below_card_insert_pos} from \"./add_card_actions\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {card_deep_link, goto_board, with_shortcut} from \"../utils\"\nimport {print_board} from \"../misc/print\"\nimport {Link} from \"@reach/router/index\"\nimport {LinkCardAnchor} from \"./link_card\"\nimport {DefaultFileCardAnchor} from \"./default_file_card\"\nimport {is_playable_media, video_player_state} from \"./video_player\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {BoardContext} from \"../board_context\"\nimport {card_level} from \"./utils\"\nimport {report_user_engagement} from \"@cling/lib.web.analytics\"\nimport {CardSynopsisOneLiner} from \"./card_synopsis\"\nimport ReactDOM from \"react-dom\"\n\nexport interface MenuItemProps {\n    disabled?: boolean\n    icon: string\n    title: string\n    onClick: (e: React.MouseEvent) => void\n    className?: string\n    outlined?: boolean\n    highlight?: boolean\n    badge?: boolean\n    \"data-test-id\"?: string\n    shortcut?: string\n}\n\nexport const CardMenuMobile = observer(\n    ({\n        card,\n        permissions,\n        has_visible_children,\n    }: {\n        card: Card\n        permissions: CardPermissions\n        has_visible_children: boolean\n    }) => {\n        const [view_mode, set_view_mode] = React.useState<\"\" | \"info\">(\"\")\n        const [open, set_open] = React.useState(false)\n        const show_menu = React.useCallback(() => {\n            ui_actions.show_card_menus(card)\n        }, [card])\n        const on_click_info = React.useCallback(() => {\n            set_view_mode(\"info\")\n        }, [])\n        const trap_browser_back_dispose = React.useRef<(() => void) | undefined>(undefined)\n        React.useEffect(\n            () =>\n                reaction(\n                    () => ui_state.card_menus_shown(card.uid),\n                    (menus_shown) => {\n                        set_open(menus_shown)\n                        if (!menus_shown) {\n                            set_view_mode(\"\")\n                            trap_browser_back_dispose.current?.()\n                            trap_browser_back_dispose.current = undefined\n                        } else {\n                            trap_browser_back_dispose.current = trap_browser_back(\n                                \"card_menu\",\n                                ui_actions.hide_card_menus,\n                            )\n                        }\n                    },\n                    {fireImmediately: true},\n                ),\n            [card.uid],\n        )\n        const {\n            current_board: {board, display_version},\n        } = React.useContext(BoardContext)\n        if (!open) {\n            return (\n                <div\n                    className={classNames(\"card-menu-mobile__placeholder\", {\n                        \"card-menu-mobile__placeholder--on-image\":\n                            may_have_thumbnail(card.file?.blob) ||\n                            card.link?.style.display.kind === ImageCardDisplayKind.cinema ||\n                            card.link?.style.display.kind === ImageCardDisplayKind.banner,\n                    })}\n                >\n                    <IconButton\n                        icon=\"more_vert\"\n                        small\n                        data-test-id=\"CardMenu_open\"\n                        onClick={show_menu}\n                    />\n                </div>\n            )\n        }\n        if (!board) {\n            return null\n        }\n        const card_actions = _card_actions({card, has_visible_children, board})\n        const is = _switches({card, board})\n        const items = _items({card, board, has_visible_children, permissions}, card_actions, is)\n        const quick_items: (MenuItemProps | undefined)[] = []\n        if (permissions.can_edit_card) {\n            quick_items.push(items.edit)\n        }\n        if (ui_state.search_state.is_search_narrowing_down) {\n            quick_items.push(items.search_go_to_card)\n        } else if (display_version !== \"latest\") {\n            quick_items.push(items.history_go_to_card)\n        }\n        if (permissions.can_move_card && !ui_state.search_state.all_boards) {\n            quick_items.push(items.dec_indent)\n            quick_items.push(items.inc_indent)\n        }\n        // Fill up the current row, so the next entries start on a new line ...\n        while (!process.env.F_PUBLIC && (quick_items.length + 1) % 4 !== 0) {\n            quick_items.push(undefined)\n        }\n        quick_items.push(items.collapse)\n        if (permissions.can_add_comment) {\n            quick_items.push(items.comment)\n        }\n        if (permissions.can_edit_task) {\n            quick_items.push(items.edit_task)\n        }\n        if (permissions.can_report_abuse) {\n            quick_items.push(items.report_abuse)\n        }\n        // Fill up the current row, so the next entries start on a new line ...\n        while (!process.env.F_PUBLIC && (quick_items.length + 1) % 4 !== 0) {\n            quick_items.push(undefined)\n        }\n        if (permissions.can_cut_card) {\n            quick_items.push(items.cut_card)\n        }\n        if (permissions.can_copy_card) {\n            quick_items.push(items.copy_card)\n        }\n        if (permissions.can_move_card) {\n            quick_items.push(items.send_to_board)\n        }\n        // Fill up the current row, so the next entries start on a new line ...\n        while (!process.env.F_PUBLIC && (quick_items.length + 1) % 4 !== 0) {\n            quick_items.push(undefined)\n        }\n        if ((navigator as any).share) {\n            quick_items.push(items.share)\n        }\n        if (card.file) {\n            quick_items.push(items.download)\n        }\n        // Fill up the current row, so the next entries start on a new line ...\n        while (!process.env.F_PUBLIC && (quick_items.length + 1) % 4 !== 0) {\n            quick_items.push(undefined)\n        }\n        if (!process.env.F_PUBLIC) {\n            quick_items.push({\n                icon: \"info\",\n                onClick: on_click_info,\n                title: i18n.info,\n                \"data-test-id\": \"CardMenu_view_info\",\n            })\n        }\n        quick_items.push(items.print)\n        if (permissions.can_remove_card || permissions.can_archive_card) {\n            if (permissions.can_archive_card) {\n                quick_items.push(items.archive)\n            }\n            if (permissions.can_remove_card) {\n                quick_items.push(items.remove)\n            }\n        }\n        // Fill up to the end ...\n        while ((quick_items.length + 1) % 4 !== 0) {\n            quick_items.push(undefined)\n        }\n        return ReactDOM.createPortal(\n            <nav\n                className=\"card-menu-mobile\"\n                data-test-id=\"CardMenu\"\n                style={{width: ui_state.layout_state.layout.main_layout.column_width}}\n            >\n                <div className=\"card-menu-mobile__content\">\n                    <div className=\"card-menu-mobile__title\">\n                        <CardSynopsisOneLiner\n                            card={card}\n                            className=\"card-menu-mobile__title-synopsis\"\n                        />\n                    </div>\n                    {view_mode === \"\" && (\n                        <div className=\"card-menu-mobile__quick-items\">\n                            <OpenCard card={card} />\n                            {quick_items.map((x, i) =>\n                                x ? (\n                                    <IconButton\n                                        className={x.className}\n                                        outlined={x.outlined !== false}\n                                        key={x.title}\n                                        icon={x.icon}\n                                        onClick={x.onClick}\n                                        data-test-id={x[\"data-test-id\"]}\n                                        disabled={x.disabled}\n                                        label={x.title}\n                                    />\n                                ) : (\n                                    <div key={i} />\n                                ),\n                            )}\n                        </div>\n                    )}\n                    {view_mode === \"info\" && <CardInfo card={card} />}\n                    <Button\n                        key=\"close\"\n                        icon=\"close\"\n                        className=\"card-menu-mobile__cancel\"\n                        onClick={ui_actions.hide_card_menus}\n                        data-test-id=\"CardMenu_close\"\n                        raised\n                    >\n                        {i18n.cancel}\n                    </Button>\n                </div>\n            </nav>,\n            document.body,\n        )\n    },\n)\n\nconst OpenCard = observer(({card}: {card: Card}) => {\n    const open = (\n        <IconButton\n            key=\"open\"\n            icon=\"open_in_new\"\n            outlined\n            label={i18n.open}\n            disabled={!card.file && !card.link}\n        />\n    )\n    const on_board_link_click = React.useCallback(() => {\n        ui_actions.hide_card_menus()\n        report_user_engagement(EngagementType.click_link)\n    }, [])\n    const on_link_click = React.useCallback(() => {\n        ui_actions.hide_card_menus()\n        report_user_engagement(EngagementType.click_link)\n    }, [])\n    const on_file_click = React.useCallback(() => {\n        ui_actions.hide_card_menus()\n        report_user_engagement(EngagementType.download_file)\n    }, [])\n    const on_image_click = React.useCallback(() => {\n        ui_actions.hide_card_menus()\n        ui_actions.open_lightbox(card)\n    }, [card])\n    const on_video_click = React.useCallback(() => {\n        ui_actions.hide_card_menus()\n        video_player_state.play({\n            blob_uid: card.file!.blob.uid,\n            mime_type: card.file!.blob.mime_type,\n            file_name: card.file!.file_name,\n        })\n    }, [card])\n    if (is_LinkCard(card)) {\n        const linked_board = extract_linked_board_and_card_uid(card.link.url)\n        if (linked_board && board_info_resource.read(linked_board.board_uid)) {\n            return (\n                <Link\n                    className=\"card-menu-mobile__open\"\n                    to={`/c/${linked_board.board_uid}${\n                        linked_board.card_uid ? \"/\" + linked_board.card_uid : \"\"\n                    }`}\n                    onClick={on_board_link_click}\n                    draggable={false}\n                >\n                    {open}\n                </Link>\n            )\n        }\n        return (\n            <LinkCardAnchor\n                card={card}\n                onClick={on_link_click}\n                className=\"card-menu-mobile__open\"\n                target=\"_blank\"\n            >\n                {open}\n            </LinkCardAnchor>\n        )\n    } else if (is_NoteCard(card)) {\n        return open\n    } else if (is_FileCard(card)) {\n        if (may_have_thumbnail(card.file.blob)) {\n            return React.cloneElement(open, {onClick: on_image_click})\n        }\n        if (is_playable_media(card)) {\n            return React.cloneElement(open, {onClick: on_video_click})\n        }\n        return (\n            <DefaultFileCardAnchor\n                blob_uid={card.file.blob.uid}\n                file_name={card.file.file_name}\n                className=\"card-menu-mobile__open\"\n                classNameFallback=\"card-menu-mobile__open--disabled\"\n                onClick={on_file_click}\n                onClickFallback={cancel_event}\n            >\n                {open}\n            </DefaultFileCardAnchor>\n        )\n    }\n    return null\n})\n\nexport const CardMenuDesktop = observer(\n    ({\n        card,\n        permissions,\n        has_visible_children,\n        onMouseDown,\n    }: {\n        card: Card\n        permissions: CardPermissions\n        has_visible_children: boolean\n        onMouseDown?: (e: React.MouseEvent<any>) => void\n    }) => {\n        const {\n            current_board: {board, display_version},\n        } = React.useContext(BoardContext)\n        if (!board) {\n            return null\n        }\n        const card_actions = _card_actions({card, has_visible_children, board})\n        const is = _switches({card, board})\n        const items = _items({card, board, has_visible_children, permissions}, card_actions, is)\n        const quick_items: (MenuItemProps | any)[] = []\n        const more_items: (MenuItemProps | any)[] = []\n        if (ui_state.search_state.is_search_narrowing_down) {\n            quick_items.push(\n                <Link\n                    key=\"search_go_to_card\"\n                    to={`/c/${card.board_uid}/${card.uid}`}\n                    draggable={false}\n                >\n                    {\n                        <IconButton\n                            key={items.search_go_to_card.title}\n                            icon={items.search_go_to_card.icon}\n                            small\n                            onClick={items.search_go_to_card.onClick}\n                            tooltip={items.search_go_to_card.title}\n                            data-test-id={items.search_go_to_card[\"data-test-id\"]}\n                        />\n                    }\n                </Link>,\n            )\n        } else if (display_version !== \"latest\") {\n            quick_items.push(\n                <Link\n                    key=\"history_go_to_card\"\n                    to={`/c/${card.board_uid}/${card.uid}`}\n                    draggable={false}\n                >\n                    {\n                        <IconButton\n                            key={items.history_go_to_card.title}\n                            icon={items.history_go_to_card.icon}\n                            small\n                            onClick={items.history_go_to_card.onClick}\n                            tooltip={items.history_go_to_card.title}\n                            data-test-id={items.history_go_to_card[\"data-test-id\"]}\n                        />\n                    }\n                </Link>,\n            )\n        }\n        if (permissions.can_move_card) {\n            quick_items.push(items.drag)\n        }\n        quick_items.push(items.collapse)\n        if (permissions.can_edit_card) {\n            quick_items.push(items.edit)\n        }\n        if (permissions.can_add_comment) {\n            more_items.push(items.comment)\n        }\n        if (permissions.can_edit_task) {\n            more_items.push(items.edit_task)\n        }\n        if (permissions.can_copy_card) {\n            more_items.push(items.copy_card)\n        }\n        if (permissions.can_move_card && !ui_state.search_state.all_boards) {\n            quick_items.push(items.dec_indent)\n            quick_items.push(items.inc_indent)\n        }\n        if (permissions.can_move_card) {\n            more_items.push(items.send_to_board)\n        }\n        if (permissions.can_cut_card) {\n            quick_items.push(items.cut_card)\n        }\n        if (permissions.can_add_card && !ui_state.search_state.all_boards) {\n            quick_items.push(items.paste_card)\n        }\n        more_items.push(items.print)\n        if (\n            permissions.can_remove_card ||\n            permissions.can_archive_card ||\n            permissions.can_report_abuse\n        ) {\n            more_items.push(<MenuItemDivider key=\"remove_divider\" />)\n            if (permissions.can_report_abuse) {\n                more_items.push(items.report_abuse)\n            }\n            if (permissions.can_archive_card) {\n                more_items.push(items.archive)\n            }\n            if (permissions.can_remove_card) {\n                more_items.push(items.remove)\n            }\n        }\n        if (card.file) {\n            quick_items.push(items.download)\n        }\n        if (!process.env.F_PUBLIC) {\n            more_items.push(<MenuItemDivider key=\"info_divider\" />)\n            more_items.push(<CardInfo key=\"info\" card={card} />)\n        }\n        // Calculate whether we have to move some quick-items to the more-menu based on\n        // column-width ...\n        // We are using broad estimations ...\n        const icon_width = 34\n        const width = ui_state.column_width - 24 /* base padding */ - card_level(card) * 12\n        let needed_width = (quick_items.length + 2) * icon_width\n        while (needed_width > width) {\n            more_items.unshift(quick_items.pop())\n            needed_width -= icon_width\n        }\n        return (\n            <nav className=\"card-menu card-menu-desktop\" data-test-id=\"CardMenu\">\n                <div className=\"card-menu-desktop__content\" onMouseDown={onMouseDown}>\n                    {quick_items.map((x) => {\n                        if (x.title) {\n                            return (\n                                <IconButton\n                                    className={x.className}\n                                    outlined={x.outlined !== false}\n                                    key={x.title}\n                                    icon={x.icon}\n                                    small\n                                    onClick={x.onClick}\n                                    onMouseDown={x.onMouseDown}\n                                    tooltip={with_shortcut(x.title, x.shortcut)}\n                                    data-test-id={x[\"data-test-id\"]}\n                                    disabled={x.disabled}\n                                />\n                            )\n                        }\n                        return x\n                    })}\n                    <Menu\n                        anchor={\n                            <IconButton\n                                icon=\"more_vert\"\n                                small\n                                tooltip={i18n.more}\n                                disabled={more_items.length === 0}\n                                data-test-id=\"CardMenu_more\"\n                            />\n                        }\n                        hoistedElementClassName=\"card-menu-desktop__mdc-menu\"\n                    >\n                        {more_items.map((x) =>\n                            !x.icon ? (\n                                x\n                            ) : (\n                                <MenuItem\n                                    key={x.title}\n                                    onClick={x.onClick}\n                                    title={x.title}\n                                    disabled={x.disabled}\n                                    className={x.className}\n                                    data-test-id={x[\"data-test-id\"]}\n                                    graphic={\n                                        <Icon\n                                            className={x.className}\n                                            outlined={x.outlined !== false}\n                                            icon={x.icon}\n                                            small={!running_on_mobile_device()}\n                                        />\n                                    }\n                                    meta={x.shortcut}\n                                />\n                            ),\n                        )}\n                    </Menu>\n                </div>\n            </nav>\n        )\n    },\n)\n\nconst CardInfo = observer(({card}: {card: Card}) => {\n    const direct_link_elm = React.createRef<HTMLInputElement>()\n    const copy_direct_link_to_clipboard = React.useCallback(() => {\n        if (direct_link_elm.current) {\n            direct_link_elm.current.select()\n            document.execCommand(\"copy\")\n            Snackbar.show_message(i18n.direct_link_to_card_copied_to_clipboard)\n        }\n    }, [direct_link_elm])\n    const {first_change, last_change} = card\n    const never_modified =\n        first_change.date.getTime() === last_change.date.getTime() &&\n        first_change.account_uid === last_change.account_uid\n    return (\n        <div className=\"card-menu-info\" data-test-id=\"CardMenu_info\">\n            <div className=\"card-menu-info__title\">{i18n.about_this_card}</div>\n            <div className=\"card-menu-info__caption\">{i18n.created}</div>\n            <div className=\"card-menu-info__content\">\n                <PrincipalInfo\n                    display=\"complete\"\n                    uid={first_change.account_uid}\n                    data-test-id=\"CardMenu_info_created_principal\"\n                />\n                <RelDate\n                    date={first_change.date}\n                    className=\"card-menu-info__rel-date\"\n                    data-test-id=\"CardMenu_info_created_date\"\n                />\n            </div>\n            {!never_modified && (\n                <>\n                    <div className=\"card-menu-info__caption\">{i18n.last_modified}</div>\n                    <div className=\"card-menu-info__content\">\n                        <PrincipalInfo\n                            display=\"complete\"\n                            uid={last_change.account_uid}\n                            data-test-id=\"CardMenu_info_last_modified_principal\"\n                        />\n                        <RelDate\n                            date={last_change.date}\n                            className=\"card-menu-info__rel-date\"\n                            data-test-id=\"CardMenu_info_last_modified_date\"\n                        />\n                    </div>\n                </>\n            )}\n            {!running_on_mobile_device() && (\n                <>\n                    <div className=\"card-menu-info__caption\">{i18n.direct_link}</div>\n                    <div className=\"card-menu-info__direct-link\">\n                        <input\n                            type=\"text\"\n                            value={card_deep_link(card)}\n                            ref={direct_link_elm}\n                            readOnly\n                        />\n                        <IconButton\n                            icon=\"content_copy\"\n                            outlined\n                            tooltip={i18n.copy_to_clipboard}\n                            onClick={copy_direct_link_to_clipboard}\n                            small\n                        />\n                    </div>\n                </>\n            )}\n        </div>\n    )\n})\n\nfunction _card_actions({\n    board,\n    card,\n    has_visible_children,\n}: {\n    board: Board\n    card: Card\n    has_visible_children: boolean\n}) {\n    return {\n        print: () => {\n            print_board(board, card)\n        },\n        dec_indent: () => {\n            if (running_on_mobile_device()) {\n                ui_actions.hide_card_menus()\n            }\n            model_actions.decrease_indent_if_possible(board, card)\n        },\n        inc_indent: () => {\n            if (running_on_mobile_device()) {\n                ui_actions.hide_card_menus()\n            }\n            model_actions.increase_indent_if_possible(\n                board,\n                card,\n                ui_state.search_state.visible_children(card.parent),\n            )\n        },\n        prev_card: () => {\n            const parent = card.parent as Card\n            const visible_cards = ui_state.search_state.visible_children(parent)\n            const pos = visible_cards.findIndex((x) => x.uid === card.uid)\n            if (pos) {\n                return visible_cards[pos - 1]\n            }\n        },\n        parent_card: () => {\n            const parent = card.parent\n            if (!parent.column && !parent.inbox) {\n                return parent\n            }\n        },\n        toggle_archived: () => {\n            ui_actions.hide_card_menus()\n            model_actions.toggle_card_archived(board, card)\n        },\n        send_to_board: () => {\n            ui_actions.hide_card_menus()\n            ui_actions.open_send_to_board_dialog({board, card})\n        },\n        cut_card: () => {\n            ui_actions.hide_card_menus()\n            model_actions.cut_card(board, card)\n        },\n        copy_card: () => {\n            ui_actions.hide_card_menus()\n            model_actions.copy_card(board, card)\n        },\n        paste_card_above_or_below: (e: React.MouseEvent) => {\n            ui_actions.hide_card_menus()\n            const pos = e.shiftKey\n                ? above_card_insert_pos(card)\n                : below_card_insert_pos(card, {has_visible_children})\n            model_actions.paste_card(board, pos)\n        },\n        remove: () => {\n            ui_actions.hide_card_menus()\n            model_actions.remove_card(board, card)\n        },\n        edit: () => {\n            ui_actions.hide_card_menus()\n            ui_actions.start_editing_card(card.board_uid, card.uid)\n        },\n        edit_task: () => {\n            ui_actions.hide_card_menus()\n            ui_actions.show_task_edit_dialog({board, card})\n        },\n        report_abuse: () => {\n            ui_actions.hide_card_menus()\n            ui_actions.open_report_abuse_dialog(board, card)\n        },\n        open_comments: () => {\n            ui_actions.hide_card_menus()\n            ui_actions.open_comments(card)\n        },\n        toggle_collapse: () => {\n            if (running_on_mobile_device()) {\n                ui_actions.hide_card_menus()\n            }\n            ui_actions.toggle_fully_collapsed(card)\n        },\n        drag: (e: React.MouseEvent) => {\n            if (\n                // Left mouse button was pressed.\n                !e.button &&\n                // No special key is pressed.\n                !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)\n            ) {\n                import(\"../drag_and_drop\")\n                    .then((mod) => mod.start_drag_card(e, card.uid, nop))\n                    .catch(report_error)\n            }\n        },\n        download_file: () => {\n            ui_actions.hide_card_menus()\n            const {file} = card as FileCard\n            download({blob_uid: file.blob.uid, file_name: file.file_name})\n        },\n        search_go_to_card: () => {\n            ui_actions.hide_card_menus()\n            ui_state.search_state.end_search({reset: true})\n            if (ui_state.current_board_uid !== board.uid) {\n                // We could just simply call `goto_board(board.uid, card.uid)` but we don't\n                // want to mess with the URL.\n                goto_board({board_uid: board.uid})\n                    .then(() => {\n                        setTimeout(() => ui_actions.highlight_card(card.uid))\n                    })\n                    .catch(report_error)\n            } else {\n                ui_actions.highlight_card(card.uid)\n            }\n        },\n        history_go_to_card: () => {\n            ui_actions.hide_card_menus()\n            ui_state.set_current_board_uid(not_null(ui_state.current_board_uid), \"latest\", () => {\n                setTimeout(() => ui_actions.highlight_card(card.uid))\n            })\n        },\n    }\n}\n\nfunction _switches({card, board}: {card: Card; board: Board}) {\n    return {\n        trashcan: board.board_type === BoardType.trashcan,\n        collapsed: !!ui_state.is_content_collapsed(card) || !!ui_state.is_children_collapsed(card),\n    }\n}\n\nfunction _items(\n    {\n        card,\n        board,\n        permissions,\n        has_visible_children,\n    }: {card: Card; board: Board; permissions: CardPermissions; has_visible_children: boolean},\n    card_actions: ReturnType<typeof _card_actions>,\n    is: ReturnType<typeof _switches>,\n) {\n    const has_comments = card.comments.length > 0\n    let new_comments_badge = false\n    for (const x of card.comments) {\n        if (ui_state.is_new_or_changed(x)) {\n            new_comments_badge = true\n            break\n        }\n    }\n    return {\n        print: {\n            icon: \"print\",\n            title: i18n.print,\n            onClick: card_actions.print,\n            disabled: false,\n        },\n        dec_indent: {\n            icon: \"arrow_back\",\n            title: i18n.decrease_indent,\n            onClick: card_actions.dec_indent,\n            disabled: !card_actions.parent_card() || !permissions.can_move_card,\n            shortcut: \"<\",\n        },\n        inc_indent: {\n            icon: \"arrow_forward\",\n            title: i18n.increase_indent,\n            onClick: card_actions.inc_indent,\n            disabled: !card_actions.prev_card() || !permissions.can_move_card,\n            shortcut: \">\",\n        },\n        archive: {\n            icon: card.archived ? \"unarchive\" : \"archive\",\n            title: i18n.toggle_archived(card.archived),\n            onClick: card_actions.toggle_archived,\n            outlined: !card.archived,\n            disabled: card.parent.archived,\n            className: \"card-menu__archive\",\n            shortcut: \"h\",\n        },\n        send_to_board: {\n            icon: \"forward\",\n            disabled: !permissions.can_move_card,\n            onClick: card_actions.send_to_board,\n            title: i18n.send_to_board,\n            \"data-test-id\": \"CardMenu_send_to_board\",\n        },\n        remove: {\n            icon: board.board_type === BoardType.trashcan ? \"delete_forever\" : \"delete\",\n            disabled: !permissions.can_remove_card,\n            onClick: card_actions.remove,\n            className: \"card-menu__remove\",\n            title: board.board_type === BoardType.trashcan ? i18n.remove_permanently : i18n.remove,\n            shortcut: \"r\",\n            \"data-test-id\": \"CardMenu_remove\",\n        },\n        cut_card: {\n            icon: \"content_cut\",\n            disabled: !permissions.can_cut_card,\n            onClick: card_actions.cut_card,\n            title: i18n.cut,\n            shortcut: \"x\",\n            \"data-test-id\": \"CardMenu_cut\",\n        },\n        copy_card: {\n            icon: \"content_copy\",\n            disabled: !permissions.can_copy_card,\n            onClick: card_actions.copy_card,\n            title: i18n.copy,\n            shortcut: \"c\",\n            \"data-test-id\": \"CardMenu_copy\",\n        },\n        paste_card: {\n            icon: \"content_paste\",\n            onClick: card_actions.paste_card_above_or_below,\n            disabled: ui_state.paste_disabled(permissions),\n            title: i18n.paste,\n            shortcut: \"v | Shift + V\",\n            \"data-test-id\": \"CardMenu_paste\",\n        },\n        let_user_paste_card: {\n            icon: \"content_paste\",\n            onClick: () => ui_actions.start_adding_pasting_new_card(\"paste\"),\n            disabled: ui_state.paste_disabled(permissions),\n            title: i18n.paste,\n            shortcut: \"v\",\n            \"data-test-id\": \"CardMenu_let_user_paste\",\n        },\n        let_user_add_card: {\n            icon: \"add_circle_outline\",\n            onClick: () => ui_actions.start_adding_pasting_new_card(\"add\"),\n            title: i18n.add_a_card,\n            shortcut: \"a\",\n            \"data-test-id\": \"CardMenu_let_user_add\",\n        },\n        collapse: {\n            icon: is.collapsed ? \"expand_more\" : \"expand_less\",\n            title: i18n.collapsed(is.collapsed),\n            disabled: !ui_state.is_content_collapsible(card) && !has_visible_children,\n            onClick: card_actions.toggle_collapse,\n            shortcut: \"(space)\",\n        },\n        drag: {\n            icon: \"drag_indicator\",\n            title: i18n.press_and_hold_left_mouse_button_to_drag_this_card,\n            \"data-test-id\": \"CardMenu_drag\",\n            onMouseDown: card_actions.drag,\n        },\n        comment: {\n            icon: \"comment\",\n            title: i18n.comments,\n            onClick: card_actions.open_comments,\n            outlined: !has_comments && !ui_state.comments_shown(card),\n            highlight: has_comments,\n            disabled: !permissions.can_add_comment,\n            badge: new_comments_badge,\n            \"data-test-id\": \"CardMenu_comment\",\n            shortcut: \"o\",\n        },\n        edit: {\n            icon: \"edit\",\n            title: i18n.edit,\n            onClick: card_actions.edit,\n            disabled: !permissions.can_edit_card,\n            \"data-test-id\": \"CardMenu_edit\",\n            shortcut: \"e\",\n        },\n        edit_task: {\n            icon: \"check_circle_outline\",\n            title: i18n.task,\n            onClick: card_actions.edit_task,\n            disabled: !permissions.can_edit_task,\n            \"data-test-id\": \"CardMenu_edit_task\",\n            shortcut: \"t\",\n        },\n        report_abuse: {\n            icon: \"flag\",\n            title: i18n.report,\n            onClick: card_actions.report_abuse,\n            disabled: !permissions.can_report_abuse,\n            \"data-test-id\": \"CardMenu_report_abuse\",\n        },\n        download: {\n            icon: \"cloud_download\",\n            title: i18n.download,\n            \"data-test-id\": \"CardMenu_download\",\n            onClick: card_actions.download_file,\n        },\n        share: {\n            icon: \"share\",\n            title: i18n.share,\n            onClick: () =>\n                (navigator as any)\n                    .share({\n                        title:\n                            card.link?.title || card.note?.title || card.file?.file_name || \"Cling\",\n                        url: card_deep_link(card),\n                    })\n                    .catch((error: any) => {\n                        if (!error.message?.includes(\"cancellation\")) {\n                            report_error(error)\n                        }\n                    }),\n        },\n        search_go_to_card: {\n            icon: \"crop_free\",\n            title: i18n.go_to_card,\n            onClick: (e?: React.MouseEvent) => {\n                if (e?.ctrlKey || e?.altKey || e?.metaKey) {\n                    // On desktop we wrap this element inside a `Link` element and want to enable\n                    // opening the card in a new tab ...\n                    return\n                }\n                card_actions.search_go_to_card()\n                cancel_event(e)\n            },\n            \"data-test-id\": \"CardMenu_search_go_to_card\",\n        },\n        history_go_to_card: {\n            icon: \"crop_free\",\n            title: i18n.go_to_card,\n            onClick: (e?: React.MouseEvent) => {\n                if (e?.ctrlKey || e?.altKey || e?.metaKey) {\n                    // On desktop we wrap this element inside a `Link` element and want to enable\n                    // opening the card in a new tab ...\n                    return\n                }\n                card_actions.history_go_to_card()\n                cancel_event(e)\n            },\n            \"data-test-id\": \"CardMenu_history_go_to_card\",\n        },\n    }\n}\n", "import {Card, TaskStatus} from \"@cling/lib.shared.model\"\nimport * as React from \"react\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {current_user, ui_actions} from \"../state/index\"\nimport {observer} from \"mobx-react\"\nimport {PrincipalInfo} from \"../account/principal_info\"\nimport {Icon} from \"@cling/lib.web.mdc\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {BoardContext} from \"../board_context\"\nimport {assert} from \"@cling/lib.shared.utils\"\n\nexport const Task = observer(\n    ({\n        card,\n        permissions,\n        className,\n    }: {\n        card: Card\n        permissions: {can_edit_task: boolean}\n        className?: string\n    }) => {\n        const {\n            current_board: {board, display_version},\n        } = React.useContext(BoardContext)\n        const {can_edit_task} = permissions\n        const on_click_on_task = React.useCallback(() => {\n            assert(\n                display_version === \"latest\",\n                \"Tasks can only be edited on the latest version of a board\",\n            )\n            if (!card.task || !board || !can_edit_task) {\n                return\n            }\n            ui_actions.show_task_edit_dialog({card, board})\n        }, [can_edit_task, card, board, display_version])\n        const {task} = card\n        if (!task) {\n            return null\n        }\n        return (\n            <aside\n                className={classNames(\"task\", className, {\n                    \"task--editable\": can_edit_task,\n                })}\n                onClick={can_edit_task ? on_click_on_task : undefined}\n                data-test-id=\"Task\"\n            >\n                <Icon\n                    icon={\n                        task.status === TaskStatus.task_open\n                            ? \"panorama_fish_eye\"\n                            : \"check_circle_outline\"\n                    }\n                    outlined\n                    small\n                    primary={can_edit_task}\n                />\n                {task.status === TaskStatus.task_open && task.date && (\n                    <>\n                        <div\n                            className={classNames(\"task__date\", {\n                                \"task__date--past\": task.date.getTime() - Date.now() < 0,\n                                \"task__date--near\":\n                                    task.date.getTime() - Date.now() < 24 * 60 * 60 * 1000 &&\n                                    task.date.getTime() - Date.now() >= 0,\n                                action: can_edit_task,\n                            })}\n                            data-test-id=\"Task_date\"\n                        >\n                            {i18n.date(task.date)}\n                        </div>\n                        <span>&nbsp;-&nbsp;</span>\n                    </>\n                )}\n                <div\n                    className={classNames(\"task__assignee\", {action: can_edit_task})}\n                    data-test-id=\"Task_assignee\"\n                >\n                    {task.status === TaskStatus.task_open && (\n                        <>\n                            {!task.assignee && i18n.no_one_is_working_on_it}\n                            {task.assignee === current_user.account.uid && i18n.i_am_working_on_it}\n                            {task.assignee &&\n                                task.assignee !== current_user.account.uid &&\n                                i18n.user_is_working_on_it(\n                                    <PrincipalInfo\n                                        uid={task.assignee}\n                                        display=\"full_name_no_teams\"\n                                    />,\n                                )}\n                        </>\n                    )}\n                    {task.status === TaskStatus.task_done && (\n                        <>\n                            {!task.assignee && i18n.somebody_did_it}\n                            {task.assignee === current_user.account.uid && i18n.i_did_it}\n                            {task.assignee &&\n                                task.assignee !== current_user.account.uid &&\n                                i18n.user_did_it(\n                                    <PrincipalInfo\n                                        uid={task.assignee}\n                                        display=\"full_name_no_teams\"\n                                    />,\n                                )}\n                        </>\n                    )}\n                </div>\n            </aside>\n        )\n    },\n)\n", "import * as React from \"react\"\nimport {\n    FileCard as FileCardModel,\n    ImageCardDisplayKind,\n    may_have_thumbnail,\n} from \"@cling/lib.shared.model\"\nimport {ImageFileCard} from \"./image_file_card\"\nimport {DefaultFileCard} from \"./default_file_card\"\nimport {observer} from \"mobx-react\"\n\ninterface Props {\n    card: FileCardModel\n}\n\n/**\n * This is just a very broad heuristic erring on the side of lower height.\n */\nexport function FileCard_estimated_height(card: FileCardModel) {\n    if (may_have_thumbnail(card.file.blob)) {\n        if (card.file.display.kind === ImageCardDisplayKind.cinema) {\n            return 210\n        }\n    }\n    return 60\n}\n\nexport const FileCard = observer(({card}: Props) => {\n    return may_have_thumbnail(card.file.blob) &&\n        (card.file.display.kind === ImageCardDisplayKind.cinema ||\n            card.file.display.kind === ImageCardDisplayKind.banner) ? (\n        <ImageFileCard card={card} />\n    ) : (\n        <DefaultFileCard card={card} />\n    )\n})\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport {FileCard} from \"@cling/lib.shared.model\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {Lightbox} from \"./lightbox\"\nimport {ImageCard} from \"./image_card\"\nimport {decorate_emojis} from \"@cling/lib.web.utils/decorate_emojis\"\nimport {title_tag} from \"./utils\"\nimport {video_player_state, is_playable_media} from \"./video_player\"\n\nexport const ImageFileCard = observer(({card}: {card: FileCard}) => {\n    const on_click = React.useCallback(\n        (e: React.MouseEvent<HTMLDivElement>) => {\n            e.preventDefault()\n            e.stopPropagation()\n            if (is_playable_media(card)) {\n                video_player_state.play({\n                    blob_uid: card.file!.blob.uid,\n                    mime_type: card.file!.blob.mime_type,\n                    file_name: card.file!.file_name,\n                })\n            } else {\n                ui_actions.open_lightbox(card)\n            }\n        },\n        [card],\n    )\n    const playable_media = is_playable_media(card)\n    const lightbox_shown = ui_state.lightbox_shown(card)\n    const matches = ui_state.search_state.search_matches(card)\n    const {title: title_text} = card.file\n    const title_html = title_text\n        ? ui_state.search_state.highlight_match(card, \"title\", matches)\n        : undefined\n    const TitleTag = title_tag(card)\n    return (\n        <>\n            <ImageCard\n                className=\"card-details\"\n                blob_uid_or_style={card.file.preview_image_blob?.uid || card.file.blob.uid}\n                card={card}\n                onClick={on_click}\n                display={card.file.display}\n                playable_media={playable_media}\n                title={\n                    !!title_text && (\n                        <TitleTag\n                            data-test-id=\"ImageFileCard_title\"\n                            dangerouslySetInnerHTML={{\n                                __html: decorate_emojis(title_html || title_text),\n                            }}\n                        />\n                    )\n                }\n            />\n            {lightbox_shown && <Lightbox initial_card={card} />}\n        </>\n    )\n})\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {\n    EngagementType,\n    NoteCard as NoteCardModel,\n    SetCardNoteSafeHtml,\n} from \"@cling/lib.shared.model\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport type {CardPermissions} from \"@cling/lib.web.resources\"\nimport {cancel_event} from \"@cling/lib.web.utils\"\nimport {\n    is_click_on_checkbox,\n    toggle_checklist_item,\n} from \"@cling/lib.web.rich_text_editor/toggle_checklist_item\"\nimport {decorate_emojis, emojis_should_be_large} from \"@cling/lib.web.utils/decorate_emojis\"\nimport {optimistic_update} from \"../state/patch\"\nimport {decorate_urls} from \"@cling/lib.web.utils/decorate_urls\"\nimport {confetti} from \"../misc/confetti\"\nimport {title_tag} from \"./utils\"\nimport {report_user_engagement} from \"@cling/lib.web.analytics\"\n\ninterface Props {\n    card: NoteCardModel\n    permissions: CardPermissions\n}\n\n/**\n * This is just a very broad heuristic erring on the side of lower height.\n */\nexport function NoteCard_estimated_height(card: NoteCardModel) {\n    let height = 38 // ... minimal base height\n    if (card.note.title) {\n        height = 44\n    }\n    height += 20 * (card.note.safe_html.match(/(<p>|<li)/) || []).length\n    return height\n}\n\nexport const NoteCard = observer(({card, permissions}: Props) => {\n    const container_ref = React.createRef<HTMLDivElement>()\n    const handle_click_on_checklist_item_check_box = React.useCallback(\n        (e: React.MouseEvent) => {\n            const container_div = container_ref.current\n            if (container_div && is_click_on_checkbox(e.nativeEvent)) {\n                cancel_event(e)\n                const target = e.target as HTMLElement\n                const {new_safe_html, checked} = toggle_checklist_item(\n                    card.note.safe_html,\n                    container_div,\n                    target,\n                )\n                report_user_engagement(EngagementType.edit_card)\n                optimistic_update(\n                    card.board_uid,\n                    new SetCardNoteSafeHtml({uid: card.uid, value: new_safe_html}),\n                )\n                if (checked) {\n                    confetti({x: e.pageX, y: e.pageY})\n                }\n                return true\n            }\n        },\n        [card, container_ref],\n    )\n    const handle_click_on_link = React.useCallback((e: React.MouseEvent) => {\n        // We want the default behaviour, when the user clicks on a link,\n        // therefore we just return `true` here, if the user clicked on a link ...\n        const res = (e.nativeEvent.target as undefined | HTMLElement)?.tagName === \"A\"\n        if (res) {\n            e.stopPropagation()\n        }\n        return res\n    }, [])\n    const handle_click = React.useCallback(\n        (e: React.MouseEvent<any>) => {\n            // Ignore click if the user selected text ...\n            const selection = window.getSelection()\n            if (\n                selection &&\n                selection.toString().length > 0 &&\n                selection.containsNode(e.target as Node, true)\n            ) {\n                return\n            }\n            if (permissions.can_edit_card) {\n                if (!(handle_click_on_checklist_item_check_box(e) || handle_click_on_link(e))) {\n                    cancel_event(e)\n                    let pos: undefined | {left: number; top: number}\n                    const container_div = container_ref.current\n                    if (container_div && e.clientX) {\n                        const r = container_div.getBoundingClientRect()\n                        pos = {left: e.clientX - r.left, top: e.clientY - r.top}\n                        if (!card.note.title) {\n                            pos.top += 24\n                        }\n                    }\n                    ui_actions.start_editing_card(card.board_uid, card.uid, {pos})\n                }\n            }\n        },\n        [\n            card,\n            container_ref,\n            handle_click_on_checklist_item_check_box,\n            handle_click_on_link,\n            permissions,\n        ],\n    )\n    const show_more = React.useCallback(\n        (e: React.SyntheticEvent) => {\n            e.stopPropagation()\n            e.preventDefault()\n            ui_actions.toggle_content_collapsed(card)\n        },\n        [card],\n    )\n    const matches = ui_state.search_state.search_matches(card)\n    const title_html = ui_state.search_state.highlight_match(card, \"title\", matches)\n    const safe_html = ui_state.search_state.highlight_match(card, \"safe_html\", matches)\n    const large_emojis = emojis_should_be_large(safe_html)\n    const condensed = ui_state.is_content_collapsed(card)\n    const TitleTag = title_tag(card)\n    return (\n        <div\n            ref={container_ref}\n            className={classNames(\"note-card card-details\", {\n                \"note-card--condensed\": condensed,\n            })}\n            onClick={handle_click}\n        >\n            {title_html && (\n                <>\n                    <TitleTag\n                        className=\"note-card__title rich-text\"\n                        data-test-id=\"NoteCard_title\"\n                        dangerouslySetInnerHTML={{\n                            __html: decorate_urls(decorate_emojis(title_html)),\n                        }}\n                    />\n                    {condensed && safe_html && (\n                        <a\n                            className=\"action note-card__more\"\n                            onClick={show_more}\n                            data-test-id=\"NoteCard_more\"\n                            draggable={false}\n                        >\n                            {i18n.more_expand}\n                        </a>\n                    )}\n                </>\n            )}\n            {safe_html && (!title_html || !condensed) && (\n                <>\n                    <div\n                        className={classNames(\"note-card__html rich-text\", {\n                            \"note-card__html--with-title\": !!title_html,\n                        })}\n                        data-test-id=\"NoteCard_safe_html\"\n                        dangerouslySetInnerHTML={{\n                            __html: decorate_urls(\n                                decorate_emojis(\n                                    safe_html,\n                                    large_emojis ? \"emoji emoji--large\" : \"emoji\",\n                                ),\n                            ),\n                        }}\n                    />\n                    {condensed && (\n                        <a\n                            className=\"action note-card__more\"\n                            onClick={show_more}\n                            data-test-id=\"NoteCard_more\"\n                            draggable={false}\n                        >\n                            {i18n.more_expand}\n                        </a>\n                    )}\n                </>\n            )}\n        </div>\n    )\n})\n", "const checklist_html_fragments = [\n    '<li role=\"option\" ',\n    'aria-checked=\"true\">',\n    'aria-checked=\"false\">',\n]\n\nexport function is_click_on_checkbox(e: MouseEvent) {\n    const target = e.target as HTMLElement\n    // Why the magic `6`? We have 6px between the checkbox and the text ...\n    return target?.tagName === \"LI\" && target.getAttribute(\"role\") === \"option\" && e.offsetX < 6\n}\n\nexport function toggle_checklist_item(\n    html: string,\n    html_container: HTMLElement,\n    target: HTMLElement,\n): {new_safe_html: string; checked: boolean} {\n    const checklist_items = Array.from(html_container.querySelectorAll('li[role=\"option\"]'))\n    const i = checklist_items.indexOf(target) + 1\n    const [checklist_item_li_prefix, checked_li_suffix, unchecked_li_suffix] =\n        checklist_html_fragments\n    const a = html.split(checklist_item_li_prefix)\n    const s = a[i]\n    let checked = false\n    if (s.startsWith(checked_li_suffix)) {\n        a[i] = unchecked_li_suffix + s.substr(checked_li_suffix.length)\n    } else if (s.startsWith(unchecked_li_suffix)) {\n        a[i] = checked_li_suffix + s.substr(unchecked_li_suffix.length)\n        checked = true\n    } else {\n        throw new Error(\"Unexpected html\")\n    }\n    return {new_safe_html: a.join(checklist_item_li_prefix), checked}\n}\n", "import * as React from \"react\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport type {Card} from \"@cling/lib.shared.model\"\n\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {card_level} from \"./utils\"\n\ninterface Props {\n    card: Card\n    error_code: string\n}\n\ninterface State {\n    error?: Error\n}\n\nexport class ErrorCard extends React.PureComponent<Props, State> {\n    state = {} as State\n\n    componentDidCatch(error: Error) {\n        report_error(\"ErrorCard.render() failed -- user does not see card\", error)\n        this.setState({error})\n    }\n\n    render() {\n        if (this.state.error) {\n            return null\n        }\n        const {card, error_code} = this.props\n        return (\n            <div\n                className={classNames(\n                    \"card card--no-user-select error-card\",\n                    `card--level-${card_level(this.props.card)}`,\n                    {\n                        \"card--archived\": card.archived,\n                    },\n                )}\n            >\n                <div className=\"note-card card-details rich-text\">\n                    <div className=\"note-card__html\">{i18n.error_displaying_card(error_code)}</div>\n                </div>\n            </div>\n        )\n    }\n}\n"],
  "mappings": "8rDAAAA,IAaO,IAAMC,GAAYC,EAAS,IAAM,CACpC,GAAM,CACF,cAAe,CAAC,MAAAC,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AA,CAAgB,GAAIuD,EAAqB,EAC1CG,EACAT,EAAClD,GAAA,CAAgB,GAAIwD,EAAqB,GAEzC,IAAM,CACH,MAAM,IAAI,MACN,4EACJ,CACJ,GAAG,CAEX,CACJ,CACJ,EAGJK,EACIX,EAACa,GAAA,CAAY,GAAGP,EAAG,YAAarB,IAC3BsB,EACGP,EAACc,GAAA,CAAU,GAAIR,EAAqB,EACpCE,EACAR,EAACe,GAAA,CAAU,GAAIT,EAAqB,EACpCG,EACAT,EAACgB,GAAA,CAAU,GAAIV,EAAqB,GAEnC,IAAM,CACH,MAAM,IAAI,MACN,iEACJ,CACJ,GAAG,CAEX,EAIJN,EAAC,OACG,IAAKb,EACL,UAAW8B,EAAW,CAClB,UAAW,CAACtD,EAAK,MACjB,WAAYuC,EACZ,aAAcC,EACd,sBAAuBxC,EAAK,MAC5B,4BAA6B0C,EAAiB,MAClD,CAAC,EACD,gBAAe1C,EAAK,IACpB,eAAa,aAEZgD,CACL,CAER,OAASO,EAAO,CACZ,IAAIC,EAAsB,GAC1B,GAAI,CACA,IAAIC,EAAIC,GAAgBH,CAAK,EACzBE,EAAE,OAAS,MACXA,EAAIA,EAAE,UAAU,EAAG,GAAG,EAAI,MAAQA,EAAE,UAAUA,EAAE,OAAS,GAAG,GAEhE,IAAME,EAAIC,GAAO,UAAO,KAAKH,CAAC,CAAC,EAC/BD,GAAuBG,EAAE,CAAC,EAAIA,EAAE,CAAC,CACrC,OAASE,EAAG,CACRC,EAAa,iCAAkCD,CAAC,CACpD,CACA,OAAAC,EACI,4DAA4DN,CAAmB,IAC/ED,CACJ,EACA1B,EAAe2B,CAAmB,EAC3BnB,EAACC,GAAA,CAAU,KAAMtC,EAAM,WAAYwD,EAAqB,CACnE,CACJ,CAAC",
  "names": ["init_compat_module", "NewElmFAB", "observer", "board", "display_version", "x", "BoardContext", "on_click_on_add", "q", "show_snackbar_if_board_size_soft_limit_is_exceeded", "add_immediately_pos", "should_add_immediately", "card_uid", "model_actions_default", "Note", "ui_actions", "on_click_on_paste", "on_cancel", "y", "on_keydown", "__name", "event", "ui_state", "permissions", "useCardPermission", "_", "classNames", "i18n", "Icon", "IconButton", "with_shortcut", "is_inbox_visible", "NewElmMiniFAB", "card", "pos", "on_add", "on_paste", "is_adding", "init_compat_module", "init_compat_module", "init_compat_module", "init_compat_module", "decorate_urls", "safe_html", "a", "find_urls", "r", "i", "offset", "length", "url", "malformed", "pretty_url", "__name", "init_compat_module", "init_compat_module", "CommentMenuDesktop", "observer", "comment", "permissions", "current_board", "x", "BoardContext", "on_remove", "q", "assert", "model_actions_default", "_", "IconButton", "i18n", "CommentMenuMobile", "open", "set_open", "d", "trap_browser_back_dispose", "A", "y", "ui_actions", "trap_browser_back", "show_menu", "hide_menu", "Rn", "ui_state", "Button", "Comment", "observer", "comment", "permissions", "desktop_menu_shown", "set_menu_shown", "d", "render_rel_date_callback", "q", "time_elm", "_", "show_menu", "hide_menu", "is_new_or_changed", "ui_state", "is_removed", "is_RemovedComment", "classNames", "current_user", "running_on_mobile_device", "CommentMenuDesktop", "PrincipalInfo", "RelDate", "CommentMenuMobile", "is_NoteComment", "NoteComment", "RemovedComment", "i18n", "matches", "safe_html", "large_emojis", "emojis_should_be_large", "decorate_urls", "decorate_emojis", "RichTextEditor", "React_lazy", "scroll_down", "elm", "__name", "Comments", "observer", "initial_focus", "comments", "card", "permissions", "className", "onMouseDown", "board", "display_version", "x", "BoardContext", "list_ref", "b", "rich_text_editor_ref", "A", "start_index", "set_start_index", "d", "valid_comment_entered", "set_valid_comment_entered", "max_length_exceeded", "set_max_length_exceeded", "should_scroll_into_view", "set_should_scroll_into_view", "running_on_mobile_device", "scroll_into_view_ref", "q", "es_default", "add_comment", "e", "safe_html", "LIMIT_HTML", "assert", "model_actions_default", "y", "interval_id", "new_max_length_exceeded", "new_valid_comment_entered", "decrease_start_index", "close", "ui_actions", "on_escape", "on_key_down", "ui_state", "runInAction", "_", "classNames", "IconButton", "i18n", "Button", "comment", "Comment", "current_user", "React_suspense", "init_compat_module", "import_router", "init_compat_module", "CardMenuMobile", "observer", "card", "permissions", "has_visible_children", "view_mode", "set_view_mode", "d", "open", "set_open", "show_menu", "q", "ui_actions", "on_click_info", "trap_browser_back_dispose", "A", "y", "reaction", "ui_state", "menus_shown", "trap_browser_back", "board", "display_version", "x", "BoardContext", "_", "classNames", "may_have_thumbnail", "IconButton", "card_actions", "_card_actions", "is", "_switches", "items", "_items", "quick_items", "i18n", "Rn", "CardSynopsisOneLiner", "OpenCard", "i", "CardInfo", "Button", "on_board_link_click", "report_user_engagement", "on_link_click", "on_file_click", "on_image_click", "on_video_click", "video_player_state", "is_LinkCard", "linked_board", "extract_linked_board_and_card_uid", "board_info_resource", "LinkCardAnchor", "is_NoteCard", "is_FileCard", "_n", "is_playable_media", "DefaultFileCardAnchor", "cancel_event", "CardMenuDesktop", "onMouseDown", "more_items", "MenuItemDivider", "icon_width", "width", "card_level", "needed_width", "with_shortcut", "Menu", "MenuItem", "Icon", "running_on_mobile_device", "direct_link_elm", "b", "copy_direct_link_to_clipboard", "Snackbar", "first_change", "last_change", "never_modified", "PrincipalInfo", "RelDate", "k", "card_deep_link", "__name", "print_board", "model_actions_default", "parent", "visible_cards", "pos", "e", "above_card_insert_pos", "below_card_insert_pos", "mod", "nop", "report_error", "file", "download", "goto_board", "not_null", "has_comments", "new_comments_badge", "error", "init_compat_module", "Task", "observer", "card", "permissions", "className", "board", "display_version", "x", "BoardContext", "can_edit_task", "on_click_on_task", "q", "assert", "ui_actions", "task", "_", "classNames", "Icon", "k", "i18n", "current_user", "PrincipalInfo", "import_router", "CardChrome", "observer", "card", "permissions", "visible_children", "className", "children", "render_card", "force_card_level", "board", "x", "BoardContext", "main_elm", "A", "on_mouse_over", "q", "ui_actions", "on_click_on_comments", "on_click_on_hidden_cards", "on_click_on_non_regular_board", "e", "ui_state", "update_main_ref", "elm", "runInAction", "scroll_container", "y", "children_collapsed", "render_collapsed_children", "T", "first_child", "last_child", "render_collapsed_cards", "__name", "hidden_card_uid", "num_cards_hidden", "_", "classNames", "Icon", "i18n", "render_dnd_preview", "dragged_card", "k", "render_children", "card_menus_shown", "is_new_or_changed", "level", "card_level", "comments_shown", "color", "matches_directly", "new_comments_badge", "is_highlighted", "show_comments_aux_line", "is_RemovedComment", "num_comments", "NewElmMiniFAB", "is_cling_hp", "running_on_mobile_device", "CardMenuMobile", "CardMenuDesktop", "Card", "board_name", "Task", "Comments", "init_compat_module", "init_compat_module", "ImageFileCard", "observer", "card", "on_click", "q", "e", "is_playable_media", "video_player_state", "ui_actions", "playable_media", "lightbox_shown", "ui_state", "matches", "title_text", "title_html", "TitleTag", "title_tag", "_", "k", "ImageCard", "decorate_emojis", "Lightbox", "FileCard_estimated_height", "card", "may_have_thumbnail", "__name", "FileCard", "observer", "_", "ImageFileCard", "DefaultFileCard", "init_compat_module", "checklist_html_fragments", "is_click_on_checkbox", "target", "__name", "toggle_checklist_item", "html", "html_container", "checklist_item_li_prefix", "checked_li_suffix", "unchecked_li_suffix", "a", "s", "checked", "NoteCard_estimated_height", "card", "height", "__name", "NoteCard", "observer", "permissions", "container_ref", "b", "handle_click_on_checklist_item_check_box", "q", "e", "container_div", "is_click_on_checkbox", "cancel_event", "target", "new_safe_html", "checked", "toggle_checklist_item", "report_user_engagement", "optimistic_update", "SetCardNoteSafeHtml", "confetti", "handle_click_on_link", "res", "handle_click", "selection", "pos", "r", "ui_actions", "show_more", "matches", "ui_state", "title_html", "safe_html", "large_emojis", "emojis_should_be_large", "condensed", "TitleTag", "title_tag", "_", "classNames", "k", "decorate_urls", "decorate_emojis", "i18n", "init_compat_module", "_ErrorCard", "N", "__publicField", "error", "report_error", "card", "error_code", "_", "classNames", "card_level", "i18n", "__name", "ErrorCard", "import_buffer", "CardChromeEditor", "React_lazy", "FileCardEditor", "LinkCardEditor", "NoteCardEditor", "TitleImageEditor", "UserMediaEditor", "intersection_observer", "scraped_by_search_bot", "entries", "entry", "runInAction", "ui_state", "elm", "estimated_card_height", "card", "height", "Note", "NoteCard_estimated_height", "Link", "LinkCard_estimated_height", "File", "FileCard_estimated_height", "Inbox", "Column", "Root", "assert_never", "sum", "x", "__name", "is_card_needed_for_highlighting", "target", "card_positions", "card_col", "target_col", "target_positions", "i", "Card", "observer", "dnd_ghost_ref", "force_card_level", "permissions", "useCardPermission", "error_code", "set_error_code", "d", "y", "profiler", "intersection_observer_elm", "A", "intersection_observer_ref", "q", "_", "ErrorCard", "is_dnd_ghost", "is_dnd_preview", "dont_delay_rendering", "visible_children", "p", "note", "link", "file", "editing_card", "children", "React_suspense", "CardChrome", "NoteCard", "LinkCard", "FileCard", "classNames", "error", "fallback_error_code", "s", "error_to_string", "a", "sha256", "e", "report_error"]
}