@budibase/server 1.0.168 → 1.0.171

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 (166) hide show
  1. package/__mocks__/pg.ts +3 -1
  2. package/builder/assets/{index.deb4ce04.js → index.40d2fb90.js} +3 -3
  3. package/builder/index.html +1 -1
  4. package/coverage/clover.xml +42 -42
  5. package/coverage/coverage-final.json +4 -4
  6. package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/component.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/index.html +1 -1
  16. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  22. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  36. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  44. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  45. package/coverage/lcov-report/api/index.html +1 -1
  46. package/coverage/lcov-report/api/index.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/index.html +1 -1
  58. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  72. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  73. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  74. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  75. package/coverage/lcov-report/automations/actions.js.html +1 -1
  76. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  77. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  78. package/coverage/lcov-report/automations/index.html +1 -1
  79. package/coverage/lcov-report/automations/index.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/index.html +1 -1
  87. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  105. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  106. package/coverage/lcov-report/constants/index.html +1 -1
  107. package/coverage/lcov-report/constants/index.js.html +1 -1
  108. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  109. package/coverage/lcov-report/constants/screens.js.html +1 -1
  110. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  111. package/coverage/lcov-report/db/index.html +1 -1
  112. package/coverage/lcov-report/db/index.js.html +1 -1
  113. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  116. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  117. package/coverage/lcov-report/db/newid.js.html +1 -1
  118. package/coverage/lcov-report/db/utils.js.html +6 -6
  119. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  120. package/coverage/lcov-report/events/index.html +1 -1
  121. package/coverage/lcov-report/events/index.js.html +1 -1
  122. package/coverage/lcov-report/events/utils.js.html +1 -1
  123. package/coverage/lcov-report/index.html +1 -1
  124. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  125. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  126. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  127. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  128. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  129. package/coverage/lcov-report/middleware/index.html +1 -1
  130. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  131. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  132. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  133. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  134. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  135. package/coverage/lcov-report/threads/automation.js.html +1 -1
  136. package/coverage/lcov-report/threads/index.html +1 -1
  137. package/coverage/lcov-report/threads/query.js.html +1 -1
  138. package/coverage/lcov-report/threads/utils.js.html +1 -1
  139. package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
  140. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  141. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  142. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  143. package/coverage/lcov-report/utilities/global.js.html +1 -1
  144. package/coverage/lcov-report/utilities/index.html +1 -1
  145. package/coverage/lcov-report/utilities/index.js.html +2 -2
  146. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  147. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  148. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  149. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  150. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  151. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  152. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  153. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  154. package/coverage/lcov-report/utilities/security.js.html +1 -1
  155. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  156. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  157. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +23 -23
  158. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  159. package/coverage/lcov-report/utilities/users.js.html +1 -1
  160. package/coverage/lcov-report/utilities/workerRequests.js.html +13 -13
  161. package/coverage/lcov.info +65 -65
  162. package/dist/integrations/postgres.js +36 -16
  163. package/dist/package.json +5 -5
  164. package/dist/tsconfig.build.tsbuildinfo +1 -1
  165. package/package.json +6 -6
  166. package/src/integrations/postgres.ts +35 -14
package/__mocks__/pg.ts CHANGED
@@ -14,7 +14,9 @@ module PgMock {
14
14
  function Client() {}
15
15
 
16
16
  Client.prototype.query = query
17
- Client.prototype.end = jest.fn()
17
+ Client.prototype.end = jest.fn(cb => {
18
+ if (cb) cb()
19
+ })
18
20
  Client.prototype.connect = jest.fn()
19
21
  Client.prototype.release = jest.fn()
20
22
 
@@ -1246,7 +1246,7 @@ function print() { __p += __j.call(arguments, '') }
1246
1246
  `),t=j("i"),i=F(n),l=F("?"),s=F(`
1247
1247
  This action cannot be undone.`)},m(o,a){$(o,e,a),$(o,t,a),N(t,i),N(t,l),$(o,s,a)},p(o,a){a&1&&n!==(n=o[0].name+"")&&Oe(i,n)},d(o){o&&b(e),o&&b(t),o&&b(s)}}}function p1e(r){let e,t,n,i,l,s;e=new wr({props:{$$slots:{control:[f1e],default:[u1e]},$$scope:{ctx:r}}});let o={okText:"Delete Automation",onOk:r[3],title:"Confirm Deletion",$$slots:{default:[c1e]},$$scope:{ctx:r}};n=new fr({props:o}),r[4](n);let a={automation:r[0]};return l=new s1e({props:a}),r[5](l),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(u,f){A(e,u,f),$(u,t,f),A(n,u,f),$(u,i,f),A(l,u,f),s=!0},p(u,[f]){const c={};f&134&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&129&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f&1&&(d.automation=u[0]),l.$set(d)},i(u){s||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){E(e,u),u&&b(t),r[4](null),E(n,u),u&&b(i),r[5](null),E(l,u)}}}function d1e(r,e,t){let n;fe(r,Ut,f=>t(6,n=f));let{automation:i}=e,l,s;async function o(){try{await Qt.actions.delete(i),we.success("Automation deleted successfully"),n("../automate")}catch{we.error("Error deleting automation")}}function a(f){K[f?"unshift":"push"](()=>{l=f,t(1,l)})}function u(f){K[f?"unshift":"push"](()=>{s=f,t(2,s)})}return r.$$set=f=>{"automation"in f&&t(0,i=f.automation)},[i,l,s,o,a,u]}class m1e extends se{constructor(e){super();oe(this,e,d1e,p1e,ie,{automation:0})}}function xy(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function g1e(r){let e,t,n;return e=new m1e({props:{automation:r[5]}}),{c(){S(e.$$.fragment),t=R()},m(i,l){A(e,i,l),$(i,t,l),n=!0},p(i,l){const s={};l&1&&(s.automation=i[5]),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){E(e,i),i&&b(t)}}}function e7(r){let e,t;function n(){return r[3](r[5])}return e=new Ll({props:{border:r[7]>0,icon:"ShareAndroid",text:r[5].name,selected:r[5]._id===r[1],$$slots:{default:[g1e]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&1&&(s.text=r[5].name),l&3&&(s.selected=r[5]._id===r[1]),l&257&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}function _1e(r){let e,t,n=r[0].automations,i=[];for(let s=0;s<n.length;s+=1)i[s]=e7(xy(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=j("div");for(let s=0;s<i.length;s+=1)i[s].c();w(e,"class","automations-list svelte-g64vb")},m(s,o){$(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,[o]){if(o&7){n=s[0].automations;let a;for(a=0;a<n.length;a+=1){const u=xy(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=e7(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(ee(),a=n.length;a<i.length;a+=1)l(a);te()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&b(e),gt(i,s)}}}function h1e(r,e,t){let n,i,l;fe(r,Ut,a=>t(4,i=a)),fe(r,Qt,a=>t(0,l=a)),qt(async()=>{try{await Qt.actions.fetch()}catch{we.error("Error getting automations list")}});function s(a){Qt.actions.select(a),i(`./${a._id}`)}const o=a=>s(a);return r.$$.update=()=>{var a,u;r.$$.dirty&1&&t(1,n=(u=(a=l.selectedAutomation)==null?void 0:a.automation)==null?void 0:u._id)},[l,n,s,o]}class $1e extends se{constructor(e){super();oe(this,e,h1e,_1e,ie,{})}}function t7(r,e,t){const n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function b1e(r){let e;return{c(){e=F(`Please name your automation, then select a trigger. Every automation must
1248
1248
  start with a trigger.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function v1e(r){let e;return{c(){e=F("Triggers")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function w1e(r){let e=r[18].name+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&8&&e!==(e=n[18].name+"")&&Oe(t,e)},d(n){n&&b(t)}}}function n7(r){let e,t,n,i,l,s,o,a,u,f;n=new ut({props:{name:r[18].icon}}),s=new Ye({props:{size:"S",$$slots:{default:[w1e]},$$scope:{ctx:r}}});function c(){return r[13](r[18])}return{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),l=j("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-d3iboa"),w(t,"class","item-body svelte-d3iboa"),w(e,"class","item svelte-d3iboa"),ae(e,"selected",r[2]===r[18].name)},m(p,d){$(p,e,d),N(e,t),A(n,t,null),N(t,i),N(t,l),A(s,l,null),N(e,o),a=!0,u||(f=Ne(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&8&&(g.name=r[18].icon),n.$set(g);const h={};d&2097160&&(h.$$scope={dirty:d,ctx:r}),s.$set(h),d&12&&ae(e,"selected",r[2]===r[18].name)},i(p){a||(m(n.$$.fragment,p),m(s.$$.fragment,p),a=!0)},o(p){_(n.$$.fragment,p),_(s.$$.fragment,p),a=!1},d(p){p&&b(e),E(n),E(s),u=!1,f()}}}function y1e(r){let e,t,n,i;e=new Ye({props:{size:"S",$$slots:{default:[v1e]},$$scope:{ctx:r}}});let l=r[3],s=[];for(let a=0;a<l.length;a+=1)s[a]=n7(t7(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){S(e.$$.fragment),t=R(),n=j("div");for(let a=0;a<s.length;a+=1)s[a].c();w(n,"class","item-list svelte-d3iboa")},m(a,u){A(e,a,u),$(a,t,u),$(a,n,u);for(let f=0;f<s.length;f+=1)s[f].m(n,null);i=!0},p(a,u){const f={};if(u&2097152&&(f.$$scope={dirty:u,ctx:a}),e.$set(f),u&76){l=a[3];let c;for(c=0;c<l.length;c+=1){const p=t7(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=n7(p),s[c].c(),m(s[c],1),s[c].m(n,null))}for(ee(),c=l.length;c<s.length;c+=1)o(c);te()}},i(a){if(!i){m(e.$$.fragment,a);for(let u=0;u<l.length;u+=1)m(s[u]);i=!0}},o(a){_(e.$$.fragment,a),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);i=!1},d(a){E(e,a),a&&b(t),a&&b(n),gt(s,a)}}}function k1e(r){let e,t,n,i,l,s,o,a,u,f;e=new s1({props:{header:"You must publish your app to activate your automations.",message:"To test your automation before publishing, you can use the 'Run Test' functionality on the next screen."}}),n=new Ye({props:{size:"XS",$$slots:{default:[b1e]},$$scope:{ctx:r}}});function c(g){r[10](g)}function p(g){r[11](g)}let d={label:"Name"};return r[0]!==void 0&&(d.value=r[0]),r[4]!==void 0&&(d.error=r[4]),l=new nt({props:d}),K.push(()=>de(l,"value",c)),K.push(()=>de(l,"error",p)),l.$on("change",r[12]),u=new Ve({props:{noPadding:!0,$$slots:{default:[y1e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),a=R(),S(u.$$.fragment)},m(g,h){A(e,g,h),$(g,t,h),A(n,g,h),$(g,i,h),A(l,g,h),$(g,a,h),A(u,g,h),f=!0},p(g,h){const v={};h&2097152&&(v.$$scope={dirty:h,ctx:g}),n.$set(v);const y={};!s&&h&1&&(s=!0,y.value=g[0],me(()=>s=!1)),!o&&h&16&&(o=!0,y.error=g[4],me(()=>o=!1)),l.$set(y);const k={};h&2097164&&(k.$$scope={dirty:h,ctx:g}),u.$set(k)},i(g){f||(m(e.$$.fragment,g),m(n.$$.fragment,g),m(l.$$.fragment,g),m(u.$$.fragment,g),f=!0)},o(g){_(e.$$.fragment,g),_(n.$$.fragment,g),_(l.$$.fragment,g),_(u.$$.fragment,g),f=!1},d(g){E(e,g),g&&b(t),E(n,g),g&&b(i),E(l,g),g&&b(a),E(u,g)}}}function C1e(r){let e,t;return e=new Nt({props:{title:"Create Automation",confirmText:"Save",size:"M",onConfirm:r[5],disabled:!r[2]||!r[0],$$slots:{default:[k1e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&5&&(l.disabled=!n[2]||!n[0]),i&2097183&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function S1e(r,e,t){let n,i,l,s,o,a;fe(r,Qt,T=>t(8,s=T)),fe(r,Ut,T=>t(16,o=T)),fe(r,Ss,T=>t(9,a=T));let u,f,c=!1,p,{webhookModal:d}=e;async function g(){var T;try{await Qt.actions.create({name:u,instanceId:n});const O=s.selectedAutomation.constructBlock("TRIGGER",p.stepId,p);Qt.actions.addBlockToAutomation(O),p.stepId==="WEBHOOK"&&d.show,await Qt.actions.save((T=s.selectedAutomation)==null?void 0:T.automation),we.success(`Automation ${u} created`),o(`./${s.selectedAutomation.automation._id}`),Ln.captureEvent(Nn.AUTOMATION.CREATED,{name:u})}catch{we.error("Error creating automation")}}const h=T=>{p=T,t(2,f=T.name)};function v(T){u=T,t(0,u)}function y(T){i=T,t(4,i),t(1,c),t(0,u)}const k=()=>t(1,c=!0),I=T=>h(T);return r.$$set=T=>{"webhookModal"in T&&t(7,d=T.webhookModal)},r.$$.update=()=>{r.$$.dirty&512&&(n=a._id),r.$$.dirty&3&&t(4,i=c&&!u?"Please specify a name for the automation.":null),r.$$.dirty&256&&t(3,l=Object.entries(s.blockDefinitions.TRIGGER))},[u,c,f,l,i,g,h,d,s,a,v,y,k,I]}class r7 extends se{constructor(e){super();oe(this,e,S1e,C1e,ie,{webhookModal:7})}}function A1e(r){let e,t;return e=new r7({props:{webhookModal:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.webhookModal=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function E1e(r){let e,t,n,i;e=new $1e({});let l={$$slots:{default:[A1e]},$$scope:{ctx:r}};return n=new kt({props:l}),r[2](n),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(s,o){A(e,s,o),$(s,t,o),A(n,s,o),i=!0},p(s,o){const a={};o&10&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){E(e,s),s&&b(t),r[2](null),E(n,s)}}}function O1e(r){let e,t;return e=new bn({props:{title:"Automations",$$slots:{default:[E1e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&11&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function T1e(r){let e,t,n,i,l,s;return t=new Vr({props:{selected:"Automations",$$slots:{default:[O1e]},$$scope:{ctx:r}}}),l=new ut({props:{hoverable:!0,name:"AddCircle"}}),l.$on("click",function(){ft(r[0].show)&&r[0].show.apply(this,arguments)}),{c(){e=j("div"),S(t.$$.fragment),n=R(),i=j("div"),S(l.$$.fragment),w(i,"class","add-button svelte-mcmub4"),w(e,"class","title svelte-mcmub4")},m(o,a){$(o,e,a),A(t,e,null),N(e,n),N(e,i),A(l,i,null),s=!0},p(o,[a]){r=o;const u={};a&11&&(u.$$scope={dirty:a,ctx:r}),t.$set(u)},i(o){s||(m(t.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(t.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){o&&b(e),E(t),E(l)}}}function I1e(r,e,t){let{modal:n}=e,{webhookModal:i}=e;function l(s){K[s?"unshift":"push"](()=>{n=s,t(0,n)})}return r.$$set=s=>{"modal"in s&&t(0,n=s.modal),"webhookModal"in s&&t(1,i=s.webhookModal)},[n,i,l]}class L1e extends se{constructor(e){super();oe(this,e,I1e,T1e,ie,{modal:0,webhookModal:1})}}function P1e(r){let e,t,n,i;return n=new Ve({props:{gap:"S",justifyItems:"center",$$slots:{default:[j1e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-16gumu0"),w(e,"class","centered svelte-16gumu0")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,s){const o={};s&257&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function N1e(r){let e;const t=r[4].default,n=bt(t,r,r[8],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&256)&&vt(n,t,i,i[8],e?yt(t,i[8],l,null):wt(i[8]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function R1e(r){let e;return{c(){e=F("You have no automations")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function M1e(r){let e;return{c(){e=F("Let's fix that. Call the bots!")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function D1e(r){let e;return{c(){e=F("Create automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function j1e(r){let e,t,n,i,l,s,o,a,u;return i=new _t({props:{size:"M",$$slots:{default:[R1e]},$$scope:{ctx:r}}}),s=new Ye({props:{size:"M",$$slots:{default:[M1e]},$$scope:{ctx:r}}}),a=new ot({props:{size:"M",cta:!0,$$slots:{default:[D1e]},$$scope:{ctx:r}}}),a.$on("click",r[5]),{c(){e=_e("svg"),t=_e("use"),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),Gt(t,"xlink:href","#spectrum-icon-18-WorkflowAdd"),w(e,"width","60px"),w(e,"height","60px"),w(e,"class","spectrum-Icon"),w(e,"focusable","false")},m(f,c){$(f,e,c),N(e,t),$(f,n,c),A(i,f,c),$(f,l,c),A(s,f,c),$(f,o,c),A(a,f,c),u=!0},p(f,c){const p={};c&256&&(p.$$scope={dirty:c,ctx:f}),i.$set(p);const d={};c&256&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const g={};c&256&&(g.$$scope={dirty:c,ctx:f}),a.$set(g)},i(f){u||(m(i.$$.fragment,f),m(s.$$.fragment,f),m(a.$$.fragment,f),u=!0)},o(f){_(i.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),u=!1},d(f){f&&b(e),f&&b(n),E(i,f),f&&b(l),E(s,f),f&&b(o),E(a,f)}}}function B1e(r){let e,t;return e=new r7({props:{webhookModal:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.webhookModal=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function z1e(r){let e,t;return e=new F1({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function q1e(r){let e,t,n,i,l,s,o,a,u,f,c,p;n=new L1e({props:{modal:r[0],webhookModal:r[1]}});const d=[N1e,P1e],g=[];function h(k,I){return k[2]?0:1}s=h(r),o=g[s]=d[s](r);let v={$$slots:{default:[B1e]},$$scope:{ctx:r}};u=new kt({props:v}),r[6](u);let y={width:"30%",$$slots:{default:[z1e]},$$scope:{ctx:r}};return c=new kt({props:y}),r[7](c),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),l=j("div"),o.c(),a=R(),S(u.$$.fragment),f=R(),S(c.$$.fragment),w(t,"class","nav svelte-16gumu0"),w(l,"class","content svelte-16gumu0"),w(e,"class","root svelte-16gumu0")},m(k,I){$(k,e,I),N(e,t),A(n,t,null),N(e,i),N(e,l),g[s].m(l,null),N(e,a),A(u,e,null),N(e,f),A(c,e,null),p=!0},p(k,[I]){const T={};I&1&&(T.modal=k[0]),I&2&&(T.webhookModal=k[1]),n.$set(T);let O=s;s=h(k),s===O?g[s].p(k,I):(ee(),_(g[O],1,1,()=>{g[O]=null}),te(),o=g[s],o?o.p(k,I):(o=g[s]=d[s](k),o.c()),m(o,1),o.m(l,null));const L={};I&258&&(L.$$scope={dirty:I,ctx:k}),u.$set(L);const M={};I&256&&(M.$$scope={dirty:I,ctx:k}),c.$set(M)},i(k){p||(m(n.$$.fragment,k),m(o),m(u.$$.fragment,k),m(c.$$.fragment,k),p=!0)},o(k){_(n.$$.fragment,k),_(o),_(u.$$.fragment,k),_(c.$$.fragment,k),p=!1},d(k){k&&b(e),E(n),g[s].d(),r[6](null),E(u),r[7](null),E(c)}}}function U1e(r,e,t){let n,i;fe(r,Qt,p=>t(3,i=p));let{$$slots:l={},$$scope:s}=e,o,a;const u=()=>o.show();function f(p){K[p?"unshift":"push"](()=>{o=p,t(0,o)})}function c(p){K[p?"unshift":"push"](()=>{a=p,t(1,a)})}return r.$$set=p=>{"$$scope"in p&&t(8,s=p.$$scope)},r.$$.update=()=>{r.$$.dirty&8&&t(2,n=i.automations[0])},[o,a,n,i,l,u,f,c,s]}class F1e extends se{constructor(e){super();oe(this,e,U1e,q1e,ie,{})}}function V1e(r){let e,t,n,i,l,s,o;function a(f){r[4](f)}let u={};return r[2]!==void 0&&(u.value=r[2]),l=new nt({props:u}),K.push(()=>de(l,"value",a)),{c(){e=j("span"),e.textContent=`The changes you have made will be deleted and the application reverted
1249
- back to its production state.`,t=R(),n=j("span"),n.textContent="Please enter your app name to continue.",i=R(),S(l.$$.fragment)},m(f,c){$(f,e,c),$(f,t,c),$(f,n,c),$(f,i,c),A(l,f,c),o=!0},p(f,c){const p={};!s&&c&4&&(s=!0,p.value=f[2],me(()=>s=!1)),l.$set(p)},i(f){o||(m(l.$$.fragment,f),o=!0)},o(f){_(l.$$.fragment,f),o=!1},d(f){f&&b(e),f&&b(t),f&&b(n),f&&b(i),E(l,f)}}}function H1e(r){let e,t;return e=new Nt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[V1e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&5&&(l.disabled=n[2]!==n[0].name),i&132&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function W1e(r){let e,t,n,i;e=new ut({props:{name:"Revert",hoverable:!0}}),e.$on("click",function(){ft(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[H1e]},$$scope:{ctx:r}};return n=new kt({props:l}),r[5](n),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(s,o){A(e,s,o),$(s,t,o),A(n,s,o),i=!0},p(s,[o]){r=s;const a={};o&133&&(a.$$scope={dirty:o,ctx:r}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){E(e,s),s&&b(t),r[5](null),E(n,s)}}}function G1e(r,e,t){let n,i;fe(r,Ge,f=>t(0,i=f));let l,s;const o=async()=>{try{await Ze.revertAppChanges(n);const f=await Ze.fetchAppPackage(n);await Ge.actions.initialise(f),we.info("Changes reverted successfully")}catch(f){we.error(`Error reverting changes: ${f}`)}};function a(f){s=f,t(2,s)}function u(f){K[f?"unshift":"push"](()=>{l=f,t(1,l)})}return r.$$.update=()=>{r.$$.dirty&1&&(n=i.appId)},[i,l,s,o,a,u]}class Y1e extends se{constructor(e){super();oe(this,e,G1e,W1e,ie,{})}}const J1e="@budibase/client",Q1e="1.0.167",X1e="MPL-2.0",K1e="dist/budibase-client.js",Z1e="dist/budibase-client.js",x1e="module",eme="src/index.js",tme={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},nme={build:"rollup -c","dev:builder":"rollup -cw"},rme={"@budibase/bbui":"^1.0.167","@budibase/frontend-core":"^1.0.167","@budibase/string-templates":"^1.0.167","@spectrum-css/button":"^3.0.3","@spectrum-css/card":"^3.0.3","@spectrum-css/divider":"^1.0.3","@spectrum-css/link":"^3.1.3","@spectrum-css/page":"^3.0.1","@spectrum-css/tag":"^3.1.4","@spectrum-css/typography":"^3.0.2","@spectrum-css/vars":"^3.0.1",apexcharts:"^3.22.1",dayjs:"^1.10.5",downloadjs:"1.4.7",leaflet:"^1.7.1",regexparam:"^1.3.0","rollup-plugin-polyfill-node":"^0.8.0","sanitize-html":"^2.7.0",screenfull:"^6.0.1",shortid:"^2.2.15",svelte:"^3.38.2","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},ime={"@rollup/plugin-alias":"^3.1.5","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-node-resolve":"^11.2.1",postcss:"^8.2.10",rollup:"^2.44.0","rollup-plugin-json":"^4.0.0","rollup-plugin-postcss":"^4.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-svg":"^2.0.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^5.5.4"},lme="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc";var H1={name:J1e,version:Q1e,license:X1e,module:K1e,main:Z1e,type:x1e,svelte:eme,exports:tme,scripts:nme,dependencies:rme,devDependencies:ime,gitHead:lme};function sme(r){let e,t;return e=new Ye({props:{size:"S",$$slots:{default:[ame]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&513&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function ome(r){let e,t;return e=new Ye({props:{size:"S",$$slots:{default:[ume]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&513&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function ame(r){let e,t,n=r[0].version+"",i,l;return{c(){e=F("This app is currently using version "),t=j("b"),i=F(n),l=F(` which is the
1249
+ back to its production state.`,t=R(),n=j("span"),n.textContent="Please enter your app name to continue.",i=R(),S(l.$$.fragment)},m(f,c){$(f,e,c),$(f,t,c),$(f,n,c),$(f,i,c),A(l,f,c),o=!0},p(f,c){const p={};!s&&c&4&&(s=!0,p.value=f[2],me(()=>s=!1)),l.$set(p)},i(f){o||(m(l.$$.fragment,f),o=!0)},o(f){_(l.$$.fragment,f),o=!1},d(f){f&&b(e),f&&b(t),f&&b(n),f&&b(i),E(l,f)}}}function H1e(r){let e,t;return e=new Nt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[V1e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&5&&(l.disabled=n[2]!==n[0].name),i&132&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function W1e(r){let e,t,n,i;e=new ut({props:{name:"Revert",hoverable:!0}}),e.$on("click",function(){ft(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[H1e]},$$scope:{ctx:r}};return n=new kt({props:l}),r[5](n),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(s,o){A(e,s,o),$(s,t,o),A(n,s,o),i=!0},p(s,[o]){r=s;const a={};o&133&&(a.$$scope={dirty:o,ctx:r}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){E(e,s),s&&b(t),r[5](null),E(n,s)}}}function G1e(r,e,t){let n,i;fe(r,Ge,f=>t(0,i=f));let l,s;const o=async()=>{try{await Ze.revertAppChanges(n);const f=await Ze.fetchAppPackage(n);await Ge.actions.initialise(f),we.info("Changes reverted successfully")}catch(f){we.error(`Error reverting changes: ${f}`)}};function a(f){s=f,t(2,s)}function u(f){K[f?"unshift":"push"](()=>{l=f,t(1,l)})}return r.$$.update=()=>{r.$$.dirty&1&&(n=i.appId)},[i,l,s,o,a,u]}class Y1e extends se{constructor(e){super();oe(this,e,G1e,W1e,ie,{})}}const J1e="@budibase/client",Q1e="1.0.170",X1e="MPL-2.0",K1e="dist/budibase-client.js",Z1e="dist/budibase-client.js",x1e="module",eme="src/index.js",tme={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},nme={build:"rollup -c","dev:builder":"rollup -cw"},rme={"@budibase/bbui":"^1.0.170","@budibase/frontend-core":"^1.0.170","@budibase/string-templates":"^1.0.170","@spectrum-css/button":"^3.0.3","@spectrum-css/card":"^3.0.3","@spectrum-css/divider":"^1.0.3","@spectrum-css/link":"^3.1.3","@spectrum-css/page":"^3.0.1","@spectrum-css/tag":"^3.1.4","@spectrum-css/typography":"^3.0.2","@spectrum-css/vars":"^3.0.1",apexcharts:"^3.22.1",dayjs:"^1.10.5",downloadjs:"1.4.7",leaflet:"^1.7.1",regexparam:"^1.3.0","rollup-plugin-polyfill-node":"^0.8.0","sanitize-html":"^2.7.0",screenfull:"^6.0.1",shortid:"^2.2.15",svelte:"^3.38.2","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},ime={"@rollup/plugin-alias":"^3.1.5","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-node-resolve":"^11.2.1",postcss:"^8.2.10",rollup:"^2.44.0","rollup-plugin-json":"^4.0.0","rollup-plugin-postcss":"^4.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-svg":"^2.0.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^5.5.4"},lme="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc";var H1={name:J1e,version:Q1e,license:X1e,module:K1e,main:Z1e,type:x1e,svelte:eme,exports:tme,scripts:nme,dependencies:rme,devDependencies:ime,gitHead:lme};function sme(r){let e,t;return e=new Ye({props:{size:"S",$$slots:{default:[ame]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&513&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function ome(r){let e,t;return e=new Ye({props:{size:"S",$$slots:{default:[ume]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&513&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function ame(r){let e,t,n=r[0].version+"",i,l;return{c(){e=F("This app is currently using version "),t=j("b"),i=F(n),l=F(` which is the
1250
1250
  latest version available.`)},m(s,o){$(s,e,o),$(s,t,o),N(t,i),$(s,l,o)},p(s,o){o&1&&n!==(n=s[0].version+"")&&Oe(i,n)},d(s){s&&b(e),s&&b(t),s&&b(l)}}}function ume(r){let e,t,n=r[0].version+"",i,l,s,o;return{c(){e=F("This app is currently using version "),t=j("b"),i=F(n),l=F(`, but version
1251
1251
  `),s=j("b"),s.textContent=`${H1.version}`,o=F(` is available. Updates can contain new features,
1252
1252
  performance improvements and bug fixes.`)},m(a,u){$(a,e,u),$(a,t,u),N(t,i),$(a,l,u),$(a,s,u),$(a,o,u)},p(a,u){u&1&&n!==(n=a[0].version+"")&&Oe(i,n)},d(a){a&&b(e),a&&b(t),a&&b(l),a&&b(s),a&&b(o)}}}function i7(r){let e,t;return e=new Ye({props:{size:"S",$$slots:{default:[fme]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&513&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function fme(r){let e,t,n=r[0].revertableVersion+"",i,l;return{c(){e=F(`You can revert this app to version
@@ -1256,10 +1256,10 @@ function print() { __p += __j.call(arguments, '') }
1256
1256
  <span class="app-published-header-text svelte-eq4le8">App Published!</span>`,w(e,"slot","header"),w(e,"class","app-published-header svelte-eq4le8")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Ome(r){let e,t;return e=new Nt({props:{confirmText:"Done",cancelText:"View App",onCancel:r[6],dataCy:"deploy-app-success-modal",$$slots:{header:[Eme],default:[Ame]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16400&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Tme(r){let e,t,n,i,l,s,o,a,u,f;e=new ot({props:{secondary:!0,$$slots:{default:[bme]},$$scope:{ctx:r}}}),e.$on("click",function(){ft(r[1].show)&&r[1].show.apply(this,arguments)});let c={$$slots:{default:[vme]},$$scope:{ctx:r}};n=new kt({props:c}),r[9](n);let p={$$slots:{default:[yme]},$$scope:{ctx:r}};l=new kt({props:p}),r[10](l);let d={$$slots:{default:[Sme]},$$scope:{ctx:r}};o=new kt({props:d}),r[11](o);let g={$$slots:{default:[Ome]},$$scope:{ctx:r}};return u=new kt({props:g}),r[12](u),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment),a=R(),S(u.$$.fragment)},m(h,v){A(e,h,v),$(h,t,v),A(n,h,v),$(h,i,v),A(l,h,v),$(h,s,v),A(o,h,v),$(h,a,v),A(u,h,v),f=!0},p(h,[v]){r=h;const y={};v&16384&&(y.$$scope={dirty:v,ctx:r}),e.$set(y);const k={};v&16384&&(k.$$scope={dirty:v,ctx:r}),n.$set(k);const I={};v&16384&&(I.$$scope={dirty:v,ctx:r}),l.$set(I);const T={};v&16384&&(T.$$scope={dirty:v,ctx:r}),o.$set(T);const O={};v&16400&&(O.$$scope={dirty:v,ctx:r}),u.$set(O)},i(h){f||(m(e.$$.fragment,h),m(n.$$.fragment,h),m(l.$$.fragment,h),m(o.$$.fragment,h),m(u.$$.fragment,h),f=!0)},o(h){_(e.$$.fragment,h),_(n.$$.fragment,h),_(l.$$.fragment,h),_(o.$$.fragment,h),_(u.$$.fragment,h),f=!1},d(h){E(e,h),h&&b(t),r[9](null),E(n,h),h&&b(i),r[10](null),E(l,h),h&&b(s),r[11](null),E(o,h),h&&b(a),r[12](null),E(u,h)}}}function Ime(r,e,t){let n,i;fe(r,Ge,y=>t(13,i=y));let l,s,o,a,u,{onOk:f}=e;async function c(){try{o.show(),s.hide(),t(8,u=await Ze.deployAppChanges()),Ln.captureEvent(Nn.APP.PUBLISHED,{appId:i.appId}),typeof f=="function"&&await f(),o.hide(),a.show()}catch(y){Ln.captureException(y),we.error("Error publishing app")}}const p=()=>{u&&(Ln.captureEvent(Nn.APP.VIEW_PUBLISHED,{appId:i.appId,eventSource:f1.PORTAL}),window.open(n,"_blank"))};function d(y){K[y?"unshift":"push"](()=>{l=y,t(0,l)})}function g(y){K[y?"unshift":"push"](()=>{s=y,t(1,s)})}function h(y){K[y?"unshift":"push"](()=>{o=y,t(2,o)})}function v(y){K[y?"unshift":"push"](()=>{a=y,t(3,a)})}return r.$$set=y=>{"onOk"in y&&t(7,f=y.onOk)},r.$$.update=()=>{r.$$.dirty&256&&t(4,n=u?`${window.origin}/app${u.appUrl}`:"")},[l,s,o,a,n,c,p,f,u,d,g,h,v]}class Lme extends se{constructor(e){super();oe(this,e,Ime,Tme,ie,{onOk:7})}}function o7(r){let e,t,n,i,l,s;n=new ut({props:{size:"M",hoverable:!0,name:"Globe",tooltip:"Your published app"}}),n.$on("click",function(){ft(r[2].show())&&r[2].show().apply(this,arguments)});let o={align:"right",disabled:!r[5],dataCy:"publish-popover-menu",showTip:!0,anchor:r[3],$$slots:{default:[jme]},$$scope:{ctx:r}};return l=new Uu({props:o}),r[15](l),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),S(l.$$.fragment),w(e,"class","publish-popover")},m(a,u){$(a,e,u),N(e,t),A(n,t,null),r[14](t),N(e,i),A(l,e,null),s=!0},p(a,u){r=a;const f={};u&32&&(f.disabled=!r[5]),u&8&&(f.anchor=r[3]),u&524322&&(f.$$scope={dirty:u,ctx:r}),l.$set(f)},i(a){s||(m(n.$$.fragment,a),m(l.$$.fragment,a),s=!0)},o(a){_(n.$$.fragment,a),_(l.$$.fragment,a),s=!1},d(a){a&&b(e),E(n),r[14](null),r[15](null),E(l)}}}function Pme(r){let e;return{c(){e=F("Your published app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Nme(r){let e,t=Cl("Last published {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(r[1][0].updatedAt).getTime()})+"",n;return{c(){e=j("span"),n=F(t),w(e,"class","publish-popover-message")},m(i,l){$(i,e,l),N(e,n)},p(i,l){l&2&&t!==(t=Cl("Last published {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(i[1][0].updatedAt).getTime()})+"")&&Oe(n,t)},d(i){i&&b(e)}}}function Rme(r){let e;return{c(){e=F("Unpublish")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Mme(r){let e;return{c(){e=F("View app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Dme(r){let e,t,n,i,l,s,o,a,u;return e=new _t({props:{size:"XS",$$slots:{default:[Pme]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",$$slots:{default:[Nme]},$$scope:{ctx:r}}}),s=new ot({props:{warning:!0,icon:"GlobeStrike",disabled:!r[5],dataCy:"publish-popover-action",$$slots:{default:[Rme]},$$scope:{ctx:r}}}),s.$on("click",r[7]),a=new ot({props:{cta:!0,$$slots:{default:[Mme]},$$scope:{ctx:r}}}),a.$on("click",r[6]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),l=j("div"),S(s.$$.fragment),o=R(),S(a.$$.fragment),w(l,"class","publish-popover-actions svelte-1af34u1")},m(f,c){A(e,f,c),$(f,t,c),A(n,f,c),$(f,i,c),$(f,l,c),A(s,l,null),N(l,o),A(a,l,null),u=!0},p(f,c){const p={};c&524288&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};c&524290&&(d.$$scope={dirty:c,ctx:f}),n.$set(d);const g={};c&32&&(g.disabled=!f[5]),c&524288&&(g.$$scope={dirty:c,ctx:f}),s.$set(g);const h={};c&524288&&(h.$$scope={dirty:c,ctx:f}),a.$set(h)},i(f){u||(m(e.$$.fragment,f),m(n.$$.fragment,f),m(s.$$.fragment,f),m(a.$$.fragment,f),u=!0)},o(f){_(e.$$.fragment,f),_(n.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),u=!1},d(f){E(e,f),f&&b(t),E(n,f),f&&b(i),f&&b(l),E(s),E(a)}}}function jme(r){let e,t;return e=new Ve({props:{gap:"M",$$slots:{default:[Dme]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&524322&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function a7(r){let e,t;return e=new ut({props:{size:"M",name:"GlobeStrike",disabled:!0,tooltip:"Your app has not been published yet"}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Bme(r){var s;let e,t,n=((s=r[0])==null?void 0:s.name)+"",i,l;return{c(){e=F("Are you sure you want to unpublish the app "),t=j("b"),i=F(n),l=F("?")},m(o,a){$(o,e,a),$(o,t,a),N(t,i),$(o,l,a)},p(o,a){var u;a&1&&n!==(n=((u=o[0])==null?void 0:u.name)+"")&&Oe(i,n)},d(o){o&&b(e),o&&b(t),o&&b(l)}}}function zme(r){let e,t,n,i,l,s,o,a=r[5]&&o7(r),u=!r[5]&&a7(),f={title:"Confirm unpublish",okText:"Unpublish app",onOk:r[8],dataCy:"unpublish-modal",$$slots:{default:[Bme]},$$scope:{ctx:r}};return i=new fr({props:f}),r[16](i),s=new Lme({props:{onOk:r[9]}}),{c(){e=j("div"),a&&a.c(),t=R(),u&&u.c(),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","deployment-top-nav")},m(c,p){$(c,e,p),a&&a.m(e,null),N(e,t),u&&u.m(e,null),$(c,n,p),A(i,c,p),$(c,l,p),A(s,c,p),o=!0},p(c,[p]){c[5]?a?(a.p(c,p),p&32&&m(a,1)):(a=o7(c),a.c(),m(a,1),a.m(e,t)):a&&(ee(),_(a,1,1,()=>{a=null}),te()),c[5]?u&&(ee(),_(u,1,1,()=>{u=null}),te()):u?p&32&&m(u,1):(u=a7(),u.c(),m(u,1),u.m(e,null));const d={};p&524289&&(d.$$scope={dirty:p,ctx:c}),i.$set(d)},i(c){o||(m(a),m(u),m(i.$$.fragment,c),m(s.$$.fragment,c),o=!0)},o(c){_(a),_(u),_(i.$$.fragment,c),_(s.$$.fragment,c),o=!1},d(c){c&&b(e),a&&a.d(),u&&u.d(),c&&b(n),r[16](null),E(i,c),c&&b(l),E(s,c)}}}function qme(r,e,t){let n,i,l,s,o,a;fe(r,Lr,L=>t(13,a=L));let{application:u}=e,f,c,p;const d=(L,M)=>{L.length>0&&$me(L,M).length&&we.warning("Deployment has been queued and will be processed shortly")};async function g(){try{const L=await Ze.getAppDeployments();return d(l,L),L}catch{we.error("Error fetching deployment history")}}const h=()=>{Ln.captureEvent(Nn.APP.VIEW_PUBLISHED,{appId:i.appId,eventSource:f1.PORTAL}),i.url?window.open(`/app${i.url}`):window.open(`/${i.prodId}`)},v=()=>{f.hide(),p.show()},y=async()=>{if(!(!u||!o))try{Ln.captureEvent(Nn.APP.UNPUBLISHED,{appId:i.appId}),await Ze.unpublishApp(i.prodId),await Lr.load(),we.success("App unpublished successfully")}catch{we.error("Error unpublishing app")}},k=async()=>{try{await Lr.load(),t(11,l=await g())}catch{we.error("Error refreshing app")}};qt(async()=>{a.length||await Lr.load(),t(11,l=await g())});function I(L){K[L?"unshift":"push"](()=>{c=L,t(3,c)})}function T(L){K[L?"unshift":"push"](()=>{f=L,t(2,f)})}function O(L){K[L?"unshift":"push"](()=>{p=L,t(4,p)})}return r.$$set=L=>{"application"in L&&t(10,u=L.application)},r.$$.update=()=>{r.$$.dirty&9216&&t(12,n=a.filter(L=>L.devId===u&&L.status==="published")),r.$$.dirty&4096&&t(0,i=(n==null?void 0:n.length)?n[0]:null),r.$$.dirty&2048&&t(1,s=l.filter(L=>L.status==="SUCCESS").sort((L,M)=>L.updatedAt>M.updatedAt)),r.$$.dirty&3&&t(5,o=i&&(s==null?void 0:s.length)>0)},t(11,l=[]),[i,s,f,c,p,o,h,v,y,k,u,l,n,a,I,T,O]}class Ume extends se{constructor(e){super();oe(this,e,qme,zme,ie,{application:10})}}function Fme(r){let e;return{c(){e=F("Self-host Budibase")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Vme(r){let e;return{c(){e=j("span"),e.textContent=`Self-host budibase for free to get unlimited apps and more - and it only
1257
1257
  takes a few minutes!`},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Hme(r){let e,t;return e=new Nt({props:{size:"M",onConfirm:r[1],title:"Self-host Budibase",confirmText:"Self-host Budibase",$$slots:{default:[Vme]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Wme(r){let e,t,n,i,l;t=new ot({props:{quiet:!0,primary:!0,size:"M",icon:"DownloadFromCloud",$$slots:{default:[Fme]},$$scope:{ctx:r}}}),t.$on("click",function(){ft(r[0].show)&&r[0].show.apply(this,arguments)});let s={$$slots:{default:[Hme]},$$scope:{ctx:r}};return i=new kt({props:s}),r[2](i),{c(){e=j("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment)},m(o,a){$(o,e,a),A(t,e,null),$(o,n,a),A(i,o,a),l=!0},p(o,[a]){r=o;const u={};a&16&&(u.$$scope={dirty:a,ctx:r}),t.$set(u);const f={};a&16&&(f.$$scope={dirty:a,ctx:r}),i.$set(f)},i(o){l||(m(t.$$.fragment,o),m(i.$$.fragment,o),l=!0)},o(o){_(t.$$.fragment,o),_(i.$$.fragment,o),l=!1},d(o){o&&b(e),E(t),o&&b(n),r[2](null),E(i,o)}}}function Gme(r,e,t){let n;fe(r,Cn,o=>t(3,n=o));let i;const l=()=>{window.open(`${n.accountPortalUrl}/portal/install`,"_blank")};function s(o){K[o?"unshift":"push"](()=>{i=o,t(0,i)})}return[i,l,s]}class Yme extends se{constructor(e){super();oe(this,e,Gme,Wme,ie,{})}}function u7(r,e,t){const n=r.slice();return n[17]=e[t].path,n[18]=e[t].title,n}function Jme(r){let e,t,n=r[21].message+"",i;return{c(){e=j("p"),t=F("Something went wrong: "),i=F(n)},m(l,s){$(l,e,s),N(e,t),N(e,i)},p:Ce,i:Ce,o:Ce,d(l){l&&b(e)}}}function Qme(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,y,k,I,T,O,L,M,U,D;u=new Vr({props:{selected:r[3],$$slots:{default:[Xme]},$$scope:{ctx:r}}}),c=new Ap({});let B=r[5].cloud&&r[6].user.account&&c7();h=new hme({}),y=new Y1e({}),I=new ut({props:{name:"Play",hoverable:!0}}),I.$on("click",r[8]),O=new Ume({props:{application:r[0]}});const V=r[10].default,G=bt(V,r,r[12],null);return{c(){e=j("div"),t=j("div"),n=j("div"),i=j("button"),l=j("img"),o=R(),a=j("div"),S(u.$$.fragment),f=R(),S(c.$$.fragment),p=R(),d=j("div"),B&&B.c(),g=R(),S(h.$$.fragment),v=R(),S(y.$$.fragment),k=R(),S(I.$$.fragment),T=R(),S(O.$$.fragment),L=R(),G&&G.c(),pn(l.src,s=kr)||w(l,"src",s),w(l,"alt","budibase icon"),w(l,"class","svelte-pm4ang"),w(i,"class","home-logo svelte-pm4ang"),w(a,"class","tabs svelte-pm4ang"),w(n,"class","topleftnav svelte-pm4ang"),w(d,"class","toprightnav svelte-pm4ang"),w(t,"class","top-nav svelte-pm4ang"),w(e,"class","root svelte-pm4ang")},m(Q,H){$(Q,e,H),N(e,t),N(t,n),N(n,i),N(i,l),N(n,o),N(n,a),A(u,a,null),N(n,f),A(c,n,null),N(t,p),N(t,d),B&&B.m(d,null),N(d,g),A(h,d,null),N(d,v),A(y,d,null),N(d,k),A(I,d,null),N(d,T),A(O,d,null),N(e,L),G&&G.m(e,null),M=!0,U||(D=Ne(l,"click",r[11]),U=!0)},p(Q,H){const q={};H&8&&(q.selected=Q[3]),H&4102&&(q.$$scope={dirty:H,ctx:Q}),u.$set(q),Q[5].cloud&&Q[6].user.account?B?H&96&&m(B,1):(B=c7(),B.c(),m(B,1),B.m(d,g)):B&&(ee(),_(B,1,1,()=>{B=null}),te());const W={};H&1&&(W.application=Q[0]),O.$set(W),G&&G.p&&(!M||H&4096)&&vt(G,V,Q,Q[12],M?yt(V,Q[12],H,null):wt(Q[12]),null)},i(Q){M||(m(u.$$.fragment,Q),m(c.$$.fragment,Q),m(B),m(h.$$.fragment,Q),m(y.$$.fragment,Q),m(I.$$.fragment,Q),m(O.$$.fragment,Q),m(G,Q),M=!0)},o(Q){_(u.$$.fragment,Q),_(c.$$.fragment,Q),_(B),_(h.$$.fragment,Q),_(y.$$.fragment,Q),_(I.$$.fragment,Q),_(O.$$.fragment,Q),_(G,Q),M=!1},d(Q){Q&&b(e),E(u),E(c),B&&B.d(),E(h),E(y),E(I),E(O),G&&G.d(Q),U=!1,D()}}}function f7(r){let e,t;return e=new bn({props:{quiet:!0,selected:r[1](r[17]),title:Cr(r[18])}}),e.$on("click",function(){ft(r[9](r[17]))&&r[9](r[17]).apply(this,arguments)}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){r=n;const l={};i&6&&(l.selected=r[1](r[17])),i&4&&(l.title=Cr(r[18])),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Xme(r){let e,t,n=r[2].children,i=[];for(let s=0;s<n.length;s+=1)i[s]=f7(u7(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Ee()},m(s,o){for(let a=0;a<i.length;a+=1)i[a].m(s,o);$(s,e,o),t=!0},p(s,o){if(o&518){n=s[2].children;let a;for(a=0;a<n.length;a+=1){const u=u7(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=f7(u),i[a].c(),m(i[a],1),i[a].m(e.parentNode,e))}for(ee(),a=n.length;a<i.length;a+=1)l(a);te()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){gt(i,s),s&&b(e)}}}function c7(r){let e,t;return e=new Yme({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Kme(r){let e;return{c(){e=j("div"),w(e,"class","loading svelte-pm4ang")},m(t,n){$(t,e,n)},p:Ce,i:Ce,o:Ce,d(t){t&&b(e)}}}function Zme(r){let e,t,n={ctx:r,current:null,token:null,hasCatch:!0,pending:Kme,then:Qme,catch:Jme,value:16,error:21,blocks:[,,,]};return KS(r[7],n),{c(){e=Ee(),n.block.c()},m(i,l){$(i,e,l),n.block.m(i,n.anchor=l),n.mount=()=>e.parentNode,n.anchor=e,t=!0},p(i,[l]){r=i,ZS(n,r,l)},i(i){t||(m(n.block),t=!0)},o(i){for(let l=0;l<3;l+=1){const s=n.blocks[l];_(s)}t=!1},d(i){i&&b(e),n.block.d(i),n.token=null,n=null}}}function xme(r,e,t){let n,i,l,s,o,a,u;fe(r,Ut,I=>t(4,i=I)),fe(r,wp,I=>t(1,l=I)),fe(r,xS,I=>t(2,s=I)),fe(r,Kr,I=>t(14,o=I)),fe(r,Cn,I=>t(5,a=I)),fe(r,Ft,I=>t(6,u=I));let{$$slots:f={},$$scope:c}=e,{application:p}=e,d=v(),g=!1;const h=()=>{window.open(`/${p}`)};async function v(){try{const I=await Ze.fetchAppPackage(p);return await Ge.actions.initialise(I),await Qt.actions.fetch(),await vi.fetch(),await a1.fetch(),I}catch(I){we.error(`Error initialising app: ${I==null?void 0:I.message}`),o("../../")}}const y=I=>()=>{const T=s.children.find(O=>l(O.path));!T||Ge.update(O=>(O.previousTopNavPath||(O.previousTopNavPath={}),O.previousTopNavPath[T.path]=window.location.pathname,i(O.previousTopNavPath[I]||I),O))};qt(async()=>{if(!g&&p){try{await Ze.syncApp(p)}catch{we.error("Failed to sync with production database")}g=!0}}),vp(()=>{Ge.actions.reset()});const k=()=>i("../../portal/");return r.$$set=I=>{"application"in I&&t(0,p=I.application),"$$scope"in I&&t(12,c=I.$$scope)},r.$$.update=()=>{var I,T;r.$$.dirty&6&&t(3,n=Cr((T=(I=s.children.find(O=>l(O.path)))==null?void 0:I.title)!=null?T:"data"))},[p,l,s,n,i,a,u,d,h,y,f,k,c]}class ege extends se{constructor(e){super();oe(this,e,xme,Zme,ie,{application:0})}}function tge(r,e,t){let n;return fe(r,Ut,i=>t(0,n=i)),n("../portal"),[]}class nge extends se{constructor(e){super();oe(this,e,tge,null,ie,{})}}function p7(r){let e;const t=r[2].default,n=bt(t,r,r[1],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&2)&&vt(n,t,i,i[1],e?yt(t,i[1],l,null):wt(i[1]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function rge(r){let e,t,n=r[0].user&&p7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[0].user?n?(n.p(i,l),l&1&&m(n,1)):(n=p7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function ige(r,e,t){let n;fe(r,Ft,s=>t(0,n=s));let{$$slots:i={},$$scope:l}=e;return r.$$set=s=>{"$$scope"in s&&t(1,l=s.$$scope)},[n,l,i]}class lge extends se{constructor(e){super();oe(this,e,ige,rge,ie,{})}}const sge=(r,e={})=>{const t={points:12,saturation:.85,lightness:.7,softness:.9,seed:null,version:null},n=i=>{var h;i=ke(ke({},t),i);const{saturation:l,lightness:s,softness:o,points:a}=i,u=i.seed||Math.random().toString(32).substring(2),f=(h=i.version)!=null?h:0,c=(v,y=0,k=100,I=0)=>{const T=k-y;let O=T+I;for(let L=0;L<v.length*2+I;L++)O=(O<<5)-O+v.charCodeAt(L%v.length),O=(O&O)%T+I;return y+O%T},p=(v,y,k=1)=>{const I=Math.min(100,l*100),T=Math.min(100,(l+.2)*100),O=Math.min(100,s*100),L=Math.min(100,(s+.2)*100),M=c(v,0,360,y),U=`${c(v,I,T,y)}%`,D=`${c(v,O,L,y)}%`;return`hsla(${M},${U},${D},${k})`},d=(v,y)=>{const k=Math.min(100,o*100),I=Math.min(100,(o+.2)*100),T=c(v,k,I,y);return`radial-gradient(at ${c(v,0,100,y)}% ${c(v,0,100,y+1)}%,${p(v,y,l)} 0,transparent ${T}%)`};let g=`opacity:0.9;background:${p(u,f,.7)};`;g+="background-image:";for(let v=0;v<a-1;v++)g+=`${d(u,f+v)},`;g+=`${d(u,a)};`,r.style=g};return n(e),{update:i=>{n(i)}}};function oge(r){let e;return{c(){e=F("Personalise the platform by adding your first name and last name.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function age(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ye({props:{size:"S",$$slots:{default:[oge]},$$scope:{ctx:r}}});function p(k){r[4](k)}let d={disabled:!0,label:"Email"};r[1].user.email!==void 0&&(d.value=r[1].user.email),n=new nt({props:d}),K.push(()=>de(n,"value",p));function g(k){r[5](k)}let h={label:"First name"};r[0].firstName!==void 0&&(h.value=r[0].firstName),s=new nt({props:h}),K.push(()=>de(s,"value",g));function v(k){r[6](k)}let y={label:"Last name"};return r[0].lastName!==void 0&&(y.value=r[0].lastName),u=new nt({props:y}),K.push(()=>de(u,"value",v)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment),a=R(),S(u.$$.fragment)},m(k,I){A(e,k,I),$(k,t,I),A(n,k,I),$(k,l,I),A(s,k,I),$(k,a,I),A(u,k,I),c=!0},p(k,I){const T={};I&128&&(T.$$scope={dirty:I,ctx:k}),e.$set(T);const O={};!i&&I&2&&(i=!0,O.value=k[1].user.email,me(()=>i=!1)),n.$set(O);const L={};!o&&I&1&&(o=!0,L.value=k[0].firstName,me(()=>o=!1)),s.$set(L);const M={};!f&&I&1&&(f=!0,M.value=k[0].lastName,me(()=>f=!1)),u.$set(M)},i(k){c||(m(e.$$.fragment,k),m(n.$$.fragment,k),m(s.$$.fragment,k),m(u.$$.fragment,k),c=!0)},o(k){_(e.$$.fragment,k),_(n.$$.fragment,k),_(s.$$.fragment,k),_(u.$$.fragment,k),c=!1},d(k){E(e,k),k&&b(t),E(n,k),k&&b(l),E(s,k),k&&b(a),E(u,k)}}}function uge(r){let e,t;return e=new Nt({props:{title:"Update user information",confirmText:"Update information",onConfirm:r[3],$$slots:{default:[age]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&131&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function fge(r,e,t){let n,i;fe(r,Ft,f=>t(1,i=f));const l=mn({firstName:i.user.firstName,lastName:i.user.lastName});fe(r,l,f=>t(0,n=f));const s=async()=>{try{await Ft.updateSelf(n),we.success("Information updated successfully")}catch{we.error("Failed to update information")}};function o(f){r.$$.not_equal(i.user.email,f)&&(i.user.email=f,Ft.set(i))}function a(f){r.$$.not_equal(n.firstName,f)&&(n.firstName=f,l.set(n))}function u(f){r.$$.not_equal(n.lastName,f)&&(n.lastName=f,l.set(n))}return[n,i,l,s,o,a,u]}class d7 extends se{constructor(e){super();oe(this,e,fge,uge,ie,{})}}function cge(r){let e;return{c(){e=F("Enter your new password below.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pge(r){let e,t,n,i,l,s;e=new Ye({props:{size:"S",$$slots:{default:[cge]},$$scope:{ctx:r}}});function o(f){r[3](f)}function a(f){r[4](f)}let u={};return r[0]!==void 0&&(u.password=r[0]),r[1]!==void 0&&(u.error=r[1]),n=new Zf({props:u}),K.push(()=>de(n,"password",o)),K.push(()=>de(n,"error",a)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(f,c){A(e,f,c),$(f,t,c),A(n,f,c),s=!0},p(f,c){const p={};c&32&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};!i&&c&1&&(i=!0,d.password=f[0],me(()=>i=!1)),!l&&c&2&&(l=!0,d.error=f[1],me(()=>l=!1)),n.$set(d)},i(f){s||(m(e.$$.fragment,f),m(n.$$.fragment,f),s=!0)},o(f){_(e.$$.fragment,f),_(n.$$.fragment,f),s=!1},d(f){E(e,f),f&&b(t),E(n,f)}}}function dge(r){let e,t;return e=new Nt({props:{title:"Update password",confirmText:"Update password",onConfirm:r[2],disabled:r[1]||!r[0],$$slots:{default:[pge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&3&&(l.disabled=n[1]||!n[0]),i&35&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function mge(r,e,t){let n,i;const l=async()=>{try{await Ft.updateSelf({password:n}),we.success("Password changed successfully")}catch{we.error("Failed to update password")}};function s(a){n=a,t(0,n)}function o(a){i=a,t(1,i)}return[n,i,l,s,o]}class m7 extends se{constructor(e){super();oe(this,e,mge,dge,ie,{})}}function g7(r,e,t){const n=r.slice();return n[16]=e[t],n[18]=t,n}function _7(r){let e,t,n,i,l,s,o;t=new Ks({props:{$$slots:{default:[Dge]},$$scope:{ctx:r}}});let a={$$slots:{default:[jge]},$$scope:{ctx:r}};i=new kt({props:a}),r[13](i);let u={$$slots:{default:[Bge]},$$scope:{ctx:r}};return s=new kt({props:u}),r[14](s),{c(){e=j("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","container svelte-1c5j0qx")},m(f,c){$(f,e,c),A(t,e,null),$(f,n,c),A(i,f,c),$(f,l,c),A(s,f,c),o=!0},p(f,c){const p={};c&524413&&(p.$$scope={dirty:c,ctx:f}),t.$set(p);const d={};c&524288&&(d.$$scope={dirty:c,ctx:f}),i.$set(d);const g={};c&524288&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),m(s.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),_(s.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),f&&b(n),r[13](null),E(i,f),f&&b(l),r[14](null),E(s,f)}}}function gge(r){let e;return{c(){e=F("Update user information")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function _ge(r){let e;return{c(){e=F("Update password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function h7(r){let e,t;return e=new Kt({props:{icon:"UserDeveloper",$$slots:{default:[hge]},$$scope:{ctx:r}}}),e.$on("click",r[12]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&524288&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function hge(r){let e;return{c(){e=F("Open developer mode")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $ge(r){let e;return{c(){e=F("Log out")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function bge(r){let e,t,n,i,l,s,o;e=new Kt({props:{icon:"UserEdit",$$slots:{default:[gge]},$$scope:{ctx:r}}}),e.$on("click",r[10]),n=new Kt({props:{icon:"LockClosed",$$slots:{default:[_ge]},$$scope:{ctx:r}}}),n.$on("click",r[11]);let a=r[0].isBuilder&&h7(r);return s=new Kt({props:{icon:"LogOut",$$slots:{default:[$ge]},$$scope:{ctx:r}}}),s.$on("click",r[7]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),a&&a.c(),l=R(),S(s.$$.fragment)},m(u,f){A(e,u,f),$(u,t,f),A(n,u,f),$(u,i,f),a&&a.m(u,f),$(u,l,f),A(s,u,f),o=!0},p(u,f){const c={};f&524288&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&524288&&(p.$$scope={dirty:f,ctx:u}),n.$set(p),u[0].isBuilder?a?(a.p(u,f),f&1&&m(a,1)):(a=h7(u),a.c(),m(a,1),a.m(l.parentNode,l)):a&&(ee(),_(a,1,1,()=>{a=null}),te());const d={};f&524288&&(d.$$scope={dirty:f,ctx:u}),s.$set(d)},i(u){o||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(a),m(s.$$.fragment,u),o=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(a),_(s.$$.fragment,u),o=!1},d(u){E(e,u),u&&b(t),E(n,u),u&&b(i),a&&a.d(u),u&&b(l),E(s,u)}}}function vge(r){let e,t,n,i,l;return t=new Cp({props:{size:"M",initials:r[0].initials,url:r[0].user.pictureUrl}}),i=new ut({props:{size:"XL",name:"ChevronDown"}}),{c(){e=j("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),w(e,"slot","control"),w(e,"class","avatar svelte-1c5j0qx")},m(s,o){$(s,e,o),A(t,e,null),N(e,n),A(i,e,null),l=!0},p(s,o){const a={};o&1&&(a.initials=s[0].initials),o&1&&(a.url=s[0].user.pictureUrl),t.$set(a)},i(s){l||(m(t.$$.fragment,s),m(i.$$.fragment,s),l=!0)},o(s){_(t.$$.fragment,s),_(i.$$.fragment,s),l=!1},d(s){s&&b(e),E(t),E(i)}}}function wge(r){let e,t=(r[0].user.firstName||r[0].user.email)+"",n;return{c(){e=F("Hey "),n=F(t)},m(i,l){$(i,e,l),$(i,n,l)},p(i,l){l&1&&t!==(t=(i[0].user.firstName||i[0].user.email)+"")&&Oe(n,t)},d(i){i&&b(e),i&&b(n)}}}function yge(r){let e,t=r[5].company+"",n,i;return{c(){e=F("Welcome to the "),n=F(t),i=F(` portal. Below you'll find the
1258
1258
  list of apps that you have access to.`)},m(l,s){$(l,e,s),$(l,n,s),$(l,i,s)},p(l,s){s&32&&t!==(t=l[5].company+"")&&Oe(n,t)},d(l){l&&b(e),l&&b(n),l&&b(i)}}}function kge(r){let e,t,n,i;return e=new _t({props:{size:"M",$$slots:{default:[wge]},$$scope:{ctx:r}}}),n=new Ye({props:{$$slots:{default:[yge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&524289&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&524320&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Cge(r){let e,t;return e=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[Oge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&524288&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Sge(r){let e,t,n,i,l;return e=new _t({props:{$$slots:{default:[Tge]},$$scope:{ctx:r}}}),i=new Ve({props:{gap:"S",noPadding:!0,$$slots:{default:[Rge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=j("div"),S(i.$$.fragment),w(n,"class","group")},m(s,o){A(e,s,o),$(s,t,o),$(s,n,o),A(i,n,null),l=!0},p(s,o){const a={};o&524288&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&524304&&(u.$$scope={dirty:o,ctx:s}),i.$set(u)},i(s){l||(m(e.$$.fragment,s),m(i.$$.fragment,s),l=!0)},o(s){_(e.$$.fragment,s),_(i.$$.fragment,s),l=!1},d(s){E(e,s),s&&b(t),s&&b(n),E(i)}}}function Age(r){let e;return{c(){e=F("You don't have access to any apps yet.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Ege(r){let e;return{c(){e=F("The apps you have access to will be listed here.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Oge(r){let e,t,n,i;return e=new _t({props:{size:"S",$$slots:{default:[Age]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",$$slots:{default:[Ege]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&524288&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&524288&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Tge(r){let e;return{c(){e=F("Apps")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Ige(r){let e=r[16].name+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[16].name+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Lge(r){let e;return{c(){e=F("Never updated")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Pge(r){let e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(r[16].updatedAt).getTime()})+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(n[16].updatedAt).getTime()})+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Nge(r){let e;function t(l,s){return l[16].updatedAt?Pge:Lge}let n=t(r),i=n(r);return{c(){i.c(),e=Ee()},m(l,s){i.m(l,s),$(l,e,s)},p(l,s){n===(n=t(l))&&i?i.p(l,s):(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function $7(r,e){let t,n,i,l,s,o,a,u,f,c,p,d,g,h,v;return o=new _t({props:{size:"XS",$$slots:{default:[Ige]},$$scope:{ctx:e}}}),u=new Ye({props:{size:"S",$$slots:{default:[Nge]},$$scope:{ctx:e}}}),c=new ut({props:{name:"ChevronRight"}}),{key:r,first:null,c(){t=j("a"),n=j("div"),l=R(),s=j("div"),S(o.$$.fragment),a=R(),S(u.$$.fragment),f=R(),S(c.$$.fragment),p=R(),w(n,"class","preview svelte-1c5j0qx"),w(s,"class","app-info"),w(t,"class","app svelte-1c5j0qx"),w(t,"target","_blank"),w(t,"href",d=b7(e[16])),this.first=t},m(y,k){$(y,t,k),N(t,n),N(t,l),N(t,s),A(o,s,null),N(s,a),A(u,s,null),N(t,f),A(c,t,null),N(t,p),g=!0,h||(v=vr(i=sge.call(null,n,{seed:e[16].name})),h=!0)},p(y,k){e=y,i&&ft(i.update)&&k&16&&i.update.call(null,{seed:e[16].name});const I={};k&524304&&(I.$$scope={dirty:k,ctx:e}),o.$set(I);const T={};k&524304&&(T.$$scope={dirty:k,ctx:e}),u.$set(T),(!g||k&16&&d!==(d=b7(e[16])))&&w(t,"href",d)},i(y){g||(m(o.$$.fragment,y),m(u.$$.fragment,y),m(c.$$.fragment,y),g=!0)},o(y){_(o.$$.fragment,y),_(u.$$.fragment,y),_(c.$$.fragment,y),g=!1},d(y){y&&b(t),E(o),E(u),E(c),h=!1,v()}}}function Rge(r){let e=[],t=new Map,n,i,l=r[4];const s=o=>o[16].appId;for(let o=0;o<l.length;o+=1){let a=g7(r,l,o),u=s(a);t.set(u,e[o]=$7(u,a))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();n=Ee()},m(o,a){for(let u=0;u<e.length;u+=1)e[u].m(o,a);$(o,n,a),i=!0},p(o,a){a&16&&(l=o[4],ee(),e=nr(e,a,s,1,o,l,t,n.parentNode,jr,$7,n,g7),te())},i(o){if(!i){for(let a=0;a<l.length;a+=1)m(e[a]);i=!0}},o(o){for(let a=0;a<e.length;a+=1)_(e[a]);i=!1},d(o){for(let a=0;a<e.length;a+=1)e[a].d(o);o&&b(n)}}}function Mge(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g;l=new wr({props:{align:"right",$$slots:{control:[vge],default:[bge]},$$scope:{ctx:r}}}),o=new Ve({props:{noPadding:!0,gap:"XS",$$slots:{default:[kge]},$$scope:{ctx:r}}}),u=new nn({});const h=[Sge,Cge],v=[];function y(k,I){return k[4].length?0:1}return c=y(r),p=v[c]=h[c](r),{c(){e=j("div"),t=j("img"),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment),a=R(),S(u.$$.fragment),f=R(),p.c(),d=Ee(),w(t,"alt","logo"),pn(t.src,n=r[5].logoUrl||kr)||w(t,"src",n),w(t,"class","svelte-1c5j0qx"),w(e,"class","header svelte-1c5j0qx")},m(k,I){$(k,e,I),N(e,t),N(e,i),A(l,e,null),$(k,s,I),A(o,k,I),$(k,a,I),A(u,k,I),$(k,f,I),v[c].m(k,I),$(k,d,I),g=!0},p(k,I){(!g||I&32&&!pn(t.src,n=k[5].logoUrl||kr))&&w(t,"src",n);const T={};I&524365&&(T.$$scope={dirty:I,ctx:k}),l.$set(T);const O={};I&524321&&(O.$$scope={dirty:I,ctx:k}),o.$set(O);let L=c;c=y(k),c===L?v[c].p(k,I):(ee(),_(v[L],1,1,()=>{v[L]=null}),te(),p=v[c],p?p.p(k,I):(p=v[c]=h[c](k),p.c()),m(p,1),p.m(d.parentNode,d))},i(k){g||(m(l.$$.fragment,k),m(o.$$.fragment,k),m(u.$$.fragment,k),m(p),g=!0)},o(k){_(l.$$.fragment,k),_(o.$$.fragment,k),_(u.$$.fragment,k),_(p),g=!1},d(k){k&&b(e),E(l),k&&b(s),E(o,k),k&&b(a),E(u,k),k&&b(f),v[c].d(k),k&&b(d)}}}function Dge(r){let e,t,n;return t=new Ve({props:{noPadding:!0,$$slots:{default:[Mge]},$$scope:{ctx:r}}}),{c(){e=j("div"),S(t.$$.fragment),w(e,"class","content svelte-1c5j0qx")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&524413&&(s.$$scope={dirty:l,ctx:i}),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function jge(r){let e,t;return e=new d7({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Bge(r){let e,t;return e=new m7({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function zge(r){let e,t,n=r[0].user&&r[1]&&_7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[0].user&&i[1]?n?(n.p(i,l),l&3&&m(n,1)):(n=_7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function b7(r){return r.url?`/app${r.url}`:`/${r.prodId}`}function qge(r,e,t){let n,i,l,s,o,a;fe(r,Ft,I=>t(0,l=I)),fe(r,Lr,I=>t(9,s=I)),fe(r,hr,I=>t(5,o=I)),fe(r,Ut,I=>t(6,a=I));let u=!1,f,c;qt(async()=>{try{await hr.init(),await Lr.load()}catch{we.error("Error loading apps")}t(1,u=!0)});const p=I=>I.status===Pa.DEPLOYED,d=async()=>{try{await Ft.logout()}catch{}},g=()=>f.show(),h=()=>c.show(),v=()=>a("../portal");function y(I){K[I?"unshift":"push"](()=>{f=I,t(2,f)})}function k(I){K[I?"unshift":"push"](()=>{c=I,t(3,c)})}return r.$$.update=()=>{var I,T;r.$$.dirty&512&&t(8,n=s.filter(p)),r.$$.dirty&257&&t(4,i=((T=(I=l.user)==null?void 0:I.builder)==null?void 0:T.global)?n:n.filter(O=>{var L;return Object.keys((L=l.user)==null?void 0:L.roles).includes(O.prodId)}))},[l,u,f,c,i,o,a,d,n,s,g,h,v,y,k]}class Uge extends se{constructor(e){super();oe(this,e,qge,zge,ie,{})}}function v7(r){let e;const t=r[2].default,n=bt(t,r,r[1],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&2)&&vt(n,t,i,i[1],e?yt(t,i[1],l,null):wt(i[1]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function Fge(r){let e,t,n=r[0].user&&v7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[0].user?n?(n.p(i,l),l&1&&m(n,1)):(n=v7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function Vge(r,e,t){let n;fe(r,Ft,s=>t(0,n=s));let{$$slots:i={},$$scope:l}=e;return r.$$set=s=>{"$$scope"in s&&t(1,l=s.$$scope)},[n,l,i]}class Hge extends se{constructor(e){super();oe(this,e,Vge,Fge,ie,{})}}function Wge(r){let e,t;return{c(){e=j("img"),w(e,"alt","logo"),pn(e.src,t=r[1].logoUrl||kr)||w(e,"src",t),w(e,"class","svelte-jotad8")},m(n,i){$(n,e,i)},p(n,i){i&2&&!pn(e.src,t=n[1].logoUrl||kr)&&w(e,"src",t)},d(n){n&&b(e)}}}function Gge(r){let e;return{c(){e=F("Forgotten your password?")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Yge(r){let e;return{c(){e=F(`No problem! Just enter your account's email address and we'll send you
1259
- a link to reset it.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Jge(r){let e,t,n,i,l,s,o;e=new _t({props:{textAlign:"center",$$slots:{default:[Gge]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[Yge]},$$scope:{ctx:r}}});function a(f){r[4](f)}let u={label:"Email"};return r[0]!==void 0&&(u.value=r[0]),l=new nt({props:u}),K.push(()=>de(l,"value",a)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(f,c){A(e,f,c),$(f,t,c),A(n,f,c),$(f,i,c),A(l,f,c),o=!0},p(f,c){const p={};c&64&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};c&64&&(d.$$scope={dirty:c,ctx:f}),n.$set(d);const g={};!s&&c&1&&(s=!0,g.value=f[0],me(()=>s=!1)),l.$set(g)},i(f){o||(m(e.$$.fragment,f),m(n.$$.fragment,f),m(l.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(n.$$.fragment,f),_(l.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),E(n,f),f&&b(i),E(l,f)}}}function Qge(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Xge(r){let e;return{c(){e=F("Back")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Kge(r){let e,t,n,i;return e=new ot({props:{cta:!0,disabled:!r[0],$$slots:{default:[Qge]},$$scope:{ctx:r}}}),e.$on("click",r[3]),n=new Jt({props:{quiet:!0,$$slots:{default:[Xge]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&1&&(o.disabled=!l[0]),s&64&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&64&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Zge(r){let e,t,n,i,l,s;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[Wge]},$$scope:{ctx:r}}}),n=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[Jge]},$$scope:{ctx:r}}}),l=new Ve({props:{gap:"XS",nopadding:!0,$$slots:{default:[Kge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(o,a){A(e,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&66&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&65&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&69&&(c.$$scope={dirty:a,ctx:o}),l.$set(c)},i(o){s||(m(e.$$.fragment,o),m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){E(e,o),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function xge(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[Zge]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&71&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function e_e(r,e,t){let n,i;fe(r,hr,u=>t(1,n=u)),fe(r,Ut,u=>t(2,i=u));let l="";async function s(){try{await Ft.forgotPassword(l),we.success("Email sent - please check your inbox")}catch{we.error("Unable to send reset password link")}}qt(async()=>{try{await hr.init()}catch{we.error("Error getting org config")}});function o(u){l=u,t(0,l)}return[l,n,i,s,o,()=>i("../")]}class t_e extends se{constructor(e){super();oe(this,e,e_e,xge,ie,{})}}function n_e(r,e,t){let n,i,l,s,o;fe(r,Kr,u=>t(3,l=u)),fe(r,Cn,u=>t(4,s=u)),fe(r,Ft,u=>t(5,o=u));let a=!1;return qt(async()=>{try{await Cn.init(),await Ft.checkQueryString()}catch{we.error("Error getting checklist")}t(0,a=!0)}),r.$$.update=()=>{r.$$.dirty&32&&t(1,n=o.tenantSet),r.$$.dirty&16&&t(2,i=s.multiTenancy),r.$$.dirty&15&&(a&&i&&!n?l("./org"):a&&l("./login"))},[a,n,i,l,s,o]}class r_e extends se{constructor(e){super();oe(this,e,n_e,null,ie,{})}}function w7(r){let e,t;return e=new Jt({props:{$$slots:{default:[i_e]},$$scope:{ctx:r}}}),e.$on("click",r[4]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function i_e(r){let e,t,n,i,l;return{c(){e=j("div"),t=j("img"),i=R(),l=j("p"),l.textContent="Sign in with Google",pn(t.src,n=k5)||w(t,"src",n),w(t,"alt","google icon"),w(t,"class","svelte-yex2p4"),w(l,"class","svelte-yex2p4"),w(e,"class","inner svelte-yex2p4")},m(s,o){$(s,e,o),N(e,t),N(e,i),N(e,l)},p:Ce,d(s){s&&b(e)}}}function l_e(r){let e,t,n=r[0]&&w7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[0]?n?(n.p(i,l),l&1&&m(n,1)):(n=w7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function s_e(r,e,t){let n,i,l;fe(r,hr,a=>t(2,i=a)),fe(r,Ft,a=>t(3,l=a));let s;const o=()=>window.open(`/api/global/auth/${n}/google`,"_blank");return r.$$.update=()=>{r.$$.dirty&8&&t(1,n=l.tenantId),r.$$.dirty&4&&t(0,s=i.google)},[s,n,i,l,o]}class o_e extends se{constructor(e){super();oe(this,e,s_e,l_e,ie,{})}}var W1="/builder/assets/oidc-logo.cb2fff74.png",y7="/builder/assets/auth0-logo.6fa5973f.png",k7="/builder/assets/microsoft-logo.07033b2a.png",C7="/builder/assets/okta-logo.61437d3d.png",S7="/builder/assets/onelogin-logo.181cc193.png";function A7(r){let e,t;return e=new Jt({props:{$$slots:{default:[a_e]},$$scope:{ctx:r}}}),e.$on("click",r[5]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&131&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function a_e(r){let e,t,n,i,l,s=`Sign in with ${r[0].name||"OIDC"}`,o;return{c(){e=j("div"),t=j("img"),i=R(),l=j("p"),o=F(s),pn(t.src,n=r[1])||w(t,"src",n),w(t,"alt","oidc icon"),w(t,"class","svelte-yex2p4"),w(l,"class","svelte-yex2p4"),w(e,"class","inner svelte-yex2p4")},m(a,u){$(a,e,u),N(e,t),N(e,i),N(e,l),N(l,o)},p(a,u){u&2&&!pn(t.src,n=a[1])&&w(t,"src",n),u&1&&s!==(s=`Sign in with ${a[0].name||"OIDC"}`)&&Oe(o,s)},d(a){a&&b(e)}}}function u_e(r){let e,t,n=r[2]&&A7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[2]?n?(n.p(i,l),l&4&&m(n,1)):(n=A7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function f_e(r,e,t){let n,i,l,s,o;fe(r,$1,f=>t(0,l=f)),fe(r,hr,f=>t(4,s=f)),fe(r,Ft,f=>t(3,o=f));let a={Oidc:W1,Auth0:y7,Microsoft:k7,Okta:C7,OneLogin:S7};qt(async()=>{try{await $1.init()}catch{we.error("Error getting OIDC config")}});const u=()=>window.open(`/api/global/auth/${o.tenantId}/oidc/configs/${l.uuid}`,"_blank");return r.$$.update=()=>{r.$$.dirty&16&&t(2,n=s.oidc),r.$$.dirty&1&&t(1,i=l.logo?a[l.logo]||`/global/logos_oidc/${l.logo}`:W1)},[l,i,n,o,s,u]}class c_e extends se{constructor(e){super();oe(this,e,f_e,u_e,ie,{})}}function p_e(r){let e,t;return{c(){e=F("Sign in to "),t=F(r[6])},m(n,i){$(n,e,i),$(n,t,i)},p(n,i){i&64&&Oe(t,n[6])},d(n){n&&b(e),n&&b(t)}}}function d_e(r){let e,t,n,i,l;return i=new _t({props:{$$slots:{default:[p_e]},$$scope:{ctx:r}}}),{c(){e=j("img"),n=R(),S(i.$$.fragment),w(e,"alt","logo"),pn(e.src,t=r[0].logoUrl||kr)||w(e,"src",t),w(e,"class","svelte-jotad8")},m(s,o){$(s,e,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){(!l||o&1&&!pn(e.src,t=s[0].logoUrl||kr))&&w(e,"src",t);const a={};o&262208&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(n),E(i,s)}}}function E7(r){let e,t,n,i;return e=new o_e({}),n=new c_e({props:{oidcIcon:r[8].logo,oidcName:r[8].name}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&256&&(o.oidcIcon=l[8].logo),s&256&&(o.oidcName=l[8].name),n.$set(o)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function m_e(r){let e;return{c(){e=F("Sign in with email")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function g_e(r){let e,t,n,i,l,s,o,a;e=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[m_e]},$$scope:{ctx:r}}});function u(d){r[12](d)}let f={label:"Email"};r[1]!==void 0&&(f.value=r[1]),n=new nt({props:f}),K.push(()=>de(n,"value",u));function c(d){r[13](d)}let p={label:"Password",type:"password"};return r[2]!==void 0&&(p.value=r[2]),s=new nt({props:p}),K.push(()=>de(s,"value",c)),s.$on("change",r[14]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment)},m(d,g){A(e,d,g),$(d,t,g),A(n,d,g),$(d,l,g),A(s,d,g),a=!0},p(d,g){const h={};g&262144&&(h.$$scope={dirty:g,ctx:d}),e.$set(h);const v={};!i&&g&2&&(i=!0,v.value=d[1],me(()=>i=!1)),n.$set(v);const y={};!o&&g&4&&(o=!0,y.value=d[2],me(()=>o=!1)),s.$set(y)},i(d){a||(m(e.$$.fragment,d),m(n.$$.fragment,d),m(s.$$.fragment,d),a=!0)},o(d){_(e.$$.fragment,d),_(n.$$.fragment,d),_(s.$$.fragment,d),a=!1},d(d){E(e,d),d&&b(t),E(n,d),d&&b(l),E(s,d)}}}function __e(r){let e,t;return{c(){e=F("Sign in to "),t=F(r[6])},m(n,i){$(n,e,i),$(n,t,i)},p(n,i){i&64&&Oe(t,n[6])},d(n){n&&b(e),n&&b(t)}}}function h_e(r){let e;return{c(){e=F("Forgot password?")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function O7(r){let e,t;return e=new Jt({props:{quiet:!0,$$slots:{default:[$_e]},$$scope:{ctx:r}}}),e.$on("click",r[16]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&262144&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function $_e(r){let e;return{c(){e=F("Change organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function b_e(r){let e,t,n,i,l,s;e=new ot({props:{cta:!0,$$slots:{default:[__e]},$$scope:{ctx:r}}}),e.$on("click",r[9]),n=new Jt({props:{quiet:!0,$$slots:{default:[h_e]},$$scope:{ctx:r}}}),n.$on("click",r[15]);let o=r[5]&&!r[4]&&O7(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),o&&o.c(),l=Ee()},m(a,u){A(e,a,u),$(a,t,u),A(n,a,u),$(a,i,u),o&&o.m(a,u),$(a,l,u),s=!0},p(a,u){const f={};u&262208&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u&262144&&(c.$$scope={dirty:u,ctx:a}),n.$set(c),a[5]&&!a[4]?o?(o.p(a,u),u&48&&m(o,1)):(o=O7(a),o.c(),m(o,1),o.m(l.parentNode,l)):o&&(ee(),_(o,1,1,()=>{o=null}),te())},i(a){s||(m(e.$$.fragment,a),m(n.$$.fragment,a),m(o),s=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),_(o),s=!1},d(a){E(e,a),a&&b(t),E(n,a),a&&b(i),o&&o.d(a),a&&b(l)}}}function T7(r){let e,t;return e=new Ye({props:{size:"xs",textAlign:"center",$$slots:{default:[w_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function v_e(r){let e;return{c(){e=F("License Agreement")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function w_e(r){let e,t,n,i,l;return i=new Qs({props:{href:"https://budibase.com/eula",target:"_blank",$$slots:{default:[v_e]},$$scope:{ctx:r}}}),{c(){e=F(`By using Budibase Cloud
1259
+ a link to reset it.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Jge(r){let e,t,n,i,l,s,o;e=new _t({props:{textAlign:"center",$$slots:{default:[Gge]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[Yge]},$$scope:{ctx:r}}});function a(f){r[4](f)}let u={label:"Email"};return r[0]!==void 0&&(u.value=r[0]),l=new nt({props:u}),K.push(()=>de(l,"value",a)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(f,c){A(e,f,c),$(f,t,c),A(n,f,c),$(f,i,c),A(l,f,c),o=!0},p(f,c){const p={};c&64&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};c&64&&(d.$$scope={dirty:c,ctx:f}),n.$set(d);const g={};!s&&c&1&&(s=!0,g.value=f[0],me(()=>s=!1)),l.$set(g)},i(f){o||(m(e.$$.fragment,f),m(n.$$.fragment,f),m(l.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(n.$$.fragment,f),_(l.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),E(n,f),f&&b(i),E(l,f)}}}function Qge(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Xge(r){let e;return{c(){e=F("Back")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Kge(r){let e,t,n,i;return e=new ot({props:{cta:!0,disabled:!r[0],$$slots:{default:[Qge]},$$scope:{ctx:r}}}),e.$on("click",r[3]),n=new Jt({props:{quiet:!0,$$slots:{default:[Xge]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&1&&(o.disabled=!l[0]),s&64&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&64&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Zge(r){let e,t,n,i,l,s;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[Wge]},$$scope:{ctx:r}}}),n=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[Jge]},$$scope:{ctx:r}}}),l=new Ve({props:{gap:"XS",nopadding:!0,$$slots:{default:[Kge]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(o,a){A(e,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&66&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&65&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&69&&(c.$$scope={dirty:a,ctx:o}),l.$set(c)},i(o){s||(m(e.$$.fragment,o),m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){E(e,o),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function xge(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[Zge]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&71&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function e_e(r,e,t){let n,i;fe(r,hr,u=>t(1,n=u)),fe(r,Ut,u=>t(2,i=u));let l="";async function s(){try{await Ft.forgotPassword(l),we.success("Email sent - please check your inbox")}catch{we.error("Unable to send reset password link")}}qt(async()=>{try{await hr.init()}catch{we.error("Error getting org config")}});function o(u){l=u,t(0,l)}return[l,n,i,s,o,()=>i("../")]}class t_e extends se{constructor(e){super();oe(this,e,e_e,xge,ie,{})}}function n_e(r,e,t){let n,i,l,s,o;fe(r,Kr,u=>t(3,l=u)),fe(r,Cn,u=>t(4,s=u)),fe(r,Ft,u=>t(5,o=u));let a=!1;return qt(async()=>{try{await Cn.init(),await Ft.checkQueryString()}catch{we.error("Error getting checklist")}t(0,a=!0)}),r.$$.update=()=>{r.$$.dirty&32&&t(1,n=o.tenantSet),r.$$.dirty&16&&t(2,i=s.multiTenancy),r.$$.dirty&15&&(a&&i&&!n?l("./org"):a&&l("./login"))},[a,n,i,l,s,o]}class r_e extends se{constructor(e){super();oe(this,e,n_e,null,ie,{})}}function w7(r){let e,t;return e=new Jt({props:{$$slots:{default:[i_e]},$$scope:{ctx:r}}}),e.$on("click",r[4]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function i_e(r){let e,t,n,i,l;return{c(){e=j("div"),t=j("img"),i=R(),l=j("p"),l.textContent="Sign in with Google",pn(t.src,n=k5)||w(t,"src",n),w(t,"alt","google icon"),w(t,"class","svelte-yex2p4"),w(l,"class","svelte-yex2p4"),w(e,"class","inner svelte-yex2p4")},m(s,o){$(s,e,o),N(e,t),N(e,i),N(e,l)},p:Ce,d(s){s&&b(e)}}}function l_e(r){let e,t,n=r[0]&&w7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[0]?n?(n.p(i,l),l&1&&m(n,1)):(n=w7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function s_e(r,e,t){let n,i,l;fe(r,hr,a=>t(2,i=a)),fe(r,Ft,a=>t(3,l=a));let s;const o=()=>window.open(`/api/global/auth/${n}/google`,"_blank");return r.$$.update=()=>{r.$$.dirty&8&&t(1,n=l.tenantId),r.$$.dirty&4&&t(0,s=i.google)},[s,n,i,l,o]}class o_e extends se{constructor(e){super();oe(this,e,s_e,l_e,ie,{})}}var W1="/builder/assets/oidc-logo.cb2fff74.png",y7="/builder/assets/auth0-logo.6fa5973f.png",k7="/builder/assets/microsoft-logo.07033b2a.png",C7="/builder/assets/okta-logo.61437d3d.png",S7="/builder/assets/onelogin-logo.181cc193.png";function A7(r){let e,t;return e=new Jt({props:{$$slots:{default:[a_e]},$$scope:{ctx:r}}}),e.$on("click",r[5]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&131&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function a_e(r){let e,t,n,i,l,s=`Sign in with ${r[0].name||"OIDC"}`,o;return{c(){e=j("div"),t=j("img"),i=R(),l=j("p"),o=F(s),pn(t.src,n=r[1])||w(t,"src",n),w(t,"alt","oidc icon"),w(t,"class","svelte-yex2p4"),w(l,"class","svelte-yex2p4"),w(e,"class","inner svelte-yex2p4")},m(a,u){$(a,e,u),N(e,t),N(e,i),N(e,l),N(l,o)},p(a,u){u&2&&!pn(t.src,n=a[1])&&w(t,"src",n),u&1&&s!==(s=`Sign in with ${a[0].name||"OIDC"}`)&&Oe(o,s)},d(a){a&&b(e)}}}function u_e(r){let e,t,n=r[2]&&A7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){i[2]?n?(n.p(i,l),l&4&&m(n,1)):(n=A7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function f_e(r,e,t){let n,i,l,s,o;fe(r,$1,f=>t(0,l=f)),fe(r,hr,f=>t(4,s=f)),fe(r,Ft,f=>t(3,o=f));let a={Oidc:W1,Auth0:y7,Microsoft:k7,Okta:C7,OneLogin:S7};qt(async()=>{try{await $1.init()}catch{we.error("Error getting OIDC config")}});const u=()=>window.open(`/api/global/auth/${o.tenantId}/oidc/configs/${l.uuid}`,"_blank");return r.$$.update=()=>{r.$$.dirty&16&&t(2,n=s.oidc),r.$$.dirty&1&&t(1,i=l.logo?a[l.logo]||`/global/logos_oidc/${l.logo}`:W1)},[l,i,n,o,s,u]}class c_e extends se{constructor(e){super();oe(this,e,f_e,u_e,ie,{})}}function p_e(r){let e,t;return{c(){e=F("Sign in to "),t=F(r[6])},m(n,i){$(n,e,i),$(n,t,i)},p(n,i){i&64&&Oe(t,n[6])},d(n){n&&b(e),n&&b(t)}}}function d_e(r){let e,t,n,i,l;return i=new _t({props:{$$slots:{default:[p_e]},$$scope:{ctx:r}}}),{c(){e=j("img"),n=R(),S(i.$$.fragment),w(e,"alt","logo"),pn(e.src,t=r[0].logoUrl||kr)||w(e,"src",t),w(e,"class","svelte-jotad8")},m(s,o){$(s,e,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){(!l||o&1&&!pn(e.src,t=s[0].logoUrl||kr))&&w(e,"src",t);const a={};o&262208&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(n),E(i,s)}}}function E7(r){let e,t,n,i;return e=new o_e({}),n=new c_e({props:{oidcIcon:r[8].logo,oidcName:r[8].name}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&256&&(o.oidcIcon=l[8].logo),s&256&&(o.oidcName=l[8].name),n.$set(o)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function m_e(r){let e;return{c(){e=F("Sign in with email")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function g_e(r){let e,t,n,i,l,s,o,a;e=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[m_e]},$$scope:{ctx:r}}});function u(d){r[12](d)}let f={label:"Email"};r[1]!==void 0&&(f.value=r[1]),n=new nt({props:f}),K.push(()=>de(n,"value",u));function c(d){r[13](d)}let p={label:"Password",type:"password"};return r[2]!==void 0&&(p.value=r[2]),s=new nt({props:p}),K.push(()=>de(s,"value",c)),s.$on("change",r[14]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment)},m(d,g){A(e,d,g),$(d,t,g),A(n,d,g),$(d,l,g),A(s,d,g),a=!0},p(d,g){const h={};g&262144&&(h.$$scope={dirty:g,ctx:d}),e.$set(h);const v={};!i&&g&2&&(i=!0,v.value=d[1],me(()=>i=!1)),n.$set(v);const y={};!o&&g&4&&(o=!0,y.value=d[2],me(()=>o=!1)),s.$set(y)},i(d){a||(m(e.$$.fragment,d),m(n.$$.fragment,d),m(s.$$.fragment,d),a=!0)},o(d){_(e.$$.fragment,d),_(n.$$.fragment,d),_(s.$$.fragment,d),a=!1},d(d){E(e,d),d&&b(t),E(n,d),d&&b(l),E(s,d)}}}function __e(r){let e,t;return{c(){e=F("Sign in to "),t=F(r[6])},m(n,i){$(n,e,i),$(n,t,i)},p(n,i){i&64&&Oe(t,n[6])},d(n){n&&b(e),n&&b(t)}}}function h_e(r){let e;return{c(){e=F("Forgot password?")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function O7(r){let e,t;return e=new Jt({props:{quiet:!0,$$slots:{default:[$_e]},$$scope:{ctx:r}}}),e.$on("click",r[16]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&262144&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function $_e(r){let e;return{c(){e=F("Change organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function b_e(r){let e,t,n,i,l,s;e=new ot({props:{cta:!0,disabled:!r[1]&&!r[2],$$slots:{default:[__e]},$$scope:{ctx:r}}}),e.$on("click",r[9]),n=new Jt({props:{quiet:!0,$$slots:{default:[h_e]},$$scope:{ctx:r}}}),n.$on("click",r[15]);let o=r[5]&&!r[4]&&O7(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),o&&o.c(),l=Ee()},m(a,u){A(e,a,u),$(a,t,u),A(n,a,u),$(a,i,u),o&&o.m(a,u),$(a,l,u),s=!0},p(a,u){const f={};u&6&&(f.disabled=!a[1]&&!a[2]),u&262208&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u&262144&&(c.$$scope={dirty:u,ctx:a}),n.$set(c),a[5]&&!a[4]?o?(o.p(a,u),u&48&&m(o,1)):(o=O7(a),o.c(),m(o,1),o.m(l.parentNode,l)):o&&(ee(),_(o,1,1,()=>{o=null}),te())},i(a){s||(m(e.$$.fragment,a),m(n.$$.fragment,a),m(o),s=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),_(o),s=!1},d(a){E(e,a),a&&b(t),E(n,a),a&&b(i),o&&o.d(a),a&&b(l)}}}function T7(r){let e,t;return e=new Ye({props:{size:"xs",textAlign:"center",$$slots:{default:[w_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function v_e(r){let e;return{c(){e=F("License Agreement")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function w_e(r){let e,t,n,i,l;return i=new Qs({props:{href:"https://budibase.com/eula",target:"_blank",$$slots:{default:[v_e]},$$scope:{ctx:r}}}),{c(){e=F(`By using Budibase Cloud
1260
1260
  `),t=j("br"),n=F(`
1261
1261
  you are agreeing to our
1262
- `),S(i.$$.fragment)},m(s,o){$(s,e,o),$(s,t,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){const a={};o&262144&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(t),s&&b(n),E(i,s)}}}function y_e(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[d_e]},$$scope:{ctx:r}}});let p=r[3]&&E7(r);i=new nn({props:{noGrid:!0}}),s=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[g_e]},$$scope:{ctx:r}}}),a=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[b_e]},$$scope:{ctx:r}}});let d=r[4]&&T7(r);return{c(){S(e.$$.fragment),t=R(),p&&p.c(),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),d&&d.c(),f=Ee()},m(g,h){A(e,g,h),$(g,t,h),p&&p.m(g,h),$(g,n,h),A(i,g,h),$(g,l,h),A(s,g,h),$(g,o,h),A(a,g,h),$(g,u,h),d&&d.m(g,h),$(g,f,h),c=!0},p(g,h){const v={};h&262209&&(v.$$scope={dirty:h,ctx:g}),e.$set(v),g[3]?p?(p.p(g,h),h&8&&m(p,1)):(p=E7(g),p.c(),m(p,1),p.m(n.parentNode,n)):p&&(ee(),_(p,1,1,()=>{p=null}),te());const y={};h&262150&&(y.$$scope={dirty:h,ctx:g}),s.$set(y);const k={};h&262384&&(k.$$scope={dirty:h,ctx:g}),a.$set(k),g[4]?d?h&16&&m(d,1):(d=T7(g),d.c(),m(d,1),d.m(f.parentNode,f)):d&&(ee(),_(d,1,1,()=>{d=null}),te())},i(g){c||(m(e.$$.fragment,g),m(p),m(i.$$.fragment,g),m(s.$$.fragment,g),m(a.$$.fragment,g),m(d),c=!0)},o(g){_(e.$$.fragment,g),_(p),_(i.$$.fragment,g),_(s.$$.fragment,g),_(a.$$.fragment,g),_(d),c=!1},d(g){E(e,g),g&&b(t),p&&p.d(g),g&&b(n),E(i,g),g&&b(l),E(s,g),g&&b(o),E(a,g),g&&b(u),d&&d.d(g),g&&b(f)}}}function k_e(r){let e,t,n,i,l,s;return n=new Ve({props:{$$slots:{default:[y_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(o,a){$(o,e,a),N(e,t),A(n,t,null),i=!0,l||(s=Ne(window,"keydown",r[10]),l=!0)},p(o,[a]){const u={};a&262655&&(u.$$scope={dirty:a,ctx:o}),n.$set(u)},i(o){i||(m(n.$$.fragment,o),i=!0)},o(o){_(n.$$.fragment,o),i=!1},d(o){o&&b(e),E(n),l=!1,s()}}}function C_e(r,e,t){let n,i,l,s,o,a,u,f;fe(r,Ut,O=>t(7,s=O)),fe(r,Ft,O=>t(17,o=O)),fe(r,Cn,O=>t(11,a=O)),fe(r,hr,O=>t(0,u=O)),fe(r,$1,O=>t(8,f=O));let c="",p="",d=!1;async function g(){var O;try{await Ft.login({username:c,password:p}),((O=o==null?void 0:o.user)==null?void 0:O.forceResetPassword)?s("./reset"):(we.success("Logged in successfully"),s("../portal"))}catch(L){we.error(L.message?L.message:"Invalid credentials")}}function h(O){O.key==="Enter"&&g()}qt(async()=>{try{await hr.init()}catch{we.error("Error getting org config")}t(3,d=!0)});function v(O){c=O,t(1,c)}function y(O){p=O,t(2,p)}function k(O){pt.call(this,r,O)}const I=()=>s("./forgot"),T=()=>{Cn.unload(),s("./org")};return r.$$.update=()=>{r.$$.dirty&1&&t(6,n=u.company||"Budibase"),r.$$.dirty&2048&&t(5,i=a.multiTenancy),r.$$.dirty&2048&&t(4,l=a.cloud)},[u,c,p,d,l,i,n,s,f,g,h,a,v,y,k,I,T]}class S_e extends se{constructor(e){super();oe(this,e,C_e,k_e,ie,{})}}function A_e(r){let e;return{c(){e=F("Set Budibase organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function E_e(r){let e,t,n,i,l;return i=new _t({props:{$$slots:{default:[A_e]},$$scope:{ctx:r}}}),{c(){e=j("img"),n=R(),S(i.$$.fragment),w(e,"alt","logo"),pn(e.src,t=kr)||w(e,"src",t),w(e,"class","svelte-jotad8")},m(s,o){$(s,e,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){const a={};o&512&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(n),E(i,s)}}}function O_e(r){let e;return{c(){e=F("Set organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function T_e(r){let e,t,n,i,l;e=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[O_e]},$$scope:{ctx:r}}});function s(a){r[5](a)}let o={label:"Organisation"};return r[0]!==void 0&&(o.value=r[0]),n=new nt({props:o}),K.push(()=>de(n,"value",s)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(a,u){A(e,a,u),$(a,t,u),A(n,a,u),l=!0},p(a,u){const f={};u&512&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0],me(()=>i=!1)),n.$set(c)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){E(e,a),a&&b(t),E(n,a)}}}function I_e(r){let e;return{c(){e=F("Set organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function L_e(r){let e,t;return e=new ot({props:{cta:!0,$$slots:{default:[I_e]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&512&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function P_e(r){let e,t,n,i,l,s,o,a;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[E_e]},$$scope:{ctx:r}}}),n=new nn({props:{noGrid:!0}}),l=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[T_e]},$$scope:{ctx:r}}}),o=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[L_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment)},m(u,f){A(e,u,f),$(u,t,f),A(n,u,f),$(u,i,f),A(l,u,f),$(u,s,f),A(o,u,f),a=!0},p(u,f){const c={};f&512&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&513&&(p.$$scope={dirty:f,ctx:u}),l.$set(p);const d={};f&512&&(d.$$scope={dirty:f,ctx:u}),o.$set(d)},i(u){a||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),m(o.$$.fragment,u),a=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),_(o.$$.fragment,u),a=!1},d(u){E(e,u),u&&b(t),E(n,u),u&&b(i),E(l,u),u&&b(s),E(o,u)}}}function N_e(r){let e,t,n,i,l,s;return n=new Ve({props:{$$slots:{default:[P_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(o,a){$(o,e,a),N(e,t),A(n,t,null),i=!0,l||(s=Ne(window,"keydown",r[2]),l=!0)},p(o,[a]){const u={};a&513&&(u.$$scope={dirty:a,ctx:o}),n.$set(u)},i(o){i||(m(n.$$.fragment,o),i=!0)},o(o){_(n.$$.fragment,o),i=!1},d(o){o&&b(e),E(n),l=!1,s()}}}function R_e(r,e,t){let n,i,l,s,o;fe(r,Ut,p=>t(8,s=p)),fe(r,Cn,p=>t(4,o=p));let a=tt(Ft).tenantSet?tt(Ft).tenantId:"";async function u(){try{(a==null||a==="")&&t(0,a="default"),await Ft.setOrg(a),await Cn.init(),s("../")}catch{we.error("Error setting organisation")}}function f(p){p.key==="Enter"&&u()}qt(async()=>{await Ft.checkQueryString(),!n||l?s("../"):Cn.unload()});function c(p){a=p,t(0,a)}return r.$$.update=()=>{r.$$.dirty&16&&(n=o.multiTenancy),r.$$.dirty&16&&t(3,i=o.cloud),r.$$.dirty&24&&(l=i&&!o.disableAccountPortal)},[a,u,f,i,o,c]}class M_e extends se{constructor(e){super();oe(this,e,R_e,N_e,ie,{})}}function D_e(r){let e,t;return{c(){e=j("img"),pn(e.src,t=r[3].logoUrl||kr)||w(e,"src",t),w(e,"alt","Organisation logo"),w(e,"class","svelte-bei7un")},m(n,i){$(n,e,i)},p(n,i){i&8&&!pn(e.src,t=n[3].logoUrl||kr)&&w(e,"src",t)},d(n){n&&b(e)}}}function j_e(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function B_e(r){let e;return{c(){e=F("Please enter the new password you'd like to use.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function z_e(r){let e,t,n,i,l,s,o,a;e=new _t({props:{textAlign:"center",$$slots:{default:[j_e]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[B_e]},$$scope:{ctx:r}}});function u(p){r[7](p)}function f(p){r[8](p)}let c={};return r[0]!==void 0&&(c.password=r[0]),r[1]!==void 0&&(c.error=r[1]),l=new Zf({props:c}),K.push(()=>de(l,"password",u)),K.push(()=>de(l,"error",f)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(p,d){A(e,p,d),$(p,t,d),A(n,p,d),$(p,i,d),A(l,p,d),a=!0},p(p,d){const g={};d&2048&&(g.$$scope={dirty:d,ctx:p}),e.$set(g);const h={};d&2048&&(h.$$scope={dirty:d,ctx:p}),n.$set(h);const v={};!s&&d&1&&(s=!0,v.password=p[0],me(()=>s=!1)),!o&&d&2&&(o=!0,v.error=p[1],me(()=>o=!1)),l.$set(v)},i(p){a||(m(e.$$.fragment,p),m(n.$$.fragment,p),m(l.$$.fragment,p),a=!0)},o(p){_(e.$$.fragment,p),_(n.$$.fragment,p),_(l.$$.fragment,p),a=!1},d(p){E(e,p),p&&b(t),E(n,p),p&&b(i),E(l,p)}}}function q_e(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function U_e(r){let e,t,n,i,l,s;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[D_e]},$$scope:{ctx:r}}}),n=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[z_e]},$$scope:{ctx:r}}}),l=new ot({props:{cta:!0,disabled:r[1]||(r[2]?!1:!r[4]),$$slots:{default:[q_e]},$$scope:{ctx:r}}}),l.$on("click",r[5]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(o,a){A(e,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&2056&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&2051&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&6&&(c.disabled=o[1]||(o[2]?!1:!o[4])),a&2048&&(c.$$scope={dirty:a,ctx:o}),l.$set(c)},i(o){s||(m(e.$$.fragment,o),m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){E(e,o),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function F_e(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[U_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-bei7un"),w(e,"class","login svelte-bei7un")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&2063&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function V_e(r,e,t){let n,i,l,s,o;fe(r,Ut,g=>t(9,i=g)),fe(r,Ft,g=>t(6,l=g)),fe(r,rr,g=>t(10,s=g)),fe(r,hr,g=>t(3,o=g));const a=s["?code"];let u,f;async function c(){try{n?(await Ft.updateSelf({password:u,forceResetPassword:!1}),i("../portal/")):(await Ft.resetPassword(u,a),we.success("Password reset successfully"),i("./login"))}catch{we.error("Unable to reset password")}}qt(async()=>{try{await Ft.getSelf(),await hr.init()}catch{we.error("Error getting org config")}});function p(g){u=g,t(0,u)}function d(g){f=g,t(1,f)}return r.$$.update=()=>{var g;r.$$.dirty&64&&t(2,n=(g=l==null?void 0:l.user)==null?void 0:g.forceResetPassword)},[u,f,n,o,a,c,l,p,d]}class H_e extends se{constructor(e){super();oe(this,e,V_e,F_e,ie,{})}}function I7(r){let e;const t=r[2].default,n=bt(t,r,r[1],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&2)&&vt(n,t,i,i[1],e?yt(t,i[1],l,null):wt(i[1]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function W_e(r){let e,t,n=(!r[0].user||r[0].user.forceResetPassword)&&I7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){!i[0].user||i[0].user.forceResetPassword?n?(n.p(i,l),l&1&&m(n,1)):(n=I7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function G_e(r,e,t){var a,u;let n,i,l;fe(r,Cn,f=>t(3,n=f)),fe(r,Ft,f=>t(0,i=f)),fe(r,Kr,f=>t(4,l=f));let{$$slots:s={},$$scope:o}=e;return i.user&&!i.user.forceResetPassword&&l("../"),!i.user&&n.cloud&&!n.disableAccountPortal&&n.accountPortalUrl&&!((u=(a=n==null?void 0:n.checklist)==null?void 0:a.sso)==null?void 0:u.checked)&&(window.location.href=n.accountPortalUrl),r.$$set=f=>{"$$scope"in f&&t(1,o=f.$$scope)},[i,o,s]}class Y_e extends se{constructor(e){super();oe(this,e,G_e,W_e,ie,{})}}function J_e(r,e,t){let n,i;return fe(r,Kr,l=>t(0,n=l)),fe(r,Ft,l=>t(1,i=l)),Ft.checkQueryString(),r.$$.update=()=>{var l,s;r.$$.dirty&3&&(((s=(l=i.user)==null?void 0:l.builder)==null?void 0:s.global)?n("./portal"):i.user&&n("./apps"))},[n,i]}class Q_e extends se{constructor(e){super();oe(this,e,J_e,null,ie,{})}}function X_e(r){let e;return{c(){e=F("Accept Invitation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function K_e(r){let e;return{c(){e=F("Please enter a password to set up your user.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Z_e(r){let e,t,n,i;return e=new _t({props:{size:"M",$$slots:{default:[X_e]},$$scope:{ctx:r}}}),n=new Ye({props:{textAlign:"center",size:"M",$$slots:{default:[K_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&256&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&256&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function x_e(r){let e;return{c(){e=F("Accept invite")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ehe(r){let e,t,n,i,l,s,o,a,u,f,c;i=new Ve({props:{gap:"XS",justifyItems:"center",noPadding:!0,$$slots:{default:[Z_e]},$$scope:{ctx:r}}});function p(h){r[3](h)}function d(h){r[4](h)}let g={};return r[1]!==void 0&&(g.error=r[1]),r[0]!==void 0&&(g.password=r[0]),s=new Zf({props:g}),K.push(()=>de(s,"error",p)),K.push(()=>de(s,"password",d)),f=new ot({props:{disabled:r[1],cta:!0,$$slots:{default:[x_e]},$$scope:{ctx:r}}}),f.$on("click",r[2]),{c(){e=j("img"),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),u=R(),S(f.$$.fragment),pn(e.src,t=kr)||w(e,"src",t),w(e,"alt","logo"),w(e,"class","svelte-1lpndr")},m(h,v){$(h,e,v),$(h,n,v),A(i,h,v),$(h,l,v),A(s,h,v),$(h,u,v),A(f,h,v),c=!0},p(h,v){const y={};v&256&&(y.$$scope={dirty:v,ctx:h}),i.$set(y);const k={};!o&&v&2&&(o=!0,k.error=h[1],me(()=>o=!1)),!a&&v&1&&(a=!0,k.password=h[0],me(()=>a=!1)),s.$set(k);const I={};v&2&&(I.disabled=h[1]),v&256&&(I.$$scope={dirty:v,ctx:h}),f.$set(I)},i(h){c||(m(i.$$.fragment,h),m(s.$$.fragment,h),m(f.$$.fragment,h),c=!0)},o(h){_(i.$$.fragment,h),_(s.$$.fragment,h),_(f.$$.fragment,h),c=!1},d(h){h&&b(e),h&&b(n),E(i,h),h&&b(l),E(s,h),h&&b(u),E(f,h)}}}function the(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[ehe]},$$scope:{ctx:r}}}),{c(){e=j("section"),t=j("div"),S(n.$$.fragment),w(t,"class","container svelte-1lpndr"),w(e,"class","svelte-1lpndr")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&259&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function nhe(r,e,t){let n,i;fe(r,Ut,c=>t(5,n=c)),fe(r,rr,c=>t(6,i=c));const l=i["?code"];let s,o;async function a(){try{await yi.acceptInvite(l,s),we.success("Invitation accepted successfully"),n("../auth/login")}catch(c){we.error(c.message)}}function u(c){o=c,t(1,o)}function f(c){s=c,t(0,s)}return[s,o,a,u,f]}class rhe extends se{constructor(e){super();oe(this,e,nhe,the,ie,{})}}const L7=()=>{const r={errors:{},touched:{},valid:!1},e={},t=mn(r),n=(l,s)=>{!s||!l||(e[l]=s)},i=async l=>{const s=eA().shape(e),o=Object.keys(e);o.forEach(f=>tt(t).errors[f]=null);let a=!1;try{await s.validate(l,{abortEarly:!1})}catch(f){f.inner?f.inner.forEach(c=>{t.update(p=>(p.errors[c.path]=Cr(c.message),p))}):(we.error("Unexpected validation error",f),a=!0)}let u;o.length&&!a?u=await s.isValid(l):u=!1,t.update(f=>(f.valid=u,f))};return{subscribe:t.subscribe,set:t.set,check:i,addValidator:n}},P7=(r,{apps:e,currentApp:t}={apps:[]})=>{r.addValidator("name",k_().trim().required("Your application must have a name").matches(CB,"App name must be letters, numbers and spaces only").test("non-existing-app-name","Another app with the same name already exists",n=>n?(t&&(e=e.filter(i=>i.appId!==t.appId)),!e.map(i=>i.name).some(i=>i.toLowerCase()===n.toLowerCase())):!0))},N7=(r,{apps:e,currentApp:t}={apps:[]})=>{r.addValidator("url",k_().trim().nullable().required("Your application must have a url").matches(SB,"Please enter a valid url").test("non-existing-app-url","Another app with the same URL already exists",n=>n?(t&&(e=e.filter(i=>i.appId!==t.appId)),!e.map(i=>i.url).some(i=>(i==null?void 0:i.toLowerCase())===n.toLowerCase())):!0).test("valid-url","Not a valid URL",n=>n?n.startsWith("/")&&!n.includes("http")&&!n.includes("www")&&!n.includes(".")&&n.length>1:!0))},ihe=(r,{template:e}={})=>{const t=e&&Object.keys(e).length===0?null:e;r.addValidator("file",(t==null?void 0:t.fromFile)?tA().required("Please choose a file to import"):null)};function lhe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,y,k,I,T;const O=r[8].default,L=bt(O,r,r[7],null);return{c(){e=j("div"),t=j("div"),n=j("img"),l=R(),s=j("div"),o=_e("svg"),a=_e("use"),c=R(),p=j("div"),L&&L.c(),g=R(),h=j("div"),v=j("div"),y=F(r[2]),w(n,"alt",r[2]),pn(n.src,i=r[1])||w(n,"src",i),w(n,"class","svelte-9xmo95"),ae(n,"error",r[5]),Gt(a,"xlink:href",u="#spectrum-icon-18-"+r[3]),w(o,"width","26px"),w(o,"height","26px"),w(o,"class","spectrum-Icon"),Lt(o,"color","white"),w(o,"focusable","false"),w(s,"style",f=`display:${r[5]?"block":"none"}`),w(p,"class",d=""+(Wn(r[4]?"template-thumbnail-action-overlay":"")+" svelte-9xmo95")),w(t,"class","template-thumbnail card-body svelte-9xmo95"),w(v,"class","svelte-9xmo95"),w(h,"class","template-thumbnail-text svelte-9xmo95"),w(e,"class","template-card svelte-9xmo95"),Lt(e,"background-color",r[0])},m(M,U){$(M,e,U),N(e,t),N(t,n),N(t,l),N(t,s),N(s,o),N(o,a),N(t,c),N(t,p),L&&L.m(p,null),N(e,g),N(e,h),N(h,v),N(v,y),k=!0,I||(T=Ne(n,"error",r[6]),I=!0)},p(M,[U]){(!k||U&4)&&w(n,"alt",M[2]),(!k||U&2&&!pn(n.src,i=M[1]))&&w(n,"src",i),U&32&&ae(n,"error",M[5]),(!k||U&8&&u!==(u="#spectrum-icon-18-"+M[3]))&&Gt(a,"xlink:href",u),(!k||U&32&&f!==(f=`display:${M[5]?"block":"none"}`))&&w(s,"style",f),L&&L.p&&(!k||U&128)&&vt(L,O,M,M[7],k?yt(O,M[7],U,null):wt(M[7]),null),(!k||U&16&&d!==(d=""+(Wn(M[4]?"template-thumbnail-action-overlay":"")+" svelte-9xmo95")))&&w(p,"class",d),(!k||U&4)&&Oe(y,M[2]),(!k||U&1)&&Lt(e,"background-color",M[0])},i(M){k||(m(L,M),k=!0)},o(M){_(L,M),k=!1},d(M){M&&b(e),L&&L.d(M),I=!1,T()}}}function she(r,e,t){let{$$slots:n={},$$scope:i}=e,{backgroundColour:l}=e,{imageSrc:s}=e,{name:o}=e,{icon:a}=e,{overlayEnabled:u=!0}=e,f=!1;const c=()=>{t(5,f=!0)};return r.$$set=p=>{"backgroundColour"in p&&t(0,l=p.backgroundColour),"imageSrc"in p&&t(1,s=p.imageSrc),"name"in p&&t(2,o=p.name),"icon"in p&&t(3,a=p.icon),"overlayEnabled"in p&&t(4,u=p.overlayEnabled),"$$scope"in p&&t(7,i=p.$$scope)},[l,s,o,a,u,f,c,i,n]}class R7 extends se{constructor(e){super();oe(this,e,she,lhe,ie,{backgroundColour:0,imageSrc:1,name:2,icon:3,overlayEnabled:4})}}function M7(r){let e,t;return e=new R7({props:{name:r[0].name,imageSrc:r[0].image,backgroundColour:r[0].background,overlayEnabled:!1,icon:r[0].icon}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.name=n[0].name),i&1&&(l.imageSrc=n[0].image),i&1&&(l.backgroundColour=n[0].background),i&1&&(l.icon=n[0].icon),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function D7(r){let e,t;return e=new Xo({props:{error:r[4].touched.file&&r[4].errors.file,gallery:!1,label:"File to import",value:[r[1].file]}}),e.$on("change",r[12]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.error=n[4].touched.file&&n[4].errors.file),i&2&&(l.value=[n[1].file]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function j7(r){let e,t;return{c(){e=j("div"),t=F(r[3]),w(e,"class","app-server svelte-x7xwuh"),w(e,"title",r[3])},m(n,i){$(n,e,i),N(e,t)},p(n,i){i&8&&Oe(t,n[3]),i&8&&w(e,"title",n[3])},d(n){n&&b(e)}}}function ohe(r){var k,I,T;let e,t,n,i,l,s,o,a,u,f,c=r[0]&&!((k=r[0])==null?void 0:k.fromFile)&&M7(r),p=((I=r[0])==null?void 0:I.fromFile)&&D7(r);function d(O){r[13](O)}let g={disabled:r[2],error:r[4].touched.name&&r[4].errors.name,label:"Name",placeholder:((T=r[5].user)==null?void 0:T.firstName)?`${r[5].user.firstName}s app`:"My app"};r[1].name!==void 0&&(g.value=r[1].name),n=new nt({props:g}),K.push(()=>de(n,"value",d)),n.$on("blur",r[14]),n.$on("change",function(){ft(r[10](r[1].name))&&r[10](r[1].name).apply(this,arguments)});function h(O){r[15](O)}let v={disabled:r[2],error:r[4].touched.url&&r[4].errors.url,label:"URL",placeholder:r[1].url?r[1].url:`/${r[8](r[0],r[1].name)}`};r[1].url!==void 0&&(v.value=r[1].url),o=new nt({props:v}),K.push(()=>de(o,"value",h)),o.$on("blur",r[16]),o.$on("change",function(){ft(r[9](r[1].url))&&r[9](r[1].url).apply(this,arguments)});let y=r[1].url&&r[1].url!==""&&!r[4].errors.url&&j7(r);return{c(){c&&c.c(),e=R(),p&&p.c(),t=R(),S(n.$$.fragment),l=R(),s=j("span"),S(o.$$.fragment),u=R(),y&&y.c()},m(O,L){c&&c.m(O,L),$(O,e,L),p&&p.m(O,L),$(O,t,L),A(n,O,L),$(O,l,L),$(O,s,L),A(o,s,null),N(s,u),y&&y.m(s,null),f=!0},p(O,L){var D,B,V;r=O,r[0]&&!((D=r[0])==null?void 0:D.fromFile)?c?(c.p(r,L),L&1&&m(c,1)):(c=M7(r),c.c(),m(c,1),c.m(e.parentNode,e)):c&&(ee(),_(c,1,1,()=>{c=null}),te()),((B=r[0])==null?void 0:B.fromFile)?p?(p.p(r,L),L&1&&m(p,1)):(p=D7(r),p.c(),m(p,1),p.m(t.parentNode,t)):p&&(ee(),_(p,1,1,()=>{p=null}),te());const M={};L&4&&(M.disabled=r[2]),L&16&&(M.error=r[4].touched.name&&r[4].errors.name),L&32&&(M.placeholder=((V=r[5].user)==null?void 0:V.firstName)?`${r[5].user.firstName}s app`:"My app"),!i&&L&2&&(i=!0,M.value=r[1].name,me(()=>i=!1)),n.$set(M);const U={};L&4&&(U.disabled=r[2]),L&16&&(U.error=r[4].touched.url&&r[4].errors.url),L&3&&(U.placeholder=r[1].url?r[1].url:`/${r[8](r[0],r[1].name)}`),!a&&L&2&&(a=!0,U.value=r[1].url,me(()=>a=!1)),o.$set(U),r[1].url&&r[1].url!==""&&!r[4].errors.url?y?y.p(r,L):(y=j7(r),y.c(),y.m(s,null)):y&&(y.d(1),y=null)},i(O){f||(m(c),m(p),m(n.$$.fragment,O),m(o.$$.fragment,O),f=!0)},o(O){_(c),_(p),_(n.$$.fragment,O),_(o.$$.fragment,O),f=!1},d(O){c&&c.d(O),O&&b(e),p&&p.d(O),O&&b(t),E(n,O),O&&b(l),O&&b(s),E(o),y&&y.d()}}}function ahe(r){var n;let e,t;return e=new Nt({props:{title:"Create your app",confirmText:((n=r[0])==null?void 0:n.fromFile)?"Import app":"Create app",onConfirm:r[11],disabled:!r[4].valid,$$slots:{default:[ohe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){var o;const s={};l&1&&(s.confirmText=((o=i[0])==null?void 0:o.fromFile)?"Import app":"Create app"),l&16&&(s.disabled=!i[4].valid),l&1048639&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}const B7="/app";function uhe(r,e,t){let n,i,l,s,o;fe(r,Ut,M=>t(17,i=M)),fe(r,Ft,M=>t(5,o=M));let{template:a}=e,u=!1;const f=mn({name:"",url:null});fe(r,f,M=>t(1,l=M));const c=L7();fe(r,c,M=>t(4,s=M)),qt(async()=>{Mn(f,l.name=d(a,l.name),l),h(l.name),await v()});const p=(M,U)=>{let D;const B=d(M,U);D=B?B.toLowerCase():"";const V=D?D.replace(/\s+/g,"-"):"";return encodeURI(V)},d=(M,U)=>M&&!U?M.name:U?U.trim():null,g=M=>{M&&!M.startsWith("/")&&(M=`/${M}`),Mn(f,l.url=M===""?null:M,l)},h=M=>{let U=p(a,M);g(U)},v=async()=>{const M=tt(Lr);P7(c,{apps:M}),N7(c,{apps:M}),ihe(c,{template:a}),c.check(l)};async function y(){t(2,u=!0);try{let M=new FormData;M.append("name",l.name.trim()),l.url&&M.append("url",l.url.trim()),M.append("useTemplate",a!=null),a&&(M.append("templateName",a.name),M.append("templateKey",a.key),M.append("templateFile",l.file));const U=await Ze.createApp(M);Ln.captureEvent(Nn.APP.CREATED,{name:l.name,appId:U.instance._id,templateToUse:a});const D=await Ze.fetchAppPackage(U.instance._id);await Ge.actions.initialise(D),await Qt.actions.fetch(),await Cn.init(),await Ze.updateOwnMetadata({roleId:l.roleId}),await Ft.setInitInfo({}),i(`/builder/app/${U.instance._id}`)}catch(M){t(2,u=!1),console.error(M),we.error("Error creating app")}}const k=M=>{var U;Mn(f,l.file=(U=M.detail)==null?void 0:U[0],l),Mn(c,s.touched.file=!0,s)};function I(M){r.$$.not_equal(l.name,M)&&(l.name=M,f.set(l))}const T=()=>Mn(c,s.touched.name=!0,s);function O(M){r.$$.not_equal(l.url,M)&&(l.url=M,f.set(l))}const L=()=>Mn(c,s.touched.url=!0,s);return r.$$set=M=>{"template"in M&&t(0,a=M.template)},r.$$.update=()=>{r.$$.dirty&2&&c.check(l),r.$$.dirty&3&&t(3,n=`${window.location.origin}${l.url?`${B7}${l.url}`:`${B7}${p(a,l.name)}`}`)},[a,l,u,n,s,o,f,c,p,g,h,y,k,I,T,O,L]}class G1 extends se{constructor(e){super();oe(this,e,uhe,ahe,ie,{template:0})}}function z7(r,e,t){const n=r.slice();return n[14]=e[t],n}function q7(r,e,t){const n=r.slice();return n[17]=e[t],n}function U7(r,e,t){const n=r.slice();return n[14]=e[t],n}function fhe(r){let e;return{c(){e=F("Templates")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function che(r){let e;return{c(){e=F("All")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function phe(r){let e=r[14]+"",t,n;return{c(){t=F(e),n=R()},m(i,l){$(i,t,l),$(i,n,l)},p(i,l){l&16&&e!==(e=i[14]+"")&&Oe(t,e)},d(i){i&&b(t),i&&b(n)}}}function F7(r){let e,t;function n(){return r[10](r[14])}return e=new Jt({props:{dataCy:r[14],selected:r[14]==r[0],$$slots:{default:[phe]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.dataCy=r[14]),l&17&&(s.selected=r[14]==r[0]),l&4194320&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}function dhe(r){let e,t,n,i;e=new Jt({props:{selected:!r[0],$$slots:{default:[che]},$$scope:{ctx:r}}}),e.$on("click",r[9]);let l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=F7(U7(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){S(e.$$.fragment),t=R();for(let a=0;a<s.length;a+=1)s[a].c();n=Ee()},m(a,u){A(e,a,u),$(a,t,u);for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,n,u),i=!0},p(a,u){const f={};if(u&1&&(f.selected=!a[0]),u&4194304&&(f.$$scope={dirty:u,ctx:a}),e.$set(f),u&17){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=U7(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=F7(p),s[c].c(),m(s[c],1),s[c].m(n.parentNode,n))}for(ee(),c=l.length;c<s.length;c+=1)o(c);te()}},i(a){if(!i){m(e.$$.fragment,a);for(let u=0;u<l.length;u+=1)m(s[u]);i=!0}},o(a){_(e.$$.fragment,a),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);i=!1},d(a){E(e,a),a&&b(t),gt(s,a),a&&b(n)}}}function mhe(r){let e,t,n,i,l;return e=new _t({props:{size:"S",$$slots:{default:[fhe]},$$scope:{ctx:r}}}),i=new Ap({props:{$$slots:{default:[dhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=j("div"),S(i.$$.fragment),w(n,"class","template-category-filters spectrum-ActionGroup")},m(s,o){A(e,s,o),$(s,t,o),$(s,n,o),A(i,n,null),l=!0},p(s,o){const a={};o&4194304&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&4194321&&(u.$$scope={dirty:o,ctx:s}),i.$set(u)},i(s){l||(m(e.$$.fragment,s),m(i.$$.fragment,s),l=!0)},o(s){_(e.$$.fragment,s),_(i.$$.fragment,s),l=!1},d(s){E(e,s),s&&b(t),s&&b(n),E(i)}}}function ghe(r){let e=r[14]+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&32&&e!==(e=n[14]+"")&&Oe(t,e)},d(n){n&&b(t)}}}function _he(r){let e;return{c(){e=F("Use template")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function hhe(r){let e,t,n,i,l,s,o,a,u;function f(){return r[11](r[17])}return e=new ot({props:{cta:!0,$$slots:{default:[_he]},$$scope:{ctx:r}}}),e.$on("click",f),{c(){S(e.$$.fragment),t=R(),n=j("a"),i=F("Details"),s=R(),w(n,"href",l=r[17].url),w(n,"target","_blank"),w(n,"class","overlay-preview-link spectrum-Button spectrum-Button--sizeM spectrum-Button--secondary svelte-1spxv8t")},m(c,p){A(e,c,p),$(c,t,p),$(c,n,p),N(n,i),$(c,s,p),o=!0,a||(u=Ne(n,"click",$p(r[8])),a=!0)},p(c,p){r=c;const d={};p&4194304&&(d.$$scope={dirty:p,ctx:r}),e.$set(d),(!o||p&34&&l!==(l=r[17].url))&&w(n,"href",l)},i(c){o||(m(e.$$.fragment,c),o=!0)},o(c){_(e.$$.fragment,c),o=!1},d(c){E(e,c),c&&b(t),c&&b(n),c&&b(s),a=!1,u()}}}function V7(r){let e,t;return e=new R7({props:{name:r[17].name,imageSrc:r[17].image,backgroundColour:r[17].background,icon:r[17].icon,$$slots:{default:[hhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&34&&(l.name=n[17].name),i&34&&(l.imageSrc=n[17].image),i&34&&(l.backgroundColour=n[17].background),i&34&&(l.icon=n[17].icon),i&4194350&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function H7(r){let e,t,n,i,l,s,o;t=new Hr({props:{size:"M",$$slots:{default:[ghe]},$$scope:{ctx:r}}});let a=r[1][r[14]],u=[];for(let c=0;c<a.length;c+=1)u[c]=V7(q7(r,a,c));const f=c=>_(u[c],1,1,()=>{u[c]=null});return{c(){e=j("div"),S(t.$$.fragment),n=R(),i=j("div");for(let c=0;c<u.length;c+=1)u[c].c();l=R(),w(i,"class","template-grid svelte-1spxv8t"),w(e,"class","template-category"),w(e,"data-cy",s=r[14])},m(c,p){$(c,e,p),A(t,e,null),N(e,n),N(e,i);for(let d=0;d<u.length;d+=1)u[d].m(i,null);N(e,l),o=!0},p(c,p){const d={};if(p&4194336&&(d.$$scope={dirty:p,ctx:c}),t.$set(d),p&46){a=c[1][c[14]];let g;for(g=0;g<a.length;g+=1){const h=q7(c,a,g);u[g]?(u[g].p(h,p),m(u[g],1)):(u[g]=V7(h),u[g].c(),m(u[g],1),u[g].m(i,null))}for(ee(),g=a.length;g<u.length;g+=1)f(g);te()}(!o||p&32&&s!==(s=c[14]))&&w(e,"data-cy",s)},i(c){if(!o){m(t.$$.fragment,c);for(let p=0;p<a.length;p+=1)m(u[p]);o=!0}},o(c){_(t.$$.fragment,c),u=u.filter(Boolean);for(let p=0;p<u.length;p+=1)_(u[p]);o=!1},d(c){c&&b(e),E(t),gt(u,c)}}}function $he(r){let e,t,n=r[5],i=[];for(let s=0;s<n.length;s+=1)i[s]=H7(z7(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Ee()},m(s,o){for(let a=0;a<i.length;a+=1)i[a].m(s,o);$(s,e,o),t=!0},p(s,o){if(o&46){n=s[5];let a;for(a=0;a<n.length;a+=1){const u=z7(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=H7(u),i[a].c(),m(i[a],1),i[a].m(e.parentNode,e))}for(ee(),a=n.length;a<i.length;a+=1)l(a);te()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){gt(i,s),s&&b(e)}}}function bhe(r){let e,t;return e=new G1({props:{template:r[3]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.template=n[3]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function vhe(r){let e,t,n,i,l,s,o,a;t=new Ve({props:{noPadding:!0,gap:"S",$$slots:{default:[mhe]},$$scope:{ctx:r}}}),l=new Ve({props:{gap:"XL",noPadding:!0,$$slots:{default:[$he]},$$scope:{ctx:r}}});let u={padding:!1,width:"600px",$$slots:{default:[bhe]},$$scope:{ctx:r}};return o=new kt({props:u}),r[12](o),o.$on("hide",r[6]),{c(){e=j("div"),S(t.$$.fragment),n=R(),i=j("div"),S(l.$$.fragment),s=R(),S(o.$$.fragment),w(e,"class","template-header"),w(i,"class","template-categories")},m(f,c){$(f,e,c),A(t,e,null),$(f,n,c),$(f,i,c),A(l,i,null),$(f,s,c),A(o,f,c),a=!0},p(f,[c]){const p={};c&4194321&&(p.$$scope={dirty:c,ctx:f}),t.$set(p);const d={};c&4194350&&(d.$$scope={dirty:c,ctx:f}),l.$set(d);const g={};c&4194312&&(g.$$scope={dirty:c,ctx:f}),o.$set(g)},i(f){a||(m(t.$$.fragment,f),m(l.$$.fragment,f),m(o.$$.fragment,f),a=!0)},o(f){_(t.$$.fragment,f),_(l.$$.fragment,f),_(o.$$.fragment,f),a=!1},d(f){f&&b(e),E(t),f&&b(n),f&&b(i),E(l),f&&b(s),r[12](null),E(o,f)}}}function whe(r,e,t){let n,i,l,{templates:s}=e,o,a,u;const f=(y,k)=>y.reduce((T,O)=>(typeof k=="string"&&[k].indexOf(O.category)<0||(T[O.category]=T[O.category]?T[O.category]:[],T[O.category].push(O)),T),{}),c=()=>{t(3,u=null)};function p(y){pt.call(this,r,y)}const d=()=>{t(0,o=null)},g=y=>{t(0,o=y)},h=y=>{t(3,u=y),a.show()};function v(y){K[y?"unshift":"push"](()=>{a=y,t(2,a)})}return r.$$set=y=>{"templates"in y&&t(7,s=y.templates)},r.$$.update=()=>{r.$$.dirty&129&&t(1,n=f(s,o)),r.$$.dirty&2&&t(5,i=n?Object.keys(n).sort():[]),r.$$.dirty&128&&t(4,l=s?Object.keys(f(s)).sort():[])},[o,n,a,u,l,i,c,s,p,d,g,h,v]}class Y1 extends se{constructor(e){super();oe(this,e,whe,vhe,ie,{templates:7})}}function yhe(r){let e;return{c(){e=F("Back")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function khe(r){let e;return{c(){e=F(Nhe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Che(r){let e;return{c(){e=F(Phe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function She(r){let e,t,n,i;return e=new _t({props:{size:"L",$$slots:{default:[khe]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"M",$$slots:{default:[Che]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&2048&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Ahe(r){let e;return{c(){e=F(Rhe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Ehe(r){let e;return{c(){e=F("Import app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function W7(r){let e,t;return e=new Y1({props:{templates:r[3]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.templates=n[3]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ohe(r){var k;let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v;t=new ot({props:{quiet:!0,secondary:!0,icon:"ChevronLeft",$$slots:{default:[yhe]},$$scope:{ctx:r}}}),t.$on("click",r[8]),s=new Ve({props:{noPadding:!0,gap:"XS",$$slots:{default:[She]},$$scope:{ctx:r}}}),u=new ot({props:{dataCy:"create-app-btn",size:"M",icon:"Add",cta:!0,$$slots:{default:[Ahe]},$$scope:{ctx:r}}}),u.$on("click",r[5]),c=new ot({props:{dataCy:"import-app-btn",icon:"Import",size:"M",quiet:!0,secondary:!0,$$slots:{default:[Ehe]},$$scope:{ctx:r}}}),c.$on("click",r[7]),d=new nn({props:{size:"S"}});let y=r[0]&&((k=r[3])==null?void 0:k.length)&&W7(r);return{c(){e=j("span"),S(t.$$.fragment),n=R(),i=j("div"),l=j("div"),S(s.$$.fragment),o=R(),a=j("div"),S(u.$$.fragment),f=R(),S(c.$$.fragment),p=R(),S(d.$$.fragment),g=R(),y&&y.c(),h=Ee(),w(a,"class","buttons svelte-1fpitx1"),w(l,"class","welcome svelte-1fpitx1"),w(i,"class","title svelte-1fpitx1")},m(I,T){$(I,e,T),A(t,e,null),$(I,n,T),$(I,i,T),N(i,l),A(s,l,null),N(l,o),N(l,a),A(u,a,null),N(a,f),A(c,a,null),$(I,p,T),A(d,I,T),$(I,g,T),y&&y.m(I,T),$(I,h,T),v=!0},p(I,T){var D;const O={};T&2048&&(O.$$scope={dirty:T,ctx:I}),t.$set(O);const L={};T&2048&&(L.$$scope={dirty:T,ctx:I}),s.$set(L);const M={};T&2048&&(M.$$scope={dirty:T,ctx:I}),u.$set(M);const U={};T&2048&&(U.$$scope={dirty:T,ctx:I}),c.$set(U),I[0]&&((D=I[3])==null?void 0:D.length)?y?(y.p(I,T),T&9&&m(y,1)):(y=W7(I),y.c(),m(y,1),y.m(h.parentNode,h)):y&&(ee(),_(y,1,1,()=>{y=null}),te())},i(I){v||(m(t.$$.fragment,I),m(s.$$.fragment,I),m(u.$$.fragment,I),m(c.$$.fragment,I),m(d.$$.fragment,I),m(y),v=!0)},o(I){_(t.$$.fragment,I),_(s.$$.fragment,I),_(u.$$.fragment,I),_(c.$$.fragment,I),_(d.$$.fragment,I),_(y),v=!1},d(I){I&&b(e),E(t),I&&b(n),I&&b(i),E(s),E(u),E(c),I&&b(p),E(d,I),I&&b(g),y&&y.d(I),I&&b(h)}}}function The(r){let e,t;return e=new Ve({props:{noPadding:!0,gap:"XL",$$slots:{default:[Ohe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2073&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ihe(r){let e,t;return e=new G1({props:{template:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.template=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Lhe(r){let e,t,n,i;e=new Ks({props:{wide:!0,$$slots:{default:[The]},$$scope:{ctx:r}}});let l={padding:!1,width:"600px",$$slots:{default:[Ihe]},$$scope:{ctx:r}};return n=new kt({props:l}),r[9](n),n.$on("hide",r[6]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(s,o){A(e,s,o),$(s,t,o),A(n,s,o),i=!0},p(s,[o]){const a={};o&2073&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&2050&&(u.$$scope={dirty:o,ctx:s}),n.$set(u)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){E(e,s),s&&b(t),r[9](null),E(n,s)}}}const Phe="Start from scratch or get a head start with one of our templates",Nhe="Create new app",Rhe="Start from scratch";function Mhe(r,e,t){let n,i;fe(r,wo,d=>t(3,n=d)),fe(r,Ut,d=>t(4,i=d));let l=n==null?void 0:n.length,s,o=!1;qt(async()=>{try{await wo.load(),(n==null?void 0:n.length)===0&&we.error("There was a problem loading quick start templates.")}catch{we.error("Error loading apps and templates")}t(0,l=!0)});const a=()=>{t(1,s=null),o.show()},u=()=>{t(1,s=null)},f=()=>{t(1,s={fromFile:!0}),o.show()},c=()=>{i("../")};function p(d){K[d?"unshift":"push"](()=>{o=d,t(2,o)})}return[l,s,o,n,i,a,u,f,c,p]}class Dhe extends se{constructor(e){super();oe(this,e,Mhe,Lhe,ie,{})}}function jhe(r){let e;return{c(){e=F("Update the name of your app.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Bhe(r){let e,t,n,i,l,s,o,a;e=new Ye({props:{size:"S",$$slots:{default:[jhe]},$$scope:{ctx:r}}});function u(d){r[9](d)}let f={error:r[1].touched.name&&r[1].errors.name,label:"Name"};r[0].name!==void 0&&(f.value=r[0].name),n=new nt({props:f}),K.push(()=>de(n,"value",u)),n.$on("blur",r[10]),n.$on("change",function(){ft(r[7](r[0].name))&&r[7](r[0].name).apply(this,arguments)});function c(d){r[11](d)}let p={error:r[1].touched.url&&r[1].errors.url,label:"URL",placeholder:r[0].url?r[0].url:`/${r[5](null,r[0].name)}`};return r[0].url!==void 0&&(p.value=r[0].url),s=new nt({props:p}),K.push(()=>de(s,"value",c)),s.$on("blur",r[12]),s.$on("change",function(){ft(r[6](r[0].url))&&r[6](r[0].url).apply(this,arguments)}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment)},m(d,g){A(e,d,g),$(d,t,g),A(n,d,g),$(d,l,g),A(s,d,g),a=!0},p(d,g){r=d;const h={};g&32768&&(h.$$scope={dirty:g,ctx:r}),e.$set(h);const v={};g&2&&(v.error=r[1].touched.name&&r[1].errors.name),!i&&g&1&&(i=!0,v.value=r[0].name,me(()=>i=!1)),n.$set(v);const y={};g&2&&(y.error=r[1].touched.url&&r[1].errors.url),g&1&&(y.placeholder=r[0].url?r[0].url:`/${r[5](null,r[0].name)}`),!o&&g&1&&(o=!0,y.value=r[0].url,me(()=>o=!1)),s.$set(y)},i(d){a||(m(e.$$.fragment,d),m(n.$$.fragment,d),m(s.$$.fragment,d),a=!0)},o(d){_(e.$$.fragment,d),_(n.$$.fragment,d),_(s.$$.fragment,d),a=!1},d(d){E(e,d),d&&b(t),E(n,d),d&&b(l),E(s,d)}}}function zhe(r){let e,t;return e=new Nt({props:{title:"Edit app",confirmText:"Save",onConfirm:r[4],disabled:!r[1].valid,$$slots:{default:[Bhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.disabled=!n[1].valid),i&32771&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function qhe(r,e,t){let n,i,{app:l}=e;const s=mn({name:"",url:null});fe(r,s,k=>t(0,n=k));const o=L7();fe(r,o,k=>t(1,i=k)),qt(async()=>{Mn(s,n.name=l.name,n),Mn(s,n.url=l.url,n),a()});const a=async()=>{const k=tt(Lr);P7(o,{apps:k,currentApp:l}),N7(o,{apps:k,currentApp:l}),o.check(n)};async function u(){try{const k={name:n.name.trim()};n.url&&(k.url=n.url.trim()),await Lr.update(l.instance._id,k)}catch(k){console.error(k),we.error("Error updating app")}}const f=(k,I)=>{let T;const O=c(null,I);T=O?O.toLowerCase():"";const L=T?T.replace(/\s+/g,"-"):"";return encodeURI(L)},c=(k,I)=>k&&!I?k.name:I?I.trim():null,p=k=>{k&&!k.startsWith("/")&&(k=`/${k}`),Mn(s,n.url=k===""?null:k,n)},d=k=>{let I=f(null,k);p(I)};function g(k){r.$$.not_equal(n.name,k)&&(n.name=k,s.set(n))}const h=()=>Mn(o,i.touched.name=!0,i);function v(k){r.$$.not_equal(n.url,k)&&(n.url=k,s.set(n))}const y=()=>Mn(o,i.touched.url=!0,i);return r.$$set=k=>{"app"in k&&t(8,l=k.app)},r.$$.update=()=>{r.$$.dirty&1&&o.check(n)},[n,i,s,o,u,f,p,d,l,g,h,v,y]}class Uhe extends se{constructor(e){super();oe(this,e,qhe,zhe,ie,{app:8})}}function G7(r,e,t){const n=r.slice();return n[15]=e[t],n}function Fhe(r){let e;return{c(){e=F("Select an icon")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Y7(r){let e,t,n,i,l,s;t=new ut({props:{name:r[15]}});function o(){return r[10](r[15])}return{c(){e=j("div"),S(t.$$.fragment),n=R(),w(e,"class","icon-item svelte-jw5qd4"),ae(e,"selected",r[15]===r[2])},m(a,u){$(a,e,u),A(t,e,null),N(e,n),i=!0,l||(s=Ne(e,"click",o),l=!0)},p(a,u){r=a,u&12&&ae(e,"selected",r[15]===r[2])},i(a){i||(m(t.$$.fragment,a),i=!0)},o(a){_(t.$$.fragment,a),i=!1},d(a){a&&b(e),E(t),l=!1,s()}}}function Vhe(r){let e;return{c(){e=F("Select a color")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Hhe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g;n=new Ke({props:{$$slots:{default:[Fhe]},$$scope:{ctx:r}}});let h=r[3],v=[];for(let T=0;T<h.length;T+=1)v[T]=Y7(G7(r,h,T));const y=T=>_(v[T],1,1,()=>{v[T]=null});u=new Ke({props:{$$slots:{default:[Vhe]},$$scope:{ctx:r}}});function k(T){r[11](T)}let I={};return r[1]!==void 0&&(I.value=r[1]),p=new Ql({props:I}),K.push(()=>de(p,"value",k)),p.$on("change",r[12]),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),l=j("div");for(let T=0;T<v.length;T+=1)v[T].c();s=R(),o=j("div"),a=j("div"),S(u.$$.fragment),f=R(),c=j("div"),S(p.$$.fragment),w(t,"class","title-spacing svelte-jw5qd4"),w(l,"class","grid svelte-jw5qd4"),w(e,"class","scrollable-icons svelte-jw5qd4"),w(c,"class","color-selection-item svelte-jw5qd4"),w(o,"class","color-selection svelte-jw5qd4")},m(T,O){$(T,e,O),N(e,t),A(n,t,null),N(e,i),N(e,l);for(let L=0;L<v.length;L+=1)v[L].m(l,null);$(T,s,O),$(T,o,O),N(o,a),A(u,a,null),N(o,f),N(o,c),A(p,c,null),g=!0},p(T,O){const L={};if(O&262144&&(L.$$scope={dirty:O,ctx:T}),n.$set(L),O&12){h=T[3];let D;for(D=0;D<h.length;D+=1){const B=G7(T,h,D);v[D]?(v[D].p(B,O),m(v[D],1)):(v[D]=Y7(B),v[D].c(),m(v[D],1),v[D].m(l,null))}for(ee(),D=h.length;D<v.length;D+=1)y(D);te()}const M={};O&262144&&(M.$$scope={dirty:O,ctx:T}),u.$set(M);const U={};!d&&O&2&&(d=!0,U.value=T[1],me(()=>d=!1)),p.$set(U)},i(T){if(!g){m(n.$$.fragment,T);for(let O=0;O<h.length;O+=1)m(v[O]);m(u.$$.fragment,T),m(p.$$.fragment,T),g=!0}},o(T){_(n.$$.fragment,T),v=v.filter(Boolean);for(let O=0;O<v.length;O+=1)_(v[O]);_(u.$$.fragment,T),_(p.$$.fragment,T),g=!1},d(T){T&&b(e),E(n),gt(v,T),T&&b(s),T&&b(o),E(u),E(p)}}}function Whe(r){let e,t;return e=new Nt({props:{title:"Edit Icon",confirmText:"Save",onConfirm:r[13],$$slots:{default:[Hhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&262150&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ghe(r){let e,t,n={$$slots:{default:[Whe]},$$scope:{ctx:r}};return e=new kt({props:n}),r[14](e),e.$on("hide",r[4]),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){const s={};l&262150&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){r[14](null),E(e,i)}}}function Yhe(r,e,t){let n,i,{app:l}=e,s,o=["Apps","Actions","ConversionFunnel","App","Briefcase","Money","ShoppingCart","Form","Help","Monitoring","Sandbox","Project","Organisations","Magnify","Launch","Car","Camera","Bug","Channel","Calculator","Calendar","GraphDonut","GraphBarHorizontal","Demographic"];const a=()=>{s.show()},u=()=>{s.hide()},f=()=>{t(2,n=""),t(1,i=""),u()},c=k=>{t(1,i=k)},p=async()=>{try{await Lr.update(l.instance._id,{icon:{name:n,color:i}})}catch{we.error("Error updating app")}},d=k=>t(2,n=k);function g(k){i=k,t(1,i),t(7,l)}const h=k=>c(k.detail),v=()=>p();function y(k){K[k?"unshift":"push"](()=>{s=k,t(0,s)})}return r.$$set=k=>{"app"in k&&t(7,l=k.app)},r.$$.update=()=>{var k,I;r.$$.dirty&128&&t(2,n=((k=l==null?void 0:l.icon)==null?void 0:k.name)||"Apps"),r.$$.dirty&128&&t(1,i=(I=l==null?void 0:l.icon)==null?void 0:I.color)},[s,i,n,o,f,c,p,l,a,u,d,g,h,v,y]}class Jhe extends se{constructor(e){super();oe(this,e,Yhe,Ghe,ie,{app:7,show:8,hide:9})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[9]}}function Qhe(r){let e=r[0].name+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0].name+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Xhe(r){let e;return{c(){e=F("Never updated")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Khe(r){let e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(r[0].updatedAt).getTime()})+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(n[0].updatedAt).getTime()})+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Zhe(r){let e;return{c(){e=F("Open")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function xhe(r){let e,t=r[0].lockedBy.email+"",n;return{c(){e=F("Locked by "),n=F(t)},m(i,l){$(i,e,l),$(i,n,l)},p(i,l){l&1&&t!==(t=i[0].lockedBy.email+"")&&Oe(n,t)},d(i){i&&b(e),i&&b(n)}}}function e0e(r){let e;return{c(){e=F("Locked by you")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function t0e(r){let e;function t(l,s){return l[0].lockedYou?e0e:l[0].lockedOther?xhe:Zhe}let n=t(r),i=n(r);return{c(){i.c(),e=Ee()},m(l,s){i.m(l,s),$(l,e,s)},p(l,s){n===(n=t(l))&&i?i.p(l,s):(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function n0e(r){let e,t,n,i;return e=new ut({props:{name:"GlobeStrike",disabled:!0}}),{c(){S(e.$$.fragment),t=R(),n=j("span"),n.textContent="Unpublished",w(n,"class","disabled svelte-bp2uq1")},m(l,s){A(e,l,s),$(l,t,s),$(l,n,s),i=!0},i(l){i||(m(e.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),l&&b(n)}}}function r0e(r){let e,t,n;return e=new ut({props:{name:"Globe",disabled:!1}}),{c(){S(e.$$.fragment),t=F(`
1262
+ `),S(i.$$.fragment)},m(s,o){$(s,e,o),$(s,t,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){const a={};o&262144&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(t),s&&b(n),E(i,s)}}}function y_e(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[d_e]},$$scope:{ctx:r}}});let p=r[3]&&E7(r);i=new nn({props:{noGrid:!0}}),s=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[g_e]},$$scope:{ctx:r}}}),a=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[b_e]},$$scope:{ctx:r}}});let d=r[4]&&T7(r);return{c(){S(e.$$.fragment),t=R(),p&&p.c(),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),d&&d.c(),f=Ee()},m(g,h){A(e,g,h),$(g,t,h),p&&p.m(g,h),$(g,n,h),A(i,g,h),$(g,l,h),A(s,g,h),$(g,o,h),A(a,g,h),$(g,u,h),d&&d.m(g,h),$(g,f,h),c=!0},p(g,h){const v={};h&262209&&(v.$$scope={dirty:h,ctx:g}),e.$set(v),g[3]?p?(p.p(g,h),h&8&&m(p,1)):(p=E7(g),p.c(),m(p,1),p.m(n.parentNode,n)):p&&(ee(),_(p,1,1,()=>{p=null}),te());const y={};h&262150&&(y.$$scope={dirty:h,ctx:g}),s.$set(y);const k={};h&262390&&(k.$$scope={dirty:h,ctx:g}),a.$set(k),g[4]?d?h&16&&m(d,1):(d=T7(g),d.c(),m(d,1),d.m(f.parentNode,f)):d&&(ee(),_(d,1,1,()=>{d=null}),te())},i(g){c||(m(e.$$.fragment,g),m(p),m(i.$$.fragment,g),m(s.$$.fragment,g),m(a.$$.fragment,g),m(d),c=!0)},o(g){_(e.$$.fragment,g),_(p),_(i.$$.fragment,g),_(s.$$.fragment,g),_(a.$$.fragment,g),_(d),c=!1},d(g){E(e,g),g&&b(t),p&&p.d(g),g&&b(n),E(i,g),g&&b(l),E(s,g),g&&b(o),E(a,g),g&&b(u),d&&d.d(g),g&&b(f)}}}function k_e(r){let e,t,n,i,l,s;return n=new Ve({props:{$$slots:{default:[y_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(o,a){$(o,e,a),N(e,t),A(n,t,null),i=!0,l||(s=Ne(window,"keydown",r[10]),l=!0)},p(o,[a]){const u={};a&262655&&(u.$$scope={dirty:a,ctx:o}),n.$set(u)},i(o){i||(m(n.$$.fragment,o),i=!0)},o(o){_(n.$$.fragment,o),i=!1},d(o){o&&b(e),E(n),l=!1,s()}}}function C_e(r,e,t){let n,i,l,s,o,a,u,f;fe(r,Ut,O=>t(7,s=O)),fe(r,Ft,O=>t(17,o=O)),fe(r,Cn,O=>t(11,a=O)),fe(r,hr,O=>t(0,u=O)),fe(r,$1,O=>t(8,f=O));let c="",p="",d=!1;async function g(){var O;try{await Ft.login({username:c,password:p}),((O=o==null?void 0:o.user)==null?void 0:O.forceResetPassword)?s("./reset"):(we.success("Logged in successfully"),s("../portal"))}catch(L){we.error(L.message?L.message:"Invalid credentials")}}function h(O){O.key==="Enter"&&g()}qt(async()=>{try{await hr.init()}catch{we.error("Error getting org config")}t(3,d=!0)});function v(O){c=O,t(1,c)}function y(O){p=O,t(2,p)}function k(O){pt.call(this,r,O)}const I=()=>s("./forgot"),T=()=>{Cn.unload(),s("./org")};return r.$$.update=()=>{r.$$.dirty&1&&t(6,n=u.company||"Budibase"),r.$$.dirty&2048&&t(5,i=a.multiTenancy),r.$$.dirty&2048&&t(4,l=a.cloud)},[u,c,p,d,l,i,n,s,f,g,h,a,v,y,k,I,T]}class S_e extends se{constructor(e){super();oe(this,e,C_e,k_e,ie,{})}}function A_e(r){let e;return{c(){e=F("Set Budibase organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function E_e(r){let e,t,n,i,l;return i=new _t({props:{$$slots:{default:[A_e]},$$scope:{ctx:r}}}),{c(){e=j("img"),n=R(),S(i.$$.fragment),w(e,"alt","logo"),pn(e.src,t=kr)||w(e,"src",t),w(e,"class","svelte-jotad8")},m(s,o){$(s,e,o),$(s,n,o),A(i,s,o),l=!0},p(s,o){const a={};o&512&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},i(s){l||(m(i.$$.fragment,s),l=!0)},o(s){_(i.$$.fragment,s),l=!1},d(s){s&&b(e),s&&b(n),E(i,s)}}}function O_e(r){let e;return{c(){e=F("Set organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function T_e(r){let e,t,n,i,l;e=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[O_e]},$$scope:{ctx:r}}});function s(a){r[5](a)}let o={label:"Organisation"};return r[0]!==void 0&&(o.value=r[0]),n=new nt({props:o}),K.push(()=>de(n,"value",s)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(a,u){A(e,a,u),$(a,t,u),A(n,a,u),l=!0},p(a,u){const f={};u&512&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0],me(()=>i=!1)),n.$set(c)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){E(e,a),a&&b(t),E(n,a)}}}function I_e(r){let e;return{c(){e=F("Set organisation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function L_e(r){let e,t;return e=new ot({props:{cta:!0,$$slots:{default:[I_e]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&512&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function P_e(r){let e,t,n,i,l,s,o,a;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[E_e]},$$scope:{ctx:r}}}),n=new nn({props:{noGrid:!0}}),l=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[T_e]},$$scope:{ctx:r}}}),o=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[L_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment)},m(u,f){A(e,u,f),$(u,t,f),A(n,u,f),$(u,i,f),A(l,u,f),$(u,s,f),A(o,u,f),a=!0},p(u,f){const c={};f&512&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&513&&(p.$$scope={dirty:f,ctx:u}),l.$set(p);const d={};f&512&&(d.$$scope={dirty:f,ctx:u}),o.$set(d)},i(u){a||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),m(o.$$.fragment,u),a=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),_(o.$$.fragment,u),a=!1},d(u){E(e,u),u&&b(t),E(n,u),u&&b(i),E(l,u),u&&b(s),E(o,u)}}}function N_e(r){let e,t,n,i,l,s;return n=new Ve({props:{$$slots:{default:[P_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-jotad8"),w(e,"class","login svelte-jotad8")},m(o,a){$(o,e,a),N(e,t),A(n,t,null),i=!0,l||(s=Ne(window,"keydown",r[2]),l=!0)},p(o,[a]){const u={};a&513&&(u.$$scope={dirty:a,ctx:o}),n.$set(u)},i(o){i||(m(n.$$.fragment,o),i=!0)},o(o){_(n.$$.fragment,o),i=!1},d(o){o&&b(e),E(n),l=!1,s()}}}function R_e(r,e,t){let n,i,l,s,o;fe(r,Ut,p=>t(8,s=p)),fe(r,Cn,p=>t(4,o=p));let a=tt(Ft).tenantSet?tt(Ft).tenantId:"";async function u(){try{(a==null||a==="")&&t(0,a="default"),await Ft.setOrg(a),await Cn.init(),s("../")}catch{we.error("Error setting organisation")}}function f(p){p.key==="Enter"&&u()}qt(async()=>{await Ft.checkQueryString(),!n||l?s("../"):Cn.unload()});function c(p){a=p,t(0,a)}return r.$$.update=()=>{r.$$.dirty&16&&(n=o.multiTenancy),r.$$.dirty&16&&t(3,i=o.cloud),r.$$.dirty&24&&(l=i&&!o.disableAccountPortal)},[a,u,f,i,o,c]}class M_e extends se{constructor(e){super();oe(this,e,R_e,N_e,ie,{})}}function D_e(r){let e,t;return{c(){e=j("img"),pn(e.src,t=r[3].logoUrl||kr)||w(e,"src",t),w(e,"alt","Organisation logo"),w(e,"class","svelte-bei7un")},m(n,i){$(n,e,i)},p(n,i){i&8&&!pn(e.src,t=n[3].logoUrl||kr)&&w(e,"src",t)},d(n){n&&b(e)}}}function j_e(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function B_e(r){let e;return{c(){e=F("Please enter the new password you'd like to use.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function z_e(r){let e,t,n,i,l,s,o,a;e=new _t({props:{textAlign:"center",$$slots:{default:[j_e]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"S",textAlign:"center",$$slots:{default:[B_e]},$$scope:{ctx:r}}});function u(p){r[7](p)}function f(p){r[8](p)}let c={};return r[0]!==void 0&&(c.password=r[0]),r[1]!==void 0&&(c.error=r[1]),l=new Zf({props:c}),K.push(()=>de(l,"password",u)),K.push(()=>de(l,"error",f)),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(p,d){A(e,p,d),$(p,t,d),A(n,p,d),$(p,i,d),A(l,p,d),a=!0},p(p,d){const g={};d&2048&&(g.$$scope={dirty:d,ctx:p}),e.$set(g);const h={};d&2048&&(h.$$scope={dirty:d,ctx:p}),n.$set(h);const v={};!s&&d&1&&(s=!0,v.password=p[0],me(()=>s=!1)),!o&&d&2&&(o=!0,v.error=p[1],me(()=>o=!1)),l.$set(v)},i(p){a||(m(e.$$.fragment,p),m(n.$$.fragment,p),m(l.$$.fragment,p),a=!0)},o(p){_(e.$$.fragment,p),_(n.$$.fragment,p),_(l.$$.fragment,p),a=!1},d(p){E(e,p),p&&b(t),E(n,p),p&&b(i),E(l,p)}}}function q_e(r){let e;return{c(){e=F("Reset your password")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function U_e(r){let e,t,n,i,l,s;return e=new Ve({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[D_e]},$$scope:{ctx:r}}}),n=new Ve({props:{gap:"XS",noPadding:!0,$$slots:{default:[z_e]},$$scope:{ctx:r}}}),l=new ot({props:{cta:!0,disabled:r[1]||(r[2]?!1:!r[4]),$$slots:{default:[q_e]},$$scope:{ctx:r}}}),l.$on("click",r[5]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment)},m(o,a){A(e,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&2056&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&2051&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&6&&(c.disabled=o[1]||(o[2]?!1:!o[4])),a&2048&&(c.$$scope={dirty:a,ctx:o}),l.$set(c)},i(o){s||(m(e.$$.fragment,o),m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){E(e,o),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function F_e(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[U_e]},$$scope:{ctx:r}}}),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),w(t,"class","main svelte-bei7un"),w(e,"class","login svelte-bei7un")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&2063&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function V_e(r,e,t){let n,i,l,s,o;fe(r,Ut,g=>t(9,i=g)),fe(r,Ft,g=>t(6,l=g)),fe(r,rr,g=>t(10,s=g)),fe(r,hr,g=>t(3,o=g));const a=s["?code"];let u,f;async function c(){try{n?(await Ft.updateSelf({password:u,forceResetPassword:!1}),i("../portal/")):(await Ft.resetPassword(u,a),we.success("Password reset successfully"),i("./login"))}catch{we.error("Unable to reset password")}}qt(async()=>{try{await Ft.getSelf(),await hr.init()}catch{we.error("Error getting org config")}});function p(g){u=g,t(0,u)}function d(g){f=g,t(1,f)}return r.$$.update=()=>{var g;r.$$.dirty&64&&t(2,n=(g=l==null?void 0:l.user)==null?void 0:g.forceResetPassword)},[u,f,n,o,a,c,l,p,d]}class H_e extends se{constructor(e){super();oe(this,e,V_e,F_e,ie,{})}}function I7(r){let e;const t=r[2].default,n=bt(t,r,r[1],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&2)&&vt(n,t,i,i[1],e?yt(t,i[1],l,null):wt(i[1]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function W_e(r){let e,t,n=(!r[0].user||r[0].user.forceResetPassword)&&I7(r);return{c(){n&&n.c(),e=Ee()},m(i,l){n&&n.m(i,l),$(i,e,l),t=!0},p(i,[l]){!i[0].user||i[0].user.forceResetPassword?n?(n.p(i,l),l&1&&m(n,1)):(n=I7(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(ee(),_(n,1,1,()=>{n=null}),te())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function G_e(r,e,t){var a,u;let n,i,l;fe(r,Cn,f=>t(3,n=f)),fe(r,Ft,f=>t(0,i=f)),fe(r,Kr,f=>t(4,l=f));let{$$slots:s={},$$scope:o}=e;return i.user&&!i.user.forceResetPassword&&l("../"),!i.user&&n.cloud&&!n.disableAccountPortal&&n.accountPortalUrl&&!((u=(a=n==null?void 0:n.checklist)==null?void 0:a.sso)==null?void 0:u.checked)&&(window.location.href=n.accountPortalUrl),r.$$set=f=>{"$$scope"in f&&t(1,o=f.$$scope)},[i,o,s]}class Y_e extends se{constructor(e){super();oe(this,e,G_e,W_e,ie,{})}}function J_e(r,e,t){let n,i;return fe(r,Kr,l=>t(0,n=l)),fe(r,Ft,l=>t(1,i=l)),Ft.checkQueryString(),r.$$.update=()=>{var l,s;r.$$.dirty&3&&(((s=(l=i.user)==null?void 0:l.builder)==null?void 0:s.global)?n("./portal"):i.user&&n("./apps"))},[n,i]}class Q_e extends se{constructor(e){super();oe(this,e,J_e,null,ie,{})}}function X_e(r){let e;return{c(){e=F("Accept Invitation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function K_e(r){let e;return{c(){e=F("Please enter a password to set up your user.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Z_e(r){let e,t,n,i;return e=new _t({props:{size:"M",$$slots:{default:[X_e]},$$scope:{ctx:r}}}),n=new Ye({props:{textAlign:"center",size:"M",$$slots:{default:[K_e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&256&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&256&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function x_e(r){let e;return{c(){e=F("Accept invite")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ehe(r){let e,t,n,i,l,s,o,a,u,f,c;i=new Ve({props:{gap:"XS",justifyItems:"center",noPadding:!0,$$slots:{default:[Z_e]},$$scope:{ctx:r}}});function p(h){r[3](h)}function d(h){r[4](h)}let g={};return r[1]!==void 0&&(g.error=r[1]),r[0]!==void 0&&(g.password=r[0]),s=new Zf({props:g}),K.push(()=>de(s,"error",p)),K.push(()=>de(s,"password",d)),f=new ot({props:{disabled:r[1],cta:!0,$$slots:{default:[x_e]},$$scope:{ctx:r}}}),f.$on("click",r[2]),{c(){e=j("img"),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),u=R(),S(f.$$.fragment),pn(e.src,t=kr)||w(e,"src",t),w(e,"alt","logo"),w(e,"class","svelte-1lpndr")},m(h,v){$(h,e,v),$(h,n,v),A(i,h,v),$(h,l,v),A(s,h,v),$(h,u,v),A(f,h,v),c=!0},p(h,v){const y={};v&256&&(y.$$scope={dirty:v,ctx:h}),i.$set(y);const k={};!o&&v&2&&(o=!0,k.error=h[1],me(()=>o=!1)),!a&&v&1&&(a=!0,k.password=h[0],me(()=>a=!1)),s.$set(k);const I={};v&2&&(I.disabled=h[1]),v&256&&(I.$$scope={dirty:v,ctx:h}),f.$set(I)},i(h){c||(m(i.$$.fragment,h),m(s.$$.fragment,h),m(f.$$.fragment,h),c=!0)},o(h){_(i.$$.fragment,h),_(s.$$.fragment,h),_(f.$$.fragment,h),c=!1},d(h){h&&b(e),h&&b(n),E(i,h),h&&b(l),E(s,h),h&&b(u),E(f,h)}}}function the(r){let e,t,n,i;return n=new Ve({props:{$$slots:{default:[ehe]},$$scope:{ctx:r}}}),{c(){e=j("section"),t=j("div"),S(n.$$.fragment),w(t,"class","container svelte-1lpndr"),w(e,"class","svelte-1lpndr")},m(l,s){$(l,e,s),N(e,t),A(n,t,null),i=!0},p(l,[s]){const o={};s&259&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(e),E(n)}}}function nhe(r,e,t){let n,i;fe(r,Ut,c=>t(5,n=c)),fe(r,rr,c=>t(6,i=c));const l=i["?code"];let s,o;async function a(){try{await yi.acceptInvite(l,s),we.success("Invitation accepted successfully"),n("../auth/login")}catch(c){we.error(c.message)}}function u(c){o=c,t(1,o)}function f(c){s=c,t(0,s)}return[s,o,a,u,f]}class rhe extends se{constructor(e){super();oe(this,e,nhe,the,ie,{})}}const L7=()=>{const r={errors:{},touched:{},valid:!1},e={},t=mn(r),n=(l,s)=>{!s||!l||(e[l]=s)},i=async l=>{const s=eA().shape(e),o=Object.keys(e);o.forEach(f=>tt(t).errors[f]=null);let a=!1;try{await s.validate(l,{abortEarly:!1})}catch(f){f.inner?f.inner.forEach(c=>{t.update(p=>(p.errors[c.path]=Cr(c.message),p))}):(we.error("Unexpected validation error",f),a=!0)}let u;o.length&&!a?u=await s.isValid(l):u=!1,t.update(f=>(f.valid=u,f))};return{subscribe:t.subscribe,set:t.set,check:i,addValidator:n}},P7=(r,{apps:e,currentApp:t}={apps:[]})=>{r.addValidator("name",k_().trim().required("Your application must have a name").matches(CB,"App name must be letters, numbers and spaces only").test("non-existing-app-name","Another app with the same name already exists",n=>n?(t&&(e=e.filter(i=>i.appId!==t.appId)),!e.map(i=>i.name).some(i=>i.toLowerCase()===n.toLowerCase())):!0))},N7=(r,{apps:e,currentApp:t}={apps:[]})=>{r.addValidator("url",k_().trim().nullable().required("Your application must have a url").matches(SB,"Please enter a valid url").test("non-existing-app-url","Another app with the same URL already exists",n=>n?(t&&(e=e.filter(i=>i.appId!==t.appId)),!e.map(i=>i.url).some(i=>(i==null?void 0:i.toLowerCase())===n.toLowerCase())):!0).test("valid-url","Not a valid URL",n=>n?n.startsWith("/")&&!n.includes("http")&&!n.includes("www")&&!n.includes(".")&&n.length>1:!0))},ihe=(r,{template:e}={})=>{const t=e&&Object.keys(e).length===0?null:e;r.addValidator("file",(t==null?void 0:t.fromFile)?tA().required("Please choose a file to import"):null)};function lhe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,y,k,I,T;const O=r[8].default,L=bt(O,r,r[7],null);return{c(){e=j("div"),t=j("div"),n=j("img"),l=R(),s=j("div"),o=_e("svg"),a=_e("use"),c=R(),p=j("div"),L&&L.c(),g=R(),h=j("div"),v=j("div"),y=F(r[2]),w(n,"alt",r[2]),pn(n.src,i=r[1])||w(n,"src",i),w(n,"class","svelte-9xmo95"),ae(n,"error",r[5]),Gt(a,"xlink:href",u="#spectrum-icon-18-"+r[3]),w(o,"width","26px"),w(o,"height","26px"),w(o,"class","spectrum-Icon"),Lt(o,"color","white"),w(o,"focusable","false"),w(s,"style",f=`display:${r[5]?"block":"none"}`),w(p,"class",d=""+(Wn(r[4]?"template-thumbnail-action-overlay":"")+" svelte-9xmo95")),w(t,"class","template-thumbnail card-body svelte-9xmo95"),w(v,"class","svelte-9xmo95"),w(h,"class","template-thumbnail-text svelte-9xmo95"),w(e,"class","template-card svelte-9xmo95"),Lt(e,"background-color",r[0])},m(M,U){$(M,e,U),N(e,t),N(t,n),N(t,l),N(t,s),N(s,o),N(o,a),N(t,c),N(t,p),L&&L.m(p,null),N(e,g),N(e,h),N(h,v),N(v,y),k=!0,I||(T=Ne(n,"error",r[6]),I=!0)},p(M,[U]){(!k||U&4)&&w(n,"alt",M[2]),(!k||U&2&&!pn(n.src,i=M[1]))&&w(n,"src",i),U&32&&ae(n,"error",M[5]),(!k||U&8&&u!==(u="#spectrum-icon-18-"+M[3]))&&Gt(a,"xlink:href",u),(!k||U&32&&f!==(f=`display:${M[5]?"block":"none"}`))&&w(s,"style",f),L&&L.p&&(!k||U&128)&&vt(L,O,M,M[7],k?yt(O,M[7],U,null):wt(M[7]),null),(!k||U&16&&d!==(d=""+(Wn(M[4]?"template-thumbnail-action-overlay":"")+" svelte-9xmo95")))&&w(p,"class",d),(!k||U&4)&&Oe(y,M[2]),(!k||U&1)&&Lt(e,"background-color",M[0])},i(M){k||(m(L,M),k=!0)},o(M){_(L,M),k=!1},d(M){M&&b(e),L&&L.d(M),I=!1,T()}}}function she(r,e,t){let{$$slots:n={},$$scope:i}=e,{backgroundColour:l}=e,{imageSrc:s}=e,{name:o}=e,{icon:a}=e,{overlayEnabled:u=!0}=e,f=!1;const c=()=>{t(5,f=!0)};return r.$$set=p=>{"backgroundColour"in p&&t(0,l=p.backgroundColour),"imageSrc"in p&&t(1,s=p.imageSrc),"name"in p&&t(2,o=p.name),"icon"in p&&t(3,a=p.icon),"overlayEnabled"in p&&t(4,u=p.overlayEnabled),"$$scope"in p&&t(7,i=p.$$scope)},[l,s,o,a,u,f,c,i,n]}class R7 extends se{constructor(e){super();oe(this,e,she,lhe,ie,{backgroundColour:0,imageSrc:1,name:2,icon:3,overlayEnabled:4})}}function M7(r){let e,t;return e=new R7({props:{name:r[0].name,imageSrc:r[0].image,backgroundColour:r[0].background,overlayEnabled:!1,icon:r[0].icon}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.name=n[0].name),i&1&&(l.imageSrc=n[0].image),i&1&&(l.backgroundColour=n[0].background),i&1&&(l.icon=n[0].icon),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function D7(r){let e,t;return e=new Xo({props:{error:r[4].touched.file&&r[4].errors.file,gallery:!1,label:"File to import",value:[r[1].file]}}),e.$on("change",r[12]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.error=n[4].touched.file&&n[4].errors.file),i&2&&(l.value=[n[1].file]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function j7(r){let e,t;return{c(){e=j("div"),t=F(r[3]),w(e,"class","app-server svelte-x7xwuh"),w(e,"title",r[3])},m(n,i){$(n,e,i),N(e,t)},p(n,i){i&8&&Oe(t,n[3]),i&8&&w(e,"title",n[3])},d(n){n&&b(e)}}}function ohe(r){var k,I,T;let e,t,n,i,l,s,o,a,u,f,c=r[0]&&!((k=r[0])==null?void 0:k.fromFile)&&M7(r),p=((I=r[0])==null?void 0:I.fromFile)&&D7(r);function d(O){r[13](O)}let g={disabled:r[2],error:r[4].touched.name&&r[4].errors.name,label:"Name",placeholder:((T=r[5].user)==null?void 0:T.firstName)?`${r[5].user.firstName}s app`:"My app"};r[1].name!==void 0&&(g.value=r[1].name),n=new nt({props:g}),K.push(()=>de(n,"value",d)),n.$on("blur",r[14]),n.$on("change",function(){ft(r[10](r[1].name))&&r[10](r[1].name).apply(this,arguments)});function h(O){r[15](O)}let v={disabled:r[2],error:r[4].touched.url&&r[4].errors.url,label:"URL",placeholder:r[1].url?r[1].url:`/${r[8](r[0],r[1].name)}`};r[1].url!==void 0&&(v.value=r[1].url),o=new nt({props:v}),K.push(()=>de(o,"value",h)),o.$on("blur",r[16]),o.$on("change",function(){ft(r[9](r[1].url))&&r[9](r[1].url).apply(this,arguments)});let y=r[1].url&&r[1].url!==""&&!r[4].errors.url&&j7(r);return{c(){c&&c.c(),e=R(),p&&p.c(),t=R(),S(n.$$.fragment),l=R(),s=j("span"),S(o.$$.fragment),u=R(),y&&y.c()},m(O,L){c&&c.m(O,L),$(O,e,L),p&&p.m(O,L),$(O,t,L),A(n,O,L),$(O,l,L),$(O,s,L),A(o,s,null),N(s,u),y&&y.m(s,null),f=!0},p(O,L){var D,B,V;r=O,r[0]&&!((D=r[0])==null?void 0:D.fromFile)?c?(c.p(r,L),L&1&&m(c,1)):(c=M7(r),c.c(),m(c,1),c.m(e.parentNode,e)):c&&(ee(),_(c,1,1,()=>{c=null}),te()),((B=r[0])==null?void 0:B.fromFile)?p?(p.p(r,L),L&1&&m(p,1)):(p=D7(r),p.c(),m(p,1),p.m(t.parentNode,t)):p&&(ee(),_(p,1,1,()=>{p=null}),te());const M={};L&4&&(M.disabled=r[2]),L&16&&(M.error=r[4].touched.name&&r[4].errors.name),L&32&&(M.placeholder=((V=r[5].user)==null?void 0:V.firstName)?`${r[5].user.firstName}s app`:"My app"),!i&&L&2&&(i=!0,M.value=r[1].name,me(()=>i=!1)),n.$set(M);const U={};L&4&&(U.disabled=r[2]),L&16&&(U.error=r[4].touched.url&&r[4].errors.url),L&3&&(U.placeholder=r[1].url?r[1].url:`/${r[8](r[0],r[1].name)}`),!a&&L&2&&(a=!0,U.value=r[1].url,me(()=>a=!1)),o.$set(U),r[1].url&&r[1].url!==""&&!r[4].errors.url?y?y.p(r,L):(y=j7(r),y.c(),y.m(s,null)):y&&(y.d(1),y=null)},i(O){f||(m(c),m(p),m(n.$$.fragment,O),m(o.$$.fragment,O),f=!0)},o(O){_(c),_(p),_(n.$$.fragment,O),_(o.$$.fragment,O),f=!1},d(O){c&&c.d(O),O&&b(e),p&&p.d(O),O&&b(t),E(n,O),O&&b(l),O&&b(s),E(o),y&&y.d()}}}function ahe(r){var n;let e,t;return e=new Nt({props:{title:"Create your app",confirmText:((n=r[0])==null?void 0:n.fromFile)?"Import app":"Create app",onConfirm:r[11],disabled:!r[4].valid,$$slots:{default:[ohe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){var o;const s={};l&1&&(s.confirmText=((o=i[0])==null?void 0:o.fromFile)?"Import app":"Create app"),l&16&&(s.disabled=!i[4].valid),l&1048639&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}const B7="/app";function uhe(r,e,t){let n,i,l,s,o;fe(r,Ut,M=>t(17,i=M)),fe(r,Ft,M=>t(5,o=M));let{template:a}=e,u=!1;const f=mn({name:"",url:null});fe(r,f,M=>t(1,l=M));const c=L7();fe(r,c,M=>t(4,s=M)),qt(async()=>{Mn(f,l.name=d(a,l.name),l),h(l.name),await v()});const p=(M,U)=>{let D;const B=d(M,U);D=B?B.toLowerCase():"";const V=D?D.replace(/\s+/g,"-"):"";return encodeURI(V)},d=(M,U)=>M&&!U?M.name:U?U.trim():null,g=M=>{M&&!M.startsWith("/")&&(M=`/${M}`),Mn(f,l.url=M===""?null:M,l)},h=M=>{let U=p(a,M);g(U)},v=async()=>{const M=tt(Lr);P7(c,{apps:M}),N7(c,{apps:M}),ihe(c,{template:a}),c.check(l)};async function y(){t(2,u=!0);try{let M=new FormData;M.append("name",l.name.trim()),l.url&&M.append("url",l.url.trim()),M.append("useTemplate",a!=null),a&&(M.append("templateName",a.name),M.append("templateKey",a.key),M.append("templateFile",l.file));const U=await Ze.createApp(M);Ln.captureEvent(Nn.APP.CREATED,{name:l.name,appId:U.instance._id,templateToUse:a});const D=await Ze.fetchAppPackage(U.instance._id);await Ge.actions.initialise(D),await Qt.actions.fetch(),await Cn.init(),await Ze.updateOwnMetadata({roleId:l.roleId}),await Ft.setInitInfo({}),i(`/builder/app/${U.instance._id}`)}catch(M){t(2,u=!1),console.error(M),we.error("Error creating app")}}const k=M=>{var U;Mn(f,l.file=(U=M.detail)==null?void 0:U[0],l),Mn(c,s.touched.file=!0,s)};function I(M){r.$$.not_equal(l.name,M)&&(l.name=M,f.set(l))}const T=()=>Mn(c,s.touched.name=!0,s);function O(M){r.$$.not_equal(l.url,M)&&(l.url=M,f.set(l))}const L=()=>Mn(c,s.touched.url=!0,s);return r.$$set=M=>{"template"in M&&t(0,a=M.template)},r.$$.update=()=>{r.$$.dirty&2&&c.check(l),r.$$.dirty&3&&t(3,n=`${window.location.origin}${l.url?`${B7}${l.url}`:`${B7}${p(a,l.name)}`}`)},[a,l,u,n,s,o,f,c,p,g,h,y,k,I,T,O,L]}class G1 extends se{constructor(e){super();oe(this,e,uhe,ahe,ie,{template:0})}}function z7(r,e,t){const n=r.slice();return n[14]=e[t],n}function q7(r,e,t){const n=r.slice();return n[17]=e[t],n}function U7(r,e,t){const n=r.slice();return n[14]=e[t],n}function fhe(r){let e;return{c(){e=F("Templates")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function che(r){let e;return{c(){e=F("All")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function phe(r){let e=r[14]+"",t,n;return{c(){t=F(e),n=R()},m(i,l){$(i,t,l),$(i,n,l)},p(i,l){l&16&&e!==(e=i[14]+"")&&Oe(t,e)},d(i){i&&b(t),i&&b(n)}}}function F7(r){let e,t;function n(){return r[10](r[14])}return e=new Jt({props:{dataCy:r[14],selected:r[14]==r[0],$$slots:{default:[phe]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.dataCy=r[14]),l&17&&(s.selected=r[14]==r[0]),l&4194320&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}function dhe(r){let e,t,n,i;e=new Jt({props:{selected:!r[0],$$slots:{default:[che]},$$scope:{ctx:r}}}),e.$on("click",r[9]);let l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=F7(U7(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){S(e.$$.fragment),t=R();for(let a=0;a<s.length;a+=1)s[a].c();n=Ee()},m(a,u){A(e,a,u),$(a,t,u);for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,n,u),i=!0},p(a,u){const f={};if(u&1&&(f.selected=!a[0]),u&4194304&&(f.$$scope={dirty:u,ctx:a}),e.$set(f),u&17){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=U7(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=F7(p),s[c].c(),m(s[c],1),s[c].m(n.parentNode,n))}for(ee(),c=l.length;c<s.length;c+=1)o(c);te()}},i(a){if(!i){m(e.$$.fragment,a);for(let u=0;u<l.length;u+=1)m(s[u]);i=!0}},o(a){_(e.$$.fragment,a),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);i=!1},d(a){E(e,a),a&&b(t),gt(s,a),a&&b(n)}}}function mhe(r){let e,t,n,i,l;return e=new _t({props:{size:"S",$$slots:{default:[fhe]},$$scope:{ctx:r}}}),i=new Ap({props:{$$slots:{default:[dhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=j("div"),S(i.$$.fragment),w(n,"class","template-category-filters spectrum-ActionGroup")},m(s,o){A(e,s,o),$(s,t,o),$(s,n,o),A(i,n,null),l=!0},p(s,o){const a={};o&4194304&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&4194321&&(u.$$scope={dirty:o,ctx:s}),i.$set(u)},i(s){l||(m(e.$$.fragment,s),m(i.$$.fragment,s),l=!0)},o(s){_(e.$$.fragment,s),_(i.$$.fragment,s),l=!1},d(s){E(e,s),s&&b(t),s&&b(n),E(i)}}}function ghe(r){let e=r[14]+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&32&&e!==(e=n[14]+"")&&Oe(t,e)},d(n){n&&b(t)}}}function _he(r){let e;return{c(){e=F("Use template")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function hhe(r){let e,t,n,i,l,s,o,a,u;function f(){return r[11](r[17])}return e=new ot({props:{cta:!0,$$slots:{default:[_he]},$$scope:{ctx:r}}}),e.$on("click",f),{c(){S(e.$$.fragment),t=R(),n=j("a"),i=F("Details"),s=R(),w(n,"href",l=r[17].url),w(n,"target","_blank"),w(n,"class","overlay-preview-link spectrum-Button spectrum-Button--sizeM spectrum-Button--secondary svelte-1spxv8t")},m(c,p){A(e,c,p),$(c,t,p),$(c,n,p),N(n,i),$(c,s,p),o=!0,a||(u=Ne(n,"click",$p(r[8])),a=!0)},p(c,p){r=c;const d={};p&4194304&&(d.$$scope={dirty:p,ctx:r}),e.$set(d),(!o||p&34&&l!==(l=r[17].url))&&w(n,"href",l)},i(c){o||(m(e.$$.fragment,c),o=!0)},o(c){_(e.$$.fragment,c),o=!1},d(c){E(e,c),c&&b(t),c&&b(n),c&&b(s),a=!1,u()}}}function V7(r){let e,t;return e=new R7({props:{name:r[17].name,imageSrc:r[17].image,backgroundColour:r[17].background,icon:r[17].icon,$$slots:{default:[hhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&34&&(l.name=n[17].name),i&34&&(l.imageSrc=n[17].image),i&34&&(l.backgroundColour=n[17].background),i&34&&(l.icon=n[17].icon),i&4194350&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function H7(r){let e,t,n,i,l,s,o;t=new Hr({props:{size:"M",$$slots:{default:[ghe]},$$scope:{ctx:r}}});let a=r[1][r[14]],u=[];for(let c=0;c<a.length;c+=1)u[c]=V7(q7(r,a,c));const f=c=>_(u[c],1,1,()=>{u[c]=null});return{c(){e=j("div"),S(t.$$.fragment),n=R(),i=j("div");for(let c=0;c<u.length;c+=1)u[c].c();l=R(),w(i,"class","template-grid svelte-1spxv8t"),w(e,"class","template-category"),w(e,"data-cy",s=r[14])},m(c,p){$(c,e,p),A(t,e,null),N(e,n),N(e,i);for(let d=0;d<u.length;d+=1)u[d].m(i,null);N(e,l),o=!0},p(c,p){const d={};if(p&4194336&&(d.$$scope={dirty:p,ctx:c}),t.$set(d),p&46){a=c[1][c[14]];let g;for(g=0;g<a.length;g+=1){const h=q7(c,a,g);u[g]?(u[g].p(h,p),m(u[g],1)):(u[g]=V7(h),u[g].c(),m(u[g],1),u[g].m(i,null))}for(ee(),g=a.length;g<u.length;g+=1)f(g);te()}(!o||p&32&&s!==(s=c[14]))&&w(e,"data-cy",s)},i(c){if(!o){m(t.$$.fragment,c);for(let p=0;p<a.length;p+=1)m(u[p]);o=!0}},o(c){_(t.$$.fragment,c),u=u.filter(Boolean);for(let p=0;p<u.length;p+=1)_(u[p]);o=!1},d(c){c&&b(e),E(t),gt(u,c)}}}function $he(r){let e,t,n=r[5],i=[];for(let s=0;s<n.length;s+=1)i[s]=H7(z7(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s<i.length;s+=1)i[s].c();e=Ee()},m(s,o){for(let a=0;a<i.length;a+=1)i[a].m(s,o);$(s,e,o),t=!0},p(s,o){if(o&46){n=s[5];let a;for(a=0;a<n.length;a+=1){const u=z7(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=H7(u),i[a].c(),m(i[a],1),i[a].m(e.parentNode,e))}for(ee(),a=n.length;a<i.length;a+=1)l(a);te()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){gt(i,s),s&&b(e)}}}function bhe(r){let e,t;return e=new G1({props:{template:r[3]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.template=n[3]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function vhe(r){let e,t,n,i,l,s,o,a;t=new Ve({props:{noPadding:!0,gap:"S",$$slots:{default:[mhe]},$$scope:{ctx:r}}}),l=new Ve({props:{gap:"XL",noPadding:!0,$$slots:{default:[$he]},$$scope:{ctx:r}}});let u={padding:!1,width:"600px",$$slots:{default:[bhe]},$$scope:{ctx:r}};return o=new kt({props:u}),r[12](o),o.$on("hide",r[6]),{c(){e=j("div"),S(t.$$.fragment),n=R(),i=j("div"),S(l.$$.fragment),s=R(),S(o.$$.fragment),w(e,"class","template-header"),w(i,"class","template-categories")},m(f,c){$(f,e,c),A(t,e,null),$(f,n,c),$(f,i,c),A(l,i,null),$(f,s,c),A(o,f,c),a=!0},p(f,[c]){const p={};c&4194321&&(p.$$scope={dirty:c,ctx:f}),t.$set(p);const d={};c&4194350&&(d.$$scope={dirty:c,ctx:f}),l.$set(d);const g={};c&4194312&&(g.$$scope={dirty:c,ctx:f}),o.$set(g)},i(f){a||(m(t.$$.fragment,f),m(l.$$.fragment,f),m(o.$$.fragment,f),a=!0)},o(f){_(t.$$.fragment,f),_(l.$$.fragment,f),_(o.$$.fragment,f),a=!1},d(f){f&&b(e),E(t),f&&b(n),f&&b(i),E(l),f&&b(s),r[12](null),E(o,f)}}}function whe(r,e,t){let n,i,l,{templates:s}=e,o,a,u;const f=(y,k)=>y.reduce((T,O)=>(typeof k=="string"&&[k].indexOf(O.category)<0||(T[O.category]=T[O.category]?T[O.category]:[],T[O.category].push(O)),T),{}),c=()=>{t(3,u=null)};function p(y){pt.call(this,r,y)}const d=()=>{t(0,o=null)},g=y=>{t(0,o=y)},h=y=>{t(3,u=y),a.show()};function v(y){K[y?"unshift":"push"](()=>{a=y,t(2,a)})}return r.$$set=y=>{"templates"in y&&t(7,s=y.templates)},r.$$.update=()=>{r.$$.dirty&129&&t(1,n=f(s,o)),r.$$.dirty&2&&t(5,i=n?Object.keys(n).sort():[]),r.$$.dirty&128&&t(4,l=s?Object.keys(f(s)).sort():[])},[o,n,a,u,l,i,c,s,p,d,g,h,v]}class Y1 extends se{constructor(e){super();oe(this,e,whe,vhe,ie,{templates:7})}}function yhe(r){let e;return{c(){e=F("Back")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function khe(r){let e;return{c(){e=F(Nhe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Che(r){let e;return{c(){e=F(Phe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function She(r){let e,t,n,i;return e=new _t({props:{size:"L",$$slots:{default:[khe]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"M",$$slots:{default:[Che]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&2048&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function Ahe(r){let e;return{c(){e=F(Rhe)},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Ehe(r){let e;return{c(){e=F("Import app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function W7(r){let e,t;return e=new Y1({props:{templates:r[3]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.templates=n[3]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ohe(r){var k;let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v;t=new ot({props:{quiet:!0,secondary:!0,icon:"ChevronLeft",$$slots:{default:[yhe]},$$scope:{ctx:r}}}),t.$on("click",r[8]),s=new Ve({props:{noPadding:!0,gap:"XS",$$slots:{default:[She]},$$scope:{ctx:r}}}),u=new ot({props:{dataCy:"create-app-btn",size:"M",icon:"Add",cta:!0,$$slots:{default:[Ahe]},$$scope:{ctx:r}}}),u.$on("click",r[5]),c=new ot({props:{dataCy:"import-app-btn",icon:"Import",size:"M",quiet:!0,secondary:!0,$$slots:{default:[Ehe]},$$scope:{ctx:r}}}),c.$on("click",r[7]),d=new nn({props:{size:"S"}});let y=r[0]&&((k=r[3])==null?void 0:k.length)&&W7(r);return{c(){e=j("span"),S(t.$$.fragment),n=R(),i=j("div"),l=j("div"),S(s.$$.fragment),o=R(),a=j("div"),S(u.$$.fragment),f=R(),S(c.$$.fragment),p=R(),S(d.$$.fragment),g=R(),y&&y.c(),h=Ee(),w(a,"class","buttons svelte-1fpitx1"),w(l,"class","welcome svelte-1fpitx1"),w(i,"class","title svelte-1fpitx1")},m(I,T){$(I,e,T),A(t,e,null),$(I,n,T),$(I,i,T),N(i,l),A(s,l,null),N(l,o),N(l,a),A(u,a,null),N(a,f),A(c,a,null),$(I,p,T),A(d,I,T),$(I,g,T),y&&y.m(I,T),$(I,h,T),v=!0},p(I,T){var D;const O={};T&2048&&(O.$$scope={dirty:T,ctx:I}),t.$set(O);const L={};T&2048&&(L.$$scope={dirty:T,ctx:I}),s.$set(L);const M={};T&2048&&(M.$$scope={dirty:T,ctx:I}),u.$set(M);const U={};T&2048&&(U.$$scope={dirty:T,ctx:I}),c.$set(U),I[0]&&((D=I[3])==null?void 0:D.length)?y?(y.p(I,T),T&9&&m(y,1)):(y=W7(I),y.c(),m(y,1),y.m(h.parentNode,h)):y&&(ee(),_(y,1,1,()=>{y=null}),te())},i(I){v||(m(t.$$.fragment,I),m(s.$$.fragment,I),m(u.$$.fragment,I),m(c.$$.fragment,I),m(d.$$.fragment,I),m(y),v=!0)},o(I){_(t.$$.fragment,I),_(s.$$.fragment,I),_(u.$$.fragment,I),_(c.$$.fragment,I),_(d.$$.fragment,I),_(y),v=!1},d(I){I&&b(e),E(t),I&&b(n),I&&b(i),E(s),E(u),E(c),I&&b(p),E(d,I),I&&b(g),y&&y.d(I),I&&b(h)}}}function The(r){let e,t;return e=new Ve({props:{noPadding:!0,gap:"XL",$$slots:{default:[Ohe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2073&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ihe(r){let e,t;return e=new G1({props:{template:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.template=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Lhe(r){let e,t,n,i;e=new Ks({props:{wide:!0,$$slots:{default:[The]},$$scope:{ctx:r}}});let l={padding:!1,width:"600px",$$slots:{default:[Ihe]},$$scope:{ctx:r}};return n=new kt({props:l}),r[9](n),n.$on("hide",r[6]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(s,o){A(e,s,o),$(s,t,o),A(n,s,o),i=!0},p(s,[o]){const a={};o&2073&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&2050&&(u.$$scope={dirty:o,ctx:s}),n.$set(u)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){E(e,s),s&&b(t),r[9](null),E(n,s)}}}const Phe="Start from scratch or get a head start with one of our templates",Nhe="Create new app",Rhe="Start from scratch";function Mhe(r,e,t){let n,i;fe(r,wo,d=>t(3,n=d)),fe(r,Ut,d=>t(4,i=d));let l=n==null?void 0:n.length,s,o=!1;qt(async()=>{try{await wo.load(),(n==null?void 0:n.length)===0&&we.error("There was a problem loading quick start templates.")}catch{we.error("Error loading apps and templates")}t(0,l=!0)});const a=()=>{t(1,s=null),o.show()},u=()=>{t(1,s=null)},f=()=>{t(1,s={fromFile:!0}),o.show()},c=()=>{i("../")};function p(d){K[d?"unshift":"push"](()=>{o=d,t(2,o)})}return[l,s,o,n,i,a,u,f,c,p]}class Dhe extends se{constructor(e){super();oe(this,e,Mhe,Lhe,ie,{})}}function jhe(r){let e;return{c(){e=F("Update the name of your app.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Bhe(r){let e,t,n,i,l,s,o,a;e=new Ye({props:{size:"S",$$slots:{default:[jhe]},$$scope:{ctx:r}}});function u(d){r[9](d)}let f={error:r[1].touched.name&&r[1].errors.name,label:"Name"};r[0].name!==void 0&&(f.value=r[0].name),n=new nt({props:f}),K.push(()=>de(n,"value",u)),n.$on("blur",r[10]),n.$on("change",function(){ft(r[7](r[0].name))&&r[7](r[0].name).apply(this,arguments)});function c(d){r[11](d)}let p={error:r[1].touched.url&&r[1].errors.url,label:"URL",placeholder:r[0].url?r[0].url:`/${r[5](null,r[0].name)}`};return r[0].url!==void 0&&(p.value=r[0].url),s=new nt({props:p}),K.push(()=>de(s,"value",c)),s.$on("blur",r[12]),s.$on("change",function(){ft(r[6](r[0].url))&&r[6](r[0].url).apply(this,arguments)}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment)},m(d,g){A(e,d,g),$(d,t,g),A(n,d,g),$(d,l,g),A(s,d,g),a=!0},p(d,g){r=d;const h={};g&32768&&(h.$$scope={dirty:g,ctx:r}),e.$set(h);const v={};g&2&&(v.error=r[1].touched.name&&r[1].errors.name),!i&&g&1&&(i=!0,v.value=r[0].name,me(()=>i=!1)),n.$set(v);const y={};g&2&&(y.error=r[1].touched.url&&r[1].errors.url),g&1&&(y.placeholder=r[0].url?r[0].url:`/${r[5](null,r[0].name)}`),!o&&g&1&&(o=!0,y.value=r[0].url,me(()=>o=!1)),s.$set(y)},i(d){a||(m(e.$$.fragment,d),m(n.$$.fragment,d),m(s.$$.fragment,d),a=!0)},o(d){_(e.$$.fragment,d),_(n.$$.fragment,d),_(s.$$.fragment,d),a=!1},d(d){E(e,d),d&&b(t),E(n,d),d&&b(l),E(s,d)}}}function zhe(r){let e,t;return e=new Nt({props:{title:"Edit app",confirmText:"Save",onConfirm:r[4],disabled:!r[1].valid,$$slots:{default:[Bhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.disabled=!n[1].valid),i&32771&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function qhe(r,e,t){let n,i,{app:l}=e;const s=mn({name:"",url:null});fe(r,s,k=>t(0,n=k));const o=L7();fe(r,o,k=>t(1,i=k)),qt(async()=>{Mn(s,n.name=l.name,n),Mn(s,n.url=l.url,n),a()});const a=async()=>{const k=tt(Lr);P7(o,{apps:k,currentApp:l}),N7(o,{apps:k,currentApp:l}),o.check(n)};async function u(){try{const k={name:n.name.trim()};n.url&&(k.url=n.url.trim()),await Lr.update(l.instance._id,k)}catch(k){console.error(k),we.error("Error updating app")}}const f=(k,I)=>{let T;const O=c(null,I);T=O?O.toLowerCase():"";const L=T?T.replace(/\s+/g,"-"):"";return encodeURI(L)},c=(k,I)=>k&&!I?k.name:I?I.trim():null,p=k=>{k&&!k.startsWith("/")&&(k=`/${k}`),Mn(s,n.url=k===""?null:k,n)},d=k=>{let I=f(null,k);p(I)};function g(k){r.$$.not_equal(n.name,k)&&(n.name=k,s.set(n))}const h=()=>Mn(o,i.touched.name=!0,i);function v(k){r.$$.not_equal(n.url,k)&&(n.url=k,s.set(n))}const y=()=>Mn(o,i.touched.url=!0,i);return r.$$set=k=>{"app"in k&&t(8,l=k.app)},r.$$.update=()=>{r.$$.dirty&1&&o.check(n)},[n,i,s,o,u,f,p,d,l,g,h,v,y]}class Uhe extends se{constructor(e){super();oe(this,e,qhe,zhe,ie,{app:8})}}function G7(r,e,t){const n=r.slice();return n[15]=e[t],n}function Fhe(r){let e;return{c(){e=F("Select an icon")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Y7(r){let e,t,n,i,l,s;t=new ut({props:{name:r[15]}});function o(){return r[10](r[15])}return{c(){e=j("div"),S(t.$$.fragment),n=R(),w(e,"class","icon-item svelte-jw5qd4"),ae(e,"selected",r[15]===r[2])},m(a,u){$(a,e,u),A(t,e,null),N(e,n),i=!0,l||(s=Ne(e,"click",o),l=!0)},p(a,u){r=a,u&12&&ae(e,"selected",r[15]===r[2])},i(a){i||(m(t.$$.fragment,a),i=!0)},o(a){_(t.$$.fragment,a),i=!1},d(a){a&&b(e),E(t),l=!1,s()}}}function Vhe(r){let e;return{c(){e=F("Select a color")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Hhe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g;n=new Ke({props:{$$slots:{default:[Fhe]},$$scope:{ctx:r}}});let h=r[3],v=[];for(let T=0;T<h.length;T+=1)v[T]=Y7(G7(r,h,T));const y=T=>_(v[T],1,1,()=>{v[T]=null});u=new Ke({props:{$$slots:{default:[Vhe]},$$scope:{ctx:r}}});function k(T){r[11](T)}let I={};return r[1]!==void 0&&(I.value=r[1]),p=new Ql({props:I}),K.push(()=>de(p,"value",k)),p.$on("change",r[12]),{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),l=j("div");for(let T=0;T<v.length;T+=1)v[T].c();s=R(),o=j("div"),a=j("div"),S(u.$$.fragment),f=R(),c=j("div"),S(p.$$.fragment),w(t,"class","title-spacing svelte-jw5qd4"),w(l,"class","grid svelte-jw5qd4"),w(e,"class","scrollable-icons svelte-jw5qd4"),w(c,"class","color-selection-item svelte-jw5qd4"),w(o,"class","color-selection svelte-jw5qd4")},m(T,O){$(T,e,O),N(e,t),A(n,t,null),N(e,i),N(e,l);for(let L=0;L<v.length;L+=1)v[L].m(l,null);$(T,s,O),$(T,o,O),N(o,a),A(u,a,null),N(o,f),N(o,c),A(p,c,null),g=!0},p(T,O){const L={};if(O&262144&&(L.$$scope={dirty:O,ctx:T}),n.$set(L),O&12){h=T[3];let D;for(D=0;D<h.length;D+=1){const B=G7(T,h,D);v[D]?(v[D].p(B,O),m(v[D],1)):(v[D]=Y7(B),v[D].c(),m(v[D],1),v[D].m(l,null))}for(ee(),D=h.length;D<v.length;D+=1)y(D);te()}const M={};O&262144&&(M.$$scope={dirty:O,ctx:T}),u.$set(M);const U={};!d&&O&2&&(d=!0,U.value=T[1],me(()=>d=!1)),p.$set(U)},i(T){if(!g){m(n.$$.fragment,T);for(let O=0;O<h.length;O+=1)m(v[O]);m(u.$$.fragment,T),m(p.$$.fragment,T),g=!0}},o(T){_(n.$$.fragment,T),v=v.filter(Boolean);for(let O=0;O<v.length;O+=1)_(v[O]);_(u.$$.fragment,T),_(p.$$.fragment,T),g=!1},d(T){T&&b(e),E(n),gt(v,T),T&&b(s),T&&b(o),E(u),E(p)}}}function Whe(r){let e,t;return e=new Nt({props:{title:"Edit Icon",confirmText:"Save",onConfirm:r[13],$$slots:{default:[Hhe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&262150&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function Ghe(r){let e,t,n={$$slots:{default:[Whe]},$$scope:{ctx:r}};return e=new kt({props:n}),r[14](e),e.$on("hide",r[4]),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){const s={};l&262150&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){r[14](null),E(e,i)}}}function Yhe(r,e,t){let n,i,{app:l}=e,s,o=["Apps","Actions","ConversionFunnel","App","Briefcase","Money","ShoppingCart","Form","Help","Monitoring","Sandbox","Project","Organisations","Magnify","Launch","Car","Camera","Bug","Channel","Calculator","Calendar","GraphDonut","GraphBarHorizontal","Demographic"];const a=()=>{s.show()},u=()=>{s.hide()},f=()=>{t(2,n=""),t(1,i=""),u()},c=k=>{t(1,i=k)},p=async()=>{try{await Lr.update(l.instance._id,{icon:{name:n,color:i}})}catch{we.error("Error updating app")}},d=k=>t(2,n=k);function g(k){i=k,t(1,i),t(7,l)}const h=k=>c(k.detail),v=()=>p();function y(k){K[k?"unshift":"push"](()=>{s=k,t(0,s)})}return r.$$set=k=>{"app"in k&&t(7,l=k.app)},r.$$.update=()=>{var k,I;r.$$.dirty&128&&t(2,n=((k=l==null?void 0:l.icon)==null?void 0:k.name)||"Apps"),r.$$.dirty&128&&t(1,i=(I=l==null?void 0:l.icon)==null?void 0:I.color)},[s,i,n,o,f,c,p,l,a,u,d,g,h,v,y]}class Jhe extends se{constructor(e){super();oe(this,e,Yhe,Ghe,ie,{app:7,show:8,hide:9})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[9]}}function Qhe(r){let e=r[0].name+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0].name+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Xhe(r){let e;return{c(){e=F("Never updated")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function Khe(r){let e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(r[0].updatedAt).getTime()})+"",t;return{c(){t=F(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=Cl("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(n[0].updatedAt).getTime()})+"")&&Oe(t,e)},d(n){n&&b(t)}}}function Zhe(r){let e;return{c(){e=F("Open")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function xhe(r){let e,t=r[0].lockedBy.email+"",n;return{c(){e=F("Locked by "),n=F(t)},m(i,l){$(i,e,l),$(i,n,l)},p(i,l){l&1&&t!==(t=i[0].lockedBy.email+"")&&Oe(n,t)},d(i){i&&b(e),i&&b(n)}}}function e0e(r){let e;return{c(){e=F("Locked by you")},m(t,n){$(t,e,n)},p:Ce,d(t){t&&b(e)}}}function t0e(r){let e;function t(l,s){return l[0].lockedYou?e0e:l[0].lockedOther?xhe:Zhe}let n=t(r),i=n(r);return{c(){i.c(),e=Ee()},m(l,s){i.m(l,s),$(l,e,s)},p(l,s){n===(n=t(l))&&i?i.p(l,s):(i.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function n0e(r){let e,t,n,i;return e=new ut({props:{name:"GlobeStrike",disabled:!0}}),{c(){S(e.$$.fragment),t=R(),n=j("span"),n.textContent="Unpublished",w(n,"class","disabled svelte-bp2uq1")},m(l,s){A(e,l,s),$(l,t,s),$(l,n,s),i=!0},i(l){i||(m(e.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),l&&b(n)}}}function r0e(r){let e,t,n;return e=new ut({props:{name:"Globe",disabled:!1}}),{c(){S(e.$$.fragment),t=F(`
1263
1263
  Published`)},m(i,l){A(e,i,l),$(i,t,l),n=!0},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){E(e,i),i&&b(t)}}}function i0e(r){let e,t;return e=new ot({props:{size:"S",secondary:!0,quiet:!0,$$slots:{default:[s0e]},$$scope:{ctx:r}}}),e.$on("click",r[13]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4194304&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function l0e(r){let e,t;return e=new ot({props:{size:"S",secondary:!0,quiet:!0,$$slots:{default:[o0e]},$$scope:{ctx:r}}}),e.$on("click",r[12]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4194304&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function s0e(r){let e;return{c(){e=F("Preview")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function o0e(r){let e;return{c(){e=F("View app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function a0e(r){let e;return{c(){e=F("Edit")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function J7(r){let e,t;return e=new Kt({props:{icon:"LockOpen",$$slots:{default:[u0e]},$$scope:{ctx:r}}}),e.$on("click",r[15]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4194304&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function u0e(r){let e;return{c(){e=F("Release lock")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function f0e(r){let e;return{c(){e=F("Export")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Q7(r){let e,t,n,i;return e=new Kt({props:{icon:"GlobeRemove",$$slots:{default:[c0e]},$$scope:{ctx:r}}}),e.$on("click",r[17]),n=new Kt({props:{icon:"Copy",$$slots:{default:[p0e]},$$scope:{ctx:r}}}),n.$on("click",r[18]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&4194304&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&4194304&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function c0e(r){let e;return{c(){e=F("Unpublish")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function p0e(r){let e;return{c(){e=F("Copy App ID")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function X7(r){let e,t,n,i;return e=new Kt({props:{icon:"Edit",$$slots:{default:[d0e]},$$scope:{ctx:r}}}),e.$on("click",r[19]),n=new Kt({props:{icon:"Delete",$$slots:{default:[m0e]},$$scope:{ctx:r}}}),n.$on("click",r[20]),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s&4194304&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&4194304&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function d0e(r){let e;return{c(){e=F("Edit")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function m0e(r){let e;return{c(){e=F("Delete")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function g0e(r){let e;return{c(){e=F("Edit icon")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function _0e(r){let e,t,n,i,l,s,o,a=r[0].lockedYou&&J7(r);t=new Kt({props:{icon:"Download",$$slots:{default:[f0e]},$$scope:{ctx:r}}}),t.$on("click",r[16]);let u=r[0].deployed&&Q7(r),f=!r[0].deployed&&X7(r);return s=new Kt({props:{icon:"Brush",$$slots:{default:[g0e]},$$scope:{ctx:r}}}),s.$on("click",r[21]),{c(){a&&a.c(),e=R(),S(t.$$.fragment),n=R(),u&&u.c(),i=R(),f&&f.c(),l=R(),S(s.$$.fragment)},m(c,p){a&&a.m(c,p),$(c,e,p),A(t,c,p),$(c,n,p),u&&u.m(c,p),$(c,i,p),f&&f.m(c,p),$(c,l,p),A(s,c,p),o=!0},p(c,p){c[0].lockedYou?a?(a.p(c,p),p&1&&m(a,1)):(a=J7(c),a.c(),m(a,1),a.m(e.parentNode,e)):a&&(ee(),_(a,1,1,()=>{a=null}),te());const d={};p&4194304&&(d.$$scope={dirty:p,ctx:c}),t.$set(d),c[0].deployed?u?(u.p(c,p),p&1&&m(u,1)):(u=Q7(c),u.c(),m(u,1),u.m(i.parentNode,i)):u&&(ee(),_(u,1,1,()=>{u=null}),te()),c[0].deployed?f&&(ee(),_(f,1,1,()=>{f=null}),te()):f?(f.p(c,p),p&1&&m(f,1)):(f=X7(c),f.c(),m(f,1),f.m(l.parentNode,l));const g={};p&4194304&&(g.$$scope={dirty:p,ctx:c}),s.$set(g)},i(c){o||(m(a),m(t.$$.fragment,c),m(u),m(f),m(s.$$.fragment,c),o=!0)},o(c){_(a),_(t.$$.fragment,c),_(u),_(f),_(s.$$.fragment,c),o=!1},d(c){a&&a.d(c),c&&b(e),E(t,c),c&&b(n),u&&u.d(c),c&&b(i),f&&f.d(c),c&&b(l),E(s,c)}}}function h0e(r){let e,t,n;return t=new ut({props:{hoverable:!0,name:"More"}}),{c(){e=j("span"),S(t.$$.fragment),w(e,"slot","control"),w(e,"class","app-row-actions-icon")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p:Ce,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function $0e(r){var Ie;let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,y,k,I,T,O,L,M,U,D,B,V,G,Q,H;i=new ut({props:{size:"XL",name:((Ie=r[0].icon)==null?void 0:Ie.name)||"Apps"}}),o=new _t({props:{size:"XS",$$slots:{default:[Qhe]},$$scope:{ctx:r}}});function q(ce,he){return ce[0].updatedAt?Khe:Xhe}let W=q(r),J=W(r);p=new u3({props:{positive:!r[0].lockedYou&&!r[0].lockedOther,notice:r[0].lockedYou,negative:r[0].lockedOther,$$slots:{default:[t0e]},$$scope:{ctx:r}}});const pe=[r0e,n0e],ne=[];function re(ce,he){return ce[0].deployed?0:1}v=re(r),y=ne[v]=pe[v](r);const Z=[l0e,i0e],$e=[];function Le(ce,he){return ce[0].deployed?0:1}return O=Le(r),L=$e[O]=Z[O](r),U=new ot({props:{size:"S",cta:!0,disabled:r[0].lockedOther,$$slots:{default:[a0e]},$$scope:{ctx:r}}}),U.$on("click",r[14]),B=new wr({props:{align:"right",dataCy:"app-row-actions-menu-popover",$$slots:{control:[h0e],default:[_0e]},$$scope:{ctx:r}}}),{c(){var ce;e=j("div"),t=j("div"),n=j("div"),S(i.$$.fragment),l=R(),s=j("div"),S(o.$$.fragment),a=R(),u=j("div"),J.c(),f=R(),c=j("div"),S(p.$$.fragment),d=R(),g=j("div"),h=j("div"),y.c(),k=R(),I=j("div"),T=j("div"),L.c(),M=R(),S(U.$$.fragment),D=R(),S(B.$$.fragment),w(n,"class","app-icon"),Lt(n,"color",((ce=r[0].icon)==null?void 0:ce.color)||""),w(s,"class","name svelte-bp2uq1"),Lt(t,"display","flex"),w(e,"class","title svelte-bp2uq1"),w(u,"class","desktop svelte-bp2uq1"),w(c,"class","desktop svelte-bp2uq1"),w(h,"class","app-status svelte-bp2uq1"),w(g,"class","desktop svelte-bp2uq1"),w(T,"class","app-row-actions svelte-bp2uq1"),w(I,"data-cy",V=`row_actions_${r[0].appId}`)},m(ce,he){$(ce,e,he),N(e,t),N(t,n),A(i,n,null),N(t,l),N(t,s),A(o,s,null),$(ce,a,he),$(ce,u,he),J.m(u,null),$(ce,f,he),$(ce,c,he),A(p,c,null),$(ce,d,he),$(ce,g,he),N(g,h),ne[v].m(h,null),$(ce,k,he),$(ce,I,he),N(I,T),$e[O].m(T,null),N(T,M),A(U,T,null),N(I,D),A(B,I,null),G=!0,Q||(H=Ne(s,"click",r[11]),Q=!0)},p(ce,[he]){var ye,He;const Pe={};he&1&&(Pe.name=((ye=ce[0].icon)==null?void 0:ye.name)||"Apps"),i.$set(Pe),(!G||he&1)&&Lt(n,"color",((He=ce[0].icon)==null?void 0:He.color)||"");const Fe={};he&4194305&&(Fe.$$scope={dirty:he,ctx:ce}),o.$set(Fe),W===(W=q(ce))&&J?J.p(ce,he):(J.d(1),J=W(ce),J&&(J.c(),J.m(u,null)));const ue={};he&1&&(ue.positive=!ce[0].lockedYou&&!ce[0].lockedOther),he&1&&(ue.notice=ce[0].lockedYou),he&1&&(ue.negative=ce[0].lockedOther),he&4194305&&(ue.$$scope={dirty:he,ctx:ce}),p.$set(ue);let Ue=v;v=re(ce),v!==Ue&&(ee(),_(ne[Ue],1,1,()=>{ne[Ue]=null}),te(),y=ne[v],y||(y=ne[v]=pe[v](ce),y.c()),m(y,1),y.m(h,null));let le=O;O=Le(ce),O===le?$e[O].p(ce,he):(ee(),_($e[le],1,1,()=>{$e[le]=null}),te(),L=$e[O],L?L.p(ce,he):(L=$e[O]=Z[O](ce),L.c()),m(L,1),L.m(T,M));const be={};he&1&&(be.disabled=ce[0].lockedOther),he&4194304&&(be.$$scope={dirty:he,ctx:ce}),U.$set(be);const Re={};he&4196275&&(Re.$$scope={dirty:he,ctx:ce}),B.$set(Re),(!G||he&1&&V!==(V=`row_actions_${ce[0].appId}`))&&w(I,"data-cy",V)},i(ce){G||(m(i.$$.fragment,ce),m(o.$$.fragment,ce),m(p.$$.fragment,ce),m(y),m(L),m(U.$$.fragment,ce),m(B.$$.fragment,ce),G=!0)},o(ce){_(i.$$.fragment,ce),_(o.$$.fragment,ce),_(p.$$.fragment,ce),_(y),_(L),_(U.$$.fragment,ce),_(B.$$.fragment,ce),G=!1},d(ce){ce&&b(e),E(i),E(o),ce&&b(a),ce&&b(u),J.d(),ce&&b(f),ce&&b(c),E(p),ce&&b(d),ce&&b(g),ne[v].d(),ce&&b(k),ce&&b(I),$e[O].d(),E(U),E(B),Q=!1,H()}}}function b0e(r,e,t){let{app:n}=e,{exportApp:i}=e,{viewApp:l}=e,{editApp:s}=e,{updateApp:o}=e,{deleteApp:a}=e,{previewApp:u}=e,{unpublishApp:f}=e,{releaseLock:c}=e,{editIcon:p}=e,{copyAppId:d}=e;const g=()=>s(n),h=()=>l(n),v=()=>u(n),y=()=>s(n),k=()=>c(n),I=()=>i(n),T=()=>f(n),O=()=>d(n),L=()=>o(n),M=()=>a(n),U=()=>p(n);return r.$$set=D=>{"app"in D&&t(0,n=D.app),"exportApp"in D&&t(1,i=D.exportApp),"viewApp"in D&&t(2,l=D.viewApp),"editApp"in D&&t(3,s=D.editApp),"updateApp"in D&&t(4,o=D.updateApp),"deleteApp"in D&&t(5,a=D.deleteApp),"previewApp"in D&&t(6,u=D.previewApp),"unpublishApp"in D&&t(7,f=D.unpublishApp),"releaseLock"in D&&t(8,c=D.releaseLock),"editIcon"in D&&t(9,p=D.editIcon),"copyAppId"in D&&t(10,d=D.copyAppId)},[n,i,l,s,o,a,u,f,c,p,d,g,h,v,y,k,I,T,O,L,M,U]}class v0e extends se{constructor(e){super();oe(this,e,b0e,$0e,ie,{app:0,exportApp:1,viewApp:2,editApp:3,updateApp:4,deleteApp:5,previewApp:6,unpublishApp:7,releaseLock:8,editIcon:9,copyAppId:10})}}function K7(r,e,t){const n=r.slice();return n[53]=e[t],n}function Z7(r){var L,M,U,D;let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,y;n=new Ve({props:{noPadding:!0,gap:"XS",$$slots:{default:[k0e]},$$scope:{ctx:r}}}),s=new ot({props:{dataCy:"create-app-btn",size:"M",icon:"Add",cta:!0,$$slots:{default:[C0e]},$$scope:{ctx:r}}}),s.$on("click",r[21]);let k=((L=r[3])==null?void 0:L.length)>0&&x7(r),I=!((M=r[3])==null?void 0:M.length)&&e9(r);c=new Ve({props:{gap:"S",justifyItems:"center",$$slots:{default:[E0e]},$$scope:{ctx:r}}}),d=new nn({props:{size:"S"}});let T=!((U=r[3])==null?void 0:U.length)&&((D=r[18])==null?void 0:D.length)&&t9(r),O=r[2].length&&n9(r);return{c(){e=j("div"),t=j("div"),S(n.$$.fragment),i=R(),l=j("div"),S(s.$$.fragment),o=R(),k&&k.c(),a=R(),I&&I.c(),u=R(),f=j("div"),S(c.$$.fragment),p=R(),S(d.$$.fragment),g=R(),T&&T.c(),h=R(),O&&O.c(),v=Ee(),w(l,"class","buttons svelte-1uwdxew"),w(t,"class","welcome svelte-1uwdxew"),w(e,"class","title svelte-1uwdxew")},m(B,V){$(B,e,V),N(e,t),A(n,t,null),N(t,i),N(t,l),A(s,l,null),N(l,o),k&&k.m(l,null),N(l,a),I&&I.m(l,null),N(e,u),N(e,f),A(c,f,null),N(e,p),A(d,e,null),$(B,g,V),T&&T.m(B,V),$(B,h,V),O&&O.m(B,V),$(B,v,V),y=!0},p(B,V){var q,W,J,pe;const G={};V[0]&196608|V[1]&33554432&&(G.$$scope={dirty:V,ctx:B}),n.$set(G);const Q={};V[0]&32768|V[1]&33554432&&(Q.$$scope={dirty:V,ctx:B}),s.$set(Q),((q=B[3])==null?void 0:q.length)>0?k?(k.p(B,V),V[0]&8&&m(k,1)):(k=x7(B),k.c(),m(k,1),k.m(l,a)):k&&(ee(),_(k,1,1,()=>{k=null}),te()),((W=B[3])==null?void 0:W.length)?I&&(ee(),_(I,1,1,()=>{I=null}),te()):I?(I.p(B,V),V[0]&8&&m(I,1)):(I=e9(B),I.c(),m(I,1),I.m(l,null));const H={};V[1]&33554432&&(H.$$scope={dirty:V,ctx:B}),c.$set(H),!((J=B[3])==null?void 0:J.length)&&((pe=B[18])==null?void 0:pe.length)?T?(T.p(B,V),V[0]&262152&&m(T,1)):(T=t9(B),T.c(),m(T,1),T.m(h.parentNode,h)):T&&(ee(),_(T,1,1,()=>{T=null}),te()),B[2].length?O?(O.p(B,V),V[0]&4&&m(O,1)):(O=n9(B),O.c(),m(O,1),O.m(v.parentNode,v)):O&&(ee(),_(O,1,1,()=>{O=null}),te())},i(B){y||(m(n.$$.fragment,B),m(s.$$.fragment,B),m(k),m(I),m(c.$$.fragment,B),m(d.$$.fragment,B),m(T),m(O),y=!0)},o(B){_(n.$$.fragment,B),_(s.$$.fragment,B),_(k),_(I),_(c.$$.fragment,B),_(d.$$.fragment,B),_(T),_(O),y=!1},d(B){B&&b(e),E(n),E(s),k&&k.d(),I&&I.d(),E(c),E(d),B&&b(g),T&&T.d(B),B&&b(h),O&&O.d(B),B&&b(v)}}}function w0e(r){let e;return{c(){e=F(r[17])},m(t,n){$(t,e,n)},p(t,n){n[0]&131072&&Oe(e,t[17])},d(t){t&&b(e)}}}function y0e(r){let e;return{c(){e=F(r[16])},m(t,n){$(t,e,n)},p(t,n){n[0]&65536&&Oe(e,t[16])},d(t){t&&b(e)}}}function k0e(r){let e,t,n,i;return e=new _t({props:{size:"L",$$slots:{default:[w0e]},$$scope:{ctx:r}}}),n=new Ye({props:{size:"M",$$slots:{default:[y0e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment)},m(l,s){A(e,l,s),$(l,t,s),A(n,l,s),i=!0},p(l,s){const o={};s[0]&131072|s[1]&33554432&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s[0]&65536|s[1]&33554432&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){E(e,l),l&&b(t),E(n,l)}}}function C0e(r){let e;return{c(){e=F(r[15])},m(t,n){$(t,e,n)},p(t,n){n[0]&32768&&Oe(e,t[15])},d(t){t&&b(e)}}}function x7(r){let e,t;return e=new ot({props:{icon:"Experience",size:"M",quiet:!0,secondary:!0,$$slots:{default:[S0e]},$$scope:{ctx:r}}}),e.$on("click",function(){ft(r[19]("/builder/portal/apps/templates"))&&r[19]("/builder/portal/apps/templates").apply(this,arguments)}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){r=n;const l={};i[1]&33554432&&(l.$$scope={dirty:i,ctx:r}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function S0e(r){let e;return{c(){e=F("Templates")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function e9(r){let e,t;return e=new ot({props:{dataCy:"import-app-btn",icon:"Import",size:"L",quiet:!0,secondary:!0,$$slots:{default:[A0e]},$$scope:{ctx:r}}}),e.$on("click",r[23]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&33554432&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function A0e(r){let e;return{c(){e=F("Import app")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function E0e(r){let e,t;return{c(){e=j("img"),w(e,"class","img-logo img-size svelte-1uwdxew"),w(e,"alt","logo"),pn(e.src,t=q1)||w(e,"src",t)},m(n,i){$(n,e,i)},p:Ce,d(n){n&&b(e)}}}function t9(r){let e,t;return e=new Y1({props:{templates:r[18]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&262144&&(l.templates=n[18]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function n9(r){let e,t;return e=new Ve({props:{noPadding:!0,gap:"S",$$slots:{default:[L0e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&16391|i[1]&33554432&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function O0e(r){let e;return{c(){e=F("Apps")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function r9(r){let e,t,n,i,l,s,o,a,u,f=r[20]&&T0e(r);function c(h){r[38](h)}let p={quiet:!0,autoWidth:!0,placeholder:null,options:[{label:"Sort by name",value:"name"},{label:"Sort by recently updated",value:"updated"},{label:"Sort by status",value:"status"}]};r[0]!==void 0&&(p.value=r[0]),i=new Qe({props:p}),K.push(()=>de(i,"value",c));function d(h){r[39](h)}let g={placeholder:"Search"};return r[1]!==void 0&&(g.value=r[1]),o=new Ff({props:g}),K.push(()=>de(o,"value",d)),{c(){e=j("div"),f&&f.c(),t=R(),n=j("div"),S(i.$$.fragment),s=R(),S(o.$$.fragment),w(n,"class","filter svelte-1uwdxew"),w(e,"class","app-actions svelte-1uwdxew")},m(h,v){$(h,e,v),f&&f.m(e,null),N(e,t),N(e,n),A(i,n,null),N(n,s),A(o,n,null),u=!0},p(h,v){h[20]&&f.p(h,v);const y={};!l&&v[0]&1&&(l=!0,y.value=h[0],me(()=>l=!1)),i.$set(y);const k={};!a&&v[0]&2&&(a=!0,k.value=h[1],me(()=>a=!1)),o.$set(k)},i(h){u||(m(f),m(i.$$.fragment,h),m(o.$$.fragment,h),u=!0)},o(h){_(f),_(i.$$.fragment,h),_(o.$$.fragment,h),u=!1},d(h){h&&b(e),f&&f.d(),E(i),E(o)}}}function T0e(r){let e,t;return e=new ot({props:{size:"M",icon:"Export",quiet:!0,secondary:!0,$$slots:{default:[I0e]},$$scope:{ctx:r}}}),e.$on("click",r[22]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&33554432&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function I0e(r){let e;return{c(){e=F("Export apps")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function i9(r,e){let t,n,i;return n=new v0e({props:{copyAppId:e[36],releaseLock:e[35],editIcon:e[28],app:e[53],unpublishApp:e[30],viewApp:e[25],editApp:e[27],exportApp:e[29],deleteApp:e[32],updateApp:e[34],previewApp:e[26]}}),{key:r,first:null,c(){t=Ee(),S(n.$$.fragment),this.first=t},m(l,s){$(l,t,s),A(n,l,s),i=!0},p(l,s){e=l;const o={};s[0]&16384&&(o.app=e[53]),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&b(t),E(n,l)}}}function L0e(r){let e,t,n,i,l,s=[],o=new Map,a;t=new Hr({props:{size:"L",$$slots:{default:[O0e]},$$scope:{ctx:r}}});let u=r[2].length>1&&r9(r),f=r[14];const c=p=>p[53].appId;for(let p=0;p<f.length;p+=1){let d=K7(r,f,p),g=c(d);o.set(g,s[p]=i9(g,d))}return{c(){e=j("div"),S(t.$$.fragment),n=R(),u&&u.c(),i=R(),l=j("div");for(let p=0;p<s.length;p+=1)s[p].c();w(e,"class","title svelte-1uwdxew"),w(l,"class","appTable svelte-1uwdxew")},m(p,d){$(p,e,d),A(t,e,null),N(e,n),u&&u.m(e,null),$(p,i,d),$(p,l,d);for(let g=0;g<s.length;g+=1)s[g].m(l,null);a=!0},p(p,d){const g={};d[1]&33554432&&(g.$$scope={dirty:d,ctx:p}),t.$set(g),p[2].length>1?u?(u.p(p,d),d[0]&4&&m(u,1)):(u=r9(p),u.c(),m(u,1),u.m(e,null)):u&&(ee(),_(u,1,1,()=>{u=null}),te()),d[0]&2113945600|d[1]&58&&(f=p[14],ee(),s=nr(s,d,c,1,p,f,o,l,jr,i9,null,K7),te())},i(p){if(!a){m(t.$$.fragment,p),m(u);for(let d=0;d<f.length;d+=1)m(s[d]);a=!0}},o(p){_(t.$$.fragment,p),_(u);for(let d=0;d<s.length;d+=1)_(s[d]);a=!1},d(p){p&&b(e),E(t),u&&u.d(),p&&b(i),p&&b(l);for(let d=0;d<s.length;d+=1)s[d].d()}}}function l9(r){let e,t,n,i,l,s,o,a;return o=new wv({props:{size:"10"}}),{c(){e=j("div"),t=j("img"),i=R(),l=j("p"),l.textContent="Creating your Budibase app from your selected template...",s=R(),S(o.$$.fragment),w(t,"class","img-logo img-size svelte-1uwdxew"),w(t,"alt","logo"),pn(t.src,n=q1)||w(t,"src",n),w(e,"class","empty-wrapper svelte-1uwdxew")},m(u,f){$(u,e,f),N(e,t),N(e,i),N(e,l),N(e,s),A(o,e,null),a=!0},p:Ce,i(u){a||(m(o.$$.fragment,u),a=!0)},o(u){_(o.$$.fragment,u),a=!1},d(u){u&&b(e),E(o)}}}function P0e(r){let e,t,n,i=r[11]&&Z7(r),l=r[13]&&l9();return{c(){i&&i.c(),e=R(),l&&l.c(),t=Ee()},m(s,o){i&&i.m(s,o),$(s,e,o),l&&l.m(s,o),$(s,t,o),n=!0},p(s,o){s[11]?i?(i.p(s,o),o[0]&2048&&m(i,1)):(i=Z7(s),i.c(),m(i,1),i.m(e.parentNode,e)):i&&(ee(),_(i,1,1,()=>{i=null}),te()),s[13]?l?(l.p(s,o),o[0]&8192&&m(l,1)):(l=l9(),l.c(),m(l,1),l.m(t.parentNode,t)):l&&(ee(),_(l,1,1,()=>{l=null}),te())},i(s){n||(m(i),m(l),n=!0)},o(s){_(i),_(l),n=!1},d(s){i&&i.d(s),s&&b(e),l&&l.d(s),s&&b(t)}}}function N0e(r){let e,t;return e=new Ve({props:{noPadding:!0,gap:"XL",$$slots:{default:[P0e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&1042447|i[1]&33554432&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function R0e(r){let e,t;return e=new G1({props:{template:r[4]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&16&&(l.template=n[4]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function M0e(r){let e,t;return e=new Uhe({props:{app:r[5]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&32&&(l.app=n[5]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function D0e(r){var d,g;let e,t,n=((d=r[5])==null?void 0:d.name)+"",i,l,s,o,a,u,f;function c(h){r[42](h)}let p={"data-cy":"delete-app-confirmation",placeholder:(g=r[5])==null?void 0:g.name};return r[12]!==void 0&&(p.value=r[12]),a=new nt({props:p}),K.push(()=>de(a,"value",c)),{c(){e=F("Are you sure you want to delete the app "),t=j("b"),i=F(n),l=F(`?
1264
1264
 
1265
1265
  `),s=j("p"),s.textContent="Please enter the app name below to confirm.",o=R(),S(a.$$.fragment)},m(h,v){$(h,e,v),$(h,t,v),N(t,i),$(h,l,v),$(h,s,v),$(h,o,v),A(a,h,v),f=!0},p(h,v){var k,I;(!f||v[0]&32)&&n!==(n=((k=h[5])==null?void 0:k.name)+"")&&Oe(i,n);const y={};v[0]&32&&(y.placeholder=(I=h[5])==null?void 0:I.name),!u&&v[0]&4096&&(u=!0,y.value=h[12],me(()=>u=!1)),a.$set(y)},i(h){f||(m(a.$$.fragment,h),f=!0)},o(h){_(a.$$.fragment,h),f=!1},d(h){h&&b(e),h&&b(t),h&&b(l),h&&b(s),h&&b(o),E(a,h)}}}function j0e(r){var s;let e,t,n=((s=r[5])==null?void 0:s.name)+"",i,l;return{c(){e=F("Are you sure you want to unpublish the app "),t=j("b"),i=F(n),l=F("?")},m(o,a){$(o,e,a),$(o,t,a),N(t,i),$(o,l,a)},p(o,a){var u;a[0]&32&&n!==(n=((u=o[5])==null?void 0:u.name)+"")&&Oe(i,n)},d(o){o&&b(e),o&&b(t),o&&b(l)}}}function B0e(r){var k;let e,t,n,i,l,s,o,a,u,f,c,p;e=new Ks({props:{wide:!0,$$slots:{default:[N0e]},$$scope:{ctx:r}}});let d={padding:!1,width:"600px",$$slots:{default:[R0e]},$$scope:{ctx:r}};n=new kt({props:d}),r[40](n),n.$on("hide",r[24]);let g={padding:!1,width:"600px",$$slots:{default:[M0e]},$$scope:{ctx:r}};l=new kt({props:g}),r[41](l);let h={title:"Confirm deletion",okText:"Delete app",onOk:r[33],onCancel:r[43],disabled:r[12]!==((k=r[5])==null?void 0:k.name),$$slots:{default:[D0e]},$$scope:{ctx:r}};o=new fr({props:h}),r[44](o);let v={title:"Confirm unpublish",okText:"Unpublish app",onOk:r[31],dataCy:"unpublish-modal",$$slots:{default:[j0e]},$$scope:{ctx:r}};u=new fr({props:v}),r[45](u);let y={app:r[5]};return c=new Jhe({props:y}),r[46](c),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment),a=R(),S(u.$$.fragment),f=R(),S(c.$$.fragment)},m(I,T){A(e,I,T),$(I,t,T),A(n,I,T),$(I,i,T),A(l,I,T),$(I,s,T),A(o,I,T),$(I,a,T),A(u,I,T),$(I,f,T),A(c,I,T),p=!0},p(I,T){var V;const O={};T[0]&1042447|T[1]&33554432&&(O.$$scope={dirty:T,ctx:I}),e.$set(O);const L={};T[0]&16|T[1]&33554432&&(L.$$scope={dirty:T,ctx:I}),n.$set(L);const M={};T[0]&32|T[1]&33554432&&(M.$$scope={dirty:T,ctx:I}),l.$set(M);const U={};T[0]&4096&&(U.onCancel=I[43]),T[0]&4128&&(U.disabled=I[12]!==((V=I[5])==null?void 0:V.name)),T[0]&4128|T[1]&33554432&&(U.$$scope={dirty:T,ctx:I}),o.$set(U);const D={};T[0]&32|T[1]&33554432&&(D.$$scope={dirty:T,ctx:I}),u.$set(D);const B={};T[0]&32&&(B.app=I[5]),c.$set(B)},i(I){p||(m(e.$$.fragment,I),m(n.$$.fragment,I),m(l.$$.fragment,I),m(o.$$.fragment,I),m(u.$$.fragment,I),m(c.$$.fragment,I),p=!0)},o(I){_(e.$$.fragment,I),_(n.$$.fragment,I),_(l.$$.fragment,I),_(o.$$.fragment,I),_(u.$$.fragment,I),_(c.$$.fragment,I),p=!1},d(I){E(e,I),I&&b(t),r[40](null),E(n,I),I&&b(i),r[41](null),E(l,I),I&&b(s),r[44](null),E(o,I),I&&b(a),r[45](null),E(u,I),I&&b(f),r[46](null),E(c,I)}}}function z0e(r,e,t){let n,i,l,s,o,a,u,f,c,p;fe(r,wo,qe=>t(18,a=qe)),fe(r,Ut,qe=>t(19,u=qe)),fe(r,Lr,qe=>t(3,f=qe)),fe(r,Ft,qe=>t(37,c=qe)),fe(r,Cn,qe=>t(48,p=qe));let d="name",g,h,v,y,k,I,T,O=(f==null?void 0:f.length)||(a==null?void 0:a.length),L="",M=p.cloud,U="",D=!1;const B=(qe,Se)=>{var Vt,Be;const xe=((Vt=qe==null?void 0:qe.user)==null?void 0:Vt.firstName)?`Welcome ${(Be=qe==null?void 0:qe.user)==null?void 0:Be.firstName}!`:"Welcome back!";return(Se==null?void 0:Se.length)?xe:"Let's create your first app!"},V=(qe,Se,xe)=>{const Vt=qe.map(Be=>lt(ke({},Be),{deployed:Be.status===Pa.DEPLOYED,lockedYou:Be.lockedBy&&Be.lockedBy.email===(Se==null?void 0:Se.email),lockedOther:Be.lockedBy&&Be.lockedBy.email!==(Se==null?void 0:Se.email)}));return xe==="status"?Vt.sort((Be,Ae)=>{var dt,Tt;return Be.status===Ae.status?((dt=Be.name)==null?void 0:dt.toLowerCase())<((Tt=Ae.name)==null?void 0:Tt.toLowerCase())?-1:1:Be.status===Pa.DEPLOYED?-1:1}):xe==="updated"?Vt.sort((Be,Ae)=>{const dt=Be.updatedAt||"9999",Tt=Ae.updatedAt||"9999";return dt<Tt?1:-1}):Vt.sort((Be,Ae)=>{var dt,Tt;return((dt=Be.name)==null?void 0:dt.toLowerCase())<((Tt=Ae.name)==null?void 0:Tt.toLowerCase())?-1:1})},G=()=>{(f==null?void 0:f.length)?u("/builder/portal/apps/create"):(t(4,g=null),v.show())},Q=()=>{try{w_("/api/cloud/export"),we.success("Apps exported successfully")}catch(qe){we.error(`Error exporting apps: ${qe}`)}},H=()=>{t(4,g={fromFile:!0}),v.show()},q=async()=>{try{let qe=g.key;const Se=f.filter(Ae=>{var dt;return(dt=Ae.name)==null?void 0:dt.startsWith(qe)});qe=`${qe}-${Se.length+1}`;let xe=new FormData;xe.append("name",qe),xe.append("useTemplate",!0),xe.append("templateKey",g.key);const Vt=await Ze.createApp(xe);Ln.captureEvent(Nn.APP.CREATED,{name:qe,appId:Vt.instance._id,template:g,fromTemplateMarketplace:!0});const Be=await Ze.fetchAppPackage(Vt.instance._id);await Ge.actions.initialise(Be),await Qt.actions.fetch(),await Cn.init(),await Ze.updateOwnMetadata({roleId:"BASIC"}),await Ft.setInitInfo({}),u(`/builder/app/${Vt.instance._id}`)}catch{we.error("Error creating app")}},W=()=>{t(4,g=null)},J=qe=>{Ln.captureEvent(Nn.APP.VIEW_PUBLISHED,{appId:qe.appId,eventSource:f1.PORTAL}),qe.url?window.open(`/app${qe.url}`):window.open(`/${qe.prodId}`)},pe=qe=>{window.open(`/${qe.devId}`)},ne=qe=>{if(qe.lockedOther){we.error(`App locked by ${qe.lockedBy.email}. Please allow lock to expire or have them unlock this app.`);return}u(`../../app/${qe.devId}`)},re=qe=>{t(5,h=qe),T.show()},Z=qe=>{const Se=qe.deployed?qe.prodId:qe.devId,xe=encodeURIComponent(qe.name);window.location=`/api/backups/export?appId=${Se}&appname=${xe}`},$e=qe=>{t(5,h=qe),I.show()},Le=async()=>{if(!!h)try{Ln.captureEvent(Nn.APP.UNPUBLISHED,{appId:h.appId}),await Ze.unpublishApp(h.prodId),await Lr.load(),we.success("App unpublished successfully")}catch{we.error("Error unpublishing app")}},Ie=qe=>{t(5,h=qe),k.show()},ce=async()=>{if(!!h){try{await Ze.deleteApp(h==null?void 0:h.devId),await Lr.load(),await Cn.init(),we.success("App deleted successfully")}catch{we.error("Error deleting app")}t(5,h=null),t(12,U=null)}},he=async qe=>{t(5,h=qe),y.show()},Pe=async qe=>{try{await Ze.releaseAppLock(qe.devId),await Lr.load(),we.success("Lock released successfully")}catch{we.error("Error releasing lock")}},Fe=async qe=>{await K_(qe.prodId),we.success("App ID copied to clipboard.")};function ue(qe){const Se=qe.split("/");Se.length===2&&Se[0]==="app"?(t(4,g={key:qe}),q()):we.error("Your Template URL is invalid. Please try another.")}qt(async()=>{try{await Lr.load(),await wo.load(),(a==null?void 0:a.length)===0&&we.error("There was a problem loading quick start templates.");const qe=await Ft.getInitInfo();if(qe==null?void 0:qe.init_template){t(13,D=!0),ue(qe.init_template);return}}catch{we.error("Error loading apps and templates")}t(11,O=!0)});function Ue(qe){d=qe,t(0,d)}function le(qe){L=qe,t(1,L)}function be(qe){K[qe?"unshift":"push"](()=>{v=qe,t(6,v)})}function Re(qe){K[qe?"unshift":"push"](()=>{y=qe,t(7,y)})}function ye(qe){U=qe,t(12,U)}const He=()=>t(12,U=null);function Ot(qe){K[qe?"unshift":"push"](()=>{k=qe,t(8,k)})}function Rt(qe){K[qe?"unshift":"push"](()=>{I=qe,t(9,I)})}function Pt(qe){K[qe?"unshift":"push"](()=>{T=qe,t(10,T)})}return r.$$.update=()=>{r.$$.dirty[0]&8|r.$$.dirty[1]&64&&t(17,n=B(c,f)),r.$$.dirty[0]&8&&t(16,i=(f==null?void 0:f.length)?"Manage your apps and get a head start with templates":"Start from scratch or get a head start with one of our templates"),r.$$.dirty[0]&8&&t(15,l=(f==null?void 0:f.length)?"Create new app":"Start from scratch"),r.$$.dirty[0]&9|r.$$.dirty[1]&64&&t(2,s=V(f,c.user,d)),r.$$.dirty[0]&6&&t(14,o=s.filter(qe=>{var Se;return(Se=qe==null?void 0:qe.name)==null?void 0:Se.toLowerCase().includes(L.toLowerCase())}))},[d,L,s,f,g,h,v,y,k,I,T,O,U,D,o,l,i,n,a,u,M,G,Q,H,W,J,pe,ne,re,Z,$e,Le,Ie,ce,he,Pe,Fe,c,Ue,le,be,Re,ye,He,Ot,Rt,Pt]}class q0e extends se{constructor(e){super();oe(this,e,z0e,B0e,ie,{},null,[-1,-1])}}function U0e(r){let e;return{c(){e=F("Back")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function s9(r){let e,t;return e=new Y1({props:{templates:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.templates=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function F0e(r){var o;let e,t,n,i,l;t=new ot({props:{quiet:!0,secondary:!0,icon:"ChevronLeft",$$slots:{default:[U0e]},$$scope:{ctx:r}}}),t.$on("click",r[3]);let s=r[0]&&((o=r[1])==null?void 0:o.length)&&s9(r);return{c(){e=j("span"),S(t.$$.fragment),n=R(),s&&s.c(),i=Ee()},m(a,u){$(a,e,u),A(t,e,null),$(a,n,u),s&&s.m(a,u),$(a,i,u),l=!0},p(a,u){var c;const f={};u&16&&(f.$$scope={dirty:u,ctx:a}),t.$set(f),a[0]&&((c=a[1])==null?void 0:c.length)?s?(s.p(a,u),u&3&&m(s,1)):(s=s9(a),s.c(),m(s,1),s.m(i.parentNode,i)):s&&(ee(),_(s,1,1,()=>{s=null}),te())},i(a){l||(m(t.$$.fragment,a),m(s),l=!0)},o(a){_(t.$$.fragment,a),_(s),l=!1},d(a){a&&b(e),E(t),a&&b(n),s&&s.d(a),a&&b(i)}}}function V0e(r){let e,t;return e=new Ve({props:{noPadding:!0,gap:"XL",$$slots:{default:[F0e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&23&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function H0e(r){let e,t;return e=new Ks({props:{wide:!0,$$slots:{default:[V0e]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&23&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function W0e(r,e,t){let n,i;fe(r,wo,o=>t(1,n=o)),fe(r,Ut,o=>t(2,i=o));let l=n==null?void 0:n.length;return qt(async()=>{try{await wo.load(),(n==null?void 0:n.length)===0&&we.error("There was a problem loading quick start templates.")}catch{we.error("Error loading apps and templates")}t(0,l=!0)}),[l,n,i,()=>{i("../")}]}class G0e extends se{constructor(e){super();oe(this,e,W0e,H0e,ie,{})}}function Y0e(r,e,t){let n;return fe(r,Kr,i=>t(0,n=i)),n("./apps"),[]}class J0e extends se{constructor(e){super();oe(this,e,Y0e,null,ie,{})}}function Q0e(r){let e,t,n,i,l,s,o,a,u;return{c(){e=_e("svg"),t=_e("g"),n=_e("path"),i=_e("path"),l=_e("path"),s=_e("path"),o=_e("defs"),a=_e("clipPath"),u=_e("rect"),w(n,"d",`M58.8037 109.043C64.0284 93.2355 74.1116 79.4822 87.615 69.7447C101.118
@@ -10,7 +10,7 @@
10
10
  href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/builder/assets/index.deb4ce04.js"></script>
13
+ <script type="module" crossorigin src="/builder/assets/index.40d2fb90.js"></script>
14
14
  <link rel="modulepreload" href="/builder/assets/vendor.5240f480.js">
15
15
  <link rel="stylesheet" href="/builder/assets/vendor.5e1fe644.css">
16
16
  <link rel="stylesheet" href="/builder/assets/index.bb5e3dfd.css">