@budibase/server 3.2.33 → 3.2.34

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.
@@ -471,7 +471,7 @@ function print() { __p += __j.call(arguments, '') }
471
471
  ${ao[2]?`font-weight:${ao[2]};`:""}
472
472
  ${ao[3]?`text-align:${ao[3]};`:""}
473
473
  ${ao[4]?`color:${ao[4]};`:""}
474
- `))&&attr(ue,"style",eo),(!ro||so&1&&no!==(no="spectrum-Body spectrum-Body--size"+ao[0]+" svelte-10a30y"))&&attr(ue,"class",no),(!ro||so&3)&&toggle_class(ue,"spectrum-Body--serif",ao[1])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a4(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{serif:io=!1}=ue,{weight:ao=null}=ue,{textAlign:so=null}=ue,{color:lo=null}=ue;return to.$$set=co=>{"size"in co&&eo(0,oo=co.size),"serif"in co&&eo(1,io=co.serif),"weight"in co&&eo(2,ao=co.weight),"textAlign"in co&&eo(3,so=co.textAlign),"color"in co&&eo(4,lo=co.color),"$$scope"in co&&eo(5,ro=co.$$scope)},[oo,io,ao,so,lo,ro,no]}class Body extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a4,create_fragment$a7,safe_not_equal,{size:0,serif:1,weight:2,textAlign:3,color:4})}}const Heading_svelte_svelte_type_style_lang="";function create_fragment$a6(to){let ue,eo,no,ro;const oo=to[5].default,io=create_slot(oo,to,to[4],null);return{c(){ue=element("h1"),io&&io.c(),attr(ue,"data-testid","typography-heading"),attr(ue,"style",eo=to[1]?`text-align:${to[1]}`:""),attr(ue,"class",no="spectrum-Heading spectrum-Heading--size"+to[0]+" spectrum-Heading--"+to[3]+" svelte-3sm8u5"),toggle_class(ue,"noPadding",to[2])},m(ao,so){insert$1(ao,ue,so),io&&io.m(ue,null),ro=!0},p(ao,[so]){io&&io.p&&(!ro||so&16)&&update_slot_base(io,oo,ao,ao[4],ro?get_slot_changes(oo,ao[4],so,null):get_all_dirty_from_scope(ao[4]),null),(!ro||so&2&&eo!==(eo=ao[1]?`text-align:${ao[1]}`:""))&&attr(ue,"style",eo),(!ro||so&9&&no!==(no="spectrum-Heading spectrum-Heading--size"+ao[0]+" spectrum-Heading--"+ao[3]+" svelte-3sm8u5"))&&attr(ue,"class",no),(!ro||so&13)&&toggle_class(ue,"noPadding",ao[2])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a3(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{textAlign:io=void 0}=ue,{noPadding:ao=!1}=ue,{weight:so="default"}=ue;return to.$$set=lo=>{"size"in lo&&eo(0,oo=lo.size),"textAlign"in lo&&eo(1,io=lo.textAlign),"noPadding"in lo&&eo(2,ao=lo.noPadding),"weight"in lo&&eo(3,so=lo.weight),"$$scope"in lo&&eo(4,ro=lo.$$scope)},[oo,io,ao,so,ro,no]}class Heading extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a3,create_fragment$a6,safe_not_equal,{size:0,textAlign:1,noPadding:2,weight:3})}}var HTTPMethod=(to=>(to.POST="POST",to.PATCH="PATCH",to.GET="GET",to.PUT="PUT",to.DELETE="DELETE",to))(HTTPMethod||{});const BannedSearchTypes=[FieldType.LINK,FieldType.ATTACHMENT_SINGLE,FieldType.ATTACHMENTS,FieldType.FORMULA,FieldType.JSON,FieldType.ATTACHMENT_SINGLE,FieldType.SIGNATURE_SINGLE,"jsonarray","queryarray"],Cookies={Auth:"budibase:auth",CurrentApp:"budibase:currentapp",ReturnUrl:"budibase:returnurl",AccountReturnUrl:"budibase:account:returnurl",OnboardingProcessCorrelationKey:BpmCorrelationKey.ONBOARDING},TableNames$1={USERS:"ta_users"},BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer}],BudibaseRoleOptions=[{label:"Account admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all apps and settings in your account",sortOrder:1},{label:"Creator",value:BudibaseRoles.Creator,subtitle:"Can create and edit apps they have access to",sortOrder:2},{label:"App user",value:BudibaseRoles.AppUser,subtitle:"Can only use published apps they have access to",sortOrder:3}],ExtendedBudibaseRoleOptions=[{label:"Account holder",value:BudibaseRoles.Owner,sortOrder:0},...BudibaseRoleOptions,...BudibaseRoleOptionsOld],PlanType={FREE:"free",TEAM:"team",PRO:"pro",BUSINESS:"business",PREMIUM:"premium",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles$2={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},ContextScopes$2={Local:"local",Global:"global"},TypeIconMap$1={[FieldType.STRING]:"Text",[FieldType.OPTIONS]:"Dropdown",[FieldType.DATETIME]:"Calendar",[FieldType.BARCODEQR]:"Camera",[FieldType.SIGNATURE_SINGLE]:"AnnotatePen",[FieldType.LONGFORM]:"TextAlignLeft",[FieldType.ARRAY]:"Duplicate",[FieldType.NUMBER]:"123",[FieldType.BOOLEAN]:"Boolean",[FieldType.ATTACHMENTS]:"DocumentFragmentGroup",[FieldType.ATTACHMENT_SINGLE]:"DocumentFragment",[FieldType.LINK]:"DataCorrelated",[FieldType.FORMULA]:"Calculator",[FieldType.AI]:"MagicWand",[FieldType.JSON]:"Brackets",[FieldType.BIGINT]:"TagBold",[FieldType.AUTO]:"Shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"UserGroup",[BBReferenceFieldSubType.USERS]:"UserGroup"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"User"}},OptionColours=[...new Array(12).keys()].map(to=>`hsla(${(to+1)*222%360}, 90%, 75%, 0.3)`),FilterOperator={ANY:"any",ALL:"all"},OnEmptyFilter={RETURN_ALL:"all",RETURN_NONE:"none"},FilterValueType={BINDING:"Binding",VALUE:"Value"},FieldPermissions$1={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$1=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ContextScopes$2,Cookies,DEFAULT_BB_DATASOURCE_ID:DEFAULT_BB_DATASOURCE_ID$1,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions:FieldPermissions$1,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles:Roles$2,SqlNumberTypeRangeMap,TableNames:TableNames$1,TypeIconMap:TypeIconMap$1},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=to=>({getAnalyticsStatus:async()=>await to.get({url:"/api/bbtel"}),analyticsPing:async ue=>await to.post({url:"/api/bbtel/ping",body:{...ue,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=to=>({generateCronExpression:async ue=>await to.post({url:"/api/ai/cron",body:{prompt:ue}})}),buildAppEndpoints=to=>({fetchAppPackage:async ue=>await to.get({url:`/api/applications/${ue}/appPackage`}),saveAppMetadata:async(ue,eo)=>await to.put({url:`/api/applications/${ue}`,body:eo}),publishAppChanges:async ue=>await to.post({url:`/api/applications/${ue}/publish`}),revertAppChanges:async ue=>await to.post({url:`/api/dev/${ue}/revert`}),updateAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/update`}),revertAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/revert`}),getAppDeployments:async()=>await to.get({url:"/api/deployments"}),createApp:async ue=>await to.post({url:"/api/applications",body:ue,json:!1}),duplicateApp:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/duplicate`,body:eo,json:!1}),updateAppFromExport:async(ue,eo)=>{const no=getDevAppID(ue);return await to.post({url:`/api/applications/${no}/import`,body:eo,json:!1})},importApps:async ue=>await to.post({url:"/api/cloud/import",body:ue,json:!1}),unpublishApp:async ue=>await to.post({url:`/api/applications/${ue}/unpublish`}),deleteApp:async ue=>await to.delete({url:`/api/applications/${ue}`}),releaseAppLock:async ue=>await to.delete({url:`/api/dev/${ue}/lock`}),fetchSystemDebugInfo:async()=>await to.get({url:"/api/debug/diagnostics"}),syncApp:async ue=>await to.post({url:`/api/applications/${ue}/sync`}),getApps:async()=>await to.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async ue=>await to.get({url:`/api/${ue}/components/definitions`}),addSampleData:async ue=>await to.post({url:`/api/applications/${ue}/sample`}),setRevertableVersion:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/setRevertableVersion`,body:{revertableVersion:eo}})}),buildAttachmentEndpoints=to=>{const ue={getSignedDatasourceURL:async(eo,no,ro)=>await to.post({url:`/api/attachments/${eo}/url`,body:{bucket:no,key:ro}})};return{...ue,uploadAttachment:async(eo,no)=>await to.post({url:`/api/attachments/${eo}/upload`,body:no,json:!1}),uploadBuilderAttachment:async eo=>await to.post({url:"/api/attachments/process",body:eo,json:!1}),externalUpload:async(eo,no,ro,oo)=>{const{signedUrl:io,publicUrl:ao}=await ue.getSignedDatasourceURL(eo,no,ro);return io?(await to.put({url:io,body:oo,json:!1,external:!0}),{publicUrl:ao}):{publicUrl:void 0}},downloadAttachment:async(eo,no,ro)=>await to.get({url:`/api/${eo}/rows/${no}/attachment/${ro}`,parseResponse:oo=>oo,suppressErrors:!0})}},buildAuthEndpoints=to=>({logIn:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/login`,body:{username:eo,password:no}}),logOut:async()=>await to.post({url:"/api/global/auth/logout"}),setInitInfo:async ue=>await to.post({url:"/api/global/auth/init",body:ue}),getInitInfo:async()=>await to.get({url:"/api/global/auth/init"}),requestForgotPassword:async(ue,eo)=>await to.post({url:`/api/global/auth/${ue}/reset`,body:{email:eo}}),resetPassword:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/reset/update`,body:{password:eo,resetCode:no}})}),buildAutomationEndpoints=to=>({triggerAutomation:async(ue,eo,no)=>await to.post({url:`/api/automations/${ue}/trigger`,body:{fields:eo,timeout:no}}),testAutomation:async(ue,eo)=>await to.post({url:`/api/automations/${ue}/test`,body:eo}),getAutomations:async()=>await to.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await to.get({url:"/api/automations/definitions/list"}),createAutomation:async ue=>await to.post({url:"/api/automations",body:ue}),updateAutomation:async ue=>await to.put({url:"/api/automations",body:ue}),deleteAutomation:async(ue,eo)=>await to.delete({url:`/api/automations/${ue}/${eo}`}),getAutomationLogs:async ue=>await to.post({url:"/api/automations/logs/search",body:ue}),clearAutomationLogErrors:async(ue,eo)=>await to.delete({url:"/api/automations/logs",body:{appId:eo,automationId:ue}})}),buildConfigEndpoints=to=>({saveConfig:async ue=>await to.post({url:"/api/global/configs",body:ue}),getConfig:async ue=>await to.get({url:`/api/global/configs/${ue}`}),deleteConfig:async(ue,eo)=>await to.delete({url:`/api/global/configs/${ue}/${eo}`}),getTenantConfig:async ue=>await to.get({url:`/api/global/configs/public?tenantId=${ue}`}),getOIDCConfig:async ue=>await to.get({url:`/api/global/configs/public/oidc?tenantId=${ue}`}),getChecklist:async ue=>await to.get({url:`/api/global/configs/checklist?tenantId=${ue}`}),uploadLogo:async ue=>await to.post({url:"/api/global/configs/upload/settings/logoUrl",body:ue,json:!1}),uploadFavicon:async ue=>await to.post({url:"/api/global/configs/upload/settings/faviconUrl",body:ue,json:!1}),uploadOIDCLogo:async(ue,eo)=>await to.post({url:`/api/global/configs/upload/logos_oidc/${ue}`,body:eo,json:!1}),getOIDCLogos:async()=>await to.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=to=>({getDatasources:async()=>await to.get({url:"/api/datasources"}),buildDatasourceSchema:async(ue,eo)=>await to.post({url:`/api/datasources/${ue}/schema`,body:{tablesFilter:eo}}),createDatasource:async ue=>await to.post({url:"/api/datasources",body:ue}),updateDatasource:async ue=>await to.put({url:`/api/datasources/${ue._id}`,body:ue}),deleteDatasource:async(ue,eo)=>await to.delete({url:`/api/datasources/${ue}/${eo}`}),validateDatasource:async ue=>await to.post({url:"/api/datasources/verify",body:{datasource:ue}}),fetchInfoForDatasource:async ue=>await to.post({url:"/api/datasources/info",body:{datasource:ue}}),fetchExternalSchema:async ue=>await to.get({url:`/api/datasources/${ue}/schema/external`})}),buildFlagEndpoints=to=>({getFlags:async()=>await to.get({url:"/api/users/flags"}),updateFlag:async(ue,eo)=>await to.post({url:"/api/users/flags",body:{flag:ue,value:eo}}),toggleUiFeature:async ue=>await to.post({url:`/api/beta/${ue}`})}),buildLayoutEndpoints=to=>({saveLayout:async ue=>await to.post({url:"/api/layouts",body:ue}),deleteLayout:async(ue,eo)=>await to.delete({url:`/api/layouts/${ue}/${eo}`})}),buildOtherEndpoints=to=>({getEnvironment:async()=>await to.get({url:"/api/system/environment"}),getSystemStatus:async()=>await to.get({url:"/api/system/status"}),getIntegrations:async()=>await to.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await to.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await to.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=to=>({getPermissionForResource:async ue=>await to.get({url:`/api/permission/${ue}`}),updatePermissionForResource:async(ue,eo,no)=>await to.post({url:`/api/permission/${eo}/${ue}/${no}`}),removePermissionFromResource:async(ue,eo,no)=>await to.delete({url:`/api/permission/${eo}/${ue}/${no}`}),getDependants:async ue=>await to.get({url:`/api/permission/${ue}/dependants`})}),buildQueryEndpoints=to=>({executeQuery:async(ue,{pagination:eo,parameters:no}={})=>await to.post({url:`/api/v2/queries/${ue}`,body:{parameters:no,pagination:eo}}),fetchQueryDefinition:async ue=>await to.get({url:`/api/queries/${ue}`,cache:!0}),getQueries:async()=>await to.get({url:"/api/queries"}),saveQuery:async ue=>await to.post({url:"/api/queries",body:ue}),deleteQuery:async(ue,eo)=>await to.delete({url:`/api/queries/${ue}/${eo}`}),importQueries:async ue=>await to.post({url:"/api/queries/import",body:ue}),previewQuery:async ue=>await to.post({url:"/api/queries/preview",body:ue})}),buildRelationshipEndpoints=to=>({fetchRelationshipData:async(ue,eo,no)=>{const ro=await to.get({url:`/api/${ue}/${eo}/enrich?field=${no}`});return no?ro[no]||[]:[ro]}}),buildRoleEndpoints=to=>({deleteRole:async(ue,eo)=>await to.delete({url:`/api/roles/${ue}/${eo}`}),saveRole:async ue=>await to.post({url:"/api/roles",body:ue}),getRoles:async()=>await to.get({url:"/api/roles"}),getRolesForApp:async ue=>await to.get({url:`/api/global/roles/${ue}`}),getAccessibleRoles:async()=>await to.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=to=>({fetchClientAppRoutes:async()=>await to.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await to.get({url:"/api/routing"})}),buildRowEndpoints=to=>({fetchRow:async(ue,eo)=>await to.get({url:`/api/${ue}/rows/${eo}`}),saveRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.post({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},patchRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.patch({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},deleteRow:async(ue,eo)=>await to.delete({url:`/api/${ue}/rows`,body:{_id:eo}}),deleteRows:async(ue,eo)=>(eo.forEach(no=>{typeof no=="object"&&(no==null||delete no._viewId)}),await to.delete({url:`/api/${ue}/rows`,body:{rows:eo}})),exportRows:async(ue,eo,no)=>await to.post({url:`/api/${ue}/rows/exportRows?format=${eo}`,body:no,parseResponse:async ro=>await ro.text()})}),buildScreenEndpoints=to=>({saveScreen:async ue=>await to.post({url:"/api/screens",body:ue}),deleteScreen:async(ue,eo)=>await to.delete({url:`/api/screens/${ue}/${eo}`})}),buildTableEndpoints=to=>({fetchTableDefinition:async ue=>await to.get({url:`/api/tables/${ue}`,cache:!0}),fetchTableData:async ue=>await to.get({url:`/api/${ue}/rows`}),searchTable:async(ue,eo)=>await to.post({url:`/api/${ue}/search`,body:eo}),importTableData:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/import`,body:{rows:eo,identifierFields:no}}),csvToJson:async ue=>await to.post({url:"/api/convert/csvToJson",body:{csvString:ue}}),getTables:async()=>await to.get({url:"/api/tables"}),getTable:async ue=>await to.get({url:`/api/tables/${ue}`}),saveTable:async ue=>await to.post({url:"/api/tables",body:ue}),deleteTable:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/${eo}`}),validateNewTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateNewTableImport",body:{rows:ue,schema:eo}}),validateExistingTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateExistingTableImport",body:{rows:ue,tableId:eo}}),migrateColumn:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/migrate`,body:{oldColumn:eo,newColumn:no}})}),buildTemplateEndpoints=to=>({getEmailTemplateDefinitions:async()=>await to.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await to.get({url:"/api/global/template/email"}),saveEmailTemplate:async ue=>await to.post({url:"/api/global/template",body:ue}),getAppTemplates:async()=>await to.get({url:"/api/templates"})}),buildUserEndpoints=to=>({getUsers:async()=>await to.get({url:"/api/global/users"}),searchUsers:async ue=>await to.post({url:"/api/global/users/search",body:ue}),getUser:async ue=>await to.get({url:`/api/global/users/${ue}`}),updateOwnMetadata:async ue=>await to.post({url:"/api/users/metadata/self",body:ue}),createAdminUser:async ue=>await to.post({url:"/api/global/users/init",body:ue}),saveUser:async ue=>await to.post({url:"/api/global/users",body:ue}),createUsers:async(ue,eo)=>(await to.post({url:"/api/global/users/bulk",body:{create:{users:ue,groups:eo}}})).created,deleteUser:async ue=>await to.delete({url:`/api/global/users/${ue}`}),deleteUsers:async ue=>(await to.post({url:"/api/global/users/bulk",body:{delete:{users:ue}}})).deleted,onboardUsers:async ue=>await to.post({url:"/api/global/users/onboard",body:ue}),updateUserInvite:async(ue,eo)=>await to.post({url:`/api/global/users/invite/update/${ue}`,body:eo}),getUserInvite:async ue=>await to.get({url:`/api/global/users/invite/${ue}`}),getUserInvites:async()=>await to.get({url:"/api/global/users/invites"}),inviteUsers:async ue=>await to.post({url:"/api/global/users/multi/invite",body:ue}),removeUserInvites:async ue=>await to.post({url:"/api/global/users/multi/invite/delete",body:ue}),acceptInvite:async ue=>await to.post({url:"/api/global/users/invite/accept",body:ue}),getUserCountByApp:async ue=>(await to.get({url:`/api/global/users/count/${ue}`})).userCount,addAppBuilder:async(ue,eo)=>await to.post({url:`/api/global/users/${ue}/app/${eo}/builder`}),removeAppBuilder:async(ue,eo)=>await to.delete({url:`/api/global/users/${ue}/app/${eo}/builder`}),getAccountHolder:async()=>await to.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=to=>({generateAPIKey:async()=>{const ue=await to.post({url:"/api/global/self/api_key"});return ue==null?void 0:ue.apiKey},fetchDeveloperInfo:async()=>to.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await to.get({url:"/api/self"}),fetchBuilderSelf:async()=>await to.get({url:"/api/global/self"}),updateSelf:async ue=>await to.post({url:"/api/global/self",body:ue})}),buildViewEndpoints=to=>({fetchViewData:async(ue,{field:eo,groupBy:no,calculation:ro})=>{const oo=new URLSearchParams;ro&&(oo.set("field",eo),oo.set("calculation",ro)),no&&oo.set("group",no);const io=eo?`/api/views/${encodeURIComponent(ue)}?${oo}`:`/api/views/${encodeURIComponent(ue)}`;return await to.get({url:io})},exportView:async(ue,eo)=>{const no=encodeURIComponent(ue);return await to.get({url:`/api/views/export?view=${no}&format=${eo}`,parseResponse:async ro=>await ro.text()})},saveView:async ue=>await to.post({url:"/api/views",body:ue}),deleteView:async ue=>await to.delete({url:`/api/views/${encodeURIComponent(ue)}`})}),buildViewV2Endpoints=to=>({fetchDefinition:async ue=>await to.get({url:`/api/v2/views/${encodeURIComponent(ue)}`,cache:!0}),create:async ue=>await to.post({url:"/api/v2/views",body:ue}),update:async ue=>await to.put({url:`/api/v2/views/${encodeURIComponent(ue.id)}`,body:ue}),fetch:async(ue,eo)=>await to.post({url:`/api/v2/views/${encodeURIComponent(ue)}/search`,body:eo}),delete:async ue=>await to.delete({url:`/api/v2/views/${encodeURIComponent(ue)}`})}),buildLicensingEndpoints=to=>({activateLicenseKey:async ue=>to.post({url:"/api/global/license/key",body:{licenseKey:ue}}),deleteLicenseKey:async()=>to.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await to.get({url:"/api/global/license/key"})}catch(ue){if(ue.status!==404)throw ue}},activateOfflineLicense:async ue=>to.post({url:"/api/global/license/offline",body:{offlineLicenseToken:ue}}),deleteOfflineLicense:async()=>to.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await to.get({url:"/api/global/license/offline"})}catch(ue){if(ue.status!==404)throw ue}},getOfflineLicenseIdentifier:async()=>await to.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>to.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>to.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=to=>{async function ue(eo,no,ro,oo){return await to.post({url:`/api/global/groups/${eo}/${no}`,body:{[ro]:oo}})}return{saveGroup:async eo=>await to.post({url:"/api/global/groups",body:eo}),getGroups:async()=>(await to.get({url:"/api/global/groups"})).data,getGroup:async eo=>await to.get({url:`/api/global/groups/${eo}`}),deleteGroup:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/${no}`}),getGroupUsers:async({id:eo,bookmark:no,emailSearch:ro})=>{let oo=`/api/global/groups/${eo}/users?`;return no&&(oo+=`bookmark=${no}&`),ro&&(oo+=`emailSearch=${ro}`),await to.get({url:oo})},addUsersToGroup:async(eo,no)=>ue(eo,"users","add",no),removeUsersFromGroup:async(eo,no)=>ue(eo,"users","remove",no),addAppsToGroup:async(eo,no)=>ue(eo,"apps","add",no),removeAppsFromGroup:async(eo,no)=>ue(eo,"apps","remove",no),addGroupAppBuilder:async(eo,no)=>await to.post({url:`/api/global/groups/${eo}/app/${no}/builder`}),removeGroupAppBuilder:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/app/${no}/builder`})}},buildPluginEndpoints=to=>({uploadPlugin:async ue=>await to.post({url:"/api/plugin/upload",body:ue,json:!1}),createPlugin:async ue=>await to.post({url:"/api/plugin",body:ue}),getPlugins:async()=>await to.get({url:"/api/plugin"}),deletePlugin:async ue=>await to.delete({url:`/api/plugin/${ue}`})}),buildBackupEndpoints=to=>({createManualBackup:async ue=>await to.post({url:`/api/apps/${ue}/backups`}),searchBackups:async(ue,eo)=>await to.post({url:`/api/apps/${ue}/backups/search`,body:eo}),deleteBackup:async(ue,eo)=>await to.delete({url:`/api/apps/${ue}/backups/${eo}`}),restoreBackup:async(ue,eo,no)=>await to.post({url:`/api/apps/${ue}/backups/${eo}/import`,body:{name:no}})}),buildEnvironmentVariableEndpoints=to=>({checkEnvironmentVariableStatus:async()=>await to.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await to.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async ue=>await to.post({url:"/api/env/variables",body:ue}),deleteEnvironmentVariable:async ue=>await to.delete({url:`/api/env/variables/${ue}`}),updateEnvironmentVariable:async(ue,eo)=>await to.patch({url:`/api/env/variables/${ue}`,body:eo})}),buildEventEndpoints=to=>({publishEvent:async ue=>await to.post({url:"/api/global/event/publish",body:{type:ue}})}),buildAuditLogEndpoints=to=>({searchAuditLogs:async ue=>await to.post({url:"/api/global/auditlogs/search",body:ue}),getEventDefinitions:async()=>await to.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:ue=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(ue))}`}),buildLogsEndpoints=to=>({getSystemLogs:async()=>await to.get({url:"/api/system/logs",json:!1,parseResponse:async ue=>ue})}),buildMigrationEndpoints=to=>({getMigrationStatus:async()=>await to.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=to=>({fetch:async ue=>(await to.get({url:`/api/tables/${ue}/actions`})).actions,create:async(ue,eo)=>await to.post({url:`/api/tables/${ue}/actions`,body:{name:eo}}),delete:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}`}),enableView:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),disableView:async(ue,eo,no)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),trigger:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/trigger`,body:{rowId:no}})}),APISessionID=uuid$2(),createAPIClient=(to={})=>{let ue={};const eo=async(lo,co,uo=!1)=>{let fo=lo.statusText,po=null;try{po=await lo.json(),po!=null&&po.message?fo=po.message:po!=null&&po.error&&(fo=po.error)}catch{}return{message:fo,json:po,status:lo.status,url:lo.url,method:co,handled:!0,suppressErrors:uo}},no=(lo,co,uo)=>({message:lo,json:null,status:400,url:co,method:uo,handled:!0,suppressErrors:!1}),ro=async lo=>{let{json:co,method:uo,external:fo,body:po,url:ho,parseResponse:_o,suppressErrors:go}=lo;co=co&&uo!==HTTPMethod.GET;let bo={Accept:"application/json"};bo[Header$1.SESSION_ID]=APISessionID,fo||(bo[Header$1.API_VER]=ApiVersion),co&&(bo["Content-Type"]="application/json"),to!=null&&to.attachHeaders&&to.attachHeaders(bo);let vo=po;if(co)try{vo=JSON.stringify(po)}catch{throw no("Invalid JSON body",ho,uo)}let yo;try{yo=await fetch(ho,{method:uo,headers:bo,body:vo,credentials:"same-origin"})}catch{throw delete ue[ho],no("Failed to send request",ho,uo)}if(yo.status>=200&&yo.status<400){oo(yo);try{return yo.status===204?void 0:_o?await _o(yo):await yo.json()}catch(wo){throw delete ue[ho],`Failed to parse response: ${wo}`}}else throw delete ue[ho],await eo(yo,uo,go)},oo=lo=>{if(!to.onMigrationDetected)return;const co=lo.headers.get(Header$1.MIGRATING_APP);co&&to.onMigrationDetected(co)},io=async lo=>{const co=lo.url;return ue[co]||(ue[co]=ro(lo),ue[co]=await ue[co]),await ue[co]},ao=lo=>async co=>{try{let uo={json:!0,external:!1,suppressErrors:!1,cache:!1,method:lo,...co},{url:fo,cache:po,external:ho}=uo;return ho||(uo.url=`/${fo}`.replace("//","/")),await(po&&(to==null?void 0:to.enableCaching)?io:ro)(uo)}catch(uo){throw to!=null&&to.onError&&to.onError(uo),uo}};let so={post:ao(HTTPMethod.POST),get:ao(HTTPMethod.GET),patch:ao(HTTPMethod.PATCH),delete:ao(HTTPMethod.DELETE),put:ao(HTTPMethod.PUT),error:lo=>{throw no(lo)},invalidateCache:()=>{ue={}},getAppID:()=>{var co;let lo={};return(co=to==null?void 0:to.attachHeaders)==null||co.call(to,lo),lo==null?void 0:lo[Header$1.APP_ID]}};return{...so,...buildAIEndpoints(so),...buildAnalyticsEndpoints(so),...buildAppEndpoints(so),...buildAttachmentEndpoints(so),...buildAuthEndpoints(so),...buildAutomationEndpoints(so),...buildConfigEndpoints(so),...buildDatasourceEndpoints(so),...buildFlagEndpoints(so),...buildLayoutEndpoints(so),...buildOtherEndpoints(so),...buildPermissionsEndpoints(so),...buildQueryEndpoints(so),...buildRelationshipEndpoints(so),...buildRoleEndpoints(so),...buildRouteEndpoints(so),...buildRowEndpoints(so),...buildScreenEndpoints(so),...buildTableEndpoints(so),...buildTemplateEndpoints(so),...buildUserEndpoints(so),...buildViewEndpoints(so),...buildSelfEndpoints(so),...buildLicensingEndpoints(so),...buildGroupsEndpoints(so),...buildPluginEndpoints(so),...buildBackupEndpoints(so),...buildEnvironmentVariableEndpoints(so),...buildEventEndpoints(so),...buildAuditLogEndpoints(so),...buildLogsEndpoints(so),...buildMigrationEndpoints(so),viewV2:buildViewV2Endpoints(so),rowActions:buildRowActionEndpoints(so)}},getJSONArrayDatasourceSchema=(to,ue)=>{let eo=to,no=[];ue.prefixKeys&&(no=ue.prefixKeys.concat(["schema"])),no=no.concat(ue.label.split(".").slice(2));for(let ro=0;ro<no.length;ro++)eo=eo==null?void 0:eo[no[ro]],eo!=null&&eo.schema&&(eo=eo.schema);return convertJSONSchemaToTableSchema(eo,{squashObjects:!0,prefixKeys:no})},convertJSONSchemaToTableSchema=(to,ue)=>{if(!to)return null;ue={squashObjects:!1,prefixKeys:null,...ue},to.schema?to=to.schema:to={value:to};const eo=extractJSONSchemaKeys(to,ue.squashObjects);let no={};return eo.forEach(({key:ro,type:oo})=>{no[ro]={type:oo,name:ro,prefixKeys:ue.prefixKeys}}),no},extractJSONSchemaKeys=(to,ue=!1)=>{if(!to||!Object.keys(to).length)return[];let eo=[];return Object.keys(to).forEach(no=>{const ro=to[no].type;if(ro==="json"&&ue){const oo=extractJSONSchemaKeys(to[no].schema,ue);eo=eo.concat(oo.map(io=>({key:`${no}.${io.key}`,type:io.type})))}else eo.push({key:no,type:ro==="array"?"jsonarray":ro})}),eo},generateQueryArraySchemas=(to,ue)=>{var eo,no;for(let ro in to)((eo=to[ro])==null?void 0:eo.type)==="json"&&((no=to[ro])==null?void 0:no.subtype)==="array"&&hasSchema(ue[ro])&&(to[ro]={schema:{schema:Object.entries(ue[ro]||{}).reduce((oo,[io,ao])=>(oo[io]={name:io,type:ao.type,subtype:ao.subtype},oo),{}),type:"json"},type:"json",subtype:"array"});return to};function setCookie(to,ue,eo){getCookie(to)&&removeCookie(to);let no=`${to}=${ue}; Path=/;`;eo&&(no+=` Domain=${eo};`),window.document.cookie=no}function getCookie(to){const eo=`; ${document.cookie}`.split(`; ${to}=`);if(eo.length===2)return eo[1].split(";").shift()}function removeCookie(to){getCookie(to)&&(document.cookie=`${to}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles$2.ADMIN]:5,[Roles$2.CREATOR]:4,[Roles$2.POWER]:3,[Roles$2.BASIC]:2,[Roles$2.PUBLIC]:1},getRolePriority=to=>RolePriorities[to]??0,sleep$2=to=>new Promise(ue=>setTimeout(ue,to)),sequential=to=>{let ue=[];return(...eo)=>new Promise((no,ro)=>{ue.push(async()=>{let oo,io;try{oo=await to(...eo)}catch(ao){io=ao}ue.shift(),ue.length&&ue[0](),io?ro(io):no(oo)}),ue.length===1&&ue[0]()})},debounce=(to,ue=1e3)=>{let eo;return async(...no)=>new Promise(ro=>{eo&&clearTimeout(eo),eo=setTimeout(async()=>{ro(await to(...no))},ue)})},domDebounce=to=>{let ue=!1,eo;return(...no)=>{eo=no,ue||(ue=!0,requestAnimationFrame(()=>{to(...eo),ue=!1}))}},buildFormBlockButtonConfig=to=>{const{_id:ue,actionType:eo,dataSource:no,notificationOverride:ro,actionUrl:oo,showDeleteButton:io,deleteButtonLabel:ao,showSaveButton:so,saveButtonLabel:lo}=to||{};if(!ue)return;const co=`${ue}-form`,uo=`${ue}-repeater`,fo=no==null?void 0:no.resourceId,po=io===!1?"":ao==null?void 0:ao.trim(),ho=so===!1?"":lo==null?void 0:lo.trim(),_o=[{"##eventHandlerType":"Validate Form",parameters:{componentId:co}},{"##eventHandlerType":"Save Row",parameters:{providerId:co,tableId:fo,notificationOverride:ro,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...eo!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:co}}],...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],go=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:fo,rowId:`{{ ${makePropSafe(uo)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(uo)}.${makePropSafe("_rev")} }}`,notificationOverride:ro}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],bo=[];return["Update","Create"].includes(eo)&&so!==!1&&bo.push({text:ho||"Save",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:_o,type:"cta"}),eo==="Update"&&io!==!1&&bo.push({text:po||"Delete",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:go,quiet:!0,type:"warning"}),bo},buildMultiStepFormBlockDefaultProps=to=>{const{_id:ue,stepCount:eo,currentStep:no,actionType:ro,dataSource:oo}=to||{};if(!ue||!eo)return;const io=`Step {{ [${ue}-form].[__currentStep] }}`,ao=oo==null?void 0:oo.resourceId,so=`${ue}-form`;let lo=[];return no!==0&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:so},"##eventHandlerType":"Change Form Step"}]}),no!==eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{parameters:{type:"next",componentId:so},"##eventHandlerType":"Change Form Step"}]}),ro!=="View"&&no===eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{"##eventHandlerType":"Save Row",parameters:{tableId:ao,providerId:so}},...ro!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:so}}]]}),{buttons:lo,title:io}};function parseFilter(to){if(!(to!=null&&to.groups))return to;const ue=lodashExports.cloneDeep(to);return ue.groups=ue.groups.map(eo=>(eo.filters=eo.filters.filter(no=>no.field&&no.operator),eo.filters.length?eo:null)).filter(eo=>eo),ue}const isBetterSample=(to,ue)=>{if(ue==null&&to!=null)return!0;if(ue!=null&&to==null)return!1;const eo=typeof ue,no=typeof to;return eo!==no?!1:no==="string"&&to.length>ue.length||no==="object"&&Object.keys(to).length>Object.keys(ue).length},generateGoldenSample=to=>{let ue={};return to==null||to.slice(0,100).forEach(eo=>{Object.keys(eo).forEach(no=>{isBetterSample(eo[no],ue[no])&&(ue[no]=eo[no])})}),ue};function getTableFields(to,ue){const eo=to.find(ro=>ro._id===ue.tableId);return!eo||!eo.sql?[]:getFields(to,Object.values(eo.schema),{allowLinks:!1}).map(ro=>({...ro,name:`${ue.name}.${ro.name}`}))}function getFields(to,ue,{allowLinks:eo}={allowLinks:!0}){let no=ue.filter(oo=>!BannedSearchTypes.includes(oo.type));if(eo){const oo=ue.filter(io=>io.type==="link");for(let io of oo)no=no.concat(getTableFields(to,io))}const ro=ue.filter(oo=>oo.type==="formula"&&oo.formulaType==="static");return no.concat(ro)}const getColumnIcon=to=>{if(to.schema.icon)return to.schema.icon;if(to.calculationType)return"Calculator";if(to.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(to.schema))return"User";const{type:ue,subtype:eo}=to.schema;return(typeof TypeIconMap$1[ue]=="object"&&eo?TypeIconMap$1[ue][eo]:TypeIconMap$1[ue])||"Text"},memo=to=>{const ue=writable(to);let eo=JSON.stringify(to);const no=ro=>{const oo=JSON.stringify(ro);oo!==eo&&(ue.set(ro),eo=oo)};return{subscribe:ue.subscribe,set:no,update:ro=>{let oo=JSON.parse(eo);const io=ro(oo);no(io)}}},derivedMemo=(to,ue)=>{const eo=derived(to,ue),no=memo(get_store_value(eo));return eo.subscribe(no.set),no},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(to=>{PACKET_TYPES_REVERSE[PACKET_TYPES[to]]=to});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to&&to.buffer instanceof ArrayBuffer,encodePacket=({type:to,data:ue},eo,no)=>withNativeBlob$1&&ue instanceof Blob?eo?no(ue):encodeBlobAsBase64(ue,no):withNativeArrayBuffer$2&&(ue instanceof ArrayBuffer||isView$1(ue))?eo?no(ue):encodeBlobAsBase64(new Blob([ue]),no):no(PACKET_TYPES[to]+(ue||"")),encodeBlobAsBase64=(to,ue)=>{const eo=new FileReader;return eo.onload=function(){const no=eo.result.split(",")[1];ue("b"+(no||""))},eo.readAsDataURL(to)};function toArray$2(to){return to instanceof Uint8Array?to:to instanceof ArrayBuffer?new Uint8Array(to):new Uint8Array(to.buffer,to.byteOffset,to.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(to,ue){if(withNativeBlob$1&&to.data instanceof Blob)return to.data.arrayBuffer().then(toArray$2).then(ue);if(withNativeArrayBuffer$2&&(to.data instanceof ArrayBuffer||isView$1(to.data)))return ue(toArray$2(to.data));encodePacket(to,!1,eo=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),ue(TEXT_ENCODER.encode(eo))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let to=0;to<chars.length;to++)lookup$1[chars.charCodeAt(to)]=to;const decode$3=to=>{let ue=to.length*.75,eo=to.length,no,ro=0,oo,io,ao,so;to[to.length-1]==="="&&(ue--,to[to.length-2]==="="&&ue--);const lo=new ArrayBuffer(ue),co=new Uint8Array(lo);for(no=0;no<eo;no+=4)oo=lookup$1[to.charCodeAt(no)],io=lookup$1[to.charCodeAt(no+1)],ao=lookup$1[to.charCodeAt(no+2)],so=lookup$1[to.charCodeAt(no+3)],co[ro++]=oo<<2|io>>4,co[ro++]=(io&15)<<4|ao>>2,co[ro++]=(ao&3)<<6|so&63;return lo},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(to,ue)=>{if(typeof to!="string")return{type:"message",data:mapBinary(to,ue)};const eo=to.charAt(0);return eo==="b"?{type:"message",data:decodeBase64Packet(to.substring(1),ue)}:PACKET_TYPES_REVERSE[eo]?to.length>1?{type:PACKET_TYPES_REVERSE[eo],data:to.substring(1)}:{type:PACKET_TYPES_REVERSE[eo]}:ERROR_PACKET},decodeBase64Packet=(to,ue)=>{if(withNativeArrayBuffer$1){const eo=decode$3(to);return mapBinary(eo,ue)}else return{base64:!0,data:to}},mapBinary=(to,ue)=>{switch(ue){case"blob":return to instanceof Blob?to:new Blob([to]);case"arraybuffer":default:return to instanceof ArrayBuffer?to:to.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(to,ue)=>{const eo=to.length,no=new Array(eo);let ro=0;to.forEach((oo,io)=>{encodePacket(oo,!1,ao=>{no[io]=ao,++ro===eo&&ue(no.join(SEPARATOR))})})},decodePayload=(to,ue)=>{const eo=to.split(SEPARATOR),no=[];for(let ro=0;ro<eo.length;ro++){const oo=decodePacket(eo[ro],ue);if(no.push(oo),oo.type==="error")break}return no};function createPacketEncoderStream(){return new TransformStream({transform(to,ue){encodePacketToBinary(to,eo=>{const no=eo.length;let ro;if(no<126)ro=new Uint8Array(1),new DataView(ro.buffer).setUint8(0,no);else if(no<65536){ro=new Uint8Array(3);const oo=new DataView(ro.buffer);oo.setUint8(0,126),oo.setUint16(1,no)}else{ro=new Uint8Array(9);const oo=new DataView(ro.buffer);oo.setUint8(0,127),oo.setBigUint64(1,BigInt(no))}to.data&&typeof to.data!="string"&&(ro[0]|=128),ue.enqueue(ro),ue.enqueue(eo)})}})}let TEXT_DECODER;function totalLength(to){return to.reduce((ue,eo)=>ue+eo.length,0)}function concatChunks(to,ue){if(to[0].length===ue)return to.shift();const eo=new Uint8Array(ue);let no=0;for(let ro=0;ro<ue;ro++)eo[ro]=to[0][no++],no===to[0].length&&(to.shift(),no=0);return to.length&&no<to[0].length&&(to[0]=to[0].slice(no)),eo}function createPacketDecoderStream(to,ue){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const eo=[];let no=0,ro=-1,oo=!1;return new TransformStream({transform(io,ao){for(eo.push(io);;){if(no===0){if(totalLength(eo)<1)break;const so=concatChunks(eo,1);oo=(so[0]&128)===128,ro=so[0]&127,ro<126?no=3:ro===126?no=1:no=2}else if(no===1){if(totalLength(eo)<2)break;const so=concatChunks(eo,2);ro=new DataView(so.buffer,so.byteOffset,so.length).getUint16(0),no=3}else if(no===2){if(totalLength(eo)<8)break;const so=concatChunks(eo,8),lo=new DataView(so.buffer,so.byteOffset,so.length),co=lo.getUint32(0);if(co>Math.pow(2,53-32)-1){ao.enqueue(ERROR_PACKET);break}ro=co*Math.pow(2,32)+lo.getUint32(4),no=3}else{if(totalLength(eo)<ro)break;const so=concatChunks(eo,ro);ao.enqueue(decodePacket(oo?so:TEXT_DECODER.decode(so),ue)),no=0}if(ro===0||ro>to){ao.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(to){if(to)return mixin(to)}function mixin(to){for(var ue in Emitter.prototype)to[ue]=Emitter.prototype[ue];return to}Emitter.prototype.on=Emitter.prototype.addEventListener=function(to,ue){return this._callbacks=this._callbacks||{},(this._callbacks["$"+to]=this._callbacks["$"+to]||[]).push(ue),this};Emitter.prototype.once=function(to,ue){function eo(){this.off(to,eo),ue.apply(this,arguments)}return eo.fn=ue,this.on(to,eo),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(to,ue){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var eo=this._callbacks["$"+to];if(!eo)return this;if(arguments.length==1)return delete this._callbacks["$"+to],this;for(var no,ro=0;ro<eo.length;ro++)if(no=eo[ro],no===ue||no.fn===ue){eo.splice(ro,1);break}return eo.length===0&&delete this._callbacks["$"+to],this};Emitter.prototype.emit=function(to){this._callbacks=this._callbacks||{};for(var ue=new Array(arguments.length-1),eo=this._callbacks["$"+to],no=1;no<arguments.length;no++)ue[no-1]=arguments[no];if(eo){eo=eo.slice(0);for(var no=0,ro=eo.length;no<ro;++no)eo[no].apply(this,ue)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(to){return this._callbacks=this._callbacks||{},this._callbacks["$"+to]||[]};Emitter.prototype.hasListeners=function(to){return!!this.listeners(to).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick$1(to,...ue){return ue.reduce((eo,no)=>(to.hasOwnProperty(no)&&(eo[no]=to[no]),eo),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(to,ue){ue.useNativeTimers?(to.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),to.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(to.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),to.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(to){return typeof to=="string"?utf8Length(to):Math.ceil((to.byteLength||to.size)*BASE64_OVERHEAD)}function utf8Length(to){let ue=0,eo=0;for(let no=0,ro=to.length;no<ro;no++)ue=to.charCodeAt(no),ue<128?eo+=1:ue<2048?eo+=2:ue<55296||ue>=57344?eo+=3:(no++,eo+=4);return eo}function encode$3(to){let ue="";for(let eo in to)to.hasOwnProperty(eo)&&(ue.length&&(ue+="&"),ue+=encodeURIComponent(eo)+"="+encodeURIComponent(to[eo]));return ue}function decode$2(to){let ue={},eo=to.split("&");for(let no=0,ro=eo.length;no<ro;no++){let oo=eo[no].split("=");ue[decodeURIComponent(oo[0])]=decodeURIComponent(oo[1])}return ue}class TransportError extends Error{constructor(ue,eo,no){super(ue),this.description=eo,this.context=no,this.type="TransportError"}}class Transport extends Emitter{constructor(ue){super(),this.writable=!1,installTimerFunctions(this,ue),this.opts=ue,this.query=ue.query,this.socket=ue.socket}onError(ue,eo,no){return super.emitReserved("error",new TransportError(ue,eo,no)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(ue){this.readyState==="open"&&this.write(ue)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(ue){const eo=decodePacket(ue,this.socket.binaryType);this.onPacket(eo)}onPacket(ue){super.emitReserved("packet",ue)}onClose(ue){this.readyState="closed",super.emitReserved("close",ue)}pause(ue){}createUri(ue,eo={}){return ue+"://"+this._hostname()+this._port()+this.opts.path+this._query(eo)}_hostname(){const ue=this.opts.hostname;return ue.indexOf(":")===-1?ue:"["+ue+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(ue){const eo=encode$3(ue);return eo.length?"?"+eo:""}}const alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed=0,i$2=0,prev;function encode$2(to){let ue="";do ue=alphabet[to%length]+ue,to=Math.floor(to/length);while(to>0);return ue}function yeast(){const to=encode$2(+new Date);return to!==prev?(seed=0,prev=to):to+"."+encode$2(seed++)}for(;i$2<length;i$2++)map[alphabet[i$2]]=i$2;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(to){}const hasCORS=value$1;function XHR(to){const ue=to.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!ue||hasCORS))return new XMLHttpRequest}catch{}if(!ue)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty$1(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(ue){if(super(ue),this.polling=!1,typeof location<"u"){const no=location.protocol==="https:";let ro=location.port;ro||(ro=no?"443":"80"),this.xd=typeof location<"u"&&ue.hostname!==location.hostname||ro!==ue.port}const eo=ue&&ue.forceBase64;this.supportsBinary=hasXHR2&&!eo,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(ue){this.readyState="pausing";const eo=()=>{this.readyState="paused",ue()};if(this.polling||!this.writable){let no=0;this.polling&&(no++,this.once("pollComplete",function(){--no||eo()})),this.writable||(no++,this.once("drain",function(){--no||eo()}))}else eo()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(ue){const eo=no=>{if(this.readyState==="opening"&&no.type==="open"&&this.onOpen(),no.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(no)};decodePayload(ue,this.socket.binaryType).forEach(eo),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const ue=()=>{this.write([{type:"close"}])};this.readyState==="open"?ue():this.once("open",ue)}write(ue){this.writable=!1,encodePayload(ue,eo=>{this.doWrite(eo,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const ue=this.opts.secure?"https":"http",eo=this.query||{};return this.opts.timestampRequests!==!1&&(eo[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!eo.sid&&(eo.b64=1),this.createUri(ue,eo)}request(ue={}){return Object.assign(ue,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),ue)}doWrite(ue,eo){const no=this.request({method:"POST",data:ue});no.on("success",eo),no.on("error",(ro,oo)=>{this.onError("xhr post error",ro,oo)})}doPoll(){const ue=this.request();ue.on("data",this.onData.bind(this)),ue.on("error",(eo,no)=>{this.onError("xhr poll error",eo,no)}),this.pollXhr=ue}}class Request extends Emitter{constructor(ue,eo){super(),installTimerFunctions(this,eo),this.opts=eo,this.method=eo.method||"GET",this.uri=ue,this.data=eo.data!==void 0?eo.data:null,this.create()}create(){var ue;const eo=pick$1(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");eo.xdomain=!!this.opts.xd;const no=this.xhr=new XHR(eo);try{no.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){no.setDisableHeaderCheck&&no.setDisableHeaderCheck(!0);for(let ro in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(ro)&&no.setRequestHeader(ro,this.opts.extraHeaders[ro])}}catch{}if(this.method==="POST")try{no.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{no.setRequestHeader("Accept","*/*")}catch{}(ue=this.opts.cookieJar)===null||ue===void 0||ue.addCookies(no),"withCredentials"in no&&(no.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(no.timeout=this.opts.requestTimeout),no.onreadystatechange=()=>{var ro;no.readyState===3&&((ro=this.opts.cookieJar)===null||ro===void 0||ro.parseCookies(no)),no.readyState===4&&(no.status===200||no.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof no.status=="number"?no.status:0)},0))},no.send(this.data)}catch(ro){this.setTimeoutFn(()=>{this.onError(ro)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(ue){this.emitReserved("error",ue,this.xhr),this.cleanup(!0)}cleanup(ue){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,ue)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const ue=this.xhr.responseText;ue!==null&&(this.emitReserved("data",ue),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Request.requestsCount=0;Request.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const to="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(to,unloadHandler,!1)}}function unloadHandler(){for(let to in Request.requests)Request.requests.hasOwnProperty(to)&&Request.requests[to].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?ue=>Promise.resolve().then(ue):(ue,eo)=>eo(ue,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(ue){super(ue),this.supportsBinary=!ue.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const ue=this.uri(),eo=this.opts.protocols,no=isReactNative?{}:pick$1(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(no.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?eo?new WebSocket(ue,eo):new WebSocket(ue):new WebSocket(ue,eo,no)}catch(ro){return this.emitReserved("error",ro)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=ue=>this.onClose({description:"websocket connection closed",context:ue}),this.ws.onmessage=ue=>this.onData(ue.data),this.ws.onerror=ue=>this.onError("websocket error",ue)}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;encodePacket(no,this.supportsBinary,oo=>{const io={};try{usingBrowserWebSocket&&this.ws.send(oo)}catch{}ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const ue=this.opts.secure?"wss":"ws",eo=this.query||{};return this.opts.timestampRequests&&(eo[this.opts.timestampParam]=yeast()),this.supportsBinary||(eo.b64=1),this.createUri(ue,eo)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(ue=>{this.onError("webtransport error",ue)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(ue=>{const eo=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),no=ue.readable.pipeThrough(eo).getReader(),ro=createPacketEncoderStream();ro.readable.pipeTo(ue.writable),this.writer=ro.writable.getWriter();const oo=()=>{no.read().then(({done:ao,value:so})=>{ao||(this.onPacket(so),oo())}).catch(ao=>{})};oo();const io={type:"open"};this.query.sid&&(io.data=`{"sid":"${this.query.sid}"}`),this.writer.write(io).then(()=>this.onOpen())})}))}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;this.writer.write(no).then(()=>{ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var ue;(ue=this.transport)===null||ue===void 0||ue.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$8(to){if(to.length>2e3)throw"URI too long";const ue=to,eo=to.indexOf("["),no=to.indexOf("]");eo!=-1&&no!=-1&&(to=to.substring(0,eo)+to.substring(eo,no).replace(/:/g,";")+to.substring(no,to.length));let ro=re$1.exec(to||""),oo={},io=14;for(;io--;)oo[parts[io]]=ro[io]||"";return eo!=-1&&no!=-1&&(oo.source=ue,oo.host=oo.host.substring(1,oo.host.length-1).replace(/;/g,":"),oo.authority=oo.authority.replace("[","").replace("]","").replace(/;/g,":"),oo.ipv6uri=!0),oo.pathNames=pathNames(oo,oo.path),oo.queryKey=queryKey(oo,oo.query),oo}function pathNames(to,ue){const eo=/\/{2,9}/g,no=ue.replace(eo,"/").split("/");return(ue.slice(0,1)=="/"||ue.length===0)&&no.splice(0,1),ue.slice(-1)=="/"&&no.splice(no.length-1,1),no}function queryKey(to,ue){const eo={};return ue.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(no,ro,oo){ro&&(eo[ro]=oo)}),eo}let Socket$1=class dh extends Emitter{constructor(ue,eo={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],ue&&typeof ue=="object"&&(eo=ue,ue=null),ue?(ue=parse$8(ue),eo.hostname=ue.host,eo.secure=ue.protocol==="https"||ue.protocol==="wss",eo.port=ue.port,ue.query&&(eo.query=ue.query)):eo.host&&(eo.hostname=parse$8(eo.host).host),installTimerFunctions(this,eo),this.secure=eo.secure!=null?eo.secure:typeof location<"u"&&location.protocol==="https:",eo.hostname&&!eo.port&&(eo.port=this.secure?"443":"80"),this.hostname=eo.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=eo.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=eo.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},eo),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(ue){const eo=Object.assign({},this.opts.query);eo.EIO=protocol$1,eo.transport=ue,this.id&&(eo.sid=this.id);const no=Object.assign({},this.opts,{query:eo,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[ue]);return new transports[ue](no)}open(){let ue;if(this.opts.rememberUpgrade&&dh.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)ue="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else ue=this.transports[0];this.readyState="opening";try{ue=this.createTransport(ue)}catch{this.transports.shift(),this.open();return}ue.open(),this.setTransport(ue)}setTransport(ue){this.transport&&this.transport.removeAllListeners(),this.transport=ue,ue.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",eo=>this.onClose("transport close",eo))}probe(ue){let eo=this.createTransport(ue),no=!1;dh.priorWebsocketSuccess=!1;const ro=()=>{no||(eo.send([{type:"ping",data:"probe"}]),eo.once("packet",uo=>{if(!no)if(uo.type==="pong"&&uo.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",eo),!eo)return;dh.priorWebsocketSuccess=eo.name==="websocket",this.transport.pause(()=>{no||this.readyState!=="closed"&&(co(),this.setTransport(eo),eo.send([{type:"upgrade"}]),this.emitReserved("upgrade",eo),eo=null,this.upgrading=!1,this.flush())})}else{const fo=new Error("probe error");fo.transport=eo.name,this.emitReserved("upgradeError",fo)}}))};function oo(){no||(no=!0,co(),eo.close(),eo=null)}const io=uo=>{const fo=new Error("probe error: "+uo);fo.transport=eo.name,oo(),this.emitReserved("upgradeError",fo)};function ao(){io("transport closed")}function so(){io("socket closed")}function lo(uo){eo&&uo.name!==eo.name&&oo()}const co=()=>{eo.removeListener("open",ro),eo.removeListener("error",io),eo.removeListener("close",ao),this.off("close",so),this.off("upgrading",lo)};eo.once("open",ro),eo.once("error",io),eo.once("close",ao),this.once("close",so),this.once("upgrading",lo),this.upgrades.indexOf("webtransport")!==-1&&ue!=="webtransport"?this.setTimeoutFn(()=>{no||eo.open()},200):eo.open()}onOpen(){if(this.readyState="open",dh.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let ue=0;const eo=this.upgrades.length;for(;ue<eo;ue++)this.probe(this.upgrades[ue])}}onPacket(ue){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",ue),this.emitReserved("heartbeat"),this.resetPingTimeout(),ue.type){case"open":this.onHandshake(JSON.parse(ue.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const eo=new Error("server error");eo.code=ue.data,this.onError(eo);break;case"message":this.emitReserved("data",ue.data),this.emitReserved("message",ue.data);break}}onHandshake(ue){this.emitReserved("handshake",ue),this.id=ue.sid,this.transport.query.sid=ue.sid,this.upgrades=this.filterUpgrades(ue.upgrades),this.pingInterval=ue.pingInterval,this.pingTimeout=ue.pingTimeout,this.maxPayload=ue.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const ue=this.getWritablePackets();this.transport.send(ue),this.prevBufferLen=ue.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let eo=1;for(let no=0;no<this.writeBuffer.length;no++){const ro=this.writeBuffer[no].data;if(ro&&(eo+=byteLength(ro)),no>0&&eo>this.maxPayload)return this.writeBuffer.slice(0,no);eo+=2}return this.writeBuffer}write(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}send(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}sendPacket(ue,eo,no,ro){if(typeof eo=="function"&&(ro=eo,eo=void 0),typeof no=="function"&&(ro=no,no=null),this.readyState==="closing"||this.readyState==="closed")return;no=no||{},no.compress=no.compress!==!1;const oo={type:ue,data:eo,options:no};this.emitReserved("packetCreate",oo),this.writeBuffer.push(oo),ro&&this.once("flush",ro),this.flush()}close(){const ue=()=>{this.onClose("forced close"),this.transport.close()},eo=()=>{this.off("upgrade",eo),this.off("upgradeError",eo),ue()},no=()=>{this.once("upgrade",eo),this.once("upgradeError",eo)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?no():ue()}):this.upgrading?no():ue()),this}onError(ue){dh.priorWebsocketSuccess=!1,this.emitReserved("error",ue),this.onClose("transport error",ue)}onClose(ue,eo){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",ue,eo),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(ue){const eo=[];let no=0;const ro=ue.length;for(;no<ro;no++)~this.transports.indexOf(ue[no])&&eo.push(ue[no]);return eo}};Socket$1.protocol=protocol$1;function url$1(to,ue="",eo){let no=to;eo=eo||typeof location<"u"&&location,to==null&&(to=eo.protocol+"//"+eo.host),typeof to=="string"&&(to.charAt(0)==="/"&&(to.charAt(1)==="/"?to=eo.protocol+to:to=eo.host+to),/^(https?|wss?):\/\//.test(to)||(typeof eo<"u"?to=eo.protocol+"//"+to:to="https://"+to),no=parse$8(to)),no.port||(/^(http|ws)$/.test(no.protocol)?no.port="80":/^(http|ws)s$/.test(no.protocol)&&(no.port="443")),no.path=no.path||"/";const oo=no.host.indexOf(":")!==-1?"["+no.host+"]":no.host;return no.id=no.protocol+"://"+oo+":"+no.port+ue,no.href=no.protocol+"://"+oo+(eo&&eo.port===no.port?"":":"+no.port),no}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to.buffer instanceof ArrayBuffer,toString$4=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$4.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$4.call(File)==="[object FileConstructor]";function isBinary(to){return withNativeArrayBuffer&&(to instanceof ArrayBuffer||isView(to))||withNativeBlob&&to instanceof Blob||withNativeFile&&to instanceof File}function hasBinary(to,ue){if(!to||typeof to!="object")return!1;if(Array.isArray(to)){for(let eo=0,no=to.length;eo<no;eo++)if(hasBinary(to[eo]))return!0;return!1}if(isBinary(to))return!0;if(to.toJSON&&typeof to.toJSON=="function"&&arguments.length===1)return hasBinary(to.toJSON(),!0);for(const eo in to)if(Object.prototype.hasOwnProperty.call(to,eo)&&hasBinary(to[eo]))return!0;return!1}function deconstructPacket(to){const ue=[],eo=to.data,no=to;return no.data=_deconstructPacket(eo,ue),no.attachments=ue.length,{packet:no,buffers:ue}}function _deconstructPacket(to,ue){if(!to)return to;if(isBinary(to)){const eo={_placeholder:!0,num:ue.length};return ue.push(to),eo}else if(Array.isArray(to)){const eo=new Array(to.length);for(let no=0;no<to.length;no++)eo[no]=_deconstructPacket(to[no],ue);return eo}else if(typeof to=="object"&&!(to instanceof Date)){const eo={};for(const no in to)Object.prototype.hasOwnProperty.call(to,no)&&(eo[no]=_deconstructPacket(to[no],ue));return eo}return to}function reconstructPacket(to,ue){return to.data=_reconstructPacket(to.data,ue),delete to.attachments,to}function _reconstructPacket(to,ue){if(!to)return to;if(to&&to._placeholder===!0){if(typeof to.num=="number"&&to.num>=0&&to.num<ue.length)return ue[to.num];throw new Error("illegal attachments")}else if(Array.isArray(to))for(let eo=0;eo<to.length;eo++)to[eo]=_reconstructPacket(to[eo],ue);else if(typeof to=="object")for(const eo in to)Object.prototype.hasOwnProperty.call(to,eo)&&(to[eo]=_reconstructPacket(to[eo],ue));return to}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(to){to[to.CONNECT=0]="CONNECT",to[to.DISCONNECT=1]="DISCONNECT",to[to.EVENT=2]="EVENT",to[to.ACK=3]="ACK",to[to.CONNECT_ERROR=4]="CONNECT_ERROR",to[to.BINARY_EVENT=5]="BINARY_EVENT",to[to.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(ue){this.replacer=ue}encode(ue){return(ue.type===PacketType.EVENT||ue.type===PacketType.ACK)&&hasBinary(ue)?this.encodeAsBinary({type:ue.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:ue.nsp,data:ue.data,id:ue.id}):[this.encodeAsString(ue)]}encodeAsString(ue){let eo=""+ue.type;return(ue.type===PacketType.BINARY_EVENT||ue.type===PacketType.BINARY_ACK)&&(eo+=ue.attachments+"-"),ue.nsp&&ue.nsp!=="/"&&(eo+=ue.nsp+","),ue.id!=null&&(eo+=ue.id),ue.data!=null&&(eo+=JSON.stringify(ue.data,this.replacer)),eo}encodeAsBinary(ue){const eo=deconstructPacket(ue),no=this.encodeAsString(eo.packet),ro=eo.buffers;return ro.unshift(no),ro}}function isObject$7(to){return Object.prototype.toString.call(to)==="[object Object]"}class Decoder extends Emitter{constructor(ue){super(),this.reviver=ue}add(ue){let eo;if(typeof ue=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");eo=this.decodeString(ue);const no=eo.type===PacketType.BINARY_EVENT;no||eo.type===PacketType.BINARY_ACK?(eo.type=no?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(eo),eo.attachments===0&&super.emitReserved("decoded",eo)):super.emitReserved("decoded",eo)}else if(isBinary(ue)||ue.base64)if(this.reconstructor)eo=this.reconstructor.takeBinaryData(ue),eo&&(this.reconstructor=null,super.emitReserved("decoded",eo));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+ue)}decodeString(ue){let eo=0;const no={type:Number(ue.charAt(0))};if(PacketType[no.type]===void 0)throw new Error("unknown packet type "+no.type);if(no.type===PacketType.BINARY_EVENT||no.type===PacketType.BINARY_ACK){const oo=eo+1;for(;ue.charAt(++eo)!=="-"&&eo!=ue.length;);const io=ue.substring(oo,eo);if(io!=Number(io)||ue.charAt(eo)!=="-")throw new Error("Illegal attachments");no.attachments=Number(io)}if(ue.charAt(eo+1)==="/"){const oo=eo+1;for(;++eo&&!(ue.charAt(eo)===","||eo===ue.length););no.nsp=ue.substring(oo,eo)}else no.nsp="/";const ro=ue.charAt(eo+1);if(ro!==""&&Number(ro)==ro){const oo=eo+1;for(;++eo;){const io=ue.charAt(eo);if(io==null||Number(io)!=io){--eo;break}if(eo===ue.length)break}no.id=Number(ue.substring(oo,eo+1))}if(ue.charAt(++eo)){const oo=this.tryParse(ue.substr(eo));if(Decoder.isPayloadValid(no.type,oo))no.data=oo;else throw new Error("invalid payload")}return no}tryParse(ue){try{return JSON.parse(ue,this.reviver)}catch{return!1}}static isPayloadValid(ue,eo){switch(ue){case PacketType.CONNECT:return isObject$7(eo);case PacketType.DISCONNECT:return eo===void 0;case PacketType.CONNECT_ERROR:return typeof eo=="string"||isObject$7(eo);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(eo)&&(typeof eo[0]=="number"||typeof eo[0]=="string"&&RESERVED_EVENTS$1.indexOf(eo[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(eo)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(ue){this.packet=ue,this.buffers=[],this.reconPack=ue}takeBinaryData(ue){if(this.buffers.push(ue),this.buffers.length===this.reconPack.attachments){const eo=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),eo}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$2=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on$1(to,ue,eo){return to.on(ue,eo),function(){to.off(ue,eo)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(ue,eo,no){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=ue,this.nsp=eo,no&&no.auth&&(this.auth=no.auth),this._opts=Object.assign({},no),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const ue=this.io;this.subs=[on$1(ue,"open",this.onopen.bind(this)),on$1(ue,"packet",this.onpacket.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...ue){return ue.unshift("message"),this.emit.apply(this,ue),this}emit(ue,...eo){if(RESERVED_EVENTS.hasOwnProperty(ue))throw new Error('"'+ue.toString()+'" is a reserved event name');if(eo.unshift(ue),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(eo),this;const no={type:PacketType.EVENT,data:eo};if(no.options={},no.options.compress=this.flags.compress!==!1,typeof eo[eo.length-1]=="function"){const io=this.ids++,ao=eo.pop();this._registerAckCallback(io,ao),no.id=io}const ro=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!ro||!this.connected)||(this.connected?(this.notifyOutgoingListeners(no),this.packet(no)):this.sendBuffer.push(no)),this.flags={},this}_registerAckCallback(ue,eo){var no;const ro=(no=this.flags.timeout)!==null&&no!==void 0?no:this._opts.ackTimeout;if(ro===void 0){this.acks[ue]=eo;return}const oo=this.io.setTimeoutFn(()=>{delete this.acks[ue];for(let ao=0;ao<this.sendBuffer.length;ao++)this.sendBuffer[ao].id===ue&&this.sendBuffer.splice(ao,1);eo.call(this,new Error("operation has timed out"))},ro),io=(...ao)=>{this.io.clearTimeoutFn(oo),eo.apply(this,ao)};io.withError=!0,this.acks[ue]=io}emitWithAck(ue,...eo){return new Promise((no,ro)=>{const oo=(io,ao)=>io?ro(io):no(ao);oo.withError=!0,eo.push(oo),this.emit(ue,...eo)})}_addToQueue(ue){let eo;typeof ue[ue.length-1]=="function"&&(eo=ue.pop());const no={id:this._queueSeq++,tryCount:0,pending:!1,args:ue,flags:Object.assign({fromQueue:!0},this.flags)};ue.push((ro,...oo)=>no!==this._queue[0]?void 0:(ro!==null?no.tryCount>this._opts.retries&&(this._queue.shift(),eo&&eo(ro)):(this._queue.shift(),eo&&eo(null,...oo)),no.pending=!1,this._drainQueue())),this._queue.push(no),this._drainQueue()}_drainQueue(ue=!1){if(!this.connected||this._queue.length===0)return;const eo=this._queue[0];eo.pending&&!ue||(eo.pending=!0,eo.tryCount++,this.flags=eo.flags,this.emit.apply(this,eo.args))}packet(ue){ue.nsp=this.nsp,this.io._packet(ue)}onopen(){typeof this.auth=="function"?this.auth(ue=>{this._sendConnectPacket(ue)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(ue){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},ue):ue})}onerror(ue){this.connected||this.emitReserved("connect_error",ue)}onclose(ue,eo){this.connected=!1,delete this.id,this.emitReserved("disconnect",ue,eo),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(ue=>{if(!this.sendBuffer.some(no=>String(no.id)===ue)){const no=this.acks[ue];delete this.acks[ue],no.withError&&no.call(this,new Error("socket has been disconnected"))}})}onpacket(ue){if(ue.nsp===this.nsp)switch(ue.type){case PacketType.CONNECT:ue.data&&ue.data.sid?this.onconnect(ue.data.sid,ue.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(ue);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(ue);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const no=new Error(ue.data.message);no.data=ue.data.data,this.emitReserved("connect_error",no);break}}onevent(ue){const eo=ue.data||[];ue.id!=null&&eo.push(this.ack(ue.id)),this.connected?this.emitEvent(eo):this.receiveBuffer.push(Object.freeze(eo))}emitEvent(ue){if(this._anyListeners&&this._anyListeners.length){const eo=this._anyListeners.slice();for(const no of eo)no.apply(this,ue)}super.emit.apply(this,ue),this._pid&&ue.length&&typeof ue[ue.length-1]=="string"&&(this._lastOffset=ue[ue.length-1])}ack(ue){const eo=this;let no=!1;return function(...ro){no||(no=!0,eo.packet({type:PacketType.ACK,id:ue,data:ro}))}}onack(ue){const eo=this.acks[ue.id];typeof eo=="function"&&(delete this.acks[ue.id],eo.withError&&ue.data.unshift(null),eo.apply(this,ue.data))}onconnect(ue,eo){this.id=ue,this.recovered=eo&&this._pid===eo,this._pid=eo,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(ue=>this.emitEvent(ue)),this.receiveBuffer=[],this.sendBuffer.forEach(ue=>{this.notifyOutgoingListeners(ue),this.packet(ue)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(ue=>ue()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(ue){return this.flags.compress=ue,this}get volatile(){return this.flags.volatile=!0,this}timeout(ue){return this.flags.timeout=ue,this}onAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(ue),this}prependAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(ue),this}offAny(ue){if(!this._anyListeners)return this;if(ue){const eo=this._anyListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(ue),this}prependAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(ue),this}offAnyOutgoing(ue){if(!this._anyOutgoingListeners)return this;if(ue){const eo=this._anyOutgoingListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(ue){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const eo=this._anyOutgoingListeners.slice();for(const no of eo)no.apply(this,ue.data)}}}function Backoff(to){to=to||{},this.ms=to.min||100,this.max=to.max||1e4,this.factor=to.factor||2,this.jitter=to.jitter>0&&to.jitter<=1?to.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var to=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var ue=Math.random(),eo=Math.floor(ue*this.jitter*to);to=Math.floor(ue*10)&1?to+eo:to-eo}return Math.min(to,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(to){this.ms=to};Backoff.prototype.setMax=function(to){this.max=to};Backoff.prototype.setJitter=function(to){this.jitter=to};class Manager extends Emitter{constructor(ue,eo){var no;super(),this.nsps={},this.subs=[],ue&&typeof ue=="object"&&(eo=ue,ue=void 0),eo=eo||{},eo.path=eo.path||"/socket.io",this.opts=eo,installTimerFunctions(this,eo),this.reconnection(eo.reconnection!==!1),this.reconnectionAttempts(eo.reconnectionAttempts||1/0),this.reconnectionDelay(eo.reconnectionDelay||1e3),this.reconnectionDelayMax(eo.reconnectionDelayMax||5e3),this.randomizationFactor((no=eo.randomizationFactor)!==null&&no!==void 0?no:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(eo.timeout==null?2e4:eo.timeout),this._readyState="closed",this.uri=ue;const ro=eo.parser||parser$2;this.encoder=new ro.Encoder,this.decoder=new ro.Decoder,this._autoConnect=eo.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(ue){return arguments.length?(this._reconnection=!!ue,this):this._reconnection}reconnectionAttempts(ue){return ue===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=ue,this)}reconnectionDelay(ue){var eo;return ue===void 0?this._reconnectionDelay:(this._reconnectionDelay=ue,(eo=this.backoff)===null||eo===void 0||eo.setMin(ue),this)}randomizationFactor(ue){var eo;return ue===void 0?this._randomizationFactor:(this._randomizationFactor=ue,(eo=this.backoff)===null||eo===void 0||eo.setJitter(ue),this)}reconnectionDelayMax(ue){var eo;return ue===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=ue,(eo=this.backoff)===null||eo===void 0||eo.setMax(ue),this)}timeout(ue){return arguments.length?(this._timeout=ue,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(ue){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const eo=this.engine,no=this;this._readyState="opening",this.skipReconnect=!1;const ro=on$1(eo,"open",function(){no.onopen(),ue&&ue()}),oo=ao=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",ao),ue?ue(ao):this.maybeReconnectOnOpen()},io=on$1(eo,"error",oo);if(this._timeout!==!1){const ao=this._timeout,so=this.setTimeoutFn(()=>{ro(),oo(new Error("timeout")),eo.close()},ao);this.opts.autoUnref&&so.unref(),this.subs.push(()=>{this.clearTimeoutFn(so)})}return this.subs.push(ro),this.subs.push(io),this}connect(ue){return this.open(ue)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const ue=this.engine;this.subs.push(on$1(ue,"ping",this.onping.bind(this)),on$1(ue,"data",this.ondata.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this)),on$1(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(ue){try{this.decoder.add(ue)}catch(eo){this.onclose("parse error",eo)}}ondecoded(ue){nextTick(()=>{this.emitReserved("packet",ue)},this.setTimeoutFn)}onerror(ue){this.emitReserved("error",ue)}socket(ue,eo){let no=this.nsps[ue];return no?this._autoConnect&&!no.active&&no.connect():(no=new Socket(this,ue,eo),this.nsps[ue]=no),no}_destroy(ue){const eo=Object.keys(this.nsps);for(const no of eo)if(this.nsps[no].active)return;this._close()}_packet(ue){const eo=this.encoder.encode(ue);for(let no=0;no<eo.length;no++)this.engine.write(eo[no],ue.options)}cleanup(){this.subs.forEach(ue=>ue()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(ue,eo){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",ue,eo),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const ue=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const eo=this.backoff.duration();this._reconnecting=!0;const no=this.setTimeoutFn(()=>{ue.skipReconnect||(this.emitReserved("reconnect_attempt",ue.backoff.attempts),!ue.skipReconnect&&ue.open(ro=>{ro?(ue._reconnecting=!1,ue.reconnect(),this.emitReserved("reconnect_error",ro)):ue.onreconnect()}))},eo);this.opts.autoUnref&&no.unref(),this.subs.push(()=>{this.clearTimeoutFn(no)})}}onreconnect(){const ue=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",ue)}}const cache$1={};function lookup(to,ue){typeof to=="object"&&(ue=to,to=void 0),ue=ue||{};const eo=url$1(to,ue.path||"/socket.io"),no=eo.source,ro=eo.id,oo=eo.path,io=cache$1[ro]&&oo in cache$1[ro].nsps,ao=ue.forceNew||ue["force new connection"]||ue.multiplex===!1||io;let so;return ao?so=new Manager(no,ue):(cache$1[ro]||(cache$1[ro]=new Manager(no,ue)),so=cache$1[ro]),eo.query&&!ue.query&&(ue.query=eo.queryKey),so.socket(eo.path,ue)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const DefaultOptions={heartbeat:!0},createWebsocket=(to,ue=DefaultOptions)=>{if(!to)throw"A websocket path must be provided";const{heartbeat:eo}={...DefaultOptions,...ue},no=location.protocol==="https:",ro=no?"wss:":"ws:",oo=location.hostname,io=location.port||(no?443:80);let ao=lookup(`${ro}//${oo}:${io}`,{path:to,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),so;return eo&&(so=setInterval(()=>{ao.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),ao.on("disconnect",()=>{clearInterval(so)}),ao.onOther=(lo,co)=>{ao.on(lo,uo=>{(uo==null?void 0:uo.apiSessionId)!==APISessionID&&co(uo)})},ao},extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;function downloadText(to,ue){typeof ue=="object"&&(ue=JSON.stringify(ue));const eo=new Blob([ue],{type:"plain/text"}),no=URL.createObjectURL(eo),ro=document.createElement("a");ro.href=no,ro.download=to,ro.click(),URL.revokeObjectURL(no)}async function downloadStream(to){const ue=await to.blob(),eo=to.headers.get("Content-Disposition"),ro=extractFileNameRegex.exec(eo)[1].replace(/['"]/g,""),oo=new Blob([ue]),io=URL.createObjectURL(oo),ao=document.createElement("a");ao.href=io,ao.download=ro,ao.click(),URL.revokeObjectURL(io)}async function downloadFile(to,ue){const eo=await fetch(to,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(eo.ok){const no=eo.headers.get("Content-Disposition"),oo=extractFileNameRegex.exec(no)[1].replace(/['"]/g,""),io=URL.createObjectURL(await eo.blob()),ao=document.createElement("a");return ao.href=io,ao.download=oo,ao.click(),URL.revokeObjectURL(io),!0}else return!1}const shouldDisplaySetting=(to,ue)=>{let eo=ue.dependsOn;return eo&&!Array.isArray(eo)&&(eo=[eo]),eo!=null&&eo.length?eo.every(no=>{let ro=no,oo=null,io=!!no.invert;if(typeof no=="object"&&(ro=no.setting,oo=no.value),!ro)return!1;Array.isArray(oo)||(oo=[oo]);const ao=deepGet$1(to,ro);return oo.some(lo=>lo==null?ao!=null&&ao!==!1&&ao!=="":lo===ao)!==io}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(to,ue)=>{function eo(no){const{timeOnly:ro,dateOnly:oo}=ue||{},io=!oo,ao=parseDate(no,{enableTime:io});return getDateDisplayValue(ao,{enableTime:io,timeOnly:ro})}return to.map(no=>eo(no))},[FieldType.BOOLEAN]:to=>to.map(ue=>!!ue),[FieldType.BB_REFERENCE_SINGLE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.BB_REFERENCE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.ARRAY]:to=>Array.from(new Set(to))};function enrichSchemaWithRelColumns(to){return Object.keys(to).reduce((eo,no)=>{const ro=to[no];if(eo[no]=ro,ro.visible!==!1&&isRelationshipField(ro)&&ro.columns){const oo=(ro==null?void 0:ro.relationshipType)===RelationshipType.ONE_TO_MANY;for(const io of Object.keys(ro.columns)){const ao=ro.columns[io];if(!ao.visible)continue;const so=`${ro.name}.${io}`;eo[so]={...ao,type:ao.type,name:so,related:{field:no,subField:io},cellRenderType:!oo&&columnTypeManyTypeOverrides[ao.type]||ao.type}}}return eo},{})}function getRelatedTableValues(to,ue,eo){var oo,io,ao,so;const no=isRelationshipField(eo)&&(eo==null?void 0:eo.relationshipType)===RelationshipType.ONE_TO_MANY;let ro="";if(no)ro=(io=(oo=to[ue.related.field])==null?void 0:oo[0])==null?void 0:io[ue.related.subField];else{const lo=columnTypeManyParser[ue.type]||(fo=>fo),co=(so=(ao=to[ue.related.field])==null?void 0:ao.flatMap(fo=>fo[ue.related.subField]))==null?void 0:so.filter(fo=>fo!=null),uo=lo(co||[],ue);ro=uo,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(ue.type)&&(ro=uo==null?void 0:uo.join(", "))}return ro}function canBeDisplayColumn(to){return!(!canBeDisplayColumn$1(to.type)||to.related)}function canBeSortColumn(to){return to.calculationType?!0:!(!canBeSortColumn$1(to.type)||to.related)}const{buildQuery,limit:queryLimit,runQuery,sort:sort$2}=QueryUtils;class DataFetch{constructor(ue){if(this.API=null,this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:null,limit:10,filter:null,query:null,sortColumn:null,sortOrder:SortOrder.ASCENDING,sortType:null,paginate:!0,clientSideSearching:!0,clientSideSorting:!0,clientSideLimiting:!0},this.store=writable({rows:[],info:null,schema:null,loading:!1,loaded:!1,query:null,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random(),error:null}),this.API=ue==null?void 0:ue.API,this.options={...this.options,...ue},!this.API)throw"An API client is required for fetching data";if(this.getData=this.getData.bind(this),this.getPage=this.getPage.bind(this),this.getInitialData=this.getInitialData.bind(this),this.determineFeatureFlags=this.determineFeatureFlags.bind(this),this.refresh=this.refresh.bind(this),this.update=this.update.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.hasPrevPage=this.hasPrevPage.bind(this),this.nextPage=this.nextPage.bind(this),this.prevPage=this.prevPage.bind(this),this.derivedStore=derived(this.store,eo=>({...eo,...this.features,hasNextPage:this.hasNextPage(eo),hasPrevPage:this.hasPrevPage(eo)})),!this.options.datasource){this.store.update(eo=>({...eo,loaded:!0}));return}this.getInitialData()}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(ue,eo){return ue!=null&&ue.primaryDisplay&&eo[ue.primaryDisplay]?ue.primaryDisplay:Object.keys(eo)[0]}async getInitialData(){const{datasource:ue,filter:eo,paginate:no}=this.options,ro=await this.getDefinition(ue),oo=this.determineFeatureFlags(ro);this.features={supportsSearch:!!(oo!=null&&oo.supportsSearch),supportsSort:!!(oo!=null&&oo.supportsSort),supportsPagination:no&&!!(oo!=null&&oo.supportsPagination)};let io=this.getSchema(ue,ro);if(io=this.enrichSchema(io),!io)return;if(this.options.sortColumn&&!io[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(ro,io)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const lo=io==null?void 0:io[this.options.sortColumn];((lo==null?void 0:lo.type)===FieldType.NUMBER||(lo==null?void 0:lo.type)===FieldType.BIGINT||lo!=null&&lo.calculationType)&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder||(this.options.sortOrder=SortOrder.ASCENDING)}let ao=this.options.query;ao||(ao=buildQuery(eo)),this.store.update(lo=>({...lo,definition:ro,schema:io,query:ao,loading:!0,cursors:[],cursor:null}));const so=await this.getPage();this.store.update(lo=>({...lo,loading:!1,loaded:!0,pageNumber:0,rows:so.rows,info:so.info,cursors:no&&so.hasNextPage?[null,so.cursor]:[null],error:so.error,resetKey:Math.random()}))}async getPage(){const{sortColumn:ue,sortOrder:eo,sortType:no,limit:ro,clientSideSearching:oo,clientSideSorting:io,clientSideLimiting:ao}=this.options,{query:so}=get_store_value(this.store);let{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}=await this.getData();return!this.features.supportsSearch&&oo&&(lo=runQuery(lo,so)),!this.features.supportsSort&&io&&(lo=sort$2(lo,ue,eo,no)),!this.features.supportsPagination&&ao&&(lo=queryLimit(lo,ro)),{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}}async getData(){return{rows:[],info:null,hasNextPage:!1,cursor:null}}async getDefinition(ue){if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getSchema(ue,eo){return eo==null?void 0:eo.schema}enrichSchema(ue){if(ue==null)return null;let eo={};Object.keys(ue).forEach(ro=>{const oo=ue[ro];if((oo==null?void 0:oo.type)===FieldType.JSON){const io=convertJSONSchemaToTableSchema(oo,{squashObjects:!0});Object.keys(io).forEach(ao=>{eo[`${ro}.${ao}`]={type:io[ao].type,nestedJSON:!0}})}}),ue={...ue,...eo};let no={};return Object.entries(ue).forEach(([ro,oo])=>{typeof oo=="string"?no[ro]={type:oo,name:ro}:no[ro]={...oo,name:ro}}),no}determineFeatureFlags(ue){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(ue){let eo=!1;const no=Object.entries(ue||{});for(let[ro,oo]of no){const io=this.options[ro]==null?null:this.options[ro];if(JSON.stringify(oo??null)!==JSON.stringify(io)){eo=!0;break}}eo&&(this.options={...this.options,...fp$1.cloneDeep(ue)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(so=>({...so,loading:!0}));const{rows:ue,info:eo,error:no,cursor:ro}=await this.getPage();let{cursors:oo}=get_store_value(this.store);const{pageNumber:io}=get_store_value(this.store);if(!ue.length&&io>0)return this.store.update(so=>({...so,loading:!1,cursors:oo.slice(0,io)})),await this.prevPage();oo[io+1]!=ro&&(oo=oo.slice(0,io+1),oo[io+1]=ro),this.store.update(so=>({...so,rows:ue,info:eo,loading:!1,error:no,cursors:oo}))}hasNextPage(ue){return ue.cursors[ue.pageNumber+1]!=null}hasPrevPage(ue){return ue.pageNumber>0}async nextPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasNextPage)return;const eo=ue.cursors[ue.pageNumber+1];this.store.update(so=>({...so,loading:!0,cursor:eo,pageNumber:so.pageNumber+1}));const{rows:no,info:ro,hasNextPage:oo,cursor:io,error:ao}=await this.getPage();this.store.update(so=>{let{cursors:lo,pageNumber:co}=so;return oo&&(lo[co+1]=io),{...so,rows:no,info:ro,cursors:lo,loading:!1,error:ao}})}async prevPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasPrevPage)return;const eo=ue.cursors[ue.pageNumber-1];this.store.update(io=>({...io,loading:!0,cursor:eo,pageNumber:io.pageNumber-1}));const{rows:no,info:ro,error:oo}=await this.getPage();this.store.update(io=>({...io,rows:no,info:ro,loading:!1,error:oo}))}}class TableFetch extends DataFetch{determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getData(){const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{tableId:ao}=ue,{cursor:so,query:lo}=get_store_value(this.store);try{const co=await this.API.searchTable(ao,{query:lo,limit:eo,sort:no,sortOrder:(ro==null?void 0:ro.toLowerCase())??SortOrder.ASCENDING,sortType:oo,paginate:io,bookmark:so});return{rows:(co==null?void 0:co.rows)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.bookmark)||null}}catch(co){return{rows:[],hasNextPage:!1,error:co}}}}class ViewFetch extends DataFetch{getSchema(ue,eo){var no,ro;return(ro=(no=eo==null?void 0:eo.views)==null?void 0:no[ue.name])==null?void 0:ro.schema}async getData(){const{datasource:ue}=this.options;try{return{rows:await this.API.fetchViewData(ue.name)||[]}}catch{return{rows:[]}}}}class ViewV2Fetch extends DataFetch{determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}getSchema(ue,eo){return eo==null?void 0:eo.schema}async getDefinition(ue){if(!(ue!=null&&ue.id))return null;try{const eo=await this.API.viewV2.fetchDefinition(ue.id);return eo==null?void 0:eo.data}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getDefaultSortColumn(){return null}async getData(){var co;const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{cursor:ao,query:so,definition:lo}=get_store_value(this.store);if(lo.type===ViewV2Type.CALCULATION&&!Object.values(lo.schema||{}).some(uo=>uo.calculationType))return{rows:[],hasNextPage:!1,cursor:null,error:null};!no&&((co=lo.sort)!=null&&co.field)&&(this.options.sortColumn=lo.sort.field,this.options.sortOrder=lo.sort.order);try{const uo=await this.API.viewV2.fetch(ue.id,{...so?{query:so}:{},paginate:io,limit:eo,bookmark:ao,sort:no,sortOrder:ro==null?void 0:ro.toLowerCase(),sortType:oo});return{rows:(uo==null?void 0:uo.rows)||[],hasNextPage:(uo==null?void 0:uo.hasNextPage)||!1,cursor:(uo==null?void 0:uo.bookmark)||null}}catch(uo){return{rows:[],hasNextPage:!1,cursor:null,error:uo}}}}class QueryFetch extends DataFetch{determineFeatureFlags(ue){var no,ro,oo,io,ao,so;return{supportsPagination:!!((ro=(no=ue==null?void 0:ue.fields)==null?void 0:no.pagination)!=null&&ro.type)&&!!((io=(oo=ue==null?void 0:ue.fields)==null?void 0:oo.pagination)!=null&&io.location)&&!!((so=(ao=ue==null?void 0:ue.fields)==null?void 0:ao.pagination)!=null&&so.pageParam)}}async getDefinition(ue){if(!(ue!=null&&ue._id))return null;try{const eo=await this.API.fetchQueryDefinition(ue._id);return eo.fields||(eo.fields=ue.fields),eo}catch{return null}}getDefaultSortColumn(){return null}async getData(){var co,uo;const{datasource:ue,limit:eo,paginate:no}=this.options,{supportsPagination:ro}=this.features,{cursor:oo,definition:io}=get_store_value(this.store),ao=(uo=(co=io==null?void 0:io.fields)==null?void 0:co.pagination)==null?void 0:uo.type;let so=cloneDeep((ue==null?void 0:ue.queryParams)||{});for(let fo of(ue==null?void 0:ue.parameters)||{})so[fo.name]||(so[fo.name]=fo.default);let lo={parameters:so};if(no&&ro){const fo=ao==="page"?parseInt(oo||1):oo;lo.pagination={page:fo,limit:eo}}try{const fo=await this.API.executeQuery(ue==null?void 0:ue._id,lo),{data:po,pagination:ho,..._o}=fo;let go=null,bo=!1;return no&&ro&&(ao==="page"?(go=lo.pagination.page+1,bo=(po==null?void 0:po.length)===eo&&eo>0):(go=ho==null?void 0:ho.cursor,bo=go!=null)),{rows:po||[],info:_o,cursor:go,hasNextPage:bo}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends DataFetch{async getData(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.rowId)||!(ue!=null&&ue.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(ue.rowTableId,ue.rowId,ue.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends DataFetch{async getDefinition(ue){var eo,no;return{schema:(eo=ue==null?void 0:ue.value)==null?void 0:eo.schema,primaryDisplay:(no=ue==null?void 0:ue.value)==null?void 0:no.primaryDisplay}}async getData(){var eo;const{datasource:ue}=this.options;return{rows:((eo=ue==null?void 0:ue.value)==null?void 0:eo.rows)||[],hasNextPage:!1,cursor:null}}}class FieldFetch extends DataFetch{async getDefinition(ue){let eo;return ue.fieldType==="attachment"?eo={url:{type:"string"},name:{type:"string"}}:ue.fieldType==="array"&&(eo={value:{type:"string"}}),{schema:eo}}async getData(){const{datasource:ue}=this.options,eo=(ue==null?void 0:ue.value)||[];let no;return Array.isArray(eo)&&eo[0]&&typeof eo[0]!="object"?no=eo.map(ro=>({value:ro})):no=eo,{rows:no||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(ue){try{const eo=await this.API.fetchTableDefinition(ue.tableId);return{schema:getJSONArrayDatasourceSchema(eo==null?void 0:eo.schema,ue)}}catch{return null}}}class UserFetch extends DataFetch{constructor(ue){super({...ue,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:ue,paginate:eo}=this.options,{cursor:no,query:ro}=get_store_value(this.store),{appId:oo,paginated:io,...ao}=ro||{},so=isSupportedUserSearch(ao)?ro:{string:{email:null}};try{const lo={bookmark:no,query:so,appId:oo,paginate:io||eo,limit:ue},co=await this.API.searchUsers(lo);return{rows:(co==null?void 0:co.data)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.nextPage)||null}}catch(lo){return{rows:[],hasNextPage:!1,error:lo}}}}class GroupUserFetch extends DataFetch{constructor(ue){super({...ue,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:ue,cursor:eo}=get_store_value(this.store);try{const no=await this.API.getGroupUsers({id:ue.groupId,emailSearch:ue.emailSearch,bookmark:eo});return{rows:(no==null?void 0:no.users)||[],hasNextPage:(no==null?void 0:no.hasNextPage)||!1,cursor:(no==null?void 0:no.bookmark)||null}}catch(no){return{rows:[],hasNextPage:!1,error:no}}}}class CustomFetch extends DataFetch{getType(ue){return ue==null?"string":typeof ue==="object"?Array.isArray(ue)?"array":"json":isNaN(ue)?"string":"number"}parseCustomData(ue){if(!ue)return[];if(Array.isArray(ue))return ue;if(typeof ue=="string"){try{const eo=JSON.parse(ue);return Array.isArray(eo)?eo:[eo]}catch{}return ue.includes(`
474
+ `))&&attr(ue,"style",eo),(!ro||so&1&&no!==(no="spectrum-Body spectrum-Body--size"+ao[0]+" svelte-10a30y"))&&attr(ue,"class",no),(!ro||so&3)&&toggle_class(ue,"spectrum-Body--serif",ao[1])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a4(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{serif:io=!1}=ue,{weight:ao=null}=ue,{textAlign:so=null}=ue,{color:lo=null}=ue;return to.$$set=co=>{"size"in co&&eo(0,oo=co.size),"serif"in co&&eo(1,io=co.serif),"weight"in co&&eo(2,ao=co.weight),"textAlign"in co&&eo(3,so=co.textAlign),"color"in co&&eo(4,lo=co.color),"$$scope"in co&&eo(5,ro=co.$$scope)},[oo,io,ao,so,lo,ro,no]}class Body extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a4,create_fragment$a7,safe_not_equal,{size:0,serif:1,weight:2,textAlign:3,color:4})}}const Heading_svelte_svelte_type_style_lang="";function create_fragment$a6(to){let ue,eo,no,ro;const oo=to[5].default,io=create_slot(oo,to,to[4],null);return{c(){ue=element("h1"),io&&io.c(),attr(ue,"data-testid","typography-heading"),attr(ue,"style",eo=to[1]?`text-align:${to[1]}`:""),attr(ue,"class",no="spectrum-Heading spectrum-Heading--size"+to[0]+" spectrum-Heading--"+to[3]+" svelte-3sm8u5"),toggle_class(ue,"noPadding",to[2])},m(ao,so){insert$1(ao,ue,so),io&&io.m(ue,null),ro=!0},p(ao,[so]){io&&io.p&&(!ro||so&16)&&update_slot_base(io,oo,ao,ao[4],ro?get_slot_changes(oo,ao[4],so,null):get_all_dirty_from_scope(ao[4]),null),(!ro||so&2&&eo!==(eo=ao[1]?`text-align:${ao[1]}`:""))&&attr(ue,"style",eo),(!ro||so&9&&no!==(no="spectrum-Heading spectrum-Heading--size"+ao[0]+" spectrum-Heading--"+ao[3]+" svelte-3sm8u5"))&&attr(ue,"class",no),(!ro||so&13)&&toggle_class(ue,"noPadding",ao[2])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a3(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{textAlign:io=void 0}=ue,{noPadding:ao=!1}=ue,{weight:so="default"}=ue;return to.$$set=lo=>{"size"in lo&&eo(0,oo=lo.size),"textAlign"in lo&&eo(1,io=lo.textAlign),"noPadding"in lo&&eo(2,ao=lo.noPadding),"weight"in lo&&eo(3,so=lo.weight),"$$scope"in lo&&eo(4,ro=lo.$$scope)},[oo,io,ao,so,ro,no]}class Heading extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a3,create_fragment$a6,safe_not_equal,{size:0,textAlign:1,noPadding:2,weight:3})}}var HTTPMethod=(to=>(to.POST="POST",to.PATCH="PATCH",to.GET="GET",to.PUT="PUT",to.DELETE="DELETE",to))(HTTPMethod||{});const BannedSearchTypes=[FieldType.LINK,FieldType.ATTACHMENT_SINGLE,FieldType.ATTACHMENTS,FieldType.FORMULA,FieldType.JSON,FieldType.ATTACHMENT_SINGLE,FieldType.SIGNATURE_SINGLE,"jsonarray","queryarray"],Cookies={Auth:"budibase:auth",CurrentApp:"budibase:currentapp",ReturnUrl:"budibase:returnurl",AccountReturnUrl:"budibase:account:returnurl",OnboardingProcessCorrelationKey:BpmCorrelationKey.ONBOARDING},TableNames$1={USERS:"ta_users"},BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer}],BudibaseRoleOptions=[{label:"Account admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all apps and settings in your account",sortOrder:1},{label:"Creator",value:BudibaseRoles.Creator,subtitle:"Can create and edit apps they have access to",sortOrder:2},{label:"App user",value:BudibaseRoles.AppUser,subtitle:"Can only use published apps they have access to",sortOrder:3}],ExtendedBudibaseRoleOptions=[{label:"Account holder",value:BudibaseRoles.Owner,sortOrder:0},...BudibaseRoleOptions,...BudibaseRoleOptionsOld],PlanType={FREE:"free",TEAM:"team",PRO:"pro",BUSINESS:"business",PREMIUM:"premium",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles$2={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},ContextScopes$2={Local:"local",Global:"global"},TypeIconMap$1={[FieldType.STRING]:"Text",[FieldType.OPTIONS]:"Dropdown",[FieldType.DATETIME]:"Calendar",[FieldType.BARCODEQR]:"Camera",[FieldType.SIGNATURE_SINGLE]:"AnnotatePen",[FieldType.LONGFORM]:"TextAlignLeft",[FieldType.ARRAY]:"Duplicate",[FieldType.NUMBER]:"123",[FieldType.BOOLEAN]:"Boolean",[FieldType.ATTACHMENTS]:"DocumentFragmentGroup",[FieldType.ATTACHMENT_SINGLE]:"DocumentFragment",[FieldType.LINK]:"DataCorrelated",[FieldType.FORMULA]:"Calculator",[FieldType.AI]:"MagicWand",[FieldType.JSON]:"Brackets",[FieldType.BIGINT]:"TagBold",[FieldType.AUTO]:"Shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"UserGroup",[BBReferenceFieldSubType.USERS]:"UserGroup"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"User"}},OptionColours=[...new Array(12).keys()].map(to=>`hsla(${(to+1)*222%360}, 90%, 75%, 0.3)`),FilterOperator={ANY:"any",ALL:"all"},OnEmptyFilter={RETURN_ALL:"all",RETURN_NONE:"none"},FilterValueType={BINDING:"Binding",VALUE:"Value"},FieldPermissions$1={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$1=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ContextScopes$2,Cookies,DEFAULT_BB_DATASOURCE_ID:DEFAULT_BB_DATASOURCE_ID$1,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions:FieldPermissions$1,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles:Roles$2,SqlNumberTypeRangeMap,TableNames:TableNames$1,TypeIconMap:TypeIconMap$1},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=to=>({getAnalyticsStatus:async()=>await to.get({url:"/api/bbtel"}),analyticsPing:async ue=>await to.post({url:"/api/bbtel/ping",body:{...ue,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=to=>({generateCronExpression:async ue=>await to.post({url:"/api/ai/cron",body:{prompt:ue}})}),buildAppEndpoints=to=>({fetchAppPackage:async ue=>await to.get({url:`/api/applications/${ue}/appPackage`}),saveAppMetadata:async(ue,eo)=>await to.put({url:`/api/applications/${ue}`,body:eo}),publishAppChanges:async ue=>await to.post({url:`/api/applications/${ue}/publish`}),revertAppChanges:async ue=>await to.post({url:`/api/dev/${ue}/revert`}),updateAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/update`}),revertAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/revert`}),getAppDeployments:async()=>await to.get({url:"/api/deployments"}),createApp:async ue=>await to.post({url:"/api/applications",body:ue,json:!1}),duplicateApp:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/duplicate`,body:eo,json:!1}),updateAppFromExport:async(ue,eo)=>{const no=getDevAppID(ue);return await to.post({url:`/api/applications/${no}/import`,body:eo,json:!1})},importApps:async ue=>await to.post({url:"/api/cloud/import",body:ue,json:!1}),unpublishApp:async ue=>await to.post({url:`/api/applications/${ue}/unpublish`}),deleteApp:async ue=>await to.delete({url:`/api/applications/${ue}`}),releaseAppLock:async ue=>await to.delete({url:`/api/dev/${ue}/lock`}),fetchSystemDebugInfo:async()=>await to.get({url:"/api/debug/diagnostics"}),syncApp:async ue=>await to.post({url:`/api/applications/${ue}/sync`}),getApps:async()=>await to.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async ue=>await to.get({url:`/api/${ue}/components/definitions`}),addSampleData:async ue=>await to.post({url:`/api/applications/${ue}/sample`}),setRevertableVersion:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/setRevertableVersion`,body:{revertableVersion:eo}})}),buildAttachmentEndpoints=to=>{const ue={getSignedDatasourceURL:async(eo,no,ro)=>await to.post({url:`/api/attachments/${eo}/url`,body:{bucket:no,key:ro}})};return{...ue,uploadAttachment:async(eo,no)=>await to.post({url:`/api/attachments/${eo}/upload`,body:no,json:!1}),uploadBuilderAttachment:async eo=>await to.post({url:"/api/attachments/process",body:eo,json:!1}),externalUpload:async(eo,no,ro,oo)=>{const{signedUrl:io,publicUrl:ao}=await ue.getSignedDatasourceURL(eo,no,ro);return io?(await to.put({url:io,body:oo,json:!1,external:!0}),{publicUrl:ao}):{publicUrl:void 0}},downloadAttachment:async(eo,no,ro)=>await to.get({url:`/api/${eo}/rows/${no}/attachment/${ro}`,parseResponse:oo=>oo,suppressErrors:!0})}},buildAuthEndpoints=to=>({logIn:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/login`,body:{username:eo,password:no}}),logOut:async()=>await to.post({url:"/api/global/auth/logout"}),setInitInfo:async ue=>await to.post({url:"/api/global/auth/init",body:ue}),getInitInfo:async()=>await to.get({url:"/api/global/auth/init"}),requestForgotPassword:async(ue,eo)=>await to.post({url:`/api/global/auth/${ue}/reset`,body:{email:eo}}),resetPassword:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/reset/update`,body:{password:eo,resetCode:no}})}),buildAutomationEndpoints=to=>({triggerAutomation:async(ue,eo,no)=>await to.post({url:`/api/automations/${ue}/trigger`,body:{fields:eo,timeout:no}}),testAutomation:async(ue,eo)=>await to.post({url:`/api/automations/${ue}/test`,body:eo}),getAutomations:async()=>await to.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await to.get({url:"/api/automations/definitions/list"}),createAutomation:async ue=>await to.post({url:"/api/automations",body:ue}),updateAutomation:async ue=>await to.put({url:"/api/automations",body:ue}),deleteAutomation:async(ue,eo)=>await to.delete({url:`/api/automations/${ue}/${eo}`}),getAutomationLogs:async ue=>await to.post({url:"/api/automations/logs/search",body:ue}),clearAutomationLogErrors:async(ue,eo)=>await to.delete({url:"/api/automations/logs",body:{appId:eo,automationId:ue}})}),buildConfigEndpoints=to=>({saveConfig:async ue=>await to.post({url:"/api/global/configs",body:ue}),getConfig:async ue=>await to.get({url:`/api/global/configs/${ue}`}),deleteConfig:async(ue,eo)=>await to.delete({url:`/api/global/configs/${ue}/${eo}`}),getTenantConfig:async ue=>await to.get({url:`/api/global/configs/public?tenantId=${ue}`}),getOIDCConfig:async ue=>await to.get({url:`/api/global/configs/public/oidc?tenantId=${ue}`}),getChecklist:async ue=>await to.get({url:`/api/global/configs/checklist?tenantId=${ue}`}),uploadLogo:async ue=>await to.post({url:"/api/global/configs/upload/settings/logoUrl",body:ue,json:!1}),uploadFavicon:async ue=>await to.post({url:"/api/global/configs/upload/settings/faviconUrl",body:ue,json:!1}),uploadOIDCLogo:async(ue,eo)=>await to.post({url:`/api/global/configs/upload/logos_oidc/${ue}`,body:eo,json:!1}),getOIDCLogos:async()=>await to.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=to=>({getDatasources:async()=>await to.get({url:"/api/datasources"}),buildDatasourceSchema:async(ue,eo)=>await to.post({url:`/api/datasources/${ue}/schema`,body:{tablesFilter:eo}}),createDatasource:async ue=>await to.post({url:"/api/datasources",body:ue}),updateDatasource:async ue=>await to.put({url:`/api/datasources/${ue._id}`,body:ue}),deleteDatasource:async(ue,eo)=>await to.delete({url:`/api/datasources/${ue}/${eo}`}),validateDatasource:async ue=>await to.post({url:"/api/datasources/verify",body:{datasource:ue}}),fetchInfoForDatasource:async ue=>await to.post({url:"/api/datasources/info",body:{datasource:ue}}),fetchExternalSchema:async ue=>await to.get({url:`/api/datasources/${ue}/schema/external`})}),buildFlagEndpoints=to=>({getFlags:async()=>await to.get({url:"/api/users/flags"}),updateFlag:async(ue,eo)=>await to.post({url:"/api/users/flags",body:{flag:ue,value:eo}}),toggleUiFeature:async ue=>await to.post({url:`/api/beta/${ue}`})}),buildLayoutEndpoints=to=>({saveLayout:async ue=>await to.post({url:"/api/layouts",body:ue}),deleteLayout:async(ue,eo)=>await to.delete({url:`/api/layouts/${ue}/${eo}`})}),buildOtherEndpoints=to=>({getEnvironment:async()=>await to.get({url:"/api/system/environment"}),getSystemStatus:async()=>await to.get({url:"/api/system/status"}),getIntegrations:async()=>await to.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await to.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await to.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=to=>({getPermissionForResource:async ue=>await to.get({url:`/api/permission/${ue}`}),updatePermissionForResource:async(ue,eo,no)=>await to.post({url:`/api/permission/${eo}/${ue}/${no}`}),removePermissionFromResource:async(ue,eo,no)=>await to.delete({url:`/api/permission/${eo}/${ue}/${no}`}),getDependants:async ue=>await to.get({url:`/api/permission/${ue}/dependants`})}),buildQueryEndpoints=to=>({executeQuery:async(ue,{pagination:eo,parameters:no}={})=>await to.post({url:`/api/v2/queries/${ue}`,body:{parameters:no,pagination:eo}}),fetchQueryDefinition:async ue=>await to.get({url:`/api/queries/${ue}`,cache:!0}),getQueries:async()=>await to.get({url:"/api/queries"}),saveQuery:async ue=>await to.post({url:"/api/queries",body:ue}),deleteQuery:async(ue,eo)=>await to.delete({url:`/api/queries/${ue}/${eo}`}),importQueries:async ue=>await to.post({url:"/api/queries/import",body:ue}),previewQuery:async ue=>await to.post({url:"/api/queries/preview",body:ue})}),buildRelationshipEndpoints=to=>({fetchRelationshipData:async(ue,eo,no)=>{const ro=await to.get({url:`/api/${ue}/${eo}/enrich?field=${no}`});return no?ro[no]||[]:[ro]}}),buildRoleEndpoints=to=>({deleteRole:async(ue,eo)=>await to.delete({url:`/api/roles/${ue}/${eo}`}),saveRole:async ue=>await to.post({url:"/api/roles",body:ue}),getRoles:async()=>await to.get({url:"/api/roles"}),getRolesForApp:async ue=>await to.get({url:`/api/global/roles/${ue}`}),getAccessibleRoles:async()=>await to.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=to=>({fetchClientAppRoutes:async()=>await to.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await to.get({url:"/api/routing"})}),buildRowEndpoints=to=>({fetchRow:async(ue,eo)=>await to.get({url:`/api/${ue}/rows/${eo}`}),saveRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.post({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},patchRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.patch({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},deleteRow:async(ue,eo)=>await to.delete({url:`/api/${ue}/rows`,body:{_id:eo}}),deleteRows:async(ue,eo)=>(eo.forEach(no=>{typeof no=="object"&&(no==null||delete no._viewId)}),await to.delete({url:`/api/${ue}/rows`,body:{rows:eo}})),exportRows:async(ue,eo,no)=>await to.post({url:`/api/${ue}/rows/exportRows?format=${eo}`,body:no,parseResponse:async ro=>await ro.text()})}),buildScreenEndpoints=to=>({saveScreen:async ue=>await to.post({url:"/api/screens",body:ue}),deleteScreen:async(ue,eo)=>await to.delete({url:`/api/screens/${ue}/${eo}`})}),buildTableEndpoints=to=>({fetchTableDefinition:async ue=>await to.get({url:`/api/tables/${ue}`,cache:!0}),fetchTableData:async ue=>await to.get({url:`/api/${ue}/rows`}),searchTable:async(ue,eo)=>await to.post({url:`/api/${ue}/search`,body:eo}),importTableData:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/import`,body:{rows:eo,identifierFields:no}}),csvToJson:async ue=>await to.post({url:"/api/convert/csvToJson",body:{csvString:ue}}),getTables:async()=>await to.get({url:"/api/tables"}),getTable:async ue=>await to.get({url:`/api/tables/${ue}`}),saveTable:async ue=>await to.post({url:"/api/tables",body:ue}),deleteTable:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/${eo}`}),validateNewTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateNewTableImport",body:{rows:ue,schema:eo}}),validateExistingTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateExistingTableImport",body:{rows:ue,tableId:eo}}),migrateColumn:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/migrate`,body:{oldColumn:eo,newColumn:no}})}),buildTemplateEndpoints=to=>({getEmailTemplateDefinitions:async()=>await to.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await to.get({url:"/api/global/template/email"}),saveEmailTemplate:async ue=>await to.post({url:"/api/global/template",body:ue}),getAppTemplates:async()=>await to.get({url:"/api/templates"})}),buildUserEndpoints=to=>({getUsers:async()=>await to.get({url:"/api/global/users"}),searchUsers:async ue=>await to.post({url:"/api/global/users/search",body:ue}),getUser:async ue=>await to.get({url:`/api/global/users/${ue}`}),updateOwnMetadata:async ue=>await to.post({url:"/api/users/metadata/self",body:ue}),createAdminUser:async ue=>await to.post({url:"/api/global/users/init",body:ue}),saveUser:async ue=>await to.post({url:"/api/global/users",body:ue}),createUsers:async(ue,eo)=>(await to.post({url:"/api/global/users/bulk",body:{create:{users:ue,groups:eo}}})).created,deleteUser:async ue=>await to.delete({url:`/api/global/users/${ue}`}),deleteUsers:async ue=>(await to.post({url:"/api/global/users/bulk",body:{delete:{users:ue}}})).deleted,onboardUsers:async ue=>await to.post({url:"/api/global/users/onboard",body:ue}),updateUserInvite:async(ue,eo)=>await to.post({url:`/api/global/users/invite/update/${ue}`,body:eo}),getUserInvite:async ue=>await to.get({url:`/api/global/users/invite/${ue}`}),getUserInvites:async()=>await to.get({url:"/api/global/users/invites"}),inviteUsers:async ue=>await to.post({url:"/api/global/users/multi/invite",body:ue}),removeUserInvites:async ue=>await to.post({url:"/api/global/users/multi/invite/delete",body:ue}),acceptInvite:async ue=>await to.post({url:"/api/global/users/invite/accept",body:ue}),getUserCountByApp:async ue=>(await to.get({url:`/api/global/users/count/${ue}`})).userCount,addAppBuilder:async(ue,eo)=>await to.post({url:`/api/global/users/${ue}/app/${eo}/builder`}),removeAppBuilder:async(ue,eo)=>await to.delete({url:`/api/global/users/${ue}/app/${eo}/builder`}),getAccountHolder:async()=>await to.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=to=>({generateAPIKey:async()=>{const ue=await to.post({url:"/api/global/self/api_key"});return ue==null?void 0:ue.apiKey},fetchDeveloperInfo:async()=>to.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await to.get({url:"/api/self"}),fetchBuilderSelf:async()=>await to.get({url:"/api/global/self"}),updateSelf:async ue=>await to.post({url:"/api/global/self",body:ue})}),buildViewEndpoints=to=>({fetchViewData:async(ue,{field:eo,groupBy:no,calculation:ro})=>{const oo=new URLSearchParams;ro&&(oo.set("field",eo),oo.set("calculation",ro)),no&&oo.set("group",no);const io=eo?`/api/views/${encodeURIComponent(ue)}?${oo}`:`/api/views/${encodeURIComponent(ue)}`;return await to.get({url:io})},exportView:async(ue,eo)=>{const no=encodeURIComponent(ue);return await to.get({url:`/api/views/export?view=${no}&format=${eo}`,parseResponse:async ro=>await ro.text()})},saveView:async ue=>await to.post({url:"/api/views",body:ue}),deleteView:async ue=>await to.delete({url:`/api/views/${encodeURIComponent(ue)}`})}),buildViewV2Endpoints=to=>({fetchDefinition:async ue=>await to.get({url:`/api/v2/views/${encodeURIComponent(ue)}`,cache:!0}),create:async ue=>await to.post({url:"/api/v2/views",body:ue}),update:async ue=>await to.put({url:`/api/v2/views/${encodeURIComponent(ue.id)}`,body:ue}),fetch:async(ue,eo)=>await to.post({url:`/api/v2/views/${encodeURIComponent(ue)}/search`,body:eo}),delete:async ue=>await to.delete({url:`/api/v2/views/${encodeURIComponent(ue)}`})}),buildLicensingEndpoints=to=>({activateLicenseKey:async ue=>to.post({url:"/api/global/license/key",body:{licenseKey:ue}}),deleteLicenseKey:async()=>to.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await to.get({url:"/api/global/license/key"})}catch(ue){if(ue.status!==404)throw ue}},activateOfflineLicense:async ue=>to.post({url:"/api/global/license/offline",body:{offlineLicenseToken:ue}}),deleteOfflineLicense:async()=>to.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await to.get({url:"/api/global/license/offline"})}catch(ue){if(ue.status!==404)throw ue}},getOfflineLicenseIdentifier:async()=>await to.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>to.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>to.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=to=>{async function ue(eo,no,ro,oo){return await to.post({url:`/api/global/groups/${eo}/${no}`,body:{[ro]:oo}})}return{saveGroup:async eo=>await to.post({url:"/api/global/groups",body:eo}),getGroups:async()=>(await to.get({url:"/api/global/groups"})).data,getGroup:async eo=>await to.get({url:`/api/global/groups/${eo}`}),deleteGroup:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/${no}`}),getGroupUsers:async({id:eo,bookmark:no,emailSearch:ro})=>{let oo=`/api/global/groups/${eo}/users?`;return no&&(oo+=`bookmark=${no}&`),ro&&(oo+=`emailSearch=${ro}`),await to.get({url:oo})},addUsersToGroup:async(eo,no)=>ue(eo,"users","add",no),removeUsersFromGroup:async(eo,no)=>ue(eo,"users","remove",no),addAppsToGroup:async(eo,no)=>ue(eo,"apps","add",no),removeAppsFromGroup:async(eo,no)=>ue(eo,"apps","remove",no),addGroupAppBuilder:async(eo,no)=>await to.post({url:`/api/global/groups/${eo}/app/${no}/builder`}),removeGroupAppBuilder:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/app/${no}/builder`})}},buildPluginEndpoints=to=>({uploadPlugin:async ue=>await to.post({url:"/api/plugin/upload",body:ue,json:!1}),createPlugin:async ue=>await to.post({url:"/api/plugin",body:ue}),getPlugins:async()=>await to.get({url:"/api/plugin"}),deletePlugin:async ue=>await to.delete({url:`/api/plugin/${ue}`})}),buildBackupEndpoints=to=>({createManualBackup:async ue=>await to.post({url:`/api/apps/${ue}/backups`}),searchBackups:async(ue,eo)=>await to.post({url:`/api/apps/${ue}/backups/search`,body:eo}),deleteBackup:async(ue,eo)=>await to.delete({url:`/api/apps/${ue}/backups/${eo}`}),restoreBackup:async(ue,eo,no)=>await to.post({url:`/api/apps/${ue}/backups/${eo}/import`,body:{name:no}})}),buildEnvironmentVariableEndpoints=to=>({checkEnvironmentVariableStatus:async()=>await to.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await to.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async ue=>await to.post({url:"/api/env/variables",body:ue}),deleteEnvironmentVariable:async ue=>await to.delete({url:`/api/env/variables/${ue}`}),updateEnvironmentVariable:async(ue,eo)=>await to.patch({url:`/api/env/variables/${ue}`,body:eo})}),buildEventEndpoints=to=>({publishEvent:async ue=>await to.post({url:"/api/global/event/publish",body:{type:ue}})}),buildAuditLogEndpoints=to=>({searchAuditLogs:async ue=>await to.post({url:"/api/global/auditlogs/search",body:ue}),getEventDefinitions:async()=>await to.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:ue=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(ue))}`}),buildLogsEndpoints=to=>({getSystemLogs:async()=>await to.get({url:"/api/system/logs",json:!1,parseResponse:async ue=>ue})}),buildMigrationEndpoints=to=>({getMigrationStatus:async()=>await to.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=to=>({fetch:async ue=>(await to.get({url:`/api/tables/${ue}/actions`})).actions,create:async(ue,eo)=>await to.post({url:`/api/tables/${ue}/actions`,body:{name:eo}}),delete:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}`}),enableView:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),disableView:async(ue,eo,no)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),trigger:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/trigger`,body:{rowId:no}})}),APISessionID=uuid$2(),createAPIClient=(to={})=>{let ue={};const eo=async(lo,co,uo=!1)=>{let fo=lo.statusText,po=null;try{po=await lo.json(),po!=null&&po.message?fo=po.message:po!=null&&po.error&&(fo=po.error)}catch{}return{message:fo,json:po,status:lo.status,url:lo.url,method:co,handled:!0,suppressErrors:uo}},no=(lo,co,uo)=>({message:lo,json:null,status:400,url:co,method:uo,handled:!0,suppressErrors:!1}),ro=async lo=>{let{json:co,method:uo,external:fo,body:po,url:ho,parseResponse:_o,suppressErrors:go}=lo;co=co&&uo!==HTTPMethod.GET;let bo={Accept:"application/json"};bo[Header$1.SESSION_ID]=APISessionID,fo||(bo[Header$1.API_VER]=ApiVersion),co&&(bo["Content-Type"]="application/json"),to!=null&&to.attachHeaders&&to.attachHeaders(bo);let vo=po;if(co)try{vo=JSON.stringify(po)}catch{throw no("Invalid JSON body",ho,uo)}let yo;try{yo=await fetch(ho,{method:uo,headers:bo,body:vo,credentials:"same-origin"})}catch{throw delete ue[ho],no("Failed to send request",ho,uo)}if(yo.status>=200&&yo.status<400){oo(yo);try{return yo.status===204?void 0:_o?await _o(yo):await yo.json()}catch(wo){throw delete ue[ho],`Failed to parse response: ${wo}`}}else throw delete ue[ho],await eo(yo,uo,go)},oo=lo=>{if(!to.onMigrationDetected)return;const co=lo.headers.get(Header$1.MIGRATING_APP);co&&to.onMigrationDetected(co)},io=async lo=>{const co=lo.url;return ue[co]||(ue[co]=ro(lo),ue[co]=await ue[co]),await ue[co]},ao=lo=>async co=>{try{let uo={json:!0,external:!1,suppressErrors:!1,cache:!1,method:lo,...co},{url:fo,cache:po,external:ho}=uo;return ho||(uo.url=`/${fo}`.replace("//","/")),await(po&&(to==null?void 0:to.enableCaching)?io:ro)(uo)}catch(uo){throw to!=null&&to.onError&&to.onError(uo),uo}};let so={post:ao(HTTPMethod.POST),get:ao(HTTPMethod.GET),patch:ao(HTTPMethod.PATCH),delete:ao(HTTPMethod.DELETE),put:ao(HTTPMethod.PUT),error:lo=>{throw no(lo)},invalidateCache:()=>{ue={}},getAppID:()=>{var co;let lo={};return(co=to==null?void 0:to.attachHeaders)==null||co.call(to,lo),lo==null?void 0:lo[Header$1.APP_ID]}};return{...so,...buildAIEndpoints(so),...buildAnalyticsEndpoints(so),...buildAppEndpoints(so),...buildAttachmentEndpoints(so),...buildAuthEndpoints(so),...buildAutomationEndpoints(so),...buildConfigEndpoints(so),...buildDatasourceEndpoints(so),...buildFlagEndpoints(so),...buildLayoutEndpoints(so),...buildOtherEndpoints(so),...buildPermissionsEndpoints(so),...buildQueryEndpoints(so),...buildRelationshipEndpoints(so),...buildRoleEndpoints(so),...buildRouteEndpoints(so),...buildRowEndpoints(so),...buildScreenEndpoints(so),...buildTableEndpoints(so),...buildTemplateEndpoints(so),...buildUserEndpoints(so),...buildViewEndpoints(so),...buildSelfEndpoints(so),...buildLicensingEndpoints(so),...buildGroupsEndpoints(so),...buildPluginEndpoints(so),...buildBackupEndpoints(so),...buildEnvironmentVariableEndpoints(so),...buildEventEndpoints(so),...buildAuditLogEndpoints(so),...buildLogsEndpoints(so),...buildMigrationEndpoints(so),viewV2:buildViewV2Endpoints(so),rowActions:buildRowActionEndpoints(so)}},getJSONArrayDatasourceSchema=(to,ue)=>{let eo=to,no=[];ue.prefixKeys&&(no=ue.prefixKeys.concat(["schema"])),no=no.concat(ue.label.split(".").slice(2));for(let ro=0;ro<no.length;ro++)eo=eo==null?void 0:eo[no[ro]],eo!=null&&eo.schema&&(eo=eo.schema);return convertJSONSchemaToTableSchema(eo,{squashObjects:!0,prefixKeys:no})},convertJSONSchemaToTableSchema=(to,ue)=>{if(!to)return null;ue={squashObjects:!1,prefixKeys:null,...ue},to.schema?to=to.schema:to={value:to};const eo=extractJSONSchemaKeys(to,ue.squashObjects);let no={};return eo.forEach(({key:ro,type:oo})=>{no[ro]={type:oo,name:ro,prefixKeys:ue.prefixKeys}}),no},extractJSONSchemaKeys=(to,ue=!1)=>{if(!to||!Object.keys(to).length)return[];let eo=[];return Object.keys(to).forEach(no=>{const ro=to[no].type;if(ro==="json"&&ue){const oo=extractJSONSchemaKeys(to[no].schema,ue);eo=eo.concat(oo.map(io=>({key:`${no}.${io.key}`,type:io.type})))}else eo.push({key:no,type:ro==="array"?"jsonarray":ro})}),eo},generateQueryArraySchemas=(to,ue)=>{var eo,no;for(let ro in to)((eo=to[ro])==null?void 0:eo.type)==="json"&&((no=to[ro])==null?void 0:no.subtype)==="array"&&hasSchema(ue[ro])&&(to[ro]={schema:{schema:Object.entries(ue[ro]||{}).reduce((oo,[io,ao])=>(oo[io]={name:io,type:ao.type,subtype:ao.subtype},oo),{}),type:"json"},type:"json",subtype:"array"});return to};function setCookie(to,ue,eo){getCookie(to)&&removeCookie(to);let no=`${to}=${ue}; Path=/;`;eo&&(no+=` Domain=${eo};`),window.document.cookie=no}function getCookie(to){const eo=`; ${document.cookie}`.split(`; ${to}=`);if(eo.length===2)return eo[1].split(";").shift()}function removeCookie(to){getCookie(to)&&(document.cookie=`${to}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles$2.ADMIN]:5,[Roles$2.CREATOR]:4,[Roles$2.POWER]:3,[Roles$2.BASIC]:2,[Roles$2.PUBLIC]:1},getRolePriority=to=>RolePriorities[to]??0,sleep$2=to=>new Promise(ue=>setTimeout(ue,to)),sequential=to=>{let ue=[];return(...eo)=>new Promise((no,ro)=>{ue.push(async()=>{let oo,io;try{oo=await to(...eo)}catch(ao){io=ao}ue.shift(),ue.length&&ue[0](),io?ro(io):no(oo)}),ue.length===1&&ue[0]()})},debounce=(to,ue=1e3)=>{let eo;return async(...no)=>new Promise(ro=>{eo&&clearTimeout(eo),eo=setTimeout(async()=>{ro(await to(...no))},ue)})},domDebounce=to=>{let ue=!1,eo;return(...no)=>{eo=no,ue||(ue=!0,requestAnimationFrame(()=>{to(...eo),ue=!1}))}},buildFormBlockButtonConfig=to=>{const{_id:ue,actionType:eo,dataSource:no,notificationOverride:ro,actionUrl:oo,showDeleteButton:io,deleteButtonLabel:ao,showSaveButton:so,saveButtonLabel:lo}=to||{};if(!ue)return;const co=`${ue}-form`,uo=`${ue}-repeater`,fo=no==null?void 0:no.resourceId,po=io===!1?"":ao==null?void 0:ao.trim(),ho=so===!1?"":lo==null?void 0:lo.trim(),_o=[{"##eventHandlerType":"Validate Form",parameters:{componentId:co}},{"##eventHandlerType":"Save Row",parameters:{providerId:co,tableId:fo,notificationOverride:ro,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...eo!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:co}}],...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],go=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:fo,rowId:`{{ ${makePropSafe(uo)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(uo)}.${makePropSafe("_rev")} }}`,notificationOverride:ro}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],bo=[];return["Update","Create"].includes(eo)&&so!==!1&&bo.push({text:ho||"Save",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:_o,type:"cta"}),eo==="Update"&&io!==!1&&bo.push({text:po||"Delete",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:go,quiet:!0,type:"warning"}),bo},buildMultiStepFormBlockDefaultProps=to=>{const{_id:ue,stepCount:eo,currentStep:no,actionType:ro,dataSource:oo}=to||{};if(!ue||!eo)return;const io=`Step {{ [${ue}-form].[__currentStep] }}`,ao=oo==null?void 0:oo.resourceId,so=`${ue}-form`;let lo=[];return no!==0&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:so},"##eventHandlerType":"Change Form Step"}]}),no!==eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{parameters:{type:"next",componentId:so},"##eventHandlerType":"Change Form Step"}]}),ro!=="View"&&no===eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{"##eventHandlerType":"Save Row",parameters:{tableId:ao,providerId:so}},...ro!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:so}}]]}),{buttons:lo,title:io}};function parseFilter(to){if(!(to!=null&&to.groups))return to;const ue=lodashExports.cloneDeep(to);return ue.groups=ue.groups.map(eo=>(eo.filters=eo.filters.filter(no=>no.field&&no.operator),eo.filters.length?eo:null)).filter(eo=>eo),ue}const isBetterSample=(to,ue)=>{if(ue==null&&to!=null)return!0;if(ue!=null&&to==null)return!1;const eo=typeof ue,no=typeof to;return eo!==no?!1:no==="string"&&to.length>ue.length||no==="object"&&Object.keys(to).length>Object.keys(ue).length},generateGoldenSample=to=>{let ue={};return to==null||to.slice(0,100).forEach(eo=>{Object.keys(eo).forEach(no=>{isBetterSample(eo[no],ue[no])&&(ue[no]=eo[no])})}),ue};function getTableFields(to,ue){const eo=to.find(ro=>ro._id===ue.tableId);return!eo||!eo.sql?[]:getFields(to,Object.values(eo.schema),{allowLinks:!1}).map(ro=>({...ro,name:`${ue.name}.${ro.name}`}))}function getFields(to,ue,{allowLinks:eo}={allowLinks:!0}){let no=ue.filter(oo=>!BannedSearchTypes.includes(oo.type));if(eo){const oo=ue.filter(io=>io.type==="link");for(let io of oo)no=no.concat(getTableFields(to,io))}const ro=ue.filter(oo=>oo.type==="formula"&&oo.formulaType==="static");return no.concat(ro)}const getColumnIcon=to=>{if(to.schema.icon)return to.schema.icon;if(to.calculationType)return"Calculator";if(to.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(to.schema))return"User";const{type:ue,subtype:eo}=to.schema;return(typeof TypeIconMap$1[ue]=="object"&&eo?TypeIconMap$1[ue][eo]:TypeIconMap$1[ue])||"Text"},memo=to=>{const ue=writable(to);let eo=JSON.stringify(to);const no=ro=>{const oo=JSON.stringify(ro);oo!==eo&&(ue.set(ro),eo=oo)};return{subscribe:ue.subscribe,set:no,update:ro=>{let oo=JSON.parse(eo);const io=ro(oo);no(io)}}},derivedMemo=(to,ue)=>{const eo=derived(to,ue),no=memo(get_store_value(eo));return eo.subscribe(no.set),no},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(to=>{PACKET_TYPES_REVERSE[PACKET_TYPES[to]]=to});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to&&to.buffer instanceof ArrayBuffer,encodePacket=({type:to,data:ue},eo,no)=>withNativeBlob$1&&ue instanceof Blob?eo?no(ue):encodeBlobAsBase64(ue,no):withNativeArrayBuffer$2&&(ue instanceof ArrayBuffer||isView$1(ue))?eo?no(ue):encodeBlobAsBase64(new Blob([ue]),no):no(PACKET_TYPES[to]+(ue||"")),encodeBlobAsBase64=(to,ue)=>{const eo=new FileReader;return eo.onload=function(){const no=eo.result.split(",")[1];ue("b"+(no||""))},eo.readAsDataURL(to)};function toArray$2(to){return to instanceof Uint8Array?to:to instanceof ArrayBuffer?new Uint8Array(to):new Uint8Array(to.buffer,to.byteOffset,to.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(to,ue){if(withNativeBlob$1&&to.data instanceof Blob)return to.data.arrayBuffer().then(toArray$2).then(ue);if(withNativeArrayBuffer$2&&(to.data instanceof ArrayBuffer||isView$1(to.data)))return ue(toArray$2(to.data));encodePacket(to,!1,eo=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),ue(TEXT_ENCODER.encode(eo))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let to=0;to<chars.length;to++)lookup$1[chars.charCodeAt(to)]=to;const decode$3=to=>{let ue=to.length*.75,eo=to.length,no,ro=0,oo,io,ao,so;to[to.length-1]==="="&&(ue--,to[to.length-2]==="="&&ue--);const lo=new ArrayBuffer(ue),co=new Uint8Array(lo);for(no=0;no<eo;no+=4)oo=lookup$1[to.charCodeAt(no)],io=lookup$1[to.charCodeAt(no+1)],ao=lookup$1[to.charCodeAt(no+2)],so=lookup$1[to.charCodeAt(no+3)],co[ro++]=oo<<2|io>>4,co[ro++]=(io&15)<<4|ao>>2,co[ro++]=(ao&3)<<6|so&63;return lo},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(to,ue)=>{if(typeof to!="string")return{type:"message",data:mapBinary(to,ue)};const eo=to.charAt(0);return eo==="b"?{type:"message",data:decodeBase64Packet(to.substring(1),ue)}:PACKET_TYPES_REVERSE[eo]?to.length>1?{type:PACKET_TYPES_REVERSE[eo],data:to.substring(1)}:{type:PACKET_TYPES_REVERSE[eo]}:ERROR_PACKET},decodeBase64Packet=(to,ue)=>{if(withNativeArrayBuffer$1){const eo=decode$3(to);return mapBinary(eo,ue)}else return{base64:!0,data:to}},mapBinary=(to,ue)=>{switch(ue){case"blob":return to instanceof Blob?to:new Blob([to]);case"arraybuffer":default:return to instanceof ArrayBuffer?to:to.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(to,ue)=>{const eo=to.length,no=new Array(eo);let ro=0;to.forEach((oo,io)=>{encodePacket(oo,!1,ao=>{no[io]=ao,++ro===eo&&ue(no.join(SEPARATOR))})})},decodePayload=(to,ue)=>{const eo=to.split(SEPARATOR),no=[];for(let ro=0;ro<eo.length;ro++){const oo=decodePacket(eo[ro],ue);if(no.push(oo),oo.type==="error")break}return no};function createPacketEncoderStream(){return new TransformStream({transform(to,ue){encodePacketToBinary(to,eo=>{const no=eo.length;let ro;if(no<126)ro=new Uint8Array(1),new DataView(ro.buffer).setUint8(0,no);else if(no<65536){ro=new Uint8Array(3);const oo=new DataView(ro.buffer);oo.setUint8(0,126),oo.setUint16(1,no)}else{ro=new Uint8Array(9);const oo=new DataView(ro.buffer);oo.setUint8(0,127),oo.setBigUint64(1,BigInt(no))}to.data&&typeof to.data!="string"&&(ro[0]|=128),ue.enqueue(ro),ue.enqueue(eo)})}})}let TEXT_DECODER;function totalLength(to){return to.reduce((ue,eo)=>ue+eo.length,0)}function concatChunks(to,ue){if(to[0].length===ue)return to.shift();const eo=new Uint8Array(ue);let no=0;for(let ro=0;ro<ue;ro++)eo[ro]=to[0][no++],no===to[0].length&&(to.shift(),no=0);return to.length&&no<to[0].length&&(to[0]=to[0].slice(no)),eo}function createPacketDecoderStream(to,ue){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const eo=[];let no=0,ro=-1,oo=!1;return new TransformStream({transform(io,ao){for(eo.push(io);;){if(no===0){if(totalLength(eo)<1)break;const so=concatChunks(eo,1);oo=(so[0]&128)===128,ro=so[0]&127,ro<126?no=3:ro===126?no=1:no=2}else if(no===1){if(totalLength(eo)<2)break;const so=concatChunks(eo,2);ro=new DataView(so.buffer,so.byteOffset,so.length).getUint16(0),no=3}else if(no===2){if(totalLength(eo)<8)break;const so=concatChunks(eo,8),lo=new DataView(so.buffer,so.byteOffset,so.length),co=lo.getUint32(0);if(co>Math.pow(2,53-32)-1){ao.enqueue(ERROR_PACKET);break}ro=co*Math.pow(2,32)+lo.getUint32(4),no=3}else{if(totalLength(eo)<ro)break;const so=concatChunks(eo,ro);ao.enqueue(decodePacket(oo?so:TEXT_DECODER.decode(so),ue)),no=0}if(ro===0||ro>to){ao.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(to){if(to)return mixin(to)}function mixin(to){for(var ue in Emitter.prototype)to[ue]=Emitter.prototype[ue];return to}Emitter.prototype.on=Emitter.prototype.addEventListener=function(to,ue){return this._callbacks=this._callbacks||{},(this._callbacks["$"+to]=this._callbacks["$"+to]||[]).push(ue),this};Emitter.prototype.once=function(to,ue){function eo(){this.off(to,eo),ue.apply(this,arguments)}return eo.fn=ue,this.on(to,eo),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(to,ue){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var eo=this._callbacks["$"+to];if(!eo)return this;if(arguments.length==1)return delete this._callbacks["$"+to],this;for(var no,ro=0;ro<eo.length;ro++)if(no=eo[ro],no===ue||no.fn===ue){eo.splice(ro,1);break}return eo.length===0&&delete this._callbacks["$"+to],this};Emitter.prototype.emit=function(to){this._callbacks=this._callbacks||{};for(var ue=new Array(arguments.length-1),eo=this._callbacks["$"+to],no=1;no<arguments.length;no++)ue[no-1]=arguments[no];if(eo){eo=eo.slice(0);for(var no=0,ro=eo.length;no<ro;++no)eo[no].apply(this,ue)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(to){return this._callbacks=this._callbacks||{},this._callbacks["$"+to]||[]};Emitter.prototype.hasListeners=function(to){return!!this.listeners(to).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick$1(to,...ue){return ue.reduce((eo,no)=>(to.hasOwnProperty(no)&&(eo[no]=to[no]),eo),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(to,ue){ue.useNativeTimers?(to.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),to.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(to.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),to.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(to){return typeof to=="string"?utf8Length(to):Math.ceil((to.byteLength||to.size)*BASE64_OVERHEAD)}function utf8Length(to){let ue=0,eo=0;for(let no=0,ro=to.length;no<ro;no++)ue=to.charCodeAt(no),ue<128?eo+=1:ue<2048?eo+=2:ue<55296||ue>=57344?eo+=3:(no++,eo+=4);return eo}function encode$3(to){let ue="";for(let eo in to)to.hasOwnProperty(eo)&&(ue.length&&(ue+="&"),ue+=encodeURIComponent(eo)+"="+encodeURIComponent(to[eo]));return ue}function decode$2(to){let ue={},eo=to.split("&");for(let no=0,ro=eo.length;no<ro;no++){let oo=eo[no].split("=");ue[decodeURIComponent(oo[0])]=decodeURIComponent(oo[1])}return ue}class TransportError extends Error{constructor(ue,eo,no){super(ue),this.description=eo,this.context=no,this.type="TransportError"}}class Transport extends Emitter{constructor(ue){super(),this.writable=!1,installTimerFunctions(this,ue),this.opts=ue,this.query=ue.query,this.socket=ue.socket}onError(ue,eo,no){return super.emitReserved("error",new TransportError(ue,eo,no)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(ue){this.readyState==="open"&&this.write(ue)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(ue){const eo=decodePacket(ue,this.socket.binaryType);this.onPacket(eo)}onPacket(ue){super.emitReserved("packet",ue)}onClose(ue){this.readyState="closed",super.emitReserved("close",ue)}pause(ue){}createUri(ue,eo={}){return ue+"://"+this._hostname()+this._port()+this.opts.path+this._query(eo)}_hostname(){const ue=this.opts.hostname;return ue.indexOf(":")===-1?ue:"["+ue+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(ue){const eo=encode$3(ue);return eo.length?"?"+eo:""}}const alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed=0,i$2=0,prev;function encode$2(to){let ue="";do ue=alphabet[to%length]+ue,to=Math.floor(to/length);while(to>0);return ue}function yeast(){const to=encode$2(+new Date);return to!==prev?(seed=0,prev=to):to+"."+encode$2(seed++)}for(;i$2<length;i$2++)map[alphabet[i$2]]=i$2;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(to){}const hasCORS=value$1;function XHR(to){const ue=to.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!ue||hasCORS))return new XMLHttpRequest}catch{}if(!ue)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty$1(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(ue){if(super(ue),this.polling=!1,typeof location<"u"){const no=location.protocol==="https:";let ro=location.port;ro||(ro=no?"443":"80"),this.xd=typeof location<"u"&&ue.hostname!==location.hostname||ro!==ue.port}const eo=ue&&ue.forceBase64;this.supportsBinary=hasXHR2&&!eo,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(ue){this.readyState="pausing";const eo=()=>{this.readyState="paused",ue()};if(this.polling||!this.writable){let no=0;this.polling&&(no++,this.once("pollComplete",function(){--no||eo()})),this.writable||(no++,this.once("drain",function(){--no||eo()}))}else eo()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(ue){const eo=no=>{if(this.readyState==="opening"&&no.type==="open"&&this.onOpen(),no.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(no)};decodePayload(ue,this.socket.binaryType).forEach(eo),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const ue=()=>{this.write([{type:"close"}])};this.readyState==="open"?ue():this.once("open",ue)}write(ue){this.writable=!1,encodePayload(ue,eo=>{this.doWrite(eo,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const ue=this.opts.secure?"https":"http",eo=this.query||{};return this.opts.timestampRequests!==!1&&(eo[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!eo.sid&&(eo.b64=1),this.createUri(ue,eo)}request(ue={}){return Object.assign(ue,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),ue)}doWrite(ue,eo){const no=this.request({method:"POST",data:ue});no.on("success",eo),no.on("error",(ro,oo)=>{this.onError("xhr post error",ro,oo)})}doPoll(){const ue=this.request();ue.on("data",this.onData.bind(this)),ue.on("error",(eo,no)=>{this.onError("xhr poll error",eo,no)}),this.pollXhr=ue}}class Request extends Emitter{constructor(ue,eo){super(),installTimerFunctions(this,eo),this.opts=eo,this.method=eo.method||"GET",this.uri=ue,this.data=eo.data!==void 0?eo.data:null,this.create()}create(){var ue;const eo=pick$1(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");eo.xdomain=!!this.opts.xd;const no=this.xhr=new XHR(eo);try{no.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){no.setDisableHeaderCheck&&no.setDisableHeaderCheck(!0);for(let ro in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(ro)&&no.setRequestHeader(ro,this.opts.extraHeaders[ro])}}catch{}if(this.method==="POST")try{no.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{no.setRequestHeader("Accept","*/*")}catch{}(ue=this.opts.cookieJar)===null||ue===void 0||ue.addCookies(no),"withCredentials"in no&&(no.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(no.timeout=this.opts.requestTimeout),no.onreadystatechange=()=>{var ro;no.readyState===3&&((ro=this.opts.cookieJar)===null||ro===void 0||ro.parseCookies(no)),no.readyState===4&&(no.status===200||no.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof no.status=="number"?no.status:0)},0))},no.send(this.data)}catch(ro){this.setTimeoutFn(()=>{this.onError(ro)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(ue){this.emitReserved("error",ue,this.xhr),this.cleanup(!0)}cleanup(ue){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,ue)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const ue=this.xhr.responseText;ue!==null&&(this.emitReserved("data",ue),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Request.requestsCount=0;Request.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const to="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(to,unloadHandler,!1)}}function unloadHandler(){for(let to in Request.requests)Request.requests.hasOwnProperty(to)&&Request.requests[to].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?ue=>Promise.resolve().then(ue):(ue,eo)=>eo(ue,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(ue){super(ue),this.supportsBinary=!ue.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const ue=this.uri(),eo=this.opts.protocols,no=isReactNative?{}:pick$1(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(no.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?eo?new WebSocket(ue,eo):new WebSocket(ue):new WebSocket(ue,eo,no)}catch(ro){return this.emitReserved("error",ro)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=ue=>this.onClose({description:"websocket connection closed",context:ue}),this.ws.onmessage=ue=>this.onData(ue.data),this.ws.onerror=ue=>this.onError("websocket error",ue)}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;encodePacket(no,this.supportsBinary,oo=>{const io={};try{usingBrowserWebSocket&&this.ws.send(oo)}catch{}ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const ue=this.opts.secure?"wss":"ws",eo=this.query||{};return this.opts.timestampRequests&&(eo[this.opts.timestampParam]=yeast()),this.supportsBinary||(eo.b64=1),this.createUri(ue,eo)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(ue=>{this.onError("webtransport error",ue)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(ue=>{const eo=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),no=ue.readable.pipeThrough(eo).getReader(),ro=createPacketEncoderStream();ro.readable.pipeTo(ue.writable),this.writer=ro.writable.getWriter();const oo=()=>{no.read().then(({done:ao,value:so})=>{ao||(this.onPacket(so),oo())}).catch(ao=>{})};oo();const io={type:"open"};this.query.sid&&(io.data=`{"sid":"${this.query.sid}"}`),this.writer.write(io).then(()=>this.onOpen())})}))}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;this.writer.write(no).then(()=>{ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var ue;(ue=this.transport)===null||ue===void 0||ue.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$8(to){if(to.length>2e3)throw"URI too long";const ue=to,eo=to.indexOf("["),no=to.indexOf("]");eo!=-1&&no!=-1&&(to=to.substring(0,eo)+to.substring(eo,no).replace(/:/g,";")+to.substring(no,to.length));let ro=re$1.exec(to||""),oo={},io=14;for(;io--;)oo[parts[io]]=ro[io]||"";return eo!=-1&&no!=-1&&(oo.source=ue,oo.host=oo.host.substring(1,oo.host.length-1).replace(/;/g,":"),oo.authority=oo.authority.replace("[","").replace("]","").replace(/;/g,":"),oo.ipv6uri=!0),oo.pathNames=pathNames(oo,oo.path),oo.queryKey=queryKey(oo,oo.query),oo}function pathNames(to,ue){const eo=/\/{2,9}/g,no=ue.replace(eo,"/").split("/");return(ue.slice(0,1)=="/"||ue.length===0)&&no.splice(0,1),ue.slice(-1)=="/"&&no.splice(no.length-1,1),no}function queryKey(to,ue){const eo={};return ue.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(no,ro,oo){ro&&(eo[ro]=oo)}),eo}let Socket$1=class dh extends Emitter{constructor(ue,eo={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],ue&&typeof ue=="object"&&(eo=ue,ue=null),ue?(ue=parse$8(ue),eo.hostname=ue.host,eo.secure=ue.protocol==="https"||ue.protocol==="wss",eo.port=ue.port,ue.query&&(eo.query=ue.query)):eo.host&&(eo.hostname=parse$8(eo.host).host),installTimerFunctions(this,eo),this.secure=eo.secure!=null?eo.secure:typeof location<"u"&&location.protocol==="https:",eo.hostname&&!eo.port&&(eo.port=this.secure?"443":"80"),this.hostname=eo.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=eo.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=eo.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},eo),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(ue){const eo=Object.assign({},this.opts.query);eo.EIO=protocol$1,eo.transport=ue,this.id&&(eo.sid=this.id);const no=Object.assign({},this.opts,{query:eo,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[ue]);return new transports[ue](no)}open(){let ue;if(this.opts.rememberUpgrade&&dh.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)ue="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else ue=this.transports[0];this.readyState="opening";try{ue=this.createTransport(ue)}catch{this.transports.shift(),this.open();return}ue.open(),this.setTransport(ue)}setTransport(ue){this.transport&&this.transport.removeAllListeners(),this.transport=ue,ue.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",eo=>this.onClose("transport close",eo))}probe(ue){let eo=this.createTransport(ue),no=!1;dh.priorWebsocketSuccess=!1;const ro=()=>{no||(eo.send([{type:"ping",data:"probe"}]),eo.once("packet",uo=>{if(!no)if(uo.type==="pong"&&uo.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",eo),!eo)return;dh.priorWebsocketSuccess=eo.name==="websocket",this.transport.pause(()=>{no||this.readyState!=="closed"&&(co(),this.setTransport(eo),eo.send([{type:"upgrade"}]),this.emitReserved("upgrade",eo),eo=null,this.upgrading=!1,this.flush())})}else{const fo=new Error("probe error");fo.transport=eo.name,this.emitReserved("upgradeError",fo)}}))};function oo(){no||(no=!0,co(),eo.close(),eo=null)}const io=uo=>{const fo=new Error("probe error: "+uo);fo.transport=eo.name,oo(),this.emitReserved("upgradeError",fo)};function ao(){io("transport closed")}function so(){io("socket closed")}function lo(uo){eo&&uo.name!==eo.name&&oo()}const co=()=>{eo.removeListener("open",ro),eo.removeListener("error",io),eo.removeListener("close",ao),this.off("close",so),this.off("upgrading",lo)};eo.once("open",ro),eo.once("error",io),eo.once("close",ao),this.once("close",so),this.once("upgrading",lo),this.upgrades.indexOf("webtransport")!==-1&&ue!=="webtransport"?this.setTimeoutFn(()=>{no||eo.open()},200):eo.open()}onOpen(){if(this.readyState="open",dh.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let ue=0;const eo=this.upgrades.length;for(;ue<eo;ue++)this.probe(this.upgrades[ue])}}onPacket(ue){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",ue),this.emitReserved("heartbeat"),this.resetPingTimeout(),ue.type){case"open":this.onHandshake(JSON.parse(ue.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const eo=new Error("server error");eo.code=ue.data,this.onError(eo);break;case"message":this.emitReserved("data",ue.data),this.emitReserved("message",ue.data);break}}onHandshake(ue){this.emitReserved("handshake",ue),this.id=ue.sid,this.transport.query.sid=ue.sid,this.upgrades=this.filterUpgrades(ue.upgrades),this.pingInterval=ue.pingInterval,this.pingTimeout=ue.pingTimeout,this.maxPayload=ue.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const ue=this.getWritablePackets();this.transport.send(ue),this.prevBufferLen=ue.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let eo=1;for(let no=0;no<this.writeBuffer.length;no++){const ro=this.writeBuffer[no].data;if(ro&&(eo+=byteLength(ro)),no>0&&eo>this.maxPayload)return this.writeBuffer.slice(0,no);eo+=2}return this.writeBuffer}write(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}send(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}sendPacket(ue,eo,no,ro){if(typeof eo=="function"&&(ro=eo,eo=void 0),typeof no=="function"&&(ro=no,no=null),this.readyState==="closing"||this.readyState==="closed")return;no=no||{},no.compress=no.compress!==!1;const oo={type:ue,data:eo,options:no};this.emitReserved("packetCreate",oo),this.writeBuffer.push(oo),ro&&this.once("flush",ro),this.flush()}close(){const ue=()=>{this.onClose("forced close"),this.transport.close()},eo=()=>{this.off("upgrade",eo),this.off("upgradeError",eo),ue()},no=()=>{this.once("upgrade",eo),this.once("upgradeError",eo)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?no():ue()}):this.upgrading?no():ue()),this}onError(ue){dh.priorWebsocketSuccess=!1,this.emitReserved("error",ue),this.onClose("transport error",ue)}onClose(ue,eo){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",ue,eo),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(ue){const eo=[];let no=0;const ro=ue.length;for(;no<ro;no++)~this.transports.indexOf(ue[no])&&eo.push(ue[no]);return eo}};Socket$1.protocol=protocol$1;function url$1(to,ue="",eo){let no=to;eo=eo||typeof location<"u"&&location,to==null&&(to=eo.protocol+"//"+eo.host),typeof to=="string"&&(to.charAt(0)==="/"&&(to.charAt(1)==="/"?to=eo.protocol+to:to=eo.host+to),/^(https?|wss?):\/\//.test(to)||(typeof eo<"u"?to=eo.protocol+"//"+to:to="https://"+to),no=parse$8(to)),no.port||(/^(http|ws)$/.test(no.protocol)?no.port="80":/^(http|ws)s$/.test(no.protocol)&&(no.port="443")),no.path=no.path||"/";const oo=no.host.indexOf(":")!==-1?"["+no.host+"]":no.host;return no.id=no.protocol+"://"+oo+":"+no.port+ue,no.href=no.protocol+"://"+oo+(eo&&eo.port===no.port?"":":"+no.port),no}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to.buffer instanceof ArrayBuffer,toString$4=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$4.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$4.call(File)==="[object FileConstructor]";function isBinary(to){return withNativeArrayBuffer&&(to instanceof ArrayBuffer||isView(to))||withNativeBlob&&to instanceof Blob||withNativeFile&&to instanceof File}function hasBinary(to,ue){if(!to||typeof to!="object")return!1;if(Array.isArray(to)){for(let eo=0,no=to.length;eo<no;eo++)if(hasBinary(to[eo]))return!0;return!1}if(isBinary(to))return!0;if(to.toJSON&&typeof to.toJSON=="function"&&arguments.length===1)return hasBinary(to.toJSON(),!0);for(const eo in to)if(Object.prototype.hasOwnProperty.call(to,eo)&&hasBinary(to[eo]))return!0;return!1}function deconstructPacket(to){const ue=[],eo=to.data,no=to;return no.data=_deconstructPacket(eo,ue),no.attachments=ue.length,{packet:no,buffers:ue}}function _deconstructPacket(to,ue){if(!to)return to;if(isBinary(to)){const eo={_placeholder:!0,num:ue.length};return ue.push(to),eo}else if(Array.isArray(to)){const eo=new Array(to.length);for(let no=0;no<to.length;no++)eo[no]=_deconstructPacket(to[no],ue);return eo}else if(typeof to=="object"&&!(to instanceof Date)){const eo={};for(const no in to)Object.prototype.hasOwnProperty.call(to,no)&&(eo[no]=_deconstructPacket(to[no],ue));return eo}return to}function reconstructPacket(to,ue){return to.data=_reconstructPacket(to.data,ue),delete to.attachments,to}function _reconstructPacket(to,ue){if(!to)return to;if(to&&to._placeholder===!0){if(typeof to.num=="number"&&to.num>=0&&to.num<ue.length)return ue[to.num];throw new Error("illegal attachments")}else if(Array.isArray(to))for(let eo=0;eo<to.length;eo++)to[eo]=_reconstructPacket(to[eo],ue);else if(typeof to=="object")for(const eo in to)Object.prototype.hasOwnProperty.call(to,eo)&&(to[eo]=_reconstructPacket(to[eo],ue));return to}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(to){to[to.CONNECT=0]="CONNECT",to[to.DISCONNECT=1]="DISCONNECT",to[to.EVENT=2]="EVENT",to[to.ACK=3]="ACK",to[to.CONNECT_ERROR=4]="CONNECT_ERROR",to[to.BINARY_EVENT=5]="BINARY_EVENT",to[to.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(ue){this.replacer=ue}encode(ue){return(ue.type===PacketType.EVENT||ue.type===PacketType.ACK)&&hasBinary(ue)?this.encodeAsBinary({type:ue.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:ue.nsp,data:ue.data,id:ue.id}):[this.encodeAsString(ue)]}encodeAsString(ue){let eo=""+ue.type;return(ue.type===PacketType.BINARY_EVENT||ue.type===PacketType.BINARY_ACK)&&(eo+=ue.attachments+"-"),ue.nsp&&ue.nsp!=="/"&&(eo+=ue.nsp+","),ue.id!=null&&(eo+=ue.id),ue.data!=null&&(eo+=JSON.stringify(ue.data,this.replacer)),eo}encodeAsBinary(ue){const eo=deconstructPacket(ue),no=this.encodeAsString(eo.packet),ro=eo.buffers;return ro.unshift(no),ro}}function isObject$7(to){return Object.prototype.toString.call(to)==="[object Object]"}class Decoder extends Emitter{constructor(ue){super(),this.reviver=ue}add(ue){let eo;if(typeof ue=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");eo=this.decodeString(ue);const no=eo.type===PacketType.BINARY_EVENT;no||eo.type===PacketType.BINARY_ACK?(eo.type=no?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(eo),eo.attachments===0&&super.emitReserved("decoded",eo)):super.emitReserved("decoded",eo)}else if(isBinary(ue)||ue.base64)if(this.reconstructor)eo=this.reconstructor.takeBinaryData(ue),eo&&(this.reconstructor=null,super.emitReserved("decoded",eo));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+ue)}decodeString(ue){let eo=0;const no={type:Number(ue.charAt(0))};if(PacketType[no.type]===void 0)throw new Error("unknown packet type "+no.type);if(no.type===PacketType.BINARY_EVENT||no.type===PacketType.BINARY_ACK){const oo=eo+1;for(;ue.charAt(++eo)!=="-"&&eo!=ue.length;);const io=ue.substring(oo,eo);if(io!=Number(io)||ue.charAt(eo)!=="-")throw new Error("Illegal attachments");no.attachments=Number(io)}if(ue.charAt(eo+1)==="/"){const oo=eo+1;for(;++eo&&!(ue.charAt(eo)===","||eo===ue.length););no.nsp=ue.substring(oo,eo)}else no.nsp="/";const ro=ue.charAt(eo+1);if(ro!==""&&Number(ro)==ro){const oo=eo+1;for(;++eo;){const io=ue.charAt(eo);if(io==null||Number(io)!=io){--eo;break}if(eo===ue.length)break}no.id=Number(ue.substring(oo,eo+1))}if(ue.charAt(++eo)){const oo=this.tryParse(ue.substr(eo));if(Decoder.isPayloadValid(no.type,oo))no.data=oo;else throw new Error("invalid payload")}return no}tryParse(ue){try{return JSON.parse(ue,this.reviver)}catch{return!1}}static isPayloadValid(ue,eo){switch(ue){case PacketType.CONNECT:return isObject$7(eo);case PacketType.DISCONNECT:return eo===void 0;case PacketType.CONNECT_ERROR:return typeof eo=="string"||isObject$7(eo);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(eo)&&(typeof eo[0]=="number"||typeof eo[0]=="string"&&RESERVED_EVENTS$1.indexOf(eo[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(eo)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(ue){this.packet=ue,this.buffers=[],this.reconPack=ue}takeBinaryData(ue){if(this.buffers.push(ue),this.buffers.length===this.reconPack.attachments){const eo=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),eo}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$2=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on$1(to,ue,eo){return to.on(ue,eo),function(){to.off(ue,eo)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(ue,eo,no){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=ue,this.nsp=eo,no&&no.auth&&(this.auth=no.auth),this._opts=Object.assign({},no),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const ue=this.io;this.subs=[on$1(ue,"open",this.onopen.bind(this)),on$1(ue,"packet",this.onpacket.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...ue){return ue.unshift("message"),this.emit.apply(this,ue),this}emit(ue,...eo){if(RESERVED_EVENTS.hasOwnProperty(ue))throw new Error('"'+ue.toString()+'" is a reserved event name');if(eo.unshift(ue),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(eo),this;const no={type:PacketType.EVENT,data:eo};if(no.options={},no.options.compress=this.flags.compress!==!1,typeof eo[eo.length-1]=="function"){const io=this.ids++,ao=eo.pop();this._registerAckCallback(io,ao),no.id=io}const ro=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!ro||!this.connected)||(this.connected?(this.notifyOutgoingListeners(no),this.packet(no)):this.sendBuffer.push(no)),this.flags={},this}_registerAckCallback(ue,eo){var no;const ro=(no=this.flags.timeout)!==null&&no!==void 0?no:this._opts.ackTimeout;if(ro===void 0){this.acks[ue]=eo;return}const oo=this.io.setTimeoutFn(()=>{delete this.acks[ue];for(let ao=0;ao<this.sendBuffer.length;ao++)this.sendBuffer[ao].id===ue&&this.sendBuffer.splice(ao,1);eo.call(this,new Error("operation has timed out"))},ro),io=(...ao)=>{this.io.clearTimeoutFn(oo),eo.apply(this,ao)};io.withError=!0,this.acks[ue]=io}emitWithAck(ue,...eo){return new Promise((no,ro)=>{const oo=(io,ao)=>io?ro(io):no(ao);oo.withError=!0,eo.push(oo),this.emit(ue,...eo)})}_addToQueue(ue){let eo;typeof ue[ue.length-1]=="function"&&(eo=ue.pop());const no={id:this._queueSeq++,tryCount:0,pending:!1,args:ue,flags:Object.assign({fromQueue:!0},this.flags)};ue.push((ro,...oo)=>no!==this._queue[0]?void 0:(ro!==null?no.tryCount>this._opts.retries&&(this._queue.shift(),eo&&eo(ro)):(this._queue.shift(),eo&&eo(null,...oo)),no.pending=!1,this._drainQueue())),this._queue.push(no),this._drainQueue()}_drainQueue(ue=!1){if(!this.connected||this._queue.length===0)return;const eo=this._queue[0];eo.pending&&!ue||(eo.pending=!0,eo.tryCount++,this.flags=eo.flags,this.emit.apply(this,eo.args))}packet(ue){ue.nsp=this.nsp,this.io._packet(ue)}onopen(){typeof this.auth=="function"?this.auth(ue=>{this._sendConnectPacket(ue)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(ue){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},ue):ue})}onerror(ue){this.connected||this.emitReserved("connect_error",ue)}onclose(ue,eo){this.connected=!1,delete this.id,this.emitReserved("disconnect",ue,eo),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(ue=>{if(!this.sendBuffer.some(no=>String(no.id)===ue)){const no=this.acks[ue];delete this.acks[ue],no.withError&&no.call(this,new Error("socket has been disconnected"))}})}onpacket(ue){if(ue.nsp===this.nsp)switch(ue.type){case PacketType.CONNECT:ue.data&&ue.data.sid?this.onconnect(ue.data.sid,ue.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(ue);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(ue);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const no=new Error(ue.data.message);no.data=ue.data.data,this.emitReserved("connect_error",no);break}}onevent(ue){const eo=ue.data||[];ue.id!=null&&eo.push(this.ack(ue.id)),this.connected?this.emitEvent(eo):this.receiveBuffer.push(Object.freeze(eo))}emitEvent(ue){if(this._anyListeners&&this._anyListeners.length){const eo=this._anyListeners.slice();for(const no of eo)no.apply(this,ue)}super.emit.apply(this,ue),this._pid&&ue.length&&typeof ue[ue.length-1]=="string"&&(this._lastOffset=ue[ue.length-1])}ack(ue){const eo=this;let no=!1;return function(...ro){no||(no=!0,eo.packet({type:PacketType.ACK,id:ue,data:ro}))}}onack(ue){const eo=this.acks[ue.id];typeof eo=="function"&&(delete this.acks[ue.id],eo.withError&&ue.data.unshift(null),eo.apply(this,ue.data))}onconnect(ue,eo){this.id=ue,this.recovered=eo&&this._pid===eo,this._pid=eo,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(ue=>this.emitEvent(ue)),this.receiveBuffer=[],this.sendBuffer.forEach(ue=>{this.notifyOutgoingListeners(ue),this.packet(ue)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(ue=>ue()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(ue){return this.flags.compress=ue,this}get volatile(){return this.flags.volatile=!0,this}timeout(ue){return this.flags.timeout=ue,this}onAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(ue),this}prependAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(ue),this}offAny(ue){if(!this._anyListeners)return this;if(ue){const eo=this._anyListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(ue),this}prependAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(ue),this}offAnyOutgoing(ue){if(!this._anyOutgoingListeners)return this;if(ue){const eo=this._anyOutgoingListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(ue){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const eo=this._anyOutgoingListeners.slice();for(const no of eo)no.apply(this,ue.data)}}}function Backoff(to){to=to||{},this.ms=to.min||100,this.max=to.max||1e4,this.factor=to.factor||2,this.jitter=to.jitter>0&&to.jitter<=1?to.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var to=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var ue=Math.random(),eo=Math.floor(ue*this.jitter*to);to=Math.floor(ue*10)&1?to+eo:to-eo}return Math.min(to,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(to){this.ms=to};Backoff.prototype.setMax=function(to){this.max=to};Backoff.prototype.setJitter=function(to){this.jitter=to};class Manager extends Emitter{constructor(ue,eo){var no;super(),this.nsps={},this.subs=[],ue&&typeof ue=="object"&&(eo=ue,ue=void 0),eo=eo||{},eo.path=eo.path||"/socket.io",this.opts=eo,installTimerFunctions(this,eo),this.reconnection(eo.reconnection!==!1),this.reconnectionAttempts(eo.reconnectionAttempts||1/0),this.reconnectionDelay(eo.reconnectionDelay||1e3),this.reconnectionDelayMax(eo.reconnectionDelayMax||5e3),this.randomizationFactor((no=eo.randomizationFactor)!==null&&no!==void 0?no:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(eo.timeout==null?2e4:eo.timeout),this._readyState="closed",this.uri=ue;const ro=eo.parser||parser$2;this.encoder=new ro.Encoder,this.decoder=new ro.Decoder,this._autoConnect=eo.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(ue){return arguments.length?(this._reconnection=!!ue,this):this._reconnection}reconnectionAttempts(ue){return ue===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=ue,this)}reconnectionDelay(ue){var eo;return ue===void 0?this._reconnectionDelay:(this._reconnectionDelay=ue,(eo=this.backoff)===null||eo===void 0||eo.setMin(ue),this)}randomizationFactor(ue){var eo;return ue===void 0?this._randomizationFactor:(this._randomizationFactor=ue,(eo=this.backoff)===null||eo===void 0||eo.setJitter(ue),this)}reconnectionDelayMax(ue){var eo;return ue===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=ue,(eo=this.backoff)===null||eo===void 0||eo.setMax(ue),this)}timeout(ue){return arguments.length?(this._timeout=ue,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(ue){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const eo=this.engine,no=this;this._readyState="opening",this.skipReconnect=!1;const ro=on$1(eo,"open",function(){no.onopen(),ue&&ue()}),oo=ao=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",ao),ue?ue(ao):this.maybeReconnectOnOpen()},io=on$1(eo,"error",oo);if(this._timeout!==!1){const ao=this._timeout,so=this.setTimeoutFn(()=>{ro(),oo(new Error("timeout")),eo.close()},ao);this.opts.autoUnref&&so.unref(),this.subs.push(()=>{this.clearTimeoutFn(so)})}return this.subs.push(ro),this.subs.push(io),this}connect(ue){return this.open(ue)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const ue=this.engine;this.subs.push(on$1(ue,"ping",this.onping.bind(this)),on$1(ue,"data",this.ondata.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this)),on$1(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(ue){try{this.decoder.add(ue)}catch(eo){this.onclose("parse error",eo)}}ondecoded(ue){nextTick(()=>{this.emitReserved("packet",ue)},this.setTimeoutFn)}onerror(ue){this.emitReserved("error",ue)}socket(ue,eo){let no=this.nsps[ue];return no?this._autoConnect&&!no.active&&no.connect():(no=new Socket(this,ue,eo),this.nsps[ue]=no),no}_destroy(ue){const eo=Object.keys(this.nsps);for(const no of eo)if(this.nsps[no].active)return;this._close()}_packet(ue){const eo=this.encoder.encode(ue);for(let no=0;no<eo.length;no++)this.engine.write(eo[no],ue.options)}cleanup(){this.subs.forEach(ue=>ue()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(ue,eo){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",ue,eo),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const ue=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const eo=this.backoff.duration();this._reconnecting=!0;const no=this.setTimeoutFn(()=>{ue.skipReconnect||(this.emitReserved("reconnect_attempt",ue.backoff.attempts),!ue.skipReconnect&&ue.open(ro=>{ro?(ue._reconnecting=!1,ue.reconnect(),this.emitReserved("reconnect_error",ro)):ue.onreconnect()}))},eo);this.opts.autoUnref&&no.unref(),this.subs.push(()=>{this.clearTimeoutFn(no)})}}onreconnect(){const ue=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",ue)}}const cache$1={};function lookup(to,ue){typeof to=="object"&&(ue=to,to=void 0),ue=ue||{};const eo=url$1(to,ue.path||"/socket.io"),no=eo.source,ro=eo.id,oo=eo.path,io=cache$1[ro]&&oo in cache$1[ro].nsps,ao=ue.forceNew||ue["force new connection"]||ue.multiplex===!1||io;let so;return ao?so=new Manager(no,ue):(cache$1[ro]||(cache$1[ro]=new Manager(no,ue)),so=cache$1[ro]),eo.query&&!ue.query&&(ue.query=eo.queryKey),so.socket(eo.path,ue)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const DefaultOptions={heartbeat:!0},createWebsocket=(to,ue=DefaultOptions)=>{if(!to)throw"A websocket path must be provided";const{heartbeat:eo}={...DefaultOptions,...ue},no=location.protocol==="https:",ro=no?"wss:":"ws:",oo=location.hostname,io=location.port||(no?443:80);let ao=lookup(`${ro}//${oo}:${io}`,{path:to,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),so;return eo&&(so=setInterval(()=>{ao.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),ao.on("disconnect",()=>{clearInterval(so)}),ao.onOther=(lo,co)=>{ao.on(lo,uo=>{(uo==null?void 0:uo.apiSessionId)!==APISessionID&&co(uo)})},ao},extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;function downloadText(to,ue){typeof ue=="object"&&(ue=JSON.stringify(ue));const eo=new Blob([ue],{type:"plain/text"}),no=URL.createObjectURL(eo),ro=document.createElement("a");ro.href=no,ro.download=to,ro.click(),URL.revokeObjectURL(no)}async function downloadStream(to){const ue=await to.blob(),eo=to.headers.get("Content-Disposition"),ro=extractFileNameRegex.exec(eo)[1].replace(/['"]/g,""),oo=new Blob([ue]),io=URL.createObjectURL(oo),ao=document.createElement("a");ao.href=io,ao.download=ro,ao.click(),URL.revokeObjectURL(io)}async function downloadFile(to,ue){const eo=await fetch(to,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(eo.ok){const no=eo.headers.get("Content-Disposition"),oo=extractFileNameRegex.exec(no)[1].replace(/['"]/g,""),io=URL.createObjectURL(await eo.blob()),ao=document.createElement("a");return ao.href=io,ao.download=oo,ao.click(),URL.revokeObjectURL(io),!0}else return!1}const shouldDisplaySetting=(to,ue)=>{let eo=ue.dependsOn;return eo&&!Array.isArray(eo)&&(eo=[eo]),eo!=null&&eo.length?eo.every(no=>{let ro=no,oo=null,io=!!no.invert;if(typeof no=="object"&&(ro=no.setting,oo=no.value),!ro)return!1;Array.isArray(oo)||(oo=[oo]);const ao=deepGet$1(to,ro);return oo.some(lo=>lo==null?ao!=null&&ao!==!1&&ao!=="":lo===ao)!==io}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(to,ue)=>{function eo(no){const{timeOnly:ro,dateOnly:oo}=ue||{},io=!oo,ao=parseDate(no,{enableTime:io});return getDateDisplayValue(ao,{enableTime:io,timeOnly:ro})}return to.map(no=>eo(no))},[FieldType.BOOLEAN]:to=>to.map(ue=>!!ue),[FieldType.BB_REFERENCE_SINGLE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.BB_REFERENCE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.ARRAY]:to=>Array.from(new Set(to))};function enrichSchemaWithRelColumns(to){return Object.keys(to).reduce((eo,no)=>{const ro=to[no];if(eo[no]=ro,ro.visible!==!1&&isRelationshipField(ro)&&ro.columns){const oo=(ro==null?void 0:ro.relationshipType)===RelationshipType.ONE_TO_MANY;for(const io of Object.keys(ro.columns)){const ao=ro.columns[io];if(!ao.visible)continue;const so=`${ro.name}.${io}`;eo[so]={...ao,type:ao.type,name:so,related:{field:no,subField:io},cellRenderType:!oo&&columnTypeManyTypeOverrides[ao.type]||ao.type}}}return eo},{})}function getRelatedTableValues(to,ue,eo){var oo,io,ao,so;const no=isRelationshipField(eo)&&(eo==null?void 0:eo.relationshipType)===RelationshipType.ONE_TO_MANY;let ro="";if(no)ro=(io=(oo=to[ue.related.field])==null?void 0:oo[0])==null?void 0:io[ue.related.subField];else{const lo=columnTypeManyParser[ue.type]||(fo=>fo),co=(so=(ao=to[ue.related.field])==null?void 0:ao.flatMap(fo=>fo[ue.related.subField]))==null?void 0:so.filter(fo=>fo!=null),uo=lo(co||[],ue);ro=uo,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(ue.type)&&(ro=uo==null?void 0:uo.join(", "))}return ro}function canBeDisplayColumn(to){return!(!canBeDisplayColumn$1(to.type)||to.related)}function canBeSortColumn(to){return to.calculationType?!0:!(!canBeSortColumn$1(to.type)||to.related)}const{buildQuery,limit:queryLimit,runQuery,sort:sort$2}=QueryUtils;class DataFetch{constructor(ue){if(this.API=null,this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:null,limit:10,filter:null,query:null,sortColumn:null,sortOrder:SortOrder.ASCENDING,sortType:null,paginate:!0,clientSideSearching:!0,clientSideSorting:!0,clientSideLimiting:!0},this.store=writable({rows:[],info:null,schema:null,loading:!1,loaded:!1,query:null,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random(),error:null}),this.API=ue==null?void 0:ue.API,this.options={...this.options,...ue},!this.API)throw"An API client is required for fetching data";if(this.getData=this.getData.bind(this),this.getPage=this.getPage.bind(this),this.getInitialData=this.getInitialData.bind(this),this.determineFeatureFlags=this.determineFeatureFlags.bind(this),this.refresh=this.refresh.bind(this),this.update=this.update.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.hasPrevPage=this.hasPrevPage.bind(this),this.nextPage=this.nextPage.bind(this),this.prevPage=this.prevPage.bind(this),this.derivedStore=derived(this.store,eo=>({...eo,...this.features,hasNextPage:this.hasNextPage(eo),hasPrevPage:this.hasPrevPage(eo)})),!this.options.datasource){this.store.update(eo=>({...eo,loaded:!0}));return}this.getInitialData()}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(ue,eo){return ue!=null&&ue.primaryDisplay&&eo[ue.primaryDisplay]?ue.primaryDisplay:Object.keys(eo)[0]}async getInitialData(){const{datasource:ue,filter:eo,paginate:no}=this.options,ro=await this.getDefinition(ue),oo=this.determineFeatureFlags(ro);this.features={supportsSearch:!!(oo!=null&&oo.supportsSearch),supportsSort:!!(oo!=null&&oo.supportsSort),supportsPagination:no&&!!(oo!=null&&oo.supportsPagination)};let io=this.getSchema(ue,ro);if(io=this.enrichSchema(io),!io)return;if(this.options.sortColumn&&!io[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(ro,io)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const lo=io==null?void 0:io[this.options.sortColumn];((lo==null?void 0:lo.type)===FieldType.NUMBER||(lo==null?void 0:lo.type)===FieldType.BIGINT||lo!=null&&lo.calculationType)&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder||(this.options.sortOrder=SortOrder.ASCENDING)}let ao=this.options.query;ao||(ao=buildQuery(eo)),this.store.update(lo=>({...lo,definition:ro,schema:io,query:ao,loading:!0,cursors:[],cursor:null}));const so=await this.getPage();this.store.update(lo=>({...lo,loading:!1,loaded:!0,pageNumber:0,rows:so.rows,info:so.info,cursors:no&&so.hasNextPage?[null,so.cursor]:[null],error:so.error,resetKey:Math.random()}))}async getPage(){const{sortColumn:ue,sortOrder:eo,sortType:no,limit:ro,clientSideSearching:oo,clientSideSorting:io,clientSideLimiting:ao}=this.options,{query:so}=get_store_value(this.store);let{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}=await this.getData();return!this.features.supportsSearch&&oo&&(lo=runQuery(lo,so)),!this.features.supportsSort&&io&&(lo=sort$2(lo,ue,eo,no)),!this.features.supportsPagination&&ao&&(lo=queryLimit(lo,ro)),{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}}async getData(){return{rows:[],info:null,hasNextPage:!1,cursor:null}}async getDefinition(ue){if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getSchema(ue,eo){return eo==null?void 0:eo.schema}enrichSchema(ue){if(ue==null)return null;let eo={};Object.keys(ue).forEach(ro=>{const oo=ue[ro];if((oo==null?void 0:oo.type)===FieldType.JSON){const io=convertJSONSchemaToTableSchema(oo,{squashObjects:!0});Object.keys(io).forEach(ao=>{eo[`${ro}.${ao}`]={type:io[ao].type,nestedJSON:!0}})}}),ue={...ue,...eo};let no={};return Object.entries(ue).forEach(([ro,oo])=>{typeof oo=="string"?no[ro]={type:oo,name:ro}:no[ro]={...oo,name:ro}}),no}determineFeatureFlags(ue){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(ue){let eo=!1;const no=Object.entries(ue||{});for(let[ro,oo]of no){const io=this.options[ro]==null?null:this.options[ro];if(JSON.stringify(oo??null)!==JSON.stringify(io)){eo=!0;break}}eo&&(this.options={...this.options,...fp$1.cloneDeep(ue)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(so=>({...so,loading:!0}));const{rows:ue,info:eo,error:no,cursor:ro}=await this.getPage();let{cursors:oo}=get_store_value(this.store);const{pageNumber:io}=get_store_value(this.store);if(!ue.length&&io>0)return this.store.update(so=>({...so,loading:!1,cursors:oo.slice(0,io)})),await this.prevPage();oo[io+1]!=ro&&(oo=oo.slice(0,io+1),oo[io+1]=ro),this.store.update(so=>({...so,rows:ue,info:eo,loading:!1,error:no,cursors:oo}))}hasNextPage(ue){return ue.cursors[ue.pageNumber+1]!=null}hasPrevPage(ue){return ue.pageNumber>0}async nextPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasNextPage)return;const eo=ue.cursors[ue.pageNumber+1];this.store.update(so=>({...so,loading:!0,cursor:eo,pageNumber:so.pageNumber+1}));const{rows:no,info:ro,hasNextPage:oo,cursor:io,error:ao}=await this.getPage();this.store.update(so=>{let{cursors:lo,pageNumber:co}=so;return oo&&(lo[co+1]=io),{...so,rows:no,info:ro,cursors:lo,loading:!1,error:ao}})}async prevPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasPrevPage)return;const eo=ue.cursors[ue.pageNumber-1];this.store.update(io=>({...io,loading:!0,cursor:eo,pageNumber:io.pageNumber-1}));const{rows:no,info:ro,error:oo}=await this.getPage();this.store.update(io=>({...io,rows:no,info:ro,loading:!1,error:oo}))}}class TableFetch extends DataFetch{determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getData(){const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{tableId:ao}=ue,{cursor:so,query:lo}=get_store_value(this.store);try{const co=await this.API.searchTable(ao,{query:lo,limit:eo,sort:no,sortOrder:(ro==null?void 0:ro.toLowerCase())??SortOrder.ASCENDING,sortType:oo,paginate:io,bookmark:so});return{rows:(co==null?void 0:co.rows)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.bookmark)||null}}catch(co){return{rows:[],hasNextPage:!1,error:co}}}}class ViewFetch extends DataFetch{getSchema(ue,eo){var no,ro;return(ro=(no=eo==null?void 0:eo.views)==null?void 0:no[ue.name])==null?void 0:ro.schema}async getData(){const{datasource:ue}=this.options;try{return{rows:await this.API.fetchViewData(ue.name,{calculation:ue.calculation,field:ue.field,groupBy:ue.groupBy,tableId:ue.tableId})||[]}}catch(eo){return console.error(eo),{rows:[]}}}}class ViewV2Fetch extends DataFetch{determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}getSchema(ue,eo){return eo==null?void 0:eo.schema}async getDefinition(ue){if(!(ue!=null&&ue.id))return null;try{const eo=await this.API.viewV2.fetchDefinition(ue.id);return eo==null?void 0:eo.data}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getDefaultSortColumn(){return null}async getData(){var co;const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{cursor:ao,query:so,definition:lo}=get_store_value(this.store);if(lo.type===ViewV2Type.CALCULATION&&!Object.values(lo.schema||{}).some(uo=>uo.calculationType))return{rows:[],hasNextPage:!1,cursor:null,error:null};!no&&((co=lo.sort)!=null&&co.field)&&(this.options.sortColumn=lo.sort.field,this.options.sortOrder=lo.sort.order);try{const uo=await this.API.viewV2.fetch(ue.id,{...so?{query:so}:{},paginate:io,limit:eo,bookmark:ao,sort:no,sortOrder:ro==null?void 0:ro.toLowerCase(),sortType:oo});return{rows:(uo==null?void 0:uo.rows)||[],hasNextPage:(uo==null?void 0:uo.hasNextPage)||!1,cursor:(uo==null?void 0:uo.bookmark)||null}}catch(uo){return{rows:[],hasNextPage:!1,cursor:null,error:uo}}}}class QueryFetch extends DataFetch{determineFeatureFlags(ue){var no,ro,oo,io,ao,so;return{supportsPagination:!!((ro=(no=ue==null?void 0:ue.fields)==null?void 0:no.pagination)!=null&&ro.type)&&!!((io=(oo=ue==null?void 0:ue.fields)==null?void 0:oo.pagination)!=null&&io.location)&&!!((so=(ao=ue==null?void 0:ue.fields)==null?void 0:ao.pagination)!=null&&so.pageParam)}}async getDefinition(ue){if(!(ue!=null&&ue._id))return null;try{const eo=await this.API.fetchQueryDefinition(ue._id);return eo.fields||(eo.fields=ue.fields),eo}catch{return null}}getDefaultSortColumn(){return null}async getData(){var co,uo;const{datasource:ue,limit:eo,paginate:no}=this.options,{supportsPagination:ro}=this.features,{cursor:oo,definition:io}=get_store_value(this.store),ao=(uo=(co=io==null?void 0:io.fields)==null?void 0:co.pagination)==null?void 0:uo.type;let so=cloneDeep((ue==null?void 0:ue.queryParams)||{});for(let fo of(ue==null?void 0:ue.parameters)||{})so[fo.name]||(so[fo.name]=fo.default);let lo={parameters:so};if(no&&ro){const fo=ao==="page"?parseInt(oo||1):oo;lo.pagination={page:fo,limit:eo}}try{const fo=await this.API.executeQuery(ue==null?void 0:ue._id,lo),{data:po,pagination:ho,..._o}=fo;let go=null,bo=!1;return no&&ro&&(ao==="page"?(go=lo.pagination.page+1,bo=(po==null?void 0:po.length)===eo&&eo>0):(go=ho==null?void 0:ho.cursor,bo=go!=null)),{rows:po||[],info:_o,cursor:go,hasNextPage:bo}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends DataFetch{async getData(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.rowId)||!(ue!=null&&ue.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(ue.rowTableId,ue.rowId,ue.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends DataFetch{async getDefinition(ue){var eo,no;return{schema:(eo=ue==null?void 0:ue.value)==null?void 0:eo.schema,primaryDisplay:(no=ue==null?void 0:ue.value)==null?void 0:no.primaryDisplay}}async getData(){var eo;const{datasource:ue}=this.options;return{rows:((eo=ue==null?void 0:ue.value)==null?void 0:eo.rows)||[],hasNextPage:!1,cursor:null}}}class FieldFetch extends DataFetch{async getDefinition(ue){let eo;return ue.fieldType==="attachment"?eo={url:{type:"string"},name:{type:"string"}}:ue.fieldType==="array"&&(eo={value:{type:"string"}}),{schema:eo}}async getData(){const{datasource:ue}=this.options,eo=(ue==null?void 0:ue.value)||[];let no;return Array.isArray(eo)&&eo[0]&&typeof eo[0]!="object"?no=eo.map(ro=>({value:ro})):no=eo,{rows:no||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(ue){try{const eo=await this.API.fetchTableDefinition(ue.tableId);return{schema:getJSONArrayDatasourceSchema(eo==null?void 0:eo.schema,ue)}}catch{return null}}}class UserFetch extends DataFetch{constructor(ue){super({...ue,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:ue,paginate:eo}=this.options,{cursor:no,query:ro}=get_store_value(this.store),{appId:oo,paginated:io,...ao}=ro||{},so=isSupportedUserSearch(ao)?ro:{string:{email:null}};try{const lo={bookmark:no,query:so,appId:oo,paginate:io||eo,limit:ue},co=await this.API.searchUsers(lo);return{rows:(co==null?void 0:co.data)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.nextPage)||null}}catch(lo){return{rows:[],hasNextPage:!1,error:lo}}}}class GroupUserFetch extends DataFetch{constructor(ue){super({...ue,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:ue,cursor:eo}=get_store_value(this.store);try{const no=await this.API.getGroupUsers({id:ue.groupId,emailSearch:ue.emailSearch,bookmark:eo});return{rows:(no==null?void 0:no.users)||[],hasNextPage:(no==null?void 0:no.hasNextPage)||!1,cursor:(no==null?void 0:no.bookmark)||null}}catch(no){return{rows:[],hasNextPage:!1,error:no}}}}class CustomFetch extends DataFetch{getType(ue){return ue==null?"string":typeof ue==="object"?Array.isArray(ue)?"array":"json":isNaN(ue)?"string":"number"}parseCustomData(ue){if(!ue)return[];if(Array.isArray(ue))return ue;if(typeof ue=="string"){try{const eo=JSON.parse(ue);return Array.isArray(eo)?eo:[eo]}catch{}return ue.includes(`
475
475
  `)?ue.split(`
476
476
  `).map(eo=>eo.trim()):ue.split(",").map(eo=>eo.trim())}return[ue]}enrichCustomData(ue){return ue!=null&&ue.length?(ue=ue.filter(eo=>eo!=null&&eo!==""&&!Array.isArray(eo)),ue.map(eo=>{if(typeof eo=="object")return eo;if(typeof eo=="string"){const no=eo.split(",").map(oo=>oo.trim());let ro={};for(let oo=0;oo<no.length;oo++){const ao=`Value${oo===0?"":` ${oo+1}`}`;ro[ao]=no[oo]}return ro}return{Value:eo}})):[]}getCustomData(ue){return this.enrichCustomData(this.parseCustomData(ue==null?void 0:ue.data))}async getDefinition(ue){let eo={};const no=this.getCustomData(ue);if(!(no!=null&&no.length))return{schema:eo};for(let ro of no)for(let oo of Object.keys(ro))if(oo!=="_id"&&!eo[oo]){let io=this.getType(ro[oo]),ao={};if(io==="string"){const so=[...new Set(no.map(co=>co[oo]))];so.length/no.length<=.8&&so.length>1&&(io="options",ao.inclusion=so)}else io==="array"&&(ao.inclusion=[...new Set(no.map(so=>so[oo]).flat())]);eo[oo]={type:io,constraints:ao}}return{schema:eo}}async getData(){const{datasource:ue}=this.options;return{rows:this.getCustomData(ue),hasNextPage:!1,cursor:null}}}class QueryArrayFetch extends FieldFetch{async getDefinition(ue){if(!(ue!=null&&ue.tableId))return null;try{const eo=await this.API.fetchQueryDefinition(ue.tableId),no=generateQueryArraySchemas(eo==null?void 0:eo.schema,eo==null?void 0:eo.nestedSchemaFields);return{schema:getJSONArrayDatasourceSchema(no,ue)}}catch{return null}}}const DataFetchMap={table:TableFetch,view:ViewFetch,viewV2:ViewV2Fetch,query:QueryFetch,link:RelationshipFetch,user:UserFetch,groupUser:GroupUserFetch,custom:CustomFetch,provider:NestedProviderFetch,field:FieldFetch,jsonarray:JSONArrayFetch,queryarray:QueryArrayFetch},fetchData=({API:to,datasource:ue,options:eo})=>{const no=DataFetchMap[ue==null?void 0:ue.type]||TableFetch;return new no({API:to,datasource:ue,...eo})},createEmptyFetchInstance=({API:to,datasource:ue})=>{const eo=DataFetchMap[ue==null?void 0:ue.type];return eo?new eo({API:to}):null},getDatasourceDefinition=async({API:to,datasource:ue})=>{const eo=createEmptyFetchInstance({API:to,datasource:ue});return await(eo==null?void 0:eo.getDefinition(ue))},getDatasourceSchema=({API:to,datasource:ue,definition:eo})=>{const no=createEmptyFetchInstance({API:to,datasource:ue});return no==null?void 0:no.getSchema(ue,eo)},createLocalStorageStore=(to,ue)=>{const eo=writable(ue,()=>{oo();const io=({key:ao})=>ao===to&&oo();return window.addEventListener("storage",io),()=>window.removeEventListener("storage",io)}),no=io=>{eo.set(io),localStorage.setItem(to,JSON.stringify(io))},ro=io=>no(io(get_store_value(eo))),oo=()=>{const io=localStorage.getItem(to);if(io==null)no(ue);else try{eo.set(JSON.parse(io))}catch{no(ue)}};return{...eo,set:no,update:ro}},createSessionStorageStore=(to,ue)=>{const eo=writable(ue,()=>{oo();const io=({key:ao})=>ao===to&&oo();return window.addEventListener("storage",io),()=>window.removeEventListener("storage",io)}),no=io=>{eo.set(io),sessionStorage.setItem(to,JSON.stringify(io))},ro=io=>no(io(get_store_value(eo))),oo=()=>{const io=sessionStorage.getItem(to);if(io==null)no(ue);else try{eo.set(JSON.parse(io))}catch{no(ue)}};return{...eo,set:no,update:ro}},BG="/builder/assets/bg-29e85dd5.png",SplitPage_svelte_svelte_type_style_lang="",get_right_slot_changes$1=to=>({}),get_right_slot_context$1=to=>({});function create_fragment$a5(to){let ue,eo,no,ro,oo,io,ao,so,lo;const co=to[1].default,uo=create_slot(co,to,to[0],null),fo=to[1].right,po=create_slot(fo,to,to[0],get_right_slot_context$1);return{c(){ue=element("div"),eo=element("div"),no=element("div"),uo&&uo.c(),ro=space$1(),oo=element("div"),io=element("img"),so=space$1(),po&&po.c(),attr(no,"class","content svelte-63esek"),attr(eo,"class","left svelte-63esek"),src_url_equal(io.src,ao=BG)||attr(io,"src",ao),attr(io,"alt"," "),attr(io,"class","svelte-63esek"),attr(oo,"class","right spectrum spectrum--darkest svelte-63esek"),attr(ue,"class","split-page svelte-63esek")},m(ho,_o){insert$1(ho,ue,_o),append$2(ue,eo),append$2(eo,no),uo&&uo.m(no,null),append$2(ue,ro),append$2(ue,oo),append$2(oo,io),append$2(oo,so),po&&po.m(oo,null),lo=!0},p(ho,[_o]){uo&&uo.p&&(!lo||_o&1)&&update_slot_base(uo,co,ho,ho[0],lo?get_slot_changes(co,ho[0],_o,null):get_all_dirty_from_scope(ho[0]),null),po&&po.p&&(!lo||_o&1)&&update_slot_base(po,fo,ho,ho[0],lo?get_slot_changes(fo,ho[0],_o,get_right_slot_changes$1):get_all_dirty_from_scope(ho[0]),get_right_slot_context$1)},i(ho){lo||(transition_in(uo,ho),transition_in(po,ho),lo=!0)},o(ho){transition_out(uo,ho),transition_out(po,ho),lo=!1},d(ho){ho&&detach(ue),uo&&uo.d(ho),po&&po.d(ho)}}}function instance$a2(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;return to.$$set=oo=>{"$$scope"in oo&&eo(0,ro=oo.$$scope)},[ro,no]}class SplitPage extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a2,create_fragment$a5,safe_not_equal,{})}}const Bulgaria="/builder/assets/bulgaria-bd68393d.png",Covanta="/builder/assets/covanta-72c46c1e.png",Schnellecke="/builder/assets/schnellecke-cf1837a8.png",Testimonial_svelte_svelte_type_style_lang="";function create_default_slot$6b(to){let ue,eo,no,ro,oo,io,ao,so,lo;return{c(){ue=element("img"),no=space$1(),ro=element("div"),ro.textContent=`"${to[0].text}"`,oo=space$1(),io=element("div"),ao=element("div"),ao.textContent=`${to[0].name}`,so=space$1(),lo=element("div"),lo.textContent=`${to[0].role}`,attr(ue,"width",to[0].imageSize),attr(ue,"alt","a-happy-budibase-user"),src_url_equal(ue.src,eo=to[0].image)||attr(ue,"src",eo),attr(ro,"class","text svelte-1rdu21t"),attr(ao,"class","name svelte-1rdu21t"),attr(lo,"class","company svelte-1rdu21t"),attr(io,"class","author")},m(co,uo){insert$1(co,ue,uo),insert$1(co,no,uo),insert$1(co,ro,uo),insert$1(co,oo,uo),insert$1(co,io,uo),append$2(io,ao),append$2(io,so),append$2(io,lo)},p:noop$6,d(co){co&&(detach(ue),detach(no),detach(ro),detach(oo),detach(io))}}}function create_fragment$a4(to){let ue,eo,no;return eo=new Layout$n({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$6b]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","testimonial svelte-1rdu21t")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,[oo]){const io={};oo&4&&(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 instance$a1(to){return[[{text:"Budibase was the only solution that checked all the boxes for Covanta. Covanta expects to realize $3.2MM in savings due to the elimination of redundant data entry.",name:"Charles Link",role:"Senior Director, Data and Analytics",image:Covanta,imageSize:105},{text:"Budibase was mission-critical for us and went a long way in preventing what could have become a humanitarian crisis here in Bulgaria.",name:"Bozhidar Bozhanov",role:"Government of Bulgaria",image:Bulgaria,imageSize:49},{text:"Centralization of authentication, quick turnaround time for requests, integration with different database systems has given it the edge and it’s now used daily for internal development for those apps that you know you need but don’t feel value in losing days of development to reinvent the wheel.",name:"Davide Lenzarini",role:"IT manager",image:Schnellecke,imageSize:141}][Math.floor(Math.random()*3)]]}class Testimonial extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a1,create_fragment$a4,safe_not_equal,{})}}const TestimonialPage_svelte_svelte_type_style_lang="";function create_default_slot$6a(to){let ue;const eo=to[1].default,no=create_slot(eo,to,to[2],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&4)&&update_slot_base(no,eo,ro,ro[2],ue?get_slot_changes(eo,ro[2],oo,null):get_all_dirty_from_scope(ro[2]),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$4I(to){let ue,eo;return ue=new Testimonial({}),{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_right_slot$3(to){let ue,eo,no=to[0]&&create_if_block$4I();return{c(){ue=element("div"),no&&no.c(),attr(ue,"slot","right"),attr(ue,"class","svelte-1ow1lgm"),toggle_class(ue,"wrapper",to[0])},m(ro,oo){insert$1(ro,ue,oo),no&&no.m(ue,null),eo=!0},p(ro,oo){ro[0]?no?oo&1&&transition_in(no,1):(no=create_if_block$4I(),no.c(),transition_in(no,1),no.m(ue,null)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros()),(!eo||oo&1)&&toggle_class(ue,"wrapper",ro[0])},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d()}}}function create_fragment$a3(to){let ue,eo;return ue=new SplitPage({props:{$$slots:{right:[create_right_slot$3],default:[create_default_slot$6a]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&5&&(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$a0(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{enabled:oo=!0}=ue;return to.$$set=io=>{"enabled"in io&&eo(0,oo=io.enabled),"$$scope"in io&&eo(2,ro=io.$$scope)},[oo,no,ro]}class TestimonialPage extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a0,create_fragment$a3,safe_not_equal,{enabled:0})}}const SignatureModal_svelte_svelte_type_style_lang="";function create_default_slot_2$31(to){let ue,eo,no,ro={darkMode:to[3],value:to[1],saveIcon:!1};return eo=new Signature({props:ro}),to[8](eo),eo.$on("update",to[9]),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","signature-wrap modal svelte-1jbgrys")},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),no=!0},p(oo,io){const ao={};io&8&&(ao.darkMode=oo[3]),io&2&&(ao.value=oo[1]),eo.$set(ao)},i(oo){no||(transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),to[8](null),destroy_component(eo)}}}function create_default_slot_1$4d(to){let ue;return{c(){ue=text(to[2])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&4&&set_data(ue,eo[2])},d(eo){eo&&detach(ue)}}}function create_header_slot$4(to){let ue,eo,no;return eo=new Body({props:{$$slots:{default:[create_default_slot_1$4d]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"slot","header")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&4100&&(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$69(to){let ue,eo;return ue=new ModalContent({props:{showConfirmButton:!0,showCancelButton:!1,showCloseIcon:!1,custom:!0,disabled:!to[6],showDivider:!1,onConfirm:to[10],$$slots:{header:[create_header_slot$4],default:[create_default_slot_2$31]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.disabled=!no[6]),ro&33&&(oo.onConfirm=no[10]),ro&4206&&(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$a2(to){let ue,eo,no={$$slots:{default:[create_default_slot$69]},$$scope:{ctx:to}};return ue=new Modal({props:no}),to[11](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&4207&&(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[11](null),destroy_component(ue,ro)}}}function instance$9$(to,ue,eo){let{onConfirm:no=()=>{}}=ue,{value:ro}=ue,{title:oo}=ue,{darkMode:io}=ue;const ao=()=>{eo(6,co=!1),so.show()};let so,lo,co=!1;function uo(_o){binding_callbacks[_o?"unshift":"push"](()=>{lo=_o,eo(5,lo)})}const fo=()=>{eo(6,co=!0)},po=()=>{no(lo)};function ho(_o){binding_callbacks[_o?"unshift":"push"](()=>{so=_o,eo(4,so)})}return to.$$set=_o=>{"onConfirm"in _o&&eo(0,no=_o.onConfirm),"value"in _o&&eo(1,ro=_o.value),"title"in _o&&eo(2,oo=_o.title),"darkMode"in _o&&eo(3,io=_o.darkMode)},[no,ro,oo,io,so,lo,co,ao,uo,fo,po,ho]}class SignatureModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9$,create_fragment$a2,safe_not_equal,{onConfirm:0,value:1,title:2,darkMode:3,show:7})}get show(){return this.$$.ctx[7]}}function create_if_block$4H(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[3]?getUserLabel(to[0]):null,position:to[2],color:getUserColor(to[0]),$$slots:{default:[create_default_slot$68]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&9&&(oo.text=no[3]?getUserLabel(no[0]):null),ro&4&&(oo.position=no[2]),ro&1&&(oo.color=getUserColor(no[0])),ro&19&&(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$68(to){let ue,eo;return ue=new Avatar({props:{size:to[1],initials:getUserInitials(to[0]),color:getUserColor(to[0])}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2&&(oo.size=no[1]),ro&1&&(oo.initials=getUserInitials(no[0])),ro&1&&(oo.color=getUserColor(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_fragment$a1(to){let ue,eo,no=to[0]&&create_if_block$4H(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0]?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$4H(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$9_(to,ue,eo){let{user:no}=ue,{size:ro="S"}=ue,{tooltipPosition:oo=TooltipPosition.Top}=ue,{showTooltip:io=!0}=ue;return to.$$set=ao=>{"user"in ao&&eo(0,no=ao.user),"size"in ao&&eo(1,ro=ao.size),"tooltipPosition"in ao&&eo(2,oo=ao.tooltipPosition),"showTooltip"in ao&&eo(3,io=ao.showTooltip)},[no,ro,oo,io]}class UserAvatar extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9_,create_fragment$a1,safe_not_equal,{user:0,size:1,tooltipPosition:2,showTooltip:3})}}const UserAvatars_svelte_svelte_type_style_lang$1="";function get_each_context$1V(to,ue,eo){const no=to.slice();return no[8]=ue[eo],no}function create_else_block$1P(to){let ue,eo;return ue=new UserAvatar({props:{size:to[0],user:to[8],tooltipPosition:to[1]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.size=no[0]),ro&4&&(oo.user=no[8]),ro&2&&(oo.tooltipPosition=no[1]),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){let ue,eo;return ue=new Avatar({props:{size:to[0],initials:to[8].label,color:"var(--spectrum-global-color-gray-500)"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.size=no[0]),ro&4&&(oo.initials=no[8].label),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$1V(to){let ue,eo,no,ro,oo;const io=[create_if_block$4G,create_else_block$1P],ao=[];function so(lo,co){return lo[8]._id==="overflow"?0:1}return eo=so(to),no=ao[eo]=io[eo](to),{c(){ue=element("span"),no.c(),ro=space$1(),set_style(ue,"z-index",to[8].zIndex),attr(ue,"class","svelte-1wnz660")},m(lo,co){insert$1(lo,ue,co),ao[eo].m(ue,null),append$2(ue,ro),oo=!0},p(lo,co){let uo=eo;eo=so(lo),eo===uo?ao[eo].p(lo,co):(group_outros(),transition_out(ao[uo],1,1,()=>{ao[uo]=null}),check_outros(),no=ao[eo],no?no.p(lo,co):(no=ao[eo]=io[eo](lo),no.c()),transition_in(no,1),no.m(ue,ro)),(!oo||co&4)&&set_style(ue,"z-index",lo[8].zIndex)},i(lo){oo||(transition_in(no),oo=!0)},o(lo){transition_out(no),oo=!1},d(lo){lo&&detach(ue),ao[eo].d()}}}function create_fragment$a0(to){let ue,eo,no=ensure_array_like(to[2]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1V(get_each_context$1V(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","avatars svelte-1wnz660")},m(io,ao){insert$1(io,ue,ao);for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(ue,null);eo=!0},p(io,[ao]){if(ao&7){no=ensure_array_like(io[2]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1V(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1V(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue,null))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function instance$9Z(to,ue,eo){let no,ro,{users:oo=[]}=ue,{order:io="ltr"}=ue,{size:ao="S"}=ue,{tooltipPosition:so=TooltipPosition.Top}=ue;const lo=uo=>{let fo={};return uo==null||uo.forEach(po=>{fo[po.email]=po}),Object.values(fo)},co=(uo,fo)=>{const po=uo.slice(0,3);if(uo.length>3){const ho={_id:"overflow",label:`+${uo.length-3}`};fo==="ltr"?po.push(ho):po.unshift(ho)}return po.map((ho,_o)=>({...ho,zIndex:fo==="ltr"?_o:no.length-_o}))};return to.$$set=uo=>{"users"in uo&&eo(3,oo=uo.users),"order"in uo&&eo(4,io=uo.order),"size"in uo&&eo(0,ao=uo.size),"tooltipPosition"in uo&&eo(1,so=uo.tooltipPosition)},to.$$.update=()=>{to.$$.dirty&24&&eo(5,no=lo(oo)),to.$$.dirty&48&&eo(2,ro=co(no,io))},[ao,so,ro,oo,io,no]}let UserAvatars$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9Z,create_fragment$a0,safe_not_equal,{users:3,order:4,size:0,tooltipPosition:1})}};const Updating_svelte_svelte_type_style_lang="";function create_else_block_1$u(to){let ue;return{c(){ue=text("Something went wrong!")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_1$2x(to){let ue;return{c(){ue=text("System update")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block$1O(to){let ue,eo,no,ro,oo;return{c(){ue=text(`An error occurred, please try again later.
477
477
  `),eo=element("br"),no=text(`
@@ -9,7 +9,7 @@
9
9
  <link href="/builder/fonts/source-sans-pro/600.css" rel="stylesheet" />
10
10
  <link href="/builder/fonts/source-sans-pro/700.css" rel="stylesheet" />
11
11
  <link href="/builder/fonts/remixicon.css" rel="stylesheet" />
12
- <script type="module" crossorigin src="/builder/assets/index-2da82116.js"></script>
12
+ <script type="module" crossorigin src="/builder/assets/index-d6695372.js"></script>
13
13
  <link rel="stylesheet" href="/builder/assets/index-e94680f4.css">
14
14
  </head>
15
15