@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +35 -52
  2. package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
  3. package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
  4. package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
  5. package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
  6. package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
  7. package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
  8. package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
  9. package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
  10. package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
  11. package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
  12. package/dist/actions.cjs +1 -1
  13. package/dist/actions.js +2 -2
  14. package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
  15. package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
  16. package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
  17. package/dist/add-new-page-DanzzvYo.js +31 -0
  18. package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
  19. package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
  20. package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
  21. package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
  22. package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
  23. package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
  24. package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
  25. package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
  26. package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
  27. package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
  28. package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
  29. package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
  30. package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
  31. package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
  32. package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
  33. package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
  34. package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
  35. package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.d.ts +0 -5
  38. package/dist/core.js +49 -49
  39. package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
  40. package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
  41. package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
  42. package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
  43. package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
  44. package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
  45. package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
  46. package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
  47. package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
  48. package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
  49. package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
  50. package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
  51. package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
  52. package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
  53. package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
  54. package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
  55. package/dist/index-BYrRPW_c.cjs +5 -0
  56. package/dist/index-D-r_K4yA.cjs +160 -0
  57. package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
  58. package/dist/index-DqzFD1CG.js +4861 -0
  59. package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
  60. package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
  61. package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
  62. package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
  63. package/dist/no-language-page-content-BRITuyfN.js +43 -0
  64. package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
  65. package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
  66. package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
  67. package/dist/page-creator-BAIbU14q.js +652 -0
  68. package/dist/page-creator-qL3-M8g3.cjs +1 -0
  69. package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
  70. package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
  71. package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
  72. package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
  73. package/dist/pages.cjs +1 -1
  74. package/dist/pages.d.ts +0 -15
  75. package/dist/pages.js +20 -21
  76. package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
  77. package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
  78. package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
  79. package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
  80. package/dist/render.cjs +1 -1
  81. package/dist/render.js +54 -54
  82. package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
  83. package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
  84. package/dist/runtime-client.cjs +1 -1
  85. package/dist/runtime-client.js +1 -1
  86. package/dist/runtime.cjs +1 -1
  87. package/dist/runtime.js +1 -1
  88. package/dist/sdk.css +1 -1
  89. package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
  90. package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
  91. package/dist/seo-panel---mYZmLD.js +559 -0
  92. package/dist/seo-panel-mfX63fua.cjs +1 -0
  93. package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
  94. package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
  95. package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
  96. package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
  97. package/dist/supabase-actions.cjs +1 -1
  98. package/dist/supabase-actions.js +2 -2
  99. package/dist/types.d.ts +0 -96
  100. package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
  101. package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
  102. package/dist/unpublish-page-3--vO5b0.js +28 -0
  103. package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
  104. package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
  105. package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
  106. package/dist/utils.cjs +1 -1
  107. package/dist/utils.js +2 -2
  108. package/dist/web-blocks.cjs +1 -1
  109. package/dist/web-blocks.js +2 -2
  110. package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
  111. package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
  112. package/package.json +1 -1
  113. package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
  114. package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
  115. package/dist/add-new-page-Ppy5-y5j.js +0 -31
  116. package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
  117. package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
  118. package/dist/design-token-usage-D1lWCJ3L.js +0 -114
  119. package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
  120. package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
  121. package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
  122. package/dist/image-compression-DPFITwOL.js +0 -37
  123. package/dist/image-compression-UaU7Bwqe.cjs +0 -1
  124. package/dist/index-BVwFJWDq.cjs +0 -5
  125. package/dist/index-DCJDQs1a.cjs +0 -160
  126. package/dist/index-LBTm1Jmk.js +0 -5199
  127. package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
  128. package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
  129. package/dist/lang-panel-B3USOxGq.js +0 -216
  130. package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
  131. package/dist/manage-design-tokens-6YGIctip.js +0 -446
  132. package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
  133. package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
  134. package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
  135. package/dist/no-language-page-content-D8t5dfgh.js +0 -43
  136. package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
  137. package/dist/page-creator-Cz_ah-qE.cjs +0 -1
  138. package/dist/page-creator-DKEkuGCO.js +0 -796
  139. package/dist/page-lock-CwZKJ4IE.js +0 -30
  140. package/dist/page-lock-DdCvtA-I.cjs +0 -1
  141. package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
  142. package/dist/page-locked-dialog-DqLlooUz.js +0 -136
  143. package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
  144. package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
  145. package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
  146. package/dist/page-revisions-content-C5O8_Fms.js +0 -459
  147. package/dist/plugin-DHpuZZXz.cjs +0 -22
  148. package/dist/save-to-lib-DMnv7ENo.js +0 -429
  149. package/dist/save-to-lib-Dc700Aop.cjs +0 -1
  150. package/dist/seo-panel-Br8gxDxu.js +0 -789
  151. package/dist/seo-panel-CMY-adM-.cjs +0 -2
  152. package/dist/take-over-request-IRLgF1dG.cjs +0 -1
  153. package/dist/take-over-request-KdR1_h_K.js +0 -64
  154. package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
  155. package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
  156. package/dist/unpublish-page-0fR1o0b7.js +0 -28
@@ -1,30 +0,0 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { u as E, a as c, b as T, P as e, A as l, B as I, E as _ } from "./index-LBTm1Jmk.js";
3
- import { useQueryClient as C } from "@tanstack/react-query";
4
- import { useRef as p, useEffect as N, Suspense as A, lazy as s } from "react";
5
- const m = s(() => import("./take-over-request-KdR1_h_K.js")), f = s(() => import("./page-locked-dialog-DqLlooUz.js")), O = s(() => import("./active-in-another-tab-B4Ur0JP7.js")), S = s(() => import("./continue-editing-in-this-client-BrSvK-Ay.js")), r = (a) => /* @__PURE__ */ n(A, { children: /* @__PURE__ */ n(a, {}) }), L = ({ isFetchingPageData: a }) => {
6
- E();
7
- const { pageStatus: t } = c(), { pageLockMeta: o } = T(), u = C(), i = p(t);
8
- if (N(() => {
9
- t === e.EDITING && i.current !== e.TAKE_OVER_REQUESTED && u.invalidateQueries({ queryKey: [l.GET_DRAFT_PAGE] }), i.current = t;
10
- }, [t, u]), a) return null;
11
- switch (t) {
12
- case e.EDITING:
13
- case e.CHECKING:
14
- case e.FORCE_TAKE_OVER:
15
- return o.type === _.CONTINUE_EDITING_IN_THIS_CLIENT ? r(S) : null;
16
- case e.LOCKED:
17
- return r(f);
18
- case e.TAKE_OVER_REQUESTED:
19
- return r(m);
20
- case e.ACTIVE_IN_ANOTHER_TAB:
21
- return r(O);
22
- case e.CONNECTION_LOST:
23
- return /* @__PURE__ */ n(I, { children: null });
24
- default:
25
- return null;
26
- }
27
- };
28
- export {
29
- L as default
30
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),e=require("./index-BVwFJWDq.cjs"),E=require("@tanstack/react-query"),r=require("react"),c=r.lazy(()=>Promise.resolve().then(()=>require("./take-over-request-IRLgF1dG.cjs"))),o=r.lazy(()=>Promise.resolve().then(()=>require("./page-locked-dialog-CrTDBoC4.cjs"))),l=r.lazy(()=>Promise.resolve().then(()=>require("./active-in-another-tab-BPdx4lWh.cjs"))),S=r.lazy(()=>Promise.resolve().then(()=>require("./continue-editing-in-this-client-Cmi-GkYZ.cjs"))),s=n=>u.jsx(r.Suspense,{children:u.jsx(n,{})}),A=({isFetchingPageData:n})=>{e.useChaibuilderRealtime();const{pageStatus:t}=e.usePageLockStatus(),{pageLockMeta:a}=e.usePageLockMeta(),T=E.useQueryClient(),i=r.useRef(t);if(r.useEffect(()=>{t===e.PAGE_STATUS.EDITING&&i.current!==e.PAGE_STATUS.TAKE_OVER_REQUESTED&&T.invalidateQueries({queryKey:[e.ACTIONS.GET_DRAFT_PAGE]}),i.current=t},[t,T]),n)return null;switch(t){case e.PAGE_STATUS.EDITING:case e.PAGE_STATUS.CHECKING:case e.PAGE_STATUS.FORCE_TAKE_OVER:return a.type===e.EVENT.CONTINUE_EDITING_IN_THIS_CLIENT?s(S):null;case e.PAGE_STATUS.LOCKED:return s(o);case e.PAGE_STATUS.TAKE_OVER_REQUESTED:return s(c);case e.PAGE_STATUS.ACTIVE_IN_ANOTHER_TAB:return s(l);case e.PAGE_STATUS.CONNECTION_LOST:return u.jsx(e.BlurContainer,{children:null});default:return null}};exports.default=A;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./index-DCJDQs1a.cjs"),p=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-BVwFJWDq.cjs"),c=require("lucide-react"),d=require("react"),O=require("react-i18next"),_=()=>{const m=t.useCurrentPageOwner(),f=t.useSendRealtimeEvent(),{setPageStatus:j}=t.usePageLockStatus(),{data:s,isFetching:v}=t.useChaiUserInfo((m==null?void 0:m.userId)||""),{pageLockMeta:o,setPageLockMeta:g}=t.usePageLockMeta(),{t:r}=O.useTranslation(),[u,i]=d.useState(""),[a,N]=d.useState({}),[T,k]=d.useState(!1),l=d.useRef(null);d.useEffect(()=>{o!=null&&o.type&&(l.current&&clearTimeout(l.current),d.startTransition(()=>{N(o),g({}),i("")}))},[o,g]);const b=()=>{u!==t.EVENT.TAKE_OVER_REQUEST&&(i(t.EVENT.TAKE_OVER_REQUEST),f(t.EVENT.TAKE_OVER_REQUEST),l.current=setTimeout(()=>i(""),2e4))},R=()=>{u!==t.EVENT.FORCE_TAKE_OVER_REQUEST&&(i(t.EVENT.FORCE_TAKE_OVER_REQUEST),f(t.EVENT.FORCE_TAKE_OVER_REQUEST),j(t.PAGE_STATUS.CHECKING),l.current=setTimeout(()=>i(""),2e4))},y=()=>{N({}),l.current&&clearTimeout(l.current),i("")},x=v?"Loading...":(s==null?void 0:s.name)||"Current editor",h=u===t.EVENT.TAKE_OVER_REQUEST,E=u===t.EVENT.FORCE_TAKE_OVER_REQUEST;return e.jsx(t.BlurContainer,{children:e.jsxs(n.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(n.CardHeader,{className:"space-y-1 border-b pb-3",children:e.jsxs(n.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(c.LockKeyhole,{className:"h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500"}),e.jsx("span",{children:r("Page Locked for Editing")})]})}),e.jsxs(n.CardContent,{className:"space-y-4 p-4",children:[e.jsxs("div",{className:"relative rounded-md border border-green-500 px-2 pb-2 pt-4",children:[e.jsx("div",{className:"absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white",children:"Current Editor"}),e.jsxs("div",{className:"flex items-center space-x-4 p-1",children:[s!=null&&s.avatar?e.jsx("img",{src:s.avatar,alt:s.name,className:"h-12 w-12 flex-shrink-0 rounded-full bg-black text-white"}):e.jsx(c.UserIcon,{className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}),e.jsxs("div",{className:"flex-1 space-y-0",children:[e.jsx("div",{className:"truncate font-medium leading-tight text-black",children:x}),(s==null?void 0:s.email)&&e.jsx("p",{className:"truncate text-sm leading-tight text-muted-foreground",children:s.email})]})]})]}),((a==null?void 0:a.type)===t.EVENT.TAKE_OVER_REJECTED||(a==null?void 0:a.type)===t.EVENT.FORCE_TAKE_OVER_REQUEST)&&e.jsx("section",{className:"space-y-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-x-2 rounded border border-red-500 bg-red-500/10 py-2 pl-3 pr-2 text-sm font-medium text-red-500",children:[e.jsxs("div",{className:"flex items-start gap-x-2",children:[e.jsx(c.AlertCircleIcon,{className:"mt-px flex h-4 w-4 shrink-0"}),e.jsxs("div",{className:"font-light leading-tight",children:[e.jsx("span",{className:"font-medium",children:(s==null?void 0:s.name)||"The current editor"}),(a==null?void 0:a.type)===t.EVENT.TAKE_OVER_REJECTED?" rejected your take over request.":" forcefully took over this page."]})]}),e.jsx(p.Button,{size:"icon",variant:"ghost",onClick:y,className:"flex-shrink-0",children:e.jsx(c.X,{className:"h-4 w-4"})})]})})]}),e.jsx(n.CardFooter,{className:"flex flex-col gap-3 border-t pt-3",children:e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r("Take Over Options")}),e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-sm font-medium",children:r("Take Over Request:")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r("Send a request to {{currentEditorName}} asking them to release the page. They can accept or decline your request.",{currentEditorName:x})})]}),e.jsxs(p.Button,{disabled:h,variant:"default",onClick:b,className:"mt-3 w-full gap-2",children:[e.jsx(c.Edit,{className:"h-4 w-4"}),h?"Take over request sent":"Send Take Over Request"]}),h&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r("Request sent. If no response, try again or use force take over.")})]}),e.jsx(n.Accordion,{type:"single",collapsible:!0,className:"w-full",children:e.jsxs(n.AccordionItem,{value:"force-takeover",className:"rounded-md border border-destructive/40 bg-destructive/5",children:[e.jsx(n.AccordionTrigger,{className:"px-3 py-2 hover:no-underline",children:e.jsx("div",{className:"flex items-center gap-2 text-left",children:e.jsxs("div",{children:[e.jsxs("p",{className:"flex items-center gap-x-2 text-sm font-medium text-destructive",children:[e.jsx(c.ShieldAlert,{className:"h-4 w-4 text-destructive"}),r("Force Take Over")]}),e.jsx("p",{className:"pl-6 text-xs font-normal leading-tight text-muted-foreground",children:r("Immediately take control (use with caution)")})]})})}),e.jsx(n.AccordionContent,{className:"px-3 pb-3",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-background p-2",children:[e.jsx("input",{type:"checkbox",id:"force-takeover",checked:T,onChange:C=>k(C.target.checked),className:"mt-0.5 h-4 w-4 rounded border-gray-300"}),e.jsx("label",{htmlFor:"force-takeover",className:"flex-1 text-xs text-muted-foreground",children:r("I understand this will immediately close the editor for {{currentEditorName}}. I am using this option with caution.",{currentEditorName:x})})]}),e.jsxs(p.Button,{disabled:!T||E,variant:"destructive",onClick:R,className:"w-full gap-2",children:[e.jsx(c.ShieldAlert,{className:"h-4 w-4"}),r(E?"Take over page...":"Force Take Over")]}),E&&e.jsx("p",{className:"text-xs text-muted-foreground",children:r("Attempting to forcefully take over this page. Please wait while we update the editing session.")})]})})]})})]})})]})})};exports.default=_;
@@ -1,136 +0,0 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { J as _, K as w, M as A, O as S, Q as K, R as F, U, V, W as I } from "./index-OuHV9Ann.js";
3
- import { B as p } from "./register-chai-top-bar-D6GjnauV.js";
4
- import { ap as Q, an as q, a as P, ao as j, b as B, B as D, E as a, P as J } from "./index-LBTm1Jmk.js";
5
- import { LockKeyhole as L, UserIcon as G, AlertCircleIcon as H, X as z, Edit as W, ShieldAlert as v } from "lucide-react";
6
- import { useState as f, useRef as X, useEffect as Y, startTransition as Z } from "react";
7
- import { useTranslation as $ } from "react-i18next";
8
- const ie = () => {
9
- const d = Q(), x = q(), { setPageStatus: T } = P(), { data: r, isFetching: k } = j((d == null ? void 0 : d.userId) || ""), { pageLockMeta: l, setPageLockMeta: E } = B(), { t: s } = $(), [o, i] = f(""), [n, g] = f({}), [N, b] = f(!1), c = X(null);
10
- Y(() => {
11
- l != null && l.type && (c.current && clearTimeout(c.current), Z(() => {
12
- g(l), E({}), i("");
13
- }));
14
- }, [l, E]);
15
- const R = () => {
16
- o !== a.TAKE_OVER_REQUEST && (i(a.TAKE_OVER_REQUEST), x(a.TAKE_OVER_REQUEST), c.current = setTimeout(() => i(""), 2e4));
17
- }, C = () => {
18
- o !== a.FORCE_TAKE_OVER_REQUEST && (i(a.FORCE_TAKE_OVER_REQUEST), x(a.FORCE_TAKE_OVER_REQUEST), T(J.CHECKING), c.current = setTimeout(() => i(""), 2e4));
19
- }, O = () => {
20
- g({}), c.current && clearTimeout(c.current), i("");
21
- }, m = k ? "Loading..." : (r == null ? void 0 : r.name) || "Current editor", u = o === a.TAKE_OVER_REQUEST, h = o === a.FORCE_TAKE_OVER_REQUEST;
22
- return /* @__PURE__ */ e(D, { children: /* @__PURE__ */ t(_, { className: "mx-auto w-full max-w-md", children: [
23
- /* @__PURE__ */ e(w, { className: "space-y-1 border-b pb-3", children: /* @__PURE__ */ t(A, { className: "flex items-center gap-2 text-xl", children: [
24
- /* @__PURE__ */ e(L, { className: "h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500" }),
25
- /* @__PURE__ */ e("span", { children: s("Page Locked for Editing") })
26
- ] }) }),
27
- /* @__PURE__ */ t(S, { className: "space-y-4 p-4", children: [
28
- /* @__PURE__ */ t("div", { className: "relative rounded-md border border-green-500 px-2 pb-2 pt-4", children: [
29
- /* @__PURE__ */ e("div", { className: "absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white", children: "Current Editor" }),
30
- /* @__PURE__ */ t("div", { className: "flex items-center space-x-4 p-1", children: [
31
- r != null && r.avatar ? /* @__PURE__ */ e(
32
- "img",
33
- {
34
- src: r.avatar,
35
- alt: r.name,
36
- className: "h-12 w-12 flex-shrink-0 rounded-full bg-black text-white"
37
- }
38
- ) : /* @__PURE__ */ e(G, { className: "h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white" }),
39
- /* @__PURE__ */ t("div", { className: "flex-1 space-y-0", children: [
40
- /* @__PURE__ */ e("div", { className: "truncate font-medium leading-tight text-black", children: m }),
41
- (r == null ? void 0 : r.email) && /* @__PURE__ */ e("p", { className: "truncate text-sm leading-tight text-muted-foreground", children: r.email })
42
- ] })
43
- ] })
44
- ] }),
45
- ((n == null ? void 0 : n.type) === a.TAKE_OVER_REJECTED || (n == null ? void 0 : n.type) === a.FORCE_TAKE_OVER_REQUEST) && /* @__PURE__ */ e("section", { className: "space-y-2", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-x-2 rounded border border-red-500 bg-red-500/10 py-2 pl-3 pr-2 text-sm font-medium text-red-500", children: [
46
- /* @__PURE__ */ t("div", { className: "flex items-start gap-x-2", children: [
47
- /* @__PURE__ */ e(H, { className: "mt-px flex h-4 w-4 shrink-0" }),
48
- /* @__PURE__ */ t("div", { className: "font-light leading-tight", children: [
49
- /* @__PURE__ */ e("span", { className: "font-medium", children: (r == null ? void 0 : r.name) || "The current editor" }),
50
- (n == null ? void 0 : n.type) === a.TAKE_OVER_REJECTED ? " rejected your take over request." : " forcefully took over this page."
51
- ] })
52
- ] }),
53
- /* @__PURE__ */ e(p, { size: "icon", variant: "ghost", onClick: O, className: "flex-shrink-0", children: /* @__PURE__ */ e(z, { className: "h-4 w-4" }) })
54
- ] }) })
55
- ] }),
56
- /* @__PURE__ */ e(K, { className: "flex flex-col gap-3 border-t pt-3", children: /* @__PURE__ */ t("section", { className: "space-y-2", children: [
57
- /* @__PURE__ */ e("h3", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: s("Take Over Options") }),
58
- /* @__PURE__ */ t("div", { className: "rounded-md border bg-muted/40 p-3", children: [
59
- /* @__PURE__ */ t("div", { className: "mb-2", children: [
60
- /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s("Take Over Request:") }),
61
- /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-muted-foreground", children: s(
62
- "Send a request to {{currentEditorName}} asking them to release the page. They can accept or decline your request.",
63
- { currentEditorName: m }
64
- ) })
65
- ] }),
66
- /* @__PURE__ */ t(
67
- p,
68
- {
69
- disabled: u,
70
- variant: "default",
71
- onClick: R,
72
- className: "mt-3 w-full gap-2",
73
- children: [
74
- /* @__PURE__ */ e(W, { className: "h-4 w-4" }),
75
- u ? "Take over request sent" : "Send Take Over Request"
76
- ]
77
- }
78
- ),
79
- u && /* @__PURE__ */ e("p", { className: "mt-2 text-xs text-muted-foreground", children: s("Request sent. If no response, try again or use force take over.") })
80
- ] }),
81
- /* @__PURE__ */ e(F, { type: "single", collapsible: !0, className: "w-full", children: /* @__PURE__ */ t(
82
- U,
83
- {
84
- value: "force-takeover",
85
- className: "rounded-md border border-destructive/40 bg-destructive/5",
86
- children: [
87
- /* @__PURE__ */ e(V, { className: "px-3 py-2 hover:no-underline", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2 text-left", children: /* @__PURE__ */ t("div", { children: [
88
- /* @__PURE__ */ t("p", { className: "flex items-center gap-x-2 text-sm font-medium text-destructive", children: [
89
- /* @__PURE__ */ e(v, { className: "h-4 w-4 text-destructive" }),
90
- s("Force Take Over")
91
- ] }),
92
- /* @__PURE__ */ e("p", { className: "pl-6 text-xs font-normal leading-tight text-muted-foreground", children: s("Immediately take control (use with caution)") })
93
- ] }) }) }),
94
- /* @__PURE__ */ e(I, { className: "px-3 pb-3", children: /* @__PURE__ */ t("div", { className: "space-y-3", children: [
95
- /* @__PURE__ */ t("div", { className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-background p-2", children: [
96
- /* @__PURE__ */ e(
97
- "input",
98
- {
99
- type: "checkbox",
100
- id: "force-takeover",
101
- checked: N,
102
- onChange: (y) => b(y.target.checked),
103
- className: "mt-0.5 h-4 w-4 rounded border-gray-300"
104
- }
105
- ),
106
- /* @__PURE__ */ e("label", { htmlFor: "force-takeover", className: "flex-1 text-xs text-muted-foreground", children: s(
107
- "I understand this will immediately close the editor for {{currentEditorName}}. I am using this option with caution.",
108
- { currentEditorName: m }
109
- ) })
110
- ] }),
111
- /* @__PURE__ */ t(
112
- p,
113
- {
114
- disabled: !N || h,
115
- variant: "destructive",
116
- onClick: C,
117
- className: "w-full gap-2",
118
- children: [
119
- /* @__PURE__ */ e(v, { className: "h-4 w-4" }),
120
- s(h ? "Take over page..." : "Force Take Over")
121
- ]
122
- }
123
- ),
124
- h && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: s(
125
- "Attempting to forcefully take over this page. Please wait while we update the editing session."
126
- ) })
127
- ] }) })
128
- ]
129
- }
130
- ) })
131
- ] }) })
132
- ] }) });
133
- };
134
- export {
135
- ie as default
136
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-DCJDQs1a.cjs"),v=require("./index-BVwFJWDq.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),S=require("@tanstack/react-query"),s=require("lodash-es"),x=require("lucide-react"),b=require("react"),j=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:a})=>{const{t:o}=j.useTranslation(),[r,i]=b.useState(""),{data:c}=v.usePageTypes(),m=b.useMemo(()=>c.some(t=>!["page","global"].includes(s.get(t,"key",""))),[c]);if(b.useEffect(()=>{!m&&l!=="all"&&a("all")},[m,l,a]),!m)return null;const u=t=>{if(!r)return!0;const d=r.toLowerCase(),g=f=>String(s.get(t,f,"")).toLowerCase().includes(d);return g("name")||g("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:a,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||o("All")}),e.jsx(x.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:o("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>i(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:o("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:o("No matching page types found")})]})]})},T=({search:l,setSearch:a})=>{const{t:o}=j.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:o("Search Pages")}),e.jsx(x.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:o("Search pages"),value:l,onChange:r=>a(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off",autoFocus:!0})]})},E=({pages:l})=>{const{t:a}=j.useTranslation(),{expandAll:o,collapseAll:r,expandedPages:i}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>o(l),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:a("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:i.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:a("Collapse All")})]})]})},C=({languages:l,selectedLanguage:a,setSelectedLanguage:o})=>{const r=v.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(i=>e.jsxs(h.Button,{variant:a===i?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${a===i?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>o(i.toLowerCase()),children:[i===r&&e.jsx(x.Star,{size:4,className:`p-0.5 ${a===r?"fill-white":"fill-black"}`}),v.LANGUAGES[i]||""]},i))})},y=()=>{const{t:l}=j.useTranslation(),a=S.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>a.invalidateQueries({queryKey:[v.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(x.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:a,setSearch:o,languages:r,onAddPage:i,selectedLanguage:c,setSelectedLanguage:m,selectedPageType:u,setSelectedPageType:p,showUntranslatedPages:t,setShowUntranslatedPages:d})=>{const{t:g}=j.useTranslation(),f=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:u,setSelectedPageType:p}),e.jsx(T,{search:a,setSearch:o}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:i,className:"rounded px-3 font-normal",children:[e.jsx(x.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:g("Add Page")})]}),!f&&e.jsx(y,{})]}),f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(C,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{m(N),d(t&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>d(!t),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:t?e.jsx(x.FilterXIcon,{}):e.jsx(x.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:g("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=C;exports.default=q;
@@ -1,210 +0,0 @@
1
- import { jsx as e, jsxs as a, Fragment as k } from "react/jsx-runtime";
2
- import { B as m, z as E } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { z as b, A as y, E as N, S as L, F as I, G as P, H as w } from "./index-OuHV9Ann.js";
4
- import { i as j, L as G, k as $, A as M } from "./index-LBTm1Jmk.js";
5
- import { u as B } from "./use-page-expand-manager-Cf4MUEJw.js";
6
- import { useQueryClient as D } from "@tanstack/react-query";
7
- import { get as c, isEmpty as C, filter as f, map as S } from "lodash-es";
8
- import { Star as R, Plus as W, FilterXIcon as q, Filter as K, ListFilter as Q, Search as F, ChevronsUpDown as T, ChevronsDownUp as _, RefreshCw as H } from "lucide-react";
9
- import { useState as O, useMemo as U, useEffect as V } from "react";
10
- import { useTranslation as v } from "react-i18next";
11
- const X = ({ selectedPageType: n, setSelectedPageType: l }) => {
12
- const { t: s } = v(), [r, o] = O(""), { data: i } = $(), p = U(
13
- () => i.some((t) => !["page", "global"].includes(c(t, "key", ""))),
14
- [i]
15
- );
16
- if (V(() => {
17
- !p && n !== "all" && l("all");
18
- }, [p, n, l]), !p) return null;
19
- const h = (t) => {
20
- if (!r) return !0;
21
- const d = r.toLowerCase(), x = (g) => String(c(t, g, "")).toLowerCase().includes(d);
22
- return x("name") || x("key");
23
- }, u = i.find((t) => t.key === n);
24
- return /* @__PURE__ */ a(L, { onValueChange: l, value: n, children: [
25
- /* @__PURE__ */ e(
26
- I,
27
- {
28
- className: `${n === "all" ? "bg-gray-100/30 hover:bg-gray-100" : "gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,
29
- children: /* @__PURE__ */ a("div", { className: "flex w-full items-center justify-between gap-x-1.5", children: [
30
- /* @__PURE__ */ e("span", { className: "max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight", children: (u == null ? void 0 : u.name) || s("All") }),
31
- /* @__PURE__ */ e(
32
- Q,
33
- {
34
- className: `${n !== "all" ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`
35
- }
36
- )
37
- ] })
38
- }
39
- ),
40
- /* @__PURE__ */ a(P, { children: [
41
- /* @__PURE__ */ e("div", { className: "sticky top-0 z-10 bg-white pb-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
42
- /* @__PURE__ */ e(F, { strokeWidth: 2, className: "absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400" }),
43
- /* @__PURE__ */ e(
44
- E,
45
- {
46
- placeholder: s("Search page types..."),
47
- className: "h-8 w-full rounded border pl-8 text-xs shadow-none",
48
- value: r,
49
- onChange: (t) => o(t.target.value),
50
- onKeyDown: (t) => t.stopPropagation()
51
- }
52
- )
53
- ] }) }),
54
- /* @__PURE__ */ e(w, { value: "all", children: s("All") }),
55
- !C(f(i, (t) => t.hasSlug && h(t))) && /* @__PURE__ */ a(k, { children: [
56
- /* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: s("Pages") }),
57
- S(
58
- [...f(i, (t) => t.hasSlug && h(t))].sort(
59
- (t, d) => c(t, "name", "").localeCompare(c(d, "name", ""))
60
- ),
61
- (t) => /* @__PURE__ */ e(w, { value: c(t, "key"), children: c(t, "name") }, c(t, "key"))
62
- )
63
- ] }),
64
- !C(f(i, (t) => !t.hasSlug && h(t))) && /* @__PURE__ */ a(k, { children: [
65
- /* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: s("Partials") }),
66
- S(
67
- [...f(i, (t) => !t.hasSlug && h(t))].sort(
68
- (t, d) => c(t, "name", "").localeCompare(c(d, "name", ""))
69
- ),
70
- (t) => /* @__PURE__ */ e(w, { value: c(t, "key"), children: c(t, "name") }, c(t, "key"))
71
- )
72
- ] }),
73
- C(f(i, h)) && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: s("No matching page types found") })
74
- ] })
75
- ] });
76
- }, J = ({ search: n, setSearch: l }) => {
77
- const { t: s } = v();
78
- return /* @__PURE__ */ a("div", { className: "relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5", children: [
79
- /* @__PURE__ */ e("label", { htmlFor: "page-search-input", className: "sr-only", children: s("Search Pages") }),
80
- /* @__PURE__ */ e(
81
- F,
82
- {
83
- className: `${n ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground`,
84
- "aria-hidden": "true"
85
- }
86
- ),
87
- /* @__PURE__ */ e(
88
- E,
89
- {
90
- id: "page-search-input",
91
- placeholder: s("Search pages"),
92
- value: n,
93
- onChange: (r) => l(r.target.value),
94
- className: "border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",
95
- autoComplete: "off",
96
- autoFocus: !0
97
- }
98
- )
99
- ] });
100
- }, Y = ({ pages: n }) => {
101
- const { t: l } = v(), { expandAll: s, collapseAll: r, expandedPages: o } = B(null);
102
- return /* @__PURE__ */ a("div", { className: "flex gap-1", children: [
103
- /* @__PURE__ */ a(b, { children: [
104
- /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(m, { variant: "outline", size: "icon", onClick: () => s(n), className: "rounded p-1 text-gray-500", children: /* @__PURE__ */ e(T, {}) }) }),
105
- /* @__PURE__ */ e(N, { children: l("Expand All") })
106
- ] }),
107
- /* @__PURE__ */ a(b, { children: [
108
- /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
109
- m,
110
- {
111
- disabled: o.length === 0,
112
- variant: "outline",
113
- size: "icon",
114
- onClick: () => r(),
115
- className: "rounded p-1 text-gray-500",
116
- children: /* @__PURE__ */ e(_, {})
117
- }
118
- ) }),
119
- /* @__PURE__ */ e(N, { children: l("Collapse All") })
120
- ] })
121
- ] });
122
- }, Z = ({ languages: n, selectedLanguage: l, setSelectedLanguage: s }) => {
123
- const r = j();
124
- return /* @__PURE__ */ e("div", { className: "scrollbar-hide flex gap-1 overflow-x-auto pb-1", children: n.map((o) => /* @__PURE__ */ a(
125
- m,
126
- {
127
- variant: l === o ? "default" : "outline",
128
- size: "sm",
129
- className: `h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${l === o ? "bg-black text-white hover:bg-black" : "text-gray-500"}`,
130
- onClick: () => s(o.toLowerCase()),
131
- children: [
132
- o === r && /* @__PURE__ */ e(R, { size: 4, className: `p-0.5 ${l === r ? "fill-white" : "fill-black"}` }),
133
- G[o] || ""
134
- ]
135
- },
136
- o
137
- )) });
138
- }, A = () => {
139
- const { t: n } = v(), l = D();
140
- return /* @__PURE__ */ a(b, { children: [
141
- /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
142
- m,
143
- {
144
- size: "sm",
145
- variant: "ghost",
146
- onClick: () => l.invalidateQueries({ queryKey: [M.GET_WEBSITE_PAGES] }),
147
- className: "mt-1 h-6 w-6",
148
- children: /* @__PURE__ */ e(H, {})
149
- }
150
- ) }),
151
- /* @__PURE__ */ e(N, { side: "bottom", children: n("Refresh pages list") })
152
- ] });
153
- }, de = ({
154
- pages: n,
155
- search: l,
156
- setSearch: s,
157
- languages: r,
158
- onAddPage: o,
159
- selectedLanguage: i,
160
- setSelectedLanguage: p,
161
- selectedPageType: h,
162
- setSelectedPageType: u,
163
- showUntranslatedPages: t,
164
- setShowUntranslatedPages: d
165
- }) => {
166
- const { t: x } = v(), g = r.length > 1;
167
- return /* @__PURE__ */ a("div", { className: "space-y-3 border-b border-b-gray-200 px-4 pb-1", children: [
168
- /* @__PURE__ */ a("div", { className: "flex items-center gap-x-2", children: [
169
- /* @__PURE__ */ e(X, { selectedPageType: h, setSelectedPageType: u }),
170
- /* @__PURE__ */ e(J, { search: l, setSearch: s }),
171
- /* @__PURE__ */ e(Y, { pages: n }),
172
- /* @__PURE__ */ a(m, { variant: "default", onClick: o, className: "rounded px-3 font-normal", children: [
173
- /* @__PURE__ */ e(W, { strokeWidth: 2, className: "stroke-white stroke-[3]" }),
174
- /* @__PURE__ */ e("span", { className: "font-normal text-white", children: x("Add Page") })
175
- ] }),
176
- !g && /* @__PURE__ */ e(A, {})
177
- ] }),
178
- g ? /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2", children: [
179
- /* @__PURE__ */ e(
180
- Z,
181
- {
182
- languages: r,
183
- selectedLanguage: i,
184
- setSelectedLanguage: (z) => {
185
- p(z), d(t && (r == null ? void 0 : r[0]) !== i);
186
- }
187
- }
188
- ),
189
- /* @__PURE__ */ a("div", { className: "flex items-center gap-x-2", children: [
190
- (r == null ? void 0 : r[0]) !== i && /* @__PURE__ */ a(b, { children: [
191
- /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
192
- m,
193
- {
194
- variant: "ghost",
195
- onClick: () => d(!t),
196
- className: "h-6 rounded px-3 py-1 text-xs font-normal",
197
- children: t ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ e(K, {})
198
- }
199
- ) }),
200
- /* @__PURE__ */ e(N, { side: "bottom", children: x("Toggle Untranslated Pages") })
201
- ] }),
202
- /* @__PURE__ */ e(A, {})
203
- ] })
204
- ] }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-2" })
205
- ] });
206
- };
207
- export {
208
- Z as LanguageSelector,
209
- de as default
210
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-DCJDQs1a.cjs"),c=require("./index-BVwFJWDq.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-Cb1CmRqP.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.usePrimaryPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.usePrimaryPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:P,fallbackLang:q}=i.useLanguages(),U=P||q;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;