@budibase/server 1.0.91-alpha.10 → 1.0.91-alpha.13
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.
- package/builder/assets/{index.aa487b9b.js → index.3873deb4.js} +7 -7
- package/builder/index.html +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/automations/utils.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/client.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/index.js.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/dist/package.json +5 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/scripts/dev/manage.js +2 -1
|
@@ -393,7 +393,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
393
393
|
name to confirm.`),l=R(),S(s.$$.fragment)},m(c,p){$(c,e,p),N(e,t),N(e,n),N(e,i),$(c,l,p),A(s,c,p),a=!0},p(c,p){const d={};!o&&p[0]&64&&(o=!0,d.value=c[6],pe(()=>o=!1)),s.$set(d)},i(c){a||(m(s.$$.fragment,c),a=!0)},o(c){_(s.$$.fragment,c),a=!1},d(c){c&&b(e),c&&b(l),E(s,c)}}}function yU(r){let e,t,n,i,l,s;e=new Dt({props:{title:r[20]?"Edit Column":"Create Column",confirmText:"Save Column",onConfirm:r[23],onCancel:r[24],disabled:r[16],$$slots:{footer:[bU],default:[hU]},$$scope:{ctx:r}}});let o={$$slots:{default:[vU]},$$scope:{ctx:r}};n=new Et({props:o}),r[54](n);let a={okText:"Delete Column",onOk:r[25],onCancel:r[33],title:"Confirm Deletion",disabled:r[6]!==r[20],$$slots:{default:[wU]},$$scope:{ctx:r}};return l=new hr({props:a}),r[56](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[0]&65536&&(c.disabled=u[16]),f[0]&65311|f[2]&64&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f[0]&1|f[2]&64&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f[0]&64&&(d.disabled=u[6]!==u[20]),f[0]&64|f[2]&64&&(d.$$scope={dirty:f,ctx:u}),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[54](null),E(n,u),u&&b(i),r[56](null),E(l,u)}}}const Ta="auto",kU=r=>r.name,CU=r=>r.type,SU=r=>r.name,AU=r=>r._id,EU=r=>r.name,OU=r=>r.value,TU=r=>r.label,IU=r=>r.value,LU=r=>r[1].name,PU=r=>r[0];function NU(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g;ue(r,Ot,Be=>t(35,g=Be));const h=jt.FORMULA.type,v=jt.LINK.type,k=jt.STRING.type,C=jt.NUMBER.type,I=jt.JSON.type,O=jt.DATETIME.type,T=ht(),P=["type","_id","_rev","tableId"],{hide:M}=Vs(yp.Modal);let F=vn.cloneDeep(jt),{field:j={type:"string",constraints:F.STRING.constraints,fieldName:g.selected.name}}=e,z=j.name;const q=z!=null;let H=g.selected.primaryDisplay==null||g.selected.primaryDisplay===j.name,Y=g.selected,U=[...g.selected.indexes||[]],W,G,Q,fe;async function Z(){j.type===Ta&&t(0,j=hv(g.draft.name,j.name,j.subtype)),j.type!==v&&delete j.fieldName;try{await Ot.saveField({originalName:z,field:j,primaryDisplay:H,indexes:U}),T("updatecolumns")}catch{we.error("Error saving column")}}function ee(){t(0,j.name=z,j)}function ae(){try{t(0,j.name=Q,j),j.name===g.selected.primaryDisplay?we.error("You cannot delete the display column"):(Ot.deleteField(j),we.success(`Column ${j.name} deleted.`),W.hide(),M(),G=!1,T("updatecolumns"))}catch{we.error("Error deleting column")}}function _e(Be){var sn;delete j.autocolumn,delete j.subtype,delete j.tableId,delete j.relationshipType,delete j.formulaType;const Mt=F[(sn=Be.detail)==null?void 0:sn.toUpperCase()];(Mt==null?void 0:Mt.constraints)&&t(0,j.constraints=Mt.constraints,j),j.type===v&&t(0,j.relationshipType=Lr.MANY_TO_MANY,j),j.type===h&&t(0,j.formulaType="dynamic",j)}function Re(Be){const Mt=Be.detail;t(0,j.constraints.presence=Mt?{allowEmpty:!1}:!1,j),t(10,n=Mt)}function $e(Be){Be.detail&&t(0,j.constraints.presence={allowEmpty:!1},j)}function be(Be){t(4,U=Be.detail?[j.name]:[])}function he(Be){Be.detail?t(4,U[1]=j.name,U):t(4,U=U.slice(0,1))}function Ne(){fe.show()}function Fe(){W.show(),G=!0}function se(){W.hide(),t(6,Q=""),G=!1}function Ce(Be){if(!Be||!Be.tableId)return null;const Mt=p==null?void 0:p.find(Ar=>Ar._id===Be.tableId);if(!Mt)return null;const sn=jl.exports.truncate(Y.name,{length:14}),Cn=jl.exports.truncate(Mt.name,{length:14});return[{name:`Many ${sn} rows \u2192 many ${Cn} rows`,alt:`Many ${Y.name} rows \u2192 many ${Mt.name} rows`,value:Lr.MANY_TO_MANY},{name:`One ${Cn} row \u2192 many ${sn} rows`,alt:`One ${Mt.name} rows \u2192 many ${Y.name} rows`,value:Lr.ONE_TO_MANY},{name:`One ${sn} row \u2192 many ${Cn} rows`,alt:`One ${Y.name} rows \u2192 many ${Mt.name} rows`,value:Lr.MANY_TO_ONE}]}function me(){return z&&h3.indexOf(j.type)!==-1?_3:z&&b3.indexOf(j.type)!==-1?$3:z&&w3.indexOf(j.type)!==-1?v3:c?[jt.STRING,jt.LONGFORM,jt.OPTIONS,jt.DATETIME,jt.NUMBER,jt.BOOLEAN,jt.ARRAY,jt.FORMULA,jt.LINK]:[...Object.values(F),{name:"Auto Column",type:Ta}]}function ke(Be){Be&&!Be.constraints&&(Be.constraints={}),Be.type===k&&!Be.constraints.length&&(Be.constraints.length={}),Be.type===C&&!Be.constraints.numericality&&(Be.constraints.numericality={}),Be.type===O&&!Be.constraints.datetime&&(Be.constraints.datetime={})}function ze(Be){function Mt(Cn,Ar,yi=null){return Object.keys((Cn==null?void 0:Cn.schema)||{}).some(Os=>Os!==yi&&Os===Ar)}const sn={};if(P.some(Cn=>Be.name===Cn)?sn.name=`${P.join(", ")} are not allowed as column names`:Mt(g.draft,Be.name,z)&&(sn.name="Column name already in use."),Be.fieldName&&Be.tableId){const Cn=g.list.find(Ar=>Ar._id===Be.tableId);Mt(Cn,Be.fieldName)&&(sn.relatedName=`Column name already in use in table ${Cn.name}`)}return sn}Gt(()=>{H&&t(0,j.constraints.presence={allowEmpty:!1},j)});function ye(Be){r.$$.not_equal(j.name,Be)&&(j.name=Be,t(0,j))}function Je(Be){r.$$.not_equal(j.type,Be)&&(j.type=Be,t(0,j))}function Nt(Be){H=Be,t(1,H)}function qe(Be){r.$$.not_equal(j.constraints.length.maximum,Be)&&(j.constraints.length.maximum=Be,t(0,j))}function pt(Be){r.$$.not_equal(j.constraints.inclusion,Be)&&(j.constraints.inclusion=Be,t(0,j))}function Rt(Be){r.$$.not_equal(j.useRichText,Be)&&(j.useRichText=Be,t(0,j))}function Ie(Be){r.$$.not_equal(j.constraints.inclusion,Be)&&(j.constraints.inclusion=Be,t(0,j))}function Ge(Be){r.$$.not_equal(j.constraints.datetime.earliest,Be)&&(j.constraints.datetime.earliest=Be,t(0,j))}function Ue(Be){r.$$.not_equal(j.constraints.datetime.latest,Be)&&(j.constraints.datetime.latest=Be,t(0,j))}function at(Be){r.$$.not_equal(j.constraints.numericality.greaterThanOrEqualTo,Be)&&(j.constraints.numericality.greaterThanOrEqualTo=Be,t(0,j))}function Le(Be){r.$$.not_equal(j.constraints.numericality.lessThanOrEqualTo,Be)&&(j.constraints.numericality.lessThanOrEqualTo=Be,t(0,j))}function Bt(Be){r.$$.not_equal(j.tableId,Be)&&(j.tableId=Be,t(0,j))}function gn(Be){r.$$.not_equal(j.relationshipType,Be)&&(j.relationshipType=Be,t(0,j))}function fn(Be){r.$$.not_equal(j.fieldName,Be)&&(j.fieldName=Be,t(0,j))}function on(Be){r.$$.not_equal(j.formulaType,Be)&&(j.formulaType=Be,t(0,j))}const $r=Be=>t(0,j.formula=Be.detail,j),In=Be=>t(0,j.subtype=Be.detail,j),ar=({detail:Be})=>{t(0,j.schema=Be.schema,j),t(0,j.json=Be.json,j)};function ir(Be){K[Be?"unshift":"push"](()=>{fe=Be,t(7,fe)})}function nl(Be){Q=Be,t(6,Q)}function Ve(Be){K[Be?"unshift":"push"](()=>{W=Be,t(5,W)})}return r.$$set=Be=>{"field"in Be&&t(0,j=Be.field)},r.$$.update=()=>{var Be,Mt;r.$$.dirty[0]&1&&ke(j),r.$$.dirty[0]&3&&t(10,n=!!((Be=j==null?void 0:j.constraints)==null?void 0:Be.presence)||H),r.$$.dirty[0]&1|r.$$.dirty[1]&16&&t(2,i=((Mt=g.selected)==null?void 0:Mt._id)===kl.USERS&&A3.includes(j.name)),r.$$.dirty[0]&1&&t(3,s=ze(j)),r.$$.dirty[0]&9&&t(16,l=!j.name||j.type===v&&!j.tableId||Object.keys(s).length!==0),r.$$.dirty[0]&1&&t(15,o=j.type!==v&&j.type!==I&&j.subtype!==Ri.CREATED_BY&&j.subtype!==Ri.UPDATED_BY&&j.type!==h),r.$$.dirty[0]&1&&t(14,a=j.type!==v&&j.type!==Ta&&j.type!==I),r.$$.dirty[0]&5&&t(13,u=j.type!==v&&!i&&j.type!==Ta),r.$$.dirty[0]&1&&t(12,f=Ce(j)),r.$$.dirty[1]&16&&t(9,p=g.list.filter(sn=>sn._id!==g.draft._id&&sn.type===Y.type&&Y.sourceId===sn.sourceId)),r.$$.dirty[0]&1&&t(11,d=!z||z&&y3.indexOf(j.type)!==-1)},t(8,c=Y.type==="external"),[j,H,i,s,U,W,Q,fe,c,p,n,d,f,u,a,o,l,h,v,I,z,q,Y,Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se,me,g,ye,Je,Nt,qe,pt,Rt,Ie,Ge,Ue,at,Le,Bt,gn,fn,on,$r,In,ar,ir,nl,Ve]}class Kv extends ie{constructor(e){super();le(this,e,NU,yU,re,{field:0},null,[-1,-1,-1])}}function RU(r){let e;return{c(){e=V(r[0])},m(t,n){$(t,e,n)},p(t,[n]){n&1&&Te(e,t[0])},i:Oe,o:Oe,d(t){t&&b(e)}}}function MU(r,e,t){let n,i,l;ue(r,Zi,o=>t(3,l=o));let{value:s}=e;return r.$$set=o=>{"value"in o&&t(1,s=o.value)},r.$$.update=()=>{var o;r.$$.dirty&10&&t(2,n=l.find(a=>a._id===s)),r.$$.dirty&4&&t(0,i=(o=n==null?void 0:n.name)!=null?o:"Unknown role")},[i,s,n,l]}class DU extends ie{constructor(e){super();le(this,e,MU,RU,re,{value:1})}}function Zv(r){let e,t,n,i;t=new Ct({props:{size:"S",$$slots:{default:[jU]},$$scope:{ctx:r}}});let l=r[5]&&xv();return{c(){e=D("div"),S(t.$$.fragment),n=R(),l&&l.c(),w(e,"class","table-title svelte-8mw47k")},m(s,o){$(s,e,o),A(t,e,null),N(e,n),l&&l.m(e,null),i=!0},p(s,o){const a={};o[0]&8|o[1]&4&&(a.$$scope={dirty:o,ctx:s}),t.$set(a),s[5]?l?o[0]&32&&m(l,1):(l=xv(),l.c(),m(l,1),l.m(e,null)):l&&(te(),_(l,1,1,()=>{l=null}),ne())},i(s){i||(m(t.$$.fragment,s),m(l),i=!0)},o(s){_(t.$$.fragment,s),_(l),i=!1},d(s){s&&b(e),E(t),l&&l.d()}}}function jU(r){let e;return{c(){e=V(r[3])},m(t,n){$(t,e,n)},p(t,n){n[0]&8&&Te(e,t[3])},d(t){t&&b(e)}}}function xv(r){let e,t,n,i;return t=new lv({props:{size:"10"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","svelte-8mw47k")},m(l,s){$(l,e,s),A(t,e,null),i=!0},i(l){i||(m(t.$$.fragment,l),l&&fi(()=>{n||(n=Dr(e,jo,{},!0)),n.run(1)}),i=!0)},o(l){_(t.$$.fragment,l),l&&(n||(n=Dr(e,jo,{},!1)),n.run(0)),i=!1},d(l){l&&b(e),E(t),l&&n&&n.end()}}}function e4(r){let e,t;return e=new $z({props:{selectedRows:r[10],deleteRows:r[18]}}),e.$on("updaterows",r[23]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&1024&&(l.selectedRows=n[10]),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 t4(r){let e,t,n,i;function l(o){r[24](o)}let s={data:r[1],schema:r[0],loading:r[5],customRenderers:r[15],rowCount:r[7],disableSorting:r[8],allowSelectRows:r[4]&&!r[9],allowEditRows:r[4],allowEditColumns:r[4],showAutoColumns:!r[6]};return r[10]!==void 0&&(s.selectedRows=r[10]),t=new Ni({props:s}),K.push(()=>ce(t,"selectedRows",l)),t.$on("editcolumn",r[25]),t.$on("editrow",r[26]),t.$on("clickrelationship",r[27]),t.$on("sort",r[28]),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","table-wrapper svelte-8mw47k")},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,a){const u={};a[0]&2&&(u.data=o[1]),a[0]&1&&(u.schema=o[0]),a[0]&32&&(u.loading=o[5]),a[0]&32768&&(u.customRenderers=o[15]),a[0]&128&&(u.rowCount=o[7]),a[0]&256&&(u.disableSorting=o[8]),a[0]&528&&(u.allowSelectRows=o[4]&&!o[9]),a[0]&16&&(u.allowEditRows=o[4]),a[0]&16&&(u.allowEditColumns=o[4]),a[0]&64&&(u.showAutoColumns=!o[6]),!n&&a[0]&1024&&(n=!0,u.selectedRows=o[10],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function BU(r){let e,t,n,i,l,s=r[2],o,a,u=r[3]&&Zv(r);const f=r[22].default,c=bt(f,r,r[33],null);let p=!r[9]&&r[10].length>0&&e4(r),d=t4(r);return{c(){e=D("div"),u&&u.c(),t=R(),n=D("div"),c&&c.c(),i=R(),p&&p.c(),l=R(),d.c(),o=Ee(),w(n,"class","popovers svelte-8mw47k")},m(g,h){$(g,e,h),u&&u.m(e,null),N(e,t),N(e,n),c&&c.m(n,null),N(n,i),p&&p.m(n,null),$(g,l,h),d.m(g,h),$(g,o,h),a=!0},p(g,h){g[3]?u?(u.p(g,h),h[0]&8&&m(u,1)):(u=Zv(g),u.c(),m(u,1),u.m(e,t)):u&&(te(),_(u,1,1,()=>{u=null}),ne()),c&&c.p&&(!a||h[1]&4)&&vt(c,f,g,g[33],a?yt(f,g[33],h,null):wt(g[33]),null),!g[9]&&g[10].length>0?p?(p.p(g,h),h[0]&1536&&m(p,1)):(p=e4(g),p.c(),m(p,1),p.m(n,null)):p&&(te(),_(p,1,1,()=>{p=null}),ne()),h[0]&4&&re(s,s=g[2])?(te(),_(d,1,1,Oe),ne(),d=t4(g),d.c(),m(d),d.m(o.parentNode,o)):d.p(g,h)},i(g){a||(m(u),m(c,g),m(p),m(d),a=!0)},o(g){_(u),_(c,g),_(p),_(d),a=!1},d(g){g&&b(e),u&&u.d(),c&&c.d(g),p&&p.d(),g&&b(l),g&&b(o),d.d(g)}}}function zU(r){let e,t,n;var i=r[16];function l(s){return{props:{row:s[12]}}}return i&&(e=new i(l(r)),e.$on("updaterows",r[29])),{c(){e&&S(e.$$.fragment),t=Ee()},m(s,o){e&&A(e,s,o),$(s,t,o),n=!0},p(s,o){const a={};if(o[0]&4096&&(a.row=s[12]),i!==(i=s[16])){if(e){te();const u=e;_(u.$$.fragment,1,0,()=>{E(u,1)}),ne()}i?(e=new i(l(s)),e.$on("updaterows",s[29]),S(e.$$.fragment),m(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(a)},i(s){n||(e&&m(e.$$.fragment,s),n=!0)},o(s){e&&_(e.$$.fragment,s),n=!1},d(s){s&&b(t),e&&E(e,s)}}}function qU(r){let e,t;return e=new Kv({props:{field:r[11],onClosed:r[14].hide}}),e.$on("updatecolumns",r[31]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&2048&&(l.field=n[11]),i[0]&16384&&(l.onClosed=n[14].hide),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 UU(r){let e,t,n,i,l,s;e=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[BU]},$$scope:{ctx:r}}});let o={$$slots:{default:[zU]},$$scope:{ctx:r}};n=new Et({props:o}),r[30](n);let a={$$slots:{default:[qU]},$$scope:{ctx:r}};return l=new Et({props:a}),r[32](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[0]&34811|f[1]&4&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f[0]&69632|f[1]&4&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f[0]&18432|f[1]&4&&(d.$$scope={dirty:f,ctx:u}),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[30](null),E(n,u),u&&b(i),r[32](null),E(l,u)}}}function FU(r,e,t){let n,i,l,s;ue(r,er,$e=>t(35,l=$e)),ue(r,qt,$e=>t(36,s=$e));let{$$slots:o={},$$scope:a}=e,{schema:u={}}=e,{data:f=[]}=e,{tableId:c}=e,{title:p}=e,{allowEditing:d=!1}=e,{loading:g=!1}=e,{hideAutocolumns:h}=e,{rowCount:v}=e,{type:k}=e,{disableSorting:C=!1}=e,I=[],O,T,P,M,F=[];const j=()=>{t(10,I=[])},z=({tableId:$e,rowId:be,fieldName:he})=>{s(`/builder/app/${l.application}/data/table/${$e}/relationship/${be}/${he}`)},q=async()=>{try{await xe.deleteRows({tableId:c,rows:I}),t(1,f=f.filter($e=>!I.includes($e))),we.success(`Successfully deleted ${I.length} rows`),t(10,I=[])}catch{we.error("Error deleting rows")}},H=$e=>{t(12,T=$e),$e&&P.show()},Y=$e=>{t(11,O=u==null?void 0:u[$e]),O&&M.show()};function U($e){ft.call(this,r,$e)}function W($e){I=$e,t(10,I)}const G=$e=>Y($e.detail),Q=$e=>H($e.detail),fe=$e=>z($e.detail);function Z($e){ft.call(this,r,$e)}function ee($e){ft.call(this,r,$e)}function ae($e){K[$e?"unshift":"push"](()=>{P=$e,t(13,P)})}function _e($e){ft.call(this,r,$e)}function Re($e){K[$e?"unshift":"push"](()=>{M=$e,t(14,M)})}return r.$$set=$e=>{"schema"in $e&&t(0,u=$e.schema),"data"in $e&&t(1,f=$e.data),"tableId"in $e&&t(2,c=$e.tableId),"title"in $e&&t(3,p=$e.title),"allowEditing"in $e&&t(4,d=$e.allowEditing),"loading"in $e&&t(5,g=$e.loading),"hideAutocolumns"in $e&&t(6,h=$e.hideAutocolumns),"rowCount"in $e&&t(7,v=$e.rowCount),"type"in $e&&t(21,k=$e.type),"disableSorting"in $e&&t(8,C=$e.disableSorting),"$$scope"in $e&&t(33,a=$e.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&2097152,r.$$.dirty[0]&4&&t(9,n=c===kl.USERS),r.$$.dirty[0]&2&&f&&j(),r.$$.dirty[0]&512&&t(16,i=n?nq:_1),r.$$.dirty[0]&513&&n&&(t(15,F=[{column:"roleId",component:DU}]),A3.forEach($e=>{u[$e]&&t(0,u[$e].editable=!1,u)}),u.email&&t(0,u.email.displayName="Email",u),u.roleId&&t(0,u.roleId.displayName="Role",u),u.firstName&&t(0,u.firstName.displayName="First Name",u),u.lastName&&t(0,u.lastName.displayName="Last Name",u),u.status&&t(0,u.status.displayName="Status",u)),r.$$.dirty[0]&1&&Ij.forEach($e=>{Object.values(u||{}).forEach(be=>{be.type===$e&&(be.sortable=!1)})})},[u,f,c,p,d,g,h,v,C,n,I,O,T,P,M,F,i,z,q,H,Y,k,o,U,W,G,Q,fe,Z,ee,ae,_e,Re,a]}class Xf extends ie{constructor(e){super();le(this,e,FU,UU,re,{schema:0,data:1,tableId:2,title:3,allowEditing:4,loading:5,hideAutocolumns:6,rowCount:7,type:21,disableSorting:8},null,[-1,-1])}}function VU(r){let e,t,n;return t=new Xf({props:{schema:r[0].schema,data:r[1],loading:HU,type:WU,rowCount:5}}),{c(){e=R(),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,i,l),n=!0},p(i,[l]){const s={};l&1&&(s.schema=i[0].schema),l&2&&(s.data=i[1]),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,i)}}}let HU=!1,WU="external";function GU(r,e,t){let{query:n={}}=e,{data:i=[]}=e;return r.$$set=l=>{"query"in l&&t(0,n=l.query),"data"in l&&t(1,i=l.data)},[n,i]}class YU extends ie{constructor(e){super();le(this,e,GU,VU,re,{query:0,data:1})}}function JU(r){let e,t,n;function i(s){r[5](s)}let l={bindings:r[3],value:r[1],allowJS:r[2]};return r[0]!==void 0&&(l.valid=r[0]),e=new zv({props:l}),K.push(()=>ce(e,"valid",i)),e.$on("change",r[6]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};o&8&&(a.bindings=s[3]),o&2&&(a.value=s[1]),o&4&&(a.allowJS=s[2]),!t&&o&1&&(t=!0,a.valid=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function QU(r,e,t){let n,{bindings:i=[]}=e,{valid:l}=e,{value:s=""}=e,{allowJS:o=!1}=e;const a=c=>(c==null?void 0:c.length)?c==null?void 0:c.map(p=>lt(Se({},p),{category:"Bindable Values",type:null})):c;function u(c){l=c,t(0,l)}function f(c){ft.call(this,r,c)}return r.$$set=c=>{"bindings"in c&&t(4,i=c.bindings),"valid"in c&&t(0,l=c.valid),"value"in c&&t(1,s=c.value),"allowJS"in c&&t(2,o=c.allowJS)},r.$$.update=()=>{r.$$.dirty&16&&t(3,n=a(i))},[l,s,o,n,i,u,f]}class b1 extends ie{constructor(e){super();le(this,e,QU,JU,re,{bindings:4,valid:0,value:1,allowJS:2})}}function n4(r){let e,t,n,i,l;return t=new ct({props:{size:"S",name:"FlashOn"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","icon svelte-14cium")},m(s,o){$(s,e,o),A(t,e,null),n=!0,i||(l=Pe(e,"click",function(){mt(r[9].show)&&r[9].show.apply(this,arguments)}),i=!0)},p(s,o){r=s},i(s){n||(m(t.$$.fragment,s),n=!0)},o(s){_(t.$$.fragment,s),n=!1},d(s){s&&b(e),E(t),i=!1,l()}}}function XU(r){let e;return{c(){e=V("Add the objects on the left to enrich your text.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function KU(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ZU(r){let e,t;return e=new gt({props:{cta:!0,slot:"buttons",disabled:!r[10],$$slots:{default:[KU]},$$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&1024&&(l.disabled=!n[10]),i&2097152&&(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 xU(r){let e,t,n,i;function l(a){r[17](a)}var s=r[0];function o(a){let u={slot:"body",value:a[8],bindings:a[1],allowJS:a[7]};return a[10]!==void 0&&(u.valid=a[10]),{props:u}}return s&&(e=new s(o(r)),K.push(()=>ce(e,"valid",l)),e.$on("change",r[18])),{c(){e&&S(e.$$.fragment),n=Ee()},m(a,u){e&&A(e,a,u),$(a,n,u),i=!0},p(a,u){const f={};if(u&256&&(f.value=a[8]),u&2&&(f.bindings=a[1]),u&128&&(f.allowJS=a[7]),!t&&u&1024&&(t=!0,f.valid=a[10],pe(()=>t=!1)),s!==(s=a[0])){if(e){te();const c=e;_(c.$$.fragment,1,0,()=>{E(c,1)}),ne()}s?(e=new s(o(a)),K.push(()=>ce(e,"valid",l)),e.$on("change",a[18]),S(e.$$.fragment),m(e.$$.fragment,1),A(e,n.parentNode,n)):e=null}else s&&e.$set(f)},i(a){i||(e&&m(e.$$.fragment,a),i=!0)},o(a){e&&_(e.$$.fragment,a),i=!1},d(a){a&&b(n),e&&E(e,a)}}}function eF(r){let e,t,n,i,l,s;t=new tt({props:{label:r[4],disabled:r[5],readonly:r[12],value:r[12]?"(JavaScript function)":r[8],placeholder:r[3]}}),t.$on("change",r[16]);let o=!r[5]&&n4(r),a={fillWidth:r[6],title:r[2],$$slots:{body:[xU],buttons:[ZU],description:[XU]},$$scope:{ctx:r}};return l=new Kr({props:a}),r[19](l),{c(){e=D("div"),S(t.$$.fragment),n=R(),o&&o.c(),i=R(),S(l.$$.fragment),w(e,"class","control svelte-14cium")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),o&&o.m(e,null),$(u,i,f),A(l,u,f),s=!0},p(u,[f]){const c={};f&16&&(c.label=u[4]),f&32&&(c.disabled=u[5]),f&4096&&(c.readonly=u[12]),f&4352&&(c.value=u[12]?"(JavaScript function)":u[8]),f&8&&(c.placeholder=u[3]),t.$set(c),u[5]?o&&(te(),_(o,1,1,()=>{o=null}),ne()):o?(o.p(u,f),f&32&&m(o,1)):(o=n4(u),o.c(),m(o,1),o.m(e,null));const p={};f&64&&(p.fillWidth=u[6]),f&4&&(p.title=u[2]),f&2100611&&(p.$$scope={dirty:f,ctx:u}),l.$set(p)},i(u){s||(m(t.$$.fragment,u),m(o),m(l.$$.fragment,u),s=!0)},o(u){_(t.$$.fragment,u),_(o),_(l.$$.fragment,u),s=!1},d(u){u&&b(e),E(t),o&&o.d(),u&&b(i),r[19](null),E(l,u)}}}function tF(r,e,t){let n,i,l,{panel:s=b1}=e,{value:o=""}=e,{bindings:a=[]}=e,{title:u="Bindings"}=e,{placeholder:f}=e,{label:c}=e,{disabled:p=!1}=e,{fillWidth:d}=e,{allowJS:g=!0}=e;const h=ht();let v,k=!0;const C=()=>{I(i),v.hide()},I=F=>{h("change",Ss(a,F))},O=F=>I(F.detail);function T(F){k=F,t(10,k)}const P=F=>t(11,i=F.detail);function M(F){K[F?"unshift":"push"](()=>{v=F,t(9,v)})}return r.$$set=F=>{"panel"in F&&t(0,s=F.panel),"value"in F&&t(15,o=F.value),"bindings"in F&&t(1,a=F.bindings),"title"in F&&t(2,u=F.title),"placeholder"in F&&t(3,f=F.placeholder),"label"in F&&t(4,c=F.label),"disabled"in F&&t(5,p=F.disabled),"fillWidth"in F&&t(6,d=F.fillWidth),"allowJS"in F&&t(7,g=F.allowJS)},r.$$.update=()=>{r.$$.dirty&32770&&t(8,n=_o(a,o)),r.$$.dirty&256&&t(11,i=n),r.$$.dirty&32768&&t(12,l=Rf(o))},[s,a,u,f,c,p,d,g,n,v,k,i,l,C,I,o,O,T,P,M]}class Un extends ie{constructor(e){super();le(this,e,tF,eF,re,{panel:0,value:15,bindings:1,title:2,placeholder:3,label:4,disabled:5,fillWidth:6,allowJS:7})}}function r4(r,e,t){const n=r.slice();return n[11]=e[t],n[12]=e,n[13]=t,n}function nF(r){let e;return{c(){e=V("Bindings")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function i4(r){let e,t;return e=new gt({props:{secondary:!0,$$slots:{default:[rF]},$$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&16384&&(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 rF(r){let e;return{c(){e=V("Add Binding")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function iF(r){let e;return{c(){e=V(`Enter a value for each binding. The default values will be used for any
|
|
394
394
|
values left blank.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function lF(r){let e;return{c(){e=V(`Bindings come in two parts: the binding name, and a default/fallback
|
|
395
395
|
value. These bindings can be used as Handlebars expressions throughout the
|
|
396
|
-
query.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function sF(r){let e;function t(l,s){return l[2]?iF:lF}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.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function oF(r){let e,t;function n(){return r[10](r[13])}return e=new ct({props:{hoverable:!0,name:"Close"}}),e.$on("click",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}function aF(r){var i;let e,t;function n(...l){return r[9](r[11],...l)}return e=new Un({props:{title:`Query binding "${r[11].name}"`,placeholder:"Value",thin:!0,value:_o(r[3],(i=r[1])==null?void 0:i[r[11].name]),bindings:r[3]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(l,s){A(e,l,s),t=!0},p(l,s){var a;r=l;const o={};s&1&&(o.title=`Query binding "${r[11].name}"`),s&11&&(o.value=_o(r[3],(a=r[1])==null?void 0:a[r[11].name])),s&8&&(o.bindings=r[3]),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function l4(r){let e,t,n,i,l,s,o,a,u,f;function c(C){r[7](C,r[11])}let p={placeholder:"Binding Name",thin:!0,disabled:r[2]};r[11].name!==void 0&&(p.value=r[11].name),e=new tt({props:p}),K.push(()=>ce(e,"value",c));function d(C){r[8](C,r[11])}let g={placeholder:"Default",thin:!0,disabled:r[2]};r[11].default!==void 0&&(g.value=r[11].default),i=new tt({props:g}),K.push(()=>ce(i,"value",d));const h=[aF,oF],v=[];function k(C,I){return C[2]?0:1}return o=k(r),a=v[o]=h[o](r),{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment),s=R(),a.c(),u=Ee()},m(C,I){A(e,C,I),$(C,n,I),A(i,C,I),$(C,s,I),v[o].m(C,I),$(C,u,I),f=!0},p(C,I){r=C;const O={};I&4&&(O.disabled=r[2]),!t&&I&1&&(t=!0,O.value=r[11].name,pe(()=>t=!1)),e.$set(O);const T={};I&4&&(T.disabled=r[2]),!l&&I&1&&(l=!0,T.value=r[11].default,pe(()=>l=!1)),i.$set(T);let P=o;o=k(r),o===P?v[o].p(r,I):(te(),_(v[P],1,1,()=>{v[P]=null}),ne(),a=v[o],a?a.p(r,I):(a=v[o]=h[o](r),a.c()),m(a,1),a.m(u.parentNode,u))},i(C){f||(m(e.$$.fragment,C),m(i.$$.fragment,C),m(a),f=!0)},o(C){_(e.$$.fragment,C),_(i.$$.fragment,C),_(a),f=!1},d(C){E(e,C),C&&b(n),E(i,C),C&&b(s),v[o].d(C),C&&b(u)}}}function uF(r){let e,t,n,i,l,s,o,a;t=new Ct({props:{size:"XS",$$slots:{default:[nF]},$$scope:{ctx:r}}});let u=!r[2]&&i4(r);l=new Ke({props:{size:"S",$$slots:{default:[sF]},$$scope:{ctx:r}}});let f=r[0],c=[];for(let d=0;d<f.length;d+=1)c[d]=l4(r4(r,f,d));const p=d=>_(c[d],1,1,()=>{c[d]=null});return{c(){e=D("div"),S(t.$$.fragment),n=R(),u&&u.c(),i=R(),S(l.$$.fragment),s=R(),o=D("div");for(let d=0;d<c.length;d+=1)c[d].c();w(e,"class","controls svelte-bpqao2"),oe(e,"height",!r[2]),w(o,"class","bindings svelte-bpqao2"),oe(o,"bindable",r[2])},m(d,g){$(d,e,g),A(t,e,null),N(e,n),u&&u.m(e,null),$(d,i,g),A(l,d,g),$(d,s,g),$(d,o,g);for(let h=0;h<c.length;h+=1)c[h].m(o,null);a=!0},p(d,g){const h={};g&16384&&(h.$$scope={dirty:g,ctx:d}),t.$set(h),d[2]?u&&(te(),_(u,1,1,()=>{u=null}),ne()):u?(u.p(d,g),g&4&&m(u,1)):(u=i4(d),u.c(),m(u,1),u.m(e,null)),g&4&&oe(e,"height",!d[2]);const v={};if(g&16388&&(v.$$scope={dirty:g,ctx:d}),l.$set(v),g&111){f=d[0];let k;for(k=0;k<f.length;k+=1){const C=r4(d,f,k);c[k]?(c[k].p(C,g),m(c[k],1)):(c[k]=l4(C),c[k].c(),m(c[k],1),c[k].m(o,null))}for(te(),k=f.length;k<c.length;k+=1)p(k);ne()}g&4&&oe(o,"bindable",d[2])},i(d){if(!a){m(t.$$.fragment,d),m(u),m(l.$$.fragment,d);for(let g=0;g<f.length;g+=1)m(c[g]);a=!0}},o(d){_(t.$$.fragment,d),_(u),_(l.$$.fragment,d),c=c.filter(Boolean);for(let g=0;g<c.length;g+=1)_(c[g]);a=!1},d(d){d&&b(e),E(t),u&&u.d(),d&&b(i),E(l,d),d&&b(s),d&&b(o),$t(c,d)}}}function fF(r){let e,t;return e=new Qe({props:{noPadding:r[2],gap:"S",$$slots:{default:[uF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&4&&(l.noPadding=n[2]),i&16399&&(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 cF(r,e,t){let{bindable:n=!0}=e,{queryBindings:i=[]}=e,{bindings:l=[]}=e,{customParams:s={}}=e;function o(){t(0,i=[...i,{}])}function a(g){i.splice(g,1),t(0,i)}function u(g,h){t(1,s[g]=Ss(l,h),s)}function f(g,h){r.$$.not_equal(h.name,g)&&(h.name=g,t(0,i))}function c(g,h){r.$$.not_equal(h.default,g)&&(h.default=g,t(0,i))}const p=(g,h)=>u(g.name,h.detail),d=g=>a(g);return r.$$set=g=>{"bindable"in g&&t(2,n=g.bindable),"queryBindings"in g&&t(0,i=g.queryBindings),"bindings"in g&&t(3,l=g.bindings),"customParams"in g&&t(1,s=g.customParams)},[i,s,n,l,o,a,u,f,c,p,d]}class v1 extends ie{constructor(e){super();le(this,e,cF,fF,re,{bindable:2,queryBindings:0,bindings:3,customParams:1})}}function pF(r){let e,t;return e=new pi({props:{disabled:!0,value:r[2],height:r[0],minHeight:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&4&&(l.value=n[2]),i&1&&(l.height=n[0]),i&2&&(l.minHeight=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 dF(r,e,t){let n,{data:i}=e,{height:l}=e,{minHeight:s="120"}=e;return r.$$set=o=>{"data"in o&&t(3,i=o.data),"height"in o&&t(0,l=o.height),"minHeight"in o&&t(1,s=o.minHeight)},r.$$.update=()=>{r.$$.dirty&8&&t(2,n=JSON.stringify(i||{},null,2))},[l,s,n,i]}class s4 extends ie{constructor(e){super();le(this,e,dF,pF,re,{data:3,height:0,minHeight:1})}}function o4(r){const e={};if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e[t]=(n==null?void 0:n.type)||"string";return e}function a4(r){const e={};if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e[t]={name:t,type:n};return e}function mF(r){if(!r)return{};r.includes("?")&&(r=r.split("?")[1]);const e=r.split("&");let t={};for(let n of e){const i=n.split("=");t[i[0]]=i.slice(1).join("=")}return t}function gF(r){let e="";if(r)for(let[t,n]of Object.entries(r))!t||t===""||(e!==""&&(e+="&"),e+=`${t}=${n||""}`);return e}function _F(r){let e=[];if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e.push({name:t,default:n});return e}function hF(r){let e={};if(Array.isArray(r))for(let t of r)e[t.name]=t.default;return e}function u4(r,e){if(r.source===yn.REST)switch(e.queryVerb){case"create":return"POST";case"update":return"PUT";case"read":return"GET";case"delete":return"DEL";case"patch":return"PATCH"}}function f4(r,e){if(r.source===yn.REST)switch(e.queryVerb){case"create":return"#dcc339";case"update":return"#5197ec";case"read":return"#53a761";case"delete":return"#ea7d82";case"patch":default:return}}function c4(r,e){if(!e.name||r.source!==yn.REST)return e.name;let t=e.name;if(t.includes("//")&&(t=t.split("//")[1]),!t.includes("/"))return t;t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/");return n[1]?`/${n.slice(1).join("/")}`:n[0]}function $F(r){if(!r)return{};const e={};return Object.entries(r).forEach(([t,n])=>{e[t]=!n}),e}var Ol={breakQueryString:mF,buildQueryString:gF,fieldsToSchema:a4,flipHeaderState:$F,keyValueToQueryParameters:_F,queryParametersToKeyValue:hF,schemaToFields:o4};function p4(r){let e,t,n,i=r[0]&&d4(r);return t=new Xe({props:{value:r[1],options:r[3],getOptionLabel:wF,getOptionValue:yF,autoWidth:!0}}),t.$on("change",r[6]),{c(){i&&i.c(),e=R(),S(t.$$.fragment)},m(l,s){i&&i.m(l,s),$(l,e,s),A(t,l,s),n=!0},p(l,s){l[0]?i?(i.p(l,s),s&1&&m(i,1)):(i=d4(l),i.c(),m(i,1),i.m(e.parentNode,e)):i&&(te(),_(i,1,1,()=>{i=null}),ne());const o={};s&2&&(o.value=l[1]),s&8&&(o.options=l[3]),t.$set(o)},i(l){n||(m(i),m(t.$$.fragment,l),n=!0)},o(l){_(i),_(t.$$.fragment,l),n=!1},d(l){i&&i.d(l),l&&b(e),E(t,l)}}}function d4(r){let e,t;return e=new Ze({props:{$$slots:{default:[bF]},$$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 bF(r){let e;return{c(){e=V(r[0])},m(t,n){$(t,e,n)},p(t,n){n&1&&Te(e,t[0])},d(t){t&&b(e)}}}function vF(r){let e,t,n=r[2]&&p4(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=p4(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}const wF=r=>r.name,yF=r=>r._id;function kF(r,e,t){let n;ue(r,Zi,p=>t(3,n=p));let{query:i}=e,{label:l}=e,s,o,a;async function u(p,d){try{t(1,s=p);const g=(i==null?void 0:i._id)||d;if(s&&g)for(let h of["read","write"])await po.save({level:h,role:p,resource:g})}catch{we.error("Error updating role")}}async function f(p){if((a==null?void 0:a._id)===(p==null?void 0:p._id)){t(2,o=!0);return}if(a=p,!p||!p._id){t(1,s=g3.BASIC),t(2,o=!0);return}try{t(1,s=(await po.forResource(p._id)).read)}catch{t(1,s=g3.BASIC)}t(2,o=!0)}const c=p=>u(p.detail);return r.$$set=p=>{"query"in p&&t(5,i=p.query),"label"in p&&t(0,l=p.label)},r.$$.update=()=>{r.$$.dirty&32&&f(i)},[l,s,o,n,u,i,c]}class m4 extends ie{constructor(e){super();le(this,e,kF,vF,re,{query:5,label:0})}}function CF(r){var i;let e,t=((i=r[4])==null?void 0:i.friendlyName)+"",n;return{c(){e=V("Query "),n=V(t)},m(l,s){$(l,e,s),$(l,n,s)},p(l,s){var o;s&16&&t!==(t=((o=l[4])==null?void 0:o.friendlyName)+"")&&Te(n,t)},d(l){l&&b(e),l&&b(n)}}}function SF(r){let e;return{c(){e=V("Config")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function AF(r){let e;return{c(){e=V("Query Name")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function g4(r){var I;let e,t,n,i,l,s,o,a,u,f,c,p,d;t=new Ze({props:{$$slots:{default:[EF]},$$scope:{ctx:r}}});function g(O){r[20](O)}let h={options:Object.keys(r[3]),getOptionLabel:r[19]};r[0].queryVerb!==void 0&&(h.value=r[0].queryVerb),i=new Xe({props:h}),K.push(()=>ce(i,"value",g)),i.$on("change",r[10]),a=new m4({props:{saveId:r[7],query:r[0],label:"Access Level"}});let v=((I=r[4])==null?void 0:I.extra)&&r[0].queryVerb&&_4(r);function k(O){r[21](O)}let C={bindable:!1};return r[0].parameters!==void 0&&(C.queryBindings=r[0].parameters),c=new v1({props:C}),K.push(()=>ce(c,"queryBindings",k)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),o=D("div"),S(a.$$.fragment),u=R(),v&&v.c(),f=R(),S(c.$$.fragment),w(e,"class","config-field svelte-hcuv48"),w(o,"class","config-field svelte-hcuv48")},m(O,T){$(O,e,T),A(t,e,null),N(e,n),A(i,e,null),$(O,s,T),$(O,o,T),A(a,o,null),$(O,u,T),v&&v.m(O,T),$(O,f,T),A(c,O,T),d=!0},p(O,T){var z;const P={};T&134217728&&(P.$$scope={dirty:T,ctx:O}),t.$set(P);const M={};T&8&&(M.options=Object.keys(O[3])),T&8&&(M.getOptionLabel=O[19]),!l&&T&1&&(l=!0,M.value=O[0].queryVerb,pe(()=>l=!1)),i.$set(M);const F={};T&128&&(F.saveId=O[7]),T&1&&(F.query=O[0]),a.$set(F),((z=O[4])==null?void 0:z.extra)&&O[0].queryVerb?v?(v.p(O,T),T&17&&m(v,1)):(v=_4(O),v.c(),m(v,1),v.m(f.parentNode,f)):v&&(te(),_(v,1,1,()=>{v=null}),ne());const j={};!p&&T&1&&(p=!0,j.queryBindings=O[0].parameters,pe(()=>p=!1)),c.$set(j)},i(O){d||(m(t.$$.fragment,O),m(i.$$.fragment,O),m(a.$$.fragment,O),m(v),m(c.$$.fragment,O),d=!0)},o(O){_(t.$$.fragment,O),_(i.$$.fragment,O),_(a.$$.fragment,O),_(v),_(c.$$.fragment,O),d=!1},d(O){O&&b(e),E(t),E(i),O&&b(s),O&&b(o),E(a),O&&b(u),v&&v.d(O),O&&b(f),E(c,O)}}}function EF(r){let e;return{c(){e=V("Function")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function _4(r){let e,t;return e=new IB({props:{query:r[0],populateExtraQuery:r[11],config:r[4].extra}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),i&16&&(l.config=n[4].extra),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 h4(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H,Y,U,W,G,Q;e=new pn({}),i=new Ct({props:{size:"S",$$slots:{default:[OF]},$$scope:{ctx:r}}}),s=new Ke({props:{size:"S",$$slots:{default:[TF]},$$scope:{ctx:r}}});function fe(ae){r[22](ae)}let Z={datasource:r[5],query:r[0],height:200,schema:r[3][r[0].queryVerb]};r[6]!==void 0&&(Z.parameters=r[6]),a=new m1({props:Z}),K.push(()=>ce(a,"parameters",fe)),c=new pn({}),h=new Ct({props:{size:"S",$$slots:{default:[IF]},$$scope:{ctx:r}}}),k=new ct({props:{hoverable:!0,name:"Help",size:"L"}}),k.$on("click",r[23]),I=new Ke({props:{size:"S",$$slots:{default:[LF]},$$scope:{ctx:r}}}),T=new Qf({props:{height:200,label:"Transformer",value:r[0].transformer,resize:"vertical"}}),T.$on("change",r[24]),M=new pn({}),z=new Ct({props:{size:"S",$$slots:{default:[PF]},$$scope:{ctx:r}}}),H=new bh({props:{gap:"M",$$slots:{default:[MF]},$$scope:{ctx:r}}}),U=new Ke({props:{size:"S",$$slots:{default:[DF]},$$scope:{ctx:r}}});let ee=r[2]&&$4(r);return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),f=R(),S(c.$$.fragment),p=R(),d=D("div"),g=D("div"),S(h.$$.fragment),v=R(),S(k.$$.fragment),C=R(),S(I.$$.fragment),O=R(),S(T.$$.fragment),P=R(),S(M.$$.fragment),F=R(),j=D("div"),S(z.$$.fragment),q=R(),S(H.$$.fragment),Y=R(),S(U.$$.fragment),W=R(),G=D("section"),ee&&ee.c(),w(n,"class","config svelte-hcuv48"),w(g,"class","help-heading svelte-hcuv48"),w(d,"class","config svelte-hcuv48"),w(j,"class","viewer-controls svelte-hcuv48"),w(G,"class","viewer svelte-hcuv48")},m(ae,_e){A(e,ae,_e),$(ae,t,_e),$(ae,n,_e),A(i,n,null),N(n,l),A(s,n,null),N(n,o),A(a,n,null),N(n,f),A(c,n,null),$(ae,p,_e),$(ae,d,_e),N(d,g),A(h,g,null),N(g,v),A(k,g,null),N(d,C),A(I,d,null),N(d,O),A(T,d,null),N(d,P),A(M,d,null),$(ae,F,_e),$(ae,j,_e),A(z,j,null),N(j,q),A(H,j,null),$(ae,Y,_e),A(U,ae,_e),$(ae,W,_e),$(ae,G,_e),ee&&ee.m(G,null),Q=!0},p(ae,_e){const Re={};_e&134217728&&(Re.$$scope={dirty:_e,ctx:ae}),i.$set(Re);const $e={};_e&134217728&&($e.$$scope={dirty:_e,ctx:ae}),s.$set($e);const be={};_e&32&&(be.datasource=ae[5]),_e&1&&(be.query=ae[0]),_e&9&&(be.schema=ae[3][ae[0].queryVerb]),!u&&_e&64&&(u=!0,be.parameters=ae[6],pe(()=>u=!1)),a.$set(be);const he={};_e&134217728&&(he.$$scope={dirty:_e,ctx:ae}),h.$set(he);const Ne={};_e&134217728&&(Ne.$$scope={dirty:_e,ctx:ae}),I.$set(Ne);const Fe={};_e&1&&(Fe.value=ae[0].transformer),T.$set(Fe);const se={};_e&134217728&&(se.$$scope={dirty:_e,ctx:ae}),z.$set(se);const Ce={};_e&134217984&&(Ce.$$scope={dirty:_e,ctx:ae}),H.$set(Ce);const me={};_e&134217728&&(me.$$scope={dirty:_e,ctx:ae}),U.$set(me),ae[2]?ee?(ee.p(ae,_e),_e&4&&m(ee,1)):(ee=$4(ae),ee.c(),m(ee,1),ee.m(G,null)):ee&&(te(),_(ee,1,1,()=>{ee=null}),ne())},i(ae){Q||(m(e.$$.fragment,ae),m(i.$$.fragment,ae),m(s.$$.fragment,ae),m(a.$$.fragment,ae),m(c.$$.fragment,ae),m(h.$$.fragment,ae),m(k.$$.fragment,ae),m(I.$$.fragment,ae),m(T.$$.fragment,ae),m(M.$$.fragment,ae),m(z.$$.fragment,ae),m(H.$$.fragment,ae),m(U.$$.fragment,ae),m(ee),Q=!0)},o(ae){_(e.$$.fragment,ae),_(i.$$.fragment,ae),_(s.$$.fragment,ae),_(a.$$.fragment,ae),_(c.$$.fragment,ae),_(h.$$.fragment,ae),_(k.$$.fragment,ae),_(I.$$.fragment,ae),_(T.$$.fragment,ae),_(M.$$.fragment,ae),_(z.$$.fragment,ae),_(H.$$.fragment,ae),_(U.$$.fragment,ae),_(ee),Q=!1},d(ae){E(e,ae),ae&&b(t),ae&&b(n),E(i),E(s),E(a),E(c),ae&&b(p),ae&&b(d),E(h),E(k),E(I),E(T),E(M),ae&&b(F),ae&&b(j),E(z),E(H),ae&&b(Y),E(U,ae),ae&&b(W),ae&&b(G),ee&&ee.d()}}}function OF(r){let e;return{c(){e=V("Fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function TF(r){let e;return{c(){e=V("Fill in the fields specific to this query.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function IF(r){let e;return{c(){e=V("Transformer")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function LF(r){let e;return{c(){e=V("Add a JavaScript function to transform the query result.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function PF(r){let e;return{c(){e=V("Results")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function NF(r){let e;return{c(){e=V("Save Query")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function RF(r){let e;return{c(){e=V("Run Query")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function MF(r){let e,t,n,i;return e=new gt({props:{cta:!0,disabled:r[8],$$slots:{default:[NF]},$$scope:{ctx:r}}}),e.$on("click",r[13]),n=new gt({props:{secondary:!0,$$slots:{default:[RF]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{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.disabled=l[8]),s&134217728&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&134217728&&(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 DF(r){let e;return{c(){e=V("Below, you can preview the results from your query and change the schema.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $4(r){let e,t;return e=new Vr({props:{selected:"JSON",$$slots:{default:[qF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&134217735&&(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 jF(r){let e,t;return e=new s4({props:{data:r[2][0],minHeight:"120"}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.data=n[2][0]),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 BF(r){let e,t,n;function i(s){r[25](s)}let l={name:"field",headings:!0,options:k3};return r[1]!==void 0&&(l.object=r[1]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&2&&(t=!0,a.object=s[1],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function zF(r){let e,t;return e=new YU({props:{query:r[0],data:r[2]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),i&4&&(l.data=n[2]),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 qF(r){let e,t,n,i,l,s;return e=new bn({props:{title:"JSON",$$slots:{default:[jF]},$$scope:{ctx:r}}}),n=new bn({props:{title:"Schema",$$slots:{default:[BF]},$$scope:{ctx:r}}}),l=new bn({props:{title:"Preview",$$slots:{default:[zF]},$$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&134217732&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&134217730&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&134217733&&(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 UF(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v;e=new Ct({props:{size:"M",$$slots:{default:[CF]},$$scope:{ctx:r}}}),n=new pn({}),l=new Ct({props:{size:"S",$$slots:{default:[SF]},$$scope:{ctx:r}}}),u=new Ze({props:{$$slots:{default:[AF]},$$scope:{ctx:r}}});function k(T){r[18](T)}let C={};r[0].name!==void 0&&(C.value=r[0].name),c=new tt({props:C}),K.push(()=>ce(c,"value",k));let I=r[3]&&g4(r),O=r[9]&&h4(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),S(u.$$.fragment),f=R(),S(c.$$.fragment),d=R(),I&&I.c(),g=R(),O&&O.c(),h=Ee(),w(a,"class","config-field svelte-hcuv48"),w(o,"class","config svelte-hcuv48")},m(T,P){A(e,T,P),$(T,t,P),A(n,T,P),$(T,i,P),A(l,T,P),$(T,s,P),$(T,o,P),N(o,a),A(u,a,null),N(a,f),A(c,a,null),N(o,d),I&&I.m(o,null),$(T,g,P),O&&O.m(T,P),$(T,h,P),v=!0},p(T,P){const M={};P&134217744&&(M.$$scope={dirty:P,ctx:T}),e.$set(M);const F={};P&134217728&&(F.$$scope={dirty:P,ctx:T}),l.$set(F);const j={};P&134217728&&(j.$$scope={dirty:P,ctx:T}),u.$set(j);const z={};!p&&P&1&&(p=!0,z.value=T[0].name,pe(()=>p=!1)),c.$set(z),T[3]?I?(I.p(T,P),P&8&&m(I,1)):(I=g4(T),I.c(),m(I,1),I.m(o,null)):I&&(te(),_(I,1,1,()=>{I=null}),ne()),T[9]?O?(O.p(T,P),P&512&&m(O,1)):(O=h4(T),O.c(),m(O,1),O.m(h.parentNode,h)):O&&(te(),_(O,1,1,()=>{O=null}),ne())},i(T){v||(m(e.$$.fragment,T),m(n.$$.fragment,T),m(l.$$.fragment,T),m(u.$$.fragment,T),m(c.$$.fragment,T),m(I),m(O),v=!0)},o(T){_(e.$$.fragment,T),_(n.$$.fragment,T),_(l.$$.fragment,T),_(u.$$.fragment,T),_(c.$$.fragment,T),_(I),_(O),v=!1},d(T){E(e,T),T&&b(t),E(n,T),T&&b(i),E(l,T),T&&b(s),T&&b(o),E(u),E(c),I&&I.d(),T&&b(g),O&&O.d(T),T&&b(h)}}}function FF(r){let e,t;return e=new Qe({props:{gap:"S",noPadding:!0,$$slots:{default:[UF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&134218751&&(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)}}}const VF="https://docs.budibase.com/building-apps/data/transformers";function HF(r,e,t){let n,i,l,s,o,a,u,f,c,p;ue(r,qt,U=>t(26,f=U)),ue(r,Ql,U=>t(16,c=U)),ue(r,en,U=>t(17,p=U));let{query:d}=e,g=(d==null?void 0:d.schema)?o4(d.schema):[],h,v=[],k;d&&!d.transformer&&(d.transformer="return data");function C(){d.fields.extra&&t(0,d.fields.extra={},d)}function I(U){t(0,d.fields.extra=U,d)}async function O(){try{const U=await kn.preview(d);if(U.rows.length===0){we.info("Query results empty. Please execute a query with results to create your schema.");return}t(2,v=U.rows),t(1,g=U.schema),we.success("Query executed successfully")}catch{we.error("Error previewing query")}}async function T(){try{const{_id:U}=await kn.save(d.datasourceId,d);t(7,k=U),we.success("Query saved successfully."),f(`../${U}`)}catch{we.error("Error creating query")}}function P(U){r.$$.not_equal(d.name,U)&&(d.name=U,t(0,d),t(1,g))}const M=U=>{var W;return((W=s[U])==null?void 0:W.displayName)||Sr(U)};function F(U){r.$$.not_equal(d.queryVerb,U)&&(d.queryVerb=U,t(0,d),t(1,g))}function j(U){r.$$.not_equal(d.parameters,U)&&(d.parameters=U,t(0,d),t(1,g))}function z(U){h=U,t(6,h)}const q=()=>window.open(VF),H=U=>t(0,d.transformer=U.detail,d);function Y(U){g=U,t(1,g)}return r.$$set=U=>{"query"in U&&t(0,d=U.query)},r.$$.update=()=>{r.$$.dirty&2&&t(0,d.schema=a4(g),d),r.$$.dirty&131073&&t(5,n=p.list.find(U=>U._id===d.datasourceId)),r.$$.dirty&32&&t(15,i=n==null?void 0:n.source),r.$$.dirty&98304&&t(4,l=i?c[i]:null),r.$$.dirty&16&&t(3,s=l==null?void 0:l.query),r.$$.dirty&9&&t(9,o=s&&d.queryVerb),r.$$.dirty&1&&t(14,a=d.queryVerb==="read"||d.readable),r.$$.dirty&16389&&t(8,u=!d.name||a&&v.length===0)},[d,g,v,s,l,n,h,k,u,o,C,I,O,T,a,i,c,p,P,M,F,j,z,q,H,Y]}class WF extends ie{constructor(e){super();le(this,e,HF,FF,re,{query:0})}}function b4(r){let e,t;return e=new WF({props:{query:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),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 GF(r){let e,t,n,i=r[1]._id&&r[0]&&b4(r);return{c(){e=D("section"),t=D("div"),i&&i.c(),w(t,"class","inner svelte-1cfdofs")},m(l,s){$(l,e,s),N(e,t),i&&i.m(t,null),n=!0},p(l,[s]){l[1]._id&&l[0]?i?(i.p(l,s),s&3&&m(i,1)):(i=b4(l),i.c(),m(i,1),i.m(t,null)):i&&(te(),_(i,1,1,()=>{i=null}),ne())},i(l){n||(m(i),n=!0)},o(l){_(i),n=!1},d(l){l&&b(e),i&&i.d()}}}function YF(r,e,t){let n,i,l,s,o;ue(r,er,f=>t(3,n=f)),ue(r,qt,f=>t(4,i=f)),ue(r,en,f=>t(5,l=f)),ue(r,kn,f=>t(6,s=f)),ue(r,ys,f=>t(1,o=f));let a,u;return r.$$.update=()=>{r.$$.dirty&72&&t(0,a=s.list.find(f=>f._id===s.selected)||{datasourceId:n.selectedDatasource,parameters:[],fields:{},queryVerb:"read"}),r.$$.dirty&40&&t(2,u=l.list.find(f=>f._id===n.selectedDatasource)),r.$$.dirty&28&&(u==null?void 0:u.source)===yn.REST&&i(`../rest/${n.query}`)},[a,o,u,n,i,l,s]}class JF extends ie{constructor(e){super();le(this,e,YF,GF,re,{})}}function QF(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function XF(r,e,t){let n,i,l,s;ue(r,er,c=>t(3,n=c)),ue(r,qt,c=>t(4,i=c)),ue(r,en,c=>t(5,l=c)),ue(r,kn,c=>t(6,s=c));let{$$slots:o={},$$scope:a}=e,u;if(n.query){const c=s.list.find(p=>p._id===n.query);c&&(kn.select(c),u=c.datasourceId)}const f=l.list.find(c=>c._id===l.selected||c._id===u);return(f==null?void 0:f.source)===yn.REST&&i(`../rest/${n.query}`),r.$$set=c=>{"$$scope"in c&&t(0,a=c.$$scope)},[a,o]}class KF extends ie{constructor(e){super();le(this,e,XF,QF,re,{})}}function v4(r,e,t){const n=r.slice();return n[18]=e[t],n[19]=e,n[20]=t,n}function w4(r){let e,t,n,i,l,s;t=new Ze({props:{$$slots:{default:[ZF]},$$scope:{ctx:r}}});function o(u){r[7](u)}let a={};return r[0].name!==void 0&&(a.value=r[0].name),i=new tt({props:a}),K.push(()=>ce(i,"value",o)),i.$on("change",r[8]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),w(e,"class","form-row svelte-13q83tn")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),A(i,e,null),s=!0},p(u,f){const c={};f&2097152&&(c.$$scope={dirty:f,ctx:u}),t.$set(c);const p={};!l&&f&1&&(l=!0,p.value=u[0].name,pe(()=>l=!1)),i.$set(p)},i(u){s||(m(t.$$.fragment,u),m(i.$$.fragment,u),s=!0)},o(u){_(t.$$.fragment,u),_(i.$$.fragment,u),s=!1},d(u){u&&b(e),E(t),E(i)}}}function ZF(r){let e;return{c(){e=V("Name")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function xF(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[rV]},$$scope:{ctx:r}}});function a(f){r[15](f,r[18])}let u={type:r[1][r[18]].type};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new tt({props:u}),K.push(()=>ce(i,"value",a)),i.$on("change",r[16]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};c&18&&(d.type=r[1][r[18]].type),!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function eV(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[iV]},$$scope:{ctx:r}}});function a(f){r[13](f,r[18])}let u={type:r[1][r[18]].type};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new pi({props:u}),K.push(()=>ce(i,"value",a)),i.$on("change",r[14]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};c&18&&(d.type=r[1][r[18]].type),!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function tV(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[lV]},$$scope:{ctx:r}}});function a(f){r[12](f,r[18])}let u={text:""};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new Vn({props:u}),K.push(()=>ce(i,"value",a)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function nV(r){let e,t,n,i,l,s,o,a;t=new Ze({props:{$$slots:{default:[sV]},$$scope:{ctx:r}}}),i=new gt({props:{secondary:!0,thin:!0,outline:!0,$$slots:{default:[oV]},$$scope:{ctx:r}}}),i.$on("click",function(){mt(r[3].addEntry())&&r[3].addEntry().apply(this,arguments)});function u(c){r[10](c,r[18])}let f={defaults:r[1][r[18]].default,noAddButton:!0};return r[5][r[18]]!==void 0&&(f.object=r[5][r[18]]),s=new vi({props:f}),r[9](s),K.push(()=>ce(s,"object",u)),s.$on("change",r[11]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","form-row ssl svelte-13q83tn")},m(c,p){$(c,e,p),A(t,e,null),N(e,n),A(i,e,null),$(c,l,p),A(s,c,p),a=!0},p(c,p){r=c;const d={};p&2097168&&(d.$$scope={dirty:p,ctx:r}),t.$set(d);const g={};p&2097152&&(g.$$scope={dirty:p,ctx:r}),i.$set(g);const h={};p&18&&(h.defaults=r[1][r[18]].default),!o&&p&48&&(o=!0,h.object=r[5][r[18]],pe(()=>o=!1)),s.$set(h)},i(c){a||(m(t.$$.fragment,c),m(i.$$.fragment,c),m(s.$$.fragment,c),a=!0)},o(c){_(t.$$.fragment,c),_(i.$$.fragment,c),_(s.$$.fragment,c),a=!1},d(c){c&&b(e),E(t),E(i),c&&b(l),r[9](null),E(s,c)}}}function rV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function iV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function lV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function sV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function oV(r){let e;return{c(){e=V("Add")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function y4(r){let e,t,n,i;const l=[nV,tV,eV,xF],s=[];function o(a,u){return a[1][a[18]].type==="object"?0:a[1][a[18]].type==="boolean"?1:a[1][a[18]].type==="longForm"?2:3}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function aV(r){let e,t,n,i=!r[2]&&w4(r),l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=y4(v4(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){i&&i.c(),e=R();for(let a=0;a<s.length;a+=1)s[a].c();t=Ee()},m(a,u){i&&i.m(a,u),$(a,e,u);for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,t,u),n=!0},p(a,u){if(a[2]?i&&(te(),_(i,1,1,()=>{i=null}),ne()):i?(i.p(a,u),u&4&&m(i,1)):(i=w4(a),i.c(),m(i,1),i.m(e.parentNode,e)),u&122){l=a[4];let f;for(f=0;f<l.length;f+=1){const c=v4(a,l,f);s[f]?(s[f].p(c,u),m(s[f],1)):(s[f]=y4(c),s[f].c(),m(s[f],1),s[f].m(t.parentNode,t))}for(te(),f=l.length;f<s.length;f+=1)o(f);ne()}},i(a){if(!n){m(i);for(let u=0;u<l.length;u+=1)m(s[u]);n=!0}},o(a){_(i),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);n=!1},d(a){i&&i.d(a),a&&b(e),$t(s,a),a&&b(t)}}}function uV(r){let e,t,n;return t=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[aV]},$$scope:{ctx:r}}}),{c(){e=D("form"),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,[l]){const s={};l&2097215&&(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 fV(r,e,t){let n,i,{datasource:l}=e,{schema:s}=e,{creating:o}=e;function a([T,P]){return P?!(l.source===yn.REST&&T==="defaultHeaders"||P.deprecated):!1}let u;function f(T){var M;let P;return((M=s[T])==null?void 0:M.display)?P=s[T].display:P=T,Sr(P)}function c(T){r.$$.not_equal(l.name,T)&&(l.name=T,t(0,l))}function p(T){ft.call(this,r,T)}function d(T){K[T?"unshift":"push"](()=>{u=T,t(3,u)})}function g(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function h(T){ft.call(this,r,T)}function v(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function k(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function C(T){ft.call(this,r,T)}function I(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function O(T){ft.call(this,r,T)}return r.$$set=T=>{"datasource"in T&&t(0,l=T.datasource),"schema"in T&&t(1,s=T.schema),"creating"in T&&t(2,o=T.creating)},r.$$.update=()=>{r.$$.dirty&1&&t(5,n=l==null?void 0:l.config),r.$$.dirty&2&&t(4,i=Object.entries(s||{}).filter(T=>a(T)).map(([T])=>T))},[l,s,o,u,i,n,f,c,p,d,g,h,v,k,C,I,O]}class k4 extends ie{constructor(e){super();le(this,e,fV,uV,re,{datasource:0,schema:1,creating:2})}}const wi={BASIC:"basic",BEARER:"bearer"},C4=[{label:"Basic Auth",value:wi.BASIC},{label:"Bearer Token",value:wi.BEARER}];function cV(r){let e=r[1](r[0])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,[i]){i&1&&e!==(e=n[1](n[0])+"")&&Te(t,e)},i:Oe,o:Oe,d(n){n&&b(t)}}}function pV(r,e,t){let{value:n}=e;const i=l=>C4.filter(s=>s.value===l).map(s=>s.label);return r.$$set=l=>{"value"in l&&t(0,n=l.value)},[n,i]}class dV extends ie{constructor(e){super();le(this,e,pV,cV,re,{value:0})}}function mV(r){let e;return{c(){e=V(`The authorization header will be automatically generated when you send the
|
|
396
|
+
query.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function sF(r){let e;function t(l,s){return l[2]?iF:lF}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.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function oF(r){let e,t;function n(){return r[10](r[13])}return e=new ct({props:{hoverable:!0,name:"Close"}}),e.$on("click",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}function aF(r){var i;let e,t;function n(...l){return r[9](r[11],...l)}return e=new Un({props:{title:`Query binding "${r[11].name}"`,placeholder:"Value",thin:!0,value:_o(r[3],(i=r[1])==null?void 0:i[r[11].name]),bindings:r[3]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(l,s){A(e,l,s),t=!0},p(l,s){var a;r=l;const o={};s&1&&(o.title=`Query binding "${r[11].name}"`),s&11&&(o.value=_o(r[3],(a=r[1])==null?void 0:a[r[11].name])),s&8&&(o.bindings=r[3]),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function l4(r){let e,t,n,i,l,s,o,a,u,f;function c(C){r[7](C,r[11])}let p={placeholder:"Binding Name",thin:!0,disabled:r[2]};r[11].name!==void 0&&(p.value=r[11].name),e=new tt({props:p}),K.push(()=>ce(e,"value",c));function d(C){r[8](C,r[11])}let g={placeholder:"Default",thin:!0,disabled:r[2]};r[11].default!==void 0&&(g.value=r[11].default),i=new tt({props:g}),K.push(()=>ce(i,"value",d));const h=[aF,oF],v=[];function k(C,I){return C[2]?0:1}return o=k(r),a=v[o]=h[o](r),{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment),s=R(),a.c(),u=Ee()},m(C,I){A(e,C,I),$(C,n,I),A(i,C,I),$(C,s,I),v[o].m(C,I),$(C,u,I),f=!0},p(C,I){r=C;const O={};I&4&&(O.disabled=r[2]),!t&&I&1&&(t=!0,O.value=r[11].name,pe(()=>t=!1)),e.$set(O);const T={};I&4&&(T.disabled=r[2]),!l&&I&1&&(l=!0,T.value=r[11].default,pe(()=>l=!1)),i.$set(T);let P=o;o=k(r),o===P?v[o].p(r,I):(te(),_(v[P],1,1,()=>{v[P]=null}),ne(),a=v[o],a?a.p(r,I):(a=v[o]=h[o](r),a.c()),m(a,1),a.m(u.parentNode,u))},i(C){f||(m(e.$$.fragment,C),m(i.$$.fragment,C),m(a),f=!0)},o(C){_(e.$$.fragment,C),_(i.$$.fragment,C),_(a),f=!1},d(C){E(e,C),C&&b(n),E(i,C),C&&b(s),v[o].d(C),C&&b(u)}}}function uF(r){let e,t,n,i,l,s,o,a;t=new Ct({props:{size:"XS",$$slots:{default:[nF]},$$scope:{ctx:r}}});let u=!r[2]&&i4(r);l=new Ke({props:{size:"S",$$slots:{default:[sF]},$$scope:{ctx:r}}});let f=r[0],c=[];for(let d=0;d<f.length;d+=1)c[d]=l4(r4(r,f,d));const p=d=>_(c[d],1,1,()=>{c[d]=null});return{c(){e=D("div"),S(t.$$.fragment),n=R(),u&&u.c(),i=R(),S(l.$$.fragment),s=R(),o=D("div");for(let d=0;d<c.length;d+=1)c[d].c();w(e,"class","controls svelte-bpqao2"),oe(e,"height",!r[2]),w(o,"class","bindings svelte-bpqao2"),oe(o,"bindable",r[2])},m(d,g){$(d,e,g),A(t,e,null),N(e,n),u&&u.m(e,null),$(d,i,g),A(l,d,g),$(d,s,g),$(d,o,g);for(let h=0;h<c.length;h+=1)c[h].m(o,null);a=!0},p(d,g){const h={};g&16384&&(h.$$scope={dirty:g,ctx:d}),t.$set(h),d[2]?u&&(te(),_(u,1,1,()=>{u=null}),ne()):u?(u.p(d,g),g&4&&m(u,1)):(u=i4(d),u.c(),m(u,1),u.m(e,null)),g&4&&oe(e,"height",!d[2]);const v={};if(g&16388&&(v.$$scope={dirty:g,ctx:d}),l.$set(v),g&111){f=d[0];let k;for(k=0;k<f.length;k+=1){const C=r4(d,f,k);c[k]?(c[k].p(C,g),m(c[k],1)):(c[k]=l4(C),c[k].c(),m(c[k],1),c[k].m(o,null))}for(te(),k=f.length;k<c.length;k+=1)p(k);ne()}g&4&&oe(o,"bindable",d[2])},i(d){if(!a){m(t.$$.fragment,d),m(u),m(l.$$.fragment,d);for(let g=0;g<f.length;g+=1)m(c[g]);a=!0}},o(d){_(t.$$.fragment,d),_(u),_(l.$$.fragment,d),c=c.filter(Boolean);for(let g=0;g<c.length;g+=1)_(c[g]);a=!1},d(d){d&&b(e),E(t),u&&u.d(),d&&b(i),E(l,d),d&&b(s),d&&b(o),$t(c,d)}}}function fF(r){let e,t;return e=new Qe({props:{noPadding:r[2],gap:"S",$$slots:{default:[uF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&4&&(l.noPadding=n[2]),i&16399&&(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 cF(r,e,t){let{bindable:n=!0}=e,{queryBindings:i=[]}=e,{bindings:l=[]}=e,{customParams:s={}}=e;function o(){t(0,i=[...i,{}])}function a(g){i.splice(g,1),t(0,i)}function u(g,h){t(1,s[g]=Ss(l,h),s)}function f(g,h){r.$$.not_equal(h.name,g)&&(h.name=g,t(0,i))}function c(g,h){r.$$.not_equal(h.default,g)&&(h.default=g,t(0,i))}const p=(g,h)=>u(g.name,h.detail),d=g=>a(g);return r.$$set=g=>{"bindable"in g&&t(2,n=g.bindable),"queryBindings"in g&&t(0,i=g.queryBindings),"bindings"in g&&t(3,l=g.bindings),"customParams"in g&&t(1,s=g.customParams)},[i,s,n,l,o,a,u,f,c,p,d]}class v1 extends ie{constructor(e){super();le(this,e,cF,fF,re,{bindable:2,queryBindings:0,bindings:3,customParams:1})}}function pF(r){let e,t;return e=new pi({props:{disabled:!0,value:r[2],height:r[0],minHeight:r[1]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&4&&(l.value=n[2]),i&1&&(l.height=n[0]),i&2&&(l.minHeight=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 dF(r,e,t){let n,{data:i}=e,{height:l}=e,{minHeight:s="120"}=e;return r.$$set=o=>{"data"in o&&t(3,i=o.data),"height"in o&&t(0,l=o.height),"minHeight"in o&&t(1,s=o.minHeight)},r.$$.update=()=>{r.$$.dirty&8&&t(2,n=JSON.stringify(i||{},null,2))},[l,s,n,i]}class s4 extends ie{constructor(e){super();le(this,e,dF,pF,re,{data:3,height:0,minHeight:1})}}function o4(r){const e={};if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e[t]=(n==null?void 0:n.type)||"string";return e}function a4(r){const e={};if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e[t]={name:t,type:n};return e}function mF(r){if(!r)return{};r.includes("?")&&(r=r.split("?")[1]);const e=r.split("&");let t={};for(let n of e){const i=n.split("=");t[i[0]]=i.slice(1).join("=")}return t}function gF(r){let e="";if(r)for(let[t,n]of Object.entries(r))!t||t===""||(e!==""&&(e+="&"),e+=`${t}=${n||""}`);return e}function _F(r){let e=[];if(r&&typeof r=="object")for(let[t,n]of Object.entries(r))e.push({name:t,default:n});return e}function hF(r){let e={};if(Array.isArray(r))for(let t of r)e[t.name]=t.default;return e}function u4(r,e){if(r.source===yn.REST)switch(e.queryVerb){case"create":return"POST";case"update":return"PUT";case"read":return"GET";case"delete":return"DEL";case"patch":return"PATCH"}}function f4(r,e){if(r.source===yn.REST)switch(e.queryVerb){case"create":return"#dcc339";case"update":return"#5197ec";case"read":return"#53a761";case"delete":return"#ea7d82";case"patch":default:return}}function c4(r,e){if(!e.name||r.source!==yn.REST)return e.name;let t=e.name;if(t.includes("//")&&(t=t.split("//")[1]),!t.includes("/"))return t;t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/");return n[1]?`/${n.slice(1).join("/")}`:n[0]}function $F(r){if(!r)return{};const e={};return Object.entries(r).forEach(([t,n])=>{e[t]=!n}),e}var Ol={breakQueryString:mF,buildQueryString:gF,fieldsToSchema:a4,flipHeaderState:$F,keyValueToQueryParameters:_F,queryParametersToKeyValue:hF,schemaToFields:o4};function p4(r){let e,t,n,i=r[0]&&d4(r);return t=new Xe({props:{value:r[1],options:r[3],getOptionLabel:wF,getOptionValue:yF,autoWidth:!0}}),t.$on("change",r[6]),{c(){i&&i.c(),e=R(),S(t.$$.fragment)},m(l,s){i&&i.m(l,s),$(l,e,s),A(t,l,s),n=!0},p(l,s){l[0]?i?(i.p(l,s),s&1&&m(i,1)):(i=d4(l),i.c(),m(i,1),i.m(e.parentNode,e)):i&&(te(),_(i,1,1,()=>{i=null}),ne());const o={};s&2&&(o.value=l[1]),s&8&&(o.options=l[3]),t.$set(o)},i(l){n||(m(i),m(t.$$.fragment,l),n=!0)},o(l){_(i),_(t.$$.fragment,l),n=!1},d(l){i&&i.d(l),l&&b(e),E(t,l)}}}function d4(r){let e,t;return e=new Ze({props:{$$slots:{default:[bF]},$$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 bF(r){let e;return{c(){e=V(r[0])},m(t,n){$(t,e,n)},p(t,n){n&1&&Te(e,t[0])},d(t){t&&b(e)}}}function vF(r){let e,t,n=r[2]&&p4(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=p4(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}const wF=r=>r.name,yF=r=>r._id;function kF(r,e,t){let n;ue(r,Zi,p=>t(3,n=p));let{query:i}=e,{label:l}=e,s,o,a;async function u(p,d){try{t(1,s=p);const g=(i==null?void 0:i._id)||d;if(s&&g)for(let h of["read","write"])await po.save({level:h,role:p,resource:g})}catch{we.error("Error updating role")}}async function f(p){if((a==null?void 0:a._id)===(p==null?void 0:p._id)){t(2,o=!0);return}if(a=p,!p||!p._id){t(1,s=g3.BASIC),t(2,o=!0);return}try{t(1,s=(await po.forResource(p._id)).read)}catch{t(1,s=g3.BASIC)}t(2,o=!0)}const c=p=>u(p.detail);return r.$$set=p=>{"query"in p&&t(5,i=p.query),"label"in p&&t(0,l=p.label)},r.$$.update=()=>{r.$$.dirty&32&&f(i)},[l,s,o,n,u,i,c]}class m4 extends ie{constructor(e){super();le(this,e,kF,vF,re,{query:5,label:0})}}function CF(r){var i;let e,t=((i=r[4])==null?void 0:i.friendlyName)+"",n;return{c(){e=V("Query "),n=V(t)},m(l,s){$(l,e,s),$(l,n,s)},p(l,s){var o;s&16&&t!==(t=((o=l[4])==null?void 0:o.friendlyName)+"")&&Te(n,t)},d(l){l&&b(e),l&&b(n)}}}function SF(r){let e;return{c(){e=V("Config")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function AF(r){let e;return{c(){e=V("Query Name")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function g4(r){var I;let e,t,n,i,l,s,o,a,u,f,c,p,d;t=new Ze({props:{$$slots:{default:[EF]},$$scope:{ctx:r}}});function g(O){r[20](O)}let h={options:Object.keys(r[3]),getOptionLabel:r[19]};r[0].queryVerb!==void 0&&(h.value=r[0].queryVerb),i=new Xe({props:h}),K.push(()=>ce(i,"value",g)),i.$on("change",r[10]),a=new m4({props:{saveId:r[7],query:r[0],label:"Access Level"}});let v=((I=r[4])==null?void 0:I.extra)&&r[0].queryVerb&&_4(r);function k(O){r[21](O)}let C={bindable:!1};return r[0].parameters!==void 0&&(C.queryBindings=r[0].parameters),c=new v1({props:C}),K.push(()=>ce(c,"queryBindings",k)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),o=D("div"),S(a.$$.fragment),u=R(),v&&v.c(),f=R(),S(c.$$.fragment),w(e,"class","config-field svelte-hcuv48"),w(o,"class","config-field svelte-hcuv48")},m(O,T){$(O,e,T),A(t,e,null),N(e,n),A(i,e,null),$(O,s,T),$(O,o,T),A(a,o,null),$(O,u,T),v&&v.m(O,T),$(O,f,T),A(c,O,T),d=!0},p(O,T){var z;const P={};T&134217728&&(P.$$scope={dirty:T,ctx:O}),t.$set(P);const M={};T&8&&(M.options=Object.keys(O[3])),T&8&&(M.getOptionLabel=O[19]),!l&&T&1&&(l=!0,M.value=O[0].queryVerb,pe(()=>l=!1)),i.$set(M);const F={};T&128&&(F.saveId=O[7]),T&1&&(F.query=O[0]),a.$set(F),((z=O[4])==null?void 0:z.extra)&&O[0].queryVerb?v?(v.p(O,T),T&17&&m(v,1)):(v=_4(O),v.c(),m(v,1),v.m(f.parentNode,f)):v&&(te(),_(v,1,1,()=>{v=null}),ne());const j={};!p&&T&1&&(p=!0,j.queryBindings=O[0].parameters,pe(()=>p=!1)),c.$set(j)},i(O){d||(m(t.$$.fragment,O),m(i.$$.fragment,O),m(a.$$.fragment,O),m(v),m(c.$$.fragment,O),d=!0)},o(O){_(t.$$.fragment,O),_(i.$$.fragment,O),_(a.$$.fragment,O),_(v),_(c.$$.fragment,O),d=!1},d(O){O&&b(e),E(t),E(i),O&&b(s),O&&b(o),E(a),O&&b(u),v&&v.d(O),O&&b(f),E(c,O)}}}function EF(r){let e;return{c(){e=V("Function")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function _4(r){let e,t;return e=new IB({props:{query:r[0],populateExtraQuery:r[11],config:r[4].extra}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),i&16&&(l.config=n[4].extra),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 h4(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H,Y,U,W,G,Q;e=new pn({}),i=new Ct({props:{size:"S",$$slots:{default:[OF]},$$scope:{ctx:r}}}),s=new Ke({props:{size:"S",$$slots:{default:[TF]},$$scope:{ctx:r}}});function fe(ae){r[22](ae)}let Z={datasource:r[5],query:r[0],height:200,schema:r[3][r[0].queryVerb]};r[6]!==void 0&&(Z.parameters=r[6]),a=new m1({props:Z}),K.push(()=>ce(a,"parameters",fe)),c=new pn({}),h=new Ct({props:{size:"S",$$slots:{default:[IF]},$$scope:{ctx:r}}}),k=new ct({props:{hoverable:!0,name:"Help",size:"L"}}),k.$on("click",r[23]),I=new Ke({props:{size:"S",$$slots:{default:[LF]},$$scope:{ctx:r}}}),T=new Qf({props:{height:200,label:"Transformer",value:r[0].transformer,resize:"vertical"}}),T.$on("change",r[24]),M=new pn({}),z=new Ct({props:{size:"S",$$slots:{default:[PF]},$$scope:{ctx:r}}}),H=new bh({props:{gap:"M",$$slots:{default:[MF]},$$scope:{ctx:r}}}),U=new Ke({props:{size:"S",$$slots:{default:[DF]},$$scope:{ctx:r}}});let ee=r[2]&&$4(r);return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),f=R(),S(c.$$.fragment),p=R(),d=D("div"),g=D("div"),S(h.$$.fragment),v=R(),S(k.$$.fragment),C=R(),S(I.$$.fragment),O=R(),S(T.$$.fragment),P=R(),S(M.$$.fragment),F=R(),j=D("div"),S(z.$$.fragment),q=R(),S(H.$$.fragment),Y=R(),S(U.$$.fragment),W=R(),G=D("section"),ee&&ee.c(),w(n,"class","config svelte-hcuv48"),w(g,"class","help-heading svelte-hcuv48"),w(d,"class","config svelte-hcuv48"),w(j,"class","viewer-controls svelte-hcuv48"),w(G,"class","viewer svelte-hcuv48")},m(ae,_e){A(e,ae,_e),$(ae,t,_e),$(ae,n,_e),A(i,n,null),N(n,l),A(s,n,null),N(n,o),A(a,n,null),N(n,f),A(c,n,null),$(ae,p,_e),$(ae,d,_e),N(d,g),A(h,g,null),N(g,v),A(k,g,null),N(d,C),A(I,d,null),N(d,O),A(T,d,null),N(d,P),A(M,d,null),$(ae,F,_e),$(ae,j,_e),A(z,j,null),N(j,q),A(H,j,null),$(ae,Y,_e),A(U,ae,_e),$(ae,W,_e),$(ae,G,_e),ee&&ee.m(G,null),Q=!0},p(ae,_e){const Re={};_e&134217728&&(Re.$$scope={dirty:_e,ctx:ae}),i.$set(Re);const $e={};_e&134217728&&($e.$$scope={dirty:_e,ctx:ae}),s.$set($e);const be={};_e&32&&(be.datasource=ae[5]),_e&1&&(be.query=ae[0]),_e&9&&(be.schema=ae[3][ae[0].queryVerb]),!u&&_e&64&&(u=!0,be.parameters=ae[6],pe(()=>u=!1)),a.$set(be);const he={};_e&134217728&&(he.$$scope={dirty:_e,ctx:ae}),h.$set(he);const Ne={};_e&134217728&&(Ne.$$scope={dirty:_e,ctx:ae}),I.$set(Ne);const Fe={};_e&1&&(Fe.value=ae[0].transformer),T.$set(Fe);const se={};_e&134217728&&(se.$$scope={dirty:_e,ctx:ae}),z.$set(se);const Ce={};_e&134217984&&(Ce.$$scope={dirty:_e,ctx:ae}),H.$set(Ce);const me={};_e&134217728&&(me.$$scope={dirty:_e,ctx:ae}),U.$set(me),ae[2]?ee?(ee.p(ae,_e),_e&4&&m(ee,1)):(ee=$4(ae),ee.c(),m(ee,1),ee.m(G,null)):ee&&(te(),_(ee,1,1,()=>{ee=null}),ne())},i(ae){Q||(m(e.$$.fragment,ae),m(i.$$.fragment,ae),m(s.$$.fragment,ae),m(a.$$.fragment,ae),m(c.$$.fragment,ae),m(h.$$.fragment,ae),m(k.$$.fragment,ae),m(I.$$.fragment,ae),m(T.$$.fragment,ae),m(M.$$.fragment,ae),m(z.$$.fragment,ae),m(H.$$.fragment,ae),m(U.$$.fragment,ae),m(ee),Q=!0)},o(ae){_(e.$$.fragment,ae),_(i.$$.fragment,ae),_(s.$$.fragment,ae),_(a.$$.fragment,ae),_(c.$$.fragment,ae),_(h.$$.fragment,ae),_(k.$$.fragment,ae),_(I.$$.fragment,ae),_(T.$$.fragment,ae),_(M.$$.fragment,ae),_(z.$$.fragment,ae),_(H.$$.fragment,ae),_(U.$$.fragment,ae),_(ee),Q=!1},d(ae){E(e,ae),ae&&b(t),ae&&b(n),E(i),E(s),E(a),E(c),ae&&b(p),ae&&b(d),E(h),E(k),E(I),E(T),E(M),ae&&b(F),ae&&b(j),E(z),E(H),ae&&b(Y),E(U,ae),ae&&b(W),ae&&b(G),ee&&ee.d()}}}function OF(r){let e;return{c(){e=V("Fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function TF(r){let e;return{c(){e=V("Fill in the fields specific to this query.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function IF(r){let e;return{c(){e=V("Transformer")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function LF(r){let e;return{c(){e=V("Add a JavaScript function to transform the query result.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function PF(r){let e;return{c(){e=V("Results")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function NF(r){let e;return{c(){e=V("Save Query")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function RF(r){let e;return{c(){e=V("Run Query")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function MF(r){let e,t,n,i;return e=new gt({props:{cta:!0,disabled:r[8],$$slots:{default:[NF]},$$scope:{ctx:r}}}),e.$on("click",r[13]),n=new gt({props:{secondary:!0,$$slots:{default:[RF]},$$scope:{ctx:r}}}),n.$on("click",r[12]),{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.disabled=l[8]),s&134217728&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&134217728&&(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 DF(r){let e;return{c(){e=V("Below, you can preview the results from your query and change the schema.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $4(r){let e,t;return e=new Vr({props:{selected:"JSON",$$slots:{default:[qF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&134217735&&(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 jF(r){let e,t;return e=new s4({props:{data:r[2][0],minHeight:"120"}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.data=n[2][0]),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 BF(r){let e,t,n;function i(s){r[25](s)}let l={name:"field",headings:!0,options:k3};return r[1]!==void 0&&(l.object=r[1]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&2&&(t=!0,a.object=s[1],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function zF(r){let e,t;return e=new YU({props:{query:r[0],data:r[2]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),i&4&&(l.data=n[2]),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 qF(r){let e,t,n,i,l,s;return e=new bn({props:{title:"JSON",$$slots:{default:[jF]},$$scope:{ctx:r}}}),n=new bn({props:{title:"Schema",$$slots:{default:[BF]},$$scope:{ctx:r}}}),l=new bn({props:{title:"Preview",$$slots:{default:[zF]},$$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&134217732&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&134217730&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a&134217733&&(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 UF(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v;e=new Ct({props:{size:"M",$$slots:{default:[CF]},$$scope:{ctx:r}}}),n=new pn({}),l=new Ct({props:{size:"S",$$slots:{default:[SF]},$$scope:{ctx:r}}}),u=new Ze({props:{$$slots:{default:[AF]},$$scope:{ctx:r}}});function k(T){r[18](T)}let C={};r[0].name!==void 0&&(C.value=r[0].name),c=new tt({props:C}),K.push(()=>ce(c,"value",k));let I=r[3]&&g4(r),O=r[9]&&h4(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),S(u.$$.fragment),f=R(),S(c.$$.fragment),d=R(),I&&I.c(),g=R(),O&&O.c(),h=Ee(),w(a,"class","config-field svelte-hcuv48"),w(o,"class","config svelte-hcuv48")},m(T,P){A(e,T,P),$(T,t,P),A(n,T,P),$(T,i,P),A(l,T,P),$(T,s,P),$(T,o,P),N(o,a),A(u,a,null),N(a,f),A(c,a,null),N(o,d),I&&I.m(o,null),$(T,g,P),O&&O.m(T,P),$(T,h,P),v=!0},p(T,P){const M={};P&134217744&&(M.$$scope={dirty:P,ctx:T}),e.$set(M);const F={};P&134217728&&(F.$$scope={dirty:P,ctx:T}),l.$set(F);const j={};P&134217728&&(j.$$scope={dirty:P,ctx:T}),u.$set(j);const z={};!p&&P&1&&(p=!0,z.value=T[0].name,pe(()=>p=!1)),c.$set(z),T[3]?I?(I.p(T,P),P&8&&m(I,1)):(I=g4(T),I.c(),m(I,1),I.m(o,null)):I&&(te(),_(I,1,1,()=>{I=null}),ne()),T[9]?O?(O.p(T,P),P&512&&m(O,1)):(O=h4(T),O.c(),m(O,1),O.m(h.parentNode,h)):O&&(te(),_(O,1,1,()=>{O=null}),ne())},i(T){v||(m(e.$$.fragment,T),m(n.$$.fragment,T),m(l.$$.fragment,T),m(u.$$.fragment,T),m(c.$$.fragment,T),m(I),m(O),v=!0)},o(T){_(e.$$.fragment,T),_(n.$$.fragment,T),_(l.$$.fragment,T),_(u.$$.fragment,T),_(c.$$.fragment,T),_(I),_(O),v=!1},d(T){E(e,T),T&&b(t),E(n,T),T&&b(i),E(l,T),T&&b(s),T&&b(o),E(u),E(c),I&&I.d(),T&&b(g),O&&O.d(T),T&&b(h)}}}function FF(r){let e,t;return e=new Qe({props:{gap:"S",noPadding:!0,$$slots:{default:[UF]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&134218751&&(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)}}}const VF="https://docs.budibase.com/docs/transformers";function HF(r,e,t){let n,i,l,s,o,a,u,f,c,p;ue(r,qt,U=>t(26,f=U)),ue(r,Ql,U=>t(16,c=U)),ue(r,en,U=>t(17,p=U));let{query:d}=e,g=(d==null?void 0:d.schema)?o4(d.schema):[],h,v=[],k;d&&!d.transformer&&(d.transformer="return data");function C(){d.fields.extra&&t(0,d.fields.extra={},d)}function I(U){t(0,d.fields.extra=U,d)}async function O(){try{const U=await kn.preview(d);if(U.rows.length===0){we.info("Query results empty. Please execute a query with results to create your schema.");return}t(2,v=U.rows),t(1,g=U.schema),we.success("Query executed successfully")}catch{we.error("Error previewing query")}}async function T(){try{const{_id:U}=await kn.save(d.datasourceId,d);t(7,k=U),we.success("Query saved successfully."),f(`../${U}`)}catch{we.error("Error creating query")}}function P(U){r.$$.not_equal(d.name,U)&&(d.name=U,t(0,d),t(1,g))}const M=U=>{var W;return((W=s[U])==null?void 0:W.displayName)||Sr(U)};function F(U){r.$$.not_equal(d.queryVerb,U)&&(d.queryVerb=U,t(0,d),t(1,g))}function j(U){r.$$.not_equal(d.parameters,U)&&(d.parameters=U,t(0,d),t(1,g))}function z(U){h=U,t(6,h)}const q=()=>window.open(VF),H=U=>t(0,d.transformer=U.detail,d);function Y(U){g=U,t(1,g)}return r.$$set=U=>{"query"in U&&t(0,d=U.query)},r.$$.update=()=>{r.$$.dirty&2&&t(0,d.schema=a4(g),d),r.$$.dirty&131073&&t(5,n=p.list.find(U=>U._id===d.datasourceId)),r.$$.dirty&32&&t(15,i=n==null?void 0:n.source),r.$$.dirty&98304&&t(4,l=i?c[i]:null),r.$$.dirty&16&&t(3,s=l==null?void 0:l.query),r.$$.dirty&9&&t(9,o=s&&d.queryVerb),r.$$.dirty&1&&t(14,a=d.queryVerb==="read"||d.readable),r.$$.dirty&16389&&t(8,u=!d.name||a&&v.length===0)},[d,g,v,s,l,n,h,k,u,o,C,I,O,T,a,i,c,p,P,M,F,j,z,q,H,Y]}class WF extends ie{constructor(e){super();le(this,e,HF,FF,re,{query:0})}}function b4(r){let e,t;return e=new WF({props:{query:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.query=n[0]),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 GF(r){let e,t,n,i=r[1]._id&&r[0]&&b4(r);return{c(){e=D("section"),t=D("div"),i&&i.c(),w(t,"class","inner svelte-1cfdofs")},m(l,s){$(l,e,s),N(e,t),i&&i.m(t,null),n=!0},p(l,[s]){l[1]._id&&l[0]?i?(i.p(l,s),s&3&&m(i,1)):(i=b4(l),i.c(),m(i,1),i.m(t,null)):i&&(te(),_(i,1,1,()=>{i=null}),ne())},i(l){n||(m(i),n=!0)},o(l){_(i),n=!1},d(l){l&&b(e),i&&i.d()}}}function YF(r,e,t){let n,i,l,s,o;ue(r,er,f=>t(3,n=f)),ue(r,qt,f=>t(4,i=f)),ue(r,en,f=>t(5,l=f)),ue(r,kn,f=>t(6,s=f)),ue(r,ys,f=>t(1,o=f));let a,u;return r.$$.update=()=>{r.$$.dirty&72&&t(0,a=s.list.find(f=>f._id===s.selected)||{datasourceId:n.selectedDatasource,parameters:[],fields:{},queryVerb:"read"}),r.$$.dirty&40&&t(2,u=l.list.find(f=>f._id===n.selectedDatasource)),r.$$.dirty&28&&(u==null?void 0:u.source)===yn.REST&&i(`../rest/${n.query}`)},[a,o,u,n,i,l,s]}class JF extends ie{constructor(e){super();le(this,e,YF,GF,re,{})}}function QF(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function XF(r,e,t){let n,i,l,s;ue(r,er,c=>t(3,n=c)),ue(r,qt,c=>t(4,i=c)),ue(r,en,c=>t(5,l=c)),ue(r,kn,c=>t(6,s=c));let{$$slots:o={},$$scope:a}=e,u;if(n.query){const c=s.list.find(p=>p._id===n.query);c&&(kn.select(c),u=c.datasourceId)}const f=l.list.find(c=>c._id===l.selected||c._id===u);return(f==null?void 0:f.source)===yn.REST&&i(`../rest/${n.query}`),r.$$set=c=>{"$$scope"in c&&t(0,a=c.$$scope)},[a,o]}class KF extends ie{constructor(e){super();le(this,e,XF,QF,re,{})}}function v4(r,e,t){const n=r.slice();return n[18]=e[t],n[19]=e,n[20]=t,n}function w4(r){let e,t,n,i,l,s;t=new Ze({props:{$$slots:{default:[ZF]},$$scope:{ctx:r}}});function o(u){r[7](u)}let a={};return r[0].name!==void 0&&(a.value=r[0].name),i=new tt({props:a}),K.push(()=>ce(i,"value",o)),i.$on("change",r[8]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),w(e,"class","form-row svelte-13q83tn")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),A(i,e,null),s=!0},p(u,f){const c={};f&2097152&&(c.$$scope={dirty:f,ctx:u}),t.$set(c);const p={};!l&&f&1&&(l=!0,p.value=u[0].name,pe(()=>l=!1)),i.$set(p)},i(u){s||(m(t.$$.fragment,u),m(i.$$.fragment,u),s=!0)},o(u){_(t.$$.fragment,u),_(i.$$.fragment,u),s=!1},d(u){u&&b(e),E(t),E(i)}}}function ZF(r){let e;return{c(){e=V("Name")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function xF(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[rV]},$$scope:{ctx:r}}});function a(f){r[15](f,r[18])}let u={type:r[1][r[18]].type};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new tt({props:u}),K.push(()=>ce(i,"value",a)),i.$on("change",r[16]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};c&18&&(d.type=r[1][r[18]].type),!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function eV(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[iV]},$$scope:{ctx:r}}});function a(f){r[13](f,r[18])}let u={type:r[1][r[18]].type};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new pi({props:u}),K.push(()=>ce(i,"value",a)),i.$on("change",r[14]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};c&18&&(d.type=r[1][r[18]].type),!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function tV(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[lV]},$$scope:{ctx:r}}});function a(f){r[12](f,r[18])}let u={text:""};return r[5][r[18]]!==void 0&&(u.value=r[5][r[18]]),i=new Vn({props:u}),K.push(()=>ce(i,"value",a)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),w(e,"class","form-row svelte-13q83tn")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),A(i,e,null),N(e,s),o=!0},p(f,c){r=f;const p={};c&2097168&&(p.$$scope={dirty:c,ctx:r}),t.$set(p);const d={};!l&&c&48&&(l=!0,d.value=r[5][r[18]],pe(()=>l=!1)),i.$set(d)},i(f){o||(m(t.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(t.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){f&&b(e),E(t),E(i)}}}function nV(r){let e,t,n,i,l,s,o,a;t=new Ze({props:{$$slots:{default:[sV]},$$scope:{ctx:r}}}),i=new gt({props:{secondary:!0,thin:!0,outline:!0,$$slots:{default:[oV]},$$scope:{ctx:r}}}),i.$on("click",function(){mt(r[3].addEntry())&&r[3].addEntry().apply(this,arguments)});function u(c){r[10](c,r[18])}let f={defaults:r[1][r[18]].default,noAddButton:!0};return r[5][r[18]]!==void 0&&(f.object=r[5][r[18]]),s=new vi({props:f}),r[9](s),K.push(()=>ce(s,"object",u)),s.$on("change",r[11]),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","form-row ssl svelte-13q83tn")},m(c,p){$(c,e,p),A(t,e,null),N(e,n),A(i,e,null),$(c,l,p),A(s,c,p),a=!0},p(c,p){r=c;const d={};p&2097168&&(d.$$scope={dirty:p,ctx:r}),t.$set(d);const g={};p&2097152&&(g.$$scope={dirty:p,ctx:r}),i.$set(g);const h={};p&18&&(h.defaults=r[1][r[18]].default),!o&&p&48&&(o=!0,h.object=r[5][r[18]],pe(()=>o=!1)),s.$set(h)},i(c){a||(m(t.$$.fragment,c),m(i.$$.fragment,c),m(s.$$.fragment,c),a=!0)},o(c){_(t.$$.fragment,c),_(i.$$.fragment,c),_(s.$$.fragment,c),a=!1},d(c){c&&b(e),E(t),E(i),c&&b(l),r[9](null),E(s,c)}}}function rV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function iV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function lV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function sV(r){let e=r[6](r[18])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&16&&e!==(e=n[6](n[18])+"")&&Te(t,e)},d(n){n&&b(t)}}}function oV(r){let e;return{c(){e=V("Add")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function y4(r){let e,t,n,i;const l=[nV,tV,eV,xF],s=[];function o(a,u){return a[1][a[18]].type==="object"?0:a[1][a[18]].type==="boolean"?1:a[1][a[18]].type==="longForm"?2:3}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function aV(r){let e,t,n,i=!r[2]&&w4(r),l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=y4(v4(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){i&&i.c(),e=R();for(let a=0;a<s.length;a+=1)s[a].c();t=Ee()},m(a,u){i&&i.m(a,u),$(a,e,u);for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,t,u),n=!0},p(a,u){if(a[2]?i&&(te(),_(i,1,1,()=>{i=null}),ne()):i?(i.p(a,u),u&4&&m(i,1)):(i=w4(a),i.c(),m(i,1),i.m(e.parentNode,e)),u&122){l=a[4];let f;for(f=0;f<l.length;f+=1){const c=v4(a,l,f);s[f]?(s[f].p(c,u),m(s[f],1)):(s[f]=y4(c),s[f].c(),m(s[f],1),s[f].m(t.parentNode,t))}for(te(),f=l.length;f<s.length;f+=1)o(f);ne()}},i(a){if(!n){m(i);for(let u=0;u<l.length;u+=1)m(s[u]);n=!0}},o(a){_(i),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);n=!1},d(a){i&&i.d(a),a&&b(e),$t(s,a),a&&b(t)}}}function uV(r){let e,t,n;return t=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[aV]},$$scope:{ctx:r}}}),{c(){e=D("form"),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,[l]){const s={};l&2097215&&(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 fV(r,e,t){let n,i,{datasource:l}=e,{schema:s}=e,{creating:o}=e;function a([T,P]){return P?!(l.source===yn.REST&&T==="defaultHeaders"||P.deprecated):!1}let u;function f(T){var M;let P;return((M=s[T])==null?void 0:M.display)?P=s[T].display:P=T,Sr(P)}function c(T){r.$$.not_equal(l.name,T)&&(l.name=T,t(0,l))}function p(T){ft.call(this,r,T)}function d(T){K[T?"unshift":"push"](()=>{u=T,t(3,u)})}function g(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function h(T){ft.call(this,r,T)}function v(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function k(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function C(T){ft.call(this,r,T)}function I(T,P){r.$$.not_equal(n[P],T)&&(n[P]=T,t(5,n),t(0,l))}function O(T){ft.call(this,r,T)}return r.$$set=T=>{"datasource"in T&&t(0,l=T.datasource),"schema"in T&&t(1,s=T.schema),"creating"in T&&t(2,o=T.creating)},r.$$.update=()=>{r.$$.dirty&1&&t(5,n=l==null?void 0:l.config),r.$$.dirty&2&&t(4,i=Object.entries(s||{}).filter(T=>a(T)).map(([T])=>T))},[l,s,o,u,i,n,f,c,p,d,g,h,v,k,C,I,O]}class k4 extends ie{constructor(e){super();le(this,e,fV,uV,re,{datasource:0,schema:1,creating:2})}}const wi={BASIC:"basic",BEARER:"bearer"},C4=[{label:"Basic Auth",value:wi.BASIC},{label:"Bearer Token",value:wi.BEARER}];function cV(r){let e=r[1](r[0])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,[i]){i&1&&e!==(e=n[1](n[0])+"")&&Te(t,e)},i:Oe,o:Oe,d(n){n&&b(t)}}}function pV(r,e,t){let{value:n}=e;const i=l=>C4.filter(s=>s.value===l).map(s=>s.label);return r.$$set=l=>{"value"in l&&t(0,n=l.value)},[n,i]}class dV extends ie{constructor(e){super();le(this,e,pV,cV,re,{value:0})}}function mV(r){let e;return{c(){e=V(`The authorization header will be automatically generated when you send the
|
|
397
397
|
request.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function S4(r){let e,t,n,i,l,s;function o(c){r[15](c)}let a={label:"Username",error:r[4].basic.username?r[3].basic.username:null};r[2].basic.username!==void 0&&(a.value=r[2].basic.username),e=new tt({props:a}),K.push(()=>ce(e,"value",o)),e.$on("change",r[7]),e.$on("blur",r[16]);function u(c){r[17](c)}let f={label:"Password",error:r[4].basic.password?r[3].basic.password:null};return r[2].basic.password!==void 0&&(f.value=r[2].basic.password),i=new tt({props:f}),K.push(()=>ce(i,"value",u)),i.$on("change",r[7]),i.$on("blur",r[18]),{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment)},m(c,p){A(e,c,p),$(c,n,p),A(i,c,p),s=!0},p(c,p){const d={};p&24&&(d.error=c[4].basic.username?c[3].basic.username:null),!t&&p&4&&(t=!0,d.value=c[2].basic.username,pe(()=>t=!1)),e.$set(d);const g={};p&24&&(g.error=c[4].basic.password?c[3].basic.password:null),!l&&p&4&&(l=!0,g.value=c[2].basic.password,pe(()=>l=!1)),i.$set(g)},i(c){s||(m(e.$$.fragment,c),m(i.$$.fragment,c),s=!0)},o(c){_(e.$$.fragment,c),_(i.$$.fragment,c),s=!1},d(c){E(e,c),c&&b(n),E(i,c)}}}function A4(r){let e,t,n;function i(s){r[19](s)}let l={label:"Token",error:r[4].bearer.token?r[3].bearer.token:null};return r[2].bearer.token!==void 0&&(l.value=r[2].bearer.token),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),e.$on("change",r[7]),e.$on("blur",r[20]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o&24&&(a.error=s[4].bearer.token?s[3].bearer.token:null),!t&&o&4&&(t=!0,a.value=s[2].bearer.token,pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function gV(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ke({props:{size:"S",$$slots:{default:[mV]},$$scope:{ctx:r}}});function p(C){r[11](C)}let d={label:"Name",error:r[4].name?r[3].name:null};r[2].name!==void 0&&(d.value=r[2].name),n=new tt({props:d}),K.push(()=>ce(n,"value",p)),n.$on("change",r[7]),n.$on("blur",r[12]);function g(C){r[13](C)}let h={label:"Type",options:C4,error:r[4].type?r[3].type:null};r[2].type!==void 0&&(h.value=r[2].type),s=new Xe({props:h}),K.push(()=>ce(s,"value",g)),s.$on("change",r[7]),s.$on("blur",r[14]);let v=r[2].type===wi.BASIC&&S4(r),k=r[2].type===wi.BEARER&&A4(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),l=R(),S(s.$$.fragment),a=R(),v&&v.c(),u=R(),k&&k.c(),f=Ee()},m(C,I){A(e,C,I),$(C,t,I),A(n,C,I),$(C,l,I),A(s,C,I),$(C,a,I),v&&v.m(C,I),$(C,u,I),k&&k.m(C,I),$(C,f,I),c=!0},p(C,I){const O={};I&33554432&&(O.$$scope={dirty:I,ctx:C}),e.$set(O);const T={};I&24&&(T.error=C[4].name?C[3].name:null),!i&&I&4&&(i=!0,T.value=C[2].name,pe(()=>i=!1)),n.$set(T);const P={};I&24&&(P.error=C[4].type?C[3].type:null),!o&&I&4&&(o=!0,P.value=C[2].type,pe(()=>o=!1)),s.$set(P),C[2].type===wi.BASIC?v?(v.p(C,I),I&4&&m(v,1)):(v=S4(C),v.c(),m(v,1),v.m(u.parentNode,u)):v&&(te(),_(v,1,1,()=>{v=null}),ne()),C[2].type===wi.BEARER?k?(k.p(C,I),I&4&&m(k,1)):(k=A4(C),k.c(),m(k,1),k.m(f.parentNode,f)):k&&(te(),_(k,1,1,()=>{k=null}),ne())},i(C){c||(m(e.$$.fragment,C),m(n.$$.fragment,C),m(s.$$.fragment,C),m(v),m(k),c=!0)},o(C){_(e.$$.fragment,C),_(n.$$.fragment,C),_(s.$$.fragment,C),_(v),_(k),c=!1},d(C){E(e,C),C&&b(t),E(n,C),C&&b(l),E(s,C),C&&b(a),v&&v.d(C),C&&b(u),k&&k.d(C),C&&b(f)}}}function _V(r){let e,t;return e=new Qe({props:{gap:"S",$$slots:{default:[gV]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&33554460&&(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 hV(r){let e,t;return e=new Dt({props:{title:r[0]?"Update Authentication":"Add Authentication",onConfirm:r[8],confirmText:r[0]?"Update":"Add",disabled:r[5]||!r[6],cancelText:"Cancel",size:"M",showSecondaryButton:!!r[0],secondaryButtonText:"Remove",secondaryAction:r[1],secondaryButtonWarning:!0,$$slots:{default:[_V]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.title=n[0]?"Update Authentication":"Add Authentication"),i&1&&(l.confirmText=n[0]?"Update":"Add"),i&96&&(l.disabled=n[5]||!n[6]),i&1&&(l.showSecondaryButton=!!n[0]),i&2&&(l.secondaryAction=n[1]),i&33554460&&(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 $V(r,e,t){let{configs:n}=e,{currentConfig:i}=e,{onConfirm:l}=e,{onRemove:s}=e,o={basic:{},bearer:{}},a={basic:{},bearer:{}},u={basic:{},bearer:{}},f=!1,c=!1;Gt(()=>{i&&p()});const p=()=>{t(2,o.name=i.name,o),t(2,o.type=i.type,o),i.type===wi.BASIC?t(2,o.basic=Se({},i.config),o):i.type===wi.BEARER&&t(2,o.bearer=Se({},i.config),o)},d=()=>{const H={name:o.name,type:o.type};return i&&(H._id=i._id),o.type===wi.BASIC?H.config=Se({},o.basic):o.type===wi.BEARER&&(H.config=Se({},o.bearer)),H},g=()=>{i?t(6,c=JSON.stringify(i)!==JSON.stringify(d())):t(6,c=!0)},h=()=>{t(5,f=!1);const H=()=>(o.name?t(3,a.name=n.find(Q=>Q.name===o.name&&Q.name!==(i==null?void 0:i.name))!==void 0?"Name must be unique":null,a):t(3,a.name="Name is required",a),!!a.name),Y=()=>(t(3,a.type=o.type?null:"Type is required",a),!!a.type),U=()=>(t(3,a.basic.username=o.basic.username?null:"Username is required",a),t(3,a.basic.password=o.basic.password?null:"Password is required",a),!!(a.basic.username||a.basic.password||G)),W=()=>(t(3,a.bearer.token=o.bearer.token?null:"Token is required",a),!!(a.bearer.token||G)),G=H()||Y();o.type===wi.BASIC?t(5,f=U()||G):o.type===wi.BEARER?t(5,f=W()||G):t(5,f=!!G)},v=()=>{h(),g()},k=()=>{l(d())};function C(H){r.$$.not_equal(o.name,H)&&(o.name=H,t(2,o))}const I=()=>t(4,u.name=!0,u);function O(H){r.$$.not_equal(o.type,H)&&(o.type=H,t(2,o))}const T=()=>t(4,u.type=!0,u);function P(H){r.$$.not_equal(o.basic.username,H)&&(o.basic.username=H,t(2,o))}const M=()=>t(4,u.basic.username=!0,u);function F(H){r.$$.not_equal(o.basic.password,H)&&(o.basic.password=H,t(2,o))}const j=()=>t(4,u.basic.password=!0,u);function z(H){r.$$.not_equal(o.bearer.token,H)&&(o.bearer.token=H,t(2,o))}const q=()=>t(4,u.bearer.token=!0,u);return r.$$set=H=>{"configs"in H&&t(9,n=H.configs),"currentConfig"in H&&t(0,i=H.currentConfig),"onConfirm"in H&&t(10,l=H.onConfirm),"onRemove"in H&&t(1,s=H.onRemove)},[i,s,o,a,u,f,c,v,k,n,l,C,I,O,T,P,M,F,j,z,q]}class bV extends ie{constructor(e){super();le(this,e,$V,hV,re,{configs:9,currentConfig:0,onConfirm:10,onRemove:1})}}function vV(r){let e,t;return e=new bV({props:{configs:r[0],currentConfig:r[1],onConfirm:r[5],onRemove:r[6]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.configs=n[0]),i&2&&(l.currentConfig=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 E4(r){let e,t;return e=new Ni({props:{schema:r[3],data:r[0],allowEditColumns:!1,allowEditRows:!1,allowSelectRows:!1,customRenderers:[{column:"type",component:dV}]}}),e.$on("click",r[8]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.data=n[0]),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 wV(r){let e;return{c(){e=V("Add authentication")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function yV(r){let e,t,n,i,l=r[0]&&r[0].length>0&&E4(r);return n=new Jt({props:{icon:"Add",$$slots:{default:[wV]},$$scope:{ctx:r}}}),n.$on("click",r[9]),{c(){l&&l.c(),e=R(),t=D("div"),S(n.$$.fragment)},m(s,o){l&&l.m(s,o),$(s,e,o),$(s,t,o),A(n,t,null),i=!0},p(s,o){s[0]&&s[0].length>0?l?(l.p(s,o),o&1&&m(l,1)):(l=E4(s),l.c(),m(l,1),l.m(e.parentNode,e)):l&&(te(),_(l,1,1,()=>{l=null}),ne());const a={};o&1024&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(m(l),m(n.$$.fragment,s),i=!0)},o(s){_(l),_(n.$$.fragment,s),i=!1},d(s){l&&l.d(s),s&&b(e),s&&b(t),E(n)}}}function kV(r){let e,t,n,i,l={$$slots:{default:[vV]},$$scope:{ctx:r}};return e=new Et({props:l}),r[7](e),n=new Qe({props:{gap:"S",noPadding:!0,$$slots:{default:[yV]},$$scope:{ctx:r}}}),{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&1027&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&1025&&(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){r[7](null),E(e,s),s&&b(t),E(n,s)}}}function CV(r,e,t){let{configs:n=[]}=e,i=null,l;const s={name:"",type:""},o=d=>{t(1,i=d),l.show()},a=d=>{i?t(0,n=n.map(g=>g._id===i._id?d:g)):(d._id=Fi(),t(0,n=[...n,d]))},u=()=>{t(0,n=n.filter(d=>d._id!==i._id))};function f(d){K[d?"unshift":"push"](()=>{l=d,t(2,l)})}const c=({detail:d})=>o(d),p=()=>o();return r.$$set=d=>{"configs"in d&&t(0,n=d.configs)},[n,i,l,s,o,a,u,f,c,p]}class SV extends ie{constructor(e){super();le(this,e,CV,kV,re,{configs:0})}}function AV(r){let e,t;return e=new Ke({props:{size:"S",$$slots:{default:[OV]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&256&&(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 EV(r){let e,t;return e=new Ni({props:{schema:r[1],data:r[0],allowEditColumns:!1,allowEditRows:!1,allowSelectRows:!1,customRenderers:[{column:"name",component:wD},{column:"value",component:CD}]}}),e.$on("click",r[5]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.data=n[0]),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 OV(r){let e;return{c(){e=D("i"),e.textContent="No dynamic variables specified."},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function TV(r){let e,t,n,i;const l=[EV,AV],s=[];function o(a,u){return a[0]&&a[0].length>0?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,[u]){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function IV(r,e,t){let n;ue(r,qt,c=>t(6,n=c));let{datasource:i}=e,{queries:l}=e,s=[];const o={name:"",query:"",value:""},a=c=>{const p=c.queryId;kn.select({_id:p}),n(`./${p}`)};function u(c,p){var d;t(0,s=[]),(d=c.config.dynamicVariables)==null||d.forEach(g=>{const h=p.find(v=>v._id===g.queryId);h&&s.push(lt(Se({},g),{query:h.name}))})}const f=({detail:c})=>a(c);return r.$$set=c=>{"datasource"in c&&t(3,i=c.datasource),"queries"in c&&t(4,l=c.queries)},r.$$.update=()=>{r.$$.dirty&24&&u(i,l)},[s,o,a,i,l,f]}class LV extends ie{constructor(e){super();le(this,e,IV,TV,re,{datasource:3,queries:4})}}function PV(r){let e;return{c(){e=V("Headers")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function NV(r){let e;return{c(){e=V("Optional")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function RV(r){let e;return{c(){e=V(`Headers enable you to provide additional information about the request, such
|
|
398
398
|
as format.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function MV(r){let e;return{c(){e=V("Add header")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function DV(r){let e;return{c(){e=V("Authentication")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function jV(r){let e;return{c(){e=V("Optional")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function BV(r){let e;return{c(){e=V("Create an authentication config that can be shared with queries.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function zV(r){let e;return{c(){e=V("Variables")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function qV(r){let e;return{c(){e=V("Optional")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function UV(r){let e;return{c(){e=V(`Variables enable you to store and re-use values in queries, with the choice
|
|
399
399
|
of a static value such as a token using static variables, or a value from a
|
|
@@ -1068,7 +1068,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1068
1068
|
query is a request for data or information from a datasource, for
|
|
1069
1069
|
example a database table.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function z4(r){let e,t,n;return t=new Ni({props:{schema:r[6],data:r[4],allowEditColumns:!1,allowEditRows:!1,allowSelectRows:!1,customRenderers:[{column:"queryVerb",component:TW}]}}),t.$on("click",r[18]),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","query-list svelte-tcikq3")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&16&&(s.data=i[4]),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 q4(r){let e,t,n;function i(s){r[19](s)}let l={queries:r[4]};return r[0]!==void 0&&(l.datasource=r[0]),e=new JV({props:l}),K.push(()=>ce(e,"datasource",i)),e.$on("change",r[7]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o&16&&(a.queries=s[4]),!t&&o&1&&(t=!0,a.datasource=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function QW(r){var fe,Z;let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q;e=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[FW]},$$scope:{ctx:r}}}),n=new pn({props:{size:"S"}}),s=new Ct({props:{size:"S",$$slots:{default:[VW]},$$scope:{ctx:r}}}),a=new gt({props:{disabled:!r[2],cta:!0,$$slots:{default:[HW]},$$scope:{ctx:r}}}),a.$on("click",r[8]);function H(ee){r[14](ee)}let Y={schema:r[3].datasource};r[0]!==void 0&&(Y.datasource=r[0]),f=new k4({props:Y}),K.push(()=>ce(f,"datasource",H)),f.$on("change",r[7]);let U=r[0].plus&&j4(r);g=new pn({props:{size:"S"}}),k=new Ct({props:{size:"S",$$slots:{default:[WW]},$$scope:{ctx:r}}});let W=((fe=r[0])==null?void 0:fe.source)===yn.REST&&B4(r);T=new gt({props:{cta:!0,icon:"Add",$$slots:{default:[YW]},$$scope:{ctx:r}}}),T.$on("click",r[17]),M=new Ke({props:{size:"S",$$slots:{default:[JW]},$$scope:{ctx:r}}});let G=r[4]&&r[4].length>0&&z4(r),Q=((Z=r[0])==null?void 0:Z.source)===yn.REST&&q4(r);return{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),l=D("div"),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),S(f.$$.fragment),p=R(),U&&U.c(),d=R(),S(g.$$.fragment),h=R(),v=D("div"),S(k.$$.fragment),C=R(),I=D("div"),W&&W.c(),O=R(),S(T.$$.fragment),P=R(),S(M.$$.fragment),F=R(),G&&G.c(),j=R(),Q&&Q.c(),z=Ee(),w(l,"class","config-header svelte-tcikq3"),w(I,"class","query-buttons svelte-tcikq3"),w(v,"class","query-header svelte-tcikq3")},m(ee,ae){A(e,ee,ae),$(ee,t,ae),A(n,ee,ae),$(ee,i,ae),$(ee,l,ae),A(s,l,null),N(l,o),A(a,l,null),$(ee,u,ae),A(f,ee,ae),$(ee,p,ae),U&&U.m(ee,ae),$(ee,d,ae),A(g,ee,ae),$(ee,h,ae),$(ee,v,ae),A(k,v,null),N(v,C),N(v,I),W&&W.m(I,null),N(I,O),A(T,I,null),$(ee,P,ae),A(M,ee,ae),$(ee,F,ae),G&&G.m(ee,ae),$(ee,j,ae),Q&&Q.m(ee,ae),$(ee,z,ae),q=!0},p(ee,ae){var se,Ce;const _e={};ae&4194313&&(_e.$$scope={dirty:ae,ctx:ee}),e.$set(_e);const Re={};ae&4194304&&(Re.$$scope={dirty:ae,ctx:ee}),s.$set(Re);const $e={};ae&4&&($e.disabled=!ee[2]),ae&4194304&&($e.$$scope={dirty:ae,ctx:ee}),a.$set($e);const be={};ae&8&&(be.schema=ee[3].datasource),!c&&ae&1&&(c=!0,be.datasource=ee[0],pe(()=>c=!1)),f.$set(be),ee[0].plus?U?(U.p(ee,ae),ae&1&&m(U,1)):(U=j4(ee),U.c(),m(U,1),U.m(d.parentNode,d)):U&&(te(),_(U,1,1,()=>{U=null}),ne());const he={};ae&4194304&&(he.$$scope={dirty:ae,ctx:ee}),k.$set(he),((se=ee[0])==null?void 0:se.source)===yn.REST?W?(W.p(ee,ae),ae&1&&m(W,1)):(W=B4(ee),W.c(),m(W,1),W.m(I,O)):W&&(te(),_(W,1,1,()=>{W=null}),ne());const Ne={};ae&4194304&&(Ne.$$scope={dirty:ae,ctx:ee}),T.$set(Ne);const Fe={};ae&4194304&&(Fe.$$scope={dirty:ae,ctx:ee}),M.$set(Fe),ee[4]&&ee[4].length>0?G?(G.p(ee,ae),ae&16&&m(G,1)):(G=z4(ee),G.c(),m(G,1),G.m(j.parentNode,j)):G&&(te(),_(G,1,1,()=>{G=null}),ne()),((Ce=ee[0])==null?void 0:Ce.source)===yn.REST?Q?(Q.p(ee,ae),ae&1&&m(Q,1)):(Q=q4(ee),Q.c(),m(Q,1),Q.m(z.parentNode,z)):Q&&(te(),_(Q,1,1,()=>{Q=null}),ne())},i(ee){q||(m(e.$$.fragment,ee),m(n.$$.fragment,ee),m(s.$$.fragment,ee),m(a.$$.fragment,ee),m(f.$$.fragment,ee),m(U),m(g.$$.fragment,ee),m(k.$$.fragment,ee),m(W),m(T.$$.fragment,ee),m(M.$$.fragment,ee),m(G),m(Q),q=!0)},o(ee){_(e.$$.fragment,ee),_(n.$$.fragment,ee),_(s.$$.fragment,ee),_(a.$$.fragment,ee),_(f.$$.fragment,ee),_(U),_(g.$$.fragment,ee),_(k.$$.fragment,ee),_(W),_(T.$$.fragment,ee),_(M.$$.fragment,ee),_(G),_(Q),q=!1},d(ee){E(e,ee),ee&&b(t),E(n,ee),ee&&b(i),ee&&b(l),E(s),E(a),ee&&b(u),E(f,ee),ee&&b(p),U&&U.d(ee),ee&&b(d),E(g,ee),ee&&b(h),ee&&b(v),E(k),W&&W.d(),E(T),ee&&b(P),E(M,ee),ee&&b(F),G&&G.d(ee),ee&&b(j),Q&&Q.d(ee),ee&&b(z)}}}function XW(r){let e,t,n,i,l={$$slots:{default:[zW]},$$scope:{ctx:r}};e=new Et({props:l}),r[13](e);let s=r[0]&&r[3]&&D4(r);return{c(){S(e.$$.fragment),t=R(),s&&s.c(),n=Ee()},m(o,a){A(e,o,a),$(o,t,a),s&&s.m(o,a),$(o,n,a),i=!0},p(o,[a]){const u={};a&4194305&&(u.$$scope={dirty:a,ctx:o}),e.$set(u),o[0]&&o[3]?s?(s.p(o,a),a&9&&m(s,1)):(s=D4(o),s.c(),m(s,1),s.m(n.parentNode,n)):s&&(te(),_(s,1,1,()=>{s=null}),ne())},i(o){i||(m(e.$$.fragment,o),m(s),i=!0)},o(o){_(e.$$.fragment,o),_(s),i=!1},d(o){r[13](null),E(e,o),o&&b(t),s&&s.d(o),o&&b(n)}}}function KW(r,e,t){let n,i,l,s;ue(r,Ql,j=>t(20,n=j)),ue(r,qt,j=>t(5,i=j)),ue(r,kn,j=>t(11,l=j)),ue(r,en,j=>t(12,s=j));let o,a,u,f,c,p;const d={name:{},queryVerb:{displayName:"Method"}};function g(j,z){j&&z&&t(2,a=!jl.exports.isEqual(j,z))}async function h(){try{await en.save(c),(c==null?void 0:c.plus)&&await Ot.fetch(),await en.fetch(),we.success(`Datasource ${name} updated successfully.`),t(10,f=vn.cloneDeep(c))}catch(j){we.error(`Error saving datasource: ${j}`)}}function v(j){kn.select(j),i(`./${j._id}`)}function k(j){j&&(t(0,c=vn.cloneDeep(j)),t(3,u=n[c.source]))}function C(j){K[j?"unshift":"push"](()=>{o=j,t(1,o)})}function I(j){c=j,t(0,c)}function O(j){c=j,t(0,c)}const T=()=>o.show(),P=()=>i("./new"),M=({detail:j})=>v(j);function F(j){c=j,t(0,c)}return r.$$.update=()=>{r.$$.dirty&4096&&t(10,f=s.list.find(j=>j._id===s.selected)),r.$$.dirty&2049&&t(4,p=l.list.filter(j=>j.datasourceId===(c==null?void 0:c._id))),r.$$.dirty&1025&&g(f,c),r.$$.dirty&1024&&k(f)},[c,o,a,u,p,i,d,g,h,v,f,l,s,C,I,O,T,P,M,F]}class ZW extends ie{constructor(e){super();le(this,e,KW,XW,re,{})}}function xW(r){let e,t,n,i,l,s;function o(u){r[8](u)}let a={placeholder:r[1]};return r[0]!==void 0&&(a.value=r[0]),t=new tt({props:a}),K.push(()=>ce(t,"value",o)),t.$on("change",r[9]),l=new ct({props:{name:"SaveFloppy",hoverable:!0,size:"S"}}),l.$on("click",r[10]),{c(){e=D("div"),S(t.$$.fragment),i=R(),S(l.$$.fragment),w(e,"class","input svelte-1wbewzp")},m(u,f){$(u,e,f),A(t,e,null),$(u,i,f),A(l,u,f),s=!0},p(u,f){const c={};f&2&&(c.placeholder=u[1]),!n&&f&1&&(n=!0,c.value=u[0],pe(()=>n=!1)),t.$set(c)},i(u){s||(m(t.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(t.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){u&&b(e),E(t),u&&b(i),E(l,u)}}}function eG(r){let e,t,n,i,l,s;const o=[rG,nG,tG],a=[];function u(f,c){return f[2]==="heading"?0:f[2]==="body"?1:2}return e=u(r),t=a[e]=o[e](r),l=new ct({props:{name:"Edit",hoverable:!0,size:"S"}}),l.$on("click",r[7]),{c(){t.c(),n=R(),i=D("div"),S(l.$$.fragment),w(i,"class","hide svelte-1wbewzp")},m(f,c){a[e].m(f,c),$(f,n,c),$(f,i,c),A(l,i,null),s=!0},p(f,c){let p=e;e=u(f),e===p?a[e].p(f,c):(te(),_(a[p],1,1,()=>{a[p]=null}),ne(),t=a[e],t?t.p(f,c):(t=a[e]=o[e](f),t.c()),m(t,1),t.m(n.parentNode,n))},i(f){s||(m(t),m(l.$$.fragment,f),s=!0)},o(f){_(t),_(l.$$.fragment,f),s=!1},d(f){a[e].d(f),f&&b(n),f&&b(i),E(l)}}}function tG(r){let e,t;return e=new Ze({props:{size:r[3],$$slots:{default:[iG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.size=n[3]),i&4099&&(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 nG(r){let e,t;return e=new Ke({props:{size:r[3],$$slots:{default:[lG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.size=n[3]),i&4099&&(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 rG(r){let e,t;return e=new Ct({props:{size:r[3],$$slots:{default:[sG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.size=n[3]),i&4099&&(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 iG(r){let e=(r[0]||r[1])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&3&&e!==(e=(n[0]||n[1])+"")&&Te(t,e)},d(n){n&&b(t)}}}function lG(r){let e=(r[0]||r[1])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&3&&e!==(e=(n[0]||n[1])+"")&&Te(t,e)},d(n){n&&b(t)}}}function sG(r){let e=(r[0]||r[1])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&3&&e!==(e=(n[0]||n[1])+"")&&Te(t,e)},d(n){n&&b(t)}}}function oG(r){let e,t,n,i;const l=[eG,xW],s=[];function o(a,u){return a[4]?1:0}return t=o(r),n=s[t]=l[t](r),{c(){e=D("div"),n.c(),w(e,"class","parent svelte-1wbewzp")},m(a,u){$(a,e,u),s[t].m(e,null),i=!0},p(a,[u]){let f=t;t=o(a),t===f?s[t].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),n=s[t],n?n.p(a,u):(n=s[t]=l[t](a),n.c()),m(n,1),n.m(e,null))},i(a){i||(m(n),i=!0)},o(a){_(n),i=!1},d(a){a&&b(e),s[t].d()}}}function aG(r,e,t){let n=ht(),{defaultValue:i=""}=e,{value:l}=e,{type:s="label"}=e,{size:o="M"}=e,a=!1;function u(h){t(4,a=h),a&&n("change")}function f(){n("save",l)}const c=()=>u(!0);function p(h){l=h,t(0,l)}function d(h){ft.call(this,r,h)}const g=()=>{u(!1),f()};return r.$$set=h=>{"defaultValue"in h&&t(1,i=h.defaultValue),"value"in h&&t(0,l=h.value),"type"in h&&t(2,s=h.type),"size"in h&&t(3,o=h.size)},[l,i,s,o,a,u,f,c,p,d,g]}class uG extends ie{constructor(e){super();le(this,e,aG,oG,re,{defaultValue:1,value:0,type:2,size:3})}}function fG(r){let e,t;return e=new Qf({props:{height:200,mode:r[6](r[1]),value:r[2],resize:"vertical"}}),e.$on("change",r[8]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.mode=n[6](n[1])),i&4&&(l.value=n[2]),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 cG(r){let e,t,n;function i(s){r[7](s)}let l={name:"param",headings:!0};return r[3]!==void 0&&(l.object=r[3]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&8&&(t=!0,a.object=s[3],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function pG(r){let e,t,n;return t=new Ke({props:{size:"S",weight:"800",$$slots:{default:[dG]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","none svelte-ly64y9")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&2048&&(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 dG(r){let e;return{c(){e=V("THE REQUEST DOES NOT HAVE A BODY")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function mG(r){let e,t,n,i,l,s;const o=[pG,cG,fG],a=[];function u(f,c){return f[1]===$i.NONE?0:((t==null||c&2)&&(t=!!f[4].includes(f[1])),t?1:((n==null||c&2)&&(n=!!f[5].includes(f[1])),n?2:-1))}return~(i=u(r,-1))&&(l=a[i]=o[i](r)),{c(){e=D("div"),l&&l.c(),w(e,"class","margin svelte-ly64y9")},m(f,c){$(f,e,c),~i&&a[i].m(e,null),s=!0},p(f,[c]){let p=i;i=u(f,c),i===p?~i&&a[i].p(f,c):(l&&(te(),_(a[p],1,1,()=>{a[p]=null}),ne()),~i?(l=a[i],l?l.p(f,c):(l=a[i]=o[i](f),l.c()),m(l,1),l.m(e,null)):l=null)},i(f){s||(m(l),s=!0)},o(f){_(l),s=!1},d(f){f&&b(e),~i&&a[i].d()}}}function gG(r,e,t){const n=[$i.FORM,$i.ENCODED],i=[$i.JSON,$i.XML,$i.TEXT];let{query:l}=e,{bodyType:s}=e,o="",a="";function u(g){if(!s||!l)return;const h=typeof(l==null?void 0:l.fields.requestBody),v=n.includes(g);i.includes(g)&&h==="string"?t(2,o=l.fields.requestBody):v&&h==="object"&&t(3,a=l.fields.requestBody)}function f(g,h,v){g===$i.NONE?t(0,l.fields.requestBody=null,l):n.includes(g)?t(0,l.fields.requestBody=v,l):t(0,l.fields.requestBody=h,l)}function c(g){switch(g){case $i.JSON:return Oa.JSON;case $i.XML:return Oa.XML;default:case $i.TEXT:return Oa.Text}}function p(g){a=g,t(3,a)}const d=g=>t(0,l.fields.requestBody=g.detail,l);return r.$$set=g=>{"query"in g&&t(0,l=g.query),"bodyType"in g&&t(1,s=g.bodyType)},r.$$.update=()=>{r.$$.dirty&2&&u(s),r.$$.dirty&14&&f(s,o,a)},[l,s,o,a,n,i,c,p,d]}class _G extends ie{constructor(e){super();le(this,e,gG,mG,re,{query:0,bodyType:1})}}function hG(r){let e;return{c(){e=V(`Specify a name for your new dynamic variable, this must be unique across
|
|
1070
1070
|
your datasource.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $G(r){let e,t,n,i,l;e=new Ke({props:{size:"S",$$slots:{default:[hG]},$$scope:{ctx:r}}});function s(a){r[10](a)}let o={label:"Variable name",error:r[3]};return r[0]!==void 0&&(o.value=r[0]),n=new tt({props:o}),K.push(()=>ce(n,"value",s)),n.$on("input",r[11]),{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&32768&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u&8&&(c.error=a[3]),!i&&u&1&&(i=!0,c.value=a[0],pe(()=>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 bG(r){let e,t;return e=new Dt({props:{title:"Add dynamic variable",confirmText:"Save",onConfirm:r[4],disabled:!r[1],$$slots:{default:[$G]},$$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]),i&32777&&(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 vG(r){let e,t,n={$$slots:{default:[bG]},$$scope:{ctx:r}};return e=new Et({props:n}),r[12](e),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){const s={};l&32779&&(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[12](null),E(e,i)}}}function wG(r,e,t){let n,{dynamicVariables:i}=e,{datasource:l}=e,{binding:s}=e,o,a,u,f;const c=()=>{a.show()},p=()=>{a.hide()};function d(C,I){return I?!f.find(O=>O.toLowerCase()===I.toLowerCase()):!1}async function g(){const C=o,I=s;t(0,o=null),t(6,s=null),t(5,i[C]=I,i)}function h(C){o=C,t(0,o)}function v(C){ft.call(this,r,C)}function k(C){K[C?"unshift":"push"](()=>{a=C,t(2,a)})}return r.$$set=C=>{"dynamicVariables"in C&&t(5,i=C.dynamicVariables),"datasource"in C&&t(7,l=C.datasource),"binding"in C&&t(6,s=C.binding)},r.$$.update=()=>{var C;r.$$.dirty&33&&t(1,u=d(i,o)),r.$$.dirty&128&&(f=(((C=l==null?void 0:l.config)==null?void 0:C.dynamicVariables)||[]).map(I=>I.name)),r.$$.dirty&3&&t(3,n=o&&!u?"Variable name is already in use.":null)},[o,u,a,n,g,i,s,l,c,p,h,v,k]}class yG extends ie{constructor(e){super();le(this,e,wG,vG,re,{dynamicVariables:5,datasource:7,binding:6,show:8,hide:9})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[9]}}var kG="/builder/assets/bb-spaceship.8f6e81e1.svg";function U4(r){let e,t,n,i,l,s,o;return n=new Qe({props:{gap:"S",$$slots:{default:[DG]},$$scope:{ctx:r}}}),s=new Qe({props:{paddingY:"S",gap:"S",$$slots:{default:[xG]},$$scope:{ctx:r}}}),{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("div"),S(s.$$.fragment),w(t,"class","top svelte-1ba99n2"),w(l,"class","bottom svelte-1ba99n2"),w(e,"class","inner svelte-1ba99n2")},m(a,u){$(a,e,u),N(e,t),A(n,t,null),N(e,i),N(e,l),A(s,l,null),o=!0},p(a,u){const f={};u[0]&3972621|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),n.$set(f);const c={};u[0]&197104|u[2]&32&&(c.$$scope={dirty:u,ctx:a}),s.$set(c)},i(a){o||(m(n.$$.fragment,a),m(s.$$.fragment,a),o=!0)},o(a){_(n.$$.fragment,a),_(s.$$.fragment,a),o=!1},d(a){a&&b(e),E(n),E(s)}}}function CG(r){let e;return{c(){e=V("Access level")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function SG(r){let e;return{c(){e=V("Send")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function AG(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function EG(r){let e,t,n;function i(s){r[37](s)}let l={tooltip:"Set the name of the binding which can be used in Handlebars statements throughout your query",name:"binding",headings:!0,keyPlaceholder:"Binding name",valuePlaceholder:"Default"};return r[9]!==void 0&&(l.object=r[9]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o[0]&512&&(t=!0,a.object=s[9],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function OG(r){let e,t,n;function i(s){r[38](s)}let l={name:"param",headings:!0};return r[2]!==void 0&&(l.object=r[2]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o[0]&4&&(t=!0,a.object=s[2],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function TG(r){let e,t,n,i;function l(a){r[39](a)}function s(a){r[40](a)}let o={toggle:!0,name:"header",headings:!0};return r[0].fields.headers!==void 0&&(o.object=r[0].fields.headers),r[11]!==void 0&&(o.activity=r[11]),e=new vi({props:o}),K.push(()=>ce(e,"object",l)),K.push(()=>ce(e,"activity",s)),{c(){S(e.$$.fragment)},m(a,u){A(e,a,u),i=!0},p(a,u){const f={};!t&&u[0]&1&&(t=!0,f.object=a[0].fields.headers,pe(()=>t=!1)),!n&&u[0]&2048&&(n=!0,f.activity=a[11],pe(()=>n=!1)),e.$set(f)},i(a){i||(m(e.$$.fragment,a),i=!0)},o(a){_(e.$$.fragment,a),i=!1},d(a){E(e,a)}}}function IG(r){let e,t,n,i,l,s,o;function a(d){r[41](d)}let u={options:r[19]?[Bf[0]]:Bf,direction:"horizontal",getOptionLabel:nY,getOptionValue:rY};r[0].fields.bodyType!==void 0&&(u.value=r[0].fields.bodyType),e=new Ch({props:u}),K.push(()=>ce(e,"value",a));function f(d){r[42](d)}function c(d){r[43](d)}let p={};return r[0].fields.bodyType!==void 0&&(p.bodyType=r[0].fields.bodyType),r[0]!==void 0&&(p.query=r[0]),i=new _G({props:p}),K.push(()=>ce(i,"bodyType",f)),K.push(()=>ce(i,"query",c)),{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment)},m(d,g){A(e,d,g),$(d,n,g),A(i,d,g),o=!0},p(d,g){const h={};g[0]&524288&&(h.options=d[19]?[Bf[0]]:Bf),!t&&g[0]&1&&(t=!0,h.value=d[0].fields.bodyType,pe(()=>t=!1)),e.$set(h);const v={};!l&&g[0]&1&&(l=!0,v.bodyType=d[0].fields.bodyType,pe(()=>l=!1)),!s&&g[0]&1&&(s=!0,v.query=d[0],pe(()=>s=!1)),i.$set(v)},i(d){o||(m(e.$$.fragment,d),m(i.$$.fragment,d),o=!0)},o(d){_(e.$$.fragment,d),_(i.$$.fragment,d),o=!1},d(d){E(e,d),d&&b(n),E(i,d)}}}function F4(r){let e,t,n,i,l,s,o,a,u,f,c;function p(I){r[45](I)}let d={label:"Pagination parameters location",options:hj,placeholer:"Choose where to send pagination parameters"};r[0].fields.pagination.location!==void 0&&(d.value=r[0].fields.pagination.location),e=new Xe({props:d}),K.push(()=>ce(e,"value",p));function g(I){r[46](I)}let h={label:r[0].fields.pagination.type==="page"?"Page number parameter name ":"Request cursor parameter name"};r[0].fields.pagination.pageParam!==void 0&&(h.value=r[0].fields.pagination.pageParam),i=new tt({props:h}),K.push(()=>ce(i,"value",g));function v(I){r[47](I)}let k={label:r[0].fields.pagination.type==="page"?"Page size parameter name":"Request limit parameter name"};r[0].fields.pagination.sizeParam!==void 0&&(k.value=r[0].fields.pagination.sizeParam),o=new tt({props:k}),K.push(()=>ce(o,"value",v));let C=r[0].fields.pagination.type==="cursor"&&V4(r);return{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment),s=R(),S(o.$$.fragment),u=R(),C&&C.c(),f=Ee()},m(I,O){A(e,I,O),$(I,n,O),A(i,I,O),$(I,s,O),A(o,I,O),$(I,u,O),C&&C.m(I,O),$(I,f,O),c=!0},p(I,O){const T={};!t&&O[0]&1&&(t=!0,T.value=I[0].fields.pagination.location,pe(()=>t=!1)),e.$set(T);const P={};O[0]&1&&(P.label=I[0].fields.pagination.type==="page"?"Page number parameter name ":"Request cursor parameter name"),!l&&O[0]&1&&(l=!0,P.value=I[0].fields.pagination.pageParam,pe(()=>l=!1)),i.$set(P);const M={};O[0]&1&&(M.label=I[0].fields.pagination.type==="page"?"Page size parameter name":"Request limit parameter name"),!a&&O[0]&1&&(a=!0,M.value=I[0].fields.pagination.sizeParam,pe(()=>a=!1)),o.$set(M),I[0].fields.pagination.type==="cursor"?C?(C.p(I,O),O[0]&1&&m(C,1)):(C=V4(I),C.c(),m(C,1),C.m(f.parentNode,f)):C&&(te(),_(C,1,1,()=>{C=null}),ne())},i(I){c||(m(e.$$.fragment,I),m(i.$$.fragment,I),m(o.$$.fragment,I),m(C),c=!0)},o(I){_(e.$$.fragment,I),_(i.$$.fragment,I),_(o.$$.fragment,I),_(C),c=!1},d(I){E(e,I),I&&b(n),E(i,I),I&&b(s),E(o,I),I&&b(u),C&&C.d(I),I&&b(f)}}}function V4(r){let e,t,n;function i(s){r[48](s)}let l={label:"Response body parameter name for cursor"};return r[0].fields.pagination.responseParam!==void 0&&(l.value=r[0].fields.pagination.responseParam),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o[0]&1&&(t=!0,a.value=s[0].fields.pagination.responseParam,pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function LG(r){let e,t,n,i,l;function s(u){r[44](u)}let o={label:"Pagination type",options:_j,placeholder:"None"};r[0].fields.pagination.type!==void 0&&(o.value=r[0].fields.pagination.type),t=new Xe({props:o}),K.push(()=>ce(t,"value",s));let a=r[0].fields.pagination.type&&F4(r);return{c(){e=D("div"),S(t.$$.fragment),i=R(),a&&a.c(),w(e,"class","pagination svelte-1ba99n2")},m(u,f){$(u,e,f),A(t,e,null),N(e,i),a&&a.m(e,null),l=!0},p(u,f){const c={};!n&&f[0]&1&&(n=!0,c.value=u[0].fields.pagination.type,pe(()=>n=!1)),t.$set(c),u[0].fields.pagination.type?a?(a.p(u,f),f[0]&1&&m(a,1)):(a=F4(u),a.c(),m(a,1),a.m(e,null)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(t.$$.fragment,u),m(a),l=!0)},o(u){_(t.$$.fragment,u),_(a),l=!1},d(u){u&&b(e),E(t),a&&a.d()}}}function H4(r){let e,t;return e=new l3({props:{extraButtonText:"Learn more",extraButtonAction:r[49],$$slots:{default:[PG]},$$scope:{ctx:r}}}),e.$on("change",r[50]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[2]&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 PG(r){let e;return{c(){e=V("Add a JavaScript function to transform the query result.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function NG(r){let e,t,n,i=!r[21].queryTransformerBanner&&H4(r);return t=new Qf({props:{height:200,mode:Oa.JSON,value:r[0].transformer,resize:"vertical"}}),t.$on("change",r[51]),{c(){i&&i.c(),e=R(),S(t.$$.fragment)},m(l,s){i&&i.m(l,s),$(l,e,s),A(t,l,s),n=!0},p(l,s){l[21].queryTransformerBanner?i&&(te(),_(i,1,1,()=>{i=null}),ne()):i?(i.p(l,s),s[0]&2097152&&m(i,1)):(i=H4(l),i.c(),m(i,1),i.m(e.parentNode,e));const o={};s[0]&1&&(o.value=l[0].transformer),t.$set(o)},i(l){n||(m(i),m(t.$$.fragment,l),n=!0)},o(l){_(i),_(t.$$.fragment,l),n=!1},d(l){i&&i.d(l),l&&b(e),E(t,l)}}}function RG(r){let e,t;return e=new Qe({props:{noPadding:!0,$$slots:{default:[NG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&2097153|i[2]&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 MG(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I;e=new bn({props:{title:"Bindings",$$slots:{default:[EG]},$$scope:{ctx:r}}}),n=new bn({props:{title:"Params",$$slots:{default:[OG]},$$scope:{ctx:r}}}),l=new bn({props:{title:"Headers",$$slots:{default:[TG]},$$scope:{ctx:r}}}),o=new bn({props:{title:"Body",$$slots:{default:[IG]},$$scope:{ctx:r}}}),u=new bn({props:{title:"Pagination",$$slots:{default:[LG]},$$scope:{ctx:r}}}),c=new bn({props:{title:"Transformer",$$slots:{default:[RG]},$$scope:{ctx:r}}});function O(P){r[52](P)}let T={label:"Auth",labelPosition:"left",placeholder:"None",options:r[18]};return r[12]!==void 0&&(T.value=r[12]),k=new Xe({props:T}),K.push(()=>ce(k,"value",O)),{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),p=R(),d=D("div"),g=D("div"),h=R(),v=D("div"),S(k.$$.fragment),w(v,"class","auth-select svelte-1ba99n2"),w(d,"class","auth-container svelte-1ba99n2")},m(P,M){A(e,P,M),$(P,t,M),A(n,P,M),$(P,i,M),A(l,P,M),$(P,s,M),A(o,P,M),$(P,a,M),A(u,P,M),$(P,f,M),A(c,P,M),$(P,p,M),$(P,d,M),N(d,g),N(d,h),N(d,v),A(k,v,null),I=!0},p(P,M){const F={};M[0]&512|M[2]&32&&(F.$$scope={dirty:M,ctx:P}),e.$set(F);const j={};M[0]&4|M[2]&32&&(j.$$scope={dirty:M,ctx:P}),n.$set(j);const z={};M[0]&2049|M[2]&32&&(z.$$scope={dirty:M,ctx:P}),l.$set(z);const q={};M[0]&524289|M[2]&32&&(q.$$scope={dirty:M,ctx:P}),o.$set(q);const H={};M[0]&1|M[2]&32&&(H.$$scope={dirty:M,ctx:P}),u.$set(H);const Y={};M[0]&2097153|M[2]&32&&(Y.$$scope={dirty:M,ctx:P}),c.$set(Y);const U={};M[0]&262144&&(U.options=P[18]),!C&&M[0]&4096&&(C=!0,U.value=P[12],pe(()=>C=!1)),k.$set(U)},i(P){I||(m(e.$$.fragment,P),m(n.$$.fragment,P),m(l.$$.fragment,P),m(o.$$.fragment,P),m(u.$$.fragment,P),m(c.$$.fragment,P),m(k.$$.fragment,P),I=!0)},o(P){_(e.$$.fragment,P),_(n.$$.fragment,P),_(l.$$.fragment,P),_(o.$$.fragment,P),_(u.$$.fragment,P),_(c.$$.fragment,P),_(k.$$.fragment,P),I=!1},d(P){E(e,P),P&&b(t),E(n,P),P&&b(i),E(l,P),P&&b(s),E(o,P),P&&b(a),E(u,P),P&&b(f),E(c,P),P&&b(p),P&&b(d),E(k)}}}function DG(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F;function j(W){r[32](W)}let z={type:"heading",defaultValue:"Untitled"};r[0].name!==void 0&&(z.value=r[0].name),t=new uG({props:z}),K.push(()=>ce(t,"value",j)),t.$on("change",r[33]),t.$on("save",r[22]),s=new Ze({props:{$$slots:{default:[CG]},$$scope:{ctx:r}}}),a=new m4({props:{query:r[0],saveId:r[10]}});function q(W){r[35](W)}let H={options:Object.keys(r[20]),getOptionLabel:r[34]};r[0].queryVerb!==void 0&&(H.value=r[0].queryVerb),p=new Xe({props:H}),K.push(()=>ce(p,"value",q)),p.$on("change",tY);function Y(W){r[36](W)}let U={placeholder:"http://www.api.com/endpoint"};return r[3]!==void 0&&(U.value=r[3]),v=new tt({props:U}),K.push(()=>ce(v,"value",Y)),I=new gt({props:{primary:!0,disabled:!r[3],$$slots:{default:[SG]},$$scope:{ctx:r}}}),I.$on("click",r[23]),T=new gt({props:{disabled:!r[0].name,cta:!0,tooltip:r[15]?null:"Saving a query before sending will mean no schema is generated",$$slots:{default:[AG]},$$scope:{ctx:r}}}),T.$on("click",r[22]),M=new Vr({props:{selected:"Bindings",quiet:!0,noPadding:!0,noHorizPadding:!0,onTop:!0,$$slots:{default:[MG]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),i=R(),l=D("div"),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),f=D("div"),c=D("div"),S(p.$$.fragment),g=R(),h=D("div"),S(v.$$.fragment),C=R(),S(I.$$.fragment),O=R(),S(T.$$.fragment),P=R(),S(M.$$.fragment),w(l,"class","access svelte-1ba99n2"),w(e,"class","top-bar svelte-1ba99n2"),w(c,"class","verb svelte-1ba99n2"),w(h,"class","url svelte-1ba99n2"),w(f,"class","url-block svelte-1ba99n2")},m(W,G){$(W,e,G),A(t,e,null),N(e,i),N(e,l),A(s,l,null),N(l,o),A(a,l,null),$(W,u,G),$(W,f,G),N(f,c),A(p,c,null),N(f,g),N(f,h),A(v,h,null),N(f,C),A(I,f,null),N(f,O),A(T,f,null),$(W,P,G),A(M,W,G),F=!0},p(W,G){const Q={};!n&&G[0]&1&&(n=!0,Q.value=W[0].name,pe(()=>n=!1)),t.$set(Q);const fe={};G[2]&32&&(fe.$$scope={dirty:G,ctx:W}),s.$set(fe);const Z={};G[0]&1&&(Z.query=W[0]),G[0]&1024&&(Z.saveId=W[10]),a.$set(Z);const ee={};G[0]&1048576&&(ee.options=Object.keys(W[20])),G[0]&1048576&&(ee.getOptionLabel=W[34]),!d&&G[0]&1&&(d=!0,ee.value=W[0].queryVerb,pe(()=>d=!1)),p.$set(ee);const ae={};!k&&G[0]&8&&(k=!0,ae.value=W[3],pe(()=>k=!1)),v.$set(ae);const _e={};G[0]&8&&(_e.disabled=!W[3]),G[2]&32&&(_e.$$scope={dirty:G,ctx:W}),I.$set(_e);const Re={};G[0]&1&&(Re.disabled=!W[0].name),G[0]&32768&&(Re.tooltip=W[15]?null:"Saving a query before sending will mean no schema is generated"),G[2]&32&&(Re.$$scope={dirty:G,ctx:W}),T.$set(Re);const $e={};G[0]&2890245|G[2]&32&&($e.$$scope={dirty:G,ctx:W}),M.$set($e)},i(W){F||(m(t.$$.fragment,W),m(s.$$.fragment,W),m(a.$$.fragment,W),m(p.$$.fragment,W),m(v.$$.fragment,W),m(I.$$.fragment,W),m(T.$$.fragment,W),m(M.$$.fragment,W),F=!0)},o(W){_(t.$$.fragment,W),_(s.$$.fragment,W),_(a.$$.fragment,W),_(p.$$.fragment,W),_(v.$$.fragment,W),_(I.$$.fragment,W),_(T.$$.fragment,W),_(M.$$.fragment,W),F=!1},d(W){W&&b(e),E(t),E(s),E(a),W&&b(u),W&&b(f),E(p),E(v),E(I),E(T),W&&b(P),E(M,W)}}}function jG(r){let e,t;return e=new Vr({props:{selected:r[4]?"JSON":"Schema",quiet:!0,noPadding:!0,noHorizPadding:!0,$$slots:{default:[XG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&16&&(l.selected=n[4]?"JSON":"Schema"),i[0]&197104|i[2]&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 BG(r){let e,t,n,i,l,s,o,a,u;return e=new Ct({props:{size:"M",$$slots:{default:[KG]},$$scope:{ctx:r}}}),a=new Ke({props:{size:"XS",textAlign:"center",$$slots:{default:[ZG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=D("div"),i=D("div"),l=D("img"),o=R(),S(a.$$.fragment),w(l,"alt","placeholder"),dn(l.src,s=kG)||w(l,"src",s),w(i,"class","placeholder-internal svelte-1ba99n2"),w(n,"class","placeholder svelte-1ba99n2")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),N(n,i),N(i,l),N(i,o),A(a,i,null),u=!0},p(f,c){const p={};c[2]&32&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};c[2]&32&&(d.$$scope={dirty:c,ctx:f}),a.$set(d)},i(f){u||(m(e.$$.fragment,f),m(a.$$.fragment,f),u=!0)},o(f){_(e.$$.fragment,f),_(a.$$.fragment,f),u=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(a)}}}function W4(r){let e,t;return e=new bn({props:{title:"JSON",$$slots:{default:[zG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&16|i[2]&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 zG(r){let e,t,n;return t=new s4({props:{height:"300",data:r[4].rows[0]}}),{c(){e=D("div"),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l[0]&16&&(s.data=i[4].rows[0]),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 G4(r){let e,t;return e=new bn({props:{title:"Schema",$$slots:{default:[qG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&131104|i[2]&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 qG(r){let e,t,n;function i(s){r[53](s)}let l={name:"schema",headings:!0,options:k3,menuItems:r[24],showMenu:!r[17],readOnly:r[17]};return r[5]!==void 0&&(l.object=r[5]),e=new vi({props:l}),K.push(()=>ce(e,"object",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o[0]&131072&&(a.showMenu=!s[17]),o[0]&131072&&(a.readOnly=s[17]),!t&&o[0]&32&&(t=!0,a.object=s[5],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Y4(r){let e,t,n,i,l,s;return e=new bn({props:{title:"Raw",$$slots:{default:[UG]},$$scope:{ctx:r}}}),n=new bn({props:{title:"Headers",$$slots:{default:[FG]},$$scope:{ctx:r}}}),l=new bn({props:{title:"Preview",$$slots:{default:[VG]},$$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[0]&16|a[2]&32&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a[0]&16|a[2]&32&&(f.$$scope={dirty:a,ctx:o}),n.$set(f);const c={};a[0]&16|a[2]&32&&(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 UG(r){var n;let e,t;return e=new pi({props:{disabled:!0,value:(n=r[4].extra)==null?void 0:n.raw,height:"300"}}),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){var o;const s={};l[0]&16&&(s.value=(o=i[4].extra)==null?void 0:o.raw),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 FG(r){var n;let e,t;return e=new vi({props:{object:(n=r[4].extra)==null?void 0:n.headers,readOnly:!0,menuItems:r[25],showMenu:!0}}),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){var o;const s={};l[0]&16&&(s.object=(o=i[4].extra)==null?void 0:o.headers),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 J4(r){var n,i;let e,t;return e=new Ni({props:{schema:(n=r[4])==null?void 0:n.schema,data:(i=r[4])==null?void 0:i.rows,allowEditColumns:!1,allowEditRows:!1,allowSelectRows:!1}}),{c(){S(e.$$.fragment)},m(l,s){A(e,l,s),t=!0},p(l,s){var a,u;const o={};s[0]&16&&(o.schema=(a=l[4])==null?void 0:a.schema),s[0]&16&&(o.data=(u=l[4])==null?void 0:u.rows),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function VG(r){let e,t,n=r[4]&&J4(r);return{c(){e=D("div"),n&&n.c(),w(e,"class","table svelte-1ba99n2")},m(i,l){$(i,e,l),n&&n.m(e,null),t=!0},p(i,l){i[4]?n?(n.p(i,l),l[0]&16&&m(n,1)):(n=J4(i),n.c(),m(n,1),n.m(e,null)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){i&&b(e),n&&n.d()}}}function Q4(r){let e,t;return e=new bn({props:{title:"Dynamic Variables",$$slots:{default:[GG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&192|i[2]&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 HG(r){let e;return{c(){e=V(`Create dynamic variables based on response body or headers
|
|
1071
|
-
from this query.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function WG(r){let e,t,n,i,l;e=new Ke({props:{size:"S",$$slots:{default:[HG]},$$scope:{ctx:r}}});function s(a){r[54](a)}let o={name:"Variable",headings:!0,keyHeading:"Name",keyPlaceholder:"Variable name",valueHeading:"Value",valuePlaceholder:"{{ value }}",readOnly:r[7]};return r[6]!==void 0&&(o.object=r[6]),n=new vi({props:o}),K.push(()=>ce(n,"object",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[2]&32&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u[0]&128&&(c.readOnly=a[7]),!i&&u[0]&64&&(i=!0,c.object=a[6],pe(()=>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 GG(r){let e,t;return e=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[WG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&192|i[2]&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 X4(r){let e,t,n,i,l,s,o;return t=new Ze({props:{size:"L",$$slots:{default:[YG]},$$scope:{ctx:r}}}),i=new Ze({props:{size:"L",$$slots:{default:[JG]},$$scope:{ctx:r}}}),s=new Ze({props:{size:"L",$$slots:{default:[QG]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","stats svelte-1ba99n2")},m(a,u){$(a,e,u),A(t,e,null),N(e,n),A(i,e,null),N(e,l),A(s,e,null),o=!0},p(a,u){const f={};u[0]&272|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),t.$set(f);const c={};u[0]&272|u[2]&32&&(c.$$scope={dirty:u,ctx:a}),i.$set(c);const p={};u[0]&272|u[2]&32&&(p.$$scope={dirty:u,ctx:a}),s.$set(p)},i(a){o||(m(t.$$.fragment,a),m(i.$$.fragment,a),m(s.$$.fragment,a),o=!0)},o(a){_(t.$$.fragment,a),_(i.$$.fragment,a),_(s.$$.fragment,a),o=!1},d(a){a&&b(e),E(t),E(i),E(s)}}}function YG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.code)+"",i,l;return{c(){e=V("Status: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.code)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function JG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.time)+"",i,l;return{c(){e=V("Time: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.time)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function QG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.size)+"",i,l;return{c(){e=V("Size: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.size)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function XG(r){let e,t,n,i,l,s,o=r[4]&&W4(r),a=(r[5]||r[4])&&G4(r),u=r[4]&&Y4(r),f=r[16]&&Q4(r),c=r[4]&&X4(r);return{c(){o&&o.c(),e=R(),a&&a.c(),t=R(),u&&u.c(),n=R(),f&&f.c(),i=R(),c&&c.c(),l=Ee()},m(p,d){o&&o.m(p,d),$(p,e,d),a&&a.m(p,d),$(p,t,d),u&&u.m(p,d),$(p,n,d),f&&f.m(p,d),$(p,i,d),c&&c.m(p,d),$(p,l,d),s=!0},p(p,d){p[4]?o?(o.p(p,d),d[0]&16&&m(o,1)):(o=W4(p),o.c(),m(o,1),o.m(e.parentNode,e)):o&&(te(),_(o,1,1,()=>{o=null}),ne()),p[5]||p[4]?a?(a.p(p,d),d[0]&48&&m(a,1)):(a=G4(p),a.c(),m(a,1),a.m(t.parentNode,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne()),p[4]?u?(u.p(p,d),d[0]&16&&m(u,1)):(u=Y4(p),u.c(),m(u,1),u.m(n.parentNode,n)):u&&(te(),_(u,1,1,()=>{u=null}),ne()),p[16]?f?(f.p(p,d),d[0]&65536&&m(f,1)):(f=Q4(p),f.c(),m(f,1),f.m(i.parentNode,i)):f&&(te(),_(f,1,1,()=>{f=null}),ne()),p[4]?c?(c.p(p,d),d[0]&16&&m(c,1)):(c=X4(p),c.c(),m(c,1),c.m(l.parentNode,l)):c&&(te(),_(c,1,1,()=>{c=null}),ne())},i(p){s||(m(o),m(a),m(u),m(f),m(c),s=!0)},o(p){_(o),_(a),_(u),_(f),_(c),s=!1},d(p){o&&o.d(p),p&&b(e),a&&a.d(p),p&&b(t),u&&u.d(p),p&&b(n),f&&f.d(p),p&&b(i),c&&c.d(p),p&&b(l)}}}function KG(r){let e;return{c(){e=V("Response")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ZG(r){let e="enter a url in the textbox above and click send to get a response".toUpperCase()+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function xG(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}});const a=[BG,jG],u=[];function f(c,p){return(n==null||p[0]&48)&&(n=!c[4]&&Object.keys(c[5]).length===0),n?0:1}return i=f(r,[-1,-1,-1]),l=u[i]=a[i](r),{c(){S(e.$$.fragment),t=R(),l.c(),s=Ee()},m(c,p){A(e,c,p),$(c,t,p),u[i].m(c,p),$(c,s,p),o=!0},p(c,p){let d=i;i=f(c,p),i===d?u[i].p(c,p):(te(),_(u[d],1,1,()=>{u[d]=null}),ne(),l=u[i],l?l.p(c,p):(l=u[i]=a[i](c),l.c()),m(l,1),l.m(s.parentNode,s))},i(c){o||(m(e.$$.fragment,c),m(l),o=!0)},o(c){_(e.$$.fragment,c),_(l),o=!1},d(c){E(e,c),c&&b(t),u[i].d(c),c&&b(s)}}}function eY(r){let e,t,n,i,l;function s(u){r[30](u)}let o={datasource:r[1],dynamicVariables:r[6]};r[14]!==void 0&&(o.binding=r[14]),e=new yG({props:o}),K.push(()=>ce(e,"binding",s)),r[31](e);let a=r[0]&&r[20]&&U4(r);return{c(){S(e.$$.fragment),n=R(),a&&a.c(),i=Ee()},m(u,f){A(e,u,f),$(u,n,f),a&&a.m(u,f),$(u,i,f),l=!0},p(u,f){const c={};f[0]&2&&(c.datasource=u[1]),f[0]&64&&(c.dynamicVariables=u[6]),!t&&f[0]&16384&&(t=!0,c.binding=u[14],pe(()=>t=!1)),e.$set(c),u[0]&&u[20]?a?(a.p(u,f),f[0]&1048577&&m(a,1)):(a=U4(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){r[31](null),E(e,u),u&&b(n),a&&a.d(u),u&&b(i)}}}const tY=()=>{},nY=r=>r.name,rY=r=>r.value;function iY(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,v,k;ue(r,en,Ve=>t(55,d=Ve)),ue(r,er,Ve=>t(56,g=Ve)),ue(r,kn,Ve=>t(57,h=Ve)),ue(r,Ql,Ve=>t(29,v=Ve)),ue(r,i1,Ve=>t(21,k=Ve));let C,I,O={},T={},P,M,F,j,z,q,H,Y,U;function W(){return vn.cloneDeep(h.list.find(Ve=>Ve._id===h.selected)||{datasourceId:g.selectedDatasource,parameters:[],fields:{disabledHeaders:{},headers:{}},queryVerb:"read"})}function G(Ve=null){C&&(!C.name||C.flags.urlName)&&(t(0,C.flags.urlName=!0,C),t(0,C.name=M||Ve,C))}function Q(Ve,Be){if(!Ve)return Ve;const Mt=Ol.buildQueryString(Be);let sn=Ve;return Ve.includes("?")&&(sn=Ve.split("?")[0]),Mt.length>0?`${sn}?${Mt}`:sn}function fe(){const Ve=Se({},C),Be=Ol.buildQueryString(O);return Ve.fields.path=M.split("?")[0],Ve.fields.queryString=Be,Ve.fields.authConfigId=q,Ve.fields.disabledHeaders=Ol.flipHeaderState(z),Ve.schema=Ol.fieldsToSchema(j),Ve.parameters=Ol.keyValueToQueryParameters(T),Ve}async function Z(){const Ve=fe();try{const{_id:Be}=await kn.save(Ve.datasourceId,Ve);t(10,P=Be),t(0,C=W()),we.success("Request saved successfully"),H&&(t(1,I.config.dynamicVariables=he(P),I),t(1,I=await en.save(I)))}catch{we.error("Error saving query")}}async function ee(){try{t(4,F=await kn.preview(fe(C))),F.rows.length===0?we.info("Request did not return any data"):(t(4,F.info=F.info||{code:200},F),t(5,j=F.schema),we.success("Request sent successfully"))}catch{we.error("Error running query")}}const ae=()=>{var Be,Mt;let Ve=C.fields.authConfigId;return Ve&&(((Mt=(Be=I==null?void 0:I.config)==null?void 0:Be.authConfigs)==null?void 0:Mt.filter(Cn=>Cn._id===Ve)[0])||(Ve=void 0)),Ve},_e=Ve=>{var Be;return((Be=Ve==null?void 0:Ve.config)==null?void 0:Be.authConfigs)?Ve.config.authConfigs.map(Mt=>({label:Mt.name,value:Mt._id})):[]},Re=[{text:"Create dynamic variable",onClick:Ve=>{t(14,U=`{{ data.0.[${Ve.name}] }}`),Y.show()}}],$e=[{text:"Create dynamic variable",onClick:Ve=>{t(14,U=`{{ info.headers.[${Ve.name}] }}`),Y.show()}}],be=(Ve,Be)=>{var sn;const Mt=(sn=Ve==null?void 0:Ve.config)==null?void 0:sn.dynamicVariables;return Mt&&Mt.length>0?(Be?Mt.filter(Ar=>Ar.queryId===Be):Mt).reduce((Ar,yi)=>lt(Se({},Ar),{[yi.name]:yi.value}),{}):{}},he=Ve=>{var sn;let Be=[];H&&(Be=Object.entries(H).map(Cn=>({name:Cn[0],value:Cn[1],queryId:Ve})));let Mt=((sn=I==null?void 0:I.config)==null?void 0:sn.dynamicVariables)||[];return Mt=Mt.filter(Cn=>Cn.queryId!==Ve),[...Mt,...Be]},Ne=(Ve,Be)=>!!(Ve&&(!Be||Object.keys(Ve).length>0)),Fe=async(Ve,Be)=>{try{await i1.updateFlag(Ve,Be)}catch{we.error("Error updating flag")}};Gt(async()=>{t(0,C=W());try{await en.init()}catch{we.error("Error getting datasources")}t(1,I=d.list.find(sn=>sn._id===(C==null?void 0:C.datasourceId)));const Ve=I==null?void 0:I.config.url,Be=C==null?void 0:C.fields.queryString;t(2,O=Ol.breakQueryString(Be));const Mt=C.fields.path;Ve&&!(Mt==null?void 0:Mt.startsWith("http"))&&!(Mt==null?void 0:Mt.startsWith("{{"))&&t(0,C.fields.path=`${I.config.url}/${Mt||""}`,C),t(3,M=Q(C.fields.path,O)),t(5,j=Ol.schemaToFields(C.schema)),t(9,T=Ol.queryParametersToKeyValue(C.parameters)),t(12,q=ae()),C.fields.disabledHeaders||t(0,C.fields.disabledHeaders={},C);for(let sn of Object.keys(C.fields.headers))C.fields.disabledHeaders[sn]||t(0,C.fields.disabledHeaders[sn]=!1,C);t(11,z=Ol.flipHeaderState(C.fields.disabledHeaders)),C&&!C.transformer&&t(0,C.transformer="return data",C),C&&!C.flags&&t(0,C.flags={urlName:!1},C),C&&!C.fields.bodyType&&(C.fields.requestBody?t(0,C.fields.bodyType=$i.JSON,C):t(0,C.fields.bodyType=$i.NONE,C)),C&&!C.fields.pagination&&t(0,C.fields.pagination={},C),t(6,H=be(I,C._id))});function se(Ve){U=Ve,t(14,U)}function Ce(Ve){K[Ve?"unshift":"push"](()=>{Y=Ve,t(13,Y)})}function me(Ve){r.$$.not_equal(C.name,Ve)&&(C.name=Ve,t(0,C))}const ke=()=>t(0,C.flags.urlName=!1,C),ze=Ve=>{var Be;return((Be=l[Ve])==null?void 0:Be.displayName)||Sr(Ve)};function ye(Ve){r.$$.not_equal(C.queryVerb,Ve)&&(C.queryVerb=Ve,t(0,C))}function Je(Ve){M=Ve,t(3,M),t(2,O)}function Nt(Ve){T=Ve,t(9,T)}function qe(Ve){O=Ve,t(2,O)}function pt(Ve){r.$$.not_equal(C.fields.headers,Ve)&&(C.fields.headers=Ve,t(0,C))}function Rt(Ve){z=Ve,t(11,z)}function Ie(Ve){r.$$.not_equal(C.fields.bodyType,Ve)&&(C.fields.bodyType=Ve,t(0,C))}function Ge(Ve){r.$$.not_equal(C.fields.bodyType,Ve)&&(C.fields.bodyType=Ve,t(0,C))}function Ue(Ve){C=Ve,t(0,C)}function at(Ve){r.$$.not_equal(C.fields.pagination.type,Ve)&&(C.fields.pagination.type=Ve,t(0,C))}function Le(Ve){r.$$.not_equal(C.fields.pagination.location,Ve)&&(C.fields.pagination.location=Ve,t(0,C))}function Bt(Ve){r.$$.not_equal(C.fields.pagination.pageParam,Ve)&&(C.fields.pagination.pageParam=Ve,t(0,C))}function gn(Ve){r.$$.not_equal(C.fields.pagination.sizeParam,Ve)&&(C.fields.pagination.sizeParam=Ve,t(0,C))}function fn(Ve){r.$$.not_equal(C.fields.pagination.responseParam,Ve)&&(C.fields.pagination.responseParam=Ve,t(0,C))}const on=()=>window.open("https://docs.budibase.com/building-apps/data/transformers"),$r=()=>Fe("queryTransformerBanner",!0),In=Ve=>t(0,C.transformer=Ve.detail,C);function ar(Ve){q=Ve,t(12,q)}function ir(Ve){j=Ve,t(5,j)}function nl(Ve){H=Ve,t(6,H)}return r.$$.update=()=>{var Ve,Be;r.$$.dirty[0]&2&&t(28,n=I==null?void 0:I.source),r.$$.dirty[0]&805306368&&t(27,i=v[n]),r.$$.dirty[0]&134217728&&t(20,l=i==null?void 0:i.query),r.$$.dirty[0]&12&&t(3,M=Q(M,O)),r.$$.dirty[0]&8&&G(M),r.$$.dirty[0]&16&&t(8,s=((Ve=F==null?void 0:F.info)==null?void 0:Ve.code)>=200&&((Be=F==null?void 0:F.info)==null?void 0:Be.code)<400),r.$$.dirty[0]&1&&t(19,o=(C==null?void 0:C.queryVerb)==="read"),r.$$.dirty[0]&2&&t(18,a=_e(I)),r.$$.dirty[0]&256&&t(17,u=!s),r.$$.dirty[0]&256&&t(7,f=!s),r.$$.dirty[0]&192&&t(16,c=Ne(H,f)),r.$$.dirty[0]&33&&t(15,p=Object.keys(j||{}).length!==0||Object.keys((C==null?void 0:C.schema)||{}).length!==0)},[C,I,O,M,F,j,H,f,s,T,P,z,q,Y,U,p,c,u,a,o,l,k,Z,ee,Re,$e,Fe,i,n,v,se,Ce,me,ke,ze,ye,Je,Nt,qe,pt,Rt,Ie,Ge,Ue,at,Le,Bt,gn,fn,on,$r,In,ar,ir,nl]}class lY extends ie{constructor(e){super();le(this,e,iY,eY,re,{},null,[-1,-1,-1])}}function sY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function oY(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,kn,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.query){const o=i.list.find(a=>a._id===n.query);o&&kn.select(o)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class aY extends ie{constructor(e){super();le(this,e,oY,sY,re,{})}}function uY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function fY(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,en,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.selectedDatasource&&!n.query){const o=i.list.find(a=>a._id===n.selectedDatasource);o&&en.select(o._id)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class cY extends ie{constructor(e){super();le(this,e,fY,uY,re,{})}}function K4(r,e,t){const n=r.slice();return n[21]=e[t],n[22]=e,n[23]=t,n}function pY(r){let e;return{c(){e=V("Upload")},m(t,n){$(t,e,n)},p:Oe,d(t){t&&b(e)}}}function dY(r){let e=r[0][0].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0][0].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function mY(r){let e,t,n,i;function l(o){r[17](o)}let s={header:"Invalid CSV",type:"error"};return r[6]!==void 0&&(s.message=r[6]),t=new n1({props:s}),K.push(()=>ce(t,"message",l)),{c(){e=D("div"),S(t.$$.fragment)},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,a){const u={};!n&&a&64&&(n=!0,u.message=o[6],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function gY(r){let e,t,n,i,l=r[4],s=[];for(let u=0;u<l.length;u+=1)s[u]=Z4(K4(r,l,u));const o=u=>_(s[u],1,1,()=>{s[u]=null});let a=!r[1]&&x4(r);return{c(){e=D("div");for(let u=0;u<s.length;u+=1)s[u].c();t=R(),a&&a.c(),n=Ee(),w(e,"class","schema-fields svelte-1rdzppm")},m(u,f){$(u,e,f);for(let c=0;c<s.length;c+=1)s[c].m(e,null);$(u,t,f),a&&a.m(u,f),$(u,n,f),i=!0},p(u,f){if(f&1818){l=u[4];let c;for(c=0;c<l.length;c+=1){const p=K4(u,l,c);s[c]?(s[c].p(p,f),m(s[c],1)):(s[c]=Z4(p),s[c].c(),m(s[c],1),s[c].m(e,null))}for(te(),c=l.length;c<s.length;c+=1)o(c);ne()}u[1]?a&&(te(),_(a,1,1,()=>{a=null}),ne()):a?(a.p(u,f),f&2&&m(a,1)):(a=x4(u),a.c(),m(a,1),a.m(n.parentNode,n))},i(u){if(!i){for(let f=0;f<l.length;f+=1)m(s[f]);m(a),i=!0}},o(u){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)_(s[f]);_(a),i=!1},d(u){u&&b(e),$t(s,u),u&&b(t),a&&a.d(u),u&&b(n)}}}function Z4(r){let e,t,n=r[21]+"",i,l,s,o,a,u,f=(r[3][r[21]].success?"Success":"Failure")+"",c,p,d,g,h,v,k;function C(T){r[14](T,r[21])}let I={options:r[10],placeholder:null,getOptionLabel:hY,getOptionValue:$Y,disabled:!!r[1]};r[3][r[21]].type!==void 0&&(I.value=r[3][r[21]].type),s=new Xe({props:I}),K.push(()=>ce(s,"value",C)),s.$on("change",function(){mt(r[9](r[21]))&&r[9](r[21]).apply(this,arguments)});function O(){return r[15](r[21])}return{c(){e=D("div"),t=D("span"),i=V(n),l=R(),S(s.$$.fragment),a=R(),u=D("span"),c=V(f),p=R(),d=D("i"),g=R(),w(u,"class","field-status svelte-1rdzppm"),oe(u,"error",!r[3][r[21]].success),w(d,"class","omit-button ri-close-circle-fill svelte-1rdzppm"),w(e,"class","field svelte-1rdzppm")},m(T,P){$(T,e,P),N(e,t),N(t,i),N(e,l),A(s,e,null),N(e,a),N(e,u),N(u,c),N(e,p),N(e,d),N(e,g),h=!0,v||(k=Pe(d,"click",O),v=!0)},p(T,P){r=T,(!h||P&16)&&n!==(n=r[21]+"")&&Te(i,n);const M={};P&2&&(M.disabled=!!r[1]),!o&&P&24&&(o=!0,M.value=r[3][r[21]].type,pe(()=>o=!1)),s.$set(M),(!h||P&24)&&f!==(f=(r[3][r[21]].success?"Success":"Failure")+"")&&Te(c,f),P&24&&oe(u,"error",!r[3][r[21]].success)},i(T){h||(m(s.$$.fragment,T),h=!0)},o(T){_(s.$$.fragment,T),h=!1},d(T){T&&b(e),E(s),v=!1,k()}}}function x4(r){let e,t,n,i;function l(o){r[16](o)}let s={label:"Display Column",options:r[4],sort:!0};return r[2]!==void 0&&(s.value=r[2]),t=new Xe({props:s}),K.push(()=>ce(t,"value",l)),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","display-column svelte-1rdzppm")},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,a){const u={};a&16&&(u.options=o[4]),!n&&a&4&&(n=!0,u.value=o[2],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function _Y(r){let e,t,n,i,l,s,o,a,u,f,c;function p(C,I){return C[0][0]?dY:pY}let d=p(r),g=d(r);const h=[gY,mY],v=[];function k(C,I){return C[4].length?0:C[5]?1:-1}return~(s=k(r))&&(o=v[s]=h[s](r)),{c(){e=D("div"),t=D("input"),n=R(),i=D("label"),g.c(),l=R(),o&&o.c(),a=Ee(),w(t,"id","file-upload"),w(t,"accept",".csv"),w(t,"type","file"),w(t,"class","svelte-1rdzppm"),w(i,"for","file-upload"),w(i,"class","svelte-1rdzppm"),oe(i,"uploaded",r[0][0]),w(e,"class","dropzone svelte-1rdzppm")},m(C,I){$(C,e,I),N(e,t),N(e,n),N(e,i),g.m(i,null),$(C,l,I),~s&&v[s].m(C,I),$(C,a,I),u=!0,f||(c=Pe(t,"change",r[7]),f=!0)},p(C,[I]){d===(d=p(C))&&g?g.p(C,I):(g.d(1),g=d(C),g&&(g.c(),g.m(i,null))),I&1&&oe(i,"uploaded",C[0][0]);let O=s;s=k(C),s===O?~s&&v[s].p(C,I):(o&&(te(),_(v[O],1,1,()=>{v[O]=null}),ne()),~s?(o=v[s],o?o.p(C,I):(o=v[s]=h[s](C),o.c()),m(o,1),o.m(a.parentNode,a)):o=null)},i(C){u||(m(o),u=!0)},o(C){_(o),u=!1},d(C){C&&b(e),g.d(),C&&b(l),~s&&v[s].d(C),C&&b(a),f=!1,c()}}}const e5=1e6,hY=r=>r.label,$Y=r=>r.value;function bY(r,e,t){let n,i;const l=e5*5;let{files:s=[]}=e,{dataImport:o={valid:!0,schema:{}}}=e,{existingTableId:a}=e,u,f,c={},p=[],d=!1;function g(F){const j={};for(let z in F){const q=F[z].type;q!=="omit"&&(j[z]={name:z,type:q,constraints:jt[q.toUpperCase()].constraints})}return j}async function h(){try{const F=await xe.validateTableCSV({csvString:u,schema:c||{},tableId:a});t(3,c=F==null?void 0:F.schema),t(4,p=Object.keys(c||{}).filter(j=>c[j].type!=="omit")),(!f||p.indexOf(f)===-1)&&t(2,f=p[0]),t(5,d=!0)}catch{we.error("CSV Invalid, please try another CSV file")}}async function v(F){const j=Array.from(F.target.files);if(j.some(q=>q.size>=l)){we.error(`Files cannot exceed ${l/e5}MB. Please try again with smaller files.`);return}let z=new FileReader;z.addEventListener("load",function(q){t(12,u=q.target.result),t(0,s=j),h()}),z.readAsText(j[0])}async function k(F){t(3,c[F].type="omit",c),await h()}const C=F=>j=>{t(3,c[F].type=j.detail,c),h()},I=[{label:"Text",value:jt.STRING.type},{label:"Number",value:jt.NUMBER.type},{label:"Date",value:jt.DATETIME.type},{label:"Options",value:jt.OPTIONS.type},{label:"Multi-select",value:jt.ARRAY.type}];function O(F,j){r.$$.not_equal(c[j].type,F)&&(c[j].type=F,t(3,c))}const T=F=>k(F);function P(F){f=F,t(2,f)}function M(F){i=F,t(6,i),t(1,a)}return r.$$set=F=>{"files"in F&&t(0,s=F.files),"dataImport"in F&&t(11,o=F.dataImport),"existingTableId"in F&&t(1,a=F.existingTableId)},r.$$.update=()=>{r.$$.dirty&56&&t(13,n=!c||p.every(F=>c[F].success)&&(!d||Object.keys(c).length>0)),r.$$.dirty&12300&&t(11,o={valid:n,schema:g(c),csvString:u,primaryDisplay:f}),r.$$.dirty&2&&t(6,i=a?"No columns in CSV match existing table schema":"Could not find any columns to import")},[s,a,f,c,p,d,i,v,k,C,I,o,u,n,O,T,P,M]}class t5 extends ie{constructor(e){super();le(this,e,bY,_Y,re,{files:0,dataImport:11,existingTableId:1})}}function vY(r){let e;return{c(){e=V("Auto Columns")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function wY(r){let e;return{c(){e=V("Create Table from CSV (Optional)")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function yY(r){let e,t,n,i,l;e=new Ze({props:{grey:!0,extraSmall:!0,$$slots:{default:[wY]},$$scope:{ctx:r}}});function s(a){r[13](a)}let o={};return r[1]!==void 0&&(o.dataImport=r[1]),n=new t5({props:o}),K.push(()=>ce(n,"dataImport",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&262144&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&2&&(i=!0,c.dataImport=a[1],pe(()=>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 kY(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H,Y;function U(he){r[7](he)}let W={"data-cy":"table-name-input",thin:!0,label:"Table Name",error:r[2]};r[0]!==void 0&&(W.value=r[0]),e=new tt({props:W}),K.push(()=>ce(e,"value",U)),e.$on("input",r[4]),l=new Ze({props:{extraSmall:!0,grey:!0,$$slots:{default:[vY]},$$scope:{ctx:r}}});function G(he){r[8](he)}let Q={text:"Created by"};r[3].createdBy.enabled!==void 0&&(Q.value=r[3].createdBy.enabled),u=new Vn({props:Q}),K.push(()=>ce(u,"value",G));function fe(he){r[9](he)}let Z={text:"Created at"};r[3].createdAt.enabled!==void 0&&(Z.value=r[3].createdAt.enabled),p=new Vn({props:Z}),K.push(()=>ce(p,"value",fe));function ee(he){r[10](he)}let ae={text:"Auto ID"};r[3].autoID.enabled!==void 0&&(ae.value=r[3].autoID.enabled),h=new Vn({props:ae}),K.push(()=>ce(h,"value",ee));function _e(he){r[11](he)}let Re={text:"Updated by"};r[3].updatedBy.enabled!==void 0&&(Re.value=r[3].updatedBy.enabled),I=new Vn({props:Re}),K.push(()=>ce(I,"value",_e));function $e(he){r[12](he)}let be={text:"Updated at"};return r[3].updatedAt.enabled!==void 0&&(be.value=r[3].updatedAt.enabled),P=new Vn({props:be}),K.push(()=>ce(P,"value",$e)),j=new pn({}),H=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[yY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),S(u.$$.fragment),c=R(),S(p.$$.fragment),g=R(),S(h.$$.fragment),k=R(),C=D("div"),S(I.$$.fragment),T=R(),S(P.$$.fragment),F=R(),S(j.$$.fragment),z=R(),q=D("div"),S(H.$$.fragment),w(a,"class","toggle-1 svelte-19e3t83"),w(C,"class","toggle-2 svelte-19e3t83"),w(o,"class","toggles svelte-19e3t83"),w(i,"class","autocolumns svelte-19e3t83")},m(he,Ne){A(e,he,Ne),$(he,n,Ne),$(he,i,Ne),A(l,i,null),N(i,s),N(i,o),N(o,a),A(u,a,null),N(a,c),A(p,a,null),N(a,g),A(h,a,null),N(o,k),N(o,C),A(I,C,null),N(C,T),A(P,C,null),N(i,F),A(j,i,null),$(he,z,Ne),$(he,q,Ne),A(H,q,null),Y=!0},p(he,Ne){const Fe={};Ne&4&&(Fe.error=he[2]),!t&&Ne&1&&(t=!0,Fe.value=he[0],pe(()=>t=!1)),e.$set(Fe);const se={};Ne&262144&&(se.$$scope={dirty:Ne,ctx:he}),l.$set(se);const Ce={};!f&&Ne&8&&(f=!0,Ce.value=he[3].createdBy.enabled,pe(()=>f=!1)),u.$set(Ce);const me={};!d&&Ne&8&&(d=!0,me.value=he[3].createdAt.enabled,pe(()=>d=!1)),p.$set(me);const ke={};!v&&Ne&8&&(v=!0,ke.value=he[3].autoID.enabled,pe(()=>v=!1)),h.$set(ke);const ze={};!O&&Ne&8&&(O=!0,ze.value=he[3].updatedBy.enabled,pe(()=>O=!1)),I.$set(ze);const ye={};!M&&Ne&8&&(M=!0,ye.value=he[3].updatedAt.enabled,pe(()=>M=!1)),P.$set(ye);const Je={};Ne&262146&&(Je.$$scope={dirty:Ne,ctx:he}),H.$set(Je)},i(he){Y||(m(e.$$.fragment,he),m(l.$$.fragment,he),m(u.$$.fragment,he),m(p.$$.fragment,he),m(h.$$.fragment,he),m(I.$$.fragment,he),m(P.$$.fragment,he),m(j.$$.fragment,he),m(H.$$.fragment,he),Y=!0)},o(he){_(e.$$.fragment,he),_(l.$$.fragment,he),_(u.$$.fragment,he),_(p.$$.fragment,he),_(h.$$.fragment,he),_(I.$$.fragment,he),_(P.$$.fragment,he),_(j.$$.fragment,he),_(H.$$.fragment,he),Y=!1},d(he){E(e,he),he&&b(n),he&&b(i),E(l),E(u),E(p),E(h),E(I),E(P),E(j),he&&b(z),he&&b(q),E(H)}}}function CY(r){let e,t;return e=new Dt({props:{title:"Create Table",confirmText:"Create",onConfirm:r[5],disabled:r[2]||!r[0]||r[1]&&!r[1].valid,$$slots:{default:[kY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&7&&(l.disabled=n[2]||!n[0]||n[1]&&!n[1].valid),i&262159&&(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 SY(r,e,t){let n,i,l,s;ue(r,qt,T=>t(15,i=T)),ue(r,fS,T=>t(16,l=T)),ue(r,Ot,T=>t(6,s=T));let{name:o}=e,a,u="",f=_v();function c(T,P){for(let[M,F]of Object.entries(f))!F.enabled||(P[F.name]=hv(T,F.name,M));return P}function p(T){const P=T.target.value;if(n.includes(P)){t(2,u=`Table with name ${P} already exists. Please choose another name.`);return}t(2,u="")}async function d(){let T={name:o,schema:c(o,a.schema||{}),dataImport:a};a.primaryDisplay&&a.primaryDisplay.length&&(T.primaryDisplay=a.primaryDisplay);let P;try{P=await Ot.save(T),we.success(`Table ${o} created successfully.`),qn.captureEvent(Yn.TABLE.CREATED,{name:o});const F=l().endsWith("data")?`./table/${P._id}`:`../../table/${P._id}`;i(F)}catch(M){we.error(M),await Ot.fetch()}}function g(T){o=T,t(0,o)}function h(T){r.$$.not_equal(f.createdBy.enabled,T)&&(f.createdBy.enabled=T,t(3,f))}function v(T){r.$$.not_equal(f.createdAt.enabled,T)&&(f.createdAt.enabled=T,t(3,f))}function k(T){r.$$.not_equal(f.autoID.enabled,T)&&(f.autoID.enabled=T,t(3,f))}function C(T){r.$$.not_equal(f.updatedBy.enabled,T)&&(f.updatedBy.enabled=T,t(3,f))}function I(T){r.$$.not_equal(f.updatedAt.enabled,T)&&(f.updatedAt.enabled=T,t(3,f))}function O(T){a=T,t(1,a)}return r.$$set=T=>{"name"in T&&t(0,o=T.name)},r.$$.update=()=>{r.$$.dirty&64&&(n=s.list.map(T=>T.name))},[o,a,u,f,p,d,s,g,h,v,k,C,I,O]}class n5 extends ie{constructor(e){super();le(this,e,SY,CY,re,{name:0})}}function r5(r,e,t){const n=r.slice();return n[4]=e[t],n}function AY(r){let e,t;return e=new n5({}),{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 EY(r){let e;return{c(){e=V("Budibase Internal")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function OY(r){let e;return{c(){e=V(`Budibase internal tables are part of your app, so the data will be
|
|
1071
|
+
from this query.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function WG(r){let e,t,n,i,l;e=new Ke({props:{size:"S",$$slots:{default:[HG]},$$scope:{ctx:r}}});function s(a){r[54](a)}let o={name:"Variable",headings:!0,keyHeading:"Name",keyPlaceholder:"Variable name",valueHeading:"Value",valuePlaceholder:"{{ value }}",readOnly:r[7]};return r[6]!==void 0&&(o.object=r[6]),n=new vi({props:o}),K.push(()=>ce(n,"object",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[2]&32&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u[0]&128&&(c.readOnly=a[7]),!i&&u[0]&64&&(i=!0,c.object=a[6],pe(()=>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 GG(r){let e,t;return e=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[WG]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&192|i[2]&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 X4(r){let e,t,n,i,l,s,o;return t=new Ze({props:{size:"L",$$slots:{default:[YG]},$$scope:{ctx:r}}}),i=new Ze({props:{size:"L",$$slots:{default:[JG]},$$scope:{ctx:r}}}),s=new Ze({props:{size:"L",$$slots:{default:[QG]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","stats svelte-1ba99n2")},m(a,u){$(a,e,u),A(t,e,null),N(e,n),A(i,e,null),N(e,l),A(s,e,null),o=!0},p(a,u){const f={};u[0]&272|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),t.$set(f);const c={};u[0]&272|u[2]&32&&(c.$$scope={dirty:u,ctx:a}),i.$set(c);const p={};u[0]&272|u[2]&32&&(p.$$scope={dirty:u,ctx:a}),s.$set(p)},i(a){o||(m(t.$$.fragment,a),m(i.$$.fragment,a),m(s.$$.fragment,a),o=!0)},o(a){_(t.$$.fragment,a),_(i.$$.fragment,a),_(s.$$.fragment,a),o=!1},d(a){a&&b(e),E(t),E(i),E(s)}}}function YG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.code)+"",i,l;return{c(){e=V("Status: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.code)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function JG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.time)+"",i,l;return{c(){e=V("Time: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.time)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function QG(r){var s;let e,t,n=((s=r[4])==null?void 0:s.info.size)+"",i,l;return{c(){e=V("Size: "),t=D("span"),i=V(n),w(t,"class",l=""+(sr(r[8]?"green":"red")+" svelte-1ba99n2"))},m(o,a){$(o,e,a),$(o,t,a),N(t,i)},p(o,a){var u;a[0]&16&&n!==(n=((u=o[4])==null?void 0:u.info.size)+"")&&Te(i,n),a[0]&256&&l!==(l=""+(sr(o[8]?"green":"red")+" svelte-1ba99n2"))&&w(t,"class",l)},d(o){o&&b(e),o&&b(t)}}}function XG(r){let e,t,n,i,l,s,o=r[4]&&W4(r),a=(r[5]||r[4])&&G4(r),u=r[4]&&Y4(r),f=r[16]&&Q4(r),c=r[4]&&X4(r);return{c(){o&&o.c(),e=R(),a&&a.c(),t=R(),u&&u.c(),n=R(),f&&f.c(),i=R(),c&&c.c(),l=Ee()},m(p,d){o&&o.m(p,d),$(p,e,d),a&&a.m(p,d),$(p,t,d),u&&u.m(p,d),$(p,n,d),f&&f.m(p,d),$(p,i,d),c&&c.m(p,d),$(p,l,d),s=!0},p(p,d){p[4]?o?(o.p(p,d),d[0]&16&&m(o,1)):(o=W4(p),o.c(),m(o,1),o.m(e.parentNode,e)):o&&(te(),_(o,1,1,()=>{o=null}),ne()),p[5]||p[4]?a?(a.p(p,d),d[0]&48&&m(a,1)):(a=G4(p),a.c(),m(a,1),a.m(t.parentNode,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne()),p[4]?u?(u.p(p,d),d[0]&16&&m(u,1)):(u=Y4(p),u.c(),m(u,1),u.m(n.parentNode,n)):u&&(te(),_(u,1,1,()=>{u=null}),ne()),p[16]?f?(f.p(p,d),d[0]&65536&&m(f,1)):(f=Q4(p),f.c(),m(f,1),f.m(i.parentNode,i)):f&&(te(),_(f,1,1,()=>{f=null}),ne()),p[4]?c?(c.p(p,d),d[0]&16&&m(c,1)):(c=X4(p),c.c(),m(c,1),c.m(l.parentNode,l)):c&&(te(),_(c,1,1,()=>{c=null}),ne())},i(p){s||(m(o),m(a),m(u),m(f),m(c),s=!0)},o(p){_(o),_(a),_(u),_(f),_(c),s=!1},d(p){o&&o.d(p),p&&b(e),a&&a.d(p),p&&b(t),u&&u.d(p),p&&b(n),f&&f.d(p),p&&b(i),c&&c.d(p),p&&b(l)}}}function KG(r){let e;return{c(){e=V("Response")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ZG(r){let e="enter a url in the textbox above and click send to get a response".toUpperCase()+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function xG(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}});const a=[BG,jG],u=[];function f(c,p){return(n==null||p[0]&48)&&(n=!c[4]&&Object.keys(c[5]).length===0),n?0:1}return i=f(r,[-1,-1,-1]),l=u[i]=a[i](r),{c(){S(e.$$.fragment),t=R(),l.c(),s=Ee()},m(c,p){A(e,c,p),$(c,t,p),u[i].m(c,p),$(c,s,p),o=!0},p(c,p){let d=i;i=f(c,p),i===d?u[i].p(c,p):(te(),_(u[d],1,1,()=>{u[d]=null}),ne(),l=u[i],l?l.p(c,p):(l=u[i]=a[i](c),l.c()),m(l,1),l.m(s.parentNode,s))},i(c){o||(m(e.$$.fragment,c),m(l),o=!0)},o(c){_(e.$$.fragment,c),_(l),o=!1},d(c){E(e,c),c&&b(t),u[i].d(c),c&&b(s)}}}function eY(r){let e,t,n,i,l;function s(u){r[30](u)}let o={datasource:r[1],dynamicVariables:r[6]};r[14]!==void 0&&(o.binding=r[14]),e=new yG({props:o}),K.push(()=>ce(e,"binding",s)),r[31](e);let a=r[0]&&r[20]&&U4(r);return{c(){S(e.$$.fragment),n=R(),a&&a.c(),i=Ee()},m(u,f){A(e,u,f),$(u,n,f),a&&a.m(u,f),$(u,i,f),l=!0},p(u,f){const c={};f[0]&2&&(c.datasource=u[1]),f[0]&64&&(c.dynamicVariables=u[6]),!t&&f[0]&16384&&(t=!0,c.binding=u[14],pe(()=>t=!1)),e.$set(c),u[0]&&u[20]?a?(a.p(u,f),f[0]&1048577&&m(a,1)):(a=U4(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){r[31](null),E(e,u),u&&b(n),a&&a.d(u),u&&b(i)}}}const tY=()=>{},nY=r=>r.name,rY=r=>r.value;function iY(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,v,k;ue(r,en,Ve=>t(55,d=Ve)),ue(r,er,Ve=>t(56,g=Ve)),ue(r,kn,Ve=>t(57,h=Ve)),ue(r,Ql,Ve=>t(29,v=Ve)),ue(r,i1,Ve=>t(21,k=Ve));let C,I,O={},T={},P,M,F,j,z,q,H,Y,U;function W(){return vn.cloneDeep(h.list.find(Ve=>Ve._id===h.selected)||{datasourceId:g.selectedDatasource,parameters:[],fields:{disabledHeaders:{},headers:{}},queryVerb:"read"})}function G(Ve=null){C&&(!C.name||C.flags.urlName)&&(t(0,C.flags.urlName=!0,C),t(0,C.name=M||Ve,C))}function Q(Ve,Be){if(!Ve)return Ve;const Mt=Ol.buildQueryString(Be);let sn=Ve;return Ve.includes("?")&&(sn=Ve.split("?")[0]),Mt.length>0?`${sn}?${Mt}`:sn}function fe(){const Ve=Se({},C),Be=Ol.buildQueryString(O);return Ve.fields.path=M.split("?")[0],Ve.fields.queryString=Be,Ve.fields.authConfigId=q,Ve.fields.disabledHeaders=Ol.flipHeaderState(z),Ve.schema=Ol.fieldsToSchema(j),Ve.parameters=Ol.keyValueToQueryParameters(T),Ve}async function Z(){const Ve=fe();try{const{_id:Be}=await kn.save(Ve.datasourceId,Ve);t(10,P=Be),t(0,C=W()),we.success("Request saved successfully"),H&&(t(1,I.config.dynamicVariables=he(P),I),t(1,I=await en.save(I)))}catch{we.error("Error saving query")}}async function ee(){try{t(4,F=await kn.preview(fe(C))),F.rows.length===0?we.info("Request did not return any data"):(t(4,F.info=F.info||{code:200},F),t(5,j=F.schema),we.success("Request sent successfully"))}catch{we.error("Error running query")}}const ae=()=>{var Be,Mt;let Ve=C.fields.authConfigId;return Ve&&(((Mt=(Be=I==null?void 0:I.config)==null?void 0:Be.authConfigs)==null?void 0:Mt.filter(Cn=>Cn._id===Ve)[0])||(Ve=void 0)),Ve},_e=Ve=>{var Be;return((Be=Ve==null?void 0:Ve.config)==null?void 0:Be.authConfigs)?Ve.config.authConfigs.map(Mt=>({label:Mt.name,value:Mt._id})):[]},Re=[{text:"Create dynamic variable",onClick:Ve=>{t(14,U=`{{ data.0.[${Ve.name}] }}`),Y.show()}}],$e=[{text:"Create dynamic variable",onClick:Ve=>{t(14,U=`{{ info.headers.[${Ve.name}] }}`),Y.show()}}],be=(Ve,Be)=>{var sn;const Mt=(sn=Ve==null?void 0:Ve.config)==null?void 0:sn.dynamicVariables;return Mt&&Mt.length>0?(Be?Mt.filter(Ar=>Ar.queryId===Be):Mt).reduce((Ar,yi)=>lt(Se({},Ar),{[yi.name]:yi.value}),{}):{}},he=Ve=>{var sn;let Be=[];H&&(Be=Object.entries(H).map(Cn=>({name:Cn[0],value:Cn[1],queryId:Ve})));let Mt=((sn=I==null?void 0:I.config)==null?void 0:sn.dynamicVariables)||[];return Mt=Mt.filter(Cn=>Cn.queryId!==Ve),[...Mt,...Be]},Ne=(Ve,Be)=>!!(Ve&&(!Be||Object.keys(Ve).length>0)),Fe=async(Ve,Be)=>{try{await i1.updateFlag(Ve,Be)}catch{we.error("Error updating flag")}};Gt(async()=>{t(0,C=W());try{await en.init()}catch{we.error("Error getting datasources")}t(1,I=d.list.find(sn=>sn._id===(C==null?void 0:C.datasourceId)));const Ve=I==null?void 0:I.config.url,Be=C==null?void 0:C.fields.queryString;t(2,O=Ol.breakQueryString(Be));const Mt=C.fields.path;Ve&&!(Mt==null?void 0:Mt.startsWith("http"))&&!(Mt==null?void 0:Mt.startsWith("{{"))&&t(0,C.fields.path=`${I.config.url}/${Mt||""}`,C),t(3,M=Q(C.fields.path,O)),t(5,j=Ol.schemaToFields(C.schema)),t(9,T=Ol.queryParametersToKeyValue(C.parameters)),t(12,q=ae()),C.fields.disabledHeaders||t(0,C.fields.disabledHeaders={},C);for(let sn of Object.keys(C.fields.headers))C.fields.disabledHeaders[sn]||t(0,C.fields.disabledHeaders[sn]=!1,C);t(11,z=Ol.flipHeaderState(C.fields.disabledHeaders)),C&&!C.transformer&&t(0,C.transformer="return data",C),C&&!C.flags&&t(0,C.flags={urlName:!1},C),C&&!C.fields.bodyType&&(C.fields.requestBody?t(0,C.fields.bodyType=$i.JSON,C):t(0,C.fields.bodyType=$i.NONE,C)),C&&!C.fields.pagination&&t(0,C.fields.pagination={},C),t(6,H=be(I,C._id))});function se(Ve){U=Ve,t(14,U)}function Ce(Ve){K[Ve?"unshift":"push"](()=>{Y=Ve,t(13,Y)})}function me(Ve){r.$$.not_equal(C.name,Ve)&&(C.name=Ve,t(0,C))}const ke=()=>t(0,C.flags.urlName=!1,C),ze=Ve=>{var Be;return((Be=l[Ve])==null?void 0:Be.displayName)||Sr(Ve)};function ye(Ve){r.$$.not_equal(C.queryVerb,Ve)&&(C.queryVerb=Ve,t(0,C))}function Je(Ve){M=Ve,t(3,M),t(2,O)}function Nt(Ve){T=Ve,t(9,T)}function qe(Ve){O=Ve,t(2,O)}function pt(Ve){r.$$.not_equal(C.fields.headers,Ve)&&(C.fields.headers=Ve,t(0,C))}function Rt(Ve){z=Ve,t(11,z)}function Ie(Ve){r.$$.not_equal(C.fields.bodyType,Ve)&&(C.fields.bodyType=Ve,t(0,C))}function Ge(Ve){r.$$.not_equal(C.fields.bodyType,Ve)&&(C.fields.bodyType=Ve,t(0,C))}function Ue(Ve){C=Ve,t(0,C)}function at(Ve){r.$$.not_equal(C.fields.pagination.type,Ve)&&(C.fields.pagination.type=Ve,t(0,C))}function Le(Ve){r.$$.not_equal(C.fields.pagination.location,Ve)&&(C.fields.pagination.location=Ve,t(0,C))}function Bt(Ve){r.$$.not_equal(C.fields.pagination.pageParam,Ve)&&(C.fields.pagination.pageParam=Ve,t(0,C))}function gn(Ve){r.$$.not_equal(C.fields.pagination.sizeParam,Ve)&&(C.fields.pagination.sizeParam=Ve,t(0,C))}function fn(Ve){r.$$.not_equal(C.fields.pagination.responseParam,Ve)&&(C.fields.pagination.responseParam=Ve,t(0,C))}const on=()=>window.open("https://docs.budibase.com/docs/transformers"),$r=()=>Fe("queryTransformerBanner",!0),In=Ve=>t(0,C.transformer=Ve.detail,C);function ar(Ve){q=Ve,t(12,q)}function ir(Ve){j=Ve,t(5,j)}function nl(Ve){H=Ve,t(6,H)}return r.$$.update=()=>{var Ve,Be;r.$$.dirty[0]&2&&t(28,n=I==null?void 0:I.source),r.$$.dirty[0]&805306368&&t(27,i=v[n]),r.$$.dirty[0]&134217728&&t(20,l=i==null?void 0:i.query),r.$$.dirty[0]&12&&t(3,M=Q(M,O)),r.$$.dirty[0]&8&&G(M),r.$$.dirty[0]&16&&t(8,s=((Ve=F==null?void 0:F.info)==null?void 0:Ve.code)>=200&&((Be=F==null?void 0:F.info)==null?void 0:Be.code)<400),r.$$.dirty[0]&1&&t(19,o=(C==null?void 0:C.queryVerb)==="read"),r.$$.dirty[0]&2&&t(18,a=_e(I)),r.$$.dirty[0]&256&&t(17,u=!s),r.$$.dirty[0]&256&&t(7,f=!s),r.$$.dirty[0]&192&&t(16,c=Ne(H,f)),r.$$.dirty[0]&33&&t(15,p=Object.keys(j||{}).length!==0||Object.keys((C==null?void 0:C.schema)||{}).length!==0)},[C,I,O,M,F,j,H,f,s,T,P,z,q,Y,U,p,c,u,a,o,l,k,Z,ee,Re,$e,Fe,i,n,v,se,Ce,me,ke,ze,ye,Je,Nt,qe,pt,Rt,Ie,Ge,Ue,at,Le,Bt,gn,fn,on,$r,In,ar,ir,nl]}class lY extends ie{constructor(e){super();le(this,e,iY,eY,re,{},null,[-1,-1,-1])}}function sY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function oY(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,kn,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.query){const o=i.list.find(a=>a._id===n.query);o&&kn.select(o)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class aY extends ie{constructor(e){super();le(this,e,oY,sY,re,{})}}function uY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function fY(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,en,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.selectedDatasource&&!n.query){const o=i.list.find(a=>a._id===n.selectedDatasource);o&&en.select(o._id)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class cY extends ie{constructor(e){super();le(this,e,fY,uY,re,{})}}function K4(r,e,t){const n=r.slice();return n[21]=e[t],n[22]=e,n[23]=t,n}function pY(r){let e;return{c(){e=V("Upload")},m(t,n){$(t,e,n)},p:Oe,d(t){t&&b(e)}}}function dY(r){let e=r[0][0].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0][0].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function mY(r){let e,t,n,i;function l(o){r[17](o)}let s={header:"Invalid CSV",type:"error"};return r[6]!==void 0&&(s.message=r[6]),t=new n1({props:s}),K.push(()=>ce(t,"message",l)),{c(){e=D("div"),S(t.$$.fragment)},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,a){const u={};!n&&a&64&&(n=!0,u.message=o[6],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function gY(r){let e,t,n,i,l=r[4],s=[];for(let u=0;u<l.length;u+=1)s[u]=Z4(K4(r,l,u));const o=u=>_(s[u],1,1,()=>{s[u]=null});let a=!r[1]&&x4(r);return{c(){e=D("div");for(let u=0;u<s.length;u+=1)s[u].c();t=R(),a&&a.c(),n=Ee(),w(e,"class","schema-fields svelte-1rdzppm")},m(u,f){$(u,e,f);for(let c=0;c<s.length;c+=1)s[c].m(e,null);$(u,t,f),a&&a.m(u,f),$(u,n,f),i=!0},p(u,f){if(f&1818){l=u[4];let c;for(c=0;c<l.length;c+=1){const p=K4(u,l,c);s[c]?(s[c].p(p,f),m(s[c],1)):(s[c]=Z4(p),s[c].c(),m(s[c],1),s[c].m(e,null))}for(te(),c=l.length;c<s.length;c+=1)o(c);ne()}u[1]?a&&(te(),_(a,1,1,()=>{a=null}),ne()):a?(a.p(u,f),f&2&&m(a,1)):(a=x4(u),a.c(),m(a,1),a.m(n.parentNode,n))},i(u){if(!i){for(let f=0;f<l.length;f+=1)m(s[f]);m(a),i=!0}},o(u){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)_(s[f]);_(a),i=!1},d(u){u&&b(e),$t(s,u),u&&b(t),a&&a.d(u),u&&b(n)}}}function Z4(r){let e,t,n=r[21]+"",i,l,s,o,a,u,f=(r[3][r[21]].success?"Success":"Failure")+"",c,p,d,g,h,v,k;function C(T){r[14](T,r[21])}let I={options:r[10],placeholder:null,getOptionLabel:hY,getOptionValue:$Y,disabled:!!r[1]};r[3][r[21]].type!==void 0&&(I.value=r[3][r[21]].type),s=new Xe({props:I}),K.push(()=>ce(s,"value",C)),s.$on("change",function(){mt(r[9](r[21]))&&r[9](r[21]).apply(this,arguments)});function O(){return r[15](r[21])}return{c(){e=D("div"),t=D("span"),i=V(n),l=R(),S(s.$$.fragment),a=R(),u=D("span"),c=V(f),p=R(),d=D("i"),g=R(),w(u,"class","field-status svelte-1rdzppm"),oe(u,"error",!r[3][r[21]].success),w(d,"class","omit-button ri-close-circle-fill svelte-1rdzppm"),w(e,"class","field svelte-1rdzppm")},m(T,P){$(T,e,P),N(e,t),N(t,i),N(e,l),A(s,e,null),N(e,a),N(e,u),N(u,c),N(e,p),N(e,d),N(e,g),h=!0,v||(k=Pe(d,"click",O),v=!0)},p(T,P){r=T,(!h||P&16)&&n!==(n=r[21]+"")&&Te(i,n);const M={};P&2&&(M.disabled=!!r[1]),!o&&P&24&&(o=!0,M.value=r[3][r[21]].type,pe(()=>o=!1)),s.$set(M),(!h||P&24)&&f!==(f=(r[3][r[21]].success?"Success":"Failure")+"")&&Te(c,f),P&24&&oe(u,"error",!r[3][r[21]].success)},i(T){h||(m(s.$$.fragment,T),h=!0)},o(T){_(s.$$.fragment,T),h=!1},d(T){T&&b(e),E(s),v=!1,k()}}}function x4(r){let e,t,n,i;function l(o){r[16](o)}let s={label:"Display Column",options:r[4],sort:!0};return r[2]!==void 0&&(s.value=r[2]),t=new Xe({props:s}),K.push(()=>ce(t,"value",l)),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","display-column svelte-1rdzppm")},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,a){const u={};a&16&&(u.options=o[4]),!n&&a&4&&(n=!0,u.value=o[2],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function _Y(r){let e,t,n,i,l,s,o,a,u,f,c;function p(C,I){return C[0][0]?dY:pY}let d=p(r),g=d(r);const h=[gY,mY],v=[];function k(C,I){return C[4].length?0:C[5]?1:-1}return~(s=k(r))&&(o=v[s]=h[s](r)),{c(){e=D("div"),t=D("input"),n=R(),i=D("label"),g.c(),l=R(),o&&o.c(),a=Ee(),w(t,"id","file-upload"),w(t,"accept",".csv"),w(t,"type","file"),w(t,"class","svelte-1rdzppm"),w(i,"for","file-upload"),w(i,"class","svelte-1rdzppm"),oe(i,"uploaded",r[0][0]),w(e,"class","dropzone svelte-1rdzppm")},m(C,I){$(C,e,I),N(e,t),N(e,n),N(e,i),g.m(i,null),$(C,l,I),~s&&v[s].m(C,I),$(C,a,I),u=!0,f||(c=Pe(t,"change",r[7]),f=!0)},p(C,[I]){d===(d=p(C))&&g?g.p(C,I):(g.d(1),g=d(C),g&&(g.c(),g.m(i,null))),I&1&&oe(i,"uploaded",C[0][0]);let O=s;s=k(C),s===O?~s&&v[s].p(C,I):(o&&(te(),_(v[O],1,1,()=>{v[O]=null}),ne()),~s?(o=v[s],o?o.p(C,I):(o=v[s]=h[s](C),o.c()),m(o,1),o.m(a.parentNode,a)):o=null)},i(C){u||(m(o),u=!0)},o(C){_(o),u=!1},d(C){C&&b(e),g.d(),C&&b(l),~s&&v[s].d(C),C&&b(a),f=!1,c()}}}const e5=1e6,hY=r=>r.label,$Y=r=>r.value;function bY(r,e,t){let n,i;const l=e5*5;let{files:s=[]}=e,{dataImport:o={valid:!0,schema:{}}}=e,{existingTableId:a}=e,u,f,c={},p=[],d=!1;function g(F){const j={};for(let z in F){const q=F[z].type;q!=="omit"&&(j[z]={name:z,type:q,constraints:jt[q.toUpperCase()].constraints})}return j}async function h(){try{const F=await xe.validateTableCSV({csvString:u,schema:c||{},tableId:a});t(3,c=F==null?void 0:F.schema),t(4,p=Object.keys(c||{}).filter(j=>c[j].type!=="omit")),(!f||p.indexOf(f)===-1)&&t(2,f=p[0]),t(5,d=!0)}catch{we.error("CSV Invalid, please try another CSV file")}}async function v(F){const j=Array.from(F.target.files);if(j.some(q=>q.size>=l)){we.error(`Files cannot exceed ${l/e5}MB. Please try again with smaller files.`);return}let z=new FileReader;z.addEventListener("load",function(q){t(12,u=q.target.result),t(0,s=j),h()}),z.readAsText(j[0])}async function k(F){t(3,c[F].type="omit",c),await h()}const C=F=>j=>{t(3,c[F].type=j.detail,c),h()},I=[{label:"Text",value:jt.STRING.type},{label:"Number",value:jt.NUMBER.type},{label:"Date",value:jt.DATETIME.type},{label:"Options",value:jt.OPTIONS.type},{label:"Multi-select",value:jt.ARRAY.type}];function O(F,j){r.$$.not_equal(c[j].type,F)&&(c[j].type=F,t(3,c))}const T=F=>k(F);function P(F){f=F,t(2,f)}function M(F){i=F,t(6,i),t(1,a)}return r.$$set=F=>{"files"in F&&t(0,s=F.files),"dataImport"in F&&t(11,o=F.dataImport),"existingTableId"in F&&t(1,a=F.existingTableId)},r.$$.update=()=>{r.$$.dirty&56&&t(13,n=!c||p.every(F=>c[F].success)&&(!d||Object.keys(c).length>0)),r.$$.dirty&12300&&t(11,o={valid:n,schema:g(c),csvString:u,primaryDisplay:f}),r.$$.dirty&2&&t(6,i=a?"No columns in CSV match existing table schema":"Could not find any columns to import")},[s,a,f,c,p,d,i,v,k,C,I,o,u,n,O,T,P,M]}class t5 extends ie{constructor(e){super();le(this,e,bY,_Y,re,{files:0,dataImport:11,existingTableId:1})}}function vY(r){let e;return{c(){e=V("Auto Columns")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function wY(r){let e;return{c(){e=V("Create Table from CSV (Optional)")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function yY(r){let e,t,n,i,l;e=new Ze({props:{grey:!0,extraSmall:!0,$$slots:{default:[wY]},$$scope:{ctx:r}}});function s(a){r[13](a)}let o={};return r[1]!==void 0&&(o.dataImport=r[1]),n=new t5({props:o}),K.push(()=>ce(n,"dataImport",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&262144&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&2&&(i=!0,c.dataImport=a[1],pe(()=>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 kY(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H,Y;function U(he){r[7](he)}let W={"data-cy":"table-name-input",thin:!0,label:"Table Name",error:r[2]};r[0]!==void 0&&(W.value=r[0]),e=new tt({props:W}),K.push(()=>ce(e,"value",U)),e.$on("input",r[4]),l=new Ze({props:{extraSmall:!0,grey:!0,$$slots:{default:[vY]},$$scope:{ctx:r}}});function G(he){r[8](he)}let Q={text:"Created by"};r[3].createdBy.enabled!==void 0&&(Q.value=r[3].createdBy.enabled),u=new Vn({props:Q}),K.push(()=>ce(u,"value",G));function fe(he){r[9](he)}let Z={text:"Created at"};r[3].createdAt.enabled!==void 0&&(Z.value=r[3].createdAt.enabled),p=new Vn({props:Z}),K.push(()=>ce(p,"value",fe));function ee(he){r[10](he)}let ae={text:"Auto ID"};r[3].autoID.enabled!==void 0&&(ae.value=r[3].autoID.enabled),h=new Vn({props:ae}),K.push(()=>ce(h,"value",ee));function _e(he){r[11](he)}let Re={text:"Updated by"};r[3].updatedBy.enabled!==void 0&&(Re.value=r[3].updatedBy.enabled),I=new Vn({props:Re}),K.push(()=>ce(I,"value",_e));function $e(he){r[12](he)}let be={text:"Updated at"};return r[3].updatedAt.enabled!==void 0&&(be.value=r[3].updatedAt.enabled),P=new Vn({props:be}),K.push(()=>ce(P,"value",$e)),j=new pn({}),H=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[yY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),S(u.$$.fragment),c=R(),S(p.$$.fragment),g=R(),S(h.$$.fragment),k=R(),C=D("div"),S(I.$$.fragment),T=R(),S(P.$$.fragment),F=R(),S(j.$$.fragment),z=R(),q=D("div"),S(H.$$.fragment),w(a,"class","toggle-1 svelte-19e3t83"),w(C,"class","toggle-2 svelte-19e3t83"),w(o,"class","toggles svelte-19e3t83"),w(i,"class","autocolumns svelte-19e3t83")},m(he,Ne){A(e,he,Ne),$(he,n,Ne),$(he,i,Ne),A(l,i,null),N(i,s),N(i,o),N(o,a),A(u,a,null),N(a,c),A(p,a,null),N(a,g),A(h,a,null),N(o,k),N(o,C),A(I,C,null),N(C,T),A(P,C,null),N(i,F),A(j,i,null),$(he,z,Ne),$(he,q,Ne),A(H,q,null),Y=!0},p(he,Ne){const Fe={};Ne&4&&(Fe.error=he[2]),!t&&Ne&1&&(t=!0,Fe.value=he[0],pe(()=>t=!1)),e.$set(Fe);const se={};Ne&262144&&(se.$$scope={dirty:Ne,ctx:he}),l.$set(se);const Ce={};!f&&Ne&8&&(f=!0,Ce.value=he[3].createdBy.enabled,pe(()=>f=!1)),u.$set(Ce);const me={};!d&&Ne&8&&(d=!0,me.value=he[3].createdAt.enabled,pe(()=>d=!1)),p.$set(me);const ke={};!v&&Ne&8&&(v=!0,ke.value=he[3].autoID.enabled,pe(()=>v=!1)),h.$set(ke);const ze={};!O&&Ne&8&&(O=!0,ze.value=he[3].updatedBy.enabled,pe(()=>O=!1)),I.$set(ze);const ye={};!M&&Ne&8&&(M=!0,ye.value=he[3].updatedAt.enabled,pe(()=>M=!1)),P.$set(ye);const Je={};Ne&262146&&(Je.$$scope={dirty:Ne,ctx:he}),H.$set(Je)},i(he){Y||(m(e.$$.fragment,he),m(l.$$.fragment,he),m(u.$$.fragment,he),m(p.$$.fragment,he),m(h.$$.fragment,he),m(I.$$.fragment,he),m(P.$$.fragment,he),m(j.$$.fragment,he),m(H.$$.fragment,he),Y=!0)},o(he){_(e.$$.fragment,he),_(l.$$.fragment,he),_(u.$$.fragment,he),_(p.$$.fragment,he),_(h.$$.fragment,he),_(I.$$.fragment,he),_(P.$$.fragment,he),_(j.$$.fragment,he),_(H.$$.fragment,he),Y=!1},d(he){E(e,he),he&&b(n),he&&b(i),E(l),E(u),E(p),E(h),E(I),E(P),E(j),he&&b(z),he&&b(q),E(H)}}}function CY(r){let e,t;return e=new Dt({props:{title:"Create Table",confirmText:"Create",onConfirm:r[5],disabled:r[2]||!r[0]||r[1]&&!r[1].valid,$$slots:{default:[kY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&7&&(l.disabled=n[2]||!n[0]||n[1]&&!n[1].valid),i&262159&&(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 SY(r,e,t){let n,i,l,s;ue(r,qt,T=>t(15,i=T)),ue(r,fS,T=>t(16,l=T)),ue(r,Ot,T=>t(6,s=T));let{name:o}=e,a,u="",f=_v();function c(T,P){for(let[M,F]of Object.entries(f))!F.enabled||(P[F.name]=hv(T,F.name,M));return P}function p(T){const P=T.target.value;if(n.includes(P)){t(2,u=`Table with name ${P} already exists. Please choose another name.`);return}t(2,u="")}async function d(){let T={name:o,schema:c(o,a.schema||{}),dataImport:a};a.primaryDisplay&&a.primaryDisplay.length&&(T.primaryDisplay=a.primaryDisplay);let P;try{P=await Ot.save(T),we.success(`Table ${o} created successfully.`),qn.captureEvent(Yn.TABLE.CREATED,{name:o});const F=l().endsWith("data")?`./table/${P._id}`:`../../table/${P._id}`;i(F)}catch(M){we.error(M),await Ot.fetch()}}function g(T){o=T,t(0,o)}function h(T){r.$$.not_equal(f.createdBy.enabled,T)&&(f.createdBy.enabled=T,t(3,f))}function v(T){r.$$.not_equal(f.createdAt.enabled,T)&&(f.createdAt.enabled=T,t(3,f))}function k(T){r.$$.not_equal(f.autoID.enabled,T)&&(f.autoID.enabled=T,t(3,f))}function C(T){r.$$.not_equal(f.updatedBy.enabled,T)&&(f.updatedBy.enabled=T,t(3,f))}function I(T){r.$$.not_equal(f.updatedAt.enabled,T)&&(f.updatedAt.enabled=T,t(3,f))}function O(T){a=T,t(1,a)}return r.$$set=T=>{"name"in T&&t(0,o=T.name)},r.$$.update=()=>{r.$$.dirty&64&&(n=s.list.map(T=>T.name))},[o,a,u,f,p,d,s,g,h,v,k,C,I,O]}class n5 extends ie{constructor(e){super();le(this,e,SY,CY,re,{name:0})}}function r5(r,e,t){const n=r.slice();return n[4]=e[t],n}function AY(r){let e,t;return e=new n5({}),{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 EY(r){let e;return{c(){e=V("Budibase Internal")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function OY(r){let e;return{c(){e=V(`Budibase internal tables are part of your app, so the data will be
|
|
1072
1072
|
stored in your apps context.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function TY(r){let e,t,n,i,l,s,o;var a=el.BUDIBASE;function u(f){return{props:{height:"26",width:"26"}}}return a&&(t=new a(u())),i=new Ct({props:{size:"M",$$slots:{default:[EY]},$$scope:{ctx:r}}}),s=new Ke({props:{size:"M",$$slots:{default:[OY]},$$scope:{ctx:r}}}),{c(){e=D("header"),t&&S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","svelte-1q89mrt")},m(f,c){$(f,e,c),t&&A(t,e,null),N(e,n),A(i,e,null),$(f,l,c),A(s,f,c),o=!0},p(f,c){if(a!==(a=el.BUDIBASE)){if(t){te();const g=t;_(g.$$.fragment,1,0,()=>{E(g,1)}),ne()}a?(t=new a(u()),S(t.$$.fragment),m(t.$$.fragment,1),A(t,e,n)):t=null}const p={};c&128&&(p.$$scope={dirty:c,ctx:f}),i.$set(p);const d={};c&128&&(d.$$scope={dirty:c,ctx:f}),s.$set(d)},i(f){o||(t&&m(t.$$.fragment,f),m(i.$$.fragment,f),m(s.$$.fragment,f),o=!0)},o(f){t&&_(t.$$.fragment,f),_(i.$$.fragment,f),_(s.$$.fragment,f),o=!1},d(f){f&&b(e),t&&E(t),E(i),f&&b(l),E(s,f)}}}function IY(r){let e;return{c(){e=V("Tables")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function LY(r){let e=r[4].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&2&&e!==(e=n[4].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function i5(r){let e,t;return e=new Ke({props:{size:"S",$$slots:{default:[PY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&130&&(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 PY(r){let e,t=r[4].primaryDisplay+"",n;return{c(){e=V("Display column: "),n=V(t)},m(i,l){$(i,e,l),$(i,n,l)},p(i,l){l&2&&t!==(t=i[4].primaryDisplay+"")&&Te(n,t)},d(i){i&&b(e),i&&b(n)}}}function l5(r){let e,t,n,i,l,s,o;t=new Ke({props:{size:"S",$$slots:{default:[LY]},$$scope:{ctx:r}}});let a=r[4].primaryDisplay&&i5(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),a&&a.c(),i=R(),w(e,"class","table-list-item svelte-1q89mrt")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),a&&a.m(e,null),N(e,i),l=!0,s||(o=Pe(e,"click",function(){mt(r[2](`../../table/${r[4]._id}`))&&r[2](`../../table/${r[4]._id}`).apply(this,arguments)}),s=!0)},p(u,f){r=u;const c={};f&130&&(c.$$scope={dirty:f,ctx:r}),t.$set(c),r[4].primaryDisplay?a?(a.p(r,f),f&2&&m(a,1)):(a=i5(r),a.c(),m(a,1),a.m(e,i)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(t.$$.fragment,u),m(a),l=!0)},o(u){_(t.$$.fragment,u),_(a),l=!1},d(u){u&&b(e),E(t),a&&a.d(),s=!1,o()}}}function NY(r){let e;return{c(){e=V("Create new table")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function RY(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[TY]},$$scope:{ctx:r}}}),n=new pn({}),l=new Ct({props:{size:"S",$$slots:{default:[IY]},$$scope:{ctx:r}}});let p=r[1].list.filter(s5),d=[];for(let h=0;h<p.length;h+=1)d[h]=l5(r5(r,p,h));const g=h=>_(d[h],1,1,()=>{d[h]=null});return f=new gt({props:{cta:!0,$$slots:{default:[NY]},$$scope:{ctx:r}}}),f.$on("click",function(){mt(r[0].show)&&r[0].show.apply(this,arguments)}),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),o=D("div");for(let h=0;h<d.length;h+=1)d[h].c();a=R(),u=D("div"),S(f.$$.fragment),w(o,"class","table-list svelte-1q89mrt")},m(h,v){A(e,h,v),$(h,t,v),A(n,h,v),$(h,i,v),A(l,h,v),$(h,s,v),$(h,o,v);for(let k=0;k<d.length;k+=1)d[k].m(o,null);$(h,a,v),$(h,u,v),A(f,u,null),c=!0},p(h,v){r=h;const k={};v&128&&(k.$$scope={dirty:v,ctx:r}),e.$set(k);const C={};if(v&128&&(C.$$scope={dirty:v,ctx:r}),l.$set(C),v&6){p=r[1].list.filter(s5);let O;for(O=0;O<p.length;O+=1){const T=r5(r,p,O);d[O]?(d[O].p(T,v),m(d[O],1)):(d[O]=l5(T),d[O].c(),m(d[O],1),d[O].m(o,null))}for(te(),O=p.length;O<d.length;O+=1)g(O);ne()}const I={};v&128&&(I.$$scope={dirty:v,ctx:r}),f.$set(I)},i(h){if(!c){m(e.$$.fragment,h),m(n.$$.fragment,h),m(l.$$.fragment,h);for(let v=0;v<p.length;v+=1)m(d[v]);m(f.$$.fragment,h),c=!0}},o(h){_(e.$$.fragment,h),_(n.$$.fragment,h),_(l.$$.fragment,h),d=d.filter(Boolean);for(let v=0;v<d.length;v+=1)_(d[v]);_(f.$$.fragment,h),c=!1},d(h){E(e,h),h&&b(t),E(n,h),h&&b(i),E(l,h),h&&b(s),h&&b(o),$t(d,h),h&&b(a),h&&b(u),E(f)}}}function MY(r){let e,t,n,i,l,s={$$slots:{default:[AY]},$$scope:{ctx:r}};return e=new Et({props:s}),r[3](e),i=new Qe({props:{$$slots:{default:[RY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=D("section"),S(i.$$.fragment),w(n,"class","svelte-1q89mrt")},m(o,a){A(e,o,a),$(o,t,a),$(o,n,a),A(i,n,null),l=!0},p(o,[a]){const u={};a&128&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&135&&(f.$$scope={dirty:a,ctx:o}),i.$set(f)},i(o){l||(m(e.$$.fragment,o),m(i.$$.fragment,o),l=!0)},o(o){_(e.$$.fragment,o),_(i.$$.fragment,o),l=!1},d(o){r[3](null),E(e,o),o&&b(t),o&&b(n),E(i)}}}const s5=r=>r.type!=="external";function DY(r,e,t){let n,i;ue(r,Ot,o=>t(1,n=o)),ue(r,qt,o=>t(2,i=o));let l;function s(o){K[o?"unshift":"push"](()=>{l=o,t(0,l)})}return[l,n,i,s]}class jY extends ie{constructor(e){super();le(this,e,DY,MY,re,{})}}function BY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function zY(r,e,t){let{$$slots:n={},$$scope:i}=e;return en.select("bb_internal"),r.$$set=l=>{"$$scope"in l&&t(0,i=l.$$scope)},[i,n]}class qY extends ie{constructor(e){super();le(this,e,zY,BY,re,{})}}function UY(r){let e;return{c(){e=D("i"),e.textContent="Select a datasource to edit",w(e,"class","svelte-o5phob")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function FY(r){let e;return{c(){e=D("i"),e.textContent="Connect your first datasource to start building.",w(e,"class","svelte-o5phob")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function VY(r){let e;function t(l,s){return l[0].list.length===0?FY:UY}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.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},i:Oe,o:Oe,d(l){i.d(l),l&&b(e)}}}function HY(r,e,t){let n,i;return ue(r,en,l=>t(0,n=l)),ue(r,qt,l=>t(1,i=l)),Gt(async()=>{n.list.length>0&&i(`./${n.list[0]._id}`)}),[n]}class WY extends ie{constructor(e){super();le(this,e,HY,VY,re,{})}}function GY(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function YY(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=l=>{"$$scope"in l&&t(0,i=l.$$scope)},[i,n]}class JY extends ie{constructor(e){super();le(this,e,YY,GY,re,{})}}function QY(r){let e={},t=it(en).list.filter(l=>l.source===r.type).length,n=ks[r.type],i=t===0?n:`${n}-${t+1}`;return e.type="datasource",e.source=r.type,e.config=r.config,e.name=i,e.plus=r.plus,e}async function w1(r,e=!1){const t=QY(r),n=await en.save(t,!e&&t.plus);return await Ot.fetch(),await en.select(n._id),qn.captureEvent(Yn.DATASOURCE.CREATED,{name:n.name,source:n.source}),n}async function XY(r){const e=mp(r);return w1(e)}function KY(r){let e;return{c(){e=V("Connect your database to Budibase using the config below.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ZY(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[KY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1024&&(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 xY(r){let e,t,n,i,l;e=new Qe({props:{noPadding:!0,$$slots:{default:[ZY]},$$scope:{ctx:r}}});function s(a){r[5](a)}let o={schema:r[1].schema,creating:!0};return r[1]!==void 0&&(o.datasource=r[1]),n=new k4({props:o}),K.push(()=>ce(n,"datasource",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&1024&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};u&2&&(c.schema=a[1].schema),!i&&u&2&&(i=!0,c.datasource=a[1],pe(()=>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 eJ(r){let e,t;return e=new Dt({props:{title:`Connect to ${ks[r[1].type]}`,onConfirm:r[6],onCancel:r[7],confirmText:r[1].plus?"Save and fetch tables":"Save and continue to query",cancelText:"Back",showSecondaryButton:r[1].plus,secondaryButtonText:r[1].plus?"Skip table fetch":void 0,secondaryAction:r[8],size:"L",$$slots:{default:[xY]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.title=`Connect to ${ks[n[1].type]}`),i&1&&(l.onCancel=n[7]),i&2&&(l.confirmText=n[1].plus?"Save and fetch tables":"Save and continue to query"),i&2&&(l.showSecondaryButton=n[1].plus),i&2&&(l.secondaryButtonText=n[1].plus?"Skip table fetch":void 0),i&4&&(l.secondaryAction=n[8]),i&1026&&(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 tJ(r,e,t){let n;ue(r,qt,d=>t(9,n=d));let{integration:i}=e,{modal:l}=e,s=mp(i),o=!1;async function a(){var d;try{const g=await w1(s,o);n(`./datasource/${g._id}`),we.success("Datasource updated successfully.")}catch(g){return we.error((d=g==null?void 0:g.message)!=null?d:"Error saving datasource"),!1}}Gt(()=>{t(2,o=!1)});function u(d){s=d,t(1,s)}const f=()=>a(),c=()=>l.show(),p=()=>(t(2,o=!0),a(),!0);return r.$$set=d=>{"integration"in d&&t(4,i=d.integration),"modal"in d&&t(0,l=d.modal)},[l,s,o,a,i,u,f,c,p]}class nJ extends ie{constructor(e){super();le(this,e,tJ,eJ,re,{integration:4,modal:0})}}var o5="/builder/assets/google-logo.c16467b8.png";function rJ(r){let e,t,n,i,l;return{c(){e=D("div"),t=D("img"),i=R(),l=D("p"),l.textContent="Sign in with Google",dn(t.src,n=o5)||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:Oe,d(s){s&&b(e)}}}function iJ(r){let e,t;return e=new Jt({props:{$$slots:{default:[rJ]},$$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&64&&(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 lJ(r,e,t){let n,i,l;ue(r,Vt,u=>t(4,i=u)),ue(r,He,u=>t(3,l=u));let{preAuthStep:s}=e,{datasource:o}=e;const a=async()=>{let u=o;u||(u=await s()),window.open(`/api/global/auth/${n}/datasource/google?datasourceId=${u._id}&appId=${l.appId}`,"_blank")};return r.$$set=u=>{"preAuthStep"in u&&t(0,s=u.preAuthStep),"datasource"in u&&t(1,o=u.datasource)},r.$$.update=()=>{r.$$.dirty&16&&t(2,n=i.tenantId)},[s,o,n,l,i,a]}class sJ extends ie{constructor(e){super();le(this,e,lJ,iJ,re,{preAuthStep:0,datasource:1})}}function oJ(r){let e,t=ks[r[1].type]+"",n,i;return{c(){e=V("Authenticate with your google account to use the "),n=V(t),i=V(" integration.")},m(l,s){$(l,e,s),$(l,n,s),$(l,i,s)},p:Oe,d(l){l&&b(e),l&&b(n),l&&b(i)}}}function aJ(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[oJ]},$$scope:{ctx:r}}}),{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 uJ(r){let e,t,n,i;return e=new Qe({props:{noPadding:!0,$$slots:{default:[aJ]},$$scope:{ctx:r}}}),n=new sJ({props:{preAuthStep:r[3]}}),{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&32&&(o.$$scope={dirty:s,ctx:l}),e.$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 fJ(r){let e,t;return e=new Dt({props:{title:`Connect to ${ks[r[1].type]}`,onCancel:r[4],cancelText:"Back",size:"L",$$slots:{default:[uJ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.onCancel=n[4]),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 cJ(r,e,t){let{integration:n}=e,{modal:i}=e,l=mp(n);const s=()=>w1(l,!0),o=()=>i.show();return r.$$set=a=>{"integration"in a&&t(2,n=a.integration),"modal"in a&&t(0,i=a.modal)},[i,l,n,s,o]}class pJ extends ie{constructor(e){super();le(this,e,cJ,fJ,re,{integration:2,modal:0})}}function a5(r,e,t){const n=r.slice();return n[23]=e[t][0],n[24]=e[t][1],n}function dJ(r){let e,t;return e=new n5({}),{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 mJ(r){let e,t;return e=new nJ({props:{integration:r[2],modal:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.integration=n[2]),i&1&&(l.modal=n[0]),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 gJ(r){let e,t;return e=new pJ({props:{integration:r[2],modal:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.integration=n[2]),i&1&&(l.modal=n[0]),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 _J(r){let e,t,n,i;const l=[gJ,mJ],s=[];function o(a,u){var f,c;return((c=(f=a[2])==null?void 0:f.auth)==null?void 0:c.type)==="google"?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function u5(r){let e,t;return e=new R4({props:{navigateDatasource:!0,createDatasource:!0,onCancel:r[12]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.onCancel=n[12]),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 hJ(r){let e,t,n=r[2].type==="REST"&&u5(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].type==="REST"?n?(n.p(i,l),l&4&&m(n,1)):(n=u5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function $J(r){let e;return{c(){e=V(`All apps need data. You can connect to a data source below, or add data
|
|
1073
1073
|
to your app using Budibase's built-in database.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function bJ(r){let e;return{c(){e=V("Budibase DB")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function vJ(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ke({props:{size:"S",$$slots:{default:[$J]},$$scope:{ctx:r}}});var p=el.BUDIBASE;function d(g){return{props:{height:"18",width:"18"}}}return p&&(l=new p(d())),a=new Ke({props:{size:"S",$$slots:{default:[bJ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=D("div"),i=D("div"),l&&S(l.$$.fragment),s=R(),o=D("span"),S(a.$$.fragment),w(o,"class","icon-spacing svelte-1akvwnp"),w(i,"class","item-body svelte-1akvwnp"),w(n,"class","item hoverable svelte-1akvwnp"),oe(n,"selected",r[2].type===yn.INTERNAL)},m(g,h){A(e,g,h),$(g,t,h),$(g,n,h),N(n,i),l&&A(l,i,null),N(i,s),N(i,o),A(a,o,null),u=!0,f||(c=Pe(n,"click",r[14]),f=!0)},p(g,h){const v={};if(h&134217728&&(v.$$scope={dirty:h,ctx:g}),e.$set(v),p!==(p=el.BUDIBASE)){if(l){te();const C=l;_(C.$$.fragment,1,0,()=>{E(C,1)}),ne()}p?(l=new p(d()),S(l.$$.fragment),m(l.$$.fragment,1),A(l,i,s)):l=null}const k={};h&134217728&&(k.$$scope={dirty:h,ctx:g}),a.$set(k),h&4&&oe(n,"selected",g[2].type===yn.INTERNAL)},i(g){u||(m(e.$$.fragment,g),l&&m(l.$$.fragment,g),m(a.$$.fragment,g),u=!0)},o(g){_(e.$$.fragment,g),l&&_(l.$$.fragment,g),_(a.$$.fragment,g),u=!1},d(g){E(e,g),g&&b(t),g&&b(n),l&&E(l),E(a),f=!1,c()}}}function wJ(r){let e;return{c(){e=V("Connect to data source")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function yJ(r){let e=(r[24].name||ks[r[23]])+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&2&&e!==(e=(n[24].name||ks[n[23]])+"")&&Te(t,e)},d(n){n&&b(t)}}}function f5(r){let e,t,n,i,l,s,o,a,u,f;var c=el[r[23]];function p(g){return{props:{height:"18",width:"18"}}}c&&(n=new c(p())),s=new Ke({props:{size:"S",$$slots:{default:[yJ]},$$scope:{ctx:r}}});function d(){return r[16](r[23])}return{c(){e=D("div"),t=D("div"),n&&S(n.$$.fragment),i=R(),l=D("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-1akvwnp"),w(t,"class","item-body svelte-1akvwnp"),w(e,"class","item hoverable svelte-1akvwnp"),oe(e,"selected",r[2].type===r[23])},m(g,h){$(g,e,h),N(e,t),n&&A(n,t,null),N(t,i),N(t,l),A(s,l,null),N(e,o),a=!0,u||(f=Pe(e,"click",d),u=!0)},p(g,h){if(r=g,c!==(c=el[r[23]])){if(n){te();const k=n;_(k.$$.fragment,1,0,()=>{E(k,1)}),ne()}c?(n=new c(p()),S(n.$$.fragment),m(n.$$.fragment,1),A(n,t,i)):n=null}const v={};h&134217730&&(v.$$scope={dirty:h,ctx:r}),s.$set(v),h&6&&oe(e,"selected",r[2].type===r[23])},i(g){a||(n&&m(n.$$.fragment,g),m(s.$$.fragment,g),a=!0)},o(g){n&&_(n.$$.fragment,g),_(s.$$.fragment,g),a=!1},d(g){g&&b(e),n&&E(n),E(s),u=!1,f()}}}function kJ(r){let e,t,n,i,l;t=new mr({props:{size:"S",$$slots:{default:[wJ]},$$scope:{ctx:r}}});let s=Object.entries(r[1]).filter(r[15]),o=[];for(let u=0;u<s.length;u+=1)o[u]=f5(a5(r,s,u));const a=u=>_(o[u],1,1,()=>{o[u]=null});return{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div");for(let u=0;u<o.length;u+=1)o[u].c();w(e,"class","title-spacing"),w(i,"class","item-list svelte-1akvwnp")},m(u,f){$(u,e,f),A(t,e,null),$(u,n,f),$(u,i,f);for(let c=0;c<o.length;c+=1)o[c].m(i,null);l=!0},p(u,f){const c={};if(f&134217728&&(c.$$scope={dirty:f,ctx:u}),t.$set(c),f&134){s=Object.entries(u[1]).filter(u[15]);let p;for(p=0;p<s.length;p+=1){const d=a5(u,s,p);o[p]?(o[p].p(d,f),m(o[p],1)):(o[p]=f5(d),o[p].c(),m(o[p],1),o[p].m(i,null))}for(te(),p=s.length;p<o.length;p+=1)a(p);ne()}},i(u){if(!l){m(t.$$.fragment,u);for(let f=0;f<s.length;f+=1)m(o[f]);l=!0}},o(u){_(t.$$.fragment,u),o=o.filter(Boolean);for(let f=0;f<o.length;f+=1)_(o[f]);l=!1},d(u){u&&b(e),E(t),u&&b(n),u&&b(i),$t(o,u)}}}function CJ(r){let e,t,n,i;return e=new Qe({props:{noPadding:!0,$$slots:{default:[vJ]},$$scope:{ctx:r}}}),n=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[kJ]},$$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&134217732&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&134217734&&(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 SJ(r){let e,t;return e=new Dt({props:{disabled:!Object.keys(r[2]).length,title:"Data",confirmText:"Continue",showSecondaryButton:r[6],secondaryButtonText:"Import",secondaryAction:r[17],showCancelButton:!1,size:"M",onConfirm:r[18],$$slots:{default:[CJ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.disabled=!Object.keys(n[2]).length),i&64&&(l.showSecondaryButton=n[6]),i&134217734&&(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 AJ(r){let e,t,n,i,l,s,o,a,u={$$slots:{default:[dJ]},$$scope:{ctx:r}};e=new Et({props:u}),r[10](e);let f={$$slots:{default:[_J]},$$scope:{ctx:r}};n=new Et({props:f}),r[11](n);let c={$$slots:{default:[hJ]},$$scope:{ctx:r}};l=new Et({props:c}),r[13](l);let p={$$slots:{default:[SJ]},$$scope:{ctx:r}};return o=new Et({props:p}),r[19](o),{c(){S(e.$$.fragment),t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),s=R(),S(o.$$.fragment)},m(d,g){A(e,d,g),$(d,t,g),A(n,d,g),$(d,i,g),A(l,d,g),$(d,s,g),A(o,d,g),a=!0},p(d,[g]){const h={};g&134217728&&(h.$$scope={dirty:g,ctx:d}),e.$set(h);const v={};g&134217733&&(v.$$scope={dirty:g,ctx:d}),n.$set(v);const k={};g&134217733&&(k.$$scope={dirty:g,ctx:d}),l.$set(k);const C={};g&134217798&&(C.$$scope={dirty:g,ctx:d}),o.$set(C)},i(d){a||(m(e.$$.fragment,d),m(n.$$.fragment,d),m(l.$$.fragment,d),m(o.$$.fragment,d),a=!0)},o(d){_(e.$$.fragment,d),_(n.$$.fragment,d),_(l.$$.fragment,d),_(o.$$.fragment,d),a=!1},d(d){r[10](null),E(e,d),d&&b(t),r[11](null),E(n,d),d&&b(i),r[13](null),E(l,d),d&&b(s),r[19](null),E(o,d)}}}function EJ(r,e,t){let n,i;ue(r,qt,z=>t(20,i=z));let{modal:l}=e,s={},o={},a,u,f;p(),Gt(()=>{h()});function c(z){const q=s[z],H={};for(let Y of Object.keys(q.datasource))H[Y]=q.datasource[Y].default;t(2,o={type:z,plus:q.plus,config:H,schema:q.datasource,auth:q.auth}),p()}function p(){t(6,n=o.type==="REST")}function d(){f.show()}async function g(){if(o.type===yn.INTERNAL)u.hide(),a.show();else if(o.type===yn.REST)try{const z=await XY(o);i(`./datasource/${z._id}`)}catch{we.error("Error creating datasource")}else u.show()}async function h(){let z={[yn.INTERNAL]:{datasource:{},name:"INTERNAL/CSV"}};try{const q=await xe.getIntegrations();z=Se(Se({},z),q)}catch{we.error("Error fetching integrations")}t(1,s=z)}function v(z){K[z?"unshift":"push"](()=>{a=z,t(3,a)})}function k(z){K[z?"unshift":"push"](()=>{u=z,t(4,u)})}const C=()=>l.show();function I(z){K[z?"unshift":"push"](()=>{f=z,t(5,f)})}const O=()=>c(yn.INTERNAL),T=([z])=>z!==yn.INTERNAL,P=z=>c(z),M=()=>d(),F=()=>{g()};function j(z){K[z?"unshift":"push"](()=>{l=z,t(0,l)})}return r.$$set=z=>{"modal"in z&&t(0,l=z.modal)},t(6,n=!1),[l,s,o,a,u,f,n,c,d,g,v,k,C,I,O,T,P,M,F,j]}class c5 extends ie{constructor(e){super();le(this,e,EJ,AJ,re,{modal:0})}}function OJ(r){let e,t,n;function i(s){r[2](s)}let l={};return r[0]!==void 0&&(l.modal=r[0]),e=new c5({props:l}),K.push(()=>ce(e,"modal",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};!t&&o&1&&(t=!0,a.modal=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function TJ(r,e,t){let n,i,l,s;ue(r,qt,u=>t(4,i=u)),ue(r,An,u=>t(5,l=u)),ue(r,en,u=>t(1,s=u));let o;Gt(()=>{!n&&!l.isDev?o.show():i("./table")});function a(u){o=u,t(0,o)}return r.$$.update=()=>{var u;r.$$.dirty&2&&(n=((u=s.list.find(f=>f._id="bb_internal"))==null?void 0:u.entities.length)>1||s.list.length>1)},[o,s,a]}class IJ extends ie{constructor(e){super();le(this,e,TJ,OJ,re,{})}}function LJ(r){let e;return{c(){e=V(r[1])},m(t,n){$(t,e,n)},p(t,n){n&2&&Te(e,t[1])},d(t){t&&b(e)}}}function PJ(r){let e,t,n;var i=r[0];function l(s){return{}}return i&&(e=new i(l()),e.$on("updaterows",r[3])),{c(){e&&S(e.$$.fragment),t=Ee()},m(s,o){e&&A(e,s,o),$(s,t,o),n=!0},p(s,o){if(i!==(i=s[0])){if(e){te();const a=e;_(a.$$.fragment,1,0,()=>{E(a,1)}),ne()}i?(e=new i(l()),e.$on("updaterows",s[3]),S(e.$$.fragment),m(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}},i(s){n||(e&&m(e.$$.fragment,s),n=!0)},o(s){e&&_(e.$$.fragment,s),n=!1},d(s){s&&b(t),e&&E(e,s)}}}function NJ(r){let e,t,n,i;e=new Jt({props:{icon:"TableRowAddBottom",size:"S",quiet:!0,$$slots:{default:[LJ]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[2].show)&&r[2].show.apply(this,arguments)});let l={$$slots:{default:[PJ]},$$scope:{ctx:r}};return n=new Et({props:l}),r[4](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&34&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o&33&&(u.$$scope={dirty:o,ctx:r}),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[4](null),E(n,s)}}}function RJ(r,e,t){let{modalContentComponent:n=_1}=e,{title:i="Create row"}=e,l;function s(a){ft.call(this,r,a)}function o(a){K[a?"unshift":"push"](()=>{l=a,t(2,l)})}return r.$$set=a=>{"modalContentComponent"in a&&t(0,n=a.modalContentComponent),"title"in a&&t(1,i=a.title)},[n,i,l,s,o]}class MJ extends ie{constructor(e){super();le(this,e,RJ,NJ,re,{modalContentComponent:0,title:1})}}function DJ(r){let e;return{c(){e=V("Create column")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function jJ(r){let e,t;return e=new Kv({}),e.$on("updatecolumns",r[1]),{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 BJ(r){let e,t,n,i;e=new Jt({props:{icon:"TableColumnAddRight",quiet:!0,size:"S",$$slots:{default:[DJ]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[0].show)&&r[0].show.apply(this,arguments)});let l={$$slots:{default:[jJ]},$$scope:{ctx:r}};return n=new Et({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]){r=s;const a={};o&8&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o&8&&(u.$$scope={dirty:o,ctx:r}),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[2](null),E(n,s)}}}function zJ(r,e,t){let n;function i(s){ft.call(this,r,s)}function l(s){K[s?"unshift":"push"](()=>{n=s,t(0,n)})}return[n,i,l]}class qJ extends ie{constructor(e){super();le(this,e,zJ,BJ,re,{})}}function UJ(r){let e,t,n;function i(s){r[3](s)}let l={label:"View Name",thin:!0};return r[0]!==void 0&&(l.value=r[0]),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function FJ(r){let e,t;return e=new Dt({props:{title:"Create View",confirmText:"Create View",onConfirm:r[1],$$slots:{default:[UJ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&129&&(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 VJ(r,e,t){let n,i,l;ue(r,qt,f=>t(5,i=f)),ue(r,Ot,f=>t(2,l=f));let s,o;function a(){if(n.includes(s)){we.error(`View exists with name ${s}`);return}try{gr.save({name:s,tableId:l.selected._id,field:o}),we.success(`View ${s} created`),qn.captureEvent(Yn.VIEW.CREATED,{name:s}),i(`../../view/${s}`)}catch{we.error("Error creating view")}}function u(f){s=f,t(0,s)}return r.$$.update=()=>{r.$$.dirty&4&&(n=l.list.flatMap(f=>Object.keys(f.views||{})))},[s,a,l,u]}class HJ extends ie{constructor(e){super();le(this,e,VJ,FJ,re,{})}}function WJ(r){let e;return{c(){e=V("Create view")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function GJ(r){let e,t;return e=new HJ({}),{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 YJ(r){let e,t,n,i;e=new Jt({props:{icon:"CollectionAdd",size:"S",quiet:!0,$$slots:{default:[WJ]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[0].show)&&r[0].show.apply(this,arguments)});let l={$$slots:{default:[GJ]},$$scope:{ctx:r}};return n=new Et({props:l}),r[1](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&4&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o&4&&(u.$$scope={dirty:o,ctx:r}),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[1](null),E(n,s)}}}function JJ(r,e,t){let n;function i(l){K[l?"unshift":"push"](()=>{n=l,t(0,n)})}return[n,i]}class QJ extends ie{constructor(e){super();le(this,e,JJ,YJ,re,{})}}function p5(r){let e,t,n,i,l;t=new Jt({props:{icon:"DataCorrelated",primary:!0,size:"S",quiet:!0,$$slots:{default:[XJ]},$$scope:{ctx:r}}}),t.$on("click",function(){mt(r[2].show)&&r[2].show.apply(this,arguments)});let s={$$slots:{default:[KJ]},$$scope:{ctx:r}};return i=new Et({props:s}),r[6](i),{c(){e=D("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&256&&(u.$$scope={dirty:a,ctx:r}),t.$set(u);const f={};a&271&&(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[6](null),E(i,o)}}}function XJ(r){let e;return{c(){e=V("Define existing relationship")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function KJ(r){let e,t;return e=new P4({props:{datasource:r[1],save:r[4],close:r[2].hide,plusTables:r[3],selectedFromTable:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.datasource=n[1]),i&4&&(l.close=n[2].hide),i&8&&(l.plusTables=n[3]),i&1&&(l.selectedFromTable=n[0]),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 ZJ(r){let e,t,n=r[0].sourceId&&p5(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].sourceId?n?(n.p(i,l),l&1&&m(n,1)):(n=p5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function xJ(r,e,t){let n,i,l;ue(r,en,c=>t(5,l=c));let{table:s}=e;const o=ht();let a;async function u(){try{await en.save(i),we.success("Relationship information saved.");const c=await Ot.fetch();await Ot.select(c.find(p=>p._id===s._id)),o("updatecolumns")}catch(c){we.error(`Error saving relationship info: ${c}`)}}function f(c){K[c?"unshift":"push"](()=>{a=c,t(2,a)})}return r.$$set=c=>{"table"in c&&t(0,s=c.table)},r.$$.update=()=>{r.$$.dirty&33&&t(1,i=l.list.find(c=>c._id===(s==null?void 0:s.sourceId))),r.$$.dirty&2&&t(3,n=(i==null?void 0:i.plus)?Object.values((i==null?void 0:i.entities)||{}):[])},[s,i,a,n,u,l,f]}class eQ extends ie{constructor(e){super();le(this,e,xJ,ZJ,re,{table:0})}}function tQ(r){let e,t,n;function i(s){r[4](s)}let l={label:"Format",options:r[1],placeholder:null,getOptionLabel:rQ,getOptionValue:iQ};return r[0]!==void 0&&(l.value=r[0]),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function nQ(r){let e,t;return e=new Dt({props:{title:"Export Data",confirmText:"Export",onConfirm:r[2],$$slots:{default:[tQ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&33&&(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)}}}const rQ=r=>r.name,iQ=r=>r.key;function lQ(r,e,t){const n=[{name:"CSV",key:"csv"},{name:"JSON",key:"json"}];let{view:i}=e,l=n[0].key;async function s(){try{const a=await xe.exportView({viewName:i,format:l});c_(a,`export.${l}`)}catch{we.error(`Unable to export ${l.toUpperCase()} data`)}}function o(a){l=a,t(0,l)}return r.$$set=a=>{"view"in a&&t(3,i=a.view)},[l,n,s,i,o]}class sQ extends ie{constructor(e){super();le(this,e,lQ,nQ,re,{view:3})}}function oQ(r){let e;return{c(){e=V("Export")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function aQ(r){let e,t;return e=new sQ({props:{view:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.view=n[0]),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 uQ(r){let e,t,n,i;e=new Jt({props:{icon:"DataDownload",size:"S",quiet:!0,$$slots:{default:[oQ]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[aQ]},$$scope:{ctx:r}};return n=new Et({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]){r=s;const a={};o&8&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o&9&&(u.$$scope={dirty:o,ctx:r}),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[2](null),E(n,s)}}}function fQ(r,e,t){let{view:n}=e,i;function l(s){K[s?"unshift":"push"](()=>{i=s,t(1,i)})}return r.$$set=s=>{"view"in s&&t(0,n=s.view)},[n,i,l]}class d5 extends ie{constructor(e){super();le(this,e,fQ,uQ,re,{view:0})}}function cQ(r){let e;return{c(){e=V(`Import rows to an existing table from a CSV. Only columns from the CSV which
|
|
1074
1074
|
exist in the table will be imported.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pQ(r){let e;return{c(){e=V("CSV to import")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function dQ(r){let e,t,n,i,l,s;e=new Ze({props:{grey:!0,extraSmall:!0,$$slots:{default:[pQ]},$$scope:{ctx:r}}});function o(f){r[4](f)}function a(f){r[5](f)}let u={};return r[1]!==void 0&&(u.dataImport=r[1]),r[0]!==void 0&&(u.existingTableId=r[0]),n=new t5({props:u}),K.push(()=>ce(n,"dataImport",o)),K.push(()=>ce(n,"existingTableId",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&128&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const d={};!i&&c&2&&(i=!0,d.dataImport=f[1],pe(()=>i=!1)),!l&&c&1&&(l=!0,d.existingTableId=f[0],pe(()=>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 mQ(r){let e,t,n,i;return e=new Ke({props:{size:"S",$$slots:{default:[cQ]},$$scope:{ctx:r}}}),n=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[dQ]},$$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&128&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&131&&(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 gQ(r){let e,t;return e=new Dt({props:{title:"Import Data",confirmText:"Import",onConfirm:r[3],disabled:!r[2],$$slots:{default:[mQ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&4&&(l.disabled=!n[2]),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 _Q(r,e,t){let n;const i=ht();let{tableId:l}=e,s;async function o(){try{await xe.importTableData({tableId:l,data:s}),we.success("Rows successfully imported")}catch{we.error("Unable to import data")}i("updaterows")}function a(f){s=f,t(1,s)}function u(f){l=f,t(0,l)}return r.$$set=f=>{"tableId"in f&&t(0,l=f.tableId)},r.$$.update=()=>{r.$$.dirty&2&&t(2,n=(s==null?void 0:s.csvString)!=null&&(s==null?void 0:s.valid))},[l,s,n,o,a,u]}class hQ extends ie{constructor(e){super();le(this,e,_Q,gQ,re,{tableId:0})}}function $Q(r){let e;return{c(){e=V("Import")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function bQ(r){let e,t;return e=new hQ({props:{tableId:r[0]}}),e.$on("updaterows",r[2]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.tableId=n[0]),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 vQ(r){let e,t,n,i;e=new Jt({props:{icon:"DataUpload",size:"S",quiet:!0,$$slots:{default:[$Q]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[bQ]},$$scope:{ctx:r}};return n=new Et({props:l}),r[3](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&16&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o&17&&(u.$$scope={dirty:o,ctx:r}),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[3](null),E(n,s)}}}function wQ(r,e,t){let{tableId:n}=e,i;function l(o){ft.call(this,r,o)}function s(o){K[o?"unshift":"push"](()=>{i=o,t(1,i)})}return r.$$set=o=>{"tableId"in o&&t(0,n=o.tableId)},[n,i,l,s]}class yQ extends ie{constructor(e){super();le(this,e,wQ,vQ,re,{tableId:0})}}function m5(r){let e,t;return e=new g1({props:{errors:r[4]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.errors=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 g5(r){let e,t,n,i,l,s,o,a,u;function f(v){r[13](v)}let c={label:"Name",disabled:r[8].includes(r[0].name)};r[0].name!==void 0&&(c.value=r[0].name),e=new tt({props:c}),K.push(()=>ce(e,"value",f));function p(v){r[14](v)}let d={label:"Inherits Role",options:r[7],getOptionValue:TQ,getOptionLabel:IQ,disabled:r[8].includes(r[0].name)};r[0].inherits!==void 0&&(d.value=r[0].inherits),i=new Xe({props:d}),K.push(()=>ce(i,"value",p));function g(v){r[15](v)}let h={label:"Base Permissions",options:r[3],getOptionValue:LQ,getOptionLabel:PQ,disabled:r[8].includes(r[0].name)};return r[0].permissionId!==void 0&&(h.value=r[0].permissionId),o=new Xe({props:h}),K.push(()=>ce(o,"value",g)),{c(){S(e.$$.fragment),n=R(),S(i.$$.fragment),s=R(),S(o.$$.fragment)},m(v,k){A(e,v,k),$(v,n,k),A(i,v,k),$(v,s,k),A(o,v,k),u=!0},p(v,k){const C={};k&1&&(C.disabled=v[8].includes(v[0].name)),!t&&k&1&&(t=!0,C.value=v[0].name,pe(()=>t=!1)),e.$set(C);const I={};k&128&&(I.options=v[7]),k&1&&(I.disabled=v[8].includes(v[0].name)),!l&&k&1&&(l=!0,I.value=v[0].inherits,pe(()=>l=!1)),i.$set(I);const O={};k&8&&(O.options=v[3]),k&1&&(O.disabled=v[8].includes(v[0].name)),!a&&k&1&&(a=!0,O.value=v[0].permissionId,pe(()=>a=!1)),o.$set(O)},i(v){u||(m(e.$$.fragment,v),m(i.$$.fragment,v),m(o.$$.fragment,v),u=!0)},o(v){_(e.$$.fragment,v),_(i.$$.fragment,v),_(o.$$.fragment,v),u=!1},d(v){E(e,v),v&&b(n),E(i,v),v&&b(s),E(o,v)}}}function kQ(r){let e,t,n,i,l,s=r[4].length&&m5(r);t=new Xe({props:{thin:!0,secondary:!0,label:"Role",value:r[1],options:r[2],placeholder:"Create new role",getOptionValue:EQ,getOptionLabel:OQ}}),t.$on("change",r[9]);let o=r[0]&&g5(r);return{c(){s&&s.c(),e=R(),S(t.$$.fragment),n=R(),o&&o.c(),i=Ee()},m(a,u){s&&s.m(a,u),$(a,e,u),A(t,a,u),$(a,n,u),o&&o.m(a,u),$(a,i,u),l=!0},p(a,u){a[4].length?s?(s.p(a,u),u&16&&m(s,1)):(s=m5(a),s.c(),m(s,1),s.m(e.parentNode,e)):s&&(te(),_(s,1,1,()=>{s=null}),ne());const f={};u&2&&(f.value=a[1]),u&4&&(f.options=a[2]),t.$set(f),a[0]?o?(o.p(a,u),u&1&&m(o,1)):(o=g5(a),o.c(),m(o,1),o.m(i.parentNode,i)):o&&(te(),_(o,1,1,()=>{o=null}),ne())},i(a){l||(m(s),m(t.$$.fragment,a),m(o),l=!0)},o(a){_(s),_(t.$$.fragment,a),_(o),l=!1},d(a){s&&s.d(a),a&&b(e),E(t,a),a&&b(n),o&&o.d(a),a&&b(i)}}}function _5(r){let e,t;return e=new gt({props:{warning:!0,$$slots:{default:[CQ]},$$scope:{ctx:r}}}),e.$on("click",r[11]),{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 CQ(r){let e;return{c(){e=V("Delete")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function SQ(r){let e,t,n=!r[6]&&_5(r);return{c(){e=D("div"),n&&n.c(),w(e,"slot","footer")},m(i,l){$(i,e,l),n&&n.m(e,null),t=!0},p(i,l){i[6]?n&&(te(),_(n,1,1,()=>{n=null}),ne()):n?(n.p(i,l),l&64&&m(n,1)):(n=_5(i),n.c(),m(n,1),n.m(e,null))},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){i&&b(e),n&&n.d()}}}function AQ(r){let e,t;return e=new Dt({props:{title:"Edit Roles",confirmText:r[6]?"Create":"Save",onConfirm:r[10],disabled:!r[5],$$slots:{footer:[SQ],default:[kQ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&64&&(l.confirmText=n[6]?"Create":"Save"),i&32&&(l.disabled=!n[5]),i&262367&&(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)}}}const EQ=r=>r._id,OQ=r=>r.name,TQ=r=>r._id,IQ=r=>r.name,LQ=r=>r._id,PQ=r=>r.name;function NQ(r,e,t){let n,i,l,s,o,a;ue(r,Zi,T=>t(12,a=T));const u={_id:"",inherits:"BASIC",permissionId:"write"};let f=[],c=u,p=[],d=["Admin","Power","Basic","Public"];const g=async()=>{try{t(3,f=await xe.getBasePermissions())}catch{we.error("Error fetching base permission options"),t(3,f=[])}},h=T=>{var F,j;const P=T==null?void 0:T.detail,M=a.find(z=>z._id===P);M?t(0,c=lt(Se({},M),{inherits:(F=M.inherits)!=null?F:"",permissionId:(j=M.permissionId)!=null?j:""})):t(0,c=u),t(4,p=[])},v=async()=>{if(t(4,p=[]),["_id","inherits","permissionId"].forEach(P=>{c[P]===""&&delete c[P]}),(!c.name||c.name.trim()==="")&&p.push({message:"Please enter a role name"}),c.permissionId||p.push({message:"Please choose permissions"}),p.length)return!1;try{await Zi.save(c),we.success("Role saved successfully")}catch{return we.error("Error saving role"),!1}},k=async()=>{try{await Zi.delete(c),h(),we.success("Role deleted successfully")}catch{we.error("Error deleting role")}};Gt(g);function C(T){r.$$.not_equal(c.name,T)&&(c.name=T,t(0,c))}function I(T){r.$$.not_equal(c.inherits,T)&&(c.inherits=T,t(0,c))}function O(T){r.$$.not_equal(c.permissionId,T)&&(c.permissionId=T,t(0,c))}return r.$$.update=()=>{r.$$.dirty&4096&&t(2,n=a.filter(T=>T._id!=="PUBLIC")),r.$$.dirty&1&&t(1,i=c._id),r.$$.dirty&6&&t(7,l=n.filter(T=>T._id!==i)),r.$$.dirty&2&&t(6,s=i==null||i===""),r.$$.dirty&1&&t(5,o=c.name&&c.inherits&&c.permissionId&&!d.includes(c.name))},[c,i,n,f,p,o,s,l,d,h,v,k,a,C,I,O]}class RQ extends ie{constructor(e){super();le(this,e,NQ,AQ,re,{})}}function MQ(r){let e;return{c(){e=V("Edit roles")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function DQ(r){let e,t;return e=new RQ({}),{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 jQ(r){let e,t,n,i,l;t=new gt({props:{icon:"UsersLock",primary:!0,size:"S",quiet:!0,$$slots:{default:[MQ]},$$scope:{ctx:r}}}),t.$on("click",function(){mt(r[0].show)&&r[0].show.apply(this,arguments)});let s={$$slots:{default:[DQ]},$$scope:{ctx:r}};return i=new Et({props:s}),r[1](i),{c(){e=D("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&4&&(u.$$scope={dirty:a,ctx:r}),t.$set(u);const f={};a&4&&(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[1](null),E(i,o)}}}function BQ(r,e,t){let n;function i(l){K[l?"unshift":"push"](()=>{n=l,t(0,n)})}return[n,i]}class zQ extends ie{constructor(e){super();le(this,e,BQ,jQ,re,{})}}function h5(r,e,t){const n=r.slice();return n[5]=e[t],n}function qQ(r){let e;return{c(){e=V("Specify the minimum access level role for this data.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function UQ(r){let e;return{c(){e=V("Level")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function FQ(r){let e;return{c(){e=V("Role")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $5(r){let e,t,n,i;e=new tt({props:{value:Sr(r[5]),disabled:!0}});function l(...s){return r[4](r[5],...s)}return n=new Xe({props:{value:r[0][r[5]],options:r[1],getOptionLabel:WQ,getOptionValue:GQ}}),n.$on("change",l),{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&1&&(a.value=Sr(r[5])),e.$set(a);const u={};o&1&&(u.value=r[0][r[5]]),o&2&&(u.options=r[1]),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),E(n,s)}}}function VQ(r){let e,t,n,i,l,s,o,a;e=new Ke({props:{size:"S",$$slots:{default:[qQ]},$$scope:{ctx:r}}}),i=new Ze({props:{extraSmall:!0,grey:!0,$$slots:{default:[UQ]},$$scope:{ctx:r}}}),s=new Ze({props:{extraSmall:!0,grey:!0,$$slots:{default:[FQ]},$$scope:{ctx:r}}});let u=Object.keys(r[0]),f=[];for(let p=0;p<u.length;p+=1)f[p]=$5(h5(r,u,p));const c=p=>_(f[p],1,1,()=>{f[p]=null});return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R();for(let p=0;p<f.length;p+=1)f[p].c();w(n,"class","row svelte-txil9n")},m(p,d){A(e,p,d),$(p,t,d),$(p,n,d),A(i,n,null),N(n,l),A(s,n,null),N(n,o);for(let g=0;g<f.length;g+=1)f[g].m(n,null);a=!0},p(p,d){const g={};d&256&&(g.$$scope={dirty:d,ctx:p}),e.$set(g);const h={};d&256&&(h.$$scope={dirty:d,ctx:p}),i.$set(h);const v={};if(d&256&&(v.$$scope={dirty:d,ctx:p}),s.$set(v),d&7){u=Object.keys(p[0]);let k;for(k=0;k<u.length;k+=1){const C=h5(p,u,k);f[k]?(f[k].p(C,d),m(f[k],1)):(f[k]=$5(C),f[k].c(),m(f[k],1),f[k].m(n,null))}for(te(),k=u.length;k<f.length;k+=1)c(k);ne()}},i(p){if(!a){m(e.$$.fragment,p),m(i.$$.fragment,p),m(s.$$.fragment,p);for(let d=0;d<u.length;d+=1)m(f[d]);a=!0}},o(p){_(e.$$.fragment,p),_(i.$$.fragment,p),_(s.$$.fragment,p),f=f.filter(Boolean);for(let d=0;d<f.length;d+=1)_(f[d]);a=!1},d(p){E(e,p),p&&b(t),p&&b(n),E(i),E(s),$t(f,p)}}}function HQ(r){let e,t;return e=new Dt({props:{title:"Manage Access",showCancelButton:!1,confirmText:"Done",$$slots:{default:[VQ]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&259&&(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)}}}const WQ=r=>r.name,GQ=r=>r._id;function YQ(r,e,t){let n;ue(r,Zi,a=>t(1,n=a));let{resourceId:i}=e,{permissions:l}=e;async function s(a,u){try{await po.save({level:a,role:u,resource:i}),t(0,l=await po.forResource(i)),we.success("Updated permissions")}catch{we.error("Error updating permissions")}}const o=(a,u)=>s(a,u.detail);return r.$$set=a=>{"resourceId"in a&&t(3,i=a.resourceId),"permissions"in a&&t(0,l=a.permissions)},[l,n,s,i,o]}class JQ extends ie{constructor(e){super();le(this,e,YQ,HQ,re,{resourceId:3,permissions:0})}}function QQ(r){let e;return{c(){e=V("Manage access")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function XQ(r){let e,t;return e=new JQ({props:{resourceId:r[0],levels:r[3],permissions:r[2]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.resourceId=n[0]),i&8&&(l.levels=n[3]),i&4&&(l.permissions=n[2]),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 KQ(r){let e,t,n,i;e=new Jt({props:{icon:"LockClosed",size:"S",quiet:!0,$$slots:{default:[QQ]},$$scope:{ctx:r}}}),e.$on("click",r[4]);let l={$$slots:{default:[XQ]},$$scope:{ctx:r}};return n=new Et({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]){const a={};o&64&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&77&&(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[5](null),E(n,s)}}}function ZQ(r,e,t){let n;ue(r,po,u=>t(3,n=u));let{resourceId:i}=e,l,s;async function o(){t(2,s=await po.forResource(i)),l.show()}function a(u){K[u?"unshift":"push"](()=>{l=u,t(1,l)})}return r.$$set=u=>{"resourceId"in u&&t(0,i=u.resourceId)},[i,l,s,n,o,a]}class b5 extends ie{constructor(e){super();le(this,e,ZQ,KQ,re,{resourceId:0})}}function xQ(r){let e;return{c(){e=V("Hide auto columns")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function eX(r){let e;return{c(){e=V("Show auto columns")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function tX(r){let e;function t(l,s){return l[0]?eX:xQ}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.d(1),i=n(l),i&&(i.c(),i.m(e.parentNode,e)))},d(l){i.d(l),l&&b(e)}}}function nX(r){let e,t;return e=new Jt({props:{icon:"MagicWand",primary:!0,size:"S",quiet:!0,$$slots:{default:[tX]},$$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&5&&(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 rX(r,e,t){let{hideAutocolumns:n}=e;function i(){t(0,n=!n)}return r.$$set=l=>{"hideAutocolumns"in l&&t(0,n=l.hideAutocolumns)},[n,i]}class v5 extends ie{constructor(e){super();le(this,e,rX,nX,re,{hideAutocolumns:0})}}function iX(r){const e=it(Ot).list.find(n=>n._id===r.tableId);return!e||!e.sql?[]:y1(Object.values(e.schema),{allowLinks:!1}).map(n=>lt(Se({},n),{name:`${e.name}.${n.name}`}))}function y1(r,{allowLinks:e}={allowLinks:!0}){let t=r.filter(i=>!$j.includes(i.type));if(e){const i=r.filter(l=>l.type==="link");for(let l of i)t=t.concat(iX(l))}const n=r.filter(i=>i.type==="formula"&&i.formulaType==="static");return t.concat(n)}function w5(r,e,t){const n=r.slice();return n[26]=e[t],n[27]=e,n[28]=t,n}function lX(r){let e;return{c(){e=V(`Results are filtered to only those which match all of the following
|
|
@@ -1131,7 +1131,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1131
1131
|
console.error("Client received invalid JSON")
|
|
1132
1132
|
// Ignore
|
|
1133
1133
|
}
|
|
1134
|
-
if (!parsed) {
|
|
1134
|
+
if (!parsed || !parsed.isBudibaseEvent) {
|
|
1135
1135
|
return
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
@@ -1212,7 +1212,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1212
1212
|
</g>
|
|
1213
1213
|
</g>
|
|
1214
1214
|
</svg>
|
|
1215
|
-
`;function Ax(r){let e,t,n;return t=new Qe({props:{justifyItems:"center",gap:"S",$$slots:{default:[Ix]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","center error svelte-byn9z3")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&8388624&&(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 Ex(r){let e,t,n;return t=new Gs({}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","center svelte-byn9z3")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p:Oe,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function Ox(r){let e;return{c(){e=V("App preview failed to load")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Tx(r){let e;return{c(){e=V(r[4])},m(t,n){$(t,e,n)},p(t,n){n&16&&Te(e,t[4])},d(t){t&&b(e)}}}function Ix(r){let e,t,n,i,l,s;return n=new Ct({props:{size:"L",$$slots:{default:[Ox]},$$scope:{ctx:r}}}),l=new Ke({props:{size:"S",$$slots:{default:[Tx]},$$scope:{ctx:r}}}),{c(){e=new cS,t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),e.a=t},m(o,a){e.m(Sx,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&8388608&&(u.$$scope={dirty:a,ctx:o}),n.$set(u);const f={};a&8388624&&(f.$$scope={dirty:a,ctx:o}),l.$set(f)},i(o){s||(m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){o&&e.d(),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function Lx(r){let e,t,n,i,l,s,o,a;const u=[Ex,Ax],f=[];function c(d,g){return d[3]?0:d[4]?1:-1}~(t=c(r))&&(n=f[t]=u[t](r));let p={title:"Confirm Deletion",body:"Are you sure you want to delete this component?",okText:"Delete component",onOk:r[6],onCancel:r[7]};return o=new hr({props:p}),r[15](o),{c(){e=D("div"),n&&n.c(),i=R(),l=D("iframe"),s=R(),S(o.$$.fragment),w(l,"title","componentPreview"),w(l,"srcdoc",r[5]),w(l,"class","svelte-byn9z3"),oe(l,"hidden",r[3]||r[4]),oe(l,"tablet",r[0].previewDevice==="tablet"),oe(l,"mobile",r[0].previewDevice==="mobile"),w(e,"class","component-container svelte-byn9z3")},m(d,g){$(d,e,g),~t&&f[t].m(e,null),N(e,i),N(e,l),r[14](l),$(d,s,g),A(o,d,g),a=!0},p(d,[g]){let h=t;t=c(d),t===h?~t&&f[t].p(d,g):(n&&(te(),_(f[h],1,1,()=>{f[h]=null}),ne()),~t?(n=f[t],n?n.p(d,g):(n=f[t]=u[t](d),n.c()),m(n,1),n.m(e,i)):n=null),(!a||g&32)&&w(l,"srcdoc",d[5]),g&24&&oe(l,"hidden",d[3]||d[4]),g&1&&oe(l,"tablet",d[0].previewDevice==="tablet"),g&1&&oe(l,"mobile",d[0].previewDevice==="mobile");const v={};o.$set(v)},i(d){a||(m(n),m(o.$$.fragment,d),a=!0)},o(d){_(n),_(o.$$.fragment,d),a=!1},d(d){d&&b(e),~t&&f[t].d(),r[14](null),d&&b(s),r[15](null),E(o,d)}}}function Px(r,e,t){let n,i,l,s,o,a;ue(r,He,z=>t(0,o=z)),ue(r,un,z=>t(13,a=z));let u,f,c,p,d,g=!0,h;const v=new Ia().name("Screen Placeholder").route("*").component("@budibase/standard-components/screenslot").instanceName("Content Placeholder").json(),k={READY:"ready",ERROR:"error",BUDIBASE:"type"},C=z=>{u&&u.contentWindow.postMessage(z)};function I(z){({[k.READY]:()=>{o.clientFeatures.messagePassing&&!g||(o.clientFeatures.intelligentLoading||t(3,g=!1),C(s))},[k.ERROR]:Y=>{t(3,g=!1),t(4,h=Y.error||"An unknown error occurred")}}[z.data.type]||O)(z)}Gt(()=>{window.addEventListener("message",I),o.clientFeatures.messagePassing||(u.contentWindow.addEventListener("ready",()=>{I({data:{type:k.READY}})},{once:!0}),u.contentWindow.addEventListener("error",z=>{I({data:{type:k.ERROR,error:z.detail}})},{once:!0}),u.contentWindow.addEventListener("bb-event",O))}),gp(()=>{window.removeEventListener("message",I),u.contentWindow&&(o.clientFeatures.messagePassing||u.contentWindow.removeEventListener("bb-event",O))});const O=async z=>{const{type:q,data:H}=z.data||z.detail;if(!!q)try{if(q==="select-component"&&H.id)He.actions.components.select({_id:H.id});else if(q==="update-prop")await He.actions.components.updateProp(H.prop,H.value);else if(q==="delete-component"&&H.id)T(H.id);else if(q==="duplicate-component"&&H.id){const Y=it(un).props,U=Cl(Y,H.id);He.actions.components.copy(U),await He.actions.components.paste(U)}else if(q==="preview-loaded")t(3,g=!1);else if(q==="move-component"){const{componentId:Y,destinationComponentId:U}=H,W=it(un).props,G=Cl(W,Y),Q=Cl(W,U);if(Sl(G,U).map(ee=>ee._id).includes(H.destinationComponentId))return;G&&Q&&(He.actions.components.copy(G,!0),await He.actions.components.paste(Q,H.mode))}else console.warn(`Client sent unknown event type: ${q}`)}catch(Y){console.warn(Y),we.error("Error handling event from app preview")}},T=z=>{d=z,p.show()},P=async()=>{try{await He.actions.components.delete({_id:d})}catch{we.error("Error deleting component")}d=null},M=()=>{d=null};function F(z){K[z?"unshift":"push"](()=>{u=z,t(1,u)})}function j(z){K[z?"unshift":"push"](()=>{p=z,t(2,p)})}return r.$$.update=()=>{var z;r.$$.dirty&1&&t(5,n=Cx.replace(/\{\{ CLIENT_LIB_PATH }}/,o.clientLibPath)),r.$$.dirty&8705&&(o.currentFrontEndType===Xn.LAYOUT?(t(8,f=a),t(9,c=v)):(t(9,c=a),t(8,f=o.layouts.find(q=>q._id===(c==null?void 0:c.layoutId))))),r.$$.dirty&1&&t(12,i=(z=o.selectedComponentId)!=null?z:""),r.$$.dirty&4865&&t(11,l={appId:o.appId,layout:f,screen:c,selectedComponentId:i,previewType:o.currentFrontEndType,theme:o.theme,customTheme:o.customTheme,previewDevice:o.previewDevice,messagePassing:o.clientFeatures.messagePassing}),r.$$.dirty&2048&&t(10,s=JSON.stringify(l)),r.$$.dirty&1024&&C(s)},[o,u,p,g,h,n,P,M,f,c,s,l,i,a,F,j]}class Nx extends ie{constructor(e){super();le(this,e,Px,Lx,re,{})}}function r6(r){let e,t,n;return t=new Ze({props:{$$slots:{default:[Rx]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","label svelte-3rofj0")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&262145&&(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 Rx(r){let e;return{c(){e=V(r[0])},m(t,n){$(t,e,n)},p(t,n){n&1&&Te(e,t[0])},d(t){t&&b(e)}}}function Mx(r){let e,t,n,i,l,s,o,a=r[4]!=="boolean"&&r[0]&&r6(r);const u=[{componentInstance:r[1]},{value:r[7]},{updateOnChange:!1},{onChange:r[8]},{bindings:r[6]},{name:r[3]},{text:r[0]},{type:r[4]},r[5]];var f=r[2];function c(p){let d={};for(let g=0;g<u.length;g+=1)d=Ui(d,u[g]);return{props:d}}return f&&(i=new f(c()),i.$on("change",r[8])),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),i&&S(i.$$.fragment),w(n,"data-cy",l=`${r[3]}-prop-control`),w(n,"class","control svelte-3rofj0"),w(e,"class","property-control svelte-3rofj0"),w(e,"data-cy",s=`setting-${r[3]}`)},m(p,d){$(p,e,d),a&&a.m(e,null),N(e,t),N(e,n),i&&A(i,n,null),o=!0},p(p,[d]){p[4]!=="boolean"&&p[0]?a?(a.p(p,d),d&17&&m(a,1)):(a=r6(p),a.c(),m(a,1),a.m(e,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne());const g=d&507?Su(u,[d&2&&{componentInstance:p[1]},d&128&&{value:p[7]},u[2],d&256&&{onChange:p[8]},d&64&&{bindings:p[6]},d&8&&{name:p[3]},d&1&&{text:p[0]},d&16&&{type:p[4]},d&32&&Au(p[5])]):{};if(f!==(f=p[2])){if(i){te();const h=i;_(h.$$.fragment,1,0,()=>{E(h,1)}),ne()}f?(i=new f(c()),i.$on("change",p[8]),S(i.$$.fragment),m(i.$$.fragment,1),A(i,n,null)):i=null}else f&&i.$set(g);(!o||d&8&&l!==(l=`${p[3]}-prop-control`))&&w(n,"data-cy",l),(!o||d&8&&s!==(s=`setting-${p[3]}`))&&w(e,"data-cy",s)},i(p){o||(m(a),i&&m(i.$$.fragment,p),o=!0)},o(p){_(a),i&&_(i.$$.fragment,p),o=!1},d(p){p&&b(e),a&&a.d(),i&&E(i)}}}function Dx(r,e,t){let n,i,l,{label:s=""}=e,{componentInstance:o={}}=e,{control:a=null}=e,{key:u=""}=e,{type:f=""}=e,{value:c=null}=e,{props:p={}}=e,{onChange:d=()=>{}}=e,{bindings:g=[]}=e,{componentBindings:h=[]}=e,{nested:v=!1}=e;const k=(O,T,P)=>P?[...T||[],...O||[]]:O,C=O=>{let T=O;O&&typeof O=="object"&&("detail"in O?T=O.detail:"target"in O&&(T=O.target.value)),f==="number"&&(T=parseInt(T)),d(typeof T=="string"?l(T):T)},I=(O,T,P)=>{const M=_o(P,O);return M==null&&T!==void 0?T:M};return r.$$set=O=>{"label"in O&&t(0,s=O.label),"componentInstance"in O&&t(1,o=O.componentInstance),"control"in O&&t(2,a=O.control),"key"in O&&t(3,u=O.key),"type"in O&&t(4,f=O.type),"value"in O&&t(9,c=O.value),"props"in O&&t(5,p=O.props),"onChange"in O&&t(10,d=O.onChange),"bindings"in O&&t(11,g=O.bindings),"componentBindings"in O&&t(12,h=O.componentBindings),"nested"in O&&t(13,v=O.nested)},r.$$.update=()=>{r.$$.dirty&14336&&t(6,n=k(g,h,v)),r.$$.dirty&608&&t(7,i=I(c,p.defaultValue,n)),r.$$.dirty&128,r.$$.dirty&64&&(l=O=>Ss(n,O))},[s,o,a,u,f,p,n,i,C,c,d,g,h,v]}class La extends ie{constructor(e){super();le(this,e,Dx,Mx,re,{label:0,componentInstance:1,control:2,key:3,type:4,value:9,props:5,onChange:10,bindings:11,componentBindings:12,nested:13})}}function jx(r){let e,t,n;function i(s){r[2](s)}let l={options:r[1].layouts,getOptionLabel:Bx,getOptionValue:zx};return r[0]!==void 0&&(l.value=r[0]),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};o&2&&(a.options=s[1].layouts),!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}const Bx=r=>r.name,zx=r=>r._id;function qx(r,e,t){let n;ue(r,He,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class Ux extends ie{constructor(e){super();le(this,e,qx,jx,re,{value:0})}}function Fx(r){let e,t,n;function i(s){r[2](s)}let l={options:r[1],getOptionLabel:Vx,getOptionValue:Hx};return r[0]!==void 0&&(l.value=r[0]),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};o&2&&(a.options=s[1]),!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}const Vx=r=>r.name,Hx=r=>r._id;function Wx(r,e,t){let n;ue(r,Zi,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class Gx extends ie{constructor(e){super();le(this,e,Wx,Fx,re,{value:0})}}function As(r){return r.split("/").map(e=>e.startsWith(":")?e:encodeURIComponent(e.replace(/ /g,"-"))).join("/").toLowerCase()}function i6(r,e,t){const n=r.slice();return n[7]=e[t],n}function l6(r){let e,t;return e=new Vo({props:{name:"Screen",collapsible:!1,$$slots:{default:[Yx]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1034&&(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 s6(r,e){let t,n,i;function l(...s){return e[6](e[7],...s)}return n=new La({props:{control:e[7].control,label:e[7].label,key:e[7].key,value:jl.exports.get(e[3],e[7].key),onChange:l,bindings:e[1]}}),{key:r,first:null,c(){t=Ee(),S(n.$$.fragment),this.first=t},m(s,o){$(s,t,o),A(n,s,o),i=!0},p(s,o){e=s;const a={};o&8&&(a.value=jl.exports.get(e[3],e[7].key)),o&2&&(a.bindings=e[1]),n.$set(a)},i(s){i||(m(n.$$.fragment,s),i=!0)},o(s){_(n.$$.fragment,s),i=!1},d(s){s&&b(t),E(n,s)}}}function Yx(r){let e=[],t=new Map,n,i,l=r[5];const s=o=>`${o[0]._id}-${o[7].key}`;for(let o=0;o<l.length;o+=1){let a=i6(r,l,o),u=s(a);t.set(u,e[o]=s6(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&59&&(l=o[5],te(),e=xn(e,a,s,1,o,l,t,n.parentNode,jr,s6,n,i6),ne())},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 Jx(r){let e,t,n=r[2].currentView!=="component"&&r[3]&&r[2].currentFrontEndType===Xn.SCREEN&&l6(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].currentView!=="component"&&i[3]&&i[2].currentFrontEndType===Xn.SCREEN?n?(n.p(i,l),l&12&&m(n,1)):(n=l6(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function Qx(r,e,t){let n,i;ue(r,He,f=>t(2,n=f)),ue(r,un,f=>t(3,i=f));let{componentInstance:l}=e,{bindings:s}=e;function o(f,c,p){p&&typeof p=="function"&&(c=p(c));const d=it(un);He.update(g=>(f==="_instanceName"&&g.currentFrontEndType===Xn.SCREEN?d.props._instanceName=c:jl.exports.setWith(d,f.split("."),c,Object),g));try{He.actions.preview.saveSelected()}catch{we.error("Error saving settings")}}const a=[{key:"routing.route",label:"Route",control:tt,parser:f=>(f.startsWith("/")||(f="/"+f),As(f))},{key:"routing.roleId",label:"Access",control:Gx},{key:"layoutId",label:"Layout",control:Ux}],u=(f,c)=>o(f.key,c,f.parser);return r.$$set=f=>{"componentInstance"in f&&t(0,l=f.componentInstance),"bindings"in f&&t(1,s=f.bindings)},[l,s,n,i,o,a,u]}class Xx extends ie{constructor(e){super();le(this,e,Qx,Jx,re,{componentInstance:0,bindings:1})}}class Jn extends n6{constructor(e){super(!1);this._children=[],this._json={_id:Fi(),_component:e,_styles:{normal:{},hover:{},active:{},selected:{}},_instanceName:"",_children:[]}}normalStyle(e){return this._json._styles.normal=e,this}hoverStyle(e){return this._json._styles.hover=e,this}customStyle(e){return this._json._styles.custom=e,this}instanceName(e){return this._json._instanceName=e,this}type(e){return this._json.type=e,this}text(e){return this._json.text=e,this}}function Kx(r){return r.map(e=>({name:`${e.name} - New`,create:()=>eee(e),id:Zx,table:e.name}))}const o6=r=>As(`/${r.name}/new/row`),Zx="NEW_ROW_TEMPLATE";function xx(r,e){return c6("New Row").addChild(f6(r,e))}const eee=r=>{const e=new Ia().instanceName(`${r.name} - New`).customProps({hAlign:"center"}).route(o6(r)),t=a6().instanceName("Form").customProps({actionType:"Create",dataSource:{label:r.name,tableId:r._id,type:"table"},size:"spectrum--medium"}),n=new Jn("@budibase/standard-components/fieldgroup").instanceName("Field Group").customProps({labelPosition:"left"}),i={type:"table",tableId:r._id};S1(i).forEach(s=>{n.addChild(s)});const l=t._json._id;return t.addChild(u6(r.name,"New")).addChild(xx(r,l)).addChild(n),e.addChild(t).json()};function tee(r){return r.map(e=>({name:`${e.name} - List`,create:()=>iee(e),id:nee,table:e.name}))}const nee="ROW_LIST_TEMPLATE",Kf=r=>As(`/${r.name}`);function ree(r){const e=new Jn("@budibase/standard-components/button").text("Create New").customProps({size:"M",type:"primary",onClick:[{parameters:{url:o6(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("New Button"),t=new Jn("@budibase/standard-components/heading").instanceName("Title").text(r.name).customProps({size:"M",align:"left"});return new Jn("@budibase/standard-components/container").customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(t).addChild(e)}const iee=r=>{const e=new Jn("@budibase/standard-components/dataprovider").instanceName("Data Provider").customProps({dataSource:{label:r.name,name:r._id,tableId:r._id,type:"table"},size:"spectrum--medium",paginate:!0,limit:8}),t=new Jn("@budibase/standard-components/table").customProps({dataProvider:`{{ literal ${$n(e._json._id)} }}`,showAutoColumns:!1,quiet:!1,rowCount:8}).instanceName(`${r.name} Table`),n=$n(t._json._id),i=$n("_id"),l=new Jn("@budibase/standard-components/link").customProps({text:"View",url:`${Kf(r)}/{{ ${n}.${i} }}`,size:"S",color:"var(--spectrum-global-color-gray-600)",align:"left"}).normalStyle({["margin-left"]:"16px",["margin-right"]:"16px"}).instanceName("View Link");return t.addChild(l),e.addChild(t),new Ia().route(Kf(r)).instanceName(`${r.name} - List`).addChild(ree(r)).addChild(e).json()};function C1(r){return`var(--spectrum-global-color-gray-${r})`}function lee(r){return new Jn("@budibase/standard-components/link").text(r).customProps({url:`/${r.toLowerCase()}`,openInNewTab:!1,color:C1(700),size:"S",align:"left"})}function a6(){return new Jn("@budibase/standard-components/form").normalStyle({width:"600px"}).instanceName("Form")}function u6(r,e){const t=lee(r).instanceName("Back Link"),n=new Jn("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:C1(700),size:"S",align:"left"}),i=new Jn("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:C1(700),size:"S",align:"left"});return new Jn("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).instanceName("Breadcrumbs").addChild(t).addChild(n).addChild(i)}function f6(r,e){return new Jn("@budibase/standard-components/button").text("Save").customProps({type:"primary",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:e}},{parameters:{providerId:e,tableId:r._id},"##eventHandlerType":"Save Row"},{parameters:{url:Kf(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("Save Button")}function c6(r){const e=new Jn("@budibase/standard-components/heading").instanceName("Title").text(r).customProps({size:"M",align:"left"});return new Jn("@budibase/standard-components/container").normalStyle({"margin-top":"32px","margin-bottom":"32px"}).customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(e)}const see={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield"};function S1(r){const{schema:e}=Di(null,r,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const l=e[i];if(l.autocolumn||l.nestedJSON)return;const s=typeof l=="object"?l.type:l,o=see[s],a=`@budibase/standard-components/${o}`;if(o){const u=new Jn(a).instanceName(i).customProps({field:i,label:i,placeholder:i});if(s==="options"&&u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"}),s==="longform"&&u.customProps({format:"auto"}),s==="array"&&u.customProps({placeholder:"Choose an option",optionsSource:"schema"}),s==="link"){let f=l.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:f})}s==="boolean"&&u.customProps({text:i,label:""}),t.push(u)}}),t}function oee(r){let e;return{c(){e=V("Update form fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function aee(r){let e,t,n,i,l;t=new Jt({props:{secondary:!0,wide:!0,$$slots:{default:[oee]},$$scope:{ctx:r}}}),t.$on("click",r[3]);let s={body:"All components inside this group will be deleted and replaced with fields to match the schema. Are you sure you want to update this Field Group?",okText:"Update",onOk:r[1],title:"Confirm Form Field Update"};return i=new hr({props:s}),r[4](i),{c(){e=D("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]){const u={};a&64&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};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[4](null),E(i,o)}}}function uee(r,e,t){let n;ue(r,un,u=>t(5,n=u));let{componentInstance:i}=e,l;const s=async()=>{const u=qf(n==null?void 0:n.props,i._id,p=>p._component.endsWith("/form")),f=u==null?void 0:u.dataSource,c=S1(f);try{await He.actions.components.updateProp("_children",c.map(p=>p.json()))}catch{we.error("Error resetting form fields")}},o=()=>l==null?void 0:l.show();function a(u){K[u?"unshift":"push"](()=>{l=u,t(0,l)})}return r.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[l,s,i,o,a]}class fee extends ie{constructor(e){super();le(this,e,uee,aee,re,{componentInstance:2})}}function p6(r,e,t){const n=r.slice();return n[44]=e[t],n}function d6(r,e,t){const n=r.slice();return n[47]=e[t],n}function m6(r,e,t){const n=r.slice();return n[50]=e[t],n}function g6(r,e,t){const n=r.slice();return n[50]=e[t],n}function _6(r,e,t){const n=r.slice();return n[55]=e[t],n}function h6(r,e,t){const n=r.slice();return n[58]=e[t],n}function $6(r,e,t){const n=r.slice();return n[61]=e[t],n}function b6(r,e,t){const n=r.slice();return n[64]=e[t],n}function v6(r){let e,t,n,i,l,s,o={title:"Query Bindings",$$slots:{body:[gee],buttons:[pee]},$$scope:{ctx:r}};return n=new Kr({props:o}),r[29](n),{c(){e=D("i"),t=R(),S(n.$$.fragment),w(e,"class","ri-settings-5-line svelte-xmd5g6")},m(a,u){$(a,e,u),$(a,t,u),A(n,a,u),i=!0,l||(s=Pe(e,"click",r[19]),l=!0)},p(a,u){const f={};u[0]&67|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){i||(m(n.$$.fragment,a),i=!0)},o(a){_(n.$$.fragment,a),i=!1},d(a){a&&b(e),a&&b(t),r[29](null),E(n,a),l=!1,s()}}}function cee(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pee(r){let e,t;return e=new gt({props:{slot:"buttons",cta:!0,$$slots:{default:[cee]},$$scope:{ctx:r}}}),e.$on("click",r[20]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[2]&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 w6(r){let e,t,n,i;function l(a){r[27](a)}function s(a){r[28](a)}let o={queryBindings:r[17](r[1])};return r[6]!==void 0&&(o.customParams=r[6]),r[0]!==void 0&&(o.bindings=r[0]),e=new v1({props:o}),K.push(()=>ce(e,"customParams",l)),K.push(()=>ce(e,"bindings",s)),{c(){S(e.$$.fragment)},m(a,u){A(e,a,u),i=!0},p(a,u){const f={};u[0]&2&&(f.queryBindings=a[17](a[1])),!t&&u[0]&64&&(t=!0,f.customParams=a[6],pe(()=>t=!1)),!n&&u[0]&1&&(n=!0,f.bindings=a[0],pe(()=>n=!1)),e.$set(f)},i(a){i||(m(e.$$.fragment,a),i=!0)},o(a){_(e.$$.fragment,a),i=!1},d(a){E(e,a)}}}function dee(r){let e=r[17](r[1]).length>0,t,n,i,l=e&&w6(r);return n=new m1({props:{height:200,query:r[1],schema:r[16](r[1]),datasource:r[18](r[1]),editable:!1}}),{c(){l&&l.c(),t=R(),S(n.$$.fragment)},m(s,o){l&&l.m(s,o),$(s,t,o),A(n,s,o),i=!0},p(s,o){o[0]&2&&(e=s[17](s[1]).length>0),e?l?(l.p(s,o),o[0]&2&&m(l,1)):(l=w6(s),l.c(),m(l,1),l.m(t.parentNode,t)):l&&(te(),_(l,1,1,()=>{l=null}),ne());const a={};o[0]&2&&(a.query=s[1]),o[0]&2&&(a.schema=s[16](s[1])),o[0]&2&&(a.datasource=s[18](s[1])),n.$set(a)},i(s){i||(m(l),m(n.$$.fragment,s),i=!0)},o(s){_(l),_(n.$$.fragment,s),i=!1},d(s){l&&l.d(s),s&&b(t),E(n,s)}}}function mee(r){let e,t;return e=new Qe({props:{noPadding:!0,gap:"XS",$$slots:{default:[dee]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&67|i[2]&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 gee(r){let e,t;return e=new Ai({props:{slot:"body",$$slots:{default:[mee]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&67|i[2]&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 _ee(r){let e;return{c(){e=V("Tables")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function y6(r){let e,t=r[64].label+"",n,i,l;function s(){return r[31](r[64])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&8192&&t!==(t=r[64].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function k6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[hee]},$$scope:{ctx:r}}});let a=r[12],u=[];for(let f=0;f<a.length;f+=1)u[f]=C6($6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&36864){a=f[12];let d;for(d=0;d<a.length;d+=1){const g=$6(f,a,d);u[d]?u[d].p(g,c):(u[d]=C6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function hee(r){let e;return{c(){e=V("Views")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function C6(r){let e,t=r[61].label+"",n,i,l;function s(){return r[32](r[61])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4096&&t!==(t=r[61].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function S6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[$ee]},$$scope:{ctx:r}}});let a=r[11],u=[];for(let f=0;f<a.length;f+=1)u[f]=A6(h6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&34818){a=f[11];let d;for(d=0;d<a.length;d+=1){const g=h6(f,a,d);u[d]?u[d].p(g,c):(u[d]=A6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function $ee(r){let e;return{c(){e=V("Queries")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function A6(r){let e,t=r[58].label+"",n,i,l,s;function o(){return r[33](r[58])}return{c(){e=D("li"),n=V(t),i=R(),w(e,"class","svelte-xmd5g6"),oe(e,"selected",r[1]===r[58])},m(a,u){$(a,e,u),N(e,n),N(e,i),l||(s=Pe(e,"click",o),l=!0)},p(a,u){r=a,u[0]&2048&&t!==(t=r[58].label+"")&&Te(n,t),u[0]&2050&&oe(e,"selected",r[1]===r[58])},d(a){a&&b(e),l=!1,s()}}}function E6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[bee]},$$scope:{ctx:r}}});let a=r[9],u=[];for(let f=0;f<a.length;f+=1)u[f]=O6(_6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33280){a=f[9];let d;for(d=0;d<a.length;d+=1){const g=_6(f,a,d);u[d]?u[d].p(g,c):(u[d]=O6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function bee(r){let e;return{c(){e=V("Relationships")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function O6(r){let e,t=r[55].label+"",n,i,l;function s(){return r[34](r[55])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&512&&t!==(t=r[55].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function T6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[vee]},$$scope:{ctx:r}}});let a=r[8],u=[];for(let f=0;f<a.length;f+=1)u[f]=I6(g6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33024){a=f[8];let d;for(d=0;d<a.length;d+=1){const g=g6(f,a,d);u[d]?u[d].p(g,c):(u[d]=I6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function vee(r){let e;return{c(){e=V("Fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function I6(r){let e,t=r[50].label+"",n,i,l;function s(){return r[35](r[50])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&256&&t!==(t=r[50].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function L6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[wee]},$$scope:{ctx:r}}});let a=r[7],u=[];for(let f=0;f<a.length;f+=1)u[f]=P6(m6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&32896){a=f[7];let d;for(d=0;d<a.length;d+=1){const g=m6(f,a,d);u[d]?u[d].p(g,c):(u[d]=P6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function wee(r){let e;return{c(){e=V("JSON Arrays")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function P6(r){let e,t=r[50].label+"",n,i,l;function s(){return r[36](r[50])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&128&&t!==(t=r[50].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function N6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[yee]},$$scope:{ctx:r}}});let a=r[10],u=[];for(let f=0;f<a.length;f+=1)u[f]=R6(d6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33794){a=f[10];let d;for(d=0;d<a.length;d+=1){const g=d6(f,a,d);u[d]?u[d].p(g,c):(u[d]=R6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function yee(r){let e;return{c(){e=V("Data Providers")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function R6(r){let e,t=r[47].label+"",n,i,l,s;function o(){return r[37](r[47])}return{c(){e=D("li"),n=V(t),i=R(),w(e,"class","svelte-xmd5g6"),oe(e,"selected",r[1]===r[47])},m(a,u){$(a,e,u),N(e,n),N(e,i),l||(s=Pe(e,"click",o),l=!0)},p(a,u){r=a,u[0]&1024&&t!==(t=r[47].label+"")&&Te(n,t),u[0]&1026&&oe(e,"selected",r[1]===r[47])},d(a){a&&b(e),l=!1,s()}}}function M6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[kee]},$$scope:{ctx:r}}});let a=r[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=D6(p6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&32772){a=f[2];let d;for(d=0;d<a.length;d+=1){const g=p6(f,a,d);u[d]?u[d].p(g,c):(u[d]=D6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function kee(r){let e;return{c(){e=V("Other")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function D6(r){let e,t=r[44].label+"",n,i,l;function s(){return r[38](r[44])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4&&t!==(t=r[44].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function Cee(r){var M,F,j,z,q,H,Y;let e,t,n,i,l,s,o,a,u,f,c,p,d;n=new Ct({props:{size:"XS",$$slots:{default:[_ee]},$$scope:{ctx:r}}});let g=r[13],h=[];for(let U=0;U<g.length;U+=1)h[U]=y6(b6(r,g,U));let v=((M=r[12])==null?void 0:M.length)&&k6(r),k=((F=r[11])==null?void 0:F.length)&&S6(r),C=((j=r[9])==null?void 0:j.length)&&E6(r),I=((z=r[8])==null?void 0:z.length)&&T6(r),O=((q=r[7])==null?void 0:q.length)&&L6(r),T=((H=r[10])==null?void 0:H.length)&&N6(r),P=((Y=r[2])==null?void 0:Y.length)&&M6(r);return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("ul");for(let U=0;U<h.length;U+=1)h[U].c();s=R(),v&&v.c(),o=R(),k&&k.c(),a=R(),C&&C.c(),u=R(),I&&I.c(),f=R(),O&&O.c(),c=R(),T&&T.c(),p=R(),P&&P.c(),w(t,"class","title svelte-xmd5g6"),w(l,"class","svelte-xmd5g6"),w(e,"class","dropdown svelte-xmd5g6")},m(U,W){$(U,e,W),N(e,t),A(n,t,null),N(e,i),N(e,l);for(let G=0;G<h.length;G+=1)h[G].m(l,null);N(e,s),v&&v.m(e,null),N(e,o),k&&k.m(e,null),N(e,a),C&&C.m(e,null),N(e,u),I&&I.m(e,null),N(e,f),O&&O.m(e,null),N(e,c),T&&T.m(e,null),N(e,p),P&&P.m(e,null),d=!0},p(U,W){var Q,fe,Z,ee,ae,_e,Re;const G={};if(W[2]&32&&(G.$$scope={dirty:W,ctx:U}),n.$set(G),W[0]&40960){g=U[13];let $e;for($e=0;$e<g.length;$e+=1){const be=b6(U,g,$e);h[$e]?h[$e].p(be,W):(h[$e]=y6(be),h[$e].c(),h[$e].m(l,null))}for(;$e<h.length;$e+=1)h[$e].d(1);h.length=g.length}((Q=U[12])==null?void 0:Q.length)?v?(v.p(U,W),W[0]&4096&&m(v,1)):(v=k6(U),v.c(),m(v,1),v.m(e,o)):v&&(te(),_(v,1,1,()=>{v=null}),ne()),((fe=U[11])==null?void 0:fe.length)?k?(k.p(U,W),W[0]&2048&&m(k,1)):(k=S6(U),k.c(),m(k,1),k.m(e,a)):k&&(te(),_(k,1,1,()=>{k=null}),ne()),((Z=U[9])==null?void 0:Z.length)?C?(C.p(U,W),W[0]&512&&m(C,1)):(C=E6(U),C.c(),m(C,1),C.m(e,u)):C&&(te(),_(C,1,1,()=>{C=null}),ne()),((ee=U[8])==null?void 0:ee.length)?I?(I.p(U,W),W[0]&256&&m(I,1)):(I=T6(U),I.c(),m(I,1),I.m(e,f)):I&&(te(),_(I,1,1,()=>{I=null}),ne()),((ae=U[7])==null?void 0:ae.length)?O?(O.p(U,W),W[0]&128&&m(O,1)):(O=L6(U),O.c(),m(O,1),O.m(e,c)):O&&(te(),_(O,1,1,()=>{O=null}),ne()),((_e=U[10])==null?void 0:_e.length)?T?(T.p(U,W),W[0]&1024&&m(T,1)):(T=N6(U),T.c(),m(T,1),T.m(e,p)):T&&(te(),_(T,1,1,()=>{T=null}),ne()),((Re=U[2])==null?void 0:Re.length)?P?(P.p(U,W),W[0]&4&&m(P,1)):(P=M6(U),P.c(),m(P,1),P.m(e,null)):P&&(te(),_(P,1,1,()=>{P=null}),ne())},i(U){d||(m(n.$$.fragment,U),m(v),m(k),m(C),m(I),m(O),m(T),m(P),d=!0)},o(U){_(n.$$.fragment,U),_(v),_(k),_(C),_(I),_(O),_(T),_(P),d=!1},d(U){U&&b(e),E(n),$t(h,U),v&&v.d(),k&&k.d(),C&&C.d(),I&&I.d(),O&&O.d(),T&&T.d(),P&&P.d()}}}function See(r){var u;let e,t,n,i,l,s;t=new Xe({props:{readonly:!0,value:r[14],options:[r[14]]}}),t.$on("click",function(){mt(r[4].show)&&r[4].show.apply(this,arguments)});let o=((u=r[1])==null?void 0:u.type)==="query"&&v6(r),a={anchor:r[3],$$slots:{default:[Cee]},$$scope:{ctx:r}};return l=new wp({props:a}),r[39](l),{c(){e=D("div"),S(t.$$.fragment),n=R(),o&&o.c(),i=R(),S(l.$$.fragment),w(e,"class","container svelte-xmd5g6")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),o&&o.m(e,null),r[30](e),$(f,i,c),A(l,f,c),s=!0},p(f,c){var g;r=f;const p={};c[0]&16384&&(p.value=r[14]),c[0]&16384&&(p.options=[r[14]]),t.$set(p),((g=r[1])==null?void 0:g.type)==="query"?o?(o.p(r,c),c[0]&2&&m(o,1)):(o=v6(r),o.c(),m(o,1),o.m(e,null)):o&&(te(),_(o,1,1,()=>{o=null}),ne());const d={};c[0]&8&&(d.anchor=r[3]),c[0]&16262|c[2]&32&&(d.$$scope={dirty:c,ctx:r}),l.$set(d)},i(f){s||(m(t.$$.fragment,f),m(o),m(l.$$.fragment,f),s=!0)},o(f){_(t.$$.fragment,f),_(o),_(l.$$.fragment,f),s=!1},d(f){f&&b(e),E(t),o&&o.d(),r[30](null),f&&b(i),r[39](null),E(l,f)}}}function Aee(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,v,k;ue(r,en,me=>t(40,p=me)),ue(r,kn,me=>t(23,d=me)),ue(r,Ql,me=>t(41,g=me)),ue(r,He,me=>t(24,h=me)),ue(r,un,me=>t(25,v=me)),ue(r,Ot,me=>t(26,k=me));let{value:C={}}=e,{otherSources:I}=e,{showAllQueries:O}=e,{bindings:T=[]}=e;const P=ht(),M=["attachment","array"];let F,j,z,q;const H=me=>{P("change",me),j.hide()},Y=me=>{const ke=p.list.find(ze=>ze._id===me.datasourceId).source;return g[ke].query[me.queryVerb]},U=me=>{var ke;return((ke=d.list.find(ze=>ze._id===(me==null?void 0:me._id)))==null?void 0:ke.parameters)||[]},W=me=>p.list.find(ke=>ke._id===(me==null?void 0:me.datasourceId)),G=()=>{t(6,q=C.queryParams),z.show()},Q=()=>{H(lt(Se({},C),{queryParams:q})),z.hide()};function fe(me){q=me,t(6,q)}function Z(me){T=me,t(0,T)}function ee(me){K[me?"unshift":"push"](()=>{z=me,t(5,z)})}function ae(me){K[me?"unshift":"push"](()=>{F=me,t(3,F)})}const _e=me=>H(me),Re=me=>H(me),$e=me=>H(me),be=me=>H(me),he=me=>H(me),Ne=me=>H(me),Fe=me=>H(me),se=me=>H(me);function Ce(me){K[me?"unshift":"push"](()=>{j=me,t(4,j)})}return r.$$set=me=>{"value"in me&&t(1,C=me.value),"otherSources"in me&&t(2,I=me.otherSources),"showAllQueries"in me&&t(21,O=me.showAllQueries),"bindings"in me&&t(0,T=me.bindings)},r.$$.update=()=>{var me;r.$$.dirty[0]&2&&t(14,n=(me=C==null?void 0:C.label)!=null?me:"Choose an option"),r.$$.dirty[0]&67108864&&t(13,i=k.list.map(ke=>({label:ke.name,tableId:ke._id,type:"table"}))),r.$$.dirty[0]&67108864&&t(12,l=k.list.reduce((ke,ze)=>{let ye=Object.entries(ze.views||{}).map(([Je,Nt])=>lt(Se({label:Je,name:Je},Nt),{type:"view"}));return[...ke,...ye]},[])),r.$$.dirty[0]&10485760&&t(11,s=d.list.filter(ke=>O||ke.queryVerb==="read"||ke.readable).map(ke=>lt(Se({label:ke.name,name:ke.name,tableId:ke._id},ke),{type:"query"}))),r.$$.dirty[0]&50331648&&t(22,o=go(v,h.selectedComponentId)),r.$$.dirty[0]&4194304&&t(10,a=o.filter(ke=>{var ze;return(ze=ke._component)==null?void 0:ze.endsWith("/dataprovider")}).map(ke=>({label:ke._instanceName,name:ke._instanceName,providerId:ke._id,value:`{{ literal ${$n(ke._id)} }}`,type:"provider"}))),r.$$.dirty[0]&1&&t(9,u=T.filter(ke=>{var ze;return((ze=ke.fieldSchema)==null?void 0:ze.type)==="link"}).map(ke=>{const{providerId:ze,readableBinding:ye,fieldSchema:Je}=ke||{},{name:Nt,tableId:qe}=Je||{},pt=$n(ze);return{providerId:ze,label:ye,fieldName:Nt,tableId:qe,type:"link",rowId:`{{ ${pt}.${$n("_id")} }}`,rowTableId:`{{ ${pt}.${$n("tableId")} }}`}})),r.$$.dirty[0]&1&&t(8,f=T.filter(ke=>{var ze;return M.includes((ze=ke.fieldSchema)==null?void 0:ze.type)}).map(ke=>{const{providerId:ze,readableBinding:ye,runtimeBinding:Je}=ke,{name:Nt,type:qe,tableId:pt}=ke.fieldSchema;return{providerId:ze,label:ye,fieldName:Nt,fieldType:qe,tableId:pt,type:"field",value:`{{ literal ${Je} }}`}})),r.$$.dirty[0]&1&&t(7,c=T.filter(ke=>{var ze;return((ze=ke.fieldSchema)==null?void 0:ze.type)==="jsonarray"}).map(ke=>{const{providerId:ze,readableBinding:ye,runtimeBinding:Je,tableId:Nt}=ke,{name:qe,type:pt,prefixKeys:Rt}=ke.fieldSchema;return{providerId:ze,label:ye,fieldName:qe,fieldType:pt,tableId:Nt,prefixKeys:Rt,type:"jsonarray",value:`{{ literal ${Je} }}`}}))},[T,C,I,F,j,z,q,c,f,u,a,s,l,i,n,H,Y,U,W,G,Q,O,o,d,h,v,k,fe,Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se,Ce]}class j6 extends ie{constructor(e){super();le(this,e,Aee,See,re,{value:1,otherSources:2,showAllQueries:21,bindings:0},null,[-1,-1,-1])}}function Eee(r){let e,t;return e=new Xe({props:{options:r[1],value:r[0]}}),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.options=n[1]),i&1&&(l.value=n[0]),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 Oee(r,e,t){let n,i;ue(r,en,o=>t(2,i=o));let{value:l=null}=e;function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,l=o.value)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=i.list.filter(o=>{var a;return o.source==="S3"&&!((a=o.config)==null?void 0:a.endpoint)}).map(o=>({label:o.name,value:o._id})))},[l,n,i,s]}class Tee extends ie{constructor(e){super();le(this,e,Oee,Eee,re,{value:0})}}function Iee(r){let e,t;return e=new Xe({props:{value:r[0],placeholder:null,options:r[1],getOptionLabel:Lee,getOptionValue:r[2]}}),e.$on("change",r[6]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.value=n[0]),i&2&&(l.options=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)}}}const Lee=r=>r._instanceName;function Pee(r,e,t){let n,i,l,s;ue(r,He,c=>t(4,l=c)),ue(r,un,c=>t(5,s=c));let{value:o}=e;const a=ht(),u=c=>`{{ literal ${$n(c._id)} }}`;Gt(()=>{!(o&&i.find(p=>u(p)===o)!=null)&&i.length&&a("change",u(i[i.length-1]))});function f(c){ft.call(this,r,c)}return r.$$set=c=>{"value"in c&&t(0,o=c.value)},r.$$.update=()=>{r.$$.dirty&48&&t(3,n=Sl(s==null?void 0:s.props,l.selectedComponentId)),r.$$.dirty&8&&t(1,i=n.filter(c=>{var p;return(p=c._component)==null?void 0:p.endsWith("/dataprovider")}))},[o,i,u,n,l,s,f]}class Nee extends ie{constructor(e){super();le(this,e,Pee,Iee,re,{value:0})}}function Ree(r){let e;return{c(){e=V("Screen")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Mee(r){let e,t,n,i,l,s,o,a,u,f;t=new Ze({props:{small:!0,$$slots:{default:[Ree]},$$scope:{ctx:r}}}),i=new Un({props:{title:"Destination URL",placeholder:"/screen",value:r[0].url,bindings:r[1]}}),i.$on("change",r[2]);function c(d){r[3](d)}let p={text:"Open screen in modal"};return r[0].peek!==void 0&&(p.value=r[0].peek),a=new Zr({props:p}),K.push(()=>ce(a,"value",c)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),s=D("div"),o=R(),S(a.$$.fragment),w(e,"class","root svelte-15fuuda")},m(d,g){$(d,e,g),A(t,e,null),N(e,n),A(i,e,null),N(e,l),N(e,s),N(e,o),A(a,e,null),f=!0},p(d,[g]){const h={};g&16&&(h.$$scope={dirty:g,ctx:d}),t.$set(h);const v={};g&1&&(v.value=d[0].url),g&2&&(v.bindings=d[1]),i.$set(v);const k={};!u&&g&1&&(u=!0,k.value=d[0].peek,pe(()=>u=!1)),a.$set(k)},i(d){f||(m(t.$$.fragment,d),m(i.$$.fragment,d),m(a.$$.fragment,d),f=!0)},o(d){_(t.$$.fragment,d),_(i.$$.fragment,d),_(a.$$.fragment,d),f=!1},d(d){d&&b(e),E(t),E(i),E(a)}}}function Dee(r,e,t){let{parameters:n}=e,{bindings:i=[]}=e;const l=o=>t(0,n.url=o.detail,n);function s(o){r.$$.not_equal(n.peek,o)&&(n.peek=o,t(0,n))}return r.$$set=o=>{"parameters"in o&&t(0,n=o.parameters),"bindings"in o&&t(1,i=o.bindings)},[n,i,l,s]}class jee extends ie{constructor(e){super();le(this,e,Dee,Mee,re,{parameters:0,bindings:1})}}function B6(r,e,t){const n=r.slice();return n[16]=e[t],n[18]=t,n}function z6(r){let e,t,n,i,l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=q6(B6(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return n=new gt({props:{icon:"AddCircle",secondary:!0,$$slots:{default:[Fee]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){for(let a=0;a<s.length;a+=1)s[a].c();e=R(),t=D("div"),S(n.$$.fragment),zt(t,"margin-top","10px")},m(a,u){for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,e,u),$(a,t,u),A(n,t,null),i=!0},p(a,u){if(u&479){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=B6(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=q6(p),s[c].c(),m(s[c],1),s[c].m(e.parentNode,e))}for(te(),c=l.length;c<s.length;c+=1)o(c);ne()}const f={};u&524290&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){if(!i){for(let u=0;u<l.length;u+=1)m(s[u]);m(n.$$.fragment,a),i=!0}},o(a){s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);_(n.$$.fragment,a),i=!1},d(a){$t(s,a),a&&b(e),a&&b(t),E(n)}}}function Bee(r){let e;return{c(){e=V(r[1])},m(t,n){$(t,e,n)},p(t,n){n&2&&Te(e,t[1])},d(t){t&&b(e)}}}function zee(r){let e,t;function n(...i){return r[11](r[18],...i)}return e=new tt({props:{thin:!0,secondary:!0,value:r[16][0]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),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 qee(r){let e,t;function n(...i){return r[10](r[18],...i)}return e=new Xe({props:{value:r[16][0],options:r[0].map(U6)}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),l&1&&(s.options=r[0].map(U6)),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 Uee(r){let e;return{c(){e=V(r[2])},m(t,n){$(t,e,n)},p(t,n){n&4&&Te(e,t[2])},d(t){t&&b(e)}}}function q6(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ze({props:{small:!0,$$slots:{default:[Bee]},$$scope:{ctx:r}}});const p=[qee,zee],d=[];function g(k,C){return k[0]?0:1}n=g(r),i=d[n]=p[n](r),s=new Ze({props:{small:!0,$$slots:{default:[Uee]},$$scope:{ctx:r}}});function h(...k){return r[12](r[18],...k)}a=new Un({props:{title:`Value for "${r[16][0]}"`,value:r[16][1],bindings:r[3]}}),a.$on("change",h);function v(){return r[13](r[16])}return f=new Jt({props:{size:"S",quiet:!0,icon:"Delete"}}),f.$on("click",v),{c(){S(e.$$.fragment),t=R(),i.c(),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),S(f.$$.fragment)},m(k,C){A(e,k,C),$(k,t,C),d[n].m(k,C),$(k,l,C),A(s,k,C),$(k,o,C),A(a,k,C),$(k,u,C),A(f,k,C),c=!0},p(k,C){r=k;const I={};C&524290&&(I.$$scope={dirty:C,ctx:r}),e.$set(I);let O=n;n=g(r),n===O?d[n].p(r,C):(te(),_(d[O],1,1,()=>{d[O]=null}),ne(),i=d[n],i?i.p(r,C):(i=d[n]=p[n](r),i.c()),m(i,1),i.m(l.parentNode,l));const T={};C&524292&&(T.$$scope={dirty:C,ctx:r}),s.$set(T);const P={};C&16&&(P.title=`Value for "${r[16][0]}"`),C&16&&(P.value=r[16][1]),C&8&&(P.bindings=r[3]),a.$set(P)},i(k){c||(m(e.$$.fragment,k),m(i),m(s.$$.fragment,k),m(a.$$.fragment,k),m(f.$$.fragment,k),c=!0)},o(k){_(e.$$.fragment,k),_(i),_(s.$$.fragment,k),_(a.$$.fragment,k),_(f.$$.fragment,k),c=!1},d(k){E(e,k),k&&b(t),d[n].d(k),k&&b(l),E(s,k),k&&b(o),E(a,k),k&&b(u),E(f,k)}}}function Fee(r){let e,t;return{c(){e=V(`Add
|
|
1215
|
+
`;function Ax(r){let e,t,n;return t=new Qe({props:{justifyItems:"center",gap:"S",$$slots:{default:[Ix]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","center error svelte-byn9z3")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&8388624&&(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 Ex(r){let e,t,n;return t=new Gs({}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","center svelte-byn9z3")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p:Oe,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function Ox(r){let e;return{c(){e=V("App preview failed to load")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Tx(r){let e;return{c(){e=V(r[4])},m(t,n){$(t,e,n)},p(t,n){n&16&&Te(e,t[4])},d(t){t&&b(e)}}}function Ix(r){let e,t,n,i,l,s;return n=new Ct({props:{size:"L",$$slots:{default:[Ox]},$$scope:{ctx:r}}}),l=new Ke({props:{size:"S",$$slots:{default:[Tx]},$$scope:{ctx:r}}}),{c(){e=new cS,t=R(),S(n.$$.fragment),i=R(),S(l.$$.fragment),e.a=t},m(o,a){e.m(Sx,o,a),$(o,t,a),A(n,o,a),$(o,i,a),A(l,o,a),s=!0},p(o,a){const u={};a&8388608&&(u.$$scope={dirty:a,ctx:o}),n.$set(u);const f={};a&8388624&&(f.$$scope={dirty:a,ctx:o}),l.$set(f)},i(o){s||(m(n.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(n.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){o&&e.d(),o&&b(t),E(n,o),o&&b(i),E(l,o)}}}function Lx(r){let e,t,n,i,l,s,o,a;const u=[Ex,Ax],f=[];function c(d,g){return d[3]?0:d[4]?1:-1}~(t=c(r))&&(n=f[t]=u[t](r));let p={title:"Confirm Deletion",body:"Are you sure you want to delete this component?",okText:"Delete component",onOk:r[6],onCancel:r[7]};return o=new hr({props:p}),r[15](o),{c(){e=D("div"),n&&n.c(),i=R(),l=D("iframe"),s=R(),S(o.$$.fragment),w(l,"title","componentPreview"),w(l,"srcdoc",r[5]),w(l,"class","svelte-byn9z3"),oe(l,"hidden",r[3]||r[4]),oe(l,"tablet",r[0].previewDevice==="tablet"),oe(l,"mobile",r[0].previewDevice==="mobile"),w(e,"class","component-container svelte-byn9z3")},m(d,g){$(d,e,g),~t&&f[t].m(e,null),N(e,i),N(e,l),r[14](l),$(d,s,g),A(o,d,g),a=!0},p(d,[g]){let h=t;t=c(d),t===h?~t&&f[t].p(d,g):(n&&(te(),_(f[h],1,1,()=>{f[h]=null}),ne()),~t?(n=f[t],n?n.p(d,g):(n=f[t]=u[t](d),n.c()),m(n,1),n.m(e,i)):n=null),(!a||g&32)&&w(l,"srcdoc",d[5]),g&24&&oe(l,"hidden",d[3]||d[4]),g&1&&oe(l,"tablet",d[0].previewDevice==="tablet"),g&1&&oe(l,"mobile",d[0].previewDevice==="mobile");const v={};o.$set(v)},i(d){a||(m(n),m(o.$$.fragment,d),a=!0)},o(d){_(n),_(o.$$.fragment,d),a=!1},d(d){d&&b(e),~t&&f[t].d(),r[14](null),d&&b(s),r[15](null),E(o,d)}}}function Px(r,e,t){let n,i,l,s,o,a;ue(r,He,z=>t(0,o=z)),ue(r,un,z=>t(13,a=z));let u,f,c,p,d,g=!0,h;const v=new Ia().name("Screen Placeholder").route("*").component("@budibase/standard-components/screenslot").instanceName("Content Placeholder").json(),k={READY:"ready",ERROR:"error",BUDIBASE:"type"},C=z=>{u&&u.contentWindow.postMessage(z)};function I(z){({[k.READY]:()=>{o.clientFeatures.messagePassing&&!g||(o.clientFeatures.intelligentLoading||t(3,g=!1),C(s))},[k.ERROR]:Y=>{t(3,g=!1),t(4,h=Y.error||"An unknown error occurred")}}[z.data.type]||O)(z)}Gt(()=>{window.addEventListener("message",I),o.clientFeatures.messagePassing||(u.contentWindow.addEventListener("ready",()=>{I({data:{type:k.READY}})},{once:!0}),u.contentWindow.addEventListener("error",z=>{I({data:{type:k.ERROR,error:z.detail}})},{once:!0}),u.contentWindow.addEventListener("bb-event",O))}),gp(()=>{window.removeEventListener("message",I),u.contentWindow&&(o.clientFeatures.messagePassing||u.contentWindow.removeEventListener("bb-event",O))});const O=async z=>{const{type:q,data:H}=z.data||z.detail;if(!!q)try{if(q==="select-component"&&H.id)He.actions.components.select({_id:H.id});else if(q==="update-prop")await He.actions.components.updateProp(H.prop,H.value);else if(q==="delete-component"&&H.id)T(H.id);else if(q==="duplicate-component"&&H.id){const Y=it(un).props,U=Cl(Y,H.id);He.actions.components.copy(U),await He.actions.components.paste(U)}else if(q==="preview-loaded")t(3,g=!1);else if(q==="move-component"){const{componentId:Y,destinationComponentId:U}=H,W=it(un).props,G=Cl(W,Y),Q=Cl(W,U);if(Sl(G,U).map(ee=>ee._id).includes(H.destinationComponentId))return;G&&Q&&(He.actions.components.copy(G,!0),await He.actions.components.paste(Q,H.mode))}else console.warn(`Client sent unknown event type: ${q}`)}catch(Y){console.warn(Y),we.error("Error handling event from app preview")}},T=z=>{d=z,p.show()},P=async()=>{try{await He.actions.components.delete({_id:d})}catch{we.error("Error deleting component")}d=null},M=()=>{d=null};function F(z){K[z?"unshift":"push"](()=>{u=z,t(1,u)})}function j(z){K[z?"unshift":"push"](()=>{p=z,t(2,p)})}return r.$$.update=()=>{var z;r.$$.dirty&1&&t(5,n=Cx.replace(/\{\{ CLIENT_LIB_PATH }}/,o.clientLibPath)),r.$$.dirty&8705&&(o.currentFrontEndType===Xn.LAYOUT?(t(8,f=a),t(9,c=v)):(t(9,c=a),t(8,f=o.layouts.find(q=>q._id===(c==null?void 0:c.layoutId))))),r.$$.dirty&1&&t(12,i=(z=o.selectedComponentId)!=null?z:""),r.$$.dirty&4865&&t(11,l={appId:o.appId,layout:f,screen:c,selectedComponentId:i,previewType:o.currentFrontEndType,theme:o.theme,customTheme:o.customTheme,previewDevice:o.previewDevice,messagePassing:o.clientFeatures.messagePassing,isBudibaseEvent:!0}),r.$$.dirty&2048&&t(10,s=JSON.stringify(l)),r.$$.dirty&1024&&C(s)},[o,u,p,g,h,n,P,M,f,c,s,l,i,a,F,j]}class Nx extends ie{constructor(e){super();le(this,e,Px,Lx,re,{})}}function r6(r){let e,t,n;return t=new Ze({props:{$$slots:{default:[Rx]},$$scope:{ctx:r}}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","label svelte-3rofj0")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&262145&&(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 Rx(r){let e;return{c(){e=V(r[0])},m(t,n){$(t,e,n)},p(t,n){n&1&&Te(e,t[0])},d(t){t&&b(e)}}}function Mx(r){let e,t,n,i,l,s,o,a=r[4]!=="boolean"&&r[0]&&r6(r);const u=[{componentInstance:r[1]},{value:r[7]},{updateOnChange:!1},{onChange:r[8]},{bindings:r[6]},{name:r[3]},{text:r[0]},{type:r[4]},r[5]];var f=r[2];function c(p){let d={};for(let g=0;g<u.length;g+=1)d=Ui(d,u[g]);return{props:d}}return f&&(i=new f(c()),i.$on("change",r[8])),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),i&&S(i.$$.fragment),w(n,"data-cy",l=`${r[3]}-prop-control`),w(n,"class","control svelte-3rofj0"),w(e,"class","property-control svelte-3rofj0"),w(e,"data-cy",s=`setting-${r[3]}`)},m(p,d){$(p,e,d),a&&a.m(e,null),N(e,t),N(e,n),i&&A(i,n,null),o=!0},p(p,[d]){p[4]!=="boolean"&&p[0]?a?(a.p(p,d),d&17&&m(a,1)):(a=r6(p),a.c(),m(a,1),a.m(e,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne());const g=d&507?Su(u,[d&2&&{componentInstance:p[1]},d&128&&{value:p[7]},u[2],d&256&&{onChange:p[8]},d&64&&{bindings:p[6]},d&8&&{name:p[3]},d&1&&{text:p[0]},d&16&&{type:p[4]},d&32&&Au(p[5])]):{};if(f!==(f=p[2])){if(i){te();const h=i;_(h.$$.fragment,1,0,()=>{E(h,1)}),ne()}f?(i=new f(c()),i.$on("change",p[8]),S(i.$$.fragment),m(i.$$.fragment,1),A(i,n,null)):i=null}else f&&i.$set(g);(!o||d&8&&l!==(l=`${p[3]}-prop-control`))&&w(n,"data-cy",l),(!o||d&8&&s!==(s=`setting-${p[3]}`))&&w(e,"data-cy",s)},i(p){o||(m(a),i&&m(i.$$.fragment,p),o=!0)},o(p){_(a),i&&_(i.$$.fragment,p),o=!1},d(p){p&&b(e),a&&a.d(),i&&E(i)}}}function Dx(r,e,t){let n,i,l,{label:s=""}=e,{componentInstance:o={}}=e,{control:a=null}=e,{key:u=""}=e,{type:f=""}=e,{value:c=null}=e,{props:p={}}=e,{onChange:d=()=>{}}=e,{bindings:g=[]}=e,{componentBindings:h=[]}=e,{nested:v=!1}=e;const k=(O,T,P)=>P?[...T||[],...O||[]]:O,C=O=>{let T=O;O&&typeof O=="object"&&("detail"in O?T=O.detail:"target"in O&&(T=O.target.value)),f==="number"&&(T=parseInt(T)),d(typeof T=="string"?l(T):T)},I=(O,T,P)=>{const M=_o(P,O);return M==null&&T!==void 0?T:M};return r.$$set=O=>{"label"in O&&t(0,s=O.label),"componentInstance"in O&&t(1,o=O.componentInstance),"control"in O&&t(2,a=O.control),"key"in O&&t(3,u=O.key),"type"in O&&t(4,f=O.type),"value"in O&&t(9,c=O.value),"props"in O&&t(5,p=O.props),"onChange"in O&&t(10,d=O.onChange),"bindings"in O&&t(11,g=O.bindings),"componentBindings"in O&&t(12,h=O.componentBindings),"nested"in O&&t(13,v=O.nested)},r.$$.update=()=>{r.$$.dirty&14336&&t(6,n=k(g,h,v)),r.$$.dirty&608&&t(7,i=I(c,p.defaultValue,n)),r.$$.dirty&128,r.$$.dirty&64&&(l=O=>Ss(n,O))},[s,o,a,u,f,p,n,i,C,c,d,g,h,v]}class La extends ie{constructor(e){super();le(this,e,Dx,Mx,re,{label:0,componentInstance:1,control:2,key:3,type:4,value:9,props:5,onChange:10,bindings:11,componentBindings:12,nested:13})}}function jx(r){let e,t,n;function i(s){r[2](s)}let l={options:r[1].layouts,getOptionLabel:Bx,getOptionValue:zx};return r[0]!==void 0&&(l.value=r[0]),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};o&2&&(a.options=s[1].layouts),!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}const Bx=r=>r.name,zx=r=>r._id;function qx(r,e,t){let n;ue(r,He,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class Ux extends ie{constructor(e){super();le(this,e,qx,jx,re,{value:0})}}function Fx(r){let e,t,n;function i(s){r[2](s)}let l={options:r[1],getOptionLabel:Vx,getOptionValue:Hx};return r[0]!==void 0&&(l.value=r[0]),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,[o]){const a={};o&2&&(a.options=s[1]),!t&&o&1&&(t=!0,a.value=s[0],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}const Vx=r=>r.name,Hx=r=>r._id;function Wx(r,e,t){let n;ue(r,Zi,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class Gx extends ie{constructor(e){super();le(this,e,Wx,Fx,re,{value:0})}}function As(r){return r.split("/").map(e=>e.startsWith(":")?e:encodeURIComponent(e.replace(/ /g,"-"))).join("/").toLowerCase()}function i6(r,e,t){const n=r.slice();return n[7]=e[t],n}function l6(r){let e,t;return e=new Vo({props:{name:"Screen",collapsible:!1,$$slots:{default:[Yx]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1034&&(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 s6(r,e){let t,n,i;function l(...s){return e[6](e[7],...s)}return n=new La({props:{control:e[7].control,label:e[7].label,key:e[7].key,value:jl.exports.get(e[3],e[7].key),onChange:l,bindings:e[1]}}),{key:r,first:null,c(){t=Ee(),S(n.$$.fragment),this.first=t},m(s,o){$(s,t,o),A(n,s,o),i=!0},p(s,o){e=s;const a={};o&8&&(a.value=jl.exports.get(e[3],e[7].key)),o&2&&(a.bindings=e[1]),n.$set(a)},i(s){i||(m(n.$$.fragment,s),i=!0)},o(s){_(n.$$.fragment,s),i=!1},d(s){s&&b(t),E(n,s)}}}function Yx(r){let e=[],t=new Map,n,i,l=r[5];const s=o=>`${o[0]._id}-${o[7].key}`;for(let o=0;o<l.length;o+=1){let a=i6(r,l,o),u=s(a);t.set(u,e[o]=s6(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&59&&(l=o[5],te(),e=xn(e,a,s,1,o,l,t,n.parentNode,jr,s6,n,i6),ne())},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 Jx(r){let e,t,n=r[2].currentView!=="component"&&r[3]&&r[2].currentFrontEndType===Xn.SCREEN&&l6(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].currentView!=="component"&&i[3]&&i[2].currentFrontEndType===Xn.SCREEN?n?(n.p(i,l),l&12&&m(n,1)):(n=l6(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function Qx(r,e,t){let n,i;ue(r,He,f=>t(2,n=f)),ue(r,un,f=>t(3,i=f));let{componentInstance:l}=e,{bindings:s}=e;function o(f,c,p){p&&typeof p=="function"&&(c=p(c));const d=it(un);He.update(g=>(f==="_instanceName"&&g.currentFrontEndType===Xn.SCREEN?d.props._instanceName=c:jl.exports.setWith(d,f.split("."),c,Object),g));try{He.actions.preview.saveSelected()}catch{we.error("Error saving settings")}}const a=[{key:"routing.route",label:"Route",control:tt,parser:f=>(f.startsWith("/")||(f="/"+f),As(f))},{key:"routing.roleId",label:"Access",control:Gx},{key:"layoutId",label:"Layout",control:Ux}],u=(f,c)=>o(f.key,c,f.parser);return r.$$set=f=>{"componentInstance"in f&&t(0,l=f.componentInstance),"bindings"in f&&t(1,s=f.bindings)},[l,s,n,i,o,a,u]}class Xx extends ie{constructor(e){super();le(this,e,Qx,Jx,re,{componentInstance:0,bindings:1})}}class Jn extends n6{constructor(e){super(!1);this._children=[],this._json={_id:Fi(),_component:e,_styles:{normal:{},hover:{},active:{},selected:{}},_instanceName:"",_children:[]}}normalStyle(e){return this._json._styles.normal=e,this}hoverStyle(e){return this._json._styles.hover=e,this}customStyle(e){return this._json._styles.custom=e,this}instanceName(e){return this._json._instanceName=e,this}type(e){return this._json.type=e,this}text(e){return this._json.text=e,this}}function Kx(r){return r.map(e=>({name:`${e.name} - New`,create:()=>eee(e),id:Zx,table:e.name}))}const o6=r=>As(`/${r.name}/new/row`),Zx="NEW_ROW_TEMPLATE";function xx(r,e){return c6("New Row").addChild(f6(r,e))}const eee=r=>{const e=new Ia().instanceName(`${r.name} - New`).customProps({hAlign:"center"}).route(o6(r)),t=a6().instanceName("Form").customProps({actionType:"Create",dataSource:{label:r.name,tableId:r._id,type:"table"},size:"spectrum--medium"}),n=new Jn("@budibase/standard-components/fieldgroup").instanceName("Field Group").customProps({labelPosition:"left"}),i={type:"table",tableId:r._id};S1(i).forEach(s=>{n.addChild(s)});const l=t._json._id;return t.addChild(u6(r.name,"New")).addChild(xx(r,l)).addChild(n),e.addChild(t).json()};function tee(r){return r.map(e=>({name:`${e.name} - List`,create:()=>iee(e),id:nee,table:e.name}))}const nee="ROW_LIST_TEMPLATE",Kf=r=>As(`/${r.name}`);function ree(r){const e=new Jn("@budibase/standard-components/button").text("Create New").customProps({size:"M",type:"primary",onClick:[{parameters:{url:o6(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("New Button"),t=new Jn("@budibase/standard-components/heading").instanceName("Title").text(r.name).customProps({size:"M",align:"left"});return new Jn("@budibase/standard-components/container").customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(t).addChild(e)}const iee=r=>{const e=new Jn("@budibase/standard-components/dataprovider").instanceName("Data Provider").customProps({dataSource:{label:r.name,name:r._id,tableId:r._id,type:"table"},size:"spectrum--medium",paginate:!0,limit:8}),t=new Jn("@budibase/standard-components/table").customProps({dataProvider:`{{ literal ${$n(e._json._id)} }}`,showAutoColumns:!1,quiet:!1,rowCount:8}).instanceName(`${r.name} Table`),n=$n(t._json._id),i=$n("_id"),l=new Jn("@budibase/standard-components/link").customProps({text:"View",url:`${Kf(r)}/{{ ${n}.${i} }}`,size:"S",color:"var(--spectrum-global-color-gray-600)",align:"left"}).normalStyle({["margin-left"]:"16px",["margin-right"]:"16px"}).instanceName("View Link");return t.addChild(l),e.addChild(t),new Ia().route(Kf(r)).instanceName(`${r.name} - List`).addChild(ree(r)).addChild(e).json()};function C1(r){return`var(--spectrum-global-color-gray-${r})`}function lee(r){return new Jn("@budibase/standard-components/link").text(r).customProps({url:`/${r.toLowerCase()}`,openInNewTab:!1,color:C1(700),size:"S",align:"left"})}function a6(){return new Jn("@budibase/standard-components/form").normalStyle({width:"600px"}).instanceName("Form")}function u6(r,e){const t=lee(r).instanceName("Back Link"),n=new Jn("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:C1(700),size:"S",align:"left"}),i=new Jn("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:C1(700),size:"S",align:"left"});return new Jn("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).instanceName("Breadcrumbs").addChild(t).addChild(n).addChild(i)}function f6(r,e){return new Jn("@budibase/standard-components/button").text("Save").customProps({type:"primary",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:e}},{parameters:{providerId:e,tableId:r._id},"##eventHandlerType":"Save Row"},{parameters:{url:Kf(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("Save Button")}function c6(r){const e=new Jn("@budibase/standard-components/heading").instanceName("Title").text(r).customProps({size:"M",align:"left"});return new Jn("@budibase/standard-components/container").normalStyle({"margin-top":"32px","margin-bottom":"32px"}).customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(e)}const see={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield"};function S1(r){const{schema:e}=Di(null,r,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const l=e[i];if(l.autocolumn||l.nestedJSON)return;const s=typeof l=="object"?l.type:l,o=see[s],a=`@budibase/standard-components/${o}`;if(o){const u=new Jn(a).instanceName(i).customProps({field:i,label:i,placeholder:i});if(s==="options"&&u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"}),s==="longform"&&u.customProps({format:"auto"}),s==="array"&&u.customProps({placeholder:"Choose an option",optionsSource:"schema"}),s==="link"){let f=l.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:f})}s==="boolean"&&u.customProps({text:i,label:""}),t.push(u)}}),t}function oee(r){let e;return{c(){e=V("Update form fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function aee(r){let e,t,n,i,l;t=new Jt({props:{secondary:!0,wide:!0,$$slots:{default:[oee]},$$scope:{ctx:r}}}),t.$on("click",r[3]);let s={body:"All components inside this group will be deleted and replaced with fields to match the schema. Are you sure you want to update this Field Group?",okText:"Update",onOk:r[1],title:"Confirm Form Field Update"};return i=new hr({props:s}),r[4](i),{c(){e=D("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]){const u={};a&64&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};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[4](null),E(i,o)}}}function uee(r,e,t){let n;ue(r,un,u=>t(5,n=u));let{componentInstance:i}=e,l;const s=async()=>{const u=qf(n==null?void 0:n.props,i._id,p=>p._component.endsWith("/form")),f=u==null?void 0:u.dataSource,c=S1(f);try{await He.actions.components.updateProp("_children",c.map(p=>p.json()))}catch{we.error("Error resetting form fields")}},o=()=>l==null?void 0:l.show();function a(u){K[u?"unshift":"push"](()=>{l=u,t(0,l)})}return r.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[l,s,i,o,a]}class fee extends ie{constructor(e){super();le(this,e,uee,aee,re,{componentInstance:2})}}function p6(r,e,t){const n=r.slice();return n[44]=e[t],n}function d6(r,e,t){const n=r.slice();return n[47]=e[t],n}function m6(r,e,t){const n=r.slice();return n[50]=e[t],n}function g6(r,e,t){const n=r.slice();return n[50]=e[t],n}function _6(r,e,t){const n=r.slice();return n[55]=e[t],n}function h6(r,e,t){const n=r.slice();return n[58]=e[t],n}function $6(r,e,t){const n=r.slice();return n[61]=e[t],n}function b6(r,e,t){const n=r.slice();return n[64]=e[t],n}function v6(r){let e,t,n,i,l,s,o={title:"Query Bindings",$$slots:{body:[gee],buttons:[pee]},$$scope:{ctx:r}};return n=new Kr({props:o}),r[29](n),{c(){e=D("i"),t=R(),S(n.$$.fragment),w(e,"class","ri-settings-5-line svelte-xmd5g6")},m(a,u){$(a,e,u),$(a,t,u),A(n,a,u),i=!0,l||(s=Pe(e,"click",r[19]),l=!0)},p(a,u){const f={};u[0]&67|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){i||(m(n.$$.fragment,a),i=!0)},o(a){_(n.$$.fragment,a),i=!1},d(a){a&&b(e),a&&b(t),r[29](null),E(n,a),l=!1,s()}}}function cee(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pee(r){let e,t;return e=new gt({props:{slot:"buttons",cta:!0,$$slots:{default:[cee]},$$scope:{ctx:r}}}),e.$on("click",r[20]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[2]&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 w6(r){let e,t,n,i;function l(a){r[27](a)}function s(a){r[28](a)}let o={queryBindings:r[17](r[1])};return r[6]!==void 0&&(o.customParams=r[6]),r[0]!==void 0&&(o.bindings=r[0]),e=new v1({props:o}),K.push(()=>ce(e,"customParams",l)),K.push(()=>ce(e,"bindings",s)),{c(){S(e.$$.fragment)},m(a,u){A(e,a,u),i=!0},p(a,u){const f={};u[0]&2&&(f.queryBindings=a[17](a[1])),!t&&u[0]&64&&(t=!0,f.customParams=a[6],pe(()=>t=!1)),!n&&u[0]&1&&(n=!0,f.bindings=a[0],pe(()=>n=!1)),e.$set(f)},i(a){i||(m(e.$$.fragment,a),i=!0)},o(a){_(e.$$.fragment,a),i=!1},d(a){E(e,a)}}}function dee(r){let e=r[17](r[1]).length>0,t,n,i,l=e&&w6(r);return n=new m1({props:{height:200,query:r[1],schema:r[16](r[1]),datasource:r[18](r[1]),editable:!1}}),{c(){l&&l.c(),t=R(),S(n.$$.fragment)},m(s,o){l&&l.m(s,o),$(s,t,o),A(n,s,o),i=!0},p(s,o){o[0]&2&&(e=s[17](s[1]).length>0),e?l?(l.p(s,o),o[0]&2&&m(l,1)):(l=w6(s),l.c(),m(l,1),l.m(t.parentNode,t)):l&&(te(),_(l,1,1,()=>{l=null}),ne());const a={};o[0]&2&&(a.query=s[1]),o[0]&2&&(a.schema=s[16](s[1])),o[0]&2&&(a.datasource=s[18](s[1])),n.$set(a)},i(s){i||(m(l),m(n.$$.fragment,s),i=!0)},o(s){_(l),_(n.$$.fragment,s),i=!1},d(s){l&&l.d(s),s&&b(t),E(n,s)}}}function mee(r){let e,t;return e=new Qe({props:{noPadding:!0,gap:"XS",$$slots:{default:[dee]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&67|i[2]&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 gee(r){let e,t;return e=new Ai({props:{slot:"body",$$slots:{default:[mee]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&67|i[2]&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 _ee(r){let e;return{c(){e=V("Tables")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function y6(r){let e,t=r[64].label+"",n,i,l;function s(){return r[31](r[64])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&8192&&t!==(t=r[64].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function k6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[hee]},$$scope:{ctx:r}}});let a=r[12],u=[];for(let f=0;f<a.length;f+=1)u[f]=C6($6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&36864){a=f[12];let d;for(d=0;d<a.length;d+=1){const g=$6(f,a,d);u[d]?u[d].p(g,c):(u[d]=C6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function hee(r){let e;return{c(){e=V("Views")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function C6(r){let e,t=r[61].label+"",n,i,l;function s(){return r[32](r[61])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4096&&t!==(t=r[61].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function S6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[$ee]},$$scope:{ctx:r}}});let a=r[11],u=[];for(let f=0;f<a.length;f+=1)u[f]=A6(h6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&34818){a=f[11];let d;for(d=0;d<a.length;d+=1){const g=h6(f,a,d);u[d]?u[d].p(g,c):(u[d]=A6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function $ee(r){let e;return{c(){e=V("Queries")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function A6(r){let e,t=r[58].label+"",n,i,l,s;function o(){return r[33](r[58])}return{c(){e=D("li"),n=V(t),i=R(),w(e,"class","svelte-xmd5g6"),oe(e,"selected",r[1]===r[58])},m(a,u){$(a,e,u),N(e,n),N(e,i),l||(s=Pe(e,"click",o),l=!0)},p(a,u){r=a,u[0]&2048&&t!==(t=r[58].label+"")&&Te(n,t),u[0]&2050&&oe(e,"selected",r[1]===r[58])},d(a){a&&b(e),l=!1,s()}}}function E6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[bee]},$$scope:{ctx:r}}});let a=r[9],u=[];for(let f=0;f<a.length;f+=1)u[f]=O6(_6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33280){a=f[9];let d;for(d=0;d<a.length;d+=1){const g=_6(f,a,d);u[d]?u[d].p(g,c):(u[d]=O6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function bee(r){let e;return{c(){e=V("Relationships")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function O6(r){let e,t=r[55].label+"",n,i,l;function s(){return r[34](r[55])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&512&&t!==(t=r[55].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function T6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[vee]},$$scope:{ctx:r}}});let a=r[8],u=[];for(let f=0;f<a.length;f+=1)u[f]=I6(g6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33024){a=f[8];let d;for(d=0;d<a.length;d+=1){const g=g6(f,a,d);u[d]?u[d].p(g,c):(u[d]=I6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function vee(r){let e;return{c(){e=V("Fields")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function I6(r){let e,t=r[50].label+"",n,i,l;function s(){return r[35](r[50])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&256&&t!==(t=r[50].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function L6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[wee]},$$scope:{ctx:r}}});let a=r[7],u=[];for(let f=0;f<a.length;f+=1)u[f]=P6(m6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&32896){a=f[7];let d;for(d=0;d<a.length;d+=1){const g=m6(f,a,d);u[d]?u[d].p(g,c):(u[d]=P6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function wee(r){let e;return{c(){e=V("JSON Arrays")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function P6(r){let e,t=r[50].label+"",n,i,l;function s(){return r[36](r[50])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&128&&t!==(t=r[50].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function N6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[yee]},$$scope:{ctx:r}}});let a=r[10],u=[];for(let f=0;f<a.length;f+=1)u[f]=R6(d6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&33794){a=f[10];let d;for(d=0;d<a.length;d+=1){const g=d6(f,a,d);u[d]?u[d].p(g,c):(u[d]=R6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function yee(r){let e;return{c(){e=V("Data Providers")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function R6(r){let e,t=r[47].label+"",n,i,l,s;function o(){return r[37](r[47])}return{c(){e=D("li"),n=V(t),i=R(),w(e,"class","svelte-xmd5g6"),oe(e,"selected",r[1]===r[47])},m(a,u){$(a,e,u),N(e,n),N(e,i),l||(s=Pe(e,"click",o),l=!0)},p(a,u){r=a,u[0]&1024&&t!==(t=r[47].label+"")&&Te(n,t),u[0]&1026&&oe(e,"selected",r[1]===r[47])},d(a){a&&b(e),l=!1,s()}}}function M6(r){let e,t,n,i,l,s,o;e=new pn({props:{size:"S"}}),i=new Ct({props:{size:"XS",$$slots:{default:[kee]},$$scope:{ctx:r}}});let a=r[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=D6(p6(r,a,f));return{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();w(n,"class","title svelte-xmd5g6"),w(s,"class","svelte-xmd5g6")},m(f,c){A(e,f,c),$(f,t,c),$(f,n,c),A(i,n,null),$(f,l,c),$(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&32772){a=f[2];let d;for(d=0;d<a.length;d+=1){const g=p6(f,a,d);u[d]?u[d].p(g,c):(u[d]=D6(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){E(e,f),f&&b(t),f&&b(n),E(i),f&&b(l),f&&b(s),$t(u,f)}}}function kee(r){let e;return{c(){e=V("Other")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function D6(r){let e,t=r[44].label+"",n,i,l;function s(){return r[38](r[44])}return{c(){e=D("li"),n=V(t),w(e,"class","svelte-xmd5g6")},m(o,a){$(o,e,a),N(e,n),i||(l=Pe(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4&&t!==(t=r[44].label+"")&&Te(n,t)},d(o){o&&b(e),i=!1,l()}}}function Cee(r){var M,F,j,z,q,H,Y;let e,t,n,i,l,s,o,a,u,f,c,p,d;n=new Ct({props:{size:"XS",$$slots:{default:[_ee]},$$scope:{ctx:r}}});let g=r[13],h=[];for(let U=0;U<g.length;U+=1)h[U]=y6(b6(r,g,U));let v=((M=r[12])==null?void 0:M.length)&&k6(r),k=((F=r[11])==null?void 0:F.length)&&S6(r),C=((j=r[9])==null?void 0:j.length)&&E6(r),I=((z=r[8])==null?void 0:z.length)&&T6(r),O=((q=r[7])==null?void 0:q.length)&&L6(r),T=((H=r[10])==null?void 0:H.length)&&N6(r),P=((Y=r[2])==null?void 0:Y.length)&&M6(r);return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("ul");for(let U=0;U<h.length;U+=1)h[U].c();s=R(),v&&v.c(),o=R(),k&&k.c(),a=R(),C&&C.c(),u=R(),I&&I.c(),f=R(),O&&O.c(),c=R(),T&&T.c(),p=R(),P&&P.c(),w(t,"class","title svelte-xmd5g6"),w(l,"class","svelte-xmd5g6"),w(e,"class","dropdown svelte-xmd5g6")},m(U,W){$(U,e,W),N(e,t),A(n,t,null),N(e,i),N(e,l);for(let G=0;G<h.length;G+=1)h[G].m(l,null);N(e,s),v&&v.m(e,null),N(e,o),k&&k.m(e,null),N(e,a),C&&C.m(e,null),N(e,u),I&&I.m(e,null),N(e,f),O&&O.m(e,null),N(e,c),T&&T.m(e,null),N(e,p),P&&P.m(e,null),d=!0},p(U,W){var Q,fe,Z,ee,ae,_e,Re;const G={};if(W[2]&32&&(G.$$scope={dirty:W,ctx:U}),n.$set(G),W[0]&40960){g=U[13];let $e;for($e=0;$e<g.length;$e+=1){const be=b6(U,g,$e);h[$e]?h[$e].p(be,W):(h[$e]=y6(be),h[$e].c(),h[$e].m(l,null))}for(;$e<h.length;$e+=1)h[$e].d(1);h.length=g.length}((Q=U[12])==null?void 0:Q.length)?v?(v.p(U,W),W[0]&4096&&m(v,1)):(v=k6(U),v.c(),m(v,1),v.m(e,o)):v&&(te(),_(v,1,1,()=>{v=null}),ne()),((fe=U[11])==null?void 0:fe.length)?k?(k.p(U,W),W[0]&2048&&m(k,1)):(k=S6(U),k.c(),m(k,1),k.m(e,a)):k&&(te(),_(k,1,1,()=>{k=null}),ne()),((Z=U[9])==null?void 0:Z.length)?C?(C.p(U,W),W[0]&512&&m(C,1)):(C=E6(U),C.c(),m(C,1),C.m(e,u)):C&&(te(),_(C,1,1,()=>{C=null}),ne()),((ee=U[8])==null?void 0:ee.length)?I?(I.p(U,W),W[0]&256&&m(I,1)):(I=T6(U),I.c(),m(I,1),I.m(e,f)):I&&(te(),_(I,1,1,()=>{I=null}),ne()),((ae=U[7])==null?void 0:ae.length)?O?(O.p(U,W),W[0]&128&&m(O,1)):(O=L6(U),O.c(),m(O,1),O.m(e,c)):O&&(te(),_(O,1,1,()=>{O=null}),ne()),((_e=U[10])==null?void 0:_e.length)?T?(T.p(U,W),W[0]&1024&&m(T,1)):(T=N6(U),T.c(),m(T,1),T.m(e,p)):T&&(te(),_(T,1,1,()=>{T=null}),ne()),((Re=U[2])==null?void 0:Re.length)?P?(P.p(U,W),W[0]&4&&m(P,1)):(P=M6(U),P.c(),m(P,1),P.m(e,null)):P&&(te(),_(P,1,1,()=>{P=null}),ne())},i(U){d||(m(n.$$.fragment,U),m(v),m(k),m(C),m(I),m(O),m(T),m(P),d=!0)},o(U){_(n.$$.fragment,U),_(v),_(k),_(C),_(I),_(O),_(T),_(P),d=!1},d(U){U&&b(e),E(n),$t(h,U),v&&v.d(),k&&k.d(),C&&C.d(),I&&I.d(),O&&O.d(),T&&T.d(),P&&P.d()}}}function See(r){var u;let e,t,n,i,l,s;t=new Xe({props:{readonly:!0,value:r[14],options:[r[14]]}}),t.$on("click",function(){mt(r[4].show)&&r[4].show.apply(this,arguments)});let o=((u=r[1])==null?void 0:u.type)==="query"&&v6(r),a={anchor:r[3],$$slots:{default:[Cee]},$$scope:{ctx:r}};return l=new wp({props:a}),r[39](l),{c(){e=D("div"),S(t.$$.fragment),n=R(),o&&o.c(),i=R(),S(l.$$.fragment),w(e,"class","container svelte-xmd5g6")},m(f,c){$(f,e,c),A(t,e,null),N(e,n),o&&o.m(e,null),r[30](e),$(f,i,c),A(l,f,c),s=!0},p(f,c){var g;r=f;const p={};c[0]&16384&&(p.value=r[14]),c[0]&16384&&(p.options=[r[14]]),t.$set(p),((g=r[1])==null?void 0:g.type)==="query"?o?(o.p(r,c),c[0]&2&&m(o,1)):(o=v6(r),o.c(),m(o,1),o.m(e,null)):o&&(te(),_(o,1,1,()=>{o=null}),ne());const d={};c[0]&8&&(d.anchor=r[3]),c[0]&16262|c[2]&32&&(d.$$scope={dirty:c,ctx:r}),l.$set(d)},i(f){s||(m(t.$$.fragment,f),m(o),m(l.$$.fragment,f),s=!0)},o(f){_(t.$$.fragment,f),_(o),_(l.$$.fragment,f),s=!1},d(f){f&&b(e),E(t),o&&o.d(),r[30](null),f&&b(i),r[39](null),E(l,f)}}}function Aee(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,v,k;ue(r,en,me=>t(40,p=me)),ue(r,kn,me=>t(23,d=me)),ue(r,Ql,me=>t(41,g=me)),ue(r,He,me=>t(24,h=me)),ue(r,un,me=>t(25,v=me)),ue(r,Ot,me=>t(26,k=me));let{value:C={}}=e,{otherSources:I}=e,{showAllQueries:O}=e,{bindings:T=[]}=e;const P=ht(),M=["attachment","array"];let F,j,z,q;const H=me=>{P("change",me),j.hide()},Y=me=>{const ke=p.list.find(ze=>ze._id===me.datasourceId).source;return g[ke].query[me.queryVerb]},U=me=>{var ke;return((ke=d.list.find(ze=>ze._id===(me==null?void 0:me._id)))==null?void 0:ke.parameters)||[]},W=me=>p.list.find(ke=>ke._id===(me==null?void 0:me.datasourceId)),G=()=>{t(6,q=C.queryParams),z.show()},Q=()=>{H(lt(Se({},C),{queryParams:q})),z.hide()};function fe(me){q=me,t(6,q)}function Z(me){T=me,t(0,T)}function ee(me){K[me?"unshift":"push"](()=>{z=me,t(5,z)})}function ae(me){K[me?"unshift":"push"](()=>{F=me,t(3,F)})}const _e=me=>H(me),Re=me=>H(me),$e=me=>H(me),be=me=>H(me),he=me=>H(me),Ne=me=>H(me),Fe=me=>H(me),se=me=>H(me);function Ce(me){K[me?"unshift":"push"](()=>{j=me,t(4,j)})}return r.$$set=me=>{"value"in me&&t(1,C=me.value),"otherSources"in me&&t(2,I=me.otherSources),"showAllQueries"in me&&t(21,O=me.showAllQueries),"bindings"in me&&t(0,T=me.bindings)},r.$$.update=()=>{var me;r.$$.dirty[0]&2&&t(14,n=(me=C==null?void 0:C.label)!=null?me:"Choose an option"),r.$$.dirty[0]&67108864&&t(13,i=k.list.map(ke=>({label:ke.name,tableId:ke._id,type:"table"}))),r.$$.dirty[0]&67108864&&t(12,l=k.list.reduce((ke,ze)=>{let ye=Object.entries(ze.views||{}).map(([Je,Nt])=>lt(Se({label:Je,name:Je},Nt),{type:"view"}));return[...ke,...ye]},[])),r.$$.dirty[0]&10485760&&t(11,s=d.list.filter(ke=>O||ke.queryVerb==="read"||ke.readable).map(ke=>lt(Se({label:ke.name,name:ke.name,tableId:ke._id},ke),{type:"query"}))),r.$$.dirty[0]&50331648&&t(22,o=go(v,h.selectedComponentId)),r.$$.dirty[0]&4194304&&t(10,a=o.filter(ke=>{var ze;return(ze=ke._component)==null?void 0:ze.endsWith("/dataprovider")}).map(ke=>({label:ke._instanceName,name:ke._instanceName,providerId:ke._id,value:`{{ literal ${$n(ke._id)} }}`,type:"provider"}))),r.$$.dirty[0]&1&&t(9,u=T.filter(ke=>{var ze;return((ze=ke.fieldSchema)==null?void 0:ze.type)==="link"}).map(ke=>{const{providerId:ze,readableBinding:ye,fieldSchema:Je}=ke||{},{name:Nt,tableId:qe}=Je||{},pt=$n(ze);return{providerId:ze,label:ye,fieldName:Nt,tableId:qe,type:"link",rowId:`{{ ${pt}.${$n("_id")} }}`,rowTableId:`{{ ${pt}.${$n("tableId")} }}`}})),r.$$.dirty[0]&1&&t(8,f=T.filter(ke=>{var ze;return M.includes((ze=ke.fieldSchema)==null?void 0:ze.type)}).map(ke=>{const{providerId:ze,readableBinding:ye,runtimeBinding:Je}=ke,{name:Nt,type:qe,tableId:pt}=ke.fieldSchema;return{providerId:ze,label:ye,fieldName:Nt,fieldType:qe,tableId:pt,type:"field",value:`{{ literal ${Je} }}`}})),r.$$.dirty[0]&1&&t(7,c=T.filter(ke=>{var ze;return((ze=ke.fieldSchema)==null?void 0:ze.type)==="jsonarray"}).map(ke=>{const{providerId:ze,readableBinding:ye,runtimeBinding:Je,tableId:Nt}=ke,{name:qe,type:pt,prefixKeys:Rt}=ke.fieldSchema;return{providerId:ze,label:ye,fieldName:qe,fieldType:pt,tableId:Nt,prefixKeys:Rt,type:"jsonarray",value:`{{ literal ${Je} }}`}}))},[T,C,I,F,j,z,q,c,f,u,a,s,l,i,n,H,Y,U,W,G,Q,O,o,d,h,v,k,fe,Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se,Ce]}class j6 extends ie{constructor(e){super();le(this,e,Aee,See,re,{value:1,otherSources:2,showAllQueries:21,bindings:0},null,[-1,-1,-1])}}function Eee(r){let e,t;return e=new Xe({props:{options:r[1],value:r[0]}}),e.$on("change",r[3]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.options=n[1]),i&1&&(l.value=n[0]),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 Oee(r,e,t){let n,i;ue(r,en,o=>t(2,i=o));let{value:l=null}=e;function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,l=o.value)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=i.list.filter(o=>{var a;return o.source==="S3"&&!((a=o.config)==null?void 0:a.endpoint)}).map(o=>({label:o.name,value:o._id})))},[l,n,i,s]}class Tee extends ie{constructor(e){super();le(this,e,Oee,Eee,re,{value:0})}}function Iee(r){let e,t;return e=new Xe({props:{value:r[0],placeholder:null,options:r[1],getOptionLabel:Lee,getOptionValue:r[2]}}),e.$on("change",r[6]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.value=n[0]),i&2&&(l.options=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)}}}const Lee=r=>r._instanceName;function Pee(r,e,t){let n,i,l,s;ue(r,He,c=>t(4,l=c)),ue(r,un,c=>t(5,s=c));let{value:o}=e;const a=ht(),u=c=>`{{ literal ${$n(c._id)} }}`;Gt(()=>{!(o&&i.find(p=>u(p)===o)!=null)&&i.length&&a("change",u(i[i.length-1]))});function f(c){ft.call(this,r,c)}return r.$$set=c=>{"value"in c&&t(0,o=c.value)},r.$$.update=()=>{r.$$.dirty&48&&t(3,n=Sl(s==null?void 0:s.props,l.selectedComponentId)),r.$$.dirty&8&&t(1,i=n.filter(c=>{var p;return(p=c._component)==null?void 0:p.endsWith("/dataprovider")}))},[o,i,u,n,l,s,f]}class Nee extends ie{constructor(e){super();le(this,e,Pee,Iee,re,{value:0})}}function Ree(r){let e;return{c(){e=V("Screen")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Mee(r){let e,t,n,i,l,s,o,a,u,f;t=new Ze({props:{small:!0,$$slots:{default:[Ree]},$$scope:{ctx:r}}}),i=new Un({props:{title:"Destination URL",placeholder:"/screen",value:r[0].url,bindings:r[1]}}),i.$on("change",r[2]);function c(d){r[3](d)}let p={text:"Open screen in modal"};return r[0].peek!==void 0&&(p.value=r[0].peek),a=new Zr({props:p}),K.push(()=>ce(a,"value",c)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),l=R(),s=D("div"),o=R(),S(a.$$.fragment),w(e,"class","root svelte-15fuuda")},m(d,g){$(d,e,g),A(t,e,null),N(e,n),A(i,e,null),N(e,l),N(e,s),N(e,o),A(a,e,null),f=!0},p(d,[g]){const h={};g&16&&(h.$$scope={dirty:g,ctx:d}),t.$set(h);const v={};g&1&&(v.value=d[0].url),g&2&&(v.bindings=d[1]),i.$set(v);const k={};!u&&g&1&&(u=!0,k.value=d[0].peek,pe(()=>u=!1)),a.$set(k)},i(d){f||(m(t.$$.fragment,d),m(i.$$.fragment,d),m(a.$$.fragment,d),f=!0)},o(d){_(t.$$.fragment,d),_(i.$$.fragment,d),_(a.$$.fragment,d),f=!1},d(d){d&&b(e),E(t),E(i),E(a)}}}function Dee(r,e,t){let{parameters:n}=e,{bindings:i=[]}=e;const l=o=>t(0,n.url=o.detail,n);function s(o){r.$$.not_equal(n.peek,o)&&(n.peek=o,t(0,n))}return r.$$set=o=>{"parameters"in o&&t(0,n=o.parameters),"bindings"in o&&t(1,i=o.bindings)},[n,i,l,s]}class jee extends ie{constructor(e){super();le(this,e,Dee,Mee,re,{parameters:0,bindings:1})}}function B6(r,e,t){const n=r.slice();return n[16]=e[t],n[18]=t,n}function z6(r){let e,t,n,i,l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=q6(B6(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return n=new gt({props:{icon:"AddCircle",secondary:!0,$$slots:{default:[Fee]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){for(let a=0;a<s.length;a+=1)s[a].c();e=R(),t=D("div"),S(n.$$.fragment),zt(t,"margin-top","10px")},m(a,u){for(let f=0;f<s.length;f+=1)s[f].m(a,u);$(a,e,u),$(a,t,u),A(n,t,null),i=!0},p(a,u){if(u&479){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=B6(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=q6(p),s[c].c(),m(s[c],1),s[c].m(e.parentNode,e))}for(te(),c=l.length;c<s.length;c+=1)o(c);ne()}const f={};u&524290&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){if(!i){for(let u=0;u<l.length;u+=1)m(s[u]);m(n.$$.fragment,a),i=!0}},o(a){s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);_(n.$$.fragment,a),i=!1},d(a){$t(s,a),a&&b(e),a&&b(t),E(n)}}}function Bee(r){let e;return{c(){e=V(r[1])},m(t,n){$(t,e,n)},p(t,n){n&2&&Te(e,t[1])},d(t){t&&b(e)}}}function zee(r){let e,t;function n(...i){return r[11](r[18],...i)}return e=new tt({props:{thin:!0,secondary:!0,value:r[16][0]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),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 qee(r){let e,t;function n(...i){return r[10](r[18],...i)}return e=new Xe({props:{value:r[16][0],options:r[0].map(U6)}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),l&1&&(s.options=r[0].map(U6)),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 Uee(r){let e;return{c(){e=V(r[2])},m(t,n){$(t,e,n)},p(t,n){n&4&&Te(e,t[2])},d(t){t&&b(e)}}}function q6(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ze({props:{small:!0,$$slots:{default:[Bee]},$$scope:{ctx:r}}});const p=[qee,zee],d=[];function g(k,C){return k[0]?0:1}n=g(r),i=d[n]=p[n](r),s=new Ze({props:{small:!0,$$slots:{default:[Uee]},$$scope:{ctx:r}}});function h(...k){return r[12](r[18],...k)}a=new Un({props:{title:`Value for "${r[16][0]}"`,value:r[16][1],bindings:r[3]}}),a.$on("change",h);function v(){return r[13](r[16])}return f=new Jt({props:{size:"S",quiet:!0,icon:"Delete"}}),f.$on("click",v),{c(){S(e.$$.fragment),t=R(),i.c(),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),u=R(),S(f.$$.fragment)},m(k,C){A(e,k,C),$(k,t,C),d[n].m(k,C),$(k,l,C),A(s,k,C),$(k,o,C),A(a,k,C),$(k,u,C),A(f,k,C),c=!0},p(k,C){r=k;const I={};C&524290&&(I.$$scope={dirty:C,ctx:r}),e.$set(I);let O=n;n=g(r),n===O?d[n].p(r,C):(te(),_(d[O],1,1,()=>{d[O]=null}),ne(),i=d[n],i?i.p(r,C):(i=d[n]=p[n](r),i.c()),m(i,1),i.m(l.parentNode,l));const T={};C&524292&&(T.$$scope={dirty:C,ctx:r}),s.$set(T);const P={};C&16&&(P.title=`Value for "${r[16][0]}"`),C&16&&(P.value=r[16][1]),C&8&&(P.bindings=r[3]),a.$set(P)},i(k){c||(m(e.$$.fragment,k),m(i),m(s.$$.fragment,k),m(a.$$.fragment,k),m(f.$$.fragment,k),c=!0)},o(k){_(e.$$.fragment,k),_(i),_(s.$$.fragment,k),_(a.$$.fragment,k),_(f.$$.fragment,k),c=!1},d(k){E(e,k),k&&b(t),d[n].d(k),k&&b(l),E(s,k),k&&b(o),E(a,k),k&&b(u),E(f,k)}}}function Fee(r){let e,t;return{c(){e=V(`Add
|
|
1216
1216
|
`),t=V(r[1])},m(n,i){$(n,e,i),$(n,t,i)},p(n,i){i&2&&Te(t,n[1])},d(n){n&&b(e),n&&b(t)}}}function Vee(r){let e,t,n=r[4]&&z6(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[4]?n?(n.p(i,l),l&16&&m(n,1)):(n=z6(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}const U6=r=>r.name;function Hee(r,e,t){const n=ht();let{parameterFields:i}=e,{schemaFields:l}=e,{fieldLabel:s="Column"}=e,{valueLabel:o="Value"}=e,{bindings:a=[]}=e,u=Object.entries(i||{});const f=()=>{t(4,u=[...u.filter(I=>I[0]),["",""]])},c=I=>{t(4,u=u.filter(O=>O[0]!==I))},p=(I,O)=>{t(4,u[I][1]=O,u),t(4,u)},d=(I,O)=>{t(4,u[I][0]=O,u),t(4,u)},g=I=>{const O={};I.filter(T=>T[0]).forEach(([T,P])=>{O[T]=P}),n("change",O)},h=(I,O)=>d(I,O.detail),v=(I,O)=>d(I,O.detail),k=(I,O)=>p(I,O.detail),C=I=>c(I[0]);return r.$$set=I=>{"parameterFields"in I&&t(9,i=I.parameterFields),"schemaFields"in I&&t(0,l=I.schemaFields),"fieldLabel"in I&&t(1,s=I.fieldLabel),"valueLabel"in I&&t(2,o=I.valueLabel),"bindings"in I&&t(3,a=I.bindings)},r.$$.update=()=>{r.$$.dirty&16&&g(u)},[l,s,o,a,u,f,c,p,d,i,h,v,k,C]}class A1 extends ie{constructor(e){super();le(this,e,Hee,Vee,re,{parameterFields:9,schemaFields:0,fieldLabel:1,valueLabel:2,bindings:3})}}function Wee(r){let e,t,n;return{c(){e=V(`Choosing a Data Source will automatically use the data it provides, but it's
|
|
1217
1217
|
optional.`),t=D("br"),n=V(`
|
|
1218
1218
|
You can always add or override fields manually.`)},m(i,l){$(i,e,l),$(i,t,l),$(i,n,l)},d(i){i&&b(e),i&&b(t),i&&b(n)}}}function Gee(r){let e;return{c(){e=V("Data Source")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Yee(r){let e;return{c(){e=V("Table")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function F6(r){let e,t,n,i,l;e=new Ze({props:{small:!0,$$slots:{default:[Jee]},$$scope:{ctx:r}}});function s(a){r[14](a)}let o={placeholder:"Are you sure you want to save this row?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new tt({props:o}),K.push(()=>ce(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&262144&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0].confirmText,pe(()=>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 Jee(r){let e;return{c(){e=V("Confirm text")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function V6(r){let e,t,n;return t=new A1({props:{parameterFields:r[0].fields,schemaFields:r[3],bindings:r[1]}}),t.$on("change",r[5]),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","fields svelte-2gvxnz")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.parameterFields=i[0].fields),l&8&&(s.schemaFields=i[3]),l&2&&(s.bindings=i[1]),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 Qee(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T;t=new Ke({props:{size:"S",$$slots:{default:[Wee]},$$scope:{ctx:r}}}),l=new Ze({props:{small:!0,$$slots:{default:[Gee]},$$scope:{ctx:r}}});function P(U){r[11](U)}let M={options:r[4],placeholder:"None"};r[0].providerId!==void 0&&(M.value=r[0].providerId),o=new Xe({props:M}),K.push(()=>ce(o,"value",P)),f=new Ze({props:{small:!0,$$slots:{default:[Yee]},$$scope:{ctx:r}}});function F(U){r[12](U)}let j={options:r[2],getOptionLabel:Xee,getOptionValue:Kee};r[0].tableId!==void 0&&(j.value=r[0].tableId),p=new Xe({props:j}),K.push(()=>ce(p,"value",F)),h=new Ze({props:{small:!0}});function z(U){r[13](U)}let q={text:"Require confirmation"};r[0].confirm!==void 0&&(q.value=r[0].confirm),k=new Zr({props:q}),K.push(()=>ce(k,"value",z));let H=r[0].confirm&&F6(r),Y=r[0].tableId&&V6(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),s=R(),S(o.$$.fragment),u=R(),S(f.$$.fragment),c=R(),S(p.$$.fragment),g=R(),S(h.$$.fragment),v=R(),S(k.$$.fragment),I=R(),H&&H.c(),O=R(),Y&&Y.c(),w(i,"class","params svelte-2gvxnz"),w(e,"class","root svelte-2gvxnz")},m(U,W){$(U,e,W),A(t,e,null),N(e,n),N(e,i),A(l,i,null),N(i,s),A(o,i,null),N(i,u),A(f,i,null),N(i,c),A(p,i,null),N(i,g),A(h,i,null),N(i,v),A(k,i,null),N(i,I),H&&H.m(i,null),N(e,O),Y&&Y.m(e,null),T=!0},p(U,[W]){const G={};W&262144&&(G.$$scope={dirty:W,ctx:U}),t.$set(G);const Q={};W&262144&&(Q.$$scope={dirty:W,ctx:U}),l.$set(Q);const fe={};W&16&&(fe.options=U[4]),!a&&W&1&&(a=!0,fe.value=U[0].providerId,pe(()=>a=!1)),o.$set(fe);const Z={};W&262144&&(Z.$$scope={dirty:W,ctx:U}),f.$set(Z);const ee={};W&4&&(ee.options=U[2]),!d&&W&1&&(d=!0,ee.value=U[0].tableId,pe(()=>d=!1)),p.$set(ee);const ae={};!C&&W&1&&(C=!0,ae.value=U[0].confirm,pe(()=>C=!1)),k.$set(ae),U[0].confirm?H?(H.p(U,W),W&1&&m(H,1)):(H=F6(U),H.c(),m(H,1),H.m(i,null)):H&&(te(),_(H,1,1,()=>{H=null}),ne()),U[0].tableId?Y?(Y.p(U,W),W&1&&m(Y,1)):(Y=V6(U),Y.c(),m(Y,1),Y.m(e,null)):Y&&(te(),_(Y,1,1,()=>{Y=null}),ne())},i(U){T||(m(t.$$.fragment,U),m(l.$$.fragment,U),m(o.$$.fragment,U),m(f.$$.fragment,U),m(p.$$.fragment,U),m(h.$$.fragment,U),m(k.$$.fragment,U),m(H),m(Y),T=!0)},o(U){_(t.$$.fragment,U),_(l.$$.fragment,U),_(o.$$.fragment,U),_(f.$$.fragment,U),_(p.$$.fragment,U),_(h.$$.fragment,U),_(k.$$.fragment,U),_(H),_(Y),T=!1},d(U){U&&b(e),E(t),E(l),E(o),E(f),E(p),E(h),E(k),H&&H.d(),Y&&Y.d()}}}const Xee=r=>r.name,Kee=r=>r._id;function Zee(r,e,t){let n,i,l,s,o,a,u,f;ue(r,Ot,T=>t(8,a=T)),ue(r,un,T=>t(9,u=T)),ue(r,He,T=>t(10,f=T));let{parameters:c}=e,{bindings:p=[]}=e;const d=(T,P)=>{const M=He.actions.components.getDefinition(T==null?void 0:T._component);return M?(Array.isArray(M.context)?M.context:[M.context]).find(j=>(j==null?void 0:j.type)===P):null},g=(T,P)=>{const M=T.map(z=>({component:z,context:d(z,"form")})),F=P.map(z=>({component:z,context:d(z,"schema")}));return M.concat(F).map(({component:z,context:q})=>{let H=z._id;return q.suffix&&(H+=`-${q.suffix}`),{label:z._instanceName,value:H}})},h=(T,P)=>{const{schema:M}=Jf(P);return Object.values(M||{})},v=T=>{t(0,c.fields=T.detail,c)};function k(T){r.$$.not_equal(c.providerId,T)&&(c.providerId=T,t(0,c))}function C(T){r.$$.not_equal(c.tableId,T)&&(c.tableId=T,t(0,c))}function I(T){r.$$.not_equal(c.confirm,T)&&(c.confirm=T,t(0,c))}function O(T){r.$$.not_equal(c.confirmText,T)&&(c.confirmText=T,t(0,c))}return r.$$set=T=>{"parameters"in T&&t(0,c=T.parameters),"bindings"in T&&t(1,p=T.bindings)},r.$$.update=()=>{r.$$.dirty&1536&&t(7,n=go(u,f.selectedComponentId,"form")),r.$$.dirty&1536&&t(6,i=go(u,f.selectedComponentId,"schema")),r.$$.dirty&192&&t(4,l=g(n,i)),r.$$.dirty&513&&t(3,s=h(u,c==null?void 0:c.tableId)),r.$$.dirty&256&&t(2,o=a.list||[])},[c,p,o,s,l,v,i,n,a,u,f,k,C,I,O]}class xee extends ie{constructor(e){super();le(this,e,Zee,Qee,re,{parameters:0,bindings:1})}}function ete(r){let e;return{c(){e=V("Table")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function tte(r){let e;return{c(){e=V("Row ID")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function nte(r){let e;return{c(){e=V("Row Rev")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function H6(r){let e,t,n,i,l;e=new Ze({props:{small:!0,$$slots:{default:[rte]},$$scope:{ctx:r}}});function s(a){r[8](a)}let o={placeholder:"Are you sure you want to delete this row?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new tt({props:o}),K.push(()=>ce(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].confirmText,pe(()=>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 rte(r){let e;return{c(){e=V("Confirm text")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ite(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O;t=new Ze({props:{$$slots:{default:[ete]},$$scope:{ctx:r}}});function T(z){r[4](z)}let P={options:r[2],getOptionLabel:lte,getOptionValue:ste};r[0].tableId!==void 0&&(P.value=r[0].tableId),i=new Xe({props:P}),K.push(()=>ce(i,"value",T)),o=new Ze({props:{small:!0,$$slots:{default:[tte]},$$scope:{ctx:r}}}),u=new Un({props:{bindings:r[1],title:"Row ID to delete",value:r[0].rowId}}),u.$on("change",r[5]),c=new Ze({props:{small:!0,$$slots:{default:[nte]},$$scope:{ctx:r}}}),d=new Un({props:{bindings:r[1],title:"Row rev to delete",value:r[0].revId}}),d.$on("change",r[6]),h=new Ze({props:{small:!0}});function M(z){r[7](z)}let F={text:"Require confirmation"};r[0].confirm!==void 0&&(F.value=r[0].confirm),k=new Zr({props:F}),K.push(()=>ce(k,"value",M));let j=r[0].confirm&&H6(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),S(o.$$.fragment),a=R(),S(u.$$.fragment),f=R(),S(c.$$.fragment),p=R(),S(d.$$.fragment),g=R(),S(h.$$.fragment),v=R(),S(k.$$.fragment),I=R(),j&&j.c(),w(e,"class","root svelte-dlpmjc")},m(z,q){$(z,e,q),A(t,e,null),N(e,n),A(i,e,null),N(e,s),A(o,e,null),N(e,a),A(u,e,null),N(e,f),A(c,e,null),N(e,p),A(d,e,null),N(e,g),A(h,e,null),N(e,v),A(k,e,null),N(e,I),j&&j.m(e,null),O=!0},p(z,[q]){const H={};q&512&&(H.$$scope={dirty:q,ctx:z}),t.$set(H);const Y={};q&4&&(Y.options=z[2]),!l&&q&1&&(l=!0,Y.value=z[0].tableId,pe(()=>l=!1)),i.$set(Y);const U={};q&512&&(U.$$scope={dirty:q,ctx:z}),o.$set(U);const W={};q&2&&(W.bindings=z[1]),q&1&&(W.value=z[0].rowId),u.$set(W);const G={};q&512&&(G.$$scope={dirty:q,ctx:z}),c.$set(G);const Q={};q&2&&(Q.bindings=z[1]),q&1&&(Q.value=z[0].revId),d.$set(Q);const fe={};!C&&q&1&&(C=!0,fe.value=z[0].confirm,pe(()=>C=!1)),k.$set(fe),z[0].confirm?j?(j.p(z,q),q&1&&m(j,1)):(j=H6(z),j.c(),m(j,1),j.m(e,null)):j&&(te(),_(j,1,1,()=>{j=null}),ne())},i(z){O||(m(t.$$.fragment,z),m(i.$$.fragment,z),m(o.$$.fragment,z),m(u.$$.fragment,z),m(c.$$.fragment,z),m(d.$$.fragment,z),m(h.$$.fragment,z),m(k.$$.fragment,z),m(j),O=!0)},o(z){_(t.$$.fragment,z),_(i.$$.fragment,z),_(o.$$.fragment,z),_(u.$$.fragment,z),_(c.$$.fragment,z),_(d.$$.fragment,z),_(h.$$.fragment,z),_(k.$$.fragment,z),_(j),O=!1},d(z){z&&b(e),E(t),E(i),E(o),E(u),E(c),E(d),E(h),E(k),j&&j.d()}}}const lte=r=>r.name,ste=r=>r._id;function ote(r,e,t){let n,i;ue(r,Ot,p=>t(3,i=p));let{parameters:l}=e,{bindings:s=[]}=e;function o(p){r.$$.not_equal(l.tableId,p)&&(l.tableId=p,t(0,l))}const a=p=>t(0,l.rowId=p.detail,l),u=p=>t(0,l.revId=p.detail,l);function f(p){r.$$.not_equal(l.confirm,p)&&(l.confirm=p,t(0,l))}function c(p){r.$$.not_equal(l.confirmText,p)&&(l.confirmText=p,t(0,l))}return r.$$set=p=>{"parameters"in p&&t(0,l=p.parameters),"bindings"in p&&t(1,s=p.bindings)},r.$$.update=()=>{r.$$.dirty&8&&t(2,n=i.list||[])},[l,s,n,i,o,a,u,f,c]}class ate extends ie{constructor(e){super();le(this,e,ote,ite,re,{parameters:0,bindings:1})}}function W6(r){let e,t,n,i,l;function s(u){r[9](u)}let o={label:"Query",options:r[3].list.filter(r[8]),getOptionLabel:dte,getOptionValue:mte};r[0].queryId!==void 0&&(o.value=r[0].queryId),e=new Xe({props:o}),K.push(()=>ce(e,"value",s));let a=r[0].queryId&&G6(r);return{c(){S(e.$$.fragment),n=R(),a&&a.c(),i=Ee()},m(u,f){A(e,u,f),$(u,n,f),a&&a.m(u,f),$(u,i,f),l=!0},p(u,f){const c={};f&24&&(c.options=u[3].list.filter(u[8])),!t&&f&1&&(t=!0,c.value=u[0].queryId,pe(()=>t=!1)),e.$set(c),u[0].queryId?a?(a.p(u,f),f&1&&m(a,1)):(a=G6(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){E(e,u),u&&b(n),a&&a.d(u),u&&b(i)}}}function G6(r){var c,p;let e,t,n,i,l,s;function o(d){r[10](d)}let a={text:"Require confirmation"};r[0].confirm!==void 0&&(a.value=r[0].confirm),e=new Zr({props:a}),K.push(()=>ce(e,"value",o));let u=r[0].confirm&&Y6(r),f=((p=(c=r[5])==null?void 0:c.parameters)==null?void 0:p.length)>0&&J6(r);return{c(){S(e.$$.fragment),n=R(),u&&u.c(),i=R(),f&&f.c(),l=Ee()},m(d,g){A(e,d,g),$(d,n,g),u&&u.m(d,g),$(d,i,g),f&&f.m(d,g),$(d,l,g),s=!0},p(d,g){var v,k;const h={};!t&&g&1&&(t=!0,h.value=d[0].confirm,pe(()=>t=!1)),e.$set(h),d[0].confirm?u?(u.p(d,g),g&1&&m(u,1)):(u=Y6(d),u.c(),m(u,1),u.m(i.parentNode,i)):u&&(te(),_(u,1,1,()=>{u=null}),ne()),((k=(v=d[5])==null?void 0:v.parameters)==null?void 0:k.length)>0?f?(f.p(d,g),g&32&&m(f,1)):(f=J6(d),f.c(),m(f,1),f.m(l.parentNode,l)):f&&(te(),_(f,1,1,()=>{f=null}),ne())},i(d){s||(m(e.$$.fragment,d),m(u),m(f),s=!0)},o(d){_(e.$$.fragment,d),_(u),_(f),s=!1},d(d){E(e,d),d&&b(n),u&&u.d(d),d&&b(i),f&&f.d(d),d&&b(l)}}}function Y6(r){let e,t,n;function i(s){r[11](s)}let l={label:"Confirm text",placeholder:"Are you sure you want to execute this query?"};return r[0].confirmText!==void 0&&(l.value=r[0].confirmText),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].confirmText,pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function J6(r){let e,t,n,i,l,s,o;function a(c){r[12](c)}function u(c){r[13](c)}let f={queryBindings:r[5].parameters};return r[0].queryParams!==void 0&&(f.customParams=r[0].queryParams),r[1]!==void 0&&(f.bindings=r[1]),t=new v1({props:f}),K.push(()=>ce(t,"customParams",a)),K.push(()=>ce(t,"bindings",u)),s=new m1({props:{height:200,query:r[5],schema:r[6](r[5]),editable:!1,datasource:r[4]}}),{c(){e=D("div"),S(t.$$.fragment),l=R(),S(s.$$.fragment),w(e,"class","params svelte-s3zryk")},m(c,p){$(c,e,p),A(t,e,null),N(e,l),A(s,e,null),o=!0},p(c,p){const d={};p&32&&(d.queryBindings=c[5].parameters),!n&&p&1&&(n=!0,d.customParams=c[0].queryParams,pe(()=>n=!1)),!i&&p&2&&(i=!0,d.bindings=c[1],pe(()=>i=!1)),t.$set(d);const g={};p&32&&(g.query=c[5]),p&32&&(g.schema=c[6](c[5])),p&16&&(g.datasource=c[4]),s.$set(g)},i(c){o||(m(t.$$.fragment,c),m(s.$$.fragment,c),o=!0)},o(c){_(t.$$.fragment,c),_(s.$$.fragment,c),o=!1},d(c){c&&b(e),E(t),E(s)}}}function ute(r){let e,t,n,i,l;function s(u){r[7](u)}let o={label:"Datasource",options:r[2].list,getOptionLabel:cte,getOptionValue:pte};r[0].datasourceId!==void 0&&(o.value=r[0].datasourceId),e=new Xe({props:o}),K.push(()=>ce(e,"value",s));let a=r[0].datasourceId&&W6(r);return{c(){S(e.$$.fragment),n=R(),a&&a.c(),i=Ee()},m(u,f){A(e,u,f),$(u,n,f),a&&a.m(u,f),$(u,i,f),l=!0},p(u,f){const c={};f&4&&(c.options=u[2].list),!t&&f&1&&(t=!0,c.value=u[0].datasourceId,pe(()=>t=!1)),e.$set(c),u[0].datasourceId?a?(a.p(u,f),f&1&&m(a,1)):(a=W6(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){E(e,u),u&&b(n),a&&a.d(u),u&&b(i)}}}function fte(r){let e,t;return e=new Qe({props:{gap:"XS",noPadding:!0,$$slots:{default:[ute]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&32831&&(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)}}}const cte=r=>r.name,pte=r=>r._id,dte=r=>r.name,mte=r=>r._id;function gte(r,e,t){let n,i,l,s,o;ue(r,Ql,C=>t(14,l=C)),ue(r,en,C=>t(2,s=C)),ue(r,kn,C=>t(3,o=C));let{parameters:a}=e,{bindings:u=[]}=e;function f(C){const I=s.list.find(O=>O._id===C.datasourceId).source;return l[I].query[C.queryVerb]}function c(C){r.$$.not_equal(a.datasourceId,C)&&(a.datasourceId=C,t(0,a))}const p=C=>C.datasourceId===i._id;function d(C){r.$$.not_equal(a.queryId,C)&&(a.queryId=C,t(0,a))}function g(C){r.$$.not_equal(a.confirm,C)&&(a.confirm=C,t(0,a))}function h(C){r.$$.not_equal(a.confirmText,C)&&(a.confirmText=C,t(0,a))}function v(C){r.$$.not_equal(a.queryParams,C)&&(a.queryParams=C,t(0,a))}function k(C){u=C,t(1,u)}return r.$$set=C=>{"parameters"in C&&t(0,a=C.parameters),"bindings"in C&&t(1,u=C.bindings)},r.$$.update=()=>{r.$$.dirty&9&&t(5,n=o.list.find(C=>C._id===a.queryId)),r.$$.dirty&5&&t(4,i=s.list.find(C=>C._id===a.datasourceId))},[a,u,s,o,i,n,f,c,p,d,g,h,v,k]}class _te extends ie{constructor(e){super();le(this,e,gte,fte,re,{parameters:0,bindings:1})}}function hte(r){let e;return{c(){e=V("Create a new automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function $te(r){let e;return{c(){e=V("Use an existing automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function bte(r){let e;return{c(){e=V("Automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function vte(r){let e,t,n;function i(s){r[16](s)}let l={placeholder:"Enter automation name"};return r[0].newAutomationName!==void 0&&(l.value=r[0].newAutomationName),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].newAutomationName,pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function wte(r){let e,t,n;function i(s){r[15](s)}let l={placeholder:"Choose automation",options:r[2],getOptionLabel:Cte,getOptionValue:Ste};return r[0].automationId!==void 0&&(l.value=r[0].automationId),e=new Xe({props:l}),K.push(()=>ce(e,"value",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o&4&&(a.options=s[2]),!t&&o&1&&(t=!0,a.value=s[0].automationId,pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Q6(r){let e,t,n,i,l;e=new Ze({props:{small:!0,$$slots:{default:[yte]},$$scope:{ctx:r}}});function s(a){r[18](a)}let o={placeholder:"Are you sure you want to trigger this automation?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new tt({props:o}),K.push(()=>ce(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&524288&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0].confirmText,pe(()=>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 yte(r){let e;return{c(){e=V("Confirm text")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function X6(r){let e,t;return e=new A1({props:{schemaFields:r[4],parameterFields:r[0].fields,fieldLabel:"Field",bindings:r[1]}}),e.$on("change",r[7]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.schemaFields=n[4]),i&1&&(l.parameterFields=n[0].fields),i&2&&(l.bindings=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 kte(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q=r[0].automationId,H,Y,U;s=new Ze({props:{small:!0,$$slots:{default:[hte]},$$scope:{ctx:r}}}),p=new Ze({props:{small:!0,grey:!r[5],$$slots:{default:[$te]},$$scope:{ctx:r}}}),h=new Ze({props:{small:!0,$$slots:{default:[bte]},$$scope:{ctx:r}}});const W=[wte,vte],G=[];function Q(_e,Re){return _e[3]===_e[6].EXISTING?0:1}k=Q(r),C=G[k]=W[k](r),O=new Ze({props:{small:!0}});function fe(_e){r[17](_e)}let Z={text:"Require confirmation"};r[0].confirm!==void 0&&(Z.value=r[0].confirm),P=new Zr({props:Z}),K.push(()=>ce(P,"value",fe));let ee=r[0].confirm&&Q6(r),ae=X6(r);return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("input"),l=R(),S(s.$$.fragment),o=R(),a=D("div"),u=D("input"),c=R(),S(p.$$.fragment),d=R(),g=D("div"),S(h.$$.fragment),v=R(),C.c(),I=R(),S(O.$$.fragment),T=R(),S(P.$$.fragment),F=R(),ee&&ee.c(),j=R(),z=D("div"),ae.c(),w(i,"type","radio"),i.__value=r[6].NEW,i.value=i.__value,w(i,"class","svelte-zdxuks"),r[13][0].push(i),w(n,"class","radio-container svelte-zdxuks"),w(u,"type","radio"),u.__value=r[6].EXISTING,u.value=u.__value,u.disabled=f=!r[5],w(u,"class","svelte-zdxuks"),r[13][0].push(u),w(a,"class","radio-container svelte-zdxuks"),w(t,"class","radios svelte-zdxuks"),w(g,"class","params svelte-zdxuks"),w(z,"class","fields svelte-zdxuks"),w(e,"class","root svelte-zdxuks")},m(_e,Re){$(_e,e,Re),N(e,t),N(t,n),N(n,i),i.checked=i.__value===r[3],N(n,l),A(s,n,null),N(t,o),N(t,a),N(a,u),u.checked=u.__value===r[3],N(a,c),A(p,a,null),N(e,d),N(e,g),A(h,g,null),N(g,v),G[k].m(g,null),N(g,I),A(O,g,null),N(g,T),A(P,g,null),N(g,F),ee&&ee.m(g,null),N(e,j),N(e,z),ae.m(z,null),H=!0,Y||(U=[Pe(i,"change",r[12]),Pe(n,"click",r[8]),Pe(u,"change",r[14]),Pe(a,"click",function(){mt(r[5]?r[9]:null)&&(r[5]?r[9]:null).apply(this,arguments)})],Y=!0)},p(_e,[Re]){r=_e,Re&8&&(i.checked=i.__value===r[3]);const $e={};Re&524288&&($e.$$scope={dirty:Re,ctx:r}),s.$set($e),(!H||Re&32&&f!==(f=!r[5]))&&(u.disabled=f),Re&8&&(u.checked=u.__value===r[3]);const be={};Re&32&&(be.grey=!r[5]),Re&524288&&(be.$$scope={dirty:Re,ctx:r}),p.$set(be);const he={};Re&524288&&(he.$$scope={dirty:Re,ctx:r}),h.$set(he);let Ne=k;k=Q(r),k===Ne?G[k].p(r,Re):(te(),_(G[Ne],1,1,()=>{G[Ne]=null}),ne(),C=G[k],C?C.p(r,Re):(C=G[k]=W[k](r),C.c()),m(C,1),C.m(g,I));const Fe={};!M&&Re&1&&(M=!0,Fe.value=r[0].confirm,pe(()=>M=!1)),P.$set(Fe),r[0].confirm?ee?(ee.p(r,Re),Re&1&&m(ee,1)):(ee=Q6(r),ee.c(),m(ee,1),ee.m(g,null)):ee&&(te(),_(ee,1,1,()=>{ee=null}),ne()),Re&1&&re(q,q=r[0].automationId)?(te(),_(ae,1,1,Oe),ne(),ae=X6(r),ae.c(),m(ae),ae.m(z,null)):ae.p(r,Re)},i(_e){H||(m(s.$$.fragment,_e),m(p.$$.fragment,_e),m(h.$$.fragment,_e),m(C),m(O.$$.fragment,_e),m(P.$$.fragment,_e),m(ee),m(ae),H=!0)},o(_e){_(s.$$.fragment,_e),_(p.$$.fragment,_e),_(h.$$.fragment,_e),_(C),_(O.$$.fragment,_e),_(P.$$.fragment,_e),_(ee),_(ae),H=!1},d(_e){_e&&b(e),r[13][0].splice(r[13][0].indexOf(i),1),E(s),r[13][0].splice(r[13][0].indexOf(u),1),E(p),E(h),G[k].d(),E(O),E(P),ee&&ee.d(),ae.d(_e),Y=!1,Tn(U)}}}const Cte=r=>r.name,Ste=r=>r._id;function Ate(r,e,t){let n,i,l,s,o;ue(r,Zt,P=>t(11,o=P));let{parameters:a={}}=e,{bindings:u=[]}=e;const f={NEW:"new",EXISTING:"existing"};let c=a.automationId?f.EXISTING:f.NEW;const p=P=>{t(0,a.fields=P.detail,a)},d=()=>{t(3,c=f.NEW),t(0,a.automationId=void 0,a),t(0,a.fields={},a)},g=()=>{var P;t(3,c=f.EXISTING),t(0,a.newAutomationName="",a),t(0,a.fields={},a),t(0,a.automationId=(P=n[0])==null?void 0:P._id,a)},h=[[]];function v(){c=this.__value,t(3,c)}function k(){c=this.__value,t(3,c)}function C(P){r.$$.not_equal(a.automationId,P)&&(a.automationId=P,t(0,a))}function I(P){r.$$.not_equal(a.newAutomationName,P)&&(a.newAutomationName=P,t(0,a))}function O(P){r.$$.not_equal(a.confirm,P)&&(a.confirm=P,t(0,a))}function T(P){r.$$.not_equal(a.confirmText,P)&&(a.confirmText=P,t(0,a))}return r.$$set=P=>{"parameters"in P&&t(0,a=P.parameters),"bindings"in P&&t(1,u=P.bindings)},r.$$.update=()=>{r.$$.dirty&2048&&t(2,n=o.automations.filter(P=>{var M;return((M=P.definition.trigger)==null?void 0:M.stepId)==="APP"}).map(P=>{const M=Object.entries(P.definition.trigger.inputs.fields).map(([F,j])=>({name:F,type:j}));return{name:P.name,_id:P._id,schema:M}})),r.$$.dirty&4&&t(5,i=n&&n.length>0),r.$$.dirty&5&&t(10,l=n==null?void 0:n.find(P=>P._id===(a==null?void 0:a.automationId))),r.$$.dirty&1024&&t(4,s=l==null?void 0:l.schema)},[a,u,n,c,s,i,f,p,d,g,l,o,v,h,k,C,I,O,T]}class Ete extends ie{constructor(e){super();le(this,e,Ate,kte,re,{parameters:0,bindings:1})}}function Ote(r){let e;return{c(){e=V("Form")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Tte(r){let e,t,n,i,l,s,o,a,u,f,c;t=new Ze({props:{small:!0,$$slots:{default:[Ote]},$$scope:{ctx:r}}});function p(v){r[4](v)}let d={options:r[1],getOptionLabel:Ite,getOptionValue:Lte};r[0].componentId!==void 0&&(d.value=r[0].componentId),i=new Xe({props:d}),K.push(()=>ce(i,"value",p));function g(v){r[5](v)}let h={text:"Validate only current step"};return r[0].onlyCurrentStep!==void 0&&(h.value=r[0].onlyCurrentStep),u=new Zr({props:h}),K.push(()=>ce(u,"value",g)),{c(){e=D("div"),S(t.$$.fragment),n=R(),S(i.$$.fragment),s=R(),o=D("div"),a=R(),S(u.$$.fragment),w(e,"class","root svelte-ss4wgk")},m(v,k){$(v,e,k),A(t,e,null),N(e,n),A(i,e,null),N(e,s),N(e,o),N(e,a),A(u,e,null),c=!0},p(v,[k]){const C={};k&64&&(C.$$scope={dirty:k,ctx:v}),t.$set(C);const I={};k&2&&(I.options=v[1]),!l&&k&1&&(l=!0,I.value=v[0].componentId,pe(()=>l=!1)),i.$set(I);const O={};!f&&k&1&&(f=!0,O.value=v[0].onlyCurrentStep,pe(()=>f=!1)),u.$set(O)},i(v){c||(m(t.$$.fragment,v),m(i.$$.fragment,v),m(u.$$.fragment,v),c=!0)},o(v){_(t.$$.fragment,v),_(i.$$.fragment,v),_(u.$$.fragment,v),c=!1},d(v){v&&b(e),E(t),E(i),E(u)}}}const Ite=r=>r._instanceName,Lte=r=>r._id;function Pte(r,e,t){let n,i,l;ue(r,He,u=>t(2,i=u)),ue(r,un,u=>t(3,l=u));let{parameters:s}=e;function o(u){r.$$.not_equal(s.componentId,u)&&(s.componentId=u,t(0,s))}function a(u){r.$$.not_equal(s.onlyCurrentStep,u)&&(s.onlyCurrentStep=u,t(0,s))}return r.$$set=u=>{"parameters"in u&&t(0,s=u.parameters)},r.$$.update=()=>{r.$$.dirty&12&&t(1,n=Yf(l,i.selectedComponentId,"ValidateForm"))},[s,n,i,l,o,a]}class Nte extends ie{constructor(e){super();le(this,e,Pte,Tte,re,{parameters:0})}}function Rte(r){let e;return{c(){e=V(`Please enter the URL you would like to be redirected to after logging out.
|
|
@@ -1234,14 +1234,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1234
1234
|
<code class="svelte-12gur68">POST</code>
|
|
1235
1235
|
request to it from your other application. If you're unable to do this now then
|
|
1236
1236
|
you can skip this step, however we will not be able to configure bindings for
|
|
1237
|
-
your later actions!`,t=R(),S(n.$$.fragment),i=R(),o&&o.c(),l=Ee(),w(e,"class","svelte-12gur68")},m(a,u){$(a,e,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&2&&(f.value=a[1]),n.$set(f),a[0]?o?o.p(a,u):(o=ny(a),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null)},i(a){s||(m(n.$$.fragment,a),s=!0)},o(a){_(n.$$.fragment,a),s=!1},d(a){a&&b(e),a&&b(t),E(n,a),a&&b(i),o&&o.d(a),a&&b(l)}}}function lfe(r){let e,t,n,i,l;return t=new ct({props:{name:"InfoOutline"}}),{c(){e=D("a"),S(t.$$.fragment),n=R(),i=D("span"),i.textContent="Learn about webhooks",w(i,"class","svelte-12gur68"),w(e,"slot","footer"),w(e,"target","_blank"),w(e,"href","https://docs.budibase.com/automate/steps/triggers"),w(e,"class","svelte-12gur68")},m(s,o){$(s,e,o),A(t,e,null),N(e,n),N(e,i),l=!0},p:Oe,i(s){l||(m(t.$$.fragment,s),l=!0)},o(s){_(t.$$.fragment,s),l=!1},d(s){s&&b(e),E(t)}}}function sfe(r){let e,t;return e=new Dt({props:{title:"Webhook Setup",confirmText:"Finished",showConfirmButton:r[0],cancelText:"Skip",$$slots:{footer:[lfe],default:[ife]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.showConfirmButton=n[0]),i&71&&(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)}}}const ofe=2500;function afe(r,e,t){let n,i;ue(r,Zt,u=>t(3,i=u));let l,s=!1,o,a=0;return Gt(async()=>{var u,f,c,p;if(!((f=(u=n==null?void 0:n.definition)==null?void 0:u.trigger)==null?void 0:f.inputs.schemaUrl))try{await Zt.actions.save(n)}catch{we.error("Error saving automation")}l=setInterval(async()=>{var d,g;try{await Zt.actions.fetch();const h=(g=(d=n==null?void 0:n.definition)==null?void 0:d.trigger.schema.outputs)==null?void 0:g.properties;Object.keys(h).length>1&&(t(2,a=Object.keys(h).length-1),t(0,s=!0))}catch{we.error("Error getting automations list")}},ofe),t(1,o=(p=(c=n==null?void 0:n.definition)==null?void 0:c.trigger)==null?void 0:p.inputs.schemaUrl)}),gp(()=>{clearInterval(l)}),r.$$.update=()=>{var u;r.$$.dirty&8&&(n=(u=i.selectedAutomation)==null?void 0:u.automation)},[s,o,a,i]}class D1 extends ie{constructor(e){super();le(this,e,afe,sfe,re,{})}}function ufe(r){let e,t;const n=r[3].default,i=bt(n,r,r[5],null);return{c(){e=D("div"),i&&i.c(),w(e,"class","container svelte-1pjf6q5")},m(l,s){$(l,e,s),i&&i.m(e,null),t=!0},p(l,s){i&&i.p&&(!t||s&32)&&vt(i,n,l,l[5],t?yt(n,l[5],s,null):wt(l[5]),null)},i(l){t||(m(i,l),t=!0)},o(l){_(i,l),t=!1},d(l){l&&b(e),i&&i.d(l)}}}function ffe(r){let e,t;return e=new Dt({props:{size:"XL",title:"Edit Code",showConfirmButton:!1,showCancelButton:!1,$$slots:{default:[ufe]},$$scope:{ctx:r}}}),{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 cfe(r){let e;return{c(){e=V("Edit Code")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pfe(r){let e,t,n,i,l={$$slots:{default:[ffe]},$$scope:{ctx:r}};return e=new Et({props:l}),r[4](e),n=new gt({props:{primary:!0,$$slots:{default:[cfe]},$$scope:{ctx:r}}}),n.$on("click",r[0]),{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&32&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&32&&(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){r[4](null),E(e,s),s&&b(t),E(n,s)}}}function dfe(r,e,t){let{$$slots:n={},$$scope:i}=e,l;const s=()=>{l.show()},o=()=>{l.hide()};function a(u){K[u?"unshift":"push"](()=>{l=u,t(1,l)})}return r.$$set=u=>{"$$scope"in u&&t(5,i=u.$$scope)},[s,l,o,n,a,i]}class mfe extends ie{constructor(e){super();le(this,e,dfe,pfe,re,{show:0,hide:2})}get show(){return this.$$.ctx[0]}get hide(){return this.$$.ctx[2]}}function ry(r,e,t){const n=r.slice();return n[4]=e[t],n}function iy(r){let e,t=r[4].name+"",n,i;return{c(){e=D("option"),n=V(t),e.__value=i=r[4]._id,e.value=e.__value},m(l,s){$(l,e,s),N(e,n)},p(l,s){s&2&&t!==(t=l[4].name+"")&&Te(n,t),s&2&&i!==(i=l[4]._id)&&(e.__value=i,e.value=e.__value)},d(l){l&&b(e)}}}function gfe(r){let e,t,n,i=r[1].list,l=[];for(let s=0;s<i.length;s+=1)l[s]=iy(ry(r,i,s));return{c(){e=D("option"),e.textContent="Choose an option",t=R();for(let s=0;s<l.length;s+=1)l[s].c();n=Ee(),e.__value="",e.value=e.__value},m(s,o){$(s,e,o),$(s,t,o);for(let a=0;a<l.length;a+=1)l[a].m(s,o);$(s,n,o)},p(s,o){if(o&2){i=s[1].list;let a;for(a=0;a<i.length;a+=1){const u=ry(s,i,a);l[a]?l[a].p(u,o):(l[a]=iy(u),l[a].c(),l[a].m(n.parentNode,n))}for(;a<l.length;a+=1)l[a].d(1);l.length=i.length}},d(s){s&&b(e),s&&b(t),$t(l,s),s&&b(n)}}}function _fe(r){let e,t,n,i;function l(o){r[2](o)}let s={secondary:!0,extraThin:!0,$$slots:{default:[gfe]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.value=r[0]),t=new Xe({props:s}),K.push(()=>ce(t,"value",l)),t.$on("change",r[3]),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","block-field")},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,[a]){const u={};a&130&&(u.$$scope={dirty:a,ctx:o}),!n&&a&1&&(n=!0,u.value=o[0],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function hfe(r,e,t){let n;ue(r,kn,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class $fe extends ie{constructor(e){super();le(this,e,hfe,_fe,re,{value:0})}}function ly(r,e,t){const n=r.slice();return n[9]=e[t],n}function sy(r){let e,t,n=r[3],i=[];for(let s=0;s<n.length;s+=1)i[s]=oy(ly(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();w(e,"class","schema-fields svelte-baq95m")},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&43){n=s[3];let a;for(a=0;a<n.length;a+=1){const u=ly(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=oy(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(te(),a=n.length;a<i.length;a+=1)l(a);ne()}},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),$t(i,s)}}}function oy(r){let e,t;function n(...i){return r[7](r[9],...i)}return e=new Un({props:{panel:xi,extraThin:!0,value:r[0][r[9].name],label:r[9].name,type:"string",bindings:r[1],fillWidth:!0,allowJS:!1}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&9&&(s.value=r[0][r[9].name]),l&8&&(s.label=r[9].name),l&2&&(s.bindings=r[1]),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 bfe(r){let e,t,n,i,l;t=new Xe({props:{label:"Query",value:r[0].queryId,options:r[2].list,getOptionValue:vfe,getOptionLabel:wfe}}),t.$on("change",r[4]);let s=r[3].length&&sy(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),s&&s.c(),i=Ee(),w(e,"class","block-field")},m(o,a){$(o,e,a),A(t,e,null),$(o,n,a),s&&s.m(o,a),$(o,i,a),l=!0},p(o,[a]){const u={};a&1&&(u.value=o[0].queryId),a&4&&(u.options=o[2].list),t.$set(u),o[3].length?s?(s.p(o,a),a&8&&m(s,1)):(s=sy(o),s.c(),m(s,1),s.m(i.parentNode,i)):s&&(te(),_(s,1,1,()=>{s=null}),ne())},i(o){l||(m(t.$$.fragment,o),m(s),l=!0)},o(o){_(t.$$.fragment,o),_(s),l=!1},d(o){o&&b(e),E(t),o&&b(n),s&&s.d(o),o&&b(i)}}}const vfe=r=>r._id,wfe=r=>r.name;function yfe(r,e,t){let n,i,l;ue(r,kn,p=>t(2,l=p));const s=ht();let{value:o}=e,{bindings:a}=e;const u=p=>{t(0,o.queryId=p.detail,o),s("change",o)},f=(p,d)=>{t(0,o[d.name]=p.detail,o),s("change",o)},c=(p,d)=>f(d,p);return r.$$set=p=>{"value"in p&&t(0,o=p.value),"bindings"in p&&t(1,a=p.bindings)},r.$$.update=()=>{var p;r.$$.dirty&1&&(o==null?void 0:o.queryId)==null&&t(0,o={queryId:""}),r.$$.dirty&5&&t(6,n=l.list.find(d=>d._id===(o==null?void 0:o.queryId))),r.$$.dirty&64&&t(3,i=(p=n==null?void 0:n.parameters)!=null?p:[])},[o,a,l,i,u,f,n,c]}class kfe extends ie{constructor(e){super();le(this,e,yfe,bfe,re,{value:0,bindings:1})}}function Cfe(r){let e=(r[1]?"Hide":"Show")+"",t,n;return{c(){t=V(e),n=V(" Presets")},m(i,l){$(i,t,l),$(i,n,l)},p(i,l){l&2&&e!==(e=(i[1]?"Hide":"Show")+"")&&Te(t,e)},d(i){i&&b(t),i&&b(n)}}}function ay(r){let e,t;return e=new Xe({props:{value:r[0],secondary:!0,extraThin:!0,label:"Presets",options:r[3]}}),e.$on("change",r[2]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.value=n[0]),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 Sfe(r){let e,t,n,i,l,s,o;t=new tt({props:{value:r[0]}}),t.$on("change",r[2]),l=new gt({props:{$$slots:{default:[Cfe]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let a=r[1]&&ay(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),s=R(),a&&a.c(),w(i,"class","presets svelte-1cg6p40"),w(e,"class","block-field svelte-1cg6p40")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),N(e,i),A(l,i,null),N(i,s),a&&a.m(i,null),o=!0},p(u,[f]){const c={};f&1&&(c.value=u[0]),t.$set(c);const p={};f&66&&(p.$$scope={dirty:f,ctx:u}),l.$set(p),u[1]?a?(a.p(u,f),f&2&&m(a,1)):(a=ay(u),a.c(),m(a,1),a.m(i,null)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){o||(m(t.$$.fragment,u),m(l.$$.fragment,u),m(a),o=!0)},o(u){_(t.$$.fragment,u),_(l.$$.fragment,u),_(a),o=!1},d(u){u&&b(e),E(t),E(l),a&&a.d()}}}function Afe(r,e,t){const n=ht();let{value:i}=e;const l=u=>{t(0,i=u.detail),n("change",u.detail)};let s=!1;const o=[{label:"Every Minute",value:"* * * * *"},{label:"Every Hour",value:"0 * * * *"},{label:"Every Morning at 8AM",value:"0 8 * * *"},{label:"Every Night at Midnight",value:"0 0 * * *"},{label:"Every Budibase Reboot",value:"@reboot"}],a=()=>t(1,s=!s);return r.$$set=u=>{"value"in u&&t(0,i=u.value)},[i,s,l,o,a]}class Efe extends ie{constructor(e){super();le(this,e,Afe,Sfe,re,{value:0})}}function uy(r,e,t){const n=r.slice();return n[43]=e[t][0],n[44]=e[t][1],n}function Ofe(r){let e=(r[44].title||(r[43]==="row"?"Table":r[43]))+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i[0]&2&&e!==(e=(n[44].title||(n[43]==="row"?"Table":n[43]))+"")&&Te(t,e)},d(n){n&&b(t)}}}function Tfe(r){let e,t,n,i;const l=[Hfe,Vfe],s=[];function o(a,u){return a[2]?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function Ife(r){let e,t;return e=new mfe({props:{$$slots:{default:[Yfe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&2314|i[1]&65536&&(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 Lfe(r){let e,t;function n(...i){return r[34](r[43],...i)}return e=new xue({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Pfe(r){let e,t;function n(...i){return r[33](r[43],...i)}return e=new ty({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Nfe(r){let e,t;function n(...i){return r[32](r[43],...i)}return e=new Xue({props:{block:r[0],value:r[3][r[43]],bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&1&&(s.block=r[0]),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Rfe(r){let e,t;function n(...i){return r[31](r[43],...i)}return e=new Iue({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Mfe(r){let e,t;function n(...i){return r[30](r[43],...i)}return e=new kfe({props:{value:r[3][r[43]],bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Dfe(r){let e,t;function n(...i){return r[29](r[43],...i)}return e=new Efe({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 jfe(r){let e,t;function n(...i){return r[28](r[43],...i)}return e=new $fe({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Bfe(r){let e,t,n,i;const l=[Qfe,Jfe],s=[];function o(a,u){return a[2]?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function zfe(r){let e,t;function n(...i){return r[25](r[43],...i)}return e=new tt({props:{type:"password",value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 qfe(r){let e,t,n,i;e=new Jt({props:{$$slots:{default:[Xfe]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[6].show)&&r[6].show.apply(this,arguments)});let l={fillWidth:rce,title:"Filtering",$$slots:{body:[xfe],buttons:[Zfe]},$$scope:{ctx:r}};return n=new Kr({props:l}),r[24](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[1]&65536&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o[0]&3202|o[1]&65536&&(u.$$scope={dirty:o,ctx:r}),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[24](null),E(n,s)}}}function Ufe(r){let e,t;function n(...i){return r[21](r[43],...i)}return e=new Xe({props:{value:r[3][r[43]],options:Object.keys(r[4].schema)}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),l[0]&16&&(s.options=Object.keys(r[4].schema)),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 Ffe(r){let e,t;function n(...l){return r[19](r[44],...l)}function i(...l){return r[20](r[43],...l)}return e=new Xe({props:{value:r[3][r[43]],options:r[44].enum,getOptionLabel:n}}),e.$on("change",i),{c(){S(e.$$.fragment)},m(l,s){A(e,l,s),t=!0},p(l,s){r=l;const o={};s[0]&10&&(o.value=r[3][r[43]]),s[0]&2&&(o.options=r[44].enum),s[0]&2&&(o.getOptionLabel=n),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function Vfe(r){let e,t,n;function i(...l){return r[38](r[43],...l)}return t=new Un({props:{fillWidth:!0,title:r[44].title,panel:xi,type:r[44].customType,value:r[3][r[43]],bindings:r[11]}}),t.$on("change",i),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","test svelte-dv1cdv")},m(l,s){$(l,e,s),A(t,e,null),n=!0},p(l,s){r=l;const o={};s[0]&2&&(o.title=r[44].title),s[0]&2&&(o.type=r[44].customType),s[0]&10&&(o.value=r[3][r[43]]),s[0]&2048&&(o.bindings=r[11]),t.$set(o)},i(l){n||(m(t.$$.fragment,l),n=!0)},o(l){_(t.$$.fragment,l),n=!1},d(l){l&&b(e),E(t)}}}function Hfe(r){let e,t;function n(...i){return r[37](r[43],...i)}return e=new h1({props:{title:r[44].title,value:r[3][r[43]],panel:xi,type:r[44].customType,bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2&&(s.type=r[44].customType),l[0]&2048&&(s.bindings=r[11]),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 Wfe(r){let e;return{c(){e=V("Bindings")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Gfe(r){let e,t;return e=new mr({props:{size:"S",$$slots:{default:[Wfe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&65536&&(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 fy(r){let e,t=JSON.stringify(r[11],null,2)+"",n;return{c(){e=D("pre"),n=V(t)},m(i,l){$(i,e,l),N(e,n)},p(i,l){l[0]&2048&&t!==(t=JSON.stringify(i[11],null,2)+"")&&Te(n,t)},d(i){i&&b(e)}}}function Yfe(r){let e,t,n,i,l;e=new Jt({props:{quiet:!0,icon:r[8]?"ChevronDown":"ChevronRight",$$slots:{default:[Gfe]},$$scope:{ctx:r}}}),e.$on("click",r[35]);let s=r[8]&&fy(r);function o(...a){return r[36](r[43],...a)}return i=new Zl({props:{mode:"javascript",value:r[3][r[43]]}}),i.$on("change",o),{c(){S(e.$$.fragment),t=R(),s&&s.c(),n=R(),S(i.$$.fragment)},m(a,u){A(e,a,u),$(a,t,u),s&&s.m(a,u),$(a,n,u),A(i,a,u),l=!0},p(a,u){r=a;const f={};u[0]&256&&(f.icon=r[8]?"ChevronDown":"ChevronRight"),u[1]&65536&&(f.$$scope={dirty:u,ctx:r}),e.$set(f),r[8]?s?s.p(r,u):(s=fy(r),s.c(),s.m(n.parentNode,n)):s&&(s.d(1),s=null);const c={};u[0]&10&&(c.value=r[3][r[43]]),i.$set(c)},i(a){l||(m(e.$$.fragment,a),m(i.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(i.$$.fragment,a),l=!1},d(a){E(e,a),a&&b(t),s&&s.d(a),a&&b(n),E(i,a)}}}function Jfe(r){let e,t;function n(...i){return r[27](r[43],...i)}return e=new Un({props:{fillWidth:!0,title:r[44].title,panel:xi,type:"email",value:r[3][r[43]],bindings:r[11],allowJS:!1}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Qfe(r){let e,t;function n(...i){return r[26](r[43],...i)}return e=new h1({props:{title:r[44].title,value:r[3][r[43]],panel:xi,type:"email",bindings:r[11],fillWidth:!0}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Xfe(r){let e;return{c(){e=V("Define filters")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Kfe(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Zfe(r){let e,t;function n(){return r[23](r[43])}return e=new gt({props:{cta:!0,slot:"buttons",$$slots:{default:[Kfe]},$$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]&65536&&(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 xfe(r){let e,t,n;function i(s){r[22](s)}let l={slot:"body",bindings:r[11],schemaFields:r[10],panel:xi};return r[7]!==void 0&&(l.filters=r[7]),e=new k1({props:l}),K.push(()=>ce(e,"filters",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o[0]&2048&&(a.bindings=s[11]),o[0]&1024&&(a.schemaFields=s[10]),!t&&o[0]&128&&(t=!0,a.filters=s[7],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function cy(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[Ofe]},$$scope:{ctx:r}}});const a=[Ffe,Ufe,qfe,zfe,Bfe,jfe,Dfe,Mfe,Rfe,Nfe,Pfe,Lfe,Ife,Tfe],u=[];function f(c,p){return c[44].type==="string"&&c[44].enum?0:c[44].customType==="column"?1:c[44].customType==="filters"?2:c[44].customType==="password"?3:c[44].customType==="email"?4:c[44].customType==="query"?5:c[44].customType==="cron"?6:c[44].customType==="queryParams"?7:c[44].customType==="table"?8:c[44].customType==="row"?9:c[44].customType==="webhookUrl"?10:c[44].customType==="triggerSchema"?11:c[44].customType==="code"?12:c[44].type==="string"||c[44].type==="number"||c[44].type==="integer"?13:-1}return~(i=f(r))&&(l=u[i]=a[i](r)),{c(){e=D("div"),S(t.$$.fragment),n=R(),l&&l.c(),s=R(),w(e,"class","block-field svelte-dv1cdv")},m(c,p){$(c,e,p),A(t,e,null),N(e,n),~i&&u[i].m(e,null),N(e,s),o=!0},p(c,p){const d={};p[0]&2|p[1]&65536&&(d.$$scope={dirty:p,ctx:c}),t.$set(d);let g=i;i=f(c),i===g?~i&&u[i].p(c,p):(l&&(te(),_(u[g],1,1,()=>{u[g]=null}),ne()),~i?(l=u[i],l?l.p(c,p):(l=u[i]=a[i](c),l.c()),m(l,1),l.m(e,s)):l=null)},i(c){o||(m(t.$$.fragment,c),m(l),o=!0)},o(c){_(t.$$.fragment,c),_(l),o=!1},d(c){c&&b(e),E(t),~i&&u[i].d()}}}function ece(r){let e,t;return e=new D1({}),{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 py(r){let e,t;return e=new gt({props:{secondary:!0,$$slots:{default:[tce]},$$scope:{ctx:r}}}),e.$on("click",r[40]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&65536&&(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 tce(r){let e;return{c(){e=V("Set Up Webhook")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function nce(r){let e,t,n,i,l,s,o=r[1],a=[];for(let p=0;p<o.length;p+=1)a[p]=cy(uy(r,o,p));const u=p=>_(a[p],1,1,()=>{a[p]=null});let f={width:"30%",$$slots:{default:[ece]},$$scope:{ctx:r}};n=new Et({props:f}),r[39](n);let c=r[9]==="WEBHOOK"&&py(r);return{c(){e=D("div");for(let p=0;p<a.length;p+=1)a[p].c();t=R(),S(n.$$.fragment),i=R(),c&&c.c(),l=Ee(),w(e,"class","fields svelte-dv1cdv")},m(p,d){$(p,e,d);for(let g=0;g<a.length;g+=1)a[g].m(e,null);$(p,t,d),A(n,p,d),$(p,i,d),c&&c.m(p,d),$(p,l,d),s=!0},p(p,d){if(d[0]&15839){o=p[1];let h;for(h=0;h<o.length;h+=1){const v=uy(p,o,h);a[h]?(a[h].p(v,d),m(a[h],1)):(a[h]=cy(v),a[h].c(),m(a[h],1),a[h].m(e,null))}for(te(),h=o.length;h<a.length;h+=1)u(h);ne()}const g={};d[1]&65536&&(g.$$scope={dirty:d,ctx:p}),n.$set(g),p[9]==="WEBHOOK"?c?(c.p(p,d),d[0]&512&&m(c,1)):(c=py(p),c.c(),m(c,1),c.m(l.parentNode,l)):c&&(te(),_(c,1,1,()=>{c=null}),ne())},i(p){if(!s){for(let d=0;d<o.length;d+=1)m(a[d]);m(n.$$.fragment,p),m(c),s=!0}},o(p){a=a.filter(Boolean);for(let d=0;d<a.length;d+=1)_(a[d]);_(n.$$.fragment,p),_(c),s=!1},d(p){p&&b(e),$t(a,p),p&&b(t),r[39](null),E(n,p),p&&b(i),c&&c.d(p),p&&b(l)}}}let rce=!0;function ice(r,e,t){let n,i,l,s,o,a,u,f,c;ue(r,Zt,Ce=>t(17,f=Ce)),ue(r,Ot,Ce=>t(18,c=Ce));let{block:p}=e,{testData:d}=e,{schemaProperties:g}=e,{isTestModal:h=!1}=e,v,k,C=P(g)||[],I=!1;const O=jl.exports.debounce(async function(Ce,me){var ke,ze;try{h?(n==="WEBHOOK"&&Zt.actions.addTestDataToAutomation({body:Se({[me]:Ce.detail},f.selectedAutomation.automation.testData.body)}),Zt.actions.addTestDataToAutomation({[me]:Ce.detail}),t(14,d[me]=Ce.detail,d),await Zt.actions.save((ke=f.selectedAutomation)==null?void 0:ke.automation)):(t(0,p.inputs[me]=Ce.detail,p),await Zt.actions.save((ze=f.selectedAutomation)==null?void 0:ze.automation))}catch{we.error("Error saving automation")}},800);function T(Ce,me){var Je,Nt,qe;if(!Ce||!me)return[];let ke=[...me.steps];me.trigger&&(ke=[me.trigger,...ke]);const ze=ke.findIndex(pt=>pt.id===Ce.id);let ye=[];for(let pt=0;pt<ze;pt++){const Rt=Object.entries((qe=(Nt=(Je=ke[pt].schema)==null?void 0:Je.outputs)==null?void 0:Nt.properties)!=null?qe:{});ye=ye.concat(Rt.map(([Ie,Ge])=>{const Ue=pt===0?`trigger.${Ie}`:`steps.${pt}.${Ie}`;return{label:Ue,type:Ge.type,description:Ge.description,category:pt===0?"Trigger outputs":`Step ${pt} outputs`,path:Ue}}))}return ye}function P(Ce){if(!Ce)return[];let me;const ke=d||p.inputs;for(let[ze,ye]of Ce){const Je=`${ze}-def`;if(ye.customType==="filters"&&(ke==null?void 0:ke[Je])){me=ke[Je];break}}return me||[]}function M(Ce){const me=u3(C),ke=`${Ce}-def`;t(3,l[Ce]=me,l),t(3,l[ke]=C,l),O({detail:me},Ce),O({detail:C},ke),k.hide()}const F=(Ce,me,ke)=>Ce.pretty?Ce.pretty[ke]:me,j=(Ce,me)=>O(me,Ce),z=(Ce,me)=>O(me,Ce);function q(Ce){C=Ce,t(7,C)}const H=Ce=>M(Ce);function Y(Ce){K[Ce?"unshift":"push"](()=>{k=Ce,t(6,k)})}const U=(Ce,me)=>O(me,Ce),W=(Ce,me)=>O(me,Ce),G=(Ce,me)=>O(me,Ce),Q=(Ce,me)=>O(me,Ce),fe=(Ce,me)=>O(me,Ce),Z=(Ce,me)=>O(me,Ce),ee=(Ce,me)=>O(me,Ce),ae=(Ce,me)=>O(me,Ce),_e=(Ce,me)=>O(me,Ce),Re=(Ce,me)=>O(me,Ce),$e=()=>t(8,I=!I),be=(Ce,me)=>{O({detail:me.detail.value},Ce),t(3,l[Ce]=me.detail.value,l)},he=(Ce,me)=>O(me,Ce),Ne=(Ce,me)=>O(me,Ce);function Fe(Ce){K[Ce?"unshift":"push"](()=>{v=Ce,t(5,v)})}const se=()=>v.show();return r.$$set=Ce=>{"block"in Ce&&t(0,p=Ce.block),"testData"in Ce&&t(14,d=Ce.testData),"schemaProperties"in Ce&&t(1,g=Ce.schemaProperties),"isTestModal"in Ce&&t(2,h=Ce.isTestModal)},r.$$.update=()=>{var Ce,me;r.$$.dirty[0]&1&&t(9,n=p.stepId),r.$$.dirty[0]&131073&&t(11,i=T(p||f.selectedBlock,(me=(Ce=f.selectedAutomation)==null?void 0:Ce.automation)==null?void 0:me.definition)),r.$$.dirty[0]&16385&&t(3,l=d||p.inputs),r.$$.dirty[0]&8&&t(16,s=l?l.tableId:null),r.$$.dirty[0]&327688&&t(4,o=s?c.list.find(ke=>ke._id===l.tableId):{schema:{}}),r.$$.dirty[0]&65536&&t(15,a=Jf(s,{searchableSchema:!0}).schema),r.$$.dirty[0]&32768&&t(10,u=Object.values(a||{}))},[p,g,h,l,o,v,k,C,I,n,u,i,O,M,d,a,s,f,c,F,j,z,q,H,Y,U,W,G,Q,fe,Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se]}class dy extends ie{constructor(e){super();le(this,e,ice,nce,re,{block:0,testData:14,schemaProperties:1,isTestModal:2},null,[-1,-1])}}function lce(r){let e;return{c(){e=V("Input")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function sce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronRight"}}),{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 oce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronDown"}}),{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 my(r){let e,t,n;return t=new pi({props:{disabled:!0,value:JSON.stringify(r[0][0].inputs,null,2)}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","text-area-container svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.value=JSON.stringify(i[0][0].inputs,null,2)),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 ace(r){let e;return{c(){e=V("Output")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function uce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronRight"}}),{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 fce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronDown"}}),{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 gy(r){let e,t,n;return t=new pi({props:{disabled:!0,value:JSON.stringify(r[0][0].outputs,null,2)}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","text-area-container svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.value=JSON.stringify(i[0][0].outputs,null,2)),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 cce(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j;l=new mr({props:{size:"S",$$slots:{default:[lce]},$$scope:{ctx:r}}});const z=[oce,sce],q=[];function H(fe,Z){return fe[2]?0:1}a=H(r),u=q[a]=z[a](r);let Y=r[2]&&my(r);v=new mr({props:{size:"S",$$slots:{default:[ace]},$$scope:{ctx:r}}});const U=[fce,uce],W=[];function G(fe,Z){return fe[3]?0:1}I=G(r),O=W[I]=U[I](r);let Q=r[3]&&gy(r);return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("span"),S(l.$$.fragment),s=R(),o=D("div"),u.c(),f=R(),Y&&Y.c(),c=R(),p=D("div"),d=D("div"),g=D("div"),h=D("span"),S(v.$$.fragment),k=R(),C=D("div"),O.c(),T=R(),Q&&Q.c(),P=Ee(),zt(i,"padding-left","var(--spacing-s)"),zt(n,"display","flex"),zt(n,"align-items","center"),w(e,"class","toggle splitHeader svelte-ddpow"),zt(h,"padding-left","var(--spacing-s)"),zt(g,"display","flex"),zt(g,"align-items","center"),w(p,"class","toggle splitHeader svelte-ddpow")},m(fe,Z){$(fe,e,Z),N(e,t),N(t,n),N(n,i),A(l,i,null),N(e,s),N(e,o),q[a].m(o,null),$(fe,f,Z),Y&&Y.m(fe,Z),$(fe,c,Z),$(fe,p,Z),N(p,d),N(d,g),N(g,h),A(v,h,null),N(p,k),N(p,C),W[I].m(C,null),$(fe,T,Z),Q&&Q.m(fe,Z),$(fe,P,Z),M=!0,F||(j=[Pe(e,"click",r[4]),Pe(p,"click",r[5])],F=!0)},p(fe,Z){const ee={};Z&64&&(ee.$$scope={dirty:Z,ctx:fe}),l.$set(ee);let ae=a;a=H(fe),a!==ae&&(te(),_(q[ae],1,1,()=>{q[ae]=null}),ne(),u=q[a],u||(u=q[a]=z[a](fe),u.c()),m(u,1),u.m(o,null)),fe[2]?Y?(Y.p(fe,Z),Z&4&&m(Y,1)):(Y=my(fe),Y.c(),m(Y,1),Y.m(c.parentNode,c)):Y&&(te(),_(Y,1,1,()=>{Y=null}),ne());const _e={};Z&64&&(_e.$$scope={dirty:Z,ctx:fe}),v.$set(_e);let Re=I;I=G(fe),I!==Re&&(te(),_(W[Re],1,1,()=>{W[Re]=null}),ne(),O=W[I],O||(O=W[I]=U[I](fe),O.c()),m(O,1),O.m(C,null)),fe[3]?Q?(Q.p(fe,Z),Z&8&&m(Q,1)):(Q=gy(fe),Q.c(),m(Q,1),Q.m(P.parentNode,P)):Q&&(te(),_(Q,1,1,()=>{Q=null}),ne())},i(fe){M||(m(l.$$.fragment,fe),m(u),m(Y),m(v.$$.fragment,fe),m(O),m(Q),M=!0)},o(fe){_(l.$$.fragment,fe),_(u),_(Y),_(v.$$.fragment,fe),_(O),_(Q),M=!1},d(fe){fe&&b(e),E(l),q[a].d(),fe&&b(f),Y&&Y.d(fe),fe&&b(c),fe&&b(p),E(v),W[I].d(),fe&&b(T),Q&&Q.d(fe),fe&&b(P),F=!1,Tn(j)}}}function pce(r){let e,t,n;return t=new ct({props:{size:"S",name:"CloseCircle"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","iconFailure svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function dce(r){let e,t,n;return t=new ct({props:{size:"S",name:"CheckmarkCircle"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","iconSuccess svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function mce(r){let e,t,n,i,l;const s=[dce,pce],o=[];function a(u,f){return u[1]||u[0][0].outputs.success?0:1}return n=a(r),i=o[n]=s[n](r),{c(){e=D("div"),t=D("div"),i.c(),zt(t,"float","right"),w(e,"slot","header")},m(u,f){$(u,e,f),N(e,t),o[n].m(t,null),l=!0},p(u,f){let c=n;n=a(u),n!==c&&(te(),_(o[c],1,1,()=>{o[c]=null}),ne(),i=o[n],i||(i=o[n]=s[n](u),i.c()),m(i,1),i.m(t,null))},i(u){l||(m(i),l=!0)},o(u){_(i),l=!1},d(u){u&&b(e),o[n].d()}}}function gce(r){let e,t;return e=new Dt({props:{showCloseIcon:!1,showConfirmButton:!1,title:"Test Automation",cancelText:"Close",$$slots:{header:[mce],default:[cce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&79&&(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 _ce(r,e,t){let{testResult:n}=e,{isTrigger:i}=e,l,s;const o=()=>{t(2,l=!l)},a=()=>{t(3,s=!s)};return r.$$set=u=>{"testResult"in u&&t(0,n=u.testResult),"isTrigger"in u&&t(1,i=u.isTrigger)},[n,i,l,s,o,a]}class hce extends ie{constructor(e){super();le(this,e,_ce,gce,re,{testResult:0,isTrigger:1})}}var $ce="/builder/assets/discord.c14881e9.svg",bce="/builder/assets/zapier.3fbd8f5c.png",vce="/builder/assets/integromat.42212f11.png",wce="/builder/assets/slack.1e1f7cfb.svg";const ho={zapier:{name:"zapier",icon:bce},discord:{name:"discord",icon:$ce},slack:{name:"slack",icon:wce},integromat:{name:"integromat",icon:vce}};function _y(r,e,t){const n=r.slice();return n[16]=e[t][0],n[17]=e[t][1],n}function hy(r,e,t){const n=r.slice();return n[16]=e[t][0],n[17]=e[t][1],n}function yce(r){let e;return{c(){e=V("Select an app or event.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function kce(r){let e;return{c(){e=V("Apps")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Cce(r){let e=r[16].charAt(0).toUpperCase()+r[16].slice(1)+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function $y(r){let e,t,n,i,l,s,o,a,u,f,c;o=new Ke({props:{size:"XS",$$slots:{default:[Cce]},$$scope:{ctx:r}}});function p(){return r[8](r[17])}return{c(){e=D("div"),t=D("div"),n=D("img"),l=R(),s=D("span"),S(o.$$.fragment),a=R(),w(n,"width","20"),w(n,"height","20"),dn(n.src,i=ho[r[17].stepId].icon)||w(n,"src",i),w(n,"alt","zapier"),w(s,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].name)},m(d,g){$(d,e,g),N(e,t),N(t,n),N(t,l),N(t,s),A(o,s,null),N(e,a),u=!0,f||(c=Pe(e,"click",p),f=!0)},p(d,g){r=d;const h={};g&4194304&&(h.$$scope={dirty:g,ctx:r}),o.$set(h),g&10&&oe(e,"selected",r[1]===r[17].name)},i(d){u||(m(o.$$.fragment,d),u=!0)},o(d){_(o.$$.fragment,d),u=!1},d(d){d&&b(e),E(o),f=!1,c()}}}function Sce(r){let e;return{c(){e=V("Actions")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Ace(r){let e,t,n,i,l,s,o,a,u,f;n=new ct({props:{name:r[17].icon}}),s=new Ke({props:{size:"XS",$$slots:{default:[Oce]},$$scope:{ctx:r}}});function c(){return r[10](r[17])}return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].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=Pe(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&4194304&&(g.$$scope={dirty:d,ctx:r}),s.$set(g),d&18&&oe(e,"selected",r[1]===r[17].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 Ece(r){let e,t;return e=new Lu({props:{text:r[2][r[16]].message,direction:"bottom",$$slots:{default:[Ice]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4194306&&(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 Oce(r){let e=r[17].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function Tce(r){let e=r[17].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function Ice(r){let e,t,n,i,l,s,o,a,u,f;n=new ct({props:{name:r[17].icon}}),s=new Ke({props:{size:"XS",$$slots:{default:[Tce]},$$scope:{ctx:r}}});function c(){return r[9](r[17])}return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].name),oe(e,"disabled",!0)},m(p,d){$(p,e,d),N(e,t),A(n,t,null),N(t,i),N(t,l),A(s,l,null),$(p,o,d),a=!0,u||(f=Pe(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&4194304&&(g.$$scope={dirty:d,ctx:r}),s.$set(g),d&18&&oe(e,"selected",r[1]===r[17].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),p&&b(o),u=!1,f()}}}function by(r){let e,t,n,i;const l=[Ece,Ace],s=[];function o(a,u){return a[2][a[16]]&&a[2][a[16]].disabled?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){t.p(a,u)},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function Lce(r){let e,t,n,i,l,s,o,a;e=new Ke({props:{size:"S",$$slots:{default:[kce]},$$scope:{ctx:r}}});let u=Object.entries(r[3]),f=[];for(let h=0;h<u.length;h+=1)f[h]=$y(hy(r,u,h));const c=h=>_(f[h],1,1,()=>{f[h]=null});l=new mr({props:{size:"S",$$slots:{default:[Sce]},$$scope:{ctx:r}}});let p=Object.entries(r[4]),d=[];for(let h=0;h<p.length;h+=1)d[h]=by(_y(r,p,h));const g=h=>_(d[h],1,1,()=>{d[h]=null});return{c(){S(e.$$.fragment),t=R(),n=D("div");for(let h=0;h<f.length;h+=1)f[h].c();i=R(),S(l.$$.fragment),s=R(),o=D("div");for(let h=0;h<d.length;h+=1)d[h].c();w(n,"class","item-list svelte-1xjh7jp"),w(o,"class","item-list svelte-1xjh7jp")},m(h,v){A(e,h,v),$(h,t,v),$(h,n,v);for(let k=0;k<f.length;k+=1)f[k].m(n,null);$(h,i,v),A(l,h,v),$(h,s,v),$(h,o,v);for(let k=0;k<d.length;k+=1)d[k].m(o,null);a=!0},p(h,v){const k={};if(v&4194304&&(k.$$scope={dirty:v,ctx:h}),e.$set(k),v&42){u=Object.entries(h[3]);let I;for(I=0;I<u.length;I+=1){const O=hy(h,u,I);f[I]?(f[I].p(O,v),m(f[I],1)):(f[I]=$y(O),f[I].c(),m(f[I],1),f[I].m(n,null))}for(te(),I=u.length;I<f.length;I+=1)c(I);ne()}const C={};if(v&4194304&&(C.$$scope={dirty:v,ctx:h}),l.$set(C),v&54){p=Object.entries(h[4]);let I;for(I=0;I<p.length;I+=1){const O=_y(h,p,I);d[I]?(d[I].p(O,v),m(d[I],1)):(d[I]=by(O),d[I].c(),m(d[I],1),d[I].m(o,null))}for(te(),I=p.length;I<d.length;I+=1)g(I);ne()}},i(h){if(!a){m(e.$$.fragment,h);for(let v=0;v<u.length;v+=1)m(f[v]);m(l.$$.fragment,h);for(let v=0;v<p.length;v+=1)m(d[v]);a=!0}},o(h){_(e.$$.fragment,h),f=f.filter(Boolean);for(let v=0;v<f.length;v+=1)_(f[v]);_(l.$$.fragment,h),d=d.filter(Boolean);for(let v=0;v<d.length;v+=1)_(d[v]);a=!1},d(h){E(e,h),h&&b(t),h&&b(n),$t(f,h),h&&b(i),E(l,h),h&&b(s),h&&b(o),$t(d,h)}}}function Pce(r){let e,t,n,i;return e=new Ke({props:{size:"XS",$$slots:{default:[yce]},$$scope:{ctx:r}}}),n=new Qe({props:{noPadding:!0,$$slots:{default:[Lce]},$$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&4194304&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&4194306&&(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 Nce(r){let e,t;return e=new Dt({props:{title:"Create Automation",confirmText:"Save",size:"M",disabled:!r[1],onConfirm:r[11],$$slots:{default:[Pce]},$$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]),i&1&&(l.onConfirm=n[11]),i&4194306&&(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 Rce(r,e,t){let n,i;ue(r,Zt,I=>t(13,n=I)),ue(r,An,I=>t(14,i=I));let{blockIdx:l}=e,{blockComplete:s}=e;const o={SEND_EMAIL_SMTP:{disabled:!i.checklist.smtp.checked,message:"Please configure SMTP"}};let a,u,f=Object.entries(n.blockDefinitions.ACTION);const c=f.reduce((I,O)=>{const[T,P]=O;return P.internal||(I[T]=P),I},{}),p=f.reduce((I,O)=>{const[T,P]=O;return P.internal&&(I[T]=P),I},{}),d=I=>{u=I,t(1,a=I.name)};async function g(){var I;try{const O=n.selectedAutomation.constructBlock("ACTION",u.stepId,u);Zt.actions.addBlockToAutomation(O,l+1),await Zt.actions.save((I=n.selectedAutomation)==null?void 0:I.automation)}catch{we.error("Error saving automation")}}const h=I=>d(I),v=I=>d(I),k=I=>d(I),C=()=>{t(0,s=!0),g()};return r.$$set=I=>{"blockIdx"in I&&t(7,l=I.blockIdx),"blockComplete"in I&&t(0,s=I.blockComplete)},[s,a,o,c,p,d,g,l,h,v,k,C]}class Mce extends ie{constructor(e){super();le(this,e,Rce,Nce,re,{blockIdx:7,blockComplete:0})}}function Dce(r){let e,t,n;return{c(){e=ge("svg"),t=ge("use"),Wt(t,"xlink:href",n="#spectrum-icon-18-"+r[0].icon),w(e,"width","28px"),w(e,"height","28px"),w(e,"class","spectrum-Icon"),zt(e,"color","grey"),w(e,"focusable","false")},m(i,l){$(i,e,l),N(e,t)},p(i,l){l[0]&1&&n!==(n="#spectrum-icon-18-"+i[0].icon)&&Wt(t,"xlink:href",n)},d(i){i&&b(e)}}}function jce(r){let e,t,n;return{c(){e=D("img"),w(e,"alt",t=ho[r[0].stepId].name),w(e,"width","28px"),w(e,"height","28px"),dn(e.src,n=ho[r[0].stepId].icon)||w(e,"src",n)},m(i,l){$(i,e,l)},p(i,l){l[0]&1&&t!==(t=ho[i[0].stepId].name)&&w(e,"alt",t),l[0]&1&&!dn(e.src,n=ho[i[0].stepId].icon)&&w(e,"src",n)},d(i){i&&b(e)}}}function Bce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[qce]},$$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 zce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[Uce]},$$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 qce(r){let e;return{c(){e=V("Do this:")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Uce(r){let e;return{c(){e=V("When this happens:")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Fce(r){var n,i;let e=(((i=(n=r[0])==null?void 0:n.name)==null?void 0:i.toUpperCase())||"")+"",t;return{c(){t=V(e)},m(l,s){$(l,t,s)},p(l,s){var o,a;s[0]&1&&e!==(e=(((a=(o=l[0])==null?void 0:o.name)==null?void 0:a.toUpperCase())||"")+"")&&Te(t,e)},d(l){l&&b(t)}}}function vy(r){var s,o;let e,t,n,i,l;return t=new t1({props:{positive:r[3]||((s=r[13][0].outputs)==null?void 0:s.success),negative:!((o=r[13][0].outputs)==null?void 0:o.success),$$slots:{default:[Hce]},$$scope:{ctx:r}}}),{c(){e=D("span"),S(t.$$.fragment)},m(a,u){$(a,e,u),A(t,e,null),n=!0,i||(l=Pe(e,"click",r[21]),i=!0)},p(a,u){var c,p;const f={};u[0]&8200&&(f.positive=a[3]||((c=a[13][0].outputs)==null?void 0:c.success)),u[0]&8192&&(f.negative=!((p=a[13][0].outputs)==null?void 0:p.success)),u[1]&2&&(f.$$scope={dirty:u,ctx:a}),t.$set(f)},i(a){n||(m(t.$$.fragment,a),n=!0)},o(a){_(t.$$.fragment,a),n=!1},d(a){a&&b(e),E(t),i=!1,l()}}}function Vce(r){let e;return{c(){e=V("View response")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Hce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[Vce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 wy(r){let e,t,n,i,l;return e=new pn({props:{noMargin:!0}}),i=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[Jce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),w(n,"class","blockSection svelte-oi1qmk")},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[0]&53547|o[1]&2&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},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 Wce(r){let e;return{c(){e=V("Setup")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Gce(r){let e,t;return e=new mr({props:{size:"S",$$slots:{default:[Wce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 yy(r){let e,t,n,i,l,s,o,a=r[14]&&ky(r);return i=new ct({props:{name:"DeleteOutline"}}),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),S(i.$$.fragment),w(n,"class","delete-padding svelte-oi1qmk"),w(e,"class","block-options svelte-oi1qmk")},m(u,f){$(u,e,f),a&&a.m(e,null),N(e,t),N(e,n),A(i,n,null),l=!0,s||(o=Pe(n,"click",r[24]),s=!0)},p(u,f){u[14]?a?(a.p(u,f),f[0]&16384&&m(a,1)):(a=ky(u),a.c(),m(a,1),a.m(e,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(a),m(i.$$.fragment,u),l=!0)},o(u){_(a),_(i.$$.fragment,u),l=!1},d(u){u&&b(e),a&&a.d(),E(i),s=!1,o()}}}function ky(r){let e,t,n;return t=new Xe({props:{quiet:!0,defaultValue:"Use values",autoWidth:!0,value:r[15]?"Use bindings":"Use values",options:["Use values","Use bindings"],placeholder:null}}),t.$on("change",r[17]),{c(){e=D("div"),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l[0]&32768&&(s.value=i[15]?"Use bindings":"Use values"),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 Cy(r){let e,t,n,i;e=new dy({props:{schemaProperties:Object.entries(r[0].schema.inputs.properties),block:r[0],webhookModal:r[5]}});let l=r[12]&&Sy(r);return{c(){S(e.$$.fragment),t=R(),l&&l.c(),n=Ee()},m(s,o){A(e,s,o),$(s,t,o),l&&l.m(s,o),$(s,n,o),i=!0},p(s,o){const a={};o[0]&1&&(a.schemaProperties=Object.entries(s[0].schema.inputs.properties)),o[0]&1&&(a.block=s[0]),o[0]&32&&(a.webhookModal=s[5]),e.$set(a),s[12]?l?(l.p(s,o),o[0]&4096&&m(l,1)):(l=Sy(s),l.c(),m(l,1),l.m(n.parentNode,n)):l&&(te(),_(l,1,1,()=>{l=null}),ne())},i(s){i||(m(e.$$.fragment,s),m(l),i=!0)},o(s){_(e.$$.fragment,s),_(l),i=!1},d(s){E(e,s),s&&b(t),l&&l.d(s),s&&b(n)}}}function Sy(r){let e,t;return e=new gt({props:{cta:!0,$$slots:{default:[Yce]},$$scope:{ctx:r}}}),e.$on("click",r[25]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 Yce(r){let e;return{c(){e=V("Finish and test automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Jce(r){let e,t,n,i,l,s;t=new Jt({props:{quiet:!0,icon:r[8]?"ChevronDown":"ChevronRight",$$slots:{default:[Gce]},$$scope:{ctx:r}}}),t.$on("click",r[23]);let o=!r[3]&&yy(r),a=r[8]&&Cy(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),o&&o.c(),i=R(),a&&a.c(),l=Ee(),w(e,"class","splitHeader svelte-oi1qmk")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),o&&o.m(e,null),$(u,i,f),a&&a.m(u,f),$(u,l,f),s=!0},p(u,f){const c={};f[0]&256&&(c.icon=u[8]?"ChevronDown":"ChevronRight"),f[1]&2&&(c.$$scope={dirty:f,ctx:u}),t.$set(c),u[3]?o&&(te(),_(o,1,1,()=>{o=null}),ne()):o?(o.p(u,f),f[0]&8&&m(o,1)):(o=yy(u),o.c(),m(o,1),o.m(e,null)),u[8]?a?(a.p(u,f),f[0]&256&&m(a,1)):(a=Cy(u),a.c(),m(a,1),a.m(l.parentNode,l)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){s||(m(t.$$.fragment,u),m(o),m(a),s=!0)},o(u){_(t.$$.fragment,u),_(o),_(a),s=!1},d(u){u&&b(e),E(t),o&&o.d(),u&&b(i),a&&a.d(u),u&&b(l)}}}function Qce(r){let e,t;return e=new hce({props:{isTrigger:r[3],testResult:r[13]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&8&&(l.isTrigger=n[3]),i[0]&8192&&(l.testResult=n[13]),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 Xce(r){let e,t,n;function i(s){r[27](s)}let l={blockIdx:r[2]};return r[9]!==void 0&&(l.blockComplete=r[9]),e=new Mce({props:l}),K.push(()=>ce(e,"blockComplete",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o[0]&4&&(a.blockIdx=s[2]),!t&&o[0]&512&&(t=!0,a.blockComplete=s[9],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Kce(r){let e,t;return e=new D1({}),{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 Ay(r){let e;return{c(){e=D("div"),w(e,"class","separator svelte-oi1qmk")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Zce(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H;function Y(be,he){return ho[be[0].stepId]?jce:Dce}let U=Y(r),W=U(r);const G=[zce,Bce],Q=[];function fe(be,he){return be[3]?0:1}o=fe(r),a=Q[o]=G[o](r),f=new mr({props:{size:"S",$$slots:{default:[Fce]},$$scope:{ctx:r}}});let Z=r[13]&&r[13][0]&&vy(r),ee=!r[9]&&wy(r),ae={width:"30%",$$slots:{default:[Qce]},$$scope:{ctx:r}};g=new Et({props:ae}),r[26](g);let _e={width:"30%",$$slots:{default:[Xce]},$$scope:{ctx:r}};v=new Et({props:_e}),r[28](v);let Re={width:"30%",$$slots:{default:[Kce]},$$scope:{ctx:r}};C=new Et({props:Re}),r[29](C),M=new ct({props:{disabled:!r[10],hoverable:!0,name:"AddCircle",size:"S"}}),M.$on("click",r[31]);let $e=(r[3]?r[11]>1:r[2]!==r[11]-2)&&Ay();return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("div"),W.c(),l=R(),s=D("div"),a.c(),u=R(),S(f.$$.fragment),c=R(),Z&&Z.c(),p=R(),ee&&ee.c(),d=R(),S(g.$$.fragment),h=R(),S(v.$$.fragment),k=R(),S(C.$$.fragment),O=R(),T=D("div"),P=R(),S(M.$$.fragment),F=R(),$e&&$e.c(),j=Ee(),w(s,"class","iconAlign svelte-oi1qmk"),w(i,"class","center-items svelte-oi1qmk"),w(n,"class","splitHeader svelte-oi1qmk"),w(t,"class","blockSection svelte-oi1qmk"),w(e,"class",I=""+(sr(`block ${r[0].type} hoverable`)+" svelte-oi1qmk")),oe(e,"selected",r[4]),w(T,"class","separator svelte-oi1qmk")},m(be,he){$(be,e,he),N(e,t),N(t,n),N(n,i),W.m(i,null),N(i,l),N(i,s),Q[o].m(s,null),N(s,u),A(f,s,null),N(n,c),Z&&Z.m(n,null),N(e,p),ee&&ee.m(e,null),N(e,d),A(g,e,null),N(e,h),A(v,e,null),N(e,k),A(C,e,null),$(be,O,he),$(be,T,he),$(be,P,he),A(M,be,he),$(be,F,he),$e&&$e.m(be,he),$(be,j,he),z=!0,q||(H=[Pe(n,"click",r[22]),Pe(e,"click",r[30])],q=!0)},p(be,he){U===(U=Y(be))&&W?W.p(be,he):(W.d(1),W=U(be),W&&(W.c(),W.m(i,l)));let Ne=o;o=fe(be),o!==Ne&&(te(),_(Q[Ne],1,1,()=>{Q[Ne]=null}),ne(),a=Q[o],a||(a=Q[o]=G[o](be),a.c()),m(a,1),a.m(s,u));const Fe={};he[0]&1|he[1]&2&&(Fe.$$scope={dirty:he,ctx:be}),f.$set(Fe),be[13]&&be[13][0]?Z?(Z.p(be,he),he[0]&8192&&m(Z,1)):(Z=vy(be),Z.c(),m(Z,1),Z.m(n,null)):Z&&(te(),_(Z,1,1,()=>{Z=null}),ne()),be[9]?ee&&(te(),_(ee,1,1,()=>{ee=null}),ne()):ee?(ee.p(be,he),he[0]&512&&m(ee,1)):(ee=wy(be),ee.c(),m(ee,1),ee.m(e,d));const se={};he[0]&8200|he[1]&2&&(se.$$scope={dirty:he,ctx:be}),g.$set(se);const Ce={};he[0]&516|he[1]&2&&(Ce.$$scope={dirty:he,ctx:be}),v.$set(Ce);const me={};he[1]&2&&(me.$$scope={dirty:he,ctx:be}),C.$set(me),(!z||he[0]&1&&I!==(I=""+(sr(`block ${be[0].type} hoverable`)+" svelte-oi1qmk")))&&w(e,"class",I),he[0]&17&&oe(e,"selected",be[4]);const ke={};he[0]&1024&&(ke.disabled=!be[10]),M.$set(ke),(be[3]?be[11]>1:be[2]!==be[11]-2)?$e||($e=Ay(),$e.c(),$e.m(j.parentNode,j)):$e&&($e.d(1),$e=null)},i(be){z||(m(a),m(f.$$.fragment,be),m(Z),m(ee),m(g.$$.fragment,be),m(v.$$.fragment,be),m(C.$$.fragment,be),m(M.$$.fragment,be),z=!0)},o(be){_(a),_(f.$$.fragment,be),_(Z),_(ee),_(g.$$.fragment,be),_(v.$$.fragment,be),_(C.$$.fragment,be),_(M.$$.fragment,be),z=!1},d(be){be&&b(e),W.d(),Q[o].d(),E(f),Z&&Z.d(),ee&&ee.d(),r[26](null),E(g),r[28](null),E(v),r[29](null),E(C),be&&b(O),be&&b(T),be&&b(P),E(M,be),be&&b(F),$e&&$e.d(be),be&&b(j),q=!1,Tn(H)}}}function xce(r,e,t){let n,i,l,s,o,a,u,f,c,p;ue(r,Zt,Z=>t(20,p=Z));let{block:d}=e,{testDataModal:g}=e,h,v,k,C,I,O;async function T(){var Z;try{Zt.actions.deleteAutomationBlock(d),await Zt.actions.save((Z=p.selectedAutomation)==null?void 0:Z.automation)}catch{we.error("Error saving notification")}}function P(Z){var ae;M(d);let ee;Z.detail==="Use values"?ee=!1:ee=!0,Zt.actions.toggleFieldControl(ee),Zt.actions.save((ae=p.selectedAutomation)==null?void 0:ae.automation)}async function M(Z){await Zt.update(ee=>(ee.selectedBlock=Z,ee))}const F=()=>C.show(),j=()=>{t(9,O=!O)},z=()=>{M(d),t(8,I=!I)},q=()=>T(),H=()=>g.show();function Y(Z){K[Z?"unshift":"push"](()=>{C=Z,t(7,C)})}function U(Z){O=Z,t(9,O)}function W(Z){K[Z?"unshift":"push"](()=>{k=Z,t(6,k)})}function G(Z){K[Z?"unshift":"push"](()=>{v=Z,t(5,v)})}const Q=()=>{M(d)},fe=()=>k.show();return r.$$set=Z=>{"block"in Z&&t(0,d=Z.block),"testDataModal"in Z&&t(1,g=Z.testDataModal)},r.$$.update=()=>{var Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se;r.$$.dirty[0]&1048576&&t(15,n=p.selectedAutomation.automation.rowControl),r.$$.dirty[0]&1&&t(14,i=d.stepId==="CREATE_ROW"||d.stepId==="UPDATE_ROW"),r.$$.dirty[0]&1048577&&t(13,l=(Z=p.selectedAutomation.testResults)==null?void 0:Z.steps.filter(Ce=>d.id?Ce.id===d.id:Ce.stepId===d.stepId)),r.$$.dirty[0]&1&&t(3,s=d.type==="TRIGGER"),r.$$.dirty[0]&1048577&&t(4,h=((ee=p.selectedBlock)==null?void 0:ee.id)===d.id),r.$$.dirty[0]&1048576&&t(19,o=($e=(Re=(_e=(ae=p.selectedAutomation)==null?void 0:ae.automation)==null?void 0:_e.definition)==null?void 0:Re.steps)!=null?$e:[]),r.$$.dirty[0]&524289&&t(2,a=o.findIndex(Ce=>Ce.id===d.id)),r.$$.dirty[0]&524300&&t(12,u=!s&&a+1===o.length),r.$$.dirty[0]&1048576&&t(11,f=((Ne=(he=(be=p.selectedAutomation)==null?void 0:be.automation)==null?void 0:he.definition)==null?void 0:Ne.steps.length)+1),r.$$.dirty[0]&1&&t(10,c=Object.keys(((se=(Fe=d.schema)==null?void 0:Fe.inputs)==null?void 0:se.properties)||{}).every(Ce=>d==null?void 0:d.inputs[Ce]))},[d,g,a,s,h,v,k,C,I,O,c,f,u,l,i,n,T,P,M,o,p,F,j,z,q,H,Y,U,W,G,Q,fe]}class epe extends ie{constructor(e){super();le(this,e,xce,Zce,re,{block:0,testDataModal:1},null,[-1,-1])}}function tpe(r){let e,t,n;return t=new dy({props:{testData:r[1],schemaProperties:r[4],isTestModal:!0,block:r[0]}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","tab-content-padding svelte-qrwx8s")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&2&&(s.testData=i[1]),l&16&&(s.schemaProperties=i[4]),l&1&&(s.block=i[0]),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 npe(r){let e;return{c(){e=V("JSON")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function rpe(r){let e,t,n,i,l,s;return t=new Ze({props:{$$slots:{default:[npe]},$$scope:{ctx:r}}}),l=new pi({props:{value:JSON.stringify(r[2].selectedAutomation.automation.testData,null,2),error:r[3]}}),l.$on("change",r[8]),{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),w(i,"class","text-area-container svelte-qrwx8s"),w(e,"class","tab-content-padding svelte-qrwx8s")},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){const u={};a&512&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};a&4&&(f.value=JSON.stringify(o[2].selectedAutomation.automation.testData,null,2)),a&8&&(f.error=o[3]),l.$set(f)},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 ipe(r){let e,t,n,i;return e=new bn({props:{icon:"Form",title:"Form",$$slots:{default:[tpe]},$$scope:{ctx:r}}}),n=new bn({props:{icon:"FileJson",title:"JSON",$$slots:{default:[rpe]},$$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&531&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&524&&(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 lpe(r){let e,t;return e=new Vr({props:{selected:"Form",quiet:!0,$$slots:{default:[ipe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&543&&(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 spe(r){let e,t;return e=new Dt({props:{title:"Add test data",confirmText:"Test",showConfirmButton:!0,disabled:r[5],onConfirm:r[7],cancelText:"Cancel",$$slots:{default:[lpe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&32&&(l.disabled=n[5]),i&543&&(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 ope(r,e,t){let n,i,l;ue(r,Zt,p=>t(2,l=p));let s=null,o={},a={};l.selectedAutomation.automation.testData||Rn(Zt,l.selectedAutomation.automation.testData={},l);function u(p){try{const d=JSON.parse(p.detail);t(3,s=null),Zt.actions.addTestDataToAutomation(d)}catch{t(3,s="Invalid JSON")}}const f=async()=>{var p;try{await Zt.actions.test((p=l.selectedAutomation)==null?void 0:p.automation,n)}catch{we.error("Error testing notification")}},c=p=>u(p);return r.$$.update=()=>{var p,d;r.$$.dirty&4&&t(0,o=vn.cloneDeep(l.selectedAutomation.automation.definition.trigger)),r.$$.dirty&1&&t(4,a=Object.entries((d=(p=o==null?void 0:o.schema)==null?void 0:p.outputs)==null?void 0:d.properties)),r.$$.dirty&4&&t(1,n=l.selectedAutomation.automation.testData||{}),r.$$.dirty&3&&t(5,i=!o.schema.outputs.required.every(g=>n[g]||g!=="row"))},[o,n,l,s,a,i,u,f,c]}class ape extends ie{constructor(e){super();le(this,e,ope,spe,re,{})}}function Ey(r,e,t){const n=r.slice();return n[9]=e[t],n[11]=t,n}function upe(r){let e=r[0].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function fpe(r){let e;return{c(){e=V("Run test")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Oy(r,e){let t,n,i,l,s,o=Oe,a;return n=new epe({props:{testDataModal:e[2],block:e[9]}}),{key:r,first:null,c(){t=D("div"),S(n.$$.fragment),i=R(),w(t,"class","block svelte-1ckypie"),this.first=t},m(u,f){$(u,t,f),A(n,t,null),N(t,i),a=!0},p(u,f){e=u;const c={};f&4&&(c.testDataModal=e[2]),f&2&&(c.block=e[9]),n.$set(c)},r(){s=t.getBoundingClientRect()},f(){zo(t),o()},a(){o(),o=qo(t,s,Uo,{duration:500})},i(u){a||(m(n.$$.fragment,u),u&&(l||fi(()=>{l=Cu(t,Jr,{x:500,duration:1500}),l.start()})),a=!0)},o(u){_(n.$$.fragment,u),a=!1},d(u){u&&b(t),E(n)}}}function cpe(r){let e,t,n=r[0].name+"",i,l,s;return{c(){e=V(`Are you sure you wish to delete the automation
|
|
1237
|
+
your later actions!`,t=R(),S(n.$$.fragment),i=R(),o&&o.c(),l=Ee(),w(e,"class","svelte-12gur68")},m(a,u){$(a,e,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&2&&(f.value=a[1]),n.$set(f),a[0]?o?o.p(a,u):(o=ny(a),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null)},i(a){s||(m(n.$$.fragment,a),s=!0)},o(a){_(n.$$.fragment,a),s=!1},d(a){a&&b(e),a&&b(t),E(n,a),a&&b(i),o&&o.d(a),a&&b(l)}}}function lfe(r){let e,t,n,i,l;return t=new ct({props:{name:"InfoOutline"}}),{c(){e=D("a"),S(t.$$.fragment),n=R(),i=D("span"),i.textContent="Learn about webhooks",w(i,"class","svelte-12gur68"),w(e,"slot","footer"),w(e,"target","_blank"),w(e,"href","https://docs.budibase.com/docs/trigger"),w(e,"class","svelte-12gur68")},m(s,o){$(s,e,o),A(t,e,null),N(e,n),N(e,i),l=!0},p:Oe,i(s){l||(m(t.$$.fragment,s),l=!0)},o(s){_(t.$$.fragment,s),l=!1},d(s){s&&b(e),E(t)}}}function sfe(r){let e,t;return e=new Dt({props:{title:"Webhook Setup",confirmText:"Finished",showConfirmButton:r[0],cancelText:"Skip",$$slots:{footer:[lfe],default:[ife]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.showConfirmButton=n[0]),i&71&&(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)}}}const ofe=2500;function afe(r,e,t){let n,i;ue(r,Zt,u=>t(3,i=u));let l,s=!1,o,a=0;return Gt(async()=>{var u,f,c,p;if(!((f=(u=n==null?void 0:n.definition)==null?void 0:u.trigger)==null?void 0:f.inputs.schemaUrl))try{await Zt.actions.save(n)}catch{we.error("Error saving automation")}l=setInterval(async()=>{var d,g;try{await Zt.actions.fetch();const h=(g=(d=n==null?void 0:n.definition)==null?void 0:d.trigger.schema.outputs)==null?void 0:g.properties;Object.keys(h).length>1&&(t(2,a=Object.keys(h).length-1),t(0,s=!0))}catch{we.error("Error getting automations list")}},ofe),t(1,o=(p=(c=n==null?void 0:n.definition)==null?void 0:c.trigger)==null?void 0:p.inputs.schemaUrl)}),gp(()=>{clearInterval(l)}),r.$$.update=()=>{var u;r.$$.dirty&8&&(n=(u=i.selectedAutomation)==null?void 0:u.automation)},[s,o,a,i]}class D1 extends ie{constructor(e){super();le(this,e,afe,sfe,re,{})}}function ufe(r){let e,t;const n=r[3].default,i=bt(n,r,r[5],null);return{c(){e=D("div"),i&&i.c(),w(e,"class","container svelte-1pjf6q5")},m(l,s){$(l,e,s),i&&i.m(e,null),t=!0},p(l,s){i&&i.p&&(!t||s&32)&&vt(i,n,l,l[5],t?yt(n,l[5],s,null):wt(l[5]),null)},i(l){t||(m(i,l),t=!0)},o(l){_(i,l),t=!1},d(l){l&&b(e),i&&i.d(l)}}}function ffe(r){let e,t;return e=new Dt({props:{size:"XL",title:"Edit Code",showConfirmButton:!1,showCancelButton:!1,$$slots:{default:[ufe]},$$scope:{ctx:r}}}),{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 cfe(r){let e;return{c(){e=V("Edit Code")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function pfe(r){let e,t,n,i,l={$$slots:{default:[ffe]},$$scope:{ctx:r}};return e=new Et({props:l}),r[4](e),n=new gt({props:{primary:!0,$$slots:{default:[cfe]},$$scope:{ctx:r}}}),n.$on("click",r[0]),{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&32&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&32&&(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){r[4](null),E(e,s),s&&b(t),E(n,s)}}}function dfe(r,e,t){let{$$slots:n={},$$scope:i}=e,l;const s=()=>{l.show()},o=()=>{l.hide()};function a(u){K[u?"unshift":"push"](()=>{l=u,t(1,l)})}return r.$$set=u=>{"$$scope"in u&&t(5,i=u.$$scope)},[s,l,o,n,a,i]}class mfe extends ie{constructor(e){super();le(this,e,dfe,pfe,re,{show:0,hide:2})}get show(){return this.$$.ctx[0]}get hide(){return this.$$.ctx[2]}}function ry(r,e,t){const n=r.slice();return n[4]=e[t],n}function iy(r){let e,t=r[4].name+"",n,i;return{c(){e=D("option"),n=V(t),e.__value=i=r[4]._id,e.value=e.__value},m(l,s){$(l,e,s),N(e,n)},p(l,s){s&2&&t!==(t=l[4].name+"")&&Te(n,t),s&2&&i!==(i=l[4]._id)&&(e.__value=i,e.value=e.__value)},d(l){l&&b(e)}}}function gfe(r){let e,t,n,i=r[1].list,l=[];for(let s=0;s<i.length;s+=1)l[s]=iy(ry(r,i,s));return{c(){e=D("option"),e.textContent="Choose an option",t=R();for(let s=0;s<l.length;s+=1)l[s].c();n=Ee(),e.__value="",e.value=e.__value},m(s,o){$(s,e,o),$(s,t,o);for(let a=0;a<l.length;a+=1)l[a].m(s,o);$(s,n,o)},p(s,o){if(o&2){i=s[1].list;let a;for(a=0;a<i.length;a+=1){const u=ry(s,i,a);l[a]?l[a].p(u,o):(l[a]=iy(u),l[a].c(),l[a].m(n.parentNode,n))}for(;a<l.length;a+=1)l[a].d(1);l.length=i.length}},d(s){s&&b(e),s&&b(t),$t(l,s),s&&b(n)}}}function _fe(r){let e,t,n,i;function l(o){r[2](o)}let s={secondary:!0,extraThin:!0,$$slots:{default:[gfe]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.value=r[0]),t=new Xe({props:s}),K.push(()=>ce(t,"value",l)),t.$on("change",r[3]),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","block-field")},m(o,a){$(o,e,a),A(t,e,null),i=!0},p(o,[a]){const u={};a&130&&(u.$$scope={dirty:a,ctx:o}),!n&&a&1&&(n=!0,u.value=o[0],pe(()=>n=!1)),t.$set(u)},i(o){i||(m(t.$$.fragment,o),i=!0)},o(o){_(t.$$.fragment,o),i=!1},d(o){o&&b(e),E(t)}}}function hfe(r,e,t){let n;ue(r,kn,o=>t(1,n=o));let{value:i}=e;function l(o){i=o,t(0,i)}function s(o){ft.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,i=o.value)},[i,n,l,s]}class $fe extends ie{constructor(e){super();le(this,e,hfe,_fe,re,{value:0})}}function ly(r,e,t){const n=r.slice();return n[9]=e[t],n}function sy(r){let e,t,n=r[3],i=[];for(let s=0;s<n.length;s+=1)i[s]=oy(ly(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();w(e,"class","schema-fields svelte-baq95m")},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&43){n=s[3];let a;for(a=0;a<n.length;a+=1){const u=ly(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=oy(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(te(),a=n.length;a<i.length;a+=1)l(a);ne()}},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),$t(i,s)}}}function oy(r){let e,t;function n(...i){return r[7](r[9],...i)}return e=new Un({props:{panel:xi,extraThin:!0,value:r[0][r[9].name],label:r[9].name,type:"string",bindings:r[1],fillWidth:!0,allowJS:!1}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l&9&&(s.value=r[0][r[9].name]),l&8&&(s.label=r[9].name),l&2&&(s.bindings=r[1]),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 bfe(r){let e,t,n,i,l;t=new Xe({props:{label:"Query",value:r[0].queryId,options:r[2].list,getOptionValue:vfe,getOptionLabel:wfe}}),t.$on("change",r[4]);let s=r[3].length&&sy(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),s&&s.c(),i=Ee(),w(e,"class","block-field")},m(o,a){$(o,e,a),A(t,e,null),$(o,n,a),s&&s.m(o,a),$(o,i,a),l=!0},p(o,[a]){const u={};a&1&&(u.value=o[0].queryId),a&4&&(u.options=o[2].list),t.$set(u),o[3].length?s?(s.p(o,a),a&8&&m(s,1)):(s=sy(o),s.c(),m(s,1),s.m(i.parentNode,i)):s&&(te(),_(s,1,1,()=>{s=null}),ne())},i(o){l||(m(t.$$.fragment,o),m(s),l=!0)},o(o){_(t.$$.fragment,o),_(s),l=!1},d(o){o&&b(e),E(t),o&&b(n),s&&s.d(o),o&&b(i)}}}const vfe=r=>r._id,wfe=r=>r.name;function yfe(r,e,t){let n,i,l;ue(r,kn,p=>t(2,l=p));const s=ht();let{value:o}=e,{bindings:a}=e;const u=p=>{t(0,o.queryId=p.detail,o),s("change",o)},f=(p,d)=>{t(0,o[d.name]=p.detail,o),s("change",o)},c=(p,d)=>f(d,p);return r.$$set=p=>{"value"in p&&t(0,o=p.value),"bindings"in p&&t(1,a=p.bindings)},r.$$.update=()=>{var p;r.$$.dirty&1&&(o==null?void 0:o.queryId)==null&&t(0,o={queryId:""}),r.$$.dirty&5&&t(6,n=l.list.find(d=>d._id===(o==null?void 0:o.queryId))),r.$$.dirty&64&&t(3,i=(p=n==null?void 0:n.parameters)!=null?p:[])},[o,a,l,i,u,f,n,c]}class kfe extends ie{constructor(e){super();le(this,e,yfe,bfe,re,{value:0,bindings:1})}}function Cfe(r){let e=(r[1]?"Hide":"Show")+"",t,n;return{c(){t=V(e),n=V(" Presets")},m(i,l){$(i,t,l),$(i,n,l)},p(i,l){l&2&&e!==(e=(i[1]?"Hide":"Show")+"")&&Te(t,e)},d(i){i&&b(t),i&&b(n)}}}function ay(r){let e,t;return e=new Xe({props:{value:r[0],secondary:!0,extraThin:!0,label:"Presets",options:r[3]}}),e.$on("change",r[2]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.value=n[0]),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 Sfe(r){let e,t,n,i,l,s,o;t=new tt({props:{value:r[0]}}),t.$on("change",r[2]),l=new gt({props:{$$slots:{default:[Cfe]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let a=r[1]&&ay(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),s=R(),a&&a.c(),w(i,"class","presets svelte-1cg6p40"),w(e,"class","block-field svelte-1cg6p40")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),N(e,i),A(l,i,null),N(i,s),a&&a.m(i,null),o=!0},p(u,[f]){const c={};f&1&&(c.value=u[0]),t.$set(c);const p={};f&66&&(p.$$scope={dirty:f,ctx:u}),l.$set(p),u[1]?a?(a.p(u,f),f&2&&m(a,1)):(a=ay(u),a.c(),m(a,1),a.m(i,null)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){o||(m(t.$$.fragment,u),m(l.$$.fragment,u),m(a),o=!0)},o(u){_(t.$$.fragment,u),_(l.$$.fragment,u),_(a),o=!1},d(u){u&&b(e),E(t),E(l),a&&a.d()}}}function Afe(r,e,t){const n=ht();let{value:i}=e;const l=u=>{t(0,i=u.detail),n("change",u.detail)};let s=!1;const o=[{label:"Every Minute",value:"* * * * *"},{label:"Every Hour",value:"0 * * * *"},{label:"Every Morning at 8AM",value:"0 8 * * *"},{label:"Every Night at Midnight",value:"0 0 * * *"},{label:"Every Budibase Reboot",value:"@reboot"}],a=()=>t(1,s=!s);return r.$$set=u=>{"value"in u&&t(0,i=u.value)},[i,s,l,o,a]}class Efe extends ie{constructor(e){super();le(this,e,Afe,Sfe,re,{value:0})}}function uy(r,e,t){const n=r.slice();return n[43]=e[t][0],n[44]=e[t][1],n}function Ofe(r){let e=(r[44].title||(r[43]==="row"?"Table":r[43]))+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i[0]&2&&e!==(e=(n[44].title||(n[43]==="row"?"Table":n[43]))+"")&&Te(t,e)},d(n){n&&b(t)}}}function Tfe(r){let e,t,n,i;const l=[Hfe,Vfe],s=[];function o(a,u){return a[2]?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function Ife(r){let e,t;return e=new mfe({props:{$$slots:{default:[Yfe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&2314|i[1]&65536&&(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 Lfe(r){let e,t;function n(...i){return r[34](r[43],...i)}return e=new xue({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Pfe(r){let e,t;function n(...i){return r[33](r[43],...i)}return e=new ty({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Nfe(r){let e,t;function n(...i){return r[32](r[43],...i)}return e=new Xue({props:{block:r[0],value:r[3][r[43]],bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&1&&(s.block=r[0]),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Rfe(r){let e,t;function n(...i){return r[31](r[43],...i)}return e=new Iue({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Mfe(r){let e,t;function n(...i){return r[30](r[43],...i)}return e=new kfe({props:{value:r[3][r[43]],bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Dfe(r){let e,t;function n(...i){return r[29](r[43],...i)}return e=new Efe({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 jfe(r){let e,t;function n(...i){return r[28](r[43],...i)}return e=new $fe({props:{value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 Bfe(r){let e,t,n,i;const l=[Qfe,Jfe],s=[];function o(a,u){return a[2]?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){let f=e;e=o(a),e===f?s[e].p(a,u):(te(),_(s[f],1,1,()=>{s[f]=null}),ne(),t=s[e],t?t.p(a,u):(t=s[e]=l[e](a),t.c()),m(t,1),t.m(n.parentNode,n))},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function zfe(r){let e,t;function n(...i){return r[25](r[43],...i)}return e=new tt({props:{type:"password",value:r[3][r[43]]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),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 qfe(r){let e,t,n,i;e=new Jt({props:{$$slots:{default:[Xfe]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[6].show)&&r[6].show.apply(this,arguments)});let l={fillWidth:rce,title:"Filtering",$$slots:{body:[xfe],buttons:[Zfe]},$$scope:{ctx:r}};return n=new Kr({props:l}),r[24](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[1]&65536&&(a.$$scope={dirty:o,ctx:r}),e.$set(a);const u={};o[0]&3202|o[1]&65536&&(u.$$scope={dirty:o,ctx:r}),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[24](null),E(n,s)}}}function Ufe(r){let e,t;function n(...i){return r[21](r[43],...i)}return e=new Xe({props:{value:r[3][r[43]],options:Object.keys(r[4].schema)}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&10&&(s.value=r[3][r[43]]),l[0]&16&&(s.options=Object.keys(r[4].schema)),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 Ffe(r){let e,t;function n(...l){return r[19](r[44],...l)}function i(...l){return r[20](r[43],...l)}return e=new Xe({props:{value:r[3][r[43]],options:r[44].enum,getOptionLabel:n}}),e.$on("change",i),{c(){S(e.$$.fragment)},m(l,s){A(e,l,s),t=!0},p(l,s){r=l;const o={};s[0]&10&&(o.value=r[3][r[43]]),s[0]&2&&(o.options=r[44].enum),s[0]&2&&(o.getOptionLabel=n),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){E(e,l)}}}function Vfe(r){let e,t,n;function i(...l){return r[38](r[43],...l)}return t=new Un({props:{fillWidth:!0,title:r[44].title,panel:xi,type:r[44].customType,value:r[3][r[43]],bindings:r[11]}}),t.$on("change",i),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","test svelte-dv1cdv")},m(l,s){$(l,e,s),A(t,e,null),n=!0},p(l,s){r=l;const o={};s[0]&2&&(o.title=r[44].title),s[0]&2&&(o.type=r[44].customType),s[0]&10&&(o.value=r[3][r[43]]),s[0]&2048&&(o.bindings=r[11]),t.$set(o)},i(l){n||(m(t.$$.fragment,l),n=!0)},o(l){_(t.$$.fragment,l),n=!1},d(l){l&&b(e),E(t)}}}function Hfe(r){let e,t;function n(...i){return r[37](r[43],...i)}return e=new h1({props:{title:r[44].title,value:r[3][r[43]],panel:xi,type:r[44].customType,bindings:r[11]}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2&&(s.type=r[44].customType),l[0]&2048&&(s.bindings=r[11]),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 Wfe(r){let e;return{c(){e=V("Bindings")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Gfe(r){let e,t;return e=new mr({props:{size:"S",$$slots:{default:[Wfe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&65536&&(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 fy(r){let e,t=JSON.stringify(r[11],null,2)+"",n;return{c(){e=D("pre"),n=V(t)},m(i,l){$(i,e,l),N(e,n)},p(i,l){l[0]&2048&&t!==(t=JSON.stringify(i[11],null,2)+"")&&Te(n,t)},d(i){i&&b(e)}}}function Yfe(r){let e,t,n,i,l;e=new Jt({props:{quiet:!0,icon:r[8]?"ChevronDown":"ChevronRight",$$slots:{default:[Gfe]},$$scope:{ctx:r}}}),e.$on("click",r[35]);let s=r[8]&&fy(r);function o(...a){return r[36](r[43],...a)}return i=new Zl({props:{mode:"javascript",value:r[3][r[43]]}}),i.$on("change",o),{c(){S(e.$$.fragment),t=R(),s&&s.c(),n=R(),S(i.$$.fragment)},m(a,u){A(e,a,u),$(a,t,u),s&&s.m(a,u),$(a,n,u),A(i,a,u),l=!0},p(a,u){r=a;const f={};u[0]&256&&(f.icon=r[8]?"ChevronDown":"ChevronRight"),u[1]&65536&&(f.$$scope={dirty:u,ctx:r}),e.$set(f),r[8]?s?s.p(r,u):(s=fy(r),s.c(),s.m(n.parentNode,n)):s&&(s.d(1),s=null);const c={};u[0]&10&&(c.value=r[3][r[43]]),i.$set(c)},i(a){l||(m(e.$$.fragment,a),m(i.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(i.$$.fragment,a),l=!1},d(a){E(e,a),a&&b(t),s&&s.d(a),a&&b(n),E(i,a)}}}function Jfe(r){let e,t;function n(...i){return r[27](r[43],...i)}return e=new Un({props:{fillWidth:!0,title:r[44].title,panel:xi,type:"email",value:r[3][r[43]],bindings:r[11],allowJS:!1}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Qfe(r){let e,t;function n(...i){return r[26](r[43],...i)}return e=new h1({props:{title:r[44].title,value:r[3][r[43]],panel:xi,type:"email",bindings:r[11],fillWidth:!0}}),e.$on("change",n),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,l){r=i;const s={};l[0]&2&&(s.title=r[44].title),l[0]&10&&(s.value=r[3][r[43]]),l[0]&2048&&(s.bindings=r[11]),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 Xfe(r){let e;return{c(){e=V("Define filters")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Kfe(r){let e;return{c(){e=V("Save")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Zfe(r){let e,t;function n(){return r[23](r[43])}return e=new gt({props:{cta:!0,slot:"buttons",$$slots:{default:[Kfe]},$$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]&65536&&(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 xfe(r){let e,t,n;function i(s){r[22](s)}let l={slot:"body",bindings:r[11],schemaFields:r[10],panel:xi};return r[7]!==void 0&&(l.filters=r[7]),e=new k1({props:l}),K.push(()=>ce(e,"filters",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o[0]&2048&&(a.bindings=s[11]),o[0]&1024&&(a.schemaFields=s[10]),!t&&o[0]&128&&(t=!0,a.filters=s[7],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function cy(r){let e,t,n,i,l,s,o;t=new Ze({props:{$$slots:{default:[Ofe]},$$scope:{ctx:r}}});const a=[Ffe,Ufe,qfe,zfe,Bfe,jfe,Dfe,Mfe,Rfe,Nfe,Pfe,Lfe,Ife,Tfe],u=[];function f(c,p){return c[44].type==="string"&&c[44].enum?0:c[44].customType==="column"?1:c[44].customType==="filters"?2:c[44].customType==="password"?3:c[44].customType==="email"?4:c[44].customType==="query"?5:c[44].customType==="cron"?6:c[44].customType==="queryParams"?7:c[44].customType==="table"?8:c[44].customType==="row"?9:c[44].customType==="webhookUrl"?10:c[44].customType==="triggerSchema"?11:c[44].customType==="code"?12:c[44].type==="string"||c[44].type==="number"||c[44].type==="integer"?13:-1}return~(i=f(r))&&(l=u[i]=a[i](r)),{c(){e=D("div"),S(t.$$.fragment),n=R(),l&&l.c(),s=R(),w(e,"class","block-field svelte-dv1cdv")},m(c,p){$(c,e,p),A(t,e,null),N(e,n),~i&&u[i].m(e,null),N(e,s),o=!0},p(c,p){const d={};p[0]&2|p[1]&65536&&(d.$$scope={dirty:p,ctx:c}),t.$set(d);let g=i;i=f(c),i===g?~i&&u[i].p(c,p):(l&&(te(),_(u[g],1,1,()=>{u[g]=null}),ne()),~i?(l=u[i],l?l.p(c,p):(l=u[i]=a[i](c),l.c()),m(l,1),l.m(e,s)):l=null)},i(c){o||(m(t.$$.fragment,c),m(l),o=!0)},o(c){_(t.$$.fragment,c),_(l),o=!1},d(c){c&&b(e),E(t),~i&&u[i].d()}}}function ece(r){let e,t;return e=new D1({}),{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 py(r){let e,t;return e=new gt({props:{secondary:!0,$$slots:{default:[tce]},$$scope:{ctx:r}}}),e.$on("click",r[40]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&65536&&(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 tce(r){let e;return{c(){e=V("Set Up Webhook")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function nce(r){let e,t,n,i,l,s,o=r[1],a=[];for(let p=0;p<o.length;p+=1)a[p]=cy(uy(r,o,p));const u=p=>_(a[p],1,1,()=>{a[p]=null});let f={width:"30%",$$slots:{default:[ece]},$$scope:{ctx:r}};n=new Et({props:f}),r[39](n);let c=r[9]==="WEBHOOK"&&py(r);return{c(){e=D("div");for(let p=0;p<a.length;p+=1)a[p].c();t=R(),S(n.$$.fragment),i=R(),c&&c.c(),l=Ee(),w(e,"class","fields svelte-dv1cdv")},m(p,d){$(p,e,d);for(let g=0;g<a.length;g+=1)a[g].m(e,null);$(p,t,d),A(n,p,d),$(p,i,d),c&&c.m(p,d),$(p,l,d),s=!0},p(p,d){if(d[0]&15839){o=p[1];let h;for(h=0;h<o.length;h+=1){const v=uy(p,o,h);a[h]?(a[h].p(v,d),m(a[h],1)):(a[h]=cy(v),a[h].c(),m(a[h],1),a[h].m(e,null))}for(te(),h=o.length;h<a.length;h+=1)u(h);ne()}const g={};d[1]&65536&&(g.$$scope={dirty:d,ctx:p}),n.$set(g),p[9]==="WEBHOOK"?c?(c.p(p,d),d[0]&512&&m(c,1)):(c=py(p),c.c(),m(c,1),c.m(l.parentNode,l)):c&&(te(),_(c,1,1,()=>{c=null}),ne())},i(p){if(!s){for(let d=0;d<o.length;d+=1)m(a[d]);m(n.$$.fragment,p),m(c),s=!0}},o(p){a=a.filter(Boolean);for(let d=0;d<a.length;d+=1)_(a[d]);_(n.$$.fragment,p),_(c),s=!1},d(p){p&&b(e),$t(a,p),p&&b(t),r[39](null),E(n,p),p&&b(i),c&&c.d(p),p&&b(l)}}}let rce=!0;function ice(r,e,t){let n,i,l,s,o,a,u,f,c;ue(r,Zt,Ce=>t(17,f=Ce)),ue(r,Ot,Ce=>t(18,c=Ce));let{block:p}=e,{testData:d}=e,{schemaProperties:g}=e,{isTestModal:h=!1}=e,v,k,C=P(g)||[],I=!1;const O=jl.exports.debounce(async function(Ce,me){var ke,ze;try{h?(n==="WEBHOOK"&&Zt.actions.addTestDataToAutomation({body:Se({[me]:Ce.detail},f.selectedAutomation.automation.testData.body)}),Zt.actions.addTestDataToAutomation({[me]:Ce.detail}),t(14,d[me]=Ce.detail,d),await Zt.actions.save((ke=f.selectedAutomation)==null?void 0:ke.automation)):(t(0,p.inputs[me]=Ce.detail,p),await Zt.actions.save((ze=f.selectedAutomation)==null?void 0:ze.automation))}catch{we.error("Error saving automation")}},800);function T(Ce,me){var Je,Nt,qe;if(!Ce||!me)return[];let ke=[...me.steps];me.trigger&&(ke=[me.trigger,...ke]);const ze=ke.findIndex(pt=>pt.id===Ce.id);let ye=[];for(let pt=0;pt<ze;pt++){const Rt=Object.entries((qe=(Nt=(Je=ke[pt].schema)==null?void 0:Je.outputs)==null?void 0:Nt.properties)!=null?qe:{});ye=ye.concat(Rt.map(([Ie,Ge])=>{const Ue=pt===0?`trigger.${Ie}`:`steps.${pt}.${Ie}`;return{label:Ue,type:Ge.type,description:Ge.description,category:pt===0?"Trigger outputs":`Step ${pt} outputs`,path:Ue}}))}return ye}function P(Ce){if(!Ce)return[];let me;const ke=d||p.inputs;for(let[ze,ye]of Ce){const Je=`${ze}-def`;if(ye.customType==="filters"&&(ke==null?void 0:ke[Je])){me=ke[Je];break}}return me||[]}function M(Ce){const me=u3(C),ke=`${Ce}-def`;t(3,l[Ce]=me,l),t(3,l[ke]=C,l),O({detail:me},Ce),O({detail:C},ke),k.hide()}const F=(Ce,me,ke)=>Ce.pretty?Ce.pretty[ke]:me,j=(Ce,me)=>O(me,Ce),z=(Ce,me)=>O(me,Ce);function q(Ce){C=Ce,t(7,C)}const H=Ce=>M(Ce);function Y(Ce){K[Ce?"unshift":"push"](()=>{k=Ce,t(6,k)})}const U=(Ce,me)=>O(me,Ce),W=(Ce,me)=>O(me,Ce),G=(Ce,me)=>O(me,Ce),Q=(Ce,me)=>O(me,Ce),fe=(Ce,me)=>O(me,Ce),Z=(Ce,me)=>O(me,Ce),ee=(Ce,me)=>O(me,Ce),ae=(Ce,me)=>O(me,Ce),_e=(Ce,me)=>O(me,Ce),Re=(Ce,me)=>O(me,Ce),$e=()=>t(8,I=!I),be=(Ce,me)=>{O({detail:me.detail.value},Ce),t(3,l[Ce]=me.detail.value,l)},he=(Ce,me)=>O(me,Ce),Ne=(Ce,me)=>O(me,Ce);function Fe(Ce){K[Ce?"unshift":"push"](()=>{v=Ce,t(5,v)})}const se=()=>v.show();return r.$$set=Ce=>{"block"in Ce&&t(0,p=Ce.block),"testData"in Ce&&t(14,d=Ce.testData),"schemaProperties"in Ce&&t(1,g=Ce.schemaProperties),"isTestModal"in Ce&&t(2,h=Ce.isTestModal)},r.$$.update=()=>{var Ce,me;r.$$.dirty[0]&1&&t(9,n=p.stepId),r.$$.dirty[0]&131073&&t(11,i=T(p||f.selectedBlock,(me=(Ce=f.selectedAutomation)==null?void 0:Ce.automation)==null?void 0:me.definition)),r.$$.dirty[0]&16385&&t(3,l=d||p.inputs),r.$$.dirty[0]&8&&t(16,s=l?l.tableId:null),r.$$.dirty[0]&327688&&t(4,o=s?c.list.find(ke=>ke._id===l.tableId):{schema:{}}),r.$$.dirty[0]&65536&&t(15,a=Jf(s,{searchableSchema:!0}).schema),r.$$.dirty[0]&32768&&t(10,u=Object.values(a||{}))},[p,g,h,l,o,v,k,C,I,n,u,i,O,M,d,a,s,f,c,F,j,z,q,H,Y,U,W,G,Q,fe,Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se]}class dy extends ie{constructor(e){super();le(this,e,ice,nce,re,{block:0,testData:14,schemaProperties:1,isTestModal:2},null,[-1,-1])}}function lce(r){let e;return{c(){e=V("Input")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function sce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronRight"}}),{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 oce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronDown"}}),{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 my(r){let e,t,n;return t=new pi({props:{disabled:!0,value:JSON.stringify(r[0][0].inputs,null,2)}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","text-area-container svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.value=JSON.stringify(i[0][0].inputs,null,2)),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 ace(r){let e;return{c(){e=V("Output")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function uce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronRight"}}),{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 fce(r){let e,t;return e=new ct({props:{size:"M",name:"ChevronDown"}}),{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 gy(r){let e,t,n;return t=new pi({props:{disabled:!0,value:JSON.stringify(r[0][0].outputs,null,2)}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","text-area-container svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.value=JSON.stringify(i[0][0].outputs,null,2)),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 cce(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j;l=new mr({props:{size:"S",$$slots:{default:[lce]},$$scope:{ctx:r}}});const z=[oce,sce],q=[];function H(fe,Z){return fe[2]?0:1}a=H(r),u=q[a]=z[a](r);let Y=r[2]&&my(r);v=new mr({props:{size:"S",$$slots:{default:[ace]},$$scope:{ctx:r}}});const U=[fce,uce],W=[];function G(fe,Z){return fe[3]?0:1}I=G(r),O=W[I]=U[I](r);let Q=r[3]&&gy(r);return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("span"),S(l.$$.fragment),s=R(),o=D("div"),u.c(),f=R(),Y&&Y.c(),c=R(),p=D("div"),d=D("div"),g=D("div"),h=D("span"),S(v.$$.fragment),k=R(),C=D("div"),O.c(),T=R(),Q&&Q.c(),P=Ee(),zt(i,"padding-left","var(--spacing-s)"),zt(n,"display","flex"),zt(n,"align-items","center"),w(e,"class","toggle splitHeader svelte-ddpow"),zt(h,"padding-left","var(--spacing-s)"),zt(g,"display","flex"),zt(g,"align-items","center"),w(p,"class","toggle splitHeader svelte-ddpow")},m(fe,Z){$(fe,e,Z),N(e,t),N(t,n),N(n,i),A(l,i,null),N(e,s),N(e,o),q[a].m(o,null),$(fe,f,Z),Y&&Y.m(fe,Z),$(fe,c,Z),$(fe,p,Z),N(p,d),N(d,g),N(g,h),A(v,h,null),N(p,k),N(p,C),W[I].m(C,null),$(fe,T,Z),Q&&Q.m(fe,Z),$(fe,P,Z),M=!0,F||(j=[Pe(e,"click",r[4]),Pe(p,"click",r[5])],F=!0)},p(fe,Z){const ee={};Z&64&&(ee.$$scope={dirty:Z,ctx:fe}),l.$set(ee);let ae=a;a=H(fe),a!==ae&&(te(),_(q[ae],1,1,()=>{q[ae]=null}),ne(),u=q[a],u||(u=q[a]=z[a](fe),u.c()),m(u,1),u.m(o,null)),fe[2]?Y?(Y.p(fe,Z),Z&4&&m(Y,1)):(Y=my(fe),Y.c(),m(Y,1),Y.m(c.parentNode,c)):Y&&(te(),_(Y,1,1,()=>{Y=null}),ne());const _e={};Z&64&&(_e.$$scope={dirty:Z,ctx:fe}),v.$set(_e);let Re=I;I=G(fe),I!==Re&&(te(),_(W[Re],1,1,()=>{W[Re]=null}),ne(),O=W[I],O||(O=W[I]=U[I](fe),O.c()),m(O,1),O.m(C,null)),fe[3]?Q?(Q.p(fe,Z),Z&8&&m(Q,1)):(Q=gy(fe),Q.c(),m(Q,1),Q.m(P.parentNode,P)):Q&&(te(),_(Q,1,1,()=>{Q=null}),ne())},i(fe){M||(m(l.$$.fragment,fe),m(u),m(Y),m(v.$$.fragment,fe),m(O),m(Q),M=!0)},o(fe){_(l.$$.fragment,fe),_(u),_(Y),_(v.$$.fragment,fe),_(O),_(Q),M=!1},d(fe){fe&&b(e),E(l),q[a].d(),fe&&b(f),Y&&Y.d(fe),fe&&b(c),fe&&b(p),E(v),W[I].d(),fe&&b(T),Q&&Q.d(fe),fe&&b(P),F=!1,Tn(j)}}}function pce(r){let e,t,n;return t=new ct({props:{size:"S",name:"CloseCircle"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","iconFailure svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function dce(r){let e,t,n;return t=new ct({props:{size:"S",name:"CheckmarkCircle"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","iconSuccess svelte-ddpow")},m(i,l){$(i,e,l),A(t,e,null),n=!0},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function mce(r){let e,t,n,i,l;const s=[dce,pce],o=[];function a(u,f){return u[1]||u[0][0].outputs.success?0:1}return n=a(r),i=o[n]=s[n](r),{c(){e=D("div"),t=D("div"),i.c(),zt(t,"float","right"),w(e,"slot","header")},m(u,f){$(u,e,f),N(e,t),o[n].m(t,null),l=!0},p(u,f){let c=n;n=a(u),n!==c&&(te(),_(o[c],1,1,()=>{o[c]=null}),ne(),i=o[n],i||(i=o[n]=s[n](u),i.c()),m(i,1),i.m(t,null))},i(u){l||(m(i),l=!0)},o(u){_(i),l=!1},d(u){u&&b(e),o[n].d()}}}function gce(r){let e,t;return e=new Dt({props:{showCloseIcon:!1,showConfirmButton:!1,title:"Test Automation",cancelText:"Close",$$slots:{header:[mce],default:[cce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&79&&(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 _ce(r,e,t){let{testResult:n}=e,{isTrigger:i}=e,l,s;const o=()=>{t(2,l=!l)},a=()=>{t(3,s=!s)};return r.$$set=u=>{"testResult"in u&&t(0,n=u.testResult),"isTrigger"in u&&t(1,i=u.isTrigger)},[n,i,l,s,o,a]}class hce extends ie{constructor(e){super();le(this,e,_ce,gce,re,{testResult:0,isTrigger:1})}}var $ce="/builder/assets/discord.c14881e9.svg",bce="/builder/assets/zapier.3fbd8f5c.png",vce="/builder/assets/integromat.42212f11.png",wce="/builder/assets/slack.1e1f7cfb.svg";const ho={zapier:{name:"zapier",icon:bce},discord:{name:"discord",icon:$ce},slack:{name:"slack",icon:wce},integromat:{name:"integromat",icon:vce}};function _y(r,e,t){const n=r.slice();return n[16]=e[t][0],n[17]=e[t][1],n}function hy(r,e,t){const n=r.slice();return n[16]=e[t][0],n[17]=e[t][1],n}function yce(r){let e;return{c(){e=V("Select an app or event.")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function kce(r){let e;return{c(){e=V("Apps")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Cce(r){let e=r[16].charAt(0).toUpperCase()+r[16].slice(1)+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function $y(r){let e,t,n,i,l,s,o,a,u,f,c;o=new Ke({props:{size:"XS",$$slots:{default:[Cce]},$$scope:{ctx:r}}});function p(){return r[8](r[17])}return{c(){e=D("div"),t=D("div"),n=D("img"),l=R(),s=D("span"),S(o.$$.fragment),a=R(),w(n,"width","20"),w(n,"height","20"),dn(n.src,i=ho[r[17].stepId].icon)||w(n,"src",i),w(n,"alt","zapier"),w(s,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].name)},m(d,g){$(d,e,g),N(e,t),N(t,n),N(t,l),N(t,s),A(o,s,null),N(e,a),u=!0,f||(c=Pe(e,"click",p),f=!0)},p(d,g){r=d;const h={};g&4194304&&(h.$$scope={dirty:g,ctx:r}),o.$set(h),g&10&&oe(e,"selected",r[1]===r[17].name)},i(d){u||(m(o.$$.fragment,d),u=!0)},o(d){_(o.$$.fragment,d),u=!1},d(d){d&&b(e),E(o),f=!1,c()}}}function Sce(r){let e;return{c(){e=V("Actions")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Ace(r){let e,t,n,i,l,s,o,a,u,f;n=new ct({props:{name:r[17].icon}}),s=new Ke({props:{size:"XS",$$slots:{default:[Oce]},$$scope:{ctx:r}}});function c(){return r[10](r[17])}return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].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=Pe(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&4194304&&(g.$$scope={dirty:d,ctx:r}),s.$set(g),d&18&&oe(e,"selected",r[1]===r[17].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 Ece(r){let e,t;return e=new Lu({props:{text:r[2][r[16]].message,direction:"bottom",$$slots:{default:[Ice]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4194306&&(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 Oce(r){let e=r[17].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function Tce(r){let e=r[17].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p:Oe,d(n){n&&b(t)}}}function Ice(r){let e,t,n,i,l,s,o,a,u,f;n=new ct({props:{name:r[17].icon}}),s=new Ke({props:{size:"XS",$$slots:{default:[Tce]},$$scope:{ctx:r}}});function c(){return r[9](r[17])}return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("span"),S(s.$$.fragment),o=R(),w(l,"class","icon-spacing svelte-1xjh7jp"),w(t,"class","item-body svelte-1xjh7jp"),w(e,"class","item svelte-1xjh7jp"),oe(e,"selected",r[1]===r[17].name),oe(e,"disabled",!0)},m(p,d){$(p,e,d),N(e,t),A(n,t,null),N(t,i),N(t,l),A(s,l,null),$(p,o,d),a=!0,u||(f=Pe(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&4194304&&(g.$$scope={dirty:d,ctx:r}),s.$set(g),d&18&&oe(e,"selected",r[1]===r[17].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),p&&b(o),u=!1,f()}}}function by(r){let e,t,n,i;const l=[Ece,Ace],s=[];function o(a,u){return a[2][a[16]]&&a[2][a[16]].disabled?0:1}return e=o(r),t=s[e]=l[e](r),{c(){t.c(),n=Ee()},m(a,u){s[e].m(a,u),$(a,n,u),i=!0},p(a,u){t.p(a,u)},i(a){i||(m(t),i=!0)},o(a){_(t),i=!1},d(a){s[e].d(a),a&&b(n)}}}function Lce(r){let e,t,n,i,l,s,o,a;e=new Ke({props:{size:"S",$$slots:{default:[kce]},$$scope:{ctx:r}}});let u=Object.entries(r[3]),f=[];for(let h=0;h<u.length;h+=1)f[h]=$y(hy(r,u,h));const c=h=>_(f[h],1,1,()=>{f[h]=null});l=new mr({props:{size:"S",$$slots:{default:[Sce]},$$scope:{ctx:r}}});let p=Object.entries(r[4]),d=[];for(let h=0;h<p.length;h+=1)d[h]=by(_y(r,p,h));const g=h=>_(d[h],1,1,()=>{d[h]=null});return{c(){S(e.$$.fragment),t=R(),n=D("div");for(let h=0;h<f.length;h+=1)f[h].c();i=R(),S(l.$$.fragment),s=R(),o=D("div");for(let h=0;h<d.length;h+=1)d[h].c();w(n,"class","item-list svelte-1xjh7jp"),w(o,"class","item-list svelte-1xjh7jp")},m(h,v){A(e,h,v),$(h,t,v),$(h,n,v);for(let k=0;k<f.length;k+=1)f[k].m(n,null);$(h,i,v),A(l,h,v),$(h,s,v),$(h,o,v);for(let k=0;k<d.length;k+=1)d[k].m(o,null);a=!0},p(h,v){const k={};if(v&4194304&&(k.$$scope={dirty:v,ctx:h}),e.$set(k),v&42){u=Object.entries(h[3]);let I;for(I=0;I<u.length;I+=1){const O=hy(h,u,I);f[I]?(f[I].p(O,v),m(f[I],1)):(f[I]=$y(O),f[I].c(),m(f[I],1),f[I].m(n,null))}for(te(),I=u.length;I<f.length;I+=1)c(I);ne()}const C={};if(v&4194304&&(C.$$scope={dirty:v,ctx:h}),l.$set(C),v&54){p=Object.entries(h[4]);let I;for(I=0;I<p.length;I+=1){const O=_y(h,p,I);d[I]?(d[I].p(O,v),m(d[I],1)):(d[I]=by(O),d[I].c(),m(d[I],1),d[I].m(o,null))}for(te(),I=p.length;I<d.length;I+=1)g(I);ne()}},i(h){if(!a){m(e.$$.fragment,h);for(let v=0;v<u.length;v+=1)m(f[v]);m(l.$$.fragment,h);for(let v=0;v<p.length;v+=1)m(d[v]);a=!0}},o(h){_(e.$$.fragment,h),f=f.filter(Boolean);for(let v=0;v<f.length;v+=1)_(f[v]);_(l.$$.fragment,h),d=d.filter(Boolean);for(let v=0;v<d.length;v+=1)_(d[v]);a=!1},d(h){E(e,h),h&&b(t),h&&b(n),$t(f,h),h&&b(i),E(l,h),h&&b(s),h&&b(o),$t(d,h)}}}function Pce(r){let e,t,n,i;return e=new Ke({props:{size:"XS",$$slots:{default:[yce]},$$scope:{ctx:r}}}),n=new Qe({props:{noPadding:!0,$$slots:{default:[Lce]},$$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&4194304&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&4194306&&(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 Nce(r){let e,t;return e=new Dt({props:{title:"Create Automation",confirmText:"Save",size:"M",disabled:!r[1],onConfirm:r[11],$$slots:{default:[Pce]},$$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]),i&1&&(l.onConfirm=n[11]),i&4194306&&(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 Rce(r,e,t){let n,i;ue(r,Zt,I=>t(13,n=I)),ue(r,An,I=>t(14,i=I));let{blockIdx:l}=e,{blockComplete:s}=e;const o={SEND_EMAIL_SMTP:{disabled:!i.checklist.smtp.checked,message:"Please configure SMTP"}};let a,u,f=Object.entries(n.blockDefinitions.ACTION);const c=f.reduce((I,O)=>{const[T,P]=O;return P.internal||(I[T]=P),I},{}),p=f.reduce((I,O)=>{const[T,P]=O;return P.internal&&(I[T]=P),I},{}),d=I=>{u=I,t(1,a=I.name)};async function g(){var I;try{const O=n.selectedAutomation.constructBlock("ACTION",u.stepId,u);Zt.actions.addBlockToAutomation(O,l+1),await Zt.actions.save((I=n.selectedAutomation)==null?void 0:I.automation)}catch{we.error("Error saving automation")}}const h=I=>d(I),v=I=>d(I),k=I=>d(I),C=()=>{t(0,s=!0),g()};return r.$$set=I=>{"blockIdx"in I&&t(7,l=I.blockIdx),"blockComplete"in I&&t(0,s=I.blockComplete)},[s,a,o,c,p,d,g,l,h,v,k,C]}class Mce extends ie{constructor(e){super();le(this,e,Rce,Nce,re,{blockIdx:7,blockComplete:0})}}function Dce(r){let e,t,n;return{c(){e=ge("svg"),t=ge("use"),Wt(t,"xlink:href",n="#spectrum-icon-18-"+r[0].icon),w(e,"width","28px"),w(e,"height","28px"),w(e,"class","spectrum-Icon"),zt(e,"color","grey"),w(e,"focusable","false")},m(i,l){$(i,e,l),N(e,t)},p(i,l){l[0]&1&&n!==(n="#spectrum-icon-18-"+i[0].icon)&&Wt(t,"xlink:href",n)},d(i){i&&b(e)}}}function jce(r){let e,t,n;return{c(){e=D("img"),w(e,"alt",t=ho[r[0].stepId].name),w(e,"width","28px"),w(e,"height","28px"),dn(e.src,n=ho[r[0].stepId].icon)||w(e,"src",n)},m(i,l){$(i,e,l)},p(i,l){l[0]&1&&t!==(t=ho[i[0].stepId].name)&&w(e,"alt",t),l[0]&1&&!dn(e.src,n=ho[i[0].stepId].icon)&&w(e,"src",n)},d(i){i&&b(e)}}}function Bce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[qce]},$$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 zce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[Uce]},$$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 qce(r){let e;return{c(){e=V("Do this:")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Uce(r){let e;return{c(){e=V("When this happens:")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Fce(r){var n,i;let e=(((i=(n=r[0])==null?void 0:n.name)==null?void 0:i.toUpperCase())||"")+"",t;return{c(){t=V(e)},m(l,s){$(l,t,s)},p(l,s){var o,a;s[0]&1&&e!==(e=(((a=(o=l[0])==null?void 0:o.name)==null?void 0:a.toUpperCase())||"")+"")&&Te(t,e)},d(l){l&&b(t)}}}function vy(r){var s,o;let e,t,n,i,l;return t=new t1({props:{positive:r[3]||((s=r[13][0].outputs)==null?void 0:s.success),negative:!((o=r[13][0].outputs)==null?void 0:o.success),$$slots:{default:[Hce]},$$scope:{ctx:r}}}),{c(){e=D("span"),S(t.$$.fragment)},m(a,u){$(a,e,u),A(t,e,null),n=!0,i||(l=Pe(e,"click",r[21]),i=!0)},p(a,u){var c,p;const f={};u[0]&8200&&(f.positive=a[3]||((c=a[13][0].outputs)==null?void 0:c.success)),u[0]&8192&&(f.negative=!((p=a[13][0].outputs)==null?void 0:p.success)),u[1]&2&&(f.$$scope={dirty:u,ctx:a}),t.$set(f)},i(a){n||(m(t.$$.fragment,a),n=!0)},o(a){_(t.$$.fragment,a),n=!1},d(a){a&&b(e),E(t),i=!1,l()}}}function Vce(r){let e;return{c(){e=V("View response")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Hce(r){let e,t;return e=new Ke({props:{size:"XS",$$slots:{default:[Vce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 wy(r){let e,t,n,i,l;return e=new pn({props:{noMargin:!0}}),i=new Qe({props:{noPadding:!0,gap:"S",$$slots:{default:[Jce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment),t=R(),n=D("div"),S(i.$$.fragment),w(n,"class","blockSection svelte-oi1qmk")},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[0]&53547|o[1]&2&&(a.$$scope={dirty:o,ctx:s}),i.$set(a)},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 Wce(r){let e;return{c(){e=V("Setup")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Gce(r){let e,t;return e=new mr({props:{size:"S",$$slots:{default:[Wce]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 yy(r){let e,t,n,i,l,s,o,a=r[14]&&ky(r);return i=new ct({props:{name:"DeleteOutline"}}),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),S(i.$$.fragment),w(n,"class","delete-padding svelte-oi1qmk"),w(e,"class","block-options svelte-oi1qmk")},m(u,f){$(u,e,f),a&&a.m(e,null),N(e,t),N(e,n),A(i,n,null),l=!0,s||(o=Pe(n,"click",r[24]),s=!0)},p(u,f){u[14]?a?(a.p(u,f),f[0]&16384&&m(a,1)):(a=ky(u),a.c(),m(a,1),a.m(e,t)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){l||(m(a),m(i.$$.fragment,u),l=!0)},o(u){_(a),_(i.$$.fragment,u),l=!1},d(u){u&&b(e),a&&a.d(),E(i),s=!1,o()}}}function ky(r){let e,t,n;return t=new Xe({props:{quiet:!0,defaultValue:"Use values",autoWidth:!0,value:r[15]?"Use bindings":"Use values",options:["Use values","Use bindings"],placeholder:null}}),t.$on("change",r[17]),{c(){e=D("div"),S(t.$$.fragment)},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l[0]&32768&&(s.value=i[15]?"Use bindings":"Use values"),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 Cy(r){let e,t,n,i;e=new dy({props:{schemaProperties:Object.entries(r[0].schema.inputs.properties),block:r[0],webhookModal:r[5]}});let l=r[12]&&Sy(r);return{c(){S(e.$$.fragment),t=R(),l&&l.c(),n=Ee()},m(s,o){A(e,s,o),$(s,t,o),l&&l.m(s,o),$(s,n,o),i=!0},p(s,o){const a={};o[0]&1&&(a.schemaProperties=Object.entries(s[0].schema.inputs.properties)),o[0]&1&&(a.block=s[0]),o[0]&32&&(a.webhookModal=s[5]),e.$set(a),s[12]?l?(l.p(s,o),o[0]&4096&&m(l,1)):(l=Sy(s),l.c(),m(l,1),l.m(n.parentNode,n)):l&&(te(),_(l,1,1,()=>{l=null}),ne())},i(s){i||(m(e.$$.fragment,s),m(l),i=!0)},o(s){_(e.$$.fragment,s),_(l),i=!1},d(s){E(e,s),s&&b(t),l&&l.d(s),s&&b(n)}}}function Sy(r){let e,t;return e=new gt({props:{cta:!0,$$slots:{default:[Yce]},$$scope:{ctx:r}}}),e.$on("click",r[25]),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[1]&2&&(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 Yce(r){let e;return{c(){e=V("Finish and test automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Jce(r){let e,t,n,i,l,s;t=new Jt({props:{quiet:!0,icon:r[8]?"ChevronDown":"ChevronRight",$$slots:{default:[Gce]},$$scope:{ctx:r}}}),t.$on("click",r[23]);let o=!r[3]&&yy(r),a=r[8]&&Cy(r);return{c(){e=D("div"),S(t.$$.fragment),n=R(),o&&o.c(),i=R(),a&&a.c(),l=Ee(),w(e,"class","splitHeader svelte-oi1qmk")},m(u,f){$(u,e,f),A(t,e,null),N(e,n),o&&o.m(e,null),$(u,i,f),a&&a.m(u,f),$(u,l,f),s=!0},p(u,f){const c={};f[0]&256&&(c.icon=u[8]?"ChevronDown":"ChevronRight"),f[1]&2&&(c.$$scope={dirty:f,ctx:u}),t.$set(c),u[3]?o&&(te(),_(o,1,1,()=>{o=null}),ne()):o?(o.p(u,f),f[0]&8&&m(o,1)):(o=yy(u),o.c(),m(o,1),o.m(e,null)),u[8]?a?(a.p(u,f),f[0]&256&&m(a,1)):(a=Cy(u),a.c(),m(a,1),a.m(l.parentNode,l)):a&&(te(),_(a,1,1,()=>{a=null}),ne())},i(u){s||(m(t.$$.fragment,u),m(o),m(a),s=!0)},o(u){_(t.$$.fragment,u),_(o),_(a),s=!1},d(u){u&&b(e),E(t),o&&o.d(),u&&b(i),a&&a.d(u),u&&b(l)}}}function Qce(r){let e,t;return e=new hce({props:{isTrigger:r[3],testResult:r[13]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i[0]&8&&(l.isTrigger=n[3]),i[0]&8192&&(l.testResult=n[13]),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 Xce(r){let e,t,n;function i(s){r[27](s)}let l={blockIdx:r[2]};return r[9]!==void 0&&(l.blockComplete=r[9]),e=new Mce({props:l}),K.push(()=>ce(e,"blockComplete",i)),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o[0]&4&&(a.blockIdx=s[2]),!t&&o[0]&512&&(t=!0,a.blockComplete=s[9],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Kce(r){let e,t;return e=new D1({}),{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 Ay(r){let e;return{c(){e=D("div"),w(e,"class","separator svelte-oi1qmk")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Zce(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,v,k,C,I,O,T,P,M,F,j,z,q,H;function Y(be,he){return ho[be[0].stepId]?jce:Dce}let U=Y(r),W=U(r);const G=[zce,Bce],Q=[];function fe(be,he){return be[3]?0:1}o=fe(r),a=Q[o]=G[o](r),f=new mr({props:{size:"S",$$slots:{default:[Fce]},$$scope:{ctx:r}}});let Z=r[13]&&r[13][0]&&vy(r),ee=!r[9]&&wy(r),ae={width:"30%",$$slots:{default:[Qce]},$$scope:{ctx:r}};g=new Et({props:ae}),r[26](g);let _e={width:"30%",$$slots:{default:[Xce]},$$scope:{ctx:r}};v=new Et({props:_e}),r[28](v);let Re={width:"30%",$$slots:{default:[Kce]},$$scope:{ctx:r}};C=new Et({props:Re}),r[29](C),M=new ct({props:{disabled:!r[10],hoverable:!0,name:"AddCircle",size:"S"}}),M.$on("click",r[31]);let $e=(r[3]?r[11]>1:r[2]!==r[11]-2)&&Ay();return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("div"),W.c(),l=R(),s=D("div"),a.c(),u=R(),S(f.$$.fragment),c=R(),Z&&Z.c(),p=R(),ee&&ee.c(),d=R(),S(g.$$.fragment),h=R(),S(v.$$.fragment),k=R(),S(C.$$.fragment),O=R(),T=D("div"),P=R(),S(M.$$.fragment),F=R(),$e&&$e.c(),j=Ee(),w(s,"class","iconAlign svelte-oi1qmk"),w(i,"class","center-items svelte-oi1qmk"),w(n,"class","splitHeader svelte-oi1qmk"),w(t,"class","blockSection svelte-oi1qmk"),w(e,"class",I=""+(sr(`block ${r[0].type} hoverable`)+" svelte-oi1qmk")),oe(e,"selected",r[4]),w(T,"class","separator svelte-oi1qmk")},m(be,he){$(be,e,he),N(e,t),N(t,n),N(n,i),W.m(i,null),N(i,l),N(i,s),Q[o].m(s,null),N(s,u),A(f,s,null),N(n,c),Z&&Z.m(n,null),N(e,p),ee&&ee.m(e,null),N(e,d),A(g,e,null),N(e,h),A(v,e,null),N(e,k),A(C,e,null),$(be,O,he),$(be,T,he),$(be,P,he),A(M,be,he),$(be,F,he),$e&&$e.m(be,he),$(be,j,he),z=!0,q||(H=[Pe(n,"click",r[22]),Pe(e,"click",r[30])],q=!0)},p(be,he){U===(U=Y(be))&&W?W.p(be,he):(W.d(1),W=U(be),W&&(W.c(),W.m(i,l)));let Ne=o;o=fe(be),o!==Ne&&(te(),_(Q[Ne],1,1,()=>{Q[Ne]=null}),ne(),a=Q[o],a||(a=Q[o]=G[o](be),a.c()),m(a,1),a.m(s,u));const Fe={};he[0]&1|he[1]&2&&(Fe.$$scope={dirty:he,ctx:be}),f.$set(Fe),be[13]&&be[13][0]?Z?(Z.p(be,he),he[0]&8192&&m(Z,1)):(Z=vy(be),Z.c(),m(Z,1),Z.m(n,null)):Z&&(te(),_(Z,1,1,()=>{Z=null}),ne()),be[9]?ee&&(te(),_(ee,1,1,()=>{ee=null}),ne()):ee?(ee.p(be,he),he[0]&512&&m(ee,1)):(ee=wy(be),ee.c(),m(ee,1),ee.m(e,d));const se={};he[0]&8200|he[1]&2&&(se.$$scope={dirty:he,ctx:be}),g.$set(se);const Ce={};he[0]&516|he[1]&2&&(Ce.$$scope={dirty:he,ctx:be}),v.$set(Ce);const me={};he[1]&2&&(me.$$scope={dirty:he,ctx:be}),C.$set(me),(!z||he[0]&1&&I!==(I=""+(sr(`block ${be[0].type} hoverable`)+" svelte-oi1qmk")))&&w(e,"class",I),he[0]&17&&oe(e,"selected",be[4]);const ke={};he[0]&1024&&(ke.disabled=!be[10]),M.$set(ke),(be[3]?be[11]>1:be[2]!==be[11]-2)?$e||($e=Ay(),$e.c(),$e.m(j.parentNode,j)):$e&&($e.d(1),$e=null)},i(be){z||(m(a),m(f.$$.fragment,be),m(Z),m(ee),m(g.$$.fragment,be),m(v.$$.fragment,be),m(C.$$.fragment,be),m(M.$$.fragment,be),z=!0)},o(be){_(a),_(f.$$.fragment,be),_(Z),_(ee),_(g.$$.fragment,be),_(v.$$.fragment,be),_(C.$$.fragment,be),_(M.$$.fragment,be),z=!1},d(be){be&&b(e),W.d(),Q[o].d(),E(f),Z&&Z.d(),ee&&ee.d(),r[26](null),E(g),r[28](null),E(v),r[29](null),E(C),be&&b(O),be&&b(T),be&&b(P),E(M,be),be&&b(F),$e&&$e.d(be),be&&b(j),q=!1,Tn(H)}}}function xce(r,e,t){let n,i,l,s,o,a,u,f,c,p;ue(r,Zt,Z=>t(20,p=Z));let{block:d}=e,{testDataModal:g}=e,h,v,k,C,I,O;async function T(){var Z;try{Zt.actions.deleteAutomationBlock(d),await Zt.actions.save((Z=p.selectedAutomation)==null?void 0:Z.automation)}catch{we.error("Error saving notification")}}function P(Z){var ae;M(d);let ee;Z.detail==="Use values"?ee=!1:ee=!0,Zt.actions.toggleFieldControl(ee),Zt.actions.save((ae=p.selectedAutomation)==null?void 0:ae.automation)}async function M(Z){await Zt.update(ee=>(ee.selectedBlock=Z,ee))}const F=()=>C.show(),j=()=>{t(9,O=!O)},z=()=>{M(d),t(8,I=!I)},q=()=>T(),H=()=>g.show();function Y(Z){K[Z?"unshift":"push"](()=>{C=Z,t(7,C)})}function U(Z){O=Z,t(9,O)}function W(Z){K[Z?"unshift":"push"](()=>{k=Z,t(6,k)})}function G(Z){K[Z?"unshift":"push"](()=>{v=Z,t(5,v)})}const Q=()=>{M(d)},fe=()=>k.show();return r.$$set=Z=>{"block"in Z&&t(0,d=Z.block),"testDataModal"in Z&&t(1,g=Z.testDataModal)},r.$$.update=()=>{var Z,ee,ae,_e,Re,$e,be,he,Ne,Fe,se;r.$$.dirty[0]&1048576&&t(15,n=p.selectedAutomation.automation.rowControl),r.$$.dirty[0]&1&&t(14,i=d.stepId==="CREATE_ROW"||d.stepId==="UPDATE_ROW"),r.$$.dirty[0]&1048577&&t(13,l=(Z=p.selectedAutomation.testResults)==null?void 0:Z.steps.filter(Ce=>d.id?Ce.id===d.id:Ce.stepId===d.stepId)),r.$$.dirty[0]&1&&t(3,s=d.type==="TRIGGER"),r.$$.dirty[0]&1048577&&t(4,h=((ee=p.selectedBlock)==null?void 0:ee.id)===d.id),r.$$.dirty[0]&1048576&&t(19,o=($e=(Re=(_e=(ae=p.selectedAutomation)==null?void 0:ae.automation)==null?void 0:_e.definition)==null?void 0:Re.steps)!=null?$e:[]),r.$$.dirty[0]&524289&&t(2,a=o.findIndex(Ce=>Ce.id===d.id)),r.$$.dirty[0]&524300&&t(12,u=!s&&a+1===o.length),r.$$.dirty[0]&1048576&&t(11,f=((Ne=(he=(be=p.selectedAutomation)==null?void 0:be.automation)==null?void 0:he.definition)==null?void 0:Ne.steps.length)+1),r.$$.dirty[0]&1&&t(10,c=Object.keys(((se=(Fe=d.schema)==null?void 0:Fe.inputs)==null?void 0:se.properties)||{}).every(Ce=>d==null?void 0:d.inputs[Ce]))},[d,g,a,s,h,v,k,C,I,O,c,f,u,l,i,n,T,P,M,o,p,F,j,z,q,H,Y,U,W,G,Q,fe]}class epe extends ie{constructor(e){super();le(this,e,xce,Zce,re,{block:0,testDataModal:1},null,[-1,-1])}}function tpe(r){let e,t,n;return t=new dy({props:{testData:r[1],schemaProperties:r[4],isTestModal:!0,block:r[0]}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"class","tab-content-padding svelte-qrwx8s")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p(i,l){const s={};l&2&&(s.testData=i[1]),l&16&&(s.schemaProperties=i[4]),l&1&&(s.block=i[0]),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 npe(r){let e;return{c(){e=V("JSON")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function rpe(r){let e,t,n,i,l,s;return t=new Ze({props:{$$slots:{default:[npe]},$$scope:{ctx:r}}}),l=new pi({props:{value:JSON.stringify(r[2].selectedAutomation.automation.testData,null,2),error:r[3]}}),l.$on("change",r[8]),{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),w(i,"class","text-area-container svelte-qrwx8s"),w(e,"class","tab-content-padding svelte-qrwx8s")},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){const u={};a&512&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};a&4&&(f.value=JSON.stringify(o[2].selectedAutomation.automation.testData,null,2)),a&8&&(f.error=o[3]),l.$set(f)},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 ipe(r){let e,t,n,i;return e=new bn({props:{icon:"Form",title:"Form",$$slots:{default:[tpe]},$$scope:{ctx:r}}}),n=new bn({props:{icon:"FileJson",title:"JSON",$$slots:{default:[rpe]},$$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&531&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&524&&(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 lpe(r){let e,t;return e=new Vr({props:{selected:"Form",quiet:!0,$$slots:{default:[ipe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&543&&(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 spe(r){let e,t;return e=new Dt({props:{title:"Add test data",confirmText:"Test",showConfirmButton:!0,disabled:r[5],onConfirm:r[7],cancelText:"Cancel",$$slots:{default:[lpe]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,[i]){const l={};i&32&&(l.disabled=n[5]),i&543&&(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 ope(r,e,t){let n,i,l;ue(r,Zt,p=>t(2,l=p));let s=null,o={},a={};l.selectedAutomation.automation.testData||Rn(Zt,l.selectedAutomation.automation.testData={},l);function u(p){try{const d=JSON.parse(p.detail);t(3,s=null),Zt.actions.addTestDataToAutomation(d)}catch{t(3,s="Invalid JSON")}}const f=async()=>{var p;try{await Zt.actions.test((p=l.selectedAutomation)==null?void 0:p.automation,n)}catch{we.error("Error testing notification")}},c=p=>u(p);return r.$$.update=()=>{var p,d;r.$$.dirty&4&&t(0,o=vn.cloneDeep(l.selectedAutomation.automation.definition.trigger)),r.$$.dirty&1&&t(4,a=Object.entries((d=(p=o==null?void 0:o.schema)==null?void 0:p.outputs)==null?void 0:d.properties)),r.$$.dirty&4&&t(1,n=l.selectedAutomation.automation.testData||{}),r.$$.dirty&3&&t(5,i=!o.schema.outputs.required.every(g=>n[g]||g!=="row"))},[o,n,l,s,a,i,u,f,c]}class ape extends ie{constructor(e){super();le(this,e,ope,spe,re,{})}}function Ey(r,e,t){const n=r.slice();return n[9]=e[t],n[11]=t,n}function upe(r){let e=r[0].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&1&&e!==(e=n[0].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function fpe(r){let e;return{c(){e=V("Run test")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Oy(r,e){let t,n,i,l,s,o=Oe,a;return n=new epe({props:{testDataModal:e[2],block:e[9]}}),{key:r,first:null,c(){t=D("div"),S(n.$$.fragment),i=R(),w(t,"class","block svelte-1ckypie"),this.first=t},m(u,f){$(u,t,f),A(n,t,null),N(t,i),a=!0},p(u,f){e=u;const c={};f&4&&(c.testDataModal=e[2]),f&2&&(c.block=e[9]),n.$set(c)},r(){s=t.getBoundingClientRect()},f(){zo(t),o()},a(){o(),o=qo(t,s,Uo,{duration:500})},i(u){a||(m(n.$$.fragment,u),u&&(l||fi(()=>{l=Cu(t,Jr,{x:500,duration:1500}),l.start()})),a=!0)},o(u){_(n.$$.fragment,u),a=!1},d(u){u&&b(t),E(n)}}}function cpe(r){let e,t,n=r[0].name+"",i,l,s;return{c(){e=V(`Are you sure you wish to delete the automation
|
|
1238
1238
|
`),t=D("i"),i=V(n),l=V("?"),s=V(`
|
|
1239
|
-
This action cannot be undone.`),w(t,"class","svelte-1ckypie")},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+"")&&Te(i,n)},d(o){o&&b(e),o&&b(t),o&&b(s)}}}function ppe(r){let e,t;return e=new ape({}),{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 dpe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g=[],h=new Map,v,k,C,I,O;l=new Ct({props:{size:"S",$$slots:{default:[upe]},$$scope:{ctx:r}}}),f=new ct({props:{hoverable:!0,size:"M",name:"DeleteOutline"}}),f.$on("click",function(){mt(r[3].show)&&r[3].show.apply(this,arguments)}),p=new Jt({props:{icon:"MultipleCheck",size:"M",$$slots:{default:[fpe]},$$scope:{ctx:r}}}),p.$on("click",r[5]);let T=r[1];const P=j=>j[9].id;for(let j=0;j<T.length;j+=1){let z=Ey(r,T,j),q=P(z);h.set(q,g[j]=Oy(q,z))}let M={okText:"Delete Automation",onOk:r[4],title:"Confirm Deletion",$$slots:{default:[cpe]},$$scope:{ctx:r}};k=new hr({props:M}),r[6](k);let F={width:"30%",$$slots:{default:[ppe]},$$scope:{ctx:r}};return I=new Et({props:F}),r[7](I),{c(){e=D("div"),t=D("div"),n=D("div"),i=D("div"),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),u=D("div"),S(f.$$.fragment),c=R(),S(p.$$.fragment),d=R();for(let j=0;j<g.length;j+=1)g[j].c();v=R(),S(k.$$.fragment),C=R(),S(I.$$.fragment),w(u,"class","icon svelte-1ckypie"),w(a,"class","iconPadding svelte-1ckypie"),zt(o,"display","flex"),zt(o,"align-items","center"),w(i,"class","subtitle svelte-1ckypie"),w(n,"class","title svelte-1ckypie"),w(t,"class","content svelte-1ckypie"),w(e,"class","canvas svelte-1ckypie")},m(j,z){$(j,e,z),N(e,t),N(t,n),N(n,i),A(l,i,null),N(i,s),N(i,o),N(o,a),N(a,u),A(f,u,null),N(o,c),A(p,o,null),N(t,d);for(let q=0;q<g.length;q+=1)g[q].m(t,null);N(e,v),A(k,e,null),N(e,C),A(I,e,null),O=!0},p(j,[z]){r=j;const q={};z&4097&&(q.$$scope={dirty:z,ctx:r}),l.$set(q);const H={};if(z&4096&&(H.$$scope={dirty:z,ctx:r}),p.$set(H),z&6){T=r[1],te();for(let W=0;W<g.length;W+=1)g[W].r();g=xn(g,z,P,1,r,T,h,t,Bo,Oy,null,Ey);for(let W=0;W<g.length;W+=1)g[W].a();ne()}const Y={};z&4097&&(Y.$$scope={dirty:z,ctx:r}),k.$set(Y);const U={};z&4096&&(U.$$scope={dirty:z,ctx:r}),I.$set(U)},i(j){if(!O){m(l.$$.fragment,j),m(f.$$.fragment,j),m(p.$$.fragment,j);for(let z=0;z<T.length;z+=1)m(g[z]);m(k.$$.fragment,j),m(I.$$.fragment,j),O=!0}},o(j){_(l.$$.fragment,j),_(f.$$.fragment,j),_(p.$$.fragment,j);for(let z=0;z<g.length;z+=1)_(g[z]);_(k.$$.fragment,j),_(I.$$.fragment,j),O=!1},d(j){j&&b(e),E(l),E(f),E(p);for(let z=0;z<g.length;z+=1)g[z].d();r[6](null),E(k),r[7](null),E(I)}}}function mpe(r,e,t){let n;ue(r,Zt,p=>t(8,n=p));let{automation:i}=e,l,s,o;async function a(){var p;try{await Zt.actions.delete((p=n.selectedAutomation)==null?void 0:p.automation)}catch{we.error("Error deleting automation")}}const u=()=>{l.show()};function f(p){K[p?"unshift":"push"](()=>{o=p,t(3,o)})}function c(p){K[p?"unshift":"push"](()=>{l=p,t(2,l)})}return r.$$set=p=>{"automation"in p&&t(0,i=p.automation)},r.$$.update=()=>{r.$$.dirty&3&&(t(1,s=[]),i&&(i.definition.trigger&&s.push(i.definition.trigger),t(1,s=s.concat(i.definition.steps||[]))))},[i,s,l,o,a,u,f,c]}class gpe extends ie{constructor(e){super();le(this,e,mpe,dpe,re,{automation:0})}}function Ty(r){let e,t;return e=new gpe({props:{automation:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.automation=n[0]),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 _pe(r){let e,t,n=r[0]&&Ty(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=Ty(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function hpe(r,e,t){let n,i;return ue(r,Zt,l=>t(1,i=l)),r.$$.update=()=>{var l;r.$$.dirty&2&&t(0,n=(l=i.selectedAutomation)==null?void 0:l.automation)},[n,i]}class $pe extends ie{constructor(e){super();le(this,e,hpe,_pe,re,{})}}function bpe(r){let e,t;return e=new $pe({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p:Oe,i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}class vpe extends ie{constructor(e){super();le(this,e,null,bpe,re,{})}}function wpe(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function ype(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,Zt,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.automation){const o=i.automations.find(a=>a._id===n.automation);o&&Zt.actions.select(o)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class kpe extends ie{constructor(e){super();le(this,e,ype,wpe,re,{})}}function Cpe(r,e,t){let n,i,l;return ue(r,Zt,s=>t(0,n=s)),ue(r,qt,s=>t(1,i=s)),ue(r,Tu,s=>t(2,l=s)),Gt(async()=>{var s,o;!l&&n.automations.length>0&&(!n.selectedAutomation||!((o=(s=n.selectedAutomation)==null?void 0:s.automation)==null?void 0:o._id))&&i(`./${n.automations[0]._id}`)}),[]}class Spe extends ie{constructor(e){super();le(this,e,Cpe,null,re,{})}}function Ape(r){let e,t,n;function i(s){r[9](s)}let l={label:"Name",error:r[2]};return r[1]!==void 0&&(l.value=r[1]),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),e.$on("input",r[5]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o&4&&(a.error=s[2]),!t&&o&2&&(t=!0,a.value=s[1],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Epe(r){let e,t,n,i,l;return t=new ct({props:{name:"InfoOutline"}}),{c(){e=D("a"),S(t.$$.fragment),n=R(),i=D("span"),i.textContent="Learn about automations",w(i,"class","svelte-6zi82x"),w(e,"slot","footer"),w(e,"target","_blank"),w(e,"href","https://docs.budibase.com/
|
|
1239
|
+
This action cannot be undone.`),w(t,"class","svelte-1ckypie")},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+"")&&Te(i,n)},d(o){o&&b(e),o&&b(t),o&&b(s)}}}function ppe(r){let e,t;return e=new ape({}),{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 dpe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g=[],h=new Map,v,k,C,I,O;l=new Ct({props:{size:"S",$$slots:{default:[upe]},$$scope:{ctx:r}}}),f=new ct({props:{hoverable:!0,size:"M",name:"DeleteOutline"}}),f.$on("click",function(){mt(r[3].show)&&r[3].show.apply(this,arguments)}),p=new Jt({props:{icon:"MultipleCheck",size:"M",$$slots:{default:[fpe]},$$scope:{ctx:r}}}),p.$on("click",r[5]);let T=r[1];const P=j=>j[9].id;for(let j=0;j<T.length;j+=1){let z=Ey(r,T,j),q=P(z);h.set(q,g[j]=Oy(q,z))}let M={okText:"Delete Automation",onOk:r[4],title:"Confirm Deletion",$$slots:{default:[cpe]},$$scope:{ctx:r}};k=new hr({props:M}),r[6](k);let F={width:"30%",$$slots:{default:[ppe]},$$scope:{ctx:r}};return I=new Et({props:F}),r[7](I),{c(){e=D("div"),t=D("div"),n=D("div"),i=D("div"),S(l.$$.fragment),s=R(),o=D("div"),a=D("div"),u=D("div"),S(f.$$.fragment),c=R(),S(p.$$.fragment),d=R();for(let j=0;j<g.length;j+=1)g[j].c();v=R(),S(k.$$.fragment),C=R(),S(I.$$.fragment),w(u,"class","icon svelte-1ckypie"),w(a,"class","iconPadding svelte-1ckypie"),zt(o,"display","flex"),zt(o,"align-items","center"),w(i,"class","subtitle svelte-1ckypie"),w(n,"class","title svelte-1ckypie"),w(t,"class","content svelte-1ckypie"),w(e,"class","canvas svelte-1ckypie")},m(j,z){$(j,e,z),N(e,t),N(t,n),N(n,i),A(l,i,null),N(i,s),N(i,o),N(o,a),N(a,u),A(f,u,null),N(o,c),A(p,o,null),N(t,d);for(let q=0;q<g.length;q+=1)g[q].m(t,null);N(e,v),A(k,e,null),N(e,C),A(I,e,null),O=!0},p(j,[z]){r=j;const q={};z&4097&&(q.$$scope={dirty:z,ctx:r}),l.$set(q);const H={};if(z&4096&&(H.$$scope={dirty:z,ctx:r}),p.$set(H),z&6){T=r[1],te();for(let W=0;W<g.length;W+=1)g[W].r();g=xn(g,z,P,1,r,T,h,t,Bo,Oy,null,Ey);for(let W=0;W<g.length;W+=1)g[W].a();ne()}const Y={};z&4097&&(Y.$$scope={dirty:z,ctx:r}),k.$set(Y);const U={};z&4096&&(U.$$scope={dirty:z,ctx:r}),I.$set(U)},i(j){if(!O){m(l.$$.fragment,j),m(f.$$.fragment,j),m(p.$$.fragment,j);for(let z=0;z<T.length;z+=1)m(g[z]);m(k.$$.fragment,j),m(I.$$.fragment,j),O=!0}},o(j){_(l.$$.fragment,j),_(f.$$.fragment,j),_(p.$$.fragment,j);for(let z=0;z<g.length;z+=1)_(g[z]);_(k.$$.fragment,j),_(I.$$.fragment,j),O=!1},d(j){j&&b(e),E(l),E(f),E(p);for(let z=0;z<g.length;z+=1)g[z].d();r[6](null),E(k),r[7](null),E(I)}}}function mpe(r,e,t){let n;ue(r,Zt,p=>t(8,n=p));let{automation:i}=e,l,s,o;async function a(){var p;try{await Zt.actions.delete((p=n.selectedAutomation)==null?void 0:p.automation)}catch{we.error("Error deleting automation")}}const u=()=>{l.show()};function f(p){K[p?"unshift":"push"](()=>{o=p,t(3,o)})}function c(p){K[p?"unshift":"push"](()=>{l=p,t(2,l)})}return r.$$set=p=>{"automation"in p&&t(0,i=p.automation)},r.$$.update=()=>{r.$$.dirty&3&&(t(1,s=[]),i&&(i.definition.trigger&&s.push(i.definition.trigger),t(1,s=s.concat(i.definition.steps||[]))))},[i,s,l,o,a,u,f,c]}class gpe extends ie{constructor(e){super();le(this,e,mpe,dpe,re,{automation:0})}}function Ty(r){let e,t;return e=new gpe({props:{automation:r[0]}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.automation=n[0]),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 _pe(r){let e,t,n=r[0]&&Ty(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=Ty(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(te(),_(n,1,1,()=>{n=null}),ne())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&b(e)}}}function hpe(r,e,t){let n,i;return ue(r,Zt,l=>t(1,i=l)),r.$$.update=()=>{var l;r.$$.dirty&2&&t(0,n=(l=i.selectedAutomation)==null?void 0:l.automation)},[n,i]}class $pe extends ie{constructor(e){super();le(this,e,hpe,_pe,re,{})}}function bpe(r){let e,t;return e=new $pe({}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p:Oe,i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}class vpe extends ie{constructor(e){super();le(this,e,null,bpe,re,{})}}function wpe(r){let e;const t=r[1].default,n=bt(t,r,r[0],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,[l]){n&&n.p&&(!e||l&1)&&vt(n,t,i,i[0],e?yt(t,i[0],l,null):wt(i[0]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function ype(r,e,t){let n,i;ue(r,er,o=>t(2,n=o)),ue(r,Zt,o=>t(3,i=o));let{$$slots:l={},$$scope:s}=e;if(n.automation){const o=i.automations.find(a=>a._id===n.automation);o&&Zt.actions.select(o)}return r.$$set=o=>{"$$scope"in o&&t(0,s=o.$$scope)},[s,l]}class kpe extends ie{constructor(e){super();le(this,e,ype,wpe,re,{})}}function Cpe(r,e,t){let n,i,l;return ue(r,Zt,s=>t(0,n=s)),ue(r,qt,s=>t(1,i=s)),ue(r,Tu,s=>t(2,l=s)),Gt(async()=>{var s,o;!l&&n.automations.length>0&&(!n.selectedAutomation||!((o=(s=n.selectedAutomation)==null?void 0:s.automation)==null?void 0:o._id))&&i(`./${n.automations[0]._id}`)}),[]}class Spe extends ie{constructor(e){super();le(this,e,Cpe,null,re,{})}}function Ape(r){let e,t,n;function i(s){r[9](s)}let l={label:"Name",error:r[2]};return r[1]!==void 0&&(l.value=r[1]),e=new tt({props:l}),K.push(()=>ce(e,"value",i)),e.$on("input",r[5]),{c(){S(e.$$.fragment)},m(s,o){A(e,s,o),n=!0},p(s,o){const a={};o&4&&(a.error=s[2]),!t&&o&2&&(t=!0,a.value=s[1],pe(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){E(e,s)}}}function Epe(r){let e,t,n,i,l;return t=new ct({props:{name:"InfoOutline"}}),{c(){e=D("a"),S(t.$$.fragment),n=R(),i=D("span"),i.textContent="Learn about automations",w(i,"class","svelte-6zi82x"),w(e,"slot","footer"),w(e,"target","_blank"),w(e,"href","https://docs.budibase.com/docs/automation-steps"),w(e,"class","svelte-6zi82x")},m(s,o){$(s,e,o),A(t,e,null),N(e,n),N(e,i),l=!0},p:Oe,i(s){l||(m(t.$$.fragment,s),l=!0)},o(s){_(t.$$.fragment,s),l=!1},d(s){s&&b(e),E(t)}}}function Ope(r){let e,t;return e=new Dt({props:{title:"Edit Automation",confirmText:"Save",size:"L",onConfirm:r[4],disabled:r[2],$$slots:{footer:[Epe],default:[Ape]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.disabled=n[2]),i&2054&&(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 Tpe(r){let e,t,n={$$slots:{default:[Ope]},$$scope:{ctx:r}};return e=new Et({props:n}),r[10](e),e.$on("hide",function(){mt(r[0])&&r[0].apply(this,arguments)}),{c(){S(e.$$.fragment)},m(i,l){A(e,i,l),t=!0},p(i,[l]){r=i;const s={};l&2054&&(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){r[10](null),E(e,i)}}}function Ipe(r,e,t){let n,i="",l,{automation:s}=e,{onCancel:o=void 0}=e;const a=()=>{t(1,n=s==null?void 0:s.name),l.show()},u=()=>{l.hide()};async function f(){try{const g=lt(Se({},s),{name:n});await Zt.actions.save(g),we.success(`Automation ${n} updated successfully`),qn.captureEvent(Yn.AUTOMATION.SAVED,{name:n}),u()}catch{we.error("Error saving automation")}}function c(g){if(t(1,n=g.target.value),!n){t(2,i="Name is required");return}t(2,i="")}function p(g){n=g,t(1,n)}function d(g){K[g?"unshift":"push"](()=>{l=g,t(3,l)})}return r.$$set=g=>{"automation"in g&&t(6,s=g.automation),"onCancel"in g&&t(0,o=g.onCancel)},[o,n,i,l,f,c,s,a,u,p,d]}class Lpe extends ie{constructor(e){super();le(this,e,Ipe,Tpe,re,{automation:6,onCancel:0,show:7,hide:8})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[8]}}function Ppe(r){let e;return{c(){e=V("Edit")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Npe(r){let e;return{c(){e=V("Delete")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Rpe(r){let e,t,n,i;return e=new Qt({props:{icon:"Edit",$$slots:{default:[Ppe]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[2].show)&&r[2].show.apply(this,arguments)}),n=new Qt({props:{icon:"Delete",$$slots:{default:[Npe]},$$scope:{ctx:r}}}),n.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)}),{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){r=l;const o={};s&128&&(o.$$scope={dirty:s,ctx:r}),e.$set(o);const a={};s&128&&(a.$$scope={dirty:s,ctx:r}),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 Mpe(r){let e,t,n;return t=new ct({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),S(t.$$.fragment),w(e,"slot","control"),w(e,"class","icon svelte-kjkbox")},m(i,l){$(i,e,l),A(t,e,null),n=!0},p:Oe,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&b(e),E(t)}}}function Dpe(r){let e,t,n=r[0].name+"",i,l,s;return{c(){e=V(`Are you sure you wish to delete the automation
|
|
1240
1240
|
`),t=D("i"),i=V(n),l=V("?"),s=V(`
|
|
1241
1241
|
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+"")&&Te(i,n)},d(o){o&&b(e),o&&b(t),o&&b(s)}}}function jpe(r){let e,t,n,i,l,s;e=new yr({props:{$$slots:{control:[Mpe],default:[Rpe]},$$scope:{ctx:r}}});let o={okText:"Delete Automation",onOk:r[3],title:"Confirm Deletion",$$slots:{default:[Dpe]},$$scope:{ctx:r}};n=new hr({props:o}),r[4](n);let a={automation:r[0]};return l=new Lpe({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 Bpe(r,e,t){let n;ue(r,qt,f=>t(6,n=f));let{automation:i}=e,l,s;async function o(){try{await Zt.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 zpe extends ie{constructor(e){super();le(this,e,Bpe,jpe,re,{automation:0})}}function Iy(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function qpe(r){let e,t,n;return e=new zpe({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 Ly(r){let e,t;function n(){return r[3](r[5])}return e=new Tl({props:{border:r[7]>0,icon:"ShareAndroid",text:r[5].name,selected:r[5]._id===r[1],$$slots:{default:[qpe]},$$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 Upe(r){let e,t,n=r[0].automations,i=[];for(let s=0;s<n.length;s+=1)i[s]=Ly(Iy(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("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=Iy(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=Ly(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(te(),a=n.length;a<i.length;a+=1)l(a);ne()}},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),$t(i,s)}}}function Fpe(r,e,t){let n,i,l;ue(r,qt,a=>t(4,i=a)),ue(r,Zt,a=>t(0,l=a)),Gt(async()=>{try{await Zt.actions.fetch()}catch{we.error("Error getting automations list")}});function s(a){Zt.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 Vpe extends ie{constructor(e){super();le(this,e,Fpe,Upe,re,{})}}function Py(r,e,t){const n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function Hpe(r){let e;return{c(){e=V(`Please name your automation, then select a trigger. Every automation must
|
|
1242
1242
|
start with a trigger.`)},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Wpe(r){let e;return{c(){e=V("Triggers")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function Gpe(r){let e=r[18].name+"",t;return{c(){t=V(e)},m(n,i){$(n,t,i)},p(n,i){i&8&&e!==(e=n[18].name+"")&&Te(t,e)},d(n){n&&b(t)}}}function Ny(r){let e,t,n,i,l,s,o,a,u,f;n=new ct({props:{name:r[18].icon}}),s=new Ke({props:{size:"S",$$slots:{default:[Gpe]},$$scope:{ctx:r}}});function c(){return r[13](r[18])}return{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("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"),oe(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=Pe(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&&oe(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 Ype(r){let e,t,n,i;e=new Ke({props:{size:"S",$$slots:{default:[Wpe]},$$scope:{ctx:r}}});let l=r[3],s=[];for(let a=0;a<l.length;a+=1)s[a]=Ny(Py(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){S(e.$$.fragment),t=R(),n=D("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=Py(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=Ny(p),s[c].c(),m(s[c],1),s[c].m(n,null))}for(te(),c=l.length;c<s.length;c+=1)o(c);ne()}},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),$t(s,a)}}}function Jpe(r){let e,t,n,i,l,s,o,a,u,f;e=new n1({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 Ke({props:{size:"XS",$$slots:{default:[Hpe]},$$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 tt({props:d}),K.push(()=>ce(l,"value",c)),K.push(()=>ce(l,"error",p)),l.$on("change",r[12]),u=new Qe({props:{noPadding:!0,$$slots:{default:[Ype]},$$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 k={};!s&&h&1&&(s=!0,k.value=g[0],pe(()=>s=!1)),!o&&h&16&&(o=!0,k.error=g[4],pe(()=>o=!1)),l.$set(k);const C={};h&2097164&&(C.$$scope={dirty:h,ctx:g}),u.$set(C)},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 Qpe(r){let e,t;return e=new Dt({props:{title:"Create Automation",confirmText:"Save",size:"M",onConfirm:r[5],disabled:!r[2]||!r[0],$$slots:{default:[Jpe]},$$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 Xpe(r,e,t){let n,i,l,s,o,a;ue(r,Zt,O=>t(8,s=O)),ue(r,qt,O=>t(16,o=O)),ue(r,ys,O=>t(9,a=O));let u,f,c=!1,p,{webhookModal:d}=e;async function g(){var O;try{await Zt.actions.create({name:u,instanceId:n});const T=s.selectedAutomation.constructBlock("TRIGGER",p.stepId,p);Zt.actions.addBlockToAutomation(T),p.stepId==="WEBHOOK"&&d.show,await Zt.actions.save((O=s.selectedAutomation)==null?void 0:O.automation),we.success(`Automation ${u} created`),o(`./${s.selectedAutomation.automation._id}`),qn.captureEvent(Yn.AUTOMATION.CREATED,{name:u})}catch{we.error("Error creating automation")}}const h=O=>{p=O,t(2,f=O.name)};function v(O){u=O,t(0,u)}function k(O){i=O,t(4,i),t(1,c),t(0,u)}const C=()=>t(1,c=!0),I=O=>h(O);return r.$$set=O=>{"webhookModal"in O&&t(7,d=O.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,k,C,I]}class Ry extends ie{constructor(e){super();le(this,e,Xpe,Qpe,re,{webhookModal:7})}}function Kpe(r){let e,t;return e=new Ry({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 Zpe(r){let e,t,n,i;e=new Vpe({});let l={$$slots:{default:[Kpe]},$$scope:{ctx:r}};return n=new Et({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 xpe(r){let e,t;return e=new bn({props:{title:"Automations",$$slots:{default:[Zpe]},$$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 ede(r){let e,t,n,i,l,s;return t=new Vr({props:{selected:"Automations",$$slots:{default:[xpe]},$$scope:{ctx:r}}}),l=new ct({props:{hoverable:!0,name:"AddCircle"}}),l.$on("click",function(){mt(r[0].show)&&r[0].show.apply(this,arguments)}),{c(){e=D("div"),S(t.$$.fragment),n=R(),i=D("div"),S(l.$$.fragment),w(i,"class","add-button svelte-mcmub4"),w(i,"data-cy","new-screen"),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 tde(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 nde extends ie{constructor(e){super();le(this,e,tde,ede,re,{modal:0,webhookModal:1})}}function rde(r){let e,t,n,i;return n=new Qe({props:{gap:"S",justifyItems:"center",$$slots:{default:[ade]},$$scope:{ctx:r}}}),{c(){e=D("div"),t=D("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 ide(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 lde(r){let e;return{c(){e=V("You have no automations")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function sde(r){let e;return{c(){e=V("Let's fix that. Call the bots!")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ode(r){let e;return{c(){e=V("Create automation")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function ade(r){let e,t,n,i,l,s,o,a,u;return i=new Ct({props:{size:"M",$$slots:{default:[lde]},$$scope:{ctx:r}}}),s=new Ke({props:{size:"M",$$slots:{default:[sde]},$$scope:{ctx:r}}}),a=new gt({props:{size:"M",cta:!0,$$slots:{default:[ode]},$$scope:{ctx:r}}}),a.$on("click",r[5]),{c(){e=ge("svg"),t=ge("use"),n=R(),S(i.$$.fragment),l=R(),S(s.$$.fragment),o=R(),S(a.$$.fragment),Wt(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 ude(r){let e,t;return e=new Ry({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 fde(r){let e,t;return e=new D1({}),{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 cde(r){let e,t,n,i,l,s,o,a,u,f,c,p;n=new nde({props:{modal:r[0],webhookModal:r[1]}});const d=[ide,rde],g=[];function h(C,I){return C[2]?0:1}s=h(r),o=g[s]=d[s](r);let v={$$slots:{default:[ude]},$$scope:{ctx:r}};u=new Et({props:v}),r[6](u);let k={width:"30%",$$slots:{default:[fde]},$$scope:{ctx:r}};return c=new Et({props:k}),r[7](c),{c(){e=D("div"),t=D("div"),S(n.$$.fragment),i=R(),l=D("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(C,I){$(C,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(C,[I]){const O={};I&1&&(O.modal=C[0]),I&2&&(O.webhookModal=C[1]),n.$set(O);let T=s;s=h(C),s===T?g[s].p(C,I):(te(),_(g[T],1,1,()=>{g[T]=null}),ne(),o=g[s],o?o.p(C,I):(o=g[s]=d[s](C),o.c()),m(o,1),o.m(l,null));const P={};I&258&&(P.$$scope={dirty:I,ctx:C}),u.$set(P);const M={};I&256&&(M.$$scope={dirty:I,ctx:C}),c.$set(M)},i(C){p||(m(n.$$.fragment,C),m(o),m(u.$$.fragment,C),m(c.$$.fragment,C),p=!0)},o(C){_(n.$$.fragment,C),_(o),_(u.$$.fragment,C),_(c.$$.fragment,C),p=!1},d(C){C&&b(e),E(n),g[s].d(),r[6](null),E(u),r[7](null),E(c)}}}function pde(r,e,t){let n,i;ue(r,Zt,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 dde extends ie{constructor(e){super();le(this,e,pde,cde,re,{})}}function mde(r){let e;return{c(){e=V("Publish")},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function gde(r){let e,t;return e=new Dt({props:{title:"Enjoying Budibase?",size:"L",showConfirmButton:!1,showCancelButton:!1}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p:Oe,i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){E(e,n)}}}function _de(r){let e;return{c(){e=D("span"),e.textContent=`The changes you have made will be published to the production version of
|
|
1243
1243
|
the application.`},m(t,n){$(t,e,n)},d(t){t&&b(e)}}}function hde(r){let e,t;return e=new Dt({props:{title:"Publish to Production",confirmText:"Publish",onConfirm:r[2],$$slots:{default:[_de]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(n,i){A(e,n,i),t=!0},p(n,i){const l={};i&64&&(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 $de(r){let e,t,n,i,l,s;e=new gt({props:{secondary:!0,$$slots:{default:[mde]},$$scope:{ctx:r}}}),e.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)});let o={$$slots:{default:[gde]},$$scope:{ctx:r}};n=new Et({props:o}),r[3](n);let a={$$slots:{default:[hde]},$$scope:{ctx:r}};return l=new Et({props:a}),r[4](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]){r=u;const c={};f&64&&(c.$$scope={dirty:f,ctx:r}),e.$set(c);const p={};f&64&&(p.$$scope={dirty:f,ctx:r}),n.$set(p);const d={};f&64&&(d.$$scope={dirty:f,ctx:r}),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[3](null),E(n,u),u&&b(i),r[4](null),E(l,u)}}}function bde(r,e,t){let n;ue(r,He,u=>t(5,n=u));let i,l;async function s(){try{await xe.deployAppChanges(),qn.captureEvent(Yn.APP.PUBLISHED,{appId:n.appId}),we.success("Application published successfully")}catch(u){qn.captureException(u),we.error("Error publishing app")}}function o(u){K[u?"unshift":"push"](()=>{i=u,t(0,i)})}function a(u){K[u?"unshift":"push"](()=>{l=u,t(1,l)})}return[i,l,s,o,a]}class vde extends ie{constructor(e){super();le(this,e,bde,$de,re,{})}}function wde(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 tt({props:u}),K.push(()=>ce(l,"value",a)),{c(){e=D("span"),e.textContent=`The changes you have made will be deleted and the application reverted
|
|
1244
|
-
back to its production state.`,t=R(),n=D("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],pe(()=>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 yde(r){let e,t;return e=new Dt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[wde]},$$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 kde(r){let e,t,n,i;e=new ct({props:{name:"Revert",hoverable:!0}}),e.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[yde]},$$scope:{ctx:r}};return n=new Et({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 Cde(r,e,t){let n,i;ue(r,He,f=>t(0,i=f));let l,s;const o=async()=>{try{await xe.revertAppChanges(n);const f=await xe.fetchAppPackage(n);await He.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 Sde extends ie{constructor(e){super();le(this,e,Cde,kde,re,{})}}const Ade="@budibase/client",Ede="1.0.91-alpha.
|
|
1244
|
+
back to its production state.`,t=R(),n=D("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],pe(()=>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 yde(r){let e,t;return e=new Dt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[wde]},$$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 kde(r){let e,t,n,i;e=new ct({props:{name:"Revert",hoverable:!0}}),e.$on("click",function(){mt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[yde]},$$scope:{ctx:r}};return n=new Et({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 Cde(r,e,t){let n,i;ue(r,He,f=>t(0,i=f));let l,s;const o=async()=>{try{await xe.revertAppChanges(n);const f=await xe.fetchAppPackage(n);await He.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 Sde extends ie{constructor(e){super();le(this,e,Cde,kde,re,{})}}const Ade="@budibase/client",Ede="1.0.91-alpha.12",Ode="MPL-2.0",Tde="dist/budibase-client.js",Ide="dist/budibase-client.js",Lde="module",Pde="src/index.js",Nde={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},Rde={build:"rollup -c","dev:builder":"rollup -cw"},Mde={"@budibase/bbui":"^1.0.91-alpha.12","@budibase/frontend-core":"^1.0.91-alpha.12","@budibase/string-templates":"^1.0.91-alpha.12","@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",regexparam:"^1.3.0","rollup-plugin-polyfill-node":"^0.8.0",shortid:"^2.2.15",svelte:"^3.38.2","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},Dde={"@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"},jde="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc";var j1={name:Ade,version:Ede,license:Ode,module:Tde,main:Ide,type:Lde,svelte:Pde,exports:Nde,scripts:Rde,dependencies:Mde,devDependencies:Dde,gitHead:jde};function Bde(r){let e,t;return e=new Ke({props:{size:"S",$$slots:{default:[qde]},$$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 zde(r){let e,t;return e=new Ke({props:{size:"S",$$slots:{default:[Ude]},$$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 qde(r){let e,t,n=r[0].version+"",i,l;return{c(){e=V("This app is currently using version "),t=D("b"),i=V(n),l=V(` which is the
|
|
1245
1245
|
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+"")&&Te(i,n)},d(s){s&&b(e),s&&b(t),s&&b(l)}}}function Ude(r){let e,t,n=r[0].version+"",i,l,s,o;return{c(){e=V("This app is currently using version "),t=D("b"),i=V(n),l=V(`, but version
|
|
1246
1246
|
`),s=D("b"),s.textContent=`${j1.version}`,o=V(` is available. Updates can contain new features,
|
|
1247
1247
|
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+"")&&Te(i,n)},d(a){a&&b(e),a&&b(t),a&&b(l),a&&b(s),a&&b(o)}}}function My(r){let e,t;return e=new Ke({props:{size:"S",$$slots:{default:[Fde]},$$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 Fde(r){let e,t,n=r[0].revertableVersion+"",i,l;return{c(){e=V(`You can revert this app to version
|