@budibase/client 3.13.18 → 3.13.20

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.
@@ -435,7 +435,7 @@ Please report this to https://github.com/markedjs/marked.`,p){const w="<p>An err
435
435
  </g>
436
436
  </g>
437
437
  </svg>
438
- `;var HTTPMethod=(y=>(y.POST="POST",y.PATCH="PATCH",y.GET="GET",y.PUT="PUT",y.DELETE="DELETE",y))(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};var TableNames=(y=>(y.USERS="ta_users",y))(TableNames||{});const BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer,sortOrder:2}],BudibaseRoleOptions=[{label:"Tenant admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all workspaces in your tenant",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",PREMIUM_PLUS:"premium_plus",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR",GROUP:"GROUP"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},TypeIconMap={[FieldType.STRING]:"text-align-left",[FieldType.OPTIONS]:"caret-circle-down",[FieldType.DATETIME]:"calendar",[FieldType.BARCODEQR]:"barcode",[FieldType.SIGNATURE_SINGLE]:"pen-nib",[FieldType.LONGFORM]:"text-align-left",[FieldType.ARRAY]:"list-checks",[FieldType.NUMBER]:"hash",[FieldType.BOOLEAN]:"toggle-right",[FieldType.ATTACHMENTS]:"files",[FieldType.ATTACHMENT_SINGLE]:"file",[FieldType.LINK]:"arrow-circle-up-right",[FieldType.FORMULA]:"calculator",[FieldType.AI]:"sparkle",[FieldType.JSON]:"brackets-angle",[FieldType.BIGINT]:"text-bolder",[FieldType.AUTO]:"shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"users-three",[BBReferenceFieldSubType.USERS]:"users-three"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"user"}},OptionColours=[...new Array(12).keys()].map(y=>`hsla(${(y+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={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,Constants$2=Object.freeze(Object.defineProperty({__proto__:null,APP_NAME_REGEX,APP_URL_REGEX,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ComponentContextScopes,Cookies,DEFAULT_BB_DATASOURCE_ID,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles,SqlNumberTypeRangeMap,TableNames,TypeIconMap},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=y=>({getAnalyticsStatus:async()=>await y.get({url:"/api/bbtel"}),analyticsPing:async p=>await y.post({url:"/api/bbtel/ping",body:{...p,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=y=>({generateCronExpression:async p=>await y.post({url:"/api/ai/cron",body:{prompt:p}}),generateJs:async p=>await y.post({url:"/api/ai/js",body:p}),generateTables:async p=>await y.post({url:"/api/ai/tables",body:p})}),buildAppEndpoints=y=>({fetchAppPackage:async p=>await y.get({url:`/api/applications/${p}/appPackage`}),saveAppMetadata:async(p,m)=>await y.put({url:`/api/applications/${p}`,body:m}),publishAppChanges:async(p,m)=>await y.post({url:`/api/applications/${p}/publish`,body:m}),revertAppChanges:async p=>await y.post({url:`/api/dev/${p}/revert`}),updateAppClientVersion:async p=>await y.post({url:`/api/applications/${p}/client/update`}),revertAppClientVersion:async p=>await y.post({url:`/api/applications/${p}/client/revert`}),getAppDeployments:async()=>await y.get({url:"/api/deployments"}),createApp:async p=>p instanceof FormData?await y.post({url:"/api/applications",body:p,json:!1}):await y.post({url:"/api/applications",body:p}),duplicateApp:async(p,m)=>await y.post({url:`/api/applications/${p}/duplicate`,body:m}),updateAppFromExport:async(p,m)=>{const v=getDevAppID(p);return await y.post({url:`/api/applications/${v}/import`,body:m,json:!1})},importApps:async p=>await y.post({url:"/api/cloud/import",body:p,json:!1}),unpublishApp:async p=>await y.post({url:`/api/applications/${p}/unpublish`}),deleteApp:async p=>await y.delete({url:`/api/applications/${p}`}),releaseAppLock:async p=>await y.delete({url:`/api/dev/${p}/lock`}),fetchSystemDebugInfo:async()=>await y.get({url:"/api/debug/diagnostics"}),syncApp:async p=>await y.post({url:`/api/applications/${p}/sync`}),getApps:async()=>await y.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async p=>await y.get({url:`/api/${p}/components/definitions`}),addSampleData:async p=>await y.post({url:`/api/applications/${p}/sample`}),getPublishedApps:async()=>(await y.get({url:"/api/client/applications"})).apps}),buildAttachmentEndpoints=y=>{const p={getSignedDatasourceURL:async(m,v,w)=>await y.post({url:`/api/attachments/${m}/url`,body:{bucket:v,key:w}})};return{...p,uploadAttachment:async(m,v)=>await y.post({url:`/api/attachments/${m}/upload`,body:v,json:!1}),uploadBuilderAttachment:async m=>await y.post({url:"/api/attachments/process",body:m,json:!1}),uploadPWAZip:async m=>await y.post({url:"/api/pwa/process-zip",body:m,json:!1}),externalUpload:async(m,v,w,S)=>{const{signedUrl:k,publicUrl:O}=await p.getSignedDatasourceURL(m,v,w);return k?(await y.put({url:k,body:S,json:!1,external:!0,parseResponse:R=>R}),{publicUrl:O}):{publicUrl:void 0}},downloadAttachment:async(m,v,w)=>await y.get({url:`/api/${m}/rows/${v}/attachment/${w}`,parseResponse:S=>S,suppressErrors:!0})}},buildAuthEndpoints=y=>({logIn:async(p,m,v)=>await y.post({url:`/api/global/auth/${p}/login`,body:{username:m,password:v},parseResponse:async w=>{const S=await w.json(),k=w.headers.get("X-Session-Invalidated-Count");return{...S,invalidatedSessionCount:k?parseInt(k):0}}}),logOut:async()=>await y.post({url:"/api/global/auth/logout"}),setInitInfo:async p=>await y.post({url:"/api/global/auth/init",body:p}),getInitInfo:async()=>await y.get({url:"/api/global/auth/init"}),requestForgotPassword:async(p,m)=>await y.post({url:`/api/global/auth/${p}/reset`,body:{email:m}}),resetPassword:async(p,m,v)=>await y.post({url:`/api/global/auth/${p}/reset/update`,body:{password:m,resetCode:v}})}),buildAutomationEndpoints=y=>({triggerAutomation:async(p,m,v)=>await y.post({url:`/api/automations/${p}/trigger`,body:{fields:m,timeout:v}}),testAutomation:async(p,m)=>await y.post({url:`/api/automations/${p}/test`,body:m}),getAutomations:async()=>await y.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await y.get({url:"/api/automations/definitions/list"}),createAutomation:async p=>await y.post({url:"/api/automations",body:p}),updateAutomation:async p=>await y.put({url:"/api/automations",body:p}),deleteAutomation:async(p,m)=>await y.delete({url:`/api/automations/${p}/${m}`}),getAutomationLogs:async p=>await y.post({url:"/api/automations/logs/search",body:p}),clearAutomationLogErrors:async(p,m)=>await y.delete({url:"/api/automations/logs",body:{appId:m,automationId:p}})}),buildConfigEndpoints=y=>({saveConfig:async p=>await y.post({url:"/api/global/configs",body:p}),getConfig:async p=>await y.get({url:`/api/global/configs/${p}`}),deleteConfig:async(p,m)=>await y.delete({url:`/api/global/configs/${p}/${m}`}),getTenantConfig:async p=>await y.get({url:`/api/global/configs/public?tenantId=${p}`}),getOIDCConfigs:async p=>await y.get({url:`/api/global/configs/public/oidc?tenantId=${p}`}),getChecklist:async p=>await y.get({url:`/api/global/configs/checklist?tenantId=${p}`}),uploadLogo:async p=>await y.post({url:"/api/global/configs/upload/settings/logoUrl",body:p,json:!1}),uploadFavicon:async p=>await y.post({url:"/api/global/configs/upload/settings/faviconUrl",body:p,json:!1}),uploadOIDCLogo:async(p,m)=>await y.post({url:`/api/global/configs/upload/logos_oidc/${p}`,body:m,json:!1}),getOIDCLogos:async()=>await y.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=y=>({getDatasources:async()=>await y.get({url:"/api/datasources"}),buildDatasourceSchema:async(p,m)=>await y.post({url:`/api/datasources/${p}/schema`,body:{tablesFilter:m}}),createDatasource:async p=>await y.post({url:"/api/datasources",body:p}),updateDatasource:async p=>await y.put({url:`/api/datasources/${p._id}`,body:p}),deleteDatasource:async(p,m)=>await y.delete({url:`/api/datasources/${p}/${m}`}),validateDatasource:async p=>await y.post({url:"/api/datasources/verify",body:{datasource:p}}),fetchInfoForDatasource:async p=>await y.post({url:"/api/datasources/info",body:{datasource:p}}),fetchExternalSchema:async p=>await y.get({url:`/api/datasources/${p}/schema/external`})}),buildFlagEndpoints=y=>({getFlags:async()=>await y.get({url:"/api/users/flags"}),updateFlag:async(p,m)=>await y.post({url:"/api/users/flags",body:{flag:p,value:m}}),toggleUiFeature:async p=>await y.post({url:`/api/beta/${p}`})}),buildLayoutEndpoints=y=>({saveLayout:async p=>await y.post({url:"/api/layouts",body:p}),deleteLayout:async(p,m)=>await y.delete({url:`/api/layouts/${p}/${m}`})}),buildOtherEndpoints=y=>({getEnvironment:async()=>await y.get({url:"/api/system/environment"}),getSystemStatus:async()=>await y.get({url:"/api/system/status"}),getIntegrations:async()=>await y.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await y.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await y.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=y=>({getPermissionForResource:async p=>await y.get({url:`/api/permission/${p}`}),updatePermissionForResource:async(p,m,v)=>await y.post({url:`/api/permission/${m}/${p}/${v}`}),removePermissionFromResource:async(p,m,v)=>await y.delete({url:`/api/permission/${m}/${p}/${v}`}),getDependants:async p=>await y.get({url:`/api/permission/${p}/dependants`})}),buildQueryEndpoints=y=>({executeQuery:async(p,{pagination:m,parameters:v}={})=>await y.post({url:`/api/v2/queries/${p}`,body:{parameters:v,pagination:m}}),fetchQueryDefinition:async p=>await y.get({url:`/api/queries/${p}`,cache:!0}),getQueries:async()=>await y.get({url:"/api/queries"}),saveQuery:async p=>await y.post({url:"/api/queries",body:p}),deleteQuery:async(p,m)=>await y.delete({url:`/api/queries/${p}/${m}`}),importQueries:async p=>await y.post({url:"/api/queries/import",body:p}),previewQuery:async p=>await y.post({url:"/api/queries/preview",body:p})}),buildRelationshipEndpoints=y=>({fetchRelationshipData:async(p,m,v)=>{const w=await y.get({url:`/api/${p}/${m}/enrich?field=${v}`});return v?w[v]||[]:[w]}}),buildRoleEndpoints=y=>({deleteRole:async(p,m)=>await y.delete({url:`/api/roles/${p}/${m}`}),saveRole:async p=>await y.post({url:"/api/roles",body:p}),getRoles:async()=>await y.get({url:"/api/roles"}),getRolesForApp:async p=>await y.get({url:`/api/global/roles/${p}`}),getAccessibleRoles:async()=>await y.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=y=>({fetchClientAppRoutes:async()=>await y.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await y.get({url:"/api/routing"})}),buildRowEndpoints=y=>({fetchRow:async(p,m)=>await y.get({url:`/api/${p}/rows/${m}`}),saveRow:async(p,m=!1)=>{const v=p._viewId||p.tableId;return await y.post({url:`/api/${v}/rows`,body:p,suppressErrors:m})},patchRow:async(p,m=!1)=>{const v=p._viewId||p.tableId;return await y.patch({url:`/api/${v}/rows`,body:p,suppressErrors:m})},deleteRow:async(p,m)=>await y.delete({url:`/api/${p}/rows`,body:{_id:m}}),deleteRows:async(p,m)=>(m.forEach(v=>{typeof v=="object"&&(v==null||delete v._viewId)}),await y.delete({url:`/api/${p}/rows`,body:{rows:m}})),exportRows:async(p,m,v)=>await y.post({url:`/api/${p}/rows/exportRows?format=${m}`,body:v,parseResponse:async w=>await w.text()})}),buildScreenEndpoints=y=>({saveScreen:async p=>await y.post({url:"/api/screens",body:p}),deleteScreen:async(p,m)=>await y.delete({url:`/api/screens/${p}/${m}`}),usageInScreens:async p=>await y.post({url:`/api/screens/usage/${p}`})}),buildTableEndpoints=y=>({fetchTableDefinition:async p=>await y.get({url:`/api/tables/${p}`,cache:!0}),fetchTableData:async p=>await y.get({url:`/api/${p}/rows`}),searchTable:async(p,m)=>await y.post({url:`/api/${p}/search`,body:m}),importTableData:async(p,m,v)=>await y.post({url:`/api/tables/${p}/import`,body:{rows:m,identifierFields:v}}),csvToJson:async p=>await y.post({url:"/api/convert/csvToJson",body:{csvString:p}}),getTables:async()=>await y.get({url:"/api/tables"}),getTable:async p=>await y.get({url:`/api/tables/${p}`}),saveTable:async p=>await y.post({url:"/api/tables",body:p}),deleteTable:async(p,m)=>await y.delete({url:`/api/tables/${p}/${m}`}),validateNewTableImport:async(p,m)=>await y.post({url:"/api/tables/validateNewTableImport",body:{rows:p,schema:m}}),validateExistingTableImport:async(p,m)=>await y.post({url:"/api/tables/validateExistingTableImport",body:{rows:p,tableId:m}}),migrateColumn:async(p,m,v)=>await y.post({url:`/api/tables/${p}/migrate`,body:{oldColumn:m,newColumn:v}}),duplicateTable:async p=>await y.post({url:`/api/tables/${p}/duplicate`})}),buildTemplateEndpoints=y=>({getEmailTemplateDefinitions:async()=>await y.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await y.get({url:"/api/global/template/email"}),saveEmailTemplate:async p=>await y.post({url:"/api/global/template",body:p}),getAppTemplates:async()=>await y.get({url:"/api/templates"})}),buildUserEndpoints=y=>({getUsers:async()=>await y.get({url:"/api/global/users"}),searchUsers:async p=>await y.post({url:"/api/global/users/search",body:p}),getUser:async p=>await y.get({url:`/api/global/users/${p}`}),updateOwnMetadata:async p=>await y.post({url:"/api/users/metadata/self",body:p}),createAdminUser:async p=>await y.post({url:"/api/global/users/init",body:p}),saveUser:async p=>await y.post({url:"/api/global/users",body:p}),createUsers:async(p,m)=>(await y.post({url:"/api/global/users/bulk",body:{create:{users:p,groups:m}}})).created,deleteUser:async p=>await y.delete({url:`/api/global/users/${p}`}),deleteUsers:async p=>(await y.post({url:"/api/global/users/bulk",body:{delete:{users:p}}})).deleted,onboardUsers:async p=>await y.post({url:"/api/global/users/onboard",body:p}),updateUserInvite:async(p,m)=>await y.post({url:`/api/global/users/invite/update/${p}`,body:m}),getUserInvite:async p=>await y.get({url:`/api/global/users/invite/${p}`}),getUserInvites:async()=>await y.get({url:"/api/global/users/invites"}),inviteUsers:async p=>await y.post({url:"/api/global/users/multi/invite",body:p}),removeUserInvites:async p=>await y.post({url:"/api/global/users/multi/invite/delete",body:p}),acceptInvite:async p=>await y.post({url:"/api/global/users/invite/accept",body:p}),getUserCountByApp:async p=>(await y.get({url:`/api/global/users/count/${p}`})).userCount,addAppBuilder:async(p,m)=>await y.post({url:`/api/global/users/${p}/app/${m}/builder`}),removeAppBuilder:async(p,m)=>await y.delete({url:`/api/global/users/${p}/app/${m}/builder`}),getAccountHolder:async()=>await y.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=y=>({generateAPIKey:async()=>{const p=await y.post({url:"/api/global/self/api_key"});return p==null?void 0:p.apiKey},fetchDeveloperInfo:async()=>y.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await y.get({url:"/api/self"}),fetchBuilderSelf:async()=>await y.get({url:"/api/global/self"}),updateSelf:async p=>await y.post({url:"/api/global/self",body:p})}),buildViewEndpoints=y=>({fetchViewData:async(p,{field:m,groupBy:v,calculation:w})=>{const S=new URLSearchParams;w&&(m&&S.set("field",m),S.set("calculation",w)),v&&S.set("group",v);const k=m?`/api/views/${encodeURIComponent(p)}?${S}`:`/api/views/${encodeURIComponent(p)}`;return await y.get({url:k})},exportView:async(p,m)=>{const v=encodeURIComponent(p);return await y.get({url:`/api/views/export?view=${v}&format=${m}`,parseResponse:async w=>await w.text()})},saveView:async p=>await y.post({url:"/api/views",body:p}),deleteView:async p=>await y.delete({url:`/api/views/${encodeURIComponent(p)}`})}),buildViewV2Endpoints=y=>({fetchDefinition:async p=>await y.get({url:`/api/v2/views/${encodeURIComponent(p)}`,cache:!0}),create:async p=>await y.post({url:"/api/v2/views",body:p}),update:async p=>await y.put({url:`/api/v2/views/${encodeURIComponent(p.id)}`,body:p}),fetch:async(p,m)=>await y.post({url:`/api/v2/views/${encodeURIComponent(p)}/search`,body:m}),delete:async p=>await y.delete({url:`/api/v2/views/${encodeURIComponent(p)}`})}),buildLicensingEndpoints=y=>({activateLicenseKey:async p=>y.post({url:"/api/global/license/key",body:{licenseKey:p}}),deleteLicenseKey:async()=>y.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await y.get({url:"/api/global/license/key"})}catch(p){if(p.status!==404)throw p}},activateOfflineLicense:async p=>y.post({url:"/api/global/license/offline",body:{offlineLicenseToken:p}}),deleteOfflineLicense:async()=>y.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await y.get({url:"/api/global/license/offline"})}catch(p){if(p.status!==404)throw p}},getOfflineLicenseIdentifier:async()=>await y.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>y.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>y.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=y=>{async function p(m,v,w,S){return await y.post({url:`/api/global/groups/${m}/${v}`,body:{[w]:S}})}return{saveGroup:async m=>await y.post({url:"/api/global/groups",body:m}),getGroups:async()=>(await y.get({url:"/api/global/groups"})).data,getGroup:async m=>await y.get({url:`/api/global/groups/${m}`}),deleteGroup:async(m,v)=>await y.delete({url:`/api/global/groups/${m}/${v}`}),getGroupUsers:async({id:m,bookmark:v,emailSearch:w})=>{let S=`/api/global/groups/${m}/users?`;return v&&(S+=`bookmark=${v}&`),w&&(S+=`emailSearch=${w}`),await y.get({url:S})},addUsersToGroup:async(m,v)=>p(m,"users","add",v),removeUsersFromGroup:async(m,v)=>p(m,"users","remove",v),addAppsToGroup:async(m,v)=>p(m,"apps","add",v),removeAppsFromGroup:async(m,v)=>p(m,"apps","remove",v),addGroupAppBuilder:async(m,v)=>await y.post({url:`/api/global/groups/${m}/app/${v}/builder`}),removeGroupAppBuilder:async(m,v)=>await y.delete({url:`/api/global/groups/${m}/app/${v}/builder`})}},buildPluginEndpoints=y=>({uploadPlugin:async p=>await y.post({url:"/api/plugin/upload",body:p,json:!1}),createPlugin:async p=>await y.post({url:"/api/plugin",body:p}),getPlugins:async()=>await y.get({url:"/api/plugin"}),deletePlugin:async p=>await y.delete({url:`/api/plugin/${p}`})}),buildBackupEndpoints=y=>({createManualBackup:async p=>await y.post({url:`/api/apps/${p}/backups`}),searchBackups:async(p,m)=>await y.post({url:`/api/apps/${p}/backups/search`,body:m}),deleteBackup:async(p,m)=>await y.delete({url:`/api/apps/${p}/backups/${m}`}),restoreBackup:async(p,m,v)=>await y.post({url:`/api/apps/${p}/backups/${m}/import`,body:{name:v}}),clearBackupErrors:async(p,m)=>await y.delete({url:"/api/backups/logs",body:{appId:p,backupId:m}})}),buildEnvironmentVariableEndpoints=y=>({checkEnvironmentVariableStatus:async()=>await y.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await y.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async p=>await y.post({url:"/api/env/variables",body:p}),deleteEnvironmentVariable:async p=>await y.delete({url:`/api/env/variables/${p}`}),updateEnvironmentVariable:async(p,m)=>await y.patch({url:`/api/env/variables/${p}`,body:m})}),buildEventEndpoints=y=>({publishEvent:async p=>await y.post({url:"/api/global/event/publish",body:{type:p}})}),buildAuditLogEndpoints=y=>({searchAuditLogs:async p=>await y.post({url:"/api/global/auditlogs/search",body:p}),getEventDefinitions:async()=>await y.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:p=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(p))}`}),buildLogsEndpoints=y=>({getSystemLogs:async()=>await y.get({url:"/api/system/logs",json:!1,parseResponse:async p=>p})}),buildMigrationEndpoints=y=>({getMigrationStatus:async()=>await y.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=y=>({fetch:async p=>(await y.get({url:`/api/tables/${p}/actions`})).actions,create:async(p,m)=>await y.post({url:`/api/tables/${p}/actions`,body:{name:m}}),delete:async(p,m)=>await y.delete({url:`/api/tables/${p}/actions/${m}`}),enableView:async(p,m,v)=>await y.post({url:`/api/tables/${p}/actions/${m}/permissions/${v}`}),disableView:async(p,m,v)=>await y.delete({url:`/api/tables/${p}/actions/${m}/permissions/${v}`}),trigger:async(p,m,v)=>await y.post({url:`/api/tables/${p}/actions/${m}/trigger`,body:{rowId:v}})}),buildOAuth2Endpoints=y=>({fetch:async()=>(await y.get({url:"/api/oauth2"})).configs,create:async p=>await y.post({url:"/api/oauth2",body:{...p}}),update:async p=>await y.put({url:`/api/oauth2/${p._id}`,body:{...p}}),delete:async(p,m)=>await y.delete({url:`/api/oauth2/${p}/${m}`}),validate:async function(p){return await y.post({url:"/api/oauth2/validate",body:{...p}})}}),buildAgentEndpoints=y=>({agentChat:async p=>{const m=p;return await y.post({url:"/api/agent/chat",body:m})},agentChatStream:async(p,m,v)=>{var S;const w=p;try{const k=await fetch("/api/agent/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(w),credentials:"same-origin"});if(!k.ok)throw new Error(`HTTP error! status: ${k.status}`);const O=(S=k.body)==null?void 0:S.getReader();if(!O)throw new Error("Failed to get response reader");const R=new TextDecoder;let D="";for(;;){const{done:P,value:N}=await O.read();if(P)break;D+=R.decode(N,{stream:!0});const H=D.split(`
438
+ `;var HTTPMethod=(y=>(y.POST="POST",y.PATCH="PATCH",y.GET="GET",y.PUT="PUT",y.DELETE="DELETE",y))(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};var TableNames=(y=>(y.USERS="ta_users",y))(TableNames||{});const BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer,sortOrder:2}],BudibaseRoleOptions=[{label:"Tenant admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all workspaces in your tenant",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",PREMIUM_PLUS:"premium_plus",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR",GROUP:"GROUP"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},TypeIconMap={[FieldType.STRING]:"text-align-left",[FieldType.OPTIONS]:"caret-circle-down",[FieldType.DATETIME]:"calendar",[FieldType.BARCODEQR]:"barcode",[FieldType.SIGNATURE_SINGLE]:"pen-nib",[FieldType.LONGFORM]:"text-align-left",[FieldType.ARRAY]:"list-checks",[FieldType.NUMBER]:"hash",[FieldType.BOOLEAN]:"toggle-right",[FieldType.ATTACHMENTS]:"files",[FieldType.ATTACHMENT_SINGLE]:"file",[FieldType.LINK]:"arrow-circle-up-right",[FieldType.FORMULA]:"calculator",[FieldType.AI]:"sparkle",[FieldType.JSON]:"brackets-angle",[FieldType.BIGINT]:"text-bolder",[FieldType.AUTO]:"shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"users-three",[BBReferenceFieldSubType.USERS]:"users-three"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"user"}},OptionColours=[...new Array(12).keys()].map(y=>`hsla(${(y+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={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,Constants$2=Object.freeze(Object.defineProperty({__proto__:null,APP_NAME_REGEX,APP_URL_REGEX,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ComponentContextScopes,Cookies,DEFAULT_BB_DATASOURCE_ID,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles,SqlNumberTypeRangeMap,TableNames,TypeIconMap},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=y=>({getAnalyticsStatus:async()=>await y.get({url:"/api/bbtel"}),analyticsPing:async p=>await y.post({url:"/api/bbtel/ping",body:{...p,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=y=>({generateCronExpression:async p=>await y.post({url:"/api/ai/cron",body:{prompt:p}}),generateJs:async p=>await y.post({url:"/api/ai/js",body:p}),generateTables:async p=>await y.post({url:"/api/ai/tables",body:p})}),buildAppEndpoints=y=>({fetchAppPackage:async p=>await y.get({url:`/api/applications/${p}/appPackage`}),saveAppMetadata:async(p,m)=>await y.put({url:`/api/applications/${p}`,body:m}),publishAppChanges:async(p,m)=>await y.post({url:`/api/applications/${p}/publish`,body:m}),revertAppChanges:async p=>await y.post({url:`/api/dev/${p}/revert`}),updateAppClientVersion:async p=>await y.post({url:`/api/applications/${p}/client/update`}),revertAppClientVersion:async p=>await y.post({url:`/api/applications/${p}/client/revert`}),getAppDeployments:async()=>await y.get({url:"/api/deployments"}),createApp:async p=>p instanceof FormData?await y.post({url:"/api/applications",body:p,json:!1}):await y.post({url:"/api/applications",body:p}),duplicateApp:async(p,m)=>await y.post({url:`/api/applications/${p}/duplicate`,body:m}),updateAppFromExport:async(p,m)=>{const v=getDevAppID(p);return await y.post({url:`/api/applications/${v}/import`,body:m,json:!1})},importApps:async p=>await y.post({url:"/api/cloud/import",body:p,json:!1}),unpublishApp:async p=>await y.post({url:`/api/applications/${p}/unpublish`}),deleteApp:async p=>await y.delete({url:`/api/applications/${p}`}),releaseAppLock:async p=>await y.delete({url:`/api/dev/${p}/lock`}),fetchSystemDebugInfo:async()=>await y.get({url:"/api/debug/diagnostics"}),syncApp:async p=>await y.post({url:`/api/applications/${p}/sync`}),getApps:async()=>await y.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async p=>await y.get({url:`/api/${p}/components/definitions`}),addSampleData:async p=>await y.post({url:`/api/applications/${p}/sample`}),getPublishedApps:async()=>(await y.get({url:"/api/client/applications"})).apps}),buildAttachmentEndpoints=y=>{const p={getSignedDatasourceURL:async(m,v,w)=>await y.post({url:`/api/attachments/${m}/url`,body:{bucket:v,key:w}})};return{...p,uploadAttachment:async(m,v)=>await y.post({url:`/api/attachments/${m}/upload`,body:v,json:!1}),uploadBuilderAttachment:async m=>await y.post({url:"/api/attachments/process",body:m,json:!1}),uploadPWAZip:async m=>await y.post({url:"/api/pwa/process-zip",body:m,json:!1}),externalUpload:async(m,v,w,S)=>{const{signedUrl:k,publicUrl:O}=await p.getSignedDatasourceURL(m,v,w);return k?(await y.put({url:k,body:S,json:!1,external:!0,parseResponse:R=>R}),{publicUrl:O}):{publicUrl:void 0}},downloadAttachment:async(m,v,w)=>await y.get({url:`/api/${m}/rows/${v}/attachment/${w}`,parseResponse:S=>S,suppressErrors:!0})}},buildAuthEndpoints=y=>({logIn:async(p,m,v)=>await y.post({url:`/api/global/auth/${p}/login`,body:{username:m,password:v},parseResponse:async w=>{const S=await w.json(),k=w.headers.get("X-Session-Invalidated-Count");return{...S,invalidatedSessionCount:k?parseInt(k):0}}}),logOut:async()=>await y.post({url:"/api/global/auth/logout"}),setInitInfo:async p=>await y.post({url:"/api/global/auth/init",body:p}),getInitInfo:async()=>await y.get({url:"/api/global/auth/init"}),requestForgotPassword:async(p,m)=>await y.post({url:`/api/global/auth/${p}/reset`,body:{email:m}}),resetPassword:async(p,m,v)=>await y.post({url:`/api/global/auth/${p}/reset/update`,body:{password:m,resetCode:v}})}),buildAutomationEndpoints=y=>({triggerAutomation:async(p,m,v)=>await y.post({url:`/api/automations/${p}/trigger`,body:{fields:m,timeout:v}}),testAutomation:async(p,m)=>await y.post({url:`/api/automations/${p}/test`,body:m}),getAutomations:async()=>await y.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await y.get({url:"/api/automations/definitions/list"}),createAutomation:async p=>await y.post({url:"/api/automations",body:p}),updateAutomation:async p=>await y.put({url:"/api/automations",body:p}),deleteAutomation:async(p,m)=>await y.delete({url:`/api/automations/${p}/${m}`}),getAutomationLogs:async p=>await y.post({url:"/api/automations/logs/search",body:p}),clearAutomationLogErrors:async(p,m)=>await y.delete({url:"/api/automations/logs",body:{appId:m,automationId:p}})}),buildConfigEndpoints=y=>({saveConfig:async p=>await y.post({url:"/api/global/configs",body:p}),getConfig:async p=>await y.get({url:`/api/global/configs/${p}`}),deleteConfig:async(p,m)=>await y.delete({url:`/api/global/configs/${p}/${m}`}),getTenantConfig:async p=>await y.get({url:`/api/global/configs/public?tenantId=${p}`}),getOIDCConfigs:async p=>await y.get({url:`/api/global/configs/public/oidc?tenantId=${p}`}),getChecklist:async p=>await y.get({url:`/api/global/configs/checklist?tenantId=${p}`}),uploadLogo:async p=>await y.post({url:"/api/global/configs/upload/settings/logoUrl",body:p,json:!1}),uploadFavicon:async p=>await y.post({url:"/api/global/configs/upload/settings/faviconUrl",body:p,json:!1}),uploadOIDCLogo:async(p,m)=>await y.post({url:`/api/global/configs/upload/logos_oidc/${p}`,body:m,json:!1}),getOIDCLogos:async()=>await y.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=y=>({getDatasources:async()=>await y.get({url:"/api/datasources"}),buildDatasourceSchema:async(p,m)=>await y.post({url:`/api/datasources/${p}/schema`,body:{tablesFilter:m}}),createDatasource:async p=>await y.post({url:"/api/datasources",body:p}),updateDatasource:async p=>await y.put({url:`/api/datasources/${p._id}`,body:p}),deleteDatasource:async(p,m)=>await y.delete({url:`/api/datasources/${p}/${m}`}),validateDatasource:async p=>await y.post({url:"/api/datasources/verify",body:{datasource:p}}),fetchInfoForDatasource:async p=>await y.post({url:"/api/datasources/info",body:{datasource:p}}),fetchExternalSchema:async p=>await y.get({url:`/api/datasources/${p}/schema/external`})}),buildFlagEndpoints=y=>({getFlags:async()=>await y.get({url:"/api/users/flags"}),updateFlag:async(p,m)=>await y.post({url:"/api/users/flags",body:{flag:p,value:m}}),toggleUiFeature:async p=>await y.post({url:`/api/beta/${p}`})}),buildLayoutEndpoints=y=>({saveLayout:async p=>await y.post({url:"/api/layouts",body:p}),deleteLayout:async(p,m)=>await y.delete({url:`/api/layouts/${p}/${m}`})}),buildOtherEndpoints=y=>({getEnvironment:async()=>await y.get({url:"/api/system/environment"}),getSystemStatus:async()=>await y.get({url:"/api/system/status"}),getIntegrations:async()=>await y.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await y.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await y.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=y=>({getPermissionForResource:async p=>await y.get({url:`/api/permission/${p}`}),updatePermissionForResource:async(p,m,v)=>await y.post({url:`/api/permission/${m}/${p}/${v}`}),removePermissionFromResource:async(p,m,v)=>await y.delete({url:`/api/permission/${m}/${p}/${v}`}),getDependants:async p=>await y.get({url:`/api/permission/${p}/dependants`})}),buildQueryEndpoints=y=>({executeQuery:async(p,{pagination:m,parameters:v}={})=>await y.post({url:`/api/v2/queries/${p}`,body:{parameters:v,pagination:m}}),fetchQueryDefinition:async p=>await y.get({url:`/api/queries/${p}`,cache:!0}),getQueries:async()=>await y.get({url:"/api/queries"}),saveQuery:async p=>await y.post({url:"/api/queries",body:p}),deleteQuery:async(p,m)=>await y.delete({url:`/api/queries/${p}/${m}`}),importQueries:async p=>await y.post({url:"/api/queries/import",body:p}),previewQuery:async p=>await y.post({url:"/api/queries/preview",body:p})}),buildRelationshipEndpoints=y=>({fetchRelationshipData:async(p,m,v)=>{const w=await y.get({url:`/api/${p}/${m}/enrich?field=${v}`});return v?w[v]||[]:[w]}}),buildRoleEndpoints=y=>({deleteRole:async(p,m)=>await y.delete({url:`/api/roles/${p}/${m}`}),saveRole:async p=>await y.post({url:"/api/roles",body:p}),getRoles:async()=>await y.get({url:"/api/roles"}),getRolesForApp:async p=>await y.get({url:`/api/global/roles/${p}`}),getAccessibleRoles:async()=>await y.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=y=>({fetchClientAppRoutes:async()=>await y.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await y.get({url:"/api/routing"})}),buildRowEndpoints=y=>({fetchRow:async(p,m)=>await y.get({url:`/api/${p}/rows/${m}`}),saveRow:async(p,m=!1)=>{const v=p._viewId||p.tableId;return await y.post({url:`/api/${v}/rows`,body:p,suppressErrors:m})},patchRow:async(p,m=!1)=>{const v=p._viewId||p.tableId;return await y.patch({url:`/api/${v}/rows`,body:p,suppressErrors:m})},deleteRow:async(p,m)=>await y.delete({url:`/api/${p}/rows`,body:{_id:m}}),deleteRows:async(p,m)=>(m.forEach(v=>{typeof v=="object"&&(v==null||delete v._viewId)}),await y.delete({url:`/api/${p}/rows`,body:{rows:m}})),exportRows:async(p,m,v)=>await y.post({url:`/api/${p}/rows/exportRows?format=${m}`,body:v,parseResponse:async w=>await w.text()})}),buildScreenEndpoints=y=>({saveScreen:async p=>await y.post({url:"/api/screens",body:p}),deleteScreen:async(p,m)=>await y.delete({url:`/api/screens/${p}/${m}`}),usageInScreens:async p=>await y.post({url:`/api/screens/usage/${p}`})}),buildTableEndpoints=y=>({fetchTableDefinition:async p=>await y.get({url:`/api/tables/${p}`,cache:!0}),fetchTableData:async p=>await y.get({url:`/api/${p}/rows`}),searchTable:async(p,m)=>await y.post({url:`/api/${p}/search`,body:m}),importTableData:async(p,m,v)=>await y.post({url:`/api/tables/${p}/import`,body:{rows:m,identifierFields:v}}),csvToJson:async p=>await y.post({url:"/api/convert/csvToJson",body:{csvString:p}}),getTables:async()=>await y.get({url:"/api/tables"}),getTable:async p=>await y.get({url:`/api/tables/${p}`}),saveTable:async p=>await y.post({url:"/api/tables",body:p}),deleteTable:async(p,m)=>await y.delete({url:`/api/tables/${p}/${m}`}),validateNewTableImport:async(p,m)=>await y.post({url:"/api/tables/validateNewTableImport",body:{rows:p,schema:m}}),validateExistingTableImport:async(p,m)=>await y.post({url:"/api/tables/validateExistingTableImport",body:{rows:p,tableId:m}}),migrateColumn:async(p,m,v)=>await y.post({url:`/api/tables/${p}/migrate`,body:{oldColumn:m,newColumn:v}}),duplicateTable:async p=>await y.post({url:`/api/tables/${p}/duplicate`})}),buildTemplateEndpoints=y=>({getEmailTemplateDefinitions:async()=>await y.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await y.get({url:"/api/global/template/email"}),saveEmailTemplate:async p=>await y.post({url:"/api/global/template",body:p}),getAppTemplates:async()=>await y.get({url:"/api/templates"})}),buildUserEndpoints=y=>({getUsers:async()=>await y.get({url:"/api/global/users"}),searchUsers:async p=>await y.post({url:"/api/global/users/search",body:p}),getUser:async p=>await y.get({url:`/api/global/users/${p}`}),updateOwnMetadata:async p=>await y.post({url:"/api/users/metadata/self",body:p}),createAdminUser:async p=>await y.post({url:"/api/global/users/init",body:p}),saveUser:async p=>await y.post({url:"/api/global/users",body:p}),createUsers:async(p,m)=>(await y.post({url:"/api/global/users/bulk",body:{create:{users:p,groups:m}}})).created,deleteUser:async p=>await y.delete({url:`/api/global/users/${p}`}),deleteUsers:async p=>(await y.post({url:"/api/global/users/bulk",body:{delete:{users:p}}})).deleted,onboardUsers:async p=>await y.post({url:"/api/global/users/onboard",body:p}),updateUserInvite:async(p,m)=>await y.post({url:`/api/global/users/invite/update/${p}`,body:m}),getUserInvite:async p=>await y.get({url:`/api/global/users/invite/${p}`}),getUserInvites:async()=>await y.get({url:"/api/global/users/invites"}),inviteUsers:async p=>await y.post({url:"/api/global/users/multi/invite",body:p}),removeUserInvites:async p=>await y.post({url:"/api/global/users/multi/invite/delete",body:p}),acceptInvite:async p=>await y.post({url:"/api/global/users/invite/accept",body:p}),getUserCountByApp:async p=>(await y.get({url:`/api/global/users/count/${p}`})).userCount,addAppBuilder:async(p,m)=>await y.post({url:`/api/global/users/${p}/app/${m}/builder`}),removeAppBuilder:async(p,m)=>await y.delete({url:`/api/global/users/${p}/app/${m}/builder`}),getAccountHolder:async()=>await y.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=y=>({generateAPIKey:async()=>{const p=await y.post({url:"/api/global/self/api_key"});return p==null?void 0:p.apiKey},fetchDeveloperInfo:async()=>y.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await y.get({url:"/api/self"}),fetchBuilderSelf:async()=>await y.get({url:"/api/global/self"}),updateSelf:async p=>await y.post({url:"/api/global/self",body:p})}),buildViewEndpoints=y=>({fetchViewData:async(p,{field:m,groupBy:v,calculation:w})=>{const S=new URLSearchParams;w&&(m&&S.set("field",m),S.set("calculation",w)),v&&S.set("group",v);const k=m?`/api/views/${encodeURIComponent(p)}?${S}`:`/api/views/${encodeURIComponent(p)}`;return await y.get({url:k})},exportView:async(p,m)=>{const v=encodeURIComponent(p);return await y.get({url:`/api/views/export?view=${v}&format=${m}`,parseResponse:async w=>await w.text()})},saveView:async p=>await y.post({url:"/api/views",body:p}),deleteView:async p=>await y.delete({url:`/api/views/${encodeURIComponent(p)}`})}),buildViewV2Endpoints=y=>({fetchDefinition:async p=>await y.get({url:`/api/v2/views/${encodeURIComponent(p)}`,cache:!0}),create:async p=>await y.post({url:"/api/v2/views",body:p}),update:async p=>await y.put({url:`/api/v2/views/${encodeURIComponent(p.id)}`,body:p}),fetch:async(p,m)=>await y.post({url:`/api/v2/views/${encodeURIComponent(p)}/search`,body:m}),delete:async p=>await y.delete({url:`/api/v2/views/${encodeURIComponent(p)}`})}),buildLicensingEndpoints=y=>({activateLicenseKey:async p=>y.post({url:"/api/global/license/key",body:{licenseKey:p}}),deleteLicenseKey:async()=>y.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await y.get({url:"/api/global/license/key"})}catch(p){if(p.status!==404)throw p}},activateOfflineLicense:async p=>y.post({url:"/api/global/license/offline",body:{offlineLicenseToken:p}}),deleteOfflineLicense:async()=>y.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await y.get({url:"/api/global/license/offline"})}catch(p){if(p.status!==404)throw p}},getOfflineLicenseIdentifier:async()=>await y.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>y.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>y.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=y=>{async function p(m,v,w,S){return await y.post({url:`/api/global/groups/${m}/${v}`,body:{[w]:S}})}return{saveGroup:async m=>await y.post({url:"/api/global/groups",body:m}),getGroups:async()=>(await y.get({url:"/api/global/groups"})).data,getGroup:async m=>await y.get({url:`/api/global/groups/${m}`}),deleteGroup:async(m,v)=>await y.delete({url:`/api/global/groups/${m}/${v}`}),getGroupUsers:async({id:m,bookmark:v,emailSearch:w})=>{let S=`/api/global/groups/${m}/users?`;return v&&(S+=`bookmark=${v}&`),w&&(S+=`emailSearch=${w}`),await y.get({url:S})},addUsersToGroup:async(m,v)=>p(m,"users","add",v),removeUsersFromGroup:async(m,v)=>p(m,"users","remove",v),addAppsToGroup:async(m,v)=>p(m,"apps","add",v),removeAppsFromGroup:async(m,v)=>p(m,"apps","remove",v),addGroupAppBuilder:async(m,v)=>await y.post({url:`/api/global/groups/${m}/app/${v}/builder`}),removeGroupAppBuilder:async(m,v)=>await y.delete({url:`/api/global/groups/${m}/app/${v}/builder`}),bulkAddUsersFromCsv:async(m,v)=>await y.post({url:`/api/global/groups/${m}/users/bulk`,body:{csvContent:v}})}},buildPluginEndpoints=y=>({uploadPlugin:async p=>await y.post({url:"/api/plugin/upload",body:p,json:!1}),createPlugin:async p=>await y.post({url:"/api/plugin",body:p}),getPlugins:async()=>await y.get({url:"/api/plugin"}),deletePlugin:async p=>await y.delete({url:`/api/plugin/${p}`})}),buildBackupEndpoints=y=>({createManualBackup:async p=>await y.post({url:`/api/apps/${p}/backups`}),searchBackups:async(p,m)=>await y.post({url:`/api/apps/${p}/backups/search`,body:m}),deleteBackup:async(p,m)=>await y.delete({url:`/api/apps/${p}/backups/${m}`}),restoreBackup:async(p,m,v)=>await y.post({url:`/api/apps/${p}/backups/${m}/import`,body:{name:v}}),clearBackupErrors:async(p,m)=>await y.delete({url:"/api/backups/logs",body:{appId:p,backupId:m}})}),buildEnvironmentVariableEndpoints=y=>({checkEnvironmentVariableStatus:async()=>await y.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await y.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async p=>await y.post({url:"/api/env/variables",body:p}),deleteEnvironmentVariable:async p=>await y.delete({url:`/api/env/variables/${p}`}),updateEnvironmentVariable:async(p,m)=>await y.patch({url:`/api/env/variables/${p}`,body:m})}),buildEventEndpoints=y=>({publishEvent:async p=>await y.post({url:"/api/global/event/publish",body:{type:p}})}),buildAuditLogEndpoints=y=>({searchAuditLogs:async p=>await y.post({url:"/api/global/auditlogs/search",body:p}),getEventDefinitions:async()=>await y.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:p=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(p))}`}),buildLogsEndpoints=y=>({getSystemLogs:async()=>await y.get({url:"/api/system/logs",json:!1,parseResponse:async p=>p})}),buildMigrationEndpoints=y=>({getMigrationStatus:async()=>await y.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=y=>({fetch:async p=>(await y.get({url:`/api/tables/${p}/actions`})).actions,create:async(p,m)=>await y.post({url:`/api/tables/${p}/actions`,body:{name:m}}),delete:async(p,m)=>await y.delete({url:`/api/tables/${p}/actions/${m}`}),enableView:async(p,m,v)=>await y.post({url:`/api/tables/${p}/actions/${m}/permissions/${v}`}),disableView:async(p,m,v)=>await y.delete({url:`/api/tables/${p}/actions/${m}/permissions/${v}`}),trigger:async(p,m,v)=>await y.post({url:`/api/tables/${p}/actions/${m}/trigger`,body:{rowId:v}})}),buildOAuth2Endpoints=y=>({fetch:async()=>(await y.get({url:"/api/oauth2"})).configs,create:async p=>await y.post({url:"/api/oauth2",body:{...p}}),update:async p=>await y.put({url:`/api/oauth2/${p._id}`,body:{...p}}),delete:async(p,m)=>await y.delete({url:`/api/oauth2/${p}/${m}`}),validate:async function(p){return await y.post({url:"/api/oauth2/validate",body:{...p}})}}),buildAgentEndpoints=y=>({agentChat:async p=>{const m=p;return await y.post({url:"/api/agent/chat",body:m})},agentChatStream:async(p,m,v)=>{var S;const w=p;try{const k=await fetch("/api/agent/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(w),credentials:"same-origin"});if(!k.ok)throw new Error(`HTTP error! status: ${k.status}`);const O=(S=k.body)==null?void 0:S.getReader();if(!O)throw new Error("Failed to get response reader");const R=new TextDecoder;let D="";for(;;){const{done:P,value:N}=await O.read();if(P)break;D+=R.decode(N,{stream:!0});const H=D.split(`
439
439
  `);D=H.pop()||"";for(const W of H)if(W.startsWith("data: "))try{const Y=W.slice(6);if(Y.trim()){const J=JSON.parse(Y);m(J)}}catch(Y){console.error("Failed to parse SSE data:",Y)}}}catch(k){if(v)v(k);else throw k}},removeChat:async p=>await y.delete({url:`/api/agent/history/${p}`}),fetchChats:async()=>await y.get({url:"/api/agent/history"}),fetchToolSources:async()=>await y.get({url:"/api/agent/toolsource"}),createToolSource:async p=>await y.post({url:"/api/agent/toolsource",body:p}),updateToolSource:async p=>await y.put({url:"/api/agent/toolsource",body:p}),deleteToolSource:async p=>await y.delete({url:`/api/agent/toolsource/${p}`})}),buildFeatureFlagEndpoints=y=>({overrideFeatureFlags:async p=>{const m={flags:p};return await y.patch({url:"/api/features",body:m,parseResponse:()=>{}})}}),buildNavigationEndpoints=y=>({updateNavigation:async(p,m)=>await y.put({url:`/api/navigation/${p}`,body:m})}),buildWorkspaceAppEndpoints=y=>({fetch:async()=>await y.get({url:"/api/workspaceApp"}),create:async p=>await y.post({url:"/api/workspaceApp",body:p}),update:async p=>await y.put({url:`/api/workspaceApp/${p._id}`,body:p}),delete:async(p,m)=>await y.delete({url:`/api/workspaceApp/${p}/${m}`})}),buildResourceEndpoints=y=>({searchForUsage:async p=>await y.post({url:"/api/resources/usage",body:p})}),buildDeploymentEndpoints=y=>({getPublishStatus:async()=>await y.get({url:"/api/deploy/status"})}),APISessionID=uuid(),createAPIClient=(y={})=>{let p={};const m=async(D,P,N=!1)=>{let H=D.statusText,W=null;try{W=await D.json(),W!=null&&W.message?H=W.message:W!=null&&W.error&&(H=JSON.stringify(W.error))}catch{}return{message:H,json:W,status:D.status,url:D.url,method:P,handled:!0,suppressErrors:N}},v=(D,P,N)=>({message:D,json:null,status:400,url:P,method:N,handled:!0,suppressErrors:!1}),w=async D=>{let{json:P,method:N,external:H,body:W,url:Y,parseResponse:J,suppressErrors:le}=D;P=P&&N!==HTTPMethod.GET;let ce={Accept:"application/json"};ce[Header.SESSION_ID]=APISessionID,H||(ce[Header.API_VER]=ApiVersion),P&&(ce["Content-Type"]="application/json"),y!=null&&y.attachHeaders&&y.attachHeaders(ce);let ue=W;if(P)try{ue=JSON.stringify(W)}catch{throw v("Invalid JSON body",Y,N)}let he;try{he=await fetch(Y,{method:N,headers:ce,body:ue,credentials:"same-origin"})}catch{throw delete p[Y],v("Failed to send request",Y,N)}if(he.status>=200&&he.status<400){S(he);try{return he.status===204?void 0:J?await J(he):await he.json()}catch(me){throw delete p[Y],`Failed to parse response: ${me}`}}else throw delete p[Y],await m(he,N,le)},S=D=>{if(!y.onMigrationDetected)return;const P=D.headers.get(Header.MIGRATING_APP);P&&y.onMigrationDetected(P)},k=async D=>{const P=D.url;return p[P]||(p[P]=w(D),p[P]=await p[P]),await p[P]},O=D=>async P=>{try{let N={json:!0,external:!1,suppressErrors:!1,cache:!1,method:D,...P},{url:H,cache:W,external:Y}=N;return Y||(N.url=`/${H}`.replace("//","/")),await(W&&(y==null?void 0:y.enableCaching)?k:w)(N)}catch(N){throw y!=null&&y.onError&&y.onError(N),N}};let R={post:O(HTTPMethod.POST),get:O(HTTPMethod.GET),patch:O(HTTPMethod.PATCH),delete:O(HTTPMethod.DELETE),put:O(HTTPMethod.PUT),invalidateCache:()=>{p={}},getAppID:()=>{var P;let D={};return(P=y==null?void 0:y.attachHeaders)==null||P.call(y,D),D==null?void 0:D[Header.APP_ID]}};return{...R,...buildAIEndpoints(R),...buildAnalyticsEndpoints(R),...buildAppEndpoints(R),...buildAttachmentEndpoints(R),...buildAuthEndpoints(R),...buildAutomationEndpoints(R),...buildConfigEndpoints(R),...buildDatasourceEndpoints(R),...buildFlagEndpoints(R),...buildLayoutEndpoints(R),...buildOtherEndpoints(R),...buildPermissionsEndpoints(R),...buildQueryEndpoints(R),...buildRelationshipEndpoints(R),...buildRoleEndpoints(R),...buildRouteEndpoints(R),...buildRowEndpoints(R),...buildScreenEndpoints(R),...buildTableEndpoints(R),...buildTemplateEndpoints(R),...buildUserEndpoints(R),...buildViewEndpoints(R),...buildSelfEndpoints(R),...buildLicensingEndpoints(R),...buildGroupsEndpoints(R),...buildPluginEndpoints(R),...buildBackupEndpoints(R),...buildEnvironmentVariableEndpoints(R),...buildEventEndpoints(R),...buildAuditLogEndpoints(R),...buildLogsEndpoints(R),...buildMigrationEndpoints(R),...buildAgentEndpoints(R),...buildFeatureFlagEndpoints(R),deployment:buildDeploymentEndpoints(R),viewV2:buildViewV2Endpoints(R),rowActions:buildRowActionEndpoints(R),oauth2:buildOAuth2Endpoints(R),navigation:buildNavigationEndpoints(R),workspaceApp:buildWorkspaceAppEndpoints(R),resource:buildResourceEndpoints(R)}},getJSONArrayDatasourceSchema=(y,p)=>{let m=y,v=[];p.prefixKeys&&(v=p.prefixKeys.concat(["schema"])),v=v.concat(p.label.split(".").slice(2));for(let w=0;w<v.length;w++)m=m==null?void 0:m[v[w]],m!=null&&m.schema&&(m=m.schema);return convertJSONSchemaToTableSchema(m,{squashObjects:!0,prefixKeys:v})},convertJSONSchemaToTableSchema=(y,p)=>{if(!y)return null;p={squashObjects:!1,prefixKeys:null,...p},y.schema?y=y.schema:y={value:y};const m=extractJSONSchemaKeys(y,p.squashObjects);let v={};return m.forEach(({key:w,type:S})=>{v[w]={type:S,name:w,prefixKeys:p.prefixKeys}}),v},extractJSONSchemaKeys=(y,p=!1)=>{if(!y||!Object.keys(y).length)return[];let m=[];return Object.keys(y).forEach(v=>{const w=y[v].type;if(w==="json"&&p){const S=extractJSONSchemaKeys(y[v].schema,p);m=m.concat(S.map(k=>({key:`${v}.${k.key}`,type:k.type})))}else m.push({key:v,type:w==="array"?"jsonarray":w})}),m},generateQueryArraySchemas=(y,p)=>{var m,v;for(let w in y)((m=y[w])==null?void 0:m.type)==="json"&&((v=y[w])==null?void 0:v.subtype)==="array"&&hasSchema(p[w])&&(y[w]={schema:{schema:Object.entries(p[w]||{}).reduce((S,[k,O])=>(S[k]={name:k,type:O.type,subtype:O.subtype},S),{}),type:"json"},type:"json",subtype:"array"});return y};function setCookie(y,p,m){getCookie(y)&&removeCookie(y);let v=`${y}=${p}; Path=/;`;m&&(v+=` Domain=${m};`),window.document.cookie=v}function getCookie(y){const m=`; ${document.cookie}`.split(`; ${y}=`);if(m.length===2)return m[1].split(";").shift()}function removeCookie(y){getCookie(y)&&(document.cookie=`${y}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles.ADMIN]:5,[Roles.CREATOR]:4,[Roles.POWER]:3,[Roles.BASIC]:2,[Roles.PUBLIC]:1},getRolePriority=y=>RolePriorities[y]??0,sleep=y=>new Promise(p=>setTimeout(p,y)),debounce=(y,p=1e3)=>{let m;return async(...v)=>new Promise(w=>{m&&clearTimeout(m),m=setTimeout(async()=>{const S=await y(...v);w(S)},p)})},throttle=(y,p=1e3)=>{let m,v=!1,w=!1;const S=(...k)=>{if(m=k,v){w=!0;return}y(...m),v=!0,setTimeout(()=>{v=!1,w&&(w=!1,S(...m))},p)};return S},domDebounce=y=>{let p=!1,m;return(...v)=>{m=v,p||(p=!0,requestAnimationFrame(()=>{y(...m),p=!1}))}},buildFormBlockButtonConfig=y=>{const{_id:p,actionType:m,dataSource:v,notificationOverride:w,actionUrl:S,showDeleteButton:k,deleteButtonLabel:O,showSaveButton:R,saveButtonLabel:D}=y||{};if(!p)return;const P=`${p}-form`,N=`${p}-repeater`,H=v==null?void 0:v.resourceId,W=k===!1?"":O==null?void 0:O.trim(),Y=R===!1?"":D==null?void 0:D.trim(),J=[{"##eventHandlerType":"Validate Form",parameters:{componentId:P}},{"##eventHandlerType":"Save Row",parameters:{providerId:P,tableId:H,notificationOverride:w,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...m!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:P}}],...S?[{"##eventHandlerType":"Navigate To",parameters:{url:S}}]:[]],le=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:H,rowId:`{{ ${makePropSafe(N)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(N)}.${makePropSafe("_rev")} }}`,notificationOverride:w}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...S?[{"##eventHandlerType":"Navigate To",parameters:{url:S}}]:[]],ce=[];return m&&["Update","Create"].includes(m)&&R!==!1&&ce.push({text:Y||"Save",_id:uuid(),_component:"@budibase/standard-components/button",onClick:J,type:"cta"}),m==="Update"&&k!==!1&&ce.push({text:W||"Delete",_id:uuid(),_component:"@budibase/standard-components/button",onClick:le,quiet:!0,type:"warning"}),ce},buildMultiStepFormBlockDefaultProps=y=>{const{_id:p,stepCount:m,currentStep:v,actionType:w,dataSource:S}=y||{};if(!p||!m)return;const k=`Step {{ [${p}-form].[__currentStep] }}`,O=S==null?void 0:S.resourceId,R=`${p}-form`;let D=[];return v!==0&&D.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:R},"##eventHandlerType":"Change Form Step"}]}),v!==m-1&&D.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:R}},{parameters:{type:"next",componentId:R},"##eventHandlerType":"Change Form Step"}]}),w!=="View"&&v===m-1&&D.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:R}},{"##eventHandlerType":"Save Row",parameters:{tableId:O,providerId:R}},...w!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:R}}]]}),{buttons:D,title:k}};function parseFilter(y){if(!(y!=null&&y.groups))return y;const p=lodashExports.cloneDeep(y);return p.groups&&(p.groups=p.groups.map(m=>{var v;return m.filters?(m.filters=m.filters.filter(w=>w.field&&w.operator),(v=m.filters)!=null&&v.length?m:null):m}).filter(m=>!!m)),p}const isBetterSample=(y,p)=>{if(p==null&&y!=null)return!0;if(p!=null&&y==null)return!1;const m=typeof p,v=typeof y;return m!==v?!1:v==="string"&&y.length>p.length||v==="object"&&Object.keys(y).length>Object.keys(p).length},generateGoldenSample=y=>{let p={};return y==null||y.slice(0,100).forEach(m=>{Object.keys(m).forEach(v=>{isBetterSample(m[v],p[v])&&(p[v]=m[v])})}),p},getColumnIcon=y=>{if(y.schema.icon&&!y.schema.icon.startsWith("ri-"))return y.schema.icon;if(y.calculationType)return"calculator";if(y.schema.autocolumn)return"shapes";if(isDeprecatedSingleUserColumn(y.schema))return"user";const{type:p,subtype:m}=y.schema;return(typeof TypeIconMap[p]=="object"&&m?TypeIconMap[p][m]:TypeIconMap[p])||"article"},memo=y=>{const p=writable(y);let m=JSON.stringify(y);const v=w=>{const S=JSON.stringify(w);S!==m&&(p.set(w),m=S)};return{subscribe:p.subscribe,set:v,update:w=>{let S=JSON.parse(m);const k=w(S);v(k)}}},derivedMemo=(y,p)=>{const m=derived(y,p),v=memo(get_store_value(m));return m.subscribe(v.set),v},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(y=>{PACKET_TYPES_REVERSE[PACKET_TYPES[y]]=y});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=y=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(y):y&&y.buffer instanceof ArrayBuffer,encodePacket=({type:y,data:p},m,v)=>withNativeBlob$1&&p instanceof Blob?m?v(p):encodeBlobAsBase64(p,v):withNativeArrayBuffer$2&&(p instanceof ArrayBuffer||isView$1(p))?m?v(p):encodeBlobAsBase64(new Blob([p]),v):v(PACKET_TYPES[y]+(p||"")),encodeBlobAsBase64=(y,p)=>{const m=new FileReader;return m.onload=function(){const v=m.result.split(",")[1];p("b"+(v||""))},m.readAsDataURL(y)};function toArray(y){return y instanceof Uint8Array?y:y instanceof ArrayBuffer?new Uint8Array(y):new Uint8Array(y.buffer,y.byteOffset,y.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(y,p){if(withNativeBlob$1&&y.data instanceof Blob)return y.data.arrayBuffer().then(toArray).then(p);if(withNativeArrayBuffer$2&&(y.data instanceof ArrayBuffer||isView$1(y.data)))return p(toArray(y.data));encodePacket(y,!1,m=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),p(TEXT_ENCODER.encode(m))})}const chars$4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$6=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let y=0;y<chars$4.length;y++)lookup$6[chars$4.charCodeAt(y)]=y;const decode$4=y=>{let p=y.length*.75,m=y.length,v,w=0,S,k,O,R;y[y.length-1]==="="&&(p--,y[y.length-2]==="="&&p--);const D=new ArrayBuffer(p),P=new Uint8Array(D);for(v=0;v<m;v+=4)S=lookup$6[y.charCodeAt(v)],k=lookup$6[y.charCodeAt(v+1)],O=lookup$6[y.charCodeAt(v+2)],R=lookup$6[y.charCodeAt(v+3)],P[w++]=S<<2|k>>4,P[w++]=(k&15)<<4|O>>2,P[w++]=(O&3)<<6|R&63;return D},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(y,p)=>{if(typeof y!="string")return{type:"message",data:mapBinary(y,p)};const m=y.charAt(0);return m==="b"?{type:"message",data:decodeBase64Packet(y.substring(1),p)}:PACKET_TYPES_REVERSE[m]?y.length>1?{type:PACKET_TYPES_REVERSE[m],data:y.substring(1)}:{type:PACKET_TYPES_REVERSE[m]}:ERROR_PACKET},decodeBase64Packet=(y,p)=>{if(withNativeArrayBuffer$1){const m=decode$4(y);return mapBinary(m,p)}else return{base64:!0,data:y}},mapBinary=(y,p)=>{switch(p){case"blob":return y instanceof Blob?y:new Blob([y]);case"arraybuffer":default:return y instanceof ArrayBuffer?y:y.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(y,p)=>{const m=y.length,v=new Array(m);let w=0;y.forEach((S,k)=>{encodePacket(S,!1,O=>{v[k]=O,++w===m&&p(v.join(SEPARATOR))})})},decodePayload=(y,p)=>{const m=y.split(SEPARATOR),v=[];for(let w=0;w<m.length;w++){const S=decodePacket(m[w],p);if(v.push(S),S.type==="error")break}return v};function createPacketEncoderStream(){return new TransformStream({transform(y,p){encodePacketToBinary(y,m=>{const v=m.length;let w;if(v<126)w=new Uint8Array(1),new DataView(w.buffer).setUint8(0,v);else if(v<65536){w=new Uint8Array(3);const S=new DataView(w.buffer);S.setUint8(0,126),S.setUint16(1,v)}else{w=new Uint8Array(9);const S=new DataView(w.buffer);S.setUint8(0,127),S.setBigUint64(1,BigInt(v))}y.data&&typeof y.data!="string"&&(w[0]|=128),p.enqueue(w),p.enqueue(m)})}})}let TEXT_DECODER;function totalLength(y){return y.reduce((p,m)=>p+m.length,0)}function concatChunks(y,p){if(y[0].length===p)return y.shift();const m=new Uint8Array(p);let v=0;for(let w=0;w<p;w++)m[w]=y[0][v++],v===y[0].length&&(y.shift(),v=0);return y.length&&v<y[0].length&&(y[0]=y[0].slice(v)),m}function createPacketDecoderStream(y,p){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const m=[];let v=0,w=-1,S=!1;return new TransformStream({transform(k,O){for(m.push(k);;){if(v===0){if(totalLength(m)<1)break;const R=concatChunks(m,1);S=(R[0]&128)===128,w=R[0]&127,w<126?v=3:w===126?v=1:v=2}else if(v===1){if(totalLength(m)<2)break;const R=concatChunks(m,2);w=new DataView(R.buffer,R.byteOffset,R.length).getUint16(0),v=3}else if(v===2){if(totalLength(m)<8)break;const R=concatChunks(m,8),D=new DataView(R.buffer,R.byteOffset,R.length),P=D.getUint32(0);if(P>Math.pow(2,53-32)-1){O.enqueue(ERROR_PACKET);break}w=P*Math.pow(2,32)+D.getUint32(4),v=3}else{if(totalLength(m)<w)break;const R=concatChunks(m,w);O.enqueue(decodePacket(S?R:TEXT_DECODER.decode(R),p)),v=0}if(w===0||w>y){O.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(y){if(y)return mixin(y)}function mixin(y){for(var p in Emitter.prototype)y[p]=Emitter.prototype[p];return y}Emitter.prototype.on=Emitter.prototype.addEventListener=function(y,p){return this._callbacks=this._callbacks||{},(this._callbacks["$"+y]=this._callbacks["$"+y]||[]).push(p),this},Emitter.prototype.once=function(y,p){function m(){this.off(y,m),p.apply(this,arguments)}return m.fn=p,this.on(y,m),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(y,p){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var m=this._callbacks["$"+y];if(!m)return this;if(arguments.length==1)return delete this._callbacks["$"+y],this;for(var v,w=0;w<m.length;w++)if(v=m[w],v===p||v.fn===p){m.splice(w,1);break}return m.length===0&&delete this._callbacks["$"+y],this},Emitter.prototype.emit=function(y){this._callbacks=this._callbacks||{};for(var p=new Array(arguments.length-1),m=this._callbacks["$"+y],v=1;v<arguments.length;v++)p[v-1]=arguments[v];if(m){m=m.slice(0);for(var v=0,w=m.length;v<w;++v)m[v].apply(this,p)}return this},Emitter.prototype.emitReserved=Emitter.prototype.emit,Emitter.prototype.listeners=function(y){return this._callbacks=this._callbacks||{},this._callbacks["$"+y]||[]},Emitter.prototype.hasListeners=function(y){return!!this.listeners(y).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(y,...p){return p.reduce((m,v)=>(y.hasOwnProperty(v)&&(m[v]=y[v]),m),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(y,p){p.useNativeTimers?(y.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),y.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(y.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),y.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(y){return typeof y=="string"?utf8Length(y):Math.ceil((y.byteLength||y.size)*BASE64_OVERHEAD)}function utf8Length(y){let p=0,m=0;for(let v=0,w=y.length;v<w;v++)p=y.charCodeAt(v),p<128?m+=1:p<2048?m+=2:p<55296||p>=57344?m+=3:(v++,m+=4);return m}function encode$4(y){let p="";for(let m in y)y.hasOwnProperty(m)&&(p.length&&(p+="&"),p+=encodeURIComponent(m)+"="+encodeURIComponent(y[m]));return p}function decode$3(y){let p={},m=y.split("&");for(let v=0,w=m.length;v<w;v++){let S=m[v].split("=");p[decodeURIComponent(S[0])]=decodeURIComponent(S[1])}return p}class TransportError extends Error{constructor(p,m,v){super(p),this.description=m,this.context=v,this.type="TransportError"}}class Transport extends Emitter{constructor(p){super(),this.writable=!1,installTimerFunctions(this,p),this.opts=p,this.query=p.query,this.socket=p.socket}onError(p,m,v){return super.emitReserved("error",new TransportError(p,m,v)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(p){this.readyState==="open"&&this.write(p)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(p){const m=decodePacket(p,this.socket.binaryType);this.onPacket(m)}onPacket(p){super.emitReserved("packet",p)}onClose(p){this.readyState="closed",super.emitReserved("close",p)}pause(p){}createUri(p,m={}){return p+"://"+this._hostname()+this._port()+this.opts.path+this._query(m)}_hostname(){const p=this.opts.hostname;return p.indexOf(":")===-1?p:"["+p+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(p){const m=encode$4(p);return m.length?"?"+m:""}}const alphabet$3="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed$1=0,i$4=0,prev;function encode$3(y){let p="";do p=alphabet$3[y%length]+p,y=Math.floor(y/length);while(y>0);return p}function yeast(){const y=encode$3(+new Date);return y!==prev?(seed$1=0,prev=y):y+"."+encode$3(seed$1++)}for(;i$4<length;i$4++)map[alphabet$3[i$4]]=i$4;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(y){}const hasCORS=value$1;function XHR(y){const p=y.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!p||hasCORS))return new XMLHttpRequest}catch{}if(!p)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(p){if(super(p),this.polling=!1,typeof location<"u"){const v=location.protocol==="https:";let w=location.port;w||(w=v?"443":"80"),this.xd=typeof location<"u"&&p.hostname!==location.hostname||w!==p.port}const m=p&&p.forceBase64;this.supportsBinary=hasXHR2&&!m,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(p){this.readyState="pausing";const m=()=>{this.readyState="paused",p()};if(this.polling||!this.writable){let v=0;this.polling&&(v++,this.once("pollComplete",function(){--v||m()})),this.writable||(v++,this.once("drain",function(){--v||m()}))}else m()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(p){const m=v=>{if(this.readyState==="opening"&&v.type==="open"&&this.onOpen(),v.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(v)};decodePayload(p,this.socket.binaryType).forEach(m),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const p=()=>{this.write([{type:"close"}])};this.readyState==="open"?p():this.once("open",p)}write(p){this.writable=!1,encodePayload(p,m=>{this.doWrite(m,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const p=this.opts.secure?"https":"http",m=this.query||{};return this.opts.timestampRequests!==!1&&(m[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!m.sid&&(m.b64=1),this.createUri(p,m)}request(p={}){return Object.assign(p,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),p)}doWrite(p,m){const v=this.request({method:"POST",data:p});v.on("success",m),v.on("error",(w,S)=>{this.onError("xhr post error",w,S)})}doPoll(){const p=this.request();p.on("data",this.onData.bind(this)),p.on("error",(m,v)=>{this.onError("xhr poll error",m,v)}),this.pollXhr=p}}class Request extends Emitter{constructor(p,m){super(),installTimerFunctions(this,m),this.opts=m,this.method=m.method||"GET",this.uri=p,this.data=m.data!==void 0?m.data:null,this.create()}create(){var p;const m=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");m.xdomain=!!this.opts.xd;const v=this.xhr=new XHR(m);try{v.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){v.setDisableHeaderCheck&&v.setDisableHeaderCheck(!0);for(let w in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(w)&&v.setRequestHeader(w,this.opts.extraHeaders[w])}}catch{}if(this.method==="POST")try{v.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{v.setRequestHeader("Accept","*/*")}catch{}(p=this.opts.cookieJar)===null||p===void 0||p.addCookies(v),"withCredentials"in v&&(v.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(v.timeout=this.opts.requestTimeout),v.onreadystatechange=()=>{var w;v.readyState===3&&((w=this.opts.cookieJar)===null||w===void 0||w.parseCookies(v)),v.readyState===4&&(v.status===200||v.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof v.status=="number"?v.status:0)},0))},v.send(this.data)}catch(w){this.setTimeoutFn(()=>{this.onError(w)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(p){this.emitReserved("error",p,this.xhr),this.cleanup(!0)}cleanup(p){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,p)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const p=this.xhr.responseText;p!==null&&(this.emitReserved("data",p),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Request.requestsCount=0,Request.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const y="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(y,unloadHandler,!1)}}function unloadHandler(){for(let y in Request.requests)Request.requests.hasOwnProperty(y)&&Request.requests[y].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?p=>Promise.resolve().then(p):(p,m)=>m(p,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(p){super(p),this.supportsBinary=!p.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const p=this.uri(),m=this.opts.protocols,v=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(v.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?m?new WebSocket(p,m):new WebSocket(p):new WebSocket(p,m,v)}catch(w){return this.emitReserved("error",w)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=p=>this.onClose({description:"websocket connection closed",context:p}),this.ws.onmessage=p=>this.onData(p.data),this.ws.onerror=p=>this.onError("websocket error",p)}write(p){this.writable=!1;for(let m=0;m<p.length;m++){const v=p[m],w=m===p.length-1;encodePacket(v,this.supportsBinary,S=>{const k={};try{usingBrowserWebSocket&&this.ws.send(S)}catch{}w&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const p=this.opts.secure?"wss":"ws",m=this.query||{};return this.opts.timestampRequests&&(m[this.opts.timestampParam]=yeast()),this.supportsBinary||(m.b64=1),this.createUri(p,m)}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(p=>{this.onError("webtransport error",p)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(p=>{const m=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),v=p.readable.pipeThrough(m).getReader(),w=createPacketEncoderStream();w.readable.pipeTo(p.writable),this.writer=w.writable.getWriter();const S=()=>{v.read().then(({done:O,value:R})=>{O||(this.onPacket(R),S())}).catch(O=>{})};S();const k={type:"open"};this.query.sid&&(k.data=`{"sid":"${this.query.sid}"}`),this.writer.write(k).then(()=>this.onOpen())})}))}write(p){this.writable=!1;for(let m=0;m<p.length;m++){const v=p[m],w=m===p.length-1;this.writer.write(v).then(()=>{w&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var p;(p=this.transport)===null||p===void 0||p.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(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$7(y){if(y.length>2e3)throw"URI too long";const p=y,m=y.indexOf("["),v=y.indexOf("]");m!=-1&&v!=-1&&(y=y.substring(0,m)+y.substring(m,v).replace(/:/g,";")+y.substring(v,y.length));let w=re.exec(y||""),S={},k=14;for(;k--;)S[parts[k]]=w[k]||"";return m!=-1&&v!=-1&&(S.source=p,S.host=S.host.substring(1,S.host.length-1).replace(/;/g,":"),S.authority=S.authority.replace("[","").replace("]","").replace(/;/g,":"),S.ipv6uri=!0),S.pathNames=pathNames(S,S.path),S.queryKey=queryKey(S,S.query),S}function pathNames(y,p){const m=/\/{2,9}/g,v=p.replace(m,"/").split("/");return(p.slice(0,1)=="/"||p.length===0)&&v.splice(0,1),p.slice(-1)=="/"&&v.splice(v.length-1,1),v}function queryKey(y,p){const m={};return p.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(v,w,S){w&&(m[w]=S)}),m}let Socket$1=class zd extends Emitter{constructor(p,m={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],p&&typeof p=="object"&&(m=p,p=null),p?(p=parse$7(p),m.hostname=p.host,m.secure=p.protocol==="https"||p.protocol==="wss",m.port=p.port,p.query&&(m.query=p.query)):m.host&&(m.hostname=parse$7(m.host).host),installTimerFunctions(this,m),this.secure=m.secure!=null?m.secure:typeof location<"u"&&location.protocol==="https:",m.hostname&&!m.port&&(m.port=this.secure?"443":"80"),this.hostname=m.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=m.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=m.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},m),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$3(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(p){const m=Object.assign({},this.opts.query);m.EIO=protocol$1,m.transport=p,this.id&&(m.sid=this.id);const v=Object.assign({},this.opts,{query:m,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[p]);return new transports[p](v)}open(){let p;if(this.opts.rememberUpgrade&&zd.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)p="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else p=this.transports[0];this.readyState="opening";try{p=this.createTransport(p)}catch{this.transports.shift(),this.open();return}p.open(),this.setTransport(p)}setTransport(p){this.transport&&this.transport.removeAllListeners(),this.transport=p,p.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",m=>this.onClose("transport close",m))}probe(p){let m=this.createTransport(p),v=!1;zd.priorWebsocketSuccess=!1;const w=()=>{v||(m.send([{type:"ping",data:"probe"}]),m.once("packet",N=>{if(!v)if(N.type==="pong"&&N.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",m),!m)return;zd.priorWebsocketSuccess=m.name==="websocket",this.transport.pause(()=>{v||this.readyState!=="closed"&&(P(),this.setTransport(m),m.send([{type:"upgrade"}]),this.emitReserved("upgrade",m),m=null,this.upgrading=!1,this.flush())})}else{const H=new Error("probe error");H.transport=m.name,this.emitReserved("upgradeError",H)}}))};function S(){v||(v=!0,P(),m.close(),m=null)}const k=N=>{const H=new Error("probe error: "+N);H.transport=m.name,S(),this.emitReserved("upgradeError",H)};function O(){k("transport closed")}function R(){k("socket closed")}function D(N){m&&N.name!==m.name&&S()}const P=()=>{m.removeListener("open",w),m.removeListener("error",k),m.removeListener("close",O),this.off("close",R),this.off("upgrading",D)};m.once("open",w),m.once("error",k),m.once("close",O),this.once("close",R),this.once("upgrading",D),this.upgrades.indexOf("webtransport")!==-1&&p!=="webtransport"?this.setTimeoutFn(()=>{v||m.open()},200):m.open()}onOpen(){if(this.readyState="open",zd.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let p=0;const m=this.upgrades.length;for(;p<m;p++)this.probe(this.upgrades[p])}}onPacket(p){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",p),this.emitReserved("heartbeat"),this.resetPingTimeout(),p.type){case"open":this.onHandshake(JSON.parse(p.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const m=new Error("server error");m.code=p.data,this.onError(m);break;case"message":this.emitReserved("data",p.data),this.emitReserved("message",p.data);break}}onHandshake(p){this.emitReserved("handshake",p),this.id=p.sid,this.transport.query.sid=p.sid,this.upgrades=this.filterUpgrades(p.upgrades),this.pingInterval=p.pingInterval,this.pingTimeout=p.pingTimeout,this.maxPayload=p.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 p=this.getWritablePackets();this.transport.send(p),this.prevBufferLen=p.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let m=1;for(let v=0;v<this.writeBuffer.length;v++){const w=this.writeBuffer[v].data;if(w&&(m+=byteLength(w)),v>0&&m>this.maxPayload)return this.writeBuffer.slice(0,v);m+=2}return this.writeBuffer}write(p,m,v){return this.sendPacket("message",p,m,v),this}send(p,m,v){return this.sendPacket("message",p,m,v),this}sendPacket(p,m,v,w){if(typeof m=="function"&&(w=m,m=void 0),typeof v=="function"&&(w=v,v=null),this.readyState==="closing"||this.readyState==="closed")return;v=v||{},v.compress=v.compress!==!1;const S={type:p,data:m,options:v};this.emitReserved("packetCreate",S),this.writeBuffer.push(S),w&&this.once("flush",w),this.flush()}close(){const p=()=>{this.onClose("forced close"),this.transport.close()},m=()=>{this.off("upgrade",m),this.off("upgradeError",m),p()},v=()=>{this.once("upgrade",m),this.once("upgradeError",m)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?v():p()}):this.upgrading?v():p()),this}onError(p){zd.priorWebsocketSuccess=!1,this.emitReserved("error",p),this.onClose("transport error",p)}onClose(p,m){(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",p,m),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(p){const m=[];let v=0;const w=p.length;for(;v<w;v++)~this.transports.indexOf(p[v])&&m.push(p[v]);return m}};Socket$1.protocol=protocol$1;function url(y,p="",m){let v=y;m=m||typeof location<"u"&&location,y==null&&(y=m.protocol+"//"+m.host),typeof y=="string"&&(y.charAt(0)==="/"&&(y.charAt(1)==="/"?y=m.protocol+y:y=m.host+y),/^(https?|wss?):\/\//.test(y)||(typeof m<"u"?y=m.protocol+"//"+y:y="https://"+y),v=parse$7(y)),v.port||(/^(http|ws)$/.test(v.protocol)?v.port="80":/^(http|ws)s$/.test(v.protocol)&&(v.port="443")),v.path=v.path||"/";const S=v.host.indexOf(":")!==-1?"["+v.host+"]":v.host;return v.id=v.protocol+"://"+S+":"+v.port+p,v.href=v.protocol+"://"+S+(m&&m.port===v.port?"":":"+v.port),v}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=y=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(y):y.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(y){return withNativeArrayBuffer&&(y instanceof ArrayBuffer||isView(y))||withNativeBlob&&y instanceof Blob||withNativeFile&&y instanceof File}function hasBinary(y,p){if(!y||typeof y!="object")return!1;if(Array.isArray(y)){for(let m=0,v=y.length;m<v;m++)if(hasBinary(y[m]))return!0;return!1}if(isBinary(y))return!0;if(y.toJSON&&typeof y.toJSON=="function"&&arguments.length===1)return hasBinary(y.toJSON(),!0);for(const m in y)if(Object.prototype.hasOwnProperty.call(y,m)&&hasBinary(y[m]))return!0;return!1}function deconstructPacket(y){const p=[],m=y.data,v=y;return v.data=_deconstructPacket(m,p),v.attachments=p.length,{packet:v,buffers:p}}function _deconstructPacket(y,p){if(!y)return y;if(isBinary(y)){const m={_placeholder:!0,num:p.length};return p.push(y),m}else if(Array.isArray(y)){const m=new Array(y.length);for(let v=0;v<y.length;v++)m[v]=_deconstructPacket(y[v],p);return m}else if(typeof y=="object"&&!(y instanceof Date)){const m={};for(const v in y)Object.prototype.hasOwnProperty.call(y,v)&&(m[v]=_deconstructPacket(y[v],p));return m}return y}function reconstructPacket(y,p){return y.data=_reconstructPacket(y.data,p),delete y.attachments,y}function _reconstructPacket(y,p){if(!y)return y;if(y&&y._placeholder===!0){if(typeof y.num=="number"&&y.num>=0&&y.num<p.length)return p[y.num];throw new Error("illegal attachments")}else if(Array.isArray(y))for(let m=0;m<y.length;m++)y[m]=_reconstructPacket(y[m],p);else if(typeof y=="object")for(const m in y)Object.prototype.hasOwnProperty.call(y,m)&&(y[m]=_reconstructPacket(y[m],p));return y}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(y){y[y.CONNECT=0]="CONNECT",y[y.DISCONNECT=1]="DISCONNECT",y[y.EVENT=2]="EVENT",y[y.ACK=3]="ACK",y[y.CONNECT_ERROR=4]="CONNECT_ERROR",y[y.BINARY_EVENT=5]="BINARY_EVENT",y[y.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(p){this.replacer=p}encode(p){return(p.type===PacketType.EVENT||p.type===PacketType.ACK)&&hasBinary(p)?this.encodeAsBinary({type:p.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:p.nsp,data:p.data,id:p.id}):[this.encodeAsString(p)]}encodeAsString(p){let m=""+p.type;return(p.type===PacketType.BINARY_EVENT||p.type===PacketType.BINARY_ACK)&&(m+=p.attachments+"-"),p.nsp&&p.nsp!=="/"&&(m+=p.nsp+","),p.id!=null&&(m+=p.id),p.data!=null&&(m+=JSON.stringify(p.data,this.replacer)),m}encodeAsBinary(p){const m=deconstructPacket(p),v=this.encodeAsString(m.packet),w=m.buffers;return w.unshift(v),w}}function isObject$1(y){return Object.prototype.toString.call(y)==="[object Object]"}class Decoder extends Emitter{constructor(p){super(),this.reviver=p}add(p){let m;if(typeof p=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");m=this.decodeString(p);const v=m.type===PacketType.BINARY_EVENT;v||m.type===PacketType.BINARY_ACK?(m.type=v?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(m),m.attachments===0&&super.emitReserved("decoded",m)):super.emitReserved("decoded",m)}else if(isBinary(p)||p.base64)if(this.reconstructor)m=this.reconstructor.takeBinaryData(p),m&&(this.reconstructor=null,super.emitReserved("decoded",m));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+p)}decodeString(p){let m=0;const v={type:Number(p.charAt(0))};if(PacketType[v.type]===void 0)throw new Error("unknown packet type "+v.type);if(v.type===PacketType.BINARY_EVENT||v.type===PacketType.BINARY_ACK){const S=m+1;for(;p.charAt(++m)!=="-"&&m!=p.length;);const k=p.substring(S,m);if(k!=Number(k)||p.charAt(m)!=="-")throw new Error("Illegal attachments");v.attachments=Number(k)}if(p.charAt(m+1)==="/"){const S=m+1;for(;++m&&!(p.charAt(m)===","||m===p.length););v.nsp=p.substring(S,m)}else v.nsp="/";const w=p.charAt(m+1);if(w!==""&&Number(w)==w){const S=m+1;for(;++m;){const k=p.charAt(m);if(k==null||Number(k)!=k){--m;break}if(m===p.length)break}v.id=Number(p.substring(S,m+1))}if(p.charAt(++m)){const S=this.tryParse(p.substr(m));if(Decoder.isPayloadValid(v.type,S))v.data=S;else throw new Error("invalid payload")}return v}tryParse(p){try{return JSON.parse(p,this.reviver)}catch{return!1}}static isPayloadValid(p,m){switch(p){case PacketType.CONNECT:return isObject$1(m);case PacketType.DISCONNECT:return m===void 0;case PacketType.CONNECT_ERROR:return typeof m=="string"||isObject$1(m);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(m)&&(typeof m[0]=="number"||typeof m[0]=="string"&&RESERVED_EVENTS$1.indexOf(m[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(m)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(p){this.packet=p,this.buffers=[],this.reconPack=p}takeBinaryData(p){if(this.buffers.push(p),this.buffers.length===this.reconPack.attachments){const m=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),m}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$1=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on(y,p,m){return y.on(p,m),function(){y.off(p,m)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(p,m,v){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=p,this.nsp=m,v&&v.auth&&(this.auth=v.auth),this._opts=Object.assign({},v),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const p=this.io;this.subs=[on(p,"open",this.onopen.bind(this)),on(p,"packet",this.onpacket.bind(this)),on(p,"error",this.onerror.bind(this)),on(p,"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(...p){return p.unshift("message"),this.emit.apply(this,p),this}emit(p,...m){if(RESERVED_EVENTS.hasOwnProperty(p))throw new Error('"'+p.toString()+'" is a reserved event name');if(m.unshift(p),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(m),this;const v={type:PacketType.EVENT,data:m};if(v.options={},v.options.compress=this.flags.compress!==!1,typeof m[m.length-1]=="function"){const k=this.ids++,O=m.pop();this._registerAckCallback(k,O),v.id=k}const w=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!w||!this.connected)||(this.connected?(this.notifyOutgoingListeners(v),this.packet(v)):this.sendBuffer.push(v)),this.flags={},this}_registerAckCallback(p,m){var v;const w=(v=this.flags.timeout)!==null&&v!==void 0?v:this._opts.ackTimeout;if(w===void 0){this.acks[p]=m;return}const S=this.io.setTimeoutFn(()=>{delete this.acks[p];for(let O=0;O<this.sendBuffer.length;O++)this.sendBuffer[O].id===p&&this.sendBuffer.splice(O,1);m.call(this,new Error("operation has timed out"))},w),k=(...O)=>{this.io.clearTimeoutFn(S),m.apply(this,O)};k.withError=!0,this.acks[p]=k}emitWithAck(p,...m){return new Promise((v,w)=>{const S=(k,O)=>k?w(k):v(O);S.withError=!0,m.push(S),this.emit(p,...m)})}_addToQueue(p){let m;typeof p[p.length-1]=="function"&&(m=p.pop());const v={id:this._queueSeq++,tryCount:0,pending:!1,args:p,flags:Object.assign({fromQueue:!0},this.flags)};p.push((w,...S)=>v!==this._queue[0]?void 0:(w!==null?v.tryCount>this._opts.retries&&(this._queue.shift(),m&&m(w)):(this._queue.shift(),m&&m(null,...S)),v.pending=!1,this._drainQueue())),this._queue.push(v),this._drainQueue()}_drainQueue(p=!1){if(!this.connected||this._queue.length===0)return;const m=this._queue[0];m.pending&&!p||(m.pending=!0,m.tryCount++,this.flags=m.flags,this.emit.apply(this,m.args))}packet(p){p.nsp=this.nsp,this.io._packet(p)}onopen(){typeof this.auth=="function"?this.auth(p=>{this._sendConnectPacket(p)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(p){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},p):p})}onerror(p){this.connected||this.emitReserved("connect_error",p)}onclose(p,m){this.connected=!1,delete this.id,this.emitReserved("disconnect",p,m),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(p=>{if(!this.sendBuffer.some(v=>String(v.id)===p)){const v=this.acks[p];delete this.acks[p],v.withError&&v.call(this,new Error("socket has been disconnected"))}})}onpacket(p){if(p.nsp===this.nsp)switch(p.type){case PacketType.CONNECT:p.data&&p.data.sid?this.onconnect(p.data.sid,p.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(p);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(p);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const v=new Error(p.data.message);v.data=p.data.data,this.emitReserved("connect_error",v);break}}onevent(p){const m=p.data||[];p.id!=null&&m.push(this.ack(p.id)),this.connected?this.emitEvent(m):this.receiveBuffer.push(Object.freeze(m))}emitEvent(p){if(this._anyListeners&&this._anyListeners.length){const m=this._anyListeners.slice();for(const v of m)v.apply(this,p)}super.emit.apply(this,p),this._pid&&p.length&&typeof p[p.length-1]=="string"&&(this._lastOffset=p[p.length-1])}ack(p){const m=this;let v=!1;return function(...w){v||(v=!0,m.packet({type:PacketType.ACK,id:p,data:w}))}}onack(p){const m=this.acks[p.id];typeof m=="function"&&(delete this.acks[p.id],m.withError&&p.data.unshift(null),m.apply(this,p.data))}onconnect(p,m){this.id=p,this.recovered=m&&this._pid===m,this._pid=m,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(p=>this.emitEvent(p)),this.receiveBuffer=[],this.sendBuffer.forEach(p=>{this.notifyOutgoingListeners(p),this.packet(p)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(p=>p()),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(p){return this.flags.compress=p,this}get volatile(){return this.flags.volatile=!0,this}timeout(p){return this.flags.timeout=p,this}onAny(p){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(p),this}prependAny(p){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(p),this}offAny(p){if(!this._anyListeners)return this;if(p){const m=this._anyListeners;for(let v=0;v<m.length;v++)if(p===m[v])return m.splice(v,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(p){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(p),this}prependAnyOutgoing(p){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(p),this}offAnyOutgoing(p){if(!this._anyOutgoingListeners)return this;if(p){const m=this._anyOutgoingListeners;for(let v=0;v<m.length;v++)if(p===m[v])return m.splice(v,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(p){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const m=this._anyOutgoingListeners.slice();for(const v of m)v.apply(this,p.data)}}}function Backoff(y){y=y||{},this.ms=y.min||100,this.max=y.max||1e4,this.factor=y.factor||2,this.jitter=y.jitter>0&&y.jitter<=1?y.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var y=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var p=Math.random(),m=Math.floor(p*this.jitter*y);y=Math.floor(p*10)&1?y+m:y-m}return Math.min(y,this.max)|0},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(y){this.ms=y},Backoff.prototype.setMax=function(y){this.max=y},Backoff.prototype.setJitter=function(y){this.jitter=y};class Manager extends Emitter{constructor(p,m){var v;super(),this.nsps={},this.subs=[],p&&typeof p=="object"&&(m=p,p=void 0),m=m||{},m.path=m.path||"/socket.io",this.opts=m,installTimerFunctions(this,m),this.reconnection(m.reconnection!==!1),this.reconnectionAttempts(m.reconnectionAttempts||1/0),this.reconnectionDelay(m.reconnectionDelay||1e3),this.reconnectionDelayMax(m.reconnectionDelayMax||5e3),this.randomizationFactor((v=m.randomizationFactor)!==null&&v!==void 0?v:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(m.timeout==null?2e4:m.timeout),this._readyState="closed",this.uri=p;const w=m.parser||parser$1;this.encoder=new w.Encoder,this.decoder=new w.Decoder,this._autoConnect=m.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(p){return arguments.length?(this._reconnection=!!p,this):this._reconnection}reconnectionAttempts(p){return p===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=p,this)}reconnectionDelay(p){var m;return p===void 0?this._reconnectionDelay:(this._reconnectionDelay=p,(m=this.backoff)===null||m===void 0||m.setMin(p),this)}randomizationFactor(p){var m;return p===void 0?this._randomizationFactor:(this._randomizationFactor=p,(m=this.backoff)===null||m===void 0||m.setJitter(p),this)}reconnectionDelayMax(p){var m;return p===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=p,(m=this.backoff)===null||m===void 0||m.setMax(p),this)}timeout(p){return arguments.length?(this._timeout=p,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(p){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const m=this.engine,v=this;this._readyState="opening",this.skipReconnect=!1;const w=on(m,"open",function(){v.onopen(),p&&p()}),S=O=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",O),p?p(O):this.maybeReconnectOnOpen()},k=on(m,"error",S);if(this._timeout!==!1){const O=this._timeout,R=this.setTimeoutFn(()=>{w(),S(new Error("timeout")),m.close()},O);this.opts.autoUnref&&R.unref(),this.subs.push(()=>{this.clearTimeoutFn(R)})}return this.subs.push(w),this.subs.push(k),this}connect(p){return this.open(p)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const p=this.engine;this.subs.push(on(p,"ping",this.onping.bind(this)),on(p,"data",this.ondata.bind(this)),on(p,"error",this.onerror.bind(this)),on(p,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(p){try{this.decoder.add(p)}catch(m){this.onclose("parse error",m)}}ondecoded(p){nextTick(()=>{this.emitReserved("packet",p)},this.setTimeoutFn)}onerror(p){this.emitReserved("error",p)}socket(p,m){let v=this.nsps[p];return v?this._autoConnect&&!v.active&&v.connect():(v=new Socket(this,p,m),this.nsps[p]=v),v}_destroy(p){const m=Object.keys(this.nsps);for(const v of m)if(this.nsps[v].active)return;this._close()}_packet(p){const m=this.encoder.encode(p);for(let v=0;v<m.length;v++)this.engine.write(m[v],p.options)}cleanup(){this.subs.forEach(p=>p()),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(p,m){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",p,m),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const p=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const m=this.backoff.duration();this._reconnecting=!0;const v=this.setTimeoutFn(()=>{p.skipReconnect||(this.emitReserved("reconnect_attempt",p.backoff.attempts),!p.skipReconnect&&p.open(w=>{w?(p._reconnecting=!1,p.reconnect(),this.emitReserved("reconnect_error",w)):p.onreconnect()}))},m);this.opts.autoUnref&&v.unref(),this.subs.push(()=>{this.clearTimeoutFn(v)})}}onreconnect(){const p=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",p)}}const cache={};function lookup$5(y,p){typeof y=="object"&&(p=y,y=void 0),p=p||{};const m=url(y,p.path||"/socket.io"),v=m.source,w=m.id,S=m.path,k=cache[w]&&S in cache[w].nsps,O=p.forceNew||p["force new connection"]||p.multiplex===!1||k;let R;return O?R=new Manager(v,p):(cache[w]||(cache[w]=new Manager(v,p)),R=cache[w]),m.query&&!p.query&&(p.query=m.queryKey),R.socket(m.path,p)}Object.assign(lookup$5,{Manager,Socket,io:lookup$5,connect:lookup$5});const DefaultOptions={heartbeat:!0},createWebsocket=(y,p=DefaultOptions)=>{if(!y)throw"A websocket path must be provided";const{heartbeat:m}={...DefaultOptions,...p},v=location.protocol==="https:",w=v?"wss:":"ws:",S=location.hostname,k=location.port||(v?443:80);let O=lookup$5(`${w}//${S}:${k}`,{path:y,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),R;return m&&(R=setInterval(()=>{O.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),O.on("disconnect",()=>{clearInterval(R)}),O.onOther=(D,P)=>{O.on(D,N=>{(N==null?void 0:N.apiSessionId)!==APISessionID&&P(N)})},O},extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;async function downloadStream(y){const p=await y.blob(),m=y.headers.get("Content-Disposition"),w=extractFileNameRegex.exec(m)[1].replace(/['"]/g,""),S=new Blob([p]),k=URL.createObjectURL(S),O=document.createElement("a");O.href=k,O.download=w,O.click(),URL.revokeObjectURL(k)}const shouldDisplaySetting=(y,p)=>{let m=p.dependsOn;return m&&!Array.isArray(m)&&(m=[m]),m!=null&&m.length?m.every(v=>{let w=v,S=null,k=!!v.invert;if(typeof v=="object"&&(w=v.setting,S=v.value),!w)return!1;Array.isArray(S)||(S=[S]);const O=deepGet$1(y,w);return S.some(D=>D==null?O!=null&&O!==!1&&O!=="":D===O)!==k}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(y,p)=>{function m(v){const{timeOnly:w,dateOnly:S}=p||{},k=!S,O=parseDate(v,{enableTime:k});return getDateDisplayValue(O,{enableTime:k,timeOnly:w})}return y.map(v=>m(v))},[FieldType.BOOLEAN]:y=>y.map(p=>!!p),[FieldType.BB_REFERENCE_SINGLE]:y=>[...new Map(y.map(p=>[p._id,p])).values()],[FieldType.BB_REFERENCE]:y=>[...new Map(y.map(p=>[p._id,p])).values()],[FieldType.ARRAY]:y=>Array.from(new Set(y))};function enrichSchemaWithRelColumns(y){return Object.keys(y).reduce((m,v)=>{const w=y[v];if(m[v]=w,w.visible!==!1&&isRelationshipField(w)&&w.columns){const S=(w==null?void 0:w.relationshipType)===RelationshipType.ONE_TO_MANY;for(const k of Object.keys(w.columns)){const O=w.columns[k];if(!O.visible)continue;const R=`${w.name}.${k}`;m[R]={...O,type:O.type,name:R,related:{field:v,subField:k},cellRenderType:!S&&columnTypeManyTypeOverrides[O.type]||O.type}}}return m},{})}function getRelatedTableValues(y,p,m){var S,k,O,R;const v=isRelationshipField(m)&&(m==null?void 0:m.relationshipType)===RelationshipType.ONE_TO_MANY;let w="";if(v)w=(k=(S=y[p.related.field])==null?void 0:S[0])==null?void 0:k[p.related.subField];else{const D=columnTypeManyParser[p.type]||(H=>H),P=(R=(O=y[p.related.field])==null?void 0:O.flatMap(H=>H[p.related.subField]))==null?void 0:R.filter(H=>H!=null),N=D(P||[],p);w=N,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(p.type)&&(w=N==null?void 0:N.join(", "))}return w}function canBeDisplayColumn(y){return!(!canBeDisplayColumn$1(y.type)||y.related)}function canBeSortColumn(y){return y.calculationType?!0:!(!canBeSortColumn$1(y.type)||y.related)}const getSettingsDefinition=y=>{var m;if(!y)return[];let p=[];return(m=y.settings)==null||m.forEach(v=>{var w;v.section?p=p.concat((w=v.settings||[])==null?void 0:w.map(S=>({...S,sectionDependsOn:v.dependsOn}))):p.push(v)}),p};function requiredValidator(y){return y!=null&&y!==""||"This field is required"}function createValidationStore(y,...p){let m=!1;const v=writable(y||""),w=derived(v,()=>m||(m=!0,!1)),S=derived([v,w],([k,O])=>O&&validate(k,p));return[v,S,w]}function validate(y,p){const m=p.find(v=>v(y)!==!0);return m&&m(y)}const NumberFormatter=Intl.NumberFormat(),formatNumber=y=>{const p=typeof y;if(p!=="string"&&p!=="number"||p==="string"&&!y.trim().length)return"";const m=NumberFormatter.format(y);return m==="NaN"?stringifyValue(y):m},stringifyValue=y=>{if(y==null)return"";if(typeof y=="string")return y;if(typeof y.toString=="function")return stringifyValue(y.toString());try{return JSON.stringify(y)}catch{return""}},stringifyField=(y,p)=>{switch(p.type){case FieldType.AUTO:return"";case FieldType.SIGNATURE_SINGLE:return y?"Yes":"No";case FieldType.ATTACHMENT_SINGLE:case FieldType.ATTACHMENTS:return y?(Array.isArray(y)?y:[y]).map(v=>v.name).filter(v=>!!v).join(", "):"";case FieldType.LINK:return y?(Array.isArray(y)?y:[y]).map(v=>v.primaryDisplay).filter(v=>!!v).join(", "):"";case FieldType.JSON:return y?JSON.stringify(y):"";case FieldType.BB_REFERENCE:case FieldType.BB_REFERENCE_SINGLE:{if(p.subtype!==BBReferenceFieldSubType.USERS&&p.subtype!==BBReferenceFieldSubType.USER||!y)return"";const m=Array.isArray(y)?y:[y];return(m==null?void 0:m.map(v=>v.primaryDisplay).join(", "))||""}case FieldType.ARRAY:return(y==null?void 0:y.join(", "))||"";case FieldType.BOOLEAN:return capitalise((y==null?void 0:y.toString())||"false");case FieldType.DATETIME:return getDateDisplayValue(y,{enableTime:!p.dateOnly,timeOnly:p.timeOnly});case FieldType.NUMBER:return formatNumber(y);case FieldType.STRING:case FieldType.LONGFORM:case FieldType.BIGINT:case FieldType.OPTIONS:case FieldType.AI:case FieldType.BARCODEQR:return y||"";case FieldType.FORMULA:default:return stringifyValue(y)}},stringifyRow=(y,p)=>{let m={};return Object.entries(p).forEach(([v,w])=>{m[v]=stringifyField(deepGet(y,v),w)}),m},SESSIONS_INVALIDATED_KEY="bb-sessions-invalidated";function popNumSessionsInvalidated(){const y=parseInt(localStorage.getItem(SESSIONS_INVALIDATED_KEY)||"0",10);return localStorage.removeItem(SESSIONS_INVALIDATED_KEY),y}function invalidationMessage(y){return`You've been logged out of ${y} other ${y===1?"session":"sessions"} because users are only allowed ${MAX_SESSIONS_PER_USER} active sessions at any one time.`}const{buildQuery,limit:queryLimit,runQuery,sort}=QueryUtils;class BaseDataFetch{constructor(p){Ni(this,"API");Ni(this,"features");Ni(this,"options");Ni(this,"store");Ni(this,"derivedStore");if(this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:p.datasource,limit:10,filter:null,query:p.query,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:p.query,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random().toString(),error:null}),this.API=p==null?void 0:p.API,this.options={...this.options,...p},!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,m=>({...m,...this.features,hasNextPage:this.hasNextPage(m),hasPrevPage:this.hasPrevPage(m)})),!this.options.datasource){this.store.update(m=>({...m,loaded:!0}));return}}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(p,m){return p!=null&&p.primaryDisplay&&m[p.primaryDisplay]?p.primaryDisplay:Object.keys(m)[0]}async getInitialData(){const{filter:p,paginate:m}=this.options,v=await this.getDefinition(),w=await this.determineFeatureFlags();this.features={supportsSearch:!!(w!=null&&w.supportsSearch),supportsSort:!!(w!=null&&w.supportsSort),supportsPagination:m&&!!(w!=null&&w.supportsPagination)};let S=this.getSchema(v);if(!S)return;if(S=this.enrichSchema(S),this.options.sortColumn&&!S[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(v,S)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const R=S==null?void 0:S[this.options.sortColumn];((R==null?void 0:R.type)===FieldType.NUMBER||(R==null?void 0:R.type)===FieldType.BIGINT||"calculationType"in R&&(R!=null&&R.calculationType))&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder?this.options.sortOrder=this.options.sortOrder.toLowerCase():this.options.sortOrder=SortOrder.ASCENDING}let k=this.options.query;k||(k=buildQuery(p??void 0)),this.store.update(R=>({...R,definition:v,schema:S,query:k,loading:!0,cursors:[],cursor:null}));const O=await this.getPage();this.store.update(R=>({...R,loading:!1,loaded:!0,pageNumber:0,rows:O.rows,info:O.info,cursors:m&&O.hasNextPage?[null,O.cursor]:[null],error:O.error,resetKey:Math.random().toString()}))}async getPage(){const{sortColumn:p,sortOrder:m,sortType:v,limit:w,clientSideSearching:S,clientSideSorting:k,clientSideLimiting:O}=this.options,{query:R}=get_store_value(this.store);let{rows:D,info:P,hasNextPage:N,cursor:H,error:W}=await this.getData();return!this.features.supportsSearch&&S&&(D=runQuery(D,R)),!this.features.supportsSort&&k&&v&&(D=sort(D,p,m,v)),!this.features.supportsPagination&&O&&(D=queryLimit(D,w)),{rows:D,info:P,hasNextPage:N,cursor:H,error:W}}getSchema(p){return(p==null?void 0:p.schema)??void 0}enrichSchema(p){let m={};for(const w of Object.keys(p)){const S=p[w];if(S.type===FieldType.JSON){const k=convertJSONSchemaToTableSchema(S,{squashObjects:!0});if(k)for(const O of Object.keys(k))m[`${w}.${O}`]={type:k[O].type,nestedJSON:!0}}}let v={};return Object.entries({...p,...m}).forEach(([w,S])=>{typeof S=="string"?v[w]={type:S,name:w}:v[w]={...S,type:S.type,name:w}}),v}async determineFeatureFlags(){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(p){let m=!1;for(const[v,w]of Object.entries(p||{})){const S=this.options[v]??null;if(JSON.stringify(w??null)!==JSON.stringify(S)){m=!0;break}}m&&(this.options={...this.options,...fp$1.cloneDeep(p)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(R=>({...R,loading:!0}));const{rows:p,info:m,error:v,cursor:w}=await this.getPage();let{cursors:S}=get_store_value(this.store);const{pageNumber:k}=get_store_value(this.store);if(!p.length&&k>0)return this.store.update(R=>({...R,loading:!1,cursors:S.slice(0,k)})),await this.prevPage();S[k+1]!=w&&(S=S.slice(0,k+1),S[k+1]=w),this.store.update(R=>({...R,rows:p,info:m,loading:!1,error:v,cursors:S}))}hasNextPage(p){return p.cursors[p.pageNumber+1]!=null}hasPrevPage(p){return p.pageNumber>0}async nextPage(){const p=get_store_value(this.derivedStore);if(p.loading||!this.options.paginate||!p.hasNextPage)return;const m=p.cursors[p.pageNumber+1];this.store.update(R=>({...R,loading:!0,cursor:m,pageNumber:R.pageNumber+1}));const{rows:v,info:w,hasNextPage:S,cursor:k,error:O}=await this.getPage();this.store.update(R=>{let{cursors:D,pageNumber:P}=R;return S&&(D[P+1]=k),{...R,rows:v,info:w,cursors:D,loading:!1,error:O}})}async prevPage(){const p=get_store_value(this.derivedStore);if(p.loading||!this.options.paginate||!p.hasPrevPage)return;const m=p.cursors[p.pageNumber-1];this.store.update(k=>({...k,loading:!0,cursor:m,pageNumber:k.pageNumber-1}));const{rows:v,info:w,error:S}=await this.getPage();this.store.update(k=>({...k,rows:v,info:w,loading:!1,error:S}))}}class TableFetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:p}=this.options;if(!(p!=null&&p.tableId))return null;try{return await this.API.fetchTableDefinition(p.tableId)}catch(m){return this.store.update(v=>({...v,error:m})),null}}async getData(){const{datasource:p,limit:m,sortColumn:v,sortOrder:w,sortType:S,paginate:k}=this.options,{tableId:O}=p,{cursor:R,query:D}=get_store_value(this.store);try{const P=await this.API.searchTable(O,{query:D,limit:m,sort:v,sortOrder:w??SortOrder.ASCENDING,sortType:S,paginate:k,bookmark:R});return{rows:(P==null?void 0:P.rows)||[],hasNextPage:(P==null?void 0:P.hasNextPage)||!1,cursor:(P==null?void 0:P.bookmark)||null}}catch(P){return{rows:[],hasNextPage:!1,error:P}}}}class ViewFetch extends BaseDataFetch{async getDefinition(){const{datasource:p}=this.options;if(!(p!=null&&p.tableId))return null;try{return await this.API.fetchTableDefinition(p.tableId)}catch(m){return this.store.update(v=>({...v,error:m})),null}}getSchema(p){var v,w;const{datasource:m}=this.options;return(w=(v=p==null?void 0:p.views)==null?void 0:v[m==null?void 0:m.name])==null?void 0:w.schema}async getData(){const{datasource:p}=this.options;try{return{rows:await this.API.fetchViewData(p.name,{calculation:p.calculation,field:p.field,groupBy:p.groupBy,tableId:p.tableId})||[]}}catch(m){return console.error(m,{datasource:p}),{rows:[]}}}}class ViewV2Fetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:p}=this.options;try{const m=await this.API.viewV2.fetchDefinition(p.id);return m==null?void 0:m.data}catch(m){return this.store.update(v=>({...v,error:m})),null}}getDefaultSortColumn(){return null}async getData(){var P;const{datasource:p,limit:m,sortColumn:v,sortOrder:w,sortType:S,paginate:k}=this.options,{cursor:O,query:R,definition:D}=get_store_value(this.store);if((D==null?void 0:D.type)===ViewV2Type.CALCULATION&&!Object.values(D.schema||{}).some(isCalculationField))return{rows:[],hasNextPage:!1,cursor:null,error:null};!v&&((P=D==null?void 0:D.sort)!=null&&P.field)&&(this.options.sortColumn=D.sort.field,this.options.sortOrder=D.sort.order||SortOrder.ASCENDING);try{const N={query:R,paginate:k,limit:m,bookmark:O,sort:v,sortOrder:w,sortType:S};if(k){const H=await this.API.viewV2.fetch(p.id,{...N,paginate:k});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:(H==null?void 0:H.hasNextPage)||!1,cursor:(H==null?void 0:H.bookmark)||null}}else{const H=await this.API.viewV2.fetch(p.id,{...N,paginate:k});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:!1,cursor:null}}}catch(N){return{rows:[],hasNextPage:!1,cursor:null,error:N}}}}class QueryFetch extends BaseDataFetch{async determineFeatureFlags(){var v,w,S,k,O,R;const p=await this.getDefinition();return{supportsPagination:!!((w=(v=p==null?void 0:p.fields)==null?void 0:v.pagination)!=null&&w.type)&&!!((k=(S=p==null?void 0:p.fields)==null?void 0:S.pagination)!=null&&k.location)&&!!((R=(O=p==null?void 0:p.fields)==null?void 0:O.pagination)!=null&&R.pageParam)}}async getDefinition(){const{datasource:p}=this.options;if(!(p!=null&&p._id))return null;try{const m=await this.API.fetchQueryDefinition(p._id);return m.fields||(m.fields=p.fields),m}catch{return null}}getDefaultSortColumn(){return null}async getData(){var P,N;const{datasource:p,limit:m,paginate:v}=this.options,{supportsPagination:w}=this.features,{cursor:S,definition:k}=get_store_value(this.store),O=(N=(P=k==null?void 0:k.fields)==null?void 0:P.pagination)==null?void 0:N.type,R=cloneDeep$1(p.queryParams||{});for(const H of(p==null?void 0:p.parameters)||[])R[H.name]||(R[H.name]=H.default);const D={parameters:R};if(v&&w){const H=O==="page"?parseInt(S||"1"):S;D.pagination={page:H,limit:m}}try{const H=await this.API.executeQuery(p==null?void 0:p._id,D),{data:W,pagination:Y,...J}=H;let le=null,ce=!1;return v&&w&&(O==="page"?(le=D.pagination.page+1,ce=(W==null?void 0:W.length)===m&&m>0):(le=Y==null?void 0:Y.cursor,ce=le!=null)),{rows:W||[],info:J,cursor:le,hasNextPage:ce}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends BaseDataFetch{async getDefinition(){const{datasource:p}=this.options;if(!(p!=null&&p.tableId))return null;try{return await this.API.fetchTableDefinition(p.tableId)}catch(m){return this.store.update(v=>({...v,error:m})),null}}async getData(){const{datasource:p}=this.options;if(!(p!=null&&p.rowId)||!(p!=null&&p.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(p.rowTableId,p.rowId,p.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends BaseDataFetch{async getDefinition(){var m,v;const{datasource:p}=this.options;return{schema:(m=p==null?void 0:p.value)==null?void 0:m.schema,primaryDisplay:(v=p==null?void 0:p.value)==null?void 0:v.primaryDisplay}}async getData(){var m;const{datasource:p}=this.options;return{rows:((m=p==null?void 0:p.value)==null?void 0:m.rows)||[],hasNextPage:!1,cursor:null}}}function isArrayOfStrings(y){return Array.isArray(y)&&!!y[0]&&typeof y[0]!="object"}class FieldFetch extends BaseDataFetch{async getDefinition(){const{datasource:p}=this.options;let m;return p.fieldType==="attachment"?m={url:{type:"string"},name:{type:"string"}}:p.fieldType==="array"&&(m={value:{type:"string"}}),{schema:m}}async getData(){const{datasource:p}=this.options,m=(p==null?void 0:p.value)||[];let v;return isArrayOfStrings(m)?v=m.map(w=>({value:w})):v=m,{rows:v||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(){const{datasource:p}=this.options;try{const m=await this.API.fetchTableDefinition(p.tableId);return{schema:getJSONArrayDatasourceSchema(m==null?void 0:m.schema,p)}}catch{return null}}}class UserFetch extends BaseDataFetch{constructor(p){super({...p,datasource:{type:"user",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:p,paginate:m}=this.options,{cursor:v,query:w}=get_store_value(this.store),{appId:S,paginated:k,...O}=w,R=isSupportedUserSearch(O)?O:{};try{const D={bookmark:v??void 0,query:R??void 0,appId:S,paginate:k||m,limit:p},P=await this.API.searchUsers(D);return{rows:(P==null?void 0:P.data)||[],hasNextPage:(P==null?void 0:P.hasNextPage)||!1,cursor:(P==null?void 0:P.nextPage)||null}}catch(D){return{rows:[],hasNextPage:!1,error:D}}}}class GroupUserFetch extends BaseDataFetch{constructor(p){super({...p,datasource:{type:"groupUser",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:p,cursor:m}=get_store_value(this.store);try{const v=await this.API.getGroupUsers({id:p.groupId,emailSearch:p.emailSearch,bookmark:m??void 0});return{rows:(v==null?void 0:v.users)||[],hasNextPage:(v==null?void 0:v.hasNextPage)||!1,cursor:(v==null?void 0:v.bookmark)||null}}catch(v){return{rows:[],hasNextPage:!1,error:v}}}}class CustomFetch extends BaseDataFetch{getType(p){return p==null?"string":typeof p==="object"?Array.isArray(p)?"array":"json":isNaN(p)?"string":"number"}parseCustomData(p){if(!p)return[];if(Array.isArray(p))return p;if(typeof p=="string"){try{const m=JSON.parse(p);return Array.isArray(m)?m:[m]}catch{}return p.includes(`
440
440
  `)?p.split(`
441
441
  `).map(m=>m.trim()):p.split(",").map(m=>m.trim())}return[p]}enrichCustomData(p){return p!=null&&p.length?(p=p.filter(m=>m!=null&&m!==""&&!Array.isArray(m)),p.map(m=>{if(typeof m=="object")return m;if(typeof m=="string"){const v=m.split(",").map(S=>S.trim()),w={};for(let S=0;S<v.length;S++){const O=`Value${S===0?"":` ${S+1}`}`;w[O]=v[S]}return w}return{Value:m}})):[]}getCustomData(p){return this.enrichCustomData(this.parseCustomData(p==null?void 0:p.data))}async getDefinition(){const{datasource:p}=this.options,m={},v=this.getCustomData(p);if(!(v!=null&&v.length))return{schema:m};for(const w of v)for(const S of Object.keys(w))if(S!=="_id"&&!m[S]){let k=this.getType(w[S]);const O={};if(k==="string"){const R=[...new Set(v.map(P=>P[S]))];R.length/v.length<=.8&&R.length>1&&(k="options",O.inclusion=R)}else k==="array"&&(O.inclusion=[...new Set(v.map(R=>R[S]).flat())]);m[S]={type:k,constraints:O}}return{schema:m}}async getData(){const{datasource:p}=this.options;return{rows:this.getCustomData(p),hasNextPage:!1,cursor:null}}}class QueryArrayFetch extends FieldFetch{async getDefinition(){const{datasource:p}=this.options;if(!(p!=null&&p.tableId))return null;try{const m=await this.API.fetchQueryDefinition(p.tableId),v=generateQueryArraySchemas(m.schema,m.nestedSchemaFields);return{schema:getJSONArrayDatasourceSchema(v,p)}}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:y,datasource:p,options:m})=>{const v=DataFetchMap[p==null?void 0:p.type]||TableFetch,w=new v({API:y,datasource:p,...m});return w.getInitialData(),w},createEmptyFetchInstance=({API:y,datasource:p})=>{const m=DataFetchMap[p==null?void 0:p.type];return m?new m({API:y,datasource:p,query:null}):null},getDatasourceDefinition=async({API:y,datasource:p})=>{const m=createEmptyFetchInstance({API:y,datasource:p});return await(m==null?void 0:m.getDefinition())},getDatasourceSchema=({API:y,datasource:p,definition:m})=>{const v=createEmptyFetchInstance({API:y,datasource:p});return v==null?void 0:v.getSchema(m)},createLocalStorageStore=(y,p)=>{const m=writable(p,()=>{S();const k=({key:O})=>O===y&&S();return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)}),v=k=>{m.set(k),localStorage.setItem(y,JSON.stringify(k))},w=k=>v(k(get_store_value(m))),S=()=>{const k=localStorage.getItem(y);if(k==null)v(p);else try{m.set(JSON.parse(k))}catch{v(p)}};return{...m,set:v,update:w}},SplitPage_svelte_svelte_type_style_lang="",Testimonial_svelte_svelte_type_style_lang="",TestimonialPage_svelte_svelte_type_style_lang="",SignatureModal_svelte_svelte_type_style_lang="";function create_default_slot_2$r(y){let p,m,v,w={darkMode:y[3],value:y[1],saveIcon:!1};return m=new Signature({props:w}),y[8](m),m.$on("update",y[9]),{c(){p=element("div"),create_component(m.$$.fragment),attr(p,"class","signature-wrap modal svelte-1jbgrys")},m(S,k){insert(S,p,k),mount_component(m,p,null),v=!0},p(S,k){const O={};k&8&&(O.darkMode=S[3]),k&2&&(O.value=S[1]),m.$set(O)},i(S){v||(transition_in(m.$$.fragment,S),v=!0)},o(S){transition_out(m.$$.fragment,S),v=!1},d(S){S&&detach(p),y[8](null),destroy_component(m)}}}function create_default_slot_1$H(y){let p;return{c(){p=text$1(y[2])},m(m,v){insert(m,p,v)},p(m,v){v&4&&set_data(p,m[2])},d(m){m&&detach(p)}}}function create_header_slot(y){let p,m,v;return m=new Body({props:{$$slots:{default:[create_default_slot_1$H]},$$scope:{ctx:y}}}),{c(){p=element("div"),create_component(m.$$.fragment),attr(p,"slot","header")},m(w,S){insert(w,p,S),mount_component(m,p,null),v=!0},p(w,S){const k={};S&4100&&(k.$$scope={dirty:S,ctx:w}),m.$set(k)},i(w){v||(transition_in(m.$$.fragment,w),v=!0)},o(w){transition_out(m.$$.fragment,w),v=!1},d(w){w&&detach(p),destroy_component(m)}}}function create_default_slot$1y(y){let p,m;return p=new ModalContent({props:{showConfirmButton:!0,showCancelButton:!1,showCloseIcon:!1,custom:!0,disabled:!y[6],showDivider:!1,onConfirm:y[10],$$slots:{header:[create_header_slot],default:[create_default_slot_2$r]},$$scope:{ctx:y}}}),{c(){create_component(p.$$.fragment)},m(v,w){mount_component(p,v,w),m=!0},p(v,w){const S={};w&64&&(S.disabled=!v[6]),w&33&&(S.onConfirm=v[10]),w&4206&&(S.$$scope={dirty:w,ctx:v}),p.$set(S)},i(v){m||(transition_in(p.$$.fragment,v),m=!0)},o(v){transition_out(p.$$.fragment,v),m=!1},d(v){destroy_component(p,v)}}}function create_fragment$2W(y){let p,m,v={$$slots:{default:[create_default_slot$1y]},$$scope:{ctx:y}};return p=new Modal({props:v}),y[11](p),{c(){create_component(p.$$.fragment)},m(w,S){mount_component(p,w,S),m=!0},p(w,[S]){const k={};S&4207&&(k.$$scope={dirty:S,ctx:w}),p.$set(k)},i(w){m||(transition_in(p.$$.fragment,w),m=!0)},o(w){transition_out(p.$$.fragment,w),m=!1},d(w){y[11](null),destroy_component(p,w)}}}function instance$2U(y,p,m){let{onConfirm:v=()=>{}}=p,{value:w}=p,{title:S}=p,{darkMode:k}=p;const O=()=>{m(6,P=!1),R.show()};let R,D,P=!1;function N(J){binding_callbacks[J?"unshift":"push"](()=>{D=J,m(5,D)})}const H=()=>{m(6,P=!0)},W=()=>{v(D)};function Y(J){binding_callbacks[J?"unshift":"push"](()=>{R=J,m(4,R)})}return y.$$set=J=>{"onConfirm"in J&&m(0,v=J.onConfirm),"value"in J&&m(1,w=J.value),"title"in J&&m(2,S=J.title),"darkMode"in J&&m(3,k=J.darkMode)},[v,w,S,k,R,D,P,O,N,H,W,Y]}class SignatureModal extends SvelteComponent{constructor(p){super(),init$1(this,p,instance$2U,create_fragment$2W,safe_not_equal,{onConfirm:0,value:1,title:2,darkMode:3,show:7})}get show(){return this.$$.ctx[7]}}function create_if_block$1M(y){let p,m;return p=new AbsTooltip({props:{text:y[3]?getUserLabel(y[0]):"",position:y[2],color:getUserColor(y[0]),$$slots:{default:[create_default_slot$1x]},$$scope:{ctx:y}}}),{c(){create_component(p.$$.fragment)},m(v,w){mount_component(p,v,w),m=!0},p(v,w){const S={};w&9&&(S.text=v[3]?getUserLabel(v[0]):""),w&4&&(S.position=v[2]),w&1&&(S.color=getUserColor(v[0])),w&19&&(S.$$scope={dirty:w,ctx:v}),p.$set(S)},i(v){m||(transition_in(p.$$.fragment,v),m=!0)},o(v){transition_out(p.$$.fragment,v),m=!1},d(v){destroy_component(p,v)}}}function create_default_slot$1x(y){let p,m;return p=new Avatar({props:{size:y[1],initials:getUserInitials(y[0]),color:getUserColor(y[0])}}),{c(){create_component(p.$$.fragment)},m(v,w){mount_component(p,v,w),m=!0},p(v,w){const S={};w&2&&(S.size=v[1]),w&1&&(S.initials=getUserInitials(v[0])),w&1&&(S.color=getUserColor(v[0])),p.$set(S)},i(v){m||(transition_in(p.$$.fragment,v),m=!0)},o(v){transition_out(p.$$.fragment,v),m=!1},d(v){destroy_component(p,v)}}}function create_fragment$2V(y){let p,m,v=y[0]&&create_if_block$1M(y);return{c(){v&&v.c(),p=empty$1()},m(w,S){v&&v.m(w,S),insert(w,p,S),m=!0},p(w,[S]){w[0]?v?(v.p(w,S),S&1&&transition_in(v,1)):(v=create_if_block$1M(w),v.c(),transition_in(v,1),v.m(p.parentNode,p)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros())},i(w){m||(transition_in(v),m=!0)},o(w){transition_out(v),m=!1},d(w){w&&detach(p),v&&v.d(w)}}}function instance$2T(y,p,m){let{user:v}=p,{size:w="S"}=p,{tooltipPosition:S=TooltipPosition.Top}=p,{showTooltip:k=!0}=p;return y.$$set=O=>{"user"in O&&m(0,v=O.user),"size"in O&&m(1,w=O.size),"tooltipPosition"in O&&m(2,S=O.tooltipPosition),"showTooltip"in O&&m(3,k=O.showTooltip)},[v,w,S,k]}class UserAvatar extends SvelteComponent{constructor(p){super(),init$1(this,p,instance$2T,create_fragment$2V,safe_not_equal,{user:0,size:1,tooltipPosition:2,showTooltip:3})}}const UserAvatars_svelte_svelte_type_style_lang$1="",Updating_svelte_svelte_type_style_lang="";function create_else_block_1$a(y){let p;return{c(){p=text$1("Something went wrong!")},m(m,v){insert(m,p,v)},d(m){m&&detach(p)}}}function create_if_block_1$V(y){let p;return{c(){p=text$1("System update")},m(m,v){insert(m,p,v)},d(m){m&&detach(p)}}}function create_else_block$w(y){let p,m,v,w,S;return{c(){p=text$1(`An error occurred, please try again later.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/client",
3
- "version": "3.13.18",
3
+ "version": "3.13.20",
4
4
  "license": "MPL-2.0",
5
5
  "module": "dist/budibase-client.js",
6
6
  "main": "dist/budibase-client.js",
@@ -73,5 +73,5 @@
73
73
  }
74
74
  }
75
75
  },
76
- "gitHead": "6d3c3c8002c3ba2682b5bfb2299b4457195fda82"
76
+ "gitHead": "6d7096e4d28a12b872d1aa83cee09a3ac431a9ae"
77
77
  }