@blinkk/root-cms 3.1.4 → 3.1.5

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 (102) hide show
  1. package/dist/app.js +3 -2
  2. package/dist/{chunk-NC3CRIFA.js → chunk-6CTCV2PN.js} +1 -1
  3. package/dist/{chunk-AFBSITEO.js → chunk-ETHWZSNM.js} +4 -0
  4. package/dist/{chunk-MYN76V3L.js → chunk-MUXSUGFF.js} +2 -2
  5. package/dist/cli.js +1 -1
  6. package/dist/client.js +1 -1
  7. package/dist/core/schema.d.ts +88 -3
  8. package/dist/core.js +1 -1
  9. package/dist/functions.js +2 -2
  10. package/dist/plugin.js +3 -3
  11. package/dist/ui/AIPage-25WICIOT.js +1 -0
  12. package/dist/ui/{AssetsPage-QUL2NBWK.js → AssetsPage-WKTM2J2G.js} +1 -1
  13. package/dist/ui/CollectionPage-5ZOVG7IG.js +1 -0
  14. package/dist/ui/{ComparePage-DCP5QHDE.js → ComparePage-DDIFYYTK.js} +1 -1
  15. package/dist/ui/{DataPage-TUVFBALT.js → DataPage-RFNGSDDN.js} +1 -1
  16. package/dist/ui/{DataSourcePage-YE2ZOHYI.js → DataSourcePage-U46CDIH2.js} +1 -1
  17. package/dist/ui/{DocTranslationsPage-3ILTQOP2.js → DocTranslationsPage-BFCM2PE3.js} +1 -1
  18. package/dist/ui/{DocumentPage-JFQ3Y2GH.js → DocumentPage-OTBXM55S.js} +1 -1
  19. package/dist/ui/{EditDataSourcePage-WHPZDMD4.js → EditDataSourcePage-NKKIF6AD.js} +1 -1
  20. package/dist/ui/EditReleasePage-TKNOUT7A.js +1 -0
  21. package/dist/ui/EmbeddedAIPage-4AX7VO3T.js +1 -0
  22. package/dist/ui/{EmbeddedDocumentPage-6FYHUHTE.js → EmbeddedDocumentPage-2CNQJTW5.js} +1 -1
  23. package/dist/ui/{ImageEditorDialog-Q44YTLB5.js → ImageEditorDialog-YDKOGVJV.js} +1 -1
  24. package/dist/ui/LogsPage-SCECIAZH.js +1 -0
  25. package/dist/ui/{NewDataSourcePage-QXW54CHQ.js → NewDataSourcePage-FAOPK2RZ.js} +1 -1
  26. package/dist/ui/NewReleasePage-HD6T6UV2.js +1 -0
  27. package/dist/ui/{NotFoundPage-RMNPVSD3.js → NotFoundPage-JRYFUENW.js} +1 -1
  28. package/dist/ui/{ProjectPage-VY4EJX6J.js → ProjectPage-2WIMWCSX.js} +1 -1
  29. package/dist/ui/ReleasePage-GUMEMLF6.js +1 -0
  30. package/dist/ui/{ReleasesPage-A4BLUNJE.js → ReleasesPage-AW6PICTQ.js} +1 -1
  31. package/dist/ui/{SettingsPage-MP3YHQDP.js → SettingsPage-KFLNZ356.js} +1 -1
  32. package/dist/ui/{SidebarToolsPage-S5DMIEQ6.js → SidebarToolsPage-3R7BQ2F7.js} +1 -1
  33. package/dist/ui/{TaskPage-LCBDMA4I.js → TaskPage-GZGPKIL5.js} +1 -1
  34. package/dist/ui/TasksPage-G3GBTV3L.js +1 -0
  35. package/dist/ui/{TranslationsArbPage-B7TIRREV.js → TranslationsArbPage-K272JEAA.js} +1 -1
  36. package/dist/ui/{TranslationsEditPage-VQG4YHA6.js → TranslationsEditPage-XWXPNKRQ.js} +1 -1
  37. package/dist/ui/{TranslationsPage-6VCVMNXI.js → TranslationsPage-7KUHVTLK.js} +1 -1
  38. package/dist/ui/{chunk-IMXZTYAA.js → chunk-2FQMT5AB.js} +1 -1
  39. package/dist/ui/{chunk-EYVQCOAD.js → chunk-2PTLQRTU.js} +1 -1
  40. package/dist/ui/{chunk-FF4CLAZS.js → chunk-2RRM4HEQ.js} +1 -1
  41. package/dist/ui/{chunk-MAZJRNAL.js → chunk-34W6H4YG.js} +1 -1
  42. package/dist/ui/{chunk-L3O3CLWO.js → chunk-44ZU5WMI.js} +1 -1
  43. package/dist/ui/{chunk-MYKJ6VAM.js → chunk-535JU7FU.js} +1 -1
  44. package/dist/ui/{chunk-JSWRHHTZ.js → chunk-5KSGCGYY.js} +1 -1
  45. package/dist/ui/{chunk-UHK5N75L.js → chunk-75NMQ3LW.js} +1 -1
  46. package/dist/ui/{chunk-W2ZAVRAT.js → chunk-7UHZS56B.js} +57 -57
  47. package/dist/ui/{chunk-76PG55CM.js → chunk-DWV5J2W7.js} +1 -1
  48. package/dist/ui/{chunk-VB5VMEN7.js → chunk-F7RQT4XN.js} +1 -1
  49. package/dist/ui/{chunk-CSUKZZK5.js → chunk-FVWSVOOY.js} +1 -1
  50. package/dist/ui/{chunk-V3G3554T.js → chunk-GCSN3YEC.js} +1 -1
  51. package/dist/ui/{chunk-74OB6FM4.js → chunk-H37RXS4R.js} +1 -1
  52. package/dist/ui/{chunk-LC6WLVRS.js → chunk-HV3JJ5UT.js} +1 -1
  53. package/dist/ui/{chunk-K3UM5OQF.js → chunk-HXSB6YB2.js} +1 -1
  54. package/dist/ui/{chunk-AZ2SK2ZK.js → chunk-IGZDFHVM.js} +1 -1
  55. package/dist/ui/chunk-ISUGBMXC.js +1 -0
  56. package/dist/ui/{chunk-WN7HUDGY.js → chunk-JBLSUM6W.js} +1 -1
  57. package/dist/ui/{chunk-F4F5MH7A.js → chunk-N5RJIILP.js} +1 -1
  58. package/dist/ui/{chunk-KBJ4AK5O.js → chunk-NCZD5IWS.js} +1 -1
  59. package/dist/ui/{chunk-NEA3XU6N.js → chunk-NXWYS4HG.js} +1 -1
  60. package/dist/ui/{chunk-4N6CPIOQ.js → chunk-OWBT6YUM.js} +1 -1
  61. package/dist/ui/chunk-OWYV43BT.js +1 -0
  62. package/dist/ui/{chunk-XM35ZJBQ.js → chunk-PIJ3E47R.js} +1 -1
  63. package/dist/ui/{chunk-WAT22UHZ.js → chunk-PLYSJ7W5.js} +1 -1
  64. package/dist/ui/{chunk-H3PYPGNR.js → chunk-QFDU6FXP.js} +1 -1
  65. package/dist/ui/{chunk-W3ICOHMF.js → chunk-QLIIVG5Q.js} +1 -1
  66. package/dist/ui/{chunk-ELKXEMOU.js → chunk-QRAFYIAW.js} +1 -1
  67. package/dist/ui/{chunk-VRRRFAIV.js → chunk-QWB6MAPJ.js} +1 -1
  68. package/dist/ui/{chunk-GCMX5V3P.js → chunk-RB23LLKL.js} +1 -1
  69. package/dist/ui/{chunk-3WQCVKK4.js → chunk-T5BJNOWE.js} +1 -1
  70. package/dist/ui/chunk-TNW2GNUR.js +1 -0
  71. package/dist/ui/{chunk-HVYNDEA7.js → chunk-UCYWQEAS.js} +1 -1
  72. package/dist/ui/{chunk-6P75AZ3B.js → chunk-UJX25CXD.js} +1 -1
  73. package/dist/ui/chunk-UPN3EMUS.js +1 -0
  74. package/dist/ui/{chunk-5SY2SVEX.js → chunk-VPZHG7JL.js} +1 -1
  75. package/dist/ui/{chunk-WS37MDM3.js → chunk-WASID5UU.js} +1 -1
  76. package/dist/ui/{chunk-2PDMFZBF.js → chunk-WC7KMPEQ.js} +1 -1
  77. package/dist/ui/chunk-WRA24P66.js +7 -0
  78. package/dist/ui/{chunk-ETPZ3TXX.js.LEGAL.txt → chunk-WRA24P66.js.LEGAL.txt} +4 -1
  79. package/dist/ui/{chunk-XJUQOX4E.js → chunk-XUBZH4ON.js} +1 -1
  80. package/dist/ui/{chunk-QHOZXW7Y.js → chunk-Y5EOMMNI.js} +1 -1
  81. package/dist/ui/{chunk-EIMRPYCD.js → chunk-YBHFGQ3Z.js} +1 -1
  82. package/dist/ui/{chunk-62VPTZJL.js → chunk-YP6ZH3MT.js} +1 -1
  83. package/dist/ui/{chunk-PR7NB5VK.js → chunk-Z3ZJJWFT.js} +1 -1
  84. package/dist/ui/ui.css +1 -1
  85. package/dist/ui/ui.js +1 -1
  86. package/package.json +3 -3
  87. package/dist/ui/AIPage-4W4MFELY.js +0 -1
  88. package/dist/ui/CollectionPage-7VU6SUUP.js +0 -1
  89. package/dist/ui/EditReleasePage-QKWHIURV.js +0 -1
  90. package/dist/ui/EmbeddedAIPage-SQLOV4IT.js +0 -1
  91. package/dist/ui/LogsPage-RC5O722W.js +0 -1
  92. package/dist/ui/NewReleasePage-TKYWVTOH.js +0 -1
  93. package/dist/ui/ReleasePage-VZAL4KUI.js +0 -1
  94. package/dist/ui/TasksPage-72KVSUQY.js +0 -1
  95. package/dist/ui/chunk-ETPZ3TXX.js +0 -7
  96. package/dist/ui/chunk-J5KDO4RM.js +0 -1
  97. package/dist/ui/chunk-SLLTYDVX.js +0 -1
  98. package/dist/ui/chunk-SWTNOWNE.js +0 -1
  99. package/dist/ui/chunk-YV5SGR24.js +0 -1
  100. /package/dist/ui/{ImageEditorDialog-Q44YTLB5.js.LEGAL.txt → ImageEditorDialog-YDKOGVJV.js.LEGAL.txt} +0 -0
  101. /package/dist/ui/{chunk-W2ZAVRAT.js.LEGAL.txt → chunk-7UHZS56B.js.LEGAL.txt} +0 -0
  102. /package/dist/ui/{chunk-5SY2SVEX.js.LEGAL.txt → chunk-VPZHG7JL.js.LEGAL.txt} +0 -0
@@ -1,3 +1,3 @@
1
- import{a as Z}from"./chunk-MYKJ6VAM.js";import{a as j}from"./chunk-JDW4UORS.js";import{a as Q,c as X,e as Y}from"./chunk-RN4XVVWD.js";import{c as K}from"./chunk-ATTW36EM.js";import{b as J}from"./chunk-EYVQCOAD.js";import{a as x}from"./chunk-XM35ZJBQ.js";import{d as W}from"./chunk-WS37MDM3.js";import{Ga as e,a as s,c as q,da as A,e as B,ea as P,j as re,na as b,pa as $,ua as F,va as V,za as S}from"./chunk-ETPZ3TXX.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(`
1
+ import{a as Z}from"./chunk-535JU7FU.js";import{a as j}from"./chunk-JDW4UORS.js";import{a as Q,c as X,e as Y}from"./chunk-RN4XVVWD.js";import{c as K}from"./chunk-ATTW36EM.js";import{b as J}from"./chunk-2PTLQRTU.js";import{a as x}from"./chunk-PIJ3E47R.js";import{d as W}from"./chunk-WASID5UU.js";import{Ga as e,a as s,c as q,da as A,e as B,ea as P,j as re,na as b,pa as $,ua as F,va as V,za as S}from"./chunk-WRA24P66.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
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
3
  `)}export{Ne as a};
@@ -1 +1 @@
1
- import{a as t}from"./chunk-XM35ZJBQ.js";function s(e){if(typeof e=="object"&&e!==null){let o=e;if(typeof o.code=="string"&&typeof o.message=="string")return`${o.code}: ${o.message}`;if(typeof o.body=="string")return o.body;if(typeof o.message=="string")return o.message}return String(e)}async function i(e){try{await e()}catch(o){console.error(o);let r=s(o);t({title:"Error",message:r,color:"red",autoClose:!1})}}export{s as a,i as b};
1
+ import{a as t}from"./chunk-PIJ3E47R.js";function s(e){if(typeof e=="object"&&e!==null){let o=e;if(typeof o.code=="string"&&typeof o.message=="string")return`${o.code}: ${o.message}`;if(typeof o.body=="string")return o.body;if(typeof o.message=="string")return o.message}return String(e)}async function i(e){try{await e()}catch(o){console.error(o);let r=s(o);t({title:"Error",message:r,color:"red",autoClose:!1})}}export{s as a,i as b};
@@ -1 +1 @@
1
- import{e as u}from"./chunk-WS37MDM3.js";import{Ga as m,a as l,c as P,g as p,j as h,wa as f}from"./chunk-ETPZ3TXX.js";h();function $(t,i){let{pageSize:n,resetDeps:o}=i,[s,r]=l(1),e=t.length,a=Math.max(1,Math.ceil(e/n)),g=Math.min(Math.max(s,1),a);P(()=>{r(1)},o??[]);let b=p(()=>{let c=(g-1)*n;return t.slice(c,c+n)},[t,g,n]),d=e===0?0:(g-1)*n+1,x=Math.min(g*n,e);return{page:g,setPage:r,totalPages:a,pageItems:b,totalItems:e,start:d,end:x}}function T(t){return t.total<=1?null:m("div",{className:u(t.className,"Pagination"),children:m(f,{total:t.total,value:t.page,onChange:t.onChange,size:"sm"})})}function z(t){let{start:i,end:n,total:o,noun:s,note:r}=t,e=o===1?s:`${s}s`,a;return o===0?a=`No ${s}s`:i===n?a=`Showing ${i} of ${o} ${e}`:a=`Showing ${i}\u2013${n} of ${o} ${e}`,m("div",{className:u(t.className,"Pagination__summary"),children:[a,r?` (${r})`:""]})}export{$ as a,T as b,z as c};
1
+ import{e as u}from"./chunk-WASID5UU.js";import{Ga as m,a as l,c as P,g as p,j as h,wa as f}from"./chunk-WRA24P66.js";h();function $(t,i){let{pageSize:n,resetDeps:o}=i,[s,r]=l(1),e=t.length,a=Math.max(1,Math.ceil(e/n)),g=Math.min(Math.max(s,1),a);P(()=>{r(1)},o??[]);let b=p(()=>{let c=(g-1)*n;return t.slice(c,c+n)},[t,g,n]),d=e===0?0:(g-1)*n+1,x=Math.min(g*n,e);return{page:g,setPage:r,totalPages:a,pageItems:b,totalItems:e,start:d,end:x}}function T(t){return t.total<=1?null:m("div",{className:u(t.className,"Pagination"),children:m(f,{total:t.total,value:t.page,onChange:t.onChange,size:"sm"})})}function z(t){let{start:i,end:n,total:o,noun:s,note:r}=t,e=o===1?s:`${s}s`,a;return o===0?a=`No ${s}s`:i===n?a=`Showing ${i} of ${o} ${e}`:a=`Showing ${i}\u2013${n} of ${o} ${e}`,m("div",{className:u(t.className,"Pagination__summary"),children:[a,r?` (${r})`:""]})}export{$ as a,T as b,z as c};
@@ -1 +1 @@
1
- import{a as b,c as w}from"./chunk-ELKXEMOU.js";import{a as p}from"./chunk-XM35ZJBQ.js";import{a}from"./chunk-KBJ4AK5O.js";import{b as z,f as I,g as C}from"./chunk-DZYYWCHX.js";import{Cc as N,Ga as n,V as v,a as c,c as y,da as m,j as L}from"./chunk-ETPZ3TXX.js";import{d as M}from"./chunk-KUCVLANF.js";L();var S="PruneTranslationsModal";function W(){let u=b(),o=w();return{open:r=>{u.openContextModal(S,{...o,title:`Prune unused strings from ${r.docId}`,innerProps:r,size:600})}}}function $(u){let{innerProps:o,context:r,id:f}=u,[l,h]=c(!0),[e,k]=c([]),[E,x]=c(!1);y(()=>{let s=!1;async function d(){let t=o.docId,g=await z({tags:[t]}),H=new Set(await Promise.all(o.sourceStrings.map(i=>C(i)))),T=[];for(let[i,P]of Object.entries(g))if(!H.has(i)){let _=P.tags||[];_.includes(t)&&T.push({hash:i,source:P.source||i,tags:_.filter(B=>B!==t)})}s||(k(T),h(!1))}return d().catch(t=>{console.error(t),s||h(!1)}),()=>{s=!0}},[o.docId,o.sourceStrings]);async function U(){if(e.length!==0){x(!0);try{let s=e.map(({hash:t,tags:g})=>({hash:t,tags:g}));await I(s,{mode:"replace"});let d=e.map(t=>t.hash);p({title:"Pruned translations",message:`Removed "${o.docId}" tag from ${d.length} unused translation(s).`,color:"green",autoClose:5e3}),o.onPruned?.(d),r.closeModal(f)}catch(s){console.error(s),p({title:"Error pruning translations",message:String(s),color:"red",autoClose:!1})}finally{x(!1)}}}return n("div",{className:"PruneTranslationsModal",children:[n("div",{className:"PruneTranslationsModal__description",children:n(a,{size:"body",children:["Pruning removes the ",n("strong",{children:o.docId})," tag from translation strings that are no longer referenced by this document. The translations themselves are not deleted and will remain available to other documents that still reference them."]})}),l&&n("div",{className:"PruneTranslationsModal__loading",children:[n(v,{color:"gray",size:"sm"}),n(a,{size:"body",color:"gray",children:"Scanning for unused strings\u2026"})]}),!l&&e.length===0&&n("div",{className:"PruneTranslationsModal__empty",children:n(a,{size:"body",color:"gray",children:['All translations tagged with "',o.docId,'" are still in use. Nothing to prune.']})}),!l&&e.length>0&&n(M,{children:[n(a,{size:"body",weight:"semi-bold",children:[e.length," unused string",e.length!==1?"s":""," will be untagged:"]}),n("div",{className:"PruneTranslationsModal__list",children:e.map(s=>n("div",{className:"PruneTranslationsModal__list__item",children:n(a,{size:"body-sm",children:s.source})},s.hash))})]}),n("div",{className:"PruneTranslationsModal__actions",children:[n(m,{variant:"default",size:"xs",onClick:()=>r.closeModal(f),children:"Cancel"}),n(m,{variant:"filled",size:"xs",color:"red",leftIcon:n(N,{size:14}),loading:E,disabled:l||e.length===0,onClick:U,children:["Prune ",e.length>0?e.length:""," string",e.length!==1?"s":""]})]})]})}$.id=S;export{W as a,$ as b};
1
+ import{a as b,c as w}from"./chunk-QRAFYIAW.js";import{a as p}from"./chunk-PIJ3E47R.js";import{a}from"./chunk-NCZD5IWS.js";import{b as z,f as I,g as C}from"./chunk-DZYYWCHX.js";import{Fc as N,Ga as n,V as v,a as c,c as y,da as m,j as L}from"./chunk-WRA24P66.js";import{d as M}from"./chunk-KUCVLANF.js";L();var S="PruneTranslationsModal";function W(){let u=b(),o=w();return{open:r=>{u.openContextModal(S,{...o,title:`Prune unused strings from ${r.docId}`,innerProps:r,size:600})}}}function $(u){let{innerProps:o,context:r,id:f}=u,[l,h]=c(!0),[e,k]=c([]),[E,x]=c(!1);y(()=>{let s=!1;async function d(){let t=o.docId,g=await z({tags:[t]}),H=new Set(await Promise.all(o.sourceStrings.map(i=>C(i)))),T=[];for(let[i,P]of Object.entries(g))if(!H.has(i)){let _=P.tags||[];_.includes(t)&&T.push({hash:i,source:P.source||i,tags:_.filter(B=>B!==t)})}s||(k(T),h(!1))}return d().catch(t=>{console.error(t),s||h(!1)}),()=>{s=!0}},[o.docId,o.sourceStrings]);async function U(){if(e.length!==0){x(!0);try{let s=e.map(({hash:t,tags:g})=>({hash:t,tags:g}));await I(s,{mode:"replace"});let d=e.map(t=>t.hash);p({title:"Pruned translations",message:`Removed "${o.docId}" tag from ${d.length} unused translation(s).`,color:"green",autoClose:5e3}),o.onPruned?.(d),r.closeModal(f)}catch(s){console.error(s),p({title:"Error pruning translations",message:String(s),color:"red",autoClose:!1})}finally{x(!1)}}}return n("div",{className:"PruneTranslationsModal",children:[n("div",{className:"PruneTranslationsModal__description",children:n(a,{size:"body",children:["Pruning removes the ",n("strong",{children:o.docId})," tag from translation strings that are no longer referenced by this document. The translations themselves are not deleted and will remain available to other documents that still reference them."]})}),l&&n("div",{className:"PruneTranslationsModal__loading",children:[n(v,{color:"gray",size:"sm"}),n(a,{size:"body",color:"gray",children:"Scanning for unused strings\u2026"})]}),!l&&e.length===0&&n("div",{className:"PruneTranslationsModal__empty",children:n(a,{size:"body",color:"gray",children:['All translations tagged with "',o.docId,'" are still in use. Nothing to prune.']})}),!l&&e.length>0&&n(M,{children:[n(a,{size:"body",weight:"semi-bold",children:[e.length," unused string",e.length!==1?"s":""," will be untagged:"]}),n("div",{className:"PruneTranslationsModal__list",children:e.map(s=>n("div",{className:"PruneTranslationsModal__list__item",children:n(a,{size:"body-sm",children:s.source})},s.hash))})]}),n("div",{className:"PruneTranslationsModal__actions",children:[n(m,{variant:"default",size:"xs",onClick:()=>r.closeModal(f),children:"Cancel"}),n(m,{variant:"filled",size:"xs",color:"red",leftIcon:n(N,{size:14}),loading:E,disabled:l||e.length===0,onClick:U,children:["Prune ",e.length>0?e.length:""," string",e.length!==1?"s":""]})]})]})}$.id=S;export{W as a,$ as b};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-H3PYPGNR.js";import{e as p}from"./chunk-WS37MDM3.js";import{Ga as o,Gb as u,U as _,g,j as b}from"./chunk-ETPZ3TXX.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
1
+ import{a as C}from"./chunk-QFDU6FXP.js";import{e as p}from"./chunk-WASID5UU.js";import{Ga as o,Jb as u,U as _,g,j as b}from"./chunk-WRA24P66.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
@@ -1 +1 @@
1
- import{L as m,a,c as f,j as O}from"./chunk-ETPZ3TXX.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};
1
+ import{L as m,a,c as f,j as O}from"./chunk-WRA24P66.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};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-MYKJ6VAM.js";import{a as $}from"./chunk-6P75AZ3B.js";import{h as w,i as A}from"./chunk-RN4XVVWD.js";import{a as C}from"./chunk-W5DOO6ID.js";import{a as B}from"./chunk-EIMRPYCD.js";import{a as v,b as S}from"./chunk-XM35ZJBQ.js";import{a as D,z as l}from"./chunk-XOWWPE7X.js";import{Fa as c,Ga as o,a as e,c as y,da as T,j as g}from"./chunk-ETPZ3TXX.js";g();g();function x(t){let i=k(t.timestamp),[s,a]=e(i>0?l(i,{style:"short"}):"never");return i?(y(()=>{let u=window.setInterval(()=>{a(l(i,{style:"short"}))},6e4);return()=>window.clearInterval(u)},[]),o(c,{transition:"pop",label:`${U(i)} by ${t.email}`,children:l(i,{style:"short"})})):o("div",{children:s})}function U(t){return new Date(t).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function k(t){return typeof t=="number"?t:t?.toMillis?t.toMillis():0}function et(t){let i=t.dataSource,[s,a]=e(!1),[u,N]=e(t.action==="sync"?i.syncedAt:i.publishedAt),[I,L]=e(t.action==="sync"?i.syncedBy:i.publishedBy),b=P(),{roles:_}=B(),E=window.firebase.user.email||"",m=C(_,E),d=t.action==="publish",r=!!i.archivedAt;async function M(){a(!0);let p=`data-source-${t.action}-${i.id}`;v({id:p,loading:!0,title:`Running Data Source ${t.action}`,message:`Updating ${i.id}...`,autoClose:!1,disallowClose:!0});try{t.action==="sync"?(i.type==="gsheet"&&!b.isLoggedIn()&&await b.login(),await w(i.id)):t.action==="publish"&&await A(i.id),N(D.now()),L(window.firebase.user.email),a(!1),t.onAction&&t.onAction(),S({id:p,title:"Success",message:`Updated Data Source ${i.id}`,autoClose:!1})}catch(n){console.error(n);let h=n;typeof n=="object"&&n.body&&(h=String(n.body)),a(!1),S({id:p,title:`Data Source ${t.action} failed`,message:String(h),color:"red",autoClose:!1})}}let f="";return t.action==="sync"?f="Sync data to a draft state":t.action==="publish"&&(f="Publish synced data to prod"),o("div",{className:"DataSourceStatusButton",children:[o("div",{className:"DataSourceStatusButton__label",children:!s&&o(x,{timestamp:u,email:I})}),o("div",{className:"DataSourceStatusButton__button",children:o($,{label:r?"Data source is archived":"You don't have access to publish this data source",condition:r||d&&!m,children:o(c,{transition:"pop",label:f,disabled:r||d&&!m,children:o(T,{variant:"default",size:"xs",compact:!0,onClick:()=>M(),loading:s,disabled:r||d&&!m,children:t.action})})})})]})}export{et as a};
1
+ import{a as P}from"./chunk-535JU7FU.js";import{a as $}from"./chunk-UJX25CXD.js";import{h as w,i as A}from"./chunk-RN4XVVWD.js";import{a as C}from"./chunk-W5DOO6ID.js";import{a as B}from"./chunk-YBHFGQ3Z.js";import{a as v,b as S}from"./chunk-PIJ3E47R.js";import{a as D,z as l}from"./chunk-XOWWPE7X.js";import{Fa as c,Ga as o,a as e,c as y,da as T,j as g}from"./chunk-WRA24P66.js";g();g();function x(t){let i=k(t.timestamp),[s,a]=e(i>0?l(i,{style:"short"}):"never");return i?(y(()=>{let u=window.setInterval(()=>{a(l(i,{style:"short"}))},6e4);return()=>window.clearInterval(u)},[]),o(c,{transition:"pop",label:`${U(i)} by ${t.email}`,children:l(i,{style:"short"})})):o("div",{children:s})}function U(t){return new Date(t).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function k(t){return typeof t=="number"?t:t?.toMillis?t.toMillis():0}function et(t){let i=t.dataSource,[s,a]=e(!1),[u,N]=e(t.action==="sync"?i.syncedAt:i.publishedAt),[I,L]=e(t.action==="sync"?i.syncedBy:i.publishedBy),b=P(),{roles:_}=B(),E=window.firebase.user.email||"",m=C(_,E),d=t.action==="publish",r=!!i.archivedAt;async function M(){a(!0);let p=`data-source-${t.action}-${i.id}`;v({id:p,loading:!0,title:`Running Data Source ${t.action}`,message:`Updating ${i.id}...`,autoClose:!1,disallowClose:!0});try{t.action==="sync"?(i.type==="gsheet"&&!b.isLoggedIn()&&await b.login(),await w(i.id)):t.action==="publish"&&await A(i.id),N(D.now()),L(window.firebase.user.email),a(!1),t.onAction&&t.onAction(),S({id:p,title:"Success",message:`Updated Data Source ${i.id}`,autoClose:!1})}catch(n){console.error(n);let h=n;typeof n=="object"&&n.body&&(h=String(n.body)),a(!1),S({id:p,title:`Data Source ${t.action} failed`,message:String(h),color:"red",autoClose:!1})}}let f="";return t.action==="sync"?f="Sync data to a draft state":t.action==="publish"&&(f="Publish synced data to prod"),o("div",{className:"DataSourceStatusButton",children:[o("div",{className:"DataSourceStatusButton__label",children:!s&&o(x,{timestamp:u,email:I})}),o("div",{className:"DataSourceStatusButton__button",children:o($,{label:r?"Data source is archived":"You don't have access to publish this data source",condition:r||d&&!m,children:o(c,{transition:"pop",label:f,disabled:r||d&&!m,children:o(T,{variant:"default",size:"xs",compact:!0,onClick:()=>M(),loading:s,disabled:r||d&&!m,children:t.action})})})})]})}export{et as a};
@@ -1 +1 @@
1
- import{b as N,f as R,g as U,i as H,j as O,k as P,m as j,o as M}from"./chunk-XOWWPE7X.js";import{a as u,c as C,e as G,h as A,j as F}from"./chunk-ETPZ3TXX.js";F();var X=200,Y=25,J=2;function ot(t,n={}){let[s,r]=u([]),[g,e]=u(!1),[o,h]=u(null),[y,a]=u(null),i=G(null),x=n.limit??Y,L=n.minQueryLength??J;return C(()=>{let m=t.trim();if(m.length<L){i.current?.abort(),i.current=null,r([]),e(!1),h(null);return}e(!0),h(null);let S=window.setTimeout(async()=>{i.current?.abort();let l=new AbortController;i.current=l;try{let c=await fetch("/cms/api/search.query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:m,limit:x}),signal:l.signal});if(!c.ok)throw new Error(`search.query returned ${c.status}`);let d=await c.json();if(!d?.success)throw new Error(d?.error||"search failed");if(l.signal.aborted)return;r(Array.isArray(d.hits)?d.hits:[]),a(d.meta||null),e(!1)}catch(c){if(l.signal.aborted)return;console.error("global search failed:",c),h(String(c?.message||c)),r([]),e(!1)}},X);return()=>{window.clearTimeout(S)}},[t,x,L]),{hits:s,loading:g,error:o,status:y}}function st(){let[t,n]=u({status:{lastRun:null,docCount:0,fieldCount:0,shardCount:0},running:!1}),[s,r]=u(!0),g=A(async()=>{try{let e=await fetch("/cms/api/search.status",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return;let o=await e.json();if(!o?.success)return;n({status:o.status,running:!!o.running})}catch(e){console.error("search.status failed:",e)}finally{r(!1)}},[]);return C(()=>{g()},[g]),{...t,loading:s,refresh:g}}var V=200,W=5,z=2;function at(t,n={}){let[s,r]=u([]),[g,e]=u(!1),o=G(null),h=n.limit??10,y=n.minQueryLength??z;return C(()=>{let a=t.trim(),i=a.indexOf("/");if((i>=0?a.slice(i+1):a).length<y){o.current&&(o.current.aborted=!0),o.current=null,r([]),e(!1);return}e(!0);let L=window.setTimeout(async()=>{o.current&&(o.current.aborted=!0);let m={aborted:!1};o.current=m;let S=null,l=a;i>=0&&(S=a.slice(0,i),l=a.slice(i+1));let c=window.__ROOT_CTX?.rootConfig?.projectId,d=window.firebase?.db;if(!c||!d){r([]),e(!1);return}let v=Object.keys(window.__ROOT_CTX.collections||{}),$=S?v.filter(p=>p.toLowerCase()===S.toLowerCase()):v,q=l,B=`${l}\uF8FF`;try{let p=$.map(async f=>{let w=N(d,"Projects",c,"Collections",f,"Drafts"),E=U(w,H(R()),P(q),j(B),O(W));try{let b=await M(E),_=[];return b.forEach(D=>{_.push({collection:f,slug:D.id,docId:`${f}/${D.id}`})}),_}catch(b){return console.error(`docSlugSearch failed for ${f}:`,b),[]}}),K=(await Promise.all(p)).flat();if(m.aborted)return;let Q=K.sort((f,w)=>{let E=f.slug===l||f.docId===a?0:1,b=w.slug===l||w.docId===a?0:1;return E!==b?E-b:f.docId.localeCompare(w.docId)});r(Q.slice(0,h)),e(!1)}catch(p){if(m.aborted)return;console.error("docSlugSearch failed:",p),r([]),e(!1)}},V);return()=>{window.clearTimeout(L)}},[t,h,y]),{hits:s,loading:g}}var T=new Set,k=!1;function I(){return T.values().next().value}function Z(t){I()&&(t.preventDefault(),t.returnValue="")}function tt(t){let n=I();if(!n||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0)return;let s=t.composedPath().find(r=>r instanceof HTMLAnchorElement&&!!r.href);!s||(s.getAttribute("href")||"").startsWith("#")||s.download||s.origin!==window.location.origin||!/^(_?self)?$/i.test(s.target)||window.confirm(n.message)||(t.preventDefault(),t.stopImmediatePropagation())}function et(t){let n=I();n&&(window.confirm(n.message)||(t.stopImmediatePropagation(),window.history.pushState(null,"",n.url)))}function lt(){k||(k=!0,window.addEventListener("beforeunload",Z),window.addEventListener("click",tt,{capture:!0}),window.addEventListener("popstate",et))}function ct(t){return T.add(t),()=>T.delete(t)}export{ot as a,st as b,at as c,lt as d,ct as e};
1
+ import{b as N,f as R,g as U,i as H,j as O,k as P,m as j,o as M}from"./chunk-XOWWPE7X.js";import{a as u,c as C,e as G,h as A,j as F}from"./chunk-WRA24P66.js";F();var X=200,Y=25,J=2;function ot(t,n={}){let[s,r]=u([]),[g,e]=u(!1),[o,h]=u(null),[y,a]=u(null),i=G(null),x=n.limit??Y,L=n.minQueryLength??J;return C(()=>{let m=t.trim();if(m.length<L){i.current?.abort(),i.current=null,r([]),e(!1),h(null);return}e(!0),h(null);let S=window.setTimeout(async()=>{i.current?.abort();let l=new AbortController;i.current=l;try{let c=await fetch("/cms/api/search.query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:m,limit:x}),signal:l.signal});if(!c.ok)throw new Error(`search.query returned ${c.status}`);let d=await c.json();if(!d?.success)throw new Error(d?.error||"search failed");if(l.signal.aborted)return;r(Array.isArray(d.hits)?d.hits:[]),a(d.meta||null),e(!1)}catch(c){if(l.signal.aborted)return;console.error("global search failed:",c),h(String(c?.message||c)),r([]),e(!1)}},X);return()=>{window.clearTimeout(S)}},[t,x,L]),{hits:s,loading:g,error:o,status:y}}function st(){let[t,n]=u({status:{lastRun:null,docCount:0,fieldCount:0,shardCount:0},running:!1}),[s,r]=u(!0),g=A(async()=>{try{let e=await fetch("/cms/api/search.status",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return;let o=await e.json();if(!o?.success)return;n({status:o.status,running:!!o.running})}catch(e){console.error("search.status failed:",e)}finally{r(!1)}},[]);return C(()=>{g()},[g]),{...t,loading:s,refresh:g}}var V=200,W=5,z=2;function at(t,n={}){let[s,r]=u([]),[g,e]=u(!1),o=G(null),h=n.limit??10,y=n.minQueryLength??z;return C(()=>{let a=t.trim(),i=a.indexOf("/");if((i>=0?a.slice(i+1):a).length<y){o.current&&(o.current.aborted=!0),o.current=null,r([]),e(!1);return}e(!0);let L=window.setTimeout(async()=>{o.current&&(o.current.aborted=!0);let m={aborted:!1};o.current=m;let S=null,l=a;i>=0&&(S=a.slice(0,i),l=a.slice(i+1));let c=window.__ROOT_CTX?.rootConfig?.projectId,d=window.firebase?.db;if(!c||!d){r([]),e(!1);return}let v=Object.keys(window.__ROOT_CTX.collections||{}),$=S?v.filter(p=>p.toLowerCase()===S.toLowerCase()):v,q=l,B=`${l}\uF8FF`;try{let p=$.map(async f=>{let w=N(d,"Projects",c,"Collections",f,"Drafts"),E=U(w,H(R()),P(q),j(B),O(W));try{let b=await M(E),_=[];return b.forEach(D=>{_.push({collection:f,slug:D.id,docId:`${f}/${D.id}`})}),_}catch(b){return console.error(`docSlugSearch failed for ${f}:`,b),[]}}),K=(await Promise.all(p)).flat();if(m.aborted)return;let Q=K.sort((f,w)=>{let E=f.slug===l||f.docId===a?0:1,b=w.slug===l||w.docId===a?0:1;return E!==b?E-b:f.docId.localeCompare(w.docId)});r(Q.slice(0,h)),e(!1)}catch(p){if(m.aborted)return;console.error("docSlugSearch failed:",p),r([]),e(!1)}},V);return()=>{window.clearTimeout(L)}},[t,h,y]),{hits:s,loading:g}}var T=new Set,k=!1;function I(){return T.values().next().value}function Z(t){I()&&(t.preventDefault(),t.returnValue="")}function tt(t){let n=I();if(!n||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0)return;let s=t.composedPath().find(r=>r instanceof HTMLAnchorElement&&!!r.href);!s||(s.getAttribute("href")||"").startsWith("#")||s.download||s.origin!==window.location.origin||!/^(_?self)?$/i.test(s.target)||window.confirm(n.message)||(t.preventDefault(),t.stopImmediatePropagation())}function et(t){let n=I();n&&(window.confirm(n.message)||(t.stopImmediatePropagation(),window.history.pushState(null,"",n.url)))}function lt(){k||(k=!0,window.addEventListener("beforeunload",Z),window.addEventListener("click",tt,{capture:!0}),window.addEventListener("popstate",et))}function ct(t){return T.add(t),()=>T.delete(t)}export{ot as a,st as b,at as c,lt as d,ct as e};