headroom-cms 0.1.8 → 0.1.10

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 (123) hide show
  1. package/admin/assets/{AdminsPage-Bt_ekZen.js → AdminsPage-BIWASote.js} +1 -1
  2. package/admin/assets/AllContentPage-1gXe2OC7.js +1 -0
  3. package/admin/assets/{ApiKeysPage-BfWCxGhC.js → ApiKeysPage-BBW4ATBx.js} +1 -1
  4. package/admin/assets/AuditPage-B5GGFWGG.js +1 -0
  5. package/admin/assets/BlockEditor-CQpF8tYb.css +1 -0
  6. package/admin/assets/BlockEditor-ClskiZoX.js +176 -0
  7. package/admin/assets/BlockTypeEditPage-CY0gCPei.js +1 -0
  8. package/admin/assets/BlockTypesPage-D8Me6OeX.js +1 -0
  9. package/admin/assets/{BulkActionBar-TRiXXLQd.js → BulkActionBar--35xjnOP.js} +1 -1
  10. package/admin/assets/CollectionEditPage-y8t0ZO89.js +1 -0
  11. package/admin/assets/{CollectionsPage-ClplrxNn.js → CollectionsPage-BQmGXpvW.js} +1 -1
  12. package/admin/assets/{ContentCreatePage-DfYcEH1u.js → ContentCreatePage-DlgxamOe.js} +1 -1
  13. package/admin/assets/ContentEditPage-WkSbCnnG.js +1 -0
  14. package/admin/assets/ContentField-D04Uo1Ov.js +1 -0
  15. package/admin/assets/ContentListPage-BDMx7pWb.js +1 -0
  16. package/admin/assets/CustomBlockPreview-Cs9bFDh4.js +479 -0
  17. package/admin/assets/FieldRenderer-wE-mtqZB.js +2 -0
  18. package/admin/assets/FilterBar-kFcOLffg.js +1 -0
  19. package/admin/assets/FloatingComposerController-D4uLQfUX-C0Lhbmda.js +1 -0
  20. package/admin/assets/IconPicker-BrgSAsa_.js +3 -0
  21. package/admin/assets/{LoginPage-DutieANA.js → LoginPage-Bi7TBzK4.js} +1 -1
  22. package/admin/assets/MediaField-B-Cz8TlK.js +1 -0
  23. package/admin/assets/MediaPage-C84p9d1U.js +1 -0
  24. package/admin/assets/Pagination-CuHwUPHi.js +1 -0
  25. package/admin/assets/RelationshipPicker-Dv7GaLcU.js +1 -0
  26. package/admin/assets/{SiteSettingsPage-BtCC3RKc.js → SiteSettingsPage-nBT7NzkA.js} +1 -1
  27. package/admin/assets/{SiteUserEditPage-ClHmp0T-.js → SiteUserEditPage-DroUTii9.js} +1 -1
  28. package/admin/assets/SiteUsersPage-iVXPCBPe.js +1 -0
  29. package/admin/assets/{SitesPage-Bw_WBN6v.js → SitesPage-BefZeWuJ.js} +1 -1
  30. package/admin/assets/{SubmissionDetailPage-DS08LGxd.js → SubmissionDetailPage-ktmzzOE1.js} +1 -1
  31. package/admin/assets/SubmissionEditPage-C-ykTI2t.js +1 -0
  32. package/admin/assets/SubmissionListPage-DA-8deUy.js +1 -0
  33. package/admin/assets/{TagInput-BILCaC9b.js → TagInput-d-Hw1fkL.js} +1 -1
  34. package/admin/assets/{TagsPage-DdeZokow.js → TagsPage-BZzDvcKa.js} +1 -1
  35. package/admin/assets/{UsersPage-B0vLxjrg.js → UsersPage-CnQAOOGF.js} +1 -1
  36. package/admin/assets/{WebhookEditPage-SlJE4d3z.js → WebhookEditPage-KeS8hmdW.js} +1 -1
  37. package/admin/assets/{WebhooksPage-C6lGZLpr.js → WebhooksPage-CASjmlPN.js} +1 -1
  38. package/admin/assets/{card-hXVtlM0q.js → card-CZTHR2Qa.js} +1 -1
  39. package/admin/assets/checkbox-DEgzM8H9.js +1 -0
  40. package/admin/assets/{collapsible-B414SspL.js → collapsible-D3d29uJp.js} +1 -1
  41. package/admin/assets/{command-fvBFHye4.js → command-CdzYw11U.js} +1 -1
  42. package/admin/assets/contentStatus-CkPi9Dh6.js +1 -0
  43. package/admin/assets/{core.esm-B_kcYf6n.js → core.esm-DdQHdRkd.js} +2 -2
  44. package/admin/assets/index-BA3y7HJs.js +18 -0
  45. package/admin/assets/index-c7UygSvP.css +1 -0
  46. package/admin/assets/popover-BFw_h3j6.js +1 -0
  47. package/admin/assets/radix-C5ZmWuuL.js +51 -0
  48. package/admin/assets/select-dX9e6VDt.js +1 -0
  49. package/admin/assets/{serializeToText-DR_WnxiI.js → serializeToText-Zin3gYPm.js} +1 -1
  50. package/admin/assets/{sortable.esm-QyXA6fio.js → sortable.esm-qVEMoaTg.js} +1 -1
  51. package/admin/assets/{table-DLoIbCQ5.js → table-Dk7eeOt2.js} +1 -1
  52. package/admin/assets/{textarea-vSXNxwTe.js → textarea-CpDSUg2s.js} +1 -1
  53. package/admin/assets/useAdminResolver-Bljb4XGQ.js +1 -0
  54. package/admin/assets/useContent-CW0tm0FY.js +1 -0
  55. package/admin/assets/useContentSearch-_bwacEth.js +1 -0
  56. package/admin/assets/{useMedia-e3sqWm_t.js → useMedia-Cu5N4rY8.js} +1 -1
  57. package/admin/assets/usePageTitle-DYvuJQp6.js +1 -0
  58. package/admin/assets/useSiteUsers-CKtC_8Jc.js +1 -0
  59. package/admin/assets/{useTags-f7AVSLuj.js → useTags-ybsMbCst.js} +1 -1
  60. package/admin/assets/{useWebhooks-BH_r8-Mo.js → useWebhooks-BAB-3sLa.js} +1 -1
  61. package/admin/assets/yjs-tXBm_srz.js +5 -0
  62. package/admin/index.html +3 -3
  63. package/admin/sw.js +1 -1
  64. package/dist/admin-site.d.ts +12 -0
  65. package/dist/admin-site.d.ts.map +1 -1
  66. package/dist/admin-site.js +8 -1
  67. package/dist/admin-site.js.map +1 -1
  68. package/dist/api.d.ts +7 -0
  69. package/dist/api.d.ts.map +1 -1
  70. package/dist/api.js +8 -1
  71. package/dist/api.js.map +1 -1
  72. package/dist/collaboration.d.ts +55 -0
  73. package/dist/collaboration.d.ts.map +1 -0
  74. package/dist/collaboration.js +141 -0
  75. package/dist/collaboration.js.map +1 -0
  76. package/dist/index.d.ts +12 -0
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +29 -4
  79. package/dist/index.js.map +1 -1
  80. package/dist/storage.d.ts +2 -0
  81. package/dist/storage.d.ts.map +1 -1
  82. package/dist/storage.js +33 -0
  83. package/dist/storage.js.map +1 -1
  84. package/lambda/api/bootstrap +0 -0
  85. package/lambda/webhook-worker/bootstrap +0 -0
  86. package/package.json +1 -1
  87. package/src/admin-site.ts +20 -1
  88. package/src/api.ts +15 -1
  89. package/src/collaboration.ts +187 -0
  90. package/src/index.ts +44 -4
  91. package/src/sst-env.d.ts +28 -0
  92. package/src/storage.ts +35 -0
  93. package/admin/assets/AllContentPage-CFqEMAl9.js +0 -1
  94. package/admin/assets/AuditPage-BE0XIUl2.js +0 -1
  95. package/admin/assets/BlockEditor-6wqsThJ7.js +0 -179
  96. package/admin/assets/BlockEditor-Cp_wZ2xN.css +0 -1
  97. package/admin/assets/BlockTypeEditPage-CuNJfZw0.js +0 -1
  98. package/admin/assets/BlockTypesPage-BIMBVxBs.js +0 -1
  99. package/admin/assets/CollectionEditPage-BqX_0cC2.js +0 -1
  100. package/admin/assets/ContentEditPage-D3Rvlktk.js +0 -2
  101. package/admin/assets/ContentListPage-zmO8Is4d.js +0 -1
  102. package/admin/assets/CustomBlockPreview-C6HqS4xv.js +0 -479
  103. package/admin/assets/FieldBuilder-36tfpSyM.js +0 -3
  104. package/admin/assets/FilterBar-DhRwTqFv.js +0 -1
  105. package/admin/assets/MediaField-J2TLG_fu.js +0 -1
  106. package/admin/assets/MediaPage-DZZKMGF4.js +0 -1
  107. package/admin/assets/RelationshipPicker-CDFs4TMW.js +0 -1
  108. package/admin/assets/SiteUsersPage-AyJvcVM7.js +0 -1
  109. package/admin/assets/SubmissionEditPage-Brf-DK2X.js +0 -1
  110. package/admin/assets/SubmissionListPage-DNMzQZHS.js +0 -1
  111. package/admin/assets/checkbox-WGrS3sUr.js +0 -1
  112. package/admin/assets/contentStatus-BmaiYVOm.js +0 -1
  113. package/admin/assets/index-Cir9tY_P.js +0 -18
  114. package/admin/assets/index-DACBYsKM.css +0 -1
  115. package/admin/assets/popover-D5_HjjUC.js +0 -1
  116. package/admin/assets/radix-C1kb_NqW.js +0 -51
  117. package/admin/assets/select-_uJYxzeZ.js +0 -1
  118. package/admin/assets/useAdminResolver-D-LlmquD.js +0 -1
  119. package/admin/assets/useContent-e8beBIuq.js +0 -1
  120. package/admin/assets/useContentSearch-DOjveB9t.js +0 -1
  121. package/admin/assets/useDebouncedValue-C-cQUcLG.js +0 -1
  122. package/admin/assets/usePageTitle-BNSba9_L.js +0 -1
  123. package/admin/assets/useSiteUsers-BdnvuM2E.js +0 -1
@@ -1 +1 @@
1
- import{a as o,b as d,u,d as c}from"./tanstack-Bs3zYPPV.js";import{e as a}from"./index-Cir9tY_P.js";function m(i,e){const n=a();return u({queryKey:["sites",i,"media","item",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`),enabled:!!i&&!!e})}function f(i,e){const n=a(),t=new URLSearchParams;e?.tag&&t.set("tag",e.tag),e?.folderId!==void 0&&t.set("folderId",e.folderId),e?.q&&t.set("q",e.q),e?.sort&&t.set("sort",e.sort),e?.limit&&t.set("limit",String(e.limit));const s=t.toString();return u({queryKey:["sites",i,"media",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media${s?`?${s}`:""}`),enabled:!!i})}function y(i,e){const n=a();return c({queryKey:["sites",i,"media","infinite",e],queryFn:({pageParam:t})=>{const s=new URLSearchParams;return t&&s.set("cursor",t),e?.tag&&s.set("tag",e.tag),e?.folderId!==void 0&&s.set("folderId",e.folderId),e?.q&&s.set("q",e.q),e?.sort&&s.set("sort",e.sort),e?.limit&&s.set("limit",String(e.limit)),n.apiFetch(`/v1/admin/sites/${i}/media?${s.toString()}`)},initialPageParam:void 0,getNextPageParam:t=>t.hasMore?t.cursor??void 0:void 0,enabled:!!i})}function q(i){const e=a();return d({mutationFn:n=>e.apiFetch(`/v1/admin/sites/${i}/media/upload-url`,{method:"POST",body:JSON.stringify(n)})})}function F(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/${t.mediaId}/complete`,{method:"POST",body:JSON.stringify({filename:t.filename,alt:t.alt,caption:t.caption,folderId:t.folderId})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media"]})})}function v(i,e){const n=a(),t=o();return d({mutationFn:s=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function $(i,e){const n=a(),t=o();return d({mutationFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`,{method:"DELETE"}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function S(i){const e=a();return u({queryKey:["sites",i,"media","folders"],queryFn:()=>e.apiFetch(`/v1/admin/sites/${i}/media/folders`),enabled:!!i})}function g(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/folders`,{method:"POST",body:JSON.stringify({name:t})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function b(i){const e=a(),n=o();return d({mutationFn:({folderId:t,name:s})=>e.apiFetch(`/v1/admin/sites/${i}/media/folders/${t}`,{method:"PUT",body:JSON.stringify({name:s})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function h(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/folders/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function K(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/bulk`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media"]})})}function M(i){const e=a();return d({mutationFn:({filename:n,size:t})=>e.apiFetch(`/v1/admin/sites/${i}/media/check-duplicate?filename=${encodeURIComponent(n)}&size=${t}`)})}function O(i,e){const n=a(),t=o();return d({mutationFn:s=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}/save-transform`,{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function P(i,e){const n=a();return u({queryKey:["sites",i,"media","usage",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}/usage`),enabled:!!i&&!!e})}export{v as a,$ as b,P as c,S as d,g as e,b as f,h as g,q as h,F as i,K as j,M as k,f as l,y as m,m as n,O as u};
1
+ import{a as o,b as d,u,d as c}from"./tanstack-Bs3zYPPV.js";import{e as a}from"./index-BA3y7HJs.js";function m(i,e){const n=a();return u({queryKey:["sites",i,"media","item",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`),enabled:!!i&&!!e})}function f(i,e){const n=a(),t=new URLSearchParams;e?.tag&&t.set("tag",e.tag),e?.folderId!==void 0&&t.set("folderId",e.folderId),e?.q&&t.set("q",e.q),e?.sort&&t.set("sort",e.sort),e?.limit&&t.set("limit",String(e.limit));const s=t.toString();return u({queryKey:["sites",i,"media",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media${s?`?${s}`:""}`),enabled:!!i})}function y(i,e){const n=a();return c({queryKey:["sites",i,"media","infinite",e],queryFn:({pageParam:t})=>{const s=new URLSearchParams;return t&&s.set("cursor",t),e?.tag&&s.set("tag",e.tag),e?.folderId!==void 0&&s.set("folderId",e.folderId),e?.q&&s.set("q",e.q),e?.sort&&s.set("sort",e.sort),e?.limit&&s.set("limit",String(e.limit)),n.apiFetch(`/v1/admin/sites/${i}/media?${s.toString()}`)},initialPageParam:void 0,getNextPageParam:t=>t.hasMore?t.cursor??void 0:void 0,enabled:!!i})}function q(i){const e=a();return d({mutationFn:n=>e.apiFetch(`/v1/admin/sites/${i}/media/upload-url`,{method:"POST",body:JSON.stringify(n)})})}function F(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/${t.mediaId}/complete`,{method:"POST",body:JSON.stringify({filename:t.filename,alt:t.alt,caption:t.caption,folderId:t.folderId})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media"]})})}function v(i,e){const n=a(),t=o();return d({mutationFn:s=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function $(i,e){const n=a(),t=o();return d({mutationFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}`,{method:"DELETE"}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function S(i){const e=a();return u({queryKey:["sites",i,"media","folders"],queryFn:()=>e.apiFetch(`/v1/admin/sites/${i}/media/folders`),enabled:!!i})}function g(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/folders`,{method:"POST",body:JSON.stringify({name:t})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function b(i){const e=a(),n=o();return d({mutationFn:({folderId:t,name:s})=>e.apiFetch(`/v1/admin/sites/${i}/media/folders/${t}`,{method:"PUT",body:JSON.stringify({name:s})}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function h(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/folders/${t}`,{method:"DELETE"}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media","folders"]})})}function K(i){const e=a(),n=o();return d({mutationFn:t=>e.apiFetch(`/v1/admin/sites/${i}/media/bulk`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",i,"media"]})})}function M(i){const e=a();return d({mutationFn:({filename:n,size:t})=>e.apiFetch(`/v1/admin/sites/${i}/media/check-duplicate?filename=${encodeURIComponent(n)}&size=${t}`)})}function O(i,e){const n=a(),t=o();return d({mutationFn:s=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}/save-transform`,{method:"POST",body:JSON.stringify(s)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",i,"media"]})})}function P(i,e){const n=a();return u({queryKey:["sites",i,"media","usage",e],queryFn:()=>n.apiFetch(`/v1/admin/sites/${i}/media/${e}/usage`),enabled:!!i&&!!e})}export{v as a,$ as b,P as c,S as d,g as e,b as f,h as g,q as h,F as i,K as j,M as k,f as l,y as m,m as n,O as u};
@@ -0,0 +1 @@
1
+ import{r as o}from"./react-vendor-C2CvUxFh.js";import{bd as s,aJ as c}from"./index-BA3y7HJs.js";function f(e){const r=s(),i=c(),n=o.useRef("");o.useEffect(()=>{if(!r)return;const t=`${e.title}|${e.showBack??""}|${e.backTo??""}|${e.badge?.label??""}|${e.badge?.variant??""}|${e.subtitle??""}`;t!==n.current&&(n.current=t,r.setTitleBar(e))}),o.useEffect(()=>{if(e.title){const t=i?.site?.name||i?.site?.host;document.title=t?`${e.title} | ${t}`:e.title}return()=>{document.title="Headroom"}},[e.title,i?.site?.name,i?.site?.host])}export{f as u};
@@ -0,0 +1 @@
1
+ import{u as c,a as r,b as a}from"./tanstack-Bs3zYPPV.js";import{e as n}from"./index-BA3y7HJs.js";function d(e,t){const s=n(),i=new URLSearchParams;t?.cursor&&i.set("cursor",t.cursor),t?.tag&&i.set("tag",t.tag),i.set("limit",String(t.limit));const u=i.toString();return c({queryKey:["sites",e,"site-users",u],queryFn:()=>s.apiFetch(`/v1/admin/sites/${e}/site-users${u?`?${u}`:""}`),enabled:!!e})}function y(e,t){const s=n();return c({queryKey:["sites",e,"site-users",t],queryFn:()=>s.apiFetch(`/v1/admin/sites/${e}/site-users/${t}`),enabled:!!e&&!!t})}function l(e){const t=n(),s=r();return a({mutationFn:i=>t.apiFetch(`/v1/admin/sites/${e}/site-users`,{method:"POST",body:JSON.stringify(i)}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"site-users"]})})}function S(e){const t=n(),s=r();return a({mutationFn:({userId:i,...u})=>t.apiFetch(`/v1/admin/sites/${e}/site-users/${i}`,{method:"PUT",body:JSON.stringify(u)}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"site-users"]})})}function f(e){const t=n(),s=r();return a({mutationFn:({userId:i,email:u})=>t.apiFetch(`/v1/admin/sites/${e}/site-users/${i}/email`,{method:"PUT",body:JSON.stringify({email:u})}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"site-users"]})})}function F(e){const t=n(),s=r();return a({mutationFn:i=>t.apiFetch(`/v1/admin/sites/${e}/site-users/${i}`,{method:"DELETE"}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"site-users"]})})}function q(e){const t=n();return c({queryKey:["sites",e,"auth"],queryFn:()=>t.apiFetch(`/v1/admin/sites/${e}/auth`),enabled:!!e})}function v(e){const t=n(),s=r();return a({mutationFn:i=>t.apiFetch(`/v1/admin/sites/${e}/auth`,{method:"PUT",body:JSON.stringify(i)}),onSuccess:()=>{s.invalidateQueries({queryKey:["sites",e,"auth"]}),s.invalidateQueries({queryKey:["sites",e]})}})}function h(e){const t=n();return a({mutationFn:s=>t.apiFetch(`/v1/admin/sites/${e}/auth/test-email`,{method:"POST",body:JSON.stringify({email:s})})})}function $(e){const t=n();return a({mutationFn:s=>t.apiFetch(`/v1/admin/sites/${e}/auth/latest-otp?email=${encodeURIComponent(s)}`)})}export{v as a,h as b,$ as c,d,l as e,F as f,y as g,S as h,f as i,q as u};
@@ -1 +1 @@
1
- import{u as r,a as i,b as u}from"./tanstack-Bs3zYPPV.js";import{e as a}from"./index-Cir9tY_P.js";function m(e){const t=a();return r({queryKey:["sites",e,"tags"],queryFn:async()=>(await t.apiFetch(`/v1/admin/sites/${e}/tags`)).tags,enabled:!!e})}function y(e){const t=a(),s=i();return u({mutationFn:n=>t.apiFetch(`/v1/admin/sites/${e}/tags`,{method:"POST",body:JSON.stringify({tag:n})}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"tags"]})})}function d(e){const t=a(),s=i();return u({mutationFn:n=>t.apiFetch(`/v1/admin/sites/${e}/tags/${encodeURIComponent(n)}`,{method:"DELETE"}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"tags"]})})}export{y as a,d as b,m as u};
1
+ import{u as r,a as i,b as u}from"./tanstack-Bs3zYPPV.js";import{e as a}from"./index-BA3y7HJs.js";function m(e){const t=a();return r({queryKey:["sites",e,"tags"],queryFn:async()=>(await t.apiFetch(`/v1/admin/sites/${e}/tags`)).tags,enabled:!!e})}function y(e){const t=a(),s=i();return u({mutationFn:n=>t.apiFetch(`/v1/admin/sites/${e}/tags`,{method:"POST",body:JSON.stringify({tag:n})}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"tags"]})})}function d(e){const t=a(),s=i();return u({mutationFn:n=>t.apiFetch(`/v1/admin/sites/${e}/tags/${encodeURIComponent(n)}`,{method:"DELETE"}),onSuccess:()=>s.invalidateQueries({queryKey:["sites",e,"tags"]})})}export{y as a,d as b,m as u};
@@ -1 +1 @@
1
- import{u,a,b as o}from"./tanstack-Bs3zYPPV.js";import{e as n}from"./index-Cir9tY_P.js";function y(e){const s=n();return u({queryKey:["sites",e,"webhooks"],queryFn:async()=>({items:(await s.apiFetch(`/v1/admin/sites/${e}/webhooks`)).webhooks}),enabled:!!e})}function d(e,s){const t=n();return u({queryKey:["sites",e,"webhooks",s],queryFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`),enabled:!!e&&!!s})}function m(e){const s=n(),t=a();return o({mutationFn:i=>s.apiFetch(`/v1/admin/sites/${e}/webhooks`,{method:"POST",body:JSON.stringify(i)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",e,"webhooks"]})})}function h(e,s){const t=n(),i=a();return o({mutationFn:c=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`,{method:"PUT",body:JSON.stringify(c)}),onSuccess:()=>{i.invalidateQueries({queryKey:["sites",e,"webhooks"]})}})}function l(e,s){const t=n(),i=a();return o({mutationFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["sites",e,"webhooks"]})})}function k(e,s){const t=n();return o({mutationFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}/test`,{method:"POST"})})}function v(e,s){const t=n();return u({queryKey:["sites",e,"webhooks",s,"deliveries"],queryFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}/deliveries`),enabled:!!e&&!!s})}export{d as a,m as b,h as c,l as d,k as e,v as f,y as u};
1
+ import{u,a,b as o}from"./tanstack-Bs3zYPPV.js";import{e as n}from"./index-BA3y7HJs.js";function y(e){const s=n();return u({queryKey:["sites",e,"webhooks"],queryFn:async()=>({items:(await s.apiFetch(`/v1/admin/sites/${e}/webhooks`)).webhooks}),enabled:!!e})}function d(e,s){const t=n();return u({queryKey:["sites",e,"webhooks",s],queryFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`),enabled:!!e&&!!s})}function m(e){const s=n(),t=a();return o({mutationFn:i=>s.apiFetch(`/v1/admin/sites/${e}/webhooks`,{method:"POST",body:JSON.stringify(i)}),onSuccess:()=>t.invalidateQueries({queryKey:["sites",e,"webhooks"]})})}function h(e,s){const t=n(),i=a();return o({mutationFn:c=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`,{method:"PUT",body:JSON.stringify(c)}),onSuccess:()=>{i.invalidateQueries({queryKey:["sites",e,"webhooks"]})}})}function l(e,s){const t=n(),i=a();return o({mutationFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["sites",e,"webhooks"]})})}function k(e,s){const t=n();return o({mutationFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}/test`,{method:"POST"})})}function v(e,s){const t=n();return u({queryKey:["sites",e,"webhooks",s,"deliveries"],queryFn:()=>t.apiFetch(`/v1/admin/sites/${e}/webhooks/${s}/deliveries`),enabled:!!e&&!!s})}export{d as a,m as b,h as c,l as d,k as e,v as f,y as u};
@@ -0,0 +1,5 @@
1
+ const U=()=>new Map,Be=e=>{const t=U();return e.forEach((n,s)=>{t.set(s,n)}),t},q=(e,t,n)=>{let s=e.get(t);return s===void 0&&e.set(t,s=n()),s},wr=(e,t)=>{const n=[];for(const[s,r]of e)n.push(t(r,s));return n},kr=(e,t)=>{for(const[n,s]of e)if(t(s,n))return!0;return!1},nt=()=>new Set,xe=e=>e[e.length-1],mr=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},W=Array.from,Ze=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Pe=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},yr=(e,t)=>{const n=new Array(e);for(let s=0;s<e;s++)n[s]=t(s,n);return n},wt=Array.isArray;class Pn{constructor(){this._observers=U()}on(t,n){return q(this._observers,t,nt).add(n),n}once(t,n){const s=(...r)=>{this.off(t,s),n(...r)};this.on(t,s)}off(t,n){const s=this._observers.get(t);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(t))}emit(t,n){return W((this._observers.get(t)||U()).values()).forEach(s=>s(...n))}destroy(){this._observers=U()}}class Rl{constructor(){this._observers=U()}on(t,n){q(this._observers,t,nt).add(n)}once(t,n){const s=(...r)=>{this.off(t,s),n(...r)};this.on(t,s)}off(t,n){const s=this._observers.get(t);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(t))}emit(t,n){return W((this._observers.get(t)||U()).values()).forEach(s=>s(...n))}destroy(){this._observers=U()}}const j=Math.floor,Qt=Math.abs,Qn=(e,t)=>e<t?e:t,ot=(e,t)=>e>t?e:t,ts=e=>e!==0?e<0:1/e<0,Dn=1,An=2,Le=4,Ue=8,Rt=32,X=64,M=128,Nl=1<<29,ke=31,je=63,et=127,_r=2147483647,re=Number.MAX_SAFE_INTEGER,In=Number.MIN_SAFE_INTEGER,Sr=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&j(e)===e),es=String.fromCharCode,br=e=>e.toLowerCase(),Cr=/^\s*/g,Er=e=>e.replace(Cr,""),Dr=/([A-Z])/g,Tn=(e,t)=>Er(e.replace(Dr,n=>`${t}${br(n)}`)),Ar=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=t.codePointAt(r);return s},Nt=typeof TextEncoder<"u"?new TextEncoder:null,Ir=e=>Nt.encode(e),Tr=Nt?Ir:Ar;let Ut=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ut&&Ut.decode(new Uint8Array).length===1&&(Ut=null);const Or=(e,t)=>yr(t,()=>e).join("");class Jt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Gt=()=>new Jt,xr=e=>{const t=Gt();return e(t),F(t)},Lr=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},F=e=>{const t=new Uint8Array(Lr(e));let n=0;for(let s=0;s<e.bufs.length;s++){const r=e.bufs[s];t.set(r,n),n+=r.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},Ur=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(ot(n,t)*2),e.cpos=0)},A=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Je=A,m=(e,t)=>{for(;t>et;)A(e,M|et&t),t=j(t/128);A(e,et&t)},Qe=(e,t)=>{const n=ts(t);for(n&&(t=-t),A(e,(t>je?M:0)|(n?X:0)|je&t),t=j(t/64);t>0;)A(e,(t>et?M:0)|et&t),t=j(t/128)},Ge=new Uint8Array(3e4),Rr=Ge.length/3,Nr=(e,t)=>{if(t.length<Rr){const n=Nt.encodeInto(t,Ge).written||0;m(e,n);for(let s=0;s<n;s++)A(e,Ge[s])}else R(e,Tr(t))},Mr=(e,t)=>{const n=unescape(encodeURIComponent(t)),s=n.length;m(e,s);for(let r=0;r<s;r++)A(e,n.codePointAt(r))},at=Nt&&Nt.encodeInto?Nr:Mr,me=(e,t)=>{const n=e.cbuf.length,s=e.cpos,r=Qn(n-s,t.length),i=t.length-r;e.cbuf.set(t.subarray(0,r),s),e.cpos+=r,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(ot(n*2,i)),e.cbuf.set(t.subarray(r)),e.cpos=i)},R=(e,t)=>{m(e,t.byteLength),me(e,t)},tn=(e,t)=>{Ur(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},vr=(e,t)=>tn(e,4).setFloat32(0,t,!1),$r=(e,t)=>tn(e,8).setFloat64(0,t,!1),Vr=(e,t)=>tn(e,8).setBigInt64(0,t,!1),On=new DataView(new ArrayBuffer(4)),Fr=e=>(On.setFloat32(0,e),On.getFloat32(0)===e),kt=(e,t)=>{switch(typeof t){case"string":A(e,119),at(e,t);break;case"number":Sr(t)&&Qt(t)<=_r?(A(e,125),Qe(e,t)):Fr(t)?(A(e,124),vr(e,t)):(A(e,123),$r(e,t));break;case"bigint":A(e,122),Vr(e,t);break;case"object":if(t===null)A(e,126);else if(wt(t)){A(e,117),m(e,t.length);for(let n=0;n<t.length;n++)kt(e,t[n])}else if(t instanceof Uint8Array)A(e,116),R(e,t);else{A(e,118);const n=Object.keys(t);m(e,n.length);for(let s=0;s<n.length;s++){const r=n[s];at(e,r),kt(e,t[r])}}break;case"boolean":A(e,t?120:121);break;default:A(e,127)}};class xn extends Jt{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&m(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const Ln=e=>{e.count>0&&(Qe(e.encoder,e.count===1?e.s:-e.s),e.count>1&&m(e.encoder,e.count-2))};class te{constructor(){this.encoder=new Jt,this.s=0,this.count=0}write(t){this.s===t?this.count++:(Ln(this),this.count=1,this.s=t)}toUint8Array(){return Ln(this),F(this.encoder)}}const Un=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Qe(e.encoder,t),e.count>1&&m(e.encoder,e.count-2)}};class Re{constructor(){this.encoder=new Jt,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(Un(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return Un(this),F(this.encoder)}}class Br{constructor(){this.sarr=[],this.s="",this.lensE=new te}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Jt;return this.sarr.push(this.s),this.s="",at(t,this.sarr.join("")),me(t,this.lensE.toUint8Array()),F(t)}}const G=e=>new Error(e),B=()=>{throw G("Method unimplemented")},v=()=>{throw G("Unexpected case")},ns=G("Unexpected end of array"),ss=G("Integer out of Range");class ye{constructor(t){this.arr=t,this.pos=0}}const At=e=>new ye(e),jr=e=>e.pos!==e.arr.length,Jr=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},N=e=>Jr(e,k(e)),mt=e=>e.arr[e.pos++],k=e=>{let t=0,n=1;const s=e.arr.length;for(;e.pos<s;){const r=e.arr[e.pos++];if(t=t+(r&et)*n,n*=128,r<M)return t;if(t>re)throw ss}throw ns},en=e=>{let t=e.arr[e.pos++],n=t&je,s=64;const r=(t&X)>0?-1:1;if((t&M)===0)return r*n;const i=e.arr.length;for(;e.pos<i;){if(t=e.arr[e.pos++],n=n+(t&et)*s,s*=128,t<M)return r*n;if(n>re)throw ss}throw ns},Gr=e=>{let t=k(e);if(t===0)return"";{let n=String.fromCodePoint(mt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(mt(e));else for(;t>0;){const s=t<1e4?t:1e4,r=e.arr.subarray(e.pos,e.pos+s);e.pos+=s,n+=String.fromCodePoint.apply(null,r),t-=s}return decodeURIComponent(escape(n))}},zr=e=>Ut.decode(N(e)),ut=Ut?zr:Gr,nn=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Hr=e=>nn(e,4).getFloat32(0,!1),Yr=e=>nn(e,8).getFloat64(0,!1),Kr=e=>nn(e,8).getBigInt64(0,!1),Xr=[e=>{},e=>null,en,Hr,Yr,Kr,e=>!1,e=>!0,ut,e=>{const t=k(e),n={};for(let s=0;s<t;s++){const r=ut(e);n[r]=Mt(e)}return n},e=>{const t=k(e),n=[];for(let s=0;s<t;s++)n.push(Mt(e));return n},N],Mt=e=>Xr[127-mt(e)](e);class Rn extends ye{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),jr(this)?this.count=k(this)+1:this.count=-1),this.count--,this.s}}class ee extends ye{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=en(this);const t=ts(this.s);this.count=1,t&&(this.s=-this.s,this.count=k(this)+2)}return this.count--,this.s}}class Ne extends ye{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=en(this),n=t&1;this.diff=j(t/2),this.count=1,n&&(this.count=k(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Wr{constructor(t){this.decoder=new ee(t),this.str=ut(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const qr=crypto.getRandomValues.bind(crypto),Zr=Math.random,rs=()=>qr(new Uint32Array(1))[0],Ml=e=>e[j(Zr()*e.length)],Pr="10000000-1000-4000-8000"+-1e11,Qr=()=>Pr.replace(/[018]/g,e=>(e^rs()&15>>e/4).toString(16)),ti=Date.now,Nn=e=>new Promise(e);Promise.all.bind(Promise);const Mn=e=>e===void 0?null:e;class ei{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let is=new ei,ni=!0;try{typeof localStorage<"u"&&localStorage&&(is=localStorage,ni=!1)}catch{}const si=is,vt=Symbol("Equality"),os=(e,t)=>e===t||!!e?.[vt]?.(t)||!1,ri=e=>typeof e=="object",ii=Object.assign,oi=Object.keys,li=(e,t)=>{for(const n in e)t(e[n],n)},ie=e=>oi(e).length,ci=e=>{for(const t in e)return!1;return!0},zt=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},sn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hi=(e,t)=>e===t||ie(e)===ie(t)&&zt(e,(n,s)=>(n!==void 0||sn(t,s))&&os(t[s],n)),ai=Object.freeze,ls=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&ls(e[t])}return ai(e)},rn=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&rn(e,t,n+1)}},ui=e=>e,ne=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[vt]!=null)return e[vt](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break}case Set:{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break}case Map:{if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!ne(e.get(n),t.get(n)))return!1;break}case void 0:case Object:if(ie(e)!==ie(t))return!1;for(const n in e)if(!sn(e,n)||!ne(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ne(e[n],t[n]))return!1;break;default:return!1}return!0},di=(e,t)=>t.includes(e);var cs={};const yt=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",fi=typeof window<"u"&&typeof document<"u"&&!yt;let J;const gi=()=>{if(J===void 0)if(yt){J=U();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const s=e[n];s[0]==="-"?(t!==null&&J.set(t,""),t=s):t!==null&&(J.set(t,s),t=null)}t!==null&&J.set(t,"")}else typeof location=="object"?(J=U(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");J.set(`--${Tn(t,"-")}`,n),J.set(`-${Tn(t,"-")}`,n)}})):J=U();return J},ze=e=>gi().has(e),oe=e=>Mn(yt?cs[e.toUpperCase().replaceAll("-","_")]:si.getItem(e)),hs=e=>ze("--"+e)||oe(e)!==null,pi=hs("production"),wi=yt&&di(cs.FORCE_COLOR,["true","1","2"]),ki=wi||!ze("--no-colors")&&!hs("no-color")&&(!yt||process.stdout.isTTY)&&(!yt||ze("--color")||oe("COLORTERM")!==null||(oe("TERM")||"").includes("color")),mi=e=>new Uint8Array(e),yi=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=es(e[n]);return btoa(t)},_i=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),vl=fi?yi:_i,Si=e=>{const t=mi(e.byteLength);return t.set(e),t},$l=e=>xr(t=>kt(t,e));class bi{constructor(t,n){this.left=t,this.right=n}}const K=(e,t)=>new bi(e,t),vn=e=>e.next()>=.5,Me=(e,t,n)=>j(e.next()*(n+1-t)+t),as=(e,t,n)=>j(e.next()*(n+1-t)+t),on=(e,t,n)=>as(e,t,n),Ci=e=>es(on(e,97,122)),Ei=(e,t=0,n=20)=>{const s=on(e,t,n);let r="";for(let i=0;i<s;i++)r+=Ci(e);return r},ve=(e,t)=>t[on(e,0,t.length-1)],Di=Symbol("0schema");class Ai{constructor(){this._rerrs=[]}extend(t,n,s,r=null){this._rerrs.push({path:t,expected:n,has:s,message:r})}toString(){const t=[];for(let n=this._rerrs.length-1;n>0;n--){const s=this._rerrs[n];t.push(Or(" ",(this._rerrs.length-n)*2)+`${s.path!=null?`[${s.path}] `:""}${s.has} doesn't match ${s.expected}. ${s.message}`)}return t.join(`
2
+ `)}}const He=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[vt]?os(e,t):wt(e)?Ze(e,n=>Pe(t,s=>He(n,s))):ri(e)?zt(e,(n,s)=>He(n,t[s])):!1;class x{static _dilutes=!1;extends(t){let[n,s]=[this.shape,t.shape];return this.constructor._dilutes&&([s,n]=[n,s]),He(n,s)}equals(t){return this.constructor===t.constructor&&ne(this.shape,t.shape)}[Di](){return!0}[vt](t){return this.equals(t)}validate(t){return this.check(t)}check(t,n){B()}get nullable(){return It(this,Ee)}get optional(){return new fs(this)}cast(t){return $n(t,this),t}expect(t){return $n(t,this),t}}class ln extends x{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n=void 0){const s=t?.constructor===this.shape&&(this._c==null||this._c(t));return!s&&n?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),s}}const E=(e,t=null)=>new ln(e,t);E(ln);class cn extends x{constructor(t){super(),this.shape=t}check(t,n){const s=this.shape(t);return!s&&n?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),s}}const T=e=>new cn(e);E(cn);class _e extends x{constructor(t){super(),this.shape=t}check(t,n){const s=this.shape.some(r=>r===t);return!s&&n?.extend(null,this.shape.join(" | "),t.toString()),s}}const Se=(...e)=>new _e(e),us=E(_e),Ii=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),ds=e=>{if(_t.check(e))return[Ii(e)];if(us.check(e))return e.shape.map(t=>t+"");if(bs.check(e))return["[+-]?\\d+.?\\d*"];if(Cs.check(e))return[".*"];if(le.check(e))return e.shape.map(ds).flat(1);v()};class Ti extends x{constructor(t){super(),this.shape=t,this._r=new RegExp("^"+t.map(ds).map(n=>`(${n.join("|")})`).join("")+"$")}check(t,n){const s=this._r.exec(t)!=null;return!s&&n?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),s}}E(Ti);const Oi=Symbol("optional");class fs extends x{constructor(t){super(),this.shape=t}check(t,n){const s=t===void 0||this.shape.check(t);return!s&&n?.extend(null,"undefined (optional)","()"),s}get[Oi](){return!0}}const xi=E(fs);class Li extends x{check(t,n){return n?.extend(null,"never",typeof t),!1}}E(Li);class be extends x{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new be(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):zt(this.shape,(s,r)=>{const i=this._isPartial&&!sn(t,r)||s.check(t[r],n);return!i&&n?.extend(r.toString(),s.toString(),typeof t[r],"Object property does not match"),i})}}const Ui=e=>new be(e),Ri=E(be),Ni=T(e=>e!=null&&(e.constructor===Object||e.constructor==null));class gs extends x{constructor(t,n){super(),this.shape={keys:t,values:n}}check(t,n){return t!=null&&zt(t,(s,r)=>{const i=this.shape.keys.check(r,n);return!i&&n?.extend(r+"","Record",typeof t,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(s,n)})}}const ps=(e,t)=>new gs(e,t),Mi=E(gs);class ws extends x{constructor(t){super(),this.shape=t}check(t,n){return t!=null&&zt(this.shape,(s,r)=>{const i=s.check(t[r],n);return!i&&n?.extend(r.toString(),"Tuple",typeof s),i})}}const vi=(...e)=>new ws(e);E(ws);class ks extends x{constructor(t){super(),this.shape=t.length===1?t[0]:new hn(t)}check(t,n){const s=wt(t)&&Ze(t,r=>this.shape.check(r));return!s&&n?.extend(null,"Array",""),s}}const ms=(...e)=>new ks(e),$i=E(ks),Vi=T(e=>wt(e));class ys extends x{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n){const s=t instanceof this.shape&&(this._c==null||this._c(t));return!s&&n?.extend(null,this.shape.name,t?.constructor.name),s}}const Fi=(e,t=null)=>new ys(e,t);E(ys);const Bi=Fi(x);class ji extends x{constructor(t){super(),this.len=t.length-1,this.args=vi(...t.slice(-1)),this.res=t[this.len]}check(t,n){const s=t.constructor===Function&&t.length<=this.len;return!s&&n?.extend(null,"function",typeof t),s}}const Ji=E(ji),Gi=T(e=>typeof e=="function");class zi extends x{constructor(t){super(),this.shape=t}check(t,n){const s=Ze(this.shape,r=>r.check(t,n));return!s&&n?.extend(null,"Intersectinon",typeof t),s}}E(zi,e=>e.shape.length>0);class hn extends x{static _dilutes=!0;constructor(t){super(),this.shape=t}check(t,n){const s=Pe(this.shape,r=>r.check(t,n));return n?.extend(null,"Union",typeof t),s}}const It=(...e)=>e.findIndex(t=>le.check(t))>=0?It(...e.map(t=>$t(t)).map(t=>le.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new hn(e),le=E(hn),_s=()=>!0,ce=T(_s),Hi=E(cn,e=>e.shape===_s),an=T(e=>typeof e=="bigint"),Yi=T(e=>e===an),Ss=T(e=>typeof e=="symbol");T(e=>e===Ss);const dt=T(e=>typeof e=="number"),bs=T(e=>e===dt),_t=T(e=>typeof e=="string"),Cs=T(e=>e===_t),Ce=T(e=>typeof e=="boolean"),Ki=T(e=>e===Ce),Es=Se(void 0);E(_e,e=>e.shape.length===1&&e.shape[0]===void 0);Se(void 0);const Ee=Se(null),Xi=E(_e,e=>e.shape.length===1&&e.shape[0]===null);E(Uint8Array);E(ln,e=>e.shape===Uint8Array);const Wi=It(dt,_t,Ee,Es,an,Ce,Ss);(()=>{const e=ms(ce),t=ps(_t,ce),n=It(dt,_t,Ee,Ce,e,t);return e.shape=n,t.shape.values=n,n})();const $t=e=>{if(Bi.check(e))return e;if(Ni.check(e)){const t={};for(const n in e)t[n]=$t(e[n]);return Ui(t)}else{if(Vi.check(e))return It(...e.map($t));if(Wi.check(e))return Se(e);if(Gi.check(e))return E(e)}v()},$n=pi?()=>{}:(e,t)=>{const n=new Ai;if(!t.check(e,n))throw G(`Expected value to be of type ${t.constructor.name}.
3
+ ${n.toString()}`)};class qi{constructor(t){this.patterns=[],this.$state=t}if(t,n){return this.patterns.push({if:$t(t),h:n}),this}else(t){return this.if(ce,t)}done(){return(t,n)=>{for(let s=0;s<this.patterns.length;s++){const r=this.patterns[s];if(r.if.check(t))return r.h(t,n)}throw G("Unhandled pattern")}}}const Zi=e=>new qi(e),Ds=Zi(ce).if(bs,(e,t)=>Me(t,In,re)).if(Cs,(e,t)=>Ei(t)).if(Ki,(e,t)=>vn(t)).if(Yi,(e,t)=>BigInt(Me(t,In,re))).if(le,(e,t)=>ct(t,ve(t,e.shape))).if(Ri,(e,t)=>{const n={};for(const s in e.shape){let r=e.shape[s];if(xi.check(r)){if(vn(t))continue;r=r.shape}n[s]=Ds(r,t)}return n}).if($i,(e,t)=>{const n=[],s=as(t,0,42);for(let r=0;r<s;r++)n.push(ct(t,e.shape));return n}).if(us,(e,t)=>ve(t,e.shape)).if(Xi,(e,t)=>null).if(Ji,(e,t)=>{const n=ct(t,e.res);return()=>n}).if(Hi,(e,t)=>ct(t,ve(t,[dt,_t,Ee,Es,an,Ce,ms(dt),ps(It("a","b","c"),dt)]))).if(Mi,(e,t)=>{const n={},s=Me(t,0,3);for(let r=0;r<s;r++){const i=ct(t,e.shape.keys),o=ct(t,e.shape.values);n[i]=o}return n}).done(),ct=(e,t)=>Ds($t(t),e),De=typeof document<"u"?document:{};T(e=>e.nodeType===no);typeof DOMParser<"u"&&new DOMParser;T(e=>e.nodeType===Qi);T(e=>e.nodeType===to);const Pi=e=>wr(e,(t,n)=>`${n}:${t};`).join(""),Qi=De.ELEMENT_NODE,to=De.TEXT_NODE,eo=De.DOCUMENT_NODE,no=De.DOCUMENT_FRAGMENT_NODE;T(e=>e.nodeType===eo);const Z=Symbol,As=Z(),Is=Z(),so=Z(),ro=Z(),io=Z(),Ts=Z(),oo=Z(),un=Z(),lo=Z(),co=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let s=0;for(;s<e.length;s++){const r=e[s];if(r===void 0)break;if(r.constructor===String||r.constructor===Number)t.push(r);else if(r.constructor===Object)break}for(s>0&&n.push(t.join(""));s<e.length;s++){const r=e[s];r instanceof Symbol||n.push(r)}return n},ho={[As]:K("font-weight","bold"),[Is]:K("font-weight","normal"),[so]:K("color","blue"),[io]:K("color","green"),[ro]:K("color","grey"),[Ts]:K("color","red"),[oo]:K("color","purple"),[un]:K("color","orange"),[lo]:K("color","black")},ao=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],s=U();let r=[],i=0;for(;i<e.length;i++){const o=e[i],l=ho[o];if(l!==void 0)s.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const c=Pi(s);i>0||c.length>0?(t.push("%c"+o),n.push(c)):t.push(o)}else break}}for(i>0&&(r=n,r.unshift(t.join("")));i<e.length;i++){const o=e[i];o instanceof Symbol||r.push(o)}return r},Os=ki?ao:co,uo=(...e)=>{console.log(...Os(e)),Ls.forEach(t=>t.print(e))},xs=(...e)=>{console.warn(...Os(e)),e.unshift(un),Ls.forEach(t=>t.print(e))},Ls=nt(),Us=e=>({[Symbol.iterator](){return this},next:e}),fo=(e,t)=>Us(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),$e=(e,t)=>Us(()=>{const{done:n,value:s}=e.next();return{done:n,value:n?void 0:t(s)}});class Ae{constructor(t,n){this.clock=t,this.len=n}}class Tt{constructor(){this.clients=new Map}}const St=(e,t,n)=>t.clients.forEach((s,r)=>{const i=e.doc.store.clients.get(r);if(i!=null){const o=i[i.length-1],l=o.id.clock+o.length;for(let c=0,a=s[c];c<s.length&&a.clock<l;a=s[++c])Ks(e,i,a.clock,a.len,n)}}),go=(e,t)=>{let n=0,s=e.length-1;for(;n<=s;){const r=j((n+s)/2),i=e[r],o=i.clock;if(o<=t){if(t<o+i.len)return r;n=r+1}else s=r-1}return null},Ht=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&go(n,t.clock)!==null},dn=e=>{e.clients.forEach(t=>{t.sort((r,i)=>r.clock-i.clock);let n,s;for(n=1,s=1;n<t.length;n++){const r=t[s-1],i=t[n];r.clock+r.len>=i.clock?t[s-1]=new Ae(r.clock,ot(r.len,i.clock+i.len-r.clock)):(s<n&&(t[s]=i),s++)}t.length=s})},Ye=e=>{const t=new Tt;for(let n=0;n<e.length;n++)e[n].clients.forEach((s,r)=>{if(!t.clients.has(r)){const i=s.slice();for(let o=n+1;o<e.length;o++)mr(i,e[o].clients.get(r)||[]);t.clients.set(r,i)}});return dn(t),t},Vt=(e,t,n,s)=>{q(e.clients,t,()=>[]).push(new Ae(n,s))},po=()=>new Tt,Rs=e=>{const t=po();return e.clients.forEach((n,s)=>{const r=[];for(let i=0;i<n.length;i++){const o=n[i];if(o.deleted){const l=o.id.clock;let c=o.length;if(i+1<n.length)for(let a=n[i+1];i+1<n.length&&a.deleted;a=n[++i+1])c+=a.length;r.push(new Ae(l,c))}}r.length>0&&t.clients.set(s,r)}),t},Ot=(e,t)=>{m(e.restEncoder,t.clients.size),W(t.clients.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{e.resetDsCurVal(),m(e.restEncoder,n);const r=s.length;m(e.restEncoder,r);for(let i=0;i<r;i++){const o=s[i];e.writeDsClock(o.clock),e.writeDsLen(o.len)}})},fn=e=>{const t=new Tt,n=k(e.restDecoder);for(let s=0;s<n;s++){e.resetDsCurVal();const r=k(e.restDecoder),i=k(e.restDecoder);if(i>0){const o=q(t.clients,r,()=>[]);for(let l=0;l<i;l++)o.push(new Ae(e.readDsClock(),e.readDsLen()))}}return t},Vn=(e,t,n)=>{const s=new Tt,r=k(e.restDecoder);for(let i=0;i<r;i++){e.resetDsCurVal();const o=k(e.restDecoder),l=k(e.restDecoder),c=n.clients.get(o)||[],a=C(n,o);for(let h=0;h<l;h++){const u=e.readDsClock(),d=u+e.readDsLen();if(u<a){a<d&&Vt(s,o,a,d-a);let f=z(c,u),g=c[f];for(!g.deleted&&g.id.clock<u&&(c.splice(f+1,0,we(t,g,u-g.id.clock)),f++);f<c.length&&(g=c[f++],g.id.clock<d);)g.deleted||(d<g.id.clock+g.length&&c.splice(f,0,we(t,g,d-g.id.clock)),g.delete(t))}else Vt(s,o,u,d-u)}}if(s.clients.size>0){const i=new st;return m(i.restEncoder,0),Ot(i,s),i.toUint8Array()}return null},Ns=rs;class xt extends Pn{constructor({guid:t=Qr(),collectionid:n=null,gc:s=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=s,this.gcFilter=r,this.clientID=Ns(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Hs,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Nn(a=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});const c=()=>Nn(a=>{const h=u=>{(u===void 0||u===!0)&&(this.off("sync",h),a())};this.on("sync",h)});this.on("sync",a=>{a===!1&&this.isSynced&&(this.whenSynced=c()),this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=c()}load(){const t=this._item;t!==null&&!this.shouldLoad&&y(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(W(this.subdocs).map(t=>t.guid))}transact(t,n=null){return y(this,t,n)}get(t,n=I){const s=q(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),r=s.constructor;if(n!==I&&r!==n)if(r===I){const i=new n;i._map=s._map,s._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=i}),i._start=s._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=s._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return s}getArray(t=""){return this.get(t,pt)}getText(t=""){return this.get(t,Et)}getMap(t=""){return this.get(t,Ct)}getXmlElement(t=""){return this.get(t,Dt)}getXmlFragment(t=""){return this.get(t,rt)}toJSON(){const t={};return this.share.forEach((n,s)=>{t[s]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,W(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new xt({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,y(t.parent.doc,s=>{const r=n.doc;t.deleted||s.subdocsAdded.add(r),s.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ms{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return k(this.restDecoder)}readDsLen(){return k(this.restDecoder)}}class vs extends Ms{readLeftID(){return p(k(this.restDecoder),k(this.restDecoder))}readRightID(){return p(k(this.restDecoder),k(this.restDecoder))}readClient(){return k(this.restDecoder)}readInfo(){return mt(this.restDecoder)}readString(){return ut(this.restDecoder)}readParentInfo(){return k(this.restDecoder)===1}readTypeRef(){return k(this.restDecoder)}readLen(){return k(this.restDecoder)}readAny(){return Mt(this.restDecoder)}readBuf(){return Si(N(this.restDecoder))}readJSON(){return JSON.parse(ut(this.restDecoder))}readKey(){return ut(this.restDecoder)}}class wo{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=k(this.restDecoder),this.dsCurrVal}readDsLen(){const t=k(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class bt extends wo{constructor(t){super(t),this.keys=[],k(t),this.keyClockDecoder=new Ne(N(t)),this.clientDecoder=new ee(N(t)),this.leftClockDecoder=new Ne(N(t)),this.rightClockDecoder=new Ne(N(t)),this.infoDecoder=new Rn(N(t),mt),this.stringDecoder=new Wr(N(t)),this.parentInfoDecoder=new Rn(N(t),mt),this.typeRefDecoder=new ee(N(t)),this.lenDecoder=new ee(N(t))}readLeftID(){return new ft(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ft(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Mt(this.restDecoder)}readBuf(){return N(this.restDecoder)}readJSON(){return Mt(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class $s{constructor(){this.restEncoder=Gt()}toUint8Array(){return F(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){m(this.restEncoder,t)}writeDsLen(t){m(this.restEncoder,t)}}class Yt extends $s{writeLeftID(t){m(this.restEncoder,t.client),m(this.restEncoder,t.clock)}writeRightID(t){m(this.restEncoder,t.client),m(this.restEncoder,t.clock)}writeClient(t){m(this.restEncoder,t)}writeInfo(t){Je(this.restEncoder,t)}writeString(t){at(this.restEncoder,t)}writeParentInfo(t){m(this.restEncoder,t?1:0)}writeTypeRef(t){m(this.restEncoder,t)}writeLen(t){m(this.restEncoder,t)}writeAny(t){kt(this.restEncoder,t)}writeBuf(t){R(this.restEncoder,t)}writeJSON(t){at(this.restEncoder,JSON.stringify(t))}writeKey(t){at(this.restEncoder,t)}}class Vs{constructor(){this.restEncoder=Gt(),this.dsCurrVal=0}toUint8Array(){return F(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,m(this.restEncoder,n)}writeDsLen(t){t===0&&v(),m(this.restEncoder,t-1),this.dsCurrVal+=t}}class st extends Vs{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Re,this.clientEncoder=new te,this.leftClockEncoder=new Re,this.rightClockEncoder=new Re,this.infoEncoder=new xn(Je),this.stringEncoder=new Br,this.parentInfoEncoder=new xn(Je),this.typeRefEncoder=new te,this.lenEncoder=new te}toUint8Array(){const t=Gt();return m(t,0),R(t,this.keyClockEncoder.toUint8Array()),R(t,this.clientEncoder.toUint8Array()),R(t,this.leftClockEncoder.toUint8Array()),R(t,this.rightClockEncoder.toUint8Array()),R(t,F(this.infoEncoder)),R(t,this.stringEncoder.toUint8Array()),R(t,F(this.parentInfoEncoder)),R(t,this.typeRefEncoder.toUint8Array()),R(t,this.lenEncoder.toUint8Array()),me(t,F(this.restEncoder)),F(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){kt(this.restEncoder,t)}writeBuf(t){R(this.restEncoder,t)}writeJSON(t){kt(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(n)}}const ko=(e,t,n,s)=>{s=ot(s,t[0].id.clock);const r=z(t,s);m(e.restEncoder,t.length-r),e.writeClient(n),m(e.restEncoder,s);const i=t[r];i.write(e,s-i.id.clock);for(let o=r+1;o<t.length;o++)t[o].write(e,0)},gn=(e,t,n)=>{const s=new Map;n.forEach((r,i)=>{C(t,i)>r&&s.set(i,r)}),Kt(t).forEach((r,i)=>{n.has(i)||s.set(i,0)}),m(e.restEncoder,s.size),W(s.entries()).sort((r,i)=>i[0]-r[0]).forEach(([r,i])=>{ko(e,t.clients.get(r),r,i)})},mo=(e,t)=>{const n=U(),s=k(e.restDecoder);for(let r=0;r<s;r++){const i=k(e.restDecoder),o=new Array(i),l=e.readClient();let c=k(e.restDecoder);n.set(l,{i:0,refs:o});for(let a=0;a<i;a++){const h=e.readInfo();switch(ke&h){case 0:{const u=e.readLen();o[a]=new $(p(l,c),u),c+=u;break}case 10:{const u=k(e.restDecoder);o[a]=new V(p(l,c),u),c+=u;break}default:{const u=(h&(X|M))===0,d=new _(p(l,c),null,(h&M)===M?e.readLeftID():null,null,(h&X)===X?e.readRightID():null,u?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,u&&(h&Rt)===Rt?e.readString():null,fr(e,h));o[a]=d,c+=d.length}}}}return n},yo=(e,t,n)=>{const s=[];let r=W(n.keys()).sort((f,g)=>f-g);if(r.length===0)return null;const i=()=>{if(r.length===0)return null;let f=n.get(r[r.length-1]);for(;f.refs.length===f.i;)if(r.pop(),r.length>0)f=n.get(r[r.length-1]);else return null;return f};let o=i();if(o===null)return null;const l=new Hs,c=new Map,a=(f,g)=>{const w=c.get(f);(w==null||w>g)&&c.set(f,g)};let h=o.refs[o.i++];const u=new Map,d=()=>{for(const f of s){const g=f.id.client,w=n.get(g);w?(w.i--,l.clients.set(g,w.refs.slice(w.i)),n.delete(g),w.i=0,w.refs=[]):l.clients.set(g,[f]),r=r.filter(S=>S!==g)}s.length=0};for(;;){if(h.constructor!==V){const g=q(u,h.id.client,()=>C(t,h.id.client))-h.id.clock;if(g<0)s.push(h),a(h.id.client,h.id.clock-1),d();else{const w=h.getMissing(e,t);if(w!==null){s.push(h);const S=n.get(w)||{refs:[],i:0};if(S.refs.length===S.i)a(w,C(t,w)),d();else{h=S.refs[S.i++];continue}}else(g===0||g<h.length)&&(h.integrate(e,g),u.set(h.id.client,h.id.clock+h.length))}}if(s.length>0)h=s.pop();else if(o!==null&&o.i<o.refs.length)h=o.refs[o.i++];else{if(o=i(),o===null)break;h=o.refs[o.i++]}}if(l.clients.size>0){const f=new st;return gn(f,l,new Map),m(f.restEncoder,0),{missing:c,update:f.toUint8Array()}}return null},_o=(e,t)=>gn(e,t.doc.store,t.beforeState),So=(e,t,n,s=new bt(e))=>y(t,r=>{r.local=!1;let i=!1;const o=r.doc,l=o.store,c=mo(s,o),a=yo(r,l,c),h=l.pendingStructs;if(h){for(const[d,f]of h.missing)if(f<C(l,d)){i=!0;break}if(a){for(const[d,f]of a.missing){const g=h.missing.get(d);(g==null||g>f)&&h.missing.set(d,f)}h.update=ae([h.update,a.update])}}else l.pendingStructs=a;const u=Vn(s,r,l);if(l.pendingDs){const d=new bt(At(l.pendingDs));k(d.restDecoder);const f=Vn(d,r,l);u&&f?l.pendingDs=ae([u,f]):l.pendingDs=u||f}else l.pendingDs=u;if(i){const d=l.pendingStructs.update;l.pendingStructs=null,Fs(r.doc,d)}},n,!1),Fs=(e,t,n,s=bt)=>{const r=At(t);So(r,e,n,new s(r))},Vl=(e,t,n)=>Fs(e,t,n,vs),bo=(e,t,n=new Map)=>{gn(e,t.store,n),Ot(e,Rs(t.store))},Co=(e,t=new Uint8Array([0]),n=new st)=>{const s=Bs(t);bo(n,e,s);const r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(Jo(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===Yt)return Bo(r.map((i,o)=>o===0?i:zo(i)));if(n.constructor===st)return ae(r)}return r[0]},Fl=(e,t)=>Co(e,t,new Yt),Eo=e=>{const t=new Map,n=k(e.restDecoder);for(let s=0;s<n;s++){const r=k(e.restDecoder),i=k(e.restDecoder);t.set(r,i)}return t},Bs=e=>Eo(new Ms(At(e))),js=(e,t)=>(m(e.restEncoder,t.size),W(t.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{m(e.restEncoder,n),m(e.restEncoder,s)}),e),Do=(e,t)=>js(e,Kt(t.store)),Ao=(e,t=new Vs)=>(e instanceof Map?js(t,e):Do(t,e),t.toUint8Array()),Bl=e=>Ao(e,new $s);class Io{constructor(){this.l=[]}}const Fn=()=>new Io,Bn=(e,t)=>e.l.push(t),jn=(e,t)=>{const n=e.l,s=n.length;e.l=n.filter(r=>t!==r),s===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Js=(e,t,n)=>rn(e.l,[t,n]);class ft{constructor(t,n){this.client=t,this.clock=n}}const ht=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,p=(e,t)=>new ft(e,t),Gs=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw v()},he=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};class zs{constructor(t,n,s,r=0){this.type=t,this.tname=n,this.item=s,this.assoc=r}}const jl=e=>new zs(e.type==null?null:p(e.type.client,e.type.clock),e.tname??null,e.item==null?null:p(e.item.client,e.item.clock),e.assoc==null?0:e.assoc);class To{constructor(t,n,s=0){this.type=t,this.index=n,this.assoc=s}}const Oo=(e,t,n=0)=>new To(e,t,n),qt=(e,t,n)=>{let s=null,r=null;return e._item===null?r=Gs(e):s=p(e._item.id.client,e._item.id.clock),new zs(s,r,t,n)},Jl=(e,t,n=0)=>{let s=e._start;if(n<0){if(t===0)return qt(e,null,n);t--}for(;s!==null;){if(!s.deleted&&s.countable){if(s.length>t)return qt(e,p(s.id.client,s.id.clock+t),n);t-=s.length}if(s.right===null&&n<0)return qt(e,s.lastId,n);s=s.right}return qt(e,null,n)},xo=(e,t)=>{const n=gt(e,t),s=t.clock-n.id.clock;return{item:n,diff:s}},Gl=(e,t,n=!0)=>{const s=t.store,r=e.item,i=e.type,o=e.tname,l=e.assoc;let c=null,a=0;if(r!==null){if(C(s,r.client)<=r.clock)return null;const h=n?qe(s,r):xo(s,r),u=h.item;if(!(u instanceof _))return null;if(c=u.parent,c._item===null||!c._item.deleted){a=u.deleted||!u.countable?0:h.diff+(l>=0?0:1);let d=u.left;for(;d!==null;)!d.deleted&&d.countable&&(a+=d.length),d=d.left}}else{if(o!==null)c=t.get(o);else if(i!==null){if(C(s,i.client)<=i.clock)return null;const{item:h}=n?qe(s,i):{item:gt(s,i)};if(h instanceof _&&h.content instanceof Y)c=h.content.type;else return null}else throw v();l>=0?a=c._length:a=0}return Oo(c,a,e.assoc)},zl=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&ht(e.item,t.item)&&ht(e.type,t.type)&&e.assoc===t.assoc;class Lo{constructor(t,n){this.ds=t,this.sv=n}}const Uo=(e,t)=>new Lo(e,t),Hl=e=>Uo(Rs(e.store),Kt(e.store)),tt=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ht(t.ds,e.id),Ke=(e,t)=>{const n=q(e.meta,Ke,nt),s=e.doc.store;n.has(t)||(t.sv.forEach((r,i)=>{r<C(s,i)&&L(e,p(i,r))}),St(e,t.ds,r=>{}),n.add(t))};class Hs{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Kt=e=>{const t=new Map;return e.clients.forEach((n,s)=>{const r=n[n.length-1];t.set(s,r.id.clock+r.length)}),t},C=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const s=n[n.length-1];return s.id.clock+s.length},Ys=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const s=n[n.length-1];if(s.id.clock+s.length!==t.id.clock)throw v()}n.push(t)},z=(e,t)=>{let n=0,s=e.length-1,r=e[s],i=r.id.clock;if(i===t)return s;let o=j(t/(i+r.length-1)*s);for(;n<=s;){if(r=e[o],i=r.id.clock,i<=t){if(t<i+r.length)return o;n=o+1}else s=o-1;o=j((n+s)/2)}throw v()},Ro=(e,t)=>{const n=e.clients.get(t.client);return n[z(n,t.clock)]},gt=Ro,Xe=(e,t,n)=>{const s=z(t,n),r=t[s];return r.id.clock<n&&r instanceof _?(t.splice(s+1,0,we(e,r,n-r.id.clock)),s+1):s},L=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[Xe(e,n,t.clock)]},Jn=(e,t,n)=>{const s=t.clients.get(n.client),r=z(s,n.clock),i=s[r];return n.clock!==i.id.clock+i.length-1&&i.constructor!==$&&s.splice(r+1,0,we(e,i,n.clock-i.id.clock+1)),i},No=(e,t,n)=>{const s=e.clients.get(t.id.client);s[z(s,t.id.clock)]=n},Ks=(e,t,n,s,r)=>{if(s===0)return;const i=n+s;let o=Xe(e,t,n),l;do l=t[o++],i<l.id.clock+l.length&&Xe(e,t,i),r(l);while(o<t.length&&t[o].id.clock<i)};class Mo{constructor(t,n,s){this.doc=t,this.deleteSet=new Tt,this.beforeState=Kt(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=s,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Gn=(e,t)=>t.deleteSet.clients.size===0&&!kr(t.afterState,(n,s)=>t.beforeState.get(s)!==n)?!1:(dn(t.deleteSet),_o(e,t),Ot(e,t.deleteSet),!0),zn=(e,t,n)=>{const s=t._item;(s===null||s.id.clock<(e.beforeState.get(s.id.client)||0)&&!s.deleted)&&q(e.changed,t,nt).add(n)},se=(e,t)=>{let n=e[t],s=e[t-1],r=t;for(;r>0;n=s,s=e[--r-1]){if(s.deleted===n.deleted&&s.constructor===n.constructor&&s.mergeWith(n)){n instanceof _&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,s);continue}break}const i=t-r;return i&&e.splice(t+1-i,i),i},vo=(e,t,n)=>{for(const[s,r]of e.clients.entries()){const i=t.clients.get(s);for(let o=r.length-1;o>=0;o--){const l=r[o],c=l.clock+l.len;for(let a=z(i,l.clock),h=i[a];a<i.length&&h.id.clock<c;h=i[++a]){const u=i[a];if(l.clock+l.len<=u.id.clock)break;u instanceof _&&u.deleted&&!u.keep&&n(u)&&u.gc(t,!1)}}}},$o=(e,t)=>{e.clients.forEach((n,s)=>{const r=t.clients.get(s);for(let i=n.length-1;i>=0;i--){const o=n[i],l=Qn(r.length-1,1+z(r,o.clock+o.len-1));for(let c=l,a=r[c];c>0&&a.id.clock>=o.clock;a=r[c])c-=1+se(r,c)}})},Xs=(e,t)=>{if(t<e.length){const n=e[t],s=n.doc,r=s.store,i=n.deleteSet,o=n._mergeStructs;try{dn(i),n.afterState=Kt(n.doc.store),s.emit("beforeObserverCalls",[n,s]);const l=[];n.changed.forEach((c,a)=>l.push(()=>{(a._item===null||!a._item.deleted)&&a._callObserver(n,c)})),l.push(()=>{n.changedParentTypes.forEach((c,a)=>{a._dEH.l.length>0&&(a._item===null||!a._item.deleted)&&(c=c.filter(h=>h.target._item===null||!h.target._item.deleted),c.forEach(h=>{h.currentTarget=a,h._path=null}),c.sort((h,u)=>h.path.length-u.path.length),l.push(()=>{Js(a._dEH,c,n)}))}),l.push(()=>s.emit("afterTransaction",[n,s])),l.push(()=>{n._needFormattingCleanup&&rl(n)})}),rn(l,[])}finally{s.gc&&vo(i,r,s.gcFilter),$o(i,r),n.afterState.forEach((h,u)=>{const d=n.beforeState.get(u)||0;if(d!==h){const f=r.clients.get(u),g=ot(z(f,d),1);for(let w=f.length-1;w>=g;)w-=1+se(f,w)}});for(let h=o.length-1;h>=0;h--){const{client:u,clock:d}=o[h].id,f=r.clients.get(u),g=z(f,d);g+1<f.length&&se(f,g+1)>1||g>0&&se(f,g)}if(!n.local&&n.afterState.get(s.clientID)!==n.beforeState.get(s.clientID)&&(uo(un,As,"[yjs] ",Is,Ts,"Changed the client-id because another client seems to be using it."),s.clientID=Ns()),s.emit("afterTransactionCleanup",[n,s]),s._observers.has("update")){const h=new Yt;Gn(h,n)&&s.emit("update",[h.toUint8Array(),n.origin,s,n])}if(s._observers.has("updateV2")){const h=new st;Gn(h,n)&&s.emit("updateV2",[h.toUint8Array(),n.origin,s,n])}const{subdocsAdded:l,subdocsLoaded:c,subdocsRemoved:a}=n;(l.size>0||a.size>0||c.size>0)&&(l.forEach(h=>{h.clientID=s.clientID,h.collectionid==null&&(h.collectionid=s.collectionid),s.subdocs.add(h)}),a.forEach(h=>s.subdocs.delete(h)),s.emit("subdocs",[{loaded:c,added:l,removed:a},s,n]),a.forEach(h=>h.destroy())),e.length<=t+1?(s._transactionCleanups=[],s.emit("afterAllTransactions",[s,e])):Xs(e,t+1)}}},y=(e,t,n=null,s=!0)=>{const r=e._transactionCleanups;let i=!1,o=null;e._transaction===null&&(i=!0,e._transaction=new Mo(e,n,s),r.push(e._transaction),r.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{o=t(e._transaction)}finally{if(i){const l=e._transaction===r[0];e._transaction=null,l&&Xs(r,0)}}return o};class Vo{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const Hn=(e,t,n)=>{St(e,n.deletions,s=>{s instanceof _&&t.scope.some(r=>r===e.doc||he(r,s))&&bn(s,!1)})},Yn=(e,t,n)=>{let s=null;const r=e.doc,i=e.scope;y(r,l=>{for(;t.length>0&&e.currStackItem===null;){const c=r.store,a=t.pop(),h=new Set,u=[];let d=!1;St(l,a.insertions,f=>{if(f instanceof _){if(f.redone!==null){let{item:g,diff:w}=qe(c,f.id);w>0&&(g=L(l,p(g.id.client,g.id.clock+w))),f=g}!f.deleted&&i.some(g=>g===l.doc||he(g,f))&&u.push(f)}}),St(l,a.deletions,f=>{f instanceof _&&i.some(g=>g===l.doc||he(g,f))&&!Ht(a.insertions,f.id)&&h.add(f)}),h.forEach(f=>{d=dr(l,f,h,a.insertions,e.ignoreRemoteMapChanges,e)!==null||d});for(let f=u.length-1;f>=0;f--){const g=u[f];e.deleteFilter(g)&&(g.delete(l),d=!0)}e.currStackItem=d?a:null}l.changed.forEach((c,a)=>{c.has(null)&&a._searchMarker&&(a._searchMarker.length=0)}),s=l},e);const o=e.currStackItem;if(o!=null){const l=s.changedParentTypes;e.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:l,origin:e},e]),e.currStackItem=null}return o};class Yl extends Pn{constructor(t,{captureTimeout:n=500,captureTransaction:s=c=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=wt(t)?t[0].doc:t instanceof xt?t:t.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(t),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=s,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=c=>{if(!this.captureTransaction(c)||!this.scope.some(S=>c.changedParentTypes.has(S)||S===this.doc)||!this.trackedOrigins.has(c.origin)&&(!c.origin||!this.trackedOrigins.has(c.origin.constructor)))return;const a=this.undoing,h=this.redoing,u=a?this.redoStack:this.undoStack;a?this.stopCapturing():h||this.clear(!1,!0);const d=new Tt;c.afterState.forEach((S,b)=>{const Cn=c.beforeState.get(b)||0,En=S-Cn;En>0&&Vt(d,b,Cn,En)});const f=ti();let g=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&u.length>0&&!a&&!h){const S=u[u.length-1];S.deletions=Ye([S.deletions,c.deleteSet]),S.insertions=Ye([S.insertions,d])}else u.push(new Vo(c.deleteSet,d)),g=!0;!a&&!h&&(this.lastChange=f),St(c,c.deleteSet,S=>{S instanceof _&&this.scope.some(b=>b===c.doc||he(b,S))&&bn(S,!0)});const w=[{stackItem:u[u.length-1],origin:c.origin,type:a?"redo":"undo",changedParentTypes:c.changedParentTypes},this];g?this.emit("stack-item-added",w):this.emit("stack-item-updated",w)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=wt(t)?t:[t],t.forEach(s=>{n.has(s)||(n.add(s),(s instanceof I?s.doc!==this.doc:s!==this.doc)&&xs("[yjs#509] Not same Y.Doc"),this.scope.push(s))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){(t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(s=>{t&&(this.undoStack.forEach(r=>Hn(s,this,r)),this.undoStack=[]),n&&(this.redoStack.forEach(r=>Hn(s,this,r)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Yn(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Yn(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Fo(e){const t=k(e.restDecoder);for(let n=0;n<t;n++){const s=k(e.restDecoder),r=e.readClient();let i=k(e.restDecoder);for(let o=0;o<s;o++){const l=e.readInfo();if(l===10){const c=k(e.restDecoder);yield new V(p(r,i),c),i+=c}else if((ke&l)!==0){const c=(l&(X|M))===0,a=new _(p(r,i),null,(l&M)===M?e.readLeftID():null,null,(l&X)===X?e.readRightID():null,c?e.readParentInfo()?e.readString():e.readLeftID():null,c&&(l&Rt)===Rt?e.readString():null,fr(e,l));yield a,i+=a.length}else{const c=e.readLen();yield new $(p(r,i),c),i+=c}}}}class pn{constructor(t,n){this.gen=Fo(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===V);return this.curr}}class wn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const Bo=e=>ae(e,vs,Yt),jo=(e,t)=>{if(e.constructor===$){const{client:n,clock:s}=e.id;return new $(p(n,s+t),e.length-t)}else if(e.constructor===V){const{client:n,clock:s}=e.id;return new V(p(n,s+t),e.length-t)}else{const n=e,{client:s,clock:r}=n.id;return new _(p(s,r+t),null,p(s,r+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},ae=(e,t=bt,n=st)=>{if(e.length===1)return e[0];const s=e.map(h=>new t(At(h)));let r=s.map(h=>new pn(h,!0)),i=null;const o=new n,l=new wn(o);for(;r=r.filter(d=>d.curr!==null),r.sort((d,f)=>{if(d.curr.id.client===f.curr.id.client){const g=d.curr.id.clock-f.curr.id.clock;return g===0?d.curr.constructor===f.curr.constructor?0:d.curr.constructor===V?1:-1:g}else return f.curr.id.client-d.curr.id.client}),r.length!==0;){const h=r[0],u=h.curr.id.client;if(i!==null){let d=h.curr,f=!1;for(;d!==null&&d.id.clock+d.length<=i.struct.id.clock+i.struct.length&&d.id.client>=i.struct.id.client;)d=h.next(),f=!0;if(d===null||d.id.client!==u||f&&d.id.clock>i.struct.id.clock+i.struct.length)continue;if(u!==i.struct.id.client)P(l,i.struct,i.offset),i={struct:d,offset:0},h.next();else if(i.struct.id.clock+i.struct.length<d.id.clock)if(i.struct.constructor===V)i.struct.length=d.id.clock+d.length-i.struct.id.clock;else{P(l,i.struct,i.offset);const g=d.id.clock-i.struct.id.clock-i.struct.length;i={struct:new V(p(u,i.struct.id.clock+i.struct.length),g),offset:0}}else{const g=i.struct.id.clock+i.struct.length-d.id.clock;g>0&&(i.struct.constructor===V?i.struct.length-=g:d=jo(d,g)),i.struct.mergeWith(d)||(P(l,i.struct,i.offset),i={struct:d,offset:0},h.next())}}else i={struct:h.curr,offset:0},h.next();for(let d=h.curr;d!==null&&d.id.client===u&&d.id.clock===i.struct.id.clock+i.struct.length&&d.constructor!==V;d=h.next())P(l,i.struct,i.offset),i={struct:d,offset:0}}i!==null&&(P(l,i.struct,i.offset),i=null),kn(l);const c=s.map(h=>fn(h)),a=Ye(c);return Ot(o,a),o.toUint8Array()},Jo=(e,t,n=bt,s=st)=>{const r=Bs(t),i=new s,o=new wn(i),l=new n(At(e)),c=new pn(l,!1);for(;c.curr;){const h=c.curr,u=h.id.client,d=r.get(u)||0;if(c.curr.constructor===V){c.next();continue}if(h.id.clock+h.length>d)for(P(o,h,ot(d-h.id.clock,0)),c.next();c.curr&&c.curr.id.client===u;)P(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===u&&c.curr.id.clock+c.curr.length<=d;)c.next()}kn(o);const a=fn(l);return Ot(i,a),i.toUint8Array()},Ws=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:F(e.encoder.restEncoder)}),e.encoder.restEncoder=Gt(),e.written=0)},P=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Ws(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),m(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},kn=e=>{Ws(e);const t=e.encoder.restEncoder;m(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const s=e.clientStructs[n];m(t,s.written),me(t,s.restEncoder)}},Go=(e,t,n,s)=>{const r=new n(At(e)),i=new pn(r,!1),o=new s,l=new wn(o);for(let a=i.curr;a!==null;a=i.next())P(l,t(a),0);kn(l);const c=fn(r);return Ot(o,c),o.toUint8Array()},zo=e=>Go(e,ui,bt,Yt),Kn="You must not compute changes after the event-handler fired.";class Ie{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Ho(this.currentTarget,this.target))}deletes(t){return Ht(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw G(Kn);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const i=n._map.get(r);let o,l;if(this.adds(i)){let c=i.left;for(;c!==null&&this.adds(c);)c=c.left;if(this.deletes(i))if(c!==null&&this.deletes(c))o="delete",l=xe(c.content.getContent());else return;else c!==null&&this.deletes(c)?(o="update",l=xe(c.content.getContent())):(o="add",l=void 0)}else if(this.deletes(i))o="delete",l=xe(i.content.getContent());else return;t.set(r,{action:o,oldValue:l})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw G(Kn);const n=this.target,s=nt(),r=nt(),i=[];if(t={added:s,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null;const c=()=>{l&&i.push(l)};for(let a=n._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((l===null||l.delete===void 0)&&(c(),l={delete:0}),l.delete+=a.length,r.add(a)):this.adds(a)?((l===null||l.insert===void 0)&&(c(),l={insert:[]}),l.insert=l.insert.concat(a.content.getContent()),s.add(a)):((l===null||l.retain===void 0)&&(c(),l={retain:0}),l.retain+=a.length);l!==null&&l.retain===void 0&&c()}this._changes=t}return t}}const Ho=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let s=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(s+=r.length),r=r.right;n.unshift(s)}t=t._item.parent}return n},O=()=>{xs("Invalid access: Add Yjs type to a document before reading data.")},qs=80;let mn=0;class Yo{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=mn++}}const Ko=e=>{e.timestamp=mn++},Zs=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=mn++},Xo=(e,t,n)=>{if(e.length>=qs){const s=e.reduce((r,i)=>r.timestamp<i.timestamp?r:i);return Zs(s,t,n),s}else{const s=new Yo(t,n);return e.push(s),s}},Te=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,o)=>Qt(t-i.index)<Qt(t-o.index)?i:o);let s=e._start,r=0;for(n!==null&&(s=n.p,r=n.index,Ko(n));s.right!==null&&r<t;){if(!s.deleted&&s.countable){if(t<r+s.length)break;r+=s.length}s=s.right}for(;s.left!==null&&r>t;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);for(;s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);return n!==null&&Qt(n.index-r)<s.parent.length/qs?(Zs(n,s,r),n):Xo(e._searchMarker,s,r)},Ft=(e,t,n)=>{for(let s=e.length-1;s>=0;s--){const r=e[s];if(n>0){let i=r.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(r.index-=i.length);if(i===null||i.marker===!0){e.splice(s,1);continue}r.p=i,i.marker=!0}(t<r.index||n>0&&t===r.index)&&(r.index=ot(t,r.index+n))}},Oe=(e,t,n)=>{const s=e,r=t.changedParentTypes;for(;q(r,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Js(s._eH,n,t)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Fn(),this._dEH=Fn(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw B()}clone(){throw B()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){Bn(this._eH,t)}observeDeep(t){Bn(this._dEH,t)}unobserve(t){jn(this._eH,t)}unobserveDeep(t){jn(this._dEH,t)}toJSON(){}}const Ps=(e,t,n)=>{e.doc??O(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let s=n-t;const r=[];let i=e._start;for(;i!==null&&s>0;){if(i.countable&&!i.deleted){const o=i.content.getContent();if(o.length<=t)t-=o.length;else{for(let l=t;l<o.length&&s>0;l++)r.push(o[l]),s--;t=0}}i=i.right}return r},Qs=e=>{e.doc??O();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const s=n.content.getContent();for(let r=0;r<s.length;r++)t.push(s[r])}n=n.right}return t},Kl=(e,t)=>{const n=[];let s=e._start;for(;s!==null;){if(s.countable&&tt(s,t)){const r=s.content.getContent();for(let i=0;i<r.length;i++)n.push(r[i])}s=s.right}return n},Bt=(e,t)=>{let n=0,s=e._start;for(e.doc??O();s!==null;){if(s.countable&&!s.deleted){const r=s.content.getContent();for(let i=0;i<r.length;i++)t(r[i],n++,e)}s=s.right}},tr=(e,t)=>{const n=[];return Bt(e,(s,r)=>{n.push(t(s,r,e))}),n},Wo=e=>{let t=e._start,n=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),s=0,t=t.right}const r=n[s++];return n.length<=s&&(n=null),{done:!1,value:r}}}},er=(e,t)=>{e.doc??O();const n=Te(e,t);let s=e._start;for(n!==null&&(s=n.p,t-=n.index);s!==null;s=s.right)if(!s.deleted&&s.countable){if(t<s.length)return s.content.getContent()[t];t-=s.length}},ue=(e,t,n,s)=>{let r=n;const i=e.doc,o=i.clientID,l=i.store,c=n===null?t._start:n.right;let a=[];const h=()=>{a.length>0&&(r=new _(p(o,C(l,o)),r,r&&r.lastId,c,c&&c.id,t,null,new it(a)),r.integrate(e,0),a=[])};s.forEach(u=>{if(u===null)a.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(u);break;default:switch(h(),u.constructor){case Uint8Array:case ArrayBuffer:r=new _(p(o,C(l,o)),r,r&&r.lastId,c,c&&c.id,t,null,new Xt(new Uint8Array(u))),r.integrate(e,0);break;case xt:r=new _(p(o,C(l,o)),r,r&&r.lastId,c,c&&c.id,t,null,new Wt(u)),r.integrate(e,0);break;default:if(u instanceof I)r=new _(p(o,C(l,o)),r,r&&r.lastId,c,c&&c.id,t,null,new Y(u)),r.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},nr=()=>G("Length exceeded!"),sr=(e,t,n,s)=>{if(n>t._length)throw nr();if(n===0)return t._searchMarker&&Ft(t._searchMarker,n,s.length),ue(e,t,null,s);const r=n,i=Te(t,n);let o=t._start;for(i!==null&&(o=i.p,n-=i.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&L(e,p(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Ft(t._searchMarker,r,s.length),ue(e,t,o,s)},qo=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((i,o)=>o.index>i.index?o:i,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return ue(e,t,r,n)},rr=(e,t,n,s)=>{if(s===0)return;const r=n,i=s,o=Te(t,n);let l=t._start;for(o!==null&&(l=o.p,n-=o.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&L(e,p(l.id.client,l.id.clock+n)),n-=l.length);for(;s>0&&l!==null;)l.deleted||(s<l.length&&L(e,p(l.id.client,l.id.clock+s)),l.delete(e),s-=l.length),l=l.right;if(s>0)throw nr();t._searchMarker&&Ft(t._searchMarker,r,-i+s)},de=(e,t,n)=>{const s=t._map.get(n);s!==void 0&&s.delete(e)},yn=(e,t,n,s)=>{const r=t._map.get(n)||null,i=e.doc,o=i.clientID;let l;if(s==null)l=new it([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new it([s]);break;case Uint8Array:l=new Xt(s);break;case xt:l=new Wt(s);break;default:if(s instanceof I)l=new Y(s);else throw new Error("Unexpected content type")}new _(p(o,C(i.store,o)),r,r&&r.lastId,null,null,t,n,l).integrate(e,0)},_n=(e,t)=>{e.doc??O();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},ir=e=>{const t={};return e.doc??O(),e._map.forEach((n,s)=>{n.deleted||(t[s]=n.content.getContent()[n.length-1])}),t},or=(e,t)=>{e.doc??O();const n=e._map.get(t);return n!==void 0&&!n.deleted},Zo=(e,t)=>{const n={};return e._map.forEach((s,r)=>{let i=s;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&tt(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Zt=e=>(e.doc??O(),fo(e._map.entries(),t=>!t[1].deleted));class Po extends Ie{}class pt extends I{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new pt;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new pt}clone(){const t=new pt;return t.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),t}get length(){return this.doc??O(),this._length}_callObserver(t,n){super._callObserver(t,n),Oe(this,t,new Po(this,t))}insert(t,n){this.doc!==null?y(this.doc,s=>{sr(s,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?y(this.doc,n=>{qo(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?y(this.doc,s=>{rr(s,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return er(this,t)}toArray(){return Qs(this)}slice(t=0,n=this.length){return Ps(this,t,n)}toJSON(){return this.map(t=>t instanceof I?t.toJSON():t)}map(t){return tr(this,t)}forEach(t){Bt(this,t)}[Symbol.iterator](){return Wo(this)}_write(t){t.writeTypeRef(Cl)}}const Qo=e=>new pt;class tl extends Ie{constructor(t,n,s){super(t,n),this.keysChanged=s}}class Ct extends I{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((s,r)=>{this.set(r,s)}),this._prelimContent=null}_copy(){return new Ct}clone(){const t=new Ct;return this.forEach((n,s)=>{t.set(s,n instanceof I?n.clone():n)}),t}_callObserver(t,n){Oe(this,t,new tl(this,t,n))}toJSON(){this.doc??O();const t={};return this._map.forEach((n,s)=>{if(!n.deleted){const r=n.content.getContent()[n.length-1];t[s]=r instanceof I?r.toJSON():r}}),t}get size(){return[...Zt(this)].length}keys(){return $e(Zt(this),t=>t[0])}values(){return $e(Zt(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return $e(Zt(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??O(),this._map.forEach((n,s)=>{n.deleted||t(n.content.getContent()[n.length-1],s,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?y(this.doc,n=>{de(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return _n(this,t)}has(t){return or(this,t)}clear(){this.doc!==null?y(this.doc,t=>{this.forEach(function(n,s,r){de(t,r,s)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(El)}}const el=e=>new Ct,Q=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&hi(e,t);class We{constructor(t,n,s,r){this.left=t,this.right=n,this.index=s,this.currentAttributes=r}forward(){switch(this.right===null&&v(),this.right.content.constructor){case D:this.right.deleted||Lt(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Xn=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case D:t.right.deleted||Lt(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&L(e,p(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},Pt=(e,t,n,s)=>{const r=new Map,i=s?Te(t,n):null;if(i){const o=new We(i.p.left,i.p,i.index,r);return Xn(e,o,n-i.index)}else{const o=new We(null,t._start,0,r);return Xn(e,o,n)}},lr=(e,t,n,s)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===D&&Q(s.get(n.right.content.key),n.right.content.value));)n.right.deleted||s.delete(n.right.content.key),n.forward();const r=e.doc,i=r.clientID;s.forEach((o,l)=>{const c=n.left,a=n.right,h=new _(p(i,C(r.store,i)),c,c&&c.lastId,a,a&&a.id,t,null,new D(l,o));h.integrate(e,0),n.right=h,n.forward()})},Lt=(e,t)=>{const{key:n,value:s}=t;s===null?e.delete(n):e.set(n,s)},cr=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===D&&Q(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},hr=(e,t,n,s)=>{const r=e.doc,i=r.clientID,o=new Map;for(const l in s){const c=s[l],a=n.currentAttributes.get(l)??null;if(!Q(a,c)){o.set(l,a);const{left:h,right:u}=n;n.right=new _(p(i,C(r.store,i)),h,h&&h.lastId,u,u&&u.id,t,null,new D(l,c)),n.right.integrate(e,0),n.forward()}}return o},Ve=(e,t,n,s,r)=>{n.currentAttributes.forEach((d,f)=>{r[f]===void 0&&(r[f]=null)});const i=e.doc,o=i.clientID;cr(n,r);const l=hr(e,t,n,r),c=s.constructor===String?new H(s):s instanceof I?new Y(s):new lt(s);let{left:a,right:h,index:u}=n;t._searchMarker&&Ft(t._searchMarker,n.index,c.getLength()),h=new _(p(o,C(i.store,o)),a,a&&a.lastId,h,h&&h.id,t,null,c),h.integrate(e,0),n.right=h,n.index=u,n.forward(),lr(e,t,n,l)},Wn=(e,t,n,s,r)=>{const i=e.doc,o=i.clientID;cr(n,r);const l=hr(e,t,n,r);t:for(;n.right!==null&&(s>0||l.size>0&&(n.right.deleted||n.right.content.constructor===D));){if(!n.right.deleted)switch(n.right.content.constructor){case D:{const{key:c,value:a}=n.right.content,h=r[c];if(h!==void 0){if(Q(h,a))l.delete(c);else{if(s===0)break t;l.set(c,a)}n.right.delete(e)}else n.currentAttributes.set(c,a);break}default:s<n.right.length&&L(e,p(n.right.id.client,n.right.id.clock+s)),s-=n.right.length;break}n.forward()}if(s>0){let c="";for(;s>0;s--)c+=`
4
+ `;n.right=new _(p(o,C(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new H(c)),n.right.integrate(e,0),n.forward()}lr(e,t,n,l)},ar=(e,t,n,s,r)=>{let i=t;const o=U();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===D){const a=i.content;o.set(a.key,a)}i=i.right}let l=0,c=!1;for(;t!==i;){if(n===t&&(c=!0),!t.deleted){const a=t.content;switch(a.constructor){case D:{const{key:h,value:u}=a,d=s.get(h)??null;(o.get(h)!==a||d===u)&&(t.delete(e),l++,!c&&(r.get(h)??null)===u&&d!==u&&(d===null?r.delete(h):r.set(h,d))),!c&&!t.deleted&&Lt(r,a);break}}}t=t.right}return l},nl=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===D){const s=t.content.key;n.has(s)?t.delete(e):n.add(s)}t=t.left}},sl=e=>{let t=0;return y(e.doc,n=>{let s=e._start,r=e._start,i=U();const o=Be(i);for(;r;){if(r.deleted===!1)switch(r.content.constructor){case D:Lt(o,r.content);break;default:t+=ar(n,s,r,i,o),i=Be(o),s=r;break}r=r.right}}),t},rl=e=>{const t=new Set,n=e.doc;for(const[s,r]of e.afterState.entries()){const i=e.beforeState.get(s)||0;r!==i&&Ks(e,n.store.clients.get(s),i,r,o=>{!o.deleted&&o.content.constructor===D&&o.constructor!==$&&t.add(o.parent)})}y(n,s=>{St(e,e.deleteSet,r=>{if(r instanceof $||!r.parent._hasFormatting||t.has(r.parent))return;const i=r.parent;r.content.constructor===D?t.add(i):nl(s,r)});for(const r of t)sl(r)})},qn=(e,t,n)=>{const s=n,r=Be(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Y:case lt:case H:n<t.right.length&&L(e,p(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&ar(e,i,t.right,r,t.currentAttributes);const o=(t.left||t.right).parent;return o._searchMarker&&Ft(o._searchMarker,t.index,-s+n),t};class il extends Ie{constructor(t,n,s){super(t,n),this.childListChanged=!1,this.keysChanged=new Set,s.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){const t=this.target.doc,n=[];y(t,s=>{const r=new Map,i=new Map;let o=this.target._start,l=null;const c={};let a="",h=0,u=0;const d=()=>{if(l!==null){let f=null;switch(l){case"delete":u>0&&(f={delete:u}),u=0;break;case"insert":(typeof a=="object"||a.length>0)&&(f={insert:a},r.size>0&&(f.attributes={},r.forEach((g,w)=>{g!==null&&(f.attributes[w]=g)}))),a="";break;case"retain":h>0&&(f={retain:h},ci(c)||(f.attributes=ii({},c))),h=0;break}f&&n.push(f),l=null}};for(;o!==null;){switch(o.content.constructor){case Y:case lt:this.adds(o)?this.deletes(o)||(d(),l="insert",a=o.content.getContent()[0],d()):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),u+=1):o.deleted||(l!=="retain"&&(d(),l="retain"),h+=1);break;case H:this.adds(o)?this.deletes(o)||(l!=="insert"&&(d(),l="insert"),a+=o.content.str):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),u+=o.length):o.deleted||(l!=="retain"&&(d(),l="retain"),h+=o.length);break;case D:{const{key:f,value:g}=o.content;if(this.adds(o)){if(!this.deletes(o)){const w=r.get(f)??null;Q(w,g)?g!==null&&o.delete(s):(l==="retain"&&d(),Q(g,i.get(f)??null)?delete c[f]:c[f]=g)}}else if(this.deletes(o)){i.set(f,g);const w=r.get(f)??null;Q(w,g)||(l==="retain"&&d(),c[f]=w)}else if(!o.deleted){i.set(f,g);const w=c[f];w!==void 0&&(Q(w,g)?w!==null&&o.delete(s):(l==="retain"&&d(),g===null?delete c[f]:c[f]=g))}o.deleted||(l==="insert"&&d(),Lt(r,o.content));break}}o=o.right}for(d();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Et extends I{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??O(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(s=>s())}catch(s){console.error(s)}this._pending=null}_copy(){return new Et}clone(){const t=new Et;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const s=new il(this,t,n);Oe(this,t,s),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??O();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===H&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?y(this.doc,s=>{const r=new We(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const o=t[i];if(o.insert!==void 0){const l=!n&&typeof o.insert=="string"&&i===t.length-1&&r.right===null&&o.insert.slice(-1)===`
5
+ `?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Ve(s,this,r,l,o.attributes||{})}else o.retain!==void 0?Wn(s,this,r,o.retain,o.attributes||{}):o.delete!==void 0&&qn(s,r,o.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,s){this.doc??O();const r=[],i=new Map,o=this.doc;let l="",c=this._start;function a(){if(l.length>0){const u={};let d=!1;i.forEach((g,w)=>{d=!0,u[w]=g});const f={insert:l};d&&(f.attributes=u),r.push(f),l=""}}const h=()=>{for(;c!==null;){if(tt(c,t)||n!==void 0&&tt(c,n))switch(c.content.constructor){case H:{const u=i.get("ychange");t!==void 0&&!tt(c,t)?(u===void 0||u.user!==c.id.client||u.type!=="removed")&&(a(),i.set("ychange",s?s("removed",c.id):{type:"removed"})):n!==void 0&&!tt(c,n)?(u===void 0||u.user!==c.id.client||u.type!=="added")&&(a(),i.set("ychange",s?s("added",c.id):{type:"added"})):u!==void 0&&(a(),i.delete("ychange")),l+=c.content.str;break}case Y:case lt:{a();const u={insert:c.content.getContent()[0]};if(i.size>0){const d={};u.attributes=d,i.forEach((f,g)=>{d[g]=f})}r.push(u);break}case D:tt(c,t)&&(a(),Lt(i,c.content));break}c=c.right}a()};return t||n?y(o,u=>{t&&Ke(u,t),n&&Ke(u,n),h()},"cleanup"):h(),r}insert(t,n,s){if(n.length<=0)return;const r=this.doc;r!==null?y(r,i=>{const o=Pt(i,this,t,!s);s||(s={},o.currentAttributes.forEach((l,c)=>{s[c]=l})),Ve(i,this,o,n,s)}):this._pending.push(()=>this.insert(t,n,s))}insertEmbed(t,n,s){const r=this.doc;r!==null?y(r,i=>{const o=Pt(i,this,t,!s);Ve(i,this,o,n,s||{})}):this._pending.push(()=>this.insertEmbed(t,n,s||{}))}delete(t,n){if(n===0)return;const s=this.doc;s!==null?y(s,r=>{qn(r,Pt(r,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,s){if(n===0)return;const r=this.doc;r!==null?y(r,i=>{const o=Pt(i,this,t,!1);o.right!==null&&Wn(i,this,o,n,s)}):this._pending.push(()=>this.format(t,n,s))}removeAttribute(t){this.doc!==null?y(this.doc,n=>{de(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return _n(this,t)}getAttributes(){return ir(this)}_write(t){t.writeTypeRef(Dl)}}const ol=e=>new Et;class Fe{constructor(t,n=()=>!0){this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??O()}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===Dt||n.constructor===rt)&&n._start!==null)t=n._start;else for(;t!==null;){const s=t.next;if(s!==null){t=s;break}else t.parent===this._root?t=null:t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class rt extends I{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new rt}clone(){const t=new rt;return t.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),t}get length(){return this.doc??O(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Fe(this,t)}querySelector(t){t=t.toUpperCase();const s=new Fe(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return s.done?null:s.value}querySelectorAll(t){return t=t.toUpperCase(),W(new Fe(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){Oe(this,t,new hl(this,n,t))}toString(){return tr(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},s){const r=t.createDocumentFragment();return s!==void 0&&s._createAssociation(r,this),Bt(this,i=>{r.insertBefore(i.toDOM(t,n,s),null)}),r}insert(t,n){this.doc!==null?y(this.doc,s=>{sr(s,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)y(this.doc,s=>{const r=t&&t instanceof I?t._item:t;ue(s,this,r,n)});else{const s=this._prelimContent,r=t===null?0:s.findIndex(i=>i===t)+1;if(r===0&&t!==null)throw G("Reference item not found");s.splice(r,0,...n)}}delete(t,n=1){this.doc!==null?y(this.doc,s=>{rr(s,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return Qs(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return er(this,t)}slice(t=0,n=this.length){return Ps(this,t,n)}forEach(t){Bt(this,t)}_write(t){t.writeTypeRef(Il)}}const ll=e=>new rt;class Dt extends rt{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((s,r)=>{this.setAttribute(r,s)}),this._prelimAttrs=null}_copy(){return new Dt(this.nodeName)}clone(){const t=new Dt(this.nodeName),n=this.getAttributes();return li(n,(s,r)=>{t.setAttribute(r,s)}),t.insert(0,this.toArray().map(s=>s instanceof I?s.clone():s)),t}toString(){const t=this.getAttributes(),n=[],s=[];for(const l in t)s.push(l);s.sort();const r=s.length;for(let l=0;l<r;l++){const c=s[l];n.push(c+'="'+t[c]+'"')}const i=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?y(this.doc,n=>{de(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return _n(this,t)}hasAttribute(t){return or(this,t)}getAttributes(t){return t?Zo(this,t):ir(this)}toDOM(t=document,n={},s){const r=t.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const l=i[o];typeof l=="string"&&r.setAttribute(o,l)}return Bt(this,o=>{r.appendChild(o.toDOM(t,n,s))}),s!==void 0&&s._createAssociation(r,this),r}_write(t){t.writeTypeRef(Al),t.writeKey(this.nodeName)}}const cl=e=>new Dt(e.readKey());class hl extends Ie{constructor(t,n,s){super(t,s),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}}class fe extends Ct{constructor(t){super(),this.hookName=t}_copy(){return new fe(this.hookName)}clone(){const t=new fe(this.hookName);return this.forEach((n,s)=>{t.set(s,n)}),t}toDOM(t=document,n={},s){const r=n[this.hookName];let i;return r!==void 0?i=r.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),s!==void 0&&s._createAssociation(i,this),i}_write(t){t.writeTypeRef(Tl),t.writeKey(this.hookName)}}const al=e=>new fe(e.readKey());class ge extends Et{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new ge}clone(){const t=new ge;return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,s){const r=t.createTextNode(this.toString());return s!==void 0&&s._createAssociation(r,this),r}toString(){return this.toDelta().map(t=>{const n=[];for(const r in t.attributes){const i=[];for(const o in t.attributes[r])i.push({key:o,value:t.attributes[r][o]});i.sort((o,l)=>o.key<l.key?-1:1),n.push({nodeName:r,attrs:i})}n.sort((r,i)=>r.nodeName<i.nodeName?-1:1);let s="";for(let r=0;r<n.length;r++){const i=n[r];s+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){const l=i.attrs[o];s+=` ${l.key}="${l.value}"`}s+=">"}s+=t.insert;for(let r=n.length-1;r>=0;r--)s+=`</${n[r].nodeName}>`;return s}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Ol)}}const ul=e=>new ge;class Sn{constructor(t,n){this.id=t,this.length=n}get deleted(){throw B()}mergeWith(t){return!1}write(t,n,s){throw B()}integrate(t,n){throw B()}}const dl=0;class $ extends Sn{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),Ys(t.doc.store,this)}write(t,n){t.writeInfo(dl),t.writeLen(this.length-n)}getMissing(t,n){return null}}class Xt{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Xt(this.content)}splice(t){throw B()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}}const fl=e=>new Xt(e.readBuf());class jt{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new jt(this.len)}splice(t){const n=new jt(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){Vt(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}}const gl=e=>new jt(e.readLen()),ur=(e,t)=>new xt({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class Wt{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Wt(ur(this.doc.guid,this.opts))}splice(t){throw B()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const pl=e=>new Wt(ur(e.readString(),e.readAny()));class lt{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new lt(this.embed)}splice(t){throw B()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const wl=e=>new lt(e.readJSON());class D{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new D(this.key,this.value)}splice(t){throw B()}mergeWith(t){return!1}integrate(t,n){const s=n.parent;s._searchMarker=null,s._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const kl=e=>new D(e.readKey(),e.readJSON());class pe{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new pe(this.arr)}splice(t){const n=new pe(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const s=this.arr.length;t.writeLen(s-n);for(let r=n;r<s;r++){const i=this.arr[r];t.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const ml=e=>{const t=e.readLen(),n=[];for(let s=0;s<t;s++){const r=e.readString();r==="undefined"?n.push(void 0):n.push(JSON.parse(r))}return new pe(n)},yl=oe("node_env")==="development";class it{constructor(t){this.arr=t,yl&&ls(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new it(this.arr)}splice(t){const n=new it(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const s=this.arr.length;t.writeLen(s-n);for(let r=n;r<s;r++){const i=this.arr[r];t.writeAny(i)}}getRef(){return 8}}const _l=e=>{const t=e.readLen(),n=[];for(let s=0;s<t;s++)n.push(e.readAny());return new it(n)};class H{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new H(this.str)}splice(t){const n=new H(this.str.slice(t));this.str=this.str.slice(0,t);const s=this.str.charCodeAt(t-1);return s>=55296&&s<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const Sl=e=>new H(e.readString()),bl=[Qo,el,ol,cl,ll,al,ul],Cl=0,El=1,Dl=2,Al=3,Il=4,Tl=5,Ol=6;class Y{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Y(this.type._copy())}splice(t){throw B()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(s=>{s.deleted?s.id.clock<(t.beforeState.get(s.id.client)||0)&&t._mergeStructs.push(s):s.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(s=>{for(;s!==null;)s.gc(t,!0),s=s.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const xl=e=>new Y(bl[e.readTypeRef()](e)),qe=(e,t)=>{let n=t,s=0,r;do s>0&&(n=p(n.client,n.clock+s)),r=gt(e,n),s=n.clock-r.id.clock,n=r.redone;while(n!==null&&r instanceof _);return{item:r,diff:s}},bn=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},we=(e,t,n)=>{const{client:s,clock:r}=t.id,i=new _(p(s,r+n),t,p(s,r+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=p(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},Zn=(e,t)=>Pe(e,n=>Ht(n.deletions,t)),dr=(e,t,n,s,r,i)=>{const o=e.doc,l=o.store,c=o.clientID,a=t.redone;if(a!==null)return L(e,a);let h=t.parent._item,u=null,d;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||dr(e,h,n,s,r,i)===null))return null;for(;h.redone!==null;)h=L(e,h.redone)}const f=h===null?t.parent:h.content.type;if(t.parentSub===null){for(u=t.left,d=t;u!==null;){let b=u;for(;b!==null&&b.parent._item!==h;)b=b.redone===null?null:L(e,b.redone);if(b!==null&&b.parent._item===h){u=b;break}u=u.left}for(;d!==null;){let b=d;for(;b!==null&&b.parent._item!==h;)b=b.redone===null?null:L(e,b.redone);if(b!==null&&b.parent._item===h){d=b;break}d=d.right}}else if(d=null,t.right&&!r){for(u=t;u!==null&&u.right!==null&&(u.right.redone||Ht(s,u.right.id)||Zn(i.undoStack,u.right.id)||Zn(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=L(e,u.redone);if(u&&u.right!==null)return null}else u=f._map.get(t.parentSub)||null;const g=C(l,c),w=p(c,g),S=new _(w,u,u&&u.lastId,d,d&&d.id,f,t.parentSub,t.content.copy());return t.redone=w,bn(S,!0),S.integrate(e,0),S};class _ extends Sn{constructor(t,n,s,r,i,o,l,c){super(t,c.getLength()),this.origin=s,this.left=n,this.right=r,this.rightOrigin=i,this.parent=o,this.parentSub=l,this.redone=null,this.content=c,this.info=this.content.isCountable()?An:0}set marker(t){(this.info&Ue)>0!==t&&(this.info^=Ue)}get marker(){return(this.info&Ue)>0}get keep(){return(this.info&Dn)>0}set keep(t){this.keep!==t&&(this.info^=Dn)}get countable(){return(this.info&An)>0}get deleted(){return(this.info&Le)>0}set deleted(t){this.deleted!==t&&(this.info^=Le)}markDeleted(){this.info|=Le}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=C(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=C(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ft&&this.id.client!==this.parent.client&&this.parent.clock>=C(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Jn(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=L(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===$||this.right&&this.right.constructor===$)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===_?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===_&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ft){const s=gt(n,this.parent);s.constructor===$?this.parent=null:this.parent=s.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=Jn(t,t.doc.store,p(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let s=this.left,r;if(s!==null)r=s.right;else if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start;const i=new Set,o=new Set;for(;r!==null&&r!==this.right;){if(o.add(r),i.add(r),ht(this.origin,r.origin)){if(r.id.client<this.id.client)s=r,i.clear();else if(ht(this.rightOrigin,r.rightOrigin))break}else if(r.origin!==null&&o.has(gt(t.doc.store,r.origin)))i.has(gt(t.doc.store,r.origin))||(s=r,i.clear());else break;r=r.right}this.left=s}if(this.left!==null){const s=this.left.right;this.right=s,this.left.right=this}else{let s;if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start,this.parent._start=this;this.right=s}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Ys(t.doc.store,this),this.content.integrate(t,this),zn(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new $(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:p(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&ht(t.origin,this.lastId)&&this.right===t&&ht(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(s=>{s.p===t&&(s.p=this,!this.deleted&&this.countable&&(s.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Vt(t.deleteSet,this.id.client,this.id.clock,this.length),zn(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw v();this.content.gc(t),n?No(t,this,new $(this.id,this.length)):this.content=new jt(this.length)}write(t,n){const s=n>0?p(this.id.client,this.id.clock+n-1):this.origin,r=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&ke|(s===null?0:M)|(r===null?0:X)|(i===null?0:Rt);if(t.writeInfo(o),s!==null&&t.writeLeftID(s),r!==null&&t.writeRightID(r),s===null&&r===null){const l=this.parent;if(l._item!==void 0){const c=l._item;if(c===null){const a=Gs(l);t.writeParentInfo(!0),t.writeString(a)}else t.writeParentInfo(!1),t.writeLeftID(c.id)}else l.constructor===String?(t.writeParentInfo(!0),t.writeString(l)):l.constructor===ft?(t.writeParentInfo(!1),t.writeLeftID(l)):v();i!==null&&t.writeString(i)}this.content.write(t,n)}}const fr=(e,t)=>Ll[t&ke](e),Ll=[()=>{v()},gl,ml,fl,Sl,wl,kl,xl,_l,pl,()=>{v()}],Ul=10;class V extends Sn{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){v()}write(t,n){t.writeInfo(Ul),m(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},pr="__ $YJS$ __";gr[pr]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");gr[pr]=!0;export{zl as $,Uo as A,M as B,Ht as C,xt as D,B as E,ge as F,Et as G,oi as H,zt as I,Ml as J,H as K,D as L,q as M,nt as N,Rl as O,po as P,_ as Q,U as R,Lo as S,Jl as T,Yl as U,zs as V,Gs as W,Gl as X,Dt as Y,he as Z,p as _,at as a,jl as a0,Y as a1,ut as b,Gt as c,At as d,ne as e,j as f,ti as g,Bl as h,Vl as i,Fl as j,Nl as k,vl as l,$l as m,fi as n,De as o,Qn as p,ot as q,k as r,Hl as s,F as t,v as u,Fs as v,m as w,z as x,St as y,Kl as z};
package/admin/index.html CHANGED
@@ -11,11 +11,11 @@
11
11
  <meta name="apple-mobile-web-app-title" content="Headroom" />
12
12
  <link rel="apple-touch-icon" href="/icons/icon-180x180.png" />
13
13
  <title>Headroom</title>
14
- <script type="module" crossorigin src="/assets/index-Cir9tY_P.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BA3y7HJs.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-C2CvUxFh.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/tanstack-Bs3zYPPV.js">
17
- <link rel="modulepreload" crossorigin href="/assets/radix-C1kb_NqW.js">
18
- <link rel="stylesheet" crossorigin href="/assets/index-DACBYsKM.css">
17
+ <link rel="modulepreload" crossorigin href="/assets/radix-C5ZmWuuL.js">
18
+ <link rel="stylesheet" crossorigin href="/assets/index-c7UygSvP.css">
19
19
  <link rel="manifest" href="/manifest.webmanifest"></head>
20
20
  <body>
21
21
  <script>
package/admin/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const a=s=>l(s,r),o={module:{uri:r},exports:u,require:a};e[r]=Promise.all(i.map(s=>o[s]||a(s))).then(s=>(n(...s),u))}}define(["./workbox-7d58179f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"index.html",revision:"d274a22e62090e63d4e18d82fd635b17"},{url:"favicon-32x32.png",revision:"b3444a97a94af8708e3af842395316b9"},{url:"favicon-16x16.png",revision:"6ac0bbd011d9edf37858e0459d580887"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"assets/workbox-window.prod.es5-BIl4cyR9.js",revision:null},{url:"assets/useWebhooks-BH_r8-Mo.js",revision:null},{url:"assets/useTags-f7AVSLuj.js",revision:null},{url:"assets/useSiteUsers-BdnvuM2E.js",revision:null},{url:"assets/usePageTitle-BNSba9_L.js",revision:null},{url:"assets/useMedia-e3sqWm_t.js",revision:null},{url:"assets/useFilterParams-DYdEuWPE.js",revision:null},{url:"assets/useDebouncedValue-C-cQUcLG.js",revision:null},{url:"assets/useContentSearch-DOjveB9t.js",revision:null},{url:"assets/useContent-e8beBIuq.js",revision:null},{url:"assets/useAdminResolver-D-LlmquD.js",revision:null},{url:"assets/textarea-vSXNxwTe.js",revision:null},{url:"assets/tanstack-Bs3zYPPV.js",revision:null},{url:"assets/table-DLoIbCQ5.js",revision:null},{url:"assets/sortable.esm-QyXA6fio.js",revision:null},{url:"assets/serializeToText-DR_WnxiI.js",revision:null},{url:"assets/select-_uJYxzeZ.js",revision:null},{url:"assets/react-vendor-C2CvUxFh.js",revision:null},{url:"assets/radix-C1kb_NqW.js",revision:null},{url:"assets/popover-D5_HjjUC.js",revision:null},{url:"assets/native-48B9X9Wg.js",revision:null},{url:"assets/module-RjUF93sV.js",revision:null},{url:"assets/media-url-DIg_vSyf.js",revision:null},{url:"assets/lib-BrI1UB_t.js",revision:null},{url:"assets/index-DACBYsKM.css",revision:null},{url:"assets/index-Cir9tY_P.js",revision:null},{url:"assets/format-C88SDH8g.js",revision:null},{url:"assets/core.esm-B_kcYf6n.js",revision:null},{url:"assets/contentStatus-BmaiYVOm.js",revision:null},{url:"assets/command-fvBFHye4.js",revision:null},{url:"assets/collapsible-B414SspL.js",revision:null},{url:"assets/checkbox-WGrS3sUr.js",revision:null},{url:"assets/card-hXVtlM0q.js",revision:null},{url:"assets/WebhooksPage-C6lGZLpr.js",revision:null},{url:"assets/WebhookEditPage-SlJE4d3z.js",revision:null},{url:"assets/UsersPage-B0vLxjrg.js",revision:null},{url:"assets/TagsPage-DdeZokow.js",revision:null},{url:"assets/TagInput-BILCaC9b.js",revision:null},{url:"assets/SubmissionListPage-DNMzQZHS.js",revision:null},{url:"assets/SubmissionEditPage-Brf-DK2X.js",revision:null},{url:"assets/SubmissionDetailPage-DS08LGxd.js",revision:null},{url:"assets/SitesPage-Bw_WBN6v.js",revision:null},{url:"assets/SiteUsersPage-AyJvcVM7.js",revision:null},{url:"assets/SiteUserEditPage-ClHmp0T-.js",revision:null},{url:"assets/SiteSettingsPage-BtCC3RKc.js",revision:null},{url:"assets/RelationshipPicker-CDFs4TMW.js",revision:null},{url:"assets/MediaPage-DfPQBmNf.css",revision:null},{url:"assets/MediaPage-DZZKMGF4.js",revision:null},{url:"assets/MediaField-J2TLG_fu.js",revision:null},{url:"assets/LoginPage-DutieANA.js",revision:null},{url:"assets/FilterBar-DhRwTqFv.js",revision:null},{url:"assets/FieldBuilder-36tfpSyM.js",revision:null},{url:"assets/CustomBlockPreview-C6HqS4xv.js",revision:null},{url:"assets/ContentListPage-zmO8Is4d.js",revision:null},{url:"assets/ContentEditPage-D3Rvlktk.js",revision:null},{url:"assets/ContentCreatePage-DfYcEH1u.js",revision:null},{url:"assets/CollectionsPage-ClplrxNn.js",revision:null},{url:"assets/CollectionEditPage-BqX_0cC2.js",revision:null},{url:"assets/BulkActionBar-TRiXXLQd.js",revision:null},{url:"assets/BlockTypesPage-BIMBVxBs.js",revision:null},{url:"assets/BlockTypeEditPage-CuNJfZw0.js",revision:null},{url:"assets/BlockEditor-Cp_wZ2xN.css",revision:null},{url:"assets/BlockEditor-6wqsThJ7.js",revision:null},{url:"assets/AuditPage-BE0XIUl2.js",revision:null},{url:"assets/ApiKeysPage-BfWCxGhC.js",revision:null},{url:"assets/AllContentPage-CFqEMAl9.js",revision:null},{url:"assets/AdminsPage-Bt_ekZen.js",revision:null},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"manifest.webmanifest",revision:"be12a951409033222ff660a548620488"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html"),{denylist:[/^\/v1\//]})),s.registerRoute(({url:s})=>s.pathname.startsWith("/v1/admin/"),new s.NetworkFirst({cacheName:"api-cache",networkTimeoutSeconds:10,plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:3600}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET"),s.registerRoute(({request:s})=>"image"===s.destination,new s.CacheFirst({cacheName:"media-cache",plugins:[new s.ExpirationPlugin({maxEntries:500,maxAgeSeconds:604800}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET")});
1
+ if(!self.define){let s,e={};const i=(i,l)=>(i=new URL(i+".js",l).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(l,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const a=s=>i(s,r),o={module:{uri:r},exports:u,require:a};e[r]=Promise.all(l.map(s=>o[s]||a(s))).then(s=>(n(...s),u))}}define(["./workbox-7d58179f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"index.html",revision:"60e0442638db6d5d7887d84abf92ebf5"},{url:"favicon-32x32.png",revision:"b3444a97a94af8708e3af842395316b9"},{url:"favicon-16x16.png",revision:"6ac0bbd011d9edf37858e0459d580887"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"assets/yjs-tXBm_srz.js",revision:null},{url:"assets/workbox-window.prod.es5-BIl4cyR9.js",revision:null},{url:"assets/useWebhooks-BAB-3sLa.js",revision:null},{url:"assets/useTags-ybsMbCst.js",revision:null},{url:"assets/useSiteUsers-CKtC_8Jc.js",revision:null},{url:"assets/usePageTitle-DYvuJQp6.js",revision:null},{url:"assets/useMedia-Cu5N4rY8.js",revision:null},{url:"assets/useFilterParams-DYdEuWPE.js",revision:null},{url:"assets/useContentSearch-_bwacEth.js",revision:null},{url:"assets/useContent-CW0tm0FY.js",revision:null},{url:"assets/useAdminResolver-Bljb4XGQ.js",revision:null},{url:"assets/textarea-CpDSUg2s.js",revision:null},{url:"assets/tanstack-Bs3zYPPV.js",revision:null},{url:"assets/table-Dk7eeOt2.js",revision:null},{url:"assets/sortable.esm-qVEMoaTg.js",revision:null},{url:"assets/serializeToText-Zin3gYPm.js",revision:null},{url:"assets/select-dX9e6VDt.js",revision:null},{url:"assets/react-vendor-C2CvUxFh.js",revision:null},{url:"assets/radix-C5ZmWuuL.js",revision:null},{url:"assets/popover-BFw_h3j6.js",revision:null},{url:"assets/native-48B9X9Wg.js",revision:null},{url:"assets/module-RjUF93sV.js",revision:null},{url:"assets/media-url-DIg_vSyf.js",revision:null},{url:"assets/lib-BrI1UB_t.js",revision:null},{url:"assets/index-c7UygSvP.css",revision:null},{url:"assets/index-BA3y7HJs.js",revision:null},{url:"assets/format-C88SDH8g.js",revision:null},{url:"assets/core.esm-DdQHdRkd.js",revision:null},{url:"assets/contentStatus-CkPi9Dh6.js",revision:null},{url:"assets/command-CdzYw11U.js",revision:null},{url:"assets/collapsible-D3d29uJp.js",revision:null},{url:"assets/checkbox-DEgzM8H9.js",revision:null},{url:"assets/card-CZTHR2Qa.js",revision:null},{url:"assets/WebhooksPage-CASjmlPN.js",revision:null},{url:"assets/WebhookEditPage-KeS8hmdW.js",revision:null},{url:"assets/UsersPage-CnQAOOGF.js",revision:null},{url:"assets/TagsPage-BZzDvcKa.js",revision:null},{url:"assets/TagInput-d-Hw1fkL.js",revision:null},{url:"assets/SubmissionListPage-DA-8deUy.js",revision:null},{url:"assets/SubmissionEditPage-C-ykTI2t.js",revision:null},{url:"assets/SubmissionDetailPage-ktmzzOE1.js",revision:null},{url:"assets/SitesPage-BefZeWuJ.js",revision:null},{url:"assets/SiteUsersPage-iVXPCBPe.js",revision:null},{url:"assets/SiteUserEditPage-DroUTii9.js",revision:null},{url:"assets/SiteSettingsPage-nBT7NzkA.js",revision:null},{url:"assets/RelationshipPicker-Dv7GaLcU.js",revision:null},{url:"assets/Pagination-CuHwUPHi.js",revision:null},{url:"assets/MediaPage-DfPQBmNf.css",revision:null},{url:"assets/MediaPage-C84p9d1U.js",revision:null},{url:"assets/MediaField-B-Cz8TlK.js",revision:null},{url:"assets/LoginPage-Bi7TBzK4.js",revision:null},{url:"assets/IconPicker-BrgSAsa_.js",revision:null},{url:"assets/FloatingComposerController-D4uLQfUX-C0Lhbmda.js",revision:null},{url:"assets/FilterBar-kFcOLffg.js",revision:null},{url:"assets/FieldRenderer-wE-mtqZB.js",revision:null},{url:"assets/CustomBlockPreview-Cs9bFDh4.js",revision:null},{url:"assets/ContentListPage-BDMx7pWb.js",revision:null},{url:"assets/ContentField-D04Uo1Ov.js",revision:null},{url:"assets/ContentEditPage-WkSbCnnG.js",revision:null},{url:"assets/ContentCreatePage-DlgxamOe.js",revision:null},{url:"assets/CollectionsPage-BQmGXpvW.js",revision:null},{url:"assets/CollectionEditPage-y8t0ZO89.js",revision:null},{url:"assets/BulkActionBar--35xjnOP.js",revision:null},{url:"assets/BlockTypesPage-D8Me6OeX.js",revision:null},{url:"assets/BlockTypeEditPage-CY0gCPei.js",revision:null},{url:"assets/BlockEditor-ClskiZoX.js",revision:null},{url:"assets/BlockEditor-CQpF8tYb.css",revision:null},{url:"assets/AuditPage-B5GGFWGG.js",revision:null},{url:"assets/ApiKeysPage-BBW4ATBx.js",revision:null},{url:"assets/AllContentPage-1gXe2OC7.js",revision:null},{url:"assets/AdminsPage-BIWASote.js",revision:null},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"manifest.webmanifest",revision:"be12a951409033222ff660a548620488"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html"),{denylist:[/^\/v1\//]})),s.registerRoute(({url:s})=>s.pathname.startsWith("/v1/admin/"),new s.NetworkFirst({cacheName:"api-cache",networkTimeoutSeconds:10,plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:3600}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET"),s.registerRoute(({request:s})=>"image"===s.destination,new s.CacheFirst({cacheName:"media-cache",plugins:[new s.ExpirationPlugin({maxEntries:500,maxAgeSeconds:604800}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET")});
@@ -8,10 +8,12 @@
8
8
  import type { ApiResources } from "./api.js";
9
9
  import type { CdnResources } from "./cdn.js";
10
10
  import type { AuthResources } from "./auth.js";
11
+ import type { CollaborationResources } from "./collaboration.js";
11
12
  export interface AdminSiteArgs {
12
13
  api: ApiResources;
13
14
  cdn: CdnResources;
14
15
  auth: AuthResources;
16
+ collab: CollaborationResources;
15
17
  pkgRoot: string;
16
18
  dev?: {
17
19
  /** Path to admin UI source, e.g. "packages/admin" */
@@ -21,6 +23,16 @@ export interface AdminSiteArgs {
21
23
  name: string;
22
24
  certificateArn: string;
23
25
  };
26
+ /**
27
+ * Build-time toggle for the entire collaboration UI. Defaults to `true`
28
+ * (collab is on whenever the WS infra is deployed). Set to `false` from
29
+ * the consuming SST config to keep the WebSocket / Collab DynamoDB table
30
+ * deployed but hide the "Collaborate" / "Request collaboration" buttons
31
+ * and refuse to open WebSockets — useful as a kill-switch without a full
32
+ * teardown. Plumbs to `VITE_COLLAB_ENABLED` in the admin Vite env; see
33
+ * `packages/admin/src/collab/featureFlag.ts` for the consumer.
34
+ */
35
+ collabEnabled?: boolean;
24
36
  }
25
37
  export declare function createAdminSite(name: string, args: AdminSiteArgs): {
26
38
  site: sst.aws.StaticSite;
@@ -1 +1 @@
1
- {"version":3,"file":"admin-site.d.ts","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qDAAqD;QACrD,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;;;EA+EhE;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"admin-site.d.ts","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qDAAqD;QACrD,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;;;EAsFhE;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -8,7 +8,10 @@
8
8
  import fs from "fs";
9
9
  import path from "path";
10
10
  export function createAdminSite(name, args) {
11
- const { api, cdn, auth } = args;
11
+ const { api, cdn, auth, collab } = args;
12
+ // Default ON for backward compat — only emit "false" when explicitly
13
+ // disabled so existing stages without the flag set don't change behaviour.
14
+ const collabEnabledStr = args.collabEnabled === false ? "false" : "true";
12
15
  const domainConfig = args.domain
13
16
  ? {
14
17
  name: args.domain.name,
@@ -32,6 +35,8 @@ export function createAdminSite(name, args) {
32
35
  VITE_USER_POOL_ID: auth.userPool.id,
33
36
  VITE_USER_POOL_CLIENT_ID: auth.userPoolClient.id,
34
37
  VITE_AWS_REGION: aws.getRegionOutput().name,
38
+ VITE_COLLAB_WS_URL: collab.wsUrl,
39
+ VITE_COLLAB_ENABLED: collabEnabledStr,
35
40
  },
36
41
  domain: domainConfig,
37
42
  });
@@ -58,6 +63,8 @@ export function createAdminSite(name, args) {
58
63
  '__HEADROOM_USER_POOL_ID__': '${auth.userPool.id}',
59
64
  '__HEADROOM_USER_POOL_CLIENT_ID__': '${auth.userPoolClient.id}',
60
65
  '__HEADROOM_AWS_REGION__': '${aws.getRegionOutput().name}',
66
+ '__HEADROOM_COLLAB_WS_URL__': '${collab.wsUrl}',
67
+ '__HEADROOM_COLLAB_ENABLED__': '${collabEnabledStr}',
61
68
  };
62
69
  function walk(d) {
63
70
  for (const f of fs.readdirSync(d)) {
@@ -1 +1 @@
1
- {"version":3,"file":"admin-site.js","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAoBxB,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAmB;IAC/D,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEhC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM;QAC9B,CAAC,CAAC;YACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc;SACjC;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,gDAAgD;QAChD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE;YAClD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;YACxB,GAAG,EAAE;gBACH,OAAO,EAAE,gBAAgB;aAC1B;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,MAAM;aACf;YACD,WAAW,EAAE;gBACX,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG;gBACzB,YAAY,EAAE,GAAG,CAAC,GAAG;gBACrB,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACnC,wBAAwB,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;gBAChD,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;aAC5C;YACD,MAAM,EAAE,YAAY;SACrB,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,0EAA0E;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,+DAA+D;IAC/D,MAAM,OAAO,GAAG,iBAAiB,CAAC;IAElC,oDAAoD;IACpD,0CAA0C;IAC1C,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAElD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE;QAClD,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,8DAA8D;YAC9D,OAAO,EAAE,YAAY,CAAA;;;;qCAIU,GAAG,CAAC,GAAG,CAAC,GAAG;qCACX,GAAG,CAAC,GAAG;0CACF,IAAI,CAAC,QAAQ,CAAC,EAAE;iDACT,IAAI,CAAC,cAAc,CAAC,EAAE;wCAC/B,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;;;;;;;;;;;;;;;;QAgB1D;YACF,MAAM,EAAE,GAAG;SACZ;QACD,MAAM,EAAE,YAAY;KACrB,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"admin-site.js","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAgCxB,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAmB;IAC/D,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxC,qEAAqE;IACrE,2EAA2E;IAC3E,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAEzE,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM;QAC9B,CAAC,CAAC;YACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc;SACjC;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,gDAAgD;QAChD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE;YAClD,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;YACxB,GAAG,EAAE;gBACH,OAAO,EAAE,gBAAgB;aAC1B;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,MAAM;aACf;YACD,WAAW,EAAE;gBACX,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG;gBACzB,YAAY,EAAE,GAAG,CAAC,GAAG;gBACrB,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACnC,wBAAwB,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;gBAChD,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;gBAC3C,kBAAkB,EAAE,MAAM,CAAC,KAAK;gBAChC,mBAAmB,EAAE,gBAAgB;aACtC;YACD,MAAM,EAAE,YAAY;SACrB,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,0EAA0E;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,+DAA+D;IAC/D,MAAM,OAAO,GAAG,iBAAiB,CAAC;IAElC,oDAAoD;IACpD,0CAA0C;IAC1C,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAElD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE;QAClD,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,8DAA8D;YAC9D,OAAO,EAAE,YAAY,CAAA;;;;qCAIU,GAAG,CAAC,GAAG,CAAC,GAAG;qCACX,GAAG,CAAC,GAAG;0CACF,IAAI,CAAC,QAAQ,CAAC,EAAE;iDACT,IAAI,CAAC,cAAc,CAAC,EAAE;wCAC/B,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;2CACvB,MAAM,CAAC,KAAK;4CACX,gBAAgB;;;;;;;;;;;;;;;;QAgBpD;YACF,MAAM,EAAE,GAAG;SACZ;QACD,MAAM,EAAE,YAAY;KACrB,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,CAAC"}
package/dist/api.d.ts CHANGED
@@ -8,11 +8,18 @@ import type { StorageResources } from "./storage.js";
8
8
  import type { AuthResources } from "./auth.js";
9
9
  import type { WebhookResources } from "./webhooks.js";
10
10
  import type { ImageResources } from "./image.js";
11
+ import type { CollabTableResources } from "./collaboration.js";
11
12
  export interface ApiArgs {
12
13
  storage: StorageResources;
13
14
  auth: AuthResources;
14
15
  webhooks: WebhookResources;
15
16
  image: ImageResources;
17
+ /**
18
+ * Just the collab DynamoDB table — the API Lambda only links the table
19
+ * for ticket reads/writes, it does NOT depend on the WebSocket handler.
20
+ * (The WS handler is created AFTER the API because its env needs api.url.)
21
+ */
22
+ collab: CollabTableResources;
16
23
  senderEmail: string;
17
24
  pkgRoot: string;
18
25
  dev?: {
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,0CAA0C;QAC1C,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;;EA6FpD;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB;;;;OAIG;IACH,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,0CAA0C;QAC1C,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;;EAoGpD;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
package/dist/api.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import path from "path";
8
8
  export function createApi(name, args) {
9
- const { storage, auth, webhooks, image } = args;
9
+ const { storage, auth, webhooks, image, collab } = args;
10
10
  const handlerConfig = args.dev
11
11
  ? {
12
12
  handler: args.dev.handler,
@@ -46,6 +46,11 @@ export function createApi(name, args) {
46
46
  RELATIONSHIPS_TABLE: storage.relationships.name,
47
47
  SITE_USERS_TABLE: storage.siteUsers.name,
48
48
  SES_FROM_EMAIL: args.senderEmail,
49
+ COLLAB_TABLE: collab.collabTable.name,
50
+ // Shared with the collab Lambda. The Go JWT middleware verifies
51
+ // `X-Headroom-Internal` against this on internal service calls
52
+ // (collab → draft snapshot). See packages/api/internal/middleware/jwt.go.
53
+ INTERNAL_SECRET: storage.internalSecret.value,
49
54
  },
50
55
  link: [
51
56
  storage.sites,
@@ -63,6 +68,8 @@ export function createApi(name, args) {
63
68
  image.imageSigningSecret,
64
69
  storage.relationships,
65
70
  storage.siteUsers,
71
+ collab.collabTable,
72
+ storage.internalSecret,
66
73
  ],
67
74
  permissions: [
68
75
  {
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAmBxB,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAa;IACnD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG;QAC5B,CAAC,CAAC;YACE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO;YACzB,OAAO,EAAE,IAAa;SACvB;QACH,CAAC,CAAC;YACE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC;YAC7C,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,iBAA0B;YACnC,YAAY,EAAE,OAAgB;SAC/B,CAAC;IAEN,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,KAAK,EAAE;QAC7C,GAAG,aAAa;QAChB,OAAO,EAAE,YAAY;QACrB,GAAG,EAAE;YACH,IAAI,EAAE,KAAK;SACZ;QACD,WAAW,EAAE;YACX,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YAC/B,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;YACnC,mBAAmB,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI;YAC9C,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACjC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YAC/B,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI;YAC3C,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;YAC1C,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;YAC1C,cAAc,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI;YAC1C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC9B,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;YACxB,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;YAC3C,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;YACtC,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI;YACzD,iBAAiB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;YACpD,oBAAoB,EAAE,KAAK,CAAC,kBAAkB,CAAC,KAAK;YACpD,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI;YACzC,mBAAmB,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI;YAC/C,gBAAgB,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI;YACxC,cAAc,EAAE,IAAI,CAAC,WAAW;SACjC;QACD,IAAI,EAAE;YACJ,OAAO,CAAC,KAAK;YACb,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,MAAM;YACd,OAAO,CAAC,KAAK;YACb,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,aAAa;YACrB,QAAQ,CAAC,QAAQ;YACjB,QAAQ,CAAC,iBAAiB;YAC1B,QAAQ,CAAC,oBAAoB;YAC7B,KAAK,CAAC,kBAAkB;YACxB,OAAO,CAAC,aAAa;YACrB,OAAO,CAAC,SAAS;SAClB;QACD,WAAW,EAAE;YACX;gBACE,OAAO,EAAE;oBACP,gDAAgD;oBAChD,iCAAiC;oBACjC,oCAAoC;oBACpC,iCAAiC;iBAClC;gBACD,SAAS,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;aAC7B;YACD;gBACE,OAAO,EAAE;oBACP,uBAAuB;oBACvB,6BAA6B;oBAC7B,6BAA6B;oBAC7B,0BAA0B;oBAC1B,+BAA+B;iBAChC;gBACD,SAAS,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;aAC/B;YACD;gBACE,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,SAAS,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;aACnC;YACD;gBACE,OAAO,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;gBAC9C,SAAS,EAAE,CAAC,GAAG,CAAC;aACjB;SACF;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AA0BxB,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAa;IACnD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG;QAC5B,CAAC,CAAC;YACE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO;YACzB,OAAO,EAAE,IAAa;SACvB;QACH,CAAC,CAAC;YACE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC;YAC7C,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,iBAA0B;YACnC,YAAY,EAAE,OAAgB;SAC/B,CAAC;IAEN,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,KAAK,EAAE;QAC7C,GAAG,aAAa;QAChB,OAAO,EAAE,YAAY;QACrB,GAAG,EAAE;YACH,IAAI,EAAE,KAAK;SACZ;QACD,WAAW,EAAE;YACX,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YAC/B,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;YACnC,mBAAmB,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI;YAC9C,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACjC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YAC/B,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI;YAC3C,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;YAC1C,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;YAC1C,cAAc,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI;YAC1C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC9B,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;YACxB,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI;YAC3C,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;YACtC,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI;YACzD,iBAAiB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;YACpD,oBAAoB,EAAE,KAAK,CAAC,kBAAkB,CAAC,KAAK;YACpD,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI;YACzC,mBAAmB,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI;YAC/C,gBAAgB,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI;YACxC,cAAc,EAAE,IAAI,CAAC,WAAW;YAChC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI;YACrC,gEAAgE;YAChE,+DAA+D;YAC/D,0EAA0E;YAC1E,eAAe,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK;SAC9C;QACD,IAAI,EAAE;YACJ,OAAO,CAAC,KAAK;YACb,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,MAAM;YACd,OAAO,CAAC,KAAK;YACb,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,UAAU;YAClB,OAAO,CAAC,aAAa;YACrB,QAAQ,CAAC,QAAQ;YACjB,QAAQ,CAAC,iBAAiB;YAC1B,QAAQ,CAAC,oBAAoB;YAC7B,KAAK,CAAC,kBAAkB;YACxB,OAAO,CAAC,aAAa;YACrB,OAAO,CAAC,SAAS;YACjB,MAAM,CAAC,WAAW;YAClB,OAAO,CAAC,cAAc;SACvB;QACD,WAAW,EAAE;YACX;gBACE,OAAO,EAAE;oBACP,gDAAgD;oBAChD,iCAAiC;oBACjC,oCAAoC;oBACpC,iCAAiC;iBAClC;gBACD,SAAS,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;aAC7B;YACD;gBACE,OAAO,EAAE;oBACP,uBAAuB;oBACvB,6BAA6B;oBAC7B,6BAA6B;oBAC7B,0BAA0B;oBAC1B,+BAA+B;iBAChC;gBACD,SAAS,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;aAC/B;YACD;gBACE,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,SAAS,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;aACnC;YACD;gBACE,OAAO,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;gBAC9C,SAAS,EAAE,CAAC,GAAG,CAAC;aACjB;SACF;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Collaboration Infrastructure
3
+ *
4
+ * API Gateway WebSocket API + DynamoDB Collab table + Node.js Lambda handler.
5
+ * Deployed at all times but dormant for solo editing — no Lambda invocations
6
+ * and no Collab table writes happen until collaboration is opted into.
7
+ *
8
+ * Supports dev mode (Node.js source with live reload) and package mode
9
+ * (pre-bundled handler).
10
+ *
11
+ * Split into two helpers:
12
+ * - `createCollabTable` — provisions just the DynamoDB Collab table.
13
+ * Must be called BEFORE `createApi`, because the Go API links the
14
+ * Collab table for ticket reads/writes.
15
+ * - `createCollabHandler` — provisions the WebSocket API + Lambda and
16
+ * wires `API_URL` into the Lambda environment so `snapshotToDraft`
17
+ * can `fetch` back into the Go API on `$disconnect`. Must be called
18
+ * AFTER `createApi`, because it needs `api.api.url`.
19
+ *
20
+ * The two halves are merged into a single `CollaborationResources` value
21
+ * by `index.ts` so downstream consumers (admin-site, etc.) see one shape.
22
+ */
23
+ import type { StorageResources } from "./storage.js";
24
+ import type { AuthResources } from "./auth.js";
25
+ import type { ApiResources } from "./api.js";
26
+ export interface CollabTableArgs {
27
+ }
28
+ export declare function createCollabTable(name: string, _args?: CollabTableArgs): {
29
+ collabTable: sst.aws.Dynamo;
30
+ };
31
+ export type CollabTableResources = ReturnType<typeof createCollabTable>;
32
+ export interface CollabHandlerArgs {
33
+ storage: StorageResources;
34
+ auth: AuthResources;
35
+ api: ApiResources;
36
+ collabTable: CollabTableResources["collabTable"];
37
+ pkgRoot: string;
38
+ dev?: {
39
+ /** SST handler string, e.g. "packages/collab/src/index.handler" */
40
+ handler: string;
41
+ };
42
+ }
43
+ export declare function createCollabHandler(name: string, args: CollabHandlerArgs): {
44
+ wsApi: aws.apigatewayv2.Api;
45
+ wsHandler: sst.aws.Function;
46
+ wsUrl: PulumiOutput<string>;
47
+ };
48
+ export type CollabHandlerResources = ReturnType<typeof createCollabHandler>;
49
+ /**
50
+ * Combined collaboration resource shape — the union of the table half
51
+ * (created early) and the handler half (created late). Downstream consumers
52
+ * (admin-site, public outputs) see a single object.
53
+ */
54
+ export type CollaborationResources = CollabTableResources & CollabHandlerResources;
55
+ //# sourceMappingURL=collaboration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../src/collaboration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,eAAe;CAE/B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,eAAoB;;EAgB1E;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;IAClB,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,mEAAmE;QACnE,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB;;;;EAiHxE;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC"}