@standards/schema 1.0.0-alpha.397 → 1.0.0-alpha.400
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{all-Cuw60VCF.d.ts → all-Y3tO-bfa.d.mts} +80 -70
- package/dist/{all-BMhGZOJ4.d.mts → all-o498zQ_Z.d.ts} +80 -70
- package/dist/api/index.d.mts +160 -64
- package/dist/api/index.d.ts +160 -64
- package/dist/api/index.js +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/{attributes-DHbSq5-c.d.ts → attributes-BOIIZZpP.d.ts} +1 -1
- package/dist/{attributes-ybI2RY0p.d.mts → attributes-CAYOHQLt.d.mts} +1 -1
- package/dist/{checkbox-DvtCTshQ.d.mts → checkbox-RJEhZTDu.d.mts} +2 -2
- package/dist/{checkbox-BgyfKv2J.d.ts → checkbox-UJEOyMLV.d.ts} +2 -2
- package/dist/{date-B9livx2w.d.mts → date-jqgfgslv.d.mts} +2 -2
- package/dist/{date-CDg8dTJA.d.ts → date-rwqgadEE.d.ts} +2 -2
- package/dist/{exceptions-CeP0QxYo.d.mts → exceptions-RCZEE1uQ.d.mts} +6 -2
- package/dist/{exceptions-CeP0QxYo.d.ts → exceptions-RCZEE1uQ.d.ts} +6 -2
- package/dist/exceptions.d.mts +1 -1
- package/dist/exceptions.d.ts +1 -1
- package/dist/{index-BttvvaQY.d.mts → index-BC5mEVkb.d.mts} +3 -3
- package/dist/{index-DpDZ-UoW.d.mts → index-Bk_zzZUx.d.mts} +418 -78
- package/dist/{index-CanuuQuP.d.ts → index-BsOZnVmp.d.ts} +3 -3
- package/dist/{index-BaxABgqT.d.ts → index-C0k7xmHS.d.ts} +418 -78
- package/dist/{index-ea_C0sbY.d.ts → index-CFXgKvOC.d.ts} +1 -1
- package/dist/{index-DICp0at8.d.mts → index-CiKELB3w.d.mts} +1 -1
- package/dist/{index-bLYmzLtL.d.mts → index-ColQV1OG.d.mts} +3 -3
- package/dist/{index-Jjt6ggWu.d.ts → index-DMBl9Ahc.d.ts} +3 -3
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{number-MnY5CLQ-.d.ts → number-CfG_k0mZ.d.ts} +2 -2
- package/dist/{number-CASI8GSl.d.mts → number-DYkxcIqq.d.mts} +2 -2
- package/dist/{objects-DgAAilNd.d.ts → objects-Dc4zYk9o.d.ts} +2 -2
- package/dist/{objects-q1d_wU_1.d.mts → objects-Dmn8ZIXZ.d.mts} +2 -2
- package/dist/record-operation-BP69nfIq.mjs +2 -0
- package/dist/record-operation-BU_PIu6m.js +2 -0
- package/dist/{text-CIY_GzA4.d.ts → text-BkLwT1XH.d.ts} +2 -2
- package/dist/{text-BjaTSXw_.d.mts → text-DkZ-_8Qs.d.mts} +2 -2
- package/dist/{utils-DDQvppjN.d.ts → utils-Brab7BhE.d.ts} +1 -1
- package/dist/{utils-BrTiR8t6.d.mts → utils-C8viP5ET.d.mts} +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/validation/all.d.mts +4 -4
- package/dist/validation/all.d.ts +4 -4
- package/dist/validation/all.js +1 -1
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/core/index.d.mts +1 -1
- package/dist/validation/core/index.d.ts +1 -1
- package/dist/validation/object/index.d.mts +1 -1
- package/dist/validation/object/index.d.ts +1 -1
- package/dist/validation/primitives/checkbox.d.mts +1 -1
- package/dist/validation/primitives/checkbox.d.ts +1 -1
- package/dist/validation/primitives/date.d.mts +1 -1
- package/dist/validation/primitives/date.d.ts +1 -1
- package/dist/validation/primitives/number.d.mts +1 -1
- package/dist/validation/primitives/number.d.ts +1 -1
- package/dist/validation/primitives/text.d.mts +1 -1
- package/dist/validation/primitives/text.d.ts +1 -1
- package/dist/view-config.schema-B9y7-OCJ.mjs +2 -0
- package/dist/view-config.schema-Cyl6PedI.js +2 -0
- package/package.json +2 -2
- package/dist/record-operation-CYn0ql3E.mjs +0 -2
- package/dist/record-operation-DLlWYtBc.js +0 -2
- package/dist/view-config.schema-Cbq9lhVg.js +0 -2
- package/dist/view-config.schema-D7TH6B1r.mjs +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys } from "../../index-
|
|
2
|
+
import { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys } from "../../index-ColQV1OG.mjs";
|
|
3
3
|
export { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys } from "../../index-
|
|
2
|
+
import { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys } from "../../index-BsOZnVmp.js";
|
|
3
3
|
export { SIMPLE_PROPERTY_TYPES, WIRE_OFFERED_BASE_CONFIG, WIRE_OMITTED_CONFIG_KEYS, attributeConfigSchemas, datePrecisionIssues, getAttributeConfigSchema, getAttributeConfigWriteSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, propertyAttributeSchema, propertyAttributeWireSchema, propertySchemaSchema, propertySchemaWireSchema, refuseForeignKeys, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema, wireHiddenTypeConfigMask, wireOmittedConfigKeysFor, withoutUnknownOptionKeys };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { DEFAULT_VALIDATION_MESSAGES, ValidationMessages, ValidationResult, formatZodErrors } from "../../index-
|
|
2
|
+
import { DEFAULT_VALIDATION_MESSAGES, ValidationMessages, ValidationResult, formatZodErrors } from "../../index-CiKELB3w.mjs";
|
|
3
3
|
export { DEFAULT_VALIDATION_MESSAGES, type ValidationMessages, type ValidationResult, formatZodErrors };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { DEFAULT_VALIDATION_MESSAGES, ValidationMessages, ValidationResult, formatZodErrors } from "../../index-
|
|
2
|
+
import { DEFAULT_VALIDATION_MESSAGES, ValidationMessages, ValidationResult, formatZodErrors } from "../../index-CFXgKvOC.js";
|
|
3
3
|
export { DEFAULT_VALIDATION_MESSAGES, type ValidationMessages, type ValidationResult, formatZodErrors };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from "../../index-
|
|
2
|
+
import { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from "../../index-BC5mEVkb.mjs";
|
|
3
3
|
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from "../../index-
|
|
2
|
+
import { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from "../../index-DMBl9Ahc.js";
|
|
3
3
|
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
import{AGGREGATE_MEASURES as e,NOTIFICATION_KINDS as t}from"./record-aggregates-DY8qLwuF.mjs";import{DuplicateError as n,SchemaError as r,ValidationError as i}from"./exceptions.mjs";import"./zod-locale.mjs";import{LIST_VIEW_TAB_VISIBILITIES as a,SCHEMA_LIMITS as o,iconNameSchema as s}from"./primitives-D9A6pmXV.mjs";import*as c from"zod";const l={createdAt:`createdAt`,updatedAt:`updatedAt`,createdBy:`createdBy`,lastUpdatedBy:`lastUpdatedBy`,attachments:`attachments`};function getSystemAttributeI18nKey(e){return l[e]}const u={createdAt:{id:`system:createdAt`,name:`createdAt`,label:`Created time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was created`},updatedAt:{id:`system:updatedAt`,name:`updatedAt`,label:`Last edited time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was last modified`},createdBy:{id:`system:createdBy`,name:`createdBy`,label:`Created by`,type:`user`,required:!1,system:!0,multiple:!1,actors:!0,icon:`user`,description:`Actor who created this record`},lastUpdatedBy:{id:`system:lastUpdatedBy`,name:`lastUpdatedBy`,label:`Last edited by`,type:`user`,required:!1,system:!0,multiple:!1,actors:!0,icon:`user`,description:`Actor who last modified this record`},attachments:{id:`system:attachments`,name:`attachments`,label:`Attachments`,type:`document`,required:!1,system:!0,hidden:!0,icon:`paperclip`,description:`Free-form document attachments`}};function getSystemAttributeList(){return Object.values(u)}function isManagedSystemAttribute(e){return e.id?.startsWith(`system:`)??!1}const d=[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`],f=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_empty`,`is_not_empty`],p=[`is`],m=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`is_empty`,`is_not_empty`],h=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],ee=[`any_of`,`none_of`,`is_empty`,`is_not_empty`],g=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],_=[`is_empty`,`is_not_empty`],v=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`contains`,`not_contains`,`is_empty`,`is_not_empty`],y=[`city`,`postalCode`,`country`];function isLocationFilterProperty(e){return y.includes(e)}const b={text:d,richtext:[],number:f,checkbox:p,date:m,phone:[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`is_empty`,`is_not_empty`],currency:f,status:h,select:h,multiselect:ee,location:[],user:g,relation:g,formula:v,document:_},te=new Set([`formula`,`rollup`]),ne=new Set([`user`,`relation`,`document`]),re=new Set([`text`,`richtext`,`number`,`select`,`multiselect`,`status`,`date`,`phone`,`currency`,`location`,`user`,`relation`,`document`]),ie=new Set([`text`,`number`,`date`,`phone`,`currency`,`select`,`multiselect`]),ae=new Set([`text`,`richtext`,`phone`,`status`,`select`,`multiselect`]),oe=new Set([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`]);function getAttributeCapabilities(e){let t=!!(e.hidden||e.archived),n=!e.archived,r=te.has(e.type),i=e.type===`document`,a=ne.has(e.type),o=getAttributeCardinality(e),s=t?[]:getRawFilterOperators(e),c=s.length>0&&!t,l=!t&&ae.has(e.type),u=!t&&oe.has(e.type),d=!t&&isGroupableType(e.type),f=!t&&e.type===`status`,p=isManagedSystemAttribute(e),m=r||i||p,h=!(t||m),ee=isRequiredForbidden(e.type)?`forbidden`:`allowed`,g=getDefaultValueCapability(e.type),_=supportsMaxItems(e),v=ie.has(e.type),y=!(!e.deprecated||t),b=resolveEditMode(e);return{lifecycle:{active:n,deprecated:!!e.deprecated,visibleInArchitect:!0,visibleInRuntime:!t,warningWhenDeprecated:y},storage:{mode:r?`computed`:a?`edge`:`value`,cardinality:o,edgeBacked:a,preservesExistingValues:!!e.archived,qualifiedProperties:supportsQualifiedProperties(e.type),polymorphic:getPolymorphicCapability(e),maxItems:_},authoring:{editable:h,readOnly:m,directEdit:h&&b===`inline`,required:ee,defaultValue:g,placeholder:v,maxItems:_},presentation:{formField:!t&&isFormFieldType(e.type),tableCell:!t&&isTableCellType(e.type),defaultColumn:!t&&isDefaultColumnType(e.type),compactDisplay:!t,popoverEditor:!t&&b===`popover`,placeholder:v,warningWhenDeprecated:y},query:{filterable:c,searchable:l,sortable:u,groupable:d,kanbanGroupable:f,operators:s},agent:{readable:!t,writable:h&&!i,compactReadable:!t,contentReadable:!t&&isContentReadableType(e.type),requiresDedicatedTool:i},exchange:{importable:!t,exportable:!t,schemaExportable:!0,metadataExportable:!1}}}function getAttributeFilterOperators(e){return getAttributeCapabilities(e).query.operators}function isAttributeFilterable(e){return getAttributeCapabilities(e).query.filterable}function isAttributeSearchable(e){return getAttributeCapabilities(e).query.searchable}function isAttributeSortable$1(e){return getAttributeCapabilities(e).query.sortable}function isAttributeGroupable(e){return getAttributeCapabilities(e).query.groupable}function isAttributeKanbanGroupable(e){return getAttributeCapabilities(e).query.kanbanGroupable}function resolveEffectiveFilterType(e){if(e.type!==`rollup`)return e.type;let t=e;if(t.function===`earliest`||t.function===`latest`)return`date`;if(t.function===`original`){let e=t.targetAttributeType;if(e&&hasFilterOperatorEntry(e))return e}return`number`}function getRollupFilterOperators$1(e){let t=resolveEffectiveFilterType(e);return hasFilterOperatorEntry(t)?b[t]:b.number}function getRawFilterOperators(e){return e.type===`rollup`?getRollupFilterOperators$1(e):b[e.type]??[]}function getAttributeCardinality(e){return e.type===`multiselect`||e.type===`document`||e.type===`user`&&e.multiple===!0||e.type===`relation`&&e.cardinality===`many`?`many`:`one`}function getPolymorphicCapability(e){if(e.type!==`relation`)return`none`;let t=e.targets??[];return t.length===1&&t[0]?.object===`*`?`internal`:t.length>1?`code-only`:`none`}function supportsMaxItems(e){return e.type===`multiselect`||e.type===`relation`&&e.cardinality===`many`}function supportsQualifiedProperties(e){return e===`relation`||e===`document`}function isRequiredForbidden(e){return e===`checkbox`||e===`formula`||e===`rollup`}function getDefaultValueCapability(e){return e===`checkbox`?`automatic`:e===`formula`||e===`rollup`?`forbidden`:re.has(e)?`static`:`forbidden`}function isDefaultColumnType(e){return isTableCellType(e)}function isTableCellType(e){return e!==`richtext`&&e!==`document`}function isFormFieldType(e){return e!==`richtext`}function resolveEditMode(e){switch(e.type){case`checkbox`:return`inline`;case`number`:return e.renderAs===`rating`?`inline`:`default`;case`select`:case`multiselect`:return e.renderAs===`badges`?`inline`:`popover`;case`status`:case`relation`:case`user`:case`date`:return`popover`;default:return`default`}}function isGroupableType(e){return e===`status`||e===`currency`}function isContentReadableType(e){return e===`richtext`||e===`document`}function hasFilterOperatorEntry(e){return Object.prototype.hasOwnProperty.call(b,e)}const se=[`text`,`richtext`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`location`,`select`,`multiselect`,`user`,`relation`,`formula`,`rollup`,`document`],ce=`*`;function relationTargetsOf(e){return e.type!==`relation`||!Array.isArray(e.targets)?[]:e.targets.map(e=>e.object).filter(e=>e!==`*`)}function isUniversalRelation(e){return e.targets.length===1&&e.targets[0].object===`*`}function isBilateralRelation(e){return e.bilateral!==void 0}function inferInverseCardinality(e){return`many`}function isAttributeSortable(e){return isAttributeSortable$1(e)}const le=b,ue=[`is_empty`,`is_not_empty`];function isNoValueOperator(e){return ue.includes(e)}function getRollupFilterOperators(e){return getRollupFilterOperators$1(e)}const de=`__`;function parseQualifiedAttribute(e){let t=e.indexOf(`__`);return t<=0||t+2>=e.length?{kind:`scalar`,attribute:e}:{kind:`qualified`,root:e.slice(0,t),property:e.slice(t+2)}}function buildQualifiedAttribute(e,t){return`${e}__${t}`}const x=[`page`,`record`,`display`];function defineBlock(e){let t=Object.fromEntries(Object.entries(e.inputs).map(([e,t])=>[e,t.isOptional?t.schema.optional():t.schema]));return Object.freeze({name:e.name,label:e.label,icon:e.icon,family:e.family,contexts:Object.freeze([...e.contexts]),inputs:Object.freeze({...e.inputs}),...e.layout===void 0?{}:{layout:Object.freeze({...e.layout})},parameters:c.object(t).strict().superRefine((t,n)=>{let r=e.refine?.(t);r&&n.addIssue({code:`custom`,path:[r.input],message:r.message})}),...e.refine===void 0?{}:{refine:(t,n)=>e.refine?.(t,n)}})}function parseBlockParameters(e,t,n){let r=e.parameters.safeParse(structuredClone(t??{}));if(!r.success)throw i.fromZodErrors(r.error.issues.map(e=>({path:[...n,...e.path.map(String)],message:e.message})));return r.data}function blockObjectInputs(e,t,n){return Object.entries(e.inputs).flatMap(([e,r])=>{let i=t[e];if(r.kind===`object`&&typeof i==`string`)return[i];if(r.kind===`query`&&typeof i==`object`&&i){let e=i.source;if(!e)return[];if(`object`in e&&typeof e.object==`string`)return[e.object];let t=n?.attributes.find(t=>t.name===e.relation);return t?relationTargetsOf(t):[]}return[]})}const fe=/^\d{4}-\d{2}-\d{2}$/u;function isCalendarDay(e){if(!fe.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function isDynamicValue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`dynamic`in e}function currentActor(){return{dynamic:`actor`,ref:`current`}}function today(){return{dynamic:`date`,anchor:`today`}}function now(){return{dynamic:`date`,anchor:`now`}}function toAmount(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:null}return null}function extractCurrencyFilterValue(e){return typeof e==`object`&&e?`value`in e?toAmount(e.value):null:toAmount(e)}function extractFilterValue(e){return e==null?null:typeof e==`object`&&`value`in e?e.value??null:e}const pe=new Set([`is_not`,`not_contains`,`none_of`,`is_empty`]),me={is_not:`is`,not_contains:`contains`,none_of:`any_of`,is_empty:`is_not_empty`};function getOperatorPolarity(e){return pe.has(e)?`none`:`any`}function normalizeForEdgeRpc(e){return me[e]??e}const S={is:`any_of`,is_not:`none_of`};function toMultiValueOperator(e){return S[e]??e}const he=new Set(Object.values(S).filter(e=>e!==void 0));function isSetMembershipOperator(e){return he.has(e)}function canonicalizeFilterValue(e,t){let n=e.value;if(isNoValueOperator(e.operator)||n==null||isDynamicValue(n))return;if(isSetMembershipOperator(e.operator)){Array.isArray(n)||(e.value=[n]);return}if(t!==`currency`)return;let r=extractCurrencyFilterValue(n);if(r!==null){e.value=r;return}if(!hasCurrencyAmount(n))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(n)}`;throw new i(a,[{path:[`value`],message:a}])}function hasCurrencyAmount(e){return typeof e!=`object`||`value`in e&&e.value!=null}const C=b.text,ge=[`is`,`is_not`,`is_empty`,`is_not_empty`],w=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],T={id:w,objectId:w,tenantId:w,label:b.text,createdAt:b.date,updatedAt:b.date,deletedAt:b.date,createdBy:b.user,lastUpdatedBy:b.user},_e=new Set([`createdAt`,`updatedAt`,`deletedAt`]);function offeredOn(e,t){return _e.has(e)?t.filter(e=>e!==`on_day_month`):t}function fullyOffered(e,t,n,r){return{target:e,attribute:t,...r?{property:r}:{},operators:n,offered:n}}function attributeFilterTarget(e){let t=getAttributeFilterOperators(e);return{target:e.name,attribute:e.name,operators:t,offered:offeredOn(e.name,t)}}function locationPartFilterTarget(e,t){return{target:buildQualifiedAttribute(e,t),attribute:e,property:t,operators:C,offered:t===`country`?ge:C}}function edgePropertyFilterTarget(e,t){let n=hasOperatorEntry(t.type)?b[t.type]:[];return fullyOffered(buildQualifiedAttribute(e,t.name),e,n,t.name)}function hasOperatorEntry(e){return Object.prototype.hasOwnProperty.call(b,e)}function systemColumnFilterTarget(e){let t=Object.prototype.hasOwnProperty.call(T,e)?T[e]:void 0;return t?{target:e,attribute:e,operators:t,offered:offeredOn(e,t)}:void 0}function filterOperatorsOfType(e){return isAttributeType(e)?getAttributeFilterOperators({type:e}):[]}function isAttributeType(e){return se.includes(e)}function isLocationPartOperator(e){return C.includes(e)}function carriesEdgeProperties(e){return e.type===`relation`||e.type===`document`}function filterTargetsOf(e){let t=[];for(let n of e){if(n.type===`location`){for(let e of y)t.push(locationPartFilterTarget(n.name,e));continue}if(t.push(attributeFilterTarget(n)),!carriesEdgeProperties(n))continue;let e=n.properties?.definitions;for(let r of e??[])t.push(edgePropertyFilterTarget(n.name,r))}let n=new Set(e.map(e=>e.name));for(let e of Object.keys(T)){if(n.has(e))continue;let r=systemColumnFilterTarget(e);r&&t.push(r)}return t.filter(e=>e.operators.length>0)}const ve={eq:`is`,equals:`is`,equal:`is`,"==":`is`,"=":`is`,neq:`is_not`,notEqual:`is_not`,isNot:`is_not`,"!=":`is_not`,"<>":`is_not`,lt:`less_than`,"<":`less_than`,gt:`greater_than`,">":`greater_than`,lte:`less_or_equal`,"<=":`less_or_equal`,gte:`greater_or_equal`,">=":`greater_or_equal`,in:`any_of`,isAnyOf:`any_of`,anyOf:`any_of`,oneOf:`any_of`,notIn:`none_of`,not_in:`none_of`,isNoneOf:`none_of`,noneOf:`none_of`,notOneOf:`none_of`,startsWith:`starts_with`,beginsWith:`starts_with`,endsWith:`ends_with`,doesNotContain:`not_contains`,notContain:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`};function normalizeOperator(e){return ve[e]??e}function normalizeFilterRule(e){let t=normalizeOperator(e.operator);return t===e.operator?e:{...e,operator:t}}const E=864e5,ye=new Set([`days`,`weeks`,`months`,`years`]),be=new Set([`past`,`future`]);function isRelativeDateValue(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.unit==`string`&&ye.has(t.unit)&&typeof t.direction==`string`&&be.has(t.direction)}function utcDayStart(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function shiftUtcDay(e,t,n){if(n===`days`)return e+t*E;if(n===`weeks`)return e+t*7*E;let r=new Date(e),i=r.getUTCFullYear()+(n===`years`?t:0),a=r.getUTCMonth()+(n===`months`?t:0),o=new Date(Date.UTC(i,a+1,0)).getUTCDate();return Date.UTC(i,a,Math.min(r.getUTCDate(),o))}function resolveIsWithinBounds(e,t=new Date){if(!isRelativeDateValue(e))return null;let n=utcDayStart(t),r=Math.trunc(e.amount),i=e.direction===`past`?{startMs:shiftUtcDay(n,-r,e.unit),endMs:n+E}:{startMs:n,endMs:shiftUtcDay(n,r,e.unit)+E};return Number.isFinite(i.startMs)&&Number.isFinite(i.endMs)?i:null}function resolveUtcDayBounds(e){if(!Number.isFinite(e))return null;let t=utcDayStart(new Date(e));return Number.isFinite(t)?{startMs:t,endMs:t+E}:null}function toUtcDayString(e){return new Date(e).toISOString().slice(0,10)}const D=new Set([`relation`,`document`,`user`]),xe={id:`text`,objectId:`text`,objectName:`text`,tenantId:`text`,label:`text`,createdAt:`date`,updatedAt:`date`,deletedAt:`date`,deletedBy:`user`,createdBy:`user`,lastUpdatedBy:`user`,visibility:`select`,ownedBy:`user`},O={before:`"less_than"`,after:`"greater_than"`,on_or_before:`"less_or_equal"`,on_or_after:`"greater_or_equal"`,is_checked:`"is" with value true`,is_not_checked:`"is" with value false`,day_month_eq:`"on_day_month"`},Se=new Set(Object.entries(b).filter(([,e])=>e.includes(`any_of`)&&!e.includes(`contains`)).map(([e])=>e)),Ce={contains:`any_of`,not_contains:`none_of`};function resolveCanonicalOperator(e,t){let n=O[e];if(n){let t=`Unknown filter operator "${e}" — use ${n}`;throw new i(t,[{path:[`operator`],message:t}])}let r=normalizeOperator(e),a=Ce[r];if(a&&Se.has(t)){let e=`Operator "${r}" is not valid for type "${t}" — use "${a}"`;throw new i(e,[{path:[`operator`],message:e}])}return r}function assertPropertyOperator(e,t,n){let r=resolveCanonicalOperator(e,t);if(!n.includes(r)){let r=`Operator "${e}" is not valid for property type "${t}". Valid operators: ${n.length?n.join(`, `):`(no operators registered for this type)`}.`;throw new i(r,[{path:[`operator`],message:r}])}return r}function assertRelativeDateValue(e){if(e.operator===`is_within`&&!isRelativeDateValue(e.value)){let e=`Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;throw new i(e,[{path:[`value`],message:e}])}}const we=/^(\d{4}-\d{2}-\d{2})(?:[T ](?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:(?:0\d|1[0-3])(?::[0-5]\d)?|14(?::00)?))?)?$/,Te=new Set([`is`,`is_not`,`less_than`,`less_or_equal`,`greater_than`,`greater_or_equal`]);function assertAbsoluteDateValue(e,t){if(t!==`date`||!Te.has(e.operator))return;let n=e.value;if(n==null||isDynamicValue(n)||typeof n==`string`&&isCastableDay(n))return;let r=`Filter on a date attribute expected a YYYY-MM-DD day, optionally followed by a time, received ${JSON.stringify(n)}`;throw new i(r,[{path:[`value`],message:r}])}function isCastableDay(e){let t=we.exec(e)?.[1];return!t||t.startsWith(`0000-`)?!1:isCalendarDay(t)}function resolveComparandType(e){return e.type===`formula`&&e.returnType===`date`?`date`:resolveEffectiveFilterType(e)}function applyCanonicalForm(e,t,n){e.operator=t,canonicalizeFilterValue(e,n),assertRelativeDateValue(e),assertAbsoluteDateValue(e,n)}function assertDynamicValueForAttribute(e,t){if(!isDynamicValue(e.value))return;let n=e.value;if(n.dynamic===`actor`&&t!==`user`){let e=`actor token (@me) is only valid on user attributes, not "${t}"`;throw new i(e,[{path:[`value`],message:e}])}if(n.dynamic===`date`&&t!==`date`){let e=`date token (@today/@now) is only valid on date attributes, not "${t}"`;throw new i(e,[{path:[`value`],message:e}])}}const k=y.map(e=>`"${e}"`).join(`, `);function operatorList(e){return e.length?e.join(`, `):`(not filterable)`}function qualifyWithSchema(e){if(D.has(e.type))return e.properties}function locationPartsHint(e){return e===`location`?` A location is filtered on one of its parts: set "property" to one of ${k} and use a text operator (e.g. contains).`:``}function dottedPathHint(e,t,n){let r=` Dotted paths are not supported — `;if(n.type===`location`)return`${r}set "attribute" to "${e}" and "property" to ${isLocationFilterProperty(t)?`"${t}"`:`one of ${k}`}.`;let i=qualifyWithSchema(n);if(i){let n=i.definitions.map(e=>`"${e.name}"`).join(`, `);return`${r}set "attribute" to "${e}" and "property" to ${i.definitions.some(e=>e.name===t)?`"${t}"`:`one of ${n}`} to filter on the edge property.`}let a=attributeFilterTarget(n).operators;return`${r}${a.length?`set "attribute" to "${e}" and use one of ${a.join(`, `)}`:`"${e}" is not filterable`}; the full-text "query" parameter matches tokens by relevance, not values.`}function collectQualifiedRuleIssues(e,t){try{return validateQualifiedRule({...e},t),[]}catch(e){if(!(e instanceof i))throw e;return e.errors.map(e=>({...e,path:[...e.path]}))}}function validateQualifiedRule(e,t){if(typeof e.attribute!=`string`){let e=`A filter rule needs an attribute: filters are one combinator and a flat list of rules`;throw new i(e,[{path:[`attribute`],message:e}])}let n=t.attributes.find(t=>t.name===e.attribute),r=n?[]:systemColumnFilterTarget(e.attribute)?.operators??[];if(!n&&r.length===0){let[n,...r]=e.attribute.split(`.`),a=r.length>0?t.attributes.find(e=>e.name===n):void 0,o=a?dottedPathHint(n??``,r[0]??``,a):e.attribute.includes(`.`)?` Dotted paths are not supported — filter on the attribute name alone with a structured operator (contains, any_of, …); the full-text "query" parameter matches tokens by relevance, not values.`:``,s=`Unknown attribute: ${e.attribute}${o}`;throw new i(s,[{path:[`attribute`],message:s}])}if(e.quantifier!==void 0&&!e.property){let e=`quantifier is only valid on qualified edge rules (set "property")`;throw new i(e,[{path:[`quantifier`],message:e}])}if(!n){if(e.property)throw new i(`Cannot qualify system attribute "${e.attribute}"`,[{path:[`property`],message:`"${e.attribute}" is a system column, not a reference`}]);let t=xe[e.attribute]??`text`,n=resolveCanonicalOperator(e.operator,t);if(!r.includes(n)){let t=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${r.join(`, `)}.`;throw new i(t,[{path:[`operator`],message:t}])}applyCanonicalForm(e,n,t);return}if(!e.property){assertDynamicValueForAttribute(e,n.type);let t=attributeFilterTarget(n).operators,r=resolveCanonicalOperator(e.operator,n.type);if(!t.includes(r)){let r=`Operator "${e.operator}" is not valid for attribute "${n.name}". Valid operators: ${operatorList(t)}.${locationPartsHint(n.type)}`;throw new i(r,[{path:[`operator`],message:r}])}applyCanonicalForm(e,r,resolveComparandType(n));return}if(n.type===`location`){if(e.quantifier!==void 0){let e=`quantifier is not valid on a location part — a location is one value, not a set of edges`;throw new i(e,[{path:[`quantifier`],message:e}])}if(!isLocationFilterProperty(e.property)){let t=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${k}.`;throw new i(t,[{path:[`property`],message:t}])}assertDynamicValueForAttribute(e,`text`);let{operators:t}=locationPartFilterTarget(n.name,e.property);applyCanonicalForm(e,assertPropertyOperator(e.operator,`text`,t),`text`);return}if(!D.has(n.type))throw new i(`Cannot qualify ${n.type} attribute "${e.attribute}"`,[{path:[`property`],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=n.properties;if(!a)throw new i(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:[`property`],message:`"${e.attribute}" has no qualifyWith`}]);let o=a.definitions.find(t=>t.name===e.property);if(!o)throw new i(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:[`property`],message:`Unknown property: ${e.property}`}]);let{operators:s}=edgePropertyFilterTarget(n.name,o);applyCanonicalForm(e,assertPropertyOperator(e.operator,o.type,s),o.type)}const Ee=c.array(c.string()).max(o.columnsPerTab),De=c.array(c.string().min(1)).max(o.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:`Displayed attribute names must be unique`}),Oe=c.object({attribute:c.string().describe(`Attribute to sort by`),direction:c.enum([`asc`,`desc`]).describe(`asc or desc`)}).strict(),A=c.array(Oe).max(o.sortsPerTab),ke=c.object({amount:c.number().describe(`Count`),unit:c.enum([`days`,`weeks`,`months`,`years`]).describe(`Unit`),direction:c.enum([`past`,`future`]).describe(`Past or future`)}).strict(),Ae=c.object({value:c.number().nullable().describe(`Amount`),code:c.array(c.string()).optional().describe(`Currency codes`)}).strict(),je=c.object({phoneNumber:c.string().nullable().describe(`Number`),countryCode:c.string().optional().describe(`ISO country code`)}).strict(),Me=c.discriminatedUnion(`dynamic`,[c.object({dynamic:c.literal(`actor`).describe(`Resolved at filter time`),ref:c.literal(`current`).describe(`The current actor`)}).strict(),c.object({dynamic:c.literal(`date`).describe(`Resolved at filter time`),anchor:c.enum([`today`,`now`]).describe(`Anchor`)}).strict()]),Ne=c.object({month:c.number().describe(`1-12`),day:c.number().describe(`Day`)}).strict(),Pe=c.union([c.string(),c.number(),c.boolean(),c.array(c.string()),ke,Ae,je,Ne,Me,c.null()]),Fe=c.enum([`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`any_of`,`none_of`],{error:e=>{let t=e.input,n=typeof t==`string`?O[t]:void 0;return n?`Unknown filter operator "${t}" — use ${n}`:void 0}}),Ie=c.object({attribute:c.string().describe(`Attribute to filter on`),property:c.string().optional().describe(`Qualified edge property`),quantifier:c.enum([`any`,`none`]).optional().describe(`For a multi-value attribute`),operator:Fe.describe(`Comparison`),value:Pe.describe(`Comparison value, by attribute type`)}).strict(),Le=c.array(Ie).max(o.filterRulesPerTab),j=c.object({combinator:c.enum([`and`,`or`]).describe(`Match every rule or any rule`),rules:Le.describe(`The rules`)}).strict(),M=c.object({object:c.string().optional().describe(`Every record of this object`),relation:c.string().optional().describe(`Records linked through this relation`)}).strict().superRefine((e,t)=>{e.object===void 0&&e.relation===void 0&&t.addIssue({code:`custom`,message:`Collection source must define an object, a relation, or both`})}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),Re=c.object({source:M,filters:j.optional(),sorts:A.optional(),limit:c.number().int().nonnegative().optional()}).strict();var RecordQuery=class{constructor(e){this.state=e}with(e){return new this.constructor({...this.state,...e})}rule(e,t,n){return this.with({rules:[...this.state.rules,{attribute:e,operator:t,value:n}]})}eq(e,t){return this.rule(e,`is`,t)}neq(e,t){return this.rule(e,`is_not`,t)}gt(e,t){return this.rule(e,`greater_than`,t)}gte(e,t){return this.rule(e,`greater_or_equal`,t)}lt(e,t){return this.rule(e,`less_than`,t)}lte(e,t){return this.rule(e,`less_or_equal`,t)}contains(e,t){return this.rule(e,`contains`,t)}notContains(e,t){return this.rule(e,`not_contains`,t)}startsWith(e,t){return this.rule(e,`starts_with`,t)}endsWith(e,t){return this.rule(e,`ends_with`,t)}in(e,t){return this.rule(e,`any_of`,t)}notIn(e,t){return this.rule(e,`none_of`,t)}isEmpty(e){return this.rule(e,`is_empty`,null)}isNotEmpty(e){return this.rule(e,`is_not_empty`,null)}where(...e){return this.with({rules:[...this.state.rules,...e.map(e=>({...e}))]})}or(){return this.with({combinator:`or`})}orderBy(e,t=`asc`){return this.with({sorts:[...this.state.sorts,{attribute:e,direction:t}]})}limit(e){return this.with({limit:e})}offset(e){return this.with({offset:e})}search(e){return this.with({search:e})}related(e){return this.with({scope:{kind:`related`,relation:e}})}relatedFrom(e){return this.with({scope:{kind:`relatedFrom`,relation:e}})}toDefinition(){let{object:e,scope:t,rules:n,combinator:r,sorts:i,limit:a}=this.state;return{source:t?.kind===`related`?{relation:t.relation}:t?.kind===`relatedFrom`?{object:e,relation:t.relation}:{object:e},...n.length>0?{filters:{combinator:r,rules:n.map(e=>({...e}))}}:{},...i.length>0?{sorts:i.map(e=>({...e}))}:{},...a===void 0?{}:{limit:a}}}};function query(e){return new RecordQuery({object:typeof e==`string`?e:e.build().name,combinator:`and`,rules:[],sorts:[]})}const N=[`day`,`week`,`month`,`quarter`,`year`],P=`$query`,ze=`$record`;function createInput(e){return Object.freeze({...e,optional:()=>createInput({...e,isOptional:!0}),inSection:t=>createInput({...e,section:t}),showWhen:(t,n)=>createInput({...e,when:{key:t,...n}}),many:()=>createInput({...e,isMany:!0,schema:c.array(e.schema).min(1)})})}function objectNameOf(e){return e===void 0||typeof e==`string`?e:e.build().name}function scalar(e,t,n){return createInput({kind:e,of:objectNameOf(n),isOptional:!1,isMany:!1,schema:t})}function name(){return c.string().min(1)}const F={object:e=>scalar(`object`,name(),e),attribute:(e,t)=>createInput({kind:`attribute`,of:objectNameOf(e),options:t,isOptional:!1,isMany:!1,schema:name()}),query:e=>scalar(`query`,Re,e),record:e=>scalar(`record`,name(),e),agent:()=>scalar(`agent`,name()),routine:()=>scalar(`routine`,name()),view:()=>scalar(`view`,name()),url:()=>scalar(`url`,c.url().refine(e=>/^https?:\/\//.test(e),`Only http(s) links`)),emailCategory:()=>scalar(`emailCategory`,name()),enum:e=>createInput({kind:`enum`,isOptional:!1,isMany:!1,schema:c.enum(e)}),text:()=>scalar(`text`,name()),number:()=>scalar(`number`,c.number()),boolean:()=>scalar(`boolean`,c.boolean()),period:()=>scalar(`period`,c.enum(N))},I={size:{w:4,h:4},minWidth:3,height:`flexible`,minHeight:3,maxHeight:10},L=defineBlock({name:`artifact_preview`,label:`Preview`,icon:`eye`,family:`context`,contexts:[`record`],layout:{size:{w:6,h:8},minWidth:4,height:`flexible`,minHeight:4,maxHeight:20},inputs:{}}),R=[`number`,`currency`],z=[`status`,`select`,`user`,`relation`,`date`],B=[`bar`,`horizontal_bar`,`line`,`area`,`donut`,`funnel`,`treemap`,`calendar`];function measureIssue({measure:e,attribute:t}){return e===`count`?t===void 0?void 0:{input:`attribute`,message:`count measures records; it takes no attribute`}:t===void 0?{input:`attribute`,message:`${String(e)} needs a number or currency attribute`}:void 0}function requires(e,t,n){return e[t]!==void 0&&e[n]===void 0?{input:t,message:`${t} needs ${n}`}:void 0}function together(e,t,n){return requires(e,t,n)??requires(e,n,t)}function kindIssue(e){let{kind:t,by:n,byBucket:r,by2:i,measure:a}=e;if(i!==void 0&&i===n)return{input:`by2`,message:`by2 must differ from by`};if((t===`donut`||t===`funnel`)&&i!==void 0)return{input:`kind`,message:`a ${String(t)} splits one grouping (by), and no second`};if(t===`funnel`&&a!==`count`&&a!==`sum`)return{input:`kind`,message:`a funnel adds stages up: its measure is count or sum`};if(t===`area`&&i===void 0)return{input:`kind`,message:`an area stacks a second grouping (by2); one series is a line`};if(t===`treemap`&&(n===void 0||i!==void 0))return{input:`kind`,message:`a treemap needs one grouping (by), and no second`};if(t===`calendar`&&(r!==`day`||i!==void 0))return{input:`kind`,message:`a calendar needs a date grouping by day, and no second`}}function measuredInputs(){return{query:F.query(),measure:F.enum(e).inSection(`data`),attribute:F.attribute(P,{types:R}).optional().showWhen(`measure`,{not:[`count`]}),label:F.text().optional()}}function metricComparePeriod(e){if(e.period)return e.period;if(!e.trendBucket)return`month`;let t=N.indexOf(e.trendBucket);return N[Math.min(t+1,N.length-1)]??`month`}function comparedSpanIssue(e){let{trendBucket:t,compare:n}=e;if(n===void 0||typeof t!=`string`)return;let r=t;if(r===N.at(-1))return{input:`compare`,message:`compare needs a trendBucket finer than year`};let i=metricComparePeriod({trendBucket:r,period:e.period});return N.indexOf(i)>N.indexOf(r)?void 0:{input:`period`,message:`period must be wider than trendBucket (unset, it is one step above)`}}const V=defineBlock({name:`metric`,label:`Indicateur`,icon:`trending-up`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:3,h:2},minWidth:3,height:`fit`,maxHeight:4,figure:!0},inputs:{...measuredInputs(),trend:F.attribute(P,{types:[`date`]}).optional().inSection(`display`),trendBucket:F.period().optional().showWhen(`trend`),compare:F.enum([`previous_period`]).optional(),period:F.period().optional().showWhen(`compare`),target:F.number().optional()},refine:e=>measureIssue(e)??together(e,`trend`,`trendBucket`)??requires(e,`period`,`compare`)??comparedSpanIssue(e)??(e.target!==void 0&&e.target<=0?{input:`target`,message:`target must be above zero`}:void 0)}),H=defineBlock({name:`chart`,label:`Graphique`,icon:`chart-bar`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:4,h:6},minWidth:4,height:`flexible`,minHeight:4,maxHeight:12},inputs:{...measuredInputs(),kind:F.enum(B),by:F.attribute(P,{types:z}).optional(),byBucket:F.period().optional().inSection(`data`).showWhen(`by`),by2:F.attribute(P,{types:z}).optional().showWhen(`by`),by2Bucket:F.period().optional().inSection(`data`).showWhen(`by2`)},refine:e=>measureIssue(e)??requires(e,`byBucket`,`by`)??requires(e,`by2`,`by`)??requires(e,`by2Bucket`,`by2`)??kindIssue(e)}),U=defineBlock({name:`agenda`,label:`Agenda`,icon:`calendar`,family:`data`,contexts:[`page`,`record`,`display`],layout:I,inputs:{query:F.query(),attribute:F.attribute(P,{types:[`date`]}),next:F.number().optional(),yearly:F.boolean().optional(),label:F.text().optional()}}),W=defineBlock({name:`card`,label:`Fiche`,icon:`user-square`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:4,h:4},minWidth:3,height:`fit`,maxHeight:10},inputs:{object:F.object().optional(),record:F.record().optional(),fields:F.attribute(ze).many().optional()},refine:(e,t)=>requires(e,`record`,`object`)??(t===`page`&&e.record===void 0?{input:`record`,message:`A card outside a record shows a chosen record: content.card(object).record(id)`}:void 0)}),G=defineBlock({name:`text_block`,label:`Texte`,icon:`type-text`,family:`layout`,contexts:[`page`,`record`,`display`],layout:{size:{w:12,h:2},minWidth:3,height:`fit`,maxHeight:16},inputs:{markdown:F.text()}}),K=defineBlock({name:`heading`,label:`Titre`,icon:`type-text`,family:`layout`,contexts:[`page`,`record`],layout:{size:{w:12,h:1},minWidth:6,height:`fit`,maxHeight:3},inputs:{title:F.text(),description:F.text().optional(),icon:F.text().optional()}}),Be=defineBlock({name:`inbox`,label:`Boîte de réception`,icon:`inbox`,family:`people`,contexts:[`page`],layout:I,inputs:{kinds:F.enum(t).inSection(`data`).many().optional(),limit:F.number().optional()}}),Ve=defineBlock({name:`meetings_upcoming`,label:`Réunions à venir`,icon:`video`,family:`people`,contexts:[`page`],layout:I,inputs:{limit:F.number().optional()},refine:({limit:e})=>e===void 0||Number.isInteger(e)&&e>=1&&e<=50?void 0:{input:`limit`,message:`limit is a whole number from 1 to 50`}}),He=defineBlock({name:`mailbox`,label:`E-mails`,icon:`envelope`,family:`people`,contexts:[`page`],layout:I,inputs:{category:F.emailCategory().optional(),important:F.boolean().optional().inSection(`data`),unread:F.boolean().optional().inSection(`data`),limit:F.number().optional(),label:F.text().optional()},refine:({limit:e})=>e===void 0||Number.isInteger(e)&&e>=1&&e<=50?void 0:{input:`limit`,message:`limit is a whole number from 1 to 50`}}),q=defineBlock({name:`record_links`,label:`Bubble`,icon:`share`,family:`context`,contexts:[`record`,`page`],layout:{size:{w:6,h:8},minWidth:6,height:`flexible`,minHeight:6,maxHeight:16},inputs:{center:F.enum([`record`,`me`]).optional().inSection(`data`),object:F.object().optional(),record:F.record().optional(),depth:F.enum([`1`,`2`,`3`,`4`,`5`]).optional()},refine:(e,t)=>requires(e,`record`,`object`)??(t===`page`&&e.center!==`me`&&e.record===void 0?{input:`record`,message:`Links outside a record centre on a chosen record or on the viewer: { object, record } or { center: "me" }`}:void 0)}),Ue={name:`bubble`,type:`custom`,extension:q.name,placement:`main`,label:q.label,icon:q.icon,parameters:{}},J=defineBlock({name:`record_memory`,label:`Memories`,icon:`database`,family:`context`,contexts:[`record`],layout:{size:{w:6,h:8},minWidth:4,height:`flexible`,minHeight:4,maxHeight:16},inputs:{}}),We={name:`memories`,type:`custom`,extension:J.name,placement:`main`,label:J.label,icon:J.icon,parameters:{}},Ge=[L,V,H,U,W,G,K,Be,Ve,He,q,J],Ke=new Set([`name`,`label`,`icon`,`family`,`contexts`,`inputs`,`parameters`,`layout`,`refine`]),qe=Ge;var ContentExtensionRegistry=class{constructor(){this.extensions=new Map,this.seed()}register(e){let t=Array.isArray(e)?e:[e],r=new Set;t.forEach((e,t)=>{if(this.prepare(e,t),r.has(e.name))throw new n(`content extension`,e.name);r.add(e.name)});for(let e of t)this.extensions.set(e.name,e);return this}prepare(e,t){let r=[`extensions`,String(t)],reject=e=>{throw new i(e,[{path:r,message:e}])};if((typeof e!=`object`||!e||Array.isArray(e))&&reject(`Expected a content extension declaration`),Object.keys(e).some(e=>!Ke.has(e))&&reject(`Expected only ${[...Ke].join(`, `)}`),(typeof e.name!=`string`||e.name.trim().length===0)&&reject(`API name must not be empty`),(!Array.isArray(e.contexts)||e.contexts.length===0||e.contexts.some(e=>!x.includes(e)))&&reject(`contexts must be a non-empty list of ${x.join(`, `)}`),typeof e.parameters?.safeParse!=`function`&&reject(`parameters must be a Zod schema`),this.extensions.has(e.name))throw new n(`content extension`,e.name)}get(e){return this.extensions.get(e)}has(e){return this.extensions.has(e)}getAll(){return[...this.extensions.values()]}get size(){return this.extensions.size}clear(){this.extensions.clear(),this.seed()}seed(){for(let e of qe)this.extensions.set(e.name,e)}};const Je=new ContentExtensionRegistry,Ye=12,Y=[3,4,6,8,9,12];function overlaps(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function findGridViolation(e,t={}){let n=Object.entries(e);for(let[e,{x:t,y:r,w:i,h:a}]of n){if(![t,r,i,a].every(Number.isInteger))return{path:[e],message:`Block "${e}" needs integer grid coordinates`};if(t<0||r<0||i<1||a<1)return{path:[e],message:`Block "${e}" needs x >= 0, y >= 0, w >= 1 and h >= 1`};if(t+i>12)return{path:[e],message:`Block "${e}" overflows the 12-column grid (x + w = ${t+i})`}}let r=n.filter(([e])=>t.exempt?.has(e)!==!0);for(let[e,[t,n]]of r.entries())for(let[i,a]of r.slice(e+1))if(overlaps(n,a))return{path:[i],message:`Blocks "${t}" and "${i}" overlap`}}function groupedMembers(e){let t=new Set(e.filter(e=>e.type!==`group`).map(e=>e.name)),n=new Set;for(let r of e)if(r.type===`group`)for(let e of r.members)t.has(e)&&n.add(e);return n}function memberlessGroups(e){let t=new Set(e.filter(e=>e.type!==`group`).map(e=>e.name));return new Set(e.flatMap(e=>e.type===`group`&&!e.members.some(e=>t.has(e))?[e.name]:[]))}function groupSizeMessage(e){return e>=2&&e<=o.membersPerGroup?void 0:`A group holds 2 to ${o.membersPerGroup} blocks, not ${e}`}function findGroupViolation(e){let t=new Map(e.map(e=>[e.name,e])),n=new Map;for(let r of e)if(r.type===`group`)for(let e of r.members){let i=t.get(e);if(i===void 0)return{path:[r.name],message:`Group "${r.name}" names "${e}", which is not a content of this page`};if(i.type===`group`)return{path:[r.name],message:`Group "${r.name}" cannot hold the group "${e}"`};let a=n.get(e);if(a!==void 0)return{path:[r.name],message:a===r.name?`Group "${r.name}" names "${e}" twice`:`"${e}" already belongs to the group "${a}"`};n.set(e,r.name)}}function boundsOf(e){let{minHeight:t,maxHeight:n}=e;return t!==void 0&&n!==void 0?`${t} to ${n} rows`:t===void 0?`at most ${String(n)} rows`:`at least ${t} rows`}function findRowLimitViolation(e){let t=Object.entries(e).find(([,e])=>e.y+e.h>o.pageRows);if(t===void 0)return;let[n,r]=t;return{path:[n],message:`Block "${n}" ends at row ${r.y+r.h}, past the page's ${o.pageRows} rows`}}function cellViolation(e,t,n){if(!Y.includes(t.w))return{path:[e],message:`Block "${e}" width ${t.w} is not one of ${Y.join(`, `)}`};if(t.w<n.minWidth)return{path:[e],message:`Block "${e}" width ${t.w} is below its minimum width ${n.minWidth}`};if(n.height===`flexible`&&(n.minHeight!==void 0&&t.h<n.minHeight||n.maxHeight!==void 0&&t.h>n.maxHeight))return{path:[e],message:`Block "${e}" height ${t.h} is outside its bounds (${boundsOf(n)})`}}function sharesRows(e,t){return e.y<t.y+t.h&&t.y<e.y+e.h}function findLayoutRuleViolation(e,t,n,r=new Set){let i=findRowLimitViolation(e);if(i!==void 0)return i;let a=groupedMembers(t),o=Object.entries(e).filter(([e])=>!a.has(e));for(let[e,t]of o){if(r.has(e))continue;let i=cellViolation(e,t,n(e));if(i!==void 0)return i}let[s,c]=o.filter(([e])=>!r.has(e)&&n(e).height===`fill`);if(s!==void 0&&c!==void 0)return{path:[c[0]],message:`Only one block may fill the page: "${s[0]}" and "${c[0]}" both do`};if(s===void 0)return;let[l,u]=s,d=o.find(([e,t])=>e!==l&&sharesRows(t,u));if(d!==void 0)return{path:[l],message:`Block "${l}" fills the page and must be alone in its rows; "${d[0]}" shares them`}}function findRelationAttribute(e,t){return e.attributes.find(e=>e.name===t&&e.type===`relation`)}function relationAcceptsObject(e,t){return e.targets.some(e=>e.object===t||e.object===`*`)}function singleRelationTarget(e){let[t,...n]=e.targets;return t&&n.length===0&&t.object!==`*`?t.object:void 0}function requireSingleRelationTarget(e,t=[e.name,`targets`]){let n=singleRelationTarget(e);if(n===void 0){let n=`Relation "${e.name}" requires one concrete collection target`;throw new i(n,[{path:t,message:n}])}return n}function collectionSourceAddress(e){return e.relation===void 0?{kind:`object`,object:e.object}:e.object===void 0?{kind:`related`,relation:e.relation}:{kind:`relatedFrom`,object:e.object,relation:e.relation}}function collectionSourceAddressOf(e){if(!e||typeof e!=`object`)return;let t=`object`in e?e.object:void 0,n=`relation`in e?e.relation:void 0;if(typeof t==`string`&&typeof n==`string`)return{kind:`relatedFrom`,object:t,relation:n};if(typeof t==`string`&&n===void 0)return{kind:`object`,object:t};if(typeof n==`string`&&t===void 0)return{kind:`related`,relation:n}}function sourcedAttributeOf(e,t){if(t.type===`richtext`)return typeof t.attribute==`string`&&e!==void 0?{object:e,attribute:t.attribute}:void 0;if(t.type!==`collection`)return;let n=collectionSourceAddressOf(t.source);if(n?.kind===`related`)return e===void 0?void 0:{object:e,attribute:n.relation};if(n?.kind===`relatedFrom`)return{object:n.object,attribute:n.relation}}function requireRecordContentContext(e,t,n){if(t!==`record`){let r=`Content "${e}" requires record context. In ${t===`page`?`a standalone page`:`a collection view`} only a collection that lists a whole object, or a custom content that does not require a record, is allowed.`;throw new i(r,[{path:n,message:r}])}}function resolveContentNavigation(e){let t=e.openMode??`page`;return{openMode:t,createMode:e.createMode??t}}function resolveCollectionActions(e,t){return[...new Set(t)].filter(t=>e.actions===void 0||e.actions.includes(t))}const Xe={collection:[`page`,`record`,`display`],group:[`page`,`record`],form:[`record`],activity:[`record`],richtext:[`record`],documents:[`record`],forms:[`record`],emails:[`record`],meetings:[`record`]},X={collection:{size:{w:12,h:8},minWidth:6,height:`flexible`,minHeight:4,maxHeight:20},activity:{size:{w:12,h:8},minWidth:6,height:`flexible`},page:{size:{w:12,h:8},minWidth:6,height:`flexible`},group:{size:{w:6,h:4},minWidth:6,height:`flexible`}};function contentReadObjects(e,t,n){if(e.type!==`group`)return[...n(e)];let r=new Set;for(let i of e.members){let e=t.get(i);if(e!==void 0&&e.type!==`group`)for(let t of n(e))r.add(t)}return[...r]}function contentPlacementContexts(e,t){return e.type===`custom`?t?.contexts:e.type===`page`||e.type===`collection`&&collectionSourceAddress(e.source).kind!==`object`?[`record`]:Xe[e.type]}function requireContentPlacement(e,t,n,r,i){let a=contentPlacementContexts(e,t);a&&!a.includes(hostPlacementContext(r))&&(requireRecordContentContext(n,r,i),reject(i,`Content "${n}" cannot be placed in a record view or a record page`))}function hostPlacementContext(e){return e===`record`?`record`:`page`}function contentContextOf(e){return e.context===`page`&&e.object!==void 0?`record`:e.context}const Ze=new WeakSet;function violationOf(e,t,n,a){if(!(e instanceof r))throw e;let o=e instanceof i?e.errors[0]:void 0;return{key:JSON.stringify([t,n,e.code,Ze.has(e)?`Invalid content view`:e.message]),contentName:n,path:o?.path??a,message:e.message,code:e.code,error:e}}const Qe=new Map(getSystemAttributeList().map(e=>[e.name,e]));function reject(e,t){throw new i(t,[{path:e,message:t}])}function requireName(e,t){e.trim().length===0&&reject(t,`API name must not be empty`)}function indexUnique(e,t,r){let i=new Map;return e.forEach((e,a)=>{if(requireName(e.name,[...r,String(a),`name`]),i.has(e.name))throw new n(t,e.name);i.set(e.name,e)}),i}const $e=30;function capped(e,t){let n=e.slice(0,t).join(`, `);return e.length>t?`${n} … and ${e.length-t} more`:n}function attributeInventory(e,t){return t.length===0?`Object "${e}" has no attributes yet.`:`Attributes of "${e}": ${capped(t,30)}`}function requireAttribute(e,t,n,r,i){if(requireName(t,n),!e)return;let a=e.attributes?.get(t)??Qe.get(t);if(!a){if(!e.attributes)return;let r=attributeInventory(e.name,[...e.attributes.keys()]);reject(n,`Unknown attribute "${e.name}.${t}". ${r}${i?.()??``}`)}let o=r===void 0?[]:[r].flat();return o.length>0&&!o.includes(a.type)&&reject(n,`Attribute "${e.name}.${t}" must have type ${o.join(` or `)}`),a}function collectContentViewCatalogue(e,t=`authoring`){let r=e.mode??`published`,a=new Map;e.objects.forEach((e,t)=>{if(requireName(e.name,[`objects`,String(t),`name`]),a.has(e.name))throw new n(`object`,e.name);a.set(e.name,{name:e.name,attributes:indexUnique(e.attributes,`attribute`,[`objects`,String(t),`attributes`])})});let o=new Set;(e.reservedObjects??[]).forEach((e,t)=>{let n=[`reservedObjects`,String(t)];requireName(e,n),!a.has(e)&&(r!==`draft`&&reject(n,`Unresolved reserved object "${e}"`),o.add(e),a.set(e,{name:e}))});let s=indexUnique(e.extensions??[],`extension`,[`extensions`]);function resolveObject(e,t){requireName(e,t);let n=a.get(e);return n||reject(t,`Unknown object "${e}"`),n}function inverseAddresses(e){let t=[];for(let[n,r]of a)if(n!==e)for(let i of r.attributes?.values()??[])i.type===`relation`&&relationAcceptsObject(i,e)&&t.push(`relatedFrom("${n}", "${i.name}")`);return t.sort().slice(0,3)}let authoringSchemaWith=n=>r===`draft`?draftContentViewDefinitionSchemaFor():contentViewDefinitionSchemaFor({traits:t===`structural`?null:(e,t)=>layoutTraitsOf(e,s,t),viewerFiltered:e.viewerFiltered,...n===void 0?{}:{statics:n}}),c=authoringSchemaWith(),l=r===`draft`||t===`structural`?c:contentViewDefinitionSchemaFor({traits:null,viewerFiltered:e.viewerFiltered}),schemaFor=t=>{if(e.authoringViews!==void 0&&!e.authoringViews.has(t))return l;let n=e.staticsOf?.(t);return n===void 0||n.size===0?c:authoringSchemaWith(n)},u=new Map,d=new Map,f=[],p=[];function parseView(e,t,r){let a=schemaFor(r).safeParse(e);if(!a.success){let n=new i(invalidViewMessage(e,a.error.issues[0]),a.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message,code:e.code})));throw Ze.add(n),n}let o=a.data;requireName(o.name,[...t,`name`]);let s=o.object??``,c=u.get(s)??new Set;if(c.has(o.name))throw new n(`view`,`${s}.${o.name}`);if(c.add(o.name),u.set(s,c),o.context!==`page`&&o.default){let e=d.get(o.object)??new Set;if(e.has(o.context))throw new n(`default view`,`${o.object}.${o.context}`);e.add(o.context),d.set(o.object,e)}return o}return e.views.forEach((e,t)=>{let n=[`views`,String(t)],r=e,i=`${String(r?.object??`?`)}.${String(r?.name??t)}`,a,o;try{a=parseView(e,n,t),o=a.object===void 0?void 0:resolveObject(a.object,[...n,`object`])}catch(e){f.push(violationOf(e,i,null,n));return}a.contents.forEach((e,t)=>{let r=[...n,`contents`,String(t)];try{requireName(e.name,[...r,`name`]),validateContent(e,r,o,contentContextOf(a),s,resolveObject,inverseAddresses)}catch(t){f.push(violationOf(t,i,e.name,r))}}),p.push(a)}),p.forEach((t,n)=>{t.contents.forEach((r,a)=>{if(r.type!==`page`)return;let o=[`views`,String(n),`contents`,String(a),`page`],s=p.find(e=>e.context===`page`&&e.object===r.page.object&&e.name===r.page.name),c=t.context===`page`?`Content "${r.name}" cannot reference a page from a page`:t.object===r.page.object?s||e.complete!==!0?void 0:`Unknown page "${r.page.object}.${r.page.name}"`:`Content "${r.name}" must reference a page of "${String(t.object)}", not of "${r.page.object}"`;c!==void 0&&f.push(violationOf(new i(c,[{path:o,message:c}]),`${String(t.object)}.${t.name}`,r.name,o))})}),{views:p,unresolvedObjects:[...o].sort(),violations:f}}function validateStoredViews(e){let t=collectContentViewCatalogue(e,`structural`).violations[0];if(t)throw t.error}function describeViewIssue(e){let t=e.path.length>0?` (${e.path.map(String).join(`.`)})`:``;return`${e.message}${t}`}function invalidViewMessage(e,t){let n=typeof e==`object`&&e?e:{},r=typeof n.name==`string`?` "${n.name}"`:``,i=typeof n.object==`string`?` of "${n.object}"`:``;return t?`Invalid content view${r}${i}: ${describeViewIssue(t)}`:`Invalid content view${r}${i}`}function validateContentViewCatalogue(e){let{views:t,unresolvedObjects:n,violations:r}=collectContentViewCatalogue(e),i=r[0];if(i)throw i.error;return{views:t,unresolvedObjects:n}}function resolveStoredQuery(e,t,n,{owner:r,requireRecord:i,resolveObject:a,inverseAddresses:o}){let s=collectionSourceAddress(e.source),c,l;if(s.kind===`object`)c=a(s.object,[...t,`source`,`object`]);else if(s.kind===`related`){i();let e=[...t,`source`,`relation`],hint=()=>{if(!r)return``;let e=o(r.name);return e.length===0?``:`. Records pointing at "${r.name}" are addressed from the other side: ${e.join(`, `)}`},n=requireAttribute(r,s.relation,e,`relation`,hint);n?.type===`relation`&&(l=n,c=a(requireSingleRelationTarget(n,e),e))}else{i(),c=a(s.object,[...t,`source`,`object`]);let o=[...t,`source`,`relation`],l=requireAttribute(c,s.relation,o,`relation`);if(l?.type===`relation`&&r&&!relationAcceptsObject(l,r.name)){let e=l.targets.map(e=>`"${e.object}"`).join(`, `);reject(o,`Relation "${s.object}.${s.relation}" targets ${e}, not "${r.name}"`)}e.filters?.combinator===`or`&&reject([...t,`filters`,`combinator`],`${n} addresses "${s.object}" from the far side, so its filters must use the "and" combinator`)}return e.sorts?.forEach((e,n)=>requireAttribute(c,e.attribute,[...t,`sorts`,String(n),`attribute`])),e.filters?.rules.forEach((e,n)=>requireAttribute(c,e.attribute,[...t,`filters`,`rules`,String(n),`attribute`])),{target:c,relationAttribute:l}}function validateBlockReferences(e,t,n,r){let i=Object.entries(e.inputs),a;for(let[o,s]of i){let i=t[o];s.kind===`query`&&i!==void 0&&(a=resolveStoredQuery(i,[...n,o],`Block "${e.name}"`,r).target)}function attributeScope(o){if(o===void 0)return;if(o===`$query`)return a;if(o!==`$record`)return r.resolveObject(o,n);let s=i.find(([,e])=>e.kind===`object`)?.[0],c=s===void 0?void 0:t[s];return typeof c==`string`?r.resolveObject(c,[...n,s??`object`]):(r.owner||reject(n,`Block "${e.name}" names attributes, so it needs an object or a record host`),r.owner)}for(let[e,r]of i){let i=t[e];if(r.kind!==`attribute`||i===void 0)continue;let a=attributeScope(r.of);(Array.isArray(i)?i:[i]).forEach((t,o)=>{if(typeof t!=`string`)return;let s=Array.isArray(i)?[...n,e,String(o)]:[...n,e];requireAttribute(a,t,s,r.options?.types)})}for(let[r,a]of i){let i=a.when?.key,o=i===void 0?void 0:e.inputs[i],s=i===void 0?void 0:t[i];a.kind===`period`&&t[r]!==void 0&&o?.kind===`attribute`&&typeof s==`string`&&requireAttribute(attributeScope(o.of),s,[...n,i??r],[`date`])}}function validateContent(e,t,n,r,a,o,s){function requireRecord(){requireRecordContentContext(e.name,r,t)}let c={owner:n,requireRecord,resolveObject:o,inverseAddresses:s},l=hostPlacementContext(r);if(e.type===`custom`){let n=a.get(e.extension);n||reject([...t,`extension`],`Unknown extension "${e.extension}"`),contentPlacementContexts(e,n)?.includes(l)||reject([...t,`extension`],`${e.extension} cannot be placed here`);let r=n.parameters.safeParse(structuredClone(e.parameters??{}));if(!r.success)throw new i(`Invalid extension parameters`,r.error.issues.map(e=>({path:[...t,`parameters`,...e.path.map(String)],message:e.message,code:e.code})));let o=r.data,s=n.refine?.(o,l);s&&reject([...t,`parameters`,s.input],s.message),validateBlockReferences(n,o,[...t,`parameters`],c);return}if(requireContentPlacement(e,void 0,e.name,r,t),e.type!==`page`&&e.type!==`group`){if(e.type===`collection`){let{target:n,relationAttribute:r}=resolveStoredQuery(e,t,`Collection "${e.name}"`,c);e.columns?.forEach((e,i)=>{let a=[...t,`columns`,String(i)];if(typeof e==`string`){requireAttribute(n,e,a);return}let o=[...a,`relationProperty`];r||reject(o,`Relation property columns require a relation source`),r.properties?.definitions.some(t=>t.name===e.relationProperty)||reject(o,`Unknown relation property "${e.relationProperty}"`)}),e.displayAttributes?.forEach((e,r)=>requireAttribute(n,e,[...t,`displayAttributes`,String(r)])),e.descriptionAttribute!==void 0&&requireAttribute(n,e.descriptionAttribute,[...t,`descriptionAttribute`]),e.layout===`kanban`&&e.groupByAttribute!==void 0&&requireAttribute(n,e.groupByAttribute,[...t,`groupByAttribute`]);return}switch(e.type){case`form`:e.groups.forEach((e,r)=>{let i=[...t,`groups`,String(r)];requireName(e.name,[...i,`name`]),e.fields.forEach((e,t)=>requireAttribute(n,e.attribute,[...i,`fields`,String(t),`attribute`]))});break;case`richtext`:requireAttribute(n,e.attribute,[...t,`attribute`],`richtext`),e.titleAttribute!==void 0&&requireAttribute(n,e.titleAttribute,[...t,`titleAttribute`],`text`);break;case`emails`:case`meetings`:e.emailAttributes.forEach((e,r)=>requireAttribute(n,e,[...t,`emailAttributes`,String(r)],`text`));break;case`documents`:e.relations?.forEach((e,r)=>requireAttribute(n,e,[...t,`relations`,String(r)],`relation`));break;case`forms`:e.objectName!==void 0&&o(e.objectName,[...t,`objectName`]);break;case`activity`:break;default:reject(t,`Unknown content type: ${String(e)}`)}}}const Z=Object.freeze({size:Object.freeze({w:4,h:4}),minWidth:3,height:`flexible`,minHeight:2,figure:!1});function resolveLayout(e){return e===void 0?Z:{size:e.size??Z.size,minWidth:e.minWidth??Z.minWidth,height:e.height??Z.height,...e.minHeight===void 0?{}:{minHeight:e.minHeight},...e.maxHeight===void 0?{}:{maxHeight:e.maxHeight},figure:e.figure??!1}}function baseTraitsOf(e,t){return e.type===`custom`?resolveLayout(t.get(e.extension)?.layout):e.type in X?resolveLayout(X[e.type]):Z}function widthCovering(e){return Y.find(t=>t>=e)??12}function boundOf(e,t){let n=e.filter(e=>e!==void 0);return n.length===0?void 0:t(...n)}function groupTraitsOf(e){if(e.length===0)return resolveLayout(X.group);let sum=t=>e.reduce((e,n)=>e+t(n),0),t={w:widthCovering(sum(e=>e.size.w)),h:Math.max(...e.map(e=>e.size.h))},n=widthCovering(sum(e=>e.minWidth)),r=e.every(e=>e.figure);if(e.every(e=>e.height===`fit`)){let i=boundOf(e.map(e=>e.maxHeight),Math.max);return{size:t,minWidth:n,height:`fit`,...i===void 0?{}:{maxHeight:i},figure:r}}let i=e.filter(e=>e.height!==`fit`),a=boundOf(i.map(e=>e.minHeight),Math.max),o=boundOf(i.map(e=>e.maxHeight),Math.min),s=o===void 0?void 0:Math.max(o,a??o);return{size:t,minWidth:n,height:`flexible`,...a===void 0?{}:{minHeight:a},...s===void 0?{}:{maxHeight:s},figure:r}}function layoutTraitsOf(e,t,n){let r=e.type===`group`?groupTraitsOf(e.members.flatMap(e=>{let r=n?.get(e);return r===void 0||r.type===`group`?[]:[layoutTraitsOf(r,t)]})):baseTraitsOf(e,t);return e.height===void 0?r:{...r,height:e.height}}function pageTraitsOf(e,t){return n=>{let r=e.get(n);return r?layoutTraitsOf(r,t,e):Z}}const et=1e4;function isPlainJsonObject(e){let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null&&t.constructor?.name===`Object`}function addJsonIssue(e,t,n=[]){e.addIssue({code:`custom`,message:t,path:n})}function pushJsonArrayChildren(e,t,n,r){for(let n of Reflect.ownKeys(e))if(n!==`length`){if(n===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,[...t.path,n]);continue}(typeof n==`symbol`||!/^(0|[1-9]\d*)$/.test(n))&&addJsonIssue(r,`Arrays cannot contain non-index JSON properties`,[...t.path,n])}for(let i=e.length-1;i>=0;i--){let a=Object.getOwnPropertyDescriptor(e,String(i)),o=[...t.path,i];if(!(a&&`value`in a)){addJsonIssue(r,`Sparse arrays are not valid JSON values`,o);continue}n.push({kind:`enter`,value:a.value,path:o,depth:t.depth+1})}}function pushJsonObjectChildren(e,t,n,r){let i=Reflect.ownKeys(e);for(let a=i.length-1;a>=0;a--){let o=i[a],s=[...t.path,o];if(o===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,s);continue}if(typeof o==`symbol`){addJsonIssue(r,`Symbol keys are not valid JSON keys`,s);continue}let c=Object.getOwnPropertyDescriptor(e,o);if(!(c?.enumerable&&`value`in c)){addJsonIssue(r,`Custom props must contain enumerable data properties only`,s);continue}n.push({kind:`enter`,value:c.value,path:s,depth:t.depth+1})}}function validateJsonProps(e,t){if(typeof e!=`object`||!e){addJsonIssue(t,`Expected a plain JSON object`);return}try{if(Array.isArray(e)||!isPlainJsonObject(e)){addJsonIssue(t,`Expected a plain JSON object`);return}}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`);return}let n=new WeakSet,r=[{kind:`enter`,value:e,path:[],depth:0}],i=0;for(;r.length>0;){let e=r.pop();if(!e)break;if(e.kind===`exit`){n.delete(e.value);continue}if(i++,i>et){addJsonIssue(t,`Custom props cannot exceed ${et.toLocaleString(`en-US`)} total JSON nodes`,e.path);return}if(e.depth>64){addJsonIssue(t,`Custom props cannot exceed depth 64`,e.path);continue}let a=e.value;if(!(a===null||typeof a==`string`||typeof a==`boolean`||typeof a==`number`&&Number.isFinite(a))){if(typeof a!=`object`){addJsonIssue(t,`Expected a JSON value`,e.path);continue}if(n.has(a)){addJsonIssue(t,`Custom props cannot contain circular references`,e.path);continue}try{if(Array.isArray(a)){n.add(a),r.push({kind:`exit`,value:a}),pushJsonArrayChildren(a,e,r,t);continue}if(!isPlainJsonObject(a)){addJsonIssue(t,`Expected an array or plain JSON object`,e.path);continue}n.add(a),r.push({kind:`exit`,value:a}),pushJsonObjectChildren(a,e,r,t)}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`,e.path)}}}}const tt=c.unknown().superRefine(validateJsonProps).transform(e=>e),nt={span:c.union([c.literal(1),c.literal(2),c.literal(3),c.literal(4),c.literal(5),c.literal(6),c.literal(7),c.literal(8),c.literal(9),c.literal(10),c.literal(11),c.literal(12)]).optional().describe(`Columns of 12 this field occupies`),label:c.string().optional().describe(`Overrides the attribute's label`),readOnly:c.boolean().optional().describe(`Shows the value, not editable`)},rt=c.object({attribute:c.string().describe(`Attribute API name shown by this field`),...nt}).strict(),it=c.object({name:c.string().describe(`Group API name, unique in the form`),label:c.string().describe(`Label people see`),description:c.string().optional().describe(`Extra context under the label`),collapsible:c.boolean().optional().describe(`Whether the group can be collapsed`),collapsed:c.boolean().optional().describe(`Whether the group starts collapsed`),fields:c.array(rt).max(o.fieldsPerGroup).describe(`Fields in this group, in order`)}).strict();function refineFormContent(e,t){e.groups.reduce((e,t)=>e+t.fields.length,0)>o.fieldsPerFormTab&&t.addIssue({code:`too_big`,origin:`array`,maximum:o.fieldsPerFormTab,inclusive:!0,message:`A form content can contain at most ${o.fieldsPerFormTab} fields`,path:[`groups`]});let n=new Set,r=new Set;e.groups.forEach((e,i)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate group name "${e.name}"`,path:[`groups`,i,`name`]}),n.add(e.name),e.fields.forEach((e,n)=>{r.has(e.attribute)&&t.addIssue({code:`custom`,message:`Duplicate field attribute "${e.attribute}"`,path:[`groups`,i,`fields`,n,`attribute`]}),r.add(e.attribute)})})}const Q={name:c.string().describe(`Content API name, unique in the view`),label:c.string().optional().describe(`Label people see`),icon:s.optional().describe(`Icon name`),placement:c.enum([`main`,`aside`,`grid`]).describe(`main: the tab strip. aside: the side panel. grid: a page block`),height:c.enum([`fit`,`flexible`,`fill`]).optional().describe(`Page block height: fit (content), flexible (between bounds) or fill (whole page, one per page)`)},at={...Q,type:c.literal(`collection`),source:M.describe(`object: every record; relation: records linked to this record; both: records of object whose relation points at this record`),visibility:c.enum(a).optional().describe(`all: no scope; workspace: every member; private: viewer's own; shared: private records other members shared with the viewer`),columns:c.array(c.union([c.string(),c.object({relationProperty:c.string().refine(e=>e.trim().length>0).describe(`Qualified edge property shown as a column`)}).strict()])).max(o.columnsPerTab).optional().describe(`Table columns, in order`),descriptionAttribute:c.string().optional().describe(`Secondary line under each row's title (list layout)`),displayAttributes:De.optional().describe(`Attributes shown on each card`),filters:j.optional().describe(`Restricts which records show`),sorts:A.optional().describe(`Sort order`),actions:c.enum([`create`,`update`,`delete`,`attach`,`detach`]).array().optional().describe(`Offered actions; absent = every action, [] = none`),openMode:c.enum([`page`,`peek`]).optional().describe(`page or peek (the record panel)`),createMode:c.enum([`page`,`peek`,`inline`]).optional().describe(`page, peek, or inline (creates without opening)`)},ot=c.object({...at,layout:c.enum([`table`,`list`,`kanban`]).describe(`table columns, list cards, kanban board grouped by a select/status attribute`),columnSizing:c.record(c.string(),c.number()).optional().describe(`Column widths in pixels, by attribute name`),groupByAttribute:c.string().optional().describe(`Kanban only: the select or status attribute that names the columns`),kanbanColumnOrder:c.array(c.string()).optional().describe(`Kanban: column order by option value`),kanbanColumnVisibility:c.record(c.string(),c.boolean()).optional().describe(`Kanban: which columns are shown`),kanbanPinnedColumns:c.array(c.string()).optional().describe(`Kanban: columns pinned first`)}).strict().superRefine((e,t)=>{let n=[`groupByAttribute`,`kanbanColumnOrder`,`kanbanColumnVisibility`,`kanbanPinnedColumns`];if(e.layout===`kanban`){e.groupByAttribute===void 0&&t.addIssue({code:`custom`,path:[`groupByAttribute`],message:`A kanban layout requires groupByAttribute`});return}for(let r of n)e[r]!==void 0&&t.addIssue({code:`custom`,path:[r],message:`Only a kanban layout groups by an attribute`})}),$={...Q,type:c.literal(`form`),groups:c.array(it).max(o.groupsPerFormTab).describe(`Field groups, in order`),formColumns:c.union([c.literal(1),c.literal(2),c.literal(3)]).optional().describe(`Grid columns, 1-3`),density:c.enum([`compact`,`comfortable`,`spacious`]).optional().describe(`Vertical spacing between fields`)},st=c.object($).strict().superRefine(refineFormContent),ct=c.object({...$,groups:$.groups.min(1,`A published form content requires at least one group`)}).strict().superRefine(refineFormContent),lt=[ot,c.object({...Q,type:c.literal(`group`),placement:c.literal(`grid`).describe(`Always grid`),members:c.array(c.string()).min(1).max(o.membersPerGroup).describe(`Contents side by side`)}).strict(),c.object({...Q,type:c.literal(`custom`),extension:c.string().describe(`Name of a registered extension`),parameters:c.lazy(()=>tt).optional().describe(`Extension parameters`)}).strict(),c.object({...Q,type:c.literal(`activity`)}).strict(),c.object({...Q,type:c.literal(`richtext`),attribute:c.string().describe(`Richtext attribute edited in place`),titleAttribute:c.string().optional().describe(`Text attribute shown as the title`)}).strict(),c.object({...Q,type:c.literal(`documents`),allowUpload:c.boolean().optional().describe(`Lets people add files here`),allowRemove:c.boolean().optional().describe(`Lets people remove files here`),hideAttachments:c.boolean().optional().describe(`Hides files attached elsewhere (e.g. emails)`),relations:c.array(c.string()).optional().describe(`Document relations shown; the record's own files if absent`)}).strict(),c.object({...Q,type:c.literal(`forms`),objectName:c.string().optional().describe(`Limits to this object's published forms`)}).strict(),c.object({...Q,type:c.literal(`emails`),emailAttributes:c.array(c.string()).max(o.emailAttributesPerTab).describe(`Addresses`)}).strict(),c.object({...Q,type:c.literal(`meetings`),emailAttributes:c.array(c.string()).max(o.emailAttributesPerTab).describe(`Addresses`)}).strict(),c.object({...Q,type:c.literal(`page`),page:c.object({object:c.string().describe(`Its object`),name:c.string().describe(`Its name`)}).strict().describe(`The record page this tab renders`)}).strict()],ut=c.discriminatedUnion(`type`,[st,...lt]),dt=c.discriminatedUnion(`type`,[ct,...lt]),ft={name:c.string(),label:c.string(),description:c.string().optional(),icon:s.optional()},pt=c.object({x:c.number().describe(`Column`),y:c.number().describe(`Row`),w:c.number().describe(`Width: 3, 4, 6, 8, 9 or 12; x + w ≤ 12`),h:c.number().describe(`Height`)}).strict();function contentViewBaseSchemaFor(e){let t=c.array(e).max(o.tabsPerView);return c.discriminatedUnion(`context`,[c.object({...ft,object:c.string(),context:c.enum([`collection`,`record`]),default:c.boolean().optional(),anchors:c.record(c.string(),c.object({after:c.string()}).strict()).optional(),contents:t}).strict(),c.object({...ft,object:c.string().optional(),context:c.literal(`page`),home:c.boolean().optional(),grid:c.record(c.string(),pt).refine(e=>Object.keys(e).length<=o.tabsPerView,{message:`A page holds at most ${o.tabsPerView} blocks`}),contents:t}).strict()])}const mt=contentViewBaseSchemaFor(ut),ht=contentViewBaseSchemaFor(dt);function registryTraits(e,t){return layoutTraitsOf(e,Je,t)}function addGroupSizeIssues(e,t){for(let n of e.contents){let e=n.type===`group`?groupSizeMessage(n.members.length):void 0;e&&t.addIssue({code:`custom`,message:e,path:[`contents`]})}}function addDuplicateContentNameIssues(e,t){let n=new Set;e.contents.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate content name "${e.name}"`,path:[`contents`,r,`name`]}),n.add(e.name)})}function addPlacementIssues(e,t){e.contents.forEach((n,r)=>{let i=n.placement===`grid`;e.context===`page`&&!i&&t.addIssue({code:`custom`,message:`Content "${n.name}" of a page must be placed on the grid`,path:[`contents`,r,`placement`]}),e.context!==`page`&&i&&t.addIssue({code:`custom`,message:`Content "${n.name}" cannot be placed on a grid outside a page`,path:[`contents`,r,`placement`]})})}function addIssue(e,t){e.addIssue({code:`custom`,message:t.message,path:[`grid`,...t.path]})}function addGridIssues(e,t,n,r){if(e.context!==`page`||!e.grid)return;let i=new Set(e.contents.map(e=>e.name)),a=groupedMembers(e.contents);for(let n of i)a.has(n)||Object.hasOwn(e.grid,n)||t.addIssue({code:`custom`,message:`Content "${n}" has no grid position`,path:[`grid`]});let o=Object.keys(e.grid).filter(e=>!i.has(e));for(let e of o)t.addIssue({code:`custom`,message:`Grid position "${e}" matches no content`,path:[`grid`,e]});if(e.home&&e.object!==void 0&&t.addIssue({code:`custom`,message:`Only a standalone page can be the home`,path:[`home`]}),o.length>0)return;let s=findGridViolation(e.grid,{exempt:a});if(s){addIssue(t,s);return}if(n===null)return;let c=findGroupViolation(e.contents);if(c){t.addIssue({code:`custom`,message:c.message,path:[`contents`]});return}let l=new Map(e.contents.map(e=>[e.name,e])),u=findLayoutRuleViolation(e.grid,e.contents,e=>n(l.get(e),l),r);u&&addIssue(t,u)}function draftContentViewDefinitionSchemaFor(){return mt.superRefine((e,t)=>{let n=e;addDuplicateContentNameIssues(n,t),addPlacementIssues(n,t),addGridIssues(n,t,null)})}function contentViewDefinitionSchemaFor(e={}){let t=e.traits===void 0?registryTraits:e.traits;return ht.superRefine((n,r)=>{let i=n;addDuplicateContentNameIssues(i,r),addPlacementIssues(i,r),addGridIssues(i,r,t,e.statics),e.viewerFiltered||addGroupSizeIssues(i,r),n.context!==`page`&&!n.contents.some(e=>e.placement===`main`)&&r.addIssue({code:`custom`,message:`A published view requires at least one main content`,path:[`contents`]})})}const gt=draftContentViewDefinitionSchemaFor(),_t=contentViewDefinitionSchemaFor();export{U as AGENDA_BLOCK,L as ARTIFACT_PREVIEW_EXTENSION,b as ATTRIBUTE_FILTER_OPERATORS,se as ATTRIBUTE_TYPES,x as BLOCK_CONTEXTS,N as BLOCK_PERIODS,Y as BLOCK_WIDTHS,W as CARD_BLOCK,H as CHART_BLOCK,B as CHART_KINDS,Xe as CONTENT_PLACEMENT_CONTEXTS,Z as DEFAULT_LAYOUT_TRAITS,z as GROUPABLE_ATTRIBUTE_TYPES,K as HEADING_BLOCK,Be as INBOX_BLOCK,$e as INVENTORY_LIMIT,y as LOCATION_FILTER_PROPERTIES,He as MAILBOX_BLOCK,R as MEASURABLE_ATTRIBUTE_TYPES,Ve as MEETINGS_UPCOMING_BLOCK,V as METRIC_BLOCK,Ge as NATIVE_BLOCKS,ue as NO_VALUE_OPERATORS,le as OPERATORS_BY_TYPE,Ye as PAGE_GRID_COLUMNS,de as QUALIFIED_SEPARATOR,P as QUERY_OBJECT,q as RECORD_LINKS_BLOCK,Ue as RECORD_LINKS_CONTENT,J as RECORD_MEMORY_BLOCK,We as RECORD_MEMORY_CONTENT,ze as RECORD_OBJECT,ce as RELATION_TARGET_ANY,O as REMOVED_OPERATOR_REPLACEMENTS,RecordQuery,ve as SYNONYM_ALIASES,u as SYSTEM_ATTRIBUTES,l as SYSTEM_ATTRIBUTE_I18N_KEYS,xe as SYSTEM_FILTER_ATTRIBUTE_TYPES,G as TEXT_BLOCK,attributeFilterTarget,attributeInventory,blockObjectInputs,buildQualifiedAttribute,canonicalizeFilterValue,capped,collectContentViewCatalogue,collectQualifiedRuleIssues,M as collectionContentSourceSchema,collectionSourceAddress,collectionSourceAddressOf,Ee as columnsSchema,Je as contentExtensionRegistry,contentReadObjects,_t as contentViewDefinitionSchema,contentViewDefinitionSchemaFor,currentActor,defineBlock,describeViewIssue,De as displayAttributesSchema,gt as draftContentViewDefinitionSchema,draftContentViewDefinitionSchemaFor,edgePropertyFilterTarget,extractCurrencyFilterValue,extractFilterValue,filterOperatorsOfType,j as filterStateSchema,filterTargetsOf,findGridViolation,findGroupViolation,findLayoutRuleViolation,findRelationAttribute,findRowLimitViolation,getAttributeCapabilities,getAttributeFilterOperators,getOperatorPolarity,getRollupFilterOperators,getSystemAttributeI18nKey,getSystemAttributeList,pt as gridPositionSchema,groupSizeMessage,groupedMembers,inferInverseCardinality,F as input,invalidViewMessage,isAttributeFilterable,isAttributeGroupable,isAttributeKanbanGroupable,isAttributeSearchable,isAttributeSortable,isBilateralRelation,isCalendarDay,isDynamicValue,isLocationFilterProperty,isLocationPartOperator,isManagedSystemAttribute,isNoValueOperator,isRelativeDateValue,isSetMembershipOperator,isUniversalRelation,layoutTraitsOf,locationPartFilterTarget,memberlessGroups,metricComparePeriod,normalizeFilterRule,normalizeForEdgeRpc,normalizeOperator,now,overlaps,pageTraitsOf,parseBlockParameters,parseQualifiedAttribute,dt as publishedViewContentDefinitionSchema,query,Re as recordQueryDefinitionSchema,relationAcceptsObject,relationTargetsOf,requireContentPlacement,requireRecordContentContext,requireSingleRelationTarget,resolveCollectionActions,resolveContentNavigation,resolveEffectiveFilterType,resolveIsWithinBounds,resolveUtcDayBounds,singleRelationTarget,A as sortsSchema,sourcedAttributeOf,systemColumnFilterTarget,toMultiValueOperator,toUtcDayString,today,validateContentViewCatalogue,validateQualifiedRule,validateStoredViews};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
const e=require("./rolldown-runtime-DETHMehu.js"),t=require("./record-aggregates-ayabJXQ0.js"),n=require("./exceptions.js");require("./zod-locale.js");const r=require("./primitives-BBtVhLdq.js");let i=require("zod");i=e.__toESM(i);const a={createdAt:`createdAt`,updatedAt:`updatedAt`,createdBy:`createdBy`,lastUpdatedBy:`lastUpdatedBy`,attachments:`attachments`};function getSystemAttributeI18nKey(e){return a[e]}const o={createdAt:{id:`system:createdAt`,name:`createdAt`,label:`Created time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was created`},updatedAt:{id:`system:updatedAt`,name:`updatedAt`,label:`Last edited time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was last modified`},createdBy:{id:`system:createdBy`,name:`createdBy`,label:`Created by`,type:`user`,required:!1,system:!0,multiple:!1,actors:!0,icon:`user`,description:`Actor who created this record`},lastUpdatedBy:{id:`system:lastUpdatedBy`,name:`lastUpdatedBy`,label:`Last edited by`,type:`user`,required:!1,system:!0,multiple:!1,actors:!0,icon:`user`,description:`Actor who last modified this record`},attachments:{id:`system:attachments`,name:`attachments`,label:`Attachments`,type:`document`,required:!1,system:!0,hidden:!0,icon:`paperclip`,description:`Free-form document attachments`}};function getSystemAttributeList(){return Object.values(o)}function isManagedSystemAttribute(e){return e.id?.startsWith(`system:`)??!1}const s=[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`],c=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_empty`,`is_not_empty`],l=[`is`],u=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`is_empty`,`is_not_empty`],d=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],f=[`any_of`,`none_of`,`is_empty`,`is_not_empty`],p=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],m=[`is_empty`,`is_not_empty`],h=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`contains`,`not_contains`,`is_empty`,`is_not_empty`],g=[`city`,`postalCode`,`country`];function isLocationFilterProperty(e){return g.includes(e)}const _={text:s,richtext:[],number:c,checkbox:l,date:u,phone:[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`is_empty`,`is_not_empty`],currency:c,status:d,select:d,multiselect:f,location:[],user:p,relation:p,formula:h,document:m},ee=new Set([`formula`,`rollup`]),te=new Set([`user`,`relation`,`document`]),v=new Set([`text`,`richtext`,`number`,`select`,`multiselect`,`status`,`date`,`phone`,`currency`,`location`,`user`,`relation`,`document`]),ne=new Set([`text`,`number`,`date`,`phone`,`currency`,`select`,`multiselect`]),re=new Set([`text`,`richtext`,`phone`,`status`,`select`,`multiselect`]),ie=new Set([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`]);function getAttributeCapabilities(e){let t=!!(e.hidden||e.archived),n=!e.archived,r=ee.has(e.type),i=e.type===`document`,a=te.has(e.type),o=getAttributeCardinality(e),s=t?[]:getRawFilterOperators(e),c=s.length>0&&!t,l=!t&&re.has(e.type),u=!t&&ie.has(e.type),d=!t&&isGroupableType(e.type),f=!t&&e.type===`status`,p=isManagedSystemAttribute(e),m=r||i||p,h=!(t||m),g=isRequiredForbidden(e.type)?`forbidden`:`allowed`,_=getDefaultValueCapability(e.type),v=supportsMaxItems(e),y=ne.has(e.type),b=!(!e.deprecated||t),x=resolveEditMode(e);return{lifecycle:{active:n,deprecated:!!e.deprecated,visibleInArchitect:!0,visibleInRuntime:!t,warningWhenDeprecated:b},storage:{mode:r?`computed`:a?`edge`:`value`,cardinality:o,edgeBacked:a,preservesExistingValues:!!e.archived,qualifiedProperties:supportsQualifiedProperties(e.type),polymorphic:getPolymorphicCapability(e),maxItems:v},authoring:{editable:h,readOnly:m,directEdit:h&&x===`inline`,required:g,defaultValue:_,placeholder:y,maxItems:v},presentation:{formField:!t&&isFormFieldType(e.type),tableCell:!t&&isTableCellType(e.type),defaultColumn:!t&&isDefaultColumnType(e.type),compactDisplay:!t,popoverEditor:!t&&x===`popover`,placeholder:y,warningWhenDeprecated:b},query:{filterable:c,searchable:l,sortable:u,groupable:d,kanbanGroupable:f,operators:s},agent:{readable:!t,writable:h&&!i,compactReadable:!t,contentReadable:!t&&isContentReadableType(e.type),requiresDedicatedTool:i},exchange:{importable:!t,exportable:!t,schemaExportable:!0,metadataExportable:!1}}}function getAttributeFilterOperators(e){return getAttributeCapabilities(e).query.operators}function isAttributeFilterable(e){return getAttributeCapabilities(e).query.filterable}function isAttributeSearchable(e){return getAttributeCapabilities(e).query.searchable}function isAttributeSortable$1(e){return getAttributeCapabilities(e).query.sortable}function isAttributeGroupable(e){return getAttributeCapabilities(e).query.groupable}function isAttributeKanbanGroupable(e){return getAttributeCapabilities(e).query.kanbanGroupable}function resolveEffectiveFilterType(e){if(e.type!==`rollup`)return e.type;let t=e;if(t.function===`earliest`||t.function===`latest`)return`date`;if(t.function===`original`){let e=t.targetAttributeType;if(e&&hasFilterOperatorEntry(e))return e}return`number`}function getRollupFilterOperators$1(e){let t=resolveEffectiveFilterType(e);return hasFilterOperatorEntry(t)?_[t]:_.number}function getRawFilterOperators(e){return e.type===`rollup`?getRollupFilterOperators$1(e):_[e.type]??[]}function getAttributeCardinality(e){return e.type===`multiselect`||e.type===`document`||e.type===`user`&&e.multiple===!0||e.type===`relation`&&e.cardinality===`many`?`many`:`one`}function getPolymorphicCapability(e){if(e.type!==`relation`)return`none`;let t=e.targets??[];return t.length===1&&t[0]?.object===`*`?`internal`:t.length>1?`code-only`:`none`}function supportsMaxItems(e){return e.type===`multiselect`||e.type===`relation`&&e.cardinality===`many`}function supportsQualifiedProperties(e){return e===`relation`||e===`document`}function isRequiredForbidden(e){return e===`checkbox`||e===`formula`||e===`rollup`}function getDefaultValueCapability(e){return e===`checkbox`?`automatic`:e===`formula`||e===`rollup`?`forbidden`:v.has(e)?`static`:`forbidden`}function isDefaultColumnType(e){return isTableCellType(e)}function isTableCellType(e){return e!==`richtext`&&e!==`document`}function isFormFieldType(e){return e!==`richtext`}function resolveEditMode(e){switch(e.type){case`checkbox`:return`inline`;case`number`:return e.renderAs===`rating`?`inline`:`default`;case`select`:case`multiselect`:return e.renderAs===`badges`?`inline`:`popover`;case`status`:case`relation`:case`user`:case`date`:return`popover`;default:return`default`}}function isGroupableType(e){return e===`status`||e===`currency`}function isContentReadableType(e){return e===`richtext`||e===`document`}function hasFilterOperatorEntry(e){return Object.prototype.hasOwnProperty.call(_,e)}const y=[`text`,`richtext`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`location`,`select`,`multiselect`,`user`,`relation`,`formula`,`rollup`,`document`];function relationTargetsOf(e){return e.type!==`relation`||!Array.isArray(e.targets)?[]:e.targets.map(e=>e.object).filter(e=>e!==`*`)}function isUniversalRelation(e){return e.targets.length===1&&e.targets[0].object===`*`}function isBilateralRelation(e){return e.bilateral!==void 0}function inferInverseCardinality(e){return`many`}function isAttributeSortable(e){return isAttributeSortable$1(e)}const b=_,x=[`is_empty`,`is_not_empty`];function isNoValueOperator(e){return x.includes(e)}function getRollupFilterOperators(e){return getRollupFilterOperators$1(e)}function parseQualifiedAttribute(e){let t=e.indexOf(`__`);return t<=0||t+2>=e.length?{kind:`scalar`,attribute:e}:{kind:`qualified`,root:e.slice(0,t),property:e.slice(t+2)}}function buildQualifiedAttribute(e,t){return`${e}__${t}`}const S=[`page`,`record`,`display`];function defineBlock(e){let t=Object.fromEntries(Object.entries(e.inputs).map(([e,t])=>[e,t.isOptional?t.schema.optional():t.schema]));return Object.freeze({name:e.name,label:e.label,icon:e.icon,family:e.family,contexts:Object.freeze([...e.contexts]),inputs:Object.freeze({...e.inputs}),...e.layout===void 0?{}:{layout:Object.freeze({...e.layout})},parameters:i.object(t).strict().superRefine((t,n)=>{let r=e.refine?.(t);r&&n.addIssue({code:`custom`,path:[r.input],message:r.message})}),...e.refine===void 0?{}:{refine:(t,n)=>e.refine?.(t,n)}})}function parseBlockParameters(e,t,r){let i=e.parameters.safeParse(structuredClone(t??{}));if(!i.success)throw n.ValidationError.fromZodErrors(i.error.issues.map(e=>({path:[...r,...e.path.map(String)],message:e.message})));return i.data}function blockObjectInputs(e,t,n){return Object.entries(e.inputs).flatMap(([e,r])=>{let i=t[e];if(r.kind===`object`&&typeof i==`string`)return[i];if(r.kind===`query`&&typeof i==`object`&&i){let e=i.source;if(!e)return[];if(`object`in e&&typeof e.object==`string`)return[e.object];let t=n?.attributes.find(t=>t.name===e.relation);return t?relationTargetsOf(t):[]}return[]})}const ae=/^\d{4}-\d{2}-\d{2}$/u;function isCalendarDay(e){if(!ae.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function isDynamicValue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`dynamic`in e}function currentActor(){return{dynamic:`actor`,ref:`current`}}function today(){return{dynamic:`date`,anchor:`today`}}function now(){return{dynamic:`date`,anchor:`now`}}function toAmount(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:null}return null}function extractCurrencyFilterValue(e){return typeof e==`object`&&e?`value`in e?toAmount(e.value):null:toAmount(e)}function extractFilterValue(e){return e==null?null:typeof e==`object`&&`value`in e?e.value??null:e}const oe=new Set([`is_not`,`not_contains`,`none_of`,`is_empty`]),se={is_not:`is`,not_contains:`contains`,none_of:`any_of`,is_empty:`is_not_empty`};function getOperatorPolarity(e){return oe.has(e)?`none`:`any`}function normalizeForEdgeRpc(e){return se[e]??e}const ce={is:`any_of`,is_not:`none_of`};function toMultiValueOperator(e){return ce[e]??e}const le=new Set(Object.values(ce).filter(e=>e!==void 0));function isSetMembershipOperator(e){return le.has(e)}function canonicalizeFilterValue(e,t){let r=e.value;if(isNoValueOperator(e.operator)||r==null||isDynamicValue(r))return;if(isSetMembershipOperator(e.operator)){Array.isArray(r)||(e.value=[r]);return}if(t!==`currency`)return;let i=extractCurrencyFilterValue(r);if(i!==null){e.value=i;return}if(!hasCurrencyAmount(r))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(r)}`;throw new n.ValidationError(a,[{path:[`value`],message:a}])}function hasCurrencyAmount(e){return typeof e!=`object`||`value`in e&&e.value!=null}const C=_.text,ue=[`is`,`is_not`,`is_empty`,`is_not_empty`],w=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],T={id:w,objectId:w,tenantId:w,label:_.text,createdAt:_.date,updatedAt:_.date,deletedAt:_.date,createdBy:_.user,lastUpdatedBy:_.user},de=new Set([`createdAt`,`updatedAt`,`deletedAt`]);function offeredOn(e,t){return de.has(e)?t.filter(e=>e!==`on_day_month`):t}function fullyOffered(e,t,n,r){return{target:e,attribute:t,...r?{property:r}:{},operators:n,offered:n}}function attributeFilterTarget(e){let t=getAttributeFilterOperators(e);return{target:e.name,attribute:e.name,operators:t,offered:offeredOn(e.name,t)}}function locationPartFilterTarget(e,t){return{target:buildQualifiedAttribute(e,t),attribute:e,property:t,operators:C,offered:t===`country`?ue:C}}function edgePropertyFilterTarget(e,t){let n=hasOperatorEntry(t.type)?_[t.type]:[];return fullyOffered(buildQualifiedAttribute(e,t.name),e,n,t.name)}function hasOperatorEntry(e){return Object.prototype.hasOwnProperty.call(_,e)}function systemColumnFilterTarget(e){let t=Object.prototype.hasOwnProperty.call(T,e)?T[e]:void 0;return t?{target:e,attribute:e,operators:t,offered:offeredOn(e,t)}:void 0}function filterOperatorsOfType(e){return isAttributeType(e)?getAttributeFilterOperators({type:e}):[]}function isAttributeType(e){return y.includes(e)}function isLocationPartOperator(e){return C.includes(e)}function carriesEdgeProperties(e){return e.type===`relation`||e.type===`document`}function filterTargetsOf(e){let t=[];for(let n of e){if(n.type===`location`){for(let e of g)t.push(locationPartFilterTarget(n.name,e));continue}if(t.push(attributeFilterTarget(n)),!carriesEdgeProperties(n))continue;let e=n.properties?.definitions;for(let r of e??[])t.push(edgePropertyFilterTarget(n.name,r))}let n=new Set(e.map(e=>e.name));for(let e of Object.keys(T)){if(n.has(e))continue;let r=systemColumnFilterTarget(e);r&&t.push(r)}return t.filter(e=>e.operators.length>0)}const fe={eq:`is`,equals:`is`,equal:`is`,"==":`is`,"=":`is`,neq:`is_not`,notEqual:`is_not`,isNot:`is_not`,"!=":`is_not`,"<>":`is_not`,lt:`less_than`,"<":`less_than`,gt:`greater_than`,">":`greater_than`,lte:`less_or_equal`,"<=":`less_or_equal`,gte:`greater_or_equal`,">=":`greater_or_equal`,in:`any_of`,isAnyOf:`any_of`,anyOf:`any_of`,oneOf:`any_of`,notIn:`none_of`,not_in:`none_of`,isNoneOf:`none_of`,noneOf:`none_of`,notOneOf:`none_of`,startsWith:`starts_with`,beginsWith:`starts_with`,endsWith:`ends_with`,doesNotContain:`not_contains`,notContain:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`};function normalizeOperator(e){return fe[e]??e}function normalizeFilterRule(e){let t=normalizeOperator(e.operator);return t===e.operator?e:{...e,operator:t}}const E=864e5,pe=new Set([`days`,`weeks`,`months`,`years`]),me=new Set([`past`,`future`]);function isRelativeDateValue(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.unit==`string`&&pe.has(t.unit)&&typeof t.direction==`string`&&me.has(t.direction)}function utcDayStart(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function shiftUtcDay(e,t,n){if(n===`days`)return e+t*E;if(n===`weeks`)return e+t*7*E;let r=new Date(e),i=r.getUTCFullYear()+(n===`years`?t:0),a=r.getUTCMonth()+(n===`months`?t:0),o=new Date(Date.UTC(i,a+1,0)).getUTCDate();return Date.UTC(i,a,Math.min(r.getUTCDate(),o))}function resolveIsWithinBounds(e,t=new Date){if(!isRelativeDateValue(e))return null;let n=utcDayStart(t),r=Math.trunc(e.amount),i=e.direction===`past`?{startMs:shiftUtcDay(n,-r,e.unit),endMs:n+E}:{startMs:n,endMs:shiftUtcDay(n,r,e.unit)+E};return Number.isFinite(i.startMs)&&Number.isFinite(i.endMs)?i:null}function resolveUtcDayBounds(e){if(!Number.isFinite(e))return null;let t=utcDayStart(new Date(e));return Number.isFinite(t)?{startMs:t,endMs:t+E}:null}function toUtcDayString(e){return new Date(e).toISOString().slice(0,10)}const he=new Set([`relation`,`document`,`user`]),ge={id:`text`,objectId:`text`,objectName:`text`,tenantId:`text`,label:`text`,createdAt:`date`,updatedAt:`date`,deletedAt:`date`,deletedBy:`user`,createdBy:`user`,lastUpdatedBy:`user`,visibility:`select`,ownedBy:`user`},D={before:`"less_than"`,after:`"greater_than"`,on_or_before:`"less_or_equal"`,on_or_after:`"greater_or_equal"`,is_checked:`"is" with value true`,is_not_checked:`"is" with value false`,day_month_eq:`"on_day_month"`},_e=new Set(Object.entries(_).filter(([,e])=>e.includes(`any_of`)&&!e.includes(`contains`)).map(([e])=>e)),ve={contains:`any_of`,not_contains:`none_of`};function resolveCanonicalOperator(e,t){let r=D[e];if(r){let t=`Unknown filter operator "${e}" — use ${r}`;throw new n.ValidationError(t,[{path:[`operator`],message:t}])}let i=normalizeOperator(e),a=ve[i];if(a&&_e.has(t)){let e=`Operator "${i}" is not valid for type "${t}" — use "${a}"`;throw new n.ValidationError(e,[{path:[`operator`],message:e}])}return i}function assertPropertyOperator(e,t,r){let i=resolveCanonicalOperator(e,t);if(!r.includes(i)){let i=`Operator "${e}" is not valid for property type "${t}". Valid operators: ${r.length?r.join(`, `):`(no operators registered for this type)`}.`;throw new n.ValidationError(i,[{path:[`operator`],message:i}])}return i}function assertRelativeDateValue(e){if(e.operator===`is_within`&&!isRelativeDateValue(e.value)){let e=`Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;throw new n.ValidationError(e,[{path:[`value`],message:e}])}}const ye=/^(\d{4}-\d{2}-\d{2})(?:[T ](?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:(?:0\d|1[0-3])(?::[0-5]\d)?|14(?::00)?))?)?$/,be=new Set([`is`,`is_not`,`less_than`,`less_or_equal`,`greater_than`,`greater_or_equal`]);function assertAbsoluteDateValue(e,t){if(t!==`date`||!be.has(e.operator))return;let r=e.value;if(r==null||isDynamicValue(r)||typeof r==`string`&&isCastableDay(r))return;let i=`Filter on a date attribute expected a YYYY-MM-DD day, optionally followed by a time, received ${JSON.stringify(r)}`;throw new n.ValidationError(i,[{path:[`value`],message:i}])}function isCastableDay(e){let t=ye.exec(e)?.[1];return!t||t.startsWith(`0000-`)?!1:isCalendarDay(t)}function resolveComparandType(e){return e.type===`formula`&&e.returnType===`date`?`date`:resolveEffectiveFilterType(e)}function applyCanonicalForm(e,t,n){e.operator=t,canonicalizeFilterValue(e,n),assertRelativeDateValue(e),assertAbsoluteDateValue(e,n)}function assertDynamicValueForAttribute(e,t){if(!isDynamicValue(e.value))return;let r=e.value;if(r.dynamic===`actor`&&t!==`user`){let e=`actor token (@me) is only valid on user attributes, not "${t}"`;throw new n.ValidationError(e,[{path:[`value`],message:e}])}if(r.dynamic===`date`&&t!==`date`){let e=`date token (@today/@now) is only valid on date attributes, not "${t}"`;throw new n.ValidationError(e,[{path:[`value`],message:e}])}}const O=g.map(e=>`"${e}"`).join(`, `);function operatorList(e){return e.length?e.join(`, `):`(not filterable)`}function qualifyWithSchema(e){if(he.has(e.type))return e.properties}function locationPartsHint(e){return e===`location`?` A location is filtered on one of its parts: set "property" to one of ${O} and use a text operator (e.g. contains).`:``}function dottedPathHint(e,t,n){let r=` Dotted paths are not supported — `;if(n.type===`location`)return`${r}set "attribute" to "${e}" and "property" to ${isLocationFilterProperty(t)?`"${t}"`:`one of ${O}`}.`;let i=qualifyWithSchema(n);if(i){let n=i.definitions.map(e=>`"${e.name}"`).join(`, `);return`${r}set "attribute" to "${e}" and "property" to ${i.definitions.some(e=>e.name===t)?`"${t}"`:`one of ${n}`} to filter on the edge property.`}let a=attributeFilterTarget(n).operators;return`${r}${a.length?`set "attribute" to "${e}" and use one of ${a.join(`, `)}`:`"${e}" is not filterable`}; the full-text "query" parameter matches tokens by relevance, not values.`}function collectQualifiedRuleIssues(e,t){try{return validateQualifiedRule({...e},t),[]}catch(e){if(!(e instanceof n.ValidationError))throw e;return e.errors.map(e=>({...e,path:[...e.path]}))}}function validateQualifiedRule(e,t){if(typeof e.attribute!=`string`){let e=`A filter rule needs an attribute: filters are one combinator and a flat list of rules`;throw new n.ValidationError(e,[{path:[`attribute`],message:e}])}let r=t.attributes.find(t=>t.name===e.attribute),i=r?[]:systemColumnFilterTarget(e.attribute)?.operators??[];if(!r&&i.length===0){let[r,...i]=e.attribute.split(`.`),a=i.length>0?t.attributes.find(e=>e.name===r):void 0,o=a?dottedPathHint(r??``,i[0]??``,a):e.attribute.includes(`.`)?` Dotted paths are not supported — filter on the attribute name alone with a structured operator (contains, any_of, …); the full-text "query" parameter matches tokens by relevance, not values.`:``,s=`Unknown attribute: ${e.attribute}${o}`;throw new n.ValidationError(s,[{path:[`attribute`],message:s}])}if(e.quantifier!==void 0&&!e.property){let e=`quantifier is only valid on qualified edge rules (set "property")`;throw new n.ValidationError(e,[{path:[`quantifier`],message:e}])}if(!r){if(e.property)throw new n.ValidationError(`Cannot qualify system attribute "${e.attribute}"`,[{path:[`property`],message:`"${e.attribute}" is a system column, not a reference`}]);let t=ge[e.attribute]??`text`,r=resolveCanonicalOperator(e.operator,t);if(!i.includes(r)){let t=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(`, `)}.`;throw new n.ValidationError(t,[{path:[`operator`],message:t}])}applyCanonicalForm(e,r,t);return}if(!e.property){assertDynamicValueForAttribute(e,r.type);let t=attributeFilterTarget(r).operators,i=resolveCanonicalOperator(e.operator,r.type);if(!t.includes(i)){let i=`Operator "${e.operator}" is not valid for attribute "${r.name}". Valid operators: ${operatorList(t)}.${locationPartsHint(r.type)}`;throw new n.ValidationError(i,[{path:[`operator`],message:i}])}applyCanonicalForm(e,i,resolveComparandType(r));return}if(r.type===`location`){if(e.quantifier!==void 0){let e=`quantifier is not valid on a location part — a location is one value, not a set of edges`;throw new n.ValidationError(e,[{path:[`quantifier`],message:e}])}if(!isLocationFilterProperty(e.property)){let t=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${O}.`;throw new n.ValidationError(t,[{path:[`property`],message:t}])}assertDynamicValueForAttribute(e,`text`);let{operators:t}=locationPartFilterTarget(r.name,e.property);applyCanonicalForm(e,assertPropertyOperator(e.operator,`text`,t),`text`);return}if(!he.has(r.type))throw new n.ValidationError(`Cannot qualify ${r.type} attribute "${e.attribute}"`,[{path:[`property`],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=r.properties;if(!a)throw new n.ValidationError(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:[`property`],message:`"${e.attribute}" has no qualifyWith`}]);let o=a.definitions.find(t=>t.name===e.property);if(!o)throw new n.ValidationError(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:[`property`],message:`Unknown property: ${e.property}`}]);let{operators:s}=edgePropertyFilterTarget(r.name,o);applyCanonicalForm(e,assertPropertyOperator(e.operator,o.type,s),o.type)}const xe=i.array(i.string()).max(r.SCHEMA_LIMITS.columnsPerTab),Se=i.array(i.string().min(1)).max(r.SCHEMA_LIMITS.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:`Displayed attribute names must be unique`}),Ce=i.object({attribute:i.string().describe(`Attribute to sort by`),direction:i.enum([`asc`,`desc`]).describe(`asc or desc`)}).strict(),k=i.array(Ce).max(r.SCHEMA_LIMITS.sortsPerTab),we=i.object({amount:i.number().describe(`Count`),unit:i.enum([`days`,`weeks`,`months`,`years`]).describe(`Unit`),direction:i.enum([`past`,`future`]).describe(`Past or future`)}).strict(),Te=i.object({value:i.number().nullable().describe(`Amount`),code:i.array(i.string()).optional().describe(`Currency codes`)}).strict(),Ee=i.object({phoneNumber:i.string().nullable().describe(`Number`),countryCode:i.string().optional().describe(`ISO country code`)}).strict(),De=i.discriminatedUnion(`dynamic`,[i.object({dynamic:i.literal(`actor`).describe(`Resolved at filter time`),ref:i.literal(`current`).describe(`The current actor`)}).strict(),i.object({dynamic:i.literal(`date`).describe(`Resolved at filter time`),anchor:i.enum([`today`,`now`]).describe(`Anchor`)}).strict()]),Oe=i.object({month:i.number().describe(`1-12`),day:i.number().describe(`Day`)}).strict(),ke=i.union([i.string(),i.number(),i.boolean(),i.array(i.string()),we,Te,Ee,Oe,De,i.null()]),Ae=i.enum([`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`any_of`,`none_of`],{error:e=>{let t=e.input,n=typeof t==`string`?D[t]:void 0;return n?`Unknown filter operator "${t}" — use ${n}`:void 0}}),je=i.object({attribute:i.string().describe(`Attribute to filter on`),property:i.string().optional().describe(`Qualified edge property`),quantifier:i.enum([`any`,`none`]).optional().describe(`For a multi-value attribute`),operator:Ae.describe(`Comparison`),value:ke.describe(`Comparison value, by attribute type`)}).strict(),Me=i.array(je).max(r.SCHEMA_LIMITS.filterRulesPerTab),A=i.object({combinator:i.enum([`and`,`or`]).describe(`Match every rule or any rule`),rules:Me.describe(`The rules`)}).strict(),j=i.object({object:i.string().optional().describe(`Every record of this object`),relation:i.string().optional().describe(`Records linked through this relation`)}).strict().superRefine((e,t)=>{e.object===void 0&&e.relation===void 0&&t.addIssue({code:`custom`,message:`Collection source must define an object, a relation, or both`})}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),Ne=i.object({source:j,filters:A.optional(),sorts:k.optional(),limit:i.number().int().nonnegative().optional()}).strict();var RecordQuery=class{constructor(e){this.state=e}with(e){return new this.constructor({...this.state,...e})}rule(e,t,n){return this.with({rules:[...this.state.rules,{attribute:e,operator:t,value:n}]})}eq(e,t){return this.rule(e,`is`,t)}neq(e,t){return this.rule(e,`is_not`,t)}gt(e,t){return this.rule(e,`greater_than`,t)}gte(e,t){return this.rule(e,`greater_or_equal`,t)}lt(e,t){return this.rule(e,`less_than`,t)}lte(e,t){return this.rule(e,`less_or_equal`,t)}contains(e,t){return this.rule(e,`contains`,t)}notContains(e,t){return this.rule(e,`not_contains`,t)}startsWith(e,t){return this.rule(e,`starts_with`,t)}endsWith(e,t){return this.rule(e,`ends_with`,t)}in(e,t){return this.rule(e,`any_of`,t)}notIn(e,t){return this.rule(e,`none_of`,t)}isEmpty(e){return this.rule(e,`is_empty`,null)}isNotEmpty(e){return this.rule(e,`is_not_empty`,null)}where(...e){return this.with({rules:[...this.state.rules,...e.map(e=>({...e}))]})}or(){return this.with({combinator:`or`})}orderBy(e,t=`asc`){return this.with({sorts:[...this.state.sorts,{attribute:e,direction:t}]})}limit(e){return this.with({limit:e})}offset(e){return this.with({offset:e})}search(e){return this.with({search:e})}related(e){return this.with({scope:{kind:`related`,relation:e}})}relatedFrom(e){return this.with({scope:{kind:`relatedFrom`,relation:e}})}toDefinition(){let{object:e,scope:t,rules:n,combinator:r,sorts:i,limit:a}=this.state;return{source:t?.kind===`related`?{relation:t.relation}:t?.kind===`relatedFrom`?{object:e,relation:t.relation}:{object:e},...n.length>0?{filters:{combinator:r,rules:n.map(e=>({...e}))}}:{},...i.length>0?{sorts:i.map(e=>({...e}))}:{},...a===void 0?{}:{limit:a}}}};function query(e){return new RecordQuery({object:typeof e==`string`?e:e.build().name,combinator:`and`,rules:[],sorts:[]})}const M=[`day`,`week`,`month`,`quarter`,`year`],N=`$query`,Pe=`$record`;function createInput(e){return Object.freeze({...e,optional:()=>createInput({...e,isOptional:!0}),inSection:t=>createInput({...e,section:t}),showWhen:(t,n)=>createInput({...e,when:{key:t,...n}}),many:()=>createInput({...e,isMany:!0,schema:i.array(e.schema).min(1)})})}function objectNameOf(e){return e===void 0||typeof e==`string`?e:e.build().name}function scalar(e,t,n){return createInput({kind:e,of:objectNameOf(n),isOptional:!1,isMany:!1,schema:t})}function name(){return i.string().min(1)}const P={object:e=>scalar(`object`,name(),e),attribute:(e,t)=>createInput({kind:`attribute`,of:objectNameOf(e),options:t,isOptional:!1,isMany:!1,schema:name()}),query:e=>scalar(`query`,Ne,e),record:e=>scalar(`record`,name(),e),agent:()=>scalar(`agent`,name()),routine:()=>scalar(`routine`,name()),view:()=>scalar(`view`,name()),url:()=>scalar(`url`,i.url().refine(e=>/^https?:\/\//.test(e),`Only http(s) links`)),emailCategory:()=>scalar(`emailCategory`,name()),enum:e=>createInput({kind:`enum`,isOptional:!1,isMany:!1,schema:i.enum(e)}),text:()=>scalar(`text`,name()),number:()=>scalar(`number`,i.number()),boolean:()=>scalar(`boolean`,i.boolean()),period:()=>scalar(`period`,i.enum(M))},F={size:{w:4,h:4},minWidth:3,height:`flexible`,minHeight:3,maxHeight:10},Fe=defineBlock({name:`artifact_preview`,label:`Preview`,icon:`eye`,family:`context`,contexts:[`record`],layout:{size:{w:6,h:8},minWidth:4,height:`flexible`,minHeight:4,maxHeight:20},inputs:{}}),Ie=[`number`,`currency`],I=[`status`,`select`,`user`,`relation`,`date`],L=[`bar`,`horizontal_bar`,`line`,`area`,`donut`,`funnel`,`treemap`,`calendar`];function measureIssue({measure:e,attribute:t}){return e===`count`?t===void 0?void 0:{input:`attribute`,message:`count measures records; it takes no attribute`}:t===void 0?{input:`attribute`,message:`${String(e)} needs a number or currency attribute`}:void 0}function requires(e,t,n){return e[t]!==void 0&&e[n]===void 0?{input:t,message:`${t} needs ${n}`}:void 0}function together(e,t,n){return requires(e,t,n)??requires(e,n,t)}function kindIssue(e){let{kind:t,by:n,byBucket:r,by2:i,measure:a}=e;if(i!==void 0&&i===n)return{input:`by2`,message:`by2 must differ from by`};if((t===`donut`||t===`funnel`)&&i!==void 0)return{input:`kind`,message:`a ${String(t)} splits one grouping (by), and no second`};if(t===`funnel`&&a!==`count`&&a!==`sum`)return{input:`kind`,message:`a funnel adds stages up: its measure is count or sum`};if(t===`area`&&i===void 0)return{input:`kind`,message:`an area stacks a second grouping (by2); one series is a line`};if(t===`treemap`&&(n===void 0||i!==void 0))return{input:`kind`,message:`a treemap needs one grouping (by), and no second`};if(t===`calendar`&&(r!==`day`||i!==void 0))return{input:`kind`,message:`a calendar needs a date grouping by day, and no second`}}function measuredInputs(){return{query:P.query(),measure:P.enum(t.AGGREGATE_MEASURES).inSection(`data`),attribute:P.attribute(N,{types:Ie}).optional().showWhen(`measure`,{not:[`count`]}),label:P.text().optional()}}function metricComparePeriod(e){if(e.period)return e.period;if(!e.trendBucket)return`month`;let t=M.indexOf(e.trendBucket);return M[Math.min(t+1,M.length-1)]??`month`}function comparedSpanIssue(e){let{trendBucket:t,compare:n}=e;if(n===void 0||typeof t!=`string`)return;let r=t;if(r===M.at(-1))return{input:`compare`,message:`compare needs a trendBucket finer than year`};let i=metricComparePeriod({trendBucket:r,period:e.period});return M.indexOf(i)>M.indexOf(r)?void 0:{input:`period`,message:`period must be wider than trendBucket (unset, it is one step above)`}}const R=defineBlock({name:`metric`,label:`Indicateur`,icon:`trending-up`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:3,h:2},minWidth:3,height:`fit`,maxHeight:4,figure:!0},inputs:{...measuredInputs(),trend:P.attribute(N,{types:[`date`]}).optional().inSection(`display`),trendBucket:P.period().optional().showWhen(`trend`),compare:P.enum([`previous_period`]).optional(),period:P.period().optional().showWhen(`compare`),target:P.number().optional()},refine:e=>measureIssue(e)??together(e,`trend`,`trendBucket`)??requires(e,`period`,`compare`)??comparedSpanIssue(e)??(e.target!==void 0&&e.target<=0?{input:`target`,message:`target must be above zero`}:void 0)}),z=defineBlock({name:`chart`,label:`Graphique`,icon:`chart-bar`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:4,h:6},minWidth:4,height:`flexible`,minHeight:4,maxHeight:12},inputs:{...measuredInputs(),kind:P.enum(L),by:P.attribute(N,{types:I}).optional(),byBucket:P.period().optional().inSection(`data`).showWhen(`by`),by2:P.attribute(N,{types:I}).optional().showWhen(`by`),by2Bucket:P.period().optional().inSection(`data`).showWhen(`by2`)},refine:e=>measureIssue(e)??requires(e,`byBucket`,`by`)??requires(e,`by2`,`by`)??requires(e,`by2Bucket`,`by2`)??kindIssue(e)}),B=defineBlock({name:`agenda`,label:`Agenda`,icon:`calendar`,family:`data`,contexts:[`page`,`record`,`display`],layout:F,inputs:{query:P.query(),attribute:P.attribute(N,{types:[`date`]}),next:P.number().optional(),yearly:P.boolean().optional(),label:P.text().optional()}}),V=defineBlock({name:`card`,label:`Fiche`,icon:`user-square`,family:`data`,contexts:[`page`,`record`,`display`],layout:{size:{w:4,h:4},minWidth:3,height:`fit`,maxHeight:10},inputs:{object:P.object().optional(),record:P.record().optional(),fields:P.attribute(Pe).many().optional()},refine:(e,t)=>requires(e,`record`,`object`)??(t===`page`&&e.record===void 0?{input:`record`,message:`A card outside a record shows a chosen record: content.card(object).record(id)`}:void 0)}),H=defineBlock({name:`text_block`,label:`Texte`,icon:`type-text`,family:`layout`,contexts:[`page`,`record`,`display`],layout:{size:{w:12,h:2},minWidth:3,height:`fit`,maxHeight:16},inputs:{markdown:P.text()}}),U=defineBlock({name:`heading`,label:`Titre`,icon:`type-text`,family:`layout`,contexts:[`page`,`record`],layout:{size:{w:12,h:1},minWidth:6,height:`fit`,maxHeight:3},inputs:{title:P.text(),description:P.text().optional(),icon:P.text().optional()}}),W=defineBlock({name:`inbox`,label:`Boîte de réception`,icon:`inbox`,family:`people`,contexts:[`page`],layout:F,inputs:{kinds:P.enum(t.NOTIFICATION_KINDS).inSection(`data`).many().optional(),limit:P.number().optional()}}),G=defineBlock({name:`meetings_upcoming`,label:`Réunions à venir`,icon:`video`,family:`people`,contexts:[`page`],layout:F,inputs:{limit:P.number().optional()},refine:({limit:e})=>e===void 0||Number.isInteger(e)&&e>=1&&e<=50?void 0:{input:`limit`,message:`limit is a whole number from 1 to 50`}}),Le=defineBlock({name:`mailbox`,label:`E-mails`,icon:`envelope`,family:`people`,contexts:[`page`],layout:F,inputs:{category:P.emailCategory().optional(),important:P.boolean().optional().inSection(`data`),unread:P.boolean().optional().inSection(`data`),limit:P.number().optional(),label:P.text().optional()},refine:({limit:e})=>e===void 0||Number.isInteger(e)&&e>=1&&e<=50?void 0:{input:`limit`,message:`limit is a whole number from 1 to 50`}}),K=defineBlock({name:`record_links`,label:`Bubble`,icon:`share`,family:`context`,contexts:[`record`,`page`],layout:{size:{w:6,h:8},minWidth:6,height:`flexible`,minHeight:6,maxHeight:16},inputs:{center:P.enum([`record`,`me`]).optional().inSection(`data`),object:P.object().optional(),record:P.record().optional(),depth:P.enum([`1`,`2`,`3`,`4`,`5`]).optional()},refine:(e,t)=>requires(e,`record`,`object`)??(t===`page`&&e.center!==`me`&&e.record===void 0?{input:`record`,message:`Links outside a record centre on a chosen record or on the viewer: { object, record } or { center: "me" }`}:void 0)}),Re={name:`bubble`,type:`custom`,extension:K.name,placement:`main`,label:K.label,icon:K.icon,parameters:{}},q=defineBlock({name:`record_memory`,label:`Memories`,icon:`database`,family:`context`,contexts:[`record`],layout:{size:{w:6,h:8},minWidth:4,height:`flexible`,minHeight:4,maxHeight:16},inputs:{}}),ze={name:`memories`,type:`custom`,extension:q.name,placement:`main`,label:q.label,icon:q.icon,parameters:{}},Be=[Fe,R,z,B,V,H,U,W,G,Le,K,q],Ve=new Set([`name`,`label`,`icon`,`family`,`contexts`,`inputs`,`parameters`,`layout`,`refine`]),He=Be;var ContentExtensionRegistry=class{constructor(){this.extensions=new Map,this.seed()}register(e){let t=Array.isArray(e)?e:[e],r=new Set;t.forEach((e,t)=>{if(this.prepare(e,t),r.has(e.name))throw new n.DuplicateError(`content extension`,e.name);r.add(e.name)});for(let e of t)this.extensions.set(e.name,e);return this}prepare(e,t){let r=[`extensions`,String(t)],reject=e=>{throw new n.ValidationError(e,[{path:r,message:e}])};if((typeof e!=`object`||!e||Array.isArray(e))&&reject(`Expected a content extension declaration`),Object.keys(e).some(e=>!Ve.has(e))&&reject(`Expected only ${[...Ve].join(`, `)}`),(typeof e.name!=`string`||e.name.trim().length===0)&&reject(`API name must not be empty`),(!Array.isArray(e.contexts)||e.contexts.length===0||e.contexts.some(e=>!S.includes(e)))&&reject(`contexts must be a non-empty list of ${S.join(`, `)}`),typeof e.parameters?.safeParse!=`function`&&reject(`parameters must be a Zod schema`),this.extensions.has(e.name))throw new n.DuplicateError(`content extension`,e.name)}get(e){return this.extensions.get(e)}has(e){return this.extensions.has(e)}getAll(){return[...this.extensions.values()]}get size(){return this.extensions.size}clear(){this.extensions.clear(),this.seed()}seed(){for(let e of He)this.extensions.set(e.name,e)}};const Ue=new ContentExtensionRegistry,J=[3,4,6,8,9,12];function overlaps(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function findGridViolation(e,t={}){let n=Object.entries(e);for(let[e,{x:t,y:r,w:i,h:a}]of n){if(![t,r,i,a].every(Number.isInteger))return{path:[e],message:`Block "${e}" needs integer grid coordinates`};if(t<0||r<0||i<1||a<1)return{path:[e],message:`Block "${e}" needs x >= 0, y >= 0, w >= 1 and h >= 1`};if(t+i>12)return{path:[e],message:`Block "${e}" overflows the 12-column grid (x + w = ${t+i})`}}let r=n.filter(([e])=>t.exempt?.has(e)!==!0);for(let[e,[t,n]]of r.entries())for(let[i,a]of r.slice(e+1))if(overlaps(n,a))return{path:[i],message:`Blocks "${t}" and "${i}" overlap`}}function groupedMembers(e){let t=new Set(e.filter(e=>e.type!==`group`).map(e=>e.name)),n=new Set;for(let r of e)if(r.type===`group`)for(let e of r.members)t.has(e)&&n.add(e);return n}function memberlessGroups(e){let t=new Set(e.filter(e=>e.type!==`group`).map(e=>e.name));return new Set(e.flatMap(e=>e.type===`group`&&!e.members.some(e=>t.has(e))?[e.name]:[]))}function groupSizeMessage(e){return e>=2&&e<=r.SCHEMA_LIMITS.membersPerGroup?void 0:`A group holds 2 to ${r.SCHEMA_LIMITS.membersPerGroup} blocks, not ${e}`}function findGroupViolation(e){let t=new Map(e.map(e=>[e.name,e])),n=new Map;for(let r of e)if(r.type===`group`)for(let e of r.members){let i=t.get(e);if(i===void 0)return{path:[r.name],message:`Group "${r.name}" names "${e}", which is not a content of this page`};if(i.type===`group`)return{path:[r.name],message:`Group "${r.name}" cannot hold the group "${e}"`};let a=n.get(e);if(a!==void 0)return{path:[r.name],message:a===r.name?`Group "${r.name}" names "${e}" twice`:`"${e}" already belongs to the group "${a}"`};n.set(e,r.name)}}function boundsOf(e){let{minHeight:t,maxHeight:n}=e;return t!==void 0&&n!==void 0?`${t} to ${n} rows`:t===void 0?`at most ${String(n)} rows`:`at least ${t} rows`}function findRowLimitViolation(e){let t=Object.entries(e).find(([,e])=>e.y+e.h>r.SCHEMA_LIMITS.pageRows);if(t===void 0)return;let[n,i]=t;return{path:[n],message:`Block "${n}" ends at row ${i.y+i.h}, past the page's ${r.SCHEMA_LIMITS.pageRows} rows`}}function cellViolation(e,t,n){if(!J.includes(t.w))return{path:[e],message:`Block "${e}" width ${t.w} is not one of ${J.join(`, `)}`};if(t.w<n.minWidth)return{path:[e],message:`Block "${e}" width ${t.w} is below its minimum width ${n.minWidth}`};if(n.height===`flexible`&&(n.minHeight!==void 0&&t.h<n.minHeight||n.maxHeight!==void 0&&t.h>n.maxHeight))return{path:[e],message:`Block "${e}" height ${t.h} is outside its bounds (${boundsOf(n)})`}}function sharesRows(e,t){return e.y<t.y+t.h&&t.y<e.y+e.h}function findLayoutRuleViolation(e,t,n,r=new Set){let i=findRowLimitViolation(e);if(i!==void 0)return i;let a=groupedMembers(t),o=Object.entries(e).filter(([e])=>!a.has(e));for(let[e,t]of o){if(r.has(e))continue;let i=cellViolation(e,t,n(e));if(i!==void 0)return i}let[s,c]=o.filter(([e])=>!r.has(e)&&n(e).height===`fill`);if(s!==void 0&&c!==void 0)return{path:[c[0]],message:`Only one block may fill the page: "${s[0]}" and "${c[0]}" both do`};if(s===void 0)return;let[l,u]=s,d=o.find(([e,t])=>e!==l&&sharesRows(t,u));if(d!==void 0)return{path:[l],message:`Block "${l}" fills the page and must be alone in its rows; "${d[0]}" shares them`}}function findRelationAttribute(e,t){return e.attributes.find(e=>e.name===t&&e.type===`relation`)}function relationAcceptsObject(e,t){return e.targets.some(e=>e.object===t||e.object===`*`)}function singleRelationTarget(e){let[t,...n]=e.targets;return t&&n.length===0&&t.object!==`*`?t.object:void 0}function requireSingleRelationTarget(e,t=[e.name,`targets`]){let r=singleRelationTarget(e);if(r===void 0){let r=`Relation "${e.name}" requires one concrete collection target`;throw new n.ValidationError(r,[{path:t,message:r}])}return r}function collectionSourceAddress(e){return e.relation===void 0?{kind:`object`,object:e.object}:e.object===void 0?{kind:`related`,relation:e.relation}:{kind:`relatedFrom`,object:e.object,relation:e.relation}}function collectionSourceAddressOf(e){if(!e||typeof e!=`object`)return;let t=`object`in e?e.object:void 0,n=`relation`in e?e.relation:void 0;if(typeof t==`string`&&typeof n==`string`)return{kind:`relatedFrom`,object:t,relation:n};if(typeof t==`string`&&n===void 0)return{kind:`object`,object:t};if(typeof n==`string`&&t===void 0)return{kind:`related`,relation:n}}function sourcedAttributeOf(e,t){if(t.type===`richtext`)return typeof t.attribute==`string`&&e!==void 0?{object:e,attribute:t.attribute}:void 0;if(t.type!==`collection`)return;let n=collectionSourceAddressOf(t.source);if(n?.kind===`related`)return e===void 0?void 0:{object:e,attribute:n.relation};if(n?.kind===`relatedFrom`)return{object:n.object,attribute:n.relation}}function requireRecordContentContext(e,t,r){if(t!==`record`){let i=`Content "${e}" requires record context. In ${t===`page`?`a standalone page`:`a collection view`} only a collection that lists a whole object, or a custom content that does not require a record, is allowed.`;throw new n.ValidationError(i,[{path:r,message:i}])}}function resolveContentNavigation(e){let t=e.openMode??`page`;return{openMode:t,createMode:e.createMode??t}}function resolveCollectionActions(e,t){return[...new Set(t)].filter(t=>e.actions===void 0||e.actions.includes(t))}const We={collection:[`page`,`record`,`display`],group:[`page`,`record`],form:[`record`],activity:[`record`],richtext:[`record`],documents:[`record`],forms:[`record`],emails:[`record`],meetings:[`record`]},Y={collection:{size:{w:12,h:8},minWidth:6,height:`flexible`,minHeight:4,maxHeight:20},activity:{size:{w:12,h:8},minWidth:6,height:`flexible`},page:{size:{w:12,h:8},minWidth:6,height:`flexible`},group:{size:{w:6,h:4},minWidth:6,height:`flexible`}};function contentReadObjects(e,t,n){if(e.type!==`group`)return[...n(e)];let r=new Set;for(let i of e.members){let e=t.get(i);if(e!==void 0&&e.type!==`group`)for(let t of n(e))r.add(t)}return[...r]}function contentPlacementContexts(e,t){return e.type===`custom`?t?.contexts:e.type===`page`||e.type===`collection`&&collectionSourceAddress(e.source).kind!==`object`?[`record`]:We[e.type]}function requireContentPlacement(e,t,n,r,i){let a=contentPlacementContexts(e,t);a&&!a.includes(hostPlacementContext(r))&&(requireRecordContentContext(n,r,i),reject(i,`Content "${n}" cannot be placed in a record view or a record page`))}function hostPlacementContext(e){return e===`record`?`record`:`page`}function contentContextOf(e){return e.context===`page`&&e.object!==void 0?`record`:e.context}const Ge=new WeakSet;function violationOf(e,t,r,i){if(!(e instanceof n.SchemaError))throw e;let a=e instanceof n.ValidationError?e.errors[0]:void 0;return{key:JSON.stringify([t,r,e.code,Ge.has(e)?`Invalid content view`:e.message]),contentName:r,path:a?.path??i,message:e.message,code:e.code,error:e}}const Ke=new Map(getSystemAttributeList().map(e=>[e.name,e]));function reject(e,t){throw new n.ValidationError(t,[{path:e,message:t}])}function requireName(e,t){e.trim().length===0&&reject(t,`API name must not be empty`)}function indexUnique(e,t,r){let i=new Map;return e.forEach((e,a)=>{if(requireName(e.name,[...r,String(a),`name`]),i.has(e.name))throw new n.DuplicateError(t,e.name);i.set(e.name,e)}),i}function capped(e,t){let n=e.slice(0,t).join(`, `);return e.length>t?`${n} … and ${e.length-t} more`:n}function attributeInventory(e,t){return t.length===0?`Object "${e}" has no attributes yet.`:`Attributes of "${e}": ${capped(t,30)}`}function requireAttribute(e,t,n,r,i){if(requireName(t,n),!e)return;let a=e.attributes?.get(t)??Ke.get(t);if(!a){if(!e.attributes)return;let r=attributeInventory(e.name,[...e.attributes.keys()]);reject(n,`Unknown attribute "${e.name}.${t}". ${r}${i?.()??``}`)}let o=r===void 0?[]:[r].flat();return o.length>0&&!o.includes(a.type)&&reject(n,`Attribute "${e.name}.${t}" must have type ${o.join(` or `)}`),a}function collectContentViewCatalogue(e,t=`authoring`){let r=e.mode??`published`,i=new Map;e.objects.forEach((e,t)=>{if(requireName(e.name,[`objects`,String(t),`name`]),i.has(e.name))throw new n.DuplicateError(`object`,e.name);i.set(e.name,{name:e.name,attributes:indexUnique(e.attributes,`attribute`,[`objects`,String(t),`attributes`])})});let a=new Set;(e.reservedObjects??[]).forEach((e,t)=>{let n=[`reservedObjects`,String(t)];requireName(e,n),!i.has(e)&&(r!==`draft`&&reject(n,`Unresolved reserved object "${e}"`),a.add(e),i.set(e,{name:e}))});let o=indexUnique(e.extensions??[],`extension`,[`extensions`]);function resolveObject(e,t){requireName(e,t);let n=i.get(e);return n||reject(t,`Unknown object "${e}"`),n}function inverseAddresses(e){let t=[];for(let[n,r]of i)if(n!==e)for(let i of r.attributes?.values()??[])i.type===`relation`&&relationAcceptsObject(i,e)&&t.push(`relatedFrom("${n}", "${i.name}")`);return t.sort().slice(0,3)}let authoringSchemaWith=n=>r===`draft`?draftContentViewDefinitionSchemaFor():contentViewDefinitionSchemaFor({traits:t===`structural`?null:(e,t)=>layoutTraitsOf(e,o,t),viewerFiltered:e.viewerFiltered,...n===void 0?{}:{statics:n}}),s=authoringSchemaWith(),c=r===`draft`||t===`structural`?s:contentViewDefinitionSchemaFor({traits:null,viewerFiltered:e.viewerFiltered}),schemaFor=t=>{if(e.authoringViews!==void 0&&!e.authoringViews.has(t))return c;let n=e.staticsOf?.(t);return n===void 0||n.size===0?s:authoringSchemaWith(n)},l=new Map,u=new Map,d=[],f=[];function parseView(e,t,r){let i=schemaFor(r).safeParse(e);if(!i.success){let r=new n.ValidationError(invalidViewMessage(e,i.error.issues[0]),i.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message,code:e.code})));throw Ge.add(r),r}let a=i.data;requireName(a.name,[...t,`name`]);let o=a.object??``,s=l.get(o)??new Set;if(s.has(a.name))throw new n.DuplicateError(`view`,`${o}.${a.name}`);if(s.add(a.name),l.set(o,s),a.context!==`page`&&a.default){let e=u.get(a.object)??new Set;if(e.has(a.context))throw new n.DuplicateError(`default view`,`${a.object}.${a.context}`);e.add(a.context),u.set(a.object,e)}return a}return e.views.forEach((e,t)=>{let n=[`views`,String(t)],r=e,i=`${String(r?.object??`?`)}.${String(r?.name??t)}`,a,s;try{a=parseView(e,n,t),s=a.object===void 0?void 0:resolveObject(a.object,[...n,`object`])}catch(e){d.push(violationOf(e,i,null,n));return}a.contents.forEach((e,t)=>{let r=[...n,`contents`,String(t)];try{requireName(e.name,[...r,`name`]),validateContent(e,r,s,contentContextOf(a),o,resolveObject,inverseAddresses)}catch(t){d.push(violationOf(t,i,e.name,r))}}),f.push(a)}),f.forEach((t,r)=>{t.contents.forEach((i,a)=>{if(i.type!==`page`)return;let o=[`views`,String(r),`contents`,String(a),`page`],s=f.find(e=>e.context===`page`&&e.object===i.page.object&&e.name===i.page.name),c=t.context===`page`?`Content "${i.name}" cannot reference a page from a page`:t.object===i.page.object?s||e.complete!==!0?void 0:`Unknown page "${i.page.object}.${i.page.name}"`:`Content "${i.name}" must reference a page of "${String(t.object)}", not of "${i.page.object}"`;c!==void 0&&d.push(violationOf(new n.ValidationError(c,[{path:o,message:c}]),`${String(t.object)}.${t.name}`,i.name,o))})}),{views:f,unresolvedObjects:[...a].sort(),violations:d}}function validateStoredViews(e){let t=collectContentViewCatalogue(e,`structural`).violations[0];if(t)throw t.error}function describeViewIssue(e){let t=e.path.length>0?` (${e.path.map(String).join(`.`)})`:``;return`${e.message}${t}`}function invalidViewMessage(e,t){let n=typeof e==`object`&&e?e:{},r=typeof n.name==`string`?` "${n.name}"`:``,i=typeof n.object==`string`?` of "${n.object}"`:``;return t?`Invalid content view${r}${i}: ${describeViewIssue(t)}`:`Invalid content view${r}${i}`}function validateContentViewCatalogue(e){let{views:t,unresolvedObjects:n,violations:r}=collectContentViewCatalogue(e),i=r[0];if(i)throw i.error;return{views:t,unresolvedObjects:n}}function resolveStoredQuery(e,t,n,{owner:r,requireRecord:i,resolveObject:a,inverseAddresses:o}){let s=collectionSourceAddress(e.source),c,l;if(s.kind===`object`)c=a(s.object,[...t,`source`,`object`]);else if(s.kind===`related`){i();let e=[...t,`source`,`relation`],hint=()=>{if(!r)return``;let e=o(r.name);return e.length===0?``:`. Records pointing at "${r.name}" are addressed from the other side: ${e.join(`, `)}`},n=requireAttribute(r,s.relation,e,`relation`,hint);n?.type===`relation`&&(l=n,c=a(requireSingleRelationTarget(n,e),e))}else{i(),c=a(s.object,[...t,`source`,`object`]);let o=[...t,`source`,`relation`],l=requireAttribute(c,s.relation,o,`relation`);if(l?.type===`relation`&&r&&!relationAcceptsObject(l,r.name)){let e=l.targets.map(e=>`"${e.object}"`).join(`, `);reject(o,`Relation "${s.object}.${s.relation}" targets ${e}, not "${r.name}"`)}e.filters?.combinator===`or`&&reject([...t,`filters`,`combinator`],`${n} addresses "${s.object}" from the far side, so its filters must use the "and" combinator`)}return e.sorts?.forEach((e,n)=>requireAttribute(c,e.attribute,[...t,`sorts`,String(n),`attribute`])),e.filters?.rules.forEach((e,n)=>requireAttribute(c,e.attribute,[...t,`filters`,`rules`,String(n),`attribute`])),{target:c,relationAttribute:l}}function validateBlockReferences(e,t,n,r){let i=Object.entries(e.inputs),a;for(let[o,s]of i){let i=t[o];s.kind===`query`&&i!==void 0&&(a=resolveStoredQuery(i,[...n,o],`Block "${e.name}"`,r).target)}function attributeScope(o){if(o===void 0)return;if(o===`$query`)return a;if(o!==`$record`)return r.resolveObject(o,n);let s=i.find(([,e])=>e.kind===`object`)?.[0],c=s===void 0?void 0:t[s];return typeof c==`string`?r.resolveObject(c,[...n,s??`object`]):(r.owner||reject(n,`Block "${e.name}" names attributes, so it needs an object or a record host`),r.owner)}for(let[e,r]of i){let i=t[e];if(r.kind!==`attribute`||i===void 0)continue;let a=attributeScope(r.of);(Array.isArray(i)?i:[i]).forEach((t,o)=>{if(typeof t!=`string`)return;let s=Array.isArray(i)?[...n,e,String(o)]:[...n,e];requireAttribute(a,t,s,r.options?.types)})}for(let[r,a]of i){let i=a.when?.key,o=i===void 0?void 0:e.inputs[i],s=i===void 0?void 0:t[i];a.kind===`period`&&t[r]!==void 0&&o?.kind===`attribute`&&typeof s==`string`&&requireAttribute(attributeScope(o.of),s,[...n,i??r],[`date`])}}function validateContent(e,t,r,i,a,o,s){function requireRecord(){requireRecordContentContext(e.name,i,t)}let c={owner:r,requireRecord,resolveObject:o,inverseAddresses:s},l=hostPlacementContext(i);if(e.type===`custom`){let r=a.get(e.extension);r||reject([...t,`extension`],`Unknown extension "${e.extension}"`),contentPlacementContexts(e,r)?.includes(l)||reject([...t,`extension`],`${e.extension} cannot be placed here`);let i=r.parameters.safeParse(structuredClone(e.parameters??{}));if(!i.success)throw new n.ValidationError(`Invalid extension parameters`,i.error.issues.map(e=>({path:[...t,`parameters`,...e.path.map(String)],message:e.message,code:e.code})));let o=i.data,s=r.refine?.(o,l);s&&reject([...t,`parameters`,s.input],s.message),validateBlockReferences(r,o,[...t,`parameters`],c);return}if(requireContentPlacement(e,void 0,e.name,i,t),e.type!==`page`&&e.type!==`group`){if(e.type===`collection`){let{target:n,relationAttribute:r}=resolveStoredQuery(e,t,`Collection "${e.name}"`,c);e.columns?.forEach((e,i)=>{let a=[...t,`columns`,String(i)];if(typeof e==`string`){requireAttribute(n,e,a);return}let o=[...a,`relationProperty`];r||reject(o,`Relation property columns require a relation source`),r.properties?.definitions.some(t=>t.name===e.relationProperty)||reject(o,`Unknown relation property "${e.relationProperty}"`)}),e.displayAttributes?.forEach((e,r)=>requireAttribute(n,e,[...t,`displayAttributes`,String(r)])),e.descriptionAttribute!==void 0&&requireAttribute(n,e.descriptionAttribute,[...t,`descriptionAttribute`]),e.layout===`kanban`&&e.groupByAttribute!==void 0&&requireAttribute(n,e.groupByAttribute,[...t,`groupByAttribute`]);return}switch(e.type){case`form`:e.groups.forEach((e,n)=>{let i=[...t,`groups`,String(n)];requireName(e.name,[...i,`name`]),e.fields.forEach((e,t)=>requireAttribute(r,e.attribute,[...i,`fields`,String(t),`attribute`]))});break;case`richtext`:requireAttribute(r,e.attribute,[...t,`attribute`],`richtext`),e.titleAttribute!==void 0&&requireAttribute(r,e.titleAttribute,[...t,`titleAttribute`],`text`);break;case`emails`:case`meetings`:e.emailAttributes.forEach((e,n)=>requireAttribute(r,e,[...t,`emailAttributes`,String(n)],`text`));break;case`documents`:e.relations?.forEach((e,n)=>requireAttribute(r,e,[...t,`relations`,String(n)],`relation`));break;case`forms`:e.objectName!==void 0&&o(e.objectName,[...t,`objectName`]);break;case`activity`:break;default:reject(t,`Unknown content type: ${String(e)}`)}}}const X=Object.freeze({size:Object.freeze({w:4,h:4}),minWidth:3,height:`flexible`,minHeight:2,figure:!1});function resolveLayout(e){return e===void 0?X:{size:e.size??X.size,minWidth:e.minWidth??X.minWidth,height:e.height??X.height,...e.minHeight===void 0?{}:{minHeight:e.minHeight},...e.maxHeight===void 0?{}:{maxHeight:e.maxHeight},figure:e.figure??!1}}function baseTraitsOf(e,t){return e.type===`custom`?resolveLayout(t.get(e.extension)?.layout):e.type in Y?resolveLayout(Y[e.type]):X}function widthCovering(e){return J.find(t=>t>=e)??12}function boundOf(e,t){let n=e.filter(e=>e!==void 0);return n.length===0?void 0:t(...n)}function groupTraitsOf(e){if(e.length===0)return resolveLayout(Y.group);let sum=t=>e.reduce((e,n)=>e+t(n),0),t={w:widthCovering(sum(e=>e.size.w)),h:Math.max(...e.map(e=>e.size.h))},n=widthCovering(sum(e=>e.minWidth)),r=e.every(e=>e.figure);if(e.every(e=>e.height===`fit`)){let i=boundOf(e.map(e=>e.maxHeight),Math.max);return{size:t,minWidth:n,height:`fit`,...i===void 0?{}:{maxHeight:i},figure:r}}let i=e.filter(e=>e.height!==`fit`),a=boundOf(i.map(e=>e.minHeight),Math.max),o=boundOf(i.map(e=>e.maxHeight),Math.min),s=o===void 0?void 0:Math.max(o,a??o);return{size:t,minWidth:n,height:`flexible`,...a===void 0?{}:{minHeight:a},...s===void 0?{}:{maxHeight:s},figure:r}}function layoutTraitsOf(e,t,n){let r=e.type===`group`?groupTraitsOf(e.members.flatMap(e=>{let r=n?.get(e);return r===void 0||r.type===`group`?[]:[layoutTraitsOf(r,t)]})):baseTraitsOf(e,t);return e.height===void 0?r:{...r,height:e.height}}function pageTraitsOf(e,t){return n=>{let r=e.get(n);return r?layoutTraitsOf(r,t,e):X}}const qe=1e4;function isPlainJsonObject(e){let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null&&t.constructor?.name===`Object`}function addJsonIssue(e,t,n=[]){e.addIssue({code:`custom`,message:t,path:n})}function pushJsonArrayChildren(e,t,n,r){for(let n of Reflect.ownKeys(e))if(n!==`length`){if(n===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,[...t.path,n]);continue}(typeof n==`symbol`||!/^(0|[1-9]\d*)$/.test(n))&&addJsonIssue(r,`Arrays cannot contain non-index JSON properties`,[...t.path,n])}for(let i=e.length-1;i>=0;i--){let a=Object.getOwnPropertyDescriptor(e,String(i)),o=[...t.path,i];if(!(a&&`value`in a)){addJsonIssue(r,`Sparse arrays are not valid JSON values`,o);continue}n.push({kind:`enter`,value:a.value,path:o,depth:t.depth+1})}}function pushJsonObjectChildren(e,t,n,r){let i=Reflect.ownKeys(e);for(let a=i.length-1;a>=0;a--){let o=i[a],s=[...t.path,o];if(o===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,s);continue}if(typeof o==`symbol`){addJsonIssue(r,`Symbol keys are not valid JSON keys`,s);continue}let c=Object.getOwnPropertyDescriptor(e,o);if(!(c?.enumerable&&`value`in c)){addJsonIssue(r,`Custom props must contain enumerable data properties only`,s);continue}n.push({kind:`enter`,value:c.value,path:s,depth:t.depth+1})}}function validateJsonProps(e,t){if(typeof e!=`object`||!e){addJsonIssue(t,`Expected a plain JSON object`);return}try{if(Array.isArray(e)||!isPlainJsonObject(e)){addJsonIssue(t,`Expected a plain JSON object`);return}}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`);return}let n=new WeakSet,r=[{kind:`enter`,value:e,path:[],depth:0}],i=0;for(;r.length>0;){let e=r.pop();if(!e)break;if(e.kind===`exit`){n.delete(e.value);continue}if(i++,i>qe){addJsonIssue(t,`Custom props cannot exceed ${qe.toLocaleString(`en-US`)} total JSON nodes`,e.path);return}if(e.depth>64){addJsonIssue(t,`Custom props cannot exceed depth 64`,e.path);continue}let a=e.value;if(!(a===null||typeof a==`string`||typeof a==`boolean`||typeof a==`number`&&Number.isFinite(a))){if(typeof a!=`object`){addJsonIssue(t,`Expected a JSON value`,e.path);continue}if(n.has(a)){addJsonIssue(t,`Custom props cannot contain circular references`,e.path);continue}try{if(Array.isArray(a)){n.add(a),r.push({kind:`exit`,value:a}),pushJsonArrayChildren(a,e,r,t);continue}if(!isPlainJsonObject(a)){addJsonIssue(t,`Expected an array or plain JSON object`,e.path);continue}n.add(a),r.push({kind:`exit`,value:a}),pushJsonObjectChildren(a,e,r,t)}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`,e.path)}}}}const Je=i.unknown().superRefine(validateJsonProps).transform(e=>e),Ye={span:i.union([i.literal(1),i.literal(2),i.literal(3),i.literal(4),i.literal(5),i.literal(6),i.literal(7),i.literal(8),i.literal(9),i.literal(10),i.literal(11),i.literal(12)]).optional().describe(`Columns of 12 this field occupies`),label:i.string().optional().describe(`Overrides the attribute's label`),readOnly:i.boolean().optional().describe(`Shows the value, not editable`)},Xe=i.object({attribute:i.string().describe(`Attribute API name shown by this field`),...Ye}).strict(),Ze=i.object({name:i.string().describe(`Group API name, unique in the form`),label:i.string().describe(`Label people see`),description:i.string().optional().describe(`Extra context under the label`),collapsible:i.boolean().optional().describe(`Whether the group can be collapsed`),collapsed:i.boolean().optional().describe(`Whether the group starts collapsed`),fields:i.array(Xe).max(r.SCHEMA_LIMITS.fieldsPerGroup).describe(`Fields in this group, in order`)}).strict();function refineFormContent(e,t){e.groups.reduce((e,t)=>e+t.fields.length,0)>r.SCHEMA_LIMITS.fieldsPerFormTab&&t.addIssue({code:`too_big`,origin:`array`,maximum:r.SCHEMA_LIMITS.fieldsPerFormTab,inclusive:!0,message:`A form content can contain at most ${r.SCHEMA_LIMITS.fieldsPerFormTab} fields`,path:[`groups`]});let n=new Set,i=new Set;e.groups.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate group name "${e.name}"`,path:[`groups`,r,`name`]}),n.add(e.name),e.fields.forEach((e,n)=>{i.has(e.attribute)&&t.addIssue({code:`custom`,message:`Duplicate field attribute "${e.attribute}"`,path:[`groups`,r,`fields`,n,`attribute`]}),i.add(e.attribute)})})}const Z={name:i.string().describe(`Content API name, unique in the view`),label:i.string().optional().describe(`Label people see`),icon:r.iconNameSchema.optional().describe(`Icon name`),placement:i.enum([`main`,`aside`,`grid`]).describe(`main: the tab strip. aside: the side panel. grid: a page block`),height:i.enum([`fit`,`flexible`,`fill`]).optional().describe(`Page block height: fit (content), flexible (between bounds) or fill (whole page, one per page)`)},Qe={...Z,type:i.literal(`collection`),source:j.describe(`object: every record; relation: records linked to this record; both: records of object whose relation points at this record`),visibility:i.enum(r.LIST_VIEW_TAB_VISIBILITIES).optional().describe(`all: no scope; workspace: every member; private: viewer's own; shared: private records other members shared with the viewer`),columns:i.array(i.union([i.string(),i.object({relationProperty:i.string().refine(e=>e.trim().length>0).describe(`Qualified edge property shown as a column`)}).strict()])).max(r.SCHEMA_LIMITS.columnsPerTab).optional().describe(`Table columns, in order`),descriptionAttribute:i.string().optional().describe(`Secondary line under each row's title (list layout)`),displayAttributes:Se.optional().describe(`Attributes shown on each card`),filters:A.optional().describe(`Restricts which records show`),sorts:k.optional().describe(`Sort order`),actions:i.enum([`create`,`update`,`delete`,`attach`,`detach`]).array().optional().describe(`Offered actions; absent = every action, [] = none`),openMode:i.enum([`page`,`peek`]).optional().describe(`page or peek (the record panel)`),createMode:i.enum([`page`,`peek`,`inline`]).optional().describe(`page, peek, or inline (creates without opening)`)},$e=i.object({...Qe,layout:i.enum([`table`,`list`,`kanban`]).describe(`table columns, list cards, kanban board grouped by a select/status attribute`),columnSizing:i.record(i.string(),i.number()).optional().describe(`Column widths in pixels, by attribute name`),groupByAttribute:i.string().optional().describe(`Kanban only: the select or status attribute that names the columns`),kanbanColumnOrder:i.array(i.string()).optional().describe(`Kanban: column order by option value`),kanbanColumnVisibility:i.record(i.string(),i.boolean()).optional().describe(`Kanban: which columns are shown`),kanbanPinnedColumns:i.array(i.string()).optional().describe(`Kanban: columns pinned first`)}).strict().superRefine((e,t)=>{let n=[`groupByAttribute`,`kanbanColumnOrder`,`kanbanColumnVisibility`,`kanbanPinnedColumns`];if(e.layout===`kanban`){e.groupByAttribute===void 0&&t.addIssue({code:`custom`,path:[`groupByAttribute`],message:`A kanban layout requires groupByAttribute`});return}for(let r of n)e[r]!==void 0&&t.addIssue({code:`custom`,path:[r],message:`Only a kanban layout groups by an attribute`})}),Q={...Z,type:i.literal(`form`),groups:i.array(Ze).max(r.SCHEMA_LIMITS.groupsPerFormTab).describe(`Field groups, in order`),formColumns:i.union([i.literal(1),i.literal(2),i.literal(3)]).optional().describe(`Grid columns, 1-3`),density:i.enum([`compact`,`comfortable`,`spacious`]).optional().describe(`Vertical spacing between fields`)},et=i.object(Q).strict().superRefine(refineFormContent),tt=i.object({...Q,groups:Q.groups.min(1,`A published form content requires at least one group`)}).strict().superRefine(refineFormContent),nt=[$e,i.object({...Z,type:i.literal(`group`),placement:i.literal(`grid`).describe(`Always grid`),members:i.array(i.string()).min(1).max(r.SCHEMA_LIMITS.membersPerGroup).describe(`Contents side by side`)}).strict(),i.object({...Z,type:i.literal(`custom`),extension:i.string().describe(`Name of a registered extension`),parameters:i.lazy(()=>Je).optional().describe(`Extension parameters`)}).strict(),i.object({...Z,type:i.literal(`activity`)}).strict(),i.object({...Z,type:i.literal(`richtext`),attribute:i.string().describe(`Richtext attribute edited in place`),titleAttribute:i.string().optional().describe(`Text attribute shown as the title`)}).strict(),i.object({...Z,type:i.literal(`documents`),allowUpload:i.boolean().optional().describe(`Lets people add files here`),allowRemove:i.boolean().optional().describe(`Lets people remove files here`),hideAttachments:i.boolean().optional().describe(`Hides files attached elsewhere (e.g. emails)`),relations:i.array(i.string()).optional().describe(`Document relations shown; the record's own files if absent`)}).strict(),i.object({...Z,type:i.literal(`forms`),objectName:i.string().optional().describe(`Limits to this object's published forms`)}).strict(),i.object({...Z,type:i.literal(`emails`),emailAttributes:i.array(i.string()).max(r.SCHEMA_LIMITS.emailAttributesPerTab).describe(`Addresses`)}).strict(),i.object({...Z,type:i.literal(`meetings`),emailAttributes:i.array(i.string()).max(r.SCHEMA_LIMITS.emailAttributesPerTab).describe(`Addresses`)}).strict(),i.object({...Z,type:i.literal(`page`),page:i.object({object:i.string().describe(`Its object`),name:i.string().describe(`Its name`)}).strict().describe(`The record page this tab renders`)}).strict()],rt=i.discriminatedUnion(`type`,[et,...nt]),$=i.discriminatedUnion(`type`,[tt,...nt]),it={name:i.string(),label:i.string(),description:i.string().optional(),icon:r.iconNameSchema.optional()},at=i.object({x:i.number().describe(`Column`),y:i.number().describe(`Row`),w:i.number().describe(`Width: 3, 4, 6, 8, 9 or 12; x + w ≤ 12`),h:i.number().describe(`Height`)}).strict();function contentViewBaseSchemaFor(e){let t=i.array(e).max(r.SCHEMA_LIMITS.tabsPerView);return i.discriminatedUnion(`context`,[i.object({...it,object:i.string(),context:i.enum([`collection`,`record`]),default:i.boolean().optional(),anchors:i.record(i.string(),i.object({after:i.string()}).strict()).optional(),contents:t}).strict(),i.object({...it,object:i.string().optional(),context:i.literal(`page`),home:i.boolean().optional(),grid:i.record(i.string(),at).refine(e=>Object.keys(e).length<=r.SCHEMA_LIMITS.tabsPerView,{message:`A page holds at most ${r.SCHEMA_LIMITS.tabsPerView} blocks`}),contents:t}).strict()])}const ot=contentViewBaseSchemaFor(rt),st=contentViewBaseSchemaFor($);function registryTraits(e,t){return layoutTraitsOf(e,Ue,t)}function addGroupSizeIssues(e,t){for(let n of e.contents){let e=n.type===`group`?groupSizeMessage(n.members.length):void 0;e&&t.addIssue({code:`custom`,message:e,path:[`contents`]})}}function addDuplicateContentNameIssues(e,t){let n=new Set;e.contents.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate content name "${e.name}"`,path:[`contents`,r,`name`]}),n.add(e.name)})}function addPlacementIssues(e,t){e.contents.forEach((n,r)=>{let i=n.placement===`grid`;e.context===`page`&&!i&&t.addIssue({code:`custom`,message:`Content "${n.name}" of a page must be placed on the grid`,path:[`contents`,r,`placement`]}),e.context!==`page`&&i&&t.addIssue({code:`custom`,message:`Content "${n.name}" cannot be placed on a grid outside a page`,path:[`contents`,r,`placement`]})})}function addIssue(e,t){e.addIssue({code:`custom`,message:t.message,path:[`grid`,...t.path]})}function addGridIssues(e,t,n,r){if(e.context!==`page`||!e.grid)return;let i=new Set(e.contents.map(e=>e.name)),a=groupedMembers(e.contents);for(let n of i)a.has(n)||Object.hasOwn(e.grid,n)||t.addIssue({code:`custom`,message:`Content "${n}" has no grid position`,path:[`grid`]});let o=Object.keys(e.grid).filter(e=>!i.has(e));for(let e of o)t.addIssue({code:`custom`,message:`Grid position "${e}" matches no content`,path:[`grid`,e]});if(e.home&&e.object!==void 0&&t.addIssue({code:`custom`,message:`Only a standalone page can be the home`,path:[`home`]}),o.length>0)return;let s=findGridViolation(e.grid,{exempt:a});if(s){addIssue(t,s);return}if(n===null)return;let c=findGroupViolation(e.contents);if(c){t.addIssue({code:`custom`,message:c.message,path:[`contents`]});return}let l=new Map(e.contents.map(e=>[e.name,e])),u=findLayoutRuleViolation(e.grid,e.contents,e=>n(l.get(e),l),r);u&&addIssue(t,u)}function draftContentViewDefinitionSchemaFor(){return ot.superRefine((e,t)=>{let n=e;addDuplicateContentNameIssues(n,t),addPlacementIssues(n,t),addGridIssues(n,t,null)})}function contentViewDefinitionSchemaFor(e={}){let t=e.traits===void 0?registryTraits:e.traits;return st.superRefine((n,r)=>{let i=n;addDuplicateContentNameIssues(i,r),addPlacementIssues(i,r),addGridIssues(i,r,t,e.statics),e.viewerFiltered||addGroupSizeIssues(i,r),n.context!==`page`&&!n.contents.some(e=>e.placement===`main`)&&r.addIssue({code:`custom`,message:`A published view requires at least one main content`,path:[`contents`]})})}const ct=draftContentViewDefinitionSchemaFor(),lt=contentViewDefinitionSchemaFor();Object.defineProperty(exports,"AGENDA_BLOCK",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"ARTIFACT_PREVIEW_EXTENSION",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"ATTRIBUTE_FILTER_OPERATORS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"ATTRIBUTE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"BLOCK_CONTEXTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"BLOCK_PERIODS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"BLOCK_WIDTHS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"CARD_BLOCK",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"CHART_BLOCK",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"CHART_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"CONTENT_PLACEMENT_CONTEXTS",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"DEFAULT_LAYOUT_TRAITS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"GROUPABLE_ATTRIBUTE_TYPES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"HEADING_BLOCK",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"INBOX_BLOCK",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"INVENTORY_LIMIT",{enumerable:!0,get:function(){return 30}}),Object.defineProperty(exports,"LOCATION_FILTER_PROPERTIES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"MAILBOX_BLOCK",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"MEASURABLE_ATTRIBUTE_TYPES",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"MEETINGS_UPCOMING_BLOCK",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"METRIC_BLOCK",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"NATIVE_BLOCKS",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"NO_VALUE_OPERATORS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"OPERATORS_BY_TYPE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"PAGE_GRID_COLUMNS",{enumerable:!0,get:function(){return 12}}),Object.defineProperty(exports,"QUALIFIED_SEPARATOR",{enumerable:!0,get:function(){return`__`}}),Object.defineProperty(exports,"QUERY_OBJECT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"RECORD_LINKS_BLOCK",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"RECORD_LINKS_CONTENT",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"RECORD_MEMORY_BLOCK",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"RECORD_MEMORY_CONTENT",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"RECORD_OBJECT",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"RELATION_TARGET_ANY",{enumerable:!0,get:function(){return`*`}}),Object.defineProperty(exports,"REMOVED_OPERATOR_REPLACEMENTS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"RecordQuery",{enumerable:!0,get:function(){return RecordQuery}}),Object.defineProperty(exports,"SYNONYM_ALIASES",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"SYSTEM_ATTRIBUTES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"SYSTEM_ATTRIBUTE_I18N_KEYS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"SYSTEM_FILTER_ATTRIBUTE_TYPES",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"TEXT_BLOCK",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"attributeFilterTarget",{enumerable:!0,get:function(){return attributeFilterTarget}}),Object.defineProperty(exports,"attributeInventory",{enumerable:!0,get:function(){return attributeInventory}}),Object.defineProperty(exports,"blockObjectInputs",{enumerable:!0,get:function(){return blockObjectInputs}}),Object.defineProperty(exports,"buildQualifiedAttribute",{enumerable:!0,get:function(){return buildQualifiedAttribute}}),Object.defineProperty(exports,"canonicalizeFilterValue",{enumerable:!0,get:function(){return canonicalizeFilterValue}}),Object.defineProperty(exports,"capped",{enumerable:!0,get:function(){return capped}}),Object.defineProperty(exports,"collectContentViewCatalogue",{enumerable:!0,get:function(){return collectContentViewCatalogue}}),Object.defineProperty(exports,"collectQualifiedRuleIssues",{enumerable:!0,get:function(){return collectQualifiedRuleIssues}}),Object.defineProperty(exports,"collectionContentSourceSchema",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"collectionSourceAddress",{enumerable:!0,get:function(){return collectionSourceAddress}}),Object.defineProperty(exports,"collectionSourceAddressOf",{enumerable:!0,get:function(){return collectionSourceAddressOf}}),Object.defineProperty(exports,"columnsSchema",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"contentExtensionRegistry",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"contentReadObjects",{enumerable:!0,get:function(){return contentReadObjects}}),Object.defineProperty(exports,"contentViewDefinitionSchema",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"contentViewDefinitionSchemaFor",{enumerable:!0,get:function(){return contentViewDefinitionSchemaFor}}),Object.defineProperty(exports,"currentActor",{enumerable:!0,get:function(){return currentActor}}),Object.defineProperty(exports,"defineBlock",{enumerable:!0,get:function(){return defineBlock}}),Object.defineProperty(exports,"describeViewIssue",{enumerable:!0,get:function(){return describeViewIssue}}),Object.defineProperty(exports,"displayAttributesSchema",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"draftContentViewDefinitionSchema",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"draftContentViewDefinitionSchemaFor",{enumerable:!0,get:function(){return draftContentViewDefinitionSchemaFor}}),Object.defineProperty(exports,"edgePropertyFilterTarget",{enumerable:!0,get:function(){return edgePropertyFilterTarget}}),Object.defineProperty(exports,"extractCurrencyFilterValue",{enumerable:!0,get:function(){return extractCurrencyFilterValue}}),Object.defineProperty(exports,"extractFilterValue",{enumerable:!0,get:function(){return extractFilterValue}}),Object.defineProperty(exports,"filterOperatorsOfType",{enumerable:!0,get:function(){return filterOperatorsOfType}}),Object.defineProperty(exports,"filterStateSchema",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"filterTargetsOf",{enumerable:!0,get:function(){return filterTargetsOf}}),Object.defineProperty(exports,"findGridViolation",{enumerable:!0,get:function(){return findGridViolation}}),Object.defineProperty(exports,"findGroupViolation",{enumerable:!0,get:function(){return findGroupViolation}}),Object.defineProperty(exports,"findLayoutRuleViolation",{enumerable:!0,get:function(){return findLayoutRuleViolation}}),Object.defineProperty(exports,"findRelationAttribute",{enumerable:!0,get:function(){return findRelationAttribute}}),Object.defineProperty(exports,"findRowLimitViolation",{enumerable:!0,get:function(){return findRowLimitViolation}}),Object.defineProperty(exports,"getAttributeCapabilities",{enumerable:!0,get:function(){return getAttributeCapabilities}}),Object.defineProperty(exports,"getAttributeFilterOperators",{enumerable:!0,get:function(){return getAttributeFilterOperators}}),Object.defineProperty(exports,"getOperatorPolarity",{enumerable:!0,get:function(){return getOperatorPolarity}}),Object.defineProperty(exports,"getRollupFilterOperators",{enumerable:!0,get:function(){return getRollupFilterOperators}}),Object.defineProperty(exports,"getSystemAttributeI18nKey",{enumerable:!0,get:function(){return getSystemAttributeI18nKey}}),Object.defineProperty(exports,"getSystemAttributeList",{enumerable:!0,get:function(){return getSystemAttributeList}}),Object.defineProperty(exports,"gridPositionSchema",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"groupSizeMessage",{enumerable:!0,get:function(){return groupSizeMessage}}),Object.defineProperty(exports,"groupedMembers",{enumerable:!0,get:function(){return groupedMembers}}),Object.defineProperty(exports,"inferInverseCardinality",{enumerable:!0,get:function(){return inferInverseCardinality}}),Object.defineProperty(exports,"input",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"invalidViewMessage",{enumerable:!0,get:function(){return invalidViewMessage}}),Object.defineProperty(exports,"isAttributeFilterable",{enumerable:!0,get:function(){return isAttributeFilterable}}),Object.defineProperty(exports,"isAttributeGroupable",{enumerable:!0,get:function(){return isAttributeGroupable}}),Object.defineProperty(exports,"isAttributeKanbanGroupable",{enumerable:!0,get:function(){return isAttributeKanbanGroupable}}),Object.defineProperty(exports,"isAttributeSearchable",{enumerable:!0,get:function(){return isAttributeSearchable}}),Object.defineProperty(exports,"isAttributeSortable",{enumerable:!0,get:function(){return isAttributeSortable}}),Object.defineProperty(exports,"isBilateralRelation",{enumerable:!0,get:function(){return isBilateralRelation}}),Object.defineProperty(exports,"isCalendarDay",{enumerable:!0,get:function(){return isCalendarDay}}),Object.defineProperty(exports,"isDynamicValue",{enumerable:!0,get:function(){return isDynamicValue}}),Object.defineProperty(exports,"isLocationFilterProperty",{enumerable:!0,get:function(){return isLocationFilterProperty}}),Object.defineProperty(exports,"isLocationPartOperator",{enumerable:!0,get:function(){return isLocationPartOperator}}),Object.defineProperty(exports,"isManagedSystemAttribute",{enumerable:!0,get:function(){return isManagedSystemAttribute}}),Object.defineProperty(exports,"isNoValueOperator",{enumerable:!0,get:function(){return isNoValueOperator}}),Object.defineProperty(exports,"isRelativeDateValue",{enumerable:!0,get:function(){return isRelativeDateValue}}),Object.defineProperty(exports,"isSetMembershipOperator",{enumerable:!0,get:function(){return isSetMembershipOperator}}),Object.defineProperty(exports,"isUniversalRelation",{enumerable:!0,get:function(){return isUniversalRelation}}),Object.defineProperty(exports,"layoutTraitsOf",{enumerable:!0,get:function(){return layoutTraitsOf}}),Object.defineProperty(exports,"locationPartFilterTarget",{enumerable:!0,get:function(){return locationPartFilterTarget}}),Object.defineProperty(exports,"memberlessGroups",{enumerable:!0,get:function(){return memberlessGroups}}),Object.defineProperty(exports,"metricComparePeriod",{enumerable:!0,get:function(){return metricComparePeriod}}),Object.defineProperty(exports,"normalizeFilterRule",{enumerable:!0,get:function(){return normalizeFilterRule}}),Object.defineProperty(exports,"normalizeForEdgeRpc",{enumerable:!0,get:function(){return normalizeForEdgeRpc}}),Object.defineProperty(exports,"normalizeOperator",{enumerable:!0,get:function(){return normalizeOperator}}),Object.defineProperty(exports,"now",{enumerable:!0,get:function(){return now}}),Object.defineProperty(exports,"overlaps",{enumerable:!0,get:function(){return overlaps}}),Object.defineProperty(exports,"pageTraitsOf",{enumerable:!0,get:function(){return pageTraitsOf}}),Object.defineProperty(exports,"parseBlockParameters",{enumerable:!0,get:function(){return parseBlockParameters}}),Object.defineProperty(exports,"parseQualifiedAttribute",{enumerable:!0,get:function(){return parseQualifiedAttribute}}),Object.defineProperty(exports,"publishedViewContentDefinitionSchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"query",{enumerable:!0,get:function(){return query}}),Object.defineProperty(exports,"recordQueryDefinitionSchema",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"relationAcceptsObject",{enumerable:!0,get:function(){return relationAcceptsObject}}),Object.defineProperty(exports,"relationTargetsOf",{enumerable:!0,get:function(){return relationTargetsOf}}),Object.defineProperty(exports,"requireContentPlacement",{enumerable:!0,get:function(){return requireContentPlacement}}),Object.defineProperty(exports,"requireRecordContentContext",{enumerable:!0,get:function(){return requireRecordContentContext}}),Object.defineProperty(exports,"requireSingleRelationTarget",{enumerable:!0,get:function(){return requireSingleRelationTarget}}),Object.defineProperty(exports,"resolveCollectionActions",{enumerable:!0,get:function(){return resolveCollectionActions}}),Object.defineProperty(exports,"resolveContentNavigation",{enumerable:!0,get:function(){return resolveContentNavigation}}),Object.defineProperty(exports,"resolveEffectiveFilterType",{enumerable:!0,get:function(){return resolveEffectiveFilterType}}),Object.defineProperty(exports,"resolveIsWithinBounds",{enumerable:!0,get:function(){return resolveIsWithinBounds}}),Object.defineProperty(exports,"resolveUtcDayBounds",{enumerable:!0,get:function(){return resolveUtcDayBounds}}),Object.defineProperty(exports,"singleRelationTarget",{enumerable:!0,get:function(){return singleRelationTarget}}),Object.defineProperty(exports,"sortsSchema",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"sourcedAttributeOf",{enumerable:!0,get:function(){return sourcedAttributeOf}}),Object.defineProperty(exports,"systemColumnFilterTarget",{enumerable:!0,get:function(){return systemColumnFilterTarget}}),Object.defineProperty(exports,"toMultiValueOperator",{enumerable:!0,get:function(){return toMultiValueOperator}}),Object.defineProperty(exports,"toUtcDayString",{enumerable:!0,get:function(){return toUtcDayString}}),Object.defineProperty(exports,"today",{enumerable:!0,get:function(){return today}}),Object.defineProperty(exports,"validateContentViewCatalogue",{enumerable:!0,get:function(){return validateContentViewCatalogue}}),Object.defineProperty(exports,"validateQualifiedRule",{enumerable:!0,get:function(){return validateQualifiedRule}}),Object.defineProperty(exports,"validateStoredViews",{enumerable:!0,get:function(){return validateStoredViews}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standards/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.400",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
"@standard-schema/spec": "^1.1.0",
|
|
252
252
|
"libphonenumber-js": "^1.12.31",
|
|
253
253
|
"zod": "^4.6.6",
|
|
254
|
-
"@standards/constants": "1.0.0-alpha.
|
|
254
|
+
"@standards/constants": "1.0.0-alpha.400"
|
|
255
255
|
},
|
|
256
256
|
"devDependencies": {
|
|
257
257
|
"@types/node": "^25.0.3",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
-
import{SchemaError as e,SchemaErrorCode as t,ToolGroupGrantError as n,ValidationError as r}from"./exceptions.mjs";import"./zod-locale.mjs";import{assertUniqueBy as i,colorIdSchema as ee,iconNameSchema as te}from"./primitives-D9A6pmXV.mjs";import*as a from"zod";import{AVATAR_COLOR_IDS as ne}from"@standards/constants";const re=[`completed`,`failed`,`cancelled`];function invalidSessionState(n){throw new e(n,t.INVARIANT_VIOLATION)}function assertSessionState(e){e.phase===`running`?e.runningTurnId===void 0&&invalidSessionState(`running session without runningTurnId`):e.runningTurnId!==void 0&&invalidSessionState(`runningTurnId present on a ${e.phase} session`),e.phase===`parked`?e.parkedOn===void 0&&invalidSessionState(`parked session without parkedOn`):e.parkedOn!==void 0&&invalidSessionState(`parkedOn present on a ${e.phase} session`),e.parkedOn===`human`?e.humanRequestIds===void 0&&invalidSessionState(`human-parked session without humanRequestIds`):e.humanRequestIds!==void 0&&invalidSessionState(`humanRequestIds present on a session not parked on a human`)}const ie=[`createdAt`,`lastActivity`],o=Object.freeze({mutation:`ask`,destructive:`ask`,outward:`ask`}),ae=[`active`,`completed`,`abandoned`],s=[`openai`,`anthropic`,`google`,`spacexai`,`deepseek`,`moonshotai`,`alibaba`,`mistral`,`minimax`,`meta`,`zai`,`cursor`],c=[`standard`,`fast`],l=[`none`,`minimal`,`low`,`medium`,`high`,`xhigh`],u=[`conversation`,`writing`,`coding`,`analysis`,`extraction`],oe=[`light`,`standard`,`heavy`],se=[`manual`,`auto`],ce={interactive:{inputPerMillionUsd:5,outputPerMillionUsd:25},delegated:{inputPerMillionUsd:2,outputPerMillionUsd:12}},d=[`model`,`speed`,`reasoning`,`imageModel`,`routing`];function mergeSessionInferencePatch(e,t){let n={...e};for(let e of d){let r=t[e];r===null?delete n[e]:r!==void 0&&Object.assign(n,{[e]:r})}return t.model&&t.routing===void 0&&(n.routing=`manual`),n}function isRoutineActorMetadata(e){return e?.kind===`routine`}const le=[`octopus`,`clover`,`flower`,`triangle`,`square`,`blob`,`circle`,`drop`,`hexagon`,`pill`,`pebble`,`puddle`],ue=[`relaxed`,`neutral`],de=4,fe=200;function agentDisplayName(e){return e.label?.trim()||e.name}const f=[`approval-requested`,`approval-responded`,`approval-dispatched`],pe=[`streaming`,`running`,`pending`,...f];function isOpenToolPartState(e){return pe.includes(e)}function isToolApprovalState(e){return f.includes(e)}const p=[`CREDITS_EXHAUSTED`];function isSystemPartCode(e){return typeof e==`string`&&p.includes(e)}const me=20,he=4e3,ge=32e3;function compareAgentSessionMessages(e,t){let n=e.createdAt.getTime()-t.createdAt.getTime();return n===0?e.id.localeCompare(t.id):n}function orderAgentSessionMessages(e){return[...e].sort(compareAgentSessionMessages)}const _e=200,ve=182,ye=366,be=`agent-notification`;function isAgentNotificationMetadata(e){return e?.kind===be}const xe=`agent-message`;function isAgentMessageMetadata(e){return e?.kind===xe}const Se=`architect-publication`;function isArchitectPublicationMetadata(e){return e?.kind===Se}const Ce=[`pending`,`in_progress`,`completed`,`blocked`],m=[`objects`,`fields`,`relations`,`views`,`samples`],we=50,Te=80,Ee=500,h=[`sandbox`,`web`,`image`,`memory`,`bulk`,`activity`,`orchestration`,`host`,`cloud-browser`,`notifications`],De=`browser_launch`,g=[`mcp`,`email.read`,`email.send`,`calendar.read`,`github`,`slack.read`,`slack.write`,`device`,`browser`,`browser-profile`,`login`],Oe=[`definition`,`default`,`child`,`inline`],ke=[`manual`,`name-asc`,`name-desc`,`date-desc`,`date-asc`],Ae=100,je=500,Me=2048,_=[`reader`,`runner`,`editor`],v=[`reader`,`editor`],Ne=[`manual`,`meeting_attendee`],Pe=new Set([`memory`,`skill`]);function parseRole(e,t){if(typeof t==`string`&&e.includes(t))return t;let n=`role must be one of: ${e.join(`, `)}`;throw new r(n,[{path:[`role`],message:n}])}function parseRecordAccessRole(e){return parseRole(v,e)}function parseAgentDefinitionAccessRole(e){return parseRole(_,e)}function parsePageAccessRole(e){return parseRole(v,e)}function deriveViewerAccess(e,t){return e.visibility===`workspace`?`workspace`:e.ownedBy!==null&&t.includes(e.ownedBy)?`owner`:e.viewerGrant===`editor`?`editor`:e.viewerGrant===`runner`?`runner`:`reader`}const Fe=[`fr`,`en`],y=[`none`,`estimated`,`exact`];function parseCountMode(e){if(typeof e==`string`&&y.includes(e))return e;throw new r(`countMode must be one of: ${y.join(`, `)} (received: ${String(e)})`,[])}function parseOptionalCountMode(e){return e===void 0?void 0:parseCountMode(e)}const Ie=1e4,Le=[`record`,`object`,`attribute`,`view`,`user`,`role`,`settings`,`file`,`agent`,`bundle`,`tenant_invitation`,`api_key`],Re=`record.created,record.updated,record.deleted,record.restored,record.purged,record.access_changed,agent.access_changed,object.created,object.updated,object.deleted,attribute.created,attribute.updated,attribute.deleted,view.created,view.updated,view.deleted,bundle.synced,bundle.removed,bundle.added,user.created,user.invited,user.updated,user.deleted,user.login,user.logout,tenant_invitation.created,tenant_invitation.delivery_failed,tenant_invitation.resent,tenant_invitation.revoked,tenant_invitation.accepted,role.created,role.updated,role.deleted,role.assigned,role.revoked,api_key.detached,settings.updated,file.uploaded,file.updated,file.deleted`.split(`,`),ze=`agentSessionId`;function isAgentWrittenAuditEntry(e){return e.actorType===`agent`||typeof e.metadata?.agentSessionId==`string`}const Be=[`draft_schema`],Ve=`discard_architect_draft`,b=`request_design_review`,He=`get_architect_draft`,x=`ask_questions`,S=`request_setup`,Ue=new Set([x,b,S]),C=new Set([x,S]),w=new Set([b]),We=4,Ge=2e3,Ke=50,qe=a.union([a.object({value:a.string(),label:a.string()}).strict(),a.object({values:a.array(a.string()),labels:a.array(a.string()),text:a.string().optional()}).strict(),a.object({text:a.string()}).strict()]),T=a.object({skipped:a.boolean().describe(`True if the person skipped all questions`),answers:a.record(a.string(),qe).describe(`Map of question ID to the answer given, with each chosen option's value and label`)});function readAskQuestionsResult(e){let t=T.safeParse(e);return t.success?t.data:null}function humanRequestKind(e){return e.approvalId==null?C.has(e.name)?`question`:w.has(e.name)?`review`:null:`approval`}function isAwaitingHuman(e){return humanRequestKind(e)===null||e.state===`streaming`||!isOpenToolPartState(e.state)||e.result!==void 0||e.error!==void 0?!1:e.approvalId==null||e.state===`approval-requested`&&e.approved===void 0}function isBlocking(e){let t=humanRequestKind(e);return t===`review`?isOpenToolPartState(e.state):t===`approval`&&e.state===`approval-requested`&&e.approved===void 0}function humanRequestId(e){return e.approvalId??e.toolCallId}function openRequests(e,t){let n=t.blocking?isBlocking:isAwaitingHuman,r=[];for(let t of e)for(let e of t.parts??[])isToolRequestPart(e)&&n(e)&&r.push({part:e,id:humanRequestId(e),requestedAt:t.createdAt});return r}function isToolRequestPart(e){return e.type===`tool`}function isParkedOnHuman(e){return e?.phase===`parked`&&e.parkedOn===`human`}const Je=50;function recentActivityEntryKey(e){return e.kind===`record`?JSON.stringify([`record`,e.objectName,e.recordId]):JSON.stringify([`conversation`,`sessionId`in e?e.sessionId:e.session.id])}const Ye=200,Xe=5242880,E=`Notetaker`,Ze=/^\d{1,9}(\.\d{1,6})?$/,Qe={meetingRecordingPolicy:`none`,meetingBotDisplayName:E,memoryPersonMonthlyLimitUsd:null,memoryTenantMonthlyLimitUsd:null,findImages:!0},$e=[`active`,`suspended`],et=[`architect`,`manual`,`auto`],tt=[`panel`,`fullscreen`],nt=50,rt=200,it=50,at=a.discriminatedUnion(`type`,[a.strictObject({type:a.literal(`record`),object:a.string().min(1),id:a.guid()}),a.strictObject({type:a.literal(`user`),id:a.guid()})]),ot=a.strictObject({nodes:a.array(at).min(1).max(50),limitPerNode:a.number().int().min(1).max(200).default(50)});function recordGraphNodeKey(e){return e.type===`record`?`record:${e.object}:${e.id}`:`user:${e.id}`}const st=100,ct=64e3,D=`work`,O=`/vercel/sandbox/${D}`,k=`/workspace`;function environmentWorkdir(e){return e?O:k}const A=[{id:`claude-code`,label:`Claude Code`,provider:`anthropic`,apiKeyEnv:`ANTHROPIC_API_KEY`,models:[{id:`sonnet`,label:`Claude Sonnet`},{id:`opus`,label:`Claude Opus`},{id:`haiku`,label:`Claude Haiku`}],defaultModel:`sonnet`},{id:`codex`,label:`Codex`,provider:`openai`,apiKeyEnv:`OPENAI_API_KEY`,models:[{id:`gpt-6.1-sol`,label:`GPT-6.1 Sol`},{id:`gpt-6-luna`,label:`GPT-6 Luna`},{id:`gpt-6-astra`,label:`GPT-6 Astra`}],defaultModel:`gpt-6.1-sol`},{id:`cursor`,label:`Cursor`,provider:`cursor`,apiKeyEnv:`CURSOR_API_KEY`,models:[{id:`auto`,label:`Auto`,cliDefault:!0},{id:`composer-2.5`,label:`Composer 2.5`}],defaultModel:`auto`}],j=new Map(A.map(e=>[e.id,e]));function isEnvironmentHarnessId(e){return j.has(e)}function findEnvironmentHarness(e){return j.get(e)}function environmentHarness(n){let r=j.get(n);if(!r)throw new e(`Unknown harness "${n}"`,t.INVARIANT_VIOLATION);return r}function cliDefaultModelOf(e){return environmentHarness(e).models.find(e=>e.cliDefault)?.id}function compiledHarnessModels(e){let t=environmentHarness(e);return t.models.map(e=>({id:e.id,label:e.label,...e.id===t.defaultModel?{isDefault:!0}:{}}))}function harnessModelChoices(e,t){let{provider:n}=environmentHarness(e);return t.map(e=>({id:e.id,provider:n,label:e.label,...e.isDefault?{isDefault:!0}:{}}))}const M=[`search`,`query`,`read`,`write`,`delete`,`organize`,`copy`,`send`],N=[...M,`edit_content`],P=[...N,`ask_questions`,`compact_context`,`request_work_mode`,`write_todos`],lt=[`browser_autopilot`,`browser_batch`,`browser_computer`,`browser_find`,`browser_form_input`,`browser_get_text`,`browser_javascript`,`browser_navigate`,`browser_read_page`,`browser_sign_in`,`browser_tabs`],ut=[`record`,`document`,`file`,`skill`,`schema`,`guide`],F={memory:{kinds:[`memory`],capabilities:[],tools:[`propose_memory`]},bulk:{kinds:[],capabilities:[`bulk`],tools:[]},activity:{kinds:[],capabilities:[`activity`],tools:[]},"email.read":{kinds:[`email`,`thread`],capabilities:[`copy_email`],tools:[]},"email.send":{kinds:[`email`,`thread`,`draft`],capabilities:[`copy_email`],tools:[]},"calendar.read":{kinds:[`event`],capabilities:[`transcript`],tools:[]}},I={sandbox:{icon:`terminal`,tools:[`exec_command`,`publish_artifact`,`sandbox_validate_payload`]},web:{icon:`globe`,tools:[`read_webpage`,`web_search`]},image:{icon:`image`,tools:[`generate_image`]},memory:{icon:`book-open`,tools:F.memory.tools},bulk:{icon:`layers-two`,tools:F.bulk.tools},activity:{icon:`activity`,tools:F.activity.tools},orchestration:{icon:`git-branch`,tools:[`message_agent`,`spawn_agent`]},host:{icon:`wrench`,tools:[]},"cloud-browser":{icon:`globe`,tools:[`browser_launch`]},notifications:{icon:`bell`,tools:[`notify`]}},L={mcp:{icon:`puzzle`,tools:[]},"email.read":{icon:`envelope`,tools:F[`email.read`].tools},"email.send":{icon:`send`,tools:F[`email.send`].tools},"calendar.read":{icon:`calendar`,tools:F[`calendar.read`].tools},github:{icon:`brand-github`,tools:[]},"slack.read":{icon:`brand-slack`,tools:[`slack_read`,`slack_find`,`slack_download_file`]},"slack.write":{icon:`brand-slack`,tools:[`slack_send`,`slack_react`,`slack_set_status`]},device:{icon:`desktop`,tools:[`exec_command`]},browser:{icon:`link`,tools:lt},"browser-profile":{icon:`globe`,tools:[`browser_launch`,...lt]},login:{icon:`key`,tools:[]}},dt={sandbox:{kinds:[],capabilities:[],tools:I.sandbox.tools},web:{kinds:[],capabilities:[],tools:I.web.tools},image:{kinds:[],capabilities:[],tools:I.image.tools},memory:F.memory,bulk:F.bulk,activity:F.activity,orchestration:{kinds:[],capabilities:[],tools:I.orchestration.tools},host:{kinds:[],capabilities:[],tools:I.host.tools},"cloud-browser":{kinds:[],capabilities:[],tools:I[`cloud-browser`].tools},notifications:{kinds:[],capabilities:[],tools:I.notifications.tools},mcp:{kinds:[],capabilities:[],tools:L.mcp.tools},"email.read":F[`email.read`],"email.send":F[`email.send`],"calendar.read":F[`calendar.read`],github:{kinds:[],capabilities:[],tools:L.github.tools},"slack.read":{kinds:[],capabilities:[],tools:L[`slack.read`].tools},"slack.write":{kinds:[],capabilities:[],tools:L[`slack.write`].tools},device:{kinds:[],capabilities:[],tools:L.device.tools},browser:{kinds:[],capabilities:[],tools:L.browser.tools},"browser-profile":{kinds:[],capabilities:[],tools:L[`browser-profile`].tools},login:{kinds:[],capabilities:[],tools:L.login.tools}},ft={schema:[`discard_architect_draft`,`draft_schema`,`get_architect_draft`,`get_schema_history`,`request_design_review`,`search_icons`],"agent-config":[`get_agents`,`upsert_agent`],setup:[`request_setup`],internal:[`load_toolset`]},pt=[...new Set([...P,...h.flatMap(e=>I[e].tools),...g.flatMap(e=>L[e].tools)])],mt={"email.read":[`gmail`,`outlook`],"email.send":[`gmail`,`outlook`],"calendar.read":[`google-calendar`,`outlook-calendar`]};function connectionGrantKindsOf(e){switch(e){case`github`:return[`github`];case`slack`:return[`slack.read`,`slack.write`];case`google-calendar`:case`outlook-calendar`:return[`calendar.read`];case`gmail`:case`outlook`:return[`email.read`,`email.send`]}}const ht=[`activity`,`bulk`,`image`,`memory`,`orchestration`,`sandbox`,`web`],gt=[`memory`],_t=new Set([`sandbox`,`host`,`cloud-browser`]);function needsManageWhenUnattended(e){return _t.has(e)||isResourceGrant(e)}function isNativeToolGroup(e){return h.includes(e)}function parseToolGroupGrant(e){if(isNativeToolGroup(e))return{type:`native`,group:e};let t=e.indexOf(`:`);if(t<=0)return null;let n=e.slice(0,t),r=e.slice(t+1);return r.length===0||!g.includes(n)?null:{type:`resource`,kind:n,id:r}}function grantKindOf(e){let t=parseToolGroupGrant(e);return t?.type===`resource`?t.kind:null}function isResourceGrant(e){return parseToolGroupGrant(e)?.type===`resource`}function resourceGrant(e,t){return`${e}:${t}`}function canonicalToolGroups(e){return[...new Set(e)].sort()}const vt=[{key:`direct`,icon:`message`,color:`ink`,description:`A message a person wrote to this mailbox: a conversation, a question, a request, a reply.`},{key:`transactional`,icon:`credit-card`,color:`terra`,description:`An automated message about an account or an operation: receipt, invoice, payment, order, shipping, booking, password reset, security alert.`},{key:`notifications`,icon:`bell`,color:`ochre`,description:`An automated alert from a tool or a service: activity on GitHub, Slack, a calendar, a CRM, a monitoring system.`},{key:`newsletters`,icon:`book-open`,color:`stone`,description:`Editorial content the mailbox subscribed to: newsletters, digests, articles, community updates.`},{key:`marketing`,icon:`percentage`,color:`iris`,description:`Promotion or prospecting: offers, discounts, product announcements, cold sales outreach.`}],yt={direct:{en:`Direct`,fr:`Direct`},transactional:{en:`Transactional`,fr:`Transactionnel`},notifications:{en:`Notifications`,fr:`Notifications`},newsletters:{en:`Newsletters`,fr:`Newsletters`},marketing:{en:`Marketing`,fr:`Marketing`}},bt=8,xt=24,St=10,Ct=500,wt=`tag`,Tt=`stone`,Et=new Set(`gmail.com,googlemail.com,outlook.com,hotmail.com,hotmail.fr,outlook.fr,live.com,live.fr,msn.com,yahoo.com,yahoo.fr,icloud.com,me.com,mac.com,proton.me,protonmail.com,gmx.com,gmx.fr,orange.fr,wanadoo.fr,free.fr,laposte.net,sfr.fr,bbox.fr,numericable.fr,aol.com`.split(`,`)),Dt=new Set(vt.map(e=>e.key)),Ot=new Set(Object.entries(yt).flatMap(([e,t])=>[e,t.en,t.fr].map(e=>e.toLowerCase())));function isSystemEmailCategory(e){return Dt.has(e)}function isSystemEmailCategoryName(e){return Ot.has(e.trim().toLowerCase())}function isPublicMailDomain(e){return Et.has(e.toLowerCase())}const R={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2}};var AgentBuilder=class{constructor(e){if(!e.name||e.name.trim().length===0)throw new r(`Agent name is required`,[]);this.bp={name:e.name,system:!0,visibility:`workspace`,triggers:[]}}description(e){return this.bp.description=e,this}label(e){return this.bp.label=e,this}avatar(e){return this.bp.avatar={type:e.type,color:e.color,expression:e.expression??`relaxed`},this}starters(e){return e.length===0?delete this.bp.starters:this.bp.starters=[...e],this}systemPrompt(e){return this.bp.systemPrompt=e,this}model(e,t,n){return this.bp.model={provider:e,model:t,...n},this}toolGroups(e){let r=e.find(e=>!isNativeToolGroup(e));if(r!==void 0)throw new n(t.AGENT_TOOL_GROUP_UNKNOWN,r,`Agent "${this.bp.name}": "${r}" is not a native tool group (blueprints cannot grant tenant resources)`);return this.bp.toolGroups=canonicalToolGroups(e),this}schedule(e){return this.bp.schedule={...e,enabled:e.enabled??!0},this}config(e){let t=this.bp.config??R,n=e.inference===void 0?t.inference:{...t.inference,...e.inference};return this.bp.config={...t,...e,...n===void 0?{}:{inference:n}},this}delegation(e){return Object.assign(this.bp,e),this}approval(e){return this.bp.approval={...o,...this.bp.approval,...e},this}visibility(e){return this.bp.visibility=e,this}trigger(e,t,n){return this.bp.triggers.push({name:e,eventType:t,...n,enabled:n?.enabled??!0}),this}runtime(){return this.bp.system=!1,this}build(){if(!this.bp.systemPrompt)throw new r(`Agent "${this.bp.name}": systemPrompt is required`,[]);if(!this.bp.model)throw new r(`Agent "${this.bp.name}": model is required`,[]);if(this.bp.system&&this.bp.visibility===`private`)throw new r(`Agent "${this.bp.name}": system agents must use workspace visibility`,[]);return i(this.bp.triggers,e=>e.name,e=>new r(`Agent "${this.bp.name}": duplicate trigger name "${e}"`,[])),{...this.bp,visibility:this.bp.visibility??`workspace`,toolGroups:this.bp.toolGroups??[...gt],config:this.bp.config??R,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};function agent(e){return new AgentBuilder(e)}const z={issue:{events:[`issues`],actions:[`opened`,`edited`,`closed`,`reopened`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`milestoned`,`demilestoned`,`transferred`,`pinned`],conditions:[`label`,`issueLabels`,`assignees`,`milestone`,`issueType`,`text`]},pull_request:{events:[`pull_request`],actions:[`opened`,`ready_for_review`,`synchronize`,`review_requested`,`merged`,`closed`,`reopened`,`converted_to_draft`,`labeled`,`assigned`,`edited`],conditions:[`baseBranch`,`headBranch`,`draft`,`issueLabels`,`changedPaths`,`prAuthor`]},review:{events:[`pull_request_review`],actions:[`submitted`,`edited`,`dismissed`],conditions:[`reviewState`,`prAuthor`]},comment:{events:[`issue_comment`,`pull_request_review_comment`,`commit_comment`],actions:[`created`,`edited`,`deleted`],conditions:[`text`,`issueAuthor`,`prAuthor`]},push:{events:[`push`],actions:[`pushed`],conditions:[`branch`,`changedPaths`,`forced`]},ref:{events:[`create`,`delete`],actions:[`created`,`deleted`],conditions:[`refType`,`branch`,`tag`]},workflow:{events:[`workflow_run`],actions:[`requested`,`in_progress`,`completed`],conditions:[`workflowName`,`conclusion`,`branch`,`originEvent`]},check:{events:[`check_suite`,`check_run`],actions:[`completed`,`rerequested`],conditions:[`checkApp`,`checkName`,`conclusion`]},project_item:{events:[`projects_v2_item`],actions:[`created`,`edited`,`archived`,`restored`,`deleted`],conditions:[`project`,`projectField`,`from`,`to`,`itemType`]},release:{events:[`release`],actions:[`published`,`created`,`edited`,`prereleased`,`deleted`],conditions:[`prerelease`,`tag`]},discussion:{events:[`discussion`,`discussion_comment`],actions:[`created`,`commented`,`answered`,`labeled`,`closed`],conditions:[`category`,`issueLabels`,`text`]},repository:{events:[`star`,`fork`,`repository`],actions:[`starred`,`forked`,`created`,`archived`],conditions:[]}},kt={mention:{events:[`app_mention`],conditions:[`text`]},message:{events:[`message`],conditions:[`position`,`text`,`hasFile`]},dm:{events:[`message`],conditions:[`text`,`hasFile`]},reaction:{events:[`reaction_added`],conditions:[`messageAuthor`]},member_joined:{events:[`member_joined_channel`],conditions:[]}},At=a.object({field:a.literal(`text`),operator:a.enum([`contains`,`starts_with`]),value:a.string().min(1)}).strict();function stringCondition(e){return a.object({field:a.literal(e),value:a.string().min(1)}).strict()}function booleanCondition(e){return a.object({field:a.literal(e),value:a.boolean()}).strict()}function listCondition(e){return a.object({field:a.literal(e),operator:a.enum([`any`,`all`]).default(`any`),value:a.array(a.string().min(1)).min(1)}).strict()}const jt=a.discriminatedUnion(`field`,[At,stringCondition(`label`),listCondition(`issueLabels`),listCondition(`assignees`),stringCondition(`milestone`),stringCondition(`issueType`),stringCondition(`baseBranch`),stringCondition(`headBranch`),stringCondition(`branch`),booleanCondition(`draft`),stringCondition(`changedPaths`),booleanCondition(`forced`),stringCondition(`prAuthor`),stringCondition(`issueAuthor`),a.object({field:a.literal(`reviewState`),value:a.enum([`approved`,`changes_requested`,`commented`])}).strict(),stringCondition(`workflowName`),stringCondition(`checkApp`),stringCondition(`checkName`),stringCondition(`conclusion`),stringCondition(`originEvent`),stringCondition(`project`),stringCondition(`projectField`),a.object({field:a.literal(`from`),value:a.string().nullable()}).strict(),a.object({field:a.literal(`to`),value:a.string().nullable()}).strict(),a.object({field:a.literal(`itemType`),value:a.enum([`issue`,`pull_request`,`draft`])}).strict(),booleanCondition(`prerelease`),stringCondition(`tag`),a.object({field:a.literal(`refType`),value:a.enum([`branch`,`tag`])}).strict(),stringCondition(`category`)]),Mt=a.discriminatedUnion(`field`,[At,a.object({field:a.literal(`position`),value:a.enum([`top_level`,`reply`])}).strict(),booleanCondition(`hasFile`),stringCondition(`messageAuthor`)]),Nt=a.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),Pt=a.enum([`human`,`me`,`any`]),Ft=a.object({family:a.enum(Object.keys(z)),actions:a.array(a.string()).default([]),repositories:a.array(Nt).default([]),sender:a.union([Pt,a.object({logins:a.array(a.string().min(1)).min(1)}).strict()]).default(`human`),conditions:a.array(jt).default([])}).strict().superRefine((e,t)=>{let n=z[e.family];e.actions.forEach((r,i)=>{n.actions.includes(r)||t.addIssue({code:`custom`,path:[`actions`,i],message:`Action ${r} is not supported by ${e.family}`})}),e.conditions.forEach((r,i)=>{n.conditions.includes(r.field)||t.addIssue({code:`custom`,path:[`conditions`,i,`field`],message:`Condition ${r.field} is not supported by ${e.family}`})})}).transform(e=>e),It=a.object({on:a.enum([`mention`,`message`,`dm`,`reaction`,`member_joined`]),channels:a.array(a.string().min(1)).default([]),reactions:a.array(a.string().min(1)).optional(),sender:a.union([Pt,a.object({users:a.array(a.string().min(1)).min(1)}).strict()]).default(`human`),conditions:a.array(Mt).default([])}).strict().superRefine((e,t)=>{e.conditions.forEach((n,r)=>{kt[e.on].conditions.includes(n.field)||t.addIssue({code:`custom`,path:[`conditions`,r,`field`],message:`Condition ${n.field} is not supported by ${e.on}`})}),e.reactions!==void 0&&e.on!==`reaction`&&t.addIssue({code:`custom`,path:[`reactions`],message:`reactions requires on=reaction`})}).transform(e=>e),Lt=a.union([Ft,It]),Rt=[`read`,`write`,`full`],zt=[`accepted`,`declined`,`tentative`],Bt=[`force`,`skip`],Vt=[`none`,`all`,`external_only`],Ht={override:null,status:`none`,failureReason:null,botId:null},Ut=a.object({speaker:a.string().nullable(),startsAtMs:a.number(),endsAtMs:a.number(),text:a.string()}),Wt=a.object({fullText:a.string(),segments:a.array(Ut),language:a.string().nullable(),startedAt:a.string().nullable(),endedAt:a.string().nullable()}),Gt={width:1280,height:720,maxBytes:13e5,mimeType:`image/jpeg`},Kt=Math.ceil(Gt.maxBytes/3)*4,qt=a.object({conferenceJoinUrl:a.string().min(1),botDisplayName:a.string().min(1),startsAt:a.string().nullable(),callbackUrl:a.url(),botImageJpeg:a.string().max(Kt).optional()}),Jt=a.object({botId:a.string().min(1)}),Yt=a.discriminatedUnion(`kind`,[a.object({kind:a.literal(`transcript-ready`),botId:a.string().min(1)}),a.object({kind:a.literal(`failure`),botId:a.string().min(1),reason:a.string()})]),Xt=100;let Zt=function(e){return e.Desktop=`desktop`,e}({});function isMailProvider(e){return e===`gmail`||e===`outlook`}const Qt=`DRAFT`;function isProviderDraft(e){return e.includes(Qt)}const $t=[`threads`,`messages`];function isMailboxListMode(e){return $t.includes(e)}const en=[`reply`,`reply_all`];function isReplyMode(e){return en.includes(e)}const tn=2e5,nn=998,B=a.number().finite().nonnegative(),V=a.enum(s),H=a.enum(c),U=a.enum(l),W=a.enum(se),G=a.object({provider:V,model:a.string().min(1)}).strict(),rn=a.object({speed:H.optional(),reasoning:U.optional(),routing:W.optional()}).strict(),K=a.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),an=a.object({model:G.optional(),speed:H.optional(),reasoning:U.optional(),imageModel:K.optional(),routing:W.optional()}).strict(),on=an.refine(e=>d.some(t=>e[t]!==void 0),{message:`At least one inference override is required`});function isSessionInferencePatch(e){return Object.keys(e).length>0&&Object.values(e).every(e=>e!==void 0)}const sn=a.object({model:G.nullable().optional(),speed:H.nullable().optional(),reasoning:U.nullable().optional(),imageModel:K.nullable().optional(),routing:W.nullable().optional()}).strict().refine(isSessionInferencePatch,{message:`At least one inference override is required`}),cn=a.object({model:a.string().min(1),routing:a.object({mode:a.literal(`auto`),tasks:a.array(a.enum(u)).optional(),demand:a.enum(oe).optional(),reason:a.enum([`selected`,`retained`,`fallback`]).optional(),relation:a.enum([`continue`,`modify`,`new`,`aside`,`unknown`]).optional(),anchorMessageId:a.string().min(1).optional()})}),q=a.object({label:a.string(),denied:a.boolean().optional(),deletion:a.object({target:a.string().optional(),count:B.optional(),restorableDays:B.optional()}).strict().optional(),record:a.object({objectName:a.string(),id:a.string(),label:a.string(),objectIcon:a.string().optional()}).strict().optional(),object:a.object({name:a.string(),label:a.string()}).strict().optional(),email:a.object({from:a.string(),to:a.array(a.string()),cc:a.array(a.string()),bcc:a.array(a.string()),subject:a.string().nullable(),text:a.string(),truncatedChars:B,outsideThread:a.array(a.string()),attachments:a.array(a.object({name:a.string(),size:B}).strict()),updatedAt:a.string()}).strict().optional(),counts:a.record(a.string(),B).optional(),warnings:a.array(a.string()).optional()}).strict(),ln=a.union([a.object({type:a.literal(`text`),text:a.string()}).strict(),a.object({type:a.literal(`reasoning`),text:a.string()}).strict(),a.object({type:a.literal(`system`),code:a.enum(p)}).strict(),a.object({type:a.literal(`error`),error:a.string(),errorClass:a.string().optional()}).strict(),a.object({type:a.literal(`tool`),toolCallId:a.string(),name:a.string(),args:a.record(a.string(),a.unknown()),result:a.unknown().optional(),error:a.string().optional(),errorCode:a.enum([`output_limit_reached`,`interrupted`,t.INVALID_TOOL_INPUT,`external_outcome_unknown`,`external_not_dispatched`]).optional(),state:a.enum([`streaming`,`running`,`completed`,`error`,`pending`,`approval-requested`,`approval-responded`,`approval-dispatched`]),durationMs:B.optional(),approvalId:a.string().optional(),approvalImpact:q.optional(),approved:a.boolean().optional(),approvalReason:a.string().optional(),approvalDecidedBy:a.string().optional(),approvalDecidedAt:a.string().optional(),approvalRelaxableByAuto:a.boolean().optional()}).strict(),a.object({type:a.literal(`file`),fileId:a.string(),name:a.string(),mimeType:a.string()}).strict(),a.object({type:a.literal(`compaction`),state:a.literal(`in-progress`),reason:a.enum([`preflight_threshold`,`overflow_recovery`]),estimatedTokens:B.optional(),reportedTokens:B.optional()}).strict(),a.object({type:a.literal(`compaction`),state:a.literal(`completed`),tokensBefore:B,tokensAfter:B,tokensSaved:B,strategy:a.enum([`no-op`,`summary`,`truncation`]),durationMs:B,summary:a.string().optional()}).strict(),a.object({type:a.literal(`compaction`),state:a.literal(`failed`),reason:a.string(),durationMs:B.optional()}).strict()]),un=a.object({id:a.string(),name:a.string(),mimeType:a.string(),size:B}).strict(),dn=a.object({id:a.string(),artifactId:a.string(),revision:a.number().int().min(1),selectedText:a.string()}).strict(),fn=a.object({id:a.string(),type:a.string().transform(e=>e),entityId:a.string(),label:a.string(),objectName:a.string().optional(),startIndex:B,endIndex:B}).strict(),pn=a.object({provider:V,model:a.string(),maxTokens:B.optional(),contextWindow:B.optional()}).strict(),mn=a.union([a.date(),a.string().datetime({offset:!0}).transform(e=>new Date(e))]),hn=a.object({id:a.string(),sessionId:a.string(),tenantId:a.string().optional(),runId:a.string().optional(),role:a.enum([`user`,`assistant`,`system`,`tool`]),parts:a.array(ln),attachments:a.array(un).optional(),mentions:a.array(fn).optional(),quotes:a.array(dn).optional(),model:pn.optional(),tokenUsage:a.object({input:B,output:B}).strict().optional(),metadata:a.record(a.string(),a.unknown()).optional(),createdAt:mn}).strict(),gn=a.object({id:a.string(),description:a.string(),status:a.enum([`pending`,`in_progress`,`completed`,`blocked`]),result:a.string().optional(),updatedAt:B.optional(),target:a.object({phase:a.enum(m)}).strict().optional()}).strict(),_n=a.object({id:a.string(),sessionId:a.string(),status:a.enum([`active`,`completed`,`abandoned`]),todos:a.array(gn),version:B,createdAt:a.string(),updatedAt:a.string(),completedAt:a.string().optional()}).strict(),J={"compaction-start":a.object({reason:a.enum([`preflight_threshold`,`overflow_recovery`]),estimatedTokens:B.optional(),reportedTokens:B.optional()}).strict(),"compaction-end":a.object({tokensBefore:B,tokensAfter:B,tokensSaved:B,strategy:a.enum([`no-op`,`summary`,`truncation`]),durationMs:B,summary:a.string().optional()}).strict(),"compaction-failed":a.object({reason:a.string()}).strict(),usage:a.object({messageId:a.string().min(1).optional(),inputTokens:B,outputTokens:B,totalTokens:B,cacheReadTokens:B.optional(),cacheCreationTokens:B.optional(),contextWindow:B,residentTokens:B,utilization:a.number().finite().min(0).max(1),costUsd:B.optional()}).strict(),"message-updated":a.object({message:hn}).strict(),"approval-context":a.object({approvalId:a.string(),toolCallId:a.string(),impact:q.optional(),relaxableByAuto:a.boolean().optional()}).strict()};function isAgentUIDataName(e){return e in J}function agentUIValidationError(e){return new r(`Invalid agent UI message chunk`,e.map(e=>({path:e.path.map(String),message:e.message,code:e.code})))}function assertCustomAgentUIMessageChunk(e){if(typeof e!=`object`||!e||typeof e.type!=`string`)throw new r(`Invalid agent UI message chunk`,[{path:[`type`],message:`Expected UI message chunk type`,code:`invalid_type`}]);let t=e.type;if(!t.startsWith(`data-`))throw new r(`Invalid agent UI message chunk`,[{path:[`type`],message:`Expected agent data chunk type`,code:`invalid_value`}]);let n=t.slice(5);if(!isAgentUIDataName(n))throw new r(`Invalid agent UI message chunk`,[{path:[`type`],message:`Unknown agent UI data type: ${n}`,code:`invalid_value`}]);let i=a.object({type:a.literal(`data-${n}`),id:a.string().optional(),data:J[n],transient:a.boolean().optional()}).strict().safeParse(e);if(!i.success)throw agentUIValidationError(i.error.issues);return i.data}function agentDataChunk(e,t,n){return assertCustomAgentUIMessageChunk({type:`data-${e}`,...n?.id===void 0?{}:{id:n.id},data:t,...n?.transient===void 0?{}:{transient:n.transient}})}const vn=a.string().trim().min(1).max(24),Y=a.string().trim().min(10).max(500),yn=a.enum([`address`,`domain`]),bn=a.object({scope:a.enum([`personal`,`workspace`]),name:vn,description:Y,icon:te.default(`tag`),color:ee.default(Tt)}),xn=a.object({name:vn.optional(),description:Y.optional(),icon:te.optional(),color:ee.optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),{message:`Nothing to update`}),Sn=a.object({moveTo:a.string().min(1).nullable().default(null)}),Cn=a.object({category:a.string().min(1).optional(),important:a.boolean().optional()}).refine(e=>e.category!==void 0||e.important!==void 0,{message:`Nothing to classify`}),wn=a.object({verdict:a.object({category:a.string().min(1).nullable(),important:a.boolean(),classifiedBy:a.enum([`model`,`rule`,`manual`]).nullable()}),ruleId:a.string().uuid().nullable(),previousRule:a.object({scope:yn,match:a.string().trim().toLowerCase().min(1),category:a.string().min(1)}).nullable()}).refine(e=>e.ruleId!==null||e.previousRule===null,{message:`A previous rule needs the rule it restores`}),Tn=a.object({scope:a.literal(`domain`)}),En=a.object({scope:a.enum([`personal`,`workspace`])}),Dn=a.object({type:a.enum(le),color:a.enum(ne),expression:a.enum(ue).default(`relaxed`)}).strict(),On=a.array(a.string().trim().min(1).max(200)).max(4);function agentAvatarFromMetadata(e){let t=Dn.safeParse(e);return t.success?t.data:void 0}const kn=[`record.created`,`record.updated`,`record.deleted`,`form.submitted`,`webhook`,`github`,`slack`],An=new Set([`record.created`,`record.updated`,`record.deleted`]),jn=/^[A-Z_][A-Z0-9_]*$/,Mn=a.object({cron:a.string().min(9),timezone:a.string().optional(),enabled:a.boolean(),input:a.record(a.string(),a.unknown()).optional(),runFor:a.enum([`armer`,`audience`]).optional(),continueConversation:a.boolean().optional()}),Nn=/^[A-Za-z0-9_$-]+(\.[A-Za-z0-9_$-]+)*$/,X=a.object({name:a.string().max(120).optional(),eventType:a.enum(kn),objectId:a.guid().optional(),watchedFields:a.array(a.string()).max(50).optional(),debounceMs:a.number().int().min(0).max(3e5).optional(),filter:a.object({combinator:a.enum([`and`,`or`]).default(`and`),rules:a.array(a.object({attribute:a.string(),operator:a.string(),value:a.unknown().optional()}))}).optional(),formDefinitionId:a.string().optional(),continuationKey:a.string().max(200).regex(Nn).nullable().optional(),connectionId:a.guid().optional(),match:Lt.optional(),continueConversation:a.boolean().optional(),enabled:a.boolean().optional()});function refineTrigger(e){return e.refine(e=>!e.watchedFields?.length||e.eventType===`record.updated`,{message:`watchedFields requires eventType=record.updated`,path:[`watchedFields`]}).refine(e=>!(e.eventType&&An.has(e.eventType))||!!e.objectId,{message:`objectId is required for record.* triggers`,path:[`objectId`]}).refine(e=>!(e.continuationKey&&e.eventType)||e.eventType===`webhook`,{message:`continuationKey requires eventType=webhook`,path:[`continuationKey`]}).superRefine((e,t)=>{let n=e.eventType===`github`||e.eventType===`slack`;if(n&&!e.connectionId&&t.addIssue({code:`custom`,path:[`connectionId`],message:`connectionId is required for native connector triggers`}),n&&!e.match&&t.addIssue({code:`custom`,path:[`match`],message:`match is required for native connector triggers`}),e.match&&e.eventType&&((e.eventType===`github`?`family`in e.match:e.eventType===`slack`&&`on`in e.match)||t.addIssue({code:`custom`,path:[`match`],message:`match must belong to the trigger provider`})),e.eventType&&!n)for(let n of[`connectionId`,`continueConversation`])e[n]!==void 0&&t.addIssue({code:`custom`,path:[n],message:`${n} requires a native connector trigger`})})}const Pn=refineTrigger(X).transform(e=>({...e,...e.eventType===`github`||e.eventType===`slack`?{continueConversation:e.continueConversation??!0}:{}})),Fn=X.partial();function parseMergedAgentTrigger(e,t){let n=Fn.safeParse(t);if(!n.success)throw triggerValidationError(n.error);let r=Object.fromEntries(Object.entries(n.data).filter(([,e])=>e!==void 0)),i=Pn.safeParse({...e,...r});if(!i.success)throw triggerValidationError(i.error);return i.data}function triggerValidationError(e){return new r(`Invalid agent trigger`,e.issues.map(e=>({path:e.path.map(String),message:e.message})))}const In=100,Z=a.uuid(),Q=a.record(a.string(),a.unknown()),Ln=a.strictObject({objectName:a.string(),recordId:Z,attribute:a.string(),base:a.unknown(),props:Q.optional()}),Rn=a.strictObject({kind:a.literal(`record.set`),objectId:Z,recordId:Z,values:Q,base:Q.optional()}),zn=a.strictObject({kind:a.literal(`record.create`),objectId:Z,recordId:Z,values:Q,options:a.strictObject({visibility:a.enum([`workspace`,`private`]).optional(),allowDraft:a.boolean().optional(),linkTo:Ln.optional()}).optional()}),Bn=a.strictObject({kind:a.literal(`record.delete`),objectId:Z,recordId:Z}),Vn=a.strictObject({kind:a.literal(`record.restore`),objectId:Z,recordId:Z}),$=a.string().min(1),Hn=a.discriminatedUnion(`command`,[a.strictObject({command:a.literal(`replace`),oldText:$,newText:a.string(),replaceAll:a.boolean().optional()}),a.strictObject({command:a.literal(`insert`),text:$,after:$.optional()})]),Un=a.strictObject({kind:a.literal(`record.patch`),objectId:Z,recordId:Z,attribute:a.string(),edit:Hn}),Wn=a.discriminatedUnion(`kind`,[Rn,zn,Bn,Vn,Un]),Gn=a.strictObject({opId:Z,steps:a.array(Wn).min(1).max(100)}).superRefine((e,t)=>{let n=new Set;for(let r of e.steps){if(n.has(r.recordId)){t.addIssue({code:`custom`,message:`one step per record`,path:[`steps`]});return}n.add(r.recordId)}});export{Rt as ACCESS_LEVELS,_ as ACCESS_ROLES,ge as AGENT_ASIDE_ANSWER_MAX_LENGTH,me as AGENT_ASIDE_HISTORY_LIMIT,he as AGENT_ASIDE_QUESTION_MAX_LENGTH,ue as AGENT_AVATAR_EXPRESSIONS,le as AGENT_AVATAR_TYPES,xe as AGENT_MESSAGE_KIND,be as AGENT_NOTIFICATION_KIND,ie as AGENT_SESSION_LIST_ORDERS,Oe as AGENT_SESSION_ORIGINS,de as AGENT_STARTERS_MAX,fe as AGENT_STARTER_MAX_LENGTH,u as AGENT_TASK_KINDS,pt as ALL_CATALOG_TOOL_NAMES,ut as ALWAYS_KINDS,w as APPROVAL_FAMILY_TOOL_NAMES,Se as ARCHITECT_PUBLICATION_KIND,Ge as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Ke as ASK_QUESTIONS_ANSWER_MAX_VALUES,We as ASK_QUESTIONS_MAX_BATCH,x as ASK_QUESTIONS_TOOL_NAME,Re as AUDIT_ACTIONS,ze as AUDIT_AGENT_SESSION_METADATA_KEY,Le as AUDIT_RESOURCE_TYPES,AgentBuilder,De as BROWSER_LAUNCH_TOOL_NAME,Fe as BUNDLE_LOCALES,mt as CONNECTION_GRANT_PROVIDERS,Nn as CONTINUATION_KEY_PATTERN,tt as CONVERSATION_SURFACES,N as CORE_RECORD_TOOL_NAMES,P as CORE_TOOL_NAMES,y as COUNT_MODES,R as DEFAULT_AGENT_EXECUTION_CONFIG,ht as DEFAULT_AGENT_TOOL_GROUPS,o as DEFAULT_APPROVAL_POLICY,gt as DEFAULT_BLUEPRINT_TOOL_GROUPS,ve as DEFAULT_DAILY_ACTIVITY_DAYS,E as DEFAULT_MEETING_BOT_DISPLAY_NAME,Qe as DEFAULT_TENANT_SETTINGS,Ve as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,ke as DOCUMENT_SORT_MODES,Be as DRAFT_WRITE_TOOL_NAMES,Tt as EMAIL_CATEGORY_DEFAULT_COLOR,wt as EMAIL_CATEGORY_DEFAULT_ICON,Ct as EMAIL_CATEGORY_DESCRIPTION_MAX,St as EMAIL_CATEGORY_DESCRIPTION_MIN,bt as EMAIL_CATEGORY_LIMIT,xt as EMAIL_CATEGORY_NAME_MAX,A as ENVIRONMENT_HARNESSES,D as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,O as ENVIRONMENT_HARNESS_WORKDIR,st as ENVIRONMENT_NAME_MAX_CHARS,k as ENVIRONMENT_STANDARDS_WORKDIR,jn as ENV_VAR_KEY_PATTERN,Ie as ESTIMATED_COUNT_CAP,Ye as FILE_URLS_MAX_IDS,He as GET_ARCHITECT_DRAFT_TOOL_NAME,z as GITHUB_TRIGGER_CATALOG,dt as GRANT_ENABLES,Ue as HITL_TOOL_NAMES,l as INFERENCE_REASONING_OPTIONS,se as INFERENCE_ROUTING_MODES,c as INFERENCE_SPEEDS,_e as LAST_RUN_ERROR_MAX_LENGTH,$t as MAILBOX_LIST_MODES,tn as MAIL_DRAFT_BODY_MAX_CHARS,nn as MAIL_SUBJECT_MAX_CHARS,ye as MAX_DAILY_ACTIVITY_DAYS,we as MAX_TODOS,Ee as MAX_TODO_DESCRIPTION_CHARS,Te as MAX_TODO_ID_CHARS,Xt as MCP_SERVER_NAME_MAX_LENGTH,Gt as MEETING_BOT_IMAGE,Kt as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,zt as MEETING_RESPONSES,Ze as MEMORY_SPEND_LIMIT_PATTERN,Zt as McpOAuthCompletionMode,h as NATIVE_TOOL_GROUPS,I as NATIVE_TOOL_GROUP_CATALOG,Ht as NO_RECORDING,pe as OPEN_TOOL_PART_STATES,In as OPERATION_MAX_STEPS,Qt as PROVIDER_DRAFT_LABEL,s as PROVIDER_NAMES,Et as PUBLIC_MAIL_DOMAINS,C as QUESTION_FAMILY_TOOL_NAMES,Je as RECENT_ACTIVITY_LEDGER_LIMIT,Bt as RECORDING_OVERRIDES,Vt as RECORDING_POLICIES,v as RECORD_ACCESS_ROLES,Ne as RECORD_ACCESS_SOURCES,Me as RECORD_DRIVE_CURSOR_MAX_LENGTH,Ae as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,je as RECORD_DRIVE_PAGE_MAX_LIMIT,it as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,rt as RECORD_GRAPH_MAX_LIMIT_PER_NODE,nt as RECORD_GRAPH_MAX_NODES,Xe as RECORD_IMAGE_MAX_BYTES,en as REPLY_MODES,b as REQUEST_DESIGN_REVIEW_TOOL_NAME,S as REQUEST_SETUP_TOOL_NAME,g as RESOURCE_GRANT_KINDS,L as RESOURCE_KIND_CATALOG,ce as ROUTING_PRICE_CEILINGS,d as SESSION_INFERENCE_PATCH_KEYS,ct as SETUP_SCRIPT_MAX_CHARS,kt as SLACK_TRIGGER_CATALOG,ft as SURFACE_TOOL_NAMES,vt as SYSTEM_EMAIL_CATEGORIES,yt as SYSTEM_EMAIL_CATEGORY_NAMES,p as SYSTEM_PART_CODES,oe as TASK_DEMAND_LEVELS,m as TODO_PHASES,ae as TODO_PLAN_STATUSES,Ce as TODO_STATUSES,f as TOOL_APPROVAL_STATES,kn as TRIGGER_EVENT_TYPES,re as TURN_OUTCOMES,Pe as UNSHAREABLE_OBJECT_NAMES,$e as USER_STATUSES,et as USER_WORK_POSTURES,M as VERB_NAMES,agent,agentAvatarFromMetadata,Dn as agentAvatarSchema,agentDataChunk,agentDisplayName,rn as agentInferencePreferencesSchema,un as agentMessageAttachmentSchema,ln as agentMessagePartSchema,Mn as agentScheduleSchema,an as agentSessionInferenceOverridesInputSchema,on as agentSessionInferenceOverridesSchema,hn as agentSessionMessageSchema,On as agentStartersSchema,X as agentTriggerBaseSchema,Fn as agentTriggerPatchSchema,Pn as agentTriggerSchema,agentUIValidationError,dn as artifactQuoteSchema,T as askQuestionsOutputSchema,assertCustomAgentUIMessageChunk,assertSessionState,canonicalToolGroups,wn as classificationRestoreSchema,Cn as classifyEmailSchema,cliDefaultModelOf,compareAgentSessionMessages,compiledHarnessModels,connectionGrantKindsOf,Lt as connectorTriggerMatchSchema,J as customDataChunkSchemas,deriveViewerAccess,mn as durableDateSchema,bn as emailCategoryCreateSchema,Sn as emailCategoryDeleteSchema,En as emailCategoryScopeQuerySchema,xn as emailCategoryUpdateSchema,Tn as emailRuleScopeSchema,environmentHarness,environmentWorkdir,findEnvironmentHarness,jt as githubConditionSchema,Ft as githubTriggerMatchSchema,grantKindOf,harnessModelChoices,humanRequestId,humanRequestKind,K as imageModelIdSchema,U as inferenceReasoningSchema,W as inferenceRoutingSchema,H as inferenceSpeedSchema,isAgentMessageMetadata,isAgentNotificationMetadata,isAgentUIDataName,isAgentWrittenAuditEntry,isArchitectPublicationMetadata,isAwaitingHuman,isBlocking,isEnvironmentHarnessId,isMailProvider,isMailboxListMode,isNativeToolGroup,isOpenToolPartState,isParkedOnHuman,isProviderDraft,isPublicMailDomain,isReplyMode,isResourceGrant,isRoutineActorMetadata,isSessionInferencePatch,isSystemEmailCategory,isSystemEmailCategoryName,isSystemPartCode,isToolApprovalState,qt as meetingBotDispatchRequestSchema,Jt as meetingBotDispatchResponseSchema,Yt as meetingBotNotificationSchema,Ut as meetingTranscriptSegmentSchema,fn as mentionReferenceSchema,mergeSessionInferencePatch,pn as modelDefinitionSchema,G as modelReferenceSchema,needsManageWhenUnattended,Wt as normalizedMeetingTranscriptSchema,openRequests,orderAgentSessionMessages,parseAgentDefinitionAccessRole,parseCountMode,parseMergedAgentTrigger,parseOptionalCountMode,parsePageAccessRole,parseRecordAccessRole,parseToolGroupGrant,V as providerNameSchema,readAskQuestionsResult,recentActivityEntryKey,recordGraphNodeKey,ot as recordGraphRequestSchema,Gn as recordOperationSchema,refineTrigger,resourceGrant,cn as routedMessageInferenceSchema,sn as sessionInferencePatchSchema,Mt as slackConditionSchema,It as slackTriggerMatchSchema,gn as todoItemSchema,_n as todoPlanSchema,q as toolImpactSchema};
|