UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

587 lines (586 loc) • 27.7 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { c } from "react/compiler-runtime"; import { Container, Box, Text, Card, Stack, Flex, Menu, Layer, useToast, useLayer, useClickOutsideEvent } from "@sanity/ui"; import * as PathUtils from "@sanity/util/paths"; import { useContext, forwardRef, useState, useRef, useEffect, Fragment } from "react"; import { styled } from "styled-components"; import "react-i18next"; import { CommentsOnboardingContext } from "sanity/_singletons"; import "react-fast-compare"; import { UpsellPanel, useTranslation, commentsLocaleNamespace, useCommentsEnabled, useCurrentUser, useComments, useAddonDataset, useCommentsScroll, useCommentsSelectedPath, useCommentsTelemetry, CommentDeleteDialog, CommentsList, CommentsOnboardingPopover, isTextSelectionComment } from "./index2.js"; import "history"; import "@sanity/icons/ArrowLeft"; import "@sanity/icons/Launch"; import { Button, MenuItem, MenuButton } from "./index.js"; import "@sanity/logos"; import "@sanity/icons/ChevronRight"; import "react-rx"; import "@sanity/client"; import "rxjs"; import "rxjs/operators"; import "./version.js"; import { CheckmarkIcon } from "@sanity/icons/Checkmark"; import "react-is"; import "@sanity/client/csm"; import "quick-lru"; import "lodash-es/throttle.js"; import "lodash-es/isEqual.js"; import "@sanity/icons/Document"; import "@sanity/icons/Image"; import "@sanity/uuid"; import "@sanity/color"; import "color2k"; import "lodash-es/isString.js"; import "@sanity/icons/Copy"; import "@sanity/icons/Clipboard"; import "./createAgentBundlesStore.js"; import "@sanity/telemetry/react"; import "@portabletext/editor"; import "@sanity/types"; import "@sanity/icons/Revert"; import "@sanity/ui/theme"; import "date-fns/differenceInDays"; import "date-fns/differenceInHours"; import "date-fns/differenceInMinutes"; import "date-fns/differenceInMonths"; import "date-fns/differenceInSeconds"; import "date-fns/differenceInWeeks"; import "date-fns/differenceInYears"; import "@sanity/icons/AddCircle"; import "@sanity/icons/Calendar"; import "@sanity/icons/Circle"; import { CloseIcon } from "@sanity/icons/Close"; import "@sanity/icons/Edit"; import "@sanity/icons/Publish"; import "@sanity/icons/Timeline"; import "@sanity/icons/Trash"; import "@sanity/icons/Unpublish"; import "@sanity/icons/ArrowDown"; import "@sanity/icons/ArrowRight"; import "@sanity/util/legacyDateFormat"; import "@sanity/diff-patch"; import "@sanity/icons/ErrorOutline"; import "@sanity/diff"; import "mendoza"; import "@sanity/icons/InfoOutline"; import "@sanity/icons/WarningOutline"; import "@portabletext/sanity-bridge"; import "@sanity/id-utils"; import "sanity/router"; import { ChevronDownIcon } from "@sanity/icons/ChevronDown"; import "date-fns/addHours"; import "date-fns/startOfHour"; import "@sanity/icons/Bolt"; import "@sanity/icons/Clock"; import "@sanity/icons/Dot"; import "@sanity/icons/EarthGlobe"; import "date-fns/format"; import "date-fns/isValid"; import "date-fns/parse"; import "lodash-es/flatten.js"; import "date-fns/getMinutes"; import "date-fns/parseISO"; import "date-fns/setMinutes"; import "@sanity/icons/EarthAmericas"; import "lodash-es/noop.js"; import "@sanity/icons/Search"; import "motion/react"; import "lodash-es/pick.js"; import "lodash-es/get.js"; import "@algorithm.ts/lcs"; import "lodash-es/intersection.js"; import "json-stable-stringify"; import "shallow-equals"; import "scroll-into-view-if-needed"; import "@sanity/schema/_internal"; import "lodash-es/groupBy.js"; import "lodash-es/sortBy.js"; import "lodash-es/compact.js"; import "lodash-es/keyBy.js"; import "lodash-es/partition.js"; import "lodash-es/toLower.js"; import "lodash-es/union.js"; import "lodash-es/uniq.js"; import "lodash-es/words.js"; import "lodash-es/isFinite.js"; import "@sanity/icons/Add"; import "observable-callback"; import "@sanity/util/content"; import "@sanity/icons/BulbOutline"; import "@sanity/icons/Unknown"; import "@sanity/icons/ToggleArrowRight"; import "lodash-es/isPlainObject.js"; import "@sanity/insert-menu"; import "@dnd-kit/sortable"; import "@sanity/icons/DragHandle"; import "@sanity/icons/AddDocument"; import "@sanity/icons/InsertAbove"; import "@sanity/icons/InsertBelow"; import "@tanstack/react-virtual"; import "lodash-es/startCase.js"; import "speakingurl"; import "@sanity/icons/Reset"; import "@sanity/icons/Sync"; import "@sanity/asset-utils"; import "@sanity/icons/AccessDenied"; import "@sanity/icons/HelpCircle"; import "@sanity/image-url"; import "@portabletext/react"; import "@sanity/icons"; import "@sanity/icons/Link"; import "lodash-es/pickBy.js"; import "swr"; import "@sanity/icons/Download"; import "@sanity/icons/Upload"; import "@sanity/icons/BinaryDocument"; import "@sanity/icons/Lock"; import "lodash-es/castArray.js"; import "nanoid"; import "use-hot-module-reload"; import "@sanity/icons/EllipsisHorizontal"; import "@sanity/icons/EyeOpen"; import "rxjs-mergemap-array"; import "@sanity/mutator"; import "react-focus-lock"; import "lodash-es/memoize.js"; import "lodash-es/sortedIndex.js"; import "lodash-es/difference.js"; import "lodash-es/identity.js"; import "lodash-es/values.js"; import "@sanity/comlink"; import "lodash-es/omit.js"; import "@isaacs/ttlcache"; import "@sanity/schema"; import "@sanity/util/client"; import "@sanity/util/concurrency-limiter"; import "lodash-es/uniqBy.js"; import "json-reduce"; import "rxjs-exhaustmap-with-trailing"; import "dataloader"; import "raf"; import "groq-js"; import "use-sync-external-store/with-selector"; import "is-network-error"; import "lodash-es/escapeRegExp.js"; import "@sanity/icons/Desktop"; import "@sanity/icons/Moon"; import "@sanity/icons/Sun"; import "lodash-es/isEmpty.js"; import "react-dom/server"; import "@sanity/icons/Controls"; import "@sanity/icons/Sort"; import "lodash-es/capitalize.js"; import "@sanity/icons/Undo"; import "@sanity/icons/Documents"; import "@sanity/icons/Menu"; import "@sanity/icons/AddUser"; import "@sanity/icons/Cog"; import "@sanity/icons/Users"; import "semver"; import "@sanity/icons/FaceHappy"; import "@sanity/icons/FaceIndifferent"; import "@sanity/icons/FaceSad"; import "@sentry/react"; import "@sanity/icons/Feedback"; import "@sanity/icons/Github"; import "@sanity/icons/Refresh"; import "@sanity/icons/Leave"; import "lodash-es/last.js"; import "react-dom/client"; import "@portabletext/toolkit"; import "date-fns/addWeeks"; import "date-fns/isAfter"; import "date-fns/isBefore"; import "lodash-es/debounce.js"; import "clsx"; import "@sanity/icons/LinkRemoved"; import "lodash-es/findIndex.js"; import "@sanity/diff-match-patch"; import { useCommentsUpsell } from "./useCommentsUpsell.js"; import "@sanity/icons/ChevronUp"; import "@xstate/react"; import "xstate"; import "date-fns/startOfMinute"; import "@sanity/icons/User"; import "@sanity/icons/CheckmarkCircle"; import "lodash-es/deburr.js"; import "@sanity/icons/ChevronLeft"; function CommentsUpsellPanel(props) { const $ = c(4), { data, onPrimaryClick, onSecondaryClick } = props; let t0; return $[0] !== data || $[1] !== onPrimaryClick || $[2] !== onSecondaryClick ? (t0 = /* @__PURE__ */ jsx(Container, { width: 1, children: /* @__PURE__ */ jsx(Box, { marginBottom: 6, children: /* @__PURE__ */ jsx(UpsellPanel, { data, onPrimaryClick, onSecondaryClick }) }) }), $[0] = data, $[1] = onPrimaryClick, $[2] = onSecondaryClick, $[3] = t0) : t0 = $[3], t0; } function useCommentsOnboarding() { const ctx = useContext(CommentsOnboardingContext); if (!ctx) throw new Error("useCommentsOnboarding: missing context value"); return ctx; } function CommentsInspectorError(t0) { const $ = c(9), { error } = t0, { t } = useTranslation(commentsLocaleNamespace); let t1; $[0] !== t ? (t1 = t("inspector-error.title"), $[0] = t, $[1] = t1) : t1 = $[1]; let t2; $[2] !== t1 ? (t2 = /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: t1 }), $[2] = t1, $[3] = t2) : t2 = $[3]; let t3; $[4] !== error.message ? (t3 = /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: error.message }), $[4] = error.message, $[5] = t3) : t3 = $[5]; let t4; return $[6] !== t2 || $[7] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Card, { paddingX: 2, paddingY: 3, tone: "critical", border: !0, radius: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [ t2, t3 ] }) }) }), $[6] = t2, $[7] = t3, $[8] = t4) : t4 = $[8], t4; } const Root = /* @__PURE__ */ styled(Card).withConfig({ displayName: "Root", componentId: "sc-1vekini-0" })({ position: "relative", zIndex: "1", lineHeight: "0" }), CommentsInspectorHeader = forwardRef(function(props, ref) { const $ = c(57), { t } = useTranslation(commentsLocaleNamespace), { onClose, onViewChange, view, mode } = props; let t0; $[0] !== onViewChange ? (t0 = () => onViewChange("open"), $[0] = onViewChange, $[1] = t0) : t0 = $[1]; const handleSetOpenView = t0; let t1; $[2] !== onViewChange ? (t1 = () => onViewChange("resolved"), $[2] = onViewChange, $[3] = t1) : t1 = $[3]; const handleSetResolvedView = t1; let t2; $[4] !== t ? (t2 = t("feature-name"), $[4] = t, $[5] = t2) : t2 = $[5]; let t3; $[6] !== t2 ? (t3 = /* @__PURE__ */ jsx(Flex, { align: "center", flex: 1, gap: 2, paddingY: 2, padding: 3, children: /* @__PURE__ */ jsx(Text, { as: "h1", size: 1, weight: "medium", children: t2 }) }), $[6] = t2, $[7] = t3) : t3 = $[7]; let t4; $[8] !== t || $[9] !== view ? (t4 = t(view === "open" ? "status-filter.status-open" : "status-filter.status-resolved"), $[8] = t, $[9] = view, $[10] = t4) : t4 = $[10]; let t5; $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(Button, { text: t4, mode: "bleed", iconRight: ChevronDownIcon }), $[11] = t4, $[12] = t5) : t5 = $[12]; let t6; $[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = { width: "180px" }, $[13] = t6) : t6 = $[13]; const t7 = view === "open" ? CheckmarkIcon : void 0; let t8; $[14] !== t ? (t8 = t("status-filter.status-open-full"), $[14] = t, $[15] = t8) : t8 = $[15]; let t9; $[16] !== handleSetOpenView || $[17] !== t7 || $[18] !== t8 ? (t9 = /* @__PURE__ */ jsx(MenuItem, { iconRight: t7, onClick: handleSetOpenView, text: t8 }), $[16] = handleSetOpenView, $[17] = t7, $[18] = t8, $[19] = t9) : t9 = $[19]; const t10 = view === "resolved" ? CheckmarkIcon : void 0; let t11; $[20] !== t ? (t11 = t("status-filter.status-resolved-full"), $[20] = t, $[21] = t11) : t11 = $[21]; let t12; $[22] !== mode || $[23] !== t ? (t12 = mode === "upsell" ? { content: t("status-filter.status-resolved-full-upsell") } : void 0, $[22] = mode, $[23] = t, $[24] = t12) : t12 = $[24]; const t13 = mode === "upsell"; let t14; $[25] !== handleSetResolvedView || $[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t13 ? (t14 = /* @__PURE__ */ jsx(MenuItem, { iconRight: t10, onClick: handleSetResolvedView, text: t11, tooltipProps: t12, disabled: t13 }), $[25] = handleSetResolvedView, $[26] = t10, $[27] = t11, $[28] = t12, $[29] = t13, $[30] = t14) : t14 = $[30]; let t15; $[31] !== t14 || $[32] !== t9 ? (t15 = /* @__PURE__ */ jsxs(Menu, { style: t6, children: [ t9, t14 ] }), $[31] = t14, $[32] = t9, $[33] = t15) : t15 = $[33]; let t16; $[34] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t16 = { placement: "bottom-end" }, $[34] = t16) : t16 = $[34]; let t17; $[35] !== t15 || $[36] !== t5 ? (t17 = /* @__PURE__ */ jsx(MenuButton, { id: "comment-status-menu-button", button: t5, menu: t15, popover: t16 }), $[35] = t15, $[36] = t5, $[37] = t17) : t17 = $[37]; let t18; $[38] !== t ? (t18 = t("close-pane-button-text-aria-label"), $[38] = t, $[39] = t18) : t18 = $[39]; let t19; $[40] !== t ? (t19 = t("close-pane-button-text"), $[40] = t, $[41] = t19) : t19 = $[41]; let t20; $[42] !== t19 ? (t20 = { content: t19 }, $[42] = t19, $[43] = t20) : t20 = $[43]; let t21; $[44] !== onClose || $[45] !== t18 || $[46] !== t20 ? (t21 = /* @__PURE__ */ jsx(Button, { "aria-label": t18, icon: CloseIcon, mode: "bleed", onClick: onClose, tooltipProps: t20 }), $[44] = onClose, $[45] = t18, $[46] = t20, $[47] = t21) : t21 = $[47]; let t22; $[48] !== t17 || $[49] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Flex, { flex: "none", padding: 1, gap: 2, children: [ t17, t21 ] }), $[48] = t17, $[49] = t21, $[50] = t22) : t22 = $[50]; let t23; $[51] !== t22 || $[52] !== t3 ? (t23 = /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [ t3, t22 ] }), $[51] = t22, $[52] = t3, $[53] = t23) : t23 = $[53]; let t24; return $[54] !== ref || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsx(Root, { ref, children: t23 }), $[54] = ref, $[55] = t23, $[56] = t24) : t24 = $[56], t24; }), RootLayer = /* @__PURE__ */ styled(Layer).withConfig({ displayName: "RootLayer", componentId: "sc-clw1pq-0" })(["display:flex;flex-direction:column;height:100%;overflow:hidden;"]); function CommentsInspector(props) { const $ = c(3), { enabled, mode } = useCommentsEnabled(); if (!enabled) return null; let t0; return $[0] !== mode || $[1] !== props ? (t0 = /* @__PURE__ */ jsx(RootLayer, { children: /* @__PURE__ */ jsx(CommentsInspectorInner, { ...props, mode }) }), $[0] = mode, $[1] = props, $[2] = t0) : t0 = $[2], t0; } function CommentsInspectorInner(props) { const $ = c(122), { t } = useTranslation(commentsLocaleNamespace), { onClose, mode } = props, [showDeleteDialog, setShowDeleteDialog] = useState(!1), [commentToDelete, setCommentToDelete] = useState(null), [deleteLoading, setDeleteLoading] = useState(!1), [deleteError, setDeleteError] = useState(null), rootRef = useRef(null), [rootElement, setRootElement] = useState(null), currentUser = useCurrentUser(), { comments, getComment, isCreatingDataset, mentionOptions, setStatus, status, operation, selectedCommentId, getCommentLink, onClearSelectedComment, onPathOpen } = useComments(), commentIdParamRef = useRef(selectedCommentId), { error: addonDatasetError } = useAddonDataset(), didScrollToCommentFromParam = useRef(!1), pushToast = useToast().push, { isTopLayer } = useLayer(); let t0; $[0] !== rootElement ? (t0 = { boundaryElement: rootElement }, $[0] = rootElement, $[1] = t0) : t0 = $[1]; const { scrollToComment, scrollToField, scrollToInlineComment } = useCommentsScroll(t0), { selectedPath, setSelectedPath } = useCommentsSelectedPath(), { isDismissed, setDismissed } = useCommentsOnboarding(), telemetry = useCommentsTelemetry(), { upsellData, telemetryLogs: upsellTelemetryLogs } = useCommentsUpsell(), currentComments = comments.data[status], { loading } = comments; let t1; $[2] !== setSelectedPath || $[3] !== setStatus || $[4] !== telemetry ? (t1 = (nextView) => { setStatus(nextView), setSelectedPath(null), telemetry.commentListViewChanged(nextView); }, $[2] = setSelectedPath, $[3] = setStatus, $[4] = telemetry, $[5] = t1) : t1 = $[5]; const handleChangeView = t1; let t2; $[6] !== onClose || $[7] !== setSelectedPath ? (t2 = () => { onClose(), setSelectedPath(null); }, $[6] = onClose, $[7] = setSelectedPath, $[8] = t2) : t2 = $[8]; const handleCloseInspector = t2; let t3; bb0: { if (!getCommentLink) { t3 = void 0; break bb0; } let t42; $[9] !== getCommentLink || $[10] !== pushToast || $[11] !== t || $[12] !== telemetry ? (t42 = (id) => { navigator.clipboard.writeText(getCommentLink(id)).catch(() => { pushToast({ closable: !0, status: "error", title: t("copy-link-error-message") }); }), telemetry.commentLinkCopied(); }, $[9] = getCommentLink, $[10] = pushToast, $[11] = t, $[12] = telemetry, $[13] = t42) : t42 = $[13], t3 = t42; } const handleCopyLink = t3; let t4; $[14] !== getComment || $[15] !== operation ? (t4 = (id_0) => { const comment = getComment(id_0); comment && operation.create({ type: "field", fieldPath: comment.target.path?.field || "", id: comment._id, message: comment.message, parentCommentId: comment.parentCommentId, reactions: comment.reactions || [], status: comment.status, threadId: comment.threadId }); }, $[14] = getComment, $[15] = operation, $[16] = t4) : t4 = $[16]; const handleCreateRetry = t4; let t5; $[17] !== deleteLoading ? (t5 = () => { deleteLoading || (setShowDeleteDialog(!1), setCommentToDelete(null)); }, $[17] = deleteLoading, $[18] = t5) : t5 = $[18]; const closeDeleteDialog = t5; let t6; $[19] !== comments.data.open || $[20] !== onPathOpen || $[21] !== scrollToField || $[22] !== scrollToInlineComment || $[23] !== setSelectedPath ? (t6 = (nextPath) => { if (setSelectedPath(nextPath), nextPath?.fieldPath) { const path = PathUtils.fromString(nextPath.fieldPath); onPathOpen?.(path), scrollToField(nextPath.fieldPath), comments.data.open.filter((c2) => c2.threadId === nextPath?.threadId).some(_temp) && nextPath.threadId && scrollToInlineComment(nextPath.threadId); } }, $[19] = comments.data.open, $[20] = onPathOpen, $[21] = scrollToField, $[22] = scrollToInlineComment, $[23] = setSelectedPath, $[24] = t6) : t6 = $[24]; const handlePathSelect = t6; let t7; $[25] !== operation || $[26] !== setSelectedPath ? (t7 = (nextComment) => { const fieldPath = nextComment?.payload?.fieldPath || ""; operation.create({ type: "field", fieldPath, message: nextComment.message, parentCommentId: nextComment.parentCommentId, reactions: nextComment.reactions, status: nextComment.status, threadId: nextComment.threadId }), setSelectedPath({ fieldPath, origin: "inspector", threadId: nextComment.threadId }); }, $[25] = operation, $[26] = setSelectedPath, $[27] = t7) : t7 = $[27]; const handleNewThreadCreate = t7; let t8; $[28] !== operation ? (t8 = (nextComment_0) => { operation.create({ ...nextComment_0, type: "field", fieldPath: nextComment_0?.payload?.fieldPath || "" }); }, $[28] = operation, $[29] = t8) : t8 = $[29]; const handleReply = t8; let t9; $[30] !== operation ? (t9 = (id_1, nextComment_1) => { operation.update(id_1, nextComment_1); }, $[30] = operation, $[31] = t9) : t9 = $[31]; const handleEdit = t9; let t10; $[32] !== currentComments ? (t10 = (id_2) => { const parent = currentComments.find((c_0) => c_0.parentComment?._id === id_2), isParent = !!(parent && parent?.replies?.length > 0); setShowDeleteDialog(!0), setCommentToDelete({ commentId: id_2, isParent }); }, $[32] = currentComments, $[33] = t10) : t10 = $[33]; const onDeleteStart = t10; let t11; $[34] !== closeDeleteDialog || $[35] !== operation ? (t11 = async (id_3) => { try { setDeleteLoading(!0), await operation.remove(id_3), closeDeleteDialog(); } catch (t122) { setDeleteError(t122); } setDeleteLoading(!1); }, $[34] = closeDeleteDialog, $[35] = operation, $[36] = t11) : t11 = $[36]; const handleDeleteConfirm = t11; let t12; $[37] !== getComment || $[38] !== operation || $[39] !== scrollToComment || $[40] !== setSelectedPath || $[41] !== setStatus ? (t12 = (id_4, nextStatus) => { if (operation.update(id_4, { status: nextStatus }), nextStatus === "open") { setStatus("open"); const comment_0 = getComment(id_4); if (!comment_0) return; setSelectedPath({ fieldPath: comment_0.target.path?.field || null, origin: "inspector", threadId: comment_0.threadId || null }), scrollToComment(id_4); } }, $[37] = getComment, $[38] = operation, $[39] = scrollToComment, $[40] = setSelectedPath, $[41] = setStatus, $[42] = t12) : t12 = $[42]; const handleStatusChange = t12; let t13; $[43] !== operation ? (t13 = (id_5, reaction) => { operation.react(id_5, reaction); }, $[43] = operation, $[44] = t13) : t13 = $[44]; const handleReactionSelect = t13; let t14; $[45] !== isTopLayer || $[46] !== selectedPath || $[47] !== setSelectedPath ? (t14 = () => { selectedPath && isTopLayer && setSelectedPath(null); }, $[45] = isTopLayer, $[46] = selectedPath, $[47] = setSelectedPath, $[48] = t14) : t14 = $[48]; const handleDeselectPath = t14; let t15; $[49] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t15 = (element) => { rootRef.current = element, setRootElement(element); }, $[49] = t15) : t15 = $[49]; const setRootRef = t15; let t16; $[50] !== handleDeselectPath ? (t16 = (event) => { event.target instanceof HTMLElement && event.target?.hasAttribute("data-pt-text") || handleDeselectPath(); }, $[50] = handleDeselectPath, $[51] = t16) : t16 = $[51]; let t17; $[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t17 = () => [rootRef.current], $[52] = t17) : t17 = $[52], useClickOutsideEvent(t16, t17); const [loggedTelemetry, setLoggedTelemetry] = useState(!1); let t18; $[53] !== loggedTelemetry || $[54] !== mode || $[55] !== selectedPath?.origin || $[56] !== upsellTelemetryLogs ? (t18 = () => { if (!(loggedTelemetry || mode !== "upsell")) return setLoggedTelemetry(!0), selectedPath?.origin === "form" ? upsellTelemetryLogs.panelViewed("field_action") : commentIdParamRef.current ? upsellTelemetryLogs.panelViewed("link") : upsellTelemetryLogs.panelViewed("document_action"), () => { upsellTelemetryLogs.panelDismissed(); }; }, $[53] = loggedTelemetry, $[54] = mode, $[55] = selectedPath?.origin, $[56] = upsellTelemetryLogs, $[57] = t18) : t18 = $[57]; const t19 = selectedPath?.origin; let t20; $[58] !== loggedTelemetry || $[59] !== mode || $[60] !== t19 || $[61] !== upsellTelemetryLogs ? (t20 = [loggedTelemetry, mode, t19, upsellTelemetryLogs], $[58] = loggedTelemetry, $[59] = mode, $[60] = t19, $[61] = upsellTelemetryLogs, $[62] = t20) : t20 = $[62], useEffect(t18, t20); let t21, t22; $[63] !== getComment || $[64] !== handlePathSelect || $[65] !== loading || $[66] !== onClearSelectedComment || $[67] !== scrollToComment || $[68] !== setStatus || $[69] !== telemetry ? (t21 = () => { const commentToScrollTo = getComment(commentIdParamRef.current || ""); !loading && commentToScrollTo && !didScrollToCommentFromParam.current && (setStatus(commentToScrollTo.status || "open"), handlePathSelect({ fieldPath: commentToScrollTo.target.path?.field || null, origin: "url", threadId: commentToScrollTo.threadId || null }), requestAnimationFrame(() => { scrollToComment(commentToScrollTo._id); }), didScrollToCommentFromParam.current = !0, commentIdParamRef.current = void 0, onClearSelectedComment?.(), telemetry.commentViewedFromLink()); }, t22 = [getComment, handlePathSelect, loading, onClearSelectedComment, scrollToComment, setStatus, telemetry], $[63] = getComment, $[64] = handlePathSelect, $[65] = loading, $[66] = onClearSelectedComment, $[67] = scrollToComment, $[68] = setStatus, $[69] = telemetry, $[70] = t21, $[71] = t22) : (t21 = $[70], t22 = $[71]), useEffect(t21, t22); let t23; bb1: { if (mode === "upsell" && upsellData) { let t242; $[72] !== upsellData || $[73] !== upsellTelemetryLogs.panelPrimaryClicked || $[74] !== upsellTelemetryLogs.panelSecondaryClicked ? (t242 = /* @__PURE__ */ jsx(CommentsUpsellPanel, { data: upsellData, onPrimaryClick: upsellTelemetryLogs.panelPrimaryClicked, onSecondaryClick: upsellTelemetryLogs.panelSecondaryClicked }), $[72] = upsellData, $[73] = upsellTelemetryLogs.panelPrimaryClicked, $[74] = upsellTelemetryLogs.panelSecondaryClicked, $[75] = t242) : t242 = $[75], t23 = t242; break bb1; } t23 = null; } const beforeListNode = t23; let t24; $[76] !== closeDeleteDialog || $[77] !== commentToDelete || $[78] !== deleteError || $[79] !== deleteLoading || $[80] !== handleDeleteConfirm || $[81] !== showDeleteDialog ? (t24 = commentToDelete && showDeleteDialog && /* @__PURE__ */ jsx(CommentDeleteDialog, { ...commentToDelete, error: deleteError, loading: deleteLoading, onClose: closeDeleteDialog, onConfirm: handleDeleteConfirm }), $[76] = closeDeleteDialog, $[77] = commentToDelete, $[78] = deleteError, $[79] = deleteLoading, $[80] = handleDeleteConfirm, $[81] = showDeleteDialog, $[82] = t24) : t24 = $[82]; const t25 = !isDismissed; let t26; $[83] !== handleChangeView || $[84] !== handleCloseInspector || $[85] !== mode || $[86] !== status ? (t26 = /* @__PURE__ */ jsx(CommentsInspectorHeader, { onClose: handleCloseInspector, onViewChange: handleChangeView, view: status, mode }), $[83] = handleChangeView, $[84] = handleCloseInspector, $[85] = mode, $[86] = status, $[87] = t26) : t26 = $[87]; let t27; $[88] !== setDismissed || $[89] !== t25 || $[90] !== t26 ? (t27 = /* @__PURE__ */ jsx(CommentsOnboardingPopover, { onDismiss: setDismissed, open: t25, placement: "left-start", children: t26 }), $[88] = setDismissed, $[89] = t25, $[90] = t26, $[91] = t27) : t27 = $[91]; let t28; $[92] !== addonDatasetError ? (t28 = addonDatasetError && /* @__PURE__ */ jsx(CommentsInspectorError, { error: addonDatasetError }), $[92] = addonDatasetError, $[93] = t28) : t28 = $[93]; let t29; $[94] !== beforeListNode || $[95] !== comments.error || $[96] !== currentComments || $[97] !== currentUser || $[98] !== handleCopyLink || $[99] !== handleCreateRetry || $[100] !== handleEdit || $[101] !== handleNewThreadCreate || $[102] !== handlePathSelect || $[103] !== handleReactionSelect || $[104] !== handleReply || $[105] !== handleStatusChange || $[106] !== isCreatingDataset || $[107] !== loading || $[108] !== mentionOptions || $[109] !== mode || $[110] !== onDeleteStart || $[111] !== selectedPath || $[112] !== status ? (t29 = currentUser && /* @__PURE__ */ jsx(CommentsList, { beforeListNode, comments: currentComments, currentUser, error: comments.error, loading, mentionOptions, mode, onCopyLink: handleCopyLink, onCreateRetry: handleCreateRetry, onDelete: onDeleteStart, onEdit: handleEdit, onNewThreadCreate: handleNewThreadCreate, onPathSelect: handlePathSelect, onReactionSelect: handleReactionSelect, onReply: handleReply, onStatusChange: handleStatusChange, readOnly: isCreatingDataset, selectedPath, status }), $[94] = beforeListNode, $[95] = comments.error, $[96] = currentComments, $[97] = currentUser, $[98] = handleCopyLink, $[99] = handleCreateRetry, $[100] = handleEdit, $[101] = handleNewThreadCreate, $[102] = handlePathSelect, $[103] = handleReactionSelect, $[104] = handleReply, $[105] = handleStatusChange, $[106] = isCreatingDataset, $[107] = loading, $[108] = mentionOptions, $[109] = mode, $[110] = onDeleteStart, $[111] = selectedPath, $[112] = status, $[113] = t29) : t29 = $[113]; let t30; $[114] !== handleDeselectPath || $[115] !== t27 || $[116] !== t28 || $[117] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, height: "fill", onClick: handleDeselectPath, overflow: "hidden", ref: setRootRef, children: [ t27, t28, t29 ] }), $[114] = handleDeselectPath, $[115] = t27, $[116] = t28, $[117] = t29, $[118] = t30) : t30 = $[118]; let t31; return $[119] !== t24 || $[120] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [ t24, t30 ] }), $[119] = t24, $[120] = t30, $[121] = t31) : t31 = $[121], t31; } function _temp(x) { return isTextSelectionComment(x.parentComment); } export { CommentsInspector }; //# sourceMappingURL=CommentsInspector.js.map