@budibase/server 3.13.14 → 3.13.15
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.
|
@@ -548,7 +548,7 @@ Please report this to https://github.com/markedjs/marked.`,ue){const ro="<p>An e
|
|
|
548
548
|
|
|
549
549
|
`),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment)},m(fo,po){insert$1(fo,ue,po),insert$1(fo,no,po),insert$1(fo,ro,po),mount_component(oo,fo,po),insert$1(fo,io,po),mount_component(so,fo,po),lo=!0},p(fo,po){(!lo||po&1)&&eo!==(eo=fo[0].schema.name+"")&&set_data(no,eo);const mo={};po&4&&(mo.error=fo[2]),!ao&&po&2&&(ao=!0,mo.value=fo[1],add_flush_callback(()=>ao=!1)),so.$set(mo)},i(fo){lo||(transition_in(oo.$$.fragment,fo),transition_in(so.$$.fragment,fo),lo=!0)},o(fo){transition_out(oo.$$.fragment,fo),transition_out(so.$$.fragment,fo),lo=!1},d(fo){fo&&(detach(ue),detach(no),detach(ro),detach(io)),destroy_component(oo,fo),destroy_component(so,fo)}}}function create_fragment$ad(to){let ue,eo;return ue=new ModalContent({props:{title:"Migrate column",confirmText:"Continue",cancelText:"Cancel",onConfirm:to[4],disabled:to[2]!==void 0,size:"M",$$slots:{default:[create_default_slot$6o]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4&&(oo.disabled=no[2]!==void 0),ro&1031&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$ah(to,ue,eo){let no,ro;const{API:oo,definition:io,rows:so}=getContext$1("grid");component_subscribe(to,io,po=>eo(6,ro=po));let{column:ao}=ue,lo=`${ao.schema.name} migrated`;const uo=po=>{if(po==="")return"Column name can't be empty.";if(po in ro.schema)return"New column name can't be the same as an existing column name.";if(po.match(ValidColumnNameRegex)===null)return"Illegal character; must be alpha-numeric."},co=async()=>{try{await oo.migrateColumn(ro._id,ao.schema.name,lo),notifications.success("Column migrated")}catch(po){notifications.error(`Failed to migrate: ${po.message}`)}await so.actions.refreshData()};function fo(po){lo=po,eo(1,lo)}return to.$$set=po=>{"column"in po&&eo(0,ao=po.column)},to.$$.update=()=>{to.$$.dirty&2&&eo(2,no=uo(lo))},[ao,lo,no,io,co,fo]}class MigrationModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ah,create_fragment$ad,safe_not_equal,{column:0})}}const HeaderCell_svelte_svelte_type_style_lang="";function create_default_slot_12$p(to){let ue,eo;return ue=new MigrationModal({props:{column:to[0]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.column=no[0]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_6$v(to){let ue,eo,no;return{c(){ue=element("input"),attr(ue,"type","text"),attr(ue,"data-grid-ignore",""),attr(ue,"class","svelte-swjxbh")},m(ro,oo){insert$1(ro,ue,oo),to[50](ue),set_input_value(ue,to[3]),eo||(no=[listen(ue,"input",to[51]),listen(ue,"blur",to[44]),listen(ue,"click",to[52]),listen(ue,"keydown",to[42])],eo=!0)},p(ro,oo){oo[0]&8&&ue.value!==ro[3]&&set_input_value(ue,ro[3])},d(ro){ro&&detach(ue),to[50](null),eo=!1,run_all(no)}}}function create_if_block_5$I(to){let ue,eo,no;return eo=new Icon({props:{name:getColumnIcon(to[0]),size:"M",color:"var(--spectrum-global-color-gray-600)",hoverable:!0,hoverColor:"var(--spectrum-global-color-gray-800)"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","column-icon svelte-swjxbh")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1&&(io.name=getColumnIcon(ro[0])),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_else_block_1$w(to){let ue,eo,no,ro,oo,io,so=to[16]&&create_if_block_4$V(to);return no=new Icon({props:{hoverable:!0,size:"S",name:"dots-three-vertical"}}),{c(){so&&so.c(),ue=space$1(),eo=element("div"),create_component(no.$$.fragment),attr(eo,"class","more-icon svelte-swjxbh")},m(ao,lo){so&&so.m(ao,lo),insert$1(ao,ue,lo),insert$1(ao,eo,lo),mount_component(no,eo,null),ro=!0,oo||(io=listen(eo,"click",to[53]),oo=!0)},p(ao,lo){ao[16]?so?(so.p(ao,lo),lo[0]&65536&&transition_in(so,1)):(so=create_if_block_4$V(ao),so.c(),transition_in(so,1),so.m(ue.parentNode,ue)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(ao){ro||(transition_in(so),transition_in(no.$$.fragment,ao),ro=!0)},o(ao){transition_out(so),transition_out(no.$$.fragment,ao),ro=!1},d(ao){ao&&(detach(ue),detach(eo)),so&&so.d(ao),destroy_component(no),oo=!1,io()}}}function create_if_block_3$1e(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{hoverable:!0,size:"S",name:"x"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","clear-icon")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[43]),ro=!0)},p:noop$5,i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_if_block_4$V(to){let ue,eo,no;return eo=new Icon({props:{hoverable:!0,size:"S",name:to[5].order===SortOrder.DESCENDING?"sort-descending":"sort-ascending"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","sort-indicator svelte-swjxbh")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&32&&(io.name=ro[5].order===SortOrder.DESCENDING?"sort-descending":"sort-ascending"),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_11$u(to){let ue,eo,no,ro,oo,io,so=to[0].label+"",ao,lo,uo,co,fo,po,mo,_o,ho=to[10]&&create_if_block_6$v(to),go=!to[4].quiet&&create_if_block_5$I(to);ro=new Icon({props:{hoverable:!0,size:"S",name:"magnifying-glass"}});const bo=[create_if_block_3$1e,create_else_block_1$w],vo=[];function $o(wo,ko){return wo[10]?0:1}return uo=$o(to),co=vo[uo]=bo[uo](to),{c(){ho&&ho.c(),ue=space$1(),go&&go.c(),eo=space$1(),no=element("div"),create_component(ro.$$.fragment),oo=space$1(),io=element("div"),ao=text(so),lo=space$1(),co.c(),fo=empty$4(),attr(no,"class","search-icon svelte-swjxbh"),attr(io,"class","name svelte-swjxbh")},m(wo,ko){ho&&ho.m(wo,ko),insert$1(wo,ue,ko),go&&go.m(wo,ko),insert$1(wo,eo,ko),insert$1(wo,no,ko),mount_component(ro,no,null),insert$1(wo,oo,ko),insert$1(wo,io,ko),append$2(io,ao),insert$1(wo,lo,ko),vo[uo].m(wo,ko),insert$1(wo,fo,ko),po=!0,mo||(_o=listen(no,"click",to[41]),mo=!0)},p(wo,ko){wo[10]?ho?ho.p(wo,ko):(ho=create_if_block_6$v(wo),ho.c(),ho.m(ue.parentNode,ue)):ho&&(ho.d(1),ho=null),wo[4].quiet?go&&(group_outros(),transition_out(go,1,1,()=>{go=null}),check_outros()):go?(go.p(wo,ko),ko[0]&16&&transition_in(go,1)):(go=create_if_block_5$I(wo),go.c(),transition_in(go,1),go.m(eo.parentNode,eo)),(!po||ko[0]&1)&&so!==(so=wo[0].label+"")&&set_data(ao,so);let So=uo;uo=$o(wo),uo===So?vo[uo].p(wo,ko):(group_outros(),transition_out(vo[So],1,1,()=>{vo[So]=null}),check_outros(),co=vo[uo],co?co.p(wo,ko):(co=vo[uo]=bo[uo](wo),co.c()),transition_in(co,1),co.m(fo.parentNode,fo))},i(wo){po||(transition_in(go),transition_in(ro.$$.fragment,wo),transition_in(co),po=!0)},o(wo){transition_out(go),transition_out(ro.$$.fragment,wo),transition_out(co),po=!1},d(wo){wo&&(detach(ue),detach(eo),detach(no),detach(oo),detach(io),detach(lo),detach(fo)),ho&&ho.d(wo),go&&go.d(wo),destroy_component(ro),vo[uo].d(wo),mo=!1,_o()}}}function create_if_block$4R(to){let ue,eo;return ue=new GridPopover({props:{anchor:to[6],align:"left",maxHeight:null,resizable:!0,$$slots:{default:[create_default_slot$6n]},$$scope:{ctx:to}}}),ue.$on("close",to[28]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&64&&(oo.anchor=no[6]),ro[0]&59569|ro[1]&16777216&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_else_block$1X(to){let ue,eo;return ue=new Menu$1({props:{$$slots:{default:[create_default_slot_1$4l]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&59441|ro[1]&16777216&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$2L(to){let ue,eo;const no=to[48].default,ro=create_slot(no,to,to[55],null);return{c(){ue=element("div"),ro&&ro.c(),attr(ue,"class","content svelte-swjxbh")},m(oo,io){insert$1(oo,ue,io),ro&&ro.m(ue,null),eo=!0},p(oo,io){ro&&ro.p&&(!eo||io[1]&16777216)&&update_slot_base(ro,no,oo,oo[55],eo?get_slot_changes(no,oo[55],io,null):get_all_dirty_from_scope(oo[55]),null)},i(oo){eo||(transition_in(ro,oo),eo=!0)},o(oo){transition_out(ro,oo),eo=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo)}}}function create_default_slot_10$x(to){let ue;return{c(){ue=text("Edit column")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_9$B(to){let ue;return{c(){ue=text("Duplicate column")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_8$L(to){let ue;return{c(){ue=text("Use as display column")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_7$X(to){let ue,eo=to[13].ascending+"",no;return{c(){ue=text("Sort "),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&8192&&eo!==(eo=ro[13].ascending+"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_default_slot_6$1c(to){let ue,eo=to[13].descending+"",no;return{c(){ue=text("Sort "),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&8192&&eo!==(eo=ro[13].descending+"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_default_slot_5$1t(to){let ue;return{c(){ue=text("Move left")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$1P(to){let ue;return{c(){ue=text("Move right")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$2p(to){let ue;return{c(){ue=text("Hide column")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_2$1J(to){let ue,eo;return ue=new Item$1({props:{icon:"user",$$slots:{default:[create_default_slot_2$37]},$$scope:{ctx:to}}}),ue.$on("click",to[40]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&16777216&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$37(to){let ue;return{c(){ue=text("Migrate to user column")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$4l(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo;ue=new Item$1({props:{icon:"pencil",disabled:!to[11],$$slots:{default:[create_default_slot_10$x]},$$scope:{ctx:to}}}),ue.$on("click",to[29]),no=new Item$1({props:{icon:"copy",disabled:!to[4].canEditColumns,$$slots:{default:[create_default_slot_9$B]},$$scope:{ctx:to}}}),no.$on("click",to[39]),oo=new Item$1({props:{icon:"tag",disabled:to[0].primaryDisplay||!canBeDisplayColumn(to[0].schema),$$slots:{default:[create_default_slot_8$L]},$$scope:{ctx:to}}}),oo.$on("click",to[37]),so=new Item$1({props:{icon:"sort-ascending",disabled:!canBeSortColumn(to[0].schema)||to[0].name===to[5].column&&to[5].order===SortOrder.ASCENDING,$$slots:{default:[create_default_slot_7$X]},$$scope:{ctx:to}}}),so.$on("click",to[33]),lo=new Item$1({props:{icon:"sort-descending",disabled:!canBeSortColumn(to[0].schema)||to[0].name===to[5].column&&to[5].order===SortOrder.DESCENDING,$$slots:{default:[create_default_slot_6$1c]},$$scope:{ctx:to}}}),lo.$on("click",to[34]),co=new Item$1({props:{disabled:!to[15],icon:"caret-left",$$slots:{default:[create_default_slot_5$1t]},$$scope:{ctx:to}}}),co.$on("click",to[35]),po=new Item$1({props:{disabled:!to[14],icon:"caret-right",$$slots:{default:[create_default_slot_4$1P]},$$scope:{ctx:to}}}),po.$on("click",to[36]),_o=new Item$1({props:{disabled:to[0].primaryDisplay||!to[4].canHideColumns,icon:"eye-slash",$$slots:{default:[create_default_slot_3$2p]},$$scope:{ctx:to}}}),_o.$on("click",to[38]);let vo=to[4].canEditColumns&&to[0].schema.type==="link"&&to[0].schema.tableId===TableNames$1.USERS&&!to[0].schema.autocolumn&&create_if_block_2$1J(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),create_component(co.$$.fragment),fo=space$1(),create_component(po.$$.fragment),mo=space$1(),create_component(_o.$$.fragment),ho=space$1(),vo&&vo.c(),go=empty$4()},m($o,wo){mount_component(ue,$o,wo),insert$1($o,eo,wo),mount_component(no,$o,wo),insert$1($o,ro,wo),mount_component(oo,$o,wo),insert$1($o,io,wo),mount_component(so,$o,wo),insert$1($o,ao,wo),mount_component(lo,$o,wo),insert$1($o,uo,wo),mount_component(co,$o,wo),insert$1($o,fo,wo),mount_component(po,$o,wo),insert$1($o,mo,wo),mount_component(_o,$o,wo),insert$1($o,ho,wo),vo&&vo.m($o,wo),insert$1($o,go,wo),bo=!0},p($o,wo){const ko={};wo[0]&2048&&(ko.disabled=!$o[11]),wo[1]&16777216&&(ko.$$scope={dirty:wo,ctx:$o}),ue.$set(ko);const So={};wo[0]&16&&(So.disabled=!$o[4].canEditColumns),wo[1]&16777216&&(So.$$scope={dirty:wo,ctx:$o}),no.$set(So);const To={};wo[0]&1&&(To.disabled=$o[0].primaryDisplay||!canBeDisplayColumn($o[0].schema)),wo[1]&16777216&&(To.$$scope={dirty:wo,ctx:$o}),oo.$set(To);const Io={};wo[0]&33&&(Io.disabled=!canBeSortColumn($o[0].schema)||$o[0].name===$o[5].column&&$o[5].order===SortOrder.ASCENDING),wo[0]&8192|wo[1]&16777216&&(Io.$$scope={dirty:wo,ctx:$o}),so.$set(Io);const Ao={};wo[0]&33&&(Ao.disabled=!canBeSortColumn($o[0].schema)||$o[0].name===$o[5].column&&$o[5].order===SortOrder.DESCENDING),wo[0]&8192|wo[1]&16777216&&(Ao.$$scope={dirty:wo,ctx:$o}),lo.$set(Ao);const Eo={};wo[0]&32768&&(Eo.disabled=!$o[15]),wo[1]&16777216&&(Eo.$$scope={dirty:wo,ctx:$o}),co.$set(Eo);const Lo={};wo[0]&16384&&(Lo.disabled=!$o[14]),wo[1]&16777216&&(Lo.$$scope={dirty:wo,ctx:$o}),po.$set(Lo);const No={};wo[0]&17&&(No.disabled=$o[0].primaryDisplay||!$o[4].canHideColumns),wo[1]&16777216&&(No.$$scope={dirty:wo,ctx:$o}),_o.$set(No),$o[4].canEditColumns&&$o[0].schema.type==="link"&&$o[0].schema.tableId===TableNames$1.USERS&&!$o[0].schema.autocolumn?vo?(vo.p($o,wo),wo[0]&17&&transition_in(vo,1)):(vo=create_if_block_2$1J($o),vo.c(),transition_in(vo,1),vo.m(go.parentNode,go)):vo&&(group_outros(),transition_out(vo,1,1,()=>{vo=null}),check_outros())},i($o){bo||(transition_in(ue.$$.fragment,$o),transition_in(no.$$.fragment,$o),transition_in(oo.$$.fragment,$o),transition_in(so.$$.fragment,$o),transition_in(lo.$$.fragment,$o),transition_in(co.$$.fragment,$o),transition_in(po.$$.fragment,$o),transition_in(_o.$$.fragment,$o),transition_in(vo),bo=!0)},o($o){transition_out(ue.$$.fragment,$o),transition_out(no.$$.fragment,$o),transition_out(oo.$$.fragment,$o),transition_out(so.$$.fragment,$o),transition_out(lo.$$.fragment,$o),transition_out(co.$$.fragment,$o),transition_out(po.$$.fragment,$o),transition_out(_o.$$.fragment,$o),transition_out(vo),bo=!1},d($o){$o&&(detach(eo),detach(ro),detach(io),detach(ao),detach(uo),detach(fo),detach(mo),detach(ho),detach(go)),destroy_component(ue,$o),destroy_component(no,$o),destroy_component(oo,$o),destroy_component(so,$o),destroy_component(lo,$o),destroy_component(co,$o),destroy_component(po,$o),destroy_component(_o,$o),vo&&vo.d($o)}}}function create_default_slot$6n(to){let ue,eo,no,ro;const oo=[create_if_block_1$2L,create_else_block$1X],io=[];function so(ao,lo){return ao[7]?0:1}return ue=so(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$4()},m(ao,lo){io[ue].m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){let uo=ue;ue=so(ao),ue===uo?io[ue].p(ao,lo):(group_outros(),transition_out(io[uo],1,1,()=>{io[uo]=null}),check_outros(),eo=io[ue],eo?eo.p(ao,lo):(eo=io[ue]=oo[ue](ao),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(ao){ro||(transition_in(eo),ro=!0)},o(ao){transition_out(eo),ro=!1},d(ao){ao&&detach(no),io[ue].d(ao)}}}function create_fragment$ac(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo={$$slots:{default:[create_default_slot_12$p]},$$scope:{ctx:to}};ue=new Modal({props:uo}),to[49](ue),ro=new GridCell({props:{width:to[0].width,left:to[0].__left,defaultHeight:!0,center:!0,$$slots:{default:[create_default_slot_11$u]},$$scope:{ctx:to}}}),ro.$on("mousedown",to[30]),ro.$on("mouseup",to[31]),ro.$on("touchstart",to[30]),ro.$on("touchend",to[31]),ro.$on("touchcancel",to[31]),ro.$on("contextmenu",to[32]);let co=to[2]&&create_if_block$4R(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),no=element("div"),create_component(ro.$$.fragment),oo=space$1(),co&&co.c(),io=empty$4(),attr(no,"class","header-cell svelte-swjxbh"),set_style(no,"flex","0 0 "+to[0].width+"px"),toggle_class(no,"open",to[2]),toggle_class(no,"searchable",to[12]),toggle_class(no,"searching",to[10]),toggle_class(no,"disabled",to[17]||to[18]),toggle_class(no,"sticky",to[1]==="sticky")},m(fo,po){mount_component(ue,fo,po),insert$1(fo,eo,po),insert$1(fo,no,po),mount_component(ro,no,null),to[54](no),insert$1(fo,oo,po),co&&co.m(fo,po),insert$1(fo,io,po),so=!0,ao||(lo=listen(no,"dblclick",to[45]),ao=!0)},p(fo,po){const mo={};po[0]&1|po[1]&16777216&&(mo.$$scope={dirty:po,ctx:fo}),ue.$set(mo);const _o={};po[0]&1&&(_o.width=fo[0].width),po[0]&1&&(_o.left=fo[0].__left),po[0]&67133|po[1]&16777216&&(_o.$$scope={dirty:po,ctx:fo}),ro.$set(_o),(!so||po[0]&1)&&set_style(no,"flex","0 0 "+fo[0].width+"px"),(!so||po[0]&4)&&toggle_class(no,"open",fo[2]),(!so||po[0]&4096)&&toggle_class(no,"searchable",fo[12]),(!so||po[0]&1024)&&toggle_class(no,"searching",fo[10]),(!so||po[0]&393216)&&toggle_class(no,"disabled",fo[17]||fo[18]),(!so||po[0]&2)&&toggle_class(no,"sticky",fo[1]==="sticky"),fo[2]?co?(co.p(fo,po),po[0]&4&&transition_in(co,1)):(co=create_if_block$4R(fo),co.c(),transition_in(co,1),co.m(io.parentNode,io)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros())},i(fo){so||(transition_in(ue.$$.fragment,fo),transition_in(ro.$$.fragment,fo),transition_in(co),so=!0)},o(fo){transition_out(ue.$$.fragment,fo),transition_out(ro.$$.fragment,fo),transition_out(co),so=!1},d(fo){fo&&(detach(eo),detach(no),detach(oo),detach(io)),to[49](null),destroy_component(ue,fo),destroy_component(ro),to[54](null),co&&co.d(fo),ao=!1,lo()}}}function instance$ag(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,{$$slots:$o={},$$scope:wo}=ue,{column:ko}=ue,{idx:So}=ue;const{reorder:To,isReordering:Io,isResizing:Ao,sort:Eo,scrollableColumns:Lo,dispatch:No,subscribe:Do,config:Po,ui:Mo,definition:Uo,datasource:Vo,schema:Wo,focusedCellId:Zo,filter:Yo,inlineFilters:xo,keyboardBlocked:Go}=getContext$1("grid");component_subscribe(to,Io,Ea=>eo(17,bo=Ea)),component_subscribe(to,Ao,Ea=>eo(18,vo=Ea)),component_subscribe(to,Eo,Ea=>eo(5,go=Ea)),component_subscribe(to,Lo,Ea=>eo(47,ho=Ea)),component_subscribe(to,Po,Ea=>eo(4,_o=Ea)),component_subscribe(to,Uo,Ea=>eo(59,po=Ea)),component_subscribe(to,Wo,Ea=>eo(58,fo=Ea)),component_subscribe(to,Zo,Ea=>eo(57,co=Ea)),component_subscribe(to,xo,Ea=>eo(60,mo=Ea));const Xo=[FieldType.STRING,FieldType.OPTIONS,FieldType.NUMBER,FieldType.BIGINT,FieldType.ARRAY,FieldType.LONGFORM];let as,Ko=!1,ls=!1,Jo,hs,ks,cs;const _s=()=>{eo(2,Ko=!1),eo(7,ls=!1)},Is=Ea=>{var sl;if(Ea.calculationType)return{ascending:"low-high",descending:"high-low"};switch((sl=Ea==null?void 0:Ea.schema)==null?void 0:sl.type){case FieldType.NUMBER:case FieldType.BIGINT:return{ascending:"low-high",descending:"high-low"};case FieldType.DATETIME:return{ascending:"old-new",descending:"new-old"};default:return{ascending:"A-Z",descending:"Z-A"}}},Bs=Ea=>{var sl;eo(3,ks=(sl=mo==null?void 0:mo.find(ll=>ll.id===`inline-${Ea}`))==null?void 0:sl.value)},Hs=Ea=>{const{type:sl,formulaType:ll}=Ea.schema;return Xo.includes(sl)||sl===FieldType.FORMULA&&ll===FormulaType.STATIC||sl===FieldType.AI},Rs=async()=>{eo(7,ls=!0),await tick(),No("edit-column",ko.schema)},Ds=Ea=>{var sl;Mo.actions.blur(),((sl=Ea.touches)!=null&&sl.length||Ea.button===0)&&lo&&(Jo=setTimeout(()=>{To.actions.startReordering(ko.name,Ea)},200))},Js=()=>{Jo&&(clearTimeout(Jo),Jo=null)},Cs=Ea=>{Ea.preventDefault(),setTimeout(()=>{Mo.actions.blur(),eo(2,Ko=!Ko)},10)},da=()=>{Eo.set({column:ko.name,order:SortOrder.ASCENDING}),eo(2,Ko=!1)},Es=()=>{Eo.set({column:ko.name,order:SortOrder.DESCENDING}),eo(2,Ko=!1)},gs=()=>{To.actions.moveColumnLeft(ko.name),eo(2,Ko=!1)},Ts=()=>{To.actions.moveColumnRight(ko.name),eo(2,Ko=!1)},ws=()=>{Vo.actions.changePrimaryDisplay(ko.name),eo(2,Ko=!1)},bs=()=>{const{related:Ea}=ko,sl={visible:!1};Ea?Vo.actions.addSubSchemaMutation(Ea.subField,Ea.field,sl):Vo.actions.addSchemaMutation(ko.name,sl),Vo.actions.saveSchemaMutations(),eo(2,Ko=!1)},Us=async()=>{eo(2,Ko=!1);let Ea=`${ko.name} copy`,sl=2;for(;fo[Ea];)Ea=`${ko.name} copy ${sl++}`;const ll=fo[ko.name];await Vo.actions.saveDefinition({...po,schema:{...fo,[Ea]:{...ll,name:Ea,schema:{...ll.schema}}}})},qs=()=>{hs.show(),eo(2,Ko=!1)},Ys=async()=>{set_store_value(Zo,co=null,co),eo(3,ks=""),await tick(),cs==null||cs.focus()},Ks=Ea=>{Ea.key==="Enter"?Qs():Ea.key==="Escape"&&(cs==null||cs.blur())},Xs=()=>{eo(3,ks=null),Qs()},Vs=()=>{ks===""&&eo(3,ks=null),Qs()},Qs=()=>{Yo.actions.addInlineFilter(ko,ks)},ca=debounce(Qs,250),ra=()=>{!uo||ao||(eo(2,Ko=!0),Rs())};onMount(()=>Do("close-edit-column",_s));function ta(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{hs=Ea,eo(8,hs)})}function sa(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{cs=Ea,eo(9,cs)})}function Pa(){ks=this.value,eo(3,ks)}const rl=()=>Zo.set(null),Aa=()=>eo(2,Ko=!0);function Ka(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{as=Ea,eo(6,as)})}return to.$$set=Ea=>{"column"in Ea&&eo(0,ko=Ea.column),"idx"in Ea&&eo(1,So=Ea.idx),"$$scope"in Ea&&eo(55,wo=Ea.$$scope)},to.$$.update=()=>{to.$$.dirty[0]&33&&eo(16,no=ko.name===go.column),to.$$.dirty[0]&1&&eo(46,lo=!ko.primaryDisplay),to.$$.dirty[0]&2|to.$$.dirty[1]&32768&&eo(15,ro=lo&&So>0),to.$$.dirty[0]&2|to.$$.dirty[1]&98304&&eo(14,oo=lo&&So<ho.length-1),to.$$.dirty[0]&1&&eo(13,io=Is(ko)),to.$$.dirty[0]&1&&eo(12,so=Hs(ko)),to.$$.dirty[0]&1&&Bs(ko.name),to.$$.dirty[0]&8&&eo(10,ao=ks!=null),to.$$.dirty[0]&8&&ca(ks),to.$$.dirty[0]&17&&eo(11,uo=_o.canEditColumns&&!ko.schema.disabled),to.$$.dirty[0]&4&&Go.set(Ko)},[ko,So,Ko,ks,_o,go,as,ls,hs,cs,ao,uo,so,io,oo,ro,no,bo,vo,Io,Ao,Eo,Lo,Po,Uo,Wo,Zo,xo,_s,Rs,Ds,Js,Cs,da,Es,gs,Ts,ws,bs,Us,qs,Ys,Ks,Xs,Vs,ra,lo,ho,$o,ta,sa,Pa,rl,Aa,Ka,wo]}class HeaderCell extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ag,create_fragment$ac,safe_not_equal,{column:0,idx:1},null,[-1,-1,-1])}}const HeaderRow_svelte_svelte_type_style_lang="",get_add_column_slot_changes$1=to=>({}),get_add_column_slot_context$1=to=>({});function get_each_context$20(to,ue,eo){const no=to.slice();return no[12]=ue[eo],no[14]=eo,no}const get_edit_column_slot_changes$2=to=>({}),get_edit_column_slot_context$2=to=>({});function create_default_slot_3$2o(to){let ue,eo;const no=to[10]["edit-column"],ro=create_slot(no,to,to[11],get_edit_column_slot_context$2);return{c(){ro&&ro.c(),ue=space$1()},m(oo,io){ro&&ro.m(oo,io),insert$1(oo,ue,io),eo=!0},p(oo,io){ro&&ro.p&&(!eo||io&2048)&&update_slot_base(ro,no,oo,oo[11],eo?get_slot_changes(no,oo[11],io,get_edit_column_slot_changes$2):get_all_dirty_from_scope(oo[11]),get_edit_column_slot_context$2)},i(oo){eo||(transition_in(ro,oo),eo=!0)},o(oo){transition_out(ro,oo),eo=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo)}}}function create_each_block$20(to){let ue,eo;return ue=new HeaderCell({props:{column:to[12],idx:to[14],$$slots:{default:[create_default_slot_3$2o]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.column=no[12]),ro&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$36(to){let ue,eo,no=ensure_array_like(to[0]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$20(get_each_context$20(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){ue=element("div");for(let io=0;io<ro.length;io+=1)ro[io].c();attr(ue,"class","row svelte-1rne7xg")},m(io,so){insert$1(io,ue,so);for(let ao=0;ao<ro.length;ao+=1)ro[ao]&&ro[ao].m(ue,null);eo=!0},p(io,so){if(so&2049){no=ensure_array_like(io[0]);let ao;for(ao=0;ao<no.length;ao+=1){const lo=get_each_context$20(io,no,ao);ro[ao]?(ro[ao].p(lo,so),transition_in(ro[ao],1)):(ro[ao]=create_each_block$20(lo),ro[ao].c(),transition_in(ro[ao],1),ro[ao].m(ue,null))}for(group_outros(),ao=no.length;ao<ro.length;ao+=1)oo(ao);check_outros()}},i(io){if(!eo){for(let so=0;so<no.length;so+=1)transition_in(ro[so]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let so=0;so<ro.length;so+=1)transition_out(ro[so]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_if_block$4Q(to){let ue=to[2],eo,no,ro=create_key_block$i(to);return{c(){ro.c(),eo=empty$4()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io&4&&safe_not_equal(ue,ue=oo[2])?(group_outros(),transition_out(ro,1,1,noop$5),check_outros(),ro=create_key_block$i(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_default_slot_1$4k(to){let ue;const eo=to[10]["add-column"],no=create_slot(eo,to,to[11],get_add_column_slot_context$1);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&2048)&&update_slot_base(no,eo,ro,ro[11],ue?get_slot_changes(eo,ro[11],oo,get_add_column_slot_changes$1):get_all_dirty_from_scope(ro[11]),get_add_column_slot_context$1)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_default_slot$6m(to){let ue,eo;return ue=new NewColumnButton({props:{$$slots:{default:[create_default_slot_1$4k]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_key_block$i(to){let ue,eo;return ue=new TempTooltip({props:{text:"Click here to create your first column",type:TooltipType.Info,condition:!to[3]&&!to[4],$$slots:{default:[create_default_slot$6m]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&24&&(oo.condition=!no[3]&&!no[4]),ro&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$ab(to){let ue,eo,no,ro;eo=new GridScrollWrapper({props:{scrollHorizontally:!0,$$slots:{default:[create_default_slot_2$36]},$$scope:{ctx:to}}});let oo=to[1].canEditColumns&&create_if_block$4Q(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),oo&&oo.c(),attr(ue,"class","header svelte-1rne7xg")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),append$2(ue,no),oo&&oo.m(ue,null),ro=!0},p(io,[so]){const ao={};so&2049&&(ao.$$scope={dirty:so,ctx:io}),eo.$set(ao),io[1].canEditColumns?oo?(oo.p(io,so),so&2&&transition_in(oo,1)):(oo=create_if_block$4Q(io),oo.c(),transition_in(oo,1),oo.m(ue,null)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(io){ro||(transition_in(eo.$$.fragment,io),transition_in(oo),ro=!0)},o(io){transition_out(eo.$$.fragment,io),transition_out(oo),ro=!1},d(io){io&&detach(ue),destroy_component(eo),oo&&oo.d()}}}function instance$af(to,ue,eo){let no,ro,oo,io,so,{$$slots:ao={},$$scope:lo}=ue;const{scrollableColumns:uo,config:co,hasNonAutoColumn:fo,datasource:po,loading:mo}=getContext$1("grid");return component_subscribe(to,uo,_o=>eo(0,no=_o)),component_subscribe(to,co,_o=>eo(1,ro=_o)),component_subscribe(to,fo,_o=>eo(3,io=_o)),component_subscribe(to,po,_o=>eo(2,oo=_o)),component_subscribe(to,mo,_o=>eo(4,so=_o)),to.$$set=_o=>{"$$scope"in _o&&eo(11,lo=_o.$$scope)},[no,ro,oo,io,so,uo,co,fo,po,mo,ao,lo]}class HeaderRow extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$af,create_fragment$ab,safe_not_equal,{})}}const ScrollOverlay_svelte_svelte_type_style_lang="";function create_if_block_1$2K(to){let ue,eo,no;return{c(){ue=element("div"),attr(ue,"class","v-scrollbar svelte-sio5lm"),set_style(ue,"top",to[5]+"px"),set_style(ue,"height",to[3]+"px"),toggle_class(ue,"dragging",to[0])},m(ro,oo){insert$1(ro,ue,oo),eo||(no=[listen(ue,"mousedown",to[20]),listen(ue,"touchstart",to[20])],eo=!0)},p(ro,oo){oo[0]&32&&set_style(ue,"top",ro[5]+"px"),oo[0]&8&&set_style(ue,"height",ro[3]+"px"),oo[0]&1&&toggle_class(ue,"dragging",ro[0])},d(ro){ro&&detach(ue),eo=!1,run_all(no)}}}function create_if_block$4P(to){let ue,eo,no;return{c(){ue=element("div"),attr(ue,"class","h-scrollbar svelte-sio5lm"),set_style(ue,"left",to[4]+"px"),set_style(ue,"width",to[2]+"px"),toggle_class(ue,"dragging",to[1])},m(ro,oo){insert$1(ro,ue,oo),eo||(no=[listen(ue,"mousedown",to[21]),listen(ue,"touchstart",to[21])],eo=!0)},p(ro,oo){oo[0]&16&&set_style(ue,"left",ro[4]+"px"),oo[0]&4&&set_style(ue,"width",ro[2]+"px"),oo[0]&2&&toggle_class(ue,"dragging",ro[1])},d(ro){ro&&detach(ue),eo=!1,run_all(no)}}}function create_fragment$aa(to){let ue,eo,no=to[6]&&create_if_block_1$2K(to),ro=to[7]&&create_if_block$4P(to);return{c(){no&&no.c(),ue=space$1(),ro&&ro.c(),eo=empty$4()},m(oo,io){no&&no.m(oo,io),insert$1(oo,ue,io),ro&&ro.m(oo,io),insert$1(oo,eo,io)},p(oo,io){oo[6]?no?no.p(oo,io):(no=create_if_block_1$2K(oo),no.c(),no.m(ue.parentNode,ue)):no&&(no.d(1),no=null),oo[7]?ro?ro.p(oo,io):(ro=create_if_block$4P(oo),ro.c(),ro.m(eo.parentNode,eo)):ro&&(ro.d(1),ro=null)},i:noop$5,o:noop$5,d(oo){oo&&(detach(ue),detach(eo)),no&&no.d(oo),ro&&ro.d(oo)}}}function instance$ae(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko;const{scroll:So,contentHeight:To,maxScrollTop:Io,contentWidth:Ao,maxScrollLeft:Eo,screenWidth:Lo,showHScrollbar:No,showVScrollbar:Do,scrollLeft:Po,scrollTop:Mo,height:Uo,isDragging:Vo,menu:Wo,focusedCellAPI:Zo}=getContext$1("grid");component_subscribe(to,To,_s=>eo(32,vo=_s)),component_subscribe(to,Io,_s=>eo(28,po=_s)),component_subscribe(to,Ao,_s=>eo(30,go=_s)),component_subscribe(to,Eo,_s=>eo(26,co=_s)),component_subscribe(to,Lo,_s=>eo(31,bo=_s)),component_subscribe(to,No,_s=>eo(7,ko=_s)),component_subscribe(to,Do,_s=>eo(6,wo=_s)),component_subscribe(to,Po,_s=>eo(27,fo=_s)),component_subscribe(to,Mo,_s=>eo(29,mo=_s)),component_subscribe(to,Uo,_s=>eo(33,$o=_s)),component_subscribe(to,Wo,_s=>eo(37,ho=_s)),component_subscribe(to,Zo,_s=>eo(36,_o=_s));let Yo,xo,Go=!1,Xo=!1;const as=()=>{ho.visible&&Wo.actions.close(),_o==null||_o.blur()},Ko=_s=>{_s.preventDefault(),Yo=parseEventLocation(_s).y,xo=mo,document.addEventListener("mousemove",ls),document.addEventListener("touchmove",ls),document.addEventListener("mouseup",Jo),document.addEventListener("touchend",Jo),eo(0,Go=!0),as()},ls=domDebounce(_s=>{const Bs=(parseEventLocation(_s).y-Yo)/oo,Hs=xo+Bs*po;So.update(Rs=>({...Rs,top:Math.max(0,Math.min(Hs,po))}))}),Jo=()=>{document.removeEventListener("mousemove",ls),document.removeEventListener("touchmove",ls),document.removeEventListener("mouseup",Jo),document.removeEventListener("touchend",Jo),eo(0,Go=!1)},hs=_s=>{_s.preventDefault(),Yo=parseEventLocation(_s).x,xo=fo,document.addEventListener("mousemove",ks),document.addEventListener("touchmove",ks),document.addEventListener("mouseup",cs),document.addEventListener("touchend",cs),eo(1,Xo=!0),as()},ks=domDebounce(_s=>{const Bs=(parseEventLocation(_s).x-Yo)/lo,Hs=xo+Bs*co;So.update(Rs=>({...Rs,left:Math.max(0,Math.min(Hs,co))}))}),cs=()=>{document.removeEventListener("mousemove",ks),document.removeEventListener("touchmove",ks),document.removeEventListener("mouseup",cs),document.removeEventListener("touchend",cs),eo(1,Xo=!1)};return to.$$.update=()=>{to.$$.dirty[0]&3&&Vo.set(Go||Xo),to.$$.dirty[1]&4&&eo(25,no=$o-2*ScrollBarSize),to.$$.dirty[0]&33554432|to.$$.dirty[1]&6&&eo(3,ro=Math.max(50,$o/vo*no)),to.$$.dirty[0]&33554440&&eo(23,oo=no-ro),to.$$.dirty[0]&813694976&&eo(5,io=ScrollBarSize+DefaultRowHeight+oo*(mo/po)),to.$$.dirty[1]&1&&eo(24,so=bo-2*ScrollBarSize),to.$$.dirty[0]&1090519040|to.$$.dirty[1]&1&&eo(2,ao=Math.max(50,bo/go*so)),to.$$.dirty[0]&16777220&&eo(22,lo=so-ao),to.$$.dirty[0]&205520896&&eo(4,uo=ScrollBarSize+lo*(fo/co))},[Go,Xo,ao,ro,uo,io,wo,ko,To,Io,Ao,Eo,Lo,No,Do,Po,Mo,Uo,Wo,Zo,Ko,hs,lo,oo,so,no,co,fo,po,mo,go,bo,vo,$o]}class ScrollOverlay extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ae,create_fragment$aa,safe_not_equal,{},null,[-1,-1])}}const MenuOverlay_svelte_svelte_type_style_lang="";function create_if_block$4O(to){let ue=to[4],eo,no,ro=create_key_block$h(to);return{c(){ro.c(),eo=empty$4()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io[0]&16&&safe_not_equal(ue,ue=oo[4])?(group_outros(),transition_out(ro,1,1,noop$5),check_outros(),ro=create_key_block$h(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_else_block$1W(to){var bo,vo;let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho;ue=new Item$1({props:{icon:"copy",disabled:!to[8],$$slots:{default:[create_default_slot_14$g]},$$scope:{ctx:to}}}),ue.$on("click",to[36]),ue.$on("click",to[13].actions.close),no=new Item$1({props:{icon:"clipboard-text",disabled:!to[9],$$slots:{default:[create_default_slot_13$j]},$$scope:{ctx:to}}}),no.$on("click",to[37]),no.$on("click",to[13].actions.close),oo=new Item$1({props:{icon:"arrows-out-simple",disabled:to[3]||!to[6].canEditRows||!to[6].canExpandRows,$$slots:{default:[create_default_slot_12$o]},$$scope:{ctx:to}}}),oo.$on("click",to[38]),oo.$on("click",to[13].actions.close),so=new Item$1({props:{icon:"copy",disabled:to[3]||!((bo=to[5])!=null&&bo._id)||!to[11],$$slots:{default:[create_default_slot_11$t]},$$scope:{ctx:to}}}),so.$on("click",to[39]),so.$on("click",to[13].actions.close),lo=new Item$1({props:{icon:"copy",disabled:to[3]||!((vo=to[5])!=null&&vo._rev)||!to[11],$$slots:{default:[create_default_slot_10$w]},$$scope:{ctx:to}}}),lo.$on("click",to[40]),lo.$on("click",to[13].actions.close),co=new Item$1({props:{icon:"copy",disabled:to[3]||!to[6].canAddRows,$$slots:{default:[create_default_slot_9$A]},$$scope:{ctx:to}}}),co.$on("click",to[25]),po=new Item$1({props:{icon:"trash",disabled:to[3]||!to[6].canDeleteRows,$$slots:{default:[create_default_slot_8$K]},$$scope:{ctx:to}}}),po.$on("click",to[24]);let go=to[6].aiEnabled&&create_if_block_3$1d(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),create_component(co.$$.fragment),fo=space$1(),create_component(po.$$.fragment),mo=space$1(),go&&go.c(),_o=empty$4()},m($o,wo){mount_component(ue,$o,wo),insert$1($o,eo,wo),mount_component(no,$o,wo),insert$1($o,ro,wo),mount_component(oo,$o,wo),insert$1($o,io,wo),mount_component(so,$o,wo),insert$1($o,ao,wo),mount_component(lo,$o,wo),insert$1($o,uo,wo),mount_component(co,$o,wo),insert$1($o,fo,wo),mount_component(po,$o,wo),insert$1($o,mo,wo),go&&go.m($o,wo),insert$1($o,_o,wo),ho=!0},p($o,wo){var No,Do;const ko={};wo[0]&256&&(ko.disabled=!$o[8]),wo[1]&16384&&(ko.$$scope={dirty:wo,ctx:$o}),ue.$set(ko);const So={};wo[0]&512&&(So.disabled=!$o[9]),wo[1]&16384&&(So.$$scope={dirty:wo,ctx:$o}),no.$set(So);const To={};wo[0]&72&&(To.disabled=$o[3]||!$o[6].canEditRows||!$o[6].canExpandRows),wo[1]&16384&&(To.$$scope={dirty:wo,ctx:$o}),oo.$set(To);const Io={};wo[0]&2088&&(Io.disabled=$o[3]||!((No=$o[5])!=null&&No._id)||!$o[11]),wo[1]&16384&&(Io.$$scope={dirty:wo,ctx:$o}),so.$set(Io);const Ao={};wo[0]&2088&&(Ao.disabled=$o[3]||!((Do=$o[5])!=null&&Do._rev)||!$o[11]),wo[1]&16384&&(Ao.$$scope={dirty:wo,ctx:$o}),lo.$set(Ao);const Eo={};wo[0]&72&&(Eo.disabled=$o[3]||!$o[6].canAddRows),wo[1]&16384&&(Eo.$$scope={dirty:wo,ctx:$o}),co.$set(Eo);const Lo={};wo[0]&72&&(Lo.disabled=$o[3]||!$o[6].canDeleteRows),wo[1]&16384&&(Lo.$$scope={dirty:wo,ctx:$o}),po.$set(Lo),$o[6].aiEnabled?go?(go.p($o,wo),wo[0]&64&&transition_in(go,1)):(go=create_if_block_3$1d($o),go.c(),transition_in(go,1),go.m(_o.parentNode,_o)):go&&(group_outros(),transition_out(go,1,1,()=>{go=null}),check_outros())},i($o){ho||(transition_in(ue.$$.fragment,$o),transition_in(no.$$.fragment,$o),transition_in(oo.$$.fragment,$o),transition_in(so.$$.fragment,$o),transition_in(lo.$$.fragment,$o),transition_in(co.$$.fragment,$o),transition_in(po.$$.fragment,$o),transition_in(go),ho=!0)},o($o){transition_out(ue.$$.fragment,$o),transition_out(no.$$.fragment,$o),transition_out(oo.$$.fragment,$o),transition_out(so.$$.fragment,$o),transition_out(lo.$$.fragment,$o),transition_out(co.$$.fragment,$o),transition_out(po.$$.fragment,$o),transition_out(go),ho=!1},d($o){$o&&(detach(eo),detach(ro),detach(io),detach(ao),detach(uo),detach(fo),detach(mo),detach(_o)),destroy_component(ue,$o),destroy_component(no,$o),destroy_component(oo,$o),destroy_component(so,$o),destroy_component(lo,$o),destroy_component(co,$o),destroy_component(po,$o),go&&go.d($o)}}}function create_if_block_2$1I(to){let ue,eo,no,ro,oo,io;return ue=new Item$1({props:{icon:"copy",disabled:!to[8],$$slots:{default:[create_default_slot_6$1b]},$$scope:{ctx:to}}}),ue.$on("click",to[33]),ue.$on("click",to[13].actions.close),no=new Item$1({props:{icon:"clipboard-text",disabled:!to[9],$$slots:{default:[create_default_slot_5$1s]},$$scope:{ctx:to}}}),no.$on("click",to[34]),no.$on("click",to[13].actions.close),oo=new Item$1({props:{icon:"trash",disabled:!to[6].canEditRows,$$slots:{default:[create_default_slot_4$1O]},$$scope:{ctx:to}}}),oo.$on("click",to[35]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment)},m(so,ao){mount_component(ue,so,ao),insert$1(so,eo,ao),mount_component(no,so,ao),insert$1(so,ro,ao),mount_component(oo,so,ao),io=!0},p(so,ao){const lo={};ao[0]&256&&(lo.disabled=!so[8]),ao[1]&16384&&(lo.$$scope={dirty:ao,ctx:so}),ue.$set(lo);const uo={};ao[0]&512&&(uo.disabled=!so[9]),ao[1]&16384&&(uo.$$scope={dirty:ao,ctx:so}),no.$set(uo);const co={};ao[0]&64&&(co.disabled=!so[6].canEditRows),ao[0]&1024|ao[1]&16384&&(co.$$scope={dirty:ao,ctx:so}),oo.$set(co)},i(so){io||(transition_in(ue.$$.fragment,so),transition_in(no.$$.fragment,so),transition_in(oo.$$.fragment,so),io=!0)},o(so){transition_out(ue.$$.fragment,so),transition_out(no.$$.fragment,so),transition_out(oo.$$.fragment,so),io=!1},d(so){so&&(detach(eo),detach(ro)),destroy_component(ue,so),destroy_component(no,so),destroy_component(oo,so)}}}function create_if_block_1$2J(to){let ue,eo,no,ro;return ue=new Item$1({props:{icon:"copy",disabled:!to[6].canAddRows||to[7]>50,$$slots:{default:[create_default_slot_3$2n]},$$scope:{ctx:to}}}),ue.$on("click",to[31]),ue.$on("click",to[13].actions.close),no=new Item$1({props:{icon:"trash",disabled:!to[6].canDeleteRows,$$slots:{default:[create_default_slot_2$35]},$$scope:{ctx:to}}}),no.$on("click",to[32]),no.$on("click",to[13].actions.close),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io[0]&192&&(so.disabled=!oo[6].canAddRows||oo[7]>50),io[0]&128|io[1]&16384&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io[0]&64&&(ao.disabled=!oo[6].canDeleteRows),io[0]&128|io[1]&16384&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_14$g(to){let ue;return{c(){ue=text("Copy")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_13$j(to){let ue;return{c(){ue=text("Paste")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_12$o(to){let ue;return{c(){ue=text("Edit row in modal")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_11$t(to){let ue;return{c(){ue=text("Copy row _id")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_10$w(to){let ue;return{c(){ue=text("Copy row _rev")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_9$A(to){let ue;return{c(){ue=text("Duplicate row")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_8$K(to){let ue;return{c(){ue=text("Delete row")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_3$1d(to){let ue,eo;return ue=new Item$1({props:{icon:"magic-wand",disabled:to[3]||!to[2],$$slots:{default:[create_default_slot_7$W]},$$scope:{ctx:to}}}),ue.$on("click",to[27]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&12&&(oo.disabled=no[3]||!no[2]),ro[1]&16384&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_7$W(to){let ue;return{c(){ue=text("Generate AI Columns")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_6$1b(to){let ue;return{c(){ue=text("Copy")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$1s(to){let ue;return{c(){ue=text("Paste")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$1O(to){let ue,eo,no;return{c(){ue=text("Delete "),eo=text(to[10]),no=text(" cells")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&1024&&set_data(eo,ro[10])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_default_slot_3$2n(to){let ue,eo,no;return{c(){ue=text("Duplicate "),eo=text(to[7]),no=text(" rows")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&128&&set_data(eo,ro[7])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_default_slot_2$35(to){let ue,eo,no;return{c(){ue=text("Delete "),eo=text(to[7]),no=text(" rows")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&128&&set_data(eo,ro[7])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_default_slot_1$4j(to){let ue,eo,no,ro;const oo=[create_if_block_1$2J,create_if_block_2$1I,create_else_block$1W],io=[];function so(ao,lo){return ao[0].multiRowMode?0:ao[0].multiCellMode?1:2}return ue=so(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$4()},m(ao,lo){io[ue].m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){let uo=ue;ue=so(ao),ue===uo?io[ue].p(ao,lo):(group_outros(),transition_out(io[uo],1,1,()=>{io[uo]=null}),check_outros(),eo=io[ue],eo?eo.p(ao,lo):(eo=io[ue]=oo[ue](ao),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(ao){ro||(transition_in(eo),ro=!0)},o(ao){transition_out(eo),ro=!1},d(ao){ao&&detach(no),io[ue].d(ao)}}}function create_default_slot$6l(to){let ue,eo;return ue=new Menu$1({props:{$$slots:{default:[create_default_slot_1$4j]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&4077|ro[1]&16384&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_key_block$h(to){let ue,eo;return ue=new GridPopover({props:{anchor:to[1],maxHeight:null,$$slots:{default:[create_default_slot$6l]},$$scope:{ctx:to}}}),ue.$on("close",to[13].actions.close),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&2&&(oo.anchor=no[1]),ro[0]&4077|ro[1]&16384&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a9(to){let ue,eo,no,ro,oo=to[0].visible&&create_if_block$4O(to);return{c(){ue=element("div"),eo=space$1(),oo&&oo.c(),no=empty$4(),attr(ue,"style",to[4]),attr(ue,"class","menu-anchor svelte-825iyj")},m(io,so){insert$1(io,ue,so),to[30](ue),insert$1(io,eo,so),oo&&oo.m(io,so),insert$1(io,no,so),ro=!0},p(io,so){(!ro||so[0]&16)&&attr(ue,"style",io[4]),io[0].visible?oo?(oo.p(io,so),so[0]&1&&transition_in(oo,1)):(oo=create_if_block$4O(io),oo.c(),transition_in(oo,1),oo.m(no.parentNode,no)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(io){ro||(transition_in(oo),ro=!0)},o(io){transition_out(oo),ro=!1},d(io){io&&(detach(ue),detach(eo),detach(no)),to[30](null),oo&&oo.d(io)}}}function instance$ad(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho;const{focusedRow:go,menu:bo,rows:vo,config:$o,dispatch:wo,focusedRowId:ko,notifications:So,hasBudibaseIdentifiers:To,selectedRowCount:Io,copyAllowed:Ao,pasteAllowed:Eo,selectedCellCount:Lo,visibleColumns:No,selectedCells:Do}=getContext$1("grid");component_subscribe(to,go,_s=>eo(5,lo=_s)),component_subscribe(to,bo,_s=>eo(0,uo=_s)),component_subscribe(to,$o,_s=>eo(6,co=_s)),component_subscribe(to,ko,_s=>eo(28,so=_s)),component_subscribe(to,So,_s=>eo(41,io=_s)),component_subscribe(to,To,_s=>eo(11,ho=_s)),component_subscribe(to,Io,_s=>eo(7,fo=_s)),component_subscribe(to,Ao,_s=>eo(8,po=_s)),component_subscribe(to,Eo,_s=>eo(9,mo=_s)),component_subscribe(to,Lo,_s=>eo(10,_o=_s)),component_subscribe(to,No,_s=>eo(29,ao=_s));let Po;const Mo=_s=>`left:${_s.left}px; top:${_s.top}px;`,Uo=()=>{bo.actions.close(),vo.actions.deleteRows([lo]),io.success("Deleted 1 row")},Vo=async()=>{bo.actions.close();const _s=await vo.actions.duplicateRow(lo);if(_s){const Is=ao[0],Bs=ao[ao.length-1],Hs=getCellID(_s._id,Is.name),Rs=getCellID(_s._id,Bs.name);Do.actions.selectRange(Hs,Rs)}},Wo=async _s=>{await copyToClipboard(_s),io.success("Copied to clipboard")},Zo=async()=>{bo.actions.close(),await vo.actions.applyRowChanges({rowId:so}),io.success("Generated AI columns")};function Yo(_s){binding_callbacks[_s?"unshift":"push"](()=>{Po=_s,eo(1,Po)})}const xo=()=>wo("request-bulk-duplicate"),Go=()=>wo("request-bulk-delete"),Xo=()=>wo("copy"),as=()=>wo("paste"),Ko=()=>wo("request-bulk-delete"),ls=()=>wo("copy"),Jo=()=>wo("paste"),hs=()=>wo("edit-row",lo),ks=()=>Wo(lo==null?void 0:lo._id),cs=()=>Wo(lo==null?void 0:lo._rev);return to.$$.update=()=>{to.$$.dirty[0]&1&&eo(4,no=Mo(uo)),to.$$.dirty[0]&268435456&&eo(3,ro=so===NewRowID),to.$$.dirty[0]&536870912&&eo(2,oo=ao.some(_s=>_s.schema.type===FieldType.AI))},[uo,Po,oo,ro,no,lo,co,fo,po,mo,_o,ho,go,bo,$o,wo,ko,So,To,Io,Ao,Eo,Lo,No,Uo,Vo,Wo,Zo,so,ao,Yo,xo,Go,Xo,as,Ko,ls,Jo,hs,ks,cs]}class MenuOverlay extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ad,create_fragment$a9,safe_not_equal,{},null,[-1,-1])}}const GutterCell_svelte_svelte_type_style_lang="";function create_else_block_1$v(to){let ue,eo,no,ro,oo,io,so;eo=new Checkbox_1({props:{value:to[3],disabled:to[7]}});let ao=!to[5]&&create_if_block_2$1H(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ao&&ao.c(),ro=empty$4(),attr(ue,"class","checkbox svelte-g7itl0"),toggle_class(ue,"visible",to[5]||to[3]||to[2]||to[1])},m(lo,uo){insert$1(lo,ue,uo),mount_component(eo,ue,null),insert$1(lo,no,uo),ao&&ao.m(lo,uo),insert$1(lo,ro,uo),oo=!0,io||(so=listen(ue,"click",to[10]),io=!0)},p(lo,uo){const co={};uo&8&&(co.value=lo[3]),uo&128&&(co.disabled=lo[7]),eo.$set(co),(!oo||uo&46)&&toggle_class(ue,"visible",lo[5]||lo[3]||lo[2]||lo[1]),lo[5]?ao&&(ao.d(1),ao=null):ao?ao.p(lo,uo):(ao=create_if_block_2$1H(lo),ao.c(),ao.m(ro.parentNode,ro))},i(lo){oo||(transition_in(eo.$$.fragment,lo),oo=!0)},o(lo){transition_out(eo.$$.fragment,lo),oo=!1},d(lo){lo&&(detach(ue),detach(no),detach(ro)),destroy_component(eo),ao&&ao.d(lo),io=!1,so()}}}function create_if_block_1$2I(to){let ue;const eo=to[14].default,no=create_slot(eo,to,to[15],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&32768)&&update_slot_base(no,eo,ro,ro[15],ue?get_slot_changes(eo,ro[15],oo,null):get_all_dirty_from_scope(ro[15]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_if_block_2$1H(to){let ue,eo=to[0].__idx+1+"",no;return{c(){ue=element("div"),no=text(eo),attr(ue,"class","number svelte-g7itl0"),toggle_class(ue,"visible",!(to[3]||to[2]||to[1]))},m(ro,oo){insert$1(ro,ue,oo),append$2(ue,no)},p(ro,oo){oo&1&&eo!==(eo=ro[0].__idx+1+"")&&set_data(no,eo),oo&14&&toggle_class(ue,"visible",!(ro[3]||ro[2]||ro[1]))},d(ro){ro&&detach(ue)}}}function create_else_block$1V(to){let ue,eo,no;return eo=new Icon({props:{size:"S",name:"arrows-out-simple",hoverable:!0}}),eo.$on("click",to[12]),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","expand svelte-g7itl0"),toggle_class(ue,"visible",to[8].canExpandRows&&to[4])},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){(!no||oo&272)&&toggle_class(ue,"visible",ro[8].canExpandRows&&ro[4])},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block$4N(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{name:"trash",size:"S",color:"var(--spectrum-global-color-red-400)"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","delete svelte-g7itl0")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[11]),ro=!0)},p:noop$5,i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_default_slot$6k(to){let ue,eo,no,ro,oo,io,so;const ao=[create_if_block_1$2I,create_else_block_1$v],lo=[];function uo(mo,_o){return mo[13].default?0:1}eo=uo(to),no=lo[eo]=ao[eo](to);const co=[create_if_block$4N,create_else_block$1V],fo=[];function po(mo,_o){return mo[3]&&mo[8].canDeleteRows?0:1}return oo=po(to),io=fo[oo]=co[oo](to),{c(){ue=element("div"),no.c(),ro=space$1(),io.c(),attr(ue,"class","gutter svelte-g7itl0"),toggle_class(ue,"selectable",to[8].canSelectRows)},m(mo,_o){insert$1(mo,ue,_o),lo[eo].m(ue,null),append$2(ue,ro),fo[oo].m(ue,null),so=!0},p(mo,_o){let ho=eo;eo=uo(mo),eo===ho?lo[eo].p(mo,_o):(group_outros(),transition_out(lo[ho],1,1,()=>{lo[ho]=null}),check_outros(),no=lo[eo],no?no.p(mo,_o):(no=lo[eo]=ao[eo](mo),no.c()),transition_in(no,1),no.m(ue,ro));let go=oo;oo=po(mo),oo===go?fo[oo].p(mo,_o):(group_outros(),transition_out(fo[go],1,1,()=>{fo[go]=null}),check_outros(),io=fo[oo],io?io.p(mo,_o):(io=fo[oo]=co[oo](mo),io.c()),transition_in(io,1),io.m(ue,null)),(!so||_o&256)&&toggle_class(ue,"selectable",mo[8].canSelectRows)},i(mo){so||(transition_in(no),transition_in(io),so=!0)},o(mo){transition_out(no),transition_out(io),so=!1},d(mo){mo&&detach(ue),lo[eo].d(),fo[oo].d()}}}function create_fragment$a8(to){var no,ro,oo;let ue,eo;return ue=new GridCell({props:{width:GutterWidth,highlighted:to[1]||to[2],selected:to[3],defaultHeight:to[6],rowIdx:(no=to[0])==null?void 0:no.__idx,metadata:(oo=(ro=to[0])==null?void 0:ro.__metadata)==null?void 0:oo.row,$$slots:{default:[create_default_slot$6k]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(io,so){mount_component(ue,io,so),eo=!0},p(io,[so]){var lo,uo,co;const ao={};so&6&&(ao.highlighted=io[1]||io[2]),so&8&&(ao.selected=io[3]),so&64&&(ao.defaultHeight=io[6]),so&1&&(ao.rowIdx=(lo=io[0])==null?void 0:lo.__idx),so&1&&(ao.metadata=(co=(uo=io[0])==null?void 0:uo.__metadata)==null?void 0:co.row),so&41407&&(ao.$$scope={dirty:so,ctx:io}),ue.$set(ao)},i(io){eo||(transition_in(ue.$$.fragment,io),eo=!0)},o(io){transition_out(ue.$$.fragment,io),eo=!1},d(io){destroy_component(ue,io)}}}function instance$ac(to,ue,eo){let no,{$$slots:ro={},$$scope:oo}=ue;const io=compute_slots(ro);let{row:so}=ue,{rowFocused:ao=!1}=ue,{rowHovered:lo=!1}=ue,{rowSelected:uo=!1}=ue,{expandable:co=!1}=ue,{disableNumber:fo=!1}=ue,{defaultHeight:po=!1}=ue,{disabled:mo=!1}=ue;const{config:_o,dispatch:ho,selectedRows:go}=getContext$1("grid");component_subscribe(to,_o,ko=>eo(8,no=ko));const bo=createEventDispatcher(),vo=ko=>{ko.stopPropagation(),bo("select");const So=so==null?void 0:so._id;So&&(ko.shiftKey?uo?ko.preventDefault():go.actions.bulkSelectRows(So):go.actions.toggleRow(So))},$o=ko=>{ko.stopPropagation(),ho("request-bulk-delete")},wo=ko=>{ko.stopPropagation(),bo("expand")};return to.$$set=ko=>{"row"in ko&&eo(0,so=ko.row),"rowFocused"in ko&&eo(1,ao=ko.rowFocused),"rowHovered"in ko&&eo(2,lo=ko.rowHovered),"rowSelected"in ko&&eo(3,uo=ko.rowSelected),"expandable"in ko&&eo(4,co=ko.expandable),"disableNumber"in ko&&eo(5,fo=ko.disableNumber),"defaultHeight"in ko&&eo(6,po=ko.defaultHeight),"disabled"in ko&&eo(7,mo=ko.disabled),"$$scope"in ko&&eo(15,oo=ko.$$scope)},[so,ao,lo,uo,co,fo,po,mo,no,_o,vo,$o,wo,io,ro,oo]}class GutterCell extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ac,create_fragment$a8,safe_not_equal,{row:0,rowFocused:1,rowHovered:2,rowSelected:3,expandable:4,disableNumber:5,defaultHeight:6,disabled:7})}}const KeyboardShortcut_svelte_svelte_type_style_lang="";function get_each_context$1$(to,ue,eo){const no=to.slice();return no[5]=ue[eo],no}function create_each_block$1$(to){let ue,eo=to[5]+"",no,ro;return{c(){ue=element("div"),no=text(eo),ro=space$1(),attr(ue,"class","key svelte-uhg3e3")},m(oo,io){insert$1(oo,ue,io),append$2(ue,no),append$2(ue,ro)},p(oo,io){io&4&&eo!==(eo=oo[5]+"")&&set_data(no,eo)},d(oo){oo&&detach(ue)}}}function create_fragment$a7(to){let ue,eo=ensure_array_like(to[2]),no=[];for(let ro=0;ro<eo.length;ro+=1)no[ro]=create_each_block$1$(get_each_context$1$(to,eo,ro));return{c(){ue=element("div");for(let ro=0;ro<no.length;ro+=1)no[ro].c();attr(ue,"class","keys svelte-uhg3e3"),toggle_class(ue,"padded",to[0]),toggle_class(ue,"overlay",to[1])},m(ro,oo){insert$1(ro,ue,oo);for(let io=0;io<no.length;io+=1)no[io]&&no[io].m(ue,null)},p(ro,[oo]){if(oo&4){eo=ensure_array_like(ro[2]);let io;for(io=0;io<eo.length;io+=1){const so=get_each_context$1$(ro,eo,io);no[io]?no[io].p(so,oo):(no[io]=create_each_block$1$(so),no[io].c(),no[io].m(ue,null))}for(;io<no.length;io+=1)no[io].d(1);no.length=eo.length}oo&1&&toggle_class(ue,"padded",ro[0]),oo&2&&toggle_class(ue,"overlay",ro[1])},i:noop$5,o:noop$5,d(ro){ro&&detach(ue),destroy_each(no,ro)}}}function instance$ab(to,ue,eo){let no,{keybind:ro}=ue,{padded:oo=!1}=ue,{overlay:io=!1}=ue;const so=ao=>ao==null?void 0:ao.split("+").map(lo=>lo.toLowerCase()==="ctrl"?navigator.platform.startsWith("Mac")?"⌘":lo:lo.toLowerCase()==="enter"?"↵":lo);return to.$$set=ao=>{"keybind"in ao&&eo(3,ro=ao.keybind),"padded"in ao&&eo(0,oo=ao.padded),"overlay"in ao&&eo(1,io=ao.overlay)},to.$$.update=()=>{to.$$.dirty&8&&eo(2,no=so(ro))},[oo,io,no,ro]}class KeyboardShortcut extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$ab,create_fragment$a7,safe_not_equal,{keybind:3,padded:0,overlay:1})}}const StickyColumn_svelte_svelte_type_style_lang="";function get_each_context$1_(to,ue,eo){var ao,lo;const no=to.slice();no[43]=ue[eo],no[49]=eo;const ro=!!no[0][no[43]._id];no[44]=ro;const oo=no[7]===no[43]._id&&(!no[8]||!no[9]);no[45]=oo;const io=((ao=no[10])==null?void 0:ao._id)===no[43]._id;no[46]=io;const so=getCellID(no[43]._id,(lo=no[1])==null?void 0:lo.name);return no[47]=so,no}const get_edit_column_slot_changes$1=to=>({}),get_edit_column_slot_context$1=to=>({});function create_if_block_3$1c(to){let ue,eo;return ue=new HeaderCell({props:{column:to[1],orderable:!1,idx:"sticky",$$slots:{default:[create_default_slot_3$2m]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&2&&(oo.column=no[1]),ro[1]&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$2m(to){let ue;const eo=to[35]["edit-column"],no=create_slot(eo,to,to[42],get_edit_column_slot_context$1);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2048)&&update_slot_base(no,eo,ro,ro[42],ue?get_slot_changes(eo,ro[42],oo,get_edit_column_slot_changes$1):get_all_dirty_from_scope(ro[42]),get_edit_column_slot_context$1)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_if_block_2$1G(to){let ue,eo;return ue=new DataCell({props:{row:to[43],cellId:to[47],rowFocused:to[46],rowSelected:to[44],cellSelected:to[12][to[47]],highlighted:to[45]||to[46],rowIdx:to[43].__idx,topRow:to[49]===0,focused:to[13]===to[47],selectedUser:to[14][to[47]],width:to[1].width,column:to[1],contentLines:to[15],isSelectingCells:to[9]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&64&&(oo.row=no[43]),ro[0]&66&&(oo.cellId=no[47]),ro[0]&1088&&(oo.rowFocused=no[46]),ro[0]&65&&(oo.rowSelected=no[44]),ro[0]&4162&&(oo.cellSelected=no[12][no[47]]),ro[0]&1984&&(oo.highlighted=no[45]||no[46]),ro[0]&64&&(oo.rowIdx=no[43].__idx),ro[0]&8258&&(oo.focused=no[13]===no[47]),ro[0]&16450&&(oo.selectedUser=no[14][no[47]]),ro[0]&2&&(oo.width=no[1].width),ro[0]&2&&(oo.column=no[1]),ro[0]&32768&&(oo.contentLines=no[15]),ro[0]&512&&(oo.isSelectingCells=no[9]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_each_block$1_(to){let ue,eo,no,ro,oo,io;eo=new GutterCell({props:{row:to[43],rowFocused:to[46],rowHovered:to[45],rowSelected:to[44]}});let so=to[1]&&create_if_block_2$1G(to);function ao(){return to[36](to[43])}function lo(){return to[38](to[43])}return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),so&&so.c(),attr(ue,"class","row svelte-15yu3r0")},m(uo,co){insert$1(uo,ue,co),mount_component(eo,ue,null),append$2(ue,no),so&&so.m(ue,null),ro=!0,oo||(io=[listen(ue,"mouseenter",function(){is_function(to[11]?null:ao)&&(to[11]?null:ao).apply(this,arguments)}),listen(ue,"mouseleave",function(){is_function(to[11]?null:to[37])&&(to[11]?null:to[37]).apply(this,arguments)}),listen(ue,"click",lo)],oo=!0)},p(uo,co){to=uo;const fo={};co[0]&64&&(fo.row=to[43]),co[0]&1088&&(fo.rowFocused=to[46]),co[0]&960&&(fo.rowHovered=to[45]),co[0]&65&&(fo.rowSelected=to[44]),eo.$set(fo),to[1]?so?(so.p(to,co),co[0]&2&&transition_in(so,1)):(so=create_if_block_2$1G(to),so.c(),transition_in(so,1),so.m(ue,null)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(uo){ro||(transition_in(eo.$$.fragment,uo),transition_in(so),ro=!0)},o(uo){transition_out(eo.$$.fragment,uo),transition_out(so),ro=!1},d(uo){uo&&detach(ue),destroy_component(eo),so&&so.d(),oo=!1,run_all(io)}}}function create_if_block$4M(to){let ue,eo,no,ro,oo,io;eo=new GutterCell({props:{rowHovered:to[7]===BlankRowID,$$slots:{default:[create_default_slot_2$34]},$$scope:{ctx:to}}});let so=to[1]&&create_if_block_1$2H(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),so&&so.c(),attr(ue,"class","row blank svelte-15yu3r0")},m(ao,lo){insert$1(ao,ue,lo),mount_component(eo,ue,null),append$2(ue,no),so&&so.m(ue,null),ro=!0,oo||(io=[listen(ue,"mouseenter",function(){is_function(to[11]?null:to[39])&&(to[11]?null:to[39]).apply(this,arguments)}),listen(ue,"mouseleave",function(){is_function(to[11]?null:to[40])&&(to[11]?null:to[40]).apply(this,arguments)}),listen(ue,"click",to[41])],oo=!0)},p(ao,lo){to=ao;const uo={};lo[0]&128&&(uo.rowHovered=to[7]===BlankRowID),lo[1]&2048&&(uo.$$scope={dirty:lo,ctx:to}),eo.$set(uo),to[1]?so?(so.p(to,lo),lo[0]&2&&transition_in(so,1)):(so=create_if_block_1$2H(to),so.c(),transition_in(so,1),so.m(ue,null)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(ao){ro||(transition_in(eo.$$.fragment,ao),transition_in(so),ro=!0)},o(ao){transition_out(eo.$$.fragment,ao),transition_out(so),ro=!1},d(ao){ao&&detach(ue),destroy_component(eo),so&&so.d(),oo=!1,run_all(io)}}}function create_default_slot_2$34(to){let ue,eo;return ue=new Icon({props:{name:"plus",color:"var(--spectrum-global-color-gray-500)"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$5,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$2H(to){let ue,eo;return ue=new GridCell({props:{width:to[1].width,highlighted:to[7]===BlankRowID,$$slots:{default:[create_default_slot_1$4i]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&2&&(oo.width=no[1].width),ro[0]&128&&(oo.highlighted=no[7]===BlankRowID),ro[1]&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$4i(to){let ue,eo;return ue=new KeyboardShortcut({props:{padded:!0,keybind:"Ctrl+Enter"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$5,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$6j(to){let ue,eo,no,ro=ensure_array_like(to[6]),oo=[];for(let ao=0;ao<ro.length;ao+=1)oo[ao]=create_each_block$1_(get_each_context$1_(to,ro,ao));const io=ao=>transition_out(oo[ao],1,1,()=>{oo[ao]=null});let so=to[16].canAddRows&&create_if_block$4M(to);return{c(){for(let ao=0;ao<oo.length;ao+=1)oo[ao].c();ue=space$1(),so&&so.c(),eo=empty$4()},m(ao,lo){for(let uo=0;uo<oo.length;uo+=1)oo[uo]&&oo[uo].m(ao,lo);insert$1(ao,ue,lo),so&&so.m(ao,lo),insert$1(ao,eo,lo),no=!0},p(ao,lo){if(lo[0]&268632003){ro=ensure_array_like(ao[6]);let uo;for(uo=0;uo<ro.length;uo+=1){const co=get_each_context$1_(ao,ro,uo);oo[uo]?(oo[uo].p(co,lo),transition_in(oo[uo],1)):(oo[uo]=create_each_block$1_(co),oo[uo].c(),transition_in(oo[uo],1),oo[uo].m(ue.parentNode,ue))}for(group_outros(),uo=ro.length;uo<oo.length;uo+=1)io(uo);check_outros()}ao[16].canAddRows?so?(so.p(ao,lo),lo[0]&65536&&transition_in(so,1)):(so=create_if_block$4M(ao),so.c(),transition_in(so,1),so.m(eo.parentNode,eo)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(ao){if(!no){for(let lo=0;lo<ro.length;lo+=1)transition_in(oo[lo]);transition_in(so),no=!0}},o(ao){oo=oo.filter(Boolean);for(let lo=0;lo<oo.length;lo+=1)transition_out(oo[lo]);transition_out(so),no=!1},d(ao){ao&&(detach(ue),detach(eo)),destroy_each(oo,ao),so&&so.d(ao)}}}function create_fragment$a6(to){let ue,eo,no,ro,oo,io,so;no=new GutterCell({props:{disableNumber:!0,defaultHeight:!0,rowSelected:to[3]&&to[3]===to[2],disabled:!to[6].length}}),no.$on("select",to[33]);let ao=to[1]&&create_if_block_3$1c(to);return io=new GridScrollWrapper({props:{scrollVertically:!0,attachHandlers:!0,$$slots:{default:[create_default_slot$6j]},$$scope:{ctx:to}}}),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),ao&&ao.c(),oo=space$1(),create_component(io.$$.fragment),attr(eo,"class","header row svelte-15yu3r0"),attr(ue,"class","sticky-column svelte-15yu3r0"),set_style(ue,"flex","0 0 "+to[4]+"px"),toggle_class(ue,"scrolled",to[5]>0)},m(lo,uo){insert$1(lo,ue,uo),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),ao&&ao.m(eo,null),append$2(ue,oo),mount_component(io,ue,null),so=!0},p(lo,uo){const co={};uo[0]&12&&(co.rowSelected=lo[3]&&lo[3]===lo[2]),uo[0]&64&&(co.disabled=!lo[6].length),no.$set(co),lo[1]?ao?(ao.p(lo,uo),uo[0]&2&&transition_in(ao,1)):(ao=create_if_block_3$1c(lo),ao.c(),transition_in(ao,1),ao.m(eo,null)):ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros());const fo={};uo[0]&131011|uo[1]&2048&&(fo.$$scope={dirty:uo,ctx:lo}),io.$set(fo),(!so||uo[0]&16)&&set_style(ue,"flex","0 0 "+lo[4]+"px"),(!so||uo[0]&32)&&toggle_class(ue,"scrolled",lo[5]>0)},i(lo){so||(transition_in(no.$$.fragment,lo),transition_in(ao),transition_in(io.$$.fragment,lo),so=!0)},o(lo){transition_out(no.$$.fragment,lo),transition_out(ao),transition_out(io.$$.fragment,lo),so=!1},d(lo){lo&&detach(ue),destroy_component(no),ao&&ao.d(),destroy_component(io)}}}function instance$aa(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,{$$slots:wo={},$$scope:ko}=ue;const{rows:So,selectedRows:To,displayColumn:Io,renderedRows:Ao,focusedCellId:Eo,hoveredRowId:Lo,config:No,selectedCellMap:Do,userCellMap:Po,focusedRow:Mo,scrollLeft:Uo,dispatch:Vo,contentLines:Wo,isDragging:Zo,isSelectingCells:Yo,selectedCellCount:xo}=getContext$1("grid");component_subscribe(to,So,ks=>eo(34,so=ks)),component_subscribe(to,To,ks=>eo(0,io=ks)),component_subscribe(to,Io,ks=>eo(1,ao=ks)),component_subscribe(to,Ao,ks=>eo(6,uo=ks)),component_subscribe(to,Eo,ks=>eo(13,go=ks)),component_subscribe(to,Lo,ks=>eo(7,co=ks)),component_subscribe(to,No,ks=>eo(16,$o=ks)),component_subscribe(to,Do,ks=>eo(12,ho=ks)),component_subscribe(to,Po,ks=>eo(14,bo=ks)),component_subscribe(to,Mo,ks=>eo(10,mo=ks)),component_subscribe(to,Uo,ks=>eo(5,lo=ks)),component_subscribe(to,Wo,ks=>eo(15,vo=ks)),component_subscribe(to,Zo,ks=>eo(11,_o=ks)),component_subscribe(to,Yo,ks=>eo(9,po=ks)),component_subscribe(to,xo,ks=>eo(8,fo=ks));const Go=()=>{if(ro===no)set_store_value(To,io={},io);else{let cs={};so.forEach(_s=>{cs[_s._id]=!0}),set_store_value(To,io=cs,io)}},Xo=ks=>set_store_value(Lo,co=ks._id,co),as=()=>set_store_value(Lo,co=null,co),Ko=ks=>Vo("rowclick",So.actions.cleanRow(ks)),ls=()=>set_store_value(Lo,co=BlankRowID,co),Jo=()=>set_store_value(Lo,co=null,co),hs=()=>Vo("add-row-inline");return to.$$set=ks=>{"$$scope"in ks&&eo(42,ko=ks.$$scope)},to.$$.update=()=>{to.$$.dirty[1]&8&&eo(2,no=so.length),to.$$.dirty[0]&1&&eo(3,ro=Object.values(io).length),to.$$.dirty[0]&2&&eo(4,oo=GutterWidth+((ao==null?void 0:ao.width)||0))},[io,ao,no,ro,oo,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,So,To,Io,Ao,Eo,Lo,No,Do,Po,Mo,Uo,Vo,Wo,Zo,Yo,xo,Go,so,wo,Xo,as,Ko,ls,Jo,hs,ko]}class StickyColumn extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$aa,create_fragment$a6,safe_not_equal,{},null,[-1,-1])}}const UserAvatars_svelte_svelte_type_style_lang="";function get_each_context$1Z(to,ue,eo){const no=to.slice();return no[4]=ue[eo],no}function create_each_block$1Z(to){let ue,eo;return ue=new UserAvatar({props:{user:to[4]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.user=no[4]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a5(to){let ue,eo,no=ensure_array_like(to[0]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1Z(get_each_context$1Z(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){ue=element("div");for(let io=0;io<ro.length;io+=1)ro[io].c();attr(ue,"class","users svelte-1ex8wrg")},m(io,so){insert$1(io,ue,so);for(let ao=0;ao<ro.length;ao+=1)ro[ao]&&ro[ao].m(ue,null);eo=!0},p(io,[so]){if(so&1){no=ensure_array_like(io[0]);let ao;for(ao=0;ao<no.length;ao+=1){const lo=get_each_context$1Z(io,no,ao);ro[ao]?(ro[ao].p(lo,so),transition_in(ro[ao],1)):(ro[ao]=create_each_block$1Z(lo),ro[ao].c(),transition_in(ro[ao],1),ro[ao].m(ue,null))}for(group_outros(),ao=no.length;ao<ro.length;ao+=1)oo(ao);check_outros()}},i(io){if(!eo){for(let so=0;so<no.length;so+=1)transition_in(ro[so]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let so=0;so<ro.length;so+=1)transition_out(ro[so]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function instance$a9(to,ue,eo){let no,ro;const{users:oo}=getContext$1("grid");component_subscribe(to,oo,so=>eo(2,ro=so));const io=so=>{let ao={};return so==null||so.forEach(lo=>{ao[lo.email]=lo}),Object.values(ao)};return to.$$.update=()=>{to.$$.dirty&4&&eo(0,no=io(ro))},[no,oo,ro]}class UserAvatars extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a9,create_fragment$a5,safe_not_equal,{})}}function instance$a8(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o;const{rows:ho,focusedCellId:go,visibleColumns:bo,rowLookupMap:vo,focusedCellAPI:$o,dispatch:wo,selectedRowCount:ko,config:So,menu:To,gridFocused:Io,keyboardBlocked:Ao,selectedCellCount:Eo,selectedCells:Lo,cellSelection:No,columnLookupMap:Do,focusedRowId:Po}=getContext$1("grid");component_subscribe(to,ho,Ko=>eo(15,oo=Ko)),component_subscribe(to,go,Ko=>eo(18,ao=Ko)),component_subscribe(to,bo,Ko=>eo(20,uo=Ko)),component_subscribe(to,vo,Ko=>eo(16,io=Ko)),component_subscribe(to,$o,Ko=>eo(13,no=Ko)),component_subscribe(to,ko,Ko=>eo(23,po=Ko)),component_subscribe(to,So,Ko=>eo(22,fo=Ko)),component_subscribe(to,Io,Ko=>eo(25,_o=Ko)),component_subscribe(to,Ao,Ko=>eo(24,mo=Ko)),component_subscribe(to,Eo,Ko=>eo(14,ro=Ko)),component_subscribe(to,No,Ko=>eo(17,so=Ko)),component_subscribe(to,Do,Ko=>eo(21,co=Ko)),component_subscribe(to,Po,Ko=>eo(19,lo=Ko));const Mo=[".spectrum-Modal",".date-time-popover","#builder-side-panel-container","[data-grid-ignore]"],Uo=Ko=>{var hs,ks,cs;if(!_o||mo)return;if((hs=Ko.target)!=null&&hs.closest){for(let _s of Mo)if(Ko.target.closest(_s))return}const ls=_s=>{Ko.preventDefault(),_s()};if(Ko.metaKey||Ko.ctrlKey)switch(Ko.key){case"c":return ls(()=>wo("copy"));case"v":return wo("paste");case"Enter":return ls(()=>{fo.canAddRows&&wo("add-row-inline")})}if(ro)switch(Ko.key){case"Escape":return ls(Lo.actions.clear);case"Delete":case"Backspace":return ls(()=>wo("request-bulk-delete"))}if(!ao){Ko.key==="Tab"||(ks=Ko.key)!=null&&ks.startsWith("Arrow")?ls(Vo):(Ko.key==="Delete"||Ko.key==="Backspace")&&ls(()=>{po&&fo.canDeleteRows&&wo("request-bulk-delete")});return}const Jo=no;if(Ko.key==="Escape")return ls(()=>{Jo!=null&&Jo.isActive()?setTimeout(Jo==null?void 0:Jo.blur,10):set_store_value(go,ao=null,ao),To.actions.close()});if(Ko.key==="Tab")return ls(()=>{var _s;(_s=Jo==null?void 0:Jo.blur)==null||_s.call(Jo),Wo(1)});if(!(!(Jo!=null&&Jo.isReadonly())&&((cs=Jo==null?void 0:Jo.onKeyDown)!=null&&cs.call(Jo,Ko)))&&!(Ko.metaKey||Ko.ctrlKey))switch(Ko.key){case"ArrowLeft":return ls(()=>Wo(-1,Ko.shiftKey));case"ArrowRight":return ls(()=>Wo(1,Ko.shiftKey));case"ArrowUp":return ls(()=>Zo(-1,Ko.shiftKey));case"ArrowDown":return ls(()=>Zo(1,Ko.shiftKey));case"Delete":case"Backspace":return ls(()=>{po&&fo.canDeleteRows?wo("request-bulk-delete"):Yo()});case"Enter":return ls(xo);default:return ls(()=>as(Ko.key,Ko.which))}},Vo=()=>{const Ko=oo[0];if(!Ko)return;const ls=uo[0];ls&&go.set(getCellID(Ko._id,ls.name))},Wo=(Ko,ls)=>{let Jo=ao;if(ls&&ro&&(Jo=so.targetCellId),!Jo)return;const{rowId:hs,field:ks}=parseCellID(Jo),cs=co[ks].__idx,_s=uo[cs+Ko];if(!_s)return;const Is=getCellID(hs,_s.name);ls?ro?(Lo.actions.updateTarget(Is),ro||go.set(Is)):Lo.actions.selectRange(Jo,Is):go.set(Is)},Zo=(Ko,ls)=>{if(lo===NewRowID)return;let Jo=ao;if(ls&&ro&&(Jo=so.targetCellId),!Jo)return;const{rowId:hs,field:ks}=parseCellID(Jo),cs=io[hs].__idx,_s=oo[cs+Ko];if(!_s)return;const Is=getCellID(_s._id,ks);ls?ro?(Lo.actions.updateTarget(Is),ro||go.set(Is)):Lo.actions.selectRange(Jo,Is):go.set(Is)},Yo=debounce(()=>{no!=null&&no.isReadonly()||no.setValue(null)},100),xo=()=>{var Ko;no!=null&&no.isReadonly()||(Ko=no==null?void 0:no.focus)==null||Ko.call(no)},Go=Ko=>Ko>=48&&Ko<=57,Xo=Ko=>Ko>=65&&Ko<=90,as=(Ko,ls)=>{if(no&&!no.isReadonly()){const Jo=no.getType();Jo==="number"&&Go(ls)?(no.setValue(parseInt(Ko),{apply:!1}),no.focus()):["string","barcodeqr","longform"].includes(Jo)&&(Xo(ls)||Go(ls))&&(no.setValue(Ko,{apply:!1}),no.focus())}};return onMount(()=>(document.addEventListener("keydown",Uo),()=>{document.removeEventListener("keydown",Uo)})),[ho,go,bo,vo,$o,ko,So,Io,Ao,Eo,No,Do,Po]}class KeyboardManager extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a8,null,safe_not_equal,{},null,[-1,-1])}}const NewRow_svelte_svelte_type_style_lang="";function get_each_context$1Y(to,ue,eo){const no=to.slice();no[64]=ue[eo];const ro=getCellID(NewRowID,no[64].name);return no[65]=ro,no}function get_if_ctx$3(to){const ue=to.slice(),eo=getCellID(NewRowID,ue[1].name);return ue[65]=eo,ue}function create_if_block_7$o(to){let ue,eo,no,ro,oo,io;return eo=new Icon({props:{name:"plus",size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","new-row-fab svelte-8ib1kg"),toggle_class(ue,"offset",!to[1])},m(so,ao){insert$1(so,ue,ao),mount_component(eo,ue,null),ro=!0,oo||(io=listen(ue,"click",to[54]),oo=!0)},p(so,ao){(!ro||ao[0]&2)&&toggle_class(ue,"offset",!so[1])},i(so){ro||(transition_in(eo.$$.fragment,so),so&&add_render_callback(()=>{ro&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!0)),no.run(1))}),ro=!0)},o(so){transition_out(eo.$$.fragment,so),so&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!1)),no.run(0)),ro=!1},d(so){so&&detach(ue),destroy_component(eo),so&&no&&no.end(),oo=!1,io()}}}function create_default_slot_6$1a(to){let ue,eo,no=!to[2]&&!to[7]&&to[14].canAddRows&&create_if_block_7$o(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,oo){!ro[2]&&!ro[7]&&ro[14].canAddRows?no?(no.p(ro,oo),oo[0]&16516&&transition_in(no,1)):(no=create_if_block_7$o(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function create_if_block$4L(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So;uo=new GutterCell({props:{expandable:!0,rowHovered:!0,$$slots:{default:[create_default_slot_5$1r]},$$scope:{ctx:to}}}),uo.$on("expand",to[42]);let To=to[1]&&create_if_block_3$1b(get_if_ctx$3(to));return _o=new GridScrollWrapper({props:{scrollHorizontally:!0,attachHandlers:!0,$$slots:{default:[create_default_slot_2$33]},$$scope:{ctx:to}}}),vo=new Button({props:{size:"M",cta:!0,disabled:to[3],$$slots:{default:[create_default_slot_1$4h]},$$scope:{ctx:to}}}),vo.$on("click",to[39]),wo=new Button({props:{size:"M",secondary:!0,newStyles:!0,$$slots:{default:[create_default_slot$6i]},$$scope:{ctx:to}}}),wo.$on("click",to[40]),{c(){ue=element("div"),eo=element("div"),ro=space$1(),oo=element("div"),so=space$1(),ao=element("div"),lo=element("div"),create_component(uo.$$.fragment),co=space$1(),To&&To.c(),po=space$1(),mo=element("div"),create_component(_o.$$.fragment),go=space$1(),bo=element("div"),create_component(vo.$$.fragment),$o=space$1(),create_component(wo.$$.fragment),attr(eo,"class","underlay sticky svelte-8ib1kg"),attr(oo,"class","underlay svelte-8ib1kg"),attr(lo,"class","row svelte-8ib1kg"),attr(ao,"class","sticky-column svelte-8ib1kg"),attr(mo,"class","normal-columns svelte-8ib1kg"),attr(bo,"class","buttons svelte-8ib1kg"),toggle_class(bo,"flip",to[5]),attr(ue,"class","new-row svelte-8ib1kg"),set_style(ue,"--offset",to[0]+"px"),set_style(ue,"--sticky-width",to[8]+"px"),toggle_class(ue,"floating",to[0]>0)},m(Io,Ao){insert$1(Io,ue,Ao),append$2(ue,eo),append$2(ue,ro),append$2(ue,oo),append$2(ue,so),append$2(ue,ao),append$2(ao,lo),mount_component(uo,lo,null),append$2(lo,co),To&&To.m(lo,null),append$2(ue,po),append$2(ue,mo),mount_component(_o,mo,null),append$2(ue,go),append$2(ue,bo),mount_component(vo,bo,null),append$2(bo,$o),mount_component(wo,bo,null),So=!0},p(Io,Ao){const Eo={};Ao[0]&8|Ao[2]&64&&(Eo.$$scope={dirty:Ao,ctx:Io}),uo.$set(Eo),Io[1]?To?(To.p(get_if_ctx$3(Io),Ao),Ao[0]&2&&transition_in(To,1)):(To=create_if_block_3$1b(get_if_ctx$3(Io)),To.c(),transition_in(To,1),To.m(lo,null)):To&&(group_outros(),transition_out(To,1,1,()=>{To=null}),check_outros());const Lo={};Ao[0]&98841|Ao[2]&64&&(Lo.$$scope={dirty:Ao,ctx:Io}),_o.$set(Lo);const No={};Ao[0]&8&&(No.disabled=Io[3]),Ao[2]&64&&(No.$$scope={dirty:Ao,ctx:Io}),vo.$set(No);const Do={};Ao[2]&64&&(Do.$$scope={dirty:Ao,ctx:Io}),wo.$set(Do),(!So||Ao[0]&32)&&toggle_class(bo,"flip",Io[5]),(!So||Ao[0]&1)&&set_style(ue,"--offset",Io[0]+"px"),(!So||Ao[0]&256)&&set_style(ue,"--sticky-width",Io[8]+"px"),(!So||Ao[0]&1)&&toggle_class(ue,"floating",Io[0]>0)},i(Io){So||(Io&&add_render_callback(()=>{So&&(no||(no=create_bidirectional_transition(eo,fade,{duration:130},!0)),no.run(1))}),Io&&add_render_callback(()=>{So&&(io||(io=create_bidirectional_transition(oo,fade,{duration:130},!0)),io.run(1))}),transition_in(uo.$$.fragment,Io),transition_in(To),Io&&add_render_callback(()=>{So&&(fo||(fo=create_bidirectional_transition(ao,fade,{duration:130},!0)),fo.run(1))}),transition_in(_o.$$.fragment,Io),Io&&add_render_callback(()=>{So&&(ho||(ho=create_bidirectional_transition(mo,fade,{duration:130},!0)),ho.run(1))}),transition_in(vo.$$.fragment,Io),transition_in(wo.$$.fragment,Io),Io&&add_render_callback(()=>{So&&(ko||(ko=create_bidirectional_transition(bo,fade,{duration:130},!0)),ko.run(1))}),So=!0)},o(Io){Io&&(no||(no=create_bidirectional_transition(eo,fade,{duration:130},!1)),no.run(0)),Io&&(io||(io=create_bidirectional_transition(oo,fade,{duration:130},!1)),io.run(0)),transition_out(uo.$$.fragment,Io),transition_out(To),Io&&(fo||(fo=create_bidirectional_transition(ao,fade,{duration:130},!1)),fo.run(0)),transition_out(_o.$$.fragment,Io),Io&&(ho||(ho=create_bidirectional_transition(mo,fade,{duration:130},!1)),ho.run(0)),transition_out(vo.$$.fragment,Io),transition_out(wo.$$.fragment,Io),Io&&(ko||(ko=create_bidirectional_transition(bo,fade,{duration:130},!1)),ko.run(0)),So=!1},d(Io){Io&&detach(ue),Io&&no&&no.end(),Io&&io&&io.end(),destroy_component(uo),To&&To.d(),Io&&fo&&fo.end(),destroy_component(_o),Io&&ho&&ho.end(),destroy_component(vo),destroy_component(wo),Io&&ko&&ko.end()}}}function create_if_block_6$u(to){let ue,eo;return{c(){ue=element("div"),attr(ue,"class","loading-overlay svelte-8ib1kg")},m(no,ro){insert$1(no,ue,ro)},i(no){no&&(eo||add_render_callback(()=>{eo=create_in_transition(ue,fade,{duration:130}),eo.start()}))},o:noop$5,d(no){no&&detach(ue)}}}function create_default_slot_5$1r(to){let ue,eo,no,ro;ue=new Icon({props:{name:"plus",color:"var(--spectrum-global-color-gray-500)"}});let oo=to[3]&&create_if_block_6$u();return{c(){create_component(ue.$$.fragment),eo=space$1(),oo&&oo.c(),no=empty$4()},m(io,so){mount_component(ue,io,so),insert$1(io,eo,so),oo&&oo.m(io,so),insert$1(io,no,so),ro=!0},p(io,so){io[3]?oo?so[0]&8&&transition_in(oo,1):(oo=create_if_block_6$u(),oo.c(),transition_in(oo,1),oo.m(no.parentNode,no)):oo&&(oo.d(1),oo=null)},i(io){ro||(transition_in(ue.$$.fragment,io),transition_in(oo),ro=!0)},o(io){transition_out(ue.$$.fragment,io),ro=!1},d(io){io&&(detach(eo),detach(no)),destroy_component(ue,io),oo&&oo.d(io)}}}function create_if_block_3$1b(to){let ue,eo;return ue=new DataCell({props:{cellId:to[65],rowFocused:!0,column:to[1],row:to[4],focused:to[9]===to[65],width:to[1].width,updateValue:to[41],topRow:to[0]===0,$$slots:{default:[create_default_slot_4$1N]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&2&&(oo.cellId=no[65]),ro[0]&2&&(oo.column=no[1]),ro[0]&16&&(oo.row=no[4]),ro[0]&514&&(oo.focused=no[9]===no[65]),ro[0]&2&&(oo.width=no[1].width),ro[0]&1&&(oo.topRow=no[0]===0),ro[0]&10|ro[2]&64&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_5$H(to){let ue;return{c(){ue=element("div"),ue.textContent="Can't edit auto column",attr(ue,"class","readonly-overlay svelte-8ib1kg")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_4$U(to){let ue,eo;return{c(){ue=element("div"),attr(ue,"class","loading-overlay svelte-8ib1kg")},m(no,ro){insert$1(no,ue,ro)},i(no){no&&(eo||add_render_callback(()=>{eo=create_in_transition(ue,fade,{duration:130}),eo.start()}))},o:noop$5,d(no){no&&detach(ue)}}}function create_default_slot_4$1N(to){var oo,io;let ue,eo,no=((io=(oo=to[1])==null?void 0:oo.schema)==null?void 0:io.autocolumn)&&create_if_block_5$H(),ro=to[3]&&create_if_block_4$U();return{c(){no&&no.c(),ue=space$1(),ro&&ro.c(),eo=empty$4()},m(so,ao){no&&no.m(so,ao),insert$1(so,ue,ao),ro&&ro.m(so,ao),insert$1(so,eo,ao)},p(so,ao){var lo,uo;(uo=(lo=so[1])==null?void 0:lo.schema)!=null&&uo.autocolumn?no||(no=create_if_block_5$H(),no.c(),no.m(ue.parentNode,ue)):no&&(no.d(1),no=null),so[3]?ro?ao[0]&8&&transition_in(ro,1):(ro=create_if_block_4$U(),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro&&(ro.d(1),ro=null)},d(so){so&&(detach(ue),detach(eo)),no&&no.d(so),ro&&ro.d(so)}}}function create_if_block_2$1F(to){let ue;return{c(){ue=element("div"),ue.textContent="Can't edit auto column",attr(ue,"class","readonly-overlay svelte-8ib1kg")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_1$2G(to){let ue,eo;return{c(){ue=element("div"),attr(ue,"class","loading-overlay svelte-8ib1kg")},m(no,ro){insert$1(no,ue,ro)},i(no){no&&(eo||add_render_callback(()=>{eo=create_in_transition(ue,fade,{duration:130}),eo.start()}))},o:noop$5,d(no){no&&detach(ue)}}}function create_default_slot_3$2l(to){var oo,io;let ue,eo,no=((io=(oo=to[64])==null?void 0:oo.schema)==null?void 0:io.autocolumn)&&create_if_block_2$1F(),ro=to[3]&&create_if_block_1$2G();return{c(){no&&no.c(),ue=space$1(),ro&&ro.c(),eo=space$1()},m(so,ao){no&&no.m(so,ao),insert$1(so,ue,ao),ro&&ro.m(so,ao),insert$1(so,eo,ao)},p(so,ao){var lo,uo;(uo=(lo=so[64])==null?void 0:lo.schema)!=null&&uo.autocolumn?no||(no=create_if_block_2$1F(),no.c(),no.m(ue.parentNode,ue)):no&&(no.d(1),no=null),so[3]?ro?ao[0]&8&&transition_in(ro,1):(ro=create_if_block_1$2G(),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro&&(ro.d(1),ro=null)},d(so){so&&(detach(ue),detach(eo)),no&&no.d(so),ro&&ro.d(so)}}}function create_each_block$1Y(to){let ue,eo;return ue=new DataCell({props:{cellId:to[65],column:to[64],updateValue:to[41],rowFocused:!0,row:to[4],focused:to[9]===to[65],width:to[64].width,topRow:to[0]===0,hidden:!to[16][to[64].name],$$slots:{default:[create_default_slot_3$2l]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&32768&&(oo.cellId=no[65]),ro[0]&32768&&(oo.column=no[64]),ro[0]&16&&(oo.row=no[4]),ro[0]&33280&&(oo.focused=no[9]===no[65]),ro[0]&32768&&(oo.width=no[64].width),ro[0]&1&&(oo.topRow=no[0]===0),ro[0]&98304&&(oo.hidden=!no[16][no[64].name]),ro[0]&32776|ro[2]&64&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$33(to){let ue,eo,no=ensure_array_like(to[15]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1Y(get_each_context$1Y(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){ue=element("div");for(let io=0;io<ro.length;io+=1)ro[io].c();attr(ue,"class","row svelte-8ib1kg")},m(io,so){insert$1(io,ue,so);for(let ao=0;ao<ro.length;ao+=1)ro[ao]&&ro[ao].m(ue,null);eo=!0},p(io,so){if(so[0]&98841|so[1]&1024){no=ensure_array_like(io[15]);let ao;for(ao=0;ao<no.length;ao+=1){const lo=get_each_context$1Y(io,no,ao);ro[ao]?(ro[ao].p(lo,so),transition_in(ro[ao],1)):(ro[ao]=create_each_block$1Y(lo),ro[ao].c(),transition_in(ro[ao],1),ro[ao].m(ue,null))}for(group_outros(),ao=no.length;ao<ro.length;ao+=1)oo(ao);check_outros()}},i(io){if(!eo){for(let so=0;so<no.length;so+=1)transition_in(ro[so]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let so=0;so<ro.length;so+=1)transition_out(ro[so]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_default_slot_1$4h(to){let ue,eo,no,ro;return no=new KeyboardShortcut({props:{overlay:!0,keybind:"Ctrl+Enter"}}),{c(){ue=element("div"),eo=text(`Save
|
|
550
550
|
`),create_component(no.$$.fragment),attr(ue,"class","button-with-keys svelte-8ib1kg")},m(oo,io){insert$1(oo,ue,io),append$2(ue,eo),mount_component(no,ue,null),ro=!0},p:noop$5,i(oo){ro||(transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(no)}}}function create_default_slot$6i(to){let ue,eo,no,ro;return no=new KeyboardShortcut({props:{keybind:"Esc"}}),{c(){ue=element("div"),eo=text(`Cancel
|
|
551
|
-
`),create_component(no.$$.fragment),attr(ue,"class","button-with-keys svelte-8ib1kg")},m(oo,io){insert$1(oo,ue,io),append$2(ue,eo),mount_component(no,ue,null),ro=!0},p:noop$5,i(oo){ro||(transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(no)}}}function create_fragment$a4(to){var io,so;let ue,eo,no,ro;ue=new TempTooltip({props:{text:"Click here to create your first row",condition:to[6]&&to[10]&&!((io=to[11])!=null&&io.length)&&!((so=to[12])!=null&&so.length)&&!to[13],type:TooltipType.Info,$$slots:{default:[create_default_slot_6$1a]},$$scope:{ctx:to}}});let oo=to[2]&&create_if_block$4L(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),oo&&oo.c(),no=empty$4()},m(ao,lo){mount_component(ue,ao,lo),insert$1(ao,eo,lo),oo&&oo.m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){var co,fo;const uo={};lo[0]&15424&&(uo.condition=ao[6]&&ao[10]&&!((co=ao[11])!=null&&co.length)&&!((fo=ao[12])!=null&&fo.length)&&!ao[13]),lo[0]&16518|lo[2]&64&&(uo.$$scope={dirty:lo,ctx:ao}),ue.$set(uo),ao[2]?oo?(oo.p(ao,lo),lo[0]&4&&transition_in(oo,1)):(oo=create_if_block$4L(ao),oo.c(),transition_in(oo,1),oo.m(no.parentNode,no)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(ao){ro||(transition_in(ue.$$.fragment,ao),transition_in(oo),ro=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(oo),ro=!1},d(ao){ao&&(detach(eo),detach(no)),destroy_component(ue,ao),oo&&oo.d(ao)}}}function instance$a7(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So,To,Io,Ao,Eo,Lo,No,Do;const{hoveredRowId:Po,focusedCellId:Mo,displayColumn:Uo,scroll:Vo,dispatch:Wo,rows:Zo,focusedCellAPI:Yo,datasource:xo,subscribe:Go,renderedRows:Xo,scrollableColumns:as,rowHeight:Ko,hasNextPage:ls,maxScrollTop:Jo,selectedRows:hs,loaded:ks,refreshing:cs,config:_s,filter:Is,inlineFilters:Bs,columnRenderMap:Hs,visibleColumns:Rs,scrollTop:Ds,height:Js}=getContext$1("grid");component_subscribe(to,Po,Vs=>eo(57,fo=Vs)),component_subscribe(to,Mo,Vs=>eo(9,co=Vs)),component_subscribe(to,Uo,Vs=>eo(1,ko=Vs)),component_subscribe(to,Zo,Vs=>eo(50,vo=Vs)),component_subscribe(to,Yo,Vs=>eo(56,uo=Vs)),component_subscribe(to,xo,Vs=>eo(52,wo=Vs)),component_subscribe(to,Xo,Vs=>eo(49,bo=Vs)),component_subscribe(to,as,Vs=>eo(15,No=Vs)),component_subscribe(to,Ko,Vs=>eo(46,_o=Vs)),component_subscribe(to,ls,Vs=>eo(45,mo=Vs)),component_subscribe(to,Jo,Vs=>eo(58,po=Vs)),component_subscribe(to,hs,Vs=>eo(51,$o=Vs)),component_subscribe(to,ks,Vs=>eo(10,To=Vs)),component_subscribe(to,cs,Vs=>eo(13,Eo=Vs)),component_subscribe(to,_s,Vs=>eo(14,Lo=Vs)),component_subscribe(to,Is,Vs=>eo(11,Io=Vs)),component_subscribe(to,Bs,Vs=>eo(12,Ao=Vs)),component_subscribe(to,Hs,Vs=>eo(16,Do=Vs)),component_subscribe(to,Rs,Vs=>eo(53,So=Vs)),component_subscribe(to,Ds,Vs=>eo(48,go=Vs)),component_subscribe(to,Js,Vs=>eo(47,ho=Vs));let Cs=!1,da=!1,Es,gs=0;const Ts=(Vs,Qs,ca,ra)=>Vs?0:(eo(0,gs=Qs*ca-ra%ca),Qs!==0&&eo(0,gs-=1),gs),ws=async()=>{eo(3,da=!0),set_store_value(Mo,co=null,co),await tick();const Vs=gs?void 0:0;let Qs={...Es};delete Qs._isNewRow;const ca=await Zo.actions.addRow({row:Qs,idx:Vs});ca&&(bs(),no&&set_store_value(Mo,co=getCellID(ca._id,no.name),co)),eo(3,da=!1)},bs=()=>{eo(3,da=!1),eo(2,Cs=!1),set_store_value(Mo,co=null,co),set_store_value(Po,fo=null,fo),document.removeEventListener("keydown",Ks)},Us=async()=>{if(Cs&&!da){await ws();return}Cs||!no||(mo||Vo.update(Vs=>({...Vs,top:po})),eo(4,Es={_isNewRow:!0}),eo(2,Cs=!0),set_store_value(Po,fo=NewRowID,fo),no&&set_store_value(Mo,co=getCellID(NewRowID,no.name),co),document.addEventListener("keydown",Ks))},qs=({column:Vs,value:Qs})=>{eo(4,Es[Vs]=Qs,Es)},Ys=()=>{bs(),Wo("add-row")},Ks=Vs=>{Cs&&Vs.key==="Escape"&&(uo!=null&&uo.isActive()||(Vs.preventDefault(),bs()))};onMount(()=>Go("add-row-inline",Us)),onDestroy(()=>{document.removeEventListener("keydown",Ks)});const Xs=()=>Wo("add-row-inline");return to.$$.update=()=>{to.$$.dirty[1]&4194304&&(no=So[0]),to.$$.dirty[0]&2&&eo(8,ro=GutterWidth+((ko==null?void 0:ko.width)||0)),to.$$.dirty[1]&2097152&&eo(2,Cs=!1),to.$$.dirty[1]&1048576&&eo(7,oo=Object.values($o).length),to.$$.dirty[1]&524288&&eo(6,io=!vo.length),to.$$.dirty[1]&262144&&eo(44,so=bo.length),to.$$.dirty[1]&188416&&eo(0,gs=Ts(mo,so,_o,go)),to.$$.dirty[0]&1|to.$$.dirty[1]&98304&&eo(43,ao=ho-gs-_o),to.$$.dirty[1]&4096&&eo(5,lo=ao<36+DefaultRowHeight)},[gs,ko,Cs,da,Es,lo,io,oo,ro,co,To,Io,Ao,Eo,Lo,No,Do,Po,Mo,Uo,Wo,Zo,Yo,xo,Xo,as,Ko,ls,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,ws,bs,qs,Ys,ao,so,mo,_o,ho,go,bo,vo,$o,wo,So,Xs]}class NewRow extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a7,create_fragment$a4,safe_not_equal,{},null,[-1,-1,-1])}}const createGridWebsocket=to=>{const{rows:ue,datasource:eo,users:no,focusedCellId:ro,definition:oo,API:io}=to,so=createWebsocket("/socket/grid"),ao=lo=>{if(!so.connected)return;const uo=io.getAppID();so.emit(GridSocketEvent.SelectDatasource,{datasource:lo,appId:uo},({users:co})=>{no.set(co)})};return so.on("connect",()=>{ao(get_store_value(eo))}),so.on("connect_error",lo=>{console.error("Failed to connect to grid websocket:",lo.message)}),so.onOther(SocketEvent.UserUpdate,({user:lo})=>{no.actions.updateUser(lo)}),so.onOther(SocketEvent.UserDisconnect,({sessionId:lo})=>{no.actions.removeUser(lo)}),so.onOther(GridSocketEvent.RowChange,async({id:lo,row:uo})=>{lo?ue.actions.replaceRow(lo,uo):uo.id&&await ue.actions.refreshRow(uo.id)}),so.onOther(GridSocketEvent.DatasourceChange,({datasource:lo})=>{lo&&oo.set(lo)}),so.on(GridSocketEvent.DatasourceChange,({datasource:lo})=>{var uo;(lo==null?void 0:lo.name)!==((uo=get_store_value(oo))==null?void 0:uo.name)&&oo.set(lo)}),eo.subscribe(ao),ro.subscribe(lo=>{so.emit(GridSocketEvent.SelectCell,{cellId:lo})}),()=>so==null?void 0:so.disconnect()},Grid_svelte_svelte_type_style_lang="",get_add_column_slot_changes=to=>({}),get_add_column_slot_context=to=>({}),get_edit_column_slot_changes_1=to=>({}),get_edit_column_slot_context_1=to=>({}),get_edit_column_slot_changes=to=>({}),get_edit_column_slot_context=to=>({}),get_controls_right_slot_changes=to=>({}),get_controls_right_slot_context=to=>({}),get_controls_slot_changes$1=to=>({}),get_controls_slot_context$1=to=>({});function create_if_block_5$G(to){let ue,eo,no,ro,oo,io;const so=to[49].controls,ao=create_slot(so,to,to[52],get_controls_slot_context$1),lo=to[49]["controls-right"],uo=create_slot(lo,to,to[52],get_controls_right_slot_context);let co=to[2]&&create_if_block_6$t();return{c(){ue=element("div"),eo=element("div"),ao&&ao.c(),no=space$1(),ro=element("div"),uo&&uo.c(),oo=space$1(),co&&co.c(),attr(eo,"class","controls-left svelte-xkde75"),attr(ro,"class","controls-right svelte-xkde75"),attr(ue,"class","controls svelte-xkde75")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),ao&&ao.m(eo,null),append$2(ue,no),append$2(ue,ro),uo&&uo.m(ro,null),append$2(ro,oo),co&&co.m(ro,null),io=!0},p(fo,po){ao&&ao.p&&(!io||po[1]&2097152)&&update_slot_base(ao,so,fo,fo[52],io?get_slot_changes(so,fo[52],po,get_controls_slot_changes$1):get_all_dirty_from_scope(fo[52]),get_controls_slot_context$1),uo&&uo.p&&(!io||po[1]&2097152)&&update_slot_base(uo,lo,fo,fo[52],io?get_slot_changes(lo,fo[52],po,get_controls_right_slot_changes):get_all_dirty_from_scope(fo[52]),get_controls_right_slot_context),fo[2]?co?po[0]&4&&transition_in(co,1):(co=create_if_block_6$t(),co.c(),transition_in(co,1),co.m(ro,null)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros())},i(fo){io||(transition_in(ao,fo),transition_in(uo,fo),transition_in(co),io=!0)},o(fo){transition_out(ao,fo),transition_out(uo,fo),transition_out(co),io=!1},d(fo){fo&&detach(ue),ao&&ao.d(fo),uo&&uo.d(fo),co&&co.d()}}}function create_if_block_6$t(to){let ue,eo;return ue=new UserAvatars({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$1a(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So;no=new StickyColumn({props:{$$slots:{"edit-column":[create_edit_column_slot_1]},$$scope:{ctx:to}}}),io=new HeaderRow({props:{$$slots:{"edit-column":[create_edit_column_slot$1],"add-column":[create_add_column_slot$1]},$$scope:{ctx:to}}}),ao=new GridBody({});let To=to[10].canAddRows&&create_if_block_4$T();return fo=new ResizeOverlay({}),mo=new ReorderOverlay({}),ho=new ScrollOverlay({}),bo=new MenuOverlay({}),$o=new PopoverOverlay({}),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),oo=element("div"),create_component(io.$$.fragment),so=space$1(),create_component(ao.$$.fragment),lo=space$1(),To&&To.c(),uo=space$1(),co=element("div"),create_component(fo.$$.fragment),po=space$1(),create_component(mo.$$.fragment),_o=space$1(),create_component(ho.$$.fragment),go=space$1(),create_component(bo.$$.fragment),vo=space$1(),create_component($o.$$.fragment),attr(oo,"class","grid-data-content svelte-xkde75"),attr(co,"class","overlays svelte-xkde75"),attr(eo,"class","grid-data-inner svelte-xkde75"),attr(ue,"class","grid-data-outer svelte-xkde75")},m(Io,Ao){insert$1(Io,ue,Ao),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),append$2(eo,oo),mount_component(io,oo,null),append$2(oo,so),mount_component(ao,oo,null),append$2(eo,lo),To&&To.m(eo,null),append$2(eo,uo),append$2(eo,co),mount_component(fo,co,null),append$2(co,po),mount_component(mo,co,null),append$2(co,_o),mount_component(ho,co,null),append$2(co,go),mount_component(bo,co,null),append$2(co,vo),mount_component($o,co,null),wo=!0,ko||(So=action_destroyer(clickOutside.call(null,ue,to[16].actions.blur)),ko=!0)},p(Io,Ao){const Eo={};Ao[1]&2097152&&(Eo.$$scope={dirty:Ao,ctx:Io}),no.$set(Eo);const Lo={};Ao[1]&2097152&&(Lo.$$scope={dirty:Ao,ctx:Io}),io.$set(Lo),Io[10].canAddRows?To?Ao[0]&1024&&transition_in(To,1):(To=create_if_block_4$T(),To.c(),transition_in(To,1),To.m(eo,uo)):To&&(group_outros(),transition_out(To,1,1,()=>{To=null}),check_outros())},i(Io){wo||(transition_in(no.$$.fragment,Io),transition_in(io.$$.fragment,Io),transition_in(ao.$$.fragment,Io),transition_in(To),transition_in(fo.$$.fragment,Io),transition_in(mo.$$.fragment,Io),transition_in(ho.$$.fragment,Io),transition_in(bo.$$.fragment,Io),transition_in($o.$$.fragment,Io),wo=!0)},o(Io){transition_out(no.$$.fragment,Io),transition_out(io.$$.fragment,Io),transition_out(ao.$$.fragment,Io),transition_out(To),transition_out(fo.$$.fragment,Io),transition_out(mo.$$.fragment,Io),transition_out(ho.$$.fragment,Io),transition_out(bo.$$.fragment,Io),transition_out($o.$$.fragment,Io),wo=!1},d(Io){Io&&detach(ue),destroy_component(no),destroy_component(io),destroy_component(ao),To&&To.d(),destroy_component(fo),destroy_component(mo),destroy_component(ho),destroy_component(bo),destroy_component($o),ko=!1,So()}}}function create_if_block_2$1E(to){let ue,eo,no,ro,oo;return{c(){ue=element("div"),eo=element("div"),eo.textContent="There was a problem loading your grid",no=space$1(),ro=element("div"),oo=text(to[8]),attr(eo,"class","grid-error-title svelte-xkde75"),attr(ro,"class","grid-error-subtitle svelte-xkde75"),attr(ue,"class","grid-error svelte-xkde75")},m(io,so){insert$1(io,ue,so),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ro,oo)},p(io,so){so[0]&256&&set_data(oo,io[8])},i:noop$5,o:noop$5,d(io){io&&detach(ue)}}}function create_edit_column_slot_1(to){let ue;const eo=to[49]["edit-column"],no=create_slot(eo,to,to[52],get_edit_column_slot_context);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_edit_column_slot_changes):get_all_dirty_from_scope(ro[52]),get_edit_column_slot_context)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_add_column_slot$1(to){let ue;const eo=to[49]["add-column"],no=create_slot(eo,to,to[52],get_add_column_slot_context);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_add_column_slot_changes):get_all_dirty_from_scope(ro[52]),get_add_column_slot_context)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_edit_column_slot$1(to){let ue;const eo=to[49]["edit-column"],no=create_slot(eo,to,to[52],get_edit_column_slot_context_1);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_edit_column_slot_changes_1):get_all_dirty_from_scope(ro[52]),get_edit_column_slot_context_1)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_if_block_4$T(to){let ue,eo;return ue=new NewRow({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$2F(to){let ue,eo,no,ro;return eo=new ProgressCircle({}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","grid-loading svelte-xkde75")},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&(no||add_render_callback(()=>{no=create_in_transition(ue,fade,{duration:130}),no.start()})),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo)}}}function create_if_block$4K(to){let ue,eo;return ue=new BulkDuplicationHandler({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a3(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go=to[24].controls&&create_if_block_5$G(to);const bo=[create_if_block_2$1E,create_if_block_3$1a],vo=[];function $o(Io,Ao){return Io[8]?0:Io[9]?1:-1}~(no=$o(to))&&(ro=vo[no]=bo[no](to));let wo=to[11]&&!to[8]&&create_if_block_1$2F(),ko=to[10].canAddRows&&create_if_block$4K();ao=new BulkDeleteHandler({}),uo=new ClipboardHandler({}),fo=new KeyboardManager({});const So=to[49].default,To=create_slot(So,to,to[52],null);return{c(){ue=element("div"),go&&go.c(),eo=space$1(),ro&&ro.c(),oo=space$1(),wo&&wo.c(),io=space$1(),ko&&ko.c(),so=space$1(),create_component(ao.$$.fragment),lo=space$1(),create_component(uo.$$.fragment),co=space$1(),create_component(fo.$$.fragment),po=space$1(),To&&To.c(),attr(ue,"class","grid svelte-xkde75"),attr(ue,"id",to[12]),set_style(ue,"--row-height",to[5]+"px"),set_style(ue,"--default-row-height",DefaultRowHeight+"px"),set_style(ue,"--gutter-width",GutterWidth+"px"),set_style(ue,"--max-cell-render-overflow",MaxCellRenderOverflow+"px"),set_style(ue,"--content-lines",to[6]),set_style(ue,"--min-height",to[7]+"px"),set_style(ue,"--controls-height",ControlsHeight+"px"),set_style(ue,"--scroll-bar-size",ScrollBarSize+"px"),toggle_class(ue,"is-resizing",to[3]),toggle_class(ue,"is-reordering",to[4]),toggle_class(ue,"stripe",to[0]),toggle_class(ue,"quiet",to[1])},m(Io,Ao){insert$1(Io,ue,Ao),go&&go.m(ue,null),append$2(ue,eo),~no&&vo[no].m(ue,null),append$2(ue,oo),wo&&wo.m(ue,null),append$2(ue,io),ko&&ko.m(ue,null),append$2(ue,so),mount_component(ao,ue,null),append$2(ue,lo),mount_component(uo,ue,null),append$2(ue,co),mount_component(fo,ue,null),append$2(ue,po),To&&To.m(ue,null),mo=!0,_o||(ho=[listen(ue,"mouseenter",to[50]),listen(ue,"mouseleave",to[51])],_o=!0)},p(Io,Ao){Io[24].controls?go?(go.p(Io,Ao),Ao[0]&16777216&&transition_in(go,1)):(go=create_if_block_5$G(Io),go.c(),transition_in(go,1),go.m(ue,eo)):go&&(group_outros(),transition_out(go,1,1,()=>{go=null}),check_outros());let Eo=no;no=$o(Io),no===Eo?~no&&vo[no].p(Io,Ao):(ro&&(group_outros(),transition_out(vo[Eo],1,1,()=>{vo[Eo]=null}),check_outros()),~no?(ro=vo[no],ro?ro.p(Io,Ao):(ro=vo[no]=bo[no](Io),ro.c()),transition_in(ro,1),ro.m(ue,oo)):ro=null),Io[11]&&!Io[8]?wo?Ao[0]&2304&&transition_in(wo,1):(wo=create_if_block_1$2F(),wo.c(),transition_in(wo,1),wo.m(ue,io)):wo&&(group_outros(),transition_out(wo,1,1,()=>{wo=null}),check_outros()),Io[10].canAddRows?ko?Ao[0]&1024&&transition_in(ko,1):(ko=create_if_block$4K(),ko.c(),transition_in(ko,1),ko.m(ue,so)):ko&&(group_outros(),transition_out(ko,1,1,()=>{ko=null}),check_outros()),To&&To.p&&(!mo||Ao[1]&2097152)&&update_slot_base(To,So,Io,Io[52],mo?get_slot_changes(So,Io[52],Ao,null):get_all_dirty_from_scope(Io[52]),null),(!mo||Ao[0]&32)&&set_style(ue,"--row-height",Io[5]+"px"),(!mo||Ao[0]&64)&&set_style(ue,"--content-lines",Io[6]),(!mo||Ao[0]&128)&&set_style(ue,"--min-height",Io[7]+"px"),(!mo||Ao[0]&8)&&toggle_class(ue,"is-resizing",Io[3]),(!mo||Ao[0]&16)&&toggle_class(ue,"is-reordering",Io[4]),(!mo||Ao[0]&1)&&toggle_class(ue,"stripe",Io[0]),(!mo||Ao[0]&2)&&toggle_class(ue,"quiet",Io[1])},i(Io){mo||(transition_in(go),transition_in(ro),transition_in(wo),transition_in(ko),transition_in(ao.$$.fragment,Io),transition_in(uo.$$.fragment,Io),transition_in(fo.$$.fragment,Io),transition_in(To,Io),mo=!0)},o(Io){transition_out(go),transition_out(ro),transition_out(wo),transition_out(ko),transition_out(ao.$$.fragment,Io),transition_out(uo.$$.fragment,Io),transition_out(fo.$$.fragment,Io),transition_out(To,Io),mo=!1},d(Io){Io&&detach(ue),go&&go.d(),~no&&vo[no].d(),wo&&wo.d(),ko&&ko.d(),destroy_component(ao),destroy_component(uo),destroy_component(fo),To&&To.d(Io),_o=!1,run_all(ho)}}}function instance$a6(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,{$$slots:fo={},$$scope:po}=ue;const mo=compute_slots(fo);let{API:_o=null}=ue,{datasource:ho=null}=ue,{schemaOverrides:go=null}=ue,{canAddRows:bo=!0}=ue,{canExpandRows:vo=!0}=ue,{canEditRows:$o=!0}=ue,{canDeleteRows:wo=!0}=ue,{canEditColumns:ko=!0}=ue,{canSaveSchema:So=!0}=ue,{stripeRows:To=!1}=ue,{quiet:Io=!1}=ue,{collaboration:Ao=!0}=ue,{showAvatars:Eo=!0}=ue,{initialFilter:Lo=null}=ue,{initialSortColumn:No=null}=ue,{initialSortOrder:Do=null}=ue,{fixedRowHeight:Po=null}=ue,{notifySuccess:Mo=null}=ue,{notifyError:Uo=null}=ue,{buttons:Vo=null}=ue,{buttonsCollapsed:Wo=!1}=ue,{buttonsCollapsedText:Zo=null}=ue,{darkMode:Yo=!1}=ue,{isCloud:xo=null}=ue,{aiEnabled:Go=!1}=ue,{canHideColumns:Xo=!0}=ue;const as=`grid-${Math.random().toString().slice(2)}`,Ko=writable(ue);let ls=attachStores({API:_o||createAPIClient(),Constants,gridID:as,props:Ko,...createEventManagers()});const{config:Jo,isResizing:hs,isReordering:ks,ui:cs,loaded:_s,loading:Is,rowHeight:Bs,contentLines:Hs,gridFocused:Rs,error:Ds}=ls;component_subscribe(to,Jo,gs=>eo(10,uo=gs)),component_subscribe(to,hs,gs=>eo(3,no=gs)),component_subscribe(to,ks,gs=>eo(4,ro=gs)),component_subscribe(to,_s,gs=>eo(9,lo=gs)),component_subscribe(to,Is,gs=>eo(11,co=gs)),component_subscribe(to,Bs,gs=>eo(5,oo=gs)),component_subscribe(to,Hs,gs=>eo(6,io=gs)),component_subscribe(to,Ds,gs=>eo(8,ao=gs));const Js=derived(Bs,gs=>{const Ts=mo.controls?ControlsHeight:0;return VPadding+SmallRowHeight+gs+Ts});component_subscribe(to,Js,gs=>eo(7,so=gs)),ls={...ls,minHeight:Js},setContext("grid",ls);const Cs=()=>ls;onMount(()=>{if(Ao)return createGridWebsocket(ls)});const da=()=>Rs.set(!0),Es=()=>Rs.set(!1);return to.$$set=gs=>{eo(55,ue=assign$1(assign$1({},ue),exclude_internal_props(gs))),"API"in gs&&eo(25,_o=gs.API),"datasource"in gs&&eo(26,ho=gs.datasource),"schemaOverrides"in gs&&eo(27,go=gs.schemaOverrides),"canAddRows"in gs&&eo(28,bo=gs.canAddRows),"canExpandRows"in gs&&eo(29,vo=gs.canExpandRows),"canEditRows"in gs&&eo(30,$o=gs.canEditRows),"canDeleteRows"in gs&&eo(31,wo=gs.canDeleteRows),"canEditColumns"in gs&&eo(32,ko=gs.canEditColumns),"canSaveSchema"in gs&&eo(33,So=gs.canSaveSchema),"stripeRows"in gs&&eo(0,To=gs.stripeRows),"quiet"in gs&&eo(1,Io=gs.quiet),"collaboration"in gs&&eo(34,Ao=gs.collaboration),"showAvatars"in gs&&eo(2,Eo=gs.showAvatars),"initialFilter"in gs&&eo(35,Lo=gs.initialFilter),"initialSortColumn"in gs&&eo(36,No=gs.initialSortColumn),"initialSortOrder"in gs&&eo(37,Do=gs.initialSortOrder),"fixedRowHeight"in gs&&eo(38,Po=gs.fixedRowHeight),"notifySuccess"in gs&&eo(39,Mo=gs.notifySuccess),"notifyError"in gs&&eo(40,Uo=gs.notifyError),"buttons"in gs&&eo(41,Vo=gs.buttons),"buttonsCollapsed"in gs&&eo(42,Wo=gs.buttonsCollapsed),"buttonsCollapsedText"in gs&&eo(43,Zo=gs.buttonsCollapsedText),"darkMode"in gs&&eo(44,Yo=gs.darkMode),"isCloud"in gs&&eo(45,xo=gs.isCloud),"aiEnabled"in gs&&eo(46,Go=gs.aiEnabled),"canHideColumns"in gs&&eo(47,Xo=gs.canHideColumns),"$$scope"in gs&&eo(52,po=gs.$$scope)},to.$$.update=()=>{to.$$.dirty[0]&2080374791|to.$$.dirty[1]&131071&&Ko.set({datasource:ho,schemaOverrides:go,canAddRows:bo,canExpandRows:vo,canEditRows:$o,canDeleteRows:wo,canEditColumns:ko,canSaveSchema:So,stripeRows:To,quiet:Io,collaboration:Ao,showAvatars:Eo,initialFilter:Lo,initialSortColumn:No,initialSortOrder:Do,fixedRowHeight:Po,notifySuccess:Mo,notifyError:Uo,buttons:Vo,buttonsCollapsed:Wo,buttonsCollapsedText:Zo,darkMode:Yo,isCloud:xo,aiEnabled:Go,canHideColumns:Xo})},ue=exclude_internal_props(ue),[To,Io,Eo,no,ro,oo,io,so,ao,lo,uo,co,as,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,mo,_o,ho,go,bo,vo,$o,wo,ko,So,Ao,Lo,No,Do,Po,Mo,Uo,Vo,Wo,Zo,Yo,xo,Go,Xo,Cs,fo,da,Es,po]}class Grid extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a6,create_fragment$a3,safe_not_equal,{API:25,datasource:26,schemaOverrides:27,canAddRows:28,canExpandRows:29,canEditRows:30,canDeleteRows:31,canEditColumns:32,canSaveSchema:33,stripeRows:0,quiet:1,collaboration:34,showAvatars:2,initialFilter:35,initialSortColumn:36,initialSortOrder:37,fixedRowHeight:38,notifySuccess:39,notifyError:40,buttons:41,buttonsCollapsed:42,buttonsCollapsedText:43,darkMode:44,isCloud:45,aiEnabled:46,canHideColumns:47,getContext:48},null,[-1,-1])}get getContext(){return this.$$.ctx[48]}}const ClientAppSkeleton_svelte_svelte_type_style_lang="";function create_if_block_1$2E(to){let ue;return{c(){ue=element("div"),attr(ue,"class","devTools svelte-1hc8b9o")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block$4J(to){let ue;return{c(){ue=element("div"),attr(ue,"class","footer svelte-1hc8b9o")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$a2(to){let ue,eo,no,ro,oo,io,so=!to[1]&&create_if_block_1$2E(),ao=!to[2]&&create_if_block$4J();return{c(){ue=element("div"),eo=element("div"),no=space$1(),so&&so.c(),ro=space$1(),oo=element("div"),oo.innerHTML='<div class="nav svelte-1hc8b9o"></div> <div class="body svelte-1hc8b9o"><div class="bodyVerticalPadding svelte-1hc8b9o"></div> <div class="bodyHorizontal svelte-1hc8b9o"><div class="bodyHorizontalPadding svelte-1hc8b9o"></div> <svg class="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="240" height="256"><mask id="mask"><rect x="0" y="0" width="240" height="256" fill="white"></rect><rect x="0" y="0" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="56" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="112" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="168" width="240" height="32" rx="6" fill="black"></rect><rect x="71" y="224" width="98" height="32" rx="6" fill="black"></rect></mask><rect x="0" y="0" width="240" height="256" fill="black" mask="url(#mask)"></rect></svg> <div class="bodyHorizontalPadding svelte-1hc8b9o"></div></div> <div class="bodyVerticalPadding svelte-1hc8b9o"></div></div>',io=space$1(),ao&&ao.c(),attr(eo,"class","animation svelte-1hc8b9o"),toggle_class(eo,"noAnimation",to[3]),attr(oo,"class","main svelte-1hc8b9o"),attr(ue,"id","clientAppSkeletonLoader"),attr(ue,"class","skeleton svelte-1hc8b9o"),toggle_class(ue,"sideNav",to[0])},m(lo,uo){insert$1(lo,ue,uo),append$2(ue,eo),append$2(ue,no),so&&so.m(ue,null),append$2(ue,ro),append$2(ue,oo),append$2(ue,io),ao&&ao.m(ue,null)},p(lo,[uo]){uo&8&&toggle_class(eo,"noAnimation",lo[3]),lo[1]?so&&(so.d(1),so=null):so||(so=create_if_block_1$2E(),so.c(),so.m(ue,ro)),lo[2]?ao&&(ao.d(1),ao=null):ao||(ao=create_if_block$4J(),ao.c(),ao.m(ue,null)),uo&1&&toggle_class(ue,"sideNav",lo[0])},i:noop$5,o:noop$5,d(lo){lo&&detach(ue),so&&so.d(),ao&&ao.d()}}}function instance$a5(to,ue,eo){let{sideNav:no=!1}=ue,{hideDevTools:ro=!1}=ue,{hideFooter:oo=!1}=ue,{noAnimation:io=!1}=ue;return to.$$set=so=>{"sideNav"in so&&eo(0,no=so.sideNav),"hideDevTools"in so&&eo(1,ro=so.hideDevTools),"hideFooter"in so&&eo(2,oo=so.hideFooter),"noAnimation"in so&&eo(3,io=so.noAnimation)},[no,ro,oo,io]}class ClientAppSkeleton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a5,create_fragment$a2,safe_not_equal,{sideNav:0,hideDevTools:1,hideFooter:2,noAnimation:3})}}function create_fragment$a1(to){let ue,eo,no;var ro=to[2];function oo(io,so){return{props:{value:io[0],autocomplete:!0,options:io[3],getOptionLabel:func$S,getOptionValue:func_1$F,disabled:io[1]}}}return ro&&(eo=construct_svelte_component(ro,oo(to)),eo.$on("change",to[8])),{c(){ue=element("div"),eo&&create_component(eo.$$.fragment),attr(ue,"class","user-control")},m(io,so){insert$1(io,ue,so),eo&&mount_component(eo,ue,null),no=!0},p(io,[so]){if(so&4&&ro!==(ro=io[2])){if(eo){group_outros();const ao=eo;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(eo=construct_svelte_component(ro,oo(io)),eo.$on("change",io[8]),create_component(eo.$$.fragment),transition_in(eo.$$.fragment,1),mount_component(eo,ue,null)):eo=null}else if(ro){const ao={};so&1&&(ao.value=io[0]),so&8&&(ao.options=io[3]),so&2&&(ao.disabled=io[1]),eo.$set(ao)}},i(io){no||(eo&&transition_in(eo.$$.fragment,io),no=!0)},o(io){eo&&transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),eo&&destroy_component(eo)}}}const func$S=to=>to.email,func_1$F=to=>to._id;function instance$a4(to,ue,eo){let no,ro,oo,io,so=noop$5,ao=()=>(so(),so=subscribe(no,mo=>eo(7,io=mo)),no);to.$$.on_destroy.push(()=>so());let{API:lo=createAPIClient()}=ue,{value:uo=null}=ue,{disabled:co}=ue,{multiselect:fo=!1}=ue;function po(mo){bubble.call(this,to,mo)}return to.$$set=mo=>{"API"in mo&&eo(5,lo=mo.API),"value"in mo&&eo(0,uo=mo.value),"disabled"in mo&&eo(1,co=mo.disabled),"multiselect"in mo&&eo(6,fo=mo.multiselect)},to.$$.update=()=>{to.$$.dirty&32&&ao(eo(4,no=fetchData({API:lo,datasource:{type:"user"},options:{limit:100}}))),to.$$.dirty&128&&eo(3,ro=io.rows),to.$$.dirty&64&&eo(2,oo=fo?Multiselect_1:Select_1$1)},[uo,co,oo,ro,no,lo,fo,io,po]}class FilterUsers extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a4,create_fragment$a1,safe_not_equal,{API:5,value:0,disabled:1,multiselect:6})}}const FilterField_svelte_svelte_type_style_lang="";function create_default_slot$6h(to){let ue;return{c(){ue=text("Confirm")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$k(to){let ue,eo;return ue=new Button({props:{cta:!0,slot:"buttons",$$slots:{default:[create_default_slot$6h]},$$scope:{ctx:to}}}),ue.$on("click",to[23]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&32&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$j(to){let ue,eo,no;var ro=to[4];function oo(io,so){return{props:{slot:"body",value:io[9],allowJS:!0,allowHelpers:!0,allowHBS:!0,bindings:io[2],context:io[6]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("change",to[16])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$4()},m(io,so){ue&&mount_component(ue,io,so),insert$1(io,eo,so),no=!0},p(io,so){if(so[0]&16&&ro!==(ro=io[4])){if(ue){group_outros();const ao=ue;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("change",io[16]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const ao={};so[0]&512&&(ao.value=io[9]),so[0]&4&&(ao.bindings=io[2]),so[0]&64&&(ao.context=io[6]),ue.$set(ao)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function create_else_block$1U(to){let ue,eo,no,ro,oo,io;const so=[create_if_block_2$1D,create_if_block_3$19,create_if_block_4$S,create_if_block_5$F,create_if_block_6$s,create_if_block_7$n,create_else_block_1$u],ao=[];function lo(uo,co){return co[0]&1&&(eo=null),co[0]&1&&(no=null),eo==null&&(eo=!![FieldType.STRING,FieldType.LONGFORM,FieldType.NUMBER,FieldType.BIGINT,FieldType.FORMULA,FieldType.AI,FieldType.BARCODEQR].includes(uo[0].type)),eo?0:uo[0].type===FieldType.ARRAY||uo[0].type===FieldType.OPTIONS&&uo[0].operator===ArrayOperator.ONE_OF?1:uo[0].type===FieldType.OPTIONS?2:uo[0].type===FieldType.BOOLEAN?3:uo[0].type===FieldType.DATETIME?4:(no==null&&(no=!![FieldType.BB_REFERENCE,FieldType.BB_REFERENCE_SINGLE].includes(uo[0].type)),no?5:6)}return ro=lo(to,[-1,-1]),oo=ao[ro]=so[ro](to),{c(){ue=element("div"),oo.c()},m(uo,co){insert$1(uo,ue,co),ao[ro].m(ue,null),io=!0},p(uo,co){let fo=ro;ro=lo(uo,co),ro===fo?ao[ro].p(uo,co):(group_outros(),transition_out(ao[fo],1,1,()=>{ao[fo]=null}),check_outros(),oo=ao[ro],oo?oo.p(uo,co):(oo=ao[ro]=so[ro](uo),oo.c()),transition_in(oo,1),oo.m(ue,null))},i(uo){io||(transition_in(oo),io=!0)},o(uo){transition_out(oo),io=!1},d(uo){uo&&detach(ue),ao[ro].d()}}}function create_if_block_1$2D(to){let ue,eo;return ue=new Input$5({props:{disabled:to[0].noValue,readonly:to[11],value:to[11]?"(JavaScript function)":to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&2048&&(oo.readonly=no[11]),ro[0]&2304&&(oo.value=no[11]?"(JavaScript function)":no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_else_block_1$u(to){let ue,eo;return ue=new Input$5({props:{disabled:!0}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$5,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_7$n(to){let ue,eo;return ue=new FilterUsers({props:{multiselect:[to[12].In.value,to[12].ContainsAny.value].includes(to[0].operator),disabled:to[0].noValue,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.multiselect=[no[12].In.value,no[12].ContainsAny.value].includes(no[0].operator)),ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_6$s(to){var no,ro;let ue,eo;return ue=new DatePicker_1({props:{disabled:to[0].noValue,enableTime:!((no=to[15](to[0]))!=null&&no.dateOnly),timeOnly:(ro=to[15](to[0]))==null?void 0:ro.timeOnly,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0},p(oo,io){var ao,lo;const so={};io[0]&1&&(so.disabled=oo[0].noValue),io[0]&1&&(so.enableTime=!((ao=oo[15](oo[0]))!=null&&ao.dateOnly)),io[0]&1&&(so.timeOnly=(lo=oo[15](oo[0]))==null?void 0:lo.timeOnly),io[0]&256&&(so.value=oo[8]),ue.$set(so)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo)}}}function create_if_block_5$F(to){let ue,eo;return ue=new Combobox_1({props:{disabled:to[0].noValue,options:[{label:"True",value:"true"},{label:"False",value:"false"}],value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_4$S(to){let ue,eo;return ue=new Combobox_1({props:{disabled:to[0].noValue,options:to[14](to[0].field),value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&1&&(oo.options=no[14](no[0].field)),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$19(to){let ue,eo;return ue=new Multiselect_1({props:{disabled:to[0].noValue,options:to[14](to[0].field),value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&1&&(oo.options=no[14](no[0].field)),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_2$1D(to){let ue,eo;return ue=new Input$5({props:{disabled:to[0].noValue,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$4I(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{size:"S",weight:"fill",name:"lightning"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon svelte-u5a0ap"),toggle_class(ue,"binding",to[0].valueType==="Binding")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[27]),ro=!0)},p(io,so){(!no||so[0]&1)&&toggle_class(ue,"binding",io[0].valueType==="Binding")},i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$a0(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co={title:to[5]||to[0].field,forceModal:!0,$$slots:{body:[create_body_slot$j],buttons:[create_buttons_slot$k]},$$scope:{ctx:to}};eo=new Drawer({props:co}),to[24](eo),eo.$on("drawerHide",to[25]),eo.$on("drawerShow",to[26]);const fo=[create_if_block_1$2D,create_else_block$1U],po=[];function mo(ho,go){return ho[0].valueType===ho[13].BINDING?0:1}io=mo(to),so=po[io]=fo[io](to);let _o=!to[1]&&to[3]&&!to[0].noValue&&create_if_block$4I(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("div"),oo=element("div"),so.c(),ao=space$1(),lo=element("div"),_o&&_o.c(),attr(oo,"class","field svelte-u5a0ap"),attr(lo,"class","binding-control svelte-u5a0ap"),attr(ro,"class","field-wrap svelte-u5a0ap"),toggle_class(ro,"bindings",to[3]),toggle_class(ro,"valid",to[10])},m(ho,go){insert$1(ho,ue,go),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),po[io].m(oo,null),append$2(ro,ao),append$2(ro,lo),_o&&_o.m(lo,null),uo=!0},p(ho,go){const bo={};go[0]&33&&(bo.title=ho[5]||ho[0].field),go[0]&724|go[1]&32&&(bo.$$scope={dirty:go,ctx:ho}),eo.$set(bo);let vo=io;io=mo(ho),io===vo?po[io].p(ho,go):(group_outros(),transition_out(po[vo],1,1,()=>{po[vo]=null}),check_outros(),so=po[io],so?so.p(ho,go):(so=po[io]=fo[io](ho),so.c()),transition_in(so,1),so.m(oo,null)),!ho[1]&&ho[3]&&!ho[0].noValue?_o?(_o.p(ho,go),go[0]&11&&transition_in(_o,1)):(_o=create_if_block$4I(ho),_o.c(),transition_in(_o,1),_o.m(lo,null)):_o&&(group_outros(),transition_out(_o,1,1,()=>{_o=null}),check_outros()),(!uo||go[0]&8)&&toggle_class(ro,"bindings",ho[3]),(!uo||go[0]&1024)&&toggle_class(ro,"valid",ho[10])},i(ho){uo||(transition_in(eo.$$.fragment,ho),transition_in(so),transition_in(_o),uo=!0)},o(ho){transition_out(eo.$$.fragment,ho),transition_out(so),transition_out(_o),uo=!1},d(ho){ho&&detach(ue),to[24](null),destroy_component(eo),po[io].d(),_o&&_o.d()}}}function instance$a3(to,ue,eo){let no,ro,oo,io,so,{filter:ao}=ue,{disabled:lo=!1}=ue,{bindings:uo=[]}=ue,{allowBindings:co=!1}=ue,{schemaFields:fo}=ue,{panel:po}=ue,{drawerTitle:mo}=ue,{toReadable:_o}=ue,{toRuntime:ho}=ue,{evaluationContext:go={}}=ue;const bo=createEventDispatcher(),{OperatorOptions:vo,FilterValueType:$o}=Constants$1;let wo;const ko=Go=>{var as;const Xo=fo.find(Ko=>Ko.name===Go);return((as=Xo==null?void 0:Xo.constraints)==null?void 0:as.inclusion)||[]},So=Go=>fo.find(Xo=>Xo.name===Go.field),To=Go=>{eo(9,oo=Go.detail)},Io=Go=>{eo(22,no=Go.detail),bo("change",{value:ho?ho(uo,no):no})},Ao=()=>{bo("change",{value:ho?ho(uo,oo):oo,valueType:oo?$o.BINDING:$o.VALUE})},Eo=Go=>!Go||!isNaN(new Date(Go).valueOf()),Lo=Go=>{let Xo=[];if(Array.isArray(Go))Xo=Go;else if(Go&&typeof Go=="string")Xo=Go.split(",");else return!Go;return Xo.every(as=>{var Ko,ls,Jo;return(Jo=(ls=(Ko=So(ao))==null?void 0:Ko.constraints)==null?void 0:ls.inclusion)==null?void 0:Jo.includes(as)})},No=Go=>Go==="false"||Go==="true"||Go=="",Do=Go=>{let Xo=[];if(Array.isArray(Go))Xo=Go;else if(Go&&typeof Go=="string")Xo=Go.split(",");else return!Go;return Xo.every(as=>as.startsWith("ro_"))},Po={date:Eo,datetime:Eo,bb_reference:Do,bb_reference_single:Do,array:Lo,longform:Go=>!isJSBinding(Go),options:Go=>{var Xo;return!isJSBinding(Go)&&!((Xo=findHBSBlocks(Go))!=null&&Xo.length)},boolean:No},Mo=Go=>{const Xo=Po[ao.type];return Xo?Xo(Go):!0},Uo=Go=>ao.valueType==$o.VALUE?"":Array.isArray(Go)?Go.join(","):ro,Vo=()=>{Ao(),wo.hide()};function Wo(Go){binding_callbacks[Go?"unshift":"push"](()=>{wo=Go,eo(7,wo)})}function Zo(Go){bubble.call(this,to,Go)}function Yo(Go){bubble.call(this,to,Go)}const xo=()=>{wo.show()};return to.$$set=Go=>{"filter"in Go&&eo(0,ao=Go.filter),"disabled"in Go&&eo(1,lo=Go.disabled),"bindings"in Go&&eo(2,uo=Go.bindings),"allowBindings"in Go&&eo(3,co=Go.allowBindings),"schemaFields"in Go&&eo(19,fo=Go.schemaFields),"panel"in Go&&eo(4,po=Go.panel),"drawerTitle"in Go&&eo(5,mo=Go.drawerTitle),"toReadable"in Go&&eo(20,_o=Go.toReadable),"toRuntime"in Go&&eo(21,ho=Go.toRuntime),"evaluationContext"in Go&&eo(6,go=Go.evaluationContext)},to.$$.update=()=>{to.$$.dirty[0]&1&&eo(22,no=ao==null?void 0:ao.value),to.$$.dirty[0]&5242884&&eo(8,ro=_o?_o(uo,no):no),to.$$.dirty[0]&4194304&&eo(9,oo=Uo(no)),to.$$.dirty[0]&4194304&&eo(11,io=isJSBinding(no)),to.$$.dirty[0]&4194304&&eo(10,so=Mo(no))},[ao,lo,uo,co,po,mo,go,wo,ro,oo,so,io,vo,$o,ko,So,To,Io,Ao,fo,_o,ho,no,Vo,Wo,Zo,Yo,xo]}class FilterField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a3,create_fragment$a0,safe_not_equal,{filter:0,disabled:1,bindings:2,allowBindings:3,schemaFields:19,panel:4,drawerTitle:5,toReadable:20,toRuntime:21,evaluationContext:6},null,[-1,-1])}}const ConditionField_svelte_svelte_type_style_lang="";function create_default_slot$6g(to){let ue;return{c(){ue=text("Confirm")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$j(to){let ue,eo;return ue=new Button({props:{cta:!0,slot:"buttons",$$slots:{default:[create_default_slot$6g]},$$scope:{ctx:to}}}),ue.$on("click",to[16]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&8388608&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$i(to){let ue,eo,no;var ro=to[3];function oo(io,so){return{props:{slot:"body",value:io[8],allowJS:!0,allowHelpers:!0,allowHBS:!0,bindings:io[2],context:io[5]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("change",to[10])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$4()},m(io,so){ue&&mount_component(ue,io,so),insert$1(io,eo,so),no=!0},p(io,so){if(so&8&&ro!==(ro=io[3])){if(ue){group_outros();const ao=ue;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("change",io[10]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const ao={};so&256&&(ao.value=io[8]),so&4&&(ao.bindings=io[2]),so&32&&(ao.context=io[5]),ue.$set(ao)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function create_if_block$4H(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{size:"S",weight:"fill",name:"lightning"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon binding svelte-eaqops")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[20]),ro=!0)},p:noop$5,i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$9$(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo={title:to[4]||"",forceModal:!0,$$slots:{body:[create_body_slot$i],buttons:[create_buttons_slot$j]},$$scope:{ctx:to}};eo=new Drawer({props:uo}),to[17](eo),eo.$on("drawerHide",to[18]),eo.$on("drawerShow",to[19]),io=new Input$5({props:{disabled:to[0].noValue,readonly:to[9],value:to[9]?"(JavaScript function)":to[7]}}),io.$on("change",to[11]);let co=!to[1]&&create_if_block$4H(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("div"),oo=element("div"),create_component(io.$$.fragment),so=space$1(),ao=element("div"),co&&co.c(),attr(oo,"class","field svelte-eaqops"),attr(ao,"class","binding-control svelte-eaqops"),attr(ro,"class","field-wrap svelte-eaqops"),toggle_class(ro,"bindings",!0)},m(fo,po){insert$1(fo,ue,po),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),mount_component(io,oo,null),append$2(ro,so),append$2(ro,ao),co&&co.m(ao,null),lo=!0},p(fo,[po]){const mo={};po&16&&(mo.title=fo[4]||""),po&8388972&&(mo.$$scope={dirty:po,ctx:fo}),eo.$set(mo);const _o={};po&1&&(_o.disabled=fo[0].noValue),po&512&&(_o.readonly=fo[9]),po&640&&(_o.value=fo[9]?"(JavaScript function)":fo[7]),io.$set(_o),fo[1]?co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros()):co?(co.p(fo,po),po&2&&transition_in(co,1)):(co=create_if_block$4H(fo),co.c(),transition_in(co,1),co.m(ao,null))},i(fo){lo||(transition_in(eo.$$.fragment,fo),transition_in(io.$$.fragment,fo),transition_in(co),lo=!0)},o(fo){transition_out(eo.$$.fragment,fo),transition_out(io.$$.fragment,fo),transition_out(co),lo=!1},d(fo){fo&&detach(ue),to[17](null),destroy_component(eo),destroy_component(io),co&&co.d()}}}function instance$a2(to,ue,eo){let no,ro,oo,{filter:io}=ue,{disabled:so=!1}=ue,{bindings:ao=[]}=ue,{panel:lo}=ue,{drawerTitle:uo}=ue,{toReadable:co}=ue,{toRuntime:fo}=ue,{evaluationContext:po={}}=ue;const mo=createEventDispatcher();let _o,ho;const go=Ao=>{eo(8,ro=Ao.detail)},bo=Ao=>{eo(15,ho=Ao.detail),mo("change",{field:fo?fo(ao,ho):ho})},vo=()=>{mo("change",{field:fo?fo(ao,ro):ro})},$o=Ao=>Array.isArray(Ao)?Ao.join(","):no,wo=()=>{vo(),_o.hide()};function ko(Ao){binding_callbacks[Ao?"unshift":"push"](()=>{_o=Ao,eo(6,_o)})}function So(Ao){bubble.call(this,to,Ao)}function To(Ao){bubble.call(this,to,Ao)}const Io=()=>{_o.show()};return to.$$set=Ao=>{"filter"in Ao&&eo(0,io=Ao.filter),"disabled"in Ao&&eo(1,so=Ao.disabled),"bindings"in Ao&&eo(2,ao=Ao.bindings),"panel"in Ao&&eo(3,lo=Ao.panel),"drawerTitle"in Ao&&eo(4,uo=Ao.drawerTitle),"toReadable"in Ao&&eo(13,co=Ao.toReadable),"toRuntime"in Ao&&eo(14,fo=Ao.toRuntime),"evaluationContext"in Ao&&eo(5,po=Ao.evaluationContext)},to.$$.update=()=>{to.$$.dirty&1&&eo(15,ho=io==null?void 0:io.field),to.$$.dirty&40964&&eo(7,no=co?co(ao,ho):ho),to.$$.dirty&32768&&eo(8,ro=$o(ho)),to.$$.dirty&32768&&eo(9,oo=isJSBinding(ho))},[io,so,ao,lo,uo,po,_o,no,ro,oo,go,bo,vo,co,fo,ho,wo,ko,So,To,Io]}class ConditionField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a2,create_fragment$9$,safe_not_equal,{filter:0,disabled:1,bindings:2,panel:3,drawerTitle:4,toReadable:13,toRuntime:14,evaluationContext:5})}}const CoreFilterBuilder_svelte_svelte_type_style_lang="";function get_each_context$1X(to,ue,eo){const no=to.slice();return no[52]=ue[eo],no[54]=eo,no}function get_each_context_1$z(to,ue,eo){const no=to.slice();return no[55]=ue[eo],no[57]=eo,no}const get_filtering_hero_content_slot_changes=to=>({}),get_filtering_hero_content_slot_context=to=>({});function create_else_block_1$t(to){let ue,eo;return ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_3$2k]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$4G(to){var co,fo,po,mo;let ue,eo,no,ro,oo,io;const so=to[27]["filtering-hero-content"],ao=create_slot(so,to,to[39],get_filtering_hero_content_slot_context);let lo=((fo=(co=to[11])==null?void 0:co.groups)==null?void 0:fo.length)&&create_if_block_5$E(to),uo=((mo=(po=to[11])==null?void 0:po.groups)==null?void 0:mo.length)&&create_if_block_3$18(to);return oo=new Layout$o({props:{noPadding:!0,$$slots:{default:[create_default_slot_1$4g]},$$scope:{ctx:to}}}),{c(){ao&&ao.c(),ue=space$1(),lo&&lo.c(),eo=space$1(),uo&&uo.c(),no=space$1(),ro=element("div"),create_component(oo.$$.fragment),attr(ro,"class","filters-footer svelte-1ymk2z3")},m(_o,ho){ao&&ao.m(_o,ho),insert$1(_o,ue,ho),lo&&lo.m(_o,ho),insert$1(_o,eo,ho),uo&&uo.m(_o,ho),insert$1(_o,no,ho),insert$1(_o,ro,ho),mount_component(oo,ro,null),io=!0},p(_o,ho){var bo,vo,$o,wo;ao&&ao.p&&(!io||ho[1]&256)&&update_slot_base(ao,so,_o,_o[39],io?get_slot_changes(so,_o[39],ho,get_filtering_hero_content_slot_changes):get_all_dirty_from_scope(_o[39]),get_filtering_hero_content_slot_context),(vo=(bo=_o[11])==null?void 0:bo.groups)!=null&&vo.length?lo?(lo.p(_o,ho),ho[0]&2048&&transition_in(lo,1)):(lo=create_if_block_5$E(_o),lo.c(),transition_in(lo,1),lo.m(eo.parentNode,eo)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros()),(wo=($o=_o[11])==null?void 0:$o.groups)!=null&&wo.length?uo?(uo.p(_o,ho),ho[0]&2048&&transition_in(uo,1)):(uo=create_if_block_3$18(_o),uo.c(),transition_in(uo,1),uo.m(no.parentNode,no)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros());const go={};ho[0]&2106|ho[1]&256&&(go.$$scope={dirty:ho,ctx:_o}),oo.$set(go)},i(_o){io||(transition_in(ao,_o),transition_in(lo),transition_in(uo),transition_in(oo.$$.fragment,_o),io=!0)},o(_o){transition_out(ao,_o),transition_out(lo),transition_out(uo),transition_out(oo.$$.fragment,_o),io=!1},d(_o){_o&&(detach(ue),detach(eo),detach(no),detach(ro)),ao&&ao.d(_o),lo&&lo.d(_o),uo&&uo.d(_o),destroy_component(oo)}}}function create_default_slot_3$2k(to){let ue;return{c(){ue=text("None of the table column can be used for filtering.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_5$E(to){var po;let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo;return io=new Select_1$1({props:{value:(po=to[11])==null?void 0:po.logicalOperator,options:to[15],getOptionLabel:func$R,getOptionValue:func_1$E,placeholder:!1}}),io.$on("change",to[28]),{c(){ue=element("div"),eo=element("span"),no=text(to[13]),ro=space$1(),oo=element("span"),create_component(io.$$.fragment),so=space$1(),ao=element("span"),lo=text("of the following "),uo=text(to[4]),co=text(" groups:"),attr(oo,"class","operator-picker svelte-1ymk2z3"),attr(ue,"class","global-filter-header svelte-1ymk2z3")},m(mo,_o){insert$1(mo,ue,_o),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),append$2(ue,so),append$2(ue,ao),append$2(ao,lo),append$2(ao,uo),append$2(ao,co),fo=!0},p(mo,_o){var go;(!fo||_o[0]&8192)&&set_data(no,mo[13]);const ho={};_o[0]&2048&&(ho.value=(go=mo[11])==null?void 0:go.logicalOperator),io.$set(ho),(!fo||_o[0]&16)&&set_data(uo,mo[4])},i(mo){fo||(transition_in(io.$$.fragment,mo),fo=!0)},o(mo){transition_out(io.$$.fragment,mo),fo=!1},d(mo){mo&&detach(ue),destroy_component(io)}}}function create_if_block_3$18(to){var io;let ue,eo,no=ensure_array_like((io=to[11])==null?void 0:io.groups),ro=[];for(let so=0;so<no.length;so+=1)ro[so]=create_each_block$1X(get_each_context$1X(to,no,so));const oo=so=>transition_out(ro[so],1,1,()=>{ro[so]=null});return{c(){ue=element("div");for(let so=0;so<ro.length;so+=1)ro[so].c();attr(ue,"class","filter-groups svelte-1ymk2z3")},m(so,ao){insert$1(so,ue,ao);for(let lo=0;lo<ro.length;lo+=1)ro[lo]&&ro[lo].m(ue,null);eo=!0},p(so,ao){var lo;if(ao[0]&16555989){no=ensure_array_like((lo=so[11])==null?void 0:lo.groups);let uo;for(uo=0;uo<no.length;uo+=1){const co=get_each_context$1X(so,no,uo);ro[uo]?(ro[uo].p(co,ao),transition_in(ro[uo],1)):(ro[uo]=create_each_block$1X(co),ro[uo].c(),transition_in(ro[uo],1),ro[uo].m(ue,null))}for(group_outros(),uo=no.length;uo<ro.length;uo+=1)oo(uo);check_outros()}},i(so){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(so){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(so){so&&detach(ue),destroy_each(ro,so)}}}function create_else_block$1T(to){let ue,eo;function no(...ro){return to[33](to[55],to[54],to[57],...ro)}return ue=new ConditionField({props:{placeholder:"Value",filter:to[55],drawerTitle:"Edit Binding",bindings:to[6],panel:to[7],toReadable:to[8],toRuntime:to[9],evaluationContext:to[10]}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&2048&&(io.filter=to[55]),oo[0]&64&&(io.bindings=to[6]),oo[0]&128&&(io.panel=to[7]),oo[0]&256&&(io.toReadable=to[8]),oo[0]&512&&(io.toRuntime=to[9]),oo[0]&1024&&(io.evaluationContext=to[10]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_4$R(to){let ue,eo;function no(...ro){return to[32](to[55],to[54],to[57],...ro)}return ue=new Select_1$1({props:{value:to[55].field,options:to[12],placeholder:"Column"}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&2048&&(io.value=to[55].field),oo[0]&4096&&(io.options=to[12]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_each_block_1$z(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co;const fo=[create_if_block_4$R,create_else_block$1T],po=[];function mo(bo,vo){return bo[4]==="filter"?0:1}eo=mo(to),no=po[eo]=fo[eo](to);function _o(...bo){return to[34](to[55],to[54],to[57],...bo)}oo=new Select_1$1({props:{value:to[55].operator,disabled:!to[55].field&&to[4]==="filter",options:to[20](to[55]),placeholder:!1}}),oo.$on("change",_o);function ho(...bo){return to[35](to[55],to[54],to[57],...bo)}so=new FilterField({props:{placeholder:"Value",disabled:!to[55].field&&to[4]==="filter",drawerTitle:to[4]==="condition"?"Edit binding":null,allowBindings:to[2],filter:{...to[55],...to[4]==="condition"?{type:FieldType.STRING}:{}},schemaFields:to[0],bindings:to[6],panel:to[7],toReadable:to[8],toRuntime:to[9],evaluationContext:to[10]}}),so.$on("change",ho);function go(){return to[36](to[54],to[57])}return lo=new ActionButton({props:{size:"M",icon:"trash"}}),lo.$on("click",go),{c(){ue=element("div"),no.c(),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),attr(ue,"class","filter svelte-1ymk2z3")},m(bo,vo){insert$1(bo,ue,vo),po[eo].m(ue,null),append$2(ue,ro),mount_component(oo,ue,null),append$2(ue,io),mount_component(so,ue,null),append$2(ue,ao),mount_component(lo,ue,null),append$2(ue,uo),co=!0},p(bo,vo){to=bo;let $o=eo;eo=mo(to),eo===$o?po[eo].p(to,vo):(group_outros(),transition_out(po[$o],1,1,()=>{po[$o]=null}),check_outros(),no=po[eo],no?no.p(to,vo):(no=po[eo]=fo[eo](to),no.c()),transition_in(no,1),no.m(ue,ro));const wo={};vo[0]&2048&&(wo.value=to[55].operator),vo[0]&2064&&(wo.disabled=!to[55].field&&to[4]==="filter"),vo[0]&2048&&(wo.options=to[20](to[55])),oo.$set(wo);const ko={};vo[0]&2064&&(ko.disabled=!to[55].field&&to[4]==="filter"),vo[0]&16&&(ko.drawerTitle=to[4]==="condition"?"Edit binding":null),vo[0]&4&&(ko.allowBindings=to[2]),vo[0]&2064&&(ko.filter={...to[55],...to[4]==="condition"?{type:FieldType.STRING}:{}}),vo[0]&1&&(ko.schemaFields=to[0]),vo[0]&64&&(ko.bindings=to[6]),vo[0]&128&&(ko.panel=to[7]),vo[0]&256&&(ko.toReadable=to[8]),vo[0]&512&&(ko.toRuntime=to[9]),vo[0]&1024&&(ko.evaluationContext=to[10]),so.$set(ko)},i(bo){co||(transition_in(no),transition_in(oo.$$.fragment,bo),transition_in(so.$$.fragment,bo),transition_in(lo.$$.fragment,bo),co=!0)},o(bo){transition_out(no),transition_out(oo.$$.fragment,bo),transition_out(so.$$.fragment,bo),transition_out(lo.$$.fragment,bo),co=!1},d(bo){bo&&detach(ue),po[eo].d(),destroy_component(oo),destroy_component(so),destroy_component(lo)}}}function create_each_block$1X(to){var Do;let ue,eo,no,ro,oo=to[21](to[54],to[11].logicalOperator)+"",io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So;function To(...Po){return to[29](to[54],...Po)}lo=new Select_1$1({props:{value:(Do=to[52])==null?void 0:Do.logicalOperator,options:to[15],getOptionLabel:func_2$6,getOptionValue:func_3$3,placeholder:!1}}),lo.$on("change",To);function Io(){return to[30](to[54])}go=new Icon({props:{name:"plus",hoverable:!0,hoverColor:"var(--ink)"}}),go.$on("click",Io);function Ao(){return to[31](to[54])}vo=new Icon({props:{name:"trash",hoverable:!0,hoverColor:"var(--ink)"}}),vo.$on("click",Ao);let Eo=ensure_array_like(to[52].filters),Lo=[];for(let Po=0;Po<Eo.length;Po+=1)Lo[Po]=create_each_block_1$z(get_each_context_1$z(to,Eo,Po));const No=Po=>transition_out(Lo[Po],1,1,()=>{Lo[Po]=null});return{c(){ue=element("div"),eo=element("div"),no=element("div"),ro=element("span"),io=text(oo),so=space$1(),ao=element("span"),create_component(lo.$$.fragment),uo=space$1(),co=element("span"),fo=text("of the following "),po=text(to[4]),mo=text("s are matched:"),_o=space$1(),ho=element("div"),create_component(go.$$.fragment),bo=space$1(),create_component(vo.$$.fragment),$o=space$1(),wo=element("div");for(let Po=0;Po<Lo.length;Po+=1)Lo[Po].c();ko=space$1(),attr(ao,"class","operator-picker svelte-1ymk2z3"),attr(no,"class","group-options svelte-1ymk2z3"),attr(ho,"class","group-actions svelte-1ymk2z3"),attr(eo,"class","group-header svelte-1ymk2z3"),attr(wo,"class","filters svelte-1ymk2z3"),attr(ue,"class","group svelte-1ymk2z3")},m(Po,Mo){insert$1(Po,ue,Mo),append$2(ue,eo),append$2(eo,no),append$2(no,ro),append$2(ro,io),append$2(no,so),append$2(no,ao),mount_component(lo,ao,null),append$2(no,uo),append$2(no,co),append$2(co,fo),append$2(co,po),append$2(co,mo),append$2(eo,_o),append$2(eo,ho),mount_component(go,ho,null),append$2(ho,bo),mount_component(vo,ho,null),append$2(ue,$o),append$2(ue,wo);for(let Uo=0;Uo<Lo.length;Uo+=1)Lo[Uo]&&Lo[Uo].m(wo,null);append$2(ue,ko),So=!0},p(Po,Mo){var Vo;to=Po,(!So||Mo[0]&2048)&&oo!==(oo=to[21](to[54],to[11].logicalOperator)+"")&&set_data(io,oo);const Uo={};if(Mo[0]&2048&&(Uo.value=(Vo=to[52])==null?void 0:Vo.logicalOperator),lo.$set(Uo),(!So||Mo[0]&16)&&set_data(po,to[4]),Mo[0]&14426069){Eo=ensure_array_like(to[52].filters);let Wo;for(Wo=0;Wo<Eo.length;Wo+=1){const Zo=get_each_context_1$z(to,Eo,Wo);Lo[Wo]?(Lo[Wo].p(Zo,Mo),transition_in(Lo[Wo],1)):(Lo[Wo]=create_each_block_1$z(Zo),Lo[Wo].c(),transition_in(Lo[Wo],1),Lo[Wo].m(wo,null))}for(group_outros(),Wo=Eo.length;Wo<Lo.length;Wo+=1)No(Wo);check_outros()}},i(Po){if(!So){transition_in(lo.$$.fragment,Po),transition_in(go.$$.fragment,Po),transition_in(vo.$$.fragment,Po);for(let Mo=0;Mo<Eo.length;Mo+=1)transition_in(Lo[Mo]);So=!0}},o(Po){transition_out(lo.$$.fragment,Po),transition_out(go.$$.fragment,Po),transition_out(vo.$$.fragment,Po),Lo=Lo.filter(Boolean);for(let Mo=0;Mo<Lo.length;Mo+=1)transition_out(Lo[Mo]);So=!1},d(Po){Po&&detach(ue),destroy_component(lo),destroy_component(go),destroy_component(vo),destroy_each(Lo,Po)}}}function create_if_block_2$1C(to){var fo;let ue,eo,no,ro,oo,io,so,ao,lo,uo,co;return oo=new Select_1$1({props:{value:(fo=to[11])==null?void 0:fo.onEmptyFilter,options:to[16],getOptionLabel:func_4$6,getOptionValue:func_5$3,placeholder:!1}}),oo.$on("change",to[37]),{c(){ue=element("div"),eo=element("span"),eo.textContent="Return",no=space$1(),ro=element("span"),create_component(oo.$$.fragment),io=space$1(),so=element("span"),ao=text("when all "),lo=text(to[4]),uo=text("s are empty"),attr(ro,"class","empty-filter-picker svelte-1ymk2z3"),attr(ue,"class","empty-filter svelte-1ymk2z3")},m(po,mo){insert$1(po,ue,mo),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),mount_component(oo,ro,null),append$2(ue,io),append$2(ue,so),append$2(so,ao),append$2(so,lo),append$2(so,uo),co=!0},p(po,mo){var ho;const _o={};mo[0]&2048&&(_o.value=(ho=po[11])==null?void 0:ho.onEmptyFilter),oo.$set(_o),(!co||mo[0]&16)&&set_data(lo,po[4])},i(po){co||(transition_in(oo.$$.fragment,po),co=!0)},o(po){transition_out(oo.$$.fragment,po),co=!1},d(po){po&&detach(ue),destroy_component(oo)}}}function create_default_slot_2$32(to){let ue,eo,no;return{c(){ue=text("Add "),eo=text(to[4]),no=text(" group")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&16&&set_data(eo,ro[4])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_if_block_1$2C(to){let ue,eo,no;return eo=new Icon({props:{name:"question",color:"var(--spectrum-global-color-gray-600)"}}),{c(){ue=element("a"),create_component(eo.$$.fragment),attr(ue,"href",to[5]),attr(ue,"target","_blank")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){(!no||oo[0]&32)&&attr(ue,"href",ro[5])},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_1$4g(to){var ao,lo;let ue,eo,no,ro,oo,io=to[1]&&to[3]&&((lo=(ao=to[11])==null?void 0:ao.groups)==null?void 0:lo.length)&&create_if_block_2$1C(to);no=new Button({props:{icon:"plus-circle",size:"M",secondary:!0,$$slots:{default:[create_default_slot_2$32]},$$scope:{ctx:to}}}),no.$on("click",to[38]);let so=to[5]&&create_if_block_1$2C(to);return{c(){io&&io.c(),ue=space$1(),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),so&&so.c(),attr(eo,"class","add-group svelte-1ymk2z3")},m(uo,co){io&&io.m(uo,co),insert$1(uo,ue,co),insert$1(uo,eo,co),mount_component(no,eo,null),append$2(eo,ro),so&&so.m(eo,null),oo=!0},p(uo,co){var po,mo;uo[1]&&uo[3]&&((mo=(po=uo[11])==null?void 0:po.groups)!=null&&mo.length)?io?(io.p(uo,co),co[0]&2058&&transition_in(io,1)):(io=create_if_block_2$1C(uo),io.c(),transition_in(io,1),io.m(ue.parentNode,ue)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros());const fo={};co[0]&16|co[1]&256&&(fo.$$scope={dirty:co,ctx:uo}),no.$set(fo),uo[5]?so?(so.p(uo,co),co[0]&32&&transition_in(so,1)):(so=create_if_block_1$2C(uo),so.c(),transition_in(so,1),so.m(eo,null)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(uo){oo||(transition_in(io),transition_in(no.$$.fragment,uo),transition_in(so),oo=!0)},o(uo){transition_out(io),transition_out(no.$$.fragment,uo),transition_out(so),oo=!1},d(uo){uo&&(detach(ue),detach(eo)),io&&io.d(uo),destroy_component(no),so&&so.d()}}}function create_default_slot$6f(to){let ue,eo,no,ro;const oo=[create_if_block$4G,create_else_block_1$t],io=[];function so(ao,lo){var uo;return(uo=ao[12])!=null&&uo.length?0:1}return ue=so(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$4()},m(ao,lo){io[ue].m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){let uo=ue;ue=so(ao),ue===uo?io[ue].p(ao,lo):(group_outros(),transition_out(io[uo],1,1,()=>{io[uo]=null}),check_outros(),eo=io[ue],eo?eo.p(ao,lo):(eo=io[ue]=oo[ue](ao),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(ao){ro||(transition_in(eo),ro=!0)},o(ao){transition_out(eo),ro=!1},d(ao){ao&&detach(no),io[ue].d(ao)}}}function create_fragment$9_(to){let ue,eo,no;return eo=new Layout$o({props:{noPadding:!0,$$slots:{default:[create_default_slot$6f]},$$scope:{ctx:to}}}),{c(){var ro,oo;ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","container svelte-1ymk2z3"),toggle_class(ue,"mobile",(oo=(ro=to[14])==null?void 0:ro.device)==null?void 0:oo.mobile)},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){var so,ao;const io={};oo[0]&16383|oo[1]&256&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io),(!no||oo[0]&16384)&&toggle_class(ue,"mobile",(ao=(so=ro[14])==null?void 0:so.device)==null?void 0:ao.mobile)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}const func$R=to=>to.label,func_1$E=to=>to.value,func_2$6=to=>to.label,func_3$3=to=>to.value,func_4$6=to=>to.label,func_5$3=to=>to.value;function instance$a1(to,ue,eo){let no,ro,oo,io,{$$slots:so={},$$scope:ao}=ue;const lo=createEventDispatcher(),{OperatorOptions:uo,DEFAULT_BB_DATASOURCE_ID:co,FilterOperator:fo,OnEmptyFilter:po,FilterValueType:mo}=Constants$1;let{schemaFields:_o}=ue,{filters:ho}=ue,{tables:go=[]}=ue,{datasource:bo}=ue,{behaviourFilters:vo=!1}=ue,{allowBindings:$o=!1}=ue,{allowOnEmpty:wo=!0}=ue,{builderType:ko="filter"}=ue,{docsURL:So="https://docs.budibase.com/docs/searchfilter-data"}=ue,{bindings:To}=ue,{panel:Io}=ue,{toReadable:Ao}=ue,{toRuntime:Eo}=ue,{evaluationContext:Lo={}}=ue;const No=Cs=>Array.isArray(Cs)?processSearchFilters(Cs):cloneDeep(Cs),Do=Object.values(fo).map(Cs=>({value:Cs,label:capitalise$1(Cs)})),Po={[po.RETURN_ALL]:"All rows",[po.RETURN_NONE]:"No rows"},Mo=Object.values(po).map(Cs=>({value:Cs,label:Po[Cs]})),Uo=getContext$1("context");component_subscribe(to,Uo,Cs=>eo(14,io=Cs));const Vo=Cs=>{const da=Cs.type;xo(Cs),Go(Cs),Xo(Cs,da)},Wo=Cs=>{Go(Cs),Xo(Cs,Cs.type)},Zo=Cs=>_o.find(da=>da.name===Cs.field),Yo=Cs=>ko==="condition"?[uo.Equals,uo.NotEquals]:!(Cs!=null&&Cs.field)&&!(Cs!=null&&Cs.name)?[]:getValidOperatorsForType(Cs,Cs.field||Cs.name,bo),xo=Cs=>{var Es;const da=_o.find(gs=>gs.name===Cs.field);Cs.type=da==null?void 0:da.type,Cs.subtype=da==null?void 0:da.subtype,Cs.formulaType=da==null?void 0:da.formulaType,Cs.constraints=da==null?void 0:da.constraints,Cs.externalType=(Es=Zo(Cs))==null?void 0:Es.externalType},Go=Cs=>{const da=Yo(Cs).map(gs=>gs.value);da.includes(Cs.operator)||(Cs.operator=da[0]??uo.Equals.value);const Es=[uo.Empty.value,uo.NotEmpty.value];Cs.noValue=Es.includes(Cs.operator)},Xo=(Cs,da)=>{if(Cs.noValue){Cs.value=null;return}Array.isArray(Cs.value)?(Cs.valueType!=="Value"||Cs.type!==FieldType.ARRAY)&&(Cs.value=null):Cs.type===FieldType.ARRAY&&Cs.valueType==="Value"?Cs.value=[]:da!==Cs.type&&(da===FieldType.BB_REFERENCE||Cs.type===FieldType.BB_REFERENCE)&&(Cs.value=Cs.type===FieldType.ARRAY?[]:null)},as=Cs=>Cs==0?"When":{[fo.ANY]:"or",[fo.ALL]:"and"}[no.logicalOperator],Ko=(Cs,da,Es)=>{const gs=cloneDeep(Cs);ls({groupIdx:da,filterIdx:Es,filter:{...gs}})},ls=Cs=>{var ca,ra,ta;const{groupIdx:da,filterIdx:Es,filter:gs,group:Ts,addFilter:ws,addGroup:bs,deleteGroup:Us,deleteFilter:qs,logicalOperator:Ys,onEmptyFilter:Ks}=Cs;let Xs=cloneDeep(no),Vs=(ca=Xs==null?void 0:Xs.groups)==null?void 0:ca[da];((ra=Vs==null?void 0:Vs.filters)==null?void 0:ra[Es])?qs?(Vs.filters.splice(Es,1),Vs.filters.length===0&&Xs.groups.splice(da,1)):gs&&(Vs.filters[Es]=gs):Vs?Us?Xs.groups.splice(da,1):ws?Vs.filters.push({valueType:mo.VALUE,...ko==="condition"?{operator:uo.Equals.value,type:FieldType.STRING}:{}}):Ts&&(Xs.groups[da]={...Vs,...Ts}):bs?((ta=Xs==null?void 0:Xs.groups)!=null&&ta.length||(Xs={logicalOperator:UILogicalOperator.ALL,onEmptyFilter:EmptyFilterOption.RETURN_NONE,groups:[]}),Xs.groups.push({logicalOperator:FilterOperator.ANY,filters:[{valueType:mo.VALUE,...ko==="condition"?{operator:uo.Equals.value}:{}}]})):Ys?Xs={...Xs,logicalOperator:Ys}:Ks&&(Xs={...Xs,onEmptyFilter:Ks}),Xs=Xs.groups.length?Xs:null,lo("change",Xs)},Jo=Cs=>{ls({logicalOperator:Cs.detail})},hs=(Cs,da)=>{ls({groupIdx:Cs,group:{logicalOperator:da.detail}})},ks=Cs=>{ls({groupIdx:Cs,addFilter:!0})},cs=Cs=>{ls({groupIdx:Cs,deleteGroup:!0})},_s=(Cs,da,Es,gs)=>{const Ts={...Cs,field:gs.detail};Vo(Ts),Ko(Ts,da,Es)},Is=(Cs,da,Es,gs)=>{const Ts={...Cs,field:gs.detail.field};Ko(Ts,da,Es)},Bs=(Cs,da,Es,gs)=>{const Ts={...Cs,operator:gs.detail};Wo(Ts),Ko(Ts,da,Es)},Hs=(Cs,da,Es,gs)=>{Ko({...Cs,...gs.detail},da,Es)},Rs=(Cs,da)=>{ls({groupIdx:Cs,filterIdx:da,deleteFilter:!0})},Ds=Cs=>{ls({onEmptyFilter:Cs.detail})},Js=()=>{ls({addGroup:!0})};return to.$$set=Cs=>{"schemaFields"in Cs&&eo(0,_o=Cs.schemaFields),"filters"in Cs&&eo(24,ho=Cs.filters),"tables"in Cs&&eo(25,go=Cs.tables),"datasource"in Cs&&eo(26,bo=Cs.datasource),"behaviourFilters"in Cs&&eo(1,vo=Cs.behaviourFilters),"allowBindings"in Cs&&eo(2,$o=Cs.allowBindings),"allowOnEmpty"in Cs&&eo(3,wo=Cs.allowOnEmpty),"builderType"in Cs&&eo(4,ko=Cs.builderType),"docsURL"in Cs&&eo(5,So=Cs.docsURL),"bindings"in Cs&&eo(6,To=Cs.bindings),"panel"in Cs&&eo(7,Io=Cs.panel),"toReadable"in Cs&&eo(8,Ao=Cs.toReadable),"toRuntime"in Cs&&eo(9,Eo=Cs.toRuntime),"evaluationContext"in Cs&&eo(10,Lo=Cs.evaluationContext),"$$scope"in Cs&&eo(39,ao=Cs.$$scope)},to.$$.update=()=>{to.$$.dirty[0]&16777216&&eo(11,no=No(ho)),to.$$.dirty[0]&100663297&&go.find(Cs=>Cs._id===(bo==null?void 0:bo.tableId)&&Cs.sourceId===co)&&!_o.some(Cs=>Cs.name==="_id")&&eo(0,_o=[..._o,{name:"_id",type:"string"}]),to.$$.dirty[0]&16&&eo(13,ro=ko==="filter"?"Show data which matches":"Run branch when matching"),to.$$.dirty[0]&1&&eo(12,oo=(_o||[]).filter(Cs=>!Cs.calculationType).map(Cs=>({label:Cs.displayName||Cs.name,value:Cs.name})))},[_o,vo,$o,wo,ko,So,To,Io,Ao,Eo,Lo,no,oo,ro,io,Do,Mo,Uo,Vo,Wo,Yo,as,Ko,ls,ho,go,bo,so,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,ao]}class CoreFilterBuilder extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a1,create_fragment$9_,safe_not_equal,{schemaFields:0,filters:24,tables:25,datasource:26,behaviourFilters:1,allowBindings:2,allowOnEmpty:3,builderType:4,docsURL:5,bindings:6,panel:7,toReadable:8,toRuntime:9,evaluationContext:10},null,[-1,-1])}}function create_default_slot$6e(to){let ue,eo,no,ro,oo,io;function so(co){to[15](co)}let ao={label:"Password",type:"password",error:to[1]};to[3]!==void 0&&(ao.value=to[3]),ue=new FancyInput({props:ao}),binding_callbacks.push(()=>bind$2(ue,"value",so));function lo(co){to[16](co)}let uo={label:"Repeat password",type:"password",error:to[4]&&to[3]!==to[2]&&"Passwords must match"};return to[2]!==void 0&&(uo.value=to[2]),ro=new FancyInput({props:uo}),binding_callbacks.push(()=>bind$2(ro,"value",lo)),{c(){create_component(ue.$$.fragment),no=space$1(),create_component(ro.$$.fragment)},m(co,fo){mount_component(ue,co,fo),insert$1(co,no,fo),mount_component(ro,co,fo),io=!0},p(co,fo){const po={};fo&2&&(po.error=co[1]),!eo&&fo&8&&(eo=!0,po.value=co[3],add_flush_callback(()=>eo=!1)),ue.$set(po);const mo={};fo&28&&(mo.error=co[4]&&co[3]!==co[2]&&"Passwords must match"),!oo&&fo&4&&(oo=!0,mo.value=co[2],add_flush_callback(()=>oo=!1)),ro.$set(mo)},i(co){io||(transition_in(ue.$$.fragment,co),transition_in(ro.$$.fragment,co),io=!0)},o(co){transition_out(ue.$$.fragment,co),transition_out(ro.$$.fragment,co),io=!1},d(co){co&&detach(no),destroy_component(ue,co),destroy_component(ro,co)}}}function create_fragment$9Z(to){let ue,eo,no={$$slots:{default:[create_default_slot$6e]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[17](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&1048606&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[17](null),destroy_component(ue,ro)}}}function instance$a0(to,ue,eo){let no,ro,oo,io,so,ao,{passwordForm:lo=void 0}=ue,{password:uo}=ue,{error:co}=ue,{minLength:fo="12"}=ue;const po=So=>!So||So.length<parseInt(fo)?`Please enter at least ${fo} characters. We recommend using machine generated or random passwords.`:null,[mo,_o,ho]=createValidationStore$1("",requiredValidator);component_subscribe(to,mo,So=>eo(3,oo=So)),component_subscribe(to,_o,So=>eo(14,ao=So)),component_subscribe(to,ho,So=>eo(13,so=So));const[go,bo,vo]=createValidationStore$1("",requiredValidator,po);component_subscribe(to,go,So=>eo(2,ro=So)),component_subscribe(to,vo,So=>eo(4,io=So));function $o(So){oo=So,mo.set(oo)}function wo(So){ro=So,go.set(ro)}function ko(So){binding_callbacks[So?"unshift":"push"](()=>{lo=So,eo(0,lo)})}return to.$$set=So=>{"passwordForm"in So&&eo(0,lo=So.passwordForm),"password"in So&&eo(10,uo=So.password),"error"in So&&eo(11,co=So.error),"minLength"in So&&eo(12,fo=So.minLength)},to.$$.update=()=>{to.$$.dirty&8&&eo(10,uo=oo),to.$$.dirty&25616&&eo(1,no=so&&ao||io&&po(uo)),to.$$.dirty&8222&&eo(11,co=!oo||!so||!io||oo!==ro||no)},[lo,no,ro,oo,io,mo,_o,ho,go,vo,uo,co,fo,so,ao,$o,wo,ko]}class PasswordRepeatInput extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a0,create_fragment$9Z,safe_not_equal,{passwordForm:0,password:10,error:11,minLength:12})}}function create_default_slot_1$4f(to){let ue;return{c(){ue=text("Enter your new password below.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$6d(to){let ue,eo,no,ro,oo,io;ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_1$4f]},$$scope:{ctx:to}}});function so(uo){to[8](uo)}function ao(uo){to[9](uo)}let lo={minLength:to[0]};return to[1]!==void 0&&(lo.password=to[1]),to[2]!==void 0&&(lo.error=to[2]),no=new PasswordRepeatInput({props:lo}),binding_callbacks.push(()=>bind$2(no,"password",so)),binding_callbacks.push(()=>bind$2(no,"error",ao)),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(uo,co){mount_component(ue,uo,co),insert$1(uo,eo,co),mount_component(no,uo,co),io=!0},p(uo,co){const fo={};co&2048&&(fo.$$scope={dirty:co,ctx:uo}),ue.$set(fo);const po={};co&1&&(po.minLength=uo[0]),!ro&&co&2&&(ro=!0,po.password=uo[1],add_flush_callback(()=>ro=!1)),!oo&&co&4&&(oo=!0,po.error=uo[2],add_flush_callback(()=>oo=!1)),no.$set(po)},i(uo){io||(transition_in(ue.$$.fragment,uo),transition_in(no.$$.fragment,uo),io=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(no.$$.fragment,uo),io=!1},d(uo){uo&&detach(eo),destroy_component(ue,uo),destroy_component(no,uo)}}}function create_fragment$9Y(to){let ue,eo,no,ro;return ue=new ModalContent({props:{title:"Update password",confirmText:"Update password",onConfirm:to[3],disabled:!!to[2]||!to[1],$$slots:{default:[create_default_slot$6d]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0,no||(ro=listen(window,"keydown",to[4]),no=!0)},p(oo,[io]){const so={};io&6&&(so.disabled=!!oo[2]||!oo[1]),io&2055&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo),no=!1,ro()}}}function instance$9$(to,ue,eo){let{API:no}=ue,{passwordMinLength:ro=void 0}=ue,{notifySuccess:oo=notifications.success}=ue,{notifyError:io=notifications.error}=ue;const so=createEventDispatcher();let ao="",lo="";const uo=async()=>{try{await no.updateSelf({password:ao}),oo("Password changed successfully"),so("save")}catch{io("Failed to update password")}},co=mo=>{mo.key==="Enter"&&!lo&&ao&&uo()};function fo(mo){ao=mo,eo(1,ao)}function po(mo){lo=mo,eo(2,lo)}return to.$$set=mo=>{"API"in mo&&eo(5,no=mo.API),"passwordMinLength"in mo&&eo(0,ro=mo.passwordMinLength),"notifySuccess"in mo&&eo(6,oo=mo.notifySuccess),"notifyError"in mo&&eo(7,io=mo.notifyError)},[ro,ao,lo,uo,co,no,oo,io,fo,po]}class ChangePasswordModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9$,create_fragment$9Y,safe_not_equal,{API:5,passwordMinLength:0,notifySuccess:6,notifyError:7})}}function create_default_slot_1$4e(to){let ue;return{c(){ue=text("Personalise the platform by adding your first name and last name.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$6c(to){var _o;let ue,eo,no,ro,oo,io,so,ao,lo,uo;ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_1$4e]},$$scope:{ctx:to}}}),no=new Input$5({props:{disabled:!0,value:((_o=to[0])==null?void 0:_o.email)||"",label:"Email"}});function co(ho){to[7](ho)}let fo={label:"First name"};to[1].firstName!==void 0&&(fo.value=to[1].firstName),oo=new Input$5({props:fo}),binding_callbacks.push(()=>bind$2(oo,"value",co));function po(ho){to[8](ho)}let mo={label:"Last name"};return to[1].lastName!==void 0&&(mo.value=to[1].lastName),ao=new Input$5({props:mo}),binding_callbacks.push(()=>bind$2(ao,"value",po)),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),so=space$1(),create_component(ao.$$.fragment)},m(ho,go){mount_component(ue,ho,go),insert$1(ho,eo,go),mount_component(no,ho,go),insert$1(ho,ro,go),mount_component(oo,ho,go),insert$1(ho,so,go),mount_component(ao,ho,go),uo=!0},p(ho,go){var ko;const bo={};go&1024&&(bo.$$scope={dirty:go,ctx:ho}),ue.$set(bo);const vo={};go&1&&(vo.value=((ko=ho[0])==null?void 0:ko.email)||""),no.$set(vo);const $o={};!io&&go&2&&(io=!0,$o.value=ho[1].firstName,add_flush_callback(()=>io=!1)),oo.$set($o);const wo={};!lo&&go&2&&(lo=!0,wo.value=ho[1].lastName,add_flush_callback(()=>lo=!1)),ao.$set(wo)},i(ho){uo||(transition_in(ue.$$.fragment,ho),transition_in(no.$$.fragment,ho),transition_in(oo.$$.fragment,ho),transition_in(ao.$$.fragment,ho),uo=!0)},o(ho){transition_out(ue.$$.fragment,ho),transition_out(no.$$.fragment,ho),transition_out(oo.$$.fragment,ho),transition_out(ao.$$.fragment,ho),uo=!1},d(ho){ho&&(detach(eo),detach(ro),detach(so)),destroy_component(ue,ho),destroy_component(no,ho),destroy_component(oo,ho),destroy_component(ao,ho)}}}function create_fragment$9X(to){let ue,eo;return ue=new ModalContent({props:{title:"My profile",confirmText:"Save",onConfirm:to[3],$$slots:{default:[create_default_slot$6c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&1027&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$9_(to,ue,eo){let no,{user:ro=void 0}=ue,{API:oo}=ue,{notifySuccess:io=notifications.success}=ue,{notifyError:so=notifications.error}=ue;const ao=createEventDispatcher(),lo=writable({firstName:ro==null?void 0:ro.firstName,lastName:ro==null?void 0:ro.lastName});component_subscribe(to,lo,po=>eo(1,no=po));const uo=async()=>{try{await oo.updateSelf(no),io("Information updated successfully"),ao("save")}catch(po){console.error(po),so("Failed to update information")}};function co(po){to.$$.not_equal(no.firstName,po)&&(no.firstName=po,lo.set(no))}function fo(po){to.$$.not_equal(no.lastName,po)&&(no.lastName=po,lo.set(no))}return to.$$set=po=>{"user"in po&&eo(0,ro=po.user),"API"in po&&eo(4,oo=po.API),"notifySuccess"in po&&eo(5,io=po.notifySuccess),"notifyError"in po&&eo(6,so=po.notifyError)},[ro,no,lo,uo,oo,io,so,co,fo]}class ProfileModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9_,create_fragment$9X,safe_not_equal,{user:0,API:4,notifySuccess:5,notifyError:6})}}var PersistenceType=(to=>(to.NONE="none",to.LOCAL="local",to.SESSION="session",to))(PersistenceType||{});class BudiStore{constructor(ue,eo){if(eo!=null&&eo.persistence)switch(eo.persistence.type){case"local":this.store=createLocalStorageStore(eo.persistence.key,ue);break;case"session":this.store=createSessionStorageStore(eo.persistence.key,ue);break;default:this.store=writable(ue)}else this.store=writable(ue);this.subscribe=this.store.subscribe,this.update=this.store.update,this.set=this.store.set,eo!=null&&eo.debug&&this.subscribe(no=>{console.warn(`${this.constructor.name}`,no)})}}class DerivedBudiStore{constructor(ue,eo,no){this.store=new BudiStore(ue,no),this.derivedStore=eo(this.store),this.subscribe=this.derivedStore.subscribe,this.update=this.store.update,this.set=this.store.set}}const INITIAL_LAYOUT_STATE={layouts:[],selectedLayoutId:null};class LayoutStore extends BudiStore{constructor(){super(INITIAL_LAYOUT_STATE),this.reset=this.reset.bind(this),this.syncAppLayouts=this.syncAppLayouts.bind(this),this.select=this.select.bind(this),this.deleteLayout=this.deleteLayout.bind(this)}reset(){this.store.set({...INITIAL_LAYOUT_STATE})}syncAppLayouts(ue){this.update(eo=>({...eo,layouts:[...ue.layouts]}))}select(ue){var oo,io;const eo=get_store_value(this.store),no=get_store_value(componentStore),ro=eo.layouts.find(so=>so._id===ue);ro&&(eo.selectedLayoutId===ro._id&&no.selectedComponentId===((oo=ro.props)==null?void 0:oo._id)||(this.update(so=>(so.selectedLayoutId=ro._id,so)),componentStore.select((io=ro.props)==null?void 0:io._id)))}async deleteLayout(ue){!(ue!=null&&ue._id)||!(ue!=null&&ue._rev)||(await API.deleteLayout(ue._id,ue._rev),this.update(eo=>(eo.layouts=eo.layouts.filter(no=>no._id!==ue._id),eo)))}}const layoutStore=new LayoutStore;derived(layoutStore,to=>{var ue;return(ue=to.layouts)==null?void 0:ue.find(eo=>eo._id===to.selectedLayoutId)});class BaseStructure{constructor(ue,eo){this._isScreen=ue,this._children=[],this._json=eo}addChild(ue){return this._children.push(ue),this}customProps(ue){for(let eo of Object.keys(ue))this._json[eo]=ue[eo];return this}json(){var eo,no;const ue=fp$1.cloneDeep(this._json);if(this._children.length!==0)for(let ro of this._children)this._isScreen?ue.props._children.push(((eo=ro.json)==null?void 0:eo.call(ro))||ro):ue._children.push(((no=ro.json)==null?void 0:no.call(ro))||ro);return ue}}let Screen$1=class extends BaseStructure{constructor(ue){super(!0,{showNavigation:!0,width:"Large",props:{_id:uuid$1(),_component:"@budibase/standard-components/container",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"",layout:"flex",direction:"column",hAlign:"stretch",vAlign:"top",size:"grow",gap:"M"},routing:{route:"",roleId:"BASIC",homeScreen:!1},name:"screen-id",workspaceAppId:ue})}role(ue){return this._json.routing.roleId=ue,this}normalStyle(ue){return this._json.props._styles.normal=ue,this}component(ue){return this._json.props._component=ue,this}table(ue){return this._json.props.table=ue,this}route(ue){return this._json.routing.route=ue,this}name(ue){return this._json.name=ue,this}autoTableId(ue){return this._json.autoTableId=ue,this}instanceName(ue){return this._json.props._instanceName=ue,this}customProps(ue){for(let eo of Object.keys(ue))this._json.props[eo]=ue[eo];return this}};class PDFScreen extends Screen$1{constructor(ue){super(ue),this._json.variant=ScreenVariant.PDF,this._json.width="Max",this._json.showNavigation=!1,this._json.props={_id:uuid$1(),_component:"@budibase/standard-components/pdf",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"PDF",title:"PDF"}}}const capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:so,...ao}=get_store_value(this.store),lo={...ao,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return notifications.error("Error fetching user"),null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;function e(to,ue){var eo=Object.keys(to);if(Object.getOwnPropertySymbols){var no=Object.getOwnPropertySymbols(to);ue&&(no=no.filter(function(ro){return Object.getOwnPropertyDescriptor(to,ro).enumerable})),eo.push.apply(eo,no)}return eo}function t$1(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue]!=null?arguments[ue]:{};ue%2?e(Object(eo),!0).forEach(function(no){o(to,no,eo[no])}):Object.getOwnPropertyDescriptors?Object.defineProperties(to,Object.getOwnPropertyDescriptors(eo)):e(Object(eo)).forEach(function(no){Object.defineProperty(to,no,Object.getOwnPropertyDescriptor(eo,no))})}return to}function n(to){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ue){return typeof ue}:function(ue){return ue&&typeof Symbol=="function"&&ue.constructor===Symbol&&ue!==Symbol.prototype?"symbol":typeof ue},n(to)}function i$2(to,ue){if(!(to instanceof ue))throw new TypeError("Cannot call a class as a function")}function r(to,ue){for(var eo=0;eo<ue.length;eo++){var no=ue[eo];no.enumerable=no.enumerable||!1,no.configurable=!0,"value"in no&&(no.writable=!0),Object.defineProperty(to,no.key,no)}}function s(to,ue,eo){return ue&&r(to.prototype,ue),eo&&r(to,eo),Object.defineProperty(to,"prototype",{writable:!1}),to}function o(to,ue,eo){return ue in to?Object.defineProperty(to,ue,{value:eo,enumerable:!0,configurable:!0,writable:!0}):to[ue]=eo,to}function a(to,ue){if(to==null)return{};var eo,no,ro=function(io,so){if(io==null)return{};var ao,lo,uo={},co=Object.keys(io);for(lo=0;lo<co.length;lo++)ao=co[lo],so.indexOf(ao)>=0||(uo[ao]=io[ao]);return uo}(to,ue);if(Object.getOwnPropertySymbols){var oo=Object.getOwnPropertySymbols(to);for(no=0;no<oo.length;no++)eo=oo[no],ue.indexOf(eo)>=0||Object.prototype.propertyIsEnumerable.call(to,eo)&&(ro[eo]=to[eo])}return ro}function u(to,ue){return function(eo){if(Array.isArray(eo))return eo}(to)||function(eo,no){var ro=eo==null?null:typeof Symbol<"u"&&eo[Symbol.iterator]||eo["@@iterator"];if(ro!=null){var oo,io,so=[],ao=!0,lo=!1;try{for(ro=ro.call(eo);!(ao=(oo=ro.next()).done)&&(so.push(oo.value),!no||so.length!==no);ao=!0);}catch(uo){lo=!0,io=uo}finally{try{ao||ro.return==null||ro.return()}finally{if(lo)throw io}}return so}}(to,ue)||c(to,ue)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
551
|
+
`),create_component(no.$$.fragment),attr(ue,"class","button-with-keys svelte-8ib1kg")},m(oo,io){insert$1(oo,ue,io),append$2(ue,eo),mount_component(no,ue,null),ro=!0},p:noop$5,i(oo){ro||(transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(no)}}}function create_fragment$a4(to){var io,so;let ue,eo,no,ro;ue=new TempTooltip({props:{text:"Click here to create your first row",condition:to[6]&&to[10]&&!((io=to[11])!=null&&io.length)&&!((so=to[12])!=null&&so.length)&&!to[13],type:TooltipType.Info,$$slots:{default:[create_default_slot_6$1a]},$$scope:{ctx:to}}});let oo=to[2]&&create_if_block$4L(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),oo&&oo.c(),no=empty$4()},m(ao,lo){mount_component(ue,ao,lo),insert$1(ao,eo,lo),oo&&oo.m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){var co,fo;const uo={};lo[0]&15424&&(uo.condition=ao[6]&&ao[10]&&!((co=ao[11])!=null&&co.length)&&!((fo=ao[12])!=null&&fo.length)&&!ao[13]),lo[0]&16518|lo[2]&64&&(uo.$$scope={dirty:lo,ctx:ao}),ue.$set(uo),ao[2]?oo?(oo.p(ao,lo),lo[0]&4&&transition_in(oo,1)):(oo=create_if_block$4L(ao),oo.c(),transition_in(oo,1),oo.m(no.parentNode,no)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(ao){ro||(transition_in(ue.$$.fragment,ao),transition_in(oo),ro=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(oo),ro=!1},d(ao){ao&&(detach(eo),detach(no)),destroy_component(ue,ao),oo&&oo.d(ao)}}}function instance$a7(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So,To,Io,Ao,Eo,Lo,No,Do;const{hoveredRowId:Po,focusedCellId:Mo,displayColumn:Uo,scroll:Vo,dispatch:Wo,rows:Zo,focusedCellAPI:Yo,datasource:xo,subscribe:Go,renderedRows:Xo,scrollableColumns:as,rowHeight:Ko,hasNextPage:ls,maxScrollTop:Jo,selectedRows:hs,loaded:ks,refreshing:cs,config:_s,filter:Is,inlineFilters:Bs,columnRenderMap:Hs,visibleColumns:Rs,scrollTop:Ds,height:Js}=getContext$1("grid");component_subscribe(to,Po,Vs=>eo(57,fo=Vs)),component_subscribe(to,Mo,Vs=>eo(9,co=Vs)),component_subscribe(to,Uo,Vs=>eo(1,ko=Vs)),component_subscribe(to,Zo,Vs=>eo(50,vo=Vs)),component_subscribe(to,Yo,Vs=>eo(56,uo=Vs)),component_subscribe(to,xo,Vs=>eo(52,wo=Vs)),component_subscribe(to,Xo,Vs=>eo(49,bo=Vs)),component_subscribe(to,as,Vs=>eo(15,No=Vs)),component_subscribe(to,Ko,Vs=>eo(46,_o=Vs)),component_subscribe(to,ls,Vs=>eo(45,mo=Vs)),component_subscribe(to,Jo,Vs=>eo(58,po=Vs)),component_subscribe(to,hs,Vs=>eo(51,$o=Vs)),component_subscribe(to,ks,Vs=>eo(10,To=Vs)),component_subscribe(to,cs,Vs=>eo(13,Eo=Vs)),component_subscribe(to,_s,Vs=>eo(14,Lo=Vs)),component_subscribe(to,Is,Vs=>eo(11,Io=Vs)),component_subscribe(to,Bs,Vs=>eo(12,Ao=Vs)),component_subscribe(to,Hs,Vs=>eo(16,Do=Vs)),component_subscribe(to,Rs,Vs=>eo(53,So=Vs)),component_subscribe(to,Ds,Vs=>eo(48,go=Vs)),component_subscribe(to,Js,Vs=>eo(47,ho=Vs));let Cs=!1,da=!1,Es,gs=0;const Ts=(Vs,Qs,ca,ra)=>Vs?0:(eo(0,gs=Qs*ca-ra%ca),Qs!==0&&eo(0,gs-=1),gs),ws=async()=>{eo(3,da=!0),set_store_value(Mo,co=null,co),await tick();const Vs=gs?void 0:0;let Qs={...Es};delete Qs._isNewRow;const ca=await Zo.actions.addRow({row:Qs,idx:Vs});ca&&(bs(),no&&set_store_value(Mo,co=getCellID(ca._id,no.name),co)),eo(3,da=!1)},bs=()=>{eo(3,da=!1),eo(2,Cs=!1),set_store_value(Mo,co=null,co),set_store_value(Po,fo=null,fo),document.removeEventListener("keydown",Ks)},Us=async()=>{if(Cs&&!da){await ws();return}Cs||!no||(mo||Vo.update(Vs=>({...Vs,top:po})),eo(4,Es={_isNewRow:!0}),eo(2,Cs=!0),set_store_value(Po,fo=NewRowID,fo),no&&set_store_value(Mo,co=getCellID(NewRowID,no.name),co),document.addEventListener("keydown",Ks))},qs=({column:Vs,value:Qs})=>{eo(4,Es[Vs]=Qs,Es)},Ys=()=>{bs(),Wo("add-row")},Ks=Vs=>{Cs&&Vs.key==="Escape"&&(uo!=null&&uo.isActive()||(Vs.preventDefault(),bs()))};onMount(()=>Go("add-row-inline",Us)),onDestroy(()=>{document.removeEventListener("keydown",Ks)});const Xs=()=>Wo("add-row-inline");return to.$$.update=()=>{to.$$.dirty[1]&4194304&&(no=So[0]),to.$$.dirty[0]&2&&eo(8,ro=GutterWidth+((ko==null?void 0:ko.width)||0)),to.$$.dirty[1]&2097152&&eo(2,Cs=!1),to.$$.dirty[1]&1048576&&eo(7,oo=Object.values($o).length),to.$$.dirty[1]&524288&&eo(6,io=!vo.length),to.$$.dirty[1]&262144&&eo(44,so=bo.length),to.$$.dirty[1]&188416&&eo(0,gs=Ts(mo,so,_o,go)),to.$$.dirty[0]&1|to.$$.dirty[1]&98304&&eo(43,ao=ho-gs-_o),to.$$.dirty[1]&4096&&eo(5,lo=ao<36+DefaultRowHeight)},[gs,ko,Cs,da,Es,lo,io,oo,ro,co,To,Io,Ao,Eo,Lo,No,Do,Po,Mo,Uo,Wo,Zo,Yo,xo,Xo,as,Ko,ls,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,ws,bs,qs,Ys,ao,so,mo,_o,ho,go,bo,vo,$o,wo,So,Xs]}class NewRow extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a7,create_fragment$a4,safe_not_equal,{},null,[-1,-1,-1])}}const createGridWebsocket=to=>{const{rows:ue,datasource:eo,users:no,focusedCellId:ro,definition:oo,API:io}=to,so=createWebsocket("/socket/grid"),ao=lo=>{if(!so.connected)return;const uo=io.getAppID();so.emit(GridSocketEvent.SelectDatasource,{datasource:lo,appId:uo},({users:co})=>{no.set(co)})};return so.on("connect",()=>{ao(get_store_value(eo))}),so.on("connect_error",lo=>{console.error("Failed to connect to grid websocket:",lo.message)}),so.onOther(SocketEvent.UserUpdate,({user:lo})=>{no.actions.updateUser(lo)}),so.onOther(SocketEvent.UserDisconnect,({sessionId:lo})=>{no.actions.removeUser(lo)}),so.onOther(GridSocketEvent.RowChange,async({id:lo,row:uo})=>{lo?ue.actions.replaceRow(lo,uo):uo.id&&await ue.actions.refreshRow(uo.id)}),so.onOther(GridSocketEvent.DatasourceChange,({datasource:lo})=>{lo&&oo.set(lo)}),so.on(GridSocketEvent.DatasourceChange,({datasource:lo})=>{var uo;(lo==null?void 0:lo.name)!==((uo=get_store_value(oo))==null?void 0:uo.name)&&oo.set(lo)}),eo.subscribe(ao),ro.subscribe(lo=>{so.emit(GridSocketEvent.SelectCell,{cellId:lo})}),()=>so==null?void 0:so.disconnect()},Grid_svelte_svelte_type_style_lang="",get_add_column_slot_changes=to=>({}),get_add_column_slot_context=to=>({}),get_edit_column_slot_changes_1=to=>({}),get_edit_column_slot_context_1=to=>({}),get_edit_column_slot_changes=to=>({}),get_edit_column_slot_context=to=>({}),get_controls_right_slot_changes=to=>({}),get_controls_right_slot_context=to=>({}),get_controls_slot_changes$1=to=>({}),get_controls_slot_context$1=to=>({});function create_if_block_5$G(to){let ue,eo,no,ro,oo,io;const so=to[49].controls,ao=create_slot(so,to,to[52],get_controls_slot_context$1),lo=to[49]["controls-right"],uo=create_slot(lo,to,to[52],get_controls_right_slot_context);let co=to[2]&&create_if_block_6$t();return{c(){ue=element("div"),eo=element("div"),ao&&ao.c(),no=space$1(),ro=element("div"),uo&&uo.c(),oo=space$1(),co&&co.c(),attr(eo,"class","controls-left svelte-fdk5zl"),attr(ro,"class","controls-right svelte-fdk5zl"),attr(ue,"class","controls svelte-fdk5zl")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),ao&&ao.m(eo,null),append$2(ue,no),append$2(ue,ro),uo&&uo.m(ro,null),append$2(ro,oo),co&&co.m(ro,null),io=!0},p(fo,po){ao&&ao.p&&(!io||po[1]&2097152)&&update_slot_base(ao,so,fo,fo[52],io?get_slot_changes(so,fo[52],po,get_controls_slot_changes$1):get_all_dirty_from_scope(fo[52]),get_controls_slot_context$1),uo&&uo.p&&(!io||po[1]&2097152)&&update_slot_base(uo,lo,fo,fo[52],io?get_slot_changes(lo,fo[52],po,get_controls_right_slot_changes):get_all_dirty_from_scope(fo[52]),get_controls_right_slot_context),fo[2]?co?po[0]&4&&transition_in(co,1):(co=create_if_block_6$t(),co.c(),transition_in(co,1),co.m(ro,null)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros())},i(fo){io||(transition_in(ao,fo),transition_in(uo,fo),transition_in(co),io=!0)},o(fo){transition_out(ao,fo),transition_out(uo,fo),transition_out(co),io=!1},d(fo){fo&&detach(ue),ao&&ao.d(fo),uo&&uo.d(fo),co&&co.d()}}}function create_if_block_6$t(to){let ue,eo;return ue=new UserAvatars({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$1a(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So;no=new StickyColumn({props:{$$slots:{"edit-column":[create_edit_column_slot_1]},$$scope:{ctx:to}}}),io=new HeaderRow({props:{$$slots:{"edit-column":[create_edit_column_slot$1],"add-column":[create_add_column_slot$1]},$$scope:{ctx:to}}}),ao=new GridBody({});let To=to[10].canAddRows&&create_if_block_4$T();return fo=new ResizeOverlay({}),mo=new ReorderOverlay({}),ho=new ScrollOverlay({}),bo=new MenuOverlay({}),$o=new PopoverOverlay({}),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),oo=element("div"),create_component(io.$$.fragment),so=space$1(),create_component(ao.$$.fragment),lo=space$1(),To&&To.c(),uo=space$1(),co=element("div"),create_component(fo.$$.fragment),po=space$1(),create_component(mo.$$.fragment),_o=space$1(),create_component(ho.$$.fragment),go=space$1(),create_component(bo.$$.fragment),vo=space$1(),create_component($o.$$.fragment),attr(oo,"class","grid-data-content svelte-fdk5zl"),attr(co,"class","overlays svelte-fdk5zl"),attr(eo,"class","grid-data-inner svelte-fdk5zl"),attr(ue,"class","grid-data-outer svelte-fdk5zl")},m(Io,Ao){insert$1(Io,ue,Ao),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),append$2(eo,oo),mount_component(io,oo,null),append$2(oo,so),mount_component(ao,oo,null),append$2(eo,lo),To&&To.m(eo,null),append$2(eo,uo),append$2(eo,co),mount_component(fo,co,null),append$2(co,po),mount_component(mo,co,null),append$2(co,_o),mount_component(ho,co,null),append$2(co,go),mount_component(bo,co,null),append$2(co,vo),mount_component($o,co,null),wo=!0,ko||(So=action_destroyer(clickOutside.call(null,ue,to[16].actions.blur)),ko=!0)},p(Io,Ao){const Eo={};Ao[1]&2097152&&(Eo.$$scope={dirty:Ao,ctx:Io}),no.$set(Eo);const Lo={};Ao[1]&2097152&&(Lo.$$scope={dirty:Ao,ctx:Io}),io.$set(Lo),Io[10].canAddRows?To?Ao[0]&1024&&transition_in(To,1):(To=create_if_block_4$T(),To.c(),transition_in(To,1),To.m(eo,uo)):To&&(group_outros(),transition_out(To,1,1,()=>{To=null}),check_outros())},i(Io){wo||(transition_in(no.$$.fragment,Io),transition_in(io.$$.fragment,Io),transition_in(ao.$$.fragment,Io),transition_in(To),transition_in(fo.$$.fragment,Io),transition_in(mo.$$.fragment,Io),transition_in(ho.$$.fragment,Io),transition_in(bo.$$.fragment,Io),transition_in($o.$$.fragment,Io),wo=!0)},o(Io){transition_out(no.$$.fragment,Io),transition_out(io.$$.fragment,Io),transition_out(ao.$$.fragment,Io),transition_out(To),transition_out(fo.$$.fragment,Io),transition_out(mo.$$.fragment,Io),transition_out(ho.$$.fragment,Io),transition_out(bo.$$.fragment,Io),transition_out($o.$$.fragment,Io),wo=!1},d(Io){Io&&detach(ue),destroy_component(no),destroy_component(io),destroy_component(ao),To&&To.d(),destroy_component(fo),destroy_component(mo),destroy_component(ho),destroy_component(bo),destroy_component($o),ko=!1,So()}}}function create_if_block_2$1E(to){let ue,eo,no,ro,oo;return{c(){ue=element("div"),eo=element("div"),eo.textContent="There was a problem loading your grid",no=space$1(),ro=element("div"),oo=text(to[8]),attr(eo,"class","grid-error-title svelte-fdk5zl"),attr(ro,"class","grid-error-subtitle svelte-fdk5zl"),attr(ue,"class","grid-error svelte-fdk5zl")},m(io,so){insert$1(io,ue,so),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ro,oo)},p(io,so){so[0]&256&&set_data(oo,io[8])},i:noop$5,o:noop$5,d(io){io&&detach(ue)}}}function create_edit_column_slot_1(to){let ue;const eo=to[49]["edit-column"],no=create_slot(eo,to,to[52],get_edit_column_slot_context);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_edit_column_slot_changes):get_all_dirty_from_scope(ro[52]),get_edit_column_slot_context)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_add_column_slot$1(to){let ue;const eo=to[49]["add-column"],no=create_slot(eo,to,to[52],get_add_column_slot_context);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_add_column_slot_changes):get_all_dirty_from_scope(ro[52]),get_add_column_slot_context)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_edit_column_slot$1(to){let ue;const eo=to[49]["edit-column"],no=create_slot(eo,to,to[52],get_edit_column_slot_context_1);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo[1]&2097152)&&update_slot_base(no,eo,ro,ro[52],ue?get_slot_changes(eo,ro[52],oo,get_edit_column_slot_changes_1):get_all_dirty_from_scope(ro[52]),get_edit_column_slot_context_1)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_if_block_4$T(to){let ue,eo;return ue=new NewRow({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$2F(to){let ue,eo,no,ro;return eo=new ProgressCircle({}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","grid-loading svelte-fdk5zl")},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&(no||add_render_callback(()=>{no=create_in_transition(ue,fade,{duration:130}),no.start()})),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo)}}}function create_if_block$4K(to){let ue,eo;return ue=new BulkDuplicationHandler({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a3(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go=to[24].controls&&create_if_block_5$G(to);const bo=[create_if_block_2$1E,create_if_block_3$1a],vo=[];function $o(Io,Ao){return Io[8]?0:Io[9]?1:-1}~(no=$o(to))&&(ro=vo[no]=bo[no](to));let wo=to[11]&&!to[8]&&create_if_block_1$2F(),ko=to[10].canAddRows&&create_if_block$4K();ao=new BulkDeleteHandler({}),uo=new ClipboardHandler({}),fo=new KeyboardManager({});const So=to[49].default,To=create_slot(So,to,to[52],null);return{c(){ue=element("div"),go&&go.c(),eo=space$1(),ro&&ro.c(),oo=space$1(),wo&&wo.c(),io=space$1(),ko&&ko.c(),so=space$1(),create_component(ao.$$.fragment),lo=space$1(),create_component(uo.$$.fragment),co=space$1(),create_component(fo.$$.fragment),po=space$1(),To&&To.c(),attr(ue,"class","grid svelte-fdk5zl"),attr(ue,"id",to[12]),set_style(ue,"--row-height",to[5]+"px"),set_style(ue,"--default-row-height",DefaultRowHeight+"px"),set_style(ue,"--gutter-width",GutterWidth+"px"),set_style(ue,"--max-cell-render-overflow",MaxCellRenderOverflow+"px"),set_style(ue,"--content-lines",to[6]),set_style(ue,"--min-height",to[7]+"px"),set_style(ue,"--controls-height",ControlsHeight+"px"),set_style(ue,"--scroll-bar-size",ScrollBarSize+"px"),toggle_class(ue,"is-resizing",to[3]),toggle_class(ue,"is-reordering",to[4]),toggle_class(ue,"stripe",to[0]),toggle_class(ue,"quiet",to[1])},m(Io,Ao){insert$1(Io,ue,Ao),go&&go.m(ue,null),append$2(ue,eo),~no&&vo[no].m(ue,null),append$2(ue,oo),wo&&wo.m(ue,null),append$2(ue,io),ko&&ko.m(ue,null),append$2(ue,so),mount_component(ao,ue,null),append$2(ue,lo),mount_component(uo,ue,null),append$2(ue,co),mount_component(fo,ue,null),append$2(ue,po),To&&To.m(ue,null),mo=!0,_o||(ho=[listen(ue,"mouseenter",to[50]),listen(ue,"mouseleave",to[51])],_o=!0)},p(Io,Ao){Io[24].controls?go?(go.p(Io,Ao),Ao[0]&16777216&&transition_in(go,1)):(go=create_if_block_5$G(Io),go.c(),transition_in(go,1),go.m(ue,eo)):go&&(group_outros(),transition_out(go,1,1,()=>{go=null}),check_outros());let Eo=no;no=$o(Io),no===Eo?~no&&vo[no].p(Io,Ao):(ro&&(group_outros(),transition_out(vo[Eo],1,1,()=>{vo[Eo]=null}),check_outros()),~no?(ro=vo[no],ro?ro.p(Io,Ao):(ro=vo[no]=bo[no](Io),ro.c()),transition_in(ro,1),ro.m(ue,oo)):ro=null),Io[11]&&!Io[8]?wo?Ao[0]&2304&&transition_in(wo,1):(wo=create_if_block_1$2F(),wo.c(),transition_in(wo,1),wo.m(ue,io)):wo&&(group_outros(),transition_out(wo,1,1,()=>{wo=null}),check_outros()),Io[10].canAddRows?ko?Ao[0]&1024&&transition_in(ko,1):(ko=create_if_block$4K(),ko.c(),transition_in(ko,1),ko.m(ue,so)):ko&&(group_outros(),transition_out(ko,1,1,()=>{ko=null}),check_outros()),To&&To.p&&(!mo||Ao[1]&2097152)&&update_slot_base(To,So,Io,Io[52],mo?get_slot_changes(So,Io[52],Ao,null):get_all_dirty_from_scope(Io[52]),null),(!mo||Ao[0]&32)&&set_style(ue,"--row-height",Io[5]+"px"),(!mo||Ao[0]&64)&&set_style(ue,"--content-lines",Io[6]),(!mo||Ao[0]&128)&&set_style(ue,"--min-height",Io[7]+"px"),(!mo||Ao[0]&8)&&toggle_class(ue,"is-resizing",Io[3]),(!mo||Ao[0]&16)&&toggle_class(ue,"is-reordering",Io[4]),(!mo||Ao[0]&1)&&toggle_class(ue,"stripe",Io[0]),(!mo||Ao[0]&2)&&toggle_class(ue,"quiet",Io[1])},i(Io){mo||(transition_in(go),transition_in(ro),transition_in(wo),transition_in(ko),transition_in(ao.$$.fragment,Io),transition_in(uo.$$.fragment,Io),transition_in(fo.$$.fragment,Io),transition_in(To,Io),mo=!0)},o(Io){transition_out(go),transition_out(ro),transition_out(wo),transition_out(ko),transition_out(ao.$$.fragment,Io),transition_out(uo.$$.fragment,Io),transition_out(fo.$$.fragment,Io),transition_out(To,Io),mo=!1},d(Io){Io&&detach(ue),go&&go.d(),~no&&vo[no].d(),wo&&wo.d(),ko&&ko.d(),destroy_component(ao),destroy_component(uo),destroy_component(fo),To&&To.d(Io),_o=!1,run_all(ho)}}}function instance$a6(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,{$$slots:fo={},$$scope:po}=ue;const mo=compute_slots(fo);let{API:_o=null}=ue,{datasource:ho=null}=ue,{schemaOverrides:go=null}=ue,{canAddRows:bo=!0}=ue,{canExpandRows:vo=!0}=ue,{canEditRows:$o=!0}=ue,{canDeleteRows:wo=!0}=ue,{canEditColumns:ko=!0}=ue,{canSaveSchema:So=!0}=ue,{stripeRows:To=!1}=ue,{quiet:Io=!1}=ue,{collaboration:Ao=!0}=ue,{showAvatars:Eo=!0}=ue,{initialFilter:Lo=null}=ue,{initialSortColumn:No=null}=ue,{initialSortOrder:Do=null}=ue,{fixedRowHeight:Po=null}=ue,{notifySuccess:Mo=null}=ue,{notifyError:Uo=null}=ue,{buttons:Vo=null}=ue,{buttonsCollapsed:Wo=!1}=ue,{buttonsCollapsedText:Zo=null}=ue,{darkMode:Yo=!1}=ue,{isCloud:xo=null}=ue,{aiEnabled:Go=!1}=ue,{canHideColumns:Xo=!0}=ue;const as=`grid-${Math.random().toString().slice(2)}`,Ko=writable(ue);let ls=attachStores({API:_o||createAPIClient(),Constants,gridID:as,props:Ko,...createEventManagers()});const{config:Jo,isResizing:hs,isReordering:ks,ui:cs,loaded:_s,loading:Is,rowHeight:Bs,contentLines:Hs,gridFocused:Rs,error:Ds}=ls;component_subscribe(to,Jo,gs=>eo(10,uo=gs)),component_subscribe(to,hs,gs=>eo(3,no=gs)),component_subscribe(to,ks,gs=>eo(4,ro=gs)),component_subscribe(to,_s,gs=>eo(9,lo=gs)),component_subscribe(to,Is,gs=>eo(11,co=gs)),component_subscribe(to,Bs,gs=>eo(5,oo=gs)),component_subscribe(to,Hs,gs=>eo(6,io=gs)),component_subscribe(to,Ds,gs=>eo(8,ao=gs));const Js=derived(Bs,gs=>{const Ts=mo.controls?ControlsHeight:0;return VPadding+SmallRowHeight+gs+Ts});component_subscribe(to,Js,gs=>eo(7,so=gs)),ls={...ls,minHeight:Js},setContext("grid",ls);const Cs=()=>ls;onMount(()=>{if(Ao)return createGridWebsocket(ls)});const da=()=>Rs.set(!0),Es=()=>Rs.set(!1);return to.$$set=gs=>{eo(55,ue=assign$1(assign$1({},ue),exclude_internal_props(gs))),"API"in gs&&eo(25,_o=gs.API),"datasource"in gs&&eo(26,ho=gs.datasource),"schemaOverrides"in gs&&eo(27,go=gs.schemaOverrides),"canAddRows"in gs&&eo(28,bo=gs.canAddRows),"canExpandRows"in gs&&eo(29,vo=gs.canExpandRows),"canEditRows"in gs&&eo(30,$o=gs.canEditRows),"canDeleteRows"in gs&&eo(31,wo=gs.canDeleteRows),"canEditColumns"in gs&&eo(32,ko=gs.canEditColumns),"canSaveSchema"in gs&&eo(33,So=gs.canSaveSchema),"stripeRows"in gs&&eo(0,To=gs.stripeRows),"quiet"in gs&&eo(1,Io=gs.quiet),"collaboration"in gs&&eo(34,Ao=gs.collaboration),"showAvatars"in gs&&eo(2,Eo=gs.showAvatars),"initialFilter"in gs&&eo(35,Lo=gs.initialFilter),"initialSortColumn"in gs&&eo(36,No=gs.initialSortColumn),"initialSortOrder"in gs&&eo(37,Do=gs.initialSortOrder),"fixedRowHeight"in gs&&eo(38,Po=gs.fixedRowHeight),"notifySuccess"in gs&&eo(39,Mo=gs.notifySuccess),"notifyError"in gs&&eo(40,Uo=gs.notifyError),"buttons"in gs&&eo(41,Vo=gs.buttons),"buttonsCollapsed"in gs&&eo(42,Wo=gs.buttonsCollapsed),"buttonsCollapsedText"in gs&&eo(43,Zo=gs.buttonsCollapsedText),"darkMode"in gs&&eo(44,Yo=gs.darkMode),"isCloud"in gs&&eo(45,xo=gs.isCloud),"aiEnabled"in gs&&eo(46,Go=gs.aiEnabled),"canHideColumns"in gs&&eo(47,Xo=gs.canHideColumns),"$$scope"in gs&&eo(52,po=gs.$$scope)},to.$$.update=()=>{to.$$.dirty[0]&2080374791|to.$$.dirty[1]&131071&&Ko.set({datasource:ho,schemaOverrides:go,canAddRows:bo,canExpandRows:vo,canEditRows:$o,canDeleteRows:wo,canEditColumns:ko,canSaveSchema:So,stripeRows:To,quiet:Io,collaboration:Ao,showAvatars:Eo,initialFilter:Lo,initialSortColumn:No,initialSortOrder:Do,fixedRowHeight:Po,notifySuccess:Mo,notifyError:Uo,buttons:Vo,buttonsCollapsed:Wo,buttonsCollapsedText:Zo,darkMode:Yo,isCloud:xo,aiEnabled:Go,canHideColumns:Xo})},ue=exclude_internal_props(ue),[To,Io,Eo,no,ro,oo,io,so,ao,lo,uo,co,as,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,mo,_o,ho,go,bo,vo,$o,wo,ko,So,Ao,Lo,No,Do,Po,Mo,Uo,Vo,Wo,Zo,Yo,xo,Go,Xo,Cs,fo,da,Es,po]}class Grid extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a6,create_fragment$a3,safe_not_equal,{API:25,datasource:26,schemaOverrides:27,canAddRows:28,canExpandRows:29,canEditRows:30,canDeleteRows:31,canEditColumns:32,canSaveSchema:33,stripeRows:0,quiet:1,collaboration:34,showAvatars:2,initialFilter:35,initialSortColumn:36,initialSortOrder:37,fixedRowHeight:38,notifySuccess:39,notifyError:40,buttons:41,buttonsCollapsed:42,buttonsCollapsedText:43,darkMode:44,isCloud:45,aiEnabled:46,canHideColumns:47,getContext:48},null,[-1,-1])}get getContext(){return this.$$.ctx[48]}}const ClientAppSkeleton_svelte_svelte_type_style_lang="";function create_if_block_1$2E(to){let ue;return{c(){ue=element("div"),attr(ue,"class","devTools svelte-1hc8b9o")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block$4J(to){let ue;return{c(){ue=element("div"),attr(ue,"class","footer svelte-1hc8b9o")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$a2(to){let ue,eo,no,ro,oo,io,so=!to[1]&&create_if_block_1$2E(),ao=!to[2]&&create_if_block$4J();return{c(){ue=element("div"),eo=element("div"),no=space$1(),so&&so.c(),ro=space$1(),oo=element("div"),oo.innerHTML='<div class="nav svelte-1hc8b9o"></div> <div class="body svelte-1hc8b9o"><div class="bodyVerticalPadding svelte-1hc8b9o"></div> <div class="bodyHorizontal svelte-1hc8b9o"><div class="bodyHorizontalPadding svelte-1hc8b9o"></div> <svg class="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="240" height="256"><mask id="mask"><rect x="0" y="0" width="240" height="256" fill="white"></rect><rect x="0" y="0" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="56" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="112" width="240" height="32" rx="6" fill="black"></rect><rect x="0" y="168" width="240" height="32" rx="6" fill="black"></rect><rect x="71" y="224" width="98" height="32" rx="6" fill="black"></rect></mask><rect x="0" y="0" width="240" height="256" fill="black" mask="url(#mask)"></rect></svg> <div class="bodyHorizontalPadding svelte-1hc8b9o"></div></div> <div class="bodyVerticalPadding svelte-1hc8b9o"></div></div>',io=space$1(),ao&&ao.c(),attr(eo,"class","animation svelte-1hc8b9o"),toggle_class(eo,"noAnimation",to[3]),attr(oo,"class","main svelte-1hc8b9o"),attr(ue,"id","clientAppSkeletonLoader"),attr(ue,"class","skeleton svelte-1hc8b9o"),toggle_class(ue,"sideNav",to[0])},m(lo,uo){insert$1(lo,ue,uo),append$2(ue,eo),append$2(ue,no),so&&so.m(ue,null),append$2(ue,ro),append$2(ue,oo),append$2(ue,io),ao&&ao.m(ue,null)},p(lo,[uo]){uo&8&&toggle_class(eo,"noAnimation",lo[3]),lo[1]?so&&(so.d(1),so=null):so||(so=create_if_block_1$2E(),so.c(),so.m(ue,ro)),lo[2]?ao&&(ao.d(1),ao=null):ao||(ao=create_if_block$4J(),ao.c(),ao.m(ue,null)),uo&1&&toggle_class(ue,"sideNav",lo[0])},i:noop$5,o:noop$5,d(lo){lo&&detach(ue),so&&so.d(),ao&&ao.d()}}}function instance$a5(to,ue,eo){let{sideNav:no=!1}=ue,{hideDevTools:ro=!1}=ue,{hideFooter:oo=!1}=ue,{noAnimation:io=!1}=ue;return to.$$set=so=>{"sideNav"in so&&eo(0,no=so.sideNav),"hideDevTools"in so&&eo(1,ro=so.hideDevTools),"hideFooter"in so&&eo(2,oo=so.hideFooter),"noAnimation"in so&&eo(3,io=so.noAnimation)},[no,ro,oo,io]}class ClientAppSkeleton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a5,create_fragment$a2,safe_not_equal,{sideNav:0,hideDevTools:1,hideFooter:2,noAnimation:3})}}function create_fragment$a1(to){let ue,eo,no;var ro=to[2];function oo(io,so){return{props:{value:io[0],autocomplete:!0,options:io[3],getOptionLabel:func$S,getOptionValue:func_1$F,disabled:io[1]}}}return ro&&(eo=construct_svelte_component(ro,oo(to)),eo.$on("change",to[8])),{c(){ue=element("div"),eo&&create_component(eo.$$.fragment),attr(ue,"class","user-control")},m(io,so){insert$1(io,ue,so),eo&&mount_component(eo,ue,null),no=!0},p(io,[so]){if(so&4&&ro!==(ro=io[2])){if(eo){group_outros();const ao=eo;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(eo=construct_svelte_component(ro,oo(io)),eo.$on("change",io[8]),create_component(eo.$$.fragment),transition_in(eo.$$.fragment,1),mount_component(eo,ue,null)):eo=null}else if(ro){const ao={};so&1&&(ao.value=io[0]),so&8&&(ao.options=io[3]),so&2&&(ao.disabled=io[1]),eo.$set(ao)}},i(io){no||(eo&&transition_in(eo.$$.fragment,io),no=!0)},o(io){eo&&transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),eo&&destroy_component(eo)}}}const func$S=to=>to.email,func_1$F=to=>to._id;function instance$a4(to,ue,eo){let no,ro,oo,io,so=noop$5,ao=()=>(so(),so=subscribe(no,mo=>eo(7,io=mo)),no);to.$$.on_destroy.push(()=>so());let{API:lo=createAPIClient()}=ue,{value:uo=null}=ue,{disabled:co}=ue,{multiselect:fo=!1}=ue;function po(mo){bubble.call(this,to,mo)}return to.$$set=mo=>{"API"in mo&&eo(5,lo=mo.API),"value"in mo&&eo(0,uo=mo.value),"disabled"in mo&&eo(1,co=mo.disabled),"multiselect"in mo&&eo(6,fo=mo.multiselect)},to.$$.update=()=>{to.$$.dirty&32&&ao(eo(4,no=fetchData({API:lo,datasource:{type:"user"},options:{limit:100}}))),to.$$.dirty&128&&eo(3,ro=io.rows),to.$$.dirty&64&&eo(2,oo=fo?Multiselect_1:Select_1$1)},[uo,co,oo,ro,no,lo,fo,io,po]}class FilterUsers extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a4,create_fragment$a1,safe_not_equal,{API:5,value:0,disabled:1,multiselect:6})}}const FilterField_svelte_svelte_type_style_lang="";function create_default_slot$6h(to){let ue;return{c(){ue=text("Confirm")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$k(to){let ue,eo;return ue=new Button({props:{cta:!0,slot:"buttons",$$slots:{default:[create_default_slot$6h]},$$scope:{ctx:to}}}),ue.$on("click",to[23]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&32&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$j(to){let ue,eo,no;var ro=to[4];function oo(io,so){return{props:{slot:"body",value:io[9],allowJS:!0,allowHelpers:!0,allowHBS:!0,bindings:io[2],context:io[6]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("change",to[16])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$4()},m(io,so){ue&&mount_component(ue,io,so),insert$1(io,eo,so),no=!0},p(io,so){if(so[0]&16&&ro!==(ro=io[4])){if(ue){group_outros();const ao=ue;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("change",io[16]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const ao={};so[0]&512&&(ao.value=io[9]),so[0]&4&&(ao.bindings=io[2]),so[0]&64&&(ao.context=io[6]),ue.$set(ao)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function create_else_block$1U(to){let ue,eo,no,ro,oo,io;const so=[create_if_block_2$1D,create_if_block_3$19,create_if_block_4$S,create_if_block_5$F,create_if_block_6$s,create_if_block_7$n,create_else_block_1$u],ao=[];function lo(uo,co){return co[0]&1&&(eo=null),co[0]&1&&(no=null),eo==null&&(eo=!![FieldType.STRING,FieldType.LONGFORM,FieldType.NUMBER,FieldType.BIGINT,FieldType.FORMULA,FieldType.AI,FieldType.BARCODEQR].includes(uo[0].type)),eo?0:uo[0].type===FieldType.ARRAY||uo[0].type===FieldType.OPTIONS&&uo[0].operator===ArrayOperator.ONE_OF?1:uo[0].type===FieldType.OPTIONS?2:uo[0].type===FieldType.BOOLEAN?3:uo[0].type===FieldType.DATETIME?4:(no==null&&(no=!![FieldType.BB_REFERENCE,FieldType.BB_REFERENCE_SINGLE].includes(uo[0].type)),no?5:6)}return ro=lo(to,[-1,-1]),oo=ao[ro]=so[ro](to),{c(){ue=element("div"),oo.c()},m(uo,co){insert$1(uo,ue,co),ao[ro].m(ue,null),io=!0},p(uo,co){let fo=ro;ro=lo(uo,co),ro===fo?ao[ro].p(uo,co):(group_outros(),transition_out(ao[fo],1,1,()=>{ao[fo]=null}),check_outros(),oo=ao[ro],oo?oo.p(uo,co):(oo=ao[ro]=so[ro](uo),oo.c()),transition_in(oo,1),oo.m(ue,null))},i(uo){io||(transition_in(oo),io=!0)},o(uo){transition_out(oo),io=!1},d(uo){uo&&detach(ue),ao[ro].d()}}}function create_if_block_1$2D(to){let ue,eo;return ue=new Input$5({props:{disabled:to[0].noValue,readonly:to[11],value:to[11]?"(JavaScript function)":to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&2048&&(oo.readonly=no[11]),ro[0]&2304&&(oo.value=no[11]?"(JavaScript function)":no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_else_block_1$u(to){let ue,eo;return ue=new Input$5({props:{disabled:!0}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$5,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_7$n(to){let ue,eo;return ue=new FilterUsers({props:{multiselect:[to[12].In.value,to[12].ContainsAny.value].includes(to[0].operator),disabled:to[0].noValue,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.multiselect=[no[12].In.value,no[12].ContainsAny.value].includes(no[0].operator)),ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_6$s(to){var no,ro;let ue,eo;return ue=new DatePicker_1({props:{disabled:to[0].noValue,enableTime:!((no=to[15](to[0]))!=null&&no.dateOnly),timeOnly:(ro=to[15](to[0]))==null?void 0:ro.timeOnly,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0},p(oo,io){var ao,lo;const so={};io[0]&1&&(so.disabled=oo[0].noValue),io[0]&1&&(so.enableTime=!((ao=oo[15](oo[0]))!=null&&ao.dateOnly)),io[0]&1&&(so.timeOnly=(lo=oo[15](oo[0]))==null?void 0:lo.timeOnly),io[0]&256&&(so.value=oo[8]),ue.$set(so)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo)}}}function create_if_block_5$F(to){let ue,eo;return ue=new Combobox_1({props:{disabled:to[0].noValue,options:[{label:"True",value:"true"},{label:"False",value:"false"}],value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_4$S(to){let ue,eo;return ue=new Combobox_1({props:{disabled:to[0].noValue,options:to[14](to[0].field),value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&1&&(oo.options=no[14](no[0].field)),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$19(to){let ue,eo;return ue=new Multiselect_1({props:{disabled:to[0].noValue,options:to[14](to[0].field),value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&1&&(oo.options=no[14](no[0].field)),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_2$1D(to){let ue,eo;return ue=new Input$5({props:{disabled:to[0].noValue,value:to[8]}}),ue.$on("change",to[17]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.disabled=no[0].noValue),ro[0]&256&&(oo.value=no[8]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$4I(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{size:"S",weight:"fill",name:"lightning"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon svelte-u5a0ap"),toggle_class(ue,"binding",to[0].valueType==="Binding")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[27]),ro=!0)},p(io,so){(!no||so[0]&1)&&toggle_class(ue,"binding",io[0].valueType==="Binding")},i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$a0(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co={title:to[5]||to[0].field,forceModal:!0,$$slots:{body:[create_body_slot$j],buttons:[create_buttons_slot$k]},$$scope:{ctx:to}};eo=new Drawer({props:co}),to[24](eo),eo.$on("drawerHide",to[25]),eo.$on("drawerShow",to[26]);const fo=[create_if_block_1$2D,create_else_block$1U],po=[];function mo(ho,go){return ho[0].valueType===ho[13].BINDING?0:1}io=mo(to),so=po[io]=fo[io](to);let _o=!to[1]&&to[3]&&!to[0].noValue&&create_if_block$4I(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("div"),oo=element("div"),so.c(),ao=space$1(),lo=element("div"),_o&&_o.c(),attr(oo,"class","field svelte-u5a0ap"),attr(lo,"class","binding-control svelte-u5a0ap"),attr(ro,"class","field-wrap svelte-u5a0ap"),toggle_class(ro,"bindings",to[3]),toggle_class(ro,"valid",to[10])},m(ho,go){insert$1(ho,ue,go),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),po[io].m(oo,null),append$2(ro,ao),append$2(ro,lo),_o&&_o.m(lo,null),uo=!0},p(ho,go){const bo={};go[0]&33&&(bo.title=ho[5]||ho[0].field),go[0]&724|go[1]&32&&(bo.$$scope={dirty:go,ctx:ho}),eo.$set(bo);let vo=io;io=mo(ho),io===vo?po[io].p(ho,go):(group_outros(),transition_out(po[vo],1,1,()=>{po[vo]=null}),check_outros(),so=po[io],so?so.p(ho,go):(so=po[io]=fo[io](ho),so.c()),transition_in(so,1),so.m(oo,null)),!ho[1]&&ho[3]&&!ho[0].noValue?_o?(_o.p(ho,go),go[0]&11&&transition_in(_o,1)):(_o=create_if_block$4I(ho),_o.c(),transition_in(_o,1),_o.m(lo,null)):_o&&(group_outros(),transition_out(_o,1,1,()=>{_o=null}),check_outros()),(!uo||go[0]&8)&&toggle_class(ro,"bindings",ho[3]),(!uo||go[0]&1024)&&toggle_class(ro,"valid",ho[10])},i(ho){uo||(transition_in(eo.$$.fragment,ho),transition_in(so),transition_in(_o),uo=!0)},o(ho){transition_out(eo.$$.fragment,ho),transition_out(so),transition_out(_o),uo=!1},d(ho){ho&&detach(ue),to[24](null),destroy_component(eo),po[io].d(),_o&&_o.d()}}}function instance$a3(to,ue,eo){let no,ro,oo,io,so,{filter:ao}=ue,{disabled:lo=!1}=ue,{bindings:uo=[]}=ue,{allowBindings:co=!1}=ue,{schemaFields:fo}=ue,{panel:po}=ue,{drawerTitle:mo}=ue,{toReadable:_o}=ue,{toRuntime:ho}=ue,{evaluationContext:go={}}=ue;const bo=createEventDispatcher(),{OperatorOptions:vo,FilterValueType:$o}=Constants$1;let wo;const ko=Go=>{var as;const Xo=fo.find(Ko=>Ko.name===Go);return((as=Xo==null?void 0:Xo.constraints)==null?void 0:as.inclusion)||[]},So=Go=>fo.find(Xo=>Xo.name===Go.field),To=Go=>{eo(9,oo=Go.detail)},Io=Go=>{eo(22,no=Go.detail),bo("change",{value:ho?ho(uo,no):no})},Ao=()=>{bo("change",{value:ho?ho(uo,oo):oo,valueType:oo?$o.BINDING:$o.VALUE})},Eo=Go=>!Go||!isNaN(new Date(Go).valueOf()),Lo=Go=>{let Xo=[];if(Array.isArray(Go))Xo=Go;else if(Go&&typeof Go=="string")Xo=Go.split(",");else return!Go;return Xo.every(as=>{var Ko,ls,Jo;return(Jo=(ls=(Ko=So(ao))==null?void 0:Ko.constraints)==null?void 0:ls.inclusion)==null?void 0:Jo.includes(as)})},No=Go=>Go==="false"||Go==="true"||Go=="",Do=Go=>{let Xo=[];if(Array.isArray(Go))Xo=Go;else if(Go&&typeof Go=="string")Xo=Go.split(",");else return!Go;return Xo.every(as=>as.startsWith("ro_"))},Po={date:Eo,datetime:Eo,bb_reference:Do,bb_reference_single:Do,array:Lo,longform:Go=>!isJSBinding(Go),options:Go=>{var Xo;return!isJSBinding(Go)&&!((Xo=findHBSBlocks(Go))!=null&&Xo.length)},boolean:No},Mo=Go=>{const Xo=Po[ao.type];return Xo?Xo(Go):!0},Uo=Go=>ao.valueType==$o.VALUE?"":Array.isArray(Go)?Go.join(","):ro,Vo=()=>{Ao(),wo.hide()};function Wo(Go){binding_callbacks[Go?"unshift":"push"](()=>{wo=Go,eo(7,wo)})}function Zo(Go){bubble.call(this,to,Go)}function Yo(Go){bubble.call(this,to,Go)}const xo=()=>{wo.show()};return to.$$set=Go=>{"filter"in Go&&eo(0,ao=Go.filter),"disabled"in Go&&eo(1,lo=Go.disabled),"bindings"in Go&&eo(2,uo=Go.bindings),"allowBindings"in Go&&eo(3,co=Go.allowBindings),"schemaFields"in Go&&eo(19,fo=Go.schemaFields),"panel"in Go&&eo(4,po=Go.panel),"drawerTitle"in Go&&eo(5,mo=Go.drawerTitle),"toReadable"in Go&&eo(20,_o=Go.toReadable),"toRuntime"in Go&&eo(21,ho=Go.toRuntime),"evaluationContext"in Go&&eo(6,go=Go.evaluationContext)},to.$$.update=()=>{to.$$.dirty[0]&1&&eo(22,no=ao==null?void 0:ao.value),to.$$.dirty[0]&5242884&&eo(8,ro=_o?_o(uo,no):no),to.$$.dirty[0]&4194304&&eo(9,oo=Uo(no)),to.$$.dirty[0]&4194304&&eo(11,io=isJSBinding(no)),to.$$.dirty[0]&4194304&&eo(10,so=Mo(no))},[ao,lo,uo,co,po,mo,go,wo,ro,oo,so,io,vo,$o,ko,So,To,Io,Ao,fo,_o,ho,no,Vo,Wo,Zo,Yo,xo]}class FilterField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a3,create_fragment$a0,safe_not_equal,{filter:0,disabled:1,bindings:2,allowBindings:3,schemaFields:19,panel:4,drawerTitle:5,toReadable:20,toRuntime:21,evaluationContext:6},null,[-1,-1])}}const ConditionField_svelte_svelte_type_style_lang="";function create_default_slot$6g(to){let ue;return{c(){ue=text("Confirm")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$j(to){let ue,eo;return ue=new Button({props:{cta:!0,slot:"buttons",$$slots:{default:[create_default_slot$6g]},$$scope:{ctx:to}}}),ue.$on("click",to[16]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&8388608&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$i(to){let ue,eo,no;var ro=to[3];function oo(io,so){return{props:{slot:"body",value:io[8],allowJS:!0,allowHelpers:!0,allowHBS:!0,bindings:io[2],context:io[5]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("change",to[10])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$4()},m(io,so){ue&&mount_component(ue,io,so),insert$1(io,eo,so),no=!0},p(io,so){if(so&8&&ro!==(ro=io[3])){if(ue){group_outros();const ao=ue;transition_out(ao.$$.fragment,1,0,()=>{destroy_component(ao,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("change",io[10]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const ao={};so&256&&(ao.value=io[8]),so&4&&(ao.bindings=io[2]),so&32&&(ao.context=io[5]),ue.$set(ao)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function create_if_block$4H(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{size:"S",weight:"fill",name:"lightning"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon binding svelte-eaqops")},m(io,so){insert$1(io,ue,so),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[20]),ro=!0)},p:noop$5,i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$9$(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo={title:to[4]||"",forceModal:!0,$$slots:{body:[create_body_slot$i],buttons:[create_buttons_slot$j]},$$scope:{ctx:to}};eo=new Drawer({props:uo}),to[17](eo),eo.$on("drawerHide",to[18]),eo.$on("drawerShow",to[19]),io=new Input$5({props:{disabled:to[0].noValue,readonly:to[9],value:to[9]?"(JavaScript function)":to[7]}}),io.$on("change",to[11]);let co=!to[1]&&create_if_block$4H(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("div"),oo=element("div"),create_component(io.$$.fragment),so=space$1(),ao=element("div"),co&&co.c(),attr(oo,"class","field svelte-eaqops"),attr(ao,"class","binding-control svelte-eaqops"),attr(ro,"class","field-wrap svelte-eaqops"),toggle_class(ro,"bindings",!0)},m(fo,po){insert$1(fo,ue,po),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),mount_component(io,oo,null),append$2(ro,so),append$2(ro,ao),co&&co.m(ao,null),lo=!0},p(fo,[po]){const mo={};po&16&&(mo.title=fo[4]||""),po&8388972&&(mo.$$scope={dirty:po,ctx:fo}),eo.$set(mo);const _o={};po&1&&(_o.disabled=fo[0].noValue),po&512&&(_o.readonly=fo[9]),po&640&&(_o.value=fo[9]?"(JavaScript function)":fo[7]),io.$set(_o),fo[1]?co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros()):co?(co.p(fo,po),po&2&&transition_in(co,1)):(co=create_if_block$4H(fo),co.c(),transition_in(co,1),co.m(ao,null))},i(fo){lo||(transition_in(eo.$$.fragment,fo),transition_in(io.$$.fragment,fo),transition_in(co),lo=!0)},o(fo){transition_out(eo.$$.fragment,fo),transition_out(io.$$.fragment,fo),transition_out(co),lo=!1},d(fo){fo&&detach(ue),to[17](null),destroy_component(eo),destroy_component(io),co&&co.d()}}}function instance$a2(to,ue,eo){let no,ro,oo,{filter:io}=ue,{disabled:so=!1}=ue,{bindings:ao=[]}=ue,{panel:lo}=ue,{drawerTitle:uo}=ue,{toReadable:co}=ue,{toRuntime:fo}=ue,{evaluationContext:po={}}=ue;const mo=createEventDispatcher();let _o,ho;const go=Ao=>{eo(8,ro=Ao.detail)},bo=Ao=>{eo(15,ho=Ao.detail),mo("change",{field:fo?fo(ao,ho):ho})},vo=()=>{mo("change",{field:fo?fo(ao,ro):ro})},$o=Ao=>Array.isArray(Ao)?Ao.join(","):no,wo=()=>{vo(),_o.hide()};function ko(Ao){binding_callbacks[Ao?"unshift":"push"](()=>{_o=Ao,eo(6,_o)})}function So(Ao){bubble.call(this,to,Ao)}function To(Ao){bubble.call(this,to,Ao)}const Io=()=>{_o.show()};return to.$$set=Ao=>{"filter"in Ao&&eo(0,io=Ao.filter),"disabled"in Ao&&eo(1,so=Ao.disabled),"bindings"in Ao&&eo(2,ao=Ao.bindings),"panel"in Ao&&eo(3,lo=Ao.panel),"drawerTitle"in Ao&&eo(4,uo=Ao.drawerTitle),"toReadable"in Ao&&eo(13,co=Ao.toReadable),"toRuntime"in Ao&&eo(14,fo=Ao.toRuntime),"evaluationContext"in Ao&&eo(5,po=Ao.evaluationContext)},to.$$.update=()=>{to.$$.dirty&1&&eo(15,ho=io==null?void 0:io.field),to.$$.dirty&40964&&eo(7,no=co?co(ao,ho):ho),to.$$.dirty&32768&&eo(8,ro=$o(ho)),to.$$.dirty&32768&&eo(9,oo=isJSBinding(ho))},[io,so,ao,lo,uo,po,_o,no,ro,oo,go,bo,vo,co,fo,ho,wo,ko,So,To,Io]}class ConditionField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a2,create_fragment$9$,safe_not_equal,{filter:0,disabled:1,bindings:2,panel:3,drawerTitle:4,toReadable:13,toRuntime:14,evaluationContext:5})}}const CoreFilterBuilder_svelte_svelte_type_style_lang="";function get_each_context$1X(to,ue,eo){const no=to.slice();return no[52]=ue[eo],no[54]=eo,no}function get_each_context_1$z(to,ue,eo){const no=to.slice();return no[55]=ue[eo],no[57]=eo,no}const get_filtering_hero_content_slot_changes=to=>({}),get_filtering_hero_content_slot_context=to=>({});function create_else_block_1$t(to){let ue,eo;return ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_3$2k]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$4G(to){var co,fo,po,mo;let ue,eo,no,ro,oo,io;const so=to[27]["filtering-hero-content"],ao=create_slot(so,to,to[39],get_filtering_hero_content_slot_context);let lo=((fo=(co=to[11])==null?void 0:co.groups)==null?void 0:fo.length)&&create_if_block_5$E(to),uo=((mo=(po=to[11])==null?void 0:po.groups)==null?void 0:mo.length)&&create_if_block_3$18(to);return oo=new Layout$o({props:{noPadding:!0,$$slots:{default:[create_default_slot_1$4g]},$$scope:{ctx:to}}}),{c(){ao&&ao.c(),ue=space$1(),lo&&lo.c(),eo=space$1(),uo&&uo.c(),no=space$1(),ro=element("div"),create_component(oo.$$.fragment),attr(ro,"class","filters-footer svelte-1ymk2z3")},m(_o,ho){ao&&ao.m(_o,ho),insert$1(_o,ue,ho),lo&&lo.m(_o,ho),insert$1(_o,eo,ho),uo&&uo.m(_o,ho),insert$1(_o,no,ho),insert$1(_o,ro,ho),mount_component(oo,ro,null),io=!0},p(_o,ho){var bo,vo,$o,wo;ao&&ao.p&&(!io||ho[1]&256)&&update_slot_base(ao,so,_o,_o[39],io?get_slot_changes(so,_o[39],ho,get_filtering_hero_content_slot_changes):get_all_dirty_from_scope(_o[39]),get_filtering_hero_content_slot_context),(vo=(bo=_o[11])==null?void 0:bo.groups)!=null&&vo.length?lo?(lo.p(_o,ho),ho[0]&2048&&transition_in(lo,1)):(lo=create_if_block_5$E(_o),lo.c(),transition_in(lo,1),lo.m(eo.parentNode,eo)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros()),(wo=($o=_o[11])==null?void 0:$o.groups)!=null&&wo.length?uo?(uo.p(_o,ho),ho[0]&2048&&transition_in(uo,1)):(uo=create_if_block_3$18(_o),uo.c(),transition_in(uo,1),uo.m(no.parentNode,no)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros());const go={};ho[0]&2106|ho[1]&256&&(go.$$scope={dirty:ho,ctx:_o}),oo.$set(go)},i(_o){io||(transition_in(ao,_o),transition_in(lo),transition_in(uo),transition_in(oo.$$.fragment,_o),io=!0)},o(_o){transition_out(ao,_o),transition_out(lo),transition_out(uo),transition_out(oo.$$.fragment,_o),io=!1},d(_o){_o&&(detach(ue),detach(eo),detach(no),detach(ro)),ao&&ao.d(_o),lo&&lo.d(_o),uo&&uo.d(_o),destroy_component(oo)}}}function create_default_slot_3$2k(to){let ue;return{c(){ue=text("None of the table column can be used for filtering.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_5$E(to){var po;let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo;return io=new Select_1$1({props:{value:(po=to[11])==null?void 0:po.logicalOperator,options:to[15],getOptionLabel:func$R,getOptionValue:func_1$E,placeholder:!1}}),io.$on("change",to[28]),{c(){ue=element("div"),eo=element("span"),no=text(to[13]),ro=space$1(),oo=element("span"),create_component(io.$$.fragment),so=space$1(),ao=element("span"),lo=text("of the following "),uo=text(to[4]),co=text(" groups:"),attr(oo,"class","operator-picker svelte-1ymk2z3"),attr(ue,"class","global-filter-header svelte-1ymk2z3")},m(mo,_o){insert$1(mo,ue,_o),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),append$2(ue,so),append$2(ue,ao),append$2(ao,lo),append$2(ao,uo),append$2(ao,co),fo=!0},p(mo,_o){var go;(!fo||_o[0]&8192)&&set_data(no,mo[13]);const ho={};_o[0]&2048&&(ho.value=(go=mo[11])==null?void 0:go.logicalOperator),io.$set(ho),(!fo||_o[0]&16)&&set_data(uo,mo[4])},i(mo){fo||(transition_in(io.$$.fragment,mo),fo=!0)},o(mo){transition_out(io.$$.fragment,mo),fo=!1},d(mo){mo&&detach(ue),destroy_component(io)}}}function create_if_block_3$18(to){var io;let ue,eo,no=ensure_array_like((io=to[11])==null?void 0:io.groups),ro=[];for(let so=0;so<no.length;so+=1)ro[so]=create_each_block$1X(get_each_context$1X(to,no,so));const oo=so=>transition_out(ro[so],1,1,()=>{ro[so]=null});return{c(){ue=element("div");for(let so=0;so<ro.length;so+=1)ro[so].c();attr(ue,"class","filter-groups svelte-1ymk2z3")},m(so,ao){insert$1(so,ue,ao);for(let lo=0;lo<ro.length;lo+=1)ro[lo]&&ro[lo].m(ue,null);eo=!0},p(so,ao){var lo;if(ao[0]&16555989){no=ensure_array_like((lo=so[11])==null?void 0:lo.groups);let uo;for(uo=0;uo<no.length;uo+=1){const co=get_each_context$1X(so,no,uo);ro[uo]?(ro[uo].p(co,ao),transition_in(ro[uo],1)):(ro[uo]=create_each_block$1X(co),ro[uo].c(),transition_in(ro[uo],1),ro[uo].m(ue,null))}for(group_outros(),uo=no.length;uo<ro.length;uo+=1)oo(uo);check_outros()}},i(so){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(so){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(so){so&&detach(ue),destroy_each(ro,so)}}}function create_else_block$1T(to){let ue,eo;function no(...ro){return to[33](to[55],to[54],to[57],...ro)}return ue=new ConditionField({props:{placeholder:"Value",filter:to[55],drawerTitle:"Edit Binding",bindings:to[6],panel:to[7],toReadable:to[8],toRuntime:to[9],evaluationContext:to[10]}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&2048&&(io.filter=to[55]),oo[0]&64&&(io.bindings=to[6]),oo[0]&128&&(io.panel=to[7]),oo[0]&256&&(io.toReadable=to[8]),oo[0]&512&&(io.toRuntime=to[9]),oo[0]&1024&&(io.evaluationContext=to[10]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_4$R(to){let ue,eo;function no(...ro){return to[32](to[55],to[54],to[57],...ro)}return ue=new Select_1$1({props:{value:to[55].field,options:to[12],placeholder:"Column"}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&2048&&(io.value=to[55].field),oo[0]&4096&&(io.options=to[12]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_each_block_1$z(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co;const fo=[create_if_block_4$R,create_else_block$1T],po=[];function mo(bo,vo){return bo[4]==="filter"?0:1}eo=mo(to),no=po[eo]=fo[eo](to);function _o(...bo){return to[34](to[55],to[54],to[57],...bo)}oo=new Select_1$1({props:{value:to[55].operator,disabled:!to[55].field&&to[4]==="filter",options:to[20](to[55]),placeholder:!1}}),oo.$on("change",_o);function ho(...bo){return to[35](to[55],to[54],to[57],...bo)}so=new FilterField({props:{placeholder:"Value",disabled:!to[55].field&&to[4]==="filter",drawerTitle:to[4]==="condition"?"Edit binding":null,allowBindings:to[2],filter:{...to[55],...to[4]==="condition"?{type:FieldType.STRING}:{}},schemaFields:to[0],bindings:to[6],panel:to[7],toReadable:to[8],toRuntime:to[9],evaluationContext:to[10]}}),so.$on("change",ho);function go(){return to[36](to[54],to[57])}return lo=new ActionButton({props:{size:"M",icon:"trash"}}),lo.$on("click",go),{c(){ue=element("div"),no.c(),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),attr(ue,"class","filter svelte-1ymk2z3")},m(bo,vo){insert$1(bo,ue,vo),po[eo].m(ue,null),append$2(ue,ro),mount_component(oo,ue,null),append$2(ue,io),mount_component(so,ue,null),append$2(ue,ao),mount_component(lo,ue,null),append$2(ue,uo),co=!0},p(bo,vo){to=bo;let $o=eo;eo=mo(to),eo===$o?po[eo].p(to,vo):(group_outros(),transition_out(po[$o],1,1,()=>{po[$o]=null}),check_outros(),no=po[eo],no?no.p(to,vo):(no=po[eo]=fo[eo](to),no.c()),transition_in(no,1),no.m(ue,ro));const wo={};vo[0]&2048&&(wo.value=to[55].operator),vo[0]&2064&&(wo.disabled=!to[55].field&&to[4]==="filter"),vo[0]&2048&&(wo.options=to[20](to[55])),oo.$set(wo);const ko={};vo[0]&2064&&(ko.disabled=!to[55].field&&to[4]==="filter"),vo[0]&16&&(ko.drawerTitle=to[4]==="condition"?"Edit binding":null),vo[0]&4&&(ko.allowBindings=to[2]),vo[0]&2064&&(ko.filter={...to[55],...to[4]==="condition"?{type:FieldType.STRING}:{}}),vo[0]&1&&(ko.schemaFields=to[0]),vo[0]&64&&(ko.bindings=to[6]),vo[0]&128&&(ko.panel=to[7]),vo[0]&256&&(ko.toReadable=to[8]),vo[0]&512&&(ko.toRuntime=to[9]),vo[0]&1024&&(ko.evaluationContext=to[10]),so.$set(ko)},i(bo){co||(transition_in(no),transition_in(oo.$$.fragment,bo),transition_in(so.$$.fragment,bo),transition_in(lo.$$.fragment,bo),co=!0)},o(bo){transition_out(no),transition_out(oo.$$.fragment,bo),transition_out(so.$$.fragment,bo),transition_out(lo.$$.fragment,bo),co=!1},d(bo){bo&&detach(ue),po[eo].d(),destroy_component(oo),destroy_component(so),destroy_component(lo)}}}function create_each_block$1X(to){var Do;let ue,eo,no,ro,oo=to[21](to[54],to[11].logicalOperator)+"",io,so,ao,lo,uo,co,fo,po,mo,_o,ho,go,bo,vo,$o,wo,ko,So;function To(...Po){return to[29](to[54],...Po)}lo=new Select_1$1({props:{value:(Do=to[52])==null?void 0:Do.logicalOperator,options:to[15],getOptionLabel:func_2$6,getOptionValue:func_3$3,placeholder:!1}}),lo.$on("change",To);function Io(){return to[30](to[54])}go=new Icon({props:{name:"plus",hoverable:!0,hoverColor:"var(--ink)"}}),go.$on("click",Io);function Ao(){return to[31](to[54])}vo=new Icon({props:{name:"trash",hoverable:!0,hoverColor:"var(--ink)"}}),vo.$on("click",Ao);let Eo=ensure_array_like(to[52].filters),Lo=[];for(let Po=0;Po<Eo.length;Po+=1)Lo[Po]=create_each_block_1$z(get_each_context_1$z(to,Eo,Po));const No=Po=>transition_out(Lo[Po],1,1,()=>{Lo[Po]=null});return{c(){ue=element("div"),eo=element("div"),no=element("div"),ro=element("span"),io=text(oo),so=space$1(),ao=element("span"),create_component(lo.$$.fragment),uo=space$1(),co=element("span"),fo=text("of the following "),po=text(to[4]),mo=text("s are matched:"),_o=space$1(),ho=element("div"),create_component(go.$$.fragment),bo=space$1(),create_component(vo.$$.fragment),$o=space$1(),wo=element("div");for(let Po=0;Po<Lo.length;Po+=1)Lo[Po].c();ko=space$1(),attr(ao,"class","operator-picker svelte-1ymk2z3"),attr(no,"class","group-options svelte-1ymk2z3"),attr(ho,"class","group-actions svelte-1ymk2z3"),attr(eo,"class","group-header svelte-1ymk2z3"),attr(wo,"class","filters svelte-1ymk2z3"),attr(ue,"class","group svelte-1ymk2z3")},m(Po,Mo){insert$1(Po,ue,Mo),append$2(ue,eo),append$2(eo,no),append$2(no,ro),append$2(ro,io),append$2(no,so),append$2(no,ao),mount_component(lo,ao,null),append$2(no,uo),append$2(no,co),append$2(co,fo),append$2(co,po),append$2(co,mo),append$2(eo,_o),append$2(eo,ho),mount_component(go,ho,null),append$2(ho,bo),mount_component(vo,ho,null),append$2(ue,$o),append$2(ue,wo);for(let Uo=0;Uo<Lo.length;Uo+=1)Lo[Uo]&&Lo[Uo].m(wo,null);append$2(ue,ko),So=!0},p(Po,Mo){var Vo;to=Po,(!So||Mo[0]&2048)&&oo!==(oo=to[21](to[54],to[11].logicalOperator)+"")&&set_data(io,oo);const Uo={};if(Mo[0]&2048&&(Uo.value=(Vo=to[52])==null?void 0:Vo.logicalOperator),lo.$set(Uo),(!So||Mo[0]&16)&&set_data(po,to[4]),Mo[0]&14426069){Eo=ensure_array_like(to[52].filters);let Wo;for(Wo=0;Wo<Eo.length;Wo+=1){const Zo=get_each_context_1$z(to,Eo,Wo);Lo[Wo]?(Lo[Wo].p(Zo,Mo),transition_in(Lo[Wo],1)):(Lo[Wo]=create_each_block_1$z(Zo),Lo[Wo].c(),transition_in(Lo[Wo],1),Lo[Wo].m(wo,null))}for(group_outros(),Wo=Eo.length;Wo<Lo.length;Wo+=1)No(Wo);check_outros()}},i(Po){if(!So){transition_in(lo.$$.fragment,Po),transition_in(go.$$.fragment,Po),transition_in(vo.$$.fragment,Po);for(let Mo=0;Mo<Eo.length;Mo+=1)transition_in(Lo[Mo]);So=!0}},o(Po){transition_out(lo.$$.fragment,Po),transition_out(go.$$.fragment,Po),transition_out(vo.$$.fragment,Po),Lo=Lo.filter(Boolean);for(let Mo=0;Mo<Lo.length;Mo+=1)transition_out(Lo[Mo]);So=!1},d(Po){Po&&detach(ue),destroy_component(lo),destroy_component(go),destroy_component(vo),destroy_each(Lo,Po)}}}function create_if_block_2$1C(to){var fo;let ue,eo,no,ro,oo,io,so,ao,lo,uo,co;return oo=new Select_1$1({props:{value:(fo=to[11])==null?void 0:fo.onEmptyFilter,options:to[16],getOptionLabel:func_4$6,getOptionValue:func_5$3,placeholder:!1}}),oo.$on("change",to[37]),{c(){ue=element("div"),eo=element("span"),eo.textContent="Return",no=space$1(),ro=element("span"),create_component(oo.$$.fragment),io=space$1(),so=element("span"),ao=text("when all "),lo=text(to[4]),uo=text("s are empty"),attr(ro,"class","empty-filter-picker svelte-1ymk2z3"),attr(ue,"class","empty-filter svelte-1ymk2z3")},m(po,mo){insert$1(po,ue,mo),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),mount_component(oo,ro,null),append$2(ue,io),append$2(ue,so),append$2(so,ao),append$2(so,lo),append$2(so,uo),co=!0},p(po,mo){var ho;const _o={};mo[0]&2048&&(_o.value=(ho=po[11])==null?void 0:ho.onEmptyFilter),oo.$set(_o),(!co||mo[0]&16)&&set_data(lo,po[4])},i(po){co||(transition_in(oo.$$.fragment,po),co=!0)},o(po){transition_out(oo.$$.fragment,po),co=!1},d(po){po&&detach(ue),destroy_component(oo)}}}function create_default_slot_2$32(to){let ue,eo,no;return{c(){ue=text("Add "),eo=text(to[4]),no=text(" group")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&16&&set_data(eo,ro[4])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_if_block_1$2C(to){let ue,eo,no;return eo=new Icon({props:{name:"question",color:"var(--spectrum-global-color-gray-600)"}}),{c(){ue=element("a"),create_component(eo.$$.fragment),attr(ue,"href",to[5]),attr(ue,"target","_blank")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){(!no||oo[0]&32)&&attr(ue,"href",ro[5])},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_1$4g(to){var ao,lo;let ue,eo,no,ro,oo,io=to[1]&&to[3]&&((lo=(ao=to[11])==null?void 0:ao.groups)==null?void 0:lo.length)&&create_if_block_2$1C(to);no=new Button({props:{icon:"plus-circle",size:"M",secondary:!0,$$slots:{default:[create_default_slot_2$32]},$$scope:{ctx:to}}}),no.$on("click",to[38]);let so=to[5]&&create_if_block_1$2C(to);return{c(){io&&io.c(),ue=space$1(),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),so&&so.c(),attr(eo,"class","add-group svelte-1ymk2z3")},m(uo,co){io&&io.m(uo,co),insert$1(uo,ue,co),insert$1(uo,eo,co),mount_component(no,eo,null),append$2(eo,ro),so&&so.m(eo,null),oo=!0},p(uo,co){var po,mo;uo[1]&&uo[3]&&((mo=(po=uo[11])==null?void 0:po.groups)!=null&&mo.length)?io?(io.p(uo,co),co[0]&2058&&transition_in(io,1)):(io=create_if_block_2$1C(uo),io.c(),transition_in(io,1),io.m(ue.parentNode,ue)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros());const fo={};co[0]&16|co[1]&256&&(fo.$$scope={dirty:co,ctx:uo}),no.$set(fo),uo[5]?so?(so.p(uo,co),co[0]&32&&transition_in(so,1)):(so=create_if_block_1$2C(uo),so.c(),transition_in(so,1),so.m(eo,null)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(uo){oo||(transition_in(io),transition_in(no.$$.fragment,uo),transition_in(so),oo=!0)},o(uo){transition_out(io),transition_out(no.$$.fragment,uo),transition_out(so),oo=!1},d(uo){uo&&(detach(ue),detach(eo)),io&&io.d(uo),destroy_component(no),so&&so.d()}}}function create_default_slot$6f(to){let ue,eo,no,ro;const oo=[create_if_block$4G,create_else_block_1$t],io=[];function so(ao,lo){var uo;return(uo=ao[12])!=null&&uo.length?0:1}return ue=so(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$4()},m(ao,lo){io[ue].m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){let uo=ue;ue=so(ao),ue===uo?io[ue].p(ao,lo):(group_outros(),transition_out(io[uo],1,1,()=>{io[uo]=null}),check_outros(),eo=io[ue],eo?eo.p(ao,lo):(eo=io[ue]=oo[ue](ao),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(ao){ro||(transition_in(eo),ro=!0)},o(ao){transition_out(eo),ro=!1},d(ao){ao&&detach(no),io[ue].d(ao)}}}function create_fragment$9_(to){let ue,eo,no;return eo=new Layout$o({props:{noPadding:!0,$$slots:{default:[create_default_slot$6f]},$$scope:{ctx:to}}}),{c(){var ro,oo;ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","container svelte-1ymk2z3"),toggle_class(ue,"mobile",(oo=(ro=to[14])==null?void 0:ro.device)==null?void 0:oo.mobile)},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){var so,ao;const io={};oo[0]&16383|oo[1]&256&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io),(!no||oo[0]&16384)&&toggle_class(ue,"mobile",(ao=(so=ro[14])==null?void 0:so.device)==null?void 0:ao.mobile)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}const func$R=to=>to.label,func_1$E=to=>to.value,func_2$6=to=>to.label,func_3$3=to=>to.value,func_4$6=to=>to.label,func_5$3=to=>to.value;function instance$a1(to,ue,eo){let no,ro,oo,io,{$$slots:so={},$$scope:ao}=ue;const lo=createEventDispatcher(),{OperatorOptions:uo,DEFAULT_BB_DATASOURCE_ID:co,FilterOperator:fo,OnEmptyFilter:po,FilterValueType:mo}=Constants$1;let{schemaFields:_o}=ue,{filters:ho}=ue,{tables:go=[]}=ue,{datasource:bo}=ue,{behaviourFilters:vo=!1}=ue,{allowBindings:$o=!1}=ue,{allowOnEmpty:wo=!0}=ue,{builderType:ko="filter"}=ue,{docsURL:So="https://docs.budibase.com/docs/searchfilter-data"}=ue,{bindings:To}=ue,{panel:Io}=ue,{toReadable:Ao}=ue,{toRuntime:Eo}=ue,{evaluationContext:Lo={}}=ue;const No=Cs=>Array.isArray(Cs)?processSearchFilters(Cs):cloneDeep(Cs),Do=Object.values(fo).map(Cs=>({value:Cs,label:capitalise$1(Cs)})),Po={[po.RETURN_ALL]:"All rows",[po.RETURN_NONE]:"No rows"},Mo=Object.values(po).map(Cs=>({value:Cs,label:Po[Cs]})),Uo=getContext$1("context");component_subscribe(to,Uo,Cs=>eo(14,io=Cs));const Vo=Cs=>{const da=Cs.type;xo(Cs),Go(Cs),Xo(Cs,da)},Wo=Cs=>{Go(Cs),Xo(Cs,Cs.type)},Zo=Cs=>_o.find(da=>da.name===Cs.field),Yo=Cs=>ko==="condition"?[uo.Equals,uo.NotEquals]:!(Cs!=null&&Cs.field)&&!(Cs!=null&&Cs.name)?[]:getValidOperatorsForType(Cs,Cs.field||Cs.name,bo),xo=Cs=>{var Es;const da=_o.find(gs=>gs.name===Cs.field);Cs.type=da==null?void 0:da.type,Cs.subtype=da==null?void 0:da.subtype,Cs.formulaType=da==null?void 0:da.formulaType,Cs.constraints=da==null?void 0:da.constraints,Cs.externalType=(Es=Zo(Cs))==null?void 0:Es.externalType},Go=Cs=>{const da=Yo(Cs).map(gs=>gs.value);da.includes(Cs.operator)||(Cs.operator=da[0]??uo.Equals.value);const Es=[uo.Empty.value,uo.NotEmpty.value];Cs.noValue=Es.includes(Cs.operator)},Xo=(Cs,da)=>{if(Cs.noValue){Cs.value=null;return}Array.isArray(Cs.value)?(Cs.valueType!=="Value"||Cs.type!==FieldType.ARRAY)&&(Cs.value=null):Cs.type===FieldType.ARRAY&&Cs.valueType==="Value"?Cs.value=[]:da!==Cs.type&&(da===FieldType.BB_REFERENCE||Cs.type===FieldType.BB_REFERENCE)&&(Cs.value=Cs.type===FieldType.ARRAY?[]:null)},as=Cs=>Cs==0?"When":{[fo.ANY]:"or",[fo.ALL]:"and"}[no.logicalOperator],Ko=(Cs,da,Es)=>{const gs=cloneDeep(Cs);ls({groupIdx:da,filterIdx:Es,filter:{...gs}})},ls=Cs=>{var ca,ra,ta;const{groupIdx:da,filterIdx:Es,filter:gs,group:Ts,addFilter:ws,addGroup:bs,deleteGroup:Us,deleteFilter:qs,logicalOperator:Ys,onEmptyFilter:Ks}=Cs;let Xs=cloneDeep(no),Vs=(ca=Xs==null?void 0:Xs.groups)==null?void 0:ca[da];((ra=Vs==null?void 0:Vs.filters)==null?void 0:ra[Es])?qs?(Vs.filters.splice(Es,1),Vs.filters.length===0&&Xs.groups.splice(da,1)):gs&&(Vs.filters[Es]=gs):Vs?Us?Xs.groups.splice(da,1):ws?Vs.filters.push({valueType:mo.VALUE,...ko==="condition"?{operator:uo.Equals.value,type:FieldType.STRING}:{}}):Ts&&(Xs.groups[da]={...Vs,...Ts}):bs?((ta=Xs==null?void 0:Xs.groups)!=null&&ta.length||(Xs={logicalOperator:UILogicalOperator.ALL,onEmptyFilter:EmptyFilterOption.RETURN_NONE,groups:[]}),Xs.groups.push({logicalOperator:FilterOperator.ANY,filters:[{valueType:mo.VALUE,...ko==="condition"?{operator:uo.Equals.value}:{}}]})):Ys?Xs={...Xs,logicalOperator:Ys}:Ks&&(Xs={...Xs,onEmptyFilter:Ks}),Xs=Xs.groups.length?Xs:null,lo("change",Xs)},Jo=Cs=>{ls({logicalOperator:Cs.detail})},hs=(Cs,da)=>{ls({groupIdx:Cs,group:{logicalOperator:da.detail}})},ks=Cs=>{ls({groupIdx:Cs,addFilter:!0})},cs=Cs=>{ls({groupIdx:Cs,deleteGroup:!0})},_s=(Cs,da,Es,gs)=>{const Ts={...Cs,field:gs.detail};Vo(Ts),Ko(Ts,da,Es)},Is=(Cs,da,Es,gs)=>{const Ts={...Cs,field:gs.detail.field};Ko(Ts,da,Es)},Bs=(Cs,da,Es,gs)=>{const Ts={...Cs,operator:gs.detail};Wo(Ts),Ko(Ts,da,Es)},Hs=(Cs,da,Es,gs)=>{Ko({...Cs,...gs.detail},da,Es)},Rs=(Cs,da)=>{ls({groupIdx:Cs,filterIdx:da,deleteFilter:!0})},Ds=Cs=>{ls({onEmptyFilter:Cs.detail})},Js=()=>{ls({addGroup:!0})};return to.$$set=Cs=>{"schemaFields"in Cs&&eo(0,_o=Cs.schemaFields),"filters"in Cs&&eo(24,ho=Cs.filters),"tables"in Cs&&eo(25,go=Cs.tables),"datasource"in Cs&&eo(26,bo=Cs.datasource),"behaviourFilters"in Cs&&eo(1,vo=Cs.behaviourFilters),"allowBindings"in Cs&&eo(2,$o=Cs.allowBindings),"allowOnEmpty"in Cs&&eo(3,wo=Cs.allowOnEmpty),"builderType"in Cs&&eo(4,ko=Cs.builderType),"docsURL"in Cs&&eo(5,So=Cs.docsURL),"bindings"in Cs&&eo(6,To=Cs.bindings),"panel"in Cs&&eo(7,Io=Cs.panel),"toReadable"in Cs&&eo(8,Ao=Cs.toReadable),"toRuntime"in Cs&&eo(9,Eo=Cs.toRuntime),"evaluationContext"in Cs&&eo(10,Lo=Cs.evaluationContext),"$$scope"in Cs&&eo(39,ao=Cs.$$scope)},to.$$.update=()=>{to.$$.dirty[0]&16777216&&eo(11,no=No(ho)),to.$$.dirty[0]&100663297&&go.find(Cs=>Cs._id===(bo==null?void 0:bo.tableId)&&Cs.sourceId===co)&&!_o.some(Cs=>Cs.name==="_id")&&eo(0,_o=[..._o,{name:"_id",type:"string"}]),to.$$.dirty[0]&16&&eo(13,ro=ko==="filter"?"Show data which matches":"Run branch when matching"),to.$$.dirty[0]&1&&eo(12,oo=(_o||[]).filter(Cs=>!Cs.calculationType).map(Cs=>({label:Cs.displayName||Cs.name,value:Cs.name})))},[_o,vo,$o,wo,ko,So,To,Io,Ao,Eo,Lo,no,oo,ro,io,Do,Mo,Uo,Vo,Wo,Yo,as,Ko,ls,ho,go,bo,so,Jo,hs,ks,cs,_s,Is,Bs,Hs,Rs,Ds,Js,ao]}class CoreFilterBuilder extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a1,create_fragment$9_,safe_not_equal,{schemaFields:0,filters:24,tables:25,datasource:26,behaviourFilters:1,allowBindings:2,allowOnEmpty:3,builderType:4,docsURL:5,bindings:6,panel:7,toReadable:8,toRuntime:9,evaluationContext:10},null,[-1,-1])}}function create_default_slot$6e(to){let ue,eo,no,ro,oo,io;function so(co){to[15](co)}let ao={label:"Password",type:"password",error:to[1]};to[3]!==void 0&&(ao.value=to[3]),ue=new FancyInput({props:ao}),binding_callbacks.push(()=>bind$2(ue,"value",so));function lo(co){to[16](co)}let uo={label:"Repeat password",type:"password",error:to[4]&&to[3]!==to[2]&&"Passwords must match"};return to[2]!==void 0&&(uo.value=to[2]),ro=new FancyInput({props:uo}),binding_callbacks.push(()=>bind$2(ro,"value",lo)),{c(){create_component(ue.$$.fragment),no=space$1(),create_component(ro.$$.fragment)},m(co,fo){mount_component(ue,co,fo),insert$1(co,no,fo),mount_component(ro,co,fo),io=!0},p(co,fo){const po={};fo&2&&(po.error=co[1]),!eo&&fo&8&&(eo=!0,po.value=co[3],add_flush_callback(()=>eo=!1)),ue.$set(po);const mo={};fo&28&&(mo.error=co[4]&&co[3]!==co[2]&&"Passwords must match"),!oo&&fo&4&&(oo=!0,mo.value=co[2],add_flush_callback(()=>oo=!1)),ro.$set(mo)},i(co){io||(transition_in(ue.$$.fragment,co),transition_in(ro.$$.fragment,co),io=!0)},o(co){transition_out(ue.$$.fragment,co),transition_out(ro.$$.fragment,co),io=!1},d(co){co&&detach(no),destroy_component(ue,co),destroy_component(ro,co)}}}function create_fragment$9Z(to){let ue,eo,no={$$slots:{default:[create_default_slot$6e]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[17](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&1048606&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[17](null),destroy_component(ue,ro)}}}function instance$a0(to,ue,eo){let no,ro,oo,io,so,ao,{passwordForm:lo=void 0}=ue,{password:uo}=ue,{error:co}=ue,{minLength:fo="12"}=ue;const po=So=>!So||So.length<parseInt(fo)?`Please enter at least ${fo} characters. We recommend using machine generated or random passwords.`:null,[mo,_o,ho]=createValidationStore$1("",requiredValidator);component_subscribe(to,mo,So=>eo(3,oo=So)),component_subscribe(to,_o,So=>eo(14,ao=So)),component_subscribe(to,ho,So=>eo(13,so=So));const[go,bo,vo]=createValidationStore$1("",requiredValidator,po);component_subscribe(to,go,So=>eo(2,ro=So)),component_subscribe(to,vo,So=>eo(4,io=So));function $o(So){oo=So,mo.set(oo)}function wo(So){ro=So,go.set(ro)}function ko(So){binding_callbacks[So?"unshift":"push"](()=>{lo=So,eo(0,lo)})}return to.$$set=So=>{"passwordForm"in So&&eo(0,lo=So.passwordForm),"password"in So&&eo(10,uo=So.password),"error"in So&&eo(11,co=So.error),"minLength"in So&&eo(12,fo=So.minLength)},to.$$.update=()=>{to.$$.dirty&8&&eo(10,uo=oo),to.$$.dirty&25616&&eo(1,no=so&&ao||io&&po(uo)),to.$$.dirty&8222&&eo(11,co=!oo||!so||!io||oo!==ro||no)},[lo,no,ro,oo,io,mo,_o,ho,go,vo,uo,co,fo,so,ao,$o,wo,ko]}class PasswordRepeatInput extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a0,create_fragment$9Z,safe_not_equal,{passwordForm:0,password:10,error:11,minLength:12})}}function create_default_slot_1$4f(to){let ue;return{c(){ue=text("Enter your new password below.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$6d(to){let ue,eo,no,ro,oo,io;ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_1$4f]},$$scope:{ctx:to}}});function so(uo){to[8](uo)}function ao(uo){to[9](uo)}let lo={minLength:to[0]};return to[1]!==void 0&&(lo.password=to[1]),to[2]!==void 0&&(lo.error=to[2]),no=new PasswordRepeatInput({props:lo}),binding_callbacks.push(()=>bind$2(no,"password",so)),binding_callbacks.push(()=>bind$2(no,"error",ao)),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(uo,co){mount_component(ue,uo,co),insert$1(uo,eo,co),mount_component(no,uo,co),io=!0},p(uo,co){const fo={};co&2048&&(fo.$$scope={dirty:co,ctx:uo}),ue.$set(fo);const po={};co&1&&(po.minLength=uo[0]),!ro&&co&2&&(ro=!0,po.password=uo[1],add_flush_callback(()=>ro=!1)),!oo&&co&4&&(oo=!0,po.error=uo[2],add_flush_callback(()=>oo=!1)),no.$set(po)},i(uo){io||(transition_in(ue.$$.fragment,uo),transition_in(no.$$.fragment,uo),io=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(no.$$.fragment,uo),io=!1},d(uo){uo&&detach(eo),destroy_component(ue,uo),destroy_component(no,uo)}}}function create_fragment$9Y(to){let ue,eo,no,ro;return ue=new ModalContent({props:{title:"Update password",confirmText:"Update password",onConfirm:to[3],disabled:!!to[2]||!to[1],$$slots:{default:[create_default_slot$6d]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0,no||(ro=listen(window,"keydown",to[4]),no=!0)},p(oo,[io]){const so={};io&6&&(so.disabled=!!oo[2]||!oo[1]),io&2055&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo),no=!1,ro()}}}function instance$9$(to,ue,eo){let{API:no}=ue,{passwordMinLength:ro=void 0}=ue,{notifySuccess:oo=notifications.success}=ue,{notifyError:io=notifications.error}=ue;const so=createEventDispatcher();let ao="",lo="";const uo=async()=>{try{await no.updateSelf({password:ao}),oo("Password changed successfully"),so("save")}catch{io("Failed to update password")}},co=mo=>{mo.key==="Enter"&&!lo&&ao&&uo()};function fo(mo){ao=mo,eo(1,ao)}function po(mo){lo=mo,eo(2,lo)}return to.$$set=mo=>{"API"in mo&&eo(5,no=mo.API),"passwordMinLength"in mo&&eo(0,ro=mo.passwordMinLength),"notifySuccess"in mo&&eo(6,oo=mo.notifySuccess),"notifyError"in mo&&eo(7,io=mo.notifyError)},[ro,ao,lo,uo,co,no,oo,io,fo,po]}class ChangePasswordModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9$,create_fragment$9Y,safe_not_equal,{API:5,passwordMinLength:0,notifySuccess:6,notifyError:7})}}function create_default_slot_1$4e(to){let ue;return{c(){ue=text("Personalise the platform by adding your first name and last name.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$6c(to){var _o;let ue,eo,no,ro,oo,io,so,ao,lo,uo;ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_1$4e]},$$scope:{ctx:to}}}),no=new Input$5({props:{disabled:!0,value:((_o=to[0])==null?void 0:_o.email)||"",label:"Email"}});function co(ho){to[7](ho)}let fo={label:"First name"};to[1].firstName!==void 0&&(fo.value=to[1].firstName),oo=new Input$5({props:fo}),binding_callbacks.push(()=>bind$2(oo,"value",co));function po(ho){to[8](ho)}let mo={label:"Last name"};return to[1].lastName!==void 0&&(mo.value=to[1].lastName),ao=new Input$5({props:mo}),binding_callbacks.push(()=>bind$2(ao,"value",po)),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),so=space$1(),create_component(ao.$$.fragment)},m(ho,go){mount_component(ue,ho,go),insert$1(ho,eo,go),mount_component(no,ho,go),insert$1(ho,ro,go),mount_component(oo,ho,go),insert$1(ho,so,go),mount_component(ao,ho,go),uo=!0},p(ho,go){var ko;const bo={};go&1024&&(bo.$$scope={dirty:go,ctx:ho}),ue.$set(bo);const vo={};go&1&&(vo.value=((ko=ho[0])==null?void 0:ko.email)||""),no.$set(vo);const $o={};!io&&go&2&&(io=!0,$o.value=ho[1].firstName,add_flush_callback(()=>io=!1)),oo.$set($o);const wo={};!lo&&go&2&&(lo=!0,wo.value=ho[1].lastName,add_flush_callback(()=>lo=!1)),ao.$set(wo)},i(ho){uo||(transition_in(ue.$$.fragment,ho),transition_in(no.$$.fragment,ho),transition_in(oo.$$.fragment,ho),transition_in(ao.$$.fragment,ho),uo=!0)},o(ho){transition_out(ue.$$.fragment,ho),transition_out(no.$$.fragment,ho),transition_out(oo.$$.fragment,ho),transition_out(ao.$$.fragment,ho),uo=!1},d(ho){ho&&(detach(eo),detach(ro),detach(so)),destroy_component(ue,ho),destroy_component(no,ho),destroy_component(oo,ho),destroy_component(ao,ho)}}}function create_fragment$9X(to){let ue,eo;return ue=new ModalContent({props:{title:"My profile",confirmText:"Save",onConfirm:to[3],$$slots:{default:[create_default_slot$6c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&1027&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$9_(to,ue,eo){let no,{user:ro=void 0}=ue,{API:oo}=ue,{notifySuccess:io=notifications.success}=ue,{notifyError:so=notifications.error}=ue;const ao=createEventDispatcher(),lo=writable({firstName:ro==null?void 0:ro.firstName,lastName:ro==null?void 0:ro.lastName});component_subscribe(to,lo,po=>eo(1,no=po));const uo=async()=>{try{await oo.updateSelf(no),io("Information updated successfully"),ao("save")}catch(po){console.error(po),so("Failed to update information")}};function co(po){to.$$.not_equal(no.firstName,po)&&(no.firstName=po,lo.set(no))}function fo(po){to.$$.not_equal(no.lastName,po)&&(no.lastName=po,lo.set(no))}return to.$$set=po=>{"user"in po&&eo(0,ro=po.user),"API"in po&&eo(4,oo=po.API),"notifySuccess"in po&&eo(5,io=po.notifySuccess),"notifyError"in po&&eo(6,so=po.notifyError)},[ro,no,lo,uo,oo,io,so,co,fo]}class ProfileModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9_,create_fragment$9X,safe_not_equal,{user:0,API:4,notifySuccess:5,notifyError:6})}}var PersistenceType=(to=>(to.NONE="none",to.LOCAL="local",to.SESSION="session",to))(PersistenceType||{});class BudiStore{constructor(ue,eo){if(eo!=null&&eo.persistence)switch(eo.persistence.type){case"local":this.store=createLocalStorageStore(eo.persistence.key,ue);break;case"session":this.store=createSessionStorageStore(eo.persistence.key,ue);break;default:this.store=writable(ue)}else this.store=writable(ue);this.subscribe=this.store.subscribe,this.update=this.store.update,this.set=this.store.set,eo!=null&&eo.debug&&this.subscribe(no=>{console.warn(`${this.constructor.name}`,no)})}}class DerivedBudiStore{constructor(ue,eo,no){this.store=new BudiStore(ue,no),this.derivedStore=eo(this.store),this.subscribe=this.derivedStore.subscribe,this.update=this.store.update,this.set=this.store.set}}const INITIAL_LAYOUT_STATE={layouts:[],selectedLayoutId:null};class LayoutStore extends BudiStore{constructor(){super(INITIAL_LAYOUT_STATE),this.reset=this.reset.bind(this),this.syncAppLayouts=this.syncAppLayouts.bind(this),this.select=this.select.bind(this),this.deleteLayout=this.deleteLayout.bind(this)}reset(){this.store.set({...INITIAL_LAYOUT_STATE})}syncAppLayouts(ue){this.update(eo=>({...eo,layouts:[...ue.layouts]}))}select(ue){var oo,io;const eo=get_store_value(this.store),no=get_store_value(componentStore),ro=eo.layouts.find(so=>so._id===ue);ro&&(eo.selectedLayoutId===ro._id&&no.selectedComponentId===((oo=ro.props)==null?void 0:oo._id)||(this.update(so=>(so.selectedLayoutId=ro._id,so)),componentStore.select((io=ro.props)==null?void 0:io._id)))}async deleteLayout(ue){!(ue!=null&&ue._id)||!(ue!=null&&ue._rev)||(await API.deleteLayout(ue._id,ue._rev),this.update(eo=>(eo.layouts=eo.layouts.filter(no=>no._id!==ue._id),eo)))}}const layoutStore=new LayoutStore;derived(layoutStore,to=>{var ue;return(ue=to.layouts)==null?void 0:ue.find(eo=>eo._id===to.selectedLayoutId)});class BaseStructure{constructor(ue,eo){this._isScreen=ue,this._children=[],this._json=eo}addChild(ue){return this._children.push(ue),this}customProps(ue){for(let eo of Object.keys(ue))this._json[eo]=ue[eo];return this}json(){var eo,no;const ue=fp$1.cloneDeep(this._json);if(this._children.length!==0)for(let ro of this._children)this._isScreen?ue.props._children.push(((eo=ro.json)==null?void 0:eo.call(ro))||ro):ue._children.push(((no=ro.json)==null?void 0:no.call(ro))||ro);return ue}}let Screen$1=class extends BaseStructure{constructor(ue){super(!0,{showNavigation:!0,width:"Large",props:{_id:uuid$1(),_component:"@budibase/standard-components/container",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"",layout:"flex",direction:"column",hAlign:"stretch",vAlign:"top",size:"grow",gap:"M"},routing:{route:"",roleId:"BASIC",homeScreen:!1},name:"screen-id",workspaceAppId:ue})}role(ue){return this._json.routing.roleId=ue,this}normalStyle(ue){return this._json.props._styles.normal=ue,this}component(ue){return this._json.props._component=ue,this}table(ue){return this._json.props.table=ue,this}route(ue){return this._json.routing.route=ue,this}name(ue){return this._json.name=ue,this}autoTableId(ue){return this._json.autoTableId=ue,this}instanceName(ue){return this._json.props._instanceName=ue,this}customProps(ue){for(let eo of Object.keys(ue))this._json.props[eo]=ue[eo];return this}};class PDFScreen extends Screen$1{constructor(ue){super(ue),this._json.variant=ScreenVariant.PDF,this._json.width="Max",this._json.showNavigation=!1,this._json.props={_id:uuid$1(),_component:"@budibase/standard-components/pdf",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"PDF",title:"PDF"}}}const capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:so,...ao}=get_store_value(this.store),lo={...ao,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return notifications.error("Error fetching user"),null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;function e(to,ue){var eo=Object.keys(to);if(Object.getOwnPropertySymbols){var no=Object.getOwnPropertySymbols(to);ue&&(no=no.filter(function(ro){return Object.getOwnPropertyDescriptor(to,ro).enumerable})),eo.push.apply(eo,no)}return eo}function t$1(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue]!=null?arguments[ue]:{};ue%2?e(Object(eo),!0).forEach(function(no){o(to,no,eo[no])}):Object.getOwnPropertyDescriptors?Object.defineProperties(to,Object.getOwnPropertyDescriptors(eo)):e(Object(eo)).forEach(function(no){Object.defineProperty(to,no,Object.getOwnPropertyDescriptor(eo,no))})}return to}function n(to){return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ue){return typeof ue}:function(ue){return ue&&typeof Symbol=="function"&&ue.constructor===Symbol&&ue!==Symbol.prototype?"symbol":typeof ue},n(to)}function i$2(to,ue){if(!(to instanceof ue))throw new TypeError("Cannot call a class as a function")}function r(to,ue){for(var eo=0;eo<ue.length;eo++){var no=ue[eo];no.enumerable=no.enumerable||!1,no.configurable=!0,"value"in no&&(no.writable=!0),Object.defineProperty(to,no.key,no)}}function s(to,ue,eo){return ue&&r(to.prototype,ue),eo&&r(to,eo),Object.defineProperty(to,"prototype",{writable:!1}),to}function o(to,ue,eo){return ue in to?Object.defineProperty(to,ue,{value:eo,enumerable:!0,configurable:!0,writable:!0}):to[ue]=eo,to}function a(to,ue){if(to==null)return{};var eo,no,ro=function(io,so){if(io==null)return{};var ao,lo,uo={},co=Object.keys(io);for(lo=0;lo<co.length;lo++)ao=co[lo],so.indexOf(ao)>=0||(uo[ao]=io[ao]);return uo}(to,ue);if(Object.getOwnPropertySymbols){var oo=Object.getOwnPropertySymbols(to);for(no=0;no<oo.length;no++)eo=oo[no],ue.indexOf(eo)>=0||Object.prototype.propertyIsEnumerable.call(to,eo)&&(ro[eo]=to[eo])}return ro}function u(to,ue){return function(eo){if(Array.isArray(eo))return eo}(to)||function(eo,no){var ro=eo==null?null:typeof Symbol<"u"&&eo[Symbol.iterator]||eo["@@iterator"];if(ro!=null){var oo,io,so=[],ao=!0,lo=!1;try{for(ro=ro.call(eo);!(ao=(oo=ro.next()).done)&&(so.push(oo.value),!no||so.length!==no);ao=!0);}catch(uo){lo=!0,io=uo}finally{try{ao||ro.return==null||ro.return()}finally{if(lo)throw io}}return so}}(to,ue)||c(to,ue)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
552
552
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function l(to){return function(ue){if(Array.isArray(ue))return d(ue)}(to)||function(ue){if(typeof Symbol<"u"&&ue[Symbol.iterator]!=null||ue["@@iterator"]!=null)return Array.from(ue)}(to)||c(to)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
553
553
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(to,ue){if(to){if(typeof to=="string")return d(to,ue);var eo=Object.prototype.toString.call(to).slice(8,-1);return eo==="Object"&&to.constructor&&(eo=to.constructor.name),eo==="Map"||eo==="Set"?Array.from(to):eo==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(eo)?d(to,ue):void 0}}function d(to,ue){(ue==null||ue>to.length)&&(ue=to.length);for(var eo=0,no=new Array(ue);eo<ue;eo++)no[eo]=to[eo];return no}function h(to,ue){var eo=typeof Symbol<"u"&&to[Symbol.iterator]||to["@@iterator"];if(!eo){if(Array.isArray(to)||(eo=c(to))||ue&&to&&typeof to.length=="number"){eo&&(to=eo);var no=0,ro=function(){};return{s:ro,n:function(){return no>=to.length?{done:!0}:{done:!1,value:to[no++]}},e:function(ao){throw ao},f:ro}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
554
554
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var oo,io=!0,so=!1;return{s:function(){eo=eo.call(to)},n:function(){var ao=eo.next();return io=ao.done,ao},e:function(ao){so=!0,oo=ao},f:function(){try{io||eo.return==null||eo.return()}finally{if(so)throw oo}}}}var f={DEBUG:!1,LIB_VERSION:"1.160.0"},v=Array.isArray,p=Object.prototype,g=p.hasOwnProperty,_=p.toString,m=v||function(to){return _.call(to)==="[object Array]"},y=function(to){return typeof to=="function"},b=function(to){return to===Object(to)&&!m(to)},k=function(to){if(b(to)){for(var ue in to)if(g.call(to,ue))return!1;return!0}return!1},w=function(to){return to===void 0},S=function(to){return _.call(to)=="[object String]"},E=function(to){return S(to)&&to.trim().length===0},I=function(to){return to===null},R=function(to){return w(to)||I(to)},F=function(to){return _.call(to)=="[object Number]"},x$1=function(to){return _.call(to)==="[object Boolean]"},P=function(to){return to instanceof FormData},T=typeof window<"u"?window:void 0,C$1=typeof globalThis<"u"?globalThis:T,$=Array.prototype,O=$.forEach,M=$.indexOf,A=C$1==null?void 0:C$1.navigator,L=C$1==null?void 0:C$1.document,D=C$1==null?void 0:C$1.location,q=C$1==null?void 0:C$1.fetch,N=C$1!=null&&C$1.XMLHttpRequest&&"withCredentials"in new C$1.XMLHttpRequest?C$1.XMLHttpRequest:void 0,B=C$1==null?void 0:C$1.AbortController,H=A==null?void 0:A.userAgent,U=T??{},j="[PostHog.js]",G={_log:function(to){if(T&&(f.DEBUG||U.POSTHOG_DEBUG)&&!w(T.console)&&T.console){for(var ue=("__rrweb_original__"in T.console[to])?T.console[to].__rrweb_original__:T.console[to],eo=arguments.length,no=new Array(eo>1?eo-1:0),ro=1;ro<eo;ro++)no[ro-1]=arguments[ro];ue.apply(void 0,[j].concat(no))}},info:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["log"].concat(ue))},warn:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["warn"].concat(ue))},error:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["error"].concat(ue))},critical:function(){for(var to,ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];(to=console).error.apply(to,[j].concat(eo))},uninitializedWarning:function(to){G.error("You must initialize PostHog before calling ".concat(to))}},W={},V=function(to){return to.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function z(to,ue,eo){if(m(to)){if(O&&to.forEach===O)to.forEach(ue,eo);else if("length"in to&&to.length===+to.length){for(var no=0,ro=to.length;no<ro;no++)if(no in to&&ue.call(eo,to[no],no)===W)return}}}function Q(to,ue,eo){if(!R(to)){if(m(to))return z(to,ue,eo);if(P(to)){var no,ro=h(to.entries());try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(ue.call(eo,oo[1],oo[0])===W)return}}catch(so){ro.e(so)}finally{ro.f()}}else for(var io in to)if(g.call(to,io)&&ue.call(eo,to[io],io)===W)return}}var J=function(to){for(var ue=arguments.length,eo=new Array(ue>1?ue-1:0),no=1;no<ue;no++)eo[no-1]=arguments[no];return z(eo,function(ro){for(var oo in ro)ro[oo]!==void 0&&(to[oo]=ro[oo])}),to};function Y(to,ue){return to.indexOf(ue)!==-1}function X(to){for(var ue=Object.keys(to),eo=ue.length,no=new Array(eo);eo--;)no[eo]=[ue[eo],to[ue[eo]]];return no}var K=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Z=function(to){try{return to()}catch{return}},ee=function(to){return function(){try{for(var ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];return to.apply(this,eo)}catch(ro){G.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),G.critical(ro)}}},te=function(to){var ue={};return Q(to,function(eo,no){S(eo)&&eo.length>0&&(ue[no]=eo)}),ue},ne=function(to){return to.replace(/^\$/,"")};function ie$2(to,ue){return eo=to,no=function(oo){return S(oo)&&!I(ue)?oo.slice(0,ue):oo},ro=new Set,function oo(io,so){return io!==Object(io)?no?no(io,so):io:ro.has(io)?void 0:(ro.add(io),m(io)?(ao=[],z(io,function(lo){ao.push(oo(lo))})):(ao={},Q(io,function(lo,uo){ro.has(lo)||(ao[uo]=oo(lo,uo))})),ao);var ao}(eo);var eo,no,ro}var re,se=function(to){var ue,eo,no,ro,oo="";for(ue=eo=0,no=(to=(to+"").replace(/\r\n/g,`
|
|
@@ -1185,7 +1185,7 @@ ${(Ea=Aa.toolCall)==null?void 0:Ea.arguments}
|
|
|
1185
1185
|
list of apps that you have access to.`)},m(oo,io){insert$1(oo,ue,io),insert$1(oo,no,io),insert$1(oo,ro,io)},p(oo,io){io&128&&eo!==(eo=oo[7].company+"")&&set_data(no,eo)},d(oo){oo&&(detach(ue),detach(no),detach(ro))}}}function create_default_slot_13$7(to){let ue,eo,no,ro;return ue=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_15$5]},$$scope:{ctx:to}}}),no=new Body({props:{$$slots:{default:[create_default_slot_14$5]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&268435457&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&268435584&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_else_block_1$7(to){let ue,eo;return ue=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_10$d]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&268435456&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_2$l(to){let ue,eo,no,ro,oo;return ue=new Heading({props:{$$slots:{default:[create_default_slot_9$f]},$$scope:{ctx:to}}}),ro=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_6$q]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),no=element("div"),create_component(ro.$$.fragment),attr(no,"class","group")},m(io,so){mount_component(ue,io,so),insert$1(io,eo,so),insert$1(io,no,so),mount_component(ro,no,null),oo=!0},p(io,so){const ao={};so&268435456&&(ao.$$scope={dirty:so,ctx:io}),ue.$set(ao);const lo={};so&268435520&&(lo.$$scope={dirty:so,ctx:io}),ro.$set(lo)},i(io){oo||(transition_in(ue.$$.fragment,io),transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(ue.$$.fragment,io),transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&(detach(eo),detach(no)),destroy_component(ue,io),destroy_component(ro)}}}function create_if_block_1$C(to){let ue,eo,no;return eo=new Layout$o({props:{gap:"S",justifyItems:"center",$$slots:{default:[create_default_slot_4$x]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&268435456&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_12$9(to){let ue;return{c(){ue=text("You don't have access to any apps yet.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_11$c(to){let ue;return{c(){ue=text("The apps you have access to will be listed here.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_10$d(to){let ue,eo,no,ro;return ue=new Heading({props:{size:"S",$$slots:{default:[create_default_slot_12$9]},$$scope:{ctx:to}}}),no=new Body({props:{size:"S",$$slots:{default:[create_default_slot_11$c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&268435456&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&268435456&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_9$f(to){let ue;return{c(){ue=text("Apps")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_8$i(to){let ue=to[25].name+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&64&&ue!==(ue=no[25].name+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_else_block$o(to){let ue;return{c(){ue=text("Never updated")},m(eo,no){insert$1(eo,ue,no)},p:noop$5,d(eo){eo&&detach(ue)}}}function create_if_block_3$c(to){let ue=processStringSync("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(to[25].updatedAt).getTime()})+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&64&&ue!==(ue=processStringSync("Updated {{ duration time 'millisecond' }} ago",{time:new Date().getTime()-new Date(no[25].updatedAt).getTime()})+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_7$o(to){let ue;function eo(oo,io){return oo[25].updatedAt?create_if_block_3$c:create_else_block$o}let no=eo(to),ro=no(to);return{c(){ro.c(),ue=empty$4()},m(oo,io){ro.m(oo,io),insert$1(oo,ue,io)},p(oo,io){no===(no=eo(oo))&&ro?ro.p(oo,io):(ro.d(1),ro=no(oo),ro&&(ro.c(),ro.m(ue.parentNode,ue)))},d(oo){oo&&detach(ue),ro.d(oo)}}}function create_each_block$m(to,ue){let eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o,ho;return so=new Heading({props:{size:"XS",$$slots:{default:[create_default_slot_8$i]},$$scope:{ctx:ue}}}),lo=new Body({props:{size:"S",$$slots:{default:[create_default_slot_7$o]},$$scope:{ctx:ue}}}),co=new Icon({props:{name:"caret-right"}}),{key:to,first:null,c(){eo=element("a"),no=element("div"),oo=space$1(),io=element("div"),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),create_component(co.$$.fragment),fo=space$1(),attr(no,"class","preview svelte-1iip7rp"),attr(io,"class","app-info"),attr(eo,"class","app svelte-1iip7rp"),attr(eo,"target","_blank"),attr(eo,"rel","noreferrer"),attr(eo,"href",po=getUrl(ue[25])),this.first=eo},m(go,bo){insert$1(go,eo,bo),append$2(eo,no),append$2(eo,oo),append$2(eo,io),mount_component(so,io,null),append$2(io,ao),mount_component(lo,io,null),append$2(eo,uo),mount_component(co,eo,null),append$2(eo,fo),mo=!0,_o||(ho=action_destroyer(ro=gradient.call(null,no,{seed:ue[25].name})),_o=!0)},p(go,bo){ue=go,ro&&is_function(ro.update)&&bo&64&&ro.update.call(null,{seed:ue[25].name});const vo={};bo&268435520&&(vo.$$scope={dirty:bo,ctx:ue}),so.$set(vo);const $o={};bo&268435520&&($o.$$scope={dirty:bo,ctx:ue}),lo.$set($o),(!mo||bo&64&&po!==(po=getUrl(ue[25])))&&attr(eo,"href",po)},i(go){mo||(transition_in(so.$$.fragment,go),transition_in(lo.$$.fragment,go),transition_in(co.$$.fragment,go),mo=!0)},o(go){transition_out(so.$$.fragment,go),transition_out(lo.$$.fragment,go),transition_out(co.$$.fragment,go),mo=!1},d(go){go&&detach(eo),destroy_component(so),destroy_component(lo),destroy_component(co),_o=!1,ho()}}}function create_default_slot_6$q(to){let ue=[],eo=new Map,no,ro,oo=ensure_array_like(to[6]);const io=so=>so[25].appId;for(let so=0;so<oo.length;so+=1){let ao=get_each_context$m(to,oo,so),lo=io(ao);eo.set(lo,ue[so]=create_each_block$m(lo,ao))}return{c(){for(let so=0;so<ue.length;so+=1)ue[so].c();no=empty$4()},m(so,ao){for(let lo=0;lo<ue.length;lo+=1)ue[lo]&&ue[lo].m(so,ao);insert$1(so,no,ao),ro=!0},p(so,ao){ao&64&&(oo=ensure_array_like(so[6]),group_outros(),ue=update_keyed_each(ue,ao,io,1,so,oo,eo,no.parentNode,outro_and_destroy_block,create_each_block$m,no,get_each_context$m),check_outros())},i(so){if(!ro){for(let ao=0;ao<oo.length;ao+=1)transition_in(ue[ao]);ro=!0}},o(so){for(let ao=0;ao<ue.length;ao+=1)transition_out(ue[ao]);ro=!1},d(so){so&&detach(no);for(let ao=0;ao<ue.length;ao+=1)ue[ao].d(so)}}}function create_default_slot_5$u(to){let ue="Your apps are currently offline.",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p:noop$5,d(no){no&&detach(eo)}}}function create_default_slot_4$x(to){let ue,eo,no,ro,oo,io;return ro=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_5$u]},$$scope:{ctx:to}}}),{c(){ue=element("img"),no=space$1(),create_component(ro.$$.fragment),oo=text(`
|
|
1186
1186
|
Please contact the account holder to get them back online.`),attr(ue,"class","spaceman svelte-1iip7rp"),attr(ue,"alt","spaceman"),src_url_equal(ue.src,eo=Logo)||attr(ue,"src",eo)},m(so,ao){insert$1(so,ue,ao),insert$1(so,no,ao),mount_component(ro,so,ao),insert$1(so,oo,ao),io=!0},p(so,ao){const lo={};ao&268435456&&(lo.$$scope={dirty:ao,ctx:so}),ro.$set(lo)},i(so){io||(transition_in(ro.$$.fragment,so),io=!0)},o(so){transition_out(ro.$$.fragment,so),io=!1},d(so){so&&(detach(ue),detach(no),detach(oo)),destroy_component(ro,so)}}}function create_default_slot_3$K(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo;oo=new ActionMenu({props:{align:"right",$$slots:{control:[create_control_slot$2],default:[create_default_slot_16$5]},$$scope:{ctx:to}}}),so=new Layout$o({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_13$7]},$$scope:{ctx:to}}}),lo=new Divider({});const _o=[create_if_block_1$C,create_if_block_2$l,create_else_block_1$7],ho=[];function go(bo,vo){return bo[9].errUserLimit?0:bo[6].length?1:2}return co=go(to),fo=ho[co]=_o[co](to),{c(){ue=element("div"),eo=element("img"),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),fo.c(),po=empty$4(),attr(eo,"class","logo svelte-1iip7rp"),attr(eo,"alt","logo"),src_url_equal(eo.src,no=to[7].logoUrl||Logo$1)||attr(eo,"src",no),attr(ue,"class","header svelte-1iip7rp")},m(bo,vo){insert$1(bo,ue,vo),append$2(ue,eo),append$2(ue,ro),mount_component(oo,ue,null),insert$1(bo,io,vo),mount_component(so,bo,vo),insert$1(bo,ao,vo),mount_component(lo,bo,vo),insert$1(bo,uo,vo),ho[co].m(bo,vo),insert$1(bo,po,vo),mo=!0},p(bo,vo){(!mo||vo&128&&!src_url_equal(eo.src,no=bo[7].logoUrl||Logo$1))&&attr(eo,"src",no);const $o={};vo&268435771&&($o.$$scope={dirty:vo,ctx:bo}),oo.$set($o);const wo={};vo&268435585&&(wo.$$scope={dirty:vo,ctx:bo}),so.$set(wo);let ko=co;co=go(bo),co===ko?ho[co].p(bo,vo):(group_outros(),transition_out(ho[ko],1,1,()=>{ho[ko]=null}),check_outros(),fo=ho[co],fo?fo.p(bo,vo):(fo=ho[co]=_o[co](bo),fo.c()),transition_in(fo,1),fo.m(po.parentNode,po))},i(bo){mo||(transition_in(oo.$$.fragment,bo),transition_in(so.$$.fragment,bo),transition_in(lo.$$.fragment,bo),transition_in(fo),mo=!0)},o(bo){transition_out(oo.$$.fragment,bo),transition_out(so.$$.fragment,bo),transition_out(lo.$$.fragment,bo),transition_out(fo),mo=!1},d(bo){bo&&(detach(ue),detach(io),detach(ao),detach(uo),detach(po)),destroy_component(oo),destroy_component(so,bo),destroy_component(lo,bo),ho[co].d(bo)}}}function create_default_slot_2$T(to){let ue,eo,no;return eo=new Layout$o({props:{noPadding:!0,$$slots:{default:[create_default_slot_3$K]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","content svelte-1iip7rp")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&268436475&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_1$17(to){let ue,eo;return ue=new ProfileModal({props:{API,user:to[0].user}}),ue.$on("save",to[20]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.user=no[0].user),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1k(to){let ue,eo;return ue=new ChangePasswordModal({props:{API,passwordMinLength:to[1].passwordMinLength}}),ue.$on("save",to[22]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2&&(oo.passwordMinLength=no[1].passwordMinLength),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1W(to){let ue,eo,no=to[0].user&&to[2]&&create_if_block$14(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0].user&&ro[2]?no?(no.p(ro,oo),oo&5&&transition_in(no,1)):(no=create_if_block$14(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function getUrl(to){return to.url?`/app${to.url}`:`/${to.prodId}`}function instance$1_(to,ue,eo){let no,ro,oo,io,so,ao,lo,uo,co,fo,po,mo,_o;component_subscribe(to,auth,Lo=>eo(0,so=Lo)),component_subscribe(to,admin,Lo=>eo(1,ao=Lo)),component_subscribe(to,clientAppsStore,Lo=>eo(13,lo=Lo)),component_subscribe(to,featureFlags,Lo=>eo(14,uo=Lo)),component_subscribe(to,enrichedApps,Lo=>eo(15,co=Lo)),component_subscribe(to,groups,Lo=>eo(16,fo=Lo)),component_subscribe(to,organisation,Lo=>eo(7,po=Lo)),component_subscribe(to,goto,Lo=>eo(8,mo=Lo)),component_subscribe(to,licensing,Lo=>eo(9,_o=Lo));let ho=!1,go,bo;function vo(Lo,No,Do){return isAdmin(Do)?Lo:Lo.filter(Po=>{var Mo;return isBuilder(Do,Po.prodId)?!0:!Object.keys((Do==null?void 0:Do.roles)||{}).length&&(Do!=null&&Do.userGroups)?No.find(Uo=>groups.getGroupAppIds(Uo).map(Vo=>appsStore.extractAppId(Vo)).includes(Po.appId)):Object.keys(((Mo=so.user)==null?void 0:Mo.roles)||{}).map(Uo=>appsStore.extractAppId(Uo)).includes(Po.appId)})}const $o=async()=>{try{await auth.logout()}catch{}};onMount(async()=>{try{await organisation.init(),await appsStore.load(),await clientAppsStore.load(),await groups.init()}catch{notifications.error("Error loading apps")}eo(2,ho=!0)});const wo=()=>go.show(),ko=()=>{io?window.location.href=`${ao.accountPortalUrl}/portal/account`:bo.show()},So=()=>mo("../portal"),To=()=>auth.getSelf();function Io(Lo){binding_callbacks[Lo?"unshift":"push"](()=>{go=Lo,eo(3,go)})}const Ao=()=>auth.getSelf();function Eo(Lo){binding_callbacks[Lo?"unshift":"push"](()=>{bo=Lo,eo(4,bo)})}return to.$$.update=()=>{to.$$.dirty&65537&&eo(11,no=fo.filter(Lo=>{var No;return(No=Lo.users)==null?void 0:No.find(Do=>{var Po;return Do._id===((Po=so.user)==null?void 0:Po._id)})})),to.$$.dirty&32768&&eo(12,ro=co.filter(Lo=>Lo.status===AppStatus.DEPLOYED)),to.$$.dirty&30721&&eo(6,oo=uo.WORKSPACE_APPS?lo.apps:vo(ro,no,so.user)),to.$$.dirty&3&&eo(5,io=so.accountPortalAccess&&ao.cloud)},[so,ao,ho,go,bo,io,oo,po,mo,_o,$o,no,ro,lo,uo,co,fo,wo,ko,So,To,Io,Ao,Eo]}let Apps$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1_,create_fragment$1W,safe_not_equal,{})}};function create_if_block$13(to){let ue;const eo=to[2].default,no=create_slot(eo,to,to[1],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&2)&&update_slot_base(no,eo,ro,ro[1],ue?get_slot_changes(eo,ro[1],oo,null):get_all_dirty_from_scope(ro[1]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_fragment$1V(to){let ue,eo,no=to[0].user&&create_if_block$13(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0].user?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$13(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1Z(to,ue,eo){let no;component_subscribe(to,auth,io=>eo(0,no=io));let{$$slots:ro={},$$scope:oo}=ue;return to.$$set=io=>{"$$scope"in io&&eo(1,oo=io.$$scope)},[no,oo,ro]}let Layout$9=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1Z,create_fragment$1V,safe_not_equal,{})}};const forgot_svelte_svelte_type_style_lang="";function create_default_slot_7$n(to){let ue,eo,no,ro,oo,io,so;return no=new Icon({props:{name:"caret-left",size:"XL"}}),{c(){ue=element("div"),eo=element("span"),create_component(no.$$.fragment),ro=text(`
|
|
1187
1187
|
Forgot your password?`),attr(eo,"class","back-chev svelte-1liwgpo"),attr(ue,"class","heading-content svelte-1liwgpo")},m(ao,lo){insert$1(ao,ue,lo),append$2(ue,eo),mount_component(no,eo,null),append$2(ue,ro),oo=!0,io||(so=listen(eo,"click",to[7]),io=!0)},p:noop$5,i(ao){oo||(transition_in(no.$$.fragment,ao),oo=!0)},o(ao){transition_out(no.$$.fragment,ao),oo=!1},d(ao){ao&&detach(ue),destroy_component(no),io=!1,so()}}}function create_default_slot_6$p(to){let ue;return{c(){ue=text(`No problem! Just enter your account's email address and we'll send you a
|
|
1188
|
-
link to reset it.`)},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$t(to){let ue,eo;return ue=new Body({props:{size:"M",$$slots:{default:[create_default_slot_6$p]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_4$w(to){let ue,eo;return ue=new FancyInput({props:{label:"Email",value:to[0],validate:to[8],error:to[5],disabled:to[2]}}),ue.$on("change",to[9]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.value=no[0]),ro&1&&(oo.validate=no[8]),ro&4&&(oo.disabled=no[2]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$J(to){let ue,eo,no={$$slots:{default:[create_default_slot_4$w]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[10](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){const io={};oo&2053&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[10](null),destroy_component(ue,ro)}}}function create_default_slot_2$S(to){let ue;return{c(){ue=text("Reset password")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$16(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po;return oo=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_7$n]},$$scope:{ctx:to}}}),so=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_5$t]},$$scope:{ctx:to}}}),lo=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_3$J]},$$scope:{ctx:to}}}),fo=new Button({props:{size:"L",disabled:!to[0]||to[5]||to[2],cta:!0,$$slots:{default:[create_default_slot_2$S]},$$scope:{ctx:to}}}),fo.$on("click",to[6]),{c(){ue=element("img"),no=space$1(),ro=element("span"),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),co=element("div"),create_component(fo.$$.fragment),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[3].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-1liwgpo"),attr(ro,"class","heading-wrap")},m(mo,_o){insert$1(mo,ue,_o),insert$1(mo,no,_o),insert$1(mo,ro,_o),mount_component(oo,ro,null),insert$1(mo,io,_o),mount_component(so,mo,_o),insert$1(mo,ao,_o),mount_component(lo,mo,_o),insert$1(mo,uo,_o),insert$1(mo,co,_o),mount_component(fo,co,null),po=!0},p(mo,_o){(!po||_o&8&&!src_url_equal(ue.src,eo=mo[3].logoUrl||Logo$1))&&attr(ue,"src",eo);const ho={};_o&2064&&(ho.$$scope={dirty:_o,ctx:mo}),oo.$set(ho);const go={};_o&2048&&(go.$$scope={dirty:_o,ctx:mo}),so.$set(go);const bo={};_o&2055&&(bo.$$scope={dirty:_o,ctx:mo}),lo.$set(bo);const vo={};_o&5&&(vo.disabled=!mo[0]||mo[5]||mo[2]),_o&2048&&(vo.$$scope={dirty:_o,ctx:mo}),fo.$set(vo)},i(mo){po||(transition_in(oo.$$.fragment,mo),transition_in(so.$$.fragment,mo),transition_in(lo.$$.fragment,mo),transition_in(fo.$$.fragment,mo),po=!0)},o(mo){transition_out(oo.$$.fragment,mo),transition_out(so.$$.fragment,mo),transition_out(lo.$$.fragment,mo),transition_out(fo.$$.fragment,mo),po=!1},d(mo){mo&&(detach(ue),detach(no),detach(ro),detach(io),detach(ao),detach(uo),detach(co)),destroy_component(oo),destroy_component(so,mo),destroy_component(lo,mo),destroy_component(fo)}}}function create_default_slot$1j(to){let ue,eo;return ue=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_1$16]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2079&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1U(to){let ue,eo;return ue=new TestimonialPage({props:{enabled:to[3].testimonialsEnabled,$$slots:{default:[create_default_slot$1j]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&8&&(oo.enabled=no[3].testimonialsEnabled),ro&2079&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$1Y(to,ue,eo){let no,ro;component_subscribe(to,organisation,mo=>eo(3,no=mo)),component_subscribe(to,goto,mo=>eo(4,ro=mo));let oo="",io,so,ao=!1;async function lo(){io.validate(),eo(2,ao=!0);try{await auth.forgotPassword(oo),notifications.success("Email sent - please check your inbox")}catch{eo(2,ao=!1),notifications.error("Unable to send reset password link")}}onMount(async()=>{try{await organisation.init()}catch{notifications.error("Error getting org config")}});const uo=()=>ro("../"),co=()=>oo?null:"Please enter your email",fo=mo=>{eo(0,oo=mo.detail)};function po(mo){binding_callbacks[mo?"unshift":"push"](()=>{io=mo,eo(1,io)})}return[oo,io,ao,no,ro,so,lo,uo,co,fo,po]}class Forgot extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1Y,create_fragment$1U,safe_not_equal,{})}}function instance$1X(to,ue,eo){let no,ro,oo,io,so;component_subscribe(to,redirect,lo=>eo(3,oo=lo)),component_subscribe(to,admin,lo=>eo(4,io=lo)),component_subscribe(to,auth,lo=>eo(5,so=lo));let ao=!1;return onMount(async()=>{try{await admin.init(),await auth.checkQueryString()}catch{notifications.error("Error getting checklist")}eo(0,ao=!0)}),to.$$.update=()=>{to.$$.dirty&32&&eo(1,no=so.tenantSet),to.$$.dirty&16&&eo(2,ro=io.multiTenancy),to.$$.dirty&15&&(ao&&ro&&!no?oo("./org"):ao&&oo("./login"))},[ao,no,ro,oo,io,so]}let Auth$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1X,null,safe_not_equal,{})}};function create_if_block$12(to){let ue,eo;return ue=new FancyButton({props:{icon:GoogleLogo,$$slots:{default:[create_default_slot$1i]},$$scope:{ctx:to}}}),ue.$on("click",to[5]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1i(to){let ue;return{c(){ue=text("Log in with Google")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$1T(to){let ue,eo,no=to[1]&&create_if_block$12(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[1]?no?(no.p(ro,oo),oo&2&&transition_in(no,1)):(no=create_if_block$12(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1W(to,ue,eo){let no,ro,oo;component_subscribe(to,organisation,lo=>eo(3,ro=lo)),component_subscribe(to,auth,lo=>eo(4,oo=lo));let{samePage:io}=ue,so;const ao=()=>{const lo=`/api/global/auth/${no}/google`;io?window.location=lo:window.open(lo,"_blank")};return to.$$set=lo=>{"samePage"in lo&&eo(0,io=lo.samePage)},to.$$.update=()=>{to.$$.dirty&16&&eo(2,no=oo.tenantId),to.$$.dirty&8&&eo(1,so=ro.google)},[io,so,no,ro,oo,ao]}class GoogleButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1W,create_fragment$1T,safe_not_equal,{samePage:0})}}const OidcLogoPng="/builder/assets/oidc-logo-cb2fff74.png",Auth0Logo="/builder/assets/auth0-logo-6fa5973f.png",MicrosoftLogo="/builder/assets/microsoft-logo-07033b2a.png",OktaLogo="/builder/assets/okta-logo-61437d3d.png",OneLoginLogo="/builder/assets/onelogin-logo-181cc193.png";function create_if_block$11(to){let ue,eo;return ue=new FancyButton({props:{icon:to[2],$$slots:{default:[create_default_slot$1h]},$$scope:{ctx:to}}}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.icon=no[2]),ro&514&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1h(to){let ue=`Log in with ${to[1].name||"OIDC"}`,eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&2&&ue!==(ue=`Log in with ${no[1].name||"OIDC"}`)&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_fragment$1S(to){let ue,eo,no=to[3]&&create_if_block$11(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[3]?no?(no.p(ro,oo),oo&8&&transition_in(no,1)):(no=create_if_block$11(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1V(to,ue,eo){let no,ro,oo,io,so,ao;component_subscribe(to,oidc,fo=>eo(1,io=fo)),component_subscribe(to,organisation,fo=>eo(6,so=fo)),component_subscribe(to,auth,fo=>eo(4,ao=fo));let{samePage:lo}=ue,uo={Oidc:OidcLogoPng,Auth0:Auth0Logo,Microsoft:MicrosoftLogo,Okta:OktaLogo,OneLogin:OneLoginLogo};onMount(async()=>{try{await oidc.init()}catch{notifications.error("Error getting OIDC config")}});const co=()=>{const fo=`/api/global/auth/${ao.tenantId}/oidc/configs/${io.uuid}`;lo?window.location=fo:window.open(fo,"_blank")};return to.$$set=fo=>{"samePage"in fo&&eo(0,lo=fo.samePage)},to.$$.update=()=>{to.$$.dirty&64&&eo(3,no=so.oidc),to.$$.dirty&2&&eo(5,ro=uo[io.logo]??io.logo),to.$$.dirty&32&&eo(2,oo=ro??OidcLogoPng)},[lo,io,oo,no,ao,ro,so,co]}class OIDCButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1V,create_fragment$1S,safe_not_equal,{samePage:0})}}const login_svelte_svelte_type_style_lang="";function create_if_block$10(to){let ue,eo;return ue=new TestimonialPage({props:{enabled:to[0].testimonialsEnabled,$$slots:{default:[create_default_slot$1g]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.enabled=no[0].testimonialsEnabled),ro&524799&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_5$2(to){let ue,eo;return{c(){ue=element("img"),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[0].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-15tskz2")},m(no,ro){insert$1(no,ue,ro)},p(no,ro){ro&1&&!src_url_equal(ue.src,eo=no[0].logoUrl||Logo$1)&&attr(ue,"src",eo)},d(no){no&&detach(ue)}}}function create_default_slot_12$8(to){let ue=(to[0].loginHeading||"Log in to Budibase")+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=(no[0].loginHeading||"Log in to Budibase")+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_11$b(to){let ue,eo,no,ro=to[1]&&create_if_block_5$2(to);return eo=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_12$8]},$$scope:{ctx:to}}}),{c(){ro&&ro.c(),ue=space$1(),create_component(eo.$$.fragment)},m(oo,io){ro&&ro.m(oo,io),insert$1(oo,ue,io),mount_component(eo,oo,io),no=!0},p(oo,io){oo[1]?ro?ro.p(oo,io):(ro=create_if_block_5$2(oo),ro.c(),ro.m(ue.parentNode,ue)):ro&&(ro.d(1),ro=null);const so={};io&524289&&(so.$$scope={dirty:io,ctx:oo}),eo.$set(so)},i(oo){no||(transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo),destroy_component(eo,oo)}}}function create_if_block_4$6(to){let ue,eo;return ue=new FancyForm({props:{$$slots:{default:[create_default_slot_10$c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&524544&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_10$c(to){let ue,eo,no,ro;return ue=new OIDCButton({props:{oidcIcon:to[8].logo,oidcName:to[8].name,samePage:!0}}),no=new GoogleButton({props:{samePage:!0}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&256&&(so.oidcIcon=oo[8].logo),io&256&&(so.oidcName=oo[8].name),ue.$set(so)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_if_block_3$b(to){let ue,eo,no,ro;ue=new Divider({});let oo={$$slots:{default:[create_default_slot_9$e]},$$scope:{ctx:to}};return no=new FancyForm({props:oo}),to[16](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(io,so){mount_component(ue,io,so),insert$1(io,eo,so),mount_component(no,io,so),ro=!0},p(io,so){const ao={};so&524312&&(ao.$$scope={dirty:so,ctx:io}),no.$set(ao)},i(io){ro||(transition_in(ue.$$.fragment,io),transition_in(no.$$.fragment,io),ro=!0)},o(io){transition_out(ue.$$.fragment,io),transition_out(no.$$.fragment,io),ro=!1},d(io){io&&detach(eo),destroy_component(ue,io),to[16](null),destroy_component(no,io)}}}function create_default_slot_9$e(to){let ue,eo,no,ro;return ue=new FancyInput({props:{label:"Your work email",value:to[4].username,validate:to[12],error:to[3].username}}),ue.$on("change",to[13]),no=new FancyInput({props:{label:"Password",value:to[4].password,type:"password",validate:to[14],error:to[3].password}}),no.$on("change",to[15]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&16&&(so.value=oo[4].username),io&24&&(so.validate=oo[12]),io&8&&(so.error=oo[3].username),ue.$set(so);const ao={};io&16&&(ao.value=oo[4].password),io&24&&(ao.validate=oo[14]),io&8&&(ao.error=oo[3].password),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_8$h(to){let ue,eo,no,ro=to[1]&&(to[0].google||to[0].oidc)&&create_if_block_4$6(to),oo=!to[0].isSSOEnforced&&create_if_block_3$b(to);return{c(){ro&&ro.c(),ue=space$1(),oo&&oo.c(),eo=empty$4()},m(io,so){ro&&ro.m(io,so),insert$1(io,ue,so),oo&&oo.m(io,so),insert$1(io,eo,so),no=!0},p(io,so){io[1]&&(io[0].google||io[0].oidc)?ro?(ro.p(io,so),so&3&&transition_in(ro,1)):(ro=create_if_block_4$6(io),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros()),io[0].isSSOEnforced?oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros()):oo?(oo.p(io,so),so&1&&transition_in(oo,1)):(oo=create_if_block_3$b(io),oo.c(),transition_in(oo,1),oo.m(eo.parentNode,eo))},i(io){no||(transition_in(ro),transition_in(oo),no=!0)},o(io){transition_out(ro),transition_out(oo),no=!1},d(io){io&&(detach(ue),detach(eo)),ro&&ro.d(io),oo&&oo.d(io)}}}function create_if_block_2$k(to){let ue,eo,no,ro;return ue=new Layout$o({props:{gap:"XS",noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_6$o]},$$scope:{ctx:to}}}),no=new Layout$o({props:{gap:"XS",noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_4$v]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&524361&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&524416&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_7$m(to){let ue=(to[0].loginButton||`Log in to ${to[6]}`)+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&65&&ue!==(ue=(no[0].loginButton||`Log in to ${no[6]}`)+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_6$o(to){let ue,eo;return ue=new Button({props:{size:"L",cta:!0,disabled:Object.keys(to[3]).length>0,$$slots:{default:[create_default_slot_7$m]},$$scope:{ctx:to}}}),ue.$on("click",to[9]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&8&&(oo.disabled=Object.keys(no[3]).length>0),ro&524353&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_5$s(to){let ue;return{c(){ue=text("Forgot password?")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$v(to){let ue,eo,no;return eo=new ActionButton({props:{size:"L",quiet:!0,$$slots:{default:[create_default_slot_5$s]},$$scope:{ctx:to}}}),eo.$on("click",to[17]),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","user-actions svelte-15tskz2")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&524288&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_1$B(to){let ue,eo;return ue=new Body({props:{size:"xs",textAlign:"center",$$slots:{default:[create_default_slot_2$R]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$I(to){let ue;return{c(){ue=text("License Agreement")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$R(to){let ue,eo,no,ro,oo;return ro=new Link({props:{href:"https://budibase.com/eula",target:"_blank",secondary:!0,$$slots:{default:[create_default_slot_3$I]},$$scope:{ctx:to}}}),{c(){ue=text(`By using Budibase Cloud
|
|
1188
|
+
link to reset it.`)},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$t(to){let ue,eo;return ue=new Body({props:{size:"M",$$slots:{default:[create_default_slot_6$p]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2048&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_4$w(to){let ue,eo;return ue=new FancyInput({props:{label:"Email",value:to[0],validate:to[8],error:to[5],disabled:to[2]}}),ue.$on("change",to[9]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.value=no[0]),ro&1&&(oo.validate=no[8]),ro&4&&(oo.disabled=no[2]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$J(to){let ue,eo,no={$$slots:{default:[create_default_slot_4$w]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[10](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){const io={};oo&2053&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[10](null),destroy_component(ue,ro)}}}function create_default_slot_2$S(to){let ue;return{c(){ue=text("Reset password")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$16(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co,fo,po;return oo=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_7$n]},$$scope:{ctx:to}}}),so=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_5$t]},$$scope:{ctx:to}}}),lo=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_3$J]},$$scope:{ctx:to}}}),fo=new Button({props:{size:"L",disabled:!to[0]||to[5]||to[2],cta:!0,$$slots:{default:[create_default_slot_2$S]},$$scope:{ctx:to}}}),fo.$on("click",to[6]),{c(){ue=element("img"),no=space$1(),ro=element("span"),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment),ao=space$1(),create_component(lo.$$.fragment),uo=space$1(),co=element("div"),create_component(fo.$$.fragment),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[3].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-1liwgpo"),attr(ro,"class","heading-wrap")},m(mo,_o){insert$1(mo,ue,_o),insert$1(mo,no,_o),insert$1(mo,ro,_o),mount_component(oo,ro,null),insert$1(mo,io,_o),mount_component(so,mo,_o),insert$1(mo,ao,_o),mount_component(lo,mo,_o),insert$1(mo,uo,_o),insert$1(mo,co,_o),mount_component(fo,co,null),po=!0},p(mo,_o){(!po||_o&8&&!src_url_equal(ue.src,eo=mo[3].logoUrl||Logo$1))&&attr(ue,"src",eo);const ho={};_o&2064&&(ho.$$scope={dirty:_o,ctx:mo}),oo.$set(ho);const go={};_o&2048&&(go.$$scope={dirty:_o,ctx:mo}),so.$set(go);const bo={};_o&2055&&(bo.$$scope={dirty:_o,ctx:mo}),lo.$set(bo);const vo={};_o&5&&(vo.disabled=!mo[0]||mo[5]||mo[2]),_o&2048&&(vo.$$scope={dirty:_o,ctx:mo}),fo.$set(vo)},i(mo){po||(transition_in(oo.$$.fragment,mo),transition_in(so.$$.fragment,mo),transition_in(lo.$$.fragment,mo),transition_in(fo.$$.fragment,mo),po=!0)},o(mo){transition_out(oo.$$.fragment,mo),transition_out(so.$$.fragment,mo),transition_out(lo.$$.fragment,mo),transition_out(fo.$$.fragment,mo),po=!1},d(mo){mo&&(detach(ue),detach(no),detach(ro),detach(io),detach(ao),detach(uo),detach(co)),destroy_component(oo),destroy_component(so,mo),destroy_component(lo,mo),destroy_component(fo)}}}function create_default_slot$1j(to){let ue,eo;return ue=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_1$16]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2079&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1U(to){let ue,eo;return ue=new TestimonialPage({props:{enabled:to[3].testimonialsEnabled,$$slots:{default:[create_default_slot$1j]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&8&&(oo.enabled=no[3].testimonialsEnabled),ro&2079&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$1Y(to,ue,eo){let no,ro;component_subscribe(to,organisation,mo=>eo(3,no=mo)),component_subscribe(to,goto,mo=>eo(4,ro=mo));let oo="",io,so,ao=!1;async function lo(){io.validate(),eo(2,ao=!0);try{await auth.forgotPassword(oo),notifications.success("Email sent - please check your inbox")}catch{eo(2,ao=!1),notifications.error("Unable to send reset password link")}}onMount(async()=>{try{await organisation.init()}catch{notifications.error("Error getting org config")}});const uo=()=>ro("../"),co=()=>oo?null:"Please enter your email",fo=mo=>{eo(0,oo=mo.detail)};function po(mo){binding_callbacks[mo?"unshift":"push"](()=>{io=mo,eo(1,io)})}return[oo,io,ao,no,ro,so,lo,uo,co,fo,po]}class Forgot extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1Y,create_fragment$1U,safe_not_equal,{})}}function instance$1X(to,ue,eo){let no,ro,oo,io,so;component_subscribe(to,redirect,lo=>eo(3,oo=lo)),component_subscribe(to,admin,lo=>eo(4,io=lo)),component_subscribe(to,auth,lo=>eo(5,so=lo));let ao=!1;return onMount(async()=>{try{await admin.init(),await auth.checkQueryString()}catch{notifications.error("Error getting checklist")}eo(0,ao=!0)}),to.$$.update=()=>{to.$$.dirty&32&&eo(1,no=so.tenantSet),to.$$.dirty&16&&eo(2,ro=io.multiTenancy),to.$$.dirty&15&&(ao&&ro&&!no?oo("./org"):ao&&oo("./login"))},[ao,no,ro,oo,io,so]}let Auth$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1X,null,safe_not_equal,{})}};function create_if_block$12(to){let ue,eo;return ue=new FancyButton({props:{icon:GoogleLogo,$$slots:{default:[create_default_slot$1i]},$$scope:{ctx:to}}}),ue.$on("click",to[5]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1i(to){let ue;return{c(){ue=text("Log in with Google")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$1T(to){let ue,eo,no=to[1]&&create_if_block$12(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[1]?no?(no.p(ro,oo),oo&2&&transition_in(no,1)):(no=create_if_block$12(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1W(to,ue,eo){let no,ro,oo;component_subscribe(to,organisation,lo=>eo(3,ro=lo)),component_subscribe(to,auth,lo=>eo(4,oo=lo));let{samePage:io}=ue,so;const ao=()=>{const lo=`/api/global/auth/${no}/google`;io?window.location=lo:window.open(lo,"_blank")};return to.$$set=lo=>{"samePage"in lo&&eo(0,io=lo.samePage)},to.$$.update=()=>{to.$$.dirty&16&&eo(2,no=oo.tenantId),to.$$.dirty&8&&eo(1,so=ro.google)},[io,so,no,ro,oo,ao]}class GoogleButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1W,create_fragment$1T,safe_not_equal,{samePage:0})}}const OidcLogoPng="/builder/assets/oidc-logo-cb2fff74.png",Auth0Logo="/builder/assets/auth0-logo-6fa5973f.png",MicrosoftLogo="/builder/assets/microsoft-logo-07033b2a.png",OktaLogo="/builder/assets/okta-logo-61437d3d.png",OneLoginLogo="/builder/assets/onelogin-logo-181cc193.png";function create_if_block$11(to){let ue,eo;return ue=new FancyButton({props:{icon:to[2],$$slots:{default:[create_default_slot$1h]},$$scope:{ctx:to}}}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.icon=no[2]),ro&514&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1h(to){let ue=`Log in with ${to[1].name||"OIDC"}`,eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&2&&ue!==(ue=`Log in with ${no[1].name||"OIDC"}`)&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_fragment$1S(to){let ue,eo,no=to[3]&&create_if_block$11(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[3]?no?(no.p(ro,oo),oo&8&&transition_in(no,1)):(no=create_if_block$11(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1V(to,ue,eo){let no,ro,oo,io,so,ao;component_subscribe(to,oidc,fo=>eo(1,io=fo)),component_subscribe(to,organisation,fo=>eo(6,so=fo)),component_subscribe(to,auth,fo=>eo(4,ao=fo));let{samePage:lo}=ue,uo={Oidc:OidcLogoPng,Auth0:Auth0Logo,Microsoft:MicrosoftLogo,Okta:OktaLogo,OneLogin:OneLoginLogo};onMount(async()=>{try{await oidc.init()}catch{notifications.error("Error getting OIDC config")}});const co=()=>{const fo=`/api/global/auth/${ao.tenantId}/oidc/configs/${io.uuid}`;lo?window.location=fo:window.open(fo,"_blank")};return to.$$set=fo=>{"samePage"in fo&&eo(0,lo=fo.samePage)},to.$$.update=()=>{to.$$.dirty&64&&eo(3,no=so.oidc),to.$$.dirty&2&&eo(5,ro=uo[io.logo]??io.logo),to.$$.dirty&32&&eo(2,oo=ro??OidcLogoPng)},[lo,io,oo,no,ao,ro,so,co]}class OIDCButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1V,create_fragment$1S,safe_not_equal,{samePage:0})}}const login_svelte_svelte_type_style_lang="";function create_if_block$10(to){let ue,eo;return ue=new TestimonialPage({props:{enabled:to[0].testimonialsEnabled,$$slots:{default:[create_default_slot$1g]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.enabled=no[0].testimonialsEnabled),ro&524799&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_5$2(to){let ue,eo;return{c(){ue=element("img"),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[0].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-15tskz2")},m(no,ro){insert$1(no,ue,ro)},p(no,ro){ro&1&&!src_url_equal(ue.src,eo=no[0].logoUrl||Logo$1)&&attr(ue,"src",eo)},d(no){no&&detach(ue)}}}function create_default_slot_12$8(to){let ue=(to[0].loginHeading||"Log in to Budibase")+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=(no[0].loginHeading||"Log in to Budibase")+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_11$b(to){let ue,eo,no,ro=to[1]&&create_if_block_5$2(to);return eo=new Heading({props:{size:"M",textAlign:"center",$$slots:{default:[create_default_slot_12$8]},$$scope:{ctx:to}}}),{c(){ro&&ro.c(),ue=space$1(),create_component(eo.$$.fragment)},m(oo,io){ro&&ro.m(oo,io),insert$1(oo,ue,io),mount_component(eo,oo,io),no=!0},p(oo,io){oo[1]?ro?ro.p(oo,io):(ro=create_if_block_5$2(oo),ro.c(),ro.m(ue.parentNode,ue)):ro&&(ro.d(1),ro=null);const so={};io&524289&&(so.$$scope={dirty:io,ctx:oo}),eo.$set(so)},i(oo){no||(transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo),destroy_component(eo,oo)}}}function create_if_block_4$6(to){let ue,eo;return ue=new FancyForm({props:{$$slots:{default:[create_default_slot_10$c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&524544&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_10$c(to){let ue,eo,no,ro;return ue=new OIDCButton({props:{oidcIcon:to[8].logo,oidcName:to[8].name,samePage:!0}}),no=new GoogleButton({props:{samePage:!0}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&256&&(so.oidcIcon=oo[8].logo),io&256&&(so.oidcName=oo[8].name),ue.$set(so)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_if_block_3$b(to){let ue,eo,no,ro;ue=new Divider({});let oo={$$slots:{default:[create_default_slot_9$e]},$$scope:{ctx:to}};return no=new FancyForm({props:oo}),to[16](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(io,so){mount_component(ue,io,so),insert$1(io,eo,so),mount_component(no,io,so),ro=!0},p(io,so){const ao={};so&524312&&(ao.$$scope={dirty:so,ctx:io}),no.$set(ao)},i(io){ro||(transition_in(ue.$$.fragment,io),transition_in(no.$$.fragment,io),ro=!0)},o(io){transition_out(ue.$$.fragment,io),transition_out(no.$$.fragment,io),ro=!1},d(io){io&&detach(eo),destroy_component(ue,io),to[16](null),destroy_component(no,io)}}}function create_default_slot_9$e(to){let ue,eo,no,ro;return ue=new FancyInput({props:{label:"Your work email",value:to[4].username,validate:to[12],error:to[3].username}}),ue.$on("change",to[13]),no=new FancyInput({props:{label:"Password",value:to[4].password,type:"password",validate:to[14],error:to[3].password}}),no.$on("change",to[15]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&16&&(so.value=oo[4].username),io&24&&(so.validate=oo[12]),io&8&&(so.error=oo[3].username),ue.$set(so);const ao={};io&16&&(ao.value=oo[4].password),io&24&&(ao.validate=oo[14]),io&8&&(ao.error=oo[3].password),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_8$h(to){let ue,eo,no,ro=to[1]&&(to[0].google||to[0].oidc)&&create_if_block_4$6(to),oo=!to[0].isSSOEnforced&&create_if_block_3$b(to);return{c(){ro&&ro.c(),ue=space$1(),oo&&oo.c(),eo=empty$4()},m(io,so){ro&&ro.m(io,so),insert$1(io,ue,so),oo&&oo.m(io,so),insert$1(io,eo,so),no=!0},p(io,so){io[1]&&(io[0].google||io[0].oidc)?ro?(ro.p(io,so),so&3&&transition_in(ro,1)):(ro=create_if_block_4$6(io),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros()),io[0].isSSOEnforced?oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros()):oo?(oo.p(io,so),so&1&&transition_in(oo,1)):(oo=create_if_block_3$b(io),oo.c(),transition_in(oo,1),oo.m(eo.parentNode,eo))},i(io){no||(transition_in(ro),transition_in(oo),no=!0)},o(io){transition_out(ro),transition_out(oo),no=!1},d(io){io&&(detach(ue),detach(eo)),ro&&ro.d(io),oo&&oo.d(io)}}}function create_if_block_2$k(to){let ue,eo,no,ro;return ue=new Layout$o({props:{gap:"XS",noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_6$o]},$$scope:{ctx:to}}}),no=new Layout$o({props:{gap:"XS",noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_4$v]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&524361&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&524416&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_7$m(to){let ue=(to[0].loginButton||`Log in to ${to[6]}`)+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&65&&ue!==(ue=(no[0].loginButton||`Log in to ${no[6]}`)+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_6$o(to){let ue,eo;return ue=new Button({props:{size:"L",cta:!0,disabled:Object.keys(to[3]).length>0,$$slots:{default:[create_default_slot_7$m]},$$scope:{ctx:to}}}),ue.$on("click",to[9]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&8&&(oo.disabled=Object.keys(no[3]).length>0),ro&524353&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_5$s(to){let ue;return{c(){ue=text("Forgot password?")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$v(to){let ue,eo,no;return eo=new ActionButton({props:{size:"L",quiet:!0,$$slots:{default:[create_default_slot_5$s]},$$scope:{ctx:to}}}),eo.$on("click",to[17]),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","user-actions svelte-15tskz2")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&524288&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_1$B(to){let ue,eo;return ue=new Body({props:{size:"xs",textAlign:"center",$$slots:{default:[create_default_slot_2$R]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$I(to){let ue;return{c(){ue=text("License Agreement")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$R(to){let ue,eo,no,ro,oo;return ro=new Link({props:{href:"https://budibase.com/eula",target:"_blank",secondary:!0,$$slots:{default:[create_default_slot_3$I]},$$scope:{ctx:to}}}),{c(){ue=text(`By using Budibase Cloud
|
|
1189
1189
|
`),eo=element("br"),no=text(`
|
|
1190
1190
|
you are agreeing to our
|
|
1191
1191
|
`),create_component(ro.$$.fragment)},m(io,so){insert$1(io,ue,so),insert$1(io,eo,so),insert$1(io,no,so),mount_component(ro,io,so),oo=!0},p(io,so){const ao={};so&524288&&(ao.$$scope={dirty:so,ctx:io}),ro.$set(ao)},i(io){oo||(transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&(detach(ue),detach(eo),detach(no)),destroy_component(ro,io)}}}function create_default_slot_1$15(to){let ue,eo,no,ro,oo,io,so;ue=new Layout$o({props:{justifyItems:"center",noPadding:!0,$$slots:{default:[create_default_slot_11$b]},$$scope:{ctx:to}}}),no=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_8$h]},$$scope:{ctx:to}}});let ao=!to[0].isSSOEnforced&&create_if_block_2$k(to),lo=to[5]&&create_if_block_1$B(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),ao&&ao.c(),oo=space$1(),lo&&lo.c(),io=empty$4()},m(uo,co){mount_component(ue,uo,co),insert$1(uo,eo,co),mount_component(no,uo,co),insert$1(uo,ro,co),ao&&ao.m(uo,co),insert$1(uo,oo,co),lo&&lo.m(uo,co),insert$1(uo,io,co),so=!0},p(uo,co){const fo={};co&524291&&(fo.$$scope={dirty:co,ctx:uo}),ue.$set(fo);const po={};co&524575&&(po.$$scope={dirty:co,ctx:uo}),no.$set(po),uo[0].isSSOEnforced?ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()):ao?(ao.p(uo,co),co&1&&transition_in(ao,1)):(ao=create_if_block_2$k(uo),ao.c(),transition_in(ao,1),ao.m(oo.parentNode,oo)),uo[5]?lo?co&32&&transition_in(lo,1):(lo=create_if_block_1$B(uo),lo.c(),transition_in(lo,1),lo.m(io.parentNode,io)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros())},i(uo){so||(transition_in(ue.$$.fragment,uo),transition_in(no.$$.fragment,uo),transition_in(ao),transition_in(lo),so=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(no.$$.fragment,uo),transition_out(ao),transition_out(lo),so=!1},d(uo){uo&&(detach(eo),detach(ro),detach(oo),detach(io)),destroy_component(ue,uo),destroy_component(no,uo),ao&&ao.d(uo),lo&&lo.d(uo)}}}function create_default_slot$1g(to){let ue,eo;return ue=new Layout$o({props:{gap:"L",noPadding:!0,$$slots:{default:[create_default_slot_1$15]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&524799&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1R(to){let ue,eo,no,ro,oo=to[1]&&create_if_block$10(to);return{c(){oo&&oo.c(),ue=empty$4()},m(io,so){oo&&oo.m(io,so),insert$1(io,ue,so),eo=!0,no||(ro=listen(window,"keydown",to[10]),no=!0)},p(io,[so]){io[1]?oo?(oo.p(io,so),so&2&&transition_in(oo,1)):(oo=create_if_block$10(io),oo.c(),transition_in(oo,1),oo.m(ue.parentNode,ue)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(io){eo||(transition_in(oo),eo=!0)},o(io){transition_out(oo),eo=!1},d(io){io&&detach(ue),oo&&oo.d(io),no=!1,ro()}}}function instance$1U(to,ue,eo){let no,ro,oo,io,so,ao,lo;component_subscribe(to,goto,ko=>eo(7,oo=ko)),component_subscribe(to,auth,ko=>eo(18,io=ko)),component_subscribe(to,admin,ko=>eo(11,so=ko)),component_subscribe(to,organisation,ko=>eo(0,ao=ko)),component_subscribe(to,oidc,ko=>eo(8,lo=ko));let uo=!1,co,fo={},po={};async function mo(){var ko;if(co.validate(),Object.keys(fo).length>0){console.error("errors",fo);return}try{const So=await auth.login(po==null?void 0:po.username.trim(),po==null?void 0:po.password);(ko=io==null?void 0:io.user)!=null&&ko.forceResetPassword?oo("./reset"):(notifications.success("Logged in successfully"),pushNumSessionsInvalidated(So.invalidatedSessionCount||0),oo("../portal"))}catch(So){notifications.error(So.message?So.message:"Invalid credentials")}}function _o(ko){ko.key==="Enter"&&mo()}onMount(async()=>{try{await organisation.init()}catch{notifications.error("Error getting org config")}eo(1,uo=!0)});const ho=()=>{let ko={username:po.username?void 0:"Please enter a valid email"};eo(3,fo=handleError({...fo,...ko}))},go=ko=>{eo(4,po={...po,username:ko.detail})},bo=()=>{let ko={password:po.password?void 0:"Please enter your password"};eo(3,fo=handleError({...fo,...ko}))},vo=ko=>{eo(4,po={...po,password:ko.detail})};function $o(ko){binding_callbacks[ko?"unshift":"push"](()=>{co=ko,eo(2,co)})}const wo=()=>oo("./forgot");return to.$$.update=()=>{to.$$.dirty&1&&eo(6,no=ao.company||"Budibase"),to.$$.dirty&2048&&eo(5,ro=so.cloud)},[ao,uo,co,fo,po,ro,no,oo,lo,mo,_o,so,ho,go,bo,vo,$o,wo]}class Login extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1U,create_fragment$1R,safe_not_equal,{})}}const org_svelte_svelte_type_style_lang="";function create_default_slot_6$n(to){let ue;return{c(){ue=text("Set Budibase organisation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$r(to){let ue,eo,no,ro,oo;return ro=new Heading({props:{$$slots:{default:[create_default_slot_6$n]},$$scope:{ctx:to}}}),{c(){ue=element("img"),no=space$1(),create_component(ro.$$.fragment),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-jotad8")},m(io,so){insert$1(io,ue,so),insert$1(io,no,so),mount_component(ro,io,so),oo=!0},p(io,so){const ao={};so&512&&(ao.$$scope={dirty:so,ctx:io}),ro.$set(ao)},i(io){oo||(transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&(detach(ue),detach(no)),destroy_component(ro,io)}}}function create_default_slot_4$u(to){let ue;return{c(){ue=text("Set organisation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$H(to){let ue,eo,no,ro,oo;ue=new Body({props:{size:"S",textAlign:"center",$$slots:{default:[create_default_slot_4$u]},$$scope:{ctx:to}}});function io(ao){to[5](ao)}let so={label:"Organisation"};return to[0]!==void 0&&(so.value=to[0]),no=new Input$5({props:so}),binding_callbacks.push(()=>bind$2(no,"value",io)),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(ao,lo){mount_component(ue,ao,lo),insert$1(ao,eo,lo),mount_component(no,ao,lo),oo=!0},p(ao,lo){const uo={};lo&512&&(uo.$$scope={dirty:lo,ctx:ao}),ue.$set(uo);const co={};!ro&&lo&1&&(ro=!0,co.value=ao[0],add_flush_callback(()=>ro=!1)),no.$set(co)},i(ao){oo||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),oo=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),oo=!1},d(ao){ao&&detach(eo),destroy_component(ue,ao),destroy_component(no,ao)}}}function create_default_slot_2$Q(to){let ue;return{c(){ue=text("Set organisation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$14(to){let ue,eo;return ue=new Button({props:{cta:!0,$$slots:{default:[create_default_slot_2$Q]},$$scope:{ctx:to}}}),ue.$on("click",to[1]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&512&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$1f(to){let ue,eo,no,ro,oo,io,so,ao;return ue=new Layout$o({props:{noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_5$r]},$$scope:{ctx:to}}}),no=new Divider({props:{noGrid:!0}}),oo=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_3$H]},$$scope:{ctx:to}}}),so=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_1$14]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(so.$$.fragment)},m(lo,uo){mount_component(ue,lo,uo),insert$1(lo,eo,uo),mount_component(no,lo,uo),insert$1(lo,ro,uo),mount_component(oo,lo,uo),insert$1(lo,io,uo),mount_component(so,lo,uo),ao=!0},p(lo,uo){const co={};uo&512&&(co.$$scope={dirty:uo,ctx:lo}),ue.$set(co);const fo={};uo&513&&(fo.$$scope={dirty:uo,ctx:lo}),oo.$set(fo);const po={};uo&512&&(po.$$scope={dirty:uo,ctx:lo}),so.$set(po)},i(lo){ao||(transition_in(ue.$$.fragment,lo),transition_in(no.$$.fragment,lo),transition_in(oo.$$.fragment,lo),transition_in(so.$$.fragment,lo),ao=!0)},o(lo){transition_out(ue.$$.fragment,lo),transition_out(no.$$.fragment,lo),transition_out(oo.$$.fragment,lo),transition_out(so.$$.fragment,lo),ao=!1},d(lo){lo&&(detach(eo),detach(ro),detach(io)),destroy_component(ue,lo),destroy_component(no,lo),destroy_component(oo,lo),destroy_component(so,lo)}}}function create_fragment$1Q(to){let ue,eo,no,ro,oo,io;return no=new Layout$o({props:{$$slots:{default:[create_default_slot$1f]},$$scope:{ctx:to}}}),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),attr(eo,"class","main svelte-jotad8"),attr(ue,"class","login svelte-jotad8")},m(so,ao){insert$1(so,ue,ao),append$2(ue,eo),mount_component(no,eo,null),ro=!0,oo||(io=listen(window,"keydown",to[2]),oo=!0)},p(so,[ao]){const lo={};ao&513&&(lo.$$scope={dirty:ao,ctx:so}),no.$set(lo)},i(so){ro||(transition_in(no.$$.fragment,so),ro=!0)},o(so){transition_out(no.$$.fragment,so),ro=!1},d(so){so&&detach(ue),destroy_component(no),oo=!1,io()}}}function instance$1T(to,ue,eo){let no,ro,oo,io,so;component_subscribe(to,goto,fo=>eo(8,io=fo)),component_subscribe(to,admin,fo=>eo(4,so=fo));let ao=get_store_value(auth).tenantSet?get_store_value(auth).tenantId:"";async function lo(){try{(ao==null||ao==="")&&eo(0,ao="default"),await auth.setOrg(ao),await admin.init(),io("../")}catch{notifications.error("Error setting organisation")}}function uo(fo){fo.key==="Enter"&&lo()}onMount(async()=>{await auth.checkQueryString(),!no||oo?io("../"):admin.unload()});function co(fo){ao=fo,eo(0,ao)}return to.$$.update=()=>{to.$$.dirty&16&&(no=so.multiTenancy),to.$$.dirty&16&&eo(3,ro=so.cloud),to.$$.dirty&24&&(oo=ro&&!so.disableAccountPortal)},[ao,lo,uo,ro,so,co]}class Org extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1T,create_fragment$1Q,safe_not_equal,{})}}const reset_svelte_svelte_type_style_lang="";function create_if_block_1$A(to){let ue,eo;return{c(){ue=element("img"),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[5].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-1rej6a3")},m(no,ro){insert$1(no,ue,ro)},p(no,ro){ro&32&&!src_url_equal(ue.src,eo=no[5].logoUrl||Logo$1)&&attr(ue,"src",eo)},d(no){no&&detach(ue)}}}function create_default_slot_5$q(to){let ue;return{c(){ue=text("Reset your password")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$t(to){let ue;return{c(){ue=text("Must contain at least 12 characters")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block$n(to){let ue;return{c(){ue=text("Reset")},m(eo,no){insert$1(eo,ue,no)},i:noop$5,o:noop$5,d(eo){eo&&detach(ue)}}}function create_if_block$$(to){let ue,eo;return ue=new ProgressCircle({props:{overBackground:!0,size:"S"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$G(to){let ue,eo,no,ro;const oo=[create_if_block$$,create_else_block$n],io=[];function so(ao,lo){return ao[2]?0:1}return ue=so(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$4()},m(ao,lo){io[ue].m(ao,lo),insert$1(ao,no,lo),ro=!0},p(ao,lo){let uo=ue;ue=so(ao),ue!==uo&&(group_outros(),transition_out(io[uo],1,1,()=>{io[uo]=null}),check_outros(),eo=io[ue],eo||(eo=io[ue]=oo[ue](ao),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(ao){ro||(transition_in(eo),ro=!0)},o(ao){transition_out(eo),ro=!1},d(ao){ao&&detach(no),io[ue].d(ao)}}}function create_default_slot_2$P(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo,co;ue=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_5$q]},$$scope:{ctx:to}}}),no=new Body({props:{size:"M",$$slots:{default:[create_default_slot_4$t]},$$scope:{ctx:to}}});function fo(ho){to[10](ho)}function po(ho){to[11](ho)}function mo(ho){to[12](ho)}let _o={minLength:to[6].passwordMinLength||12};return to[0]!==void 0&&(_o.passwordForm=to[0]),to[3]!==void 0&&(_o.password=to[3]),to[4]!==void 0&&(_o.error=to[4]),oo=new PasswordRepeatInput({props:_o}),binding_callbacks.push(()=>bind$2(oo,"passwordForm",fo)),binding_callbacks.push(()=>bind$2(oo,"password",po)),binding_callbacks.push(()=>bind$2(oo,"error",mo)),uo=new Button({props:{secondary:!0,cta:!0,$$slots:{default:[create_default_slot_3$G]},$$scope:{ctx:to}}}),uo.$on("click",to[7]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),lo=space$1(),create_component(uo.$$.fragment)},m(ho,go){mount_component(ue,ho,go),insert$1(ho,eo,go),mount_component(no,ho,go),insert$1(ho,ro,go),mount_component(oo,ho,go),insert$1(ho,lo,go),mount_component(uo,ho,go),co=!0},p(ho,go){const bo={};go&131072&&(bo.$$scope={dirty:go,ctx:ho}),ue.$set(bo);const vo={};go&131072&&(vo.$$scope={dirty:go,ctx:ho}),no.$set(vo);const $o={};go&64&&($o.minLength=ho[6].passwordMinLength||12),!io&&go&1&&(io=!0,$o.passwordForm=ho[0],add_flush_callback(()=>io=!1)),!so&&go&8&&(so=!0,$o.password=ho[3],add_flush_callback(()=>so=!1)),!ao&&go&16&&(ao=!0,$o.error=ho[4],add_flush_callback(()=>ao=!1)),oo.$set($o);const wo={};go&131076&&(wo.$$scope={dirty:go,ctx:ho}),uo.$set(wo)},i(ho){co||(transition_in(ue.$$.fragment,ho),transition_in(no.$$.fragment,ho),transition_in(oo.$$.fragment,ho),transition_in(uo.$$.fragment,ho),co=!0)},o(ho){transition_out(ue.$$.fragment,ho),transition_out(no.$$.fragment,ho),transition_out(oo.$$.fragment,ho),transition_out(uo.$$.fragment,ho),co=!1},d(ho){ho&&(detach(eo),detach(ro),detach(lo)),destroy_component(ue,ho),destroy_component(no,ho),destroy_component(oo,ho),destroy_component(uo,ho)}}}function create_default_slot_1$13(to){let ue,eo,no,ro,oo,io=to[1]&&create_if_block_1$A(to);return eo=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_2$P]},$$scope:{ctx:to}}}),{c(){io&&io.c(),ue=space$1(),create_component(eo.$$.fragment),no=space$1(),ro=element("div")},m(so,ao){io&&io.m(so,ao),insert$1(so,ue,ao),mount_component(eo,so,ao),insert$1(so,no,ao),insert$1(so,ro,ao),oo=!0},p(so,ao){so[1]?io?io.p(so,ao):(io=create_if_block_1$A(so),io.c(),io.m(ue.parentNode,ue)):io&&(io.d(1),io=null);const lo={};ao&131165&&(lo.$$scope={dirty:ao,ctx:so}),eo.$set(lo)},i(so){oo||(transition_in(eo.$$.fragment,so),oo=!0)},o(so){transition_out(eo.$$.fragment,so),oo=!1},d(so){so&&(detach(ue),detach(no),detach(ro)),io&&io.d(so),destroy_component(eo,so)}}}function create_default_slot$1e(to){let ue,eo;return ue=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_1$13]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&131199&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1P(to){let ue,eo,no,ro;return ue=new TestimonialPage({props:{enabled:to[5].testimonialsEnabled,$$slots:{default:[create_default_slot$1e]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0,no||(ro=listen(window,"keydown",to[8]),no=!0)},p(oo,[io]){const so={};io&32&&(so.enabled=oo[5].testimonialsEnabled),io&131199&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo),no=!1,ro()}}}function instance$1S(to,ue,eo){let no,ro,oo,io,so,ao;component_subscribe(to,goto,$o=>eo(14,ro=$o)),component_subscribe(to,auth,$o=>eo(9,oo=$o)),component_subscribe(to,params,$o=>eo(15,io=$o)),component_subscribe(to,organisation,$o=>eo(5,so=$o)),component_subscribe(to,admin,$o=>eo(6,ao=$o));const lo=io["?code"];let uo,co=!1,fo=!1,po,mo;async function _o(){if(!(!uo.validate()||mo))try{if(eo(2,fo=!0),no){const $o=oo.user.email,wo=oo.user.tenantId;await auth.updateSelf({password:po,forceResetPassword:!1}),oo.user||await auth.login($o,po,wo),ro("../portal/")}else await auth.resetPassword(po,lo),notifications.success("Password reset successfully"),ro("./login")}catch($o){eo(2,fo=!1),notifications.error($o.message||"Unable to reset password")}}onMount(async()=>{try{await auth.getSelf(),await organisation.init()}catch{notifications.error("Error getting org config")}eo(1,co=!0)});const ho=$o=>{$o.key==="Enter"&&_o()};function go($o){uo=$o,eo(0,uo)}function bo($o){po=$o,eo(3,po)}function vo($o){mo=$o,eo(4,mo)}return to.$$.update=()=>{var $o;to.$$.dirty&512&&(no=($o=oo==null?void 0:oo.user)==null?void 0:$o.forceResetPassword)},[uo,co,fo,po,mo,so,ao,_o,ho,oo,go,bo,vo]}class Reset extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1S,create_fragment$1P,safe_not_equal,{})}}function create_if_block$_(to){let ue;const eo=to[2].default,no=create_slot(eo,to,to[1],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&2)&&update_slot_base(no,eo,ro,ro[1],ue?get_slot_changes(eo,ro[1],oo,null):get_all_dirty_from_scope(ro[1]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_fragment$1O(to){let ue,eo,no=(!to[0].user||to[0].user.forceResetPassword)&&create_if_block$_(to);return{c(){no&&no.c(),ue=empty$4()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){!ro[0].user||ro[0].user.forceResetPassword?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$_(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$1R(to,ue,eo){var ao,lo,uo;let no,ro,oo;component_subscribe(to,admin,co=>eo(3,no=co)),component_subscribe(to,auth,co=>eo(0,ro=co)),component_subscribe(to,redirect,co=>eo(4,oo=co));let{$$slots:io={},$$scope:so}=ue;if(ro.user&&!ro.user.forceResetPassword&&oo("../"),no!=null&&no.cloud&&((ao=no==null?void 0:no.checklist)!=null&&ao.branding)){let po=new URL(window.location.href).hostname.split("."),mo=po[0],_o=po.slice(-2).join("."),ho=getCookie("tenantId");(!ho||ho!==mo)&&setCookie("tenantId",mo,_o)}return!ro.user&&no.cloud&&!no.disableAccountPortal&&no.accountPortalUrl&&!((uo=(lo=no==null?void 0:no.checklist)==null?void 0:lo.sso)!=null&&uo.checked)&&(window.location.href=no.accountPortalUrl),to.$$set=co=>{"$$scope"in co&&eo(1,so=co.$$scope)},[ro,so,io]}let Layout$8=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1R,create_fragment$1O,safe_not_equal,{})}};function create_else_block$m(to){let ue;return{c(){ue=element("link"),attr(ue,"rel","icon"),attr(ue,"href","/builder/bblogo.png")},m(eo,no){insert$1(eo,ue,no)},p:noop$5,d(eo){eo&&detach(ue)}}}function create_if_block$Z(to){let ue;return{c(){ue=element("link"),attr(ue,"rel","icon"),attr(ue,"href",to[2])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&4&&attr(ue,"href",eo[2])},d(eo){eo&&detach(ue)}}}function create_fragment$1N(to){let ue,eo;document.title=ue=to[3];function no(io,so){return io[1]&&!io[0].user&&io[2]?create_if_block$Z:create_else_block$m}let ro=no(to),oo=ro(to);return{c(){oo.c(),eo=empty$4()},m(io,so){oo.m(document.head,null),append$2(document.head,eo)},p(io,[so]){so&8&&ue!==(ue=io[3])&&(document.title=ue),ro===(ro=no(io))&&oo?oo.p(io,so):(oo.d(1),oo=ro(io),oo&&(oo.c(),oo.m(eo.parentNode,eo)))},i:noop$5,o:noop$5,d(io){oo.d(io),detach(eo)}}}function instance$1Q(to,ue,eo){let no,ro,oo,io,so;component_subscribe(to,organisation,lo=>eo(5,io=lo)),component_subscribe(to,auth,lo=>eo(0,so=lo));let ao=!1;return onMount(async()=>{await organisation.init(),eo(1,ao=!0)}),to.$$.update=()=>{to.$$.dirty&32&&eo(4,no=io.platformTitle),to.$$.dirty&17&&eo(3,ro=!so.user&&no?no:"Budibase"),to.$$.dirty&32&&eo(2,oo=io.faviconUrl||"/builder/bblogo.png")},[so,ao,oo,ro,no,io]}let Branding$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1Q,create_fragment$1N,safe_not_equal,{})}};function instance$1P(to,ue,eo){let no,ro;return component_subscribe(to,redirect,oo=>eo(0,no=oo)),component_subscribe(to,auth,oo=>eo(1,ro=oo)),auth.checkQueryString(),to.$$.update=()=>{to.$$.dirty&3&&(hasBuilderPermissions(ro.user)?no("./portal"):ro.user&&no("./apps"))},[no,ro]}class Builder extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1P,null,safe_not_equal,{})}}const index_svelte_svelte_type_style_lang$c="";function create_if_block$Y(to){let ue,eo;return ue=new TestimonialPage({props:{$$slots:{default:[create_default_slot$1d]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&16777439&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_7$l(to){let ue,eo;return{c(){ue=text("Join "),eo=text(to[7])},m(no,ro){insert$1(no,ue,ro),insert$1(no,eo,ro)},p(no,ro){ro&128&&set_data(eo,no[7])},d(no){no&&(detach(ue),detach(eo))}}}function create_default_slot_6$m(to){let ue;return{c(){ue=text("Create your account to access your budibase apps!")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$p(to){let ue,eo,no,ro;return ue=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_7$l]},$$scope:{ctx:to}}}),no=new Body({props:{size:"M",$$slots:{default:[create_default_slot_6$m]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&16777344&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&16777216&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_if_block_1$z(to){let ue,eo,no,ro;return ue=new FancyInput({props:{label:"Password",value:to[2].password,type:"password",validateOn:"blur",validate:to[14],error:to[4].password,disabled:to[3]}}),ue.$on("change",to[15]),no=new FancyInput({props:{label:"Repeat password",value:to[2].confirmationPassword,type:"password",validate:to[16],error:to[4].confirmationPassword,disabled:to[3]}}),no.$on("change",to[17]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&4&&(so.value=oo[2].password),io&84&&(so.validate=oo[14]),io&16&&(so.error=oo[4].password),io&8&&(so.disabled=oo[3]),ue.$set(so);const ao={};io&4&&(ao.value=oo[2].confirmationPassword),io&20&&(ao.validate=oo[16]),io&16&&(ao.error=oo[4].confirmationPassword),io&8&&(ao.disabled=oo[3]),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_4$s(to){let ue,eo,no,ro,oo,io,so,ao;ue=new FancyInput({props:{label:"Email",value:to[2].email,disabled:!0,error:to[4].email}}),no=new FancyInput({props:{label:"First name",value:to[2].firstName,validate:to[11],error:to[4].firstName,disabled:to[3]}}),no.$on("change",to[12]),oo=new FancyInput({props:{label:"Last name (optional)",value:to[2].lastName,disabled:to[3]}}),oo.$on("change",to[13]);let lo=!to[0].isSSOEnforced&&create_if_block_1$z(to);return{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),lo&&lo.c(),so=empty$4()},m(uo,co){mount_component(ue,uo,co),insert$1(uo,eo,co),mount_component(no,uo,co),insert$1(uo,ro,co),mount_component(oo,uo,co),insert$1(uo,io,co),lo&&lo.m(uo,co),insert$1(uo,so,co),ao=!0},p(uo,co){const fo={};co&4&&(fo.value=uo[2].email),co&16&&(fo.error=uo[4].email),ue.$set(fo);const po={};co&4&&(po.value=uo[2].firstName),co&20&&(po.validate=uo[11]),co&16&&(po.error=uo[4].firstName),co&8&&(po.disabled=uo[3]),no.$set(po);const mo={};co&4&&(mo.value=uo[2].lastName),co&8&&(mo.disabled=uo[3]),oo.$set(mo),uo[0].isSSOEnforced?lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros()):lo?(lo.p(uo,co),co&1&&transition_in(lo,1)):(lo=create_if_block_1$z(uo),lo.c(),transition_in(lo,1),lo.m(so.parentNode,so))},i(uo){ao||(transition_in(ue.$$.fragment,uo),transition_in(no.$$.fragment,uo),transition_in(oo.$$.fragment,uo),transition_in(lo),ao=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(no.$$.fragment,uo),transition_out(oo.$$.fragment,uo),transition_out(lo),ao=!1},d(uo){uo&&(detach(eo),detach(ro),detach(io),detach(so)),destroy_component(ue,uo),destroy_component(no,uo),destroy_component(oo,uo),lo&&lo.d(uo)}}}function create_default_slot_3$F(to){let ue,eo,no={$$slots:{default:[create_default_slot_4$s]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[18](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){const io={};oo&16777309&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[18](null),destroy_component(ue,ro)}}}function create_default_slot_2$O(to){let ue;return{c(){ue=text("Create account")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$12(to){let ue,eo,no,ro,oo,io,so,ao,lo,uo;return ro=new Layout$o({props:{gap:"XS",noPadding:!0,$$slots:{default:[create_default_slot_5$p]},$$scope:{ctx:to}}}),io=new Layout$o({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_3$F]},$$scope:{ctx:to}}}),lo=new Button({props:{size:"L",disabled:Object.keys(to[4]).length>0||to[3],cta:!0,$$slots:{default:[create_default_slot_2$O]},$$scope:{ctx:to}}}),lo.$on("click",to[8]),{c(){ue=element("img"),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),so=space$1(),ao=element("div"),create_component(lo.$$.fragment),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=to[0].logoUrl||Logo$1)||attr(ue,"src",eo),attr(ue,"class","svelte-j2s60j")},m(co,fo){insert$1(co,ue,fo),insert$1(co,no,fo),mount_component(ro,co,fo),insert$1(co,oo,fo),mount_component(io,co,fo),insert$1(co,so,fo),insert$1(co,ao,fo),mount_component(lo,ao,null),uo=!0},p(co,fo){(!uo||fo&1&&!src_url_equal(ue.src,eo=co[0].logoUrl||Logo$1))&&attr(ue,"src",eo);const po={};fo&16777344&&(po.$$scope={dirty:fo,ctx:co}),ro.$set(po);const mo={};fo&16777311&&(mo.$$scope={dirty:fo,ctx:co}),io.$set(mo);const _o={};fo&24&&(_o.disabled=Object.keys(co[4]).length>0||co[3]),fo&16777216&&(_o.$$scope={dirty:fo,ctx:co}),lo.$set(_o)},i(co){uo||(transition_in(ro.$$.fragment,co),transition_in(io.$$.fragment,co),transition_in(lo.$$.fragment,co),uo=!0)},o(co){transition_out(ro.$$.fragment,co),transition_out(io.$$.fragment,co),transition_out(lo.$$.fragment,co),uo=!1},d(co){co&&(detach(ue),detach(no),detach(oo),detach(so),detach(ao)),destroy_component(ro,co),destroy_component(io,co),destroy_component(lo)}}}function create_default_slot$1d(to){let ue,eo;return ue=new Layout$o({props:{gap:"M",noPadding:!0,$$slots:{default:[create_default_slot_1$12]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&16777439&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$1M(to){let ue,eo,no,ro,oo=to[5]&&create_if_block$Y(to);return{c(){oo&&oo.c(),ue=empty$4()},m(io,so){oo&&oo.m(io,so),insert$1(io,ue,so),eo=!0,no||(ro=listen(window,"keydown",to[9]),no=!0)},p(io,[so]){io[5]?oo?(oo.p(io,so),so&32&&transition_in(oo,1)):(oo=create_if_block$Y(io),oo.c(),transition_in(oo,1),oo.m(ue.parentNode,ue)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros())},i(io){eo||(transition_in(oo),eo=!0)},o(io){transition_out(oo),eo=!1},d(io){io&&detach(ue),oo&&oo.d(io),no=!1,ro()}}}function instance$1O(to,ue,eo){let no,ro,oo,io,so,ao;component_subscribe(to,goto,Eo=>eo(19,oo=Eo)),component_subscribe(to,organisation,Eo=>eo(0,io=Eo)),component_subscribe(to,admin,Eo=>eo(10,so=Eo)),component_subscribe(to,params,Eo=>eo(20,ao=Eo));const lo=ao["?code"];let uo,co={},fo=!1,po={},mo=!1;async function _o(){if(uo.validate(),!(Object.keys(po).length>0)){eo(3,fo=!0);try{const{password:Eo,firstName:Lo,lastName:No}=co,Do=await users.acceptInvite(lo,Eo,Lo,No);notifications.success("Invitation accepted successfully"),auth.setOrg(Do.tenantId),await go()}catch(Eo){notifications.error(Eo.message),eo(3,fo=!1)}}}async function ho(){try{const Eo=await users.fetchInvite(lo);Eo!=null&&Eo.email&&eo(2,co.email=Eo==null?void 0:Eo.email,co),io.isSSOEnforced&&(await users.acceptInvite(lo),oo("../auth"))}catch(Eo){notifications.error(Eo.message)}}async function go(){try{await auth.login(co.email.trim(),co.password.trim()),notifications.success("Logged in successfully"),oo("../portal")}catch(Eo){notifications.error(Eo.message?Eo.message:"Something went wrong")}}onMount(async()=>{try{await organisation.init(),await ho(),eo(5,mo=!0)}catch{notifications.error("Error getting invite config")}});const bo=Eo=>{Eo.key==="Enter"&&_o()},vo=()=>{let Eo={firstName:co.firstName?void 0:"Please enter your first name"};eo(4,po=handleError({...po,...Eo}))},$o=Eo=>{eo(2,co={...co,firstName:Eo.detail})},wo=Eo=>{eo(2,co={...co,lastName:Eo.detail})},ko=()=>{let Eo={};function Lo(){if(co.password){if(co.password.length<ro)return`Please enter at least ${ro} characters`}else return"Please enter a password"}Eo.password=Lo(),Eo.confirmationPassword=!passwordsMatch(co.password,co.confirmationPassword)&&co.confirmationPassword?"Passwords must match":void 0,eo(4,po=handleError({...po,...Eo}))},So=Eo=>{eo(2,co={...co,password:Eo.detail})},To=()=>{let Eo={confirmationPassword:!passwordsMatch(co.password,co.confirmationPassword)&&co.password?"Passwords must match":void 0};eo(4,po=handleError({...po,...Eo}))},Io=Eo=>{eo(2,co={...co,confirmationPassword:Eo.detail})};function Ao(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{uo=Eo,eo(1,uo)})}return to.$$.update=()=>{to.$$.dirty&1&&eo(7,no=io.company||"Budibase"),to.$$.dirty&1024&&eo(6,ro=so.passwordMinLength??12)},[io,uo,co,fo,po,mo,ro,no,_o,bo,so,vo,$o,wo,ko,So,To,Io,Ao]}class Invite extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1O,create_fragment$1M,safe_not_equal,{})}}const BudibaseLogo_svelte_svelte_type_style_lang="";function create_fragment$1L(to){let ue,eo,no,ro;return{c(){ue=element("img"),src_url_equal(ue.src,eo=Logo$1)||attr(ue,"src",eo),attr(ue,"alt","Budibase Logo"),attr(ue,"class","svelte-19hn6ob")},m(oo,io){insert$1(oo,ue,io),no||(ro=listen(ue,"click",to[1]),no=!0)},p:noop$5,i:noop$5,o:noop$5,d(oo){oo&&detach(ue),no=!1,ro()}}}function instance$1N(to,ue,eo){let no;return component_subscribe(to,goto,oo=>eo(0,no=oo)),[no,()=>no("./apps")]}class BudibaseLogo extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$1N,create_fragment$1L,safe_not_equal,{})}}const index_svelte_svelte_type_style_lang$b="";function get_each_context$l(to,ue,eo){const no=to.slice();return no[2]=ue[eo],no}function create_if_block$X(to){let ue,eo,no,ro;return ue=new Layout$o({props:{$$slots:{default:[create_default_slot_1$11]},$$scope:{ctx:to}}}),no=new Button({props:{$$slots:{default:[create_default_slot$1c]},$$scope:{ctx:to}}}),no.$on("click",to[1]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const so={};io&32&&(so.$$scope={dirty:io,ctx:oo}),ue.$set(so);const ao={};io&32&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_4$r(to){let ue;return{c(){ue=text("Please upgrade your Budibase installation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$E(to){let ue;return{c(){ue=text(`We've detected that the version of Budibase you're using depends
|