@stndrds/schema 1.0.0-alpha.302 → 1.0.0-alpha.303

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.
Files changed (65) hide show
  1. package/dist/{all-CarWsKlE.d.ts → all-BV7tFgtR.d.ts} +3 -3
  2. package/dist/{all-CNJlNEG2.d.mts → all-EX5romwn.d.mts} +3 -3
  3. package/dist/attributes-CJNqalP0.d.mts +1350 -0
  4. package/dist/attributes-CJNqalP0.d.ts +1350 -0
  5. package/dist/chunk-CCB4E55H.mjs +2 -0
  6. package/dist/chunk-JKGRSRRX.js +2 -0
  7. package/dist/exceptions.d.mts +1 -536
  8. package/dist/exceptions.d.ts +1 -536
  9. package/dist/{helpers-MEZ69ERH.d.mts → helpers-BnyKRb4x.d.mts} +3 -3
  10. package/dist/{helpers-BQ524PQe.d.ts → helpers-DIWzq1cf.d.ts} +3 -3
  11. package/dist/{index-DL0rfjzZ.d.ts → index-B36J5GDI.d.ts} +2 -2
  12. package/dist/{index-Kd4QZ13G.d.mts → index-DcXCAPHR.d.mts} +2 -2
  13. package/dist/index.d.mts +91 -16
  14. package/dist/index.d.ts +91 -16
  15. package/dist/index.js +17 -17
  16. package/dist/index.mjs +17 -17
  17. package/dist/{objects-D8tojUPV.d.ts → objects-CfJvQbZc.d.ts} +1 -3
  18. package/dist/{objects-DvZ79fW2.d.mts → objects-DglxOigU.d.mts} +1 -3
  19. package/dist/{types-R2f1GdCB.d.ts → types-CEwRsyh0.d.ts} +1 -1
  20. package/dist/{types-M5L07ItN.d.mts → types-Co8cq3dM.d.mts} +1 -1
  21. package/dist/utils.d.mts +2 -134
  22. package/dist/utils.d.ts +2 -134
  23. package/dist/utils.js +1 -1
  24. package/dist/utils.mjs +1 -1
  25. package/dist/validation/all.d.mts +6 -8
  26. package/dist/validation/all.d.ts +6 -8
  27. package/dist/validation/complex/currency.d.mts +2 -3
  28. package/dist/validation/complex/currency.d.ts +2 -3
  29. package/dist/validation/complex/location.d.mts +2 -3
  30. package/dist/validation/complex/location.d.ts +2 -3
  31. package/dist/validation/complex/phone.d.mts +2 -3
  32. package/dist/validation/complex/phone.d.ts +2 -3
  33. package/dist/validation/complex/relation.d.mts +2 -3
  34. package/dist/validation/complex/relation.d.ts +2 -3
  35. package/dist/validation/complex/richtext.d.mts +2 -3
  36. package/dist/validation/complex/richtext.d.ts +2 -3
  37. package/dist/validation/complex/select.d.mts +2 -3
  38. package/dist/validation/complex/select.d.ts +2 -3
  39. package/dist/validation/complex/user.d.mts +2 -3
  40. package/dist/validation/complex/user.d.ts +2 -3
  41. package/dist/validation/computed/formula.d.mts +2 -3
  42. package/dist/validation/computed/formula.d.ts +2 -3
  43. package/dist/validation/computed/rollup.d.mts +2 -3
  44. package/dist/validation/computed/rollup.d.ts +2 -3
  45. package/dist/validation/config/index.d.mts +3 -5
  46. package/dist/validation/config/index.d.ts +3 -5
  47. package/dist/validation/core/index.d.mts +3 -4
  48. package/dist/validation/core/index.d.ts +3 -4
  49. package/dist/validation/object/index.d.mts +4 -6
  50. package/dist/validation/object/index.d.ts +4 -6
  51. package/dist/validation/primitives/checkbox.d.mts +2 -3
  52. package/dist/validation/primitives/checkbox.d.ts +2 -3
  53. package/dist/validation/primitives/date.d.mts +2 -3
  54. package/dist/validation/primitives/date.d.ts +2 -3
  55. package/dist/validation/primitives/number.d.mts +2 -3
  56. package/dist/validation/primitives/number.d.ts +2 -3
  57. package/dist/validation/primitives/text.d.mts +2 -3
  58. package/dist/validation/primitives/text.d.ts +2 -3
  59. package/package.json +2 -2
  60. package/dist/attributes-DfhBu4HT.d.ts +0 -590
  61. package/dist/attributes-Zw-DDGE7.d.mts +0 -590
  62. package/dist/chunk-64F3CCLD.mjs +0 -2
  63. package/dist/chunk-ZMDMQAV5.js +0 -2
  64. package/dist/migrations-B1Wl_3RY.d.ts +0 -39
  65. package/dist/migrations-BG2mNaJn.d.mts +0 -39
package/dist/index.mjs CHANGED
@@ -1,22 +1,22 @@
1
- import {d,a as a$4}from'./chunk-64F3CCLD.mjs';export{b as asTenantId,c as asUserId,a as canonicalStringify,f as deepEqual,d as generateId,e as indexBy}from'./chunk-64F3CCLD.mjs';import {B,S as S$1,V as V$1,w as w$1,C as C$1,ma as ma$1,na as na$1,ka,fa as fa$1,ea as ea$1,$ as $$1,aa as aa$1,Z,ia as ia$1,la as la$1,y as y$1,ba as ba$1,_ as _$1,n as n$1,j,g,h as h$1,K as K$1,J as J$1,H,D,sa as sa$1,ra as ra$1}from'./chunk-WBFUAEWU.mjs';export{i as ATTRIBUTE_FILTER_OPERATORS,sa as LIST_TAB_KANBAN_KEYS,ra as LIST_TAB_TABLE_KEYS,y as LIST_VIEW_TAB_VISIBILITIES,f as LOCATION_FILTER_PROPERTIES,v as NATIVE_OBJECT_NAMES,s as NO_VALUE_OPERATORS,r as OPERATORS_BY_TYPE,W as REMOVED_OPERATOR_REPLACEMENTS,B as RESERVED_ATTRIBUTE_NAMES,C as RESERVED_OBJECT_NAMES,x as RESOURCE_VISIBILITIES,O as SYNONYM_ALIASES,c as SYSTEM_ATTRIBUTES,a as SYSTEM_ATTRIBUTE_I18N_KEYS,A as SYSTEM_FIELD_NAMES,V as SYSTEM_FILTER_ATTRIBUTE_TYPES,N as canonicalizeFilterValue,X as collectQualifiedRuleIssues,Z as columnsSchema,E as currentActor,ka as detailTabDraftSchema,ja as detailTabSchema,na as detailViewConfigSchema,_ as displayAttributesSchema,H as extractCurrencyFilterValue,I as extractFilterValue,da as fieldSchema,ca as fieldShape,ea as fieldSlotSchema,ba as filterGroupSchema,aa as filterStateSchema,j as getAttributeCapabilities,k as getAttributeFilterOperators,J as getOperatorPolarity,u as getRollupFilterOperators,b as getSystemAttributeI18nKey,d as getSystemAttributeList,fa as groupWriteSchema,ha as inverseSourceSchema,l as isAttributeFilterable,o as isAttributeGroupable,p as isAttributeKanbanGroupable,m as isAttributeSearchable,D as isDynamicValue,g as isLocationFilterProperty,h as isLocationPartOperator,e as isManagedSystemAttribute,w as isNativeObjectName,t as isNoValueOperator,R as isRelativeDateValue,M as isSetMembershipOperator,ma as listViewConfigSchema,la as listViewTabSchema,Q as normalizeFilterRule,K as normalizeForEdgeRpc,P as normalizeOperator,G as now,z as parseResourceVisibility,qa as parseViewConfig,ga as relationSourceSchema,q as resolveEffectiveFilterType,S as resolveIsWithinBounds,T as resolveUtcDayBounds,$ as sortsSchema,ia as tableSourceSchema,L as toMultiValueOperator,U as toUtcDayString,F as today,Y as validateQualifiedRule,pa as viewConfigByTypeSchema,oa as viewTypeSchema}from'./chunk-WBFUAEWU.mjs';import {c,n,e as e$1,m}from'./chunk-GKMHYCAM.mjs';export{d as ComputedFormulaParseError,a as SCHEMA_LIMITS,b as colorIdSchema,c as iconNameSchema,h as multiselectOptionWriteSchema,l as parseAttributeConfig,n as parseAttributeConfigForCreate,o as parseAttributeConfigForUpdate,e as parseComputedFormula,g as selectOptionWriteSchema,f as statusGroupSchema,i as statusOptionWriteSchema}from'./chunk-GKMHYCAM.mjs';import {a as a$1,c as c$2,e,g as g$1}from'./chunk-TEHAV6HL.mjs';export{d as createFormAttributeValidator,a as isNullishOrEmptyString,b as isValuePresent,l as rejectUnknownAttributesOrThrow,j as validateDraft,k as validateDraftOrThrow,h as validateObject,i as validateObjectOrThrow}from'./chunk-TEHAV6HL.mjs';import'./chunk-GKXTXH4Y.mjs';import'./chunk-Q7TQCRSD.mjs';import'./chunk-WMQRTFOP.mjs';export{a as createCheckboxValidator}from'./chunk-4VCADZK4.mjs';export{a as createDateValidator}from'./chunk-KYPEBOPW.mjs';import {c as c$1,a as a$3,b as b$2}from'./chunk-LB4TNMZU.mjs';import'./chunk-PFO7NWQW.mjs';import'./chunk-XMQV2WFY.mjs';import'./chunk-VKFLXFPP.mjs';import'./chunk-YIXNAWH6.mjs';import'./chunk-XRDP2Y4J.mjs';import {h,b as b$1,a as a$2,r,s,c as c$3}from'./chunk-55SG6IBQ.mjs';export{C as AccessDeniedError,I as AttributeInUseError,e as AttributeNotFoundError,q as ChangeTypeNotSupportedError,A as ConcurrentModificationError,o as DestructiveSyncNotAllowedError,r as DuplicateError,x as ForbiddenError,G as MemoryNotFoundError,p as MigrationTimeoutError,c as NotFoundError,F as NotImplementedError,d as ObjectNotFoundError,J as ObjectReferencedError,n as OrphanSystemAttributeError,i as ProtectedResourceError,y as ProtectedRoleError,f as RecordNotFoundError,H as RecordReferencedError,D as RepositoryError,s as ReservedObjectNameError,z as RoleNotFoundError,b as SchemaError,a as SchemaErrorCode,g as SchemaPlanNotFoundError,E as SearchBackendError,B as StorageError,m as SyncCascadeError,l as SyncConflictError,j as SyncError,k as SystemEntityImmutableError,h as ValidationError,L as isAttributeInUseError,u as isNotFoundError,M as isObjectReferencedError,w as isProtectedResourceError,K as isRecordReferencedError,t as isSchemaError,v as isValidationError}from'./chunk-55SG6IBQ.mjs';export{a as TEXT_FORMAT_PATTERNS,c as createTextValidator,b as resolveTextPattern}from'./chunk-O34B5KOW.mjs';export{a as createNumberValidator}from'./chunk-KG2ADZG6.mjs';export{a as DEFAULT_VALIDATION_MESSAGES,b as formatZodErrors}from'./chunk-4OTKOCGB.mjs';import {a}from'./chunk-KSPJP74K.mjs';import {ICONS,SKILL_NAME_MAX_LENGTH,SKILL_DESCRIPTION_MAX_LENGTH,MEMORY_NAME_MAX_LENGTH,MEMORY_DESCRIPTION_MAX_LENGTH,getCountryDisplayNameByIso3}from'@stndrds/constants';import er,{z as z$1}from'zod';/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- var ji=["fyi","task","question","handoff","system"],Mi=["low","normal","high","urgent"],Li=["public","internal","sensitive"],Bi=["unread","read","archived","snoozed"],Ui=["none","pending","processing","completed","dismissed","expired","failed"],vs="agent.session.waiting_human",Rs="agent.task.assigned",Es="agent.question.requested",ob=[vs,Rs,Es];var sb=["name","type"],ub=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],lb=["label","description","placeholder","icon"];var $i=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],He="*";function pb(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==He)}a(pb,"relationTargetsOf");function qi(e){return e.targets.length===1&&e.targets[0].object===He}a(qi,"isUniversalRelation");function mb(e){return e.bilateral!==void 0}a(mb,"isBilateralRelation");function fb(e){return "many"}a(fb,"inferInverseCardinality");function bb(e){return n$1(e)}a(bb,"isAttributeSortable");var hb=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],Ab=["record.created","record.updated","record.deleted","record.restored","record.purged","object.created","object.updated","object.deleted","attribute.created","attribute.updated","attribute.deleted","view.created","view.updated","view.deleted","schema_source.applied","schema_source.removed","user.created","user.invited","user.updated","user.deleted","user.login","user.logout","role.created","role.updated","role.deleted","role.assigned","role.revoked","settings.updated","file.uploaded","file.updated","file.deleted"];function xb(e){return e.phase==="terminal"}a(xb,"isTerminalState");function Ib(e){switch(e.phase){case "running":return "active";case "queued":return "idle";case "parked":if(e.parkedOn===void 0)throw new b$1("parked state without parkedOn",a$2.INVARIANT_VIOLATION);return e.parkedOn==="agents"?"waiting_agents":"waiting_human";case "terminal":if(e.outcome===void 0)throw new b$1("terminal state without outcome",a$2.INVARIANT_VIOLATION);return e.outcome}}a(Ib,"sessionStateToLegacyStatus");function Sb(e){switch(e){case "active":return {phase:"running"};case "idle":return {phase:"queued"};case "waiting_human":return {phase:"parked",parkedOn:"human",humanRequestIds:[]};case "waiting_agents":return {phase:"parked",parkedOn:"agents"};default:return {phase:"terminal",outcome:e}}}a(Sb,"legacyStatusToSessionState");var Ds=["completed","failed","cancelled","timeout","expired"];function vb(e){return Ds.includes(e)}a(vb,"isTerminalSessionStatus");var Cs=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function Rb(e){return Cs.includes(e)}a(Rb,"isClaimableSessionStatus");var zi=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),Eb=["active","completed","abandoned"],Gi=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],Wi=["standard","fast"],Ki=["none","minimal","low","medium","high","xhigh"];function Db(e){return e.label?.trim()||e.name}a(Db,"agentDisplayName");var Yi=["approval-requested","approval-responded","approval-dispatched"],Ns=["streaming","running",...Yi];function Cb(e){return Ns.includes(e)}a(Cb,"isOpenToolPartState");function Nb(e){return Yi.includes(e)}a(Nb,"isToolApprovalState");var Wt=["CREDITS_EXHAUSTED"];function Ob(e){return typeof e=="string"&&Wt.includes(e)}a(Ob,"isSystemPartCode");function Os(e,t){let r=e.createdAt.getTime()-t.createdAt.getTime();return r===0?e.id.localeCompare(t.id):r}a(Os,"compareAgentSessionMessages");function kb(e){return [...e].sort(Os)}a(kb,"orderAgentSessionMessages");var _b=["pending","in_progress","completed","blocked"],Pb=50,Fb=80,Vb=500,jb=2e3;var Ub="session-state",ks="__stndrdsNativeUiPartIds",_s=1,Ps="Native agent UI part IDs metadata is invalid";function se(){throw new h(Ps,[])}a(se,"invalidNativePartIds");function Hi(e){if(e===null||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}a(Hi,"isPlainRecord");function Fs(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}a(Fs,"nativeAgentUIPartIdMetadataKey");function $b(e){let t=e.metadata?.[ks];Hi(t)||se(),(Object.keys(t).length!==2||t.schemaVersion!==_s||!Hi(t.partIds))&&se();let r=new Map;for(let[s,l]of e.parts.entries()){let p=Fs(l,s);if(!p||r.has(p)){p&&se();continue}r.set(p,l);}let n=Object.entries(t.partIds);n.length!==r.size&&se();let o=new Map,a={};for(let[s,l]of n){let p=r.get(s);p&&typeof l=="string"&&l.length>0||se();let I=o.get(l);I&&(p.type==="tool"||I!==p.type)&&se(),p.type==="tool"&&l!==p.toolCallId&&se(),o.set(l,p.type),a[s]=l;}return a}a($b,"parseNativeAgentUIPartIdsMetadata");var Gb=16e3,Wb=3200,Kb=6400,Yb=16e3,Hb=65536,Qb=15e3,Jb=1e4,Xb=5e3,Zb="google/gemini-3.5-transcribe-live",eg={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var rg=["web","presentation","document","spreadsheet","image","code","other"],ng=["ephemeral","conversation","persistent"],ig=["source","preview","entrypoint","asset"];var Qi=5;function sg(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"?"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e):String(e)}a(sg,"getErrorMessage");function cg(e){return typeof e=="object"&&e!==null&&"slots"in e&&"steps"in e&&"name"in e&&typeof e.name=="string"&&Array.isArray(e.slots)&&Array.isArray(e.steps)}a(cg,"isFormDefinition");var Kt=["relation","multiRelation","formula","rollup","document","richtext","user"];function Ji(e){return e.type==="slot"}a(Ji,"isFormSlotFieldRef");function Yt(e){return e.type==="free"}a(Yt,"isFormFreeFieldRef");function fg(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}a(fg,"resolveFieldRequired");function Xi(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}a(Xi,"getSlotFieldTargets");function Vs(e){return Ji(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}a(Vs,"formFieldKey");function js(e){return Ji(e)?e.attribute:e.attribute.name}a(js,"formFieldFlatKey");function bg(e,t){return e[Vs(t)]??e[js(t)]}a(bg,"readFormFieldValue");function Qe(e){return e.type==="fields"}a(Qe,"isFormFieldsRow");function hg(e){return e.type==="heading"}a(hg,"isFormHeadingRow");function Ag(e){return e.type==="separator"}a(Ag,"isFormSeparatorRow");function Tg(e){return e.type==="text"}a(Tg,"isFormTextRow");var Ht=class Ht{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};a(Ht,"NoopGeocodingAdapter");var Zi=Ht;var Qt=["read","create","update","delete","manage"];function Eg(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===Qt.length&&Qt.every(t=>e.includes(t))?"full":"custom"}a(Eg,"actionsToAccessLevel");function Dg(e){switch(e){case "full":return [...Qt];case "read-only":return ["read"];case "none":return []}}a(Dg,"accessLevelToActions");function eo(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let r=t;return Array.isArray(r.definitions)?r.definitions:[]}a(eo,"resolvePropertyDefinitions");function Og(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}a(Og,"hasOptions");var Ms="Notetaker",Pg={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:Ms};var Vg=["active","suspended"],jg=["plan","manual","auto"];function Lg(e){return `${e.object}:${e.name}:${e.type}`}a(Lg,"viewStateKey");function Je(e){return e.type==="detail"}a(Je,"isDetailView");function to(e){return e.type==="list"}a(to,"isListView");function Ls(e){return e.type==="fields"}a(Ls,"isFieldGroup");var zg=["square","landscape","portrait"];var ro=["none","estimated","exact"];function Bs(e){if(typeof e=="string"&&ro.includes(e))return e;throw new h(`countMode must be one of: ${ro.join(", ")} (received: ${String(e)})`,[])}a(Bs,"parseCountMode");function Kg(e){return e===void 0?void 0:Bs(e)}a(Kg,"parseOptionalCountMode");var Yg=1e4;var Jg=["storage.bytes","members.seats","data.live_records"];function Us(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}a(Us,"isEmptyObject");function no(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}a(no,"isNotEmpty");function $s(e){return no(e)?e:void 0}a($s,"toUndefinedIfEmpty");function qs(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,r=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**r).toFixed(1)),unitIndex:r}}a(qs,"computeByteMagnitude");var zs=["B","KB","MB","GB","TB"];function zy(e){let{value:t,unitIndex:r}=qs(e);return `${t} ${zs[r]}`}a(zy,"formatByteSize");function Gs(e){return e.displayAttributes!==void 0?[...e.displayAttributes]:[...new Set([e.cardUserAttribute,e.cardDateAttribute].filter(t=>t!==void 0))]}a(Gs,"getListViewDisplayAttributeNames");var Hy={ATTACHMENTS:"attachments"};function Qy(e){return e.type==="document"}a(Qy,"isDocumentAttribute");function Jy(e,t){if(!t||t.length===0)return true;let r=e.name.toLowerCase();return t.some(n=>n.endsWith("/*")?e.mimeType.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n.toLowerCase()):e.mimeType===n)}a(Jy,"matchesAccepts");var io=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function Xe(e){let t=[];for(let r of e){let n=r.build();if(!io.includes(n.type))throw new Error(`Property type "${n.type}" is not supported in .qualifyWith()`);t.push(n);}return {definitions:t}}a(Xe,"buildPropertySchema");var rh="__";function nh(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)}}a(nh,"parseQualifiedAttribute");function ih(e,t){return `${e}__${t}`}a(ih,"buildQualifiedAttribute");function ee(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}a(ee,"isDateRangeValue");function Ws(e,t){return a$1(e)?null:ee(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e=="string"?t.endDate?{start:e,end:null}:e:null}a(Ws,"normalizeDateValue");function be(e){return typeof e=="string"&&e!==""?e:ee(e)&&e.start!==""?e.start:null}a(be,"dateValueStart");var Ze="\u2014";function Ks(e){return String(e)}a(Ks,"formatText");function Ys(e){return e?"Yes":"No"}a(Ys,"formatCheckbox");function Hs(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let r=t.decimals;return t.unit==="integer"?e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}):t.unit==="percentage"?(e/100).toLocaleString(void 0,{style:"percent",minimumFractionDigits:r,maximumFractionDigits:r}):e.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}a(Hs,"formatNumber");function Qs(e,t){if(typeof e!="object"||e===null)return String(e);let r=e;return "value"in r&&"code"in r?`${r.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${r.code}`:String(e)}a(Qs,"formatCurrency");function Jt(e){if(ee(e)){let t=Jt(e.start);return e.end?`${t} \u2192 ${Jt(e.end)}`:t}if(e instanceof Date)return e.toISOString().split("T")[0];if(typeof e=="string"){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toISOString().split("T")[0]}return String(e)}a(Jt,"formatDate");function Js(e){if(typeof e!="object"||e===null)return String(e);let t=e;return "phoneNumber"in t?t.phoneNumber?t.countryCode?c$1(t):t.phoneNumber:"":String(e)}a(Js,"formatPhone");function Xs(e,t="full"){if(typeof e!="object"||e===null)return "";let r=e,n=[];switch(t){case "country":r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "state":r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "city":r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "coordinates":r.latitude!==void 0&&r.longitude!==void 0&&n.push(`${r.latitude}, ${r.longitude}`);break;case "address":r.address&&n.push(r.address),r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;default:r.address&&n.push(r.address),r.address2&&n.push(r.address2),r.city&&n.push(r.city),r.state&&n.push(r.state),r.postalCode&&n.push(r.postalCode),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break}return n.join(", ")}a(Xs,"formatLocationValue");function Zs(e,t){return typeof e!="object"||e===null?String(e):Xs(e,t.granularity??"full")||Ze}a(Zs,"formatLocation");function eu(e,t){return typeof e!="string"?String(e):t.options?.find(n=>n.value===e)?.label??String(e)}a(eu,"formatSelect");function tu(e,t){return Array.isArray(e)?t.options?e.map(n=>t.options.find(o=>o.value===n)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}a(tu,"formatMultiselect");function oo(e,t){if(a$1(e))return Ze;switch(t.type){case "text":return Ks(e);case "checkbox":return Ys(e);case "number":return Hs(e,t);case "currency":return Qs(e);case "date":return Jt(e);case "phone":return Js(e);case "location":return Zs(e,t);case "select":case "status":return eu(e,t);case "multiselect":return tu(e,t);case "user":case "relation":return Array.isArray(e)?e.join(", "):String(e);default:return Array.isArray(e)?e.join(", "):String(e)}}a(oo,"formatAttributeValue");var nu=["UPPER","LOWER","capitalize","trim"],iu=["prefix","suffix","wrap","default"],et=[...nu,...iu],ge=z$1.string().min(1,"labelExpression cannot be empty").refine(e=>tt(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,r;for(;(r=t.exec(e))!==null;){let n=r[1];if(!et.includes(n))return false}return true},{message:`Invalid pipe name. Valid pipes: ${et.join(", ")}`});function ou(e){let t=ge.safeParse(e);return t.success?{success:true,attributes:po(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}a(ou,"validateLabelExpression");var ao={UPPER:a(e=>String(e).toUpperCase(),"UPPER"),LOWER:a(e=>String(e).toLowerCase(),"LOWER"),capitalize:a(e=>String(e).replace(/(^|\s)\S/g,t=>t.toUpperCase()),"capitalize"),trim:a(e=>String(e).trim(),"trim")},so={prefix:a((e,t="")=>e?`${t}${e}`:"","prefix"),suffix:a((e,t="")=>e?`${e}${t}`:"","suffix"),wrap:a((e,t="",r="")=>e?`${t}${e}${r}`:"","wrap"),default:a((e,t="")=>e||t,"default")};function au(e,t){let r=e;for(let n of t){let{name:o,args:a}=lo(n),s=ao[o];if(s)r!==""&&(r=s(r));else {let l=so[o];l&&(r=l(r,...a));}}return r}a(au,"applyPipes");function su(e,t){return t.split(".").reduce((r,n)=>{if(!(r==null||typeof r!="object"))return r[n]},e)}a(su,"getValue");var uo="(Untitled)";function lo(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let r=t[1],n=t[2];if(!n)return {name:r,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(n))!==null;)o.push(s[1]);return {name:r,args:o}}a(lo,"parsePipeExpression");function Xt(e,t,r=uo){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(o,a)=>{let s=a.split("||").map(j=>j.trim()),p=s[s.length-1].split("|").map(j=>j.trim());s[s.length-1]=p[0];let I=p.slice(1).filter(Boolean),Z=s.filter(Boolean),B="";for(let j of Z){let H=co(su(t,j));if(H!==""){B=H;break}}if(a$1(B)&&I.length===0)return "";for(let j of I){let{name:H,args:ss}=lo(j),pi=ao[H];if(pi)B!==""&&(B=pi(B));else {let mi=so[H];mi&&(B=mi(B,...ss));}}return B}).trim()||r}a(Xt,"renderLabelExpression");function co(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(co).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}a(co,"toText");function tt(e){return /\{\{\s*\S+.*\}\}/.test(e)}a(tt,"isLabelExpression");function po(e){let t=[],r=/\{\{\s*([^}]+)\s*\}\}/g,n;for(;(n=r.exec(e))!==null;){let a=n[1].trim().split("||").map(l=>l.trim()),s=a[a.length-1];a[a.length-1]=s.split("|")[0].trim();for(let l of a){if(!l)continue;let p=l.split(".")[0];p&&!t.includes(p)&&t.push(p);}}return t}a(po,"extractAttributeNames");var uu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function mo(e){let t=e.trim().match(uu);return t?t[1]:null}a(mo,"getSingleAttributeFromExpression");function lu(e,t){let r=mo(e);if(r===null)return null;let n=t.find(o=>o.name===r);return !n||n.type!=="text"||j(n).authoring.readOnly?null:n}a(lu,"getEditableLabelAttribute");var du=/\{\{\s*props\./;function cu(e,t,r){if(!du.test(e))return e;let n={},o=new Map(r?.map(s=>[s.name,s]));if(t)for(let[s,l]of Object.entries(t)){if(l==null)continue;let p=o.get(s);if(p){let I=oo(l,p);n[s]=I===Ze?"":I;}else n[s]=l;}return Xt(e,{props:n},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}a(cu,"applyRelationProps");function pu(e){if(e?.type==="relation")return e.properties?.definitions}a(pu,"relationPropertyDefs");function mu(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}a(mu,"qualifiedPropertyDefs");function fo(e){if(a$1(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>fo(t));if(typeof e=="object"&&"id"in e){let t=e;if(typeof t.id=="string")return [{id:t.id,props:t.props}]}return []}a(fo,"extractValueRefs");function fu(e){let t=[e.firstName,e.lastName].map(r=>r?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}a(fu,"getUserDisplayName");var bu=/\p{L}|\p{N}/u;function gu(e,t){let r=e?.trim()??"";if(r==="")return t;let n=r.split(/\s+/),a=(n.length===1?r.split("@")[0].split(/[._-]/):n).map(s=>{let l=s.match(bu)?.[0];return l===void 0?"":[...l.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}a(gu,"deriveInitials");var bo="__creatorRootActorId";function yu(e){let t=e.metadata?.[bo];return typeof t=="string"&&t.length>0?t:e.createdBy}a(yu,"getRecordCreatorPrincipalId");function ye(e,t){return e?.includes("*")===true||e?.includes(t)===true}a(ye,"includesAction");function hu(e){return {canRead:ye(e,"read"),canCreate:ye(e,"create"),canUpdate:ye(e,"update"),canDelete:ye(e,"delete"),canManage:ye(e,"manage")}}a(hu,"buildPermissionFlags");var kh=new Set(["id","name","label","type","required","system","unique","order"]);var L={PEOPLE:"people",WORKSPACE:"workspace",ARCHITECT:"architect",FEATURE_FLAGS:"feature-flags",FILES:"files",VIEWS:"views",FORMS:"forms",DOCUMENTS:"documents",AUDIT:"audit",API_KEYS:"api-keys",CONNECTORS:"connectors",ENV_VARS:"env-vars",SESSION:"session"},Ph=[L.PEOPLE,L.WORKSPACE,L.ARCHITECT,L.FEATURE_FLAGS,L.FILES,L.VIEWS,L.FORMS,L.DOCUMENTS,L.AUDIT,L.API_KEYS,L.CONNECTORS,L.ENV_VARS,L.SESSION],Fh={people:"People",workspace:"Workspace",architect:"Architect","feature-flags":"Feature flags",files:"Files",views:"Views",forms:"Forms",documents:"Documents",audit:"Audit","api-keys":"API keys",connectors:"Connected accounts","env-vars":"Environment variables",session:"Agent sessions"},Au={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},Vh={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},jh={owner:"Full access to all platform features and data",member:"Can view, create, edit and delete business data",agent_default:"Default role for AI agents \u2014 CRUD on records plus documents and files",reflex_default:"Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"},Zt=["read","create","update","delete","manage"],Tu=["read","create","delete"],Mh={owner:{system:[{target:"*",actions:Zt}],object:[{target:"*",actions:Zt}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:Tu},{target:"files",actions:["read","create","update"]}],object:[{target:"*",actions:Zt}]},agent_default:{system:[{target:"documents",actions:["read","create","update"]},{target:"files",actions:["read","create","update"]},{target:"env-vars",actions:["read"]},{target:"session",actions:["observe"]}],object:[{target:"*",actions:["read","create","update","delete"]}]},reflex_default:{system:[],object:[]}};function Lh(e){return Object.values(Au).includes(e)}a(Lh,"isDefaultRole");var xu=new Set(ICONS),yo=/^[a-zA-Z_][a-zA-Z0-9_]*$/,Iu=/^[a-z][a-z0-9-]*$/,he=63,go=128,rt=er.string().min(1,"Object name cannot be empty").max(63,"Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
1
+ import {h as h$1,b as b$3}from'./chunk-CCB4E55H.mjs';export{a as NonJsonValueError,f as asTenantId,g as asUserId,b as canonicalStringify,j as deepEqual,h as generateId,i as indexBy,e as sameStableValue,d as serializeCanonicalJson,c as serializeStableJson}from'./chunk-CCB4E55H.mjs';import {B,S as S$1,V as V$1,w as w$1,C as C$1,ma as ma$1,na as na$1,ka as ka$1,fa as fa$1,ea as ea$1,$ as $$1,aa as aa$1,Z,ia as ia$1,la as la$1,y,ba as ba$1,_ as _$1,n as n$1,j,g as g$1,h as h$2,K as K$1,J as J$1,H,D as D$1,sa as sa$1,ra as ra$1}from'./chunk-WBFUAEWU.mjs';export{i as ATTRIBUTE_FILTER_OPERATORS,sa as LIST_TAB_KANBAN_KEYS,ra as LIST_TAB_TABLE_KEYS,y as LIST_VIEW_TAB_VISIBILITIES,f as LOCATION_FILTER_PROPERTIES,v as NATIVE_OBJECT_NAMES,s as NO_VALUE_OPERATORS,r as OPERATORS_BY_TYPE,W as REMOVED_OPERATOR_REPLACEMENTS,B as RESERVED_ATTRIBUTE_NAMES,C as RESERVED_OBJECT_NAMES,x as RESOURCE_VISIBILITIES,O as SYNONYM_ALIASES,c as SYSTEM_ATTRIBUTES,a as SYSTEM_ATTRIBUTE_I18N_KEYS,A as SYSTEM_FIELD_NAMES,V as SYSTEM_FILTER_ATTRIBUTE_TYPES,N as canonicalizeFilterValue,X as collectQualifiedRuleIssues,Z as columnsSchema,E as currentActor,ka as detailTabDraftSchema,ja as detailTabSchema,na as detailViewConfigSchema,_ as displayAttributesSchema,H as extractCurrencyFilterValue,I as extractFilterValue,da as fieldSchema,ca as fieldShape,ea as fieldSlotSchema,ba as filterGroupSchema,aa as filterStateSchema,j as getAttributeCapabilities,k as getAttributeFilterOperators,J as getOperatorPolarity,u as getRollupFilterOperators,b as getSystemAttributeI18nKey,d as getSystemAttributeList,fa as groupWriteSchema,ha as inverseSourceSchema,l as isAttributeFilterable,o as isAttributeGroupable,p as isAttributeKanbanGroupable,m as isAttributeSearchable,D as isDynamicValue,g as isLocationFilterProperty,h as isLocationPartOperator,e as isManagedSystemAttribute,w as isNativeObjectName,t as isNoValueOperator,R as isRelativeDateValue,M as isSetMembershipOperator,ma as listViewConfigSchema,la as listViewTabSchema,Q as normalizeFilterRule,K as normalizeForEdgeRpc,P as normalizeOperator,G as now,z as parseResourceVisibility,qa as parseViewConfig,ga as relationSourceSchema,q as resolveEffectiveFilterType,S as resolveIsWithinBounds,T as resolveUtcDayBounds,$ as sortsSchema,ia as tableSourceSchema,L as toMultiValueOperator,U as toUtcDayString,F as today,Y as validateQualifiedRule,pa as viewConfigByTypeSchema,oa as viewTypeSchema}from'./chunk-WBFUAEWU.mjs';import {c,n,e as e$1,m}from'./chunk-GKMHYCAM.mjs';export{d as ComputedFormulaParseError,a as SCHEMA_LIMITS,b as colorIdSchema,c as iconNameSchema,h as multiselectOptionWriteSchema,l as parseAttributeConfig,n as parseAttributeConfigForCreate,o as parseAttributeConfigForUpdate,e as parseComputedFormula,g as selectOptionWriteSchema,f as statusGroupSchema,i as statusOptionWriteSchema}from'./chunk-GKMHYCAM.mjs';import {a as a$1,c as c$2,e,g as g$2}from'./chunk-TEHAV6HL.mjs';export{d as createFormAttributeValidator,a as isNullishOrEmptyString,b as isValuePresent,l as rejectUnknownAttributesOrThrow,j as validateDraft,k as validateDraftOrThrow,h as validateObject,i as validateObjectOrThrow}from'./chunk-TEHAV6HL.mjs';import'./chunk-GKXTXH4Y.mjs';import'./chunk-Q7TQCRSD.mjs';import'./chunk-WMQRTFOP.mjs';export{a as createCheckboxValidator}from'./chunk-4VCADZK4.mjs';export{a as createDateValidator}from'./chunk-KYPEBOPW.mjs';import {c as c$1,a as a$3,b as b$2}from'./chunk-LB4TNMZU.mjs';import'./chunk-PFO7NWQW.mjs';import'./chunk-XMQV2WFY.mjs';import'./chunk-VKFLXFPP.mjs';import'./chunk-YIXNAWH6.mjs';import'./chunk-XRDP2Y4J.mjs';import {h,b as b$1,a as a$2,r,s,c as c$3}from'./chunk-55SG6IBQ.mjs';export{C as AccessDeniedError,I as AttributeInUseError,e as AttributeNotFoundError,q as ChangeTypeNotSupportedError,A as ConcurrentModificationError,o as DestructiveSyncNotAllowedError,r as DuplicateError,x as ForbiddenError,G as MemoryNotFoundError,p as MigrationTimeoutError,c as NotFoundError,F as NotImplementedError,d as ObjectNotFoundError,J as ObjectReferencedError,n as OrphanSystemAttributeError,i as ProtectedResourceError,y as ProtectedRoleError,f as RecordNotFoundError,H as RecordReferencedError,D as RepositoryError,s as ReservedObjectNameError,z as RoleNotFoundError,b as SchemaError,a as SchemaErrorCode,g as SchemaPlanNotFoundError,E as SearchBackendError,B as StorageError,m as SyncCascadeError,l as SyncConflictError,j as SyncError,k as SystemEntityImmutableError,h as ValidationError,L as isAttributeInUseError,u as isNotFoundError,M as isObjectReferencedError,w as isProtectedResourceError,K as isRecordReferencedError,t as isSchemaError,v as isValidationError}from'./chunk-55SG6IBQ.mjs';export{a as TEXT_FORMAT_PATTERNS,c as createTextValidator,b as resolveTextPattern}from'./chunk-O34B5KOW.mjs';export{a as createNumberValidator}from'./chunk-KG2ADZG6.mjs';export{a as DEFAULT_VALIDATION_MESSAGES,b as formatZodErrors}from'./chunk-4OTKOCGB.mjs';import {a}from'./chunk-KSPJP74K.mjs';import {ICONS,SKILL_NAME_MAX_LENGTH,SKILL_DESCRIPTION_MAX_LENGTH,MEMORY_NAME_MAX_LENGTH,MEMORY_DESCRIPTION_MAX_LENGTH,getCountryDisplayNameByIso3}from'@stndrds/constants';import ar,{z as z$1}from'zod';/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
+ var Ki=["fyi","task","question","handoff","system"],Yi=["low","normal","high","urgent"],Hi=["public","internal","sensitive"],Qi=["unread","read","archived","snoozed"],Ji=["none","pending","processing","completed","dismissed","expired","failed"],zs="agent.session.waiting_human",Gs="agent.task.assigned",Ws="agent.question.requested",Eb=[zs,Gs,Ws];var Cb=["name","type"],Nb=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],Ob=["label","description","placeholder","icon"];var Xi=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],Ze="*";function Pb(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==Ze)}a(Pb,"relationTargetsOf");function Zi(e){return e.targets.length===1&&e.targets[0].object===Ze}a(Zi,"isUniversalRelation");function Fb(e){return e.bilateral!==void 0}a(Fb,"isBilateralRelation");function Vb(e){return "many"}a(Vb,"inferInverseCardinality");function jb(e){return n$1(e)}a(jb,"isAttributeSortable");var Bb=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],Ub=["record.created","record.updated","record.deleted","record.restored","record.purged","object.created","object.updated","object.deleted","attribute.created","attribute.updated","attribute.deleted","view.created","view.updated","view.deleted","schema_source.applied","schema_source.removed","user.created","user.invited","user.updated","user.deleted","user.login","user.logout","role.created","role.updated","role.deleted","role.assigned","role.revoked","settings.updated","file.uploaded","file.updated","file.deleted"];function zb(e){return e.phase==="terminal"}a(zb,"isTerminalState");function Gb(e){switch(e.phase){case "running":return "active";case "queued":return "idle";case "parked":if(e.parkedOn===void 0)throw new b$1("parked state without parkedOn",a$2.INVARIANT_VIOLATION);return e.parkedOn==="agents"?"waiting_agents":"waiting_human";case "terminal":if(e.outcome===void 0)throw new b$1("terminal state without outcome",a$2.INVARIANT_VIOLATION);return e.outcome}}a(Gb,"sessionStateToLegacyStatus");function Wb(e){switch(e){case "active":return {phase:"running"};case "idle":return {phase:"queued"};case "waiting_human":return {phase:"parked",parkedOn:"human",humanRequestIds:[]};case "waiting_agents":return {phase:"parked",parkedOn:"agents"};default:return {phase:"terminal",outcome:e}}}a(Wb,"legacyStatusToSessionState");var Ks=["completed","failed","cancelled","timeout","expired"];function Kb(e){return Ks.includes(e)}a(Kb,"isTerminalSessionStatus");var Ys=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function Yb(e){return Ys.includes(e)}a(Yb,"isClaimableSessionStatus");var eo=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),Hb=["active","completed","abandoned"],to=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],ro=["standard","fast"],no=["none","minimal","low","medium","high","xhigh"];function Qb(e){return e.label?.trim()||e.name}a(Qb,"agentDisplayName");var io=["approval-requested","approval-responded","approval-dispatched"],Hs=["streaming","running",...io];function Jb(e){return Hs.includes(e)}a(Jb,"isOpenToolPartState");function Xb(e){return io.includes(e)}a(Xb,"isToolApprovalState");var Xt=["CREDITS_EXHAUSTED"];function Zb(e){return typeof e=="string"&&Xt.includes(e)}a(Zb,"isSystemPartCode");function Qs(e,t){let r=e.createdAt.getTime()-t.createdAt.getTime();return r===0?e.id.localeCompare(t.id):r}a(Qs,"compareAgentSessionMessages");function eg(e){return [...e].sort(Qs)}a(eg,"orderAgentSessionMessages");var tg=["pending","in_progress","completed","blocked"],rg=50,ng=80,ig=500,og=2e3;var lg="session-state",Js="__stndrdsNativeUiPartIds",Xs=1,Zs="Native agent UI part IDs metadata is invalid";function se(){throw new h(Zs,[])}a(se,"invalidNativePartIds");function oo(e){if(e===null||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}a(oo,"isPlainRecord");function eu(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}a(eu,"nativeAgentUIPartIdMetadataKey");function dg(e){let t=e.metadata?.[Js];oo(t)||se(),(Object.keys(t).length!==2||t.schemaVersion!==Xs||!oo(t.partIds))&&se();let r=new Map;for(let[s,l]of e.parts.entries()){let p=eu(l,s);if(!p||r.has(p)){p&&se();continue}r.set(p,l);}let n=Object.entries(t.partIds);n.length!==r.size&&se();let o=new Map,a={};for(let[s,l]of n){let p=r.get(s);p&&typeof l=="string"&&l.length>0||se();let I=o.get(l);I&&(p.type==="tool"||I!==p.type)&&se(),p.type==="tool"&&l!==p.toolCallId&&se(),o.set(l,p.type),a[s]=l;}return a}a(dg,"parseNativeAgentUIPartIdsMetadata");var mg=16e3,fg=3200,bg=6400,gg=16e3,yg=65536,hg=15e3,Ag=1e4,Tg=5e3,wg="google/gemini-3.5-transcribe-live",xg={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var Sg=["web","presentation","document","spreadsheet","image","code","other"],vg=["ephemeral","conversation","persistent"],Rg=["source","preview","entrypoint","asset"];var ao=5;function Cg(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"?"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e):String(e)}a(Cg,"getErrorMessage");function _g(e){return typeof e=="object"&&e!==null&&"slots"in e&&"steps"in e&&"name"in e&&typeof e.name=="string"&&Array.isArray(e.slots)&&Array.isArray(e.steps)}a(_g,"isFormDefinition");var Zt=["relation","multiRelation","formula","rollup","document","richtext","user"];function so(e){return e.type==="slot"}a(so,"isFormSlotFieldRef");function er(e){return e.type==="free"}a(er,"isFormFreeFieldRef");function Vg(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}a(Vg,"resolveFieldRequired");function uo(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}a(uo,"getSlotFieldTargets");function tu(e){return so(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}a(tu,"formFieldKey");function ru(e){return so(e)?e.attribute:e.attribute.name}a(ru,"formFieldFlatKey");function jg(e,t){return e[tu(t)]??e[ru(t)]}a(jg,"readFormFieldValue");function et(e){return e.type==="fields"}a(et,"isFormFieldsRow");function Bg(e){return e.type==="heading"}a(Bg,"isFormHeadingRow");function Ug(e){return e.type==="separator"}a(Ug,"isFormSeparatorRow");function $g(e){return e.type==="text"}a($g,"isFormTextRow");var tr=class tr{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};a(tr,"NoopGeocodingAdapter");var lo=tr;var rr=["read","create","update","delete","manage"];function Hg(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===rr.length&&rr.every(t=>e.includes(t))?"full":"custom"}a(Hg,"actionsToAccessLevel");function Qg(e){switch(e){case "full":return [...rr];case "read-only":return ["read"];case "none":return []}}a(Qg,"accessLevelToActions");function co(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let r=t;return Array.isArray(r.definitions)?r.definitions:[]}a(co,"resolvePropertyDefinitions");function Zg(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}a(Zg,"hasOptions");var nu="Notetaker",ry={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:nu};var iy=["active","suspended"],oy=["plan","manual","auto"];function sy(e){return `${e.object}:${e.name}:${e.type}`}a(sy,"viewStateKey");function tt(e){return e.type==="detail"}a(tt,"isDetailView");function po(e){return e.type==="list"}a(po,"isListView");function iu(e){return e.type==="fields"}a(iu,"isFieldGroup");var py=["square","landscape","portrait"];var mo=["none","estimated","exact"];function ou(e){if(typeof e=="string"&&mo.includes(e))return e;throw new h(`countMode must be one of: ${mo.join(", ")} (received: ${String(e)})`,[])}a(ou,"parseCountMode");function by(e){return e===void 0?void 0:ou(e)}a(by,"parseOptionalCountMode");var gy=1e4;var Ay=["storage.bytes","members.seats","data.live_records"];function au(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}a(au,"isEmptyObject");function fo(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}a(fo,"isNotEmpty");function su(e){return fo(e)?e:void 0}a(su,"toUndefinedIfEmpty");function uu(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,r=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**r).toFixed(1)),unitIndex:r}}a(uu,"computeByteMagnitude");var lu=["B","KB","MB","GB","TB"];function ph(e){let{value:t,unitIndex:r}=uu(e);return `${t} ${lu[r]}`}a(ph,"formatByteSize");function du(e){return e.displayAttributes!==void 0?[...e.displayAttributes]:[...new Set([e.cardUserAttribute,e.cardDateAttribute].filter(t=>t!==void 0))]}a(du,"getListViewDisplayAttributeNames");var yh={ATTACHMENTS:"attachments"};function hh(e){return e.type==="document"}a(hh,"isDocumentAttribute");function Ah(e,t){if(!t||t.length===0)return true;let r=e.name.toLowerCase();return t.some(n=>n.endsWith("/*")?e.mimeType.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n.toLowerCase()):e.mimeType===n)}a(Ah,"matchesAccepts");var bo=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function rt(e){let t=[];for(let r of e){let n=r.build();if(!bo.includes(n.type))throw new Error(`Property type "${n.type}" is not supported in .qualifyWith()`);t.push(n);}return {definitions:t}}a(rt,"buildPropertySchema");var Sh="__";function vh(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)}}a(vh,"parseQualifiedAttribute");function Rh(e,t){return `${e}__${t}`}a(Rh,"buildQualifiedAttribute");function ee(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}a(ee,"isDateRangeValue");function cu(e,t){return a$1(e)?null:ee(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e=="string"?t.endDate?{start:e,end:null}:e:null}a(cu,"normalizeDateValue");function ge(e){return typeof e=="string"&&e!==""?e:ee(e)&&e.start!==""?e.start:null}a(ge,"dateValueStart");var nt="\u2014";function pu(e){return String(e)}a(pu,"formatText");function mu(e){return e?"Yes":"No"}a(mu,"formatCheckbox");function fu(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let r=t.decimals;return t.unit==="integer"?e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}):t.unit==="percentage"?(e/100).toLocaleString(void 0,{style:"percent",minimumFractionDigits:r,maximumFractionDigits:r}):e.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}a(fu,"formatNumber");function bu(e,t){if(typeof e!="object"||e===null)return String(e);let r=e;return "value"in r&&"code"in r?`${r.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${r.code}`:String(e)}a(bu,"formatCurrency");function nr(e){if(ee(e)){let t=nr(e.start);return e.end?`${t} \u2192 ${nr(e.end)}`:t}if(e instanceof Date)return e.toISOString().split("T")[0];if(typeof e=="string"){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toISOString().split("T")[0]}return String(e)}a(nr,"formatDate");function gu(e){if(typeof e!="object"||e===null)return String(e);let t=e;return "phoneNumber"in t?t.phoneNumber?t.countryCode?c$1(t):t.phoneNumber:"":String(e)}a(gu,"formatPhone");function yu(e,t="full"){if(typeof e!="object"||e===null)return "";let r=e,n=[];switch(t){case "country":r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "state":r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "city":r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;case "coordinates":r.latitude!==void 0&&r.longitude!==void 0&&n.push(`${r.latitude}, ${r.longitude}`);break;case "address":r.address&&n.push(r.address),r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break;default:r.address&&n.push(r.address),r.address2&&n.push(r.address2),r.city&&n.push(r.city),r.state&&n.push(r.state),r.postalCode&&n.push(r.postalCode),r.country&&n.push(getCountryDisplayNameByIso3(r.country));break}return n.join(", ")}a(yu,"formatLocationValue");function hu(e,t){return typeof e!="object"||e===null?String(e):yu(e,t.granularity??"full")||nt}a(hu,"formatLocation");function Au(e,t){return typeof e!="string"?String(e):t.options?.find(n=>n.value===e)?.label??String(e)}a(Au,"formatSelect");function Tu(e,t){return Array.isArray(e)?t.options?e.map(n=>t.options.find(o=>o.value===n)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}a(Tu,"formatMultiselect");function go(e,t){if(a$1(e))return nt;switch(t.type){case "text":return pu(e);case "checkbox":return mu(e);case "number":return fu(e,t);case "currency":return bu(e);case "date":return nr(e);case "phone":return gu(e);case "location":return hu(e,t);case "select":case "status":return Au(e,t);case "multiselect":return Tu(e,t);case "user":case "relation":return Array.isArray(e)?e.join(", "):String(e);default:return Array.isArray(e)?e.join(", "):String(e)}}a(go,"formatAttributeValue");var xu=["UPPER","LOWER","capitalize","trim"],Iu=["prefix","suffix","wrap","default"],it=[...xu,...Iu],ye=z$1.string().min(1,"labelExpression cannot be empty").refine(e=>ot(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,r;for(;(r=t.exec(e))!==null;){let n=r[1];if(!it.includes(n))return false}return true},{message:`Invalid pipe name. Valid pipes: ${it.join(", ")}`});function Su(e){let t=ye.safeParse(e);return t.success?{success:true,attributes:xo(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}a(Su,"validateLabelExpression");var yo={UPPER:a(e=>String(e).toUpperCase(),"UPPER"),LOWER:a(e=>String(e).toLowerCase(),"LOWER"),capitalize:a(e=>String(e).replace(/(^|\s)\S/g,t=>t.toUpperCase()),"capitalize"),trim:a(e=>String(e).trim(),"trim")},ho={prefix:a((e,t="")=>e?`${t}${e}`:"","prefix"),suffix:a((e,t="")=>e?`${e}${t}`:"","suffix"),wrap:a((e,t="",r="")=>e?`${t}${e}${r}`:"","wrap"),default:a((e,t="")=>e||t,"default")};function vu(e,t){let r=e;for(let n of t){let{name:o,args:a}=To(n),s=yo[o];if(s)r!==""&&(r=s(r));else {let l=ho[o];l&&(r=l(r,...a));}}return r}a(vu,"applyPipes");function Ru(e,t){return t.split(".").reduce((r,n)=>{if(!(r==null||typeof r!="object"))return r[n]},e)}a(Ru,"getValue");var Ao="(Untitled)";function To(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let r=t[1],n=t[2];if(!n)return {name:r,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(n))!==null;)o.push(s[1]);return {name:r,args:o}}a(To,"parsePipeExpression");function ir(e,t,r=Ao){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(o,a)=>{let s=a.split("||").map(j=>j.trim()),p=s[s.length-1].split("|").map(j=>j.trim());s[s.length-1]=p[0];let I=p.slice(1).filter(Boolean),Z=s.filter(Boolean),B="";for(let j of Z){let H=wo(Ru(t,j));if(H!==""){B=H;break}}if(a$1(B)&&I.length===0)return "";for(let j of I){let{name:H,args:xs}=To(j),xi=yo[H];if(xi)B!==""&&(B=xi(B));else {let Ii=ho[H];Ii&&(B=Ii(B,...xs));}}return B}).trim()||r}a(ir,"renderLabelExpression");function wo(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(wo).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}a(wo,"toText");function ot(e){return /\{\{\s*\S+.*\}\}/.test(e)}a(ot,"isLabelExpression");function xo(e){let t=[],r=/\{\{\s*([^}]+)\s*\}\}/g,n;for(;(n=r.exec(e))!==null;){let a=n[1].trim().split("||").map(l=>l.trim()),s=a[a.length-1];a[a.length-1]=s.split("|")[0].trim();for(let l of a){if(!l)continue;let p=l.split(".")[0];p&&!t.includes(p)&&t.push(p);}}return t}a(xo,"extractAttributeNames");var Eu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function Io(e){let t=e.trim().match(Eu);return t?t[1]:null}a(Io,"getSingleAttributeFromExpression");function Du(e,t){let r=Io(e);if(r===null)return null;let n=t.find(o=>o.name===r);return !n||n.type!=="text"||j(n).authoring.readOnly?null:n}a(Du,"getEditableLabelAttribute");var Cu=/\{\{\s*props\./;function Nu(e,t,r){if(!Cu.test(e))return e;let n={},o=new Map(r?.map(s=>[s.name,s]));if(t)for(let[s,l]of Object.entries(t)){if(l==null)continue;let p=o.get(s);if(p){let I=go(l,p);n[s]=I===nt?"":I;}else n[s]=l;}return ir(e,{props:n},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}a(Nu,"applyRelationProps");function Ou(e){if(e?.type==="relation")return e.properties?.definitions}a(Ou,"relationPropertyDefs");function ku(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}a(ku,"qualifiedPropertyDefs");function So(e){if(a$1(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>So(t));if(typeof e=="object"&&"id"in e){let t=e;if(typeof t.id=="string")return [{id:t.id,props:t.props}]}return []}a(So,"extractValueRefs");function _u(e){let t=[e.firstName,e.lastName].map(r=>r?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}a(_u,"getUserDisplayName");var Pu=/\p{L}|\p{N}/u;function Fu(e,t){let r=e?.trim()??"";if(r==="")return t;let n=r.split(/\s+/),a=(n.length===1?r.split("@")[0].split(/[._-]/):n).map(s=>{let l=s.match(Pu)?.[0];return l===void 0?"":[...l.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}a(Fu,"deriveInitials");var vo="__creatorRootActorId";function Vu(e){let t=e.metadata?.[vo];return typeof t=="string"&&t.length>0?t:e.createdBy}a(Vu,"getRecordCreatorPrincipalId");function he(e,t){return e?.includes("*")===true||e?.includes(t)===true}a(he,"includesAction");function ju(e){return {canRead:he(e,"read"),canCreate:he(e,"create"),canUpdate:he(e,"update"),canDelete:he(e,"delete"),canManage:he(e,"manage")}}a(ju,"buildPermissionFlags");var eA=new Set(["id","name","label","type","required","system","unique","order"]);var L={PEOPLE:"people",WORKSPACE:"workspace",ARCHITECT:"architect",FEATURE_FLAGS:"feature-flags",FILES:"files",VIEWS:"views",FORMS:"forms",DOCUMENTS:"documents",AUDIT:"audit",API_KEYS:"api-keys",CONNECTORS:"connectors",ENV_VARS:"env-vars",SESSION:"session"},rA=[L.PEOPLE,L.WORKSPACE,L.ARCHITECT,L.FEATURE_FLAGS,L.FILES,L.VIEWS,L.FORMS,L.DOCUMENTS,L.AUDIT,L.API_KEYS,L.CONNECTORS,L.ENV_VARS,L.SESSION],nA={people:"People",workspace:"Workspace",architect:"Architect","feature-flags":"Feature flags",files:"Files",views:"Views",forms:"Forms",documents:"Documents",audit:"Audit","api-keys":"API keys",connectors:"Connected accounts","env-vars":"Environment variables",session:"Agent sessions"},Mu={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},iA={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},oA={owner:"Full access to all platform features and data",member:"Can view, create, edit and delete business data",agent_default:"Default role for AI agents \u2014 CRUD on records plus documents and files",reflex_default:"Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"},or=["read","create","update","delete","manage"],Lu=["read","create","delete"],aA={owner:{system:[{target:"*",actions:or}],object:[{target:"*",actions:or}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:Lu},{target:"files",actions:["read","create","update"]}],object:[{target:"*",actions:or}]},agent_default:{system:[{target:"documents",actions:["read","create","update"]},{target:"files",actions:["read","create","update"]},{target:"env-vars",actions:["read"]},{target:"session",actions:["observe"]}],object:[{target:"*",actions:["read","create","update","delete"]}]},reflex_default:{system:[],object:[]}};function sA(e){return Object.values(Mu).includes(e)}a(sA,"isDefaultRole");var Uu=new Set(ICONS),Eo=/^[a-zA-Z_][a-zA-Z0-9_]*$/,$u=/^[a-z][a-z0-9-]*$/,Ae=63,Ro=128,at=ar.string().min(1,"Object name cannot be empty").max(63,"Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
3
3
  Name must be in kebab-case (slug format):
4
4
  \u2705 Valid: 'products', 'user-profiles', 'order-items'
5
- \u274C Invalid: 'Products', 'userProfiles', 'user_profiles'`});function Ce(e){try{rt.parse(e);}catch(t){throw t instanceof er.ZodError?new b$1(t.issues[0].message,a$2.INVALID_OBJECT_NAME):t}}a(Ce,"validateObjectName");function nt(e){if(!e||e.length===0)throw new h("View name cannot be empty",[{path:["name"],message:"View name cannot be empty"}]);if(e.length>he)throw new h("View name is too long",[{path:["name"],message:`View name is too long (max ${he} characters)`}]);if(!Iu.test(e))throw new h("Invalid view name format",[{path:["name"],message:"View name must be in kebab-case (e.g., 'detail', 'list-view')"}])}a(nt,"validateViewName");function ue(e,t,r){let n=new Set;for(let o of e){let a=t(o);if(n.has(a))throw r(a);n.add(a);}}a(ue,"assertUniqueBy");var ho=er.string().min(1,"Attribute name cannot be empty").max(he,`Attribute name is too long (max ${he} characters)`).regex(yo,{message:`Invalid attribute name format.
5
+ \u274C Invalid: 'Products', 'userProfiles', 'user_profiles'`});function Ce(e){try{at.parse(e);}catch(t){throw t instanceof ar.ZodError?new b$1(t.issues[0].message,a$2.INVALID_OBJECT_NAME):t}}a(Ce,"validateObjectName");function st(e){if(!e||e.length===0)throw new h("View name cannot be empty",[{path:["name"],message:"View name cannot be empty"}]);if(e.length>Ae)throw new h("View name is too long",[{path:["name"],message:`View name is too long (max ${Ae} characters)`}]);if(!$u.test(e))throw new h("Invalid view name format",[{path:["name"],message:"View name must be in kebab-case (e.g., 'detail', 'list-view')"}])}a(st,"validateViewName");function ue(e,t,r){let n=new Set;for(let o of e){let a=t(o);if(n.has(a))throw r(a);n.add(a);}}a(ue,"assertUniqueBy");var sr=ar.string().min(1,"Attribute name cannot be empty").max(Ae,`Attribute name is too long (max ${Ae} characters)`).regex(Eo,{message:`Invalid attribute name format.
6
6
  Name must be a valid variable identifier:
7
7
  \u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
8
- \u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!B.includes(e),{message:"This is a reserved attribute name"});function Ne(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute name cannot be empty");if(e.length>he)throw new Error(`[AttributeBuilder] Attribute name is too long (max ${he} characters)`);if(!yo.test(e))throw new Error(`[AttributeBuilder] Invalid attribute name format.
8
+ \u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!B.includes(e),{message:"This is a reserved attribute name"});function Ne(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute name cannot be empty");if(e.length>Ae)throw new Error(`[AttributeBuilder] Attribute name is too long (max ${Ae} characters)`);if(!Eo.test(e))throw new Error(`[AttributeBuilder] Invalid attribute name format.
9
9
  Name must be a valid variable identifier:
10
10
  \u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
11
11
  \u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`);if(B.includes(e))throw new Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.
12
- Reserved names: ${B.join(", ")}`)}a(Ne,"validateAttributeName");function Ao(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute label cannot be empty");if(e.length>go)throw new Error(`[AttributeBuilder] Attribute label is too long (max ${go} characters)`)}a(Ao,"validateLabel");function To(e,t){if(!xu.has(e))throw new Error(`[AttributeBuilder] Invalid icon "${e}" in ${t}.
13
- Icon must be one of the predefined icons from @stndrds/constants.`)}a(To,"validateIconName");function le(e,t){let r=new Set;for(let n of t){if(!n.value?.trim())throw new Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!n.label?.trim())throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has an empty or missing label.`);if(r.has(n.value))throw new Error(`[AttributeBuilder] Duplicate option value "${n.value}" in "${e}".`);r.add(n.value);}for(let n of t){if(n.inverse===void 0)continue;let o=t.find(a=>a.value===n.inverse);if(!o)throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has inverse "${n.inverse}" which does not match any option value.`);if(o.inverse!==n.value)throw new Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${n.value}" points to "${n.inverse}", but "${n.inverse}" points to "${o.inverse??"(none)"}". Inverse pairs must be symmetric.`)}}a(le,"validateOptions");var wo={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},rr=class rr{constructor(t){if(!t.name||t.name.trim().length===0)throw new h("Agent name is required",[]);this.bp={name:t.name,system:true,visibility:"workspace",triggers:[]};}description(t){return this.bp.description=t,this}label(t){return this.bp.label=t,this}icon(t){return this.bp.icon=t,this}systemPrompt(t){return this.bp.systemPrompt=t,this}model(t,r,n){return this.bp.model={provider:t,model:r,...n},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let r=this.bp.config??wo,n=t.inference===void 0?r.inference:{...r.inference,...t.inference};return this.bp.config={...r,...t,...n===void 0?{}:{inference:n}},this}delegation(t){return Object.assign(this.bp,t),this}mcpServers(t){return this.bp.mcpServers=Array.isArray(t)?[...t]:t,this}approval(t){return this.bp.approval={...zi,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,r){return this.bp.requiredPermission={resource:t,action:r},this}trigger(t,r,n){return this.bp.triggers.push({name:t,eventType:r,...n,enabled:n?.enabled??true}),this}runtime(){return this.bp.system=false,this}build(){if(!this.bp.systemPrompt)throw new h(`Agent "${this.bp.name}": systemPrompt is required`,[]);if(!this.bp.model)throw new h(`Agent "${this.bp.name}": model is required`,[]);if(this.bp.system&&this.bp.visibility==="private")throw new h(`Agent "${this.bp.name}": system agents must use workspace visibility`,[]);return ue(this.bp.triggers,t=>t.name,t=>new h(`Agent "${this.bp.name}": duplicate trigger name "${t}"`,[])),{...this.bp,visibility:this.bp.visibility??"workspace",config:this.bp.config??wo,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};a(rr,"AgentBuilder");var tr=rr;function Jh(e){return new tr(e)}a(Jh,"agent");var Su="@stndrds/schema";function it(e){return {version:1,vendor:Su,validate:a(t=>{let r=e.safeParse(t);return r.success?{value:r.data}:{issues:r.error.issues.map(n=>({message:n.message,path:n.path}))}},"validate")}}a(it,"createStandardSchemaProps");function eA(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}a(eA,"isStandardSchema");var Tr=class Tr{get"~standard"(){let t=c$2(this.build());return it(t)}constructor(t,r,n){Ne(r),Ao(n),this.attr={name:r,label:n,type:t,required:false,system:true};}setRequired(t){this.attr.required=t;}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=false,this}hidden(){return this.attr.hidden=true,this}placeholder(t){return this.attr.placeholder=t,this}description(t){return this.attr.description=t,this}icon(t){return To(t,`attribute "${this.attr.name}"`),this.attr.icon=t,this}order(t){return this.attr.order=t,this}defaultValue(t){return ("defaultValue"in this.attr||!["formula","rollup"].includes(this.attr.type))&&(this.attr.defaultValue=t),this}metadata(t){return this.attr.metadata=t,this}build(){return this.attr}};a(Tr,"BaseAttributeBuilder");var R=Tr,wr=class wr extends R{constructor(t,r){super("text",t,r);}minLength(t){return this.attr.minLength=t,this}maxLength(t){return this.attr.maxLength=t,this}pattern(t){return this.attr.pattern=t,this.attr.format=void 0,this}multiline(t=true){return this.attr.multiline=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}email(){return this.attr.format="email",this.attr.pattern=void 0,this}url(){return this.attr.format="url",this.attr.pattern=void 0,this}slug(){return this.attr.format="slug",this.attr.pattern=void 0,this}};a(wr,"TextAttributeBuilder");var nr=wr;function f(e){return new nr(e.name,e.label)}a(f,"text");var xr=class xr extends R{constructor(t,r){super("richtext",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(xr,"RichtextAttributeBuilder");var ir=xr;function Ae(e){return new ir(e.name,e.label)}a(Ae,"richtext");var Ir=class Ir extends R{constructor(t,r){super("number",t,r);}min(t){return this.attr.min=t,this}max(t){return this.attr.max=t,this}integer(){return this.attr.unit="integer",this.attr.decimals=0,this}decimal(t=2){return this.attr.unit="decimal",this.attr.decimals=t,this}percentage(){return this.attr.unit="percentage",this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Ir,"NumberAttributeBuilder");var or=Ir;function at(e){return new or(e.name,e.label)}a(at,"number");var Sr=class Sr extends R{constructor(t,r){super("checkbox",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Sr,"CheckboxAttributeBuilder");var ar=Sr;function xo(e){return new ar(e.name,e.label)}a(xo,"checkbox");var vr=class vr extends R{constructor(t,r){super("date",t,r);}format(t){return this.attr.dateFormat=t,this}minDate(t){return this.attr.minDate=t,this}maxDate(t){return this.attr.maxDate=t,this}endDate(){return this.attr.endDate=true,this.asPhantomState()}includeTime(){return this.attr.includeTime=true,this}timeFormat(t){return this.attr.timeFormat=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(vr,"DateAttributeBuilder");var sr=vr;function U(e){return new sr(e.name,e.label)}a(U,"date");var Rr=class Rr extends R{constructor(t,r){super("phone",t,r);}defaultCountry(t){return this.attr.defaultCountryCode=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Rr,"PhoneAttributeBuilder");var ur=Rr;function lA(e){return new ur(e.name,e.label)}a(lA,"phone");var Er=class Er extends R{constructor(t,r){super("currency",t,r);}defaultCurrency(t){return this.attr.defaultCurrency=t,this}allowedCurrencies(t){return this.attr.allowedCurrencies=t,this}allowNegative(t=true){return this.attr.allowNegative=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Er,"CurrencyAttributeBuilder");var lr=Er;function dA(e){return new lr(e.name,e.label)}a(dA,"currency");var Dr=class Dr extends R{constructor(t,r){super("status",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Dr,"StatusAttributeBuilder");var dr=Dr;function cA(e){return new dr(e.name,e.label)}a(cA,"status");var Cr=class Cr extends R{constructor(t,r){super("select",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Cr,"SelectAttributeBuilder");var cr=Cr;function q(e){return new cr(e.name,e.label)}a(q,"select");var Nr=class Nr extends R{constructor(t,r){super("multiselect",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Nr,"MultiselectAttributeBuilder");var pr=Nr;function pA(e){return new pr(e.name,e.label)}a(pA,"multiselect");var Or=class Or extends R{constructor(t,r){super("location",t,r);}granularity(t){return this.attr.granularity=t,this}defaultCountry(t){return this.attr.defaultCountry=t,this}allowedCountries(t){return this.attr.allowedCountries=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Or,"LocationAttributeBuilder");var mr=Or;function mA(e){return new mr(e.name,e.label)}a(mA,"location");var kr=class kr extends R{constructor(t,r){super("user",t,r),this.attr.types=["user","agent"];}types(t){let r=[...new Set(t)];if(r.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=r,this}multiple(){return this.attr.multiple=true,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(kr,"UserAttributeBuilder");var fr=kr;function fA(e){return new fr(e.name,e.label)}a(fA,"user");var _r=class _r extends R{to(t,r){let n={object:t,...r};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:He}],this}qualifyWith(...t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=Xe(t),this}bilateral(t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(r.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(qi(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");return this.attr.bilateral=t,this}};a(_r,"BaseRelationAttributeBuilder");var ot=_r,Pr=class Pr extends ot{constructor(t,r){super("relation",t,r),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new gr(this.attr.name,this.attr.label??"",{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===false&&t.runtime(),this.attr.hidden&&t.hidden(),this.attr.placeholder&&t.placeholder(this.attr.placeholder),this.attr.description&&t.description(this.attr.description),this.attr.icon&&t.icon(this.attr.icon),this.attr.order!==void 0&&t.order(this.attr.order),this.attr.metadata&&t.metadata(this.attr.metadata),t}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Pr,"SingleRelationAttributeBuilder");var br=Pr,Fr=class Fr extends ot{constructor(t,r,n){super("relation",t,r),this.attr.cardinality="many",this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(true);}maxItems(t){return this.attr.maxItems=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Fr,"MultiRelationAttributeBuilder");var gr=Fr;function Te(e){return new br(e.name,e.label)}a(Te,"relation");var Vr=class Vr extends R{constructor(t,r){super("formula",t,r),this.attr.required=false;}expression(t){return this.attr.expression=t,this}returns(t){return this.attr.returnType=t,this}decimals(t){return this.attr.decimals=t,this}required(){throw new Error("Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};a(Vr,"FormulaAttributeBuilder");var yr=Vr;function bA(e){return new yr(e.name,e.label)}a(bA,"formula");var jr=class jr extends R{constructor(t,r){super("rollup",t,r),this.attr.required=false;}from(t){return this.attr.relationAttribute=t,this}aggregate(t){return this.attr.targetAttribute=t,this}using(t){return this.attr.function=t,this}decimals(t){return this.attr.decimals=t,this}path(t){return this.attr.relationPath=t,this}targetType(t){return this.attr.targetAttributeType=t,this}targetOptions(t){return this.attr.targetAttributeOptions=t,this}targetCurrency(t){return this.attr.targetCurrencyCode=t,this}build(){let t=this.attr.function,r=this.attr.targetAttributeType;if(t==="original"&&r!==void 0&&r!=="select"&&r!=="status"&&r!=="multiselect"){let n=this.attr.relationAttribute??"relation",o=this.attr.targetAttribute??"field";throw new b$1(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${r}") was given. To surface a plain ${r} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${n}.${o}").`,a$2.VALIDATION_FAILED)}return super.build()}required(){throw new Error("Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};a(jr,"RollupAttributeBuilder");var hr=jr;function gA(e){return new hr(e.name,e.label)}a(gA,"rollup");var Mr=class Mr extends R{constructor(t,r){super("document",t,r);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=Xe(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Mr,"DocumentAttributeBuilder");var Ar=Mr;function Io(e){return new Ar(e.name,e.label)}a(Io,"document");function vo(e,t,r){let n=Array.isArray(e)?e:[e],[o,...a]=n;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:r?.label,required:r?.required,tooltip:r?.tooltip}}a(vo,"buildSlotFieldRef");var $r=class $r{constructor(t,r,n){this._finalized=false;this.stepBuilder=t,this.rowData={id:r,order:n,type:"fields",fields:[]};}field(t,r,n){return this.rowData.fields.push(vo(t,r,n)),this}freeField(t,r){let o={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,r){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,r)}separator(){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).separator()}text(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).text(t)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=true,this.stepBuilder._finalizeRow(this.rowData))}};a($r,"FormRowBuilder");var Lr=$r,qr=class qr{constructor(t,r,n){this.rowOrder=0;this.formBuilder=t,this.stepData={id:r,label:n,rows:[]};}description(t){return this.stepData.description=t,this}field(t,r,n){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=vo(t,r,n),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,r){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression},s={id:n,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new Lr(this,t,this.rowOrder)}heading(t,r){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:r};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let t={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"separator"};return this.stepData.rows.push(t),this}text(t){this.rowOrder++;let r={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(r),this}step(t,r){return this.formBuilder._finalizeStep(this.stepData).step(t,r)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(t){return t.fields.length>0&&this.stepData.rows.push(t),this}_getData(){return this.stepData}};a(qr,"FormStepBuilder");var Br=qr,zr=class zr{constructor(t,r){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=r;}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}status(t){return this.data.status=t,this}metadata(t){return this.data.metadata=t,this}slot(t,r,n){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:r,label:n.label,mode:n.mode??"create",color:n.color,icon:n.icon};return this.data.slots.push(o),this}step(t,r){if(this.data.steps.some(n=>n.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new Br(this,t,r)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let r=z$1.string().min(1,"Form name cannot be empty").max(63,"Form name is too long (max 63 characters)").regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:"Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'"});try{r.parse(t);}catch(n){throw n instanceof z$1.ZodError?new Error(`[FormBuilder] ${n.issues[0].message}`):n}}validateRequiredData(){if(this.data.slots.length===0)throw new Error("[FormBuilder] At least one slot is required. Use .slot() to add slots.");if(this.data.steps.length===0)throw new Error("[FormBuilder] At least one step is required. Use .step() to add steps.")}validateSlotReferences(){let t=new Map(this.data.slots.map(r=>[r.id,r.objectName]));for(let r of this.data.steps)for(let n of r.rows)if(Qe(n))for(let o of n.fields){if(o.type!=="slot")continue;let a=Xi(o);for(let l of a)if(!t.has(l))throw new Error(`[FormBuilder] Step "${r.id}" references unknown slot "${l}". Declare it with .slot("${l}", ...) first.`);let s=new Set(a.map(l=>t.get(l)));if(s.size>1)throw new Error(`[FormBuilder] Step "${r.id}" field on attribute "${o.attribute}" targets slots of different objects (${[...s].join(", ")}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let t=[...et,"join"];for(let r of this.data.steps)for(let n of r.rows)if(Qe(n))for(let o of n.fields){if(!Yt(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${r.id}"`;if(!tt(a))throw new Error(`[FormBuilder] ${s} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(a))throw new Error(`[FormBuilder] ${s} contains empty {{ }} interpolation.`);for(let l of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let p=l[1];if(!t.includes(p))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${p}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(Kt);for(let r of this.data.steps)for(let n of r.rows)if(Qe(n)){for(let o of n.fields)if(Yt(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${r.id}" uses forbidden attribute type "${a}". Forbidden types: ${Kt.join(", ")}`)}}}};a(zr,"FormBuilder");var Ur=zr;function IA(e,t){return new Ur(e,t)}a(IA,"form");function vu(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}a(vu,"resolveBuiltInTransform");var Gr=class Gr{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,r){if(this.touchedAttributes.has(t))throw new Error(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${r}).`)}renameAttribute(t,r){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:r}),this}changeType(t,r,n,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?vu(n):void 0;return this.operations.push({type:"change_type",name:t,from:r,to:n,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t,backup_config:{}}),this}addAttribute(t){return this.assertNotTouched(t.name,"add_attribute"),this.touchedAttributes.add(t.name),this.operations.push({type:"add_attribute",attribute:t}),this}updateConfig(t,r){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:r}),this}build(){return {version:this.version,operations:[...this.operations]}}};a(Gr,"MigrationBuilder");var st=Gr;function Ru(e){let{name:t,labelExpression:r,embeddingExpression:n}=e;if(!r)throw new b$1(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,a$2.VALIDATION_FAILED);let o=ge.safeParse(r);if(!o.success){let a=o.error.issues[0]?.message??"Invalid labelExpression";throw new b$1(`Invalid labelExpression for "${t}": ${a}`,a$2.VALIDATION_FAILED)}if(n!==void 0){let a=ge.safeParse(n);if(!a.success){let s=a.error.issues[0]?.message??"Invalid embeddingExpression";throw new b$1(`Invalid embeddingExpression for "${t}": ${s}`,a$2.VALIDATION_FAILED)}}}a(Ru,"validateObjectExpressions");var Wr=class Wr{constructor(t){this._migrations=[];this._sealed=false;this._toleratedAttributes=[];this.validateName(t.name),this.obj={name:t.name,label:t.label,attributes:[],system:true},t.id&&(this.obj.id=t.id);}get"~standard"(){let t=e(this.build());return it(t)}description(t){return this.obj.description=t,this}pluralLabel(t){return this._pluralLabel=t,this}icon(t){return this.obj.icon=t,this}runtime(){return this.obj.system=false,this}sealed(){return this._sealed=true,this}tolerate(t){return this._toleratedAttributes=[...this._toleratedAttributes,...t],this}attribute(t){return this.pushAttributes([t]),this}attributes(t){return this.pushAttributes(t),this}pushAttributes(t){let r$1=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n);ue([...this.obj.attributes,...r$1],n=>n.name,n=>new r("attribute",n,`Object "${this.obj.name}": duplicate attribute name "${n}"`)),this.obj.attributes.push(...r$1);}metadata(t){return this.obj.metadata={...this.obj.metadata,...t},this}order(t){return this.obj.metadata={...this.obj.metadata,order:t},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:true},this}labelExpression(t){return this._labelExpression=t,this}embeddingExpression(t){return this._embeddingExpression=t,this}documentLayout(t){if(t.presets)for(let r of t.presets)Ro(r.id,r.structure,1);return this.obj.documentLayout=t,this}migration(t,r){if(t<2)throw new Error(`[ObjectBuilder] Migration version must be >= 2 (version 1 is implicit). Got: ${t}`);if(this._migrations.some(a=>a.version===t))throw new Error(`[ObjectBuilder] Duplicate migration version: ${t}`);let o=new st(t);return r(o),this._migrations.push(o.build()),this}build(){if(!this.obj.name)throw new h("[ObjectBuilder] Missing required field: name",[{path:["name"],message:"name is required"}]);if(!this.obj.label)throw new h("[ObjectBuilder] Missing required field: label",[{path:["label"],message:"label is required"}]);Ru({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((n,o)=>n.version-o.version);for(let n=0;n<t.length;n++){let o=n+2;if(t[n].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[n].version}.`)}let r=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:r,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&Ce(t);}};a(Wr,"ObjectBuilder");var Oe=Wr;function FA(e){if(w$1(e.name))throw new s(e.name,"builder");return new Oe(e)}a(FA,"object");function Ro(e,t,r){let n=a((a,s)=>{throw new h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");r>5&&n(`Preset structure exceeds max depth of ${5}`,"Preset structure too deep");let o=new Set;for(let a of t){let s=a.title.trim();s.length===0&&n("Folder preset node title is required","Empty folder title"),s.includes("/")&&n("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&n("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&Ro(e,a.children,r+1);}}a(Ro,"validatePresetStructure");var rn=class rn{constructor(t,r){this.data={type:"fields",fields:[]};this.data.id=t,this.data.label=r;}description(t){return this.data.description=t,this}collapsible(t=false){return this.data.collapsible=true,this.data.collapsed=t,this}order(t){return this.data.order=t,this}fields(...t){for(let r of t)this.data.fields?.push({attribute:r});return this}field(t,r){return this.data.fields?.push({attribute:t,...r}),this}attributeGroup(t,r){return this.data.fields?.push({attributeGroup:t,...r}),this}build(){if(!this.data.id)throw new Error("[GroupBuilder] id is required");if(!this.data.label)throw new Error("[GroupBuilder] label is required");if(!this.data.fields||this.data.fields.length===0)throw new Error("[GroupBuilder] At least one field is required");return this.data}};a(rn,"GroupBuilder");var lt=rn,nn=class nn{constructor(t,r){this.view=t,this.tabData=r;}columns(...t){return this.tabData.columns=t,this}create(t){return this.tabData.allowCreate=true,t?.mode&&(this.tabData.createMode=t.mode),this}createMode(t){return this.tabData.createMode=t,this}edit(){return this.tabData.allowEdit=true,this}delete(){return this.tabData.allowDelete=true,this}crud(){return this.tabData.allowCreate=true,this.tabData.allowEdit=true,this.tabData.allowDelete=true,this}filters(t){return this.tabData.filters=t,this}sorts(t){return this.tabData.sorts=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}tab(t,r){return this.finalize(),new J(this.view,t,r)}done(){return this.finalize(),this.view}build(){return this.finalize(),this.view.build()}finalize(){if(!this.tabData.columns||this.tabData.columns.length===0)throw new Error(`[TableTabConfig] columns() is required for tab "${this.tabData.name}"`);this.view._addTab(this.tabData);}};a(nn,"TableTabConfig");var dt=nn,on=class on{constructor(t,r,n){this.view=t,this.tabData={...r,type:"custom",component:n};}props(t){return this.tabData.props=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(on,"CustomTabConfig");var Kr=on,an=class an{constructor(t,r,n){this.view=t,this.tabData={...r,type:"richtext",attribute:n};}titleAttribute(t){return this.tabData.titleAttribute=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(an,"RichtextTabConfig");var Yr=an,sn=class sn{constructor(t,r){this.view=t,this.tabData={...r,type:"activity"};}limit(t){return this.tabData.limit=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(sn,"ActivityTabConfig");var Hr=sn,un=class un{constructor(t,r,n){this.view=t,this.tabData={...r,type:n,emailAttributeIds:[]};}emailAttributes(...t){return this.tabData.emailAttributeIds=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(un,"AddressMatchedTabConfig");var ct=un,ln=class ln extends ct{constructor(t,r){super(t,r,"emails");}};a(ln,"EmailsTabConfig");var Qr=ln,dn=class dn extends ct{constructor(t,r){super(t,r,"meetings");}};a(dn,"MeetingsTabConfig");var Jr=dn,cn=class cn{constructor(t,r){this.view=t,this.tabData={...r,type:"documents",allowUpload:true,allowRemove:true,hideAttachments:false};}disableUpload(){return this.tabData.allowUpload=false,this}disableRemove(){return this.tabData.allowRemove=false,this}hideAttachments(){return this.tabData.hideAttachments=true,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(cn,"DocumentsTabConfig");var Xr=cn,pn=class pn{constructor(t,r,n){this.view=t,this.base={id:r,name:r,label:n};}icon(t){return this.base.icon=t,this}order(t){return this.base.order=t,this}form(...t){if(t.length===0)throw new Error(`[TabBuilder] form() requires at least one group for tab "${this.base.name}"`);let r={...this.base,type:"form",groups:t.map(n=>n instanceof lt?n.build():n)};return this.view._addTab(r)}table(t){return new dt(this.view,{...this.base,type:"table",source:{type:"relation",attribute:t},columns:[]})}tableFrom(t,r){return new dt(this.view,{...this.base,type:"table",source:{type:"inverse",object:t,attribute:r},columns:[]})}custom(t){return new Kr(this.view,this.base,t)}richtext(t){return new Yr(this.view,this.base,t)}activity(){return new Hr(this.view,this.base)}documents(){return new Xr(this.view,this.base)}emails(){return new Qr(this.view,this.base)}meetings(){return new Jr(this.view,this.base)}forms(t){let r={...this.base,type:"forms",...t};return this.view._addTab(r)}};a(pn,"TabBuilder");var J=pn,mn=class mn{constructor(t,r){nt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}sidePanel(t){return this.data.sidePanel=t,this}readOnly(){return this.data.readOnly=true,this}tab(t,r){return new J(this,t,r)}addTab(t){return this.data.tabs.push(t),this}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[DetailViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[DetailViewBuilder] At least one tab is required");ue(this.data.tabs,r=>r.name,r=>new Error(`[DetailViewBuilder] Duplicate tab name "${r}"`));let t={tabs:this.data.tabs,sidePanel:this.data.sidePanel,...this.data.readOnly?{readOnly:true}:{}};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"detail",config:t,default:this.data.default,metadata:this.data.metadata}}};a(mn,"DetailViewBuilder");var Zr=mn;function z(e,t){return new Zr(e,t)}a(z,"detailView");function ut(e){if(Array.isArray(e))return e.map(ut).find(r=>r!==void 0);if(e===null||typeof e!="object")return;let t=e;return t.attribute==="visibility"||t.attribute==="ownedBy"?t.attribute:ut(t.rules)??ut(t.groups)}a(ut,"findProtectedTabFilterAttribute");var fn=class fn{constructor(t,r){nt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}baseFilter(t){return this.data.defaultFilters=t,this}allowPresentationCustomization(){return this.data.allowPresentationCustomization=true,this}tab(t,r){return new tn(this,t,r)}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[ListViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[ListViewBuilder] At least one tab is required");if(ue(this.data.tabs,n=>n.id,n=>new Error(`[ListViewBuilder] Duplicate tab id "${n}"`)),this.data.tabs.filter(n=>n.default).length>1)throw new Error("[ListViewBuilder] Only one tab can be marked as default");for(let n of this.data.tabs){if(n.layout==="table"&&n.columns.length===0)throw new h(`[ListViewBuilder] Tab "${n.id}" must have at least one column`,[]);if(n.layout==="kanban"&&!n.groupByAttribute)throw new h(`[ListViewBuilder] Kanban tab "${n.id}" requires a groupByAttribute`,[]);if(n.descriptionAttribute!==void 0&&n.descriptionAttribute.length===0)throw new h(`[ListViewBuilder] Tab "${n.id}" requires a nonempty description attribute name`,[]);if(n.displayAttributes!==void 0){let o=_$1.safeParse(n.displayAttributes);if(!o.success)throw new h(`[ListViewBuilder] Tab "${n.id}" has invalid display attributes`,o.error.issues.map(a=>({path:["tabs",n.id,"displayAttributes",...a.path.map(String)],message:a.message})))}}let r={allowPresentationCustomization:this.data.allowPresentationCustomization,defaultFilters:this.data.defaultFilters?{id:d(),combinator:this.data.defaultFilters.combinator,rules:this.data.defaultFilters.rules}:void 0,tabs:this.data.tabs.map(n=>{let o={id:n.id,label:n.label,icon:n.icon,default:n.default,visibility:n.visibility,columns:n.columns,descriptionAttribute:n.descriptionAttribute,displayAttributes:n.displayAttributes,filters:n.filters?{id:d(),combinator:n.filters.combinator,rules:n.filters.rules}:void 0,sorts:n.sorts,readOnly:n.readOnly,createMode:n.createMode};return n.layout==="kanban"?{...o,layout:"kanban",groupByAttribute:n.groupByAttribute,cardUserAttribute:n.cardUserAttribute,cardDateAttribute:n.cardDateAttribute,kanbanColumnOrder:n.kanbanColumnOrder,kanbanColumnVisibility:n.kanbanColumnVisibility,kanbanPinnedColumns:n.kanbanPinnedColumns}:{...o,layout:n.layout,columnSizing:n.columnSizing}})};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"list",config:r,default:this.data.default,metadata:this.data.metadata}}};a(fn,"ListViewBuilder");var en=fn,pt=class pt{constructor(t,r,n){this.view=t,this.tabData={id:r,label:n,visibility:"all",layout:"table",columns:[]};}icon(t){return this.tabData.icon=t,this}default(){return this.tabData.default=true,this}readOnly(){return this.tabData.readOnly=true,this}visibility(t){return this.tabData.visibility=t,this}table(){return this.tabData.layout="table",this}list(){return this.tabData.layout="list",this}descriptionAttribute(t){return this.tabData.descriptionAttribute=t,this}displayAttributes(...t){return this.tabData.displayAttributes=t,this}kanban(t){return this.tabData.layout="kanban",this.tabData.groupByAttribute=t,this}cardUserAttribute(t){return this.tabData.cardUserAttribute=t,this}cardDateAttribute(t){return this.tabData.cardDateAttribute=t,this}kanbanColumnOrder(t){return this.tabData.kanbanColumnOrder=t,this}kanbanColumnVisibility(t){return this.tabData.kanbanColumnVisibility=t,this}kanbanPinnedColumns(t){return this.tabData.kanbanPinnedColumns=t,this}createMode(t){return this.tabData.createMode=t,this}columns(...t){return this.tabData.columns=t,this}columnWidth(t,r){return this.tabData.columnSizing||(this.tabData.columnSizing={}),this.tabData.columnSizing[t]=r,this}filter(t){let r=ut(t);if(r){let n=`Tab filters cannot target "${r}". Use .visibility("private")`;throw new h(n,[{path:["filters"],message:n}])}return this.tabData.filters=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}sorts(t){return this.tabData.sorts=t,this}tab(t,r){return this.view._addTab(this.tabData),new pt(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(pt,"ListViewTabConfigBuilder");var tn=pt;function G(e,t){return new en(e,t)}a(G,"listView");function $A(e,t){return new lt(e,t)}a($A,"group");function Eu(e){if(!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(e))throw new Error(`Invalid flag name "${e}". Flag names must be kebab-case (e.g., "architect-mode", "ai-features").`)}a(Eu,"validateFlagName");var An=class An{constructor(t,r,n){Eu(t),this.flag={name:t,valueType:r,defaultValue:n,allowedLevels:["global","tenant","user"]};}label(t){return this.flag.label=t,this}description(t){return this.flag.description=t,this}category(t){return this.flag.category=t,this}system(){return this.flag.system=true,this}tenantScoped(){return this.flag.allowedLevels=["global","tenant"],this}globalOnly(){return this.flag.allowedLevels=["global"],this}allowedLevels(t){return this.flag.allowedLevels=[...t],this}build(){if(!this.flag.label?.trim())throw new Error(`Flag "${this.flag.name}" must have a label. Use .label("Human-readable label").`);return {...this.flag,allowedLevels:[...this.flag.allowedLevels||[]]}}};a(An,"BaseFlagBuilder");var we=An,Tn=class Tn extends we{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};a(Tn,"BooleanFlagBuilder");var bn=Tn,wn=class wn extends we{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};a(wn,"StringFlagBuilder");var gn=wn,xn=class xn extends we{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};a(xn,"NumberFlagBuilder");var yn=xn,In=class In extends we{constructor(t,r){super(t,"json",r);}defaultValue(t){return this.flag.defaultValue=t,this}};a(In,"JsonFlagBuilder");var hn=In;function Du(e){return new bn(e)}a(Du,"booleanFlag");function Cu(e){return new gn(e)}a(Cu,"stringFlag");function Nu(e){return new yn(e)}a(Nu,"numberFlag");function Ou(e,t){return new hn(e,t)}a(Ou,"jsonFlag");function Sn(e){return new r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}a(Sn,"duplicateFlagError");function vn(e){return {...e,allowedLevels:[...e.allowedLevels]}}a(vn,"cloneFlagDefinition");var Rn=class Rn{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw Sn(t.name);this.flags.set(t.name,vn(t));}registerAll(t){let r=new Set;for(let n of t){if(this.flags.has(n.name)||r.has(n.name))throw Sn(n.name);r.add(n.name);}for(let n of t)this.register(n);}get(t){let r=this.flags.get(t);return r?vn(r):void 0}getOrThrow(t){let r=this.get(t);if(!r)throw new c$3("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return r}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),vn)}listNames(){return Array.from(this.flags.keys())}unregister(t){return this.flags.delete(t)}clear(){this.flags.clear();}get size(){return this.flags.size}};a(Rn,"FlagRegistry");var ke=Rn,ku=new ke;function _u(){return new ke}a(_u,"createFlagRegistry");function mt(){return {global:new Map,tenant:new Map,user:new Map}}a(mt,"emptyOverrides");function Pu(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}a(Pu,"isActiveOverride");function En(e,t){let r=new Map;for(let n of e){if(!Pu(n,t))continue;let o=n.flagName;r.has(o)||r.set(o,n);}return r}a(En,"indexOverrides");var Dn=class Dn{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(r=>[r.name,r.value])??[]);}async resolveAll(t={}){let r=this.collectFlagNames(),n=this.repository&&r.size>0?await this.getAllOverrides(t,[...r]):mt();return this.resolveNames(r,n,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),mt(),{})}collectFlagNames(){let t=new Set;for(let r of this.registry.listNames())t.add(r);for(let r of this.staticDefaults.keys())t.add(r);return t}resolveNames(t,r,n){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,r,n));return o}async resolve(t,r={}){let n=this.repository?await this.getAllOverrides(r,[t]):mt();return this.resolveWithSource(t,n,r)}async isEnabled(t,r={}){return (await this.resolve(t,r)).value===true}async getValue(t,r={}){return (await this.resolve(t,r)).value}async setOverride(t,r,n,o={}){if(!this.repository)throw new b$1("Cannot set override: no FeatureFlagsRepository configured. Add featureFlags to your DatabaseAdapter to enable runtime overrides.",a$2.CONFIGURATION_REQUIRED);let a=this.registry.get(t);if(a&&!a.allowedLevels.includes(r)){let s=`Flag "${t}" does not allow ${r}-level overrides. Allowed levels: ${a.allowedLevels.join(", ")}`;throw new h(s,[{path:["level"],message:s}])}if(a?.system){let s=`Flag "${t}" is a system flag and cannot be overridden via API.`;throw new h(s,[{path:["flagName"],message:s}])}await this.repository.setOverride({flagName:t,level:r,value:n,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,r,n){if(!this.repository)throw new b$1("Cannot delete override: no FeatureFlagsRepository configured.",a$2.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,r,n);}async getAllOverrides(t,r){if(!this.repository)return mt();let[n,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:r}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:r}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:r}):Promise.resolve([])]),s=Date.now();return {global:En(n,s),tenant:En(o,s),user:En(a,s)}}resolveValue(t,r,n){return this.resolveWithSource(t,r,n).value}resolveWithSource(t,r,n){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(n.userId&&a.includes("user")){let s=r.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:n.userId}}if(n.tenantId&&a.includes("tenant")){let s=r.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:n.tenantId}}if(a.includes("global")){let s=r.global.get(t);if(s)return {name:t,value:s.value,source:"global"}}return this.staticDefaults.has(t)?{name:t,value:this.staticDefaults.get(t),source:"default"}:{name:t,value:o?.defaultValue??void 0,source:"default"}}};a(Dn,"FlagService");var ft=Dn;function Fu(e){return new ft(e)}a(Fu,"createFlagService");var Eo=Symbol("stndrds.native-object");function Nn(e){return Object.defineProperty(e,Eo,{value:true,enumerable:false}),e}a(Nn,"markNativeDefinition");var kn=class kn extends Oe{build(){return Nn(super.build())}};a(kn,"NativeObjectBuilder");var Cn=kn;function W(e){return new Cn(e)}a(W,"nativeObject");function On(e){return e[Eo]===true}a(On,"isNativeDefinition");function _n(e){let t=structuredClone(e);return On(e)?Nn(t):t}a(_n,"cloneObjectDefinition");var Fn=class Fn{constructor(){this.objects=new Map;}register(t){let n=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of n){if(this.validate(a),o.has(a.name))throw new r("object",a.name,`[NativeObjectRegistry] Duplicate object name "${a.name}" within a single register() batch.`);o.add(a.name);}for(let a of n)this.objects.set(a.name,_n(a));return this}validate(t){if(!t.system){let r=`[NativeObjectRegistry] Cannot register object "${t.name}" (id: ${t.id}): missing system flag.
14
- Native objects must have system=true. Did you call .runtime() on the builder? Remove that call \u2014 objects are system:true by default.`;throw new h(r,[])}if(w$1(t.name)&&!On(t))throw new s(t.name,"registry");if(this.objects.has(t.name)){let r$1=this.objects.get(t.name),n=`[NativeObjectRegistry] Duplicate object name "${t.name}":
12
+ Reserved names: ${B.join(", ")}`)}a(Ne,"validateAttributeName");function Do(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute label cannot be empty");if(e.length>Ro)throw new Error(`[AttributeBuilder] Attribute label is too long (max ${Ro} characters)`)}a(Do,"validateLabel");function Co(e,t){if(!Uu.has(e))throw new Error(`[AttributeBuilder] Invalid icon "${e}" in ${t}.
13
+ Icon must be one of the predefined icons from @stndrds/constants.`)}a(Co,"validateIconName");function le(e,t){let r=new Set;for(let n of t){if(!n.value?.trim())throw new Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!n.label?.trim())throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has an empty or missing label.`);if(r.has(n.value))throw new Error(`[AttributeBuilder] Duplicate option value "${n.value}" in "${e}".`);r.add(n.value);}for(let n of t){if(n.inverse===void 0)continue;let o=t.find(a=>a.value===n.inverse);if(!o)throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has inverse "${n.inverse}" which does not match any option value.`);if(o.inverse!==n.value)throw new Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${n.value}" points to "${n.inverse}", but "${n.inverse}" points to "${o.inverse??"(none)"}". Inverse pairs must be symmetric.`)}}a(le,"validateOptions");var No={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},lr=class lr{constructor(t){if(!t.name||t.name.trim().length===0)throw new h("Agent name is required",[]);this.bp={name:t.name,system:true,visibility:"workspace",triggers:[]};}description(t){return this.bp.description=t,this}label(t){return this.bp.label=t,this}icon(t){return this.bp.icon=t,this}systemPrompt(t){return this.bp.systemPrompt=t,this}model(t,r,n){return this.bp.model={provider:t,model:r,...n},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let r=this.bp.config??No,n=t.inference===void 0?r.inference:{...r.inference,...t.inference};return this.bp.config={...r,...t,...n===void 0?{}:{inference:n}},this}delegation(t){return Object.assign(this.bp,t),this}mcpServers(t){return this.bp.mcpServers=Array.isArray(t)?[...t]:t,this}approval(t){return this.bp.approval={...eo,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,r){return this.bp.requiredPermission={resource:t,action:r},this}trigger(t,r,n){return this.bp.triggers.push({name:t,eventType:r,...n,enabled:n?.enabled??true}),this}runtime(){return this.bp.system=false,this}build(){if(!this.bp.systemPrompt)throw new h(`Agent "${this.bp.name}": systemPrompt is required`,[]);if(!this.bp.model)throw new h(`Agent "${this.bp.name}": model is required`,[]);if(this.bp.system&&this.bp.visibility==="private")throw new h(`Agent "${this.bp.name}": system agents must use workspace visibility`,[]);return ue(this.bp.triggers,t=>t.name,t=>new h(`Agent "${this.bp.name}": duplicate trigger name "${t}"`,[])),{...this.bp,visibility:this.bp.visibility??"workspace",config:this.bp.config??No,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};a(lr,"AgentBuilder");var ur=lr;function AA(e){return new ur(e)}a(AA,"agent");var qu="@stndrds/schema";function ut(e){return {version:1,vendor:qu,validate:a(t=>{let r=e.safeParse(t);return r.success?{value:r.data}:{issues:r.error.issues.map(n=>({message:n.message,path:n.path}))}},"validate")}}a(ut,"createStandardSchemaProps");function xA(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}a(xA,"isStandardSchema");var Er=class Er{get"~standard"(){let t=c$2(this.build());return ut(t)}constructor(t,r,n){Ne(r),Do(n),this.attr={name:r,label:n,type:t,required:false,system:true};}setRequired(t){this.attr.required=t;}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=false,this}hidden(){return this.attr.hidden=true,this}placeholder(t){return this.attr.placeholder=t,this}description(t){return this.attr.description=t,this}icon(t){return Co(t,`attribute "${this.attr.name}"`),this.attr.icon=t,this}order(t){return this.attr.order=t,this}defaultValue(t){return ("defaultValue"in this.attr||!["formula","rollup"].includes(this.attr.type))&&(this.attr.defaultValue=t),this}metadata(t){return this.attr.metadata=t,this}build(){return this.attr}};a(Er,"BaseAttributeBuilder");var v=Er,Dr=class Dr extends v{constructor(t,r){super("text",t,r);}minLength(t){return this.attr.minLength=t,this}maxLength(t){return this.attr.maxLength=t,this}pattern(t){return this.attr.pattern=t,this.attr.format=void 0,this}multiline(t=true){return this.attr.multiline=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}email(){return this.attr.format="email",this.attr.pattern=void 0,this}url(){return this.attr.format="url",this.attr.pattern=void 0,this}slug(){return this.attr.format="slug",this.attr.pattern=void 0,this}};a(Dr,"TextAttributeBuilder");var dr=Dr;function f(e){return new dr(e.name,e.label)}a(f,"text");var Cr=class Cr extends v{constructor(t,r){super("richtext",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Cr,"RichtextAttributeBuilder");var cr=Cr;function Te(e){return new cr(e.name,e.label)}a(Te,"richtext");var Nr=class Nr extends v{constructor(t,r){super("number",t,r);}min(t){return this.attr.min=t,this}max(t){return this.attr.max=t,this}integer(){return this.attr.unit="integer",this.attr.decimals=0,this}decimal(t=2){return this.attr.unit="decimal",this.attr.decimals=t,this}percentage(){return this.attr.unit="percentage",this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Nr,"NumberAttributeBuilder");var pr=Nr;function dt(e){return new pr(e.name,e.label)}a(dt,"number");var Or=class Or extends v{constructor(t,r){super("checkbox",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Or,"CheckboxAttributeBuilder");var mr=Or;function Oo(e){return new mr(e.name,e.label)}a(Oo,"checkbox");var kr=class kr extends v{constructor(t,r){super("date",t,r);}format(t){return this.attr.dateFormat=t,this}minDate(t){return this.attr.minDate=t,this}maxDate(t){return this.attr.maxDate=t,this}endDate(){return this.attr.endDate=true,this.asPhantomState()}includeTime(){return this.attr.includeTime=true,this}timeFormat(t){return this.attr.timeFormat=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(kr,"DateAttributeBuilder");var fr=kr;function U(e){return new fr(e.name,e.label)}a(U,"date");var _r=class _r extends v{constructor(t,r){super("phone",t,r);}defaultCountry(t){return this.attr.defaultCountryCode=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(_r,"PhoneAttributeBuilder");var br=_r;function OA(e){return new br(e.name,e.label)}a(OA,"phone");var Pr=class Pr extends v{constructor(t,r){super("currency",t,r);}defaultCurrency(t){return this.attr.defaultCurrency=t,this}allowedCurrencies(t){return this.attr.allowedCurrencies=t,this}allowNegative(t=true){return this.attr.allowNegative=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Pr,"CurrencyAttributeBuilder");var gr=Pr;function kA(e){return new gr(e.name,e.label)}a(kA,"currency");var Fr=class Fr extends v{constructor(t,r){super("status",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Fr,"StatusAttributeBuilder");var yr=Fr;function _A(e){return new yr(e.name,e.label)}a(_A,"status");var Vr=class Vr extends v{constructor(t,r){super("select",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Vr,"SelectAttributeBuilder");var hr=Vr;function q(e){return new hr(e.name,e.label)}a(q,"select");var jr=class jr extends v{constructor(t,r){super("multiselect",t,r);}options(t){let r=t;return le(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return le(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(jr,"MultiselectAttributeBuilder");var Ar=jr;function PA(e){return new Ar(e.name,e.label)}a(PA,"multiselect");var Mr=class Mr extends v{constructor(t,r){super("location",t,r);}granularity(t){return this.attr.granularity=t,this}defaultCountry(t){return this.attr.defaultCountry=t,this}allowedCountries(t){return this.attr.allowedCountries=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Mr,"LocationAttributeBuilder");var Tr=Mr;function FA(e){return new Tr(e.name,e.label)}a(FA,"location");var Lr=class Lr extends v{constructor(t,r){super("user",t,r),this.attr.types=["user","agent"];}types(t){let r=[...new Set(t)];if(r.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=r,this}multiple(){return this.attr.multiple=true,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Lr,"UserAttributeBuilder");var wr=Lr;function VA(e){return new wr(e.name,e.label)}a(VA,"user");var Br=class Br extends v{to(t,r){let n={object:t,...r};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:Ze}],this}qualifyWith(...t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=rt(t),this}bilateral(t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(r.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(Zi(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");return this.attr.bilateral=t,this}};a(Br,"BaseRelationAttributeBuilder");var lt=Br,Ur=class Ur extends lt{constructor(t,r){super("relation",t,r),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new Ir(this.attr.name,this.attr.label??"",{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===false&&t.runtime(),this.attr.hidden&&t.hidden(),this.attr.placeholder&&t.placeholder(this.attr.placeholder),this.attr.description&&t.description(this.attr.description),this.attr.icon&&t.icon(this.attr.icon),this.attr.order!==void 0&&t.order(this.attr.order),this.attr.metadata&&t.metadata(this.attr.metadata),t}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Ur,"SingleRelationAttributeBuilder");var xr=Ur,$r=class $r extends lt{constructor(t,r,n){super("relation",t,r),this.attr.cardinality="many",this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(true);}maxItems(t){return this.attr.maxItems=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a($r,"MultiRelationAttributeBuilder");var Ir=$r;function we(e){return new xr(e.name,e.label)}a(we,"relation");var qr=class qr extends v{constructor(t,r){super("formula",t,r),this.attr.required=false;}expression(t){return this.attr.expression=t,this}returns(t){return this.attr.returnType=t,this}decimals(t){return this.attr.decimals=t,this}required(){throw new Error("Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};a(qr,"FormulaAttributeBuilder");var Sr=qr;function jA(e){return new Sr(e.name,e.label)}a(jA,"formula");var zr=class zr extends v{constructor(t,r){super("rollup",t,r),this.attr.required=false;}from(t){return this.attr.relationAttribute=t,this}aggregate(t){return this.attr.targetAttribute=t,this}using(t){return this.attr.function=t,this}decimals(t){return this.attr.decimals=t,this}path(t){return this.attr.relationPath=t,this}targetType(t){return this.attr.targetAttributeType=t,this}targetOptions(t){return this.attr.targetAttributeOptions=t,this}targetCurrency(t){return this.attr.targetCurrencyCode=t,this}build(){let t=this.attr.function,r=this.attr.targetAttributeType;if(t==="original"&&r!==void 0&&r!=="select"&&r!=="status"&&r!=="multiselect"){let n=this.attr.relationAttribute??"relation",o=this.attr.targetAttribute??"field";throw new b$1(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${r}") was given. To surface a plain ${r} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${n}.${o}").`,a$2.VALIDATION_FAILED)}return super.build()}required(){throw new Error("Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};a(zr,"RollupAttributeBuilder");var vr=zr;function MA(e){return new vr(e.name,e.label)}a(MA,"rollup");var Gr=class Gr extends v{constructor(t,r){super("document",t,r);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=rt(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};a(Gr,"DocumentAttributeBuilder");var Rr=Gr;function ko(e){return new Rr(e.name,e.label)}a(ko,"document");function Po(e,t,r){let n=Array.isArray(e)?e:[e],[o,...a]=n;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:r?.label,required:r?.required,tooltip:r?.tooltip}}a(Po,"buildSlotFieldRef");var Hr=class Hr{constructor(t,r,n){this._finalized=false;this.stepBuilder=t,this.rowData={id:r,order:n,type:"fields",fields:[]};}field(t,r,n){return this.rowData.fields.push(Po(t,r,n)),this}freeField(t,r){let o={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,r){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,r)}separator(){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).separator()}text(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).text(t)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=true,this.stepBuilder._finalizeRow(this.rowData))}};a(Hr,"FormRowBuilder");var Wr=Hr,Qr=class Qr{constructor(t,r,n){this.rowOrder=0;this.formBuilder=t,this.stepData={id:r,label:n,rows:[]};}description(t){return this.stepData.description=t,this}field(t,r,n){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=Po(t,r,n),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,r){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression},s={id:n,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new Wr(this,t,this.rowOrder)}heading(t,r){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:r};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let t={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"separator"};return this.stepData.rows.push(t),this}text(t){this.rowOrder++;let r={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(r),this}step(t,r){return this.formBuilder._finalizeStep(this.stepData).step(t,r)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(t){return t.fields.length>0&&this.stepData.rows.push(t),this}_getData(){return this.stepData}};a(Qr,"FormStepBuilder");var Kr=Qr,Jr=class Jr{constructor(t,r){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=r;}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}status(t){return this.data.status=t,this}metadata(t){return this.data.metadata=t,this}slot(t,r,n){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:r,label:n.label,mode:n.mode??"create",color:n.color,icon:n.icon};return this.data.slots.push(o),this}step(t,r){if(this.data.steps.some(n=>n.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new Kr(this,t,r)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let r=z$1.string().min(1,"Form name cannot be empty").max(63,"Form name is too long (max 63 characters)").regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:"Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'"});try{r.parse(t);}catch(n){throw n instanceof z$1.ZodError?new Error(`[FormBuilder] ${n.issues[0].message}`):n}}validateRequiredData(){if(this.data.slots.length===0)throw new Error("[FormBuilder] At least one slot is required. Use .slot() to add slots.");if(this.data.steps.length===0)throw new Error("[FormBuilder] At least one step is required. Use .step() to add steps.")}validateSlotReferences(){let t=new Map(this.data.slots.map(r=>[r.id,r.objectName]));for(let r of this.data.steps)for(let n of r.rows)if(et(n))for(let o of n.fields){if(o.type!=="slot")continue;let a=uo(o);for(let l of a)if(!t.has(l))throw new Error(`[FormBuilder] Step "${r.id}" references unknown slot "${l}". Declare it with .slot("${l}", ...) first.`);let s=new Set(a.map(l=>t.get(l)));if(s.size>1)throw new Error(`[FormBuilder] Step "${r.id}" field on attribute "${o.attribute}" targets slots of different objects (${[...s].join(", ")}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let t=[...it,"join"];for(let r of this.data.steps)for(let n of r.rows)if(et(n))for(let o of n.fields){if(!er(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${r.id}"`;if(!ot(a))throw new Error(`[FormBuilder] ${s} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(a))throw new Error(`[FormBuilder] ${s} contains empty {{ }} interpolation.`);for(let l of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let p=l[1];if(!t.includes(p))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${p}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(Zt);for(let r of this.data.steps)for(let n of r.rows)if(et(n)){for(let o of n.fields)if(er(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${r.id}" uses forbidden attribute type "${a}". Forbidden types: ${Zt.join(", ")}`)}}}};a(Jr,"FormBuilder");var Yr=Jr;function GA(e,t){return new Yr(e,t)}a(GA,"form");function zu(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}a(zu,"resolveBuiltInTransform");var Xr=class Xr{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,r){if(this.touchedAttributes.has(t))throw new Error(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${r}).`)}renameAttribute(t,r){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:r}),this}changeType(t,r,n,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?zu(n):void 0;return this.operations.push({type:"change_type",name:t,from:r,to:n,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t,backup_config:{}}),this}addAttribute(t){return this.assertNotTouched(t.name,"add_attribute"),this.touchedAttributes.add(t.name),this.operations.push({type:"add_attribute",attribute:t}),this}updateConfig(t,r){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:r}),this}build(){return {version:this.version,operations:[...this.operations]}}};a(Xr,"MigrationBuilder");var ct=Xr;function Gu(e){let{name:t,labelExpression:r,embeddingExpression:n}=e;if(!r)throw new b$1(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,a$2.VALIDATION_FAILED);let o=ye.safeParse(r);if(!o.success){let a=o.error.issues[0]?.message??"Invalid labelExpression";throw new b$1(`Invalid labelExpression for "${t}": ${a}`,a$2.VALIDATION_FAILED)}if(n!==void 0){let a=ye.safeParse(n);if(!a.success){let s=a.error.issues[0]?.message??"Invalid embeddingExpression";throw new b$1(`Invalid embeddingExpression for "${t}": ${s}`,a$2.VALIDATION_FAILED)}}}a(Gu,"validateObjectExpressions");var Zr=class Zr{constructor(t){this._migrations=[];this._sealed=false;this._toleratedAttributes=[];this.validateName(t.name),this.obj={name:t.name,label:t.label,attributes:[],system:true},t.id&&(this.obj.id=t.id);}get"~standard"(){let t=e(this.build());return ut(t)}description(t){return this.obj.description=t,this}pluralLabel(t){return this._pluralLabel=t,this}icon(t){return this.obj.icon=t,this}runtime(){return this.obj.system=false,this}sealed(){return this._sealed=true,this}tolerate(t){return this._toleratedAttributes=[...this._toleratedAttributes,...t],this}attribute(t){return this.pushAttributes([t]),this}attributes(t){return this.pushAttributes(t),this}pushAttributes(t){let r$1=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n);ue([...this.obj.attributes,...r$1],n=>n.name,n=>new r("attribute",n,`Object "${this.obj.name}": duplicate attribute name "${n}"`)),this.obj.attributes.push(...r$1);}metadata(t){return this.obj.metadata={...this.obj.metadata,...t},this}order(t){return this.obj.metadata={...this.obj.metadata,order:t},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:true},this}labelExpression(t){return this._labelExpression=t,this}embeddingExpression(t){return this._embeddingExpression=t,this}documentLayout(t){if(t.presets)for(let r of t.presets)Fo(r.id,r.structure,1);return this.obj.documentLayout=t,this}migration(t,r){if(t<2)throw new Error(`[ObjectBuilder] Migration version must be >= 2 (version 1 is implicit). Got: ${t}`);if(this._migrations.some(a=>a.version===t))throw new Error(`[ObjectBuilder] Duplicate migration version: ${t}`);let o=new ct(t);return r(o),this._migrations.push(o.build()),this}build(){if(!this.obj.name)throw new h("[ObjectBuilder] Missing required field: name",[{path:["name"],message:"name is required"}]);if(!this.obj.label)throw new h("[ObjectBuilder] Missing required field: label",[{path:["label"],message:"label is required"}]);Gu({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((n,o)=>n.version-o.version);for(let n=0;n<t.length;n++){let o=n+2;if(t[n].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[n].version}.`)}let r=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:r,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&Ce(t);}};a(Zr,"ObjectBuilder");var Oe=Zr;function nT(e){if(w$1(e.name))throw new s(e.name,"builder");return new Oe(e)}a(nT,"object");function Fo(e,t,r){let n=a((a,s)=>{throw new h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");r>5&&n(`Preset structure exceeds max depth of ${5}`,"Preset structure too deep");let o=new Set;for(let a of t){let s=a.title.trim();s.length===0&&n("Folder preset node title is required","Empty folder title"),s.includes("/")&&n("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&n("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&Fo(e,a.children,r+1);}}a(Fo,"validatePresetStructure");var dn=class dn{constructor(t,r){this.data={type:"fields",fields:[]};this.data.id=t,this.data.label=r;}description(t){return this.data.description=t,this}collapsible(t=false){return this.data.collapsible=true,this.data.collapsed=t,this}order(t){return this.data.order=t,this}fields(...t){for(let r of t)this.data.fields?.push({attribute:r});return this}field(t,r){return this.data.fields?.push({attribute:t,...r}),this}attributeGroup(t,r){return this.data.fields?.push({attributeGroup:t,...r}),this}build(){if(!this.data.id)throw new Error("[GroupBuilder] id is required");if(!this.data.label)throw new Error("[GroupBuilder] label is required");if(!this.data.fields||this.data.fields.length===0)throw new Error("[GroupBuilder] At least one field is required");return this.data}};a(dn,"GroupBuilder");var mt=dn,cn=class cn{constructor(t,r){this.view=t,this.tabData=r;}columns(...t){return this.tabData.columns=t,this}create(t){return this.tabData.allowCreate=true,t?.mode&&(this.tabData.createMode=t.mode),this}createMode(t){return this.tabData.createMode=t,this}edit(){return this.tabData.allowEdit=true,this}delete(){return this.tabData.allowDelete=true,this}crud(){return this.tabData.allowCreate=true,this.tabData.allowEdit=true,this.tabData.allowDelete=true,this}filters(t){return this.tabData.filters=t,this}sorts(t){return this.tabData.sorts=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}tab(t,r){return this.finalize(),new J(this.view,t,r)}done(){return this.finalize(),this.view}build(){return this.finalize(),this.view.build()}finalize(){if(!this.tabData.columns||this.tabData.columns.length===0)throw new Error(`[TableTabConfig] columns() is required for tab "${this.tabData.name}"`);this.view._addTab(this.tabData);}};a(cn,"TableTabConfig");var ft=cn,pn=class pn{constructor(t,r,n){this.view=t,this.tabData={...r,type:"custom",component:n};}props(t){return this.tabData.props=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(pn,"CustomTabConfig");var en=pn,mn=class mn{constructor(t,r,n){this.view=t,this.tabData={...r,type:"richtext",attribute:n};}titleAttribute(t){return this.tabData.titleAttribute=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(mn,"RichtextTabConfig");var tn=mn,fn=class fn{constructor(t,r){this.view=t,this.tabData={...r,type:"activity"};}limit(t){return this.tabData.limit=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(fn,"ActivityTabConfig");var rn=fn,bn=class bn{constructor(t,r,n){this.view=t,this.tabData={...r,type:n,emailAttributeIds:[]};}emailAttributes(...t){return this.tabData.emailAttributeIds=t,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(bn,"AddressMatchedTabConfig");var bt=bn,gn=class gn extends bt{constructor(t,r){super(t,r,"emails");}};a(gn,"EmailsTabConfig");var nn=gn,yn=class yn extends bt{constructor(t,r){super(t,r,"meetings");}};a(yn,"MeetingsTabConfig");var on=yn,hn=class hn{constructor(t,r){this.view=t,this.tabData={...r,type:"documents",allowUpload:true,allowRemove:true,hideAttachments:false};}disableUpload(){return this.tabData.allowUpload=false,this}disableRemove(){return this.tabData.allowRemove=false,this}hideAttachments(){return this.tabData.hideAttachments=true,this}tab(t,r){return this.view._addTab(this.tabData),new J(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(hn,"DocumentsTabConfig");var an=hn,An=class An{constructor(t,r,n){this.view=t,this.base={id:r,name:r,label:n};}icon(t){return this.base.icon=t,this}order(t){return this.base.order=t,this}form(...t){if(t.length===0)throw new Error(`[TabBuilder] form() requires at least one group for tab "${this.base.name}"`);let r={...this.base,type:"form",groups:t.map(n=>n instanceof mt?n.build():n)};return this.view._addTab(r)}table(t){return new ft(this.view,{...this.base,type:"table",source:{type:"relation",attribute:t},columns:[]})}tableFrom(t,r){return new ft(this.view,{...this.base,type:"table",source:{type:"inverse",object:t,attribute:r},columns:[]})}custom(t){return new en(this.view,this.base,t)}richtext(t){return new tn(this.view,this.base,t)}activity(){return new rn(this.view,this.base)}documents(){return new an(this.view,this.base)}emails(){return new nn(this.view,this.base)}meetings(){return new on(this.view,this.base)}forms(t){let r={...this.base,type:"forms",...t};return this.view._addTab(r)}};a(An,"TabBuilder");var J=An,Tn=class Tn{constructor(t,r){st(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}sidePanel(t){return this.data.sidePanel=t,this}readOnly(){return this.data.readOnly=true,this}tab(t,r){return new J(this,t,r)}addTab(t){return this.data.tabs.push(t),this}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[DetailViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[DetailViewBuilder] At least one tab is required");ue(this.data.tabs,r=>r.name,r=>new Error(`[DetailViewBuilder] Duplicate tab name "${r}"`));let t={tabs:this.data.tabs,sidePanel:this.data.sidePanel,...this.data.readOnly?{readOnly:true}:{}};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"detail",config:t,default:this.data.default,metadata:this.data.metadata}}};a(Tn,"DetailViewBuilder");var sn=Tn;function z(e,t){return new sn(e,t)}a(z,"detailView");function pt(e){if(Array.isArray(e))return e.map(pt).find(r=>r!==void 0);if(e===null||typeof e!="object")return;let t=e;return t.attribute==="visibility"||t.attribute==="ownedBy"?t.attribute:pt(t.rules)??pt(t.groups)}a(pt,"findProtectedTabFilterAttribute");var wn=class wn{constructor(t,r){st(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}baseFilter(t){return this.data.defaultFilters=t,this}allowPresentationCustomization(){return this.data.allowPresentationCustomization=true,this}tab(t,r){return new ln(this,t,r)}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[ListViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[ListViewBuilder] At least one tab is required");if(ue(this.data.tabs,n=>n.id,n=>new Error(`[ListViewBuilder] Duplicate tab id "${n}"`)),this.data.tabs.filter(n=>n.default).length>1)throw new Error("[ListViewBuilder] Only one tab can be marked as default");for(let n of this.data.tabs){if(n.layout==="table"&&n.columns.length===0)throw new h(`[ListViewBuilder] Tab "${n.id}" must have at least one column`,[]);if(n.layout==="kanban"&&!n.groupByAttribute)throw new h(`[ListViewBuilder] Kanban tab "${n.id}" requires a groupByAttribute`,[]);if(n.descriptionAttribute!==void 0&&n.descriptionAttribute.length===0)throw new h(`[ListViewBuilder] Tab "${n.id}" requires a nonempty description attribute name`,[]);if(n.displayAttributes!==void 0){let o=_$1.safeParse(n.displayAttributes);if(!o.success)throw new h(`[ListViewBuilder] Tab "${n.id}" has invalid display attributes`,o.error.issues.map(a=>({path:["tabs",n.id,"displayAttributes",...a.path.map(String)],message:a.message})))}}let r={allowPresentationCustomization:this.data.allowPresentationCustomization,defaultFilters:this.data.defaultFilters?{id:h$1(),combinator:this.data.defaultFilters.combinator,rules:this.data.defaultFilters.rules}:void 0,tabs:this.data.tabs.map(n=>{let o={id:n.id,label:n.label,icon:n.icon,default:n.default,visibility:n.visibility,columns:n.columns,descriptionAttribute:n.descriptionAttribute,displayAttributes:n.displayAttributes,filters:n.filters?{id:h$1(),combinator:n.filters.combinator,rules:n.filters.rules}:void 0,sorts:n.sorts,readOnly:n.readOnly,createMode:n.createMode};return n.layout==="kanban"?{...o,layout:"kanban",groupByAttribute:n.groupByAttribute,cardUserAttribute:n.cardUserAttribute,cardDateAttribute:n.cardDateAttribute,kanbanColumnOrder:n.kanbanColumnOrder,kanbanColumnVisibility:n.kanbanColumnVisibility,kanbanPinnedColumns:n.kanbanPinnedColumns}:{...o,layout:n.layout,columnSizing:n.columnSizing}})};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"list",config:r,default:this.data.default,metadata:this.data.metadata}}};a(wn,"ListViewBuilder");var un=wn,gt=class gt{constructor(t,r,n){this.view=t,this.tabData={id:r,label:n,visibility:"all",layout:"table",columns:[]};}icon(t){return this.tabData.icon=t,this}default(){return this.tabData.default=true,this}readOnly(){return this.tabData.readOnly=true,this}visibility(t){return this.tabData.visibility=t,this}table(){return this.tabData.layout="table",this}list(){return this.tabData.layout="list",this}descriptionAttribute(t){return this.tabData.descriptionAttribute=t,this}displayAttributes(...t){return this.tabData.displayAttributes=t,this}kanban(t){return this.tabData.layout="kanban",this.tabData.groupByAttribute=t,this}cardUserAttribute(t){return this.tabData.cardUserAttribute=t,this}cardDateAttribute(t){return this.tabData.cardDateAttribute=t,this}kanbanColumnOrder(t){return this.tabData.kanbanColumnOrder=t,this}kanbanColumnVisibility(t){return this.tabData.kanbanColumnVisibility=t,this}kanbanPinnedColumns(t){return this.tabData.kanbanPinnedColumns=t,this}createMode(t){return this.tabData.createMode=t,this}columns(...t){return this.tabData.columns=t,this}columnWidth(t,r){return this.tabData.columnSizing||(this.tabData.columnSizing={}),this.tabData.columnSizing[t]=r,this}filter(t){let r=pt(t);if(r){let n=`Tab filters cannot target "${r}". Use .visibility("private")`;throw new h(n,[{path:["filters"],message:n}])}return this.tabData.filters=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}sorts(t){return this.tabData.sorts=t,this}tab(t,r){return this.view._addTab(this.tabData),new gt(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};a(gt,"ListViewTabConfigBuilder");var ln=gt;function G(e,t){return new un(e,t)}a(G,"listView");function dT(e,t){return new mt(e,t)}a(dT,"group");function Wu(e){if(!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(e))throw new Error(`Invalid flag name "${e}". Flag names must be kebab-case (e.g., "architect-mode", "ai-features").`)}a(Wu,"validateFlagName");var Rn=class Rn{constructor(t,r,n){Wu(t),this.flag={name:t,valueType:r,defaultValue:n,allowedLevels:["global","tenant","user"]};}label(t){return this.flag.label=t,this}description(t){return this.flag.description=t,this}category(t){return this.flag.category=t,this}system(){return this.flag.system=true,this}tenantScoped(){return this.flag.allowedLevels=["global","tenant"],this}globalOnly(){return this.flag.allowedLevels=["global"],this}allowedLevels(t){return this.flag.allowedLevels=[...t],this}build(){if(!this.flag.label?.trim())throw new Error(`Flag "${this.flag.name}" must have a label. Use .label("Human-readable label").`);return {...this.flag,allowedLevels:[...this.flag.allowedLevels||[]]}}};a(Rn,"BaseFlagBuilder");var xe=Rn,En=class En extends xe{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};a(En,"BooleanFlagBuilder");var xn=En,Dn=class Dn extends xe{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};a(Dn,"StringFlagBuilder");var In=Dn,Cn=class Cn extends xe{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};a(Cn,"NumberFlagBuilder");var Sn=Cn,Nn=class Nn extends xe{constructor(t,r){super(t,"json",r);}defaultValue(t){return this.flag.defaultValue=t,this}};a(Nn,"JsonFlagBuilder");var vn=Nn;function Ku(e){return new xn(e)}a(Ku,"booleanFlag");function Yu(e){return new In(e)}a(Yu,"stringFlag");function Hu(e){return new Sn(e)}a(Hu,"numberFlag");function Qu(e,t){return new vn(e,t)}a(Qu,"jsonFlag");function On(e){return new r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}a(On,"duplicateFlagError");function kn(e){return {...e,allowedLevels:[...e.allowedLevels]}}a(kn,"cloneFlagDefinition");var _n=class _n{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw On(t.name);this.flags.set(t.name,kn(t));}registerAll(t){let r=new Set;for(let n of t){if(this.flags.has(n.name)||r.has(n.name))throw On(n.name);r.add(n.name);}for(let n of t)this.register(n);}get(t){let r=this.flags.get(t);return r?kn(r):void 0}getOrThrow(t){let r=this.get(t);if(!r)throw new c$3("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return r}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),kn)}listNames(){return Array.from(this.flags.keys())}unregister(t){return this.flags.delete(t)}clear(){this.flags.clear();}get size(){return this.flags.size}};a(_n,"FlagRegistry");var ke=_n,Ju=new ke;function Xu(){return new ke}a(Xu,"createFlagRegistry");function yt(){return {global:new Map,tenant:new Map,user:new Map}}a(yt,"emptyOverrides");function Zu(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}a(Zu,"isActiveOverride");function Pn(e,t){let r=new Map;for(let n of e){if(!Zu(n,t))continue;let o=n.flagName;r.has(o)||r.set(o,n);}return r}a(Pn,"indexOverrides");var Fn=class Fn{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(r=>[r.name,r.value])??[]);}async resolveAll(t={}){let r=this.collectFlagNames(),n=this.repository&&r.size>0?await this.getAllOverrides(t,[...r]):yt();return this.resolveNames(r,n,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),yt(),{})}collectFlagNames(){let t=new Set;for(let r of this.registry.listNames())t.add(r);for(let r of this.staticDefaults.keys())t.add(r);return t}resolveNames(t,r,n){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,r,n));return o}async resolve(t,r={}){let n=this.repository?await this.getAllOverrides(r,[t]):yt();return this.resolveWithSource(t,n,r)}async isEnabled(t,r={}){return (await this.resolve(t,r)).value===true}async getValue(t,r={}){return (await this.resolve(t,r)).value}async setOverride(t,r,n,o={}){if(!this.repository)throw new b$1("Cannot set override: no FeatureFlagsRepository configured. Add featureFlags to your DatabaseAdapter to enable runtime overrides.",a$2.CONFIGURATION_REQUIRED);let a=this.registry.get(t);if(a&&!a.allowedLevels.includes(r)){let s=`Flag "${t}" does not allow ${r}-level overrides. Allowed levels: ${a.allowedLevels.join(", ")}`;throw new h(s,[{path:["level"],message:s}])}if(a?.system){let s=`Flag "${t}" is a system flag and cannot be overridden via API.`;throw new h(s,[{path:["flagName"],message:s}])}await this.repository.setOverride({flagName:t,level:r,value:n,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,r,n){if(!this.repository)throw new b$1("Cannot delete override: no FeatureFlagsRepository configured.",a$2.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,r,n);}async getAllOverrides(t,r){if(!this.repository)return yt();let[n,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:r}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:r}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:r}):Promise.resolve([])]),s=Date.now();return {global:Pn(n,s),tenant:Pn(o,s),user:Pn(a,s)}}resolveValue(t,r,n){return this.resolveWithSource(t,r,n).value}resolveWithSource(t,r,n){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(n.userId&&a.includes("user")){let s=r.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:n.userId}}if(n.tenantId&&a.includes("tenant")){let s=r.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:n.tenantId}}if(a.includes("global")){let s=r.global.get(t);if(s)return {name:t,value:s.value,source:"global"}}return this.staticDefaults.has(t)?{name:t,value:this.staticDefaults.get(t),source:"default"}:{name:t,value:o?.defaultValue??void 0,source:"default"}}};a(Fn,"FlagService");var ht=Fn;function el(e){return new ht(e)}a(el,"createFlagService");var Vo=Symbol("stndrds.native-object");function jn(e){return Object.defineProperty(e,Vo,{value:true,enumerable:false}),e}a(jn,"markNativeDefinition");var Ln=class Ln extends Oe{build(){return jn(super.build())}};a(Ln,"NativeObjectBuilder");var Vn=Ln;function W(e){return new Vn(e)}a(W,"nativeObject");function Mn(e){return e[Vo]===true}a(Mn,"isNativeDefinition");function Bn(e){let t=structuredClone(e);return Mn(e)?jn(t):t}a(Bn,"cloneObjectDefinition");var $n=class $n{constructor(){this.objects=new Map;}register(t){let n=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of n){if(this.validate(a),o.has(a.name))throw new r("object",a.name,`[NativeObjectRegistry] Duplicate object name "${a.name}" within a single register() batch.`);o.add(a.name);}for(let a of n)this.objects.set(a.name,Bn(a));return this}validate(t){if(!t.system){let r=`[NativeObjectRegistry] Cannot register object "${t.name}" (id: ${t.id}): missing system flag.
14
+ Native objects must have system=true. Did you call .runtime() on the builder? Remove that call \u2014 objects are system:true by default.`;throw new h(r,[])}if(w$1(t.name)&&!Mn(t))throw new s(t.name,"registry");if(this.objects.has(t.name)){let r$1=this.objects.get(t.name),n=`[NativeObjectRegistry] Duplicate object name "${t.name}":
15
15
  - Existing: "${r$1?.label}" (id: ${r$1?.id})
16
16
  - New: "${t.label}" (id: ${t.id})
17
- Please use unique names for each native object.`;throw new r("object",t.name,n)}}getByName(t){let r=this.objects.get(t);return r?_n(r):void 0}getByNameOrThrow(t){let r=this.getByName(t);if(!r){let n=`[NativeObjectRegistry] Native object "${t}" not found.
18
- Available objects: ${this.listNames().join(", ")}`;throw new c$3("Native object",t,a$2.OBJECT_NOT_FOUND,n)}return r}getAll(){return Array.from(this.objects.values(),_n)}listNames(){return Array.from(this.objects.keys())}has(t){return this.objects.has(t)}get size(){return this.objects.size}clear(){this.objects.clear();}summary(){let t=this.getAll();return [`[NativeObjectRegistry] ${this.size} native object(s) registered:`,...t.map(r=>` - ${r.name}: "${r.label}" (${r.attributes.length} attributes)`)].join(`
19
- `)}debug(t){let r=this.summary();return t?.(r),r}};a(Fn,"NativeObjectRegistryClass");var Pn=Fn,gT=new Pn;function O(e){return {...e,system:true}}a(O,"markSystemView");var Do=`## Overview
17
+ Please use unique names for each native object.`;throw new r("object",t.name,n)}}getByName(t){let r=this.objects.get(t);return r?Bn(r):void 0}getByNameOrThrow(t){let r=this.getByName(t);if(!r){let n=`[NativeObjectRegistry] Native object "${t}" not found.
18
+ Available objects: ${this.listNames().join(", ")}`;throw new c$3("Native object",t,a$2.OBJECT_NOT_FOUND,n)}return r}getAll(){return Array.from(this.objects.values(),Bn)}listNames(){return Array.from(this.objects.keys())}has(t){return this.objects.has(t)}get size(){return this.objects.size}clear(){this.objects.clear();}summary(){let t=this.getAll();return [`[NativeObjectRegistry] ${this.size} native object(s) registered:`,...t.map(r=>` - ${r.name}: "${r.label}" (${r.attributes.length} attributes)`)].join(`
19
+ `)}debug(t){let r=this.summary();return t?.(r),r}};a($n,"NativeObjectRegistryClass");var Un=$n,MT=new Un;function N(e){return {...e,system:true}}a(N,"markSystemView");var jo=`## Overview
20
20
 
21
21
  Describe in one or two sentences what this skill does and the outcome it produces. The agent reads this page when it uses the skill \u2014 write instructions for the agent, not documentation for people.
22
22
 
@@ -47,14 +47,14 @@ Show at least one concrete example of the skill applied well.
47
47
 
48
48
  - Never \u2026
49
49
  - Do not \u2026
50
- `,Mu=W({name:"skill",label:"Skill"}).sealed().icon("book-open").order(Number.MAX_SAFE_INTEGER).pluralLabel("Skills").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
50
+ `,nl=W({name:"skill",label:"Skill"}).sealed().icon("book-open").order(Number.MAX_SAFE_INTEGER).pluralLabel("Skills").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
51
51
  {{ description }}
52
- {{ content }}`).attribute(f({name:"name",label:"Name"}).maxLength(SKILL_NAME_MAX_LENGTH).required()).attribute(f({name:"description",label:"Description"}).multiline().maxLength(SKILL_DESCRIPTION_MAX_LENGTH).required().placeholder('What this skill does and when to use it \u2014 e.g. "Drafts replies to customer complaints. Use when asked to answer an unhappy customer."')).attribute(Ae({name:"content",label:"Content"}).defaultValue(Do)).build(),Lu=O(z("skill-detail","Skill").for("skill").default().sidePanel({attributes:["name","description"]}).tab("content","Content").richtext("content").titleAttribute("name").done().tab("files","Files").documents().done().tab("activity","Activity").activity().done().build()),Bu=O(G("skill-list","Skills").for("skill").default().allowPresentationCustomization().tab("workspace","Skills").default().icon("list").visibility("workspace").list().columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name","asc").tab("mine","My skills").icon("lock").visibility("private").list().columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name","asc").build());var qu=W({name:"memory",label:"Memory"}).sealed().icon("database").order(Number.MAX_SAFE_INTEGER).pluralLabel("Memories").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
52
+ {{ content }}`).attribute(f({name:"name",label:"Name"}).maxLength(SKILL_NAME_MAX_LENGTH).required()).attribute(f({name:"description",label:"Description"}).multiline().maxLength(SKILL_DESCRIPTION_MAX_LENGTH).required().placeholder('What this skill does and when to use it \u2014 e.g. "Drafts replies to customer complaints. Use when asked to answer an unhappy customer."')).attribute(Te({name:"content",label:"Content"}).defaultValue(jo)).build(),il=N(z("skill-detail","Skill").for("skill").default().sidePanel({attributes:["name","description"]}).tab("content","Content").richtext("content").titleAttribute("name").done().tab("files","Files").documents().done().tab("activity","Activity").activity().done().build()),ol=N(G("skill-list","Skills").for("skill").default().allowPresentationCustomization().tab("workspace","Skills").default().icon("list").visibility("workspace").list().columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name","asc").tab("mine","My skills").icon("lock").visibility("private").list().columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name","asc").build());var ul=W({name:"memory",label:"Memory"}).sealed().icon("database").order(Number.MAX_SAFE_INTEGER).pluralLabel("Memories").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
53
53
  {{ description }}
54
- {{ content }}`).migration(2,e=>e.changeType("content","text","richtext")).attribute(f({name:"name",label:"Name"}).maxLength(MEMORY_NAME_MAX_LENGTH).required()).attribute(f({name:"description",label:"Description"}).multiline().maxLength(MEMORY_DESCRIPTION_MAX_LENGTH).required()).attribute(Ae({name:"content",label:"Content"})).attribute(q({name:"kind",label:"Kind"}).options([{value:"fact",label:"Fact"},{value:"preference",label:"Preference"},{value:"feedback",label:"Feedback"},{value:"reference",label:"Reference"}])).attribute(Te({name:"subjects",label:"Subjects"}).toAny().many()).attribute(Te({name:"links",label:"Links"}).to("memory").many()).attribute(q({name:"source",label:"Source"}).options([{value:"explicit",label:"Saved by an agent"},{value:"extracted",label:"Extracted from a session"},{value:"corroborated",label:"Corroborated across users"},{value:"curated",label:"Curated by Dreamer"}])).attribute(U({name:"validFrom",label:"Valid from"}).includeTime()).attribute(U({name:"invalidAt",label:"Invalid at"}).includeTime()).attribute(Te({name:"supersededBy",label:"Superseded by"}).to("memory")).attribute(f({name:"provenance",label:"Provenance"}).multiline()).attribute(q({name:"reviewState",label:"Review state"}).options([{value:"needs_review",label:"Needs review"},{value:"skill_candidate",label:"Skill candidate"}])).attribute(f({name:"reviewReason",label:"Review reason"}).multiline()).attribute(U({name:"curatedAt",label:"Curated at"}).includeTime()).attribute(U({name:"reviewAfter",label:"Review after"}).includeTime()).attribute(f({name:"curationFingerprint",label:"Curation fingerprint"})).build(),Co={combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_empty",value:null}]},zu=O(z("memory-detail","Memory").for("memory").default().sidePanel({attributes:["description","kind","source","provenance","reviewState","reviewReason","validFrom","invalidAt","supersededBy","curatedAt","reviewAfter","subjects","links"]}).tab("content","Content").richtext("content").titleAttribute("name").build()),Gu=O(G("memory-list","Memories").for("memory").default().allowPresentationCustomization().tab("workspace","Memories").default().icon("list").visibility("workspace").list().columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(Co).sort("name","asc").tab("mine","My memories").icon("lock").visibility("private").list().columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(Co).sort("name","asc").tab("review","To review").icon("question-circle").table().columns("name","reviewState","reviewReason","updatedAt").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_not_empty",value:null}]}).sort("updatedAt","desc").tab("history","History").icon("archive").table().columns("name","kind","invalidAt","supersededBy").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_not_empty",value:null}]}).sort("invalidAt","desc").build());var bt="drives",Wu=W({name:bt,label:"Drive"}).sealed().icon("folder").hidden().pluralLabel("Drives").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
55
- {{ description }}`).attribute(f({name:"name",label:"Name"}).required()).attribute(f({name:"description",label:"Description"}).multiline()).build(),Ku=O(z("drive-detail","Drive").for(bt).default().sidePanel({attributes:["description"]}).tab("documents","Documents").documents().build()),Yu=O(G("drive-list","Drives").for(bt).default().tab("workspace","Shared").default().icon("users").visibility("workspace").table().columns("name","description","updatedAt").sort("name","asc").tab("mine","My drives").icon("lock").visibility("private").table().columns("name","description","updatedAt").sort("name","asc").build());var gt="artifact",Hu=W({name:gt,label:"Artifact"}).sealed().icon("package").pluralLabel("Artifacts").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
56
- {{ description }}`).attribute(f({name:"name",label:"Name"}).required()).attribute(f({name:"description",label:"Description"}).multiline()).attribute(q({name:"kind",label:"Kind"}).options([{value:"web",label:"Web",color:"blue"},{value:"presentation",label:"Presentation",color:"purple"},{value:"document",label:"Document",color:"sky"},{value:"spreadsheet",label:"Spreadsheet",color:"green"},{value:"image",label:"Image",color:"pink"},{value:"code",label:"Code",color:"slate"},{value:"other",label:"Other",color:"gray"}]).required()).attribute(q({name:"retention",label:"Retention"}).options([{value:"ephemeral",label:"Ephemeral",color:"gray"},{value:"conversation",label:"Conversation",color:"blue"},{value:"persistent",label:"Persistent",color:"green"}]).defaultValue("conversation").required()).attribute(at({name:"currentRevision",label:"Current revision"}).integer().min(1)).attribute(U({name:"expiresAt",label:"Expires at"}).includeTime().hidden()).attribute(f({name:"sourceSessionId",label:"Source session"}).hidden()).attribute(f({name:"sourceMessageId",label:"Source message"}).hidden()).attribute(f({name:"initialToolCallId",label:"Initial tool call"}).hidden()).attribute(Io({name:"versions",label:"Versions"}).qualifyWith(at({name:"revision",label:"Revision"}).integer().min(1).required(),f({name:"toolCallId",label:"Tool call"}).hidden(),f({name:"sourceFileId",label:"Source file"}).hidden(),f({name:"previewFileId",label:"Preview file"}).hidden(),f({name:"fileIds",label:"File manifest"}).hidden(),f({name:"entrypoint",label:"Entrypoint"}).hidden(),f({name:"sourceMessageId",label:"Source message"}).hidden(),f({name:"artifactName",label:"Artifact name"}).hidden(),f({name:"artifactDescription",label:"Artifact description"}).hidden(),f({name:"artifactKind",label:"Artifact kind"}).hidden(),f({name:"displayMode",label:"Display mode"}).hidden(),f({name:"displayInteraction",label:"Display interaction"}).hidden(),f({name:"displaySize",label:"Display size"}).hidden(),at({name:"displayAspectRatio",label:"Display aspect ratio"}).hidden())).build(),Qu=O(z("artifact-detail","Artifact").for(gt).default().readOnly().sidePanel({attributes:["description","kind","retention","currentRevision","createdBy","updatedAt"]}).tab("preview","Preview").custom("ArtifactPreview").done().tab("versions","Versions").documents().disableUpload().disableRemove().hideAttachments().done().tab("activity","Activity").activity().done().build());function Ju(){let e=G("artifact-list","Artifacts").for(gt).default().allowPresentationCustomization().tab("mine","My artifacts").default().icon("lock").visibility("private").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").tab("workspace","Workspace").icon("list").visibility("workspace").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").build();return {...e,config:{...e.config,tabs:e.config.tabs.map(t=>({...t,default:t.default??false}))}}}a(Ju,"buildArtifactListView");var Xu=O(Ju());var yt="meeting",T={title:"title",description:"description",location:"location",startsAt:"startsAt",endsAt:"endsAt",isAllDay:"isAllDay",status:"status",organizerAddress:"organizerAddress",organizerName:"organizerName",conferenceProvider:"conferenceProvider",conferenceJoinUrl:"conferenceJoinUrl",htmlLink:"htmlLink",participants:"participants",providerEventId:"providerEventId",icalUid:"icalUid",recurringEventId:"recurringEventId",connectionId:"connectionId",recordingOverride:"recordingOverride",endedAnnouncedAt:"endedAnnouncedAt",linkedRecords:"linkedRecords"},Oo="meeting-list",ko="calendar-sync",_o="meeting-detail",No=[T.title,T.startsAt,T.endsAt,T.status],Zu=W({name:yt,label:"Meeting"}).sealed().hidden().metadata({platformOwned:{editable:[T.linkedRecords],source:ko}}).icon("calendar").pluralLabel("Meetings").labelExpression("{{ title }}").embeddingExpression(`{{ title }}
54
+ {{ content }}`).migration(2,e=>e.changeType("content","text","richtext")).attribute(f({name:"name",label:"Name"}).maxLength(MEMORY_NAME_MAX_LENGTH).required()).attribute(f({name:"description",label:"Description"}).multiline().maxLength(MEMORY_DESCRIPTION_MAX_LENGTH).required()).attribute(Te({name:"content",label:"Content"})).attribute(q({name:"kind",label:"Kind"}).options([{value:"fact",label:"Fact"},{value:"preference",label:"Preference"},{value:"feedback",label:"Feedback"},{value:"reference",label:"Reference"}])).attribute(we({name:"subjects",label:"Subjects"}).toAny().many()).attribute(we({name:"links",label:"Links"}).to("memory").many()).attribute(q({name:"source",label:"Source"}).options([{value:"explicit",label:"Saved by an agent"},{value:"extracted",label:"Extracted from a session"},{value:"corroborated",label:"Corroborated across users"},{value:"curated",label:"Curated by Dreamer"}])).attribute(U({name:"validFrom",label:"Valid from"}).includeTime()).attribute(U({name:"invalidAt",label:"Invalid at"}).includeTime()).attribute(we({name:"supersededBy",label:"Superseded by"}).to("memory")).attribute(f({name:"provenance",label:"Provenance"}).multiline()).attribute(q({name:"reviewState",label:"Review state"}).options([{value:"needs_review",label:"Needs review"},{value:"skill_candidate",label:"Skill candidate"}])).attribute(f({name:"reviewReason",label:"Review reason"}).multiline()).attribute(U({name:"curatedAt",label:"Curated at"}).includeTime()).attribute(U({name:"reviewAfter",label:"Review after"}).includeTime()).attribute(f({name:"curationFingerprint",label:"Curation fingerprint"})).build(),Mo={combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_empty",value:null}]},ll=N(z("memory-detail","Memory").for("memory").default().sidePanel({attributes:["description","kind","source","provenance","reviewState","reviewReason","validFrom","invalidAt","supersededBy","curatedAt","reviewAfter","subjects","links"]}).tab("content","Content").richtext("content").titleAttribute("name").build()),dl=N(G("memory-list","Memories").for("memory").default().allowPresentationCustomization().tab("workspace","Memories").default().icon("list").visibility("workspace").list().columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(Mo).sort("name","asc").tab("mine","My memories").icon("lock").visibility("private").list().columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(Mo).sort("name","asc").tab("review","To review").icon("question-circle").table().columns("name","reviewState","reviewReason","updatedAt").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_not_empty",value:null}]}).sort("updatedAt","desc").tab("history","History").icon("archive").table().columns("name","kind","invalidAt","supersededBy").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_not_empty",value:null}]}).sort("invalidAt","desc").build());var At="drives",cl=W({name:At,label:"Drive"}).sealed().icon("folder").hidden().pluralLabel("Drives").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
55
+ {{ description }}`).attribute(f({name:"name",label:"Name"}).required()).attribute(f({name:"description",label:"Description"}).multiline()).build(),pl=N(z("drive-detail","Drive").for(At).default().sidePanel({attributes:["description"]}).tab("documents","Documents").documents().build()),ml=N(G("drive-list","Drives").for(At).default().tab("workspace","Shared").default().icon("users").visibility("workspace").table().columns("name","description","updatedAt").sort("name","asc").tab("mine","My drives").icon("lock").visibility("private").table().columns("name","description","updatedAt").sort("name","asc").build());var Tt="artifact",fl=W({name:Tt,label:"Artifact"}).sealed().icon("package").pluralLabel("Artifacts").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
56
+ {{ description }}`).attribute(f({name:"name",label:"Name"}).required()).attribute(f({name:"description",label:"Description"}).multiline()).attribute(q({name:"kind",label:"Kind"}).options([{value:"web",label:"Web",color:"blue"},{value:"presentation",label:"Presentation",color:"purple"},{value:"document",label:"Document",color:"sky"},{value:"spreadsheet",label:"Spreadsheet",color:"green"},{value:"image",label:"Image",color:"pink"},{value:"code",label:"Code",color:"slate"},{value:"other",label:"Other",color:"gray"}]).required()).attribute(q({name:"retention",label:"Retention"}).options([{value:"ephemeral",label:"Ephemeral",color:"gray"},{value:"conversation",label:"Conversation",color:"blue"},{value:"persistent",label:"Persistent",color:"green"}]).defaultValue("conversation").required()).attribute(dt({name:"currentRevision",label:"Current revision"}).integer().min(1)).attribute(U({name:"expiresAt",label:"Expires at"}).includeTime().hidden()).attribute(f({name:"sourceSessionId",label:"Source session"}).hidden()).attribute(f({name:"sourceMessageId",label:"Source message"}).hidden()).attribute(f({name:"initialToolCallId",label:"Initial tool call"}).hidden()).attribute(ko({name:"versions",label:"Versions"}).qualifyWith(dt({name:"revision",label:"Revision"}).integer().min(1).required(),f({name:"toolCallId",label:"Tool call"}).hidden(),f({name:"sourceFileId",label:"Source file"}).hidden(),f({name:"previewFileId",label:"Preview file"}).hidden(),f({name:"fileIds",label:"File manifest"}).hidden(),f({name:"entrypoint",label:"Entrypoint"}).hidden(),f({name:"sourceMessageId",label:"Source message"}).hidden(),f({name:"artifactName",label:"Artifact name"}).hidden(),f({name:"artifactDescription",label:"Artifact description"}).hidden(),f({name:"artifactKind",label:"Artifact kind"}).hidden(),f({name:"displayMode",label:"Display mode"}).hidden(),f({name:"displayInteraction",label:"Display interaction"}).hidden(),f({name:"displaySize",label:"Display size"}).hidden(),dt({name:"displayAspectRatio",label:"Display aspect ratio"}).hidden())).build(),bl=N(z("artifact-detail","Artifact").for(Tt).default().readOnly().sidePanel({attributes:["description","kind","retention","currentRevision","createdBy","updatedAt"]}).tab("preview","Preview").custom("ArtifactPreview").done().tab("versions","Versions").documents().disableUpload().disableRemove().hideAttachments().done().tab("activity","Activity").activity().done().build());function gl(){let e=G("artifact-list","Artifacts").for(Tt).default().allowPresentationCustomization().tab("mine","My artifacts").default().icon("lock").visibility("private").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").tab("workspace","Workspace").icon("list").visibility("workspace").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").build();return {...e,config:{...e.config,tabs:e.config.tabs.map(t=>({...t,default:t.default??false}))}}}a(gl,"buildArtifactListView");var yl=N(gl());var wt="meeting",T={title:"title",description:"description",location:"location",startsAt:"startsAt",endsAt:"endsAt",isAllDay:"isAllDay",status:"status",organizerAddress:"organizerAddress",organizerName:"organizerName",conferenceProvider:"conferenceProvider",conferenceJoinUrl:"conferenceJoinUrl",htmlLink:"htmlLink",participants:"participants",providerEventId:"providerEventId",icalUid:"icalUid",recurringEventId:"recurringEventId",connectionId:"connectionId",recordingOverride:"recordingOverride",endedAnnouncedAt:"endedAnnouncedAt",linkedRecords:"linkedRecords"},Bo="meeting-list",Uo="calendar-sync",$o="meeting-detail",Lo=[T.title,T.startsAt,T.endsAt,T.status],hl=W({name:wt,label:"Meeting"}).sealed().hidden().metadata({platformOwned:{editable:[T.linkedRecords],source:Uo}}).icon("calendar").pluralLabel("Meetings").labelExpression("{{ title }}").embeddingExpression(`{{ title }}
57
57
  {{ description }}
58
- {{ participants }}`).attribute(f({name:T.title,label:"Title"}).required()).attribute(Ae({name:T.description,label:"Description"})).attribute(f({name:T.location,label:"Location"})).attribute(U({name:T.startsAt,label:"Starts at"}).includeTime()).attribute(U({name:T.endsAt,label:"Ends at"}).includeTime()).attribute(xo({name:T.isAllDay,label:"All day"})).attribute(q({name:T.status,label:"Status"}).options([{value:"confirmed",label:"Confirmed"},{value:"tentative",label:"Tentative"},{value:"cancelled",label:"Cancelled"}])).attribute(f({name:T.organizerAddress,label:"Organizer address"}).email()).attribute(f({name:T.organizerName,label:"Organizer"})).attribute(f({name:T.conferenceProvider,label:"Conference provider"})).attribute(f({name:T.conferenceJoinUrl,label:"Join link"}).url()).attribute(f({name:T.htmlLink,label:"Open in calendar"}).url()).attribute(f({name:T.participants,label:"Participants"}).multiline()).attribute(f({name:T.providerEventId,label:"Provider event id"}).hidden()).attribute(f({name:T.icalUid,label:"iCal UID"}).hidden()).attribute(f({name:T.recurringEventId,label:"Recurring event id"}).hidden()).attribute(f({name:T.connectionId,label:"Connection id"}).hidden()).attribute(q({name:T.recordingOverride,label:"Recording"}).options([{value:"force",label:"Force"},{value:"skip",label:"Skip"}]).hidden()).attribute(U({name:T.endedAnnouncedAt,label:"Ended announced at"}).includeTime().hidden()).attribute(Te({name:T.linkedRecords,label:"Linked records"}).toAny().many().qualifyWith(f({name:"source",label:"Source"}).hidden())).build(),el=O(z(_o,"Meeting").for(yt).default().sidePanel({attributes:[T.startsAt,T.endsAt,T.linkedRecords]}).tab("description","Description").richtext(T.description).titleAttribute(T.title).build()),tl=O(G(Oo,"Meetings").for(yt).default().tab("workspace","Shared").default().icon("users").visibility("workspace").table().columns(...No).sort(T.startsAt,"desc").tab("mine","My meetings").icon("lock").visibility("private").table().columns(...No).sort(T.startsAt,"desc").build());function _e(e){return structuredClone(e)}a(_e,"cloneViewDefinition");var jn=class jn{constructor(){this.views=new Map;this.byObject=new Map;this.byObjectAndType=new Map;}register(t){let r=Array.isArray(t)?t:[t];for(let n of r)this.registerSingle(n);return this}registerSingle(t){let r$1=this.makeKey(t.object,t.name,t.type);if(this.views.has(r$1)){let l=`[ViewRegistry] Duplicate view: "${t.name}" (${t.type}) for object "${t.object}"`;throw new r("view",r$1,l)}let n=_e(t);this.views.set(r$1,n);let o=this.byObject.get(n.object)??[];o.push(n),this.byObject.set(n.object,o);let a=`${n.object}:${n.type}`,s=this.byObjectAndType.get(a)??[];s.push(n),this.byObjectAndType.set(a,s);}getByObjectName(t){return Array.from(this.byObject.get(t)??[],_e)}getByObjectNameAndType(t,r){return Array.from(this.byObjectAndType.get(`${t}:${r}`)??[],_e)}get(t,r,n){if(n){let a=this.views.get(this.makeKey(t,r,n));return a?_e(a):void 0}return this.getByObjectName(t).find(a=>a.name===r)}getOrThrow(t,r,n){let o=this.get(t,r,n);if(!o){let s=this.getByObjectName(t).map(p=>`${p.name} (${p.type})`).join(", ")||"(none)",l=`[ViewRegistry] View "${r}" not found for object "${t}".
58
+ {{ participants }}`).attribute(f({name:T.title,label:"Title"}).required()).attribute(Te({name:T.description,label:"Description"})).attribute(f({name:T.location,label:"Location"})).attribute(U({name:T.startsAt,label:"Starts at"}).includeTime()).attribute(U({name:T.endsAt,label:"Ends at"}).includeTime()).attribute(Oo({name:T.isAllDay,label:"All day"})).attribute(q({name:T.status,label:"Status"}).options([{value:"confirmed",label:"Confirmed"},{value:"tentative",label:"Tentative"},{value:"cancelled",label:"Cancelled"}])).attribute(f({name:T.organizerAddress,label:"Organizer address"}).email()).attribute(f({name:T.organizerName,label:"Organizer"})).attribute(f({name:T.conferenceProvider,label:"Conference provider"})).attribute(f({name:T.conferenceJoinUrl,label:"Join link"}).url()).attribute(f({name:T.htmlLink,label:"Open in calendar"}).url()).attribute(f({name:T.participants,label:"Participants"}).multiline()).attribute(f({name:T.providerEventId,label:"Provider event id"}).hidden()).attribute(f({name:T.icalUid,label:"iCal UID"}).hidden()).attribute(f({name:T.recurringEventId,label:"Recurring event id"}).hidden()).attribute(f({name:T.connectionId,label:"Connection id"}).hidden()).attribute(q({name:T.recordingOverride,label:"Recording"}).options([{value:"force",label:"Force"},{value:"skip",label:"Skip"}]).hidden()).attribute(U({name:T.endedAnnouncedAt,label:"Ended announced at"}).includeTime().hidden()).attribute(we({name:T.linkedRecords,label:"Linked records"}).toAny().many().qualifyWith(f({name:"source",label:"Source"}).hidden())).build(),Al=N(z($o,"Meeting").for(wt).default().sidePanel({attributes:[T.startsAt,T.endsAt,T.linkedRecords]}).tab("description","Description").richtext(T.description).titleAttribute(T.title).build()),Tl=N(G(Bo,"Meetings").for(wt).default().tab("workspace","Shared").default().icon("users").visibility("workspace").table().columns(...Lo).sort(T.startsAt,"desc").tab("mine","My meetings").icon("lock").visibility("private").table().columns(...Lo).sort(T.startsAt,"desc").build());function _e(e){return structuredClone(e)}a(_e,"cloneViewDefinition");var zn=class zn{constructor(){this.views=new Map;this.byObject=new Map;this.byObjectAndType=new Map;}register(t){let r=Array.isArray(t)?t:[t];for(let n of r)this.registerSingle(n);return this}registerSingle(t){let r$1=this.makeKey(t.object,t.name,t.type);if(this.views.has(r$1)){let l=`[ViewRegistry] Duplicate view: "${t.name}" (${t.type}) for object "${t.object}"`;throw new r("view",r$1,l)}let n=_e(t);this.views.set(r$1,n);let o=this.byObject.get(n.object)??[];o.push(n),this.byObject.set(n.object,o);let a=`${n.object}:${n.type}`,s=this.byObjectAndType.get(a)??[];s.push(n),this.byObjectAndType.set(a,s);}getByObjectName(t){return Array.from(this.byObject.get(t)??[],_e)}getByObjectNameAndType(t,r){return Array.from(this.byObjectAndType.get(`${t}:${r}`)??[],_e)}get(t,r,n){if(n){let a=this.views.get(this.makeKey(t,r,n));return a?_e(a):void 0}return this.getByObjectName(t).find(a=>a.name===r)}getOrThrow(t,r,n){let o=this.get(t,r,n);if(!o){let s=this.getByObjectName(t).map(p=>`${p.name} (${p.type})`).join(", ")||"(none)",l=`[ViewRegistry] View "${r}" not found for object "${t}".
59
59
  Available views: ${s}`;throw new c$3("View",`${t}:${r}`,void 0,l)}return o}getAll(){return Array.from(this.views.values(),_e)}has(t,r,n){return n?this.views.has(this.makeKey(t,r,n)):this.getByObjectName(t).some(a=>a.name===r)}hasObject(t){return this.byObject.has(t)}get size(){return this.views.size}listObjectNames(){return Array.from(this.byObject.keys())}getDefault(t,r){let n=this.getByObjectNameAndType(t,r);return n.find(o=>o.default)??n[0]}clear(){this.views.clear(),this.byObject.clear(),this.byObjectAndType.clear();}summary(){let t=[];t.push(`[ViewRegistry] ${this.size} view(s) registered:`);for(let r of this.listObjectNames()){let o=this.getByObjectName(r).map(a=>{let s=[];a.default&&s.push("default");let l=s.length>0?` (${s.join(", ")})`:"";return `${a.name}:${a.type}${l}`});t.push(` ${r}: ${o.join(", ")}`);}return t.join(`
60
- `)}debug(t){let r=this.summary();return t?.(r),r}makeKey(t,r,n){return `${t}:${r}:${n}`}};a(jn,"ViewRegistry");var Vn=jn,rl=new Vn;function Po(e,t=[]){return e.filter(r=>!(!j(r).lifecycle.visibleInRuntime||r.system||t.includes(r.name)))}a(Po,"getRuntimeAttributes");function Fo(e){return [...e].sort((t,r)=>{let n=t.order??999,o=r.order??999;return n!==o?n-o:t.name.localeCompare(r.name)})}a(Fo,"sortAttributes");function nl(e){if(e.type==="text"&&e.multiline)return 12;switch(e.type){case "richtext":case "location":return 12;case "checkbox":return 4;default:return 6}}a(nl,"getDefaultFieldSpan");function il(e){return {attribute:e.name,span:nl(e)}}a(il,"attributeToField");function Mn(e,t={}){let{includeActivityTab:r=true,includeDocumentsTab:n=true,excludeAttributes:o=[]}=t,a=Po(e.attributes,o),p=[{id:"form",name:"form",label:"Details",type:"form",groups:[{id:"general",label:"General",type:"fields",fields:Fo(a.filter(ae=>j(ae).presentation.formField)).map(il),order:0}],order:0}],I=1,Z=e.attributes.some(ae=>ae.type==="document");n&&Z&&p.push({id:"documents",name:"documents",label:"Documents",type:"documents",order:I++,allowUpload:true,allowRemove:true}),r&&p.push({id:"activity",name:"activity",label:"Activity",type:"activity",order:I++});let B={tabs:p};return {name:"default",label:"Default View",object:e.name,type:"detail",config:B,default:true}}a(Mn,"generateDefaultDetailView");function Ln(e,t={}){let{excludeAttributes:r=[],maxListColumns:n=5}=t,o=Po(e.attributes,r),l={tabs:[{id:"all",label:"All",default:true,visibility:"workspace",layout:"table",columns:Fo(o.filter(p=>j(p).presentation.defaultColumn)).slice(0,n).map(p=>p.name)}]};return {name:"default",label:"All Records",object:e.name,type:"list",config:l,default:true}}a(Ln,"generateDefaultListView");function ol(e,t){let{preserveCustomTabs:r=true,preserveTableTabs:n=true}=t,o=[];for(let a of e.config.tabs)r&&a.type==="custom"&&o.push(a),n&&a.type==="table"&&o.push(a);return o}a(ol,"getPreservedDetailTabs");function al(e,t){if(t.length===0)return e;let r=e.find(s=>s.type==="form"),n=e.filter(s=>s.type!=="form"),o=[];r&&o.push(r);let a=1;for(let s of t)o.push({...s,order:a++});for(let s of n)o.push({...s,order:a++});return o}a(al,"mergeDetailTabs");function sl(e,t,r){let{preserveMetadata:n=true,...o}=r,a=Mn(t,o),s=ol(e,r),l=al(a.config.tabs,s),p={...a.config,tabs:l},I={...a,config:p};return n&&(I.id=e.id,I.name=e.name,I.label=e.label,I.description=e.description,I.icon=e.icon),I}a(sl,"resetDetailViewToDefault");function ul(e,t,r){let{preserveMetadata:n=true,...o}=r,s={...Ln(t,o)};return n&&(s.id=e.id,s.name=e.name,s.label=e.label,s.description=e.description,s.icon=e.icon),s}a(ul,"resetListViewToDefault");function ll(e,t,r={}){if(Je(e))return sl(e,t,r);if(to(e))return ul(e,t,r);throw new Error(`Reset not supported for view type: ${e.type}`)}a(ll,"resetViewToDefault");function ew(e,t){if(t){let r=e.tabs.find(n=>n.id===t);if(r)return r}return e.tabs.find(r=>r.default)??e.tabs[0]}a(ew,"getActiveTab");function Bn(e){return structuredClone(e)}a(Bn,"cloneFormDefinition");var Un=class Un{constructor(){this.forms=new Map;}register(t){let r$1=Array.isArray(t)?t:[t];for(let n of r$1){if(this.forms.has(n.name))throw new r("form",n.name,`[FormRegistry] Duplicate form: "${n.name}"`);this.forms.set(n.name,Bn(n));}return this}get(t){let r=this.forms.get(t);return r?Bn(r):void 0}getAll(){return Array.from(this.forms.values(),Bn)}listNames(){return Array.from(this.forms.keys())}};a(Un,"FormRegistry");var Pe=Un;var Vo=new Pe;function cw(e,t){return `${e}:${t}`}a(cw,"formatAgentStreamFrameId");function pw(e){let t=e.lastIndexOf(":");if(t<=0)return null;let r=e.slice(0,t),n=Number(e.slice(t+1));return !Number.isInteger(n)||n<=0?null:{streamId:r,sequence:n}}a(pw,"parseAgentStreamFrameId");var bw=204800,gw=256;function qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(qn,"isRecord");function zn(e,t){let r=Object.keys(e);return r.length===t.length&&r.every(n=>t.includes(n))}a(zn,"hasExactKeys");function $n(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}a($n,"isPositiveInteger");function jo(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}a(jo,"isNonNegativeInteger");function dl(e){return qn(e)&&zn(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&jo(e.startOffset)&&jo(e.endOffset)&&e.endOffset>=e.startOffset:false}a(dl,"isContentRange");function cl(e){if(!qn(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return zn(e,t)&&$n(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||dl(e.content))}a(cl,"isBatchItem");function pl(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}a(pl,"encodedSize");function yw(e){if(!(qn(e)&&zn(e,["schemaVersion","batchId","tenantId","sessionId","streamId","sequenceStart","sequenceEnd","items"]))||e.schemaVersion!==1||typeof e.batchId!="string"||e.batchId.trim()===""||typeof e.tenantId!="string"||e.tenantId.trim()===""||typeof e.sessionId!="string"||e.sessionId.trim()===""||typeof e.streamId!="string"||e.streamId.trim()===""||!$n(e.sequenceStart)||!$n(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(cl))return false;let t=0;for(let n of e.items){if(n.sequence<=t)return false;t=n.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let r=pl(e);return r!==void 0&&r<=204800}a(yw,"isAgentUIMessageBatch");function Tw(e){switch(e.kind){case "workspace":return `workspace:${encodeURIComponent(e.tenantId)}`;case "object":return `object:${encodeURIComponent(e.objectId)}`;case "record":return `record:${encodeURIComponent(e.objectId)}:${encodeURIComponent(e.recordId)}`;case "view":return `view:${encodeURIComponent(e.viewId)}`;case "user":return `user:${encodeURIComponent(e.actorId)}`;case "conversation":return `conversation:${encodeURIComponent(e.sessionId)}`;case "architect-draft":return `architect-draft:${encodeURIComponent(e.actorId)}`}}a(Tw,"liveChannelKey");function te(e){try{return decodeURIComponent(e)}catch{return null}}a(te,"decodeLiveChannelPart");function Mo(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"workspace",tenantId:r}:null}if(t[0]==="object"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"object",objectId:r}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let r=te(t[1]),n=te(t[2]);return r&&n?{kind:"record",objectId:r,recordId:n}:null}if(t[0]==="view"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"view",viewId:r}:null}if(t[0]==="user"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"user",actorId:r}:null}if(t[0]==="architect-draft"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"architect-draft",actorId:r}:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"conversation",sessionId:r}:null}return null}a(Mo,"parseLiveChannelKey");var ml={"record.patch":true,"record.deleted":true,"record.removed":true,"record.created":true,"view.projection.stale":true,"agent.session.patch":true,"notification.created":true,"notification.recipient.patch":true,"notification.count.patch":true,"notification.inbox.archived":true,"reflex.state.changed":true,"reflex.run.completed":true,"reflex.authoring.progress":true,"architect.draft.updated":true,"meeting.recording.patch":true,"wallet.state":true,"channel.revoked":true},fl=Object.keys(ml),bl=["membership-unknown","sort-unknown","permissions-changed"],gl=["permission-revoked","workspace-left","object-deleted"],yl=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],hl=["type","objectId","recordId","recordVersion"],Al=["type","objectId","recordId","recordVersion","record"],Tl=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],wl=["type","targetActorId","archivedCount","version","updatedAt"];function xl(e){return typeof e=="string"&&fl.includes(e)}a(xl,"isLiveEventType");function Sw(e){return C(e)&&xl(e.type)?Il(e.type,e):false}a(Sw,"isLiveEventPayload");function Il(e,t){if(!C(t))return false;switch(e){case "record.patch":return Nl(t);case "record.deleted":return Ol(t);case "record.removed":return kl(t);case "record.created":return Pl(t);case "view.projection.stale":return Fl(t);case "agent.session.patch":return Vl(t);case "notification.created":return Bl(t);case "notification.recipient.patch":return Ul(t);case "notification.count.patch":return $l(t);case "notification.inbox.archived":return ql(t);case "reflex.state.changed":return Hl(t);case "reflex.run.completed":return Ql(t);case "reflex.authoring.progress":return Jl(t);case "architect.draft.updated":return Yl(t);case "meeting.recording.patch":return Zl(t);case "wallet.state":return rd(t);case "channel.revoked":return nd(t);default:return false}}a(Il,"isLiveEventPayloadForType");function C(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(C,"isRecord");function F(e){return typeof e=="string"}a(F,"isString");function Lo(e){return F(e)&&e.length>0}a(Lo,"isNonEmptyString");function ht(e){return e===null||F(e)}a(ht,"isNullableString");function Sl(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}a(Sl,"isVersion");function K(e){if(!F(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}a(K,"isIsoDateString");function xe(e){return e===null||K(e)}a(xe,"isNullableIsoDateString");function x(e,t){return F(e[t])}a(x,"hasString");function re(e,t){return Lo(e[t])}a(re,"hasNonEmptyString");function N(e,t){return Sl(e[t])}a(N,"hasVersion");function k(e,t){return K(e[t])}a(k,"hasIsoDateString");function w(e,t,r){return !Object.hasOwn(e,t)||r(e[t])}a(w,"hasOptional");function At(e,t){return Object.keys(e).every(r=>t.includes(r))}a(At,"hasOnlyKeys");function _(e,t){return typeof e=="string"&&t.includes(e)}a(_,"isOneOf");function vl(e){return _(e,ji)}a(vl,"isNotificationKind");function Rl(e){return _(e,Mi)}a(Rl,"isNotificationPriority");function El(e){return _(e,Li)}a(El,"isNotificationSensitivity");function Bo(e){return _(e,Bi)}a(Bo,"isNotificationInboxState");function Uo(e){return _(e,Ui)}a(Uo,"isNotificationWorkState");function Dl(e){return C(e)&&x(e,"type")&&x(e,"id")}a(Dl,"isNotificationSubject");function Cl(e){return C(e)&&x(e,"fieldKey")&&Object.hasOwn(e,"value")&&N(e,"version")}a(Cl,"isRecordFieldPatch");function Nl(e){return e.type==="record.patch"&&x(e,"objectId")&&x(e,"recordId")&&N(e,"recordVersion")&&w(e,"label",F)&&w(e,"metadata",C)&&w(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(Cl)&&x(e,"updatedAt")}a(Nl,"isRecordPatchPayload");function Ol(e){return e.type==="record.deleted"&&x(e,"objectId")&&x(e,"recordId")&&N(e,"recordVersion")&&x(e,"deletedAt")}a(Ol,"isRecordDeletedPayload");function kl(e){return e.type==="record.removed"&&At(e,hl)&&x(e,"objectId")&&x(e,"recordId")&&N(e,"recordVersion")}a(kl,"isRecordRemovedPayload");function _l(e){return C(e)&&At(e,Tl)&&x(e,"id")&&x(e,"objectId")&&_(e.visibility,["workspace","private"])&&ht(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&Lo(e.ownedBy))&&x(e,"label")&&C(e.values)&&w(e,"metadata",C)&&k(e,"createdAt")&&k(e,"updatedAt")&&w(e,"createdBy",F)&&w(e,"lastUpdatedBy",F)&&N(e,"schemaVersion")}a(_l,"isRecordLiveSnapshot");function Pl(e){return e.type==="record.created"&&At(e,Al)&&x(e,"objectId")&&x(e,"recordId")&&N(e,"recordVersion")&&_l(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}a(Pl,"isRecordCreatedPayload");function Fl(e){return e.type==="view.projection.stale"&&x(e,"viewId")&&_(e.reason,bl)}a(Fl,"isViewProjectionStalePayload");function Vl(e){return e.type==="agent.session.patch"&&x(e,"sessionId")&&C(e.patch)&&N(e,"version")&&x(e,"updatedAt")}a(Vl,"isAgentSessionPatchPayload");function jl(e){return C(e)&&x(e,"id")&&x(e,"tenantId")&&w(e,"senderActorId",F)&&w(e,"rootActorId",F)&&w(e,"triggeredByActorId",F)&&vl(e.kind)&&x(e,"type")&&w(e,"subject",Dl)&&x(e,"title")&&w(e,"summary",F)&&C(e.payload)&&Rl(e.priority)&&El(e.sensitivity)&&w(e,"threadKey",F)&&w(e,"idempotencyKey",F)&&w(e,"expiresAt",K)&&k(e,"createdAt")&&k(e,"updatedAt")}a(jl,"isLiveNotification");function Ml(e){return C(e)&&x(e,"id")&&x(e,"tenantId")&&x(e,"notificationId")&&x(e,"recipientActorId")&&Bo(e.inboxState)&&Uo(e.workState)&&w(e,"lockedAt",K)&&w(e,"lockedByActorId",F)&&w(e,"readAt",K)&&w(e,"archivedAt",K)&&w(e,"snoozedUntil",K)&&w(e,"completedAt",K)&&w(e,"dismissedAt",K)&&k(e,"createdAt")&&k(e,"updatedAt")}a(Ml,"isLiveNotificationRecipient");function Ll(e){return C(e)?Object.keys(e).every(t=>yl.includes(t))&&w(e,"inboxState",Bo)&&w(e,"workState",Uo)&&w(e,"lockedAt",xe)&&w(e,"lockedByActorId",ht)&&w(e,"readAt",xe)&&w(e,"archivedAt",xe)&&w(e,"snoozedUntil",xe)&&w(e,"completedAt",xe)&&w(e,"dismissedAt",xe)&&w(e,"updatedAt",K):false}a(Ll,"isNotificationRecipientPatch");function Bl(e){let t=jl(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(r=>Ml(r)&&r.notificationId===t.id)&&N(e,"version")&&k(e,"updatedAt")}a(Bl,"isNotificationCreatedPayload");function Ul(e){return e.type==="notification.recipient.patch"&&x(e,"recipientId")&&x(e,"recipientActorId")&&Ll(e.patch)&&N(e,"version")&&k(e,"updatedAt")}a(Ul,"isNotificationRecipientPatchPayload");function $l(e){return e.type==="notification.count.patch"&&x(e,"targetActorId")&&N(e,"unread")&&N(e,"pendingWork")&&N(e,"version")&&k(e,"updatedAt")}a($l,"isNotificationCountPatchPayload");function ql(e){return e.type==="notification.inbox.archived"&&At(e,wl)&&re(e,"targetActorId")&&N(e,"archivedCount")&&N(e,"version")&&k(e,"updatedAt")}a(ql,"isNotificationInboxArchivedPayload");var zl=["armed","disarmed"],Gl=["authoring","compiling","replaying","promoted","failed"],Wl=["promoted","lkg"],Kl=["composing","published","discarded"];function Yl(e){if(e.type!=="architect.draft.updated"||!C(e.draft))return false;let t=e.draft;return re(t,"id")&&re(t,"actorId")&&ht(t.agentSessionId)&&Array.isArray(t.operations)&&t.operations.every(C)&&C(t.baselines)&&_(t.status,Kl)}a(Yl,"isArchitectDraftUpdatedPayload");function Hl(e){return e.type==="reflex.state.changed"&&re(e,"reflexId")&&_(e.state,zl)&&k(e,"updatedAt")}a(Hl,"isReflexStateChangedPayload");function Ql(e){return e.type==="reflex.run.completed"&&re(e,"reflexId")&&re(e,"runId")&&_(e.served,Wl)&&N(e,"version")&&N(e,"wallMs")&&k(e,"completedAt")}a(Ql,"isReflexRunCompletedPayload");function Jl(e){return e.type==="reflex.authoring.progress"&&re(e,"reflexId")&&_(e.status,Gl)&&k(e,"updatedAt")}a(Jl,"isReflexAuthoringProgressPayload");var Xl=["none","scheduled","recording","completed","failed"];function Zl(e){return e.type==="meeting.recording.patch"&&re(e,"meetingId")&&_(e.status,Xl)&&ht(e.failureReason)&&k(e,"updatedAt")}a(Zl,"isMeetingRecordingPatchPayload");var ed=["ok","low","exhausted","paused"],td=["metering-only","contract","wallet"];function rd(e){return e.type==="wallet.state"&&_(e.status,ed)&&_(e.mode,td)&&k(e,"updatedAt")}a(rd,"isWalletStatePayload");function nd(e){return e.type==="channel.revoked"&&x(e,"channel")&&_(e.reason,gl)}a(nd,"isChannelRevokedPayload");function Gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(Gn,"isRecord");function id(e){let{channel:t}=e;return typeof t=="string"&&Mo(t)?t:null}a(id,"payloadChannel");function Dw(e){return Gn(e)?id(e):null}a(Dw,"getLiveProtocolPayloadChannel");function Cw(e){return Gn(e)?typeof e.id=="string"&&e.id.length>0&&typeof e.channel=="string"&&typeof e.type=="string"&&typeof e.tenantId=="string"&&e.tenantId.length>0&&typeof e.occurredAt=="string"&&Gn(e.payload):false}a(Cw,"isLiveEventEnvelope");var kw=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],Fe={if:{name:"if",returnType:"branch",minArgs:3,maxArgs:3},concat:{name:"concat",returnType:{kind:"scalar",type:"text"},minArgs:1},sum:{name:"sum",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},avg:{name:"avg",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count:{name:"count",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},min:{name:"min",returnType:"source_item",minArgs:1,maxArgs:1},max:{name:"max",returnType:"source_item",minArgs:1,maxArgs:1},earliest:{name:"earliest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},latest:{name:"latest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},unique:{name:"unique",returnType:"argument",minArgs:1,maxArgs:1},first:{name:"first",returnType:"source_item",minArgs:1,maxArgs:1},percent_empty:{name:"percent_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},percent_not_empty:{name:"percent_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_empty:{name:"count_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_not_empty:{name:"count_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_unique:{name:"count_unique",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1}};function Tt(e){return Object.hasOwn(Fe,e)}a(Tt,"isComputedFunctionName");var Hn=class Hn extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};a(Hn,"ComputedFormulaCompileError");var b=Hn;function Ko(e){let t=od(e.expression),r=wt(t,e.schema),n=Ed(r.valueType);if(n!==e.returnType)throw new b(`Computed formula "${e.attributeName}" returns "${n}", expected "${e.returnType}"`);if(Yo(e.returnType)&&r.optionsSource===void 0)throw new b(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=r.optionsSource===void 0?[]:[{kind:"options",source:r.optionsSource}],a=Yn([...r.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:r.valueType,dependencies:a,ast:t,...r.optionsSource?{optionsSource:r.optionsSource}:{},...r.targetAttributeType?{targetAttributeType:r.targetAttributeType}:{},dependenciesHash:Dd({expression:e.expression,returnType:e.returnType,dependencies:a})}}a(Ko,"compileComputedFormula");function jw(e){let t=new Map(e.map(o=>[o.attributeName,o])),r=new Set,n=a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let I=[...a.slice(s),o];throw new b(`Computed field cycle detected: ${I.join(" -> ")}`)}if(r.has(o))return;let l=t.get(o);if(l===void 0)return;let p=[...a,o];for(let I of l.dependencies)I.kind==="computed"&&n(I.attributeName,p);r.add(o);},"visit");for(let o of e)n(o.attributeName,[]);}a(jw,"assertAcyclicComputedDependencies");function od(e){try{return e$1(e)}catch(t){throw t instanceof Error?new b(t.message):t}}a(od,"parseCompileFormula");function wt(e,t){switch(e.kind){case "literal":return {valueType:ad(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return sd(e.parts,t);case "call":return md(e.functionName,e.args,t);case "binary":return hd(e.operator,wt(e.left,t),wt(e.right,t));default:return e}}a(wt,"inferNode");function ad(e){switch(typeof e){case "string":return {kind:"scalar",type:"text"};case "number":return {kind:"scalar",type:"number"};case "boolean":return {kind:"scalar",type:"boolean"};case "object":return {kind:"scalar",type:"text"};default:return e}}a(ad,"literalToValueType");function sd(e,t){if(e.length===1){let r=e[0],n=Wn(t,r);if(n===void 0)throw new b(`Unknown attribute "${r}" on object "${t.objectName}"`);return n.type==="relation"?{valueType:dd(),dependencies:[{kind:"relation",relationName:n.name,cardinality:$o(n)}],targetAttributeType:n.type}:{valueType:qo(n),dependencies:[ld(n)],optionsSource:zo(t.objectName,n),targetAttributeType:n.type}}if(e.length===2){let[r,n]=e,o=Wn(t,r);if(o===void 0)throw new b(`Unknown attribute "${r}" on object "${t.objectName}"`);if(o.type!=="relation")throw new b(`Attribute "${r}" on object "${t.objectName}" is not a relation`);let a=ud(o);if(a===void 0)throw new b(`Relation "${r}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new b(`Unknown related object "${a}"`);let l=Wn(s,n);if(l===void 0)throw new b(`Unknown attribute "${n}" on object "${s.objectName}"`);let p=qo(l);return {valueType:o.cardinality==="many"?pd(p):p,dependencies:[{kind:"relation",relationName:r,targetAttributeName:n,cardinality:$o(o)}],optionsSource:zo(s.objectName,l),targetAttributeType:l.type}}throw new b("Computed paths support at most one relation hop")}a(sd,"inferPath");function Wn(e,t){return e.attributes.find(r=>r.name===t)}a(Wn,"findAttribute");function ud(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}a(ud,"getRelationTargetObjectName");function $o(e){return e.cardinality??"one"}a($o,"relationCardinality");function ld(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}a(ld,"localDependencyFor");function qo(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new b(`Computed attribute "${e.name}" is missing returnType`);return cd(e.returnType)}switch(e.type){case "number":case "currency":return {kind:"scalar",type:"number"};case "checkbox":return {kind:"scalar",type:"boolean"};case "date":return {kind:"scalar",type:"date"};case "select":case "status":return {kind:"scalar",type:"select"};case "multiselect":return {kind:"collection",itemType:"select"};case "text":case "richtext":case "phone":case "user":case "location":case "relation":case "document":return {kind:"scalar",type:"text"};default:return e.type}}a(qo,"attributeToValueType");function dd(){return {kind:"collection",itemType:"text"}}a(dd,"relationToValueType");function cd(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}a(cd,"returnTypeToValueType");function pd(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}a(pd,"asCollectionValueType");function zo(e,t){if(t.type==="formula"||t.type==="rollup")return Yo(t.returnType)?t.optionsSource:void 0;if(!(t.type!=="select"&&t.type!=="status"&&t.type!=="multiselect"))return t.optionsSource??{objectName:e,attributeName:t.name,...t.id?{attributeId:t.id}:{}}}a(zo,"optionsSourceForAttribute");function md(e,t,r){if(!Tt(e))throw new b(`Unknown computed function "${e}"`);let n=Fe[e];if(t.length<n.minArgs||n.maxArgs!==void 0&&t.length>n.maxArgs){let a=n.maxArgs===void 0||n.maxArgs===n.minArgs?String(n.minArgs):`${n.minArgs}-${n.maxArgs}`;throw new b(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>wt(a,r));return fd(e,o)}a(md,"inferCall");function fd(e,t){let r=Yn(t.flatMap(n=>n.dependencies));switch(e){case "if":return bd(t,r);case "concat":return Ad(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:r};case "sum":case "avg":return Go(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return wd(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "min":case "max":return Td(e,t[0]),{valueType:xd(t[0]),dependencies:r,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return Go(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:r,targetAttributeType:t[0].targetAttributeType};case "unique":return gd(t[0],r);case "first":return yd(t[0],r);default:return e}}a(fd,"inferFunctionReturn");function bd(e,t){Kn(e[0].valueType,"boolean",'Function "if" condition must be boolean');let r=e[1],n=e[2],o=Sd(r,n),a=vd(r,n);if(o===void 0)throw new b('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:r.targetAttributeType??n.targetAttributeType}}a(bd,"inferIfFunction");function gd(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new b('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}a(gd,"inferUniqueFunction");function yd(e,t){if(e.valueType.kind!=="collection")throw new b('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}a(yd,"inferFirstFunction");function hd(e,t,r){let n=Yn([...t.dependencies,...r.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||r.valueType.kind==="collection")throw new b(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||r.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:n}:(Kn(t.valueType,"number",`Operator "${e}" expects number operands`),Kn(r.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:n});if(e==="=="||e==="!="){if(t.valueType.type!==r.valueType.type)throw new b(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}if((t.valueType.type!=="number"||r.valueType.type!=="number")&&(t.valueType.type!=="date"||r.valueType.type!=="date"))throw new b(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}a(hd,"inferBinary");function Ad(e,t){for(let r of e)if(r.valueType.kind==="collection")throw new b(t)}a(Ad,"ensureNoCollections");function Go(e,t,r){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==r)throw new b(`Function "${e}" expects ${r} values`)}a(Go,"ensureCollectionOrScalarType");function Td(e,t){if(t.valueType.kind!=="collection")throw new b(`Function "${e}" expects a collection`);let r=t.valueType.itemType;if(r!=="number"&&r!=="date")throw new b(`Function "${e}" expects number or date values`)}a(Td,"ensureMinMaxSource");function wd(e,t){if(t.valueType.kind!=="collection")throw new b(`Function "${e}" expects a collection`)}a(wd,"ensureCollectionSource");function Kn(e,t,r){if(e.kind!=="scalar"||e.type!==t)throw new b(r)}a(Kn,"ensureScalarType");function xd(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}a(xd,"sourceItemValueType");function Id(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}a(Id,"sameValueType");function Sd(e,t){if(Id(e.valueType,t.valueType)||Wo(e,t))return e.valueType;if(Wo(t,e))return t.valueType}a(Sd,"resolveIfBranchValueType");function Wo(e,t){return e.valueType.kind==="scalar"&&e.valueType.type==="select"&&t.valueType.kind==="scalar"&&t.valueType.type==="text"&&t.literalString!==void 0}a(Wo,"isSelectScalarWithStringLiteral");function vd(e,t){let r=e.optionsSource,n=t.optionsSource;if(r!==void 0&&n!==void 0&&!Rd(r,n))throw new b('Function "if" branches use incompatible options sources');return r??n}a(vd,"resolveIfOptionsSource");function Rd(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}a(Rd,"sameOptionsSource");function Yo(e){return e==="select"||e==="multiselect"}a(Yo,"isSelectLikeReturnType");function Ed(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new b(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}a(Ed,"valueTypeToReturnType");function Yn(e){let t=new Set,r=[];for(let n of e){let o=JSON.stringify(Ve(n));t.has(o)||(t.add(o),r.push(n));}return r}a(Yn,"uniqueDependencies");function Dd(e){let t=e.dependencies.map(r=>Ve(r)).sort((r,n)=>Ho(JSON.stringify(r),JSON.stringify(n)));return JSON.stringify(Ve({expression:e.expression,returnType:e.returnType,dependencies:t}))}a(Dd,"createDependenciesHash");function Ve(e){return Array.isArray(e)?e.map(t=>Ve(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>Ho(t,r)).map(([t,r])=>[t,Ve(r)])):e}a(Ve,"stableNormalize");function Ho(e,t){return e<t?-1:e>t?1:0}a(Ho,"compareStrings");function Cd(e){return e.function==="count"?`count(${e.relationAttribute})`:`${kd(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}a(Cd,"rollupToFormulaExpression");function Nd(e,t){if(e.function==="count")return "number";let r=_d(e,t);switch(e.function){case "countValues":case "countEmpty":case "percentEmpty":case "percentNotEmpty":case "countUniqueValues":return "number";case "sum":case "avg":return "number";case "earliest":case "latest":return "date";case "original":if(!Fd(r.type))throw new b('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}a(Nd,"inferRollupReturnType");function Uw(e,t){let r=Cd(e),n=Nd(e,t);return {...Ko({attributeName:e.name,expression:r,returnType:n,schema:Od(e,t)}),kind:"rollup"}}a(Uw,"compileRollupAttribute");function Od(e,t){return {...t,attributes:t.attributes.map(r=>r.name===e.relationAttribute&&r.type==="relation"?{...r,cardinality:"many"}:r)}}a(Od,"schemaWithRollupRelationAsMany");function kd(e){switch(e){case "sum":case "avg":case "earliest":case "latest":return e;case "original":return "unique";case "countValues":return "count_not_empty";case "countEmpty":return "count_empty";case "percentEmpty":return "percent_empty";case "percentNotEmpty":return "percent_not_empty";case "countUniqueValues":return "count_unique";default:return e}}a(kd,"rollupFunctionToFormulaFunction");function _d(e,t){let r=Qo(t,e.relationAttribute);if(r===void 0)throw new b(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(r.type!=="relation")throw new b(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let n=Pd(r);if(n===void 0)throw new b(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[n];if(o===void 0)throw new b(`Unknown related object "${n}"`);let a=Qo(o,e.targetAttribute);if(a===void 0)throw new b(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}a(_d,"findRollupTargetAttribute");function Qo(e,t){return e.attributes.find(r=>r.name===t)}a(Qo,"findAttribute");function Pd(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}a(Pd,"getRelationTargetObjectName");function Fd(e){return e==="select"||e==="status"||e==="multiselect"}a(Fd,"isSelectLikeAttributeType");function X(e,t){switch(e.kind){case "literal":return e.value;case "path":return jd(t,e.parts);case "binary":return Md(e.operator,X(e.left,t),X(e.right,t));case "call":return Vd(e.functionName,e.args,t);default:return e}}a(X,"evaluateAst");function Vd(e,t,r){if(Bd(e),Ud(e,t.length),e==="if"){let n=X(t[0],r);return n===null?null:X(n?t[1]:t[2],r)}return $d(e,t.map(n=>X(n,r)))}a(Vd,"evaluateCallNode");function jd(e,t){return t.reduce((r,n)=>ra(r,n),e)}a(jd,"resolvePath");function ra(e,t){if(Array.isArray(e))return e.map(n=>ra(n,t));if(!ta(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let r=e.values;return ta(r)&&Object.hasOwn(r,t)?r[t]??null:null}a(ra,"resolvePathPart");function Md(e,t,r){switch(e){case "+":return Ld(t,r);case "-":return It(t,r,(n,o)=>n-o);case "*":return It(t,r,(n,o)=>n*o);case "/":return It(t,r,(n,o)=>n/o);case ">":return xt(t,r,n=>n>0);case "<":return xt(t,r,n=>n<0);case ">=":return xt(t,r,n=>n>=0);case "<=":return xt(t,r,n=>n<=0);case "==":return Jo(t,r);case "!=":{let n=Jo(t,r);return n===null?null:!n}default:return e}}a(Md,"evaluateBinary");function Ld(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:It(e,t,(r,n)=>r+n)}a(Ld,"add");function xt(e,t,r){let n=na(e,t);return n===null?null:r(n)}a(xt,"compareWith");function na(e,t){if(!Ie([e,t]))return null;let r=Se(e),n=Se(t);if(r!==null&&n!==null)return r-n;let o=Xn(e),a=Xn(t);return o&&a?o.getTime()-a.getTime():null}a(na,"compare");function Jo(e,t){return e===t?true:e==null||t===null||t===void 0?false:Ie([e,t])?na(e,t)===0:null}a(Jo,"equalScalar");function Bd(e){if(!Tt(e))throw new Error(`Unknown computed function "${e}"`)}a(Bd,"assertComputedFunctionName");function Ud(e,t){let{minArgs:r,maxArgs:n}=Fe[e];if(t>=r&&t<=(n??Number.POSITIVE_INFINITY))return;let o=n===void 0?`at least ${r}`:`between ${r} and ${n}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}a(Ud,"validateArity");function $d(e,t){switch(e){case "concat":return t.filter(r=>r!=null).map(String).join("");case "sum":return Ie(t)?Qn(t).reduce((r,n)=>r+n,0):null;case "avg":{if(!Ie(t))return null;let r=Qn(t);return r.length>0?r.reduce((n,o)=>n+o,0)/r.length:null}case "count":return de(t[0]).length;case "min":return Xo(t,"min");case "max":return Xo(t,"max");case "earliest":return Jn(t,"min");case "latest":return Jn(t,"max");case "unique":return ea(de(t[0]));case "first":return de(t[0]).find(r=>r!=null)??null;case "percent_empty":return Zo(t[0],true);case "percent_not_empty":return Zo(t[0],false);case "count_empty":return de(t[0]).filter(a$1).length;case "count_not_empty":return de(t[0]).filter(r=>!a$1(r)).length;case "count_unique":return ea(de(t[0])).length;default:return e}}a($d,"evaluateCall");function Qn(e){return St(e).map(Se).filter(t=>t!==null)}a(Qn,"numericValues");function Ie(e){let t=new Set;for(let r of St(e))Zn(r)&&t.add(ia(r));return t.size<=1}a(Ie,"areCommensurable");function ia(e){return e.code.toUpperCase()}a(ia,"currencyCode");function It(e,t,r){if(!Ie([e,t]))return null;let n=Se(e),o=Se(t);if(n===null||o===null)return null;let a=r(n,o);return Number.isFinite(a)?a:null}a(It,"numericBinary");function Xo(e,t){if(!Ie(e))return null;let r=Qn(e);return r.length>0?t==="min"?Math.min(...r):Math.max(...r):Jn(e,t)}a(Xo,"minMax");function Jn(e,t){let r=St(e).map(Xn).filter(a=>a!==null);if(r.length===0)return null;let n=r.map(a=>a.getTime()),o=t==="min"?Math.min(...n):Math.max(...n);return new Date(o).toISOString()}a(Jn,"dateMinMax");function Zo(e,t){let r=de(e);return r.length===0?0:r.filter(o=>a$1(o)===t).length/r.length}a(Zo,"percentByEmptyState");function ea(e){let t=new Set,r=[];for(let n of e){if(a$1(n))continue;let o=qd(n);t.has(o)||(t.add(o),r.push(n));}return r}a(ea,"uniqueNonEmpty");function de(e){return e==null?[]:Array.isArray(e)?St(e):[e]}a(de,"collectionItems");function St(e){return e.flat(Number.POSITIVE_INFINITY)}a(St,"flatten");function Se(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 Zn(e)&&Number.isFinite(e.value)?e.value:null}a(Se,"toFiniteNumber");function Zn(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}a(Zn,"isCurrencyValue");function Xn(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let r=be(e);if(r===null)return null;let n=new Date(r);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}a(Xn,"toDate");function qd(e){if(Zn(e))return `currency:${ia(e)}:${e.value}`;let t=Se(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}a(qd,"uniqueKey");function ta(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(ta,"isPlainRecord");function zd(e,t,r){if(e==null)return null;let n=a(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"||o instanceof Date?String(o):null,"stringifyScalar");switch(t){case "number":{let o=typeof e=="number"?e:Number(e);return Number.isNaN(o)?null:r!==void 0?Number(o.toFixed(r)):o}case "boolean":return !!e;case "date":return e instanceof Date?e.toISOString():typeof e=="string"?e:null;case "text":return String(e);case "select":if(Array.isArray(e)){for(let o of e){if(o==null)continue;let a=n(o);if(a!==null)return a}return null}return n(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=n(o);return a===null?[]:[a]}):n(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}a(zd,"formatComputedResult");function Yw(e,t){return X(e,t)}a(Yw,"evaluateComputedAst");function Hw(e,t){return X(e$1(e),t)}a(Hw,"evaluateComputedFormula");function Qw(e,t,r,n){try{let o=X(e$1(e),t);return {value:r?zd(o,r,n):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}a(Qw,"evaluateComputedFormulaWithResult");var Zw=[{name:"if",signature:"if(condition, then, else)",description:"Conditional value",category:"logic",example:"if(amount > 100, 'big', 'small')"},{name:"concat",signature:"concat(a, b, ...)",description:"Join values into text",category:"text",example:"concat(firstName, ' ', lastName)"},{name:"sum",signature:"sum(collection)",description:"Total of values",category:"number",example:"sum(orders.amount)"},{name:"avg",signature:"avg(collection)",description:"Average of values",category:"number",example:"avg(orders.amount)"},{name:"min",signature:"min(collection)",description:"Smallest value",category:"number",example:"min(orders.amount)"},{name:"max",signature:"max(collection)",description:"Largest value",category:"number",example:"max(orders.amount)"},{name:"count",signature:"count(collection)",description:"Number of items",category:"collection",example:"count(orders)"},{name:"count_empty",signature:"count_empty(collection)",description:"Items with no value",category:"collection",example:"count_empty(orders.note)"},{name:"count_not_empty",signature:"count_not_empty(collection)",description:"Items with a value",category:"collection",example:"count_not_empty(orders.note)"},{name:"count_unique",signature:"count_unique(collection)",description:"Distinct values",category:"collection",example:"count_unique(orders.status)"},{name:"percent_empty",signature:"percent_empty(collection)",description:"Fraction with no value",category:"collection",example:"percent_empty(orders.note)"},{name:"percent_not_empty",signature:"percent_not_empty(collection)",description:"Fraction with a value",category:"collection",example:"percent_not_empty(orders.note)"},{name:"unique",signature:"unique(collection)",description:"Distinct values as a list",category:"collection",example:"unique(orders.status)"},{name:"first",signature:"first(collection)",description:"First non-empty value",category:"collection",example:"first(orders.status)"},{name:"earliest",signature:"earliest(collection)",description:"Earliest date",category:"date",example:"earliest(orders.closeDate)"},{name:"latest",signature:"latest(collection)",description:"Latest date",category:"date",example:"latest(orders.closeDate)"}];var oa=a(e=>a$1(e)||Array.isArray(e)&&e.length===0,"isEmpty"),V=a(e=>e==null?"":String(e),"toStr"),Et=a(e=>{if(a$1(e))return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},"toNum"),Dt=a(e=>{if(e==null)return null;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t},"toDate"),vt=a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),Gd=a((e,t,r)=>{let n=Et(e),o=Et(t);return n!==null&&o!==null&&r(n,o)},"compareNumbers"),Wd=a((e,t,r)=>{let n=Dt(e),o=Dt(t);return n!==null&&o!==null&&r(n.getTime(),o.getTime())},"compareDates"),aa=a((e,t,r)=>{if(r.type==="number"||r.type==="currency"){let n=Et(e),o=Et(t);if(n!==null&&o!==null)return n===o}return V(e)===V(t)},"equalsForAttr");function nx(e,t){return e?e==="checkbox":typeof t=="boolean"}a(nx,"isCheckboxEquality");var Rt=a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:a((t,r,n)=>n.type==="date"?Wd(t,r,e):Gd(t,r,e),"evaluateInMemory")}),"orderingSpec"),Ct={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:a((e,t,r)=>r.type==="checkbox"?e===true==(t===true):aa(e,t,r),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:a((e,t,r)=>!aa(e,t,r),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().includes(V(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:a((e,t)=>!V(e).toLowerCase().includes(V(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().startsWith(V(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().endsWith(V(t).toLowerCase()),"evaluateInMemory")},is_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:a(e=>oa(e),"evaluateInMemory")},is_not_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:a(e=>!oa(e),"evaluateInMemory")},less_than:Rt((e,t)=>e<t),greater_than:Rt((e,t)=>e>t),less_or_equal:Rt((e,t)=>e<=t),greater_or_equal:Rt((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:a((e,t)=>{let r=Dt(e),n=S$1(t);return r&&n?r.getTime()>=n.startMs&&r.getTime()<n.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:a((e,t)=>{let r=Dt(e);if(!r)return false;let n=t;return r.getMonth()+1===n.month&&r.getDate()===n.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:a((e,t)=>{let r=vt(t).map(V);return vt(e).map(V).some(o=>r.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:a((e,t)=>{let r=vt(t).map(V);return !vt(e).map(V).some(o=>r.includes(o))},"evaluateInMemory")}};var Kd=a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),Yd=[...Object.entries(V$1).map(([e,t])=>Kd(e,t))];function fx(e,t,r){let n=t;return Hd(e,{...t.values,id:t.id,objectId:t.objectId,objectName:n.objectName,tenantId:n.tenantId,label:t.label,createdAt:t.createdAt,updatedAt:t.updatedAt,createdBy:t.createdBy,lastUpdatedBy:t.lastUpdatedBy,deletedAt:t.deletedAt,deletedBy:t.deletedBy,visibility:t.visibility,ownedBy:t.ownedBy},[...r,...Yd])}a(fx,"evaluateRecordFilterState");function Hd(e,t,r){if(e.rules.length===0)return true;let n=new Map(r.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>Qd(a,t,n))}a(Hd,"evaluateFilterState");function Qd(e,t,r){let n=r.get(e.attribute);if(!n)return false;if(e.property&&n.type==="location"){if(!(g(e.property)&&h$1(e.operator)))return false;let l=Ct[e.operator];if(!l)return false;let p=t[e.attribute],I=typeof p=="object"&&p!==null?p[e.property]:void 0;return ei(l,"text",e.operator,I,e.value,n)}if(e.property){let l=eo(n).find(j=>j.name===e.property);if(!l)return false;let p=K$1(e.operator),I=Ct[p];if(!I?.appliesTo.includes(l.type))return false;let Z=t[e.attribute],ae=(Array.isArray(Z)?Z:Z==null?[]:[Z]).some(j=>{if(typeof j!="object"||j===null)return false;let H=j.props;return typeof H!="object"||H===null?false:ei(I,l.type,p,H[e.property],e.value,l)});return (e.quantifier??J$1(e.operator))==="none"?!ae:ae}let o=Ct[e.operator];if(!o||!o.appliesTo.includes(n.type))return false;let a=t[e.attribute],s=n.type==="relation"||n.type==="document"||n.type==="user"?Zd(a):a;return ei(o,n.type,e.operator,s,e.value,n)}a(Qd,"evaluateRule");function ei(e,t,r,n,o,a){let[s,l]=Jd(t,r,n,o);return t==="phone"&&l===""&&r==="contains"?false:t==="phone"&&l===""&&r==="not_contains"?true:e.evaluateInMemory(s,l,a)}a(ei,"evaluateNormalizedComparands");function Jd(e,t,r,n){return e==="date"&&(t==="is"||t==="is_not")?[sa(r),sa(n)]:e==="phone"?Xd(r,n):[ua(e,r),ua(e,n)]}a(Jd,"normalizeOperatorComparands");function sa(e){let t=ee(e)?be(e):e;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t.toISOString().slice(0,10);if(typeof t!="string"||t==="")return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString().slice(0,10)}a(sa,"normalizeUtcCalendarDay");function Xd(e,t){let r=typeof t=="object"&&t!==null?t:{},n=typeof r.countryCode=="string"?r.countryCode:void 0,o=a(a=>{let s=typeof a=="object"&&a!==null?a:{phoneNumber:a};if(typeof s.phoneNumber!="string")return null;if(!n)return a$3(s.phoneNumber);let l=typeof s.countryCode=="string"?s.countryCode:n;return `${l}:${b$2(s.phoneNumber,l)}`},"normalizeOne");return [o(e),o(t)]}a(Xd,"normalizePhoneComparands");function ua(e,t){return e==="currency"?H(t):e==="date"?ee(t)?be(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}a(ua,"normalizeComparableValue");function Zd(e){let t=a(r=>typeof r!="object"||r===null?r:r.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}a(Zd,"normalizeReferenceIds");var la="today";function Nt(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}a(Nt,"dateInTimezone");function ec(e,t){if(!("defaultValue"in e))return;let{defaultValue:r}=e;return e.type!=="date"||r!==la?r:e.includeTime?t.now.toISOString():Nt(t.now,t.timezone)}a(ec,"resolveAttributeDefaultValue");function xx(e,t,r){if(e.combinator==="or"&&e.rules.length>1)return {};let n=new Map(t.map(a=>[a.name,a])),o={};for(let a of e.rules){if(a.property!==void 0||Object.hasOwn(o,a.attribute))continue;let s=n.get(a.attribute);if(!s)continue;let l=tc(a,r);l!==void 0&&(o[a.attribute]=j(s).storage.cardinality==="many"?[l]:l);}return o}a(xx,"deriveCreateDefaultsFromFilters");function tc(e,t){if(e.operator==="is")return D(e.value)?da(e.value,t):e.value===null||Array.isArray(e.value)?void 0:e.value;if(e.operator==="any_of"){if(!Array.isArray(e.value)||e.value.length!==1)return;let r=e.value[0];return D(r)?da(r,t):r}}a(tc,"extractDeterministicValue");function da(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return Nt(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}a(da,"resolveDynamicValue");var vx={status:"connector_status",error:"connector_error",provider:"connector_provider"};var rc=(t=>(t.Desktop="desktop",t))(rc||{});var Dx=["force","skip"],Cx=["none","all","external_only"],Nx="x-fake-signature",Ox={override:null,status:"none",failureReason:null,botId:null};var nc=/^Session \d+$/;function ca(e){let t=e.replace(/\s+/g," ").trim().replace(/[.!?]+$/,"");return t?t.length>60?`${t.slice(0,59).trimEnd()}...`:t:"New conversation"}a(ca,"buildAgentFallbackTitle");function ic(e){let t=e.generated?.trim();return t&&!nc.test(t)?t:e.firstUserText?ca(e.firstUserText):e.emptyLabel}a(ic,"conversationDisplayTitle");var ti=/^[a-z0-9][a-z0-9-]{0,62}$/;function oc(e){if(!ti.test(e))throw new h(`Invalid schema source id "${e}": expected a lowercase slug matching ${ti}`,[])}a(oc,"assertSchemaSourceId");function ac(e){return {label:e.label,description:e.description??null,icon:e.icon??null,config:e.config,default:e.default??false,metadata:e.metadata??null}}a(ac,"viewSyncPayload");function Bx(e){let{attributeRemovals:t,objectRemovals:r,renames:n}=e.destructive;return t.length>0||r.length>0||n.length>0}a(Bx,"hasDestructiveEntries");var $={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function ni(e){return e instanceof Error?e.message:String(e)}a(ni,"errorMessage");var sc=z$1.enum(["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"]).describe('The attribute\'s data type. Determines which keys `config` accepts and requires: `status`/`select`/`multiselect` need a non-empty `options` array (each `status` option carrying its own `group`); `relation` needs `targets` (non-empty) and `cardinality` ("one" or "many"); `formula` needs `expression` and `returnType`; `rollup` needs `targetAttribute` and `function`. Every other type accepts only the shared presentation keys (`placeholder`, `defaultValue`, `icon`, ...) plus a few type-specific optionals (e.g. `number.decimals`, `date.dateFormat`). An attribute\'s type can never be changed later through this tool \u2014 only through a code migration \u2014 so pick it correctly now.');var ha=z$1.string().min(1).superRefine((e,t)=>{try{Ne(e);}catch(r){t.addIssue({code:z$1.ZodIssueCode.custom,message:ni(r)});}}).describe('The attribute\'s machine name \u2014 the record\'s field key, and what `{{ name }}` refers to in a labelExpression. Must be a valid identifier: starts with a letter or underscore, then only letters/digits/underscores ("montantHt", "first_name", "FIRST_NAME" are valid; "first-name", "first name", "123name" are not). Max 63 characters. Cannot be a name reserved by the record shape itself (id, createdAt, updatedAt, createdBy, lastUpdatedBy, objectId, label, embeddingText, values, metadata, deletedAt, deletedBy, schemaVersion).'),uc=z$1.string().min(1).superRefine((e,t)=>{w$1(e)&&t.addIssue({code:z$1.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${C$1.join(", ")}) and cannot be used for a new object.`});try{Ce(e);}catch(r){t.addIssue({code:z$1.ZodIssueCode.custom,message:ni(r)});}}).describe(`The new object's machine name: kebab-case slug, lowercase letters/digits/hyphens only, starting with a letter ("products", "user-profiles", "order-items" are valid; "Products", "userProfiles", "user_profiles" are not). Max 63 characters. Cannot be a name the platform reserves for its own system objects, and cannot already exist.`);function Aa(e){return e.superRefine((t,r)=>{try{let n$1=n(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(n$1,a));o.length>0&&r.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(n){if(n instanceof h){for(let o of n.errors)r.addIssue({code:z$1.ZodIssueCode.custom,path:["config",...o.path.map(a=>/^\d+$/.test(a)?Number(a):a)],message:`Config for type "${t.type}" is invalid or incomplete: ${o.message}`});return}r.addIssue({code:z$1.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${ni(n)}`});}})}a(Aa,"withConfigCheck");var Ta=z$1.object({objectName:z$1.string().min(1).describe("Name of the existing (or, elsewhere in the same plan, newly created) object this attribute is added to. Ignored for an attribute declared inline in `additive.objects[].attributes` \u2014 there the parent object's own `name` is used instead."),name:ha,label:z$1.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:sc,config:z$1.record(z$1.string(),z$1.unknown()).optional().describe('Type-specific configuration; required keys depend on `type` (see `type`\'s description). Shared optional keys on every type: `placeholder`, `defaultValue`, `icon`, `order`, `hidden`, `archived`, `deprecated`, `metadata`. Per-type keys: `text` \u2014 `multiline`, `minLength`, `maxLength`, `pattern`, `format` ("email"|"url"|"slug"); `number` \u2014 `renderAs` ("number"|"rating"), `min`, `max`, `unit`, `decimals`; `date` \u2014 `dateFormat`, `minDate`, `maxDate`, `includeTime`, `endDate`, `timeFormat` ("12h"|"24h"); `phone` \u2014 `defaultCountryCode` (3-letter); `currency` \u2014 `defaultCurrency`, `allowedCurrencies`, `allowNegative`; `status`/`select`/`multiselect` \u2014 `options` (REQUIRED, non-empty array of `{ value, label, color }`, unique `value`s; for `status` every OPTION also carries `group` as idle|in_progress|finished \u2014 `group` belongs on each option, never on `config` itself; select/multiselect accept `renderAs: "badges"`); `location` \u2014 `granularity`, `defaultCountry`, `allowedCountries`; `user` \u2014 `types` ("user"|"agent"), `multiple`; `relation` \u2014 `targets` (REQUIRED, non-empty array of `{ object }`) and `cardinality` (REQUIRED, "one"|"many"); `formula` \u2014 `expression` (REQUIRED formula string) and `returnType` (REQUIRED); `rollup` \u2014 `targetAttribute` (REQUIRED) and `function` (REQUIRED, e.g. "sum"|"avg"|"count"); `document` \u2014 `properties`, `accepts`, `maxFileSize`. Omit entirely for `richtext`/`checkbox`, which take no type-specific keys.'),required:z$1.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:z$1.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),lc=Aa(Ta),dc=Aa(Ta.omit({objectName:true})),cc=z$1.object({name:uc,label:z$1.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:z$1.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:z$1.string().optional().describe("Help text describing what this object represents."),icon:c.describe("Required icon name for the object. Must be a catalogue value \u2014 call `search_icons` and use a name it returns verbatim. A name that is not in the catalogue is rejected without any hint as to what would have worked, so never guess one."),labelExpression:ge.describe('Template used to render a human-readable label for every record of this object \u2014 e.g. shown in relations, search results, and breadcrumbs. MUST contain at least one `{{ attributeName }}` interpolation referencing an attribute this object will actually have (either declared in this same `attributes` array, or an existing attribute if this is an update) \u2014 a plain string with no `{{ }}` at all (e.g. "Devis") is rejected. Interpolations cannot be empty (`{{ }}` is rejected) and only these pipes are allowed: UPPER, LOWER, capitalize, trim, prefix:"...", suffix:"...", wrap:"..." "...", default:"...". `{{ a || b }}` falls back to `b` when `a` is empty. Examples: "{{ firstName }} {{ lastName }}", "{{ numero | UPPER }}", "{{ name || reference }}".'),attributes:z$1.array(dc).default([]).describe("Attributes to create on this new object, inline. Same rules as a standalone entry in `additive.attributes`, minus `objectName` (implied by this object). At least one attribute referenced by `labelExpression` should be included here.")}).strict(),wa=z$1.object({attributeRemovals:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object the attribute is removed from."),attributeName:z$1.string().min(1).describe("Attribute to delete, together with every record's stored value for it. Must not be a system (code-declared) attribute, and must not be referenced by the object's own `labelExpression` or `embeddingExpression` \u2014 update those first.")}).strict()).default([]).describe("Attributes to permanently delete. Irreversible: record values for the attribute are purged."),objectRemovals:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object to delete entirely, together with all its records. Must not be a system (code-declared) object, and must not still be targeted by a `relation` attribute on another object \u2014 retarget or remove that relation first.")}).strict()).default([]).describe("Objects to permanently delete, records included. Irreversible."),renames:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object the renamed attribute belongs to."),from:z$1.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:ha.describe("New attribute name \u2014 same identifier rules as any attribute `name` (see `name` on a planned attribute), and must not collide with another name already on the object, including one added elsewhere in this same plan.")}).strict()).default([]).describe("Attribute renames. Every reference to the old name (labelExpression, views, formulas) must be updated separately \u2014 a rename does not follow references automatically.")}).strict().default({attributeRemovals:[],objectRemovals:[],renames:[]}),xa=z$1.string().min(1).describe("ONE sentence naming the intent of the change \u2014 what it is for, not what it contains. The human approving it has already watched every entry land in the preview window and can read every row of the plan itself, so a recap tells them nothing they do not have. A second sentence is warranted only when `destructive` is non-empty: say plainly what will be lost (e.g. 'deletes the \"ancienMontant\" column and its data on every devis'). Never restate the plan \u2014 explain intent."),pa="The COMPLETE config this view should end up with \u2014 not a patch. Copy the baseline returned by get_default_view and edit it, preserving every tab and setting you are not changing: anything you omit is dropped. To change the columns shown, set `tabs[].columns` (an array of attribute names) \u2014 there is no top-level `columns` on either view type. For a detail view's side panel, set `sidePanel.attributes`. Every attribute name listed must already exist on the object, or be created earlier in this same plan. ONE EXCEPTION to omit-is-dropped: a tab with `type: \"custom\"` renders a component belonging to the application, which you cannot describe or recreate. Copy every such tab through from the baseline exactly as it came, `name`, `component` and `props` untouched \u2014 dropping one, inventing one, or altering any of those three is rejected rather than applied (`name` is the tab's address in links, not its wording). Its `label` and `icon` you may change.",ma="Opaque token returned by get_default_view alongside the baseline you edited. REQUIRED when the object already exists \u2014 it proves you authored against the baseline that is still current. Must be OMITTED when this plan creates the object, which has no baseline yet.",fa=z$1.string().min(1).describe("Name of the object whose default view of this type is replaced. Not a view name \u2014 a plan can only replace an object's deterministic default view, never create a view or target a non-default one."),pc=z$1.discriminatedUnion("viewType",[z$1.object({objectName:fa,viewType:z$1.literal("list").describe("Targets the object's default list view (the grid)."),canonicalConfig:ma$1.describe(pa),baselineToken:z$1.string().min(1).optional().describe(ma)}).strict(),z$1.object({objectName:fa,viewType:z$1.literal("detail").describe("Targets the object's default detail view (the single-record view)."),canonicalConfig:na$1.describe(pa),baselineToken:z$1.string().min(1).optional().describe(ma)}).strict()]);var ba=z$1.string().regex(/^[0-9a-f]{64}$/,"Expected a lowercase SHA-256 hash"),ga={baseConfigHash:ba.nullable(),targetConfigHash:ba,baselineOrigin:z$1.enum(["persisted","generated","absent"])},mc=z$1.discriminatedUnion("viewType",[z$1.object({objectName:z$1.string().min(1),viewType:z$1.literal("list"),canonicalConfig:ma$1,...ga}).strict(),z$1.object({objectName:z$1.string().min(1),viewType:z$1.literal("detail"),canonicalConfig:na$1,...ga}).strict()]).superRefine((e,t)=>{let r=e.baselineOrigin!=="absent";r!==(e.baseConfigHash!==null)&&t.addIssue({code:"custom",path:["baseConfigHash"],message:r?`A ${e.baselineOrigin} baseline requires baseConfigHash`:"An absent baseline requires baseConfigHash to be null"});});function Ia(e){return z$1.object({objects:z$1.array(cc).default([]).describe("New objects to create, with their attributes inline."),attributes:z$1.array(lc).default([]).describe("Attributes to add to existing or same-plan objects."),viewUpdates:z$1.array(e).default([]).describe("Complete target configs for deterministic default views; never view names.")}).strict().default({objects:[],attributes:[],viewUpdates:[]})}a(Ia,"buildAdditiveSchema");function ri(e,t=[],r=new WeakSet){if(e===null||typeof e=="string"||typeof e=="boolean")return null;if(typeof e=="number")return Number.isFinite(e)?null:{path:t,message:"Plan input contains a non-finite number"};if(typeof e!="object")return {path:t,message:"Plan input must contain only JSON-safe values"};if(r.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){r.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return r.delete(e),{path:[...t,s],message:"Plan input arrays cannot contain non-index JSON properties"};for(let s=0;s<e.length;s++){if(!Object.hasOwn(e,s))return r.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let l=ri(e[s],[...t,s],r);if(l)return r.delete(e),l}return r.delete(e),null}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};r.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let l=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(l?.enumerable&&"value"in l))return r.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let l=ri(o[s],[...t,s],r);if(l)return r.delete(e),l}return r.delete(e),null}a(ri,"findJsonSafetyIssue");function fc(e){let t=[];return e.additive.objects.forEach((r,n)=>{t.push(["additive","objects",n]),r.attributes.forEach((o,a)=>{t.push(["additive","objects",n,"attributes",a]);});}),e.additive.attributes.forEach((r,n)=>{t.push(["additive","attributes",n]);}),e.additive.viewUpdates.forEach((r,n)=>{t.push(["additive","viewUpdates",n]);}),e.destructive.attributeRemovals.forEach((r,n)=>{t.push(["destructive","attributeRemovals",n]);}),e.destructive.objectRemovals.forEach((r,n)=>{t.push(["destructive","objectRemovals",n]);}),e.destructive.renames.forEach((r,n)=>{t.push(["destructive","renames",n]);}),t}a(fc,"mutationPaths");function Sa(e,t){e.additive.objects.length>$.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:$.objectAdditions,inclusive:true,path:["additive","objects",$.objectAdditions],message:`A schema plan can add at most ${$.objectAdditions} objects`});let r=fc(e);r.length>$.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:$.totalMutations,inclusive:true,path:r[$.totalMutations],message:`A schema plan can contain at most ${$.totalMutations} mutations; received ${r.length}`});}a(Sa,"addPlanLimitIssues");function va(e,t){let r=ri(e);if(r)return t.addIssue({code:"custom",path:r.path,message:r.message}),z$1.NEVER;let n=new TextEncoder().encode(a$4(e)).byteLength;return n>$.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:$.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${$.serializedBytes} UTF-8 bytes; received ${n}`}),z$1.NEVER):e}a(va,"boundSerializedPlanInput");var bc=Ia(pc),gc=Ia(mc),ya=z$1.object({schemaPlanVersion:z$1.literal(2).describe("Required proposal contract version."),summary:xa,additive:bc,destructive:wa}).strict().superRefine((e,t)=>{let r=new Set(e.additive.objects.map(n=>n.name));e.additive.viewUpdates.forEach((n,o)=>{let a=["additive","viewUpdates",o,"baselineToken"];if(r.has(n.objectName)){n.baselineToken!==void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an object added by this plan must not include baselineToken"});return}n.baselineToken===void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an existing object requires baselineToken"});}),Sa(e,t);}),Zx=Object.assign(z$1.preprocess(va,ya),{shape:ya.shape}),yc=z$1.object({schemaPlanVersion:z$1.literal(2),summary:xa,additive:gc,destructive:wa}).strict().superRefine(Sa),eI=z$1.preprocess(va,yc);var A=z$1.number().finite().nonnegative(),Ea=z$1.enum(Gi),ii=z$1.enum(Wi),oi=z$1.enum(Ki),Da=z$1.object({provider:Ea,model:z$1.string().min(1)}).strict(),aI=z$1.object({speed:ii.optional(),reasoning:oi.optional()}).strict(),Ca=z$1.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),hc=z$1.object({model:Da.optional(),speed:ii.optional(),reasoning:oi.optional(),imageModel:Ca.optional()}).strict(),sI=hc.refine(e=>e.model!==void 0||e.speed!==void 0||e.reasoning!==void 0||e.imageModel!==void 0,{message:"At least one inference override is required"}),uI=z$1.object({model:Da.nullable().optional(),speed:ii.nullable().optional(),reasoning:oi.nullable().optional(),imageModel:Ca.nullable().optional()}).strict().refine(e=>Object.keys(e).length>0&&Object.values(e).every(t=>t!==void 0),{message:"At least one inference override is required"}),Na=z$1.object({label:z$1.string(),denied:z$1.boolean().optional(),deletion:z$1.object({target:z$1.string().optional(),count:A.optional(),restorableDays:A.optional()}).strict().optional(),counts:z$1.record(z$1.string(),A).optional(),warnings:z$1.array(z$1.string()).optional()}).strict(),Ac=z$1.union([z$1.object({type:z$1.literal("text"),text:z$1.string()}).strict(),z$1.object({type:z$1.literal("reasoning"),text:z$1.string()}).strict(),z$1.object({type:z$1.literal("system"),code:z$1.enum(Wt)}).strict(),z$1.object({type:z$1.literal("error"),error:z$1.string(),errorClass:z$1.string().optional()}).strict(),z$1.object({type:z$1.literal("tool"),toolCallId:z$1.string(),name:z$1.string(),args:z$1.record(z$1.string(),z$1.unknown()),result:z$1.unknown().optional(),error:z$1.string().optional(),errorCode:z$1.enum(["output_limit_reached","interrupted"]).optional(),state:z$1.enum(["streaming","running","completed","error","approval-requested","approval-responded","approval-dispatched"]),durationMs:A.optional(),approvalId:z$1.string().optional(),approvalImpact:Na.optional(),approved:z$1.boolean().optional(),approvalReason:z$1.string().optional(),approvalRelaxableByAuto:z$1.boolean().optional()}).strict(),z$1.object({type:z$1.literal("file"),fileId:z$1.string(),name:z$1.string(),mimeType:z$1.string()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("in-progress"),reason:z$1.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:A.optional(),reportedTokens:A.optional()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("completed"),tokensBefore:A,tokensAfter:A,tokensSaved:A,strategy:z$1.enum(["no-op","summary","truncation"]),durationMs:A,summary:z$1.string().optional()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("failed"),reason:z$1.string(),durationMs:A.optional()}).strict()]),Tc=z$1.object({id:z$1.string(),name:z$1.string(),mimeType:z$1.string(),size:A}).strict(),wc=z$1.object({id:z$1.string(),type:z$1.string().transform(e=>e),entityId:z$1.string(),label:z$1.string(),objectName:z$1.string().optional(),startIndex:A,endIndex:A}).strict(),xc=z$1.object({provider:Ea,model:z$1.string(),maxTokens:A.optional(),contextWindow:A.optional()}).strict(),Ic=z$1.union([z$1.date(),z$1.string().datetime({offset:true}).transform(e=>new Date(e))]),Ra=z$1.object({id:z$1.string(),sessionId:z$1.string(),tenantId:z$1.string().optional(),runId:z$1.string().optional(),role:z$1.enum(["user","assistant","system","tool"]),parts:z$1.array(Ac),attachments:z$1.array(Tc).optional(),mentions:z$1.array(wc).optional(),model:xc.optional(),tokenUsage:z$1.object({input:A,output:A}).strict().optional(),metadata:z$1.record(z$1.string(),z$1.unknown()).optional(),createdAt:Ic}).strict(),Sc=z$1.object({id:z$1.string(),description:z$1.string(),status:z$1.enum(["pending","in_progress","completed","blocked"]),result:z$1.string().optional(),updatedAt:A.optional()}).strict(),vc=z$1.object({id:z$1.string(),sessionId:z$1.string(),status:z$1.enum(["active","completed","abandoned"]),todos:z$1.array(Sc),version:A,createdAt:z$1.string(),updatedAt:z$1.string(),completedAt:z$1.string().optional()}).strict(),Oa={"session-named":z$1.object({name:z$1.string()}).strict(),"compaction-start":z$1.object({reason:z$1.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:A.optional(),reportedTokens:A.optional()}).strict(),"compaction-end":z$1.object({tokensBefore:A,tokensAfter:A,tokensSaved:A,strategy:z$1.enum(["no-op","summary","truncation"]),durationMs:A,summary:z$1.string().optional()}).strict(),"compaction-failed":z$1.object({reason:z$1.string()}).strict(),usage:z$1.object({messageId:z$1.string().min(1).optional(),inputTokens:A,outputTokens:A,totalTokens:A,cacheReadTokens:A.optional(),cacheCreationTokens:A.optional(),contextWindow:A,residentTokens:A,utilization:z$1.number().finite().min(0).max(1),costUsd:A.optional()}).strict(),"message-persisted":z$1.object({message:Ra}).strict(),"message-updated":z$1.object({message:Ra}).strict(),"todo-plan-update":z$1.object({plan:vc}).strict(),"approval-context":z$1.object({approvalId:z$1.string(),toolCallId:z$1.string(),impact:Na.optional(),relaxableByAuto:z$1.boolean().optional()}).strict(),"session-state":z$1.object({state:z$1.object({phase:z$1.enum(["queued","running","parked","terminal"]),parkedOn:z$1.enum(["human","agents"]).optional(),humanRequestIds:z$1.array(z$1.string()).optional(),outcome:z$1.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:z$1.number().int().positive(),updatedAt:z$1.string().datetime({offset:true})}).strict()};function Rc(e){return e in Oa}a(Rc,"isAgentUIDataName");function Ec(e){return new h("Invalid agent UI message chunk",e.map(t=>({path:t.path.map(String),message:t.message,code:t.code})))}a(Ec,"agentUIValidationError");function Dc(e){if(typeof e!="object"||e===null||typeof e.type!="string")throw new h("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 h("Invalid agent UI message chunk",[{path:["type"],message:"Expected agent data chunk type",code:"invalid_value"}]);let r=t.slice(5);if(!Rc(r))throw new h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${r}`,code:"invalid_value"}]);let n=z$1.object({type:z$1.literal(`data-${r}`),id:z$1.string().optional(),data:Oa[r],transient:z$1.boolean().optional()}).strict().safeParse(e);if(!n.success)throw Ec(n.error.issues);return n.data}a(Dc,"assertCustomAgentUIMessageChunk");function lI(e,t,r){return Dc({type:`data-${e}`,...r?.id!==void 0?{id:r.id}:{},data:t,...r?.transient!==void 0?{transient:r.transient}:{}})}a(lI,"agentDataChunk");function Ot(e){return e}a(Ot,"defineOperation");function y(e,t,r){let n=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=r?.(o);return {impact:t,navigation:n,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}a(y,"definePresentation");var ai={id:z$1.string().min(1)},v={...ai,viewId:z$1.string().min(1)};function S(e,t,r){if(!e.views.some(n=>n.id===t))throw new h(`View "${t}" is not in the draftable state`,[]);return {...e,views:e.views.map(n=>n.id===t?r(n):n)}}a(S,"mapView");function _a(e,t,r){let n=[...e],[o]=n.splice(t,1);return n.splice(r,0,o),n}a(_a,"moveWithin");function je(e,t,r){if(t.length!==e.length)throw new h(`${r} order lists ${t.length} ids for ${e.length} items`,[]);return t.map(n=>{let o=e.find(a=>a.id===n);if(!o)throw new h(`${r} "${n}" is not in this collection`,[]);return o})}a(je,"reorderById");function ne(e,t,r){let n=e.tabs.find(o=>o.id===t);if(!n)throw new h(`Tab "${t}" is not in view "${e.id}"`,[]);if(n.type!=="form")throw new h(`Tab "${t}" is not a form tab`,[]);return {...e,tabs:e.tabs.map(o=>o.id===t?r(n):o)}}a(ne,"mapFormTab");function Pt(e,t){let r=e.groups.find(n=>n.id===t);if(!r)throw new h(`Group "${t}" is not in tab "${e.id}"`,[]);return r}a(Pt,"requireGroup");function si(e,t){for(let r of e.groups){let n=r.fields.find(o=>o.id===t);if(n)return {group:r,field:n}}throw new h(`Field slot "${t}" is not in tab "${e.id}"`,[])}a(si,"locateField");function kt(e){return {viewId:e.viewId}}a(kt,"viewFocus");function _t(e){return {viewId:e.viewId,tabId:e.tabId}}a(_t,"tabFocus");function Pa(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}}a(Pa,"groupFocus");function Fa(e){return {viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}}a(Fa,"fieldFocus");function Va(e){return {viewId:e.viewId,tabId:e.tab.id}}a(Va,"addTabFocus");function ja(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.group.id}}a(ja,"addGroupFocus");function Ma(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId,fieldId:e.field.id}}a(Ma,"addFieldFocus");function La(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.toGroupId,fieldId:e.fieldId}}a(La,"moveFieldFocus");function Me(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(Me,"firstChangedProperty");var Cc=ka,Nc=fa$1,Oc=ea$1,kc=z$1.object({...v,type:z$1.literal("add_tab"),tab:Cc}),_c={type:"add_tab",schema:kc,apply:a((e,t)=>S(e,t.viewId,r=>{if(r.tabs.some(n=>n.id===t.tab.id))throw new h(`Tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,tabs:[...r.tabs,t.tab]}}),"apply"),focus:Va,presentation:y(Va,"local"),describe:a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},Pc=z$1.object({...v,type:z$1.literal("remove_tab"),tabId:z$1.string().min(1)}),Fc={type:"remove_tab",schema:Pc,apply:a((e,t)=>S(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.filter(n=>n.id!==t.tabId)}}),"apply"),focus:_t,presentation:y(_t,"local"),describe:a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Ga=z$1.object({label:z$1.string().min(1).optional(),icon:c.optional(),order:z$1.number().int().optional()}),Vc=Object.keys(Ga.shape),jc=z$1.object({...v,type:z$1.literal("update_tab"),tabId:z$1.string().min(1),changes:Ga.refine(e=>Object.keys(e).length>0,"update_tab needs at least one change")}),Ba=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabFocus"),Mc={type:"update_tab",schema:jc,apply:a((e,t)=>S(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.map(n=>n.id===t.tabId?{...n,...t.changes}:n)}}),"apply"),focus:Ba,presentation:y(Ba,"atomic",Me),describe:a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},Lc=z$1.object({...v,type:z$1.literal("reorder_tabs"),tabOrder:z$1.array(z$1.string().min(1))}),Bc={type:"reorder_tabs",schema:Lc,apply:a((e,t)=>S(e,t.viewId,r=>({...r,tabs:je(r.tabs,t.tabOrder,"Tab")})),"apply"),focus:kt,presentation:y(kt,"local"),describe:a(()=>"R\xE9ordonne les onglets","describe")},Uc=z$1.object({...v,type:z$1.literal("add_group"),tabId:z$1.string().min(1),group:Nc}),$c={type:"add_group",schema:Uc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>{if(n.groups.some(o=>o.id===t.group.id))throw new h(`Group "${t.group.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:[...n.groups,t.group]}})),"apply"),focus:ja,presentation:y(ja,"local"),describe:a(e=>`Ajoute le groupe \xAB ${e.group.label} \xBB`,"describe")},qc=z$1.object({...v,type:z$1.literal("remove_group"),tabId:z$1.string().min(1),groupId:z$1.string().min(1)}),zc={type:"remove_group",schema:qc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>(Pt(n,t.groupId),{...n,groups:n.groups.filter(o=>o.id!==t.groupId)}))),"apply"),focus:Pa,presentation:y(Pa,"local"),describe:a(e=>`Supprime le groupe ${e.groupId}`,"describe")},Gc=z$1.object({...v,type:z$1.literal("update_group"),tabId:z$1.string().min(1),groupId:z$1.string().min(1),changes:z$1.object({label:z$1.string().min(1).optional(),description:z$1.string().optional(),collapsible:z$1.boolean().optional(),collapsed:z$1.boolean().optional(),order:z$1.number().int().optional()}).refine(e=>Object.keys(e).length>0,"update_group needs at least one change")}),Ua=a(e=>({viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}),"updateGroupFocus"),Wc={type:"update_group",schema:Gc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>(Pt(n,t.groupId),{...n,groups:n.groups.map(o=>o.id===t.groupId?{...o,...t.changes}:o)}))),"apply"),focus:Ua,presentation:y(Ua,"atomic",Me),describe:a(e=>e.changes.label?`Renomme le groupe en \xAB ${e.changes.label} \xBB`:"Modifie le groupe","describe")},Kc=z$1.object({...v,type:z$1.literal("reorder_groups"),tabId:z$1.string().min(1),groupOrder:z$1.array(z$1.string().min(1))}),Yc={type:"reorder_groups",schema:Kc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>({...n,groups:je(n.groups,t.groupOrder,"Group")}))),"apply"),focus:_t,presentation:y(_t,"local"),describe:a(()=>"R\xE9ordonne les groupes","describe")},Hc=z$1.object({...v,type:z$1.literal("add_field"),tabId:z$1.string().min(1),groupId:z$1.string().min(1),field:Oc,index:z$1.number().int().min(0).optional()}),Qc={type:"add_field",schema:Hc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>{if(Pt(n,t.groupId),n.groups.some(o=>o.fields.some(a=>a.id===t.field.id)))throw new h(`Field slot "${t.field.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:n.groups.map(o=>{if(o.id!==t.groupId)return o;let a=t.index??o.fields.length;return {...o,fields:[...o.fields.slice(0,a),t.field,...o.fields.slice(a)]}})}})),"apply"),focus:Ma,presentation:y(Ma,"local"),describe:a(e=>`Ajoute le champ ${e.field.attribute??e.field.id}`,"describe")},Jc=z$1.object({...v,type:z$1.literal("remove_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1)}),Xc={type:"remove_field",schema:Jc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>{let{group:o}=si(n,t.fieldId);return {...n,groups:n.groups.map(a=>a.id===o.id?{...a,fields:a.fields.filter(s=>s.id!==t.fieldId)}:a)}})),"apply"),focus:Fa,presentation:y(Fa,"local"),describe:a(e=>`Retire le champ ${e.fieldId}`,"describe")},Zc=z$1.object({...v,type:z$1.literal("move_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1),toGroupId:z$1.string().min(1),toIndex:z$1.number().int().min(0)}),ep={type:"move_field",schema:Zc,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>{let{group:o,field:a}=si(n,t.fieldId),s=Pt(n,t.toGroupId);if(o.id===s.id){let l=o.fields.findIndex(p=>p.id===t.fieldId);return {...n,groups:n.groups.map(p=>p.id===o.id?{...p,fields:_a(p.fields,l,t.toIndex)}:p)}}return {...n,groups:n.groups.map(l=>l.id===o.id?{...l,fields:l.fields.filter(p=>p.id!==t.fieldId)}:l.id===s.id?{...l,fields:[...l.fields.slice(0,t.toIndex),a,...l.fields.slice(t.toIndex)]}:l)}})),"apply"),focus:La,presentation:y(La,"local"),describe:a(e=>`D\xE9place le champ ${e.fieldId} vers le groupe ${e.toGroupId}`,"describe")},tp=z$1.object({...v,type:z$1.literal("update_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1),changes:z$1.object({label:z$1.string().optional(),readOnly:z$1.boolean().optional(),span:z$1.number().int().min(1).max(12).optional()}).refine(e=>Object.keys(e).length>0,"update_field needs at least one change")}),$a=a(e=>({viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}),"updateFieldFocus"),rp={type:"update_field",schema:tp,apply:a((e,t)=>S(e,t.viewId,r=>ne(r,t.tabId,n=>(si(n,t.fieldId),{...n,groups:n.groups.map(o=>({...o,fields:o.fields.map(a=>a.id===t.fieldId?{...a,...t.changes}:a)}))}))),"apply"),focus:$a,presentation:y($a,"atomic",Me),describe:a(e=>`Modifie le champ ${e.fieldId}`,"describe")},Wa=z$1.object({source:ia$1.optional(),columns:Z.optional(),filters:aa$1.nullable().optional(),sorts:$$1.nullable().optional(),allowCreate:z$1.boolean().optional(),allowEdit:z$1.boolean().optional(),allowDelete:z$1.boolean().optional(),createMode:z$1.enum(["redirect","inline","peek"]).optional()}),np=Object.keys(Wa.shape),Ka=z$1.object({emailAttributeIds:z$1.array(z$1.string().min(1)).optional(),attribute:z$1.string().min(1).optional(),titleAttribute:z$1.string().min(1).nullable().optional(),component:z$1.string().nullable().optional(),props:z$1.record(z$1.string(),z$1.unknown()).nullable().optional()}),ip=Object.keys(Ka.shape),op={emailAttributeIds:["emails","meetings"],attribute:["richtext"],titleAttribute:["richtext"],component:["custom"],props:["custom"]},ap=z$1.object({...v,type:z$1.literal("update_tab_config"),tabId:z$1.string().min(1),changes:Ka.refine(e=>Object.keys(e).length>0,"update_tab_config needs at least one change")}),qa=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabConfigFocus"),sp={type:"update_tab_config",schema:ap,apply:a((e,t)=>S(e,t.viewId,r=>{let n=r.tabs.find(o=>o.id===t.tabId);if(!n)throw new h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);for(let o of Object.keys(t.changes)){let a=op[o];if(a&&!a.includes(n.type))throw new h(`"${o}" is not a setting of a "${n.type}" tab`,[])}return {...r,tabs:r.tabs.map(o=>o.id===t.tabId?{...o,...t.changes}:o)}}),"apply"),focus:qa,presentation:y(qa,"atomic",Me),describe:a(e=>`Configure ${Object.keys(e.changes).join(", ")} sur l'onglet ${e.tabId}`,"describe")},up=z$1.object({...v,type:z$1.literal("update_table_tab"),tabId:z$1.string().min(1),changes:Wa.refine(e=>Object.keys(e).length>0,"update_table_tab needs at least one change")}),za=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTableTabFocus"),lp={type:"update_table_tab",schema:up,apply:a((e,t)=>S(e,t.viewId,r=>{let n=r.tabs.find(l=>l.id===t.tabId);if(!n)throw new h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);if(n.type!=="table")throw new h(`Tab "${t.tabId}" is not a table tab`,[]);let o=Object.entries(t.changes),a=Object.fromEntries(o.filter(([,l])=>l!==null)),s=new Set(o.filter(([,l])=>l===null).map(([l])=>l));return {...r,tabs:r.tabs.map(l=>l.id===t.tabId?Object.fromEntries(Object.entries({...l,...a}).filter(([p])=>!s.has(p))):l)}}),"apply"),focus:za,presentation:y(za,"atomic",Me),describe:a(e=>e.changes.columns?`Affiche ${e.changes.columns.length} colonne(s) dans l'onglet ${e.tabId}`:`Modifie l'onglet ${e.tabId}`,"describe")},dp=z$1.object({...v,type:z$1.literal("set_side_panel"),sidePanel:z$1.object({attributes:z$1.array(z$1.string().min(1)),width:z$1.number().int().min(1).optional()}).nullable()}),cp={type:"set_side_panel",schema:dp,apply:a((e,t)=>S(e,t.viewId,r=>({...r,config:{...r.config,sidePanel:t.sidePanel??void 0}})),"apply"),focus:kt,presentation:y(kt,"atomic",()=>["config","sidePanel"]),describe:a(e=>e.sidePanel?"Active le panneau lat\xE9ral":"Retire le panneau lat\xE9ral","describe")},Ya=[_c,Fc,Mc,Bc,$c,zc,Wc,Yc,Qc,Xc,ep,rp,lp,sp,cp];var Le={...v,tabId:z$1.string().min(1)};function Ft(e){return {viewId:e.viewId}}a(Ft,"viewFocus");function ie(e){return {viewId:e.viewId,tabId:e.tabId}}a(ie,"tabFocus");function Ha(e){return {viewId:e.viewId,tabId:e.tab.id}}a(Ha,"addTabFocus");function pp(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(pp,"firstChangedProperty");function Ja(e){let t={...e};for(let r of sa$1)delete t[r];return t}a(Ja,"withoutKanbanKeys");function Xa(e){let t={...e};for(let r of ra$1)delete t[r];return t}a(Xa,"withoutTableKeys");function mp(e,t,r,n){let o=la$1.safeParse(t);if(!o.success){if(!la$1.safeParse(e).success)return t;let a=o.error.issues.map(s=>s.path.length?`${s.path.join(".")}: ${s.message}`:s.message).join(", ");throw new h(`List tab "${n}" in view "${r}" would no longer be publishable: ${a}`,[])}return t}a(mp,"assertStillPublishableTab");function Vt(e,t,r,n){return S(e,t,o=>{let a=o.config.tabs??[];if(!a.some(s=>s.id===r))throw new h(`List tab "${r}" is not in view "${t}"`,[]);return {...o,config:{...o.config,tabs:a.map(s=>s.id===r?mp(s,n(s),t,r):s)}}})}a(Vt,"mapListTab");var fp=la$1,Za=ba$1,bp=$$1;function Y(e,t,r,n){let o=z$1.object({...Le,type:z$1.literal(e),value:r});return {type:e,schema:o,apply:a((a,s)=>Vt(a,s.viewId,s.tabId,l=>{if(s.value===null){let{[t]:p,...I}=l;return I}return {...l,[t]:s.value}}),"apply"),focus:ie,presentation:y(ie,"atomic",()=>[String(t)]),describe:a(a=>n(a.value),"describe")}}a(Y,"setOnTab");var gp=z$1.object({...v,type:z$1.literal("add_list_tab"),tab:fp}),yp={type:"add_list_tab",schema:gp,apply:a((e,t)=>S(e,t.viewId,r=>{let n=r.config.tabs??[];if(n.some(o=>o.id===t.tab.id))throw new h(`List tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:[...n,t.tab]}}}),"apply"),focus:Ha,presentation:y(Ha,"local"),describe:a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},hp=z$1.object({...Le,type:z$1.literal("remove_list_tab")}),Ap={type:"remove_list_tab",schema:hp,apply:a((e,t)=>S(e,t.viewId,r=>{let n=r.config.tabs??[];if(!n.some(o=>o.id===t.tabId))throw new h(`List tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:n.filter(o=>o.id!==t.tabId)}}}),"apply"),focus:ie,presentation:y(ie,"local"),describe:a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Tp=z$1.object({...Le,type:z$1.literal("update_list_tab"),changes:z$1.object({label:z$1.string().min(1).optional(),icon:c.optional(),default:z$1.boolean().optional(),visibility:z$1.enum(y$1).optional()}).refine(e=>Object.keys(e).length>0,"update_list_tab needs at least one change")}),Qa=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateListTabFocus"),wp={type:"update_list_tab",schema:Tp,apply:a((e,t)=>Vt(e,t.viewId,t.tabId,r=>({...r,...t.changes})),"apply"),focus:Qa,presentation:y(Qa,"atomic",pp),describe:a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},xp=z$1.object({...v,type:z$1.literal("reorder_list_tabs"),tabOrder:z$1.array(z$1.string().min(1))}),Ip={type:"reorder_list_tabs",schema:xp,apply:a((e,t)=>S(e,t.viewId,r=>({...r,config:{...r.config,tabs:je(r.config.tabs??[],t.tabOrder,"List tab")}})),"apply"),focus:Ft,presentation:y(Ft,"local"),describe:a(()=>"R\xE9ordonne les onglets","describe")},Sp=Y("set_columns","columns",z$1.array(z$1.string().min(1)),e=>`Affiche ${Array.isArray(e)?e.length:0} colonne(s)`),vp=Y("set_column_sizing","columnSizing",z$1.record(z$1.string(),z$1.number().int().positive()),()=>"Ajuste la largeur des colonnes"),Rp=z$1.object({...Le,type:z$1.literal("set_layout"),value:z$1.enum(["table","list","kanban"])}),Ep={type:"set_layout",schema:Rp,apply:a((e,t)=>Vt(e,t.viewId,t.tabId,r=>{if(t.value!=="kanban")return {...Ja(r),layout:t.value};if(r.groupByAttribute===void 0)throw new h(`List tab "${t.tabId}" cannot switch to kanban without a group attribute \u2014 use set_group_by, which switches the layout itself`,[]);return {...Xa(r),layout:"kanban"}}),"apply"),focus:ie,presentation:y(ie,"atomic",()=>["layout"]),describe:a(e=>`Passe en affichage ${e.value}`,"describe")},Dp=z$1.object({...Le,type:z$1.literal("set_group_by"),value:z$1.string().min(1).nullable()}),Cp={type:"set_group_by",schema:Dp,apply:a((e,t)=>Vt(e,t.viewId,t.tabId,r=>t.value===null?{...Ja(r),layout:"table"}:{...Xa(r),layout:"kanban",groupByAttribute:t.value}),"apply"),focus:ie,presentation:y(ie,"atomic",()=>["groupByAttribute"]),describe:a(e=>e.value?`Regroupe par ${e.value} en kanban`:"Retire le regroupement, retour en table","describe")},Np=Y("set_filters","filters",Za.nullable(),e=>e?"Modifie les filtres":"Retire les filtres"),Op=Y("set_sorts","sorts",bp.nullable(),e=>e?"Modifie le tri":"Retire le tri"),kp=Y("set_create_mode","createMode",z$1.enum(["redirect","inline","peek"]),e=>`Cr\xE9ation en mode ${e}`),_p=Y("set_read_only","readOnly",z$1.boolean(),e=>e?"Passe l'onglet en lecture seule":"Rend l'onglet modifiable"),Pp=Y("set_card_user_attribute","cardUserAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire l'utilisateur des cartes"),Fp=Y("set_card_date_attribute","cardDateAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire la date des cartes"),Vp=Y("set_description_attribute","descriptionAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} en description`:"Retire la description"),jp=Y("set_display_attributes","displayAttributes",_$1.nullable(),e=>`Affiche ${Array.isArray(e)?e.length:0} attribut(s)`),Mp=z$1.object({...v,type:z$1.literal("set_default_filters"),filters:Za.nullable()}),Lp={type:"set_default_filters",schema:Mp,apply:a((e,t)=>S(e,t.viewId,r=>{if(t.filters===null){let{defaultFilters:n,...o}=r.config;return {...r,config:o}}return {...r,config:{...r.config,defaultFilters:t.filters}}}),"apply"),focus:Ft,presentation:y(Ft,"atomic",()=>["config","defaultFilters"]),describe:a(e=>e.filters?"Modifie les filtres de la vue":"Retire les filtres de la vue","describe")},es=[Lp,yp,Ap,wp,Ip,Sp,vp,Ep,Cp,Np,Op,kp,_p,Pp,Fp,Vp,jp];function Bp(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}a(Bp,"toDraftableObject");function Up(e){let t=e.id??e.name;return (e.attributes??[]).map(r=>$p(r,t))}a(Up,"toDraftableAttributes");function ui(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}a(ui,"toAttribute");function $p(e,t){let{id:r,name:n,label:o,type:a,...s}=e;return {id:e.id??e.name,objectId:t,name:e.name,label:e.label??e.name,attributeType:e.type,config:s}}a($p,"toDraftableAttribute");function Lt(e,t){if(!e.objects.some(r=>r.id===t))throw new h(`Object "${t}" is not in the draftable state`,[])}a(Lt,"requireObject");function jt(e){return {objectId:e.objectId}}a(jt,"objectFocus");function Mt(e){return {objectId:e.objectId,recordId:e.recordId}}a(Mt,"recordFocus");function ve(e){return {objectId:e.objectId,attributeId:e.attributeId}}a(ve,"attributeFocus");function qp(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(qp,"firstChangedProperty");var oe={...ai,objectId:z$1.string().uuid()},zp=z$1.object({...oe,type:z$1.literal("add_object"),name:rt,label:z$1.string().min(1),icon:z$1.string().min(1).optional()}),Gp={type:"add_object",schema:zp,apply:a((e,t)=>{if(e.objects.some(n=>n.name===t.name))throw new h(`Object "${t.name}" already exists`,[]);if(e.objects.some(n=>n.id===t.objectId))throw new h(`Object id "${t.objectId}" is already taken`,[]);let r={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,r]}},"apply"),focus:jt,presentation:y(jt,"structural"),describe:a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},Wp=z$1.object({...oe,type:z$1.literal("update_object"),changes:z$1.object({label:z$1.string().min(1).optional(),icon:z$1.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change")}),ts=a(e=>({objectId:e.objectId}),"updateObjectFocus"),Kp={type:"update_object",schema:Wp,apply:a((e,t)=>(Lt(e,t.objectId),{...e,objects:e.objects.map(r=>r.id===t.objectId?{...r,...t.changes}:r)}),"apply"),focus:ts,presentation:y(ts,"atomic",qp),describe:a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},Yp=z$1.object({...oe,type:z$1.literal("remove_object")}),Hp={type:"remove_object",schema:Yp,apply:a((e,t)=>{Lt(e,t.objectId);let r=e.objects.find(n=>n.id===t.objectId)?.name;return {...e,objects:e.objects.filter(n=>n.id!==t.objectId),attributes:e.attributes.filter(n=>n.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(n=>n.objectId!==t.objectId),views:e.views.filter(n=>n.objectName!==r)}},"apply"),focus:jt,presentation:y(jt,"structural"),describe:a(e=>`Supprime l'objet ${e.objectId}`,"describe")},Be=$i.filter(e=>e!=="formula"&&e!=="rollup"),Qp=z$1.object({...oe,type:z$1.literal("add_attribute"),attributeId:z$1.string().min(1),name:ho,label:z$1.string().min(1),attributeType:z$1.enum(Be),config:z$1.record(z$1.string(),z$1.unknown()).optional()}).superRefine((e,t)=>{try{n(e.attributeType,e.config??{});}catch(r){if(r instanceof h){for(let n of r.errors)t.addIssue({code:"custom",message:n.message,path:["config",...n.path??[]]});return}throw r}}),Jp={type:"add_attribute",schema:Qp,apply:a((e,t)=>{if(Lt(e,t.objectId),e.attributes.some(n=>n.objectId===t.objectId&&n.name===t.name))throw new h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let r={id:t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let n of e.sampleRecords)n.objectId===t.objectId&&rs(n.id,r,n.values);return {...e,attributes:[...e.attributes,r]}},"apply"),focus:ve,presentation:y(ve,"local"),describe:a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},Xp=z$1.object({...oe,type:z$1.literal("update_attribute"),attributeId:z$1.string().min(1),changes:z$1.object({label:z$1.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change")}),Zp={type:"update_attribute",schema:Xp,apply:a((e,t)=>{if(!e.attributes.some(r=>r.id===t.attributeId))throw new h(`Attribute "${t.attributeId}" is not in the draftable state`,[]);return {...e,attributes:e.attributes.map(r=>r.id===t.attributeId?{...r,...t.changes}:r)}},"apply"),focus:ve,presentation:y(ve,"atomic"),describe:a(e=>e.changes.label?`Renomme l'attribut en \xAB ${e.changes.label} \xBB`:"Modifie l'attribut","describe")},em=z$1.object({...oe,type:z$1.literal("remove_attribute"),attributeId:z$1.string().min(1)}),tm={type:"remove_attribute",schema:em,apply:a((e,t)=>{let r=e.attributes.find(o=>o.id===t.attributeId);if(!r)throw new h(`Attribute "${t.attributeId}" is not in the draftable state`,[]);let n=e.sampleRecords.find(o=>o.objectId===r.objectId&&r.name in o.values);if(n)throw new h(`Attribute "${r.name}" is still used by sample record "${n.id}"`,[]);return {...e,attributes:e.attributes.filter(o=>o.id!==t.attributeId)}},"apply"),focus:ve,presentation:y(ve,"local"),describe:a(e=>`Supprime l'attribut ${e.attributeId}`,"describe")};function rm(e,t,r,n){let o=ui(r);try{c$2(o);}catch{return}let a=g$1(o,n);if(a.success)return;let s=a.errors??[],l=s.map(p=>p.message).join(", ");throw new h(`Sample record "${e}" has an invalid value for "${t}": ${l}`,s.map(p=>({path:p.path,message:p.message})))}a(rm,"assertSampleValue");function rs(e,t,r){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in r&&r[t.name]!==void 0))throw new h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}a(rs,"assertRequiredCovered");var nm=z$1.object({...oe,type:z$1.literal("add_sample_record"),recordId:z$1.string().uuid(),values:z$1.record(z$1.string(),z$1.unknown())}),im={type:"add_sample_record",schema:nm,apply:a((e,t)=>{if(Lt(e,t.objectId),e.sampleRecords.some(n=>n.id===t.recordId))throw new h(`Sample record "${t.recordId}" already exists`,[]);let r=new Map(e.attributes.filter(n=>n.objectId===t.objectId).map(n=>[n.name,n]));for(let[n,o]of Object.entries(t.values)){let a=r.get(n);if(!a)throw new h(`Sample record "${t.recordId}" uses unknown attribute "${n}"`,[]);rm(t.recordId,n,a,o);}for(let n of r.values())rs(t.recordId,n,t.values);return {...e,sampleRecords:[...e.sampleRecords,{id:t.recordId,objectId:t.objectId,values:t.values}]}},"apply"),focus:Mt,presentation:y(Mt,"local"),describe:a(()=>"Ajoute un exemple","describe")},om=z$1.object({...oe,type:z$1.literal("remove_sample_record"),recordId:z$1.string().min(1)}),am={type:"remove_sample_record",schema:om,apply:a((e,t)=>{if(!e.sampleRecords.some(r=>r.id===t.recordId&&r.objectId===t.objectId))throw new h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return {...e,sampleRecords:e.sampleRecords.filter(r=>r.id!==t.recordId)}},"apply"),focus:Mt,presentation:y(Mt,"local"),describe:a(()=>"Retire un exemple","describe")},ns=[Gp,Kp,Hp,Jp,Zp,tm,im,am];function sm(){let e=new Map;for(let t of [...ns,...Ya,...es]){if(e.has(t.type))throw new r("architect operation",t.type);e.set(t.type,t);}return e}a(sm,"build");var ce=sm(),li=[...ce.keys()];function Ue(e){let t=ce.get(e.type);if(!t)throw new h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}a(Ue,"defOf");function di(e,t){return t.reduce((r,n)=>Ue(n).apply(r,n),e)}a(di,"applyOperations");function um(e){return Ue(e).focus(e)}a(um,"focusOf");function lm(e,t){return e.map(r=>Ue(r).describe(r,t))}a(lm,"describeOperations");function dm(e){if(typeof e!="object"||e===null||!("type"in e))throw new h("An operation must be an object carrying a type",[]);let t=e.type;if(typeof t!="string")throw new h("An operation's type must be a string",[]);let r=ce.get(t);if(!r)throw new h(`Unknown operation type "${t}"`,[]);let n=r.schema.safeParse(e);if(!n.success)throw new h(`Operation "${t}" is invalid: ${n.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return n.data}a(dm,"parseOperation");function is(e){return z$1.toJSONSchema(e,{io:"input"})}a(is,"toJsonSchema");function pm(e){let t=ce.get(e);if(!t)throw new h(`Unknown operation type "${e}"`,[]);return is(t.schema)}a(pm,"describeOperationInput");function mm(e){let t=Be.find(r=>r===e);if(!t)throw new h(`Unknown attribute type "${e}"`,[]);return is(m(t))}a(mm,"describeAttributeConfig");function fm(){return {operations:[...li],attributeTypes:[...Be]}}a(fm,"listDescribableNames");function os(e,t,r){let n=`fld_${e}_${t}`;return r===0?n:`${n}_${r}`}a(os,"makeFieldId");function bm(e,t){return e.attributeGroup?e.attributeGroup.id:e.attribute?e.attribute:`slot${t}`}a(bm,"seedOf");function gm(e){let t=new Map,r=e.fields.map((n,o)=>{if(n.id)return n;let a=bm(n,o),s=t.get(a)??0;return t.set(a,s+1),{...n,id:os(e.id,a,s)}});return {...e,fields:r}}a(gm,"withIds");function ym(e){return e.map(t=>t.type==="form"?{...t,groups:t.groups.map(gm)}:t)}a(ym,"ensureFieldIds");function ci(e){return Ue(e).presentation(e)}a(ci,"presentationOf");function hm(e){let t=e.map(ci);return new Set(t.map(({focus:n})=>n.viewId??n.objectId).filter(n=>n!==void 0)).size>1||t.some(({impact:n})=>n==="structural")?"structural":t.some(({impact:n})=>n==="local")?"local":"atomic"}a(hm,"episodeImpactOf");function Am(e,t){return e.config.tabs?.find(r=>r.id===t)}a(Am,"listTabOf");function as(e,t){let r=t.viewId?e.views.find(o=>o.id===t.viewId):void 0,n=t.tabId?r?.tabs.find(o=>o.id===t.tabId):void 0;if(t.attributeId)return e.attributes.find(o=>o.id===t.attributeId);if(t.fieldId){if(n?.type!=="form")return;for(let o of n.groups){let a=o.fields.find(s=>s.id===t.fieldId);if(a)return a}return}if(t.groupId)return n?.type!=="form"?void 0:n.groups.find(o=>o.id===t.groupId);if(t.tabId)return r?n??Am(r,t.tabId):void 0;if(t.recordId)return e.sampleRecords.find(o=>o.id===t.recordId);if(r)return r;if(t.objectId)return e.objects.find(o=>o.id===t.objectId)}a(as,"snapshotArchitectTarget");function Tm(e,t){let r=e;return t.map(n=>{let o=ci(n),a=as(r,o.focus);r=di(r,[n]);let s=as(r,o.focus);return {operationId:n.id,operationType:n.type,presentation:o,before:a,after:s}})}a(Tm,"deriveArchitectChanges");function wm(e){return {id:e.id??"",objectName:e.object,type:e.type,label:e.label,tabs:Je(e)?e.config.tabs??[]:[],config:e.config}}a(wm,"toDraftableView");function xm(e,t){return e.type==="detail"?{...e,label:t.label,config:{...t.config,tabs:t.tabs}}:{...e,label:t.label,config:t.config}}a(xm,"fromDraftableView");export{bw as AGENT_UI_BATCH_MAX_BYTES,gw as AGENT_UI_BATCH_MAX_ITEMS,io as ALLOWED_PROPERTY_TYPES,Qt as ALL_ACTIONS,li as ALL_OPERATION_TYPES,Ph as ALL_SYSTEM_RESOURCES,ig as ARTIFACT_FILE_ROLES,rg as ARTIFACT_KINDS,Xu as ARTIFACT_LIST_VIEW,Hu as ARTIFACT_OBJECT,gt as ARTIFACT_OBJECT_NAME,ng as ARTIFACT_RETENTIONS,Qu as ARTIFACT_VIEW,$i as ATTRIBUTE_TYPES,Ab as AUDIT_ACTIONS,hb as AUDIT_RESOURCE_TYPES,Hr as ActivityTabConfig,tr as AgentBuilder,ub as BEHAVIOR_PROPERTIES,zs as BYTE_UNIT_LABELS,Cs as CLAIMABLE_SESSION_STATUSES,Fe as COMPUTED_FUNCTIONS,Zw as COMPUTED_FUNCTION_METADATA,kw as COMPUTED_FUNCTION_NAMES,vx as CONNECTOR_CALLBACK_PARAM,ro as COUNT_MODES,b as ComputedFormulaCompileError,Kr as CustomTabConfig,kh as DB_COLUMN_FIELDS,wo as DEFAULT_AGENT_EXECUTION_CONFIG,zi as DEFAULT_APPROVAL_POLICY,eg as DEFAULT_DICTATION_LIMITS,uo as DEFAULT_LABEL_FALLBACK,Ms as DEFAULT_MEETING_BOT_DISPLAY_NAME,Au as DEFAULT_ROLES,jh as DEFAULT_ROLE_DESCRIPTIONS,Vh as DEFAULT_ROLE_LABELS,Mh as DEFAULT_ROLE_PERMISSIONS,Pg as DEFAULT_TENANT_SETTINGS,Xb as DICTATION_FINALIZATION_TIMEOUT_MS,Wb as DICTATION_FRAME_BYTES,Yb as DICTATION_MAX_BUFFER_BYTES,Kb as DICTATION_MAX_FRAME_BYTES,Hb as DICTATION_MAX_TRANSCRIPT_BYTES,Zb as DICTATION_MODEL_ID,Jb as DICTATION_PREPARATION_TIMEOUT_MS,Gb as DICTATION_SAMPLE_RATE,Qb as DICTATION_TICKET_TTL_MS,Hy as DOCUMENT_SYSTEM_ATTRIBUTES,Be as DRAFTABLE_ATTRIBUTE_TYPES,Yu as DRIVE_LIST_VIEW,Wu as DRIVE_OBJECT,bt as DRIVE_OBJECT_NAME,Ku as DRIVE_VIEW,Zr as DetailViewBuilder,Xr as DocumentsTabConfig,Ze as EMPTY_VALUE_PLACEHOLDER,Yg as ESTIMATED_COUNT_CAP,Qr as EmailsTabConfig,Nx as FAKE_MEETING_BOT_SIGNATURE_HEADER,Kt as FORM_FORBIDDEN_ATTRIBUTE_TYPES,ke as FlagRegistry,ft as FlagService,Ur as FormBuilder,Pe as FormRegistry,Lr as FormRowBuilder,Br as FormStepBuilder,lt as GroupBuilder,sb as IDENTITY_PROPERTIES,zg as IMAGE_FORMATS,Ki as INFERENCE_REASONING_OPTIONS,Wi as INFERENCE_SPEEDS,fl as LIVE_EVENT_TYPES,en as ListViewBuilder,tn as ListViewTabConfigBuilder,Qi as MAX_PRESET_DEPTH,Pb as MAX_TODOS,Vb as MAX_TODO_DESCRIPTION_CHARS,Fb as MAX_TODO_ID_CHARS,jb as MAX_TODO_RESULT_CHARS,T as MEETING_ATTRIBUTES,_o as MEETING_DETAIL_VIEW_ID,tl as MEETING_LIST_VIEW,Oo as MEETING_LIST_VIEW_ID,Zu as MEETING_OBJECT,yt as MEETING_OBJECT_NAME,el as MEETING_VIEW,ko as MEETING_WRITE_SOURCE,Gu as MEMORY_LIST_VIEW,qu as MEMORY_OBJECT,zu as MEMORY_VIEW,rc as McpOAuthCompletionMode,Jr as MeetingsTabConfig,ks as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,_s as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,Bi as NOTIFICATION_INBOX_STATES,ji as NOTIFICATION_KINDS,Mi as NOTIFICATION_PRIORITIES,Li as NOTIFICATION_SENSITIVITIES,ob as NOTIFICATION_TYPES_V1,Es as NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED,vs as NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN,Rs as NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED,Ui as NOTIFICATION_WORK_STATES,Ox as NO_RECORDING,Zi as NoopGeocodingAdapter,rt as OBJECT_NAME_SCHEMA,Ns as OPEN_TOOL_PART_STATES,ce as OPERATION_REGISTRY,Ct as OPERATOR_SPECS,Oe as ObjectBuilder,lb as PRESENTATION_PROPERTIES,Gi as PROVIDER_NAMES,rh as QUALIFIED_SEPARATOR,Jg as QUOTA_KEYS,Dx as RECORDING_OVERRIDES,Cx as RECORDING_POLICIES,bo as RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY,He as RELATION_TARGET_ANY,Yr as RichtextTabConfig,$ as SCHEMA_PLAN_LIMITS,ti as SCHEMA_SOURCE_ID_PATTERN,Ub as SESSION_STATE_STREAM_ID,Ds as SESSION_TERMINAL_STATUSES,Do as SKILL_CONTENT_TEMPLATE,Bu as SKILL_LIST_VIEW,Mu as SKILL_OBJECT,Lu as SKILL_VIEW,Su as STANDARD_SCHEMA_VENDOR,Wt as SYSTEM_PART_CODES,L as SYSTEM_RESOURCES,Fh as SYSTEM_RESOURCE_LABELS,la as TODAY_DEFAULT,Eb as TODO_PLAN_STATUSES,_b as TODO_STATUSES,Yi as TOOL_APPROVAL_STATES,J as TabBuilder,dt as TableTabConfig,np as UPDATE_TABLE_TAB_CHANGE_KEYS,Vc as UPDATE_TAB_CHANGE_KEYS,ip as UPDATE_TAB_CONFIG_CHANGE_KEYS,Vg as USER_STATUSES,jg as USER_WORK_POSTURES,Dg as accessLevelToActions,Eg as actionsToAccessLevel,Jh as agent,lI as agentDataChunk,Db as agentDisplayName,aI as agentInferencePreferencesSchema,Tc as agentMessageAttachmentSchema,Ac as agentMessagePartSchema,hc as agentSessionInferenceOverridesInputSchema,sI as agentSessionInferenceOverridesSchema,Ra as agentSessionMessageSchema,Ec as agentUIValidationError,di as applyOperations,au as applyPipes,cu as applyRelationProps,jw as assertAcyclicComputedDependencies,Dc as assertCustomAgentUIMessageChunk,oc as assertSchemaSourceId,Du as booleanFlag,ca as buildAgentFallbackTitle,hu as buildPermissionFlags,Xe as buildPropertySchema,ih as buildQualifiedAttribute,xo as checkbox,Os as compareAgentSessionMessages,Ko as compileComputedFormula,Uw as compileRollupAttribute,qs as computeByteMagnitude,ic as conversationDisplayTitle,_u as createFlagRegistry,Fu as createFlagService,it as createStandardSchemaProps,dA as currency,Oa as customDataChunkSchemas,U as date,Nt as dateInTimezone,be as dateValueStart,Ot as defineOperation,y as definePresentation,Tm as deriveArchitectChanges,xx as deriveCreateDefaultsFromFilters,gu as deriveInitials,mm as describeAttributeConfig,pm as describeOperationInput,lm as describeOperations,wa as destructiveSchema,z as detailView,Io as document,Ic as durableDateSchema,ym as ensureFieldIds,hm as episodeImpactOf,Yw as evaluateComputedAst,Hw as evaluateComputedFormula,Qw as evaluateComputedFormulaWithResult,Hd as evaluateFilterState,fx as evaluateRecordFilterState,po as extractAttributeNames,fo as extractValueRefs,ku as flagRegistry,um as focusOf,IA as form,js as formFieldFlatKey,Vs as formFieldKey,Vo as formRegistry,cw as formatAgentStreamFrameId,oo as formatAttributeValue,zy as formatByteSize,zd as formatComputedResult,Xs as formatLocationValue,bA as formula,xm as fromDraftableView,Mn as generateDefaultDetailView,Ln as generateDefaultListView,ew as getActiveTab,lu as getEditableLabelAttribute,sg as getErrorMessage,Gs as getListViewDisplayAttributeNames,Dw as getLiveProtocolPayloadChannel,yu as getRecordCreatorPrincipalId,mo as getSingleAttributeFromExpression,Xi as getSlotFieldTargets,fu as getUserDisplayName,$A as group,Bx as hasDestructiveEntries,Og as hasOptions,Ca as imageModelIdSchema,ye as includesAction,fb as inferInverseCardinality,Nd as inferRollupReturnType,oi as inferenceReasoningSchema,ii as inferenceSpeedSchema,Rc as isAgentUIDataName,yw as isAgentUIMessageBatch,bb as isAttributeSortable,mb as isBilateralRelation,nx as isCheckboxEquality,Rb as isClaimableSessionStatus,Tt as isComputedFunctionName,ee as isDateRangeValue,Lh as isDefaultRole,Je as isDetailView,Qy as isDocumentAttribute,Us as isEmptyObject,Ls as isFieldGroup,cg as isFormDefinition,Qe as isFormFieldsRow,Yt as isFormFreeFieldRef,hg as isFormHeadingRow,Ag as isFormSeparatorRow,Ji as isFormSlotFieldRef,Tg as isFormTextRow,tt as isLabelExpression,to as isListView,Cw as isLiveEventEnvelope,Sw as isLiveEventPayload,Il as isLiveEventPayloadForType,xl as isLiveEventType,no as isNotEmpty,Cb as isOpenToolPartState,ta as isPlainRecord,eA as isStandardSchema,Ob as isSystemPartCode,vb as isTerminalSessionStatus,xb as isTerminalState,Nb as isToolApprovalState,qi as isUniversalRelation,Ou as jsonFlag,Sb as legacyStatusToSessionState,fm as listDescribableNames,G as listView,Tw as liveChannelKey,mA as location,os as makeFieldId,Jy as matchesAccepts,wc as mentionReferenceSchema,xc as modelDefinitionSchema,Da as modelReferenceSchema,pA as multiselect,Fs as nativeAgentUIPartIdMetadataKey,Ws as normalizeDateValue,at as number,Nu as numberFlag,FA as object,kb as orderAgentSessionMessages,pw as parseAgentStreamFrameId,Bs as parseCountMode,Mo as parseLiveChannelKey,$b as parseNativeAgentUIPartIdsMetadata,dm as parseOperation,Kg as parseOptionalCountMode,nh as parseQualifiedAttribute,mc as persistedDefaultViewTargetSchema,eI as persistedSchemaPlanSchema,lA as phone,lc as plannedAttributeSchema,dc as plannedInlineAttributeSchema,cc as plannedObjectSchema,ci as presentationOf,pc as proposedDefaultViewTargetSchema,Ea as providerNameSchema,mu as qualifiedPropertyDefs,bg as readFormFieldValue,gT as registry,Te as relation,pu as relationPropertyDefs,pb as relationTargetsOf,Xt as renderLabelExpression,ll as resetViewToDefault,ec as resolveAttributeDefaultValue,fg as resolveFieldRequired,eo as resolvePropertyDefinitions,Ae as richtext,gA as rollup,Cd as rollupToFormulaExpression,Zx as schemaPlanSchema,q as select,uI as sessionInferencePatchSchema,Ib as sessionStateToLegacyStatus,cA as status,Cu as stringFlag,f as text,ui as toAttribute,Up as toDraftableAttributes,Bp as toDraftableObject,wm as toDraftableView,$s as toUndefinedIfEmpty,Sc as todoItemSchema,vc as todoPlanSchema,Na as toolImpactSchema,fA as user,Ne as validateAttributeName,ou as validateLabelExpression,Ru as validateObjectExpressions,Ce as validateObjectName,nt as validateViewName,rl as viewRegistry,Lg as viewStateKey,ac as viewSyncPayload};
60
+ `)}debug(t){let r=this.summary();return t?.(r),r}makeKey(t,r,n){return `${t}:${r}:${n}`}};a(zn,"ViewRegistry");var qn=zn,wl=new qn;function qo(e,t=[]){return e.filter(r=>!(!j(r).lifecycle.visibleInRuntime||r.system||t.includes(r.name)))}a(qo,"getRuntimeAttributes");function zo(e){return [...e].sort((t,r)=>{let n=t.order??999,o=r.order??999;return n!==o?n-o:t.name.localeCompare(r.name)})}a(zo,"sortAttributes");function xl(e){if(e.type==="text"&&e.multiline)return 12;switch(e.type){case "richtext":case "location":return 12;case "checkbox":return 4;default:return 6}}a(xl,"getDefaultFieldSpan");function Il(e){return {attribute:e.name,span:xl(e)}}a(Il,"attributeToField");function Pe(e,t={}){let{includeActivityTab:r=true,includeDocumentsTab:n=true,excludeAttributes:o=[]}=t,a=qo(e.attributes,o),p=[{id:"form",name:"form",label:"Details",type:"form",groups:[{id:"general",label:"General",type:"fields",fields:zo(a.filter(ae=>j(ae).presentation.formField)).map(Il),order:0}],order:0}],I=1,Z=e.attributes.some(ae=>ae.type==="document");n&&Z&&p.push({id:"documents",name:"documents",label:"Documents",type:"documents",order:I++,allowUpload:true,allowRemove:true}),r&&p.push({id:"activity",name:"activity",label:"Activity",type:"activity",order:I++});let B={tabs:p};return {name:"default",label:"Default View",object:e.name,type:"detail",config:B,default:true}}a(Pe,"generateDefaultDetailView");function Fe(e,t={}){let{excludeAttributes:r=[],maxListColumns:n=5}=t,o=qo(e.attributes,r),l={tabs:[{id:"all",label:"All",default:true,visibility:"workspace",layout:"table",columns:zo(o.filter(p=>j(p).presentation.defaultColumn)).slice(0,n).map(p=>p.name)}]};return {name:"default",label:"All Records",object:e.name,type:"list",config:l,default:true}}a(Fe,"generateDefaultListView");function Sl(e,t){let{preserveCustomTabs:r=true,preserveTableTabs:n=true}=t,o=[];for(let a of e.config.tabs)r&&a.type==="custom"&&o.push(a),n&&a.type==="table"&&o.push(a);return o}a(Sl,"getPreservedDetailTabs");function vl(e,t){if(t.length===0)return e;let r=e.find(s=>s.type==="form"),n=e.filter(s=>s.type!=="form"),o=[];r&&o.push(r);let a=1;for(let s of t)o.push({...s,order:a++});for(let s of n)o.push({...s,order:a++});return o}a(vl,"mergeDetailTabs");function Rl(e,t,r){let{preserveMetadata:n=true,...o}=r,a=Pe(t,o),s=Sl(e,r),l=vl(a.config.tabs,s),p={...a.config,tabs:l},I={...a,config:p};return n&&(I.id=e.id,I.name=e.name,I.label=e.label,I.description=e.description,I.icon=e.icon),I}a(Rl,"resetDetailViewToDefault");function El(e,t,r){let{preserveMetadata:n=true,...o}=r,s={...Fe(t,o)};return n&&(s.id=e.id,s.name=e.name,s.label=e.label,s.description=e.description,s.icon=e.icon),s}a(El,"resetListViewToDefault");function Dl(e,t,r={}){if(tt(e))return Rl(e,t,r);if(po(e))return El(e,t,r);throw new Error(`Reset not supported for view type: ${e.type}`)}a(Dl,"resetViewToDefault");function xw(e,t){if(t){let r=e.tabs.find(n=>n.id===t);if(r)return r}return e.tabs.find(r=>r.default)??e.tabs[0]}a(xw,"getActiveTab");function Gn(e){return structuredClone(e)}a(Gn,"cloneFormDefinition");var Wn=class Wn{constructor(){this.forms=new Map;}register(t){let r$1=Array.isArray(t)?t:[t];for(let n of r$1){if(this.forms.has(n.name))throw new r("form",n.name,`[FormRegistry] Duplicate form: "${n.name}"`);this.forms.set(n.name,Gn(n));}return this}get(t){let r=this.forms.get(t);return r?Gn(r):void 0}getAll(){return Array.from(this.forms.values(),Gn)}listNames(){return Array.from(this.forms.keys())}};a(Wn,"FormRegistry");var Ve=Wn;var Go=new Ve;function _w(e,t){return `${e}:${t}`}a(_w,"formatAgentStreamFrameId");function Pw(e){let t=e.lastIndexOf(":");if(t<=0)return null;let r=e.slice(0,t),n=Number(e.slice(t+1));return !Number.isInteger(n)||n<=0?null:{streamId:r,sequence:n}}a(Pw,"parseAgentStreamFrameId");var jw=204800,Mw=256;function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(Yn,"isRecord");function Hn(e,t){let r=Object.keys(e);return r.length===t.length&&r.every(n=>t.includes(n))}a(Hn,"hasExactKeys");function Kn(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}a(Kn,"isPositiveInteger");function Wo(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}a(Wo,"isNonNegativeInteger");function Cl(e){return Yn(e)&&Hn(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&Wo(e.startOffset)&&Wo(e.endOffset)&&e.endOffset>=e.startOffset:false}a(Cl,"isContentRange");function Nl(e){if(!Yn(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return Hn(e,t)&&Kn(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||Cl(e.content))}a(Nl,"isBatchItem");function Ol(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}a(Ol,"encodedSize");function Lw(e){if(!(Yn(e)&&Hn(e,["schemaVersion","batchId","tenantId","sessionId","streamId","sequenceStart","sequenceEnd","items"]))||e.schemaVersion!==1||typeof e.batchId!="string"||e.batchId.trim()===""||typeof e.tenantId!="string"||e.tenantId.trim()===""||typeof e.sessionId!="string"||e.sessionId.trim()===""||typeof e.streamId!="string"||e.streamId.trim()===""||!Kn(e.sequenceStart)||!Kn(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(Nl))return false;let t=0;for(let n of e.items){if(n.sequence<=t)return false;t=n.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let r=Ol(e);return r!==void 0&&r<=204800}a(Lw,"isAgentUIMessageBatch");function $w(e){switch(e.kind){case "workspace":return `workspace:${encodeURIComponent(e.tenantId)}`;case "object":return `object:${encodeURIComponent(e.objectId)}`;case "record":return `record:${encodeURIComponent(e.objectId)}:${encodeURIComponent(e.recordId)}`;case "view":return `view:${encodeURIComponent(e.viewId)}`;case "user":return `user:${encodeURIComponent(e.actorId)}`;case "conversation":return `conversation:${encodeURIComponent(e.sessionId)}`;case "architect-draft":return `architect-draft:${encodeURIComponent(e.actorId)}`}}a($w,"liveChannelKey");function te(e){try{return decodeURIComponent(e)}catch{return null}}a(te,"decodeLiveChannelPart");function Ko(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"workspace",tenantId:r}:null}if(t[0]==="object"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"object",objectId:r}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let r=te(t[1]),n=te(t[2]);return r&&n?{kind:"record",objectId:r,recordId:n}:null}if(t[0]==="view"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"view",viewId:r}:null}if(t[0]==="user"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"user",actorId:r}:null}if(t[0]==="architect-draft"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"architect-draft",actorId:r}:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let r=te(t[1]);return r?{kind:"conversation",sessionId:r}:null}return null}a(Ko,"parseLiveChannelKey");var kl={"record.patch":true,"record.deleted":true,"record.removed":true,"record.created":true,"view.projection.stale":true,"agent.session.patch":true,"notification.created":true,"notification.recipient.patch":true,"notification.count.patch":true,"notification.inbox.archived":true,"reflex.state.changed":true,"reflex.run.completed":true,"reflex.authoring.progress":true,"architect.draft.updated":true,"meeting.recording.patch":true,"wallet.state":true,"channel.revoked":true},_l=Object.keys(kl),Pl=["membership-unknown","sort-unknown","permissions-changed"],Fl=["permission-revoked","workspace-left","object-deleted"],Vl=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],jl=["type","objectId","recordId","recordVersion"],Ml=["type","objectId","recordId","recordVersion","record"],Ll=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],Bl=["type","targetActorId","archivedCount","version","updatedAt"];function Ul(e){return typeof e=="string"&&_l.includes(e)}a(Ul,"isLiveEventType");function Ww(e){return D(e)&&Ul(e.type)?$l(e.type,e):false}a(Ww,"isLiveEventPayload");function $l(e,t){if(!D(t))return false;switch(e){case "record.patch":return Hl(t);case "record.deleted":return Ql(t);case "record.removed":return Jl(t);case "record.created":return Zl(t);case "view.projection.stale":return ed(t);case "agent.session.patch":return td(t);case "notification.created":return od(t);case "notification.recipient.patch":return ad(t);case "notification.count.patch":return sd(t);case "notification.inbox.archived":return ud(t);case "reflex.state.changed":return fd(t);case "reflex.run.completed":return bd(t);case "reflex.authoring.progress":return gd(t);case "architect.draft.updated":return md(t);case "meeting.recording.patch":return hd(t);case "wallet.state":return wd(t);case "channel.revoked":return xd(t);default:return false}}a($l,"isLiveEventPayloadForType");function D(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(D,"isRecord");function F(e){return typeof e=="string"}a(F,"isString");function Yo(e){return F(e)&&e.length>0}a(Yo,"isNonEmptyString");function xt(e){return e===null||F(e)}a(xt,"isNullableString");function ql(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}a(ql,"isVersion");function K(e){if(!F(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}a(K,"isIsoDateString");function Ie(e){return e===null||K(e)}a(Ie,"isNullableIsoDateString");function x(e,t){return F(e[t])}a(x,"hasString");function re(e,t){return Yo(e[t])}a(re,"hasNonEmptyString");function C(e,t){return ql(e[t])}a(C,"hasVersion");function O(e,t){return K(e[t])}a(O,"hasIsoDateString");function w(e,t,r){return !Object.hasOwn(e,t)||r(e[t])}a(w,"hasOptional");function It(e,t){return Object.keys(e).every(r=>t.includes(r))}a(It,"hasOnlyKeys");function k(e,t){return typeof e=="string"&&t.includes(e)}a(k,"isOneOf");function zl(e){return k(e,Ki)}a(zl,"isNotificationKind");function Gl(e){return k(e,Yi)}a(Gl,"isNotificationPriority");function Wl(e){return k(e,Hi)}a(Wl,"isNotificationSensitivity");function Ho(e){return k(e,Qi)}a(Ho,"isNotificationInboxState");function Qo(e){return k(e,Ji)}a(Qo,"isNotificationWorkState");function Kl(e){return D(e)&&x(e,"type")&&x(e,"id")}a(Kl,"isNotificationSubject");function Yl(e){return D(e)&&x(e,"fieldKey")&&Object.hasOwn(e,"value")&&C(e,"version")}a(Yl,"isRecordFieldPatch");function Hl(e){return e.type==="record.patch"&&x(e,"objectId")&&x(e,"recordId")&&C(e,"recordVersion")&&w(e,"label",F)&&w(e,"metadata",D)&&w(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(Yl)&&x(e,"updatedAt")}a(Hl,"isRecordPatchPayload");function Ql(e){return e.type==="record.deleted"&&x(e,"objectId")&&x(e,"recordId")&&C(e,"recordVersion")&&x(e,"deletedAt")}a(Ql,"isRecordDeletedPayload");function Jl(e){return e.type==="record.removed"&&It(e,jl)&&x(e,"objectId")&&x(e,"recordId")&&C(e,"recordVersion")}a(Jl,"isRecordRemovedPayload");function Xl(e){return D(e)&&It(e,Ll)&&x(e,"id")&&x(e,"objectId")&&k(e.visibility,["workspace","private"])&&xt(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&Yo(e.ownedBy))&&x(e,"label")&&D(e.values)&&w(e,"metadata",D)&&O(e,"createdAt")&&O(e,"updatedAt")&&w(e,"createdBy",F)&&w(e,"lastUpdatedBy",F)&&C(e,"schemaVersion")}a(Xl,"isRecordLiveSnapshot");function Zl(e){return e.type==="record.created"&&It(e,Ml)&&x(e,"objectId")&&x(e,"recordId")&&C(e,"recordVersion")&&Xl(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}a(Zl,"isRecordCreatedPayload");function ed(e){return e.type==="view.projection.stale"&&x(e,"viewId")&&k(e.reason,Pl)}a(ed,"isViewProjectionStalePayload");function td(e){return e.type==="agent.session.patch"&&x(e,"sessionId")&&D(e.patch)&&C(e,"version")&&x(e,"updatedAt")}a(td,"isAgentSessionPatchPayload");function rd(e){return D(e)&&x(e,"id")&&x(e,"tenantId")&&w(e,"senderActorId",F)&&w(e,"rootActorId",F)&&w(e,"triggeredByActorId",F)&&zl(e.kind)&&x(e,"type")&&w(e,"subject",Kl)&&x(e,"title")&&w(e,"summary",F)&&D(e.payload)&&Gl(e.priority)&&Wl(e.sensitivity)&&w(e,"threadKey",F)&&w(e,"idempotencyKey",F)&&w(e,"expiresAt",K)&&O(e,"createdAt")&&O(e,"updatedAt")}a(rd,"isLiveNotification");function nd(e){return D(e)&&x(e,"id")&&x(e,"tenantId")&&x(e,"notificationId")&&x(e,"recipientActorId")&&Ho(e.inboxState)&&Qo(e.workState)&&w(e,"lockedAt",K)&&w(e,"lockedByActorId",F)&&w(e,"readAt",K)&&w(e,"archivedAt",K)&&w(e,"snoozedUntil",K)&&w(e,"completedAt",K)&&w(e,"dismissedAt",K)&&O(e,"createdAt")&&O(e,"updatedAt")}a(nd,"isLiveNotificationRecipient");function id(e){return D(e)?Object.keys(e).every(t=>Vl.includes(t))&&w(e,"inboxState",Ho)&&w(e,"workState",Qo)&&w(e,"lockedAt",Ie)&&w(e,"lockedByActorId",xt)&&w(e,"readAt",Ie)&&w(e,"archivedAt",Ie)&&w(e,"snoozedUntil",Ie)&&w(e,"completedAt",Ie)&&w(e,"dismissedAt",Ie)&&w(e,"updatedAt",K):false}a(id,"isNotificationRecipientPatch");function od(e){let t=rd(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(r=>nd(r)&&r.notificationId===t.id)&&C(e,"version")&&O(e,"updatedAt")}a(od,"isNotificationCreatedPayload");function ad(e){return e.type==="notification.recipient.patch"&&x(e,"recipientId")&&x(e,"recipientActorId")&&id(e.patch)&&C(e,"version")&&O(e,"updatedAt")}a(ad,"isNotificationRecipientPatchPayload");function sd(e){return e.type==="notification.count.patch"&&x(e,"targetActorId")&&C(e,"unread")&&C(e,"pendingWork")&&C(e,"version")&&O(e,"updatedAt")}a(sd,"isNotificationCountPatchPayload");function ud(e){return e.type==="notification.inbox.archived"&&It(e,Bl)&&re(e,"targetActorId")&&C(e,"archivedCount")&&C(e,"version")&&O(e,"updatedAt")}a(ud,"isNotificationInboxArchivedPayload");var ld=["armed","disarmed"],dd=["authoring","compiling","replaying","promoted","failed"],cd=["promoted","lkg"],pd=["composing","published","discarded"];function md(e){if(e.type!=="architect.draft.updated"||!D(e.draft))return false;let t=e.draft;return re(t,"id")&&re(t,"actorId")&&xt(t.agentSessionId)&&Array.isArray(t.operations)&&t.operations.every(D)&&D(t.baselines)&&k(t.status,pd)}a(md,"isArchitectDraftUpdatedPayload");function fd(e){return e.type==="reflex.state.changed"&&re(e,"reflexId")&&k(e.state,ld)&&O(e,"updatedAt")}a(fd,"isReflexStateChangedPayload");function bd(e){return e.type==="reflex.run.completed"&&re(e,"reflexId")&&re(e,"runId")&&k(e.served,cd)&&C(e,"version")&&C(e,"wallMs")&&O(e,"completedAt")}a(bd,"isReflexRunCompletedPayload");function gd(e){return e.type==="reflex.authoring.progress"&&re(e,"reflexId")&&k(e.status,dd)&&O(e,"updatedAt")}a(gd,"isReflexAuthoringProgressPayload");var yd=["none","scheduled","recording","completed","failed"];function hd(e){return e.type==="meeting.recording.patch"&&re(e,"meetingId")&&k(e.status,yd)&&xt(e.failureReason)&&O(e,"updatedAt")}a(hd,"isMeetingRecordingPatchPayload");var Ad=["ok","low","exhausted","paused"],Td=["metering-only","contract","wallet"];function wd(e){return e.type==="wallet.state"&&k(e.status,Ad)&&k(e.mode,Td)&&O(e,"updatedAt")}a(wd,"isWalletStatePayload");function xd(e){return e.type==="channel.revoked"&&x(e,"channel")&&k(e.reason,Fl)}a(xd,"isChannelRevokedPayload");function Qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(Qn,"isRecord");function Id(e){let{channel:t}=e;return typeof t=="string"&&Ko(t)?t:null}a(Id,"payloadChannel");function Qw(e){return Qn(e)?Id(e):null}a(Qw,"getLiveProtocolPayloadChannel");function Jw(e){return Qn(e)?typeof e.id=="string"&&e.id.length>0&&typeof e.channel=="string"&&typeof e.type=="string"&&typeof e.tenantId=="string"&&e.tenantId.length>0&&typeof e.occurredAt=="string"&&Qn(e.payload):false}a(Jw,"isLiveEventEnvelope");var ex=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],je={if:{name:"if",returnType:"branch",minArgs:3,maxArgs:3},concat:{name:"concat",returnType:{kind:"scalar",type:"text"},minArgs:1},sum:{name:"sum",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},avg:{name:"avg",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count:{name:"count",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},min:{name:"min",returnType:"source_item",minArgs:1,maxArgs:1},max:{name:"max",returnType:"source_item",minArgs:1,maxArgs:1},earliest:{name:"earliest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},latest:{name:"latest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},unique:{name:"unique",returnType:"argument",minArgs:1,maxArgs:1},first:{name:"first",returnType:"source_item",minArgs:1,maxArgs:1},percent_empty:{name:"percent_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},percent_not_empty:{name:"percent_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_empty:{name:"count_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_not_empty:{name:"count_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_unique:{name:"count_unique",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1}};function St(e){return Object.hasOwn(je,e)}a(St,"isComputedFunctionName");var ei=class ei extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};a(ei,"ComputedFormulaCompileError");var b=ei;function ra(e){let t=Sd(e.expression),r=vt(t,e.schema),n=Wd(r.valueType);if(n!==e.returnType)throw new b(`Computed formula "${e.attributeName}" returns "${n}", expected "${e.returnType}"`);if(na(e.returnType)&&r.optionsSource===void 0)throw new b(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=r.optionsSource===void 0?[]:[{kind:"options",source:r.optionsSource}],a=Zn([...r.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:r.valueType,dependencies:a,ast:t,...r.optionsSource?{optionsSource:r.optionsSource}:{},...r.targetAttributeType?{targetAttributeType:r.targetAttributeType}:{},dependenciesHash:Kd({expression:e.expression,returnType:e.returnType,dependencies:a})}}a(ra,"compileComputedFormula");function ox(e){let t=new Map(e.map(o=>[o.attributeName,o])),r=new Set,n=a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let I=[...a.slice(s),o];throw new b(`Computed field cycle detected: ${I.join(" -> ")}`)}if(r.has(o))return;let l=t.get(o);if(l===void 0)return;let p=[...a,o];for(let I of l.dependencies)I.kind==="computed"&&n(I.attributeName,p);r.add(o);},"visit");for(let o of e)n(o.attributeName,[]);}a(ox,"assertAcyclicComputedDependencies");function Sd(e){try{return e$1(e)}catch(t){throw t instanceof Error?new b(t.message):t}}a(Sd,"parseCompileFormula");function vt(e,t){switch(e.kind){case "literal":return {valueType:vd(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return Rd(e.parts,t);case "call":return kd(e.functionName,e.args,t);case "binary":return jd(e.operator,vt(e.left,t),vt(e.right,t));default:return e}}a(vt,"inferNode");function vd(e){switch(typeof e){case "string":return {kind:"scalar",type:"text"};case "number":return {kind:"scalar",type:"number"};case "boolean":return {kind:"scalar",type:"boolean"};case "object":return {kind:"scalar",type:"text"};default:return e}}a(vd,"literalToValueType");function Rd(e,t){if(e.length===1){let r=e[0],n=Jn(t,r);if(n===void 0)throw new b(`Unknown attribute "${r}" on object "${t.objectName}"`);return n.type==="relation"?{valueType:Cd(),dependencies:[{kind:"relation",relationName:n.name,cardinality:Jo(n)}],targetAttributeType:n.type}:{valueType:Xo(n),dependencies:[Dd(n)],optionsSource:Zo(t.objectName,n),targetAttributeType:n.type}}if(e.length===2){let[r,n]=e,o=Jn(t,r);if(o===void 0)throw new b(`Unknown attribute "${r}" on object "${t.objectName}"`);if(o.type!=="relation")throw new b(`Attribute "${r}" on object "${t.objectName}" is not a relation`);let a=Ed(o);if(a===void 0)throw new b(`Relation "${r}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new b(`Unknown related object "${a}"`);let l=Jn(s,n);if(l===void 0)throw new b(`Unknown attribute "${n}" on object "${s.objectName}"`);let p=Xo(l);return {valueType:o.cardinality==="many"?Od(p):p,dependencies:[{kind:"relation",relationName:r,targetAttributeName:n,cardinality:Jo(o)}],optionsSource:Zo(s.objectName,l),targetAttributeType:l.type}}throw new b("Computed paths support at most one relation hop")}a(Rd,"inferPath");function Jn(e,t){return e.attributes.find(r=>r.name===t)}a(Jn,"findAttribute");function Ed(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}a(Ed,"getRelationTargetObjectName");function Jo(e){return e.cardinality??"one"}a(Jo,"relationCardinality");function Dd(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}a(Dd,"localDependencyFor");function Xo(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new b(`Computed attribute "${e.name}" is missing returnType`);return Nd(e.returnType)}switch(e.type){case "number":case "currency":return {kind:"scalar",type:"number"};case "checkbox":return {kind:"scalar",type:"boolean"};case "date":return {kind:"scalar",type:"date"};case "select":case "status":return {kind:"scalar",type:"select"};case "multiselect":return {kind:"collection",itemType:"select"};case "text":case "richtext":case "phone":case "user":case "location":case "relation":case "document":return {kind:"scalar",type:"text"};default:return e.type}}a(Xo,"attributeToValueType");function Cd(){return {kind:"collection",itemType:"text"}}a(Cd,"relationToValueType");function Nd(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}a(Nd,"returnTypeToValueType");function Od(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}a(Od,"asCollectionValueType");function Zo(e,t){if(t.type==="formula"||t.type==="rollup")return na(t.returnType)?t.optionsSource:void 0;if(!(t.type!=="select"&&t.type!=="status"&&t.type!=="multiselect"))return t.optionsSource??{objectName:e,attributeName:t.name,...t.id?{attributeId:t.id}:{}}}a(Zo,"optionsSourceForAttribute");function kd(e,t,r){if(!St(e))throw new b(`Unknown computed function "${e}"`);let n=je[e];if(t.length<n.minArgs||n.maxArgs!==void 0&&t.length>n.maxArgs){let a=n.maxArgs===void 0||n.maxArgs===n.minArgs?String(n.minArgs):`${n.minArgs}-${n.maxArgs}`;throw new b(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>vt(a,r));return _d(e,o)}a(kd,"inferCall");function _d(e,t){let r=Zn(t.flatMap(n=>n.dependencies));switch(e){case "if":return Pd(t,r);case "concat":return Md(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:r};case "sum":case "avg":return ea(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return Bd(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "min":case "max":return Ld(e,t[0]),{valueType:Ud(t[0]),dependencies:r,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return ea(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:r,targetAttributeType:t[0].targetAttributeType};case "unique":return Fd(t[0],r);case "first":return Vd(t[0],r);default:return e}}a(_d,"inferFunctionReturn");function Pd(e,t){Xn(e[0].valueType,"boolean",'Function "if" condition must be boolean');let r=e[1],n=e[2],o=qd(r,n),a=zd(r,n);if(o===void 0)throw new b('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:r.targetAttributeType??n.targetAttributeType}}a(Pd,"inferIfFunction");function Fd(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new b('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}a(Fd,"inferUniqueFunction");function Vd(e,t){if(e.valueType.kind!=="collection")throw new b('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}a(Vd,"inferFirstFunction");function jd(e,t,r){let n=Zn([...t.dependencies,...r.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||r.valueType.kind==="collection")throw new b(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||r.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:n}:(Xn(t.valueType,"number",`Operator "${e}" expects number operands`),Xn(r.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:n});if(e==="=="||e==="!="){if(t.valueType.type!==r.valueType.type)throw new b(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}if((t.valueType.type!=="number"||r.valueType.type!=="number")&&(t.valueType.type!=="date"||r.valueType.type!=="date"))throw new b(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}a(jd,"inferBinary");function Md(e,t){for(let r of e)if(r.valueType.kind==="collection")throw new b(t)}a(Md,"ensureNoCollections");function ea(e,t,r){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==r)throw new b(`Function "${e}" expects ${r} values`)}a(ea,"ensureCollectionOrScalarType");function Ld(e,t){if(t.valueType.kind!=="collection")throw new b(`Function "${e}" expects a collection`);let r=t.valueType.itemType;if(r!=="number"&&r!=="date")throw new b(`Function "${e}" expects number or date values`)}a(Ld,"ensureMinMaxSource");function Bd(e,t){if(t.valueType.kind!=="collection")throw new b(`Function "${e}" expects a collection`)}a(Bd,"ensureCollectionSource");function Xn(e,t,r){if(e.kind!=="scalar"||e.type!==t)throw new b(r)}a(Xn,"ensureScalarType");function Ud(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}a(Ud,"sourceItemValueType");function $d(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}a($d,"sameValueType");function qd(e,t){if($d(e.valueType,t.valueType)||ta(e,t))return e.valueType;if(ta(t,e))return t.valueType}a(qd,"resolveIfBranchValueType");function ta(e,t){return e.valueType.kind==="scalar"&&e.valueType.type==="select"&&t.valueType.kind==="scalar"&&t.valueType.type==="text"&&t.literalString!==void 0}a(ta,"isSelectScalarWithStringLiteral");function zd(e,t){let r=e.optionsSource,n=t.optionsSource;if(r!==void 0&&n!==void 0&&!Gd(r,n))throw new b('Function "if" branches use incompatible options sources');return r??n}a(zd,"resolveIfOptionsSource");function Gd(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}a(Gd,"sameOptionsSource");function na(e){return e==="select"||e==="multiselect"}a(na,"isSelectLikeReturnType");function Wd(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new b(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}a(Wd,"valueTypeToReturnType");function Zn(e){let t=new Set,r=[];for(let n of e){let o=JSON.stringify(Me(n));t.has(o)||(t.add(o),r.push(n));}return r}a(Zn,"uniqueDependencies");function Kd(e){let t=e.dependencies.map(r=>Me(r)).sort((r,n)=>ia(JSON.stringify(r),JSON.stringify(n)));return JSON.stringify(Me({expression:e.expression,returnType:e.returnType,dependencies:t}))}a(Kd,"createDependenciesHash");function Me(e){return Array.isArray(e)?e.map(t=>Me(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>ia(t,r)).map(([t,r])=>[t,Me(r)])):e}a(Me,"stableNormalize");function ia(e,t){return e<t?-1:e>t?1:0}a(ia,"compareStrings");function Yd(e){return e.function==="count"?`count(${e.relationAttribute})`:`${Jd(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}a(Yd,"rollupToFormulaExpression");function Hd(e,t){if(e.function==="count")return "number";let r=Xd(e,t);switch(e.function){case "countValues":case "countEmpty":case "percentEmpty":case "percentNotEmpty":case "countUniqueValues":return "number";case "sum":case "avg":return "number";case "earliest":case "latest":return "date";case "original":if(!ec(r.type))throw new b('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}a(Hd,"inferRollupReturnType");function lx(e,t){let r=Yd(e),n=Hd(e,t);return {...ra({attributeName:e.name,expression:r,returnType:n,schema:Qd(e,t)}),kind:"rollup"}}a(lx,"compileRollupAttribute");function Qd(e,t){return {...t,attributes:t.attributes.map(r=>r.name===e.relationAttribute&&r.type==="relation"?{...r,cardinality:"many"}:r)}}a(Qd,"schemaWithRollupRelationAsMany");function Jd(e){switch(e){case "sum":case "avg":case "earliest":case "latest":return e;case "original":return "unique";case "countValues":return "count_not_empty";case "countEmpty":return "count_empty";case "percentEmpty":return "percent_empty";case "percentNotEmpty":return "percent_not_empty";case "countUniqueValues":return "count_unique";default:return e}}a(Jd,"rollupFunctionToFormulaFunction");function Xd(e,t){let r=oa(t,e.relationAttribute);if(r===void 0)throw new b(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(r.type!=="relation")throw new b(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let n=Zd(r);if(n===void 0)throw new b(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[n];if(o===void 0)throw new b(`Unknown related object "${n}"`);let a=oa(o,e.targetAttribute);if(a===void 0)throw new b(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}a(Xd,"findRollupTargetAttribute");function oa(e,t){return e.attributes.find(r=>r.name===t)}a(oa,"findAttribute");function Zd(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}a(Zd,"getRelationTargetObjectName");function ec(e){return e==="select"||e==="status"||e==="multiselect"}a(ec,"isSelectLikeAttributeType");function X(e,t){switch(e.kind){case "literal":return e.value;case "path":return rc(t,e.parts);case "binary":return nc(e.operator,X(e.left,t),X(e.right,t));case "call":return tc(e.functionName,e.args,t);default:return e}}a(X,"evaluateAst");function tc(e,t,r){if(oc(e),ac(e,t.length),e==="if"){let n=X(t[0],r);return n===null?null:X(n?t[1]:t[2],r)}return sc(e,t.map(n=>X(n,r)))}a(tc,"evaluateCallNode");function rc(e,t){return t.reduce((r,n)=>ca(r,n),e)}a(rc,"resolvePath");function ca(e,t){if(Array.isArray(e))return e.map(n=>ca(n,t));if(!da(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let r=e.values;return da(r)&&Object.hasOwn(r,t)?r[t]??null:null}a(ca,"resolvePathPart");function nc(e,t,r){switch(e){case "+":return ic(t,r);case "-":return Et(t,r,(n,o)=>n-o);case "*":return Et(t,r,(n,o)=>n*o);case "/":return Et(t,r,(n,o)=>n/o);case ">":return Rt(t,r,n=>n>0);case "<":return Rt(t,r,n=>n<0);case ">=":return Rt(t,r,n=>n>=0);case "<=":return Rt(t,r,n=>n<=0);case "==":return aa(t,r);case "!=":{let n=aa(t,r);return n===null?null:!n}default:return e}}a(nc,"evaluateBinary");function ic(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:Et(e,t,(r,n)=>r+n)}a(ic,"add");function Rt(e,t,r){let n=pa(e,t);return n===null?null:r(n)}a(Rt,"compareWith");function pa(e,t){if(!Se([e,t]))return null;let r=ve(e),n=ve(t);if(r!==null&&n!==null)return r-n;let o=ni(e),a=ni(t);return o&&a?o.getTime()-a.getTime():null}a(pa,"compare");function aa(e,t){return e===t?true:e==null||t===null||t===void 0?false:Se([e,t])?pa(e,t)===0:null}a(aa,"equalScalar");function oc(e){if(!St(e))throw new Error(`Unknown computed function "${e}"`)}a(oc,"assertComputedFunctionName");function ac(e,t){let{minArgs:r,maxArgs:n}=je[e];if(t>=r&&t<=(n??Number.POSITIVE_INFINITY))return;let o=n===void 0?`at least ${r}`:`between ${r} and ${n}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}a(ac,"validateArity");function sc(e,t){switch(e){case "concat":return t.filter(r=>r!=null).map(String).join("");case "sum":return Se(t)?ti(t).reduce((r,n)=>r+n,0):null;case "avg":{if(!Se(t))return null;let r=ti(t);return r.length>0?r.reduce((n,o)=>n+o,0)/r.length:null}case "count":return de(t[0]).length;case "min":return sa(t,"min");case "max":return sa(t,"max");case "earliest":return ri(t,"min");case "latest":return ri(t,"max");case "unique":return la(de(t[0]));case "first":return de(t[0]).find(r=>r!=null)??null;case "percent_empty":return ua(t[0],true);case "percent_not_empty":return ua(t[0],false);case "count_empty":return de(t[0]).filter(a$1).length;case "count_not_empty":return de(t[0]).filter(r=>!a$1(r)).length;case "count_unique":return la(de(t[0])).length;default:return e}}a(sc,"evaluateCall");function ti(e){return Dt(e).map(ve).filter(t=>t!==null)}a(ti,"numericValues");function Se(e){let t=new Set;for(let r of Dt(e))ii(r)&&t.add(ma(r));return t.size<=1}a(Se,"areCommensurable");function ma(e){return e.code.toUpperCase()}a(ma,"currencyCode");function Et(e,t,r){if(!Se([e,t]))return null;let n=ve(e),o=ve(t);if(n===null||o===null)return null;let a=r(n,o);return Number.isFinite(a)?a:null}a(Et,"numericBinary");function sa(e,t){if(!Se(e))return null;let r=ti(e);return r.length>0?t==="min"?Math.min(...r):Math.max(...r):ri(e,t)}a(sa,"minMax");function ri(e,t){let r=Dt(e).map(ni).filter(a=>a!==null);if(r.length===0)return null;let n=r.map(a=>a.getTime()),o=t==="min"?Math.min(...n):Math.max(...n);return new Date(o).toISOString()}a(ri,"dateMinMax");function ua(e,t){let r=de(e);return r.length===0?0:r.filter(o=>a$1(o)===t).length/r.length}a(ua,"percentByEmptyState");function la(e){let t=new Set,r=[];for(let n of e){if(a$1(n))continue;let o=uc(n);t.has(o)||(t.add(o),r.push(n));}return r}a(la,"uniqueNonEmpty");function de(e){return e==null?[]:Array.isArray(e)?Dt(e):[e]}a(de,"collectionItems");function Dt(e){return e.flat(Number.POSITIVE_INFINITY)}a(Dt,"flatten");function ve(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 ii(e)&&Number.isFinite(e.value)?e.value:null}a(ve,"toFiniteNumber");function ii(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}a(ii,"isCurrencyValue");function ni(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let r=ge(e);if(r===null)return null;let n=new Date(r);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}a(ni,"toDate");function uc(e){if(ii(e))return `currency:${ma(e)}:${e.value}`;let t=ve(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}a(uc,"uniqueKey");function da(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(da,"isPlainRecord");function lc(e,t,r){if(e==null)return null;let n=a(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"||o instanceof Date?String(o):null,"stringifyScalar");switch(t){case "number":{let o=typeof e=="number"?e:Number(e);return Number.isNaN(o)?null:r!==void 0?Number(o.toFixed(r)):o}case "boolean":return !!e;case "date":return e instanceof Date?e.toISOString():typeof e=="string"?e:null;case "text":return String(e);case "select":if(Array.isArray(e)){for(let o of e){if(o==null)continue;let a=n(o);if(a!==null)return a}return null}return n(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=n(o);return a===null?[]:[a]}):n(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}a(lc,"formatComputedResult");function gx(e,t){return X(e,t)}a(gx,"evaluateComputedAst");function yx(e,t){return X(e$1(e),t)}a(yx,"evaluateComputedFormula");function hx(e,t,r,n){try{let o=X(e$1(e),t);return {value:r?lc(o,r,n):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}a(hx,"evaluateComputedFormulaWithResult");var wx=[{name:"if",signature:"if(condition, then, else)",description:"Conditional value",category:"logic",example:"if(amount > 100, 'big', 'small')"},{name:"concat",signature:"concat(a, b, ...)",description:"Join values into text",category:"text",example:"concat(firstName, ' ', lastName)"},{name:"sum",signature:"sum(collection)",description:"Total of values",category:"number",example:"sum(orders.amount)"},{name:"avg",signature:"avg(collection)",description:"Average of values",category:"number",example:"avg(orders.amount)"},{name:"min",signature:"min(collection)",description:"Smallest value",category:"number",example:"min(orders.amount)"},{name:"max",signature:"max(collection)",description:"Largest value",category:"number",example:"max(orders.amount)"},{name:"count",signature:"count(collection)",description:"Number of items",category:"collection",example:"count(orders)"},{name:"count_empty",signature:"count_empty(collection)",description:"Items with no value",category:"collection",example:"count_empty(orders.note)"},{name:"count_not_empty",signature:"count_not_empty(collection)",description:"Items with a value",category:"collection",example:"count_not_empty(orders.note)"},{name:"count_unique",signature:"count_unique(collection)",description:"Distinct values",category:"collection",example:"count_unique(orders.status)"},{name:"percent_empty",signature:"percent_empty(collection)",description:"Fraction with no value",category:"collection",example:"percent_empty(orders.note)"},{name:"percent_not_empty",signature:"percent_not_empty(collection)",description:"Fraction with a value",category:"collection",example:"percent_not_empty(orders.note)"},{name:"unique",signature:"unique(collection)",description:"Distinct values as a list",category:"collection",example:"unique(orders.status)"},{name:"first",signature:"first(collection)",description:"First non-empty value",category:"collection",example:"first(orders.status)"},{name:"earliest",signature:"earliest(collection)",description:"Earliest date",category:"date",example:"earliest(orders.closeDate)"},{name:"latest",signature:"latest(collection)",description:"Latest date",category:"date",example:"latest(orders.closeDate)"}];var fa=a(e=>a$1(e)||Array.isArray(e)&&e.length===0,"isEmpty"),V=a(e=>e==null?"":String(e),"toStr"),Ot=a(e=>{if(a$1(e))return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},"toNum"),kt=a(e=>{if(e==null)return null;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t},"toDate"),Ct=a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),dc=a((e,t,r)=>{let n=Ot(e),o=Ot(t);return n!==null&&o!==null&&r(n,o)},"compareNumbers"),cc=a((e,t,r)=>{let n=kt(e),o=kt(t);return n!==null&&o!==null&&r(n.getTime(),o.getTime())},"compareDates"),ba=a((e,t,r)=>{if(r.type==="number"||r.type==="currency"){let n=Ot(e),o=Ot(t);if(n!==null&&o!==null)return n===o}return V(e)===V(t)},"equalsForAttr");function vx(e,t){return e?e==="checkbox":typeof t=="boolean"}a(vx,"isCheckboxEquality");var Nt=a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:a((t,r,n)=>n.type==="date"?cc(t,r,e):dc(t,r,e),"evaluateInMemory")}),"orderingSpec"),_t={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:a((e,t,r)=>r.type==="checkbox"?e===true==(t===true):ba(e,t,r),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:a((e,t,r)=>!ba(e,t,r),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().includes(V(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:a((e,t)=>!V(e).toLowerCase().includes(V(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().startsWith(V(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:a((e,t)=>V(e).toLowerCase().endsWith(V(t).toLowerCase()),"evaluateInMemory")},is_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:a(e=>fa(e),"evaluateInMemory")},is_not_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:a(e=>!fa(e),"evaluateInMemory")},less_than:Nt((e,t)=>e<t),greater_than:Nt((e,t)=>e>t),less_or_equal:Nt((e,t)=>e<=t),greater_or_equal:Nt((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:a((e,t)=>{let r=kt(e),n=S$1(t);return r&&n?r.getTime()>=n.startMs&&r.getTime()<n.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:a((e,t)=>{let r=kt(e);if(!r)return false;let n=t;return r.getMonth()+1===n.month&&r.getDate()===n.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:a((e,t)=>{let r=Ct(t).map(V);return Ct(e).map(V).some(o=>r.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:a((e,t)=>{let r=Ct(t).map(V);return !Ct(e).map(V).some(o=>r.includes(o))},"evaluateInMemory")}};var pc=a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),mc=[...Object.entries(V$1).map(([e,t])=>pc(e,t))];function Vx(e,t,r){let n=t;return fc(e,{...t.values,id:t.id,objectId:t.objectId,objectName:n.objectName,tenantId:n.tenantId,label:t.label,createdAt:t.createdAt,updatedAt:t.updatedAt,createdBy:t.createdBy,lastUpdatedBy:t.lastUpdatedBy,deletedAt:t.deletedAt,deletedBy:t.deletedBy,visibility:t.visibility,ownedBy:t.ownedBy},[...r,...mc])}a(Vx,"evaluateRecordFilterState");function fc(e,t,r){if(e.rules.length===0)return true;let n=new Map(r.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>bc(a,t,n))}a(fc,"evaluateFilterState");function bc(e,t,r){let n=r.get(e.attribute);if(!n)return false;if(e.property&&n.type==="location"){if(!(g$1(e.property)&&h$2(e.operator)))return false;let l=_t[e.operator];if(!l)return false;let p=t[e.attribute],I=typeof p=="object"&&p!==null?p[e.property]:void 0;return oi(l,"text",e.operator,I,e.value,n)}if(e.property){let l=co(n).find(j=>j.name===e.property);if(!l)return false;let p=K$1(e.operator),I=_t[p];if(!I?.appliesTo.includes(l.type))return false;let Z=t[e.attribute],ae=(Array.isArray(Z)?Z:Z==null?[]:[Z]).some(j=>{if(typeof j!="object"||j===null)return false;let H=j.props;return typeof H!="object"||H===null?false:oi(I,l.type,p,H[e.property],e.value,l)});return (e.quantifier??J$1(e.operator))==="none"?!ae:ae}let o=_t[e.operator];if(!o||!o.appliesTo.includes(n.type))return false;let a=t[e.attribute],s=n.type==="relation"||n.type==="document"||n.type==="user"?hc(a):a;return oi(o,n.type,e.operator,s,e.value,n)}a(bc,"evaluateRule");function oi(e,t,r,n,o,a){let[s,l]=gc(t,r,n,o);return t==="phone"&&l===""&&r==="contains"?false:t==="phone"&&l===""&&r==="not_contains"?true:e.evaluateInMemory(s,l,a)}a(oi,"evaluateNormalizedComparands");function gc(e,t,r,n){return e==="date"&&(t==="is"||t==="is_not")?[ga(r),ga(n)]:e==="phone"?yc(r,n):[ya(e,r),ya(e,n)]}a(gc,"normalizeOperatorComparands");function ga(e){let t=ee(e)?ge(e):e;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t.toISOString().slice(0,10);if(typeof t!="string"||t==="")return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString().slice(0,10)}a(ga,"normalizeUtcCalendarDay");function yc(e,t){let r=typeof t=="object"&&t!==null?t:{},n=typeof r.countryCode=="string"?r.countryCode:void 0,o=a(a=>{let s=typeof a=="object"&&a!==null?a:{phoneNumber:a};if(typeof s.phoneNumber!="string")return null;if(!n)return a$3(s.phoneNumber);let l=typeof s.countryCode=="string"?s.countryCode:n;return `${l}:${b$2(s.phoneNumber,l)}`},"normalizeOne");return [o(e),o(t)]}a(yc,"normalizePhoneComparands");function ya(e,t){return e==="currency"?H(t):e==="date"?ee(t)?ge(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}a(ya,"normalizeComparableValue");function hc(e){let t=a(r=>typeof r!="object"||r===null?r:r.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}a(hc,"normalizeReferenceIds");var ha="today";function Pt(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}a(Pt,"dateInTimezone");function Ac(e,t){if(!("defaultValue"in e))return;let{defaultValue:r}=e;return e.type!=="date"||r!==ha?r:e.includeTime?t.now.toISOString():Pt(t.now,t.timezone)}a(Ac,"resolveAttributeDefaultValue");function zx(e,t,r){if(e.combinator==="or"&&e.rules.length>1)return {};let n=new Map(t.map(a=>[a.name,a])),o={};for(let a of e.rules){if(a.property!==void 0||Object.hasOwn(o,a.attribute))continue;let s=n.get(a.attribute);if(!s)continue;let l=Tc(a,r);l!==void 0&&(o[a.attribute]=j(s).storage.cardinality==="many"?[l]:l);}return o}a(zx,"deriveCreateDefaultsFromFilters");function Tc(e,t){if(e.operator==="is")return D$1(e.value)?Aa(e.value,t):e.value===null||Array.isArray(e.value)?void 0:e.value;if(e.operator==="any_of"){if(!Array.isArray(e.value)||e.value.length!==1)return;let r=e.value[0];return D$1(r)?Aa(r,t):r}}a(Tc,"extractDeterministicValue");function Aa(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return Pt(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}a(Aa,"resolveDynamicValue");var Kx={status:"connector_status",error:"connector_error",provider:"connector_provider"};var wc=(t=>(t.Desktop="desktop",t))(wc||{});var Qx=["force","skip"],Jx=["none","all","external_only"],Xx="x-fake-signature",Zx={override:null,status:"none",failureReason:null,botId:null};var xc=/^Session \d+$/;function Ta(e){let t=e.replace(/\s+/g," ").trim().replace(/[.!?]+$/,"");return t?t.length>60?`${t.slice(0,59).trimEnd()}...`:t:"New conversation"}a(Ta,"buildAgentFallbackTitle");function Ic(e){let t=e.generated?.trim();return t&&!xc.test(t)?t:e.firstUserText?Ta(e.firstUserText):e.emptyLabel}a(Ic,"conversationDisplayTitle");var ai=/^[a-z0-9][a-z0-9-]{0,62}$/;function Sc(e){if(!ai.test(e))throw new h(`Invalid schema source id "${e}": expected a lowercase slug matching ${ai}`,[])}a(Sc,"assertSchemaSourceId");function vc(e){return {label:e.label,description:e.description??null,icon:e.icon??null,config:e.config,default:e.default??false,metadata:e.metadata??null}}a(vc,"viewSyncPayload");function uI(e){let{attributeRemovals:t,objectRemovals:r,renames:n}=e.destructive;return t.length>0||r.length>0||n.length>0}a(uI,"hasDestructiveEntries");var $={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function ui(e){return e instanceof Error?e.message:String(e)}a(ui,"errorMessage");var Rc=z$1.enum(["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"]).describe('The attribute\'s data type. Determines which keys `config` accepts and requires: `status`/`select`/`multiselect` need a non-empty `options` array (each `status` option carrying its own `group`); `relation` needs `targets` (non-empty) and `cardinality` ("one" or "many"); `formula` needs `expression` and `returnType`; `rollup` needs `targetAttribute` and `function`. Every other type accepts only the shared presentation keys (`placeholder`, `defaultValue`, `icon`, ...) plus a few type-specific optionals (e.g. `number.decimals`, `date.dateFormat`). An attribute\'s type can never be changed later through this tool \u2014 only through a code migration \u2014 so pick it correctly now.');var Ea=z$1.string().min(1).superRefine((e,t)=>{try{Ne(e);}catch(r){t.addIssue({code:z$1.ZodIssueCode.custom,message:ui(r)});}}).describe('The attribute\'s machine name \u2014 the record\'s field key, and what `{{ name }}` refers to in a labelExpression. Must be a valid identifier: starts with a letter or underscore, then only letters/digits/underscores ("montantHt", "first_name", "FIRST_NAME" are valid; "first-name", "first name", "123name" are not). Max 63 characters. Cannot be a name reserved by the record shape itself (id, createdAt, updatedAt, createdBy, lastUpdatedBy, objectId, label, embeddingText, values, metadata, deletedAt, deletedBy, schemaVersion).'),Ec=z$1.string().min(1).superRefine((e,t)=>{w$1(e)&&t.addIssue({code:z$1.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${C$1.join(", ")}) and cannot be used for a new object.`});try{Ce(e);}catch(r){t.addIssue({code:z$1.ZodIssueCode.custom,message:ui(r)});}}).describe(`The new object's machine name: kebab-case slug, lowercase letters/digits/hyphens only, starting with a letter ("products", "user-profiles", "order-items" are valid; "Products", "userProfiles", "user_profiles" are not). Max 63 characters. Cannot be a name the platform reserves for its own system objects, and cannot already exist.`);function Da(e){return e.superRefine((t,r)=>{try{let n$1=n(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(n$1,a));o.length>0&&r.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(n){if(n instanceof h){for(let o of n.errors)r.addIssue({code:z$1.ZodIssueCode.custom,path:["config",...o.path.map(a=>/^\d+$/.test(a)?Number(a):a)],message:`Config for type "${t.type}" is invalid or incomplete: ${o.message}`});return}r.addIssue({code:z$1.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${ui(n)}`});}})}a(Da,"withConfigCheck");var Ca=z$1.object({objectName:z$1.string().min(1).describe("Name of the existing (or, elsewhere in the same plan, newly created) object this attribute is added to. Ignored for an attribute declared inline in `additive.objects[].attributes` \u2014 there the parent object's own `name` is used instead."),name:Ea,label:z$1.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:Rc,config:z$1.record(z$1.string(),z$1.unknown()).optional().describe('Type-specific configuration; required keys depend on `type` (see `type`\'s description). Shared optional keys on every type: `placeholder`, `defaultValue`, `icon`, `order`, `hidden`, `archived`, `deprecated`, `metadata`. Per-type keys: `text` \u2014 `multiline`, `minLength`, `maxLength`, `pattern`, `format` ("email"|"url"|"slug"); `number` \u2014 `renderAs` ("number"|"rating"), `min`, `max`, `unit`, `decimals`; `date` \u2014 `dateFormat`, `minDate`, `maxDate`, `includeTime`, `endDate`, `timeFormat` ("12h"|"24h"); `phone` \u2014 `defaultCountryCode` (3-letter); `currency` \u2014 `defaultCurrency`, `allowedCurrencies`, `allowNegative`; `status`/`select`/`multiselect` \u2014 `options` (REQUIRED, non-empty array of `{ value, label, color }`, unique `value`s; for `status` every OPTION also carries `group` as idle|in_progress|finished \u2014 `group` belongs on each option, never on `config` itself; select/multiselect accept `renderAs: "badges"`); `location` \u2014 `granularity`, `defaultCountry`, `allowedCountries`; `user` \u2014 `types` ("user"|"agent"), `multiple`; `relation` \u2014 `targets` (REQUIRED, non-empty array of `{ object }`) and `cardinality` (REQUIRED, "one"|"many"); `formula` \u2014 `expression` (REQUIRED formula string) and `returnType` (REQUIRED); `rollup` \u2014 `targetAttribute` (REQUIRED) and `function` (REQUIRED, e.g. "sum"|"avg"|"count"); `document` \u2014 `properties`, `accepts`, `maxFileSize`. Omit entirely for `richtext`/`checkbox`, which take no type-specific keys.'),required:z$1.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:z$1.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),Dc=Da(Ca),Cc=Da(Ca.omit({objectName:true})),Nc=z$1.object({name:Ec,label:z$1.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:z$1.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:z$1.string().optional().describe("Help text describing what this object represents."),icon:c.describe("Required icon name for the object. Must be a catalogue value \u2014 call `search_icons` and use a name it returns verbatim. A name that is not in the catalogue is rejected without any hint as to what would have worked, so never guess one."),labelExpression:ye.describe('Template used to render a human-readable label for every record of this object \u2014 e.g. shown in relations, search results, and breadcrumbs. MUST contain at least one `{{ attributeName }}` interpolation referencing an attribute this object will actually have (either declared in this same `attributes` array, or an existing attribute if this is an update) \u2014 a plain string with no `{{ }}` at all (e.g. "Devis") is rejected. Interpolations cannot be empty (`{{ }}` is rejected) and only these pipes are allowed: UPPER, LOWER, capitalize, trim, prefix:"...", suffix:"...", wrap:"..." "...", default:"...". `{{ a || b }}` falls back to `b` when `a` is empty. Examples: "{{ firstName }} {{ lastName }}", "{{ numero | UPPER }}", "{{ name || reference }}".'),attributes:z$1.array(Cc).default([]).describe("Attributes to create on this new object, inline. Same rules as a standalone entry in `additive.attributes`, minus `objectName` (implied by this object). At least one attribute referenced by `labelExpression` should be included here.")}).strict(),Na=z$1.object({attributeRemovals:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object the attribute is removed from."),attributeName:z$1.string().min(1).describe("Attribute to delete, together with every record's stored value for it. Must not be a system (code-declared) attribute, and must not be referenced by the object's own `labelExpression` or `embeddingExpression` \u2014 update those first.")}).strict()).default([]).describe("Attributes to permanently delete. Irreversible: record values for the attribute are purged."),objectRemovals:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object to delete entirely, together with all its records. Must not be a system (code-declared) object, and must not still be targeted by a `relation` attribute on another object \u2014 retarget or remove that relation first.")}).strict()).default([]).describe("Objects to permanently delete, records included. Irreversible."),renames:z$1.array(z$1.object({objectName:z$1.string().min(1).describe("Object the renamed attribute belongs to."),from:z$1.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:Ea.describe("New attribute name \u2014 same identifier rules as any attribute `name` (see `name` on a planned attribute), and must not collide with another name already on the object, including one added elsewhere in this same plan.")}).strict()).default([]).describe("Attribute renames. Every reference to the old name (labelExpression, views, formulas) must be updated separately \u2014 a rename does not follow references automatically.")}).strict().default({attributeRemovals:[],objectRemovals:[],renames:[]}),Oa=z$1.string().min(1).describe("ONE sentence naming the intent of the change \u2014 what it is for, not what it contains. The human approving it has already watched every entry land in the preview window and can read every row of the plan itself, so a recap tells them nothing they do not have. A second sentence is warranted only when `destructive` is non-empty: say plainly what will be lost (e.g. 'deletes the \"ancienMontant\" column and its data on every devis'). Never restate the plan \u2014 explain intent."),wa="The COMPLETE config this view should end up with \u2014 not a patch. Copy the baseline returned by get_default_view and edit it, preserving every tab and setting you are not changing: anything you omit is dropped. To change the columns shown, set `tabs[].columns` (an array of attribute names) \u2014 there is no top-level `columns` on either view type. For a detail view's side panel, set `sidePanel.attributes`. Every attribute name listed must already exist on the object, or be created earlier in this same plan. ONE EXCEPTION to omit-is-dropped: a tab with `type: \"custom\"` renders a component belonging to the application, which you cannot describe or recreate. Copy every such tab through from the baseline exactly as it came, `name`, `component` and `props` untouched \u2014 dropping one, inventing one, or altering any of those three is rejected rather than applied (`name` is the tab's address in links, not its wording). Its `label` and `icon` you may change.",xa="Opaque token returned by get_default_view alongside the baseline you edited. REQUIRED when the object already exists \u2014 it proves you authored against the baseline that is still current. Must be OMITTED when this plan creates the object, which has no baseline yet.",Ia=z$1.string().min(1).describe("Name of the object whose default view of this type is replaced. Not a view name \u2014 a plan can only replace an object's deterministic default view, never create a view or target a non-default one."),Oc=z$1.discriminatedUnion("viewType",[z$1.object({objectName:Ia,viewType:z$1.literal("list").describe("Targets the object's default list view (the grid)."),canonicalConfig:ma$1.describe(wa),baselineToken:z$1.string().min(1).optional().describe(xa)}).strict(),z$1.object({objectName:Ia,viewType:z$1.literal("detail").describe("Targets the object's default detail view (the single-record view)."),canonicalConfig:na$1.describe(wa),baselineToken:z$1.string().min(1).optional().describe(xa)}).strict()]);var Sa=z$1.string().regex(/^[0-9a-f]{64}$/,"Expected a lowercase SHA-256 hash"),va={baseConfigHash:Sa.nullable(),targetConfigHash:Sa,baselineOrigin:z$1.enum(["persisted","generated","absent"])},kc=z$1.discriminatedUnion("viewType",[z$1.object({objectName:z$1.string().min(1),viewType:z$1.literal("list"),canonicalConfig:ma$1,...va}).strict(),z$1.object({objectName:z$1.string().min(1),viewType:z$1.literal("detail"),canonicalConfig:na$1,...va}).strict()]).superRefine((e,t)=>{let r=e.baselineOrigin!=="absent";r!==(e.baseConfigHash!==null)&&t.addIssue({code:"custom",path:["baseConfigHash"],message:r?`A ${e.baselineOrigin} baseline requires baseConfigHash`:"An absent baseline requires baseConfigHash to be null"});});function ka(e){return z$1.object({objects:z$1.array(Nc).default([]).describe("New objects to create, with their attributes inline."),attributes:z$1.array(Dc).default([]).describe("Attributes to add to existing or same-plan objects."),viewUpdates:z$1.array(e).default([]).describe("Complete target configs for deterministic default views; never view names.")}).strict().default({objects:[],attributes:[],viewUpdates:[]})}a(ka,"buildAdditiveSchema");function si(e,t=[],r=new WeakSet){if(e===null||typeof e=="string"||typeof e=="boolean")return null;if(typeof e=="number")return Number.isFinite(e)?null:{path:t,message:"Plan input contains a non-finite number"};if(typeof e!="object")return {path:t,message:"Plan input must contain only JSON-safe values"};if(r.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){r.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return r.delete(e),{path:[...t,s],message:"Plan input arrays cannot contain non-index JSON properties"};for(let s=0;s<e.length;s++){if(!Object.hasOwn(e,s))return r.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let l=si(e[s],[...t,s],r);if(l)return r.delete(e),l}return r.delete(e),null}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};r.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let l=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(l?.enumerable&&"value"in l))return r.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let l=si(o[s],[...t,s],r);if(l)return r.delete(e),l}return r.delete(e),null}a(si,"findJsonSafetyIssue");function _c(e){let t=[];return e.additive.objects.forEach((r,n)=>{t.push(["additive","objects",n]),r.attributes.forEach((o,a)=>{t.push(["additive","objects",n,"attributes",a]);});}),e.additive.attributes.forEach((r,n)=>{t.push(["additive","attributes",n]);}),e.additive.viewUpdates.forEach((r,n)=>{t.push(["additive","viewUpdates",n]);}),e.destructive.attributeRemovals.forEach((r,n)=>{t.push(["destructive","attributeRemovals",n]);}),e.destructive.objectRemovals.forEach((r,n)=>{t.push(["destructive","objectRemovals",n]);}),e.destructive.renames.forEach((r,n)=>{t.push(["destructive","renames",n]);}),t}a(_c,"mutationPaths");function _a(e,t){e.additive.objects.length>$.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:$.objectAdditions,inclusive:true,path:["additive","objects",$.objectAdditions],message:`A schema plan can add at most ${$.objectAdditions} objects`});let r=_c(e);r.length>$.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:$.totalMutations,inclusive:true,path:r[$.totalMutations],message:`A schema plan can contain at most ${$.totalMutations} mutations; received ${r.length}`});}a(_a,"addPlanLimitIssues");function Pa(e,t){let r=si(e);if(r)return t.addIssue({code:"custom",path:r.path,message:r.message}),z$1.NEVER;let n=new TextEncoder().encode(b$3(e)).byteLength;return n>$.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:$.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${$.serializedBytes} UTF-8 bytes; received ${n}`}),z$1.NEVER):e}a(Pa,"boundSerializedPlanInput");var Pc=ka(Oc),Fc=ka(kc),Ra=z$1.object({schemaPlanVersion:z$1.literal(2).describe("Required proposal contract version."),summary:Oa,additive:Pc,destructive:Na}).strict().superRefine((e,t)=>{let r=new Set(e.additive.objects.map(n=>n.name));e.additive.viewUpdates.forEach((n,o)=>{let a=["additive","viewUpdates",o,"baselineToken"];if(r.has(n.objectName)){n.baselineToken!==void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an object added by this plan must not include baselineToken"});return}n.baselineToken===void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an existing object requires baselineToken"});}),_a(e,t);}),wI=Object.assign(z$1.preprocess(Pa,Ra),{shape:Ra.shape}),Vc=z$1.object({schemaPlanVersion:z$1.literal(2),summary:Oa,additive:Fc,destructive:Na}).strict().superRefine(_a),xI=z$1.preprocess(Pa,Vc);var A=z$1.number().finite().nonnegative(),Va=z$1.enum(to),li=z$1.enum(ro),di=z$1.enum(no),ja=z$1.object({provider:Va,model:z$1.string().min(1)}).strict(),DI=z$1.object({speed:li.optional(),reasoning:di.optional()}).strict(),Ma=z$1.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),jc=z$1.object({model:ja.optional(),speed:li.optional(),reasoning:di.optional(),imageModel:Ma.optional()}).strict(),CI=jc.refine(e=>e.model!==void 0||e.speed!==void 0||e.reasoning!==void 0||e.imageModel!==void 0,{message:"At least one inference override is required"}),NI=z$1.object({model:ja.nullable().optional(),speed:li.nullable().optional(),reasoning:di.nullable().optional(),imageModel:Ma.nullable().optional()}).strict().refine(e=>Object.keys(e).length>0&&Object.values(e).every(t=>t!==void 0),{message:"At least one inference override is required"}),La=z$1.object({label:z$1.string(),denied:z$1.boolean().optional(),deletion:z$1.object({target:z$1.string().optional(),count:A.optional(),restorableDays:A.optional()}).strict().optional(),counts:z$1.record(z$1.string(),A).optional(),warnings:z$1.array(z$1.string()).optional()}).strict(),Mc=z$1.union([z$1.object({type:z$1.literal("text"),text:z$1.string()}).strict(),z$1.object({type:z$1.literal("reasoning"),text:z$1.string()}).strict(),z$1.object({type:z$1.literal("system"),code:z$1.enum(Xt)}).strict(),z$1.object({type:z$1.literal("error"),error:z$1.string(),errorClass:z$1.string().optional()}).strict(),z$1.object({type:z$1.literal("tool"),toolCallId:z$1.string(),name:z$1.string(),args:z$1.record(z$1.string(),z$1.unknown()),result:z$1.unknown().optional(),error:z$1.string().optional(),errorCode:z$1.enum(["output_limit_reached","interrupted"]).optional(),state:z$1.enum(["streaming","running","completed","error","approval-requested","approval-responded","approval-dispatched"]),durationMs:A.optional(),approvalId:z$1.string().optional(),approvalImpact:La.optional(),approved:z$1.boolean().optional(),approvalReason:z$1.string().optional(),approvalRelaxableByAuto:z$1.boolean().optional()}).strict(),z$1.object({type:z$1.literal("file"),fileId:z$1.string(),name:z$1.string(),mimeType:z$1.string()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("in-progress"),reason:z$1.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:A.optional(),reportedTokens:A.optional()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("completed"),tokensBefore:A,tokensAfter:A,tokensSaved:A,strategy:z$1.enum(["no-op","summary","truncation"]),durationMs:A,summary:z$1.string().optional()}).strict(),z$1.object({type:z$1.literal("compaction"),state:z$1.literal("failed"),reason:z$1.string(),durationMs:A.optional()}).strict()]),Lc=z$1.object({id:z$1.string(),name:z$1.string(),mimeType:z$1.string(),size:A}).strict(),Bc=z$1.object({id:z$1.string(),type:z$1.string().transform(e=>e),entityId:z$1.string(),label:z$1.string(),objectName:z$1.string().optional(),startIndex:A,endIndex:A}).strict(),Uc=z$1.object({provider:Va,model:z$1.string(),maxTokens:A.optional(),contextWindow:A.optional()}).strict(),$c=z$1.union([z$1.date(),z$1.string().datetime({offset:true}).transform(e=>new Date(e))]),Fa=z$1.object({id:z$1.string(),sessionId:z$1.string(),tenantId:z$1.string().optional(),runId:z$1.string().optional(),role:z$1.enum(["user","assistant","system","tool"]),parts:z$1.array(Mc),attachments:z$1.array(Lc).optional(),mentions:z$1.array(Bc).optional(),model:Uc.optional(),tokenUsage:z$1.object({input:A,output:A}).strict().optional(),metadata:z$1.record(z$1.string(),z$1.unknown()).optional(),createdAt:$c}).strict(),qc=z$1.object({id:z$1.string(),description:z$1.string(),status:z$1.enum(["pending","in_progress","completed","blocked"]),result:z$1.string().optional(),updatedAt:A.optional()}).strict(),zc=z$1.object({id:z$1.string(),sessionId:z$1.string(),status:z$1.enum(["active","completed","abandoned"]),todos:z$1.array(qc),version:A,createdAt:z$1.string(),updatedAt:z$1.string(),completedAt:z$1.string().optional()}).strict(),Ba={"session-named":z$1.object({name:z$1.string()}).strict(),"compaction-start":z$1.object({reason:z$1.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:A.optional(),reportedTokens:A.optional()}).strict(),"compaction-end":z$1.object({tokensBefore:A,tokensAfter:A,tokensSaved:A,strategy:z$1.enum(["no-op","summary","truncation"]),durationMs:A,summary:z$1.string().optional()}).strict(),"compaction-failed":z$1.object({reason:z$1.string()}).strict(),usage:z$1.object({messageId:z$1.string().min(1).optional(),inputTokens:A,outputTokens:A,totalTokens:A,cacheReadTokens:A.optional(),cacheCreationTokens:A.optional(),contextWindow:A,residentTokens:A,utilization:z$1.number().finite().min(0).max(1),costUsd:A.optional()}).strict(),"message-persisted":z$1.object({message:Fa}).strict(),"message-updated":z$1.object({message:Fa}).strict(),"todo-plan-update":z$1.object({plan:zc}).strict(),"approval-context":z$1.object({approvalId:z$1.string(),toolCallId:z$1.string(),impact:La.optional(),relaxableByAuto:z$1.boolean().optional()}).strict(),"session-state":z$1.object({state:z$1.object({phase:z$1.enum(["queued","running","parked","terminal"]),parkedOn:z$1.enum(["human","agents"]).optional(),humanRequestIds:z$1.array(z$1.string()).optional(),outcome:z$1.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:z$1.number().int().positive(),updatedAt:z$1.string().datetime({offset:true})}).strict()};function Gc(e){return e in Ba}a(Gc,"isAgentUIDataName");function Wc(e){return new h("Invalid agent UI message chunk",e.map(t=>({path:t.path.map(String),message:t.message,code:t.code})))}a(Wc,"agentUIValidationError");function Kc(e){if(typeof e!="object"||e===null||typeof e.type!="string")throw new h("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 h("Invalid agent UI message chunk",[{path:["type"],message:"Expected agent data chunk type",code:"invalid_value"}]);let r=t.slice(5);if(!Gc(r))throw new h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${r}`,code:"invalid_value"}]);let n=z$1.object({type:z$1.literal(`data-${r}`),id:z$1.string().optional(),data:Ba[r],transient:z$1.boolean().optional()}).strict().safeParse(e);if(!n.success)throw Wc(n.error.issues);return n.data}a(Kc,"assertCustomAgentUIMessageChunk");function OI(e,t,r){return Kc({type:`data-${e}`,...r?.id!==void 0?{id:r.id}:{},data:t,...r?.transient!==void 0?{transient:r.transient}:{}})}a(OI,"agentDataChunk");function Ft(e){return e}a(Ft,"defineOperation");function g(e,t,r){let n=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=r?.(o);return {impact:t,navigation:n,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}a(g,"definePresentation");var ci={id:z$1.string().min(1)},S={...ci,viewId:z$1.string().min(1)},Yc={add_tab:"add_list_tab",add_list_tab:"add_tab"};function ne(e,t,r,n,o){let a=e.views.find(s=>s.id===t);if(!a)throw new h(`View "${t}" is not in the draftable state`,[]);if(a.type!==r){let s=Yc[o]??`a ${a.type}-view operation`;throw new h(`${o} targets ${a.type} view "${t}"; use ${s}`,[])}return {...e,views:e.views.map(s=>{if(s.id!==t)return s;let{derived:l,...p}=n(s);return p})}}a(ne,"mapView");function $a(e,t,r){let n=[...e],[o]=n.splice(t,1);return n.splice(r,0,o),n}a($a,"moveWithin");function Le(e,t,r){if(t.length!==e.length)throw new h(`${r} order lists ${t.length} ids for ${e.length} items`,[]);return t.map(n=>{let o=e.find(a=>a.id===n);if(!o)throw new h(`${r} "${n}" is not in this collection`,[]);return o})}a(Le,"reorderById");function _(e,t,r,n){return ne(e,t,"detail",r,n)}a(_,"mapDetailView");function ie(e,t,r){let n=e.tabs.find(o=>o.id===t);if(!n)throw new h(`Tab "${t}" is not in view "${e.id}"`,[]);if(n.type!=="form")throw new h(`Tab "${t}" is not a form tab`,[]);return {...e,tabs:e.tabs.map(o=>o.id===t?r(n):o)}}a(ie,"mapFormTab");function Mt(e,t){let r=e.groups.find(n=>n.id===t);if(!r)throw new h(`Group "${t}" is not in tab "${e.id}"`,[]);return r}a(Mt,"requireGroup");function pi(e,t){for(let r of e.groups){let n=r.fields.find(o=>o.id===t);if(n)return {group:r,field:n}}throw new h(`Field slot "${t}" is not in tab "${e.id}"`,[])}a(pi,"locateField");function Vt(e){return {viewId:e.viewId}}a(Vt,"viewFocus");function jt(e){return {viewId:e.viewId,tabId:e.tabId}}a(jt,"tabFocus");function qa(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}}a(qa,"groupFocus");function za(e){return {viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}}a(za,"fieldFocus");function Ga(e){return {viewId:e.viewId,tabId:e.tab.id}}a(Ga,"addTabFocus");function Wa(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.group.id}}a(Wa,"addGroupFocus");function Ka(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId,fieldId:e.field.id}}a(Ka,"addFieldFocus");function Ya(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.toGroupId,fieldId:e.fieldId}}a(Ya,"moveFieldFocus");function Be(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(Be,"firstChangedProperty");var Hc=ka$1,Qc=fa$1,Jc=ea$1,Xc=z$1.object({...S,type:z$1.literal("add_tab"),tab:Hc}),Zc={type:"add_tab",schema:Xc,apply:a((e,t)=>_(e,t.viewId,r=>{if(r.tabs.some(n=>n.id===t.tab.id))throw new h(`Tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,tabs:[...r.tabs,t.tab]}},"add_tab"),"apply"),focus:Ga,presentation:g(Ga,"local"),describe:a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},ep=z$1.object({...S,type:z$1.literal("remove_tab"),tabId:z$1.string().min(1)}),tp={type:"remove_tab",schema:ep,apply:a((e,t)=>_(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.filter(n=>n.id!==t.tabId)}},"remove_tab"),"apply"),focus:jt,presentation:g(jt,"local"),describe:a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},es=z$1.object({label:z$1.string().min(1).optional(),icon:c.optional(),order:z$1.number().int().optional()}),rp=Object.keys(es.shape),np=z$1.object({...S,type:z$1.literal("update_tab"),tabId:z$1.string().min(1),changes:es.refine(e=>Object.keys(e).length>0,"update_tab needs at least one change")}),Ha=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabFocus"),ip={type:"update_tab",schema:np,apply:a((e,t)=>_(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.map(n=>n.id===t.tabId?{...n,...t.changes}:n)}},"update_tab"),"apply"),focus:Ha,presentation:g(Ha,"atomic",Be),describe:a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},op=z$1.object({...S,type:z$1.literal("reorder_tabs"),tabOrder:z$1.array(z$1.string().min(1))}),ap={type:"reorder_tabs",schema:op,apply:a((e,t)=>_(e,t.viewId,r=>({...r,tabs:Le(r.tabs,t.tabOrder,"Tab")}),"reorder_tabs"),"apply"),focus:Vt,presentation:g(Vt,"local"),describe:a(()=>"R\xE9ordonne les onglets","describe")},sp=z$1.object({...S,type:z$1.literal("add_group"),tabId:z$1.string().min(1),group:Qc}),up={type:"add_group",schema:sp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>{if(n.groups.some(o=>o.id===t.group.id))throw new h(`Group "${t.group.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:[...n.groups,t.group]}}),"add_group"),"apply"),focus:Wa,presentation:g(Wa,"local"),describe:a(e=>`Ajoute le groupe \xAB ${e.group.label} \xBB`,"describe")},lp=z$1.object({...S,type:z$1.literal("remove_group"),tabId:z$1.string().min(1),groupId:z$1.string().min(1)}),dp={type:"remove_group",schema:lp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>(Mt(n,t.groupId),{...n,groups:n.groups.filter(o=>o.id!==t.groupId)})),"remove_group"),"apply"),focus:qa,presentation:g(qa,"local"),describe:a(e=>`Supprime le groupe ${e.groupId}`,"describe")},cp=z$1.object({...S,type:z$1.literal("update_group"),tabId:z$1.string().min(1),groupId:z$1.string().min(1),changes:z$1.object({label:z$1.string().min(1).optional(),description:z$1.string().optional(),collapsible:z$1.boolean().optional(),collapsed:z$1.boolean().optional(),order:z$1.number().int().optional()}).refine(e=>Object.keys(e).length>0,"update_group needs at least one change")}),Qa=a(e=>({viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}),"updateGroupFocus"),pp={type:"update_group",schema:cp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>(Mt(n,t.groupId),{...n,groups:n.groups.map(o=>o.id===t.groupId?{...o,...t.changes}:o)})),"update_group"),"apply"),focus:Qa,presentation:g(Qa,"atomic",Be),describe:a(e=>e.changes.label?`Renomme le groupe en \xAB ${e.changes.label} \xBB`:"Modifie le groupe","describe")},mp=z$1.object({...S,type:z$1.literal("reorder_groups"),tabId:z$1.string().min(1),groupOrder:z$1.array(z$1.string().min(1))}),fp={type:"reorder_groups",schema:mp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>({...n,groups:Le(n.groups,t.groupOrder,"Group")})),"reorder_groups"),"apply"),focus:jt,presentation:g(jt,"local"),describe:a(()=>"R\xE9ordonne les groupes","describe")},bp=z$1.object({...S,type:z$1.literal("add_field"),tabId:z$1.string().min(1),groupId:z$1.string().min(1),field:Jc,index:z$1.number().int().min(0).optional()}),gp={type:"add_field",schema:bp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>{if(Mt(n,t.groupId),n.groups.some(o=>o.fields.some(a=>a.id===t.field.id)))throw new h(`Field slot "${t.field.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:n.groups.map(o=>{if(o.id!==t.groupId)return o;let a=t.index??o.fields.length;return {...o,fields:[...o.fields.slice(0,a),t.field,...o.fields.slice(a)]}})}}),"add_field"),"apply"),focus:Ka,presentation:g(Ka,"local"),describe:a(e=>`Ajoute le champ ${e.field.attribute??e.field.id}`,"describe")},yp=z$1.object({...S,type:z$1.literal("remove_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1)}),hp={type:"remove_field",schema:yp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>{let{group:o}=pi(n,t.fieldId);return {...n,groups:n.groups.map(a=>a.id===o.id?{...a,fields:a.fields.filter(s=>s.id!==t.fieldId)}:a)}}),"remove_field"),"apply"),focus:za,presentation:g(za,"local"),describe:a(e=>`Retire le champ ${e.fieldId}`,"describe")},Ap=z$1.object({...S,type:z$1.literal("move_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1),toGroupId:z$1.string().min(1),toIndex:z$1.number().int().min(0)}),Tp={type:"move_field",schema:Ap,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>{let{group:o,field:a}=pi(n,t.fieldId),s=Mt(n,t.toGroupId);if(o.id===s.id){let l=o.fields.findIndex(p=>p.id===t.fieldId);return {...n,groups:n.groups.map(p=>p.id===o.id?{...p,fields:$a(p.fields,l,t.toIndex)}:p)}}return {...n,groups:n.groups.map(l=>l.id===o.id?{...l,fields:l.fields.filter(p=>p.id!==t.fieldId)}:l.id===s.id?{...l,fields:[...l.fields.slice(0,t.toIndex),a,...l.fields.slice(t.toIndex)]}:l)}}),"move_field"),"apply"),focus:Ya,presentation:g(Ya,"local"),describe:a(e=>`D\xE9place le champ ${e.fieldId} vers le groupe ${e.toGroupId}`,"describe")},wp=z$1.object({...S,type:z$1.literal("update_field"),tabId:z$1.string().min(1),fieldId:z$1.string().min(1),changes:z$1.object({label:z$1.string().optional(),readOnly:z$1.boolean().optional(),span:z$1.number().int().min(1).max(12).optional()}).refine(e=>Object.keys(e).length>0,"update_field needs at least one change")}),Ja=a(e=>({viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}),"updateFieldFocus"),xp={type:"update_field",schema:wp,apply:a((e,t)=>_(e,t.viewId,r=>ie(r,t.tabId,n=>(pi(n,t.fieldId),{...n,groups:n.groups.map(o=>({...o,fields:o.fields.map(a=>a.id===t.fieldId?{...a,...t.changes}:a)}))})),"update_field"),"apply"),focus:Ja,presentation:g(Ja,"atomic",Be),describe:a(e=>`Modifie le champ ${e.fieldId}`,"describe")},ts=z$1.object({source:ia$1.optional(),columns:Z.optional(),filters:aa$1.nullable().optional(),sorts:$$1.nullable().optional(),allowCreate:z$1.boolean().optional(),allowEdit:z$1.boolean().optional(),allowDelete:z$1.boolean().optional(),createMode:z$1.enum(["redirect","inline","peek"]).optional()}),Ip=Object.keys(ts.shape),rs=z$1.object({emailAttributeIds:z$1.array(z$1.string().min(1)).optional(),attribute:z$1.string().min(1).optional(),titleAttribute:z$1.string().min(1).nullable().optional(),component:z$1.string().nullable().optional(),props:z$1.record(z$1.string(),z$1.unknown()).nullable().optional()}),Sp=Object.keys(rs.shape),vp={emailAttributeIds:["emails","meetings"],attribute:["richtext"],titleAttribute:["richtext"],component:["custom"],props:["custom"]},Rp=z$1.object({...S,type:z$1.literal("update_tab_config"),tabId:z$1.string().min(1),changes:rs.refine(e=>Object.keys(e).length>0,"update_tab_config needs at least one change")}),Xa=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabConfigFocus"),Ep={type:"update_tab_config",schema:Rp,apply:a((e,t)=>_(e,t.viewId,r=>{let n=r.tabs.find(o=>o.id===t.tabId);if(!n)throw new h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);for(let o of Object.keys(t.changes)){let a=vp[o];if(a&&!a.includes(n.type))throw new h(`"${o}" is not a setting of a "${n.type}" tab`,[])}return {...r,tabs:r.tabs.map(o=>o.id===t.tabId?{...o,...t.changes}:o)}},"update_tab_config"),"apply"),focus:Xa,presentation:g(Xa,"atomic",Be),describe:a(e=>`Configure ${Object.keys(e.changes).join(", ")} sur l'onglet ${e.tabId}`,"describe")},Dp=z$1.object({...S,type:z$1.literal("update_table_tab"),tabId:z$1.string().min(1),changes:ts.refine(e=>Object.keys(e).length>0,"update_table_tab needs at least one change")}),Za=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTableTabFocus"),Cp={type:"update_table_tab",schema:Dp,apply:a((e,t)=>_(e,t.viewId,r=>{let n=r.tabs.find(l=>l.id===t.tabId);if(!n)throw new h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);if(n.type!=="table")throw new h(`Tab "${t.tabId}" is not a table tab`,[]);let o=Object.entries(t.changes),a=Object.fromEntries(o.filter(([,l])=>l!==null)),s=new Set(o.filter(([,l])=>l===null).map(([l])=>l));return {...r,tabs:r.tabs.map(l=>l.id===t.tabId?Object.fromEntries(Object.entries({...l,...a}).filter(([p])=>!s.has(p))):l)}},"update_table_tab"),"apply"),focus:Za,presentation:g(Za,"atomic",Be),describe:a(e=>e.changes.columns?`Affiche ${e.changes.columns.length} colonne(s) dans l'onglet ${e.tabId}`:`Modifie l'onglet ${e.tabId}`,"describe")},Np=z$1.object({...S,type:z$1.literal("set_side_panel"),sidePanel:z$1.object({attributes:z$1.array(z$1.string().min(1)),width:z$1.number().int().min(1).optional()}).nullable()}),Op={type:"set_side_panel",schema:Np,apply:a((e,t)=>_(e,t.viewId,r=>({...r,config:{...r.config,sidePanel:t.sidePanel??void 0}}),"set_side_panel"),"apply"),focus:Vt,presentation:g(Vt,"atomic",()=>["config","sidePanel"]),describe:a(e=>e.sidePanel?"Active le panneau lat\xE9ral":"Retire le panneau lat\xE9ral","describe")},ns=[Zc,tp,ip,ap,up,dp,pp,fp,gp,hp,Tp,xp,Cp,Ep,Op];var Ue={...S,tabId:z$1.string().min(1)};function Lt(e){return {viewId:e.viewId}}a(Lt,"viewFocus");function oe(e){return {viewId:e.viewId,tabId:e.tabId}}a(oe,"tabFocus");function is(e){return {viewId:e.viewId,tabId:e.tab.id}}a(is,"addTabFocus");function kp(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(kp,"firstChangedProperty");function as(e){let t={...e};for(let r of sa$1)delete t[r];return t}a(as,"withoutKanbanKeys");function ss(e){let t={...e};for(let r of ra$1)delete t[r];return t}a(ss,"withoutTableKeys");function _p(e,t,r,n){let o=la$1.safeParse(t);if(!o.success){if(!la$1.safeParse(e).success)return t;let a=o.error.issues.map(s=>s.path.length?`${s.path.join(".")}: ${s.message}`:s.message).join(", ");throw new h(`List tab "${n}" in view "${r}" would no longer be publishable: ${a}`,[])}return t}a(_p,"assertStillPublishableTab");function Bt(e,t,r,n,o){return ne(e,t,"list",a=>{let s=a.config.tabs??[];if(!s.some(l=>l.id===r))throw new h(`List tab "${r}" is not in view "${t}"`,[]);return {...a,config:{...a.config,tabs:s.map(l=>l.id===r?_p(l,n(l),t,r):l)}}},o)}a(Bt,"mapListTab");var Pp=la$1,us=ba$1,Fp=$$1;function Y(e,t,r,n){let o=z$1.object({...Ue,type:z$1.literal(e),value:r});return {type:e,schema:o,apply:a((a,s)=>Bt(a,s.viewId,s.tabId,l=>{if(s.value===null){let{[t]:p,...I}=l;return I}return {...l,[t]:s.value}},e),"apply"),focus:oe,presentation:g(oe,"atomic",()=>[String(t)]),describe:a(a=>n(a.value),"describe")}}a(Y,"setOnTab");var Vp=z$1.object({...S,type:z$1.literal("add_list_tab"),tab:Pp}),jp={type:"add_list_tab",schema:Vp,apply:a((e,t)=>ne(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(n.some(o=>o.id===t.tab.id))throw new h(`List tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:[...n,t.tab]}}},"add_list_tab"),"apply"),focus:is,presentation:g(is,"local"),describe:a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},Mp=z$1.object({...Ue,type:z$1.literal("remove_list_tab")}),Lp={type:"remove_list_tab",schema:Mp,apply:a((e,t)=>ne(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(!n.some(o=>o.id===t.tabId))throw new h(`List tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:n.filter(o=>o.id!==t.tabId)}}},"remove_list_tab"),"apply"),focus:oe,presentation:g(oe,"local"),describe:a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Bp=z$1.object({...Ue,type:z$1.literal("update_list_tab"),changes:z$1.object({label:z$1.string().min(1).optional(),icon:c.optional(),default:z$1.boolean().optional(),visibility:z$1.enum(y).optional()}).refine(e=>Object.keys(e).length>0,"update_list_tab needs at least one change")}),os=a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateListTabFocus"),Up={type:"update_list_tab",schema:Bp,apply:a((e,t)=>Bt(e,t.viewId,t.tabId,r=>({...r,...t.changes}),"update_list_tab"),"apply"),focus:os,presentation:g(os,"atomic",kp),describe:a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},$p=z$1.object({...S,type:z$1.literal("reorder_list_tabs"),tabOrder:z$1.array(z$1.string().min(1))}),qp={type:"reorder_list_tabs",schema:$p,apply:a((e,t)=>ne(e,t.viewId,"list",r=>({...r,config:{...r.config,tabs:Le(r.config.tabs??[],t.tabOrder,"List tab")}}),"reorder_list_tabs"),"apply"),focus:Lt,presentation:g(Lt,"local"),describe:a(()=>"R\xE9ordonne les onglets","describe")},zp=Y("set_columns","columns",z$1.array(z$1.string().min(1)),e=>`Affiche ${Array.isArray(e)?e.length:0} colonne(s)`),Gp=Y("set_column_sizing","columnSizing",z$1.record(z$1.string(),z$1.number().int().positive()),()=>"Ajuste la largeur des colonnes"),Wp=z$1.object({...Ue,type:z$1.literal("set_layout"),value:z$1.enum(["table","list","kanban"])}),Kp={type:"set_layout",schema:Wp,apply:a((e,t)=>Bt(e,t.viewId,t.tabId,r=>{if(t.value!=="kanban")return {...as(r),layout:t.value};if(r.groupByAttribute===void 0)throw new h(`List tab "${t.tabId}" cannot switch to kanban without a group attribute \u2014 use set_group_by, which switches the layout itself`,[]);return {...ss(r),layout:"kanban"}},"set_layout"),"apply"),focus:oe,presentation:g(oe,"atomic",()=>["layout"]),describe:a(e=>`Passe en affichage ${e.value}`,"describe")},Yp=z$1.object({...Ue,type:z$1.literal("set_group_by"),value:z$1.string().min(1).nullable()}),Hp={type:"set_group_by",schema:Yp,apply:a((e,t)=>Bt(e,t.viewId,t.tabId,r=>t.value===null?{...as(r),layout:"table"}:{...ss(r),layout:"kanban",groupByAttribute:t.value},"set_group_by"),"apply"),focus:oe,presentation:g(oe,"atomic",()=>["groupByAttribute"]),describe:a(e=>e.value?`Regroupe par ${e.value} en kanban`:"Retire le regroupement, retour en table","describe")},Qp=Y("set_filters","filters",us.nullable(),e=>e?"Modifie les filtres":"Retire les filtres"),Jp=Y("set_sorts","sorts",Fp.nullable(),e=>e?"Modifie le tri":"Retire le tri"),Xp=Y("set_create_mode","createMode",z$1.enum(["redirect","inline","peek"]),e=>`Cr\xE9ation en mode ${e}`),Zp=Y("set_read_only","readOnly",z$1.boolean(),e=>e?"Passe l'onglet en lecture seule":"Rend l'onglet modifiable"),em=Y("set_card_user_attribute","cardUserAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire l'utilisateur des cartes"),tm=Y("set_card_date_attribute","cardDateAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire la date des cartes"),rm=Y("set_description_attribute","descriptionAttribute",z$1.string().min(1).nullable(),e=>e?`Affiche ${e} en description`:"Retire la description"),nm=Y("set_display_attributes","displayAttributes",_$1.nullable(),e=>`Affiche ${Array.isArray(e)?e.length:0} attribut(s)`),im=z$1.object({...S,type:z$1.literal("set_default_filters"),filters:us.nullable()}),om={type:"set_default_filters",schema:im,apply:a((e,t)=>ne(e,t.viewId,"list",r=>{if(t.filters===null){let{defaultFilters:n,...o}=r.config;return {...r,config:o}}return {...r,config:{...r.config,defaultFilters:t.filters}}},"set_default_filters"),"apply"),focus:Lt,presentation:g(Lt,"atomic",()=>["config","defaultFilters"]),describe:a(e=>e.filters?"Modifie les filtres de la vue":"Retire les filtres de la vue","describe")},ls=[om,jp,Lp,Up,qp,zp,Gp,Kp,Hp,Qp,Jp,Xp,Zp,em,tm,rm,nm];function ds(e,t,r){let n=`fld_${e}_${t}`;return r===0?n:`${n}_${r}`}a(ds,"makeFieldId");function am(e,t){return e.attributeGroup?e.attributeGroup.id:e.attribute?e.attribute:`slot${t}`}a(am,"seedOf");function sm(e){let t=new Map,r=e.fields.map((n,o)=>{if(n.id)return n;let a=am(n,o),s=t.get(a)??0;return t.set(a,s+1),{...n,id:ds(e.id,a,s)}});return {...e,fields:r}}a(sm,"withIds");function mi(e){return e.map(t=>t.type==="form"?{...t,groups:t.groups.map(sm)}:t)}a(mi,"ensureFieldIds");function um(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}a(um,"toDraftableObject");function lm(e){let t=e.id??e.name;return (e.attributes??[]).map(r=>dm(r,t))}a(lm,"toDraftableAttributes");function Ut(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}a(Ut,"toAttribute");function dm(e,t){let{id:r,name:n,label:o,type:a,...s}=e;return {id:e.id??e.name,objectId:t,name:e.name,label:e.label??e.name,attributeType:e.type,config:s}}a(dm,"toDraftableAttribute");function cs(e){let t=e[0];return t?`{{ ${t.name} }}`:"{{ id }}"}a(cs,"draftedLabelExpression");function $t(e,t){let r=t.filter(n=>n.objectId===e.id);return {id:e.id,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon},labelExpression:cs(r),attributes:r.map((n,o)=>{let a=Ut(n);return a.order===void 0?{...a,order:o}:a})}}a($t,"draftedObjectDefinition");var cm=0x100000001b3n,pm=0xffffffffffffffffn;function ps(e,t){let r=t;for(let n of new TextEncoder().encode(e))r^=BigInt(n),r=r*cm&pm;return r}a(ps,"fnv1a64");function fi(e,t){let r=`${e.toLowerCase()}:${t}`,n=ps(r,0xcbf29ce484222325n).toString(16).padStart(16,"0"),o=ps(`${t}:${r}`,0x84222325cbf29ce4n).toString(16).padStart(16,"0"),a=n+o,s=(Number.parseInt(a[16],16)&3|8).toString(16);return [a.slice(0,8),a.slice(8,12),`8${a.slice(13,16)}`,`${s}${a.slice(17,20)}`,a.slice(20,32)].join("-")}a(fi,"viewIdFor");function bi(e){return {list:fi(e,"list"),detail:fi(e,"detail")}}a(bi,"defaultViewIdsFor");function ms(e,t,r){if(e==="list"){let s=Fe(r);return {id:t,objectName:s.object,type:"list",label:s.label,tabs:[],config:s.config,derived:true}}let n=Pe(r),{tabs:o,...a}=n.config;return {id:t,objectName:n.object,type:"detail",label:n.label,tabs:mi(o??[]),config:a,derived:true}}a(ms,"derivedView");function gi(e,t){let r=$t(e,t),n=bi(e.id);return ["list","detail"].map(o=>ms(o,n[o],r))}a(gi,"defaultViewsFor");function yi(e,t,r){return ms(e.type,e.id,$t(t,r))}a(yi,"regenerateDerived");function $e(e,t){let r=e.objects.find(n=>n.id===t);if(!r)throw new h(`Object "${t}" is not in the draftable state`,[]);return r}a($e,"requireObject");function hi(e,t,r){return {...e,attributes:[...r],views:e.views.map(n=>n.derived&&n.objectName===t.name?yi(n,t,r):n)}}a(hi,"withDerivedViews");function qt(e){return {objectId:e.objectId}}a(qt,"objectFocus");function zt(e){return {objectId:e.objectId,recordId:e.recordId}}a(zt,"recordFocus");function fs(e){return {objectId:e.objectId,attributeId:e.attributeId}}a(fs,"attributeFocus");function Gt(e){return {objectId:e.objectId,attributeName:e.attribute}}a(Gt,"existingAttributeFocus");function mm(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}a(mm,"firstChangedProperty");var ce={...ci,objectId:z$1.string().uuid()},fm=z$1.object({...ce,type:z$1.literal("add_object"),name:at,label:z$1.string().min(1),icon:z$1.string().min(1).optional()}),bm={type:"add_object",schema:fm,apply:a((e,t)=>{if(e.objects.some(n=>n.name===t.name))throw new h(`Object "${t.name}" already exists`,[]);if(e.objects.some(n=>n.id===t.objectId))throw new h(`Object id "${t.objectId}" is already taken`,[]);let r={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,r],views:[...e.views,...gi(r,e.attributes)]}},"apply"),focus:qt,presentation:g(qt,"structural"),describe:a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},gm=z$1.object({...ce,type:z$1.literal("update_object"),changes:z$1.object({label:z$1.string().min(1).optional(),icon:z$1.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change")}),bs=a(e=>({objectId:e.objectId}),"updateObjectFocus"),ym={type:"update_object",schema:gm,apply:a((e,t)=>($e(e,t.objectId),{...e,objects:e.objects.map(r=>r.id===t.objectId?{...r,...t.changes}:r)}),"apply"),focus:bs,presentation:g(bs,"atomic",mm),describe:a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},hm=z$1.object({...ce,type:z$1.literal("remove_object")}),Am={type:"remove_object",schema:hm,apply:a((e,t)=>{$e(e,t.objectId);let r=e.objects.find(n=>n.id===t.objectId)?.name;return {...e,objects:e.objects.filter(n=>n.id!==t.objectId),attributes:e.attributes.filter(n=>n.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(n=>n.objectId!==t.objectId),views:e.views.filter(n=>n.objectName!==r)}},"apply"),focus:qt,presentation:g(qt,"structural"),describe:a(e=>`Supprime l'objet ${e.objectId}`,"describe")},qe=Xi.filter(e=>e!=="formula"&&e!=="rollup"),Tm=z$1.object({...ce,type:z$1.literal("add_attribute"),attributeId:z$1.string().min(1),name:sr,label:z$1.string().min(1),attributeType:z$1.enum(qe),config:z$1.record(z$1.string(),z$1.unknown()).optional()}).superRefine((e,t)=>{try{n(e.attributeType,e.config??{});}catch(r){if(r instanceof h){for(let n of r.errors)t.addIssue({code:"custom",message:n.message,path:["config",...n.path??[]]});return}throw r}}),wm={type:"add_attribute",schema:Tm,apply:a((e,t)=>{let r=$e(e,t.objectId);if(e.attributes.some(a=>a.objectId===t.objectId&&a.name===t.name))throw new h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let n={id:t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let a of e.sampleRecords)a.objectId===t.objectId&&hs(a.id,n,a.values);let o=[...e.attributes,n];return hi(e,r,o)},"apply"),focus:fs,presentation:g(fs,"local"),describe:a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},gs={...ce,attribute:sr};function ys(e,t,r,n){let o=$e(e,t);if(r===void 0)throw new h(`${n} now addresses the attribute by name; remove this operation and append it again with "attribute"`,[]);let a=e.attributes.find(s=>s.objectId===t&&s.name===r);if(!a)throw new h(`Attribute "${r}" is not on object "${t}"`,[]);return {object:o,attribute:a}}a(ys,"requireAttribute");var xm=z$1.object({...gs,type:z$1.literal("update_attribute"),changes:z$1.object({label:z$1.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change")}),Im={type:"update_attribute",schema:xm,apply:a((e,t)=>{let{object:r,attribute:n}=ys(e,t.objectId,t.attribute,"update_attribute"),o=e.attributes.map(a=>a===n?{...a,...t.changes}:a);return hi(e,r,o)},"apply"),focus:Gt,presentation:g(Gt,"atomic"),describe:a(e=>e.changes.label?`Renomme l'attribut \xAB ${e.attribute} \xBB en \xAB ${e.changes.label} \xBB`:`Modifie l'attribut \xAB ${e.attribute} \xBB`,"describe")},Sm=z$1.object({...gs,type:z$1.literal("remove_attribute")}),vm={type:"remove_attribute",schema:Sm,apply:a((e,t)=>{let{object:r,attribute:n}=ys(e,t.objectId,t.attribute,"remove_attribute"),o=e.sampleRecords.find(s=>s.objectId===n.objectId&&n.name in s.values);if(o)throw new h(`Attribute "${n.name}" is still used by sample record "${o.id}"`,[]);let a=e.attributes.filter(s=>s!==n);return hi(e,r,a)},"apply"),focus:Gt,presentation:g(Gt,"local"),describe:a(e=>`Supprime l'attribut \xAB ${e.attribute} \xBB`,"describe")};function Rm(e,t,r,n){let o=Ut(r);try{c$2(o);}catch{return}let a=g$2(o,n);if(a.success)return;let s=a.errors??[],l=s.map(p=>p.message).join(", ");throw new h(`Sample record "${e}" has an invalid value for "${t}": ${l}`,s.map(p=>({path:p.path,message:p.message})))}a(Rm,"assertSampleValue");function hs(e,t,r){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in r&&r[t.name]!==void 0))throw new h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}a(hs,"assertRequiredCovered");var Em=z$1.object({...ce,type:z$1.literal("add_sample_record"),recordId:z$1.string().uuid(),values:z$1.record(z$1.string(),z$1.unknown())}),Dm={type:"add_sample_record",schema:Em,apply:a((e,t)=>{if($e(e,t.objectId),e.sampleRecords.some(n=>n.id===t.recordId))throw new h(`Sample record "${t.recordId}" already exists`,[]);let r=new Map(e.attributes.filter(n=>n.objectId===t.objectId).map(n=>[n.name,n]));for(let[n,o]of Object.entries(t.values)){let a=r.get(n);if(!a)throw new h(`Sample record "${t.recordId}" uses unknown attribute "${n}"`,[]);Rm(t.recordId,n,a,o);}for(let n of r.values())hs(t.recordId,n,t.values);return {...e,sampleRecords:[...e.sampleRecords,{id:t.recordId,objectId:t.objectId,values:t.values}]}},"apply"),focus:zt,presentation:g(zt,"local"),describe:a(()=>"Ajoute un exemple","describe")},Cm=z$1.object({...ce,type:z$1.literal("remove_sample_record"),recordId:z$1.string().min(1)}),Nm={type:"remove_sample_record",schema:Cm,apply:a((e,t)=>{if(!e.sampleRecords.some(r=>r.id===t.recordId&&r.objectId===t.objectId))throw new h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return {...e,sampleRecords:e.sampleRecords.filter(r=>r.id!==t.recordId)}},"apply"),focus:zt,presentation:g(zt,"local"),describe:a(()=>"Retire un exemple","describe")},As=[bm,ym,Am,wm,Im,vm,Dm,Nm];function Om(){let e=new Map;for(let t of [...As,...ns,...ls]){if(e.has(t.type))throw new r("architect operation",t.type);e.set(t.type,t);}return e}a(Om,"build");var pe=Om(),Ai=[...pe.keys()];function ze(e){let t=pe.get(e.type);if(!t)throw new h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}a(ze,"defOf");function Ti(e,t){return t.reduce((r,n)=>ze(n).apply(r,n),e)}a(Ti,"applyOperations");function km(e){return ze(e).focus(e)}a(km,"focusOf");function _m(e,t){return e.map(r=>ze(r).describe(r,t))}a(_m,"describeOperations");function Pm(e){if(typeof e!="object"||e===null||!("type"in e))throw new h("An operation must be an object carrying a type",[]);let t=e.type;if(typeof t!="string")throw new h("An operation's type must be a string",[]);let r=pe.get(t);if(!r)throw new h(`Unknown operation type "${t}"`,[]);let n=r.schema.safeParse(e);if(!n.success)throw new h(`Operation "${t}" is invalid: ${n.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return n.data}a(Pm,"parseOperation");function Ts(e){return z$1.toJSONSchema(e,{io:"input"})}a(Ts,"toJsonSchema");function Vm(e){let t=pe.get(e);if(!t)throw new h(`Unknown operation type "${e}"`,[]);return Ts(t.schema)}a(Vm,"describeOperationInput");function jm(e){let t=qe.find(r=>r===e);if(!t)throw new h(`Unknown attribute type "${e}"`,[]);return Ts(m(t))}a(jm,"describeAttributeConfig");function Mm(){return {operations:[...Ai],attributeTypes:[...qe]}}a(Mm,"listDescribableNames");function wi(e){return ze(e).presentation(e)}a(wi,"presentationOf");function Lm(e){let t=e.map(wi);return new Set(t.map(({focus:n})=>n.viewId??n.objectId).filter(n=>n!==void 0)).size>1||t.some(({impact:n})=>n==="structural")?"structural":t.some(({impact:n})=>n==="local")?"local":"atomic"}a(Lm,"episodeImpactOf");function Bm(e,t){return e.config.tabs?.find(r=>r.id===t)}a(Bm,"listTabOf");function ws(e,t){let r=t.viewId?e.views.find(o=>o.id===t.viewId):void 0,n=t.tabId?r?.tabs.find(o=>o.id===t.tabId):void 0;if(t.attributeId)return e.attributes.find(o=>o.id===t.attributeId);if(t.attributeName)return e.attributes.find(o=>o.objectId===t.objectId&&o.name===t.attributeName);if(t.fieldId){if(n?.type!=="form")return;for(let o of n.groups){let a=o.fields.find(s=>s.id===t.fieldId);if(a)return a}return}if(t.groupId)return n?.type!=="form"?void 0:n.groups.find(o=>o.id===t.groupId);if(t.tabId)return r?n??Bm(r,t.tabId):void 0;if(t.recordId)return e.sampleRecords.find(o=>o.id===t.recordId);if(r)return r;if(t.objectId)return e.objects.find(o=>o.id===t.objectId)}a(ws,"snapshotArchitectTarget");function Um(e,t){let r=e;return t.map(n=>{let o=wi(n),a=ws(r,o.focus);r=Ti(r,[n]);let s=ws(r,o.focus);return {operationId:n.id,operationType:n.type,presentation:o,before:a,after:s}})}a(Um,"deriveArchitectChanges");function $m(e){return {id:e.id??"",objectName:e.object,type:e.type,label:e.label,tabs:tt(e)?e.config.tabs??[]:[],config:e.config}}a($m,"toDraftableView");function Ge(e){return e.type==="detail"?{...e.config,tabs:e.tabs}:e.config}a(Ge,"persistedViewConfig");function qm(e,t){return e.type==="detail"?{...e,label:t.label,config:Ge(t)}:{...e,label:t.label,config:Ge(t)}}a(qm,"fromDraftableView");function zm(e){let t={id:e.id,name:"default",label:e.label,object:e.objectName,default:true};return e.type==="detail"?{...t,type:"detail",config:Ge(e)}:{...t,type:"list",config:Ge(e)}}a(zm,"draftedViewDefinition");export{jw as AGENT_UI_BATCH_MAX_BYTES,Mw as AGENT_UI_BATCH_MAX_ITEMS,bo as ALLOWED_PROPERTY_TYPES,rr as ALL_ACTIONS,Ai as ALL_OPERATION_TYPES,rA as ALL_SYSTEM_RESOURCES,Rg as ARTIFACT_FILE_ROLES,Sg as ARTIFACT_KINDS,yl as ARTIFACT_LIST_VIEW,fl as ARTIFACT_OBJECT,Tt as ARTIFACT_OBJECT_NAME,vg as ARTIFACT_RETENTIONS,bl as ARTIFACT_VIEW,Xi as ATTRIBUTE_TYPES,Ub as AUDIT_ACTIONS,Bb as AUDIT_RESOURCE_TYPES,rn as ActivityTabConfig,ur as AgentBuilder,Nb as BEHAVIOR_PROPERTIES,lu as BYTE_UNIT_LABELS,Ys as CLAIMABLE_SESSION_STATUSES,je as COMPUTED_FUNCTIONS,wx as COMPUTED_FUNCTION_METADATA,ex as COMPUTED_FUNCTION_NAMES,Kx as CONNECTOR_CALLBACK_PARAM,mo as COUNT_MODES,b as ComputedFormulaCompileError,en as CustomTabConfig,eA as DB_COLUMN_FIELDS,No as DEFAULT_AGENT_EXECUTION_CONFIG,eo as DEFAULT_APPROVAL_POLICY,xg as DEFAULT_DICTATION_LIMITS,Ao as DEFAULT_LABEL_FALLBACK,nu as DEFAULT_MEETING_BOT_DISPLAY_NAME,Mu as DEFAULT_ROLES,oA as DEFAULT_ROLE_DESCRIPTIONS,iA as DEFAULT_ROLE_LABELS,aA as DEFAULT_ROLE_PERMISSIONS,ry as DEFAULT_TENANT_SETTINGS,Tg as DICTATION_FINALIZATION_TIMEOUT_MS,fg as DICTATION_FRAME_BYTES,gg as DICTATION_MAX_BUFFER_BYTES,bg as DICTATION_MAX_FRAME_BYTES,yg as DICTATION_MAX_TRANSCRIPT_BYTES,wg as DICTATION_MODEL_ID,Ag as DICTATION_PREPARATION_TIMEOUT_MS,mg as DICTATION_SAMPLE_RATE,hg as DICTATION_TICKET_TTL_MS,yh as DOCUMENT_SYSTEM_ATTRIBUTES,qe as DRAFTABLE_ATTRIBUTE_TYPES,ml as DRIVE_LIST_VIEW,cl as DRIVE_OBJECT,At as DRIVE_OBJECT_NAME,pl as DRIVE_VIEW,sn as DetailViewBuilder,an as DocumentsTabConfig,nt as EMPTY_VALUE_PLACEHOLDER,gy as ESTIMATED_COUNT_CAP,nn as EmailsTabConfig,Xx as FAKE_MEETING_BOT_SIGNATURE_HEADER,Zt as FORM_FORBIDDEN_ATTRIBUTE_TYPES,ke as FlagRegistry,ht as FlagService,Yr as FormBuilder,Ve as FormRegistry,Wr as FormRowBuilder,Kr as FormStepBuilder,mt as GroupBuilder,Cb as IDENTITY_PROPERTIES,py as IMAGE_FORMATS,no as INFERENCE_REASONING_OPTIONS,ro as INFERENCE_SPEEDS,_l as LIVE_EVENT_TYPES,un as ListViewBuilder,ln as ListViewTabConfigBuilder,ao as MAX_PRESET_DEPTH,rg as MAX_TODOS,ig as MAX_TODO_DESCRIPTION_CHARS,ng as MAX_TODO_ID_CHARS,og as MAX_TODO_RESULT_CHARS,T as MEETING_ATTRIBUTES,$o as MEETING_DETAIL_VIEW_ID,Tl as MEETING_LIST_VIEW,Bo as MEETING_LIST_VIEW_ID,hl as MEETING_OBJECT,wt as MEETING_OBJECT_NAME,Al as MEETING_VIEW,Uo as MEETING_WRITE_SOURCE,dl as MEMORY_LIST_VIEW,ul as MEMORY_OBJECT,ll as MEMORY_VIEW,wc as McpOAuthCompletionMode,on as MeetingsTabConfig,Js as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,Xs as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,Qi as NOTIFICATION_INBOX_STATES,Ki as NOTIFICATION_KINDS,Yi as NOTIFICATION_PRIORITIES,Hi as NOTIFICATION_SENSITIVITIES,Eb as NOTIFICATION_TYPES_V1,Ws as NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED,zs as NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN,Gs as NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED,Ji as NOTIFICATION_WORK_STATES,Zx as NO_RECORDING,lo as NoopGeocodingAdapter,at as OBJECT_NAME_SCHEMA,Hs as OPEN_TOOL_PART_STATES,pe as OPERATION_REGISTRY,_t as OPERATOR_SPECS,Oe as ObjectBuilder,Ob as PRESENTATION_PROPERTIES,to as PROVIDER_NAMES,Sh as QUALIFIED_SEPARATOR,Ay as QUOTA_KEYS,Qx as RECORDING_OVERRIDES,Jx as RECORDING_POLICIES,vo as RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY,Ze as RELATION_TARGET_ANY,tn as RichtextTabConfig,$ as SCHEMA_PLAN_LIMITS,ai as SCHEMA_SOURCE_ID_PATTERN,lg as SESSION_STATE_STREAM_ID,Ks as SESSION_TERMINAL_STATUSES,jo as SKILL_CONTENT_TEMPLATE,ol as SKILL_LIST_VIEW,nl as SKILL_OBJECT,il as SKILL_VIEW,qu as STANDARD_SCHEMA_VENDOR,Xt as SYSTEM_PART_CODES,L as SYSTEM_RESOURCES,nA as SYSTEM_RESOURCE_LABELS,ha as TODAY_DEFAULT,Hb as TODO_PLAN_STATUSES,tg as TODO_STATUSES,io as TOOL_APPROVAL_STATES,J as TabBuilder,ft as TableTabConfig,Ip as UPDATE_TABLE_TAB_CHANGE_KEYS,rp as UPDATE_TAB_CHANGE_KEYS,Sp as UPDATE_TAB_CONFIG_CHANGE_KEYS,iy as USER_STATUSES,oy as USER_WORK_POSTURES,Qg as accessLevelToActions,Hg as actionsToAccessLevel,AA as agent,OI as agentDataChunk,Qb as agentDisplayName,DI as agentInferencePreferencesSchema,Lc as agentMessageAttachmentSchema,Mc as agentMessagePartSchema,jc as agentSessionInferenceOverridesInputSchema,CI as agentSessionInferenceOverridesSchema,Fa as agentSessionMessageSchema,Wc as agentUIValidationError,Ti as applyOperations,vu as applyPipes,Nu as applyRelationProps,ox as assertAcyclicComputedDependencies,Kc as assertCustomAgentUIMessageChunk,Sc as assertSchemaSourceId,Ku as booleanFlag,Ta as buildAgentFallbackTitle,ju as buildPermissionFlags,rt as buildPropertySchema,Rh as buildQualifiedAttribute,Oo as checkbox,Qs as compareAgentSessionMessages,ra as compileComputedFormula,lx as compileRollupAttribute,uu as computeByteMagnitude,Ic as conversationDisplayTitle,Xu as createFlagRegistry,el as createFlagService,ut as createStandardSchemaProps,kA as currency,Ba as customDataChunkSchemas,U as date,Pt as dateInTimezone,ge as dateValueStart,bi as defaultViewIdsFor,gi as defaultViewsFor,Ft as defineOperation,g as definePresentation,Um as deriveArchitectChanges,zx as deriveCreateDefaultsFromFilters,Fu as deriveInitials,jm as describeAttributeConfig,Vm as describeOperationInput,_m as describeOperations,Na as destructiveSchema,z as detailView,ko as document,cs as draftedLabelExpression,$t as draftedObjectDefinition,zm as draftedViewDefinition,$c as durableDateSchema,mi as ensureFieldIds,Lm as episodeImpactOf,gx as evaluateComputedAst,yx as evaluateComputedFormula,hx as evaluateComputedFormulaWithResult,fc as evaluateFilterState,Vx as evaluateRecordFilterState,xo as extractAttributeNames,So as extractValueRefs,Ju as flagRegistry,km as focusOf,GA as form,ru as formFieldFlatKey,tu as formFieldKey,Go as formRegistry,_w as formatAgentStreamFrameId,go as formatAttributeValue,ph as formatByteSize,lc as formatComputedResult,yu as formatLocationValue,jA as formula,qm as fromDraftableView,Pe as generateDefaultDetailView,Fe as generateDefaultListView,xw as getActiveTab,Du as getEditableLabelAttribute,Cg as getErrorMessage,du as getListViewDisplayAttributeNames,Qw as getLiveProtocolPayloadChannel,Vu as getRecordCreatorPrincipalId,Io as getSingleAttributeFromExpression,uo as getSlotFieldTargets,_u as getUserDisplayName,dT as group,uI as hasDestructiveEntries,Zg as hasOptions,Ma as imageModelIdSchema,he as includesAction,Vb as inferInverseCardinality,Hd as inferRollupReturnType,di as inferenceReasoningSchema,li as inferenceSpeedSchema,Gc as isAgentUIDataName,Lw as isAgentUIMessageBatch,jb as isAttributeSortable,Fb as isBilateralRelation,vx as isCheckboxEquality,Yb as isClaimableSessionStatus,St as isComputedFunctionName,ee as isDateRangeValue,sA as isDefaultRole,tt as isDetailView,hh as isDocumentAttribute,au as isEmptyObject,iu as isFieldGroup,_g as isFormDefinition,et as isFormFieldsRow,er as isFormFreeFieldRef,Bg as isFormHeadingRow,Ug as isFormSeparatorRow,so as isFormSlotFieldRef,$g as isFormTextRow,ot as isLabelExpression,po as isListView,Jw as isLiveEventEnvelope,Ww as isLiveEventPayload,$l as isLiveEventPayloadForType,Ul as isLiveEventType,fo as isNotEmpty,Jb as isOpenToolPartState,da as isPlainRecord,xA as isStandardSchema,Zb as isSystemPartCode,Kb as isTerminalSessionStatus,zb as isTerminalState,Xb as isToolApprovalState,Zi as isUniversalRelation,Qu as jsonFlag,Wb as legacyStatusToSessionState,Mm as listDescribableNames,G as listView,$w as liveChannelKey,FA as location,ds as makeFieldId,Ah as matchesAccepts,Bc as mentionReferenceSchema,Uc as modelDefinitionSchema,ja as modelReferenceSchema,PA as multiselect,eu as nativeAgentUIPartIdMetadataKey,cu as normalizeDateValue,dt as number,Hu as numberFlag,nT as object,eg as orderAgentSessionMessages,Pw as parseAgentStreamFrameId,ou as parseCountMode,Ko as parseLiveChannelKey,dg as parseNativeAgentUIPartIdsMetadata,Pm as parseOperation,by as parseOptionalCountMode,vh as parseQualifiedAttribute,kc as persistedDefaultViewTargetSchema,xI as persistedSchemaPlanSchema,Ge as persistedViewConfig,OA as phone,Dc as plannedAttributeSchema,Cc as plannedInlineAttributeSchema,Nc as plannedObjectSchema,wi as presentationOf,Oc as proposedDefaultViewTargetSchema,Va as providerNameSchema,ku as qualifiedPropertyDefs,jg as readFormFieldValue,yi as regenerateDerived,MT as registry,we as relation,Ou as relationPropertyDefs,Pb as relationTargetsOf,ir as renderLabelExpression,Dl as resetViewToDefault,Ac as resolveAttributeDefaultValue,Vg as resolveFieldRequired,co as resolvePropertyDefinitions,Te as richtext,MA as rollup,Yd as rollupToFormulaExpression,wI as schemaPlanSchema,q as select,NI as sessionInferencePatchSchema,Gb as sessionStateToLegacyStatus,_A as status,Yu as stringFlag,f as text,Ut as toAttribute,lm as toDraftableAttributes,um as toDraftableObject,$m as toDraftableView,su as toUndefinedIfEmpty,qc as todoItemSchema,zc as todoPlanSchema,La as toolImpactSchema,VA as user,Ne as validateAttributeName,Su as validateLabelExpression,Gu as validateObjectExpressions,Ce as validateObjectName,st as validateViewName,fi as viewIdFor,wl as viewRegistry,sy as viewStateKey,vc as viewSyncPayload};