{ "version": 3, "sources": ["../../board_context.ts", "../../card/new_elm.tsx", "../../state/permission_hooks.ts", "../../card/card.tsx", "../../card/card_chrome.tsx", "../../comments/comments.tsx", "../../comments/comment.tsx", "../../../lib.web.utils/decorate_urls.ts", "../../misc/rel_date.tsx", "../../comments/comment_menu.tsx", "../../../../node_modules/compute-scroll-into-view/src/index.ts", "../../../../node_modules/scroll-into-view-if-needed/es/index.js", "../../../../node_modules/smooth-scroll-into-view-if-needed/es/index.js", "../../../lib.web.lazy_load/suspense.tsx", "../../card/utils.ts", "../../card/card_menu.tsx", "../../card/add_card_actions.ts", "../../misc/print.tsx", "../../../lib.shared.board_to_html/board_to_react.tsx", "../../../lib.shared.faas/constants.ts", "../../../lib.web.resources/thumbnails.ts", "../../card/link_card.tsx", "../../card/image_card.tsx", "../../card/lightbox.tsx", "../../../lib.web.motion/index.ts", "../../card/condensed_thumbnail.tsx", "../../state/update_board_queue.ts", "../../board/board_chooser_props.tsx", "../../card/default_file_card.tsx", "../../card/card_synopsis.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", "../../misc/_confetti.ts", "../../misc/confetti.tsx", "../../card/error_card.tsx", "../../../lib.web.rich_text_editor/index.ts"], "sourcesContent": ["import type {Board, BoardUID} from \"@cling/lib.shared.model\"\nimport * as React from \"react\"\n\nexport const BoardContext = React.createContext<{\n current_board: {board?: Board; display_version: \"latest\" | number}\n current_board_uid: BoardUID | undefined\n}>({\n current_board: {board: undefined, display_version: \"latest\"},\n current_board_uid: undefined,\n})\n", "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 type {Card} from \"@cling/lib.shared.model\"\nimport {BoardContext} from \"../board_context\"\nimport {current_user} from \"./index\"\nimport type {BoardPermissions, CardPermissions} from \"@cling/lib.web.resources\"\n\nexport function useCardPermission(card?: Card): CardPermissions {\n const {current_board} = React.useContext(BoardContext)\n if (!current_board.board || !card || card.board_uid !== current_board.board.uid) {\n return {\n can_add_comment: false,\n can_add_board: false,\n can_add_card: false,\n can_archive_card: false,\n can_copy_card: false,\n can_cut_card: false,\n can_edit_card: false,\n can_edit_task: false,\n can_move_card: false,\n can_remove_card: false,\n can_report_abuse: false,\n }\n }\n return current_user.card_permissions(current_board.board, current_board.display_version, card)\n}\n\nexport function useCurrentBoardPermission(): BoardPermissions {\n const {\n current_board: {board, display_version},\n } = React.useContext(BoardContext)\n const [permissions, set_permissions] = React.useState(\n board ? current_user.board_permissions(board, display_version) : undefined,\n )\n React.useEffect(() => {\n set_permissions(board ? current_user.board_permissions(board, display_version) : undefined)\n }, [board, display_version])\n if (!board || !permissions) {\n return {\n can_leave_board: false,\n can_archive_board: false,\n can_view_history: false,\n can_change_board_settings: false,\n can_change_board_common_settings: false,\n can_change_board_notification_settings: false,\n can_export_board: false,\n can_copy_board: false,\n can_import_data: false,\n can_join_video_meeting: false,\n can_remove_board: false,\n can_rename_board: false,\n can_set_custom_access_level: false,\n can_share_board: false,\n can_upload_board_background_image: false,\n could_export_board_in_cling_pro: false,\n could_set_custom_access_level_in_cling_pro: false,\n could_upload_board_background_image_in_cling_pro: false,\n could_view_whole_history: false,\n can_view_whole_history: false,\n }\n }\n return permissions\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 \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 * as React from \"react\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {the_now} from \"@cling/lib.shared.utils/the_now\"\nimport {simple_tooltip_event_handlers} from \"@cling/lib.web.mdc/simple_tooltip\"\n\n/**\n * Display a relative date and refresh whenever the string representation of the date changes.\n */\nexport const RelDate = ({\n date,\n render,\n className,\n \"data-test-id\": data_test_id,\n}: {\n date: Date\n // Will be called whenever the displayed relative date is going to change.\n render?: (time_elm: React.ReactElement<HTMLTimeElement>) => React.ReactElement<any>\n className?: string\n \"data-test-id\"?: string\n}) => {\n const [rendered_rel_date, set_rendered_rel_date] = React.useState<string>()\n React.useEffect(() => {\n let timeout_id: any\n const update = () => {\n set_rendered_rel_date(i18n.format_rel_date(date))\n timeout_id = setTimeout(\n update,\n the_now() - date.getTime() < 60000\n ? 1000\n : Math.floor(Math.random() * 10000) + 30000,\n )\n }\n update()\n return () => clearTimeout(timeout_id)\n }, [date])\n const time_elm = (\n <time\n aria-label={i18n.datetime(date)}\n className={className}\n dateTime={date.toISOString()}\n data-test-id={data_test_id}\n data-test-ignore\n {...simple_tooltip_event_handlers}\n >\n {rendered_rel_date}\n </time>\n )\n return render ? render(time_elm) : time_elm\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", "// Compute what scrolling needs to be done on required scrolling boxes for target to be in view\n\n// The type names here are named after the spec to make it easier to find more information around what they mean:\n// To reduce churn and reduce things that need be maintained things from the official TS DOM library is used here\n// https://drafts.csswg.org/cssom-view/\n\n// For a definition on what is \"block flow direction\" exactly, check this: https://drafts.csswg.org/css-writing-modes-4/#block-flow-direction\n\n// add support for visualViewport object currently implemented in chrome\ninterface visualViewport {\n height: number\n width: number\n}\n\ntype ScrollLogicalPosition = 'start' | 'center' | 'end' | 'nearest'\n// This new option is tracked in this PR, which is the most likely candidate at the time: https://github.com/w3c/csswg-drafts/pull/1805\ntype ScrollMode = 'always' | 'if-needed'\n// New option that skips auto-scrolling all nodes with overflow: hidden set\n// See FF implementation: https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18\ntype SkipOverflowHiddenElements = boolean\n\ninterface Options {\n block?: ScrollLogicalPosition\n inline?: ScrollLogicalPosition\n scrollMode?: ScrollMode\n boundary?: CustomScrollBoundary\n skipOverflowHiddenElements?: SkipOverflowHiddenElements\n}\n\n// Custom behavior, not in any spec\ntype CustomScrollBoundaryCallback = (parent: Element) => boolean\ntype CustomScrollBoundary = Element | CustomScrollBoundaryCallback | null\ninterface CustomScrollAction {\n el: Element\n top: number\n left: number\n}\n\n// @TODO better shadowdom test, 11 = document fragment\nfunction isElement(el: any): el is Element {\n return typeof el === 'object' && el != null && el.nodeType === 1\n}\n\nfunction canOverflow(\n overflow: string | null,\n skipOverflowHiddenElements?: boolean\n) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false\n }\n\n return overflow !== 'visible' && overflow !== 'clip'\n}\n\nfunction getFrameElement(el: Element) {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null\n }\n\n try {\n return el.ownerDocument.defaultView.frameElement\n } catch (e) {\n return null\n }\n}\n\nfunction isHiddenByFrame(el: Element): boolean {\n const frame = getFrameElement(el)\n if (!frame) {\n return false\n }\n\n return (\n frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth\n )\n}\n\nfunction isScrollable(el: Element, skipOverflowHiddenElements?: boolean) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n const style = getComputedStyle(el, null)\n return (\n canOverflow(style.overflowY, skipOverflowHiddenElements) ||\n canOverflow(style.overflowX, skipOverflowHiddenElements) ||\n isHiddenByFrame(el)\n )\n }\n\n return false\n}\n/**\n * Find out which edge to align against when logical scroll position is \"nearest\"\n * Interesting fact: \"nearest\" works similarily to \"if-needed\", if the element is fully visible it will not scroll it\n *\n * Legends:\n * ┌────────┠┠┠┠┠┓\n * │ target │ frame\n * └────────┘ â”— â” â” â” â”›\n */\nfunction alignNearest(\n scrollingEdgeStart: number,\n scrollingEdgeEnd: number,\n scrollingSize: number,\n scrollingBorderStart: number,\n scrollingBorderEnd: number,\n elementEdgeStart: number,\n elementEdgeEnd: number,\n elementSize: number\n) {\n /**\n * If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B\n *\n * ┌──â”\n * â”â”│â”â”│â”┓\n * │ │\n * ┃ │ │ ┃ do nothing\n * │ │\n * â”—â”│â”â”│â”â”›\n * └──┘\n *\n * If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D\n *\n * ┠┠┠┠┠┓\n * ┌───────────â”\n * │┃ ┃│ do nothing\n * └───────────┘\n * â”— â” â” â” â” â”›\n */\n if (\n (elementEdgeStart < scrollingEdgeStart &&\n elementEdgeEnd > scrollingEdgeEnd) ||\n (elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd)\n ) {\n return 0\n }\n\n /**\n * If element edge A is outside scrolling box edge A and element height is less than scrolling box height\n *\n * ┌──â”\n * â”â”│â”â”│â”┓ â”â”┌â”â”â”â”┓\n * └──┘ │ │\n * from ┃ ┃ to ┃ └──┘ ┃\n *\n * â”—â” â”â” â”â”› â”—â” â”â” â”â”›\n *\n * If element edge B is outside scrolling box edge B and element height is greater than scrolling box height\n *\n * â”â” â”â” â”┓ â”â”┌â”â”â”â”┓\n * │ │\n * from ┃ ┌──┠┃ to ┃ │ │ ┃\n * │ │ │ │\n * â”—â”│â”â”│â”â”› â”—â”│â”â”│â”â”›\n * │ │ └──┘\n * │ │\n * └──┘\n *\n * If element edge C is outside scrolling box edge C and element width is less than scrolling box width\n *\n * from to\n * ┠┠┠┠┠┓ ┠┠┠┠┠┓\n * ┌───┠┌───â”\n * │ ┃ │ ┃ ┃ │ ┃\n * └───┘ └───┘\n * â”— â” â” â” â” â”› â”— â” â” â” â” â”›\n *\n * If element edge D is outside scrolling box edge D and element width is greater than scrolling box width\n *\n * from to\n * ┠┠┠┠┠┓ ┠┠┠┠┠┓\n * ┌───────────┠┌───────────â”\n * ┃ │ ┃ │ ┃ ┃ │\n * └───────────┘ └───────────┘\n * â”— â” â” â” â” â”› â”— â” â” â” â” â”›\n */\n if (\n (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize) ||\n (elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)\n ) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart\n }\n\n /**\n * If element edge B is outside scrolling box edge B and element height is less than scrolling box height\n *\n * â”â” â”â” â”┓ â”â” â”â” â”┓\n *\n * from ┃ ┃ to ┃ ┌──┠┃\n * ┌──┠│ │\n * â”—â”│â”â”│â”â”› â”—â”â””â”â”┘â”â”›\n * └──┘\n *\n * If element edge A is outside scrolling box edge A and element height is greater than scrolling box height\n *\n * ┌──â”\n * │ │\n * │ │ ┌──â”\n * â”â”│â”â”│â”┓ â”â”│â”â”│â”┓\n * │ │ │ │\n * from ┃ └──┘ ┃ to ┃ │ │ ┃\n * │ │\n * â”—â” â”â” â”â”› â”—â”â””â”â”┘â”â”›\n *\n * If element edge C is outside scrolling box edge C and element width is greater than scrolling box width\n *\n * from to\n * ┠┠┠┠┠┓ ┠┠┠┠┠┓\n * ┌───────────┠┌───────────â”\n * │ ┃ │ ┃ │ ┃ ┃\n * └───────────┘ └───────────┘\n * â”— â” â” â” â” â”› â”— â” â” â” â” â”›\n *\n * If element edge D is outside scrolling box edge D and element width is less than scrolling box width\n *\n * from to\n * ┠┠┠┠┠┓ ┠┠┠┠┠┓\n * ┌───┠┌───â”\n * ┃ │ ┃ │ ┃ │ ┃\n * └───┘ └───┘\n * â”— â” â” â” â” â”› â”— â” â” â” â” â”›\n *\n */\n if (\n (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize) ||\n (elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)\n ) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd\n }\n\n return 0\n}\n\nexport default (target: Element, options: Options): CustomScrollAction[] => {\n //TODO: remove this hack when microbundle will support typescript >= 4.0\n const windowWithViewport = (window as unknown) as Window & {\n visualViewport: visualViewport\n }\n\n const {\n scrollMode,\n block,\n inline,\n boundary,\n skipOverflowHiddenElements,\n } = options\n // Allow using a callback to check the boundary\n // The default behavior is to check if the current target matches the boundary element or not\n // If undefined it'll check that target is never undefined (can happen as we recurse up the tree)\n const checkBoundary =\n typeof boundary === 'function' ? boundary : (node: any) => node !== boundary\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target')\n }\n\n // Used to handle the top most element that can be scrolled\n const scrollingElement = document.scrollingElement || document.documentElement\n\n // Collect all the scrolling boxes, as defined in the spec: https://drafts.csswg.org/cssom-view/#scrolling-box\n const frames: Element[] = []\n let cursor: Element | null = target\n while (isElement(cursor) && checkBoundary(cursor)) {\n // Move cursor to parent\n cursor = cursor.parentElement\n\n // Stop when we reach the viewport\n if (cursor === scrollingElement) {\n frames.push(cursor)\n break\n }\n\n // Skip document.body if it's not the scrollingElement and documentElement isn't independently scrollable\n if (\n cursor != null &&\n cursor === document.body &&\n isScrollable(cursor) &&\n !isScrollable(document.documentElement)\n ) {\n continue\n }\n\n // Now we check if the element is scrollable, this code only runs if the loop haven't already hit the viewport or a custom boundary\n if (cursor != null && isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor)\n }\n }\n\n // Support pinch-zooming properly, making sure elements scroll into the visual viewport\n // Browsers that don't support visualViewport will report the layout viewport dimensions on document.documentElement.clientWidth/Height\n // and viewport dimensions on window.innerWidth/Height\n // https://www.quirksmode.org/mobile/viewports2.html\n // https://bokand.github.io/viewport/index.html\n const viewportWidth = windowWithViewport.visualViewport\n ? windowWithViewport.visualViewport.width\n : innerWidth\n const viewportHeight = windowWithViewport.visualViewport\n ? windowWithViewport.visualViewport.height\n : innerHeight\n\n // Newer browsers supports scroll[X|Y], page[X|Y]Offset is\n const viewportX = window.scrollX || pageXOffset\n const viewportY = window.scrollY || pageYOffset\n\n const {\n height: targetHeight,\n width: targetWidth,\n top: targetTop,\n right: targetRight,\n bottom: targetBottom,\n left: targetLeft,\n } = target.getBoundingClientRect()\n\n // These values mutate as we loop through and generate scroll coordinates\n let targetBlock: number =\n block === 'start' || block === 'nearest'\n ? targetTop\n : block === 'end'\n ? targetBottom\n : targetTop + targetHeight / 2 // block === 'center\n let targetInline: number =\n inline === 'center'\n ? targetLeft + targetWidth / 2\n : inline === 'end'\n ? targetRight\n : targetLeft // inline === 'start || inline === 'nearest\n\n // Collect new scroll positions\n const computations: CustomScrollAction[] = []\n // In chrome there's no longer a difference between caching the `frames.length` to a var or not, so we don't in this case (size > speed anyways)\n for (let index = 0; index < frames.length; index++) {\n const frame = frames[index]\n\n // @TODO add a shouldScroll hook here that allows userland code to take control\n\n const {\n height,\n width,\n top,\n right,\n bottom,\n left,\n } = frame.getBoundingClientRect()\n\n // If the element is already visible we can end it here\n // @TODO targetBlock and targetInline should be taken into account to be compliant with https://github.com/w3c/csswg-drafts/pull/1805/files#diff-3c17f0e43c20f8ecf89419d49e7ef5e0R1333\n if (\n scrollMode === 'if-needed' &&\n targetTop >= 0 &&\n targetLeft >= 0 &&\n targetBottom <= viewportHeight &&\n targetRight <= viewportWidth &&\n targetTop >= top &&\n targetBottom <= bottom &&\n targetLeft >= left &&\n targetRight <= right\n ) {\n // Break the loop and return the computations for things that are not fully visible\n return computations\n }\n\n const frameStyle = getComputedStyle(frame)\n const borderLeft = parseInt(frameStyle.borderLeftWidth as string, 10)\n const borderTop = parseInt(frameStyle.borderTopWidth as string, 10)\n const borderRight = parseInt(frameStyle.borderRightWidth as string, 10)\n const borderBottom = parseInt(frameStyle.borderBottomWidth as string, 10)\n\n let blockScroll: number = 0\n let inlineScroll: number = 0\n\n // The property existance checks for offfset[Width|Height] is because only HTMLElement objects have them, but any Element might pass by here\n // @TODO find out if the \"as HTMLElement\" overrides can be dropped\n const scrollbarWidth =\n 'offsetWidth' in frame\n ? (frame as HTMLElement).offsetWidth -\n (frame as HTMLElement).clientWidth -\n borderLeft -\n borderRight\n : 0\n const scrollbarHeight =\n 'offsetHeight' in frame\n ? (frame as HTMLElement).offsetHeight -\n (frame as HTMLElement).clientHeight -\n borderTop -\n borderBottom\n : 0\n\n if (scrollingElement === frame) {\n // Handle viewport logic (document.documentElement or document.body)\n\n if (block === 'start') {\n blockScroll = targetBlock\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight\n } else if (block === 'nearest') {\n blockScroll = alignNearest(\n viewportY,\n viewportY + viewportHeight,\n viewportHeight,\n borderTop,\n borderBottom,\n viewportY + targetBlock,\n viewportY + targetBlock + targetHeight,\n targetHeight\n )\n } else {\n // block === 'center' is the default\n blockScroll = targetBlock - viewportHeight / 2\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth\n } else {\n // inline === 'nearest' is the default\n inlineScroll = alignNearest(\n viewportX,\n viewportX + viewportWidth,\n viewportWidth,\n borderLeft,\n borderRight,\n viewportX + targetInline,\n viewportX + targetInline + targetWidth,\n targetWidth\n )\n }\n\n // Apply scroll position offsets and ensure they are within bounds\n // @TODO add more test cases to cover this 100%\n blockScroll = Math.max(0, blockScroll + viewportY)\n inlineScroll = Math.max(0, inlineScroll + viewportX)\n } else {\n // Handle each scrolling frame that might exist between the target and the viewport\n\n if (block === 'start') {\n blockScroll = targetBlock - top - borderTop\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight\n } else if (block === 'nearest') {\n blockScroll = alignNearest(\n top,\n bottom,\n height,\n borderTop,\n borderBottom + scrollbarHeight,\n targetBlock,\n targetBlock + targetHeight,\n targetHeight\n )\n } else {\n // block === 'center' is the default\n blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - left - borderLeft\n } else if (inline === 'center') {\n inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth\n } else {\n // inline === 'nearest' is the default\n inlineScroll = alignNearest(\n left,\n right,\n width,\n borderLeft,\n borderRight + scrollbarWidth,\n targetInline,\n targetInline + targetWidth,\n targetWidth\n )\n }\n\n const { scrollLeft, scrollTop } = frame\n // Ensure scroll coordinates are not out of bounds while applying scroll offsets\n blockScroll = Math.max(\n 0,\n Math.min(\n scrollTop + blockScroll,\n frame.scrollHeight - height + scrollbarHeight\n )\n )\n inlineScroll = Math.max(\n 0,\n Math.min(\n scrollLeft + inlineScroll,\n frame.scrollWidth - width + scrollbarWidth\n )\n )\n\n // Cache the offset so that parent frames can scroll this into view correctly\n targetBlock += scrollTop - blockScroll\n targetInline += scrollLeft - inlineScroll\n }\n\n computations.push({ el: frame, top: blockScroll, left: inlineScroll })\n }\n\n return computations\n}\n", "import compute from 'compute-scroll-into-view';\n\nfunction isOptionsObject(options) {\n return options === Object(options) && Object.keys(options).length !== 0;\n}\n\nfunction defaultBehavior(actions, behavior) {\n if (behavior === void 0) {\n behavior = 'auto';\n }\n\n var canSmoothScroll = ('scrollBehavior' in document.body.style);\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n\n if (el.scroll && canSmoothScroll) {\n el.scroll({\n top: top,\n left: left,\n behavior: behavior\n });\n } else {\n el.scrollTop = top;\n el.scrollLeft = left;\n }\n });\n}\n\nfunction getOptions(options) {\n if (options === false) {\n return {\n block: 'end',\n inline: 'nearest'\n };\n }\n\n if (isOptionsObject(options)) {\n return options;\n }\n\n return {\n block: 'start',\n inline: 'nearest'\n };\n}\n\nfunction scrollIntoView(target, options) {\n var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);\n\n if (isOptionsObject(options) && typeof options.behavior === 'function') {\n return options.behavior(isTargetAttached ? compute(target, options) : []);\n }\n\n if (!isTargetAttached) {\n return;\n }\n\n var computeOptions = getOptions(options);\n return defaultBehavior(compute(target, computeOptions), computeOptions.behavior);\n}\n\nexport default scrollIntoView;", "import scrollIntoView from 'scroll-into-view-if-needed';\nvar memoizedNow;\n\nvar now = function now() {\n if (!memoizedNow) {\n memoizedNow = 'performance' in window ? performance.now.bind(performance) : Date.now;\n }\n\n return memoizedNow();\n};\n\nfunction step(context) {\n var time = now();\n var elapsed = Math.min((time - context.startTime) / context.duration, 1);\n var value = context.ease(elapsed);\n var currentX = context.startX + (context.x - context.startX) * value;\n var currentY = context.startY + (context.y - context.startY) * value;\n context.method(currentX, currentY);\n\n if (currentX !== context.x || currentY !== context.y) {\n requestAnimationFrame(function () {\n return step(context);\n });\n } else {\n context.cb();\n }\n}\n\nfunction smoothScroll(el, x, y, duration, ease, cb) {\n if (duration === void 0) {\n duration = 600;\n }\n\n if (ease === void 0) {\n ease = function ease(t) {\n return 1 + --t * t * t * t * t;\n };\n }\n\n var scrollable;\n var startX;\n var startY;\n var method;\n scrollable = el;\n startX = el.scrollLeft;\n startY = el.scrollTop;\n\n method = function method(x, y) {\n el.scrollLeft = Math.ceil(x);\n el.scrollTop = Math.ceil(y);\n };\n\n step({\n scrollable: scrollable,\n method: method,\n startTime: now(),\n startX: startX,\n startY: startY,\n x: x,\n y: y,\n duration: duration,\n ease: ease,\n cb: cb\n });\n}\n\nvar shouldSmoothScroll = function shouldSmoothScroll(options) {\n return options && !options.behavior || options.behavior === 'smooth';\n};\n\nfunction scroll(target, options) {\n var overrides = options || {};\n\n if (shouldSmoothScroll(overrides)) {\n return scrollIntoView(target, {\n block: overrides.block,\n inline: overrides.inline,\n scrollMode: overrides.scrollMode,\n boundary: overrides.boundary,\n behavior: function behavior(actions) {\n return Promise.all(actions.reduce(function (results, _ref) {\n var el = _ref.el,\n left = _ref.left,\n top = _ref.top;\n var startLeft = el.scrollLeft;\n var startTop = el.scrollTop;\n\n if (startLeft === left && startTop === top) {\n return results;\n }\n\n return [].concat(results, [new Promise(function (resolve) {\n return smoothScroll(el, left, top, overrides.duration, overrides.ease, function () {\n return resolve({\n el: el,\n left: [startLeft, left],\n top: [startTop, top]\n });\n });\n })]);\n }, []));\n }\n });\n }\n\n return Promise.resolve(scrollIntoView(target, options));\n}\n\nvar smoothScrollIntoView = scroll;\nexport default smoothScrollIntoView;", "/**\n * Support for lazy loading using React.lazy and React.Suspense.\n */\nimport React from \"react\"\nimport {LoadingIndicator} from \"./loading_indicator\"\n\n/**\n * @param mode if `eager_load` is given then the module will start loading in a few seconds. This\n * helps preventing flickering and short delays on first render.\n */\nexport function React_lazy(mod: () => Promise<{default: any}>, mode?: \"eager_load\") {\n if (mode === \"eager_load\") {\n let m: any = undefined\n setTimeout(() => (m = mod()), 8000 + Math.ceil(Math.random() * 8000))\n return React.lazy(() => m ?? mod())\n }\n return React.lazy(mod)\n}\n\nexport const React_suspense = ({children}: {children: any}) => {\n return <React.Suspense fallback={<LoadingIndicator delay={1000} />}>{children}</React.Suspense>\n}\n", "import type {Card} from \"@cling/lib.shared.model\"\nimport {ui_state} from \"../state/index\"\n\nexport function card_level(card: Card) {\n return ui_state.search_state.all_boards ? 2 : card.level\n}\n\nexport function title_tag(card: Card) {\n return `h${Math.min(6, card_level(card))}` as \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\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 {ui_actions, ui_state} from \"../state/index\"\nimport model_actions from \"../state/model_actions\"\nimport {\n Note,\n Link,\n GetUploadBlobURLRequest,\n GetUploadBlobURLResponse,\n Blob,\n File as FileModel,\n Board,\n Card,\n ImageCardDisplay,\n is_image,\n CardColor,\n ImageCardDisplayKind,\n} from \"@cling/lib.shared.model\"\nimport {\n cancel_uploads,\n let_user_select_files,\n upload_files,\n check_blob_quota_limits,\n add_provisional_thumbnail_for_uploaded_file,\n} from \"../upload/upload\"\nimport {call_function} from \"@cling/lib.shared.faas\"\nimport {board_resource} from \"@cling/lib.web.resources\"\nimport {Snackbar} from \"@cling/lib.web.mdc\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport type {InsertPos} from \"../state/types\"\nimport {runInAction} from \"mobx\"\nimport {not_null} from \"@cling/lib.shared.utils\"\nimport {sanitize_file_name} from \"@cling/lib.shared.utils/file_name\"\n\nexport class AddCardActions {\n constructor(\n private readonly board: Board,\n private readonly insert_pos_provider: () => InsertPos,\n ) {}\n\n add_note = (opts?: {special_editor?: \"title\" | \"audio\" | \"video\" | \"photo\"}) => {\n this._add_note_or_link({note: new Note({})}, opts)\n }\n\n add_link = () => {\n this._add_note_or_link({link: new Link({})})\n }\n\n paste = () => {\n model_actions.paste_card(this.board, this.insert_pos_provider())\n }\n\n add_file = async () => {\n const files = await let_user_select_files({multiple: true})\n return this.add_files(files.map((x) => ({file: x})))\n }\n\n add_files = async (\n files: {file: File; file_name?: string; title?: string; card_color?: CardColor}[],\n ) => {\n let {board} = this\n const insert_pos = this.insert_pos_provider()\n ui_actions.hide_global_backdrop()\n if (files.length === 0) {\n return\n }\n if (!check_blob_quota_limits(files.map((x) => x.file))) {\n return\n }\n upload_files({\n files,\n get_upload_url: async (o: {mime_type: string; md5_base64: string; size: number}) =>\n call_function(new GetUploadBlobURLRequest(o), GetUploadBlobURLResponse),\n on_progress: () => {\n try {\n board.card(insert_pos.target_card_uid)\n } catch {\n // Target card has been removed from board.\n cancel_uploads()\n Snackbar.show_message(i18n.upload_canceled)\n }\n },\n on_file_uploaded: async ({blob_uid, file, mime_type, md5_base64}) => {\n if (mime_type.startsWith(\"image/\") && !mime_type.includes(\"svg\")) {\n await add_provisional_thumbnail_for_uploaded_file({file: file.file, blob_uid})\n }\n const blob = new Blob({\n uid: blob_uid,\n size: file.file.size,\n mime_type,\n md5_base64,\n })\n // Make sure we use the latest board version\n board = not_null(board_resource.read(board.uid))\n const new_card_uid = model_actions.add_file_card(\n board,\n insert_pos,\n new FileModel({\n blob,\n file_name:\n sanitize_file_name(file.file_name || file.file.name) || \"unknown.bin\",\n title: file.title,\n display: new ImageCardDisplay({\n kind: is_image(blob)\n ? ImageCardDisplayKind.cinema\n : ImageCardDisplayKind.condensed,\n }),\n }),\n file.card_color,\n )\n if (new_card_uid) {\n // Make sure we use the patched board.\n board = not_null(board_resource.read(board.uid))\n const parent = board.card(new_card_uid).parent\n if (parent.column) {\n // Ok, we added a column, now put the next cards\n // beneath the newly created card.\n insert_pos.target_card_uid = parent.uid\n }\n insert_pos.target_pos += 1\n } else {\n // Target card has been removed from board.\n cancel_uploads()\n Snackbar.show_message(i18n.upload_canceled)\n }\n },\n })\n }\n\n private _add_note_or_link(\n value: {note: Note} | {note?: never; link: Link},\n opts?: {special_editor?: \"title\" | \"audio\" | \"video\" | \"photo\"},\n ) {\n const {board} = this\n runInAction(() => {\n const card_uid = model_actions.add_card_locally(\n board,\n this.insert_pos_provider(),\n value,\n )\n if (card_uid !== \"quota_exceeded\") {\n ui_actions.start_editing_card(board.uid, card_uid, opts)\n }\n })\n }\n}\n\nexport function below_card_insert_pos(\n card: Card,\n {has_visible_children}: {has_visible_children: boolean},\n): InsertPos {\n return has_visible_children && !ui_state.is_children_collapsed(card)\n ? {target_card_uid: card.uid, target_pos: 0}\n : {target_card_uid: card.parent.uid, target_pos: card.parent_pos + 1}\n}\n\nexport function above_card_insert_pos(card: Card): InsertPos {\n return {target_card_uid: card.parent.uid, target_pos: card.parent_pos}\n}\n", "import * as React from \"preact\"\nimport {BlobUID, Board, Card, EngagementType, FileCard, is_image} from \"@cling/lib.shared.model\"\nimport {board_info_resource} from \"@cling/lib.web.resources\"\nimport {board_to_react} from \"@cling/lib.shared.board_to_html/board_to_react\"\nimport {with_timeout} from \"@cling/lib.shared.utils\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {ui_state} from \"../state/index\"\nimport {download_url} from \"./download\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {report_user_engagement} from \"@cling/lib.web.analytics\"\nimport {render as preact_render} from \"preact\"\nimport {useEffect} from \"preact/hooks\"\nimport {thumbnail_url} from \"@cling/lib.web.resources/thumbnails\"\n\n/**\n * Open a new window, render a printable version and call `window.print()`.\n *\n * If the given board is the currently displayed board then only the visible cards will be\n * rendered and printed.\n */\nexport function print_board(board: Board, card?: Card) {\n report_user_engagement(EngagementType.print)\n const print_window = window.open(\"/c/static/print.html\", \"_blank\")!\n let interval_id: any\n let num_errors_to_ignore = 15\n const run = async () => {\n try {\n // Make sure that `run` is only executed once, but not\n // before `print_window.document.documentElement` is defined ...\n if (!(interval_id && print_window.document && print_window.document.documentElement)) {\n return\n }\n clearInterval(interval_id)\n interval_id = 0\n const progress_div = (\n <div\n id=\"progress\"\n style={{\n fontFamily: \"'Proxima', Arial, sans-serif\",\n position: \"fixed\",\n fontSize: \"14px\",\n backgroundColor: \"#ffd180\",\n borderRadius: \"6px\",\n border: \"1px solid #333\",\n top: \"0\",\n left: \"0\",\n bottom: \"0\",\n right: \"0\",\n margin: \"auto\",\n height: \"50px\",\n width: \"300px\",\n justifyContent: \"center\",\n alignItems: \"center\",\n display: \"flex\",\n }}\n role=\"dialog\"\n >\n {i18n.preparing_content_to_print}\n </div>\n )\n const PrintApp = () => {\n useEffect(() => {\n print_window.document.head.querySelector(\"title\")!.innerText = i18n.print\n })\n return (\n <>\n <head>\n <title>{i18n.preparing_content_to_print}</title>\n </head>\n <body>{progress_div}</body>\n </>\n )\n }\n const root = print_window.document.documentElement\n preact_render(<PrintApp />, root)\n const is_card_visible = (x: Card) => {\n if (x === card) {\n return true\n }\n if (ui_state.current_board_uid === board.uid) {\n return ui_state.search_state.visible_children(x.parent).includes(x)\n } else {\n return ui_state.search_state.archived_cards_shown || !x.archived\n }\n }\n const file_cards = (card || board.root).deep_children.filter(\n (x) => x.file && is_card_visible(x),\n ) as FileCard[]\n if (card?.file) {\n file_cards.push(card as FileCard)\n }\n const blob_uris = new Map<BlobUID, string>()\n for (const {file} of file_cards) {\n if (is_image(file.blob)) {\n const url = thumbnail_url({blob_uid: file.blob.uid, width: 512, height: 512})\n blob_uris.set(file.blob.uid, url)\n } else {\n try {\n blob_uris.set(\n file.blob.uid,\n download_url({\n file_name: file.file_name,\n blob_uid: file.blob.uid,\n attachment: true,\n }),\n )\n } catch {\n blob_uris.set(file.blob.uid, \"/404\")\n }\n }\n }\n const render = () => {\n preact_render(\n board_to_react({\n board,\n blob_uris,\n card,\n print: true,\n board_names: new Map(\n board_info_resource.read_all().map((x) => [x.uid, x.name]),\n ),\n is_card_visible,\n body_children: [progress_div],\n }),\n root,\n )\n }\n // Render the board (even if there are missing thumbnails) ...\n render()\n // Wait until the board has been rendered and mounted ...\n await with_timeout(\n 30000,\n new Promise<void>((resolve) => {\n const interval_id_2 = setInterval(() => {\n if (print_window.document.querySelector(\"main\")) {\n clearInterval(interval_id_2)\n resolve()\n }\n }, 113)\n }),\n {\n description: \"Board not rendered within 30 seconds\",\n },\n )\n // Wait until all images are loaded ...\n await with_timeout(\n 60000,\n new Promise<void>((resolve) => {\n let num_images_loaded = 0\n const img_elements = print_window.document.querySelectorAll(\"img\")\n if (img_elements.length === 0) {\n resolve()\n } else {\n const image_urls = Array.from(img_elements).map((x) => x.src)\n const f = () => {\n num_images_loaded += 1\n if (num_images_loaded === img_elements.length) {\n resolve()\n }\n }\n image_urls.forEach((image_url) => {\n const img = new Image()\n img.onload = f\n // We also want to resolve if an image could not be loaded ...\n img.onerror = f\n img.src = image_url\n })\n }\n }),\n {\n description: \"Images not loaded within 30 seconds\",\n },\n )\n print_window.addEventListener(\"afterprint\", () => {\n // We have to wait a bit (at least on Safari/OSX) before closing the window ...\n setTimeout(() => {\n print_window.close()\n }, 500)\n })\n print_window.document.querySelector(\"#progress\")?.remove()\n // For testing ...\n if (window._under_test) {\n ;(window as any).__ready_to_print = true\n } else {\n print_window.print()\n }\n } catch (error) {\n if (\n num_errors_to_ignore > 0 &&\n error.message?.includes(\"Blocked a frame with origin\")\n ) {\n // This is to be expected a few times ...\n num_errors_to_ignore -= 1\n return\n }\n report_error(\"Failed to print board\", error)\n }\n }\n print_window.onload = run\n // Boah, I hate the cross-browser hazzle. Some browsers (Edge 18) won't always invoke\n // `print_window.onload` so we use a fallback ...\n interval_id = setInterval(run, 137)\n}\n", "import * as React from \"preact\"\nimport {\n BlobUID,\n Board,\n BoardStyle,\n BoardUID,\n Card,\n extract_linked_board_and_card_uid,\n File,\n is_image,\n Link,\n Note,\n} from \"@cling/lib.shared.model\"\nimport {not_null} from \"@cling/lib.shared.utils\"\n\nexport function board_to_react(props: {\n board: Board\n blob_uris: Map<BlobUID, string>\n is_card_visible: (card: Card) => boolean\n card?: Card\n print?: boolean\n board_names?: Map<BoardUID, string>\n body_children?: any[]\n}) {\n const elms = React.createElement(RBoard, props)\n if (props.print) {\n return elms\n }\n return <html>{elms}</html>\n}\n\nconst RBoard = (props: {\n board: Board\n blob_uris: Map<BlobUID, string>\n card?: Card\n print?: boolean\n board_names?: Map<BoardUID, string>\n is_card_visible: (card: Card) => boolean\n body_children?: any[]\n}) => {\n const {board, body_children, card, print, is_card_visible, blob_uris} = props\n const inbox = board.inbox.children.filter((x) => is_card_visible(x)).length > 0 && (\n <RColumn {...props} key=\"inbox\" column={board.inbox} />\n )\n return (\n <>\n <head>\n <title>Cling - {board.name}</title>\n <link rel=\"icon\" href=\"https://cling.com/c/static/icon_512.png\" type=\"image/png\" />\n <meta charSet=\"UTF-8\" />\n <meta name=\"theme-color\" content=\"#222222\" />\n <style\n type=\"text/css\"\n dangerouslySetInnerHTML={{\n __html: style(\n print\n ? new BoardStyle({background_color: \"#ffffff\"})\n : board.board_style,\n blob_uris,\n ),\n }}\n />\n </head>\n <body className=\"mdc-typography\">\n <header role=\"banner\">Cling - {board.name}</header>\n <main>\n {card && (\n <section>\n <RCard {...props} card={card} />\n </section>\n )}\n {!card && (\n <>\n {!print && inbox}\n {board.columns\n .filter(\n (x) => x.children.filter((y) => is_card_visible(y)).length > 0,\n )\n .map((x) => (\n <RColumn {...props} key={x.uid} column={x} />\n ))}\n {print && inbox}\n </>\n )}\n </main>\n {!print && (\n <footer>\n This is only a quick preview. The complete data can be found in the file\n board.json.\n <br />\n <br />\n <a href={`https://cling.com/c/${board.uid}`}>See this board in Cling</a>\n </footer>\n )}\n {body_children}\n </body>\n </>\n )\n}\n\nconst RColumn = (props: {\n column: Card\n blob_uris: Map<BlobUID, string>\n board_names?: Map<BoardUID, string>\n is_card_visible: (card: Card) => boolean\n}) => {\n const {column, is_card_visible} = props\n return (\n <section key={column.uid}>\n {!!column.inbox && <header>Inbox</header>}\n {column.children\n .filter((x) => is_card_visible(x))\n .map((x) => (\n <RCard {...props} key={x.uid} card={x} />\n ))}\n </section>\n )\n}\n\nconst RCard = (props: {\n card: Card\n blob_uris: Map<BlobUID, string>\n board_names?: Map<BoardUID, string>\n is_card_visible: (card: Card) => boolean\n}) => {\n const {card, blob_uris, board_names, is_card_visible} = props\n return (\n <article key={card.uid}>\n {card.note && <RNote note={card.note} />}\n {card.link && <RLink link={card.link} board_names={board_names} />}\n {card.file && (\n <RFile\n file={card.file}\n blob_uri={not_null(blob_uris.get(card.file.blob.uid), card.file.blob.uid)}\n />\n )}\n {card.children\n .filter((x) => is_card_visible(x))\n .map((x) => (\n <RCard {...props} key={x.uid} card={x} />\n ))}\n </article>\n )\n}\n\nconst RNote = ({note}: {note: Note}) => (\n <div className=\"note\">\n {note.title && <header>{note.title}</header>}\n {note.safe_html && (\n <div className=\"safe_html\" dangerouslySetInnerHTML={{__html: note.safe_html}} />\n )}\n </div>\n)\n\nconst RLink = ({link, board_names}: {link: Link; board_names?: Map<BoardUID, string>}) => {\n const target_board_uid = extract_linked_board_and_card_uid(link.url)?.board_uid\n if (target_board_uid) {\n // Special handling for board-link-cards.\n const board_name = board_names?.get(target_board_uid)\n return <div>Board {board_name || target_board_uid}</div>\n }\n return (\n <div className=\"link\">\n <a href={link.url}>{link.title || link.url}</a>\n </div>\n )\n}\n\nconst RFile = ({file, blob_uri}: {file: File; blob_uri: string}) => (\n <div className={`file${is_image(file.blob) ? \" file--image\" : \"\"}`}>\n {file.title && <header>{file.title}</header>}\n <a href={blob_uri}>\n {is_image(file.blob) && (\n <img\n src={blob_uri}\n alt={file.file_name}\n style={{\n backgroundColor: file.display.background_color,\n }}\n />\n )}\n {!is_image(file.blob) && file.file_name}\n </a>\n </div>\n)\n\nconst style = (board_style: BoardStyle, blob_uris: Map<BlobUID, string>) => {\n const space = 16\n let {background_color: color, background_image_url: image_url} = board_style\n const {background_image_blob: image_blob} = board_style\n if (!color) {\n color = \"#607d8b\"\n }\n if (image_blob) {\n image_url = not_null(blob_uris.get(image_blob.uid), image_blob.uid)\n }\n const is_background_pattern =\n board_style.background_is_pattern || image_url.includes(\"/patterns/\")\n // language=CSS\n return `\n body {\n font-family: Arial, sans-serif;\n font-size: 13px;\n margin: 0;\n padding: 0;\n }\n @media print {\n body {\n font-size: 11px;\n } \n }\n @media screen {\n body {\n ${image_url ? `background-image: url(${image_url});` : \"\"}\n background-color: ${color};\n ${is_background_pattern ? \"\" : \"background-size: cover;\"}\n background-position: center;\n }\n }\n a, a:visited {\n color: #1976d2;\n }\n body > header {\n font-size: larger;\n font-weight: bolder;\n } \n @media print {\n body > header {\n padding-bottom: ${space}px;\n }\n }\n @media screen {\n body > header {\n padding: ${space}px ${2 * space}px;\n background-color: rgba(0,0,0,0.62);\n color: white;\n } \n }\n @media screen {\n main {\n display: flex;\n flex-direction: row;\n }\n main > section {\n margin: ${space}px ${space}px 80px;\n flex: 1;\n width: 400px;\n }\n }\n @media print {\n main > section {\n break-after: page; \n }\n }\n article, section > header {\n background-color: white;\n border: 1px solid #999;\n border-radius: 4px;\n padding: ${space}px;\n }\n article {\n margin-bottom: ${space}px;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n main > section > header {\n margin-bottom: ${space}px;\n }\n @media print {\n main > section > header {\n font-weight: bolder; \n }\n }\n @media screen {\n main > section > header {\n background-color: rgba(0,0,0,0.62);\n color: white;\n }\n }\n article > article {\n margin-right: ${-space}px;\n margin-top: ${space}px;\n border-right: none;\n margin-top: ${space}px;\n } \n @media print {\n article > article {\n break-inside: avoid;\n }\n }\n .note > header {\n font-weight: bolder; \n }\n .note > header + .safe_html {\n margin-top: ${space}px;\n }\n .note > .safe_html p {\n margin-top: 0;\n margin-bottom: 0;\n }\n @media screen {\n .note > .safe_html em {\n background-color: #69f0ae; /* $material-color-light-green-a200; */\n font-style: inherit;\n }\n }\n @media print {\n .note > .safe_html em {\n font-weight: bolder;\n color: #69f0ae; /* $material-color-light-green-a200; */\n font-style: inherit;\n }\n }\n .note > .safe_html ul {\n list-style: circle;\n }\n .note > .safe_html ol {\n list-style: decimal;\n }\n .note > .safe_html ul[role=\"listbox\"] {\n padding-left: 24px;\n position: relative;\n list-style: none;\n margin: 12px 0;\n }\n .note > .safe_html li[role=\"option\"] {\n margin-bottom: 2px;\n min-height: 24px;\n padding-left: 6px;\n }\n .note > .safe_html li[role=\"option\"]:before {\n display: block;\n position: absolute;\n content: \" \";\n background-size: 24px 24px;\n height: 26px;\n width: 24px;\n left: 0;\n margin-top: -2px;\n }\n .note > .safe_html li[aria-checked=\"true\"] {\n color: #757575; /* $material-color-grey-600; */\n }\n @media screen {\n .note > .safe_html li[aria-checked=\"true\"]:before {\n background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z\" fill=\"rgb(158,158,158)\"/></svg>');\n }\n .note > .safe_html li[aria-checked=\"false\"]:before {\n background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\" fill=\"rgb(97,97,97)\"/></svg>');\n }\n }\n @media print {\n .note > .safe_html li[aria-checked=\"true\"]:before {\n content: \"[x]\";\n line-height: 24px;\n font-family: \"Courier New\", monospace;\n }\n .note > .safe_html li[aria-checked=\"false\"]:before {\n content: \"[ ]\";\n line-height: 24px;\n font-family: \"Courier New\", monospace;\n }\n }\n .note > .safe_html pre {\n background-color: rgba(0, 0, 0, 0.05);\n }\n .note > .safe_html code {\n background-color: rgba(0, 0, 0, 0.05);\n font-family: \"Courier New\", monospace;\n padding: 2px;\n border-radius: 3px;\n white-space: normal;\n }\n .note > .safe_html pre code {\n background-color: unset;\n }\n .file {\n display: flex;\n flex-direction: column;\n }\n .file > header {\n font-weight: bolder; \n margin-bottom: ${space}px;\n }\n .file.file--image {\n align-items: center;\n }\n .file img {\n border-radius: 4px;\n max-width: 250px;\n max-height: 250px;\n }\n body > footer {\n padding: ${space}px ${2 * space}px;\n background-color: rgba(0,0,0,0.62);\n color: white;\n font-size: smaller;\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n } \n /* Style and force the scrollbar to be visible on all platforms. */\n *::-webkit-scrollbar {\n -webkit-appearance: none;\n }\n *::-webkit-scrollbar:vertical {\n width: 12px;\n }\n *::-webkit-scrollbar:horizontal {\n height: 12px;\n }\n *::-webkit-scrollbar-thumb {\n border-radius: 8px;\n border: 1px solid white; /* Should match background, can't be transparent. */\n background-color: rgba(0, 0, 0, .5);\n }\n `\n}\n", "export const supported_thumbnail_dims = [128, 256, 512, 1024, 1920] as readonly number[]\n\nexport const most_common_thumbnail_dims = [\n [128, 128],\n [1024, 512],\n [1920, 1920],\n] as readonly number[][]\n\nexport const broken_image_svg =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M21,5V11.59L18,8.58L14,12.59L10,8.59L6,12.59L3,9.58V5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5M18,11.42L21,14.43V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V12.42L6,15.41L10,11.41L14,15.41\" style=\"fill:red\"/></svg>'\n", "import {BlobUID, BoardStyleStruct, as_BlobUID} from \"@cling/lib.shared.model\"\nimport {supported_thumbnail_dims} from \"@cling/lib.shared.faas/constants\"\nimport {not_null} from \"@cling/lib.shared.utils\"\nimport {report_info} from \"@cling/lib.shared.debug\"\n\nlet _thumbnail_url: (props: {\n blob_uid: BlobUID\n max_thumbnail_width: number\n max_thumbnail_height: number\n}) => string\n\nlet _image_cache_thrash_index: (blob_uid: BlobUID) => number\n\nexport type ProvisionalThumbnail = {\n blob_uid: BlobUID\n mime_type: string\n file: File\n width: number\n height: number\n url?: string\n}\n\nconst provisional_thumbnails = new Map<BlobUID, ProvisionalThumbnail>()\n\nexport async function add_provisional_thumbnail(thumbnail: ProvisionalThumbnail) {\n provisional_thumbnails.set(thumbnail.blob_uid, thumbnail)\n try {\n const cache = await caches.open(\"provisional_thumbnails\")\n await cache.put(thumbnail.blob_uid, new Response(thumbnail.file))\n } catch (error) {\n report_info(\"Failed to cache provisional thumbnail -- ignoring\", error)\n }\n}\n\nexport async function remove_provisional_thumbnail(blob_uid: BlobUID): Promise<boolean> {\n const provisional = provisional_thumbnails.get(blob_uid)\n if (provisional) {\n if (provisional.url) {\n URL.revokeObjectURL(provisional.url)\n }\n provisional_thumbnails.delete(blob_uid)\n }\n try {\n const cache = await caches.open(\"provisional_thumbnails\")\n await cache.delete(blob_uid)\n } catch (error) {\n report_info(\"Failed to delete provisional thumbnail from cache -- ignoring\", error)\n }\n return !!provisional\n}\n\n/**\n * Returns an empty string if no background image is set.\n */\nexport function board_background_image_url(\n board_style: BoardStyleStruct,\n {dim}: {dim: 128 | 1920} = {dim: 1920},\n): string {\n if (board_style.background_image_url) {\n let url = board_style.background_image_url\n if (dim === 128) {\n url = url.replace(\"/photos/2000w/\", \"/photos/200w/\")\n }\n return url\n }\n if (board_style.background_image_blob) {\n return thumbnail_url({\n blob_uid: board_style.background_image_blob.uid,\n width: dim,\n height: dim,\n })\n }\n return \"\"\n}\n\nexport async function init(args: {\n thumbnail_url: (props: {\n blob_uid: BlobUID\n max_thumbnail_width: number\n max_thumbnail_height: number\n }) => string\n image_cache_thrash_index: (blob_uid: BlobUID) => number\n skip_cache?: boolean\n}) {\n _thumbnail_url = args.thumbnail_url\n _image_cache_thrash_index = args.image_cache_thrash_index\n if (args.skip_cache) {\n return\n }\n try {\n const cache = await caches.open(\"provisional_thumbnails\")\n const keys = await cache.keys()\n for (const key of keys) {\n const response = await cache.match(key)\n if (response) {\n const file = await response.blob()\n const blob_uid = as_BlobUID(key.url.slice(key.url.lastIndexOf(\"/\") + 1))\n provisional_thumbnails.set(blob_uid, {\n blob_uid,\n mime_type: file.type,\n file: file as File,\n width: 0,\n height: 0,\n })\n }\n }\n } catch (error) {\n report_info(\"Failed to read provisional thumbnails from cache -- ignoring\", error)\n }\n}\n\nexport function thumbnail_url({\n blob_uid,\n width,\n height,\n}: {\n blob_uid: BlobUID\n width: number\n height: number\n}): string {\n not_null(_thumbnail_url, \"`init` must be called first\")\n const provisional = provisional_thumbnails.get(blob_uid)\n if (provisional) {\n if (!provisional.url) {\n provisional.url = URL.createObjectURL(provisional.file)\n }\n return provisional.url\n }\n const thumbnail_height =\n supported_thumbnail_dims.find((dim) => height <= dim) ||\n supported_thumbnail_dims[supported_thumbnail_dims.length - 1]\n const thumbnail_width =\n supported_thumbnail_dims.find((dim) => width <= dim) ||\n supported_thumbnail_dims[supported_thumbnail_dims.length - 1]\n const url = _thumbnail_url({\n blob_uid,\n max_thumbnail_width: thumbnail_width,\n max_thumbnail_height: thumbnail_height,\n })\n const thrash = _image_cache_thrash_index(blob_uid)\n if (thrash) {\n return `${url}${url.includes(\"?\") ? \"&\" : \"?\"}_thrash=${thrash}`\n }\n return url\n}\n\nexport async function thumbnail_url_preloaded({\n blob_uid,\n width,\n height,\n}: {\n blob_uid: BlobUID\n width: number\n height: number\n}): Promise<string> {\n const url = thumbnail_url({blob_uid, width, height})\n await new Promise((resolve) => {\n const img = new Image()\n img.onload = resolve\n img.onerror = resolve\n img.src = url\n })\n return url\n}\n\nexport function is_provisional_thumbnail_url(url: string): boolean {\n return url.startsWith(\"blob:\")\n}\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport {\n BlobUID,\n BoardInfo,\n CardColor,\n derive_URLUID,\n EngagementType,\n extract_linked_board_and_card_uid,\n ImageCardDisplayKind,\n is_BlobUID,\n LinkCard as LinkCardModel,\n LinkStyleImage,\n} from \"@cling/lib.shared.model\"\nimport {extract_domain, not_null} from \"@cling/lib.shared.utils\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {decorate_emojis} from \"@cling/lib.web.utils/decorate_emojis\"\nimport {board_info_resource, url_info_resource} from \"@cling/lib.web.resources\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {ImageCard} from \"./image_card\"\nimport {Lightbox} from \"./lightbox\"\nimport {\n CondensedThumbnail,\n CondensedThumbnailLoading,\n CondensedThumbnailNoImage,\n} from \"./condensed_thumbnail\"\nimport {goto_board, is_cling_hp} from \"../utils\"\nimport {video_player_state, is_playable_media} from \"./video_player\"\nimport {cancel_event} from \"@cling/lib.web.utils\"\nimport {title_tag} from \"./utils\"\nimport {report_user_engagement} from \"@cling/lib.web.analytics\"\nimport {open_intercom} from \"../misc/intercom\"\nimport {schedule_update_board} from \"../state/update_board_queue\"\nimport {board_name} from \"../board/board_name\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {board_background_style} from \"../board/board_chooser_props\"\n\ninterface Props {\n card: LinkCardModel\n}\n/**\n * This is just a very broad heuristic erring on the side of lower height.\n */\nexport function LinkCard_estimated_height(card: LinkCardModel) {\n if (card.link.style.display.kind === ImageCardDisplayKind.cinema) {\n return 210\n }\n return 60\n}\n\nexport const LinkCard = observer(({card}: Props) => {\n let on_click = React.useCallback(\n (e: React.MouseEvent<any>) => {\n e.stopPropagation()\n if (\n process.env.F_PUBLIC &&\n card.link.url.match(/https:\\/\\/cling\\.com\\/[^/]+\\/chat\\.html/)\n ) {\n // Yeah, this is a bit hacky, but what gives.\n e.preventDefault()\n open_intercom(\"new_message\")\n } else {\n report_user_engagement(EngagementType.click_link)\n if (process.env.F_PUBLIC) {\n return\n }\n const linked_board = extract_linked_board_and_card_uid(card.link.url)\n if (linked_board) {\n e.preventDefault()\n goto_board({\n board_uid: linked_board.board_uid,\n highlight_card_uid: linked_board.card_uid,\n }).catch(report_error)\n }\n }\n },\n [card],\n )\n let on_click_on_image = React.useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation()\n if (extract_linked_board_and_card_uid(card.link.url)) {\n // For now, nothing happens if you click on a board image.\n e.preventDefault()\n return\n }\n if (is_playable_media(card)) {\n e.preventDefault()\n video_player_state.play({url: card.link.url})\n return\n }\n if (card.link?.style.display.kind === ImageCardDisplayKind.banner) {\n report_user_engagement(EngagementType.click_link)\n return\n }\n e.preventDefault()\n ui_actions.open_lightbox(card)\n },\n [card],\n )\n const {link} = card\n const {url: plain_url} = link\n let {title: plain_title} = link\n const url_info = url_info_resource.read(derive_URLUID(link.url))\n const linked_board_uid = extract_linked_board_and_card_uid(plain_url)?.board_uid\n let featured_blob_uid = url_info?.featured_image_blob?.uid\n const logo_blob_uid = url_info?.logo_image_blob?.uid\n const screenshot_blob_uid = url_info?.screenshot_image_blob?.uid\n let image_style: React.CSSProperties | undefined\n if (!process.env.F_PUBLIC && linked_board_uid) {\n const board_info = board_info_resource.read(linked_board_uid)\n if (board_info) {\n if (!plain_title || plain_title === \"Cling Board\") {\n // Just a bit of convenience of the card title is not set or it is the default name\n // we used to use.\n plain_title = board_name(board_info)\n }\n const x = blob_uids_and_style_of_linked_board(board_info)\n featured_blob_uid = x.featured_blob_uid\n if (!link.style.image_blob && link.style.image !== LinkStyleImage.logo) {\n image_style = x.background_style\n }\n }\n }\n const domain = extract_domain(plain_url) || plain_url\n const matches = ui_state.search_state.search_matches(card)\n const title_html = ui_state.search_state.highlight_match(card, \"title\", matches, plain_title)\n const url_matches = matches.some((x) => x.text_matches.some((y) => y.field === \"url\"))\n const TitleTag = title_tag(card)\n const render_title = (className: string) => (\n <TitleTag\n className={className}\n data-test-id=\"LinkCard_title\"\n dangerouslySetInnerHTML={{__html: decorate_emojis(title_html)}}\n />\n )\n const render_domain = (className: string) => (\n <div className={className} data-test-id=\"LinkCard_domain\">\n {/* We have a match inside the URL (which is not visible to the */}\n {/* user), so we highlight the domain-part instead.*/}\n {url_matches && ui_state.search_state.highlight_all(domain)}\n {!url_matches && domain}\n </div>\n )\n if (!plain_title && url_info?.scrape_info?.title && !linked_board_uid) {\n // We have a link w/o a title but we also have a URLInfo with a title.\n // Let's update the board.\n schedule_update_board(card.board_uid)\n }\n const playable_media = is_playable_media(card)\n const style = link.style\n const lightbox_shown = ui_state.lightbox_shown(card)\n const blob_uid = (() => {\n if (image_style) {\n return undefined\n }\n if (style.image_blob) {\n return style.image_blob.uid\n }\n if (style.image === LinkStyleImage.logo && logo_blob_uid) {\n return logo_blob_uid\n }\n if (style.image === LinkStyleImage.screenshot && screenshot_blob_uid) {\n return screenshot_blob_uid\n }\n return featured_blob_uid || logo_blob_uid || screenshot_blob_uid\n })()\n if (is_cling_hp()) {\n // We always want to play media inline (and never open the URL) and we never want to open\n // the lightbox.\n if (playable_media) {\n on_click = on_click_on_image\n } else {\n on_click_on_image = on_click\n }\n }\n if (\n (style.display.kind === ImageCardDisplayKind.banner ||\n style.display.kind === ImageCardDisplayKind.cinema) &&\n (blob_uid || image_style)\n ) {\n const is_color = card.color !== CardColor.no_color\n return (\n <div\n className={classNames(\"card-details link-card link-card__mode\", {\n \"link-card__mode-image--banner\":\n style.display.kind === ImageCardDisplayKind.banner,\n \"link-card__mode-image--cinema\":\n style.display.kind === ImageCardDisplayKind.cinema,\n })}\n >\n <LinkCardAnchor\n card={card}\n onClick={on_click}\n target={process.env.F_PUBLIC || linked_board_uid ? undefined : \"_blank\"}\n >\n <ImageCard\n card={card}\n blob_uid_or_style={not_null(blob_uid || image_style)}\n key=\"image\"\n playable_media={playable_media}\n display={style.display}\n className={classNames(\"link-card__mode-image\", {\n \"link-card__mode-image--banner\":\n style.display.kind === ImageCardDisplayKind.banner,\n \"link-card__mode-image--cinema\":\n style.display.kind === ImageCardDisplayKind.cinema,\n \"link-card__mode-image--with-color\": is_color,\n })}\n title={\n <div onClick={on_click}>\n {plain_title ? render_title(\"link-card__mode-title\") : plain_url}\n </div>\n }\n title_display={\n style.display.kind === ImageCardDisplayKind.banner ? \"banner\" : \"cinema\"\n }\n onClick={on_click_on_image}\n />\n {render_domain(\"link-card__mode-domain\")}\n </LinkCardAnchor>\n {lightbox_shown && <Lightbox initial_card={card} />}\n </div>\n )\n }\n return (\n <>\n <LinkCardAnchor\n card={card}\n onClick={on_click}\n className=\"card-details card-with-icon link-card\"\n target={process.env.F_PUBLIC || linked_board_uid ? undefined : \"_blank\"}\n >\n <div className=\"card-with-icon__icon-outline\">\n <LinkThumbnail\n blob_uid_or_style={blob_uid || image_style}\n is_loading={!url_info && !linked_board_uid && !blob_uid}\n is_playable={playable_media}\n className=\"card-with-icon__icon\"\n onClick={on_click_on_image}\n />\n </div>\n <div className=\"card-with-icon__content link-card__content\">\n {render_title(\n \"card-with-icon__title link-card__content-title test_LinkCard_link\",\n )}\n {render_domain(\"card-with-icon__caption\")}\n </div>\n </LinkCardAnchor>\n {lightbox_shown && <Lightbox initial_card={card} />}\n </>\n )\n})\n\nexport const LinkCardAnchor = observer(\n ({\n card,\n onClick,\n children,\n target,\n className,\n }: {\n card: LinkCardModel\n onClick: React.MouseEventHandler<any>\n target: \"_blank\" | undefined\n children: any\n className?: string\n }) => {\n return (\n <a\n href={card.link.url}\n className={className}\n rel={\"noopener\" /* ... SEC: see https://bit.ly/2x5jXjn */}\n target={target}\n onClick={onClick}\n draggable={false}\n >\n {children}\n </a>\n )\n },\n)\n\nexport const LinkThumbnail = observer(\n ({\n blob_uid_or_style,\n className,\n onClick,\n is_playable,\n is_loading,\n }: {\n blob_uid_or_style: BlobUID | React.CSSProperties | undefined\n className?: string\n is_playable: boolean\n is_loading: boolean\n onClick?: React.MouseEventHandler<HTMLElement>\n }) => {\n const image_style = is_BlobUID(blob_uid_or_style) ? undefined : blob_uid_or_style\n if (is_loading) {\n return (\n <CondensedThumbnailLoading\n playable_media={is_playable}\n className={className}\n image_style={image_style}\n onClick={is_playable ? onClick : cancel_event}\n />\n )\n }\n if (!blob_uid_or_style) {\n return (\n <CondensedThumbnailNoImage\n playable_media={is_playable}\n className={className}\n image_style={image_style}\n onClick={is_playable ? onClick : cancel_event}\n />\n )\n }\n return (\n <CondensedThumbnail\n blob_uid_or_style={blob_uid_or_style}\n className={className}\n playable_media={is_playable}\n onClick={onClick}\n />\n )\n },\n)\n\nexport function blob_uids_and_style_of_linked_board(\n board_info: BoardInfo,\n):\n | {featured_blob_uid: BlobUID; background_style?: never}\n | {featured_blob_uid?: never; background_style: React.CSSProperties} {\n if (board_info.board_style.background_image_blob) {\n return {featured_blob_uid: board_info.board_style.background_image_blob.uid}\n } else {\n return {background_style: board_background_style(board_info)}\n }\n}\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {\n CardColor,\n BlobUID,\n Card as CardModel,\n CardUID,\n MediaTranscodeStatus,\n is_BlobUID,\n ImageCardDisplay,\n ImageCardDisplayKind,\n} from \"@cling/lib.shared.model\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {media_info_resource} from \"@cling/lib.web.resources\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {is_provisional_thumbnail_url, thumbnail_url} from \"@cling/lib.web.resources/thumbnails\"\nimport {LoadingIndicator} from \"@cling/lib.web.lazy_load/loading_indicator\"\nimport {simple_tooltip_event_handlers} from \"@cling/lib.web.mdc/simple_tooltip\"\n\n/**\n * We strive for cards to reach this aspect ratio.\n * This is 3:2.\n */\nconst MAX_CARD_ASPECT_RATIO = 0.66\n\n/**\n * Up until this aspect ratio images are displayed in `cover` mode even if this means that we\n * loose some image information at the top and the bottom.\n * This is ok, as it results in the most pleasant experience and others (namely Google Photos)\n * do the same.\n * This is 16:9.\n */\nconst MAX_COVER_ASPECT_RATIO = 0.77\n\nconst loading = (\n <div className=\"image-card__loading\" data-test-thumbnail-state=\"waiting\">\n <LoadingIndicator delay={2000} />\n </div>\n)\n\nconst broken = (\n <div className=\"image-card__broken\">\n <div className=\"image-card__broken-icon\" />\n </div>\n)\n\nexport const ImageCard = observer(\n ({\n blob_uid_or_style,\n card,\n title,\n title_display,\n onClick,\n className,\n display,\n playable_media,\n }: {\n blob_uid_or_style: BlobUID | React.CSSProperties\n card: CardModel\n title?: any\n title_display?: \"cinema\" | \"banner\"\n onClick?: React.MouseEventHandler<HTMLElement>\n className?: string\n display: ImageCardDisplay\n playable_media?: boolean\n }) => {\n const dimension_elm = React.useRef<HTMLDivElement>(null)\n const [image_dim, set_image_dim] = React.useState<{\n width: number\n height: number\n playable_media: boolean\n }>()\n const blob_uid = is_BlobUID(blob_uid_or_style) ? blob_uid_or_style : undefined\n const media_info = blob_uid ? media_info_resource.read(blob_uid) : undefined\n React.useEffect(() => {\n if (blob_uid) {\n if (media_info) {\n set_image_dim({\n width: media_info.width,\n height: media_info.height,\n playable_media: !!media_info.transcode_status,\n })\n }\n } else {\n set_image_dim({width: 128, height: 128, playable_media: false})\n }\n }, [blob_uid, media_info])\n let padding_top\n let background_size: \"cover\" | \"contain\"\n let thumbnail_width\n let thumbnail_height\n if (!dimension_elm.current || !image_dim) {\n padding_top = \"50%\"\n background_size = \"cover\"\n thumbnail_width = 0\n thumbnail_height = 0\n } else {\n const card_width = dimension_elm.current.getBoundingClientRect().width\n const {width: image_width, height: image_height} = image_dim\n const device_pixel_ratio = Math.min(window.devicePixelRatio || 1, 3)\n thumbnail_width = Math.min(image_width, Math.round(card_width * device_pixel_ratio))\n thumbnail_height =\n display.kind === ImageCardDisplayKind.banner\n ? 512\n : Math.min(\n image_height,\n Math.round(card_width * device_pixel_ratio * MAX_CARD_ASPECT_RATIO),\n )\n const img_aspect_ratio =\n display.kind === ImageCardDisplayKind.cinema && display.cinema_forced_aspect_ratio\n ? display.cinema_forced_aspect_ratio\n : image_height / image_width\n const card_aspect_ratio = Math.min(img_aspect_ratio, MAX_CARD_ASPECT_RATIO)\n padding_top = card_aspect_ratio * 100 + \"%\"\n if (display.is_pattern) {\n background_size = \"contain\"\n } else {\n if (\n !image_dim.playable_media &&\n display.kind !== ImageCardDisplayKind.banner &&\n img_aspect_ratio >= MAX_COVER_ASPECT_RATIO\n ) {\n // Image is in \"portrait\" mode - i.e. it is much taller than wide.\n background_size = \"contain\"\n } else {\n // Image almost or perfectly fits the card - i.e. has (almost) the same\n // aspect ratio or it is a video.\n background_size = \"cover\"\n }\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 condensed = ui_state.is_content_collapsed(card)\n return (\n <div\n className={classNames(\"image-card\", className, {\n \"image-card--condensed\": condensed,\n \"image-card--banner\": display.kind === ImageCardDisplayKind.banner,\n \"image-card--cinema\": display.kind === ImageCardDisplayKind.cinema,\n })}\n ref={dimension_elm}\n data-test-id=\"ImageCard\"\n >\n <div style={{paddingTop: padding_top}}>\n {playable_media && <div className=\"image-card__play\" onClick={onClick}></div>}\n <AsyncThumbnail\n card={card}\n blob_uid_or_style={blob_uid_or_style}\n onClick={onClick}\n thumbnail_width={thumbnail_width}\n thumbnail_height={thumbnail_height}\n background_size={background_size}\n background_repeat={display.is_pattern ? \"repeat\" : \"no-repeat\"}\n background_color={display.background_color}\n />\n </div>\n {title && (\n <div\n onClick={onClick}\n className={classNames(\"image-card__title\", {\n \"image-card__title--cinema\":\n !title_display || title_display === \"cinema\",\n \"image-card__title--banner\": title_display === \"banner\",\n \"image-card__title--with-color\": card.color !== CardColor.no_color,\n })}\n >\n {title}\n </div>\n )}\n {condensed && (\n <div className=\"action image-card__more\" onClick={show_more}>\n {i18n.more_expand}\n </div>\n )}\n </div>\n )\n },\n)\n\nexport const AsyncThumbnail = observer(\n ({\n blob_uid_or_style,\n card,\n onClick,\n thumbnail_height,\n thumbnail_width,\n background_size,\n background_repeat,\n background_color,\n }: {\n blob_uid_or_style: BlobUID | React.CSSProperties\n card?: {uid: CardUID; color: CardColor}\n onClick?: React.MouseEventHandler<HTMLElement>\n thumbnail_width: number\n thumbnail_height: number\n background_size: \"cover\" | \"contain\"\n background_repeat?: \"no-repeat\" | \"repeat\"\n background_color?: string\n }) => {\n const [prev_url, set_prev_url] = React.useState(\"\")\n const [url, set_url] = React.useState(\"\")\n const [is_provisional_thumbnail, set_is_provisional_thumbnail] = React.useState(false)\n const blob_uid = is_BlobUID(blob_uid_or_style) ? blob_uid_or_style : undefined\n let style: React.CSSProperties\n if (blob_uid) {\n const media_info = media_info_resource.read(blob_uid)\n if (media_info?.invalid) {\n return broken\n }\n if (!media_info || media_info.transcode_status === MediaTranscodeStatus.in_progress) {\n return loading\n }\n if (thumbnail_width === 0 || thumbnail_height === 0) {\n return loading\n }\n const new_url = thumbnail_url({\n blob_uid,\n width: thumbnail_width,\n height: thumbnail_height,\n })\n if (prev_url && new_url !== prev_url && is_provisional_thumbnail) {\n const img = new Image()\n img.onload = () => {\n set_prev_url(new_url)\n set_url(new_url)\n set_is_provisional_thumbnail(is_provisional_thumbnail_url(new_url))\n }\n img.src = new_url\n } else if (new_url !== prev_url) {\n set_prev_url(new_url)\n set_url(new_url)\n set_is_provisional_thumbnail(is_provisional_thumbnail_url(new_url))\n }\n if (!url) {\n return loading\n }\n style = {\n backgroundImage: `url(${url})`,\n }\n } else {\n style = blob_uid_or_style as React.CSSProperties\n }\n return (\n <>\n {background_size === \"contain\" && (\n <div className=\"image-card__portrait-background\" style={style} />\n )}\n <div\n onClick={onClick}\n data-blob-uid={blob_uid}\n className=\"image-card__img\"\n data-test-id=\"ImageCard_image\"\n data-test-thumbnail-state={is_provisional_thumbnail ? \"waiting\" : \"\"}\n style={{\n ...style,\n backgroundSize: background_size,\n backgroundRepeat: background_repeat,\n backgroundColor: background_color,\n }}\n />\n {card && card.color !== CardColor.no_color && (\n <div\n aria-label={i18n.card_color(card.color)}\n className={`image-card__card-color-marker card--color-${card.color}`}\n {...simple_tooltip_event_handlers}\n />\n )}\n </>\n )\n },\n)\n\nexport const ImageCardPreview = observer(\n ({image_url, badge}: {image_url: string; badge?: string}) => {\n return (\n <div className=\"card-details image-card image-card-preview\">\n <div>\n <div\n className=\"image-card__img image-card-preview__img\"\n style={{backgroundImage: `url(${image_url})`}}\n />\n {!!badge && <div className=\"image-card-preview__badge\">{badge}</div>}\n </div>\n </div>\n )\n },\n)\n", "import * as React from \"react\"\nimport * as ReactDOM from \"react-dom\"\n\nimport * as MDC from \"@cling/lib.web.mdc\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {load_photoswipe} from \"@cling/lib.web.lazy_load\"\nimport {element_enters_screen_duration, element_leaves_screen_duration} from \"@cling/lib.web.motion\"\nimport {\n can_enter_fullscreen,\n can_exit_fullscreen,\n enter_fullscreen,\n exit_fullscreen,\n running_on_mobile_device,\n trap_browser_back,\n} from \"@cling/lib.web.utils\"\nimport {\n Board,\n Card,\n CardUID,\n QueryThumbnailRequest,\n as_BlobUID,\n from_b64url,\n} from \"@cling/lib.shared.model\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {runInAction} from \"mobx\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {BoardContext} from \"../board_context\"\nimport {thumbnail_url} from \"@cling/lib.web.resources/thumbnails\"\nimport {media_info_resource} from \"@cling/lib.web.resources\"\n\ninterface Props {\n initial_card: Card\n children?: any\n}\n\ninterface State {\n can_navigate_prev: boolean\n can_navigate_next: boolean\n}\n\nfunction max_thumbnail_size(): [number, number] {\n const device_pixel_ratio = Math.min(window.devicePixelRatio || 1, 3)\n const max_width = Math.round(screen.width * device_pixel_ratio)\n const max_height = Math.round(screen.height * device_pixel_ratio)\n return [Math.min(max_width, 1920), Math.min(max_height, 1920)]\n}\n\ninterface Item {\n // Used by Cling.\n b: () => {x: number; y: number; w: number}\n card_uid: CardUID\n // Used by PhotoSwipe.\n src: string\n w: number\n h: number\n}\n\nexport class Lightbox extends React.PureComponent<Props, State> {\n static readonly contextType = BoardContext\n private dispose_trap_browser_back?: () => void\n private card_menus_disabled_before = false\n\n on_popstate = () => {\n this.close()\n }\n\n state = {\n can_navigate_prev: false,\n can_navigate_next: false,\n }\n private init_later = false\n private pswp_div_ref: ReactRef<HTMLDivElement>\n private gallery: any\n private readonly dispose_functions = [] as Array<() => void>\n\n close = () => {\n if (this.gallery) {\n this.gallery.close()\n this.gallery = null\n }\n for (const dispose of this.dispose_functions) {\n dispose()\n }\n if (this.dispose_trap_browser_back) {\n this.dispose_trap_browser_back()\n this.dispose_trap_browser_back = undefined\n }\n this.init_later = false\n }\n\n update_pswp_div_ref = (ref: ReactRef<HTMLDivElement>) => {\n if (ref) {\n this.pswp_div_ref = ref\n this.init_later = true\n const load_photoswipe_promise = load_photoswipe()\n const [max_thumbnail_width, max_thumbnail_height] = max_thumbnail_size()\n const {initial_card} = this.props\n const card_to_item = (card: Card) => {\n const {uid: card_uid} = card\n const thumbnail_div = document\n .querySelector(`[data-card-uid=\"${card_uid}\"]`)\n ?.querySelector(\"[data-blob-uid]\") as HTMLDivElement\n if (!thumbnail_div) {\n return undefined\n }\n const url = new URL(\n thumbnail_div.style.backgroundImage!.slice(4, -1).replace(/\"/g, \"\"),\n )\n const blob_uid = as_BlobUID(thumbnail_div.getAttribute(\"data-blob-uid\"))\n let thumbnail_width\n let thumbnail_height\n if (cling.frontend_only) {\n thumbnail_width = 1024\n thumbnail_height = 512\n } else {\n // We should always have the `q` parameter but we got an error report in\n // production that it was missing. We should definitely move away from\n // PhotoSwipe.\n if (url.searchParams.has(\"q\")) {\n const req = from_b64url(QueryThumbnailRequest, url.searchParams.get(\"q\")!)\n thumbnail_width = req.max_thumbnail_width\n thumbnail_height = req.max_thumbnail_height\n } else {\n thumbnail_width = 1024\n thumbnail_height = 512\n }\n }\n const media_info = media_info_resource.read(blob_uid)\n const image_width = media_info?.width ?? thumbnail_width\n const image_height = media_info?.height ?? thumbnail_height\n let w = image_width\n let h = image_height\n const aspect_ratio = image_width / image_height\n if (w > max_thumbnail_width || h > max_thumbnail_height) {\n w = max_thumbnail_width\n h = Math.round(max_thumbnail_width / aspect_ratio)\n if (h > max_thumbnail_height) {\n w = Math.round(max_thumbnail_height * aspect_ratio)\n h = max_thumbnail_height\n }\n }\n const src = thumbnail_url({blob_uid, width: w, height: h})\n return {\n src,\n w,\n h,\n // For open/close lightbox animation.\n b: () => {\n const r = thumbnail_div.getBoundingClientRect()\n return {x: r.left, y: r.top, w: r.width}\n },\n card_uid,\n }\n }\n const items = (this.context.current_board.board as Board).all_cards\n .filter((card) => card.file || card.link)\n .map(card_to_item)\n .filter((x) => x) as Array<Item>\n const options: any = {\n index: items.findIndex((x) => x.card_uid === initial_card.uid),\n getThumbBoundsFn: (index: number) => items[index].b(),\n preload: [1, 2],\n loop: false,\n // We don't allow PhotoSwipe to handle the arrow keys [<-] and [->] because\n // PhotoSwipe will switch to the last image when the first image is displayed\n // and the user presses [<-] and we don't want this behavior.\n arrowKeys: false,\n history: false,\n showHideOpacity: true,\n showAnimationDuration: element_enters_screen_duration,\n hideAnimationDuration: element_leaves_screen_duration,\n }\n load_photoswipe_promise\n .then(() => {\n if (!this.init_later) {\n return\n }\n const g = new PhotoSwipe(ref, null, items, options)\n this.gallery = g\n g.listen(\"destroy\", () => {\n ui_actions.close_lightbox()\n })\n g.listen(\"beforeChange\", () => {\n const idx = g.getCurrentIndex()\n const can_navigate_prev = idx > 0\n const can_navigate_next = idx < items.length - 1\n if (\n can_navigate_prev !== this.state.can_navigate_prev ||\n can_navigate_next !== this.state.can_navigate_next\n ) {\n this.setState({can_navigate_prev, can_navigate_next})\n }\n })\n g.init()\n if (!running_on_mobile_device()) {\n g.scrollWrap.addEventListener(\"pswpTap\", (e: any) => {\n if (e.target.classList.contains(\"pswp__img\")) {\n if (ref.classList.contains(\"pswp--zoom-allowed\")) {\n g.toggleDesktopZoom(e.detail.releasePoint)\n }\n }\n })\n }\n })\n .catch(report_error)\n }\n }\n\n enter_fullscreen = () => {\n enter_fullscreen(\n this.pswp_div_ref!,\n /* on_exit_fullscreen: */ () => {\n if (running_on_mobile_device()) {\n this.close()\n }\n },\n )\n }\n\n show_prev_image = () => {\n this.gallery.prev()\n }\n\n show_next_image = () => {\n this.gallery.next()\n }\n\n handle_window_resize = () => {\n this.forceUpdate() // ... for the Fullscreen / Fullscreen Exit icon\n }\n\n handle_keydown = (e: KeyboardEvent) => {\n // Don't do anything if special key pressed to prevent from overriding default browser\n // actions (e.g. in Chrome on Mac cmd+arrow-left returns to previous page) ...\n if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) {\n return\n }\n if (e.keyCode === 37 && this.state.can_navigate_prev) {\n this.show_prev_image()\n } else if (e.keyCode === 39 && this.state.can_navigate_next) {\n this.show_next_image()\n }\n }\n\n componentDidMount() {\n this.dispose_trap_browser_back = trap_browser_back(\"lightbox\", this.on_popstate)\n runInAction(() => {\n ui_state.prevent_touch_scroll_x = true\n this.card_menus_disabled_before = ui_state.card_menus_disabled\n ui_state.card_menus_disabled = true\n })\n addEventListener(\"resize\", this.handle_window_resize)\n document.addEventListener(\"keydown\", this.handle_keydown)\n }\n\n componentWillUnmount() {\n if (this.dispose_trap_browser_back) {\n this.dispose_trap_browser_back()\n this.dispose_trap_browser_back = undefined\n }\n runInAction(() => {\n ui_state.prevent_touch_scroll_x = false\n ui_state.card_menus_disabled = this.card_menus_disabled_before\n })\n removeEventListener(\"resize\", this.handle_window_resize)\n document.removeEventListener(\"keydown\", this.handle_keydown)\n }\n\n render(): any {\n return ReactDOM.createPortal(\n <div\n className=\"pswp\"\n tabIndex={-1}\n role=\"dialog\"\n aria-hidden=\"true\"\n ref={this.update_pswp_div_ref}\n >\n <div className=\"pswp__bg\" />\n <div className=\"pswp__scroll-wrap\">\n <div className=\"pswp__container\" data-test-id=\"Lightbox_container\">\n <div className=\"pswp__item\" />\n <div className=\"pswp__item\" />\n <div className=\"pswp__item\" />\n </div>\n {this.render_ui()}\n </div>\n </div>,\n document.body,\n )\n }\n\n render_ui() {\n const {can_navigate_prev, can_navigate_next} = this.state\n return (\n <div className=\"pswp__ui\">\n <div className=\"pswp__ui_left\">\n {can_navigate_prev && !running_on_mobile_device() && (\n <MDC.IconButton\n icon=\"navigate_before\"\n tooltip={i18n.previous_image}\n onClick={this.show_prev_image}\n />\n )}\n </div>\n <div className=\"pswp__ui_right\">\n {can_navigate_next && !running_on_mobile_device() && (\n <MDC.IconButton\n icon=\"navigate_next\"\n tooltip={i18n.next_image}\n onClick={this.show_next_image}\n />\n )}\n </div>\n <div className=\"pswp__ui_top_left\">\n <MDC.IconButton\n data-test-id=\"Lightbox_close\"\n icon=\"close\"\n tooltip={i18n.close}\n onClick={this.close}\n onTouchEnd={this.close}\n />\n </div>\n <div className=\"pswp__ui_top_right\">\n {!running_on_mobile_device() && can_enter_fullscreen() && (\n <MDC.IconButton\n icon=\"fullscreen\"\n tooltip={i18n.fullscreen}\n onClick={this.enter_fullscreen}\n />\n )}\n {!running_on_mobile_device() && can_exit_fullscreen() && (\n <MDC.IconButton\n icon=\"fullscreen_exit\"\n tooltip={i18n.exit_fullscreen}\n onClick={exit_fullscreen}\n />\n )}\n {this.props.children}\n </div>\n </div>\n )\n }\n}\n", "import {running_on_mobile_device} from \"@cling/lib.web.utils\"\n\nexport const material_motion_duration: number = (function () {\n // https://material.io/guidelines/motion/duration-easing.html#duration-easing-dynamic-durations\n // Transitions on mobile typically occur over 300ms. Desktop animations should be faster and\n // simpler than their mobile counterparts. These animations should last 150ms to 200ms.\n return running_on_mobile_device() ? 300 : 175\n})()\n// Elements entering the screen occur over 225ms (for mobile) ...\nexport const element_enters_screen_duration = Math.round((material_motion_duration * 225) / 300)\n// Elements leaving the screen occur over 195ms (for mobile) ...\nexport const element_leaves_screen_duration = Math.round((material_motion_duration * 195) / 300)\n", "import * as React from \"react\"\nimport {BlobUID, is_BlobUID, MediaTranscodeStatus} from \"@cling/lib.shared.model\"\nimport {media_info_resource} from \"@cling/lib.web.resources\"\n\nimport {classNames} from \"@cling/lib.web.utils\"\nimport {observer} from \"mobx-react\"\nimport {LoadingIndicator} from \"@cling/lib.web.lazy_load/loading_indicator\"\nimport {is_provisional_thumbnail_url, thumbnail_url} from \"@cling/lib.web.resources/thumbnails\"\n\nexport const CondensedThumbnailLoading = ({\n className,\n image_style,\n playable_media,\n onClick,\n}: {\n className?: string\n image_style?: React.CSSProperties\n playable_media: boolean\n onClick?: React.MouseEventHandler\n}) => (\n <div\n className={classNames(\"condensed-thumbnail condensed-thumbnail__loading\", className, {\n \"card-with-icon__play\": playable_media,\n })}\n style={image_style}\n onClick={onClick}\n data-test-id=\"CondensedThumbnail_loading\"\n data-test-thumbnail-state=\"waiting\"\n >\n <LoadingIndicator delay={2000} />\n </div>\n)\n\nexport const CondensedThumbnailNoImage = ({\n className,\n image_style,\n playable_media,\n onClick,\n}: {\n className?: string\n image_style?: React.CSSProperties\n playable_media: boolean\n onClick?: React.MouseEventHandler\n}) => (\n <div\n className={classNames(\"condensed-thumbnail\", className, {\n \"condensed-thumbnail__no-image\": !playable_media && !image_style,\n \"card-with-icon__play\": playable_media,\n })}\n style={image_style}\n onClick={onClick}\n data-test-id=\"CondensedThumbnail_fallback\"\n />\n)\n\nexport const CondensedThumbnail = observer(\n ({\n blob_uid_or_style,\n className,\n playable_media,\n background_color,\n onClick,\n }: {\n blob_uid_or_style: BlobUID | React.CSSProperties\n className?: string\n playable_media?: boolean\n background_color?: string\n onClick?: React.MouseEventHandler<HTMLElement>\n }) => {\n const blob_uid = is_BlobUID(blob_uid_or_style) ? blob_uid_or_style : undefined\n const image_style = is_BlobUID(blob_uid_or_style) ? undefined : blob_uid_or_style\n let aspect_ratio: number\n let attributes: any\n let is_provisional_thumbnail = false\n if (blob_uid) {\n const url = thumbnail_url({blob_uid, width: 128, height: 128})\n const media_info = blob_uid ? media_info_resource.read(blob_uid) : undefined\n if (!media_info || media_info.transcode_status === MediaTranscodeStatus.in_progress) {\n return (\n <CondensedThumbnailLoading\n playable_media={!!playable_media}\n className={className}\n image_style={image_style}\n onClick={playable_media ? onClick : undefined}\n />\n )\n }\n if (media_info.invalid) {\n return (\n <CondensedThumbnailNoImage\n playable_media={!!playable_media}\n className={className}\n image_style={image_style}\n onClick={playable_media ? onClick : undefined}\n />\n )\n }\n is_provisional_thumbnail = is_provisional_thumbnail_url(url)\n const {width: image_width, height: image_height} = media_info\n aspect_ratio = image_height / image_width\n attributes = {\n \"data-blob-uid\": blob_uid /* See card/lightbox.tsx */,\n style: {backgroundImage: `url(${url})`},\n }\n } else {\n aspect_ratio = 1\n attributes = {\n style: image_style,\n }\n }\n if (background_color) {\n attributes.style.backgroundColor = background_color\n }\n return (\n <div\n className={classNames(\"condensed-thumbnail\", className, {\n // Very wide/narrow images should be displayed completely.\n \"condensed-thumbnail--contain\": aspect_ratio < 0.25 || aspect_ratio > 4,\n })}\n data-test-thumbnail-state={is_provisional_thumbnail ? \"waiting\" : \"\"}\n onClick={onClick}\n data-test-id=\"CondensedThumbnail\"\n {...attributes}\n >\n {playable_media && <div className=\"card-with-icon__play\" />}\n </div>\n )\n },\n)\n", "import {BoardUID, UpdateBoardRequest} from \"@cling/lib.shared.model\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport p_limit from \"p-limit\"\nimport {call_function} from \"@cling/lib.shared.faas\"\nimport {can_call_faas} from \"@cling/lib.web.auth\"\n\nconst queue = p_limit(1)\nconst outstanding = new Set<BoardUID>()\n\nexport function schedule_update_board(board_uid: BoardUID) {\n if (outstanding.has(board_uid) || !can_call_faas()) {\n return\n }\n outstanding.add(board_uid)\n queue(() => {\n outstanding.delete(board_uid)\n call_function(new UpdateBoardRequest({board_uid})).catch(report_error)\n }).catch(report_error)\n}\n", "import * as React from \"react\"\nimport {\n AccessLevel,\n AccountUID,\n BoardInfo,\n BoardType,\n is_AccountUID,\n is_TeamUID,\n TeamUID,\n} from \"@cling/lib.shared.model\"\nimport {\n account_resource,\n board_info_resource,\n meet_status_resource,\n team_resource,\n} from \"@cling/lib.web.resources\"\nimport {current_user, ui_state} from \"../state/index\"\nimport type {BoardChooserItem} from \"@cling/lib.web.board_chooser/board_chooser_items\"\nimport {background_style} from \"@cling/lib.web.layout\"\nimport {full_name} from \"@cling/lib.shared.utils\"\nimport {PrincipalInfo} from \"../account/principal_info\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {board_name} from \"./board_name\"\nimport {Icon} from \"@cling/lib.web.mdc\"\nimport {simple_tooltip_event_handlers} from \"@cling/lib.web.mdc/simple_tooltip\"\nimport {board_background_image_url} from \"@cling/lib.web.resources/thumbnails\"\n\n// TODO: Test the filtering, min_access_level etc.\nexport function board_chooser_board_infos(\n filter?: \"system_boards_only\" | \"dashboard_and_user_boards\" | \"user_boards\",\n min_access_level?: AccessLevel,\n) {\n return (\n board_info_resource\n .read_all()\n .filter(\n (x) =>\n x.board_type !== BoardType.people &&\n (filter !== \"system_boards_only\" || x.is_system_board) &&\n (filter !== \"dashboard_and_user_boards\" || x.is_dashboard_or_user_board) &&\n (filter !== \"user_boards\" || x.is_user_board),\n )\n .filter(\n (x) =>\n !min_access_level ||\n (x.acl.access_level(current_user.account_attributes) || 0) >= min_access_level,\n )\n // Filter out boards the user only sees because they are public ...\n .filter(\n (x) =>\n !x.acl.is_public || x.acl.entries(current_user.account_attributes).length > 0,\n )\n )\n}\n\nfunction can_be_folded(board_info: BoardInfo, archived?: boolean) {\n if (board_info.board_type === BoardType.dashboard) {\n return false\n }\n const fourteen_days_ago = Date.now() - 14 * 24 * 60 * 60 * 1000\n return (\n archived ||\n ((board_info.last_important_change || board_info.last_change).date.getTime() <\n fourteen_days_ago &&\n (ui_state.board_last_seen(board_info.uid)?.getTime() ?? Date.now()) < fourteen_days_ago)\n )\n}\n\nexport function board_chooser_props(\n filter?: \"system_boards_only\" | \"dashboard_and_user_boards\" | \"user_boards\",\n min_access_level?: AccessLevel,\n): {items: BoardChooserItem[]} {\n const {account_settings} = current_user\n const board_infos = board_chooser_board_infos(filter, min_access_level)\n function title(board_info: BoardInfo) {\n const {acl} = board_info\n const {all} = acl\n if (all.length === 1) {\n return (\n <div className=\"board-chooser-item__title\">\n <div>{board_name(board_info)}</div>\n <div />\n </div>\n )\n }\n let shared_with = `${i18n.shared_with} `\n const team_names = all\n .filter((x) => is_TeamUID(x))\n .map((x) => team_resource.read(x as TeamUID)?.name || \"...\")\n .sort((a, b) => a.localeCompare(b))\n // SEC: It is important that a user only sees the team if a board is shared with a team\n // and other individual users. In a team-scenario (say a school) we don't want\n // team-members to know who else has access to a board (especially if the team has\n // not full-access to the board)\n if (team_names.length > 0) {\n shared_with += team_names[0]\n } else {\n if (board_info.owner !== current_user.account.uid) {\n shared_with += full_name(account_resource.read(board_info.owner))\n } else {\n const account_names = all\n .filter((x) => is_AccountUID(x))\n .filter((x) => x !== current_user.account.uid)\n .map((x) => full_name(account_resource.read(x as AccountUID)))\n .sort((a, b) => a.localeCompare(b))\n shared_with += account_names[0]\n }\n }\n const is_public = acl.is_public\n if (is_public) {\n if (board_info.indexed_by_search_engines) {\n shared_with = i18n.public\n } else {\n shared_with = i18n.shared_as_link\n }\n } else if (all.length > 2) {\n shared_with += ` +${all.length - 2}`\n }\n return (\n <div className=\"board-chooser-item__title\">\n <div>{board_name(board_info)}</div>\n {is_public && board_info.indexed_by_search_engines && (\n <Icon\n icon=\"public\"\n outlined\n small\n aria-label={shared_with}\n {...simple_tooltip_event_handlers}\n />\n )}\n {is_public && !board_info.indexed_by_search_engines && (\n <Icon\n icon=\"visibility\"\n outlined\n small\n aria-label={shared_with}\n {...simple_tooltip_event_handlers}\n />\n )}\n {!is_public && all.length > 1 && board_info.board_type !== BoardType.people && (\n <Icon\n icon=\"people\"\n outlined\n small\n aria-label={shared_with}\n {...simple_tooltip_event_handlers}\n />\n )}\n {!is_public && all.length === 1 && <div />}\n </div>\n )\n }\n return {\n items: board_infos.map((x) => {\n const archived = account_settings.board_setting(x.uid)?.archived\n const name = board_name(x)\n return {\n uid: x.uid,\n sort: {\n name: name,\n date_ms: (x.last_important_change || x.last_change).date.getTime(),\n },\n user_board_title: title(x),\n user_board_title_str: name,\n archived,\n show_badge: !!(x.is_user_board && ui_state.is_new_or_changed(x)),\n background_style: board_background_style(x),\n can_be_folded: can_be_folded(x, archived),\n selected: ui_state.current_board_uid === x.uid,\n num_participants_in_video_chat:\n meet_status_resource.read(x.uid)?.participants.length ?? 0,\n }\n }),\n }\n}\n\nexport function board_background_style(board_info: BoardInfo): React.CSSProperties {\n if (board_info.board_type === BoardType.people) {\n const shared_with_uid = board_info.people_board_shared_with(current_user.account.uid)\n const shared_with_account = account_resource.read(shared_with_uid)\n return {\n backgroundImage: `url(${shared_with_account?.profile_image_url})`,\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"center center\",\n }\n }\n return background_style({\n url: board_background_image_url(board_info.board_style, {dim: 128}),\n color: board_info.board_style.background_color,\n is_pattern: board_info.board_style.background_is_pattern,\n })\n}\n\nexport function people_chooser_board_infos() {\n return board_info_resource.read_all().filter((x) => x.board_type === BoardType.people)\n}\n\nexport function people_chooser_props(): {items: BoardChooserItem[]} {\n const {\n account: {uid: account_uid},\n account_settings,\n } = current_user\n const board_infos = people_chooser_board_infos()\n return {\n items: board_infos.map((x) => {\n const shared_with_uid = x.people_board_shared_with(account_uid)\n const archived = account_settings.board_setting(x.uid)?.archived\n const name = board_name(x)\n return {\n uid: x.uid,\n sort: {name, date_ms: (x.last_important_change || x.last_change).date.getTime()},\n user_board_title: (\n <PrincipalInfo\n className=\"mdc-list-item__text\"\n display=\"full_name\"\n prefix={archived ? `[${i18n.archived}] ` : \"\"}\n uid={shared_with_uid}\n />\n ),\n user_board_title_str: name,\n archived,\n show_badge: !!ui_state.is_new_or_changed(x),\n background_style: board_background_style(x),\n can_be_folded: can_be_folded(x, archived),\n selected: ui_state.current_board_uid === x.uid,\n num_participants_in_video_chat:\n meet_status_resource.read(x.uid)?.participants.length ?? 0,\n }\n }),\n }\n}\n", "import * as React from \"react\"\nimport {observer} from \"mobx-react\"\nimport {i18n} from \"@cling/lib.web.i18n\"\nimport {\n Blob,\n BlobUID,\n Card,\n EngagementType,\n FileCard as FileCardModel,\n GetDownloadBlobURLRequest,\n GetDownloadBlobURLResponse,\n is_video,\n may_have_thumbnail,\n MediaTranscodeStatus,\n} from \"@cling/lib.shared.model\"\nimport {download_url} from \"../misc/download\"\nimport {ui_actions, ui_state} from \"../state/index\"\nimport {register_auth_listener} from \"@cling/lib.web.auth\"\nimport {cancel_event, trap_browser_back} from \"@cling/lib.web.utils\"\nimport {not_null} from \"@cling/lib.shared.utils\"\nimport {CondensedThumbnail, CondensedThumbnailNoImage} from \"./condensed_thumbnail\"\nimport {Lightbox} from \"./lightbox\"\nimport {decorate_emojis} from \"@cling/lib.web.utils/decorate_emojis\"\nimport {video_player_state, is_playable_media} from \"./video_player\"\nimport {title_tag} from \"./utils\"\nimport {report_user_engagement} from \"@cling/lib.web.analytics\"\nimport {media_info_resource} from \"@cling/lib.web.resources\"\nimport {simple_tooltip_event_handlers} from \"@cling/lib.web.mdc/simple_tooltip\"\nimport {call_function} from \"@cling/lib.shared.faas\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {LoadingIndicator} from \"@cling/lib.web.lazy_load/loading_indicator\"\nimport ReactDOM from \"react-dom\"\nimport {IconButton, Snackbar} from \"@cling/lib.web.mdc\"\nimport {classNames} from \"@cling/lib.web.utils\"\n\nconst PDF_VIEWER_VERSION = \"2.14.305_29\"\n\nexport const DefaultFileCard = observer(({card}: {card: FileCardModel}) => {\n const [pdf_viewer_shown, set_pdf_viewer_shown] = React.useState(false)\n const pdf_preview = React.useCallback(\n (e: React.MouseEvent) => {\n if (card.file.blob.mime_type === \"application/pdf\") {\n set_pdf_viewer_shown(true)\n e.preventDefault()\n e.stopPropagation()\n return true\n }\n return false\n },\n [card],\n )\n const on_download_file = React.useCallback(\n (e: React.MouseEvent) => {\n if (pdf_preview(e)) {\n return\n }\n report_user_engagement(EngagementType.download_file)\n },\n [pdf_preview],\n )\n const open_lightbox_or_play = React.useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n e.stopPropagation()\n e.preventDefault()\n if (pdf_preview(e)) {\n return\n }\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 return\n }\n ui_actions.open_lightbox(card)\n },\n [card, pdf_preview],\n )\n const lightbox_shown = ui_state.lightbox_shown(card)\n const {file_name, title, blob} = card.file\n const matches = ui_state.search_state.search_matches(card)\n const file_name_html = ui_state.search_state.highlight_match(card, \"file_name\", matches)\n const title_html = ui_state.search_state.highlight_match(card, \"title\", matches)\n const playable_media = is_playable_media(card)\n return (\n <>\n <DefaultFileCardPresentation\n onClick={on_download_file}\n file_name={file_name}\n file_name_html={file_name_html}\n file_size={blob.size}\n title={title}\n title_html={title_html}\n blob={blob}\n card={card}\n icon_on_click={open_lightbox_or_play}\n playable_media={playable_media}\n />\n {lightbox_shown && <Lightbox initial_card={card} />}\n {pdf_viewer_shown && (\n <PDFViewer card={card} on_close={() => set_pdf_viewer_shown(false)} />\n )}\n </>\n )\n})\n\nexport const DefaultFileCardPresentation = observer(\n ({\n blob,\n card,\n file_name,\n file_name_html,\n file_size,\n title,\n title_html,\n icon_on_click,\n playable_media,\n onClick,\n }: {\n onClick?: React.MouseEventHandler<any>\n file_name: string\n file_name_html?: string\n file_size: number\n title?: string\n title_html?: string\n playable_media?: boolean\n icon_on_click?: React.MouseEventHandler<HTMLElement>\n } & (\n | {\n blob: Blob\n card: Card\n }\n | {\n blob?: never\n card?: never\n }\n )) => {\n const file_name_parts = (file_name || \"\").split(\".\")\n // TODO: (2017-05) (SEC) Server-side should check that mime-type and file-extension match.\n // If not then file-extension should be set to the appropriate one.\n let icon = file_name_parts[file_name_parts.length - 1]\n if (file_name_parts.length < 2 || icon.length > 4) {\n icon = \"bin\"\n }\n const headline_html =\n title_html || file_name_html\n ? {\n dangerouslySetInnerHTML: {\n __html: decorate_emojis(not_null(title_html || file_name_html)),\n },\n }\n : {children: decorate_emojis(title || file_name)}\n let additional_filename\n if (title || title_html) {\n additional_filename = file_name_html\n ? {dangerouslySetInnerHTML: {__html: file_name_html}}\n : {children: file_name}\n }\n let thumbnail_blob_uid: BlobUID | undefined\n if (card?.file?.preview_image_blob) {\n thumbnail_blob_uid = card.file.preview_image_blob.uid\n } else if (\n !!blob &&\n may_have_thumbnail(blob) &&\n (!is_video(blob) ||\n media_info_resource.read(blob.uid)?.transcode_status !== MediaTranscodeStatus.error)\n ) {\n thumbnail_blob_uid = blob.uid\n }\n const HeadlineTag = card ? title_tag(card) : \"div\"\n return (\n <DefaultFileCardAnchor\n blob_uid={blob?.uid}\n file_name={file_name}\n className=\"card-details file-card card-with-icon\"\n classNameFallback=\"card-details file-card card-with-icon\"\n onClick={onClick}\n onClickFallback={cancel_event}\n >\n <div className=\"card-with-icon__icon-outline\">\n {!!thumbnail_blob_uid && (\n <CondensedThumbnail\n className=\"cursor--zoom-in\"\n playable_media={playable_media}\n blob_uid_or_style={thumbnail_blob_uid}\n onClick={icon_on_click}\n />\n )}\n {!thumbnail_blob_uid && playable_media && (\n <CondensedThumbnailNoImage\n className=\"cursor--zoom-in\"\n playable_media\n onClick={icon_on_click}\n />\n )}\n {!(thumbnail_blob_uid || playable_media) && (\n <div\n className=\"card-with-icon__icon file-card__icon\"\n onClick={cancel_event}\n >\n {icon}\n </div>\n )}\n </div>\n <div className=\"card-with-icon__content\">\n <HeadlineTag\n className=\"card-with-icon__title\"\n data-test-id={\n title_html ? \"DefaultFileCard_title\" : \"DefaultFileCard_file_name\"\n }\n aria-label={file_name}\n {...headline_html}\n {...simple_tooltip_event_handlers}\n />\n <div className=\"card-with-icon__caption\">\n {i18n.format_file_size(file_size)}\n {!!additional_filename && (\n <>\n <div> - </div>\n <div\n data-test-id=\"DefaultFileCard_file_name\"\n {...additional_filename}\n />\n </>\n )}\n </div>\n </div>\n </DefaultFileCardAnchor>\n )\n },\n)\n\nexport const DefaultFileCardAnchor = ({\n blob_uid,\n file_name,\n children,\n className,\n classNameFallback,\n onClick,\n onClickFallback,\n}: {\n blob_uid?: BlobUID\n file_name: string\n children: any\n className?: string\n classNameFallback?: string\n onClick?: React.MouseEventHandler<any>\n onClickFallback?: React.MouseEventHandler<any>\n}) => {\n const [url, set_url] = React.useState<string | undefined>(undefined)\n React.useEffect(() => {\n if (!blob_uid) {\n return\n }\n const doit = () => {\n set_url(\n download_url({\n blob_uid,\n file_name: file_name,\n attachment: false,\n }),\n )\n }\n if (process.env.F_PUBLIC) {\n doit()\n } else {\n return register_auth_listener(doit)\n }\n }, [blob_uid, file_name])\n if (!url) {\n return (\n <div className={classNameFallback} onClick={onClickFallback}>\n {children}\n </div>\n )\n }\n return (\n // We need to use an anchor element here to fully support browser previews (mostly PDF)\n // across all platforms. Furthermore we want to give (desktop) users the ability to\n // use the browser's context menu for actions like `Save As ...`.\n <a\n data-test-id=\"DefaultFileCardAnchor\"\n className={className}\n onClick={onClick}\n // This is important if users choose to use `Save As ...` from the browser's\n // context menu.\n download={file_name}\n // We need to open a new window:\n // - on iOS because otherwise the download will happen in the background and the\n // user is abruptly confronted with the result.\n // - on desktop browsers, because we would *navigate* to the download and leave\n // the current page.\n target=\"_blank\"\n href={url}\n draggable={false}\n rel=\"nofollow noreferrer\"\n >\n {children}\n </a>\n )\n}\n\nconst PDFViewer = ({card, on_close}: {card: FileCardModel; on_close: () => void}) => {\n const [iframe_url, set_iframe_url] = React.useState(\"\")\n const [fade_out, set_fade_out] = React.useState(false)\n const close = React.useCallback(() => {\n set_fade_out(true)\n setTimeout(on_close, 300)\n }, [on_close])\n React.useEffect(() => {\n call_function(\n new GetDownloadBlobURLRequest({blob_uid: card.file.blob.uid}),\n GetDownloadBlobURLResponse,\n )\n .then((res) => {\n set_iframe_url(\n `/c/dist/pdfjs_${PDF_VIEWER_VERSION}/web/viewer.html?file=${encodeURIComponent(\n res.download_url + \"#\" + card.file.file_name,\n )}`,\n )\n })\n .catch((error) => {\n Snackbar.show_message(i18n.failed_to_preview_pdf)\n report_error(\"Failed to preview pdf\", error)\n on_close()\n })\n }, [card, on_close])\n React.useEffect(() => {\n return trap_browser_back(\"video_player\", on_close)\n }, [on_close])\n if (!iframe_url) {\n return ReactDOM.createPortal(\n <div className=\"pdf-viewer pdf-viewer--show\" data-test-id=\"PDFViewer_loading\">\n <LoadingIndicator />\n </div>,\n document.body,\n )\n }\n return ReactDOM.createPortal(\n <div\n className={classNames(\"pdf-viewer\", {\n \"pdf-viewer--show\": !fade_out,\n \"pdf-viewer--hide\": fade_out,\n })}\n data-test-id=\"PDFViewer\"\n >\n <div className=\"pdf-viewer__close\">\n <IconButton data-test-id=\"PDFViewer_close\" icon=\"arrow_back\" onClick={close} />\n </div>\n <iframe\n data-test-id=\"PDFViewer_iframe\"\n className=\"pdf-viewer__iframe\"\n name=\"pdf-viewer\"\n src={iframe_url}\n ></iframe>\n </div>,\n document.body,\n )\n}\n", "import React from \"react\"\nimport {\n Card,\n Link,\n Note,\n File,\n Inbox,\n Column,\n Root,\n extract_linked_board_and_card_uid,\n} from \"@cling/lib.shared.model\"\nimport {observer} from \"mobx-react\"\nimport {board_info_resource} from \"@cling/lib.web.resources\"\nimport {board_name} from \"../board/board_name\"\nimport {assert_never} from \"@cling/lib.shared.utils\"\nimport {classNames} from \"@cling/lib.web.utils\"\n\nexport const CardSynopsisOneLiner = observer(\n ({card, className}: {card: Card; className?: string}) => (\n <CardSynopsis card={card} className={classNames(className, \"card-synopsis--one-liner\")} />\n ),\n)\n\nexport const CardSynopsis = observer(({card, className}: {card: Card; className?: string}) => {\n className = classNames(className, \"card-synopsis\")\n if (card.kind instanceof Note) {\n if (card.kind.title) {\n return <div className={className}>{card.kind.title}</div>\n }\n if (card.kind.safe_html) {\n return (\n <div\n className={className}\n dangerouslySetInnerHTML={{__html: card.kind.safe_html}}\n />\n )\n }\n return null\n } else if (card.kind instanceof Link) {\n const linked_board_uid = extract_linked_board_and_card_uid(card.kind.url)?.board_uid\n if (linked_board_uid) {\n const board_info = board_info_resource.read(linked_board_uid)\n if (board_info) {\n return <div className={className}>{board_name(board_info)}</div>\n }\n }\n return <div className={className}>{card.kind.title || card.kind.url}</div>\n } else if (card.kind instanceof File) {\n return <div className={className}>{card.kind.title || card.kind.file_name}</div>\n } else if (card.kind instanceof Inbox) {\n return null\n } else if (card.kind instanceof Column) {\n return null\n } else if (card.kind instanceof Root) {\n return null\n } else {\n assert_never(card.kind)\n return null\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> - </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", "/* eslint-disable */\n// @ts-nocheck\n// Copied from https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js\n// We had to copy the code because we don't want any Worker related code and esbuild throws\n// an error (https://github.com/evanw/esbuild/issues/607#issuecomment-804011666) ...\nvar raf = (function () {\n var TIME = Math.floor(1000 / 60)\n var frame, cancel\n var frames: Record<string, ReturnType<typeof requestAnimationFrame>> = {}\n var lastFrameTime = 0\n\n if (typeof requestAnimationFrame === \"function\" && typeof cancelAnimationFrame === \"function\") {\n frame = function (cb: () => void) {\n var id = Math.random()\n\n frames[id] = requestAnimationFrame(function onFrame(time) {\n if (lastFrameTime === time || lastFrameTime + TIME - 1 < time) {\n lastFrameTime = time\n delete frames[id]\n\n cb()\n } else {\n frames[id] = requestAnimationFrame(onFrame)\n }\n })\n\n return id\n }\n cancel = function (id) {\n if (frames[id]) {\n cancelAnimationFrame(frames[id])\n }\n }\n } else {\n frame = function (cb) {\n return setTimeout(cb, TIME)\n }\n cancel = function (timer) {\n return clearTimeout(timer)\n }\n }\n\n return {frame: frame, cancel: cancel}\n})()\n\nvar defaults = {\n particleCount: 50,\n angle: 90,\n spread: 45,\n startVelocity: 45,\n decay: 0.9,\n gravity: 1,\n drift: 0,\n ticks: 200,\n x: 0.5,\n y: 0.5,\n shapes: [\"square\", \"circle\"],\n zIndex: 100,\n colors: [\"#26ccff\", \"#a25afd\", \"#ff5e7e\", \"#88ff5a\", \"#fcff42\", \"#ffa62d\", \"#ff36ff\"],\n // probably should be true, but back-compat\n disableForReducedMotion: false,\n scalar: 1,\n}\n\nfunction convert(val, transform) {\n return transform ? transform(val) : val\n}\n\nfunction isOk(val) {\n return !(val === null || val === undefined)\n}\n\nfunction prop(options, name, transform) {\n return convert(options && isOk(options[name]) ? options[name] : defaults[name], transform)\n}\n\nfunction onlyPositiveInt(number) {\n return number < 0 ? 0 : Math.floor(number)\n}\n\nfunction randomInt(min, max) {\n // [min, max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n\nfunction toDecimal(str) {\n return parseInt(str, 16)\n}\n\nfunction colorsToRgb(colors) {\n return colors.map(hexToRgb)\n}\n\nfunction hexToRgb(str) {\n var val = String(str).replace(/[^0-9a-f]/gi, \"\")\n\n if (val.length < 6) {\n val = val[0] + val[0] + val[1] + val[1] + val[2] + val[2]\n }\n\n return {\n r: toDecimal(val.substring(0, 2)),\n g: toDecimal(val.substring(2, 4)),\n b: toDecimal(val.substring(4, 6)),\n }\n}\n\nfunction getOrigin(options) {\n var origin = prop(options, \"origin\", Object)\n origin.x = prop(origin, \"x\", Number)\n origin.y = prop(origin, \"y\", Number)\n\n return origin\n}\n\nfunction setCanvasWindowSize(canvas) {\n canvas.width = document.documentElement.clientWidth\n canvas.height = document.documentElement.clientHeight\n}\n\nfunction setCanvasRectSize(canvas) {\n var rect = canvas.getBoundingClientRect()\n canvas.width = rect.width\n canvas.height = rect.height\n}\n\nfunction getCanvas(zIndex) {\n var canvas = document.createElement(\"canvas\")\n\n canvas.style.position = \"fixed\"\n canvas.style.top = \"0px\"\n canvas.style.left = \"0px\"\n canvas.style.pointerEvents = \"none\"\n canvas.style.zIndex = zIndex\n\n return canvas\n}\n\nfunction ellipse(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle, antiClockwise?) {\n context.save()\n context.translate(x, y)\n context.rotate(rotation)\n context.scale(radiusX, radiusY)\n context.arc(0, 0, 1, startAngle, endAngle, antiClockwise)\n context.restore()\n}\n\nfunction randomPhysics(opts) {\n var radAngle = opts.angle * (Math.PI / 180)\n var radSpread = opts.spread * (Math.PI / 180)\n\n return {\n x: opts.x,\n y: opts.y,\n wobble: Math.random() * 10,\n velocity: opts.startVelocity * 0.5 + Math.random() * opts.startVelocity,\n angle2D: -radAngle + (0.5 * radSpread - Math.random() * radSpread),\n tiltAngle: Math.random() * Math.PI,\n color: opts.color,\n shape: opts.shape,\n tick: 0,\n totalTicks: opts.ticks,\n decay: opts.decay,\n drift: opts.drift,\n random: Math.random() + 5,\n tiltSin: 0,\n tiltCos: 0,\n wobbleX: 0,\n wobbleY: 0,\n gravity: opts.gravity * 3,\n ovalScalar: 0.6,\n scalar: opts.scalar,\n }\n}\n\nfunction updateFetti(context, fetti) {\n fetti.x += Math.cos(fetti.angle2D) * fetti.velocity + fetti.drift\n fetti.y += Math.sin(fetti.angle2D) * fetti.velocity + fetti.gravity\n fetti.wobble += 0.1\n fetti.velocity *= fetti.decay\n fetti.tiltAngle += 0.1\n fetti.tiltSin = Math.sin(fetti.tiltAngle)\n fetti.tiltCos = Math.cos(fetti.tiltAngle)\n fetti.random = Math.random() + 5\n fetti.wobbleX = fetti.x + 10 * fetti.scalar * Math.cos(fetti.wobble)\n fetti.wobbleY = fetti.y + 10 * fetti.scalar * Math.sin(fetti.wobble)\n\n var progress = fetti.tick++ / fetti.totalTicks\n\n var x1 = fetti.x + fetti.random * fetti.tiltCos\n var y1 = fetti.y + fetti.random * fetti.tiltSin\n var x2 = fetti.wobbleX + fetti.random * fetti.tiltCos\n var y2 = fetti.wobbleY + fetti.random * fetti.tiltSin\n\n context.fillStyle =\n \"rgba(\" +\n fetti.color.r +\n \", \" +\n fetti.color.g +\n \", \" +\n fetti.color.b +\n \", \" +\n (1 - progress) +\n \")\"\n context.beginPath()\n\n if (fetti.shape === \"circle\") {\n context.ellipse\n ? context.ellipse(\n fetti.x,\n fetti.y,\n Math.abs(x2 - x1) * fetti.ovalScalar,\n Math.abs(y2 - y1) * fetti.ovalScalar,\n (Math.PI / 10) * fetti.wobble,\n 0,\n 2 * Math.PI,\n )\n : ellipse(\n context,\n fetti.x,\n fetti.y,\n Math.abs(x2 - x1) * fetti.ovalScalar,\n Math.abs(y2 - y1) * fetti.ovalScalar,\n (Math.PI / 10) * fetti.wobble,\n 0,\n 2 * Math.PI,\n )\n } else {\n context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y))\n context.lineTo(Math.floor(fetti.wobbleX), Math.floor(y1))\n context.lineTo(Math.floor(x2), Math.floor(y2))\n context.lineTo(Math.floor(x1), Math.floor(fetti.wobbleY))\n }\n\n context.closePath()\n context.fill()\n\n return fetti.tick < fetti.totalTicks\n}\n\nfunction animate(canvas, fettis, resizer, size, done) {\n var animatingFettis = fettis.slice()\n var context = canvas.getContext(\"2d\")\n var animationFrame\n var destroy\n\n var prom = new Promise<void>(function (resolve) {\n function onDone() {\n animationFrame = destroy = null\n\n context.clearRect(0, 0, size.width, size.height)\n\n done()\n resolve()\n }\n\n function update() {\n if (!size.width && !size.height) {\n resizer(canvas)\n size.width = canvas.width\n size.height = canvas.height\n }\n\n context.clearRect(0, 0, size.width, size.height)\n\n animatingFettis = animatingFettis.filter(function (fetti) {\n return updateFetti(context, fetti)\n })\n\n if (animatingFettis.length) {\n animationFrame = raf.frame(update)\n } else {\n onDone()\n }\n }\n\n animationFrame = raf.frame(update)\n destroy = onDone\n })\n\n return {\n addFettis: function (fettis) {\n animatingFettis = animatingFettis.concat(fettis)\n\n return prom\n },\n canvas: canvas,\n promise: prom,\n reset: function () {\n if (animationFrame) {\n raf.cancel(animationFrame)\n }\n\n if (destroy) {\n destroy()\n }\n },\n }\n}\n\nexport function confettiCannon(canvas, globalOpts) {\n var isLibCanvas = !canvas\n var allowResize = !!prop(globalOpts || {}, \"resize\")\n var globalDisableForReducedMotion = prop(globalOpts, \"disableForReducedMotion\", Boolean)\n var resizer = isLibCanvas ? setCanvasWindowSize : setCanvasRectSize\n var initialized = false\n var preferLessMotion =\n typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion)\").matches\n var animationObj\n\n function fireLocal(options, size, done) {\n var particleCount = prop(options, \"particleCount\", onlyPositiveInt)\n var angle = prop(options, \"angle\", Number)\n var spread = prop(options, \"spread\", Number)\n var startVelocity = prop(options, \"startVelocity\", Number)\n var decay = prop(options, \"decay\", Number)\n var gravity = prop(options, \"gravity\", Number)\n var drift = prop(options, \"drift\", Number)\n var colors = prop(options, \"colors\", colorsToRgb)\n var ticks = prop(options, \"ticks\", Number)\n var shapes = prop(options, \"shapes\")\n var scalar = prop(options, \"scalar\")\n var origin = getOrigin(options)\n\n var temp = particleCount\n var fettis = []\n\n var startX = canvas.width * origin.x\n var startY = canvas.height * origin.y\n\n while (temp--) {\n fettis.push(\n randomPhysics({\n x: startX,\n y: startY,\n angle: angle,\n spread: spread,\n startVelocity: startVelocity,\n color: colors[temp % colors.length],\n shape: shapes[randomInt(0, shapes.length)],\n ticks: ticks,\n decay: decay,\n gravity: gravity,\n drift: drift,\n scalar: scalar,\n }),\n )\n }\n\n // if we have a previous canvas already animating,\n // add to it\n if (animationObj) {\n return animationObj.addFettis(fettis)\n }\n\n animationObj = animate(canvas, fettis, resizer, size, done)\n\n return animationObj.promise\n }\n\n function fire(options) {\n var disableForReducedMotion =\n globalDisableForReducedMotion || prop(options, \"disableForReducedMotion\", Boolean)\n var zIndex = prop(options, \"zIndex\", Number)\n\n if (disableForReducedMotion && preferLessMotion) {\n return new Promise<void>(function (resolve) {\n resolve()\n })\n }\n\n if (isLibCanvas && animationObj) {\n // use existing canvas from in-progress animation\n canvas = animationObj.canvas\n } else if (isLibCanvas && !canvas) {\n // create and initialize a new canvas\n canvas = getCanvas(zIndex)\n document.body.appendChild(canvas)\n }\n\n if (allowResize && !initialized) {\n // initialize the size of a user-supplied canvas\n resizer(canvas)\n }\n\n var size = {\n width: canvas.width,\n height: canvas.height,\n }\n\n initialized = true\n\n function onResize() {\n // don't actually query the size here, since this\n // can execute frequently and rapidly\n size.width = size.height = null\n }\n\n function done() {\n animationObj = null\n\n if (allowResize) {\n global.removeEventListener(\"resize\", onResize)\n }\n\n if (isLibCanvas && canvas) {\n document.body.removeChild(canvas)\n canvas = null\n initialized = false\n }\n }\n\n if (allowResize) {\n global.addEventListener(\"resize\", onResize, false)\n }\n\n return fireLocal(options, size, done)\n }\n\n fire.reset = function () {\n if (animationObj) {\n animationObj.reset()\n }\n }\n\n return fire\n}\n", "import {memoize, nop} from \"@cling/lib.shared.utils\"\nimport {confettiCannon} from \"./_confetti\"\n\nexport function confetti({x, y}: {x: number; y: number}) {\n canvas_confetti()({\n particleCount: 20,\n spread: 40,\n decay: 0.9,\n gravity: 2,\n ticks: 40,\n startVelocity: 20,\n origin: {x: x / window.innerWidth, y: y / window.innerHeight},\n })?.catch(nop)\n}\n\nconst canvas_confetti = memoize(() => {\n return confettiCannon(null as any, {useWorker: false, resize: true})\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", "export function is_elm_inside_an_active_rich_text_editor(elm?: HTMLElement): boolean {\n if (!elm || !elm.closest) {\n return false\n }\n const editor = elm.closest(\".ProseMirror\")\n if (!editor) {\n return false\n }\n return !!editor.getAttribute(\"contenteditable\")\n}\n"], "mappings": "60CACAA,IAEO,IAAMC,EAAqBC,GAG/B,CACC,cAAe,CAAC,MAAO,OAAW,gBAAiB,QAAQ,EAC3D,kBAAmB,MACvB,CAAC,ECTDC,ICAAC,IAMO,SAASC,GAAkBC,EAA8B,CAC5D,GAAM,CAAC,cAAAC,CAAa,EAAUC,EAAWC,CAAY,EACrD,MAAI,CAACF,EAAc,OAAS,CAACD,GAAQA,EAAK,YAAcC,EAAc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GAAG,CAEX,EAIJN,EAAC,OACG,IAAKb,EACL,UAAW6B,EAAW,CAClB,UAAW,CAACrD,EAAK,MACjB,WAAYuC,EACZ,aAAcC,EACd,sBAAuBxC,EAAK,MAC5B,4BAA6B0C,EAAiB,MAClD,CAAC,EACD,gBAAe1C,EAAK,IACpB,eAAa,aAEZgD,CACL,CAER,OAASM,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,EACAzB,EAAe0B,CAAmB,EAC3BlB,EAACC,GAAA,CAAU,KAAMtC,EAAM,WAAYuD,EAAqB,CACnE,CACJ,CAAC,EmC5RM,SAASO,GAAyCC,EAA4B,CACjF,GAAI,CAACA,GAAO,CAACA,EAAI,QACb,MAAO,GAEX,IAAMC,EAASD,EAAI,QAAQ,cAAc,EACzC,OAAKC,EAGE,CAAC,CAACA,EAAO,aAAa,iBAAiB,EAFnC,EAGf,CATgBC,EAAAH,GAAA", "names": ["init_compat_module", "BoardContext", "J", "init_compat_module", "init_compat_module", "useCardPermission", "card", "current_board", "x", "BoardContext", "current_user", "__name", "useCurrentBoardPermission", "board", "display_version", "permissions", "set_permissions", "d", "y", "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", "RelDate", "__name", "date", "render", "className", "data_test_id", "rendered_rel_date", "set_rendered_rel_date", "d", "y", "timeout_id", "update", "i18n", "the_now", "time_elm", "_", "simple_tooltip_event_handlers", "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", "isElement", "el", "nodeType", "canOverflow", "overflow", "skipOverflowHiddenElements", "isScrollable", "clientHeight", "scrollHeight", "clientWidth", "scrollWidth", "style", "getComputedStyle", "overflowY", "overflowX", "frame", "ownerDocument", "defaultView", "frameElement", "e", "alignNearest", "scrollingEdgeStart", "scrollingEdgeEnd", "scrollingSize", "scrollingBorderStart", "scrollingBorderEnd", "elementEdgeStart", "elementEdgeEnd", "elementSize", "target", "options", "windowWithViewport", "window", "scrollMode", "block", "inline", "boundary", "checkBoundary", "node", "TypeError", "scrollingElement", "document", "documentElement", "frames", "cursor", "parentElement", "push", "body", "viewportWidth", "visualViewport", "width", "innerWidth", "viewportHeight", "height", "innerHeight", "viewportX", "scrollX", "pageXOffset", "viewportY", "scrollY", "pageYOffset", "getBoundingClientRect", "targetHeight", "targetWidth", "targetTop", "top", "targetRight", "right", "targetBottom", "bottom", "targetLeft", "left", "targetBlock", "targetInline", "computations", "index", "length", "frameStyle", "borderLeft", "parseInt", "borderLeftWidth", "borderTop", "borderTopWidth", "borderRight", "borderRightWidth", "borderBottom", "borderBottomWidth", "blockScroll", "inlineScroll", "scrollbarWidth", "offsetWidth", "scrollbarHeight", "offsetHeight", "Math", "max", "scrollLeft", "scrollTop", "min", "isOptionsObject", "options", "__name", "defaultBehavior", "actions", "behavior", "canSmoothScroll", "_ref", "el", "top", "left", "getOptions", "scrollIntoView", "target", "isTargetAttached", "index_module_default", "computeOptions", "es_default", "memoizedNow", "now", "__name", "step", "context", "time", "elapsed", "value", "currentX", "currentY", "smoothScroll", "el", "x", "y", "duration", "ease", "cb", "t", "scrollable", "startX", "startY", "method", "shouldSmoothScroll", "options", "scroll", "target", "overrides", "es_default", "actions", "results", "_ref", "left", "top", "startLeft", "startTop", "resolve", "smoothScrollIntoView", "init_compat_module", "React_lazy", "mod", "mode", "m", "Rn", "__name", "React_suspense", "children", "LoadingIndicator", "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", "card_level", "card", "ui_state", "__name", "title_tag", "init_compat_module", "below_card_insert_pos", "card", "has_visible_children", "ui_state", "__name", "above_card_insert_pos", "init_preact_module", "init_preact_module", "board_to_react", "props", "elms", "_", "RBoard", "__name", "board", "body_children", "card", "print", "is_card_visible", "blob_uris", "inbox", "x", "RColumn", "k", "style", "BoardStyle", "RCard", "y", "column", "board_names", "RNote", "RLink", "RFile", "not_null", "note", "link", "target_board_uid", "extract_linked_board_and_card_uid", "board_name", "file", "blob_uri", "is_image", "board_style", "color", "image_url", "image_blob", "is_background_pattern", "init_preact_module", "init_hooks_module", "supported_thumbnail_dims", "_thumbnail_url", "_image_cache_thrash_index", "provisional_thumbnails", "board_background_image_url", "board_style", "dim", "url", "thumbnail_url", "__name", "init", "args", "_thumbnail_url", "_image_cache_thrash_index", "cache", "keys", "key", "response", "file", "blob_uid", "as_BlobUID", "provisional_thumbnails", "error", "report_info", "width", "height", "not_null", "provisional", "thumbnail_height", "supported_thumbnail_dims", "thumbnail_width", "thrash", "is_provisional_thumbnail_url", "url", "__name", "print_board", "board", "card", "report_user_engagement", "print_window", "interval_id", "num_errors_to_ignore", "run", "__name", "progress_div", "_", "i18n", "PrintApp", "y", "k", "root", "D", "is_card_visible", "x", "ui_state", "file_cards", "blob_uris", "file", "is_image", "url", "thumbnail_url", "download_url", "board_to_react", "board_info_resource", "with_timeout", "resolve", "interval_id_2", "num_images_loaded", "img_elements", "image_urls", "f", "image_url", "img", "error", "report_error", "import_router", "init_compat_module", "init_compat_module", "MAX_CARD_ASPECT_RATIO", "MAX_COVER_ASPECT_RATIO", "loading", "_", "LoadingIndicator", "broken", "ImageCard", "observer", "blob_uid_or_style", "card", "title", "title_display", "onClick", "className", "display", "playable_media", "dimension_elm", "A", "image_dim", "set_image_dim", "d", "blob_uid", "is_BlobUID", "media_info", "media_info_resource", "y", "padding_top", "background_size", "thumbnail_width", "thumbnail_height", "card_width", "image_width", "image_height", "device_pixel_ratio", "img_aspect_ratio", "show_more", "q", "e", "ui_actions", "condensed", "ui_state", "classNames", "AsyncThumbnail", "i18n", "background_repeat", "background_color", "prev_url", "set_prev_url", "url", "set_url", "is_provisional_thumbnail", "set_is_provisional_thumbnail", "style", "new_url", "thumbnail_url", "img", "is_provisional_thumbnail_url", "k", "simple_tooltip_event_handlers", "ImageCardPreview", "image_url", "badge", "init_compat_module", "material_motion_duration", "running_on_mobile_device", "element_enters_screen_duration", "element_leaves_screen_duration", "max_thumbnail_size", "device_pixel_ratio", "max_width", "max_height", "__name", "_Lightbox", "N", "__publicField", "dispose", "ref", "load_photoswipe_promise", "load_photoswipe", "max_thumbnail_width", "max_thumbnail_height", "initial_card", "card_to_item", "card", "card_uid", "thumbnail_div", "url", "blob_uid", "as_BlobUID", "thumbnail_width", "thumbnail_height", "req", "from_b64url", "QueryThumbnailRequest", "media_info", "media_info_resource", "image_width", "image_height", "w", "h", "aspect_ratio", "thumbnail_url", "r", "items", "x", "options", "index", "element_enters_screen_duration", "element_leaves_screen_duration", "g", "ui_actions", "idx", "can_navigate_prev", "can_navigate_next", "running_on_mobile_device", "e", "report_error", "enter_fullscreen", "trap_browser_back", "runInAction", "ui_state", "$", "_", "IconButton", "i18n", "can_enter_fullscreen", "can_exit_fullscreen", "exit_fullscreen", "BoardContext", "Lightbox", "init_compat_module", "CondensedThumbnailLoading", "__name", "className", "image_style", "playable_media", "onClick", "_", "classNames", "LoadingIndicator", "CondensedThumbnailNoImage", "CondensedThumbnail", "observer", "blob_uid_or_style", "background_color", "blob_uid", "is_BlobUID", "aspect_ratio", "attributes", "is_provisional_thumbnail", "url", "thumbnail_url", "media_info", "media_info_resource", "is_provisional_thumbnail_url", "image_width", "image_height", "queue", "pLimit", "outstanding", "schedule_update_board", "board_uid", "can_call_faas", "call_function", "UpdateBoardRequest", "report_error", "__name", "init_compat_module", "board_chooser_board_infos", "filter", "min_access_level", "board_info_resource", "x", "current_user", "__name", "can_be_folded", "board_info", "archived", "fourteen_days_ago", "ui_state", "board_chooser_props", "account_settings", "board_infos", "title", "acl", "all", "_", "board_name", "shared_with", "i18n", "team_names", "is_TeamUID", "team_resource", "a", "b", "full_name", "account_resource", "account_names", "is_AccountUID", "is_public", "Icon", "simple_tooltip_event_handlers", "name", "board_background_style", "meet_status_resource", "shared_with_uid", "background_style", "board_background_image_url", "people_chooser_board_infos", "people_chooser_props", "account_uid", "PrincipalInfo", "LinkCard_estimated_height", "card", "__name", "LinkCard", "observer", "on_click", "q", "e", "open_intercom", "report_user_engagement", "on_click_on_image", "extract_linked_board_and_card_uid", "is_playable_media", "video_player_state", "ui_actions", "link", "plain_url", "plain_title", "url_info", "url_info_resource", "derive_URLUID", "linked_board_uid", "featured_blob_uid", "logo_blob_uid", "screenshot_blob_uid", "image_style", "domain", "extract_domain", "matches", "ui_state", "title_html", "url_matches", "y", "TitleTag", "title_tag", "render_title", "className", "_", "decorate_emojis", "render_domain", "schedule_update_board", "playable_media", "style", "lightbox_shown", "blob_uid", "is_cling_hp", "is_color", "classNames", "LinkCardAnchor", "ImageCard", "not_null", "Lightbox", "k", "LinkThumbnail", "onClick", "children", "target", "blob_uid_or_style", "is_playable", "is_loading", "is_BlobUID", "CondensedThumbnailLoading", "cancel_event", "CondensedThumbnail", "CondensedThumbnailNoImage", "init_compat_module", "init_compat_module", "PDF_VIEWER_VERSION", "DefaultFileCard", "observer", "card", "pdf_viewer_shown", "set_pdf_viewer_shown", "d", "pdf_preview", "q", "e", "on_download_file", "report_user_engagement", "open_lightbox_or_play", "is_playable_media", "video_player_state", "ui_actions", "lightbox_shown", "ui_state", "file_name", "title", "blob", "matches", "file_name_html", "title_html", "playable_media", "_", "k", "DefaultFileCardPresentation", "Lightbox", "PDFViewer", "file_size", "icon_on_click", "onClick", "file_name_parts", "icon", "headline_html", "decorate_emojis", "not_null", "additional_filename", "thumbnail_blob_uid", "may_have_thumbnail", "is_video", "media_info_resource", "HeadlineTag", "title_tag", "DefaultFileCardAnchor", "cancel_event", "CondensedThumbnail", "CondensedThumbnailNoImage", "simple_tooltip_event_handlers", "i18n", "__name", "blob_uid", "children", "className", "classNameFallback", "onClickFallback", "url", "set_url", "y", "download_url", "on_close", "iframe_url", "set_iframe_url", "fade_out", "set_fade_out", "close", "call_function", "GetDownloadBlobURLRequest", "GetDownloadBlobURLResponse", "res", "error", "Snackbar", "report_error", "trap_browser_back", "Rn", "classNames", "IconButton", "LoadingIndicator", "init_compat_module", "CardSynopsisOneLiner", "observer", "card", "className", "Rn", "CardSynopsis", "classNames", "Note", "Link", "linked_board_uid", "extract_linked_board_and_card_uid", "board_info", "board_info_resource", "board_name", "File", "Inbox", "Column", "Root", "assert_never", "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", "Rn", "CardSynopsisOneLiner", "OpenCard", "i", "CardInfo", "Button", "i18n", "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", "i", "checklist_item_li_prefix", "checked_li_suffix", "unchecked_li_suffix", "a", "s", "checked", "raf", "TIME", "frame", "cancel", "frames", "lastFrameTime", "__name", "cb", "id", "onFrame", "time", "timer", "defaults", "convert", "val", "transform", "isOk", "prop", "options", "name", "onlyPositiveInt", "number", "randomInt", "min", "max", "toDecimal", "str", "colorsToRgb", "colors", "hexToRgb", "getOrigin", "origin", "setCanvasWindowSize", "canvas", "setCanvasRectSize", "rect", "getCanvas", "zIndex", "ellipse", "context", "x", "y", "radiusX", "radiusY", "rotation", "startAngle", "endAngle", "antiClockwise", "randomPhysics", "opts", "radAngle", "radSpread", "updateFetti", "fetti", "progress", "x1", "y1", "x2", "y2", "animate", "fettis", "resizer", "size", "done", "animatingFettis", "animationFrame", "destroy", "prom", "resolve", "onDone", "update", "confettiCannon", "globalOpts", "isLibCanvas", "allowResize", "globalDisableForReducedMotion", "initialized", "preferLessMotion", "animationObj", "fireLocal", "particleCount", "angle", "spread", "startVelocity", "decay", "gravity", "drift", "ticks", "shapes", "scalar", "temp", "startX", "startY", "fire", "disableForReducedMotion", "onResize", "confetti", "x", "y", "canvas_confetti", "nop", "__name", "memoize", "confettiCannon", "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", "CardChrome", "NoteCard", "LinkCard", "FileCard", "classNames", "error", "fallback_error_code", "s", "error_to_string", "a", "sha256", "e", "report_error", "is_elm_inside_an_active_rich_text_editor", "elm", "editor", "__name"] }