@blinkk/root-cms 3.0.1 → 3.0.3

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 (161) hide show
  1. package/dist/app.js +5 -5
  2. package/dist/{chunk-KGAUXTJ6.js → chunk-7Z5IRD2G.js} +176 -83
  3. package/dist/{chunk-2BSW7SIH.js → chunk-N4K6ICFR.js} +4 -4
  4. package/dist/{chunk-BGTUWIV6.js → chunk-PNLLZXVY.js} +4 -4
  5. package/dist/{chunk-C245C557.js → chunk-RXWDB3K4.js} +3 -3
  6. package/dist/{chunk-XLX37FRL.js → chunk-TEKMLYXS.js} +3 -4
  7. package/dist/cli/cli.d.ts +12 -0
  8. package/dist/cli/docs.d.ts +49 -0
  9. package/dist/cli/export.d.ts +11 -0
  10. package/dist/cli/generate-types.d.ts +6 -0
  11. package/dist/cli/import.d.ts +13 -0
  12. package/dist/cli/init-firebase.d.ts +7 -0
  13. package/dist/cli/utils.d.ts +27 -0
  14. package/dist/cli.js +10 -10
  15. package/dist/client.js +1 -1
  16. package/dist/core/ai-tools.d.ts +156 -0
  17. package/dist/core/ai.d.ts +330 -0
  18. package/dist/core/api.d.ts +21 -0
  19. package/dist/core/app.d.ts +16 -0
  20. package/dist/core/checks-translations.d.ts +13 -0
  21. package/dist/core/checks.d.ts +48 -0
  22. package/dist/core/client.d.ts +715 -0
  23. package/dist/core/core.d.ts +5 -0
  24. package/dist/core/cron.d.ts +19 -0
  25. package/dist/core/csv.d.ts +5 -0
  26. package/dist/core/functions.d.ts +9 -0
  27. package/dist/core/plugin.d.ts +357 -0
  28. package/dist/{project.d.ts → core/project.d.ts} +8 -12
  29. package/dist/core/richtext.d.ts +101 -0
  30. package/dist/{core.d.ts → core/route.d.ts} +13 -66
  31. package/dist/core/runtime.d.ts +46 -0
  32. package/dist/{schema-Db_xODoi.d.ts → core/schema.d.ts} +47 -100
  33. package/dist/core/search-extract.d.ts +70 -0
  34. package/dist/core/search-index.d.ts +182 -0
  35. package/dist/core/search-query.d.ts +68 -0
  36. package/dist/core/security.d.ts +6 -0
  37. package/dist/core/server-version.d.ts +5 -0
  38. package/dist/core/services-notifications.d.ts +57 -0
  39. package/dist/core/services.d.ts +44 -0
  40. package/dist/core/sse.d.ts +10 -0
  41. package/dist/core/translations-manager.d.ts +187 -0
  42. package/dist/core/translations.d.ts +83 -0
  43. package/dist/core/url-safety.d.ts +19 -0
  44. package/dist/core/validation.d.ts +30 -0
  45. package/dist/core/values.d.ts +9 -0
  46. package/dist/core/versions.d.ts +48 -0
  47. package/dist/core.js +1 -1
  48. package/dist/edit-M4PN4SGX.js +7 -0
  49. package/dist/functions.js +4 -4
  50. package/dist/{generate-types-SPV7I3A5.js → generate-types-JWIG4QVI.js} +1 -1
  51. package/dist/plugin.js +124 -129
  52. package/dist/shared/marshal.d.ts +68 -0
  53. package/dist/shared/objects.d.ts +9 -0
  54. package/dist/shared/richtext.d.ts +74 -0
  55. package/dist/shared/safe-json.d.ts +11 -0
  56. package/dist/shared/sanitize.d.ts +12 -0
  57. package/dist/shared/slug.d.ts +19 -0
  58. package/dist/shared/sse.d.ts +16 -0
  59. package/dist/shared/strings.d.ts +23 -0
  60. package/dist/ui/AIPage-2LUC2PWC.js +1 -0
  61. package/dist/ui/AssetsPage-PODV4QAB.js +1 -0
  62. package/dist/ui/CollectionPage-4DMKW5YB.js +1 -0
  63. package/dist/ui/ComparePage-JMJE5A5Y.js +1 -0
  64. package/dist/ui/DataPage-MVLZT2BU.js +1 -0
  65. package/dist/ui/DataSourcePage-4RPBXRI2.js +1 -0
  66. package/dist/ui/DocTranslationsPage-XJSPKGVX.js +1 -0
  67. package/dist/ui/DocumentPage-R2PVNG24.js +1 -0
  68. package/dist/ui/EditDataSourcePage-3SHAARNL.js +1 -0
  69. package/dist/ui/EditReleasePage-G5VW2OGW.js +1 -0
  70. package/dist/ui/ImageEditorDialog-4H665KK2.js +81 -0
  71. package/dist/ui/ImageEditorDialog-4H665KK2.js.LEGAL.txt +17 -0
  72. package/dist/ui/LogsPage-K6KYEG2P.js +1 -0
  73. package/dist/ui/NewDataSourcePage-O2VQEOJG.js +1 -0
  74. package/dist/ui/NewReleasePage-RSVS32RZ.js +1 -0
  75. package/dist/ui/NotFoundPage-ZYD5ILG6.js +1 -0
  76. package/dist/ui/ProjectPage-X3YQBWL4.js +1 -0
  77. package/dist/ui/ReleasePage-FJHHXNNB.js +1 -0
  78. package/dist/ui/ReleasesPage-VGWIBNEZ.js +1 -0
  79. package/dist/ui/SettingsPage-C4RXOQ6T.js +1 -0
  80. package/dist/ui/SidebarToolsPage-ZBOKPEMP.js +1 -0
  81. package/dist/ui/TaskPage-BQ4OX5WN.js +1 -0
  82. package/dist/ui/TasksPage-3IGQYVYS.js +1 -0
  83. package/dist/ui/TranslationsArbPage-GGHCWPQL.js +2 -0
  84. package/dist/ui/TranslationsEditPage-E2BCMKYV.js +1 -0
  85. package/dist/ui/TranslationsPage-MC4O4ZNI.js +162 -0
  86. package/dist/ui/ai-tools-5E5ELLZX.js +1 -0
  87. package/dist/ui/chunk-3IYZCUPI.js +1 -0
  88. package/dist/ui/chunk-4KE2SZKH.js +1 -0
  89. package/dist/ui/chunk-4W73RW5I.js +1 -0
  90. package/dist/ui/chunk-54DVDYU6.js +1 -0
  91. package/dist/ui/chunk-5MV6XVGA.js +1 -0
  92. package/dist/ui/chunk-62UWGWON.js +1 -0
  93. package/dist/ui/chunk-6IFGKSIE.js +1 -0
  94. package/dist/ui/chunk-767BAQ53.js +1 -0
  95. package/dist/ui/chunk-AFWBSIPL.js +1 -0
  96. package/dist/ui/chunk-AL3TN2KI.js +1 -0
  97. package/dist/ui/chunk-B6BLDN24.js +141 -0
  98. package/dist/ui/chunk-B6BLDN24.js.LEGAL.txt +106 -0
  99. package/dist/ui/chunk-BZIRGB4W.js +1 -0
  100. package/dist/ui/chunk-C5NH23G4.js +3 -0
  101. package/dist/ui/chunk-CGCKJFL4.js +1 -0
  102. package/dist/ui/chunk-DEGMKEHP.js +1 -0
  103. package/dist/ui/chunk-DTMZLUNY.js +15 -0
  104. package/dist/ui/chunk-DTMZLUNY.js.LEGAL.txt +237 -0
  105. package/dist/ui/chunk-DUJYIOLE.js +5 -0
  106. package/dist/ui/chunk-E2RCCK2T.js +1 -0
  107. package/dist/ui/chunk-EGEB6N4J.js +22 -0
  108. package/dist/ui/chunk-EGEB6N4J.js.LEGAL.txt +1059 -0
  109. package/dist/ui/chunk-GXSAEPU3.js +1 -0
  110. package/dist/ui/chunk-HHMG665Z.js +1 -0
  111. package/dist/ui/chunk-HKINZLMW.js +84 -0
  112. package/dist/ui/chunk-HLMBCVRX.js +1 -0
  113. package/dist/ui/chunk-HRGYNHZ3.js +1 -0
  114. package/dist/ui/chunk-I6ICVKEC.js +1 -0
  115. package/dist/ui/chunk-IU36W2TB.js +1 -0
  116. package/dist/ui/chunk-JDW4UORS.js +1 -0
  117. package/dist/ui/chunk-JHBAMPGB.js +1 -0
  118. package/dist/ui/chunk-JYFLU7DM.js +19 -0
  119. package/dist/ui/chunk-JZFTZ4X4.js +87 -0
  120. package/dist/ui/chunk-JZFTZ4X4.js.LEGAL.txt +9 -0
  121. package/dist/ui/chunk-KFAZBEPV.js +1 -0
  122. package/dist/ui/chunk-KKEWCXVV.js +1 -0
  123. package/dist/ui/chunk-KUCVLANF.js +1 -0
  124. package/dist/ui/chunk-KYDOSLTO.js +1 -0
  125. package/dist/ui/chunk-L4RHGQUG.js +1 -0
  126. package/dist/ui/chunk-MDUBCXU2.js +1 -0
  127. package/dist/ui/chunk-NXQVLOTK.js +1 -0
  128. package/dist/ui/chunk-NZHF733K.js +7 -0
  129. package/dist/ui/chunk-NZHF733K.js.LEGAL.txt +146 -0
  130. package/dist/ui/chunk-ONTGW2VA.js +1 -0
  131. package/dist/ui/chunk-ORXEMIQC.js +1 -0
  132. package/dist/ui/chunk-PHBMVORG.js +1 -0
  133. package/dist/ui/chunk-PJA7YP4A.js +1 -0
  134. package/dist/ui/chunk-PVAE643M.js +1 -0
  135. package/dist/ui/chunk-PWKJDYE2.js +1 -0
  136. package/dist/ui/chunk-RSVO46S3.js +1 -0
  137. package/dist/ui/chunk-SKEP5WYH.js +10 -0
  138. package/dist/ui/chunk-SKEP5WYH.js.LEGAL.txt +176 -0
  139. package/dist/ui/chunk-SQRKKWRG.js +3 -0
  140. package/dist/ui/chunk-UEON4JAT.js +1 -0
  141. package/dist/ui/chunk-V7S4IAGB.js +1 -0
  142. package/dist/ui/chunk-VMT7JFAM.js +1 -0
  143. package/dist/ui/chunk-W3BJ2EZX.js +1 -0
  144. package/dist/ui/chunk-W3HIZQ4Z.js +1 -0
  145. package/dist/ui/chunk-X2WHBGTP.js +1 -0
  146. package/dist/ui/chunk-XOQ3KDSR.js +3 -0
  147. package/dist/ui/chunk-YDO2EDVY.js +1 -0
  148. package/dist/ui/chunk-YFA6U2CV.js +1 -0
  149. package/dist/ui/gcs-L33FIRZU.js +1 -0
  150. package/dist/ui/prerender-Q4YSDCPB.js +1 -0
  151. package/dist/ui/signin.js +1 -1
  152. package/dist/ui/ui.css +1 -1
  153. package/dist/ui/ui.js +1 -630
  154. package/dist/ui/ui.js.LEGAL.txt +19 -732
  155. package/package.json +20 -20
  156. package/dist/client-1puwLgNx.d.ts +0 -1552
  157. package/dist/client.d.ts +0 -5
  158. package/dist/edit-MT4B37QK.js +0 -7
  159. package/dist/functions.d.ts +0 -13
  160. package/dist/plugin.d.ts +0 -5
  161. package/dist/richtext.d.ts +0 -104
@@ -0,0 +1,106 @@
1
+ Bundled license information:
2
+
3
+ use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js:
4
+ /**
5
+ * @license React
6
+ * use-sync-external-store-with-selector.production.js
7
+ *
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+ prismjs/prism.js:
15
+ /**
16
+ * Prism: Lightweight, robust, elegant syntax highlighting
17
+ *
18
+ * @license MIT <https://opensource.org/licenses/MIT>
19
+ * @author Lea Verou <https://lea.verou.me>
20
+ * @namespace
21
+ * @public
22
+ */
23
+
24
+ @editorjs/editorjs/dist/editorjs.mjs:
25
+ /*!
26
+ * CodeX.Tooltips
27
+ *
28
+ * @version 1.0.5
29
+ *
30
+ * @licence MIT
31
+ * @author CodeX <https://codex.so>
32
+ *
33
+ *
34
+ */
35
+ /*!
36
+ * Library for handling keyboard shortcuts
37
+ * @copyright CodeX (https://codex.so)
38
+ * @license MIT
39
+ * @author CodeX (https://codex.so)
40
+ * @version 1.2.0
41
+ */
42
+ /**
43
+ * Base Paragraph Block for the Editor.js.
44
+ * Represents a regular text block
45
+ *
46
+ * @author CodeX (team@codex.so)
47
+ * @copyright CodeX 2018
48
+ * @license The MIT License (MIT)
49
+ */
50
+ /**
51
+ * Editor.js
52
+ *
53
+ * @license Apache-2.0
54
+ * @see Editor.js <https://editorjs.io>
55
+ * @author CodeX Team <https://codex.so>
56
+ */
57
+
58
+ @editorjs/header/dist/header.mjs:
59
+ /**
60
+ * Header block for the Editor.js.
61
+ *
62
+ * @author CodeX (team@ifmo.su)
63
+ * @copyright CodeX 2018
64
+ * @license MIT
65
+ * @version 2.0.0
66
+ */
67
+
68
+ @editorjs/image/dist/image.mjs:
69
+ /**
70
+ * Image Tool for the Editor.js
71
+ * @author CodeX <team@codex.so>
72
+ * @license MIT
73
+ * @see {@link https://github.com/editor-js/image}
74
+ *
75
+ * To developers.
76
+ * To simplify Tool structure, we split it to 4 parts:
77
+ * 1) index.ts — main Tool's interface, public API and methods for working with data
78
+ * 2) uploader.ts — module that has methods for sending files via AJAX: from device, by URL or File pasting
79
+ * 3) ui.ts — module for UI manipulations: render, showing preloader, etc
80
+ *
81
+ * For debug purposes there is a testing server
82
+ * that can save uploaded files and return a Response {@link UploadResponseFormat}
83
+ *
84
+ * $ node dev/server.js
85
+ *
86
+ * It will expose 8008 port, so you can pass http://localhost:8008 with the Tools config:
87
+ *
88
+ * image: {
89
+ * class: ImageTool,
90
+ * config: {
91
+ * endpoints: {
92
+ * byFile: 'http://localhost:8008/uploadFile',
93
+ * byUrl: 'http://localhost:8008/fetchUrl',
94
+ * }
95
+ * },
96
+ * },
97
+ */
98
+
99
+ @editorjs/raw/dist/raw.mjs:
100
+ /**
101
+ * Raw HTML Tool for CodeX Editor
102
+ *
103
+ * @author CodeX (team@codex.so)
104
+ * @copyright CodeX 2018
105
+ * @license The MIT License (MIT)
106
+ */
@@ -0,0 +1 @@
1
+ import{b as R,f as O,g as U,i as A,j as H,k as j,m as N,o as M}from"./chunk-EGEB6N4J.js";import{a,c as E,e as x,h as D,j as B}from"./chunk-NZHF733K.js";B();var F=200,X=25,Y=2;function W(u,d={}){let[b,r]=a([]),[f,t]=a(!1),[e,g]=a(null),[y,n]=a(null),o=x(null),T=d.limit??X,L=d.minQueryLength??Y;return E(()=>{let h=u.trim();if(h.length<L){o.current?.abort(),o.current=null,r([]),t(!1),g(null);return}t(!0),g(null);let S=window.setTimeout(async()=>{o.current?.abort();let s=new AbortController;o.current=s;try{let l=await fetch("/cms/api/search.query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:h,limit:T}),signal:s.signal});if(!l.ok)throw new Error(`search.query returned ${l.status}`);let c=await l.json();if(!c?.success)throw new Error(c?.error||"search failed");if(s.signal.aborted)return;r(Array.isArray(c.hits)?c.hits:[]),n(c.meta||null),t(!1)}catch(l){if(s.signal.aborted)return;console.error("global search failed:",l),g(String(l?.message||l)),r([]),t(!1)}},F);return()=>{window.clearTimeout(S)}},[u,T,L]),{hits:b,loading:f,error:e,status:y}}function Z(){let[u,d]=a({status:{lastRun:null,docCount:0,fieldCount:0,shardCount:0},running:!1}),[b,r]=a(!0),f=D(async()=>{try{let t=await fetch("/cms/api/search.status",{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)return;let e=await t.json();if(!e?.success)return;d({status:e.status,running:!!e.running})}catch(t){console.error("search.status failed:",t)}finally{r(!1)}},[]);return E(()=>{f()},[f]),{...u,loading:b,refresh:f}}var v=200,J=5,K=2;function tt(u,d={}){let[b,r]=a([]),[f,t]=a(!1),e=x(null),g=d.limit??10,y=d.minQueryLength??K;return E(()=>{let n=u.trim(),o=n.indexOf("/");if((o>=0?n.slice(o+1):n).length<y){e.current&&(e.current.aborted=!0),e.current=null,r([]),t(!1);return}t(!0);let L=window.setTimeout(async()=>{e.current&&(e.current.aborted=!0);let h={aborted:!1};e.current=h;let S=null,s=n;o>=0&&(S=n.slice(0,o),s=n.slice(o+1));let l=window.__ROOT_CTX?.rootConfig?.projectId,c=window.firebase?.db;if(!l||!c){r([]),t(!1);return}let I=Object.keys(window.__ROOT_CTX.collections||{}),q=S?I.filter(p=>p.toLowerCase()===S.toLowerCase()):I,P=s,Q=`${s}\uF8FF`;try{let p=q.map(async i=>{let w=R(c,"Projects",l,"Collections",i,"Drafts"),C=U(w,A(O()),j(P),N(Q),H(J));try{let m=await M(C),_=[];return m.forEach(G=>{_.push({collection:i,slug:G.id,docId:`${i}/${G.id}`})}),_}catch(m){return console.error(`docSlugSearch failed for ${i}:`,m),[]}}),$=(await Promise.all(p)).flat();if(h.aborted)return;let k=$.sort((i,w)=>{let C=i.slug===s||i.docId===n?0:1,m=w.slug===s||w.docId===n?0:1;return C!==m?C-m:i.docId.localeCompare(w.docId)});r(k.slice(0,g)),t(!1)}catch(p){if(h.aborted)return;console.error("docSlugSearch failed:",p),r([]),t(!1)}},v);return()=>{window.clearTimeout(L)}},[u,g,y]),{hits:b,loading:f}}export{W as a,Z as b,tt as c};
@@ -0,0 +1,3 @@
1
+ import{a as Z}from"./chunk-CGCKJFL4.js";import{a as Q,c as X,e as Y}from"./chunk-4KE2SZKH.js";import{c as K}from"./chunk-W3HIZQ4Z.js";import{a as j}from"./chunk-JDW4UORS.js";import{b as J}from"./chunk-62UWGWON.js";import{a as x}from"./chunk-I6ICVKEC.js";import{d as W}from"./chunk-AL3TN2KI.js";import{Aa as S,Ha as e,a as s,c as q,e as B,ea as A,fa as P,j as re,oa as b,qa as $,va as F,wa as V}from"./chunk-NZHF733K.js";import{d as M}from"./chunk-KUCVLANF.js";re();var se="Enter the URL to make the HTTP request.",ne="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ne(a){let{route:n}=W(),c=B(null),i=Z(),[h,d]=s(!1),[r,U]=s(i.enabled?"gsheet":"http"),[g,z]=s("map"),[v,ee]=s("GET"),[y,T]=s(!1),[w,N]=s(1),[E,H]=s("hours"),[R,C]=s(!1),[L,p]=s(""),[te,O]=s(!!a.dataSourceId),[_,G]=s(null),I="";r==="http"?I=se:r==="gsheet"&&(I=ne);async function ae(t){await J(async()=>{let o=await X(t);G(o),U(o?.type||"http"),z(o?.dataFormat||"map"),o?.cron?(T(o.cron.enabled||!1),N(o.cron.interval||1),H(o.cron.unit||"hours"),C(o.cron.autoPublish||!1)):(T(!1),N(1),H("hours"),C(!1))}),O(!1)}q(()=>{a.dataSourceId&&(O(!0),ae(a.dataSourceId))},[a.dataSourceId]);async function oe(){p("");let t=c.current;function o(l){let f=t.elements[l];return f?f.value.trim():""}let m=a.dataSourceId||o("id");if(!m){p("missing id");return}if(!j(m)){p("id is invalid (alphanumeric characters and dashes only)");return}let D=o("url");if(!D){p("missing url");return}let u={id:m,description:o("description"),type:r,url:D,previewUrl:o("previewUrl")};if(r==="http"){if(!ie(D)){p("invalid url");return}u.httpOptions={method:v};let l=o("httpHeaders");if(l&&(u.httpOptions.headers=ue(l)),v==="POST"){let f=o("httpBody");f&&(u.httpOptions.body=f)}}else if(r==="gsheet"){if(!K(D)?.spreadsheetId){p("failed to parse spreadsheet url");return}u.dataFormat=g||"map"}y?u.cron={enabled:!0,interval:w,unit:E,autoPublish:R}:u.cron={enabled:!1,interval:w,unit:E};try{G(u),d(!0),a.dataSourceId?(await Y(a.dataSourceId,u),x({title:"Saved data source",message:`Successfully updated ${m}`,autoClose:5e3}),d(!1)):(await Q(m,u),x({title:"Added data source",message:`Successfully added ${m}`,autoClose:5e3}),d(!1),n(`/cms/data/${m}`))}catch(l){console.error(l),x({title:"Failed to save data source",message:String(l),color:"red",autoClose:!1}),d(!1)}}let k=[{value:"http",label:"HTTP"}];return(i.enabled||r==="gsheet")&&k.push({value:"gsheet",label:"Google Sheet"}),e("form",{className:"DataSourceForm",ref:c,onSubmit:t=>{t.preventDefault(),oe()},children:[e($,{visible:te}),e("div",{className:"DataSourceForm__input",children:e(S,{name:"type",label:"Type",data:k,value:r,onChange:t=>U(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(F,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:a.dataSourceId,disabled:!!a.dataSourceId}),e(b,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:_?.description}),e(F,{className:"DataSourceForm__input",name:"url",label:"URL",description:I,size:"xs",radius:0,value:_?.url}),r==="http"&&e(M,{children:[e("div",{className:"DataSourceForm__input",children:e(S,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:v,onChange:t=>ee(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(b,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:ce(_?.httpOptions?.headers||{})}),v==="POST"&&e(b,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:_?.httpOptions?.body})]}),r==="gsheet"&&e("div",{className:"DataSourceForm__input",children:[e(S,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:g,onChange:t=>z(t),size:"xs",radius:0,dropdownComponent:"div"}),g==="array"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",e("code",{children:"[[header1, header2], [foo, bar]]"})]}),g==="map"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",e("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),e("div",{className:"DataSourceForm__section",children:[e("div",{className:"DataSourceForm__section__label",children:"Sync Schedule"}),e(P,{className:"DataSourceForm__input",label:"Enable scheduled sync",checked:y,onChange:t=>T(t.currentTarget.checked),size:"xs"}),y&&e("div",{className:"DataSourceForm__cron",children:[e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every"}),e(V,{className:"DataSourceForm__cron__interval",value:w,onChange:t=>N(Number(t)||1),min:1,size:"xs",radius:0}),e(S,{className:"DataSourceForm__cron__unit",data:[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],value:E,onChange:t=>H(t),size:"xs",radius:0,dropdownComponent:"div"})]}),e(P,{className:"DataSourceForm__input",label:"Auto-publish after sync",checked:R,onChange:t=>C(t.currentTarget.checked),size:"xs"})]})]}),e(F,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:_?.previewUrl}),e(A,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:h,children:a.buttonLabel||"Save"}),L&&e("div",{className:"DataSourceForm__error",children:["Error: ",L]})]})}function ie(a){let n,c=a.startsWith("/")?"http://localhost":void 0;try{n=new URL(a,c)}catch(i){return console.error(i),!1}return n.protocol==="http:"||n.protocol==="https:"}function ue(a){let n={};return a.split(`
2
+ `).forEach(i=>{let h=i.indexOf(":");if(h===-1)return;let d=i.slice(0,h).trim(),r=i.slice(h+1).trim();d&&r&&(n[d]=r)}),n}function ce(a){let n=[];for(let c in a){let i=a[c];n.push(`${c}: ${i}`)}return n.join(`
3
+ `)}export{Ne as a};
@@ -0,0 +1 @@
1
+ import{L as m,a,c as f,j as O}from"./chunk-NZHF733K.js";O();var G=["https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/spreadsheets"],P=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest","https://sheets.googleapis.com/$discovery/rest?version=v4"];function R(){let o=window.__ROOT_CTX.rootConfig.projectId,t=!!(window.__ROOT_CTX.gapi?.apiKey&&window.__ROOT_CTX.gapi?.clientId),[e,n]=a(t),[i,w]=a(0),[s,h]=m({key:`root-cms::${o}::gapi-user-consent`,defaultValue:{}});async function C(){await Promise.all([E(),b()]),n(!1)}f(()=>{t&&C()},[]);function _(r){return new Promise(v=>{let g=window.__ROOT_CTX.gapi.clientId,c=Array.from(new Set([...G,...r?.scopes||[]])),u=google.accounts.oauth2.initTokenClient({client_id:g,scope:c.join(" "),callback:async I=>{let y=l()+parseInt(I.expires_in);w(y),h({at:l(),clientId:g,scopes:c}),v()}});s&&k(s,c)?(console.log("requesting token without prompt"),u.requestAccessToken({prompt:""})):(console.log("requesting token with prompt"),u.requestAccessToken({prompt:"consent"}))})}function S(){return l()<i}function T(r){return s?.scopes?.includes(r)||!1}return{enabled:t,loading:e,isLoggedIn:S,login:_,hasScope:T}}function k(o,t){if(!o||!o.at)return!1;let e=window.__ROOT_CTX.gapi?.clientId;if(o.clientId!==e)return!1;let n=o.scopes||[];return t.every(i=>n.includes(i))}function l(){return Math.floor(new Date().getTime()/1e3)}var p=null;async function E(){return p||(p=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://apis.google.com/js/api.js",e.onload=()=>{gapi.load("client",async()=>{try{await gapi.client.init({}),await Promise.all(P.map(n=>gapi.client.load(n))),console.log("gapi loaded"),o()}catch(n){console.error("Error initializing gapi:",n),t(n)}})},e.onerror=()=>{console.error("gapi script failed to load"),t(new Error("gapi script failed to load"))},document.head.appendChild(e)})),p}var d=null;async function b(){return d||(d=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.onload=()=>{o()},e.onerror=()=>{console.error("gis script failed to load"),t(new Error("gis script failed to load"))},document.head.appendChild(e)})),d}export{R as a};
@@ -0,0 +1 @@
1
+ import{h as M}from"./chunk-RSVO46S3.js";import{a as n,c as _}from"./chunk-HRGYNHZ3.js";import{b as h}from"./chunk-62UWGWON.js";import{a as u}from"./chunk-I6ICVKEC.js";import{e as f}from"./chunk-ORXEMIQC.js";import{a as m}from"./chunk-EGEB6N4J.js";import{Ha as e,a as i,e as c,ea as d,j as I}from"./chunk-NZHF733K.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};
@@ -0,0 +1,15 @@
1
+ var ie=()=>{};var ae=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Oe=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=t[n++],o=t[n++],l=t[n++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{let s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},ce={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let s=t[i],o=i+1<t.length,l=o?t[i+1]:0,c=i+2<t.length,d=c?t[i+2]:0,S=s>>2,m=(s&3)<<4|l>>4,a=(l&15)<<2|d>>6,u=d&63;c||(u=64,o||(a=64)),r.push(n[S],n[m],n[a],n[u])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(ae(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Oe(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let s=n[t.charAt(i++)],l=i<t.length?n[t.charAt(i)]:0;++i;let d=i<t.length?n[t.charAt(i)]:64;++i;let m=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||l==null||d==null||m==null)throw new k;let a=s<<2|l>>4;if(r.push(a),d!==64){let u=l<<4&240|d>>2;if(r.push(u),m!==64){let E=d<<6&192|m;r.push(E)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},k=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},xe=function(t){let e=ae(t);return ce.encodeByteArray(e,!0)},C=function(t){return xe(t).replace(/\./g,"")},fe=function(t){try{return ce.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Be(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Te=()=>Be().__FIREBASE_DEFAULTS__,Me=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Ne=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&fe(t[1]);return e&&JSON.parse(e)},O=()=>{try{return ie()||Te()||Me()||Ne()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Re=t=>O()?.emulatorHosts?.[t],Jt=t=>{let e=Re(t);if(!e)return;let n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);let r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},$=()=>O()?.config,Kt=t=>O()?.[`_${t}`];var I=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};function Le(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Zt(t){return(await fetch(t,{credentials:"include"})).ok}function Yt(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");let o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...t};return[C(JSON.stringify(n)),C(JSON.stringify(o)),""].join(".")}var w={};function ke(){let t={prod:[],emulator:[]};for(let e of Object.keys(w))w[e]?t.emulator.push(e):t.prod.push(e);return t}function Pe(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}var se=!1;function qt(t,e){if(typeof window>"u"||typeof document>"u"||!Le(window.location.host)||w[t]===e||w[t]||se)return;w[t]=e;function n(a){return`__firebase__banner__${a}`}let r="__firebase__banner",s=ke().prod.length>0;function o(){let a=document.getElementById(r);a&&a.remove()}function l(a){a.style.display="flex",a.style.background="#7faaf0",a.style.position="fixed",a.style.bottom="5px",a.style.left="5px",a.style.padding=".5em",a.style.borderRadius="5px",a.style.alignItems="center"}function c(a,u){a.setAttribute("width","24"),a.setAttribute("id",u),a.setAttribute("height","24"),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("fill","none"),a.style.marginLeft="-6px"}function d(){let a=document.createElement("span");return a.style.cursor="pointer",a.style.marginLeft="16px",a.style.fontSize="24px",a.innerHTML=" &times;",a.onclick=()=>{se=!0,o()},a}function S(a,u){a.setAttribute("id",u),a.innerText="Learn more",a.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",a.setAttribute("target","__blank"),a.style.paddingLeft="5px",a.style.textDecoration="underline"}function m(){let a=Pe(r),u=n("text"),E=document.getElementById(u)||document.createElement("span"),te=n("learnmore"),ne=document.getElementById(te)||document.createElement("a"),re=n("preprendIcon"),A=document.getElementById(re)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(a.created){let R=a.element;l(R),S(ne,te);let Ie=d();c(A,re),R.append(A,E,ne,Ie),document.body.appendChild(R)}s?(E.innerText="Preview backend disconnected.",A.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
2
+ <path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
3
+ </g>
4
+ <defs>
5
+ <clipPath id="clip0_6013_33858">
6
+ <rect width="24" height="24" fill="white"/>
7
+ </clipPath>
8
+ </defs>`):(A.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
9
+ <path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
10
+ </g>
11
+ <defs>
12
+ <clipPath id="clip0_6083_34804">
13
+ <rect width="24" height="24" fill="white"/>
14
+ </clipPath>
15
+ </defs>`,E.innerText="Preview backend running in this workspace."),E.setAttribute("id",u)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",m):m()}function le(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Xt(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(le())}function $e(){let t=O()?.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function Qt(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function en(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function tn(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function nn(){let t=le();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function rn(){return!$e()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function de(){try{return typeof indexedDB=="object"}catch{return!1}}function ue(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}var He="FirebaseError",b=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=He,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,v.prototype.create)}},v=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Fe(s,r):"Error",l=`${this.serviceName}: ${o} (${i}).`;return new b(i,l,r)}};function Fe(t,e){return t.replace(ze,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}var ze=/\{\$([^}]+)}/g;function sn(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function x(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let s=t[i],o=e[i];if(oe(s)&&oe(o)){if(!x(s,o))return!1}else if(s!==o)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function oe(t){return t!==null&&typeof t=="object"}function on(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function an(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function cn(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function fn(t,e){let n=new P(t,e);return n.subscribe.bind(n)}var P=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");Ue(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=L),i.error===void 0&&(i.error=L),i.complete===void 0&&(i.complete=L);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Ue(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function L(){}var ln=14400*1e3;function dn(t){return t&&t._delegate?t._delegate:t}var _=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var y="[DEFAULT]";var H=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new I;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){let n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(je(e))try{this.getOrInitializeService({instanceIdentifier:y})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=y){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=y){return this.instances.has(e)}getOptions(e=y){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[s,o]of this.instancesDeferred.entries()){let l=this.normalizeInstanceIdentifier(s);r===l&&o.resolve(i)}return i}onInit(e,n){let r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Ve(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=y){return this.component?this.component.multipleInstances?e:y:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function Ve(t){return t===y?void 0:t}function je(t){return t.instantiationMode==="EAGER"}var B=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let n=new H(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var We=[],f;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(f||(f={}));var Ge={debug:f.DEBUG,verbose:f.VERBOSE,info:f.INFO,warn:f.WARN,error:f.ERROR,silent:f.SILENT},Je=f.INFO,Ke={[f.DEBUG]:"log",[f.VERBOSE]:"log",[f.INFO]:"info",[f.WARN]:"warn",[f.ERROR]:"error"},Ze=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=Ke[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},T=class{constructor(e){this.name=e,this._logLevel=Je,this._logHandler=Ze,this._userLogHandler=null,We.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in f))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Ge[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,f.DEBUG,...e),this._logHandler(this,f.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,f.VERBOSE,...e),this._logHandler(this,f.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,f.INFO,...e),this._logHandler(this,f.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,f.WARN,...e),this._logHandler(this,f.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,f.ERROR,...e),this._logHandler(this,f.ERROR,...e)}};var Ye=(t,e)=>e.some(n=>t instanceof n),he,pe;function qe(){return he||(he=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Xe(){return pe||(pe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var me=new WeakMap,z=new WeakMap,ge=new WeakMap,F=new WeakMap,V=new WeakMap;function Qe(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(h(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&me.set(n,t)}).catch(()=>{}),V.set(e,t),e}function et(t){if(z.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});z.set(t,e)}var U={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return z.get(t);if(e==="objectStoreNames")return t.objectStoreNames||ge.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return h(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function be(t){U=t(U)}function tt(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(M(this),e,...n);return ge.set(r,e.sort?e.sort():[e]),h(r)}:Xe().includes(t)?function(...e){return t.apply(M(this),e),h(me.get(this))}:function(...e){return h(t.apply(M(this),e))}}function nt(t){return typeof t=="function"?tt(t):(t instanceof IDBTransaction&&et(t),Ye(t,qe())?new Proxy(t,U):t)}function h(t){if(t instanceof IDBRequest)return Qe(t);if(F.has(t))return F.get(t);let e=nt(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}var M=t=>V.get(t);function _e(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(t,e),l=h(o);return r&&o.addEventListener("upgradeneeded",c=>{r(h(o.result),c.oldVersion,c.newVersion,h(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",d=>i(d.oldVersion,d.newVersion,d))}).catch(()=>{}),l}var rt=["get","getKey","getAll","getAllKeys","count"],it=["put","add","delete","clear"],j=new Map;function ye(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(j.get(e))return j.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=it.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||rt.includes(n)))return;let s=async function(o,...l){let c=this.transaction(o,i?"readwrite":"readonly"),d=c.store;return r&&(d=d.index(l.shift())),(await Promise.all([d[n](...l),i&&c.done]))[0]};return j.set(e,s),s}be(t=>({...t,get:(e,n,r)=>ye(e,n)||t.get(e,n,r),has:(e,n)=>!!ye(e,n)||t.has(e,n)}));var J=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(st(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};function st(t){return t.getComponent()?.type==="VERSION"}var K="@firebase/app",Ee="0.14.2";var p=new T("@firebase/app"),ot="@firebase/app-compat",at="@firebase/analytics-compat",ct="@firebase/analytics",ft="@firebase/app-check-compat",lt="@firebase/app-check",dt="@firebase/auth",ut="@firebase/auth-compat",ht="@firebase/database",pt="@firebase/data-connect",mt="@firebase/database-compat",gt="@firebase/functions",bt="@firebase/functions-compat",yt="@firebase/installations",_t="@firebase/installations-compat",Et="@firebase/messaging",wt="@firebase/messaging-compat",Ct="@firebase/performance",vt="@firebase/performance-compat",Dt="@firebase/remote-config",St="@firebase/remote-config-compat",At="@firebase/storage",It="@firebase/storage-compat",Ot="@firebase/firestore",xt="@firebase/ai",Bt="@firebase/firestore-compat",Tt="firebase",Mt="12.2.0";var Z="[DEFAULT]",Nt={[K]:"fire-core",[ot]:"fire-core-compat",[ct]:"fire-analytics",[at]:"fire-analytics-compat",[lt]:"fire-app-check",[ft]:"fire-app-check-compat",[dt]:"fire-auth",[ut]:"fire-auth-compat",[ht]:"fire-rtdb",[pt]:"fire-data-connect",[mt]:"fire-rtdb-compat",[gt]:"fire-fn",[bt]:"fire-fn-compat",[yt]:"fire-iid",[_t]:"fire-iid-compat",[Et]:"fire-fcm",[wt]:"fire-fcm-compat",[Ct]:"fire-perf",[vt]:"fire-perf-compat",[Dt]:"fire-rc",[St]:"fire-rc-compat",[At]:"fire-gcs",[It]:"fire-gcs-compat",[Ot]:"fire-fst",[Bt]:"fire-fst-compat",[xt]:"fire-vertex","fire-js":"fire-js",[Tt]:"fire-js-all"};var N=new Map,Rt=new Map,Y=new Map;function we(t,e){try{t.container.addComponent(e)}catch(n){p.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function q(t){let e=t.name;if(Y.has(e))return p.debug(`There were multiple attempts to register component ${e}.`),!1;Y.set(e,t);for(let n of N.values())we(n,t);for(let n of Rt.values())we(n,t);return!0}function On(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function xn(t){return t==null?!1:t.settings!==void 0}var Lt={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},g=new v("app","Firebase",Lt);var X=class{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new _("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw g.create("app-deleted",{appName:this._name})}};var Bn=Mt;function kt(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:Z,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw g.create("bad-app-name",{appName:String(i)});if(n||(n=$()),!n)throw g.create("no-options");let s=N.get(i);if(s){if(x(n,s.options)&&x(r,s.config))return s;throw g.create("duplicate-app",{appName:i})}let o=new B(i);for(let c of Y.values())o.addComponent(c);let l=new X(n,r,o);return N.set(i,l),l}function Tn(t=Z){let e=N.get(t);if(!e&&t===Z&&$())return kt();if(!e)throw g.create("no-app",{appName:t});return e}function W(t,e,n){let r=Nt[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),p.warn(o.join(" "));return}q(new _(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}var Pt="firebase-heartbeat-database",$t=1,D="firebase-heartbeat-store",G=null;function Se(){return G||(G=_e(Pt,$t,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(D)}catch(n){console.warn(n)}}}}).catch(t=>{throw g.create("idb-open",{originalErrorMessage:t.message})})),G}async function Ht(t){try{let n=(await Se()).transaction(D),r=await n.objectStore(D).get(Ae(t));return await n.done,r}catch(e){if(e instanceof b)p.warn(e.message);else{let n=g.create("idb-get",{originalErrorMessage:e?.message});p.warn(n.message)}}}async function Ce(t,e){try{let r=(await Se()).transaction(D,"readwrite");await r.objectStore(D).put(e,Ae(t)),await r.done}catch(n){if(n instanceof b)p.warn(n.message);else{let r=g.create("idb-set",{originalErrorMessage:n?.message});p.warn(r.message)}}}function Ae(t){return`${t.name}!${t.options.appId}`}var Ft=1024,zt=30,Q=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new ee(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=ve();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>zt){let i=Vt(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){p.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=ve(),{heartbeatsToSend:n,unsentEntries:r}=Ut(this._heartbeatsCache.heartbeats),i=C(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return p.warn(e),""}}};function ve(){return new Date().toISOString().substring(0,10)}function Ut(t,e=Ft){let n=[],r=t.slice();for(let i of t){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),De(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),De(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var ee=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return de()?ue().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await Ht(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ce(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ce(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};function De(t){return C(JSON.stringify({version:2,heartbeats:t})).length}function Vt(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function jt(t){q(new _("platform-logger",e=>new J(e),"PRIVATE")),q(new _("heartbeat",e=>new Q(e),"PRIVATE")),W(K,Ee,t),W(K,Ee,"esm2020"),W("fire-js","")}jt("");export{fe as a,Re as b,Jt as c,Kt as d,Le as e,Zt as f,Yt as g,qt as h,le as i,Xt as j,Qt as k,en as l,tn as m,nn as n,rn as o,b as p,v as q,sn as r,x as s,on as t,an as u,cn as v,fn as w,dn as x,_ as y,f as z,T as A,q as B,On as C,xn as D,Bn as E,kt as F,Tn as G,W as H};
@@ -0,0 +1,237 @@
1
+ Bundled license information:
2
+
3
+ @firebase/util/dist/index.esm.js:
4
+ @firebase/util/dist/index.esm.js:
5
+ @firebase/util/dist/index.esm.js:
6
+ @firebase/util/dist/index.esm.js:
7
+ @firebase/util/dist/index.esm.js:
8
+ @firebase/util/dist/index.esm.js:
9
+ @firebase/util/dist/index.esm.js:
10
+ @firebase/util/dist/index.esm.js:
11
+ @firebase/util/dist/index.esm.js:
12
+ @firebase/logger/dist/esm/index.esm.js:
13
+ /**
14
+ * @license
15
+ * Copyright 2017 Google LLC
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+
30
+ @firebase/util/dist/index.esm.js:
31
+ /**
32
+ * @license
33
+ * Copyright 2022 Google LLC
34
+ *
35
+ * Licensed under the Apache License, Version 2.0 (the "License");
36
+ * you may not use this file except in compliance with the License.
37
+ * You may obtain a copy of the License at
38
+ *
39
+ * http://www.apache.org/licenses/LICENSE-2.0
40
+ *
41
+ * Unless required by applicable law or agreed to in writing, software
42
+ * distributed under the License is distributed on an "AS IS" BASIS,
43
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
+ * See the License for the specific language governing permissions and
45
+ * limitations under the License.
46
+ */
47
+ /**
48
+ * @license
49
+ * Copyright 2017 Google LLC
50
+ *
51
+ * Licensed under the Apache License, Version 2.0 (the "License");
52
+ * you may not use this file except in compliance with the License.
53
+ * You may obtain a copy of the License at
54
+ *
55
+ * http://www.apache.org/licenses/LICENSE-2.0
56
+ *
57
+ * Unless required by applicable law or agreed to in writing, software
58
+ * distributed under the License is distributed on an "AS IS" BASIS,
59
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60
+ * See the License for the specific language governing permissions and
61
+ * limitations under the License.
62
+ */
63
+ /**
64
+ * @license
65
+ * Copyright 2025 Google LLC
66
+ *
67
+ * Licensed under the Apache License, Version 2.0 (the "License");
68
+ * you may not use this file except in compliance with the License.
69
+ * You may obtain a copy of the License at
70
+ *
71
+ * http://www.apache.org/licenses/LICENSE-2.0
72
+ *
73
+ * Unless required by applicable law or agreed to in writing, software
74
+ * distributed under the License is distributed on an "AS IS" BASIS,
75
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76
+ * See the License for the specific language governing permissions and
77
+ * limitations under the License.
78
+ */
79
+ /**
80
+ * @license
81
+ * Copyright 2021 Google LLC
82
+ *
83
+ * Licensed under the Apache License, Version 2.0 (the "License");
84
+ * you may not use this file except in compliance with the License.
85
+ * You may obtain a copy of the License at
86
+ *
87
+ * http://www.apache.org/licenses/LICENSE-2.0
88
+ *
89
+ * Unless required by applicable law or agreed to in writing, software
90
+ * distributed under the License is distributed on an "AS IS" BASIS,
91
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92
+ * See the License for the specific language governing permissions and
93
+ * limitations under the License.
94
+ */
95
+
96
+ @firebase/util/dist/index.esm.js:
97
+ /**
98
+ * @license
99
+ * Copyright 2022 Google LLC
100
+ *
101
+ * Licensed under the Apache License, Version 2.0 (the "License");
102
+ * you may not use this file except in compliance with the License.
103
+ * You may obtain a copy of the License at
104
+ *
105
+ * http://www.apache.org/licenses/LICENSE-2.0
106
+ *
107
+ * Unless required by applicable law or agreed to in writing, software
108
+ * distributed under the License is distributed on an "AS IS" BASIS,
109
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110
+ * See the License for the specific language governing permissions and
111
+ * limitations under the License.
112
+ */
113
+
114
+ @firebase/util/dist/index.esm.js:
115
+ @firebase/component/dist/esm/index.esm.js:
116
+ @firebase/app/dist/esm/index.esm.js:
117
+ @firebase/app/dist/esm/index.esm.js:
118
+ /**
119
+ * @license
120
+ * Copyright 2019 Google LLC
121
+ *
122
+ * Licensed under the Apache License, Version 2.0 (the "License");
123
+ * you may not use this file except in compliance with the License.
124
+ * You may obtain a copy of the License at
125
+ *
126
+ * http://www.apache.org/licenses/LICENSE-2.0
127
+ *
128
+ * Unless required by applicable law or agreed to in writing, software
129
+ * distributed under the License is distributed on an "AS IS" BASIS,
130
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131
+ * See the License for the specific language governing permissions and
132
+ * limitations under the License.
133
+ */
134
+
135
+ @firebase/util/dist/index.esm.js:
136
+ /**
137
+ * @license
138
+ * Copyright 2020 Google LLC
139
+ *
140
+ * Licensed under the Apache License, Version 2.0 (the "License");
141
+ * you may not use this file except in compliance with the License.
142
+ * You may obtain a copy of the License at
143
+ *
144
+ * http://www.apache.org/licenses/LICENSE-2.0
145
+ *
146
+ * Unless required by applicable law or agreed to in writing, software
147
+ * distributed under the License is distributed on an "AS IS" BASIS,
148
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
+ * See the License for the specific language governing permissions and
150
+ * limitations under the License.
151
+ */
152
+
153
+ @firebase/util/dist/index.esm.js:
154
+ /**
155
+ * @license
156
+ * Copyright 2021 Google LLC
157
+ *
158
+ * Licensed under the Apache License, Version 2.0 (the "License");
159
+ * you may not use this file except in compliance with the License.
160
+ * You may obtain a copy of the License at
161
+ *
162
+ * http://www.apache.org/licenses/LICENSE-2.0
163
+ *
164
+ * Unless required by applicable law or agreed to in writing, software
165
+ * distributed under the License is distributed on an "AS IS" BASIS,
166
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
+ * See the License for the specific language governing permissions and
168
+ * limitations under the License.
169
+ */
170
+
171
+ @firebase/app/dist/esm/index.esm.js:
172
+ /**
173
+ * @license
174
+ * Copyright 2019 Google LLC
175
+ *
176
+ * Licensed under the Apache License, Version 2.0 (the "License");
177
+ * you may not use this file except in compliance with the License.
178
+ * You may obtain a copy of the License at
179
+ *
180
+ * http://www.apache.org/licenses/LICENSE-2.0
181
+ *
182
+ * Unless required by applicable law or agreed to in writing, software
183
+ * distributed under the License is distributed on an "AS IS" BASIS,
184
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ * See the License for the specific language governing permissions and
186
+ * limitations under the License.
187
+ */
188
+ /**
189
+ * @license
190
+ * Copyright 2023 Google LLC
191
+ *
192
+ * Licensed under the Apache License, Version 2.0 (the "License");
193
+ * you may not use this file except in compliance with the License.
194
+ * You may obtain a copy of the License at
195
+ *
196
+ * http://www.apache.org/licenses/LICENSE-2.0
197
+ *
198
+ * Unless required by applicable law or agreed to in writing, software
199
+ * distributed under the License is distributed on an "AS IS" BASIS,
200
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ * See the License for the specific language governing permissions and
202
+ * limitations under the License.
203
+ */
204
+
205
+ @firebase/app/dist/esm/index.esm.js:
206
+ /**
207
+ * @license
208
+ * Copyright 2021 Google LLC
209
+ *
210
+ * Licensed under the Apache License, Version 2.0 (the "License");
211
+ * you may not use this file except in compliance with the License.
212
+ * You may obtain a copy of the License at
213
+ *
214
+ * http://www.apache.org/licenses/LICENSE-2.0
215
+ *
216
+ * Unless required by applicable law or agreed to in writing, software
217
+ * distributed under the License is distributed on an "AS IS" BASIS,
218
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
+ * See the License for the specific language governing permissions and
220
+ * limitations under the License.
221
+ */
222
+ /**
223
+ * @license
224
+ * Copyright 2019 Google LLC
225
+ *
226
+ * Licensed under the Apache License, Version 2.0 (the "License");
227
+ * you may not use this file except in compliance with the License.
228
+ * You may obtain a copy of the License at
229
+ *
230
+ * http://www.apache.org/licenses/LICENSE-2.0
231
+ *
232
+ * Unless required by applicable law or agreed to in writing, software
233
+ * distributed under the License is distributed on an "AS IS" BASIS,
234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
235
+ * See the License for the specific language governing permissions and
236
+ * limitations under the License.
237
+ */
@@ -0,0 +1,5 @@
1
+ import{f as c}from"./chunk-ORXEMIQC.js";import{a as p,b,c as g,g as E,i as C,n as x,p as _,q as A,r as w,s as h,u,v as D}from"./chunk-EGEB6N4J.js";var q="tasks",H=20;function K(){let t=window.firebase.db,e=window.__ROOT_CTX.rootConfig.projectId;return g(t,"Projects",e)}function T(t){let e=window.firebase.db,n=window.__ROOT_CTX.rootConfig.projectId;return g(e,"Projects",n,"Tasks",t)}function N(){let t=window.firebase.db,e=window.__ROOT_CTX.rootConfig.projectId;return g(t,"Projects",e,"Counters",q)}function v(){let t=window.firebase.db,e=window.__ROOT_CTX.rootConfig.projectId;return b(t,"Projects",e,"Tasks")}function O(t){let e=window.firebase.db,n=window.__ROOT_CTX.rootConfig.projectId;return b(e,"Projects",n,"Tasks",t,"Comments")}function P(t,e){let n=window.firebase.db,s=window.__ROOT_CTX.rootConfig.projectId;return g(n,"Projects",s,"Tasks",t,"Comments",e)}function R(t){let e=window.firebase.db,n=window.__ROOT_CTX.rootConfig.projectId;return b(e,"Projects",n,"Tasks",t,"Events")}function G(t){return g(R(t))}async function J(){let t=await x(K());return t.exists()&&(t.data()||{}).settings?.defaultAssignee||null}async function st(t){if(!t.title)throw new Error("missing task title");let e=window.firebase.db,n=t.assignee??await J(),s=t.priority||"normal",a="new",i=L(t.targetLaunchDate),d=await h(e,async r=>{let o=N(),l=(await r.get(o)).data()||{},f=typeof l.lastTaskId=="number"?l.lastTaskId:0,k=Math.floor(f)+1;for(let B=0;B<H;B++){let j=T(String(k));if(!(await r.get(j)).exists())return r.set(o,{lastTaskId:k,updatedAt:u()},{merge:!0}),r.set(j,{id:String(k),title:t.title,description:t.description||"",assignee:n??null,priority:s,status:a,targetLaunchDate:i,createdAt:u(),createdBy:window.firebase.user.email||"",updatedAt:u(),updatedBy:window.firebase.user.email||""}),String(k);k+=1}throw new Error("unable to allocate a task id")});return c("tasks.create",{metadata:{taskId:d}}),d}function L(t){return t instanceof Date?p.fromDate(t):t??null}function Q(t){let e=W(t);return!["closed","complete","completed","done","resolved"].includes(e)}function W(t){let e=(t||"new").trim().toLowerCase();return e==="open"?"new":e==="blocked"?"in-progress":["done","complete","completed","resolved"].includes(e)?"closed":e}function Y(t){return t.sort((e,n)=>{let s=e.createdAt?.toMillis?.()||0;return(n.createdAt?.toMillis?.()||0)-s})}function M(t){return Y(t.docs.map(e=>({...e.data(),id:e.id})))}function at(t,e){return w(v(),n=>{t(M(n))},e)}function it(t,e){return w(v(),n=>{t(M(n).filter(s=>Q(s.status)))},e)}function rt(t,e,n){return w(T(t),s=>{if(!s.exists()){e(null);return}e({...s.data(),id:s.id})},n)}function ot(t,e,n){return w(E(O(t),C("createdAt","asc")),s=>{e(s.docs.map(a=>({...a.data(),id:a.id})))},n)}function dt(t,e,n){return w(E(R(t),C("createdAt","asc")),s=>{e(s.docs.map(a=>({...a.data(),id:a.id})))},n)}async function ct(t,e){if(!t)throw new Error("missing task id");let n=e?.trim()||null;await y(t,"assignee",n)&&c("tasks.updateAssignee",{metadata:{taskId:t,assignee:n}})}async function ut(t,e){if(!t)throw new Error("missing task id");let n=e.trim();if(!n)throw new Error("missing title");await y(t,"title",n)&&c("tasks.updateTitle",{metadata:{taskId:t}})}async function mt(t,e){if(!t)throw new Error("missing task id");if(!e)throw new Error("missing status");let n=e.trim();await y(t,"status",n)&&c("tasks.updateStatus",{metadata:{taskId:t,status:e}})}async function lt(t,e){if(!t)throw new Error("missing task id");await y(t,"priority",e)&&c("tasks.updatePriority",{metadata:{taskId:t,priority:e}})}async function ft(t,e){if(!t)throw new Error("missing task id");let n=L(e);await y(t,"targetLaunchDate",n)&&c("tasks.updateTargetLaunchDate",{metadata:{taskId:t}})}async function pt(t,e){if(!t)throw new Error("missing task id");await A(T(t),{description:e,updatedAt:u(),updatedBy:window.firebase.user.email||""}),c("tasks.updateDescription",{metadata:{taskId:t}})}async function gt(t,e){if(!t)throw new Error("missing task id");if(!e?.src)throw new Error("missing attachment file");let n=window.firebase.db,s=T(t),a=window.firebase.user.email||"",i={...e,id:g(R(t)).id,attachedAt:p.now(),attachedBy:a};return await h(n,async d=>{let r=await d.get(s);if(!r.exists())throw new Error("task not found");let o=r.data(),m=S(o.attachments);d.update(s,{attachments:[...m,i],updatedAt:u(),updatedBy:a})}),c("tasks.attachment.add",{metadata:{taskId:t,attachmentId:i.id,filename:i.filename||i.src}}),i}async function wt(t,e){if(!t||!e)throw new Error("missing task or attachment id");let n=window.firebase.db,s=T(t),a=window.firebase.user.email||"",i;await h(n,async r=>{let o=await r.get(s);if(!o.exists())throw new Error("task not found");let m=o.data(),l=S(m.attachments);return i=l.find(f=>f.id===e),i?(r.update(s,{attachments:l.filter(f=>f.id!==e),updatedAt:u(),updatedBy:a}),!0):!1})&&c("tasks.attachment.remove",{metadata:{taskId:t,attachmentId:e,filename:i?.filename||i?.src||""}})}async function y(t,e,n){let s=window.firebase.db,a=T(t),i=G(t),d=window.firebase.user.email||"";return h(s,async r=>{let o=await r.get(a);if(!o.exists())throw new Error("task not found");let m=o.data(),l=U(m[e]),f=U(n);return Z(l,f)?!1:(r.update(a,{[e]:f,updatedAt:u(),updatedBy:d}),r.set(i,{id:i.id,taskId:t,type:"metadata",field:e,oldValue:l,newValue:f,createdAt:u(),createdBy:d}),!0)})}function U(t){return t instanceof p||typeof t=="string"?t:null}function Z(t,e){return t instanceof p&&e instanceof p?t.toMillis()===e.toMillis():t===e}function S(t){return Array.isArray(t)?t.filter(e=>!!(e?.id&&e?.src)):[]}async function Tt(t,e,n,s){if(!t)throw new Error("missing task id");if(!e)throw new Error("missing comment content");let a=z(e),i=typeof e=="string"?e:F(e);if(!i.trim()&&!a)throw new Error("missing comment content");let d=g(O(t)),r=d.id,o=(s?.mentions||[]).map(m=>m.toLowerCase());return await _(d,{id:r,taskId:t,parentId:n||null,content:i,body:a,mentions:o,createdAt:u(),createdBy:window.firebase.user.email||"",history:[]}),c("tasks.comment.add",{metadata:{taskId:t,commentId:r,parentId:n||null,mentions:o}}),r}async function kt(t,e,n,s){if(!t||!e)throw new Error("missing task or comment id");if(!n)throw new Error("missing comment content");let a=z(n),i=typeof n=="string"?n:F(n);if(!i.trim()&&!a)throw new Error("missing comment content");let d=P(t,e),r=await x(d);if(!r.exists())throw new Error("comment not found");let o=r.data(),m=(s?.mentions||[]).map(l=>l.toLowerCase());await A(d,{content:i,body:a,mentions:m,updatedAt:u(),updatedBy:window.firebase.user.email||"",isDeleted:!1,history:D({action:"edit",content:o.content,body:o.body||null,changedAt:p.now(),changedBy:window.firebase.user.email||""})}),c("tasks.comment.edit",{metadata:{taskId:t,commentId:e,mentions:m}})}function z(t){return typeof t=="string"?null:t}function F(t){return t?.blocks?.length?t.blocks.map(e=>$(e)).filter(Boolean).join(`
2
+ `).trim():""}function $(t){switch(t.type){case"paragraph":case"heading":case"quote":return V(t.data?.text||"");case"orderedList":case"unorderedList":return(t.data?.items||[]).map(e=>X(e)).filter(Boolean).join(`
3
+ `);case"image":return t.data?.file?.alt||t.data?.file?.url||"";default:return""}}function X(t){let e=[V(t.content||"")];return t.items?.length&&e.push(t.items.map(n=>X(n)).filter(Boolean).join(`
4
+ `)),e.filter(Boolean).join(`
5
+ `)}function V(t){return t.replace(/<[^>]+>/g,"")}async function ht(t,e){if(!t||!e)throw new Error("missing task or comment id");let n=P(t,e),s=await x(n);if(!s.exists())throw new Error("comment not found");let a=s.data();await A(n,{content:"",isDeleted:!0,deletedAt:u(),deletedBy:window.firebase.user.email||"",history:D({action:"delete",content:a.content,changedAt:p.now(),changedBy:window.firebase.user.email||""})}),c("tasks.comment.delete",{metadata:{taskId:t,commentId:e}})}export{st as a,Q as b,W as c,at as d,it as e,rt as f,ot as g,dt as h,ct as i,ut as j,mt as k,lt as l,ft as m,pt as n,gt as o,wt as p,Tt as q,kt as r,ht as s};
@@ -0,0 +1 @@
1
+ import{a as k}from"./chunk-KFAZBEPV.js";import{b as B}from"./chunk-W3HIZQ4Z.js";import{a as H}from"./chunk-PJA7YP4A.js";import{g as D}from"./chunk-ORXEMIQC.js";import{a as b}from"./chunk-EGEB6N4J.js";import{f as C}from"./chunk-AL3TN2KI.js";import{Aa as E,Ac as U,Ea as F,F as M,Ga as L,Ha as t,U as w,V as N,a as d,c as v,ea as p,g as A,j as Y,ta as I,va as j,xa as O}from"./chunk-NZHF733K.js";import{d as z}from"./chunk-KUCVLANF.js";Y();var S=50,tt=[{value:"all",label:"All time"},{value:"1h",label:"Last hour"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function Q(e){let[a,o]=d(!0),[n,i]=d([]);return v(()=>{D(e?{limit:e}:void 0).then(r=>{i(r),o(!1)})},[e]),{loading:a,actions:n}}function xt(e){if(e.compact)return t(ot,{...e});let[a,o]=d(""),[n]=M(a,300),[i,r]=d([]),[m,q]=d([]),[g,G]=d("all"),[h,T]=d(1),{actions:l,loading:R}=Q(),X=A(()=>{let s=new Set;return l.forEach(c=>s.add(c.action)),Array.from(s).sort()},[l]),Z=A(()=>{let s=new Set;return l.forEach(c=>{c.by&&s.add(c.by)}),Array.from(s).sort()},[l]),u=A(()=>{let s=Date.now();return l.filter(c=>{if(n){let f=n.toLowerCase(),x=c.action.toLowerCase().includes(f),_=c.by?.toLowerCase().includes(f),K=ct(c.metadata).toLowerCase().includes(f);if(!x&&!_&&!K)return!1}if(i.length>0&&!i.includes(c.action)||m.length>0&&(!c.by||!m.includes(c.by)))return!1;if(g&&g!=="all"){let f=J(c.timestamp);if(!f)return!1;let x=f.toMillis(),_=0;switch(g){case"1h":_=s-3600*1e3;break;case"24h":_=s-1440*60*1e3;break;case"7d":_=s-10080*60*1e3;break;case"30d":_=s-720*60*60*1e3;break}if(x<_)return!1}return!0})},[l,n,i,m,g]),$=e.compact?1:Math.ceil(u.length/S),y=A(()=>{if(e.compact)return u;let s=(h-1)*S;return u.slice(s,s+S)},[u,h,e.compact]);return v(()=>{T(1)},[n,i,m,g]),R?t("div",{className:`ActionsLog ActionsLog--loading ${e.className||""}`,children:t(N,{color:"gray",size:"xl"})}):t("div",{className:`ActionsLog ${e.className||""}`,children:[!e.compact&&t("div",{className:"ActionsLog__tableHeader",children:[t("div",{className:"ActionsLog__filters",children:[t(j,{className:"ActionsLog__filters__search",placeholder:"Search actions...",icon:t(U,{size:16}),value:a,onChange:s=>o(s.target.value)}),t(I,{className:"ActionsLog__filters__select",placeholder:"Filter by action",clearable:!0,searchable:!0,data:X,value:i,onChange:r}),t(I,{className:"ActionsLog__filters__select",placeholder:"Filter by user",clearable:!0,searchable:!0,data:Z,value:m,onChange:q}),t(E,{className:"ActionsLog__filters__select",placeholder:"Filter by time",data:tt,value:g,onChange:G})]}),t("div",{className:"ActionsLog__summary",children:["Showing ",y.length," of ",u.length," ","actions",u.length!==l.length&&` (filtered from ${l.length} total)`]})]}),t(H,{className:"ActionsLog__tableSurface",children:t(F,{className:"ActionsLog__table",children:[t("thead",{children:t("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[t("th",{className:"ActionsLogs__table__header",children:"Timestamp"}),t("th",{className:"ActionsLogs__table__header",children:"User"}),t("th",{className:"ActionsLogs__table__header",children:"Action"}),t("th",{className:"ActionsLogs__table__header",children:"Details"}),t("th",{className:"ActionsLogs__table__header",children:"Links"})]})}),t("tbody",{children:[y.map((s,c)=>t("tr",{className:"ActionsLogs__table__row",children:[t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:V(s.timestamp)}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t("span",{className:"ActionsLogs__user",children:s.by?t(z,{children:[t(k,{email:s.by,size:20}),t("span",{className:"ActionsLogs__user__email",children:s.by})]}):"\u2014"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--action",children:t("span",{className:"ActionsLogs__action",children:s.action})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--metadata",children:t(W,{metadata:s.metadata})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--links",children:t(P,{action:s})})]},c)),y.length===0&&t("tr",{children:t("td",{colSpan:5,className:"ActionsLogs__table__col ActionsLogs__table__col--empty",children:"No actions found matching your filters."})})]})]})}),!e.compact&&$>1&&t("div",{className:"ActionsLog__pagination",children:t(O,{total:$,value:h,onChange:T,size:"sm"})})]})}function W(e){let{metadata:a}=e;if(!a||Object.keys(a).length===0)return t("span",{className:"ActionsLogs__metadata--empty",children:"\u2014"});let o=Object.entries(a);return t("div",{className:"ActionsLogs__metadata",children:o.map(([n,i])=>t("div",{className:"ActionsLogs__metadata__item",children:[t("span",{className:"ActionsLogs__metadata__key",children:[n,":"]})," ",t("span",{className:"ActionsLogs__metadata__value",children:et(i)})]},n))})}function et(e){if(e==null)return"\u2014";if(Array.isArray(e))return e.length===0?"[]":e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} (+${e.length-3} more)`;if(typeof e=="object"){let a=at(e);try{return JSON.stringify(a)}catch(o){console.error(o),console.error("failed to stringify json:",a)}}return String(e)}function at(e){let a={};return Object.entries(e).forEach(([o,n])=>{o.startsWith("_")||(a[o]=n)}),a}function P(e){let{action:a}=e,o=[];function n(i){return e.label||i}return a.action!=="doc.delete"&&a.metadata?.docId&&o.push(t(L,{transition:"pop",label:a.metadata.docId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${a.metadata.docId}`,children:n("Open doc")})},"doc")),a.action!=="datasource.delete"&&a.metadata?.datasourceId&&o.push(t(L,{transition:"pop",label:a.metadata.datasourceId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${a.metadata.datasourceId}`,children:n("Open data source")})},"datasource")),a.action!=="release.delete"&&a.metadata?.releaseId&&o.push(t(L,{transition:"pop",label:a.metadata.releaseId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${a.metadata.releaseId}`,children:n("Open release")})},"release")),a.metadata?.sheetId&&o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:B(a.metadata.sheetId),target:"_blank",children:n("Open sheet")},"sheet")),a.action.startsWith("acls.")&&o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:n("Open settings")},"settings")),a.links&&a.links.forEach((i,r)=>{o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:i.url,target:i.target,children:i.label},`link-${r}`))}),o.length===0?t("span",{className:"ActionsLogs__links--empty"}):(e.limit&&(o=o.slice(0,e.limit)),t("div",{className:"ActionsLogs__table__buttons",children:o}))}function ot(e){let{actions:a,loading:o}=Q(e.limit||10);return o?t("div",{className:C(e.className,"ActionLogsCompact","ActionLogsCompact--loading"),children:t(N,{color:"gray",size:"xl"})}):t("div",{className:C(e.className,"ActionLogsCompact"),children:t(w,{className:"ActionLogsCompact__table",multiple:!0,children:a.map((n,i)=>t(w.Item,{label:t(nt,{action:n}),children:t(st,{action:n})},i))})})}function nt(e){let a=e.action,o=it(a),n=e.action.by||"";return t("div",{className:"ActionLogsCompactItemPreview",children:[t("div",{className:"ActionLogsCompactItemPreview__user",children:t(k,{email:n,size:20})}),t("div",{className:"ActionLogsCompactItemPreview__timestamp",children:V(a.timestamp)}),t("div",{className:"ActionLogsCompactItemPreview__action",children:a.action}),t("div",{className:"ActionLogsCompactItemPreview__actionMetaId",children:o}),t("div",{className:"ActionLogsCompactItemPreview__buttons",children:t(P,{action:a,label:"Open",limit:1})})]})}function st(e){let a=e.action,o={user:a.by,...a.metadata};return t("div",{className:"ActionLogsCompactItemDetails",children:[t(W,{metadata:o}),t(P,{action:a})]})}function it(e){for(let a of Object.keys(e.metadata||{}))if(a.toLowerCase().endsWith("id"))return e.metadata[a];return""}function J(e){return e?e instanceof b?e:typeof e=="object"&&typeof e._seconds=="number"?new b(e._seconds,e._nanoseconds||0):typeof e=="object"&&typeof e.seconds=="number"?new b(e.seconds,e.nanoseconds||0):typeof e=="number"?b.fromMillis(e):null:null}function V(e){let a=J(e);if(!a)return"Invalid date";let o=a.toDate(),n=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0"),r=String(o.getHours()).padStart(2,"0"),m=String(o.getMinutes()).padStart(2,"0");return`${n}/${i} ${r}:${m}`}function ct(e){function a(o){return o===null?"null":typeof o>"u"?"undefined":typeof o=="string"?`"${o.replaceAll('"','\\"')}"`:typeof o!="object"?String(o):Array.isArray(o)?`[${o.map(a).join(", ")}]`:`{${Object.entries(o).map(([i,r])=>`${i}: ${a(r)}`).join(", ")}}`}return a(e)}export{xt as a};